+foreach ($ext->getConstants() as $constant => $value) {
+ printf("const %s = %s;\n", $constant, $value);
+}
+printf("\n");
+
+foreach ($ext->getFunctions() as $f) {
+ printf("function %s(", $f->getName());
+ $ps = array();
+ foreach ($f->getParameters() as $p) {
+ $p1 = sprintf("%s%s\$%s", t($p), $p->isPassedByReference()?"&":"", $p->getName());
+ if ($p->isOptional()) {
+ if ($p->isDefaultValueAvailable()) {
+ $p1 .= sprintf(" = %s", var_export($p->getDefaultValue(), true));
+ } elseif (!($p->isArray() || $p->getClass()) || $p->allowsNull()) {
+ $p1 .= " = NULL";
+ } elseif ($p->isArray()) {
+ $p1 .= " = array()";
+ }
+ }
+ $ps[] = $p1;
+ }
+ printf("%s) {\n}\n", implode(", ", $ps));
+}
+printf("\n");
+