Commit f0a8d0ae authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

* HACKING, Makefile.am, configure.ac, m4/gccwarn.m4,

src/Makefile.am, src/ltlast/Makefile.am, src/ltlast/allnodes.hh,
src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh,
src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/constant.cc,
src/ltlast/constant.hh, src/ltlast/formulae.hh,
src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/predecl.hh,
src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlast/visitor.hh,
src/ltlparse/Makefile.am, src/ltlparse/ltlparse.yy,
src/ltlparse/ltlscan.ll, src/ltlparse/parsedecl.hh,
src/ltlparse/public.hh, src/ltlvisit/Makefile.am,
src/ltlvisit/dotty.cc, src/ltlvisit/dotty.hh,
src/ltlvisit/dump.cc, src/ltlvisit/dump.hh,
src/ltlvisit/rewrite.cc, src/ltlvisit/rewrite.hh,
src/ltltest/Makefile.am, src/ltltest/defs.in, src/ltltest/readltl.cc,
src/ltltest/parse.test, src/ltltest/parseerr.test,
src/misc/Makefile.am, src/misc/const_sel.hh: New files.
parent ababb9ff
Makefile
Makefile.in
configure
config.log
config.status
aclocal.m4
autom4te.cache
2003-04-15 Alexandre DURET-LUTZ <aduret@src.lip6.fr>
* HACKING, Makefile.am, configure.ac, m4/gccwarn.m4,
src/Makefile.am, src/ltlast/Makefile.am, src/ltlast/allnodes.hh,
src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh,
src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/constant.cc,
src/ltlast/constant.hh, src/ltlast/formulae.hh,
src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/predecl.hh,
src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlast/visitor.hh,
src/ltlparse/Makefile.am, src/ltlparse/ltlparse.yy,
src/ltlparse/ltlscan.ll, src/ltlparse/parsedecl.hh,
src/ltlparse/public.hh, src/ltlvisit/Makefile.am,
src/ltlvisit/dotty.cc, src/ltlvisit/dotty.hh,
src/ltlvisit/dump.cc, src/ltlvisit/dump.hh,
src/ltlvisit/rewrite.cc, src/ltlvisit/rewrite.hh,
src/ltltest/Makefile.am, src/ltltest/defs.in, src/ltltest/readltl.cc,
src/ltltest/parse.test, src/ltltest/parseerr.test,
src/misc/Makefile.am, src/misc/const_sel.hh: New files.
Bootstraping:
=============
Some files in SPOT's source tree are generated. They are distributed
so that users do not need to tools to rebuild them, but we don't keep
all of them under CVS because it can generate lots of changes or
conflicts.
Here are the tools you need to bootstrap the CVS tree, or more
generally if you plan to regenerate some of the generated files.
GNU Autoconf 2.57
GNU Automake 1.7.3
GNU Flex (the version probably doesn't matter much, we used 2.5.4)
The CVS version of GNU Bison (called 1.875b at the time of writing)
Bootstrap the CVS tree by running
autoreconf -vfi
and then go on with the usual
./configure
make
Coding conventions:
===================
Here are the conventions we follow in Spot, so that the code looks
homogeneous.
Comments
--------
* The language to use is American.
* When comments are sentences, they should start with a capital and
end with a dot. Dots that end sentences should be followed by two
spaces (i.e., American typing convention), like in this paragraph.
Formating
---------
* Braces on their own line.
* Text within braces is two-space indented.
{
f(12);
}
* Anything after a control statement is two-space indented. This
includes braces.
if (test)
{
f(123);
while (test2)
g(456);
}
* Braces from function/structure/enum/classe/namespace definitions
are not indented.
class foo
{
public:
Foo();
protected:
static int get_mumble();
};
* The above corresponds to the `gnu' indentation style under Emacs.
* Put return types or linkage specifiers on their own line in
function/method _definitions_ :
static int
Foo::get_mumble()
{
return 2;
}
This makes it easier to grep functions in the code.
Function/method declarations can be put on one line.
* Space before parentheses in control statements
if (test)
{
do
{
something();
}
while (0);
}
* No space before parentheses in function calls.
(`some()->foo()->bar()' is far more readable than
`some ()->foo ()->bar ()' is)
* No space after opening or before closing parentheses, however
put a space after commas (as in english).
func(arg1, arg2, arg3);
* No useless parentheses in return statements.
return 2; (not `return (2);')
* Spaces around infix binary or ternary operators:
2 + 2;
a = b;
a <<= (3 + 5) * 3 + f(67 + (really ? 45 : 0));
* No space after prefix unary operators, or befor postfix unary operators:
if (!test && y++ != 0)
{
++x;
}
* When an expression spans over several lines, split it before
operators. If it's inside a parenthesis, the following lines
should be 1-indented w.r.t. the opening parenthesis.
if (foo_this_is_long && bar > win(x, y, z)
&& !remaining_condition)
{
...
}
* If a line takes more than 80 columns, split it or rethink it.
Naming
======
* Functions, methods, types, classes, etc. are named with lowercase
letters, using an underscore to separate words.
int compute_this_and_that();
class this_is_a_class;
typedef int int_array[];
That is the style used in STL.
* private members end with an underscore.
class my_class
{
public:
...
int get_val() const;
private:
int name_;
};
* Identifiers (even internal) starting with `_' are best avoided
to limit clashes with system definitions.
* Template arguments use capitalized name, with joined words.
template <class T, int NumberOfThings>
class foo
{
...
};
* Enum mumblers also use capitalized name, with joined words.
* C Macros are all uppercase.
* Pointers and references are part of the type, and should be put
near the type, not near the variable.
int* p; // not `int *p;'
list& l; // not `list &l;'
void* magic(); // not `void *magic();'
* Do not declare many variables on one line.
Use
int* p;
int* q;
instead of
int *p, *q;
The former declarations also allow you to describe each variable.
* The include guard for src/somedir/foo.hh is
SPOT_SOMEDIR_FOO_HH
SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = m4/gccwarn.m4
\ No newline at end of file
AC_PREREQ([2.57])
AC_INIT([spot], [0.1])
AC_CONFIG_AUX_DIR([tools])
AM_INIT_AUTOMAKE([foreign 1.7.3])
AC_PROG_CXX
AC_PROG_RANLIB
AM_PROG_LEX
AC_PROG_YACC
AC_LANG(C++)
CF_GXX_WARNINGS
AC_CHECK_PROG([DOT], [dot], [dot])
AC_CONFIG_FILES([
Makefile
src/Makefile
src/ltlast/Makefile
src/ltlparse/Makefile
src/ltltest/Makefile
src/ltltest/defs
src/ltlvisit/Makefile
src/misc/Makefile
])
AC_OUTPUT
\ No newline at end of file
dnl Check if the compiler supports useful warning options. There's a few that
dnl we don't use, simply because they're too noisy:
dnl
dnl -ansi (prevents declaration of functions like strdup, and because
dnl it makes warning in system headers).
dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
dnl -Wtraditional (combines too many unrelated messages, only a few useful)
dnl -Wredundant-decls (system headers make this too noisy)
dnl -pedantic
dnl -Wunreachable-code (broken, see GCC PR/7827)
dnl -Wredundant-decls (too many warnings in GLIBC's header with old GCC)
dnl
dnl A few other options have been left out because they are annoying in C++.
AC_DEFUN([CF_GXX_WARNINGS],
[if test -n "$GXX"; then
AC_CACHE_CHECK([for g++ warning options], ac_cv_prog_gxx_warn_flags,
[
cat > conftest.$ac_ext <<EOF
#line __oline__ "configure"
int main(int argc, char *argv[[]]) { return argv[[argc-1]] == 0; }
EOF
cf_save_CXXFLAGS="$CXXFLAGS"
ac_cv_prog_gxx_warn_flags="-W -Wall"
for cf_opt in \
Wcast-align \
Winline \
Wpointer-arith \
Wwrite-strings \
Wstrict-prototypes \
Wcast-qual \
Werror
do
CXXFLAGS="$cf_save_CXXFLAGS $ac_cv_prog_gxx_warn_flags -$cf_opt"
if AC_TRY_EVAL(ac_compile); then
ac_cv_prog_gxx_warn_flags="$ac_cv_prog_gxx_warn_flags -$cf_opt"
test "$cf_opt" = Wcast-qual && ac_cv_prog_gxx_warn_flags="$ac_cv_prog_gxx_warn_flags -DXTSTRINGDEFINES"
fi
done
rm -f conftest*
CXXFLAGS="$cf_save_CXXFLAGS"])
fi
AC_SUBST([WARNING_CXXFLAGS], ["${ac_cv_prog_gxx_warn_flags}"])
])
.deps
Makefile
Makefile.in
AUTOMAKE_OPTIONS = subdir-objects
# List directories in the order they must be built.
SUBDIRS = misc ltlast ltlvisit ltlparse ltltest
.deps
Makefile
Makefile.in
AM_CPPFLAGS = -I$(srcdir)/..
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
lib_LIBRARIES = libltlast.a
libltlast_a_SOURCES = \
allnodes.hh \
atomic_prop.cc \
atomic_prop.hh \
binop.cc \
binop.hh \
constant.cc \
constant.hh \
formulae.hh \
multop.cc \
multop.hh \
predecl.hh \
unop.cc \
unop.hh
#ifndef SPOT_LTLAST_ALLNODES_HH
# define SPOT_LTLAST_ALLNODES_HH
# include "binop.hh"
# include "unop.hh"
# include "multop.hh"
# include "atomic_prop.hh"
# include "constant.hh"
#endif // SPOT_LTLAST_ALLNODES_HH
#include "atomic_prop.hh"
#include "visitor.hh"
namespace spot
{
namespace ltl
{
atomic_prop::atomic_prop(std::string name)
: name_(name)
{
}
atomic_prop::~atomic_prop()
{
}
void
atomic_prop::accept(visitor& v)
{
v.visit(this);
}
void
atomic_prop::accept(const_visitor& v) const
{
v.visit(this);
}
bool
atomic_prop::equals(const formulae* f) const
{
const atomic_prop* p = dynamic_cast<const atomic_prop*>(f);
return p && p->name() == name();
}
const std::string&
atomic_prop::name() const
{
return name_;
}
}
}
#ifndef SPOT_LTLAST_ATOMIC_PROP_HH
# define SPOT_LTLAST_ATOMIC_PROP_HH
#include <string>
#include "formulae.hh"
namespace spot
{
namespace ltl
{
class atomic_prop : public formulae
{
public:
atomic_prop(std::string name);
virtual ~atomic_prop();
virtual void accept(visitor& visitor);
virtual void accept(const_visitor& visitor) const;
virtual bool equals(const formulae* f) const;
const std::string& name() const;
private:
std::string name_;
};
}
}
#endif // SPOT_LTLAST_ATOMICPROP_HH
#include <cassert>
#include "binop.hh"
#include "visitor.hh"
namespace spot
{
namespace ltl
{
binop::binop(type op, formulae* first, formulae* second)
: op_(op), first_(first), second_(second)
{
}
binop::~binop()
{
}
void
binop::accept(visitor& v)
{
v.visit(this);
}
void
binop::accept(const_visitor& v) const
{
v.visit(this);
}
const formulae*
binop::first() const
{
return first_;
}
formulae*
binop::first()
{
return first_;
}
const formulae*
binop::second() const
{
return second_;
}
formulae*
binop::second()
{
return second_;
}
bool
binop::equals(const formulae* f) const
{
const binop* p = dynamic_cast<const binop*>(f);
return p && p->op() == op()
&& first()->equals(p->first())
&& second()->equals(p->second());
}
binop::type
binop::op() const
{
return op_;
}
const char*
binop::op_name() const
{
switch (op_)
{
case Xor:
return "Xor";
case Implies:
return "Implies";
case Equiv:
return "Equiv";
case U:
return "U";
case R:
return "R";
}
// Unreachable code.
assert(0);
return 0;
}
}
}
#ifndef SPOT_LTLAST_BINOP_HH
# define SPOT_LTLAST_BINOP_HH
#include "formulae.hh"
namespace spot
{
namespace ltl
{
class binop : public formulae
{
public:
// And and Or are not here. Because they
// are often nested we represent them as multops.
enum type { Xor, Implies, Equiv, U, R };
binop(type op, formulae* first, formulae* second);
virtual ~binop();
virtual void accept(visitor& v);
virtual void accept(const_visitor& v) const;
virtual bool equals(const formulae* f) const;
const formulae* first() const;
formulae* first();
const formulae* second() const;
formulae* second();
type op() const;
const char* op_name() const;
private:
type op_;
formulae* first_;
formulae* second_;
};
}
}
#endif // SPOT_LTLAST_BINOP_HH
#include "constant.hh"
#include "visitor.hh"
#include <cassert>
namespace spot
{
namespace ltl
{
constant::constant(type val)
: val_(val)
{
}
constant::~constant()
{
}
void
constant::accept(visitor& v)
{
v.visit(this);
}
void
constant::accept(const_visitor& v) const
{
v.visit(this);
}
bool
constant::equals(const formulae* f) const
{
const constant* p = dynamic_cast<const constant*>(f);
return p && p->val() == val();
}
constant::type
constant::val() const
{
return val_;
}
const char*
constant::val_name() const
{
switch (val_)
{
case True:
return "1";
case False:
return "0";
}
// Unreachable code.
assert(0);
return 0;
}
}
}
#ifndef SPOT_LTLAST_CONSTANT_HH
# define SPOT_LTLAST_CONSTANT_HH
#include "formulae.hh"
namespace spot
{
namespace ltl
{
class constant : public formulae
{
public:
enum type { False, True };
constant(type val);
virtual ~constant();