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