1 | /*
|
---|
2 | =============================================================================
|
---|
3 | sqselbx.c -- MIDAS-VII sequence editor box selection functions
|
---|
4 | Version 19 -- 1988-11-18 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "ram.h"
|
---|
9 |
|
---|
10 | #define ST_0 0x01 /* initial Action 1 or Action 2*/
|
---|
11 | #define ST_1 0x02 /* operand type */
|
---|
12 | #define ST_2 0x04 /* initial Action 3*/
|
---|
13 |
|
---|
14 | #define ST_OFF 0x00 /* cancel highlighting */
|
---|
15 |
|
---|
16 | int16_t action; /* current action column */
|
---|
17 | int16_t sqdeflg; /* sequence data entry buffer filled */
|
---|
18 | int16_t sqmenu; /* sqeuence submenu state */
|
---|
19 |
|
---|
20 | int8_t sqdebuf[50]; /* sequence data entry buffer */
|
---|
21 |
|
---|
22 | struct seqent seqbuf; /* sequence line buffer */
|
---|
23 |
|
---|
24 | /* |
---|
25 |
|
---|
26 | */
|
---|
27 |
|
---|
28 | int8_t sqhilit[][8] = { /* submenu highlight table */
|
---|
29 |
|
---|
30 | /* start, width, row1, row2, row3, row4, row5, pad */
|
---|
31 |
|
---|
32 | { 2, 13, ST_0|ST_2, ST_0|ST_2, ST_0|ST_2, ST_0, 0, 0},
|
---|
33 | { 17, 11, ST_0|ST_2, ST_0|ST_2, ST_0|ST_2, ST_0, 0, 0},
|
---|
34 | { 30, 11, ST_0|ST_2, ST_0|ST_2, 0, ST_0, 0, 0},
|
---|
35 | { 43, 8, ST_0|ST_2, ST_0|ST_2, ST_0, ST_0, ST_0, 0},
|
---|
36 | { 53, 8, ST_1, ST_1, ST_1, ST_1, 0, 0},
|
---|
37 | };
|
---|
38 |
|
---|
39 | struct selbox sqboxes[] = { /* selection boxes */
|
---|
40 |
|
---|
41 | {CTOX(1), RTOY(DATAROW), CTOX(48)-1, RTOY(1+DATAROW)-1, 0, sqfnbox}, /* current patch */
|
---|
42 |
|
---|
43 | { 0, 0, 0, 0, 0, FN_NULL}
|
---|
44 | };
|
---|
45 |
|
---|
46 | int8_t sqopreq[] = { /* action needs operand type flag table */
|
---|
47 |
|
---|
48 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1
|
---|
49 | };
|
---|
50 |
|
---|
51 | int8_t nextact[] = { 24, 36, 6 }; /* next column after action entry */
|
---|
52 |
|
---|
53 | /* |
---|
54 |
|
---|
55 | */
|
---|
56 |
|
---|
57 | int16_t sqidata[] = { /* intial data by box */
|
---|
58 |
|
---|
59 | 0x0000, /* " " 0 */
|
---|
60 | 0x0000, /* "Kt 001 1 01" 1 */
|
---|
61 | 0x0000, /* "Kc 001 1 01" 2 */
|
---|
62 | 0x0000, /* "Kr 001 1 01" 3 */
|
---|
63 | 0x0000, /* "If 001 1 01" 4 */
|
---|
64 | 0x0000, /* "Trig on 01" 5 */
|
---|
65 | 0x0000, /* "Trig off 01" 6 */
|
---|
66 | 0x0000, /* "Trig tgl 01" 7 */
|
---|
67 | 0x0000, /* "If trig 01" 8 */
|
---|
68 | 0x0000, /* "Stop " 9 */
|
---|
69 | 0x0000, /* "Jump to 000" 10 */
|
---|
70 | 0x0000, /* "???????????" 11 */
|
---|
71 | 0x0000, /* "If stim act" 12 */
|
---|
72 | SQ_VAL, /* "Set R01=00 " 13 */
|
---|
73 | SQ_VAL, /* "Inc R01+00 " 14 */
|
---|
74 | SQ_VAL, /* "If R01=00 " 15 */
|
---|
75 | SQ_VAL, /* "If R01<00 " 16 */
|
---|
76 | SQ_VAL /* "If R01>00 " 17 */
|
---|
77 | };
|
---|
78 |
|
---|
79 | /* |
---|
80 |
|
---|
81 | */
|
---|
82 |
|
---|
83 | int8_t actcol[] = { /* action data entry column by action */
|
---|
84 |
|
---|
85 | 0, 3, 3, 3, 3, 9, 9, 9, 9, 5, 5, 5, 5, 10, 8, 3, 5
|
---|
86 | };
|
---|
87 |
|
---|
88 | int8_t sqvcol[] = { 9, 8, 9, 9 }; /* value entry column - type order */
|
---|
89 |
|
---|
90 | int8_t seqvcol[] = { 8, 8, 9, 9, 9 }; /* value entry column - box order */
|
---|
91 |
|
---|
92 | int16_t sqndata[] = { /* data types in box order */
|
---|
93 |
|
---|
94 | SQ_VAL, SQ_REG, SQ_VLT, SQ_RND
|
---|
95 | };
|
---|
96 |
|
---|
97 | /* |
---|
98 |
|
---|
99 | */
|
---|
100 |
|
---|
101 | /*
|
---|
102 | =============================================================================
|
---|
103 | hilitsq() -- highlight sequence submenu
|
---|
104 | =============================================================================
|
---|
105 | */
|
---|
106 |
|
---|
107 | void hilitsq(int8_t n)
|
---|
108 | {
|
---|
109 | register int16_t chr, h, v, w;
|
---|
110 |
|
---|
111 | sqmenu = n; /* set current submenu type */
|
---|
112 |
|
---|
113 | for (h = 0; h < 5; h++) { /* scan the columns */
|
---|
114 |
|
---|
115 | for (v = 0; v < 5; v++) { /* scan the rows */
|
---|
116 |
|
---|
117 | chr = sqhilit[h][0]; /* starting character */
|
---|
118 |
|
---|
119 | for (w = sqhilit[h][1]; w-- > 0; )
|
---|
120 | vsetcv(obj11, v + 1, chr++,
|
---|
121 | (sqhilit[h][v + 2] & n) ?
|
---|
122 | PTIATR : PTMATR, 64);
|
---|
123 | }
|
---|
124 | }
|
---|
125 | }
|
---|
126 |
|
---|
127 | /* |
---|
128 |
|
---|
129 | */
|
---|
130 |
|
---|
131 | /*
|
---|
132 | =============================================================================
|
---|
133 | postcm() -- determine state after cursor motion
|
---|
134 | =============================================================================
|
---|
135 | */
|
---|
136 |
|
---|
137 | void postcm(void)
|
---|
138 | {
|
---|
139 | if (inrange(stccol, 12, 22)) {
|
---|
140 |
|
---|
141 | if (inrange(stccol, 12, 13))
|
---|
142 | hilitsq(ST_0);
|
---|
143 | else if ((sqopreq[seqbuf.seqact1 & SQ_MACT]) AND (stccol EQ 19))
|
---|
144 | hilitsq(ST_1);
|
---|
145 | else
|
---|
146 | hilitsq(ST_OFF);
|
---|
147 |
|
---|
148 | return;
|
---|
149 |
|
---|
150 | } else if (inrange(stccol, 24, 34)) {
|
---|
151 |
|
---|
152 | if (inrange(stccol, 24, 25))
|
---|
153 | hilitsq(ST_0);
|
---|
154 | else if ((sqopreq[seqbuf.seqact2 & SQ_MACT]) AND (stccol EQ 31))
|
---|
155 | hilitsq(ST_1);
|
---|
156 | else
|
---|
157 | hilitsq(ST_OFF);
|
---|
158 |
|
---|
159 | return;
|
---|
160 |
|
---|
161 | } else if (inrange(stccol, 36, 46)) {
|
---|
162 |
|
---|
163 | if (inrange(stccol, 36, 37))
|
---|
164 | hilitsq(ST_2);
|
---|
165 | else if ((sqopreq[seqbuf.seqact3 & SQ_MACT]) AND (stccol EQ 43))
|
---|
166 | hilitsq(ST_1);
|
---|
167 | else
|
---|
168 | hilitsq(ST_OFF);
|
---|
169 |
|
---|
170 | return;
|
---|
171 |
|
---|
172 | } else {
|
---|
173 |
|
---|
174 | hilitsq(ST_OFF);
|
---|
175 | return;
|
---|
176 | }
|
---|
177 | }
|
---|
178 |
|
---|
179 | /* |
---|
180 |
|
---|
181 | */
|
---|
182 |
|
---|
183 | /*
|
---|
184 | =============================================================================
|
---|
185 | movestc() -- move cursor and reset highlighting
|
---|
186 | =============================================================================
|
---|
187 | */
|
---|
188 |
|
---|
189 | void movestc(int16_t r, int16_t c)
|
---|
190 | {
|
---|
191 | ctcpos(r, c);
|
---|
192 | postcm();
|
---|
193 | }
|
---|
194 |
|
---|
195 | /*
|
---|
196 | =============================================================================
|
---|
197 | endssm() -- end patch submenu data entry
|
---|
198 | =============================================================================
|
---|
199 | */
|
---|
200 |
|
---|
201 | void endssm(int16_t row, int16_t col)
|
---|
202 | {
|
---|
203 | submenu = FALSE;
|
---|
204 | cmtype = CT_SMTH;
|
---|
205 |
|
---|
206 | mtcoff();
|
---|
207 | ctcon();
|
---|
208 | movestc(row, col);
|
---|
209 | }
|
---|
210 |
|
---|
211 | /* |
---|
212 |
|
---|
213 | */
|
---|
214 |
|
---|
215 | /*
|
---|
216 | =============================================================================
|
---|
217 | setsqm() -- setup submenu
|
---|
218 | =============================================================================
|
---|
219 | */
|
---|
220 |
|
---|
221 | void setsqm(int16_t r, int16_t c)
|
---|
222 | {
|
---|
223 | submenu = TRUE;
|
---|
224 | cmtype = CT_MENU;
|
---|
225 | mtcpos(r, c);
|
---|
226 | }
|
---|
227 |
|
---|
228 | /* |
---|
229 |
|
---|
230 | */
|
---|
231 |
|
---|
232 | /*
|
---|
233 | =============================================================================
|
---|
234 | sqenter() -- enter an action
|
---|
235 | =============================================================================
|
---|
236 | */
|
---|
237 |
|
---|
238 | int16_t sqenter(void)
|
---|
239 | {
|
---|
240 | register int16_t i, lcol;
|
---|
241 | register int32_t ltemp;
|
---|
242 | register uint16_t *ap, *dp;
|
---|
243 | uint16_t theact, port, chan, key, val, obj, dtype;
|
---|
244 |
|
---|
245 | switch (action) {
|
---|
246 |
|
---|
247 | case 0:
|
---|
248 |
|
---|
249 | ap = &seqbuf.seqact1;
|
---|
250 | dp = &seqbuf.seqdat1;
|
---|
251 | break;
|
---|
252 |
|
---|
253 | case 1:
|
---|
254 |
|
---|
255 | ap = &seqbuf.seqact2;
|
---|
256 | dp = &seqbuf.seqdat2;
|
---|
257 | break;
|
---|
258 |
|
---|
259 | case 2:
|
---|
260 |
|
---|
261 | ap = &seqbuf.seqact3;
|
---|
262 | dp = &seqbuf.seqdat3;
|
---|
263 | break;
|
---|
264 |
|
---|
265 | default:
|
---|
266 |
|
---|
267 | action = 0;
|
---|
268 | movestc(DATAROW, actlft[action]);
|
---|
269 | return(FAILURE);
|
---|
270 | }
|
---|
271 |
|
---|
272 | /* |
---|
273 |
|
---|
274 | */
|
---|
275 | lcol = actlft[action];
|
---|
276 | theact = SQ_MACT & *ap;
|
---|
277 |
|
---|
278 | switch (theact) {
|
---|
279 |
|
---|
280 | case SQ_TKEY: /* "Kt 001 1 01" */
|
---|
281 | case SQ_CKEY: /* "Kc 001 1 01" */
|
---|
282 | case SQ_RKEY: /* "Kr 001 1 01" */
|
---|
283 | case SQ_IKEY: /* "If 001 1 01" */
|
---|
284 |
|
---|
285 | ltemp = 0;
|
---|
286 |
|
---|
287 | for (i = lcol + 3; i < lcol + 6; i++)
|
---|
288 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
289 |
|
---|
290 | if ((ltemp < 1L) OR (ltemp > 128L)) {
|
---|
291 |
|
---|
292 | movestc(DATAROW, actlft[action] + 3);
|
---|
293 | return(FAILURE);
|
---|
294 | }
|
---|
295 |
|
---|
296 | key = ltemp - 1;
|
---|
297 | /* |
---|
298 |
|
---|
299 | */
|
---|
300 | i = sqdebuf[lcol + 7];
|
---|
301 |
|
---|
302 | if ((i EQ '1') OR (i EQ '2')) {
|
---|
303 |
|
---|
304 | port = i - '1';
|
---|
305 |
|
---|
306 | } else if (i EQ 'L') {
|
---|
307 |
|
---|
308 | port = 2;
|
---|
309 |
|
---|
310 | } else {
|
---|
311 |
|
---|
312 | movestc(DATAROW, actlft[action] + 7);
|
---|
313 | return(FAILURE);
|
---|
314 | }
|
---|
315 |
|
---|
316 | ltemp = ((sqdebuf[lcol + 9] - '0') * 10) +
|
---|
317 | (sqdebuf[lcol + 10] - '0');
|
---|
318 |
|
---|
319 | if ((ltemp < 1L) OR (ltemp > 16L)) {
|
---|
320 |
|
---|
321 | movestc(DATAROW, actlft[action] + 9);
|
---|
322 | return(FAILURE);
|
---|
323 | }
|
---|
324 |
|
---|
325 | chan = ltemp - 1;
|
---|
326 | *dp = (port << 11) | (chan << 7) | key;
|
---|
327 |
|
---|
328 | break;
|
---|
329 | /* |
---|
330 |
|
---|
331 | */
|
---|
332 | case SQ_STRG: /* "Trig on 01" */
|
---|
333 | case SQ_CTRG: /* "Trig off 01" */
|
---|
334 | case SQ_TTRG: /* "Trig tgl 01" */
|
---|
335 |
|
---|
336 | ltemp = ((sqdebuf[lcol + 9] - '0') * 10)+
|
---|
337 | (sqdebuf[lcol + 10] - '0');
|
---|
338 |
|
---|
339 | if ((ltemp < 1L) OR (ltemp > 16)) {
|
---|
340 |
|
---|
341 | movestc(DATAROW, actlft[action] + 9);
|
---|
342 | return(FAILURE);
|
---|
343 | }
|
---|
344 |
|
---|
345 | *dp = ltemp - 1;
|
---|
346 |
|
---|
347 | break;
|
---|
348 |
|
---|
349 | case SQ_NULL: /* " " */
|
---|
350 | case SQ_ITRG: /* "If trig act" */
|
---|
351 | case SQ_STOP: /* "Stop " */
|
---|
352 | case SQ_ISTM: /* "If stim act" */
|
---|
353 |
|
---|
354 | break;
|
---|
355 |
|
---|
356 | case SQ_JUMP: /* "Jump to 000" */
|
---|
357 |
|
---|
358 | ltemp = 0;
|
---|
359 |
|
---|
360 | for (i = lcol + 8; i < lcol + 11; i++)
|
---|
361 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
362 |
|
---|
363 | *dp = ltemp;
|
---|
364 |
|
---|
365 | break;
|
---|
366 | /* |
---|
367 |
|
---|
368 | */
|
---|
369 | case SQ_SREG: /* "Set R01=00 " */
|
---|
370 | case SQ_AREG: /* "Inc R01+00 " */
|
---|
371 | case SQ_IREQ: /* "If R01=00 " */
|
---|
372 | case SQ_IRLT: /* "If R01<00 " */
|
---|
373 | case SQ_IRGT: /* "If R01>00 " */
|
---|
374 |
|
---|
375 | dtype = *dp & SQ_MTYP;
|
---|
376 |
|
---|
377 | ltemp = ((sqdebuf[lcol + 5] - '0') * 10) +
|
---|
378 | (sqdebuf[lcol + 6] - '0');
|
---|
379 |
|
---|
380 | if ((ltemp < 1) OR (ltemp > 16)) {
|
---|
381 |
|
---|
382 | movestc(DATAROW, actlft[action] + 5);
|
---|
383 | return(FAILURE);
|
---|
384 | }
|
---|
385 |
|
---|
386 | obj = ltemp - 1;
|
---|
387 |
|
---|
388 | switch (dtype) {
|
---|
389 |
|
---|
390 | case SQ_REG: /* register */
|
---|
391 |
|
---|
392 | ltemp = ((sqdebuf[lcol + 9] - '0') * 10) +
|
---|
393 | (sqdebuf[lcol + 10] - '0');
|
---|
394 |
|
---|
395 | if ((ltemp < 1) OR (ltemp > 16)) {
|
---|
396 |
|
---|
397 | movestc(DATAROW, actlft[action] + 9);
|
---|
398 | return(FAILURE);
|
---|
399 | }
|
---|
400 |
|
---|
401 | val = ltemp - 1;
|
---|
402 | break;
|
---|
403 |
|
---|
404 | case SQ_VAL: /* constant value */
|
---|
405 |
|
---|
406 | val = ((sqdebuf[lcol + 8] - '0') * 10) +
|
---|
407 | (sqdebuf[lcol + 9] - '0');
|
---|
408 |
|
---|
409 | break;
|
---|
410 | /* |
---|
411 |
|
---|
412 | */
|
---|
413 | case SQ_VLT: /* control voltage */
|
---|
414 |
|
---|
415 | val = (sqdebuf[lcol + 9] - '0') - 1;
|
---|
416 | break;
|
---|
417 |
|
---|
418 | case SQ_RND: /* random value */
|
---|
419 |
|
---|
420 | val = sqdebuf[lcol + 9] - '0';
|
---|
421 | break;
|
---|
422 |
|
---|
423 | default:
|
---|
424 |
|
---|
425 | movestc(DATAROW, actlft[action] + 8);
|
---|
426 | return(FAILURE);
|
---|
427 | }
|
---|
428 |
|
---|
429 | if (((*ap & SQ_MACT) EQ SQ_AREG) AND
|
---|
430 | (sqdebuf[lcol + 7] EQ '-'))
|
---|
431 | val |= 0x1000;
|
---|
432 |
|
---|
433 | *ap = (*ap & SQ_MACT) | (obj << 8);
|
---|
434 | *dp = (*dp & SQ_MTYP) | val;
|
---|
435 |
|
---|
436 | break;
|
---|
437 |
|
---|
438 | default:
|
---|
439 |
|
---|
440 | movestc(DATAROW, actlft[action]);
|
---|
441 | return(FAILURE);
|
---|
442 | }
|
---|
443 | /* |
---|
444 |
|
---|
445 | */
|
---|
446 | memcpyw(&seqtab[curslin], &seqbuf, NSEQW);
|
---|
447 | dsqlin(sqdebuf, curslin);
|
---|
448 | sqdeflg = TRUE;
|
---|
449 | dcursq();
|
---|
450 | movestc(DATAROW, nextact[action]);
|
---|
451 | return(SUCCESS);
|
---|
452 | }
|
---|
453 |
|
---|
454 | /* |
---|
455 |
|
---|
456 | */
|
---|
457 |
|
---|
458 | /*
|
---|
459 | =============================================================================
|
---|
460 | sqfnbox() -- sequence display box hit processor
|
---|
461 | =============================================================================
|
---|
462 | */
|
---|
463 |
|
---|
464 | int16_t sqfnbox(int16_t n)
|
---|
465 | {
|
---|
466 | int16_t act, vtype;
|
---|
467 | register int16_t box;
|
---|
468 | register int16_t i;
|
---|
469 | register int32_t ltemp;
|
---|
470 |
|
---|
471 | if (NOT submenu) { /* SEQUENCE DATA ENTRY LINE */
|
---|
472 |
|
---|
473 | if (inrange(stccol, 2, 4)) { /* Line */
|
---|
474 |
|
---|
475 | ltemp = 0;
|
---|
476 |
|
---|
477 | for (i = 2; i < 5; i++)
|
---|
478 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
479 |
|
---|
480 | curslin = ltemp;
|
---|
481 | sqdeflg = FALSE;
|
---|
482 | dstw();
|
---|
483 | movestc(DATAROW, 2);
|
---|
484 | return(SUCCESS);
|
---|
485 |
|
---|
486 | } else if (inrange(stccol, 6, 10)) { /* Time */
|
---|
487 |
|
---|
488 | ltemp = 0;
|
---|
489 |
|
---|
490 | for (i = 6; i < 8; i++)
|
---|
491 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
492 |
|
---|
493 | for (i = 9; i < 11; i++)
|
---|
494 | ltemp = (ltemp * 10) + (sqdebuf[i] - '0');
|
---|
495 |
|
---|
496 | seqtab[curslin].seqtime = ltemp;
|
---|
497 | seqbuf.seqtime = ltemp;
|
---|
498 | dsqlin(sqdebuf, curslin);
|
---|
499 | sqdeflg = TRUE;
|
---|
500 | dcursq();
|
---|
501 | movestc(DATAROW, 12);
|
---|
502 | return(SUCCESS);
|
---|
503 | /* |
---|
504 |
|
---|
505 | */
|
---|
506 | } else if (inrange(stccol, 12, 22)) { /* Action 1 */
|
---|
507 |
|
---|
508 | action = 0;
|
---|
509 |
|
---|
510 | if (inrange(stccol, 12, 13)) {
|
---|
511 |
|
---|
512 | setsqm(19, 2);
|
---|
513 | return(SUCCESS);
|
---|
514 |
|
---|
515 | } else if ((sqopreq[seqbuf.seqact1 & SQ_MACT]) AND
|
---|
516 | (stccol EQ 19)) {
|
---|
517 |
|
---|
518 | setsqm(19, 53);
|
---|
519 | return(SUCCESS);
|
---|
520 |
|
---|
521 | } else {
|
---|
522 |
|
---|
523 | return(sqenter());
|
---|
524 | }
|
---|
525 |
|
---|
526 | } else if (inrange(stccol, 24, 34)) { /* Action 2 */
|
---|
527 |
|
---|
528 | action = 1;
|
---|
529 |
|
---|
530 | if (inrange(stccol, 24, 25)) {
|
---|
531 |
|
---|
532 | setsqm(19, 2);
|
---|
533 | return(SUCCESS);
|
---|
534 |
|
---|
535 | } else if ((sqopreq[seqbuf.seqact2 & SQ_MACT]) AND
|
---|
536 | (stccol EQ 31)) {
|
---|
537 |
|
---|
538 | setsqm(19, 53);
|
---|
539 | return(SUCCESS);
|
---|
540 |
|
---|
541 | } else {
|
---|
542 |
|
---|
543 | return(sqenter());
|
---|
544 | }
|
---|
545 | /* |
---|
546 |
|
---|
547 | */
|
---|
548 | } else if (inrange(stccol, 36, 46)) { /* Action 3 */
|
---|
549 |
|
---|
550 | action = 2;
|
---|
551 |
|
---|
552 | if (inrange(stccol, 36, 37)) {
|
---|
553 |
|
---|
554 | setsqm(19, 2);
|
---|
555 | return(SUCCESS);
|
---|
556 |
|
---|
557 | } else if ((sqopreq[seqbuf.seqact3 & SQ_MACT]) AND
|
---|
558 | (stccol EQ 43)) {
|
---|
559 |
|
---|
560 | setsqm(19, 53);
|
---|
561 | return(SUCCESS);
|
---|
562 |
|
---|
563 | } else {
|
---|
564 |
|
---|
565 | return(sqenter());
|
---|
566 | }
|
---|
567 |
|
---|
568 | } else
|
---|
569 | return(FAILURE);
|
---|
570 | /* |
---|
571 |
|
---|
572 | */
|
---|
573 | } else { /* SUBMENU SELECTION */
|
---|
574 |
|
---|
575 | /* determine the "box" we're pointing at */
|
---|
576 |
|
---|
577 | if (inrange(vtccol, 2, 14))
|
---|
578 | box = vtcrow - 18;
|
---|
579 | else if (inrange(vtccol, 17, 27))
|
---|
580 | box = vtcrow - 14;
|
---|
581 | else if (inrange(vtccol, 30, 40))
|
---|
582 | box = vtcrow - 10;
|
---|
583 | else if (inrange(vtccol, 43, 50))
|
---|
584 | box = vtcrow - 6;
|
---|
585 | else if (inrange(vtccol, 53, 60))
|
---|
586 | box = vtcrow - 1;
|
---|
587 | else
|
---|
588 | return(FAILURE);
|
---|
589 | /* |
---|
590 |
|
---|
591 | */
|
---|
592 | switch (sqmenu) { /* switch on submenu type */
|
---|
593 |
|
---|
594 | case ST_0: /* Action 1 or Action 2 type */
|
---|
595 | case ST_2: /* Action 3 type */
|
---|
596 |
|
---|
597 | if (inrange(box, 18, 21))
|
---|
598 | return(FAILURE);
|
---|
599 |
|
---|
600 | switch (action) {
|
---|
601 |
|
---|
602 | case 0: /* action 1 */
|
---|
603 |
|
---|
604 | act = SQ_MACT & (seqbuf.seqact1 = sqatype[box]);
|
---|
605 | vtype = 0x000F & ((seqbuf.seqdat1 = sqidata[box]) >> 8);
|
---|
606 | break;
|
---|
607 |
|
---|
608 | case 1: /* action 2 */
|
---|
609 |
|
---|
610 | act = SQ_MACT & (seqbuf.seqact2 = sqatype[box]);
|
---|
611 | vtype = 0x000F & ((seqbuf.seqdat2 = sqidata[box]) >> 8);
|
---|
612 | break;
|
---|
613 |
|
---|
614 | case 2: /* action 3 */
|
---|
615 |
|
---|
616 | if ((box EQ 4) OR (box EQ 8) OR (box EQ 12) OR
|
---|
617 | inrange(box, 15, 17))
|
---|
618 | return(FAILURE);
|
---|
619 |
|
---|
620 | act = SQ_MACT & (seqbuf.seqact3 = sqatype[box]);
|
---|
621 | vtype = 0x000F & ((seqbuf.seqdat3 = sqidata[box]) >> 8);
|
---|
622 | break;
|
---|
623 | }
|
---|
624 |
|
---|
625 | memcpyw(&seqtab[curslin], &seqbuf, NSEQW);
|
---|
626 | dsqlin(sqdebuf, curslin);
|
---|
627 | sqdeflg = TRUE;
|
---|
628 | dcursq();
|
---|
629 |
|
---|
630 | if (sqopreq[act])
|
---|
631 | endssm(stcrow, actlft[action] + sqvcol[vtype]);
|
---|
632 | else if ((act EQ SQ_ISTM) OR (act EQ SQ_STOP))
|
---|
633 | endssm(stcrow, nextact[action]);
|
---|
634 | else
|
---|
635 | endssm(stcrow, actlft[action] + actcol[act]);
|
---|
636 |
|
---|
637 | return(SUCCESS);
|
---|
638 | /* |
---|
639 |
|
---|
640 | */
|
---|
641 | case ST_1: /* operand type */
|
---|
642 |
|
---|
643 | if (NOT inrange(box, 18, 21))
|
---|
644 | return(FAILURE);
|
---|
645 |
|
---|
646 | switch (action) {
|
---|
647 |
|
---|
648 | case 0: /* action 1 */
|
---|
649 |
|
---|
650 | if (NOT sqopreq[act = SQ_MACT & seqbuf.seqact1])
|
---|
651 | return(FAILURE);
|
---|
652 |
|
---|
653 | seqbuf.seqdat1 = (seqbuf.seqdat1 & SQ_MFLG) | sqndata[box - 18];
|
---|
654 | break;
|
---|
655 |
|
---|
656 | case 1: /* action 2 */
|
---|
657 |
|
---|
658 | if (NOT sqopreq[act = SQ_MACT & seqbuf.seqact2])
|
---|
659 | return(FAILURE);
|
---|
660 |
|
---|
661 | seqbuf.seqdat2 = (seqbuf.seqdat2 & SQ_MFLG) | sqndata[box - 18];
|
---|
662 | break;
|
---|
663 |
|
---|
664 | case 2: /* action 3 */
|
---|
665 |
|
---|
666 | if (NOT sqopreq[act = SQ_MACT & seqbuf.seqact3])
|
---|
667 | return(FAILURE);
|
---|
668 |
|
---|
669 | seqbuf.seqdat3 = (seqbuf.seqdat3 & SQ_MFLG) | sqndata[box - 18];
|
---|
670 | break;
|
---|
671 | }
|
---|
672 |
|
---|
673 | break;
|
---|
674 |
|
---|
675 | default: /* -BOGUS- */
|
---|
676 |
|
---|
677 | endssm(stcrow, stccol);
|
---|
678 | return(FAILURE);
|
---|
679 | }
|
---|
680 |
|
---|
681 | memcpyw(&seqtab[curslin], &seqbuf, NSEQW);
|
---|
682 | dsqlin(sqdebuf, curslin);
|
---|
683 | sqdeflg = TRUE;
|
---|
684 | dcursq();
|
---|
685 | endssm(stcrow, actlft[action] + seqvcol[box - 18]);
|
---|
686 | return(SUCCESS);
|
---|
687 | }
|
---|
688 |
|
---|
689 | return(FAILURE);
|
---|
690 | }
|
---|
691 |
|
---|