APIDump: Implemented creating the list of undocumented API objects.

master
madmaxoft 2013-09-14 22:15:58 +02:00
parent 62b74d0054
commit 66aee0ec68
1 changed files with 65 additions and 3 deletions

View File

@ -216,6 +216,47 @@ function DumpAPIHtml()
cssf:close(); cssf:close();
end end
-- List the undocumented objects:
f = io.open("API/undocumented.lua", "w");
if (f ~= nil) then
f:write("\n-- This is the list of undocumented API objects, automatically generated by APIDump\n\n");
f:write("g_APIDesc =\n{\n\tClasses =\n\t{\n");
for i, cls in ipairs(API) do
local HasWrittenClassHeader = false;
local HasFunctions = ((cls.UndocumentedFunctions ~= nil) and (#cls.UndocumentedFunctions > 0));
local HasConstants = ((cls.UndocumentedConstants ~= nil) and (#cls.UndocumentedConstants > 0));
if (HasFunctions or HasConstants) then
f:write("\t\t" .. cls.Name .. " =\n\t\t{\n");
if ((cls.Desc == nil) or (cls.Desc == "")) then
f:write("\t\t\tDesc = \"\"\n");
end
end
if (HasFunctions) then
f:write("\t\t\tFunctions =\n\t\t\t{\n");
table.sort(cls.UndocumentedFunctions);
for j, fn in ipairs(cls.UndocumentedFunctions) do
f:write("\t\t\t\t" .. fn .. " = { Params = \"\", Return = \"\", Notes = \"\" },\n");
end -- for j, fn - cls.Undocumented[]
f:write("\t\t\t},\n\n");
end
if (HasConstants) then
f:write("\t\t\tConstants =\n\t\t\t{\n");
table.sort(cls.UndocumentedConstants);
for j, cn in ipairs(cls.UndocumentedConstants) do
f:write("\t\t\t\t" .. cn .. " = { Notes = \"\" },\n");
end -- for j, fn - cls.Undocumented[]
f:write("\t\t\t},\n\n");
end
if (HasFunctions or HasConstants) then
f:write("\t\t},\n\n");
end
end -- for i, cls - API[]
f:close();
end
LOG("API subfolder written"); LOG("API subfolder written");
end end
@ -226,6 +267,9 @@ end
function ReadDescriptions(a_API) function ReadDescriptions(a_API)
-- Returns true if the function (specified by its fully qualified name) is to be ignored -- Returns true if the function (specified by its fully qualified name) is to be ignored
local function IsFunctionIgnored(a_FnName) local function IsFunctionIgnored(a_FnName)
if (g_APIDesc.IgnoreFunctions == nil) then
return false;
end
for i, name in ipairs(g_APIDesc.IgnoreFunctions) do for i, name in ipairs(g_APIDesc.IgnoreFunctions) do
if (a_FnName:match(name)) then if (a_FnName:match(name)) then
return true; return true;
@ -234,6 +278,19 @@ function ReadDescriptions(a_API)
return false; return false;
end end
-- Returns true if the constant (specified by its fully qualified name) is to be ignored
local function IsConstantIgnored(a_CnName)
if (g_APIDesc.IgnoreConstants == nil) then
return false;
end;
for i, name in ipairs(g_APIDesc.IgnoreConstants) do
if (a_CnName:match(name)) then
return true;
end
end
return false;
end
local UnexportedDocumented = {}; -- List of API objects that are documented but not exported, simply a list of names local UnexportedDocumented = {}; -- List of API objects that are documented but not exported, simply a list of names
for i, cls in ipairs(a_API) do for i, cls in ipairs(a_API) do
@ -272,7 +329,8 @@ function ReadDescriptions(a_API)
end end
end end
cls.Undocumented = {}; -- This will contain all the API objects that are not documented cls.UndocumentedFunctions = {}; -- This will contain names of all the functions that are not documented
cls.UndocumentedConstants = {}; -- This will contain names of all the constants that are not documented
local DoxyFunctions = {}; -- This will contain all the API functions together with their documentation local DoxyFunctions = {}; -- This will contain all the API functions together with their documentation
@ -288,7 +346,9 @@ function ReadDescriptions(a_API)
if (FnDesc == nil) then if (FnDesc == nil) then
-- No description for this API function -- No description for this API function
AddFunction(func.Name); AddFunction(func.Name);
table.insert(cls.Undocumented, func.Name); if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
else else
-- Description is available -- Description is available
if (FnDesc[1] == nil) then if (FnDesc[1] == nil) then
@ -319,7 +379,9 @@ function ReadDescriptions(a_API)
local CnDesc = APIDesc.Constants[cons.Name]; local CnDesc = APIDesc.Constants[cons.Name];
if (CnDesc == nil) then if (CnDesc == nil) then
-- Not documented -- Not documented
table.insert(cls.Undocumented, cons.Name); if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then
table.insert(cls.UndocumentedConstants, cons.Name);
end
else else
cons.Notes = CnDesc.Notes; cons.Notes = CnDesc.Notes;
CnDesc.IsExported = true; CnDesc.IsExported = true;