diff --git a/NEWS b/NEWS index 88cee43cf..7332d71fe 100644 --- a/NEWS +++ b/NEWS @@ -107,10 +107,12 @@ New in spot 1.99b (not yet released) sugar for [:*1..], and corresponds to the operator ⊕ introduced by Dax et al. (ATVA'09). - - GraphViz output now uses an horizontal layout by default. - The --dot option of the various command-line tools takes an - optional parameter to fine-tune the GraphViz output (including - vertical layout, round states, and named automata). + - GraphViz output now uses an horizontal layout by default. The + --dot option of the various command-line tools takes an optional + parameter to fine-tune the GraphViz output (including vertical + layout, round states, and named automata). The environment + variable SPOT_DOTEXTRA can also be used to add extra attributes + to the output graph. - Never claims can now be output in the style usd by Spin since version 6.2.4 (i.e., using do..od instead of if..fi, and with diff --git a/src/bin/man/spot-x.x b/src/bin/man/spot-x.x index aa30d6df3..b8d673040 100644 --- a/src/bin/man/spot-x.x +++ b/src/bin/man/spot-x.x @@ -11,6 +11,12 @@ spot-x \- Common fine-tuning options. [ENVIRONMENT VARIABLES] +.TP +\fBSPOT_DOTEXTRA\fR +The contents of this variable is added to any dot output, immediately +before the first state is output. This makes it easy to override +global attributes of the graph. + .TP \fBSPOT_SATLOG\fR If set to a filename, the SAT-based minimization routines will append diff --git a/src/taalgos/dotty.cc b/src/taalgos/dotty.cc index 692eb9217..6ba8ba802 100644 --- a/src/taalgos/dotty.cc +++ b/src/taalgos/dotty.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2010, 2012, 2014 Laboratoire de Recherche et +// Copyright (C) 2010, 2012, 2014, 2015 Laboratoire de Recherche et // Developpement de l Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -39,7 +39,11 @@ namespace spot void start() { - os_ << "digraph G {" << std::endl; + os_ << "digraph G {\n"; + + static const char* extra = getenv("SPOT_DOTEXTRA"); + if (extra) + os_ << " " << extra << '\n'; artificial_initial_state_ = t_automata_->get_artificial_initial_state(); diff --git a/src/tgbaalgos/dotty.cc b/src/tgbaalgos/dotty.cc index c7c7793f9..702f4c726 100644 --- a/src/tgbaalgos/dotty.cc +++ b/src/tgbaalgos/dotty.cc @@ -30,6 +30,7 @@ #include "tgba/tgbagraph.hh" #include "tgba/formula2bdd.hh" #include "tgbaalgos/sccinfo.hh" +#include namespace spot { @@ -108,6 +109,12 @@ namespace spot } if (opt_circles_) os_ << " node [shape=\"circle\"]\n"; + // Any extra text passed in the SPOT_DOTEXTRA environment + // variable should be output at the end of the "header", so + // that our setup can be overridden. + static const char* extra = getenv("SPOT_DOTEXTRA"); + if (extra) + os_ << " " << extra << '\n'; os_ << " I [label=\"\", style=invis, "; os_ << (opt_horizontal_ ? "width" : "height"); os_ << "=0]\n I -> " << aut_->get_init_state_number() << '\n'; diff --git a/src/tgbatest/readsave.test b/src/tgbatest/readsave.test index 49fc0d20d..65e86c8bf 100755 --- a/src/tgbatest/readsave.test +++ b/src/tgbatest/readsave.test @@ -306,11 +306,14 @@ State: 3 "s3" [0] 1 --END-- EOF -$autfilt -H input | $autfilt --dot=vcsn >output + +$autfilt -H input | + SPOT_DOTEXTRA='/* hello world */' $autfilt --dot=vcsn >output cat >expected < 3 subgraph cluster_0 { diff --git a/wrap/python/tests/automata.ipynb b/wrap/python/tests/automata.ipynb index 1ed4ffc98..e7950ffe5 100644 --- a/wrap/python/tests/automata.ipynb +++ b/wrap/python/tests/automata.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:6c1898261f2fab59f18fc3b6d75fe387d6f811b02935833fc74fa5e476796d4c" + "signature": "sha256:5d2a4f77c6bcffce3121cc011949d340222f35788edaf95171ae9917ea3794d6" }, "nbformat": 3, "nbformat_minor": 0, @@ -12,7 +12,9 @@ "cell_type": "code", "collapsed": false, "input": [ - "import spot" + "import spot\n", + "import os\n", + "os.environ['SPOT_DOTEXTRA'] = 'node[style=filled,fillcolor=\"#88ddff\"]'" ], "language": "python", "metadata": {}, @@ -47,7 +49,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "0\n", "\n", "\n", @@ -63,7 +65,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "\n", "1\n", "\n", @@ -75,7 +77,7 @@ "\n", "\n", "4\n", - "\n", + "\n", "4\n", "\n", "\n", @@ -92,7 +94,7 @@ "\n", "\n", "2\n", - "\n", + "\n", "2\n", "\n", "\n", @@ -103,7 +105,7 @@ "\n", "\n", "3\n", - "\n", + "\n", "3\n", "\n", "\n", @@ -152,7 +154,7 @@ "\n" ], "text": [ - " *' at 0x7f79a4a46090> >" + " *' at 0x7fd82431b0f0> >" ] } ], @@ -188,7 +190,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "0\n", "\n", "\n", @@ -204,7 +206,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "\n", "1\n", "\n", @@ -216,7 +218,7 @@ "\n", "\n", "4\n", - "\n", + "\n", "4\n", "\n", "\n", @@ -233,7 +235,7 @@ "\n", "\n", "3\n", - "\n", + "\n", "3\n", "\n", "\n", @@ -244,7 +246,7 @@ "\n", "\n", "2\n", - "\n", + "\n", "2\n", "\n", "\n", @@ -293,7 +295,7 @@ "" ], "text": [ - "" + "" ] } ], @@ -350,7 +352,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "1\n", "\n", "\n", @@ -366,7 +368,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "\n", "0\n", "\n", @@ -386,7 +388,7 @@ "\n" ], "text": [ - " *' at 0x7f79a4aa1810> >" + " *' at 0x7fd8242f2870> >" ] } ], @@ -420,7 +422,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "1\n", "\n", "\n", @@ -436,7 +438,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "\n", "0\n", "\n", @@ -456,7 +458,7 @@ "\n" ], "text": [ - " *' at 0x7f79a4aa1930> >" + " *' at 0x7fd8242f2ab0> >" ] } ], @@ -490,7 +492,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "1\n", "\n", "\n", @@ -506,7 +508,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "0\n", "\n", "\n", @@ -525,7 +527,7 @@ "\n" ], "text": [ - " *' at 0x7f79a4aa18a0> >" + " *' at 0x7fd8242f2900> >" ] } ], @@ -575,7 +577,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "0\n", "\n", "\n", @@ -585,7 +587,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "\n", "1\n", "\n", @@ -597,7 +599,7 @@ "\n", "\n", "2\n", - "\n", + "\n", "\n", "2\n", "\n", @@ -609,7 +611,7 @@ "\n", "\n", "3\n", - "\n", + "\n", "\n", "3\n", "\n", @@ -641,7 +643,7 @@ "" ], "text": [ - "" + "" ] } ], @@ -659,7 +661,7 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 12, + "prompt_number": 10, "svg": [ "\n", "\n", @@ -668,7 +670,7 @@ "\n", "\n", "6\n", - "\n", + "\n", "\n", "6\n", "\n", @@ -685,7 +687,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "\n", "0\n", "\n", @@ -697,7 +699,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "\n", "1\n", "\n", @@ -709,7 +711,7 @@ "\n", "\n", "2\n", - "\n", + "\n", "\n", "2\n", "\n", @@ -721,7 +723,7 @@ "\n", "\n", "3\n", - "\n", + "\n", "\n", "3\n", "\n", @@ -733,7 +735,7 @@ "\n", "\n", "4\n", - "\n", + "\n", "\n", "4\n", "\n", @@ -745,7 +747,7 @@ "\n", "\n", "5\n", - "\n", + "\n", "\n", "5\n", "\n", @@ -831,11 +833,19 @@ "" ], "text": [ - "" + "" ] } ], - "prompt_number": 12 + "prompt_number": 10 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] } ], "metadata": {}