Typemap updates since they were branched from Java
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4523 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
af98737169
commit
a48f45179e
1 changed files with 15 additions and 22 deletions
|
|
@ -4,23 +4,8 @@
|
||||||
* CSharp typemaps
|
* CSharp typemaps
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
//%include "stl.i"
|
|
||||||
|
|
||||||
//Initial revision of this module - everything is liable to change!!
|
//Initial revision of this module - everything is liable to change!!
|
||||||
%insert(runtime) %{
|
%include "csharphead.swg"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define DllExport __declspec( dllexport )
|
|
||||||
#else
|
|
||||||
/*
|
|
||||||
This is not needed for unix
|
|
||||||
*/
|
|
||||||
#define DllExport
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
|
|
||||||
/* The jni, jtype and jstype typemaps work together and so there should be one of each.
|
/* The jni, jtype and jstype typemaps work together and so there should be one of each.
|
||||||
* The jni typemap contains the JNI type used in the JNI (C/C++) code.
|
* The jni typemap contains the JNI type used in the JNI (C/C++) code.
|
||||||
|
|
@ -173,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. */
|
/* 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 */
|
/* primitive types */
|
||||||
%typemap(in) bool,
|
%typemap(in) bool
|
||||||
char,
|
%{ $1 = $input ? true : false; %}
|
||||||
|
|
||||||
|
%typemap(in) char,
|
||||||
signed char,
|
signed char,
|
||||||
unsigned char,
|
unsigned char,
|
||||||
short,
|
short,
|
||||||
|
|
@ -267,8 +254,11 @@
|
||||||
%typemap(out) void ""
|
%typemap(out) void ""
|
||||||
|
|
||||||
/* primitive types by reference */
|
/* primitive types by reference */
|
||||||
%typemap(in) const bool & (bool temp),
|
%typemap(in) const bool & (bool temp)
|
||||||
const char & (char temp),
|
%{ temp = $input ? true : false;
|
||||||
|
$1 = &temp; %}
|
||||||
|
|
||||||
|
%typemap(in) const char & (char temp),
|
||||||
const signed char & (signed char temp),
|
const signed char & (signed char temp),
|
||||||
const unsigned char & (unsigned char temp),
|
const unsigned char & (unsigned char temp),
|
||||||
const short & (short temp),
|
const short & (short temp),
|
||||||
|
|
@ -352,11 +342,14 @@ $1 = &temp; %}
|
||||||
/* Default handling. Object passed by value. Convert to a pointer */
|
/* Default handling. Object passed by value. Convert to a pointer */
|
||||||
%typemap(in) SWIGTYPE ($&1_type argp)
|
%typemap(in) SWIGTYPE ($&1_type argp)
|
||||||
%{ argp = *($&1_ltype*)&$input;
|
%{ argp = *($&1_ltype*)&$input;
|
||||||
|
if (!argp) {
|
||||||
|
// SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
|
||||||
|
return $null;
|
||||||
|
}
|
||||||
$1 = *argp; %}
|
$1 = *argp; %}
|
||||||
%typemap(out) SWIGTYPE
|
%typemap(out) SWIGTYPE
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
%{$&1_ltype $1ptr = new $1_ltype(($1_ltype &)$1);
|
%{*($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %}
|
||||||
*($&1_ltype*)&$result = $1ptr; %}
|
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue