- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::nx::MetaSlot
::nx::MetaSlot create ...
Class Relations
::nx::Class create ::nx::MetaSlot \ -superclass ::nx::ClassMethods (to be applied on the object)
createFromParameterSpec (scripted)
lassign [:parseParameterSpec -class $class -defaultopts $defaultopts -target $target $spec] name parameterOptions class opts lappend opts -incremental $incremental if {[info exists default]} { lappend opts -default $default } if {${per-object}} { lappend opts -per-object true set scope object set container per-object-slot } else { set scope class set container slot } if {$private} { regsub -all : __$target _ prefix lappend opts -settername $name -name __private($target,$name) set slotname ${prefix}.$name } else { set slotname $name } if {$class eq ""} { set class ::nx::VariableSlot } else { #puts stderr "*** Class for '$target $name' is $class // [$class info heritage]" } set slotObj [::nx::slotObj -container $container $target $slotname] #puts stderr "[self] SLOTCREATE *** [list $class create $slotObj] {*}$opts <$initblock>" set r [$class create $slotObj {*}$opts $initblock] #puts stderr "[self] SLOTCREATE returned $r" return $roptionsToValueCheckingSpec (scripted)
set noptions "" if {[dict exists $options -type]} { set type [dict get $options -type] if {[string match "::*" $type]} { lappend noptions object type=$type } elseif {$type eq "switch"} { lappend noptions boolean } else { lappend noptions $type } } if {[dict exists $options -arg]} { lappend noptions arg=[dict get $options -arg] } if {[dict exists $options -multiplicity]} { lappend noptions [dict get $options -multiplicity] } return [join $noptions ,]parseParameterSpec (scripted)
array set opt $defaultopts set opts "" set colonPos [string first : $spec] if {$colonPos == -1} { set name $spec set parameterOptions "" } else { set parameterOptions [string range $spec [expr {$colonPos+1}] end] set name [string range $spec 0 [expr {$colonPos -1}]] foreach property [split $parameterOptions ,] { if {$property in [list "required" "convert" "noarg" "nodashalnum"]} { if {$property eq "convert" } {set class [:requireClass ::nx::VariableSlot $class]} lappend opts -$property 1 } elseif {$property eq "noconfig"} { set opt(-configurable) 0 ;# TODO } elseif {$property eq "incremental"} { return -code error "parameter option incremental must not be used; use non-positional argument -incremental instead" } elseif {[string match "type=*" $property]} { set class [:requireClass ::nx::VariableSlot $class] set type [string range $property 5 end] if {$type eq ""} { unset type } elseif {![string match "::*" $type]} { set type [namespace qualifier $target]::$type } } elseif {[string match "arg=*" $property]} { set argument [string range $property 4 end] lappend opts -arg $argument } elseif {[string match "substdefault*" $property]} { if {[string match "substdefault=*" $property]} { set argument [string range $property 13 end] } else { set argument 0b111 } lappend opts -substdefault $argument } elseif {[string match "method=*" $property]} { lappend opts -methodname [string range $property 7 end] } elseif {$property eq "optional"} { lappend opts -required 0 } elseif {$property in [list "alias" "forward" "cmd" "initcmd"]} { lappend opts -disposition $property set class [:requireClass ::nx::ObjectParameterSlot $class] } elseif {[regexp {([01])[.][.]([1n*])} $property _ minOccurrence maxOccurrence]} { lappend opts -multiplicity $property } else { set type $property } } } if {[info exists type]} { #if {$type eq "switch"} {error "switch is not allowed as type for object parameter $name"} lappend opts -type $type } lappend opts {*}[array get opt] #puts stderr "[self] *** parseParameterSpec [list $name $parameterOptions $class $opts]" return [list $name $parameterOptions $class $opts]requireClass (scripted)
if {$old eq "" || $old eq $required} {return $required} if {[$required info superclasses -closure $old] ne ""} { #puts stderr "required $required has $old as superclass => specializing" return $required } elseif {[$required info subclasses -closure $old] ne ""} { #puts stderr "required $required is more general than $old => keep $old" return $old } else { return -code error "required class $required not compatible with $old" }substDefaultOptions (scripted)
set options {} if {($bitPattern & 0b100) == 0} { lappend options -nobackslashes } if {($bitPattern & 0b010) == 0} { lappend options -novariables } if {($bitPattern & 0b001) == 0} { lappend options -nocommands } return $options
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables