blob: fd1ac363528f13c2939c00f7b76cec6984d2e4a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?php
class php_constant extends php_element {
function php_constant($name, $value, $type="string", $desc="") {
$this->name = $name;
$this->value= $value;
$this->type = $type;
$this->desc = $desc;
}
function c_code() {
switch($this->type) {
case "integer":
return "REGISTER_LONG_CONSTANT(\"{$this->name}\", {$this->value}, 0);\n";
case "float":
return "REGISTER_DOUBLE_CONSTANT(\"{$this->name}\", {$this->value}, 0);\n";
case "string":
return "REGISTER_STRING_CONSTANT(\"{$this->name}\", \"$value\", ".strlen($this->value).", 0);\n";
}
}
function docbook_xml() {
return trim("
<row>
<entry>
<constant id='constant".strtolower(str_replace("_","-",$this->name))."'>$name</constant>
(<link linkend='language.types.integer'>integer</link>)
</entry>
<entry>{$this->value}</entry>
<entry>{$this->desc}</entry>
</row>
")."\n";
}
}
?>
|