update luadoc scripts
authorRobin Gareus <robin@gareus.org>
Thu, 24 Mar 2016 23:43:15 +0000 (00:43 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 24 Mar 2016 23:43:15 +0000 (00:43 +0100)
tools/doxy2json/ardourdoc.sh
tools/fmt-luadoc.php

index 8d69a64e2802bba75f0dbc89f3a89051a2ff8555..91db7c280e5b5d2e4d79151fa06691d2f1c5942e 100755 (executable)
@@ -42,6 +42,13 @@ foreach (json_decode (\$json, true) as \$a) {
        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']);
        \$canon = str_replace (' *', '*', \$a['decl']);
        \$api[\$canon] = \$a;
        }
index 683216fe0d3e010201876998626dad9ba993b3c2..d9d5ceca6300d894aeef5770bebb86506c525f68 100755 (executable)
@@ -155,8 +155,12 @@ function canonical_ctor ($b) {
 
 function canonical_decl ($b) {
        $rv = '';
+       $pfx = '';
        # match clang's declatation format
        if (preg_match('/[^(]*\(([^)*]*)\*\)\((.*)\)/', $b['decl'], $matches)) {
+               if (strpos ($b['type'], 'Free Function') !== false) {
+                       $pfx = str_replace (':', '::', luafn2class ($b['lua'])) . '::';
+               }
                $fn = substr ($b['lua'], 1 + strrpos ($b['lua'], ':'));
                $rv = $matches[1] . $fn . '(';
                $arglist = preg_split ('/, */', $matches[2]);
@@ -165,16 +169,17 @@ function canonical_decl ($b) {
                        if (!$first) { $rv .= ', '; }; $first = false;
                        if (empty ($a)) { continue; }
                        $a = preg_replace ('/([^>]) >/', '$1>', $a);
-                       $a = preg_replace ('/^.*::/', '', $a);
+                       $a = preg_replace ('/^Cairo::/', '', $a); // special case cairo enums
                        $a = preg_replace ('/([^ ])&/', '$1 &', $a);
                        $a = str_replace ('vector', 'std::vector', $a);
+                       $a = str_replace ('std::string', 'string', $a);
                        $a = str_replace ('string const', 'const string', $a);
                        $a = str_replace ('string', 'std::string', $a);
                        $rv .= $a;
                }
                $rv .= ')';
        }
-       return $rv;
+       return $pfx . $rv;
 }
 
 ################################################################################
@@ -513,7 +518,7 @@ function format_doxydoc ($f) {
                if (!empty ($doc)) {
                        $rv.= '<tr><td></td><td class="doc" colspan="2"><div class="dox">'.$doc;
                        $rv.= '</div></td></tr>'.NL;
-               } else if (0) { # debug
+               } else if (1) { # debug
                        $rv.= '<tr><td></td><td class="doc" colspan="2"><p>'.htmlentities($f['cand']).'</p>';
                        $rv.= '</td></tr>'.NL;
                }