source: buchla-68k/ram/etidin.c@ 0c834c5

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

Point of no return.

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