source: buchla-68k/ram/sqread.c@ bc11fc1

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

Use standard integer types.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 =============================================================================
3 sqread.c -- librarian - read sequence functions
4 Version 2 -- 1988-11-17 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "graphdef.h"
9#include "stddefs.h"
10#include "stdio.h"
11#include "patch.h"
12#include "vsdd.h"
13
14#include "midas.h"
15#include "libdsp.h"
16
17extern int16_t errno; /* system error number */
18
19
20/*
21 =============================================================================
22 sqioerr() -- put up an I/O error message
23 =============================================================================
24*/
25
26void sqioerr(void)
27{
28 int8_t erms[40];
29
30 clrlsel();
31
32 sprintf(erms, " errno = %d", errno);
33
34 ldermsg("Couldn't read", " the sequence table", erms,
35 LD_EMCF, LD_EMCB);
36}
37
38/*
39
40*/
41
42/*
43 =============================================================================
44 sqread() -- read a sequence
45 =============================================================================
46*/
47
48int16_t sqread(FILE *fp)
49{
50 int8_t cb;
51 int16_t seq;
52
53 ldwmsg(" Busy -- please stand by", (int8_t *)NULL, " Reading sequences",
54 LCFBX10, LCBBX10);
55
56 for (;;) {
57
58 if (rd_ec(fp, &cb, 1L)) { /* get control byte */
59
60 sqioerr();
61 return(FAILURE);
62 }
63
64 if (0 EQ cb) /* zero control byte is end */
65 return(SUCCESS);
66
67 if (rd_ec(fp, &seq, 2L)) { /* get Line number */
68
69 sqioerr();
70 return(FAILURE);
71 }
72
73 if (cb & 0x08) { /* get Time */
74
75 if (rd_ec(fp, &seqtab[seq].seqtime, 2L)) {
76
77 sqioerr();
78 return(FAILURE);
79 }
80 }
81/*
82
83*/
84 if (cb & 0x04) { /* get Action 1 */
85
86 if (rd_ec(fp, &seqtab[seq].seqact1, 4L)) {
87
88 sqioerr();
89 return(FAILURE);
90 }
91 }
92
93 if (cb & 0x02) { /* get Action 2 */
94
95 if (rd_ec(fp, &seqtab[seq].seqact2, 4L)) {
96
97 sqioerr();
98 return(FAILURE);
99 }
100 }
101
102 if (cb & 0x01) { /* get Action 3 */
103
104 if (rd_ec(fp, &seqtab[seq].seqact3, 4L)) {
105
106 sqioerr();
107 return(FAILURE);
108 }
109 }
110 }
111}
Note: See TracBrowser for help on using the repository browser.