diff options
author | andreas_kupries <akupries@shaw.ca> | 2009-11-05 19:35:20 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2009-11-05 19:35:20 (GMT) |
commit | 8f57a0b74ebdd06b863f18306f18ff4790020cf6 (patch) | |
tree | c405c426b906f7d0e8b99c28347f923687b236ad /library/safe.tcl | |
parent | a27ebb15203548a964fd1ff14415b61b853dc154 (diff) | |
download | tcl-8f57a0b74ebdd06b863f18306f18ff4790020cf6.zip tcl-8f57a0b74ebdd06b863f18306f18ff4790020cf6.tar.gz tcl-8f57a0b74ebdd06b863f18306f18ff4790020cf6.tar.bz2 |
* library/safe.tcl: A series of patches which bring the SafeBase
up to date with code guidelines, Tcl's features, also eliminating
a number of inefficiencies along the way.
(4) Moved the multiple namespace eval's around. Command export at
the top, everything else (var decls, argument parsing setup) at
the bottom.
Diffstat (limited to 'library/safe.tcl')
-rw-r--r-- | library/safe.tcl | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/library/safe.tcl b/library/safe.tcl index 0b6cf1c..b6622cf 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: safe.tcl,v 1.22 2009/11/05 19:22:04 andreas_kupries Exp $ +# RCS: @(#) $Id: safe.tcl,v 1.23 2009/11/05 19:35:21 andreas_kupries Exp $ # # The implementation is based on namespaces. These naming conventions are @@ -26,48 +26,9 @@ package require opt 0.4.1 # Create the safe namespace namespace eval ::safe { - # Exported API: namespace export interpCreate interpInit interpConfigure interpDelete \ interpAddToAccessPath interpFindInAccessPath setLogCmd - - #### - # - # Setup the arguments parsing - # - #### - - # Make sure that our temporary variable is local to this namespace. [Bug - # 981733] - variable temp - - # Share the descriptions - set temp [::tcl::OptKeyRegister { - {-accessPath -list {} "access path for the slave"} - {-noStatics "prevent loading of statically linked pkgs"} - {-statics true "loading of statically linked pkgs"} - {-nestedLoadOk "allow nested loading"} - {-nested false "nested loading"} - {-deleteHook -script {} "delete hook"} - }] - - # create case (slave is optional) - ::tcl::OptKeyRegister { - {?slave? -name {} "name of the slave (optional)"} - } ::safe::interpCreate - # adding the flags sub programs to the command program (relying on Opt's - # internal implementation details) - lappend ::tcl::OptDesc(::safe::interpCreate) $::tcl::OptDesc($temp) - - # init and configure (slave is needed) - ::tcl::OptKeyRegister { - {slave -name {} "name of the slave"} - } ::safe::interpIC - # adding the flags sub programs to the command program (relying on Opt's - # internal implementation details) - lappend ::tcl::OptDesc(::safe::interpIC) $::tcl::OptDesc($temp) - # temp not needed anymore - ::tcl::OptKeyDelete $temp } # Helper function to resolve the dual way of specifying staticsok (either @@ -582,11 +543,6 @@ proc ::safe::setLogCmd {args} { } } -namespace eval ::safe { - # internal variable - variable Log {} -} - # ------------------- END OF PUBLIC METHODS ------------ # @@ -1045,3 +1001,47 @@ proc ::safe::AliasEncoding {slave args} { Log $slave $msg error $msg } + + +namespace eval ::safe { + # internal variable + variable Log {} + + #### + # + # Setup the arguments parsing + # + #### + + # Make sure that our temporary variable is local to this namespace. [Bug + # 981733] + variable temp + + # Share the descriptions + set temp [::tcl::OptKeyRegister { + {-accessPath -list {} "access path for the slave"} + {-noStatics "prevent loading of statically linked pkgs"} + {-statics true "loading of statically linked pkgs"} + {-nestedLoadOk "allow nested loading"} + {-nested false "nested loading"} + {-deleteHook -script {} "delete hook"} + }] + + # create case (slave is optional) + ::tcl::OptKeyRegister { + {?slave? -name {} "name of the slave (optional)"} + } ::safe::interpCreate + # adding the flags sub programs to the command program (relying on Opt's + # internal implementation details) + lappend ::tcl::OptDesc(::safe::interpCreate) $::tcl::OptDesc($temp) + + # init and configure (slave is needed) + ::tcl::OptKeyRegister { + {slave -name {} "name of the slave"} + } ::safe::interpIC + # adding the flags sub programs to the command program (relying on Opt's + # internal implementation details) + lappend ::tcl::OptDesc(::safe::interpIC) $::tcl::OptDesc($temp) + # temp not needed anymore + ::tcl::OptKeyDelete $temp +} |