|
|
1.1 root 1: /* te.c: error message control, input line count */
2: # include "t..c"
3: error(s)
4: char *s;
5: {
6: fprintf(stderr, "\n%s: line %d: %s\n", ifile, iline, s);
7: # ifdef unix
8: fprintf(stderr, "tbl quits\n");
9: exit(1);
10: # endif
11: # ifdef gcos
12: fprintf(stderr, "run terminated due to error condition detected by tbl preprocessor\n");
13: exit(0);
14: # endif
15: }
16: char *gets1(s, size)
17: char *s;
18: int size;
19: {
20: char *p, *ns;
21: int nbl = 0;
22: iline++;
23: ns = s;
24: p=fgets(s,size,tabin);
25: while (p==0)
26: {
27: if (swapin()==0)
28: return(0);
29: p = fgets(s,size,tabin);
30: }
31:
32: while (*s) s++;
33: s--;
34: if (*s == '\n') *s-- =0;
35: else error("input buffer too small");
36: for(nbl=0; *s == '\\' && s>p; s--)
37: nbl++;
38: if (linstart && nbl % 2) /* fold escaped nl if in table */
39: gets1(s+1, size - (s-ns));
40:
41: return(p);
42: }
43: # define BACKMAX 500
44: char backup[BACKMAX];
45: char *backp = backup;
46: un1getc(c)
47: {
48: if (c=='\n')
49: iline--;
50: *backp++ = c;
51: if (backp >= backup+BACKMAX)
52: error("too much backup");
53: }
54: get1char()
55: {
56: int c;
57: if (backp>backup)
58: c = *--backp;
59: else
60: c=getc(tabin);
61: if (c== EOF) /* EOF */
62: {
63: if (swapin() ==0)
64: error("unexpected EOF");
65: c = getc(tabin);
66: }
67: if (c== '\n')
68: iline++;
69: return(c);
70: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.