cvs: pear /CodeGen_PECL TODO package.xml /CodeGen_PECL/PECL/Element Function.php

From: Date: Tue, 17 Oct 2006 15:29:19 +0000
Subject: cvs: pear /CodeGen_PECL TODO package.xml /CodeGen_PECL/PECL/Element Function.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-42606@lists.php.net to get a copy of this message
hholzgra Tue Oct 17 15:29:19 2006 UTC Modified files: /pear/CodeGen_PECL TODO package.xml /pear/CodeGen_PECL/PECL/Element Function.php Log: make functions that use resource types "inherit" their conditional compile settings http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/TODO?r1=1.35&r2=1.36&diff_format=u Index: pear/CodeGen_PECL/TODO diff -u pear/CodeGen_PECL/TODO:1.35 pear/CodeGen_PECL/TODO:1.36 --- pear/CodeGen_PECL/TODO:1.35 Tue Oct 17 14:21:12 2006 +++ pear/CodeGen_PECL/TODO Tue Oct 17 15:29:18 2006 @@ -17,6 +17,10 @@ - pkg-config support (almost done) +- have functions using a conditional element in their proto + modify their ifCondition automaticly (done for resources, + still open for classes and for constants in default values) + - finish config.w32 generation (almost done, need someone with windows build experience to finish and test this) @@ -26,11 +30,6 @@ - return by reference for 5.1 and above -- improve configure check for conditional resource types - -- have functions using a conditional resource type as - default set their ifCondition automaticly - - re2c and lemon support in config.m4 / Makefile.frag generation? - headers and libs within <with> are not taken into account in the http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/package.xml?r1=1.22&r2=1.23&diff_format=u Index: pear/CodeGen_PECL/package.xml diff -u pear/CodeGen_PECL/package.xml:1.22 pear/CodeGen_PECL/package.xml:1.23 --- pear/CodeGen_PECL/package.xml:1.22 Tue Oct 17 14:22:59 2006 +++ pear/CodeGen_PECL/package.xml Tue Oct 17 15:29:18 2006 @@ -62,7 +62,8 @@ Changes since 1.0.4: - new function prototype parser - added PHP version check to config.m4 -- +- functions accepting/returning resources now "inherit" + those resources conditional compilation settings </notes> <deps> http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Element/Function.php?r1=1.40&r2=1.41&diff_format=u Index: pear/CodeGen_PECL/PECL/Element/Function.php diff -u pear/CodeGen_PECL/PECL/Element/Function.php:1.40 pear/CodeGen_PECL/PECL/Element/Function.php:1.41 --- pear/CodeGen_PECL/PECL/Element/Function.php:1.40 Tue Oct 17 11:08:04 2006 +++ pear/CodeGen_PECL/PECL/Element/Function.php Tue Oct 17 15:29:18 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.40 2006/10/17 11:08:04 hholzgra Exp $ + * @version CVS: $Id: Function.php,v 1.41 2006/10/17 15:29:18 hholzgra Exp $ * @link http://pear.php.net/package/CodeGen */ @@ -993,7 +993,7 @@ switch ($this->role) { case "public": - $code .= $this->ifConditionStart(); + $code .= $this->ifConditionStart($extension); // function prototype comment $code .= "/* {{{ proto {$this->proto}\n "; @@ -1278,7 +1278,7 @@ $code .= "}\n/* }}} {$this->name} */\n\n"; - $code .= $this->ifConditionEnd(); + $code .= $this->ifConditionEnd($extension); break; @@ -1563,6 +1563,62 @@ { $this->returns = $returns; } + + function ifConditionStart($extension = false) + { + $code = parent::ifConditionStart(); + + if ($extension) { + $params = $this->params; + $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; + } + } + } + + return $code; + } + + function ifConditionEnd($extension = false) + { + $code = ""; + + if ($extension) { + $params = $this->params; + $params[] = $this->returns; + + 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; + } + } + } + + $code .= parent::ifConditionEnd(); + + return $code; + } } /*

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