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