00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "errormsg.hh"
00025 #include "boxes.hh"
00026 #include <iostream>
00027 using namespace std;
00028
00029 const char* yyfilename = "????";
00030 int gErrorCount = 0;
00031 Tree DEFLINEPROP = tree(symbol("DefLineProp"));
00032
00033 void yyerror(char* msg)
00034 {
00035 fprintf(stderr, "%s:%d:%s\n", yyfilename, yylineno, msg);
00036 gErrorCount++;
00037 }
00038
00039 void evalerror(const char* filename, int linenum, const char* msg, Tree exp)
00040 {
00041 fprintf(stderr, "%s:%d: ERROR: %s ", filename, linenum, msg);
00042 print(exp,stderr); fprintf(stderr, "\n");
00043 gErrorCount++;
00044 }
00045
00046 void evalwarning(const char* filename, int linenum, const char* msg, Tree exp)
00047 {
00048 fprintf(stderr, "%s:%d: WARNING: %s ", filename, linenum, msg);
00049 print(exp,stderr); fprintf(stderr, "\n");
00050 }
00051
00052 void evalremark(const char* filename, int linenum, const char* msg, Tree exp)
00053 {
00054 fprintf(stderr, "%s:%d: REMARK: %s ", filename, linenum, msg);
00055 print(exp,stderr); fprintf(stderr, "\n");
00056 }
00057
00058
00059 void setDefProp(Tree sym, const char* filename, int lineno)
00060 {
00061 setProperty(sym, DEFLINEPROP, cons(tree(filename), tree(lineno)));
00062 }
00063
00064
00065 const char* getDefFileProp(Tree sym)
00066 {
00067 Tree n;
00068 if (getProperty(sym, DEFLINEPROP, n)) {
00069 return name(hd(n)->node().getSym());
00070 } else {
00071 return "????";
00072 }
00073 }
00074
00075 int getDefLineProp(Tree sym)
00076 {
00077 Tree n;
00078 if (getProperty(sym, DEFLINEPROP, n)) {
00079 return tl(n)->node().getInt();
00080 } else {
00081 return -1;
00082 }
00083 }