proto.h 9.41 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-2002 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
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *   any later version.                                                   *
 *                                                                        *
 *   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.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

/* Externs */

#include <sys/stat.h>
25
26

#ifdef HAVE_REGEX_H
27
#include <regex.h>
28
29
#endif

Chris Allegretta's avatar
Chris Allegretta committed
30
31
#include "nano.h"

32
extern int editwinrows;
Chris Allegretta's avatar
Chris Allegretta committed
33
extern int current_x, current_y, totlines;
Chris Allegretta's avatar
Chris Allegretta committed
34
35
extern int placewewant;
extern int mark_beginx, samelinewrap;
36
37
extern long totsize;
extern int temp_opt;
38
extern int fill, wrap_at, flags,tabsize;
Chris Allegretta's avatar
Chris Allegretta committed
39
extern int search_last_line;
40
extern int currslen;
Chris Allegretta's avatar
Chris Allegretta committed
41

42
#ifndef DISABLE_JUSTIFY
Chris Allegretta's avatar
Chris Allegretta committed
43
extern char *quotestr;
44
45
#endif

Chris Allegretta's avatar
Chris Allegretta committed
46
extern WINDOW *edit, *topwin, *bottomwin;
Chris Allegretta's avatar
Chris Allegretta committed
47
extern char *filename;
48
extern char *answer;
Chris Allegretta's avatar
Chris Allegretta committed
49
extern char *hblank, *help_text;
Chris Allegretta's avatar
Chris Allegretta committed
50
51
extern char *last_search;
extern char *last_replace;
52
53
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
54
extern char *full_operating_dir;
55
#endif
56
57
58
#ifndef DISABLE_SPELLER
extern  char *alt_speller;
#endif
Chris Allegretta's avatar
Chris Allegretta committed
59
60
61
extern struct stat fileinfo;
extern filestruct *current, *fileage, *edittop, *editbot, *filebot; 
extern filestruct *cutbuffer, *mark_beginbuf;
62

63
#ifdef ENABLE_MULTIBUFFER
64
extern openfilestruct *open_files;
65
66
#endif

67
#ifdef ENABLE_COLOR
Chris Allegretta's avatar
Chris Allegretta committed
68
extern colortype *colorstrings;
69
extern syntaxtype *syntaxes;
70
extern char *syntaxstr;
71
72
#endif

Chris Allegretta's avatar
Chris Allegretta committed
73
extern shortcut *shortcut_list;
74
75
76
extern shortcut *main_list, *whereis_list;
extern shortcut *replace_list, *goto_list;
extern shortcut *writefile_list, *insertfile_list;
Chris Allegretta's avatar
Chris Allegretta committed
77
78
79
80
extern shortcut *spell_list, *replace_list_2;
#ifndef NANO_SMALL
extern shortcut *extcmd_list;
#endif
81
extern shortcut *help_list;
82
#ifndef DISABLE_BROWSER
83
extern shortcut *browser_list, *gotodir_list;
Chris Allegretta's avatar
Chris Allegretta committed
84
#endif
85
extern shortcut *currshortcut;
86
87

#ifdef HAVE_REGEX_H
88
89
90
extern int use_regexp, regexp_compiled;
extern regex_t search_regexp;
extern regmatch_t regmatches[10];  
91
92
93
94

#ifdef ENABLE_COLOR
extern regex_t color_regexp;
extern regmatch_t colormatches[1];  
95
96
97

extern regex_t syntaxfile_regexp;
extern regmatch_t synfilematches[1];  
Chris Allegretta's avatar
Chris Allegretta committed
98
#endif /* ENABLE_COLOR */
99
100
#endif

101
extern toggle *toggles;
Chris Allegretta's avatar
Chris Allegretta committed
102
103
104

/* Programs we want available */

105
106
107
/* public functions in global.c */
int length_of_list(const shortcut *s);
void shortcut_init(int unjustify);
108
#ifdef DEBUG
109
void thanks_for_all_the_fish(void);
110
#endif
111
112
113



Chris Allegretta's avatar
Chris Allegretta committed
114
char *revstrstr(char *haystack, char *needle, char *rev_start);
115
116
char *stristr(char *haystack, char *needle);
char *revstristr(char *haystack, char *needle, char *rev_start);
117
char *strstrwrapper(char *haystack, char *needle, char *rev_start, int line_pos);
Chris Allegretta's avatar
Chris Allegretta committed
118
119
120
int search_init(int replacing);
int renumber(filestruct * fileptr);
int free_filestruct(filestruct * src);
121
122
123
124
125

#ifdef ENABLE_MULTIBUFFER
int free_openfilestruct(openfilestruct * src);
#endif

Chris Allegretta's avatar
Chris Allegretta committed
126
127
128
int xplustabs(void);
int do_yesno(int all, int leavecursor, char *msg, ...);
int actual_x(filestruct * fileptr, int xplus);
129
int strnlenpt(char *buf, int size);
Chris Allegretta's avatar
Chris Allegretta committed
130
int strlenpt(char *buf);
131
int statusq(int allowtabs, shortcut s[], char *def, char *msg, ...);
132
int write_file(char *name, int tmpfile, int append, int nonamechange);
Chris Allegretta's avatar
Chris Allegretta committed
133
134
135
int do_cut_text(void);
int do_uncut_text(void);
int no_help(void);
Chris Allegretta's avatar
Chris Allegretta committed
136
int renumber_all(void);
Chris Allegretta's avatar
Chris Allegretta committed
137
int open_file(const char *filename, int insert, int quiet);
138
int do_insertfile(int loading_file);
139
int num_of_digits(int n);
140
int open_pipe(char *command);
Chris Allegretta's avatar
Chris Allegretta committed
141
int read_file(FILE *f, const char *filename, int quiet);
142

143
#ifdef ENABLE_MULTIBUFFER
144
int add_open_file(int update);
145
146
#endif

147
148
149
150
#ifndef DISABLE_OPERATINGDIR
int check_operating_dir(char *currpath, int allow_tabcomp);
#endif

151
152
153
154
155
#ifndef NANO_SMALL
int do_next_word_void(void);
int do_prev_word_void(void);
#endif /* !NANO_SMALL */

156
int do_writeout(char *path, int exiting, int append);
157
int do_gotoline(int line, int save_pos);
158
int is_whole_word(int curr_pos, filestruct *fileptr, char *searchword);
Chris Allegretta's avatar
Chris Allegretta committed
159
160
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
			int wholewords, int *i);
161
int do_find_bracket(void);
162

163
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
164
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
165
166
#endif

Chris Allegretta's avatar
Chris Allegretta committed
167
168
169
170
171
/* Now in move.c */
int do_up(void);
int do_down(void);
int do_left(void);
int do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
172
int check_wildcard_match(const char *text, const char *pattern);
173

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
174
char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list);
175
char *real_dir_from_tilde(char *buf);
Chris Allegretta's avatar
Chris Allegretta committed
176

Chris Allegretta's avatar
Chris Allegretta committed
177
void signal_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
178
179
void unsunder(char *str, int true_len);
void sunder(char *str);
Chris Allegretta's avatar
Chris Allegretta committed
180
181
void lowercase(char *src);
void blank_bottombars(void);
Chris Allegretta's avatar
Chris Allegretta committed
182
void check_wrap(filestruct * inptr);
Chris Allegretta's avatar
Chris Allegretta committed
183
184
void dump_buffer(filestruct * inptr);
void align(char **strp);
185
void edit_refresh(void), edit_refresh_clearok(void);
186
void edit_update(filestruct * fileptr, int topmidbotnone);
Chris Allegretta's avatar
Chris Allegretta committed
187
188
void update_cursor(void);
void delete_node(filestruct * fileptr);
189
190
191
192
193

#ifdef ENABLE_MULTIBUFFER
void delete_opennode(openfilestruct * fileptr);
#endif

Chris Allegretta's avatar
Chris Allegretta committed
194
195
196
197
198
void set_modified(void);
void dump_buffer_reverse(filestruct * inptr);
void reset_cursor(void);
void check_statblank(void);
void update_line(filestruct * fileptr, int index);
Robert Siemborski's avatar
Robert Siemborski committed
199
void fix_editbot(void);
Chris Allegretta's avatar
Chris Allegretta committed
200
void statusbar(char *msg, ...);
Chris Allegretta's avatar
Chris Allegretta committed
201
202
void blank_statusbar(void);
void titlebar(char *path);
Chris Allegretta's avatar
Chris Allegretta committed
203
204
void previous_line(void);
void center_cursor(void);
205
void bottombars(const shortcut *s);
Chris Allegretta's avatar
Chris Allegretta committed
206
void blank_statusbar_refresh(void);
207
void nperror(const char *s);
208
void *mallocstrcpy(char *dest, char *src);
Chris Allegretta's avatar
Chris Allegretta committed
209
210
211
void wrap_reset(void);
void display_main_list(void);
void nano_small_msg(void);
212
void nano_disable_msg(void);
Chris Allegretta's avatar
Chris Allegretta committed
213
214
215
216
void do_early_abort(void);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
void die(char *msg, ...);
217
void die_save_file(char *die_filename);
Chris Allegretta's avatar
Chris Allegretta committed
218
void new_file(void);
Robert Siemborski's avatar
Robert Siemborski committed
219
void new_magicline(void);
220
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
221
222
223
224
225

#ifdef ENABLE_MULTIBUFFER
void splice_opennode(openfilestruct *begin, openfilestruct *newnode, openfilestruct *end);
#endif

226
void null_at(char **data, int index);
227
void page_up(void);
Chris Allegretta's avatar
Chris Allegretta committed
228
void blank_edit(void);
Chris Allegretta's avatar
Chris Allegretta committed
229
230
void search_init_globals(void);
void replace_abort(void);
231
void add_to_cutbuffer(filestruct * inptr);
232
void do_replace_highlight(int highlight_flag, char *word);
233
void nano_disabled_msg(void);
234
void window_init(void);
235
void do_mouse(void);
Chris Allegretta's avatar
Chris Allegretta committed
236
void print_view_warning(void);
237
void unlink_node(filestruct * fileptr);
238
239
240
241
242

#ifdef ENABLE_MULTIBUFFER
void unlink_opennode(openfilestruct * fileptr);
#endif

243
244
void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
                        int bot_x, int destructive);
245

246
#ifdef ENABLE_NANORC
247
248
249
void do_rcfile(void);
#endif

250
#ifdef NANO_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
251
void do_credits(void);
252
#endif
Chris Allegretta's avatar
Chris Allegretta committed
253
254

int do_writeout_void(void), do_exit(void), do_gotoline_void(void);
255
256
int do_insertfile_void(void), do_search(void);

257
#ifdef ENABLE_MULTIBUFFER
258
259
260
int load_open_file(void), close_open_file(void);
#endif

261
int do_page_up(void), do_page_down(void);
262
int do_cursorpos(int constant), do_cursorpos_void(void), do_spell(void);
Chris Allegretta's avatar
Chris Allegretta committed
263
264
265
266
int do_home(void), do_end(void), total_refresh(void), do_mark(void);
int do_delete(void), do_backspace(void), do_tab(void), do_justify(void);
int do_first_line(void), do_last_line(void);
int do_replace(void), do_help(void), do_enter_void(void);
267
int keypad_on(WINDOW * win, int newval);
Chris Allegretta's avatar
Chris Allegretta committed
268

269
#ifdef ENABLE_MULTIBUFFER
270
int open_prevfile(int closing_file), open_nextfile(int closing_file);
271
int open_prevfile_void(void), open_nextfile_void(void);
272
273
#endif

274
char *charalloc (size_t howmuch);
Chris Allegretta's avatar
Chris Allegretta committed
275
char *get_next_filename(const char *name);
276

277
#if !defined (DISABLE_SPELLER) || !defined (DISABLE_OPERATINGDIR)
278
279
280
281
char *get_full_path(const char *origpath);
#endif

#ifndef DISABLE_SPELLER
282
char *check_writable_directory(const char *path);
283
char *safe_tempnam(const char *dirname, const char *filename_prefix);
284
285
#endif

286
#ifndef DISABLE_BROWSER
Chris Allegretta's avatar
Chris Allegretta committed
287
char *do_browser(char *path);
288
289
struct stat filestat(const char *path);
char *do_browse_from(char *inpath);
Chris Allegretta's avatar
Chris Allegretta committed
290
291
#endif

292
293
294
295
#ifdef ENABLE_COLOR
int do_colorinit(void);
void color_on(WINDOW *win, int whatever);
void color_off(WINDOW *win, int whatever);
296
void update_color(void);
297
298
299
300

extern colorstruct colors[NUM_NCOLORS];
#endif /* ENABLE_COLOR */

301
RETSIGTYPE main_loop (int junk);
302

Chris Allegretta's avatar
Chris Allegretta committed
303
304
305
filestruct *copy_node(filestruct * src);
filestruct *copy_filestruct(filestruct * src);
filestruct *make_new_node(filestruct * prevnode);
306
307
308
309
310

#ifdef ENABLE_MULTIBUFFER
openfilestruct *make_new_opennode(openfilestruct * prevnode);
#endif

311
filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin,
Chris Allegretta's avatar
Chris Allegretta committed
312
			int beginx, char *needle);
313

314
315
316
#ifndef DISABLE_HELP
void help_init(void);
#endif