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
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
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
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode);
305
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
306
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
307
char *get_next_filename(const char *name, const char *suffix);
308
void do_insertfile_void(void);
309
310
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
311
char *safe_tempfile(FILE **f);
312
#ifndef DISABLE_OPERATINGDIR
313
void init_operating_dir(void);
314
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
315
#endif
316
#ifndef NANO_TINY
317
void init_backup_dir(void);
318
int delete_lockfile(const char *lockfilename);
319
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
320
#endif
321
int copy_file(FILE *inn, FILE *out);
322
323
bool write_file(const char *name, FILE *f_open, bool tmp,
	kind_of_writing_type method, bool nonamechange);
324
#ifndef NANO_TINY
325
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
326
	kind_of_writing_type method);
327
#endif
328
int do_writeout(bool exiting);
329
void do_writeout_void(void);
330
331
332
#ifndef NANO_TINY
void do_savefile(void);
#endif
333
char *real_dir_from_tilde(const char *buf);
334
335
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
336
void free_chararray(char **array, size_t len);
337
#endif
Chris Allegretta's avatar
Chris Allegretta committed
338
#ifndef DISABLE_TABCOMP
339
bool is_dir(const char *buf);
340
char **username_tab_completion(const char *buf, size_t *num_matches,
341
	size_t buf_len);
342
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
343
	*num_matches, size_t buf_len);
344
char *input_tab(char *buf, bool allow_files, size_t *place,
345
	bool *lastwastab, void (*refresh_func)(void), bool *listed);
Chris Allegretta's avatar
Chris Allegretta committed
346
#endif
347
const char *tail(const char *path);
348
#ifndef DISABLE_HISTORIES
349
char *histfilename(void);
350
void load_history(void);
351
bool writehist(FILE *hist, const filestruct *head);
352
void save_history(void);
353
354
355
int check_dotnano(void);
void load_poshistory(void);
void save_poshistory(void);
356
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
357
bool has_old_position(const char *file, ssize_t *line, ssize_t *column);
358
#endif
359

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

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

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

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

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

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

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

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

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

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

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

787
#endif /* !PROTO_H */