add lua script to test channel-mapping, update doc
[ardour.git] / tools / doxy2json / ardourdoc.sh
1 #!/bin/bash
2 cd `dirname $0`
3 set -e
4 make
5 cd ../..
6 test -f libs/ardour/ardour/ardour.h
7 LLVMINCLUDE="-I /usr/lib/llvm-3.6/include -I /usr/lib/llvm-3.6/lib/clang/3.6.2/include/"
8
9 TMPFILE=`mktemp`
10 trap 'rm -f $TMPFILE' exit SIGINT SIGTERM
11
12 echo "# analyzing source.. -> $TMPFILE"
13 ./tools/doxy2json/doxy2json \
14         `pkg-config --cflags glib-2.0 glibmm-2.4 cairomm-1.0 gtkmm-2.4 | sed 's/-std=c++11 //;s/-pthread //'` \
15         $LLVMINCLUDE -I /usr/include/linux \
16         -I libs/ardour -I libs/pbd -I libs/lua -I gtk2_ardour -I libs/timecode \
17         -I libs/ltc -I libs/evoral \
18         -X "_" -X "::" -X "sigc" -X "Atk::" -X "Gdk::" -X "Gtk::" -X "Gio::" \
19         -X "Glib::" -X "Pango::" -X "luabridge::" \
20         libs/ardour/ardour/* libs/pbd/pbd/* \
21         gtk2_ardour/*.h \
22         /usr/include/cairomm-1.0/cairomm/context.h \
23 > $TMPFILE
24
25 ls -lh $TMPFILE
26
27 echo "# consolidating JSON"
28 php << EOF
29 <?php
30 \$json = file_get_contents ('$TMPFILE');
31 \$api = array ();
32 foreach (json_decode (\$json, true) as \$a) {
33         if (!isset (\$a['decl'])) { continue; }
34
35         \$a['decl'] = str_replace ('size_t', 'unsigned long', \$a['decl']);
36         \$a['decl'] = str_replace ('uint32_t', 'unsigned int', \$a['decl']);
37         \$a['decl'] = str_replace ('int32_t', 'int', \$a['decl']);
38         \$a['decl'] = str_replace ('framepos_t', 'long', \$a['decl']);
39         \$a['decl'] = str_replace ('framecnt_t', 'long', \$a['decl']);
40         \$a['decl'] = str_replace ('frameoffset_t', 'long', \$a['decl']);
41         \$a['decl'] = str_replace ('int64_t', 'long', \$a['decl']);
42         \$a['decl'] = str_replace ('uint8_t', 'unsigned char', \$a['decl']);
43         \$a['decl'] = str_replace ('pframes_t', 'unsigned int', \$a['decl']);
44         \$a['decl'] = str_replace ('uint64_t', 'unsigned long', \$a['decl']);
45         \$a['decl'] = str_replace ('const char', 'char', \$a['decl']);
46         \$a['decl'] = str_replace ('const float', 'float', \$a['decl']);
47         \$a['decl'] = str_replace ('const double', 'double', \$a['decl']);
48         \$a['decl'] = str_replace ('const long', 'long', \$a['decl']);
49         \$a['decl'] = str_replace ('const unsigned int', 'unsigned int', \$a['decl']);
50         \$a['decl'] = str_replace ('const unsigned long', 'unsigned long', \$a['decl']);
51         \$canon = str_replace (' *', '*', \$a['decl']);
52         \$api[\$canon] = \$a;
53 }
54 \$jout = array ();
55 foreach (\$api as \$k => \$a) {
56         \$jout[] = \$a;
57 }
58 file_put_contents('doc/ardourapi.json.gz', gzencode (json_encode (\$jout, JSON_PRETTY_PRINT)));
59 EOF
60
61 ls -l doc/ardourapi.json.gz