From c7a269dddc3173cce9383baecf9d2597a9211c1f Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 6 Aug 2003 09:52:04 +0000 Subject: [PATCH] * wrap/python/cgi/ltl2tgba.in: Handle show_formula_dot and show_formula_gif. --- ChangeLog | 3 +++ wrap/python/cgi/ltl2tgba.in | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c63d32901..988d2fccb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-08-06 Alexandre Duret-Lutz + * wrap/python/cgi/ltl2tgba.in: Handle show_formula_dot and + show_formula_gif. + * src/ltlvisit/dotty.hh (dotty): Move the ostream argument first. * src/ltlvisit/dump.hh (dump): Likewise. * src/ltltest/equals.cc, src/ltltest/readltl.cc, diff --git a/wrap/python/cgi/ltl2tgba.in b/wrap/python/cgi/ltl2tgba.in index c4c536aaf..7b33e0712 100644 --- a/wrap/python/cgi/ltl2tgba.in +++ b/wrap/python/cgi/ltl2tgba.in @@ -1,4 +1,5 @@ #!@PYTHON@ +# -*- python -*- import sys import os @@ -6,7 +7,7 @@ import cgi import cgitb; cgitb.enable() sys.path.insert(0, '@pythondir@') -# Directory for temporary files (images and other auxiliary files). +# Directory for temporary files (images and other auxiliary files). imgdir = 'spotimg' # Cleanup stale files from our image directory. @@ -51,6 +52,8 @@ formula = form.getfirst('formula', '') options = [ ('show_parse', 'show traces during parsing', 0), + ('show_formula_dot', 'print the formula as .dot', 0), + ('show_formula_gif', 'draw the formula', 0), ('show_automaton_dot', 'print Büchi automaton as .dot', 0), ('show_automaton_gif', 'draw Büchi automaton', 1), ('show_degen_dot', 'print degeneralized Büchi automaton as .dot', 0), @@ -112,6 +115,22 @@ if err: print "

Formula is", f, "

" +if show_formula_dot: + print '
'; sys.stdout.flush()
+    s = spot.ostringstream()
+    spot.dotty(s, f)
+    print cgi.escape(s.str())
+    del s
+    print '
'; sys.stdout.flush() +if show_formula_gif: + outfile = spot.ofstream(imgprefix + '-f.dot') + spot.dotty(outfile, f) + del outfile + os.spawnlp(os.P_WAIT, 'dot', 'dot', '-Tgif', '-o', + imgprefix + '-f.gif', imgprefix + '-f.dot') + print '' + + print '

Automaton

' dict = spot.bdd_dict()