proto.h 24.3 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   *
 *   Free Software Foundation, Inc.                                       *
Chris Allegretta's avatar
Chris Allegretta committed
7
8
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
9
 *   the Free Software Foundation; either version 3, or (at your option)  *
Chris Allegretta's avatar
Chris Allegretta committed
10
11
 *   any later version.                                                   *
 *                                                                        *
12
13
14
15
 *   This program is distributed in the hope that it will be useful, but  *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    *
 *   General Public License for more details.                             *
Chris Allegretta's avatar
Chris Allegretta committed
16
17
18
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
19
20
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA            *
 *   02110-1301, USA.                                                     *
Chris Allegretta's avatar
Chris Allegretta committed
21
22
23
 *                                                                        *
 **************************************************************************/

24
25
26
#ifndef PROTO_H
#define PROTO_H 1

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

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

35
#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
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;

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

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

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

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

extern ssize_t tabsize;

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

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

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

103
extern bool edit_refresh_needed;
104
extern const shortcut *currshortcut;
105
extern int currmenu;
106

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

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

121
extern int reverse_attr;
122

123
124
extern char *homedir;

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

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

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

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

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

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

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

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

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

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

534
/* All functions in rcfile.c. */
535
#ifdef ENABLE_NANORC
536
537
538
539
540
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);
541
bool nregcomp(const char *regex, int eflags);
542
void parse_syntax(char *ptr);
543
void parse_include(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
544
short color_to_short(const char *colorname, bool *bright);
545
void parse_colors(char *ptr, bool icase);
546
void reset_multis(filestruct *fileptr);
547
void alloc_multidata_if_needed(filestruct *fileptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
548
#endif
549
550
551
552
553
void parse_rcfile(FILE *rcstream
#ifdef ENABLE_COLOR
	, bool syntax_only
#endif
	);
554
void do_rcfile(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
555
#endif
556

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

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

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

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

const char *cancel_msg;
#ifndef NANO_TINY
const char *case_sens_msg;
const char *backwards_msg;
797
798
const char *prev_history_msg;
const char *next_history_msg;
799
800
801
802
#endif
const char *replace_msg;
const char *no_replace_msg;
const char *go_to_line_msg;
Chris Allegretta's avatar
Chris Allegretta committed
803
804
805
806
const char *whereis_next_msg;
const char *first_file_msg;
const char *last_file_msg;
const char *goto_dir_msg;
807
808
809
810
811
812
813
814
815
816
817
818
const char *ext_cmd_msg;
const char *to_files_msg;
const char *dos_format_msg;
const char *mac_format_msg;
const char *append_msg;
const char *prepend_msg;
const char *backup_file_msg;
const char *dos_format_msg;
const char *mac_format_msg;
const char *append_msg;
const char *prepend_msg;
const char *backup_file_msg;
819
820
const char *gototext_msg;
const char *new_buffer_msg;
821
void iso_me_harder_funcmap(short func);
822
823
void enable_nodelay(void);
void disable_nodelay(void);
824
825
826
827
828

#ifdef HAVE_REGEX_H
const char *regexp_msg;
#endif

Chris Allegretta's avatar
Chris Allegretta committed
829
830
#ifdef NANO_EXTRA
void do_credits(void);
831
#endif
832
833

#endif /* !PROTO_H */