| 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | sqread.c -- librarian - read sequence functions
|
|---|
| 4 | Version 2 -- 1988-11-17 -- D.N. Lynx Crowe
|
|---|
| 5 | =============================================================================
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "ram.h"
|
|---|
| 9 |
|
|---|
| 10 | /*
|
|---|
| 11 | =============================================================================
|
|---|
| 12 | sqioerr() -- put up an I/O error message
|
|---|
| 13 | =============================================================================
|
|---|
| 14 | */
|
|---|
| 15 |
|
|---|
| 16 | void sqioerr(void)
|
|---|
| 17 | {
|
|---|
| 18 | int8_t erms[40];
|
|---|
| 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 |
|
|---|
| 34 | int16_t sqread(FILE *fp)
|
|---|
| 35 | {
|
|---|
| 36 | int8_t cb;
|
|---|
| 37 | int16_t seq;
|
|---|
| 38 |
|
|---|
| 39 | ldwmsg(" Busy -- please stand by", (int8_t *)NULL, " Reading sequences",
|
|---|
| 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 | }
|
|---|
| 67 |
|
|---|
| 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 | }
|
|---|
| 96 |
|
|---|