betz Thu Sep 8 15:29:20 2005 EDT
Modified files: /phpdoc/scripts xml_proto.php Log: no tabs
http://cvs.php.net/diff.php/phpdoc/scripts/xml_proto.php?r1=1.35&r2=1.36&ty=u Index: phpdoc/scripts/xml_proto.php diff -u phpdoc/scripts/xml_proto.php:1.35 phpdoc/scripts/xml_proto.php:1.36 --- phpdoc/scripts/xml_proto.php:1.35 Wed Sep 7 04:20:42 2005 +++ phpdoc/scripts/xml_proto.php Thu Sep 8 15:29:19 2005 @@ -16,7 +16,7 @@ | Authors: Brad House <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: xml_proto.php,v 1.35 2005/09/07 08:20:42 vrana Exp $ + $Id: xml_proto.php,v 1.36 2005/09/08 19:29:19 betz Exp $ */ /* @@ -49,8 +49,8 @@ - Generation of references.xml template - functions with optional arguments would not parse properly, now it does - Wildcard scanning is now allowed - - Requires PHP 4.3.0-pre1 or higher now - - Usage is totally different + - Requires PHP 4.3.0-pre1 or higher now + - Usage is totally different 05/06/04 v2.1 - Corrected filenames for OO functions 01/03/05 v2.2 - Implemented the new doc style 08/08/05 v2.3 - Refpurpose is on one line @@ -159,7 +159,7 @@ } fwrite($fp, '<?xml version="1.0" encoding="iso-8859-1"?>'."\n" . - '<!-- $Revision: 1.35 $ -->'."\n" . + '<!-- $Revision: 1.36 $ -->'."\n" . "<!-- Purpose: -->\n" . "<!-- Membership: -->\n" . "<!-- Generated by xml_proto.php v" . $version . ". Found in /scripts directory of phpdoc. -->\n" . @@ -246,7 +246,7 @@ $functype = trim($funclist[$i]["function_type"]); fwrite($fp, '<?xml version="1.0" encoding="iso-8859-1"?>'."\n" . - '<!-- $Revision: 1.35 $ -->'."\n" . + '<!-- $Revision: 1.36 $ -->'."\n" . "<!-- Generated by xml_proto.php v" . $version . ". Found in /scripts directory of phpdoc. -->\n" . "<refentry id=\"function." . $fixname . "\">\n" . " <refnamediv>\n" . @@ -443,19 +443,19 @@ case '\n': case ' ': if (!$spaces) { - $spaces=1; + $spaces=1; $temp .= ' '; - $temp_len++; + $temp_len++; } - break; + break; default: if ($c != '\r' && $c != '\n') { $spaces=0; - $temp .= $c; - $temp_len++; + $temp .= $c; + $temp_len++; } - break; + break; } } function_add_purpose($func_num, $temp); @@ -464,129 +464,129 @@ function parse_proto($proto) { - $len=0; - $i=0; - $c=0; - $done=0; - $start=0; - $func_number=-1; - $got_proto_def=0; - $got_proto_type=0; - $got_proto_name=0; - $got_arg_type=0; - $start_args=0; - $temp=""; - $temp2=""; - $temp_len=0; - $isopt=0; - - $len=strlen($proto); - - for ($i=0; $i<$len; $i++) { - $c=substr($proto, $i, 1); - switch ($c) { - case '\r': - case '\n': - case ' ': - if ($temp_len) { - if (!$got_proto_def) { - if (strcasecmp($temp, "proto") != 0) { - // Possibly just a comment, don't output error info - // echo "Not a proper proto definition: $proto\n"; - return(0); - } else { - $got_proto_def=1; - } - } else if (!$got_proto_type) { - $func_number=new_function(); - function_add_type($func_number, $temp); - $got_proto_type=1; - } else if (!$got_proto_name) { - function_add_name($func_number, $temp); - $got_proto_name=1; - } else if ($start_args && !$got_arg_type) { - $got_arg_type=1; - $temp2=$temp; - } else if ($start_args && $got_arg_type) { - $got_arg_type=0; - function_add_arg($func_number, $temp2, $temp, $isopt); - $temp2=""; - } - $temp_len=0; - $temp=""; - } - break; + $len=0; + $i=0; + $c=0; + $done=0; + $start=0; + $func_number=-1; + $got_proto_def=0; + $got_proto_type=0; + $got_proto_name=0; + $got_arg_type=0; + $start_args=0; + $temp=""; + $temp2=""; + $temp_len=0; + $isopt=0; + + $len=strlen($proto); + + for ($i=0; $i<$len; $i++) { + $c=substr($proto, $i, 1); + switch ($c) { + case '\r': + case '\n': + case ' ': + if ($temp_len) { + if (!$got_proto_def) { + if (strcasecmp($temp, "proto") != 0) { + // Possibly just a comment, don't output error info + // echo "Not a proper proto definition: $proto\n"; + return(0); + } else { + $got_proto_def=1; + } + } else if (!$got_proto_type) { + $func_number=new_function(); + function_add_type($func_number, $temp); + $got_proto_type=1; + } else if (!$got_proto_name) { + function_add_name($func_number, $temp); + $got_proto_name=1; + } else if ($start_args && !$got_arg_type) { + $got_arg_type=1; + $temp2=$temp; + } else if ($start_args && $got_arg_type) { + $got_arg_type=0; + function_add_arg($func_number, $temp2, $temp, $isopt); + $temp2=""; + } + $temp_len=0; + $temp=""; + } + break; - case '[': - if ($got_proto_name) { - $isopt=1; - } else { - echo "Not a proper proto definition -5: $proto\n"; - } - break; + case '[': + if ($got_proto_name) { + $isopt=1; + } else { + echo "Not a proper proto definition -5: $proto\n"; + } + break; - case ']': - if ($got_proto_name && $isopt) { - } else { - echo "Not a proper proto definition -6: $proto\n"; - } - break; - - case '(': - if ($got_proto_type && $got_proto_def &&!$got_proto_name) { - function_add_name($func_number, $temp); - $temp=""; - $temp_len=0; - $start_args=1; - $got_proto_name=1; - } else { - echo "Not a proper proto definition -2: $proto\n"; - return(0); - } - - break; - - case ')': - if ($start_args) { - if ($got_arg_type && $temp_len) { - function_add_arg($func_number, $temp2, $temp, $isopt); - $temp=""; - $temp_len=0; - } - $done=1; - } else { - echo "Not a proper proto definition -4: $proto\n"; - return(0); - } - break; - - case ',': - if ($start_args && $got_arg_type) { - $got_arg_type=0; - function_add_arg($func_number, $temp2, $temp, $isopt); - $temp2=""; - $temp=""; - $temp_len=0; - } else if ($temp && !$temp2) { - echo "Not a proper proto definition -3: $temp2 : $temp : $proto\n"; - return(0); - } - break; - - default: - if ($c != '\r' && $c != '\n') { - $temp .= $c; - $temp_len++; - } - break; - } - if ($done) { - $start=$i+1; - break; + case ']': + if ($got_proto_name && $isopt) { + } else { + echo "Not a proper proto definition -6: $proto\n"; + } + break; + + case '(': + if ($got_proto_type && $got_proto_def &&!$got_proto_name) { + function_add_name($func_number, $temp); + $temp=""; + $temp_len=0; + $start_args=1; + $got_proto_name=1; + } else { + echo "Not a proper proto definition -2: $proto\n"; + return(0); + } + + break; + + case ')': + if ($start_args) { + if ($got_arg_type && $temp_len) { + function_add_arg($func_number, $temp2, $temp, $isopt); + $temp=""; + $temp_len=0; + } + $done=1; + } else { + echo "Not a proper proto definition -4: $proto\n"; + return(0); + } + break; + + case ',': + if ($start_args && $got_arg_type) { + $got_arg_type=0; + function_add_arg($func_number, $temp2, $temp, $isopt); + $temp2=""; + $temp=""; + $temp_len=0; + } else if ($temp && !$temp2) { + echo "Not a proper proto definition -3: $temp2 : $temp : $proto\n"; + return(0); + } + break; + + default: + if ($c != '\r' && $c != '\n') { + $temp .= $c; + $temp_len++; + } + break; + } + if ($done) { + $start=$i+1; + break; + } } - } - parse_desc($func_number, substr($proto, $start)); - return(1); + parse_desc($func_number, substr($proto, $start)); + return(1); } function parse_file($buffer) @@ -625,35 +625,35 @@ function add_constant($varlist, $type) { - $on_name=0; - $len=strlen($varlist); - for ($i=0; $i<$len; $i++) { - $c=substr($varlist, $i, 1); - switch($c) { - case '"'; - if (!$on_name) { - $on_name=1; - $name=""; - } else { - $on_name=0; - add_constant_to_list($name, $type); - return(1); - } - break; + $on_name=0; + $len=strlen($varlist); + for ($i=0; $i<$len; $i++) { + $c=substr($varlist, $i, 1); + switch($c) { + case '"'; + if (!$on_name) { + $on_name=1; + $name=""; + } else { + $on_name=0; + add_constant_to_list($name, $type); + return(1); + } + break; + + case ',': + return(0); + break; + + default: + if ($on_name) { + $name .= $c; + } + break; - case ',': - return(0); - break; - - default: - if ($on_name) { - $name .= $c; } - break; - - } - } - return(0); + } + return(0); } function scan_for_constants_byref($buffer, $string, $type) @@ -856,13 +856,13 @@ } } else { $temp_source_files=glob($progargv[$i]); - $num=count($source_files); - $new_num=count($temp_source_files); - for ($j=0; $j<$new_num; $j++) { - $source_files[$num+$j]=$temp_source_files[$j]; - } - $total=count($source_files); - + $num=count($source_files); + $new_num=count($temp_source_files); + for ($j=0; $j<$new_num; $j++) { + $source_files[$num+$j]=$temp_source_files[$j]; + } + $total=count($source_files); + if ($total == 0) { die("FATAL ERROR: Could not find any PHP source files to parse\n"); }