api_called_proc_names (private)
api_called_proc_names [ -body body ] -proc_name proc_name
Defined in packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl
Return list of procs called by the specified procname handle. Note that this function is based on "::apidoc::tcl_to_html", which is based on some heuristics and is not guaranteed to return always the correct results (it might contain false positives). Use this private function only, when heuristics are fine.
- Switches:
- -body (optional)
- -proc_name (required)
- name is fully qualified name without leading colons proc procs, XOTcl methods are a triple with the fully qualified class name, then proc|instproc and then the method name.
- Author:
- Gustaf Neumann
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- callgraph__bad_library_calls, callgraph__bad_page_calls
Source code: if {[info exists body]} { # # Get the calling information directly from the body, when # e.g. the information is not in the procdoc nsv. This is # e.g. necessary, when getting calling info from *-init.tcl # files. # set body [apidoc::tclcode_to_html $body] } else { # # Get calling info from prettified proc body # try { ::apidoc::tcl_to_html $proc_name } on ok {result} { set body $result #ns_log notice "api_called_proc_names <$proc_name> got body <$body>" } on error {errorMsg} { ns_log warning "api_called_proc_names: cannot obtain body of '$proc_name'" "via ::apidoc::tcl_to_html: $errorMsg" return "" } } dom parse -html <p>$body</p> doc $doc documentElement root set called {} foreach a [$root selectNodes //a] { set href [$a getAttribute href] # # When the href points to a proc, record this as calling info # if {[regexp {/api-doc/proc-view[?]proc=(.*)&} $href . called_proc]} { set called_proc [string trimleft [ns_urldecode $called_proc] :] lappend called $called_proc } } #ns_log notice "api_called_proc_names: <$proc_name> calls $called" return [lsort -unique $called]XQL Not present: Generic, PostgreSQL, Oracle