1: #include "defs" 2: 3: char *linerr() 4: { 5: static char buff[50]; 6: register int i; 7: 8: for(i = filedepth; i>0 && filenames[i]==NULL ; --i) 9: ; 10: if(i > 0) 11: sprintf(buff, "on line %d of file %s", yylineno, filenames[i]); 12: else 13: sprintf(buff, "on line %d", yylineno); 14: return(buff); 15: } 16: 17: 18: 19: laberr(s,t) 20: char *s; 21: char *t; 22: { 23: errmess("Label error", s, t); 24: } 25: 26: 27: 28: 29: 30: exprerr(s,t) 31: char *s; 32: ptr t; 33: { 34: errmess("Expression error", s, t); 35: } 36: 37: 38: 39: 40: execerr(s,t) 41: char *s, *t; 42: { 43: errmess("Error", s, t); 44: } 45: 46: 47: errmess(m,s,t) 48: char *m, *s, *t; 49: { 50: fprintf(diagfile, "**%s %s: ", m, linerr()); 51: if(s) 52: fprintf(diagfile, s, t); 53: fprintf(diagfile, "\n"); 54: ++nerrs; 55: } 56: 57: 58: 59: dclerr(s, n) 60: char *s, *n; 61: { 62: extern int nerrs; 63: 64: fprintf(diagfile, "**Error %s: Declaration for %s: %s\n", 65: linerr(), n, s); 66: ++nerrs; 67: } 68: 69: 70: 71: 72: badtag(routine, tag) 73: char *routine; 74: int tag; 75: { 76: char buff[100]; 77: sprintf(buff, "impossible tag %d in routine %s", tag, routine); 78: fatal(buff); 79: } 80: 81: 82: 83: fatal1(s,t) 84: char *s; 85: int t; 86: { 87: 88: sprintf(msg, s, t); 89: fatal(msg); 90: } 91: 92: 93: 94: fatal(s) 95: char *s; 96: { 97: fprintf(diagfile, "\n***Compiler error %s.", linerr()); 98: if(s) fprintf(diagfile, " %s.", s); 99: fprintf(diagfile, "\n"); 100: fflush(stdout); 101: 102: if(dumpcore) 103: abort(0); 104: else { 105: rmiis(); 106: exit(-1); 107: } 108: } 109: 110: 111: 112: warn1(s,t) 113: char *s; 114: int t; 115: { 116: sprintf(msg, s, t); 117: warn(msg); 118: } 119: 120: 121: 122: 123: warn(s) 124: char *s; 125: { 126: ++nwarns; 127: if( !nowarnflag) 128: fprintf(diagfile, "*Warning: %s\n", s); 129: } 130: 131: 132: 133: yyerror(s) 134: char *s; 135: { 136: errmess(s, CNULL, CNULL); 137: }