diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index a3e5c2d06..12b4d2a5f 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -1320,11 +1320,19 @@ class CSHARP : public Language { if (!static_flag) Printv(nativecall, "swigCPtr", NIL); + emit_mark_varargs(l); + int gencomma = !static_flag; /* Output each parameter */ for (i = 0, p=l; p; i++) { + /* Ignored varargs */ + if (checkAttribute(p,"varargs:ignore","1")) { + p = nextSibling(p); + continue; + } + /* Ignored parameters */ if (checkAttribute(p,"tmap:in:numinputs","0")) { p = Getattr(p,"tmap:in:next"); @@ -1457,11 +1465,19 @@ class CSHARP : public Language { Swig_typemap_attach_parms("jstype", l, NULL); Swig_typemap_attach_parms("javain", l, NULL); + emit_mark_varargs(l); + int gencomma = 0; /* Output each parameter */ for (i = 0, p=l; p; i++) { + /* Ignored varargs */ + if (checkAttribute(p,"varargs:ignore","1")) { + p = nextSibling(p); + continue; + } + /* Ignored parameters */ if (checkAttribute(p,"tmap:in:numinputs","0")) { p = Getattr(p,"tmap:in:next"); @@ -2045,7 +2061,7 @@ swig_csharp(void) { * ----------------------------------------------------------------------------- */ const char *CSHARP::usage = (char*)"\ -CSharp Options (available with -csharp)\n\ +C# Options (available with -csharp)\n\ -package - set name of the assembly\n\ -noproxy - Generate the low-level functional interface instead of proxy classes\n\ \n"; diff --git a/Source/Modules/emit.cxx b/Source/Modules/emit.cxx index 1bbb0c459..a38ecdeec 100644 --- a/Source/Modules/emit.cxx +++ b/Source/Modules/emit.cxx @@ -328,6 +328,24 @@ emit_isvarargs(ParmList *p) { return 0; } +/* ----------------------------------------------------------------------------- + * void emit_mark_vararg_parms() + * + * Marks the vararg parameters which are to be ignored. + * Vararg parameters are marked as ignored if there is no 'in' varargs (...) + * typemap. + * ----------------------------------------------------------------------------- */ + +void emit_mark_varargs(ParmList *l) { + Parm *p = l; + while (p) { + if (SwigType_isvarargs(Getattr(p,"type"))) + if (!Getattr(p,"tmap:in")) + Setattr(p,"varargs:ignore","1"); + p = nextSibling(p); + } +} + /* ----------------------------------------------------------------------------- * replace_args() * ----------------------------------------------------------------------------- */ @@ -454,5 +472,3 @@ void emit_action(Node *n, Wrapper *f) { } - - diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 9b2a2e77a..ab7656ef8 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -554,7 +554,6 @@ class JAVA : public Language { /* Get number of required and total arguments */ num_arguments = emit_num_arguments(l); num_required = emit_num_required(l); - int gencomma = 0; // Now walk the function parameter list and generate code to get arguments @@ -1314,11 +1313,19 @@ class JAVA : public Language { if (!static_flag) Printv(nativecall, "swigCPtr", NIL); + emit_mark_varargs(l); + int gencomma = !static_flag; /* Output each parameter */ for (i = 0, p=l; p; i++) { + /* Ignored varargs */ + if (checkAttribute(p,"varargs:ignore","1")) { + p = nextSibling(p); + continue; + } + /* Ignored parameters */ if (checkAttribute(p,"tmap:in:numinputs","0")) { p = Getattr(p,"tmap:in:next"); @@ -1417,11 +1424,19 @@ class JAVA : public Language { Swig_typemap_attach_parms("jstype", l, NULL); Swig_typemap_attach_parms("javain", l, NULL); + emit_mark_varargs(l); + int gencomma = 0; /* Output each parameter */ for (i = 0, p=l; p; i++) { + /* Ignored varargs */ + if (checkAttribute(p,"varargs:ignore","1")) { + p = nextSibling(p); + continue; + } + /* Ignored parameters */ if (checkAttribute(p,"tmap:in:numinputs","0")) { p = Getattr(p,"tmap:in:next"); diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h index d53372edc..34d485839 100644 --- a/Source/Modules/swigmod.h +++ b/Source/Modules/swigmod.h @@ -260,6 +260,7 @@ extern int emit_num_arguments(ParmList *); extern int emit_num_required(ParmList *); extern int emit_isvarargs(ParmList *); extern void emit_attach_parmmaps(ParmList *, Wrapper *f); +extern void emit_mark_varargs(ParmList *l); extern void emit_action(Node *n, Wrapper *f); extern List *Swig_overload_rank(Node *n); extern String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *);