[f40a309] | 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 |
|
---|
[7258c6a] | 20 | extern uint16_t *instob;
|
---|
[f40a309] | 21 |
|
---|
[7258c6a] | 22 | extern int16_t vtcrow, vtccol, stccol, curinst, curvce, idcfsw, idintmp;
|
---|
| 23 | extern int16_t editsw, curfunc, submenu;
|
---|
[f40a309] | 24 |
|
---|
[7258c6a] | 25 | extern int16_t idbox[][8];
|
---|
| 26 | extern int16_t instmod[];
|
---|
| 27 | extern int16_t vce2grp[];
|
---|
[f40a309] | 28 |
|
---|
[7258c6a] | 29 | extern int8_t dspbuf[];
|
---|
[f40a309] | 30 |
|
---|
| 31 | extern struct instdef idefs[];
|
---|
| 32 | extern struct instdef vbufs[];
|
---|
| 33 |
|
---|
| 34 | /* |
---|
| 35 |
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | /*
|
---|
| 39 | =============================================================================
|
---|
| 40 | et_idin() -- load the edit buffer
|
---|
| 41 | =============================================================================
|
---|
| 42 | */
|
---|
[7258c6a] | 43 |
|
---|
[f40a309] | 44 | int16_t et_idin(int16_t 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 | */
|
---|
[7258c6a] | 58 |
|
---|
[f40a309] | 59 | int16_t ef_idin(int16_t n)
|
---|
[7258c6a] | 60 | {
|
---|
[f40a309] | 61 | register int16_t 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 | }
|
---|
[9519422] | 98 | /* |
---|
[f40a309] | 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 | /* |
---|
[9519422] | 127 |
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 159 | rd_idin() -- (re)display the field
|
---|
[f40a309] | 160 | =============================================================================
|
---|
| 161 | */
|
---|
| 162 |
|
---|
| 163 | int16_t rd_idin(int16_t 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 | /*
|
---|
[7258c6a] | 185 | =============================================================================
|
---|
[f40a309] | 186 | nd_idin() -- handle new data entry
|
---|
[7258c6a] | 187 | =============================================================================
|
---|
[f40a309] | 188 | */
|
---|
| 189 |
|
---|
| 190 | int16_t nd_idin(int16_t n, int16_t k)
|
---|
| 191 | {
|
---|
| 192 | register int16_t 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 |
|
---|