From 2ef8917ba59a3f639b13489a2f2128e34c1d5c14 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 24 Jun 2013 21:39:22 +0200 Subject: [PATCH] Enable -fvisibility=hidden for src/misc/. * configure.ac: Check for -fvisibility support. * m4/ax_check_compile_flag.m4: New file. * src/misc/common.hh: New file. * src/misc/Makefile.am: Add common.hh, and adjust to use -fvisibility. * src/misc/bareword.hh, src/misc/escape.hh, src/misc/formater.hh, src/misc/intvcmp2.hh, src/misc/intvcomp.hh, src/misc/memusage.hh, src/misc/minato.hh, src/misc/optionmap.hh, src/misc/random.hh, src/misc/timer.hh, src/misc/version.hh, src/misc/bddop.hh: Include common.hh and add SPOT_API tags. * src/misc/acccompl.hh, src/misc/accconv.hh: Prepare for upcoming move. * src/sanity/style.test: Ignore SPOT_API tags. * wrap/python/Makefile.am: Ignore SPOT_API. * wrap/python/spot.i: Do not emit binding for bddalloc.hh. * wrap/python/tests/minato.py: Do not use bdd_allocator. --- configure.ac | 8 +++++ m4/ax_check_compile_flag.m4 | 72 +++++++++++++++++++++++++++++++++++++ src/misc/Makefile.am | 18 +++++----- src/misc/acccompl.hh | 8 ++--- src/misc/accconv.hh | 8 ++--- src/misc/bareword.hh | 17 +++++---- src/misc/bddop.hh | 10 ++++-- src/misc/common.hh | 59 ++++++++++++++++++++++++++++++ src/misc/escape.hh | 14 ++++---- src/misc/formater.hh | 3 +- src/misc/intvcmp2.hh | 12 ++++--- src/misc/intvcomp.hh | 22 ++++++------ src/misc/memusage.hh | 8 +++-- src/misc/minato.hh | 8 +++-- src/misc/optionmap.hh | 11 ++++-- src/misc/random.hh | 20 ++++++----- src/misc/timer.hh | 5 +-- src/misc/version.hh | 9 +++-- src/sanity/style.test | 5 ++- wrap/python/Makefile.am | 10 +++--- wrap/python/spot.i | 2 -- wrap/python/tests/minato.py | 7 ++-- 22 files changed, 258 insertions(+), 78 deletions(-) create mode 100644 m4/ax_check_compile_flag.m4 create mode 100644 src/misc/common.hh diff --git a/configure.ac b/configure.ac index 593f0e1e8..dd45ef26e 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,14 @@ gl_INIT AC_LANG(C++) +# Use -Werror since using -fvisibility under MinGW is only a warning. +# (The option is ignored anyway since this does not make sense under windows). +AC_SUBST([VISIBILITY_CXXFLAGS]) +AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden], + [VISIBILITY_CXXFLAGS="$VISIBILITY_CXXFLAGS -fvisibility=hidden -DSPOT_BUILD" + AX_CHECK_COMPILE_FLAG([-fvisibility-inlines-hidden], + [VISIBILITY_CXXFLAGS="$VISIBILITY_CXXFLAGS -fvisibility-inlines-hidden"])]) + AC_HEADER_UNORDERED_MAP AC_HEADER_TR1_UNORDERED_MAP AC_HEADER_EXT_HASH_MAP diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 000000000..c3a8d695a --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program 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 3 of the License, or (at your +# option) any later version. +# +# This program 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 this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/src/misc/Makefile.am b/src/misc/Makefile.am index 843d0db2b..5271ccad5 100644 --- a/src/misc/Makefile.am +++ b/src/misc/Makefile.am @@ -1,8 +1,9 @@ -## Copyright (C) 2011, 2012 Laboratoire de Recherche et Développement -## de l'Epita (LRDE). +## -*- coding: utf-8 -*- +## Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et +## Développement de l'Epita (LRDE). ## Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de -## Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), -## Université Pierre et Marie Curie. +## 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. ## @@ -20,7 +21,7 @@ ## along with this program. If not, see . AM_CPPFLAGS = -I$(srcdir)/.. -I.. $(BUDDY_CPPFLAGS) -AM_CXXFLAGS = $(WARNING_CXXFLAGS) +AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(VISIBILITY_CXXFLAGS) miscdir = $(pkgincludedir)/misc @@ -35,6 +36,7 @@ misc_HEADERS = \ bddlt.hh \ bddop.hh \ casts.hh \ + common.hh \ escape.hh \ fixpool.hh \ formater.hh \ @@ -45,8 +47,8 @@ misc_HEADERS = \ intvcmp2.hh \ ltstr.hh \ minato.hh \ - memusage.hh \ modgray.hh \ + memusage.hh \ mspool.hh \ optionmap.hh \ random.hh \ @@ -62,13 +64,13 @@ libmisc_la_SOURCES = \ bddalloc.cc \ bddop.cc \ escape.cc \ - freelist.cc \ formater.cc \ + freelist.cc \ intvcomp.cc \ intvcmp2.cc \ + modgray.cc \ memusage.cc \ minato.cc \ - modgray.cc \ optionmap.cc \ random.cc \ timer.cc \ diff --git a/src/misc/acccompl.hh b/src/misc/acccompl.hh index b8d30e0f5..7d1b42ac5 100644 --- a/src/misc/acccompl.hh +++ b/src/misc/acccompl.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2012 Laboratoire de Recherche et Developpement de +// Copyright (C) 2012, 2013 Laboratoire de Recherche et Developpement de // l'Epita (LRDE) // // This file is part of Spot, a model checking library. @@ -18,8 +18,8 @@ // along with this program. If not, see . -#ifndef SPOT_MISC_ACCCOMPL_HH -# define SPOT_MISC_ACCCOMPL_HH +#ifndef SPOT_PRIV_ACCCOMPL_HH +# define SPOT_PRIV_ACCCOMPL_HH #include #include @@ -53,4 +53,4 @@ namespace spot }; } // End namespace Spot -#endif // !SPOT_MISC_ACCCOMPL_HH +#endif // SPOT_PRIV_ACCCOMPL_HH diff --git a/src/misc/accconv.hh b/src/misc/accconv.hh index 7b7383ff7..4fa5f28ad 100644 --- a/src/misc/accconv.hh +++ b/src/misc/accconv.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2011 Laboratoire de Recherche et Developpement de +// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de // l'Epita (LRDE) // // This file is part of Spot, a model checking library. @@ -16,8 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef SPOT_MISC_ACCCONV_HH -# define SPOT_MISC_ACCCONV_HH +#ifndef SPOT_PRIV_ACCCONV_HH +# define SPOT_PRIV_ACCCONV_HH #include #include "misc/hash.hh" @@ -48,4 +48,4 @@ namespace spot } -#endif // SPOT_MISC_ACCCONV_HH +#endif // SPOT_PRIV_ACCCONV_HH diff --git a/src/misc/bareword.hh b/src/misc/bareword.hh index 68434b39c..735c16100 100644 --- a/src/misc/bareword.hh +++ b/src/misc/bareword.hh @@ -1,5 +1,8 @@ +// -*- coding: utf-8 -*- +// Copyright (C) 2013 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -20,7 +23,8 @@ #ifndef SPOT_MISC_BAREWORD_HH # define SPOT_MISC_BAREWORD_HH -#include +# include "common.hh" +# include namespace spot { @@ -28,13 +32,14 @@ namespace spot /// @{ /// \brief Whether a word is bare. /// - /// Bare words should start with a letter or an underscore, and - /// consist solely of alphanumeric characters and underscores. - bool is_bare_word(const char* str); + /// Bare words should start with a letter, an underscore, or a dot, + /// and consist solely of alphanumeric characters, underscores, and + /// dots. + SPOT_API bool is_bare_word(const char* str); /// \brief Double-quote words that are not bare. /// \see is_bare_word - std::string quote_unless_bare_word(const std::string& str); + SPOT_API std::string quote_unless_bare_word(const std::string& str); /// @} } diff --git a/src/misc/bddop.hh b/src/misc/bddop.hh index 05ab5aa47..5425ab702 100644 --- a/src/misc/bddop.hh +++ b/src/misc/bddop.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2009 Laboratoire de Recherche et Développement +// -*- coding: utf-8 -*- +// Copyright (C) 2009, 2013 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -19,17 +20,20 @@ #ifndef SPOT_MISC_BDDOP_HH # define SPOT_MISC_BDDOP_HH +#include "common.hh" #include "bdd.h" namespace spot { /// \brief Compute all acceptance conditions from all neg acceptance /// conditions. - bdd compute_all_acceptance_conditions(bdd neg_acceptance_conditions); + SPOT_API bdd + compute_all_acceptance_conditions(bdd neg_acceptance_conditions); /// \brief Compute neg acceptance conditions from all acceptance /// conditions. - bdd compute_neg_acceptance_conditions(bdd all_acceptance_conditions); + SPOT_API bdd + compute_neg_acceptance_conditions(bdd all_acceptance_conditions); } #endif // SPOT_MISC_BDDOP_HH diff --git a/src/misc/common.hh b/src/misc/common.hh new file mode 100644 index 000000000..50a929507 --- /dev/null +++ b/src/misc/common.hh @@ -0,0 +1,59 @@ +// -*- coding: utf-8 -*- +// Copyright (C) 2013 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). +// +// 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 3 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 this program. If not, see . + +#ifndef SPOT_MISC_COMMON_HH +# define SPOT_MISC_COMMON_HH + +#if defined _WIN32 || defined __CYGWIN__ + #define SPOT_HELPER_DLL_IMPORT __declspec(dllimport) + #define SPOT_HELPER_DLL_EXPORT __declspec(dllexport) + #define SPOT_HELPER_DLL_LOCAL +#else + #if __GNUC__ >= 4 + #define SPOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) + #define SPOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define SPOT_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden"))) + #else + #define SPOT_HELPER_DLL_IMPORT + #define SPOT_HELPER_DLL_EXPORT + #define SPOT_HELPER_DLL_LOCAL + #endif +#endif + +#ifdef SPOT_BUILD + #define SPOT_DLL +#endif + +// SPOT_API is used for the public API symbols. It either DLL imports +// or DLL exports (or does nothing for static build) SPOT_LOCAL is +// used for non-api symbols that may occur in header files. +#ifdef SPOT_DLL + #ifdef SPOT_BUILD + #define SPOT_API SPOT_HELPER_DLL_EXPORT + #else + #define SPOT_API SPOT_HELPER_DLL_IMPORT + #endif + #define SPOT_LOCAL SPOT_HELPER_DLL_LOCAL +#else + #define SPOT_API + #define SPOT_LOCAL +#endif +#define SPOT_API_VAR extern SPOT_API + +#endif // SPOT_MISC_COMMON_HH diff --git a/src/misc/escape.hh b/src/misc/escape.hh index cff0108fc..c603d9e52 100644 --- a/src/misc/escape.hh +++ b/src/misc/escape.hh @@ -1,7 +1,8 @@ -// Copyright (C) 2011, 2012 Laboratoire de Recherche et Developpement de -// l'Epita (LRDE). +// -*- coding: utf-8 -*- +// Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et +// Developpement de l'Epita (LRDE). // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -22,6 +23,7 @@ #ifndef SPOT_MISC_ESCAPE_HH # define SPOT_MISC_ESCAPE_HH +# include "common.hh" # include # include @@ -32,14 +34,14 @@ namespace spot /// \brief Escape characters ", \\, and /// \\n in \a str. - std::ostream& escape_str(std::ostream& os, const std::string& str); + SPOT_API std::ostream& escape_str(std::ostream& os, const std::string& str); /// \brief Escape characters ", \\, and /// \\n in \a str. - std::string escape_str(const std::string& str); + SPOT_API std::string escape_str(const std::string& str); /// \brief Remove spaces at the front and back of \a str. - void trim(std::string& str); + SPOT_API void trim(std::string& str); /// @} } diff --git a/src/misc/formater.hh b/src/misc/formater.hh index ff56cb08f..3d138609f 100644 --- a/src/misc/formater.hh +++ b/src/misc/formater.hh @@ -20,6 +20,7 @@ #ifndef SPOT_MISC_FORMATER_HH #define SPOT_MISC_FORMATER_HH +#include "common.hh" #include #include #include @@ -101,7 +102,7 @@ namespace spot }; - class formater + class SPOT_API formater { printable_id id; printable_percent percent; diff --git a/src/misc/intvcmp2.hh b/src/misc/intvcmp2.hh index ab972a74a..3844904de 100644 --- a/src/misc/intvcmp2.hh +++ b/src/misc/intvcmp2.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 Laboratoire de Recherche et Developpement de +// -*- coding: utf-8 -*- +// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de // l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -19,8 +20,9 @@ #ifndef SPOT_MISC_INTVCMP2_HH # define SPOT_MISC_INTVCMP2_HH -#include -#include +# include "common.hh" +# include +# include namespace spot { @@ -33,7 +35,7 @@ namespace spot /// assert will be triggered if \a dest_size is too small. On /// return, \a dest_size will be set to the actually number of int /// filled in \a dest - void + SPOT_API void int_array_array_compress2(const int* array, size_t n, int* dest, size_t& dest_size); @@ -41,7 +43,7 @@ namespace spot /// array of size \a size. /// /// \a size must be the exact expected size of uncompressed array. - void + SPOT_API void int_array_array_decompress2(const int* array, size_t array_size, int* res, size_t size); diff --git a/src/misc/intvcomp.hh b/src/misc/intvcomp.hh index ad6aa35a2..1c00f2af9 100644 --- a/src/misc/intvcomp.hh +++ b/src/misc/intvcomp.hh @@ -1,5 +1,6 @@ -// Copyright (C) 2011 Laboratoire de Recherche et Developpement de -// l'Epita (LRDE). +// -*- coding: utf-8 -*- +// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement +// de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -19,8 +20,9 @@ #ifndef SPOT_MISC_INTVCOMP_HH # define SPOT_MISC_INTVCOMP_HH -#include -#include +# include "common.hh" +# include +# include namespace spot { @@ -28,7 +30,7 @@ namespace spot /// @{ /// Compress an int vector into a vector of unsigned int. - void + SPOT_API void int_vector_vector_compress(const std::vector& input, std::vector& output); @@ -36,19 +38,19 @@ namespace spot /// size \a size. /// /// \a size must be the exact expected size of uncompressed array. - void + SPOT_API void int_vector_vector_decompress(const std::vector& array, std::vector& output, size_t size); /// Compress an int array if size \a n into a vector of unsigned int. - const std::vector* + SPOT_API const std::vector* int_array_vector_compress(const int* array, size_t n); /// \brief Uncompress a vector of unsigned int into an int array of /// size \a size. /// /// \a size must be the exact expected size of uncompressed array. - void + SPOT_API void int_vector_array_decompress(const std::vector* array, int* res, size_t size); @@ -58,7 +60,7 @@ namespace spot /// assert will be triggered if \a dest_size is too small. On /// return, \a dest_size will be set to the actually number of int /// filled in \a dest - void + SPOT_API void int_array_array_compress(const int* array, size_t n, int* dest, size_t& dest_size); @@ -66,7 +68,7 @@ namespace spot /// array of size \a size. /// /// \a size must be the exact expected size of uncompressed array. - void + SPOT_API void int_array_array_decompress(const int* array, size_t array_size, int* res, size_t size); diff --git a/src/misc/memusage.hh b/src/misc/memusage.hh index 51e7bed30..d379c8323 100644 --- a/src/misc/memusage.hh +++ b/src/misc/memusage.hh @@ -1,5 +1,8 @@ +// -*- coding: utf-8 -*- +// Copyright (C) 2013 Laboratoire de Recherche et Developpement de +// l'Epita (LRDE). // Copyright (C) 2006 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -20,6 +23,7 @@ #ifndef SPOT_MISC_MEMUSAGE_HH # define SPOT_MISC_MEMUSAGE_HH +#include "common.hh" namespace spot { @@ -27,7 +31,7 @@ namespace spot /// /// \return The total number of pages in use by the program if known. /// -1 otherwise. - int memusage(); + SPOT_API int memusage(); } #endif // SPOT_MISC_MEMUSAGE_HH diff --git a/src/misc/minato.hh b/src/misc/minato.hh index 165656d29..bcc320d11 100644 --- a/src/misc/minato.hh +++ b/src/misc/minato.hh @@ -1,7 +1,8 @@ -// Copyright (C) 2009 Laboratoire de Recherche et Développement +// -*- coding: utf-8 -*- +// Copyright (C) 2009, 2013 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -22,6 +23,7 @@ #ifndef SPOT_MISC_MINATO_HH # define SPOT_MISC_MINATO_HH +# include "common.hh" # include # include @@ -47,7 +49,7 @@ namespace spot month = {April} } \endverbatim */ - class minato_isop + class SPOT_API minato_isop { public: /// \brief Conctructor. diff --git a/src/misc/optionmap.hh b/src/misc/optionmap.hh index b445ccb27..a63332031 100644 --- a/src/misc/optionmap.hh +++ b/src/misc/optionmap.hh @@ -1,5 +1,8 @@ +// -*- coding: utf-8 -*- +// Copyright (C) 2013 Laboratoire de Recherche et Developpement de +// l'Epita (LRDE) // Copyright (C) 2005 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -20,6 +23,7 @@ #ifndef SPOT_MISC_OPTIONMAP_HH # define SPOT_MISC_OPTIONMAP_HH +#include "common.hh" #include #include #include @@ -30,7 +34,7 @@ namespace spot /// \brief Manage a map of options. /// /// Each option is defined by a string and is associated to an integer value. - class option_map + class SPOT_API option_map { public: /// \brief Add the parsed options to the map. @@ -76,7 +80,8 @@ namespace spot int& operator[](const char* option); /// \brief Print the option_map \a m. - friend std::ostream& operator<<(std::ostream& os, const option_map& m); + friend SPOT_API std::ostream& + operator<<(std::ostream& os, const option_map& m); private: std::map options_; diff --git a/src/misc/random.hh b/src/misc/random.hh index 01fb894b6..e365899c2 100644 --- a/src/misc/random.hh +++ b/src/misc/random.hh @@ -1,5 +1,8 @@ +// -*- coding: utf-8 -*- +// Copyright (C) 2013 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -20,6 +23,7 @@ #ifndef SPOT_MISC_RANDOM_HH # define SPOT_MISC_RANDOM_HH +# include "common.hh" # include namespace spot @@ -31,25 +35,25 @@ namespace spot /// \brief Reset the seed of the pseudo-random number generator. /// /// \see drand, mrand, rrand - void srand(unsigned int seed); + SPOT_API void srand(unsigned int seed); /// \brief Compute a pseudo-random integer value between \a min and /// \a max included. /// /// \see drand, mrand, srand - int rrand(int min, int max); + SPOT_API int rrand(int min, int max); /// \brief Compute a pseudo-random integer value between 0 and /// \a max-1 included. /// /// \see drand, rrand, srand - int mrand(int max); + SPOT_API int mrand(int max); /// \brief Compute a pseudo-random double value /// between 0.0 and 1.0 (1.0 excluded). /// /// \see mrand, rrand, srand - double drand(); + SPOT_API double drand(); /// \brief Compute a pseudo-random double value /// following a standard normal distribution. (Odeh & Evans) @@ -57,14 +61,14 @@ namespace spot /// This uses a polynomial approximation of the inverse cumulated /// density function from Odeh & Evans, Journal of Applied /// Statistics, 1974, vol 23, pp 96-97. - double nrand(); + SPOT_API double nrand(); /// \brief Compute a pseudo-random double value /// following a standard normal distribution. (Box-Muller) /// /// This uses the polar form of the Box-Muller transform /// to generate random values. - double bmrand(); + SPOT_API double bmrand(); /// \brief Compute pseudo-random integer value between 0 /// and \a n included, following a binomial distribution @@ -112,7 +116,7 @@ namespace spot /// following a Poisson distribution with parameter \a p. /// /// \pre p > 0 - int prand(double p); + SPOT_API int prand(double p); /// @} } diff --git a/src/misc/timer.hh b/src/misc/timer.hh index f400bbead..daa00a933 100644 --- a/src/misc/timer.hh +++ b/src/misc/timer.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2009, 2011, 2012 Laboratoire de Recherche et +// Copyright (C) 2009, 2011, 2012, 2013 Laboratoire de Recherche et // Développement de l'Epita (LRDE). // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -23,6 +23,7 @@ #ifndef SPOT_MISC_TIMER_HH # define SPOT_MISC_TIMER_HH +# include "common.hh" # include "misc/_config.h" # include # include @@ -200,7 +201,7 @@ namespace spot } /// Format information about all timers in a table. - std::ostream& + SPOT_API std::ostream& print(std::ostream& os) const; /// \brief Remove information about all timers. diff --git a/src/misc/version.hh b/src/misc/version.hh index 4bdb97628..de3f6d2d6 100644 --- a/src/misc/version.hh +++ b/src/misc/version.hh @@ -1,5 +1,8 @@ +// -*- coding: utf-8 -*- +// Copyright (C) 2013 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -20,11 +23,13 @@ #ifndef SPOT_MISC_VERSION_HH # define SPOT_MISC_VERSION_HH +# include "common.hh" + namespace spot { /// \ingroup misc_tools /// \brief Return Spot's version. - const char* version(); + SPOT_API const char* version(); } #endif // SPOT_MISC_VERSION_HH diff --git a/src/sanity/style.test b/src/sanity/style.test index 2ef2d4023..18c61709c 100755 --- a/src/sanity/style.test +++ b/src/sanity/style.test @@ -86,10 +86,13 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do # // # // # to keep the line numbers correct in the diagnostics. + # + # Also get read of the SPOT_API tags. perl -pe 'sub f {my $a = shift; $a =~ s:[^\n]*://:g; return "$a"} s,/\*(.*?)\*/,f($1),sge; s,//.*?\n,//\n,g; - s,"[^"\n]*","",g' -0777 <$file >$tmp + s,"[^"\n]*","",g; + s,SPOT_API ,,g' -0777 <$file >$tmp grep '[ ]$' $tmp && diag 'Trailing whitespace.' diff --git a/wrap/python/Makefile.am b/wrap/python/Makefile.am index 6a4326865..fe13622e8 100644 --- a/wrap/python/Makefile.am +++ b/wrap/python/Makefile.am @@ -1,7 +1,8 @@ -## Copyright (C) 2010, 2011 Laboratoire de Recherche et Development de +## -*- coding: utf-8 -*- +## Copyright (C) 2010, 2011, 2013 Laboratoire de Recherche et Development de ## l'Epita (LRDE). ## Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), -## département Systèmes Répartis Coopératifs (SRC), Université Pierre +## département Systèmes Répartis Coopératifs (SRC), Université Pierre ## et Marie Curie. ## ## This file is part of Spot, a model checking library. @@ -39,7 +40,8 @@ _spot_la_LDFLAGS = -avoid-version -module _spot_la_LIBADD = $(top_builddir)/src/libspot.la $(srcdir)/spot_wrap.cxx: $(srcdir)/spot.i - $(SWIG) -c++ -python -I$(srcdir) -I$(top_srcdir)/src $(srcdir)/spot.i + $(SWIG) -c++ -python -DSPOT_API= -I$(srcdir) \ + -I$(top_srcdir)/src $(srcdir)/spot.i $(srcdir)/spot.py: $(srcdir)/spot.i $(MAKE) $(AM_MAKEFLAGS) spot_wrap.cxx @@ -51,7 +53,7 @@ _buddy_la_SOURCES = $(srcdir)/buddy_wrap.cxx _buddy_la_LDFLAGS = -avoid-version -module $(BUDDY_LDFLAGS) $(srcdir)/buddy_wrap.cxx: $(srcdir)/buddy.i - $(SWIG) -c++ -python $(BUDDY_CPPFLAGS) $(srcdir)/buddy.i + $(SWIG) -c++ -python -DBUDDY_API= $(BUDDY_CPPFLAGS) $(srcdir)/buddy.i $(srcdir)/buddy.py: $(srcdir)/buddy.i $(MAKE) $(AM_MAKEFLAGS) buddy_wrap.cxx diff --git a/wrap/python/spot.i b/wrap/python/spot.i index e91149c6a..fd84b75e1 100644 --- a/wrap/python/spot.i +++ b/wrap/python/spot.i @@ -44,7 +44,6 @@ namespace std { #include #include "misc/version.hh" -#include "misc/bddalloc.hh" #include "misc/minato.hh" #include "misc/modgray.hh" #include "misc/optionmap.hh" @@ -158,7 +157,6 @@ using namespace spot; %rename(TrueVal) True; %include "misc/version.hh" -%include "misc/bddalloc.hh" %include "misc/minato.hh" %include "misc/optionmap.hh" %include "misc/random.hh" diff --git a/wrap/python/tests/minato.py b/wrap/python/tests/minato.py index e7463cf55..989bcce4f 100755 --- a/wrap/python/tests/minato.py +++ b/wrap/python/tests/minato.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: utf-8 -*- -# Copyright (C) 2010, 2012 Laboratoire de Recherche et Développement +# Copyright (C) 2010, 2012, 2013 Laboratoire de Recherche et Développement # de l'Epita # Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -24,9 +24,8 @@ import spot import buddy import sys -alloc = spot.bdd_allocator() - -alloc.allocate_variables(3) +buddy.bdd_init(10000, 10000) +buddy.bdd_setvarnum(3) a = buddy.bdd_ithvar(0) b = buddy.bdd_ithvar(1)