update MSVC project in the wake of cf1651e6
[ardour.git] / tools / fmt-luadoc.php
index 38221c7f1419f533b605fe91c7841c3dcfe82fba..3f7ef99b7298a5ca93568d6c71bdfbd21d3b4d1c 100755 (executable)
@@ -38,8 +38,14 @@ foreach (json_decode ($json, true) as $b) {
        $b ['lua'] = preg_replace ('/:_end/', ':end', $b ['lua']);
        $b ['lua'] = preg_replace ('/:_type/', ':type', $b ['lua']);
        $b ['ldec'] = preg_replace ('/ const/', '', preg_replace ('/ const&/', '', $b['decl']));
+       $b ['ldec'] = preg_replace ('/_VampHost::/', '', $b['ldec']);
+       $b ['decl'] = preg_replace ('/_VampHost::/', '', $b['decl']);
        if (isset ($b['ret'])) {
                $b['ret'] = preg_replace ('/ const/', '', preg_replace ('/ const&/', '', $b['ret']));
+               $b['ret'] = preg_replace ('/_VampHost::/', '', $b['ret']);
+       }
+       if (isset ($b['parent'])) {
+               $b ['parent'] = preg_replace ('/_VampHost::/', '', $b['parent']);
        }
        $doc[] = $b;
 }
@@ -96,6 +102,10 @@ function arg2lua ($argtype, $flags = 0) {
                return array ($arg => $flags);
        }
 
+       if ($arg == 'luabridge::LuaRef') {
+               return array ('Lua-Function' => $flags | 4);
+       }
+
        # check Class declarations first
        foreach (array_merge ($classes, $consts) as $b) {
                if ($b['ldec'] == $arg) {
@@ -194,6 +204,8 @@ function canonical_decl ($b) {
                        $a = preg_replace ('/([^>]) >/', '$1>', $a);
                        $a = preg_replace ('/^Cairo::/', '', $a); // special case cairo enums
                        $a = preg_replace ('/([^ ])&/', '$1 &', $a);
+                       $a = preg_replace ('/std::vector<([^>]*)> const/', 'const std::vector<$1>', $a);
+                       $a = str_replace ('std::vector', 'vector', $a);
                        $a = str_replace ('vector', 'std::vector', $a);
                        $a = str_replace ('std::string', 'string', $a);
                        $a = str_replace ('string const', 'const string', $a);
@@ -571,7 +583,10 @@ function format_args ($args) {
        foreach ($args as $a) {
                if (!$first) { $rv .= ', '; }; $first = false;
                $flags = $a[varname ($a)];
-               if ($flags & 2) {
+               if ($flags & 4) {
+                       $rv .= '<span>'.varname ($a).'</span>';
+               }
+               else if ($flags & 2) {
                        $rv .= '<em>LuaTable</em> {'.typelink (varname ($a), true, 'em').'}';
                }
                elseif ($flags & 1) {
@@ -712,6 +727,8 @@ function format_class_members ($ns, $cl, &$dups) {
                        $rv.= ' <tr><td class="def">'.typelink (array_keys ($f['ret'])[0], false, 'em').'</td><td class="decl">';
                        $rv.= '<span class="functionname">'.stripclass ($ns, $f['name']).'</span>';
                        $rv.= '</td><td class="fill"></td></tr>'.NL;
+                       $f['cand'] = str_replace (':', '::', $f['name']);
+                       $rv.= format_doxydoc($f);
                }
        }
        return $rv;