proto.h 23.9 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
/**************************************************************************
2
 *   proto.h  --  This file is part of GNU nano.                          *
Chris Allegretta's avatar
Chris Allegretta committed
3
 *                                                                        *
4
 *   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,  *
5
 *   2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc.    *
Chris Allegretta's avatar
Chris Allegretta committed
6
 *                                                                        *
7
8
9
10
11
12
13
14
15
 *   GNU nano is free software: you can redistribute it and/or modify     *
 *   it under the terms of the GNU General Public License as published    *
 *   by the Free Software Foundation, either version 3 of the License,    *
 *   or (at your option) any later version.                               *
 *                                                                        *
 *   GNU nano is distributed in the hope that it will be useful,          *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty          *
 *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
 *   See the GNU General Public License for more details.                 *
Chris Allegretta's avatar
Chris Allegretta committed
16
17
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
18
 *   along with this program.  If not, see http://www.gnu.org/licenses/.  *
Chris Allegretta's avatar
Chris Allegretta committed
19
20
21
 *                                                                        *
 **************************************************************************/

22
23
24
#ifndef PROTO_H
#define PROTO_H 1

Chris Allegretta's avatar
Chris Allegretta committed
25
26
#include "nano.h"

27
/* All external variables.  See global.c for their descriptions. */
28
#ifndef NANO_TINY
29
extern volatile sig_atomic_t sigwinch_counter;
30
31
#endif

32
#ifdef __linux__
33
extern bool console;
34
35
#endif

36
extern bool meta_key;
37
38
extern bool shift_held;

39
extern bool focusing;
40
41

extern message_type lastmessage;
42

43
44
extern int controlleft;
extern int controlright;
45
46
extern int controlup;
extern int controldown;
47
#ifndef NANO_TINY
48
49
50
51
52
53
54
55
extern int shiftcontrolleft;
extern int shiftcontrolright;
extern int shiftcontrolup;
extern int shiftcontroldown;
extern int shiftaltleft;
extern int shiftaltright;
extern int shiftaltup;
extern int shiftaltdown;
56
57
#endif

58
#ifndef DISABLE_WRAPJUSTIFY
59
extern ssize_t fill;
60
extern ssize_t wrap_at;
61
#endif
62
63
64

extern char *last_search;

65
66
extern char *present_path;

67
extern unsigned flags[4];
68
69
70
71
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
72
extern int maxrows;
73
74

extern filestruct *cutbuffer;
75
extern filestruct *cutbottom;
76
77
extern partition *filepart;
extern openfilestruct *openfile;
Chris Allegretta's avatar
Chris Allegretta committed
78

79
80
81
82
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

83
#ifndef NANO_TINY
84
extern char *whitespace;
85
extern int whitespace_len[2];
86
87
#endif

88
89
extern const char *exit_tag;
extern const char *close_tag;
90
extern const char *uncut_tag;
91
#ifndef DISABLE_JUSTIFY
92
extern const char *unjust_tag;
93
94
extern char *punct;
extern char *brackets;
Chris Allegretta's avatar
Chris Allegretta committed
95
extern char *quotestr;
96
97
98
99
100
101
102
#ifdef HAVE_REGEX_H
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
#else
extern size_t quotelen;
#endif
103
104
#endif /* !DISABLE_JUSTIFY */

105
106
extern char *word_chars;

107
extern bool nodelay_mode;
108

109
110
111
112
extern char *answer;

extern ssize_t tabsize;

113
#ifndef NANO_TINY
114
extern char *backup_dir;
115
116
extern const char *locking_prefix;
extern const char *locking_suffix;
117
#endif
118
119
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
120
extern char *full_operating_dir;
121
#endif
122

123
#ifndef DISABLE_SPELLER
124
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
125
126
#endif

127
#ifndef DISABLE_COLOR
128
129
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
130
#endif
131

132
extern bool refresh_needed;
133

134
extern int currmenu;
135
136
137
138
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
139

140
#ifndef DISABLE_HISTORIES
141
142
143
144
145
146
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
147
extern poshiststruct *position_history;
148
149
#endif

150
151
152
153
154
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

155
extern int hilite_attribute;
156
157
158
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
159
extern int interface_color_pair[NUMBER_OF_ELEMENTS];
160

161
162
extern char *homedir;

163
164
typedef void (*functionptrtype)(void);

165
/* All functions in browser.c. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
166
#ifndef DISABLE_BROWSER
167
char *do_browser(char *path);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
168
char *do_browse_from(const char *inpath);
169
void read_the_list(const char *path, DIR *dir);
170
functionptrtype parse_browser_input(int *kbinput);
171
void browser_refresh(void);
172
void browser_select_dirname(const char *needle);
173
int filesearch_init(void);
174
void findnextfile(const char *needle);
175
176
177
178
179
void filesearch_abort(void);
void do_filesearch(void);
void do_fileresearch(void);
void do_first_file(void);
void do_last_file(void);
180
char *striponedir(const char *path);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
181
182
#endif

183
/* Most functions in chars.c. */
184
185
186
187
#ifdef ENABLE_UTF8
void utf8_init(void);
bool using_utf8(void);
#endif
188
char *addstrings(char* str1, size_t len1, char* str2, size_t len2);
189
#ifndef HAVE_ISBLANK
190
bool nisblank(int c);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
191
#endif
192
#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
193
bool niswblank(wchar_t wc);
194
#endif
195
bool is_byte(int c);
196
bool is_alpha_mbchar(const char *c);
197
bool is_alnum_mbchar(const char *c);
198
bool is_blank_mbchar(const char *c);
199
bool is_ascii_cntrl_char(int c);
200
bool is_cntrl_char(int c);
201
bool is_cntrl_mbchar(const char *c);
202
bool is_punct_mbchar(const char *c);
203
bool is_word_mbchar(const char *c, bool allow_punct);
204
char control_rep(const signed char c);
205
char control_mbrep(const char *c);
206
int length_of_char(const char *c, int *width);
207
208
int mbwidth(const char *c);
int mb_cur_max(void);
209
char *make_mbchar(long chr, int *chr_mb_len);
210
int parse_mbchar(const char *buf, char *chr, size_t *col);
211
212
size_t move_mbleft(const char *buf, size_t pos);
size_t move_mbright(const char *buf, size_t pos);
213
214
215
216
217
218
219
220
221
#ifndef HAVE_STRCASECMP
int nstrcasecmp(const char *s1, const char *s2);
#endif
int mbstrcasecmp(const char *s1, const char *s2);
#ifndef HAVE_STRNCASECMP
int nstrncasecmp(const char *s1, const char *s2, size_t n);
#endif
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
#ifndef HAVE_STRCASESTR
222
char *nstrcasestr(const char *haystack, const char *needle);
223
#endif
224
225
226
227
228
229
230
char *mbstrcasestr(const char *haystack, const char *needle);
char *revstrstr(const char *haystack, const char *needle, const char
	*rev_start);
char *revstrcasestr(const char *haystack, const char *needle, const char
	*rev_start);
char *mbrevstrcasestr(const char *haystack, const char *needle, const
	char *rev_start);
231
size_t mbstrlen(const char *s);
232
233
234
235
#ifndef HAVE_STRNLEN
size_t nstrnlen(const char *s, size_t maxlen);
#endif
size_t mbstrnlen(const char *s, size_t maxlen);
236
237
238
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
char *mbstrchr(const char *s, const char *c);
#endif
239
#ifndef NANO_TINY
240
char *mbstrpbrk(const char *s, const char *accept);
241
242
char *revstrpbrk(const char *s, const char *accept, const char
	*rev_start);
243
244
char *mbrevstrpbrk(const char *s, const char *accept, const char
	*rev_start);
245
#endif
246
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
247
248
249
bool has_blank_chars(const char *s);
bool has_blank_mbchars(const char *s);
#endif
250
251
252
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
253
#ifndef DISABLE_NANORC
254
255
bool is_valid_mbstring(const char *s);
#endif
256

257
/* Most functions in color.c. */
258
#ifndef DISABLE_COLOR
259
void set_colorpairs(void);
260
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
261
void color_update(void);
262
263
264
void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr);
void precalc_multicolorinfo(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
265
#endif
266

267
/* All functions in cut.c. */
268
void cutbuffer_reset(void);
269
bool keeping_cutbuffer(void);
270
void cut_line(void);
271
#ifndef NANO_TINY
272
273
void cut_marked(void);
void cut_to_eol(void);
274
void cut_to_eof(void);
275
#endif
276
void do_cut_text(
277
#ifndef NANO_TINY
278
	bool copy_text, bool cut_till_eof
279
280
281
282
283
284
285
#else
	void
#endif
	);
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
286
void do_cut_till_eof(void);
287
#endif
288
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
289

290
/* Most functions in files.c. */
291
void make_new_buffer(void);
292
void initialize_buffer_text(void);
293
bool open_buffer(const char *filename, bool undoable);
294
295
296
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
297
void display_buffer(void);
298
#ifndef DISABLE_MULTIBUFFER
299
300
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
301
bool close_buffer(void);
302
#endif
303
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode);
304
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
305
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
306
char *get_next_filename(const char *name, const char *suffix);
307
void do_insertfile(
308
#ifndef NANO_TINY
309
310
311
312
313
	bool execute
#else
	void
#endif
	);
314
void do_insertfile_void(void);
315
316
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
317
char *safe_tempfile(FILE **f);
318
#ifndef DISABLE_OPERATINGDIR
319
void init_operating_dir(void);
320
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
321
#endif
322
#ifndef NANO_TINY
323
void init_backup_dir(void);
324
int delete_lockfile(const char *lockfilename);
325
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
326
#endif
327
int copy_file(FILE *inn, FILE *out);
328
329
bool write_file(const char *name, FILE *f_open, bool tmp,
	kind_of_writing_type method, bool nonamechange);
330
#ifndef NANO_TINY
331
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
332
	kind_of_writing_type method);
333
#endif
334
int do_writeout(bool exiting);
335
void do_writeout_void(void);
336
337
338
#ifndef NANO_TINY
void do_savefile(void);
#endif
339
char *real_dir_from_tilde(const char *buf);
340
341
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
342
void free_chararray(char **array, size_t len);
343
#endif
Chris Allegretta's avatar
Chris Allegretta committed
344
#ifndef DISABLE_TABCOMP
345
bool is_dir(const char *buf);
346
char **username_tab_completion(const char *buf, size_t *num_matches,
347
	size_t buf_len);
348
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
349
	*num_matches, size_t buf_len);
350
char *input_tab(char *buf, bool allow_files, size_t *place,
351
	bool *lastwastab, void (*refresh_func)(void), bool *listed);
Chris Allegretta's avatar
Chris Allegretta committed
352
#endif
353
const char *tail(const char *path);
354
#ifndef DISABLE_HISTORIES
355
char *histfilename(void);
356
void load_history(void);
357
bool writehist(FILE *hist, filestruct *histhead);
358
void save_history(void);
359
360
361
int check_dotnano(void);
void load_poshistory(void);
void save_poshistory(void);
362
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
363
int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
364
#endif
365

366
/* Some functions in global.c. */
367
size_t length_of_list(int menu);
368
369
const sc *first_sc_for(int menu, void (*func)(void));
int sc_seq_or(void (*func)(void), int defaultval);
370
functionptrtype func_from_key(int *kbinput);
371
void assign_keyinfo(sc *s, const char *keystring);
372
void print_sclist(void);
373
void shortcut_init(void);
374
#ifndef DISABLE_COLOR
375
void set_lint_or_format_shortcuts(void);
376
377
void set_spell_shortcuts(void);
#endif
378
const subnfunc *sctofunc(const sc *s);
379
const char *flagtostr(int flag);
380
381
sc *strtosc(const char *input);
int strtomenu(const char *input);
Chris Allegretta's avatar
Chris Allegretta committed
382
383
#ifdef DEBUG
void thanks_for_all_the_fish(void);
384
385
#endif

386
/* All functions in help.c. */
387
#ifndef DISABLE_HELP
388
void do_help(void);
389
void help_init(void);
390
functionptrtype parse_help_input(int *kbinput);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
391
size_t help_line_len(const char *ptr);
392
#endif
393
void do_help_void(void);
394

395
/* All functions in move.c. */
396
397
398
399
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
400
401
402
403
404
405
#ifndef DISABLE_JUSTIFY
void do_para_begin(bool allow_update);
void do_para_begin_void(void);
void do_para_end(bool allow_update);
void do_para_end_void(void);
#endif
406
407
void do_prev_block(void);
void do_next_block(void);
408
void do_prev_word(bool allow_punct, bool allow_update);
409
void do_prev_word_void(void);
410
411
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
412
413
void do_home(void);
void do_end(void);
414
void do_up(bool scroll_only);
415
void do_up_void(void);
416
void do_down(bool scroll_only);
417
void do_down_void(void);
418
#ifndef NANO_TINY
419
void do_scroll_up(void);
420
421
void do_scroll_down(void);
#endif
422
423
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
424

425
/* All functions in nano.c. */
426
427
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
428
void splice_node(filestruct *afterthis, filestruct *newnode);
429
void unlink_node(filestruct *fileptr);
430
431
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
Chris Allegretta's avatar
Chris Allegretta committed
432
void free_filestruct(filestruct *src);
433
void renumber(filestruct *fileptr);
434
435
partition *partition_filestruct(filestruct *top, size_t top_x,
	filestruct *bot, size_t bot_x);
436
void unpartition_filestruct(partition **p);
437
438
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
	filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
439
void copy_from_filestruct(filestruct *somebuffer);
440
441
442
openfilestruct *make_new_opennode(void);
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
443
void print_view_warning(void);
444
445
446
447
void show_restricted_warning(void);
#ifdef DISABLE_HELP
void say_there_is_no_help(void);
#endif
448
449
void finish(void);
void die(const char *msg, ...);
450
void die_save_file(const char *die_filename, struct stat *die_stat);
451
452
void window_init(void);
#ifndef DISABLE_MOUSE
453
454
void disable_mouse_support(void);
void enable_mouse_support(void);
455
456
void mouse_init(void);
#endif
457
void print_opt_full(const char *shortflag
458
459
460
461
#ifdef HAVE_GETOPT_LONG
	, const char *longflag
#endif
	, const char *desc);
462
463
void usage(void);
void version(void);
464
void no_current_file_name_warning(void);
465
void do_exit(void);
466
void close_and_go(void);
Chris Allegretta's avatar
Chris Allegretta committed
467
void signal_init(void);
468
469
470
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
471
#ifndef NANO_TINY
472
RETSIGTYPE handle_sigwinch(int signal);
473
void regenerate_screen(void);
474
void allow_sigwinch(bool allow);
475
void do_toggle(int flag);
476
void do_toggle_void(void);
477
478
479
480
void enable_signals(void);
#endif
void disable_flow_control(void);
void enable_flow_control(void);
481
void terminal_init(void);
482
void unbound_key(int code);
483
int do_input(bool allow_funcs);
484
#ifndef DISABLE_MOUSE
485
int do_mouse(void);
486
#endif
487
void do_output(char *output, size_t output_len, bool allow_cntrls);
488

489
/* All functions in prompt.c. */
490
491
int do_statusbar_input(bool *ran_func, bool *finished,
	void (*refresh_func)(void));
492
#ifndef DISABLE_MOUSE
493
int do_statusbar_mouse(void);
494
#endif
495
void do_statusbar_output(int *the_input, size_t input_len,
496
	bool filtering, bool *got_newline);
497
498
499
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
500
void do_statusbar_right(void);
501
502
503
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
504
#ifndef NANO_TINY
505
void do_statusbar_prev_word(void);
506
void do_statusbar_next_word(void);
507
#endif
508
void do_statusbar_verbatim_input(bool *got_newline);
509
510
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
511
void reinit_statusbar_x(void);
512
void reset_statusbar_cursor(void);
513
void update_the_statusbar(void);
514
515
516
517
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
518
	int menu, const char *curranswer,
519
#ifndef DISABLE_HISTORIES
520
521
	filestruct **history_list,
#endif
522
	void (*refresh_func)(void), const char *msg, ...);
523
int do_yesno_prompt(bool all, const char *msg);
524

525
/* Most functions in rcfile.c. */
526
527
528
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
char *parse_next_word(char *ptr);
#endif
529
#ifndef DISABLE_NANORC
530
531
void rcfile_error(const char *msg, ...);
char *parse_argument(char *ptr);
532
#ifndef DISABLE_COLOR
533
534
char *parse_next_regex(char *ptr);
void parse_syntax(char *ptr);
535
void parse_includes(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
536
short color_to_short(const char *colorname, bool *bright);
537
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
538
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
539
#endif
540
void parse_rcfile(FILE *rcstream
541
#ifndef DISABLE_COLOR
542
543
544
	, bool syntax_only
#endif
	);
545
void do_rcfile(void);
546
#endif /* !DISABLE_NANORC */
547

548
/* All functions in search.c. */
549
#ifdef HAVE_REGEX_H
550
bool regexp_init(const char *regexp);
551
552
553
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
554
void search_replace_abort(void);
555
int search_init(bool replacing, bool use_answer);
556
int findnextstr(
557
#ifndef DISABLE_SPELLER
558
	bool whole_word_only,
559
#endif
560
	const filestruct *begin, size_t begin_x,
561
	const char *needle, size_t *match_len);
562
void do_search(void);
563
564
565
566
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
567
void do_research(void);
568
void go_looking(void);
569
#ifdef HAVE_REGEX_H
570
int replace_regexp(char *string, bool create);
571
#endif
572
char *replace_line(const char *needle);
573
574
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
575
	bool whole_word_only,
576
#endif
577
578
	const filestruct *real_current, size_t *real_current_x,
	const char *needle);
579
void do_replace(void);
580
void goto_line_posx(ssize_t line, size_t pos_x);
581
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
582
	bool interactive);
583
void do_gotolinecolumn_void(void);
584
#ifndef NANO_TINY
585
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
586
void do_find_bracket(void);
587
#ifndef DISABLE_TABCOMP
588
char *get_history_completion(filestruct **h, char *s, size_t len);
589
#endif
590
#endif
591
592
#ifndef DISABLE_HISTORIES
bool history_has_changed(void);
593
void history_init(void);
594
void history_reset(const filestruct *h);
595
596
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
597
void update_history(filestruct **h, const char *s);
598
599
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
600
601
void get_history_older_void(void);
void get_history_newer_void(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
602
#endif
Chris Allegretta's avatar
Chris Allegretta committed
603

604
/* All functions in text.c. */
605
#ifndef NANO_TINY
606
607
608
609
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
610
611
612
613
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
614
void do_tab(void);
615
#ifndef NANO_TINY
616
617
618
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
619
620
void do_undo(void);
void do_redo(void);
621
#endif
622
623
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
624
625
void do_comment(void);
#endif
626
void do_enter(void);
627
#ifndef NANO_TINY
628
RETSIGTYPE cancel_command(int signal);
629
bool execute_command(const char *command);
630
#endif
631
632
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
633
bool do_wrap(filestruct *line);
634
#endif
635
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
636
637
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
638
	, bool newln
639
640
#endif
	);
641
#endif
642
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
643
644
645
646
647
648
649
650
651
652
653
size_t indent_length(const char *line);
#endif
#ifndef DISABLE_JUSTIFY
void justify_format(filestruct *paragraph, size_t skip);
size_t quote_length(const char *line);
bool quotes_match(const char *a_line, size_t a_quote, const char
	*b_line);
bool indents_match(const char *a_line, size_t a_indent, const char
	*b_line, size_t b_indent);
bool begpar(const filestruct *const foo);
bool inpar(const filestruct *const foo);
654
void backup_lines(filestruct *first_line, size_t par_len);
655
bool find_paragraph(size_t *const quote, size_t *const par);
656
657
658
void do_justify(bool full_justify);
void do_justify_void(void);
void do_full_justify(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
659
#endif
660
661
662
663
664
665
#ifndef DISABLE_SPELLER
bool do_int_spell_fix(const char *word);
const char *do_int_speller(const char *tempfile_name);
const char *do_alt_speller(char *tempfile_name);
void do_spell(void);
#endif
666
667
#ifndef DISABLE_COLOR
void do_linter(void);
668
void do_formatter(void);
669
#endif
670
#ifndef NANO_TINY
671
void do_wordlinechar_count(void);
672
#endif
673
void do_verbatim_input(void);
674

675
/* All functions in utils.c. */
676
void get_homedir(void);
677
bool parse_num(const char *str, ssize_t *val);
678
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
679
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
680
681
682
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
683
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
684
685
686
687
688
689
#ifndef HAVE_GETLINE
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
#endif
#ifndef HAVE_GETDELIM
ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
#endif
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
690
#endif
691
#ifdef HAVE_REGEX_H
692
const char *fixbounds(const char *r);
693
#endif
694
#ifndef DISABLE_SPELLER
695
bool is_separate_word(size_t position, size_t length, const char *buf);
696
#endif
697
const char *strstrwrapper(const char *haystack, const char *needle,
698
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
699
700
701
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
702
char *mallocstrncpy(char *dest, const char *src, size_t n);
703
char *mallocstrcpy(char *dest, const char *src);
704
char *free_and_assign(char *dest, char *src);
705
size_t get_page_start(size_t column);
706
707
708
709
size_t xplustabs(void);
size_t actual_x(const char *s, size_t column);
size_t strnlenpt(const char *s, size_t maxlen);
size_t strlenpt(const char *s);
Chris Allegretta's avatar
Chris Allegretta committed
710
void new_magicline(void);
711
#ifndef NANO_TINY
712
void remove_magicline(void);
713
void mark_order(const filestruct **top, size_t *top_x, const filestruct
714
	**bot, size_t *bot_x, bool *right_side_up);
715
void discard_until(const undo *thisitem, openfilestruct *thefile);
716
void add_undo(undo_type action);
717
void update_undo(undo_type action);
718
719
720
721
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
#endif
722
#endif
723
size_t get_totsize(const filestruct *begin, const filestruct *end);
724
filestruct *fsfromline(ssize_t lineno);
725
726
727
728
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
729

730
/* Most functions in winio.c. */
731
732
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
733
void unget_input(int *input, size_t input_len);
734
void unget_kbinput(int kbinput, bool metakey);
735
int *get_input(WINDOW *win, size_t input_len);
736
737
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
738
739
int arrow_from_abcd(int kbinput);
int parse_escape_sequence(WINDOW *win, int kbinput);
740
int get_byte_kbinput(int kbinput);
741
#ifdef ENABLE_UTF8
742
long add_unicode_digit(int kbinput, long factor, long *uni);
743
long get_unicode_kbinput(WINDOW *win, int kbinput);
744
#endif
745
int get_control_kbinput(int kbinput);
746
void unparse_kbinput(char *output, size_t output_len);
747
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
748
int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
749
#ifndef DISABLE_MOUSE
750
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
751
#endif
752
const sc *get_shortcut(int *kbinput);
753
void blank_line(WINDOW *win, int y, int x, int n);
754
void blank_titlebar(void);
755
756
void blank_edit(void);
void blank_statusbar(void);
757
void blank_bottombars(void);
758
void check_statusblank(void);
759
760
char *display_string(const char *buf, size_t start_col, size_t span,
	bool dollars);
761
void titlebar(const char *path);
762
extern void set_modified(void);
763
void statusbar(const char *msg);
764
void statusline(message_type importance, const char *msg, ...);
765
void bottombars(int menu);
766
void onekey(const char *keystroke, const char *desc, int length);
767
void reset_cursor(void);
768
void edit_draw(filestruct *fileptr, const char *converted, int
769
	line, size_t start);
770
int update_line(filestruct *fileptr, size_t index);
771
bool need_horizontal_scroll(const size_t old_column, const size_t new_column);
772
void edit_scroll(scroll_dir direction, ssize_t nlines);
773
void edit_redraw(filestruct *old_current);
Chris Allegretta's avatar
Chris Allegretta committed
774
void edit_refresh(void);
775
void edit_update(update_type location);
776
void total_redraw(void);
777
void total_refresh(void);
778
void display_main_list(void);
779
void do_cursorpos(bool constant);
780
void do_cursorpos_void(void);
781
void spotlight(bool active, const char *word);
782
783
void xon_complaint(void);
void xoff_complaint(void);
784
void do_suspend_void(void);
785
786
void enable_nodelay(void);
void disable_nodelay(void);
787
#ifndef DISABLE_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
788
void do_credits(void);
789
#endif
790

791
/* May as well throw these here, since they are just placeholders. */
792
793
794
795
796
797
798
799
800
801
void do_cancel(void);
void case_sens_void(void);
void regexp_void(void);
void gototext_void(void);
void to_files_void(void);
void dos_format_void(void);
void mac_format_void(void);
void append_void(void);
void prepend_void(void);
void backup_file_void(void);
802
void discard_buffer(void);
803
804
805
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
806
void flip_replace_void(void);
807
void flip_execute_void(void);
808

809
#endif /* !PROTO_H */