proto.h 21.5 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-2005 Chris Allegretta                             *
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 2, 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

26
/* Externs. */
Chris Allegretta's avatar
Chris Allegretta committed
27
28
#include "nano.h"

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

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

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

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

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

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

79
extern openfilestruct *openfile;
80

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

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

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

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

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

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

128
extern bool curses_ended;
129

130
131
extern char *homedir;

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

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
134
135
136
137
138
139
140
141
142
/* 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

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

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

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

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

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

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

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

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

428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
/* 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);
443
#ifndef NANO_TINY
444
445
446
447
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);
448
#ifndef NANO_TINY
449
450
bool find_statusbar_bracket_match(bool reverse, const char
	*bracket_set);
451
452
void do_statusbar_find_bracket(void);
#endif
453
454
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
455
456
457
458
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,
459
#ifndef NANO_TINY
460
461
462
463
464
465
466
	filestruct **history_list,
#endif
	const shortcut *s
#ifndef DISABLE_TABCOMP
	, bool *list
#endif
	);
467
468
int do_prompt(bool allow_tabs, const shortcut *s, const char
	*curranswer,
469
#ifndef NANO_TINY
470
471
472
	filestruct **history_list,
#endif
	const char *msg, ...);
473
474
void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
475

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

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

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

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

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

#endif /* !PROTO_H */