'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>] ]An entity which stores a string of characters. Most characters are valid but no white-spaces are accepted from the command line. The 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. For example
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.
See also ``prnt'' and ''How to write values to a file''.