[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etipnt.c -- instrument editor - point number field handlers
|
---|
| 4 | Version 15 -- 1988-01-13 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define DEBUGIT 0
|
---|
| 9 |
|
---|
[b28a12e] | 10 | #include "ram.h"
|
---|
[f40a309] | 11 |
|
---|
| 12 | /*
|
---|
| 13 | =============================================================================
|
---|
| 14 | et_ipnt() -- load the edit buffer
|
---|
| 15 | =============================================================================
|
---|
| 16 | */
|
---|
| 17 |
|
---|
[7258c6a] | 18 | int16_t et_ipnt(int16_t n)
|
---|
[f40a309] | 19 | {
|
---|
| 20 | sprintf(ebuf, "%02d", subj);
|
---|
| 21 | ebflag = TRUE;
|
---|
| 22 |
|
---|
| 23 | return(SUCCESS);
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | /*
|
---|
| 27 | =============================================================================
|
---|
| 28 | ef_ipnt() -- parse (unload) the edit buffer
|
---|
| 29 | =============================================================================
|
---|
| 30 | */
|
---|
| 31 |
|
---|
[7258c6a] | 32 | int16_t ef_ipnt(int16_t n)
|
---|
[f40a309] | 33 | {
|
---|
[7258c6a] | 34 | register int16_t i, tmpval, endpnt, basept;
|
---|
[f40a309] | 35 | register struct idfnhdr *fp;
|
---|
| 36 | register struct instdef *ip;
|
---|
| 37 |
|
---|
| 38 | ip = &vbufs[curvce]; /* set instrument pointer */
|
---|
| 39 | fp = &ip->idhfnc[curfunc]; /* set function pointer */
|
---|
| 40 |
|
---|
| 41 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 42 | ebflag = FALSE;
|
---|
| 43 |
|
---|
| 44 | tmpval = 0;
|
---|
| 45 |
|
---|
| 46 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 47 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 48 |
|
---|
| 49 | basept = fp->idfpt1;
|
---|
| 50 | endpnt = fp->idfpt1 + fp->idfpif - 1; /* calculate last point */
|
---|
| 51 | #if DEBUGIT
|
---|
| 52 | printf("ef_ipnt(): subj=%d, basept=%d, tmpval=%d, endpnt=%d, idpif=%d\r\n",
|
---|
| 53 | subj, basept, tmpval, endpnt, fp->idfpif);
|
---|
| 54 | #endif
|
---|
| 55 | if (tmpval GE fp->idfpif) { /* see if we want a new point */
|
---|
| 56 |
|
---|
| 57 | if (fp->idfpif EQ 100) { /* can't do it if we're full */
|
---|
| 58 |
|
---|
| 59 | showpt(1);
|
---|
| 60 | return(FAILURE);
|
---|
| 61 | }
|
---|
| 62 | #if DEBUGIT
|
---|
| 63 | printf("ef_ipnt(): NEW POINT REQUESTED\r\n");
|
---|
| 64 | #endif
|
---|
| 65 | if (FALSE EQ inspnt(ip, curfunc, endpnt)) { /* try to add it */
|
---|
| 66 | #if DEBUGIT
|
---|
| 67 | printf("ef_ipnt(): inspnt() returned FALSE -- no point allocated\r\n");
|
---|
| 68 | #endif
|
---|
| 69 | showpt(1);
|
---|
| 70 | return(FAILURE);
|
---|
| 71 |
|
---|
| 72 | } else {
|
---|
| 73 |
|
---|
| 74 | subj = fp->idfpif - 1; /* make it the current point */
|
---|
| 75 | pntsel();
|
---|
| 76 | memset(pntptr, 0, sizeof (struct instpnt));
|
---|
| 77 | pntptr->ipval = (pntptr - 1)->ipval;
|
---|
| 78 | setseg(subj, timeto(curfunc, subj - 1) + 1);
|
---|
| 79 | showpt(1);
|
---|
| 80 | #if DEBUGIT
|
---|
| 81 | printf("ef_ipnt(): NEW POINT SELECTED curpnt=%d, subj=%d, idpif=%d\r\n",
|
---|
| 82 | curpnt, subj, fp->idfpif);
|
---|
| 83 | #endif
|
---|
| 84 | modinst();
|
---|
| 85 | return(SUCCESS);
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | } else { /* old point requested */
|
---|
| 89 | #if DEBUGIT
|
---|
| 90 | printf("ef_ipnt(): OLD POINT REQUESTED\r\n");
|
---|
| 91 | #endif
|
---|
| 92 | if ((tmpval + basept) > endpnt) /* check range */
|
---|
| 93 | return(FAILURE);
|
---|
| 94 |
|
---|
| 95 | subj = tmpval; /* make it current */
|
---|
| 96 | pntsel();
|
---|
| 97 | showpt(1);
|
---|
| 98 | #if DEBUGIT
|
---|
| 99 | printf("ef_ipnt(): OLD POINT SELECTED curpnt=%d, subj=%d\r\n",
|
---|
| 100 | curpnt, subj);
|
---|
| 101 | #endif
|
---|
| 102 | return(SUCCESS);
|
---|
| 103 | }
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | /*
|
---|
| 107 | =============================================================================
|
---|
| 108 | rd_ipnt() -- (re)display the point number
|
---|
| 109 | =============================================================================
|
---|
| 110 | */
|
---|
| 111 |
|
---|
[7258c6a] | 112 | int16_t rd_ipnt(int16_t n)
|
---|
[f40a309] | 113 | {
|
---|
| 114 | sprintf(dspbuf, "%02d", subj); /* convert to ASCII */
|
---|
| 115 |
|
---|
| 116 | vbank(0); /* display the value */
|
---|
| 117 |
|
---|
| 118 | vcputsv(instob, 64, idbox[n][4], idbox[n][5],
|
---|
| 119 | idbox[n][6] + 1, idbox[n][7], dspbuf, 14);
|
---|
| 120 |
|
---|
| 121 | return(SUCCESS);
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | /*
|
---|
| 125 | =============================================================================
|
---|
| 126 | nd_ipnt() -- handle new data entry
|
---|
| 127 | =============================================================================
|
---|
| 128 | */
|
---|
| 129 |
|
---|
[7258c6a] | 130 | int16_t nd_ipnt(int16_t n, int16_t k)
|
---|
[f40a309] | 131 | {
|
---|
[7258c6a] | 132 | register int16_t ec;
|
---|
[f40a309] | 133 |
|
---|
| 134 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 135 | ebuf[ec] = k + '0';
|
---|
| 136 | ebuf[2] = '\0';
|
---|
| 137 |
|
---|
| 138 | dspbuf[0] = k + '0';
|
---|
| 139 | dspbuf[1] = '\0';
|
---|
| 140 |
|
---|
| 141 | vbank(0);
|
---|
| 142 |
|
---|
| 143 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
| 144 | idbox[n][6] + 1, stccol, dspbuf, 14);
|
---|
| 145 |
|
---|
| 146 | advicur();
|
---|
| 147 |
|
---|
| 148 | return(SUCCESS);
|
---|
| 149 | }
|
---|
[6262b5c] | 150 |
|
---|