Arbortext Command Language > Using the Arbortext Command Language > Operands
  
Operands
Operands for expressions are any of the following:
Operands: number
number
A string of decimal digits 0 to 9. A sequence of digits starting with 0 is treated as an octal integer (base 8). A sequence of digits beginning with 0x or 0X is taken as a hexadecimal number (base 16). Hexadecimal digits include a (or A) through f (or F) with decimal values 10 through 15. For example, the number 31 can be written as 037 in base 8 or 0x1f in base 16.
Operands: string
"string"
(Note double quotation marks.) A string in which variable substitution may be done. The usual C-style backslash sequences are recognized in double quoted string literals:
\b backspace
\f formfeed
\n newline
\r carriage return
\t tab
\ddd octal value ddd, where ddd is 1 to 3 digits between 0 and 7
\c any other character taken literally, for example, \" for ", \ ` for ` and \\ for \
'string'
(Note single right quotation marks.) An arbitrary string which is uninterpreted—that is, variables are not substituted.
`string`
(Note single left quotation marks, or back quotes.) A string interpreted as a shell command, and the output of that command (or pipeline) is the value of the operand, as in the Bourne or C-shells. White space in the output (space, tab, and newline) is replaced by single blanks between words. Leading and trailing white space is removed. Variable substitution is performed on the string before it is sent to the shell. The command is executed each time the expression is evaluated.
$name
A variable. Braces may be used to delimit the name from following text when used in a quoted string, (for example, "${tagname}_help").
Note: The dollar sign is not required for variable references inside functions or in scopes outside the main package.
$array [e1]
An array reference. The string value of the expression e1 is used as the array subscript.
name (e1, e2 , . . . )
A built-in function that takes arguments that are expressions.
(*name) (a1, a2 , . . .)
Is an indirect function call. It represents a call to a function whose name is the value of the variable name, which must be a lvalue, that is, either a scalar variable or array element. The function name is looked up in the current package if no package qualifier is given. name may specify either a user-defined or a built-in function. As an example, here is a function that calls another function whose name is given as a parameter:
function callback(func, data)
{if (defined("$func()")){
(*func)(data)}}
The call to defined verifies that the function is defined, since otherwise the script will be aborted if func specifies an unrecognized function name. The indirect function operator is more efficient than using the eval function to build a call to a function. For example:
eval(func .
"(data)")
since it doesn't have to compile an expression every time the function is executed.
Leading white space in a string is ignored in cases where the string is interpreted as a number.
Arbortext Editor uses the dot (.) as a concatenation operator, which allows you to use built-in functions, such as substr, to build strings. This means that for a document named Ch2, an operand such as ${docname}.bak would be interpreted as Ch2bak, and not as Ch2.bak. In cases where this is not desired, you must use quotation marks to indicate that the dot is to be taken literally (for example, "${docname}.bak").
Related Topics
Functions as expressions and commands
Using expressions
Expression operator precedence
Logical expressions