From 545022872d4e5fbd3f3ce6a5b97b96e6cee7b08a Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Sat, 26 Apr 2003 15:42:59 +0000 Subject: [PATCH] constructor prototype changed code and documentation header and footer for constants block now generated by static class methods --- scripts/ext_skel_ng/php_constant.php | 56 +++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/scripts/ext_skel_ng/php_constant.php b/scripts/ext_skel_ng/php_constant.php index c1db564b73..d3d2e5d4f9 100644 --- a/scripts/ext_skel_ng/php_constant.php +++ b/scripts/ext_skel_ng/php_constant.php @@ -1,16 +1,31 @@ name = $name; - $this->value= $value; - $this->type = $type; + + function __construct($attr, $desc) { + + $this->name = $attr["name"]; + if (!$this->is_name($this->name)) { + $this->error[] = "'$attr[name]'is not a valid constant name"; + } + + $this->type = isset($attr["type"]) ? $this->is_type($attr["type"]) : "string"; + if (!in_array($this->type, array('int', 'float', 'string'))) { + $this->error[] = "'$attr[type]' is not a valid constant type, only int, float and string"; + } + + $this->value= $attr["value"]; $this->desc = $desc; } + + + static function c_code_header($name) { + return ""; + } function c_code() { - switch($this->type) { - case "integer": + switch ($this->type) { + case "int": return "REGISTER_LONG_CONSTANT(\"{$this->name}\", {$this->value}, 0);\n"; case "float": @@ -21,6 +36,27 @@ } } + static function c_code_footer() { + return ""; + } + + + + static function docbook_xml_header($name) { +" + $name constants + + + + name + value + descrpition + + + +"; + } + function docbook_xml() { return trim(" @@ -33,6 +69,14 @@ ")."\n"; } + + static function docbook_xml_footer() { + return +" + +
+"; + } } ?> -- 2.40.0