From 72ae820b0cca3b9c98c6b4ea7dc52aa004dfef4d Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 2 Feb 2010 16:58:14 +0100 Subject: [PATCH] Add SVG output and language containment options to the cgi script. * wrap/python/cgi-bin/ltl2tgba.in (new): Mark new options as new. (svg_output, reduce_langcout): Add these new options. (render_dot): Support svg_output. --- ChangeLog | 8 ++++++++ wrap/python/cgi-bin/ltl2tgba.in | 29 ++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index dafd02677..b8a91fb6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-02-02 Alexandre Duret-Lutz + + Add SVG output and language containment options to the cgi script. + + * wrap/python/cgi-bin/ltl2tgba.in (new): Mark new options as new. + (svg_output, reduce_langcout): Add these new options. + (render_dot): Support svg_output. + 2010-02-02 Alexandre Duret-Lutz * NEWS: Typo. diff --git a/wrap/python/cgi-bin/ltl2tgba.in b/wrap/python/cgi-bin/ltl2tgba.in index ca0f50bd3..2111bd501 100755 --- a/wrap/python/cgi-bin/ltl2tgba.in +++ b/wrap/python/cgi-bin/ltl2tgba.in @@ -192,11 +192,20 @@ def print_stats(automaton): return False def render_dot(basename): - os.spawnlp(os.P_WAIT, dot, dot, dot_bgcolor, '-Tpng', - '-Gsize=14,14', '-o', basename + '.png', basename + '.txt') + if svg_output: + ext = 'svg' + else: + ext = 'png' + os.spawnlp(os.P_WAIT, dot, dot, dot_bgcolor, '-T' + ext, + '-Gsize=14,14', '-o', basename + '.' + ext, basename + '.txt') reset_alarm() b = cgi.escape(basename) - print '
(dot source)' + if svg_output: + print ('' + + 'Your browser does not support SVG.') + else: + print ('
(dot source)') sys.stdout.flush() def render_automaton(basename, automata, dont_run_dot, deco = False): @@ -236,20 +245,24 @@ color_fm = "#DFC6F8" color_lacim = "#F8C6DF" color_taa = "#F8DFC6" +new = ' (NEW)' + options_common = [ ('show_formula_png', 'draw the formula', 0), ('show_automaton_png', 'draw Büchi automaton', 1), ('show_degen_png', 'draw degeneralized Büchi automaton', 0), ('show_never_claim', 'output Spin never claim', 0), ('show_lbtt', 'convert automaton for LBTT', 0), + ('svg_output', 'draw automata in SVG instead of PNG' + new, 0), ] options_reduce = [ ('reduce_basics', 'basic rewritings', 1), ('reduce_syntimpl', 'syntactic implication', 1), ('reduce_eventuniv', 'eventuality and universality', 1), + ('reduce_langcont', 'language containment' + new, 0), ] options_aut_reduce = [ - ('reduce_scc', 'prune unaccepting SCCs', 0), + ('reduce_scc', 'prune unaccepting SCCs' + new, 0), ] options_debug = [ ('show_parse', 'show traces during parsing', 0), @@ -264,7 +277,7 @@ options_trans_fm = [ ] options_trans_lacim = [ ('symbolically_prune_scc', - 'symbolically prune unaccepting SCCs', 1), + 'symbolically prune unaccepting SCCs' + new, 1), ('show_relation_set', 'print the transition relation as a BDD set', 0), ('show_relation_png', @@ -283,7 +296,7 @@ default_translator = 'trans_fm'; translators = [ ('trans_fm', 'Couvreur/FM', color_fm), ('trans_lacim', 'Couvreur/LaCIM', color_lacim), - ('trans_taa', 'Tauriainen/TAA', color_taa), + ('trans_taa', 'Tauriainen/TAA' + new, color_taa), ] options_accepting_run = [ @@ -298,7 +311,7 @@ options_accepting_run = [ 'Tau03', 'Tau03_opt'], 'no'), ('emptiness_check_options', - '...with these ' + '... with these ' + 'options:', ''), ] @@ -501,6 +514,8 @@ if reduce_syntimpl: opt = opt + spot.Reduce_Syntactic_Implications if reduce_eventuniv: opt = opt + spot.Reduce_Eventuality_And_Universality +if reduce_langcont: + opt = opt + spot.Reduce_Containment_Checks_Stronger if opt != spot.Reduce_None: f2 = spot.reduce(f, opt) f.destroy()