proto.h 25 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
6
 *   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,  *
 *   2008, 2009 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
extern bool use_undo;
34
35
#endif

36
#ifndef DISABLE_WRAPJUSTIFY
37
extern ssize_t fill;
38
extern ssize_t wrap_at;
39
#endif
40
41
42
43

extern char *last_search;
extern char *last_replace;

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

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

59
60
61
62
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

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

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

extern ssize_t tabsize;

88
#ifndef NANO_TINY
89
extern char *backup_dir;
90
91
extern const char *locking_prefix;
extern const char *locking_suffix;
92
#endif
93
94
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
95
extern char *full_operating_dir;
96
#endif
97

98
#ifndef DISABLE_SPELLER
99
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
100
101
#endif

102
103
extern sc *sclist;
extern subnfunc *allfuncs;
104
extern subnfunc *uncutfunc;
105
#ifndef DISABLE_COLOR
106
107
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
108
#endif
109

110
extern bool edit_refresh_needed;
111
extern const shortcut *currshortcut;
112
extern int currmenu;
113

114
#ifndef NANO_TINY
115
116
117
118
119
120
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
121
extern poshiststruct *poshistory;
122
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
123
124
#endif

125
126
127
128
129
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

130
extern int reverse_attr;
131

132
133
extern char *homedir;

134
/* All functions in browser.c. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
135
#ifndef DISABLE_BROWSER
136
char *do_browser(char *path, DIR *dir);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
137
char *do_browse_from(const char *inpath);
138
void browser_init(const char *path, DIR *dir);
139
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
140
void browser_refresh(void);
141
bool browser_select_filename(const char *needle);
142
143
144
145
146
147
148
149
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);
150
char *striponedir(const char *path);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
151
152
#endif

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

235
/* All functions in color.c. */
236
#ifndef DISABLE_COLOR
237
void set_colorpairs(void);
238
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
239
void color_update(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
240
#endif
241

242
/* All functions in cut.c. */
243
void cutbuffer_reset(void);
244
void cut_line(void);
245
#ifndef NANO_TINY
246
247
void cut_marked(void);
void cut_to_eol(void);
248
void cut_to_eof(void);
249
#endif
250
void do_cut_text(
251
#ifndef NANO_TINY
252
	bool copy_text, bool cut_till_end, bool undoing
253
254
255
256
257
258
259
#else
	void
#endif
	);
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
260
261
void do_cut_till_end(void);
#endif
262
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
263

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

344
/* All functions in global.c. */
345
size_t length_of_list(int menu);
346
#ifndef NANO_TINY
347
348
349
350
351
void toggle_init_one(int val
#ifndef DISABLE_HELP
	, const char *desc, bool blank_after
#endif
	, long flag);
352
353
void toggle_init(void);
#endif
354
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc
355
#ifndef DISABLE_HELP
356
	, const char *help, bool blank_after
357
#endif
358
359
	, int metaval, int funcval, int miscval, bool view, void
	(*func)(void));
360
void shortcut_init(void);
Chris Allegretta's avatar
Chris Allegretta committed
361
362
#ifdef DEBUG
void thanks_for_all_the_fish(void);
363
364
#endif

365
/* All functions in help.c. */
366
367
368
void do_help_void(void);
#ifndef DISABLE_HELP
void do_help(void (*refresh_func)(void));
369
void help_init(void);
370
void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
371
size_t help_line_len(const char *ptr);
372
373
#endif

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

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

494
/* All functions in prompt.c. */
495
int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
496
497
	bool *ran_func, bool *finished, bool allow_funcs, void
	(*refresh_func)(void));
498
#ifndef DISABLE_MOUSE
499
int do_statusbar_mouse(void);
500
501
#endif
void do_statusbar_output(char *output, size_t output_len, bool
502
	*got_enter, bool allow_cntrls);
503
504
505
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
506
void do_statusbar_right(void);
507
508
509
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
510
#ifndef NANO_TINY
511
512
513
514
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);
515
#ifndef NANO_TINY
516
517
bool find_statusbar_bracket_match(bool reverse, const char
	*bracket_set);
518
519
void do_statusbar_find_bracket(void);
#endif
520
521
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
522
void reset_statusbar_cursor(void);
523
void update_statusbar_line(const char *curranswer, size_t index);
524
bool need_statusbar_horizontal_update(size_t pww_save);
525
void total_statusbar_refresh(void (*refresh_func)(void));
526
const sc *get_prompt_string(int *value, bool allow_tabs,
527
528
529
530
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
	const char *curranswer,
531
	bool *meta_key, bool *func_key,
532
#ifndef NANO_TINY
533
534
	filestruct **history_list,
#endif
535
	void (*refresh_func)(void), int menu
536
537
538
539
#ifndef DISABLE_TABCOMP
	, bool *list
#endif
	);
540
541
542
543
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
544
	int menu, const char *curranswer,
545
	bool *meta_key, bool *func_key,
546
#ifndef NANO_TINY
547
548
	filestruct **history_list,
#endif
549
	void (*refresh_func)(void), const char *msg, ...);
550
551
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
552

553
/* All functions in rcfile.c. */
554
#ifndef DISABLE_NANORC
555
556
557
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
558
#ifndef DISABLE_COLOR
559
char *parse_next_regex(char *ptr);
560
bool nregcomp(const char *regex, int eflags);
561
void parse_syntax(char *ptr);
562
void parse_magic_syntax(char *ptr);
563
void parse_include(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
564
short color_to_short(const char *colorname, bool *bright);
565
void parse_colors(char *ptr, bool icase);
566
void reset_multis(filestruct *fileptr, bool force);
567
void alloc_multidata_if_needed(filestruct *fileptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
568
#endif
569
void parse_rcfile(FILE *rcstream
570
#ifndef DISABLE_COLOR
571
572
573
	, bool syntax_only
#endif
	);
574
void do_rcfile(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
575
#endif
576

577
/* All functions in search.c. */
578
#ifdef HAVE_REGEX_H
579
bool regexp_init(const char *regexp);
580
581
582
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
583
void search_replace_abort(void);
584
void search_init_globals(void);
585
int search_init(bool replacing, bool use_answer);
586
587
588
589
590
591
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);
592
void findnextstr_wrap_reset(void);
593
void do_search(void);
594
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
595
void do_research(void);
596
#endif
597
#ifdef HAVE_REGEX_H
598
int replace_regexp(char *string, bool create);
599
#endif
600
char *replace_line(const char *needle);
601
602
603
604
605
606
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);
607
void do_replace(void);
608
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
609
	bool interactive, bool save_pos, bool allow_update);
610
void do_gotolinecolumn_void(void);
611
#ifndef DISABLE_SPELLER
612
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
613
	pos_pww);
Chris Allegretta's avatar
Chris Allegretta committed
614
#endif
615
#ifndef NANO_TINY
616
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
617
void do_find_bracket(void);
618
#ifndef DISABLE_NANORC
619
bool history_has_changed(void);
620
#endif
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);
630
#ifndef DISABLE_TABCOMP
631
char *get_history_completion(filestruct **h, const char *s, size_t len);
632
#endif
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
633
#endif
Chris Allegretta's avatar
Chris Allegretta committed
634

635
/* All functions in text.c. */
636
#ifndef NANO_TINY
637
638
639
640
641
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
void do_tab(void);
642
#ifndef NANO_TINY
643
644
645
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
646
647
void do_undo(void);
void do_redo(void);
648
#endif
649
void do_enter(bool undoing);
650
void do_enter_void(void);
651
#ifndef NANO_TINY
652
RETSIGTYPE cancel_command(int signal);
653
bool execute_command(const char *command);
654
#endif
655
656
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
657
bool do_wrap(filestruct *line, bool undoing);
658
#endif
659
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
660
661
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
662
	, bool newln
663
664
#endif
	);
665
#endif
666
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
667
668
669
670
671
672
673
674
675
676
677
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);
678
void backup_lines(filestruct *first_line, size_t par_len);
679
bool find_paragraph(size_t *const quote, size_t *const par);
680
681
682
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
683
#endif
684
685
686
687
688
689
#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
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 meta_key, bool func_key);
752
int *get_input(WINDOW *win, size_t input_len);
753
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
754
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
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 menu, int *kbinput, bool
771
	*meta_key, bool *func_key);
772
const sc *first_sc_for(int menu, void (*func)(void));
773
void blank_line(WINDOW *win, int y, int x, int n);
774
void blank_titlebar(void);
775
void blank_topbar(void);
776
777
void blank_edit(void);
void blank_statusbar(void);
778
void blank_bottombars(void);
779
void check_statusblank(void);
780
781
char *display_string(const char *buf, size_t start_col, size_t len, bool
	dollars);
782
void titlebar(const char *path);
783
784
void set_modified(void);
void statusbar(const char *msg, ...);
785
void bottombars(int menu);
786
void onekey(const char *keystroke, const char *desc, size_t len);
787
void reset_cursor(void);
788
void edit_draw(filestruct *fileptr, const char *converted, int
789
	line, size_t start);
790
int update_line(filestruct *fileptr, size_t index);
791
792
bool need_horizontal_update(size_t pww_save);
bool need_vertical_update(size_t pww_save);
793
void edit_scroll(scroll_dir direction, ssize_t nlines);
794
void edit_redraw(filestruct *old_current, size_t pww_save);
Chris Allegretta's avatar
Chris Allegretta committed
795
void edit_refresh(void);
796
void edit_update(update_type location);
797
void total_redraw(void);
798
void total_refresh(void);
799
void display_main_list(void);
800
void do_cursorpos(bool constant);
801
void do_cursorpos_void(void);
802
void do_replace_highlight(bool highlight, const char *word);
803
const char *flagtostr(int flag);
804
const subnfunc *sctofunc(sc *s);
805
const subnfunc *getfuncfromkey(WINDOW *win);
806
void print_sclist(void);
807
sc *strtosc(char *input);
808
function_type strtokeytype(const char *str);
809
810
811
812
int strtomenu(char *input);
void assign_keyinfo(sc *s);
void xon_complaint(void);
void xoff_complaint(void);
813
int sc_seq_or (void (*func)(void), int defaultval);
814
void do_suspend_void(void);
815

816

817
818
void enable_nodelay(void);
void disable_nodelay(void);
819
820

#ifdef HAVE_REGEX_H
821
extern const char *regexp_msg;
822
823
#endif

824
#ifndef DISABLE_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
825
void do_credits(void);
826
#endif
827

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

847
#endif /* !PROTO_H */