From e5b6a8e72f693a4b533af6fc7c04599e8b99b981 Mon Sep 17 00:00:00 2001
From: William S Fulton
@@ -331,7 +332,7 @@ the contents of the %{ ... %} block are copied without modification to the output (including all preprocessor directives).
-
@@ -373,7 +374,78 @@ to actually go into the wrapper file, prefix the preprocessor directives with
+Typemaps support a special attribute where the { ... } delimiters can be used, +but the delimiters are not actually generated into the code. +The effect is then similar to using "" or %{ %} delimiters but the code is run through the preprocessor. For example: +
+ +
+#define SWIG_macro(CAST) (CAST)$input
+%typemap(in) Int {$1= SWIG_macro(int);}
+
++might generate +
+ +
+ {
+ arg1=(int)jarg1;
+ }
+
++whereas +
+ +
+#define SWIG_macro(CAST) (CAST)$input
+%typemap(in,noblock=1) Int {$1= SWIG_macro(int);}
+
++might generate +
+ ++ arg1=(int)jarg1; ++
+and +
+ +
+#define SWIG_macro(CAST) (CAST)$input
+%typemap(in) Int %{$1=SWIG_macro(int);%}
+
++would generate +
+ ++ arg1=SWIG_macro(int); ++
@@ -383,7 +455,7 @@ Instead the results after the preprocessor has run are displayed. This might be useful as an aid to debugging and viewing the results of macro expansions.
-diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html index b5bf6c849..f57783671 100644 --- a/Doc/Manual/Typemaps.html +++ b/Doc/Manual/Typemaps.html @@ -714,7 +714,8 @@ code : { ... }
-Note that the preprocessor will expand code within the {} delimiters, but not in the last two styles of delimiters. +Note that the preprocessor will expand code within the {} delimiters, but not in the last two styles of delimiters, +see Preprocessor and Typemaps. Here are some examples of valid typemap specifications: