proto.h 21.2 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
64
#ifndef DISABLE_HELP
extern char *help_text;
#endif
Chris Allegretta's avatar
Chris Allegretta committed
65
66
extern char *last_search;
extern char *last_replace;
67
68
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
69
extern char *full_operating_dir;
70
#endif
71
#ifndef DISABLE_SPELLER
72
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
73
74
#endif

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

82
extern openfilestruct *openfile;
83

84
#ifdef ENABLE_COLOR
85
extern syntaxtype *syntaxes;
86
extern char *syntaxstr;
87
88
#endif

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

Chris Allegretta's avatar
Chris Allegretta committed
107
extern const shortcut *currshortcut;
108
109

#ifdef HAVE_REGEX_H
110
extern regex_t search_regexp;
111
extern regmatch_t regmatches[10];
112
#ifdef ENABLE_COLOR
113
extern regex_t syntaxfile_regexp;
114
extern regmatch_t synfilematches[1];
Chris Allegretta's avatar
Chris Allegretta committed
115
#endif /* ENABLE_COLOR */
Chris Allegretta's avatar
Chris Allegretta committed
116
#endif /* HAVE_REGEX_H */
117

Chris Allegretta's avatar
Chris Allegretta committed
118
#ifndef NANO_SMALL
119
extern toggle *toggles;
120
#endif
121

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

131
extern bool curses_ended;
132

133
134
extern char *homedir;

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
135
/* The functions we want available. */
136

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

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

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

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

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

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

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

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
/* 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);

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

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

526
527
/* Public functions in text.c. */
#ifndef NANO_SMALL
528
529
530
531
532
533
534
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
void do_tab(void);
void do_enter(void);
#ifndef NANO_SMALL
535
536
void cancel_command(int signal);
bool execute_command(const char *command);
537
#endif
538
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
#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 */
564
565
566
567
568
569
#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
570
#ifndef NANO_SMALL
571
void do_wordlinechar_count(void);
572
573
574
#endif

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

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

#endif /* !PROTO_H */