예제 #1
0
 /**
  * Create the module entry code for this extension
  *
  * @access private
  * @return string  zend_module_entry code fragment
  */
 function generateExtensionEntry()
 {
     $name = $this->name;
     $upname = strtoupper($this->name);
     $code = "";
     if (empty($this->otherExtensions)) {
         $moduleHeader = "    STANDARD_MODULE_HEADER,";
     } else {
         $code .= CodeGen_PECL_Dependency_Extension::cCodeHeader($this);
         foreach ($this->otherExtensions as $ext) {
             $code .= $ext->cCode($this);
         }
         $code .= CodeGen_PECL_Dependency_Extension::cCodeFooter($this);
         $moduleHeader = "#if ZEND_EXTENSION_API_NO >= 220050617\n        STANDARD_MODULE_HEADER_EX, NULL,\n        {$this->name}_deps,\n#else\n        STANDARD_MODULE_HEADER,\n#endif\n";
     }
     $code .= "\n/* {{{ {$name}_module_entry\n */\nzend_module_entry {$name}_module_entry = {\n{$moduleHeader}\n    \"{$name}\",\n    {$name}_functions,\n    PHP_MINIT({$name}),     /* Replace with NULL if there is nothing to do at php startup   */ \n    PHP_MSHUTDOWN({$name}), /* Replace with NULL if there is nothing to do at php shutdown  */\n    PHP_RINIT({$name}),     /* Replace with NULL if there is nothing to do at request start */\n    PHP_RSHUTDOWN({$name}), /* Replace with NULL if there is nothing to do at request end   */\n    PHP_MINFO({$name}),\n    \"" . $this->release->getVersion() . "\", \n    STANDARD_MODULE_PROPERTIES\n};\n/* }}} */\n\n";
     $code .= "#ifdef COMPILE_DL_{$upname}\n";
     if ($this->language == "cpp") {
         $code .= "extern \"C\" {\n";
     }
     $code .= "ZEND_GET_MODULE({$name})\n";
     if ($this->language == "cpp") {
         $code .= "} // extern \"C\"\n";
     }
     $code .= "#endif\n\n";
     return $code;
 }
예제 #2
0
 function tagstart_deps_extension($attr)
 {
     $ext = new CodeGen_PECL_Dependency_Extension();
     $err = $ext->setName($attr['name']);
     if (PEAR::isError($err)) {
         return $err;
     }
     if (isset($attr["type"])) {
         $err = $ext->setType($attr['type']);
         if (PEAR::isError($err)) {
             return $err;
         }
     }
     if (isset($attr["version"]) || isset($attr["rel"])) {
         if (!isset($attr["version"])) {
             return PEAR::raiseError("'rel' attribut requires 'version' ");
         }
         if (!isset($attr["rel"])) {
             $attr["rel"] = "ge";
         }
         $err = $ext->setVersion($attr['version'], $attr['rel']);
         if (PEAR::isError($err)) {
             return $err;
         }
     }
     $this->extension->addOtherExtension($ext);
 }