hholzgra                Fri Feb 28 01:37:05 2003 EDT

  Modified files:              
    /php4/scripts/ext_skel_ng   extension_parser.php php_function.php 
  Log:
  - support for "callback" type
  - proto syntax errors are now passed back to the top level parser
  
  
Index: php4/scripts/ext_skel_ng/extension_parser.php
diff -u php4/scripts/ext_skel_ng/extension_parser.php:1.5 
php4/scripts/ext_skel_ng/extension_parser.php:1.6
--- php4/scripts/ext_skel_ng/extension_parser.php:1.5   Mon Feb 24 05:57:48 2003
+++ php4/scripts/ext_skel_ng/extension_parser.php       Fri Feb 28 01:37:04 2003
@@ -196,6 +196,7 @@
                                $this->private_functions[$attr['name']] = $function;
                                break;
                        case "public":
+                               if(is_string($function->status)) 
$this->error($function->status." in prototype");
                                $this->functions[$attr['name']] = $function;
                                break;
                        default:
@@ -282,7 +283,7 @@
                        $fp = fopen("$docdir/reference.xml", "w");
                        fputs($fp,
 "<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- \$Revision: 1.5 $ -->
+<!-- \$Revision: 1.6 $ -->
  <reference id='ref.{$this->name}'>
   <title>{$this->summary}</title>
   <titleabbrev>{$this->name}</titleabbrev>
Index: php4/scripts/ext_skel_ng/php_function.php
diff -u php4/scripts/ext_skel_ng/php_function.php:1.4 
php4/scripts/ext_skel_ng/php_function.php:1.5
--- php4/scripts/ext_skel_ng/php_function.php:1.4       Mon Feb 24 05:57:48 2003
+++ php4/scripts/ext_skel_ng/php_function.php   Fri Feb 28 01:37:05 2003
@@ -8,7 +8,7 @@
                        $this->desc = empty($desc) ? "&warn.undocumented.func;" : 
$desc;
       $this->code = $code;
                        $this->role = empty($role) ? "public" : $role;
-                       if($this->role === "public") $this->parse_proto($proto);
+                       if($this->role === "public") $this->status = 
$this->parse_proto($proto);
                } 
                
                function parse_proto($proto) {
@@ -32,9 +32,9 @@
                        $opts=0;
                        $params=array();
                        $return_type = ($this->is_type($tokens[$n])) ? $tokens[$n++] : 
"void";
-                       if(! $this->is_name($tokens[$n])) die("$tokens[$n] is not a 
valid function name");
+                       if(! $this->is_name($tokens[$n])) return("$tokens[$n] is not a 
valid function name");
                        $function_name = $tokens[$n++];
-                       if($tokens[$n]!='(') die("'(' expected instead of 
'$tokens[$n]'");
+                       if($tokens[$n]!='(') return("'(' expected instead of 
'$tokens[$n]'");
                        if($tokens[++$n]!=')') {                        
                                for($param=0;$tokens[$n];$n++,$param++) {
                                        if($tokens[$n]=='[') {
@@ -42,11 +42,11 @@
                                                $opts++;
                                                $n++;
                                                if($param>0) { 
-                                                       if ($tokens[$n]!=',') die("',' 
expected after '[' instead of $token[$n]");
+                                                       if ($tokens[$n]!=',') 
return("',' expected after '[' instead of '$token[$n]'");
                                                        $n++;
                                                }
                                        }
-                                       if(!$this->is_type($tokens[$n])) die("type 
name expected instead of $tokens[$n]");
+                                       if(!$this->is_type($tokens[$n])) return("type 
name expected instead of '$tokens[$n]'");
                                        $params[$param]['type']=$tokens[$n];
                                        $n++;
                                        if($this->is_name($tokens[$n])) {
@@ -67,13 +67,15 @@
                                $n++;
                                $opts--;
                        }
-                       if($opts!=0) die ("'[' / ']' count mismatch");
-                       if($tokens[$n] != ')') die ("')' expected instead of 
$tokens[$n]");
+                       if($opts!=0) return ("'[' / ']' count mismatch");
+                       if($tokens[$n] != ')') return("')' expected instead of 
'$tokens[$n]'");
                        
                        $this->name     = $function_name;
                        $this->returns  = $return_type;
                        $this->params   = $params;
                        $this->optional = $numopts;
+
+                       return true;
                }
 
                function c_code() {
@@ -154,6 +156,7 @@
                                                        ."  }\n";
                                                break;
                                        case "mixed":
+                                       case "callback":
                                                $arg_string.="z";
                                                $code .= "  zval * $name = NULL;\n";
                                                break;
@@ -189,7 +192,7 @@
                function docbook_xml() {
                        $xml = 
 '<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
   <refentry id="function.'.strtolower(str_replace("_","-",$this->name)).'">
    <refnamediv>
     <refname>'.$this->name.'</refname>



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to