home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / se / part03 / se.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-01-25  |  7.7 KB  |  288 lines

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