Blame testing/057_caller_graphs.tcl

Packit Service 50c9f2
#// objective: test for completeness and correctness of references/referencedby relations 
Packit Service 50c9f2
#// check: 057__caller__graphs_8tcl.xml
Packit Service 50c9f2
#// check: __057__caller__graphs_8tcl.xml
Packit Service 50c9f2
#// check: namespacebar.xml
Packit Service 50c9f2
#// check: namespacefoo.xml
Packit Service 50c9f2
#// check: namespace1.xml
Packit Service 50c9f2
#// check: namespace1_1_11.xml
Packit Service 50c9f2
#// check: namespace1_1_11_1_11.xml
Packit Service 50c9f2
#// check: namespace2.xml
Packit Service 50c9f2
#// check: namespace2_1_12.xml
Packit Service 50c9f2
#// check: namespace2_1_12_1_12.xml
Packit Service 50c9f2
#// check: namespace2_1_12_1_12_1_12.xml
Packit Service 50c9f2
#// check: namespace2_1_12_1_12_1_12_1_12.xml
Packit Service 50c9f2
#// config: EXTRACT_ALL = yes
Packit Service 50c9f2
#// config: INLINE_SOURCES = no
Packit Service 50c9f2
#// config: REFERENCED_BY_RELATION = yes
Packit Service 50c9f2
#// config: REFERENCES_RELATION = yes
Packit Service 50c9f2
#// config: INPUT = $INPUTDIR/057_caller_graphs.tcl $INPUTDIR/_057_caller_graphs.tcl
Packit Service 50c9f2
# config: HAVE_DOT = yes
Packit Service 50c9f2
# config: CALLER_GRAPH = yes
Packit Service 50c9f2
# config: CALL_GRAPH = yes
Packit Service 50c9f2
# config: GENERATE_HTML = yes
Packit Service 50c9f2
Packit Service 50c9f2
# This is a stripped down example from my code.
Packit Service 50c9f2
# Doxygen 1.8.7 generates the correct relations (xml)
Packit Service 50c9f2
# but caller graphs will be incomplete.
Packit Service 50c9f2
# It does not generate any relations at all if INLINE_SOURCES = no.
Packit Service 50c9f2
namespace eval bar {}
Packit Service 50c9f2
proc bar::slave { } {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
    if {1} then {
Packit Service 50c9f2
        bar::baz
Packit Service 50c9f2
    }
Packit Service 50c9f2
    return 
Packit Service 50c9f2
}
Packit Service 50c9f2
proc bar::baz {} {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
    bar::bazbaz
Packit Service 50c9f2
}
Packit Service 50c9f2
proc bar::bazbaz {} {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
}
Packit Service 50c9f2
namespace eval foo {}
Packit Service 50c9f2
proc foo::master {  } {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline $info(proc)
Packit Service 50c9f2
    bar::slave
Packit Service 50c9f2
    return
Packit Service 50c9f2
}
Packit Service 50c9f2
#
Packit Service 50c9f2
# now we check tcl's rules: from the help
Packit Service 50c9f2
# NAME RESOLUTION
Packit Service 50c9f2
#... Command names are also always resolved by looking in the current
Packit Service 50c9f2
#namespace first. If not found there, they are searched for in every namespace on
Packit Service 50c9f2
#the current namespace's command path (which is empty by default). If not found
Packit Service 50c9f2
#there, command names are looked up in the global namespace (or, failing that,
Packit Service 50c9f2
#are processed by the unknown command.) ...
Packit Service 50c9f2
#
Packit Service 50c9f2
namespace eval ::1::1::1 {}
Packit Service 50c9f2
proc ::baz args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::baz args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::bar args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::bar args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::1::bar args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::1::1::bar args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::test1 args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline $info(proc)
Packit Service 50c9f2
    baz
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::test2 args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline $info(proc)
Packit Service 50c9f2
    bar
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::test3 args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline $info(proc)
Packit Service 50c9f2
    ::bar
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::test4 args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline $info(proc)
Packit Service 50c9f2
    1::bar
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::1::test5 args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline $info(proc)
Packit Service 50c9f2
    1::baz
Packit Service 50c9f2
}
Packit Service 50c9f2
#
Packit Service 50c9f2
# funny example, do you see the infinite loop?
Packit Service 50c9f2
# we stop before the interpreter crashes
Packit Service 50c9f2
set ::countdown 10
Packit Service 50c9f2
namespace eval ::2::2::2::2::2 {}
Packit Service 50c9f2
proc ::next args {
Packit Service 50c9f2
    array set info [info frame 0]; puts $info(proc)
Packit Service 50c9f2
    2::next
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::2::next args {
Packit Service 50c9f2
    array set info [info frame 0]; puts $info(proc)
Packit Service 50c9f2
    incr ::countdown -1
Packit Service 50c9f2
    if {$::countdown>0} then {
Packit Service 50c9f2
        2::next
Packit Service 50c9f2
    } else {
Packit Service 50c9f2
        puts "stop after 10 rounds."
Packit Service 50c9f2
    }
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::2::2::next args {
Packit Service 50c9f2
    array set info [info frame 0]; puts $info(proc)
Packit Service 50c9f2
    2::next
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::2::2::2::next args {
Packit Service 50c9f2
    array set info [info frame 0]; puts $info(proc)
Packit Service 50c9f2
    2::next
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::2::2::2::2::next args {
Packit Service 50c9f2
    array set info [info frame 0]; puts $info(proc)
Packit Service 50c9f2
    2::next
Packit Service 50c9f2
}
Packit Service 50c9f2
proc ::2::2::2::2::2::next args {
Packit Service 50c9f2
    array set info [info frame 0]; puts $info(proc)
Packit Service 50c9f2
    2::next
Packit Service 50c9f2
}
Packit Service 50c9f2
#
Packit Service 50c9f2
# cross check with two files
Packit Service 50c9f2
# If doxygen did not do two passes, then xrefs would depend on file order
Packit Service 50c9f2
# and would be incomplete.
Packit Service 50c9f2
source _057_caller_graphs.tcl
Packit Service 50c9f2
proc master args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
    inFileB
Packit Service 50c9f2
    return
Packit Service 50c9f2
}
Packit Service 50c9f2
proc inFileA args {
Packit Service 50c9f2
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Packit Service 50c9f2
    return
Packit Service 50c9f2
}
Packit Service 50c9f2
# now, check with tcl what is called
Packit Service 50c9f2
foo::master
Packit Service 50c9f2
puts ""
Packit Service 50c9f2
foreach proc [lsort [info procs ::1::test?]] {
Packit Service 50c9f2
    $proc
Packit Service 50c9f2
    puts ""
Packit Service 50c9f2
}
Packit Service 50c9f2
::next
Packit Service 50c9f2
master
Packit Service 50c9f2
exit
Packit Service 50c9f2