2134: Clean up Swilena a bit.

https://svn.lrde.epita.fr/svn/oln/trunk/swilena Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Clean up Swilena a bit. * box2d.i, dpoint2d.i: Remove dead code. * image2d.ixx: Likewise. (instantiate_image2d): Indent. * intp.ixx: Add missing `module' statement. * fill.ixx: Use macro mln_value() in fill()'s signature, as in the original one. * ch_value.ixx (ch_value< image2d< int_u<8> >, int_u<32> >): Turn into... (ch_value< image2d< int_u<8> >, V >): ...this. Adjust documentation. * image2d_int.i: Add a FIXME. * point2d.i: Aesthetic change. box2d.i | 5 ----- ch_value.ixx | 15 +++++++-------- dpoint2d.i | 17 +---------------- fill.ixx | 9 ++++++--- image2d.ixx | 6 ------ image2d_int.i | 5 +++++ intp.ixx | 4 +++- point2d.i | 1 + 8 files changed, 23 insertions(+), 39 deletions(-) Index: box2d.i --- box2d.i (revision 2134) +++ box2d.i (working copy) @@ -38,11 +38,6 @@ %include "mln/core/macros.hh"; -// %include "mln/core/grids.hh"; - -// %include "mln/core/point.hh"; -// %include "mln/core/point2d.hh"; - %include "mln/core/box.hh"; %include "mln/core/box2d.hh"; Index: dpoint2d.i --- dpoint2d.i (revision 2134) +++ dpoint2d.i (working copy) @@ -38,24 +38,9 @@ %include "mln/core/dpoint.hh"; %include "mln/core/dpoint2d.hh"; -/* FIXME: Ignore `mln::dpoint_<M,C>::origin' to circumvent a swig bug. - Without this ignore clause, the generated code would trigger this - error : - image2d-wrap.cc:3115:144: error: macro "SWIG_as_voidptr" passed 2 - arguments, but takes just 1 - image2d-wrap.cc: In function 'PyObject* dpoint2d_origin_get()': - image2d-wrap.cc:3115: error: 'SWIG_as_voidptr' was not declared in this - scope - - Check whether this bug has been fixed in a recent release of SWIG - or if it has been reported. */ -// %ignore mln::dpoint_<mln::grid::square,int>::origin; -// Ignoring to_h_vec saves us the wrapping of h_vec. -// %ignore mln::dpoint_<mln::grid::square,int>::to_h_vec; // Swig tries to wrap everything by default; prevent it from wrapping -// invalid methods (1D and 3D ctors for a dpoint2d). -// %ignore mln::dpoint_<mln::grid::square,int>::dpoint_(const literal::zero_t&); +// invalid methods (1D and 3D ctors for a point2d). %ignore mln::dpoint_<mln::grid::square,int>::dpoint_(const literal::one_t&); %ignore mln::dpoint_<mln::grid::square,int>::operator=(const literal::one_t&); %ignore mln::dpoint_<mln::grid::square,int>::dpoint_(int); Index: image2d.ixx --- image2d.ixx (revision 2134) +++ image2d.ixx (working copy) @@ -42,19 +42,13 @@ // Shortcuts macros. %include "mln/core/macros.hh" -// Associated types. -// %include "mln/core/box2d.hh" -// %include "mln/core/dpoint2d.hh" - // Meta-expressions used in traits. -// %include "mln/metal/bexpr.hh" %include "mln/metal/equal.hh" %include "mln/metal/if.hh" %include "mln/metal/is_const.hh" // Traits. %include "mln/trait/value_.hh" -// %include "mln/trait/image/props.hh" %include "mln/trait/images.hh" // Concept. Index: intp.ixx --- intp.ixx (revision 2134) +++ intp.ixx (working copy) @@ -26,9 +26,11 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file intp.i +/// \file intp.ixx /// \brief A wrapper of int pointers. +%module intp + %include "cpointer.i" // Wrap a class interface around an "int *" (see // // http://www.swig.org/Doc1.3/Library.html#Library_nn4). Index: fill.ixx --- fill.ixx (revision 2134) +++ fill.ixx (working copy) @@ -35,15 +35,18 @@ #include "mln/level/fill.hh" %} -// FIXME: Wrap mln::level::fill by hand, for mln_value(I) disturbs -// swig. Annotate the original source code instead? +%include "mln/core/macros.hh" + +/* FIXME: Wrap mln::level::fill by hand to help swig choose the right + overload of the algorithm. We might just try to use %ignore + statements instead. */ namespace mln { namespace level { template <typename I> - void fill(mln::Image<I>& ima, const typename I::value& v); + void fill(mln::Image<I>& ima, const mln_value(I)& v); } // end of namespace mln::level Index: ch_value.ixx --- ch_value.ixx (revision 2134) +++ ch_value.ixx (working copy) @@ -52,8 +52,8 @@ // Nothing by default. }; - /* Swig is not powerful enough to parse difficult templates. For - instance, it won't match this specialization. + /* Swig is not powerful enough to parse difficult templates (yet). + For instance, it won't match this specialization: template <typename T, typename U> struct ch_value< mln::image2d< T >, U > @@ -61,16 +61,15 @@ typedef mln::image2d< U > ret; }; - (which is even simpler than what mln/trait/ch_value.hh contains!) + which is even simpler than what mln/trait/ch_value.hh contains. - So we just give it simple ``inlined'' equivalent traits that + Hence we just give it simple ``inlined'' equivalent traits that are compatible with the ones in mln/trait/ch_value.hh. */ - template <> - struct ch_value< mln::image2d< mln::value::int_u<8> >, - mln::value::int_u<32> > + template <typename V> + struct ch_value< mln::image2d< mln::value::int_u<8> >, V > { - typedef mln::image2d< mln::value::int_u<32> > ret; + typedef mln::image2d< V > ret; }; } // end of namespace mln::morpho Index: image2d_int.i --- image2d_int.i (revision 2134) +++ image2d_int.i (working copy) @@ -32,6 +32,11 @@ %module image2d_int +/* FIXME: Shouldn't it be + + %include "intp.i" + + instead? After all, module `intp' generates wrappers too. */ %include "intp.ixx" %include "image2d.ixx" instantiate_image2d(image2d_int, int) Index: point2d.i --- point2d.i (revision 2134) +++ point2d.i (working copy) @@ -38,6 +38,7 @@ %include "mln/core/point.hh"; %include "mln/core/point2d.hh"; + /* FIXME: Ignore `mln::point_<M,C>::origin' to circumvent a swig bug. Without this ignore clause, the generated code would trigger this error :
participants (1)
-
Roland Levillain