From: Keith J. <bu...@us...> - 2002-08-22 14:15:56
|
Update of /cvsroot/cup-language/cup/src/compiler In directory usw-pr-cvs1:/tmp/cvs-serv5715/compiler Modified Files: binary.c compiler.h nodes.c parser.y Log Message: make WINBINARY=no now compiles/installs like under a unix environment, with cygwin, good for testing unknown functions now can report the correct filename/line number some unix make install bugs fixed Index: binary.c =================================================================== RCS file: /cvsroot/cup-language/cup/src/compiler/binary.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** binary.c 2 Aug 2002 15:50:44 -0000 1.13 --- binary.c 22 Aug 2002 14:15:53 -0000 1.14 *************** *** 595,599 **** if (!label1) { ! cupc_tb(comp, "CUPCOP_CALL", "unknown function"); return; } --- 595,611 ---- if (!label1) { ! char errbuf[TBUFSIZE]; ! const char *sfile; ! ! comp->line = node->line; ! sfile = comp->filename; ! comp->filename = node->sourcefile; ! ! sprintf(errbuf, "unknown function '%s'", node->one->const_string); ! cupc_tb(comp, "CUPCOP_CALL", errbuf); ! ! comp->line = 0; ! comp->filename = sfile; ! return; } Index: compiler.h =================================================================== RCS file: /cvsroot/cup-language/cup/src/compiler/compiler.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** compiler.h 2 Aug 2002 15:50:44 -0000 1.10 --- compiler.h 22 Aug 2002 14:15:53 -0000 1.11 *************** *** 29,32 **** --- 29,35 ---- long int const_integer; char *const_string; + + char *sourcefile; + unsigned long line; }; Index: nodes.c =================================================================== RCS file: /cvsroot/cup-language/cup/src/compiler/nodes.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** nodes.c 2 Aug 2002 15:50:44 -0000 1.11 --- nodes.c 22 Aug 2002 14:15:53 -0000 1.12 *************** *** 85,88 **** --- 85,90 ---- newnode->op = op; newnode->const_string = NULL; + newnode->sourcefile = NULL; + newnode->line = 0; return newnode; *************** *** 153,156 **** --- 155,160 ---- if (node->next) cupc_node_free(node->next); + if (node->sourcefile) + dfree(node->sourcefile); dfree(node); } Index: parser.y =================================================================== RCS file: /cvsroot/cup-language/cup/src/compiler/parser.y,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** parser.y 2 Aug 2002 15:50:44 -0000 1.12 --- parser.y 22 Aug 2002 14:15:53 -0000 1.13 *************** *** 259,263 **** { $$ = cupc_node_new(CUPCOP_CALL, cupc_node_new_token($1), cupc_node_stack_pop((CUPCOMPILED *) parm), ! NULL, NULL); } ; --- 259,265 ---- { $$ = cupc_node_new(CUPCOP_CALL, cupc_node_new_token($1), cupc_node_stack_pop((CUPCOMPILED *) parm), ! NULL, NULL); ! $$->sourcefile = dstrdup(((CUPCOMPILED *) parm)->filename, TYPE_CUPC); ! $$->line = ((CUPCOMPILED *) parm)->line; } ; *************** *** 539,543 **** { const char *oldsrc, *oldfname; ! unsigned long oldplace; bool ret; --- 541,545 ---- { const char *oldsrc, *oldfname; ! unsigned long oldplace, oldline; bool ret; *************** *** 545,552 **** --- 547,556 ---- oldfname = comp->filename; oldplace = comp->place; + oldline = comp->line; comp->source = cup_callback_include(comp->data, filename); comp->filename = filename; comp->place = 0; + comp->line = 1; if (yyparse(comp) != 1) *************** *** 558,561 **** --- 562,566 ---- comp->filename = oldfname; comp->place = oldplace; + comp->line = oldline; dfree(filename); *************** *** 592,595 **** --- 597,601 ---- { cupc_node_link(comp, cupc_node_new(CUPCOP_EXIT, cupc_node_new_integer(0), NULL, NULL, NULL)); + comp->line = 0; if (comp_debug) |