diff options
author | madmaxoft <github@xoft.cz> | 2013-09-14 22:15:58 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-09-14 22:15:58 +0200 |
commit | 66aee0ec687f30f8e9c847a7f3cecb8ed8a31525 (patch) | |
tree | bb6e3a8315977468ed79280784b647a67bc3a9aa | |
parent | APIDump: Added a simple header to the class index. (diff) | |
download | cuberite-66aee0ec687f30f8e9c847a7f3cecb8ed8a31525.tar cuberite-66aee0ec687f30f8e9c847a7f3cecb8ed8a31525.tar.gz cuberite-66aee0ec687f30f8e9c847a7f3cecb8ed8a31525.tar.bz2 cuberite-66aee0ec687f30f8e9c847a7f3cecb8ed8a31525.tar.lz cuberite-66aee0ec687f30f8e9c847a7f3cecb8ed8a31525.tar.xz cuberite-66aee0ec687f30f8e9c847a7f3cecb8ed8a31525.tar.zst cuberite-66aee0ec687f30f8e9c847a7f3cecb8ed8a31525.zip |
Diffstat (limited to '')
-rw-r--r-- | MCServer/Plugins/APIDump/main.lua | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 68c8b63bc..a38dad44d 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -216,6 +216,47 @@ function DumpAPIHtml() cssf:close(); 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"); end @@ -226,6 +267,9 @@ end function ReadDescriptions(a_API) -- Returns true if the function (specified by its fully qualified name) is to be ignored local function IsFunctionIgnored(a_FnName) + if (g_APIDesc.IgnoreFunctions == nil) then + return false; + end for i, name in ipairs(g_APIDesc.IgnoreFunctions) do if (a_FnName:match(name)) then return true; @@ -234,6 +278,19 @@ function ReadDescriptions(a_API) return false; 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 for i, cls in ipairs(a_API) do @@ -272,7 +329,8 @@ function ReadDescriptions(a_API) 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 @@ -288,7 +346,9 @@ function ReadDescriptions(a_API) if (FnDesc == nil) then -- No description for this API function AddFunction(func.Name); - table.insert(cls.Undocumented, func.Name); + if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then + table.insert(cls.UndocumentedFunctions, FnName); + end else -- Description is available if (FnDesc[1] == nil) then @@ -319,7 +379,9 @@ function ReadDescriptions(a_API) local CnDesc = APIDesc.Constants[cons.Name]; if (CnDesc == nil) then -- Not documented - table.insert(cls.Undocumented, cons.Name); + if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then + table.insert(cls.UndocumentedConstants, cons.Name); + end else cons.Notes = CnDesc.Notes; CnDesc.IsExported = true; |