1 /************************************************************************
2 ************************************************************************
4 Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
5 ---------------------------------------------------------------------
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ************************************************************************
20 ************************************************************************/
24 #include "errormsg.hh"
30 const char* yyfilename
= "????";
32 Tree DEFLINEPROP
= tree(symbol("DefLineProp"));
34 void yyerror(char* msg
)
36 fprintf(stderr
, "%s:%d:%s\n", yyfilename
, yylineno
, msg
);
40 void evalerror(const char* filename
, int linenum
, const char* msg
, Tree exp
)
42 fprintf(stderr
, "%s:%d: ERROR: %s ", filename
, linenum
, msg
);
43 print(exp
,stderr
); fprintf(stderr
, "\n");
47 void evalerrorbox(const char* filename
, int linenum
, const char* msg
, Tree exp
)
49 cerr
<< filename
<< ':' << linenum
<< ": ERROR: " << msg
<< " : " << boxpp(exp
) << endl
;
53 void evalwarning(const char* filename
, int linenum
, const char* msg
, Tree exp
)
55 fprintf(stderr
, "%s:%d: WARNING: %s ", filename
, linenum
, msg
);
56 print(exp
,stderr
); fprintf(stderr
, "\n");
59 void evalremark(const char* filename
, int linenum
, const char* msg
, Tree exp
)
61 fprintf(stderr
, "%s:%d: REMARK: %s ", filename
, linenum
, msg
);
62 print(exp
,stderr
); fprintf(stderr
, "\n");
66 void setDefProp(Tree sym
, const char* filename
, int lineno
)
68 setProperty(sym
, DEFLINEPROP
, cons(tree(filename
), tree(lineno
)));
72 const char* getDefFileProp(Tree sym
)
75 if (getProperty(sym
, DEFLINEPROP
, n
)) {
76 return name(hd(n
)->node().getSym());
82 int getDefLineProp(Tree sym
)
85 if (getProperty(sym
, DEFLINEPROP
, n
)) {
86 return tl(n
)->node().getInt();