William Lupton's fix for i=0,j=0 sequencer bug

This commit is contained in:
rwright
1998-02-04 22:53:03 +00:00
parent 887059f618
commit cba017d4c9
4 changed files with 23 additions and 9 deletions

View File

@@ -10,6 +10,7 @@
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,7 +251,7 @@ Expr *sp; /* ptr to current State struct */
int level; /* indentation level */
{
Expr *epf;
int nparams;
int nexprs;
extern int reent_opt;
extern int line_num;
@@ -354,13 +355,16 @@ int level; /* indentation level */
if (special_func(stmt_type, ep, sp))
break;
printf("%s(", ep->value);
for (epf = ep->left, nparams = 0; epf != 0; epf = epf->next, nparams++)
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 (nparams > 0)
if (nexprs > 0)
printf(" ,");
eval_expr(stmt_type, epf, sp, 0);
}
printf(") ");
break;
case E_ASGNOP:
case E_BINOP:
@@ -483,7 +487,7 @@ Expr *sp; /* current State struct */
case F_EFCLEAR:
case F_EFTESTANDCLEAR:
/* Event flag funtions */
gen_ef_func(stmt_type, ep, sp, fname);
gen_ef_func(stmt_type, ep, sp, fname, func_code);
return TRUE;
case F_PVPUT:
@@ -520,7 +524,10 @@ Expr *sp; /* current State struct */
* 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)
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,6 +554,8 @@ enum fcode func_code;
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,6 +595,8 @@ char *fname; /* function name */
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);

View File

@@ -15,6 +15,7 @@
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,6 +514,7 @@ void *argp; /* ptr to argument to pass on to function */
case E_SS:
case E_STATE:
case E_FUNC:
case E_COMMA:
case E_CMPND:
case E_STMT:
case E_ELSE:

View File

@@ -558,8 +558,8 @@ long seqAuxTask()
{
extern int seqAuxTaskId;
/* Register this task with the EPICS watchdog*/
taskwdInsert(taskIdSelf(),(VOIDFUNCPTR)0, (VOID *)0);
/* Register this task with the EPICS watchdog */
taskwdInsert(taskIdSelf(),(VOIDFUNCPTR)0, (VOID *)0);
/* Set up so all state program tasks will use a common CA context */
ca_task_initialize();
seqAuxTaskId = taskIdSelf(); /* must follow ca_task_initialize() */

View File

@@ -14,6 +14,7 @@
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,7 +247,7 @@ transition /* define a transition ("when" statment ) */
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; }
: 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); }