source: buchla-68k/orig/RAM/ETIPNT.C@ 66b48e7

Last change on this file since 66b48e7 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 4.2 KB
Line 
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
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 "instdsp.h"
18
19extern short advicur(), pntsel(), showpt(), timeto(), setseg();
20
21extern unsigned *instob;
22
23extern short stccol, subj, curvce, curfunc, curpnt;
24
25extern short idbox[][8];
26
27extern char dspbuf[];
28
29extern struct instdef vbufs[];
30
31extern struct instpnt *pntptr;
32
33/*
34
35*/
36
37/*
38 =============================================================================
39 et_ipnt() -- load the edit buffer
40 =============================================================================
41*/
42
43short
44et_ipnt(n)
45short n;
46{
47 sprintf(ebuf, "%02d", subj);
48 ebflag = TRUE;
49
50 return(SUCCESS);
51}
52
53/*
54
55*/
56
57/*
58 =============================================================================
59 ef_ipnt() -- parse (unload) the edit buffer
60 =============================================================================
61*/
62
63short
64ef_ipnt(n)
65short n;
66{
67 register short i, tmpval, endpnt, basept;
68 register struct idfnhdr *fp;
69 register struct instdef *ip;
70
71 ip = &vbufs[curvce]; /* set instrument pointer */
72 fp = &ip->idhfnc[curfunc]; /* set function pointer */
73
74 ebuf[2] = '\0'; /* terminate the string in ebuf */
75 ebflag = FALSE;
76
77 tmpval = 0;
78
79 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
80 tmpval = (tmpval * 10) + (ebuf[i] - '0');
81
82 basept = fp->idfpt1;
83 endpnt = fp->idfpt1 + fp->idfpif - 1; /* calculate last point */
84#if DEBUGIT
85 printf("ef_ipnt(): subj=%d, basept=%d, tmpval=%d, endpnt=%d, idpif=%d\r\n",
86 subj, basept, tmpval, endpnt, fp->idfpif);
87#endif
88 if (tmpval GE fp->idfpif) { /* see if we want a new point */
89
90 if (fp->idfpif EQ 100) { /* can't do it if we're full */
91
92 showpt(1);
93 return(FAILURE);
94 }
95#if DEBUGIT
96 printf("ef_ipnt(): NEW POINT REQUESTED\r\n");
97#endif
98 if (FALSE EQ inspnt(ip, curfunc, endpnt)) { /* try to add it */
99#if DEBUGIT
100 printf("ef_ipnt(): inspnt() returned FALSE -- no point allocated\r\n");
101#endif
102 showpt(1);
103 return(FAILURE);
104
105 } else {
106
107 subj = fp->idfpif - 1; /* make it the current point */
108 pntsel();
109 memset(pntptr, 0, sizeof (struct instpnt));
110 pntptr->ipval = (pntptr - 1)->ipval;
111 setseg(subj, timeto(curfunc, subj - 1) + 1);
112 showpt(1);
113#if DEBUGIT
114 printf("ef_ipnt(): NEW POINT SELECTED curpnt=%d, subj=%d, idpif=%d\r\n",
115 curpnt, subj, fp->idfpif);
116#endif
117 modinst();
118 return(SUCCESS);
119 }
120
121 } else { /* old point requested */
122#if DEBUGIT
123 printf("ef_ipnt(): OLD POINT REQUESTED\r\n");
124#endif
125 if ((tmpval + basept) > endpnt) /* check range */
126 return(FAILURE);
127
128 subj = tmpval; /* make it current */
129 pntsel();
130 showpt(1);
131#if DEBUGIT
132 printf("ef_ipnt(): OLD POINT SELECTED curpnt=%d, subj=%d\r\n",
133 curpnt, subj);
134#endif
135 return(SUCCESS);
136 }
137}
138
139/*
140
141*/
142
143/*
144 =============================================================================
145 rd_ipnt() -- (re)display the point number
146 =============================================================================
147*/
148
149short
150rd_ipnt(n)
151short n;
152{
153 sprintf(dspbuf, "%02d", subj); /* convert to ASCII */
154
155 vbank(0); /* display the value */
156
157 vcputsv(instob, 64, idbox[n][4], idbox[n][5],
158 idbox[n][6] + 1, idbox[n][7], dspbuf, 14);
159
160 return(SUCCESS);
161}
162
163/*
164
165*/
166
167/*
168 =============================================================================
169 nd_ipnt() -- handle new data entry
170 =============================================================================
171*/
172
173short
174nd_ipnt(n, k)
175short n;
176register short k;
177{
178 register short ec;
179
180 ec = stccol - cfetp->flcol; /* setup edit buffer column */
181 ebuf[ec] = k + '0';
182 ebuf[2] = '\0';
183
184 dspbuf[0] = k + '0';
185 dspbuf[1] = '\0';
186
187 vbank(0);
188
189 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
190 idbox[n][6] + 1, stccol, dspbuf, 14);
191
192 advicur();
193
194 return(SUCCESS);
195}
Note: See TracBrowser for help on using the repository browser.