Lard Interpreter li

config module

The config module provides a centralised facility to save the configuration of the modules making up the execution environment.

To save the configuration, set each config_save_modname boolean variable to indicate which modules' configurations should be saved and call config_save with the filename.

Since configuration files are simply files of tcl commands no special mechanism is needed to load a configuration file; just use source to read it in.

Each module that wants to be able to save some aspect of its configuration must add an element to config_save_list and define a config_save_go_modname function.

The module also provides utility functions that individual modules' save functions can call.

User interface

Name config_save
Class command
Syntax config_save filename
Description Open the specified file and for each config_save_modname variable that is set call the coresponding config_save_go_modname function to save that aspect of the configuration.

Module writer's interface

Name config_save_list
Class variable
Description List to which each module that wants to save its configuration should append an element. The element should be a two-element list with the first element giving a short name for the module and the second element giving a longer name that can be used as a prompt for the user.

Name config_save_var
Class command
Syntax config_save_var f varname
Description Write a line of tcl to file f which sets variable varname to its current value.

Name config_save_array
Class command
Syntax config_save_array f arrayname
Description Write a line of tcl to file f which sets array variable arrayname to its current value.