summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-12-12 16:32:55 +0000
committerAndy Williams <andy@andywilliams.me>2017-12-12 16:35:20 +0000
commit86b37828d9866465676f9fa6d07629696c31db2d (patch)
treefc7d6fc94b767463b50cb9f48f5280123c263a48
parent33a40500488f0a4be602901cbb58895ea6ddbbd6 (diff)
docs: Group our inherited members and events by class
That's the closest class that extends, not the originating class. Also realised that "inherited from" is not needed this deep, so keep it succinct.
-rw-r--r--src/scripts/elua/apps/gendoc.lua115
1 files changed, 72 insertions, 43 deletions
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index e4c0be8b35..ac0c4dfe16 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -711,11 +711,6 @@ local build_functable = function(f, tcl, tbl, newm)
711 711
712 local cl, impl = unpack(implt) 712 local cl, impl = unpack(implt)
713 local ocl = impl:class_get() 713 local ocl = impl:class_get()
714 if not newm then
715 lbuf:write_link(cl:nspaces_get(true), cl:full_name_get())
716 lbuf:write_raw(".")
717 end
718
719 local func = impl:function_get() 714 local func = impl:function_get()
720 local over = impl:is_overridden(cl) 715 local over = impl:is_overridden(cl)
721 716
@@ -732,11 +727,12 @@ local build_functable = function(f, tcl, tbl, newm)
732 end 727 end
733 728
734 local wt = {} 729 local wt = {}
735 wt[0] = func 730 wt[0] = cl
731 wt[1] = func
736 -- name info 732 -- name info
737 wt[1] = lbuf:finish() 733 wt[2] = lbuf:finish()
738 734
739 if over then 735 if over and newm then
740 -- TODO: possibly also mention which part of a property was 736 -- TODO: possibly also mention which part of a property was
741 -- overridden and where, get/set override point might differ! 737 -- overridden and where, get/set override point might differ!
742 -- but we get latest doc every time so it's ok for now 738 -- but we get latest doc every time so it's ok for now
@@ -759,7 +755,13 @@ local build_functable = function(f, tcl, tbl, newm)
759 else 755 else
760 bdoc = doc:brief_get(docf) 756 bdoc = doc:brief_get(docf)
761 end 757 end
762 758 if bdoc ~= "No description supplied." then
759 lbuf:write_br()
760 lbuf:write_nl()
761 lbuf:write_raw("> ")
762 lbuf:write_raw(bdoc)
763 end
764
763 lbuf:write_nl() 765 lbuf:write_nl()
764 local codes = {} 766 local codes = {}
765 if func:type_get() ~= dtree.Function.PROPERTY then 767 if func:type_get() ~= dtree.Function.PROPERTY then
@@ -769,12 +771,7 @@ local build_functable = function(f, tcl, tbl, newm)
769 codes[#codes + 1] = gen_func_csig(func, dtree.Function.PROP_SET) 771 codes[#codes + 1] = gen_func_csig(func, dtree.Function.PROP_SET)
770 end 772 end
771 lbuf:write_code(table.concat(codes, "\n"), "c") 773 lbuf:write_code(table.concat(codes, "\n"), "c")
772 774 lbuf:write_br()
773 if bdoc ~= "No description supplied." then
774 lbuf:write_nl()
775 lbuf:write_raw(bdoc)
776 lbuf:write_br()
777 end
778 end 775 end
779 776
780 -- sigs and description 777 -- sigs and description
@@ -805,7 +802,7 @@ local build_functable = function(f, tcl, tbl, newm)
805 end 802 end
806 end 803 end
807 table.sort(nt, function(v1, v2) 804 table.sort(nt, function(v1, v2)
808 local f1, f2 = v1[0], v2[0] 805 local f1, f2 = v1[1], v2[1]
809 local f1s, f2s = get_best_scope(f1), get_best_scope(f2) 806 local f1s, f2s = get_best_scope(f1), get_best_scope(f2)
810 if f1s ~= f2s then 807 if f1s ~= f2s then
811 if f1s ~= f1.scope.PROTECED then 808 if f1s ~= f1.scope.PROTECED then
@@ -816,11 +813,15 @@ local build_functable = function(f, tcl, tbl, newm)
816 return f2s == f2.scope.PRIVATE 813 return f2s == f2.scope.PRIVATE
817 end 814 end
818 end 815 end
819 return v1[1] < v2[1] 816 return v1[2] < v2[2]
820 end) 817 end)
818
819 local prevcl = tcl
820 local wrote = false
821 for i, item in ipairs(nt) do 821 for i, item in ipairs(nt) do
822 -- scope 822 -- scope
823 local func = item[0] 823 local cl = item[0]
824 local func = item[1]
824 local ftt = { 825 local ftt = {
825 [func.scope.PROTECTED] = "protected", 826 [func.scope.PROTECTED] = "protected",
826 [func.scope.PRIVATE] = "private" 827 [func.scope.PRIVATE] = "private"
@@ -829,10 +830,28 @@ local build_functable = function(f, tcl, tbl, newm)
829 f:write_b(fs) 830 f:write_b(fs)
830 f:write_raw(" ") 831 f:write_raw(" ")
831 end 832 end
833
834 -- class grouping for inheritance
835 if cl ~= prevcl then
836 if wrote then
837 f:write_br()
838 f:write_nl()
839 end
840
841 prevcl = cl
842 f:write_link(cl:nspaces_get(true), cl:full_name_get())
843 f:write_br()
844 f:write_nl()
845 f:write_raw("> ")
846 wrote = true
847 elseif not newm then
848 f:write_raw(", ")
849 end
850
832 -- name 851 -- name
833 f:write_raw(item[1])
834 -- override
835 f:write_raw(item[2]) 852 f:write_raw(item[2])
853 -- override
854 f:write_raw(item[3])
836 -- scope 855 -- scope
837 if func:type_get() == func.PROPERTY then 856 if func:type_get() == func.PROPERTY then
838 local ft1, ft2 = ftt[func:scope_get(func.PROP_GET)], 857 local ft1, ft2 = ftt[func:scope_get(func.PROP_GET)],
@@ -859,10 +878,7 @@ local build_functable = function(f, tcl, tbl, newm)
859 end 878 end
860 end 879 end
861 -- desc 880 -- desc
862 f:write_raw(item[3]) 881 f:write_raw(item[4])
863 f:write_nl()
864 f:write_br()
865 f:write_nl()
866 end 882 end
867 f:write_nl() 883 f:write_nl()
868end 884end
@@ -918,31 +934,28 @@ local build_evtable = function(f, tcl, tbl, newm)
918 cl, ev = tcl, evt 934 cl, ev = tcl, evt
919 end 935 end
920 936
921 if not newm then
922 lbuf:write_link(cl:nspaces_get(true), cl:full_name_get())
923 lbuf:write_raw(".")
924 end
925
926 local llbuf = writer.Buffer() 937 local llbuf = writer.Buffer()
927 llbuf:write_link(ev:nspaces_get(cl, true), ev:name_get()) 938 llbuf:write_link(ev:nspaces_get(cl, true), ev:name_get())
928 lbuf:write_b(llbuf:finish()) 939 lbuf:write_b(llbuf:finish())
929 940
930 local wt = {} 941 local wt = {}
931 wt[0] = ev 942 wt[0] = cl
943 wt[1] = ev
932 -- name info 944 -- name info
933 wt[1] = lbuf:finish() 945 wt[2] = lbuf:finish()
934 946
935 if newm then 947 if newm then
936 lbuf:write_nl()
937 lbuf:write_code(build_evcsig(ev), "c");
938
939 local bdoc = ev:doc_get():brief_get() 948 local bdoc = ev:doc_get():brief_get()
940 if bdoc ~= "No description supplied." then 949 if bdoc ~= "No description supplied." then
950 lbuf:write_br()
941 lbuf:write_nl() 951 lbuf:write_nl()
952 lbuf:write_raw("> ")
942 lbuf:write_raw(bdoc) 953 lbuf:write_raw(bdoc)
943 lbuf:write_br()
944 end 954 end
945 955
956 lbuf:write_nl()
957 lbuf:write_code(build_evcsig(ev), "c");
958 lbuf:write_br()
946 end 959 end
947 -- description 960 -- description
948 wt[#wt + 1] = lbuf:finish() 961 wt[#wt + 1] = lbuf:finish()
@@ -952,17 +965,36 @@ local build_evtable = function(f, tcl, tbl, newm)
952 build_event(ev, cl) 965 build_event(ev, cl)
953 end 966 end
954 end 967 end
955 table.sort(nt, function(v1, v2) return v1[1] < v2[1] end) 968 table.sort(nt, function(v1, v2) return v1[2] < v2[2] end)
956 for i = #nt, 1, -1 do 969 for i = #nt, 1, -1 do
957 if i ~= 1 and nt[i][1] == nt[i - 1][1] then 970 if i ~= 1 and nt[i][2] == nt[i - 1][2] then
958 table.remove(nt, i) 971 table.remove(nt, i)
959 end 972 end
960 end 973 end
974 local prevcl = tcl
975 local wrote = false
961 for i, item in ipairs(nt) do 976 for i, item in ipairs(nt) do
977 local cl = item[0]
978 if cl ~= prevcl then
979 if wrote then
980 f:write_br()
981 f:write_nl()
982 end
983
984 prevcl = cl
985 f:write_link(cl:nspaces_get(true), cl:full_name_get())
986 f:write_br()
987 f:write_nl()
988 f:write_raw("> ")
989 wrote = true
990 elseif not newm then
991 f:write_raw(", ")
992 end
993
962 -- name 994 -- name
963 f:write_raw(item[1]) 995 f:write_raw(item[2])
964 -- scope 996 -- scope
965 local ev = item[0] 997 local ev = item[1]
966 local ett = { 998 local ett = {
967 [ev.scope.PROTECTED] = "protected", 999 [ev.scope.PROTECTED] = "protected",
968 [ev.scope.PRIVATE] = "private" 1000 [ev.scope.PRIVATE] = "private"
@@ -973,10 +1005,7 @@ local build_evtable = function(f, tcl, tbl, newm)
973 f:write_m(ets) 1005 f:write_m(ets)
974 end 1006 end
975 -- desc 1007 -- desc
976 f:write_raw(item[2]) 1008 f:write_raw(item[3])
977 f:write_nl()
978 f:write_br()
979 f:write_nl()
980 end 1009 end
981end 1010end
982 1011