X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=tools%2Ffmt-luadoc.php;h=b13e38617caf77f2b7c31a75ca67ba958f20d006;hb=a5b38fd6dc9ce9d1fb450da493adbc02b787c5e8;hp=38221c7f1419f533b605fe91c7841c3dcfe82fba;hpb=d07d91602febc90f9db989b319ef4767fe8c0754;p=ardour.git diff --git a/tools/fmt-luadoc.php b/tools/fmt-luadoc.php index 38221c7f14..b13e38617c 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); @@ -258,7 +270,17 @@ foreach ($doc as $b) { $classlist[luafn2class ($b['lua'])]['ctor'][] = array ( 'name' => luafn2class ($b['lua']), 'args' => decl2args ($b['ldec']), - 'cand' => canonical_ctor ($b) + 'cand' => canonical_ctor ($b), + 'nil' => false + ); + break; + case "Weak/Shared Pointer NIL Constructor": + checkclass ($b); + $classlist[luafn2class ($b['lua'])]['ctor'][] = array ( + 'name' => luafn2class ($b['lua']), + 'args' => decl2args ($b['ldec']), + 'cand' => canonical_ctor ($b), + 'nil' => true ); break; case "Property": @@ -540,6 +562,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 +594,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) { @@ -626,7 +652,13 @@ function format_class_members ($ns, $cl, &$dups) { usort ($cl['ctor'], 'name_sort_cb'); $rv.= ' Constructor'.NL; foreach ($cl['ctor'] as $f) { - $rv.= ' ℂ'; + $rv.= ' '; + if ($f['nil']) { + $rv.= ''; + } else { + $rv.= 'ℂ'; + } + $rv.= ''; $rv.= ''.ctorname ($f['name']).''; $rv.= format_args ($f['args']); $rv.= ''.NL; @@ -712,6 +744,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; @@ -772,6 +806,7 @@ div.luafooter { text-align:center; font-size:80%; color: #888; margin: 2em #luaref table.classmembers td.fill { width: 99%; } #luaref table.classmembers span.em { font-style: italic; } #luaref span.functionname abbr { text-decoration:none; cursor:default; } +#luaref table.classmembers td.def abbr { text-decoration:none; cursor:default; } @@ -793,11 +828,6 @@ div.luafooter { text-align:center; font-size:80%; color: #888; margin: 2em } else { ?> ---- -layout: default -style: luadoc -title: Class Reference ----

This documentation is far from complete may be inaccurate and subject to change.