* configure.ac: Output src/tgbaparse/Makefile.

* src/Makefile.am (SUBDIRS): Add tgbaparse.
(libspot_la_LDADD): Add tgbaparse/libtgbaparse.la.
* src/tgba/tgbaexplicit.cc (tgba_explicit::get_condition,
tgba_explicit::get_promise, tgba_explicit::add_neg_condition,
tgba_explicit::add_neg_promise): New methods.
* src/tgba/tgbaexplicit.hh: Declare them.
* src/tgbaparse/Makefile.am, src/tgbaparse/fmterror.cc,
src/tgbaparse/parsedecl.hh, src/tgbaparse/public.hh,
src/tgbaparse/tgbaparse.yy, src/tgbaparse/tgbascan.ll,
src/tgbatest/tgbaread.cc, src/tgbatest/tgbaread.test: New files.
* src/tgbatest/Makefile.am (check_PROGRAMS): Add tgbaread.
(TESTS): Add tgbaread.cc.
(CLEANFILES): Add input.
(tgbaread_SOURCES): New variable.
This commit is contained in:
Alexandre Duret-Lutz 2003-06-05 15:22:42 +00:00
parent cebffb11e8
commit 6884a7f985
18 changed files with 495 additions and 14 deletions

View file

@ -4,3 +4,4 @@ Makefile.in
defs
explicit
.libs
tgbaread

View file

@ -4,13 +4,16 @@ LDADD = ../libspot.la
check_SCRIPTS = defs
# Keep this sorted alphabetically.
check_PROGRAMS = \
explicit
explicit \
tgbaread
explicit_SOURCES = explicit.cc
tgbaread_SOURCES = tgbaread.cc
TESTS = \
explicit.test
explicit.test \
tgbaread.test
EXTRA_DIST = $(TESTS)
CLEANFILES = stdout expected
CLEANFILES = inpu stdout expected

50
src/tgbatest/tgbaread.cc Normal file
View file

@ -0,0 +1,50 @@
#include <iostream>
#include "tgbaparse/public.hh"
#include "tgba/tgbaexplicit.hh"
#include "tgbaalgos/dotty.hh"
void
syntax(char* prog)
{
std::cerr << prog << " [-d] filename" << std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
int exit_code = 0;
if (argc < 2)
syntax(argv[0]);
bool debug = false;
int filename_index = 1;
if (!strcmp(argv[1], "-d"))
{
debug = true;
if (argc < 3)
syntax(argv[0]);
filename_index = 2;
}
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit* a = spot::tgba_parse(argv[filename_index],
pel, env, debug);
exit_code =
spot::format_tgba_parse_errors(std::cerr, pel);
if (a)
{
spot::dotty_reachable(std::cout, *a);
delete a;
}
else
{
exit_code = 1;
}
return exit_code;
}

31
src/tgbatest/tgbaread.test Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
. ./defs
set -e
cat >input <<EOF
s1, "s2", a!b, c d;
"s2", "state 3", a, !c;
"state 3", s1,,;
EOF
./tgbaread input > stdout
cat >expected <<EOF
digraph G {
size="7.26,10.69"
0 [label="", style=invis]
1 [label="s1"]
0 -> 1
2 [label="s2"]
1 -> 2 [label="<a:1, b:0>\n<Prom[c]:1, Prom[d]:1>"]
3 [label="state 3"]
2 -> 3 [label="<a:1>\n<Prom[c]:0>"]
3 -> 1 [label="T\nT"]
}
EOF
diff stdout expected
rm input stdout expected