The SCVD interpreter has built-in evaluation for expressions that are used in various XML elements and attributes. An expression is a combination of operands and Operators that evaluate to a resulting value where the type of the result is derived from the expression.
An operand may be a numeric constant, a variable, a built-in function, a predefined variable, or an expression. Operators are used to combine and compare operands.
Operators combine and compare operands. Operators may be unary (requiring one operand) or binary (requiring two operands). The combination of an operator and its operands is an expression. Parentheses can be used in expressions with multiple operators to specify the order of evaluation. If no parentheses are used in an expression, then the operator precedence determines the evaluation order.
Operators | Precedence | Description |
---|---|---|
( ) | 1 | Parentheses can be used to specify the order of evaluation |
.member | 2 | Type member |
typedef_name:member:enum | 2 | Enumerator value; refer to enum |
typedef_name:member | 2 | Type-member selector for use in __Offset_of intrinsic; refer to member |
Unary +, Unary — | 3 | Unary plus or minus applied to the following operand |
* / % | 4 | Multiplication, Division, or Modulo |
+ — | 5 | Addition, Subtraction |
<< >> | 6 | Shift left, Shift right |
& | ^ | 7 | Binary AND, OR, XOR |
== != > >= < <= | 8 | Comparisons |
&& || | 9 | Logical AND, OR |
e ? e : e | 10 | Conditional operator |
= |= &= ^= += -= *= /= %= | 11 | Assignment operators |
Code Examples
Numeric constants are supported in standard 'C' format, for example: 13, 0xF8, 1.5, 1E+10.
A symbolic enumerator name (enum) represents a constant value that can be referenced using the syntax :typedef_name:member:enum.
The SCVD interpreter has the following ways to define local variables that can be used in expressions:
Predefined variables can be used without a declaration or definition.
Predefined Variable | Description |
---|---|
__Running | Indicates program execution at target: 1=run, 0=stop |
_count | Counts the number of items in readlist and read elements. |
_addr | Returns the memory address of a readlist member. |