| 1 | /*
 | 
|---|
| 2 |    =============================================================================
 | 
|---|
| 3 |         etagpt.c -- assignment editor - group to input port field handlers
 | 
|---|
| 4 |         Version 5 -- 198-10-04 -- 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 | 
 | 
|---|
| 14 | #include "midas.h"
 | 
|---|
| 15 | #include "asgdsp.h"
 | 
|---|
| 16 | 
 | 
|---|
| 17 | extern  char    *numblk();
 | 
|---|
| 18 | 
 | 
|---|
| 19 | extern  unsigned        *asgob;
 | 
|---|
| 20 | 
 | 
|---|
| 21 | extern  short   stcrow, stccol;
 | 
|---|
| 22 | 
 | 
|---|
| 23 | extern  char    dspbuf[];
 | 
|---|
| 24 | extern  char    *gprep[];
 | 
|---|
| 25 | 
 | 
|---|
| 26 | extern  short   key2grp[];
 | 
|---|
| 27 | 
 | 
|---|
| 28 | extern  short   adbox[][8];
 | 
|---|
| 29 | 
 | 
|---|
| 30 | extern  short   grp2prt[12][2]; /* group to port and channel table */
 | 
|---|
| 31 |                                 /* port [0] = 0..3, channel [1] = -1, 1..16 */
 | 
|---|
| 32 | 
 | 
|---|
| 33 | /*  | 
|---|
| 34 | 
 | 
|---|
| 35 | */
 | 
|---|
| 36 | 
 | 
|---|
| 37 | /*
 | 
|---|
| 38 |    =============================================================================
 | 
|---|
| 39 |         et_agpt() -- load the edit buffer
 | 
|---|
| 40 |    =============================================================================
 | 
|---|
| 41 | */
 | 
|---|
| 42 | 
 | 
|---|
| 43 | short
 | 
|---|
| 44 | et_agpt(n)
 | 
|---|
| 45 | short n;
 | 
|---|
| 46 | {
 | 
|---|
| 47 |         register short grp;
 | 
|---|
| 48 | 
 | 
|---|
| 49 |         grp = 0x00FF & (n >> 8);
 | 
|---|
| 50 | 
 | 
|---|
| 51 |         ebuf[0] = grp2prt[grp][0];
 | 
|---|
| 52 |         ebuf[1] = '\0';
 | 
|---|
| 53 | 
 | 
|---|
| 54 |         ebflag = TRUE;
 | 
|---|
| 55 | 
 | 
|---|
| 56 |         return(SUCCESS);
 | 
|---|
| 57 | }
 | 
|---|
| 58 | 
 | 
|---|
| 59 | /*
 | 
|---|
| 60 |    =============================================================================
 | 
|---|
| 61 |         ef_agpt() -- parse (unload) the edit buffer
 | 
|---|
| 62 |    =============================================================================
 | 
|---|
| 63 | */
 | 
|---|
| 64 | 
 | 
|---|
| 65 | short
 | 
|---|
| 66 | ef_agpt(n)
 | 
|---|
| 67 | short n;
 | 
|---|
| 68 | {
 | 
|---|
| 69 |         register short tmpval, grp, i;
 | 
|---|
| 70 | 
 | 
|---|
| 71 |         grp = 0x00FF & (n >> 8);
 | 
|---|
| 72 | 
 | 
|---|
| 73 |         ebuf[1] = '\0';                 /* terminate the string in ebuf */
 | 
|---|
| 74 |         ebflag = FALSE;
 | 
|---|
| 75 | 
 | 
|---|
| 76 |         grp2prt[grp][0] = ebuf[0];
 | 
|---|
| 77 | 
 | 
|---|
| 78 |         if (grp2prt[grp][0] NE 1)
 | 
|---|
| 79 |                 for (i = 0; i < 88; i++)
 | 
|---|
| 80 |                         key2grp[i] &= ~(0x0001 << grp);
 | 
|---|
| 81 | 
 | 
|---|
| 82 |         drawk2g(grp);
 | 
|---|
| 83 | 
 | 
|---|
| 84 |         modasg();
 | 
|---|
| 85 |         return(SUCCESS);
 | 
|---|
| 86 | }
 | 
|---|
| 87 | 
 | 
|---|
| 88 | /*  | 
|---|
| 89 | 
 | 
|---|
| 90 | */
 | 
|---|
| 91 | 
 | 
|---|
| 92 | /*
 | 
|---|
| 93 |    =============================================================================
 | 
|---|
| 94 |         rd_agpt() -- (re)display the field
 | 
|---|
| 95 |    =============================================================================
 | 
|---|
| 96 | */
 | 
|---|
| 97 | 
 | 
|---|
| 98 | short
 | 
|---|
| 99 | rd_agpt(nn)
 | 
|---|
| 100 | short nn;
 | 
|---|
| 101 | {
 | 
|---|
| 102 |         register short n, grp;
 | 
|---|
| 103 | 
 | 
|---|
| 104 |         n   = 0x00FF & nn;
 | 
|---|
| 105 |         grp = 0x00FF & (nn >> 8);
 | 
|---|
| 106 | 
 | 
|---|
| 107 |         vbank(0);
 | 
|---|
| 108 |         vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
 | 
|---|
| 109 |                 cfetp->frow, cfetp->flcol, gprep[grp2prt[grp][0]], 14);
 | 
|---|
| 110 | 
 | 
|---|
| 111 |         return(SUCCESS);
 | 
|---|
| 112 | }
 | 
|---|
| 113 | 
 | 
|---|
| 114 | /*
 | 
|---|
| 115 |    =============================================================================
 | 
|---|
| 116 |         nd_agpt() -- handle new data entry
 | 
|---|
| 117 |    =============================================================================
 | 
|---|
| 118 | */
 | 
|---|
| 119 | 
 | 
|---|
| 120 | short
 | 
|---|
| 121 | nd_agpt(nn, k)
 | 
|---|
| 122 | short nn;
 | 
|---|
| 123 | register short  k;
 | 
|---|
| 124 | {
 | 
|---|
| 125 |         register short n;
 | 
|---|
| 126 | 
 | 
|---|
| 127 |         n = nn & 0x00FF;
 | 
|---|
| 128 | 
 | 
|---|
| 129 |         if (k EQ 8) {           /* '-' */
 | 
|---|
| 130 | 
 | 
|---|
| 131 |                 if (--ebuf[0] LT 0)
 | 
|---|
| 132 |                         ebuf[0] = 3;
 | 
|---|
| 133 | 
 | 
|---|
| 134 |         } else if (k EQ 9) {    /* '+' */
 | 
|---|
| 135 | 
 | 
|---|
| 136 |                 if (++ebuf[0] GT 3)
 | 
|---|
| 137 |                         ebuf[0] = 0;
 | 
|---|
| 138 | 
 | 
|---|
| 139 |         } else {
 | 
|---|
| 140 | 
 | 
|---|
| 141 |                 return(FAILURE);
 | 
|---|
| 142 |         }
 | 
|---|
| 143 | 
 | 
|---|
| 144 |         dspbuf[0] = *gprep[ebuf[0]];
 | 
|---|
| 145 |         dspbuf[1] = '\0';
 | 
|---|
| 146 | 
 | 
|---|
| 147 |         vbank(0);
 | 
|---|
| 148 |         vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
 | 
|---|
| 149 | 
 | 
|---|
| 150 |         return(SUCCESS);
 | 
|---|
| 151 | }
 | 
|---|
| 152 | 
 | 
|---|