summaryrefslogtreecommitdiff
path: root/starmath/workben/smath-dump-watch.sh
diff options
context:
space:
mode:
authorJonas Finnemann Jensen <jopsen@gmail.com>2010-10-28 23:59:35 +0200
committerJonas Finnemann Jensen <jopsen@gmail.com>2010-10-28 23:59:35 +0200
commit4a32655ef510d11dd3ab93a519554455c7c2e82e (patch)
treebb8567c2b901344fbdd996f3d7abb8a4b99db17b /starmath/workben/smath-dump-watch.sh
parentb9a06728f8f5b7c77684b9c5510e957c21f39e83 (diff)
Updating todo-file for visual editor, and adding graph dump script
Diffstat (limited to 'starmath/workben/smath-dump-watch.sh')
-rwxr-xr-xstarmath/workben/smath-dump-watch.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/starmath/workben/smath-dump-watch.sh b/starmath/workben/smath-dump-watch.sh
new file mode 100755
index 000000000000..21ec5f14ad35
--- /dev/null
+++ b/starmath/workben/smath-dump-watch.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+
+# Watches for formula dumps by starmath and renders them
+# If starmath is compiled with the macro DEBUG_ENABLE_DUMPASDOT defined.
+# shift+enter, in the visual formula editor will make starmath dump a
+# graphviz graph of the formula tree structure. This is very useful when
+# debugging. The formula is dumped to /tmp/smath-dump.gv-
+# This script monitors this file and renders the graph when written,
+# after which the formula is displayed using feh.
+#
+# Usage: Let this script run in the background, e.g. start it in a terminal
+# (and don't close the terminal). Then compile starmath with DEBUG_ENABLE_DUMPASDOT
+# defined, use the visual formula editor to write something and hit shift+enter.
+#
+# Note: This won't work on Windows as the /tmp/ folder will be missing.
+#
+# Author: "Jonas Finnemann Jensen" <jopsen@gmail.com>
+
+touch /tmp/smath-dump.gv;
+while inotifywait -q -e close_write /tmp/smath-dump.gv;
+do
+ dot -Tpng < /tmp/smath-dump.gv > /tmp/smath-dump.png; > /dev/null
+ kill `pidof -s feh`; > /dev/null
+ feh /tmp/smath-dump.png & > /dev/null
+done