summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2015-10-25 00:57:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2015-10-25 00:57:53 (GMT)
commit66718c29e87bb9d9a3e521373c60d5c812c04736 (patch)
treebab25345d19851aff8e603de0fbc2746afbc05f8
parent8493e90ff204597cf5a0277be39455380a5ec36c (diff)
downloadtcl-66718c29e87bb9d9a3e521373c60d5c812c04736.zip
tcl-66718c29e87bb9d9a3e521373c60d5c812c04736.tar.gz
tcl-66718c29e87bb9d9a3e521373c60d5c812c04736.tar.bz2
Added drh's analysis wrapper script so that we don't need to keep private copies.
-rw-r--r--tools/cgannotate.tcl24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/cgannotate.tcl b/tools/cgannotate.tcl
new file mode 100644
index 0000000..f8b9b7d
--- /dev/null
+++ b/tools/cgannotate.tcl
@@ -0,0 +1,24 @@
+#!/usr/bin/tclsh
+#
+# A wrapper around cg_annotate that sets appropriate command-line options
+# and rearranges the output so that annotated files occur in a consistent
+# sorted order.
+#
+
+set in [open |[list cg_annotate --show=Ir --auto=yes --context=40 {*}$argv] r]
+set dest !
+set out(!) {}
+while {![eof $in]} {
+ set line [string map {\t { }} [gets $in]]
+ if {[regexp {^-- Auto-annotated source: (.*)} $line all name]} {
+ set dest $name
+ } elseif {[regexp {^-- line \d+ ------} $line]} {
+ set line [lreplace $line 2 2 {#}]
+ } elseif {[regexp {^The following files chosen for } $line]} {
+ set dest !
+ }
+ append out($dest) $line\n
+}
+foreach x [lsort [array names out]] {
+ puts $out($x)
+}