api: Fix some basic syntax problems with the plugin API generator

Change-Id: I9e6afa5b75e7fb803ee4c29f8306b56d7f8d7f64
This commit is contained in:
Solomon Peachy 2025-04-20 16:54:29 -04:00
parent 3383060990
commit 6d656814dd
4 changed files with 17 additions and 17 deletions

View file

@ -1,4 +1,4 @@
<? <?php
$svn = "http://svn.rockbox.org/viewvc.cgi/trunk/"; $svn = "http://svn.rockbox.org/viewvc.cgi/trunk/";
$wiki = "http://www.rockbox.org/wiki/"; $wiki = "http://www.rockbox.org/wiki/";
@ -12,10 +12,10 @@ function func_sort($a, $b)
function get_newest() function get_newest()
{ {
global $svn; global $svn;
$mypath = $_SERVER['SCRIPT_FILENAME']; $mypath = "./"; //$_SERVER['SCRIPT_FILENAME'];
$mypath = substr($mypath, 0, strrpos($mypath, "/"))."/"; // $mypath = substr($mypath, 0, strrpos($mypath, "/"))."/";
$text = file_get_contents($mypath."../../apps/plugin.h"); $text = file_get_contents($mypath."../../apps/plugin.h");
$text = str_replace(array("\r\n", "\r"), "\n", $text); $text = str_replace(array("\r\n", "\r"), "\n", $text);
@ -55,7 +55,7 @@ function get_newest()
for($i=0; $i<count($text); $i++) for($i=0; $i<count($text); $i++)
{ {
$tmp = trim($text[$i]); $tmp = trim($text[$i]);
if(substr($tmp, 0, 1) == '#') if(substr($tmp, 0, 1) == '#')
{ {
$tmp = trim(substr($tmp, 1)); $tmp = trim(substr($tmp, 1));
@ -196,7 +196,7 @@ function get_args($func)
$buffer = ""; $buffer = "";
for($i=0; $i<strlen($func); $i++) for($i=0; $i<strlen($func); $i++)
{ {
switch($func{$i}) switch($func[$i])
{ {
case "(": case "(":
$level++; $level++;
@ -234,7 +234,7 @@ function get_args($func)
$buffer .= ","; $buffer .= ",";
break; break;
default: default:
$buffer .= $func{$i}; $buffer .= $func[$i];
break; break;
} }
} }
@ -295,8 +295,8 @@ function split_var($var)
function _simplify($text) function _simplify($text)
{ {
$text = ereg_replace('\(!\( (.*)[ ]?\)\)', '!\1', $text); // $text = ereg_replace('\(!\( (.*)[ ]?\)\)', '!\1', $text);
$text = ereg_replace('\(\(([^ ])\)\)', '\1', $text); // $text = preg_replace('/\(\((.*])\)\)/', '${1}', $text);
return $text; return $text;
} }
@ -313,7 +313,7 @@ function do_see_markup($data)
foreach($data as $el) foreach($data as $el)
{ {
$el = trim($el); $el = trim($el);
if(substr($el, 0, 1) != "[") if(substr($el, 0, 1) != "[")
$ret[] = do_markup("[F[".$el."]]"); $ret[] = do_markup("[F[".$el."]]");
else else

View file

@ -1,5 +1,5 @@
#!/usr/bin/php #!/usr/bin/php
<? <?php
require_once("functions.php"); require_once("functions.php");
function get_group($text) function get_group($text)
@ -134,4 +134,4 @@ foreach($inh as $group_name => $group)
} }
copy($mypath."layout.css", "output/layout.css"); copy($mypath."layout.css", "output/layout.css");
?> ?>

View file

@ -1,5 +1,5 @@
#!/usr/bin/php #!/usr/bin/php
<? <?php
require_once("functions.php"); require_once("functions.php");
echo '# Auto generated documentation by Rockbox plugin API generator v2'."\n"; echo '# Auto generated documentation by Rockbox plugin API generator v2'."\n";
@ -60,4 +60,4 @@ foreach(get_newest() as $line)
} }
echo "\n# END\n"; echo "\n# END\n";
?> ?>

View file

@ -1,5 +1,5 @@
#!/usr/bin/php #!/usr/bin/php
<? <?php
require_once("functions.php"); require_once("functions.php");
$input = file_get_contents($argv[1]); $input = file_get_contents($argv[1]);
@ -158,4 +158,4 @@ foreach($merged as $func => $line)
} }
echo "\n# END\n"; echo "\n# END\n";
?> ?>