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