1: #include "defs" 2: #include "string_defs" 3: 4: #ifdef C_OVERLAY 5: char efilname[] = "/usr/share/misc/f77_strings"; 6: int efil = -1; 7: 8: error(index,t,u,type) 9: unsigned index; 10: char *t, *u; 11: register int type; 12: { 13: char buf[100]; 14: long lseek(); 15: 16: if (efil < 0) { 17: efil = open(efilname, 0); 18: if (efil < 0) { 19: oops: 20: perror(efilname); 21: exit(1); 22: } 23: } 24: if (lseek(efil, (long) index, 0) < 0 || read(efil, buf, sizeof(buf)) <= 0) 25: goto oops; 26: switch (type) { 27: case WARN1: 28: case WARN: 29: if(nowarnflag) 30: return; 31: fprintf(diagfile, "Warning on line %d of %s: ", lineno, infname); 32: ++nwarn; 33: break; 34: 35: case YYERR: 36: case ERR2: 37: case ERR1: 38: case ERR: 39: fprintf(diagfile, "Error on line %d of %s: ", lineno, infname); 40: ++nerr; 41: break; 42: 43: case FATAL1: 44: case FATAL: 45: if (buf[0] != '\0') { 46: fprintf(diagfile, buf, t, u); 47: fprintf(diagfile, "\n"); 48: } 49: fprintf(diagfile,"f77 compiler error line %d of %s: ", lineno, infname); 50: fprintf(diagfile,buf,t,u); 51: fputc('\n',diagfile); 52: if(debugflag) 53: abort(); 54: done(3); 55: exit(3); 56: case EXECERR: 57: fprintf(diagfile, "Error on line %d of %s: ", lineno, infname); 58: fprintf(diagfile,"Execution error %s"); 59: ++nerr; 60: break; 61: case DCLERR: 62: if(t) 63: fprintf(diagfile,"Declaration error for %s: %s\n", 64: varstr(VL, (struct nameblock *)t->varname), buf); 65: else 66: fprintf(diagfile,"Declaration error %s\n", buf); 67: return; 68: 69: default: 70: fprintf(diagfile,"unrecognizable error switch\n"); 71: exit(1); 72: /*NOTREACHED*/ 73: } 74: fprintf(diagfile,buf,t,u); 75: fprintf(diagfile,"\n"); 76: } 77: 78: #else C_OVERLAY 79: 80: error(str,t,u,type) 81: char *str, *t, *u; 82: register int type; 83: { 84: switch (type) { 85: case WARN1: 86: case WARN: 87: if(nowarnflag) 88: return; 89: fprintf(diagfile, "Warning on line %d of %s: ", lineno, infname); 90: ++nwarn; 91: break; 92: 93: case YYERR: 94: case ERR2: 95: case ERR1: 96: case ERR: 97: fprintf(diagfile, "Error on line %d of %s: ", lineno, infname); 98: ++nerr; 99: break; 100: 101: case FATAL1: 102: case FATAL: 103: if (str != NULL) { 104: fprintf(diagfile, str, t, u); 105: fprintf(diagfile, "\n"); 106: } 107: fprintf(diagfile,"f77 compiler error line %d of %s: ", lineno, infname); 108: if(debugflag) 109: abort(); 110: done(3); 111: exit(3); 112: case EXECERR: 113: fprintf(diagfile, "Error on line %d of %s: ", lineno, infname); 114: fprintf(diagfile, "Execution error %s"); 115: ++nerr; 116: break; 117: case DCLERR: 118: if(t) 119: fprintf(diagfile,"Declaration error for %s: %s\n", 120: varstr(VL, (struct nameblock *)t->varname), str); 121: else 122: fprintf(diagfile,"Declaration error %s\n", str); 123: return; 124: 125: default: 126: fprintf(diagfile,"unrecognizable error switch\n"); 127: exit(1); 128: /*NOTREACHED*/ 129: } 130: fprintf(diagfile,str,t,u); 131: fprintf(diagfile,"\n"); 132: } 133: 134: #endif C_OVERLAY