From e78ffdc4620893c3cf648cf1d4e5482315df373f Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 30 Jul 2003 14:02:57 +0000 Subject: [PATCH] * iface/gspn/gspn.cc (tgba_gspn::format_state): Call gspn's print_state. --- ChangeLog | 5 ++++- iface/gspn/gspn.cc | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 248e9a915..94469f74a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ 2003-07-30 Alexandre Duret-Lutz + * iface/gspn/gspn.cc (tgba_gspn::format_state): Call gspn's + print_state. + * iface/gspn/dcswaveltl.test: Check for a false formula too. - + * iface/gspn/dcswaveltl.test, iface/gspn/ltlgspn.cc: New files. * iface/gspn/Makefile.am (TESTS): Add dcswaveltl.test. (ltlgspn_rg_LDADD, ltlgspn_srg_LDADD, ltlgspn_rg_SOURCES) diff --git a/iface/gspn/gspn.cc b/iface/gspn/gspn.cc index 4e211cc98..f20cec1bc 100644 --- a/iface/gspn/gspn.cc +++ b/iface/gspn/gspn.cc @@ -387,9 +387,29 @@ namespace spot { const state_gspn* s = dynamic_cast(state); assert(s); - // FIXME: We ought to ask GSPN to format the state. std::ostringstream os; - os << s->get_state(); + char* str; + int err = print_state(s->get_state(), &str); + if (err) + throw gspn_exeption("print_state()", err); + + // Rewrite all new lines as \\\n. + const char* pos = str; + while (*pos) + { + switch (*pos) + { + // Rewrite all new lines as \\n, and strip the last one. + case '\n': + if (pos[1]) + os << "\\n"; + break; + default: + os << *pos; + } + ++pos; + } + free(str); return os.str(); }