From 4defec66b489144735cf13e0258edd93bf2e279e Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 20 Oct 2004 15:50:52 +0000 Subject: [PATCH] * src/misc/bareword.hh, src/misc/bareword.cc: New files. * src/misc/Makefile.am (libmisc_la_SOURCES, misc_HEADERS): Add them. --- ChangeLog | 3 +++ src/misc/Makefile.am | 2 ++ src/misc/bareword.cc | 40 ++++++++++++++++++++++++++++++++++++++++ src/misc/bareword.hh | 25 +++++++++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 src/misc/bareword.cc create mode 100644 src/misc/bareword.hh diff --git a/ChangeLog b/ChangeLog index e1d338059..43eb5e704 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-10-20 Alexandre Duret-Lutz + * src/misc/bareword.hh, src/misc/bareword.cc: New files. + * src/misc/Makefile.am (libmisc_la_SOURCES, misc_HEADERS): Add them. + * src/misc/modgray.hh, src/misc/modgray.cc: New files. * src/misc/Makefile.am (libmisc_la_SOURCES, misc_HEADERS): Add them. * wrap/python/spot.i: Activate directors, and interface modgray.hh. diff --git a/src/misc/Makefile.am b/src/misc/Makefile.am index ffd0b43d2..b04fc738d 100644 --- a/src/misc/Makefile.am +++ b/src/misc/Makefile.am @@ -25,6 +25,7 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS) miscdir = $(pkgincludedir)/misc misc_HEADERS = \ + bareword.hh \ bddalloc.hh \ bddlt.hh \ escape.hh \ @@ -36,6 +37,7 @@ misc_HEADERS = \ noinst_LTLIBRARIES = libmisc.la libmisc_la_SOURCES = \ + bareword.cc \ bddalloc.cc \ escape.cc \ freelist.cc \ diff --git a/src/misc/bareword.cc b/src/misc/bareword.cc new file mode 100644 index 000000000..01dc784e5 --- /dev/null +++ b/src/misc/bareword.cc @@ -0,0 +1,40 @@ +// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// et Marie Curie. +// +// This file is part of Spot, a model checking library. +// +// Spot is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Spot is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +// License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Spot; see the file COPYING. If not, write to the Free +// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. + +#include "bareword.hh" +#include + +namespace spot +{ + bool + is_bare_word(const char* str) + { + // Bare words cannot be empty and should start with a letter. + if (!*str + || !(isalpha(*str) || *str == '_')) + return false; + // The remaining of the word must be alphanumeric. + while (*++str) + if (!(isalnum(*str) || *str == '_')) + return false; + return true; + } +} diff --git a/src/misc/bareword.hh b/src/misc/bareword.hh new file mode 100644 index 000000000..30c44bdf4 --- /dev/null +++ b/src/misc/bareword.hh @@ -0,0 +1,25 @@ +// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// et Marie Curie. +// +// This file is part of Spot, a model checking library. +// +// Spot is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Spot is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +// License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Spot; see the file COPYING. If not, write to the Free +// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. + +namespace spot +{ + bool is_bare_word(const char* str); +}