C# typemap name change twiddle

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4897 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-06-12 12:32:08 +00:00
commit 4667d7bf2a
4 changed files with 80 additions and 80 deletions

View file

@ -7,8 +7,8 @@ Version 1.3.20 (In progress)
Typemap name changes:
jni -> ctype
jtype -> cstype
jstype -> cswtype
jtype -> imtype
jstype -> cstype
javain -> csin
javaout -> csout
javainterfaces -> csinterfaces

View file

@ -6,10 +6,10 @@
%include "csharphead.swg"
/* The ctype, cstype and cswtype typemaps work together and so there should be one of each.
/* The ctype, imtype and cstype 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. */
* The imtype typemap contains the C# type used in the intermediary class.
* The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
/* Primitive types */
%typemap(ctype) bool, const bool & "bool"
@ -29,6 +29,23 @@
%typemap(ctype) char * "char *"
%typemap(ctype) void "void"
%typemap(imtype) bool, const bool & "bool"
%typemap(imtype) char, const char & "char"
%typemap(imtype) signed char, const signed char & "sbyte"
%typemap(imtype) unsigned char, const unsigned char & "byte"
%typemap(imtype) short, const short & "short"
%typemap(imtype) unsigned short, const unsigned short & "ushort"
%typemap(imtype) int, const int & "int"
%typemap(imtype) unsigned int, const unsigned int & "uint"
%typemap(imtype) long, const long & "int"
%typemap(imtype) unsigned long, const unsigned long & "uint"
%typemap(imtype) long long, const long long & "long"
%typemap(imtype) unsigned long long, const unsigned long long & "ulong"
%typemap(imtype) float, const float & "float"
%typemap(imtype) double, const double & "double"
%typemap(imtype) char * "string"
%typemap(imtype) void "void"
%typemap(cstype) bool, const bool & "bool"
%typemap(cstype) char, const char & "char"
%typemap(cstype) signed char, const signed char & "sbyte"
@ -46,52 +63,35 @@
%typemap(cstype) char * "string"
%typemap(cstype) 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(ctype) char[ANY] "char *"
%typemap(imtype) char[ANY] "string"
%typemap(cstype) char[ANY] "string"
%typemap(cswtype) char[ANY] "string"
/* Non primitive types */
%typemap(ctype) SWIGTYPE "int"
%typemap(cstype) SWIGTYPE "IntPtr"
%typemap(cswtype) SWIGTYPE "$&csclassname"
%typemap(imtype) SWIGTYPE "IntPtr"
%typemap(cstype) SWIGTYPE "$&csclassname"
%typemap(ctype) SWIGTYPE [] "int"
%typemap(cstype) SWIGTYPE [] "IntPtr"
%typemap(cswtype) SWIGTYPE [] "$csclassname"
%typemap(imtype) SWIGTYPE [] "IntPtr"
%typemap(cstype) SWIGTYPE [] "$csclassname"
%typemap(ctype) SWIGTYPE * "int"
%typemap(cstype) SWIGTYPE * "IntPtr"
%typemap(cswtype) SWIGTYPE * "$csclassname"
%typemap(imtype) SWIGTYPE * "IntPtr"
%typemap(cstype) SWIGTYPE * "$csclassname"
%typemap(ctype) SWIGTYPE & "int"
%typemap(cstype) SWIGTYPE & "IntPtr"
%typemap(cswtype) SWIGTYPE & "$csclassname"
%typemap(imtype) SWIGTYPE & "IntPtr"
%typemap(cstype) SWIGTYPE & "$csclassname"
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "int"
%typemap(cswtype) enum SWIGTYPE "int"
/* pointer to a class member */
%typemap(ctype) SWIGTYPE (CLASS::*) "int"
%typemap(cstype) SWIGTYPE (CLASS::*) "IntPtr"
%typemap(cswtype) SWIGTYPE (CLASS::*) "$csclassname"
%typemap(imtype) SWIGTYPE (CLASS::*) "IntPtr"
%typemap(cstype) SWIGTYPE (CLASS::*) "$csclassname"
/* 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. */

View file

@ -18,6 +18,21 @@
%typemap(ctype) float *, float & "float *"
%typemap(ctype) double *, double & "double *"
%typemap(imtype) bool *, bool & "ref bool"
%typemap(imtype) char & "ref char"
%typemap(imtype) signed char *, signed char & "ref sbyte"
%typemap(imtype) unsigned char *, unsigned char & "ref byte"
%typemap(imtype) short *, short & "ref short"
%typemap(imtype) unsigned short *, unsigned short & "ref ushort"
%typemap(imtype) int *, int & "ref int"
%typemap(imtype) unsigned int *, unsigned int & "ref uint"
%typemap(imtype) long *, long & "ref int"
%typemap(imtype) unsigned long *, unsigned long & "ref uint"
%typemap(imtype) long long *, long long & "ref long"
%typemap(imtype) unsigned long long *, unsigned long long & "ref ulong"
%typemap(imtype) float *, float & "ref float"
%typemap(imtype) double *, double & "ref double"
%typemap(cstype) bool *, bool & "ref bool"
%typemap(cstype) char & "ref char"
%typemap(cstype) signed char *, signed char & "ref sbyte"
@ -33,21 +48,6 @@
%typemap(cstype) float *, float & "ref float"
%typemap(cstype) 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(csin) bool *, bool &,
char &,
signed char *, signed char &,

View file

@ -474,7 +474,7 @@ class CSHARP : public Language {
/* Attach the non-standard typemaps to the parameter list. */
Swig_typemap_attach_parms("ctype", l, f);
Swig_typemap_attach_parms("cstype", l, f);
Swig_typemap_attach_parms("imtype", l, f);
/* Get return types */
if ((tm = Swig_typemap_lookup_new("ctype",n,"",0))) {
@ -484,11 +484,11 @@ class CSHARP : public Language {
"No ctype typemap defined for %s\n", SwigType_str(t,0));
}
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
if ((tm = Swig_typemap_lookup_new("imtype",n,"",0))) {
Printf(im_return_type,"%s", tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number,
"No cstype typemap defined for %s\n", SwigType_str(t,0));
"No imtype typemap defined for %s\n", SwigType_str(t,0));
}
is_void_return = (Cmp(c_return_type, "void") == 0);
@ -538,11 +538,11 @@ class CSHARP : public Language {
}
/* Get the intermediary class parameter types of the parameter */
if ((tm = Getattr(p,"tmap:cstype"))) {
if ((tm = Getattr(p,"tmap:imtype"))) {
Printv(im_param_type, tm, NIL);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number,
"No cstype typemap defined for %s\n", SwigType_str(pt,0));
"No imtype typemap defined for %s\n", SwigType_str(pt,0));
}
/* Add parameter to intermediary class method */
@ -745,11 +745,11 @@ class CSHARP : public Language {
String *tm;
// Get the variable type
if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
substituteClassname(t, tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(t,0));
"No cstype typemap defined for %s\n", SwigType_str(t,0));
}
// Output the property's field declaration and accessor methods
@ -782,7 +782,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 cswtype typemap for all the enum items.
/* Adjust the enum type for the Swig_typemap_lookup. We want the same cstype 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"));
@ -790,17 +790,17 @@ class CSHARP : public Language {
}
/* Attach the non-standard typemaps to the parameter list. */
Swig_typemap_attach_parms("cswtype", l, NULL);
Swig_typemap_attach_parms("cstype", l, NULL);
/* Get C# return types */
bool classname_substituted_flag = false;
if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
classname_substituted_flag = substituteClassname(t, tm);
Printf(return_type, "%s", tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(t,0));
"No cstype typemap defined for %s\n", SwigType_str(t,0));
}
// Add the stripped quotes back in
@ -820,7 +820,7 @@ class CSHARP : public Language {
bool const_feature_flag = const_feature && Cmp(const_feature, "0") != 0;
// enums are wrapped using a public final static int in C#.
// Other constants are wrapped using a public final static [cswtype] in C#.
// Other constants are wrapped using a public final static [cstype] in C#.
Printf(constants_code, " public %s %s %s = ", (const_feature_flag ? "const" : "static readonly"), return_type, ((proxy_flag && wrapping_member_flag) ? variable_name : symname));
if ((is_enum_item && Getattr(n,"enumvalue") == 0) || !const_feature_flag) {
@ -1226,16 +1226,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("cswtype", l, NULL);
Swig_typemap_attach_parms("cstype", l, NULL);
Swig_typemap_attach_parms("csin", l, NULL);
/* Get return types */
if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
substituteClassname(t, tm);
Printf(return_type, "%s", tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(t,0));
"No cstype typemap defined for %s\n", SwigType_str(t,0));
}
if(proxy_flag && wrapping_member_flag && !enum_constant_flag) {
@ -1284,12 +1284,12 @@ class CSHARP : public Language {
String *param_type = NewString("");
/* Get the C# parameter type */
if ((tm = Getattr(p,"tmap:cswtype"))) {
if ((tm = Getattr(p,"tmap:cstype"))) {
substituteClassname(pt, tm);
Printf(param_type, "%s", tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(pt,0));
"No cstype typemap defined for %s\n", SwigType_str(pt,0));
}
if (gencomma)
@ -1400,7 +1400,7 @@ class CSHARP : public Language {
/* Attach the non-standard typemaps to the parameter list */
Swig_typemap_attach_parms("in", l, NULL);
Swig_typemap_attach_parms("cswtype", l, NULL);
Swig_typemap_attach_parms("cstype", l, NULL);
Swig_typemap_attach_parms("csin", l, NULL);
emit_mark_varargs(l);
@ -1426,12 +1426,12 @@ class CSHARP : public Language {
String *param_type = NewString("");
/* Get the C# parameter type */
if ((tm = Getattr(p,"tmap:cswtype"))) {
if ((tm = Getattr(p,"tmap:cstype"))) {
substituteClassname(pt, tm);
Printf(param_type, "%s", tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(pt,0));
"No cstype typemap defined for %s\n", SwigType_str(pt,0));
}
if (gencomma)
@ -1501,11 +1501,11 @@ class CSHARP : public Language {
String *tm;
// Get the variable type
if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
substituteClassname(t, tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(t,0));
"No cstype typemap defined for %s\n", SwigType_str(t,0));
}
// Output the property's field declaration and accessor methods
@ -1535,11 +1535,11 @@ class CSHARP : public Language {
String *tm;
// Get the variable type
if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
substituteClassname(t, tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(t,0));
"No cstype typemap defined for %s\n", SwigType_str(t,0));
}
// Output the property's field declaration and accessor methods
@ -1614,16 +1614,16 @@ class CSHARP : public Language {
}
/* Attach the non-standard typemaps to the parameter list */
Swig_typemap_attach_parms("cswtype", l, NULL);
Swig_typemap_attach_parms("cstype", l, NULL);
Swig_typemap_attach_parms("csin", l, NULL);
/* Get return types */
if ((tm = Swig_typemap_lookup_new("cswtype",n,"",0))) {
if ((tm = Swig_typemap_lookup_new("cstype",n,"",0))) {
substituteClassname(t, tm);
Printf(return_type, "%s", tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(t,0));
"No cstype typemap defined for %s\n", SwigType_str(t,0));
}
/* Change function name for global variables */
@ -1663,12 +1663,12 @@ class CSHARP : public Language {
String *param_type = NewString("");
/* Get the C# parameter type */
if ((tm = Getattr(p,"tmap:cswtype"))) {
if ((tm = Getattr(p,"tmap:cstype"))) {
substituteClassname(pt, tm);
Printf(param_type, "%s", tm);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_JSWTYPE_UNDEF, input_file, line_number,
"No cswtype typemap defined for %s\n", SwigType_str(pt,0));
"No cstype typemap defined for %s\n", SwigType_str(pt,0));
}
if (gencomma)
@ -1765,9 +1765,9 @@ class CSHARP : public Language {
* is the same as a $&descriptor substitution, ie one pointer added to descriptor name.
* Inputs:
* pt - parameter type
* tm - cswtype typemap
* tm - cstype typemap
* Outputs:
* tm - cswtype typemap with $csclassname substitution
* tm - cstype typemap with $csclassname substitution
* Return:
* substitution_performed - flag indicating if a substitution was performed
* ----------------------------------------------------------------------------- */