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  2012  2013  2014  2015  2016  <2017 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
<== Date ==> <== Thread ==>

Subject: RE: waveform arrays within SNL
From: Al Honey <ahoney@keck.hawaii.edu>
To: 'Benjamin Franksen' <benjamin.franksen@helmholtz-berlin.de>, "'tech-talk@aps.anl.gov'" <tech-talk@aps.anl.gov>
Date: Thu, 22 Jun 2017 18:12:31 +0000
Yes, Thank you.
Kay K gave  me the solution (strcpy of indexed elements) :^)


-----Original Message-----
From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Benjamin Franksen
Sent: Thursday, June 22, 2017 3:13 AM
To: 'tech-talk@aps.anl.gov'
Subject: Re: waveform arrays within SNL [faked-from]

On 20.06.2017 23:42, Al Honey wrote:
> But the other waveform record holds an array of strings -
field(FTVL,"STRING") - and continues to thwart me.
>
> caput k1:osiris:ss1:posnames "one two three four"
> caget k1:osiris:ss1:posnames
> k1:osiris:ss1:posnames 4 one two three four
>
> Trrying what I think is correct in SNL, I get compilation errors:
>
> #define MAX_ENTRIES 100
>
> string posnames[MAX_ENTRIES];
> assign posnames to "{tel}{instr}:{mech}:posnames";  // this is the
'string' waveform record
>
> local variable is:
> string names[4] = { "0.100", "0.050", "0.035", "0,020" };
>
> state STARTUP {
> entry {
>         for (idx=0; idx<4; idx++ ) posnames[idx] = names[idx];
>         pvPut( posnames );
> }
> .
> .
> .
> }
>
> error: incompatible types when assigning to type string from type char *
>            posnames[idx] = names[idx];

The SNL type 'string' is compiled to 'char[40]' in C. The assignment in the loop body is therefore not valid C. Using strcpy or one of its variants should work.

Cheers
Ben
-- "Make it so they have to reboot after every typo." ― Scott Adams


References:
waveform arrays within SNL Al Honey
RE: waveform arrays within SNL Mark Rivers
RE: waveform arrays within SNL Al Honey
Re: waveform arrays within SNL Benjamin Franksen

Navigate by Date:
Prev: Re: waveform arrays within SNL Benjamin Franksen
Next: Problem compiling EPICS ioc with libusb Sam de Jong
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
Navigate by Thread:
Prev: Re: waveform arrays within SNL Benjamin Franksen
Next: Re: waveform arrays within SNL Southern, Tim
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
ANJ, 22 Jun 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·