build: add support for __index in widgets
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
2b767c2352
commit
b3a16bc6ad
|
@ -282,6 +282,11 @@ if(GENERATE_LUADOC)
|
||||||
a_file_match(${cfile} "const struct luaL_reg" result)
|
a_file_match(${cfile} "const struct luaL_reg" result)
|
||||||
if(result)
|
if(result)
|
||||||
set(luadoc_c_srcs ${luadoc_c_srcs} ${cfile})
|
set(luadoc_c_srcs ${luadoc_c_srcs} ${cfile})
|
||||||
|
else()
|
||||||
|
a_file_match(${cfile} "luaA_.*_index" result)
|
||||||
|
if(result)
|
||||||
|
set(luadoc_c_srcs ${luadoc_c_srcs} ${cfile})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ for i, line in ipairs(ilines) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Get function list and print their documentation
|
-- Get function list and print their documentation
|
||||||
capture = false
|
capture = false
|
||||||
for i, line in ipairs(ilines) do
|
for i, line in ipairs(ilines) do
|
||||||
|
@ -67,6 +68,15 @@ for i, line in ipairs(ilines) do
|
||||||
_, _, libname, libtype = line:find("const struct luaL_reg awesome_(%a+)_(%a+)%[%] ")
|
_, _, libname, libtype = line:find("const struct luaL_reg awesome_(%a+)_(%a+)%[%] ")
|
||||||
-- Special case
|
-- Special case
|
||||||
if not libname then _, _, libname, libtype = line:find("const struct luaL_reg (awesome)_(lib)%[%] =") end
|
if not libname then _, _, libname, libtype = line:find("const struct luaL_reg (awesome)_(lib)%[%] =") end
|
||||||
|
-- __index alone
|
||||||
|
if not libname and line:find("^luaA_.*_index") then
|
||||||
|
local fctname, fctdef
|
||||||
|
_, _, fctdef, fctname = line:find("^(luaA_(.+)_index)")
|
||||||
|
print(function_doc[fctdef]:comment_translate())
|
||||||
|
print("-- @class table")
|
||||||
|
print("-- @name " .. fctname)
|
||||||
|
print(fctname)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if line:find("};") then
|
if line:find("};") then
|
||||||
libname = nil
|
libname = nil
|
||||||
|
@ -74,21 +84,13 @@ for i, line in ipairs(ilines) do
|
||||||
local fctname, fctdef
|
local fctname, fctdef
|
||||||
_, _, fctname, fctdef = line:find("\"(.+)\", (.+) },?")
|
_, _, fctname, fctdef = line:find("\"(.+)\", (.+) },?")
|
||||||
if fctname and (not fctname:find("^__")
|
if fctname and (not fctname:find("^__")
|
||||||
or fctname:find("^__call")
|
or fctname:find("^__call")) then
|
||||||
or fctname:find("^__index")) then
|
|
||||||
if function_doc[fctdef] then
|
if function_doc[fctdef] then
|
||||||
if fctname:find("^__index") then
|
fctname = "." .. fctname
|
||||||
print(function_doc[fctdef]:comment_translate())
|
fctname = fctname:gsub("^.__call", "")
|
||||||
print("-- @class table")
|
print(function_doc[fctdef]:comment_translate())
|
||||||
print("-- @name " .. libname)
|
print("function " .. libname .. fctname .. "()")
|
||||||
print(libname)
|
print("end");
|
||||||
else
|
|
||||||
fctname = "." .. fctname
|
|
||||||
fctname = fctname:gsub("^.__call", "")
|
|
||||||
print(function_doc[fctdef]:comment_translate())
|
|
||||||
print("function " .. libname .. fctname .. "()")
|
|
||||||
print("end");
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
print("This function is not yet documented.")
|
print("This function is not yet documented.")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue