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
#ifndef DISABLE_WRAPJUSTIFY
31
extern ssize_t fill;
32
extern ssize_t wrap_at;
33
#endif
34
35
36
37

extern char *last_search;
extern char *last_replace;

38
extern long flags;
39
40
41
42
43
44
45
46
47
48
49
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
50

51
52
53
54
#ifndef NANO_TINY
extern char *matchbrackets;
#endif

55
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
56
extern char *whitespace;
57
extern int whitespace_len[2];
58
59
#endif

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

73
74
75
76
extern char *answer;

extern ssize_t tabsize;

77
#ifndef NANO_TINY
78
79
extern char *backup_dir;
#endif
80
81
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
82
extern char *full_operating_dir;
83
#endif
84

85
#ifndef DISABLE_SPELLER
86
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
87
88
#endif

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

111
#ifdef ENABLE_COLOR
112
113
extern syntaxtype *syntaxes;
extern char *syntaxstr;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
114
#endif
115

116
extern const shortcut *currshortcut;
117
#ifndef NANO_TINY
118
extern toggle *toggles;
119
#endif
120

121
#ifndef NANO_TINY
122
123
124
125
126
127
extern filestruct *search_history;
extern filestruct *searchage;
extern filestruct *searchbot;
extern filestruct *replace_history;
extern filestruct *replaceage;
extern filestruct *replacebot;
128
129
#endif

130
131
132
133
134
#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#endif

135
extern int reverse_attr;
136
extern bool curses_ended;
137

138
139
extern char *homedir;

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

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

239
/* Public functions in color.c. */
Chris Allegretta's avatar
Chris Allegretta committed
240
#ifdef ENABLE_COLOR
241
void set_colorpairs(void);
242
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
243
void color_update(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
244
#endif
245

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

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

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

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

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

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

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

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

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

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

/* Public functions in utils.c. */
651
int digits(size_t n);
652
void get_homedir(void);
653
bool parse_num(const char *str, ssize_t *val);
654
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
655
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
656
657
658
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
659
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
660
661
662
663
664
665
#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
666
#endif
667
668
669
670
671
#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
672
bool regexp_bol_or_eol(const regex_t *preg, const char *string);
673
#endif
674
#ifndef DISABLE_SPELLER
675
bool is_whole_word(size_t pos, const char *buf, const char *word);
676
#endif
677
const char *strstrwrapper(const char *haystack, const char *needle,
678
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
679
680
681
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
682
char *mallocstrncpy(char *dest, const char *src, size_t n);
683
char *mallocstrcpy(char *dest, const char *src);
684
char *mallocstrassn(char *dest, char *src);
685
size_t get_page_start(size_t column);
686
687
688
689
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
690
void new_magicline(void);
691
#ifndef NANO_TINY
692
void remove_magicline(void);
693
void mark_order(const filestruct **top, size_t *top_x, const filestruct
694
	**bot, size_t *bot_x, bool *right_side_up);
695
#endif
696
size_t get_totsize(const filestruct *begin, const filestruct *end);
697
698
699
700
701
702
703
#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
704

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

#endif /* !PROTO_H */