Am Donnerstag, 9. Mai 2013, 21:20:00 schrieb Joe Sullivan:
> SNC evflags used to be made available to escaped C code via #define
>
> ---------------------------------------------------------------------
> /* SNC Version 2.0.12: Wed Jun 16 13:13:56 2010: batch_scan_v3.i */
> /* Event flags */
> #define updateTime 1
> #define modeChange 2
> #define positioner1Done 3
> #define positioner2Done 4
> #define positioner3Done 5
> ---------------------------------------------
>
> Now the 'enums' are defined in-line in sequence code but not in
> escaped C functions where they become undefined variables.
>
> # line 2107 "../batch_scan_v3.st"
> seq_efSet(ssId, 3/*positioner1Done*/);
>
> Was this done on purpose?
It is always fascinating what uses people find for stuff once it exists...
I simply did not imagine that use case! The change was done simply to bring
event flags in line with how variables are treated (which you cannot directly
use in embedded C code for similar reasons).
Obviously that was flawed thinking on my part. Because for variables there is
pvIndex function, which unfortunately refuses to work with event flags. But
this is actually not a big problem, because you can just leave it off, see
below.
> What is the best way around this?
There is indeed a trick which works: you pass the event flag to your C
function as a value of type EV_ID (which is a synonym for 'unsigned' but that
need not concern you):
program event_flag_in_c_func
evflag x;
%{
static void efSet_x(SS_ID ssId, EV_ID x)
{
seq_efSet(ssId, x);
}
}%
/* call the C function from SNL code: */
ss myss {
state set_flag {
when () {
efSet_x(ssId, x);
} state check_flag
}
state check_flag {
when (delay(0.5)) {
printf("oops, timeout, didn't work\n");
} exit
when (efTest(x)) {
printf("cool, we came here, means it worked\n");
} exit
}
}
Cheers
--
Ben Franksen
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachm€nts
________________________________
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
Sitz Berlin, AG Charlottenburg, 89 HRB 5583
Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
http://www.helmholtz-berlin.de
- References:
- SNC: evflags not available to escaped C Joe Sullivan
- Navigate by Date:
- Prev:
Re: new archiver problem James F Ross
- Next:
Re: Re: epicsTimeGetEvent failed Geon-Yeong Mun
- 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:
SNC: evflags not available to escaped C Joe Sullivan
- Next:
National Instruments PCI DAQmx Rafael Vescovi
- 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
|