blob: 1fe58714db8ceceece071f910c420c915a4b3523 [file] [log] [blame]
Chris Allegretta11b00112000-08-06 21:13:45 +00001/* $Id$ */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00002/**************************************************************************
3 * proto.h *
4 * *
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +00005 * Copyright (C) 1999-2005 Chris Allegretta *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00006 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
Chris Allegretta3a24f3f2001-10-24 11:33:54 +00008 * the Free Software Foundation; either version 2, or (at your option) *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00009 * any later version. *
10 * *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000011 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * General Public License for more details. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000015 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
19 * 02110-1301, USA. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000020 * *
21 **************************************************************************/
22
David Lawrence Ramseye527e452005-04-15 18:07:26 +000023#ifndef PROTO_H
24#define PROTO_H 1
25
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +000026/* Externs. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000027#include "nano.h"
28
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000029#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey691698a2005-07-24 19:57:51 +000030extern ssize_t fill;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000031extern ssize_t wrap_at;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000032#endif
Chris Allegretta17dcb722001-01-20 21:40:07 +000033extern int editwinrows;
David Lawrence Ramseydb958022005-07-13 20:18:46 +000034extern long flags;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000035extern ssize_t tabsize;
Chris Allegretta6b58acd2001-04-12 03:01:53 +000036extern int currslen;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000037
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000038#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000039extern char *whitespace;
David Lawrence Ramsey6e60db62005-03-10 22:52:21 +000040extern int whitespace_len[2];
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000041#endif
42
Chris Allegrettae4f940d2002-03-03 22:36:36 +000043#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000044extern char *punct;
45extern char *brackets;
Chris Allegretta45329a12002-03-10 01:22:21 +000046extern char *quotestr;
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000047#ifdef HAVE_REGEX_H
48extern regex_t quotereg;
49extern int quoterc;
50extern char *quoteerr;
51#else
52extern size_t quotelen;
53#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000054#endif
55
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000056#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000057extern char *backup_dir;
58#endif
59
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +000060extern WINDOW *topwin, *edit, *bottomwin;
David Lawrence Ramsey26f61a42005-10-28 17:14:11 +000061extern char *answer;
Chris Allegretta27eb13f2000-11-05 16:52:21 +000062extern char *last_search;
63extern char *last_replace;
Chris Allegrettae1f14522001-09-19 03:19:43 +000064#ifndef DISABLE_OPERATINGDIR
65extern char *operating_dir;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +000066extern char *full_operating_dir;
Chris Allegrettae1f14522001-09-19 03:19:43 +000067#endif
Chris Allegretta8d8e0122001-04-18 04:28:54 +000068#ifndef DISABLE_SPELLER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000069extern char *alt_speller;
Chris Allegretta6df90f52002-07-19 01:08:59 +000070#endif
71
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000072extern struct stat fileinfo;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000073extern filestruct *cutbuffer;
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000074#ifndef DISABLE_JUSTIFY
75extern filestruct *jusbuffer;
76#endif
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +000077extern partition *filepart;
Chris Allegretta2d7893d2001-07-11 02:08:33 +000078
David Lawrence Ramsey64661ac2005-07-08 19:57:25 +000079extern openfilestruct *openfile;
Chris Allegretta2d7893d2001-07-11 02:08:33 +000080
Chris Allegretta08893e02001-11-29 02:42:27 +000081#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +000082extern syntaxtype *syntaxes;
Chris Allegretta09900ff2002-05-04 04:23:30 +000083extern char *syntaxstr;
Chris Allegretta08893e02001-11-29 02:42:27 +000084#endif
85
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000086extern shortcut *shortcut_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +000087extern shortcut *main_list, *whereis_list;
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +000088extern shortcut *replace_list, *gotoline_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +000089extern shortcut *writefile_list, *insertfile_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +000090extern shortcut *replace_list_2;
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000091#ifndef NANO_TINY
Chris Allegretta7162e3d2002-04-06 05:02:14 +000092extern shortcut *extcmd_list;
93#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +000094#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +000095extern shortcut *help_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +000096#endif
97#ifndef DISABLE_SPELLER
98extern shortcut *spell_list;
99#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000100#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000101extern shortcut *browser_list, *gotodir_list;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000102#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000103
Chris Allegretta6df90f52002-07-19 01:08:59 +0000104extern const shortcut *currshortcut;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000105
106#ifdef HAVE_REGEX_H
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000107extern regex_t search_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000108extern regmatch_t regmatches[10];
Chris Allegretta3533a342002-03-24 23:19:32 +0000109#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000110extern regex_t syntaxfile_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000111extern regmatch_t synfilematches[1];
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000112#endif
113#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000114
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000115#ifndef NANO_TINY
Chris Allegretta6df90f52002-07-19 01:08:59 +0000116extern toggle *toggles;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000117#endif
118
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000119#ifndef NANO_TINY
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000120extern filestruct *search_history;
121extern filestruct *searchage;
122extern filestruct *searchbot;
123extern filestruct *replace_history;
124extern filestruct *replaceage;
125extern filestruct *replacebot;
Chris Allegretta5beed502003-01-05 20:41:21 +0000126#endif
127
David Lawrence Ramsey76356bd2004-08-12 04:30:22 +0000128extern bool curses_ended;
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000129
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000130extern char *homedir;
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000131
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +0000132/* The functions we want available. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000133
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000134/* Public functions in browser.c. */
135#ifndef DISABLE_BROWSER
136char *do_browser(char *path, DIR *dir);
137char **browser_init(const char *path, int *longest, size_t *numents, DIR
138 *dir);
139char *do_browse_from(const char *inpath);
140void striponedir(char *path);
141#endif
142
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000143/* Public functions in chars.c. */
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000144#ifndef HAVE_ISBLANK
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000145bool nisblank(int c);
David Lawrence Ramsey77abec72005-03-16 17:00:27 +0000146#endif
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000147#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000148bool niswblank(wchar_t wc);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000149#endif
David Lawrence Ramsey356d2482005-06-13 19:51:56 +0000150bool is_byte(int c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000151bool is_alnum_mbchar(const char *c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000152bool is_blank_mbchar(const char *c);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000153bool is_cntrl_char(int c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000154#ifdef ENABLE_UTF8
David Lawrence Ramseyed7ad332005-06-15 16:07:14 +0000155bool is_cntrl_wchar(wchar_t wc);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000156#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000157bool is_cntrl_mbchar(const char *c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000158bool is_punct_mbchar(const char *c);
David Lawrence Ramseye2213112005-06-15 03:03:45 +0000159bool is_word_mbchar(const char *c, bool allow_punct);
David Lawrence Ramsey19462612005-06-12 18:05:42 +0000160char control_rep(char c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000161#ifdef ENABLE_UTF8
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000162wchar_t control_wrep(wchar_t c);
163#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000164char *control_mbrep(const char *c, char *crep, int *crep_len);
David Lawrence Ramsey96452cb2005-07-26 06:13:45 +0000165char *mbrep(const char *c, char *crep, int *crep_len);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000166int mbwidth(const char *c);
167int mb_cur_max(void);
David Lawrence Ramsey8b006c22005-08-08 23:03:25 +0000168char *make_mbchar(long chr, int *chr_mb_len);
David Lawrence Ramsey96452cb2005-07-26 06:13:45 +0000169int parse_mbchar(const char *buf, char *chr, size_t *col);
David Lawrence Ramseyd24fbb72005-01-14 21:50:32 +0000170size_t move_mbleft(const char *buf, size_t pos);
171size_t move_mbright(const char *buf, size_t pos);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000172#ifndef HAVE_STRCASECMP
173int nstrcasecmp(const char *s1, const char *s2);
174#endif
175int mbstrcasecmp(const char *s1, const char *s2);
176#ifndef HAVE_STRNCASECMP
177int nstrncasecmp(const char *s1, const char *s2, size_t n);
178#endif
179int mbstrncasecmp(const char *s1, const char *s2, size_t n);
180#ifndef HAVE_STRCASESTR
181const char *nstrcasestr(const char *haystack, const char *needle);
182#endif
David Lawrence Ramsey42abfe02005-01-22 18:24:16 +0000183const char *mbstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000184#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000185const char *revstrstr(const char *haystack, const char *needle, const
186 char *rev_start);
David Lawrence Ramsey7b601fd2005-06-13 13:25:36 +0000187#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000188#ifndef NANO_TINY
David Lawrence Ramsey3ee4cf32005-01-22 20:49:14 +0000189const char *revstrcasestr(const char *haystack, const char *needle,
190 const char *rev_start);
David Lawrence Ramsey345260c2005-01-24 01:14:17 +0000191const char *mbrevstrcasestr(const char *haystack, const char *needle,
192 const char *rev_start);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000193#endif
David Lawrence Ramsey3f9c6352005-01-25 19:21:11 +0000194size_t mbstrlen(const char *s);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000195#ifndef HAVE_STRNLEN
196size_t nstrnlen(const char *s, size_t maxlen);
197#endif
198size_t mbstrnlen(const char *s, size_t maxlen);
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000199#ifndef NANO_TINY
200char *revstrpbrk(const char *s, const char *accept, const char
201 *rev_start);
202#endif
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000203#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey66444c32005-07-21 18:05:27 +0000204char *mbstrchr(const char *s, char *c);
David Lawrence Ramseyd5d4dde2005-06-14 01:55:56 +0000205#ifdef ENABLE_NANORC
206bool has_blank_chars(const char *s);
207bool has_blank_mbchars(const char *s);
208#endif
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000209#endif
David Lawrence Ramsey6ff695c2005-08-05 03:14:29 +0000210#ifdef ENABLE_UTF8
211bool is_valid_unicode(wchar_t wc);
212#endif
David Lawrence Ramseybdfa9272005-06-14 23:36:13 +0000213#ifdef ENABLE_NANORC
214bool is_valid_mbstring(const char *s);
215#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000216
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000217/* Public functions in color.c. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000218#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000219void set_colorpairs(void);
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000220void color_init(void);
David Lawrence Ramsey43cf7a12005-07-14 18:31:45 +0000221void color_update(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000222#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000223
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000224/* Public functions in cut.c. */
David Lawrence Ramseyc833d9e2004-05-29 15:36:58 +0000225void cutbuffer_reset(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000226void cut_line(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000227#ifndef NANO_TINY
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000228void cut_marked(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000229void cut_to_eol(void);
David Lawrence Ramseyb80d49f2005-03-26 22:49:46 +0000230#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000231void do_cut_text(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000232#ifndef NANO_TINY
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000233void do_cut_till_end(void);
234#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000235void do_uncut_text(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000236
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000237/* Public functions in files.c. */
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000238void make_new_buffer(void);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000239void initialize_buffer(void);
David Lawrence Ramseyc00513b2005-07-23 00:41:45 +0000240void initialize_buffer_text(void);
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000241void open_buffer(const char *filename);
David Lawrence Ramsey9c984e82005-11-08 19:15:58 +0000242#ifndef DISABLE_SPELLER
243void replace_buffer(const char *filename);
244#endif
David Lawrence Ramseye5c7e922005-07-12 23:06:22 +0000245void display_buffer(void);
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000246#ifdef ENABLE_MULTIBUFFER
247void switch_to_prevnext_buffer(bool next);
248void switch_to_prev_buffer_void(void);
249void switch_to_next_buffer_void(void);
250bool close_buffer(void);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000251#endif
David Lawrence Ramsey50995bd2005-05-16 20:13:09 +0000252filestruct *read_line(char *buf, filestruct *prevnode, bool
David Lawrence Ramsey483f3ac2005-06-19 19:57:13 +0000253 *first_line_ins, size_t buf_len);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000254void read_file(FILE *f, const char *filename);
255int open_file(const char *filename, bool newfie, FILE **f);
David Lawrence Ramseyb9b57222005-05-29 02:22:55 +0000256char *get_next_filename(const char *name, const char *suffix);
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000257void do_insertfile(
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000258#ifndef NANO_TINY
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000259 bool execute
260#else
261 void
262#endif
263 );
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000264void do_insertfile_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000265char *get_full_path(const char *origpath);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000266char *check_writable_directory(const char *path);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000267char *safe_tempfile(FILE **f);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000268#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000269void init_operating_dir(void);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000270bool check_operating_dir(const char *currpath, bool allow_tabcomp);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000271#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000272#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000273void init_backup_dir(void);
274#endif
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000275int copy_file(FILE *inn, FILE *out);
David Lawrence Ramseybf0e47d2005-08-01 18:27:10 +0000276int write_file(const char *name, FILE *f_open, bool tmp, append_type
277 append, bool nonamechange);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000278#ifndef NANO_TINY
David Lawrence Ramseybf0e47d2005-08-01 18:27:10 +0000279int write_marked_file(const char *name, FILE *f_open, bool tmp,
280 append_type append);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000281#endif
David Lawrence Ramsey951d7142004-10-04 15:23:47 +0000282int do_writeout(bool exiting);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000283void do_writeout_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000284char *real_dir_from_tilde(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000285#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
286int diralphasort(const void *va, const void *vb);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000287void free_chararray(char **array, size_t len);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000288#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000289#ifndef DISABLE_TABCOMP
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000290char **username_tab_completion(const char *buf, size_t *num_matches,
291 size_t buflen);
292char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
293 buflen);
294char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
Chris Allegretta7662c862003-01-13 01:35:15 +0000295#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000296const char *tail(const char *foo);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000297#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000298char *histfilename(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000299void load_history(void);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000300bool writehist(FILE *hist, filestruct *histhead);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000301void save_history(void);
302#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000303
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000304/* Public functions in global.c. */
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000305size_t length_of_list(const shortcut *s);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000306#ifndef NANO_TINY
David Lawrence Ramsey2ad32092004-07-07 14:36:44 +0000307void toggle_init_one(int val, const char *desc, long flag);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000308void toggle_init(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000309#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000310void sc_init_one(shortcut **shortcutage, int key, const char *desc,
311#ifndef DISABLE_HELP
312 const char *help,
313#endif
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000314 int metaval, int funcval, int miscval, bool view, void
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000315 (*func)(void));
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000316void shortcut_init(bool unjustify);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000317void free_shortcutage(shortcut **shortcutage);
Chris Allegretta6232d662002-05-12 19:52:15 +0000318#ifdef DEBUG
Chris Allegrettadab017e2002-04-23 10:56:06 +0000319void thanks_for_all_the_fish(void);
Chris Allegretta6232d662002-05-12 19:52:15 +0000320#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000321
David Lawrence Ramsey7e2d6732005-11-01 19:32:45 +0000322/* Public functions in help.c. */
323#ifndef DISABLE_HELP
David Lawrence Ramsey7e2d6732005-11-01 19:32:45 +0000324void do_help(void);
David Lawrence Ramseyd420b5a2005-11-01 23:00:56 +0000325void help_init(void);
David Lawrence Ramseyc3593012005-11-01 20:11:55 +0000326size_t help_line_len(const char *ptr);
David Lawrence Ramsey7e2d6732005-11-01 19:32:45 +0000327#endif
328
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000329/* Public functions in move.c. */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000330void do_first_line(void);
331void do_last_line(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000332void do_page_up(void);
333void do_page_down(void);
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000334#ifndef DISABLE_JUSTIFY
335void do_para_begin(bool allow_update);
336void do_para_begin_void(void);
337void do_para_end(bool allow_update);
338void do_para_end_void(void);
339#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000340#ifndef NANO_TINY
David Lawrence Ramseyc4037f32005-07-20 21:31:19 +0000341bool do_next_word(bool allow_punct, bool allow_update);
342void do_next_word_void(void);
343bool do_prev_word(bool allow_punct, bool allow_update);
344void do_prev_word_void(void);
345#endif
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000346void do_home(void);
347void do_end(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000348void do_up(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000349#ifndef NANO_TINY
David Lawrence Ramsey2de84c12005-10-24 02:12:09 +0000350void do_scroll_up(void);
351#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000352void do_down(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000353#ifndef NANO_TINY
David Lawrence Ramsey2de84c12005-10-24 02:12:09 +0000354void do_scroll_down(void);
355#endif
David Lawrence Ramsey1c3bfa92005-09-13 04:53:44 +0000356void do_left(void);
357void do_right(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000358
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000359/* Public functions in nano.c. */
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000360filestruct *make_new_node(filestruct *prevnode);
361filestruct *copy_node(const filestruct *src);
362void splice_node(filestruct *begin, filestruct *newnode, filestruct
363 *end);
364void unlink_node(const filestruct *fileptr);
365void delete_node(filestruct *fileptr);
366filestruct *copy_filestruct(const filestruct *src);
367void free_filestruct(filestruct *src);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000368void renumber(filestruct *fileptr);
369partition *partition_filestruct(filestruct *top, size_t top_x,
370 filestruct *bot, size_t bot_x);
371void unpartition_filestruct(partition **p);
372void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
373 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
374void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
David Lawrence Ramseye99494f2005-07-20 21:08:38 +0000375openfilestruct *make_new_opennode(void);
376void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
377 openfilestruct *end);
378void unlink_opennode(openfilestruct *fileptr);
379void delete_opennode(openfilestruct *fileptr);
380#ifdef DEBUG
381void free_openfilestruct(openfilestruct *src);
382#endif
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000383void print_view_warning(void);
David Lawrence Ramseyda141062004-05-25 19:41:11 +0000384void finish(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000385void die(const char *msg, ...);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000386void die_save_file(const char *die_filename);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000387void window_init(void);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000388#ifndef DISABLE_MOUSE
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000389void mouse_init(void);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000390#endif
David Lawrence Ramsey39e8ce62005-03-21 07:24:47 +0000391void print1opt_full(const char *shortflag
392#ifdef HAVE_GETOPT_LONG
393 , const char *longflag
394#endif
395 , const char *desc);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000396void usage(void);
397void version(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000398int no_more_space(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000399int no_help(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000400void nano_disabled_msg(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000401void do_exit(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000402void signal_init(void);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000403void handle_hupterm(int signal);
404void do_suspend(int signal);
405void do_cont(int signal);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000406#ifndef NANO_TINY
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000407void handle_sigwinch(int s);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000408void allow_pending_sigwinch(bool allow);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000409#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000410#ifndef NANO_TINY
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000411void do_toggle(const toggle *which);
412#endif
David Lawrence Ramsey8bcac8a2005-06-09 04:02:57 +0000413void disable_extended_io(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000414void disable_signals(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000415#ifndef NANO_TINY
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000416void enable_signals(void);
417#endif
418void disable_flow_control(void);
419void enable_flow_control(void);
David Lawrence Ramsey8aaf0302004-07-27 16:46:35 +0000420void terminal_init(void);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000421int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000422 *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000423#ifndef DISABLE_MOUSE
424bool do_mouse(void);
425#endif
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000426void do_output(char *output, size_t output_len, bool allow_cntrls);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000427
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000428/* Public functions in prompt.c. */
429int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
430 bool *ran_func, bool *finished, bool allow_funcs);
431#ifndef DISABLE_MOUSE
432bool do_statusbar_mouse(void);
433#endif
434void do_statusbar_output(char *output, size_t output_len, bool
435 *got_enter, bool allow_cntrls);
436void do_statusbar_home(void);
437void do_statusbar_end(void);
438void do_statusbar_right(void);
439void do_statusbar_left(void);
440void do_statusbar_backspace(void);
441void do_statusbar_delete(void);
442void do_statusbar_cut_text(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000443#ifndef NANO_TINY
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000444bool do_statusbar_next_word(bool allow_punct);
445bool do_statusbar_prev_word(bool allow_punct);
446#endif
447void do_statusbar_verbatim_input(bool *got_enter);
David Lawrence Ramseyc4993822005-11-16 04:14:03 +0000448#ifndef NANO_TINY
449void do_statusbar_find_bracket(void);
450#endif
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000451size_t statusbar_xplustabs(void);
452size_t get_statusbar_page_start(size_t start_col, size_t column);
David Lawrence Ramseye19449e2005-11-07 21:45:44 +0000453void update_statusbar_line(const char *curranswer, size_t index);
454void reset_statusbar_cursor(void);
455bool need_statusbar_horizontal_update(size_t old_pww);
456int get_prompt_string(bool allow_tabs, const char *curranswer,
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000457#ifndef NANO_TINY
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000458 filestruct **history_list,
459#endif
460 const shortcut *s
461#ifndef DISABLE_TABCOMP
462 , bool *list
463#endif
464 );
David Lawrence Ramseye19449e2005-11-07 21:45:44 +0000465int do_prompt(bool allow_tabs, const shortcut *s, const char
466 *curranswer,
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000467#ifndef NANO_TINY
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000468 filestruct **history_list,
469#endif
470 const char *msg, ...);
David Lawrence Ramseye19449e2005-11-07 21:45:44 +0000471void do_prompt_abort(void);
472int do_yesno_prompt(bool all, const char *msg);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000473
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000474/* Public functions in rcfile.c. */
Chris Allegretta7a500092001-04-19 21:13:46 +0000475#ifdef ENABLE_NANORC
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000476void rcfile_error(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000477char *parse_next_word(char *ptr);
478char *parse_argument(char *ptr);
479#ifdef ENABLE_COLOR
David Lawrence Ramsey150d8892005-07-24 20:23:40 +0000480short color_to_short(const char *colorname, bool *bright);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000481char *parse_next_regex(char *ptr);
David Lawrence Ramsey2385c1a2005-07-29 21:42:08 +0000482bool nregcomp(const char *regex, int eflags);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000483void parse_syntax(char *ptr);
David Lawrence Ramsey23555f22005-06-27 03:07:10 +0000484void parse_colors(char *ptr, bool icase);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000485#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000486void parse_rcfile(FILE *rcstream);
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000487void do_rcfile(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000488#endif
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000489
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000490/* Public functions in search.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000491#ifdef HAVE_REGEX_H
Chris Allegretta5d715142003-01-29 04:18:37 +0000492int regexp_init(const char *regexp);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000493void regexp_cleanup(void);
494#endif
495void not_found_msg(const char *str);
496void search_abort(void);
497void search_init_globals(void);
David Lawrence Ramseyd532f192004-10-04 22:37:56 +0000498int search_init(bool replacing, bool use_answer);
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000499bool findnextstr(bool whole_word, bool no_sameline, const filestruct
500 *begin, size_t begin_x, const char *needle, size_t *needle_len);
David Lawrence Ramseye5e88fd2004-10-31 13:20:30 +0000501void findnextstr_wrap_reset(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000502void do_search(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000503#ifndef NANO_TINY
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000504void do_research(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000505#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000506void replace_abort(void);
507#ifdef HAVE_REGEX_H
David Lawrence Ramseye3970f52005-05-26 03:47:24 +0000508int replace_regexp(char *string, bool create);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000509#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000510char *replace_line(const char *needle);
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000511ssize_t do_replace_loop(bool whole_word, bool *canceled, const
512 filestruct *real_current, size_t *real_current_x, const char
513 *needle);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000514void do_replace(void);
David Lawrence Ramsey5beae582005-06-29 00:17:18 +0000515void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
David Lawrence Ramsey8f1afee2005-07-16 07:06:36 +0000516 bool interactive, bool save_pos, bool allow_update);
David Lawrence Ramsey9245f972005-05-17 18:06:26 +0000517void do_gotolinecolumn_void(void);
David Lawrence Ramsey8f4762a2005-07-16 22:35:11 +0000518#ifndef DISABLE_SPELLER
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000519void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
520 pos_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000521#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000522#ifndef NANO_TINY
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000523bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000524void do_find_bracket(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000525#ifdef ENABLE_NANORC
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000526bool history_has_changed(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000527#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000528void history_init(void);
David Lawrence Ramsey0e581b32005-07-18 07:48:50 +0000529void history_reset(const filestruct *h);
David Lawrence Ramsey96e6d562005-07-19 04:53:45 +0000530filestruct *find_history(const filestruct *h_start, const filestruct
531 *h_end, const char *s, size_t len);
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000532void update_history(filestruct **h, const char *s);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000533char *get_history_older(filestruct **h);
534char *get_history_newer(filestruct **h);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000535#ifndef DISABLE_TABCOMP
David Lawrence Ramsey96e6d562005-07-19 04:53:45 +0000536char *get_history_completion(filestruct **h, const char *s, size_t len);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000537#endif
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000538#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000539
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000540/* Public functions in text.c. */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000541#ifndef NANO_TINY
David Lawrence Ramsey7ea09e52005-07-25 02:41:59 +0000542void do_mark(void);
543#endif
544void do_delete(void);
545void do_backspace(void);
546void do_tab(void);
547void do_enter(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000548#ifndef NANO_TINY
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000549void cancel_command(int signal);
550bool execute_command(const char *command);
551#endif
552#ifndef DISABLE_WRAPPING
553void wrap_reset(void);
554bool do_wrap(filestruct *line);
555#endif
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000556#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
557ssize_t break_line(const char *line, ssize_t goal, bool newline);
558#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000559#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000560size_t indent_length(const char *line);
561#endif
562#ifndef DISABLE_JUSTIFY
563void justify_format(filestruct *paragraph, size_t skip);
564size_t quote_length(const char *line);
565bool quotes_match(const char *a_line, size_t a_quote, const char
566 *b_line);
567bool indents_match(const char *a_line, size_t a_indent, const char
568 *b_line, size_t b_indent);
569bool begpar(const filestruct *const foo);
570bool inpar(const filestruct *const foo);
David Lawrence Ramseycd8f7352005-11-10 21:20:32 +0000571void backup_lines(filestruct *first_line, size_t par_len);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000572bool find_paragraph(size_t *const quote, size_t *const par);
573void do_justify(bool full_justify);
574void do_justify_void(void);
575void do_full_justify(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000576#endif
David Lawrence Ramseycc8185f2005-07-25 02:33:45 +0000577#ifndef DISABLE_SPELLER
578bool do_int_spell_fix(const char *word);
579const char *do_int_speller(const char *tempfile_name);
580const char *do_alt_speller(char *tempfile_name);
581void do_spell(void);
582#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000583#ifndef NANO_TINY
David Lawrence Ramsey8e942342005-07-25 04:21:46 +0000584void do_wordlinechar_count(void);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000585#endif
David Lawrence Ramsey37ddfa92005-11-07 06:06:05 +0000586void do_verbatim_input(void);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000587
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000588/* Public functions in utils.c. */
David Lawrence Ramseyc596c0c2005-04-19 16:32:08 +0000589int digits(size_t n);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000590void get_homedir(void);
David Lawrence Ramseyc53ab2a2004-08-04 18:24:53 +0000591bool parse_num(const char *str, ssize_t *val);
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000592bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
David Lawrence Ramsey6a0d5b82005-06-13 14:00:22 +0000593void align(char **str);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000594void null_at(char **data, size_t index);
595void unsunder(char *str, size_t true_len);
596void sunder(char *str);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000597#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000598#ifndef HAVE_GETLINE
599ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
600#endif
601#ifndef HAVE_GETDELIM
602ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
603#endif
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000604#endif
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000605#ifdef HAVE_REGEX_H
606#ifdef BROKEN_REGEXEC
607int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
608 regmatch_t pmatch[], int eflags);
609#endif
610int regexp_bol_or_eol(const regex_t *preg, const char *string);
611#endif
612bool is_whole_word(size_t pos, const char *buf, const char *word);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000613const char *strstrwrapper(const char *haystack, const char *needle,
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000614 const char *start);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000615void nperror(const char *s);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000616void *nmalloc(size_t howmuch);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000617void *nrealloc(void *ptr, size_t howmuch);
David Lawrence Ramsey4a1fc552004-11-02 15:18:30 +0000618char *mallocstrncpy(char *dest, const char *src, size_t n);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000619char *mallocstrcpy(char *dest, const char *src);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000620char *mallocstrassn(char *dest, char *src);
David Lawrence Ramsey2b9d6a02005-11-01 17:45:31 +0000621size_t get_page_start(size_t column);
David Lawrence Ramsey81c4e182005-10-31 23:07:58 +0000622size_t xplustabs(void);
623size_t actual_x(const char *s, size_t column);
624size_t strnlenpt(const char *s, size_t maxlen);
625size_t strlenpt(const char *s);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000626void new_magicline(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000627#ifndef NANO_TINY
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000628void remove_magicline(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000629void mark_order(const filestruct **top, size_t *top_x, const filestruct
David Lawrence Ramsey90e59c12004-11-05 23:03:03 +0000630 **bot, size_t *bot_x, bool *right_side_up);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000631#endif
David Lawrence Ramseyc104ef12005-07-17 01:44:35 +0000632size_t get_totsize(const filestruct *begin, const filestruct *end);
David Lawrence Ramsey00cc5652005-11-02 15:44:01 +0000633#ifndef NDEBUG
634int check_linenumbers(const filestruct *fileptr);
635#endif
636#ifdef DEBUG
637void dump_filestruct(const filestruct *inptr);
638void dump_filestruct_reverse(void);
639#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000640
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000641/* Public functions in winio.c. */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000642#ifndef NANO_TINY
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000643void reset_kbinput(void);
644#endif
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000645void get_key_buffer(WINDOW *win);
646size_t get_key_buffer_len(void);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000647void unget_input(int *input, size_t input_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000648void unget_kbinput(int kbinput, bool meta_key, bool func_key);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000649int *get_input(WINDOW *win, size_t input_len);
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000650int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000651int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000652#ifndef NANO_TINY
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000653 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000654#endif
655 );
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000656int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000657 *ignore_seq);
658int get_escape_seq_abcd(int kbinput);
David Lawrence Ramseyf0a53f02005-01-03 19:56:56 +0000659int get_byte_kbinput(int kbinput
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000660#ifndef NANO_TINY
David Lawrence Ramseyf0a53f02005-01-03 19:56:56 +0000661 , bool reset
662#endif
663 );
David Lawrence Ramsey8b006c22005-08-08 23:03:25 +0000664long get_unicode_kbinput(int kbinput
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000665#ifndef NANO_TINY
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000666 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000667#endif
668 );
669int get_control_kbinput(int kbinput);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000670void unparse_kbinput(char *output, size_t output_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000671int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
672int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
David Lawrence Ramsey14bf8032004-05-22 20:19:15 +0000673#ifndef DISABLE_MOUSE
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000674bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
675#endif
David Lawrence Ramsey1483ee32004-11-29 00:30:07 +0000676const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000677 *meta_key, bool *func_key);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000678#ifndef NANO_TINY
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000679const toggle *get_toggle(int kbinput, bool meta_key);
680#endif
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000681void blank_line(WINDOW *win, int y, int x, int n);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000682void blank_titlebar(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000683void blank_topbar(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000684void blank_edit(void);
685void blank_statusbar(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000686void blank_bottombars(void);
David Lawrence Ramseyb9ddb802005-03-17 17:56:48 +0000687void check_statusblank(void);
David Lawrence Ramseyfc693212004-12-23 17:43:27 +0000688char *display_string(const char *buf, size_t start_col, size_t len, bool
689 dollars);
Chris Allegrettaf717f982003-02-13 22:25:01 +0000690void titlebar(const char *path);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000691void set_modified(void);
692void statusbar(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000693void bottombars(const shortcut *s);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000694void onekey(const char *keystroke, const char *desc, size_t len);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000695void reset_cursor(void);
David Lawrence Ramseya0aff672005-10-27 20:10:45 +0000696void edit_draw(const filestruct *fileptr, const char *converted, int
697 line, size_t start);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000698void update_line(const filestruct *fileptr, size_t index);
David Lawrence Ramseyfeb89db2005-09-13 04:45:46 +0000699bool need_horizontal_update(size_t old_pww);
700bool need_vertical_update(size_t old_pww);
David Lawrence Ramsey107e8162005-08-01 21:05:29 +0000701void edit_scroll(scroll_dir direction, ssize_t nlines);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000702void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000703void edit_refresh(void);
David Lawrence Ramseybf0e47d2005-08-01 18:27:10 +0000704void edit_update(update_type location);
David Lawrence Ramseyc54c4d12005-06-18 15:49:17 +0000705void total_redraw(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000706void total_refresh(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000707void display_main_list(void);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000708void do_cursorpos(bool constant);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000709void do_cursorpos_void(void);
David Lawrence Ramsey7bde0532005-06-30 03:55:55 +0000710void do_replace_highlight(bool highlight, const char *word);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000711#ifdef NANO_EXTRA
Chris Allegretta34318ed2001-01-31 23:22:36 +0000712void do_credits(void);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000713#endif
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000714
715#endif /* !PROTO_H */