[m-rev.] diff: selective display of links to module representations

Zoltan Somogyi zs at unimelb.edu.au
Wed Oct 24 16:34:34 AEDT 2012


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.

Zoltan.

cvs diff: Diffing .
Index: create_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/create_report.m,v
retrieving revision 1.38
diff -u -b -r1.38 create_report.m
--- create_report.m	24 Oct 2012 04:59:53 -0000	1.38
+++ create_report.m	24 Oct 2012 05:30:59 -0000
@@ -582,9 +582,19 @@
 
 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",
Index: display_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/display_report.m,v
retrieving revision 1.38
diff -u -b -r1.38 display_report.m
--- display_report.m	24 Oct 2012 04:59:53 -0000	1.38
+++ display_report.m	24 Oct 2012 05:30:59 -0000
@@ -1127,7 +1127,7 @@
     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 @@
     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)),
+    (
+        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.
 
Index: report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/report.m,v
retrieving revision 1.34
diff -u -b -r1.34 report.m
--- report.m	24 Oct 2012 04:59:54 -0000	1.34
+++ report.m	24 Oct 2012 05:30:59 -0000
@@ -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).
 
cvs diff: Diffing notes
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list