[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 | sqread() -- read a sequence
|
---|
| 31 | =============================================================================
|
---|
| 32 | */
|
---|
| 33 |
|
---|
[7258c6a] | 34 | int16_t sqread(FILE *fp)
|
---|
[f40a309] | 35 | {
|
---|
[7258c6a] | 36 | int8_t cb;
|
---|
| 37 | int16_t seq;
|
---|
[f40a309] | 38 |
|
---|
[7258c6a] | 39 | ldwmsg(" Busy -- please stand by", (int8_t *)NULL, " Reading sequences",
|
---|
[f40a309] | 40 | LCFBX10, LCBBX10);
|
---|
| 41 |
|
---|
| 42 | for (;;) {
|
---|
| 43 |
|
---|
| 44 | if (rd_ec(fp, &cb, 1L)) { /* get control byte */
|
---|
| 45 |
|
---|
| 46 | sqioerr();
|
---|
| 47 | return(FAILURE);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | if (0 EQ cb) /* zero control byte is end */
|
---|
| 51 | return(SUCCESS);
|
---|
| 52 |
|
---|
| 53 | if (rd_ec(fp, &seq, 2L)) { /* get Line number */
|
---|
| 54 |
|
---|
| 55 | sqioerr();
|
---|
| 56 | return(FAILURE);
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | if (cb & 0x08) { /* get Time */
|
---|
| 60 |
|
---|
| 61 | if (rd_ec(fp, &seqtab[seq].seqtime, 2L)) {
|
---|
| 62 |
|
---|
| 63 | sqioerr();
|
---|
| 64 | return(FAILURE);
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
[fa38804] | 67 |
|
---|
[f40a309] | 68 | if (cb & 0x04) { /* get Action 1 */
|
---|
| 69 |
|
---|
| 70 | if (rd_ec(fp, &seqtab[seq].seqact1, 4L)) {
|
---|
| 71 |
|
---|
| 72 | sqioerr();
|
---|
| 73 | return(FAILURE);
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | if (cb & 0x02) { /* get Action 2 */
|
---|
| 78 |
|
---|
| 79 | if (rd_ec(fp, &seqtab[seq].seqact2, 4L)) {
|
---|
| 80 |
|
---|
| 81 | sqioerr();
|
---|
| 82 | return(FAILURE);
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | if (cb & 0x01) { /* get Action 3 */
|
---|
| 87 |
|
---|
| 88 | if (rd_ec(fp, &seqtab[seq].seqact3, 4L)) {
|
---|
| 89 |
|
---|
| 90 | sqioerr();
|
---|
| 91 | return(FAILURE);
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
| 95 | }
|
---|
[6262b5c] | 96 |
|
---|