# 2.11BSD#431 - /usr/src/ucb/pascal/pxp/error.c

##### Functions

    cerror            X
    error             X
    panic             X

##### Variables

    errpfx            X

       1: #
       2: /*
       3:  * pi - Pascal interpreter code translator
       4:  *
       5:  * Charles Haley, Bill Joy UCB
       6:  * Version 1.2 January 1979
       7:  *
       8:  *
       9:  * pxp - Pascal execution profiler
      10:  *
      11:  * Bill Joy UCB
      12:  * Version 1.2 January 1979
      13:  */
      14:
      15: #include "0.h"
      16: #include "yy.h"
      17:
      18: #ifdef PXP
      19: extern  int yyline;
      20: extern  char errout;
      21: #endif
      22:
      23: char    errpfx  = 'E';
      24: extern  int yyline;
      25: /*
      26:  * Panic is called when impossible
      27:  * (supposedly, anyways) situations
      28:  * are encountered.
      29: #ifdef PI
      30:  * Panic messages should be short
      31:  * as they do not go to the message
      32:  * file.
      33: #endif
      34:  */
      35: panic(s)
      36:     char *s;
      37: {
      38:
      39: #ifdef DEBUG
      40:     printf("Snark (%s) line=%d yyline=%d\n", s, line, yyline);
      41: #endif
      42: #ifdef PXP
      43:     Perror( "Snark in pxp", s);
      44: #endif
      45: #ifdef PI
      46:     Perror( "Snark in pi", s);
      47: #endif
      48:     pexit(DIED);
      49: }
      50:
      51: extern  char *errfile;
      52: /*
      53:  * Error is called for
      54:  * semantic errors and
      55:  * prints the error and
      56:  * a line number.
      57:  */
      58: error(a1, a2, a3, a4)
      59: {
      60: #ifdef PI
      61:     char buf[256];
      62:     register int i;
      63: #endif
      64: #ifdef PXP
      65:     int ofout;
      66: #endif
      67:
      68:     if (errpfx == 'w' && opt('w') != 0)
      69:         return;
      70: #ifdef PXP
      71:     flush();
      72:     ofout = fout[0];
      73:     fout[0] = errout;
      74: #endif
      75: #ifdef PI
      76:     Enocascade = 0;
      77:     geterr(a1, buf);
      78:     a1 = buf;
      79: #endif
      80:     if (line < 0)
      81:         line = -line;
      82:     yySsync();
      83:     yysetfile(filename);
      84: #ifdef PI
      85:     if (errpfx == ' ') {
      86:         printf("  ");
      87:         for (i = line; i >= 10; i /= 10)
      88:             putchar(' ');
      89:         printf("... ");
      90:     } else if (Enoline)
      91:         printf("  %c - ", errpfx);
      92:     else
      93: #endif
      94:         printf("%c %d - ", errpfx, line);
      95:     printf(a1, a2, a3, a4);
      96:     if (errpfx == 'E')
      97: #ifdef PI
      98:         eflg++, cgenflg++;
      99: #endif
     100: #ifdef PXP
     101:         eflg++;
     102: #endif
     103:     errpfx = 'E';
     104: #ifdef PI
     105:     if (Eholdnl)
     106:         Eholdnl = 0;
     107:     else
     108: #endif
     109:         putchar('\n');
     110: #ifdef PXP
     111:     flush();
     112:     fout[0] = ofout;
     113: #endif
     114: }
     115:
     116: #ifdef PI
     117: cerror(a1, a2, a3, a4)
     118: {
     119:
     120:     if (Enocascade)
     121:         return;
     122:     setpfx(' ');
     123:     error(a1, a2, a3, a4);
     124: }
     125: #endif

#### Defined functions

cerror defined in line 117; never used
error defined in line 58; used 12 times

- in line 123
- in /usr/src/ucb/pascal/pxp/nl.c line 603-608(2), 668, 677
- in /usr/src/ucb/pascal/pxp/yyerror.c line 100
- in /usr/src/ucb/pascal/pxp/yyget.c line 145, 201, 207, 223, 233, 241

panic defined in line 35; used 12 times

- in /usr/src/ucb/pascal/pxp/const.c line 83
- in /usr/src/ucb/pascal/pxp/fdec.c line 55
- in /usr/src/ucb/pascal/pxp/lval.c line 40
- in /usr/src/ucb/pascal/pxp/nl.c line 338
- in /usr/src/ucb/pascal/pxp/pp.c line 286
- in /usr/src/ucb/pascal/pxp/rval.c line 61
- in /usr/src/ucb/pascal/pxp/stat.c line 64
- in /usr/src/ucb/pascal/pxp/tree.c line 163
- in /usr/src/ucb/pascal/pxp/type.c line 78
- in /usr/src/ucb/pascal/pxp/yylex.c line 32
- in /usr/src/ucb/pascal/pxp/yyparse.c line 210
- in /usr/src/ucb/pascal/pxp/yyrecover.c line 836

#### Defined variables

errpfx defined in line 23; used 6 times

- in line 68, 85, 91-96(3), 103

Last modified: 1986-06-01 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 574 |