EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: can't initialize record field with string
From: Bruce Hill <[email protected]>
To: haquin <[email protected]>
Cc: [email protected]
Date: Tue, 27 Oct 2009 11:47:26 -0700
Hi Christophe,
I had a similar problem recently, and solved it with another level of indirection. i.e. My genSub inpb was the name of a PV of string type that contained the actual
string I wanted to read into my genSub function.

Hope this helps,
- Bruce Hill


haquin wrote:
Hi Andrew,

Thank you for this clarification.

Initially I wanted to configure a gensub input as a string with number of element >=2 (string array input),
and initialize it with MACRO substitution.

I understand this is not possible because a string is considered as a CA_LINK.

But can you still answer the following questions:
- is it possible to initialize an array with a MACRO (be it numeric or string) ? - is it possible to initialize a string array from the startup script using dbpf command or else ?

regards.


Andrew Johnson a écrit :
Hi Christophe,

On Tuesday 27 October 2009 05:50:55 haquin wrote:
I looked in the genSub record code and I think that what I do should work ... After deeper investigations, it turns out that when I initialize the INPH field type with FTH=STRING or CHAR it is then assigned a CA_LINK type ((*plinkin).type)==CA_LINK instead of CONSTANT ... That's why the Constant
string is not copied at init.

When FTH=LONG then ((*plinkin).type)==CONSTANT

How can I force it to be a CONSTANT

You can't; with the existing database code the link type will be CONSTANT only if the INPH string is a number. This behavior is a fundamental feature of the way in which we parse link strings: If the string is completely consumed by strtod() or strtol() the link type is a CONSTANT; if not and it matches the name of a local PV it's a DB_LINK, otherwise it must be a CA_LINK.

As an alternative to Tim's suggestion you could put one or more dbpf commands in your startup script to set the .H field with your string(s), but they must appear after the iocInit command.

Sorry,

- Andrew

--
Bruce Hill
Member Technical Staff
SLAC National Accelerator Lab
2575 Sand Hill Road M/S 94
Menlo Park, CA  94025



References:
can't initialize record field with string haquin
Re: can't initialize record field with string Tim Mooney
Re: can't initialize record field with string haquin
Re: can't initialize record field with string Andrew Johnson
Re: can't initialize record field with string haquin

Navigate by Date:
Prev: Re: can't initialize record field with string Andrew Johnson
Next: Re: ICALEPCS 2009 Lifetime Achievement Award Paul Sichta
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: can't initialize record field with string Andrew Johnson
Next: ICALEPCS 2009 Lifetime Achievement Award Ned Arnold
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024