From: <wsf...@us...> - 2008-05-15 21:18:49
|
Revision: 10453 http://swig.svn.sourceforge.net/swig/?rev=10453&view=rev Author: wsfulton Date: 2008-05-15 14:18:44 -0700 (Thu, 15 May 2008) Log Message: ----------- Remove old swig-1.1 Swig_typemap_lookup function. Rename Swig_typemap_lookup_new() to Swig_typemap_lookup() Modified Paths: -------------- trunk/Source/Modules/allegrocl.cxx trunk/Source/Modules/cffi.cxx trunk/Source/Modules/chicken.cxx trunk/Source/Modules/csharp.cxx trunk/Source/Modules/emit.cxx trunk/Source/Modules/guile.cxx trunk/Source/Modules/lang.cxx trunk/Source/Modules/lua.cxx trunk/Source/Modules/modula3.cxx trunk/Source/Modules/mzscheme.cxx trunk/Source/Modules/ocaml.cxx trunk/Source/Modules/octave.cxx trunk/Source/Modules/perl5.cxx trunk/Source/Modules/php4.cxx trunk/Source/Modules/pike.cxx trunk/Source/Modules/python.cxx trunk/Source/Modules/r.cxx trunk/Source/Modules/ruby.cxx trunk/Source/Modules/tcl8.cxx trunk/Source/Swig/swig.h trunk/Source/Swig/typemap.c Modified: trunk/Source/Modules/allegrocl.cxx =================================================================== --- trunk/Source/Modules/allegrocl.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/allegrocl.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -2293,7 +2293,7 @@ Wrapper *wrap = NewWrapper(); Swig_typemap_attach_parms("lin", pl, wrap); // Swig_typemap_attach_parms("ffitype", pl, wrap); - Swig_typemap_lookup_new("lout", n, "result", 0); + Swig_typemap_lookup("lout", n, "result", 0); SwigType *result_type = Swig_cparse_type(Getattr(n, "tmap:ctype")); // prime the pump, with support for OUTPUT, INOUT typemaps. @@ -2519,7 +2519,7 @@ ParmList *parms = CopyParmList(Getattr(n, "parms")); Wrapper *f = NewWrapper(); - String *raw_return_type = Swig_typemap_lookup_new("ctype", n, "", 0); + String *raw_return_type = Swig_typemap_lookup("ctype", n, "", 0); SwigType *return_type = Swig_cparse_type(raw_return_type); SwigType *resolved = SwigType_typedef_resolve_all(return_type); int is_void_return = (Cmp(resolved, "void") == 0); Modified: trunk/Source/Modules/cffi.cxx =================================================================== --- trunk/Source/Modules/cffi.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/cffi.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -237,7 +237,7 @@ for (Parm *p = pl; p; p = nextSibling(p), argnum++) { String *argname = Getattr(p, "name"); - String *ffitype = Swig_typemap_lookup_new("lispclass", p, "", 0); + String *ffitype = Swig_typemap_lookup("lispclass", p, "", 0); int tempargname = 0; @@ -291,7 +291,7 @@ for (Parm *p = pl; p; p = nextSibling(p), argnum++) { String *argname = Getattr(p, "name"); - String *ffitype = Swig_typemap_lookup_new("lispclass", p, "", 0); + String *ffitype = Swig_typemap_lookup("lispclass", p, "", 0); int tempargname = 0; if (!argname) { @@ -356,7 +356,7 @@ String *iname = Getattr(n, "sym:name"); Wrapper *f = NewWrapper(); - String *raw_return_type = Swig_typemap_lookup_new("ctype", n, "", 0); + String *raw_return_type = Swig_typemap_lookup("ctype", n, "", 0); SwigType *return_type = Swig_cparse_type(raw_return_type); SwigType *resolved = SwigType_typedef_resolve_all(return_type); int is_void_return = (Cmp(resolved, "void") == 0); @@ -506,7 +506,7 @@ emit_inline(n, func_name); Printf(f_cl, "\n(cffi:defcfun (\"%s\" %s)", name, func_name); - String *ffitype = Swig_typemap_lookup_new("cout", n, ":pointer", 0); + String *ffitype = Swig_typemap_lookup("cout", n, ":pointer", 0); Printf(f_cl, " %s", ffitype); Delete(ffitype); @@ -520,7 +520,7 @@ String *argname = Getattr(p, "name"); - ffitype = Swig_typemap_lookup_new("cin", p, "", 0); + ffitype = Swig_typemap_lookup("cin", p, "", 0); int tempargname = 0; if (!argname) { @@ -568,7 +568,7 @@ // return SWIG_OK; String *var_name = Getattr(n, "sym:name"); - String *lisp_type = Swig_typemap_lookup_new("cin", n, "", 0); + String *lisp_type = Swig_typemap_lookup("cin", n, "", 0); String *lisp_name = lispify_name(n, var_name, "'variable"); if (Strcmp(lisp_name, "t") == 0 || Strcmp(lisp_name, "T") == 0) @@ -585,7 +585,7 @@ int CFFI::typedefHandler(Node *n) { if (generate_typedef_flag && strncmp(Char(Getattr(n, "type")), "enum", 4)) { String *lisp_name = lispify_name(n, Getattr(n, "name"), "'typename"); - Printf(f_cl, "\n(cffi:defctype %s %s)\n", lisp_name, Swig_typemap_lookup_new("cin", n, "", 0)); + Printf(f_cl, "\n(cffi:defctype %s %s)\n", lisp_name, Swig_typemap_lookup("cin", n, "", 0)); emit_export(n, lisp_name); } return Language::typedefHandler(n); Modified: trunk/Source/Modules/chicken.cxx =================================================================== --- trunk/Source/Modules/chicken.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/chicken.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -557,14 +557,14 @@ /* Look to see if there is any newfree cleanup code */ if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } } /* See if there is any return cleanup code */ - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } @@ -727,7 +727,7 @@ /* Check for a setting of the variable value */ if (!GetFlag(n, "feature:immutable")) { Printf(f->code, "if (argc > 2) {\n"); - if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { Replaceall(tm, "$source", "value"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "value"); @@ -748,7 +748,7 @@ // Now return the value of the variable - regardless // of evaluating or setting. - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", varname); Replaceall(tm, "$varname", varname); Replaceall(tm, "$target", "resultobj"); @@ -881,7 +881,7 @@ if (SwigType_type(t) == T_MPOINTER) { Printf(f_header, "static %s = %s;\n", SwigType_str(t, source), rvalue); } else { - if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) { + if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) { Replaceall(tm, "$source", rvalue); Replaceall(tm, "$target", source); Replaceall(tm, "$result", source); @@ -920,7 +920,7 @@ Printf(f->code, "if (argc!=2) C_bad_argc(argc,2);\n"); // Return the value of the variable - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", source); Replaceall(tm, "$varname", source); Modified: trunk/Source/Modules/csharp.cxx =================================================================== --- trunk/Source/Modules/csharp.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/csharp.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -731,7 +731,7 @@ Swig_typemap_attach_parms("imtype", l, f); /* Get return types */ - if ((tm = Swig_typemap_lookup_new("ctype", n, "", 0))) { + if ((tm = Swig_typemap_lookup("ctype", n, "", 0))) { String *ctypeout = Getattr(n, "tmap:ctype:out"); // the type in the ctype typemap's out attribute overrides the type in the typemap if (ctypeout) tm = ctypeout; @@ -740,7 +740,7 @@ Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s\n", SwigType_str(t, 0)); } - if ((tm = Swig_typemap_lookup_new("imtype", n, "", 0))) { + if ((tm = Swig_typemap_lookup("imtype", n, "", 0))) { String *imtypeout = Getattr(n, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap if (imtypeout) tm = imtypeout; @@ -949,7 +949,7 @@ /* Look to see if there is any newfree cleanup code */ if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { canThrow(n, "newfree", n); Replaceall(tm, "$source", "result"); /* deprecated */ Printf(f->code, "%s\n", tm); @@ -958,7 +958,7 @@ /* See if there is any return cleanup code */ if (!native_function_flag) { - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { canThrow(n, "ret", n); Replaceall(tm, "$source", "result"); /* deprecated */ Printf(f->code, "%s\n", tm); @@ -1317,7 +1317,7 @@ /* Get C# return types */ bool classname_substituted_flag = false; - if ((tm = Swig_typemap_lookup_new("cstype", n, "", 0))) { + if ((tm = Swig_typemap_lookup("cstype", n, "", 0))) { String *cstypeout = Getattr(n, "tmap:cstype:out"); // the type in the cstype typemap's out attribute overrides the type in the typemap if (cstypeout) tm = cstypeout; @@ -1909,7 +1909,7 @@ Swig_typemap_attach_parms("csin", l, NULL); /* Get return types */ - if ((tm = Swig_typemap_lookup_new("cstype", n, "", 0))) { + if ((tm = Swig_typemap_lookup("cstype", n, "", 0))) { // Note that in the case of polymorphic (covariant) return types, the method's return type is changed to be the base of the C++ return type SwigType *covariant = Getattr(n, "covariant"); String *cstypeout = Getattr(n, "tmap:cstype:out"); // the type in the cstype typemap's out attribute overrides the type in the typemap @@ -2053,7 +2053,7 @@ Printf(function_code, ")"); // Transform return type used in PInvoke function (in intermediary class) to type used in C# wrapper function (in proxy class) - if ((tm = Swig_typemap_lookup_new("csout", n, "", 0))) { + if ((tm = Swig_typemap_lookup("csout", n, "", 0))) { excodeSubstitute(n, tm, "csout", n); bool is_pre_code = Len(pre_code) > 0; bool is_post_code = Len(post_code) > 0; @@ -2147,7 +2147,7 @@ } } else { // Getter method - if ((tm = Swig_typemap_lookup_new("csvarout", n, "", 0))) { + if ((tm = Swig_typemap_lookup("csvarout", n, "", 0))) { if (GetFlag(n, "feature:new")) Replaceall(tm, "$owner", "true"); else @@ -2498,7 +2498,7 @@ Swig_typemap_attach_parms("csin", l, NULL); /* Get return types */ - if ((tm = Swig_typemap_lookup_new("cstype", n, "", 0))) { + if ((tm = Swig_typemap_lookup("cstype", n, "", 0))) { String *cstypeout = Getattr(n, "tmap:cstype:out"); // the type in the cstype typemap's out attribute overrides the type in the typemap if (cstypeout) tm = cstypeout; @@ -2609,7 +2609,7 @@ Printf(function_code, ")"); // Transform return type used in PInvoke function (in intermediary class) to type used in C# wrapper function (in module class) - if ((tm = Swig_typemap_lookup_new("csout", n, "", 0))) { + if ((tm = Swig_typemap_lookup("csout", n, "", 0))) { excodeSubstitute(n, tm, "csout", n); bool is_pre_code = Len(pre_code) > 0; bool is_post_code = Len(post_code) > 0; @@ -2679,7 +2679,7 @@ } } else { // Getter method - if ((tm = Swig_typemap_lookup_new("csvarout", n, "", 0))) { + if ((tm = Swig_typemap_lookup("csvarout", n, "", 0))) { if (GetFlag(n, "feature:new")) Replaceall(tm, "$owner", "true"); else @@ -3242,7 +3242,7 @@ /* Create the intermediate class wrapper */ Parm *tp = NewParmFromNode(returntype, empty_str, n); - tm = Swig_typemap_lookup_new("imtype", tp, "", 0); + tm = Swig_typemap_lookup("imtype", tp, "", 0); if (tm) { String *imtypeout = Getattr(tp, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap if (imtypeout) @@ -3262,7 +3262,7 @@ Parm *retpm = NewParmFromNode(returntype, empty_str, n); - if ((c_ret_type = Swig_typemap_lookup_new("ctype", retpm, "", 0))) { + if ((c_ret_type = Swig_typemap_lookup("ctype", retpm, "", 0))) { if (!is_void && !ignored_method) { String *jretval_decl = NewStringf("%s jresult", c_ret_type); @@ -3359,7 +3359,7 @@ Wrapper_add_localv(w, arg, c_decl, (!(SwigType_ispointer(pt) || SwigType_isreference(pt)) ? "" : "= 0"), NIL); /* Add input marshalling code */ - if ((desc_tm = Swig_typemap_lookup_new("directorin", tp, "", 0)) + if ((desc_tm = Swig_typemap_lookup("directorin", tp, "", 0)) && (tm = Getattr(p, "tmap:directorin"))) { Replaceall(tm, "$input", arg); @@ -3506,7 +3506,7 @@ if (!is_void) { Parm *tp = NewParmFromNode(returntype, empty_str, n); - if ((tm = Swig_typemap_lookup_new("csdirectorout", tp, "", 0))) { + if ((tm = Swig_typemap_lookup("csdirectorout", tp, "", 0))) { substituteClassname(returntype, tm); Replaceall(tm, "$cscall", upcall); @@ -3533,7 +3533,7 @@ Parm *tp = NewParmFromNode(returntype, result_str, n); /* Copy jresult into c_result... */ - if ((tm = Swig_typemap_lookup_new("directorout", tp, result_str, w))) { + if ((tm = Swig_typemap_lookup("directorout", tp, result_str, w))) { addThrows(n, "tmap:directorout", tp); Replaceall(tm, "$input", jresult_str); Replaceall(tm, "$result", result_str); Modified: trunk/Source/Modules/emit.cxx =================================================================== --- trunk/Source/Modules/emit.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/emit.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -464,7 +464,7 @@ int unknown_catch = 0; Printf(eaction, "}\n"); for (Parm *ep = catchlist; ep; ep = nextSibling(ep)) { - String *em = Swig_typemap_lookup_new("throws", ep, "_e", 0); + String *em = Swig_typemap_lookup("throws", ep, "_e", 0); if (em) { SwigType *et = Getattr(ep, "type"); SwigType *etr = SwigType_typedef_resolve_all(et); @@ -488,7 +488,7 @@ } /* Look for except typemap (Deprecated) */ - tm = Swig_typemap_lookup_new("except", n, "result", 0); + tm = Swig_typemap_lookup("except", n, "result", 0); if (tm) { Setattr(n, "feature:except", tm); tm = 0; Modified: trunk/Source/Modules/guile.cxx =================================================================== --- trunk/Source/Modules/guile.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/guile.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -910,13 +910,13 @@ // Look for any remaining cleanup if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, "\n", NIL); } } // Free any memory allocated by the function being wrapped.. - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, "\n", NIL); } @@ -1179,7 +1179,7 @@ if (!GetFlag(n, "feature:immutable")) { /* Check for a setting of the variable value */ Printf(f->code, "if (s_0 != SCM_UNDEFINED) {\n"); - if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { Replaceall(tm, "$source", "s_0"); Replaceall(tm, "$input", "s_0"); Replaceall(tm, "$target", name); @@ -1193,7 +1193,7 @@ // Now return the value of the variable (regardless // of evaluating or setting) - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", name); Replaceall(tm, "$target", "gswig_result"); Replaceall(tm, "$result", "gswig_result"); @@ -1389,7 +1389,7 @@ rvalue = NewString(value); } - if ((tm = Swig_typemap_lookup_new("constant", n, name, 0))) { + if ((tm = Swig_typemap_lookup("constant", n, name, 0))) { Replaceall(tm, "$source", rvalue); Replaceall(tm, "$value", rvalue); Replaceall(tm, "$target", name); Modified: trunk/Source/Modules/lang.cxx =================================================================== --- trunk/Source/Modules/lang.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/lang.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -1432,7 +1432,7 @@ target = NewStringf("%s->%s", pname, name); Delete(pname); } - tm = Swig_typemap_lookup_new("memberin", n, target, 0); + tm = Swig_typemap_lookup("memberin", n, target, 0); } int flags = Extend | SmartPointer | use_naturalvar_mode(n); if (is_non_virtual_protected_access(n)) @@ -2849,15 +2849,13 @@ if (assignable) { int make_set_wrapper = 1; - String *tm = Swig_typemap_lookup_new("globalin", n, name, 0); + String *tm = Swig_typemap_lookup("globalin", n, name, 0); Swig_VarsetToFunction(n, flags); String *sname = Swig_name_set(symname); Setattr(n, "sym:name", sname); Delete(sname); - /* String *tm = Swig_typemap_lookup((char *) "globalin",type,name,name,Swig_cparm_name(0,0),name,0); */ - if (!tm) { if (SwigType_isarray(type)) { Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(type, 0)); Modified: trunk/Source/Modules/lua.cxx =================================================================== --- trunk/Source/Modules/lua.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/lua.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -590,14 +590,14 @@ /* Look to see if there is any newfree cleanup code */ if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } } /* See if there is any return cleanup code */ - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } @@ -750,7 +750,7 @@ // I refered to the Language::variableWrapper() to find this out bool assignable=is_assignable(n) ? true : false; SwigType *type = Getattr(n, "type"); - String *tm = Swig_typemap_lookup_new("globalin", n, iname, 0); + String *tm = Swig_typemap_lookup("globalin", n, iname, 0); if (!tm && SwigType_isarray(type)) assignable=false; Delete(tm); @@ -794,13 +794,13 @@ value = Char(wname); } - if ((tm = Swig_typemap_lookup_new("consttab", n, name, 0))) { + if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); Replaceall(tm, "$nsname", nsname); Printf(s_const_tab, "%s,\n", tm); - } else if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) { + } else if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); Modified: trunk/Source/Modules/modula3.cxx =================================================================== --- trunk/Source/Modules/modula3.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/modula3.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -315,7 +315,7 @@ * ----------------------------------------------------------------------------- */ String *getMappedTypeNew(Node *n, const char *map, const char *lname = "", bool warn = true) { - String *tm = Swig_typemap_lookup_new(map, n, lname, 0); + String *tm = Swig_typemap_lookup(map, n, lname, 0); if ((tm == NIL) && warn) { Swig_warning(WARN_MODULA3_TYPEMAP_TYPE_UNDEF, input_file, line_number, "No '%s' typemap defined for type '%s'\n", map, SwigType_str(Getattr(n, "type"), 0)); @@ -330,7 +330,7 @@ * ----------------------------------------------------------------------------- */ void attachMappedType(Node *n, const char *map, const char *lname = "") { - String *tm = Swig_typemap_lookup_new(map, n, lname, 0); + String *tm = Swig_typemap_lookup(map, n, lname, 0); if (tm != NIL) { String *attr = NewStringf("tmap:%s", map); Setattr(n, attr, tm); @@ -1450,7 +1450,7 @@ /* Look to see if there is any newfree cleanup code */ if (GetFlag(n, "feature:new")) { - String *tm = Swig_typemap_lookup_new("newfree", n, "result", 0); + String *tm = Swig_typemap_lookup("newfree", n, "result", 0); if (tm != NIL) { addThrows(throws_hash, "newfree", n); Replaceall(tm, "$source", "result"); /* deprecated */ @@ -1460,7 +1460,7 @@ /* See if there is any return cleanup code */ if (!native_function_flag) { - String *tm = Swig_typemap_lookup_new("ret", n, "result", 0); + String *tm = Swig_typemap_lookup("ret", n, "result", 0); if (tm != NIL) { Replaceall(tm, "$source", "result"); /* deprecated */ Printf(f->code, "%s\n", tm); Modified: trunk/Source/Modules/mzscheme.cxx =================================================================== --- trunk/Source/Modules/mzscheme.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/mzscheme.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -416,14 +416,14 @@ // Look for any remaining cleanup if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, "\n", NIL); } } // Free any memory allocated by the function being wrapped.. - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, "\n", NIL); } @@ -530,7 +530,7 @@ if (!GetFlag(n, "feature:immutable")) { /* Check for a setting of the variable value */ Printf(f->code, "if (argc) {\n"); - if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { Replaceall(tm, "$source", "argv[0]"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "argv[0]"); @@ -544,7 +544,7 @@ // Now return the value of the variable (regardless // of evaluating or setting) - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", name); Replaceall(tm, "$target", "swig_result"); Replaceall(tm, "$result", "swig_result"); @@ -618,7 +618,7 @@ Clear(rvalue); Printv(rvalue, "'", temp, "'", NIL); } - if ((tm = Swig_typemap_lookup_new("constant", n, name, 0))) { + if ((tm = Swig_typemap_lookup("constant", n, name, 0))) { Replaceall(tm, "$source", rvalue); Replaceall(tm, "$value", rvalue); Replaceall(tm, "$target", name); @@ -755,7 +755,7 @@ if ((SwigType_type(type) == T_USER) && (!is_a_pointer(type))) { Printv(convert_tab, tab4, "fields[i++] = ", NIL); Printv(convert_tab, "_swig_convert_struct_", swigtype, "((", SwigType_str(ctype_ptr, ""), ")&((ptr)->", name, "));\n", NIL); - } else if ((tm = Swig_typemap_lookup_new("varout", n, access_mem, 0))) { + } else if ((tm = Swig_typemap_lookup("varout", n, access_mem, 0))) { Replaceall(tm, "$result", "fields[i++]"); Printv(convert_tab, tm, "\n", NIL); } else Modified: trunk/Source/Modules/ocaml.cxx =================================================================== --- trunk/Source/Modules/ocaml.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/ocaml.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -665,14 +665,14 @@ // Look for any remaining cleanup if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "swig_result"); Printv(f->code, tm, "\n", NIL); } } // Free any memory allocated by the function being wrapped.. - if ((tm = Swig_typemap_lookup_new("swig_result", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("swig_result", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, "\n", NIL); } @@ -800,13 +800,13 @@ if (!GetFlag(n, "feature:immutable")) { /* Check for a setting of the variable value */ Printf(f->code, "if (args != Val_int(0)) {\n"); - if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { Replaceall(tm, "$source", "args"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "args"); /* Printv(f->code, tm, "\n",NIL); */ emit_action_code(n, f->code, tm); - } else if ((tm = Swig_typemap_lookup_new("in", n, name, 0))) { + } else if ((tm = Swig_typemap_lookup("in", n, name, 0))) { Replaceall(tm, "$source", "args"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "args"); @@ -819,12 +819,12 @@ // Now return the value of the variable (regardless // of evaluating or setting) - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", name); Replaceall(tm, "$target", "swig_result"); Replaceall(tm, "$result", "swig_result"); emit_action_code(n, f->code, tm); - } else if ((tm = Swig_typemap_lookup_new("out", n, name, 0))) { + } else if ((tm = Swig_typemap_lookup("out", n, name, 0))) { Replaceall(tm, "$source", name); Replaceall(tm, "$target", "swig_result"); Replaceall(tm, "$result", "swig_result"); @@ -1588,7 +1588,7 @@ "swig_result = caml_swig_alloc(1,C_list);\n" "SWIG_Store_field(swig_result,0,args);\n" "args = swig_result;\n" "swig_result = Val_unit;\n", 0); Printf(w->code, "swig_result = " "callback3(*caml_named_value(\"swig_runmethod\")," "swig_get_self(),copy_string(\"%s\"),args);\n", Getattr(n, "name")); /* exception handling */ - tm = Swig_typemap_lookup_new("director:except", n, "result", 0); + tm = Swig_typemap_lookup("director:except", n, "result", 0); if (!tm) { tm = Getattr(n, "feature:director:except"); } @@ -1623,7 +1623,7 @@ * occurs in Language::cDeclaration(). */ Setattr(n, "type", return_type); - tm = Swig_typemap_lookup_new("directorout", n, "c_result", w); + tm = Swig_typemap_lookup("directorout", n, "c_result", w); Setattr(n, "type", type); if (tm == 0) { String *name = NewString("c_result"); Modified: trunk/Source/Modules/octave.cxx =================================================================== --- trunk/Source/Modules/octave.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/octave.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -599,13 +599,13 @@ Printv(f->code, cleanup, NIL); if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } } - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Replaceall(tm, "$result", "_outv"); Printf(f->code, "%s\n", tm); @@ -685,7 +685,7 @@ Printf(setf->def, "if (!SWIG_check_num_args(\"%s_set\",args.length(),1,1,0)) return octave_value_list();", iname); if (is_assignable(n)) { Setattr(n, "wrap:name", setname); - if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { Replaceall(tm, "$source", "args(0)"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "args(0)"); @@ -709,7 +709,7 @@ int addfail = 0; Printf(getf->def, "static octave_value_list _wrap_%s(const octave_value_list& args,int nargout) {", getname); Wrapper_add_local(getf, "obj", "octave_value obj"); - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", name); Replaceall(tm, "$target", "obj"); Replaceall(tm, "$result", "obj"); @@ -749,7 +749,7 @@ Delete(str); value = wname; } - if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) { + if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); @@ -1285,7 +1285,7 @@ Printf(w->code, "}\n"); Setattr(n, "type", return_type); - tm = Swig_typemap_lookup_new("directorout", n, "result", w); + tm = Swig_typemap_lookup("directorout", n, "result", w); Setattr(n, "type", type); if (tm == 0) { String *name = NewString("result"); Modified: trunk/Source/Modules/perl5.cxx =================================================================== --- trunk/Source/Modules/perl5.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/perl5.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -755,13 +755,13 @@ Printv(f->code, cleanup, NIL); if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } } - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } @@ -856,7 +856,7 @@ Printv(setf->code, tab4, "MAGIC_PPERL\n", NIL); /* Check for a few typemaps */ - tm = Swig_typemap_lookup_new("varin", n, name, 0); + tm = Swig_typemap_lookup("varin", n, name, 0); if (tm) { Replaceall(tm, "$source", "sv"); Replaceall(tm, "$target", name); @@ -879,7 +879,7 @@ Printf(getf->def, "SWIGCLASS_STATIC int %s(pTHX_ SV *sv, MAGIC *SWIGUNUSEDPARM(mg)) {\n", get_name); Printv(getf->code, tab4, "MAGIC_PPERL\n", NIL); - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$target", "sv"); Replaceall(tm, "$result", "sv"); Replaceall(tm, "$source", name); @@ -982,7 +982,7 @@ value = Char(wname); } - if ((tm = Swig_typemap_lookup_new("consttab", n, name, 0))) { + if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); @@ -992,7 +992,7 @@ Replaceall(tm, "$shadow", "0"); } Printf(constant_tab, "%s,\n", tm); - } else if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) { + } else if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); Modified: trunk/Source/Modules/php4.cxx =================================================================== --- trunk/Source/Modules/php4.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/php4.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -1195,7 +1195,7 @@ if (native_constructor == NATIVE_CONSTRUCTOR) { Printf(f->code, "add_property_zval(this_ptr,\"" SWIG_PTR "\",_cPtr);\n"); } else { - String *shadowrettype = SwigToPhpType(d, iname, true); + String *shadowrettype = SwigToPhpType(n, true); Printf(f->code, "object_init_ex(return_value,ptr_ce_swig_%s);\n", shadowrettype); Delete(shadowrettype); Printf(f->code, "add_property_zval(return_value,\"" SWIG_PTR "\",_cPtr);\n"); @@ -1217,14 +1217,14 @@ /* Look to see if there is any newfree cleanup code */ if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Printf(f->code, "%s\n", tm); Delete(tm); } } /* See if there is any return cleanup code */ - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Printf(f->code, "%s\n", tm); Delete(tm); } @@ -1858,7 +1858,7 @@ /* First link C variables to PHP */ - tm = Swig_typemap_lookup_new("varinit", n, name, 0); + tm = Swig_typemap_lookup("varinit", n, name, 0); if (tm) { Replaceall(tm, "$target", name); Printf(s_vinit, "%s\n", tm); @@ -1868,7 +1868,7 @@ /* Now generate PHP -> C sync blocks */ /* - tm = Swig_typemap_lookup_new("varin", n, name, 0); + tm = Swig_typemap_lookup("varin", n, name, 0); if(tm) { Replaceall(tm, "$symname", iname); Printf(f_c->code, "%s\n", tm); @@ -1881,7 +1881,7 @@ /* if(!GetFlag(n,"feature:immutable")) { - tm = Swig_typemap_lookup_new("varout", n, name, 0); + tm = Swig_typemap_lookup("varout", n, name, 0); if(tm) { Replaceall(tm, "$symname", iname); Printf(f_php->code, "%s\n", tm); @@ -1911,7 +1911,7 @@ SwigType_remember(type); - if ((tm = Swig_typemap_lookup_new("consttab", n, name, 0))) { + if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); @@ -2496,7 +2496,7 @@ // is made. int assignable = is_assignable(n); if (assignable) { - String *tm = Swig_typemap_lookup_new("globalin", n, name, 0); + String *tm = Swig_typemap_lookup("globalin", n, name, 0); if (!tm && SwigType_isarray(type)) { assignable = 0; } @@ -2556,14 +2556,15 @@ } - String * SwigToPhpType(SwigType *t, String_or_char *pname, int shadow_flag) { + String * SwigToPhpType(Node *n, int shadow_flag) { String *ptype = 0; + SwigType *t = Getattr(n, "type"); if (shadow_flag) { - ptype = PhpTypeFromTypemap((char *) "pstype", t, pname, (char *) ""); + ptype = PhpTypeFromTypemap((char *) "pstype", n, (char *) ""); } if (!ptype) { - ptype = PhpTypeFromTypemap((char *) "ptype", t, pname, (char *) ""); + ptype = PhpTypeFromTypemap((char *) "ptype", n, (char *) ""); } if (ptype) return ptype; @@ -2603,22 +2604,12 @@ return NewStringEmpty(); } - String *PhpTypeFromTypemap(char *op, SwigType *t, String_or_char *pname, String_or_char *lname) { - String *tms; - tms = Swig_typemap_lookup(op, t, pname, lname, (char *) "", (char *) "", NULL); - if (!tms) { - return NULL; - } - - char *start = Char(tms); - while (isspace(*start) || *start == '{') { - start++; - } - char *end = start; - while (*end && *end != '}') { - end++; - } - return NewStringWithSize(start, end - start); + String *PhpTypeFromTypemap(char *op, Node *n, String_or_char *lname) { + String *tms = Swig_typemap_lookup(op, n, lname, 0); + if (!tms) + return 0; + else + return NewStringf("%s", tms); } int abstractConstructorHandler(Node *n) { Modified: trunk/Source/Modules/pike.cxx =================================================================== --- trunk/Source/Modules/pike.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/pike.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -446,14 +446,14 @@ /* Look to see if there is any newfree cleanup code */ if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } } /* See if there is any return cleanup code */ - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } @@ -573,7 +573,7 @@ } /* Perform constant typemap substitution */ - String *tm = Swig_typemap_lookup_new("constant", n, value, 0); + String *tm = Swig_typemap_lookup("constant", n, value, 0); if (tm) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", symname); Modified: trunk/Source/Modules/python.cxx =================================================================== --- trunk/Source/Modules/python.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/python.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -2016,7 +2016,7 @@ /* Look to see if there is any newfree cleanup code */ if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); Delete(tm); @@ -2024,14 +2024,14 @@ } /* See if there is any return cleanup code */ - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); Delete(tm); } if (director_method) { - if ((tm = Swig_typemap_lookup_new("directorfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("directorfree", n, "result", 0))) { Replaceall(tm, "$input", "result"); Replaceall(tm, "$result", "resultobj"); Printf(f->code, "%s\n", tm); @@ -2171,7 +2171,7 @@ if (assignable) { Setattr(n, "wrap:name", varsetname); Printf(setf->def, "SWIGINTERN int %s(PyObject *_val) {", varsetname); - if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { Replaceall(tm, "$source", "_val"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "_val"); @@ -2204,7 +2204,7 @@ int addfail = 0; Printf(getf->def, "SWIGINTERN PyObject *%s(void) {", vargetname); Wrapper_add_local(getf, "pyobj", "PyObject *pyobj = 0"); - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", name); Replaceall(tm, "$target", "pyobj"); Replaceall(tm, "$result", "pyobj"); @@ -2258,7 +2258,7 @@ Delete(str); value = wname; } - if ((tm = Swig_typemap_lookup_new("consttab", n, name, 0))) { + if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); @@ -2266,7 +2266,7 @@ Delete(tm); have_tm = 1; } - if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) { + if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); @@ -3596,7 +3596,7 @@ Printf(w->code, "swig_set_inner(\"%s\", false);\n", name); /* exception handling */ - tm = Swig_typemap_lookup_new("director:except", n, "result", 0); + tm = Swig_typemap_lookup("director:except", n, "result", 0); if (!tm) { tm = Getattr(n, "feature:director:except"); if (tm) @@ -3646,7 +3646,7 @@ * occurs in Language::cDeclaration(). */ Setattr(n, "type", return_type); - tm = Swig_typemap_lookup_new("directorout", n, "result", w); + tm = Swig_typemap_lookup("directorout", n, "result", w); Setattr(n, "type", type); if (tm == 0) { String *name = NewString("result"); Modified: trunk/Source/Modules/r.cxx =================================================================== --- trunk/Source/Modules/r.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/r.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -72,7 +72,7 @@ SwigType_push(elType, elDecl); String *ans; - String *rtype = Swig_typemap_lookup_new("rtype", n, "", 0); + String *rtype = Swig_typemap_lookup("rtype", n, "", 0); String *i = getRTypeName(elType); if(Len(i) == 0) { @@ -710,7 +710,7 @@ Setattr(bbase, "type", rettype); Setattr(bbase, "name", NewString("result")); - String *returnTM = Swig_typemap_lookup_new("in", bbase, "result", f); + String *returnTM = Swig_typemap_lookup("in", bbase, "result", f); if(returnTM) { String *tm = returnTM; Replaceall(tm,"$input", "r_swig_cb_data->retValue"); @@ -1634,7 +1634,7 @@ } Printv(f->code, "if (", NIL); for (p =pi, j = 0 ; j < num_arguments ; j++) { - String *tm = Swig_typemap_lookup_new("rtype", p, "", 0); + String *tm = Swig_typemap_lookup("rtype", p, "", 0); if(tm) { replaceRClass(tm, Getattr(p, "type")); } @@ -1950,7 +1950,7 @@ } - tm = Swig_typemap_lookup_new("rtype", curP, "", 0); + tm = Swig_typemap_lookup("rtype", curP, "", 0); if(tm) { replaceRClass(tm, Getattr(curP, "type")); } @@ -2076,7 +2076,7 @@ Printv(f->code, UnProtectWrapupCode, NIL); /*If the user gave us something to convert the result in */ - if ((tm = Swig_typemap_lookup_new("scoerceout", n, + if ((tm = Swig_typemap_lookup("scoerceout", n, "result", sfun))) { Replaceall(tm,"$source","ans"); Replaceall(tm,"$result","ans"); @@ -2102,7 +2102,7 @@ Wrapper_print(sfun, sfile); Printf(sfun->code, "\n# End of %s\n", iname); - tm = Swig_typemap_lookup_new("rtype", n, "", 0); + tm = Swig_typemap_lookup("rtype", n, "", 0); if(tm) { SwigType *retType = Getattr(n, "type"); replaceRClass(tm, retType); @@ -2336,7 +2336,7 @@ #if 0 tp = getRType(c); #else - tp = Swig_typemap_lookup_new("rtype", c, "", 0); + tp = Swig_typemap_lookup("rtype", c, "", 0); if(!tp) { c = nextSibling(c); continue; @@ -2432,7 +2432,7 @@ continue; } - String *tp = Swig_typemap_lookup_new("rtype", c, "", 0); + String *tp = Swig_typemap_lookup("rtype", c, "", 0); if(!tp) { continue; } Modified: trunk/Source/Modules/ruby.cxx =================================================================== --- trunk/Source/Modules/ruby.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/ruby.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -1885,7 +1885,7 @@ /* Look for any remaining cleanup. This processes the %new directive */ if (current != CONSTRUCTOR_ALLOCATE && GetFlag(n, "feature:new")) { - tm = Swig_typemap_lookup_new("newfree", n, "result", 0); + tm = Swig_typemap_lookup("newfree", n, "result", 0); if (tm) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, "\n", NIL); @@ -1894,7 +1894,7 @@ } /* Special processing on return value. */ - tm = Swig_typemap_lookup_new("ret", n, "result", 0); + tm = Swig_typemap_lookup("ret", n, "result", 0); if (tm) { Replaceall(tm, "$source", "result"); Printv(f->code, tm, NIL); @@ -1902,7 +1902,7 @@ } if (director_method) { - if ((tm = Swig_typemap_lookup_new("directorfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("directorfree", n, "result", 0))) { Replaceall(tm, "$input", "result"); Replaceall(tm, "$result", "vresult"); Printf(f->code, "%s\n", tm); @@ -2109,7 +2109,7 @@ Printf(getf->def, ") {"); Wrapper_add_local(getf, "_val", "VALUE _val"); - tm = Swig_typemap_lookup_new("varout", n, name, 0); + tm = Swig_typemap_lookup("varout", n, name, 0); if (tm) { Replaceall(tm, "$result", "_val"); Replaceall(tm, "$target", "_val"); @@ -2141,7 +2141,7 @@ Setattr(n, "wrap:name", setfname); Printv(setf->def, "SWIGINTERN VALUE\n", setfname, "(VALUE self, ", NIL); Printf(setf->def, "VALUE _val) {"); - tm = Swig_typemap_lookup_new("varin", n, name, 0); + tm = Swig_typemap_lookup("varin", n, name, 0); if (tm) { Replaceall(tm, "$input", "_val"); Replaceall(tm, "$source", "_val"); @@ -2253,9 +2253,9 @@ Printf(f_header, "static %s = %s;\n", SwigType_str(type, wname), value); value = Char(wname); } - String *tm = Swig_typemap_lookup_new("constant", n, value, 0); + String *tm = Swig_typemap_lookup("constant", n, value, 0); if (!tm) - tm = Swig_typemap_lookup_new("constcode", n, value, 0); + tm = Swig_typemap_lookup("constcode", n, value, 0); if (tm) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", iname); @@ -2872,7 +2872,7 @@ String *depthCountName = NewStringf("%s_%s_call_depth", className, methodName); // Check for an exception typemap of some kind - String *tm = Swig_typemap_lookup_new("director:except", n, "result", 0); + String *tm = Swig_typemap_lookup("director:except", n, "result", 0); if (!tm) { tm = Getattr(n, "feature:director:except"); } @@ -3233,7 +3233,7 @@ * It's not just me, similar silliness also occurs in Language::cDeclaration(). */ Setattr(n, "type", return_type); - tm = Swig_typemap_lookup_new("directorout", n, "result", w); + tm = Swig_typemap_lookup("directorout", n, "result", w); Setattr(n, "type", type); if (tm == 0) { String *name = NewString("result"); Modified: trunk/Source/Modules/tcl8.cxx =================================================================== --- trunk/Source/Modules/tcl8.cxx 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Modules/tcl8.cxx 2008-05-15 21:18:44 UTC (rev 10453) @@ -476,13 +476,13 @@ /* Look for any remaining cleanup */ if (GetFlag(n, "feature:new")) { - if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } } - if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) { + if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) { Replaceall(tm, "$source", "result"); Printf(f->code, "%s\n", tm); } @@ -566,7 +566,7 @@ Setattr(n, "wrap:name", getfname); Printv(getf->def, "SWIGINTERN const char *", getfname, "(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, char *name1, char *name2, int flags) {", NIL); Wrapper_add_local(getf, "value", "Tcl_Obj *value = 0"); - if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varout", n, name, 0))) { Replaceall(tm, "$source", name); Replaceall(tm, "$target", "value"); Replaceall(tm, "$result", "value"); @@ -602,7 +602,7 @@ Wrapper_add_local(setf, "value", "Tcl_Obj *value = 0"); Wrapper_add_local(setf, "name1o", "Tcl_Obj *name1o = 0"); - if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) { + if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { Replaceall(tm, "$source", "value"); Replaceall(tm, "$target", name); Replaceall(tm, "$input", "value"); @@ -676,13 +676,13 @@ value = Char(wname); } - if ((tm = Swig_typemap_lookup_new("consttab", n, name, 0))) { + if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); Replaceall(tm, "$nsname", nsname); Printf(const_tab, "%s,\n", tm); - } else if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) { + } else if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) { Replaceall(tm, "$source", value); Replaceall(tm, "$target", name); Replaceall(tm, "$value", value); Modified: trunk/Source/Swig/swig.h =================================================================== --- trunk/Source/Swig/swig.h 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Swig/swig.h 2008-05-15 21:18:44 UTC (rev 10453) @@ -369,10 +369,7 @@ extern Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String_or_char *pname, SwigType **matchtype); extern Hash *Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int *nmatch); - extern String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_char *pname, String_or_char *lname, - String_or_char *source, String_or_char *target, Wrapper *f); - - extern String *Swig_typemap_lookup_new(const String_or_char *op, Node *n, const String_or_char *lname, Wrapper *f); + extern String *Swig_typemap_lookup(const String_or_char *op, Node *n, const String_or_char *lname, Wrapper *f); extern String *Swig_typemap_lookup_out(const String_or_char *op, Node *n, const String_or_char *lname, Wrapper *f, String *actioncode); extern void Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p); extern void Swig_typemap_new_scope(void); Modified: trunk/Source/Swig/typemap.c =================================================================== --- trunk/Source/Swig/typemap.c 2008-05-15 21:16:48 UTC (rev 10452) +++ trunk/Source/Swig/typemap.c 2008-05-15 21:18:44 UTC (rev 10453) @@ -1162,81 +1162,18 @@ /* ----------------------------------------------------------------------------- * Swig_typemap_lookup() * - * Perform a typemap lookup (ala SWIG1.1) + * Attach one or more typemaps to a node and optionally generate the typemap contents + * into the wrapper. + * op - typemap name, eg "out", "newfree" + * node - the node to attach the typemaps to + * lname - name of variable to substitute $1, $2 etc for + * f - wrapper code to generate into if non null + * actioncode - code to generate into f before the out typemap code, unless + * the optimal attribute is set in the out typemap in which case + * $1 in the out typemap will be replaced by the code in actioncode. * ----------------------------------------------------------------------------- */ -String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_char *pname, - String_or_char *lname, String_or_char *source, String_or_char *target, Wrapper *f) { - Hash *tm; - String *s = 0; - SwigType *mtype = 0; - ParmList *locals; - tm = Swig_typemap_search(op, type, pname, &mtype); - if (!tm) - return 0; - - s = Getattr(tm, "code"); - if (!s) { - if (mtype) - Delete(mtype); - return 0; - } - - - /* Blocked */ - if (Cmp(s, "pass") == 0) { - Delete(mtype); - return 0; - } - - s = Copy(s); /* Make a local copy of the typemap code */ - - locals = Getattr(tm, "locals"); - if (locals) - locals = CopyParmList(locals); - - /* This is wrong. It replaces locals in place. Need to fix this */ - if (mtype && SwigType_isarray(mtype)) { - typemap_replace_vars(s, locals, mtype, type, pname, lname, 1); - } else { - typemap_replace_vars(s, locals, type, type, pname, lname, 1); - } - - if (locals && f) { - typemap_locals(s, locals, f, -1); - } - - replace_embedded_typemap(s); - - /* Now perform character replacements */ - Replace(s, "$source", source, DOH_REPLACE_ANY); - Replace(s, "$target", target, DOH_REPLACE_ANY); - - /* { - String *tmname = Getattr(tm,"typemap"); - if (tmname) Replace(s,"$typemap",tmname, DOH_REPLACE_ANY); - } - */ - - Replace(s, "$parmname", pname, DOH_REPLACE_ANY); - /* Replace(s,"$name",pname,DOH_REPLACE_ANY); */ - - Delete(locals); - Delete(mtype); - return s; -} - -/* ----------------------------------------------------------------------------- - * Swig_typemap_lookup_new() - * - * Attach one or more typemaps to a node - * op - typemap name, eg "out", "newfree" - * node - the node to attach the typemaps to - * lname - name of variable to substitute $1, $2 etc for - * f - wrapper code to generate into - * ----------------------------------------------------------------------------- */ - -static String *Swig_typemap_lookup_new_impl(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f, String *actioncode) { +static String *Swig_typemap_lookup_impl(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f, String *actioncode) { SwigType *type; SwigType *mtype = 0; String *pname; @@ -1450,11 +1387,11 @@ String *Swig_typemap_lookup_out(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f, String *actioncode) { assert(actioncode); assert(Cmp(op, "out") == 0); - return Swig_typemap_lookup_new_impl(op, node, lname, f, actioncode); + return Swig_typemap_lookup_impl(op, node, lname, f, actioncode); } -String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f) { - return Swig_typemap_lookup_new_impl(op, node, lname, f, 0); +String *Swig_typemap_lookup(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f) { + return Swig_typemap_lookup_impl(op, node, lname, f, 0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |