From f7490c405b712f77ef11982f5fec054f97ce1dd6 Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Wed, 26 Feb 2003 10:06:47 +0000 Subject: [PATCH] forgot to add these two on my last commit :( --- scripts/ext_skel_ng/php_logo.php | 51 ++++++++++++++++++++++ scripts/ext_skel_ng/php_resource.php | 65 ++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 scripts/ext_skel_ng/php_logo.php create mode 100644 scripts/ext_skel_ng/php_resource.php diff --git a/scripts/ext_skel_ng/php_logo.php b/scripts/ext_skel_ng/php_logo.php new file mode 100644 index 0000000000..5d2adf6fad --- /dev/null +++ b/scripts/ext_skel_ng/php_logo.php @@ -0,0 +1,51 @@ +name = $name; + $this->attr = $attr; + $this->id = '"'.strtoupper($name).'_LOGO_ID"'; + + $this->data = file_get_contents($attr['src']); + $this->size = strlen($this->data); + + $this->mime_type = "image/gif"; + } + + function docbook_xml($base) { + return ""; + } + + function minit_code() { + return " php_register_info_logo({$this->id}, \"{$this->mime_type}\", {$this->name}_logo, {$this->size});\n"; + } + + function c_code() { + return " +static unsigned char {$this->name}_logo[] = { +#include \"{$this->name}_logo.h\" +}; +"; + } + + function h_code() { + $len = strlen($this->data); + $code = " "; + $i=0; + for($n = 0; $n < $len; $n++) { + $code .= sprintf(" %3d",ord($this->data[$n])); + if($n == $len - 1) break; + $code .= ","; + if(++$i==8) { + $code .= "\n "; + $i=0; + } + } + + $code .= "\n"; + + return $code; + } + } + +?> \ No newline at end of file diff --git a/scripts/ext_skel_ng/php_resource.php b/scripts/ext_skel_ng/php_resource.php new file mode 100644 index 0000000000..ea99405841 --- /dev/null +++ b/scripts/ext_skel_ng/php_resource.php @@ -0,0 +1,65 @@ +name = $name; + $this->payload = $payload; + $this->destruct = $destruct; + $this->description = $description; + + if (empty($this->destruct) && strstr($this->payload, "*")) { + $this->destruct = " free(resource);\n"; + } + + if(empty($this->payload)) { + $this->payload = "int"; + } + } + + function docbook_xml($base) { + return " +
+ <litera>{$this->name}</literal> + + {$this->description} + +
+"; + } + + function minit_code() { + return " +le_{$this->name} = zend_register_list_destructors_ex({$this->name}_dtor, + NULL, + \"{$this->name}\", + module_number); + +"; + } + + function c_code() { + return " +int le_{$this->name}; + +void {$this->name}_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ + {$this->payload} resource = ({$this->payload})(rsrc->ptr); + + {$this->destruct} +} +"; + } + + function h_code() { + $upname = strtoupper($this->name); + + return " +#define {$upname}_FETCH(r, z) ZEND_FETCH_RESOURCE(r, {$this->payload}, z, -1, ${$this->name}, le_{$this->nameĀ }); \ + if(!r) { RETURN_FALSE; } + +#define {$upname}_REGISTER(r) ZEND_REGISTER_RESOURCE(return_value, r, le_{$this->nameĀ }); +"; + } + } + +?> \ No newline at end of file -- 2.50.1