dot: allow extra configuration via environment

* src/tgbaalgos/dotty.cc, src/taalgos/dotty.cc: Honnor the SPOT_DOTEXTRA
environement variable.
* src/tgbatest/readsave.test, wrap/python/tests/automata.ipynb: Test it.
* NEWS, src/bin/man/spot-x.x: Document it.
This commit is contained in:
Alexandre Duret-Lutz 2015-03-16 17:19:37 +01:00
parent b6762b7dc9
commit 7caf2b83d6
6 changed files with 77 additions and 45 deletions

View file

@ -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

View file

@ -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();

View file

@ -30,6 +30,7 @@
#include "tgba/tgbagraph.hh"
#include "tgba/formula2bdd.hh"
#include "tgbaalgos/sccinfo.hh"
#include <cstdlib>
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';

View file

@ -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 <<EOF
digraph G {
node [shape="circle"]
/* hello world */
I [label="", style=invis, height=0]
I -> 3
subgraph cluster_0 {