[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etiact.c -- point action field handlers
|
---|
| 4 | Version 16 -- 1988-08-31 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define DEBUGIT 0
|
---|
| 9 |
|
---|
[b28a12e] | 10 | #include "ram.h"
|
---|
[f40a309] | 11 |
|
---|
| 12 | /*
|
---|
| 13 | =============================================================================
|
---|
| 14 | et_iact() -- load edit buffer
|
---|
| 15 | =============================================================================
|
---|
| 16 | */
|
---|
| 17 |
|
---|
[7258c6a] | 18 | int16_t et_iact(int16_t nn)
|
---|
[f40a309] | 19 | {
|
---|
| 20 | register struct instpnt *pp;
|
---|
| 21 |
|
---|
[7ecfb7b] | 22 | (void)nn;
|
---|
| 23 |
|
---|
[f40a309] | 24 | pp = &vbufs[curvce].idhpnt[curpnt];
|
---|
| 25 |
|
---|
| 26 | aform = pp->ipact;
|
---|
| 27 |
|
---|
| 28 | switch (aform) {
|
---|
| 29 |
|
---|
| 30 | case AC_NULL:
|
---|
| 31 | case AC_SUST:
|
---|
| 32 | case AC_ENBL:
|
---|
| 33 | case AC_UNDF:
|
---|
| 34 |
|
---|
| 35 | ebuf[0] = '\0';
|
---|
| 36 | break;
|
---|
| 37 |
|
---|
| 38 | case AC_JUMP:
|
---|
| 39 | case AC_KYUP:
|
---|
| 40 | case AC_KYDN:
|
---|
| 41 |
|
---|
| 42 | sprintf(ebuf, "%02d", pp->ippar1);
|
---|
| 43 | break;
|
---|
| 44 |
|
---|
| 45 | case AC_LOOP:
|
---|
| 46 |
|
---|
| 47 | sprintf(ebuf, "%02d %02d", pp->ippar1, pp->ippar2);
|
---|
| 48 | break;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | #if DEBUGIT
|
---|
| 52 | if (debugsw)
|
---|
| 53 | printf("et_iact(): aform=%d, ebuf=[%s]\r\n", aform, ebuf);
|
---|
| 54 | #endif
|
---|
| 55 |
|
---|
| 56 | ebflag = TRUE;
|
---|
| 57 | return(SUCCESS);
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | =============================================================================
|
---|
| 62 | ef_iact() -- unload (parse) edit buffer
|
---|
| 63 | =============================================================================
|
---|
| 64 | */
|
---|
| 65 |
|
---|
[7258c6a] | 66 | int16_t ef_iact(int16_t nn)
|
---|
[f40a309] | 67 | {
|
---|
[7258c6a] | 68 | register int16_t i, tmp1, tmp2;
|
---|
[f40a309] | 69 | register struct instpnt *pp;
|
---|
| 70 | register struct idfnhdr *fp;
|
---|
| 71 |
|
---|
[7ecfb7b] | 72 | (void)nn;
|
---|
| 73 |
|
---|
[f40a309] | 74 | fp = &vbufs[curvce].idhfnc[curfunc];
|
---|
| 75 | pp = &vbufs[curvce].idhpnt[curpnt];
|
---|
| 76 | ebflag = FALSE;
|
---|
| 77 |
|
---|
| 78 | #if DEBUGIT
|
---|
| 79 | if (debugsw)
|
---|
| 80 | printf("ef_iact(): aform=%d, fp=$%08lX, pp=$%08lX\r\n",
|
---|
| 81 | aform, fp, pp);
|
---|
| 82 | #endif
|
---|
| 83 |
|
---|
| 84 | switch (aform) {
|
---|
| 85 |
|
---|
| 86 | case AC_NULL:
|
---|
| 87 | case AC_UNDF:
|
---|
| 88 |
|
---|
| 89 | aform = AC_NULL;
|
---|
| 90 |
|
---|
| 91 | case AC_SUST:
|
---|
| 92 | case AC_ENBL:
|
---|
| 93 |
|
---|
| 94 | pp->ipact = aform;
|
---|
| 95 |
|
---|
| 96 | #if DEBUGIT
|
---|
| 97 | if (debugsw)
|
---|
| 98 | printf("ef_iact(): aform=%d, ipact=%d, ippar1=%d, ippar2=%d\r\n",
|
---|
| 99 | aform, pp->ipact, pp->ippar1, pp->ippar2);
|
---|
| 100 | #endif
|
---|
| 101 |
|
---|
| 102 | modinst();
|
---|
| 103 | return(SUCCESS);
|
---|
| 104 |
|
---|
| 105 | case AC_JUMP:
|
---|
| 106 | case AC_KYUP:
|
---|
| 107 | case AC_KYDN:
|
---|
| 108 |
|
---|
| 109 | tmp1 = 0;
|
---|
| 110 |
|
---|
| 111 | for (i = 0; i < 2; i++)
|
---|
| 112 | tmp1 = (tmp1 * 10) + (ebuf[i] - '0');
|
---|
| 113 |
|
---|
| 114 | if (tmp1 GE fp->idfpif)
|
---|
| 115 | return(FAILURE);
|
---|
| 116 |
|
---|
| 117 | pp->ipact = aform;
|
---|
| 118 | pp->ippar1 = tmp1;
|
---|
| 119 | pp->ippar2 = 0;
|
---|
| 120 | pp->ippar3 = 0;
|
---|
| 121 |
|
---|
| 122 | #if DEBUGIT
|
---|
| 123 | if (debugsw)
|
---|
| 124 | printf("ef_iact(): aform=%d, ipact=%d, ippar1=%d, ippar2=%d\r\n",
|
---|
| 125 | aform, pp->ipact, pp->ippar1, pp->ippar2);
|
---|
| 126 | #endif
|
---|
| 127 |
|
---|
| 128 | modinst();
|
---|
| 129 | return(SUCCESS);
|
---|
[fa38804] | 130 |
|
---|
[f40a309] | 131 | case AC_LOOP:
|
---|
| 132 |
|
---|
| 133 | tmp1 = 0;
|
---|
| 134 |
|
---|
| 135 | for (i = 0; i < 2; i++)
|
---|
| 136 | tmp1 = (tmp1 * 10) + (ebuf[i] - '0');
|
---|
| 137 |
|
---|
| 138 | if (tmp1 GE fp->idfpif)
|
---|
| 139 | return(FAILURE);
|
---|
| 140 |
|
---|
| 141 | tmp2 = 0;
|
---|
| 142 |
|
---|
| 143 | for (i = 3; i < 5; i++)
|
---|
| 144 | tmp2 = (tmp2 * 10) + (ebuf[i] - '0');
|
---|
| 145 |
|
---|
| 146 | pp->ipact = aform;
|
---|
| 147 | pp->ippar1 = tmp1;
|
---|
| 148 | pp->ippar2 = tmp2;
|
---|
| 149 | pp->ippar3 = 0;
|
---|
| 150 |
|
---|
| 151 | #if DEBUGIT
|
---|
| 152 | if (debugsw)
|
---|
| 153 | printf("ef_iact(): aform=%d, ipact=%d, ippar1=%d, ippar2=%d\r\n",
|
---|
| 154 | aform, pp->ipact, pp->ippar1, pp->ippar2);
|
---|
| 155 | #endif
|
---|
| 156 |
|
---|
| 157 | modinst();
|
---|
| 158 | return(SUCCESS);
|
---|
| 159 | }
|
---|
[599d89b] | 160 |
|
---|
| 161 | return(FAILURE);
|
---|
[f40a309] | 162 | }
|
---|
| 163 |
|
---|
| 164 | /*
|
---|
| 165 | =============================================================================
|
---|
| 166 | rd_iact() -- (re)-display the field
|
---|
| 167 | =============================================================================
|
---|
| 168 | */
|
---|
| 169 |
|
---|
[7258c6a] | 170 | int16_t rd_iact(int16_t nn)
|
---|
[f40a309] | 171 | {
|
---|
[7258c6a] | 172 | register int16_t pnt, par, n;
|
---|
[f40a309] | 173 | register struct instpnt *pp;
|
---|
[7258c6a] | 174 | register int8_t *s1;
|
---|
[f40a309] | 175 |
|
---|
| 176 | n = nn & 0x00FF;
|
---|
| 177 | pp = &vbufs[curvce].idhpnt[curpnt];
|
---|
| 178 | pnt = pp->ippar1;
|
---|
| 179 | par = pp->ippar2;
|
---|
| 180 | aform = pp->ipact;
|
---|
| 181 |
|
---|
| 182 | #if DEBUGIT
|
---|
| 183 | if (debugsw)
|
---|
| 184 | printf("rd_iact(): aform=%d, pp=$%08lX, pnt=%d, par=%d\r\n",
|
---|
| 185 | aform, pp, pnt, par);
|
---|
| 186 | #endif
|
---|
| 187 |
|
---|
| 188 | switch (aform) {
|
---|
| 189 |
|
---|
| 190 | case AC_NULL:
|
---|
| 191 |
|
---|
| 192 | s1 = " ";
|
---|
| 193 | break;
|
---|
| 194 |
|
---|
| 195 | case AC_SUST:
|
---|
| 196 |
|
---|
| 197 | sprintf(dspbuf, "Pause if key %c ", SP_DNA);
|
---|
| 198 | s1 = dspbuf;
|
---|
| 199 | break;
|
---|
| 200 |
|
---|
| 201 | case AC_ENBL:
|
---|
| 202 |
|
---|
| 203 | sprintf(dspbuf, "Stop if key %c ", SP_UPA);
|
---|
| 204 | s1 = dspbuf;
|
---|
| 205 | break;
|
---|
| 206 |
|
---|
| 207 | case AC_JUMP:
|
---|
| 208 |
|
---|
| 209 | sprintf(dspbuf, "GoTo %02d forever ", pnt);
|
---|
| 210 | s1 = dspbuf;
|
---|
| 211 | break;
|
---|
| 212 |
|
---|
[fa38804] | 213 |
|
---|
[f40a309] | 214 | case AC_LOOP:
|
---|
| 215 |
|
---|
| 216 | sprintf(dspbuf, "GoTo %02d %02d times", pnt, par);
|
---|
| 217 |
|
---|
| 218 | if (dspbuf[8] EQ '9')
|
---|
| 219 | dspbuf[8] = 'R';
|
---|
| 220 |
|
---|
| 221 | s1 = dspbuf;
|
---|
| 222 | break;
|
---|
| 223 |
|
---|
| 224 | case AC_KYUP:
|
---|
| 225 |
|
---|
| 226 | sprintf(dspbuf, "GoTo %02d if key %c", pnt, SP_UPA);
|
---|
| 227 | s1 = dspbuf;
|
---|
| 228 | break;
|
---|
| 229 |
|
---|
| 230 | case AC_KYDN:
|
---|
| 231 |
|
---|
| 232 | sprintf(dspbuf, "GoTo %02d if key %c", pnt, SP_DNA);
|
---|
| 233 | s1 = dspbuf;
|
---|
| 234 | break;
|
---|
| 235 |
|
---|
| 236 | default:
|
---|
| 237 |
|
---|
| 238 | s1 = "????????????????";
|
---|
| 239 | break;
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | vbank(0);
|
---|
| 243 | vcputsv(instob, 64, idbox[n][4], idbox[n][5],
|
---|
| 244 | idbox[n][6] + 1, idbox[n][7], s1, 14);
|
---|
[60288f5] | 245 |
|
---|
| 246 | return(SUCCESS);
|
---|
[f40a309] | 247 | }
|
---|
| 248 |
|
---|
| 249 | /*
|
---|
| 250 | =============================================================================
|
---|
| 251 | setactb() -- set action field data entry buffer format
|
---|
| 252 | =============================================================================
|
---|
| 253 | */
|
---|
| 254 |
|
---|
[7258c6a] | 255 | void setactb(int16_t n)
|
---|
[f40a309] | 256 | {
|
---|
[7258c6a] | 257 | register int8_t *s1;
|
---|
[f40a309] | 258 |
|
---|
| 259 | switch (aform) {
|
---|
| 260 |
|
---|
| 261 | case AC_NULL:
|
---|
| 262 |
|
---|
| 263 | s1 = " ";
|
---|
| 264 | ebuf[0] = '\0';
|
---|
| 265 | break;
|
---|
| 266 |
|
---|
| 267 | case AC_SUST:
|
---|
| 268 |
|
---|
| 269 | sprintf(dspbuf, "Pause if key %c ", SP_DNA);
|
---|
| 270 | s1 = dspbuf;
|
---|
| 271 | ebuf[0] = '\0';
|
---|
| 272 | break;
|
---|
| 273 |
|
---|
| 274 | case AC_ENBL:
|
---|
| 275 |
|
---|
| 276 | sprintf(dspbuf, "Stop if key %c ", SP_UPA);
|
---|
| 277 | s1 = dspbuf;
|
---|
| 278 | ebuf[0] = '\0';
|
---|
| 279 | break;
|
---|
| 280 |
|
---|
| 281 | case AC_JUMP:
|
---|
| 282 |
|
---|
| 283 | s1 = "GoTo 00 forever ";
|
---|
| 284 | ebuf[0] = '0';
|
---|
| 285 | ebuf[1] = '0';
|
---|
| 286 | ebuf[2] = '\0';
|
---|
| 287 | break;
|
---|
| 288 |
|
---|
[fa38804] | 289 |
|
---|
[f40a309] | 290 | case AC_LOOP:
|
---|
| 291 |
|
---|
| 292 | s1 = "GoTo 00 00 times";
|
---|
| 293 | ebuf[0] = '0';
|
---|
| 294 | ebuf[1] = '0';
|
---|
| 295 | ebuf[2] = ' ';
|
---|
| 296 | ebuf[3] = '0';
|
---|
| 297 | ebuf[4] = '0';
|
---|
| 298 | ebuf[5] = '\0';
|
---|
| 299 | break;
|
---|
| 300 |
|
---|
| 301 | case AC_KYUP:
|
---|
| 302 |
|
---|
| 303 | sprintf(dspbuf, "GoTo 00 if key %c", SP_UPA);
|
---|
| 304 | s1 = dspbuf;
|
---|
| 305 | ebuf[0] = '0';
|
---|
| 306 | ebuf[1] = '0';
|
---|
| 307 | ebuf[2] = '\0';
|
---|
| 308 | break;
|
---|
| 309 |
|
---|
| 310 | case AC_KYDN:
|
---|
| 311 |
|
---|
| 312 | sprintf(dspbuf, "GoTo 00 if key %c", SP_DNA);
|
---|
| 313 | s1 = dspbuf;
|
---|
| 314 | ebuf[0] = '0';
|
---|
| 315 | ebuf[1] = '0';
|
---|
| 316 | ebuf[2] = '\0';
|
---|
| 317 | break;
|
---|
| 318 |
|
---|
| 319 | default:
|
---|
| 320 |
|
---|
| 321 | s1 = "????????????????";
|
---|
| 322 | ebuf[0] = '\0';
|
---|
| 323 | break;
|
---|
| 324 | }
|
---|
| 325 |
|
---|
| 326 | vbank(0);
|
---|
| 327 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
| 328 | idbox[n][6] + 1, idbox[n][7], s1, 14);
|
---|
| 329 | }
|
---|
| 330 |
|
---|
| 331 | /*
|
---|
| 332 | =============================================================================
|
---|
| 333 | nd_iact() -- process new data entry
|
---|
| 334 | =============================================================================
|
---|
| 335 | */
|
---|
| 336 |
|
---|
[7258c6a] | 337 | int16_t nd_iact(int16_t nn, int16_t k)
|
---|
[f40a309] | 338 | {
|
---|
[7258c6a] | 339 | register int16_t n, ec;
|
---|
[f40a309] | 340 |
|
---|
| 341 | n = nn & 0xFF;
|
---|
| 342 |
|
---|
| 343 | if (stccol LT (idbox[n][7] + 5)) {
|
---|
| 344 |
|
---|
| 345 | if (k EQ 8) {
|
---|
| 346 |
|
---|
| 347 | if (--aform < 0)
|
---|
| 348 | aform = AC_KYDN;
|
---|
| 349 |
|
---|
| 350 | setactb(n);
|
---|
| 351 | return(SUCCESS);
|
---|
| 352 |
|
---|
| 353 | } else if (k EQ 9) {
|
---|
| 354 |
|
---|
| 355 | if (++aform > AC_KYDN)
|
---|
| 356 | aform = AC_NULL;
|
---|
| 357 |
|
---|
| 358 | setactb(n);
|
---|
| 359 | return(SUCCESS);
|
---|
| 360 | }
|
---|
| 361 |
|
---|
| 362 | return(FAILURE);
|
---|
| 363 |
|
---|
[fa38804] | 364 |
|
---|
[f40a309] | 365 | } else {
|
---|
| 366 |
|
---|
| 367 | switch (aform) {
|
---|
| 368 |
|
---|
| 369 | case AC_NULL:
|
---|
| 370 | case AC_UNDF:
|
---|
| 371 | case AC_ENBL:
|
---|
| 372 | case AC_SUST:
|
---|
| 373 |
|
---|
| 374 | return(FAILURE);
|
---|
| 375 |
|
---|
| 376 | case AC_KYUP:
|
---|
| 377 | case AC_KYDN:
|
---|
| 378 | case AC_JUMP:
|
---|
| 379 |
|
---|
| 380 | if ((stccol EQ (idbox[n][7] + 5)) OR
|
---|
| 381 | (stccol EQ (idbox[n][7] + 6))) {
|
---|
| 382 |
|
---|
| 383 | ebuf[stccol - (idbox[n][7] + 5)] = k + '0';
|
---|
| 384 | dspbuf[0] = k + '0';
|
---|
| 385 | dspbuf[1] = '\0';
|
---|
| 386 |
|
---|
| 387 | vbank(0);
|
---|
| 388 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
| 389 | stcrow, stccol, dspbuf, 14);
|
---|
| 390 |
|
---|
| 391 | advicur();
|
---|
| 392 | return(SUCCESS);
|
---|
| 393 |
|
---|
| 394 | } else {
|
---|
| 395 |
|
---|
| 396 | return(FAILURE);
|
---|
| 397 | }
|
---|
[fa38804] | 398 |
|
---|
[f40a309] | 399 | case AC_LOOP:
|
---|
| 400 |
|
---|
| 401 | if ((stccol GE (idbox[n][7] + 5)) AND
|
---|
| 402 | (stccol LE (idbox[n][7] + 9))) {
|
---|
| 403 |
|
---|
| 404 | ec = stccol - (idbox[n][7] + 5);
|
---|
| 405 |
|
---|
| 406 | if (ec EQ 2)
|
---|
| 407 | return(FAILURE);
|
---|
| 408 |
|
---|
| 409 | ebuf[ec] = k + '0';
|
---|
| 410 | dspbuf[0] = k + '0';
|
---|
| 411 | dspbuf[1] = '\0';
|
---|
| 412 |
|
---|
| 413 | if ((ec EQ 3) AND (k EQ 9))
|
---|
| 414 | dspbuf[0] = 'R';
|
---|
| 415 |
|
---|
| 416 | vbank(0);
|
---|
| 417 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
| 418 | stcrow, stccol, dspbuf, 14);
|
---|
| 419 |
|
---|
| 420 | advicur();
|
---|
| 421 |
|
---|
| 422 | if (ec EQ 1)
|
---|
| 423 | advicur();
|
---|
| 424 |
|
---|
| 425 | return(SUCCESS);
|
---|
| 426 |
|
---|
| 427 | } else {
|
---|
| 428 |
|
---|
| 429 | return(FAILURE);
|
---|
| 430 | }
|
---|
| 431 | }
|
---|
[599d89b] | 432 |
|
---|
| 433 | return(FAILURE);
|
---|
[f40a309] | 434 | }
|
---|
| 435 | }
|
---|
[6262b5c] | 436 |
|
---|