home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / tde221.zip / TDESTR.H < prev    next >
C/C++ Source or Header  |  1993-04-01  |  26KB  |  703 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. /*
  62.  * general defines.
  63.  */
  64. #define ERROR             (-1)  /* abnormal termination */
  65. #define OK                   0  /* normal termination */
  66. #define TRUE                 1  /* logical true */
  67. #define FALSE                0  /* logical false */
  68.  
  69. #define MAX_KEYS           256  /* number of special keys recognized by TDE */
  70. #define MAX_TWO_KEYS       128  /* number of two key-combos allowed by TDE  */
  71. #define STROKE_LIMIT      1024  /* number of key strokes in playback buffer */
  72.  
  73.  
  74. #define STACK_UNDERFLOW      1  /* code for underflowing macro stack */
  75. #define STACK_OVERFLOW       2  /* code for overflowing macro stack */
  76. #define SAS_P               20  /* number of sas pointers to tokens */
  77. #define NUM_FUNCS          135
  78.  
  79. #define NUM_COLORS          14  /* number of color fields in TDE */
  80.  
  81. /*
  82.  * special cases for keyboard mapping -  see bottom of main.c
  83.  */
  84. #define RTURN           262           /* Return key = 262 */
  85. #define ESC             258           /* Escape key = 258 */
  86. #define CONTROL_BREAK   269           /* Control-Break = 269 */
  87.  
  88.  
  89. /*
  90.  * The following defines are used by the "error" function to indicate
  91.  *  how serious the error is.
  92.  */
  93. #define WARNING         1    /* user must acknowledge, editor continues */
  94. #define FATAL           2    /* editor aborts - very rare! */
  95. #define INFO            3    /* display message, acknowledge, continue */
  96.  
  97.  
  98. /*
  99.  * define the type of block marked by user and block actions
  100.  */
  101. #define NOTMARKED       0    /* block type undefined */
  102. #define BOX             1    /* block marked by row and column */
  103. #define LINE            2    /* block marked by begin and end lines */
  104. #define STREAM          3    /* block marked by begin and end characters */
  105.  
  106. #define MOVE            1
  107. #define DELETE          2
  108. #define COPY            3
  109. #define KOPY            4
  110. #define FILL            5
  111. #define OVERLAY         6
  112. #define NUMBER          7
  113. #define SWAP            8
  114.  
  115. #define LEFT            1
  116. #define RIGHT           2
  117.  
  118. #define ASCENDING       1
  119. #define DESCENDING      2
  120.  
  121.  
  122. /*
  123.  * three types of ways to update windows
  124.  */
  125. #define LOCAL           1
  126. #define NOT_LOCAL       2
  127. #define GLOBAL          3
  128.  
  129. #define CURLINE         1
  130. #define NOTCURLINE      2
  131.  
  132.  
  133. /*
  134.  * search/replace flags.
  135.  */
  136. #define CLR_SEARCH      0
  137. #define WRAPPED         1
  138. #define SEARCHING       2
  139. #define REPLACING       3
  140.  
  141. #define IGNORE          1
  142. #define MATCH           2
  143.  
  144. #define PROMPT          1
  145. #define NOPROMPT        2
  146.  
  147. #define FORWARD         1
  148. #define BACKWARD        2
  149.  
  150. #define BEGIN           1
  151. #define END             2
  152.  
  153.  
  154. #define BEGINNING       1
  155. #define CURRENT         2
  156.  
  157. /*
  158.  * word wrap flag.
  159.  */
  160. #define NO_WRAP         0
  161. #define FIXED_WRAP      1
  162. #define DYNAMIC_WRAP    2
  163.  
  164. /*
  165.  * date and time formats
  166.  */
  167. #define MM_DD_YY        0
  168. #define DD_MM_YY        1
  169. #define YY_MM_DD        2
  170. #define MM_DD_YYYY      3
  171. #define DD_MM_YYYY      4
  172. #define YYYY_MM_DD      5
  173.  
  174. #define _12_HOUR        0
  175. #define _24_HOUR        1
  176.  
  177.  
  178. /*
  179.  * used in interrupt 0x21 function xx for checking file status
  180.  */
  181. #define EXIST           0
  182. #define WRITE           2
  183. #define READ            4
  184. #define READ_WRITE      6
  185.  
  186. #define NORMAL          0x00
  187. #define READ_ONLY       0x01
  188. #define HIDDEN          0x02
  189. #define SYSTEM          0x04
  190. #define VOLUME_LABEL    0x08
  191. #define SUBDIRECTORY    0x10
  192. #define ARCHIVE         0x20
  193.  
  194. /*
  195.  * critical error def's
  196.  */
  197. #define RETRY           1
  198. #define ABORT           2
  199. #define FAIL            3
  200.  
  201.  
  202. /*
  203.  * flags used for opening files to write either in binary or text mode.
  204.  * crlf is for writing files in text mode - Operating System converts
  205.  * lf to crlf automatically on output.  in binary mode, lf is not translated.
  206.  */
  207. #define NATIVE          1
  208. #define CRLF            2
  209. #define LF              3
  210. #define BINARY          4
  211. #define TEXT            5
  212.  
  213. #define OVERWRITE       1
  214. #define APPEND          2
  215.  
  216. /*
  217.  * characters used in tdeasm.c to display eol and column pointer in ruler
  218.  */
  219. #define EOL_CHAR        0x11
  220. #define RULER_PTR       0x19
  221. #define RULER_FILL      0x2e
  222. #define RULER_TICK      0x04
  223. #define LM_CHAR         0xb4
  224. #define RM_CHAR_RAG     0x3c
  225. #define RM_CHAR_JUS     0xc3
  226. #define PGR_CHAR        0x14
  227.  
  228.  
  229. /*
  230.  * character used two separate vertical screens
  231.  */
  232. #define VERTICAL_CHAR   0xba
  233.  
  234.  
  235. /*
  236.  * cursor size
  237.  */
  238. #define SMALL_INS       0
  239. #define BIG_INS         1
  240.  
  241.  
  242. /*
  243.  * possible answers to various questions - see get_yn, get_ynaq and get_oa
  244.  */
  245. #define A_YES           1
  246. #define A_NO            2
  247. #define A_ALWAYS        3
  248. #define A_QUIT          4
  249. #define A_ABORT         5
  250. #define A_OVERWRITE     6
  251. #define A_APPEND        7
  252.  
  253. /*
  254.  * The following defines specify which video attributes give desired
  255.  *  effects on different display devices.
  256.  * REVERSE is supposed to be reverse video - a different background color,
  257.  *  so that even a blank space can be identified.
  258.  * HIGH is supposed to quickly draw the user's eye to the relevant part of
  259.  *  the screen, either for a message or for matched text in find/replace.
  260.  * NORMAL is supposed to be something pleasant to look at for the main
  261.  *  body of the text.
  262.  */
  263. #define VIDEO_INT       0x10
  264.  
  265. #define HERC_REVERSE    0x70
  266. #define HERC_UNDER      0x01
  267. #define HERC_NORMAL     0x07
  268. #define HERC_HIGH       0x0f
  269.  
  270. #define COLOR_HEAD      0x4b
  271. #define COLOR_TEXT      0x07
  272. #define COLOR_DIRTY     0x02
  273. #define COLOR_MODE      0x17
  274. #define COLOR_BLOCK     0x71
  275. #define COLOR_MESSAGE   0x0f
  276. #define COLOR_HELP      0x1a
  277. #define COLOR_DIAG      0x0e
  278. #define COLOR_EOF       0x09
  279. #define COLOR_CURL      0x0f
  280. #define COLOR_RULER     0x02
  281. #define COLOR_POINTER   0x0a
  282. #define COLOR_OVRS      0x00
  283.  
  284. #define COLOR_80        3
  285. #define MONO_80         7
  286.  
  287. #define VGA             3
  288. #define EGA             2
  289. #define CGA             1
  290. #define MDA             0
  291.  
  292.  
  293. #define SAS_DELIMITERS  " \n"
  294.  
  295. /*
  296.  * let's explicitly treat characters as unsigned.
  297.  */
  298. typedef unsigned char far * text_ptr;
  299.  
  300.  
  301. /*
  302.  * "s_line_list" contains contains struct defs for a node of text.
  303.  */
  304. typedef struct s_line_list {
  305.    text_ptr line;                       /* pointer to line */
  306.    int      len;                        /* length of line */
  307.    int      dirty;                      /* boolean - dirty line indicator */
  308.    struct s_line_list far *next;        /* next line in doubly linked list */
  309.    struct s_line_list far *prev;        /* prev line in doubly linked list */
  310. } line_list_struc;
  311.  
  312. typedef line_list_struc far *line_list_ptr;
  313.  
  314.  
  315. struct vcfg {
  316.    int color;
  317.    int rescan;
  318.    int mode;
  319.    int far *videomem;
  320. };
  321.  
  322.  
  323. typedef struct {
  324.    char sig[8];                 /* signature, so we can find struct in .exe */
  325.    int  clr[2][NUM_COLORS];     /* one array for mono and another for color */
  326. } COLORS;
  327.  
  328.  
  329. /*
  330.  * structure for two key combos
  331.  */
  332. typedef struct {
  333.    int parent_key;
  334.    int child_key;
  335.    int func;
  336. } TWO_KEY_TYPE;
  337.  
  338.  
  339. typedef struct {
  340.    char sig[8];
  341.    TWO_KEY_TYPE key[MAX_TWO_KEYS];
  342. } TWO_KEY;
  343.  
  344.  
  345. typedef struct {
  346.    char sig[8];
  347.    unsigned char key[MAX_KEYS];
  348. } KEY_FUNC;
  349.  
  350.  
  351. /*
  352.  * structure used in directory list.
  353.  */
  354. typedef struct {
  355.    char fname[14];              /* file name */
  356.    long fsize;                  /* file size in bytes */
  357. } FTYPE;
  358.  
  359.  
  360. /*
  361.  * stuff we need to know about how to display a directory listing.
  362.  */
  363. typedef struct {
  364.    int  row;                    /* absolute row to display dir box */
  365.    int  col;                    /* absolute column to display dir box */
  366.    int  wid;                    /* absolute number of columns in dir box */
  367.    int  hgt;                    /* absolute number of rows in dir box */
  368.    int  max_cols;               /* number of columns of files in box */
  369.    int  max_lines;              /* number of lines of files in box */
  370.    int  cnt;                    /* file count */
  371.    int  cols;                   /* logical number of columns in list */
  372.    int  lines;                  /* logical number of rows in list */
  373.    int  prow;                   /* logical number of rows in partial row */
  374.    int  vcols;                  /* number of virtual columns, if any */
  375.    int  nfiles;                 /* number of files on screen */
  376.    int  avail;                  /* number of available slots for files */
  377.    int  select;                 /* current file under cursor */
  378.    int  flist_col[5];           /* offset from col to display each column */
  379. } DIRECTORY;
  380.  
  381.  
  382. typedef struct {
  383.    int  pattern_length;                 /* number of chars in pattern */
  384.    int  search_defined;                 /* search pattern defined? */
  385.    unsigned char pattern[MAX_COLS];     /* search pattern */
  386.    int  forward_md2;                    /* forward mini-delta2 */
  387.    int  backward_md2;                   /* backward mini-delta2 */
  388.    char skip_forward[256];              /* boyer array for forward searches */
  389.    char skip_backward[256];             /* boyer array for back searches */
  390. } boyer_moore_type;
  391.  
  392.  
  393. /*
  394.  * "mode_infos" contain the editor mode variables.  The configuration
  395.  *  utility modifies this structure to custimize the start-up tde
  396.  *  configuration
  397.  */
  398. typedef struct {
  399.    char sig[8];                 /* signature, so we can find struct in .exe */
  400.    int  color_scheme;           /* color to start out with */
  401.    int  sync;                   /* sync the cursor movement command? */
  402.    int  sync_sem;               /* sync the cursor movement command? */
  403.    int  record;                 /* are we recording keystrokes? */
  404.    int  insert;                 /* in insert mode? */
  405.    int  indent;                 /* in auto-indent mode? */
  406.    int  ptab_size;              /* physical tab stops */
  407.    int  ltab_size;              /* logical tab stops */
  408.    int  smart_tab;              /* smart tab mode on or off? */
  409.    int  inflate_tabs;           /* inflate tabs?  T or F */
  410.    int  search_case;            /* consider case? IGNORE or MATCH */
  411.    int  enh_kbd;                /* type of keyboard */
  412.    int  cursor_size;            /* insert cursor big or small? */
  413.    char *eof;                   /* message to display at end of file */
  414.    int  control_z;              /* write ^Z - t or f */
  415.    int  crlf;                   /* <cr><lf> toggle CRLF or LF */
  416.    int  trailing;               /* remove trailing space? T or F */
  417.    int  show_eol;               /* show lf at eol? T or F */
  418.    int  word_wrap;              /* in word wrap mode? */
  419.    int  left_margin;            /* left margin */
  420.    int  parg_margin;            /* column for 1st word in paragraph */
  421.    int  right_margin;           /* right margin */
  422.    int  right_justify;          /* boolean, justify right margin?  T or F */
  423.    int  format_sem;             /* format semaphore */
  424.    int  undo_max;               /* max number of lines in undo stack */
  425.    int  do_backups;             /* create backup or ".bak" files? T or F */
  426.    int  ruler;                  /* show ruler at top of window? T or F */
  427.    int  date_style;             /* date style for date and time stamp */
  428.    int  time_style;             /* time style for date and time stamp */
  429. } mode_infos;
  430.  
  431.  
  432. /*
  433.  * "displays" contain all the status information about what attributes are
  434.  *  used for what purposes, which attribute is currently set, and so on.
  435.  * The editor only knows about one physical screen.
  436.  */
  437. typedef struct {
  438.    int nlines;                  /* lines on display device */
  439.    int ncols;                   /* columns on display device */
  440.    int line_length;             /* length of longest line */
  441.    int mode_line;               /* line to display editor modes - fmd */
  442.    int head_color;              /* file header color */
  443.    int text_color;              /* text area color */
  444.    int dirty_color;             /* text area color */
  445.    int mode_color;              /* mode line color - footer */
  446.    int block_color;             /* hilited area of blocked region */
  447.    int message_color;           /* color of editor messages */
  448.    int help_color;              /* color of help screen */
  449.    int diag_color;              /* color for diagnostics in mode line */
  450.    int eof_color;               /* color for end of file line */
  451.    int curl_color;              /* color of cursor line */
  452.    int ruler_color;             /* color of ruler line */
  453.    int ruler_pointer;           /* color of ruler pointer */
  454.    int hilited_file;            /* color of current file in dir list */
  455.    int overscan;                /* color of overscan color */
  456.    int old_overscan;            /* color of old overscan   */
  457.    int adapter;                 /* VGA, EGA, CGA, or MDA? */
  458.    unsigned int overw_cursor;   /* hi part = top scan line, lo part = bottom */
  459.    unsigned int insert_cursor;  /* hi part = top scan line, lo part = bottom */
  460.    char far *display_address;   /* address of display memory */
  461. } displays;
  462.  
  463.  
  464. /*
  465.  * "WINDOW" contains all the information that is unique to a given
  466.  *  window.
  467.  */
  468. typedef struct s_window {
  469.    struct s_file_infos *file_info;       /* file in window */
  470.    line_list_ptr ll;            /* pointer to current node in linked list */
  471.    int  ccol;                   /* column cursor logically in */
  472.    int  rcol;                   /* column cursor actually in */
  473.    int  bcol;                   /* base column to start display */
  474.    int  cline;                  /* line cursor logically in */
  475.    long rline;                  /* real line cursor in */
  476.    long bin_offset;             /* offset, in bytes from beg of bin file */
  477.    int  top_line;               /* top line in window */
  478.    int  bottom_line;            /* bottom line in window */
  479.    int  vertical;               /* boolean. is window split vertically? */
  480.    int  start_col;              /* starting column on physical screen */
  481.    int  end_col;                /* ending column on physical screen */
  482.    int  page;                   /* no. of lines to scroll for one page */
  483.    int  visible;                /* window hidden or visible */
  484.    int  letter;                 /* window letter */
  485.    int  ruler;                  /* show ruler in this window? */
  486.    char ruler_line[MAX_COLS+2]; /* ruler for this window */
  487.    struct s_window *next;       /* next window in doubly linked list */
  488.    struct s_window *prev;       /* previous window in doubly linked list */
  489. } WINDOW;
  490.  
  491.  
  492. /*
  493.  * struct for find first and find next functions.  see DOS technical ref
  494.  * manuals for more info on DTA structures.
  495.  */
  496. typedef struct {
  497.    char          reserved[21];
  498.    unsigned char attrib;
  499.    unsigned      time;
  500.    unsigned      date;
  501.    long          size;
  502.    char          name[13];
  503. } DTA;
  504.  
  505.  
  506. /*
  507.  * "status_infos" contain all the editor status information that is
  508.  *  global to the entire editor (i.e. not dependent on the file or
  509.  *  window)
  510.  */
  511. typedef struct {
  512.    WINDOW *current_window;      /* current active window */
  513.    struct s_file_infos *current_file; /* current active file */
  514.    struct s_file_infos *file_list; /* all active files */
  515.    WINDOW *window_list;         /* all active windows */
  516.    int  window_count;           /* number of windows - displayed and hidden */
  517.    int  file_count;             /* number of files currently open */
  518.    int  arg;                    /* current argument pointer */
  519.    int  found_first;            /* have we found the first file? */
  520.    int  argc;                   /* argument count */
  521.    char **argv;                 /* argument variables - same as *argv[] */
  522.    char path[MAX_COLS];         /* path for files on command line */
  523.    DTA  dta;                    /* disk transfer address for find next */
  524.    int  file_mode;              /* mode to open sas files, TEXT or BINARY */
  525.    int  file_chunk;             /* if opened BINARY, bytes per line */
  526.    int  sas_defined;            /* has search and seize been defined */
  527.    int  sas_arg;                /* current argument pointer */
  528.    int  sas_argc;               /* argument count */
  529.    char **sas_argv;             /* argument variables - same as *argv[] */
  530.    char sas_tokens[MAX_COLS];   /* storage for file tokens */
  531.    char sas_path[MAX_COLS];     /* path for files on search list */
  532.    char *sas_arg_pointers[SAS_P]; /* array of pointers to tokens in sas_path */
  533.    int  sas_found_first;        /* have we found the first file? */
  534.    DTA  sas_dta;                /* disk transfer address for find next */
  535.    long sas_rline;              /* line number of sas find */
  536.    int  sas_rcol;               /* column number of sas find */
  537.    int  sas_mode;               /* mode to open sas files, TEXT or BINARY */
  538.    int  sas_chunk;              /* if opened BINARY, bytes per line */
  539.    line_list_ptr sas_ll;        /* linked list node pointing to line */
  540.    int  marked;                 /* has block been marked? */
  541.    int  prompt_line;            /* line to display cursor */
  542.    int  prompt_col;             /* column to display cursor */
  543.    struct s_file_infos *marked_file;  /* pointer to file w/ marked block */
  544.    char rw_name[MAX_COLS];      /* name of last file read or written */
  545.    char pattern[MAX_COLS];      /* last search pattern */
  546.    char subst[MAX_COLS];        /* last substitute text */
  547.    int  replace_flag;           /* prompt or noprompt b4 replacing */
  548.    int  replace_defined;        /* replace defined ? */
  549.    int  overlap;                /* overlap between pages for page up etc */
  550.    line_list_ptr buff_node;     /* address of node in line_buff */
  551.    int  copied;                 /* has line been copied to file? */
  552.    char line_buff[BUFF_SIZE*2+8]; /* for currently edited line */
  553.    char tabout_buff[BUFF_SIZE+8]; /* for exanding tabs */
  554.    int  line_buff_len;          /* length of line in the line_buff */
  555.    int  tabout_buff_len;        /* length of line in the tabout_buff */
  556.    int  command;                /* function of key just entered */
  557.    int  key_pressed;            /* key pressed by user */
  558.    int  key_pending;            /* is two-key command waiting for next key? */
  559.    int  first_key;              /* first key of the two-key sequence */
  560.    int  wrapped;                /* is the wrapped message on mode line? */
  561.    int  stop;                   /* stop indicator */
  562.    int  control_break;          /* control break pressed? */
  563.    int  recording_key;          /* key we are assigning keystrokes to */
  564.    int  stroke_count;           /* free keys in stroke buffer */
  565.    int  macro_next;             /* pointer to next key in macro */
  566.    int  macro_executing;        /* flag set if macro is executing */
  567.    int  mstack_pointer;         /* pointer to macro stack */
  568.    int  current_macro;          /* index of currently executing macro */
  569. } status_infos;
  570.  
  571.  
  572. /*
  573.  * marker structure used to save file positions.
  574.  */
  575. typedef struct {
  576.    long rline;                  /* real line of marker */
  577.    int  rcol;                   /* real column of marker */
  578.    int  ccol;                   /* logical column of marker */
  579.    int  bcol;                   /* base column of marker */
  580.    int  marked;                 /* boolean:  has this marker been set? */
  581. } MARKER;
  582.  
  583.  
  584. /*
  585.  * "file_infos" contain all the information unique to a given file
  586.  */
  587. typedef struct s_file_infos {
  588.    line_list_ptr line_list;    /* pointer to first node in linked list */
  589.    line_list_ptr line_list_end; /* pointer to last node in linked list */
  590.    line_list_ptr undo_top;     /* pointer to top node in undo stack */
  591.    line_list_ptr undo_bot;     /* pointer to last node in undo stack */
  592.    int  undo_count;            /* number of lines in undo stack */
  593.    MARKER marker[NO_MARKERS];  /* number of file markers */
  594.    long length;                /* number of lines in file */
  595.    int  modified;              /* file has been modified since save? */
  596.    int  dirty;                 /* file in window modified? */
  597.    int  new_file;              /* is current file new? */
  598.    int  backed_up;             /* has ".bak" file been created? */
  599.    int  crlf;                  /* when read, did lines end CRLF or LF? */
  600.    int  open_mode;             /* opened in BINARY or TEXT */
  601.    char file_name[MAX_COLS];   /* name of current file being edited */
  602.    char backup_fname[MAX_COLS];/* name of backup of current file */
  603.    int  block_type;            /* block type - line or box */
  604.    line_list_ptr block_start;  /* beginning block position */
  605.    line_list_ptr block_end;    /* ending block position */
  606.    int  block_bc;              /* beginning column */
  607.    long block_br;              /* beginning row */
  608.    int  block_ec;              /* ending column */
  609.    long block_er;              /* ending row */
  610.    int  file_no;               /* file number */
  611.    int  ref_count;             /* no. of windows referring to file */
  612.    int  next_letter;           /* next window letter */
  613.    unsigned int  file_attrib;  /* file attributes (rwx etc) */
  614.    struct s_file_infos *next;  /* next file in doubly linked list */
  615.    struct s_file_infos *prev;  /* previous file in doubly linked list */
  616. } file_infos;
  617.  
  618.  
  619. /*
  620.  * structure for recording and playing back one keystroke.
  621.  */
  622. typedef struct {
  623.   int key;      /* key assinged to this node, which may be text or function */
  624.   int next;     /* pointer to next node in macro def */
  625. } STROKES;
  626.  
  627.  
  628. /*
  629.  * structure for the macro buffer.
  630.  */
  631. typedef struct {
  632.    char sig[8];                         /* signature, easy to find in .exe */
  633.    int  first_stroke[MAX_KEYS];         /* pointer to first key in macro */
  634.    STROKES strokes[STROKE_LIMIT];       /* buffer to hold key strokes */
  635. } MACRO;
  636.  
  637.  
  638. /*
  639.  * structure for the local macro stack in macro processor.
  640.  */
  641. typedef struct {
  642.    int key;                             /* key to begin execution in macro */
  643.    int macro;                           /* macro we were executing */
  644. } MACRO_STACK;
  645.  
  646.  
  647. /*
  648.  * structure for critical error handler.  check the flag for errors on
  649.  * each I/O call.
  650.  */
  651. typedef struct {
  652.    int  flag;                   /* 0 = no error, -1 = error */
  653.    int  code;                   /* error code from di */
  654.    int  rw;                     /* read or write operation? */
  655.    int  drive;                  /* drive number of error */
  656.    int  extended;               /* extended error code, func 0x59 */
  657.    int  class;                  /* error class */
  658.    int  action;                 /* suggested action from DOS */
  659.    int  locus;                  /* locus of error: drive, network, etc... */
  660.    int  dattr;                  /* device attribute, 0 = drive, 1 = serial */
  661.    char dname[10];              /* device name */
  662. } CEH;
  663.  
  664.  
  665. /*
  666.  * structure for sort strings
  667.  */
  668. typedef struct {
  669.    text_ptr pivot_ptr;
  670.    int  direction;
  671.    unsigned char *order_array;
  672.    int  block_len;
  673.    int  pivot_len;
  674.    int  bc;
  675.    int  ec;
  676. } SORT;
  677.  
  678.  
  679. typedef struct {
  680.    unsigned char ignore[256];
  681.    unsigned char match[256];
  682. } SORT_ORDER;
  683.  
  684.  
  685. /*
  686.  * structure for diff.  let's only diff two windows at a time.
  687.  */
  688. typedef struct {
  689.    int       defined;           /* initially FALSE */
  690.    int       leading;           /* skip leading spaces t/f */
  691.    int       all_space;         /* skip all space t/f */
  692.    int       blank_lines;       /* skip blank lines t/f */
  693.    int       ignore_eol;        /* skip end of line t/f */
  694.    WINDOW    *w1;               /* pointer to first diff window */
  695.    WINDOW    *w2;               /* pointer to second diff window */
  696.    line_list_ptr  d1;           /* pointer to text in window 1 */
  697.    line_list_ptr  d2;           /* pointer to text in window 2 */
  698.    long      rline1;            /* line number in window 1 */
  699.    long      rline2;            /* line number in window 2 */
  700.    long      bin_offset1;       /* binary offset in window 1 */
  701.    long      bin_offset2;       /* binary offset in window 2 */
  702. } DIFF;
  703.