home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / cpm / emacs / emacssrc.lzh / ed.h < prev    next >
C/C++ Source or Header  |  1992-03-11  |  6KB  |  147 lines

  1.  
  2. #define    CPM80    1            /* CP/M            */
  3.  
  4. #define TELEVIDEO 1
  5.  
  6. #define    CVMVAS    1            /* C-V, M-V arg. in screens.    */
  7.  
  8. #define NFILEN 15
  9. #define NBUFN 15
  10. #define NLINE 128
  11. #define NPAT 20
  12.  
  13. #define    HUGE    1000            /* Huge number            */
  14.  
  15. #define    METACH    0x1B            /* M- prefix,   Control-[, ESC    */
  16. #define CMINUSCH 0x1c
  17.  
  18. #define    META    0x0200            /* Meta flag, or'ed in        */
  19. #define    CTLX    0x0400            /* ^X flag, or'ed in        */
  20. #define MAGIC   0x0100            /* MAIGIC flag */
  21.  
  22. #define    FALSE    0            /* False, no, bad, etc.        */
  23. #define    TRUE    1            /* True, yes, good, etc.    */
  24. #define    ABORT    2            /* Death, ^G, abort, etc.    */
  25.  
  26. #define    FIOSUC    0            /* File I/O, success.        */
  27. #define    FIOFNF    1            /* File I/O, file not found.    */
  28. #define    FIOEOF    2            /* File I/O, end of file.    */
  29. #define    FIOERR    3            /* File I/O, error.        */
  30.  
  31. #define    CFCPCN    0x0001            /* Last command was C-P, C-N    */
  32. #define    CFKILL    0x0002            /* Last command was a kill    */
  33.  
  34. /*
  35.  * There is a window structure allocated for
  36.  * every active display window. The windows are kept in a
  37.  * big list, in top to bottom screen order, with the listhead at
  38.  * "wheadp". Each window contains its own values of dot and mark.
  39.  * The flag field contains some bits that are set by commands
  40.  * to guide redisplay; although this is a bit of a compromise in
  41.  * terms of decoupling, the full blown redisplay is just too
  42.  * expensive to run for every input character. 
  43.  */
  44. typedef    struct    WINDOW {
  45.     struct    LINE *w_dotp;        /* Line containing "."        */
  46.     short    w_doto;            /* Byte offset for "."        */
  47.     struct    LINE *w_markp;        /* Line containing "mark"    */
  48.     short    w_marko;        /* Byte offset for "mark"    */
  49.     struct    WINDOW *w_wndp;        /* Next window            */
  50.     struct    BUFFER *w_bufp;        /* Buffer displayed in window    */
  51.     struct    LINE *w_linep;        /* Top line in the window    */
  52.     char    w_toprow;        /* Origin 0 top row of window    */
  53.     char    w_ntrows;        /* # of rows of text in window    */
  54.     char    w_force;        /* If NZ, forcing row.        */
  55.     char    w_flag;            /* Flags.            */
  56. }    WINDOW;
  57.  
  58. #define    WFFORCE    0x01            /* Window needs forced reframe    */
  59. #define    WFMOVE    0x02            /* Movement from line to line    */
  60. #define    WFEDIT    0x04            /* Editing within a line    */
  61. #define    WFHARD    0x08            /* Better to a full display    */
  62. #define    WFMODE    0x10            /* Update mode line.        */
  63.  
  64. /*
  65.  * Text is kept in buffers. A buffer header, described
  66.  * below, exists for every buffer in the system. The buffers are
  67.  * kept in a big list, so that commands that search for a buffer by
  68.  * name can find the buffer header. There is a safe store for the
  69.  * dot and mark in the header, but this is only valid if the buffer
  70.  * is not being displayed (that is, if "b_nwnd" is 0). The text for
  71.  * the buffer is kept in a circularly linked list of lines, with
  72.  * a pointer to the header line in "b_linep".
  73.  */
  74. typedef    struct    BUFFER {
  75.     struct    LINE *b_dotp;        /* Link to "." LINE structure    */
  76.     short    b_doto;            /* Offset of "." in above LINE    */
  77.     struct    LINE *b_markp;        /* The same as the above two,    */
  78.     short    b_marko;        /* but for the "mark"        */
  79.     struct    BUFFER *b_bufp;        /* Link to next BUFFER        */
  80.     struct    LINE *b_linep;        /* Link to the header LINE    */
  81.     char    b_nwnd;            /* Count of windows on buffer    */
  82.     char    b_flag;            /* Flags            */
  83.     char    b_fname[NFILEN];    /* File name            */
  84.     char    b_bname[NBUFN];        /* Buffer name            */
  85. }    BUFFER;
  86.  
  87. #define    BFTEMP    0x01            /* Internal temporary buffer    */
  88. #define    BFCHG    0x02            /* Changed since last write    */
  89.  
  90. /*
  91.  * The starting position of a
  92.  * region, and the size of the region in
  93.  * characters, is kept in a region structure.
  94.  * Used by the region commands.
  95.  */
  96. typedef    struct    {
  97.     struct    LINE *r_linep;        /* Origin LINE address.        */
  98.     short    r_offset;        /* Origin LINE offset.        */
  99.     short    r_size;            /* Length in characters.    */
  100. }    REGION;
  101.  
  102. /*
  103.  * All text is kept in circularly linked
  104.  * lists of "LINE" structures. These begin at the
  105.  * header line (which is the blank line beyond the
  106.  * end of the buffer). This line is pointed to by
  107.  * the "BUFFER". Each line contains a the number of
  108.  * bytes in the line (the "used" size), the size
  109.  * of the text array, and the text. The end of line
  110.  * is not stored as a byte; it's implied. Future
  111.  * additions will include update hints, and a
  112.  * list of marks into the line.
  113.  */
  114. typedef    struct LINE {
  115.     struct    LINE *l_fp;        /* Link to the next line    */
  116.     struct    LINE *l_bp;        /* Link to the previous line    */
  117.     char    l_size;            /* Allocated size        */
  118.     char    l_used;            /* Used size            */
  119.     char    l_text[1];        /* A bunch of characters.    */
  120. }    LINE;
  121.  
  122. #define    lforw(lp)    ((lp)->l_fp)
  123. #define    lback(lp)    ((lp)->l_bp)
  124. #define    lgetc(lp, n)    ((lp)->l_text[(n)])
  125. #define    lputc(lp, n, c)    ((lp)->l_text[(n)]=(c))
  126. #define    llength(lp)    ((lp)->l_used)
  127.  
  128. extern    int    fillcol;        /* Fill column            */
  129. extern    int    currow;            /* Cursor row            */
  130. extern    int    curcol;            /* Cursor column        */
  131. extern    int    thisflag;        /* Flags, this command        */
  132. extern    int    lastflag;        /* Flags, last command        */
  133. extern    int    curgoal;        /* Goal for C-P, C-N        */
  134. extern    int    mpresf;            /* Stuff in message line    */
  135. extern    int    sgarbf;            /* State of screen unknown    */
  136. extern    WINDOW    *curwp;            /* Current window        */
  137. extern    BUFFER    *curbp;            /* Current buffer        */
  138. extern    WINDOW    *wheadp;        /* Head of list of windows    */
  139. extern    BUFFER    *bheadp;        /* Head of list of buffers    */
  140. extern    BUFFER    *blistp;        /* Buffer for C-X C-B        */
  141. extern    char    pat[NPAT];            /* Search pattern        */
  142.  
  143. extern    BUFFER    *bfind();        /* Lookup a buffer by name    */
  144. extern    WINDOW    *wpopup();        /* Pop up window creation    */
  145. extern    LINE    *lalloc();        /* Allocate a line        */
  146. extern char cclass[128];
  147.