When iterating Hash hash with Iterator ki, use ki.item instead of
Getattr(hash, ki.key). [Patch recommit] git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9113 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fe4b1da5dc
commit
9139e439c9
1 changed files with 43 additions and 45 deletions
|
|
@ -120,7 +120,6 @@ static const char *php_header =
|
||||||
|
|
||||||
void
|
void
|
||||||
SwigPHP_emit_resource_registrations() {
|
SwigPHP_emit_resource_registrations() {
|
||||||
DOH *key;
|
|
||||||
Iterator ki;
|
Iterator ki;
|
||||||
String *destructor=0;
|
String *destructor=0;
|
||||||
String *classname=0;
|
String *classname=0;
|
||||||
|
|
@ -131,44 +130,44 @@ SwigPHP_emit_resource_registrations() {
|
||||||
ki = First(zend_types);
|
ki = First(zend_types);
|
||||||
if (ki.key) Printf(s_oinit,"\n/* Register resource destructors for pointer types */\n");
|
if (ki.key) Printf(s_oinit,"\n/* Register resource destructors for pointer types */\n");
|
||||||
while (ki.key) if (1 /* is pointer type*/) {
|
while (ki.key) if (1 /* is pointer type*/) {
|
||||||
key = ki.key;
|
DOH *key = ki.key;
|
||||||
Node *class_node;
|
Node *class_node = ki.item;
|
||||||
if ((class_node=Getattr(zend_types,key))) {
|
|
||||||
// Write out destructor function header
|
|
||||||
Printf(s_wrappers,"/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n",key);
|
|
||||||
|
|
||||||
// write out body
|
// Write out destructor function header
|
||||||
if ((class_node!=NOTCLASS)) {
|
Printf(s_wrappers,"/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n",key);
|
||||||
classname = Getattr(class_node,"name");
|
|
||||||
if (! (shadow_classname = Getattr(class_node,"sym:name"))) {
|
// write out body
|
||||||
shadow_classname=classname;
|
if ((class_node!=NOTCLASS)) {
|
||||||
}
|
classname = Getattr(class_node,"name");
|
||||||
// Do we have a known destructor for this type?
|
if (! (shadow_classname = Getattr(class_node,"sym:name"))) {
|
||||||
if ((destructor = Getattr(class_node,"destructor"))) {
|
shadow_classname=classname;
|
||||||
Printf(s_wrappers," /* has destructor: %s */\n",destructor);
|
|
||||||
Printf(s_wrappers," %s(rsrc, SWIGTYPE%s->name TSRMLS_CC);\n",destructor,key);
|
|
||||||
} else {
|
|
||||||
Printf(s_wrappers," /* bah! No destructor for this wrapped class!! */\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Printf(s_wrappers," /* bah! No destructor for this simple type!! */\n");
|
|
||||||
}
|
}
|
||||||
|
// Do we have a known destructor for this type?
|
||||||
// close function
|
if ((destructor = Getattr(class_node,"destructor"))) {
|
||||||
Printf(s_wrappers,"}\n");
|
Printf(s_wrappers," /* has destructor: %s */\n",destructor);
|
||||||
|
Printf(s_wrappers," %s(rsrc, SWIGTYPE%s->name TSRMLS_CC);\n",destructor,key);
|
||||||
// declare le_swig_<mangled> to store php registration
|
} else {
|
||||||
Printf(s_vdecl,"static int le_swig_%s=0; /* handle for %s */\n", key, shadow_classname);
|
Printf(s_wrappers," /* bah! No destructor for this wrapped class!! */\n");
|
||||||
|
}
|
||||||
// register with php
|
} else {
|
||||||
Printf(s_oinit,"le_swig_%s=zend_register_list_destructors_ex"
|
Printf(s_wrappers," /* bah! No destructor for this simple type!! */\n");
|
||||||
"(_wrap_destroy%s,NULL,(char *)(SWIGTYPE%s->name),module_number);\n",
|
|
||||||
key,key,key);
|
|
||||||
|
|
||||||
// store php type in class struct
|
|
||||||
Printf(s_oinit,"SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n",
|
|
||||||
key,key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// close function
|
||||||
|
Printf(s_wrappers,"}\n");
|
||||||
|
|
||||||
|
// declare le_swig_<mangled> to store php registration
|
||||||
|
Printf(s_vdecl,"static int le_swig_%s=0; /* handle for %s */\n", key, shadow_classname);
|
||||||
|
|
||||||
|
// register with php
|
||||||
|
Printf(s_oinit,"le_swig_%s=zend_register_list_destructors_ex"
|
||||||
|
"(_wrap_destroy%s,NULL,(char *)(SWIGTYPE%s->name),module_number);\n",
|
||||||
|
key,key,key);
|
||||||
|
|
||||||
|
// store php type in class struct
|
||||||
|
Printf(s_oinit,"SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n",
|
||||||
|
key,key);
|
||||||
|
|
||||||
ki = Next(ki);
|
ki = Next(ki);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -306,6 +305,7 @@ public:
|
||||||
Printf(f_make, "\t$(CXX) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n");
|
Printf(f_make, "\t$(CXX) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n");
|
||||||
Printf(f_make, "%%.o: %%.c\n");
|
Printf(f_make, "%%.o: %%.c\n");
|
||||||
Printf(f_make, "\t$(CC) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n");
|
Printf(f_make, "\t$(CC) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n");
|
||||||
|
|
||||||
Close(f_make);
|
Close(f_make);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,7 +352,6 @@ public:
|
||||||
Printf(f_extra,"LTLIBRARY_SOURCES = %s\n", withc );
|
Printf(f_extra,"LTLIBRARY_SOURCES = %s\n", withc );
|
||||||
Printf(f_extra,"LTLIBRARY_SOURCES_CPP = %s %s\n", Swig_file_filename(outfile),withcxx);
|
Printf(f_extra,"LTLIBRARY_SOURCES_CPP = %s %s\n", Swig_file_filename(outfile),withcxx);
|
||||||
Printf(f_extra,"LTLIBRARY_OBJECTS_X = $(LTLIBRARY_SOURCES_CPP:.cpp=.lo) $(LTLIBRARY_SOURCES_CPP:.cxx=.lo)\n");
|
Printf(f_extra,"LTLIBRARY_OBJECTS_X = $(LTLIBRARY_SOURCES_CPP:.cpp=.lo) $(LTLIBRARY_SOURCES_CPP:.cxx=.lo)\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
Printf(f_extra,"LTLIBRARY_SHARED_NAME = php_%s.la\n", module);
|
Printf(f_extra,"LTLIBRARY_SHARED_NAME = php_%s.la\n", module);
|
||||||
Printf(f_extra,"LTLIBRARY_SHARED_LIBADD = $(%s_SHARED_LIBADD)\n\n", cap_module);
|
Printf(f_extra,"LTLIBRARY_SHARED_LIBADD = $(%s_SHARED_LIBADD)\n\n", cap_module);
|
||||||
|
|
@ -593,7 +592,6 @@ public:
|
||||||
Printf(f_phpcode," if (!dl(\"%s\")) return;\n", dlname);
|
Printf(f_phpcode," if (!dl(\"%s\")) return;\n", dlname);
|
||||||
Printf(f_phpcode,"}\n\n");
|
Printf(f_phpcode,"}\n\n");
|
||||||
|
|
||||||
|
|
||||||
/* sub-sections of the php file */
|
/* sub-sections of the php file */
|
||||||
pragma_code = NewString("");
|
pragma_code = NewString("");
|
||||||
pragma_incl = NewString("");
|
pragma_incl = NewString("");
|
||||||
|
|
@ -1526,7 +1524,7 @@ public:
|
||||||
if (scount++) {
|
if (scount++) {
|
||||||
Printf(s_propset," else");
|
Printf(s_propset," else");
|
||||||
}
|
}
|
||||||
Printf(s_propset," if (strcmp(propname,\"%s\")==0) {\n",Getattr(shadow_set_vars,key) );
|
Printf(s_propset," if (strcmp(propname,\"%s\")==0) {\n", ki.item);
|
||||||
Printf(s_propset," return _wrap_%s(property_reference, value);\n",key);
|
Printf(s_propset," return _wrap_%s(property_reference, value);\n",key);
|
||||||
Printf(s_propset," }");
|
Printf(s_propset," }");
|
||||||
|
|
||||||
|
|
@ -1616,7 +1614,7 @@ public:
|
||||||
if (gcount++) {
|
if (gcount++) {
|
||||||
Printf(s_propget," else");
|
Printf(s_propget," else");
|
||||||
}
|
}
|
||||||
Printf(s_propget," if (strcmp(propname,\"%s\")==0) {\n",Getattr(shadow_get_vars,key));
|
Printf(s_propget," if (strcmp(propname,\"%s\")==0) {\n", ki.item);
|
||||||
Printf(s_propget," *value=_wrap_%s(property_reference);\n",key);
|
Printf(s_propget," *value=_wrap_%s(property_reference);\n",key);
|
||||||
Printf(s_propget," return SUCCESS;\n");
|
Printf(s_propget," return SUCCESS;\n");
|
||||||
Printf(s_propget," }");
|
Printf(s_propget," }");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue