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 | |
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.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | library/safe.tcl | 90 |
2 files changed, 53 insertions, 50 deletions
@@ -3,12 +3,15 @@ * 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. - (1) Change all procedure names to be fully qualified. - (2) Move the procedures out of the namespace eval. Keep their - locations. IOW, break the namespace eval apart into small - sectionsnot covering the procedure definitions. - (3) Reindent the code. Just lots of whitespace + (1) Changed all procedure names to be fully qualified. + (2) Moved the procedures out of the namespace eval. Kept their + locations. IOW, broke the namespace eval apart into small sections + not covering the procedure definitions. + (3) Reindented the code. Just lots of whitespace changes. Functionality unchanged. + (4) Moved the multiple namespace eval's around. Command export at + the top, everything else (var decls, argument parsing setup) at + the bottom. 2009-11-02 Kevin B. Kenny <kennykb@acm.org> 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 +} |