proto.h 22.9 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 externs.  See global.c for descriptions of them. */
30
31
32
33
#ifndef NANO_TINY
extern sigjmp_buf jmpbuf;
#endif

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

extern char *last_search;
extern char *last_replace;

42
extern long flags;
43
44
45
46
47
48
49
50
51
52
53
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
54

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

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

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

77
78
79
80
extern char *answer;

extern ssize_t tabsize;

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

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

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

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

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

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

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

139
extern int reverse_attr;
140
extern bool curses_ended;
141

142
143
extern char *homedir;

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
144
145
146
147
/* Public functions in browser.c. */
#ifndef DISABLE_BROWSER
char *do_browser(char *path, DIR *dir);
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
152
153
154
155
156
157
158
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);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
159
160
161
void striponedir(char *path);
#endif

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

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

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

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

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

358
359
/* Public functions in help.c. */
#ifndef DISABLE_HELP
360
361
362
363
364
void do_help(void (*refresh_func)(void));
void do_help_void(void);
#ifndef DISABLE_BROWSER
void do_browser_help(void);
#endif
365
void help_init(void);
366
void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
367
size_t help_line_len(const char *ptr);
368
369
#endif

370
/* Public functions in move.c. */
371
372
373
374
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
375
376
377
378
379
380
#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
381
#ifndef NANO_TINY
382
383
384
385
386
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
387
388
void do_home(void);
void do_end(void);
389
void do_up(void);
390
#ifndef NANO_TINY
391
392
void do_scroll_up(void);
#endif
393
void do_down(void);
394
#ifndef NANO_TINY
395
396
void do_scroll_down(void);
#endif
397
398
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
399

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

469
470
/* Public functions in prompt.c. */
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
471
472
	bool *ran_func, bool *finished, bool allow_funcs, void
	(*refresh_func)(void));
473
474
475
476
477
478
479
480
#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);
481
void do_statusbar_right(void);
482
483
484
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
485
#ifndef NANO_TINY
486
487
488
489
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);
490
#ifndef NANO_TINY
491
492
bool find_statusbar_bracket_match(bool reverse, const char
	*bracket_set);
493
494
void do_statusbar_find_bracket(void);
#endif
495
496
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
497
498
499
void update_statusbar_line(const char *curranswer, size_t index);
void reset_statusbar_cursor(void);
bool need_statusbar_horizontal_update(size_t old_pww);
500
501
502
503
504
int get_prompt_string(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
	const char *curranswer,
505
#ifndef NANO_TINY
506
507
	filestruct **history_list,
#endif
508
	void (*refresh_func)(void), const shortcut *s
509
510
511
512
#ifndef DISABLE_TABCOMP
	, bool *list
#endif
	);
513
514
515
516
517
int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
	bool allow_files,
#endif
	const shortcut *s, const char *curranswer,
518
#ifndef NANO_TINY
519
520
	filestruct **history_list,
#endif
521
	void (*refresh_func)(void), const char *msg, ...);
522
523
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
524

525
/* Public functions in rcfile.c. */
526
#ifdef ENABLE_NANORC
527
528
529
530
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
531
short color_to_short(const char *colorname, bool *bright);
532
char *parse_next_regex(char *ptr);
533
bool nregcomp(const char *regex, int eflags);
534
void parse_syntax(char *ptr);
535
void parse_include(char *ptr);
536
void parse_colors(char *ptr, bool icase);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
537
#endif
538
539
540
541
542
void parse_rcfile(FILE *rcstream
#ifdef ENABLE_COLOR
	, bool syntax_only
#endif
	);
543
void do_rcfile(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
544
#endif
545

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

602
/* Public functions in text.c. */
603
#ifndef NANO_TINY
604
605
606
607
608
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
void do_tab(void);
609
#ifndef NANO_TINY
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
610
void do_indent_marked(ssize_t cols);
611
612
613
void do_indent_marked_void(void);
void do_unindent_marked_void(void);
#endif
614
void do_enter(void);
615
#ifndef NANO_TINY
616
RETSIGTYPE cancel_command(int signal);
617
bool execute_command(const char *command);
618
#endif
619
620
621
622
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
#endif
623
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
624
625
626
627
628
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
	, bool newline
#endif
	);
629
#endif
630
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
631
632
633
634
635
636
637
638
639
640
641
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);
642
void backup_lines(filestruct *first_line, size_t par_len);
643
bool find_paragraph(size_t *const quote, size_t *const par);
644
645
646
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
647
#endif
648
649
650
651
652
653
#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
654
#ifndef NANO_TINY
655
void do_wordlinechar_count(void);
656
#endif
657
void do_verbatim_input(void);
658
659

/* Public functions in utils.c. */
660
int digits(size_t n);
661
void get_homedir(void);
662
bool parse_num(const char *str, ssize_t *val);
663
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
664
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
665
666
667
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
668
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
669
670
671
672
673
674
#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
675
#endif
676
677
678
679
680
#ifdef HAVE_REGEX_H
#ifdef BROKEN_REGEXEC
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
	regmatch_t pmatch[], int eflags);
#endif
681
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
682
#endif
683
#ifndef DISABLE_SPELLER
684
bool is_whole_word(size_t pos, const char *buf, const char *word);
685
#endif
686
const char *strstrwrapper(const char *haystack, const char *needle,
687
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
688
689
690
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
691
char *mallocstrncpy(char *dest, const char *src, size_t n);
692
char *mallocstrcpy(char *dest, const char *src);
693
char *mallocstrassn(char *dest, char *src);
694
size_t get_page_start(size_t column);
695
696
697
698
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
699
void new_magicline(void);
700
#ifndef NANO_TINY
701
void remove_magicline(void);
702
void mark_order(const filestruct **top, size_t *top_x, const filestruct
703
	**bot, size_t *bot_x, bool *right_side_up);
704
#endif
705
size_t get_totsize(const filestruct *begin, const filestruct *end);
706
707
708
709
710
711
712
#ifndef NDEBUG
int check_linenumbers(const filestruct *fileptr);
#endif
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
void dump_filestruct_reverse(void);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
713

714
/* Public functions in winio.c. */
715
716
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
717
void unget_input(int *input, size_t input_len);
718
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
719
int *get_input(WINDOW *win, size_t input_len);
720
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
721
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
722
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
723
	*ignore_seq);
724
int get_escape_seq_abcd(int kbinput);
725
726
int get_byte_kbinput(int kbinput);
long get_unicode_kbinput(int kbinput);
727
int get_control_kbinput(int kbinput);
728
void unparse_kbinput(char *output, size_t output_len);
729
730
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
731
#ifndef DISABLE_MOUSE
732
733
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
#endif
734
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
735
	*meta_key, bool *func_key);
736
#ifndef NANO_TINY
737
738
const toggle *get_toggle(int kbinput, bool meta_key);
#endif
739
void blank_line(WINDOW *win, int y, int x, int n);
740
void blank_titlebar(void);
741
void blank_topbar(void);
742
743
void blank_edit(void);
void blank_statusbar(void);
744
void blank_bottombars(void);
745
void check_statusblank(void);
746
747
char *display_string(const char *buf, size_t start_col, size_t len, bool
	dollars);
748
void titlebar(const char *path);
749
750
void set_modified(void);
void statusbar(const char *msg, ...);
751
void bottombars(const shortcut *s);
752
void onekey(const char *keystroke, const char *desc, size_t len);
753
void reset_cursor(void);
754
755
void edit_draw(const filestruct *fileptr, const char *converted, int
	line, size_t start);
756
void update_line(const filestruct *fileptr, size_t index);
757
758
bool need_horizontal_update(size_t old_pww);
bool need_vertical_update(size_t old_pww);
759
void edit_scroll(scroll_dir direction, ssize_t nlines);
760
void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta's avatar
Chris Allegretta committed
761
void edit_refresh(void);
762
void edit_update(update_type location);
763
void total_redraw(void);
764
void total_refresh(void);
765
void display_main_list(void);
766
void do_cursorpos(bool constant);
767
void do_cursorpos_void(void);
768
void do_replace_highlight(bool highlight, const char *word);
Chris Allegretta's avatar
Chris Allegretta committed
769
770
#ifdef NANO_EXTRA
void do_credits(void);
771
#endif
772
773

#endif /* !PROTO_H */