cvs: pear /CodeGen_PECL/PECL Extension.php /CodeGen_PECL/PECL/Element Function.php /CodeGen_PECL/PECL/Tools ProtoParser.y

From: Date: Wed, 18 Oct 2006 00:23:02 +0000
Subject: cvs: pear /CodeGen_PECL/PECL Extension.php /CodeGen_PECL/PECL/Element Function.php /CodeGen_PECL/PECL/Tools ProtoParser.y
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-42613@lists.php.net to get a copy of this message
hholzgra Wed Oct 18 00:23:02 2006 UTC Modified files: /pear/CodeGen_PECL/PECL/Element Function.php /pear/CodeGen_PECL/PECL/Tools ProtoParser.y /pear/CodeGen_PECL/PECL Extension.php Log: completed #ifdef wrapping of functions based on element dependencies http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Element/Function.php?r1=1.41&r2=1.42&diff_format=u Index: pear/CodeGen_PECL/PECL/Element/Function.php diff -u pear/CodeGen_PECL/PECL/Element/Function.php:1.41 pear/CodeGen_PECL/PECL/Element/Function.php:1.42 --- pear/CodeGen_PECL/PECL/Element/Function.php:1.41 Tue Oct 17 15:29:18 2006 +++ pear/CodeGen_PECL/PECL/Element/Function.php Wed Oct 18 00:23:02 2006 @@ -15,7 +15,7 @@ * @author Hartmut Holzgraefe <hartmut@php.net> * @copyright 2005, 2006 Hartmut Holzgraefe * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Function.php,v 1.41 2006/10/17 15:29:18 hholzgra Exp $ + * @version CVS: $Id: Function.php,v 1.42 2006/10/18 00:23:02 hholzgra Exp $ * @link http://pear.php.net/package/CodeGen */ @@ -927,6 +927,9 @@ function defaultval($param, $default) { if (isset($param["default"])) { + if (is_object($param["default"])) { + return $param["default"]->getValue(); + } return $param["default"]; } @@ -1573,18 +1576,16 @@ $params[] = $this->returns; foreach ($params as $param) { - switch ($param["type"]) { - case "resource": - if (isset($param['subtype'])) { - $code.= $extension->getResource($param['subtype'])->ifConditionStart(); - } - break; - case "object": - // TODO - break; - default: - break; + if ($param["type"] == "resource" && isset($param['subtype'])) { + $obj = $extension->getResource($param['subtype']); + } else if ($param["type"] == "object" && isset($param['subtype'])) { + $obj = $extension->getClass($param['subtype']); + } else if (isset($param["default"]) && is_object($param["default"])) { + $obj = $param["default"]; + } else { + continue; } + $code.= $obj->ifConditionStart(); } } @@ -1599,19 +1600,19 @@ $params = $this->params; $params[] = $this->returns; + $params = array_reverse($params); + foreach ($params as $param) { - switch ($param["type"]) { - case "resource": - if (isset($param['subtype'])) { - $code.= $extension->getResource($param['subtype'])->ifConditionEnd(); - } - break; - case "object": - // TODO - break; - default: - break; + if ($param["type"] == "resource" && isset($param['subtype'])) { + $obj = $extension->getResource($param['subtype']); + } else if ($param["type"] == "object" && isset($param['subtype'])) { + $obj = $extension->getClass($param['subtype']); + } else if (isset($param["default"]) && is_object($param["default"])) { + $obj = $param["default"]; + } else { + continue; } + $code.= $obj->ifConditionEnd(); } } http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Tools/ProtoParser.y?r1=1.5&r2=1.6&diff_format=u Index: pear/CodeGen_PECL/PECL/Tools/ProtoParser.y diff -u pear/CodeGen_PECL/PECL/Tools/ProtoParser.y:1.5 pear/CodeGen_PECL/PECL/Tools/ProtoParser.y:1.6 --- pear/CodeGen_PECL/PECL/Tools/ProtoParser.y:1.5 Wed Oct 18 00:19:28 2006 +++ pear/CodeGen_PECL/PECL/Tools/ProtoParser.y Wed Oct 18 00:23:02 2006 @@ -96,7 +96,7 @@ default(A) ::= NAME(B). { $constant = $extension->getConstant(B); if ($constant) { - A = $constant->getValue(); + A = $constant; } else { throw new Exception("invalid default value '".B."'"); } http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Extension.php?r1=1.62&r2=1.63&diff_format=u Index: pear/CodeGen_PECL/PECL/Extension.php diff -u pear/CodeGen_PECL/PECL/Extension.php:1.62 pear/CodeGen_PECL/PECL/Extension.php:1.63 --- pear/CodeGen_PECL/PECL/Extension.php:1.62 Tue Oct 17 14:15:29 2006 +++ pear/CodeGen_PECL/PECL/Extension.php Wed Oct 18 00:23:02 2006 @@ -15,7 +15,7 @@ * @author Hartmut Holzgraefe <hartmut@php.net> * @copyright 2005, 2006 Hartmut Holzgraefe * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Extension.php,v 1.62 2006/10/17 14:15:29 hholzgra Exp $ + * @version CVS: $Id: Extension.php,v 1.63 2006/10/18 00:23:02 hholzgra Exp $ * @link http://pear.php.net/package/CodeGen_PECL */ @@ -420,6 +420,23 @@ /** + * Get a specific class by name + * + * @access public + * @param string class name + * @return object class object or false if not found + */ + function getClass($name) + { + if (isset($this->classes[$name])) { + return $this->classes[$name]; + } + + return false; + } + + + /** * Add a PHP class to the extension * * @access public @@ -2423,14 +2440,22 @@ */ function minPhpVersion() { + // extension interdependencies only exist in 5.1 and above if (!empty($this->otherExtensions)) { return "5.1.0rc1"; } + // return by reference only exist in 5.1 and above + if (isset($this->returns["byRef"])) { + return "5.1.0rc1"; + } + + // we only support the 5.0 (ZE2) OO api if (!empty($this->classes) || !empty($this->interfaces)) { return "5.0.0"; } + // default: 4.0 return "4.0.0"; // TODO test for real lower bound }

« previous php.pear.cvs (#42613) next »