--- capa/capa51/pProj/capaGrammarDef.y 2000/03/22 21:08:03 1.10 +++ capa/capa51/pProj/capaGrammarDef.y 2000/09/14 20:25:12 1.15 @@ -1,6 +1,30 @@ +/* main CAPA parser + Copyright (C) 1992-2000 Michigan State University + + The CAPA system is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The CAPA system is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the CAPA system; see the file COPYING. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + As a special exception, you have permission to link this program + with the TtH/TtM library and distribute executables, as long as you + follow the requirements of the GNU GPL in regard to all of the + software in the executable aside from TtH/TtM. +*/ + /* ========================================================================== */ /* capaGrammarDef.y created by Isaac Tsai */ -/* 1998, 1999 copyrighted by Isaac Tsai */ +/* 1998, 1999 by Isaac Tsai */ /* no longer there is a length constrain on string concatenation July 13 1998 */ /* /RMAP() function */ /* TODO: new mechanism to collect answer informations */ @@ -226,7 +250,7 @@ statement : IDENTIFIER '=' calc_expr case IDENTIFIER: case I_VAR: case I_CONSTANT: case R_VAR: case R_CONSTANT: break; - case S_VAR: case S_CONSTANT: + case S_VAR: case S_CONSTANT: /* free up original used spaces */ capa_mfree($1->s_str); $1->s_str = NULL; break; default: break; } @@ -680,6 +704,7 @@ map_expr : startM '(' basic_constr ' a_sp=build_array_list($5,$7->s_argc); result=do_map(key, a_sp->s_argp, $7->s_argp, a_sp->s_argc, FORWARD_MAP); free_arglist(a_sp->s_argp); + a_sp->s_argp=NULL; } else { sprintf(warn_msg,"/MAP arg. counts are not matched.\n"); capa_msg(MESSAGE_ERROR,warn_msg); @@ -691,7 +716,9 @@ map_expr : startM '(' basic_constr ' capa_msg(MESSAGE_ERROR,warn_msg); } free_arglist($5->s_argp); - free_arglist($7->s_argp); + $5->s_argp=NULL; + free_arglist($7->s_argp); + $7->s_argp=NULL; } | startR '(' basic_constr ';' var_list ';' arg_list ')' { char key[SMALL_LINE_BUFFER]; @@ -709,6 +736,7 @@ map_expr : startM '(' basic_constr ' a_sp=build_array_list($5,$7->s_argc); result=do_map(key, a_sp->s_argp, $7->s_argp, a_sp->s_argc, FORWARD_MAP); free_arglist(a_sp->s_argp); + a_sp->s_argp=NULL; } else { sprintf(warn_msg,"/RMAP arg. counts are not matched.\n"); capa_msg(MESSAGE_ERROR,warn_msg); @@ -720,7 +748,9 @@ map_expr : startM '(' basic_constr ' capa_msg(MESSAGE_ERROR,warn_msg); } free_arglist($5->s_argp); + $5->s_argp=NULL; free_arglist($7->s_argp); + $7->s_argp=NULL; } ; @@ -772,6 +802,7 @@ basic_constr : FUNCTION_ID '(' ')' { $$ = do_function(tmp, $3->s_argc, $3->s_argp); capa_mfree(FuncStack[Func_idx].s_name); free_arglist($3->s_argp); + $3->s_argp=NULL; } YYDBUG_PR1(" basic_constr <= RETURN FUNCT "); YYDBUG_SYM($$);