summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-02-24 17:12:28 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-02-24 17:12:28 +0100
commit4f9c3e0679e8a5f4bfe50a16ab71f6873d362de3 (patch)
tree444d1984ba58c32d60f5ac300efbfc316ff2e3e4
parent9124f1f8c6ddd82a9fe14a42ecadff01b3fb1e18 (diff)
docgen: more useful event listing
-rw-r--r--src/scripts/elua/apps/gendoc.lua65
1 files changed, 48 insertions, 17 deletions
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 45d0467338..2c5d07ce91 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -693,7 +693,7 @@ local build_functable = function(f, title, tcl, tbl, newm)
693 if #tbl == 0 then 693 if #tbl == 0 then
694 return 694 return
695 end 695 end
696 f:write_h(title, 2) 696 f:write_h(title, newm and 2 or 3)
697 local nt = {} 697 local nt = {}
698 for i, implt in ipairs(tbl) do 698 for i, implt in ipairs(tbl) do
699 local lbuf = writer.Buffer() 699 local lbuf = writer.Buffer()
@@ -814,31 +814,62 @@ find_callables = function(cl, omeths, events, written)
814 end 814 end
815end 815end
816 816
817local build_evtable = function(f, title, cl, tbl) 817local build_evtable = function(f, title, tcl, tbl, newm)
818 if #tbl == 0 then 818 if #tbl == 0 then
819 return 819 return
820 end 820 end
821 f:write_h(title, 2) 821 f:write_h(title, newm and 2 or 3)
822 local nt = {} 822 local nt = {}
823 local oclass = not cl 823 for i, evt in ipairs(tbl) do
824 for i, ev in ipairs(tbl) do
825 local lbuf = writer.Buffer() 824 local lbuf = writer.Buffer()
826 local evn 825 local evn
827 if oclass then 826 local cl, ev
828 cl = ev[1] 827 if not newm then
829 ev = ev[2] 828 cl, ev = evt[1], evt[2]
830 evn = cl:full_name_get() .. "." .. ev:name_get()
831 else 829 else
832 evn = ev:name_get() 830 cl, ev = tcl, evt
833 end 831 end
834 lbuf:write_link(ev:nspaces_get(cl, true), evn) 832
835 nt[#nt + 1] = { 833 if not newm then
836 lbuf:finish(), ev:doc_get():brief_get() 834 lbuf:write_link(cl:nspaces_get(true), cl:full_name_get())
837 } 835 lbuf:write_raw(".")
836 end
837
838 local llbuf = writer.Buffer()
839 llbuf:write_link(ev:nspaces_get(cl, true), ev:name_get())
840 lbuf:write_b(llbuf:finish())
841
842 local wt = {}
843 -- name info
844 wt[#wt + 1] = lbuf:finish()
845
846 lbuf:write_nl()
847 lbuf:write_code(dtree.type_cstr_get(ev:type_get(), ev:c_name_get())
848 .. ";", "c")
849
850 local bdoc = ev:doc_get():brief_get()
851 if bdoc ~= "No description supplied." then
852 lbuf:write_nl()
853 lbuf:write_raw(bdoc)
854 lbuf:write_br()
855 end
856
857 -- description
858 wt[#wt + 1] = lbuf:finish()
859 nt[#nt + 1] = wt
860
838 build_event(ev, cl) 861 build_event(ev, cl)
839 end 862 end
840 table.sort(nt, function(v1, v2) return v1[1] < v2[1] end) 863 table.sort(nt, function(v1, v2) return v1[1] < v2[1] end)
841 f:write_table({ "Event name", "Brief description" }, nt) 864 for i, item in ipairs(nt) do
865 -- name
866 f:write_raw(item[1])
867 -- desc
868 f:write_raw(item[2])
869 f:write_nl()
870 f:write_br()
871 f:write_nl()
872 end
842end 873end
843 874
844local build_class = function(cl) 875local build_class = function(cl)
@@ -885,8 +916,8 @@ local build_class = function(cl)
885 build_functable(f, "Members", cl, meths, true) 916 build_functable(f, "Members", cl, meths, true)
886 build_functable(f, "Inherited", cl, omeths, false) 917 build_functable(f, "Inherited", cl, omeths, false)
887 918
888 build_evtable(f, "Events", cl, cl:events_get()) 919 build_evtable(f, "Events", cl, cl:events_get(), true)
889 build_evtable(f, "Inherited Events", nil, ievs) 920 build_evtable(f, "Inherited", cl, ievs, false)
890 921
891 f:finish() 922 f:finish()
892end 923end