A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 164 lines 4.1 kB view raw
1#!/usr/bin/php 2<?php 3require_once("functions.php"); 4 5$input = file_get_contents($argv[1]); 6 7$input = parse_documentation($input); 8 9/* Format input */ 10foreach($input as $rootname => $rootel) 11{ 12 foreach($rootel as $name => $el) 13 $input[$name] = $el; 14 unset($input[$rootname]); 15} 16 17$new = get_newest(); 18 19/* Format new */ 20foreach($new as $name => $el) 21{ 22 unset($new[$name]); 23 $name = clean_func($el["func"]); 24 25 $new[$name] = array( 26 "group" => array($el["group"]), 27 "description" => array("") 28 ); 29 30 if(strlen($el["cond"]) > 2) { 31 $new[$name]["conditions"][0] = $el["cond"]; 32 } else { 33 $new[$name]["conditions"][0] = ""; 34 } 35 36 $args = get_args($el["func"]); 37 if(count($args) > 0) 38 { 39 foreach($args as $n => $arg) 40 { 41 $tmp = split_var($arg); 42 $args[$n] = $tmp[1]; 43 } 44 $new[$name]["param"] = $args; 45 } 46 47 if(get_return($el["func"]) !== false) 48 $new[$name]["return"][0] = ""; 49} 50 51/* Compare and merge both */ 52$merged = array(); 53foreach($new as $name => $el) 54{ 55 if(isset($input[$name])) 56 { 57 $merged[$name] = $input[$name]; 58 $merged[$name]["conditions"] = $new[$name]["conditions"]; 59 60 if(strlen($el["group"][0]) > 0) 61 $merged[$name]["group"] = $el["group"]; 62 63 if(isset($el["param"])) 64 { 65 foreach($el["param"] as $nr => $parel) 66 { 67 if($parel != $input[$name]["param"][$nr]) 68 { 69 $param = trim($parel); 70 $p1 = substr($param, 0, strpos($param, " ")); 71 72 $param = trim($input[$name]["param"][$nr]); 73 $p2 = substr($param, strpos($param, " ")); 74 $merged[$name]["params"][] = $p1." ".$p2." [AUTO-ADDED]"; 75 } 76 else 77 $merged[$name]["params"][] = $parel; 78 } 79 } 80 81 if(!isset($el["return"]) && isset($merged[$name]["return"])) 82 unset($merged[$name]["return"]); 83 84 unset($input[$name]); 85 } 86 else 87 $merged[$name] = $el; 88} 89 90/* Now to the rest of input */ 91foreach($input as $name => $el) 92 $merged[$name." [DEPRECATED]"] = $el; 93 94uksort($merged, "func_sort"); 95 96echo '# Auto generated documentation by Rockbox plugin API generator v2'."\n"; 97echo '# Made by Maurus Cuelenaere'."\n"; 98echo <<<MOO 99# __________ __ ___. 100# Open \______ \ ____ ____ | | _\_ |__ _______ ___ 101# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 102# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 103# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 104# \/ \/ \/ \/ \/ 105# \$Id$ 106# 107# Generated from $svn\x61apps/plugin.h 108# 109# Format: 110# \\group memory and strings 111# \\conditions defined(HAVE_BACKLIGHT) 112# \\param fmt 113# \\return 114# \\description 115# \\see func1 func2 [S[apps/plugin.c]] 116# 117# Markup: 118# [W[wiki url]] 119# [S[svn url]] 120# [F[function]] 121# [[url]] 122# %BR% 123# =code= 124 125MOO; 126 127foreach($merged as $func => $line) 128{ 129 echo "\n".clean_func($func)."\n"; 130 131 if(strlen($line["group"][0]) > 0) 132 echo " \\group ".trim($line["group"][0])."\n"; 133 134 if(strlen($line["conditions"][0]) > 2) 135 echo " \\conditions ".trim(_simplify($line["conditions"][0]))."\n"; 136 137 if(isset($line["param"])) 138 { 139 foreach($line["param"] as $param) 140 { 141 if($param != "...") 142 echo " \\param ".trim($param)."\n"; 143 } 144 } 145 146 if(isset($line["return"])) 147 { 148 if(trim($line["return"][0]) == "") 149 echo " \\return\n"; 150 else 151 echo " \\return ".trim($line["return"][0])."\n"; 152 } 153 154 if(trim($line["description"][0]) == "") 155 echo " \\description\n"; 156 else 157 echo " \\description ".trim($line["description"][0])."\n"; 158 159 if(isset($line["see"])) 160 echo " \\see ".trim($line["see"][0])."\n"; 161} 162 163echo "\n# END\n"; 164?>