xo::api proc update_object_doc (public)
xo::api update_object_doc scope obj doc_string
Defined in packages/xotcl-core/tcl/01-debug-procs.tcl
Update the API browser nsvs with information about the provided object. If no doc string is provided, try to get it from the object definition. if {![string match ::* $obj]} { ad_log error "==== update_object_doc OBJECT WITHOUT leading colons <$obj>" }
- Parameters:
- scope (required)
- obj (required)
- doc_string (required)
- Testcases:
- No testcase defined.
Source code: # # Update the API browser nsvs with information about the provided # object. # # If no doc string is provided, try to get it from the object # definition. # #if {![string match ::* $obj]} { # ad_log error "==== update_object_doc OBJECT WITHOUT leading colons <$obj>" #} if {$doc_string eq ""} { set doc_string [:get_doc_block [:get_init_block $scope $obj]] } ad_parse_documentation_string $doc_string doc_elements # # Initialize dictionary with default values and update it with the # information from parsing the doc string. # set doc [dict create param "" protection public varargs_p false deprecated_p false warn_p false script [::xo::api script_name -obj $obj $scope] ] set doc [dict replace $doc {*}[array get doc_elements]] # # TODO: add actual parameters to flags and defaults (also required, ...) # set switches {}; set flags {} foreach l [dict get $doc param] { if {[regexp {^([^ ]+)\s} $l . word]} { lappend switches $word lappend flags $word "" } } set proc_index [::xo::api object_index $scope $obj] set doc [dict replace $doc default_values "" switches0 $switches switches1 "" positionals "" flags $flags ] #ns_log notice "proc_index <$proc_index> -> $doc" if {![nsv_exists api_proc_doc $proc_index]} { nsv_lappend api_proc_doc_scripts [dict get $doc script] $proc_index } nsv_set api_proc_doc $proc_index $doc nsv_set api_library_doc $proc_index $doc set file_index [dict get $doc script] if {[nsv_exists api_library_doc $file_index]} { array set elements [nsv_get api_library_doc $file_index] } set oldDoc [expr {[info exists elements(main)] ? [lindex $elements(main) 0] : ""}] set prefix "This file defines the following Objects and Classes" set entry [::xo::api object_link $scope $obj] if {![string match "*$prefix*" $oldDoc]} { append oldDoc "<p>$prefix: $entry" } else { append oldDoc ", $entry" } set elements(main) [list $oldDoc] #ns_log notice "elements = [array get elements]" nsv_set api_library_doc $file_index [array get elements] if {[::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::nx::Class]} { # # nx classes # foreach protection {public protected private} { foreach m [::nsf::dispatch $obj ::nsf::methods::class::info::methods -path -callprotection $protection -type scripted] { set docBlock [:get_doc_block [::nsf::dispatch $obj ::nsf::methods::class::info::method body $m]] ::xo::api update_method_doc -protection $protection -deprecated=false -debug=false $scope $obj inst $m $docBlock } } } if {[::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::nx::Object]} { # # nx objects # foreach protection {public protected private} { foreach m [::nsf::dispatch $obj ::nsf::methods::object::info::methods -callprotection $protection -type scripted] { set docBlock [:get_doc_block [::nsf::dispatch $obj ::nsf::methods::object::info::method body $m]] ::xo::api update_method_doc -protection $protection -deprecated=false -debug=false $scope $obj "" $m $docBlock } } }XQL Not present: Generic, PostgreSQL, Oracle