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