X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=tools%2Ffmt-luadoc.php;h=ff375856116c258802b3876871c3f55cc932b8b3;hb=c3d8967870f4a973945e6e6c723bbd8c24ad76eb;hp=38221c7f1419f533b605fe91c7841c3dcfe82fba;hpb=d07d91602febc90f9db989b319ef4767fe8c0754;p=ardour.git diff --git a/tools/fmt-luadoc.php b/tools/fmt-luadoc.php index 38221c7f14..ff37585611 100755 --- a/tools/fmt-luadoc.php +++ b/tools/fmt-luadoc.php @@ -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); @@ -540,6 +552,7 @@ function traverse_parent ($ns, &$inherited) { asort ($parents); foreach ($parents as $p) { if (!empty ($rv)) { $rv .= ', '; } + if ($p == $ns) { continue; } $rv .= typelink ($p); $inherited[$p] = $classlist[$p]; traverse_parent ($p, $inherited); @@ -571,7 +584,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 .= ''.varname ($a).''; + } + else if ($flags & 2) { $rv .= 'LuaTable {'.typelink (varname ($a), true, 'em').'}'; } elseif ($flags & 1) { @@ -712,6 +728,8 @@ function format_class_members ($ns, $cl, &$dups) { $rv.= ' '.typelink (array_keys ($f['ret'])[0], false, 'em').''; $rv.= ''.stripclass ($ns, $f['name']).''; $rv.= ''.NL; + $f['cand'] = str_replace (':', '::', $f['name']); + $rv.= format_doxydoc($f); } } return $rv;