1 /* 2 * Copyright 2014 Garrett D'Amore <garrett@damore.org> 3 * 4 * This file is made available under the terms of the Less License. 5 */ 6 7 #include <regex.h> 8 9 struct mlist; 10 struct loption; 11 12 void *ecalloc(int, unsigned int); 13 char *easprintf(const char *, ...); 14 char *estrdup(const char *); 15 char *skipsp(char *); 16 int sprefix(char *, char *, int); 17 void quit(int); 18 void raw_mode(int); 19 char *special_key_str(int); 20 void get_term(void); 21 void init(void); 22 void deinit(void); 23 void home(void); 24 void add_line(void); 25 void lower_left(void); 26 void line_left(void); 27 void goto_line(int); 28 void vbell(void); 29 void ring_bell(void); 30 void do_clear(void); 31 void clear_eol(void); 32 void clear_bot(void); 33 void at_enter(int); 34 void at_exit(void); 35 void at_switch(int); 36 int is_at_equiv(int, int); 37 int apply_at_specials(int); 38 void putbs(void); 39 void match_brac(int, int, int, int); 40 int ch_get(void); 41 void ch_ungetchar(int); 42 void end_logfile(void); 43 void sync_logfile(void); 44 int ch_seek(off_t); 45 int ch_end_seek(void); 46 int ch_beg_seek(void); 47 off_t ch_length(void); 48 off_t ch_tell(void); 49 int ch_forw_get(void); 50 int ch_back_get(void); 51 void ch_setbufspace(int); 52 void ch_flush(void); 53 int seekable(int); 54 void ch_set_eof(void); 55 void ch_init(int, int); 56 void ch_close(void); 57 int ch_getflags(void); 58 void init_charset(void); 59 int binary_char(LWCHAR); 60 int control_char(LWCHAR); 61 char *prchar(LWCHAR); 62 char *prutfchar(LWCHAR); 63 int utf_len(char); 64 int is_utf8_well_formed(const char *); 65 LWCHAR get_wchar(const char *); 66 void put_wchar(char **, LWCHAR); 67 LWCHAR step_char(char **, int, char *); 68 int is_composing_char(LWCHAR); 69 int is_ubin_char(LWCHAR); 70 int is_wide_char(LWCHAR); 71 int is_combining_char(LWCHAR, LWCHAR); 72 void cmd_reset(void); 73 void clear_cmd(void); 74 void cmd_putstr(char *); 75 int len_cmdbuf(void); 76 void set_mlist(void *, int); 77 void cmd_addhist(struct mlist *, const char *); 78 void cmd_accept(void); 79 int cmd_char(int); 80 off_t cmd_int(long *); 81 char *get_cmdbuf(void); 82 char *cmd_lastpattern(void); 83 void init_cmdhist(void); 84 void save_cmdhist(void); 85 int in_mca(void); 86 void dispversion(void); 87 int getcc(void); 88 void ungetcc(int); 89 void ungetsc(char *); 90 void commands(void); 91 int cvt_length(int); 92 int *cvt_alloc_chpos(int); 93 void cvt_text(char *, char *, int *, int *, int); 94 void init_cmds(void); 95 void add_fcmd_table(char *, int); 96 void add_ecmd_table(char *, int); 97 int fcmd_decode(const char *, char **); 98 int ecmd_decode(const char *, char **); 99 char *lgetenv(char *); 100 int lesskey(char *, int); 101 void add_hometable(char *, char *, int); 102 int editchar(int, int); 103 void init_textlist(struct textlist *, char *); 104 char *forw_textlist(struct textlist *, char *); 105 char *back_textlist(struct textlist *, char *); 106 int edit(char *); 107 int edit_ifile(IFILE); 108 int edit_list(char *); 109 int edit_first(void); 110 int edit_last(void); 111 int edit_next(int); 112 int edit_prev(int); 113 int edit_index(int); 114 IFILE save_curr_ifile(void); 115 void unsave_ifile(IFILE); 116 void reedit_ifile(IFILE); 117 void reopen_curr_ifile(void); 118 int edit_stdin(void); 119 void cat_file(void); 120 void use_logfile(char *); 121 char *shell_unquote(char *); 122 char *get_meta_escape(void); 123 char *shell_quote(const char *); 124 char *homefile(char *); 125 char *fexpand(char *); 126 char *fcomplete(char *); 127 int bin_file(int f); 128 char *lglob(char *); 129 char *open_altfile(char *, int *, void **); 130 void close_altfile(char *, char *, void *); 131 int is_dir(char *); 132 char *bad_file(char *); 133 off_t filesize(int); 134 char *last_component(char *); 135 int eof_displayed(void); 136 int entire_file_displayed(void); 137 void squish_check(void); 138 void forw(int, off_t, int, int, int); 139 void back(int, off_t, int, int); 140 void forward(int, int, int); 141 void backward(int, int, int); 142 int get_back_scroll(void); 143 void del_ifile(IFILE); 144 IFILE next_ifile(IFILE); 145 IFILE prev_ifile(IFILE); 146 IFILE getoff_ifile(IFILE); 147 int nifile(void); 148 IFILE get_ifile(char *, IFILE); 149 char *get_filename(IFILE); 150 int get_index(IFILE); 151 void store_pos(IFILE, struct scrpos *); 152 void get_pos(IFILE, struct scrpos *); 153 int opened(IFILE); 154 void hold_ifile(IFILE, int); 155 int held_ifile(IFILE); 156 void set_open(IFILE); 157 void *get_filestate(IFILE); 158 void set_filestate(IFILE, void *); 159 off_t forw_line(off_t); 160 off_t back_line(off_t); 161 void set_attnpos(off_t); 162 void jump_forw(void); 163 void jump_back(off_t); 164 void repaint(void); 165 void jump_percent(int, long); 166 void jump_line_loc(off_t, int); 167 void jump_loc(off_t, int); 168 void init_line(void); 169 int is_ascii_char(LWCHAR); 170 void prewind(void); 171 void plinenum(off_t); 172 void pshift_all(void); 173 int is_ansi_end(LWCHAR); 174 int is_ansi_middle(LWCHAR); 175 int pappend(char, off_t); 176 int pflushmbc(void); 177 void pdone(int, int); 178 void set_status_col(char); 179 int gline(int, int *); 180 void null_line(void); 181 off_t forw_raw_line(off_t, char **, int *); 182 off_t back_raw_line(off_t, char **, int *); 183 void clr_linenum(void); 184 void add_lnum(off_t, off_t); 185 off_t find_linenum(off_t); 186 off_t find_pos(off_t); 187 off_t currline(int); 188 void lsystem(const char *, const char *); 189 int pipe_mark(int, char *); 190 void init_mark(void); 191 int badmark(int); 192 void setmark(int); 193 void lastmark(void); 194 void gomark(int); 195 off_t markpos(int); 196 void unmark(IFILE); 197 void opt_o(int, char *); 198 void opt__O(int, char *); 199 void opt_j(int, char *); 200 void calc_jump_sline(void); 201 void opt_shift(int, char *); 202 void calc_shift_count(void); 203 void opt_k(int, char *); 204 void opt_t(int, char *); 205 void opt__T(int, char *); 206 void opt_p(int, char *); 207 void opt__P(int, char *); 208 void opt_b(int, char *); 209 void opt_i(int, char *); 210 void opt__V(int, char *); 211 void opt_x(int, char *); 212 void opt_quote(int, char *); 213 void opt_query(int, char *); 214 int get_swindow(void); 215 char *propt(int); 216 void scan_option(char *); 217 void toggle_option(struct loption *, int, char *, int); 218 int opt_has_param(struct loption *); 219 char *opt_prompt(struct loption *); 220 int isoptpending(void); 221 void nopendopt(void); 222 int getnum(char **, char *, int *); 223 long getfraction(char **, char *, int *); 224 int get_quit_at_eof(void); 225 void init_option(void); 226 struct loption *findopt(int); 227 struct loption *findopt_name(char **, char **, int *); 228 int iread(int, unsigned char *, unsigned int); 229 char *errno_message(char *); 230 int percentage(off_t, off_t); 231 off_t percent_pos(off_t, int, long); 232 void put_line(void); 233 void flush(int); 234 int putchr(int); 235 void putstr(const char *); 236 void get_return(void); 237 void error(const char *, PARG *); 238 void ierror(const char *, PARG *); 239 int query(const char *, PARG *); 240 int compile_pattern(char *, int, regex_t **); 241 void uncompile_pattern(regex_t **); 242 int match_pattern(void *, char *, char *, int, char **, char **, 243 int, int); 244 off_t position(int); 245 void add_forw_pos(off_t); 246 void add_back_pos(off_t); 247 void pos_clear(void); 248 void pos_init(void); 249 int onscreen(off_t); 250 int empty_screen(void); 251 int empty_lines(int, int); 252 void get_scrpos(struct scrpos *); 253 int adjsline(int); 254 void init_prompt(void); 255 char *pr_expand(const char *, int); 256 char *eq_message(void); 257 char *prompt_string(void); 258 char *wait_message(void); 259 void init_search(void); 260 void repaint_hilite(int); 261 void clear_attn(void); 262 void undo_search(void); 263 void clr_hilite(void); 264 int is_filtered(off_t); 265 int is_hilited(off_t, off_t, int, int *); 266 void chg_caseless(void); 267 void chg_hilite(void); 268 int search(int, char *, int); 269 void prep_hilite(off_t, off_t, int); 270 void set_filter_pattern(char *, int); 271 int is_filtering(void); 272 void sigwinch(int); 273 void init_signals(int); 274 void psignals(void); 275 void cleantags(void); 276 void findtag(char *); 277 off_t tagsearch(void); 278 char *nexttag(int); 279 char *prevtag(int); 280 int ntags(void); 281 int curr_tag(void); 282 int edit_tagfile(void); 283 void open_getchr(void); 284 int getchr(void); 285 void *lsignal(int, void (*)(int)); 286 char *helpfile(void); 287