Add 'directorinattributes' and 'directoroutattributes' typemap attributes for the imtype typemap. These should contain C# attributes which will be generated into the C# director delegates methods.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10212 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-01-18 23:35:49 +00:00
commit bc94eeb6a0
2 changed files with 28 additions and 16 deletions

View file

@ -1,6 +1,11 @@
Version 1.3.34 (in progress) Version 1.3.34 (in progress)
============================ ============================
01/18/2008: wsfulton
Add 'directorinattributes' and 'directoroutattributes' typemap attributes
for the imtype typemap. These should contain C# attributes which will
be generated into the C# director delegate methods.
01/18/2008: olly 01/18/2008: olly
Fix handling of byte value 255 in input files on platforms where Fix handling of byte value 255 in input files on platforms where
char is signed (it was getting mapped to EOF). Fixes SF#1518219. char is signed (it was getting mapped to EOF). Fixes SF#1518219.

View file

@ -702,7 +702,7 @@ public:
String *cleanup = NewString(""); String *cleanup = NewString("");
String *outarg = NewString(""); String *outarg = NewString("");
String *body = NewString(""); String *body = NewString("");
String *im_outattribute = 0; String *im_outattributes = 0;
int num_arguments = 0; int num_arguments = 0;
int num_required = 0; int num_required = 0;
bool is_void_return; bool is_void_return;
@ -744,7 +744,7 @@ public:
if (imtypeout) if (imtypeout)
tm = imtypeout; tm = imtypeout;
Printf(im_return_type, "%s", tm); Printf(im_return_type, "%s", tm);
im_outattribute = Getattr(n, "tmap:imtype:outattributes"); im_outattributes = Getattr(n, "tmap:imtype:outattributes");
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(t, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(t, 0));
} }
@ -775,8 +775,8 @@ public:
Printv(imclass_class_code, "\n [DllImport(\"", dllimport, "\", EntryPoint=\"CSharp_", overloaded_name, "\")]\n", NIL); Printv(imclass_class_code, "\n [DllImport(\"", dllimport, "\", EntryPoint=\"CSharp_", overloaded_name, "\")]\n", NIL);
if (im_outattribute) if (im_outattributes)
Printf(imclass_class_code, " %s\n", im_outattribute); Printf(imclass_class_code, " %s\n", im_outattributes);
Printf(imclass_class_code, " public static extern %s %s(", im_return_type, overloaded_name); Printf(imclass_class_code, " public static extern %s %s(", im_return_type, overloaded_name);
@ -810,8 +810,8 @@ public:
/* Get the intermediary class parameter types of the parameter */ /* Get the intermediary class parameter types of the parameter */
if ((tm = Getattr(p, "tmap:imtype"))) { if ((tm = Getattr(p, "tmap:imtype"))) {
String *inattributes = Getattr(p, "tmap:imtype:inattributes"); const String *inattributes = Getattr(p, "tmap:imtype:inattributes");
Printf(im_param_type, "%s%s", inattributes ? (const String *) inattributes : empty_string, tm); Printf(im_param_type, "%s%s", inattributes ? inattributes : empty_string, tm);
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(pt, 0));
} }
@ -1991,8 +1991,8 @@ public:
/* Get the C# parameter type */ /* Get the C# parameter type */
if ((tm = Getattr(p, "tmap:cstype"))) { if ((tm = Getattr(p, "tmap:cstype"))) {
substituteClassname(pt, tm); substituteClassname(pt, tm);
String *inattributes = Getattr(p, "tmap:cstype:inattributes"); const String *inattributes = Getattr(p, "tmap:cstype:inattributes");
Printf(param_type, "%s%s", inattributes ? (const String *) inattributes : empty_string, tm); Printf(param_type, "%s%s", inattributes ? inattributes : empty_string, tm);
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0));
} }
@ -2241,8 +2241,8 @@ public:
/* Get the C# parameter type */ /* Get the C# parameter type */
if ((tm = Getattr(p, "tmap:cstype"))) { if ((tm = Getattr(p, "tmap:cstype"))) {
substituteClassname(pt, tm); substituteClassname(pt, tm);
String *inattributes = Getattr(p, "tmap:cstype:inattributes"); const String *inattributes = Getattr(p, "tmap:cstype:inattributes");
Printf(param_type, "%s%s", inattributes ? (const String *) inattributes : empty_string, tm); Printf(param_type, "%s%s", inattributes ? inattributes : empty_string, tm);
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0));
} }
@ -2343,9 +2343,9 @@ public:
} }
Printf(helper_code, "\n }\n"); Printf(helper_code, "\n }\n");
String *helper_name = NewStringf("%s.SwigConstruct%s(%s)", proxy_class_name, proxy_class_name, helper_args); String *helper_name = NewStringf("%s.SwigConstruct%s(%s)", proxy_class_name, proxy_class_name, helper_args);
String *im_outattribute = Getattr(n, "tmap:imtype:outattributes"); String *im_outattributes = Getattr(n, "tmap:imtype:outattributes");
if (im_outattribute) if (im_outattributes)
Printf(proxy_class_code, " %s\n", im_outattribute); Printf(proxy_class_code, " %s\n", im_outattributes);
Printv(proxy_class_code, helper_code, "\n", NIL); Printv(proxy_class_code, helper_code, "\n", NIL);
Replaceall(function_code, "$imcall", helper_name); Replaceall(function_code, "$imcall", helper_name);
Delete(helper_name); Delete(helper_name);
@ -2548,8 +2548,8 @@ public:
/* Get the C# parameter type */ /* Get the C# parameter type */
if ((tm = Getattr(p, "tmap:cstype"))) { if ((tm = Getattr(p, "tmap:cstype"))) {
substituteClassname(pt, tm); substituteClassname(pt, tm);
String *inattributes = Getattr(p, "tmap:cstype:inattributes"); const String *inattributes = Getattr(p, "tmap:cstype:inattributes");
Printf(param_type, "%s%s", inattributes ? (const String *) inattributes : empty_string, tm); Printf(param_type, "%s%s", inattributes ? inattributes : empty_string, tm);
} else { } else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0)); Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0));
} }
@ -3237,6 +3237,12 @@ public:
String *imtypeout = Getattr(tp, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap String *imtypeout = Getattr(tp, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap
if (imtypeout) if (imtypeout)
tm = imtypeout; tm = imtypeout;
const String *im_directoroutattributes = Getattr(tp, "tmap:imtype:directoroutattributes");
if (im_directoroutattributes) {
Printf(callback_def, " %s\n", im_directoroutattributes);
Printf(director_delegate_definitions, " %s\n", im_directoroutattributes);
}
Printf(callback_def, " private %s SwigDirector%s(", tm, overloaded_name); Printf(callback_def, " private %s SwigDirector%s(", tm, overloaded_name);
if (!ignored_method) if (!ignored_method)
Printf(director_delegate_definitions, " public delegate %s", tm); Printf(director_delegate_definitions, " public delegate %s", tm);
@ -3367,6 +3373,7 @@ public:
String *imtypeout = Getattr(p, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap String *imtypeout = Getattr(p, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap
if (imtypeout) if (imtypeout)
tm = imtypeout; tm = imtypeout;
const String *im_directorinattributes = Getattr(p, "tmap:imtype:directorinattributes");
String *din = Copy(Getattr(p, "tmap:csdirectorin")); String *din = Copy(Getattr(p, "tmap:csdirectorin"));
@ -3381,7 +3388,7 @@ public:
Printf(proxy_method_types, ", "); Printf(proxy_method_types, ", ");
Printf(imcall_args, ", "); Printf(imcall_args, ", ");
} }
Printf(delegate_parms, "%s %s", tm, ln); Printf(delegate_parms, "%s%s %s", im_directorinattributes ? im_directorinattributes : empty_string, tm, ln);
if (Cmp(din, ln)) { if (Cmp(din, ln)) {
Printv(imcall_args, din, NIL); Printv(imcall_args, din, NIL);