[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | ettval.c -- MIDAS tuning editor -- value field handlers
|
---|
| 4 | Version 2 -- 1987-12-09 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "fields.h"
|
---|
| 10 | #include "vsdd.h"
|
---|
| 11 | #include "vsddsw.h"
|
---|
| 12 | #include "graphdef.h"
|
---|
| 13 | #include "charset.h"
|
---|
| 14 |
|
---|
| 15 | #include "midas.h"
|
---|
| 16 | #include "tundsp.h"
|
---|
| 17 |
|
---|
| 18 | extern unsigned *tunob;
|
---|
| 19 |
|
---|
| 20 | extern short stcrow, stccol, tunval, tunmod;
|
---|
| 21 |
|
---|
| 22 | extern short tdbox[][8];
|
---|
| 23 |
|
---|
| 24 | extern char dspbuf[];
|
---|
| 25 |
|
---|
| 26 | /* |
---|
| 27 |
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /*
|
---|
| 31 | =============================================================================
|
---|
| 32 | modtun() -- indicate that the tuning table was modified
|
---|
| 33 | =============================================================================
|
---|
| 34 | */
|
---|
[0580615] | 35 |
|
---|
[f40a309] | 36 | void modtun(void)
|
---|
| 37 | {
|
---|
| 38 | if (NOT tunmod) {
|
---|
| 39 |
|
---|
| 40 | tunmod = TRUE;
|
---|
| 41 | tdswin(6);
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | /* |
---|
| 46 |
|
---|
| 47 | */
|
---|
| 48 |
|
---|
| 49 | /*
|
---|
| 50 | =============================================================================
|
---|
| 51 | et_tval() -- load the edit buffer
|
---|
| 52 | =============================================================================
|
---|
[0580615] | 53 | */
|
---|
[f40a309] | 54 |
|
---|
| 55 | short et_tval(short n)
|
---|
| 56 | {
|
---|
| 57 | register short tv;
|
---|
| 58 | register char ts;
|
---|
| 59 |
|
---|
| 60 | tv = (tunval < 0 ? -tunval : tunval) >> 1;
|
---|
| 61 | ts = tunval < 0 ? '-' : '+';
|
---|
| 62 |
|
---|
| 63 | sprintf(ebuf, "%c%04d", ts, tv);
|
---|
| 64 | ebflag = TRUE;
|
---|
| 65 |
|
---|
| 66 | return(SUCCESS);
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | /* |
---|
| 70 |
|
---|
| 71 | */
|
---|
| 72 |
|
---|
| 73 | /*
|
---|
| 74 | =============================================================================
|
---|
| 75 | ef_tval() -- parse (unload) the edit buffer
|
---|
[0580615] | 76 | =============================================================================
|
---|
[f40a309] | 77 | */
|
---|
| 78 |
|
---|
| 79 | short ef_tval(short n)
|
---|
| 80 | {
|
---|
| 81 | register short *ov;
|
---|
| 82 | register short i, tmpval, tv;
|
---|
| 83 | register char ts;
|
---|
| 84 |
|
---|
| 85 | ebuf[5] = '\0'; /* terminate the string in ebuf */
|
---|
| 86 | ebflag = FALSE;
|
---|
| 87 |
|
---|
| 88 | tmpval = 0;
|
---|
| 89 |
|
---|
| 90 | for (i = 1; i < 5; i++) /* convert from ASCII to binary */
|
---|
| 91 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 92 |
|
---|
| 93 | if (ebuf[0] EQ '-')
|
---|
| 94 | tunval = -tmpval << 1;
|
---|
| 95 | else
|
---|
| 96 | tunval = tmpval << 1;
|
---|
| 97 |
|
---|
| 98 | tv = (tunval < 0 ? -tunval : tunval) >> 1;
|
---|
| 99 | ts = tunval < 0 ? '-' : '+';
|
---|
| 100 | sprintf(dspbuf, "Val %c%04d", ts, tv);
|
---|
| 101 |
|
---|
| 102 | vbank(0);
|
---|
| 103 | vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
|
---|
| 104 |
|
---|
| 105 | modtun();
|
---|
| 106 | return(SUCCESS);
|
---|
| 107 | }
|
---|
| 108 |
|
---|
| 109 | /* |
---|
| 110 |
|
---|
| 111 | */
|
---|
| 112 |
|
---|
| 113 | /*
|
---|
| 114 | =============================================================================
|
---|
[0580615] | 115 | rd_tval() -- (re)display the field
|
---|
[f40a309] | 116 | =============================================================================
|
---|
| 117 | */
|
---|
| 118 |
|
---|
| 119 | short rd_tval(short nn)
|
---|
| 120 | {
|
---|
| 121 | register short tv, n;
|
---|
| 122 | register char ts;
|
---|
| 123 |
|
---|
| 124 | n = nn & 0xFF;
|
---|
| 125 |
|
---|
| 126 | tv = (tunval < 0 ? -tunval : tunval) >> 1;
|
---|
| 127 | ts = tunval < 0 ? '-' : '+';
|
---|
| 128 |
|
---|
| 129 | sprintf(dspbuf, "Val %c%04d", ts, tv);
|
---|
| 130 |
|
---|
| 131 | vbank(0);
|
---|
| 132 | vcputsv(tunob, 64, tdbox[n][4], tdbox[n][5], 18, 54, dspbuf, 14);
|
---|
| 133 | return(SUCCESS);
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | /* |
---|
| 137 |
|
---|
| 138 | */
|
---|
| 139 |
|
---|
| 140 | /*
|
---|
[0580615] | 141 | =============================================================================
|
---|
[f40a309] | 142 | nd_tval() -- handle new data entry
|
---|
| 143 | =============================================================================
|
---|
| 144 | */
|
---|
| 145 |
|
---|
| 146 | short nd_tval(short nn, short k)
|
---|
| 147 | {
|
---|
| 148 | register short ec, n;
|
---|
| 149 |
|
---|
| 150 | n = nn & 0xFF;
|
---|
| 151 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 152 |
|
---|
| 153 | if (ec EQ 0) {
|
---|
| 154 |
|
---|
| 155 | if (k EQ 8) {
|
---|
| 156 |
|
---|
| 157 | ebuf[0] = '-';
|
---|
| 158 | ebuf[5] = '\0';
|
---|
| 159 |
|
---|
| 160 | dspbuf[0] = '-';
|
---|
| 161 | dspbuf[1] = '\0';
|
---|
| 162 |
|
---|
| 163 | } else if (k EQ 9) {
|
---|
| 164 |
|
---|
| 165 | ebuf[0] = '+';
|
---|
| 166 | ebuf[5] = '\0';
|
---|
| 167 |
|
---|
| 168 | dspbuf[0] = '+';
|
---|
| 169 | dspbuf[1] = '\0';
|
---|
| 170 |
|
---|
| 171 | } else {
|
---|
| 172 |
|
---|
| 173 | return(FAILURE);
|
---|
| 174 | }
|
---|
| 175 | /* |
---|
| 176 |
|
---|
| 177 | */
|
---|
| 178 | } else {
|
---|
| 179 |
|
---|
| 180 | ebuf[ec] = k + '0';
|
---|
| 181 | ebuf[5] = '\0';
|
---|
| 182 |
|
---|
| 183 | dspbuf[0] = k + '0';
|
---|
| 184 | dspbuf[1] = '\0';
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | vbank(0);
|
---|
| 188 | vcputsv(tunob, 64, TDENTRY, tdbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
| 189 |
|
---|
| 190 | advtcur();
|
---|
| 191 | return(SUCCESS);
|
---|
| 192 | }
|
---|
| 193 |
|
---|