summaryrefslogtreecommitdiff
path: root/tools/doxy2json/ardourdoc.sh
blob: 478ae9326dac292e20ac54c2f745a3167dfc0e6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e
make
cd ../..
test -f libs/ardour/ardour/ardour.h
LLVMINCLUDE="-I /usr/lib/llvm-3.6/include -I /usr/lib/llvm-3.6/lib/clang/3.6.2/include/"

TMPFILE=`mktemp`
trap 'rm -f $TMPFILE' exit SIGINT SIGTERM

echo "# analyzing source.. -> $TMPFILE"
./tools/doxy2json/doxy2json \
	`pkg-config --cflags glib-2.0 glibmm-2.4 cairomm-1.0 gtkmm-2.4 | sed 's/-std=c++11 //;s/-pthread //'` \
	$LLVMINCLUDE -I /usr/include/linux \
	-I libs/ardour -I libs/pbd -I libs/lua -I gtk2_ardour -I libs/timecode \
	-I libs/ltc -I libs/evoral \
	libs/ardour/ardour/* libs/pbd/pbd/* \
	gtk2_ardour/*.h \
	/usr/include/cairomm-1.0/cairomm/context.h \
> $TMPFILE

ls -lh $TMPFILE

echo "# consolidating JSON"
php << EOF
<?php
\$json = file_get_contents ('$TMPFILE');
\$api = array ();
foreach (json_decode (\$json, true) as \$a) {
	if (!isset (\$a['decl'])) { continue; }
	if (empty (\$a['decl'])) { continue; }
	if (\$a['decl'] == '::') { continue; }
	if (substr (\$a['decl'], 0, 1) == '_') { continue; }
	if (substr (\$a['decl'], 0, 2) == '::') { continue; }
	if (substr (\$a['decl'], 0, 4) == 'sigc') { continue; }
	if (substr (\$a['decl'], 0, 5) == 'Atk::') { continue; }
	if (substr (\$a['decl'], 0, 5) == 'Gdk::') { continue; }
	if (substr (\$a['decl'], 0, 5) == 'Gtk::') { continue; }
	if (substr (\$a['decl'], 0, 5) == 'Gio::') { continue; }
	if (substr (\$a['decl'], 0, 6) == 'Glib::') { continue; }
	if (substr (\$a['decl'], 0, 7) == 'Pango::') { continue; }
	if (substr (\$a['decl'], 0, 11) == 'luabridge::') { continue; }

	\$a['decl'] = str_replace ('size_t', 'unsigned long', \$a['decl']);
	\$a['decl'] = str_replace ('uint32_t', 'unsigned int', \$a['decl']);
	\$a['decl'] = str_replace ('framepos_t', 'long', \$a['decl']);
	\$a['decl'] = str_replace ('frameoffset_t', 'long', \$a['decl']);
	\$a['decl'] = str_replace ('int64_t', 'long', \$a['decl']);
	\$a['decl'] = str_replace ('uint8_t', 'unsigned char', \$a['decl']);
	\$a['decl'] = str_replace ('pframes_t', 'unsigned int', \$a['decl']);
	\$a['decl'] = str_replace ('uint64_t', 'unsigned long', \$a['decl']);
	\$a['decl'] = str_replace ('const char', 'char', \$a['decl']);
	\$a['decl'] = str_replace ('const float', 'float', \$a['decl']);
	\$a['decl'] = str_replace ('const double', 'double', \$a['decl']);
	\$a['decl'] = str_replace ('const long', 'long', \$a['decl']);
	\$a['decl'] = str_replace ('const unsigned int', 'unsigned int', \$a['decl']);
	\$a['decl'] = str_replace ('const unsigned long', 'unsigned long', \$a['decl']);
	\$canon = str_replace (' *', '*', \$a['decl']);
	\$api[\$canon] = \$a;
	}
\$jout = array ();
foreach (\$api as \$k => \$a) {
	\$jout[] = \$a;
}
file_put_contents('doc/ardourapi.json.gz', gzencode (json_encode (\$jout, JSON_PRETTY_PRINT)));
EOF

ls -l doc/ardourapi.json.gz