[kepler-users] Literal text with special characters as a StringParameter/Parameter?

Christopher Brooks cxh at eecs.berkeley.edu
Wed Mar 26 10:55:51 PDT 2008


Hi Josep Maria,

By definition, Parameters parse their values.
StringParameter is a subclass of Parameter that is in "string mode",
which does not require double quotes, see the documentation for
ptolemy/data/expr/Variable.java

You could try writing actors that use
ptolemy.kernel.util.StringAttribute for arbitrary strings.  The
ptolemy.actor.lib.python.PythonScript actor uses a StringAttribute for
the Python script.

It might be possible to use StringToken by using readFile() or
readResource() in the expression language.

If you want pass arbitrary scripts around, you could encapsulate them
in an Object and use the ObjectToken.  You could create your own
PerlScriptToken. It is not that hard to define your own Token types,
see ptolemy/actor/lib/security/KeyToken.java.  If you have your own
types, then you get more type safety than you would with ObjectToken.

_Christopher

--------

    Hi community,
    I'm making huge progress on Kepler. Thanks all for this splendid
    program.However, I'm in front another drawback.
    
    I'd like to include special characters (" ' # / $variable ...) in the blank
    space for a StringParameter/Parameter. Exactly I'd like to include a short
    Perl script into it. But Kepler does not allow me to do that! It seem that
    the " quotation marks are a problematic characters, then also the $var word
   =
    s
    are interpreted when I do not want this.
    
    So, is there any way to save an string literally into a Parameter regardles
   =
    s
    their content? Any idea to tackle that?
    
    Also I've look up the functions in the expression language but it seems to
    me there isn't that functionality.  An obvious solution is to have a
    separated Perl file, but I have ruled out this since I have to modify the
    Perl script quite often!
    
    All comments will be appreciated,
    
    Josep Maria,
    
    ---------------------------------------------
    Josep Maria Campanera Alsina
    Juan de la Cierva Researcher
    Departament de Fisicoqu=EDmica
    Facultat de Farm=E0cia
    Avgda Joan XXIII, s/n
    08028 Barcelona =B7 Catalonia =B7 Spain
    Tel: +34 93 4035988
    Fax: +34 93 4035987
    campanera at ub.edu
    --------------------------------------------



More information about the Kepler-users mailing list