org: add a first code example

The difficulty is not the example, but setting up org-mode to allow
Python and C++ example that use the local libraries, not those
installed system-wide.

* doc/org/.dir-locals.el: Rename as...
* doc/org/.dir-locals.el.in: ... this, so we can easily define
PYTHONPATH and other environment variables.
* doc/org/init.el.in: Enable C++, and make sure but Python
and C++ use the local libraries.
* doc/org/g++wrap.in, doc/org/tut01.org: New files.
* doc/Makefile.am, configure.ac: Adjust.
* wrap/python/spot.py (to_str): Take a parenth argument.
This commit is contained in:
Alexandre Duret-Lutz 2015-06-02 23:53:04 +02:00
parent 16336be3cc
commit 8de524adb0
7 changed files with 255 additions and 10 deletions

View file

@ -98,21 +98,21 @@ ta.show = _return_automaton_as_svg
def _formula_str_ctor(self, str):
self.this = parse_formula(str)
def _formula_to_str(self, format = 'spot'):
def _formula_to_str(self, format = 'spot', parenth = False):
if format == 'spot':
return to_string(self)
return to_string(self, parenth)
elif format == 'spin':
return to_spin_string(self)
return to_spin_string(self, parenth)
elif format == 'utf8':
return to_utf8_string(self)
return to_utf8_string(self, parenth)
elif format == 'lbt':
return to_lbt_string(self)
elif format == 'wring':
return to_wring_string(self)
elif format == 'latex':
return to_latex_string(self)
return to_latex_string(self, parenth)
elif format == 'sclatex':
return to_sclatex_string(self)
return to_sclatex_string(self, parenth)
else:
raise ValueError("unknown string format: " + format)