mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-08 18:34:00 +00:00
On the module summary page, display the link to the module representation page
Estimated hours taken: 0.3 Branches: main On the module summary page, display the link to the module representation page only if we actually have access to the module representation. deep_profiler/report.m: Add a field giving this information to the data structure representing the module summary page. deep_profiler/create_report.m: Fill in this field when generating module summary information. deep_profiler/display_report.m: Act on this field when displaying module summary pages.
This commit is contained in:
@@ -582,9 +582,19 @@ module_pair_to_row_data(Deep, ModuleName - ModuleData) = ModuleRowData :-
|
||||
|
||||
create_module_report(Deep, ModuleName, MaybeModuleReport) :-
|
||||
( map.search(Deep ^ module_data, ModuleName, ModuleData) ->
|
||||
deep_get_maybe_progrep(Deep, MaybeProgRep),
|
||||
(
|
||||
MaybeProgRep = ok(ProgRep),
|
||||
ProgRep = prog_rep(ModuleMap),
|
||||
map.search(ModuleMap, ModuleName, _)
|
||||
->
|
||||
HaveModuleRep = have_module_rep
|
||||
;
|
||||
HaveModuleRep = do_not_have_module_rep
|
||||
),
|
||||
PSPtrs = ModuleData ^ module_procs,
|
||||
ProcRowDatas = list.map(proc_to_active_row_data(Deep), PSPtrs),
|
||||
ModuleReport = module_report(ModuleName, ProcRowDatas),
|
||||
ModuleReport = module_report(ModuleName, HaveModuleRep, ProcRowDatas),
|
||||
MaybeModuleReport = ok(ModuleReport)
|
||||
;
|
||||
Msg = string.format("There is no module named `%s'.\n",
|
||||
|
||||
@@ -1127,7 +1127,7 @@ avoid_sort_self_and_desc(Prefs) = SortPrefs :-
|
||||
is det.
|
||||
|
||||
display_report_module(Prefs, ModuleReport, Display) :-
|
||||
ModuleReport = module_report(ModuleName, ProcRowDatas0),
|
||||
ModuleReport = module_report(ModuleName, HaveModuleRep, ProcRowDatas0),
|
||||
Cmd = deep_cmd_module(ModuleName),
|
||||
Title = string.format("The procedures of module %s:", [s(ModuleName)]),
|
||||
|
||||
@@ -1174,23 +1174,32 @@ display_report_module(Prefs, ModuleReport, Display) :-
|
||||
GetterSetterCmd = deep_cmd_module_getter_setters(ModuleName),
|
||||
GetterSetterControl = display_link(deep_link(GetterSetterCmd, yes(Prefs),
|
||||
attr_str([], "Show field getters and setters"), link_class_link)),
|
||||
RepCmd = deep_cmd_module_rep(ModuleName),
|
||||
RepControl = display_link(deep_link(RepCmd, yes(Prefs),
|
||||
attr_str([], "Show module representation"), link_class_link)),
|
||||
(
|
||||
HaveModuleRep = do_not_have_module_rep,
|
||||
ModuleControls =
|
||||
[display_paragraph_break, GetterSetterControl]
|
||||
;
|
||||
HaveModuleRep = have_module_rep,
|
||||
RepCmd = deep_cmd_module_rep(ModuleName),
|
||||
RepControl = display_link(deep_link(RepCmd, yes(Prefs),
|
||||
attr_str([], "Show module representation"), link_class_link)),
|
||||
ModuleControls =
|
||||
[display_paragraph_break, GetterSetterControl,
|
||||
display_paragraph_break, RepControl]
|
||||
),
|
||||
|
||||
InactiveControls = inactive_proc_controls(Prefs, Cmd),
|
||||
FieldControls = field_controls(Prefs, Cmd),
|
||||
FormatControls = format_controls(Prefs, Cmd),
|
||||
MenuRestartQuitControls = cmds_menu_restart_quit(yes(Prefs)),
|
||||
|
||||
Display = display(yes(Title),
|
||||
[DisplayTable,
|
||||
display_paragraph_break, GetterSetterControl,
|
||||
display_paragraph_break, RepControl,
|
||||
display_paragraph_break, InactiveControls,
|
||||
GeneralControls =
|
||||
[display_paragraph_break, InactiveControls,
|
||||
display_paragraph_break, FieldControls,
|
||||
display_paragraph_break, FormatControls,
|
||||
display_paragraph_break, MenuRestartQuitControls]).
|
||||
display_paragraph_break, MenuRestartQuitControls],
|
||||
|
||||
Display = display(yes(Title),
|
||||
[DisplayTable] ++ ModuleControls ++ GeneralControls).
|
||||
|
||||
:- pred active_proc(perf_row_data(proc_active)::in) is semidet.
|
||||
|
||||
|
||||
@@ -322,9 +322,14 @@
|
||||
% Summary information about all the procedures in one module
|
||||
% of the program.
|
||||
mr_module_name :: string,
|
||||
mr_have_module_rep :: maybe_have_module_rep,
|
||||
mr_procs :: list(perf_row_data(proc_active))
|
||||
).
|
||||
|
||||
:- type maybe_have_module_rep
|
||||
---> do_not_have_module_rep
|
||||
; have_module_rep.
|
||||
|
||||
:- type data_struct_name
|
||||
---> data_struct_name(string).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user