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: string fanout or stringout after conditional check?
From: "Zimoch Dirk (PSI)" <dirk.zimoch@psi.ch>
To: Jeong Han Lee <citadel.lee@gmail.com>
Cc: Eric Norum <eric@norum.ca>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Thu, 18 May 2017 21:39:11 +0000
The guard is not strictly necessary. StreamDevice will not overrun the buffer.

In recent versions I have improved string scanning: for example "%#s" reads strings containing white space.

But maybe you want to do more parsing:
in "user,%d,%(\$1)s";
This in an I/O Intr scanned record fetches the number whenever a line starting with "user," is received and sends the last part to a different record.

Dirk



Gruss
Dirk
> Am 18.05.2017 um 17:22 schrieb Jeong Han Lee <citadel.lee@gmail.com>:
> 
> Hi Eric,
>> On 05/18/2017 05:08 PM, Eric Norum wrote:
>> To guard against buffer overrun issues it’s best to specify a maximum
>> length in the protocol entry:
>> read_raw
>> {
>>   in “%39c";
>> }
> 
>  Thanks for your comments.
> 
>> 
>> Or, if the input terminator is set to a single ‘\r’ or ‘\n’ and the
>> device sends a "\r\n” you could use:
>> read_raw
>> {
>>   in “%39[^\r\n]";
>> }
>> 
>  By the way, I have the terminator in "st.cmd" as follows:
> 
>  asynOctetSetInputEos("L0", 0, "\r\n")
> 
>  Thanks,
>  Han
> 
> 
>> 
>>> On May 18, 2017, at 6:37 AM, Jeong Han Lee <citadel.lee@gmail.com
>>> <mailto:citadel.lee@gmail.com>> wrote:
>>> 
>>> I have the bar code scanner, so, the string input is the arbitrary
>>> ascii and numbers from bar codes, generated by myself, whenever I scan
>>> it.
>>> 
>>> For example,
>>> 
>>> case 1 : user,123456789,U002C007
>>> case 2 : ABCDEFGHIZ0123456789
>>> case 3 : office,248795493,M01B21
>>> case 4 : ....
>>> 
>>> case N : SUBMIT
>>> 
>>> Note that case 1..N-1 can be done without order.
>>> 
>>> The scanner has a typical RS232 connection. I wrote the very simple
>>> IOC with asyn and Stream. It has only one record and one function in
>>> db and proto file as follows:
>>> 
>>> --- snip snip ---
>>> 
>>> record(stringin, "$(SYSDEV)RawScanData")
>>> {
>>>   field(DESC, "RAW Scanned data")
>>>   field(DTYP, "stream")
>>>   field( INP, "@scanner.proto read_raw $(PORT)")
>>>   field(SCAN, "I/O Intr")
>>>   field(PINI, "YES")
>>> }
>>> 
>>> read_raw
>>> {
>>>   in "%s";
>>> }
>>> --- snip snip ----------
>>> 
>>> Is this enough?
>>> 
>>>  Thanks,
>>>  Han
>> 
>> --
>> Eric Norum
>> eric@norum.ca <mailto:eric@norum.ca>
>> 
>> 
>> 
>> 

Replies:
Re: string fanout or stringout after conditional check? Eric Norum
Re: string fanout or stringout after conditional check? Jeong Han Lee
References:
string fanout or stringout after conditional check? Jeong Han Lee
Re: string fanout or stringout after conditional check? Ralph Lange
Re: string fanout or stringout after conditional check? Jeong Han Lee
Re: string fanout or stringout after conditional check? Eric Norum
Re: string fanout or stringout after conditional check? Jeong Han Lee

Navigate by Date:
Prev: Re: Streamdevice waveform - binary data stream with no separator Zimoch Dirk (PSI)
Next: Re: string fanout or stringout after conditional check? Eric Norum
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: string fanout or stringout after conditional check? Jeong Han Lee
Next: Re: string fanout or stringout after conditional check? Eric Norum
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, 23 May 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·