File 'base/dump.tcl' (part of 'Pool_Base')

Description (short)
Dump datastructures into sourceable strings.
Written by
Andreas Kupries
Description
Dump various interpreter information into strings, for save and later restoration. The information is packed into sourceable tcl scripts thus making restauration trivial.
Depends on
Tcl
Keywords
dump datastructures, info dump, procedure dump, namespace dump, variable dump, stack trace, tracing the stack


::pool::dump::callstack (stackName)

Returns a string containing the procedure callstack at the place of the procedures calling
Argument: stackName (= {}) Name given to this trace

::pool::dump::namespace (args)

Dumps a namespace and its contents into a string. Evaluating the string will restore the namespace.
Argument: args A list of options and their values, followed by the name of the namespace. The options known to this procedure are '-proc', '-var', '-ns', '-imports' and '-array'. Allowed values are 'on', 'off' and 'compact'. The single exception to this is '-array', see ::pool::dump::var for more. The value of an option determines whether the associated part of the namespace is dumped (on), left out (off) or in a short form (compact). The latter can be a simple statement (variables, procedures), or a comment (imported commands, nested namespaces).
Returns: A string containing a tcl statement to restore the specified namespace and its contents.

::pool::dump::nsopt (o v)

Internal type checker for all options except '-array'. Accepts 'on', 'off' and 'copmpact'
Argument: o The name of the option to check.
Argument: v The value to check.
Returns: A boolean value. True signals acceptance of v.

::pool::dump::nsvar (args)

Dumps a namespace variable and its contents into a string. Evaluating the string will restore the variable. See ::pool::dump::var too. Expects to be called in the namespace containing the variable.
Argument: args A list of options and their values, followed by the name of the variable. The only option known to this procedure is '-array'. Allowed values are 'compact' and 'verbose', the first is used as default. Only dumping of arrays is affected by this option. In compact format an 'array set' statement will be generated, otherwise a sequence of individual 'set's.
Returns: A string containing a tcl statement to restore the specified variable and its contents.

::pool::dump::proc (procName)

Dumps procedure procName into a string. Evaluating the string in a tcl interpreter will restore the procedure and add it to that interpreter.
Dangers: Qualifying namespaces are removed from the procedure name in the returned statement
Argument: procName The name of the procedure to dump. Absolute and/or relative namespace identifiers are allowed here.
Returns: A string containing a tcl statement to restore the procedure definition.

::pool::dump::var (args)

Dumps a global (or procedure local) variable and its contents into a string. Evaluating the string will restore the variable. See ::pool::dump::nsvar too.
Argument: args A list of options and their values, followed by the name of the variable. The only option known to this procedure is '-array'. Allowed values are 'compact' and 'verbose', the first is used as default. Only dumping of arrays is affected by this option. In compact format an 'array set' statement will be generated, otherwise a sequence of individual 'set's.
Returns: A string containing a tcl statement to restore the specified variable and its contents.

::pool::dump::varopt (o v)

Internal type checker for option '-array'. Accepts only 'verbose' and 'copmpact'
Argument: o The name of the option to check.
Argument: v The value to check.
Returns: A boolean value. True signals acceptance of v.


Generated by AutoDoc 2.4 at 09/14/2000, invoked by Andreas Kupries