proto.h 25.1 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(ENABLE_NANORC)
64
extern char *whitespace;
65
extern int whitespace_len[2];
66
extern undo_type last_action;
67
68
#endif

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

extern ssize_t tabsize;

86
#ifndef NANO_TINY
87
88
extern char *backup_dir;
#endif
89
90
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
91
extern char *full_operating_dir;
92
#endif
93

94
#ifndef DISABLE_SPELLER
95
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
96
97
#endif

98
99
extern sc *sclist;
extern subnfunc *allfuncs;
100
#ifdef ENABLE_COLOR
101
102
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
103
#endif
104

105
extern bool edit_refresh_needed;
106
extern const shortcut *currshortcut;
107
extern int currmenu;
108

109
#ifndef NANO_TINY
110
111
112
113
114
115
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
116
117
#endif

118
119
120
121
122
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

123
extern int reverse_attr;
124

125
126
extern char *homedir;

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

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

228
/* All functions in color.c. */
Chris Allegretta's avatar
Chris Allegretta committed
229
#ifdef ENABLE_COLOR
230
void set_colorpairs(void);
231
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
232
void color_update(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
233
#endif
234

235
/* All functions in cut.c. */
236
void cutbuffer_reset(void);
237
void cut_line(void);
238
#ifndef NANO_TINY
239
240
void cut_marked(void);
void cut_to_eol(void);
241
void cut_to_eof(void);
242
#endif
243
void do_cut_text(
244
#ifndef NANO_TINY
245
	bool copy_text, bool cut_till_end, bool undoing
246
247
248
249
250
251
252
#else
	void
#endif
	);
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
253
254
void do_cut_till_end(void);
#endif
255
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
256

257
/* All functions in files.c. */
258
void make_new_buffer(void);
259
void initialize_buffer(void);
260
void initialize_buffer_text(void);
261
void open_buffer(const char *filename, bool undoable);
262
263
264
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
265
void display_buffer(void);
266
267
268
269
270
#ifdef ENABLE_MULTIBUFFER
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);
271
#endif
272
filestruct *read_line(char *buf, filestruct *prevnode, bool
273
	*first_line_ins, size_t buf_len);
274
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
275
int open_file(const char *filename, bool newfie, FILE **f);
276
char *get_next_filename(const char *name, const char *suffix);
277
void do_insertfile(
278
#ifndef NANO_TINY
279
280
281
282
283
	bool execute
#else
	void
#endif
	);
284
void do_insertfile_void(void);
285
286
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
287
char *safe_tempfile(FILE **f);
288
#ifndef DISABLE_OPERATINGDIR
289
void init_operating_dir(void);
290
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
291
#endif
292
#ifndef NANO_TINY
293
294
void init_backup_dir(void);
#endif
295
int copy_file(FILE *inn, FILE *out);
296
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
297
	append, bool nonamechange);
298
#ifndef NANO_TINY
299
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
300
	append_type append);
301
#endif
302
bool do_writeout(bool exiting);
303
void do_writeout_void(void);
304
char *real_dir_from_tilde(const char *buf);
305
306
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
307
void free_chararray(char **array, size_t len);
308
#endif
Chris Allegretta's avatar
Chris Allegretta committed
309
#ifndef DISABLE_TABCOMP
310
bool is_dir(const char *buf);
311
char **username_tab_completion(const char *buf, size_t *num_matches,
312
	size_t buf_len);
313
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
314
	*num_matches, size_t buf_len);
315
char *input_tab(char *buf, bool allow_files, size_t *place, bool
316
	*lastwastab, void (*refresh_func)(void), bool *list);
Chris Allegretta's avatar
Chris Allegretta committed
317
#endif
318
const char *tail(const char *foo);
319
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
320
char *histfilename(void);
321
void load_history(void);
322
bool writehist(FILE *hist, filestruct *histhead);
323
324
void save_history(void);
#endif
325

326
/* All functions in global.c. */
327
size_t length_of_list(int menu);
328
#ifndef NANO_TINY
329
330
331
332
333
void toggle_init_one(int val
#ifndef DISABLE_HELP
	, const char *desc, bool blank_after
#endif
	, long flag);
334
335
void toggle_init(void);
#endif
336
void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc
337
#ifndef DISABLE_HELP
338
	, const char *help, bool blank_after
339
#endif
340
341
	, int metaval, int funcval, int miscval, bool view, void
	(*func)(void));
342
void shortcut_init(bool unjustify);
343
void free_shortcutage(shortcut **shortcutage);
Chris Allegretta's avatar
Chris Allegretta committed
344
345
#ifdef DEBUG
void thanks_for_all_the_fish(void);
346
347
#endif

348
/* All functions in help.c. */
349
350
351
#ifndef DISABLE_BROWSER
void do_browser_help(void);
#endif
352
353
354
void do_help_void(void);
#ifndef DISABLE_HELP
void do_help(void (*refresh_func)(void));
355
void help_init(void);
356
void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
357
size_t help_line_len(const char *ptr);
358
359
#endif

360
/* All functions in move.c. */
361
362
363
364
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
365
366
367
368
369
370
#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
371
#ifndef NANO_TINY
372
373
374
375
376
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
377
378
void do_home(void);
void do_end(void);
379
380
381
382
383
384
385
386
void do_up(
#ifndef NANO_TINY
	bool scroll_only
#else
	void
#endif
	);
void do_up_void(void);
387
#ifndef NANO_TINY
388
389
void do_scroll_up(void);
#endif
390
391
392
393
394
395
396
397
void do_down(
#ifndef NANO_TINY
	bool scroll_only
#else
	void
#endif
	);
void do_down_void(void);
398
#ifndef NANO_TINY
399
400
void do_scroll_down(void);
#endif
401
402
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
403

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

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

541
/* All functions in rcfile.c. */
542
#ifdef ENABLE_NANORC
543
544
545
546
547
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
char *parse_next_regex(char *ptr);
548
bool nregcomp(const char *regex, int eflags);
549
void parse_syntax(char *ptr);
550
void parse_magic_syntax(char *ptr);
551
void parse_include(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
552
short color_to_short(const char *colorname, bool *bright);
553
void parse_colors(char *ptr, bool icase);
554
void reset_multis(filestruct *fileptr, bool force);
555
void alloc_multidata_if_needed(filestruct *fileptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
556
#endif
557
558
559
560
561
void parse_rcfile(FILE *rcstream
#ifdef ENABLE_COLOR
	, bool syntax_only
#endif
	);
562
void do_rcfile(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
563
#endif
564

565
/* All functions in search.c. */
566
#ifdef HAVE_REGEX_H
567
bool regexp_init(const char *regexp);
568
569
570
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
571
void search_replace_abort(void);
572
void search_init_globals(void);
573
int search_init(bool replacing, bool use_answer);
574
575
576
577
578
579
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);
580
void findnextstr_wrap_reset(void);
581
void do_search(void);
582
#ifndef NANO_TINY
583
void do_research(void);
584
#endif
585
#ifdef HAVE_REGEX_H
586
int replace_regexp(char *string, bool create);
587
#endif
588
char *replace_line(const char *needle);
589
590
591
592
593
594
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);
595
void do_replace(void);
596
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
597
	bool interactive, bool save_pos, bool allow_update);
598
void do_gotolinecolumn_void(void);
599
#ifndef DISABLE_SPELLER
600
void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
601
	pos_pww);
Chris Allegretta's avatar
Chris Allegretta committed
602
#endif
603
#ifndef NANO_TINY
604
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
605
void do_find_bracket(void);
606
#ifdef ENABLE_NANORC
607
bool history_has_changed(void);
608
#endif
609
void history_init(void);
610
void history_reset(const filestruct *h);
611
612
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
613
void update_history(filestruct **h, const char *s);
614
615
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
616
617
void get_history_older_void(void);
void get_history_newer_void(void);
618
#ifndef DISABLE_TABCOMP
619
char *get_history_completion(filestruct **h, const char *s, size_t len);
620
#endif
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
621
#endif
Chris Allegretta's avatar
Chris Allegretta committed
622

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

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

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

804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
extern const char *cancel_msg;
#ifndef NANO_TINY
extern const char *case_sens_msg;
extern const char *backwards_msg;
extern const char *prev_history_msg;
extern const char *next_history_msg;
#endif
extern const char *replace_msg;
extern const char *no_replace_msg;
extern const char *go_to_line_msg;
extern const char *whereis_next_msg;
extern const char *first_file_msg;
extern const char *last_file_msg;
extern const char *goto_dir_msg;
extern const char *ext_cmd_msg;
extern const char *to_files_msg;
extern const char *dos_format_msg;
extern const char *mac_format_msg;
extern const char *append_msg;
extern const char *prepend_msg;
extern const char *backup_file_msg;
extern const char *gototext_msg;
extern const char *new_buffer_msg;

828
829
void enable_nodelay(void);
void disable_nodelay(void);
830
831

#ifdef HAVE_REGEX_H
832
extern const char *regexp_msg;
833
834
#endif

Chris Allegretta's avatar
Chris Allegretta committed
835
836
#ifdef NANO_EXTRA
void do_credits(void);
837
#endif
838

839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
/* May as just throw these here since they are just placeholders */
void do_cancel(void);
void case_sens_void(void);
void regexp_void(void);
void gototext_void(void);
void to_files_void(void);
void dos_format_void(void);
void mac_format_void(void);
void append_void(void);
void prepend_void(void);
void backup_file_void(void);
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
void no_replace_void(void);
void ext_cmd_void(void);


857
#endif /* !PROTO_H */