Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: snc/seq enhancements ... local-variable access
From: "J. Lewis Muir" <jlmuir@anl.gov>
To: "Laznovsky, Michael" <lazmo@slac.stanford.edu>
Cc: tech-talk@aps.anl.gov
Date: Tue, 04 Apr 2006 11:43:27 -0400
Hi, Mike.

A feature I would like is for snc to not generate warning messages for variables that are defined in other included source files. For example:

Warning: variable "asynSuccess" is used but not declared.

I get this message at compile time if I'm using the asyn module and want to check the return status of an asyn function call from the SNL program. asynSuccess is defined as an asynStatus enum value in asynDriver.h which I have included in my SNL program.

These warnings are common when defines or enums or whatever are defined in other files and one wants to reference them from the SNL program.

Similarly, I'd like to be able to use defines for declaring SNL char arrays. For example, it would be great if I could have a file color.h that has

#define MAX_COLOR_NAME_SIZE 21

and then in the SNL program be able to do

char colorName[MAX_COLOR_NAME_SIZE];

This allows me to have the SNL program and other C code make use of this MAX_COLOR_NAME_SIZE define so that it can be defined in just one place.

And lastly, I'd like it if SNL supported a "void *" declaration type so that one could declare generic pointers rather than using "char *" for this.

Thanks for all your work on snc/seq!

-lewis

Laznovsky, Michael wrote:

Greetings EPICS fans- I'm sending this email to solicit suggestions and comments for some snc/seq enhancements I'm working on, in this case support for access to local variables within sequence code.

Access is provided by show/get/put functions, and also via special PVs when a small database is added to the IOC. Progress thus far includes snc producing the required data structures and the aformentioned seq functions. For example, the following illustrates a set of declarations in a source file and the output of a series of "seqVarShow" calls:

	char         errmsg[256];
	char        *pbuf;
	char        *pbuf2;

	short        n;
	int          xyz[5][10];
	unsigned int m;
	long         foo;

	float        a;
	double       z;
.....

Get thread ID:

	epics> seqShow
	Program Name     Thread ID  Thread Name      SS Name
	zz99Control      1e7a80     zz99seq          zz99_ctrl

"seqVarShow" with no arguments displays all local variables in all state programs (or you can provide the thread id as an argument to limit output):

	epics> seqVarShow
	Program: zz99Control
	  Name                  Type            [n][n]  Address Value
	  -----------------------------------------------------------
	  errmsg                char            [256]   1e5334  "0"
	  pbuf                  char *                  1e5434  (NULL)
	  pbuf2                 char *                  1e5438  192270 -> "90 0 34 ..."
	  n                     short                   1e5448  "-77"
	  xyz                   int             [5][10] 1e5536  "3"
	  m                     unsigned int            1e544c  "1"
	  foo                   long                    1e5330  "0"
	  a                     float                   1e543c  "1.0"
	  z                     double                  1e5328  "0.1873811581904769"

"seqVarGet" with thread ID and variable name displays just that variable:

	epics> seqVarGet 1e7a80,"z"
	"0.9685835438816328"

"seqVarPut" with thread ID, variable name, and value (as string) modifies the variable:

	epics> seqVarPut 1e7a80,"m","33"
	epics> seqVarGet 1e7a80,"m"
	"33"

Things to note (all preliminary at this point):

Both reentrant and non-reentrant cases are properly handled.

Variables of type "pointer" are resolved, so that the objects pointed to are get/put, rather than the pointers themselves (unless the pointer is NULL). Maybe provide a way to alter the pointer itself?

Character arrays (strings) are displayed/entered as numeric byte sequences (could be selectable?).

Need a general way to get at arbitrary array elements. Currently only the first element is accessible.

While local variables are file-scoped (and thus shared by all state sets within a given source file) the only way I see to uniquely identify a collection of them is via a "thread ID"... "program name", "thread name", and "SS name" are all potentially subject to collisions when multiple sequences are loaded and/or invoked.

Short-term future plans include database and EDM display infrastructure to support run-time debugging of state programs, including state single-stepping and forced out-of-order transitions.

Feedback welcomed.

Mike



Replies:
Re: snc/seq enhancements ... local-variable access Benjamin Franksen
References:
snc/seq enhancements ... local-variable access Laznovsky, Michael

Navigate by Date:
Prev: Re: snc/seq enhancements ... local-variable access Tim Mooney
Next: Re: snc/seq enhancements ... local-variable access Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
Navigate by Thread:
Prev: Re: snc/seq enhancements ... local-variable access Tim Mooney
Next: Re: snc/seq enhancements ... local-variable access Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·