Add Nano tool - user-friendly text editor
[tomato.git] / release / src / router / nano / src / proto.h
blobe05eefe86f3a3afa9b49a565ec5e56b9dfc7293f
1 /* $Id: proto.h 4460 2009-12-09 16:51:43Z astyanax $ */
2 /**************************************************************************
3 * proto.h *
4 * *
5 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
6 * 2008, 2009 Free Software Foundation, Inc. *
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 *
9 * the Free Software Foundation; either version 3, or (at your option) *
10 * any later version. *
11 * *
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. *
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 *
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
20 * 02110-1301, USA. *
21 * *
22 **************************************************************************/
24 #ifndef PROTO_H
25 #define PROTO_H 1
27 #include "nano.h"
29 /* All external variables. See global.c for their descriptions. */
30 #ifndef NANO_TINY
31 extern sigjmp_buf jump_buf;
32 extern bool jump_buf_main;
33 extern bool use_undo;
34 #endif
36 #ifndef DISABLE_WRAPJUSTIFY
37 extern ssize_t fill;
38 extern ssize_t wrap_at;
39 #endif
41 extern char *last_search;
42 extern char *last_replace;
44 extern unsigned flags[4];
45 extern WINDOW *topwin;
46 extern WINDOW *edit;
47 extern WINDOW *bottomwin;
48 extern int editwinrows;
49 extern int maxrows;
51 extern filestruct *cutbuffer;
52 extern filestruct *cutbottom;
53 #ifndef DISABLE_JUSTIFY
54 extern filestruct *jusbuffer;
55 #endif
56 extern partition *filepart;
57 extern openfilestruct *openfile;
59 #ifndef NANO_TINY
60 extern char *matchbrackets;
61 #endif
63 #if !defined(NANO_TINY) && defined(ENABLE_NANORC)
64 extern char *whitespace;
65 extern int whitespace_len[2];
66 extern undo_type last_action;
67 #endif
69 #ifndef DISABLE_JUSTIFY
70 extern char *punct;
71 extern char *brackets;
72 extern char *quotestr;
73 #ifdef HAVE_REGEX_H
74 extern regex_t quotereg;
75 extern int quoterc;
76 extern char *quoteerr;
77 #else
78 extern size_t quotelen;
79 #endif
80 #endif
81 extern bool nodelay_mode;
82 extern char *answer;
84 extern ssize_t tabsize;
86 #ifndef NANO_TINY
87 extern char *backup_dir;
88 #endif
89 #ifndef DISABLE_OPERATINGDIR
90 extern char *operating_dir;
91 extern char *full_operating_dir;
92 #endif
94 #ifndef DISABLE_SPELLER
95 extern char *alt_speller;
96 #endif
98 extern sc *sclist;
99 extern subnfunc *allfuncs;
100 #ifdef ENABLE_COLOR
101 extern syntaxtype *syntaxes;
102 extern char *syntaxstr;
103 #endif
105 extern bool edit_refresh_needed;
106 extern const shortcut *currshortcut;
107 extern int currmenu;
109 #ifndef NANO_TINY
110 extern filestruct *search_history;
111 extern filestruct *searchage;
112 extern filestruct *searchbot;
113 extern filestruct *replace_history;
114 extern filestruct *replaceage;
115 extern filestruct *replacebot;
116 #endif
118 #ifdef HAVE_REGEX_H
119 extern regex_t search_regexp;
120 extern regmatch_t regmatches[10];
121 #endif
123 extern int reverse_attr;
125 extern char *homedir;
127 /* All functions in browser.c. */
128 #ifndef DISABLE_BROWSER
129 char *do_browser(char *path, DIR *dir);
130 char *do_browse_from(const char *inpath);
131 void browser_init(const char *path, DIR *dir);
132 void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
133 void browser_refresh(void);
134 bool browser_select_filename(const char *needle);
135 int filesearch_init(void);
136 bool findnextfile(bool no_sameline, size_t begin, const char *needle);
137 void findnextfile_wrap_reset(void);
138 void filesearch_abort(void);
139 void do_filesearch(void);
140 void do_fileresearch(void);
141 void do_first_file(void);
142 void do_last_file(void);
143 char *striponedir(const char *path);
144 #endif
146 /* All functions in chars.c. */
147 #ifdef ENABLE_UTF8
148 void utf8_init(void);
149 bool using_utf8(void);
150 #endif
151 #ifndef HAVE_ISBLANK
152 bool nisblank(int c);
153 #endif
154 #if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
155 bool niswblank(wchar_t wc);
156 #endif
157 bool is_byte(int c);
158 bool is_alnum_mbchar(const char *c);
159 bool is_blank_mbchar(const char *c);
160 bool is_ascii_cntrl_char(int c);
161 bool is_cntrl_char(int c);
162 #ifdef ENABLE_UTF8
163 bool is_cntrl_wchar(wchar_t wc);
164 #endif
165 bool is_cntrl_mbchar(const char *c);
166 bool is_punct_mbchar(const char *c);
167 bool is_word_mbchar(const char *c, bool allow_punct);
168 char control_rep(char c);
169 #ifdef ENABLE_UTF8
170 wchar_t control_wrep(wchar_t c);
171 #endif
172 char *control_mbrep(const char *c, char *crep, int *crep_len);
173 char *mbrep(const char *c, char *crep, int *crep_len);
174 int mbwidth(const char *c);
175 int mb_cur_max(void);
176 char *make_mbchar(long chr, int *chr_mb_len);
177 int parse_mbchar(const char *buf, char *chr, size_t *col);
178 size_t move_mbleft(const char *buf, size_t pos);
179 size_t move_mbright(const char *buf, size_t pos);
180 #ifndef HAVE_STRCASECMP
181 int nstrcasecmp(const char *s1, const char *s2);
182 #endif
183 int mbstrcasecmp(const char *s1, const char *s2);
184 #ifndef HAVE_STRNCASECMP
185 int nstrncasecmp(const char *s1, const char *s2, size_t n);
186 #endif
187 int mbstrncasecmp(const char *s1, const char *s2, size_t n);
188 #ifndef HAVE_STRCASESTR
189 char *nstrcasestr(const char *haystack, const char *needle);
190 #endif
191 char *mbstrcasestr(const char *haystack, const char *needle);
192 #if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
193 char *revstrstr(const char *haystack, const char *needle, const char
194 *rev_start);
195 #endif
196 #ifndef NANO_TINY
197 char *revstrcasestr(const char *haystack, const char *needle, const char
198 *rev_start);
199 char *mbrevstrcasestr(const char *haystack, const char *needle, const
200 char *rev_start);
201 #endif
202 size_t mbstrlen(const char *s);
203 #ifndef HAVE_STRNLEN
204 size_t nstrnlen(const char *s, size_t maxlen);
205 #endif
206 size_t mbstrnlen(const char *s, size_t maxlen);
207 #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
208 char *mbstrchr(const char *s, const char *c);
209 #endif
210 #ifndef NANO_TINY
211 char *mbstrpbrk(const char *s, const char *accept);
212 char *revstrpbrk(const char *s, const char *accept, const char
213 *rev_start);
214 char *mbrevstrpbrk(const char *s, const char *accept, const char
215 *rev_start);
216 #endif
217 #if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
218 bool has_blank_chars(const char *s);
219 bool has_blank_mbchars(const char *s);
220 #endif
221 #ifdef ENABLE_UTF8
222 bool is_valid_unicode(wchar_t wc);
223 #endif
224 #ifdef ENABLE_NANORC
225 bool is_valid_mbstring(const char *s);
226 #endif
228 /* All functions in color.c. */
229 #ifdef ENABLE_COLOR
230 void set_colorpairs(void);
231 void color_init(void);
232 void color_update(void);
233 #endif
235 /* All functions in cut.c. */
236 void cutbuffer_reset(void);
237 void cut_line(void);
238 #ifndef NANO_TINY
239 void cut_marked(void);
240 void cut_to_eol(void);
241 void cut_to_eof(void);
242 #endif
243 void do_cut_text(
244 #ifndef NANO_TINY
245 bool copy_text, bool cut_till_end, bool undoing
246 #else
247 void
248 #endif
250 void do_cut_text_void(void);
251 #ifndef NANO_TINY
252 void do_copy_text(void);
253 void do_cut_till_end(void);
254 #endif
255 void do_uncut_text(void);
257 /* All functions in files.c. */
258 void make_new_buffer(void);
259 void initialize_buffer(void);
260 void initialize_buffer_text(void);
261 void open_buffer(const char *filename, bool undoable);
262 #ifndef DISABLE_SPELLER
263 void replace_buffer(const char *filename);
264 #endif
265 void display_buffer(void);
266 #ifdef ENABLE_MULTIBUFFER
267 void switch_to_prevnext_buffer(bool next);
268 void switch_to_prev_buffer_void(void);
269 void switch_to_next_buffer_void(void);
270 bool close_buffer(void);
271 #endif
272 filestruct *read_line(char *buf, filestruct *prevnode, bool
273 *first_line_ins, size_t buf_len);
274 void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
275 int open_file(const char *filename, bool newfie, FILE **f);
276 char *get_next_filename(const char *name, const char *suffix);
277 void do_insertfile(
278 #ifndef NANO_TINY
279 bool execute
280 #else
281 void
282 #endif
284 void do_insertfile_void(void);
285 char *get_full_path(const char *origpath);
286 char *check_writable_directory(const char *path);
287 char *safe_tempfile(FILE **f);
288 #ifndef DISABLE_OPERATINGDIR
289 void init_operating_dir(void);
290 bool check_operating_dir(const char *currpath, bool allow_tabcomp);
291 #endif
292 #ifndef NANO_TINY
293 void init_backup_dir(void);
294 #endif
295 int copy_file(FILE *inn, FILE *out);
296 bool write_file(const char *name, FILE *f_open, bool tmp, append_type
297 append, bool nonamechange);
298 #ifndef NANO_TINY
299 bool write_marked_file(const char *name, FILE *f_open, bool tmp,
300 append_type append);
301 #endif
302 bool do_writeout(bool exiting);
303 void do_writeout_void(void);
304 char *real_dir_from_tilde(const char *buf);
305 #if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
306 int diralphasort(const void *va, const void *vb);
307 void free_chararray(char **array, size_t len);
308 #endif
309 #ifndef DISABLE_TABCOMP
310 bool is_dir(const char *buf);
311 char **username_tab_completion(const char *buf, size_t *num_matches,
312 size_t buf_len);
313 char **cwd_tab_completion(const char *buf, bool allow_files, size_t
314 *num_matches, size_t buf_len);
315 char *input_tab(char *buf, bool allow_files, size_t *place, bool
316 *lastwastab, void (*refresh_func)(void), bool *list);
317 #endif
318 const char *tail(const char *foo);
319 #if !defined(NANO_TINY) && defined(ENABLE_NANORC)
320 char *histfilename(void);
321 void load_history(void);
322 bool writehist(FILE *hist, filestruct *histhead);
323 void save_history(void);
324 #endif
326 /* All functions in global.c. */
327 size_t length_of_list(int menu);
328 #ifndef NANO_TINY
329 void toggle_init_one(int val
330 #ifndef DISABLE_HELP
331 , const char *desc, bool blank_after
332 #endif
333 , long flag);
334 void toggle_init(void);
335 #endif
336 void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc
337 #ifndef DISABLE_HELP
338 , const char *help, bool blank_after
339 #endif
340 , int metaval, int funcval, int miscval, bool view, void
341 (*func)(void));
342 void shortcut_init(bool unjustify);
343 void free_shortcutage(shortcut **shortcutage);
344 #ifdef DEBUG
345 void thanks_for_all_the_fish(void);
346 #endif
348 /* All functions in help.c. */
349 #ifndef DISABLE_BROWSER
350 void do_browser_help(void);
351 #endif
352 void do_help_void(void);
353 #ifndef DISABLE_HELP
354 void do_help(void (*refresh_func)(void));
355 void help_init(void);
356 void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
357 size_t help_line_len(const char *ptr);
358 #endif
360 /* All functions in move.c. */
361 void do_first_line(void);
362 void do_last_line(void);
363 void do_page_up(void);
364 void do_page_down(void);
365 #ifndef DISABLE_JUSTIFY
366 void do_para_begin(bool allow_update);
367 void do_para_begin_void(void);
368 void do_para_end(bool allow_update);
369 void do_para_end_void(void);
370 #endif
371 #ifndef NANO_TINY
372 bool do_next_word(bool allow_punct, bool allow_update);
373 void do_next_word_void(void);
374 bool do_prev_word(bool allow_punct, bool allow_update);
375 void do_prev_word_void(void);
376 #endif
377 void do_home(void);
378 void do_end(void);
379 void do_up(
380 #ifndef NANO_TINY
381 bool scroll_only
382 #else
383 void
384 #endif
386 void do_up_void(void);
387 #ifndef NANO_TINY
388 void do_scroll_up(void);
389 #endif
390 void do_down(
391 #ifndef NANO_TINY
392 bool scroll_only
393 #else
394 void
395 #endif
397 void do_down_void(void);
398 #ifndef NANO_TINY
399 void do_scroll_down(void);
400 #endif
401 void do_left(void);
402 void do_right(void);
404 /* All functions in nano.c. */
405 filestruct *make_new_node(filestruct *prevnode);
406 filestruct *copy_node(const filestruct *src);
407 void splice_node(filestruct *begin, filestruct *newnode, filestruct
408 *end);
409 void unlink_node(const filestruct *fileptr);
410 void delete_node(filestruct *fileptr);
411 filestruct *copy_filestruct(const filestruct *src);
412 void free_filestruct(filestruct *src);
413 void renumber(filestruct *fileptr);
414 partition *partition_filestruct(filestruct *top, size_t top_x,
415 filestruct *bot, size_t bot_x);
416 void unpartition_filestruct(partition **p);
417 void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
418 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
419 void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
420 openfilestruct *make_new_opennode(void);
421 void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
422 openfilestruct *end);
423 void unlink_opennode(openfilestruct *fileptr);
424 void delete_opennode(openfilestruct *fileptr);
425 #ifdef DEBUG
426 void free_openfilestruct(openfilestruct *src);
427 #endif
428 void print_view_warning(void);
429 void finish(void);
430 void die(const char *msg, ...);
431 void die_save_file(const char *die_filename
432 #ifndef NANO_TINY
433 , struct stat *die_stat
434 #endif
436 void window_init(void);
437 #ifndef DISABLE_MOUSE
438 void disable_mouse_support(void);
439 void enable_mouse_support(void);
440 void mouse_init(void);
441 #endif
442 void print_opt_full(const char *shortflag
443 #ifdef HAVE_GETOPT_LONG
444 , const char *longflag
445 #endif
446 , const char *desc);
447 void usage(void);
448 void version(void);
449 int no_more_space(void);
450 int no_help(void);
451 void nano_disabled_msg(void);
452 void do_exit(void);
453 void signal_init(void);
454 RETSIGTYPE handle_hupterm(int signal);
455 RETSIGTYPE do_suspend(int signal);
456 RETSIGTYPE do_continue(int signal);
457 #ifndef NANO_TINY
458 RETSIGTYPE handle_sigwinch(int signal);
459 void allow_pending_sigwinch(bool allow);
460 #endif
461 #ifndef NANO_TINY
462 void do_toggle(int flag);
463 #endif
464 void disable_extended_io(void);
465 #ifdef USE_SLANG
466 void disable_signals(void);
467 #endif
468 #ifndef NANO_TINY
469 void enable_signals(void);
470 #endif
471 void disable_flow_control(void);
472 void enable_flow_control(void);
473 void terminal_init(void);
474 int do_input(bool *meta_key, bool *func_key, bool *have_shortcut, bool
475 *ran_func, bool *finished, bool allow_funcs);
476 #ifndef DISABLE_MOUSE
477 int do_mouse(void);
478 #endif
479 void do_output(char *output, size_t output_len, bool allow_cntrls);
481 /* All functions in prompt.c. */
482 int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
483 bool *ran_func, bool *finished, bool allow_funcs, void
484 (*refresh_func)(void));
485 #ifndef DISABLE_MOUSE
486 int do_statusbar_mouse(void);
487 #endif
488 void do_statusbar_output(char *output, size_t output_len, bool
489 *got_enter, bool allow_cntrls);
490 void do_statusbar_home(void);
491 void do_statusbar_end(void);
492 void do_statusbar_left(void);
493 void do_statusbar_right(void);
494 void do_statusbar_backspace(void);
495 void do_statusbar_delete(void);
496 void do_statusbar_cut_text(void);
497 #ifndef NANO_TINY
498 bool do_statusbar_next_word(bool allow_punct);
499 bool do_statusbar_prev_word(bool allow_punct);
500 #endif
501 void do_statusbar_verbatim_input(bool *got_enter);
502 #ifndef NANO_TINY
503 bool find_statusbar_bracket_match(bool reverse, const char
504 *bracket_set);
505 void do_statusbar_find_bracket(void);
506 #endif
507 size_t statusbar_xplustabs(void);
508 size_t get_statusbar_page_start(size_t start_col, size_t column);
509 void reset_statusbar_cursor(void);
510 void update_statusbar_line(const char *curranswer, size_t index);
511 bool need_statusbar_horizontal_update(size_t pww_save);
512 void total_statusbar_refresh(void (*refresh_func)(void));
513 const sc *get_prompt_string(int *value, bool allow_tabs,
514 #ifndef DISABLE_TABCOMP
515 bool allow_files,
516 #endif
517 const char *curranswer,
518 bool *meta_key, bool *func_key,
519 #ifndef NANO_TINY
520 filestruct **history_list,
521 #endif
522 void (*refresh_func)(void), int menu
523 #ifndef DISABLE_TABCOMP
524 , bool *list
525 #endif
527 int do_prompt(bool allow_tabs,
528 #ifndef DISABLE_TABCOMP
529 bool allow_files,
530 #endif
531 int menu, const char *curranswer,
532 bool *meta_key, bool *func_key,
533 #ifndef NANO_TINY
534 filestruct **history_list,
535 #endif
536 void (*refresh_func)(void), const char *msg, ...);
537 void do_prompt_abort(void);
538 int do_yesno_prompt(bool all, const char *msg);
540 /* All functions in rcfile.c. */
541 #ifdef ENABLE_NANORC
542 void rcfile_error(const char *msg, ...);
543 char *parse_next_word(char *ptr);
544 char *parse_argument(char *ptr);
545 #ifdef ENABLE_COLOR
546 char *parse_next_regex(char *ptr);
547 bool nregcomp(const char *regex, int eflags);
548 void parse_syntax(char *ptr);
549 void parse_include(char *ptr);
550 short color_to_short(const char *colorname, bool *bright);
551 void parse_colors(char *ptr, bool icase);
552 void reset_multis(filestruct *fileptr, bool force);
553 void alloc_multidata_if_needed(filestruct *fileptr);
554 #endif
555 void parse_rcfile(FILE *rcstream
556 #ifdef ENABLE_COLOR
557 , bool syntax_only
558 #endif
560 void do_rcfile(void);
561 #endif
563 /* All functions in search.c. */
564 #ifdef HAVE_REGEX_H
565 bool regexp_init(const char *regexp);
566 void regexp_cleanup(void);
567 #endif
568 void not_found_msg(const char *str);
569 void search_replace_abort(void);
570 void search_init_globals(void);
571 int search_init(bool replacing, bool use_answer);
572 bool findnextstr(
573 #ifndef DISABLE_SPELLER
574 bool whole_word,
575 #endif
576 bool no_sameline, const filestruct *begin, size_t begin_x, const
577 char *needle, size_t *needle_len);
578 void findnextstr_wrap_reset(void);
579 void do_search(void);
580 #ifndef NANO_TINY
581 void do_research(void);
582 #endif
583 #ifdef HAVE_REGEX_H
584 int replace_regexp(char *string, bool create);
585 #endif
586 char *replace_line(const char *needle);
587 ssize_t do_replace_loop(
588 #ifndef DISABLE_SPELLER
589 bool whole_word,
590 #endif
591 bool *canceled, const filestruct *real_current, size_t
592 *real_current_x, const char *needle);
593 void do_replace(void);
594 void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
595 bool interactive, bool save_pos, bool allow_update);
596 void do_gotolinecolumn_void(void);
597 #ifndef DISABLE_SPELLER
598 void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
599 pos_pww);
600 #endif
601 #ifndef NANO_TINY
602 bool find_bracket_match(bool reverse, const char *bracket_set);
603 void do_find_bracket(void);
604 #ifdef ENABLE_NANORC
605 bool history_has_changed(void);
606 #endif
607 void history_init(void);
608 void history_reset(const filestruct *h);
609 filestruct *find_history(const filestruct *h_start, const filestruct
610 *h_end, const char *s, size_t len);
611 void update_history(filestruct **h, const char *s);
612 char *get_history_older(filestruct **h);
613 char *get_history_newer(filestruct **h);
614 #ifndef DISABLE_TABCOMP
615 char *get_history_completion(filestruct **h, const char *s, size_t len);
616 #endif
617 #endif
619 /* All functions in text.c. */
620 #ifndef NANO_TINY
621 void do_mark(void);
622 #endif
623 void do_delete(void);
624 void do_backspace(void);
625 void do_tab(void);
626 #ifndef NANO_TINY
627 void do_indent(ssize_t cols);
628 void do_indent_void(void);
629 void do_unindent(void);
630 void do_undo(void);
631 void do_redo(void);
632 #endif
633 void do_enter(bool undoing);
634 #ifndef NANO_TINY
635 RETSIGTYPE cancel_command(int signal);
636 bool execute_command(const char *command);
637 #endif
638 #ifndef DISABLE_WRAPPING
639 void wrap_reset(void);
640 bool do_wrap(filestruct *line, bool undoing);
641 #endif
642 #if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
643 ssize_t break_line(const char *line, ssize_t goal
644 #ifndef DISABLE_HELP
645 , bool newln
646 #endif
648 #endif
649 #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
650 size_t indent_length(const char *line);
651 #endif
652 #ifndef DISABLE_JUSTIFY
653 void justify_format(filestruct *paragraph, size_t skip);
654 size_t quote_length(const char *line);
655 bool quotes_match(const char *a_line, size_t a_quote, const char
656 *b_line);
657 bool indents_match(const char *a_line, size_t a_indent, const char
658 *b_line, size_t b_indent);
659 bool begpar(const filestruct *const foo);
660 bool inpar(const filestruct *const foo);
661 void backup_lines(filestruct *first_line, size_t par_len);
662 bool find_paragraph(size_t *const quote, size_t *const par);
663 void do_justify(bool full_justify);
664 void do_justify_void(void);
665 void do_full_justify(void);
666 #endif
667 #ifndef DISABLE_SPELLER
668 bool do_int_spell_fix(const char *word);
669 const char *do_int_speller(const char *tempfile_name);
670 const char *do_alt_speller(char *tempfile_name);
671 void do_spell(void);
672 #endif
673 #ifndef NANO_TINY
674 void do_wordlinechar_count(void);
675 #endif
676 void do_verbatim_input(void);
678 /* All functions in utils.c. */
679 int digits(size_t n);
680 void get_homedir(void);
681 bool parse_num(const char *str, ssize_t *val);
682 bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
683 void align(char **str);
684 void null_at(char **data, size_t index);
685 void unsunder(char *str, size_t true_len);
686 void sunder(char *str);
687 #if !defined(NANO_TINY) && defined(ENABLE_NANORC)
688 #ifndef HAVE_GETLINE
689 ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
690 #endif
691 #ifndef HAVE_GETDELIM
692 ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
693 #endif
694 #endif
695 #ifdef HAVE_REGEX_H
696 bool regexp_bol_or_eol(const regex_t *preg, const char *string);
697 const char *fixbounds(const char *r);
698 #endif
699 #ifndef DISABLE_SPELLER
700 bool is_whole_word(size_t pos, const char *buf, const char *word);
701 #endif
702 const char *strstrwrapper(const char *haystack, const char *needle,
703 const char *start);
704 void nperror(const char *s);
705 void *nmalloc(size_t howmuch);
706 void *nrealloc(void *ptr, size_t howmuch);
707 char *mallocstrncpy(char *dest, const char *src, size_t n);
708 char *mallocstrcpy(char *dest, const char *src);
709 char *mallocstrassn(char *dest, char *src);
710 size_t get_page_start(size_t column);
711 size_t xplustabs(void);
712 size_t actual_x(const char *s, size_t column);
713 size_t strnlenpt(const char *s, size_t maxlen);
714 size_t strlenpt(const char *s);
715 void new_magicline(void);
716 #ifndef NANO_TINY
717 void remove_magicline(void);
718 void mark_order(const filestruct **top, size_t *top_x, const filestruct
719 **bot, size_t *bot_x, bool *right_side_up);
720 void add_undo(undo_type current_action);
721 void update_undo(undo_type action);
722 #endif
723 size_t get_totsize(const filestruct *begin, const filestruct *end);
724 filestruct *fsfromline(ssize_t lineno);
725 #ifdef DEBUG
726 void dump_filestruct(const filestruct *inptr);
727 void dump_filestruct_reverse(void);
728 #endif
730 /* All functions in winio.c. */
731 void get_key_buffer(WINDOW *win);
732 size_t get_key_buffer_len(void);
733 void unget_input(int *input, size_t input_len);
734 void unget_kbinput(int kbinput, bool meta_key, bool func_key);
735 int *get_input(WINDOW *win, size_t input_len);
736 int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
737 int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
738 int get_escape_seq_kbinput(const int *seq, size_t seq_len);
739 int get_escape_seq_abcd(int kbinput);
740 int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
741 int get_byte_kbinput(int kbinput);
742 #ifdef ENABLE_UTF8
743 long add_unicode_digit(int kbinput, long factor, long *uni);
744 long get_unicode_kbinput(int kbinput);
745 #endif
746 int get_control_kbinput(int kbinput);
747 void unparse_kbinput(char *output, size_t output_len);
748 int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
749 int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
750 #ifndef DISABLE_MOUSE
751 int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
752 #endif
753 const sc *get_shortcut(int menu, int *kbinput, bool
754 *meta_key, bool *func_key);
755 const sc *first_sc_for(int menu, short func);
756 void blank_line(WINDOW *win, int y, int x, int n);
757 void blank_titlebar(void);
758 void blank_topbar(void);
759 void blank_edit(void);
760 void blank_statusbar(void);
761 void blank_bottombars(void);
762 void check_statusblank(void);
763 char *display_string(const char *buf, size_t start_col, size_t len, bool
764 dollars);
765 void titlebar(const char *path);
766 void set_modified(void);
767 void statusbar(const char *msg, ...);
768 void bottombars(int menu);
769 void onekey(const char *keystroke, const char *desc, size_t len);
770 void reset_cursor(void);
771 void edit_draw(filestruct *fileptr, const char *converted, int
772 line, size_t start);
773 int update_line(filestruct *fileptr, size_t index);
774 bool need_horizontal_update(size_t pww_save);
775 bool need_vertical_update(size_t pww_save);
776 void edit_scroll(scroll_dir direction, ssize_t nlines);
777 void edit_redraw(filestruct *old_current, size_t pww_save);
778 void edit_refresh(void);
779 void edit_update(update_type location);
780 void total_redraw(void);
781 void total_refresh(void);
782 void display_main_list(void);
783 void do_cursorpos(bool constant);
784 void do_cursorpos_void(void);
785 void do_replace_highlight(bool highlight, const char *word);
786 const char *flagtostr(int flag);
787 const subnfunc *sctofunc(sc *s);
788 const subnfunc *getfuncfromkey(WINDOW *win);
789 void print_sclist(void);
790 sc *strtosc(int menu, char *input);
791 function_type strtokeytype(const char *str);
792 int strtomenu(char *input);
793 void assign_keyinfo(sc *s);
794 void xon_complaint(void);
795 void xoff_complaint(void);
796 int sc_seq_or (short func, int defaultval);
797 void do_suspend_void(void);
799 extern const char *cancel_msg;
800 #ifndef NANO_TINY
801 extern const char *case_sens_msg;
802 extern const char *backwards_msg;
803 extern const char *prev_history_msg;
804 extern const char *next_history_msg;
805 #endif
806 extern const char *replace_msg;
807 extern const char *no_replace_msg;
808 extern const char *go_to_line_msg;
809 extern const char *whereis_next_msg;
810 extern const char *first_file_msg;
811 extern const char *last_file_msg;
812 extern const char *goto_dir_msg;
813 extern const char *ext_cmd_msg;
814 extern const char *to_files_msg;
815 extern const char *dos_format_msg;
816 extern const char *mac_format_msg;
817 extern const char *append_msg;
818 extern const char *prepend_msg;
819 extern const char *backup_file_msg;
820 extern const char *gototext_msg;
821 extern const char *new_buffer_msg;
823 void iso_me_harder_funcmap(short func);
824 void enable_nodelay(void);
825 void disable_nodelay(void);
827 #ifdef HAVE_REGEX_H
828 extern const char *regexp_msg;
829 #endif
831 #ifdef NANO_EXTRA
832 void do_credits(void);
833 #endif
835 #endif /* !PROTO_H */