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 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 filestruct *pletion_line;

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

67
#ifndef DISABLE_WRAPJUSTIFY
68
extern ssize_t fill;
69
extern ssize_t wrap_at;
70
#endif
71
72
73

extern char *last_search;

74
75
extern char *present_path;

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

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

88
89
90
91
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

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

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

114
115
extern char *word_chars;

116
extern bool nodelay_mode;
117

118
119
120
121
extern char *answer;

extern ssize_t tabsize;

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

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

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

141
extern bool refresh_needed;
142

143
extern int currmenu;
144
145
146
147
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
148

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

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

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

170
171
extern char *homedir;

172
173
typedef void (*functionptrtype)(void);

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

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

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

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

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

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

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

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

422
/* All functions in nano.c. */
423
424
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
425
void splice_node(filestruct *afterthis, filestruct *newnode);
426
void unlink_node(filestruct *fileptr);
427
428
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
Chris Allegretta's avatar
Chris Allegretta committed
429
void free_filestruct(filestruct *src);
430
void renumber(filestruct *fileptr);
431
432
partition *partition_filestruct(filestruct *top, size_t top_x,
	filestruct *bot, size_t bot_x);
433
void unpartition_filestruct(partition **p);
434
435
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
	filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
436
void copy_from_filestruct(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, bool *got_newline);
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(bool *got_newline);
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
509
510
511
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
512
	int menu, const char *curranswer,
513
#ifndef DISABLE_HISTORIES
514
515
	filestruct **history_list,
#endif
516
	void (*refresh_func)(void), const char *msg, ...);
517
int do_yesno_prompt(bool all, const char *msg);
518

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

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

580
/* All functions in text.c. */
581
#ifndef NANO_TINY
582
583
584
585
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
586
587
588
589
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
590
void do_tab(void);
591
#ifndef NANO_TINY
592
593
594
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
595
596
void do_undo(void);
void do_redo(void);
597
#endif
598
599
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
600
601
void do_comment(void);
#endif
602
void do_enter(void);
603
#ifndef NANO_TINY
604
RETSIGTYPE cancel_command(int signal);
605
bool execute_command(const char *command);
606
#endif
607
608
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
609
bool do_wrap(filestruct *line);
610
#endif
611
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
612
613
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
614
	, bool newln
615
616
#endif
	);
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
int digits(int n);
655
bool parse_num(const char *str, ssize_t *val);
656
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
657
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
658
659
660
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
661
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
662
663
664
665
666
667
#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
668
#endif
669
#ifdef HAVE_REGEX_H
670
const char *fixbounds(const char *r);
671
#endif
672
#ifndef DISABLE_SPELLER
673
bool is_separate_word(size_t position, size_t length, const char *buf);
674
#endif
675
const char *strstrwrapper(const char *haystack, const char *needle,
676
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
677
678
679
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
680
char *mallocstrncpy(char *dest, const char *src, size_t n);
681
char *mallocstrcpy(char *dest, const char *src);
682
char *free_and_assign(char *dest, char *src);
683
size_t get_page_start(size_t column);
684
685
686
687
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
688
void new_magicline(void);
689
#ifndef NANO_TINY
690
void remove_magicline(void);
691
void mark_order(const filestruct **top, size_t *top_x, const filestruct
692
	**bot, size_t *bot_x, bool *right_side_up);
693
void discard_until(const undo *thisitem, openfilestruct *thefile);
694
void add_undo(undo_type action);
695
void update_undo(undo_type action);
696
697
698
699
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
#endif
700
#endif
701
size_t get_totsize(const filestruct *begin, const filestruct *end);
702
filestruct *fsfromline(ssize_t lineno);
703
704
705
706
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
707

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

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

788
#endif /* !PROTO_H */