proto.h 23.3 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
79
80
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;

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

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

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

94
95
extern const char *exit_tag;
extern const char *close_tag;
96
extern const char *uncut_tag;
97
#ifndef DISABLE_JUSTIFY
98
extern const char *unjust_tag;
99
100
extern char *punct;
extern char *brackets;
Chris Allegretta's avatar
Chris Allegretta committed
101
extern char *quotestr;
102
103
104
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
105
106
#endif /* !DISABLE_JUSTIFY */

107
108
extern char *word_chars;

109
extern bool nodelay_mode;
110

111
112
113
114
extern char *answer;

extern ssize_t tabsize;

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

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

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

134
extern bool refresh_needed;
135

136
extern int currmenu;
137
138
139
140
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
141

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

152
153
154
extern regex_t search_regexp;
extern regmatch_t regmatches[10];

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 *strip_last_component(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
bool is_byte(int c);
190
bool is_alpha_mbchar(const char *c);
191
bool is_alnum_mbchar(const char *c);
192
bool is_blank_mbchar(const char *c);
193
bool is_ascii_cntrl_char(int c);
194
bool is_cntrl_char(int c);
195
bool is_cntrl_mbchar(const char *c);
196
bool is_punct_mbchar(const char *c);
197
bool is_word_mbchar(const char *c, bool allow_punct);
198
char control_rep(const signed char c);
199
char control_mbrep(const char *c, bool isdata);
200
int length_of_char(const char *c, int *width);
201
int mbwidth(const char *c);
202
char *make_mbchar(long chr, int *chr_mb_len);
203
int parse_mbchar(const char *buf, char *chr, size_t *col);
204
205
size_t move_mbleft(const char *buf, size_t pos);
size_t move_mbright(const char *buf, size_t pos);
206
207
int mbstrcasecmp(const char *s1, const char *s2);
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
208
char *mbstrcasestr(const char *haystack, const char *needle);
209
210
char *revstrstr(const char *haystack, const char *needle,
	const char *pointer);
211
212
213
214
char *revstrcasestr(const char *haystack, const char *needle, const char
	*rev_start);
char *mbrevstrcasestr(const char *haystack, const char *needle, const
	char *rev_start);
215
size_t mbstrlen(const char *s);
216
size_t mbstrnlen(const char *s, size_t maxlen);
217
218
219
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
char *mbstrchr(const char *s, const char *c);
#endif
220
#ifndef NANO_TINY
221
char *mbstrpbrk(const char *s, const char *accept);
222
223
char *revstrpbrk(const char *s, const char *accept, const char
	*rev_start);
224
225
char *mbrevstrpbrk(const char *s, const char *accept, const char
	*rev_start);
226
#endif
227
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
228
229
230
bool has_blank_chars(const char *s);
bool has_blank_mbchars(const char *s);
#endif
231
232
233
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
234
#ifndef DISABLE_NANORC
235
236
bool is_valid_mbstring(const char *s);
#endif
237

238
/* Most functions in color.c. */
239
#ifndef DISABLE_COLOR
240
void set_colorpairs(void);
241
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
242
void color_update(void);
243
void check_the_multis(filestruct *line);
244
245
void alloc_multidata_if_needed(filestruct *fileptr);
void precalc_multicolorinfo(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
246
#endif
247

248
/* All functions in cut.c. */
249
void cutbuffer_reset(void);
250
bool keeping_cutbuffer(void);
251
void cut_line(void);
252
#ifndef NANO_TINY
253
void cut_marked(bool *right_side_up);
254
void cut_to_eol(void);
255
void cut_to_eof(void);
256
#endif
257
void do_cut_text(bool copy_text, bool cut_till_eof);
258
259
260
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
261
void do_cut_till_eof(void);
262
#endif
263
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
264

265
/* Most functions in files.c. */
266
void make_new_buffer(void);
267
void initialize_buffer_text(void);
268
bool open_buffer(const char *filename, bool undoable);
269
270
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
271
272
273
274
#ifndef NANO_TINY
void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
	filestruct *bot, size_t bot_x);
#endif
275
#endif
276
void display_buffer(void);
277
#ifndef DISABLE_MULTIBUFFER
278
279
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
280
bool close_buffer(void);
281
#endif
282
char *encode_data(char *buf, size_t buf_len);
283
284
void read_file(FILE *f, int fd, const char *filename, bool undoable,
		bool checkwritable);
285
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
286
char *get_next_filename(const char *name, const char *suffix);
287
void do_insertfile_void(void);
288
289
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
290
char *safe_tempfile(FILE **f);
291
#ifndef DISABLE_OPERATINGDIR
292
void init_operating_dir(void);
293
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
294
#endif
295
#ifndef NANO_TINY
296
void init_backup_dir(void);
297
int delete_lockfile(const char *lockfilename);
298
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
299
#endif
300
int copy_file(FILE *inn, FILE *out, bool close_out);
301
302
bool write_file(const char *name, FILE *f_open, bool tmp,
	kind_of_writing_type method, bool nonamechange);
303
#ifndef NANO_TINY
304
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
305
	kind_of_writing_type method);
306
#endif
307
int do_writeout(bool exiting);
308
void do_writeout_void(void);
309
310
311
#ifndef NANO_TINY
void do_savefile(void);
#endif
312
char *real_dir_from_tilde(const char *buf);
313
314
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
315
void free_chararray(char **array, size_t len);
316
#endif
Chris Allegretta's avatar
Chris Allegretta committed
317
#ifndef DISABLE_TABCOMP
318
bool is_dir(const char *buf);
319
char **username_tab_completion(const char *buf, size_t *num_matches,
320
	size_t buf_len);
321
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
322
	*num_matches, size_t buf_len);
323
char *input_tab(char *buf, bool allow_files, size_t *place,
324
	bool *lastwastab, void (*refresh_func)(void), bool *listed);
Chris Allegretta's avatar
Chris Allegretta committed
325
#endif
326
const char *tail(const char *path);
327
#ifndef DISABLE_HISTORIES
328
char *histfilename(void);
329
void load_history(void);
330
bool writehist(FILE *hist, const filestruct *head);
331
void save_history(void);
332
333
334
int check_dotnano(void);
void load_poshistory(void);
void save_poshistory(void);
335
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
336
bool has_old_position(const char *file, ssize_t *line, ssize_t *column);
337
#endif
338

339
/* Some functions in global.c. */
340
size_t length_of_list(int menu);
341
const sc *first_sc_for(int menu, void (*func)(void));
342
int the_code_for(void (*func)(void), int defaultval);
343
functionptrtype func_from_key(int *kbinput);
344
void assign_keyinfo(sc *s, const char *keystring, const int keycode);
345
void print_sclist(void);
346
void shortcut_init(void);
347
#ifndef DISABLE_COLOR
348
void set_lint_or_format_shortcuts(void);
349
350
void set_spell_shortcuts(void);
#endif
351
const subnfunc *sctofunc(const sc *s);
352
const char *flagtostr(int flag);
353
354
sc *strtosc(const char *input);
int strtomenu(const char *input);
Chris Allegretta's avatar
Chris Allegretta committed
355
356
#ifdef DEBUG
void thanks_for_all_the_fish(void);
357
358
#endif

359
/* All functions in help.c. */
360
#ifndef DISABLE_HELP
361
void do_help(void);
362
void help_init(void);
363
functionptrtype parse_help_input(int *kbinput);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
364
size_t help_line_len(const char *ptr);
365
#endif
366
void do_help_void(void);
367

368
/* All functions in move.c. */
369
370
371
372
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
373
374
375
376
377
378
#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
379
380
void do_prev_block(void);
void do_next_block(void);
381
void do_prev_word(bool allow_punct, bool allow_update);
382
void do_prev_word_void(void);
383
384
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
385
void do_home(bool be_clever);
386
void do_home_void(void);
387
void do_end(bool be_clever);
388
void do_end_void(void);
389
void do_up(bool scroll_only);
390
void do_up_void(void);
391
void do_down(bool scroll_only);
392
void do_down_void(void);
393
#ifndef NANO_TINY
394
void do_scroll_up(void);
395
396
void do_scroll_down(void);
#endif
397
398
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
399

400
/* All functions in nano.c. */
401
402
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
403
void splice_node(filestruct *afterthis, filestruct *newnode);
404
void unlink_node(filestruct *fileptr);
405
406
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
Chris Allegretta's avatar
Chris Allegretta committed
407
void free_filestruct(filestruct *src);
408
void renumber(filestruct *fileptr);
409
410
partition *partition_filestruct(filestruct *top, size_t top_x,
	filestruct *bot, size_t bot_x);
411
void unpartition_filestruct(partition **p);
412
void extract_buffer(filestruct **file_top, filestruct **file_bot,
413
	filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
414
void ingraft_buffer(filestruct *somebuffer);
415
void copy_from_buffer(filestruct *somebuffer);
416
417
418
openfilestruct *make_new_opennode(void);
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
419
void print_view_warning(void);
420
421
422
423
void show_restricted_warning(void);
#ifdef DISABLE_HELP
void say_there_is_no_help(void);
#endif
424
425
void finish(void);
void die(const char *msg, ...);
426
void die_save_file(const char *die_filename, struct stat *die_stat);
427
428
void window_init(void);
#ifndef DISABLE_MOUSE
429
430
void disable_mouse_support(void);
void enable_mouse_support(void);
431
432
void mouse_init(void);
#endif
433
void print_opt(const char *shortflag, const char *longflag, const char *desc);
434
435
void usage(void);
void version(void);
436
void do_exit(void);
437
void close_and_go(void);
Chris Allegretta's avatar
Chris Allegretta committed
438
void signal_init(void);
439
440
441
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
442
#ifndef NANO_TINY
443
RETSIGTYPE handle_sigwinch(int signal);
444
void regenerate_screen(void);
445
void allow_sigwinch(bool allow);
446
void do_toggle(int flag);
447
void do_toggle_void(void);
448
449
450
451
void enable_signals(void);
#endif
void disable_flow_control(void);
void enable_flow_control(void);
452
void terminal_init(void);
453
void unbound_key(int code);
454
int do_input(bool allow_funcs);
455
#ifndef DISABLE_MOUSE
456
int do_mouse(void);
457
#endif
458
void do_output(char *output, size_t output_len, bool allow_cntrls);
459

460
/* Most functions in prompt.c. */
461
#ifndef DISABLE_MOUSE
462
int do_statusbar_mouse(void);
463
#endif
464
void do_statusbar_output(int *the_input, size_t input_len,
465
	bool filtering);
466
467
468
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
469
void do_statusbar_right(void);
470
471
472
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
473
#ifndef NANO_TINY
474
void do_statusbar_prev_word(void);
475
void do_statusbar_next_word(void);
476
#endif
477
void do_statusbar_verbatim_input(void);
478
479
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
480
void reinit_statusbar_x(void);
481
void reset_statusbar_cursor(void);
482
void update_the_statusbar(void);
483
int do_prompt(bool allow_tabs, bool allow_files,
484
	int menu, const char *curranswer,
485
#ifndef DISABLE_HISTORIES
486
487
	filestruct **history_list,
#endif
488
	void (*refresh_func)(void), const char *msg, ...);
489
int do_yesno_prompt(bool all, const char *msg);
490

491
/* Most functions in rcfile.c. */
492
493
494
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
char *parse_next_word(char *ptr);
#endif
495
#ifndef DISABLE_NANORC
496
#ifndef DISABLE_COLOR
497
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
498
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
499
#endif
500
void parse_rcfile(FILE *rcstream, bool syntax_only);
501
void do_rcfiles(void);
502
#endif /* !DISABLE_NANORC */
503

504
/* All functions in search.c. */
505
bool regexp_init(const char *regexp);
506
507
void regexp_cleanup(void);
void not_found_msg(const char *str);
508
void search_replace_abort(void);
509
int search_init(bool replacing, bool use_answer);
510
511
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);
512
void do_search(void);
513
514
515
516
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
517
void do_research(void);
518
void go_looking(void);
519
int replace_regexp(char *string, bool create);
520
char *replace_line(const char *needle);
521
522
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
	const filestruct *real_current, size_t *real_current_x);
523
void do_replace(void);
524
void goto_line_posx(ssize_t line, size_t pos_x);
525
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
526
	bool interactive);
527
void do_gotolinecolumn_void(void);
528
#ifndef NANO_TINY
529
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
530
void do_find_bracket(void);
531
#ifndef DISABLE_TABCOMP
532
char *get_history_completion(filestruct **h, char *s, size_t len);
533
#endif
534
#endif
535
536
#ifndef DISABLE_HISTORIES
bool history_has_changed(void);
537
void history_init(void);
538
void history_reset(const filestruct *h);
539
540
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
541
void update_history(filestruct **h, const char *s);
542
543
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
544
545
void get_history_older_void(void);
void get_history_newer_void(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
546
#endif
Chris Allegretta's avatar
Chris Allegretta committed
547

548
/* All functions in text.c. */
549
#ifndef NANO_TINY
550
551
552
553
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
554
555
556
557
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
558
void do_tab(void);
559
#ifndef NANO_TINY
560
561
562
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
563
#endif
564
565
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
566
void do_comment(void);
567
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
568
#endif
569
570
void do_undo(void);
void do_redo(void);
571
void do_enter(void);
572
#ifndef NANO_TINY
573
RETSIGTYPE cancel_command(int signal);
574
bool execute_command(const char *command);
575
576
577
578
void discard_until(const undo *thisitem, openfilestruct *thefile);
void add_undo(undo_type action);
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
579
#endif
580
581
void update_undo(undo_type action);
#endif /* !NANO_TINY */
582
583
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
584
bool do_wrap(filestruct *line);
585
#endif
586
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
587
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
588
#endif
589
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
590
591
592
593
594
595
596
597
598
599
600
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);
601
void backup_lines(filestruct *first_line, size_t par_len);
602
bool find_paragraph(size_t *const quote, size_t *const par);
603
604
605
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
606
#endif
607
608
609
610
611
612
#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
613
614
#ifndef DISABLE_COLOR
void do_linter(void);
615
void do_formatter(void);
616
#endif
617
#ifndef NANO_TINY
618
void do_wordlinechar_count(void);
619
#endif
620
void do_verbatim_input(void);
621
void complete_a_word(void);
622

623
/* All functions in utils.c. */
624
void get_homedir(void);
625
626
627
#ifdef ENABLE_LINENUMBERS
int digits(ssize_t n);
#endif
628
bool parse_num(const char *str, ssize_t *val);
629
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
630
void snuggly_fit(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
631
632
633
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
634
const char *fixbounds(const char *r);
635
#ifndef DISABLE_SPELLER
636
bool is_separate_word(size_t position, size_t length, const char *buf);
637
#endif
638
const char *strstrwrapper(const char *haystack, const char *needle,
639
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
640
641
642
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
643
char *mallocstrncpy(char *dest, const char *src, size_t n);
644
char *mallocstrcpy(char *dest, const char *src);
645
char *free_and_assign(char *dest, char *src);
646
size_t get_page_start(size_t column);
647
648
649
650
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
651
void new_magicline(void);
652
#ifndef NANO_TINY
653
void remove_magicline(void);
654
void mark_order(const filestruct **top, size_t *top_x, const filestruct
655
	**bot, size_t *bot_x, bool *right_side_up);
656
#endif
657
size_t get_totsize(const filestruct *begin, const filestruct *end);
658
#ifndef NANO_TINY
659
filestruct *fsfromline(ssize_t lineno);
660
#endif
661
662
663
664
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
665

666
/* Most functions in winio.c. */
667
668
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
669
void unget_input(int *input, size_t input_len);
670
void unget_kbinput(int kbinput, bool metakey);
671
int *get_input(WINDOW *win, size_t input_len);
672
673
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
674
675
int arrow_from_abcd(int kbinput);
int parse_escape_sequence(WINDOW *win, int kbinput);
676
int get_byte_kbinput(int kbinput);
677
#ifdef ENABLE_UTF8
678
long add_unicode_digit(int kbinput, long factor, long *uni);
679
long get_unicode_kbinput(WINDOW *win, int kbinput);
680
#endif
681
int get_control_kbinput(int kbinput);
682
void unparse_kbinput(char *output, size_t output_len);
683
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
684
int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
685
#ifndef DISABLE_MOUSE
686
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
687
#endif
688
const sc *get_shortcut(int *kbinput);
689
void blank_row(WINDOW *win, int y, int x, int n);
690
void blank_titlebar(void);
691
692
void blank_edit(void);
void blank_statusbar(void);
693
void blank_bottombars(void);
694
void check_statusblank(void);
695
696
char *display_string(const char *buf, size_t start_col, size_t span,
	bool dollars);
697
void titlebar(const char *path);
698
extern void set_modified(void);
699
void statusbar(const char *msg);
700
void warn_and_shortly_pause(const char *msg);
701
void statusline(message_type importance, const char *msg, ...);
702
void bottombars(int menu);
703
void onekey(const char *keystroke, const char *desc, int length);
704
void reset_cursor(void);
705
706
void edit_draw(filestruct *fileptr, const char *converted,
	int line, size_t from_col);
707
int update_line(filestruct *fileptr, size_t index);
708
709
710
#ifndef NANO_TINY
int update_softwrapped_line(filestruct *fileptr);
#endif
711
bool line_needs_update(const size_t old_column, const size_t new_column);
712
713
int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
714
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
715
void edit_scroll(scroll_dir direction, int nrows);
716
void ensure_firstcolumn_is_aligned(void);
717
718
719
bool current_is_above_screen(void);
bool current_is_below_screen(void);
bool current_is_offscreen(void);
720
void edit_redraw(filestruct *old_current);
Chris Allegretta's avatar
Chris Allegretta committed
721
void edit_refresh(void);
722
void adjust_viewport(update_type location);
723
void total_redraw(void);
724
void total_refresh(void);
725
void display_main_list(void);
726
void do_cursorpos(bool force);
727
void do_cursorpos_void(void);
728
void spotlight(bool active, const char *word);
729
730
void xon_complaint(void);
void xoff_complaint(void);
731
void do_suspend_void(void);
732
733
void enable_nodelay(void);
void disable_nodelay(void);
734
#ifndef DISABLE_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
735
void do_credits(void);
736
#endif
737

738
/* May as well throw these here, since they are just placeholders. */
739
740
741
742
743
744
745
746
747
748
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);
749
void discard_buffer(void);
750
751
752
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
753
void flip_replace_void(void);
754
void flip_execute_void(void);
755

756
#endif /* !PROTO_H */