cvs: pear /CodeGen_PECL/PECL Extension.php ExtensionParser.php /CodeGen_PECL/PECL/Element Constant.php
| From: | Hartmut Holzgraefe | Date: | Thu, 17 Aug 2006 17:05:14 +0000 |
| Subject: | cvs: pear /CodeGen_PECL/PECL Extension.php ExtensionParser.php /CodeGen_PECL/PECL/Element Constant.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-41666@lists.php.net to get a copy of this message | ||
hholzgra Thu Aug 17 17:05:14 2006 UTC
Modified files:
/pear/CodeGen_PECL/PECL Extension.php ExtensionParser.php
/pear/CodeGen_PECL/PECL/Element Constant.php
Log:
constants now have a "group=..." attribute and are grouped by
this in the documentation
the <constants> tag may now be used to set a default group name
http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Extension.php?r1=1.53&r2=1.54&diff_format=u
Index: pear/CodeGen_PECL/PECL/Extension.php
diff -u pear/CodeGen_PECL/PECL/Extension.php:1.53 pear/CodeGen_PECL/PECL/Extension.php:1.54
--- pear/CodeGen_PECL/PECL/Extension.php:1.53 Wed Aug 16 10:40:51 2006
+++ pear/CodeGen_PECL/PECL/Extension.php Thu Aug 17 17:05:14 2006
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Extension.php,v 1.53 2006/08/16 10:40:51 hholzgra Exp $
+ * @version CVS: $Id: Extension.php,v 1.54 2006/08/17 17:05:14 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen_PECL
*/
@@ -681,13 +681,25 @@
if (empty($this->constants)) {
$fp->puts(" &no.constants;\n");
} else {
- $fp->puts(CodeGen_PECL_Element_Constant::docHeader($idName));
+ $const_groups = array();
foreach ($this->constants as $constant) {
- $fp->puts($constant->docEntry($idName));
+ $const_groups[$constant->getGroup()][] = $constant;
}
- $fp->puts(CodeGen_PECL_Element_Constant::docFooter());
+ foreach ($const_groups as $group => $constants) {
+ if ($group == "default") {
+ $group = $idName;
+ }
+
+ $fp->puts(CodeGen_PECL_Element_Constant::docHeader($group));
+
+ foreach ($constants as $constant) {
+ $fp->puts($constant->docEntry($group));
+ }
+
+ $fp->puts(CodeGen_PECL_Element_Constant::docFooter());
+ }
}
$fp->puts(
@@ -708,6 +720,9 @@
$fp = new CodeGen_Tools_FileReplacer("$docdir/configure.xml");
$fp->puts("\n <section id='$idName.requirements'>\n
&reftitle.required;\n");
+
+ // TODO headers and libs are now "hidden" in $with
+
if (empty($this->libs) && empty($this->headers)) {
$fp->puts(" &no.requirement;\n");
} else {
http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/ExtensionParser.php?r1=1.47&r2=1.48&diff_format=u
Index: pear/CodeGen_PECL/PECL/ExtensionParser.php
diff -u pear/CodeGen_PECL/PECL/ExtensionParser.php:1.47
pear/CodeGen_PECL/PECL/ExtensionParser.php:1.48
--- pear/CodeGen_PECL/PECL/ExtensionParser.php:1.47 Mon Aug 14 22:50:43 2006
+++ pear/CodeGen_PECL/PECL/ExtensionParser.php Thu Aug 17 17:05:14 2006
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: ExtensionParser.php,v 1.47 2006/08/14 22:50:43 hholzgra Exp $
+ * @version CVS: $Id: ExtensionParser.php,v 1.48 2006/08/17 17:05:14 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen
*/
@@ -352,6 +352,9 @@
}
+ function tagstart_constants($attr) {
+ $this->pushHelper($attr);
+ }
function tagend_extension_constant($attr, $data)
{
@@ -397,12 +400,22 @@
return $err;
}
+ if (isset($attr["group"])) {
+ $err = $const->setGroup($attr["group"]);
+ } else if (is_array($this->helper) &&
isset($this->helper["group"])) {
+ $err = $const->setGroup($this->helper["group"]);
+ }
+ if (PEAR::isError($err)) {
+ return $err;
+ }
+
$const->setDesc(CodeGen_Tools_IndentC::linetrim($data));
return $this->extension->addConstant($const);
}
function tagend_constants($attr, $data) {
+ $this->popHelper();
return true;
}
http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Element/Constant.php?r1=1.4&r2=1.5&diff_format=u
Index: pear/CodeGen_PECL/PECL/Element/Constant.php
diff -u pear/CodeGen_PECL/PECL/Element/Constant.php:1.4
pear/CodeGen_PECL/PECL/Element/Constant.php:1.5
--- pear/CodeGen_PECL/PECL/Element/Constant.php:1.4 Thu Feb 9 21:59:22 2006
+++ pear/CodeGen_PECL/PECL/Element/Constant.php Thu Aug 17 17:05:14 2006
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Constant.php,v 1.4 2006/02/09 21:59:22 hholzgra Exp $
+ * @version CVS: $Id: Constant.php,v 1.5 2006/08/17 17:05:14 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen
*/
@@ -79,7 +79,13 @@
* @var bool
*/
protected $define = false;
-
+
+ /**
+ * Resource group
+ *
+ * @var string
+ */
+ protected $group = "default";
/**
* Set constant name
@@ -176,6 +182,31 @@
return true;
}
+ /**
+ * Set group this constant belongs to
+ *
+ * @access public
+ * @param string group name
+ * @return bool true on success
+ */
+ function setGroup($group)
+ {
+ $this->group = $group;
+
+ return true;
+ }
+
+ /**
+ * Get group thsi constant belongs to
+ *
+ * @access public
+ * @return string group name
+ */
+ function getGroup()
+ {
+ return $this->group;
+ }
+
/**
* Set define flag
*
@@ -272,15 +303,14 @@
*/
function docEntry($base) {
return trim("
-<row>
- <entry>
- <constant
id='constant".strtolower(str_replace("_","-",$this->name))."'>{$this->name}</constant>
- (<link linkend='language.types.integer'>integer</link>)
- </entry>
- <entry>{$this->value}</entry>
- <entry>{$this->desc}</entry>
-</row>
-")."\n";
+ <row>
+ <entry>
+ <constant
id='constant".strtolower(str_replace("_","-",$this->name))."'>{$this->name}</constant>
+ (<link linkend='language.types.integer'>integer</link>)
+ </entry>
+ <entry>{$this->value}</entry>
+ <entry>{$this->desc}</entry>
+ </row>\n\n");
}
/**