diff options
Diffstat (limited to 'utils/rockbox_api')
-rwxr-xr-x | utils/rockbox_api/functions.php | 5 | ||||
-rwxr-xr-x | utils/rockbox_api/update.php | 44 |
2 files changed, 47 insertions, 2 deletions
diff --git a/utils/rockbox_api/functions.php b/utils/rockbox_api/functions.php index 57a7c99b13..d66caa1b29 100755 --- a/utils/rockbox_api/functions.php +++ b/utils/rockbox_api/functions.php | |||
@@ -13,7 +13,10 @@ function get_newest() | |||
13 | { | 13 | { |
14 | global $svn; | 14 | global $svn; |
15 | 15 | ||
16 | $text = file_get_contents("../../apps/plugin.h"); | 16 | $mypath = $_SERVER['SCRIPT_FILENAME']; |
17 | $mypath = substr($mypath, 0, strrpos($mypath, "/"))."/"; | ||
18 | |||
19 | $text = file_get_contents($mypath."../../apps/plugin.h"); | ||
17 | 20 | ||
18 | $text = str_replace(array("\r\n", "\r"), "\n", $text); | 21 | $text = str_replace(array("\r\n", "\r"), "\n", $text); |
19 | 22 | ||
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]); | |||
6 | 6 | ||
7 | $input = parse_documentation($input); | 7 | $input = parse_documentation($input); |
8 | 8 | ||
9 | /* Format input */ | ||
9 | foreach($input as $rootname => $rootel) | 10 | foreach($input as $rootname => $rootel) |
10 | { | 11 | { |
11 | foreach($rootel as $name => $el) | 12 | foreach($rootel as $name => $el) |
@@ -15,6 +16,7 @@ foreach($input as $rootname => $rootel) | |||
15 | 16 | ||
16 | $new = get_newest(); | 17 | $new = get_newest(); |
17 | 18 | ||
19 | /* Format new */ | ||
18 | foreach($new as $name => $el) | 20 | foreach($new as $name => $el) |
19 | { | 21 | { |
20 | unset($new[$name]); | 22 | unset($new[$name]); |
@@ -43,8 +45,48 @@ foreach($new as $name => $el) | |||
43 | $new[$name]["return"][0] = ""; | 45 | $new[$name]["return"][0] = ""; |
44 | } | 46 | } |
45 | 47 | ||
48 | /* Compare and merge both */ | ||
49 | $merged = array(); | ||
50 | foreach($new as $name => $el) | ||
51 | { | ||
52 | if(isset($input[$name])) | ||
53 | { | ||
54 | $merged[$name] = $input[$name]; | ||
55 | $merged[$name]["conditions"] = $new[$name]["conditions"]; | ||
56 | |||
57 | if(strlen($el["group"][0]) > 0) | ||
58 | $merged[$name]["group"] = $el["group"]; | ||
59 | |||
60 | if(isset($el["param"])) | ||
61 | { | ||
62 | foreach($el["param"] as $nr => $parel) | ||
63 | { | ||
64 | if($parel != $input[$name]["param"][$nr]) | ||
65 | { | ||
66 | $param = trim($parel); | ||
67 | $p1 = substr($param, 0, strpos($param, " ")); | ||
68 | |||
69 | $param = trim($input[$name]["param"][$nr]); | ||
70 | $p2 = substr($param, strpos($param, " ")); | ||
71 | $merged[$name]["params"][] = $p1." ".$p2." [AUTO-ADDED]"; | ||
72 | } | ||
73 | else | ||
74 | $merged[$name]["params"][] = $parel; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | if(!isset($el["return"]) && isset($merged[$name]["return"])) | ||
79 | unset($merged[$name]["return"]); | ||
80 | |||
81 | unset($input[$name]); | ||
82 | } | ||
83 | else | ||
84 | $merged[$name] = $el; | ||
85 | } | ||
46 | 86 | ||
47 | $merged = array_merge($new, $input); | 87 | /* Now to the rest of input */ |
88 | foreach($input as $name => $el) | ||
89 | $merged[$name." [DEPRECATED]"] = $el; | ||
48 | 90 | ||
49 | uksort($merged, "func_sort"); | 91 | uksort($merged, "func_sort"); |
50 | 92 | ||