3 require_once("functions.php");
5 $input = file_get_contents($argv[1]);
7 $input = parse_documentation($input);
10 foreach($input as $rootname => $rootel)
12 foreach($rootel as $name => $el)
14 unset($input[$rootname]);
20 foreach($new as $name => $el)
23 $name = clean_func($el["func"]);
26 "group" => array($el["group"]),
27 "description" => array("")
30 if(strlen($el["cond"]) > 2)
31 $new[$name]["conditions"][0] = $el["cond"];
33 $args = get_args($el["func"]);
36 foreach($args as $n => $arg)
38 $tmp = split_var($arg);
41 $new[$name]["param"] = $args;
44 if(get_return($el["func"]) !== false)
45 $new[$name]["return"][0] = "";
48 /* Compare and merge both */
50 foreach($new as $name => $el)
52 if(isset($input[$name]))
54 $merged[$name] = $input[$name];
55 $merged[$name]["conditions"] = $new[$name]["conditions"];
57 if(strlen($el["group"][0]) > 0)
58 $merged[$name]["group"] = $el["group"];
60 if(isset($el["param"]))
62 foreach($el["param"] as $nr => $parel)
64 if($parel != $input[$name]["param"][$nr])
66 $param = trim($parel);
67 $p1 = substr($param, 0, strpos($param, " "));
69 $param = trim($input[$name]["param"][$nr]);
70 $p2 = substr($param, strpos($param, " "));
71 $merged[$name]["params"][] = $p1." ".$p2." [AUTO-ADDED]";
74 $merged[$name]["params"][] = $parel;
78 if(!isset($el["return"]) && isset($merged[$name]["return"]))
79 unset($merged[$name]["return"]);
87 /* Now to the rest of input */
88 foreach($input as $name => $el)
89 $merged[$name." [DEPRECATED]"] = $el;
91 uksort($merged, "func_sort");
93 echo '# Auto generated documentation by Rockbox plugin API generator v2'."\n";
94 echo '# Made by Maurus Cuelenaere'."\n";
97 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
98 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
99 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
100 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
104 # Generated from $svn\x61pps/plugin.h
107 # \\group memory and strings
108 # \\conditions defined(HAVE_BACKLIGHT)
112 # \\see func1 func2 [S[apps/plugin.c]]
124 foreach($merged as $func => $line)
126 echo "\n".clean_func($func)."\n";
128 if(strlen($line["group"]) > 0)
129 echo " \\group ".trim($line["group"][0])."\n";
131 if(strlen($line["conditions"]) > 2)
132 echo " \\conditions ".trim(_simplify($line["conditions"][0]))."\n";
134 if(isset($line["param"]))
136 foreach($line["param"] as $param)
139 echo " \\param ".trim($param)."\n";
143 if(isset($line["return"]))
145 if(trim($line["return"]) == "")
148 echo " \\return ".trim($line["return"][0])."\n";
151 if(trim($line["description"]) == "")
152 echo " \\description\n";
154 echo " \\description ".trim($line["description"][0])."\n";
156 if(isset($line["see"]))
157 echo " \\see ".trim($line["see"][0])."\n";