Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
47489236
Commit
47489236
authored
Feb 02, 2004
by
Alexandre Duret-Lutz
Browse files
* wrap/python/cgi/ltl2tgba.in (render_dot, render_automaton)
(render_bdd): New functions, extracted from the rest of the code.
parent
dae794aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
47489236
2004-02-02 Alexandre Duret-Lutz <adl@gnu.org>
* wrap/python/cgi/ltl2tgba.in (render_dot, render_automaton)
(render_bdd): New functions, extracted from the rest of the code.
* wrap/python/cgi/ltl2tgba.in (default_translator): Default
to trans_fm.
(translators): Show trans_fm before trans_lacim.
...
...
wrap/python/cgi/ltl2tgba.in
View file @
47489236
#!@PYTHON@
# -*-
python
-*-
# -*-
mode: python; coding: iso-8859-1
-*-
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
# et Marie Curie.
...
...
@@ -71,6 +71,25 @@ def print_stats(automaton):
print
"</p>"
sys
.
stdout
.
flush
()
def
render_dot
(
basename
):
os
.
spawnlp
(
os
.
P_WAIT
,
'dot'
,
'dot'
,
'-Tgif'
,
'-Gsize=14,14'
,
'-o'
,
basename
+
'.gif'
,
basename
+
'.dot'
)
os
.
spawnlp
(
os
.
P_WAIT
,
'convert'
,
'convert'
,
basename
+
'.gif'
,
basename
+
'.png'
)
print
'<img src="'
+
basename
+
'.png">'
def
render_automaton
(
basename
,
automata
):
outfile
=
spot
.
ofstream
(
basename
+
'.dot'
)
spot
.
dotty_reachable
(
outfile
,
automata
)
del
outfile
render_dot
(
basename
)
def
render_bdd
(
basename
,
dictionary
,
bdd
):
outfile
=
spot
.
ofstream
(
basename
+
'.dot'
)
spot
.
bdd_print_dot
(
outfile
,
dictionary
,
bdd
)
del
outfile
render_dot
(
basename
)
print
"Content-Type: text/html"
print
...
...
@@ -214,15 +233,7 @@ if show_automaton_dot:
print
'</pre>'
;
sys
.
stdout
.
flush
()
if
show_automaton_gif
:
outfile
=
spot
.
ofstream
(
imgprefix
+
'-a.dot'
)
spot
.
dotty_reachable
(
outfile
,
automaton
)
del
outfile
os
.
spawnlp
(
os
.
P_WAIT
,
'dot'
,
'dot'
,
'-Tgif'
,
'-Gsize=14,14'
,
'-o'
,
imgprefix
+
'-a.gif'
,
imgprefix
+
'-a.dot'
)
os
.
spawnlp
(
os
.
P_WAIT
,
'convert'
,
'convert'
,
imgprefix
+
'-a.gif'
,
imgprefix
+
'-a.png'
)
print
'<img src="'
+
imgprefix
+
'-a.png">'
render_automaton
(
imgprefix
+
'-a'
,
automaton
)
if
show_degen_dot
or
show_degen_gif
:
print
'<H3>Degeneralized automaton</H3>'
...
...
@@ -236,14 +247,7 @@ if show_degen_dot or show_degen_gif:
del
s
print
'</pre>'
;
sys
.
stdout
.
flush
()
if
show_degen_gif
:
outfile
=
spot
.
ofstream
(
imgprefix
+
'-d.dot'
)
spot
.
dotty_reachable
(
outfile
,
degen
)
del
outfile
os
.
spawnlp
(
os
.
P_WAIT
,
'dot'
,
'dot'
,
'-Tgif'
,
'-Gsize=14,14'
,
'-o'
,
imgprefix
+
'-d.gif'
,
imgprefix
+
'-d.dot'
)
os
.
spawnlp
(
os
.
P_WAIT
,
'convert'
,
'convert'
,
imgprefix
+
'-d.gif'
,
imgprefix
+
'-d.png'
)
print
'<img src="'
+
imgprefix
+
'-d.png">'
render_automaton
(
imgprefix
+
'-d'
,
degen
)
else
:
degen
=
0
...
...
@@ -264,35 +268,21 @@ if (type(automaton) == spot.tgba_bdd_concretePtr
escaped_print_set
(
automaton
.
get_dict
(),
automaton
.
get_core_data
().
relation
)
if
show_relation_gif
:
outfile
=
spot
.
ofstream
(
imgprefix
+
'-b.dot'
)
spot
.
bdd_print_dot
(
outfile
,
automaton
.
get_dict
(),
automaton
.
get_core_data
().
relation
)
del
outfile
os
.
spawnlp
(
os
.
P_WAIT
,
'dot'
,
'dot'
,
'-Tgif'
,
'-Gsize=14,14'
,
'-o'
,
imgprefix
+
'-b.gif'
,
imgprefix
+
'-b.dot'
)
os
.
spawnlp
(
os
.
P_WAIT
,
'convert'
,
'convert'
,
imgprefix
+
'-b.gif'
,
imgprefix
+
'-b.png'
)
print
'<img src="'
+
imgprefix
+
'-b.png">'
render_bdd
(
imgprefix
+
'-b'
,
automaton
.
get_dict
(),
automaton
.
get_core_data
().
relation
)
if
(
type
(
automaton
)
==
spot
.
tgba_bdd_concretePtr
and
(
show_acceptance_dot
or
show_acceptance_set
or
show_acceptance_gif
)):
print
'<H3>Acceptance relation</H3>'
if
show_acceptance_dot
:
escaped_print_dot
(
automaton
.
get_dict
(),
automaton
.
get_core_data
().
accept
ing
_conditions
)
automaton
.
get_core_data
().
accept
ance
_conditions
)
if
show_acceptance_set
:
escaped_print_set
(
automaton
.
get_dict
(),
automaton
.
get_core_data
().
accept
ing
_conditions
)
automaton
.
get_core_data
().
accept
ance
_conditions
)
if
show_acceptance_gif
:
outfile
=
spot
.
ofstream
(
imgprefix
+
'-c.dot'
)
spot
.
bdd_print_dot
(
outfile
,
automaton
.
get_dict
(),
automaton
.
get_core_data
().
accepting_conditions
)
del
outfile
os
.
spawnlp
(
os
.
P_WAIT
,
'dot'
,
'dot'
,
'-Tgif'
,
'-Gsize=14,14'
,
'-o'
,
imgprefix
+
'-c.gif'
,
imgprefix
+
'-c.dot'
)
os
.
spawnlp
(
os
.
P_WAIT
,
'convert'
,
'convert'
,
imgprefix
+
'-c.gif'
,
imgprefix
+
'-c.png'
)
print
'<img src="'
+
imgprefix
+
'-c.png">'
render_bdd
(
imgprefix
+
'-c'
,
automaton
.
get_dict
(),
automaton
.
get_core_data
().
acceptance_conditions
)
if
show_lbtt
:
print
'<H3>LBTT conversion</H3>'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment