1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etavgr.c -- assignment editor - voice to group field handlers
|
---|
4 | Version 9 -- 1988-03-18 -- 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 |
|
---|
16 | #include "midas.h"
|
---|
17 | #include "asgdsp.h"
|
---|
18 |
|
---|
19 | #include "stdio.h"
|
---|
20 |
|
---|
21 | #if DEBUGIT
|
---|
22 | extern short debugsw;
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | extern int8_t *numblk(int8_t *buf, int16_t n);
|
---|
26 |
|
---|
27 | extern void advacur(void);
|
---|
28 | extern void execins(int16_t vce, int16_t ins, int16_t tag);
|
---|
29 | extern void modasg(void);
|
---|
30 |
|
---|
31 | extern uint16_t *asgob;
|
---|
32 |
|
---|
33 | extern int16_t stcrow, stccol;
|
---|
34 |
|
---|
35 | extern int16_t adbox[][8];
|
---|
36 |
|
---|
37 | extern int8_t dspbuf[];
|
---|
38 |
|
---|
39 | extern int16_t vce2grp[12]; /* voice to group table */
|
---|
40 | extern int16_t ins2grp[12];
|
---|
41 |
|
---|
42 | /* |
---|
43 |
|
---|
44 | */
|
---|
45 |
|
---|
46 | /*
|
---|
47 | =============================================================================
|
---|
48 | et_avgr() -- load the edit buffer
|
---|
49 | =============================================================================
|
---|
50 | */
|
---|
51 |
|
---|
52 | int16_t et_avgr(int16_t nn)
|
---|
53 | {
|
---|
54 | register int16_t grp;
|
---|
55 | int8_t buf[4];
|
---|
56 |
|
---|
57 | grp = 0x00FF & (nn >> 8);
|
---|
58 |
|
---|
59 | sprintf(ebuf, "%s", numblk(buf, vce2grp[grp]));
|
---|
60 | ebflag = TRUE;
|
---|
61 |
|
---|
62 | #if DEBUGIT
|
---|
63 | if (debugsw)
|
---|
64 | printf("et_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | return(SUCCESS);
|
---|
68 | }
|
---|
69 |
|
---|
70 | /* |
---|
71 |
|
---|
72 | */
|
---|
73 |
|
---|
74 | /*
|
---|
75 | =============================================================================
|
---|
76 | ef_avgr() -- parse (unload) the edit buffer
|
---|
77 | =============================================================================
|
---|
78 | */
|
---|
79 |
|
---|
80 | int16_t ef_avgr(int16_t nn)
|
---|
81 | {
|
---|
82 | register int16_t tmpval, vce, i;
|
---|
83 |
|
---|
84 | vce = 0x00FF & (nn >> 8);
|
---|
85 |
|
---|
86 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
87 | ebflag = FALSE;
|
---|
88 | tmpval = 0;
|
---|
89 |
|
---|
90 | #if DEBUGIT
|
---|
91 | if (debugsw)
|
---|
92 | printf("ef_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | if ((ebuf[0] EQ ' ') AND (ebuf[1] EQ ' ')) {
|
---|
96 |
|
---|
97 | tmpval = -1;
|
---|
98 |
|
---|
99 | } else {
|
---|
100 |
|
---|
101 | for (i = 0; i < 2; i++) {
|
---|
102 |
|
---|
103 | if (ebuf[i] EQ ' ')
|
---|
104 | ebuf[i] = '0';
|
---|
105 |
|
---|
106 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
107 | }
|
---|
108 |
|
---|
109 | if ((tmpval EQ 0) OR (tmpval GT 12))
|
---|
110 | return(FAILURE);
|
---|
111 | }
|
---|
112 |
|
---|
113 | vce2grp[vce] = tmpval;
|
---|
114 |
|
---|
115 | if (tmpval > 0)
|
---|
116 | execins(vce, (ins2grp[tmpval - 1] & 0x00FF), 1);
|
---|
117 |
|
---|
118 | modasg();
|
---|
119 | return(SUCCESS);
|
---|
120 | }
|
---|
121 |
|
---|
122 | /* |
---|
123 |
|
---|
124 | */
|
---|
125 |
|
---|
126 | /*
|
---|
127 | =============================================================================
|
---|
128 | rd_avgr() -- (re)display the field
|
---|
129 | =============================================================================
|
---|
130 | */
|
---|
131 |
|
---|
132 | int16_t rd_avgr(int16_t nn)
|
---|
133 | {
|
---|
134 | register int16_t n, grp;
|
---|
135 | int8_t buf[4];
|
---|
136 |
|
---|
137 | n = 0x00FF & nn;
|
---|
138 | grp = 0x00FF & (nn >> 8);
|
---|
139 |
|
---|
140 | vbank(0);
|
---|
141 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
142 | cfetp->frow, cfetp->flcol, numblk(buf, vce2grp[grp]), 14);
|
---|
143 |
|
---|
144 | return(SUCCESS);
|
---|
145 | }
|
---|
146 |
|
---|
147 | /* |
---|
148 |
|
---|
149 | */
|
---|
150 |
|
---|
151 | /*
|
---|
152 | =============================================================================
|
---|
153 | nd_avgr() -- handle new data entry
|
---|
154 | =============================================================================
|
---|
155 | */
|
---|
156 |
|
---|
157 | int16_t nd_avgr(int16_t nn, int16_t k)
|
---|
158 | {
|
---|
159 | register int16_t n, col;
|
---|
160 |
|
---|
161 | n = nn & 0xFF;
|
---|
162 | col = stccol - cfetp->flcol;
|
---|
163 |
|
---|
164 | ebuf[col] = k + '0';
|
---|
165 | ebuf[2] = '\0';
|
---|
166 |
|
---|
167 | #if DEBUGIT
|
---|
168 | if (debugsw)
|
---|
169 | printf("nd_avgr($%04.4X, %d): cfetp=$%08.8lX, col=%d, ebuf=[%s]\n",
|
---|
170 | nn, k, cfetp, col, ebuf);
|
---|
171 | #endif
|
---|
172 |
|
---|
173 | dspbuf[0] = k + '0';
|
---|
174 | dspbuf[1] = '\0';
|
---|
175 |
|
---|
176 | vbank(0);
|
---|
177 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
178 |
|
---|
179 | advacur();
|
---|
180 | return(SUCCESS);
|
---|
181 | }
|
---|
182 |
|
---|