[lua] Added a typemap DISOWN for SWIGTYPE* and SWIGTYPE[], and support for %delobject feature.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10326 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Gossage 2008-03-27 01:58:30 +00:00
commit 11647d87e8
14 changed files with 377 additions and 19 deletions

View file

@ -450,7 +450,11 @@ public:
Replaceall(tm, "$target", ln);
Replaceall(tm, "$input", source);
Setattr(p, "emit:input", source);
if (Getattr(p, "wrap:disown") || (Getattr(p, "tmap:in:disown"))) {
Replaceall(tm, "$disown", "SWIG_POINTER_DISOWN");
} else {
Replaceall(tm, "$disown", "0");
}
/* NEW LANGUAGE NOTE:***********************************************
look for a 'checkfn' typemap
this an additional parameter added to the in typemap
@ -1057,8 +1061,7 @@ public:
* ------------------------------------------------------------ */
virtual int destructorHandler(Node *n) {
//have_destructor = 1;
//return SWIG_NOWRAP;
//REPORT("destructorHandler", n);
current = DESTRUCTOR;
Language::destructorHandler(n);
current = NO_CPP;
@ -1145,12 +1148,12 @@ public:
*/
void EscapeCode(String* str)
{
Printf(f_runtime,"/* original luacode:[[[\n%s\n]]]\n*/\n",str);
//Printf(f_runtime,"/* original luacode:[[[\n%s\n]]]\n*/\n",str);
Chop(str); // trim
Replace(str,"\\","\\\\",DOH_REPLACE_ANY); // \ to \\ (this must be done first)
Replace(str,"\"","\\\"",DOH_REPLACE_ANY); // " to \"
Replace(str,"\n","\\n\"\n \"",DOH_REPLACE_ANY); // \n to \n"\n" (ie quoting every line)
Printf(f_runtime,"/* hacked luacode:[[[\n%s\n]]]\n*/\n",str);
//Printf(f_runtime,"/* hacked luacode:[[[\n%s\n]]]\n*/\n",str);
}
};