summaryrefslogtreecommitdiffstats
path: root/utils/rockbox_api/update.php
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-10-09 11:48:26 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-10-09 11:48:26 +0000
commite7ea23b18025f41d21095ab8983bd3097b4accfb (patch)
tree134708a4774c526a601d1f740ca1322f8940f842 /utils/rockbox_api/update.php
parent486869693c020e032626d3da6cd8dffb01217dbe (diff)
downloadrockbox-e7ea23b18025f41d21095ab8983bd3097b4accfb.tar.gz
rockbox-e7ea23b18025f41d21095ab8983bd3097b4accfb.tar.bz2
rockbox-e7ea23b18025f41d21095ab8983bd3097b4accfb.zip
Improve plugin API documentation updater a bit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18753 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/rockbox_api/update.php')
-rwxr-xr-xutils/rockbox_api/update.php44
1 files changed, 43 insertions, 1 deletions
diff --git a/utils/rockbox_api/update.php b/utils/rockbox_api/update.php
index ef4a456d12..5fb46c9d58 100755
--- a/utils/rockbox_api/update.php
+++ b/utils/rockbox_api/update.php
@@ -6,6 +6,7 @@ $input = file_get_contents($argv[1]);
$input = parse_documentation($input);
+/* Format input */
foreach($input as $rootname => $rootel)
{
foreach($rootel as $name => $el)
@@ -15,6 +16,7 @@ foreach($input as $rootname => $rootel)
$new = get_newest();
+/* Format new */
foreach($new as $name => $el)
{
unset($new[$name]);
@@ -43,8 +45,48 @@ foreach($new as $name => $el)
$new[$name]["return"][0] = "";
}
+/* Compare and merge both */
+$merged = array();
+foreach($new as $name => $el)
+{
+ if(isset($input[$name]))
+ {
+ $merged[$name] = $input[$name];
+ $merged[$name]["conditions"] = $new[$name]["conditions"];
+
+ if(strlen($el["group"][0]) > 0)
+ $merged[$name]["group"] = $el["group"];
+
+ if(isset($el["param"]))
+ {
+ foreach($el["param"] as $nr => $parel)
+ {
+ if($parel != $input[$name]["param"][$nr])
+ {
+ $param = trim($parel);
+ $p1 = substr($param, 0, strpos($param, " "));
+
+ $param = trim($input[$name]["param"][$nr]);
+ $p2 = substr($param, strpos($param, " "));
+ $merged[$name]["params"][] = $p1." ".$p2." [AUTO-ADDED]";
+ }
+ else
+ $merged[$name]["params"][] = $parel;
+ }
+ }
+
+ if(!isset($el["return"]) && isset($merged[$name]["return"]))
+ unset($merged[$name]["return"]);
+
+ unset($input[$name]);
+ }
+ else
+ $merged[$name] = $el;
+}
-$merged = array_merge($new, $input);
+/* Now to the rest of input */
+foreach($input as $name => $el)
+ $merged[$name." [DEPRECATED]"] = $el;
uksort($merged, "func_sort");