From 4be26aa11d967501c8a5f6de65555c46d7fab387 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 18 Aug 2009 14:02:22 +0000 Subject: [PATCH] Clear up confusion that typemaps can contain C/C++ as well as target language code git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11634 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Sections.html | 2 +- Doc/Manual/Typemaps.html | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html index 789efc129..e39633e38 100644 --- a/Doc/Manual/Sections.html +++ b/Doc/Manual/Sections.html @@ -6,7 +6,7 @@

SWIG-1.3 Development Documentation

-Last update : SWIG-1.3.40 (in progress) +Last update : SWIG-1.3.40 (18 August 2009)

Sections

diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html index 226b4ef3e..bf31b30b9 100644 --- a/Doc/Manual/Typemaps.html +++ b/Doc/Manual/Typemaps.html @@ -230,14 +230,17 @@ At first glance, this code will look a little confusing. However, there is really not much to it. The first typemap (the "in" typemap) is used to convert a value from the target language to C. The second typemap (the "out" typemap) is used to convert in the other -direction. The content of each typemap is a small fragment of C code -that is inserted directly into the SWIG generated wrapper functions. Within -this code, a number of special variables prefixed with a $ are expanded. These are -really just placeholders for C variables that are generated in the course +direction. The content of each typemap is a small fragment of code +that is inserted directly into the SWIG generated wrapper functions. +The code is usually C or C++ code which will be generated into the C/C++ wrapper functions. +Note that this isn't always the case as some target language modules allow target language +code within the typemaps which gets generated into target language specific files. +Within this code, a number of special variables prefixed with a $ are expanded. These are +really just placeholders for C/C++ variables that are generated in the course of creating the wrapper function. In this case, $input refers to an -input object that needs to be converted to C and $result +input object that needs to be converted to C/C++ and $result refers to an object that is going to be returned by a wrapper -function. $1 refers to a C variable that has the same type as +function. $1 refers to a C/C++ variable that has the same type as specified in the typemap declaration (an int in this example).

@@ -4060,6 +4063,7 @@ numerous examples. You should look at these files to get a feel for how to define typemaps of your own. Some of the language modules support additional typemaps and further information is available in the individual chapters for each target language. +There you may also find more hands-on practical examples.