proto.h 24.7 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
extern volatile sig_atomic_t sigwinch_counter;
32
33
#endif

34
35
extern bool meta_key;
extern bool func_key;
36
extern bool focusing;
37

38
39
40
41
42
#ifndef NANO_TINY
extern int controlleft;
extern int controlright;
#endif

43
#ifndef DISABLE_WRAPJUSTIFY
44
extern ssize_t fill;
45
extern ssize_t wrap_at;
46
#endif
47
48
49
50

extern char *last_search;
extern char *last_replace;

51
extern unsigned flags[4];
52
53
54
55
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
56
extern int maxrows;
57
58

extern filestruct *cutbuffer;
59
extern filestruct *cutbottom;
60
61
62
63
64
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
extern partition *filepart;
extern openfilestruct *openfile;
Chris Allegretta's avatar
Chris Allegretta committed
65

66
67
68
69
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

70
#ifndef NANO_TINY
71
extern char *whitespace;
72
extern int whitespace_len[2];
73
74
#endif

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

92
extern bool nodelay_mode;
93
94
95
96
extern char *answer;

extern ssize_t tabsize;

97
#ifndef NANO_TINY
98
extern char *backup_dir;
99
100
extern const char *locking_prefix;
extern const char *locking_suffix;
101
#endif
102
103
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
104
extern char *full_operating_dir;
105
#endif
106

107
#ifndef DISABLE_SPELLER
108
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
109
110
#endif

111
#ifndef DISABLE_COLOR
112
113
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
114
#endif
115

116
extern bool edit_refresh_needed;
117

118
extern int currmenu;
119
120
121
122
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
123

124
#ifndef DISABLE_HISTORIES
125
126
127
128
129
130
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
131
extern poshiststruct *poshistory;
132
133
#endif

134
135
136
137
138
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

139
extern int hilite_attribute;
140
141
142
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
143
extern color_pair interface_color_pair[NUMBER_OF_ELEMENTS];
144

145
146
extern char *homedir;

147
148
typedef void (*functionptrtype)(void);

149
/* All functions in browser.c. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
150
#ifndef DISABLE_BROWSER
151
char *do_browser(char *path, DIR *dir);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
152
char *do_browse_from(const char *inpath);
153
void browser_init(const char *path, DIR *dir);
154
functionptrtype parse_browser_input(int *kbinput);
155
void browser_refresh(void);
156
void browser_select_dirname(const char *needle);
157
int filesearch_init(void);
158
void findnextfile(const char *needle);
159
160
161
162
163
void filesearch_abort(void);
void do_filesearch(void);
void do_fileresearch(void);
void do_first_file(void);
void do_last_file(void);
164
char *striponedir(const char *path);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
165
166
#endif

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

250
/* All functions in color.c. */
251
#ifndef DISABLE_COLOR
252
void set_colorpairs(void);
253
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
254
void color_update(void);
255
256
257
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
258
#endif
259

260
/* All functions in cut.c. */
261
void cutbuffer_reset(void);
262
bool keeping_cutbuffer(void);
263
void cut_line(void);
264
#ifndef NANO_TINY
265
266
void cut_marked(void);
void cut_to_eol(void);
267
void cut_to_eof(void);
268
#endif
269
void do_cut_text(
270
#ifndef NANO_TINY
271
	bool copy_text, bool cut_till_eof
272
273
274
275
276
277
278
#else
	void
#endif
	);
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
279
void do_cut_till_eof(void);
280
#endif
281
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
282

283
/* All functions in files.c. */
284
void make_new_buffer(void);
285
void initialize_buffer_text(void);
286
bool open_buffer(const char *filename, bool undoable);
287
288
289
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
290
void display_buffer(void);
291
#ifndef DISABLE_MULTIBUFFER
292
void switch_to_prevnext_buffer(bool next, bool quiet);
293
294
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
295
bool close_buffer(bool quiet);
296
#endif
297
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode);
298
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
299
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
300
char *get_next_filename(const char *name, const char *suffix);
301
void do_insertfile(
302
#ifndef NANO_TINY
303
304
305
306
307
	bool execute
#else
	void
#endif
	);
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
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
323
	append, bool nonamechange);
324
#ifndef NANO_TINY
325
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
326
	append_type append);
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, bool
345
	*lastwastab, void (*refresh_func)(void), bool *list);
Chris Allegretta's avatar
Chris Allegretta committed
346
#endif
347
const char *tail(const char *foo);
348
#ifndef DISABLE_HISTORIES
349
char *histfilename(void);
350
void load_history(void);
351
bool writehist(FILE *hist, filestruct *histhead);
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
int check_poshistory(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
363
364
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);
365
functionptrtype func_from_key(int *kbinput);
366
367
void assign_keyinfo(sc *s);
void print_sclist(void);
368
void shortcut_init(void);
369
#ifndef DISABLE_COLOR
370
void set_lint_or_format_shortcuts(void);
371
372
373
374
375
376
void set_spell_shortcuts(void);
#endif
const subnfunc *sctofunc(sc *s);
const char *flagtostr(int flag);
sc *strtosc(char *input);
int strtomenu(char *input);
Chris Allegretta's avatar
Chris Allegretta committed
377
378
#ifdef DEBUG
void thanks_for_all_the_fish(void);
379
380
#endif

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

390
/* All functions in move.c. */
391
392
393
394
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
395
396
397
398
399
400
#ifndef DISABLE_JUSTIFY
void do_para_begin(bool allow_update);
void do_para_begin_void(void);
void do_para_end(bool allow_update);
void do_para_end_void(void);
#endif
401
#ifndef NANO_TINY
402
403
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
404
void do_prev_word(bool allow_punct, bool allow_update);
405
406
void do_prev_word_void(void);
#endif
407
408
void do_home(void);
void do_end(void);
409
410
411
412
413
414
415
416
void do_up(
#ifndef NANO_TINY
	bool scroll_only
#else
	void
#endif
	);
void do_up_void(void);
417
#ifndef NANO_TINY
418
419
void do_scroll_up(void);
#endif
420
421
422
423
424
425
426
427
void do_down(
#ifndef NANO_TINY
	bool scroll_only
#else
	void
#endif
	);
void do_down_void(void);
428
#ifndef NANO_TINY
429
430
void do_scroll_down(void);
#endif
431
432
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
433

434
/* All functions in nano.c. */
435
436
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
437
void splice_node(filestruct *afterthis, filestruct *newnode);
438
void unlink_node(filestruct *fileptr);
439
440
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
Chris Allegretta's avatar
Chris Allegretta committed
441
void free_filestruct(filestruct *src);
442
void renumber(filestruct *fileptr);
443
444
partition *partition_filestruct(filestruct *top, size_t top_x,
	filestruct *bot, size_t bot_x);
445
void unpartition_filestruct(partition **p);
446
447
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
	filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
448
void copy_from_filestruct(filestruct *somebuffer);
449
450
451
452
453
454
455
456
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
457
void print_view_warning(void);
458
459
460
461
void show_restricted_warning(void);
#ifdef DISABLE_HELP
void say_there_is_no_help(void);
#endif
462
463
void finish(void);
void die(const char *msg, ...);
464
465
466
467
468
void die_save_file(const char *die_filename
#ifndef NANO_TINY
	, struct stat *die_stat
#endif
	);
469
470
void window_init(void);
#ifndef DISABLE_MOUSE
471
472
void disable_mouse_support(void);
void enable_mouse_support(void);
473
474
void mouse_init(void);
#endif
475
void print_opt_full(const char *shortflag
476
477
478
479
#ifdef HAVE_GETOPT_LONG
	, const char *longflag
#endif
	, const char *desc);
480
481
void usage(void);
void version(void);
482
int more_space(void);
483
int no_help(void);
484
void no_current_file_name_warning(void);
485
void do_exit(void);
486
void close_and_go(void);
Chris Allegretta's avatar
Chris Allegretta committed
487
void signal_init(void);
488
489
490
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
491
#ifndef NANO_TINY
492
RETSIGTYPE handle_sigwinch(int signal);
493
void regenerate_screen(void);
494
void allow_pending_sigwinch(bool allow);
495
void do_toggle(int flag);
496
#endif
497
void do_toggle_void(void);
498
void disable_extended_io(void);
499
500
501
#ifdef USE_SLANG
void disable_signals(void);
#endif
502
#ifndef NANO_TINY
503
504
505
506
void enable_signals(void);
#endif
void disable_flow_control(void);
void enable_flow_control(void);
507
void terminal_init(void);
508
int do_input(bool allow_funcs);
509
#ifndef DISABLE_MOUSE
510
int do_mouse(void);
511
#endif
512
void do_output(char *output, size_t output_len, bool allow_cntrls);
513

514
/* All functions in prompt.c. */
515
516
int do_statusbar_input(bool *ran_func, bool *finished,
	void (*refresh_func)(void));
517
#ifndef DISABLE_MOUSE
518
int do_statusbar_mouse(void);
519
520
#endif
void do_statusbar_output(char *output, size_t output_len, bool
521
	*got_enter, bool allow_cntrls);
522
523
524
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
525
void do_statusbar_right(void);
526
527
528
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
529
#ifndef NANO_TINY
530
531
532
533
534
535
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);
536
void reset_statusbar_cursor(void);
537
void update_statusbar_line(const char *curranswer, size_t index);
538
bool need_statusbar_update(size_t pww_save);
539
void total_statusbar_refresh(void (*refresh_func)(void));
540
functionptrtype get_prompt_string(int *value, bool allow_tabs,
541
542
#ifndef DISABLE_TABCOMP
	bool allow_files,
543
	bool *list,
544
545
#endif
	const char *curranswer,
546
#ifndef DISABLE_HISTORIES
547
548
	filestruct **history_list,
#endif
549
	void (*refresh_func)(void));
550
551
552
553
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
554
	int menu, const char *curranswer,
555
#ifndef DISABLE_HISTORIES
556
557
	filestruct **history_list,
#endif
558
	void (*refresh_func)(void), const char *msg, ...);
559
560
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
561

562
/* Most functions in rcfile.c. */
563
564
565
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
char *parse_next_word(char *ptr);
#endif
566
#ifndef DISABLE_NANORC
567
568
void rcfile_error(const char *msg, ...);
char *parse_argument(char *ptr);
569
#ifndef DISABLE_COLOR
570
char *parse_next_regex(char *ptr);
571
bool nregcomp(const char *regex, int eflags);
572
void parse_syntax(char *ptr);
573
void parse_include(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
574
short color_to_short(const char *colorname, bool *bright);
575
void parse_colors(char *ptr, bool icase);
576
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
577
#endif
578
void parse_rcfile(FILE *rcstream
579
#ifndef DISABLE_COLOR
580
581
582
	, bool syntax_only
#endif
	);
583
void do_rcfile(void);
584
#endif /* !DISABLE_NANORC */
585

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

648
/* All functions in text.c. */
649
#ifndef NANO_TINY
650
651
652
653
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
654
655
656
657
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
658
void do_tab(void);
659
#ifndef NANO_TINY
660
661
662
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
663
664
void do_undo(void);
void do_redo(void);
665
#endif
666
void do_enter(void);
667
#ifndef NANO_TINY
668
RETSIGTYPE cancel_command(int signal);
669
bool execute_command(const char *command);
670
#endif
671
672
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
673
bool do_wrap(filestruct *line);
674
#endif
675
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
676
677
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
678
	, bool newln
679
680
#endif
	);
681
#endif
682
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
683
684
685
686
687
688
689
690
691
692
693
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);
694
void backup_lines(filestruct *first_line, size_t par_len);
695
bool find_paragraph(size_t *const quote, size_t *const par);
696
697
698
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
699
#endif
700
701
702
703
704
705
#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
706
707
#ifndef DISABLE_COLOR
void do_linter(void);
708
void do_formatter(void);
709
#endif
710
#ifndef NANO_TINY
711
void do_wordlinechar_count(void);
712
#endif
713
void do_verbatim_input(void);
714

715
/* All functions in utils.c. */
716
void get_homedir(void);
717
bool parse_num(const char *str, ssize_t *val);
718
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
719
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
720
721
722
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
723
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
724
725
726
727
728
729
#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
730
#endif
731
#ifdef HAVE_REGEX_H
732
const char *fixbounds(const char *r);
733
#endif
734
#ifndef DISABLE_SPELLER
735
bool is_whole_word(size_t pos, const char *buf, const char *word);
736
#endif
737
const char *strstrwrapper(const char *haystack, const char *needle,
738
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
739
740
741
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
742
char *mallocstrncpy(char *dest, const char *src, size_t n);
743
char *mallocstrcpy(char *dest, const char *src);
744
char *mallocstrassn(char *dest, char *src);
745
size_t get_page_start(size_t column);
746
747
748
749
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
750
void new_magicline(void);
751
#ifndef NANO_TINY
752
void remove_magicline(void);
753
void mark_order(const filestruct **top, size_t *top_x, const filestruct
754
	**bot, size_t *bot_x, bool *right_side_up);
755
void discard_until(undo *thisone);
756
void add_undo(undo_type action);
757
void update_undo(undo_type action);
758
#endif
759
size_t get_totsize(const filestruct *begin, const filestruct *end);
760
filestruct *fsfromline(ssize_t lineno);
761
762
763
764
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
765

766
/* Most functions in winio.c. */
767
768
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
769
void unget_input(int *input, size_t input_len);
770
void unget_kbinput(int kbinput, bool metakey, bool funckey);
771
int *get_input(WINDOW *win, size_t input_len);
772
773
int get_kbinput(WINDOW *win);
int parse_kbinput(WINDOW *win);
774
775
int arrow_from_abcd(int kbinput);
int parse_escape_sequence(WINDOW *win, int kbinput);
776
int get_byte_kbinput(int kbinput);
777
#ifdef ENABLE_UTF8
778
long add_unicode_digit(int kbinput, long factor, long *uni);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
779
long get_unicode_kbinput(int kbinput);
780
#endif
781
int get_control_kbinput(int kbinput);
782
void unparse_kbinput(char *output, size_t output_len);
783
784
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
785
#ifndef DISABLE_MOUSE
786
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
787
#endif
788
const sc *get_shortcut(int *kbinput);
789
void blank_line(WINDOW *win, int y, int x, int n);
790
void blank_titlebar(void);
791
void blank_topbar(void);
792
793
void blank_edit(void);
void blank_statusbar(void);
794
void blank_bottombars(void);
795
void check_statusblank(void);
796
797
char *display_string(const char *buf, size_t start_col, size_t len, bool
	dollars);
798
void titlebar(const char *path);
799
extern void set_modified(void);
800
void statusbar(const char *msg, ...);
801
void bottombars(int menu);
802
void onekey(const char *keystroke, const char *desc, size_t len);
803
void reset_cursor(void);
804
void edit_draw(filestruct *fileptr, const char *converted, int
805
	line, size_t start);
806
int update_line(filestruct *fileptr, size_t index);
807
bool need_screen_update(size_t pww_save);
808
void edit_scroll(scroll_dir direction, ssize_t nlines);
809
void edit_redraw(filestruct *old_current, size_t pww_save);
Chris Allegretta's avatar
Chris Allegretta committed
810
void edit_refresh(void);
811
void edit_update(update_type location);
812
void total_redraw(void);
813
void total_refresh(void);
814
void display_main_list(void);
815
void do_cursorpos(bool constant);
816
void do_cursorpos_void(void);
817
void do_replace_highlight(bool highlight, const char *word);
818
819
void xon_complaint(void);
void xoff_complaint(void);
820
void do_suspend_void(void);
821
822
void enable_nodelay(void);
void disable_nodelay(void);
823
#ifndef DISABLE_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
824
void do_credits(void);
825
#endif
826

827
/* May as well throw these here, since they are just placeholders. */
828
void do_cancel(void);
829
830
void do_page_up(void);
void do_page_down(void);
831
832
833
834
835
836
837
838
839
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);
840
void discard_buffer(void);
841
842
843
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
844
void flip_replace_void(void);
845
void flip_execute_void(void);
846

847
#endif /* !PROTO_H */