Index: Makefile.in =================================================================== diff -u -r4467dfc8b4c7b8a689ba01915c71d4afe4c7051c -redea1a9c44f4c685e45e59e7f8864ae11d84ff42 --- Makefile.in (.../Makefile.in) (revision 4467dfc8b4c7b8a689ba01915c71d4afe4c7051c) +++ Makefile.in (.../Makefile.in) (revision edea1a9c44f4c685e45e59e7f8864ae11d84ff42) @@ -284,20 +284,23 @@ yuidoc: pkgIndex.tcl $(YUIDOC_OUTPUT) $(target_doc_dir)/$(PACKAGE_NAME)/index.html: $(PACKAGE_NAME).nxd - $(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle $(PACKAGE_NAME) \ + $(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle $(PACKAGE_NAME) \ -docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \ - -outdir $(target_doc_dir) "package:$(PACKAGE_NAME)" + -outdir $(target_doc_dir) -indexfiles generic/nxdocIndex -- "package:$(PACKAGE_NAME)" $(target_doc_dir)/nx/index.html: library/nx/nx.nxd $(PACKAGE_NAME).nxd - $(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle nx \ + $(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle nx \ -docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \ - -outdir $(target_doc_dir) "package:nx" + -outdir $(target_doc_dir) -indexfiles "library/nx/nxdocIndex" -- "package:nx" $(xotcl_target_doc_dir)/XOTcl-langRef/index.html: library/xotcl/doc/langRef.xotcl $(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle XOTcl-langRef \ -docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \ -outdir $(xotcl_target_doc_dir) "@package:XOTcl-langRef" +yuidoc-dev: NXDFLAGS := -validation +yuidoc-dev: yuidoc + XOWIKI_OUTPUT = \ $(target_doc_dir)/$(PACKAGE_NAME).xowiki \ $(target_doc_dir)/nx.xowiki \ @@ -306,21 +309,27 @@ xowiki: pkgIndex.tcl $(XOWIKI_OUTPUT) $(target_doc_dir)/$(PACKAGE_NAME).xowiki : $(PACKAGE_NAME).nxd - $(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle $(basename $(notdir $@)) \ + $(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle $(basename $(notdir $@)) \ -docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \ - -outdir $(@D) -format xowiki -layout many-to-1 "package:$(basename $(notdir $@))" + -outdir $(@D) -format xowiki -layout many-to-1 -indexfiles "generic/nxdocIndex" \ + -- "package:$(basename $(notdir $@))" $(target_doc_dir)/nx.xowiki : library/nx/nx.nxd $(PACKAGE_NAME).nxd - $(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle $(basename $(notdir $@)) \ + $(TCLSH) $(src_app_dir_native)/utils/nxdoc $(NXDFLAGS) -doctitle $(basename $(notdir $@)) \ -docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \ - -outdir $(@D) -format xowiki -layout many-to-1 "package:$(basename $(notdir $@))" + -outdir $(@D) -format xowiki -layout many-to-1 -indexfiles "library/nx/nxdocIndex" \ + -- "package:$(basename $(notdir $@))" $(xotcl_target_doc_dir)/XOTcl-langRef.xowiki : library/xotcl/doc/langRef.xotcl $(TCLSH) $(src_app_dir_native)/utils/nxdoc -doctitle $(basename $(notdir $@)) \ -docurl "http://next-scripting.org/" -docversion $(PACKAGE_VERSION) \ -outdir $(@D) -format xowiki -layout many-to-1 "@package:$(basename $(notdir $@))" +xowiki-dev: NXDFLAGS := -validation +xowiki-dev: xowiki + + example-doc: $(EXAMPLE_SCRIPTS) $(xotcl_target_doc_dir)/langRef-xotcl.html: pkgIndex.tcl $(xotcl_src_doc_dir)/langRef.xotcl $(XODOC_SOURCE) Index: apps/utils/nxdoc =================================================================== diff -u -r5bb824230bdec762db1607482bd9866be01184af -redea1a9c44f4c685e45e59e7f8864ae11d84ff42 --- apps/utils/nxdoc (.../nxdoc) (revision 5bb824230bdec762db1607482bd9866be01184af) +++ apps/utils/nxdoc (.../nxdoc) (revision edea1a9c44f4c685e45e59e7f8864ae11d84ff42) @@ -40,7 +40,7 @@ # :private method barf {msg} { - return -code error "NXDOC: $msg" + return -code error "NXDoc: $msg" } :protected method ... args { Index: library/lib/nxdoc-core.tcl =================================================================== diff -u -r5bb824230bdec762db1607482bd9866be01184af -redea1a9c44f4c685e45e59e7f8864ae11d84ff42 --- library/lib/nxdoc-core.tcl (.../nxdoc-core.tcl) (revision 5bb824230bdec762db1607482bd9866be01184af) +++ library/lib/nxdoc-core.tcl (.../nxdoc-core.tcl) (revision edea1a9c44f4c685e45e59e7f8864ae11d84ff42) @@ -2333,7 +2333,6 @@ {*}[expr {[::nsf::var::exists $obj __initcmd] && [::nsf::var::set $obj __initcmd] ne ""?[list ->docstring [::nsf::var::set $obj __initcmd]]:[list]}] return $obj } - ::nsf::mixin $rootmclass ${::nx::doc::rootns}::__Tracer # ::nsf::relation $rootmclass class-mixin ${::nx::doc::rootns}::__Tracer if {[info commands "::nx::Object"] ne ""} { @@ -2392,6 +2391,9 @@ ::nsf::mixin $rootclass ${::nx::doc::rootns}::__ObjTracer #::nsf::relation $rootclass class-mixin ${::nx::doc::rootns}::__ObjTracer } + + ::nsf::mixin $rootmclass ${::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] @@ -2567,7 +2569,7 @@ } } - # 2) provide for tracing Tcl procs declared at "sourcing time" -> [proc] + # 2a) provide for tracing Tcl procs declared at "sourcing time" -> [proc] #::interp hide "" proc ::interp invokehidden "" proc ::proc {name arguments body} { set ns [uplevel [list namespace current]] @@ -2587,6 +2589,26 @@ } } + + rename ::nsf::proc ::nsf::_%&proc + ::interp invokehidden "" proc ::nsf::proc {name arguments body} { + set ns [uplevel [list namespace current]] + uplevel [list ::nsf::_%&proc $name $arguments $body] + set fqn $name + if {[string first "::" $name] != 0} { + set fqn [string trimright $ns :]::$name + } + if {$arguments eq "" && $body eq ""} { + ::nx::doc::__at_deregister_command $fqn + } else { + ::nx::doc::__at_register_command $fqn \ + ->cmdtype @command \ + ->source [file normalize [info script]] \ + ->nsexported [::nx::doc::is_exported $fqn] \ + ->docstring $body + } + } + # 3) provide for tracing commands namespace-imported at "sourcing time" #::interp hide "" namespace ::interp invokehidden "" proc ::namespace {subcmd args} { @@ -3105,8 +3127,8 @@ @method }]] - puts stderr generated_commands=$generated_commands - puts stderr present_entities=$present_entities + #puts stderr generated_commands=$generated_commands + #puts stderr present_entities=$present_entities set map [dict create] foreach pe $present_entities { if {[$pe pinfo exists bundle handle]} { @@ -3291,7 +3313,7 @@ $box registered_commands [$box get_registered_commands $nsFilters] } - puts stderr REGISTERED_COMMANDS=[dict keys [$box registered_commands]] + # puts stderr REGISTERED_COMMANDS=[dict keys [$box registered_commands]] foreach {attr part_class} [$project part_attributes] { @@ -4045,7 +4067,7 @@ # :method parse@space {line} {;} } - ::nsf::proc mkIndex {{-documentAll:switch 0} -indexfiles:0..* {-outdir "[pwd]"} args} { + ::nsf::proc mkIndex {{-documentAll:switch 0} {-indexfiles:0..* ""} {-outdir "[pwd]"} args} { if {![llength $args]} { set args *.tcl @@ -4062,21 +4084,40 @@ if {![llength $scripts]} return; set sbox [Sandbox new -interp [interp create]] - $sbox do [list package req nx] + # 1pass + append scriptBlock "source " [join $scripts "; source "] + $sbox do [list package req nsf] + $sbox do $scriptBlock + # 2pass $sbox do [list ::nx::doc::__init] + $sbox do $scriptBlock + set cmds [dict keys [$sbox get_registered_commands -types {@command @object @class}]] + + append index "# NXDoc index file, version [package require nx::doc]\n" + append index "# This file was generated by the \"::nx::doc::mkIndex\" command\n" + append index "# and is optionally sourced by nxdoc to filter the command population\n" + append index "# to be documented. Typically each line is a command that\n" + append index "# sets an element in the ::nxdoc::include array, where the\n" + append index "# element name is the name of a command and the value indicates whether\n" + append index "# the command is to be documented (1) or not (0).\n" + append index \n - set cmds [list] - foreach script $scripts { - $sbox do [list source $script] - puts stderr >>>[$sbox get_registered_commands -types {@command @object @class}] - lappend cmds {*}[dict keys [$sbox get_registered_commands -types {@command @object @class}]] + if {[llength $indexfiles]} { + append index "# Source external (e.g., auto-generated) index files\n" } - + + foreach idx $indexfiles { + append index {source [file join [file dirname [info script]] } $idx {]} "\n" + } + foreach cmd $cmds { - puts stderr "set ::nxdoc::include($cmd) $documentAll" + append index "set ::nxdoc::include($cmd) $documentAll\n" } - } - + + set fid [open [file join [file normalize $outdir] nxdocIndex] w] + puts -nonewline $fid $index + close $fid + } } # puts stderr "Doc Tools loaded: [info command ::nx::doc::*]" \ No newline at end of file