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

get1char defined in line 55; used 9 times
un1getc defined in line 47; used 7 times

Defined variables

backp defined in line 46; used 4 times
backup defined in line 45; used 3 times
sccsid defined in line 2; never used

Defined macros

BACKMAX defined in line 44; used 2 times
Last modified: 1993-01-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2526
Valid CSS Valid XHTML 1.0 Strict