source: buchla-68k/orig/RAM/ETIDIN.C@ c0cb375

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

Imported original source code.

  • Property mode set to 100755
File size: 4.1 KB
Line 
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 "stddefs.h"
9#include "fields.h"
10#include "hwdefs.h"
11#include "vsdd.h"
12#include "vsddsw.h"
13#include "graphdef.h"
14
15#include "midas.h"
16#include "instdsp.h"
17
18#define DIN_OFF 14
19
20extern unsigned *instob;
21
22extern short vtcrow, vtccol, stccol, curinst, curvce, idcfsw, idintmp;
23extern short editsw, curfunc, submenu;
24
25extern short idbox[][8];
26extern short instmod[];
27extern short vce2grp[];
28
29extern char dspbuf[];
30
31extern struct instdef idefs[];
32extern struct instdef vbufs[];
33
34/*
35
36*/
37
38/*
39 =============================================================================
40 et_idin() -- load the edit buffer
41 =============================================================================
42*/
43
44short
45et_idin(n)
46short n;
47{
48 sprintf(ebuf, "%02d", curinst);
49 ebflag = TRUE;
50
51 return(SUCCESS);
52}
53
54
55/*
56 =============================================================================
57 ef_idin() -- parse (unload) the edit buffer
58 =============================================================================
59*/
60
61short
62ef_idin(n)
63short n;
64{
65 register short i, tmpval, j;
66 register struct instdef *ip;
67
68 if (idcfsw) { /* 'E' with menu up */
69
70 if (vtcrow EQ 22) { /* fetch or escape */
71
72 if (vtccol LT 35) {
73
74 newinst(idintmp);
75 execins(curvce, curinst, 1);
76
77 if (NOT editsw) {
78
79 if ((i = vce2grp[curvce]) > 0) {
80
81 for (j =0; j < 12; j++)
82 if (vce2grp[j] EQ i)
83 execins(j, curinst, 1);
84 }
85 }
86 }
87
88 objclr(TTCPRI);
89 idvlblc();
90 idcfsw = FALSE;
91 submenu = FALSE;
92
93 if (vtccol LT 35) {
94
95 allwins();
96
97 } else {
98
99 dswin(22);
100 dswin(19);
101 }
102/*
103
104*/
105 } else if (vtcrow EQ 23) { /* copy to library */
106
107 if (idintmp) {
108
109 memcpyw(&idefs[idintmp], &vbufs[curvce],
110 (sizeof (struct instdef) / 2));
111
112 curinst = idintmp;
113 instmod[curvce] = FALSE;
114 }
115
116 objclr(TTCPRI);
117 idvlblc();
118 idcfsw = FALSE;
119 submenu = FALSE;
120 dswin(22);
121 dswin(19);
122
123 if (idintmp EQ 0)
124 return(FAILURE);
125
126 } else
127 return(FAILURE);
128
129 return(SUCCESS);
130/*
131
132*/
133 } else { /* 'E' with menu not up */
134
135 ebuf[2] = '\0'; /* terminate the string in ebuf */
136 ebflag = FALSE;
137
138 tmpval = 0;
139
140 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
141 tmpval = (tmpval * 10) + (ebuf[i] - '0');
142
143 if (tmpval GE NINST) /* check the range */
144 return(FAILURE);
145
146 idintmp = tmpval; /* save selected value */
147 idcpfch(); /* put up copy/fetch menu */
148 dswin(22);
149 SetPri(TTCURS, TTCPRI);
150 ttcpos(22, 17);
151 idcfsw = TRUE;
152 submenu = TRUE;
153 return(SUCCESS);
154 }
155}
156
157/*
158
159*/
160
161/*
162 =============================================================================
163 rd_idin() -- (re)display the field
164 =============================================================================
165*/
166
167short
168rd_idin(n)
169short n;
170{
171 if (idcfsw) /* don't display if copy/fetch is up */
172 return(FAILURE);
173
174 /* convert to ASCII */
175
176 sprintf(dspbuf, "%02d", curinst);
177
178 vbank(0); /* display the value */
179
180 vcputsv(instob, 64, (instmod[curvce] ? ID_CHGD : idbox[n][4]),
181 idbox[n][5], idbox[n][6], idbox[n][7] + DIN_OFF, dspbuf, 14);
182
183 return(SUCCESS);
184}
185
186/*
187
188*/
189
190/*
191 =============================================================================
192 nd_idin() -- handle new data entry
193 =============================================================================
194*/
195
196short
197nd_idin(n, k)
198short n;
199register short k;
200{
201 register short ec, c;
202
203 ec = stccol - cfetp->flcol; /* setup edit buffer column */
204 ebuf[ec] = k + '0';
205 ebuf[2] = '\0';
206
207 dspbuf[0] = k + '0';
208 dspbuf[1] = '\0';
209
210 vbank(0);
211
212 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
213 idbox[n][6], stccol, dspbuf, 14);
214
215 advicur();
216
217 return(SUCCESS);
218}
219
Note: See TracBrowser for help on using the repository browser.