Overview | Index by: file name | procedure name | procedure call | annotation

module.tcl Annotations

Created from source/module.tcl
MikroConf modules are regular Tcl packages, that are loaded using the newer "Tcl modules" mechanism. We create a wrapper of this mechanism here, because we need to keep track some extra information regarding MikroConf modules, like the exact dependency tree.
Author:
Alexandros Stergiakis

Procedure Summary
$name { {$arguments} }
          
available { }
          
bgexec { args }
          Wrapper for bgexec.
Catch { level body {msg {}} }
          Convenience procedure that catch and logs
command { name arguments body }
          'proc' wrapper for command handlers, to catch and properly log erros.
exec { args }
          Wrapper for
ferror { explanation index }
          Print an error message with an indication of the erroneous word and generate an error in the context of the caller.
getall { argname }
          From a list named "arguments" in the context of the caller, find and return in the order they appear, all the values of all the instances of key $key.
getpos { argname {index 0} }
          Find the position on the command line where the value for the argument name $argname appears.
getval { argname args }
          
init { }
          Set-up Module
loadall { }
          Load as many modules as possible from the available ones.
loaded { }
          Return all loaded modules in order of first to last
OnError { level {name {}} }
          Convenience procedure that catch and logs
OnError_leave_trace { args }
          
provide { name {ver {}} }
          Declare that a module is provided.
ptyexec { args }
          Wrapper for ptyexec.
puts { args }
          
reloadall { }
          Reload all module code.
require { name args }
          Load a required module, and its dependencies.
reset { name }
          Initialize a module's configuration state.
resetall { }
          Initialize the configuration state of the whole system (all loaded modules).
seval { script }
          Evaluate a script like "eval" but on a Session interpreter.
version { name }
          Return the version of a loaded module.

Procedure Detail

$name

proc $name { {$arguments} }
Defined in:
module.tcl, line 390

available

proc available {  }
Defined in:
module.tcl, line 145

bgexec

proc bgexec { args }
Wrapper for bgexec. Since bgexec is executed in Master thread, which executes one command handler till termination before serving another one, this results to only one bgexec session be run at any time from Master.
Defined in:
module.tcl, line 313

Catch

proc Catch { level body {msg {}} }
Convenience procedure that catch and logs errors
Parameters:
level - Syslog level: Debug Info Notice Warning Error Critical Alert Emergency.
body - The body of code to evaluate on calling scope.
msg - Additional error message to display before that generated by 'error'.
Defined in:
module.tcl, line 401

command

proc command { name arguments body }
'proc' wrapper for command handlers, to catch and properly log erros. Unclassified errors are reported as "Error" severity.
Defined in:
module.tcl, line 383

exec

proc exec { args }
Wrapper for exec.
Defined in:
module.tcl, line 304

ferror

proc ferror { explanation index }
Print an error message with an indication of the erroneous word and generate an error in the context of the caller. @assume cmdline exists on the context of the caller and it is a valid list.
Parameters:
explanation - Explanatory text of the error.
index - List index of the erroneous word. Can point after the list. @error
Defined in:
module.tcl, line 207

getall

proc getall { argname }
From a list named "arguments" in the context of the caller, find and return in the order they appear, all the values of all the instances of key $key. Remove duplicates; keep only the first instance.
Parameters:
key - The name of the key, which values will be looked for.
Returns:
The values for all the instances of $key, returned in the order found in $lst.
Defined in:
module.tcl, line 272

getpos

proc getpos { argname {index 0} }
Find the position on the command line where the value for the argument name $argname appears. $index specifies (zero-based) which among possibly many arguments with same name be returned. Defaults to 0 (the first found). The caller should have a dict "arguments" and a variable "argstart" defined properly.
Parameters:
argname - The argument name whose possition we are looking for.
index - If multiple arguments with $argname name, return the $index one. (zero-based).
Returns:
The position in the command line the value for "argname" appears.
Defined in:
module.tcl, line 230

getval

proc getval { argname args }
Returns:
The key value is key "argname" is present, otherwise $default. @error
Defined in:
module.tcl, line 253

init

proc init {  }
Set-up Module loading.
Defined in:
module.tcl, line 172

loadall

proc loadall {  }
Load as many modules as possible from the available ones. Ignore already loaded, those loaded with different version, and load failures. In effect, try to load as many modules as possible.
Defined in:
module.tcl, line 161

loaded

proc loaded {  }
Return all loaded modules in order of first to last loaded.
Returns:
A list of loaded modules, or empty list if no module is loaded.
Defined in:
module.tcl, line 134

OnError

proc OnError { level {name {}} }
Convenience procedure that catch and logs errors.
Parameters:
level - Either "Ignore" or a syslog severity level: Debug Info Notice Warning Error Critical Alert Emergency. If "Ignore" then errors will not be logged at all.
name - Optional. The name of the proc to apply OnError on. This name is resolved according to namespace rules.
Defined in:
module.tcl, line 345

OnError_leave_trace

proc OnError_leave_trace { args }
Defined in:
module.tcl, line 370

provide

proc provide { name {ver {}} }
Declare that a module is provided. A mere wrapper to "package provide".
Parameters:
args - Same as in "package provide".
Defined in:
module.tcl, line 35

ptyexec

proc ptyexec { args }
Wrapper for ptyexec. One ptyexec session can run for each Session at any time.
Defined in:
module.tcl, line 321

puts

proc puts { args }
Defined in:
module.tcl, line 283

reloadall

proc reloadall {  }
Reload all module code. @error
Defined in:
module.tcl, line 109

require

proc require { name args }
Load a required module, and its dependencies. Sytanx: module require name ?version? strings adhere to the syntax of the "package require" Tcl command. @depends On the syntax for 'package require' sub-command. @assume Any module is loaded on MikroConf start, so that it is possible to print messages to stdout.
Parameters:
args - Arguments according to the syntax specification above
Returns:
returns the version of the package (just loaded or already loaded) @error
Defined in:
module.tcl, line 56

reset

proc reset { name }
Initialize a module's configuration state. All running configuration pertaining to this module will be lost.
Parameters:
name - Name of package @error
Defined in:
module.tcl, line 76

resetall

proc resetall {  }
Initialize the configuration state of the whole system (all loaded modules). @error
Defined in:
module.tcl, line 95

seval

proc seval { script }
Evaluate a script like "eval" but on a Session interpreter. By doing so the script has access to constructs pressent only in a specific Session interpreter. The session Id is found by looking for a variable named 'sid' on the context of the caller. The command returns when the script completes evaluation. Meanwhile the Master's loop is not blocked.
Parameters:
args - Same arguments as "eval". @returns Same as "eval".
Defined in:
module.tcl, line 336

version

proc version { name }
Return the version of a loaded module. @assume Requested module is loaded.
Parameters:
mod - Name of package
Returns:
Version string.
Defined in:
module.tcl, line 126

Overview | Index by: file name | procedure name | procedure call | annotation
File generated 2010-03-13 at 22:28.