A modern, network-enabled music player platform built on Rockbox technology.
rockboxd.tsiry-sandratraina.com
rust
deno
navidrome
airplay
libadwaita
zig
mpris
snapcast
mpd
rockbox
audio
subsonic
4.1 kB
163 lines
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#
106# Generated from $svn\x61apps/plugin.h
107#
108# Format:
109# \\group memory and strings
110# \\conditions defined(HAVE_BACKLIGHT)
111# \\param fmt
112# \\return
113# \\description
114# \\see func1 func2 [S[apps/plugin.c]]
115#
116# Markup:
117# [W[wiki url]]
118# [S[svn url]]
119# [F[function]]
120# [[url]]
121# %BR%
122# =code=
123
124MOO;
125
126foreach($merged as $func => $line)
127{
128 echo "\n".clean_func($func)."\n";
129
130 if(strlen($line["group"][0]) > 0)
131 echo " \\group ".trim($line["group"][0])."\n";
132
133 if(strlen($line["conditions"][0]) > 2)
134 echo " \\conditions ".trim(_simplify($line["conditions"][0]))."\n";
135
136 if(isset($line["param"]))
137 {
138 foreach($line["param"] as $param)
139 {
140 if($param != "...")
141 echo " \\param ".trim($param)."\n";
142 }
143 }
144
145 if(isset($line["return"]))
146 {
147 if(trim($line["return"][0]) == "")
148 echo " \\return\n";
149 else
150 echo " \\return ".trim($line["return"][0])."\n";
151 }
152
153 if(trim($line["description"][0]) == "")
154 echo " \\description\n";
155 else
156 echo " \\description ".trim($line["description"][0])."\n";
157
158 if(isset($line["see"]))
159 echo " \\see ".trim($line["see"][0])."\n";
160}
161
162echo "\n# END\n";
163?>