genIncludeHeaderFiles(); ?> // global vars globalVars as $name => $type): ?> ; // class register functions classCeList as $ce): ?> zend_class_entry * ; // class entry zend_class_entry *classMap) . ']' ?>; // func zend_function *funcMap) . ']' ?>; zend_class_entry *php_get_class(int class_id, const char *class_name) { if (UNEXPECTED([class_id] == nullptr)) { [class_id] = php::getClassEntrySafe(class_name); } return [class_id]; } zend_function *php_get_func(int func_id, const char *func_name) { if (UNEXPECTED([func_id] == nullptr)) { [func_id] = php::getFunction(func_name); } return [func_id]; } // literal strings php::Var [] = { literalStrings as $str => $index): ?> php::String{ZEND_STRL("escapeString($str)?>"), true}, }; // constants nativeConstants as $name => $constant): ?> type?> ; // property offset classes as $classDef): foreach ($classDef->properties as $propertyDef): ?> uint32_t getPropertyOffset($propertyDef->name, $classDef->name, $classDef->namespace)?>; // clang-format off static const zend_function_entry ext_functions[] = { functions as $functionDef): ?> ZEND_FE(name?>, arginfo_name?>) ZEND_FE_END }; // clang-format on static PHP_MINIT_FUNCTION(targetName?>) { // class/interface class entries classCeList as $ce): $info = $this->classCeInfo[$ce] ?? $this->getInternalCeInfo($ce); ?> = (); return SUCCESS; } void php_app_init() { // register constants nativeConstants as $name => $constant): ?> = value ?>; php::define("", ); // global vars globalVars as $name => $type): ?> php::initGlobal("", ); // property offset classes as $classDef): foreach ($classDef->properties as $propertyDef): ?> getPropertyOffset($propertyDef->name, $classDef->name, $classDef->namespace)?> = php::getPropertyOffset("getNamespacedName(false)?>", "name?>"); } void php_app_clean() { globalVars as $name => $type) : ?> .unset(); php::unsetGlobal(""); nativeConstants as $name => $constant): if ($constant->type !== Translator::TYPE_VAR) { continue; } ?> .unset(); } zend_module_entry targetName?>_module_entry = { STANDARD_MODULE_HEADER, "targetName?>", ext_functions, PHP_MINIT(targetName?>), nullptr, nullptr, nullptr, nullptr, nullptr, STANDARD_MODULE_PROPERTIES, }; #ifdef BUILD_PHP_EXTENSION ZEND_GET_MODULE(targetName?>); #else zend_module_entry *get_module() { return &targetName ?>_module_entry; } #endif