I haven't checked whether this bug has been fixed in SWIG's
Subversion repository yet (but it wasn't present in SWIG 1.3.28).
2006-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Work around a bug in SWIG 1.3.29.
* generate_arith_instantiations.py (write_algorithms)
* generate_morpho_instantiations.py (write_algorithms): Work
around a bug in SWIG 1.3.29 in the generation of C++ wrappers.
Index: 10.229/tools/swilena/generate_morpho_instantiations.py
--- 10.229/tools/swilena/generate_morpho_instantiations.py Fri, 30 Jun 2006 17:26:15 +0200
levill_r (oln/v/24_generate_m 1.8.1.1 700)
+++ 10.229(w)/tools/swilena/generate_morpho_instantiations.py Mon, 03 Jul 2006 12:23:42
+0200 levill_r (oln/v/24_generate_m 1.8.1.1 700)
@@ -57,7 +57,13 @@
"ntg_int_u8", "ntg_int_u32",
"ntg_int_s8", "ntg_int_s32",
"ntg_float" ]:
- img_type = "::oln::image%(dim)sd< %(type)s >" % vars()
+ # FIXME: SWIG 1.3.29 Bug. We used to refer to `oln::image' from
+ # the global (top-level) namespace, i.e. `::oln::image',
+ # but it makes swig 1.3.29 generate invalid C++ code when
+ # used ad a template argument: the space between `<' and
+ # `::' is eaten by swig, and `<:' is understood as a
+ # trigraph (for `[') by the C++ compiler.
+ img_type = "oln::image%(dim)sd< %(type)s >" % vars()
win_type = "::oln::window%(dim)sd" % vars()
neighb_type = "::oln::neighborhood%(dim)sd" % vars()
@@ -135,10 +141,12 @@
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)
# Watershed
- img_ret_type = "::oln::image%(dim)sd< ntg_int_u32 >"
% vars()
+ # FIXME: SWIG 1.3.29 Bug (same as above).
+ img_ret_type = "oln::image%(dim)sd< ntg_int_u32 >" %
vars()
instantiate(idx, "watershed_seg", img_ret_type, img_type,
neighb_type)
instantiate(idx, "watershed_con", img_ret_type, img_type,
neighb_type)
- bin_img_type = "::oln::image%(dim)sd< ntg_bin >" %
vars()
+ # FIXME: SWIG 1.3.29 Bug (same as above).
+ bin_img_type = "oln::image%(dim)sd< ntg_bin >" %
vars()
instantiate(idx, "sure_minima_imposition", img_type,
img_type, bin_img_type, neighb_type)
instantiate(idx, "sequential_minima_imposition", img_type,
img_type, bin_img_type, neighb_type)
instantiate(idx, "hybrid_minima_imposition", img_type,
img_type, bin_img_type, neighb_type)
Index: 10.229/tools/swilena/generate_arith_instantiations.py
--- 10.229/tools/swilena/generate_arith_instantiations.py Fri, 30 Jun 2006 17:26:15 +0200
levill_r (oln/v/51_generate_a 1.1.1.1 700)
+++ 10.229(w)/tools/swilena/generate_arith_instantiations.py Mon, 03 Jul 2006 11:44:33
+0200 levill_r (oln/v/51_generate_a 1.1.1.1 700)
@@ -59,13 +59,19 @@
"ntg_int_u8", "ntg_int_u32",
"ntg_int_s8", "ntg_int_s32",
"ntg_float" ]:
- img_type = "::oln::image%(dim)sd< %(type)s >" % vars()
+ # FIXME: SWIG 1.3.29 Bug. We used to refer to `oln::image' from
+ # the global (top-level) namespace, i.e. `::oln::image',
+ # but it makes swig 1.3.29 generate invalid C++ code when
+ # used ad a template argument: the space between `<' and
+ # `::' is eaten by swig, and `<:' is understood as a
+ # trigraph (for `[') by the C++ compiler.
+ img_type = "oln::image%(dim)sd< %(type)s >" % vars()
bigger_type = get_bigger_type(type)
- return_img_type = "::oln::image%(dim)sd< %(bigger_type)s >" %
vars()
+ return_img_type = "oln::image%(dim)sd< %(bigger_type)s >" % vars()
# FIXME: these algorithms do not work with bin
if type != "ntg_bin":
- for algo in [ "plus", "minus", "times", "div"
]:
+ for algo in [ "plus", "minus", "times", "div"
]:
instantiate(dim, algo, return_img_type, img_type, img_type)
instantiate(dim, "min", return_img_type, img_type, img_type)