int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags) { SwigType *type; Parm *p; type = NewString(classname); SwigType_add_pointer(type); p = NewParm(type, k_self); Setattr(p, k_self, "1"); Setattr(p, k_hidden, "1"); Setattr(p, k_wrapdisown, "1"); Delete(type); type = NewString("void"); if (flags & CWRAP_EXTEND) { String *cres; String *call; String *membername, *mangled, *code; membername = Swig_name_destroy(classname); mangled = Swig_name_mangle(membername); code = Getattr(n, k_code); if (code) { Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, k_self); } call = Swig_cfunction_call(mangled, p); cres = NewStringf("%s;\n", call); Setattr(n, k_wrapaction, cres); Delete(membername); Delete(mangled); Delete(call); Delete(cres); } else { if (cplus) { String *call = Swig_cppdestructor_call(n); String *cres = NewStringf("%s\n", call); Setattr(n, k_wrapaction, cres); Delete(call); Delete(cres); } else { String *call = Swig_cdestructor_call(n); String *cres = NewStringf("%s\n", call); Setattr(n, k_wrapaction, cres); Delete(call); Delete(cres); } } Setattr(n, k_type, type); Setattr(n, k_parms, p); Delete(type); Delete(p); return SWIG_OK; }
int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags) { SwigType *type; Parm *p; type = NewString(classname); SwigType_add_pointer(type); p = NewParm(type,"self"); Delete(type); type = NewString("void"); if (flags & CWRAP_EXTEND) { String *membername, *mangled, *code; membername = Swig_name_destroy(classname); mangled = Swig_name_mangle(membername); code = Getattr(n,"code"); if (code) { String *s = NewStringf("void %s(%s)", mangled, ParmList_str(p)); Printv(s,code,"\n",NIL); Setattr(n,"wrap:code",s); Delete(s); } Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cfunction_call(mangled,p))); Delete(membername); Delete(mangled); } else { if (cplus) { String* action = NewString(""); Printf(action, "%s;\n", Swig_cppdestructor_call()); Setattr(n,"wrap:action", action); } else { Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cdestructor_call())); } } Setattr(n,"type",type); Setattr(n,"parms", p); Delete(type); Delete(p); return SWIG_OK; }