proto.h 21.1 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
39
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
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
57
58
59
#ifndef NANO_SMALL
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;
Chris Allegretta's avatar
Chris Allegretta committed
91
92
93
#ifndef NANO_SMALL
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];
Chris Allegretta's avatar
Chris Allegretta committed
112
#endif /* ENABLE_COLOR */
Chris Allegretta's avatar
Chris Allegretta committed
113
#endif /* HAVE_REGEX_H */
114

Chris Allegretta's avatar
Chris Allegretta committed
115
#ifndef NANO_SMALL
116
extern toggle *toggles;
117
#endif
118

119
#ifndef NANO_SMALL
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

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

204
/* Public functions in color.c. */
Chris Allegretta's avatar
Chris Allegretta committed
205
#ifdef ENABLE_COLOR
206
void set_colorpairs(void);
207
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
208
void color_update(void);
Chris Allegretta's avatar
Chris Allegretta committed
209
#endif /* ENABLE_COLOR */
210

211
/* Public functions in cut.c. */
212
void cutbuffer_reset(void);
213
void cut_line(void);
214
#ifndef NANO_SMALL
215
216
void cut_marked(void);
void cut_to_eol(void);
217
#endif
218
void do_cut_text(void);
219
220
221
#ifndef NANO_SMALL
void do_cut_till_end(void);
#endif
222
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
223

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

295
/* Public functions in global.c. */
296
size_t length_of_list(const shortcut *s);
297
#ifndef NANO_SMALL
298
void toggle_init_one(int val, const char *desc, long flag);
299
300
void toggle_init(void);
#endif
301
302
303
304
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
	const char *help,
#endif
305
	int metaval, int funcval, int miscval, bool view, void
306
	(*func)(void));
307
void shortcut_init(bool unjustify);
308
void free_shortcutage(shortcut **shortcutage);
Chris Allegretta's avatar
Chris Allegretta committed
309
310
#ifdef DEBUG
void thanks_for_all_the_fish(void);
311
312
#endif

313
314
315
/* Public functions in help.c. */
#ifndef DISABLE_HELP
void do_help(void);
316
void help_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
317
size_t help_line_len(const char *ptr);
318
319
#endif

320
/* Public functions in move.c. */
321
322
323
324
void do_first_line(void);
void do_last_line(void);
void do_page_up(void);
void do_page_down(void);
325
326
327
328
329
330
#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
331
332
333
334
335
336
#ifndef NANO_SMALL
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
337
338
void do_home(void);
void do_end(void);
339
void do_up(void);
340
341
342
#ifndef NANO_SMALL
void do_scroll_up(void);
#endif
343
void do_down(void);
344
345
346
#ifndef NANO_SMALL
void do_scroll_down(void);
#endif
347
348
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
349

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

420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
/* 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);
#ifndef NANO_SMALL
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);
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
void nanoget_repaint(const char *buf, size_t x);
int nanogetstr(bool allow_tabs, const char *curranswer,
#ifndef NANO_SMALL
	filestruct **history_list,
#endif
	const shortcut *s
#ifndef DISABLE_TABCOMP
	, bool *list
#endif
	);
int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
#ifndef NANO_SMALL
	filestruct **history_list,
#endif
	const char *msg, ...);
void statusq_abort(void);

459
/* Public functions in rcfile.c. */
460
#ifdef ENABLE_NANORC
461
462
463
464
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
465
short color_to_short(const char *colorname, bool *bright);
466
char *parse_next_regex(char *ptr);
467
bool nregcomp(const char *regex, int eflags);
468
void parse_syntax(char *ptr);
469
void parse_colors(char *ptr, bool icase);
470
471
#endif /* ENABLE_COLOR */
void parse_rcfile(FILE *rcstream);
472
void do_rcfile(void);
473
#endif /* ENABLE_NANORC */
474

475
/* Public functions in search.c. */
476
#ifdef HAVE_REGEX_H
477
int regexp_init(const char *regexp);
478
479
480
481
482
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
void search_abort(void);
void search_init_globals(void);
483
int search_init(bool replacing, bool use_answer);
484
bool findnextstr(bool can_display_wrap, bool wholeword, bool
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
485
	no_sameline, const filestruct *begin, size_t begin_x, const char
486
	*needle, size_t *needle_len);
487
void findnextstr_wrap_reset(void);
488
void do_search(void);
489
#ifndef NANO_SMALL
490
void do_research(void);
491
#endif
492
493
void replace_abort(void);
#ifdef HAVE_REGEX_H
494
int replace_regexp(char *string, bool create);
495
#endif
496
char *replace_line(const char *needle);
497
498
499
ssize_t do_replace_loop(const char *needle, const filestruct
	*real_current, size_t *real_current_x, bool wholewords, bool
	*canceled);
500
void do_replace(void);
501
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
502
	bool interactive, bool save_pos, bool allow_update);
503
void do_gotolinecolumn_void(void);
504
#ifndef DISABLE_SPELLER
505
506
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
507
#endif
508
#ifndef NANO_SMALL
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
509
510
511
#ifdef HAVE_REGEX_H
void do_find_bracket(void);
#endif
512
#ifdef ENABLE_NANORC
513
bool history_has_changed(void);
514
#endif
515
void history_init(void);
516
void history_reset(const filestruct *h);
517
518
filestruct *find_history(const filestruct *h_start, const filestruct
	*h_end, const char *s, size_t len);
519
void update_history(filestruct **h, const char *s);
520
521
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
522
#ifndef DISABLE_TABCOMP
523
char *get_history_completion(filestruct **h, const char *s, size_t len);
524
#endif
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
525
#endif /* !NANO_SMALL */
Chris Allegretta's avatar
Chris Allegretta committed
526

527
528
/* Public functions in text.c. */
#ifndef NANO_SMALL
529
530
531
532
533
534
535
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
void do_tab(void);
void do_enter(void);
#ifndef NANO_SMALL
536
537
void cancel_command(int signal);
bool execute_command(const char *command);
538
#endif
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
#endif
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
ssize_t break_line(const char *line, ssize_t goal, bool newline);
#endif
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
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);
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
	quote_len);
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);
#endif /* !DISABLE_JUSTIFY */
565
566
567
568
569
570
#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
571
#ifndef NANO_SMALL
572
void do_wordlinechar_count(void);
573
574
575
#endif

/* Public functions in utils.c. */
576
int digits(size_t n);
577
void get_homedir(void);
578
bool parse_num(const char *str, ssize_t *val);
579
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
580
void align(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
581
582
583
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
584
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
585
586
587
588
589
590
#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
591
#endif /* !NANO_SMALL && ENABLE_NANORC */
592
593
594
595
596
597
598
599
#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
bool is_whole_word(size_t pos, const char *buf, const char *word);
600
const char *strstrwrapper(const char *haystack, const char *needle,
601
	const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
602
603
604
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
605
char *mallocstrncpy(char *dest, const char *src, size_t n);
606
char *mallocstrcpy(char *dest, const char *src);
607
char *mallocstrassn(char *dest, char *src);
608
size_t get_page_start(size_t column);
609
610
611
612
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
613
void new_magicline(void);
614
#ifndef NANO_SMALL
615
void remove_magicline(void);
616
void mark_order(const filestruct **top, size_t *top_x, const filestruct
617
	**bot, size_t *bot_x, bool *right_side_up);
618
#endif
619
size_t get_totsize(const filestruct *begin, const filestruct *end);
620
621
622
623
624
625
626
#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
627

628
/* Public functions in winio.c. */
629
630
631
#ifndef NANO_SMALL
void reset_kbinput(void);
#endif
632
633
void get_key_buffer(WINDOW *win);
size_t get_key_buffer_len(void);
634
void unget_input(int *input, size_t input_len);
635
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
636
int *get_input(WINDOW *win, size_t input_len);
637
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
638
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
639
#ifndef NANO_SMALL
640
	, bool reset
641
642
#endif
	);
643
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
644
	*ignore_seq);
645
int get_escape_seq_abcd(int kbinput);
646
647
648
649
650
int get_byte_kbinput(int kbinput
#ifndef NANO_SMALL
	, bool reset
#endif
	);
651
long get_unicode_kbinput(int kbinput
652
#ifndef NANO_SMALL
653
	, bool reset
654
655
#endif
	);
656
int get_control_kbinput(int kbinput);
657
void unparse_kbinput(char *output, size_t output_len);
658
659
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
660
#ifndef DISABLE_MOUSE
661
662
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
#endif
663
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
664
	*meta_key, bool *func_key);
665
666
667
#ifndef NANO_SMALL
const toggle *get_toggle(int kbinput, bool meta_key);
#endif
668
void blank_line(WINDOW *win, int y, int x, int n);
669
void blank_titlebar(void);
670
void blank_topbar(void);
671
672
void blank_edit(void);
void blank_statusbar(void);
673
void blank_bottombars(void);
674
void check_statusblank(void);
675
676
char *display_string(const char *buf, size_t start_col, size_t len, bool
	dollars);
677
void titlebar(const char *path);
678
679
void set_modified(void);
void statusbar(const char *msg, ...);
680
void bottombars(const shortcut *s);
681
void onekey(const char *keystroke, const char *desc, size_t len);
682
void reset_cursor(void);
683
684
void edit_draw(const filestruct *fileptr, const char *converted, int
	line, size_t start);
685
void update_line(const filestruct *fileptr, size_t index);
686
687
bool need_horizontal_update(size_t old_pww);
bool need_vertical_update(size_t old_pww);
688
void edit_scroll(scroll_dir direction, ssize_t nlines);
689
void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta's avatar
Chris Allegretta committed
690
void edit_refresh(void);
691
void edit_update(update_type location);
692
int do_yesno(bool all, const char *msg);
693
void total_redraw(void);
694
void total_refresh(void);
695
void display_main_list(void);
696
void do_cursorpos(bool constant);
697
void do_cursorpos_void(void);
698
void do_replace_highlight(bool highlight, const char *word);
Chris Allegretta's avatar
Chris Allegretta committed
699
700
#ifdef NANO_EXTRA
void do_credits(void);
701
#endif
702
703

#endif /* !PROTO_H */