[3ae31e9] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etavgr.c -- assignment editor - voice to group field handlers
|
---|
| 4 | Version 9 -- 1988-03-18 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define DEBUGIT 0
|
---|
| 9 |
|
---|
| 10 | #include "stddefs.h"
|
---|
| 11 | #include "fields.h"
|
---|
| 12 | #include "vsdd.h"
|
---|
| 13 | #include "vsddsw.h"
|
---|
| 14 | #include "graphdef.h"
|
---|
| 15 |
|
---|
| 16 | #include "midas.h"
|
---|
| 17 | #include "asgdsp.h"
|
---|
| 18 |
|
---|
| 19 | #if DEBUGIT
|
---|
| 20 | extern short debugsw;
|
---|
| 21 | #endif
|
---|
| 22 |
|
---|
| 23 | extern char *numblk();
|
---|
| 24 |
|
---|
| 25 | extern unsigned *asgob;
|
---|
| 26 |
|
---|
| 27 | extern short stcrow, stccol;
|
---|
| 28 |
|
---|
| 29 | extern short adbox[][8];
|
---|
| 30 |
|
---|
| 31 | extern char dspbuf[];
|
---|
| 32 |
|
---|
| 33 | extern short vce2grp[12]; /* voice to group table */
|
---|
| 34 | extern short ins2grp[12];
|
---|
| 35 |
|
---|
| 36 | /* |
---|
| 37 |
|
---|
| 38 | */
|
---|
| 39 |
|
---|
| 40 | /*
|
---|
| 41 | =============================================================================
|
---|
| 42 | et_avgr() -- load the edit buffer
|
---|
| 43 | =============================================================================
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | short
|
---|
| 47 | et_avgr(nn)
|
---|
| 48 | short nn;
|
---|
| 49 | {
|
---|
| 50 | register short grp;
|
---|
| 51 | char buf[4];
|
---|
| 52 |
|
---|
| 53 | grp = 0x00FF & (nn >> 8);
|
---|
| 54 |
|
---|
| 55 | sprintf(ebuf, "%s", numblk(buf, vce2grp[grp]));
|
---|
| 56 | ebflag = TRUE;
|
---|
| 57 |
|
---|
| 58 | #if DEBUGIT
|
---|
| 59 | if (debugsw)
|
---|
| 60 | printf("et_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
|
---|
| 61 | #endif
|
---|
| 62 |
|
---|
| 63 | return(SUCCESS);
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | /* |
---|
| 67 |
|
---|
| 68 | */
|
---|
| 69 |
|
---|
| 70 | /*
|
---|
| 71 | =============================================================================
|
---|
| 72 | ef_avgr() -- parse (unload) the edit buffer
|
---|
| 73 | =============================================================================
|
---|
| 74 | */
|
---|
| 75 |
|
---|
| 76 | short
|
---|
| 77 | ef_avgr(nn)
|
---|
| 78 | short nn;
|
---|
| 79 | {
|
---|
| 80 | register short tmpval, vce, i;
|
---|
| 81 |
|
---|
| 82 | vce = 0x00FF & (nn >> 8);
|
---|
| 83 |
|
---|
| 84 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 85 | ebflag = FALSE;
|
---|
| 86 | tmpval = 0;
|
---|
| 87 |
|
---|
| 88 | #if DEBUGIT
|
---|
| 89 | if (debugsw)
|
---|
| 90 | printf("ef_avgr($%04.4X): ebuf=[%s]\n", nn, ebuf);
|
---|
| 91 | #endif
|
---|
| 92 |
|
---|
| 93 | if ((ebuf[0] EQ ' ') AND (ebuf[1] EQ ' ')) {
|
---|
| 94 |
|
---|
| 95 | tmpval = -1;
|
---|
| 96 |
|
---|
| 97 | } else {
|
---|
| 98 |
|
---|
| 99 | for (i = 0; i < 2; i++) {
|
---|
| 100 |
|
---|
| 101 | if (ebuf[i] EQ ' ')
|
---|
| 102 | ebuf[i] = '0';
|
---|
| 103 |
|
---|
| 104 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | if ((tmpval EQ 0) OR (tmpval GT 12))
|
---|
| 108 | return(FAILURE);
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | vce2grp[vce] = tmpval;
|
---|
| 112 |
|
---|
| 113 | if (tmpval > 0)
|
---|
| 114 | execinst(vce, (ins2grp[tmpval - 1] & 0x00FF), 1);
|
---|
| 115 |
|
---|
| 116 | modasg();
|
---|
| 117 | return(SUCCESS);
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | /* |
---|
| 121 |
|
---|
| 122 | */
|
---|
| 123 |
|
---|
| 124 | /*
|
---|
| 125 | =============================================================================
|
---|
| 126 | rd_avgr() -- (re)display the field
|
---|
| 127 | =============================================================================
|
---|
| 128 | */
|
---|
| 129 |
|
---|
| 130 | short
|
---|
| 131 | rd_avgr(nn)
|
---|
| 132 | short nn;
|
---|
| 133 | {
|
---|
| 134 | register short n, grp;
|
---|
| 135 | char buf[4];
|
---|
| 136 |
|
---|
| 137 | n = 0x00FF & nn;
|
---|
| 138 | grp = 0x00FF & (nn >> 8);
|
---|
| 139 |
|
---|
| 140 | vbank(0);
|
---|
| 141 | vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
|
---|
| 142 | cfetp->frow, cfetp->flcol, numblk(buf, vce2grp[grp]), 14);
|
---|
| 143 |
|
---|
| 144 | return(SUCCESS);
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | /* |
---|
| 148 |
|
---|
| 149 | */
|
---|
| 150 |
|
---|
| 151 | /*
|
---|
| 152 | =============================================================================
|
---|
| 153 | nd_avgr() -- handle new data entry
|
---|
| 154 | =============================================================================
|
---|
| 155 | */
|
---|
| 156 |
|
---|
| 157 | short
|
---|
| 158 | nd_avgr(nn, k)
|
---|
| 159 | short nn;
|
---|
| 160 | register short k;
|
---|
| 161 | {
|
---|
| 162 | register short n, col;
|
---|
| 163 |
|
---|
| 164 | n = nn & 0xFF;
|
---|
| 165 | col = stccol - cfetp->flcol;
|
---|
| 166 |
|
---|
| 167 | ebuf[col] = k + '0';
|
---|
| 168 | ebuf[2] = '\0';
|
---|
| 169 |
|
---|
| 170 | #if DEBUGIT
|
---|
| 171 | if (debugsw)
|
---|
| 172 | printf("nd_avgr($%04.4X, %d): cfetp=$%08.8lX, col=%d, ebuf=[%s]\n",
|
---|
| 173 | nn, k, cfetp, col, ebuf);
|
---|
| 174 | #endif
|
---|
| 175 |
|
---|
| 176 | dspbuf[0] = k + '0';
|
---|
| 177 | dspbuf[1] = '\0';
|
---|
| 178 |
|
---|
| 179 | vbank(0);
|
---|
| 180 | vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
|
---|
| 181 |
|
---|
| 182 | advacur();
|
---|
| 183 | return(SUCCESS);
|
---|
| 184 | }
|
---|
| 185 |
|
---|