Add names to c function params
This commit is contained in:
parent
b88df82c55
commit
83ae863d4a
3 changed files with 18 additions and 6 deletions
|
|
@ -869,7 +869,7 @@ public:
|
||||||
// We want to use readable parameter names in our wrappers instead of the autogenerated arg$N if possible, so do it, and do it before calling
|
// We want to use readable parameter names in our wrappers instead of the autogenerated arg$N if possible, so do it, and do it before calling
|
||||||
// Swig_typemap_attach_parms(), as this uses the parameter names for typemap expansion.
|
// Swig_typemap_attach_parms(), as this uses the parameter names for typemap expansion.
|
||||||
for (Parm* p2 = p; p2; p2 = nextSibling(p2)) {
|
for (Parm* p2 = p; p2; p2 = nextSibling(p2)) {
|
||||||
String* name = Getattr(p, "name");
|
String* name = Getattr(p2, "name");
|
||||||
if (!name) {
|
if (!name) {
|
||||||
// Can't do anything for unnamed parameters.
|
// Can't do anything for unnamed parameters.
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2411,10 +2411,21 @@ public:
|
||||||
String *lname = 0;
|
String *lname = 0;
|
||||||
|
|
||||||
for (p = (Parm*)parms, index = 1; p; (p = nextSibling(p)), index++) {
|
for (p = (Parm*)parms, index = 1; p; (p = nextSibling(p)), index++) {
|
||||||
if(!(lname = Getattr(p, "lname"))) {
|
String* name = Getattr(p, "name");
|
||||||
lname = NewStringf("arg%d", index);
|
if (!name) {
|
||||||
Setattr(p, "lname", lname);
|
// Can't do anything for unnamed parameters.
|
||||||
|
if(!(lname = Getattr(p, "lname"))) {
|
||||||
|
lname = NewStringf("arg%d", index);
|
||||||
|
Setattr(p, "lname", lname);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
scoped_dohptr name_ptr;
|
||||||
|
if (Strstr(name, "::")) {
|
||||||
|
name_ptr = Swig_scopename_last(name);
|
||||||
|
name = name_ptr.get();
|
||||||
}
|
}
|
||||||
|
Setattr(p, "lname", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++ function wrapper
|
// C++ function wrapper
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,8 @@ const char *Swig_cresult_name(void) {
|
||||||
String *Swig_cparm_name(Parm *p, int i) {
|
String *Swig_cparm_name(Parm *p, int i) {
|
||||||
String *name = NewStringf("arg%d", i + 1);
|
String *name = NewStringf("arg%d", i + 1);
|
||||||
if (p) {
|
if (p) {
|
||||||
Setattr(p, "lname", name);
|
String *lname = Getattr(p, "lname");
|
||||||
|
if (!lname) Setattr(p, "lname", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|
|
||||||
|
|
@ -1834,7 +1834,7 @@ void Swig_typemap_attach_parms(const_String_or_char_ptr tmap_method, ParmList *p
|
||||||
for (i = 0; i < nmatch; i++) {
|
for (i = 0; i < nmatch; i++) {
|
||||||
SwigType *type = Getattr(p, "type");
|
SwigType *type = Getattr(p, "type");
|
||||||
String *pname = Getattr(p, "name");
|
String *pname = Getattr(p, "name");
|
||||||
String *lname = Getattr(p, "lname");
|
String *lname = Swig_cparm_name(p, argnum-1);
|
||||||
SwigType *mtype = Getattr(p, "tmap:match");
|
SwigType *mtype = Getattr(p, "tmap:match");
|
||||||
SwigType *matchtype = mtype ? mtype : type;
|
SwigType *matchtype = mtype ? mtype : type;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue