1 /* ***********************************************************
  2    *                                                         *
  3    * Copyright, (C) Honeywell Bull Inc., 1988                *
  4    *                                                         *
  5    * Copyright, (C) Honeywell Information Systems Inc., 1987 *
  6    *                                                         *
  7    *********************************************************** */
  8 
  9 
 10 /* HISTORY COMMENTS:
 11   1) change(87-03-13,Wallman), approve(87-03-13,MCR7586),
 12      audit(87-08-10,Flegel), install(87-08-07,MR12.1-1072):
 13      First release
 14   2) change(87-08-14,Wallman), approve(87-08-14,MCR7586),
 15      audit(87-08-17,Flegel), install(87-09-10,MR12.1-1103):
 16      Change version to 1.01 for PBF to wstutil.
 17   3) change(87-09-02,Wallman), approve(87-09-02,MCR7586),
 18      audit(87-08-17,Flegel), install(87-09-10,MR12.1-1103):
 19      Change version to 1.02 for PBFs to wstutil, wstkbscr, wstedit, and
 20      wstfrgnd.
 21   4) change(87-09-17,Wallman), approve(87-09-17,PBF7586),
 22      audit(87-09-17,LJAdams), install(87-09-18,MR12.1-1109):
 23      Changed version to 1.03 for PBF to wstutil.
 24   5) change(88-02-24,Lee), approve(88-05-16,MCR7897), audit(88-09-19,Flegel),
 25      install(88-10-12,MR12.2-1160):
 26      Removed debugging code and unused variables, re-formatting.
 27   6) change(88-07-25,Lee), approve(88-05-16,MCR7897), audit(88-09-19,Flegel),
 28      install(88-10-12,MR12.2-1160):
 29      Documentation additions only. Added header comments to all routines.
 30   7) change(88-08-09,Lee), approve(88-05-16,MCR7897), audit(88-09-19,Flegel),
 31      install(88-10-12,MR12.2-1160):
 32      Fix references to include files; "wstdefs.h" was split into
 33      "wstdefs.h" and "wsttype.h" to avoid declaration clash; also,
 34      various constants defined to descriptive names.
 35   8) change(88-08-23,Lee), approve(88-05-16,MCR7897), audit(88-09-19,Flegel),
 36      install(88-10-12,MR12.2-1160):
 37      Added declarations for global variables for edit mode and
 38      WSTERM's various other modes.
 39   9) change(89-01-18,Lee), approve(89-01-18,MCR8043), audit(89-03-14,Flegel),
 40      install(89-04-24,MR12.3-1033):
 41      Updated version number to 1.08.
 42                                                    END HISTORY COMMENTS */
 43 
 44 
 45 /* WSTGLOB - GLobal static data for WSTERM */
 46 
 47 /* This module declares storage for all the global static variables used
 48    by WSTERM. The include file wstglob.h provides descriptions of this
 49    storage to the active modules. */
 50 
 51 #include    <stdio.h>
 52 #include    <dos.h>
 53 #include    <ws.h>
 54 #include    <ws_mcb.h>
 55 #include    <ws_dcls.h>
 56 #include    "wstdefs.h"
 57 
 58 char    brk_table [96],         /* Break table characters */
 59         bs_str [2] = "\010",    /* ASCII BS as a string */
 60         char_erase = '#',       /* Character erase */
 61         erkl_chars [4],         /* Local edit chars as a string */
 62         F1_10 [10][4] = {       /* Normal function keys */
 63             "^[0", "^[2", "^[6", "^[8", "^[:",
 64             "^[<", "^[>", "^[P", "^[R", "^[T"  },
 65         F11_12 [2][4] = {       /* Shifted function keys */
 66             "^[1", "^[5" },
 67 
 68         line_kill = '@',        /* Line kill */
 69         lnc = '\\',             /* Literal escape character */
 70         local_action = NUL,     /* Local escape action char */
 71         nl [3] = "\015\012",    /* Multics NL as a string */
 72         nul_str [2] = "",       /* A null string */
 73         octstr [6] = "",        /* Display string for octval */
 74         spaces [11] = "          ",     /* Spaces for tabbing */
 75         version [6] = "1.08";   /* WSTERM version */
 76 
 77         int bk_msg_showing = OFF,   /* Message display control */
 78         break_sent = OFF,       /* An FG_BREAK is outstanding */
 79         crecho = OFF,           /* CRECHO mode switch */
 80         echo_delay = 1,         /* Max allowable delay for sync echo */
 81         fg_msg_len = 0,         /* Length of a foreground message */
 82         fg_msg_showing = OFF,   /* Message display control */
 83         lfecho = OFF,           /* LFECHO mode switch */
 84         mowse_active,           /* Switch showing MOWSE health */
 85         octsw = OFF,            /* Octal escape switch */
 86         octval = 0,             /* Octal escape value */
 87         oldtime = -1,           /* Previous clock */
 88         read_active = OFF,      /* Sync mode read is active */
 89         read_count = 0,         /* Number characters able to send */
 90         sync = OFF,             /* Sync (video) mode flag */
 91         term_read = OFF;        /* Terminate a read command */
 92 
 93 mcb  * wst_mcb = NULL;
 94 
 95 struct ds_struct ds;        /* Keyboard display data */
 96 
 97 union fg_msg_struct fg_msg; /* Foreground (incoming) messages */
 98 
 99 struct get_struc tdata_arg; /* Gettdata argument */
100 
101 struct kb_struct kb;        /* Keyboard input data */
102 
103 struct screen_struct screen;    /* Screen bookkeeping */
104 
105 
106 
107 /*****
108  variables used to maintain WSTERM's various modes
109 ******/
110 
111 /* set by our ^BREAK handler to indicate ^BREAK was hit */
112 int break_flag;
113 
114 /* flag indicates WSTERM's displayed status (glass,sync,async) */
115 int wst_status;
116 
117 /* use while filtering out escape codes */
118 int clr_index;
119 
120 /* indicates if FANSI-CONSOLE is being used */
121 int wst_fansi_flag;
122 
123 /* indicates if /B was specified for using ^BREAK to send a break */
124 int break_sends_to_host;
125 
126 /* indicates if WSTERM should display EOP after a screenful */
127 int wst_paging;
128 
129 /* indicates if WSTERM should freeze display (no scroll) */
130 int wst_freeze;
131 
132 /* indicates if WSTERM should audit to file */
133 int wst_f_audit;
134 
135 /* indicates if WSTERM should audit to line printer */
136 int wst_p_audit;
137 
138 /* pointer to string containing audit file name */
139 char *audit_file_name;
140 
141 /* specifies printer card (0-2) to use */
142 int wst_printer_card;
143 
144 int wst_edit_mode;
145 int glass_edit_mode;
146 
147 /* This table is used to determine whether a particular character
148    is valid following an escape character. This restricts the
149    number of invalid escape sequences from getting through which
150    may possibly kill the screen driver.
151 */
152 char is_esc[] = {
153      0, 0, 0, 0, 0, 0, 0, 0,
154      0, 0, 0, 0, 0, 0, 0, 0,
155      0, 0, 0, 0, 0, 0, 0, 0,
156      0, 0, 0, 0, 0, 0, 0, 0,
157 
158      0, 0, 0, 0, 0, 0, 0, 0,
159      0, 0, 0, 0, 0, 0, 0, 0,
160      0, 0, 0, 0, 0, 0, 0, 1,
161      1, 0, 0, 0, 1, 1, 1, 0,
162 
163      0, 0, 0, 0, 1, 1, 0, 0,
164      1, 0, 1, 0, 0, 1, 0, 0,
165      0, 0, 0, 0, 0, 0, 0, 0,
166      0, 0, 1, 0, 1, 1, 1, 1,
167 
168      0, 0, 1, 1, 0, 0, 0, 0,
169      0, 0, 0, 0, 0, 0, 1, 1,
170      0, 0, 0, 0, 0, 0, 0, 0,
171      0, 0, 0, 0, 1, 1, 1, 0
172 };
173 
174 
175 /* Screen buffers for scratch, background, foreground and help screens */
176 /* These structures are used to save the contents of a particular
177    screen and the cursor position before switching to another screen.
178 */
179 SCREEN wst_tmp_screen;
180 SCREEN wst_bg_screen;
181 SCREEN wst_fg_screen;
182 SCREEN wst_help_screen;
183 
184 /* edit mode line and line information */
185 EDIT_LINE edlin;
186 
187 /* edit mode screen size */
188 SCREEN_SIZE ss;
189 
190 /* flag to indicate block or under line cursor type */
191 int cursor_type;
192 
193 /* list of printer errors detected */
194 char *print_error_list[] = {
195     "OFF Line",
196     "No paper",
197     "Printer not ready"
198 };
199 
200 /* table of months for formatting into audit begin/end messages */
201 char *month_tab[] = {
202 "Jan.",
203 "Feb.",
204 "Mar.",
205 "Apr.",
206 "May",
207 "June",
208 "July",
209 "Aug.",
210 "Sep.",
211 "Oct.",
212 "Nov.",
213 "Dec."
214 };
215 
216 int wst_prt_timeout;    /* original printer timeout value */
217 int orig_break_status;  /* original CTRL-C checking status */
218 union REGS scroll_regs; /* registers for scrolling up 1 line */
219 
220 /* End of WSTGLOB */