1 #// objective: tests processing of commands inside brackets [], only references/referencedby relations are relevant
2 #// check: 058__bracket__recursion_8tcl.xml
3 #// config: REFERENCED_BY_RELATION = yes
4 #// config: REFERENCES_RELATION = yes
5 #// config: EXTRACT_ALL = yes
6 #// config: INLINE_SOURCES = yes
9 # \brief should be reference by every proc below
11 puts "Procedure \"Invoked\" is invoked indeed. Ok."
15 # \brief must not be reference by every proc below
16 proc NotInvoked args {
17 puts "Procedure \"NotInvoked\" is invoked. Not Ok!"
21 # check if call references work at all
27 # check brackets with various quoting, bracing
30 set r [list \[NotInvoked \]]
40 set r "\[NotInvoked \]"
44 set r [list \[NotInvoked [Invoked]\]]
48 set r [list [Invoked \[NotInvoked \]]]
53 set r "{\[NotInvoked \]}"
57 [Invoked set] r {[NotInvoked]}
60 # check brackets in tcl commands containing script arguments
62 # example generated according to
63 # https://groups.google.com/d/msg/comp.lang.tcl/G5-mc3GiIyY/e-AVD9t7xMkJ
65 foreach item [Invoked] {
70 foreach [Invoked item] [list one two three] {
79 for {} {[Invoked 0]} {} {
92 } elseif {[Invoked 0]} {
95 # these are really nasty examples
96 # they shows, that the condition argument may not be parsed as a script
97 set NotInvoked \$NotInvoked
98 proc $NotInvoked args {
99 puts "Procedure \"\$NotInvoked\" is invoked. Not Ok!"
103 set NotInvoked \$NotInvoked
104 if {$NotInvoked eq [Invoked 1]} {
109 set NotInvoked \$NotInvoked
111 } elseif {$NotInvoked eq [Invoked 1]} {
116 set NotInvoked \$NotInvoked
117 while {$NotInvoked eq [Invoked 1]} {
122 set NotInvoked \$NotInvoked
123 for {} {$NotInvoked eq [Invoked 1]} {} {
127 # dangling open brackets should not confuse the scanner
129 set foo ]]]][Invoked]
132 # Example according to
133 # https://bugzilla.gnome.org/show_bug.cgi?id=729135
135 # Note the subtle difference in this | whitespace
138 set classifier_state {{bphy} }
139 if { ($classifier_state == {{bphy} }) } {
144 set classifier_state {{bphy} }
145 if { ($classifier_state == {{bphy} } ) } {
150 # call all single letter procs
151 # let tcl check what is called and what is not called
152 foreach p [info procs ?] {
153 puts "Check procedure \"$p\""