From 8536ff033385cb90021c234a06d5f9c78de5d696 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 11 Feb 2003 22:41:10 +0000 Subject: [PATCH] bool typemap mods for Visual C++ git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4300 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/java/java.swg | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Lib/java/java.swg b/Lib/java/java.swg index 74ed4a72a..91181a77e 100644 --- a/Lib/java/java.swg +++ b/Lib/java/java.swg @@ -158,8 +158,10 @@ /* The following are the in, out, freearg, argout typemaps. These are the JNI code generating typemaps for converting from Java to C and visa versa. */ /* primitive types */ -%typemap(in) bool, - char, +%typemap(in) bool +%{ $1 = $input ? true : false; %} + +%typemap(in) char, signed char, unsigned char, short, @@ -256,8 +258,11 @@ %typemap(out) void "" /* primitive types by reference */ -%typemap(in) const bool & (bool temp), - const char & (char temp), +%typemap(in) const bool & (bool temp) +%{ temp = $input ? true : false; + $1 = &temp; %} + +%typemap(in) const char & (char temp), const signed char & (signed char temp), const unsigned char & (unsigned char temp), const short & (short temp), @@ -270,7 +275,7 @@ const float & (float temp), const double & (double temp) %{ temp = ($*1_ltype)$input; -$1 = &temp; %} + $1 = &temp; %} %typemap(out) const bool & %{ $result = (jboolean)*$1; %} %typemap(out) const char & %{ $result = (jchar)*$1; %}