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 | f28f50e | 2004-01-09 23:04:55 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2004 Chris Allegretta * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 6 | * 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 Allegretta | 3a24f3f | 2001-10-24 11:33:54 +0000 | [diff] [blame] | 8 | * the Free Software Foundation; either version 2, or (at your option) * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 9 | * any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 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 * |
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * |
| 19 | * * |
| 20 | **************************************************************************/ |
| 21 | |
David Lawrence Ramsey | f28f50e | 2004-01-09 23:04:55 +0000 | [diff] [blame] | 22 | /* Externs. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 23 | |
| 24 | #include <sys/stat.h> |
David Lawrence Ramsey | fd3039a | 2004-07-17 19:49:12 +0000 | [diff] [blame^] | 25 | #include <sys/types.h> |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 26 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 27 | #include <regex.h> |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 28 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 29 | #include "nano.h" |
| 30 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 31 | #ifndef DISABLE_WRAPJUSTIFY |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 32 | extern ssize_t wrap_at; |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 33 | #endif |
Chris Allegretta | 17dcb72 | 2001-01-20 21:40:07 +0000 | [diff] [blame] | 34 | extern int editwinrows; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 35 | extern int current_x, current_y, totlines; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 36 | extern int placewewant; |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 37 | #ifndef NANO_SMALL |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 38 | extern int mark_beginx; |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 39 | #endif |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 40 | extern long totsize; |
David Lawrence Ramsey | edab0cc | 2004-07-03 03:09:12 +0000 | [diff] [blame] | 41 | extern long flags; |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 42 | extern ssize_t tabsize; |
Chris Allegretta | 27eb13f | 2000-11-05 16:52:21 +0000 | [diff] [blame] | 43 | extern int search_last_line; |
Chris Allegretta | 6b58acd | 2001-04-12 03:01:53 +0000 | [diff] [blame] | 44 | extern int currslen; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 45 | |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 46 | #if !defined(NANO_SMALL) && defined(ENABLE_NANORC) |
| 47 | extern char *whitespace; |
| 48 | #endif |
| 49 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 50 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 2c62b07 | 2004-05-29 16:38:57 +0000 | [diff] [blame] | 51 | extern char *punct; |
| 52 | extern char *brackets; |
Chris Allegretta | 45329a1 | 2002-03-10 01:22:21 +0000 | [diff] [blame] | 53 | extern char *quotestr; |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 54 | #endif |
| 55 | |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 56 | #ifndef NANO_SMALL |
| 57 | extern char *backup_dir; |
| 58 | #endif |
| 59 | |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 60 | extern WINDOW *topwin, *edit, *bottomwin; |
Chris Allegretta | 1a6e904 | 2000-12-14 13:56:28 +0000 | [diff] [blame] | 61 | extern char *filename; |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 62 | extern struct stat originalfilestat; |
Chris Allegretta | 31925e4 | 2000-11-02 04:40:39 +0000 | [diff] [blame] | 63 | extern char *answer; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 64 | extern char *hblank; |
| 65 | #ifndef DISABLE_HELP |
| 66 | extern char *help_text; |
| 67 | #endif |
Chris Allegretta | 27eb13f | 2000-11-05 16:52:21 +0000 | [diff] [blame] | 68 | extern char *last_search; |
| 69 | extern char *last_replace; |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 70 | #ifndef DISABLE_OPERATINGDIR |
| 71 | extern char *operating_dir; |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 72 | extern char *full_operating_dir; |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 73 | #endif |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 74 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 75 | extern char *alt_speller; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 76 | #endif |
| 77 | |
Chris Allegretta | 65f075d | 2003-02-13 03:03:49 +0000 | [diff] [blame] | 78 | extern int resetstatuspos; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 79 | extern struct stat fileinfo; |
David Lawrence Ramsey | b977515 | 2004-03-19 02:15:42 +0000 | [diff] [blame] | 80 | extern filestruct *current, *fileage, *edittop, *filebot; |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 81 | extern filestruct *cutbuffer; |
| 82 | #ifndef NANO_SMALL |
| 83 | extern filestruct *mark_beginbuf; |
| 84 | #endif |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 85 | |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 86 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 87 | extern openfilestruct *open_files; |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 88 | #endif |
| 89 | |
Chris Allegretta | 08893e0 | 2001-11-29 02:42:27 +0000 | [diff] [blame] | 90 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 1f28b8f | 2002-09-27 14:21:59 +0000 | [diff] [blame] | 91 | extern const colortype *colorstrings; |
Chris Allegretta | b6c5dc2 | 2002-05-04 03:47:33 +0000 | [diff] [blame] | 92 | extern syntaxtype *syntaxes; |
Chris Allegretta | 09900ff | 2002-05-04 04:23:30 +0000 | [diff] [blame] | 93 | extern char *syntaxstr; |
Chris Allegretta | 08893e0 | 2001-11-29 02:42:27 +0000 | [diff] [blame] | 94 | #endif |
| 95 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 96 | extern shortcut *shortcut_list; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 97 | extern shortcut *main_list, *whereis_list; |
| 98 | extern shortcut *replace_list, *goto_list; |
| 99 | extern shortcut *writefile_list, *insertfile_list; |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 100 | extern shortcut *replace_list_2; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 101 | #ifndef NANO_SMALL |
| 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 |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 111 | extern shortcut *browser_list, *gotodir_list; |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 112 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 113 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 114 | #if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE) |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 115 | extern const shortcut *currshortcut; |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 116 | #endif |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 117 | |
| 118 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 119 | extern regex_t search_regexp; |
David Lawrence Ramsey | c372488 | 2004-05-27 18:39:16 +0000 | [diff] [blame] | 120 | extern regmatch_t regmatches[10]; |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 121 | #ifdef ENABLE_COLOR |
Chris Allegretta | b6c5dc2 | 2002-05-04 03:47:33 +0000 | [diff] [blame] | 122 | extern regex_t syntaxfile_regexp; |
David Lawrence Ramsey | c372488 | 2004-05-27 18:39:16 +0000 | [diff] [blame] | 123 | extern regmatch_t synfilematches[1]; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 124 | #endif /* ENABLE_COLOR */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 125 | #endif /* HAVE_REGEX_H */ |
| 126 | |
| 127 | #ifndef NANO_SMALL |
| 128 | extern toggle *toggles; |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 129 | #endif |
| 130 | |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 131 | #ifndef NANO_SMALL |
| 132 | extern historyheadtype search_history; |
| 133 | extern historyheadtype replace_history; |
| 134 | #endif |
| 135 | |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 136 | extern int curses_ended; |
| 137 | |
David Lawrence Ramsey | f28f50e | 2004-01-09 23:04:55 +0000 | [diff] [blame] | 138 | /* Functions we want available. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 139 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 140 | /* Public functions in color.c */ |
| 141 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 1f28b8f | 2002-09-27 14:21:59 +0000 | [diff] [blame] | 142 | void set_colorpairs(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 143 | void do_colorinit(void); |
| 144 | void update_color(void); |
| 145 | #endif /* ENABLE_COLOR */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 146 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 147 | /* Public functions in cut.c */ |
David Lawrence Ramsey | c833d9e | 2004-05-29 15:36:58 +0000 | [diff] [blame] | 148 | void cutbuffer_reset(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 149 | filestruct *get_cutbottom(void); |
David Lawrence Ramsey | 44e7f82 | 2004-03-30 04:17:10 +0000 | [diff] [blame] | 150 | void add_to_cutbuffer(filestruct *inptr, int allow_concat); |
David Lawrence Ramsey | 8213850 | 2003-12-24 08:03:54 +0000 | [diff] [blame] | 151 | void cut_marked_segment(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 152 | void do_cut_text(void); |
| 153 | void do_uncut_text(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 154 | |
| 155 | /* Public functions in files.c */ |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 156 | void load_file(int update); |
| 157 | void new_file(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 158 | filestruct *read_line(char *buf, filestruct *prev, int *line1ins, size_t |
| 159 | len); |
David Lawrence Ramsey | d717d4b | 2004-07-10 16:53:17 +0000 | [diff] [blame] | 160 | void read_file(FILE *f, const char *filename, int quiet); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 161 | int open_file(const char *filename, int insert, int quiet); |
| 162 | char *get_next_filename(const char *name); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 163 | void do_insertfile(int loading_file); |
| 164 | void do_insertfile_void(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 165 | #ifdef ENABLE_MULTIBUFFER |
| 166 | openfilestruct *make_new_opennode(openfilestruct *prevnode); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 167 | void splice_opennode(openfilestruct *begin, openfilestruct *newnode, |
| 168 | openfilestruct *end); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 169 | void unlink_opennode(const openfilestruct *fileptr); |
| 170 | void delete_opennode(openfilestruct *fileptr); |
| 171 | void free_openfilestruct(openfilestruct *src); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 172 | void add_open_file(int update); |
| 173 | void load_open_file(void); |
| 174 | void open_prevfile(int closing_file); |
| 175 | void open_prevfile_void(void); |
| 176 | void open_nextfile(int closing_file); |
| 177 | void open_nextfile_void(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 178 | int close_open_file(void); |
| 179 | #endif |
| 180 | #if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR) |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 181 | char *get_full_path(const char *origpath); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 182 | #endif |
| 183 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 184 | char *check_writable_directory(const char *path); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 185 | char *safe_tempnam(const char *dirname, const char *filename_prefix); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 186 | #endif |
| 187 | #ifndef DISABLE_OPERATINGDIR |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 188 | void init_operating_dir(void); |
| 189 | int check_operating_dir(const char *currpath, int allow_tabcomp); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 190 | #endif |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 191 | #ifndef NANO_SMALL |
| 192 | void init_backup_dir(void); |
| 193 | #endif |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 194 | int write_file(const char *name, int tmp, int append, int nonamechange); |
David Lawrence Ramsey | 35961c4 | 2004-01-23 19:34:03 +0000 | [diff] [blame] | 195 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 2f0d03b | 2004-05-28 00:15:28 +0000 | [diff] [blame] | 196 | int write_marked(const char *name, int tmp, int append); |
David Lawrence Ramsey | 35961c4 | 2004-01-23 19:34:03 +0000 | [diff] [blame] | 197 | #endif |
David Lawrence Ramsey | 6aec4b8 | 2004-03-15 20:26:30 +0000 | [diff] [blame] | 198 | int do_writeout(int exiting); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 199 | void do_writeout_void(void); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 200 | char *real_dir_from_tilde(const char *buf); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 201 | #ifndef DISABLE_TABCOMP |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 202 | int append_slash_if_dir(char *buf, int *lastwastab, int *place); |
| 203 | char **username_tab_completion(char *buf, int *num_matches); |
| 204 | char **cwd_tab_completion(char *buf, int *num_matches); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 205 | char *input_tab(char *buf, int place, int *lastwastab, int *newplace, |
| 206 | int *list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 207 | #endif |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 208 | const char *tail(const char *foo); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 209 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 210 | int diralphasort(const void *va, const void *vb); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 211 | void free_charptrarray(char **array, size_t len); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 212 | void striponedir(char *foo); |
Chris Allegretta | 858d9d9 | 2003-01-30 00:53:32 +0000 | [diff] [blame] | 213 | int readable_dir(const char *path); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 214 | char **browser_init(const char *path, int *longest, int *numents); |
| 215 | char *do_browser(const char *inpath); |
| 216 | char *do_browse_from(const char *inpath); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 217 | #endif |
| 218 | |
| 219 | /* Public functions in global.c */ |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 220 | size_t length_of_list(const shortcut *s); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 221 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 2ad3209 | 2004-07-07 14:36:44 +0000 | [diff] [blame] | 222 | void toggle_init_one(int val, const char *desc, long flag); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 223 | void toggle_init(void); |
| 224 | #ifdef DEBUG |
| 225 | void free_toggles(void); |
| 226 | #endif |
| 227 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 228 | void sc_init_one(shortcut **shortcutage, int key, const char *desc, |
| 229 | #ifndef DISABLE_HELP |
| 230 | const char *help, |
| 231 | #endif |
| 232 | int metaval, int funcval, int miscval, int view, void |
| 233 | (*func)(void)); |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 234 | void shortcut_init(int unjustify); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 235 | void free_shortcutage(shortcut **shortcutage); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 236 | #ifdef DEBUG |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 237 | void thanks_for_all_the_fish(void); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 238 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 239 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 240 | /* Public functions in move.c */ |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 241 | void do_first_line(void); |
| 242 | void do_last_line(void); |
| 243 | void do_home(void); |
| 244 | void do_end(void); |
| 245 | void do_page_up(void); |
| 246 | void do_page_down(void); |
| 247 | void do_up(void); |
| 248 | void do_down(void); |
| 249 | void do_left(int allow_update); |
| 250 | void do_left_void(void); |
| 251 | void do_right(int allow_update); |
| 252 | void do_right_void(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 253 | |
| 254 | /* Public functions in nano.c */ |
David Lawrence Ramsey | da14106 | 2004-05-25 19:41:11 +0000 | [diff] [blame] | 255 | void finish(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 256 | void die(const char *msg, ...); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 257 | void die_save_file(const char *die_filename); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 258 | void die_too_small(void); |
| 259 | void print_view_warning(void); |
| 260 | void global_init(int save_cutbuffer); |
| 261 | void window_init(void); |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 262 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 263 | void mouse_init(void); |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 264 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 265 | #ifndef DISABLE_HELP |
| 266 | void help_init(void); |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 267 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 268 | filestruct *make_new_node(filestruct *prevnode); |
| 269 | filestruct *copy_node(const filestruct *src); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 270 | void splice_node(filestruct *begin, filestruct *newnode, filestruct |
| 271 | *end); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 272 | void unlink_node(const filestruct *fileptr); |
| 273 | void delete_node(filestruct *fileptr); |
| 274 | filestruct *copy_filestruct(const filestruct *src); |
| 275 | void free_filestruct(filestruct *src); |
| 276 | void renumber_all(void); |
| 277 | void renumber(filestruct *fileptr); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 278 | void print1opt(const char *shortflag, const char *longflag, const char |
| 279 | *desc); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 280 | void usage(void); |
| 281 | void version(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 282 | int no_help(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 283 | void nano_disabled_msg(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 284 | #ifndef NANO_SMALL |
| 285 | RETSIGTYPE cancel_fork(int signal); |
| 286 | int open_pipe(const char *command); |
| 287 | #endif |
| 288 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 289 | void do_mouse(void); |
| 290 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 291 | void do_char(char ch); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 292 | void do_verbatim_input(void); |
| 293 | void do_backspace(void); |
| 294 | void do_delete(void); |
| 295 | void do_tab(void); |
| 296 | void do_enter(void); |
David Lawrence Ramsey | c97acfb | 2003-09-10 20:08:00 +0000 | [diff] [blame] | 297 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 298 | void do_next_word(void); |
| 299 | void do_prev_word(void); |
| 300 | void do_mark(void); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 301 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 302 | #ifndef DISABLE_WRAPPING |
David Lawrence Ramsey | c97acfb | 2003-09-10 20:08:00 +0000 | [diff] [blame] | 303 | void wrap_reset(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 304 | int do_wrap(filestruct *inptr); |
| 305 | #endif |
| 306 | #ifndef DISABLE_SPELLER |
| 307 | int do_int_spell_fix(const char *word); |
David Lawrence Ramsey | fa39404 | 2004-05-23 21:11:14 +0000 | [diff] [blame] | 308 | const char *do_int_speller(char *tempfile_name); |
| 309 | const char *do_alt_speller(char *tempfile_name); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 310 | void do_spell(void); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 311 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 312 | #if !defined(DISABLE_WRAPPING) && !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY) |
| 313 | size_t indent_length(const char *line); |
| 314 | #endif |
| 315 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 1cadddd | 2004-05-17 20:32:51 +0000 | [diff] [blame] | 316 | void justify_format(filestruct *line, size_t skip); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 317 | #ifdef HAVE_REGEX_H |
| 318 | size_t quote_length(const char *line, const regex_t *qreg); |
| 319 | #else |
| 320 | size_t quote_length(const char *line); |
| 321 | #endif |
| 322 | #ifdef HAVE_REGEX_H |
| 323 | # define IFREG(a, b) a, b |
| 324 | #else |
| 325 | # define IFREG(a, b) a |
| 326 | #endif |
David Lawrence Ramsey | d4693cb | 2004-05-14 01:17:25 +0000 | [diff] [blame] | 327 | int quotes_match(const char *a_line, size_t a_quote, IFREG(const char |
| 328 | *b_line, const regex_t *qreg)); |
| 329 | size_t indents_match(const char *a_line, size_t a_indent, const char |
| 330 | *b_line, size_t b_indent); |
| 331 | filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t |
| 332 | quote_len); |
Chris Allegretta | cff6e6f | 2003-02-03 03:22:02 +0000 | [diff] [blame] | 333 | int breakable(const char *line, int goal); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 334 | int break_line(const char *line, int goal, int force); |
David Lawrence Ramsey | 2e3aeae | 2004-05-24 05:52:35 +0000 | [diff] [blame] | 335 | int do_para_search(justbegend search_type, size_t *quote, size_t *par, |
| 336 | size_t *indent, int do_refresh); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 337 | void do_para_begin(void); |
| 338 | void do_para_end(void); |
| 339 | void do_justify(int full_justify); |
| 340 | void do_justify_void(void); |
| 341 | void do_full_justify(void); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 342 | #endif /* !DISABLE_JUSTIFY */ |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 343 | void do_exit(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 344 | void signal_init(void); |
David Lawrence Ramsey | 2ab03f6 | 2002-10-17 02:19:31 +0000 | [diff] [blame] | 345 | RETSIGTYPE handle_hupterm(int signal); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 346 | RETSIGTYPE do_suspend(int signal); |
| 347 | RETSIGTYPE do_cont(int signal); |
| 348 | #ifndef NANO_SMALL |
| 349 | void handle_sigwinch(int s); |
David Lawrence Ramsey | 369732f | 2004-02-16 20:32:40 +0000 | [diff] [blame] | 350 | void allow_pending_sigwinch(int allow); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 351 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 352 | #ifndef NANO_SMALL |
| 353 | void do_toggle(const toggle *which); |
| 354 | #endif |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 355 | #if !defined(NANO_SMALL) || defined(USE_SLANG) |
| 356 | void disable_signals(void); |
| 357 | #endif |
| 358 | #ifndef NANO_SMALL |
| 359 | void enable_signals(void); |
| 360 | #endif |
| 361 | void disable_flow_control(void); |
| 362 | void enable_flow_control(void); |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 363 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 364 | /* Public functions in rcfile.c */ |
Chris Allegretta | 7a50009 | 2001-04-19 21:13:46 +0000 | [diff] [blame] | 365 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 366 | void rcfile_error(const char *msg, ...); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 367 | char *parse_next_word(char *ptr); |
| 368 | char *parse_argument(char *ptr); |
| 369 | #ifdef ENABLE_COLOR |
| 370 | int colortoint(const char *colorname, int *bright); |
| 371 | char *parse_next_regex(char *ptr); |
David Lawrence Ramsey | edab0cc | 2004-07-03 03:09:12 +0000 | [diff] [blame] | 372 | int nregcomp(regex_t *preg, const char *regex, int eflags); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 373 | void parse_syntax(char *ptr); |
| 374 | void parse_colors(char *ptr); |
| 375 | #endif /* ENABLE_COLOR */ |
| 376 | void parse_rcfile(FILE *rcstream); |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 377 | void do_rcfile(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 378 | #endif /* ENABLE_NANORC */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 379 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 380 | /* Public functions in search.c */ |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 381 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 5d71514 | 2003-01-29 04:18:37 +0000 | [diff] [blame] | 382 | int regexp_init(const char *regexp); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 383 | void regexp_cleanup(void); |
| 384 | #endif |
| 385 | void not_found_msg(const char *str); |
| 386 | void search_abort(void); |
| 387 | void search_init_globals(void); |
| 388 | int search_init(int replacing); |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 389 | int is_whole_word(int curr_pos, const char *datastr, const char |
| 390 | *searchword); |
| 391 | int findnextstr(int can_display_wrap, int wholeword, const filestruct |
| 392 | *begin, size_t beginx, const char *needle, int no_sameline); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 393 | void do_search(void); |
David Lawrence Ramsey | 5aa3983 | 2004-05-05 21:36:50 +0000 | [diff] [blame] | 394 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 395 | void do_research(void); |
David Lawrence Ramsey | 5aa3983 | 2004-05-05 21:36:50 +0000 | [diff] [blame] | 396 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 397 | void replace_abort(void); |
| 398 | #ifdef HAVE_REGEX_H |
| 399 | int replace_regexp(char *string, int create_flag); |
| 400 | #endif |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 401 | char *replace_line(const char *needle); |
| 402 | int do_replace_loop(const char *needle, const filestruct *real_current, |
| 403 | size_t *real_current_x, int wholewords); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 404 | void do_replace(void); |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 405 | void do_gotoline(ssize_t line, int save_pos); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 406 | void do_gotoline_void(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 407 | #if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER) |
| 408 | void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant); |
| 409 | #endif |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 410 | void do_find_bracket(void); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 411 | #ifndef NANO_SMALL |
| 412 | void history_init(void); |
| 413 | historytype *find_node(historytype *h, char *s); |
| 414 | void remove_node(historytype *r); |
| 415 | void insert_node(historytype *h, const char *s); |
| 416 | void update_history(historyheadtype *h, char *s); |
| 417 | char *get_history_older(historyheadtype *h); |
| 418 | char *get_history_newer(historyheadtype *h); |
| 419 | char *get_history_completion(historyheadtype *h, char *s); |
| 420 | void free_history(historyheadtype *h); |
Chris Allegretta | f3de8b5 | 2003-01-16 23:44:46 +0000 | [diff] [blame] | 421 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | c372488 | 2004-05-27 18:39:16 +0000 | [diff] [blame] | 422 | void load_history(void); |
Chris Allegretta | f3de8b5 | 2003-01-16 23:44:46 +0000 | [diff] [blame] | 423 | void save_history(void); |
| 424 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 425 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 426 | |
| 427 | /* Public functions in utils.c */ |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 428 | #ifdef HAVE_REGEX_H |
Chris Allegretta | d845193 | 2003-03-11 03:50:40 +0000 | [diff] [blame] | 429 | #ifdef BROKEN_REGEXEC |
| 430 | int regexec_safe(const regex_t *preg, const char *string, size_t nmatch, |
| 431 | regmatch_t pmatch[], int eflags); |
| 432 | #endif |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 433 | int regexp_bol_or_eol(const regex_t *preg, const char *string); |
| 434 | #endif |
David Lawrence Ramsey | 9830d75 | 2004-05-13 17:19:54 +0000 | [diff] [blame] | 435 | #ifndef HAVE_ISBLANK |
| 436 | int is_blank_char(int c); |
| 437 | #endif |
Chris Allegretta | cf287c8 | 2002-07-20 13:57:41 +0000 | [diff] [blame] | 438 | int is_cntrl_char(int c); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 439 | int num_of_digits(int n); |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 440 | int parse_num(const char *str, ssize_t *val); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 441 | void align(char **strp); |
| 442 | void null_at(char **data, size_t index); |
| 443 | void unsunder(char *str, size_t true_len); |
| 444 | void sunder(char *str); |
Chris Allegretta | 4f5335d | 2003-08-04 02:51:12 +0000 | [diff] [blame] | 445 | #ifndef HAVE_STRCASECMP |
| 446 | int nstricmp(const char *s1, const char *s2); |
| 447 | #endif |
| 448 | #ifndef HAVE_STRNCASECMP |
| 449 | int nstrnicmp(const char *s1, const char *s2, size_t n); |
| 450 | #endif |
David Lawrence Ramsey | 14bf803 | 2004-05-22 20:19:15 +0000 | [diff] [blame] | 451 | #ifndef HAVE_STRCASESTR |
David Lawrence Ramsey | a3370c4 | 2004-04-05 01:08:14 +0000 | [diff] [blame] | 452 | const char *nstristr(const char *haystack, const char *needle); |
David Lawrence Ramsey | 14bf803 | 2004-05-22 20:19:15 +0000 | [diff] [blame] | 453 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 454 | #ifndef NANO_SMALL |
David Lawrence Ramsey | a3370c4 | 2004-04-05 01:08:14 +0000 | [diff] [blame] | 455 | const char *revstrstr(const char *haystack, const char *needle, const |
| 456 | char *rev_start); |
| 457 | const char *revstristr(const char *haystack, const char *needle, const |
| 458 | char *rev_start); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 459 | #endif |
David Lawrence Ramsey | fa39404 | 2004-05-23 21:11:14 +0000 | [diff] [blame] | 460 | #ifndef HAVE_STRNLEN |
| 461 | size_t nstrnlen(const char *s, size_t maxlen); |
| 462 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 463 | const char *strstrwrapper(const char *haystack, const char *needle, |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 464 | const char *start); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 465 | void nperror(const char *s); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 466 | void *nmalloc(size_t howmuch); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 467 | void *nrealloc(void *ptr, size_t howmuch); |
| 468 | char *mallocstrcpy(char *dest, const char *src); |
| 469 | void new_magicline(void); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 470 | #ifndef NANO_SMALL |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 471 | void mark_order(const filestruct **top, size_t *top_x, const filestruct |
| 472 | **bot, size_t *bot_x); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 473 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 474 | #ifndef DISABLE_TABCOMP |
| 475 | int check_wildcard_match(const char *text, const char *pattern); |
| 476 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 477 | |
| 478 | /* Public functions in winio.c */ |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 479 | #ifndef NANO_SMALL |
| 480 | void reset_kbinput(void); |
| 481 | #endif |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 482 | int get_kbinput(WINDOW *win, int *meta_key); |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 483 | int get_translated_kbinput(int kbinput, int *es |
| 484 | #ifndef NANO_SMALL |
| 485 | , int reset |
| 486 | #endif |
| 487 | ); |
| 488 | int get_ascii_kbinput(int kbinput, size_t ascii_digits |
| 489 | #ifndef NANO_SMALL |
| 490 | , int reset |
| 491 | #endif |
| 492 | ); |
| 493 | int get_control_kbinput(int kbinput); |
David Lawrence Ramsey | e65e639 | 2004-06-04 18:18:17 +0000 | [diff] [blame] | 494 | int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int |
| 495 | *ignore_seq); |
David Lawrence Ramsey | c2c5a51 | 2004-01-23 19:26:17 +0000 | [diff] [blame] | 496 | int get_escape_seq_abcd(int kbinput); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 497 | int *get_verbatim_kbinput(WINDOW *win, int *v_kbinput, size_t *v_len, |
| 498 | int allow_ascii); |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 499 | int get_untranslated_kbinput(int kbinput, size_t position, int |
| 500 | allow_ascii |
| 501 | #ifndef NANO_SMALL |
| 502 | , int reset |
| 503 | #endif |
| 504 | ); |
David Lawrence Ramsey | 14bf803 | 2004-05-22 20:19:15 +0000 | [diff] [blame] | 505 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 506 | int get_mouseinput(int *mouse_x, int *mouse_y, int allow_shortcuts); |
David Lawrence Ramsey | 14bf803 | 2004-05-22 20:19:15 +0000 | [diff] [blame] | 507 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 508 | size_t xplustabs(void); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 509 | size_t actual_x(const char *str, size_t xplus); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 510 | size_t strnlenpt(const char *buf, size_t size); |
| 511 | size_t strlenpt(const char *buf); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 512 | void blank_titlebar(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 513 | void blank_edit(void); |
| 514 | void blank_statusbar(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 515 | void check_statblank(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 516 | void blank_bottombars(void); |
| 517 | char *display_string(const char *buf, size_t start_col, size_t len); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 518 | void nanoget_repaint(const char *buf, const char *inputbuf, size_t x); |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 519 | int nanogetstr(int allowtabs, const char *buf, const char *def, |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 520 | #ifndef NANO_SMALL |
| 521 | historyheadtype *history_list, |
| 522 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 523 | const shortcut *s |
| 524 | #ifndef DISABLE_TABCOMP |
| 525 | , int *list |
| 526 | #endif |
Chris Allegretta | 65f075d | 2003-02-13 03:03:49 +0000 | [diff] [blame] | 527 | ); |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 528 | void titlebar(const char *path); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 529 | void set_modified(void); |
| 530 | void statusbar(const char *msg, ...); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 531 | void bottombars(const shortcut *s); |
David Lawrence Ramsey | fa39404 | 2004-05-23 21:11:14 +0000 | [diff] [blame] | 532 | void onekey(const char *keystroke, const char *desc, size_t len); |
David Lawrence Ramsey | 1f28b8f | 2002-09-27 14:21:59 +0000 | [diff] [blame] | 533 | #ifndef NDEBUG |
| 534 | int check_linenumbers(const filestruct *fileptr); |
| 535 | #endif |
David Lawrence Ramsey | 2dd7ed1 | 2003-09-29 05:15:24 +0000 | [diff] [blame] | 536 | size_t get_page_start(size_t column); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 537 | void reset_cursor(void); |
David Lawrence Ramsey | 07d3feb | 2004-04-16 05:15:11 +0000 | [diff] [blame] | 538 | void edit_add(const filestruct *fileptr, const char *converted, int |
| 539 | yval, size_t start); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 540 | void update_line(const filestruct *fileptr, size_t index); |
David Lawrence Ramsey | 2ed225f | 2004-05-28 20:44:09 +0000 | [diff] [blame] | 541 | int need_horizontal_update(int old_placewewant); |
| 542 | int need_vertical_update(int old_placewewant); |
| 543 | void edit_scroll(updown direction, int nlines); |
David Lawrence Ramsey | c21790d | 2004-05-30 03:19:52 +0000 | [diff] [blame] | 544 | void edit_redraw(const filestruct *old_current, int old_pww); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 545 | void edit_refresh(void); |
David Lawrence Ramsey | 1356a0a | 2003-09-10 20:31:02 +0000 | [diff] [blame] | 546 | void edit_update(filestruct *fileptr, topmidnone location); |
David Lawrence Ramsey | 6aec4b8 | 2004-03-15 20:26:30 +0000 | [diff] [blame] | 547 | int statusq(int allowtabs, const shortcut *s, const char *def, |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 548 | #ifndef NANO_SMALL |
| 549 | historyheadtype *history_list, |
| 550 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 551 | const char *msg, ...); |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 552 | int do_yesno(int all, const char *msg); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 553 | void total_refresh(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 554 | void display_main_list(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 555 | void do_cursorpos(int constant); |
| 556 | void do_cursorpos_void(void); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 557 | size_t line_len(const char *ptr); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 558 | void do_help(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 559 | void do_replace_highlight(int highlight_flag, const char *word); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 560 | #ifdef DEBUG |
| 561 | void dump_buffer(const filestruct *inptr); |
| 562 | void dump_buffer_reverse(void); |
| 563 | #endif |
Chris Allegretta | 8a0de3b | 2000-11-24 20:45:14 +0000 | [diff] [blame] | 564 | #ifdef NANO_EXTRA |
Chris Allegretta | 34318ed | 2001-01-31 23:22:36 +0000 | [diff] [blame] | 565 | void do_credits(void); |
Chris Allegretta | 8a0de3b | 2000-11-24 20:45:14 +0000 | [diff] [blame] | 566 | #endif |