Chapter 3 The Application Description Language

3.5 Compound Types

The ADL supports three compound data types: list, time, and interval. It also supports both multidimensional indexed arrays and one dimensional associative arrays. Arrays are complex data types, however, and are discussed further in a later section (see Section 3.9, "Complex Data Types" page 25).

List

A list is a compound type built up out of expressions of base and compound types. Lists can, therefore, nest. There is no syntactical requirement that all list elements be of the same type. You create lists using the list delimiters ( {} ), and separate list elements with commas.

A list element in a ( {} ) expression can be an expression itself. In this case, the expression is evaluated and the list element is initialized with the result. The list contains the result of evaluating the expression, not the expression.

Note that lists are not objects, and objects cannot be members of lists. Handles to objects, however, are a base type and so can be list members. The empty list denoted by ( {} ) can be used in comparisons and to initialize lists.
List examples
{'Monday, 'Tuesday, 'Wednesday, 'Thursday, 'Friday }
{'ClipA, {0, max+1} }
{ dayOfMonth, month, year }

Time

A time is an ordered 4-tuple of integers representing a period of time, and is not meant to be used for absolute (real) time. A time consists of numbers of hours, minutes, seconds, and milliseconds, and can be either positive or negative.

Time constants consist of from one to four integers separated by colons. If only one number is given, a colon must precede it. The four numbers correspond to hours, minutes, seconds, and milliseconds. If fewer than four numbers are given, then they are assumed to be the less significant (and more precise) components of a time (i.e., 3:4 is taken to mean 3 seconds and 4 milliseconds). White space between the parts of a time constant is not allowed.

All times are kept in standard form: milliseconds are between 0 and 999, minutes and seconds are between 0 and 59. This means that constants such as 90:0 are automatically converted to 1:30:0 internally. If any integer in a time constant is negative, all integers forming the constant must be negative or 0, so that -1:-30:0 is legal but -1:30:0 is not legal.

Interval

An interval is an ordered pair of integers or real numbers with an associated open or closed condition for each half of the pair. You can convert appropriately formatted lists consisting of

{ {boolean, integer|real}, {boolean, integer|real} }

or

{ {boolean, time}, {boolean, time} }

to intervals, and vice versa. Note that this alternate representation of an interval consists of a two part list of lists. Each sublist contains a boolean and either a real, an integer, or a time. A TRUE value corresponds to the closed condition, and a FALSE corresponds to the open condition. You can represent the interval constant as follows:

A parenthesis indicates an open condition, and a square bracket indicates a closed condition. The interval variable is assigned only as a unit. You can access and alter the interval endpoints and the associated open and closed conditions only by using the corresponding list form of the interval, or a built-in function. An interval appears in expressions only if it uses the special relational operator ( : ),pronounced in.

integer|real|time : interval

Such a (sub)expression evaluates to TRUE if and only if the left argument falls within the interval defined by the right argument. Interval expressions are intended primarily to test whether the current value of a state object falls within a particular range. See the example of interval usage in Figure 3.3.
Sample Interval Usage
4 : [0,9] // returns TRUE
interval range;

integer frame;
range = (0 , 54000];

frame = 999;
if ( frame : range )
{ /* Do this */ }


AM2 Documentation - 19 NOV 1996

Generated with Harlequin WebMaker