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