g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014 
<== Date ==> <== Thread ==>

Subject: RE: SNL with C
From: "Zelazny, Michael Stanley" <zelazny@slac.stanford.edu>
To: Pierrick Hanlet <hanlet@fnal.gov>
Cc: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Wed, 19 Dec 2012 16:40:17 -0800
I've never tried that.  I'd put it in myFunc.c then add that to my Makefile.  Example:

myApp_SRCS += myFunc.c
________________________________________
From: Pierrick Hanlet [hanlet@fnal.gov]
Sent: Wednesday, December 19, 2012 4:37 PM
To: Zelazny, Michael Stanley
Cc: tech-talk@aps.anl.gov
Subject: Re: SNL with C

Great!  Thank you and Mark.

Another question: if I want to write a C function, I understand that it needs to be
after the last SNL statement.  Does it belong outside of the ss SS1 {} block, or
is it after the last statement within the block.  Is it true that this code would
also need to be escaped %{ short myFunc() {} }%?
Best regards,
Pierrick


On 12/19/2012 06:11 PM, Zelazny, Michael Stanley wrote:

try putting your statement in an "entry" block.  And, as Mark says, the "%%" probably isn't necessary.

ss SS1 {

  state Offline {
    /* Get PV relevent PV information */
    when (SS1mon == 1) {
      SS1state = 1;
      pvPut(SS1state);
    } state Pumping
  }

  state Pumping {
    /* Get PV relevent PV information */
    entry {
    %%if (StateReadCDB()) printf("SS1-Pumping: success\");
    }
    when (SS1vac <= 1.0e-4) {
      SS1state = 2;
      pvPut(SS1state);
    } state Pumped_Warm
  }
... continued
}
________________________________________
From: tech-talk-bounces@aps.anl.gov<mailto:tech-talk-bounces@aps.anl.gov> [tech-talk-bounces@aps.anl.gov<mailto:tech-talk-bounces@aps.anl.gov>] On Behalf Of Pierrick M Hanlet [hanlet@fnal.gov<mailto:hanlet@fnal.gov>]
Sent: Wednesday, December 19, 2012 3:59 PM
To: tech-talk@aps.anl.gov<mailto:tech-talk@aps.anl.gov>
Subject: SNL with C

Hi,
I a newcomer to SNL.

I have a library to which I link my snl.  In a global entrance block, I can successfully call
one of the functions.  Later I added the use of another function in a state set and now
I can no longer compile.

ss SS1 {

  state Offline {
    /* Get PV relevent PV information */
    when (SS1mon == 1) {
      SS1state = 1;
      pvPut(SS1state);
    } state Pumping
  }

  state Pumping {
    /* Get PV relevent PV information */
    %%if (StateReadCDB()) printf("SS1-Pumping: success\");
    when (SS1vac <= 1.0e-4) {
      SS1state = 2;
      pvPut(SS1state);
    } state Pumped_Warm
  }
... continued
}


The error at compilation/linking is:
converting ../sncMICEStates.stt
/home/epics/epics/Support/seq/bin/linux-x86/snc +r   ../sncMICEStates.stt -o sncMICEStates.c.tmp
syntax error: line no. 96 (../sncMICEStates.stt)
     state option list
make[3]: *** [sncMICEStates.c] Error 1
make[3]: Leaving directory `/home/epics/epics/iocTops/MICEStates/MICEStatesApp/src/O.linux-x86'
make[2]: *** [install.linux-x86] Error 2
make[2]: Leaving directory `/home/epics/epics/iocTops/MICEStates/MICEStatesApp/src'
make[1]: *** [src.install] Error 2
make[1]: Leaving directory `/home/epics/epics/iocTops/MICEStates/MICEStatesApp'
make: *** [MICEStatesApp.install] Error 2

where line no. 96 is the escaped call to the library function in my Pumping state.  The error "state option list"
doesn't tell me anything.

Help please,
Pierrick



"Whether you think you can or think you can't, either way, you are correct"
-- Henry Ford

_________________________________________________________________________
Pierrick Hanlet
IIT/Fermilab
+1-630-697-8758 (FNAL)
+1-312-567-5745 (IIT)
+1-630-697-8758/+44-7-948-860-1978 (US/UK mobile)


--
"Whether you think you can or think you can't, either way, you are correct" -- Henry Ford
_______________________________________________________________
Pierrick Hanlet
IIT/Fermilab
+1-630-840-5555 (FNAL)
+1-312-567-5745 (IIT)
+1-630-697-8758/+44-79-48-860-197 (US/UK mobile)


References:
SNL with C Pierrick M Hanlet
RE: SNL with C Zelazny, Michael Stanley
Re: SNL with C Pierrick Hanlet

Navigate by Date:
Prev: Re: SNL with C Pierrick Hanlet
Next: RE: SNL with C Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014 
Navigate by Thread:
Prev: Re: SNL with C Pierrick Hanlet
Next: RE: structs and SNL Zelazny, Michael Stanley
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·