[PATCH 04/10] Start to provide some precompiled wrappers for Milena.

* src/wrappers/milena.hh, src/wrappers/milena.cc: New. * src/wrappers/Makefile.am: New. * src/Makefile.am (SUBDIRS): New. Add . and wrappers. * configure.ac: Configure src/wrappers/Makefile. --- dynamic-use-of-static-c++/ChangeLog | 10 ++ dynamic-use-of-static-c++/configure.ac | 1 + dynamic-use-of-static-c++/src/Makefile.am | 2 + dynamic-use-of-static-c++/src/wrappers/Makefile.am | 25 ++++++ dynamic-use-of-static-c++/src/wrappers/milena.cc | 88 ++++++++++++++++++++ dynamic-use-of-static-c++/src/wrappers/milena.hh | 57 +++++++++++++ 6 files changed, 183 insertions(+), 0 deletions(-) create mode 100644 dynamic-use-of-static-c++/src/wrappers/Makefile.am create mode 100644 dynamic-use-of-static-c++/src/wrappers/milena.cc create mode 100644 dynamic-use-of-static-c++/src/wrappers/milena.hh diff --git a/dynamic-use-of-static-c++/ChangeLog b/dynamic-use-of-static-c++/ChangeLog index 8d30676..8f695ef 100644 --- a/dynamic-use-of-static-c++/ChangeLog +++ b/dynamic-use-of-static-c++/ChangeLog @@ -1,5 +1,15 @@ 2009-11-02 Roland Levillain <roland@lrde.epita.fr> + Start to provide some precompiled wrappers for Milena. + + * src/wrappers/milena.hh, src/wrappers/milena.cc: New. + * src/wrappers/Makefile.am: New. + * src/Makefile.am (SUBDIRS): New. + Add . and wrappers. + * configure.ac: Configure src/wrappers/Makefile. + +2009-11-02 Roland Levillain <roland@lrde.epita.fr> + Wrap global objects (operator functors) previously ignored. * swig/dyn.i: Here. diff --git a/dynamic-use-of-static-c++/configure.ac b/dynamic-use-of-static-c++/configure.ac index e6ff54b..02dced0 100644 --- a/dynamic-use-of-static-c++/configure.ac +++ b/dynamic-use-of-static-c++/configure.ac @@ -208,6 +208,7 @@ AC_CONFIG_FILES([ libmd5/Makefile src/Makefile src/config.hh + src/wrappers/Makefile data/Makefile config/Makefile _config/local-config.rb diff --git a/dynamic-use-of-static-c++/src/Makefile.am b/dynamic-use-of-static-c++/src/Makefile.am index ea01751..0f5fd9b 100644 --- a/dynamic-use-of-static-c++/src/Makefile.am +++ b/dynamic-use-of-static-c++/src/Makefile.am @@ -14,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with Olena. If not, see <http://www.gnu.org/licenses/>. +SUBDIRS = . wrappers + include_HEADERS = dyn-all.hh dyn-light.hh lib_LTLIBRARIES = libdyn.la diff --git a/dynamic-use-of-static-c++/src/wrappers/Makefile.am b/dynamic-use-of-static-c++/src/wrappers/Makefile.am new file mode 100644 index 0000000..af08122 --- /dev/null +++ b/dynamic-use-of-static-c++/src/wrappers/Makefile.am @@ -0,0 +1,25 @@ +# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE). +# +# This file is part of Olena. +# +# Olena 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, version 2 of the License. +# +# Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. + +# FIXME: These wrappers should be optional (and likewise for all +# milena-related code); have configure provide an `--enable-milena' +# option. + +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src + +# Wrapping a few Milena routines. +lib_LTLIBRARIES = libdynmilena.la +libdynmilena_la_SOURCES = milena.hh milena.cc diff --git a/dynamic-use-of-static-c++/src/wrappers/milena.cc b/dynamic-use-of-static-c++/src/wrappers/milena.cc new file mode 100644 index 0000000..3ad7a95 --- /dev/null +++ b/dynamic-use-of-static-c++/src/wrappers/milena.cc @@ -0,0 +1,88 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#include <wrappers/milena.hh> + +/// \file +/// \brief Definition of Milena wrappers. +/// +/// \todo The next step is to generate (semi-)automatically this file +/// from Milena's (possibly annotated) source files. + +namespace dyn +{ + + namespace mln + { + + /*-----------------. + | Initialization. | + `-----------------*/ + + /* This initialization relies on ctors of the fact that + constructors of global objects called before `main', or more + precisely: + + [...] the constructor of a global object is called either + before the first statement of main or may be deferred until + after the first statement of main but before the first use of + any object or function in the same translation unit as the + global object is defined in. + + according to this page: + http://en.allexperts.com/q/C-1040/Constructors-Global-Object.htm. */ + + struct init_type + { + init_type() + { + dyn::include_dir(MILENA_DIR); + dyn::include("mln/core/image/image2d.hh"); + dyn::include("mln/data/fill.hh"); + dyn::include("mln/debug/iota.hh"); + dyn::include("mln/debug/println.hh"); + } + }; + + init_type init; + + + /*-------------------------. + | A few wrapped routines. | + `-------------------------*/ + + ctor mk_image2d_int("mln::image2d<int>"); + + fun fill("mln::data::fill"); + fun iota("mln::debug::iota"); + fun println("mln::debug::println"); + + // FIXME: Wrap more routines. + + // ... + + } // end of namespace dyn::mln + +} // end of namespace dyn diff --git a/dynamic-use-of-static-c++/src/wrappers/milena.hh b/dynamic-use-of-static-c++/src/wrappers/milena.hh new file mode 100644 index 0000000..b0ba1ed --- /dev/null +++ b/dynamic-use-of-static-c++/src/wrappers/milena.hh @@ -0,0 +1,57 @@ +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena 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, version 2 of the License. +// +// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. +// +// As a special exception, you may use this file as part of a free +// software project without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to produce +// an executable, this file does not by itself cause the resulting +// executable to be covered by the GNU General Public License. This +// exception does not however invalidate any other reasons why the +// executable file might be covered by the GNU General Public License. + +#ifndef DYN_WRAPPERS_MILENA_HH +# define DYN_WRAPPERS_MILENA_HH + +/// \file +/// \brief Declaration of Milena wrappers. +/// +/// \todo The next step is to generate (semi-)automatically this file +/// from Milena's (possibly annotated) source files. + +# include <dyn-all.hh> + +namespace dyn +{ + + namespace mln + { + + extern dyn::language::ctor mk_image2d_int; + + extern dyn::language::fun fill; + extern dyn::language::fun iota; + extern dyn::language::fun println; + + // FIXME: Wrap more routines. + + // ... + + } // end of namespace dyn::mln + +} // end of namespace dyn + +#endif // ! DYN_WRAPPERS_MILENA_HH -- 1.6.5
participants (1)
-
Roland Levillain