Annotation of src/usr.bin/mg/def.h, Revision 1.179
1.179 ! op 1: /* $OpenBSD: def.h,v 1.178 2023/03/30 19:00:02 op Exp $ */
1.64 kjell 2:
3: /* This file is in the public domain. */
1.6 niklas 4:
1.1 deraadt 5: /*
6: * This file is the general header file for all parts
1.4 millert 7: * of the Mg display editor. It contains all of the
1.1 deraadt 8: * general definitions and macros. It also contains some
9: * conditional compilation flags. All of the per-system and
10: * per-terminal definitions are in special header files.
11: */
1.58 henning 12:
1.143 bcallah 13: #include "chrdef.h"
1.1 deraadt 14:
1.47 vincent 15: typedef int (*PF)(int, int); /* generally useful type */
1.1 deraadt 16:
17: /*
18: * Table sizes, etc.
19: */
1.7 art 20: #define NFILEN 1024 /* Length, file name. */
21: #define NBUFN NFILEN /* Length, buffer name. */
1.4 millert 22: #define NLINE 256 /* Length, line. */
23: #define PBMODES 4 /* modes per buffer */
24: #define NPAT 80 /* Length, pattern. */
25: #define HUGE 1000 /* A rather large number. */
26: #define NSRCH 128 /* Undoable search commands. */
27: #define NXNAME 64 /* Length, extended command. */
1.60 db 28: #define NKNAME 20 /* Length, key names. */
1.68 kjell 29: #define NTIME 50 /* Length, timestamp string. */
1.147 bcallah 30:
1.1 deraadt 31: /*
32: * Universal.
33: */
1.4 millert 34: #define FALSE 0 /* False, no, bad, etc. */
35: #define TRUE 1 /* True, yes, good, etc. */
36: #define ABORT 2 /* Death, ^G, abort, etc. */
1.125 lum 37: #define UERROR 3 /* User Error. */
1.127 florian 38: #define REVERT 4 /* Revert the buffer */
1.1 deraadt 39:
1.98 deraadt 40: #define KCLEAR 2 /* clear echo area */
1.1 deraadt 41:
42: /*
43: * These flag bits keep track of
44: * some aspects of the last command. The CFCPCN
45: * flag controls goal column setting. The CFKILL
46: * flag controls the clearing versus appending
47: * of data in the kill buffer.
48: */
1.159 lum 49: #define CFCPCN 0x0001 /* Last command was C-p or C-n */
1.4 millert 50: #define CFKILL 0x0002 /* Last command was a kill */
1.60 db 51: #define CFINS 0x0004 /* Last command was self-insert */
1.1 deraadt 52:
53: /*
54: * File I/O.
55: */
1.4 millert 56: #define FIOSUC 0 /* Success. */
57: #define FIOFNF 1 /* File not found. */
58: #define FIOEOF 2 /* End of file. */
59: #define FIOERR 3 /* Error. */
60: #define FIOLONG 4 /* long line partially read */
1.77 deraadt 61: #define FIODIR 5 /* File is a directory */
1.1 deraadt 62:
63: /*
64: * Display colors.
65: */
1.4 millert 66: #define CNONE 0 /* Unknown color. */
67: #define CTEXT 1 /* Text color. */
68: #define CMODE 2 /* Mode line color. */
69:
70: /*
1.22 millert 71: * Flags for keyboard invoked functions.
1.4 millert 72: */
73: #define FFUNIV 1 /* universal argument */
1.27 deraadt 74: #define FFNEGARG 2 /* negative only argument */
1.4 millert 75: #define FFOTHARG 4 /* other argument */
76: #define FFARG 7 /* any argument */
77: #define FFRAND 8 /* Called by other function */
1.1 deraadt 78:
79: /*
80: * Flags for "eread".
81: */
1.4 millert 82: #define EFFUNC 0x0001 /* Autocomplete functions. */
83: #define EFBUF 0x0002 /* Autocomplete buffers. */
84: #define EFFILE 0x0004 /* " files (maybe someday) */
1.60 db 85: #define EFAUTO 0x0007 /* Some autocompletion on */
1.4 millert 86: #define EFNEW 0x0008 /* New prompt. */
87: #define EFCR 0x0010 /* Echo CR at end; last read. */
1.20 art 88: #define EFDEF 0x0020 /* buffer contains default args */
1.63 kjell 89: #define EFNUL 0x0040 /* Null Minibuffer OK */
1.1 deraadt 90:
91: /*
1.75 kjell 92: * Direction of insert into kill ring
1.1 deraadt 93: */
1.112 kjell 94: #define KNONE 0x00
95: #define KFORW 0x01 /* forward insert into kill ring */
96: #define KBACK 0x02 /* Backwards insert into kill ring */
97: #define KREG 0x04 /* This is a region-based kill */
1.1 deraadt 98:
1.123 lum 99: #define MAX_TOKEN 64
100:
1.164 lum 101: #define BUFSIZE 128 /* Size of line contents in extend.c */
1.49 vincent 102: /*
1.143 bcallah 103: * Previously from sysdef.h
104: */
105: typedef int RSIZE; /* Type for file/region sizes */
106: typedef short KCHAR; /* Type for internal keystrokes */
107:
108: /*
1.49 vincent 109: * This structure holds the starting position
110: * (as a line/offset pair) and the number of characters in a
111: * region of a buffer. This makes passing the specification
112: * of a region around a little bit easier.
113: */
1.74 deraadt 114: struct region {
115: struct line *r_linep; /* Origin line address. */
116: int r_offset; /* Origin line offset. */
1.110 kjell 117: int r_lineno; /* Origin line number */
1.60 db 118: RSIZE r_size; /* Length in characters. */
1.74 deraadt 119: };
1.49 vincent 120:
121:
1.1 deraadt 122: /*
123: * All text is kept in circularly linked
1.75 kjell 124: * lists of "line" structures. These begin at the
1.1 deraadt 125: * header line (which is the blank line beyond the
126: * end of the buffer). This line is pointed to by
1.75 kjell 127: * the "buffer" structure. Each line contains the number of
1.1 deraadt 128: * bytes in the line (the "used" size), the size
129: * of the text array, and the text. The end of line
130: * is not stored as a byte; it's implied. Future
131: * additions will include update hints, and a
132: * list of marks into the line.
133: */
1.74 deraadt 134: struct line {
135: struct line *l_fp; /* Link to the next line */
136: struct line *l_bp; /* Link to the previous line */
1.60 db 137: int l_size; /* Allocated size */
138: int l_used; /* Used size */
139: char *l_text; /* Content of the line */
1.74 deraadt 140: };
1.1 deraadt 141:
142: /*
143: * The rationale behind these macros is that you
144: * could (with some editing, like changing the type of a line
1.75 kjell 145: * link from a "struct line *" to a "REFLINE", and fixing the commands
1.1 deraadt 146: * like file reading that break the rules) change the actual
147: * storage representation of lines to use something fancy on
148: * machines with small address spaces.
149: */
150: #define lforw(lp) ((lp)->l_fp)
151: #define lback(lp) ((lp)->l_bp)
152: #define lgetc(lp, n) (CHARMASK((lp)->l_text[(n)]))
153: #define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
154: #define llength(lp) ((lp)->l_used)
155: #define ltext(lp) ((lp)->l_text)
156:
157: /*
158: * All repeated structures are kept as linked lists of structures.
159: * All of these start with a LIST structure (except lines, which
160: * have their own abstraction). This will allow for
161: * later conversion to generic list manipulation routines should
1.60 db 162: * I decide to do that. It does mean that there are four extra
1.1 deraadt 163: * bytes per window. I feel that this is an acceptable price,
164: * considering that there are usually only one or two windows.
165: */
1.74 deraadt 166: struct list {
1.1 deraadt 167: union {
1.74 deraadt 168: struct mgwin *l_wp;
1.75 kjell 169: struct buffer *x_bp; /* l_bp is used by struct line */
1.74 deraadt 170: struct list *l_nxt;
1.1 deraadt 171: } l_p;
1.82 kjell 172: char *l_name;
1.74 deraadt 173: };
1.4 millert 174:
1.1 deraadt 175: /*
176: * Usual hack - to keep from uglifying the code with lotsa
177: * references through the union, we #define something for it.
178: */
179: #define l_next l_p.l_nxt
180:
181: /*
182: * There is a window structure allocated for
183: * every active display window. The windows are kept in a
184: * big list, in top to bottom screen order, with the listhead at
185: * "wheadp". Each window contains its own values of dot and mark.
186: * The flag field contains some bits that are set by commands
187: * to guide redisplay; although this is a bit of a compromise in
188: * terms of decoupling, the full blown redisplay is just too
189: * expensive to run for every input character.
190: */
1.74 deraadt 191: struct mgwin {
192: struct list w_list; /* List header */
193: struct buffer *w_bufp; /* Buffer displayed in window */
194: struct line *w_linep; /* Top line in the window */
195: struct line *w_dotp; /* Line containing "." */
196: struct line *w_markp; /* Line containing "mark" */
1.60 db 197: int w_doto; /* Byte offset for "." */
198: int w_marko; /* Byte offset for "mark" */
1.122 lum 199: int w_toprow; /* Origin 0 top row of window */
200: int w_ntrows; /* # of rows of text in window */
201: int w_frame; /* #lines to reframe by. */
1.111 kjell 202: char w_rflag; /* Redisplay Flags. */
203: char w_flag; /* Flags. */
1.74 deraadt 204: struct line *w_wrapline;
1.92 kjell 205: int w_dotline; /* current line number of dot */
206: int w_markline; /* current line number of mark */
1.74 deraadt 207: };
1.1 deraadt 208: #define w_wndp w_list.l_p.l_wp
209: #define w_name w_list.l_name
210:
211: /*
1.109 kjell 212: * Window redisplay flags are set by command processors to
1.1 deraadt 213: * tell the display system what has happened to the buffer
1.99 deanna 214: * mapped by the window. Setting "WFFULL" is always a safe thing
1.1 deraadt 215: * to do, but it may do more work than is necessary. Always try
216: * to set the simplest action that achieves the required update.
217: * Because commands set bits in the "w_flag", update will see
218: * all change flags, and do the most general one.
219: */
1.89 kjell 220: #define WFFRAME 0x01 /* Force reframe. */
1.43 vincent 221: #define WFMOVE 0x02 /* Movement from line to line. */
222: #define WFEDIT 0x04 /* Editing within a line. */
1.89 kjell 223: #define WFFULL 0x08 /* Do a full display. */
1.43 vincent 224: #define WFMODE 0x10 /* Update mode line. */
1.1 deraadt 225:
1.111 kjell 226: /*
227: * Window flags
228: */
229: #define WNONE 0x00 /* No special window options. */
230: #define WEPHEM 0x01 /* Window is ephemeral. */
231:
1.35 vincent 232: struct undo_rec;
1.113 oga 233: TAILQ_HEAD(undoq, undo_rec);
1.143 bcallah 234:
235: /*
236: * Previously from sysdef.h
237: * Only used in struct buffer.
238: */
239: struct fileinfo {
240: uid_t fi_uid;
241: gid_t fi_gid;
242: mode_t fi_mode;
243: struct timespec fi_mtime; /* Last modified time */
244: };
1.35 vincent 245:
1.1 deraadt 246: /*
247: * Text is kept in buffers. A buffer header, described
248: * below, exists for every buffer in the system. The buffers are
249: * kept in a big list, so that commands that search for a buffer by
250: * name can find the buffer header. There is a safe store for the
251: * dot and mark in the header, but this is only valid if the buffer
252: * is not being displayed (that is, if "b_nwnd" is 0). The text for
253: * the buffer is kept in a circularly linked list of lines, with
1.94 kjell 254: * a pointer to the header line in "b_headp".
1.1 deraadt 255: */
1.74 deraadt 256: struct buffer {
257: struct list b_list; /* buffer list pointer */
258: struct buffer *b_altb; /* Link to alternate buffer */
1.75 kjell 259: struct line *b_dotp; /* Link to "." line structure */
1.74 deraadt 260: struct line *b_markp; /* ditto for mark */
1.94 kjell 261: struct line *b_headp; /* Link to the header line */
1.74 deraadt 262: struct maps_s *b_modes[PBMODES]; /* buffer modes */
1.75 kjell 263: int b_doto; /* Offset of "." in above line */
1.60 db 264: int b_marko; /* ditto for the "mark" */
265: short b_nmodes; /* number of non-fundamental modes */
266: char b_nwnd; /* Count of windows on buffer */
267: char b_flag; /* Flags */
268: char b_fname[NFILEN]; /* File name */
1.86 kjell 269: char b_cwd[NFILEN]; /* working directory */
1.168 lum 270: char *b_nlseq; /* Newline sequence of chars */
271: char *b_nlchr; /* 1st newline character */
1.60 db 272: struct fileinfo b_fi; /* File attributes */
1.113 oga 273: struct undoq b_undo; /* Undo actions list */
1.67 kjell 274: struct undo_rec *b_undoptr;
1.92 kjell 275: int b_dotline; /* Line number of dot */
276: int b_markline; /* Line number of mark */
277: int b_lines; /* Number of lines in file */
1.74 deraadt 278: };
1.1 deraadt 279: #define b_bufp b_list.l_p.x_bp
280: #define b_bname b_list.l_name
1.95 kjell 281:
282: /* Some helper macros, in case they ever change to functions */
283: #define bfirstlp(buf) (lforw((buf)->b_headp))
284: #define blastlp(buf) (lback((buf)->b_headp))
1.1 deraadt 285:
1.43 vincent 286: #define BFCHG 0x01 /* Changed. */
287: #define BFBAK 0x02 /* Need to make a backup. */
288: #define BFNOTAB 0x04 /* no tab mode */
289: #define BFOVERWRITE 0x08 /* overwrite mode */
1.60 db 290: #define BFREADONLY 0x10 /* read only mode */
1.107 kjell 291: #define BFDIRTY 0x20 /* Buffer was modified elsewhere */
1.151 lum 292: #define BFIGNDIRTY 0x40 /* Ignore modifications */
293: #define BFDIREDDEL 0x80 /* Dired has a deleted 'D' file */
1.1 deraadt 294: /*
1.30 vincent 295: * This structure holds information about recent actions for the Undo command.
296: */
297: struct undo_rec {
1.113 oga 298: TAILQ_ENTRY(undo_rec) next;
1.30 vincent 299: enum {
300: INSERT = 1,
301: DELETE,
1.93 kjell 302: BOUNDARY,
1.112 kjell 303: MODIFIED,
304: DELREG
1.30 vincent 305: } type;
1.74 deraadt 306: struct region region;
1.30 vincent 307: int pos;
1.34 deraadt 308: char *content;
1.30 vincent 309: };
1.144 bcallah 310:
311: /*
1.174 lum 312: * Variable structure.
313: */
314: struct varentry {
315: SLIST_ENTRY(varentry) entry;
316: char v_buf[BUFSIZE];
317: char *v_name;
318: char *v_vals;
319: int v_count;
320: };
321: SLIST_HEAD(vhead, varentry);
322:
323: /*
1.144 bcallah 324: * Previously from ttydef.h
325: */
326: #define STANDOUT_GLITCH /* possible standout glitch */
327:
328: #define putpad(str, num) tputs(str, num, ttputc)
329:
330: #define KFIRST K00
331: #define KLAST K00
1.30 vincent 332:
333: /*
1.4 millert 334: * Prototypes.
335: */
336:
1.5 millert 337: /* tty.c X */
1.74 deraadt 338: void ttinit(void);
339: void ttreinit(void);
340: void tttidy(void);
341: void ttmove(int, int);
342: void tteeol(void);
343: void tteeop(void);
344: void ttbeep(void);
345: void ttinsl(int, int, int);
346: void ttdell(int, int, int);
347: void ttwindow(int, int);
348: void ttnowindow(void);
349: void ttcolor(int);
350: void ttresize(void);
1.31 deraadt 351:
1.166 florian 352: extern volatile sig_atomic_t winch_flag;
1.4 millert 353:
354: /* ttyio.c */
1.74 deraadt 355: void ttopen(void);
356: int ttraw(void);
357: void ttclose(void);
358: int ttcooked(void);
359: int ttputc(int);
360: void ttflush(void);
361: int ttgetc(void);
362: int ttwait(int);
1.80 kjell 363: int charswaiting(void);
1.4 millert 364:
365: /* dir.c */
1.74 deraadt 366: void dirinit(void);
367: int changedir(int, int);
368: int showcwdir(int, int);
1.86 kjell 369: int getcwdir(char *, size_t);
1.131 jasper 370: int makedir(int, int);
1.141 lum 371: int do_makedir(char *);
372: int ask_makedir(void);
1.4 millert 373:
374: /* dired.c */
1.74 deraadt 375: struct buffer *dired_(char *);
1.172 lum 376: int dired_jump(int, int);
1.152 lum 377: int do_dired(char *);
1.5 millert 378:
379: /* file.c X */
1.74 deraadt 380: int fileinsert(int, int);
381: int filevisit(int, int);
382: int filevisitalt(int, int);
383: int filevisitro(int, int);
384: int poptofile(int, int);
385: int readin(char *);
386: int insertfile(char *, char *, int);
387: int filewrite(int, int);
388: int filesave(int, int);
389: int buffsave(struct buffer *);
390: int makebkfile(int, int);
1.121 lum 391: int writeout(FILE **, struct buffer *, char *);
1.74 deraadt 392: void upmodes(struct buffer *);
1.116 kjell 393: size_t xbasename(char *, const char *, size_t);
1.154 lum 394: int do_filevisitalt(char *);
1.5 millert 395:
396: /* line.c X */
1.74 deraadt 397: struct line *lalloc(int);
398: int lrealloc(struct line *, int);
399: void lfree(struct line *);
400: void lchange(int);
401: int linsert(int, int);
402: int lnewline_at(struct line *, int);
403: int lnewline(void);
404: int ldelete(RSIZE, int);
405: int ldelnewline(void);
406: int lreplace(RSIZE, char *);
1.88 kjell 407: char * linetostr(const struct line *);
1.156 reyk 408: int setcasereplace(int, int);
1.78 kjell 409:
410: /* yank.c X */
411:
1.74 deraadt 412: void kdelete(void);
413: int kinsert(int, int);
414: int kremove(int);
1.76 kjell 415: int kchunk(char *, RSIZE, int);
1.78 kjell 416: int killline(int, int);
417: int yank(int, int);
1.5 millert 418:
419: /* window.c X */
1.74 deraadt 420: struct mgwin *new_window(struct buffer *);
421: int reposition(int, int);
1.80 kjell 422: int redraw(int, int);
1.83 otto 423: int do_redraw(int, int, int);
1.74 deraadt 424: int nextwind(int, int);
425: int prevwind(int, int);
426: int onlywind(int, int);
427: int splitwind(int, int);
428: int enlargewind(int, int);
429: int shrinkwind(int, int);
430: int delwind(int, int);
1.4 millert 431:
432: /* buffer.c */
1.74 deraadt 433: int togglereadonly(int, int);
1.157 lum 434: int togglereadonlyall(int, int);
1.86 kjell 435: struct buffer *bfind(const char *, int);
1.74 deraadt 436: int poptobuffer(int, int);
437: int killbuffer(struct buffer *);
438: int killbuffer_cmd(int, int);
439: int savebuffers(int, int);
440: int listbuffers(int, int);
441: int addlinef(struct buffer *, char *, ...);
1.12 art 442: #define addline(bp, text) addlinef(bp, "%s", text)
1.74 deraadt 443: int anycb(int);
444: int bclear(struct buffer *);
445: int showbuffer(struct buffer *, struct mgwin *, int);
1.86 kjell 446: int augbname(char *, const char *, size_t);
1.111 kjell 447: struct mgwin *popbuf(struct buffer *, int);
1.74 deraadt 448: int bufferinsert(int, int);
449: int usebuffer(int, int);
450: int notmodified(int, int);
1.111 kjell 451: int popbuftop(struct buffer *, int);
1.86 kjell 452: int getbufcwd(char *, size_t);
1.107 kjell 453: int checkdirty(struct buffer *);
1.126 jasper 454: int revertbuffer(int, int);
1.128 haesbaer 455: int dorevert(void);
1.134 florian 456: int diffbuffer(int, int);
1.139 lum 457: struct buffer *findbuffer(char *);
1.4 millert 458:
459: /* display.c */
1.165 lum 460: int vtresize(int, int, int);
461: void vtinit(void);
462: void vttidy(void);
463: void update(int);
464: int linenotoggle(int, int);
465: int colnotoggle(int, int);
1.5 millert 466:
467: /* echo.c X */
1.74 deraadt 468: void eerase(void);
469: int eyorn(const char *);
1.127 florian 470: int eynorr(const char *);
1.74 deraadt 471: int eyesno(const char *);
472: void ewprintf(const char *fmt, ...);
1.150 guenther 473: char *eread(const char *, char *, size_t, int, ...)
474: __attribute__((__format__ (printf, 1, 5)));
1.74 deraadt 475: int getxtra(struct list *, struct list *, int, int);
476: void free_file_list(struct list *);
1.4 millert 477:
478: /* fileio.c */
1.121 lum 479: int ffropen(FILE **, const char *, struct buffer *);
480: void ffstat(FILE *, struct buffer *);
481: int ffwopen(FILE **, const char *, struct buffer *);
482: int ffclose(FILE *, struct buffer *);
1.158 lum 483: int ffputbuf(FILE *, struct buffer *, int);
1.121 lum 484: int ffgetline(FILE *, char *, int, int *);
1.74 deraadt 485: int fbackupfile(const char *);
1.91 jason 486: char *adjustname(const char *, int);
1.178 op 487: FILE *startupfile(char *, char *, char *, size_t);
1.74 deraadt 488: int copy(char *, char *);
489: struct list *make_file_list(char *);
490: int fisdir(const char *);
1.107 kjell 491: int fchecktime(struct buffer *);
492: int fupdstat(struct buffer *);
1.124 lum 493: int backuptohomedir(int, int);
494: int toggleleavetmp(int, int);
1.130 jasper 495: char *expandtilde(const char *);
1.4 millert 496:
1.5 millert 497: /* kbd.c X */
1.74 deraadt 498: int do_meta(int, int);
499: int bsmap(int, int);
500: void ungetkey(int);
501: int getkey(int);
502: int doin(void);
503: int rescan(int, int);
504: int universal_argument(int, int);
505: int digit_argument(int, int);
506: int negative_argument(int, int);
1.162 lum 507: int ask_selfinsert(int, int);
1.74 deraadt 508: int selfinsert(int, int);
509: int quote(int, int);
1.4 millert 510:
511: /* main.c */
1.74 deraadt 512: int ctrlg(int, int);
513: int quit(int, int);
1.4 millert 514:
515: /* ttyio.c */
1.74 deraadt 516: void panic(char *);
1.4 millert 517:
518: /* cinfo.c */
1.80 kjell 519: char *getkeyname(char *, size_t, int);
1.4 millert 520:
521: /* basic.c */
1.74 deraadt 522: int gotobol(int, int);
523: int backchar(int, int);
524: int gotoeol(int, int);
525: int forwchar(int, int);
526: int gotobob(int, int);
527: int gotoeob(int, int);
528: int forwline(int, int);
529: int backline(int, int);
530: void setgoal(void);
531: int getgoal(struct line *);
532: int forwpage(int, int);
533: int backpage(int, int);
534: int forw1page(int, int);
535: int back1page(int, int);
536: int pagenext(int, int);
537: void isetmark(void);
538: int setmark(int, int);
1.101 kjell 539: int clearmark(int, int);
1.74 deraadt 540: int swapmark(int, int);
541: int gotoline(int, int);
1.126 jasper 542: int setlineno(int);
1.5 millert 543:
1.159 lum 544: /* util.c X */
1.74 deraadt 545: int showcpos(int, int);
1.135 florian 546: int getcolpos(struct mgwin *);
1.74 deraadt 547: int twiddle(int, int);
548: int openline(int, int);
1.142 bcallah 549: int enewline(int, int);
1.74 deraadt 550: int deblank(int, int);
551: int justone(int, int);
552: int delwhite(int, int);
1.102 kjell 553: int delleadwhite(int, int);
554: int deltrailwhite(int, int);
555: int lfindent(int, int);
1.74 deraadt 556: int indent(int, int);
557: int forwdel(int, int);
558: int backdel(int, int);
559: int space_to_tabstop(int, int);
1.114 kjell 560: int backtoindent(int, int);
1.115 kjell 561: int joinline(int, int);
1.5 millert 562:
1.117 lum 563: /* tags.c X */
564: int findtag(int, int);
565: int poptag(int, int);
566: int tagsvisit(int, int);
1.123 lum 567: int curtoken(int, int, char *);
568:
569: /* cscope.c */
1.165 lum 570: int cssymbol(int, int);
571: int csdefinition(int, int);
572: int csfuncalled(int, int);
573: int cscallerfuncs(int, int);
574: int csfindtext(int, int);
575: int csegrep(int, int);
576: int csfindfile(int, int);
577: int csfindinc(int, int);
578: int csnextfile(int, int);
579: int csnextmatch(int, int);
580: int csprevfile(int, int);
581: int csprevmatch(int, int);
582: int cscreatelist(int, int);
1.117 lum 583:
1.5 millert 584: /* extend.c X */
1.74 deraadt 585: int insert(int, int);
586: int bindtokey(int, int);
587: int localbind(int, int);
1.80 kjell 588: int redefine_key(int, int);
1.74 deraadt 589: int unbindtokey(int, int);
590: int localunbind(int, int);
591: int extend(int, int);
592: int evalexpr(int, int);
593: int evalbuffer(int, int);
594: int evalfile(int, int);
1.178 op 595: int load(FILE *, const char *);
1.176 lum 596: int excline(char *, int, int);
1.164 lum 597: char *skipwhite(char *);
1.5 millert 598:
599: /* help.c X */
1.74 deraadt 600: int desckey(int, int);
601: int wallchart(int, int);
602: int help_help(int, int);
603: int apropos_command(int, int);
1.5 millert 604:
605: /* paragraph.c X */
1.74 deraadt 606: int gotobop(int, int);
607: int gotoeop(int, int);
608: int fillpara(int, int);
609: int killpara(int, int);
610: int fillword(int, int);
611: int setfillcol(int, int);
1.148 lum 612: int markpara(int, int);
1.149 lum 613: int transposepara(int, int);
1.155 lum 614: int sentencespace(int, int);
1.5 millert 615:
616: /* word.c X */
1.74 deraadt 617: int backword(int, int);
618: int forwword(int, int);
619: int upperword(int, int);
620: int lowerword(int, int);
621: int capword(int, int);
622: int delfword(int, int);
623: int delbword(int, int);
624: int inword(void);
1.153 lum 625: int transposeword(int, int);
1.5 millert 626:
627: /* region.c X */
1.74 deraadt 628: int killregion(int, int);
629: int copyregion(int, int);
630: int lowerregion(int, int);
631: int upperregion(int, int);
632: int prefixregion(int, int);
633: int setprefix(int, int);
634: int region_get_data(struct region *, char *, int);
1.79 kjell 635: void region_put_data(const char *, int);
1.119 lum 636: int markbuffer(int, int);
637: int piperegion(int, int);
1.136 lum 638: int shellcommand(int, int);
1.133 florian 639: int pipeio(const char * const, char * const[], char * const, int,
640: struct buffer *);
1.5 millert 641:
642: /* search.c X */
1.74 deraadt 643: int forwsearch(int, int);
644: int backsearch(int, int);
645: int searchagain(int, int);
646: int forwisearch(int, int);
647: int backisearch(int, int);
648: int queryrepl(int, int);
649: int forwsrch(void);
650: int backsrch(void);
651: int readpattern(char *);
1.177 op 652: int zapuptochar(int, int);
653: int zaptochar(int, int);
654: int zap(int, int);
1.5 millert 655:
656: /* spawn.c X */
1.74 deraadt 657: int spawncli(int, int);
1.5 millert 658:
659: /* ttykbd.c X */
1.74 deraadt 660: void ttykeymapinit(void);
661: void ttykeymaptidy(void);
1.5 millert 662:
663: /* match.c X */
1.74 deraadt 664: int showmatch(int, int);
1.5 millert 665:
666: /* version.c X */
1.74 deraadt 667: int showversion(int, int);
1.5 millert 668:
669: /* macro.c X */
1.74 deraadt 670: int definemacro(int, int);
671: int finishmacro(int, int);
672: int executemacro(int, int);
1.5 millert 673:
674: /* modes.c X */
1.74 deraadt 675: int indentmode(int, int);
676: int fillmode(int, int);
677: int notabmode(int, int);
1.80 kjell 678: int overwrite_mode(int, int);
1.74 deraadt 679: int set_default_mode(int,int);
1.5 millert 680:
681: #ifdef REGEX
682: /* re_search.c X */
1.74 deraadt 683: int re_forwsearch(int, int);
684: int re_backsearch(int, int);
685: int re_searchagain(int, int);
686: int re_queryrepl(int, int);
1.173 lum 687: int re_repl(int, int);
1.74 deraadt 688: int replstr(int, int);
689: int setcasefold(int, int);
690: int delmatchlines(int, int);
691: int delnonmatchlines(int, int);
692: int cntmatchlines(int, int);
693: int cntnonmatchlines(int, int);
1.5 millert 694: #endif /* REGEX */
1.1 deraadt 695:
1.30 vincent 696: /* undo.c X */
1.74 deraadt 697: void free_undo_record(struct undo_rec *);
698: int undo_dump(int, int);
1.97 kjell 699: int undo_enabled(void);
1.108 kjell 700: int undo_enable(int, int);
701: int undo_add_boundary(int, int);
1.93 kjell 702: void undo_add_modified(void);
1.74 deraadt 703: int undo_add_insert(struct line *, int, int);
1.112 kjell 704: int undo_add_delete(struct line *, int, int, int);
1.108 kjell 705: int undo_boundary_enable(int, int);
1.74 deraadt 706: int undo_add_change(struct line *, int, int);
707: int undo(int, int);
1.41 vincent 708:
709: /* autoexec.c X */
1.74 deraadt 710: int auto_execute(int, int);
711: PF *find_autoexec(const char *);
712: int add_autoexec(const char *, const char *);
1.46 vincent 713:
1.103 kjell 714: /* cmode.c X */
715: int cmode(int, int);
1.104 kjell 716: int cc_brace(int, int);
1.103 kjell 717: int cc_char(int, int);
718: int cc_tab(int, int);
719: int cc_indent(int, int);
720: int cc_lfindent(int, int);
1.66 kjell 721:
722: /* grep.c X */
1.74 deraadt 723: int next_error(int, int);
1.100 kjell 724: int globalwdtoggle(int, int);
1.106 kjell 725: int compile(int, int);
1.30 vincent 726:
1.138 lum 727: /* bell.c */
728: void bellinit(void);
729: int toggleaudiblebell(int, int);
730: int togglevisiblebell(int, int);
1.175 lum 731: int dobeep_num(const char *, int);
1.163 lum 732: int dobeep_msgs(const char *, const char *);
733: int dobeep_msg(const char *);
1.138 lum 734: void dobeep(void);
1.164 lum 735:
736: /* interpreter.c */
1.176 lum 737: int foundparen(char *, int, int);
1.170 lum 738: void cleanup(void);
1.138 lum 739:
1.1 deraadt 740: /*
741: * Externals.
742: */
1.74 deraadt 743: extern struct buffer *bheadp;
744: extern struct buffer *curbp;
745: extern struct mgwin *curwp;
746: extern struct mgwin *wheadp;
1.174 lum 747: extern struct vhead varhead;
1.74 deraadt 748: extern int thisflag;
749: extern int lastflag;
750: extern int curgoal;
751: extern int startrow;
752: extern int epresf;
753: extern int sgarbf;
754: extern int mode;
755: extern int nrow;
756: extern int ncol;
757: extern int ttrow;
758: extern int ttcol;
759: extern int tttop;
760: extern int ttbot;
761: extern int tthue;
762: extern int defb_nmodes;
763: extern int defb_flag;
1.138 lum 764: extern int doaudiblebell;
765: extern int dovisiblebell;
1.155 lum 766: extern int dblspace;
1.157 lum 767: extern int allbro;
1.169 lum 768: extern int batch;
1.117 lum 769: extern char cinfo[];
1.74 deraadt 770: extern char *keystrings[];
771: extern char pat[NPAT];
772: extern char prompt[];
1.166 florian 773: extern int tceeol;
774: extern int tcinsl;
775: extern int tcdell;
776: extern int rptcount; /* successive invocation count */