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

* src/ltlenv/Makefile.am, src/ltlenv/defaultenv.cc,
src/ltlenv/defaultenv.hh, src/ltlenv/environment.hh: New files.
* src/ltlparse/public.hh (parse): Take an environment as third
argument.
* src/ltlparse/ltlparse.yy (ATOMIC_PROP, parse): Require the
atomic proposition via the environment.
* src/ltltest/readltl.cc (main): Adjust the call to parse().
* src/ltltest/Makefile.am (LDADD): Add ../ltlenv/libltlenv.a.
This commit is contained in:
Alexandre Duret-Lutz 2003-04-17 15:09:49 +00:00
parent ae7fdeba59
commit a30a0638b9
12 changed files with 141 additions and 7 deletions

4
src/ltlenv/.cvsignore Normal file
View file

@ -0,0 +1,4 @@
.deps
Makefile
Makefile.in
libltlenv.a

8
src/ltlenv/Makefile.am Normal file
View file

@ -0,0 +1,8 @@
AM_CPPFLAGS = -I$(srcdir)/..
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
lib_LIBRARIES = libltlenv.a
libltlenv_a_SOURCES = \
defaultenv.cc \
defaultenv.hh \
environment.hh

33
src/ltlenv/defaultenv.cc Normal file
View file

@ -0,0 +1,33 @@
#include "defaultenv.hh"
namespace spot
{
namespace ltl
{
atomic_prop*
default_environment::require(const std::string& s)
{
return new atomic_prop(s);
}
const std::string&
default_environment::name()
{
static std::string name("default environment");
return name;
}
default_environment::default_environment()
{
}
default_environment&
default_environment::instance()
{
static default_environment* singleton = new default_environment();
return *singleton;
}
}
}

26
src/ltlenv/defaultenv.hh Normal file
View file

@ -0,0 +1,26 @@
#ifndef SPOT_LTLENV_DEFAULT_ENVIRONMENT_HH
# define SPOT_LTLENV_DEFAULT_ENVIRONMENT_HH
# include "environment.hh"
namespace spot
{
namespace ltl
{
class default_environment : public environment
{
public:
virtual atomic_prop* require(const std::string& prop_str);
virtual const std::string& name();
/* This class is a singleton. */
static default_environment& instance();
protected:
default_environment();
};
}
}
#endif // SPOT_LTLENV_DEFAULT_ENVIRONMENT_HH

29
src/ltlenv/environment.hh Normal file
View file

@ -0,0 +1,29 @@
#ifndef SPOT_LTLENV_ENVIRONMENT_HH
# define SPOT_LTLENV_ENVIRONMENT_HH
# include "ltlast/atomic_prop.hh"
# include <string>
namespace spot
{
namespace ltl
{
class environment
{
public:
// Check whether the environment contains the atomic proposition
// described by prop_str.
// Note this is NOT a const method. Some environment will
// "create" the atomic proposition when asked.
virtual atomic_prop* require(const std::string& prop_str) = 0;
virtual const std::string& name() = 0;
// FIXME: More functions will be needed later, but
// it's enough for now.
};
}
}
#endif // SPOT_LTLENV_ENVIRONMENT_HH