summaryrefslogtreecommitdiffstats
path: root/testing/059_command_catch.tcl
diff options
context:
space:
mode:
authorwtschueller <wtschueller@users.noreply.github.com>2014-06-17 19:50:40 (GMT)
committerwtschueller <wtschueller@users.noreply.github.com>2014-06-17 19:50:40 (GMT)
commit9d24b488add8b4c7c689f58a095184a6ed85e9f1 (patch)
tree1c7d2ba0103ef29da519a51a05a9bd8a2ddb1832 /testing/059_command_catch.tcl
parent3d05cb6dd47e02b1e8c5e35cf51b440f1d57c5b4 (diff)
downloadDoxygen-9d24b488add8b4c7c689f58a095184a6ed85e9f1.zip
Doxygen-9d24b488add8b4c7c689f58a095184a6ed85e9f1.tar.gz
Doxygen-9d24b488add8b4c7c689f58a095184a6ed85e9f1.tar.bz2
Tcl: support eval/catch commands
--HG-- extra : rebase_source : 5d7e3a2b3c549419c672cddd8d780542053d68bb
Diffstat (limited to 'testing/059_command_catch.tcl')
-rw-r--r--testing/059_command_catch.tcl87
1 files changed, 87 insertions, 0 deletions
diff --git a/testing/059_command_catch.tcl b/testing/059_command_catch.tcl
new file mode 100644
index 0000000..4227da7
--- /dev/null
+++ b/testing/059_command_catch.tcl
@@ -0,0 +1,87 @@
+#// objective: tests processing of catch/eval, only references/referencedby relations are relevant
+#// check: 059__command__catch_8tcl.xml
+#// config: REFERENCED_BY_RELATION = yes
+#// config: REFERENCES_RELATION = yes
+#// config: EXTRACT_ALL = yes
+#// config: INLINE_SOURCES = no
+
+##
+# \brief should be reference by every proc below
+proc Invoked args {
+ puts "Procedure \"Invoked\" is invoked indeed. Ok."
+ return $args
+}
+##
+# \brief must not be reference by every proc below
+proc NotInvoked args {
+ puts "Procedure \"NotInvoked\" is invoked. Not Ok!"
+ return $args
+}
+#
+# check if call references work at all
+proc a args {
+ Invoked NotInvoked
+ return
+}
+#
+# catch command
+# Tcl8.5: catch script ?resultVarName? ?optionsVarName?
+proc b args {
+ catch Invoked
+ return
+}
+proc c args {
+ catch Invoked NotInvoked
+ return
+}
+proc d args {
+ catch Invoked NotInvoked NotInvoked
+ return
+}
+proc e args {
+ set r [catch Invoked NotInvoked NotInvoked]
+ return
+}
+proc f args {
+ set r [catch {Invoked} NotInvoked NotInvoked]
+ return
+}
+proc g args {
+ set r [catch {
+ set x [Invoked]
+ } NotInvoked NotInvoked]
+ return
+}
+# eval arg ?arg ...?
+proc h args {
+ eval Invoked NotInvoked
+ return
+}
+proc i args {
+ eval set NotInvoked [Invoked NotInvoked]
+ return
+}
+# This is a striped down example. Original:
+#
+# jpeg.tcl --
+#
+# Querying and modifying JPEG image files.
+#
+# Copyright (c) 2004 Aaron Faupell <afaupell@users.sourceforge.net>
+#
+# ...
+# eval [list addComment $file] [lreplace $com 0 0 $comment]
+# ...
+proc j args {
+ eval [list set] [list NotInvoked] [Invoked NotInvoked]
+ return
+}
+#
+# call all single letter procs
+# let tcl check what is called and what is not called
+foreach p [info procs ?] {
+ puts "Check procedure \"$p\""
+ $p
+}
+exit
+