home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / EDITOR / ME39SRC1.ZIP / ESTRUCT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1987-07-22  |  21.7 KB  |  636 lines

  1. /*    ESTRUCT:    Structure and preprocesser defined for
  2.             MicroEMACS 3.9
  3.  
  4.             written by Dave G. Conroy
  5.             modified by Steve Wilhite, George Jones
  6.             substantially modified by Daniel Lawrence
  7. */
  8.  
  9. #ifdef    LATTICE
  10. #undef    LATTICE        /* don't use their definitions...use ours    */
  11. #endif
  12. #ifdef    MSDOS
  13. #undef    MSDOS
  14. #endif
  15. #ifdef    CPM
  16. #undef    CPM
  17. #endif
  18. #ifdef    AMIGA
  19. #undef    AMIGA
  20. #endif
  21. #ifdef    EGA
  22. #undef    EGA
  23. #endif
  24.  
  25. /*    Program Identification.....
  26.  
  27.     PROGNAME should always be MicroEMACS for a distibrution
  28.     unmodified version. People using MicroEMACS as a shell
  29.     for other products should change this to reflect their
  30.     product. Macros can query this via the $progname variable
  31. */
  32.  
  33. #define    PROGNAME    "MicroEMACS"
  34. #define    VERSION        "3.9"
  35.  
  36. /*    Machine/OS definitions            */
  37.  
  38. #define AMIGA   0                       /* AmigaDOS            */
  39. #define ST520   0                       /* ST520, TOS                   */
  40. #define MSDOS   1                       /* MS-DOS                       */
  41. #define V7      0                       /* V7 UNIX or Coherent or BSD4.2*/
  42. #define    BSD    0            /* UNIX BSD 4.2    and ULTRIX    */
  43. #define    USG    0            /* UNIX system V        */
  44. #define VMS     0                       /* VAX/VMS                      */
  45. #define CPM     0                       /* CP/M-86                      */
  46. #define    FINDER    0            /* Macintosh OS            */
  47.  
  48. /*    Compiler definitions            */
  49. #define    UNIX    0    /* a random UNIX compiler */
  50. #define MWC86   0    /* marc williams compiler */
  51. #define    LATTICE    0    /* Lattice 2.14 thruough 3.0 compilers */
  52. #define    AZTEC    1    /* Aztec C 3.20e */
  53. #define    MSC    0    /* MicroSoft C compile version 3 & 4 */
  54. #define    TURBO    0    /* Turbo C/MSDOS */
  55.  
  56. /*    Debugging options    */
  57. #define    RAMSIZE    0    /* dynamic RAM memory usage tracking */
  58. #define    RAMSHOW    0    /* auto dynamic RAM reporting */
  59.  
  60. /*   Special keyboard definitions            */
  61.  
  62. #define WANGPC    0        /* WangPC - mostly escape sequences     */
  63.  
  64. /*    Terminal Output definitions        */
  65.  
  66. #define ANSI    0            /* ANSI escape sequences    */
  67. #define    HP150    0            /* HP150 screen driver        */
  68. #define    HP110    0            /* HP110 screen driver        */
  69. #define    VMSVT    0            /* various VMS terminal entries    */
  70. #define VT52    0                       /* VT52 terminal (Zenith).      */
  71. #define VT100   0                       /* Handle VT100 style keypad.   */
  72. #define RAINBOW 0                       /* Use Rainbow fast video.      */
  73. #define TERMCAP 0                       /* Use TERMCAP                  */
  74. #define    IBMPC    1            /* IBM-PC CGA/MONO/EGA driver    */
  75. #define    DG10    0            /* Data General system/10    */
  76. #define    TIPC    0            /* TI Profesional PC driver    */
  77. #define    Z309    0            /* Zenith 100 PC family    driver    */
  78. #define    MAC    0            /* Macintosh            */
  79. #define    ATARI    0            /* Atari 520/1040ST screen    */
  80.  
  81. /*    Configuration options    */
  82.  
  83. #define CVMVAS  1    /* arguments to page forward/back in pages    */
  84. #define    CLRMSG    0    /* space clears the message line with no insert    */
  85. #define    CFENCE    1    /* fench matching in CMODE            */
  86. #define    TYPEAH    1    /* type ahead causes update to be skipped    */
  87. #define DEBUGM    1    /* $debug triggers macro debugging        */
  88. #define    VISMAC    0    /* update display during keyboard macros    */
  89. #define    CTRLZ    0    /* add a ^Z at end of files under MSDOS only    */
  90.  
  91. #define    REVSTA    1    /* Status line appears in reverse video        */
  92. #define    COLOR    1    /* color commands and windows            */
  93.  
  94. #define    FILOCK    0    /* file locking under unix BSD 4.2        */
  95. #define    ISRCH    0    /* Incremental searches like ITS EMACS        */
  96. #define    WORDPRO    1    /* Advanced word processing features        */
  97. #define    FLABEL    0    /* function key label code [HP150]        */
  98. #define    APROP    1    /* Add code for Apropos command            */
  99. #define    CRYPT    1    /* file encryption enabled?            */
  100. #define MAGIC    1    /* include regular expression matching?        */
  101. #define    AEDIT    1    /* advanced editing options: en/detabbing    */
  102. #define    PROC    1    /* named procedures                */
  103.  
  104. #define ASCII    1    /* always using ASCII char sequences for now    */
  105. #define EBCDIC    0    /* later IBM mainfraim versions will use EBCDIC    */
  106.  
  107. /*    System dependant library redefinitions, structures and includes    */
  108.  
  109. #if    TURBO
  110. #include      <dos.h>
  111. #include      <mem.h>
  112. #undef peek
  113. #undef poke
  114. #define       peek(a,b,c,d)   movedata(a,b,FP_SEG(c),FP_OFF(c),d)
  115. #define       poke(a,b,c,d)   movedata(FP_SEG(c),FP_OFF(c),a,b,d)
  116. #endif
  117.  
  118. #if    VMS
  119. #define    atoi    xatoi
  120. #define    abs    xabs
  121. #define    getname    xgetname
  122. #endif
  123.  
  124. #if    LATTICE
  125. #define    unsigned
  126. #endif
  127.  
  128. #if    AZTEC
  129. #undef    fputc
  130. #undef    fgetc
  131. #if    MSDOS
  132. #define    fgetc    a1getc
  133. #else
  134. #define    fgetc    agetc
  135. #endif
  136. #define    fputc    aputc
  137. #define    int86    sysint
  138. #define    intdos(a, b)    sysint(33, a, b)
  139. #define    inp    inportb
  140. #define    outp    outportb
  141.  
  142. struct XREG {
  143.     int ax,bx,cx,dx,si,di;
  144. };
  145.  
  146. struct HREG {
  147.     char al,ah,bl,bh,cl,ch,dl,dh;
  148. };
  149.  
  150. union REGS {
  151.     struct XREG x;
  152.     struct HREG h;
  153. };
  154. #endif
  155.  
  156. #if    MSDOS & MWC86
  157. #include    <dos.h>
  158. #define    int86(a, b, c)    intcall(b, c, a)
  159. #define    inp    in
  160.  
  161. struct XREG {
  162.     int ax,bx,cx,dx,si,di,ds,es,flags;
  163. };
  164.  
  165. struct HREG {
  166.     char al,ah,bl,bh,cl,ch,dl,dh;
  167.     int ds,es,flags;
  168. };
  169.  
  170. union REGS {
  171.     struct XREG x;
  172.     struct HREG h;
  173. };
  174. #endif
  175.  
  176. #if    MSDOS & MSC
  177. #include    <dos.h>
  178. #include    <memory.h>
  179. #define    peek(a,b,c,d)    movedata(a,b,FP_SEG(c),FP_OFF(c),d)
  180. #define    poke(a,b,c,d)    movedata(FP_SEG(c),FP_OFF(c),a,b,d)
  181. #define    movmem(a, b, c)        memcpy(b, a, c)
  182. #endif
  183.  
  184. #if    MSDOS & LATTICE
  185. #undef    CPM
  186. #undef    LATTICE
  187. #include    <dos.h>
  188. #undef    CPM
  189. #endif
  190.  
  191. #if    VMS
  192. #define    unlink(a)    delete(a)
  193. #endif
  194.  
  195. /*    define some ability flags */
  196.  
  197. #if    IBMPC | Z309
  198. #define    MEMMAP    1
  199. #else
  200. #define    MEMMAP    0
  201. #endif
  202.  
  203. #if    ((MSDOS) & (LATTICE | AZTEC | MSC | TURBO)) | V7 | USG | BSD
  204. #define    ENVFUNC    1
  205. #else
  206. #define    ENVFUNC    0
  207. #endif
  208.  
  209. /*    internal constants    */
  210.  
  211. #define    NBINDS    256            /* max # of bound keys        */
  212. #define NFILEN  80                      /* # of bytes, file name        */
  213. #define NBUFN   16                      /* # of bytes, buffer name      */
  214. #define NLINE   256                     /* # of bytes, input line       */
  215. #define    NSTRING    128            /* # of bytes, string buffers    */
  216. #define NKBDM   256                     /* # of strokes, keyboard macro */
  217. #define NPAT    128                     /* # of bytes, pattern          */
  218. #define HUGE    1000                    /* Huge number                  */
  219. #define    NLOCKS    100            /* max # of file locks active    */
  220. #define    NCOLORS    8            /* number of supported colors    */
  221. #define    KBLOCK    250            /* sizeof kill buffer chunks    */
  222. #define    NBLOCK    16            /* line block chunk size    */
  223. #define    NVSIZE    10            /* max #chars in a var name    */
  224.  
  225. #define CTRL    0x0100                  /* Control flag, or'ed in       */
  226. #define META    0x0200                  /* Meta flag, or'ed in          */
  227. #define CTLX    0x0400                  /* ^X flag, or'ed in            */
  228. #define    SPEC    0x0800            /* special key (function keys)    */
  229.  
  230. #ifdef    FALSE
  231. #undef    FALSE
  232. #endif
  233. #ifdef    TRUE
  234. #undef    TRUE
  235. #endif
  236.  
  237. #define FALSE   0                       /* False, no, bad, etc.         */
  238. #define TRUE    1                       /* True, yes, good, etc.        */
  239. #define ABORT   2                       /* Death, ^G, abort, etc.       */
  240. #define    FAILED    3            /* not-quite fatal false return    */
  241.  
  242. #define    STOP    0            /* keyboard macro not in use    */
  243. #define    PLAY    1            /*          playing    */
  244. #define    RECORD    2            /*          recording    */
  245.  
  246. /*    Directive definitions    */
  247.  
  248. #define    DIF        0
  249. #define DELSE        1
  250. #define DENDIF        2
  251. #define DGOTO        3
  252. #define DRETURN        4
  253. #define DENDM        5
  254. #define DWHILE        6
  255. #define    DENDWHILE    7
  256. #define    DBREAK        8
  257. #define DFORCE        9
  258.  
  259. #define NUMDIRS        10
  260.  
  261. /*
  262.  * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
  263.  * the scan routines.
  264.  */
  265. #define    PTBEG    0    /* Leave the point at the beginning on search    */
  266. #define    PTEND    1    /* Leave the point at the end on search        */
  267. #define    FORWARD    0            /* forward direction        */
  268. #define REVERSE    1            /* backwards direction        */
  269.  
  270. #define FIOSUC  0                       /* File I/O, success.           */
  271. #define FIOFNF  1                       /* File I/O, file not found.    */
  272. #define FIOEOF  2                       /* File I/O, end of file.       */
  273. #define FIOERR  3                       /* File I/O, error.             */
  274. #define    FIOMEM    4            /* File I/O, out of memory    */
  275. #define    FIOFUN    5            /* File I/O, eod of file/bad line*/
  276.  
  277. #define CFCPCN  0x0001                  /* Last command was C-P, C-N    */
  278. #define CFKILL  0x0002                  /* Last command was a kill      */
  279.  
  280. #define    BELL    0x07            /* a bell character        */
  281. #define    TAB    0x09            /* a tab character        */
  282.  
  283. #if    V7 | USG | BSD
  284. #define    PATHCHR    ':'
  285. #else
  286. #define    PATHCHR    ';'
  287. #endif
  288.  
  289. #define    INTWIDTH    sizeof(int) * 3
  290.  
  291. /*    Macro argument token types                    */
  292.  
  293. #define    TKNUL    0            /* end-of-string        */
  294. #define    TKARG    1            /* interactive argument        */
  295. #define    TKBUF    2            /* buffer argument        */
  296. #define    TKVAR    3            /* user variables        */
  297. #define    TKENV    4            /* environment variables    */
  298. #define    TKFUN    5            /* function....            */
  299. #define    TKDIR    6            /* directive            */
  300. #define    TKLBL    7            /* line label            */
  301. #define    TKLIT    8            /* numeric literal        */
  302. #define    TKSTR    9            /* quoted string literal    */
  303. #define    TKCMD    10            /* command name            */
  304.  
  305. /*    Internal defined functions                    */
  306.  
  307. #define    nextab(a)    (a & ~7) + 8
  308. #ifdef    abs
  309. #undef    abs
  310. #endif
  311.  
  312. /* DIFCASE represents the integer difference between upper
  313.    and lower case letters.  It is an xor-able value, which is
  314.    fortunate, since the relative positions of upper to lower
  315.    case letters is the opposite of ascii in ebcdic.
  316. */
  317.  
  318. #ifdef    islower
  319. #undef    islower
  320. #endif
  321.  
  322. #if    ASCII
  323.  
  324. #define    DIFCASE        0x20
  325. #define isletter(c)    (('a' <= c && 'z' >= c) || ('A' <= c && 'Z' >= c))
  326. #define islower(c)    (('a' <= c && 'z' >= c))
  327. #endif
  328.  
  329. #if    EBCDIC
  330.  
  331. #define    DIFCASE        0x40
  332. #define isletter(c)    (('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c) || ('s' <= c && 'z' >= c) || ('A' <= c && 'I' >= c) || ('J' <= c && 'R' >= c) || ('S' <= c && 'Z' >= c))
  333. #define islower(c)    (('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c) || ('s' <= c && 'z' >= c))
  334. #endif
  335.  
  336. /*    Dynamic RAM tracking and reporting redefinitions    */
  337.  
  338. #if    RAMSIZE
  339. #define    malloc    allocate
  340. #define    free    release
  341. #endif
  342.  
  343. /*
  344.  * There is a window structure allocated for every active display window. The
  345.  * windows are kept in a big list, in top to bottom screen order, with the
  346.  * listhead at "wheadp". Each window contains its own values of dot and mark.
  347.  * The flag field contains some bits that are set by commands to guide
  348.  * redisplay. Although this is a bit of a compromise in terms of decoupling,
  349.  * the full blown redisplay is just too expensive to run for every input
  350.  * character.
  351.  */
  352. typedef struct  WINDOW {
  353.         struct  WINDOW *w_wndp;         /* Next window                  */
  354.         struct  BUFFER *w_bufp;         /* Buffer displayed in window   */
  355.         struct  LINE *w_linep;          /* Top line in the window       */
  356.         struct  LINE *w_dotp;           /* Line containing "."          */
  357.         short   w_doto;                 /* Byte offset for "."          */
  358.         struct  LINE *w_markp;          /* Line containing "mark"       */
  359.         short   w_marko;                /* Byte offset for "mark"       */
  360.         char    w_toprow;               /* Origin 0 top row of window   */
  361.         char    w_ntrows;               /* # of rows of text in window  */
  362.         char    w_force;                /* If NZ, forcing row.          */
  363.         char    w_flag;                 /* Flags.                       */
  364. #if    COLOR
  365.     char    w_fcolor;        /* current forground color    */
  366.     char    w_bcolor;        /* current background color    */
  367. #endif
  368. }       WINDOW;
  369.  
  370. #define WFFORCE 0x01                    /* Window needs forced reframe  */
  371. #define WFMOVE  0x02                    /* Movement from line to line   */
  372. #define WFEDIT  0x04                    /* Editing within a line        */
  373. #define WFHARD  0x08                    /* Better to a full display     */
  374. #define WFMODE  0x10                    /* Update mode line.            */
  375. #define    WFCOLR    0x20            /* Needs a color change        */
  376.  
  377. /*
  378.  * Text is kept in buffers. A buffer header, described below, exists for every
  379.  * buffer in the system. The buffers are kept in a big list, so that commands
  380.  * that search for a buffer by name can find the buffer header. There is a
  381.  * safe store for the dot and mark in the header, but this is only valid if
  382.  * the buffer is not being displayed (that is, if "b_nwnd" is 0). The text for
  383.  * the buffer is kept in a circularly linked list of lines, with a pointer to
  384.  * the header line in "b_linep".
  385.  *     Buffers may be "Inactive" which means the files associated with them
  386.  * have not been read in yet. These get read in at "use buffer" time.
  387.  */
  388. typedef struct  BUFFER {
  389.         struct  BUFFER *b_bufp;         /* Link to next BUFFER          */
  390.         struct  LINE *b_dotp;           /* Link to "." LINE structure   */
  391.         short   b_doto;                 /* Offset of "." in above LINE  */
  392.         struct  LINE *b_markp;          /* The same as the above two,   */
  393.         short   b_marko;                /* but for the "mark"           */
  394.         struct  LINE *b_linep;          /* Link to the header LINE      */
  395.     char    b_active;        /* window activated flag    */
  396.         char    b_nwnd;                 /* Count of windows on buffer   */
  397.         char    b_flag;                 /* Flags                        */
  398.     int    b_mode;            /* editor mode of this buffer    */
  399.         char    b_fname[NFILEN];        /* File name                    */
  400.         char    b_bname[NBUFN];         /* Buffer name                  */
  401. #if    CRYPT
  402.     char    b_key[NPAT];        /* current encrypted key    */
  403. #endif
  404. }       BUFFER;
  405.  
  406. #define BFINVS  0x01                    /* Internal invisable buffer    */
  407. #define BFCHG   0x02                    /* Changed since last write     */
  408.  
  409. /*    mode flags    */
  410. #define    NUMMODES    9        /* # of defined modes        */
  411.  
  412. #define    MDWRAP    0x0001            /* word wrap            */
  413. #define    MDCMOD    0x0002            /* C indentation and fence match*/
  414. #define    MDSPELL    0x0004            /* spell error parcing        */
  415. #define    MDEXACT    0x0008            /* Exact matching for searches    */
  416. #define    MDVIEW    0x0010            /* read-only buffer        */
  417. #define MDOVER    0x0020            /* overwrite mode        */
  418. #define MDMAGIC    0x0040            /* regular expresions in search */
  419. #define    MDCRYPT    0x0080            /* encrytion mode active    */
  420. #define    MDASAVE    0x0100            /* auto-save mode        */
  421.  
  422. /*
  423.  * The starting position of a region, and the size of the region in
  424.  * characters, is kept in a region structure.  Used by the region commands.
  425.  */
  426. typedef struct  {
  427.         struct  LINE *r_linep;          /* Origin LINE address.         */
  428.         short   r_offset;               /* Origin LINE offset.          */
  429.         long    r_size;                 /* Length in characters.        */
  430. }       REGION;
  431.  
  432. /*
  433.  * All text is kept in circularly linked lists of "LINE" structures. These
  434.  * begin at the header line (which is the blank line beyond the end of the
  435.  * buffer). This line is pointed to by the "BUFFER". Each line contains a the
  436.  * number of bytes in the line (the "used" size), the size of the text array,
  437.  * and the text. The end of line is not stored as a byte; it's implied. Future
  438.  * additions will include update hints, and a list of marks into the line.
  439.  */
  440. typedef struct  LINE {
  441.         struct  LINE *l_fp;             /* Link to the next line        */
  442.         struct  LINE *l_bp;             /* Link to the previous line    */
  443.         short   l_size;                 /* Allocated size               */
  444.         short   l_used;                 /* Used size                    */
  445.         char    l_text[1];              /* A bunch of characters.       */
  446. }       LINE;
  447.  
  448. #define lforw(lp)       ((lp)->l_fp)
  449. #define lback(lp)       ((lp)->l_bp)
  450. #define lgetc(lp, n)    ((lp)->l_text[(n)]&0xFF)
  451. #define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
  452. #define llength(lp)     ((lp)->l_used)
  453.  
  454. /*
  455.  * The editor communicates with the display using a high level interface. A
  456.  * "TERM" structure holds useful variables, and indirect pointers to routines
  457.  * that do useful operations. The low level get and put routines are here too.
  458.  * This lets a terminal, in addition to having non standard commands, have
  459.  * funny get and put character code too. The calls might get changed to
  460.  * "termp->t_field" style in the future, to make it possible to run more than
  461.  * one terminal type.
  462.  */
  463. typedef struct  {
  464.     short    t_mrow;            /* max number of rows allowable */
  465.         short   t_nrow;                 /* current number of rows used  */
  466.         short   t_mcol;                 /* max Number of columns.       */
  467.         short   t_ncol;                 /* current Number of columns.   */
  468.     short    t_margin;        /* min margin for extended lines*/
  469.     short    t_scrsiz;        /* size of scroll region "    */
  470.     int    t_pause;        /* # times thru update to pause */
  471.         int     (*t_open)();            /* Open terminal at the start.  */
  472.         int     (*t_close)();           /* Close terminal at end.       */
  473.     int    (*t_kopen)();        /* Open keyboard        */
  474.     int    (*t_kclose)();        /* close keyboard        */
  475.         int     (*t_getchar)();         /* Get character from keyboard. */
  476.         int     (*t_putchar)();         /* Put character to display.    */
  477.         int     (*t_flush)();           /* Flush output buffers.        */
  478.         int     (*t_move)();            /* Move the cursor, origin 0.   */
  479.         int     (*t_eeol)();            /* Erase to end of line.        */
  480.         int     (*t_eeop)();            /* Erase to end of page.        */
  481.         int     (*t_beep)();            /* Beep.                        */
  482.     int    (*t_rev)();        /* set reverse video state    */
  483.     int    (*t_rez)();        /* change screen resolution    */
  484. #if    COLOR
  485.     int    (*t_setfor)();        /* set forground color        */
  486.     int    (*t_setback)();        /* set background color        */
  487. #endif
  488. }       TERM;
  489.  
  490. /*    TEMPORARY macros for terminal I/O  (to be placed in a machine
  491.                         dependant place later)    */
  492.  
  493. #define    TTopen        (*term.t_open)
  494. #define    TTclose        (*term.t_close)
  495. #define    TTkopen        (*term.t_kopen)
  496. #define    TTkclose    (*term.t_kclose)
  497. #define    TTgetc        (*term.t_getchar)
  498. #define    TTputc        (*term.t_putchar)
  499. #define    TTflush        (*term.t_flush)
  500. #define    TTmove        (*term.t_move)
  501. #define    TTeeol        (*term.t_eeol)
  502. #define    TTeeop        (*term.t_eeop)
  503. #define    TTbeep        (*term.t_beep)
  504. #define    TTrev        (*term.t_rev)
  505. #define    TTrez        (*term.t_rez)
  506. #if    COLOR
  507. #define    TTforg        (*term.t_setfor)
  508. #define    TTbacg        (*term.t_setback)
  509. #endif
  510.  
  511. /*    structure for the table of initial key bindings        */
  512.  
  513. typedef struct  {
  514.         short   k_code;                 /* Key code                     */
  515.         int     (*k_fp)();              /* Routine to handle it         */
  516. }       KEYTAB;
  517.  
  518. /*    structure for the name binding table        */
  519.  
  520. typedef struct {
  521.     char *n_name;        /* name of function key */
  522.     int (*n_func)();    /* function name is bound to */
  523. }    NBIND;
  524.  
  525. /*    The editor holds deleted text chunks in the KILL buffer. The
  526.     kill buffer is logically a stream of ascii characters, however
  527.     due to its unpredicatable size, it gets implemented as a linked
  528.     list of chunks. (The d_ prefix is for "deleted" text, as k_
  529.     was taken up by the keycode structure)
  530. */
  531.  
  532. typedef    struct KILL {
  533.     struct KILL *d_next;    /* link to next chunk, NULL if last */
  534.     char d_chunk[KBLOCK];    /* deleted text */
  535. } KILL;
  536.  
  537. /*    When emacs' command interpetor needs to get a variable's name,
  538.     rather than it's value, it is passed back as a VDESC variable
  539.     description structure. The v_num field is a index into the
  540.     appropriate variable table.
  541. */
  542.  
  543. typedef struct VDESC {
  544.     int v_type;    /* type of variable */
  545.     int v_num;    /* ordinal pointer to variable in list */
  546. } VDESC;
  547.  
  548. /*    The !WHILE directive in the execution language needs to
  549.     stack references to pending whiles. These are stored linked
  550.     to each currently open procedure via a linked list of
  551.     the following structure
  552. */
  553.  
  554. typedef struct WHBLOCK {
  555.     LINE *w_begin;        /* ptr to !while statement */
  556.     LINE *w_end;        /* ptr to the !endwhile statement*/
  557.     int w_type;        /* block type */
  558.     struct WHBLOCK *w_next;    /* next while */
  559. } WHBLOCK;
  560.  
  561. #define    BTWHILE        1
  562. #define    BTBREAK        2
  563.  
  564. /*
  565.  * Incremental search defines.
  566.  */
  567. #if    ISRCH
  568.  
  569. #define    CMDBUFLEN    256    /* Length of our command buffer */
  570.  
  571. #define    IS_ABORT    0x07    /* Abort the isearch */
  572. #define IS_BACKSP    0x08    /* Delete previous char */
  573. #define    IS_TAB        0x09    /* Tab character (allowed search char) */
  574. #define IS_NEWLINE    0x0D    /* New line from keyboard (Carriage return) */
  575. #define    IS_QUOTE    0x11    /* Quote next character */
  576. #define IS_REVERSE    0x12    /* Search backward */
  577. #define    IS_FORWARD    0x13    /* Search forward */
  578. #define    IS_VMSQUOTE    0x16    /* VMS quote character */
  579. #define    IS_VMSFORW    0x18    /* Search forward for VMS */
  580. #define    IS_QUIT        0x1B    /* Exit the search */
  581. #define    IS_RUBOUT    0x7F    /* Delete previous character */
  582.  
  583. /* IS_QUIT is no longer used, the variable metac is used instead */
  584.  
  585. #endif
  586.  
  587. #if    MAGIC
  588.  
  589. /*
  590.  * Defines for the metacharacters in the regular expressions in search
  591.  * routines.
  592.  */
  593.  
  594. #define    MCNIL        0    /* Like the '\0' for strings.*/
  595. #define    LITCHAR        1
  596. #define    ANY        2
  597. #define    CCL        3
  598. #define    NCCL        4
  599. #define    BOL        5
  600. #define    EOL        6
  601. #define    CLOSURE        256    /* An or-able value.*/
  602. #define    MASKCL        CLOSURE - 1
  603.  
  604. #define    MC_ANY        '.'    /* 'Any' character (except newline).*/
  605. #define    MC_CCL        '['    /* Character class.*/
  606. #define    MC_NCCL        '^'    /* Negate character class.*/
  607. #define    MC_RCCL        '-'    /* Range in character class.*/
  608. #define    MC_ECCL        ']'    /* End of character class.*/
  609. #define    MC_BOL        '^'    /* Beginning of line.*/
  610. #define    MC_EOL        '$'    /* End of line.*/
  611. #define    MC_CLOSURE    '*'    /* Closure - does not extend past newline.*/
  612.  
  613. #define    MC_ESC        '\\'    /* Escape - suppress meta-meaning.*/
  614.  
  615. #define    BIT(n)        (1 << (n))    /* An integer with one bit set.*/
  616. #define    CHCASE(c)    ((c) ^ DIFCASE)    /* Toggle the case of a letter.*/
  617.  
  618. /* HICHAR - 1 is the largest character we will deal with.
  619.  * HIBYTE represents the number of bytes in the bitmap.
  620.  */
  621.  
  622. #define    HICHAR        256
  623. #define    HIBYTE        HICHAR >> 3
  624.  
  625. typedef char    *BITMAP;
  626.  
  627. typedef    struct {
  628.     short int    mc_type;
  629.     union {
  630.         int    lchar;
  631.         BITMAP    cclmap;
  632.     } u;
  633. } MC;
  634. #endif
  635.  
  636.