aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2003-06-11 19:52:27 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2003-06-11 19:52:27 +0000
commitb983da351d65d2e0eea47a95240da16c914a6787 (patch)
treee3fcb7391cee74e3969d035907c431f7d50869f0 /Source
parent21948a15cc6708e4167387864b870e813b0b6901 (diff)
downloadswig-b983da351d65d2e0eea47a95240da16c914a6787.tar.gz
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/SWIG@4890 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Source')
-rw-r--r--Source/Modules/csharp.cxx301
1 files changed, 122 insertions, 179 deletions
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index d8099a8dc..512bde451 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -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);