next up previous contents index
Next: Scalars Up: The Xic Scripting Language Previous: Error Reporting   Contents   Index


Data Types

Variables may be one of several different types. The types that are currently implemented are listed below.

no type
Before a variable receives an assignment, it has no type, but behaves in all respects as a string with a value of the variable name.
string
The string type contains text data.
scalar
Scalars are real numbers that are stored internally in double-precision floating point format. Conversion to integer values, such as for array subscription, is performed automatically where needed.
array
The array type contains a 1-3 dimensional array of numerical values.
complex
The complex type contains real and imaginary double precision floating-point scalar values. Most math functions and operators accept complex values, and return complex values if passed a complex value.
handle
The handle type contains a reference to a complex data object. There are a number of different object types that can be referenced by handles.
zoidlist
Zoidlists contain a list of trapezoids that define spatial regions.
layer_expr
This variable type contains a parse tree for a ``layer expression'' (see 15.1). A layer expression is a logical expression involving layer names.

The type of a variable is determined by its assignment, or in the case of arrays, by declaration. Once a type is assigned, it is generally an error to assign a different type. Exceptions are the undefining of array pointers (to be discussed), the promotion of scalars to handles when a handle is assigned to a scalar, and use of the delete operator to unassign a variable and free its contents.

Variables that are referenced before assignment, or after being operated on by delete, behave as strings with a string value set to the variable name. For example, if an unassigned variable is passed to one of the print functions the name of that variable will be printed.

Type identification of a literal is by context. A quoted quantity is always taken to be a string, e.g., "2.345" is a string. Quote marks can be included in strings by preceding them with a backslash. A number in integer, floating, or exponential format is always taken as a scalar.



Subsections
next up previous contents index
Next: Scalars Up: The Xic Scripting Language Previous: Error Reporting   Contents   Index
Stephen R. Whiteley 2024-09-29