make generation work again
This commit is contained in:
parent
5b4dd81793
commit
c6e4a1f075
|
@ -246,7 +246,6 @@ M.ref_groups_get = function(eos)
|
|||
local structs = eos:structs_get():to_array()
|
||||
local enums = eos:enums_get():to_array()
|
||||
local consts = eos:constants_get():to_array()
|
||||
local globals = eos:globals_get():to_array()
|
||||
|
||||
local grouped = {}
|
||||
local groups = {}
|
||||
|
@ -286,8 +285,7 @@ M.ref_groups_get = function(eos)
|
|||
nspaces_filter(aliases, ns),
|
||||
nspaces_filter(structs, ns),
|
||||
nspaces_filter(enums, ns),
|
||||
nspaces_filter(consts, ns),
|
||||
nspaces_filter(globals, ns)
|
||||
nspaces_filter(consts, ns)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ end
|
|||
|
||||
M.type_cstr_get = function(tp, suffix)
|
||||
tp = tp or "void"
|
||||
local ct = (type(tp) == "string") and tp or tp:c_type_get(eolian.c_type_type.DEFAULT)
|
||||
local ct = (type(tp) == "string") and tp or tp:c_type_get()
|
||||
if not suffix then
|
||||
return ct
|
||||
end
|
||||
|
@ -132,10 +132,6 @@ local wrap_type_attrs = function(tp, str)
|
|||
--if tp:is_own() then
|
||||
-- str = "own(" .. str .. ")"
|
||||
--end
|
||||
local ffunc = tp:free_func_get()
|
||||
if ffunc then
|
||||
str = "free(" .. str .. ", " .. ffunc .. ")"
|
||||
end
|
||||
if tp:is_ptr() then
|
||||
str = "ptr(" .. str .. ")"
|
||||
end
|
||||
|
@ -150,7 +146,8 @@ serialize_type = function(tp)
|
|||
return wrap_type_attrs(tp, "void")
|
||||
elseif tpt == eolian.type_type.UNDEFINED then
|
||||
return wrap_type_attrs(tp, "__undefined_type")
|
||||
elseif tpt == eolian.type_type.REGULAR or tpt == eolian.type_type.CLASS then
|
||||
elseif tpt == eolian.type_type.REGULAR or tpt == eolian.type_type.CLASS
|
||||
or tpt == eolian.type_type.ERROR then
|
||||
local stp = tp:base_type_get()
|
||||
if stp then
|
||||
local stypes = {}
|
||||
|
@ -320,17 +317,13 @@ end
|
|||
|
||||
serialize_var = function(var)
|
||||
local buf = {}
|
||||
if var:type_get() == eolian.variable_type.GLOBAL then
|
||||
buf[#buf + 1] = "var "
|
||||
else
|
||||
buf[#buf + 1] = "const "
|
||||
end
|
||||
buf[#buf + 1] = "const "
|
||||
if var:is_extern() then
|
||||
buf[#buf + 1] = "@extern "
|
||||
end
|
||||
buf[#buf + 1] = var:name_get()
|
||||
buf[#buf + 1] = ": "
|
||||
buf[#buf + 1] = serialize_type(var:base_type_get())
|
||||
buf[#buf + 1] = serialize_type(var:type_get())
|
||||
local val = var:value_get()
|
||||
if val then
|
||||
buf[#buf + 1] = " = "
|
||||
|
@ -342,40 +335,19 @@ end
|
|||
|
||||
serialize_var_c = function(var, ns)
|
||||
local buf = {}
|
||||
local bt = var:base_type_get()
|
||||
local bt = var:type_get()
|
||||
local fulln = var:name_get():gsub("%.", "_"):upper()
|
||||
keyref.add(fulln, ns, "c")
|
||||
if var:type_get() == eolian.variable_type.GLOBAL then
|
||||
local ts = bt:c_type_get(eolian.c_type_type.DEFAULT)
|
||||
buf[#buf + 1] = ts
|
||||
if ts:sub(#ts) ~= "*" then
|
||||
buf[#buf + 1] = " "
|
||||
end
|
||||
buf[#buf + 1] = fulln
|
||||
local val = var:value_get()
|
||||
if val then
|
||||
buf[#buf + 1] = " = "
|
||||
local vt = val:eval_type(bt)
|
||||
local lv = vt:to_literal()
|
||||
local sv = val:serialize()
|
||||
buf[#buf + 1] = lv
|
||||
if lv ~= sv then
|
||||
buf[#buf + 1] = "/* " .. sv .. " */"
|
||||
end
|
||||
end
|
||||
buf[#buf + 1] = ";"
|
||||
else
|
||||
buf[#buf + 1] = "#define "
|
||||
buf[#buf + 1] = fulln
|
||||
buf[#buf + 1] = " "
|
||||
local val = var:value_get()
|
||||
local vt = val:eval_type(bt)
|
||||
local lv = vt:to_literal()
|
||||
local sv = val:serialize()
|
||||
buf[#buf + 1] = lv
|
||||
if lv ~= sv then
|
||||
buf[#buf + 1] = "/* " .. sv .. " */"
|
||||
end
|
||||
buf[#buf + 1] = "#define "
|
||||
buf[#buf + 1] = fulln
|
||||
buf[#buf + 1] = " "
|
||||
local val = var:value_get()
|
||||
local vt = val:eval()
|
||||
local lv = vt:to_literal()
|
||||
local sv = val:serialize()
|
||||
buf[#buf + 1] = lv
|
||||
if lv ~= sv then
|
||||
buf[#buf + 1] = "/* " .. sv .. " */"
|
||||
end
|
||||
return table.concat(buf)
|
||||
end
|
||||
|
@ -383,7 +355,7 @@ end
|
|||
local sert = {
|
||||
[eolian.object_type.TYPE] = serialize_type,
|
||||
[eolian.object_type.TYPEDECL] = serialize_tdecl,
|
||||
[eolian.object_type.VARIABLE] = serialize_var
|
||||
[eolian.object_type.CONSTANT] = serialize_var
|
||||
}
|
||||
|
||||
M.obj_serialize = function(obj)
|
||||
|
@ -394,7 +366,7 @@ end
|
|||
|
||||
local sertc = {
|
||||
[eolian.object_type.TYPEDECL] = serialize_tdecl_c,
|
||||
[eolian.object_type.VARIABLE] = serialize_var_c
|
||||
[eolian.object_type.CONSTANT] = serialize_var_c
|
||||
}
|
||||
|
||||
M.obj_serialize_c = function(obj, ns)
|
||||
|
@ -406,11 +378,11 @@ end
|
|||
local gen_cparam = function(par, out)
|
||||
local part = par:type_get()
|
||||
out = out or (par:direction_get() == eolian.parameter_dir.OUT)
|
||||
local tstr = part:c_type_get(eolian.c_type_type.DEFAULT)
|
||||
local tstr = part:c_type_get()
|
||||
if out then
|
||||
tstr = M.type_cstr_get(tstr, "*")
|
||||
end
|
||||
return M.type_cstr_get(tstr, par:name_get())
|
||||
return M.type_cstr_get(tstr, par:short_name_get())
|
||||
end
|
||||
|
||||
local get_func_csig_part = function(cn, tp)
|
||||
|
@ -428,8 +400,8 @@ M.function_serialize_c = function(f, ftype)
|
|||
local rtype = f:return_type_get(ftype)
|
||||
|
||||
local fparam = "Eo *obj"
|
||||
if f:is_class() then
|
||||
fparam = "Efl_Class *klass"
|
||||
if f:is_static() then
|
||||
fparam = nil
|
||||
elseif f:is_const() or ftype == eolian.function_type.PROP_GET then
|
||||
fparam = "const Eo *obj"
|
||||
end
|
||||
|
@ -440,7 +412,9 @@ M.function_serialize_c = function(f, ftype)
|
|||
for i = 1, #pars do
|
||||
pars[i] = gen_cparam(pars[i])
|
||||
end
|
||||
table.insert(pars, 1, fparam);
|
||||
if fparam then
|
||||
table.insert(pars, 1, fparam);
|
||||
end
|
||||
return cnrt .. "(" .. table.concat(pars, ", ") .. ");"
|
||||
end
|
||||
|
||||
|
@ -456,7 +430,9 @@ M.function_serialize_c = function(f, ftype)
|
|||
for i, par in ipairs(vals) do
|
||||
pars[#pars + 1] = gen_cparam(par)
|
||||
end
|
||||
table.insert(pars, 1, fparam);
|
||||
if fparam then
|
||||
table.insert(pars, 1, fparam);
|
||||
end
|
||||
return cnrt .. "(" .. table.concat(pars, ", ") .. ");"
|
||||
end
|
||||
|
||||
|
@ -502,8 +478,8 @@ local gen_func_namesig = function(fn, cl, buf, isprop, isget, isset)
|
|||
buf[#buf + 1] = "@protected "
|
||||
end
|
||||
end
|
||||
if fn:is_class() then
|
||||
buf[#buf + 1] = "@class "
|
||||
if fn:is_static() then
|
||||
buf[#buf + 1] = "@static "
|
||||
end
|
||||
if fn:is_const() then
|
||||
buf[#buf + 1] = "@const "
|
||||
|
@ -525,12 +501,6 @@ local gen_func_param = function(fp, buf, nodir)
|
|||
buf[#buf + 1] = dval:serialize()
|
||||
buf[#buf + 1] = ")"
|
||||
end
|
||||
if fp:is_nonull() then
|
||||
buf[#buf + 1] = " @nonull"
|
||||
end
|
||||
if fp:is_nullable() then
|
||||
buf[#buf + 1] = " @nullable"
|
||||
end
|
||||
if fp:is_optional() then
|
||||
buf[#buf + 1] = " @optional"
|
||||
end
|
||||
|
@ -551,8 +521,8 @@ local gen_func_return = function(fp, ftype, buf, indent)
|
|||
buf[#buf + 1] = dval:serialize()
|
||||
buf[#buf + 1] = ")"
|
||||
end
|
||||
if fp:return_is_warn_unused(ftype) then
|
||||
buf[#buf + 1] = " @warn_unused"
|
||||
if not fp:return_allow_unused(ftype) then
|
||||
buf[#buf + 1] = " @no_unused"
|
||||
end
|
||||
buf[#buf + 1] = ";\n"
|
||||
end
|
||||
|
|
|
@ -156,7 +156,7 @@ M.check_method = function(fn, cl)
|
|||
end
|
||||
for p in fn:parameters_get() do
|
||||
if not p:documentation_get() then
|
||||
print_missing(fulln .. "." .. p:name_get(), "method parameter")
|
||||
print_missing(fulln .. "." .. p:short_name_get(), "method parameter")
|
||||
stat_incr("param", true)
|
||||
else
|
||||
stat_incr("param", false)
|
||||
|
|
20
gendoc.lua
20
gendoc.lua
|
@ -55,7 +55,7 @@ local build_reftable = function(f, title, t)
|
|||
f:write_table({ title, "Brief description" }, nt)
|
||||
end
|
||||
|
||||
local build_ref_group = function(f, ns, classes, ifaces, mixins, aliases, structs, enums, consts, globals)
|
||||
local build_ref_group = function(f, ns, classes, ifaces, mixins, aliases, structs, enums, consts)
|
||||
f:write_h(ns, 2)
|
||||
|
||||
build_reftable(f, "Classes", classes)
|
||||
|
@ -66,7 +66,6 @@ local build_ref_group = function(f, ns, classes, ifaces, mixins, aliases, struct
|
|||
build_reftable(f, "Structures", structs)
|
||||
build_reftable(f, "Enums", enums)
|
||||
build_reftable(f, "Constants", consts)
|
||||
build_reftable(f, "Globals", globals)
|
||||
|
||||
f:write_nl()
|
||||
end
|
||||
|
@ -153,9 +152,9 @@ local write_scope = function(f, func)
|
|||
[eolian.object_scope.PROTECTED] = "protected",
|
||||
[eolian.object_scope.PRIVATE] = "private"
|
||||
}
|
||||
if func:is_class() then
|
||||
if func:is_static() then
|
||||
f:write_raw(" ")
|
||||
f:write_m("class")
|
||||
f:write_m("static")
|
||||
end
|
||||
if func:type_get() == eolian.function_type.PROPERTY then
|
||||
local ft1, ft2 = ftt[func:scope_get(eolian.function_type.PROP_GET)],
|
||||
|
@ -714,7 +713,7 @@ local build_stats_keyref = function()
|
|||
end
|
||||
end
|
||||
for ev in cl:events_get() do
|
||||
keyref.add(ev:c_name_get(), eoutils.event_nspaces_get(ev, cl), "c")
|
||||
keyref.add(ev:c_macro_get(), eoutils.event_nspaces_get(ev, cl), "c")
|
||||
end
|
||||
end
|
||||
for tp in eos:aliases_get() do
|
||||
|
@ -729,9 +728,6 @@ local build_stats_keyref = function()
|
|||
for v in eos:constants_get() do
|
||||
stats.check_constant(v)
|
||||
end
|
||||
for v in eos:globals_get() do
|
||||
stats.check_global(v)
|
||||
end
|
||||
end
|
||||
|
||||
local build_typedecls = function()
|
||||
|
@ -766,14 +762,6 @@ local build_variables = function()
|
|||
}
|
||||
)
|
||||
end
|
||||
|
||||
for v in eos:globals_get() do
|
||||
render_template(
|
||||
"variable", eoutils.obj_nspaces_get(v), v:name_get(), {
|
||||
var_obj = v, var_is_constant = false
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local scan_directory = function(dir)
|
||||
|
|
|
@ -4,7 +4,7 @@ local eoutils = require("docgen.eolian_utils")
|
|||
local M = {}
|
||||
|
||||
M.example_get = function(ev)
|
||||
local evcn = ev:c_name_get()
|
||||
local evcn = ev:c_macro_get()
|
||||
local evcnl = evcn:lower()
|
||||
|
||||
local dtype = "Data *"
|
||||
|
@ -30,7 +30,7 @@ M.example_get = function(ev)
|
|||
end
|
||||
|
||||
M.signature_get = function(ev)
|
||||
local buf = { ev:name_get() }
|
||||
local buf = { ev:short_name_get() }
|
||||
|
||||
if ev:scope_get() == eolian.object_scope.PRIVATE then
|
||||
buf[#buf + 1] = " @private"
|
||||
|
@ -60,7 +60,7 @@ M.signature_get = function(ev)
|
|||
end
|
||||
|
||||
M.c_signature_get = function(ev)
|
||||
local csbuf = { ev:c_name_get(), "(" }
|
||||
local csbuf = { ev:c_macro_get(), "(" }
|
||||
|
||||
csbuf[#csbuf + 1] = eoutils.type_cstr_get(ev:type_get())
|
||||
|
||||
|
|
Loading…
Reference in New Issue