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