diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2018-01-13 15:23:38 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2018-01-13 15:23:38 (GMT) |
commit | ecaec63f48c02c5bb7c0e7585ebc1d746b77ffd9 (patch) | |
tree | 1ddfc8af501ec8aa9e30ef20967955c2f5323200 /library/msgcat | |
parent | e1ffd3f0057b68e75bce64f9c514b9993fb8a79c (diff) | |
download | tcl-ecaec63f48c02c5bb7c0e7585ebc1d746b77ffd9.zip tcl-ecaec63f48c02c5bb7c0e7585ebc1d746b77ffd9.tar.gz tcl-ecaec63f48c02c5bb7c0e7585ebc1d746b77ffd9.tar.bz2 |
Extended command msgcat::mcexists by switch "-namespace ns" to explicitly specify namespace
Diffstat (limited to 'library/msgcat')
-rw-r--r-- | library/msgcat/msgcat.tcl | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 29ccf0a..e57802b 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -265,23 +265,31 @@ proc msgcat::mcexists {args} { variable Loclist variable PackageConfig - set ns [PackageNamespaceGet] - set loclist [PackagePreferences $ns] - while {[llength $args] != 1} { set args [lassign $args option] switch -glob -- $option { - -exactnamespace { set exactnamespace 1 } - -exactlocale { set loclist [lrange $loclist 0 0] } + -exactnamespace - -exactlocale { set $option 1 } + -namespace { + if {[llength $args] < 2} { + return -code error\ + "Argument missing for switch \"-namespace\"" + } + set args [lassign $args ns] + } -* { return -code error "unknown option \"$option\"" } default { return -code error "wrong # args: should be\ \"[lindex [info level 0] 0] ?-exactnamespace?\ - ?-exactlocale? src\"" + ?-exactlocale? ?-namespace ns? src\"" } } } set src [lindex $args 0] + + if {![info exists ns]} { set ns [PackageNamespaceGet] } + + set loclist [PackagePreferences $ns] + if {[info exists -exactlocale]} { set loclist [lrange $loclist 0 0] } while {$ns ne ""} { foreach loc $loclist { @@ -289,7 +297,7 @@ proc msgcat::mcexists {args} { return 1 } } - if {[info exists exactnamespace]} {return 0} + if {[info exists -exactnamespace]} {return 0} set ns [namespace parent $ns] } return 0 |