Annotation of 43BSD/usr.bin/f77/src/f77pass1/error.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  */
                      6: 
                      7: #ifndef lint
                      8: static char sccsid[] = "@(#)error.c    5.1 (Berkeley) 6/7/85";
                      9: #endif not lint
                     10: 
                     11: /*
                     12:  * error.c
                     13:  *
                     14:  * Error handling routines for f77 compiler pass 1, 4.2 BSD.
                     15:  *
                     16:  * University of Utah CS Dept modification history:
                     17:  * 
                     18:  * Revision 1.2  84/08/20  17:57:20  donn
                     19:  * Added strategic colons to the format strings in execerr() and dclerr().
                     20:  * 
                     21:  */
                     22: 
                     23: #include "defs.h"
                     24: 
                     25: 
                     26: warn1(s,t)
                     27: char *s, *t;
                     28: {
                     29: char buff[100];
                     30: sprintf(buff, s, t);
                     31: warn(buff);
                     32: }
                     33: 
                     34: 
                     35: warn(s)
                     36: char *s;
                     37: {
                     38: if(nowarnflag)
                     39:        return;
                     40: fprintf(diagfile, "Warning on line %d of %s: %s\n", lineno, infname, s);
                     41: ++nwarn;
                     42: }
                     43: 
                     44: 
                     45: errstr(s, t)
                     46: char *s, *t;
                     47: {
                     48: char buff[100];
                     49: sprintf(buff, s, t);
                     50: err(buff);
                     51: }
                     52: 
                     53: 
                     54: errnm(fmt, l, s)
                     55: char *fmt;
                     56: int l;
                     57: register char *s;
                     58: {
                     59:   char buff[VL+1];
                     60:   register int i;
                     61: 
                     62:   i = 0;
                     63:   while (i < l)
                     64:     {
                     65:       buff[i] = s[i];
                     66:       i++;
                     67:     }
                     68:   buff[i] = '\0';
                     69: 
                     70:   errstr(fmt, buff);
                     71: }
                     72: 
                     73: warnnm(fmt, l, s)
                     74: char *fmt;
                     75: int l;
                     76: register char *s;
                     77: {
                     78:   char buff[VL+1];
                     79:   register int i;
                     80: 
                     81:   i = 0;
                     82:   while (i < l)
                     83:     {
                     84:       buff[i] = s[i];
                     85:       i++;
                     86:     }
                     87:   buff[i] = '\0';
                     88: 
                     89:   warn1(fmt, buff);
                     90: }
                     91: 
                     92: erri(s,t)
                     93: char *s;
                     94: int t;
                     95: {
                     96: char buff[100];
                     97: sprintf(buff, s, t);
                     98: err(buff);
                     99: }
                    100: 
                    101: 
                    102: err(s)
                    103: char *s;
                    104: {
                    105: fprintf(diagfile, "Error on line %d of %s: %s\n", lineno, infname, s);
                    106: ++nerr;
                    107: optoff();
                    108: }
                    109: 
                    110: 
                    111: yyerror(s)
                    112: char *s;
                    113: { err(s); }
                    114: 
                    115: 
                    116: 
                    117: dclerr(s, v)
                    118: char *s;
                    119: Namep v;
                    120: {
                    121: char buff[100];
                    122: 
                    123: if(v)
                    124:        {
                    125:        sprintf(buff, "Declaration error for %s: %s", varstr(VL, v->varname), s);
                    126:        err(buff);
                    127:        }
                    128: else
                    129:        errstr("Declaration error: %s", s);
                    130: }
                    131: 
                    132: 
                    133: 
                    134: execerr(s, n)
                    135: char *s, *n;
                    136: {
                    137: char buf1[100], buf2[100];
                    138: 
                    139: sprintf(buf1, "Execution error: %s", s);
                    140: sprintf(buf2, buf1, n);
                    141: err(buf2);
                    142: }
                    143: 
                    144: 
                    145: fatal(t)
                    146: char *t;
                    147: {
                    148: fprintf(diagfile, "Compiler error line %d of %s: %s\n", lineno, infname, t);
                    149: if (debugflag[8])
                    150:        showbuffer();
                    151: if (debugflag[0])
                    152:        abort();
                    153: done(3);
                    154: exit(3);
                    155: }
                    156: 
                    157: 
                    158: 
                    159: 
                    160: fatalstr(t,s)
                    161: char *t, *s;
                    162: {
                    163: char buff[100];
                    164: sprintf(buff, t, s);
                    165: fatal(buff);
                    166: }
                    167: 
                    168: 
                    169: 
                    170: fatali(t,d)
                    171: char *t;
                    172: int d;
                    173: {
                    174: char buff[100];
                    175: sprintf(buff, t, d);
                    176: fatal(buff);
                    177: }
                    178: 
                    179: 
                    180: 
                    181: badthing(thing, r, t)
                    182: char *thing, *r;
                    183: int t;
                    184: {
                    185: char buff[50];
                    186: sprintf(buff, "Impossible %s %d in routine %s", thing, t, r);
                    187: fatal(buff);
                    188: }
                    189: 
                    190: 
                    191: 
                    192: badop(r, t)
                    193: char *r;
                    194: int t;
                    195: {
                    196: badthing("opcode", r, t);
                    197: }
                    198: 
                    199: 
                    200: 
                    201: badtag(r, t)
                    202: char *r;
                    203: int t;
                    204: {
                    205: badthing("tag", r, t);
                    206: }
                    207: 
                    208: 
                    209: 
                    210: 
                    211: 
                    212: badstg(r, t)
                    213: char *r;
                    214: int t;
                    215: {
                    216: badthing("storage class", r, t);
                    217: }
                    218: 
                    219: 
                    220: 
                    221: 
                    222: badtype(r, t)
                    223: char *r;
                    224: int t;
                    225: {
                    226: badthing("type", r, t);
                    227: }
                    228: 
                    229: 
                    230: many(s, c)
                    231: char *s, c;
                    232: {
                    233: char buff[25];
                    234: 
                    235: sprintf(buff, "Too many %s.  Try the -N%c option", s, c);
                    236: fatal(buff);
                    237: }
                    238: 
                    239: 
                    240: err66(s)
                    241: char *s;
                    242: {
                    243: errstr("Fortran 77 feature used: %s", s);
                    244: }
                    245: 
                    246: 
                    247: 
                    248: errext(s)
                    249: char *s;
                    250: {
                    251: errstr("F77 compiler extension used: %s", s);
                    252: }

unix.superglobalmegacorp.com

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