proto.h 24.1 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
42
43
44
45
46
47
extern int margin;
extern int editwincols;
#ifdef ENABLE_LINENUMBERS
extern int last_drawn_line;
extern int last_line_y;
#endif

48
extern message_type lastmessage;
49

50
51
extern int controlleft;
extern int controlright;
52
53
extern int controlup;
extern int controldown;
54
#ifndef NANO_TINY
55
56
57
58
59
60
61
62
extern int shiftcontrolleft;
extern int shiftcontrolright;
extern int shiftcontrolup;
extern int shiftcontroldown;
extern int shiftaltleft;
extern int shiftaltright;
extern int shiftaltup;
extern int shiftaltdown;
63
64
#endif

65
#ifndef DISABLE_WRAPJUSTIFY
66
extern ssize_t fill;
67
extern ssize_t wrap_at;
68
#endif
69
70
71

extern char *last_search;

72
73
extern char *present_path;

74
extern unsigned flags[4];
75
76
77
78
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
79
extern int maxrows;
80
81

extern filestruct *cutbuffer;
82
extern filestruct *cutbottom;
83
84
extern partition *filepart;
extern openfilestruct *openfile;
Chris Allegretta's avatar
Chris Allegretta committed
85

86
87
88
89
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

90
#ifndef NANO_TINY
91
extern char *whitespace;
92
extern int whitespace_len[2];
93
94
#endif

95
96
extern const char *exit_tag;
extern const char *close_tag;
97
extern const char *uncut_tag;
98
#ifndef DISABLE_JUSTIFY
99
extern const char *unjust_tag;
100
101
extern char *punct;
extern char *brackets;
Chris Allegretta's avatar
Chris Allegretta committed
102
extern char *quotestr;
103
104
105
106
107
108
109
#ifdef HAVE_REGEX_H
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
#else
extern size_t quotelen;
#endif
110
111
#endif /* !DISABLE_JUSTIFY */

112
113
extern char *word_chars;

114
extern bool nodelay_mode;
115

116
117
118
119
extern char *answer;

extern ssize_t tabsize;

120
#ifndef NANO_TINY
121
extern char *backup_dir;
122
123
extern const char *locking_prefix;
extern const char *locking_suffix;
124
#endif
125
126
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
127
extern char *full_operating_dir;
128
#endif
129

130
#ifndef DISABLE_SPELLER
131
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
132
133
#endif

134
#ifndef DISABLE_COLOR
135
136
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
137
#endif
138

139
extern bool refresh_needed;
140

141
extern int currmenu;
142
143
144
145
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
146

147
#ifndef DISABLE_HISTORIES
148
149
150
151
152
153
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
154
extern poshiststruct *position_history;
155
156
#endif

157
158
159
160
161
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

162
extern int hilite_attribute;
163
164
165
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
166
extern int interface_color_pair[NUMBER_OF_ELEMENTS];
167

168
169
extern char *homedir;

170
171
typedef void (*functionptrtype)(void);

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

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

264
/* Most functions in color.c. */
265
#ifndef DISABLE_COLOR
266
void set_colorpairs(void);
267
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
268
void color_update(void);
269
270
271
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
272
#endif
273

274
/* All functions in cut.c. */
275
void cutbuffer_reset(void);
276
bool keeping_cutbuffer(void);
277
void cut_line(void);
278
#ifndef NANO_TINY
279
280
void cut_marked(void);
void cut_to_eol(void);
281
void cut_to_eof(void);
282
#endif
283
void do_cut_text(
284
#ifndef NANO_TINY
285
	bool copy_text, bool cut_till_eof
286
287
288
289
290
291
292
#else
	void
#endif
	);
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
293
void do_cut_till_eof(void);
294
#endif
295
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
296

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

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

393
/* All functions in help.c. */
394
#ifndef DISABLE_HELP
395
void do_help(void);
396
void help_init(void);
397
functionptrtype parse_help_input(int *kbinput);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
398
size_t help_line_len(const char *ptr);
399
#endif
400
void do_help_void(void);
401

402
/* All functions in move.c. */
403
404
405
406
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
407
408
409
410
411
412
#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
413
414
void do_prev_block(void);
void do_next_block(void);
415
void do_prev_word(bool allow_punct, bool allow_update);
416
void do_prev_word_void(void);
417
418
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
419
void ensure_line_is_visible(void);
420
421
void do_home(void);
void do_end(void);
422
void do_up(bool scroll_only);
423
void do_up_void(void);
424
void do_down(bool scroll_only);
425
void do_down_void(void);
426
#ifndef NANO_TINY
427
void do_scroll_up(void);
428
429
void do_scroll_down(void);
#endif
430
431
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
432

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

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

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

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

612
/* All functions in text.c. */
613
#ifndef NANO_TINY
614
615
616
617
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
618
619
620
621
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
622
void do_tab(void);
623
#ifndef NANO_TINY
624
625
626
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
627
628
void do_undo(void);
void do_redo(void);
629
#endif
630
631
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
632
633
void do_comment(void);
#endif
634
void do_enter(void);
635
#ifndef NANO_TINY
636
RETSIGTYPE cancel_command(int signal);
637
bool execute_command(const char *command);
638
#endif
639
640
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
641
bool do_wrap(filestruct *line);
642
#endif
643
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
644
645
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
646
	, bool newln
647
648
#endif
	);
649
#endif
650
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
651
652
653
654
655
656
657
658
659
660
661
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);
662
void backup_lines(filestruct *first_line, size_t par_len);
663
bool find_paragraph(size_t *const quote, size_t *const par);
664
665
666
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
667
#endif
668
669
670
671
672
673
#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
674
675
#ifndef DISABLE_COLOR
void do_linter(void);
676
void do_formatter(void);
677
#endif
678
#ifndef NANO_TINY
679
void do_wordlinechar_count(void);
680
#endif
681
void do_verbatim_input(void);
682

683
/* All functions in utils.c. */
684
void get_homedir(void);
685
int digits(int n);
686
bool parse_num(const char *str, ssize_t *val);
687
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
688
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
689
690
691
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
692
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
693
694
695
696
697
698
#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
699
#endif
700
#ifdef HAVE_REGEX_H
701
const char *fixbounds(const char *r);
702
#endif
703
#ifndef DISABLE_SPELLER
704
bool is_separate_word(size_t position, size_t length, const char *buf);
705
#endif
706
const char *strstrwrapper(const char *haystack, const char *needle,
707
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
708
709
710
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
711
char *mallocstrncpy(char *dest, const char *src, size_t n);
712
char *mallocstrcpy(char *dest, const char *src);
713
char *free_and_assign(char *dest, char *src);
714
size_t get_page_start(size_t column);
715
716
717
718
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
719
void new_magicline(void);
720
#ifndef NANO_TINY
721
void remove_magicline(void);
722
void mark_order(const filestruct **top, size_t *top_x, const filestruct
723
	**bot, size_t *bot_x, bool *right_side_up);
724
void discard_until(const undo *thisitem, openfilestruct *thefile);
725
void add_undo(undo_type action);
726
void update_undo(undo_type action);
727
728
729
730
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
#endif
731
#endif
732
size_t get_totsize(const filestruct *begin, const filestruct *end);
733
filestruct *fsfromline(ssize_t lineno);
734
735
736
737
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
738

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

800
/* May as well throw these here, since they are just placeholders. */
801
802
803
804
805
806
807
808
809
810
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);
811
void discard_buffer(void);
812
813
814
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
815
void flip_replace_void(void);
816
void flip_execute_void(void);
817

818
#endif /* !PROTO_H */