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

5.3 Variables Collections

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

The flexible context / lookup method specification was decided against, and for now the way to introduce variables is via variables collections. If ever more flexibles ways for introducing variables will be allowed, the current, variables collection one will still be supported and default.

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 Collection.