[m-rev.] diff: Delete unused option in browser_params_to_string.
Peter Wang
novalazy at gmail.com
Wed Aug 16 10:40:34 AEST 2017
browser/browser_info.m:
browser_params_to_string supported an option to print the browser
persistent state in a friendly format instead of as mdb commands.
The option was never used, so delete it.
(Fixes an unreachable bug where that unused code path did not print
the web_browser_cmd value.)
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_misc.c:
Update the caller.
---
browser/browser_info.m | 118 ++++++++++++++---------------------------
trace/mercury_trace_browse.c | 4 +-
trace/mercury_trace_browse.h | 8 ++-
trace/mercury_trace_cmd_misc.c | 2 +-
4 files changed, 47 insertions(+), 85 deletions(-)
diff --git a/browser/browser_info.m b/browser/browser_info.m
index fe30b8d..e2fc5b7 100644
--- a/browser/browser_info.m
+++ b/browser/browser_info.m
@@ -316,8 +316,8 @@
:- pred send_term_to_socket(term_browser_response::in, io::di, io::uo) is det.
-:- pred browser_params_to_string(browser_persistent_state::in, bool::in,
- string::out) is det.
+:- pred browser_params_to_string(browser_persistent_state::in, string::out)
+ is det.
%---------------------------------------------------------------------------%
@@ -1130,86 +1130,50 @@ send_term_to_socket(Term, !IO) :-
%---------------------------------------------------------------------------%
-:- pragma foreign_export("C", browser_params_to_string(in, in, out),
+:- pragma foreign_export("C", browser_params_to_string(in, out),
"ML_BROWSE_browser_params_to_string").
-browser_params_to_string(Browser, MDBCommandFormat, Desc) :-
+browser_params_to_string(Browser, Desc) :-
Browser = browser_persistent_state(PrintParams, BrowseParams,
PrintAllParams, NumIOActions, MaybeXMLBrowserCmd, MaybeXMLTmpFileName,
MaybeWebBrowserCmd),
- (
- MDBCommandFormat = yes,
- ParamCmds =
- caller_params_to_mdb_command("-P ", PrintParams) ++
- caller_params_to_mdb_command("-B ", BrowseParams) ++
- caller_params_to_mdb_command("-A ", PrintAllParams),
- NumIOActionCmd =
- "max_io_actions " ++ int_to_string(NumIOActions) ++ "\n",
- ( if
- MaybeXMLBrowserCmd = yes(XMLBrowserCmd),
- % XMLBrowserCmd shouldn't be "" if MaybeXMLBrowserCmd is yes,
- % but better safe than sorry.
- XMLBrowserCmd \= ""
- then
- XMLBrowserCmdCmd =
- "xml_browser_cmd " ++ XMLBrowserCmd ++ "\n"
- else
- XMLBrowserCmdCmd = ""
- ),
- ( if
- MaybeXMLTmpFileName = yes(XMLTmpFileName),
- % XMLTmpFileName shouldn't be "" if MaybeXMLTmpFileName is yes,
- % but better safe than sorry.
- XMLTmpFileName \= ""
- then
- XMLTmpFileNameCmd =
- "xml_tmp_filename " ++ XMLTmpFileName ++ "\n"
- else
- XMLTmpFileNameCmd = ""
- ),
- ( if
- MaybeWebBrowserCmd = yes(WebBrowserCmd),
- WebBrowserCmd \= ""
- then
- WebBrowserCmdCmd =
- "web_browser_cmd " ++ WebBrowserCmd ++ "\n"
- else
- WebBrowserCmdCmd = ""
- ),
- Desc = ParamCmds ++ NumIOActionCmd ++
- XMLBrowserCmdCmd ++ XMLTmpFileNameCmd ++
- WebBrowserCmdCmd
- ;
- MDBCommandFormat = no,
- ParamDesc =
- "Print parameters:\n" ++
- caller_params_to_desc(PrintParams) ++
- "Browse parameters:\n" ++
- caller_params_to_desc(BrowseParams) ++
- "Print all parameters:\n" ++
- caller_params_to_desc(PrintAllParams),
- NumIOActionDesc =
- "Maximum number of I/O actions printed: " ++
- int_to_string(NumIOActions) ++ "\n",
- (
- MaybeXMLBrowserCmd = yes(XMLBrowserCmd),
- XMLBrowserCmdDesc =
- "XML browser command: " ++ XMLBrowserCmd ++ "\n"
- ;
- MaybeXMLBrowserCmd = no,
- XMLBrowserCmdDesc = ""
- ),
- (
- MaybeXMLTmpFileName = yes(XMLTmpFileName),
- XMLTmpFileNameDesc =
- "XML temporary filename: " ++ XMLTmpFileName ++ "\n"
- ;
- MaybeXMLTmpFileName = no,
- XMLTmpFileNameDesc = ""
- ),
- Desc = ParamDesc ++ NumIOActionDesc ++
- XMLBrowserCmdDesc ++ XMLTmpFileNameDesc
- ).
+ ParamCmds =
+ caller_params_to_mdb_command("-P ", PrintParams) ++
+ caller_params_to_mdb_command("-B ", BrowseParams) ++
+ caller_params_to_mdb_command("-A ", PrintAllParams),
+ NumIOActionCmd =
+ "max_io_actions " ++ int_to_string(NumIOActions) ++ "\n",
+ ( if
+ MaybeXMLBrowserCmd = yes(XMLBrowserCmd),
+ % XMLBrowserCmd shouldn't be "" if MaybeXMLBrowserCmd is yes,
+ % but better safe than sorry.
+ XMLBrowserCmd \= ""
+ then
+ XMLBrowserCmdCmd = "xml_browser_cmd " ++ XMLBrowserCmd ++ "\n"
+ else
+ XMLBrowserCmdCmd = ""
+ ),
+ ( if
+ MaybeXMLTmpFileName = yes(XMLTmpFileName),
+ % XMLTmpFileName shouldn't be "" if MaybeXMLTmpFileName is yes,
+ % but better safe than sorry.
+ XMLTmpFileName \= ""
+ then
+ XMLTmpFileNameCmd = "xml_tmp_filename " ++ XMLTmpFileName ++ "\n"
+ else
+ XMLTmpFileNameCmd = ""
+ ),
+ ( if
+ MaybeWebBrowserCmd = yes(WebBrowserCmd),
+ WebBrowserCmd \= ""
+ then
+ WebBrowserCmdCmd = "web_browser_cmd " ++ WebBrowserCmd ++ "\n"
+ else
+ WebBrowserCmdCmd = ""
+ ),
+ Desc = ParamCmds ++ NumIOActionCmd ++
+ XMLBrowserCmdCmd ++ XMLTmpFileNameCmd ++
+ WebBrowserCmdCmd.
:- func caller_params_to_mdb_command(string, caller_params) = string.
diff --git a/trace/mercury_trace_browse.c b/trace/mercury_trace_browse.c
index 264acef..402761b 100644
--- a/trace/mercury_trace_browse.c
+++ b/trace/mercury_trace_browse.c
@@ -329,14 +329,14 @@ MR_trace_print_goal(MR_ConstString name, MR_Word arg_list, MR_Word is_func,
}
void
-MR_trace_print_all_browser_params(FILE *fp, MR_bool mdb_command_format)
+MR_trace_print_all_browser_params(FILE *fp)
{
MR_String param_string;
MR_trace_browse_ensure_init();
MR_TRACE_CALL_MERCURY(
ML_BROWSE_browser_params_to_string(MR_trace_browser_persistent_state,
- (MR_Word)mdb_command_format, ¶m_string);
+ ¶m_string);
);
fputs(param_string, fp);
diff --git a/trace/mercury_trace_browse.h b/trace/mercury_trace_browse.h
index a6a0316..c65ccbb 100644
--- a/trace/mercury_trace_browse.h
+++ b/trace/mercury_trace_browse.h
@@ -91,12 +91,10 @@ extern void MR_trace_print_goal(MR_ConstString name, MR_Word arg_list,
MR_Word is_func, MR_BrowseCallerType caller,
MR_BrowseFormat format);
-// Print all the browser parameters. If mdb_command_format is true, print them
-// in the form of the mdb commands required to recreate this state; otherwise,
-// print them in a user-friendly form.
+// Print all the browser parameters in the form of the mdb commands required to
+// recreate this state.
-extern void MR_trace_print_all_browser_params(FILE *fp,
- MR_bool mdb_command_format);
+extern void MR_trace_print_all_browser_params(FILE *fp);
// Invoke an interactive query.
diff --git a/trace/mercury_trace_cmd_misc.c b/trace/mercury_trace_cmd_misc.c
index 8c4d7ca..d8cc97d 100644
--- a/trace/mercury_trace_cmd_misc.c
+++ b/trace/mercury_trace_cmd_misc.c
@@ -167,7 +167,7 @@ MR_trace_cmd_save(char **words, int word_count, MR_TraceCmdInfo *cmd,
MR_fatal_error("save cmd: invalid default scope");
}
- MR_trace_print_all_browser_params(fp, MR_TRUE);
+ MR_trace_print_all_browser_params(fp);
MR_decl_print_all_trusted(fp, MR_TRUE);
if (MR_dice_fail_trace_counts_file != NULL) {
--
2.9.0
More information about the reviews
mailing list