A number of the C# features, pragmas and typemaps have had their names changed.

They no longer have java or jni in their names. CHANGES file has complete list.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4890 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-06-11 19:52:27 +00:00
commit 3c2f9d8057
4 changed files with 338 additions and 350 deletions

View file

@ -1,6 +1,48 @@
Version 1.3.20 (In progress) Version 1.3.20 (In progress)
============================ ============================
06/10/2003: cheetah (William Fulton)
[C#] A number of changes have been made to remove the Java naming
that was used in the C# module.
Typemap name changes:
jni -> ctype
jtype -> cstype
jstype -> cswtype
javain -> csin
javaout -> csout
javainterfaces -> csinterfaces
javabase -> csbase
javaclassmodifiers -> csclassmodifiers
javacode -> cscode
javaimports -> csimports
javaptrconstructormodifiers -> csptrconstructormodifiers
javagetcptr -> csgetcptr
javafinalize -> csfinalize
Feature name changes:
javaconst -> csconst
javamethodmodifiers -> csmethodmodifiers
Pragma changes:
pragma(java) -> pragma(csharp)
jniclassbase -> imclassbase
jniclassclassmodifiers -> imclassclassmodifiers
jniclasscode -> imclasscode
jniclassimports -> imclassimports
jniclassinterfaces -> imclassinterfaces
Special variable name changes:
$javaclassname -> $csclassname
$javainput -> $csinput
$jnicall -> $imcall
This will break SWIG interface files that use these typemaps, features
and pragmas. Please update your code or use macros for backwards
compatibility.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
06/10/2003: mkoeppe (Matthias Koeppe) 06/10/2003: mkoeppe (Matthias Koeppe)
[MzScheme] Applied MzScheme module updates contributed by [MzScheme] Applied MzScheme module updates contributed by
John Lenz <jelenz@students.wisc.edu>. John Lenz <jelenz@students.wisc.edu>.
@ -27,20 +69,24 @@ Version 1.3.20 (In progress)
*** NEW FEATURE [MzScheme] *** *** NEW FEATURE [MzScheme] ***
06/10/2003: cheetah (William Fulton) 06/10/2003: cheetah (William Fulton)
[Java] New typemaps: javadestruct_base and javadestruct_derived [Java] New typemaps: javadestruct and javadestruct_derived
for the C++ destructor wrapper. The _base version gets used by for the C++ destructor wrapper. The javadestruct version gets used by
classes at the top of an inheritance chain and the _derived classes at the top of an inheritance chain and the javadestruct_derived
version gets used by other classes. version gets used by other classes.
[C#] cildispose and cildisposeoverride typemaps replaced by [C#] cildispose and cildisposeoverride typemaps replaced by
csdestruct_base and csdestruct_derived typemaps. The delete() csdestruct and csdestruct_derived typemaps. The delete()
method has been removed and its functionality put into these method has been removed and its functionality put into these
typemaps designed for the Dispose() method. typemaps designed for the Dispose() method.
New typemaps csinterfaces_base and csinterfaces_derived replace
- New typemaps csinterfaces and csinterfaces_derived replace
the javainterfaces typemap. Also fixes the peculiarity of all classes the javainterfaces typemap. Also fixes the peculiarity of all classes
in an inheritance chain individually deriving from the IDisposable in an inheritance chain individually deriving from the IDisposable
interface. interface.
New typemap csfinalize for finalizers.
- New typemap csfinalize for finalizers. C++ destructors are now called
by garbage collector during finalization. Problem reported by
Andreas Schörk.
06/10/2003: Tiger 06/10/2003: Tiger
Modified contract code for error message output. Modified contract code for error message output.

View file

@ -4,97 +4,96 @@
* CSharp typemaps * CSharp typemaps
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
//Initial revision of this module - the typemap names will change, in fact anything could change!!
%include "csharphead.swg" %include "csharphead.swg"
/* The jni, jtype and jstype typemaps work together and so there should be one of each. /* The ctype, cstype and cswtype 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 ctype typemap contains the PInvoke type used in the PInvoke (C/C++) code.
* The jtype typemap contains the Java type used in the Java module class. * The cstype typemap contains the C# type used in the PInvoke class.
* The jstype typemap contains the Java type used in the Java proxy class. */ * The cswtype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
/* Primitive types */ /* Primitive types */
%typemap(jni) bool, const bool & "bool" %typemap(ctype) bool, const bool & "bool"
%typemap(jni) char, const char & "char" %typemap(ctype) char, const char & "char"
%typemap(jni) signed char, const signed char & "signed char" %typemap(ctype) signed char, const signed char & "signed char"
%typemap(jni) unsigned char, const unsigned char & "unsigned short" %typemap(ctype) unsigned char, const unsigned char & "unsigned short"
%typemap(jni) short, const short & "short" %typemap(ctype) short, const short & "short"
%typemap(jni) unsigned short, const unsigned short & "unsigned short" %typemap(ctype) unsigned short, const unsigned short & "unsigned short"
%typemap(jni) int, const int & "int" %typemap(ctype) int, const int & "int"
%typemap(jni) unsigned int, const unsigned int & "unsigned int" %typemap(ctype) unsigned int, const unsigned int & "unsigned int"
%typemap(jni) long, const long & "long" %typemap(ctype) long, const long & "long"
%typemap(jni) unsigned long, const unsigned long & "unsigned long" %typemap(ctype) unsigned long, const unsigned long & "unsigned long"
%typemap(jni) long long, const long long & "long long" %typemap(ctype) long long, const long long & "long long"
%typemap(jni) unsigned long long, const unsigned long long & "unsigned long long" %typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
%typemap(jni) float, const float & "float" %typemap(ctype) float, const float & "float"
%typemap(jni) double, const double & "double" %typemap(ctype) double, const double & "double"
%typemap(jni) char * "char *" %typemap(ctype) char * "char *"
%typemap(jni) void "void" %typemap(ctype) void "void"
%typemap(jtype) bool, const bool & "bool" %typemap(cstype) bool, const bool & "bool"
%typemap(jtype) char, const char & "char" %typemap(cstype) char, const char & "char"
%typemap(jtype) signed char, const signed char & "sbyte" %typemap(cstype) signed char, const signed char & "sbyte"
%typemap(jtype) unsigned char, const unsigned char & "byte" %typemap(cstype) unsigned char, const unsigned char & "byte"
%typemap(jtype) short, const short & "short" %typemap(cstype) short, const short & "short"
%typemap(jtype) unsigned short, const unsigned short & "ushort" %typemap(cstype) unsigned short, const unsigned short & "ushort"
%typemap(jtype) int, const int & "int" %typemap(cstype) int, const int & "int"
%typemap(jtype) unsigned int, const unsigned int & "uint" %typemap(cstype) unsigned int, const unsigned int & "uint"
%typemap(jtype) long, const long & "int" %typemap(cstype) long, const long & "int"
%typemap(jtype) unsigned long, const unsigned long & "uint" %typemap(cstype) unsigned long, const unsigned long & "uint"
%typemap(jtype) long long, const long long & "long" %typemap(cstype) long long, const long long & "long"
%typemap(jtype) unsigned long long, const unsigned long long & "ulong" %typemap(cstype) unsigned long long, const unsigned long long & "ulong"
%typemap(jtype) float, const float & "float" %typemap(cstype) float, const float & "float"
%typemap(jtype) double, const double & "double" %typemap(cstype) double, const double & "double"
%typemap(jtype) char * "string" %typemap(cstype) char * "string"
%typemap(jtype) void "void" %typemap(cstype) void "void"
%typemap(jstype) bool, const bool & "bool" %typemap(cswtype) bool, const bool & "bool"
%typemap(jstype) char, const char & "char" %typemap(cswtype) char, const char & "char"
%typemap(jstype) signed char, const signed char & "sbyte" %typemap(cswtype) signed char, const signed char & "sbyte"
%typemap(jstype) unsigned char, const unsigned char & "byte" %typemap(cswtype) unsigned char, const unsigned char & "byte"
%typemap(jstype) short, const short & "short" %typemap(cswtype) short, const short & "short"
%typemap(jstype) unsigned short, const unsigned short & "ushort" %typemap(cswtype) unsigned short, const unsigned short & "ushort"
%typemap(jstype) int, const int & "int" %typemap(cswtype) int, const int & "int"
%typemap(jstype) unsigned int, const unsigned int & "uint" %typemap(cswtype) unsigned int, const unsigned int & "uint"
%typemap(jstype) long, const long & "int" %typemap(cswtype) long, const long & "int"
%typemap(jstype) unsigned long, const unsigned long & "uint" %typemap(cswtype) unsigned long, const unsigned long & "uint"
%typemap(jstype) long long, const long long & "long" %typemap(cswtype) long long, const long long & "long"
%typemap(jstype) unsigned long long, const unsigned long long & "ulong" %typemap(cswtype) unsigned long long, const unsigned long long & "ulong"
%typemap(jstype) float, const float & "float" %typemap(cswtype) float, const float & "float"
%typemap(jstype) double, const double & "double" %typemap(cswtype) double, const double & "double"
%typemap(jstype) char * "string" %typemap(cswtype) char * "string"
%typemap(jstype) void "void" %typemap(cswtype) void "void"
%typemap(jni) char[ANY] "char *" %typemap(ctype) char[ANY] "char *"
%typemap(jtype) char[ANY] "string" %typemap(cstype) char[ANY] "string"
%typemap(jstype) char[ANY] "string" %typemap(cswtype) char[ANY] "string"
/* Non primitive types */ /* Non primitive types */
%typemap(jni) SWIGTYPE "int" %typemap(ctype) SWIGTYPE "int"
%typemap(jtype) SWIGTYPE "IntPtr" %typemap(cstype) SWIGTYPE "IntPtr"
%typemap(jstype) SWIGTYPE "$&javaclassname" %typemap(cswtype) SWIGTYPE "$&csclassname"
%typemap(jni) SWIGTYPE [] "int" %typemap(ctype) SWIGTYPE [] "int"
%typemap(jtype) SWIGTYPE [] "IntPtr" %typemap(cstype) SWIGTYPE [] "IntPtr"
%typemap(jstype) SWIGTYPE [] "$javaclassname" %typemap(cswtype) SWIGTYPE [] "$csclassname"
%typemap(jni) SWIGTYPE * "int" %typemap(ctype) SWIGTYPE * "int"
%typemap(jtype) SWIGTYPE * "IntPtr" %typemap(cstype) SWIGTYPE * "IntPtr"
%typemap(jstype) SWIGTYPE * "$javaclassname" %typemap(cswtype) SWIGTYPE * "$csclassname"
%typemap(jni) SWIGTYPE & "int" %typemap(ctype) SWIGTYPE & "int"
%typemap(jtype) SWIGTYPE & "IntPtr" %typemap(cstype) SWIGTYPE & "IntPtr"
%typemap(jstype) SWIGTYPE & "$javaclassname" %typemap(cswtype) SWIGTYPE & "$csclassname"
%typemap(jni) enum SWIGTYPE "int" %typemap(ctype) enum SWIGTYPE "int"
%typemap(jtype) enum SWIGTYPE "int" %typemap(cstype) enum SWIGTYPE "int"
%typemap(jstype) enum SWIGTYPE "int" %typemap(cswtype) enum SWIGTYPE "int"
/* pointer to a class member */ /* pointer to a class member */
%typemap(jni) SWIGTYPE (CLASS::*) "int" %typemap(ctype) SWIGTYPE (CLASS::*) "int"
%typemap(jtype) SWIGTYPE (CLASS::*) "IntPtr" %typemap(cstype) SWIGTYPE (CLASS::*) "IntPtr"
%typemap(jstype) SWIGTYPE (CLASS::*) "$javaclassname" %typemap(cswtype) SWIGTYPE (CLASS::*) "$csclassname"
/* 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 PInvoke code generating typemaps for converting from C# to C and visa versa. */
/* primitive types */ /* primitive types */
%typemap(in) bool %typemap(in) bool
@ -221,7 +220,7 @@ $1 = &temp; %}
/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions /* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
* that cannot be overloaded in Java as more than one C++ type maps to a single Java type */ * that cannot be overloaded in C# as more than one C++ type maps to a single C# type */
%typecheck(SWIG_TYPECHECK_BOOL) /* Java boolean */ %typecheck(SWIG_TYPECHECK_BOOL) /* Java boolean */
bool, bool,
@ -316,11 +315,11 @@ $1 = &temp; %}
} }
/* Typemaps for code generation in proxy classes and Java type wrapper classes */ /* Typemaps for code generation in proxy classes and C# type wrapper classes */
/* The javain typemap is used for converting function parameter types from the type /* The csin typemap is used for converting function parameter types from the type
* used in the proxy, module or type wrapper class to the type used in the JNI class. */ * used in the proxy, module or type wrapper class to the type used in the PInvoke class. */
%typemap(javain) bool, const bool &, %typemap(csin) bool, const bool &,
char, const char &, char, const char &,
signed char, const signed char &, signed char, const signed char &,
unsigned char, const unsigned char &, unsigned char, const unsigned char &,
@ -337,13 +336,13 @@ $1 = &temp; %}
char *, char *,
char[ANY], char[ANY],
enum SWIGTYPE enum SWIGTYPE
"$javainput" "$csinput"
%typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)" %typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$javaclassname.getCPtr($javainput)" %typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$csclassname.getCPtr($csinput)"
/* The javaout typemap is used for converting function return types from the return type /* The csout typemap is used for converting function return types from the return type
* used in the JNI class to the type returned by the proxy, module or type wrapper class. */ * used in the PInvoke class to the type returned by the proxy, module or type wrapper class. */
%typemap(javaout) bool, const bool &, %typemap(csout) bool, const bool &,
char, const char &, char, const char &,
signed char, const signed char &, signed char, const signed char &,
unsigned char, const unsigned char &, unsigned char, const unsigned char &,
@ -360,26 +359,26 @@ $1 = &temp; %}
char *, char *,
char[ANY], char[ANY],
enum SWIGTYPE { enum SWIGTYPE {
return $jnicall; return $imcall;
} }
%typemap(javaout) void { %typemap(csout) void {
$jnicall; $imcall;
} }
%typemap(javaout) SWIGTYPE { %typemap(csout) SWIGTYPE {
return new $&javaclassname($jnicall, true); return new $&csclassname($imcall, true);
} }
%typemap(javaout) SWIGTYPE & { %typemap(csout) SWIGTYPE & {
return new $javaclassname($jnicall, $owner); return new $csclassname($imcall, $owner);
} }
%typemap(javaout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) { %typemap(csout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) {
IntPtr cPtr = $jnicall; IntPtr cPtr = $imcall;
return (cPtr == IntPtr.Zero) ? null : new $javaclassname(cPtr, $owner); return (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);
} }
/* Properties */ /* Properties */
%typemap(csvarin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ %typemap(csvarin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
set { set {
$jnicall; $imcall;
} %} } %}
%typemap(csvarout) bool, const bool &, %typemap(csvarout) bool, const bool &,
@ -400,34 +399,34 @@ $1 = &temp; %}
char[ANY], char[ANY],
enum SWIGTYPE %{ enum SWIGTYPE %{
get { get {
return $jnicall; return $imcall;
} %} } %}
%typemap(csvarout) void %{ %typemap(csvarout) void %{
get { get {
$jnicall; $imcall;
} %} } %}
%typemap(csvarout) SWIGTYPE %{ %typemap(csvarout) SWIGTYPE %{
get { get {
return new $&javaclassname($jnicall, true); return new $&csclassname($imcall, true);
} %} } %}
%typemap(csvarout) SWIGTYPE & %{ %typemap(csvarout) SWIGTYPE & %{
get { get {
return new $javaclassname($jnicall, $owner); return new $csclassname($imcall, $owner);
} %} } %}
%typemap(csvarout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ %typemap(csvarout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
get { get {
IntPtr cPtr = $jnicall; IntPtr cPtr = $imcall;
return (cPtr == IntPtr.Zero) ? null : new $javaclassname(cPtr, $owner); return (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);
} %} } %}
/* Typemaps used for the generation of proxy and type wrapper class code */ /* Typemaps used for the generation of proxy and type wrapper class code */
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public" %typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;" %typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
%typemap(csinterfaces_base) SWIGTYPE "IDisposable" %typemap(csinterfaces) SWIGTYPE "IDisposable"
%typemap(csinterfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(csinterfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal" %typemap(csptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
%typemap(csfinalize) SWIGTYPE %{ %typemap(csfinalize) SWIGTYPE %{
protected override void Finalize() { protected override void Finalize() {
@ -435,9 +434,9 @@ $1 = &temp; %}
} }
%} %}
%typemap(csdestruct_base) SWIGTYPE { %typemap(csdestruct) SWIGTYPE {
if(swigCPtr != IntPtr.Zero && swigCMemOwn) { if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
$jnicall; $imcall;
swigCMemOwn = false; swigCMemOwn = false;
} }
swigCPtr = IntPtr.Zero; swigCPtr = IntPtr.Zero;
@ -446,7 +445,7 @@ $1 = &temp; %}
%typemap(csdestruct_derived) SWIGTYPE { %typemap(csdestruct_derived) SWIGTYPE {
if(swigCPtr != IntPtr.Zero && swigCMemOwn) { if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
$jnicall; $imcall;
swigCMemOwn = false; swigCMemOwn = false;
} }
swigCPtr = IntPtr.Zero; swigCPtr = IntPtr.Zero;
@ -454,23 +453,23 @@ $1 = &temp; %}
base.Dispose(); base.Dispose();
} }
%typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ %typemap(csgetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
internal static IntPtr getCPtr($javaclassname obj) { internal static IntPtr getCPtr($csclassname obj) {
return (obj == null) ? IntPtr.Zero : obj.swigCPtr; return (obj == null) ? IntPtr.Zero : obj.swigCPtr;
} }
%} %}
/* Java specific directives */ /* C# specific directives */
#define %javaconst(flag) %feature("java:const","flag") #define %csconst(flag) %feature("cs:const","flag")
#define %javamethodmodifiers %feature("java:methodmodifiers") #define %csmethodmodifiers %feature("cs:methodmodifiers")
%javamethodmodifiers "public"; %csmethodmodifiers "public";
%pragma(java) moduleimports=%{ %pragma(csharp) moduleimports=%{
using System; using System;
%} %}
%pragma(java) jniclassimports=%{ %pragma(csharp) imclassimports=%{
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
%} %}

View file

@ -3,52 +3,52 @@
* OUTPUT * and OUTPUT & as they currently break functions that return a pointer or * OUTPUT * and OUTPUT & as they currently break functions that return a pointer or
* reference. */ * reference. */
%typemap(jni) bool *, bool & "bool *" %typemap(ctype) bool *, bool & "bool *"
%typemap(jni) char & "char *" %typemap(ctype) char & "char *"
%typemap(jni) signed char *, signed char & "signed char *" %typemap(ctype) signed char *, signed char & "signed char *"
%typemap(jni) unsigned char *, unsigned char & "unsigned short *" %typemap(ctype) unsigned char *, unsigned char & "unsigned short *"
%typemap(jni) short *, short & "short *" %typemap(ctype) short *, short & "short *"
%typemap(jni) unsigned short *, unsigned short & "unsigned short *" %typemap(ctype) unsigned short *, unsigned short & "unsigned short *"
%typemap(jni) int *, int & "int *" %typemap(ctype) int *, int & "int *"
%typemap(jni) unsigned int *, unsigned int & "unsigned int *" %typemap(ctype) unsigned int *, unsigned int & "unsigned int *"
%typemap(jni) long *, long & "long *" %typemap(ctype) long *, long & "long *"
%typemap(jni) unsigned long *, unsigned long & "unsigned long *" %typemap(ctype) unsigned long *, unsigned long & "unsigned long *"
%typemap(jni) long long *, long long & "long long *" %typemap(ctype) long long *, long long & "long long *"
%typemap(jni) unsigned long long *, unsigned long long & "unsigned long long *" %typemap(ctype) unsigned long long *, unsigned long long & "unsigned long long *"
%typemap(jni) float *, float & "float *" %typemap(ctype) float *, float & "float *"
%typemap(jni) double *, double & "double *" %typemap(ctype) double *, double & "double *"
%typemap(jtype) bool *, bool & "ref bool" %typemap(cstype) bool *, bool & "ref bool"
%typemap(jtype) char & "ref char" %typemap(cstype) char & "ref char"
%typemap(jtype) signed char *, signed char & "ref sbyte" %typemap(cstype) signed char *, signed char & "ref sbyte"
%typemap(jtype) unsigned char *, unsigned char & "ref byte" %typemap(cstype) unsigned char *, unsigned char & "ref byte"
%typemap(jtype) short *, short & "ref short" %typemap(cstype) short *, short & "ref short"
%typemap(jtype) unsigned short *, unsigned short & "ref ushort" %typemap(cstype) unsigned short *, unsigned short & "ref ushort"
%typemap(jtype) int *, int & "ref int" %typemap(cstype) int *, int & "ref int"
%typemap(jtype) unsigned int *, unsigned int & "ref uint" %typemap(cstype) unsigned int *, unsigned int & "ref uint"
%typemap(jtype) long *, long & "ref int" %typemap(cstype) long *, long & "ref int"
%typemap(jtype) unsigned long *, unsigned long & "ref uint" %typemap(cstype) unsigned long *, unsigned long & "ref uint"
%typemap(jtype) long long *, long long & "ref long" %typemap(cstype) long long *, long long & "ref long"
%typemap(jtype) unsigned long long *, unsigned long long & "ref ulong" %typemap(cstype) unsigned long long *, unsigned long long & "ref ulong"
%typemap(jtype) float *, float & "ref float" %typemap(cstype) float *, float & "ref float"
%typemap(jtype) double *, double & "ref double" %typemap(cstype) double *, double & "ref double"
%typemap(jstype) bool *, bool & "ref bool" %typemap(cswtype) bool *, bool & "ref bool"
%typemap(jstype) char & "ref char" %typemap(cswtype) char & "ref char"
%typemap(jstype) signed char *, signed char & "ref sbyte" %typemap(cswtype) signed char *, signed char & "ref sbyte"
%typemap(jstype) unsigned char *, unsigned char & "ref byte" %typemap(cswtype) unsigned char *, unsigned char & "ref byte"
%typemap(jstype) short *, short & "ref short" %typemap(cswtype) short *, short & "ref short"
%typemap(jstype) unsigned short *, unsigned short & "ref ushort" %typemap(cswtype) unsigned short *, unsigned short & "ref ushort"
%typemap(jstype) int *, int & "ref int" %typemap(cswtype) int *, int & "ref int"
%typemap(jstype) unsigned int *, unsigned int & "ref uint" %typemap(cswtype) unsigned int *, unsigned int & "ref uint"
%typemap(jstype) long *, long & "ref int" %typemap(cswtype) long *, long & "ref int"
%typemap(jstype) unsigned long *, unsigned long & "ref uint" %typemap(cswtype) unsigned long *, unsigned long & "ref uint"
%typemap(jstype) long long *, long long & "ref long" %typemap(cswtype) long long *, long long & "ref long"
%typemap(jstype) unsigned long long *, unsigned long long & "ref ulong" %typemap(cswtype) unsigned long long *, unsigned long long & "ref ulong"
%typemap(jstype) float *, float & "ref float" %typemap(cswtype) float *, float & "ref float"
%typemap(jstype) double *, double & "ref double" %typemap(cswtype) double *, double & "ref double"
%typemap(javain) bool *, bool &, %typemap(csin) bool *, bool &,
char &, char &,
signed char *, signed char &, signed char *, signed char &,
unsigned char *, unsigned char &, unsigned char *, unsigned char &,
@ -62,5 +62,5 @@
unsigned long long *, unsigned long long &, unsigned long long *, unsigned long long &,
float *, float &, float *, float &,
double *, double & double *, double &
"ref $javainput" "ref $csinput"

View file

@ -155,22 +155,9 @@ class CSHARP : public Language {
} else { } else {
Swig_arg_error(); Swig_arg_error();
} }
} else if ((strcmp(argv[i],"-shadow") == 0) || ((strcmp(argv[i],"-proxy") == 0))) {
Printf(stderr,"Deprecated command line option: %s. Proxy classes are now generated by default.\n", argv[i]);
Swig_mark_arg(i);
proxy_flag = true;
} else if ((strcmp(argv[i],"-noproxy") == 0)) { } else if ((strcmp(argv[i],"-noproxy") == 0)) {
Swig_mark_arg(i); Swig_mark_arg(i);
proxy_flag = false; proxy_flag = false;
} else if (strcmp(argv[i],"-jnic") == 0) {
Swig_mark_arg(i);
Printf(stderr,"Deprecated command line option: -jnic. C JNI calling convention now used when -c++ not specified.\n");
} else if (strcmp(argv[i],"-nofinalize") == 0) {
Swig_mark_arg(i);
Printf(stderr,"Deprecated command line option: -nofinalize. Use the new javafinalize typemaps instead.\n");
} else if (strcmp(argv[i],"-jnicpp") == 0) {
Swig_mark_arg(i);
Printf(stderr,"Deprecated command line option: -jnicpp. C++ JNI calling convention now used when -c++ specified.\n");
} else if (strcmp(argv[i],"-help") == 0) { } else if (strcmp(argv[i],"-help") == 0) {
Printf(stderr,"%s\n", usage); Printf(stderr,"%s\n", usage);
} }
@ -500,22 +487,22 @@ class CSHARP : public Language {
String *wname = Swig_name_wrapper(overloaded_name); String *wname = Swig_name_wrapper(overloaded_name);
/* Attach the non-standard typemaps to the parameter list. */ /* Attach the non-standard typemaps to the parameter list. */
Swig_typemap_attach_parms("jni", l, f); Swig_typemap_attach_parms("ctype", l, f);
Swig_typemap_attach_parms("jtype", l, f); Swig_typemap_attach_parms("cstype", l, f);
/* Get Java return types */ /* Get Java return types */
if ((tm = Swig_typemap_lookup_new("jni",n,"",0))) { if ((tm = Swig_typemap_lookup_new("ctype",n,"",0))) {
Printf(jnirettype,"%s", tm); Printf(jnirettype,"%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number,
"No jni typemap defined for %s\n", SwigType_str(t,0)); "No ctype typemap defined for %s\n", SwigType_str(t,0));
} }
if ((tm = Swig_typemap_lookup_new("jtype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
Printf(javarettype,"%s", tm); Printf(javarettype,"%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number,
"No jtype typemap defined for %s\n", SwigType_str(t,0)); "No cstype typemap defined for %s\n", SwigType_str(t,0));
} }
is_void_return = (Cmp(jnirettype, "void") == 0); is_void_return = (Cmp(jnirettype, "void") == 0);
@ -557,20 +544,20 @@ class CSHARP : public Language {
Printf(arg,"j%s", ln); Printf(arg,"j%s", ln);
/* Get the jni types of the parameter */ /* Get the ctype types of the parameter */
if ((tm = Getattr(p,"tmap:jni"))) { if ((tm = Getattr(p,"tmap:ctype"))) {
Printv(jni_param_type, tm, NIL); Printv(jni_param_type, tm, NIL);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number,
"No jni typemap defined for %s\n", SwigType_str(pt,0)); "No ctype typemap defined for %s\n", SwigType_str(pt,0));
} }
/* Get the java types of the parameter */ /* Get the java types of the parameter */
if ((tm = Getattr(p,"tmap:jtype"))) { if ((tm = Getattr(p,"tmap:cstype"))) {
Printv(javaparamtype, tm, NIL); Printv(javaparamtype, tm, NIL);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number,
"No jtype typemap defined for %s\n", SwigType_str(pt,0)); "No cstype typemap defined for %s\n", SwigType_str(pt,0));
} }
/* Add to java function header */ /* Add to java function header */
@ -776,11 +763,11 @@ class CSHARP : public Language {
String *tm; String *tm;
// Get the variable type // Get the variable type
if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(t,0)); "No cswtype typemap defined for %s\n", SwigType_str(t,0));
} }
// Output the property's field declaration and accessor methods // Output the property's field declaration and accessor methods
@ -813,7 +800,7 @@ class CSHARP : public Language {
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0); bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
/* Adjust the enum type for the Swig_typemap_lookup. We want the same jstype typemap for all the enum items. /* Adjust the enum type for the Swig_typemap_lookup. We want the same cswtype typemap for all the enum items.
* The type of each enum item depends on what value it is assigned, but is usually a C int. */ * The type of each enum item depends on what value it is assigned, but is usually a C int. */
if (is_enum_item) { if (is_enum_item) {
t = NewStringf("enum %s", Getattr(parentNode(n), "sym:name")); t = NewStringf("enum %s", Getattr(parentNode(n), "sym:name"));
@ -821,17 +808,17 @@ class CSHARP : public Language {
} }
/* Attach the non-standard typemaps to the parameter list. */ /* Attach the non-standard typemaps to the parameter list. */
Swig_typemap_attach_parms("jstype", l, NULL); Swig_typemap_attach_parms("cswtype", l, NULL);
/* Get Java return types */ /* Get Java return types */
bool is_return_type_java_class = false; bool is_return_type_java_class = false;
if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
is_return_type_java_class = substituteJavaclassname(t, tm); is_return_type_java_class = substituteJavaclassname(t, tm);
Printf(shadowrettype, "%s", tm); Printf(shadowrettype, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(t,0)); "No cswtype typemap defined for %s\n", SwigType_str(t,0));
} }
// Add the stripped quotes back in // Add the stripped quotes back in
@ -846,15 +833,15 @@ class CSHARP : public Language {
Setattr(n, "value", new_value); Setattr(n, "value", new_value);
} }
// The %javaconst directive determines how the constant value is obtained // The %csconst directive determines how the constant value is obtained
String *javaconst = Getattr(n,"feature:java:const"); String *csconst = Getattr(n,"feature:java:const");
bool javaconst_flag = javaconst && Cmp(javaconst, "0") != 0; bool csconst_flag = csconst && Cmp(csconst, "0") != 0;
// enums are wrapped using a public final static int in java. // enums are wrapped using a public final static int in java.
// Other constants are wrapped using a public final static [jstype] in Java. // Other constants are wrapped using a public final static [cswtype] in Java.
Printf(constants_code, " public %s %s %s = ", (javaconst_flag ? "const" : "static readonly"), shadowrettype, ((proxy_flag && wrapping_member_flag) ? variable_name : symname)); Printf(constants_code, " public %s %s %s = ", (csconst_flag ? "const" : "static readonly"), shadowrettype, ((proxy_flag && wrapping_member_flag) ? variable_name : symname));
if ((is_enum_item && Getattr(n,"enumvalue") == 0) || !javaconst_flag) { if ((is_enum_item && Getattr(n,"enumvalue") == 0) || !csconst_flag) {
// Enums without value and default constant handling will work with any type of C constant and initialises the Java variable from C through a JNI call. // Enums without value and default constant handling will work with any type of C constant and initialises the Java variable from C through a JNI call.
if(is_return_type_java_class) // This handles function pointers using the %constant directive if(is_return_type_java_class) // This handles function pointers using the %constant directive
@ -894,11 +881,11 @@ class CSHARP : public Language {
* pragmaDirective() * pragmaDirective()
* *
* Valid Pragmas: * Valid Pragmas:
* jniclassbase - base (extends) for the JNI class * imclassbase - base (extends) for the JNI class
* jniclassclassmodifiers - class modifiers for the JNI class * imclassclassmodifiers - class modifiers for the JNI class
* jniclasscode - text (java code) is copied verbatim to the JNI class * imclasscode - text (java code) is copied verbatim to the JNI class
* jniclassimports - import statements for the JNI class * imclassimports - import statements for the JNI class
* jniclassinterfaces - interface (implements) for the JNI class * imclassinterfaces - interface (implements) for the JNI class
* *
* modulebase - base (extends) for the module class * modulebase - base (extends) for the module class
* moduleclassmodifiers - class modifiers for the module class * moduleclassmodifiers - class modifiers for the module class
@ -914,27 +901,27 @@ class CSHARP : public Language {
String *code = Getattr(n,"name"); String *code = Getattr(n,"name");
String *value = Getattr(n,"value"); String *value = Getattr(n,"value");
if(Strcmp(lang, "java") == 0) { if(Strcmp(lang, "csharp") == 0) {
String *strvalue = NewString(value); String *strvalue = NewString(value);
Replaceall(strvalue,"\\\"", "\""); Replaceall(strvalue,"\\\"", "\"");
if(Strcmp(code, "jniclassbase") == 0) { if(Strcmp(code, "imclassbase") == 0) {
Delete(jniclass_baseclass); Delete(jniclass_baseclass);
jniclass_baseclass = Copy(strvalue); jniclass_baseclass = Copy(strvalue);
} }
else if(Strcmp(code, "jniclassclassmodifiers") == 0) { else if(Strcmp(code, "imclassclassmodifiers") == 0) {
Delete(jniclass_class_modifiers); Delete(jniclass_class_modifiers);
jniclass_class_modifiers = Copy(strvalue); jniclass_class_modifiers = Copy(strvalue);
} }
else if(Strcmp(code, "jniclasscode") == 0) { else if(Strcmp(code, "imclasscode") == 0) {
Printf(jniclass_class_code, "%s\n", strvalue); Printf(jniclass_class_code, "%s\n", strvalue);
} }
else if(Strcmp(code, "jniclassimports") == 0) { else if(Strcmp(code, "imclassimports") == 0) {
Delete(jniclass_imports); Delete(jniclass_imports);
jniclass_imports = Copy(strvalue); jniclass_imports = Copy(strvalue);
} }
else if(Strcmp(code, "jniclassinterfaces") == 0) { else if(Strcmp(code, "imclassinterfaces") == 0) {
Delete(jniclass_interfaces); Delete(jniclass_interfaces);
jniclass_interfaces = Copy(strvalue); jniclass_interfaces = Copy(strvalue);
} }
@ -956,49 +943,6 @@ class CSHARP : public Language {
else if(Strcmp(code, "moduleinterfaces") == 0) { else if(Strcmp(code, "moduleinterfaces") == 0) {
Delete(module_interfaces); Delete(module_interfaces);
module_interfaces = Copy(strvalue); module_interfaces = Copy(strvalue);
}
else if(Strcmp(code, "moduleimport") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use the moduleimports pragma.\n", input_file, line_number);
}
else if(Strcmp(code, "moduleinterface") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use the moduleinterfaces pragma.\n", input_file, line_number);
}
else if(Strcmp(code, "modulemethodmodifiers") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %javamethodmodifiers.\n", input_file, line_number);
}
else if(Strcmp(code, "allshadowimport") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javaimports).\n", input_file, line_number);
}
else if(Strcmp(code, "allshadowcode") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javacode).\n", input_file, line_number);
}
else if(Strcmp(code, "allshadowbase") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javabase).\n", input_file, line_number);
}
else if(Strcmp(code, "allshadowinterface") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javainterfaces).\n", input_file, line_number);
}
else if(Strcmp(code, "allshadowclassmodifiers") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javaclassmodifiers).\n", input_file, line_number);
}
else if (proxy_flag) {
if (Strcmp(code,"shadowcode") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javacode).\n", input_file, line_number);
}
else if (Strcmp(code,"shadowimport") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javaimports).\n", input_file, line_number);
}
else if (Strcmp(code,"shadowbase") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javabase).\n", input_file, line_number);
}
else if (Strcmp(code,"shadowinterface") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javainterfaces).\n", input_file, line_number);
}
else if (Strcmp(code,"shadowclassmodifiers") == 0) {
Printf(stderr,"%s : Line %d. Ignored: Deprecated pragma. Please use %typemap(javaclassmodifiers).\n", input_file, line_number);
} else {
Printf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number);
}
} else { } else {
Printf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number); Printf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number);
} }
@ -1040,21 +984,21 @@ class CSHARP : public Language {
baseclass = NewString(""); baseclass = NewString("");
// Inheritance from pure Java classes // Inheritance from pure Java classes
const String *pure_java_baseclass = javaTypemapLookup("javabase", classDeclarationName, WARN_NONE); const String *pure_java_baseclass = javaTypemapLookup("csbase", classDeclarationName, WARN_NONE);
if (Len(pure_java_baseclass) > 0 && Len(baseclass) > 0) { if (Len(pure_java_baseclass) > 0 && Len(baseclass) > 0) {
Swig_warning(WARN_JAVA_MULTIPLE_INHERITANCE, input_file, line_number, Swig_warning(WARN_JAVA_MULTIPLE_INHERITANCE, input_file, line_number,
"Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in C#.\n", classDeclarationName, pure_java_baseclass); "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in C#.\n", classDeclarationName, pure_java_baseclass);
} }
// Pure Java interfaces // Pure Java interfaces
const String *pure_java_interfaces = javaTypemapLookup(derived ? "csinterfaces_derived" : "csinterfaces_base", classDeclarationName, WARN_NONE); const String *pure_java_interfaces = javaTypemapLookup(derived ? "csinterfaces_derived" : "csinterfaces", classDeclarationName, WARN_NONE);
// Start writing the shadow class // Start writing the shadow class
Printv(shadow_classdef, Printv(shadow_classdef,
javaTypemapLookup("javaimports", classDeclarationName, WARN_NONE), // Import statements javaTypemapLookup("csimports", classDeclarationName, WARN_NONE), // Import statements
"\n", "\n",
javaTypemapLookup("javaclassmodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers javaTypemapLookup("csclassmodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
" class $javaclassname", // Class name and bases " class $csclassname", // Class name and bases
(derived || *Char(pure_java_baseclass) || *Char(pure_java_interfaces)) ? (derived || *Char(pure_java_baseclass) || *Char(pure_java_interfaces)) ?
" : " : " : " :
"", "",
@ -1071,10 +1015,10 @@ class CSHARP : public Language {
" protected bool swigCMemOwn;\n", " protected bool swigCMemOwn;\n",
"\n", "\n",
" ", " ",
javaTypemapLookup("javaptrconstructormodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers javaTypemapLookup("csptrconstructormodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers
" $javaclassname(IntPtr cPtr, bool cMemoryOwn) ", // Constructor used for wrapping pointers " $csclassname(IntPtr cPtr, bool cMemoryOwn) ", // Constructor used for wrapping pointers
derived ? derived ?
": base($jniclassname.$javaclassnameTo$baseclass(cPtr), cMemoryOwn) {\n" : ": base($jniclassname.$csclassnameTo$baseclass(cPtr), cMemoryOwn) {\n" :
"{\n swigCMemOwn = cMemoryOwn;\n", "{\n swigCMemOwn = cMemoryOwn;\n",
" swigCPtr = cPtr;\n", " swigCPtr = cPtr;\n",
" }\n", " }\n",
@ -1083,7 +1027,7 @@ class CSHARP : public Language {
if(!have_default_constructor_flag) { // All Java classes need a constructor if(!have_default_constructor_flag) { // All Java classes need a constructor
Printv(shadow_classdef, Printv(shadow_classdef,
"\n", "\n",
" protected $javaclassname() : this(IntPtr.Zero, false) {\n", " protected $csclassname() : this(IntPtr.Zero, false) {\n",
" }\n", " }\n",
NIL); NIL);
} }
@ -1094,7 +1038,7 @@ class CSHARP : public Language {
if (derived) if (derived)
tm = javaTypemapLookup("csdestruct_derived", classDeclarationName, WARN_NONE); tm = javaTypemapLookup("csdestruct_derived", classDeclarationName, WARN_NONE);
else else
tm = javaTypemapLookup("csdestruct_base", classDeclarationName, WARN_NONE); tm = javaTypemapLookup("csdestruct", classDeclarationName, WARN_NONE);
// Emit the Finalize and Dispose methods // Emit the Finalize and Dispose methods
if (tm) { if (tm) {
@ -1102,30 +1046,29 @@ class CSHARP : public Language {
if (*Char(destructor_call)) { if (*Char(destructor_call)) {
Printv(shadow_classdef, Printv(shadow_classdef,
javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE), javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE),
"\n",
NIL); NIL);
} }
// Dispose method // Dispose method
Printv(destruct, tm, NIL); Printv(destruct, tm, NIL);
if (*Char(destructor_call)) if (*Char(destructor_call))
Replaceall(destruct, "$jnicall", destructor_call); Replaceall(destruct, "$imcall", destructor_call);
else else
Replaceall(destruct, "$jnicall", "throw new MethodAccessException(\"C++ destructor does not have public access\")"); Replaceall(destruct, "$imcall", "throw new MethodAccessException(\"C++ destructor does not have public access\")");
if (*Char(destruct)) if (*Char(destruct))
Printv(shadow_classdef, " public ", derived ? "override" : "virtual", " void Dispose() ", destruct, "\n", NIL); Printv(shadow_classdef, "\n public ", derived ? "override" : "virtual", " void Dispose() ", destruct, "\n", NIL);
} }
Delete(destruct); Delete(destruct);
// Emit various other methods // Emit various other methods
Printv(shadow_classdef, Printv(shadow_classdef,
javaTypemapLookup("javagetcptr", classDeclarationName, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method javaTypemapLookup("csgetcptr", classDeclarationName, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method
javaTypemapLookup("javacode", classDeclarationName, WARN_NONE), // extra Java code javaTypemapLookup("cscode", classDeclarationName, WARN_NONE), // extra Java code
"\n", "\n",
NIL); NIL);
// Substitute various strings into the above template // Substitute various strings into the above template
Replaceall(shadow_code, "$javaclassname", shadow_classname); Replaceall(shadow_code, "$csclassname", shadow_classname);
Replaceall(shadow_classdef, "$javaclassname", shadow_classname); Replaceall(shadow_classdef, "$csclassname", shadow_classname);
Replaceall(shadow_classdef, "$baseclass", baseclass); Replaceall(shadow_classdef, "$baseclass", baseclass);
Replaceall(shadow_code, "$baseclass", baseclass); Replaceall(shadow_code, "$baseclass", baseclass);
@ -1137,10 +1080,10 @@ class CSHARP : public Language {
if(derived){ if(derived){
Printv(jniclass_cppcasts_code,"\n [DllImport(\"", module_class_name, "\", EntryPoint=\"CSharp_", shadow_classname ,"To", baseclass ,"\")]\n", NIL); Printv(jniclass_cppcasts_code,"\n [DllImport(\"", module_class_name, "\", EntryPoint=\"CSharp_", shadow_classname ,"To", baseclass ,"\")]\n", NIL);
Printv(jniclass_cppcasts_code," public static extern IntPtr ", Printv(jniclass_cppcasts_code," public static extern IntPtr ",
"$javaclassnameTo$baseclass(IntPtr objectRef);\n", "$csclassnameTo$baseclass(IntPtr objectRef);\n",
NIL); NIL);
Replaceall(jniclass_cppcasts_code, "$javaclassname", shadow_classname); Replaceall(jniclass_cppcasts_code, "$csclassname", shadow_classname);
Replaceall(jniclass_cppcasts_code, "$baseclass", baseclass); Replaceall(jniclass_cppcasts_code, "$baseclass", baseclass);
Printv(wrapper_conversion_code, Printv(wrapper_conversion_code,
@ -1302,16 +1245,16 @@ class CSHARP : public Language {
/* Attach the non-standard typemaps to the parameter list */ /* Attach the non-standard typemaps to the parameter list */
Swig_typemap_attach_parms("in", l, NULL); Swig_typemap_attach_parms("in", l, NULL);
Swig_typemap_attach_parms("jstype", l, NULL); Swig_typemap_attach_parms("cswtype", l, NULL);
Swig_typemap_attach_parms("javain", l, NULL); Swig_typemap_attach_parms("csin", l, NULL);
/* Get Java return types */ /* Get Java return types */
if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Printf(shadowrettype, "%s", tm); Printf(shadowrettype, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(t,0)); "No cswtype typemap defined for %s\n", SwigType_str(t,0));
} }
if(proxy_flag && wrapping_member_flag && !enum_constant_flag) { if(proxy_flag && wrapping_member_flag && !enum_constant_flag) {
@ -1320,7 +1263,7 @@ class CSHARP : public Language {
} }
/* Start generating the shadow function */ /* Start generating the shadow function */
Printf(function_code, " %s ", Getattr(n,"feature:java:methodmodifiers")); Printf(function_code, " %s ", Getattr(n,"feature:cs:methodmodifiers"));
if (static_flag) if (static_flag)
Printf(function_code, "static "); Printf(function_code, "static ");
if (Getattr(n,"virtual:derived")) if (Getattr(n,"virtual:derived"))
@ -1360,12 +1303,12 @@ class CSHARP : public Language {
String *javaparamtype = NewString(""); String *javaparamtype = NewString("");
/* Get the java type of the parameter */ /* Get the java type of the parameter */
if ((tm = Getattr(p,"tmap:jstype"))) { if ((tm = Getattr(p,"tmap:cswtype"))) {
substituteJavaclassname(pt, tm); substituteJavaclassname(pt, tm);
Printf(javaparamtype, "%s", tm); Printf(javaparamtype, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(pt,0)); "No cswtype typemap defined for %s\n", SwigType_str(pt,0));
} }
if (gencomma) if (gencomma)
@ -1374,13 +1317,13 @@ class CSHARP : public Language {
String *arg = variable_wrapper_flag ? NewString("value") : makeParameterName(n, p, i); String *arg = variable_wrapper_flag ? NewString("value") : makeParameterName(n, p, i);
// Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class) // Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class)
if ((tm = Getattr(p,"tmap:javain"))) { if ((tm = Getattr(p,"tmap:csin"))) {
substituteJavaclassname(pt, tm); substituteJavaclassname(pt, tm);
Replaceall(tm, "$javainput", arg); Replaceall(tm, "$csinput", arg);
Printv(nativecall, tm, NIL); Printv(nativecall, tm, NIL);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number,
"No javain typemap defined for %s\n", SwigType_str(pt,0)); "No csin typemap defined for %s\n", SwigType_str(pt,0));
} }
/* Add to java shadow function header */ /* Add to java shadow function header */
@ -1400,17 +1343,17 @@ class CSHARP : public Language {
generateThrowsClause(n, function_code); generateThrowsClause(n, function_code);
// Transform return type used in native function (in JNI class) to type used in Java wrapper function (in proxy class) // Transform return type used in native function (in JNI class) to type used in Java wrapper function (in proxy class)
if ((tm = Swig_typemap_lookup_new("javaout",n,"",0))) { if ((tm = Swig_typemap_lookup_new("csout",n,"",0))) {
if (Getattr(n,"feature:new")) if (Getattr(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Replaceall(tm, "$jnicall", nativecall); Replaceall(tm, "$imcall", nativecall);
Printf(function_code, " %s\n\n", tm); Printf(function_code, " %s\n\n", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
"No javaout typemap defined for %s\n", SwigType_str(t,0)); "No csout typemap defined for %s\n", SwigType_str(t,0));
} }
if(proxy_flag && wrapping_member_flag && !enum_constant_flag) { if(proxy_flag && wrapping_member_flag && !enum_constant_flag) {
@ -1423,7 +1366,7 @@ class CSHARP : public Language {
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Replaceall(tm, "$jnicall", nativecall); Replaceall(tm, "$imcall", nativecall);
Printf(shadow_code, "%s", tm); Printf(shadow_code, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
@ -1437,7 +1380,7 @@ class CSHARP : public Language {
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Replaceall(tm, "$jnicall", nativecall); Replaceall(tm, "$imcall", nativecall);
Printf(shadow_code, "%s", tm); Printf(shadow_code, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
@ -1471,13 +1414,13 @@ class CSHARP : public Language {
String *overloaded_name = getOverloadedName(n); String *overloaded_name = getOverloadedName(n);
String *nativecall = NewString(""); String *nativecall = NewString("");
Printf(shadow_code, " %s %s(", Getattr(n,"feature:java:methodmodifiers"), shadow_classname); Printf(shadow_code, " %s %s(", Getattr(n,"feature:cs:methodmodifiers"), shadow_classname);
Printv(nativecall, " : this(", jniclass_name, ".", Swig_name_construct(overloaded_name), "(", NIL); Printv(nativecall, " : this(", jniclass_name, ".", Swig_name_construct(overloaded_name), "(", NIL);
/* Attach the non-standard typemaps to the parameter list */ /* Attach the non-standard typemaps to the parameter list */
Swig_typemap_attach_parms("in", l, NULL); Swig_typemap_attach_parms("in", l, NULL);
Swig_typemap_attach_parms("jstype", l, NULL); Swig_typemap_attach_parms("cswtype", l, NULL);
Swig_typemap_attach_parms("javain", l, NULL); Swig_typemap_attach_parms("csin", l, NULL);
emit_mark_varargs(l); emit_mark_varargs(l);
@ -1502,12 +1445,12 @@ class CSHARP : public Language {
String *javaparamtype = NewString(""); String *javaparamtype = NewString("");
/* Get the java type of the parameter */ /* Get the java type of the parameter */
if ((tm = Getattr(p,"tmap:jstype"))) { if ((tm = Getattr(p,"tmap:cswtype"))) {
substituteJavaclassname(pt, tm); substituteJavaclassname(pt, tm);
Printf(javaparamtype, "%s", tm); Printf(javaparamtype, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(pt,0)); "No cswtype typemap defined for %s\n", SwigType_str(pt,0));
} }
if (gencomma) if (gencomma)
@ -1516,13 +1459,13 @@ class CSHARP : public Language {
String *arg = makeParameterName(n, p, i); String *arg = makeParameterName(n, p, i);
// Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class) // Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class)
if ((tm = Getattr(p,"tmap:javain"))) { if ((tm = Getattr(p,"tmap:csin"))) {
substituteJavaclassname(pt, tm); substituteJavaclassname(pt, tm);
Replaceall(tm, "$javainput", arg); Replaceall(tm, "$csinput", arg);
Printv(nativecall, tm, NIL); Printv(nativecall, tm, NIL);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number,
"No javain typemap defined for %s\n", SwigType_str(pt,0)); "No csin typemap defined for %s\n", SwigType_str(pt,0));
} }
/* Add to java shadow function header */ /* Add to java shadow function header */
@ -1577,11 +1520,11 @@ class CSHARP : public Language {
String *tm; String *tm;
// Get the variable type // Get the variable type
if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(t,0)); "No cswtype typemap defined for %s\n", SwigType_str(t,0));
} }
// Output the property's field declaration and accessor methods // Output the property's field declaration and accessor methods
@ -1611,11 +1554,11 @@ class CSHARP : public Language {
String *tm; String *tm;
// Get the variable type // Get the variable type
if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(t,0)); "No cswtype typemap defined for %s\n", SwigType_str(t,0));
} }
// Output the property's field declaration and accessor methods // Output the property's field declaration and accessor methods
@ -1690,16 +1633,16 @@ class CSHARP : public Language {
} }
/* Attach the non-standard typemaps to the parameter list */ /* Attach the non-standard typemaps to the parameter list */
Swig_typemap_attach_parms("jstype", l, NULL); Swig_typemap_attach_parms("cswtype", l, NULL);
Swig_typemap_attach_parms("javain", l, NULL); Swig_typemap_attach_parms("csin", l, NULL);
/* Get Java return types */ /* Get Java return types */
if ((tm = Swig_typemap_lookup_new("jstype",n,"",0))) { if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Printf(shadowrettype, "%s", tm); Printf(shadowrettype, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(t,0)); "No cswtype typemap defined for %s\n", SwigType_str(t,0));
} }
/* Change function name for global variables */ /* Change function name for global variables */
@ -1718,7 +1661,7 @@ class CSHARP : public Language {
} }
/* Start generating the function */ /* Start generating the function */
Printf(function_code, " %s static %s %s(", Getattr(n,"feature:java:methodmodifiers"), shadowrettype, func_name); Printf(function_code, " %s static %s %s(", Getattr(n,"feature:cs:methodmodifiers"), shadowrettype, func_name);
Printv(nativecall, jniclass_name, ".", overloaded_name, "(", NIL); Printv(nativecall, jniclass_name, ".", overloaded_name, "(", NIL);
/* Get number of required and total arguments */ /* Get number of required and total arguments */
@ -1739,12 +1682,12 @@ class CSHARP : public Language {
String *javaparamtype = NewString(""); String *javaparamtype = NewString("");
/* Get the java type of the parameter */ /* Get the java type of the parameter */
if ((tm = Getattr(p,"tmap:jstype"))) { if ((tm = Getattr(p,"tmap:cswtype"))) {
substituteJavaclassname(pt, tm); substituteJavaclassname(pt, tm);
Printf(javaparamtype, "%s", tm); Printf(javaparamtype, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
"No jstype typemap defined for %s\n", SwigType_str(pt,0)); "No cswtype typemap defined for %s\n", SwigType_str(pt,0));
} }
if (gencomma) if (gencomma)
@ -1753,13 +1696,13 @@ class CSHARP : public Language {
String *arg = makeParameterName(n, p, i); String *arg = makeParameterName(n, p, i);
// Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class) // Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class)
if ((tm = Getattr(p,"tmap:javain"))) { if ((tm = Getattr(p,"tmap:csin"))) {
substituteJavaclassname(pt, tm); substituteJavaclassname(pt, tm);
Replaceall(tm, "$javainput", arg); Replaceall(tm, "$csinput", arg);
Printv(nativecall, tm, NIL); Printv(nativecall, tm, NIL);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number,
"No javain typemap defined for %s\n", SwigType_str(pt,0)); "No csin typemap defined for %s\n", SwigType_str(pt,0));
} }
/* Add to java shadow function header */ /* Add to java shadow function header */
@ -1778,17 +1721,17 @@ class CSHARP : public Language {
generateThrowsClause(n, function_code); generateThrowsClause(n, function_code);
// Transform return type used in native function (in JNI class) to type used in Java wrapper function (in module class) // Transform return type used in native function (in JNI class) to type used in Java wrapper function (in module class)
if ((tm = Swig_typemap_lookup_new("javaout",n,"",0))) { if ((tm = Swig_typemap_lookup_new("csout",n,"",0))) {
if (Getattr(n,"feature:new")) if (Getattr(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Replaceall(tm, "$jnicall", nativecall); Replaceall(tm, "$imcall", nativecall);
Printf(function_code, " %s\n\n", tm); Printf(function_code, " %s\n\n", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
"No javaout typemap defined for %s\n", SwigType_str(t,0)); "No csout typemap defined for %s\n", SwigType_str(t,0));
} }
if (proxy_flag && global_variable_flag) { if (proxy_flag && global_variable_flag) {
@ -1801,7 +1744,7 @@ class CSHARP : public Language {
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Replaceall(tm, "$jnicall", nativecall); Replaceall(tm, "$imcall", nativecall);
Printf(module_class_code, "%s", tm); Printf(module_class_code, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
@ -1815,7 +1758,7 @@ class CSHARP : public Language {
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
substituteJavaclassname(t, tm); substituteJavaclassname(t, tm);
Replaceall(tm, "$jnicall", nativecall); Replaceall(tm, "$imcall", nativecall);
Printf(module_class_code, "%s", tm); Printf(module_class_code, "%s", tm);
} else { } else {
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number, Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
@ -1836,38 +1779,38 @@ class CSHARP : public Language {
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* substituteJavaclassname() * substituteJavaclassname()
* *
* Substitute $javaclassname with either the shadow class name for classes/structs/unions that SWIG knows about. * Substitute $csclassname with either the shadow class name for classes/structs/unions that SWIG knows about.
* Otherwise use the $descriptor name for the Java class name. Note that the $&javaclassname substitution * Otherwise use the $descriptor name for the Java class name. Note that the $&csclassname substitution
* is the same as a $&descriptor substitution, ie one pointer added to descriptor name. * is the same as a $&descriptor substitution, ie one pointer added to descriptor name.
* Inputs: * Inputs:
* pt - parameter type * pt - parameter type
* tm - jstype typemap * tm - cswtype typemap
* Outputs: * Outputs:
* tm - jstype typemap with $javaclassname substitution * tm - cswtype typemap with $csclassname substitution
* Return: * Return:
* is_java_class - flag indicating if a substitution was performed * is_java_class - flag indicating if a substitution was performed
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
bool substituteJavaclassname(SwigType *pt, String *tm) { bool substituteJavaclassname(SwigType *pt, String *tm) {
bool is_java_class = false; bool is_java_class = false;
if (Strstr(tm, "$javaclassname") || Strstr(tm,"$&javaclassname")) { if (Strstr(tm, "$csclassname") || Strstr(tm,"$&csclassname")) {
String *javaclassname = is_shadow(pt); String *csclassname = is_shadow(pt);
if (javaclassname) { if (csclassname) {
Replaceall(tm,"$&javaclassname", javaclassname); // is_shadow() works for pointers to classes too Replaceall(tm,"$&csclassname", csclassname); // is_shadow() works for pointers to classes too
Replaceall(tm,"$javaclassname", javaclassname); Replaceall(tm,"$csclassname", csclassname);
} }
else { // use $descriptor if SWIG does not know anything about this type. Note that any typedefs are resolved. else { // use $descriptor if SWIG does not know anything about this type. Note that any typedefs are resolved.
String *descriptor = NULL; String *descriptor = NULL;
SwigType *type = Copy(SwigType_typedef_resolve_all(pt)); SwigType *type = Copy(SwigType_typedef_resolve_all(pt));
if (Strstr(tm, "$&javaclassname")) { if (Strstr(tm, "$&csclassname")) {
SwigType_add_pointer(type); SwigType_add_pointer(type);
descriptor = NewStringf("SWIGTYPE%s", SwigType_manglestr(type)); descriptor = NewStringf("SWIGTYPE%s", SwigType_manglestr(type));
Replaceall(tm, "$&javaclassname", descriptor); Replaceall(tm, "$&csclassname", descriptor);
} }
else { // $javaclassname else { // $csclassname
descriptor = NewStringf("SWIGTYPE%s", SwigType_manglestr(type)); descriptor = NewStringf("SWIGTYPE%s", SwigType_manglestr(type));
Replaceall(tm, "$javaclassname", descriptor); Replaceall(tm, "$csclassname", descriptor);
} }
// Add to hash table so that the SWIGTYPE Java classes can be created later // Add to hash table so that the SWIGTYPE Java classes can be created later
@ -1911,8 +1854,8 @@ class CSHARP : public Language {
* emitJavaClass() * emitJavaClass()
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void emitJavaClass(String *javaclassname, SwigType *type) { void emitJavaClass(String *csclassname, SwigType *type) {
String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), javaclassname); String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), csclassname);
File *f_swigtype = NewFile(filen,"w"); File *f_swigtype = NewFile(filen,"w");
String *swigtype = NewString(""); String *swigtype = NewString("");
@ -1922,15 +1865,15 @@ class CSHARP : public Language {
Printf(f_swigtype, "//package %s;\n\n", package); Printf(f_swigtype, "//package %s;\n\n", package);
// Pure Java baseclass and interfaces // Pure Java baseclass and interfaces
const String *pure_java_baseclass = javaTypemapLookup("javabase", type, WARN_NONE); const String *pure_java_baseclass = javaTypemapLookup("csbase", type, WARN_NONE);
const String *pure_java_interfaces = javaTypemapLookup("javainterfaces", type, WARN_NONE); const String *pure_java_interfaces = javaTypemapLookup("csinterfaces", type, WARN_NONE);
// Emit the class // Emit the class
Printv(swigtype, Printv(swigtype,
javaTypemapLookup("javaimports", type, WARN_NONE), // Import statements javaTypemapLookup("csimports", type, WARN_NONE), // Import statements
"\n", "\n",
javaTypemapLookup("javaclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers javaTypemapLookup("csclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
" class $javaclassname", // Class name and bases " class $csclassname", // Class name and bases
*Char(pure_java_baseclass) ? *Char(pure_java_baseclass) ?
" : " : " : " :
"", "",
@ -1943,21 +1886,21 @@ class CSHARP : public Language {
" private IntPtr swigCPtr;\n", " private IntPtr swigCPtr;\n",
"\n", "\n",
" ", " ",
javaTypemapLookup("javaptrconstructormodifiers", type, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers javaTypemapLookup("csptrconstructormodifiers", type, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers
" $javaclassname(IntPtr cPtr, bool bFutureUse) {\n", // Constructor used for wrapping pointers " $csclassname(IntPtr cPtr, bool bFutureUse) {\n", // Constructor used for wrapping pointers
" swigCPtr = cPtr;\n", " swigCPtr = cPtr;\n",
" }\n", " }\n",
"\n", "\n",
" protected $javaclassname() {\n", // Default constructor " protected $csclassname() {\n", // Default constructor
" swigCPtr = IntPtr.Zero;\n", " swigCPtr = IntPtr.Zero;\n",
" }\n", " }\n",
javaTypemapLookup("javagetcptr", type, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method javaTypemapLookup("csgetcptr", type, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method
javaTypemapLookup("javacode", type, WARN_NONE), // extra Java code javaTypemapLookup("cscode", type, WARN_NONE), // extra Java code
"}\n", "}\n",
"\n", "\n",
NIL); NIL);
Replaceall(swigtype, "$javaclassname", javaclassname); Replaceall(swigtype, "$csclassname", csclassname);
Printv(f_swigtype, swigtype, NIL); Printv(f_swigtype, swigtype, NIL);
Close(f_swigtype); Close(f_swigtype);
@ -2012,7 +1955,7 @@ class CSHARP : public Language {
Replaceall(javacls," ",""); // remove spaces Replaceall(javacls," ",""); // remove spaces
Replaceall(javacls,"\t",""); // remove tabs Replaceall(javacls,"\t",""); // remove tabs
if (Len(javacls) > 0) { if (Len(javacls) > 0) {
// $javaclassname substitution // $csclassname substitution
SwigType *pt = Getattr(parameter,"type"); SwigType *pt = Getattr(parameter,"type");
substituteJavaclassname(pt, javacls); substituteJavaclassname(pt, javacls);