home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 001-099 / ff093.lzh / MicroEmacs / source / src.arc / estruct.h < prev    next >
C/C++ Source or Header  |  1987-08-16  |  20KB  |  575 lines

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