%extend for static member varibles work in progress ... more consistent code across different language modules and memory leak fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9608 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fc10a97b23
commit
5cd992dade
3 changed files with 18 additions and 8 deletions
|
|
@ -1162,6 +1162,8 @@ int CHICKEN::membervariableHandler(Node *n) {
|
|||
}
|
||||
|
||||
Delete(proc);
|
||||
Delete(setfunc);
|
||||
Delete(getfunc);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -765,9 +765,11 @@ public:
|
|||
SwigType *t = Getattr(n, "type");
|
||||
Wrapper *getf, *setf;
|
||||
String *tm;
|
||||
String *getname = Swig_name_get(iname);
|
||||
String *setname = Swig_name_set(iname);
|
||||
|
||||
String *set_name = Swig_name_wrapper(Swig_name_set(iname));
|
||||
String *val_name = Swig_name_wrapper(Swig_name_get(iname));
|
||||
String *get_name = Swig_name_wrapper(getname);
|
||||
String *set_name = Swig_name_wrapper(setname);
|
||||
|
||||
if (!addSymbol(iname, n))
|
||||
return SWIG_ERROR;
|
||||
|
|
@ -801,7 +803,7 @@ public:
|
|||
|
||||
/* Now write a function to evaluate the variable */
|
||||
int addfail = 0;
|
||||
Printf(getf->def, "SWIGCLASS_STATIC int %s(pTHX_ SV *sv, MAGIC *SWIGUNUSEDPARM(mg)) {\n", val_name);
|
||||
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))) {
|
||||
|
|
@ -850,10 +852,10 @@ public:
|
|||
}
|
||||
/* Now add symbol to the PERL interpreter */
|
||||
if (GetFlag(n, "feature:immutable")) {
|
||||
Printv(variable_tab, tab4, "{ \"", cmodule, "::", iname, "\", MAGIC_CLASS swig_magic_readonly, MAGIC_CLASS ", val_name, ",", tt, " },\n", NIL);
|
||||
Printv(variable_tab, tab4, "{ \"", cmodule, "::", iname, "\", MAGIC_CLASS swig_magic_readonly, MAGIC_CLASS ", get_name, ",", tt, " },\n", NIL);
|
||||
|
||||
} else {
|
||||
Printv(variable_tab, tab4, "{ \"", cmodule, "::", iname, "\", MAGIC_CLASS ", set_name, ", MAGIC_CLASS ", val_name, ",", tt, " },\n", NIL);
|
||||
Printv(variable_tab, tab4, "{ \"", cmodule, "::", iname, "\", MAGIC_CLASS ", set_name, ", MAGIC_CLASS ", get_name, ",", tt, " },\n", NIL);
|
||||
}
|
||||
|
||||
/* If we're blessed, try to figure out what to do with the variable
|
||||
|
|
@ -876,8 +878,10 @@ public:
|
|||
|
||||
DelWrapper(setf);
|
||||
DelWrapper(getf);
|
||||
Delete(getname);
|
||||
Delete(setname);
|
||||
Delete(set_name);
|
||||
Delete(val_name);
|
||||
Delete(get_name);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1416,7 +1416,8 @@ public:
|
|||
|
||||
/* create getter */
|
||||
int addfail = 0;
|
||||
getfname = Swig_name_get(iname);
|
||||
String *getname = Swig_name_get(iname);
|
||||
getfname = Swig_name_wrapper(getname);
|
||||
Printv(getf->def, "SWIGINTERN VALUE\n", getfname, "(", NIL);
|
||||
Printf(getf->def, "VALUE self");
|
||||
Printf(getf->def, ") {");
|
||||
|
|
@ -1445,7 +1446,8 @@ public:
|
|||
setfname = NewString("NULL");
|
||||
} else {
|
||||
/* create setter */
|
||||
setfname = Swig_name_set(iname);
|
||||
String *setname = Swig_name_set(iname);
|
||||
setfname = Swig_name_wrapper(setname);
|
||||
Printv(setf->def, "SWIGINTERN VALUE\n", setfname, "(VALUE self, ", NIL);
|
||||
Printf(setf->def, "VALUE _val) {");
|
||||
tm = Swig_typemap_lookup_new("varin", n, name, 0);
|
||||
|
|
@ -1463,6 +1465,7 @@ public:
|
|||
Printv(setf->code, tab4, "return Qnil;\n", NIL);
|
||||
Printf(setf->code, "}\n");
|
||||
Wrapper_print(setf, f_wrappers);
|
||||
Delete(setname);
|
||||
}
|
||||
|
||||
/* define accessor method */
|
||||
|
|
@ -1502,6 +1505,7 @@ public:
|
|||
Delete(s);
|
||||
break;
|
||||
}
|
||||
Delete(getname);
|
||||
Delete(getfname);
|
||||
Delete(setfname);
|
||||
DelWrapper(setf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue