EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: sequencer problem with parsing "i=0, j=0"
From: [email protected] (William Lupton)
To: [email protected]
Date: Tue, 13 Jan 1998 15:52:49 -1000
----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 13

Dear all,

  The sequencer problem that turned "i=0, j=0" into "i=0" has been fixed.
I attach a patch file relative to the R3.13.0Beta11 release. The fix will
(I assume) be present in the next Beta release.

  If you don't want to patch your version of the sequencer, you can rest
assured that the above is the only circumstance under which the problem
occurred, and you can avoid it by re-coding to use multiple statements.

  Thanks,

  William
----------
X-Sun-Data-Type: default
X-Sun-Data-Name: comma.patch
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 177

Index: r3.13/base/src/sequencer/gen_ss_code.c
diff -c r3.13/base/src/sequencer/gen_ss_code.c:1.1.1.1 r3.13/base/src/sequencer/gen_ss_code.c:1.3
*** r3.13/base/src/sequencer/gen_ss_code.c:1.1.1.1	Thu Oct  9 15:30:37 1997
--- r3.13/base/src/sequencer/gen_ss_code.c	Tue Jan 13 15:48:33 1998
***************
*** 10,15 ****
--- 10,16 ----
  28apr92,ajk	Implemented efClear() & efTestAndClear().
  01mar94,ajk	Changed table generation to the new structures defined 
  		in seqCom.h.
+ 13jan98,wfl	Fixed handling of compound expressions, using E_COMMA.
  ***************************************************************************/
  #include	<stdio.h>
  #include	"parse.h"
***************
*** 250,256 ****
  int		level;		/* indentation level */
  {
  	Expr		*epf;
! 	int		nparams;
  	extern int	reent_opt;
  	extern int	line_num;
  
--- 251,257 ----
  int		level;		/* indentation level */
  {
  	Expr		*epf;
! 	int		nexprs;
  	extern int	reent_opt;
  	extern int	line_num;
  
***************
*** 354,366 ****
  		if (special_func(stmt_type, ep, sp))
  			break;
  		printf("%s(", ep->value);
! 		for (epf = ep->left, nparams = 0; epf != 0; epf = epf->next, nparams++)
  		{
! 			if (nparams > 0)
  				printf(" ,");
  			eval_expr(stmt_type, epf, sp, 0);
  		}
- 		printf(") ");
  		break;
  	case E_ASGNOP:
  	case E_BINOP:
--- 355,370 ----
  		if (special_func(stmt_type, ep, sp))
  			break;
  		printf("%s(", ep->value);
! 		eval_expr(stmt_type, ep->left, sp, 0);
! 		printf(") ");
! 		break;
! 	case E_COMMA:
! 		for (epf = ep->left, nexprs = 0; epf != 0; epf = epf->next, nexprs++)
  		{
! 			if (nexprs > 0)
  				printf(" ,");
  			eval_expr(stmt_type, epf, sp, 0);
  		}
  		break;
  	case E_ASGNOP:
  	case E_BINOP:
***************
*** 483,489 ****
  	    case F_EFCLEAR:
  	    case F_EFTESTANDCLEAR:
  		/* Event flag funtions */
! 		gen_ef_func(stmt_type, ep, sp, fname);
  		return TRUE;
  
  	    case F_PVPUT:
--- 487,493 ----
  	    case F_EFCLEAR:
  	    case F_EFTESTANDCLEAR:
  		/* Event flag funtions */
! 		gen_ef_func(stmt_type, ep, sp, fname, func_code);
  		return TRUE;
  
  	    case F_PVPUT:
***************
*** 520,526 ****
  		 * Note:  name is changed by prepending "seq_". */
  		printf("seq_%s(ssId", fname);
  		/* now fill in user-supplied paramters */
! 		for (ep1 = ep->left; ep1 != 0; ep1 = ep1->next)
  		{
  			printf(", ");
  			eval_expr(stmt_type, ep1, sp, 0);
--- 524,533 ----
  		 * Note:  name is changed by prepending "seq_". */
  		printf("seq_%s(ssId", fname);
  		/* now fill in user-supplied paramters */
! 		ep1 = ep->left;
! 		if (ep1 != 0 && ep1->type == E_COMMA)
! 			ep1 = ep1->left;
! 		for (; ep1 != 0; ep1 = ep1->next)
  		{
  			printf(", ");
  			eval_expr(stmt_type, ep1, sp, 0);
***************
*** 547,552 ****
--- 554,561 ----
  	Chan		*cp;
  
  	ep1 = ep->left; /* ptr to 1-st parameters */
+ 	if (ep1 != 0 && ep1->type == E_COMMA)
+ 		ep1 = ep1->left;
  	if ( (ep1 != 0) && (ep1->type == E_VAR) )
  		vp = (Var *)findVar(ep1->value);
  	else
***************
*** 586,591 ****
--- 595,602 ----
  	int		index;
  
  	ep1 = ep->left; /* ptr to 1-st parameter in the function */
+ 	if (ep1 != 0 && ep1->type == E_COMMA)
+ 		ep1 = ep1->left;
  	if (ep1 == 0)
  	{
  		fprintf(stderr, "Line %d: ", ep->line_num);
Index: r3.13/base/src/sequencer/phase2.c
diff -c r3.13/base/src/sequencer/phase2.c:1.1.1.1 r3.13/base/src/sequencer/phase2.c:1.3
*** r3.13/base/src/sequencer/phase2.c:1.1.1.1	Thu Oct  9 15:30:37 1997
--- r3.13/base/src/sequencer/phase2.c	Tue Jan 13 15:48:34 1998
***************
*** 15,20 ****
--- 15,21 ----
  01mar94,ajk	Implemented new interface to sequencer (seqCom.h).
  01mar94,ajk	Implemented assignment of array elements to db channels.
  01mar94,ajk	Changed algorithm for assigning event bits.
+ 13jan98,wfl	Supported E_COMMA token (for compound expressions).
  ***************************************************************************/
  /*#define	DEBUG	1*/
  
***************
*** 513,518 ****
--- 514,520 ----
  	case E_SS:
  	case E_STATE:
  	case E_FUNC:
+ 	case E_COMMA:
  	case E_CMPND:
  	case E_STMT:
  	case E_ELSE:
Index: r3.13/base/src/sequencer/snc.y
diff -c r3.13/base/src/sequencer/snc.y:1.1.1.1 r3.13/base/src/sequencer/snc.y:1.3
*** r3.13/base/src/sequencer/snc.y:1.1.1.1	Thu Oct  9 15:30:38 1997
--- r3.13/base/src/sequencer/snc.y	Tue Jan 13 15:48:35 1998
***************
*** 14,19 ****
--- 14,20 ----
  31may94,ajk	Changed method for handling global C code.
  20jul95,ajk	Added "unsigned" types (see UNSIGNED token).
  11jul96,ajk	Added character constants (CHAR_CONST).
+ 13jan98,wfl	Added "down a level" handling of compound expressions
  ***************************************************************************/
  /*	SNC - State Notation Compiler.
   *	The general structure of a state program is:
***************
*** 246,252 ****
  
  expr	/* general expr: e.g. (-b+2*a/(c+d)) != 0 || (func1(x,y) < 5.0) */
  	/* Expr *expression(int type, char *value, Expr *left, Expr *right) */
! :	compound_expr			{ $$ = $1; }
  |	expr binop expr %prec UOP	{ $$ = expression(E_BINOP, $2, $1, $3); }
  |	expr asgnop expr		{ $$ = expression(E_ASGNOP, $2, $1, $3); }
  |	unop expr  %prec UOP		{ $$ = expression(E_UNOP, $1, $2, 0); }
--- 247,253 ----
  
  expr	/* general expr: e.g. (-b+2*a/(c+d)) != 0 || (func1(x,y) < 5.0) */
  	/* Expr *expression(int type, char *value, Expr *left, Expr *right) */
! :	compound_expr			{ $$ = expression(E_COMMA, "", $1, 0); }
  |	expr binop expr %prec UOP	{ $$ = expression(E_BINOP, $2, $1, $3); }
  |	expr asgnop expr		{ $$ = expression(E_ASGNOP, $2, $1, $3); }
  |	unop expr  %prec UOP		{ $$ = expression(E_UNOP, $1, $2, 0); }

Navigate by Date:
Prev: new archiving capabilities for the frequency archiver Bob Dalesio
Next: JOB-OFFER eckart
Index: 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: new archiving capabilities for the frequency archiver Bob Dalesio
Next: JOB-OFFER eckart
Index: 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·