[f40a309] | 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 |
|
---|
[e225e77] | 17 | extern int16_t rd_ec(FILE *fp, int8_t *to, int32_t len);
|
---|
| 18 | extern void clrlsel(void);
|
---|
| 19 | extern void ldermsg(int8_t *p1, int8_t *p2, int8_t *p3, uint16_t p4, uint16_t p5);
|
---|
| 20 | extern void ldwmsg(int8_t *line1, int8_t *line2, int8_t *line3, uint16_t fgcolor, uint16_t bgcolor);
|
---|
| 21 |
|
---|
[7258c6a] | 22 | extern int16_t errno; /* system error number */
|
---|
[f40a309] | 23 |
|
---|
| 24 |
|
---|
| 25 | /*
|
---|
| 26 | =============================================================================
|
---|
| 27 | sqioerr() -- put up an I/O error message
|
---|
| 28 | =============================================================================
|
---|
| 29 | */
|
---|
| 30 |
|
---|
[0580615] | 31 | void sqioerr(void)
|
---|
[f40a309] | 32 | {
|
---|
[7258c6a] | 33 | int8_t erms[40];
|
---|
[f40a309] | 34 |
|
---|
| 35 | clrlsel();
|
---|
| 36 |
|
---|
| 37 | sprintf(erms, " errno = %d", errno);
|
---|
| 38 |
|
---|
| 39 | ldermsg("Couldn't read", " the sequence table", erms,
|
---|
| 40 | LD_EMCF, LD_EMCB);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | /* |
---|
| 44 |
|
---|
| 45 | */
|
---|
| 46 |
|
---|
| 47 | /*
|
---|
| 48 | =============================================================================
|
---|
| 49 | sqread() -- read a sequence
|
---|
| 50 | =============================================================================
|
---|
| 51 | */
|
---|
[7258c6a] | 52 |
|
---|
[f40a309] | 53 | int16_t sqread(FILE *fp)
|
---|
[7258c6a] | 54 | {
|
---|
| 55 | int8_t cb;
|
---|
[f40a309] | 56 | int16_t seq;
|
---|
[7258c6a] | 57 |
|
---|
[f40a309] | 58 | ldwmsg(" Busy -- please stand by", (int8_t *)NULL, " Reading sequences",
|
---|
| 59 | LCFBX10, LCBBX10);
|
---|
| 60 |
|
---|
| 61 | for (;;) {
|
---|
| 62 |
|
---|
| 63 | if (rd_ec(fp, &cb, 1L)) { /* get control byte */
|
---|
| 64 |
|
---|
| 65 | sqioerr();
|
---|
| 66 | return(FAILURE);
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | if (0 EQ cb) /* zero control byte is end */
|
---|
| 70 | return(SUCCESS);
|
---|
| 71 |
|
---|
| 72 | if (rd_ec(fp, &seq, 2L)) { /* get Line number */
|
---|
| 73 |
|
---|
| 74 | sqioerr();
|
---|
| 75 | return(FAILURE);
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | if (cb & 0x08) { /* get Time */
|
---|
| 79 |
|
---|
| 80 | if (rd_ec(fp, &seqtab[seq].seqtime, 2L)) {
|
---|
| 81 |
|
---|
| 82 | sqioerr();
|
---|
| 83 | return(FAILURE);
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 | /* |
---|
| 87 |
|
---|
| 88 | */
|
---|
| 89 | if (cb & 0x04) { /* get Action 1 */
|
---|
| 90 |
|
---|
| 91 | if (rd_ec(fp, &seqtab[seq].seqact1, 4L)) {
|
---|
| 92 |
|
---|
| 93 | sqioerr();
|
---|
| 94 | return(FAILURE);
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | if (cb & 0x02) { /* get Action 2 */
|
---|
| 99 |
|
---|
| 100 | if (rd_ec(fp, &seqtab[seq].seqact2, 4L)) {
|
---|
| 101 |
|
---|
| 102 | sqioerr();
|
---|
| 103 | return(FAILURE);
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | if (cb & 0x01) { /* get Action 3 */
|
---|
| 108 |
|
---|
| 109 | if (rd_ec(fp, &seqtab[seq].seqact3, 4L)) {
|
---|
| 110 |
|
---|
| 111 | sqioerr();
|
---|
| 112 | return(FAILURE);
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 | }
|
---|