api_add_calling_info_to_procdoc (private)

 api_add_calling_info_to_procdoc [ proc_name ]

Defined in packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl

Add the calling information (what are the functions called by this proc_name) to the collected proc_doc information.

Parameters:
proc_name (optional, defaults to "*")
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 api_add_to_proc_doc api_add_to_proc_doc (public) api_called_proc_names api_called_proc_names (private) apm_enabled_packages apm_enabled_packages (public) apm_get_package_files apm_get_package_files (public) template::util::read_file template::util::read_file (public) api_add_calling_info_to_procdoc api_add_calling_info_to_procdoc api_add_calling_info_to_procdoc->api_add_to_proc_doc api_add_calling_info_to_procdoc->api_called_proc_names api_add_calling_info_to_procdoc->apm_enabled_packages api_add_calling_info_to_procdoc->apm_get_package_files api_add_calling_info_to_procdoc->template::util::read_file

Testcases:
No testcase defined.
Source code:
    if {$proc_name eq "*"} {
        set proc_names [nsv_array names api_proc_doc]
    } else {
        set proc_names [list $proc_name]
    }

    #
    # Get calling information from init files
    #
    set init_files packages/acs-bootstrap-installer/bootstrap.tcl
    foreach package_key [apm_enabled_packages] {
        foreach file [apm_get_package_files  -package_key $package_key  -file_types  {tcl_init content_page include_page}] {
            if {[file extension $file] eq ".tcl"} {
                lappend init_files packages/$package_key/$file
            }
        }
    }

    foreach init_file $init_files {
        set file_contents [template::util::read_file $::acs::rootdir/$init_file]
        foreach called [api_called_proc_names -proc_name $init_file -body $file_contents] {
            api_add_to_proc_doc  -proc_name $called  -property calledby  -value $init_file
        }
    }

    #
    # Get calling information from procs
    #
    foreach proc_name $proc_names {
        if {[regexp {^_([^_]+)__(.*)$} $proc_name . package_key testcase_id]} {
            #
            # Turn this test-case cross-check just on, when needed for debugging.
            #
            if {0} {
                set calls {}
                foreach call [api_called_proc_names -proc_name $proc_name] {
                    #
                    # Ignore aa_* calls (the testing infrastructure is
                    # explicitly tested).
                    #
                    if {[string match "aa_*" $call]} continue

                    #
                    # Check, if these cases are already covered.
                    #
                    set covered 0
                    if {[nsv_exists api_proc_doc $call]} {
                        set called_proc_doc [nsv_get api_proc_doc $call]
                        #ns_log notice "procdoc for $call has testcase [dict exists $called_proc_doc testcase]"
                        if {[dict exists $called_proc_doc testcase]} {
                            set testcase_pair [list $testcase_id $package_key]
                            ns_log notice "$call is covered by cases [dict get $called_proc_doc testcase] - new case included [expr {$testcase_pair in [dict get $called_proc_doc testcase]}]"
                            set covered [expr {$testcase_pair in [dict get $called_proc_doc testcase]}]
                        }
                    }

                    #
                    # Only list remaining calls to suggestions.
                    #
                    if {!$covered} {
                        lappend calls $call
                    }
                }
                if {[llength $calls] > 0} {
                    ns_log notice "potential test_cases $package_key $testcase_id $package_key: $calls"
                }
            }
        } else {
            foreach called [api_called_proc_names -proc_name $proc_name] {

                api_add_to_proc_doc  -proc_name $called  -property calledby  -value $proc_name
            }
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: