=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/pvar.c,v retrieving revision 1.15 retrieving revision 1.18 diff -u -p -r1.15 -r1.18 --- OpenXM_contrib2/asir2000/parse/pvar.c 2005/10/26 07:33:03 1.15 +++ OpenXM_contrib2/asir2000/parse/pvar.c 2006/06/21 09:46:06 1.18 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/parse/pvar.c,v 1.14 2003/11/12 07:01:38 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/pvar.c,v 1.17 2006/03/11 23:14:53 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -58,16 +58,16 @@ int gdef,mgdef,ldef; void mkpvs(char *fname) { VS pvs; - char *fullname; + char *fullname,*buf; FUNC f; if ( CUR_MODULE ) { /* function must be declared in advance */ searchf(CUR_MODULE->usrf_list,fname,&f); if ( !f ) { - fprintf(stderr,"\"%s\", near line %d: undeclared function `%s'", - asir_infile->name,asir_infile->ln,fname); - error(""); + buf = ALLOCA(strlen("undeclared function "+strlen(fname)+10)); + sprintf(buf,"undeclared function `%s'",fname); + yyerror(buf); } } pvs = (VS)MALLOC(sizeof(struct oVS)); @@ -132,6 +132,7 @@ void poppvs() { unsigned int makepvar(char *str) { int c,c1,created; + char *buf; if ( str[0] == '_' ) { /* pattern variable */ @@ -232,9 +233,9 @@ unsigned int makepvar(char *str) c = PVGLOBAL((unsigned int)c); } else { /* not declared as static or extern */ - fprintf(stderr,"\"%s\", near line %d: undeclared variable `%s'", - asir_infile->name,asir_infile->ln,str); - error(""); + buf = ALLOCA(strlen("undeclared variable"+strlen(str)+10)); + sprintf(buf,"undeclared variable `%s'",str); + yyerror(buf); } } else { /* outside function, outside module */ @@ -243,9 +244,9 @@ unsigned int makepvar(char *str) return c; CONFLICTION: - fprintf(stderr,"\"%s\", near line %d: conflicting declarations for `%s'", - asir_infile->name,asir_infile->ln,str); - error(""); + buf = ALLOCA(strlen("conflicting declarations for "+strlen(str)+10)); + sprintf(buf,"conflicting declarations for `%s'",str); + yyerror(buf); } extern FUNC parse_targetf; @@ -319,15 +320,15 @@ void closecurrentinput() fclose(asir_infile->fp); unlink(asir_infile->tname); #else - PCLOSE(asir_infile->fp); + if ( asir_infile->fp != stdin ) + PCLOSE(asir_infile->fp); #endif asir_infile = NEXT(asir_infile); - resetpvs(); } void resetpvs() { - if ( !NEXT(asir_infile) ) { + if ( asir_infile && !NEXT(asir_infile) ) { PVSS = 0; CPVS = GPVS; MPVS = 0; CUR_MODULE = 0; nextbp = 0; gdef = mgdef = ldef = 0; if ( EPVS->va ) {