home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / word / text / 024 / tdestr.h < prev    next >
C/C++ Source or Header  |  1993-06-04  |  27KB  |  742 lines

  1. /*
  2.  * New editor name:  tde, the Thomson-Davis Editor.
  3.  * Author:           Frank Davis
  4.  * Date:             June 5, 1991
  5.  *
  6.  * This modification of Douglas Thomson's code is released into the
  7.  * public domain, Frank Davis.  You may distribute it freely.
  8.  *
  9.  * This file contains define's and structure declarations common to all
  10.  * editor modules.  It should be included in every source code module.
  11.  *
  12.  * I'm so stupid, I can't keep up with which declarations are in which
  13.  * file.  I decided to put all typedefs, structs, and defines in one file.
  14.  * If I don't, I end up defining a typedef one way in one file and a
  15.  * completely different way in another file.
  16.  */
  17.  
  18.  
  19. #include <stdio.h>
  20. #include <string.h>
  21. #include <stdlib.h>
  22. #include <ctype.h>
  23. #include <conio.h>
  24. #include <assert.h>
  25. #if defined( __MSC__ )
  26.    #include <malloc.h>          /* for memory allocation */
  27.    #if defined( toupper )
  28.        #undef toupper
  29.    #endif
  30. #else
  31.    #include <alloc.h>           /* for memory allocation */
  32. #endif
  33.  
  34.  
  35. /*
  36.  * defines for the inline assembler.
  37.  */
  38. #if defined( __MSC__ )
  39.    #define  ASSEMBLE   _asm
  40. #else
  41.    #define  ASSEMBLE   asm
  42. #endif
  43.  
  44.  
  45. #define MAX_COLS            80  /* widest screen ever used */
  46. #define MAX_LINES           24  /* highest screen ever used */
  47. #define BUFF_SIZE         1042  /* buffer size for lines */
  48. #define MAX_LINE_LENGTH   1040  /* longest line allowed in file */
  49. #define FNAME_LENGTH        45  /* maximum file name length in lite bar */
  50. #define NO_MARKERS           3  /* maximum no. of markers */
  51. #define UNDO_STACK_LEN     200  /* number of lines in undo stack */
  52.  
  53. /*
  54.  * when we read in a file, lets try to match the size of the read buffer
  55.  *   with some multiple of a hardware or software cache that may be present.
  56.  */
  57. #define READ_LENGTH             1024
  58. #define DEFAULT_BIN_LENGTH      64
  59.  
  60.  
  61. #define REGX_SIZE               200     /* maximum number of nodes in nfa */
  62.  
  63.  
  64. /*
  65.  * general defines.
  66.  */
  67. #define ERROR             (-1)  /* abnormal termination */
  68. #define OK                   0  /* normal termination */
  69. #define TRUE                 1  /* logical true */
  70. #define FALSE                0  /* logical false */
  71.  
  72. #define MAX_KEYS           256  /* number of special keys recognized by TDE */
  73. #define MAX_TWO_KEYS       128  /* number of two key-combos allowed by TDE  */
  74. #define STROKE_LIMIT      1024  /* number of key strokes in playback buffer */
  75.  
  76.  
  77. #define STACK_UNDERFLOW      1  /* code for underflowing macro stack */
  78. #define STACK_OVERFLOW       2  /* code for overflowing macro stack */
  79. #define SAS_P               20  /* number of sas pointers to tokens */
  80. #define NUM_FUNCS          139
  81.  
  82. #define NUM_COLORS          14  /* number of color fields in TDE */
  83.  
  84. /*
  85.  * special cases for keyboard mapping -  see bottom of main.c
  86.  */
  87. #define RTURN           262           /* Return key = 262 */
  88. #define ESC             258           /* Escape key = 258 */
  89. #define CONTROL_BREAK   269           /* Control-Break = 269 */
  90.  
  91.  
  92. /*
  93.  * The following defines are used by the "error" function to indicate
  94.  *  how serious the error is.
  95.  */
  96. #define WARNING         1    /* user must acknowledge, editor continues */
  97. #define FATAL           2    /* editor aborts - very rare! */
  98. #define INFO            3    /* display message, acknowledge, continue */
  99.  
  100.  
  101. /*
  102.  * define the type of block marked by user and block actions
  103.  */
  104. #define NOTMARKED       0    /* block type undefined */
  105. #define BOX             1    /* block marked by row and column */
  106. #define LINE            2    /* block marked by begin and end lines */
  107. #define STREAM          3    /* block marked by begin and end characters */
  108.  
  109. #define MOVE            1
  110. #define DELETE          2
  111. #define COPY            3
  112. #define KOPY            4
  113. #define FILL            5
  114. #define OVERLAY         6
  115. #define NUMBER          7
  116. #define SWAP            8
  117.  
  118. #define LEFT            1
  119. #define RIGHT           2
  120.  
  121. #define ASCENDING       1
  122. #define DESCENDING      2
  123.  
  124.  
  125. /*
  126.  * three types of ways to update windows
  127.  */
  128. #define LOCAL           1
  129. #define NOT_LOCAL       2
  130. #define GLOBAL          3
  131.  
  132. #define CURLINE         1
  133. #define NOTCURLINE      2
  134.  
  135.  
  136. /*
  137.  * search/replace flags.
  138.  */
  139. #define BOYER_MOORE     0
  140. #define REG_EXPRESSION  1
  141.  
  142. #define CLR_SEARCH      0
  143. #define WRAPPED         1
  144. #define SEARCHING       2
  145. #define REPLACING       3
  146. #define NFA_GAVE_UP     4
  147.  
  148. #define IGNORE          1
  149. #define MATCH           2
  150.  
  151. #define PROMPT          1
  152. #define NOPROMPT        2
  153.  
  154. #define FORWARD         1
  155. #define BACKWARD        2
  156.  
  157. #define BEGIN           1
  158. #define END             2
  159.  
  160.  
  161. #define BEGINNING       1
  162. #define CURRENT         2
  163.  
  164. /*
  165.  * word wrap flag.
  166.  */
  167. #define NO_WRAP         0
  168. #define FIXED_WRAP      1
  169. #define DYNAMIC_WRAP    2
  170.  
  171. /*
  172.  * date and time formats
  173.  */
  174. #define MM_DD_YY        0
  175. #define DD_MM_YY        1
  176. #define YY_MM_DD        2
  177. #define MM_DD_YYYY      3
  178. #define DD_MM_YYYY      4
  179. #define YYYY_MM_DD      5
  180.  
  181. #define _12_HOUR        0
  182. #define _24_HOUR        1
  183.  
  184.  
  185. /*
  186.  * used in interrupt 0x21 function xx for checking file status
  187.  */
  188. #define EXIST           0
  189. #define WRITE           2
  190. #define READ            4
  191. #define READ_WRITE      6
  192.  
  193. #define NORMAL          0x00
  194. #define READ_ONLY       0x01
  195. #define HIDDEN          0x02
  196. #define SYSTEM          0x04
  197. #define VOLUME_LABEL    0x08
  198. #define SUBDIRECTORY    0x10
  199. #define ARCHIVE         0x20
  200.  
  201. /*
  202.  * critical error def's
  203.  */
  204. #define RETRY           1
  205. #define ABORT           2
  206. #define FAIL            3
  207.  
  208.  
  209. /*
  210.  * flags used for opening files to write either in binary or text mode.
  211.  * crlf is for writing files in text mode - Operating System converts
  212.  * lf to crlf automatically on output.  in binary mode, lf is not translated.
  213.  */
  214. #define NATIVE          1
  215. #define CRLF            2
  216. #define LF              3
  217. #define BINARY          4
  218. #define TEXT            5
  219.  
  220. #define OVERWRITE       1
  221. #define APPEND          2
  222.  
  223. /*
  224.  * characters used in tdeasm.c to display eol and column pointer in ruler
  225.  */
  226. #define EOL_CHAR        0x11
  227. #define RULER_PTR       0x19
  228. #define RULER_FILL      0x2e
  229. #define RULER_TICK      0x04
  230. #define LM_CHAR         0xb4
  231. #define RM_CHAR_RAG     0x3c
  232. #define RM_CHAR_JUS     0xc3
  233. #define PGR_CHAR        0x14
  234.  
  235.  
  236. /*
  237.  * character used two separate vertical screens
  238.  */
  239. #define VERTICAL_CHAR   0xba
  240.  
  241.  
  242. /*
  243.  * cursor size
  244.  */
  245. #define SMALL_INS       0
  246. #define BIG_INS         1
  247.  
  248.  
  249. /*
  250.  * possible answers to various questions - see get_yn, get_ynaq and get_oa
  251.  */
  252. #define A_YES           1
  253. #define A_NO            2
  254. #define A_ALWAYS        3
  255. #define A_QUIT          4
  256. #define A_ABORT         5
  257. #define A_OVERWRITE     6
  258. #define A_APPEND        7
  259.  
  260. /*
  261.  * The following defines specify which video attributes give desired
  262.  *  effects on different display devices.
  263.  * REVERSE is supposed to be reverse video - a different background color,
  264.  *  so that even a blank space can be identified.
  265.  * HIGH is supposed to quickly draw the user's eye to the relevant part of
  266.  *  the screen, either for a message or for matched text in find/replace.
  267.  * NORMAL is supposed to be something pleasant to look at for the main
  268.  *  body of the text.
  269.  */
  270. #define VIDEO_INT       0x10
  271.  
  272. #define HERC_REVERSE    0x70
  273. #define HERC_UNDER      0x01
  274. #define HERC_NORMAL     0x07
  275. #define HERC_HIGH       0x0f
  276.  
  277. #define COLOR_HEAD      0x4b
  278. #define COLOR_TEXT      0x07
  279. #define COLOR_DIRTY     0x02
  280. #define COLOR_MODE      0x17
  281. #define COLOR_BLOCK     0x71
  282. #define COLOR_MESSAGE   0x0f
  283. #define COLOR_HELP      0x1a
  284. #define COLOR_DIAG      0x0e
  285. #define COLOR_EOF       0x09
  286. #define COLOR_CURL      0x0f
  287. #define COLOR_RULER     0x02
  288. #define COLOR_POINTER   0x0a
  289. #define COLOR_OVRS      0x00
  290.  
  291. #define COLOR_80        3
  292. #define MONO_80         7
  293.  
  294. #define VGA             3
  295. #define EGA             2
  296. #define CGA             1
  297. #define MDA             0
  298.  
  299.  
  300. #define SAS_DELIMITERS  " \n"
  301.  
  302. /*
  303.  * let's explicitly treat characters as unsigned.
  304.  */
  305. typedef unsigned char far * text_ptr;