proto.h 23.6 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 the_window_resized;
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
extern bool as_an_at;

43
44
45
extern int margin;
extern int editwincols;

46
extern message_type lastmessage;
47

48
49
extern filestruct *pletion_line;

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 maxlines;
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, bool isdata);
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
char *mbstrcasestr(const char *haystack, const char *needle);
232
233
char *revstrstr(const char *haystack, const char *needle,
	const char *pointer);
234
235
236
237
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
void check_the_multis(filestruct *line);
270
271
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
void cut_marked(bool *right_side_up);
280
void cut_to_eol(void);
281
void cut_to_eof(void);
282
#endif
283
void do_cut_text(bool copy_text, bool cut_till_eof);
284
285
286
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
287
void do_cut_till_eof(void);
288
#endif
289
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
290

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

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

381
/* All functions in help.c. */
382
#ifndef DISABLE_HELP
383
void do_help(void);
384
void help_init(void);
385
functionptrtype parse_help_input(int *kbinput);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
386
size_t help_line_len(const char *ptr);
387
#endif
388
void do_help_void(void);
389

390
/* All functions in move.c. */
391
392
393
394
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
395
396
397
398
399
400
#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
401
402
void do_prev_block(void);
void do_next_block(void);
403
void do_prev_word(bool allow_punct, bool allow_update);
404
void do_prev_word_void(void);
405
406
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
407
void ensure_line_is_visible(void);
408
409
void do_home(void);
void do_end(void);
410
void do_up(bool scroll_only);
411
void do_up_void(void);
412
void do_down(bool scroll_only);
413
void do_down_void(void);
414
#ifndef NANO_TINY
415
void do_scroll_up(void);
416
417
void do_scroll_down(void);
#endif
418
419
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
420

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

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

516
/* Most functions in rcfile.c. */
517
518
519
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
char *parse_next_word(char *ptr);
#endif
520
#ifndef DISABLE_NANORC
521
#ifndef DISABLE_COLOR
522
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
523
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
524
#endif
525
void parse_rcfile(FILE *rcstream, bool syntax_only);
526
void do_rcfiles(void);
527
#endif /* !DISABLE_NANORC */
528

529
/* All functions in search.c. */
530
#ifdef HAVE_REGEX_H
531
bool regexp_init(const char *regexp);
532
533
534
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
535
void search_replace_abort(void);
536
int search_init(bool replacing, bool use_answer);
537
538
int findnextstr(const char *needle, bool whole_word_only, bool have_region,
	size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
539
void do_search(void);
540
541
542
543
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
544
void do_research(void);
545
void go_looking(void);
546
#ifdef HAVE_REGEX_H
547
int replace_regexp(char *string, bool create);
548
#endif
549
char *replace_line(const char *needle);
550
551
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
	const filestruct *real_current, size_t *real_current_x);
552
void do_replace(void);
553
void goto_line_posx(ssize_t line, size_t pos_x);
554
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
555
	bool interactive);
556
void do_gotolinecolumn_void(void);
557
#ifndef NANO_TINY
558
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
559
void do_find_bracket(void);
560
#ifndef DISABLE_TABCOMP
561
char *get_history_completion(filestruct **h, char *s, size_t len);
562
#endif
563
#endif
564
565
#ifndef DISABLE_HISTORIES
bool history_has_changed(void);
566
void history_init(void);
567
void history_reset(const filestruct *h);
568
569
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
570
void update_history(filestruct **h, const char *s);
571
572
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
573
574
void get_history_older_void(void);
void get_history_newer_void(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
575
#endif
Chris Allegretta's avatar
Chris Allegretta committed
576

577
/* All functions in text.c. */
578
#ifndef NANO_TINY
579
580
581
582
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
583
584
585
586
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
587
void do_tab(void);
588
#ifndef NANO_TINY
589
590
591
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
592
#endif
593
594
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
595
void do_comment(void);
596
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
597
#endif
598
599
void do_undo(void);
void do_redo(void);
600
void do_enter(void);
601
#ifndef NANO_TINY
602
RETSIGTYPE cancel_command(int signal);
603
bool execute_command(const char *command);
604
605
606
607
void discard_until(const undo *thisitem, openfilestruct *thefile);
void add_undo(undo_type action);
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
608
#endif
609
610
void update_undo(undo_type action);
#endif /* !NANO_TINY */
611
612
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
613
bool do_wrap(filestruct *line);
614
#endif
615
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
616
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
617
#endif
618
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
619
620
621
622
623
624
625
626
627
628
629
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);
630
void backup_lines(filestruct *first_line, size_t par_len);
631
bool find_paragraph(size_t *const quote, size_t *const par);
632
633
634
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
635
#endif
636
637
638
639
640
641
#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
642
643
#ifndef DISABLE_COLOR
void do_linter(void);
644
void do_formatter(void);
645
#endif
646
#ifndef NANO_TINY
647
void do_wordlinechar_count(void);
648
#endif
649
void do_verbatim_input(void);
650
void complete_a_word(void);
651

652
/* All functions in utils.c. */
653
void get_homedir(void);
654
655
656
#ifdef ENABLE_LINENUMBERS
int digits(ssize_t n);
#endif
657
bool parse_num(const char *str, ssize_t *val);
658
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
659
void snuggly_fit(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
660
661
662
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
663
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
664
665
666
667
668
669
#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
670
#endif
671
#ifdef HAVE_REGEX_H
672
const char *fixbounds(const char *r);
673
#endif
674
#ifndef DISABLE_SPELLER
675
bool is_separate_word(size_t position, size_t length, const char *buf);
676
#endif
677
const char *strstrwrapper(const char *haystack, const char *needle,
678
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
679
680
681
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
682
char *mallocstrncpy(char *dest, const char *src, size_t n);
683
char *mallocstrcpy(char *dest, const char *src);
684
char *free_and_assign(char *dest, char *src);
685
size_t get_page_start(size_t column);
686
687
688
689
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
690
void new_magicline(void);
691
#ifndef NANO_TINY
692
void remove_magicline(void);
693
void mark_order(const filestruct **top, size_t *top_x, const filestruct
694
	**bot, size_t *bot_x, bool *right_side_up);
695
#endif
696
size_t get_totsize(const filestruct *begin, const filestruct *end);
697
#ifndef NANO_TINY
698
filestruct *fsfromline(ssize_t lineno);
699
#endif
700
701
702
703
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
704

705
/* Most functions in winio.c. */
706
707
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
708
void unget_input(int *input, size_t input_len);
709
void unget_kbinput(int kbinput, bool metakey);
710
int *get_input(WINDOW *win, size_t input_len);
711
712
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
713
714
int arrow_from_abcd(int kbinput);
int parse_escape_sequence(WINDOW *win, int kbinput);
715
int get_byte_kbinput(int kbinput);
716
#ifdef ENABLE_UTF8
717
long add_unicode_digit(int kbinput, long factor, long *uni);
718
long get_unicode_kbinput(WINDOW *win, int kbinput);
719
#endif
720
int get_control_kbinput(int kbinput);
721
void unparse_kbinput(char *output, size_t output_len);
722
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
723
int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
724
#ifndef DISABLE_MOUSE
725
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
726
#endif
727
const sc *get_shortcut(int *kbinput);
728
void blank_row(WINDOW *win, int y, int x, int n);
729
void blank_titlebar(void);
730
731
void blank_edit(void);
void blank_statusbar(void);
732
void blank_bottombars(void);
733
void check_statusblank(void);
734
735
char *display_string(const char *buf, size_t start_col, size_t span,
	bool dollars);
736
void titlebar(const char *path);
737
extern void set_modified(void);
738
void statusbar(const char *msg);
739
void warn_and_shortly_pause(const char *msg);
740
void statusline(message_type importance, const char *msg, ...);
741
void bottombars(int menu);
742
void onekey(const char *keystroke, const char *desc, int length);
743
void reset_cursor(void);
744
745
void edit_draw(filestruct *fileptr, const char *converted,
	int line, size_t from_col);
746
int update_line(filestruct *fileptr, size_t index);
747
bool need_horizontal_scroll(const size_t old_column, const size_t new_column);
748
void edit_scroll(scroll_dir direction, int nrows);
749
void edit_redraw(filestruct *old_current);
Chris Allegretta's avatar
Chris Allegretta committed
750
void edit_refresh(void);
751
void adjust_viewport(update_type location);
752
void total_redraw(void);
753
void total_refresh(void);
754
void display_main_list(void);
755
void do_cursorpos(bool force);
756
void do_cursorpos_void(void);
757
void spotlight(bool active, const char *word);
758
759
void xon_complaint(void);
void xoff_complaint(void);
760
void do_suspend_void(void);
761
762
void enable_nodelay(void);
void disable_nodelay(void);
763
#ifndef DISABLE_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
764
void do_credits(void);
765
#endif
766

767
/* May as well throw these here, since they are just placeholders. */
768
769
770
771
772
773
774
775
776
777
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);
778
void discard_buffer(void);
779
780
781
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
782
void flip_replace_void(void);
783
void flip_execute_void(void);
784

785
#endif /* !PROTO_H */