Experimental Physics and Industrial Control System
|
There are a number of problems in your example including a couple of fairly fundamental C errors.On Sep 26, 2011, at 2:39 PM, Bradley Pietrzak wrote: Thank you again for your responses. Unfortunately, I have encountered another problem, this time involving code that has been escaped to C. The new version of my program is shown below. Without the re-entrant option, the code runs perfectly fine. With the re-entrant option, however, I am met with several errors. The SNL user's manual says that the SNC automatically refers to variables in the struct UserVar by running the code " pVar->xxx", but that such references have to be handled manually for escaped C code. How do I handle such situations manually?
/* Sample Program */ program sncExample
option +r; /* reentrant */
float i;
float pv; assign pv to "testioc:magnet{mag}";
%{
void helloWorld(i) { <<<<<==== Here you've not specified a type for 'i', so the compiler assumes it to be an 'int'. printf("Hello World! You have just called a C function, and the variable i is %5.1f \n", i); <<<<====== But here you tell printf that the argument being passed to be printed is a double-precision floating point value.
}
}%
ss ss1 {
state one { when() { i = 1; %% helloWorld(i); <<<<===== Reentrant state sets have variables placed into a structure so you need to say %% helloWorld(pVar->i); -- see the SNL manual for details pv = 1; pvPut(pv); sleep(1); } state two }
state two {
when () { i = 2; %% helloWorld(i); pv = 2; pvPut(pv); sleep(1); } state one }
}
Thanks,
Brad Pietrzak
|
- References:
- Re: Combing Two State Sets into One Bradley Pietrzak
- Re: Combing Two State Sets into One Ned Arnold
- Re: Combing Two State Sets into One Bradley Pietrzak
- Navigate by Date:
- Prev:
Re: Combing Two State Sets into One Bradley Pietrzak
- Next:
Re: Combing Two State Sets into One J. Lewis Muir
- Index:
1994
1995
1996
1997
1998
1999
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:
Re: Combing Two State Sets into One Bradley Pietrzak
- Next:
Re: Combing Two State Sets into One J. Lewis Muir
- Index:
1994
1995
1996
1997
1998
1999
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, 18 Nov 2013 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|