proto.h 24.5 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
/* $Id$ */
Chris Allegretta's avatar
Chris Allegretta committed
2
3
4
/**************************************************************************
 *   proto.h                                                              *
 *                                                                        *
5
 *   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,  *
6
 *   2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc.    *
Chris Allegretta's avatar
Chris Allegretta committed
7
8
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
9
 *   the Free Software Foundation; either version 3, or (at your option)  *
Chris Allegretta's avatar
Chris Allegretta committed
10
11
 *   any later version.                                                   *
 *                                                                        *
12
13
14
15
 *   This program 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
18
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
19
20
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA            *
 *   02110-1301, USA.                                                     *
Chris Allegretta's avatar
Chris Allegretta committed
21
22
23
 *                                                                        *
 **************************************************************************/

24
25
26
#ifndef PROTO_H
#define PROTO_H 1

Chris Allegretta's avatar
Chris Allegretta committed
27
28
#include "nano.h"

29
/* All external variables.  See global.c for their descriptions. */
30
#ifndef NANO_TINY
31
32
extern sigjmp_buf jump_buf;
extern bool jump_buf_main;
33
34
#endif

35
36
37
extern bool meta_key;
extern bool func_key;

38
#ifndef DISABLE_WRAPJUSTIFY
39
extern ssize_t fill;
40
extern ssize_t wrap_at;
41
#endif
42
43
44
45

extern char *last_search;
extern char *last_replace;

46
extern unsigned flags[4];
47
48
49
50
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
51
extern int maxrows;
52
53

extern filestruct *cutbuffer;
54
extern filestruct *cutbottom;
55
56
57
58
59
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
extern partition *filepart;
extern openfilestruct *openfile;
Chris Allegretta's avatar
Chris Allegretta committed
60

61
62
63
64
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

65
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
66
extern char *whitespace;
67
extern int whitespace_len[2];
68
69
#endif

70
71
extern const char *exit_tag;
extern const char *close_tag;
72
extern const char *uncut_tag;
73
#ifndef DISABLE_JUSTIFY
74
extern const char *unjust_tag;
75
76
extern char *punct;
extern char *brackets;
Chris Allegretta's avatar
Chris Allegretta committed
77
extern char *quotestr;
78
79
80
81
82
83
84
#ifdef HAVE_REGEX_H
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
#else
extern size_t quotelen;
#endif
85
86
#endif /* !DISABLE_JUSTIFY */

87
extern bool nodelay_mode;
88
89
90
91
extern char *answer;

extern ssize_t tabsize;

92
#ifndef NANO_TINY
93
extern char *backup_dir;
94
95
extern const char *locking_prefix;
extern const char *locking_suffix;
96
#endif
97
98
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
99
extern char *full_operating_dir;
100
#endif
101

102
#ifndef DISABLE_SPELLER
103
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
104
105
#endif

106
#ifndef DISABLE_COLOR
107
108
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
109
#endif
110

111
extern bool edit_refresh_needed;
112

113
extern int currmenu;
114
115
116
117
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
118

119
#ifndef DISABLE_HISTORIES
120
121
122
123
124
125
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
126
extern poshiststruct *poshistory;
127
128
#endif

129
130
131
132
133
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

134
extern int hilite_attribute;
135
136
137
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
138
extern color_pair interface_color_pair[NUMBER_OF_ELEMENTS];
139

140
141
extern char *homedir;

142
/* All functions in browser.c. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
143
#ifndef DISABLE_BROWSER
144
char *do_browser(char *path, DIR *dir);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
145
char *do_browse_from(const char *inpath);
146
void browser_init(const char *path, DIR *dir);
147
void parse_browser_input(int *kbinput);
148
void browser_refresh(void);
149
bool browser_select_filename(const char *needle);
150
151
152
153
154
155
156
157
int filesearch_init(void);
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
void findnextfile_wrap_reset(void);
void filesearch_abort(void);
void do_filesearch(void);
void do_fileresearch(void);
void do_first_file(void);
void do_last_file(void);
158
char *striponedir(const char *path);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
159
160
#endif

161
/* All functions in chars.c. */
162
163
164
165
#ifdef ENABLE_UTF8
void utf8_init(void);
bool using_utf8(void);
#endif
166
char *addstrings(char* str1, size_t len1, char* str2, size_t len2);
167
#ifndef HAVE_ISBLANK
168
bool nisblank(int c);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
169
#endif
170
#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
171
bool niswblank(wchar_t wc);
172
#endif
173
bool is_byte(int c);
174
bool is_alnum_mbchar(const char *c);
175
bool is_blank_mbchar(const char *c);
176
bool is_ascii_cntrl_char(int c);
177
bool is_cntrl_char(int c);
178
#ifdef ENABLE_UTF8
179
bool is_cntrl_wchar(wchar_t wc);
180
#endif
181
bool is_cntrl_mbchar(const char *c);
182
bool is_punct_mbchar(const char *c);
183
bool is_word_mbchar(const char *c, bool allow_punct);
184
char control_rep(char c);
185
#ifdef ENABLE_UTF8
186
187
wchar_t control_wrep(wchar_t c);
#endif
188
char *control_mbrep(const char *c, char *crep, int *crep_len);
189
char *mbrep(const char *c, char *crep, int *crep_len);
190
191
int mbwidth(const char *c);
int mb_cur_max(void);
192
char *make_mbchar(long chr, int *chr_mb_len);
193
int parse_mbchar(const char *buf, char *chr, size_t *col);
194
195
size_t move_mbleft(const char *buf, size_t pos);
size_t move_mbright(const char *buf, size_t pos);
196
197
198
199
200
201
202
203
204
#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
205
char *nstrcasestr(const char *haystack, const char *needle);
206
#endif
207
char *mbstrcasestr(const char *haystack, const char *needle);
208
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
209
210
char *revstrstr(const char *haystack, const char *needle, const char
	*rev_start);
211
#endif
212
#ifndef NANO_TINY
213
214
215
216
char *revstrcasestr(const char *haystack, const char *needle, const char
	*rev_start);
char *mbrevstrcasestr(const char *haystack, const char *needle, const
	char *rev_start);
217
#endif
218
size_t mbstrlen(const char *s);
219
220
221
222
#ifndef HAVE_STRNLEN
size_t nstrnlen(const char *s, size_t maxlen);
#endif
size_t mbstrnlen(const char *s, size_t maxlen);
223
224
225
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
char *mbstrchr(const char *s, const char *c);
#endif
226
#ifndef NANO_TINY
227
char *mbstrpbrk(const char *s, const char *accept);
228
229
char *revstrpbrk(const char *s, const char *accept, const char
	*rev_start);
230
231
char *mbrevstrpbrk(const char *s, const char *accept, const char
	*rev_start);
232
#endif
233
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
234
235
236
bool has_blank_chars(const char *s);
bool has_blank_mbchars(const char *s);
#endif
237
238
239
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
240
#ifndef DISABLE_NANORC
241
242
bool is_valid_mbstring(const char *s);
#endif
243

244
/* All functions in color.c. */
245
#ifndef DISABLE_COLOR
246
void set_colorpairs(void);
247
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
248
void color_update(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
249
#endif
250

251
/* All functions in cut.c. */
252
void cutbuffer_reset(void);
253
bool keeping_cutbuffer(void);
254
void cut_line(void);
255
#ifndef NANO_TINY
256
257
void cut_marked(void);
void cut_to_eol(void);
258
void cut_to_eof(void);
259
#endif
260
void do_cut_text(
261
#ifndef NANO_TINY
262
	bool copy_text, bool cut_till_eof, bool undoing
263
264
265
266
267
268
269
#else
	void
#endif
	);
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
270
void do_cut_till_eof(void);
271
#endif
272
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
273

274
/* All functions in files.c. */
275
void make_new_buffer(void);
276
void initialize_buffer(void);
277
void initialize_buffer_text(void);
278
void open_buffer(const char *filename, bool undoable);
279
280
281
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
282
void display_buffer(void);
283
#ifndef DISABLE_MULTIBUFFER
284
285
286
287
void switch_to_prevnext_buffer(bool next);
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
bool close_buffer(void);
288
#endif
289
filestruct *read_line(char *buf, filestruct *prevnode, bool
290
	*first_line_ins, size_t buf_len);
291
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
292
int open_file(const char *filename, bool newfie, FILE **f);
293
char *get_next_filename(const char *name, const char *suffix);
294
void do_insertfile(
295
#ifndef NANO_TINY
296
297
298
299
300
	bool execute
#else
	void
#endif
	);
301
void do_insertfile_void(void);
302
303
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
304
char *safe_tempfile(FILE **f);
305
#ifndef DISABLE_OPERATINGDIR
306
void init_operating_dir(void);
307
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
308
#endif
309
#ifndef NANO_TINY
310
void init_backup_dir(void);
311
int delete_lockfile(const char *lockfilename);
312
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
313
#endif
314
int copy_file(FILE *inn, FILE *out);
315
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
316
	append, bool nonamechange);
317
#ifndef NANO_TINY
318
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
319
	append_type append);
320
#endif
321
bool do_writeout(bool exiting);
322
void do_writeout_void(void);
323
char *real_dir_from_tilde(const char *buf);
324
325
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
326
void free_chararray(char **array, size_t len);
327
#endif
Chris Allegretta's avatar
Chris Allegretta committed
328
#ifndef DISABLE_TABCOMP
329
bool is_dir(const char *buf);
330
char **username_tab_completion(const char *buf, size_t *num_matches,
331
	size_t buf_len);
332
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
333
	*num_matches, size_t buf_len);
334
char *input_tab(char *buf, bool allow_files, size_t *place, bool
335
	*lastwastab, void (*refresh_func)(void), bool *list);
Chris Allegretta's avatar
Chris Allegretta committed
336
#endif
337
const char *tail(const char *foo);
338
#ifndef DISABLE_HISTORIES
339
char *histfilename(void);
340
void load_history(void);
341
bool writehist(FILE *hist, filestruct *histhead);
342
void save_history(void);
343
344
345
int check_dotnano(void);
void load_poshistory(void);
void save_poshistory(void);
346
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
347
int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
348
#endif
349

350
/* Some functions in global.c. */
351
size_t length_of_list(int menu);
352
353
354
355
356
key_type strtokeytype(const char *str);
const sc *first_sc_for(int menu, void (*func)(void));
int sc_seq_or(void (*func)(void), int defaultval);
void assign_keyinfo(sc *s);
void print_sclist(void);
357
void shortcut_init(void);
358
359
360
361
362
363
364
365
366
#ifndef DISABLE_COLOR
void set_lint_shortcuts(void);
void set_spell_shortcuts(void);
#endif
const subnfunc *sctofunc(sc *s);
const subnfunc *getfuncfromkey(WINDOW *win);
const char *flagtostr(int flag);
sc *strtosc(char *input);
int strtomenu(char *input);
Chris Allegretta's avatar
Chris Allegretta committed
367
368
#ifdef DEBUG
void thanks_for_all_the_fish(void);
369
370
#endif

371
/* All functions in help.c. */
372
373
#ifndef DISABLE_HELP
void do_help(void (*refresh_func)(void));
374
void help_init(void);
375
void parse_help_input(int *kbinput);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
376
size_t help_line_len(const char *ptr);
377
#endif
378
void do_help_void(void);
379

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

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

499
/* All functions in prompt.c. */
500
501
int do_statusbar_input(bool *ran_func, bool *finished,
	void (*refresh_func)(void));
502
#ifndef DISABLE_MOUSE
503
int do_statusbar_mouse(void);
504
505
#endif
void do_statusbar_output(char *output, size_t output_len, bool
506
	*got_enter, bool allow_cntrls);
507
508
509
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
510
void do_statusbar_right(void);
511
512
513
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
514
#ifndef NANO_TINY
515
516
517
518
519
520
bool do_statusbar_next_word(bool allow_punct);
bool do_statusbar_prev_word(bool allow_punct);
#endif
void do_statusbar_verbatim_input(bool *got_enter);
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
521
void reset_statusbar_cursor(void);
522
void update_statusbar_line(const char *curranswer, size_t index);
523
bool need_statusbar_horizontal_update(size_t pww_save);
524
void total_statusbar_refresh(void (*refresh_func)(void));
525
const sc *get_prompt_string(int *value, bool allow_tabs,
526
527
#ifndef DISABLE_TABCOMP
	bool allow_files,
528
	bool *list,
529
530
#endif
	const char *curranswer,
531
#ifndef DISABLE_HISTORIES
532
533
	filestruct **history_list,
#endif
534
	void (*refresh_func)(void));
535
536
537
538
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
539
	int menu, const char *curranswer,
540
#ifndef DISABLE_HISTORIES
541
542
	filestruct **history_list,
#endif
543
	void (*refresh_func)(void), const char *msg, ...);
544
545
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
546

547
/* Most functions in rcfile.c. */
548
549
550
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
char *parse_next_word(char *ptr);
#endif
551
#ifndef DISABLE_NANORC
552
553
void rcfile_error(const char *msg, ...);
char *parse_argument(char *ptr);
554
#ifndef DISABLE_COLOR
555
char *parse_next_regex(char *ptr);
556
bool nregcomp(const char *regex, int eflags);
557
void parse_syntax(char *ptr);
558
void parse_include(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
559
short color_to_short(const char *colorname, bool *bright);
560
void parse_colors(char *ptr, bool icase);
561
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
562
void reset_multis(filestruct *fileptr, bool force);
563
void alloc_multidata_if_needed(filestruct *fileptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
564
#endif
565
void parse_rcfile(FILE *rcstream
566
#ifndef DISABLE_COLOR
567
568
569
	, bool syntax_only
#endif
	);
570
void do_rcfile(void);
571
#endif /* !DISABLE_NANORC */
572

573
/* All functions in search.c. */
574
#ifdef HAVE_REGEX_H
575
bool regexp_init(const char *regexp);
576
577
578
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
579
void search_replace_abort(void);
580
void search_init_globals(void);
581
int search_init(bool replacing, bool use_answer);
582
583
584
585
586
587
bool findnextstr(
#ifndef DISABLE_SPELLER
	bool whole_word,
#endif
	bool no_sameline, const filestruct *begin, size_t begin_x, const
	char *needle, size_t *needle_len);
588
void findnextstr_wrap_reset(void);
589
void do_search(void);
590
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
591
void do_research(void);
592
#endif
593
#ifdef HAVE_REGEX_H
594
int replace_regexp(char *string, bool create);
595
#endif
596
char *replace_line(const char *needle);
597
598
599
600
601
602
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
	bool whole_word,
#endif
	bool *canceled, const filestruct *real_current, size_t
	*real_current_x, const char *needle);
603
void do_replace(void);
604
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
605
	bool interactive, bool save_pos, bool allow_update);
606
void do_gotolinecolumn_void(void);
607
#ifndef DISABLE_SPELLER
608
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
609
	pos_pww);
Chris Allegretta's avatar
Chris Allegretta committed
610
#endif
611
void goto_line_posx(ssize_t line, size_t pos_x);
612
#ifndef NANO_TINY
613
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
614
void do_find_bracket(void);
615
616
617
#ifndef DISABLE_TABCOMP
char *get_history_completion(filestruct **h, const char *s, size_t len);
#endif
618
#endif
619
620
#ifndef DISABLE_HISTORIES
bool history_has_changed(void);
621
void history_init(void);
622
void history_reset(const filestruct *h);
623
624
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
625
void update_history(filestruct **h, const char *s);
626
627
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
628
629
void get_history_older_void(void);
void get_history_newer_void(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
630
#endif
Chris Allegretta's avatar
Chris Allegretta committed
631

632
/* All functions in text.c. */
633
#ifndef NANO_TINY
634
635
636
637
638
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
void do_tab(void);
639
#ifndef NANO_TINY
640
641
642
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
643
644
void do_undo(void);
void do_redo(void);
645
#endif
646
void do_enter(bool undoing);
647
void do_enter_void(void);
648
#ifndef NANO_TINY
649
RETSIGTYPE cancel_command(int signal);
650
bool execute_command(const char *command);
651
#endif
652
653
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
654
bool do_wrap(filestruct *line);
655
#endif
656
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
657
658
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
659
	, bool newln
660
661
#endif
	);
662
#endif
663
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
664
665
666
667
668
669
670
671
672
673
674
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);
675
void backup_lines(filestruct *first_line, size_t par_len);
676
bool find_paragraph(size_t *const quote, size_t *const par);
677
678
679
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
680
#endif
681
682
683
684
685
686
#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
687
688
689
#ifndef DISABLE_COLOR
void do_linter(void);
#endif
690
#ifndef NANO_TINY
691
void do_wordlinechar_count(void);
692
#endif
693
void do_verbatim_input(void);
694

695
/* All functions in utils.c. */
696
int digits(size_t n);
697
void get_homedir(void);
698
bool parse_num(const char *str, ssize_t *val);
699
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
700
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
701
702
703
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
704
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
705
706
707
708
709
710
#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
711
#endif
712
#ifdef HAVE_REGEX_H
713
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
714
const char *fixbounds(const char *r);
715
#endif
716
#ifndef DISABLE_SPELLER
717
bool is_whole_word(size_t pos, const char *buf, const char *word);
718
#endif
719
const char *strstrwrapper(const char *haystack, const char *needle,
720
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
721
722
723
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
724
char *mallocstrncpy(char *dest, const char *src, size_t n);
725
char *mallocstrcpy(char *dest, const char *src);
726
char *mallocstrassn(char *dest, char *src);
727
size_t get_page_start(size_t column);
728
729
730
731
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
732
void new_magicline(void);
733
#ifndef NANO_TINY
734
void remove_magicline(void);
735
void mark_order(const filestruct **top, size_t *top_x, const filestruct
736
	**bot, size_t *bot_x, bool *right_side_up);
737
738
void add_undo(undo_type current_action);
void update_undo(undo_type action);
739
#endif
740
size_t get_totsize(const filestruct *begin, const filestruct *end);
741
filestruct *fsfromline(ssize_t lineno);
742
743
744
745
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
746

747
/* All functions in winio.c. */
748
749
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
750
void unget_input(int *input, size_t input_len);
751
void unget_kbinput(int kbinput, bool metakey, bool funckey);
752
int *get_input(WINDOW *win, size_t input_len);
753
754
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
755
int get_escape_seq_kbinput(const int *seq, size_t seq_len);
756
int get_escape_seq_abcd(int kbinput);
757
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
758
int get_byte_kbinput(int kbinput);
759
#ifdef ENABLE_UTF8
760
long add_unicode_digit(int kbinput, long factor, long *uni);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
761
long get_unicode_kbinput(int kbinput);
762
#endif
763
int get_control_kbinput(int kbinput);
764
void unparse_kbinput(char *output, size_t output_len);
765
766
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
767
#ifndef DISABLE_MOUSE
768
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
769
#endif
770
const sc *get_shortcut(int *kbinput);
771
void blank_line(WINDOW *win, int y, int x, int n);
772
void blank_titlebar(void);
773
void blank_topbar(void);
774
775
void blank_edit(void);
void blank_statusbar(void);
776
void blank_bottombars(void);
777
void check_statusblank(void);
778
779
char *display_string(const char *buf, size_t start_col, size_t len, bool
	dollars);
780
void titlebar(const char *path);
781
782
void set_modified(void);
void statusbar(const char *msg, ...);
783
void bottombars(int menu);
784
void onekey(const char *keystroke, const char *desc, size_t len);
785
void reset_cursor(void);
786
void edit_draw(filestruct *fileptr, const char *converted, int
787
	line, size_t start);
788
int update_line(filestruct *fileptr, size_t index);
789
790
bool need_horizontal_update(size_t pww_save);
bool need_vertical_update(size_t pww_save);
791
void edit_scroll(scroll_dir direction, ssize_t nlines);
792
void edit_redraw(filestruct *old_current, size_t pww_save);
Chris Allegretta's avatar
Chris Allegretta committed
793
void edit_refresh(void);
794
void edit_update(update_type location);
795
void total_redraw(void);
796
void total_refresh(void);
797
void display_main_list(void);
798
void do_cursorpos(bool constant);
799
void do_cursorpos_void(void);
800
void do_replace_highlight(bool highlight, const char *word);
801
802
void xon_complaint(void);
void xoff_complaint(void);
803
void do_suspend_void(void);
804
805
void enable_nodelay(void);
void disable_nodelay(void);
806
#ifndef DISABLE_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
807
void do_credits(void);
808
#endif
809

810
/* May as well throw these here, since they are just placeholders. */
811
void do_cancel(void);
812
813
void do_page_up(void);
void do_page_down(void);
814
815
816
817
818
819
820
821
822
823
824
825
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);
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
826
void flip_replace_void(void);
827
void flip_execute_void(void);
828

829
#endif /* !PROTO_H */