valu

   'valu' <name> [[<value>|['push' [<splitkey>]]|'pop'] [nr]] | ->
         [['?'|'&'|'*'|'/'|'+'|'-'|'abs'|'max'|'min'|'pow'|->
          'sqr'|'sin'|'cos'|'tan'|'asin'|'acos'|'atan'] ->
          'int'|'float'|'exp' ->
         [name|<const> name|<const>] ]
A command which generates an entity (called value) which basically stores a string of characters. Most characters are valid but no white-spaces are accepted from the command line. The command allows simple calculations and string operations. It is able to read from- and write to the stack. The cgx command parser will scan each parameter of each command for expressions which match the name of a value and will replace the parameter by the content of the value. After that the command is executed. For example

pnt P0 xvalue 0. 0.

uses the value 'xvalue'. If the user has previously defined the value with:

valu xvalue 1.24

then the command-parser will replace 'xvalue' by '1.24' in the 'pnt' command.

For convenience this general substitution works for all commands except the 'valu' command! The command parser will not scan the parameters of the 'valu' command and will not substitute them. Instead this substitution is performed by the 'valu' command itself. The command does not treat its own name as a value and will not substitute it by previously defined values. Therefore nested levels of 'values' are not solved. However if this functionallity is needed the “val” command can be used.

ATTENTION: To suppress the substitution of a certain value it has to be masked by a leading '\'. For example the command:

del v \xvalue

will delete the value xvalue itself. Without the masking xvalue would be replaced by its content '1.24' and since no value named '1.24' exists, nothing will happen.

The content of a value can be defined by the user

valu arg1 1.24

or derived from the stack previously filled by a command

valu arg1 pop

if the ”stack” was activated. A certain number on the stack can be addressed with

valu arg1 pop 2

were the '2' means that 2 successive 'pops' are executed. In this way the second value on the stack can be loaded at once.

Values can be added to a set

seta valset v all

and can then be deleted by zapping “zap” the set storing the values.

Values can be written to the stack when the 'push' parameter is used:

valu arg1 push

A white-space separated string stored in a “valu” will be written to the stack in separate sub-strings. With this method single pieces of a white-space separated string can be splitted and stored in separate values:

stack on

opens the stack

valu complicatedString push

splits the string stored in 'complicatedString' and writes the single pieces to the stack. The command

valu subString pop 3

loads the 3rd substring into the varible 'subString'. Other splitting characters can be used when this character follows the push key-word:

valu string push .

splits the string at each occurence of “.” and writes the pieces to the stack.

The command is able to perform simple calculations like

valu result * arg1 arg2

'result' will store the product from 'arg1' and 'arg2'. The two arguments arg1 and arg2 may be other 'values' or constant numbers. That means that a direct multiplication of two numbers or a value with a number is possible. During the calulation the strings are converted to double precision numbers and the result is stored as a string representing an exponential number. The 'int', 'float' and 'exp' convert between integer, floating point and exponential format:

valu result int result

The '?' operator is used to request user input:

valu string ?

The command is waiting for user input. Please type into the terminal. Usually this requires to leave the graphics window and click into the terminal from which cgx was started.

The '&' operator is used to concatenate two strings:

valu string3 & string1 string2

The string1 and string2 might be values or constant strings.

The values are written to the fbd file unless its name starts with a '!'.

WARNING: With that command the meaning of a command can be changed and unintended effects are possible. For example if the character 'l' is used as a value it is not longer possible to use the 'plot' command to display lines without masking the 'l'.

The sections ”How to write values to a file”, ”How to process results” and ”How to generate a user dataset” explain more about the use of values.