Home

Documentation

Project Support

Changes in Version 2 of GraspSwCommandSyntax

Author:
isani
Timestamp:
Thu Feb 4 08:11:01 2010

Legend:

Unmodified
Added
Removed
Modified
  • GraspSwCommandSyntax

    v1 v2
    1 1  '''II. [wiki:GraspSw STARGRASP Software Command Syntax Notes]''' 
    2 2  [[TracNav(GraspContents)]] 
    3 3  A '''command''' and '''argument=value''' syntax is used throughout the layers of STARGRASP software.  This applies to the [wiki:GraspSwDemoScripts demo scripts] (written in Bourne Shell), the [wiki:GraspSwToolkit toolkit level commands] which can be executed on a "command line" or from your favorite scripting language, and the [wiki:GraspSwControllerCmd ASCII socket level interface implemented on the controller].  (It does not apply to the C API where the interface is a standard C-Language function call interface.)  The following general rules apply: 
    4 4   * Arguments always follow the command. 
    5 5   * Order is not important(*) 
    6 6   * Do '''not''' include dashes "-" or "--" in front of the argument. 
    7 7   * Do '''not''' include white space around the equal sign ("=") 
    8 8   * Enclose white space in a value with double quotes (or quotes appropriate for the scripting language you are using.) 
    9 9  Examples: 
    10 10  {{{ 
    11 11  go nexp=3 etype=DARK comment="Some comment string w/ spaces"  GOOD 
    12 12  go 3                                                          Not recommended 
    13    go nexp = 3                                                   WRONG go nexp = 3                                                   WRONG 
      13  go nexp = 3                                                   WRONG go nexp = 3                                                   WRONG! 
    13    go nexp=3 etype=DARK comment=Some comment string              WRONG go nexp=3 etype=DARK comment=Some comment string              WRONG 
      13  go nexp=3 etype=DARK comment=Some comment string              WRONG go nexp=3 etype=DARK comment=Some comment string              WRONG! 
    13 13  }}} 
      14   
      15  === Sticky Arguments === 
      16   
      17  Some options are "sticky", or have separate commands that set a default.  The effect is the same in either case.  If you leave out the option, either the default set with the other command applies, or the last used "sticky" value applies.  See the documentation on the various layers of software for details.  In many cases, it is best to be explicit and send all relevant options each time, especially from a script.  The extra overhead to transmit and process the arguments is not significant. 
      18   
      19  Examples: 
      20  {{{ 
      21  readout dev=0 bpp=16 
      22  }}} 
      23  is equivalent to: 
      24  {{{ 
      25  dev 0 
      26  readout bpp=16 
      27  }}} 
      28  However, this only works if there happens to be a separate command implemented to set the option default.  As a case in point, there is no "bpp" command so 
      29  {{{ 
      30  bpp 16              WRONG! (no such command implemented) 
      31  }}} 
      32   
    14 33  ---- 
    15 34  (*) The only time order is important is when using a shorthand in which only the '''value''' is given (i.e., no '''argument''' and no '''=''').  In this case, the command parser falls back on positional rules.  This syntax is not recommended, because the full syntax is more explicit, provides a level of self-documentation in scripts, and is easier to make sense of in network traces.