merge frome trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11524 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
b0e85706b6
60 changed files with 510 additions and 734 deletions
|
|
@ -501,6 +501,10 @@ public:
|
|||
Printf(s_entry, "static zend_function_entry %s_functions[] = {\n", module);
|
||||
|
||||
/* start the init section */
|
||||
Append(s_init, "#if ZEND_MODULE_API_NO <= 20090626\n");
|
||||
Append(s_init, "#undef ZEND_MODULE_BUILD_ID\n");
|
||||
Append(s_init, "#define ZEND_MODULE_BUILD_ID (char*)\"API\" ZEND_TOSTR(ZEND_MODULE_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA\n");
|
||||
Append(s_init, "#endif\n");
|
||||
Printv(s_init, "zend_module_entry ", module, "_module_entry = {\n" "#if ZEND_MODULE_API_NO > 20010900\n" " STANDARD_MODULE_HEADER,\n" "#endif\n", NIL);
|
||||
Printf(s_init, " (char*)\"%s\",\n", module);
|
||||
Printf(s_init, " %s_functions,\n", module);
|
||||
|
|
@ -1022,7 +1026,20 @@ public:
|
|||
String *output = s_oowrappers;
|
||||
if (constructor) {
|
||||
class_has_ctor = true;
|
||||
methodname = "__construct";
|
||||
// Skip the Foo:: prefix.
|
||||
char *ptr = strrchr(GetChar(n, "name"), ':');
|
||||
if (ptr) {
|
||||
ptr++;
|
||||
} else {
|
||||
ptr = GetChar(n, "name");
|
||||
}
|
||||
if (strcmp(ptr, GetChar(n, "constructorHandler:sym:name")) == 0) {
|
||||
methodname = "__construct";
|
||||
} else {
|
||||
// The class has multiple constructors and this one is
|
||||
// renamed, so this will be a static factory function
|
||||
methodname = GetChar(n, "constructorHandler:sym:name");
|
||||
}
|
||||
} else if (wrapperType == memberfn) {
|
||||
methodname = Char(Getattr(n, "memberfunctionHandler:sym:name"));
|
||||
} else if (wrapperType == staticmemberfn) {
|
||||
|
|
@ -1581,7 +1598,11 @@ public:
|
|||
Printf(output, "%s", prepare);
|
||||
if (constructor) {
|
||||
if (!directorsEnabled() || !Swig_directorclass(n)) {
|
||||
Printf(output, "\t\t$this->%s=%s;\n", SWIG_PTR, invoke);
|
||||
if (strcmp(methodname, "__construct") == 0) {
|
||||
Printf(output, "\t\t$this->%s=%s;\n", SWIG_PTR, invoke);
|
||||
} else {
|
||||
Printf(output, "\t\treturn new %s(%s);\n", "Foo", invoke);
|
||||
}
|
||||
} else {
|
||||
Node *parent = Swig_methodclass(n);
|
||||
String *classname = Swig_class_name(parent);
|
||||
|
|
@ -1627,8 +1648,14 @@ public:
|
|||
*/
|
||||
Printf(output, "\t\tif (is_resource($r)) {\n");
|
||||
Printf(output, "\t\t\t$class='%s'.substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n", prefix);
|
||||
Printf(output, "\t\t\treturn new $class($r);\n\t\t}\n");
|
||||
Printf(output, "\t\telse return $r;\n");
|
||||
if (Getattr(classLookup(Getattr(n, "type")), "module")) {
|
||||
Printf(output, "\t\t\treturn new $class($r);\n");
|
||||
} else {
|
||||
Printf(output, "\t\t\t$c = new stdClass();\n");
|
||||
Printf(output, "\t\t\t$c->_cPtr = $r;\n");
|
||||
Printf(output, "\t\t\treturn $c;\n");
|
||||
}
|
||||
Printf(output, "\t\t}\n\t\telse return $r;\n");
|
||||
} else {
|
||||
Printf(output, "\t\t$this->%s = $r;\n", SWIG_PTR);
|
||||
Printf(output, "\t\treturn $this;\n");
|
||||
|
|
@ -1928,7 +1955,7 @@ public:
|
|||
|
||||
Printf(s_phpclasses, "class %s%s ", prefix, shadow_classname);
|
||||
String *baseclass = NULL;
|
||||
if (base.item) {
|
||||
if (base.item && Getattr(base.item, "module")) {
|
||||
baseclass = Getattr(base.item, "sym:name");
|
||||
if (!baseclass)
|
||||
baseclass = Getattr(base.item, "name");
|
||||
|
|
|
|||
|
|
@ -2984,7 +2984,7 @@ public:
|
|||
Delete(realct);
|
||||
}
|
||||
if (!have_constructor) {
|
||||
Printv(f_shadow_file, tab4, "def __init__(self, *args, **kwargs): raise AttributeError(\"No constructor defined\")\n", NIL);
|
||||
Printv(f_shadow_file, tab4, "def __init__(self, *args, **kwargs): raise AttributeError(\"", "No constructor defined", (Getattr(n, "abstract") ? " - class is abstract" : ""), "\")\n", NIL);
|
||||
} else if (fastinit) {
|
||||
|
||||
Printv(f_wrappers, "SWIGINTERN PyObject *", class_name, "_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL);
|
||||
|
|
|
|||
|
|
@ -931,13 +931,13 @@ public:
|
|||
Printv(f_shadow, " constructor { } {\n", NIL);
|
||||
Printv(f_shadow, " # This constructor will fail if called directly\n", NIL);
|
||||
Printv(f_shadow, " if { [info class] == \"::", class_name, "\" } {\n", NIL);
|
||||
Printv(f_shadow, " error \"No constructor for class ", class_name, "\"\n", NIL);
|
||||
Printv(f_shadow, " error \"No constructor for class ", class_name, (Getattr(n, "abstract") ? " - class is abstract" : ""), "\"\n", NIL);
|
||||
Printv(f_shadow, " }\n", NIL);
|
||||
Printv(f_shadow, " }\n", NIL);
|
||||
}
|
||||
|
||||
Printv(f_shadow, "}\n\n", NIL);
|
||||
};
|
||||
}
|
||||
|
||||
Printv(f_wrappers, "static swig_class *swig_", mangled_classname, "_bases[] = {", base_class, "0};\n", NIL);
|
||||
Printv(f_wrappers, "static const char * swig_", mangled_classname, "_base_names[] = {", base_class_names, "0};\n", NIL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue