summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FDISK/DISPLAY.C
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/CMD/FDISK/DISPLAY.C')
-rw-r--r--v4.0/src/CMD/FDISK/DISPLAY.C406
1 files changed, 406 insertions, 0 deletions
diff --git a/v4.0/src/CMD/FDISK/DISPLAY.C b/v4.0/src/CMD/FDISK/DISPLAY.C
new file mode 100644
index 0000000..fed2393
--- /dev/null
+++ b/v4.0/src/CMD/FDISK/DISPLAY.C
@@ -0,0 +1,406 @@
1
2
3#include "dos.h" /* AN000 */
4#include "fdisk.h" /* AN000 */
5#include "subtype.h" /* AN000 */
6#include "stdio.h" /* AN000 */
7#include "extern.h" /* AN000 */
8#include "doscall.h" /* AN000 */
9#include "fdiskmsg.h" /* AN000 */
10#include "ctype.h" /* AN000 */
11
12/* */
13/******************* START OF SPECIFICATIONS *******************/
14/* */
15/* SUBROUTINE NAME: DISPLAY */
16/* */
17/* DESCRIPTIVE NAME: Display full screen interface messages */
18/* */
19/* FUNCTION: Displays messages and handles control characters */
20/* */
21/* NOTES: */
22/* FDISK MESSAGES */
23/* Portions of the screen that are handled in the msg are */
24/* indicated on the listing of the screen with the message */
25/* name given. If the text message is defined in another */
26/* screen, then the name is followed by a "#" character */
27/* */
28/* NOTE TO TRANSLATORS The characters inside the <> and the [] */
29/* are control characters and should not be translated. The */
30/* Control characters are defined as follows: */
31/* */
32/* <H> - Highlight the following text */
33/* <R> - Regular text */
34/* <B> - Blink the following text */
35/* <O> - Turn blinking off */
36/* <Y> - Print YES character, as set by define */
37/* <N> - Print NO character, as set by define */
38/* <W> - Sound the beep */
39/* <S> - Save cursor position for later use */
40/* <I> - Insert character from insert[] string. This string */
41/* must be set up prior to displaying the message. The */
42/* first <I> will insert Insert[0], the second */
43/* insert[1], etc....This will move the cursor one */
44/* postition. The insert[] string will be initialized */
45/* */
46/* Multiple control characters can be between the <>. */
47/* */
48/* The ^####^indicates Row and column for the text and has the */
49/* format of [rrcc] where the numbers are decimal and zero */
50/* based (first row/col is 00. The numbers are in decimal, */
51/* and must be 2 characters, which means rows/cols 0-9 should */
52/* be listed as 00-09. For example, the 5th row, 3rd column */
53/* on the screen would be listed as ^0402^. */
54/* */
55/* The column number is always the column desired. The row */
56/* number is an offset from the previous row. For example, if */
57/* the text just printed is on row 6, and the next text should */
58/* be printed 2 rows down in column 0, then the control strin */
59/* would be ^0201^. The first row specified in the message is */
60/* assumed to be based off of row 0, it would actually specify */
61/* the actual row for the start of the msg to be printed. */
62/* */
63/* ENTRY POINTS: display(*message_name); */
64/* LINKAGE: Near call */
65/* */
66/* INPUT: char *message_name */
67/* */
68/* EXIT-NORMAL: */
69/* */
70/* EXIT-ERROR: */
71/* */
72/* EFFECTS: */
73/* input_row changed if <S> control character in message */
74/* input_col changed if <S> control character in message */
75/* */
76/* INTERNAL REFERENCES: */
77/* ROUTINES: */
78/* */
79/* EXTERNAL REFERENCES: */
80/* ROUTINES: */
81/* */
82/* viowrtcharstratt(); */
83/******************** END OF SPECIFICATIONS ********************/
84/* */
85void display(s)
86
87char far *s;
88
89BEGIN
90 unsigned row;
91 unsigned col;
92 char attribute;
93 char far *attribute_ptr = &attribute;
94 unsigned insert_count;
95
96
97 /* Initialize row and col, and index into array */
98 row = u(0); /* AC000 */
99 col = u(0); /* AC000 */
100 insert_count = u(0); /* AC000 */
101 /* check for a request to display a null string */
102 if (*s == c('\0')) /* AC000 */
103 BEGIN
104 /* Message string error */
105 insert[0] = c('1'); /* AC000 */
106 display(debug_msg);
107 END
108 else
109 BEGIN
110 /* There is data there, lets go handle it */
111
112 attribute = c(0x00); /* AC000 */
113 /* Go until end of string */
114 while (*s != c('\0')) /* AC000 */
115 BEGIN
116
117 /* Check for any imbedded control strings */
118 switch (*s)
119 BEGIN
120 /* Check for control characters */
121 case '<':
122 BEGIN
123 s++;
124 while ( (*s != c('>')) && (*s != c('\0')) ) /* AC000 */
125 BEGIN
126 switch (*s++)
127 BEGIN
128 case 'H': if (mono_flag == TRUE) /* AN006 */
129 attribute = (attribute & 0x80) | HIWHITE_ON_BLACK; /* AN006 */
130 else /* AN006 */
131 attribute = (attribute & 0x80) | HIWHITE_ON_BLUE; /* AC006 */
132 break;
133
134
135 case 'R': if (mono_flag == TRUE) /* AN006 */
136 attribute = (attribute & 0x80) | GRAY_ON_BLACK; /* AN006 */
137 else /* AN006 */
138 attribute = (attribute & 0x80) | WHITE_ON_BLUE; /* AC006 */
139 break;
140
141 case 'B': attribute |= 0x80;
142 break;
143
144 case 'O': attribute &= 0x7F;
145 break;
146
147 case 'W': DOSBEEP(u(900),u(400)); /* AC000 */
148 break;
149
150 case 'I':
151 BEGIN
152 /* display next element in the array */
153 if ((mono_flag == TRUE) && (attribute == c(0x00))) /* AN006 */
154 attribute = c(GRAY_ON_BLACK); /* AN006 */
155 if ((mono_flag == FALSE) && (attribute == c(0x00))) /* AN006 */
156 attribute = c(WHITE_ON_BLUE); /* AC006 */
157 VIOWRTCHARSTRATT(pinsert+insert_count++,u(1),row,col++,attribute_ptr,u(0));
158 break;
159 END
160
161
162 case 'Y': /* AC011 */
163 BEGIN
164 /* display YES character in next location */
165 *--s = c(Yes); /* AC000 */
166 if ((mono_flag == TRUE) && (attribute == c(0x00))) /* AN006 */
167 attribute = c(GRAY_ON_BLACK); /* AN006 */
168 if ((mono_flag == FALSE) && (attribute == c(0x00))) /* AN006 */
169 attribute = c(WHITE_ON_BLUE); /* AC006 */
170 VIOWRTCHARSTRATT(s,u(1),row,col++,attribute_ptr,u(0)); /* AC000 */
171 *s++ = c(Yes); /* AC000 AC011 */
172 break;
173 END
174
175 case 'N': /* AC011 */
176 BEGIN
177 /* display NO character in next location */
178 *--s = c(No); /* AC000 */
179 if ((mono_flag == TRUE) && (attribute == c(0x00))) /* AN006 */
180 attribute = c(GRAY_ON_BLACK); /* AN006 */
181 if ((mono_flag == FALSE) && (attribute == c(0x00))) /* AN006 */
182 attribute = c(WHITE_ON_BLUE); /* AC006 */
183 VIOWRTCHARSTRATT(s,u(1),row,col++,attribute_ptr,u(0)); /* AC000 */
184 *s++ = c(No); /* AC000 AC011 */
185 break;
186 END
187
188
189 case 'S':
190 BEGIN
191 input_row = row;
192 input_col = col;
193 break;
194 END
195
196
197 case 'C':
198 BEGIN
199 /* Clear from current position to end of line */
200 clear_screen(row,col,row,u(79)); /* AC000 */
201 break;
202 END
203
204 case '\0':
205 BEGIN
206 /* Message string error - string ended in the middle of control string*/
207 insert[0] = c('7'); /* AC000 */
208 display(debug_msg);
209 break;
210 END
211
212 default:
213 BEGIN
214 /* Message string error - no valid control char found */
215 insert[0] = c('6'); /* AC000 */
216 display(debug_msg);
217 break;
218 END
219 END /* Switch */
220 END /* While */
221 /* Get the pointer past the '>' */
222 s++;
223 break;
224 END /* control characters */
225
226 /* Check for row,col */
227 case '^': /* AC000 */
228 BEGIN
229 s++;
230 /* determine the row to put the message on */
231 if ( !isdigit(*s) )
232 BEGIN
233 /* Message string error */
234 insert[0] = c('2'); /* AC000 */
235 display(debug_msg);
236 END
237 else
238 BEGIN
239 row = row+((unsigned)(((*s++ - '0')*10)));
240 if ( !isdigit(*s) )
241 BEGIN
242 /* Message string error */
243 insert[0] = c('2'); /* AC000 */
244 display(debug_msg);
245 END
246 else
247 BEGIN
248 row = row+((unsigned)(*s++ - '0'));
249 /* determine the col to put the message on */
250 if ( !isdigit(*s) )
251 BEGIN
252 /* Message string error */
253 insert[0] = c('3'); /* AC000 */
254 display(debug_msg);
255 END
256 else
257 BEGIN
258 col = ((unsigned)(*s++ - '0'));
259 if ( !isdigit(*s) )
260 BEGIN
261 /* Message string error */
262 insert[0] = c('3'); /* AC000 */
263 display(debug_msg);
264 END
265 else
266 BEGIN
267 col = ((unsigned)((col* 10) + (*s++ - '0')));
268 if (*s++ != c('^')) /* AC000 */
269 BEGIN
270 /* Message string error */
271 insert[0] = c('4'); /* AC000 */
272 display(debug_msg);
273 END /* 2nd sq bracket */
274 END /* 2nd digit col */
275 END /* 1st digit col */
276 END /* 2nd digit row */
277 END /* 1st digit row */
278 break;
279 END
280 /* Handle anything else */
281
282
283 default:
284 BEGIN
285 /* See if attribute set to anything */
286 if ((mono_flag == FALSE) && (attribute == c(0x00))) /* AN006 */
287 attribute = c(WHITE_ON_BLUE); /* AC006 */
288 if ((mono_flag == TRUE) && (attribute == c(0x00))) /* AN006 */
289 attribute = c(GRAY_ON_BLACK); /* AN006 */
290 VIOWRTCHARSTRATT(s++,u(1),row,col++,attribute_ptr,u(0)); /* AC000 */
291 break;
292 END
293 END
294 END /* End of string check */
295 END /* No characters in string check */
296 return;
297
298END
299
300/* */
301
302void number_in_msg(number,start)
303
304XFLOAT number;
305unsigned start;
306
307BEGIN
308
309char mbytes[32];
310
311 /* Divide the space down and get it into decimal */
312 sprintf(mbytes,"%4.0d",number);
313 insert[start+0] = mbytes[0];
314 insert[start+1] = mbytes[1];
315 insert[start+2] = mbytes[2];
316 insert[start+3] = mbytes[3];
317
318 return;
319
320END
321
322
323/* */
324void percent_in_msg(number,start) /* AN000 */
325
326unsigned number; /* AN000 */
327unsigned start; /* AN000 */
328
329BEGIN /* AN000 */
330
331
332char percent[32];
333
334 /* Divide the space down and get it into decimal */
335 sprintf(percent,"%3.0d%%",number); /* AC000 */
336 insert[start+0] = percent[0]; /* AC000 */
337 insert[start+1] = percent[1]; /* AC000 */
338 insert[start+2] = percent[2]; /* AC000 */
339 insert[start+3] = percent[3]; /* AC000 */
340
341 return;
342
343END /* AN000 */
344
345/* */
346void string_in_msg(string_ptr,start) /* AN000 */
347
348char far *string_ptr; /* AN000 */
349unsigned start; /* AN000 */
350
351BEGIN /* AN000 */
352
353unsigned i; /* AN000 */
354
355 /* init the 8 spots to blanks */
356 for (i = u(0); i < u(8);i++) /* AN000 */
357 BEGIN /* AN000 */
358 insert[start+i] = c(' '); /* AN000 */
359 END /* AN000 */
360 /* Put characters into the array */
361 BEGIN /* AN000 */
362 insert[start+0] = *(string_ptr+0); /* AN000 */
363 insert[start+1] = *(string_ptr+1); /* AN000 */
364 insert[start+2] = *(string_ptr+2); /* AN000 */
365 insert[start+3] = *(string_ptr+3); /* AN000 */
366 insert[start+4] = *(string_ptr+4); /* AN000 */
367 insert[start+5] = *(string_ptr+5); /* AN000 */
368 insert[start+6] = *(string_ptr+6); /* AN000 */
369 insert[start+7] = *(string_ptr+7); /* AN000 */
370 END /* AN000 */
371 return; /* AN000 */
372END /* AN000 */
373
374
375/* */
376void volume_in_msg(string_ptr,start) /* AN000 */
377
378char far *string_ptr; /* AN000 */
379unsigned start; /* AN000 */
380
381BEGIN /* AN000 */
382
383unsigned i; /* AN000 */
384
385 /* init the 11 spots to blanks */
386 for (i = u(0); i < u(11);i++) /* AN000 */
387 BEGIN /* AN000 */
388 insert[start+i] = c(' '); /* AN000 */
389 END /* AN000 */
390 /* Put characters into the array */
391 BEGIN /* AN000 */
392 insert[start+0] = *(string_ptr+0); /* AN000 */
393 insert[start+1] = *(string_ptr+1); /* AN000 */
394 insert[start+2] = *(string_ptr+2); /* AN000 */
395 insert[start+3] = *(string_ptr+3); /* AN000 */
396 insert[start+4] = *(string_ptr+4); /* AN000 */
397 insert[start+5] = *(string_ptr+5); /* AN000 */
398 insert[start+6] = *(string_ptr+6); /* AN000 */
399 insert[start+7] = *(string_ptr+7); /* AN000 */
400 insert[start+8] = *(string_ptr+8); /* AN000 */
401 insert[start+9] = *(string_ptr+9); /* AN000 */
402 insert[start+10] = *(string_ptr+10); /* AN000 */
403 END /* AN000 */
404 return; /* AN000 */
405END /* AN000 */
406