spot/wrap/python/ajax
Alexandre Duret-Lutz 8fb7b279f7 ltlvisit: rename tostring.hh as print.hh and rename printer functions
This actually performs three related changes, but separating them
would be quite inconvenient.

1) rename tostring.hh to print.hh a welcome side-effect is that
I could fix several files that included this file for not reason.

2) de-overload some of the to_string functions, and rename them
as follow:

  to_string -> print_psl, print_sere, str_psl, str_sere
  to_utf8_string -> print_utf8_psl, print_utf8_sere,
                    str_utf8_psl, str_utf8_sere
  to_spin_string -> print_spin_ltl, str_spin_ltl
  to_wring_string -> print_wring_ltl, str_wing_ltl
  to_lbt_string -> print_lbt_ltl, str_lbt_ltl
  to_latex_string -> print_latex_psl, str_latex_psl
  to_sclatex_string -> print_sclatex_psl, str_sclatex_psl

Now it is clearer what these functions do, and their restrictions.

3) all those print_* functions now take the stream to write onto
as their first argument.  This fixes #88.

* src/ltlvisit/tostring.cc, src/ltlvisit/tostring.hh: Rename into...
* src/ltlvisit/print.cc, src/ltlvisit/print.hh: ... those, and make
the changes listed above.
* doc/org/tut01.org, src/bin/common_output.cc,
src/bin/common_trans.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc,
src/bin/ltlcross.cc, src/bin/ltldo.cc, src/bin/ltlfilt.cc,
src/bin/randltl.cc, src/ltlparse/ltlparse.yy,
src/ltlvisit/Makefile.am, src/ltlvisit/mark.cc,
src/ltlvisit/relabel.cc, src/ltlvisit/simplify.cc,
src/ltlvisit/snf.cc, src/ta/taexplicit.cc, src/ta/tgtaexplicit.cc,
src/taalgos/tgba2ta.cc, src/tests/equalsf.cc, src/tests/ltl2tgba.cc,
src/tests/ltlrel.cc, src/tests/randtgba.cc, src/tests/reduc.cc,
src/tests/syntimpl.cc, src/tests/tostring.cc, src/twa/bdddict.cc,
src/twa/bddprint.cc, src/twa/taatgba.cc, src/twa/taatgba.hh,
src/twa/twagraph.cc, src/twaalgos/compsusp.cc, src/twaalgos/lbtt.cc,
src/twaalgos/ltl2taa.cc, src/twaalgos/ltl2tgba_fm.cc,
src/twaalgos/neverclaim.cc, src/twaalgos/remprop.cc,
src/twaalgos/stats.cc, wrap/python/ajax/spot.in, wrap/python/spot.py,
wrap/python/spot_impl.i: Adjust.
2015-06-04 22:56:57 +02:00
..
css ltl2tgba.html: Separate the ltl3ba tabs from the others. 2014-08-21 23:16:39 +02:00
js ltl2tgba.html: Display a loading logo for delayed results. 2012-06-19 21:55:08 +02:00
logos Updates to the ltl2tgba ajax version. 2011-01-26 22:03:14 +01:00
ltl2tgba.html dotty: get rid of the decorated version 2015-01-24 12:22:31 +01:00
Makefile.am Upgrade GPL v2+ to GPL v3+. 2012-10-12 22:05:18 +02:00
protocol.txt ltl2tgba.html: Add option to output LBT format. 2014-08-21 23:16:39 +02:00
README ltl2tgba.html: Adjust for ltl3ba 1.1.0 2015-01-23 16:39:09 +01:00
spot.in ltlvisit: rename tostring.hh as print.hh and rename printer functions 2015-06-04 22:56:57 +02:00

ltl2tgba.html is a dynamic web page that translates user-supplied LTL
formulae to Transition-based Generalized Büchi Automata.  The actual
translation work is performed by a CGI script in Python: spot.py.

There are two ways to use the script: using a web server such as
Apache, or standalone.

In both cases you should ensure that the command `dot', from the
GraphViz package, is in the PATH.  configure should have picked it up.

The "ltl3ba" tab will only be enabled if ltl3ba is available (as
checked by ./configure) and supports options -v/-T/-T3 (checked by the
CGI script).  These option were introduced into ltl3ba version 1.1.0.


Standalone usage
================

Simply run spot.py from this directory.  This will create a directory
called spotimg/ in the current directory (this will hold the generated
pictures) and start an HTTP server on port 8000.  Point your browser
to http://localhost:8000/ltl2tgba.html and you should be OK.

After you have killed the server process (e.g. with Control-C),
you may want to erase the spotimg/ directory.


Installing on a real web server
===============================

1) Install Spot first (run `make install' from the top-level).

   The CGI script uses the Python bindings and assume they
   have been installed.  Near the top of the script, you
   should see a call to sys.path.insert(), with the expected
   location of the Python bindings for spot.  This path was
   configured from ./configure's arguments and you should not
   have to fiddle with it.  I'm mentionning it just in case.

2) Copy spot.py to some place were CGI execution is allowed.
   Depending on your HTTP server's configuration, you may have
   to rename the script as spot.cgi or something else, so
   that the server accepts to run it.

   Apache users in trouble should look at the following options
   before digging the Apache manual deeper.  These can go
   in a .htaccess file (if allowed).

      # Treat *.py files as CGI scripts
      AddHandler cgi-script .py

      # Allow CGI execution in some directory.
      Options +ExecCGI

3) In the directory where you have installed spot.py,
   create a subdirectory called spotimg/.  This is where
   the script will cache its images and other temporary
   files.  (If you want to change this name, see the imgdir
   variable at the top of the script.)

   This directory must be writable by the Unix user that
   will run the script when the HTTP server processes the
   request.

   spot.py purges old files at most once every hour.

4) Copy the directories css/, js/, and logos/ along with ltl2tgba.html
   to there destination.  You may have to adjust a few paths at the
   top of the html page.


Debugging
=========

When working on the script, remember that the contents of spotimg/ is
used as a cache and that a request will not be processed again if its
result is in the cache.  So if you don't understand why the change you
have performed has no effect, make sure you are performing some fresh
query, or wipe the contents of the cache (i.e., erase all files inside
spotimg/ but not the spotimg/ directory itself).


The hash string displayed in the web browser is the query string sent
to the CGI script, so you can simulate the call from the command line
with a command like this:

  % export QUERY_STRING="f=a+U+b&r=br&r=lf&r=si&r=eu&o=a&ff=o&mf=d&af=t&ra=t&rf=p&t=fm&fm=od&fm=sm&la=sp&ta=lc&as=ps&ec=Cou99&eo="
  % export SCRIPT_NAME=spot.py
  % export SERVER_SOFTWARE=SimpleHTTP
  % ./spot.py