diff --git a/NEWS b/NEWS
index a6fbca306..5d4844a5e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,17 @@
New in spot 1.2.4a (not yet released)
- * New feature:
+ * New features:
- The online ltl2tgba translator will automatically attempt to
parse a formula using LBT's syntax if it cannot parse it using
the normal infix syntax.
+ - ltl2tgba and dstar2tgba have a new experimental option --hoaf to
+ output automata in the Hanoï Omega Automaton Format whose
+ current draft is at http://adl.github.io/hoaf/
+ The corresponding C++ function is spot::hoaf_reachable() in
+ tgbaalgos/hoaf.hh.
+
* Documentation:
- The man page for ltl2tgba has some new notes and references
diff --git a/src/bin/dstar2tgba.cc b/src/bin/dstar2tgba.cc
index 1b4b92038..f877423c6 100644
--- a/src/bin/dstar2tgba.cc
+++ b/src/bin/dstar2tgba.cc
@@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
-// Copyright (C) 2013 Laboratoire de Recherche et Développement de
-// l'Epita (LRDE).
+// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
+// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@@ -35,6 +35,7 @@
#include "tgba/tgbaexplicit.hh"
#include "tgbaalgos/dotty.hh"
#include "tgbaalgos/lbtt.hh"
+#include "tgbaalgos/hoaf.hh"
#include "tgbaalgos/neverclaim.hh"
#include "tgbaalgos/save.hh"
#include "tgbaalgos/stats.hh"
@@ -72,6 +73,10 @@ static const argp_option options[] =
/**************************************************/
{ 0, 0, 0, 0, "Output format:", 3 },
{ "dot", OPT_DOT, 0, 0, "GraphViz's format (default)", 0 },
+ { "hoaf", 'H', "s|t|m|l", OPTION_ARG_OPTIONAL,
+ "Output the automaton in HOA format. Add letters to select "
+ "(s) state-based acceptance, (t) transition-based acceptance, "
+ "(m) mixed acceptance, (l) single-line output", 0 },
{ "lbtt", OPT_LBTT, "t", OPTION_ARG_OPTIONAL,
"LBTT's format (add =t to force transition-based acceptance even"
" on Büchi automata)", 0 },
@@ -122,9 +127,10 @@ const struct argp_child children[] =
{ 0, 0, 0, 0 }
};
-enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats } format = Dot;
+enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats, Hoa } format = Dot;
bool utf8 = false;
const char* stats = "";
+const char* hoaf_opt = 0;
spot::option_map extra_options;
static int
@@ -142,6 +148,10 @@ parse_opt(int key, char* arg, struct argp_state*)
case 'F':
jobs.push_back(job(arg, true));
break;
+ case 'H':
+ format = Hoa;
+ hoaf_opt = arg;
+ break;
case 'M':
type = spot::postprocessor::Monitor;
break;
@@ -340,6 +350,9 @@ namespace
case Lbtt_t:
spot::lbtt_reachable(std::cout, aut, false);
break;
+ case Hoa:
+ spot::hoaf_reachable(std::cout, aut, hoaf_opt) << '\n';
+ break;
case Spot:
spot::tgba_save_reachable(std::cout, aut);
break;
diff --git a/src/bin/ltl2tgba.cc b/src/bin/ltl2tgba.cc
index c81db4331..7e49cbedc 100644
--- a/src/bin/ltl2tgba.cc
+++ b/src/bin/ltl2tgba.cc
@@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
-// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement
-// de l'Epita (LRDE).
+// Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et
+// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@@ -39,6 +39,7 @@
#include "tgbaalgos/lbtt.hh"
#include "tgbaalgos/neverclaim.hh"
#include "tgbaalgos/save.hh"
+#include "tgbaalgos/hoaf.hh"
#include "tgbaalgos/stats.hh"
#include "tgbaalgos/translate.hh"
#include "tgba/bddprint.hh"
@@ -72,6 +73,10 @@ static const argp_option options[] =
{ "csv-escape", OPT_CSV, 0, 0, "quote formula output by %f in --format "
"for use in CSV file", 0 },
{ "dot", OPT_DOT, 0, 0, "GraphViz's format (default)", 0 },
+ { "hoaf", 'H', "s|t|m|l", OPTION_ARG_OPTIONAL,
+ "Output the automaton in HOA format. Add letters to select "
+ "(s) state-based acceptance, (t) transition-based acceptance, "
+ "(m) mixed acceptance, (l) single-line output", 0 },
{ "lbtt", OPT_LBTT, "t", OPTION_ARG_OPTIONAL,
"LBTT's format (add =t to force transition-based acceptance even"
" on Büchi automata)", 0 },
@@ -118,9 +123,10 @@ const struct argp_child children[] =
{ 0, 0, 0, 0 }
};
-enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats } format = Dot;
+enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats, Hoa } format = Dot;
bool utf8 = false;
const char* stats = "";
+const char* hoaf_opt = 0;
spot::option_map extra_options;
static int
@@ -136,6 +142,10 @@ parse_opt(int key, char* arg, struct argp_state*)
case 'B':
type = spot::postprocessor::BA;
break;
+ case 'H':
+ format = Hoa;
+ hoaf_opt = arg;
+ break;
case 'M':
type = spot::postprocessor::Monitor;
break;
@@ -255,6 +265,9 @@ namespace
case Lbtt_t:
spot::lbtt_reachable(std::cout, aut, false);
break;
+ case Hoa:
+ spot::hoaf_reachable(std::cout, aut, hoaf_opt, f) << '\n';
+ break;
case Spot:
spot::tgba_save_reachable(std::cout, aut);
break;
diff --git a/src/tgbaalgos/Makefile.am b/src/tgbaalgos/Makefile.am
index cb710ffc3..811165958 100644
--- a/src/tgbaalgos/Makefile.am
+++ b/src/tgbaalgos/Makefile.am
@@ -1,6 +1,6 @@
## -*- coding: utf-8 -*-
-## Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Laboratoire de
-## Recherche et Développement de l'Epita (LRDE).
+## Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire
+## de Recherche et Développement de l'Epita (LRDE).
## Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris
## 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
## Université Pierre et Marie Curie.
@@ -44,6 +44,7 @@ tgbaalgos_HEADERS = \
emptiness.hh \
emptiness_stats.hh \
gv04.hh \
+ hoaf.hh \
isdet.hh \
isweakscc.hh \
lbtt.hh \
@@ -92,6 +93,7 @@ libtgbaalgos_la_SOURCES = \
eltl2tgba_lacim.cc \
emptiness.cc \
gv04.cc \
+ hoaf.cc \
isdet.cc \
isweakscc.cc \
lbtt.cc \
diff --git a/src/tgbaalgos/hoaf.cc b/src/tgbaalgos/hoaf.cc
new file mode 100644
index 000000000..80eb8f3fe
--- /dev/null
+++ b/src/tgbaalgos/hoaf.cc
@@ -0,0 +1,366 @@
+// -*- coding: utf-8 -*-
+// Copyright (C) 2011, 2012, 2014 Laboratoire de Recherche et
+// Developpement de l'Epita (LRDE).
+// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
+// département Systèmes Répartis Coopératifs (SRC), Université Pierre
+// et Marie Curie.
+//
+// This file is part of Spot, a model checking library.
+//
+// Spot is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// Spot is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+#include
+#include
+#include