* wrap/python/cgi/ltl2tgba.in: Handle show_formula_dot and

show_formula_gif.
This commit is contained in:
Alexandre Duret-Lutz 2003-08-06 09:52:04 +00:00
parent fe2f726863
commit c7a269dddc
2 changed files with 23 additions and 1 deletions

View file

@ -1,5 +1,8 @@
2003-08-06 Alexandre Duret-Lutz <adl@gnu.org> 2003-08-06 Alexandre Duret-Lutz <adl@gnu.org>
* 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/dotty.hh (dotty): Move the ostream argument first.
* src/ltlvisit/dump.hh (dump): Likewise. * src/ltlvisit/dump.hh (dump): Likewise.
* src/ltltest/equals.cc, src/ltltest/readltl.cc, * src/ltltest/equals.cc, src/ltltest/readltl.cc,

View file

@ -1,4 +1,5 @@
#!@PYTHON@ #!@PYTHON@
# -*- python -*-
import sys import sys
import os import os
@ -6,7 +7,7 @@ import cgi
import cgitb; cgitb.enable() import cgitb; cgitb.enable()
sys.path.insert(0, '@pythondir@') 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' imgdir = 'spotimg'
# Cleanup stale files from our image directory. # Cleanup stale files from our image directory.
@ -51,6 +52,8 @@ formula = form.getfirst('formula', '')
options = [ options = [
('show_parse', 'show traces during parsing', 0), ('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_dot', 'print Büchi automaton as .dot', 0),
('show_automaton_gif', 'draw Büchi automaton', 1), ('show_automaton_gif', 'draw Büchi automaton', 1),
('show_degen_dot', 'print degeneralized Büchi automaton as .dot', 0), ('show_degen_dot', 'print degeneralized Büchi automaton as .dot', 0),
@ -112,6 +115,22 @@ if err:
print "<p>Formula is<code>", f, "</code></p>" print "<p>Formula is<code>", f, "</code></p>"
if show_formula_dot:
print '<pre>'; sys.stdout.flush()
s = spot.ostringstream()
spot.dotty(s, f)
print cgi.escape(s.str())
del s
print '</pre>'; 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 '<img src="' + imgprefix + '-f.gif">'
print '<H2>Automaton</H2>' print '<H2>Automaton</H2>'
dict = spot.bdd_dict() dict = spot.bdd_dict()