summaryrefslogtreecommitdiff
path: root/dev/univdot
diff options
context:
space:
mode:
authorGravatar Samuel Mimram <samuel.mimram@ens-lyon.org>2004-07-28 21:54:47 +0000
committerGravatar Samuel Mimram <samuel.mimram@ens-lyon.org>2004-07-28 21:54:47 +0000
commit6b649aba925b6f7462da07599fe67ebb12a3460e (patch)
tree43656bcaa51164548f3fa14e5b10de5ef1088574 /dev/univdot
Imported Upstream version 8.0pl1upstream/8.0pl1
Diffstat (limited to 'dev/univdot')
-rwxr-xr-xdev/univdot49
1 files changed, 49 insertions, 0 deletions
diff --git a/dev/univdot b/dev/univdot
new file mode 100755
index 00000000..bb0dd2c8
--- /dev/null
+++ b/dev/univdot
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+usage() {
+ echo ""
+ echo "usage: univdot [INPUT] [OUTPUT]"
+ echo ""
+ echo "takes the output of Dump Universes \"file\" command"
+ echo "and transforms it to the dot format"
+ echo ""
+ echo "Coq> Dump Universes \"univ.raw\"."
+ echo ""
+ echo "user@host> univdot univ.raw | dot -Tps > univ.ps"
+ echo ""
+}
+
+
+# these are dot edge attributes to draw arrows corresponding
+# to > >= and = edges of the universe graph
+
+GT="[color=red]"
+GE="[color=blue]"
+EQ="[color=black]"
+
+
+# input/output redirection
+case $# in
+ 0) ;;
+ 1) case $1 in
+ -h|-help|--help) usage
+ exit 0 ;;
+ *) exec < $1 ;;
+ esac ;;
+ 2) exec < $1 > $2 ;;
+ *) usage
+ exit 0;;
+esac
+
+
+# dot header
+echo 'digraph G {\
+ size="7.5,10" ;\
+ rankdir = TB ;'
+
+sed -e "s/^\([^ =>]\+\) > \([^ =>]\+\)/\1 -> \2 $GT/" \
+ -e "s/^\([^ =>]\+\) >= \([^ =>]\+\)/\1 -> \2 $GE/" \
+ -e "s/^\([^ =>]\+\) = \([^ =>]\+\)/\1 -> \2 $EQ/" \
+| sed -e "s/\./_/g"
+
+echo "}" \ No newline at end of file