source: buchla-68k/ram/etipnt.c@ b28a12e

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

Zero redundant declarations.

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