diff options
author | Robin Gareus <robin@gareus.org> | 2019-08-29 05:42:46 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-08-29 05:43:02 +0200 |
commit | 7496a856c7785888327146c9934e5db23ba5f155 (patch) | |
tree | e5ebeb6d32749ec987161886674323617f67dbd8 /tools/doxy2json | |
parent | 0840bc0c767ab68b4c564367a5febc41476357d9 (diff) |
Tweak Lua-doc processing:
Separate PHP based post-processing, used for manual creation.
php-cli may not be available on build host.
Diffstat (limited to 'tools/doxy2json')
-rwxr-xr-x | tools/doxy2json/ardourdoc.sh | 41 | ||||
-rwxr-xr-x | tools/doxy2json/postproc.sh | 51 |
2 files changed, 56 insertions, 36 deletions
diff --git a/tools/doxy2json/ardourdoc.sh b/tools/doxy2json/ardourdoc.sh index 8237641bd0..975235dc51 100755 --- a/tools/doxy2json/ardourdoc.sh +++ b/tools/doxy2json/ardourdoc.sh @@ -38,39 +38,8 @@ time ./tools/doxy2json/doxy2json -j 4 \ 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; } - - \$a['decl'] = str_replace ('size_t', 'unsigned long', \$a['decl']); - \$a['decl'] = str_replace ('uint32_t', 'unsigned int', \$a['decl']); - \$a['decl'] = str_replace ('int32_t', 'int', \$a['decl']); - \$a['decl'] = str_replace ('samplepos_t', 'long', \$a['decl']); - \$a['decl'] = str_replace ('samplecnt_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']); - \$a['decl'] = str_replace (' ::Vamp::', ' Vamp::', \$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 +if test -z "$1"; then + ./tools/doxy2json/postproc.sh $TMPFILE +else + cp -vi $TMPFILE doc/ardourapi-pre.json +fi diff --git a/tools/doxy2json/postproc.sh b/tools/doxy2json/postproc.sh new file mode 100755 index 0000000000..6c74d5ff78 --- /dev/null +++ b/tools/doxy2json/postproc.sh @@ -0,0 +1,51 @@ +#!/bin/bash +cd `dirname $0` +cd ../.. + +set -e + +test -f "$1" + +echo "# consolidating JSON $1" +php << EOF +<?php +\$json = file_get_contents ('$1'); +\$api = array (); +foreach (json_decode (\$json, true) as \$a) { + if (!isset (\$a['decl'])) { continue; } + + \$a['decl'] = str_replace ('__cxx11::', '', \$a['decl']); + \$a['decl'] = str_replace ('size_t', 'unsigned long', \$a['decl']); + \$a['decl'] = str_replace ('uint32_t', 'unsigned int', \$a['decl']); + \$a['decl'] = str_replace ('int32_t', 'int', \$a['decl']); + \$a['decl'] = str_replace ('ARDOUR::samplepos_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('ARDOUR::samplecnt_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('ARDOUR::sampleoffset_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('ARDOUR::frameoffset_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('ARDOUR::pframes_t', 'unsigned int', \$a['decl']); + \$a['decl'] = str_replace ('samplepos_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('samplecnt_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('sampleoffset_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('frameoffset_t', 'long', \$a['decl']); + \$a['decl'] = str_replace ('pframes_t', 'unsigned int', \$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 ('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']); + \$a['decl'] = str_replace (' ::Vamp::', ' Vamp::', \$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 |