Index: ChangeLog from Damien Thivolle damien@lrde.epita.fr
* configure.ac: Add support for ruby-1.7, ruby-1.8.
Index: olena/ChangeLog from Damien Thivolle damien@lrde.epita.fr
* olena/oln/core/point2d.hh: Add header include. * olena/oln/core/point2d.hxx: Likewise. * olena/oln/core/point3d.hh: Likewise. * olena/oln/core/point3d.hxx: Likewise.
Index: tools/swilena/ChangeLog -2004-10-04 Niels Van Vliet niels@lrde.epita.fr +2004-04-11 Damien Thivolle damien@lrde.epita.fr
- * tools/swilena/meta/swilena_structelt.i: Fix a bug. - * tools/swilena/doc/swilena.texi: Fix a bug. - * tools/swilena/python/Makefile.am: Add clean_local. + * swilena/expand.sh: Split morpho modules to make the code compile + faster. + * swilena/generate_morpho_instantiations.py: Likewise. + * swilena/meta/swilena_ntg.i: Add `do_nothing' argument to empty SWIG + macros since the SWIG preprocessor does not support them. + * swilena/meta/swilena_morpho.i: Likewise. + +2004-04-10 Niels Van Vliet niels@lrde.epita.fr + + * swilena/meta/swilena_structelt.i: Fix a bug. + * swilena/doc/swilena.texi: Fix a bug. + * swilena/python/Makefile.am: Add clean_local.
2004-01-26 Astrid Wang astrid@lrde.epita.fr
Index: configure.ac --- configure.ac Fri, 09 Apr 2004 18:30:54 +0200 thivol_d (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.1 600) +++ configure.ac Fri, 09 Apr 2004 19:14:02 +0200 thivol_d (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.2 600) @@ -416,7 +416,7 @@ AC_ARG_VAR([RUBY_CPPFLAGS], [Path to ruby.h]) AC_ARG_WITH([ruby-includedir], [Include path for ruby.h], [RUBY_CPPFLAGS="-I$withval"], - [RUBY_CPPFLAGS="-I/usr/lib/ruby/1.6/i386-linux"]) + [RUBY_CPPFLAGS="-I/usr/lib/ruby/1.6/i386-linux -I/usr/lib/ruby/1.7/i386-linux -I/usr/lib/ruby/1.8/i386-linux"])
CPPFLAGS="$CPPFLAGS $RUBY_CPPFLAGS" AC_CHECK_HEADERS([ruby.h],, Index: olena/oln/core/point2d.hh --- olena/oln/core/point2d.hh Mon, 29 Mar 2004 09:26:50 +0200 odou_s (oln/c/30_point2d.hh 1.14 600) +++ olena/oln/core/point2d.hh Sun, 11 Apr 2004 19:09:24 +0200 thivol_d (oln/c/30_point2d.hh 1.15 600) @@ -29,7 +29,7 @@ # define OLENA_CORE_POINT2D_HH
# include <oln/core/coord.hh> -# include <oln/core/abstract/point.hh> +# include <oln/core/point1d.hh> # include <iostream> namespace oln {
Index: olena/oln/core/point2d.hxx --- olena/oln/core/point2d.hxx Mon, 29 Mar 2004 09:26:50 +0200 odou_s (oln/c/29_point2d.hx 1.7 600) +++ olena/oln/core/point2d.hxx Sun, 11 Apr 2004 19:16:23 +0200 thivol_d (oln/c/29_point2d.hx 1.8 600) @@ -28,6 +28,7 @@ #ifndef OLENA_CORE_POINT2D_HXX # define OLENA_CORE_POINT2D_HXX
+# include <oln/core/point1d.hh> # include <oln/core/dpoint2d.hh> # include <iostream>
Index: olena/oln/core/point3d.hh --- olena/oln/core/point3d.hh Mon, 29 Mar 2004 09:26:50 +0200 odou_s (oln/c/28_point3d.hh 1.16 600) +++ olena/oln/core/point3d.hh Sun, 11 Apr 2004 19:09:05 +0200 thivol_d (oln/c/28_point3d.hh 1.17 600) @@ -30,7 +30,7 @@
# include <ntg/core/predecls.hh> # include <oln/core/coord.hh> -# include <oln/core/abstract/point.hh> +# include <oln/core/point2d.hh> # include <iostream>
Index: olena/oln/core/point3d.hxx --- olena/oln/core/point3d.hxx Mon, 29 Mar 2004 09:26:50 +0200 odou_s (oln/c/27_point3d.hx 1.6 600) +++ olena/oln/core/point3d.hxx Sun, 11 Apr 2004 19:16:31 +0200 thivol_d (oln/c/27_point3d.hx 1.7 600) @@ -28,6 +28,7 @@ #ifndef OLENA_CORE_POINT3D_HXX # define OLENA_CORE_POINT3D_HXX
+# include <oln/core/point2d.hh> # include <oln/core/dpoint3d.hh> # include <iostream>
Index: tools/swilena/expand.sh --- tools/swilena/expand.sh Mon, 10 Nov 2003 14:09:27 +0100 burrus_n (oln/s/25_expand.sh 1.12 700) +++ tools/swilena/expand.sh Sun, 11 Apr 2004 17:54:54 +0200 thivol_d (oln/s/25_expand.sh 1.13 700) @@ -45,8 +45,12 @@ make_image(image${dim}d_float, $dim, ntg_float, ntg_float_value) EOF
+ TYPES="ntg_bin ntg_int_u8 ntg_int_u32 ntg_int_s8 ntg_int_s32 ntg_float" + ## Morpho algorithms - MODULES="$MODULES morpho${dim}d" + for types in $TYPES; do + MODULES="$MODULES morpho${dim}d_${types}" + done $SWILENA/generate_morpho_instantiations.py $SWILENA/src
## Arith @@ -114,7 +118,7 @@ sdir=meta fi echo "swilena_${mod}_wrap.cxx swilena_${mod}.py: $(srcdir)/../$sdir/swilena_${mod}.i" - echo -e "\t$(SWIG) -c -c++ -python -I$(srcdir)/../src -I$(srcdir)/../meta $(CPPFLAGS) -o swilena_${mod}_wrap.cxx $(srcdir)/../$sdir/swilena_${mod}.i" + echo -e "\t$(SWIG) -noruntime -c++ -python -I$(srcdir)/../src -I$(srcdir)/../meta $(CPPFLAGS) -o swilena_${mod}_wrap.cxx $(srcdir)/../$sdir/swilena_${mod}.i" echo done } Index: tools/swilena/meta/swilena_ntg.i --- tools/swilena/meta/swilena_ntg.i Mon, 10 Nov 2003 11:19:49 +0100 burrus_n (oln/s/33_swilena_nt 1.7 600) +++ tools/swilena/meta/swilena_ntg.i Sun, 11 Apr 2004 19:10:54 +0200 thivol_d (oln/s/33_swilena_nt 1.8 600) @@ -157,7 +157,7 @@ }; %enddef
-%define decl_complex() +%define decl_complex(do_nothing) template<typename repr, typename T> class cplx { @@ -185,7 +185,8 @@ }; %enddef
-%define decl_ntg() +// Swig preprocessor does not understand empty call to macros. +%define decl_ntg(do_nothing) %include <ntg/vect/cplx_representation.hh> %include <ntg/core/predecls.hh> %{ @@ -201,12 +202,12 @@ decl_scalar_class(ntg, int_s, long) decl_bin_class(ntg, bin, bool)
- decl_complex() + decl_complex(do_nothing)
} %enddef
-decl_ntg() +decl_ntg(do_nothing)
/* Macro are defined for every type and should be used in all modules Index: tools/swilena/meta/swilena_morpho.i --- tools/swilena/meta/swilena_morpho.i Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/34_swilena_mo 1.2 600) +++ tools/swilena/meta/swilena_morpho.i Sun, 11 Apr 2004 16:03:09 +0200 thivol_d (oln/s/34_swilena_mo 1.3 600) @@ -182,7 +182,7 @@ Declare generic functions for classical algorithms */
-%define decl_classical_family() +%define decl_classical_family(do_nothing) decl_morpho_2(<oln/morpho/erosion.hh>, erosion, 1) decl_morpho_2(<oln/morpho/dilation.hh>, dilation, 1) decl_morpho_2(<oln/morpho/opening.hh>, opening, 1) @@ -237,7 +237,7 @@ | Extrema killer family | `----------------------*/
-%define decl_extrema_killer_family() +%define decl_extrema_killer_family(do_nothing) decl_morpho_extrema_killer(<oln/morpho/extrema_killer.hh>, sure_maxima_killer) decl_morpho_extrema_killer(<oln/morpho/extrema_killer.hh>, @@ -252,12 +252,12 @@ | Watershed family | `-----------------*/
-%define decl_watershed_family() +%define decl_watershed_family(do_nothing) decl_morpho_watershed(watershed_seg) decl_morpho_watershed(watershed_con) decl_morpho_3(<oln/morpho/watershed.hh>, watershed_seg_or, 0) %enddef
-decl_classical_family() -decl_watershed_family() -decl_extrema_killer_family() +decl_classical_family(do_nothing) +decl_watershed_family(do_nothing) +decl_extrema_killer_family(do_nothing) Index: tools/swilena/meta/swilena_exception.i --- tools/swilena/meta/swilena_exception.i Sun, 21 Sep 2003 21:59:21 +0200 burrus_n (oln/s/37_swilena_ex 1.2 600) +++ tools/swilena/meta/swilena_exception.i Sun, 11 Apr 2004 15:38:57 +0200 thivol_d (oln/s/37_swilena_ex 1.3 600) @@ -9,7 +9,7 @@ // Olena uses classes that derive from std::exception. Declare it. namespace std { class exception { public: const char *what() const; }; }
-%define START_PROTECT() +%define START_PROTECT(do_nothing) %exception { try { $action @@ -26,8 +26,8 @@ } %enddef
-%define END_PROTECT() +%define END_PROTECT(do_nothing) %exception; %enddef
-START_PROTECT() +START_PROTECT(do_nothing) Index: tools/swilena/generate_morpho_instantiations.py --- tools/swilena/generate_morpho_instantiations.py Mon, 10 Nov 2003 14:09:27 +0100 burrus_n (oln/v/24_generate_m 1.4 700) +++ tools/swilena/generate_morpho_instantiations.py Sun, 11 Apr 2004 17:47:33 +0200 thivol_d (oln/v/24_generate_m 1.5 700) @@ -3,6 +3,10 @@ import sys
files = [] +dict_type_num = {1: "ntg_bin", 2: "ntg_int_u8", 3: "ntg_int_u32", + 4: "ntg_int_s8", 5: "ntg_int_s32", 6: "ntg_float"} +dict_num_type = {"ntg_bin": 1, "ntg_int_u8": 2, "ntg_int_u32": 3, + "ntg_int_s8": 4, "ntg_int_s32": 5, "ntg_float": 6}
def close_files(): for file in files: @@ -10,14 +14,18 @@
def open_files(path): for dim in range(1, 4): - files.append(open(path + "/swilena_morpho%(dim)sd.i" % vars(), 'w')) + for type in range(1, 7): + str_type = dict_type_num[type] + files.append(open(path + "/swilena_morpho%(dim)sd_%(str_type)s.i" % vars(), 'w'))
def write_headers(): for dim in range(1, 4): - file = files[dim - 1] + for type in range(1, 7): + str_type = dict_type_num[type] + file = files[(dim - 1)* 6 + type - 1] file.write("""// Note: this file was generated by generate_morpho.py.
-%%module swilena_morpho%(dim)sd +%%module swilena_morpho%(dim)sd_%(str_type)s
%%include swilena_exception.i
@@ -30,8 +38,8 @@
""" % vars())
-def instantiate(dim, algorithm, *args): - file = files[dim - 1] +def instantiate(idx, algorithm, *args): + file = files[idx - 1] swilena_algorithm = "my_" + algorithm params = args[0] for param in args[1:]: @@ -51,77 +59,80 @@ win_type = "::oln::window%(dim)sd" % vars() neighb_type = "::oln::neighborhood%(dim)sd" % vars()
+ idx = (dim - 1) * 6 + dict_num_type[type] + + print idx # FIXME: these algorithms do not work with floats if type != "ntg_float": - instantiate(dim, "erosion", img_type, img_type, win_type) - instantiate(dim, "fast_erosion", img_type, img_type, win_type) + instantiate(idx, "erosion", img_type, img_type, win_type) + instantiate(idx, "fast_erosion", img_type, img_type, win_type) - instantiate(dim, "dilation", img_type, img_type, win_type) - instantiate(dim, "fast_dilation", img_type, img_type, win_type) + instantiate(idx, "dilation", img_type, img_type, win_type) + instantiate(idx, "fast_dilation", img_type, img_type, win_type)
- instantiate(dim, "opening", img_type, img_type, win_type) - instantiate(dim, "fast_opening", img_type, img_type, win_type) + instantiate(idx, "opening", img_type, img_type, win_type) + instantiate(idx, "fast_opening", img_type, img_type, win_type)
- instantiate(dim, "closing", img_type, img_type, win_type) - instantiate(dim, "fast_closing", img_type, img_type, win_type) + instantiate(idx, "closing", img_type, img_type, win_type) + instantiate(idx, "fast_closing", img_type, img_type, win_type) - instantiate(dim, "thickening", img_type, img_type, win_type, win_type) - instantiate(dim, "fast_thickening", img_type, img_type, win_type, win_type) + instantiate(idx, "thickening", img_type, img_type, win_type, win_type) + instantiate(idx, "fast_thickening", img_type, img_type, win_type, win_type) - instantiate(dim, "thinning", img_type, img_type, win_type, win_type) - instantiate(dim, "fast_thinning", img_type, img_type, win_type, win_type) + instantiate(idx, "thinning", img_type, img_type, win_type, win_type) + instantiate(idx, "fast_thinning", img_type, img_type, win_type, win_type)
- instantiate(dim, "geodesic_erosion", img_type, img_type, img_type, neighb_type) - instantiate(dim, "sure_geodesic_erosion", img_type, img_type, img_type, neighb_type) + instantiate(idx, "geodesic_erosion", img_type, img_type, img_type, neighb_type) + instantiate(idx, "sure_geodesic_erosion", img_type, img_type, img_type, neighb_type)
- instantiate(dim, "geodesic_dilation", img_type, img_type, img_type, neighb_type) - instantiate(dim, "sure_geodesic_dilation", img_type, img_type, img_type, neighb_type) + instantiate(idx, "geodesic_dilation", img_type, img_type, img_type, neighb_type) + instantiate(idx, "sure_geodesic_dilation", img_type, img_type, img_type, neighb_type) - instantiate(dim, "sure_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type) - instantiate(dim, "sequential_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type) - instantiate(dim, "hybrid_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type) + instantiate(idx, "sure_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type) + instantiate(idx, "sequential_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type) + instantiate(idx, "hybrid_geodesic_reconstruction_dilation", img_type, img_type, img_type, neighb_type) - instantiate(dim, "sure_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type) - instantiate(dim, "sequential_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type) - instantiate(dim, "hybrid_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type) + instantiate(idx, "sure_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type) + instantiate(idx, "sequential_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type) + instantiate(idx, "hybrid_geodesic_reconstruction_erosion", img_type, img_type, img_type, neighb_type)
- instantiate(dim, "hit_or_miss", img_type, img_type, win_type, win_type) - instantiate(dim, "fast_hit_or_miss", img_type, img_type, win_type, win_type) + instantiate(idx, "hit_or_miss", img_type, img_type, win_type, win_type) + instantiate(idx, "fast_hit_or_miss", img_type, img_type, win_type, win_type)
- instantiate(dim, "hit_or_miss_opening", img_type, img_type, win_type, win_type) - instantiate(dim, "fast_hit_or_miss_opening", img_type, img_type, win_type, win_type) + instantiate(idx, "hit_or_miss_opening", img_type, img_type, win_type, win_type) + instantiate(idx, "fast_hit_or_miss_opening", img_type, img_type, win_type, win_type)
- instantiate(dim, "hit_or_miss_opening_bg", img_type, img_type, win_type, win_type) - instantiate(dim, "fast_hit_or_miss_opening_bg", img_type, img_type, win_type, win_type) + instantiate(idx, "hit_or_miss_opening_bg", img_type, img_type, win_type, win_type) + instantiate(idx, "fast_hit_or_miss_opening_bg", img_type, img_type, win_type, win_type)
- instantiate(dim, "hit_or_miss_closing", img_type, img_type, win_type, win_type) - instantiate(dim, "fast_hit_or_miss_closing", img_type, img_type, win_type, win_type) + instantiate(idx, "hit_or_miss_closing", img_type, img_type, win_type, win_type) + instantiate(idx, "fast_hit_or_miss_closing", img_type, img_type, win_type, win_type)
- instantiate(dim, "hit_or_miss_closing_bg", img_type, img_type, win_type, win_type) - instantiate(dim, "fast_hit_or_miss_closing_bg", img_type, img_type, win_type, win_type) + instantiate(idx, "hit_or_miss_closing_bg", img_type, img_type, win_type, win_type) + instantiate(idx, "fast_hit_or_miss_closing_bg", img_type, img_type, win_type, win_type)
# FIXME: these algorithms do not work with float neither binary types if type != "ntg_bin": - instantiate(dim, "beucher_gradient", img_type, img_type, win_type) - instantiate(dim, "fast_beucher_gradient", img_type, img_type, win_type) + instantiate(idx, "beucher_gradient", img_type, img_type, win_type) + instantiate(idx, "fast_beucher_gradient", img_type, img_type, win_type)
- instantiate(dim, "internal_gradient", img_type, img_type, win_type) - instantiate(dim, "fast_internal_gradient", img_type, img_type, win_type) + instantiate(idx, "internal_gradient", img_type, img_type, win_type) + instantiate(idx, "fast_internal_gradient", img_type, img_type, win_type)
- instantiate(dim, "external_gradient", img_type, img_type, win_type) - instantiate(dim, "fast_external_gradient", img_type, img_type, win_type) + instantiate(idx, "external_gradient", img_type, img_type, win_type) + instantiate(idx, "fast_external_gradient", img_type, img_type, win_type)
- instantiate(dim, "white_top_hat", img_type, img_type, win_type) - instantiate(dim, "fast_white_top_hat", img_type, img_type, win_type) + instantiate(idx, "white_top_hat", img_type, img_type, win_type) + instantiate(idx, "fast_white_top_hat", img_type, img_type, win_type)
- instantiate(dim, "black_top_hat", img_type, img_type, win_type) - instantiate(dim, "fast_black_top_hat", img_type, img_type, win_type) + instantiate(idx, "black_top_hat", img_type, img_type, win_type) + instantiate(idx, "fast_black_top_hat", img_type, img_type, win_type)
- instantiate(dim, "self_complementary_top_hat", img_type, img_type, win_type) - instantiate(dim, "fast_self_complementary_top_hat", img_type, img_type, win_type) + instantiate(idx, "self_complementary_top_hat", img_type, img_type, win_type) + instantiate(idx, "fast_self_complementary_top_hat", img_type, img_type, win_type)
- instantiate(dim, "top_hat_contrast_op", img_type, img_type, win_type) - instantiate(dim, "fast_top_hat_contrast_op", img_type, img_type, win_type) + instantiate(idx, "top_hat_contrast_op", img_type, img_type, win_type) + instantiate(idx, "fast_top_hat_contrast_op", img_type, img_type, win_type)
# FIXME: fix this when available #if type == "ntg_int_u8":
"Damien" == Damien Thivolle damien@lrde.epita.fr writes:
@@ -416,7 +416,7 @@ AC_ARG_VAR([RUBY_CPPFLAGS], [Path to ruby.h]) AC_ARG_WITH([ruby-includedir], [Include path for ruby.h], [RUBY_CPPFLAGS="-I$withval"],
[RUBY_CPPFLAGS="-I/usr/lib/ruby/1.6/i386-linux"])
[RUBY_CPPFLAGS="-I/usr/lib/ruby/1.6/i386-linux -I/usr/lib/ruby/1.7/i386-linux -I/usr/lib/ruby/1.8/i386-linux"])
C'est pas bon, c'est la fuite en avant !
La bonne approche c'est plutôt de chercher si on peut demander à ruby son rép d'install, comme pour Python.
Ou de chercher dans tous ces répertoires, mais en n'en gardant qu'un seul. Je suis d'ailleurs surpris qu'il n'existe rien pour Ruby...
Google trouve de l'inspiration par là
http://mailman.cs.uchicago.edu/pipermail/swig/2003-January/006632.html
Regarder en particulier des choses comme
# Includes AC_MSG_CHECKING(for ruby includes) [ruby_includes=-I`ruby -e "puts $:.join(' -I')"`] AC_MSG_RESULT($ruby_includes)
~/src/oln % ruby -e "puts $:.join(' -I')" nostromo Err 1 /usr/local/lib/site_ruby/1.8 -I/usr/local/lib/site_ruby/1.8/i386-linux -I/usr/local/lib/site_ruby -I/usr/lib/ruby/1.8 -I/usr/lib/ruby/1.8/i386-linux -I.
Akim Demaille akim@epita.fr writes:
"Damien" == Damien Thivolle damien@lrde.epita.fr writes:
@@ -416,7 +416,7 @@ AC_ARG_VAR([RUBY_CPPFLAGS], [Path to ruby.h]) AC_ARG_WITH([ruby-includedir], [Include path for ruby.h], [RUBY_CPPFLAGS="-I$withval"],
[RUBY_CPPFLAGS="-I/usr/lib/ruby/1.6/i386-linux"])
[RUBY_CPPFLAGS="-I/usr/lib/ruby/1.6/i386-linux -I/usr/lib/ruby/1.7/i386-linux -I/usr/lib/ruby/1.8/i386-linux"])
C'est pas bon, c'est la fuite en avant !
La bonne approche c'est plutôt de chercher si on peut demander à ruby son rép d'install, comme pour Python.
Ou de chercher dans tous ces répertoires, mais en n'en gardant qu'un seul. Je suis d'ailleurs surpris qu'il n'existe rien pour Ruby...
Google trouve de l'inspiration par là
http://mailman.cs.uchicago.edu/pipermail/swig/2003-January/006632.html
Regarder en particulier des choses comme
# Includes AC_MSG_CHECKING(for ruby includes) [ruby_includes=-I`ruby -e "puts $:.join(' -I')"`] AC_MSG_RESULT($ruby_includes)
~/src/oln % ruby -e "puts $:.join(' -I')" nostromo Err 1 /usr/local/lib/site_ruby/1.8 -I/usr/local/lib/site_ruby/1.8/i386-linux -I/usr/local/lib/site_ruby -I/usr/lib/ruby/1.8 -I/usr/lib/ruby/1.8/i386-linux -I.
Ca a été corrigé.
Ca a été corrigé avant la release, maintenant, on fait comme cela RUBY_CPPFLAGS="-I`ruby -e 'puts $:.join("\n")'| while read line; do if [[ -f ${line}/ruby.h ]]; then echo $line fi done`"
"Damien" == Damien Thivolle damien@lrde.epita.fr writes:
Ca a été corrigé avant la release, maintenant, on fait comme cela RUBY_CPPFLAGS="-I`ruby -e 'puts $:.join("\n")'| while read line; do if [[ -f ${line}/ruby.h ]]; then echo $line fi done`"
J'ai pas vu passer cette modification. OK :)