Index: library/lib/doc-assets/api.css
===================================================================
diff -u -r170cefa7618f2b44f91102711607fc6fa7d12c4f -r239888ee1ee6ed6d7b9afa5e170f49c5224a186d
--- library/lib/doc-assets/api.css (.../api.css) (revision 170cefa7618f2b44f91102711607fc6fa7d12c4f)
+++ library/lib/doc-assets/api.css (.../api.css) (revision 239888ee1ee6ed6d7b9afa5e170f49c5224a186d)
@@ -163,7 +163,8 @@
}
.deprecated, .private, .protected {
- display: none;
+ display: inherit;
+ /* display: none;*/
}
body.show_deprecated .deprecated,
Index: library/lib/doc-assets/method.html.tmpl
===================================================================
diff -u -r170cefa7618f2b44f91102711607fc6fa7d12c4f -r239888ee1ee6ed6d7b9afa5e170f49c5224a186d
--- library/lib/doc-assets/method.html.tmpl (.../method.html.tmpl) (revision 170cefa7618f2b44f91102711607fc6fa7d12c4f)
+++ library/lib/doc-assets/method.html.tmpl (.../method.html.tmpl) (revision 239888ee1ee6ed6d7b9afa5e170f49c5224a186d)
@@ -1,19 +1,11 @@
-[:!let paramblock [:parameters]]
+
[:print_name -status]
-
[:? {[info exists :@return] && [${:@return} spec] ne ""} {<[[${:@return} spec] spec]>} ]
+ [:? {[info exists :@return] && [${:@return} spec] ne ""} {<[${:@return} spec]>} ]
${:name}
- $paramblock
+ [:pinfo get -default "" bundle parametersyntax]
- [:? {[:@syshook]} {
-
Internally called method, can be redefined.
- }]
- [:? {[[[:partof] name] info methods ${:name}] ne "" &&
- [::nsf::methodproperty [[:partof] name] ${:name} redefine-protected]} {
-
Method is redefine-protected
- }]
[:as_text]
@@ -27,13 +19,15 @@
} - {
[:? {[info exists :@parameter]} {
- - Method parameters:
+ - Parameters:
[:for param ${:@parameter} {
-
-
[$param name]
+ [$param print_name]
[:? {[$param eval {info exists :spec}] && [$param spec] ne ""} {<[$param spec]>}]
+ [$param statusmark]
[$param as_text]
+ [$param pinfo get -default "" validation]
[:? {[$param eval {info exists :default}]} {
Default Value: [$param default]
@@ -45,26 +39,37 @@
}]
[:? {[info exists :@return]} {
- [:!let rparam ${:@return}]
- Returns:
-
+
+ [:? {[${:@return} eval {info exists :spec}] && [${:@return} spec] ne ""} {[${:@return} spec]}]
- - [$rparam as_text]
+ - [${:@return} as_text]
}]
}]
- [:? {[info exists :@deprecated]} {
+ [:? ${:@deprecated} {
- Deprecated ${:@deprecated}
+ Deprecated
}]
- [:? {[[[:partof] name] info methods ${:name}] ne ""} {
-
Method type: [[[:partof] name] info method type ${:name}]
+
+ - Type:
+ - [:pinfo get bundle type]
[:? {${:@syshook}} {-
+internally called, redefinable hook
}]
-
+
+
+
+ - Protection:
+ [:? {[:pinfo get -default 0 bundle redefine-protected]} {
+ - redefine-protected
+ }]
+
+
+
Index: library/lib/doc-tools.tcl
===================================================================
diff -u -r170cefa7618f2b44f91102711607fc6fa7d12c4f -r239888ee1ee6ed6d7b9afa5e170f49c5224a186d
--- library/lib/doc-tools.tcl (.../doc-tools.tcl) (revision 170cefa7618f2b44f91102711607fc6fa7d12c4f)
+++ library/lib/doc-tools.tcl (.../doc-tools.tcl) (revision 239888ee1ee6ed6d7b9afa5e170f49c5224a186d)
@@ -113,8 +113,7 @@
}
return [dict create {*}[concat {*}[lsort -integer -index 1 -decreasing $haystack]]]
}
-
-
+
proc find_asset_path {{subdir library/lib/doc-assets}} {
# This helper tries to identify the file system path of the
# asset ressources.
@@ -524,8 +523,43 @@
:attribute partof:object,type=::nx::doc::StructuredEntity
:attribute part_attribute:object,type=::nx::doc::PartAttribute
- :attribute pdata
+ #
+ # TODO: the pdata/pinfo/validate combo only makes sense for
+ # entities which reflect Tcl program structures -> refactor into a
+ # dedicated PEntity class or the like
+ #
+ :public method get_fqn_command_name {} {
+ return ${:name}
+ }
+
+ :attribute pdata
+ :public method validate {} {;}
+ :public method "pinfo get" {{-default ?} args} {
+ if {![info exists :pdata] || ![dict exists ${:pdata} {*}$args]} {
+ return $default;
+ }
+ dict get ${:pdata} {*}$args
+ }
+
+ :public method "pinfo exists" args {
+ if {![info exists :pdata]} {return 0}
+ dict exists ${:pdata} {*}$args
+ }
+
+ :public method "pinfo set" args {
+ if {![info exists :pdata]} return;
+ dict set :pdata {*}$args
+ }
+
+ :public method "pinfo propagate" args {
+ :pinfo set {*}$args
+ set path [dict create {*}[:get_upward_path -attribute {set :name}]]
+ foreach p [dict keys $path] {
+ $p pinfo set {*}$args
+ }
+ }
+
:public method get_upward_path {
-relative:switch
{-attribute {set :name}}
@@ -669,6 +703,15 @@
}
return $r
}
+
+ :public method validate {} {
+
+ dict for {s entities} [:owned_parts] {
+ foreach e $entities {
+ $e [current method]
+ }
+ }
+ }
}
@@ -927,7 +970,7 @@
}
:public forward @method %self @object-method
- :attribute @class-object-method -slotclass ::nx::doc::PartAttribute {
+ :attribute @object-method -slotclass ::nx::doc::PartAttribute {
set :part_class ::nx::doc::@method
}
@@ -963,6 +1006,7 @@
}
:public forward @method %self @class-method
+ :public forward @class-object-method %self @object-method
:attribute @class-method -slotclass ::nx::doc::PartAttribute {
:pretty_name "Per-class method"
:pretty_plural "Per-class methods"
@@ -1024,7 +1068,6 @@
set :part_class ::nx::doc::@param
}
:attribute @return -slotclass ::nx::doc::PartAttribute {
-
#
# TODO: @return spec fragments should be nameless,
# conceptually. They represent "out" parameters with each
@@ -1071,13 +1114,13 @@
return [::nx::doc::@method id [$domain name] ${:scope} $name]
}
}
-
- # :method require_part {domain prop value} {
- # set partof [$domain partof]
- # next $partof $prop [join [list [[$domain part_attribute] scope] [$domain name] $value] ::]
- # }
}
+ :public method get_fqn_command_name {} {
+ set scope [expr {[${:part_attribute} scope] eq "class"?"classes":"objects"}]
+ return ::nsf::${scope}::[string trimleft [[:partof] name] :]::${:name}
+ }
+
:public method parameters {} {
set params [list]
if {[info exists :@parameter]} {
@@ -1156,6 +1199,64 @@
}
return $params
}
+
+ :public method validate {} {
+ set partof [:get_owning_partof]
+ if {[:pinfo get -default complete status] ne "missing"} {
+ next
+ #
+ # Note: Some information on methods cannot be retrieved from
+ # within the tracers as they might not be set local to the
+ # method definition. Hence, we gather them at this point. I
+ # will review whether there is a more appropriate way of
+ # dealing with this issue ...
+ #
+ set prj [:current_project]
+ set box [$prj sandbox]
+ set obj [$partof name]
+
+ #set mname [:get_combined name]
+ if {[:pinfo exists bundle handle]} {
+ set handle [:pinfo get bundle handle]
+ :pinfo set bundle redefine-protected [$box eval [list ::nsf::methodproperty $obj $handle redefine-protected]]
+ :pinfo set bundle call-protected [$box eval [list ::nsf::methodproperty $obj $handle call-protected]]
+ }
+
+ set params [list]
+ set param_names [list]
+ if {[info exists :@parameter]} {
+ foreach p [:@parameter] {
+ set value [$p name]
+ lappend param_names $value
+ if {[$p eval {info exists :default}] || $value eq "args" } {
+ set value "?$value?"
+ }
+ lappend params $value
+ }
+ }
+
+ dict for {actualparam paraminfo} [:pinfo get -default "" bundle parameter] {
+ if {$actualparam ni $param_names} {
+ set p [:@parameter $actualparam]
+ $p pdata [lappend paraminfo status missing]
+ }
+ }
+ # if {[:pinfo exists bundle parameter]} {
+ # set actual_params [:pinfo get bundle parameter]
+ # if {$actual_params ne $params} {
+ # :pinfo propagate status mismatch
+ # :pinfo set validation "Parameter definition mismatch: $actual_params"
+ # }
+ # }
+
+ if {![:pinfo exists bundle parametersyntax]} {
+ :pinfo set bundle parametersyntax $params
+ }
+ } else {
+ # the method is missing -> this makes the owning object a mismatch
+ $partof pinfo set status mismatch
+ }
+ }
:public method get_sub_methods {} {
if {[info exists :@method]} {
@@ -1167,20 +1268,32 @@
lappend leaves {*}[$m get_sub_methods]
}
}
-# puts stderr LEAVES=$leaves
- #puts stderr [::nx::doc::entities::method::nx::Object::class::info::has @method]
return $leaves
}
}
:public method get_combined {what} {
set result [list]
if {[info exists :partof] && [${:partof} info has type [current class]]} {
- lappend result {*}[${:partof} get_combined $what] [:$what]
+ set result [${:partof} get_combined $what]
}
- return $result
+ return [lappend result [:$what]]
}
+ :public method get_owning_object {} {
+ return [[:get_owning_partof] name]
+ }
+
+ :public method get_owning_partof {} {
+ if {[${:partof} info has type [current class]]} {
+ return [${:partof} [current method]]
+ } else {
+ return ${:partof}
+ }
+ }
+
+
+
}; # @method
# PartTag create @subcommand -superclass {Part @command}
@@ -1240,6 +1353,17 @@
-part_attribute $part_attribute {*}$args
}
+
+ :public method validate {} {
+ if {[:pinfo get -default complete status] ne "missing"} {
+ if {[info exists :spec] && ${:spec} ne [:pinfo get bundle spec]} {
+ :pinfo propagate status mismatch
+ :pinfo set validation "Specification mismatch: [:pinfo get bundle spec]"
+ }
+ } else {
+ ${:partof} pinfo propagate status mismatch
+ }
+ }
}
#
@@ -1305,6 +1429,10 @@
return [[current class] eval [list set :templates($tmpl)]]
}
+
+ :public method render_start {} {;}
+ :public method render_end {} {;}
+
# This mixin class realises a rudimentary templating language to
# be used in nx::doc templates. It realises language expressions
# to verify the existence of variables and simple loop constructs
@@ -1321,10 +1449,13 @@
# of the actual rendered entity ... review later ...
#
$entity rendered_entity $entity
- $entity eval [subst -nocommands {
+ $entity render_start
+ set content [$entity eval [subst -nocommands {
$initscript
$tmplscript
- }]
+ }]]
+ $entity render_end
+ return $content
}
@@ -1356,8 +1487,6 @@
}
:method ?objvar {obj varname args} {
- # set args [lassign $args then_script]
- # append script "\[::set $varname \[$obj eval {set :$varname; puts stderr >>>>\[set :$varname\]}\]\]\n" $then_script
uplevel 1 [list :? -ops [list [::nsf::current method] -] \
"\[$obj eval {info exists :$varname}\]" {*}$args]
}
@@ -1515,6 +1644,7 @@
#
if {![$e info has type ::nx::doc::StructuredEntity]} continue;
$e current_project [current object]
+ $e validate
set content [$e render -initscript $init $tmpl]
:write_data $content [file join $project_path "[$e filename].$ext"]
puts stderr "$e written to [file join $project_path [$e filename].$ext]"
@@ -1553,19 +1683,18 @@
:public forward rendered_entity [current] %method
# :public forward print_name %current name
- :public method print_name {-status:switch} {
- set status_mark ""
- if {$status} {
- set cls ""
- if {[info exists :pdata]} {
- set cls [expr {[dict exists ${:pdata} status]?\
- [dict get ${:pdata} status]:""}]
- } else {
- set cls "extra"
- }
- set status_mark "
"
+ :public method statusmark {} {
+ set cls ""
+ if {[info exists :pdata]} {
+ set cls [expr {[dict exists ${:pdata} status]?\
+ [dict get ${:pdata} status]:""}]
+ } else {
+ set cls "extra"
}
-
+ set status_mark "
"
+ }
+ :public method print_name {-status:switch} {
+ set status_mark [expr {$status?[:statusmark]:""}]
return "${:name}$status_mark"
}
@@ -1803,6 +1932,9 @@
dict set hash access ${:@modifier}
return $hash
}
+ :public method render_start {} {
+ #:validate
+ }
}; # NxDocRenderer::@method
}; # NxDocTemplating
@@ -1961,11 +2093,12 @@
# [list ->status:in,arg=complete|missing|prototype|mismatch,slot=[current] missing]
:public method at_register_command [list \
name:fqn,slot=[current] \
- ->cmdtype:in,arg=object|proc|method,slot=[current] \
+ ->cmdtype:in,arg=@object|@class|@command|@method,slot=[current] \
->source:fpathtype,arg=absolute,slot=[current] \
{->nsexported:boolean 0} \
{->nsimported:boolean 0} \
->docstring:optional,nonempty,slot=[current] \
+ ->bundle
] {
# peek the currently processed package (if any)
set storable_vars [info vars >*]
@@ -2137,7 +2270,7 @@
set filepath [file normalize $filepath]
foreach {cmd isexported} $delta_commands {
::nx::doc::__at_register_command $cmd \
- ->cmdtype proc \
+ ->cmdtype @command \
->source $filepath \
->nsexported $isexported
}
@@ -2184,16 +2317,82 @@
[::nsf::configure objectsystem] ne ""} {
::nsf::configure keepinitcmd true;
+
+ array set sysmeths [concat {*}[lassign {*}[::nsf::configure objectsystem] rootclass rootmclass]]
+ set ::nx::doc::rootns [namespace qualifier $rootmclass]
+ $rootmclass $sysmeths(-class.create) ${::nx::doc::rootns}::__Tracer
+ ::nsf::method ${::nx::doc::rootns}::__Tracer \
+ -public $sysmeths(-class.create) {name args} {
+ set obj [::nsf::next];
+ set cmdtype [expr {[::nsf::is class $obj]?"@class":"@object"}]
+ ::nx::doc::__at_register_command $obj \
+ ->cmdtype $cmdtype \
+ ->source [file normalize [info script]] \
+ ->nsexported [::nx::doc::is_exported $obj] \
+ {*}[expr {[::nsf::existsvar $obj __initcmd] && [::nsf::setvar $obj __initcmd] ne ""?[list ->docstring [::nsf::setvar $obj __initcmd]]:[list]}]
+ return $obj
+ }
+
+ # ISSUE: yields -> bad relationtype "mixin": must be
+ # object-mixin, class-mixin, object-filter,
+ # class-filter, class, superclass, or rootclass
+ # -> ::nsf::mixin defaults to "mixin" instead of "class-mixin"
+ # ::nsf::mixin $rootmclass ::nsf::__Tracer
+ ::nsf::relation $rootmclass class-mixin ${::nx::doc::rootns}::__Tracer
+
+ ::interp invokehidden "" proc ::nx::doc::handleinfo {handle} {
+ set definition [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method definition $handle]
+ if {$definition ne ""} {
+ set obj [lindex $definition 0]
+ set modifier [lindex $definition 2]
+ if {$modifier eq "class-object"} {
+ set scope $modifier
+ set name [lindex $definition 4]
+ } else {
+ set scope ""
+ set name [lindex $definition 3]
+ }
+ }
+ return [list $obj $scope $name]
+ }
+
+
+ ::interp invokehidden "" proc ::nx::doc::paraminfo {
+ value {default ""}
+ } {
+ set colon [string first : $value]
+ set spec ""
+ if {$colon == -1} {
+ set name $value
+ } else {
+ set spec [string range $value [expr {$colon+1}] end]
+ set name [string range $value 0 [expr {$colon -1}]]
+ }
+ return [list $name [list $spec $default]]
+ }
+
+
rename ::nsf::method ::nsf::_%&method
::interp invokehidden "" proc ::nsf::method {
object
args
} {
set handle [uplevel [list ::nsf::_%&method $object {*}$args]]
if {$handle ne ""} {
+ set bundle [dict create]
+ dict set bundle handle $handle
+ dict set bundle handleinfo [::nx::doc::handleinfo $handle]
+# dict set bundle parameter [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parameter $handle]
+ foreach pspec [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parameter $handle] {
+ dict set bundle parameter {*}[::nx::doc::paraminfo {*}$pspec]
+ }
+ dict set bundle parametersyntax [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method parametersyntax $handle]
+ dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle]
+ dict set bundle returns [::nsf::methodproperty ${::nx::doc::rootns}::__Tracer $handle returns]
::nx::doc::__at_register_command $handle \
- ->cmdtype method \
- ->source [file normalize [info script]]
+ ->cmdtype @method \
+ ->source [file normalize [info script]] \
+ ->bundle $bundle
}
return $handle
}
@@ -2204,16 +2403,36 @@
} {
set handle [uplevel [list ::nsf::_%&alias {*}$args]]
if {$handle ne ""} {
+ dict set bundle handle $handle
+ dict set bundle handleinfo [::nx::doc::handleinfo $handle]
+ dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle]
+
::nx::doc::__at_register_command $handle \
- ->cmdtype method \
- ->source [file normalize [info script]]
+ ->cmdtype @method \
+ ->source [file normalize [info script]] \
+ ->bundle $bundle
}
return $handle
}
-
+ rename ::nsf::forward ::nsf::_%&forward
+ ::interp invokehidden "" proc ::nsf::forward {
+ args
+ } {
+ set handle [uplevel [list ::nsf::_%&forward {*}$args]]
+ if {$handle ne ""} {
+ dict set bundle handle $handle
+ dict set bundle handleinfo [::nx::doc::handleinfo $handle]
+ dict set bundle type [::nsf::dispatch ${::nx::doc::rootns}::__Tracer ::nsf::methods::object::info::method type $handle]
+
+ ::nx::doc::__at_register_command $handle \
+ ->cmdtype @method \
+ ->source [file normalize [info script]] \
+ ->bundle $bundle
+ }
+ }
- rename ::nsf::createobjectsystem ::nsf::_%&createobjectsystem
+ rename ::nsf::createobjectsystem ::nsf::_%&createobjectsystem
::interp invokehidden "" proc ::nsf::createobjectsystem {
rootclass
rootmclass
@@ -2222,34 +2441,13 @@
uplevel [list ::nsf::_%&createobjectsystem $rootclass $rootmclass {*}$args]
foreach r [list $rootclass $rootmclass] {
::nx::doc::__at_register_command $r \
- ->cmdtype object \
+ ->cmdtype @class \
->source [file normalize [info script]] \
->nsexported [::nx::doc::is_exported $r] \
{*}[expr {[::nsf::existsvar $r __initcmd] && [::nsf::setvar $obj __initcmd] ne ""?[list ->docstring [::nsf::setvar $r __initcmd]]:[list]}]
}
}
-
- array set sysmeths [concat {*}[lassign {*}[::nsf::configure objectsystem] rootclass rootmclass]]
- set rootns [namespace qualifier $rootmclass]
- $rootmclass $sysmeths(-class.create) ${rootns}::__Tracer
- ::nsf::method ${rootns}::__Tracer \
- -public $sysmeths(-class.create) {name args} {
- set obj [::nsf::next];
- ::nx::doc::__at_register_command $obj \
- ->cmdtype object \
- ->source [file normalize [info script]] \
- ->nsexported [::nx::doc::is_exported $obj] \
- {*}[expr {[::nsf::existsvar $obj __initcmd] && [::nsf::setvar $obj __initcmd] ne ""?[list ->docstring [::nsf::setvar $obj __initcmd]]:[list]}]
- return $obj
- }
- # ISSUE: yields -> bad relationtype "mixin": must be
- # object-mixin, class-mixin, object-filter,
- # class-filter, class, superclass, or rootclass
- # -> ::nsf::mixin defaults to "mixin" instead of "class-mixin"
- # ::nsf::mixin $rootmclass ::nsf::__Tracer
- ::nsf::relation $rootmclass class-mixin ${rootns}::__Tracer
-
}
# 2) provide for tracing Tcl procs declared at "sourcing time" -> [proc]
#::interp hide "" proc
@@ -2264,7 +2462,7 @@
::nx::doc::__at_deregister_command $fqn
} else {
::nx::doc::__at_register_command $fqn \
- ->cmdtype proc \
+ ->cmdtype @command \
->source [file normalize [info script]] \
->nsexported [::nx::doc::is_exported $fqn] \
->docstring $body
@@ -2281,9 +2479,11 @@
if {[string match "-*" $pattern]} continue;
foreach cmd [info commands $pattern] {
if {![::nx::doc::is_exported $cmd]} continue;
- set type [expr {[info commands "::nsf::isobject"] ne "" &&\
- [::nsf::isobject $cmd]?"object":"proc"}]
-
+ set type @command
+ if {[info commands "::nsf::isobject"] ne "" &&\
+ [::nsf::isobject $cmd]} {
+ set type [expr {[::nsf::is class $cmd]?"@class":"@object"}]
+ }
set imported_name [string trimright $ns :]::[namespace tail $cmd]
::nx::doc::__at_register_command $imported_name \
->cmdtype $type \
@@ -2388,15 +2588,15 @@
# TODO: some cleanup is only needed if __init has been called
# (which is not always the case). refactor the code
# accordingly.
- set rootns [namespace qualifier $rootmclass]
- if {[::nsf::isobject ${rootns}::__Tracer]} {
- ${rootns}::__Tracer $sysmeths(-object.destroy)
+ set ::nx::doc::rootns [namespace qualifier $rootmclass]
+ if {[::nsf::isobject ${::nx::doc::rootns}::__Tracer]} {
+ ${::nx::doc::rootns}::__Tracer $sysmeths(-object.destroy)
::nsf::relation $rootmclass class-mixin {}
}
if {[info commands ::nsf::_%&createobjectsystem] ne ""} {
rename ::nsf::_%&createobjectsystem ::nsf::createobjectsystem
}
- unset rootns
+ unset ::nx::doc::rootns
}
rename ::proc ""
interp expose "" proc
@@ -2441,29 +2641,31 @@
namespace import -force ::nx::doc::*
Mixin create [current]::Entity {
- :public method get_command_name {} {
- return ${:name}
- }
:public method init args {
next
set prj [:current_project]
if {$prj ne ""} {
set box [$prj sandbox]
- set cmdname [:get_command_name]
+ set cmdname [:get_fqn_command_name]
if {[$box eval [concat dict exists \${:registered_commands} $cmdname]]} {
:pdata [$box eval [concat dict get \${:registered_commands} $cmdname]]
}
}
[[current class] info parent] at_processed [current]
}
}
-
- Mixin create [current]::@method -superclass [current]::Entity {
- :method get_command_name {} {
- return ::nsf::classes::[string trimleft [[:partof] name] :]::${:name}
+
+ Mixin create [current]::@param -superclass [current]::Entity {
+ :public method init args {
+ next
+ if {[${:partof} pinfo exists bundle parameter ${:name}]} {
+ lassign [${:partof} pinfo get bundle parameter ${:name}] spec default
+ :pdata [list bundle [list spec $spec default $default]]
+ }
}
}
-
+
+
#
# mixin layer interface
#
@@ -2554,43 +2756,77 @@
foreach script $scripts {
lappend provided_entities {*}[:readin $script]
}
-
+
# output
# 1. absent entities (doc[yes]->program[no])
# => all doc entities without pdata
-# puts stderr "--- $provided_entities"
+ # puts stderr "--- $provided_entities"
set present_entities [::nx::doc::filtered $provided_entities {[info exists :pdata]}]
# TODO: the nspatterns should be consumed from the source
# specification and should not be hardcoded here ... review
# later ...
- set generated_commands [$box get_registered_commands [list ::nsf ::nx]]
+ #set generated_commands [$box get_registered_commands [list ::nsf ::nx]]
+ set generated_commands [dict merge [$box get_registered_commands -exported -types {@object @class @command}] [$box get_registered_commands -types @method]]
+ set map [dict create]
foreach pe $present_entities {
- dict unset generated_commands [$pe name]
+ set fqn [$pe get_fqn_command_name]
+ dict unset generated_commands $fqn
+ dict set map $fqn $pe
}
# puts stderr "PRESENT $present_entities"
# puts stderr "ABSENT [::nx::doc::filtered $provided_entities {![info exists :pdata]}]"
# 2. generated entities (doc[no]->program[yes])
# => all registered_commands without doc entity
-# puts stderr "== TO GENERATE == [dict keys $generated_commands]"
+ #puts stderr "== TO GENERATE == [join [dict keys $generated_commands] \n]"
dict for {cmd info} $generated_commands {
- if {[string match ::nsf::classes::* $cmd]} continue;
- if {[string match ::nsf::objects::* $cmd]} continue;
+ #if {[string match ::nsf::classes::* $cmd]} continue;
+ #if {[string match ::nsf::objects::* $cmd]} continue;
if {[string match *::slot::* $cmd]} continue;
dict with info {
#
# TODO: for now, we assume objects beyond this point
# ... relax later!
#
- if {$cmdtype ni [list object proc]} continue;
- set kind @command
- if {$cmdtype eq "object"} {
- set kind [expr {[$box do [list ::nsf::is class $cmd]]?\
- "@class":"@object"}]
+ if {$cmdtype ni [list @command @object @class @method]} continue;
+ if {$cmdtype eq "@method"} {
+ lassign [dict get $bundle handleinfo] obj scope name
+ # ! we assume the partof entity is present or has been generated
+ if {![dict exists $map $obj]} continue;
+ set partof_entity [dict get $map $obj]
+ set entity [$partof_entity @[join [list {*}${scope} method] -] $name]
+ if {[dict exists $info bundle parameter]} {
+ dict for {pname paraminfo} [dict get $info bundle parameter] {
+ lassign $paraminfo spec default
+
+ set paramid [@parameter id $entity "" $pname]
+ set ppdata [list bundle [list spec $spec default $default]]
+ if {$paramid ni $provided_entities} {
+ set paramid [$entity @parameter $pname]
+ lappend ppdata status missing
+ }
+ $paramid pdata $ppdata
+ }
+ }
+ } else {
+ set entity [@ $cmdtype $cmd]
}
- set entity [@ $kind $cmd]
- :process=$kind $project $entity
+ #-> ::nsf::classes::nx::CopyHandler::targetList
+ # @class.method {::nx::CopyHandler targetList}
+
+ #:process=$cmdtype $project $entity
$entity pdata [lappend info status missing]
+ dict set map [$entity get_fqn_command_name] $entity
}
+
+ :method generate_parameter {value} {
+ set colon_pos [string first : $value]
+ if {$colon_pos == -1} {
+ set name $value
+ } else {
+ set properties [string range $value [expr {$colonPos+1}] end]
+ set name [string range $value 0 [expr {$colonPos -1}]]
+ }
+ }
}
}
@@ -2631,20 +2867,19 @@
# TODO: for now, we assume objects beyond this point
# ... relax later!
#
- if {$cmdtype ne "object"} continue;
- set kind [expr {[$box do [list ::nsf::is class $cmd]]?"@class":"@object"}]
+ if {$cmdtype ni [list @object @class]} continue;
if {[info exists docstring]} {
lassign [:readin \
-docstring \
- -tag $kind \
+ -tag $cmdtype \
-name $cmd \
-parsing_level 1 \
$docstring] entity processed_entities
unset docstring
} else {
- set entity [@ $kind $cmd]
+ set entity [@ $cmdtype $cmd]
}
- :process=$kind $project $entity
+ :process=$cmdtype $project $entity
}
}
}
Index: library/nx/nx.nxd
===================================================================
diff -u -r170cefa7618f2b44f91102711607fc6fa7d12c4f -r239888ee1ee6ed6d7b9afa5e170f49c5224a186d
--- library/nx/nx.nxd (.../nx.nxd) (revision 170cefa7618f2b44f91102711607fc6fa7d12c4f)
+++ library/nx/nx.nxd (.../nx.nxd) (revision 239888ee1ee6ed6d7b9afa5e170f49c5224a186d)
@@ -43,9 +43,9 @@
# the overall '''create''' mechanism by just allocating uninitialized
# objects using '''alloc'''.
#
-# @properties interally-called
-# @parameter name The object identifier assigned to the object storage
-# to be allocated.
+# @property syshook
+# @parameter name The designated object identifier assigned to the
+# object storage to be allocated.
# @return The name of the allocated, uninitialized object
# @class.method {Class create}
Index: library/nx/nx.tcl
===================================================================
diff -u -r939c4689d75f1ab087d28336e108bfb97b7b64c4 -r239888ee1ee6ed6d7b9afa5e170f49c5224a186d
--- library/nx/nx.tcl (.../nx.tcl) (revision 939c4689d75f1ab087d28336e108bfb97b7b64c4)
+++ library/nx/nx.tcl (.../nx.tcl) (revision 239888ee1ee6ed6d7b9afa5e170f49c5224a186d)
@@ -24,7 +24,7 @@
-object.defaultmethod defaultmethod
-object.destroy destroy
-object.init init
- -object.move move
+ -object.move move
-object.objectparameter objectparameter
-object.residualargs residualargs
-object.unknown unknown
@@ -574,7 +574,7 @@
Object method "info info" {} {::nx::infoOptions ::nx::Object::slot::__info}
Class method "info info" {} {::nx::infoOptions ::nx::Class::slot::__info}
-
+
# finally register method "method" (otherwise, we cannot use "method" above)
Object alias "info method" ::nsf::methods::object::info::method
Class alias "info method" ::nsf::methods::class::info::method
Index: tests/doc.test
===================================================================
diff -u -r170cefa7618f2b44f91102711607fc6fa7d12c4f -r239888ee1ee6ed6d7b9afa5e170f49c5224a186d
--- tests/doc.test (.../doc.test) (revision 170cefa7618f2b44f91102711607fc6fa7d12c4f)
+++ tests/doc.test (.../doc.test) (revision 239888ee1ee6ed6d7b9afa5e170f49c5224a186d)
@@ -442,7 +442,7 @@
# @parameter a Provides a first value
# @parameter b Provides a second value
- # @class.class-object-method {::Bar foo}
+ # @class.object-method {::Bar foo}
#
# This describes the per-object foo method
#
@@ -511,7 +511,7 @@
}
- set entity [@method id ::Bar class-object foo]
+ set entity [@method id ::Bar object foo]
? [list [@class id ::Bar] @class-object-method] $entity
? [list ::nsf::is object $entity] 1
? [list $entity info has type ::nx::doc::@method] 1
@@ -888,11 +888,11 @@
? [list ::nsf::isobject $entity] 1
? [list $entity as_text] "Only description available here ..."
- set entity [@method id ::C class-object sub]
+ set entity [@method id ::C object sub]
? [list ::nsf::isobject $entity] 1
? [list $entity as_text] "A brief desc"
- set entity [@method id ::C class-object sub::foo2]
+ set entity [@method id ::C object sub::foo2]
? [list ::nsf::isobject $entity] 1
? [list $entity info has type ::nx::doc::@method] 1
? [list $entity as_text] "could allow both (@sub-method is the attribute name, @method is a forwarder in the context of an owning @method object!)"