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

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

Zero redundant declarations.

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