From 20fb47ec778abe215ca69692434ff753596319e6 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Mon, 6 Oct 2008 22:19:54 +0000 Subject: Commit FS#9462: an semi-automatic plugin API documentation generator git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18722 a1c6a512-1295-4272-9138-f99709370657 --- utils/rockbox_api/update.php | 119 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100755 utils/rockbox_api/update.php (limited to 'utils/rockbox_api/update.php') diff --git a/utils/rockbox_api/update.php b/utils/rockbox_api/update.php new file mode 100755 index 0000000..ef4a456 --- /dev/null +++ b/utils/rockbox_api/update.php @@ -0,0 +1,119 @@ +#!/usr/bin/php + $rootel) +{ + foreach($rootel as $name => $el) + $input[$name] = $el; + unset($input[$rootname]); +} + +$new = get_newest(); + +foreach($new as $name => $el) +{ + unset($new[$name]); + $name = clean_func($el["func"]); + + $new[$name] = array( + "group" => array($el["group"]), + "description" => array("") + ); + + if(strlen($el["cond"]) > 2) + $new[$name]["conditions"][0] = $el["cond"]; + + $args = get_args($el["func"]); + if(count($args) > 0) + { + foreach($args as $n => $arg) + { + $tmp = split_var($arg); + $args[$n] = $tmp[1]; + } + $new[$name]["param"] = $args; + } + + if(get_return($el["func"]) !== false) + $new[$name]["return"][0] = ""; +} + + +$merged = array_merge($new, $input); + +uksort($merged, "func_sort"); + +echo '# Auto generated documentation by Rockbox plugin API generator v2'."\n"; +echo '# Made by Maurus Cuelenaere'."\n"; +echo << ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# \$Id$ +# +# Generated from $svn\x61pps/plugin.h +# +# Format: +# \\group memory and strings +# \\conditions defined(HAVE_BACKLIGHT) +# \\param fmt +# \\return +# \\description +# \\see func1 func2 [S[apps/plugin.c]] +# +# Markup: +# [W[wiki url]] +# [S[svn url]] +# [F[function]] +# [[url]] +# %BR% +# =code= + +MOO; + +foreach($merged as $func => $line) +{ + echo "\n".clean_func($func)."\n"; + + if(strlen($line["group"]) > 0) + echo " \\group ".trim($line["group"][0])."\n"; + + if(strlen($line["conditions"]) > 2) + echo " \\conditions ".trim(_simplify($line["conditions"][0]))."\n"; + + if(isset($line["param"])) + { + foreach($line["param"] as $param) + { + if($param != "...") + echo " \\param ".trim($param)."\n"; + } + } + + if(isset($line["return"])) + { + if(trim($line["return"]) == "") + echo " \\return\n"; + else + echo " \\return ".trim($line["return"][0])."\n"; + } + + if(trim($line["description"]) == "") + echo " \\description\n"; + else + echo " \\description ".trim($line["description"][0])."\n"; + + if(isset($line["see"])) + echo " \\see ".trim($line["see"][0])."\n"; +} + +echo "\n# END\n"; +?> \ No newline at end of file -- cgit v1.1