[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/mal mal_session.mx, , 1.186, 1.187

Sjoerd Mullender sjoerd at acm.org
Tue Apr 14 13:34:47 CEST 2009


Should this have been done on the stable branch?

Martin Kersten wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/mal
> In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv30687
> 
> Modified Files:
> 	mal_session.mx 
> Log Message:
> On the console it could happen that a MAL syntax error caused a crash
> in the next statement due to incomplete cleanup.
> 
> 
> U mal_session.mx
> Index: mal_session.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_session.mx,v
> retrieving revision 1.186
> retrieving revision 1.187
> diff -u -d -r1.186 -r1.187
> --- mal_session.mx	2 Apr 2009 17:51:41 -0000	1.186
> +++ mal_session.mx	11 Apr 2009 07:07:48 -0000	1.187
> @@ -495,10 +495,14 @@
>  table may have grown in size.
>  
>  @= restoreState
> -	if( c->listing) 
> -		printFunction(c->fdout,c->curprg->def, 0, c->listing);
> -	MSresetVariables(c,c->curprg->def, c->glb, oldstate.vtop);
> -	resetMalBlk(c->curprg->def,oldstate.stop);
> +{	int i;
> +	for ( i=1; i<c->curprg->def->vtop; i++)
> +		freeVariable(c->curprg->def,i);
> +	GDKfree(c->glb);
> +	c->glb = NULL;
> +	c->curprg->def->vtop = 1;
> +	MSinitClientPrg(c,"user", "main");
> +}
>  @c
>  str
>  MALinitClient(Client c)
> @@ -511,15 +515,9 @@
>  str
>  MALexitClient(Client c)
>  {
> -	int i;
>  	if (c->glb && c->curprg->def->errors == 0) 
>  		garbageCollector(c, c->curprg->def, c->glb,TRUE);
> -	for ( i=1; i<c->curprg->def->vtop; i++)
> -		freeVariable(c->curprg->def,i);
> -	GDKfree(c->glb);
> -	c->glb = NULL;
> -	c->curprg->def->vtop = 1;
> -	MSinitClientPrg(c,"user", "main");
> +	@:restoreState@
>  	return NULL;
>  }
>  
> @@ -547,18 +545,20 @@
>  str
>  MALparser(Client c)
>  {
> -	InstrPtr p;
>  	MalBlkRecord oldstate;
>  
>  	c->curprg->def->errors = 0;
>  	oldstate = *c->curprg->def;
>  
>  	prepareMalBlk(c->curprg->def, CURRENT(c));
> -	if (parseMAL(c, c->curprg) || c->curprg->def->errors) {
> +	if (parseMAL(c, c->curprg) || c->curprg->def->errors ||
> +		getInstrPtr(c->curprg->def, 0)->token != FUNCTIONsymbol ){;
>  		/* just complete it for visibility */
>  		pushEndInstruction(c->curprg->def);
>  		/* caught errors */
>  		showErrors(c);
> +		if( c->listing) 
> +			printFunction(c->fdout,c->curprg->def, 0, c->listing);
>  		@:restoreState@
>  		/* now the parsing is done we should advance the stream */
>  		c->fdin->pos += c->yycur;
> @@ -577,15 +577,12 @@
>  	if (c->curprg->def->stop == 1)
>  		return MAL_SUCCEED;
>  
> -	p = getInstrPtr(c->curprg->def, 0);
> -	if (p->token != FUNCTIONsymbol) {
> -		@:restoreState@
> -		throw(MAL, "MAL.parser", "Function signature missing");
> -	}
>  	pushEndInstruction(c->curprg->def);
>  	chkProgram(c->nspace, c->curprg->def);
>  	if (c->curprg->def->errors) {
>  		showErrors(c);
> +		if( c->listing) 
> +			printFunction(c->fdout,c->curprg->def, 0, c->listing);
>  		@:restoreState@
>  		throw(MAL, "MAL.parser", "Semantic errors detected");
>  	}
> @@ -619,6 +616,7 @@
>  
>  	if (prg->def->errors > 0) {
>  		showErrors(c);
> +		/* constructed MAL programs may not have been shown */
>  		if (c->listing )
>  			printFunction(c->fdout, c->curprg->def, 0, c->listing);
>  		@:restoreState@
> @@ -651,8 +649,6 @@
>  		str place = getExceptionPlace(msg);
>  		showException(getExceptionType(msg), place, getExceptionMessage(msg));
>  		GDKfree(place);
> -		if (!c->listing)
> -			printFunction(c->fdout, c->curprg->def, 0, c->listing);
>  		showErrors(c);
>  	}
>  	MSresetVariables(c,prg->def, c->glb, 0);
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Monetdb-checkins mailing list
> Monetdb-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins


-- 
Sjoerd Mullender

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 369 bytes
Desc: OpenPGP digital signature
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20090414/429d47ee/attachment.sig>


More information about the developers-list mailing list