1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etidin.c -- MIDAS instrument editor - instrument number field handlers
|
---|
4 | Version 28 -- 1988-09-15 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "ram.h"
|
---|
9 |
|
---|
10 | #define DIN_OFF 14
|
---|
11 |
|
---|
12 | /*
|
---|
13 | =============================================================================
|
---|
14 | et_idin() -- load the edit buffer
|
---|
15 | =============================================================================
|
---|
16 | */
|
---|
17 |
|
---|
18 | int16_t et_idin(int16_t n)
|
---|
19 | {
|
---|
20 | sprintf(ebuf, "%02d", curinst);
|
---|
21 | ebflag = TRUE;
|
---|
22 |
|
---|
23 | return(SUCCESS);
|
---|
24 | }
|
---|
25 |
|
---|
26 |
|
---|
27 | /*
|
---|
28 | =============================================================================
|
---|
29 | ef_idin() -- parse (unload) the edit buffer
|
---|
30 | =============================================================================
|
---|
31 | */
|
---|
32 |
|
---|
33 | int16_t ef_idin(int16_t n)
|
---|
34 | {
|
---|
35 | register int16_t i, tmpval, j;
|
---|
36 | register struct instdef *ip;
|
---|
37 |
|
---|
38 | if (idcfsw) { /* 'E' with menu up */
|
---|
39 |
|
---|
40 | if (vtcrow EQ 22) { /* fetch or escape */
|
---|
41 |
|
---|
42 | if (vtccol LT 35) {
|
---|
43 |
|
---|
44 | newinst(idintmp);
|
---|
45 | execins(curvce, curinst, 1);
|
---|
46 |
|
---|
47 | if (NOT editsw) {
|
---|
48 |
|
---|
49 | if ((i = vce2grp[curvce]) > 0) {
|
---|
50 |
|
---|
51 | for (j =0; j < 12; j++)
|
---|
52 | if (vce2grp[j] EQ i)
|
---|
53 | execins(j, curinst, 1);
|
---|
54 | }
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | objclr(TTCPRI);
|
---|
59 | idvlblc();
|
---|
60 | idcfsw = FALSE;
|
---|
61 | submenu = FALSE;
|
---|
62 |
|
---|
63 | if (vtccol LT 35) {
|
---|
64 |
|
---|
65 | allwins();
|
---|
66 |
|
---|
67 | } else {
|
---|
68 |
|
---|
69 | dswin(22);
|
---|
70 | dswin(19);
|
---|
71 | }
|
---|
72 | /* |
---|
73 |
|
---|
74 | */
|
---|
75 | } else if (vtcrow EQ 23) { /* copy to library */
|
---|
76 |
|
---|
77 | if (idintmp) {
|
---|
78 |
|
---|
79 | memcpyw(&idefs[idintmp], &vbufs[curvce],
|
---|
80 | (sizeof (struct instdef) / 2));
|
---|
81 |
|
---|
82 | curinst = idintmp;
|
---|
83 | instmod[curvce] = FALSE;
|
---|
84 | }
|
---|
85 |
|
---|
86 | objclr(TTCPRI);
|
---|
87 | idvlblc();
|
---|
88 | idcfsw = FALSE;
|
---|
89 | submenu = FALSE;
|
---|
90 | dswin(22);
|
---|
91 | dswin(19);
|
---|
92 |
|
---|
93 | if (idintmp EQ 0)
|
---|
94 | return(FAILURE);
|
---|
95 |
|
---|
96 | } else
|
---|
97 | return(FAILURE);
|
---|
98 |
|
---|
99 | return(SUCCESS);
|
---|
100 | /* |
---|
101 |
|
---|
102 | */
|
---|
103 | } else { /* 'E' with menu not up */
|
---|
104 |
|
---|
105 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
106 | ebflag = FALSE;
|
---|
107 |
|
---|
108 | tmpval = 0;
|
---|
109 |
|
---|
110 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
111 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
112 |
|
---|
113 | if (tmpval GE NINST) /* check the range */
|
---|
114 | return(FAILURE);
|
---|
115 |
|
---|
116 | idintmp = tmpval; /* save selected value */
|
---|
117 | idcpfch(); /* put up copy/fetch menu */
|
---|
118 | dswin(22);
|
---|
119 | SetPri(TTCURS, TTCPRI);
|
---|
120 | ttcpos(22, 17);
|
---|
121 | idcfsw = TRUE;
|
---|
122 | submenu = TRUE;
|
---|
123 | return(SUCCESS);
|
---|
124 | }
|
---|
125 | }
|
---|
126 |
|
---|
127 | /* |
---|
128 |
|
---|
129 | */
|
---|
130 |
|
---|
131 | /*
|
---|
132 | =============================================================================
|
---|
133 | rd_idin() -- (re)display the field
|
---|
134 | =============================================================================
|
---|
135 | */
|
---|
136 |
|
---|
137 | int16_t rd_idin(int16_t n)
|
---|
138 | {
|
---|
139 | if (idcfsw) /* don't display if copy/fetch is up */
|
---|
140 | return(FAILURE);
|
---|
141 |
|
---|
142 | /* convert to ASCII */
|
---|
143 |
|
---|
144 | sprintf(dspbuf, "%02d", curinst);
|
---|
145 |
|
---|
146 | vbank(0); /* display the value */
|
---|
147 |
|
---|
148 | vcputsv(instob, 64, (instmod[curvce] ? ID_CHGD : idbox[n][4]),
|
---|
149 | idbox[n][5], idbox[n][6], idbox[n][7] + DIN_OFF, dspbuf, 14);
|
---|
150 |
|
---|
151 | return(SUCCESS);
|
---|
152 | }
|
---|
153 |
|
---|
154 | /* |
---|
155 |
|
---|
156 | */
|
---|
157 |
|
---|
158 | /*
|
---|
159 | =============================================================================
|
---|
160 | nd_idin() -- handle new data entry
|
---|
161 | =============================================================================
|
---|
162 | */
|
---|
163 |
|
---|
164 | int16_t nd_idin(int16_t n, int16_t k)
|
---|
165 | {
|
---|
166 | register int16_t ec, c;
|
---|
167 |
|
---|
168 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
169 | ebuf[ec] = k + '0';
|
---|
170 | ebuf[2] = '\0';
|
---|
171 |
|
---|
172 | dspbuf[0] = k + '0';
|
---|
173 | dspbuf[1] = '\0';
|
---|
174 |
|
---|
175 | vbank(0);
|
---|
176 |
|
---|
177 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
178 | idbox[n][6], stccol, dspbuf, 14);
|
---|
179 |
|
---|
180 | advicur();
|
---|
181 |
|
---|
182 | return(SUCCESS);
|
---|
183 | }
|
---|
184 |
|
---|
185 |
|
---|