8
8
* the naming of local variables, calling conventions, and so forth.
9
9
* ----------------------------------------------------------------------------- */
11
char cvsroot_cwrap_c[] = "$Header: /cvsroot/swig/SWIG/Source/Swig/cwrap.c,v 1.92 2006/11/10 23:08:51 wsfulton Exp $";
11
char cvsroot_cwrap_c[] = "$Id: cwrap.c 9633 2007-01-10 23:43:07Z beazley $";
16
15
extern int cparse_cplusplus;
18
17
static Parm *nonvoid_parms(Parm *p) {
20
SwigType *t = Getattr(p, k_type);
19
SwigType *t = Getattr(p, "type");
21
20
if (SwigType_type(t) == T_VOID)
192
191
String *lname = Swig_cparm_name(p, i);
193
SwigType *pt = Getattr(p, k_type);
192
SwigType *pt = Getattr(p, "type");
194
193
if ((SwigType_type(pt) != T_VOID)) {
195
194
String *local = 0;
196
String *type = Getattr(p, k_type);
195
String *type = Getattr(p, "type");
197
196
/* default values only emitted if in compact default args mode */
198
String *pvalue = (compactdefargs) ? Getattr(p, k_value) : 0;
197
String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0;
199
198
SwigType *altty = SwigType_alttype(type, 0);
200
199
int tycode = SwigType_type(type);
201
200
if (tycode == T_REFERENCE) {
504
503
func = NewStringEmpty();
505
504
Printf(func, "new %s(", nname);
507
pt = Getattr(p, k_type);
506
pt = Getattr(p, "type");
508
507
if ((SwigType_type(pt) != T_VOID)) {
509
508
String *rcaststr = 0;
510
509
String *pname = 0;
512
511
Append(func, ",");
513
if (!Getattr(p, k_argbyname)) {
512
if (!Getattr(p, "arg:byname")) {
514
513
pname = Swig_cparm_name(p, i);
517
if ((pname = Getattr(p, k_value)))
516
if ((pname = Getattr(p, "value")))
518
517
pname = Copy(pname);
520
pname = Copy(Getattr(p, k_name));
519
pname = Copy(Getattr(p, "name"));
522
521
rcaststr = SwigType_rcaststr(pt, pname);
523
522
Append(func, rcaststr);
769
768
* ----------------------------------------------------------------------------- */
770
769
int Swig_add_extension_code(Node *n, const String *function_name, ParmList *parms, SwigType *return_type, const String *code, int cplusplus, const String *self) {
771
770
String *body = extension_code(function_name, parms, return_type, code, cplusplus, self);
772
Setattr(n, k_wrapcode, body);
771
Setattr(n, "wrap:code", body);
796
795
/* If node is a member template expansion, we don't allow added code */
797
if (Getattr(n, k_templatetype))
796
if (Getattr(n, "templatetype"))
798
797
flags &= ~(CWRAP_EXTEND);
800
name = Getattr(n, k_name);
801
qualifier = Getattr(n, k_qualifier);
802
parms = CopyParmList(nonvoid_parms(Getattr(n, k_parms)));
799
name = Getattr(n, "name");
800
qualifier = Getattr(n, "qualifier");
801
parms = CopyParmList(nonvoid_parms(Getattr(n, "parms")));
804
803
type = NewString(classname);
806
805
SwigType_push(type, qualifier);
808
807
SwigType_add_pointer(type);
809
p = NewParm(type, k_self);
810
Setattr(p, k_self, "1");
811
Setattr(p, k_hidden, "1");
808
p = NewParm(type, "self");
809
Setattr(p, "self", "1");
810
Setattr(p, "hidden","1");
813
812
Disable the 'this' ownership in 'self' to manage inplace
844
843
String *call = 0;
845
844
String *cres = 0;
846
845
String *explicitcall_name = 0;
847
int pure_virtual = !(Cmp(Getattr(n, k_storage), "virtual")) && !(Cmp(Getattr(n, k_value), "0"));
846
int pure_virtual = !(Cmp(Getattr(n, "storage"), "virtual")) && !(Cmp(Getattr(n, "value"), "0"));
849
848
/* Call the explicit method rather than allow for a polymorphic call */
850
849
if ((flags & CWRAP_DIRECTOR_TWO_CALLS) || (flags & CWRAP_DIRECTOR_ONE_CALL)) {
851
850
String *access = Getattr(n, "access");
852
851
if (access && (Cmp(access, "protected") == 0)) {
853
852
/* If protected access (can only be if a director method) then call the extra public accessor method (language module must provide this) */
854
String *explicit_qualifier_tmp = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), k_qname));
853
String *explicit_qualifier_tmp = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname"));
855
854
explicitcall_name = NewStringf("%sSwigPublic", name);
856
855
explicit_qualifier = NewStringf("SwigDirector_%s", explicit_qualifier_tmp);
857
856
Delete(explicit_qualifier_tmp);
859
explicit_qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), k_qname));
858
explicit_qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname"));
863
862
call = Swig_cmethod_call(explicitcall_name ? explicitcall_name : name, p, self, explicit_qualifier, director_type);
864
cres = Swig_cresult(Getattr(n, k_type), k_result, call);
863
cres = Swig_cresult(Getattr(n, "type"), "result", call);
866
865
if (pure_virtual && is_director && (flags & CWRAP_DIRECTOR_TWO_CALLS)) {
867
String *qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), k_qname));
866
String *qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname"));
869
868
cres = NewStringf("Swig::DirectorPureVirtualException::raise(\"%s::%s\");", qualifier, name);
870
869
Delete(qualifier);
874
873
/* Create two method calls, one to call the explicit method, the other a normal polymorphic function call */
875
874
String *cres_both_calls = NewStringf("");
876
875
String *call_extra = Swig_cmethod_call(name, p, self, 0, director_type);
877
String *cres_extra = Swig_cresult(Getattr(n, k_type), k_result, call_extra);
876
String *cres_extra = Swig_cresult(Getattr(n, "type"), "result", call_extra);
878
877
Printv(cres_both_calls, "if (upcall) {\n", cres, "\n", "} else {", cres_extra, "\n}", NIL);
879
Setattr(n, k_wrapaction, cres_both_calls);
878
Setattr(n, "wrap:action", cres_both_calls);
880
879
Delete(cres_extra);
881
880
Delete(call_extra);
882
881
Delete(cres_both_calls);
884
Setattr(n, k_wrapaction, cres);
883
Setattr(n, "wrap:action", cres);
887
886
Delete(explicitcall_name);
892
891
/* Methods with default arguments are wrapped with additional methods for each default argument,
893
892
* however, only one extra %extend method is generated. */
895
String *defaultargs = Getattr(n, k_defaultargs);
896
String *code = Getattr(n, k_code);
897
String *cname = Getattr(n, k_classname) ? Getattr(n, k_classname) : classname;
894
String *defaultargs = Getattr(n, "defaultargs");
895
String *code = Getattr(n, "code");
896
String *cname = Getattr(n, "classname") ? Getattr(n, "classname") : classname;
898
897
String *membername = Swig_name_member(cname, name);
899
898
String *mangled = Swig_name_mangle(membername);
900
899
int is_smart_pointer = flags & CWRAP_SMART_POINTER;
902
type = Getattr(n, k_type);
901
type = Getattr(n, "type");
904
903
/* Check if the method is overloaded. If so, and it has code attached, we append an extra suffix
905
904
to avoid a name-clash in the generated wrappers. This allows overloaded methods to be defined
907
if (Getattr(n, k_symoverloaded) && code) {
908
Append(mangled, Getattr(defaultargs ? defaultargs : n, k_symovername));
906
if (Getattr(n, "sym:overloaded") && code) {
907
Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
911
910
/* See if there is any code that we need to emit */
912
911
if (!defaultargs && code && !is_smart_pointer) {
913
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, k_self);
912
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, "self");
915
914
if (is_smart_pointer) {
918
917
String *func = NewStringf("%s(", mangled);
921
if (Cmp(Getattr(n, k_storage), k_static) != 0) {
920
if (Cmp(Getattr(n, "storage"), "static") != 0) {
922
921
String *pname = Swig_cparm_name(pp, i);
923
922
String *ctname = SwigType_namestr(cname);
924
923
String *fadd = NewStringf("(%s*)(%s)->operator ->()", ctname, pname);
949
948
Append(func, ")");
950
cres = Swig_cresult(Getattr(n, k_type), k_result, func);
951
Setattr(n, k_wrapaction, cres);
949
cres = Swig_cresult(Getattr(n, "type"), "result", func);
950
Setattr(n, "wrap:action", cres);
954
953
String *call = Swig_cfunction_call(mangled, p);
955
String *cres = Swig_cresult(Getattr(n, k_type), k_result, call);
956
Setattr(n, k_wrapaction, cres);
954
String *cres = Swig_cresult(Getattr(n, "type"), "result", call);
955
Setattr(n, "wrap:action", cres);
975
974
* ----------------------------------------------------------------------------- */
977
976
Node *Swig_methodclass(Node *n) {
978
Node *nodetype = Getattr(n, k_nodetype);
977
Node *nodetype = nodeType(n);
979
978
if (!Cmp(nodetype, "class"))
981
return GetFlag(n, "feature:extend") ? Getattr(Getattr(n, k_parentnode), k_parentnode) : Getattr(n, k_parentnode);
980
return GetFlag(n, "feature:extend") ? parentNode(parentNode(n)) : parentNode(n);
984
983
int Swig_directorclass(Node *n) {
985
984
Node *classNode = Swig_methodclass(n);
986
985
assert(classNode != 0);
987
return (Getattr(classNode, k_vtable) != 0);
986
return (Getattr(classNode, "vtable") != 0);
990
989
Node *Swig_directormap(Node *module, String *type) {
1020
1019
classNode = Swig_methodclass(n);
1021
1020
use_director = Swig_directorclass(n);
1023
parms = CopyParmList(nonvoid_parms(Getattr(n, k_parms)));
1022
parms = CopyParmList(nonvoid_parms(Getattr(n, "parms")));
1025
1024
/* Prepend the list of prefix_args (if any) */
1026
prefix_args = Getattr(n, k_directorprefixargs);
1025
prefix_args = Getattr(n, "director:prefix_args");
1027
1026
if (prefix_args != NIL) {
1046
1045
* however, only one extra %extend method is generated. */
1049
String *defaultargs = Getattr(n, k_defaultargs);
1050
String *code = Getattr(n, k_code);
1048
String *defaultargs = Getattr(n, "defaultargs");
1049
String *code = Getattr(n, "code");
1051
1050
String *membername = Swig_name_construct(classname);
1052
1051
String *mangled = Swig_name_mangle(membername);
1054
1053
/* Check if the constructor is overloaded. If so, and it has code attached, we append an extra suffix
1055
1054
to avoid a name-clash in the generated wrappers. This allows overloaded constructors to be defined
1057
if (Getattr(n, k_symoverloaded) && code) {
1058
Append(mangled, Getattr(defaultargs ? defaultargs : n, k_symovername));
1056
if (Getattr(n, "sym:overloaded") && code) {
1057
Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
1061
1060
/* See if there is any code that we need to emit */
1062
1061
if (!defaultargs && code) {
1063
Swig_add_extension_code(n, mangled, parms, type, code, cparse_cplusplus, k_self);
1062
Swig_add_extension_code(n, mangled, parms, type, code, cparse_cplusplus, "self");
1066
1065
call = Swig_cfunction_call(mangled, parms);
1067
cres = Swig_cresult(type, k_result, call);
1068
Setattr(n, k_wrapaction, cres);
1066
cres = Swig_cresult(type, "result", call);
1067
Setattr(n, "wrap:action", cres);
1071
1070
Delete(membername);
1075
1074
/* if a C++ director class exists, create it rather than the original class */
1076
1075
if (use_director) {
1077
1076
Node *parent = Swig_methodclass(n);
1078
int abstract = Getattr(parent, k_abstract) != 0;
1079
String *name = Getattr(parent, k_symname);
1077
int abstract = Getattr(parent, "abstract") != 0;
1078
String *name = Getattr(parent, "sym:name");
1080
1079
String *directorname = NewStringf("SwigDirector_%s", name);
1081
1080
String *action = NewStringEmpty();
1082
1081
String *tmp_none_comparison = Copy(none_comparison);
1110
1109
Append(action, director_ctor);
1111
1110
Replaceall(action, "$comparison", tmp_none_comparison);
1113
cres = Swig_cresult(type, k_result, director_call);
1112
cres = Swig_cresult(type, "result", director_call);
1114
1113
Replaceall(action, "$director_new", cres);
1117
cres = Swig_cresult(type, k_result, nodirector_call);
1116
cres = Swig_cresult(type, "result", nodirector_call);
1118
1117
Replaceall(action, "$nondirector_new", cres);
1121
Setattr(n, k_wrapaction, action);
1120
Setattr(n, "wrap:action", action);
1122
1121
Delete(tmp_none_comparison);
1123
1122
Delete(action);
1124
1123
Delete(directorname);
1126
1125
String *call = Swig_cppconstructor_call(classname, parms);
1127
String *cres = Swig_cresult(type, k_result, call);
1128
Setattr(n, k_wrapaction, cres);
1126
String *cres = Swig_cresult(type, "result", call);
1127
Setattr(n, "wrap:action", cres);
1133
1132
String *call = Swig_cconstructor_call(classname);
1134
String *cres = Swig_cresult(type, k_result, call);
1135
Setattr(n, k_wrapaction, cres);
1133
String *cres = Swig_cresult(type, "result", call);
1134
Setattr(n, "wrap:action", cres);
1140
Setattr(n, k_type, type);
1141
Setattr(n, k_parms, parms);
1139
Setattr(n, "type", type);
1140
Setattr(n, "parms", parms);
1143
1142
if (directorparms != parms)
1144
1143
Delete(directorparms);
1159
1158
type = NewString(classname);
1160
1159
SwigType_add_pointer(type);
1161
p = NewParm(type, k_self);
1162
Setattr(p, k_self, "1");
1163
Setattr(p, k_hidden, "1");
1164
Setattr(p, k_wrapdisown, "1");
1160
p = NewParm(type, "self");
1161
Setattr(p, "self", "1");
1162
Setattr(p, "hidden", "1");
1163
Setattr(p, "wrap:disown", "1");
1166
1165
type = NewString("void");
1171
1170
String *membername, *mangled, *code;
1172
1171
membername = Swig_name_destroy(classname);
1173
1172
mangled = Swig_name_mangle(membername);
1174
code = Getattr(n, k_code);
1173
code = Getattr(n, "code");
1176
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, k_self);
1175
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, "self");
1178
1177
call = Swig_cfunction_call(mangled, p);
1179
1178
cres = NewStringf("%s;\n", call);
1180
Setattr(n, k_wrapaction, cres);
1179
Setattr(n, "wrap:action", cres);
1181
1180
Delete(membername);
1182
1181
Delete(mangled);
1187
1186
String *call = Swig_cppdestructor_call(n);
1188
1187
String *cres = NewStringf("%s\n", call);
1189
Setattr(n, k_wrapaction, cres);
1188
Setattr(n, "wrap:action", cres);
1193
1192
String *call = Swig_cdestructor_call(n);
1194
1193
String *cres = NewStringf("%s\n", call);
1195
Setattr(n, k_wrapaction, cres);
1194
Setattr(n, "wrap:action", cres);
1200
Setattr(n, k_type, type);
1201
Setattr(n, k_parms, p);
1199
Setattr(n, "type", type);
1200
Setattr(n, "parms", p);
1204
1203
return SWIG_OK;
1229
1228
self = NewString("(*this)->");
1232
name = Getattr(n, k_name);
1233
type = Getattr(n, k_type);
1231
name = Getattr(n, "name");
1232
type = Getattr(n, "type");
1235
1234
sname = Swig_name_set(name);
1236
1235
membername = Swig_name_member(classname, sname);
1239
1238
t = NewString(classname);
1240
1239
SwigType_add_pointer(t);
1241
parms = NewParm(t, k_self);
1242
Setattr(parms, k_self, "1");
1243
Setattr(parms, k_hidden, "1");
1240
parms = NewParm(t, "self");
1241
Setattr(parms, "self", "1");
1242
Setattr(parms, "hidden","1");
1246
1245
ty = Swig_wrapped_member_var_type(type, varcref);
1247
1246
p = NewParm(ty, name);
1248
Setattr(parms, k_hidden, "1");
1247
Setattr(parms, "hidden", "1");
1249
1248
set_nextSibling(parms, p);
1251
1250
/* If the type is a pointer or reference. We mark it with a special wrap:disown attribute */
1252
1251
if (SwigType_check_decl(type, "p.")) {
1253
Setattr(p, k_wrapdisown, "1");
1252
Setattr(p, "wrap:disown", "1");
1257
1256
if (flags & CWRAP_EXTEND) {
1260
String *code = Getattr(n, k_code);
1259
String *code = Getattr(n, "code");
1262
Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus, k_self);
1261
/* I don't think this ever gets run - WSF */
1262
Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus, "self");
1264
1264
call = Swig_cfunction_call(mangled, parms);
1265
1265
cres = NewStringf("%s;\n", call);
1266
Setattr(n, k_wrapaction, cres);
1266
Setattr(n, "wrap:action", cres);
1270
1270
String *call = Swig_cmemberset_call(name, type, self, varcref);
1271
1271
String *cres = NewStringf("%s;\n", call);
1272
Setattr(n, k_wrapaction, cres);
1272
Setattr(n, "wrap:action", cres);
1276
Setattr(n, k_type, void_type);
1277
Setattr(n, k_parms, parms);
1276
Setattr(n, "type", void_type);
1277
Setattr(n, "parms", parms);
1280
1280
Delete(void_type);
1305
1305
int varcref = flags & CWRAP_NATURAL_VAR;
1307
1307
if (flags & CWRAP_SMART_POINTER) {
1308
if (checkAttribute(n, k_storage, k_static)) {
1309
Node *sn = Getattr(n, k_cplusstaticbase);
1310
String *base = Getattr(sn, k_name);
1308
if (checkAttribute(n, "storage", "static")) {
1309
Node *sn = Getattr(n, "cplus:staticbase");
1310
String *base = Getattr(sn, "name");
1311
1311
self = NewStringf("%s::", base);
1313
1313
self = NewString("(*this)->");
1317
name = Getattr(n, k_name);
1318
type = Getattr(n, k_type);
1317
name = Getattr(n, "name");
1318
type = Getattr(n, "type");
1320
1320
gname = Swig_name_get(name);
1321
1321
membername = Swig_name_member(classname, gname);
1324
1324
t = NewString(classname);
1325
1325
SwigType_add_pointer(t);
1326
parms = NewParm(t, k_self);
1327
Setattr(parms, k_self, "1");
1328
Setattr(parms, k_hidden, "1");
1326
parms = NewParm(t, "self");
1327
Setattr(parms, "self", "1");
1328
Setattr(parms, "hidden","1");
1331
1331
ty = Swig_wrapped_member_var_type(type, varcref);
1336
String *code = Getattr(n, k_code);
1336
String *code = Getattr(n, "code");
1338
Swig_add_extension_code(n, mangled, parms, ty, code, cparse_cplusplus, k_self);
1338
/* I don't think this ever gets run - WSF */
1339
Swig_add_extension_code(n, mangled, parms, ty, code, cparse_cplusplus, "self");
1340
1341
call = Swig_cfunction_call(mangled, parms);
1341
cres = Swig_cresult(ty, k_result, call);
1342
Setattr(n, k_wrapaction, cres);
1342
cres = Swig_cresult(ty, "result", call);
1343
Setattr(n, "wrap:action", cres);
1346
1347
String *call = Swig_cmemberget_call(name, type, self, varcref);
1347
String *cres = Swig_cresult(ty, k_result, call);
1348
Setattr(n, k_wrapaction, cres);
1348
String *cres = Swig_cresult(ty, "result", call);
1349
Setattr(n, "wrap:action", cres);
1352
Setattr(n, k_type, ty);
1353
Setattr(n, k_parms, parms);
1353
Setattr(n, "type", ty);
1354
Setattr(n, "parms", parms);
1356
1357
Delete(membername);
1374
1376
int varcref = flags & CWRAP_NATURAL_VAR;
1376
name = Getattr(n, k_name);
1377
type = Getattr(n, k_type);
1378
name = Getattr(n, "name");
1379
type = Getattr(n, "type");
1379
1380
nname = SwigType_namestr(name);
1381
1381
ty = Swig_wrapped_var_type(type, varcref);
1382
1382
parms = NewParm(ty, name);
1385
if (!Strstr(type, "enum $unnamed")) {
1386
String *pname = Swig_cparm_name(0, 0);
1387
String *dref = Swig_wrapped_var_deref(type, pname, varcref);
1388
String *call = NewStringf("%s = %s;\n", nname, dref);
1389
Setattr(n, k_wrapaction, call);
1384
if (flags & CWRAP_EXTEND) {
1385
String *sname = Swig_name_set(name);
1386
String *mangled = Swig_name_mangle(sname);
1387
String *call = Swig_cfunction_call(mangled, parms);
1388
String *cres = NewStringf("%s;\n", call);
1389
Setattr(n, "wrap:action", cres);
1394
String *pname = Swig_cparm_name(0, 0);
1395
String *call = NewStringf("if (sizeof(int) == sizeof(%s)) *(int*)(void*)&(%s) = %s;\n", nname, nname, pname);
1396
Setattr(n, k_wrapaction, call);
1395
if (!Strstr(type, "enum $unnamed")) {
1396
String *pname = Swig_cparm_name(0, 0);
1397
String *dref = Swig_wrapped_var_deref(type, pname, varcref);
1398
String *call = NewStringf("%s = %s;\n", nname, dref);
1399
Setattr(n, "wrap:action", call);
1404
String *pname = Swig_cparm_name(0, 0);
1405
String *call = NewStringf("if (sizeof(int) == sizeof(%s)) *(int*)(void*)&(%s) = %s;\n", nname, nname, pname);
1406
Setattr(n, "wrap:action", call);
1399
Setattr(n, k_type, "void");
1400
Setattr(n, k_parms, parms);
1411
Setattr(n, "type", "void");
1412
Setattr(n, "parms", parms);
1403
1416
return SWIG_OK;
1406
1419
/* -----------------------------------------------------------------------------
1407
1420
* Swig_VargetToFunction()
1409
* This function creates a C wrapper for getting a global variable.
1422
* This function creates a C wrapper for getting a global variable or static member
1410
1424
* ----------------------------------------------------------------------------- */
1412
1426
int Swig_VargetToFunction(Node *n, int flags) {
1413
1427
String *cres, *call;
1414
String *name, *nname;
1415
SwigType *type, *ty;
1417
1432
int varcref = flags & CWRAP_NATURAL_VAR;
1419
name = Getattr(n, k_name);
1420
type = Getattr(n, k_type);
1422
nname = SwigType_namestr(name);
1434
name = Getattr(n, "name");
1435
type = Getattr(n, "type");
1423
1436
ty = Swig_wrapped_var_type(type, varcref);
1424
call = Swig_wrapped_var_assign(type, nname, varcref);
1425
cres = Swig_cresult(ty, k_result, call);
1426
Setattr(n, k_wrapaction, cres);
1438
if (flags & CWRAP_EXTEND) {
1439
String *sname = Swig_name_get(name);
1440
String *mangled = Swig_name_mangle(sname);
1441
call = Swig_cfunction_call(mangled, 0);
1442
cres = Swig_cresult(ty, "result", call);
1443
Setattr(n, "wrap:action", cres);
1447
String *nname = SwigType_namestr(name);
1448
call = Swig_wrapped_var_assign(type, nname, varcref);
1449
cres = Swig_cresult(ty, "result", call);
1450
Setattr(n, "wrap:action", cres);
1454
Setattr(n, "type", ty);
1455
Delattr(n, "parms");
1429
Setattr(n, k_type, ty);
1430
Delattr(n, k_parms);
1433
1459
return SWIG_OK;