Next: , Previous: , Up: Imperative Language Interpreter   [Index]


5.3 Variables Collections

Interpreted programs may access some of the state of the application via variables.

Variables are introduced to the imperative language interpreter through variables collections (and not through a more flexible context and lookup method specification, like for the expression evaluator).

Variables collections are application wise typeless. They are declared as pointers (to void presumably) and initialized with NULL. A single collection is allowed for program parsing, and it is linked into the parsing context (the struct x1f4_c1_type one) via variable_set.context field of the parsing context.

See struct x1f4_c1_type.

Adding variables to variables collections is convenienced by the x1f4_push_bill, x1f4_push_mode, x1f4_push_real, x1f4_push_text and x1f4_push_variable functions.

See x1f4_push_bill.

See x1f4_push_mode.

See x1f4_push_real.

See x1f4_push_text.

See x1f4_push_variable.

Variables collections may be examined via the x1f4_list_state function.

See x1f4_list_state.

Once variables collections are no longer of use they are to be disposed via the x1f4_air_state function. Executable program representations do refer variables in the variables collection in use during the construction of such representations, hence disposing of variables collections should not occur before the disposal of the executable program representations referring them.

See x1f4_air_state.

The variable collections are regular libaime named objects collections, and can be operated via specific methods. The one exception is their initial NULL state - in this state they are not named objects collections.

See Named Objects Collections.