proto.h 24.3 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
2
3
/**************************************************************************
 *   proto.h                                                              *
 *                                                                        *
4
 *   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,  *
5
 *   2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc.    *
Chris Allegretta's avatar
Chris Allegretta committed
6
7
 *   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 *
8
 *   the Free Software Foundation; either version 3, or (at your option)  *
Chris Allegretta's avatar
Chris Allegretta committed
9
10
 *   any later version.                                                   *
 *                                                                        *
11
12
13
14
 *   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
15
16
17
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
18
19
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA            *
 *   02110-1301, USA.                                                     *
Chris Allegretta's avatar
Chris Allegretta committed
20
21
22
 *                                                                        *
 **************************************************************************/

23
24
25
#ifndef PROTO_H
#define PROTO_H 1

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

28
/* All external variables.  See global.c for their descriptions. */
29
#ifndef NANO_TINY
30
extern volatile sig_atomic_t sigwinch_counter;
31
32
#endif

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

extern message_type lastmessage;
38

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

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

extern char *last_search;

51
52
extern char *present_path;

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

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

68
69
70
71
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

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

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

94
extern bool nodelay_mode;
95
96
97
98
extern char *answer;

extern ssize_t tabsize;

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

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

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

118
extern bool refresh_needed;
119

120
extern int currmenu;
121
122
123
124
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
125

126
#ifndef DISABLE_HISTORIES
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
extern poshiststruct *position_history;
134
135
#endif

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

141
extern int hilite_attribute;
142
143
144
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
145
extern int interface_color_pair[NUMBER_OF_ELEMENTS];
146

147
148
extern char *homedir;

149
150
typedef void (*functionptrtype)(void);

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

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

246
/* Most functions in color.c. */
247
#ifndef DISABLE_COLOR
248
void set_colorpairs(void);
249
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
250
void color_update(void);
251
252
253
void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr);
void precalc_multicolorinfo(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
254
#endif
255

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

279
/* Most functions in files.c. */
280
void make_new_buffer(void);
281
void initialize_buffer_text(void);
282
bool open_buffer(const char *filename, bool undoable);
283
284
285
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
286
void display_buffer(void);
287
#ifndef DISABLE_MULTIBUFFER
288
289
void switch_to_prev_buffer_void(void);
void switch_to_next_buffer_void(void);
290
bool close_buffer(void);
291
#endif
292
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode);
293
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
294
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
295
char *get_next_filename(const char *name, const char *suffix);
296
void do_insertfile(
297
#ifndef NANO_TINY
298
299
300
301
302
	bool execute
#else
	void
#endif
	);
303
void do_insertfile_void(void);
304
305
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
306
char *safe_tempfile(FILE **f);
307
#ifndef DISABLE_OPERATINGDIR
308
void init_operating_dir(void);
309
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
310
#endif
311
#ifndef NANO_TINY
312
void init_backup_dir(void);
313
int delete_lockfile(const char *lockfilename);
314
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
315
#endif
316
int copy_file(FILE *inn, FILE *out);
317
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
318
	append, bool nonamechange);
319
#ifndef NANO_TINY
320
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
321
	append_type append);
322
#endif
323
int do_writeout(bool exiting);
324
void do_writeout_void(void);
325
326
327
#ifndef NANO_TINY
void do_savefile(void);
#endif
328
char *real_dir_from_tilde(const char *buf);
329
330
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
331
void free_chararray(char **array, size_t len);
332
#endif
Chris Allegretta's avatar
Chris Allegretta committed
333
#ifndef DISABLE_TABCOMP
334
bool is_dir(const char *buf);
335
char **username_tab_completion(const char *buf, size_t *num_matches,
336
	size_t buf_len);
337
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
338
	*num_matches, size_t buf_len);
339
char *input_tab(char *buf, bool allow_files, size_t *place,
340
	bool *lastwastab, void (*refresh_func)(void), bool *listed);
Chris Allegretta's avatar
Chris Allegretta committed
341
#endif
342
const char *tail(const char *path);
343
#ifndef DISABLE_HISTORIES
344
char *histfilename(void);
345
void load_history(void);
346
bool writehist(FILE *hist, filestruct *histhead);
347
void save_history(void);
348
349
350
int check_dotnano(void);
void load_poshistory(void);
void save_poshistory(void);
351
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
352
int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
353
#endif
354

355
/* Some functions in global.c. */
356
size_t length_of_list(int menu);
357
358
const sc *first_sc_for(int menu, void (*func)(void));
int sc_seq_or(void (*func)(void), int defaultval);
359
functionptrtype func_from_key(int *kbinput);
360
key_type strtokeytype(const char *str);
361
362
void assign_keyinfo(sc *s);
void print_sclist(void);
363
void shortcut_init(void);
364
#ifndef DISABLE_COLOR
365
void set_lint_or_format_shortcuts(void);
366
367
void set_spell_shortcuts(void);
#endif
368
const subnfunc *sctofunc(const sc *s);
369
const char *flagtostr(int flag);
370
371
sc *strtosc(const char *input);
int strtomenu(const char *input);
Chris Allegretta's avatar
Chris Allegretta committed
372
373
#ifdef DEBUG
void thanks_for_all_the_fish(void);
374
375
#endif

376
/* All functions in help.c. */
377
#ifndef DISABLE_HELP
378
void do_help(void);
379
void help_init(void);
380
functionptrtype parse_help_input(int *kbinput);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
381
size_t help_line_len(const char *ptr);
382
#endif
383
void do_help_void(void);
384

385
/* All functions in move.c. */
386
387
388
389
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
390
391
392
393
394
395
#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
396
#ifndef NANO_TINY
397
void do_prev_word(bool allow_punct, bool allow_update);
398
void do_prev_word_void(void);
399
400
bool do_next_word(bool allow_punct, bool allow_update);
void do_next_word_void(void);
401
#endif
402
403
void do_home(void);
void do_end(void);
404
405
406
407
408
409
410
411
void do_up(
#ifndef NANO_TINY
	bool scroll_only
#else
	void
#endif
	);
void do_up_void(void);
412
#ifndef NANO_TINY
413
414
void do_scroll_up(void);
#endif
415
416
417
418
419
420
421
422
void do_down(
#ifndef NANO_TINY
	bool scroll_only
#else
	void
#endif
	);
void do_down_void(void);
423
#ifndef NANO_TINY
424
425
void do_scroll_down(void);
#endif
426
427
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
428

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

505
/* All functions in prompt.c. */
506
507
int do_statusbar_input(bool *ran_func, bool *finished,
	void (*refresh_func)(void));
508
#ifndef DISABLE_MOUSE
509
int do_statusbar_mouse(void);
510
#endif
511
void do_statusbar_output(int *the_input, size_t input_len,
512
	bool filtering, bool *got_newline);
513
514
515
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
516
void do_statusbar_right(void);
517
518
519
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
520
#ifndef NANO_TINY
521
void do_statusbar_prev_word(void);
522
void do_statusbar_next_word(void);
523
#endif
524
void do_statusbar_verbatim_input(bool *got_newline);
525
526
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
527
void reinit_statusbar_x(void);
528
void reset_statusbar_cursor(void);
529
void update_the_statusbar(void);
530
void update_bar_if_needed(void);
531
functionptrtype get_prompt_string(int *value, bool allow_tabs,
532
#ifndef DISABLE_TABCOMP
533
	bool allow_files, bool *listed,
534
535
#endif
	const char *curranswer,
536
#ifndef DISABLE_HISTORIES
537
538
	filestruct **history_list,
#endif
539
	void (*refresh_func)(void));
540
541
542
543
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
544
	int menu, const char *curranswer,
545
#ifndef DISABLE_HISTORIES
546
547
	filestruct **history_list,
#endif
548
	void (*refresh_func)(void), const char *msg, ...);
549
int do_yesno_prompt(bool all, const char *msg);
550

551
/* Most functions in rcfile.c. */
552
553
554
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
char *parse_next_word(char *ptr);
#endif
555
#ifndef DISABLE_NANORC
556
557
void rcfile_error(const char *msg, ...);
char *parse_argument(char *ptr);
558
#ifndef DISABLE_COLOR
559
560
char *parse_next_regex(char *ptr);
void parse_syntax(char *ptr);
561
void parse_includes(char *ptr);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
562
short color_to_short(const char *colorname, bool *bright);
563
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
564
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
565
#endif
566
void parse_rcfile(FILE *rcstream
567
#ifndef DISABLE_COLOR
568
569
570
	, bool syntax_only
#endif
	);
571
void do_rcfile(void);
572
#endif /* !DISABLE_NANORC */
573

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

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

702
/* All functions in utils.c. */
703
void get_homedir(void);
704
bool parse_num(const char *str, ssize_t *val);
705
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
706
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
707
708
709
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
710
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
711
712
713
714
715
716
#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
717
#endif
718
#ifdef HAVE_REGEX_H
719
const char *fixbounds(const char *r);
720
#endif
721
#ifndef DISABLE_SPELLER
722
bool is_separate_word(size_t position, size_t length, const char *buf);
723
#endif
724
const char *strstrwrapper(const char *haystack, const char *needle,
725
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
726
727
728
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
729
char *mallocstrncpy(char *dest, const char *src, size_t n);
730
char *mallocstrcpy(char *dest, const char *src);
731
char *free_and_assign(char *dest, char *src);
732
size_t get_page_start(size_t column);
733
734
735
736
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
737
void new_magicline(void);
738
#ifndef NANO_TINY
739
void remove_magicline(void);
740
void mark_order(const filestruct **top, size_t *top_x, const filestruct
741
	**bot, size_t *bot_x, bool *right_side_up);
742
void discard_until(const undo *thisitem, openfilestruct *thefile);
743
void add_undo(undo_type action);
744
void update_undo(undo_type action);
745
746
747
748
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
#endif
749
#endif
750
size_t get_totsize(const filestruct *begin, const filestruct *end);
751
filestruct *fsfromline(ssize_t lineno);
752
753
754
755
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
756

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

819
/* May as well throw these here, since they are just placeholders. */
820
821
822
823
824
825
826
827
828
829
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);
830
void discard_buffer(void);
831
832
833
void new_buffer_void(void);
void backwards_void(void);
void goto_dir_void(void);
834
void flip_replace_void(void);
835
void flip_execute_void(void);
836

837
#endif /* !PROTO_H */