From c1dad55c5c5b6758996a3f79b30fd0e6e4c112c3 Mon Sep 17 00:00:00 2001
From: William S Fulton
@@ -2560,7 +2561,37 @@ rather than blindly passing values to the underlying C/C++ program.
+The code within typemaps is usually language dependent, +however, many languages support the same typemaps. +In order to distinguish typemaps across different languages, the preprocessor should be used. +For example, the "in" typemap for Perl and Ruby could be written as: +
+ ++#if defined(SWIGPERL) + %typemap(in) int "$1 = NUM2INT($input);" +#elif defined(SWIGRUBY) + %typemap(in) int "$1 = ($1_ltype) SvIV($input);" +#else + #warning no "in" typemap defined +#endif +
+The full set of language specific macros is defined in the Conditional Compilation section. +The example above also shows a common approach of issuing a warning for an as yet unsupported language. +
+ +
+Compatibility note: In SWIG-1.1 different languages could be distinguished with the language name being put within the %typemap directive, for example,
+%typemap(ruby,in) int "$1 = NUM2INT($input);".
+
@@ -2825,7 +2856,7 @@ when crossing languages you may need to worry about issues such as row-major vs. ordering (and perform conversions if needed).
-@@ -2851,7 +2882,7 @@ language modules.
@@ -3037,7 +3068,7 @@ structures rather than creating new ones. These swig_module_info structures are chained together in a circularly linked list.
-This section covers how to use these functions from typemaps. To learn how to @@ -3131,7 +3162,7 @@ probably just look at the output of SWIG to get a better sense for how types are managed.
-@@ -3440,7 +3471,7 @@ Subsequent "in" typemaps would then perform more extensive type-checking. -
@@ -3525,7 +3556,7 @@ example: -
@@ -3606,7 +3637,7 @@ convert_float_array(PyObject *input, int size) { -
@@ -3643,7 +3674,7 @@ sure that the typemaps sharing information have exactly the same types and names
-