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