proto.h 24.4 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
#ifndef NANO_TINY
extern int controlleft;
extern int controlright;
42
43
extern int controlup;
extern int controldown;
44
45
#endif

46
#ifndef DISABLE_WRAPJUSTIFY
47
extern ssize_t fill;
48
extern ssize_t wrap_at;
49
#endif
50
51
52

extern char *last_search;

53
54
extern char *present_path;

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

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

70
71
72
73
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

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

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

96
97
extern char *word_chars;

98
extern bool nodelay_mode;
99

100
101
102
103
extern char *answer;

extern ssize_t tabsize;

104
#ifndef NANO_TINY
105
extern char *backup_dir;
106
107
extern const char *locking_prefix;
extern const char *locking_suffix;
108
#endif
109
110
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
111
extern char *full_operating_dir;
112
#endif
113

114
#ifndef DISABLE_SPELLER
115
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
116
117
#endif

118
#ifndef DISABLE_COLOR
119
120
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
121
#endif
122

123
extern bool refresh_needed;
124

125
extern int currmenu;
126
127
128
129
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
130

131
#ifndef DISABLE_HISTORIES
132
133
134
135
136
137
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
138
extern poshiststruct *position_history;
139
140
#endif

141
142
143
144
145
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

146
extern int hilite_attribute;
147
148
149
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
150
extern int interface_color_pair[NUMBER_OF_ELEMENTS];
151

152
153
extern char *homedir;

154
155
typedef void (*functionptrtype)(void);

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

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

251
/* Most functions in color.c. */
252
#ifndef DISABLE_COLOR
253
void set_colorpairs(void);
254
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
255
void color_update(void);
256
257
258
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
259
#endif
260

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

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

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

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

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

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

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

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

578
/* All functions in search.c. */
579
#ifdef HAVE_REGEX_H
580
bool regexp_init(const char *regexp);
581
582
583
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
584
void search_replace_abort(void);
585
int search_init(bool replacing, bool use_answer);
586
int findnextstr(
587
#ifndef DISABLE_SPELLER
588
	bool whole_word_only,
589
#endif
590
	const filestruct *begin, size_t begin_x,
591
	const char *needle, size_t *match_len);
592
void do_search(void);
593
594
595
596
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
597
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
598
void do_research(void);
599
#endif
600
void go_looking(void);
601
#ifdef HAVE_REGEX_H
602
int replace_regexp(char *string, bool create);
603
#endif
604
char *replace_line(const char *needle);
605
606
ssize_t do_replace_loop(
#ifndef DISABLE_SPELLER
607
	bool whole_word_only,
608
#endif
609
610
	const filestruct *real_current, size_t *real_current_x,
	const char *needle);
611
void do_replace(void);
612
void goto_line_posx(ssize_t line, size_t pos_x);
613
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
614
	bool interactive);
615
void do_gotolinecolumn_void(void);
616
#ifndef NANO_TINY
617
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
618
void do_find_bracket(void);
619
#ifndef DISABLE_TABCOMP
620
char *get_history_completion(filestruct **h, char *s, size_t len);
621
#endif
622
#endif
623
624
#ifndef DISABLE_HISTORIES
bool history_has_changed(void);
625
void history_init(void);
626
void history_reset(const filestruct *h);
627
628
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
629
void update_history(filestruct **h, const char *s);
630
631
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
632
633
void get_history_older_void(void);
void get_history_newer_void(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
634
#endif
Chris Allegretta's avatar
Chris Allegretta committed
635

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

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

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

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

841
#endif /* !PROTO_H */