[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 |
|
---|
[7258c6a] | 17 | extern int16_t errno; /* system error number */
|
---|
[f40a309] | 18 |
|
---|
| 19 |
|
---|
| 20 | /*
|
---|
| 21 | =============================================================================
|
---|
| 22 | sqioerr() -- put up an I/O error message
|
---|
| 23 | =============================================================================
|
---|
| 24 | */
|
---|
| 25 |
|
---|
[0580615] | 26 | void sqioerr(void)
|
---|
[f40a309] | 27 | {
|
---|
[7258c6a] | 28 | int8_t erms[40];
|
---|
[f40a309] | 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 | */
|
---|
[7258c6a] | 47 |
|
---|
[f40a309] | 48 | int16_t sqread(FILE *fp)
|
---|
[7258c6a] | 49 | {
|
---|
| 50 | int8_t cb;
|
---|
[f40a309] | 51 | int16_t seq;
|
---|
[7258c6a] | 52 |
|
---|
[f40a309] | 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 | }
|
---|