uniform the name_get/name_set names
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7715 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e8535abc5b
commit
61e61a35ed
4 changed files with 17 additions and 13 deletions
|
|
@ -1599,7 +1599,8 @@ public:
|
|||
String *iname = Getattr(n,"sym:name");
|
||||
SwigType *t = Getattr(n,"type");
|
||||
|
||||
String *wname;
|
||||
String *getnamef;
|
||||
String *setnamef;
|
||||
static int have_globals = 0;
|
||||
String *tm;
|
||||
Wrapper *getf, *setf;
|
||||
|
|
@ -1627,12 +1628,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
wname = Swig_name_wrapper(iname);
|
||||
getnamef = Swig_name_get(iname);
|
||||
setnamef = Swig_name_set(iname);
|
||||
|
||||
/* Create a function for setting the value of the variable */
|
||||
|
||||
if (assignable) {
|
||||
Printf(setf->def,"static int %s_set(PyObject *_val) {", wname);
|
||||
Printf(setf->def,"static int %s(PyObject *_val) {", setnamef);
|
||||
if ((tm = Swig_typemap_lookup_new("varin",n,name,0))) {
|
||||
Replaceall(tm,"$source","_val");
|
||||
Replaceall(tm,"$target",name);
|
||||
|
|
@ -1649,9 +1651,9 @@ public:
|
|||
} else {
|
||||
/* Is a readonly variable. Issue an error */
|
||||
if (CPlusPlus) {
|
||||
Printf(setf->def,"static int %s_set(PyObject *) {", wname);
|
||||
Printf(setf->def,"static int %s(PyObject *) {", setnamef);
|
||||
} else {
|
||||
Printf(setf->def,"static int %s_set(PyObject *_val) {", wname);
|
||||
Printf(setf->def,"static int %s(PyObject *_val SWIGUNUSED) {", setnamef);
|
||||
}
|
||||
Printv(setf->code,
|
||||
tab4, "SWIG_Error(SWIG_AttributeError,\"Variable ", iname," is read-only.\");\n",
|
||||
|
|
@ -1663,7 +1665,7 @@ public:
|
|||
Wrapper_print(setf,f_wrappers);
|
||||
|
||||
/* Create a function for getting the value of a variable */
|
||||
Printf(getf->def,"static PyObject *%s_get(void) {", wname);
|
||||
Printf(getf->def,"static PyObject *%s(void) {", getnamef);
|
||||
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj = 0");
|
||||
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
||||
Replaceall(tm,"$source",name);
|
||||
|
|
@ -1679,8 +1681,10 @@ public:
|
|||
Wrapper_print(getf,f_wrappers);
|
||||
|
||||
/* Now add this to the variable linking mechanism */
|
||||
Printf(f_init,"\t SWIG_addvarlink(SWIG_globals(),(char*)\"%s\",%s_get, %s_set);\n", iname, wname, wname);
|
||||
Printf(f_init,"\t SWIG_addvarlink(SWIG_globals(),(char*)\"%s\",%s, %s);\n", iname, getnamef, setnamef);
|
||||
|
||||
Delete(getnamef);
|
||||
Delete(setnamef);
|
||||
DelWrapper(setf);
|
||||
DelWrapper(getf);
|
||||
return SWIG_OK;
|
||||
|
|
|
|||
|
|
@ -1473,7 +1473,7 @@ public:
|
|||
setf = NewWrapper();
|
||||
|
||||
/* create getter */
|
||||
getfname = NewString(Swig_name_get(iname));
|
||||
getfname = Swig_name_get(iname);
|
||||
Printv(getf->def, "SWIGINTERN VALUE\n", getfname, "(", NIL);
|
||||
Printf(getf->def, "VALUE self");
|
||||
Printf(getf->def, ") {");
|
||||
|
|
@ -1502,7 +1502,7 @@ public:
|
|||
setfname = NewString("NULL");
|
||||
} else {
|
||||
/* create setter */
|
||||
setfname = NewString(Swig_name_set(iname));
|
||||
setfname = Swig_name_set(iname);
|
||||
Printv(setf->def, "SWIGINTERN VALUE\n", setfname, "(VALUE self, ", NIL);
|
||||
Printf(setf->def, "VALUE _val) {");
|
||||
|
||||
|
|
|
|||
|
|
@ -558,7 +558,7 @@ public:
|
|||
|
||||
/* Create a function for getting a variable */
|
||||
getf = NewWrapper();
|
||||
getname = Swig_name_wrapper(Swig_name_get(iname));
|
||||
getname = Swig_name_get(iname);
|
||||
Printv(getf->def,"SWIGINTERN char *",getname,"(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, char *name1, char *name2, int flags) {",NIL);
|
||||
Wrapper_add_local(getf,"value", "Tcl_Obj *value = 0");
|
||||
|
||||
|
|
@ -585,7 +585,7 @@ public:
|
|||
/* Try to create a function setting a variable */
|
||||
if (is_assignable(n)) {
|
||||
setf = NewWrapper();
|
||||
setname = Swig_name_wrapper(Swig_name_set(iname));
|
||||
setname = Swig_name_set(iname);
|
||||
Printv(setf->def,"SWIGINTERN char *",setname, "(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, char *name1, char *name2 SWIGUNUSED, int flags) {",NIL);
|
||||
Wrapper_add_local(setf,"value", "Tcl_Obj *value = 0");
|
||||
Wrapper_add_local(setf,"name1o", "Tcl_Obj *name1o = 0");
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ Swig_name_get(const String_or_char *vname) {
|
|||
Append(r,f);
|
||||
}
|
||||
Replace(r,"%v",vname, DOH_REPLACE_ANY);
|
||||
Replace(r,"::","_", DOH_REPLACE_ANY);
|
||||
name_mangle(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ Swig_name_set(const String_or_char *vname) {
|
|||
Append(r,f);
|
||||
}
|
||||
Replace(r,"%v",vname, DOH_REPLACE_ANY);
|
||||
Replace(r,"::","_", DOH_REPLACE_ANY);
|
||||
name_mangle(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue