diff options
Diffstat (limited to 'utils/rockbox_api/update.php')
-rwxr-xr-x | utils/rockbox_api/update.php | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/utils/rockbox_api/update.php b/utils/rockbox_api/update.php new file mode 100755 index 0000000000..ef4a456d12 --- /dev/null +++ b/utils/rockbox_api/update.php | |||
@@ -0,0 +1,119 @@ | |||
1 | #!/usr/bin/php | ||
2 | <? | ||
3 | require_once("functions.php"); | ||
4 | |||
5 | $input = file_get_contents($argv[1]); | ||
6 | |||
7 | $input = parse_documentation($input); | ||
8 | |||
9 | foreach($input as $rootname => $rootel) | ||
10 | { | ||
11 | foreach($rootel as $name => $el) | ||
12 | $input[$name] = $el; | ||
13 | unset($input[$rootname]); | ||
14 | } | ||
15 | |||
16 | $new = get_newest(); | ||
17 | |||
18 | foreach($new as $name => $el) | ||
19 | { | ||
20 | unset($new[$name]); | ||
21 | $name = clean_func($el["func"]); | ||
22 | |||
23 | $new[$name] = array( | ||
24 | "group" => array($el["group"]), | ||
25 | "description" => array("") | ||
26 | ); | ||
27 | |||
28 | if(strlen($el["cond"]) > 2) | ||
29 | $new[$name]["conditions"][0] = $el["cond"]; | ||
30 | |||
31 | $args = get_args($el["func"]); | ||
32 | if(count($args) > 0) | ||
33 | { | ||
34 | foreach($args as $n => $arg) | ||
35 | { | ||
36 | $tmp = split_var($arg); | ||
37 | $args[$n] = $tmp[1]; | ||
38 | } | ||
39 | $new[$name]["param"] = $args; | ||
40 | } | ||
41 | |||
42 | if(get_return($el["func"]) !== false) | ||
43 | $new[$name]["return"][0] = ""; | ||
44 | } | ||
45 | |||
46 | |||
47 | $merged = array_merge($new, $input); | ||
48 | |||
49 | uksort($merged, "func_sort"); | ||
50 | |||
51 | echo '# Auto generated documentation by Rockbox plugin API generator v2'."\n"; | ||
52 | echo '# Made by Maurus Cuelenaere'."\n"; | ||
53 | echo <<<MOO | ||
54 | # __________ __ ___. | ||
55 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
56 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
57 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
58 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
59 | # \/ \/ \/ \/ \/ | ||
60 | # \$Id$ | ||
61 | # | ||
62 | # Generated from $svn\x61pps/plugin.h | ||
63 | # | ||
64 | # Format: | ||
65 | # \\group memory and strings | ||
66 | # \\conditions defined(HAVE_BACKLIGHT) | ||
67 | # \\param fmt | ||
68 | # \\return | ||
69 | # \\description | ||
70 | # \\see func1 func2 [S[apps/plugin.c]] | ||
71 | # | ||
72 | # Markup: | ||
73 | # [W[wiki url]] | ||
74 | # [S[svn url]] | ||
75 | # [F[function]] | ||
76 | # [[url]] | ||
77 | # %BR% | ||
78 | # =code= | ||
79 | |||
80 | MOO; | ||
81 | |||
82 | foreach($merged as $func => $line) | ||
83 | { | ||
84 | echo "\n".clean_func($func)."\n"; | ||
85 | |||
86 | if(strlen($line["group"]) > 0) | ||
87 | echo " \\group ".trim($line["group"][0])."\n"; | ||
88 | |||
89 | if(strlen($line["conditions"]) > 2) | ||
90 | echo " \\conditions ".trim(_simplify($line["conditions"][0]))."\n"; | ||
91 | |||
92 | if(isset($line["param"])) | ||
93 | { | ||
94 | foreach($line["param"] as $param) | ||
95 | { | ||
96 | if($param != "...") | ||
97 | echo " \\param ".trim($param)."\n"; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | if(isset($line["return"])) | ||
102 | { | ||
103 | if(trim($line["return"]) == "") | ||
104 | echo " \\return\n"; | ||
105 | else | ||
106 | echo " \\return ".trim($line["return"][0])."\n"; | ||
107 | } | ||
108 | |||
109 | if(trim($line["description"]) == "") | ||
110 | echo " \\description\n"; | ||
111 | else | ||
112 | echo " \\description ".trim($line["description"][0])."\n"; | ||
113 | |||
114 | if(isset($line["see"])) | ||
115 | echo " \\see ".trim($line["see"][0])."\n"; | ||
116 | } | ||
117 | |||
118 | echo "\n# END\n"; | ||
119 | ?> \ No newline at end of file | ||