proto.h 21.6 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
/* $Id$ */
Chris Allegretta's avatar
Chris Allegretta committed
2
3
4
/**************************************************************************
 *   proto.h                                                              *
 *                                                                        *
5
6
 *   Copyright (C) 1999-2004 Chris Allegretta                             *
 *   Copyright (C) 2005 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

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
27
/* Public externs. */
Chris Allegretta's avatar
Chris Allegretta committed
28
29
#include "nano.h"

30
#ifndef DISABLE_WRAPJUSTIFY
31
extern ssize_t fill;
32
extern ssize_t wrap_at;
33
#endif
34
extern int editwinrows;
35
extern long flags;
36
extern ssize_t tabsize;
37
extern int currslen;
Chris Allegretta's avatar
Chris Allegretta committed
38

39
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
40
extern char *whitespace;
41
extern int whitespace_len[2];
42
43
#endif

44
#ifndef DISABLE_JUSTIFY
45
46
extern char *punct;
extern char *brackets;
Chris Allegretta's avatar
Chris Allegretta committed
47
extern char *quotestr;
48
49
50
51
52
53
54
#ifdef HAVE_REGEX_H
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
#else
extern size_t quotelen;
#endif
55
56
#endif

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

61
extern WINDOW *topwin, *edit, *bottomwin;
62
extern char *answer;
Chris Allegretta's avatar
Chris Allegretta committed
63
64
extern char *last_search;
extern char *last_replace;
65
66
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
67
extern char *full_operating_dir;
68
#endif
69
#ifndef DISABLE_SPELLER
70
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
71
72
#endif

Chris Allegretta's avatar
Chris Allegretta committed
73
extern struct stat fileinfo;
74
extern filestruct *cutbuffer;
75
76
77
#ifndef DISABLE_JUSTIFY
extern filestruct *jusbuffer;
#endif
78
extern partition *filepart;
79

80
extern openfilestruct *openfile;
81

82
#ifdef ENABLE_COLOR
83
extern syntaxtype *syntaxes;
84
extern char *syntaxstr;
85
86
#endif

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

Chris Allegretta's avatar
Chris Allegretta committed
105
extern const shortcut *currshortcut;
106
107

#ifdef HAVE_REGEX_H
108
extern regex_t search_regexp;
109
extern regmatch_t regmatches[10];
110
#ifdef ENABLE_COLOR
111
extern regex_t syntaxfile_regexp;
112
extern regmatch_t synfilematches[1];
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
113
114
#endif
#endif
115

116
#ifndef NANO_TINY
117
extern toggle *toggles;
118
#endif
119

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

129
extern bool curses_ended;
130

131
132
extern char *homedir;

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
133
/* The functions we want available. */
134

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
135
136
137
138
139
140
141
142
143
/* Public functions in browser.c. */
#ifndef DISABLE_BROWSER
char *do_browser(char *path, DIR *dir);
char **browser_init(const char *path, int *longest, size_t *numents, DIR
	*dir);
char *do_browse_from(const char *inpath);
void striponedir(char *path);
#endif

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

218
/* Public functions in color.c. */
Chris Allegretta's avatar
Chris Allegretta committed
219
#ifdef ENABLE_COLOR
220
void set_colorpairs(void);
221
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
222
void color_update(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
223
#endif
224

225
/* Public functions in cut.c. */
226
void cutbuffer_reset(void);
227
void cut_line(void);
228
#ifndef NANO_TINY
229
230
void cut_marked(void);
void cut_to_eol(void);
231
#endif
232
void do_cut_text(void);
233
#ifndef NANO_TINY
234
235
void do_cut_till_end(void);
#endif
236
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
237

238
/* Public functions in files.c. */
239
void make_new_buffer(void);
240
void initialize_buffer(void);
241
void initialize_buffer_text(void);
242
void open_buffer(const char *filename);
243
244
245
#ifndef DISABLE_SPELLER
void replace_buffer(const char *filename);
#endif
246
void display_buffer(void);
247
248
249
250
251
#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);
252
#endif
253
filestruct *read_line(char *buf, filestruct *prevnode, bool
254
	*first_line_ins, size_t buf_len);
255
256
void read_file(FILE *f, const char *filename);
int open_file(const char *filename, bool newfie, FILE **f);
257
char *get_next_filename(const char *name, const char *suffix);
258
void do_insertfile(
259
#ifndef NANO_TINY
260
261
262
263
264
	bool execute
#else
	void
#endif
	);
265
void do_insertfile_void(void);
266
267
char *get_full_path(const char *origpath);
char *check_writable_directory(const char *path);
268
char *safe_tempfile(FILE **f);
269
#ifndef DISABLE_OPERATINGDIR
270
void init_operating_dir(void);
271
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
272
#endif
273
#ifndef NANO_TINY
274
275
void init_backup_dir(void);
#endif
276
int copy_file(FILE *inn, FILE *out);
277
278
int write_file(const char *name, FILE *f_open, bool tmp, append_type
	append, bool nonamechange);
279
#ifndef NANO_TINY
280
281
int write_marked_file(const char *name, FILE *f_open, bool tmp,
	append_type append);
282
#endif
283
int do_writeout(bool exiting);
284
void do_writeout_void(void);
285
char *real_dir_from_tilde(const char *buf);
286
287
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
288
void free_chararray(char **array, size_t len);
289
#endif
Chris Allegretta's avatar
Chris Allegretta committed
290
#ifndef DISABLE_TABCOMP
291
292
293
294
295
char **username_tab_completion(const char *buf, size_t *num_matches,
	size_t buflen);
char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
	buflen);
char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
Chris Allegretta's avatar
Chris Allegretta committed
296
#endif
297
const char *tail(const char *foo);
298
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
299
char *histfilename(void);
300
void load_history(void);
301
bool writehist(FILE *hist, filestruct *histhead);
302
303
void save_history(void);
#endif
304

305
/* Public functions in global.c. */
306
size_t length_of_list(const shortcut *s);
307
#ifndef NANO_TINY
308
void toggle_init_one(int val, const char *desc, long flag);
309
310
void toggle_init(void);
#endif
311
312
313
314
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
	const char *help,
#endif
315
	int metaval, int funcval, int miscval, bool view, void
316
	(*func)(void));
317
void shortcut_init(bool unjustify);
318
void free_shortcutage(shortcut **shortcutage);
Chris Allegretta's avatar
Chris Allegretta committed
319
320
#ifdef DEBUG
void thanks_for_all_the_fish(void);
321
322
#endif

323
324
325
/* Public functions in help.c. */
#ifndef DISABLE_HELP
void do_help(void);
326
void help_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
327
size_t help_line_len(const char *ptr);
328
329
#endif

330
/* Public functions in move.c. */
331
332
333
334
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
335
336
337
338
339
340
#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
341
#ifndef NANO_TINY
342
343
344
345
346
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
347
348
void do_home(void);
void do_end(void);
349
void do_up(void);
350
#ifndef NANO_TINY
351
352
void do_scroll_up(void);
#endif
353
void do_down(void);
354
#ifndef NANO_TINY
355
356
void do_scroll_down(void);
#endif
357
358
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
359

360
/* Public functions in nano.c. */
361
362
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
363
364
void splice_node(filestruct *begin, filestruct *newnode, filestruct
	*end);
365
366
367
void unlink_node(const filestruct *fileptr);
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
Chris Allegretta's avatar
Chris Allegretta committed
368
void free_filestruct(filestruct *src);
369
void renumber(filestruct *fileptr);
370
371
partition *partition_filestruct(filestruct *top, size_t top_x,
	filestruct *bot, size_t bot_x);
372
void unpartition_filestruct(partition **p);
373
374
375
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);
376
377
378
379
380
381
382
383
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
384
385
386
387
388
389
390
391
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
392
393
394
395
396
void print1opt_full(const char *shortflag
#ifdef HAVE_GETOPT_LONG
	, const char *longflag
#endif
	, const char *desc);
397
398
void usage(void);
void version(void);
399
int no_more_space(void);
400
int no_help(void);
401
402
void nano_disabled_msg(void);
void do_exit(void);
Chris Allegretta's avatar
Chris Allegretta committed
403
void signal_init(void);
404
405
406
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
407
#ifndef NANO_TINY
408
RETSIGTYPE handle_sigwinch(int signal);
409
void allow_pending_sigwinch(bool allow);
410
#endif
411
#ifndef NANO_TINY
412
413
void do_toggle(const toggle *which);
#endif
414
void disable_extended_io(void);
415
void disable_signals(void);
416
#ifndef NANO_TINY
417
418
419
420
void enable_signals(void);
#endif
void disable_flow_control(void);
void enable_flow_control(void);
421
void terminal_init(void);
422
int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
423
	*ran_func, bool *finished, bool allow_funcs);
424
425
426
#ifndef DISABLE_MOUSE
bool do_mouse(void);
#endif
427
void do_output(char *output, size_t output_len, bool allow_cntrls);
428

429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/* Public functions in prompt.c. */
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
	bool *ran_func, bool *finished, bool allow_funcs);
#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_right(void);
void do_statusbar_left(void);
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
444
#ifndef NANO_TINY
445
446
447
448
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);
449
#ifndef NANO_TINY
450
451
bool find_statusbar_bracket_match(bool reverse, const char
	*bracket_set);
452
453
void do_statusbar_find_bracket(void);
#endif
454
455
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
456
457
458
459
void update_statusbar_line(const char *curranswer, size_t index);
void reset_statusbar_cursor(void);
bool need_statusbar_horizontal_update(size_t old_pww);
int get_prompt_string(bool allow_tabs, const char *curranswer,
460
#ifndef NANO_TINY
461
462
463
464
465
466
467
	filestruct **history_list,
#endif
	const shortcut *s
#ifndef DISABLE_TABCOMP
	, bool *list
#endif
	);
468
469
int do_prompt(bool allow_tabs, const shortcut *s, const char
	*curranswer,
470
#ifndef NANO_TINY
471
472
473
	filestruct **history_list,
#endif
	const char *msg, ...);
474
475
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
476

477
/* Public functions in rcfile.c. */
478
#ifdef ENABLE_NANORC
479
480
481
482
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
483
short color_to_short(const char *colorname, bool *bright);
484
char *parse_next_regex(char *ptr);
485
bool nregcomp(const char *regex, int eflags);
486
void parse_syntax(char *ptr);
487
void parse_colors(char *ptr, bool icase);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
488
#endif
489
void parse_rcfile(FILE *rcstream);
490
void do_rcfile(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
491
#endif
492

493
/* Public functions in search.c. */
494
#ifdef HAVE_REGEX_H
495
int regexp_init(const char *regexp);
496
497
498
499
500
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
void search_abort(void);
void search_init_globals(void);
501
int search_init(bool replacing, bool use_answer);
502
503
504
505
506
507
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);
508
void findnextstr_wrap_reset(void);
509
void do_search(void);
510
#ifndef NANO_TINY
511
void do_research(void);
512
#endif
513
514
void replace_abort(void);
#ifdef HAVE_REGEX_H
515
int replace_regexp(char *string, bool create);
516
#endif
517
char *replace_line(const char *needle);
518
519
520
521
522
523
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);
524
void do_replace(void);
525
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
526
	bool interactive, bool save_pos, bool allow_update);
527
void do_gotolinecolumn_void(void);
528
#ifndef DISABLE_SPELLER
529
530
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
	pos_pww);
Chris Allegretta's avatar
Chris Allegretta committed
531
#endif
532
#ifndef NANO_TINY
533
bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
534
void do_find_bracket(void);
535
#ifdef ENABLE_NANORC
536
bool history_has_changed(void);
537
#endif
538
void history_init(void);
539
void history_reset(const filestruct *h);
540
541
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
542
void update_history(filestruct **h, const char *s);
543
544
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
545
#ifndef DISABLE_TABCOMP
546
char *get_history_completion(filestruct **h, const char *s, size_t len);
547
#endif
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
548
#endif
Chris Allegretta's avatar
Chris Allegretta committed
549

550
/* Public functions in text.c. */
551
#ifndef NANO_TINY
552
553
554
555
556
557
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
void do_tab(void);
void do_enter(void);
558
#ifndef NANO_TINY
559
RETSIGTYPE cancel_command(int signal);
560
bool execute_command(const char *command);
561
#endif
562
563
564
565
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
#endif
566
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
567
568
569
570
571
ssize_t break_line(const char *line, ssize_t goal
#ifndef DISABLE_HELP
	, bool newline
#endif
	);
572
#endif
573
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
574
575
576
577
578
579
580
581
582
583
584
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);
585
void backup_lines(filestruct *first_line, size_t par_len);
586
bool find_paragraph(size_t *const quote, size_t *const par);
587
588
589
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
590
#endif
591
592
593
594
595
596
#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
597
#ifndef NANO_TINY
598
void do_wordlinechar_count(void);
599
#endif
600
void do_verbatim_input(void);
601
602

/* Public functions in utils.c. */
603
int digits(size_t n);
604
void get_homedir(void);
605
bool parse_num(const char *str, ssize_t *val);
606
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
607
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
608
609
610
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
611
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
612
613
614
615
616
617
#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
618
#endif
619
620
621
622
623
624
625
#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
int regexp_bol_or_eol(const regex_t *preg, const char *string);
#endif
626
#ifndef DISABLE_SPELLER
627
bool is_whole_word(size_t pos, const char *buf, const char *word);
628
#endif
629
const char *strstrwrapper(const char *haystack, const char *needle,
630
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
631
632
633
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
634
char *mallocstrncpy(char *dest, const char *src, size_t n);
635
char *mallocstrcpy(char *dest, const char *src);
636
char *mallocstrassn(char *dest, char *src);
637
size_t get_page_start(size_t column);
638
639
640
641
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
642
void new_magicline(void);
643
#ifndef NANO_TINY
644
void remove_magicline(void);
645
void mark_order(const filestruct **top, size_t *top_x, const filestruct
646
	**bot, size_t *bot_x, bool *right_side_up);
647
#endif
648
size_t get_totsize(const filestruct *begin, const filestruct *end);
649
650
651
652
653
654
655
#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
656

657
/* Public functions in winio.c. */
658
#ifndef NANO_TINY
659
660
void reset_kbinput(void);
#endif
661
662
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
663
void unget_input(int *input, size_t input_len);
664
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
665
int *get_input(WINDOW *win, size_t input_len);
666
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
667
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
668
#ifndef NANO_TINY
669
	, bool reset
670
671
#endif
	);
672
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
673
	*ignore_seq);
674
int get_escape_seq_abcd(int kbinput);
675
int get_byte_kbinput(int kbinput
676
#ifndef NANO_TINY
677
678
679
	, bool reset
#endif
	);
680
long get_unicode_kbinput(int kbinput
681
#ifndef NANO_TINY
682
	, bool reset
683
684
#endif
	);
685
int get_control_kbinput(int kbinput);
686
void unparse_kbinput(char *output, size_t output_len);
687
688
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
689
#ifndef DISABLE_MOUSE
690
691
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
#endif
692
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
693
	*meta_key, bool *func_key);
694
#ifndef NANO_TINY
695
696
const toggle *get_toggle(int kbinput, bool meta_key);
#endif
697
void blank_line(WINDOW *win, int y, int x, int n);
698
void blank_titlebar(void);
699
void blank_topbar(void);
700
701
void blank_edit(void);
void blank_statusbar(void);
702
void blank_bottombars(void);
703
void check_statusblank(void);
704
705
char *display_string(const char *buf, size_t start_col, size_t len, bool
	dollars);
706
void titlebar(const char *path);
707
708
void set_modified(void);
void statusbar(const char *msg, ...);
709
void bottombars(const shortcut *s);
710
void onekey(const char *keystroke, const char *desc, size_t len);
711
void reset_cursor(void);
712
713
void edit_draw(const filestruct *fileptr, const char *converted, int
	line, size_t start);
714
void update_line(const filestruct *fileptr, size_t index);
715
716
bool need_horizontal_update(size_t old_pww);
bool need_vertical_update(size_t old_pww);
717
void edit_scroll(scroll_dir direction, ssize_t nlines);
718
void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta's avatar
Chris Allegretta committed
719
void edit_refresh(void);
720
void edit_update(update_type location);
721
void total_redraw(void);
722
void total_refresh(void);
723
void display_main_list(void);
724
void do_cursorpos(bool constant);
725
void do_cursorpos_void(void);
726
void do_replace_highlight(bool highlight, const char *word);
Chris Allegretta's avatar
Chris Allegretta committed
727
728
#ifdef NANO_EXTRA
void do_credits(void);
729
#endif
730
731

#endif /* !PROTO_H */