summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-05-10 18:11:24 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-05-12 11:59:09 +0100
commitaaa1e2b0ec58370d9ffaef0002e5f68c65185e30 (patch)
treea1efab799deed2d8c445fefaea3afeeb80e28a18
parentd46ae0205c056103697196b94a6ffe745e3d0033 (diff)
downloadefl-aaa1e2b0ec58370d9ffaef0002e5f68c65185e30.tar.gz
docgen: basic doc generation for types
-rw-r--r--gendoc.lua27
1 files changed, 24 insertions, 3 deletions
diff --git a/gendoc.lua b/gendoc.lua
index db201e8720..4abb298fee 100644
--- a/gendoc.lua
+++ b/gendoc.lua
@@ -812,7 +812,7 @@ local get_typedecl_str = function(tp)
local tpt = tp:type_get()
if tpt == tps.UNKNOWN then
error("unknown typedecl: " .. tp:full_name_get())
- elseif tpt == tps.STRUCT or tpt == tps.STURCT_OPAQUE then
+ elseif tpt == tps.STRUCT or tpt == tps.STRUCT_OPAQUE then
local buf = { "struct " }
add_typedecl_attrs(tp, buf)
buf[#buf + 1] = tp:full_name_get()
@@ -848,8 +848,11 @@ local get_typedecl_str = function(tp)
for i, fld in ipairs(fields) do
buf[#buf + 1] = " "
buf[#buf + 1] = fld:name_get()
- buf[#buf + 1] = ": "
- buf[#buf + 1] = fld:value_get():serialize()
+ local val = fld:value_get()
+ if val then
+ buf[#buf + 1] = ": "
+ buf[#buf + 1] = val:serialize()
+ end
if i == #fields then
buf[#buf + 1] = "\n"
else
@@ -1479,10 +1482,24 @@ local build_classes = function()
end
end
+local write_tsigs = function(f, tp)
+ f:write_h(tp:full_name_get(), 2)
+
+ f:write_h("Signature", 3)
+ f:write_code(get_typedecl_str(tp))
+ f:write_nl()
+
+ f:write_h("C signature", 3)
+ f:write_code(tp:c_type_get() .. ";")
+ f:write_nl()
+end
+
local build_alias = function(tp)
local f = Writer(gen_nsp_eo(tp, "alias"))
check_alias(tp)
+ write_tsigs(f, tp)
+
f:finish()
end
@@ -1490,6 +1507,8 @@ local build_struct = function(tp)
local f = Writer(gen_nsp_eo(tp, "struct"))
check_struct(tp)
+ write_tsigs(f, tp)
+
f:finish()
end
@@ -1497,6 +1516,8 @@ local build_enum = function(tp)
local f = Writer(gen_nsp_eo(tp, "enum"))
check_enum(tp)
+ write_tsigs(f, tp)
+
f:finish()
end