source: buchla-68k/ram/etiact.c@ 60288f5

Last change on this file since 60288f5 was 60288f5, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Make function pointers more consistent.

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