EPICS Controls 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  <20112012  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  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: shell command arguments limitation?
From: Daron Chabot <[email protected]>
To: Jim Chen <[email protected]>
Cc: Eric Norum <[email protected]>, [email protected]
Date: Thu, 21 Apr 2011 15:11:10 -0400
Hi Jim,

IMO, if you have functions with more than 5-6 arguments, you may need to re-examine the structure and behavior of the software.

Beyond the ease-of-reading/aesthetics argument, numerous function arguments is often indicative of a function/method that is trying to do too many things.

I recall an iocsh function that initialized a certain motor controller and had 25 arguments...
I don't want to say this was ugly, but it would have a tough time getting a date to prom.

Would you consider something like this:

int Hy8417AsynInit(char *portName, int vmeSlotNum, int ipSlotNum, int vectorNum);
int Hy8417ADCInit(int samples, int average, int mode, int offset, int clockRate,
                               int extClock, int fastADC, int range, int ChannelNo, int ChannelBit);

Hopefully you could break down the second function even more...


-- dc

On Thu, Apr 21, 2011 at 8:41 AM, Jim Chen <[email protected]> wrote:
Yes Mark, that does do the job. Yet one side effect is that I couldn't pass
VxWorks symbols (such as IPAC3) to my shell command any more, although I can
manually manage the example IPAC3

===========================================
IPAC3 = ipacAddHy8002("3,2")
iocsh()

epics> Hy8417AsynInit("ADC8417", IPAC3, 1, 10, 1000, 1, 1, 0, 9, 0, 0, 0,
16, 16)
illegal integer 'IPAC3'
....
===========================================

I have to do

epics> Hy8417AsynInit("ADC8417", 0, 1, 10, 1000, 1, 1, 0, 9, 0, 0, 0, 16,
16)

and it works fine.

Thanks,

Jim
Hytec Electronics Ltd.
Tel: +44 (0) 118 975 7770
Fax: +44 (0) 118 975 7566
Web: www.hytec-electronics.co.uk
Incorporated in England No 1246940
VAT NO GB 285 2479 27
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


> -----Original Message-----
> From: Mark Rivers [mailto:[email protected]]
> Sent: 21 April 2011 12:03
> To: Jim Chen; Andrew Johnson; [email protected]
> Cc: Eric Norum
> Subject: RE: shell command arguments limitation?
>
> Hi Jim,
>
> I think the vxWorks shell is limited to 10 arguments to function calls.
>
> However, it should work to run iocsh under vWorks, and then you won't
> have the limit.
>
> Try adding a call to iocsh before your call to the 14 argument command.
>
> Mark
>
>
> ________________________________
>
> From: [email protected] on behalf of Jim Chen
> Sent: Thu 4/21/2011 5:39 AM
> To: 'Andrew Johnson'; [email protected]
> Cc: 'Eric Norum'
> Subject: RE: shell command arguments limitation?
>
>
>
> Thanks for all the comments.
>
> I have a configuration which takes 14 arguments to the shell command
> and
> here is the start up printouts:
>
> # For VME/VxWorks
> IPAC3 = ipacAddHy8002("3,2")
> new symbol "IPAC3" added to symbol table.
> IPAC3 = 0x1ed56080: value = 0 = 0x0
>
> #int Hy8417AsynInit(char *portName, int vmeSlotNum, int ipSlotNum, int
> vectorNum,
> #                                       int samples, int average, int
> mode,
> int offset, int clockRate,
> #                   int extClock, int fastADC, int range, int ChannelNo,
> int
> ChannelBit)
> # Settings are:
> #       vmeslot=0, ipslot=5, vector=10, samples=1000, average=1,
> mode=1(trigger), offset=0,
> #   clockrate=9(1kHz), extclock=0(no), fastADC=0(slow mca & EPID),
> range=0(+/-10V),
> #       ChannelNo=16, ChannelBit=16
> Hy8417AsynInit("ADC8417", IPAC3, 1, 10, 1000, 1, 1, 0, 9, 0, 0, 0, 16,
> 16)
> too many arguments to functions.
>
> Done executing startup script /localhome/local/st.cmd
> ->
>
> It complains about "too many arguments to functions."
>
> Interestingly, it doesn't complain in my Linux box.
>
> I remember few years ago we had similar situation with about 18
> arguments in
> a configuration routine, we ended up splitting them into two with the
> first
> one taking 12 and it works fine since.
>
> The test environment: VxWorks 5.5, processor board MVME5500, EPICS
> 3.14.8.2.
> Any ideas please?
>
> Jim
> Hytec Electronics Ltd.
> Tel: +44 (0) 118 975 7770
> Fax: +44 (0) 118 975 7566
> Web: www.hytec-electronics.co.uk
> Incorporated in England No 1246940
> VAT NO GB 285 2479 27
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> > -----Original Message-----
> > From: [email protected] [mailto:tech-talk-
> > [email protected]] On Behalf Of Andrew Johnson
> > Sent: 20 April 2011 18:18
> > To: [email protected]
> > Cc: Eric Norum
> > Subject: Re: shell command arguments limitation?
> >
> > On Wednesday 20 April 2011 12:02:31 Eric Norum wrote:
> > > The ioc shell doesn't call its registered functions with individual
> > >  arguments so the limit you're describing does not exist.  iocsh
> > handler
> > >  functions are called with a single argument -- a pointer to an
> array
> > of
> > >  argument unions.  The only limit that I can see is the amount of
> > memory
> > >  available to hold this array.
> >
> > There may be a limit to the length of the command line buffer which
> > would
> > restrict the number of arguments, but that probably depends on the
> > underlying
> > OS and what the EPICS_READLINE setting is.
> >
> > Jim may have been remembering the arguments to the vxWorks taskSpawn()
> > function, which is limited to 10 arguments.  I'm not aware of a limit
> > in the
> > vxWorks shell either, but there may be one that I haven't come across
> > yet.
> >
> > - Andrew
> > --
> > An error is only a mistake if you don't learn from it.
> > When you learn something from it, it becomes a lesson.
>
>
>





References:
New sequencer bugfix release candidate Benjamin Franksen
RE: shell command arguments limitation? Hu, Yong
Re: shell command arguments limitation? Eric Norum
Re: shell command arguments limitation? Andrew Johnson
RE: shell command arguments limitation? Mark Rivers

Navigate by Date:
Prev: Re: seq-2-0-13-rc2 J. Lewis Muir
Next: Re: PyEpics and Python threads Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: shell command arguments limitation? Jim Chen
Next: Re: seq-2-0-13-rc2 J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·