Chris Allegretta | 11b0011 | 2000-08-06 21:13:45 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 2 | /************************************************************************** |
| 3 | * proto.h * |
| 4 | * * |
David Lawrence Ramsey | d8a1d37 | 2007-10-11 05:01:32 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 * |
| 6 | * Free Software Foundation, Inc. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 7 | * This program is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published by * |
David Lawrence Ramsey | d0035b4 | 2007-08-11 05:17:36 +0000 | [diff] [blame] | 9 | * the Free Software Foundation; either version 3, or (at your option) * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 10 | * any later version. * |
| 11 | * * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 12 | * This program is distributed in the hope that it will be useful, but * |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 15 | * General Public License for more details. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
| 18 | * along with this program; if not, write to the Free Software * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * |
| 20 | * 02110-1301, USA. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 21 | * * |
| 22 | **************************************************************************/ |
| 23 | |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 24 | #ifndef PROTO_H |
| 25 | #define PROTO_H 1 |
| 26 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 27 | #include "nano.h" |
| 28 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 29 | /* All external variables. See global.c for their descriptions. */ |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 30 | #ifndef NANO_TINY |
David Lawrence Ramsey | 1c5af64 | 2006-05-10 15:15:06 +0000 | [diff] [blame] | 31 | extern sigjmp_buf jump_buf; |
| 32 | extern bool jump_buf_main; |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 33 | #endif |
| 34 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 35 | #ifndef DISABLE_WRAPJUSTIFY |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 36 | extern ssize_t fill; |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 37 | extern ssize_t wrap_at; |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 38 | #endif |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 39 | |
| 40 | extern char *last_search; |
| 41 | extern char *last_replace; |
| 42 | |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 43 | extern long flags; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 44 | extern WINDOW *topwin; |
| 45 | extern WINDOW *edit; |
| 46 | extern WINDOW *bottomwin; |
| 47 | extern int editwinrows; |
| 48 | |
| 49 | extern filestruct *cutbuffer; |
| 50 | #ifndef DISABLE_JUSTIFY |
| 51 | extern filestruct *jusbuffer; |
| 52 | #endif |
| 53 | extern partition *filepart; |
| 54 | extern openfilestruct *openfile; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 55 | |
David Lawrence Ramsey | d89617f | 2006-01-06 21:51:10 +0000 | [diff] [blame] | 56 | #ifndef NANO_TINY |
| 57 | extern char *matchbrackets; |
| 58 | #endif |
| 59 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 60 | #if !defined(NANO_TINY) && defined(ENABLE_NANORC) |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 61 | extern char *whitespace; |
David Lawrence Ramsey | 6e60db6 | 2005-03-10 22:52:21 +0000 | [diff] [blame] | 62 | extern int whitespace_len[2]; |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 63 | #endif |
| 64 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 65 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 2c62b07 | 2004-05-29 16:38:57 +0000 | [diff] [blame] | 66 | extern char *punct; |
| 67 | extern char *brackets; |
Chris Allegretta | 45329a1 | 2002-03-10 01:22:21 +0000 | [diff] [blame] | 68 | extern char *quotestr; |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 69 | #ifdef HAVE_REGEX_H |
| 70 | extern regex_t quotereg; |
| 71 | extern int quoterc; |
| 72 | extern char *quoteerr; |
| 73 | #else |
| 74 | extern size_t quotelen; |
| 75 | #endif |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 76 | #endif |
| 77 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 78 | extern char *answer; |
| 79 | |
| 80 | extern ssize_t tabsize; |
| 81 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 82 | #ifndef NANO_TINY |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 83 | extern char *backup_dir; |
| 84 | #endif |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 85 | #ifndef DISABLE_OPERATINGDIR |
| 86 | extern char *operating_dir; |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 87 | extern char *full_operating_dir; |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 88 | #endif |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 89 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 90 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 91 | extern char *alt_speller; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 92 | #endif |
| 93 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 94 | extern shortcut *main_list; |
| 95 | extern shortcut *whereis_list; |
| 96 | extern shortcut *replace_list; |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 97 | extern shortcut *replace_list_2; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 98 | extern shortcut *gotoline_list; |
| 99 | extern shortcut *writefile_list; |
| 100 | extern shortcut *insertfile_list; |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 101 | #ifndef NANO_TINY |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 102 | extern shortcut *extcmd_list; |
| 103 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 104 | #ifndef DISABLE_HELP |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 105 | extern shortcut *help_list; |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 106 | #endif |
| 107 | #ifndef DISABLE_SPELLER |
| 108 | extern shortcut *spell_list; |
| 109 | #endif |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 110 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 111 | extern shortcut *browser_list; |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 112 | extern shortcut *whereis_file_list; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 113 | extern shortcut *gotodir_list; |
| 114 | #endif |
| 115 | |
| 116 | #ifdef ENABLE_COLOR |
| 117 | extern syntaxtype *syntaxes; |
| 118 | extern char *syntaxstr; |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 119 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 120 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 121 | extern const shortcut *currshortcut; |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 122 | #ifndef NANO_TINY |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 123 | extern toggle *toggles; |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 124 | #endif |
| 125 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 126 | #ifndef NANO_TINY |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 127 | extern filestruct *search_history; |
| 128 | extern filestruct *searchage; |
| 129 | extern filestruct *searchbot; |
| 130 | extern filestruct *replace_history; |
| 131 | extern filestruct *replaceage; |
| 132 | extern filestruct *replacebot; |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 133 | #endif |
| 134 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 135 | #ifdef HAVE_REGEX_H |
| 136 | extern regex_t search_regexp; |
| 137 | extern regmatch_t regmatches[10]; |
| 138 | #endif |
| 139 | |
David Lawrence Ramsey | 4d72de7 | 2006-04-12 15:27:40 +0000 | [diff] [blame] | 140 | extern int reverse_attr; |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 141 | |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 142 | extern char *homedir; |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 143 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 144 | /* All functions in browser.c. */ |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 145 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | b08c9f0 | 2006-07-11 18:12:24 +0000 | [diff] [blame] | 146 | char *do_browser(char *path, DIR *dir); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 147 | char *do_browse_from(const char *inpath); |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 148 | void browser_init(const char *path, DIR *dir); |
David Lawrence Ramsey | 91a2a69 | 2006-02-07 04:41:44 +0000 | [diff] [blame] | 149 | void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key); |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 150 | void browser_refresh(void); |
David Lawrence Ramsey | a43b108 | 2006-06-30 22:28:37 +0000 | [diff] [blame] | 151 | bool browser_select_filename(const char *needle); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 152 | int filesearch_init(void); |
| 153 | bool findnextfile(bool no_sameline, size_t begin, const char *needle); |
| 154 | void findnextfile_wrap_reset(void); |
| 155 | void filesearch_abort(void); |
| 156 | void do_filesearch(void); |
| 157 | void do_fileresearch(void); |
| 158 | void do_first_file(void); |
| 159 | void do_last_file(void); |
David Lawrence Ramsey | a4e92c8 | 2006-06-30 14:14:40 +0000 | [diff] [blame] | 160 | char *striponedir(const char *path); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 161 | #endif |
| 162 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 163 | /* All functions in chars.c. */ |
David Lawrence Ramsey | 4d72de7 | 2006-04-12 15:27:40 +0000 | [diff] [blame] | 164 | #ifdef ENABLE_UTF8 |
| 165 | void utf8_init(void); |
| 166 | bool using_utf8(void); |
| 167 | #endif |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 168 | #ifndef HAVE_ISBLANK |
David Lawrence Ramsey | 1aee5cc | 2005-06-29 18:17:54 +0000 | [diff] [blame] | 169 | bool nisblank(int c); |
David Lawrence Ramsey | 77abec7 | 2005-03-16 17:00:27 +0000 | [diff] [blame] | 170 | #endif |
David Lawrence Ramsey | 7eb30a8 | 2005-07-17 02:40:07 +0000 | [diff] [blame] | 171 | #if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8) |
David Lawrence Ramsey | 1aee5cc | 2005-06-29 18:17:54 +0000 | [diff] [blame] | 172 | bool niswblank(wchar_t wc); |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 173 | #endif |
David Lawrence Ramsey | 356d248 | 2005-06-13 19:51:56 +0000 | [diff] [blame] | 174 | bool is_byte(int c); |
David Lawrence Ramsey | 2515ccc | 2005-06-15 06:04:08 +0000 | [diff] [blame] | 175 | bool is_alnum_mbchar(const char *c); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 176 | bool is_blank_mbchar(const char *c); |
David Lawrence Ramsey | 8e341e1 | 2006-05-24 17:36:00 +0000 | [diff] [blame] | 177 | bool is_ascii_cntrl_char(int c); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 178 | bool is_cntrl_char(int c); |
David Lawrence Ramsey | 7eb30a8 | 2005-07-17 02:40:07 +0000 | [diff] [blame] | 179 | #ifdef ENABLE_UTF8 |
David Lawrence Ramsey | ed7ad33 | 2005-06-15 16:07:14 +0000 | [diff] [blame] | 180 | bool is_cntrl_wchar(wchar_t wc); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 181 | #endif |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 182 | bool is_cntrl_mbchar(const char *c); |
David Lawrence Ramsey | 2515ccc | 2005-06-15 06:04:08 +0000 | [diff] [blame] | 183 | bool is_punct_mbchar(const char *c); |
David Lawrence Ramsey | e221311 | 2005-06-15 03:03:45 +0000 | [diff] [blame] | 184 | bool is_word_mbchar(const char *c, bool allow_punct); |
David Lawrence Ramsey | 1946261 | 2005-06-12 18:05:42 +0000 | [diff] [blame] | 185 | char control_rep(char c); |
David Lawrence Ramsey | 7eb30a8 | 2005-07-17 02:40:07 +0000 | [diff] [blame] | 186 | #ifdef ENABLE_UTF8 |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 187 | wchar_t control_wrep(wchar_t c); |
| 188 | #endif |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 189 | char *control_mbrep(const char *c, char *crep, int *crep_len); |
David Lawrence Ramsey | 96452cb | 2005-07-26 06:13:45 +0000 | [diff] [blame] | 190 | char *mbrep(const char *c, char *crep, int *crep_len); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 191 | int mbwidth(const char *c); |
| 192 | int mb_cur_max(void); |
David Lawrence Ramsey | 8b006c2 | 2005-08-08 23:03:25 +0000 | [diff] [blame] | 193 | char *make_mbchar(long chr, int *chr_mb_len); |
David Lawrence Ramsey | 96452cb | 2005-07-26 06:13:45 +0000 | [diff] [blame] | 194 | int parse_mbchar(const char *buf, char *chr, size_t *col); |
David Lawrence Ramsey | d24fbb7 | 2005-01-14 21:50:32 +0000 | [diff] [blame] | 195 | size_t move_mbleft(const char *buf, size_t pos); |
| 196 | size_t move_mbright(const char *buf, size_t pos); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 197 | #ifndef HAVE_STRCASECMP |
| 198 | int nstrcasecmp(const char *s1, const char *s2); |
| 199 | #endif |
| 200 | int mbstrcasecmp(const char *s1, const char *s2); |
| 201 | #ifndef HAVE_STRNCASECMP |
| 202 | int nstrncasecmp(const char *s1, const char *s2, size_t n); |
| 203 | #endif |
| 204 | int mbstrncasecmp(const char *s1, const char *s2, size_t n); |
| 205 | #ifndef HAVE_STRCASESTR |
David Lawrence Ramsey | ae46b91 | 2007-07-06 13:44:13 +0000 | [diff] [blame] | 206 | char *nstrcasestr(const char *haystack, const char *needle); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 207 | #endif |
David Lawrence Ramsey | ae46b91 | 2007-07-06 13:44:13 +0000 | [diff] [blame] | 208 | char *mbstrcasestr(const char *haystack, const char *needle); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 209 | #if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP) |
David Lawrence Ramsey | ae46b91 | 2007-07-06 13:44:13 +0000 | [diff] [blame] | 210 | char *revstrstr(const char *haystack, const char *needle, const char |
| 211 | *rev_start); |
David Lawrence Ramsey | 7b601fd | 2005-06-13 13:25:36 +0000 | [diff] [blame] | 212 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 213 | #ifndef NANO_TINY |
David Lawrence Ramsey | ae46b91 | 2007-07-06 13:44:13 +0000 | [diff] [blame] | 214 | char *revstrcasestr(const char *haystack, const char *needle, const char |
| 215 | *rev_start); |
| 216 | char *mbrevstrcasestr(const char *haystack, const char *needle, const |
| 217 | char *rev_start); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 218 | #endif |
David Lawrence Ramsey | 3f9c635 | 2005-01-25 19:21:11 +0000 | [diff] [blame] | 219 | size_t mbstrlen(const char *s); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 220 | #ifndef HAVE_STRNLEN |
| 221 | size_t nstrnlen(const char *s, size_t maxlen); |
| 222 | #endif |
| 223 | size_t mbstrnlen(const char *s, size_t maxlen); |
David Lawrence Ramsey | a248863 | 2006-01-06 07:10:30 +0000 | [diff] [blame] | 224 | #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) |
| 225 | char *mbstrchr(const char *s, const char *c); |
| 226 | #endif |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 227 | #ifndef NANO_TINY |
David Lawrence Ramsey | a248863 | 2006-01-06 07:10:30 +0000 | [diff] [blame] | 228 | char *mbstrpbrk(const char *s, const char *accept); |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 229 | char *revstrpbrk(const char *s, const char *accept, const char |
| 230 | *rev_start); |
David Lawrence Ramsey | a248863 | 2006-01-06 07:10:30 +0000 | [diff] [blame] | 231 | char *mbrevstrpbrk(const char *s, const char *accept, const char |
| 232 | *rev_start); |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 233 | #endif |
David Lawrence Ramsey | 1a16df9 | 2006-01-06 22:04:38 +0000 | [diff] [blame] | 234 | #if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)) |
David Lawrence Ramsey | d5d4dde | 2005-06-14 01:55:56 +0000 | [diff] [blame] | 235 | bool has_blank_chars(const char *s); |
| 236 | bool has_blank_mbchars(const char *s); |
| 237 | #endif |
David Lawrence Ramsey | 6ff695c | 2005-08-05 03:14:29 +0000 | [diff] [blame] | 238 | #ifdef ENABLE_UTF8 |
| 239 | bool is_valid_unicode(wchar_t wc); |
| 240 | #endif |
David Lawrence Ramsey | bdfa927 | 2005-06-14 23:36:13 +0000 | [diff] [blame] | 241 | #ifdef ENABLE_NANORC |
| 242 | bool is_valid_mbstring(const char *s); |
| 243 | #endif |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 244 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 245 | /* All functions in color.c. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 246 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 1f28b8f | 2002-09-27 14:21:59 +0000 | [diff] [blame] | 247 | void set_colorpairs(void); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 248 | void color_init(void); |
David Lawrence Ramsey | 43cf7a1 | 2005-07-14 18:31:45 +0000 | [diff] [blame] | 249 | void color_update(void); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 250 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 251 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 252 | /* All functions in cut.c. */ |
David Lawrence Ramsey | c833d9e | 2004-05-29 15:36:58 +0000 | [diff] [blame] | 253 | void cutbuffer_reset(void); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 254 | void cut_line(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 255 | #ifndef NANO_TINY |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 256 | void cut_marked(void); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 257 | void cut_to_eol(void); |
David Lawrence Ramsey | 41b8972 | 2006-05-21 20:03:43 +0000 | [diff] [blame] | 258 | void cut_to_eof(void); |
David Lawrence Ramsey | b80d49f | 2005-03-26 22:49:46 +0000 | [diff] [blame] | 259 | #endif |
David Lawrence Ramsey | c87e0c0 | 2006-04-25 02:23:28 +0000 | [diff] [blame] | 260 | void do_cut_text( |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 261 | #ifndef NANO_TINY |
David Lawrence Ramsey | 41b8972 | 2006-05-21 20:03:43 +0000 | [diff] [blame] | 262 | bool copy_text, bool cut_till_end |
David Lawrence Ramsey | c87e0c0 | 2006-04-25 02:23:28 +0000 | [diff] [blame] | 263 | #else |
| 264 | void |
| 265 | #endif |
| 266 | ); |
| 267 | void do_cut_text_void(void); |
| 268 | #ifndef NANO_TINY |
| 269 | void do_copy_text(void); |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 270 | void do_cut_till_end(void); |
| 271 | #endif |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 272 | void do_uncut_text(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 273 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 274 | /* All functions in files.c. */ |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 275 | void make_new_buffer(void); |
David Lawrence Ramsey | b386a90 | 2005-07-10 02:37:38 +0000 | [diff] [blame] | 276 | void initialize_buffer(void); |
David Lawrence Ramsey | c00513b | 2005-07-23 00:41:45 +0000 | [diff] [blame] | 277 | void initialize_buffer_text(void); |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 278 | void open_buffer(const char *filename); |
David Lawrence Ramsey | 9c984e8 | 2005-11-08 19:15:58 +0000 | [diff] [blame] | 279 | #ifndef DISABLE_SPELLER |
| 280 | void replace_buffer(const char *filename); |
| 281 | #endif |
David Lawrence Ramsey | e5c7e92 | 2005-07-12 23:06:22 +0000 | [diff] [blame] | 282 | void display_buffer(void); |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 283 | #ifdef ENABLE_MULTIBUFFER |
| 284 | void switch_to_prevnext_buffer(bool next); |
| 285 | void switch_to_prev_buffer_void(void); |
| 286 | void switch_to_next_buffer_void(void); |
| 287 | bool close_buffer(void); |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 288 | #endif |
David Lawrence Ramsey | 50995bd | 2005-05-16 20:13:09 +0000 | [diff] [blame] | 289 | filestruct *read_line(char *buf, filestruct *prevnode, bool |
David Lawrence Ramsey | 483f3ac | 2005-06-19 19:57:13 +0000 | [diff] [blame] | 290 | *first_line_ins, size_t buf_len); |
David Lawrence Ramsey | 02517e0 | 2004-09-05 21:40:31 +0000 | [diff] [blame] | 291 | void read_file(FILE *f, const char *filename); |
| 292 | int open_file(const char *filename, bool newfie, FILE **f); |
David Lawrence Ramsey | b9b5722 | 2005-05-29 02:22:55 +0000 | [diff] [blame] | 293 | char *get_next_filename(const char *name, const char *suffix); |
David Lawrence Ramsey | be908f6 | 2004-10-01 18:34:30 +0000 | [diff] [blame] | 294 | void do_insertfile( |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 295 | #ifndef NANO_TINY |
David Lawrence Ramsey | be908f6 | 2004-10-01 18:34:30 +0000 | [diff] [blame] | 296 | bool execute |
| 297 | #else |
| 298 | void |
| 299 | #endif |
| 300 | ); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 301 | void do_insertfile_void(void); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 302 | char *get_full_path(const char *origpath); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 303 | char *check_writable_directory(const char *path); |
David Lawrence Ramsey | 5e068c6 | 2005-05-31 04:28:15 +0000 | [diff] [blame] | 304 | char *safe_tempfile(FILE **f); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 305 | #ifndef DISABLE_OPERATINGDIR |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 306 | void init_operating_dir(void); |
David Lawrence Ramsey | 1b9d3f9 | 2005-02-11 20:09:11 +0000 | [diff] [blame] | 307 | bool check_operating_dir(const char *currpath, bool allow_tabcomp); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 308 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 309 | #ifndef NANO_TINY |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 310 | void init_backup_dir(void); |
| 311 | #endif |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 312 | int copy_file(FILE *inn, FILE *out); |
David Lawrence Ramsey | 4154d08 | 2007-01-11 21:36:29 +0000 | [diff] [blame] | 313 | bool write_file(const char *name, FILE *f_open, bool tmp, append_type |
David Lawrence Ramsey | bf0e47d | 2005-08-01 18:27:10 +0000 | [diff] [blame] | 314 | append, bool nonamechange); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 315 | #ifndef NANO_TINY |
David Lawrence Ramsey | 4154d08 | 2007-01-11 21:36:29 +0000 | [diff] [blame] | 316 | bool write_marked_file(const char *name, FILE *f_open, bool tmp, |
David Lawrence Ramsey | bf0e47d | 2005-08-01 18:27:10 +0000 | [diff] [blame] | 317 | append_type append); |
David Lawrence Ramsey | 35961c4 | 2004-01-23 19:34:03 +0000 | [diff] [blame] | 318 | #endif |
David Lawrence Ramsey | 4154d08 | 2007-01-11 21:36:29 +0000 | [diff] [blame] | 319 | bool do_writeout(bool exiting); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 320 | void do_writeout_void(void); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 321 | char *real_dir_from_tilde(const char *buf); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 322 | #if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER) |
| 323 | int diralphasort(const void *va, const void *vb); |
David Lawrence Ramsey | ab41ab9 | 2005-06-15 06:30:05 +0000 | [diff] [blame] | 324 | void free_chararray(char **array, size_t len); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 325 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 326 | #ifndef DISABLE_TABCOMP |
David Lawrence Ramsey | 4154d08 | 2007-01-11 21:36:29 +0000 | [diff] [blame] | 327 | bool is_dir(const char *buf); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 328 | char **username_tab_completion(const char *buf, size_t *num_matches, |
David Lawrence Ramsey | 6e6c80b | 2007-10-11 15:38:32 +0000 | [diff] [blame] | 329 | size_t buf_len); |
David Lawrence Ramsey | 9d8c284 | 2006-02-07 21:11:05 +0000 | [diff] [blame] | 330 | char **cwd_tab_completion(const char *buf, bool allow_files, size_t |
David Lawrence Ramsey | 6e6c80b | 2007-10-11 15:38:32 +0000 | [diff] [blame] | 331 | *num_matches, size_t buf_len); |
David Lawrence Ramsey | 9d8c284 | 2006-02-07 21:11:05 +0000 | [diff] [blame] | 332 | char *input_tab(char *buf, bool allow_files, size_t *place, bool |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 333 | *lastwastab, void (*refresh_func)(void), bool *list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 334 | #endif |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 335 | const char *tail(const char *foo); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 336 | #if !defined(NANO_TINY) && defined(ENABLE_NANORC) |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 337 | char *histfilename(void); |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 338 | void load_history(void); |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 339 | bool writehist(FILE *hist, filestruct *histhead); |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 340 | void save_history(void); |
| 341 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 342 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 343 | /* All functions in global.c. */ |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 344 | size_t length_of_list(const shortcut *s); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 345 | #ifndef NANO_TINY |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 346 | void toggle_init_one(int val |
| 347 | #ifndef DISABLE_HELP |
| 348 | , const char *desc, bool blank_after |
| 349 | #endif |
| 350 | , long flag); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 351 | void toggle_init(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 352 | #endif |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 353 | void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 354 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 355 | , const char *help, bool blank_after |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 356 | #endif |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 357 | , int metaval, int funcval, int miscval, bool view, void |
| 358 | (*func)(void)); |
David Lawrence Ramsey | 1f1ebb8 | 2004-11-11 21:50:01 +0000 | [diff] [blame] | 359 | void shortcut_init(bool unjustify); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 360 | void free_shortcutage(shortcut **shortcutage); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 361 | #ifdef DEBUG |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 362 | void thanks_for_all_the_fish(void); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 363 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 364 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 365 | /* All functions in help.c. */ |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 366 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 367 | void do_help(void (*refresh_func)(void)); |
| 368 | void do_help_void(void); |
| 369 | #ifndef DISABLE_BROWSER |
| 370 | void do_browser_help(void); |
| 371 | #endif |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 372 | void help_init(void); |
David Lawrence Ramsey | bc80cb1 | 2006-04-24 23:03:21 +0000 | [diff] [blame] | 373 | void parse_help_input(int *kbinput, bool *meta_key, bool *func_key); |
David Lawrence Ramsey | c359301 | 2005-11-01 20:11:55 +0000 | [diff] [blame] | 374 | size_t help_line_len(const char *ptr); |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 375 | #endif |
| 376 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 377 | /* All functions in move.c. */ |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 378 | void do_first_line(void); |
| 379 | void do_last_line(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 380 | void do_page_up(void); |
| 381 | void do_page_down(void); |
David Lawrence Ramsey | ca62f9f | 2005-07-20 19:24:11 +0000 | [diff] [blame] | 382 | #ifndef DISABLE_JUSTIFY |
| 383 | void do_para_begin(bool allow_update); |
| 384 | void do_para_begin_void(void); |
| 385 | void do_para_end(bool allow_update); |
| 386 | void do_para_end_void(void); |
| 387 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 388 | #ifndef NANO_TINY |
David Lawrence Ramsey | c4037f3 | 2005-07-20 21:31:19 +0000 | [diff] [blame] | 389 | bool do_next_word(bool allow_punct, bool allow_update); |
| 390 | void do_next_word_void(void); |
| 391 | bool do_prev_word(bool allow_punct, bool allow_update); |
| 392 | void do_prev_word_void(void); |
| 393 | #endif |
David Lawrence Ramsey | ca62f9f | 2005-07-20 19:24:11 +0000 | [diff] [blame] | 394 | void do_home(void); |
| 395 | void do_end(void); |
David Lawrence Ramsey | 2c36e2e | 2006-07-06 22:17:47 +0000 | [diff] [blame] | 396 | void do_up( |
| 397 | #ifndef NANO_TINY |
| 398 | bool scroll_only |
| 399 | #else |
| 400 | void |
| 401 | #endif |
| 402 | ); |
| 403 | void do_up_void(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 404 | #ifndef NANO_TINY |
David Lawrence Ramsey | 2de84c1 | 2005-10-24 02:12:09 +0000 | [diff] [blame] | 405 | void do_scroll_up(void); |
| 406 | #endif |
David Lawrence Ramsey | 2c36e2e | 2006-07-06 22:17:47 +0000 | [diff] [blame] | 407 | void do_down( |
| 408 | #ifndef NANO_TINY |
| 409 | bool scroll_only |
| 410 | #else |
| 411 | void |
| 412 | #endif |
| 413 | ); |
| 414 | void do_down_void(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 415 | #ifndef NANO_TINY |
David Lawrence Ramsey | 2de84c1 | 2005-10-24 02:12:09 +0000 | [diff] [blame] | 416 | void do_scroll_down(void); |
| 417 | #endif |
David Lawrence Ramsey | 1c3bfa9 | 2005-09-13 04:53:44 +0000 | [diff] [blame] | 418 | void do_left(void); |
| 419 | void do_right(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 420 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 421 | /* All functions in nano.c. */ |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 422 | filestruct *make_new_node(filestruct *prevnode); |
| 423 | filestruct *copy_node(const filestruct *src); |
| 424 | void splice_node(filestruct *begin, filestruct *newnode, filestruct |
| 425 | *end); |
| 426 | void unlink_node(const filestruct *fileptr); |
| 427 | void delete_node(filestruct *fileptr); |
| 428 | filestruct *copy_filestruct(const filestruct *src); |
| 429 | void free_filestruct(filestruct *src); |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 430 | void renumber(filestruct *fileptr); |
| 431 | partition *partition_filestruct(filestruct *top, size_t top_x, |
| 432 | filestruct *bot, size_t bot_x); |
| 433 | void unpartition_filestruct(partition **p); |
| 434 | void move_to_filestruct(filestruct **file_top, filestruct **file_bot, |
| 435 | filestruct *top, size_t top_x, filestruct *bot, size_t bot_x); |
| 436 | void copy_from_filestruct(filestruct *file_top, filestruct *file_bot); |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 437 | openfilestruct *make_new_opennode(void); |
| 438 | void splice_opennode(openfilestruct *begin, openfilestruct *newnode, |
| 439 | openfilestruct *end); |
| 440 | void unlink_opennode(openfilestruct *fileptr); |
| 441 | void delete_opennode(openfilestruct *fileptr); |
| 442 | #ifdef DEBUG |
| 443 | void free_openfilestruct(openfilestruct *src); |
| 444 | #endif |
David Lawrence Ramsey | 5040666 | 2005-01-19 19:52:42 +0000 | [diff] [blame] | 445 | void print_view_warning(void); |
David Lawrence Ramsey | da14106 | 2004-05-25 19:41:11 +0000 | [diff] [blame] | 446 | void finish(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 447 | void die(const char *msg, ...); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 448 | void die_save_file(const char *die_filename); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 449 | void window_init(void); |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 450 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 503bad0 | 2006-06-09 18:24:37 +0000 | [diff] [blame] | 451 | void disable_mouse_support(void); |
| 452 | void enable_mouse_support(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 453 | void mouse_init(void); |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 454 | #endif |
David Lawrence Ramsey | 660e05b | 2006-05-12 19:30:28 +0000 | [diff] [blame] | 455 | void print_opt_full(const char *shortflag |
David Lawrence Ramsey | 39e8ce6 | 2005-03-21 07:24:47 +0000 | [diff] [blame] | 456 | #ifdef HAVE_GETOPT_LONG |
| 457 | , const char *longflag |
| 458 | #endif |
| 459 | , const char *desc); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 460 | void usage(void); |
| 461 | void version(void); |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 462 | int no_more_space(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 463 | int no_help(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 464 | void nano_disabled_msg(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 465 | void do_exit(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 466 | void signal_init(void); |
David Lawrence Ramsey | 8befda6 | 2005-12-06 19:39:56 +0000 | [diff] [blame] | 467 | RETSIGTYPE handle_hupterm(int signal); |
| 468 | RETSIGTYPE do_suspend(int signal); |
| 469 | RETSIGTYPE do_continue(int signal); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 470 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8befda6 | 2005-12-06 19:39:56 +0000 | [diff] [blame] | 471 | RETSIGTYPE handle_sigwinch(int signal); |
David Lawrence Ramsey | ce62e82 | 2004-08-05 22:10:22 +0000 | [diff] [blame] | 472 | void allow_pending_sigwinch(bool allow); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 473 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 474 | #ifndef NANO_TINY |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 475 | void do_toggle(const toggle *which); |
| 476 | #endif |
David Lawrence Ramsey | 8bcac8a | 2005-06-09 04:02:57 +0000 | [diff] [blame] | 477 | void disable_extended_io(void); |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame^] | 478 | #ifdef USE_SLANG |
| 479 | void disable_signals(void); |
| 480 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 481 | #ifndef NANO_TINY |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 482 | void enable_signals(void); |
| 483 | #endif |
| 484 | void disable_flow_control(void); |
| 485 | void enable_flow_control(void); |
David Lawrence Ramsey | 8aaf030 | 2004-07-27 16:46:35 +0000 | [diff] [blame] | 486 | void terminal_init(void); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 487 | int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool |
David Lawrence Ramsey | cac0293 | 2005-01-11 23:05:05 +0000 | [diff] [blame] | 488 | *ran_func, bool *finished, bool allow_funcs); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 489 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 3a5eaeb | 2007-05-20 23:41:56 +0000 | [diff] [blame] | 490 | int do_mouse(void); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 491 | #endif |
David Lawrence Ramsey | efec641 | 2005-03-17 03:52:08 +0000 | [diff] [blame] | 492 | void do_output(char *output, size_t output_len, bool allow_cntrls); |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 493 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 494 | /* All functions in prompt.c. */ |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 495 | int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t, |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 496 | bool *ran_func, bool *finished, bool allow_funcs, void |
| 497 | (*refresh_func)(void)); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 498 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 3a5eaeb | 2007-05-20 23:41:56 +0000 | [diff] [blame] | 499 | int do_statusbar_mouse(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 500 | #endif |
| 501 | void do_statusbar_output(char *output, size_t output_len, bool |
David Lawrence Ramsey | 8137102 | 2006-11-27 04:56:16 +0000 | [diff] [blame] | 502 | *got_enter, bool allow_cntrls); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 503 | void do_statusbar_home(void); |
| 504 | void do_statusbar_end(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 505 | void do_statusbar_left(void); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 506 | void do_statusbar_right(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 507 | void do_statusbar_backspace(void); |
| 508 | void do_statusbar_delete(void); |
| 509 | void do_statusbar_cut_text(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 510 | #ifndef NANO_TINY |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 511 | bool do_statusbar_next_word(bool allow_punct); |
| 512 | bool do_statusbar_prev_word(bool allow_punct); |
| 513 | #endif |
| 514 | void do_statusbar_verbatim_input(bool *got_enter); |
David Lawrence Ramsey | c499382 | 2005-11-16 04:14:03 +0000 | [diff] [blame] | 515 | #ifndef NANO_TINY |
David Lawrence Ramsey | 5ab56ea | 2005-11-16 13:45:41 +0000 | [diff] [blame] | 516 | bool find_statusbar_bracket_match(bool reverse, const char |
| 517 | *bracket_set); |
David Lawrence Ramsey | c499382 | 2005-11-16 04:14:03 +0000 | [diff] [blame] | 518 | void do_statusbar_find_bracket(void); |
| 519 | #endif |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 520 | size_t statusbar_xplustabs(void); |
| 521 | size_t get_statusbar_page_start(size_t start_col, size_t column); |
David Lawrence Ramsey | e19449e | 2005-11-07 21:45:44 +0000 | [diff] [blame] | 522 | void reset_statusbar_cursor(void); |
David Lawrence Ramsey | 60edb0a | 2006-05-15 15:17:50 +0000 | [diff] [blame] | 523 | void update_statusbar_line(const char *curranswer, size_t index); |
David Lawrence Ramsey | fa38795 | 2006-08-26 16:50:51 +0000 | [diff] [blame] | 524 | bool need_statusbar_horizontal_update(size_t pww_save); |
David Lawrence Ramsey | 60edb0a | 2006-05-15 15:17:50 +0000 | [diff] [blame] | 525 | void total_statusbar_refresh(void (*refresh_func)(void)); |
David Lawrence Ramsey | 9d8c284 | 2006-02-07 21:11:05 +0000 | [diff] [blame] | 526 | int get_prompt_string(bool allow_tabs, |
| 527 | #ifndef DISABLE_TABCOMP |
| 528 | bool allow_files, |
| 529 | #endif |
| 530 | const char *curranswer, |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 531 | #ifndef NANO_TINY |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 532 | filestruct **history_list, |
| 533 | #endif |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 534 | void (*refresh_func)(void), const shortcut *s |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 535 | #ifndef DISABLE_TABCOMP |
| 536 | , bool *list |
| 537 | #endif |
| 538 | ); |
David Lawrence Ramsey | 9d8c284 | 2006-02-07 21:11:05 +0000 | [diff] [blame] | 539 | int do_prompt(bool allow_tabs, |
| 540 | #ifndef DISABLE_TABCOMP |
| 541 | bool allow_files, |
| 542 | #endif |
| 543 | const shortcut *s, const char *curranswer, |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 544 | #ifndef NANO_TINY |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 545 | filestruct **history_list, |
| 546 | #endif |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 547 | void (*refresh_func)(void), const char *msg, ...); |
David Lawrence Ramsey | e19449e | 2005-11-07 21:45:44 +0000 | [diff] [blame] | 548 | void do_prompt_abort(void); |
| 549 | int do_yesno_prompt(bool all, const char *msg); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 550 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 551 | /* All functions in rcfile.c. */ |
Chris Allegretta | 7a50009 | 2001-04-19 21:13:46 +0000 | [diff] [blame] | 552 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 553 | void rcfile_error(const char *msg, ...); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 554 | char *parse_next_word(char *ptr); |
| 555 | char *parse_argument(char *ptr); |
| 556 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 557 | char *parse_next_regex(char *ptr); |
David Lawrence Ramsey | 2385c1a | 2005-07-29 21:42:08 +0000 | [diff] [blame] | 558 | bool nregcomp(const char *regex, int eflags); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 559 | void parse_syntax(char *ptr); |
David Lawrence Ramsey | cee20e5 | 2006-04-13 02:43:54 +0000 | [diff] [blame] | 560 | void parse_include(char *ptr); |
David Lawrence Ramsey | a8239c3 | 2006-05-28 22:24:03 +0000 | [diff] [blame] | 561 | short color_to_short(const char *colorname, bool *bright); |
David Lawrence Ramsey | 23555f2 | 2005-06-27 03:07:10 +0000 | [diff] [blame] | 562 | void parse_colors(char *ptr, bool icase); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 563 | #endif |
David Lawrence Ramsey | cee20e5 | 2006-04-13 02:43:54 +0000 | [diff] [blame] | 564 | void parse_rcfile(FILE *rcstream |
| 565 | #ifdef ENABLE_COLOR |
| 566 | , bool syntax_only |
| 567 | #endif |
| 568 | ); |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 569 | void do_rcfile(void); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 570 | #endif |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 571 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 572 | /* All functions in search.c. */ |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 573 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 0ec34ac | 2007-01-09 23:35:02 +0000 | [diff] [blame] | 574 | bool regexp_init(const char *regexp); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 575 | void regexp_cleanup(void); |
| 576 | #endif |
| 577 | void not_found_msg(const char *str); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 578 | void search_replace_abort(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 579 | void search_init_globals(void); |
David Lawrence Ramsey | d532f19 | 2004-10-04 22:37:56 +0000 | [diff] [blame] | 580 | int search_init(bool replacing, bool use_answer); |
David Lawrence Ramsey | cf9c34a | 2005-11-16 05:59:06 +0000 | [diff] [blame] | 581 | bool findnextstr( |
| 582 | #ifndef DISABLE_SPELLER |
| 583 | bool whole_word, |
| 584 | #endif |
| 585 | bool no_sameline, const filestruct *begin, size_t begin_x, const |
| 586 | char *needle, size_t *needle_len); |
David Lawrence Ramsey | e5e88fd | 2004-10-31 13:20:30 +0000 | [diff] [blame] | 587 | void findnextstr_wrap_reset(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 588 | void do_search(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 589 | #ifndef NANO_TINY |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 590 | void do_research(void); |
David Lawrence Ramsey | 5aa3983 | 2004-05-05 21:36:50 +0000 | [diff] [blame] | 591 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 592 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | e3970f5 | 2005-05-26 03:47:24 +0000 | [diff] [blame] | 593 | int replace_regexp(char *string, bool create); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 594 | #endif |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 595 | char *replace_line(const char *needle); |
David Lawrence Ramsey | cf9c34a | 2005-11-16 05:59:06 +0000 | [diff] [blame] | 596 | ssize_t do_replace_loop( |
| 597 | #ifndef DISABLE_SPELLER |
| 598 | bool whole_word, |
| 599 | #endif |
| 600 | bool *canceled, const filestruct *real_current, size_t |
| 601 | *real_current_x, const char *needle); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 602 | void do_replace(void); |
David Lawrence Ramsey | 5beae58 | 2005-06-29 00:17:18 +0000 | [diff] [blame] | 603 | void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, |
David Lawrence Ramsey | 8f1afee | 2005-07-16 07:06:36 +0000 | [diff] [blame] | 604 | bool interactive, bool save_pos, bool allow_update); |
David Lawrence Ramsey | 9245f97 | 2005-05-17 18:06:26 +0000 | [diff] [blame] | 605 | void do_gotolinecolumn_void(void); |
David Lawrence Ramsey | 8f4762a | 2005-07-16 22:35:11 +0000 | [diff] [blame] | 606 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 607 | void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t |
David Lawrence Ramsey | 2cf6d71 | 2005-06-28 06:25:34 +0000 | [diff] [blame] | 608 | pos_pww); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 609 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 610 | #ifndef NANO_TINY |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 611 | bool find_bracket_match(bool reverse, const char *bracket_set); |
David Lawrence Ramsey | c4ca596 | 2005-06-16 20:58:19 +0000 | [diff] [blame] | 612 | void do_find_bracket(void); |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 613 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 614 | bool history_has_changed(void); |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 615 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 616 | void history_init(void); |
David Lawrence Ramsey | 0e581b3 | 2005-07-18 07:48:50 +0000 | [diff] [blame] | 617 | void history_reset(const filestruct *h); |
David Lawrence Ramsey | 96e6d56 | 2005-07-19 04:53:45 +0000 | [diff] [blame] | 618 | filestruct *find_history(const filestruct *h_start, const filestruct |
| 619 | *h_end, const char *s, size_t len); |
David Lawrence Ramsey | 34bdc35 | 2005-06-02 18:41:31 +0000 | [diff] [blame] | 620 | void update_history(filestruct **h, const char *s); |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 621 | char *get_history_older(filestruct **h); |
| 622 | char *get_history_newer(filestruct **h); |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 623 | #ifndef DISABLE_TABCOMP |
David Lawrence Ramsey | 96e6d56 | 2005-07-19 04:53:45 +0000 | [diff] [blame] | 624 | char *get_history_completion(filestruct **h, const char *s, size_t len); |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 625 | #endif |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 626 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 627 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 628 | /* All functions in text.c. */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 629 | #ifndef NANO_TINY |
David Lawrence Ramsey | 7ea09e5 | 2005-07-25 02:41:59 +0000 | [diff] [blame] | 630 | void do_mark(void); |
| 631 | #endif |
| 632 | void do_delete(void); |
| 633 | void do_backspace(void); |
| 634 | void do_tab(void); |
David Lawrence Ramsey | f85001a | 2006-04-28 13:19:56 +0000 | [diff] [blame] | 635 | #ifndef NANO_TINY |
David Lawrence Ramsey | aee00d4 | 2006-07-05 18:42:22 +0000 | [diff] [blame] | 636 | void do_indent(ssize_t cols); |
| 637 | void do_indent_void(void); |
| 638 | void do_unindent(void); |
David Lawrence Ramsey | f85001a | 2006-04-28 13:19:56 +0000 | [diff] [blame] | 639 | #endif |
David Lawrence Ramsey | 7ea09e5 | 2005-07-25 02:41:59 +0000 | [diff] [blame] | 640 | void do_enter(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 641 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8befda6 | 2005-12-06 19:39:56 +0000 | [diff] [blame] | 642 | RETSIGTYPE cancel_command(int signal); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 643 | bool execute_command(const char *command); |
| 644 | #endif |
| 645 | #ifndef DISABLE_WRAPPING |
| 646 | void wrap_reset(void); |
| 647 | bool do_wrap(filestruct *line); |
| 648 | #endif |
David Lawrence Ramsey | c7c04bb | 2005-11-29 21:30:00 +0000 | [diff] [blame] | 649 | #if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY) |
David Lawrence Ramsey | b9b2fd5 | 2005-11-22 21:13:36 +0000 | [diff] [blame] | 650 | ssize_t break_line(const char *line, ssize_t goal |
| 651 | #ifndef DISABLE_HELP |
| 652 | , bool newline |
| 653 | #endif |
| 654 | ); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 655 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 656 | #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 657 | size_t indent_length(const char *line); |
| 658 | #endif |
| 659 | #ifndef DISABLE_JUSTIFY |
| 660 | void justify_format(filestruct *paragraph, size_t skip); |
| 661 | size_t quote_length(const char *line); |
| 662 | bool quotes_match(const char *a_line, size_t a_quote, const char |
| 663 | *b_line); |
| 664 | bool indents_match(const char *a_line, size_t a_indent, const char |
| 665 | *b_line, size_t b_indent); |
| 666 | bool begpar(const filestruct *const foo); |
| 667 | bool inpar(const filestruct *const foo); |
David Lawrence Ramsey | cd8f735 | 2005-11-10 21:20:32 +0000 | [diff] [blame] | 668 | void backup_lines(filestruct *first_line, size_t par_len); |
David Lawrence Ramsey | 79383be | 2005-11-29 18:34:45 +0000 | [diff] [blame] | 669 | bool find_paragraph(size_t *const quote, size_t *const par); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 670 | void do_justify(bool full_justify); |
| 671 | void do_justify_void(void); |
| 672 | void do_full_justify(void); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 673 | #endif |
David Lawrence Ramsey | cc8185f | 2005-07-25 02:33:45 +0000 | [diff] [blame] | 674 | #ifndef DISABLE_SPELLER |
| 675 | bool do_int_spell_fix(const char *word); |
| 676 | const char *do_int_speller(const char *tempfile_name); |
| 677 | const char *do_alt_speller(char *tempfile_name); |
| 678 | void do_spell(void); |
| 679 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 680 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8e94234 | 2005-07-25 04:21:46 +0000 | [diff] [blame] | 681 | void do_wordlinechar_count(void); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 682 | #endif |
David Lawrence Ramsey | 37ddfa9 | 2005-11-07 06:06:05 +0000 | [diff] [blame] | 683 | void do_verbatim_input(void); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 684 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 685 | /* All functions in utils.c. */ |
David Lawrence Ramsey | c596c0c | 2005-04-19 16:32:08 +0000 | [diff] [blame] | 686 | int digits(size_t n); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 687 | void get_homedir(void); |
David Lawrence Ramsey | c53ab2a | 2004-08-04 18:24:53 +0000 | [diff] [blame] | 688 | bool parse_num(const char *str, ssize_t *val); |
David Lawrence Ramsey | 2cf6d71 | 2005-06-28 06:25:34 +0000 | [diff] [blame] | 689 | bool parse_line_column(const char *str, ssize_t *line, ssize_t *column); |
David Lawrence Ramsey | 6a0d5b8 | 2005-06-13 14:00:22 +0000 | [diff] [blame] | 690 | void align(char **str); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 691 | void null_at(char **data, size_t index); |
| 692 | void unsunder(char *str, size_t true_len); |
| 693 | void sunder(char *str); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 694 | #if !defined(NANO_TINY) && defined(ENABLE_NANORC) |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 695 | #ifndef HAVE_GETLINE |
| 696 | ssize_t ngetline(char **lineptr, size_t *n, FILE *stream); |
| 697 | #endif |
| 698 | #ifndef HAVE_GETDELIM |
| 699 | ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream); |
| 700 | #endif |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 701 | #endif |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 702 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 703 | bool regexp_bol_or_eol(const regex_t *preg, const char *string); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 704 | #endif |
David Lawrence Ramsey | cf9c34a | 2005-11-16 05:59:06 +0000 | [diff] [blame] | 705 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 706 | bool is_whole_word(size_t pos, const char *buf, const char *word); |
David Lawrence Ramsey | cf9c34a | 2005-11-16 05:59:06 +0000 | [diff] [blame] | 707 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 708 | const char *strstrwrapper(const char *haystack, const char *needle, |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 709 | const char *start); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 710 | void nperror(const char *s); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 711 | void *nmalloc(size_t howmuch); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 712 | void *nrealloc(void *ptr, size_t howmuch); |
David Lawrence Ramsey | 4a1fc55 | 2004-11-02 15:18:30 +0000 | [diff] [blame] | 713 | char *mallocstrncpy(char *dest, const char *src, size_t n); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 714 | char *mallocstrcpy(char *dest, const char *src); |
David Lawrence Ramsey | 02517e0 | 2004-09-05 21:40:31 +0000 | [diff] [blame] | 715 | char *mallocstrassn(char *dest, char *src); |
David Lawrence Ramsey | 2b9d6a0 | 2005-11-01 17:45:31 +0000 | [diff] [blame] | 716 | size_t get_page_start(size_t column); |
David Lawrence Ramsey | 81c4e18 | 2005-10-31 23:07:58 +0000 | [diff] [blame] | 717 | size_t xplustabs(void); |
| 718 | size_t actual_x(const char *s, size_t column); |
| 719 | size_t strnlenpt(const char *s, size_t maxlen); |
| 720 | size_t strlenpt(const char *s); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 721 | void new_magicline(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 722 | #ifndef NANO_TINY |
David Lawrence Ramsey | 40bdb68 | 2004-11-03 22:03:41 +0000 | [diff] [blame] | 723 | void remove_magicline(void); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 724 | void mark_order(const filestruct **top, size_t *top_x, const filestruct |
David Lawrence Ramsey | 90e59c1 | 2004-11-05 23:03:03 +0000 | [diff] [blame] | 725 | **bot, size_t *bot_x, bool *right_side_up); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 726 | #endif |
David Lawrence Ramsey | c104ef1 | 2005-07-17 01:44:35 +0000 | [diff] [blame] | 727 | size_t get_totsize(const filestruct *begin, const filestruct *end); |
David Lawrence Ramsey | 00cc565 | 2005-11-02 15:44:01 +0000 | [diff] [blame] | 728 | #ifdef DEBUG |
| 729 | void dump_filestruct(const filestruct *inptr); |
| 730 | void dump_filestruct_reverse(void); |
| 731 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 732 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 733 | /* All functions in winio.c. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 734 | void get_key_buffer(WINDOW *win); |
| 735 | size_t get_key_buffer_len(void); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 736 | void unget_input(int *input, size_t input_len); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 737 | void unget_kbinput(int kbinput, bool meta_key, bool func_key); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 738 | int *get_input(WINDOW *win, size_t input_len); |
David Lawrence Ramsey | eb16f43 | 2004-09-27 01:04:50 +0000 | [diff] [blame] | 739 | int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key); |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 740 | int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key); |
David Lawrence Ramsey | 1b4ae69 | 2006-07-25 19:23:35 +0000 | [diff] [blame] | 741 | int get_escape_seq_kbinput(const int *seq, size_t seq_len); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 742 | int get_escape_seq_abcd(int kbinput); |
David Lawrence Ramsey | 5370b0c | 2006-07-23 17:54:35 +0000 | [diff] [blame] | 743 | int parse_escape_seq_kbinput(WINDOW *win, int kbinput); |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 744 | int get_byte_kbinput(int kbinput); |
David Lawrence Ramsey | 6fb6689 | 2006-05-27 17:39:19 +0000 | [diff] [blame] | 745 | #ifdef ENABLE_UTF8 |
David Lawrence Ramsey | 12e3708 | 2006-05-27 15:52:26 +0000 | [diff] [blame] | 746 | long add_unicode_digit(int kbinput, long factor, long *uni); |
David Lawrence Ramsey | 7f1b119 | 2006-05-28 17:30:28 +0000 | [diff] [blame] | 747 | long get_unicode_kbinput(int kbinput); |
David Lawrence Ramsey | 6fb6689 | 2006-05-27 17:39:19 +0000 | [diff] [blame] | 748 | #endif |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 749 | int get_control_kbinput(int kbinput); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 750 | void unparse_kbinput(char *output, size_t output_len); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 751 | int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); |
| 752 | int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); |
David Lawrence Ramsey | 14bf803 | 2004-05-22 20:19:15 +0000 | [diff] [blame] | 753 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 3a5eaeb | 2007-05-20 23:41:56 +0000 | [diff] [blame] | 754 | int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts); |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 755 | #endif |
David Lawrence Ramsey | 1483ee3 | 2004-11-29 00:30:07 +0000 | [diff] [blame] | 756 | const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool |
David Lawrence Ramsey | eb16f43 | 2004-09-27 01:04:50 +0000 | [diff] [blame] | 757 | *meta_key, bool *func_key); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 758 | #ifndef NANO_TINY |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 759 | const toggle *get_toggle(int kbinput, bool meta_key); |
| 760 | #endif |
David Lawrence Ramsey | b386a90 | 2005-07-10 02:37:38 +0000 | [diff] [blame] | 761 | void blank_line(WINDOW *win, int y, int x, int n); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 762 | void blank_titlebar(void); |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 763 | void blank_topbar(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 764 | void blank_edit(void); |
| 765 | void blank_statusbar(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 766 | void blank_bottombars(void); |
David Lawrence Ramsey | b9ddb80 | 2005-03-17 17:56:48 +0000 | [diff] [blame] | 767 | void check_statusblank(void); |
David Lawrence Ramsey | fc69321 | 2004-12-23 17:43:27 +0000 | [diff] [blame] | 768 | char *display_string(const char *buf, size_t start_col, size_t len, bool |
| 769 | dollars); |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 770 | void titlebar(const char *path); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 771 | void set_modified(void); |
| 772 | void statusbar(const char *msg, ...); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 773 | void bottombars(const shortcut *s); |
David Lawrence Ramsey | fa39404 | 2004-05-23 21:11:14 +0000 | [diff] [blame] | 774 | void onekey(const char *keystroke, const char *desc, size_t len); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 775 | void reset_cursor(void); |
David Lawrence Ramsey | a0aff67 | 2005-10-27 20:10:45 +0000 | [diff] [blame] | 776 | void edit_draw(const filestruct *fileptr, const char *converted, int |
| 777 | line, size_t start); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 778 | void update_line(const filestruct *fileptr, size_t index); |
David Lawrence Ramsey | fa38795 | 2006-08-26 16:50:51 +0000 | [diff] [blame] | 779 | bool need_horizontal_update(size_t pww_save); |
| 780 | bool need_vertical_update(size_t pww_save); |
David Lawrence Ramsey | 107e816 | 2005-08-01 21:05:29 +0000 | [diff] [blame] | 781 | void edit_scroll(scroll_dir direction, ssize_t nlines); |
David Lawrence Ramsey | fa38795 | 2006-08-26 16:50:51 +0000 | [diff] [blame] | 782 | void edit_redraw(const filestruct *old_current, size_t pww_save); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 783 | void edit_refresh(void); |
David Lawrence Ramsey | bf0e47d | 2005-08-01 18:27:10 +0000 | [diff] [blame] | 784 | void edit_update(update_type location); |
David Lawrence Ramsey | c54c4d1 | 2005-06-18 15:49:17 +0000 | [diff] [blame] | 785 | void total_redraw(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 786 | void total_refresh(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 787 | void display_main_list(void); |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 788 | void do_cursorpos(bool constant); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 789 | void do_cursorpos_void(void); |
David Lawrence Ramsey | 7bde053 | 2005-06-30 03:55:55 +0000 | [diff] [blame] | 790 | void do_replace_highlight(bool highlight, const char *word); |
Chris Allegretta | 8a0de3b | 2000-11-24 20:45:14 +0000 | [diff] [blame] | 791 | #ifdef NANO_EXTRA |
Chris Allegretta | 34318ed | 2001-01-31 23:22:36 +0000 | [diff] [blame] | 792 | void do_credits(void); |
Chris Allegretta | 8a0de3b | 2000-11-24 20:45:14 +0000 | [diff] [blame] | 793 | #endif |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 794 | |
| 795 | #endif /* !PROTO_H */ |