* iface/gspn/eesrg.cc (format_state): Do not rewrite n's,

just strip the last one.  Escaping must be done at output.
* iface/gspn/gspm.cc (format_state): Likewise.
* src/misc/escape.hh, src/misc/escape.cc: New files.
* src/misc/Makefile.am: Add them.
* src/tgba/bddprint.cc (bdd_format_accset): New function.
* src/tgba/bddprint.hh (bdd_format_accset): New function.
* src/tgbaalgos/dotty.cc (dotty_bfs::process_state):
Escape the state name using escape_str().
(dotty_bfs::process_link): Escape conditions and acceptance
conditions using escape_str().
* src/tgbaalgos/save.cc (save_bfs::start): Call print_acc().
(save_bfs::print_acc): New function extracted from save_bfs::start().
Escape each acceptance condition.
(save_bfs::process_state): Use escape_str() and print_acc()
This commit is contained in:
Alexandre Duret-Lutz 2004-01-06 16:56:07 +00:00
parent 8008deeddd
commit 9297d6dd9f
10 changed files with 182 additions and 91 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// 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.
//
@ -19,7 +19,6 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <sstream>
#include <map>
#include <cassert>
#include "gspn.hh"
@ -366,30 +365,17 @@ namespace spot
{
const state_gspn* s = dynamic_cast<const state_gspn*>(state);
assert(s);
std::ostringstream os;
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;
}
// Strip trailing \n...
unsigned len = strlen(str);
while (str[--len] == '\n')
str[len] = 0;
std::string res(str);
free(str);
return os.str();
return res;
}
bdd