- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xotcl::package
::xotcl::package create ... \
[ -autoexport (default "") ] \
[ -export (default "") ] \
[ -provide provide ] \
[ -version (default "1.0") ]
Defined in
Class Relations
::nx::Class create ::xotcl::package \ -superclass ::nx::ClassMethods (to be applied on the object)
contains (scripted, public)
xotcl::package contains script
- Parameters:
- script (required)
- Testcases:
- No testcase defined.
if {[info exists :provide]} { package provide [set :provide] [set :version] } else { package provide [::xotcl::self] [set :version] } namespace eval [::xotcl::self] {namespace import ::xotcl::*} #namespace eval [::xotcl::self] $script #::nsf::directdispatch [::xotcl::self] -frame method ::apply [list {} $script [::xotcl::self]] ::apply [list {} $script [::xotcl::self]] foreach e [set :export] { set nq [namespace qualifiers $e] if {$nq ne ""} { namespace eval [::xotcl::self]::$nq [list namespace export [namespace tail $e]] } else { namespace eval [::xotcl::self] [list namespace export $e] } } foreach e [set :autoexport] { namespace eval :: [list namespace import [::xotcl::self]::$e] }create (scripted, public)
xotcl::package create name args [ args... ]
- Parameters:
- name (required)
- args (required)
- Testcases:
- No testcase defined.
set nq [namespace qualifiers $name] if {$nq ne "" && ![namespace exists $nq]} {Object create $nq} nextextend (scripted, public)
xotcl::package extend name args [ args... ]
- Parameters:
- name (required)
- args (required)
- Testcases:
- No testcase defined.
:require $name $name configure {*}$argsimport (scripted, public)
xotcl::package import [ -into into ] pkg
- Switches:
- -into (optional, defaults to
"::"
)- Parameters:
- pkg (required)
- Testcases:
- No testcase defined.
:require $pkg namespace eval $into [subst -nocommands { #puts stderr "*** package import ${pkg}::* into [namespace current]" namespace import ${pkg}::* }] # import subclasses if any foreach e [$pkg export] { set nq [namespace qualifiers $e] if {$nq ne ""} { namespace eval $into$nq [list namespace import ${pkg}::$e] } }present (scripted, public)
xotcl::package present args [ args... ]
- Parameters:
- args (required)
- Testcases:
- No testcase defined.
if {$::tcl_version<8.3} { switch -exact -- [lindex $args 0] { -exact {set pkg [lindex $args 1]} default {set pkg [lindex $args 0]} } if {[info exists :loaded($pkg)]} { return ${:loaded}($pkg) } else { error "not found" } } else { [set :packagecmd] present {*}$args }require (scripted, public)
xotcl::package require args [ args... ]puts "XOTCL package require $args, current=[namespace current]"
- Parameters:
- args (required)
- Testcases:
- No testcase defined.
set prevComponent ${:component} if {[catch {set v [package present {*}$args]} msg]} { #puts stderr "we have to load $msg" switch -exact -- [lindex $args 0] { -exact {set pkg [lindex $args 1]} default {set pkg [lindex $args 0]} } set :component $pkg lappend :uses($prevComponent) ${:component} set v [::uplevel \#1 [set :packagecmd] require $args] if {$v ne "" && ${:verbose}} { set path [lindex [::package ifneeded $pkg $v] 1] puts "... $pkg $v loaded from '$path'" set :loaded($pkg) $v ;# loaded stuff needed for Tcl 8.0 } } set :component $prevComponent return $vunknown (scripted, public)
xotcl::package unknown args [ args... ]puts stderr "unknown: package $args"
- Parameters:
- args (required)
- Testcases:
- No testcase defined.
[set :packagecmd] {*}$argsverbose (scripted, public)
xotcl::package verbose value
- Parameters:
- value (required)
- Testcases:
- No testcase defined.
set :verbose $value
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables