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:
parent
b11d993a44
commit
3c2f9d8057
4 changed files with 338 additions and 350 deletions
|
|
@ -1,6 +1,48 @@
|
|||
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)
|
||||
[MzScheme] Applied MzScheme module updates contributed by
|
||||
John Lenz <jelenz@students.wisc.edu>.
|
||||
|
|
@ -27,20 +69,24 @@ Version 1.3.20 (In progress)
|
|||
*** NEW FEATURE [MzScheme] ***
|
||||
|
||||
06/10/2003: cheetah (William Fulton)
|
||||
[Java] New typemaps: javadestruct_base and javadestruct_derived
|
||||
for the C++ destructor wrapper. The _base version gets used by
|
||||
classes at the top of an inheritance chain and the _derived
|
||||
[Java] New typemaps: javadestruct and javadestruct_derived
|
||||
for the C++ destructor wrapper. The javadestruct version gets used by
|
||||
classes at the top of an inheritance chain and the javadestruct_derived
|
||||
version gets used by other classes.
|
||||
|
||||
[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
|
||||
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
|
||||
in an inheritance chain individually deriving from the IDisposable
|
||||
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
|
||||
Modified contract code for error message output.
|
||||
|
|
|
|||
|
|
@ -4,97 +4,96 @@
|
|||
* CSharp typemaps
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
//Initial revision of this module - the typemap names will change, in fact anything could change!!
|
||||
%include "csharphead.swg"
|
||||
|
||||
/* 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 jtype typemap contains the Java type used in the Java module class.
|
||||
* The jstype typemap contains the Java type used in the Java proxy class. */
|
||||
/* The ctype, cstype and cswtype typemaps work together and so there should be one of each.
|
||||
* The ctype typemap contains the PInvoke type used in the PInvoke (C/C++) code.
|
||||
* The cstype typemap contains the C# type used in the PInvoke class.
|
||||
* The cswtype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
|
||||
|
||||
/* Primitive types */
|
||||
%typemap(jni) bool, const bool & "bool"
|
||||
%typemap(jni) char, const char & "char"
|
||||
%typemap(jni) signed char, const signed char & "signed char"
|
||||
%typemap(jni) unsigned char, const unsigned char & "unsigned short"
|
||||
%typemap(jni) short, const short & "short"
|
||||
%typemap(jni) unsigned short, const unsigned short & "unsigned short"
|
||||
%typemap(jni) int, const int & "int"
|
||||
%typemap(jni) unsigned int, const unsigned int & "unsigned int"
|
||||
%typemap(jni) long, const long & "long"
|
||||
%typemap(jni) unsigned long, const unsigned long & "unsigned long"
|
||||
%typemap(jni) long long, const long long & "long long"
|
||||
%typemap(jni) unsigned long long, const unsigned long long & "unsigned long long"
|
||||
%typemap(jni) float, const float & "float"
|
||||
%typemap(jni) double, const double & "double"
|
||||
%typemap(jni) char * "char *"
|
||||
%typemap(jni) void "void"
|
||||
%typemap(ctype) bool, const bool & "bool"
|
||||
%typemap(ctype) char, const char & "char"
|
||||
%typemap(ctype) signed char, const signed char & "signed char"
|
||||
%typemap(ctype) unsigned char, const unsigned char & "unsigned short"
|
||||
%typemap(ctype) short, const short & "short"
|
||||
%typemap(ctype) unsigned short, const unsigned short & "unsigned short"
|
||||
%typemap(ctype) int, const int & "int"
|
||||
%typemap(ctype) unsigned int, const unsigned int & "unsigned int"
|
||||
%typemap(ctype) long, const long & "long"
|
||||
%typemap(ctype) unsigned long, const unsigned long & "unsigned long"
|
||||
%typemap(ctype) long long, const long long & "long long"
|
||||
%typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
|
||||
%typemap(ctype) float, const float & "float"
|
||||
%typemap(ctype) double, const double & "double"
|
||||
%typemap(ctype) char * "char *"
|
||||
%typemap(ctype) void "void"
|
||||
|
||||
%typemap(jtype) bool, const bool & "bool"
|
||||
%typemap(jtype) char, const char & "char"
|
||||
%typemap(jtype) signed char, const signed char & "sbyte"
|
||||
%typemap(jtype) unsigned char, const unsigned char & "byte"
|
||||
%typemap(jtype) short, const short & "short"
|
||||
%typemap(jtype) unsigned short, const unsigned short & "ushort"
|
||||
%typemap(jtype) int, const int & "int"
|
||||
%typemap(jtype) unsigned int, const unsigned int & "uint"
|
||||
%typemap(jtype) long, const long & "int"
|
||||
%typemap(jtype) unsigned long, const unsigned long & "uint"
|
||||
%typemap(jtype) long long, const long long & "long"
|
||||
%typemap(jtype) unsigned long long, const unsigned long long & "ulong"
|
||||
%typemap(jtype) float, const float & "float"
|
||||
%typemap(jtype) double, const double & "double"
|
||||
%typemap(jtype) char * "string"
|
||||
%typemap(jtype) void "void"
|
||||
%typemap(cstype) bool, const bool & "bool"
|
||||
%typemap(cstype) char, const char & "char"
|
||||
%typemap(cstype) signed char, const signed char & "sbyte"
|
||||
%typemap(cstype) unsigned char, const unsigned char & "byte"
|
||||
%typemap(cstype) short, const short & "short"
|
||||
%typemap(cstype) unsigned short, const unsigned short & "ushort"
|
||||
%typemap(cstype) int, const int & "int"
|
||||
%typemap(cstype) unsigned int, const unsigned int & "uint"
|
||||
%typemap(cstype) long, const long & "int"
|
||||
%typemap(cstype) unsigned long, const unsigned long & "uint"
|
||||
%typemap(cstype) long long, const long long & "long"
|
||||
%typemap(cstype) unsigned long long, const unsigned long long & "ulong"
|
||||
%typemap(cstype) float, const float & "float"
|
||||
%typemap(cstype) double, const double & "double"
|
||||
%typemap(cstype) char * "string"
|
||||
%typemap(cstype) void "void"
|
||||
|
||||
%typemap(jstype) bool, const bool & "bool"
|
||||
%typemap(jstype) char, const char & "char"
|
||||
%typemap(jstype) signed char, const signed char & "sbyte"
|
||||
%typemap(jstype) unsigned char, const unsigned char & "byte"
|
||||
%typemap(jstype) short, const short & "short"
|
||||
%typemap(jstype) unsigned short, const unsigned short & "ushort"
|
||||
%typemap(jstype) int, const int & "int"
|
||||
%typemap(jstype) unsigned int, const unsigned int & "uint"
|
||||
%typemap(jstype) long, const long & "int"
|
||||
%typemap(jstype) unsigned long, const unsigned long & "uint"
|
||||
%typemap(jstype) long long, const long long & "long"
|
||||
%typemap(jstype) unsigned long long, const unsigned long long & "ulong"
|
||||
%typemap(jstype) float, const float & "float"
|
||||
%typemap(jstype) double, const double & "double"
|
||||
%typemap(jstype) char * "string"
|
||||
%typemap(jstype) void "void"
|
||||
%typemap(cswtype) bool, const bool & "bool"
|
||||
%typemap(cswtype) char, const char & "char"
|
||||
%typemap(cswtype) signed char, const signed char & "sbyte"
|
||||
%typemap(cswtype) unsigned char, const unsigned char & "byte"
|
||||
%typemap(cswtype) short, const short & "short"
|
||||
%typemap(cswtype) unsigned short, const unsigned short & "ushort"
|
||||
%typemap(cswtype) int, const int & "int"
|
||||
%typemap(cswtype) unsigned int, const unsigned int & "uint"
|
||||
%typemap(cswtype) long, const long & "int"
|
||||
%typemap(cswtype) unsigned long, const unsigned long & "uint"
|
||||
%typemap(cswtype) long long, const long long & "long"
|
||||
%typemap(cswtype) unsigned long long, const unsigned long long & "ulong"
|
||||
%typemap(cswtype) float, const float & "float"
|
||||
%typemap(cswtype) double, const double & "double"
|
||||
%typemap(cswtype) char * "string"
|
||||
%typemap(cswtype) void "void"
|
||||
|
||||
%typemap(jni) char[ANY] "char *"
|
||||
%typemap(jtype) char[ANY] "string"
|
||||
%typemap(jstype) char[ANY] "string"
|
||||
%typemap(ctype) char[ANY] "char *"
|
||||
%typemap(cstype) char[ANY] "string"
|
||||
%typemap(cswtype) char[ANY] "string"
|
||||
|
||||
/* Non primitive types */
|
||||
%typemap(jni) SWIGTYPE "int"
|
||||
%typemap(jtype) SWIGTYPE "IntPtr"
|
||||
%typemap(jstype) SWIGTYPE "$&javaclassname"
|
||||
%typemap(ctype) SWIGTYPE "int"
|
||||
%typemap(cstype) SWIGTYPE "IntPtr"
|
||||
%typemap(cswtype) SWIGTYPE "$&csclassname"
|
||||
|
||||
%typemap(jni) SWIGTYPE [] "int"
|
||||
%typemap(jtype) SWIGTYPE [] "IntPtr"
|
||||
%typemap(jstype) SWIGTYPE [] "$javaclassname"
|
||||
%typemap(ctype) SWIGTYPE [] "int"
|
||||
%typemap(cstype) SWIGTYPE [] "IntPtr"
|
||||
%typemap(cswtype) SWIGTYPE [] "$csclassname"
|
||||
|
||||
%typemap(jni) SWIGTYPE * "int"
|
||||
%typemap(jtype) SWIGTYPE * "IntPtr"
|
||||
%typemap(jstype) SWIGTYPE * "$javaclassname"
|
||||
%typemap(ctype) SWIGTYPE * "int"
|
||||
%typemap(cstype) SWIGTYPE * "IntPtr"
|
||||
%typemap(cswtype) SWIGTYPE * "$csclassname"
|
||||
|
||||
%typemap(jni) SWIGTYPE & "int"
|
||||
%typemap(jtype) SWIGTYPE & "IntPtr"
|
||||
%typemap(jstype) SWIGTYPE & "$javaclassname"
|
||||
%typemap(ctype) SWIGTYPE & "int"
|
||||
%typemap(cstype) SWIGTYPE & "IntPtr"
|
||||
%typemap(cswtype) SWIGTYPE & "$csclassname"
|
||||
|
||||
%typemap(jni) enum SWIGTYPE "int"
|
||||
%typemap(jtype) enum SWIGTYPE "int"
|
||||
%typemap(jstype) enum SWIGTYPE "int"
|
||||
%typemap(ctype) enum SWIGTYPE "int"
|
||||
%typemap(cstype) enum SWIGTYPE "int"
|
||||
%typemap(cswtype) enum SWIGTYPE "int"
|
||||
|
||||
/* pointer to a class member */
|
||||
%typemap(jni) SWIGTYPE (CLASS::*) "int"
|
||||
%typemap(jtype) SWIGTYPE (CLASS::*) "IntPtr"
|
||||
%typemap(jstype) SWIGTYPE (CLASS::*) "$javaclassname"
|
||||
%typemap(ctype) SWIGTYPE (CLASS::*) "int"
|
||||
%typemap(cstype) SWIGTYPE (CLASS::*) "IntPtr"
|
||||
%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 */
|
||||
%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
|
||||
* 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 */
|
||||
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
|
||||
* used in the proxy, module or type wrapper class to the type used in the JNI class. */
|
||||
%typemap(javain) bool, const bool &,
|
||||
/* 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 PInvoke class. */
|
||||
%typemap(csin) bool, const bool &,
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
|
|
@ -337,13 +336,13 @@ $1 = &temp; %}
|
|||
char *,
|
||||
char[ANY],
|
||||
enum SWIGTYPE
|
||||
"$javainput"
|
||||
%typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)"
|
||||
%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$javaclassname.getCPtr($javainput)"
|
||||
"$csinput"
|
||||
%typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
|
||||
%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$csclassname.getCPtr($csinput)"
|
||||
|
||||
/* The javaout 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. */
|
||||
%typemap(javaout) bool, const bool &,
|
||||
/* The csout typemap is used for converting function return types from the return type
|
||||
* used in the PInvoke class to the type returned by the proxy, module or type wrapper class. */
|
||||
%typemap(csout) bool, const bool &,
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
|
|
@ -360,26 +359,26 @@ $1 = &temp; %}
|
|||
char *,
|
||||
char[ANY],
|
||||
enum SWIGTYPE {
|
||||
return $jnicall;
|
||||
return $imcall;
|
||||
}
|
||||
%typemap(javaout) void {
|
||||
$jnicall;
|
||||
%typemap(csout) void {
|
||||
$imcall;
|
||||
}
|
||||
%typemap(javaout) SWIGTYPE {
|
||||
return new $&javaclassname($jnicall, true);
|
||||
%typemap(csout) SWIGTYPE {
|
||||
return new $&csclassname($imcall, true);
|
||||
}
|
||||
%typemap(javaout) SWIGTYPE & {
|
||||
return new $javaclassname($jnicall, $owner);
|
||||
%typemap(csout) SWIGTYPE & {
|
||||
return new $csclassname($imcall, $owner);
|
||||
}
|
||||
%typemap(javaout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) {
|
||||
IntPtr cPtr = $jnicall;
|
||||
return (cPtr == IntPtr.Zero) ? null : new $javaclassname(cPtr, $owner);
|
||||
%typemap(csout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) {
|
||||
IntPtr cPtr = $imcall;
|
||||
return (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);
|
||||
}
|
||||
|
||||
/* Properties */
|
||||
%typemap(csvarin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
set {
|
||||
$jnicall;
|
||||
$imcall;
|
||||
} %}
|
||||
|
||||
%typemap(csvarout) bool, const bool &,
|
||||
|
|
@ -400,34 +399,34 @@ $1 = &temp; %}
|
|||
char[ANY],
|
||||
enum SWIGTYPE %{
|
||||
get {
|
||||
return $jnicall;
|
||||
return $imcall;
|
||||
} %}
|
||||
%typemap(csvarout) void %{
|
||||
get {
|
||||
$jnicall;
|
||||
$imcall;
|
||||
} %}
|
||||
%typemap(csvarout) SWIGTYPE %{
|
||||
get {
|
||||
return new $&javaclassname($jnicall, true);
|
||||
return new $&csclassname($imcall, true);
|
||||
} %}
|
||||
%typemap(csvarout) SWIGTYPE & %{
|
||||
get {
|
||||
return new $javaclassname($jnicall, $owner);
|
||||
return new $csclassname($imcall, $owner);
|
||||
} %}
|
||||
%typemap(csvarout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
get {
|
||||
IntPtr cPtr = $jnicall;
|
||||
return (cPtr == IntPtr.Zero) ? null : new $javaclassname(cPtr, $owner);
|
||||
IntPtr cPtr = $imcall;
|
||||
return (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);
|
||||
} %}
|
||||
|
||||
/* Typemaps used for the generation of proxy and type wrapper class code */
|
||||
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
|
||||
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
|
||||
%typemap(csinterfaces_base) SWIGTYPE "IDisposable"
|
||||
%typemap(csinterfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
|
||||
%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
|
||||
%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
|
||||
%typemap(csinterfaces) SWIGTYPE "IDisposable"
|
||||
%typemap(csinterfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
|
||||
|
||||
%typemap(csfinalize) SWIGTYPE %{
|
||||
protected override void Finalize() {
|
||||
|
|
@ -435,9 +434,9 @@ $1 = &temp; %}
|
|||
}
|
||||
%}
|
||||
|
||||
%typemap(csdestruct_base) SWIGTYPE {
|
||||
%typemap(csdestruct) SWIGTYPE {
|
||||
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
||||
$jnicall;
|
||||
$imcall;
|
||||
swigCMemOwn = false;
|
||||
}
|
||||
swigCPtr = IntPtr.Zero;
|
||||
|
|
@ -446,7 +445,7 @@ $1 = &temp; %}
|
|||
|
||||
%typemap(csdestruct_derived) SWIGTYPE {
|
||||
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
||||
$jnicall;
|
||||
$imcall;
|
||||
swigCMemOwn = false;
|
||||
}
|
||||
swigCPtr = IntPtr.Zero;
|
||||
|
|
@ -454,23 +453,23 @@ $1 = &temp; %}
|
|||
base.Dispose();
|
||||
}
|
||||
|
||||
%typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
internal static IntPtr getCPtr($javaclassname obj) {
|
||||
%typemap(csgetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
internal static IntPtr getCPtr($csclassname obj) {
|
||||
return (obj == null) ? IntPtr.Zero : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
||||
/* Java specific directives */
|
||||
#define %javaconst(flag) %feature("java:const","flag")
|
||||
#define %javamethodmodifiers %feature("java:methodmodifiers")
|
||||
/* C# specific directives */
|
||||
#define %csconst(flag) %feature("cs:const","flag")
|
||||
#define %csmethodmodifiers %feature("cs:methodmodifiers")
|
||||
|
||||
%javamethodmodifiers "public";
|
||||
%csmethodmodifiers "public";
|
||||
|
||||
%pragma(java) moduleimports=%{
|
||||
%pragma(csharp) moduleimports=%{
|
||||
using System;
|
||||
%}
|
||||
|
||||
%pragma(java) jniclassimports=%{
|
||||
%pragma(csharp) imclassimports=%{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -3,52 +3,52 @@
|
|||
* OUTPUT * and OUTPUT & as they currently break functions that return a pointer or
|
||||
* reference. */
|
||||
|
||||
%typemap(jni) bool *, bool & "bool *"
|
||||
%typemap(jni) char & "char *"
|
||||
%typemap(jni) signed char *, signed char & "signed char *"
|
||||
%typemap(jni) unsigned char *, unsigned char & "unsigned short *"
|
||||
%typemap(jni) short *, short & "short *"
|
||||
%typemap(jni) unsigned short *, unsigned short & "unsigned short *"
|
||||
%typemap(jni) int *, int & "int *"
|
||||
%typemap(jni) unsigned int *, unsigned int & "unsigned int *"
|
||||
%typemap(jni) long *, long & "long *"
|
||||
%typemap(jni) unsigned long *, unsigned long & "unsigned long *"
|
||||
%typemap(jni) long long *, long long & "long long *"
|
||||
%typemap(jni) unsigned long long *, unsigned long long & "unsigned long long *"
|
||||
%typemap(jni) float *, float & "float *"
|
||||
%typemap(jni) double *, double & "double *"
|
||||
%typemap(ctype) bool *, bool & "bool *"
|
||||
%typemap(ctype) char & "char *"
|
||||
%typemap(ctype) signed char *, signed char & "signed char *"
|
||||
%typemap(ctype) unsigned char *, unsigned char & "unsigned short *"
|
||||
%typemap(ctype) short *, short & "short *"
|
||||
%typemap(ctype) unsigned short *, unsigned short & "unsigned short *"
|
||||
%typemap(ctype) int *, int & "int *"
|
||||
%typemap(ctype) unsigned int *, unsigned int & "unsigned int *"
|
||||
%typemap(ctype) long *, long & "long *"
|
||||
%typemap(ctype) unsigned long *, unsigned long & "unsigned long *"
|
||||
%typemap(ctype) long long *, long long & "long long *"
|
||||
%typemap(ctype) unsigned long long *, unsigned long long & "unsigned long long *"
|
||||
%typemap(ctype) float *, float & "float *"
|
||||
%typemap(ctype) double *, double & "double *"
|
||||
|
||||
%typemap(jtype) bool *, bool & "ref bool"
|
||||
%typemap(jtype) char & "ref char"
|
||||
%typemap(jtype) signed char *, signed char & "ref sbyte"
|
||||
%typemap(jtype) unsigned char *, unsigned char & "ref byte"
|
||||
%typemap(jtype) short *, short & "ref short"
|
||||
%typemap(jtype) unsigned short *, unsigned short & "ref ushort"
|
||||
%typemap(jtype) int *, int & "ref int"
|
||||
%typemap(jtype) unsigned int *, unsigned int & "ref uint"
|
||||
%typemap(jtype) long *, long & "ref int"
|
||||
%typemap(jtype) unsigned long *, unsigned long & "ref uint"
|
||||
%typemap(jtype) long long *, long long & "ref long"
|
||||
%typemap(jtype) unsigned long long *, unsigned long long & "ref ulong"
|
||||
%typemap(jtype) float *, float & "ref float"
|
||||
%typemap(jtype) double *, double & "ref double"
|
||||
%typemap(cstype) bool *, bool & "ref bool"
|
||||
%typemap(cstype) char & "ref char"
|
||||
%typemap(cstype) signed char *, signed char & "ref sbyte"
|
||||
%typemap(cstype) unsigned char *, unsigned char & "ref byte"
|
||||
%typemap(cstype) short *, short & "ref short"
|
||||
%typemap(cstype) unsigned short *, unsigned short & "ref ushort"
|
||||
%typemap(cstype) int *, int & "ref int"
|
||||
%typemap(cstype) unsigned int *, unsigned int & "ref uint"
|
||||
%typemap(cstype) long *, long & "ref int"
|
||||
%typemap(cstype) unsigned long *, unsigned long & "ref uint"
|
||||
%typemap(cstype) long long *, long long & "ref long"
|
||||
%typemap(cstype) unsigned long long *, unsigned long long & "ref ulong"
|
||||
%typemap(cstype) float *, float & "ref float"
|
||||
%typemap(cstype) double *, double & "ref double"
|
||||
|
||||
%typemap(jstype) bool *, bool & "ref bool"
|
||||
%typemap(jstype) char & "ref char"
|
||||
%typemap(jstype) signed char *, signed char & "ref sbyte"
|
||||
%typemap(jstype) unsigned char *, unsigned char & "ref byte"
|
||||
%typemap(jstype) short *, short & "ref short"
|
||||
%typemap(jstype) unsigned short *, unsigned short & "ref ushort"
|
||||
%typemap(jstype) int *, int & "ref int"
|
||||
%typemap(jstype) unsigned int *, unsigned int & "ref uint"
|
||||
%typemap(jstype) long *, long & "ref int"
|
||||
%typemap(jstype) unsigned long *, unsigned long & "ref uint"
|
||||
%typemap(jstype) long long *, long long & "ref long"
|
||||
%typemap(jstype) unsigned long long *, unsigned long long & "ref ulong"
|
||||
%typemap(jstype) float *, float & "ref float"
|
||||
%typemap(jstype) double *, double & "ref double"
|
||||
%typemap(cswtype) bool *, bool & "ref bool"
|
||||
%typemap(cswtype) char & "ref char"
|
||||
%typemap(cswtype) signed char *, signed char & "ref sbyte"
|
||||
%typemap(cswtype) unsigned char *, unsigned char & "ref byte"
|
||||
%typemap(cswtype) short *, short & "ref short"
|
||||
%typemap(cswtype) unsigned short *, unsigned short & "ref ushort"
|
||||
%typemap(cswtype) int *, int & "ref int"
|
||||
%typemap(cswtype) unsigned int *, unsigned int & "ref uint"
|
||||
%typemap(cswtype) long *, long & "ref int"
|
||||
%typemap(cswtype) unsigned long *, unsigned long & "ref uint"
|
||||
%typemap(cswtype) long long *, long long & "ref long"
|
||||
%typemap(cswtype) unsigned long long *, unsigned long long & "ref ulong"
|
||||
%typemap(cswtype) float *, float & "ref float"
|
||||
%typemap(cswtype) double *, double & "ref double"
|
||||
|
||||
%typemap(javain) bool *, bool &,
|
||||
%typemap(csin) bool *, bool &,
|
||||
char &,
|
||||
signed char *, signed char &,
|
||||
unsigned char *, unsigned char &,
|
||||
|
|
@ -62,5 +62,5 @@
|
|||
unsigned long long *, unsigned long long &,
|
||||
float *, float &,
|
||||
double *, double &
|
||||
"ref $javainput"
|
||||
"ref $csinput"
|
||||
|
||||
|
|
|
|||
|
|
@ -155,22 +155,9 @@ class CSHARP : public Language {
|
|||
} else {
|
||||
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)) {
|
||||
Swig_mark_arg(i);
|
||||
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) {
|
||||
Printf(stderr,"%s\n", usage);
|
||||
}
|
||||
|
|
@ -500,22 +487,22 @@ class CSHARP : public Language {
|
|||
String *wname = Swig_name_wrapper(overloaded_name);
|
||||
|
||||
/* Attach the non-standard typemaps to the parameter list. */
|
||||
Swig_typemap_attach_parms("jni", l, f);
|
||||
Swig_typemap_attach_parms("jtype", l, f);
|
||||
Swig_typemap_attach_parms("ctype", l, f);
|
||||
Swig_typemap_attach_parms("cstype", l, f);
|
||||
|
||||
/* 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);
|
||||
} else {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
|
|
@ -557,20 +544,20 @@ class CSHARP : public Language {
|
|||
|
||||
Printf(arg,"j%s", ln);
|
||||
|
||||
/* Get the jni types of the parameter */
|
||||
if ((tm = Getattr(p,"tmap:jni"))) {
|
||||
/* Get the ctype types of the parameter */
|
||||
if ((tm = Getattr(p,"tmap:ctype"))) {
|
||||
Printv(jni_param_type, tm, NIL);
|
||||
} else {
|
||||
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 */
|
||||
if ((tm = Getattr(p,"tmap:jtype"))) {
|
||||
if ((tm = Getattr(p,"tmap:cstype"))) {
|
||||
Printv(javaparamtype, tm, NIL);
|
||||
} else {
|
||||
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 */
|
||||
|
|
@ -776,11 +763,11 @@ class CSHARP : public Language {
|
|||
String *tm;
|
||||
|
||||
// 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);
|
||||
} else {
|
||||
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
|
||||
|
|
@ -813,7 +800,7 @@ class CSHARP : public Language {
|
|||
|
||||
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. */
|
||||
if (is_enum_item) {
|
||||
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. */
|
||||
Swig_typemap_attach_parms("jstype", l, NULL);
|
||||
Swig_typemap_attach_parms("cswtype", l, NULL);
|
||||
|
||||
/* Get Java return types */
|
||||
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);
|
||||
Printf(shadowrettype, "%s", tm);
|
||||
} else {
|
||||
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
|
||||
|
|
@ -846,15 +833,15 @@ class CSHARP : public Language {
|
|||
Setattr(n, "value", new_value);
|
||||
}
|
||||
|
||||
// The %javaconst directive determines how the constant value is obtained
|
||||
String *javaconst = Getattr(n,"feature:java:const");
|
||||
bool javaconst_flag = javaconst && Cmp(javaconst, "0") != 0;
|
||||
// The %csconst directive determines how the constant value is obtained
|
||||
String *csconst = Getattr(n,"feature:java:const");
|
||||
bool csconst_flag = csconst && Cmp(csconst, "0") != 0;
|
||||
|
||||
// enums are wrapped using a public final static int in java.
|
||||
// Other constants are wrapped using a public final static [jstype] in Java.
|
||||
Printf(constants_code, " public %s %s %s = ", (javaconst_flag ? "const" : "static readonly"), shadowrettype, ((proxy_flag && wrapping_member_flag) ? variable_name : symname));
|
||||
// Other constants are wrapped using a public final static [cswtype] in Java.
|
||||
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.
|
||||
|
||||
if(is_return_type_java_class) // This handles function pointers using the %constant directive
|
||||
|
|
@ -894,11 +881,11 @@ class CSHARP : public Language {
|
|||
* pragmaDirective()
|
||||
*
|
||||
* Valid Pragmas:
|
||||
* jniclassbase - base (extends) for the JNI class
|
||||
* jniclassclassmodifiers - class modifiers for the JNI class
|
||||
* jniclasscode - text (java code) is copied verbatim to the JNI class
|
||||
* jniclassimports - import statements for the JNI class
|
||||
* jniclassinterfaces - interface (implements) for the JNI class
|
||||
* imclassbase - base (extends) for the JNI class
|
||||
* imclassclassmodifiers - class modifiers for the JNI class
|
||||
* imclasscode - text (java code) is copied verbatim to the JNI class
|
||||
* imclassimports - import statements for the JNI class
|
||||
* imclassinterfaces - interface (implements) for the JNI class
|
||||
*
|
||||
* modulebase - base (extends) 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 *value = Getattr(n,"value");
|
||||
|
||||
if(Strcmp(lang, "java") == 0) {
|
||||
if(Strcmp(lang, "csharp") == 0) {
|
||||
|
||||
String *strvalue = NewString(value);
|
||||
Replaceall(strvalue,"\\\"", "\"");
|
||||
|
||||
if(Strcmp(code, "jniclassbase") == 0) {
|
||||
if(Strcmp(code, "imclassbase") == 0) {
|
||||
Delete(jniclass_baseclass);
|
||||
jniclass_baseclass = Copy(strvalue);
|
||||
}
|
||||
else if(Strcmp(code, "jniclassclassmodifiers") == 0) {
|
||||
else if(Strcmp(code, "imclassclassmodifiers") == 0) {
|
||||
Delete(jniclass_class_modifiers);
|
||||
jniclass_class_modifiers = Copy(strvalue);
|
||||
}
|
||||
else if(Strcmp(code, "jniclasscode") == 0) {
|
||||
else if(Strcmp(code, "imclasscode") == 0) {
|
||||
Printf(jniclass_class_code, "%s\n", strvalue);
|
||||
}
|
||||
else if(Strcmp(code, "jniclassimports") == 0) {
|
||||
else if(Strcmp(code, "imclassimports") == 0) {
|
||||
Delete(jniclass_imports);
|
||||
jniclass_imports = Copy(strvalue);
|
||||
}
|
||||
else if(Strcmp(code, "jniclassinterfaces") == 0) {
|
||||
else if(Strcmp(code, "imclassinterfaces") == 0) {
|
||||
Delete(jniclass_interfaces);
|
||||
jniclass_interfaces = Copy(strvalue);
|
||||
}
|
||||
|
|
@ -956,49 +943,6 @@ class CSHARP : public Language {
|
|||
else if(Strcmp(code, "moduleinterfaces") == 0) {
|
||||
Delete(module_interfaces);
|
||||
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 {
|
||||
Printf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number);
|
||||
}
|
||||
|
|
@ -1040,21 +984,21 @@ class CSHARP : public Language {
|
|||
baseclass = NewString("");
|
||||
|
||||
// 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) {
|
||||
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);
|
||||
}
|
||||
|
||||
// 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
|
||||
Printv(shadow_classdef,
|
||||
javaTypemapLookup("javaimports", classDeclarationName, WARN_NONE), // Import statements
|
||||
javaTypemapLookup("csimports", classDeclarationName, WARN_NONE), // Import statements
|
||||
"\n",
|
||||
javaTypemapLookup("javaclassmodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
|
||||
" class $javaclassname", // Class name and bases
|
||||
javaTypemapLookup("csclassmodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
|
||||
" class $csclassname", // Class name and bases
|
||||
(derived || *Char(pure_java_baseclass) || *Char(pure_java_interfaces)) ?
|
||||
" : " :
|
||||
"",
|
||||
|
|
@ -1071,10 +1015,10 @@ class CSHARP : public Language {
|
|||
" protected bool swigCMemOwn;\n",
|
||||
"\n",
|
||||
" ",
|
||||
javaTypemapLookup("javaptrconstructormodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers
|
||||
" $javaclassname(IntPtr cPtr, bool cMemoryOwn) ", // Constructor used for wrapping pointers
|
||||
javaTypemapLookup("csptrconstructormodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers
|
||||
" $csclassname(IntPtr cPtr, bool cMemoryOwn) ", // Constructor used for wrapping pointers
|
||||
derived ?
|
||||
": base($jniclassname.$javaclassnameTo$baseclass(cPtr), cMemoryOwn) {\n" :
|
||||
": base($jniclassname.$csclassnameTo$baseclass(cPtr), cMemoryOwn) {\n" :
|
||||
"{\n swigCMemOwn = cMemoryOwn;\n",
|
||||
" swigCPtr = cPtr;\n",
|
||||
" }\n",
|
||||
|
|
@ -1083,7 +1027,7 @@ class CSHARP : public Language {
|
|||
if(!have_default_constructor_flag) { // All Java classes need a constructor
|
||||
Printv(shadow_classdef,
|
||||
"\n",
|
||||
" protected $javaclassname() : this(IntPtr.Zero, false) {\n",
|
||||
" protected $csclassname() : this(IntPtr.Zero, false) {\n",
|
||||
" }\n",
|
||||
NIL);
|
||||
}
|
||||
|
|
@ -1094,7 +1038,7 @@ class CSHARP : public Language {
|
|||
if (derived)
|
||||
tm = javaTypemapLookup("csdestruct_derived", classDeclarationName, WARN_NONE);
|
||||
else
|
||||
tm = javaTypemapLookup("csdestruct_base", classDeclarationName, WARN_NONE);
|
||||
tm = javaTypemapLookup("csdestruct", classDeclarationName, WARN_NONE);
|
||||
|
||||
// Emit the Finalize and Dispose methods
|
||||
if (tm) {
|
||||
|
|
@ -1102,30 +1046,29 @@ class CSHARP : public Language {
|
|||
if (*Char(destructor_call)) {
|
||||
Printv(shadow_classdef,
|
||||
javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE),
|
||||
"\n",
|
||||
NIL);
|
||||
}
|
||||
// Dispose method
|
||||
Printv(destruct, tm, NIL);
|
||||
if (*Char(destructor_call))
|
||||
Replaceall(destruct, "$jnicall", destructor_call);
|
||||
Replaceall(destruct, "$imcall", destructor_call);
|
||||
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))
|
||||
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);
|
||||
|
||||
// Emit various other methods
|
||||
Printv(shadow_classdef,
|
||||
javaTypemapLookup("javagetcptr", classDeclarationName, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method
|
||||
javaTypemapLookup("javacode", classDeclarationName, WARN_NONE), // extra Java code
|
||||
javaTypemapLookup("csgetcptr", classDeclarationName, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method
|
||||
javaTypemapLookup("cscode", classDeclarationName, WARN_NONE), // extra Java code
|
||||
"\n",
|
||||
NIL);
|
||||
|
||||
// Substitute various strings into the above template
|
||||
Replaceall(shadow_code, "$javaclassname", shadow_classname);
|
||||
Replaceall(shadow_classdef, "$javaclassname", shadow_classname);
|
||||
Replaceall(shadow_code, "$csclassname", shadow_classname);
|
||||
Replaceall(shadow_classdef, "$csclassname", shadow_classname);
|
||||
|
||||
Replaceall(shadow_classdef, "$baseclass", baseclass);
|
||||
Replaceall(shadow_code, "$baseclass", baseclass);
|
||||
|
|
@ -1137,10 +1080,10 @@ class CSHARP : public Language {
|
|||
if(derived){
|
||||
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 ",
|
||||
"$javaclassnameTo$baseclass(IntPtr objectRef);\n",
|
||||
"$csclassnameTo$baseclass(IntPtr objectRef);\n",
|
||||
NIL);
|
||||
|
||||
Replaceall(jniclass_cppcasts_code, "$javaclassname", shadow_classname);
|
||||
Replaceall(jniclass_cppcasts_code, "$csclassname", shadow_classname);
|
||||
Replaceall(jniclass_cppcasts_code, "$baseclass", baseclass);
|
||||
|
||||
Printv(wrapper_conversion_code,
|
||||
|
|
@ -1302,16 +1245,16 @@ class CSHARP : public Language {
|
|||
|
||||
/* Attach the non-standard typemaps to the parameter list */
|
||||
Swig_typemap_attach_parms("in", l, NULL);
|
||||
Swig_typemap_attach_parms("jstype", l, NULL);
|
||||
Swig_typemap_attach_parms("javain", l, NULL);
|
||||
Swig_typemap_attach_parms("cswtype", l, NULL);
|
||||
Swig_typemap_attach_parms("csin", l, NULL);
|
||||
|
||||
/* 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);
|
||||
Printf(shadowrettype, "%s", tm);
|
||||
} else {
|
||||
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) {
|
||||
|
|
@ -1320,7 +1263,7 @@ class CSHARP : public Language {
|
|||
}
|
||||
|
||||
/* 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)
|
||||
Printf(function_code, "static ");
|
||||
if (Getattr(n,"virtual:derived"))
|
||||
|
|
@ -1360,12 +1303,12 @@ class CSHARP : public Language {
|
|||
String *javaparamtype = NewString("");
|
||||
|
||||
/* Get the java type of the parameter */
|
||||
if ((tm = Getattr(p,"tmap:jstype"))) {
|
||||
if ((tm = Getattr(p,"tmap:cswtype"))) {
|
||||
substituteJavaclassname(pt, tm);
|
||||
Printf(javaparamtype, "%s", tm);
|
||||
} else {
|
||||
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)
|
||||
|
|
@ -1374,13 +1317,13 @@ class CSHARP : public Language {
|
|||
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)
|
||||
if ((tm = Getattr(p,"tmap:javain"))) {
|
||||
if ((tm = Getattr(p,"tmap:csin"))) {
|
||||
substituteJavaclassname(pt, tm);
|
||||
Replaceall(tm, "$javainput", arg);
|
||||
Replaceall(tm, "$csinput", arg);
|
||||
Printv(nativecall, tm, NIL);
|
||||
} else {
|
||||
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 */
|
||||
|
|
@ -1400,17 +1343,17 @@ class CSHARP : public Language {
|
|||
generateThrowsClause(n, function_code);
|
||||
|
||||
// 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"))
|
||||
Replaceall(tm,"$owner","true");
|
||||
else
|
||||
Replaceall(tm,"$owner","false");
|
||||
substituteJavaclassname(t, tm);
|
||||
Replaceall(tm, "$jnicall", nativecall);
|
||||
Replaceall(tm, "$imcall", nativecall);
|
||||
Printf(function_code, " %s\n\n", tm);
|
||||
} else {
|
||||
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) {
|
||||
|
|
@ -1423,7 +1366,7 @@ class CSHARP : public Language {
|
|||
else
|
||||
Replaceall(tm,"$owner","false");
|
||||
substituteJavaclassname(t, tm);
|
||||
Replaceall(tm, "$jnicall", nativecall);
|
||||
Replaceall(tm, "$imcall", nativecall);
|
||||
Printf(shadow_code, "%s", tm);
|
||||
} else {
|
||||
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
|
||||
|
|
@ -1437,7 +1380,7 @@ class CSHARP : public Language {
|
|||
else
|
||||
Replaceall(tm,"$owner","false");
|
||||
substituteJavaclassname(t, tm);
|
||||
Replaceall(tm, "$jnicall", nativecall);
|
||||
Replaceall(tm, "$imcall", nativecall);
|
||||
Printf(shadow_code, "%s", tm);
|
||||
} else {
|
||||
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 *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);
|
||||
|
||||
/* Attach the non-standard typemaps to the parameter list */
|
||||
Swig_typemap_attach_parms("in", l, NULL);
|
||||
Swig_typemap_attach_parms("jstype", l, NULL);
|
||||
Swig_typemap_attach_parms("javain", l, NULL);
|
||||
Swig_typemap_attach_parms("cswtype", l, NULL);
|
||||
Swig_typemap_attach_parms("csin", l, NULL);
|
||||
|
||||
emit_mark_varargs(l);
|
||||
|
||||
|
|
@ -1502,12 +1445,12 @@ class CSHARP : public Language {
|
|||
String *javaparamtype = NewString("");
|
||||
|
||||
/* Get the java type of the parameter */
|
||||
if ((tm = Getattr(p,"tmap:jstype"))) {
|
||||
if ((tm = Getattr(p,"tmap:cswtype"))) {
|
||||
substituteJavaclassname(pt, tm);
|
||||
Printf(javaparamtype, "%s", tm);
|
||||
} else {
|
||||
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)
|
||||
|
|
@ -1516,13 +1459,13 @@ class CSHARP : public Language {
|
|||
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)
|
||||
if ((tm = Getattr(p,"tmap:javain"))) {
|
||||
if ((tm = Getattr(p,"tmap:csin"))) {
|
||||
substituteJavaclassname(pt, tm);
|
||||
Replaceall(tm, "$javainput", arg);
|
||||
Replaceall(tm, "$csinput", arg);
|
||||
Printv(nativecall, tm, NIL);
|
||||
} else {
|
||||
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 */
|
||||
|
|
@ -1577,11 +1520,11 @@ class CSHARP : public Language {
|
|||
String *tm;
|
||||
|
||||
// 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);
|
||||
} else {
|
||||
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
|
||||
|
|
@ -1611,11 +1554,11 @@ class CSHARP : public Language {
|
|||
String *tm;
|
||||
|
||||
// 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);
|
||||
} else {
|
||||
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
|
||||
|
|
@ -1690,16 +1633,16 @@ class CSHARP : public Language {
|
|||
}
|
||||
|
||||
/* Attach the non-standard typemaps to the parameter list */
|
||||
Swig_typemap_attach_parms("jstype", l, NULL);
|
||||
Swig_typemap_attach_parms("javain", l, NULL);
|
||||
Swig_typemap_attach_parms("cswtype", l, NULL);
|
||||
Swig_typemap_attach_parms("csin", l, NULL);
|
||||
|
||||
/* 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);
|
||||
Printf(shadowrettype, "%s", tm);
|
||||
} else {
|
||||
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 */
|
||||
|
|
@ -1718,7 +1661,7 @@ class CSHARP : public Language {
|
|||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Get number of required and total arguments */
|
||||
|
|
@ -1739,12 +1682,12 @@ class CSHARP : public Language {
|
|||
String *javaparamtype = NewString("");
|
||||
|
||||
/* Get the java type of the parameter */
|
||||
if ((tm = Getattr(p,"tmap:jstype"))) {
|
||||
if ((tm = Getattr(p,"tmap:cswtype"))) {
|
||||
substituteJavaclassname(pt, tm);
|
||||
Printf(javaparamtype, "%s", tm);
|
||||
} else {
|
||||
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)
|
||||
|
|
@ -1753,13 +1696,13 @@ class CSHARP : public Language {
|
|||
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)
|
||||
if ((tm = Getattr(p,"tmap:javain"))) {
|
||||
if ((tm = Getattr(p,"tmap:csin"))) {
|
||||
substituteJavaclassname(pt, tm);
|
||||
Replaceall(tm, "$javainput", arg);
|
||||
Replaceall(tm, "$csinput", arg);
|
||||
Printv(nativecall, tm, NIL);
|
||||
} else {
|
||||
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 */
|
||||
|
|
@ -1778,17 +1721,17 @@ class CSHARP : public Language {
|
|||
generateThrowsClause(n, function_code);
|
||||
|
||||
// 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"))
|
||||
Replaceall(tm,"$owner","true");
|
||||
else
|
||||
Replaceall(tm,"$owner","false");
|
||||
substituteJavaclassname(t, tm);
|
||||
Replaceall(tm, "$jnicall", nativecall);
|
||||
Replaceall(tm, "$imcall", nativecall);
|
||||
Printf(function_code, " %s\n\n", tm);
|
||||
} else {
|
||||
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) {
|
||||
|
|
@ -1801,7 +1744,7 @@ class CSHARP : public Language {
|
|||
else
|
||||
Replaceall(tm,"$owner","false");
|
||||
substituteJavaclassname(t, tm);
|
||||
Replaceall(tm, "$jnicall", nativecall);
|
||||
Replaceall(tm, "$imcall", nativecall);
|
||||
Printf(module_class_code, "%s", tm);
|
||||
} else {
|
||||
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
|
||||
|
|
@ -1815,7 +1758,7 @@ class CSHARP : public Language {
|
|||
else
|
||||
Replaceall(tm,"$owner","false");
|
||||
substituteJavaclassname(t, tm);
|
||||
Replaceall(tm, "$jnicall", nativecall);
|
||||
Replaceall(tm, "$imcall", nativecall);
|
||||
Printf(module_class_code, "%s", tm);
|
||||
} else {
|
||||
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
|
||||
|
|
@ -1836,38 +1779,38 @@ class CSHARP : public Language {
|
|||
/* -----------------------------------------------------------------------------
|
||||
* substituteJavaclassname()
|
||||
*
|
||||
* Substitute $javaclassname 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
|
||||
* 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 $&csclassname substitution
|
||||
* is the same as a $&descriptor substitution, ie one pointer added to descriptor name.
|
||||
* Inputs:
|
||||
* pt - parameter type
|
||||
* tm - jstype typemap
|
||||
* tm - cswtype typemap
|
||||
* Outputs:
|
||||
* tm - jstype typemap with $javaclassname substitution
|
||||
* tm - cswtype typemap with $csclassname substitution
|
||||
* Return:
|
||||
* is_java_class - flag indicating if a substitution was performed
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
bool substituteJavaclassname(SwigType *pt, String *tm) {
|
||||
bool is_java_class = false;
|
||||
if (Strstr(tm, "$javaclassname") || Strstr(tm,"$&javaclassname")) {
|
||||
String *javaclassname = is_shadow(pt);
|
||||
if (javaclassname) {
|
||||
Replaceall(tm,"$&javaclassname", javaclassname); // is_shadow() works for pointers to classes too
|
||||
Replaceall(tm,"$javaclassname", javaclassname);
|
||||
if (Strstr(tm, "$csclassname") || Strstr(tm,"$&csclassname")) {
|
||||
String *csclassname = is_shadow(pt);
|
||||
if (csclassname) {
|
||||
Replaceall(tm,"$&csclassname", csclassname); // is_shadow() works for pointers to classes too
|
||||
Replaceall(tm,"$csclassname", csclassname);
|
||||
}
|
||||
else { // use $descriptor if SWIG does not know anything about this type. Note that any typedefs are resolved.
|
||||
String *descriptor = NULL;
|
||||
SwigType *type = Copy(SwigType_typedef_resolve_all(pt));
|
||||
|
||||
if (Strstr(tm, "$&javaclassname")) {
|
||||
if (Strstr(tm, "$&csclassname")) {
|
||||
SwigType_add_pointer(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));
|
||||
Replaceall(tm, "$javaclassname", descriptor);
|
||||
Replaceall(tm, "$csclassname", descriptor);
|
||||
}
|
||||
|
||||
// Add to hash table so that the SWIGTYPE Java classes can be created later
|
||||
|
|
@ -1911,8 +1854,8 @@ class CSHARP : public Language {
|
|||
* emitJavaClass()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void emitJavaClass(String *javaclassname, SwigType *type) {
|
||||
String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), javaclassname);
|
||||
void emitJavaClass(String *csclassname, SwigType *type) {
|
||||
String *filen = NewStringf("%s%s.cs", Swig_file_dirname(outfile), csclassname);
|
||||
File *f_swigtype = NewFile(filen,"w");
|
||||
String *swigtype = NewString("");
|
||||
|
||||
|
|
@ -1922,15 +1865,15 @@ class CSHARP : public Language {
|
|||
Printf(f_swigtype, "//package %s;\n\n", package);
|
||||
|
||||
// Pure Java baseclass and interfaces
|
||||
const String *pure_java_baseclass = javaTypemapLookup("javabase", type, WARN_NONE);
|
||||
const String *pure_java_interfaces = javaTypemapLookup("javainterfaces", type, WARN_NONE);
|
||||
const String *pure_java_baseclass = javaTypemapLookup("csbase", type, WARN_NONE);
|
||||
const String *pure_java_interfaces = javaTypemapLookup("csinterfaces", type, WARN_NONE);
|
||||
|
||||
// Emit the class
|
||||
Printv(swigtype,
|
||||
javaTypemapLookup("javaimports", type, WARN_NONE), // Import statements
|
||||
javaTypemapLookup("csimports", type, WARN_NONE), // Import statements
|
||||
"\n",
|
||||
javaTypemapLookup("javaclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
|
||||
" class $javaclassname", // Class name and bases
|
||||
javaTypemapLookup("csclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
|
||||
" class $csclassname", // Class name and bases
|
||||
*Char(pure_java_baseclass) ?
|
||||
" : " :
|
||||
"",
|
||||
|
|
@ -1943,21 +1886,21 @@ class CSHARP : public Language {
|
|||
" private IntPtr swigCPtr;\n",
|
||||
"\n",
|
||||
" ",
|
||||
javaTypemapLookup("javaptrconstructormodifiers", type, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers
|
||||
" $javaclassname(IntPtr cPtr, bool bFutureUse) {\n", // Constructor used for wrapping pointers
|
||||
javaTypemapLookup("csptrconstructormodifiers", type, WARN_JAVA_TYPEMAP_PTRCONSTMOD_UNDEF), // pointer constructor modifiers
|
||||
" $csclassname(IntPtr cPtr, bool bFutureUse) {\n", // Constructor used for wrapping pointers
|
||||
" swigCPtr = cPtr;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" protected $javaclassname() {\n", // Default constructor
|
||||
" protected $csclassname() {\n", // Default constructor
|
||||
" swigCPtr = IntPtr.Zero;\n",
|
||||
" }\n",
|
||||
javaTypemapLookup("javagetcptr", type, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method
|
||||
javaTypemapLookup("javacode", type, WARN_NONE), // extra Java code
|
||||
javaTypemapLookup("csgetcptr", type, WARN_JAVA_TYPEMAP_GETCPTR_UNDEF), // getCPtr method
|
||||
javaTypemapLookup("cscode", type, WARN_NONE), // extra Java code
|
||||
"}\n",
|
||||
"\n",
|
||||
NIL);
|
||||
|
||||
Replaceall(swigtype, "$javaclassname", javaclassname);
|
||||
Replaceall(swigtype, "$csclassname", csclassname);
|
||||
Printv(f_swigtype, swigtype, NIL);
|
||||
|
||||
Close(f_swigtype);
|
||||
|
|
@ -2012,7 +1955,7 @@ class CSHARP : public Language {
|
|||
Replaceall(javacls," ",""); // remove spaces
|
||||
Replaceall(javacls,"\t",""); // remove tabs
|
||||
if (Len(javacls) > 0) {
|
||||
// $javaclassname substitution
|
||||
// $csclassname substitution
|
||||
SwigType *pt = Getattr(parameter,"type");
|
||||
substituteJavaclassname(pt, javacls);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue