home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume4 / se / part1 / se.h < prev    next >
C/C++ Source or Header  |  1986-11-30  |  8KB  |  273 lines

  1. /* se.h    --- definitions    for the    screen editor */
  2.  
  3. #include <stdio.h>
  4. #include <ctype.h>
  5. #include <signal.h>
  6.  
  7. /* some standard definitions used throughout the screen editor */
  8. #include "constdefs.h"
  9. #include "ascii.h"    /* definitions of ascii characters */
  10.  
  11. /* new data types */
  12. typedef    int filedes;        /* Unix    file descriptor    */
  13.  
  14. typedef    struct ldesc {        /* line    descriptor */
  15. #ifdef OLD_SCRATCH
  16.     struct    ldesc *Prevline; /* link to previous line */
  17.     struct    ldesc *Nextline; /* link to next line */
  18. #endif
  19.     unsigned Seekaddr;    /* scratch file seek address / 8 */
  20.     unsigned Lineleng : 16;    /* line length    including NL  EOS */
  21.     unsigned Globmark : 1;    /* mark for global commands */
  22.     unsigned Markname : 7;    /* mark name associated with line */
  23. } LINEDESC;
  24.  
  25. /* Language extensions */
  26. #define min(a,b)    ((a)<(b)?(a):(b))
  27. #define max(a,b)    ((a)>(b)?(a):(b))
  28. #define SKIPBL(l,i)    while (l[i] == ' ') (i)++
  29.  
  30. /* save a little procedure call overhead... */
  31. #define remark(text)    mesg(text, REMARK_MSG)
  32.  
  33. /* Arbitrary definitions */
  34. #define BACKWARD    -1
  35. #define FORWARD        0
  36. #define NOSTATUS    1
  37. #define NOMORE        0
  38. #define NEWLINE        '\n'
  39. #define TAB        '\t'
  40. #define RETERR    1
  41. #define RETOK    0
  42.  
  43. /* Array dimensions and    other limit values */
  44. #define MAXBUF        8192
  45. #define MAXTOBUF    512
  46. #define MAXCHARS    10
  47. #define MAXROWS        200
  48. #define MINROWS        16
  49. #define MAXCOLS        200
  50. #define MAXLINE        512
  51. #define MAXPAT        512
  52. #define GARB_FACTOR    2
  53. #define GARB_THRESHOLD    1000
  54. #define BUFENT        1
  55. #define KEYSIZE        11
  56.  
  57. /* Message classes for status line at bottom of    screen */
  58. #define NOMSG        0
  59. #define REMARK_MSG    1
  60. #define CHAR_MSG    2
  61. #define CASE_MSG    3
  62. #define INS_MSG        4
  63. #define TIME_MSG    5
  64. #define FILE_MSG    6
  65. #define COL_MSG        7
  66. #define LINE_MSG    8
  67. #define COMPRESS_MSG    9
  68. #define HELP_MSG    10
  69. #define MODE_MSG    11
  70. #define CRYPT_MSG    12
  71.  
  72. /* Characters typed by the user    */
  73. #define ANYWAY        '!'
  74. #define APPENDCOM    'a'
  75. #define UCAPPENDCOM    'A'
  76. #define BACKSEARCH    '<'
  77. #define CHANGE        'c'
  78. #define UCCHANGE    'C'
  79. #define COPYCOM        't'
  80. #define UCCOPYCOM    'T'
  81. #define CURLINE        '.'
  82. #define DEFAULTNAME    ' '
  83. #define DELCOM        'd'
  84. #define UCDELCOM    'D'
  85. #define ENTER        'e'
  86. #define UCENTER        'E'
  87. #define EXCLUDE        'x'
  88. #define UCEXCLUDE    'X'
  89. #define GLOBAL        'g'
  90. #define UCGLOBAL    'G'
  91. #define GMARK        '\''
  92. #define HELP        'h'
  93. #define UCHELP        'H'
  94. #define INSERT        'i'
  95. #define UCINSERT    'I'
  96. #define JOINCOM        'j'
  97. #define UCJOINCOM    'J'
  98. #define LASTLINE    '$'
  99. #define LOCATECMD    'l'
  100. #define UCLOCATECMD    'L'
  101. #define MARKCOM        'k'
  102. #define UCMARKCOM    'K'
  103. #define MOVECOM        'm'
  104. #define UCMOVECOM    'M'
  105. #define NAMECOM        'n'
  106. #define UCNAMECOM    'N'
  107. #define OPTCOM        'o'
  108. #define UCOPTCOM    'O'
  109. #define PAGECOM        ':'
  110. #define OVERLAYCOM    'v'
  111. #define UCOVERLAYCOM    'V'
  112. #define PREVLINE    '^'
  113. #define PREVLINE2    '-'
  114. #define PRINT        'p'
  115. #define UCPRINT        'P'
  116. #define PRINTCUR    '='
  117. #define PRINTFIL    'f'
  118. #define UCPRINTFIL    'F'
  119. #define QUIT        'q'
  120. #define UCQUIT        'Q'
  121. #define READCOM        'r'
  122. #define UCREADCOM    'R'
  123. #define SCAN        '/'
  124. #define SEARCH        '>'
  125. #define SUBSTITUTE    's'
  126. #define UCSUBSTITUTE    'S'
  127. #define TLITCOM        'y'
  128. #define UCTLITCOM    'Y'
  129. #define TOPLINE        '#'
  130. #define UNDOCOM        'u'
  131. #define UCUNDOCOM    'U'
  132. #define WRITECOM    'w'
  133. #define UCWRITECOM    'W'
  134. #define MISCCOM        'z'
  135. #define UCMISCCOM    'Z'
  136. #define SHELLCOM    '!'
  137.  
  138. /* Error message numbers.  Arbitrary so    long as    they are different. */
  139. #define EBACKWARD    1
  140. #define ENOPAT        2
  141. #define EBADPAT        3
  142. #define EBADSTR        4
  143. #define EBADSUB        5
  144. #define ECANTREAD    6
  145. #define EEGARB        7
  146. #define EFILEN        8
  147. #define EBADTABS    9
  148. #define EINSIDEOUT    10
  149. #define EKNOTFND    11
  150. #define ELINE1        12
  151. #define E2LONG        13
  152. #define ENOERR        14
  153. #define ENOLIMBO    15
  154. #define EODLSSGTR    16
  155. #define EORANGE        17
  156. #define EOWHAT        18
  157. #define EPNOTFND    19
  158. #define ESTUPID        20
  159. #define EWHATZAT    21
  160. #define EBREAK        22
  161. #define ELINE2        23
  162. #define ECANTWRITE    24
  163. #define ECANTINJECT    25
  164. #define ENOMATCH    26
  165. #define ENOFN        27
  166. #define EBADLIST    28
  167. #define ENOLIST        29
  168. #define ENONSENSE    30
  169. #define ENOHELP        31
  170. #define EBADLNR        32
  171. #define EFEXISTS    33
  172. #define EBADCOL        34
  173. #define ENOLANG        35
  174. #define ETRUNC        36
  175. #define ENOSHELL    37
  176. #define ECANTFORK    38
  177. #define EHANGUP        39
  178. #define ENOSUB        40
  179. #define ENOCMD        41
  180.  
  181. #ifdef HARD_TERMS
  182. /* Terminal types */
  183. #define NOTERM        0    /* type    not known yet */
  184. #define ADDS980        1    /* ADDS    Consul 980 */
  185. #define ADDS100        2    /* ADDS    Regent 100, 20,    40, etc    */
  186. #define FOX        3    /* Perkin-Elmer    1100 */
  187. #define TVT        4    /* Allen's SWTPC T. V. Typewriter II */
  188. #define GT40        5    /* DEC GT40 with Waugh terminal    program    */
  189. #define BEE150        6    /* Beehive 150 */
  190. #define BEE200        7    /* Beehive 200 */
  191. #define SBEE        8    /* Beehive Super-Bee */
  192. #define SOL        9    /* Sol emulating Beehive 200 */
  193. #define HAZ1510        10    /* Hazeltine 1500 series */
  194. #define CG        11    /* Chromatics CG */
  195. #define ISC8001        12    /* ISC 8001 color terminal */
  196. #define ADM3A        13    /* Lear-Siegler    ADM 3A */
  197. #define IBM        14    /* IBM 3101 */
  198. #define ANP        15    /* Allen & Paul    model 1    */
  199. #define NETRON        16    /* Netronics */
  200. #define H19        17    /* Heath H19/Zenith Z19    */
  201. #define TRS80        18    /* Radio Shaft TRS80 */
  202. #define HP21        19    /* Hewlett-Packard 2621A/P */
  203. #define ADM31        20    /* Lear-Siegler    ADM 31 */
  204. #define VI200        21    /* VIsual 200 terminal */
  205. #define VC4404        22    /* Volker-Craig    4404 */
  206. #define ESPRIT        23    /* Hazeltine Esprit (Hazeltine mode) */
  207. #define TS1        24    /* Falco TS-1 */
  208. #define TVI950        25    /* Televideo 950 */
  209. #define VI50        26    /* Visual 50 */
  210. #define VI300        27    /* Visual 300    */
  211. #endif
  212.  
  213. /* Screen design positions */
  214. #define NAMECOL        5    /* column to put mark name in */
  215. #define BARCOL        6    /* column for "|" divider */
  216. #define POOPCOL        7    /* column for text to start in */
  217.  
  218. /* Control characters */
  219.  
  220. /* Leftward cursor motion */
  221. #define CURSOR_LEFT        CTRL_H    /* left    one column */
  222. #define TAB_LEFT        CTRL_E    /* left    one tab    stop */
  223. #define SKIP_LEFT        CTRL_W    /* go to column    1 */
  224. #define SCAN_LEFT        CTRL_L    /* scan    left for a char    */
  225. #define G_LEFT            CTRL_U    /* erase char to left */
  226. #define G_TAB_LEFT        FS    /* erase to prev tab stop */
  227. #define KILL_LEFT        CTRL_Y    /* erase to column 1 */
  228. #define G_SCAN_LEFT        CTRL_N    /* scan    left and erase */
  229.  
  230. /* Rightward cursor motion */
  231. #define CURSOR_RIGHT        CTRL_G    /* right one column */
  232. #define TAB_RIGHT        CTRL_I    /* right one tab stop */
  233. #define SKIP_RIGHT        CTRL_O    /* go to end of    line */
  234. #ifdef GITVAX
  235. #define SCAN_RIGHT        CTRL_S    /* scan    right for char */
  236. #else
  237. #define SCAN_RIGHT        CTRL_J    /* scan    right for char */
  238. #endif
  239. #define G_RIGHT            CTRL_R    /* erase over cursor */
  240. #define G_TAB_RIGHT        RS    /* erase to next tab */
  241. #define KILL_RIGHT        CTRL_T    /* erase to end    of line    */
  242. #define G_SCAN_RIGHT        CTRL_B    /* scan    right and erase    */
  243.  
  244. /* Line    termination */
  245. #define T_SKIP_RIGHT        CTRL_V    /* skip    to end and terminate */
  246. #define T_KILL_RIGHT        CR    /* KILL_RIGHT,    SKIP_RIGHT_AND_TERM */
  247. #define FUNNY            CTRL_F    /* take    funny return */
  248. #define CURSOR_UP        CTRL_D    /* move    up one line */
  249. #define CURSOR_DOWN        CTRL_K    /* move    down one line */
  250. #define CURSOR_SAME        CTRL_J    /* leave cursor    on same    line */
  251.  
  252. /* Insertion */
  253. #define INSERT_BLANK        CTRL_C    /* insert one blank */
  254. #define INSERT_TAB        CTRL_X    /* insert blanks to next tab */
  255. #define INSERT_NEWLINE        US    /* insert a newline */
  256.  
  257. /* Miscellany */
  258. #define TOGGLE_INSERT_MODE    CTRL_A    /* toggle insert mode flag */
  259. #define SHIFT_CASE        CTRL_Z    /* toggle case mapping flag */
  260. #define KILL_ALL        DEL    /* erase entire    line */
  261. #ifdef GITVAX
  262. #define FIX_SCREEN        CTRL_Q    /* clear and restore screen */
  263. #else
  264. #define FIX_SCREEN        GS    /* clear and restore screen */
  265. #endif
  266.  
  267. /* Function for moving around the buffer, either style line handling: */
  268. #ifdef OLD_SCRATCH
  269. #define NEXTLINE(k)    ((k) -> Nextline)
  270. #else
  271. #define NEXTLINE(k)    (((k) < &Buf[Lastln]) ? (k) + 1 : Line0)
  272. #endif
  273.