proto.h 23.2 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-2004 Chris Allegretta                             *
6
 *   Copyright (C) 2005-2006 David Lawrence Ramsey                        *
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 2, 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
/* Public external variables.  See global.c for their descriptions. */
30
#ifndef NANO_TINY
31
32
extern sigjmp_buf jump_buf;
extern bool jump_buf_main;
33
34
#endif

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

extern char *last_search;
extern char *last_replace;

43
extern long flags;
44
45
46
47
48
49
50
51
52
53
54
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;

extern filestruct *cutbuffer;
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
extern partition *filepart;
extern openfilestruct *openfile;
Chris Allegretta's avatar
Chris Allegretta committed
55

56
57
58
59
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

60
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
61
extern char *whitespace;
62
extern int whitespace_len[2];
63
64
#endif

65
#ifndef DISABLE_JUSTIFY
66
67
extern char *punct;
extern char *brackets;
Chris Allegretta's avatar
Chris Allegretta committed
68
extern char *quotestr;
69
70
71
72
73
74
75
#ifdef HAVE_REGEX_H
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
#else
extern size_t quotelen;
#endif
76
77
#endif

78
79
80
81
extern char *answer;

extern ssize_t tabsize;

82
#ifndef NANO_TINY
83
84
extern char *backup_dir;
#endif
85
86
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
87
extern char *full_operating_dir;
88
#endif
89

90
#ifndef DISABLE_SPELLER
91
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
92
93
#endif

94
95
96
extern shortcut *main_list;
extern shortcut *whereis_list;
extern shortcut *replace_list;
97
extern shortcut *replace_list_2;
98
99
100
extern shortcut *gotoline_list;
extern shortcut *writefile_list;
extern shortcut *insertfile_list;
101
#ifndef NANO_TINY
Chris Allegretta's avatar
Chris Allegretta committed
102
103
extern shortcut *extcmd_list;
#endif
104
#ifndef DISABLE_HELP
105
extern shortcut *help_list;
106
107
108
109
#endif
#ifndef DISABLE_SPELLER
extern shortcut *spell_list;
#endif
110
#ifndef DISABLE_BROWSER
111
extern shortcut *browser_list;
112
extern shortcut *whereis_file_list;
113
extern shortcut *gotodir_list;
Chris Allegretta's avatar
Chris Allegretta committed
114
#endif
115

116
#ifdef ENABLE_COLOR
117
118
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
119
#endif
120

121
extern const shortcut *currshortcut;
122
#ifndef NANO_TINY
123
extern toggle *toggles;
124
#endif
125

126
#ifndef NANO_TINY
127
128
129
130
131
132
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
133
134
#endif

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

140
extern int reverse_attr;
141

142
143
extern char *homedir;

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
144
145
/* Public functions in browser.c. */
#ifndef DISABLE_BROWSER
146
char *do_browser(char *path, DIR *dir);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
147
char *do_browse_from(const char *inpath);
148
void browser_init(const char *path, DIR *dir);
149
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
150
void browser_refresh(void);
151
bool browser_select_filename(const char *needle);
152
153
154
155
156
157
158
159
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);
160
char *striponedir(const char *path);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
161
162
#endif

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

245
/* Public functions in color.c. */
Chris Allegretta's avatar
Chris Allegretta committed
246
#ifdef ENABLE_COLOR
247
void set_colorpairs(void);
248
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
249
void color_update(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
250
#endif
251

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

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

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

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

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

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

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

548
/* Public functions in rcfile.c. */
549
#ifdef ENABLE_NANORC
550
551
552
553
554
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);
555
bool nregcomp(const char *regex, int eflags);
556
void parse_syntax(char *ptr);
557
void parse_include(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
558
short color_to_short(const char *colorname, bool *bright);
559
void parse_colors(char *ptr, bool icase);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
560
#endif
561
562
563
564
565
void parse_rcfile(FILE *rcstream
#ifdef ENABLE_COLOR
	, bool syntax_only
#endif
	);
566
void do_rcfile(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
567
#endif
568

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

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

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

730
/* Public functions in winio.c. */
731
732
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
733
void unget_input(int *input, size_t input_len);
734
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
735
int *get_input(WINDOW *win, size_t input_len);
736
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
737
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
738
int get_escape_seq_kbinput(const int *seq, size_t seq_len);
739
int get_escape_seq_abcd(int kbinput);
740
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
741
int get_byte_kbinput(int kbinput);
742
#ifdef ENABLE_UTF8
743
long add_unicode_digit(int kbinput, long factor, long *uni);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
744
long get_unicode_kbinput(int kbinput);
745
#endif
746
int get_control_kbinput(int kbinput);
747
void unparse_kbinput(char *output, size_t output_len);
748
749
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
750
#ifndef DISABLE_MOUSE
751
752
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
#endif
753
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
754
	*meta_key, bool *func_key);
755
#ifndef NANO_TINY
756
757
const toggle *get_toggle(int kbinput, bool meta_key);
#endif
758
void blank_line(WINDOW *win, int y, int x, int n);
759
void blank_titlebar(void);
760
void blank_topbar(void);
761
762
void blank_edit(void);
void blank_statusbar(void);
763
void blank_bottombars(void);
764
void check_statusblank(void);
765
766
char *display_string(const char *buf, size_t start_col, size_t len, bool
	dollars);
767
void titlebar(const char *path);
768
769
void set_modified(void);
void statusbar(const char *msg, ...);
770
void bottombars(const shortcut *s);
771
void onekey(const char *keystroke, const char *desc, size_t len);
772
void reset_cursor(void);
773
774
void edit_draw(const filestruct *fileptr, const char *converted, int
	line, size_t start);
775
void update_line(const filestruct *fileptr, size_t index);
776
777
bool need_horizontal_update(size_t old_pww);
bool need_vertical_update(size_t old_pww);
778
void edit_scroll(scroll_dir direction, ssize_t nlines);
779
void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta's avatar
Chris Allegretta committed
780
void edit_refresh(void);
781
void edit_update(update_type location);
782
void total_redraw(void);
783
void total_refresh(void);
784
void display_main_list(void);
785
void do_cursorpos(bool constant);
786
void do_cursorpos_void(void);
787
void do_replace_highlight(bool highlight, const char *word);
Chris Allegretta's avatar
Chris Allegretta committed
788
789
#ifdef NANO_EXTRA
void do_credits(void);
790
#endif
791
792

#endif /* !PROTO_H */