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