xref: /freebsd/contrib/less/funcs.h (revision b55f5e1c4ae375d92dfd597901f238a230e868da)
1 public char * saven(constant char *s, size_t n);
2 public char * save(constant char *s);
3 public void out_of_memory(void);
4 public void * ecalloc(size_t count, size_t size);
5 public char * skipsp(char *s);
6 public constant char * skipspc(constant char *s);
7 public size_t sprefix(constant char *ps, constant char *s, int uppercase);
8 public void quit(int status);
9 public int secure_allow(int features);
10 public void raw_mode(int on);
11 public void screen_size_changed(void);
12 public constant char * special_key_str(int key);
13 public void init_win_colors(void);
14 public void get_term(void);
15 public void init_mouse(void);
16 public void deinit_mouse(void);
17 public void init(void);
18 public void deinit(void);
19 public int interactive(void);
20 public void home(void);
21 public void dump_screen(void);
22 public void add_line(void);
23 public void remove_top(int n);
24 public void win32_scroll_up(int n);
25 public void lower_left(void);
26 public void line_left(void);
27 public void check_winch(void);
28 public void goto_line(int sindex);
29 public void vbell(void);
30 public void bell(void);
31 public void clear(void);
32 public void clear_eol(void);
33 public void clear_bot(void);
34 public COLOR_TYPE parse_color(constant char *str, mutable int *p_fg, mutable int *p_bg, mutable CHAR_ATTR *p_cattr);
35 public void at_enter(int attr);
36 public void at_exit(void);
37 public void at_switch(int attr);
38 public lbool is_at_equiv(int attr1, int attr2);
39 public int apply_at_specials(int attr);
40 public void putbs(void);
41 public void WIN32ungetch(int ch);
42 public lbool win32_kbhit(void);
43 public char WIN32getch(void);
44 public void win32_getch_clear(void);
45 public void WIN32setcolors(int fg, int bg);
46 public void WIN32textout(constant char *text, size_t len);
47 public void match_brac(char obrac, char cbrac, int forwdir, int n);
48 public void ch_ungetchar(int c);
49 public void end_logfile(void);
50 public void sync_logfile(void);
51 public int ch_seek(POSITION pos);
52 public int ch_end_seek(void);
53 public int ch_end_buffer_seek(void);
54 public int ch_beg_seek(void);
55 public POSITION ch_length(void);
56 public POSITION ch_tell(void);
57 public int ch_forw_get(void);
58 public int ch_back_get(void);
59 public void ch_setbufspace(ssize_t bufspace);
60 public void ch_flush(void);
61 public int seekable(int f);
62 public void ch_set_eof(void);
63 public void ch_init(int f, int flags, ssize_t nread);
64 public void ch_close(void);
65 public int ch_getflags(void);
66 public void setfmt(constant char *s, constant char **fmtvarptr, int *attrptr, constant char *default_fmt, lbool for_printf);
67 public void init_charset(void);
68 public lbool binary_char(LWCHAR c);
69 public lbool control_char(LWCHAR c);
70 public constant char * prchar(LWCHAR c);
71 public constant char * prutfchar(LWCHAR ch);
72 public int utf_len(char ch);
73 public lbool is_utf8_well_formed(constant char *ss, int slen);
74 public void utf_skip_to_lead(constant char **pp, constant char *limit);
75 public LWCHAR get_wchar(constant char *sp);
76 public void put_wchar(mutable char **pp, LWCHAR ch);
77 public LWCHAR step_charc(constant char **pp, signed int dir, constant char *limit);
78 public LWCHAR step_char(char **pp, signed int dir, constant char *limit);
79 public lbool is_composing_char(LWCHAR ch);
80 public lbool is_ubin_char(LWCHAR ch);
81 public lbool is_wide_char(LWCHAR ch);
82 public lbool is_combining_char(LWCHAR ch1, LWCHAR ch2);
83 public void cmd_reset(void);
84 public void clear_cmd(void);
85 public void cmd_putstr(constant char *s);
86 public int len_cmdbuf(void);
87 public void cmd_repaint(constant char *old_cp);
88 public void set_mlist(void *mlist, int cmdflags);
89 public ssize_t save_updown_match(void);
90 public void restore_updown_match(ssize_t udm);
91 public void cmd_addhist(struct mlist *mlist, constant char *cmd, lbool modified);
92 public void cmd_accept(void);
93 public int cmd_char(char c);
94 public LINENUM cmd_int(mutable long *frac);
95 public constant char * get_cmdbuf(void);
96 public constant char * cmd_lastpattern(void);
97 public void init_cmdhist(void);
98 public void save_cmdhist(void);
99 public int in_mca(void);
100 public int norm_search_type(int st);
101 public void screen_trashed_num(int trashed);
102 public void screen_trashed(void);
103 public int is_screen_trashed(void);
104 public void dispversion(void);
105 public void getcc_clear(void);
106 public char getcc(void);
107 public void ungetcc(char c);
108 public void ungetcc_back(char c);
109 public void ungetcc_end_command(void);
110 public void ungetsc(constant char *s);
111 public char peekcc(void);
112 public void commands(void);
113 public size_t cvt_length(size_t len, int ops);
114 public int * cvt_alloc_chpos(size_t len);
115 public void cvt_text(mutable char *odst, constant char *osrc, mutable int *chpos, mutable size_t *lenp, int ops);
116 public void expand_cmd_tables(void);
117 public void init_cmds(void);
118 public void add_fcmd_table(unsigned char *buf, size_t len);
119 public void add_ecmd_table(unsigned char *buf, size_t len);
120 public void add_uvar_table(unsigned char *buf, size_t len);
121 public void add_sysvar_table(unsigned char *buf, size_t len);
122 public int fcmd_decode(constant char *cmd, constant char **sp);
123 public int ecmd_decode(constant char *cmd, constant char **sp);
124 public constant char * lgetenv(constant char *var);
125 public constant char * lgetenv_ext(constant char *var, unsigned char *env_buf, size_t env_buf_len);
126 public lbool isnullenv(constant char *s);
127 public int lesskey(constant char *filename, lbool sysvar);
128 public int lesskey_src(constant char *filename, lbool sysvar);
129 public int lesskey_content(constant char *content, lbool sysvar);
130 public int editchar(char c, int flags);
131 public void init_textlist(struct textlist *tlist, mutable char *str);
132 public constant char * forw_textlist(struct textlist *tlist, constant char *prev);
133 public constant char * back_textlist(struct textlist *tlist, constant char *prev);
134 public void close_altpipe(IFILE ifile);
135 public void check_altpipe_error(void);
136 public int edit(constant char *filename);
137 public int edit_ifile(IFILE ifile);
138 public int edit_list(char *filelist);
139 public int edit_first(void);
140 public int edit_last(void);
141 public int edit_next(int n);
142 public int edit_prev(int n);
143 public int edit_index(int n);
144 public IFILE save_curr_ifile(void);
145 public void unsave_ifile(IFILE save_ifile);
146 public void reedit_ifile(IFILE save_ifile);
147 public void reopen_curr_ifile(void);
148 public int edit_stdin(void);
149 public void cat_file(void);
150 public void use_logfile(constant char *filename);
151 public void expand_evars(mutable char *buf, size_t len, struct xbuffer *xbuf);
152 public char * shell_unquote(constant char *str);
153 public constant char * get_meta_escape(void);
154 public char * shell_quoten(constant char *s, size_t slen);
155 public char * shell_quote(constant char *s);
156 public char * dirfile(constant char *dirname, constant char *filename, int must_exist);
157 public char * homefile(constant char *filename);
158 public char * fexpand(constant char *s);
159 public char * fcomplete(constant char *s);
160 public int bin_file(int f, ssize_t *n);
161 public char * readfd(FILE *fd);
162 public char * lglob(constant char *afilename);
163 public lbool is_fake_pathname(constant char *path);
164 public char * lrealpath(constant char *path);
165 public char * open_altfile(constant char *filename, int *pf, void **pfd);
166 public void close_altfile(constant char *altfilename, constant char *filename);
167 public lbool is_dir(constant char *filename);
168 public char * bad_file(constant char *filename);
169 public POSITION filesize(int f);
170 public lbool curr_ifile_changed(void);
171 public constant char * shell_coption(void);
172 public constant char * last_component(constant char *name);
173 public void eof_bell(void);
174 public lbool eof_displayed(void);
175 public lbool entire_file_displayed(void);
176 public void squish_check(void);
177 public int overlay_header(void);
178 public void forw(int n, POSITION pos, lbool force, lbool only_last, int nblank);
179 public void back(int n, POSITION pos, lbool force, lbool only_last);
180 public void forward(int n, lbool force, lbool only_last);
181 public void backward(int n, lbool force, lbool only_last);
182 public int get_back_scroll(void);
183 public int get_one_screen(void);
184 public void del_ifile(IFILE h);
185 public IFILE next_ifile(IFILE h);
186 public IFILE prev_ifile(IFILE h);
187 public IFILE getoff_ifile(IFILE ifile);
188 public int nifile(void);
189 public IFILE get_ifile(constant char *filename, IFILE prev);
190 public constant char * get_filename(IFILE ifile);
191 public constant char * get_real_filename(IFILE ifile);
192 public int get_index(IFILE ifile);
193 public void store_pos(IFILE ifile, struct scrpos *scrpos);
194 public void get_pos(IFILE ifile, struct scrpos *scrpos);
195 public void set_open(IFILE ifile);
196 public int opened(IFILE ifile);
197 public void hold_ifile(IFILE ifile, int incr);
198 public int held_ifile(IFILE ifile);
199 public void * get_filestate(IFILE ifile);
200 public void set_filestate(IFILE ifile, void *filestate);
201 public void set_altpipe(IFILE ifile, void *p);
202 public void *get_altpipe(IFILE ifile);
203 public void set_altfilename(IFILE ifile, char *altfilename);
204 public char * get_altfilename(IFILE ifile);
205 public void if_dump(void);
206 public POSITION forw_line_seg(POSITION curr_pos, lbool skipeol, lbool rscroll, lbool nochop);
207 public POSITION forw_line(POSITION curr_pos);
208 public POSITION back_line(POSITION curr_pos);
209 public void set_attnpos(POSITION pos);
210 public void jump_forw(void);
211 public void jump_forw_buffered(void);
212 public void jump_back(LINENUM linenum);
213 public void repaint(void);
214 public void jump_percent(int percent, long fraction);
215 public void jump_line_loc(POSITION pos, int sline);
216 public POSITION after_header_pos(POSITION pos);
217 public void jump_loc(POSITION pos, int sline);
218 public void init_line(void);
219 public lbool is_ascii_char(LWCHAR ch);
220 public POSITION line_position(void);
221 public void prewind(void);
222 public void plinestart(POSITION pos);
223 public int line_pfx_width(void);
224 public void pshift_all(void);
225 public int pwidth(LWCHAR ch, int a, LWCHAR prev_ch, int prev_a);
226 public void savec(void);
227 public void loadc(void);
228 public lbool is_ansi_end(LWCHAR ch);
229 public lbool is_ansi_middle(LWCHAR ch);
230 public void skip_ansi(struct ansi_state *pansi, constant char **pp, constant char *limit);
231 public struct ansi_state * ansi_start(LWCHAR ch);
232 public ansi_state ansi_step(struct ansi_state *pansi, LWCHAR ch);
233 public osc8_state ansi_osc8_state(struct ansi_state *pansi);
234 public void ansi_done(struct ansi_state *pansi);
235 public int pappend_b(char c, POSITION pos, lbool before_pendc);
236 public int pappend(char c, POSITION pos);
237 public int pflushmbc(void);
238 public void pdone(int endline, int chopped, int forw);
239 public int col_from_pos(POSITION linepos, POSITION spos, POSITION saved_pos, int saved_col);
240 public POSITION pos_from_col(POSITION linepos, int col, POSITION saved_pos, int saved_col);
241 public void set_attr_line(int a);
242 public void set_status_col(char c, int attr);
243 public int gline(size_t i, int *ap);
244 public void null_line(void);
245 public POSITION forw_raw_line_len(POSITION curr_pos, size_t read_len, constant char **linep, size_t *line_lenp);
246 public POSITION forw_raw_line(POSITION curr_pos, constant char **linep, size_t *line_lenp);
247 public POSITION back_raw_line(POSITION curr_pos, constant char **linep, size_t *line_lenp);
248 public int skip_columns(int cols, constant char **linep, size_t *line_lenp);
249 public void load_line(constant char *str);
250 public int rrshift(void);
251 public int set_color_map(int attr, constant char *colorstr);
252 public constant char * get_color_map(int attr);
253 public void clr_linenum(void);
254 public void add_lnum(LINENUM linenum, POSITION pos);
255 public LINENUM find_linenum(POSITION pos);
256 public POSITION find_pos(LINENUM linenum);
257 public LINENUM currline(int where);
258 public void scan_eof(void);
259 public LINENUM vlinenum(LINENUM linenum);
260 public void lsystem(constant char *cmd, constant char *donemsg);
261 public int pipe_mark(char c, constant char *cmd);
262 public int pipe_data(constant char *cmd, POSITION spos, POSITION epos);
263 public void init_mark(void);
264 public int badmark(char c);
265 public void setmark(char c, int where);
266 public void clrmark(char c);
267 public void lastmark(void);
268 public void gomark(char c);
269 public POSITION markpos(char c);
270 public char posmark(POSITION pos);
271 public void unmark(IFILE ifile);
272 public void mark_check_ifile(IFILE ifile);
273 public void save_marks(FILE *fout, constant char *hdr);
274 public void restore_mark(constant char *line);
275 public void opt_o(int type, constant char *s);
276 public void opt__O(int type, constant char *s);
277 public void opt_j(int type, constant char *s);
278 public void calc_jump_sline(void);
279 public void opt_shift(int type, constant char *s);
280 public void calc_shift_count(void);
281 public void opt_k(int type, constant char *s);
282 public void opt_ks(int type, constant char *s);
283 public void opt_kc(int type, constant char *s);
284 public void opt__S(int type, constant char *s);
285 public void opt_t(int type, constant char *s);
286 public void opt__T(int type, constant char *s);
287 public void opt_p(int type, constant char *s);
288 public void opt__P(int type, constant char *s);
289 public void opt_b(int type, constant char *s);
290 public void opt_i(int type, constant char *s);
291 public void opt__V(int type, constant char *s);
292 public void opt_D(int type, constant char *s);
293 public void set_tabs(constant char *s, size_t len);
294 public void opt_x(int type, constant char *s);
295 public void opt_quote(int type, constant char *s);
296 public void opt_rscroll(int type, constant char *s);
297 public void opt_query(int type, constant char *s);
298 public void opt_match_shift(int type, constant char *s);
299 public void calc_match_shift(void);
300 public void opt_mousecap(int type, constant char *s);
301 public void opt_wheel_lines(int type, constant char *s);
302 public void opt_linenum_width(int type, constant char *s);
303 public void opt_status_col_width(int type, constant char *s);
304 public void opt_filesize(int type, constant char *s);
305 public void opt_intr(int type, constant char *s);
306 public int next_cnum(constant char **sp, constant char *printopt, constant char *errmsg, lbool *errp);
307 public void opt_header(int type, constant char *s);
308 public void opt_search_type(int type, constant char *s);
309 public void opt_nosearch_headers(int type, constant char *s);
310 public void opt_nosearch_header_lines(int type, constant char *s);
311 public void opt_nosearch_header_cols(int type, constant char *s);
312 public void opt_ttyin_name(int type, constant char *s);
313 public int chop_line(void);
314 public int get_swindow(void);
315 public constant char * propt(char c);
316 public void scan_option(constant char *s);
317 public void toggle_option(struct loption *o, int lower, constant char *s, int how_toggle);
318 public int opt_has_param(struct loption *o);
319 public constant char * opt_prompt(struct loption *o);
320 public constant char * opt_toggle_disallowed(int c);
321 public lbool isoptpending(void);
322 public void nopendopt(void);
323 public int getnumc(constant char **sp, constant char *printopt, lbool *errp);
324 public int getnum(char **sp, constant char *printopt, lbool *errp);
325 public long getfraction(constant char **sp, constant char *printopt, lbool *errp);
326 public void init_unsupport(void);
327 public int get_quit_at_eof(void);
328 public void init_option(void);
329 public struct loption * findopt(int c);
330 public struct loption * findopt_name(constant char **p_optname, constant char **p_oname, lbool *p_ambig);
331 public void init_poll(void);
332 public int supports_ctrl_x(void);
333 public ssize_t iread(int fd, unsigned char *buf, size_t len);
334 public void intread(void);
335 public time_type get_time(void);
336 public char * errno_message(constant char *filename);
337 public constant char * signal_message(int sig);
338 public uintmax umuldiv(uintmax val, uintmax num, uintmax den);
339 public int percentage(POSITION num, POSITION den);
340 public POSITION percent_pos(POSITION pos, int percent, long fraction);
341 public int os9_signal(int type, RETSIGTYPE (*handler)());
342 public void sleep_ms(int ms);
343 public void put_line(void);
344 public void flush(void);
345 public void set_output(int fd);
346 public int putchr(int ch);
347 public void clear_bot_if_needed(void);
348 public void putstr(constant char *s);
349 public int less_printf(constant char *fmt, PARG *parg);
350 public void get_return(void);
351 public void error(constant char *fmt, PARG *parg);
352 public void ierror(constant char *fmt, PARG *parg);
353 public void ixerror(constant char *fmt, PARG *parg);
354 public int query(constant char *fmt, PARG *parg);
355 public int compile_pattern(constant char *pattern, int search_type, int show_error, PATTERN_TYPE *comp_pattern);
356 public void uncompile_pattern(PATTERN_TYPE *pattern);
357 public int valid_pattern(char *pattern);
358 public lbool is_null_pattern(PATTERN_TYPE pattern);
359 public int match_pattern(PATTERN_TYPE pattern, constant char *tpattern, constant char *line, size_t line_len, constant char **sp, constant char **ep, int nsp, int notbol, int search_type);
360 public constant char * pattern_lib_name(void);
361 public POSITION position(int sindex);
362 public void add_forw_pos(POSITION pos);
363 public void add_back_pos(POSITION pos);
364 public void pos_clear(void);
365 public void pos_init(void);
366 public int onscreen(POSITION pos);
367 public int empty_screen(void);
368 public int empty_lines(int s, int e);
369 public void get_scrpos(struct scrpos *scrpos, int where);
370 public int sindex_from_sline(int sline);
371 public void pos_rehead(void);
372 public void init_prompt(void);
373 public constant char * pr_expand(constant char *proto);
374 public constant char * eq_message(void);
375 public constant char * pr_string(void);
376 public constant char * wait_message(void);
377 public void init_search(void);
378 public int get_cvt_ops(int search_type);
379 public void repaint_hilite(lbool on);
380 public void clear_attn(void);
381 public void undo_search(lbool clear);
382 public void clr_hlist(struct hilite_tree *anchor);
383 public void clr_hilite(void);
384 public void clr_filter(void);
385 public void set_header(POSITION pos);
386 public lbool is_filtered(POSITION pos);
387 public POSITION next_unfiltered(POSITION pos);
388 public POSITION prev_unfiltered(POSITION pos);
389 public int is_hilited_attr(POSITION pos, POSITION epos, int nohide, int *p_matches);
390 public void chg_hilite(void);
391 public void osc8_search(int search_type, constant char *param, int matches);
392 public lbool osc8_click(int sindex, int col);
393 public void osc8_open(void);
394 public void osc8_jump(void);
395 public void chg_caseless(void);
396 public int search(int search_type, constant char *pattern, int n);
397 public void prep_hilite(POSITION spos, POSITION epos, int maxlines);
398 public void set_filter_pattern(constant char *pattern, int search_type);
399 public lbool is_filtering(void);
400 public RETSIGTYPE winch(int type);
401 public void init_signals(int on);
402 public void psignals(void);
403 public void cleantags(void);
404 public int gettagtype(void);
405 public void findtag(constant char *tag);
406 public POSITION tagsearch(void);
407 public constant char * nexttag(int n);
408 public constant char * prevtag(int n);
409 public int ntags(void);
410 public int curr_tag(void);
411 public int edit_tagfile(void);
412 public lbool is_lesstest(void);
413 public int open_tty(void);
414 public void open_getchr(void);
415 public void close_getchr(void);
416 public int pclose(FILE *f);
417 public int default_wheel_lines(void);
418 public int getchr(void);
419 public void xbuf_init(struct xbuffer *xbuf);
420 public void xbuf_init_size(struct xbuffer *xbuf, size_t init_size);
421 public void xbuf_deinit(struct xbuffer *xbuf);
422 public void xbuf_reset(struct xbuffer *xbuf);
423 public void xbuf_add_byte(struct xbuffer *xbuf, unsigned char b);
424 public void xbuf_add_char(struct xbuffer *xbuf, char c);
425 public void xbuf_add_data(struct xbuffer *xbuf, constant unsigned char *data, size_t len);
426 public int xbuf_pop(struct xbuffer *buf);
427 public void xbuf_set(struct xbuffer *dst, struct xbuffer *src);
428 public constant char * xbuf_char_data(constant struct xbuffer *xbuf);
429 public lbool help_ckd_add(void *r, uintmax a, uintmax b, int rsize, int rsigned);
430 public lbool help_ckd_mul(void *r, uintmax a, uintmax b, int rsize, int rsigned);
431