Annotation of researchv10no/cmd/f2c/error.c, revision 1.1.1.1

1.1       root        1: /****************************************************************
                      2: Copyright 1990, 1993 by AT&T Bell Laboratories and Bellcore.
                      3: 
                      4: Permission to use, copy, modify, and distribute this software
                      5: and its documentation for any purpose and without fee is hereby
                      6: granted, provided that the above copyright notice appear in all
                      7: copies and that both that the copyright notice and this
                      8: permission notice and warranty disclaimer appear in supporting
                      9: documentation, and that the names of AT&T Bell Laboratories or
                     10: Bellcore or any of their entities not be used in advertising or
                     11: publicity pertaining to distribution of the software without
                     12: specific, written prior permission.
                     13: 
                     14: AT&T and Bellcore disclaim all warranties with regard to this
                     15: software, including all implied warranties of merchantability
                     16: and fitness.  In no event shall AT&T or Bellcore be liable for
                     17: any special, indirect or consequential damages or any damages
                     18: whatsoever resulting from loss of use, data or profits, whether
                     19: in an action of contract, negligence or other tortious action,
                     20: arising out of or in connection with the use or performance of
                     21: this software.
                     22: ****************************************************************/
                     23: 
                     24: #include "defs.h"
                     25: 
                     26: warni(s,t)
                     27:  char *s;
                     28:  int t;
                     29: {
                     30:        char buf[100];
                     31:        sprintf(buf,s,t);
                     32:        warn(buf);
                     33:        }
                     34: 
                     35: warn1(s,t)
                     36: char *s, *t;
                     37: {
                     38:        char buff[100];
                     39:        sprintf(buff, s, t);
                     40:        warn(buff);
                     41: }
                     42: 
                     43: 
                     44: warn(s)
                     45: char *s;
                     46: {
                     47:        if(nowarnflag)
                     48:                return;
                     49:        if (infname && *infname)
                     50:                fprintf(diagfile, "Warning on line %ld of %s: %s\n",
                     51:                        lineno, infname, s);
                     52:        else
                     53:                fprintf(diagfile, "Warning on line %ld: %s\n", lineno, s);
                     54:        fflush(diagfile);
                     55:        ++nwarn;
                     56: }
                     57: 
                     58: 
                     59: errstr(s, t)
                     60: char *s, *t;
                     61: {
                     62:        char buff[100];
                     63:        sprintf(buff, s, t);
                     64:        err(buff);
                     65: }
                     66: 
                     67: 
                     68: 
                     69: erri(s,t)
                     70: char *s;
                     71: int t;
                     72: {
                     73:        char buff[100];
                     74:        sprintf(buff, s, t);
                     75:        err(buff);
                     76: }
                     77: 
                     78: errl(s,t)
                     79: char *s;
                     80: long t;
                     81: {
                     82:        char buff[100];
                     83:        sprintf(buff, s, t);
                     84:        err(buff);
                     85: }
                     86: 
                     87:  char *err_proc = 0;
                     88: 
                     89: err(s)
                     90: char *s;
                     91: {
                     92:        if (err_proc)
                     93:                fprintf(diagfile,
                     94:                        "Error processing %s before line %ld",
                     95:                        err_proc, lineno);
                     96:        else
                     97:                fprintf(diagfile, "Error on line %ld", lineno);
                     98:        if (infname && *infname)
                     99:                fprintf(diagfile, " of %s", infname);
                    100:        fprintf(diagfile, ": %s\n", s);
                    101:        fflush(diagfile);
                    102:        ++nerr;
                    103: }
                    104: 
                    105: 
                    106: yyerror(s)
                    107: char *s;
                    108: {
                    109:        err(s);
                    110: }
                    111: 
                    112: 
                    113: 
                    114: dclerr(s, v)
                    115: char *s;
                    116: Namep v;
                    117: {
                    118:        char buff[100];
                    119: 
                    120:        if(v)
                    121:        {
                    122:                sprintf(buff, "Declaration error for %s: %s", v->fvarname, s);
                    123:                err(buff);
                    124:        }
                    125:        else
                    126:                errstr("Declaration error %s", s);
                    127: }
                    128: 
                    129: 
                    130: 
                    131: execerr(s, n)
                    132: char *s, *n;
                    133: {
                    134:        char buf1[100], buf2[100];
                    135: 
                    136:        sprintf(buf1, "Execution error %s", s);
                    137:        sprintf(buf2, buf1, n);
                    138:        err(buf2);
                    139: }
                    140: 
                    141: 
                    142: Fatal(t)
                    143: char *t;
                    144: {
                    145:        fprintf(diagfile, "Compiler error line %ld", lineno);
                    146:        if (infname)
                    147:                fprintf(diagfile, " of %s", infname);
                    148:        fprintf(diagfile, ": %s\n", t);
                    149:        done(3);
                    150: }
                    151: 
                    152: 
                    153: 
                    154: 
                    155: fatalstr(t,s)
                    156: char *t, *s;
                    157: {
                    158:        char buff[100];
                    159:        sprintf(buff, t, s);
                    160:        Fatal(buff);
                    161: }
                    162: 
                    163: 
                    164: 
                    165: fatali(t,d)
                    166: char *t;
                    167: int d;
                    168: {
                    169:        char buff[100];
                    170:        sprintf(buff, t, d);
                    171:        Fatal(buff);
                    172: }
                    173: 
                    174: 
                    175: 
                    176: badthing(thing, r, t)
                    177: char *thing, *r;
                    178: int t;
                    179: {
                    180:        char buff[50];
                    181:        sprintf(buff, "Impossible %s %d in routine %s", thing, t, r);
                    182:        Fatal(buff);
                    183: }
                    184: 
                    185: 
                    186: 
                    187: badop(r, t)
                    188: char *r;
                    189: int t;
                    190: {
                    191:        badthing("opcode", r, t);
                    192: }
                    193: 
                    194: 
                    195: 
                    196: badtag(r, t)
                    197: char *r;
                    198: int t;
                    199: {
                    200:        badthing("tag", r, t);
                    201: }
                    202: 
                    203: 
                    204: 
                    205: 
                    206: 
                    207: badstg(r, t)
                    208: char *r;
                    209: int t;
                    210: {
                    211:        badthing("storage class", r, t);
                    212: }
                    213: 
                    214: 
                    215: 
                    216: 
                    217: badtype(r, t)
                    218: char *r;
                    219: int t;
                    220: {
                    221:        badthing("type", r, t);
                    222: }
                    223: 
                    224: 
                    225: many(s, c, n)
                    226: char *s, c;
                    227: int n;
                    228: {
                    229:        char buff[250];
                    230: 
                    231:        sprintf(buff,
                    232:            "Too many %s.\nTable limit now %d.\nTry rerunning with the -N%c%d option.\n",
                    233:            s, n, c, 2*n);
                    234:        Fatal(buff);
                    235: }
                    236: 
                    237: 
                    238: err66(s)
                    239: char *s;
                    240: {
                    241:        errstr("Fortran 77 feature used: %s", s);
                    242:        --nerr;
                    243: }
                    244: 
                    245: 
                    246: 
                    247: errext(s)
                    248: char *s;
                    249: {
                    250:        errstr("f2c extension used: %s", s);
                    251:        --nerr;
                    252: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.