# 2.11BSD#431 - /usr/src/usr.bin/tbl/te.c

##### Functions

    error             X
    get1char          X
    gets1             X
    un1getc           X

##### Variables

    backp             X
    backup            X

##### Macros

    BACKMAX           X

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

#### Defined functions

error defined in line 7; used 27 times

- in line 53, 65
- in /usr/src/usr.bin/tbl/t1.c line 99
- in /usr/src/usr.bin/tbl/t3.c line 57, 82
- in /usr/src/usr.bin/tbl/t4.c line 45, 57-65(3), 73, 86, 99-101(2), 140, 158-162(2), 181, 212, 236
- in /usr/src/usr.bin/tbl/t5.c line 139
- in /usr/src/usr.bin/tbl/t9.c line 12-16(2)
- in /usr/src/usr.bin/tbl/tb.c line 51-54(2), 75
- in /usr/src/usr.bin/tbl/tc.c line 58
- in /usr/src/usr.bin/tbl/tg.c line 14

get1char defined in line 55; used 9 times

- in /usr/src/usr.bin/tbl/t4.c line 39, 63, 126-130(2), 139, 145, 168, 197, 225

gets1 defined in line 20; used 6 times

- in line 40
- in /usr/src/usr.bin/tbl/t1.c line 48
- in /usr/src/usr.bin/tbl/t3.c line 39
- in /usr/src/usr.bin/tbl/t5.c line 12
- in /usr/src/usr.bin/tbl/t9.c line 18
- in /usr/src/usr.bin/tbl/tg.c line 45

un1getc defined in line 47; used 7 times

- in /usr/src/usr.bin/tbl/t3.c line 93-95(2)
- in /usr/src/usr.bin/tbl/t4.c line 135, 163, 184, 214, 227

#### Defined variables

backp defined in line 46; used 4 times

- in line 51-52(2), 58-59(2)

backup defined in line 45; used 3 times

- in line 46, 52, 58

sccsid defined in line 2; never used

#### Defined macros

BACKMAX defined in line 44; used 2 times

- in line 45, 52

Last modified: 1993-01-18 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1098 |