summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-06-22 11:44:57 +0300
committerDmitry Stogov <dmitry@zend.com>2015-06-22 11:44:57 +0300
commited418312a5937389c3b2aa486291bfeb5ffde4c2 (patch)
tree80ca248e26edb2730d22fb80e5197a7e48f50373 /scripts
parent3db071dba23ee3ee694aab915d7acf105dfde3c3 (diff)
downloadphp-git-ed418312a5937389c3b2aa486291bfeb5ffde4c2.tar.gz
Revert "Fix arginfo for built-in engine functions"
This reverts commit d2356541d0386e3f0b6d593e2cc046ced68ff050.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/dev/genarginfo.php74
1 files changed, 0 insertions, 74 deletions
diff --git a/scripts/dev/genarginfo.php b/scripts/dev/genarginfo.php
deleted file mode 100644
index de69f5b045..0000000000
--- a/scripts/dev/genarginfo.php
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-$types = [
- 'string'=>'IS_STRING',
- 'int'=>'IS_LONG',
- 'float'=>'IS_DOUBLE',
- 'double'=>'IS_DOUBLE',
- 'bool'=>'_IS_BOOL',
- 'boolean'=>'_IS_BOOL',
- 'array'=>'IS_ARRAY',
- 'objects'=>'IS_OBJECT',
- 'resource'=>'IS_RESOURCE',
- 'callable'=>'IS_CALLABLE',
- 'callback'=>'IS_CALLABLE'
-];
-
-$file_contents = file_get_contents($argv[1]);
-$m = preg_match_all("~^\s*/\*\s+\{{3}\s+proto\s+(\S+)\s+(\w+)\s*\((.*?)\)~mU", $file_contents, $matches);
-if($m) {
- $rets = $names = $param_strs = [];
- foreach($matches[1] as $mk => $mv) {
- $origs[] = $matches[0][$mk];
- $rets[] = $matches[1][$mk];
- $names[] = $matches[2][$mk];
- $param_strs[] = $matches[3][$mk];
- }
- foreach($names as $k => $name) {
- $ret = $rets[$k];
- $param_str = $param_strs[$k];
- list(,$orig) = explode('proto ', $origs[$k]);
- list($count, $optional, $args) = parse_params($param_str);
- $required = $count - $optional;
- echo "/* ".trim($orig)." */\n";
- if(!empty($types[$ret])) {
- echo "ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_{$name}, 0, {$required}, {$types[$ret]}, 0, 0)\n";
- } else {
- echo "ZEND_BEGIN_ARG_INFO_EX(arginfo_{$name}, 0, 0, {$required})\n";
- }
- foreach($args as $arg) {
- list($type,$name) = explode(' ', $arg, 2);
- list($name,) = explode('|', $name, 2); // No |'s in the names - choose the first
- $type=trim($type);
- if(!empty($types[$type])) {
- echo "\tZEND_ARG_TYPE_INFO(0, {$name}, {$types[$type]}, 0)\n";
- } else {
- echo "\tZEND_ARG_INFO(0, {$name})\n";
- }
- }
- echo "ZEND_END_ARG_INFO()\n\n";
- }
-} else {
- echo "No function prototypes found in {$argv[1]}\n";
-}
-
-function parse_params($str) {
- $str = trim(strtolower($str));
- if(empty($str) || $str=='void') return [0,0,[]];
- $params = explode(',', $str);
- $optional = 0;
- $args = [];
- foreach($params as $i=>$p) {
- $p = trim($p);
- if($p[0]=='[') {
- $optional++;
- $p = ltrim($p, '[ ');
- } else if($i) {
- if(substr($params[$i-1],-1)=='[') $optional++;
- }
- $p = rtrim($p, ' ][');
- $args[$i] = $p;
- }
- return [$i+1,$optional, $args];
-}