home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / code / microema.sit / src / estruct.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-09  |  20.0 KB  |  686 lines  |  [TEXT/Earl]

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