[m-rev.] diff switch to four-space indentation in trace directory files
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri Jan 28 13:51:01 AEDT 2005
trace/mercury_trace_browse.c:
trace/mercury_trace_help.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_source.c:
trace/mercury_trace_tables.c:
trace/mercury_trace_util.c:
trace/mercury_vars.c:
Switch to four-space indentation. Previously, the code was so indented
that some constant strings had to be split over four lines.
Zoltan.
cvs diff: Diffing .
Index: mercury_trace_browse.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_browse.c,v
retrieving revision 1.34
diff -u -b -r1.34 mercury_trace_browse.c
--- mercury_trace_browse.c 11 Dec 2004 01:59:52 -0000 1.34
+++ mercury_trace_browse.c 27 Jan 2005 14:37:29 -0000
@@ -1,4 +1,7 @@
/*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
** Copyright (C) 1998-2004 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -109,8 +112,8 @@
MR_c_file_to_mercury_file(MR_mdb_out, &mdb_out);
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_save_term_to_file_xml(mercury_filename,
- browser_term, &mdb_out);
+ ML_BROWSE_save_term_to_file_xml(mercury_filename, browser_term,
+ &mdb_out);
);
}
@@ -230,15 +233,13 @@
if (format != MR_BROWSE_DEFAULT_FORMAT) {
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_print_browser_term_format(browser_term,
- &mdb_out, caller, (MR_Word) format,
- MR_trace_browser_persistent_state);
+ ML_BROWSE_print_browser_term_format(browser_term, &mdb_out, caller,
+ (MR_Word) format, MR_trace_browser_persistent_state);
);
} else {
MR_TRACE_CALL_MERCURY(
ML_BROWSE_print_browser_term(browser_term, &mdb_out,
- (MR_Word) caller,
- MR_trace_browser_persistent_state);
+ (MR_Word) caller, MR_trace_browser_persistent_state);
);
}
}
@@ -258,15 +259,13 @@
if (format != MR_BROWSE_DEFAULT_FORMAT) {
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_print_browser_term_format(browser_term,
- &mdb_out, caller, (MR_Word) format,
- MR_trace_browser_persistent_state);
+ ML_BROWSE_print_browser_term_format(browser_term, &mdb_out, caller,
+ (MR_Word) format, MR_trace_browser_persistent_state);
);
} else {
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_print_browser_term(browser_term,
- &mdb_out, (MR_Word) caller,
- MR_trace_browser_persistent_state);
+ ML_BROWSE_print_browser_term(browser_term, &mdb_out,
+ (MR_Word) caller, MR_trace_browser_persistent_state);
);
}
}
@@ -298,9 +297,8 @@
MR_trace_is_natural_number(value, &depth))
{
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_set_param_depth_from_mdb(print, browse,
- print_all, flat, raw_pretty, verbose, pretty,
- depth,
+ ML_BROWSE_set_param_depth_from_mdb(print, browse, print_all,
+ flat, raw_pretty, verbose, pretty, depth,
MR_trace_browser_persistent_state,
&MR_trace_browser_persistent_state);
);
@@ -309,9 +307,8 @@
MR_trace_is_natural_number(value, &size))
{
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_set_param_size_from_mdb(print, browse,
- print_all, flat, raw_pretty, verbose, pretty,
- size,
+ ML_BROWSE_set_param_size_from_mdb(print, browse, print_all,
+ flat, raw_pretty, verbose, pretty, size,
MR_trace_browser_persistent_state,
&MR_trace_browser_persistent_state);
);
@@ -320,9 +317,8 @@
MR_trace_is_natural_number(value, &width))
{
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_set_param_width_from_mdb(print, browse,
- print_all, flat, raw_pretty, verbose, pretty,
- width,
+ ML_BROWSE_set_param_width_from_mdb(print, browse, print_all,
+ flat, raw_pretty, verbose, pretty, width,
MR_trace_browser_persistent_state,
&MR_trace_browser_persistent_state);
);
@@ -331,9 +327,8 @@
MR_trace_is_natural_number(value, &lines))
{
MR_TRACE_CALL_MERCURY(
- ML_BROWSE_set_param_lines_from_mdb(print, browse,
- print_all, flat, raw_pretty, verbose, pretty,
- lines,
+ ML_BROWSE_set_param_lines_from_mdb(print, browse, print_all,
+ flat, raw_pretty, verbose, pretty, lines,
MR_trace_browser_persistent_state,
&MR_trace_browser_persistent_state);
);
@@ -410,7 +405,9 @@
MR_c_file_to_mercury_file(MR_mdb_in, &mdb_in);
MR_c_file_to_mercury_file(MR_mdb_out, &mdb_out);
- if (options == NULL) options = "";
+ if (options == NULL) {
+ options = "";
+ }
MR_TRACE_USE_HP(
MR_make_aligned_string(options_on_heap, options);
@@ -419,8 +416,8 @@
for (i = num_imports; i > 0; i--) {
MR_ConstString this_import;
MR_make_aligned_string(this_import, imports[i - 1]);
- imports_list = MR_string_list_cons(
- (MR_Word) this_import, imports_list);
+ imports_list = MR_string_list_cons((MR_Word) this_import,
+ imports_list);
}
);
Index: mercury_trace_help.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_help.c,v
retrieving revision 1.23
diff -u -b -r1.23 mercury_trace_help.c
--- mercury_trace_help.c 6 May 2004 08:13:50 -0000 1.23
+++ mercury_trace_help.c 27 Jan 2005 14:39:27 -0000
@@ -1,4 +1,7 @@
/*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
** Copyright (C) 1998-2000,2002-2004 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -103,9 +106,8 @@
);
MR_TRACE_CALL_MERCURY(
- ML_HELP_add_help_node(MR_trace_help_system, path, slot,
- name_on_heap, text_on_heap, &result,
- &MR_trace_help_system);
+ ML_HELP_add_help_node(MR_trace_help_system, path, slot, name_on_heap,
+ text_on_heap, &result, &MR_trace_help_system);
error = ML_HELP_result_is_error(result, &msg);
);
@@ -189,16 +191,14 @@
if (! done) {
MR_TRACE_CALL_MERCURY(
typeinfo_type = ML_get_type_info_for_type_info();
- ML_HELP_help_system_type(
- &MR_trace_help_system_type_word);
- MR_trace_help_system_type =
- (MR_TypeInfo) MR_trace_help_system_type_word;
+ ML_HELP_help_system_type(&MR_trace_help_system_type_word);
+ MR_trace_help_system_type = (MR_TypeInfo)
+ MR_trace_help_system_type_word;
ML_HELP_init(&MR_trace_help_system);
);
MR_trace_help_system_type = (MR_TypeInfo) MR_make_permanent(
- (MR_Word) MR_trace_help_system_type,
- (MR_TypeInfo) typeinfo_type);
+ (MR_Word) MR_trace_help_system_type, (MR_TypeInfo) typeinfo_type);
MR_trace_help_system = MR_make_permanent(MR_trace_help_system,
MR_trace_help_system_type);
done = MR_TRUE;
@@ -218,8 +218,7 @@
strcmp(MR_help_words[slot], word));
if (!found) {
MR_ensure_room_for_next(MR_help_word, char *, 100);
- MR_prepare_insert_into_sorted(MR_help_words,
- MR_help_word_next, slot,
+ MR_prepare_insert_into_sorted(MR_help_words, MR_help_word_next, slot,
strcmp(MR_help_words[slot], word));
MR_help_words[slot] = MR_copy_string(word);
}
Index: mercury_trace_internal.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.189
diff -u -b -r1.189 mercury_trace_internal.c
--- mercury_trace_internal.c 27 Jan 2005 06:17:41 -0000 1.189
+++ mercury_trace_internal.c 27 Jan 2005 14:31:20 -0000
@@ -1,4 +1,7 @@
/*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
** Copyright (C) 1998-2005 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -397,8 +400,8 @@
static void MR_trace_internal_init_from_local(void);
static void MR_trace_internal_init_from_home_dir(void);
static MR_Next MR_trace_debug_cmd(char *line, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr);
+ MR_Event_Info *event_info, MR_Event_Details *event_details,
+ MR_Code **jumpaddr);
typedef MR_Next MR_TraceCmdFunc(char **words, int word_count,
MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
@@ -494,13 +497,14 @@
static void MR_maybe_print_spy_point(int slot, const char *problem);
static void MR_print_unsigned_var(FILE *fp, const char *var,
MR_Unsigned value);
-static MR_bool MR_parse_source_locn(char *word, const char **file, int *line);
+static MR_bool MR_parse_source_locn(char *word, const char **file,
+ int *line);
static const char *MR_trace_new_source_window(const char *window_cmd,
const char *server_cmd, const char *server_name,
int timeout, MR_bool force, MR_bool verbose,
MR_bool split);
-static void MR_trace_maybe_sync_source_window(MR_Event_Info *event_info,
- MR_bool verbose);
+static void MR_trace_maybe_sync_source_window(
+ MR_Event_Info *event_info, MR_bool verbose);
static void MR_trace_maybe_close_source_window(MR_bool verbose);
static void MR_trace_cmd_stack_2(MR_Event_Info *event_info,
@@ -524,13 +528,15 @@
MR_Spy_Print_List *print_list,
char ***words, int *word_count,
const char *cat, const char *item);
-static MR_bool MR_trace_options_ignore_count(MR_Spy_Ignore_When *ignore_when,
+static MR_bool MR_trace_options_ignore_count(
+ MR_Spy_Ignore_When *ignore_when,
int *ignore_count, char ***words, int *word_count,
const char *cat, const char *item);
static MR_bool MR_trace_options_quiet(MR_bool *verbose, char ***words,
int *word_count, const char *cat, const char *item);
-static MR_bool MR_trace_options_ignore(MR_bool *ignore_errors, char ***words,
- int *word_count, const char *cat, const char *item);
+static MR_bool MR_trace_options_ignore(MR_bool *ignore_errors,
+ char ***words, int *word_count, const char *cat,
+ const char *item);
static MR_bool MR_trace_options_break_print(MR_Browse_Format *format,
MR_bool *at_start, MR_bool *warn, char ***words,
int *word_count, const char *cat, const char *item);
@@ -539,11 +545,12 @@
static MR_bool MR_trace_options_stack_trace(MR_bool *detailed,
int *frame_limit, char ***words, int *word_count,
const char *cat, const char *item);
-static MR_bool MR_trace_options_confirmed(MR_bool *confirmed, char ***words,
- int *word_count, const char *cat, const char *item);
-static MR_bool MR_trace_options_format(MR_Browse_Format *format, MR_bool *xml,
+static MR_bool MR_trace_options_confirmed(MR_bool *confirmed,
char ***words, int *word_count, const char *cat,
const char *item);
+static MR_bool MR_trace_options_format(MR_Browse_Format *format,
+ MR_bool *xml, char ***words, int *word_count,
+ const char *cat, const char *item);
static MR_bool MR_trace_options_param_set(MR_Word *print_set,
MR_Word *browse_set, MR_Word *print_all_set,
MR_Word *flat_format, MR_Word *raw_pretty_format,
@@ -578,8 +585,7 @@
const MR_Proc_Layout *entry_layout);
static int MR_trace_var_print_list(MR_Spy_Print_List print_list);
-static const MR_Proc_Layout *
- MR_find_single_matching_proc(MR_Proc_Spec *spec,
+static const MR_Proc_Layout *MR_find_single_matching_proc(MR_Proc_Spec *spec,
MR_bool verbose);
/*
@@ -649,7 +655,8 @@
MR_TypeClassDeclInfo *type_class_decl_info,
MR_bool print_methods, MR_bool print_instances);
/* Print the given pseudo-typeinfo. */
-static void MR_print_pseudo_type_info(FILE *fp, MR_PseudoTypeInfo pseudo);
+static void MR_print_pseudo_type_info(FILE *fp,
+ MR_PseudoTypeInfo pseudo);
static void MR_trace_set_level_and_report(int ancestor_level,
MR_bool detailed, MR_bool print_optionals);
@@ -674,15 +681,16 @@
MR_Browse_Caller_Type caller, MR_Browse_Format format);
static const char *MR_trace_read_help_text(void);
-static const char *MR_trace_parse_line(char *line,
- char ***words, int *word_max, int *word_count);
+static const char *MR_trace_parse_line(char *line, char ***words,
+ int *word_max, int *word_count);
static const char *MR_trace_break_into_words(char *line, char ***words_ptr,
int *word_max_ptr, int *word_count_ptr);
static const char *MR_trace_break_off_one_word(char *line, int char_pos,
int *new_char_pos_ptr);
static void MR_trace_expand_aliases(char ***words,
int *word_max, int *word_count);
-static MR_bool MR_trace_source(const char *filename, MR_bool ignore_errors);
+static MR_bool MR_trace_source(const char *filename,
+ MR_bool ignore_errors);
static void MR_trace_source_from_open_file(FILE *fp);
static char *MR_trace_getline_queue(void);
static MR_bool MR_trace_continue_line(char *ptr, MR_bool *quoted);
@@ -715,8 +723,7 @@
const char *prompt;
if (! interactive) {
- return MR_trace_event_internal_report(cmd, print_list,
- event_info);
+ return MR_trace_event_internal_report(cmd, print_list, event_info);
}
if (MR_trace_decl_mode != MR_TRACE_INTERACTIVE) {
@@ -799,7 +806,9 @@
if (filename == NULL) {
return default_file;
} else {
- FILE *f = fopen(filename, mode);
+ FILE *f;
+
+ f = fopen(filename, mode);
if (f == NULL) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err, "mdb: error opening `%s': %s\n",
@@ -840,21 +849,16 @@
** using MR_mdb_*_filename, or stdin, stdout
** and stderr.
*/
- MR_mdb_in_window =
- MR_trace_internal_create_mdb_window();
+ MR_mdb_in_window = MR_trace_internal_create_mdb_window();
if (! MR_mdb_in_window) {
- MR_mdb_warning(
- "Try `mdb --program-in-window' instead.\n");
+ MR_mdb_warning("Try `mdb --program-in-window' instead.\n");
}
}
if (! MR_mdb_in_window) {
- MR_mdb_in = MR_try_fopen(MR_mdb_in_filename,
- "r", stdin);
- MR_mdb_out = MR_try_fopen(MR_mdb_out_filename,
- "w", stdout);
- MR_mdb_err = MR_try_fopen(MR_mdb_err_filename,
- "w", stderr);
+ MR_mdb_in = MR_try_fopen(MR_mdb_in_filename, "r", stdin);
+ MR_mdb_out = MR_try_fopen(MR_mdb_out_filename, "w", stdout);
+ MR_mdb_err = MR_try_fopen(MR_mdb_err_filename, "w", stderr);
}
/* Ensure that MR_mdb_err is not buffered */
@@ -935,22 +939,19 @@
if (master_fd == -1 || grantpt(master_fd) == -1
|| unlockpt(master_fd) == -1)
{
- MR_mdb_perror(
- "error opening master pseudo-terminal for mdb window");
+ MR_mdb_perror("error opening master pseudo-terminal for mdb window");
close(master_fd);
return MR_FALSE;
}
if ((slave_name = ptsname(master_fd)) == NULL) {
- MR_mdb_perror(
- "error getting name of pseudo-terminal for mdb window");
+ MR_mdb_perror("error getting name of pseudo-terminal for mdb window");
close(master_fd);
return MR_FALSE;
}
slave_fd = open(slave_name, O_RDWR);
if (slave_fd == -1) {
close(master_fd);
- MR_mdb_perror(
- "opening slave pseudo-terminal for mdb window failed");
+ MR_mdb_perror("opening slave pseudo-terminal for mdb window failed");
return MR_FALSE;
}
@@ -1041,23 +1042,21 @@
*/
MR_get_signal_action(SIGALRM, &old_alarm_action,
"error retrieving alarm handler");
- MR_setup_signal_no_restart(SIGALRM,
- MR_trace_internal_alarm_handler, MR_FALSE,
- "error setting up alarm handler");
+ MR_setup_signal_no_restart(SIGALRM, MR_trace_internal_alarm_handler,
+ MR_FALSE, "error setting up alarm handler");
MR_got_alarm = MR_FALSE;
alarm(10); /* 10 second timeout */
while (1) {
char c;
int status;
+
status = read(slave_fd, &c, 1);
if (status == -1) {
if (MR_got_alarm) {
- MR_mdb_warning(
- "timeout starting mdb window");
+ MR_mdb_warning("timeout starting mdb window");
goto parent_error;
} else if (!MR_is_eintr(errno)) {
- MR_mdb_perror(
- "error reading from mdb window");
+ MR_mdb_perror("error reading from mdb window");
goto parent_error;
}
} else if (status == 0 || c == '\n') {
@@ -1078,32 +1077,27 @@
#endif
if ((out_fd = dup(slave_fd)) == -1) {
- MR_mdb_perror(
- "opening slave pseudo-terminal for xterm failed");
+ MR_mdb_perror("opening slave pseudo-terminal for xterm failed");
goto parent_error;
}
if ((err_fd = dup(slave_fd)) == -1) {
- MR_mdb_perror(
- "opening slave pseudo-terminal for xterm failed");
+ MR_mdb_perror("opening slave pseudo-terminal for xterm failed");
goto parent_error;
}
MR_mdb_in = fdopen(slave_fd, "r");
if (MR_mdb_in == NULL) {
- MR_mdb_perror(
- "opening slave pseudo-terminal for xterm failed");
+ MR_mdb_perror("opening slave pseudo-terminal for xterm failed");
goto parent_error;
}
MR_mdb_out = fdopen(out_fd, "w");
if (MR_mdb_out == NULL) {
- MR_mdb_perror(
- "opening slave pseudo-terminal for xterm failed");
+ MR_mdb_perror("opening slave pseudo-terminal for xterm failed");
goto parent_error;
}
MR_mdb_err = fdopen(err_fd, "w");
if (MR_mdb_err == NULL) {
- MR_mdb_perror(
- "opening slave pseudo-terminal for xterm failed");
+ MR_mdb_perror("opening slave pseudo-terminal for xterm failed");
goto parent_error;
}
@@ -1113,9 +1107,18 @@
parent_error:
MR_trace_internal_kill_mdb_window();
- if (MR_mdb_in) fclose(MR_mdb_in);
- if (MR_mdb_out) fclose(MR_mdb_out);
- if (MR_mdb_err) fclose(MR_mdb_err);
+ if (MR_mdb_in) {
+ fclose(MR_mdb_in);
+ }
+
+ if (MR_mdb_out) {
+ fclose(MR_mdb_out);
+ }
+
+ if (MR_mdb_err) {
+ fclose(MR_mdb_err);
+ }
+
close(slave_fd);
close(out_fd);
close(err_fd);
@@ -1124,8 +1127,7 @@
}
#else /* !MR_HAVE_OPEN, etc. */
- MR_mdb_warning(
- "Sorry, `mdb --window' not supported on this platform.\n");
+ MR_mdb_warning("Sorry, `mdb --window' not supported on this platform.\n");
return MR_FALSE;
#endif /* !MR_HAVE_OPEN, etc. */
}
@@ -1225,8 +1227,7 @@
** of the value of MR_context_position.
*/
- MR_print_call_trace_info(MR_mdb_out, entry,
- base_sp, base_curfr);
+ MR_print_call_trace_info(MR_mdb_out, entry, base_sp, base_curfr);
indent = 26;
} else {
indent = 5;
@@ -1259,16 +1260,14 @@
break;
default:
- MR_fatal_error("MR_trace_browse_internal:"
- " unknown caller type");
+ MR_fatal_error("MR_trace_browse_internal: unknown caller type");
}
}
static void
MR_trace_save_and_invoke_xml_browser(MR_Word browser_term)
{
- if (MR_xml_tmp_filename != NULL &&
- (!MR_streq(MR_xml_tmp_filename, ""))) {
+ if (MR_xml_tmp_filename != NULL && (!MR_streq(MR_xml_tmp_filename, ""))) {
MR_trace_save_term_xml(MR_xml_tmp_filename, browser_term);
} else {
fflush(MR_mdb_out);
@@ -1277,11 +1276,11 @@
}
if (MR_xml_browser_command != NULL &&
- (!MR_streq(MR_xml_browser_command, ""))) {
+ (!MR_streq(MR_xml_browser_command, "")))
+ {
if (system(MR_xml_browser_command) == -1) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "\nmdb: Error invoking XML browser using "
+ fprintf(MR_mdb_err, "\nmdb: Error invoking XML browser using "
"command:\n\"%s\"\n", MR_xml_browser_command);
}
} else {
@@ -1314,13 +1313,11 @@
break;
case MR_BROWSE_CALLER_PRINT:
- MR_trace_print_goal(name, arg_list, is_func,
- caller, format);
+ MR_trace_print_goal(name, arg_list, is_func, caller, format);
break;
case MR_BROWSE_CALLER_PRINT_ALL:
- MR_fatal_error("MR_trace_browse_goal_internal:"
- " bad caller type");
+ MR_fatal_error("MR_trace_browse_goal_internal: bad caller type");
default:
MR_fatal_error("MR_trace_browse_goal_internal:"
@@ -1335,7 +1332,6 @@
MR_Word browser_term;
browser_term = MR_synthetic_to_browser_term(name, arg_list, is_func);
-
MR_trace_save_and_invoke_xml_browser(browser_term);
}
@@ -1398,7 +1394,9 @@
static void
MR_mdb_print_proc_id_and_nl(void *data, const MR_Proc_Layout *entry_layout)
{
- FILE *fp = data;
+ FILE *fp;
+
+ fp = (FILE *) data;
MR_print_proc_id_and_nl(fp, entry_layout);
}
@@ -1419,29 +1417,24 @@
switch (node->p_what) {
case MR_SPY_PRINT_ALL:
problem = MR_trace_browse_all(MR_mdb_out,
- MR_trace_browse_internal,
- node->p_format);
+ MR_trace_browse_internal, node->p_format);
break;
case MR_SPY_PRINT_GOAL:
problem = MR_trace_browse_one_goal(MR_mdb_out,
- MR_trace_browse_goal_internal,
- MR_BROWSE_CALLER_PRINT,
+ MR_trace_browse_goal_internal, MR_BROWSE_CALLER_PRINT,
node->p_format);
break;
case MR_SPY_PRINT_ONE:
- problem = MR_trace_parse_browse_one(MR_mdb_out,
- MR_TRUE, node->p_name,
- MR_trace_browse_internal,
- MR_BROWSE_CALLER_PRINT, node->p_format,
- MR_FALSE);
+ problem = MR_trace_parse_browse_one(MR_mdb_out, MR_TRUE,
+ node->p_name, MR_trace_browse_internal,
+ MR_BROWSE_CALLER_PRINT, node->p_format, MR_FALSE);
if (problem != NULL && MR_streq(problem,
"there is no such variable"))
{
if (node->p_warn) {
- problem = "there is no "
- "variable named";
+ problem = "there is no variable named";
after_problem = node->p_name;
} else {
problem = NULL;
@@ -1514,8 +1507,8 @@
/*
** Call the command dispatcher
*/
- next = MR_trace_handle_cmd(words, word_count, cmd,
- event_info, event_details, jumpaddr);
+ next = MR_trace_handle_cmd(words, word_count, cmd, event_info,
+ event_details, jumpaddr);
}
MR_free(line);
@@ -1577,8 +1570,7 @@
cmd->MR_trace_cmd = MR_CMD_GOTO;
cmd->MR_trace_stop_event = MR_trace_event_number + 1;
return STOP_INTERACTING;
- } else if (word_count == 2
- && MR_trace_is_natural_number(words[1], &n))
+ } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n))
{
cmd->MR_trace_cmd = MR_CMD_GOTO;
cmd->MR_trace_stop_event = MR_trace_event_number + n;
@@ -1613,8 +1605,7 @@
} else {
/* XXX this message is misleading */
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "The debugger cannot go "
- "to a past event.\n");
+ fprintf(MR_mdb_err, "The debugger cannot go to a past event.\n");
}
} else {
MR_trace_usage("forward", "goto");
@@ -1628,10 +1619,11 @@
MR_Event_Info *event_info, MR_Event_Details *event_details,
MR_Code **jumpaddr)
{
- MR_Unsigned depth = event_info->MR_call_depth;
+ MR_Unsigned depth;
int stop_depth;
int n;
+ depth = event_info->MR_call_depth;
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_default_print_level;
MR_init_trace_check_integrity(cmd);
@@ -1650,9 +1642,7 @@
return KEEP_INTERACTING;
}
- if (depth == stop_depth &&
- MR_port_is_final(event_info->MR_trace_port))
- {
+ if (depth == stop_depth && MR_port_is_final(event_info->MR_trace_port)) {
MR_trace_do_noop();
} else {
cmd->MR_trace_cmd = MR_CMD_NEXT;
@@ -1668,10 +1658,11 @@
MR_Event_Info *event_info, MR_Event_Details *event_details,
MR_Code **jumpaddr)
{
- MR_Unsigned depth = event_info->MR_call_depth;
+ MR_Unsigned depth;
int stop_depth;
int n;
+ depth = event_info->MR_call_depth;
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_default_print_level;
MR_init_trace_check_integrity(cmd);
@@ -1680,8 +1671,7 @@
{
; /* the usage message has already been printed */
return KEEP_INTERACTING;
- } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n))
- {
+ } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
stop_depth = depth - n;
} else if (word_count == 1) {
stop_depth = depth;
@@ -1690,9 +1680,7 @@
return KEEP_INTERACTING;
}
- if (depth == stop_depth &&
- MR_port_is_final(event_info->MR_trace_port))
- {
+ if (depth == stop_depth && MR_port_is_final(event_info->MR_trace_port)) {
MR_trace_do_noop();
} else {
cmd->MR_trace_cmd = MR_CMD_FINISH;
@@ -1724,8 +1712,7 @@
{
; /* the usage message has already been printed */
return KEEP_INTERACTING;
- } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n))
- {
+ } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
stop_depth = depth - n;
} else if (word_count == 1) {
stop_depth = depth;
@@ -1736,23 +1723,19 @@
if (MR_DETISM_DET_STACK(detism)) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: cannot continue until failure: "
+ fprintf(MR_mdb_err, "mdb: cannot continue until failure: "
"selected procedure has determinism %s.\n",
MR_detism_names[detism]);
return KEEP_INTERACTING;
}
- if (depth == stop_depth &&
- event_info->MR_trace_port == MR_PORT_FAIL)
- {
+ if (depth == stop_depth && event_info->MR_trace_port == MR_PORT_FAIL) {
MR_trace_do_noop();
} else if (depth == stop_depth &&
event_info->MR_trace_port == MR_PORT_EXCEPTION)
{
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: cannot continue until failure: "
+ fprintf(MR_mdb_err, "mdb: cannot continue until failure: "
"the call has raised an exception.\n");
} else {
cmd->MR_trace_cmd = MR_CMD_FAIL;
@@ -1828,7 +1811,9 @@
{
; /* the usage message has already been printed */
} else if (word_count == 1) {
- MR_Trace_Port port = event_info->MR_trace_port;
+ MR_Trace_Port port;
+
+ port = event_info->MR_trace_port;
if (port == MR_PORT_FAIL ||
port == MR_PORT_REDO ||
port == MR_PORT_EXCEPTION)
@@ -1919,11 +1904,9 @@
** select the intelligent default.
*/
if (cmd->MR_trace_strict) {
- cmd->MR_trace_print_level =
- MR_PRINT_LEVEL_NONE;
+ cmd->MR_trace_print_level = MR_PRINT_LEVEL_NONE;
} else {
- cmd->MR_trace_print_level =
- MR_PRINT_LEVEL_SOME;
+ cmd->MR_trace_print_level = MR_PRINT_LEVEL_SOME;
}
}
return STOP_INTERACTING;
@@ -1952,9 +1935,7 @@
&words, &word_count, "backward", "retry"))
{
; /* the usage message has already been printed */
- } else if (word_count == 2 &&
- MR_trace_is_natural_number(words[1], &n))
- {
+ } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
ancestor_level = n;
} else if (word_count == 1) {
ancestor_level = 0;
@@ -1963,15 +1944,14 @@
return KEEP_INTERACTING;
}
- if (ancestor_level == 0 && MR_port_is_entry(event_info->MR_trace_port))
- {
+ if (ancestor_level == 0 && MR_port_is_entry(event_info->MR_trace_port)) {
MR_trace_do_noop();
return KEEP_INTERACTING;
}
- result = MR_trace_retry(event_info, event_details,
- ancestor_level, across_io, assume_all_io_is_tabled,
- &problem, MR_mdb_in, MR_mdb_out, jumpaddr);
+ result = MR_trace_retry(event_info, event_details, ancestor_level,
+ across_io, assume_all_io_is_tabled, &problem, MR_mdb_in, MR_mdb_out,
+ jumpaddr);
switch (result) {
case MR_RETRY_OK_DIRECT:
@@ -1983,8 +1963,7 @@
case MR_RETRY_OK_FINISH_FIRST:
cmd->MR_trace_cmd = MR_CMD_FINISH;
- cmd->MR_trace_stop_depth = event_info->MR_call_depth
- - ancestor_level;
+ cmd->MR_trace_stop_depth = event_info->MR_call_depth - ancestor_level;
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_PRINT_LEVEL_NONE;
@@ -1995,8 +1974,7 @@
case MR_RETRY_OK_FAIL_FIRST:
cmd->MR_trace_cmd = MR_CMD_FAIL;
- cmd->MR_trace_stop_depth = event_info->MR_call_depth
- - ancestor_level;
+ cmd->MR_trace_stop_depth = event_info->MR_call_depth - ancestor_level;
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_PRINT_LEVEL_NONE;
@@ -2023,15 +2001,12 @@
MR_bool detailed;
detailed = MR_FALSE;
- if (! MR_trace_options_detailed(&detailed,
- &words, &word_count, "browsing", "level"))
+ if (! MR_trace_options_detailed(&detailed, &words, &word_count,
+ "browsing", "level"))
{
; /* the usage message has already been printed */
- } else if (word_count == 2 &&
- MR_trace_is_natural_number(words[1], &n))
- {
- MR_trace_set_level_and_report(n, detailed,
- MR_print_optionals);
+ } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
+ MR_trace_set_level_and_report(n, detailed, MR_print_optionals);
} else {
MR_trace_usage("browsing", "level");
}
@@ -2048,19 +2023,15 @@
MR_bool detailed;
detailed = MR_FALSE;
- if (! MR_trace_options_detailed(&detailed,
- &words, &word_count, "browsing", "up"))
+ if (! MR_trace_options_detailed(&detailed, &words, &word_count,
+ "browsing", "up"))
{
; /* the usage message has already been printed */
- } else if (word_count == 2 &&
- MR_trace_is_natural_number(words[1], &n))
- {
- MR_trace_set_level_and_report(
- MR_trace_current_level() + n, detailed,
+ } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
+ MR_trace_set_level_and_report(MR_trace_current_level() + n, detailed,
MR_print_optionals);
} else if (word_count == 1) {
- MR_trace_set_level_and_report(
- MR_trace_current_level() + 1, detailed,
+ MR_trace_set_level_and_report(MR_trace_current_level() + 1, detailed,
MR_print_optionals);
} else {
MR_trace_usage("browsing", "up");
@@ -2078,19 +2049,15 @@
MR_bool detailed;
detailed = MR_FALSE;
- if (! MR_trace_options_detailed(&detailed,
- &words, &word_count, "browsing", "down"))
+ if (! MR_trace_options_detailed(&detailed, &words, &word_count,
+ "browsing", "down"))
{
; /* the usage message has already been printed */
- } else if (word_count == 2 &&
- MR_trace_is_natural_number(words[1], &n))
- {
- MR_trace_set_level_and_report(
- MR_trace_current_level() - n, detailed,
+ } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
+ MR_trace_set_level_and_report(MR_trace_current_level() - n, detailed,
MR_print_optionals);
} else if (word_count == 1) {
- MR_trace_set_level_and_report(
- MR_trace_current_level() - 1, detailed,
+ MR_trace_set_level_and_report(MR_trace_current_level() - 1, detailed,
MR_print_optionals);
} else {
MR_trace_usage("browsing", "down");
@@ -2154,20 +2121,16 @@
MR_trace_browse_internal, format);
} else if (MR_streq(words[1], "goal")) {
problem = MR_trace_browse_one_goal(MR_mdb_out,
- MR_trace_browse_goal_internal,
- MR_BROWSE_CALLER_PRINT, format);
+ MR_trace_browse_goal_internal, MR_BROWSE_CALLER_PRINT, format);
} else if (MR_streq(words[1], "exception")) {
problem = MR_trace_browse_exception(event_info,
- MR_trace_browse_internal,
- MR_BROWSE_CALLER_PRINT, format);
+ MR_trace_browse_internal, MR_BROWSE_CALLER_PRINT, format);
} else if (MR_streq(words[1], "proc_body")) {
problem = MR_trace_browse_proc_body(event_info,
- MR_trace_browse_internal,
- MR_BROWSE_CALLER_PRINT, format);
+ MR_trace_browse_internal, MR_BROWSE_CALLER_PRINT, format);
} else {
- problem = MR_trace_parse_browse_one(MR_mdb_out,
- MR_TRUE, words[1], MR_trace_browse_internal,
- MR_BROWSE_CALLER_PRINT, format,
+ problem = MR_trace_parse_browse_one(MR_mdb_out, MR_TRUE, words[1],
+ MR_trace_browse_internal, MR_BROWSE_CALLER_PRINT, format,
MR_FALSE);
}
@@ -2218,11 +2181,11 @@
goal_browser = MR_trace_browse_goal_internal;
browser = MR_trace_browse_internal;
}
+
if (word_count == 1) {
const char *problem;
- problem = MR_trace_browse_one_goal(MR_mdb_out,
- goal_browser,
+ problem = MR_trace_browse_one_goal(MR_mdb_out, goal_browser,
MR_BROWSE_CALLER_BROWSE, format);
if (problem != NULL) {
@@ -2233,21 +2196,17 @@
const char *problem;
if (MR_streq(words[1], "goal")) {
- problem = MR_trace_browse_one_goal(MR_mdb_out,
- goal_browser, MR_BROWSE_CALLER_BROWSE,
- format);
+ problem = MR_trace_browse_one_goal(MR_mdb_out, goal_browser,
+ MR_BROWSE_CALLER_BROWSE, format);
} else if (MR_streq(words[1], "exception")) {
- problem = MR_trace_browse_exception(event_info,
- browser, MR_BROWSE_CALLER_BROWSE,
- format);
+ problem = MR_trace_browse_exception(event_info, browser,
+ MR_BROWSE_CALLER_BROWSE, format);
} else if (MR_streq(words[1], "proc_body")) {
- problem = MR_trace_browse_proc_body(event_info,
- browser, MR_BROWSE_CALLER_BROWSE,
- format);
+ problem = MR_trace_browse_proc_body(event_info, browser,
+ MR_BROWSE_CALLER_BROWSE, format);
} else {
- problem = MR_trace_parse_browse_one(MR_mdb_out,
- MR_FALSE, words[1], browser,
- MR_BROWSE_CALLER_BROWSE, format,
+ problem = MR_trace_parse_browse_one(MR_mdb_out, MR_FALSE,
+ words[1], browser, MR_BROWSE_CALLER_BROWSE, format,
MR_TRUE);
}
@@ -2260,9 +2219,8 @@
{
const char *problem;
- problem = MR_trace_browse_action(MR_mdb_out, n,
- goal_browser, MR_BROWSE_CALLER_BROWSE,
- format);
+ problem = MR_trace_browse_action(MR_mdb_out, n, goal_browser,
+ MR_BROWSE_CALLER_BROWSE, format);
if (problem != NULL) {
fflush(MR_mdb_out);
@@ -2292,13 +2250,12 @@
{
; /* the usage message has already been printed */
} else if (word_count == 1) {
- MR_trace_cmd_stack_2(event_info, detailed,
- frame_limit, line_limit);
+ MR_trace_cmd_stack_2(event_info, detailed, frame_limit, line_limit);
} else if (word_count == 2 &&
MR_trace_is_natural_number(words[1], &spec_line_limit))
{
- MR_trace_cmd_stack_2(event_info, detailed,
- frame_limit, spec_line_limit);
+ MR_trace_cmd_stack_2(event_info, detailed, frame_limit,
+ spec_line_limit);
} else {
MR_trace_usage("browsing", "stack");
}
@@ -2359,33 +2316,30 @@
if (word_count == 3 && MR_streq(words[1], "xml_browser_cmd")) {
if (MR_xml_browser_command == NULL) {
- MR_xml_browser_command =
- (char*)malloc(strlen(words[2]) + 1);
+ MR_xml_browser_command = (char*) malloc(strlen(words[2]) + 1);
} else {
- MR_xml_browser_command = (char*)realloc(
- MR_xml_browser_command, strlen(words[2]) + 1);
+ MR_xml_browser_command = (char*) realloc(MR_xml_browser_command,
+ strlen(words[2]) + 1);
}
strcpy(MR_xml_browser_command, words[2]);
} else if (word_count == 3 && MR_streq(words[1], "xml_tmp_filename")) {
if (MR_xml_tmp_filename == NULL) {
- MR_xml_tmp_filename =
- (char*)malloc(strlen(words[2]) + 1);
+ MR_xml_tmp_filename = (char*) malloc(strlen(words[2]) + 1);
} else {
- MR_xml_tmp_filename = (char*)realloc(
- MR_xml_tmp_filename, strlen(words[2]) + 1);
+ MR_xml_tmp_filename = (char*) realloc(MR_xml_tmp_filename,
+ strlen(words[2]) + 1);
}
strcpy(MR_xml_tmp_filename, words[2]);
} else if (! MR_trace_options_param_set(&print_set, &browse_set,
- &print_all_set, &flat_format, &raw_pretty_format,
- &verbose_format, &pretty_format, &words, &word_count,
- "parameter", "set"))
+ &print_all_set, &flat_format, &raw_pretty_format, &verbose_format,
+ &pretty_format, &words, &word_count, "parameter", "set"))
{
; /* the usage message has already been printed */
}
else if (word_count != 3 ||
- ! MR_trace_set_browser_param(print_set, browse_set,
- print_all_set, flat_format, raw_pretty_format,
- verbose_format, pretty_format, words[1], words[2]))
+ ! MR_trace_set_browser_param(print_set, browse_set, print_all_set,
+ flat_format, raw_pretty_format, verbose_format, pretty_format,
+ words[1], words[2]))
{
MR_trace_usage("parameter", "set");
}
@@ -2409,8 +2363,8 @@
const char *msg;
if (! MR_trace_options_view(&window_cmd, &server_cmd, &server_name,
- &timeout, &force, &verbose, &split, &close_window,
- &words, &word_count, "browsing", "view"))
+ &timeout, &force, &verbose, &split, &close_window, &words, &word_count,
+ "browsing", "view"))
{
; /* the usage message has already been printed */
} else if (word_count != 1) {
@@ -2418,8 +2372,8 @@
} else if (close_window) {
MR_trace_maybe_close_source_window(verbose);
} else {
- msg = MR_trace_new_source_window(window_cmd, server_cmd,
- server_name, timeout, force, verbose, split);
+ msg = MR_trace_new_source_window(window_cmd, server_cmd, server_name,
+ timeout, force, verbose, split);
if (msg != NULL) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err, "mdb: %s.\n", msg);
@@ -2454,10 +2408,9 @@
MR_bool is_func;
problem = NULL;
- MR_convert_goal_to_synthetic_term(&name, &arg_list,
- &is_func);
- browser_term = MR_synthetic_to_browser_term(name,
- arg_list, is_func);
+ MR_convert_goal_to_synthetic_term(&name, &arg_list, &is_func);
+ browser_term = MR_synthetic_to_browser_term(name, arg_list,
+ is_func);
} else if (MR_streq(words[1], "exception")) {
MR_Word exception;
@@ -2465,8 +2418,7 @@
if (exception == (MR_Word) NULL) {
problem = "missing exception value";
} else {
- browser_term = MR_univ_to_browser_term(
- exception);
+ browser_term = MR_univ_to_browser_term(exception);
}
} else if (MR_streq(words[1], "proc_body")) {
const MR_Proc_Layout *entry;
@@ -2488,8 +2440,7 @@
problem = MR_convert_var_spec_to_type_value(var_spec,
&type_info, &value);
if (problem == NULL) {
- browser_term = MR_type_value_to_browser_term(
- type_info, value);
+ browser_term = MR_type_value_to_browser_term(type_info, value);
}
}
@@ -2541,8 +2492,7 @@
}
if (count == 0) {
- fprintf(MR_mdb_out,
- "There are no break points.\n");
+ fprintf(MR_mdb_out, "There are no break points.\n");
}
return KEEP_INTERACTING;
@@ -2568,8 +2518,7 @@
MR_Trace_Port port;
port = event_info->MR_trace_port;
- if (ignore_count > 0 &&
- ignore_when == MR_SPY_IGNORE_ENTRY &&
+ if (ignore_count > 0 && ignore_when == MR_SPY_IGNORE_ENTRY &&
! MR_port_is_entry(port))
{
fprintf(MR_mdb_out, "That breakpoint "
@@ -2585,10 +2534,8 @@
}
MR_register_all_modules_and_procs(MR_mdb_out, MR_TRUE);
- slot = MR_add_proc_spy_point(MR_SPY_SPECIFIC, action,
- ignore_when, ignore_count,
- layout->MR_sll_entry, layout, print_list,
- &problem);
+ slot = MR_add_proc_spy_point(MR_SPY_SPECIFIC, action, ignore_when,
+ ignore_count, layout->MR_sll_entry, layout, print_list, &problem);
MR_maybe_print_spy_point(slot, problem);
} else if (word_count == 2 && MR_parse_proc_spec(words[1], &spec)) {
MR_Matches_Info matches;
@@ -2598,25 +2545,20 @@
matches = MR_search_for_matching_procedures(&spec);
if (matches.match_proc_next == 0) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: there is no such procedure.\n");
+ fprintf(MR_mdb_err, "mdb: there is no such procedure.\n");
} else if (matches.match_proc_next == 1) {
- slot = MR_add_proc_spy_point(when, action,
- ignore_when, ignore_count,
- matches.match_procs[0], NULL, print_list,
+ slot = MR_add_proc_spy_point(when, action, ignore_when,
+ ignore_count, matches.match_procs[0], NULL, print_list,
&problem);
MR_maybe_print_spy_point(slot, problem);
} else if (multi_match == MR_MULTIMATCH_ALL) {
int i;
for (i = 0; i < matches.match_proc_next; i++) {
- slot = MR_add_proc_spy_point(
- when, action,
- ignore_when, ignore_count,
- matches.match_procs[i], NULL,
- print_list, &problem);
- MR_maybe_print_spy_point(slot,
- problem);
+ slot = MR_add_proc_spy_point(when, action, ignore_when,
+ ignore_count, matches.match_procs[i], NULL, print_list,
+ &problem);
+ MR_maybe_print_spy_point(slot, problem);
}
} else {
char buf[80];
@@ -2625,13 +2567,12 @@
fflush(MR_mdb_out);
fprintf(MR_mdb_err,
- "Ambiguous procedure specification. "
- "The matches are:\n");
+ "Ambiguous procedure specification. The matches are:\n");
+
for (i = 0; i < matches.match_proc_next; i++)
{
fprintf(MR_mdb_out, "%d: ", i);
- MR_print_proc_id_and_nl(MR_mdb_out,
- matches.match_procs[i]);
+ MR_print_proc_id_and_nl(MR_mdb_out, matches.match_procs[i]);
}
if (multi_match == MR_MULTIMATCH_ONE) {
@@ -2641,42 +2582,27 @@
sprintf(buf, "\nWhich do you want to put "
"a breakpoint on (0-%d or *)? ",
matches.match_proc_next - 1);
- line2 = MR_trace_getline(buf,
- MR_mdb_in, MR_mdb_out);
+ line2 = MR_trace_getline(buf, MR_mdb_in, MR_mdb_out);
if (line2 == NULL) {
/* This means the user input EOF. */
fprintf(MR_mdb_out, "none of them\n");
} else if (MR_streq(line2, "*")) {
- for (i = 0;
- i < matches.match_proc_next;
- i++)
- {
- slot = MR_add_proc_spy_point(
- when, action,
- ignore_when,
- ignore_count,
- matches.match_procs[i],
- NULL, print_list, &problem);
- MR_maybe_print_spy_point(
- slot, problem);
+ for (i = 0; i < matches.match_proc_next; i++) {
+ slot = MR_add_proc_spy_point(when, action, ignore_when,
+ ignore_count, matches.match_procs[i], NULL, print_list,
+ &problem);
+ MR_maybe_print_spy_point(slot, problem);
}
MR_free(line2);
} else if (MR_trace_is_natural_number(line2, &i)) {
- if (0 <= i &&
- i < matches.match_proc_next)
- {
- slot = MR_add_proc_spy_point(
- when, action,
- ignore_when,
- ignore_count,
- matches.match_procs[i],
- NULL, print_list, &problem);
- MR_maybe_print_spy_point(
- slot, problem);
+ if (0 <= i && i < matches.match_proc_next) {
+ slot = MR_add_proc_spy_point(when, action, ignore_when,
+ ignore_count, matches.match_procs[i], NULL, print_list,
+ &problem);
+ MR_maybe_print_spy_point(slot, problem);
} else {
- fprintf(MR_mdb_out,
- "no such match\n");
+ fprintf(MR_mdb_out, "no such match\n");
}
MR_free(line2);
} else {
@@ -2689,8 +2615,8 @@
{
int slot;
- slot = MR_add_line_spy_point(action, ignore_when,
- ignore_count, file, line, print_list, &problem);
+ slot = MR_add_line_spy_point(action, ignore_when, ignore_count, file,
+ line, print_list, &problem);
MR_maybe_print_spy_point(slot, problem);
} else if (word_count == 2 &&
MR_trace_is_natural_number(words[1], &breakline))
@@ -2698,8 +2624,7 @@
int slot;
if (MR_find_context(layout, &file, &line)) {
- slot = MR_add_line_spy_point(action,
- ignore_when, ignore_count,
+ slot = MR_add_line_spy_point(action, ignore_when, ignore_count,
file, breakline, print_list, &problem);
MR_maybe_print_spy_point(slot, problem);
} else {
@@ -2730,17 +2655,12 @@
; /* the usage message has already been printed */
} else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n))
{
- if (0 <= n && n < MR_spy_point_next
- && MR_spy_points[n]->spy_exists)
- {
- problem = MR_ignore_spy_point(n, ignore_when,
- ignore_count);
+ if (0 <= n && n < MR_spy_point_next && MR_spy_points[n]->spy_exists) {
+ problem = MR_ignore_spy_point(n, ignore_when, ignore_count);
MR_maybe_print_spy_point(n, problem);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: break point #%d "
- "does not exist.\n",
- n);
+ fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
}
} else if (word_count == 2 && MR_streq(words[1], "*")) {
int i;
@@ -2749,31 +2669,26 @@
count = 0;
for (i = 0; i < MR_spy_point_next; i++) {
if (MR_spy_points[i]->spy_exists) {
- problem = MR_ignore_spy_point(n,
- ignore_when, ignore_count);
+ problem = MR_ignore_spy_point(n, ignore_when, ignore_count);
MR_maybe_print_spy_point(n, problem);
count++;
}
}
if (count == 0) {
- fprintf(MR_mdb_err,
- "There are no break points.\n");
+ fprintf(MR_mdb_err, "There are no break points.\n");
}
} else if (word_count == 1) {
if (0 <= MR_most_recent_spy_point
&& MR_most_recent_spy_point < MR_spy_point_next
- && MR_spy_points[MR_most_recent_spy_point]->
- spy_exists)
+ && MR_spy_points[MR_most_recent_spy_point]->spy_exists)
{
n = MR_most_recent_spy_point;
- problem = MR_ignore_spy_point(n, ignore_when,
- ignore_count);
+ problem = MR_ignore_spy_point(n, ignore_when, ignore_count);
MR_maybe_print_spy_point(n, problem);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: there is no "
- "most recent break point.\n");
+ fprintf(MR_mdb_err, "mdb: there is no most recent break point.\n");
}
} else {
MR_trace_usage("breakpoint", "ignore");
@@ -2808,24 +2723,20 @@
{
print_list = NULL;
for (i = 2; i < word_count; i++) {
- print_list = MR_add_to_print_list_end(format,
- words[i], warn, print_list);
+ print_list = MR_add_to_print_list_end(format, words[i], warn,
+ print_list);
}
if (at_start) {
- MR_add_spy_point_print_list_start(n,
- print_list);
+ MR_add_spy_point_print_list_start(n, print_list);
} else {
- MR_add_spy_point_print_list_end(n,
- print_list);
+ MR_add_spy_point_print_list_end(n, print_list);
}
MR_print_spy_point(MR_mdb_out, n, MR_TRUE);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: break point #%d "
- "does not exist.\n",
- n);
+ fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
}
} else {
MR_trace_usage("breakpoint", "break_print");
@@ -2881,16 +2792,12 @@
int n;
if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
- if (0 <= n && n < MR_spy_point_next
- && MR_spy_points[n]->spy_exists)
- {
+ if (0 <= n && n < MR_spy_point_next && MR_spy_points[n]->spy_exists) {
MR_spy_points[n]->spy_enabled = MR_TRUE;
MR_print_spy_point(MR_mdb_out, n, MR_FALSE);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: break point #%d "
- "does not exist.\n",
- n);
+ fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
}
} else if (word_count == 2 && MR_streq(words[1], "*")) {
int i;
@@ -2906,23 +2813,18 @@
}
if (count == 0) {
- fprintf(MR_mdb_err,
- "There are no break points.\n");
+ fprintf(MR_mdb_err, "There are no break points.\n");
}
} else if (word_count == 1) {
if (0 <= MR_most_recent_spy_point
&& MR_most_recent_spy_point < MR_spy_point_next
- && MR_spy_points[MR_most_recent_spy_point]->
- spy_exists)
+ && MR_spy_points[MR_most_recent_spy_point]->spy_exists)
{
- MR_spy_points[MR_most_recent_spy_point]
- ->spy_enabled = MR_TRUE;
- MR_print_spy_point(MR_mdb_out,
- MR_most_recent_spy_point, MR_FALSE);
+ MR_spy_points[MR_most_recent_spy_point]->spy_enabled = MR_TRUE;
+ MR_print_spy_point(MR_mdb_out, MR_most_recent_spy_point, MR_FALSE);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: there is no "
- "most recent break point.\n");
+ fprintf(MR_mdb_err, "mdb: there is no most recent break point.\n");
}
} else {
MR_trace_usage("breakpoint", "enable");
@@ -2939,16 +2841,12 @@
int n;
if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
- if (0 <= n && n < MR_spy_point_next
- && MR_spy_points[n]->spy_exists)
- {
+ if (0 <= n && n < MR_spy_point_next && MR_spy_points[n]->spy_exists) {
MR_spy_points[n]->spy_enabled = MR_FALSE;
MR_print_spy_point(MR_mdb_out, n, MR_FALSE);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: break point #%d "
- "does not exist.\n",
- n);
+ fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
}
} else if (word_count == 2 && MR_streq(words[1], "*")) {
int i;
@@ -2957,8 +2855,7 @@
count = 0;
for (i = 0; i < MR_spy_point_next; i++) {
if (MR_spy_points[i]->spy_exists) {
- MR_spy_points[i]->spy_enabled =
- MR_FALSE;
+ MR_spy_points[i]->spy_enabled = MR_FALSE;
MR_print_spy_point(MR_mdb_out, i, MR_FALSE);
count++;
}
@@ -2966,23 +2863,18 @@
if (count == 0) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "There are no break points.\n");
+ fprintf(MR_mdb_err, "There are no break points.\n");
}
} else if (word_count == 1) {
if (0 <= MR_most_recent_spy_point
&& MR_most_recent_spy_point < MR_spy_point_next
- && MR_spy_points[MR_most_recent_spy_point]->
- spy_exists)
+ && MR_spy_points[MR_most_recent_spy_point]->spy_exists)
{
- MR_spy_points[MR_most_recent_spy_point]
- ->spy_enabled = MR_FALSE;
- MR_print_spy_point(MR_mdb_out,
- MR_most_recent_spy_point, MR_FALSE);
+ MR_spy_points[MR_most_recent_spy_point]->spy_enabled = MR_FALSE;
+ MR_print_spy_point(MR_mdb_out, MR_most_recent_spy_point, MR_FALSE);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "There is no "
- "most recent break point.\n");
+ fprintf(MR_mdb_err, "There is no most recent break point.\n");
}
} else {
MR_trace_usage("breakpoint", "disable");
@@ -2999,17 +2891,13 @@
int n;
if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
- if (0 <= n && n < MR_spy_point_next
- && MR_spy_points[n]->spy_exists)
- {
+ if (0 <= n && n < MR_spy_point_next && MR_spy_points[n]->spy_exists) {
MR_spy_points[n]->spy_exists = MR_FALSE;
MR_print_spy_point(MR_mdb_out, n, MR_FALSE);
MR_delete_spy_point(n);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: break point #%d "
- "does not exist.\n",
- n);
+ fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
}
} else if (word_count == 2 && MR_streq(words[1], "*")) {
int i;
@@ -3027,14 +2915,12 @@
if (count == 0) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "There are no break points.\n");
+ fprintf(MR_mdb_err, "There are no break points.\n");
}
} else if (word_count == 1) {
if (0 <= MR_most_recent_spy_point
&& MR_most_recent_spy_point < MR_spy_point_next
- && MR_spy_points[MR_most_recent_spy_point]->
- spy_exists)
+ && MR_spy_points[MR_most_recent_spy_point]->spy_exists)
{
int slot;
@@ -3044,8 +2930,7 @@
MR_delete_spy_point(slot);
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: there is no "
- "most recent break point.\n");
+ fprintf(MR_mdb_err, "mdb: there is no most recent break point.\n");
}
} else {
MR_trace_usage("breakpoint", "delete");
@@ -3109,9 +2994,7 @@
MR_Event_Info *event_info, MR_Event_Details *event_details,
MR_Code **jumpaddr)
{
- MR_trace_query(MR_NORMAL_QUERY, MR_mmc_options,
- word_count - 1, words + 1);
-
+ MR_trace_query(MR_NORMAL_QUERY, MR_mmc_options, word_count - 1, words + 1);
return KEEP_INTERACTING;
}
@@ -3120,9 +3003,7 @@
MR_Event_Info *event_info, MR_Event_Details *event_details,
MR_Code **jumpaddr)
{
- MR_trace_query(MR_CC_QUERY, MR_mmc_options,
- word_count - 1, words + 1);
-
+ MR_trace_query(MR_CC_QUERY, MR_mmc_options, word_count - 1, words + 1);
return KEEP_INTERACTING;
}
@@ -3131,9 +3012,7 @@
MR_Event_Info *event_info, MR_Event_Details *event_details,
MR_Code **jumpaddr)
{
- MR_trace_query(MR_IO_QUERY, MR_mmc_options,
- word_count - 1, words + 1);
-
+ MR_trace_query(MR_IO_QUERY, MR_mmc_options, word_count - 1, words + 1);
return KEEP_INTERACTING;
}
@@ -3146,27 +3025,20 @@
if (MR_streq(words[1], "none")) {
MR_default_print_level = MR_PRINT_LEVEL_NONE;
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out,
- "Default print level set to "
- "`none'.\n");
+ fprintf(MR_mdb_out, "Default print level set to `none'.\n");
}
} else if (MR_streq(words[1], "some")) {
MR_default_print_level = MR_PRINT_LEVEL_SOME;
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out,
- "Default print level set to "
- "`some'.\n");
+ fprintf(MR_mdb_out, "Default print level set to `some'.\n");
}
} else if (MR_streq(words[1], "all")) {
MR_default_print_level = MR_PRINT_LEVEL_ALL;
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out,
- "Default print level set to "
- "`all'.\n");
+ fprintf(MR_mdb_out, "Default print level set to `all'.\n");
}
} else {
- MR_trace_usage("parameter",
- "printlevel");
+ MR_trace_usage("parameter", "printlevel");
}
} else if (word_count == 1) {
fprintf(MR_mdb_out, "The default print level is ");
@@ -3181,10 +3053,8 @@
fprintf(MR_mdb_out, "`all'.\n");
break;
default:
- MR_default_print_level =
- MR_PRINT_LEVEL_SOME;
- fprintf(MR_mdb_out, "invalid "
- "(now set to `some').\n");
+ MR_default_print_level = MR_PRINT_LEVEL_SOME;
+ fprintf(MR_mdb_out, "invalid (now set to `some').\n");
break;
}
} else {
@@ -3232,21 +3102,18 @@
if (MR_streq(words[1], "off")) {
MR_scroll_control = MR_FALSE;
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out,
- "Scroll control disabled.\n");
+ fprintf(MR_mdb_out, "Scroll control disabled.\n");
}
} else if (MR_streq(words[1], "on")) {
MR_scroll_control = MR_TRUE;
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out,
- "Scroll control enabled.\n");
+ fprintf(MR_mdb_out, "Scroll control enabled.\n");
}
} else if (MR_trace_is_natural_number(words[1], &n)) {
MR_scroll_limit = n;
if (MR_trace_internal_interacting) {
fprintf(MR_mdb_out,
- "Scroll window size set to "
- "%d.\n", MR_scroll_limit);
+ "Scroll window size set to %d.\n", MR_scroll_limit);
}
} else {
MR_trace_usage("parameter", "scroll");
@@ -3258,8 +3125,7 @@
} else {
fprintf(MR_mdb_out, "off");
}
- fprintf(MR_mdb_out, ", scroll window size is %d.\n",
- MR_scroll_limit);
+ fprintf(MR_mdb_out, ", scroll window size is %d.\n", MR_scroll_limit);
} else {
MR_trace_usage("parameter", "scroll");
}
@@ -3283,20 +3149,18 @@
if (MR_stack_default_line_limit > 0) {
fprintf(MR_mdb_out,
- "Default stack dump size limit set to "
- "%d.\n", MR_stack_default_line_limit);
+ "Default stack dump size limit set to %d.\n",
+ MR_stack_default_line_limit);
} else {
fprintf(MR_mdb_out,
- "Default stack dump size limit set to "
- "none.\n");
+ "Default stack dump size limit set to none.\n");
}
} else {
MR_trace_usage("parameter", "stack_default_limit");
}
} else if (word_count == 1) {
if (MR_stack_default_line_limit > 0) {
- fprintf(MR_mdb_out,
- "Default stack dump size limit is %d.\n",
+ fprintf(MR_mdb_out, "Default stack dump size limit is %d.\n",
MR_stack_default_line_limit);
} else {
fprintf(MR_mdb_out,
@@ -3332,8 +3196,7 @@
if (MR_trace_internal_interacting) {
fprintf(MR_mdb_out, "%s\n",
- MR_context_set_msg[
- MR_context_position]);
+ MR_context_set_msg[MR_context_position]);
}
} else if (word_count == 1) {
switch (MR_context_position) {
@@ -3343,8 +3206,7 @@
case MR_CONTEXT_PREVLINE:
case MR_CONTEXT_NEXTLINE:
fprintf(MR_mdb_out, "%s\n",
- MR_context_report_msg[
- MR_context_position]);
+ MR_context_report_msg[MR_context_position]);
break;
default:
@@ -3365,12 +3227,10 @@
if (word_count == 2) {
if (MR_streq(words[1], "off")) {
MR_print_goal_paths = MR_FALSE;
- fprintf(MR_mdb_out,
- "Goal path printing is now off.\n");
+ fprintf(MR_mdb_out, "Goal path printing is now off.\n");
} else if (MR_streq(words[1], "on")) {
MR_print_goal_paths = MR_TRUE;
- fprintf(MR_mdb_out,
- "Goal path printing is now on.\n");
+ fprintf(MR_mdb_out, "Goal path printing is now on.\n");
} else {
MR_trace_usage("parameter", "goal_paths");
return KEEP_INTERACTING;
@@ -3407,8 +3267,7 @@
if (MR_trace_internal_interacting) {
fprintf(MR_mdb_out, "%s\n",
- MR_scope_set_msg[
- MR_default_breakpoint_scope]);
+ MR_scope_set_msg[MR_default_breakpoint_scope]);
}
} else if (word_count == 1) {
switch (MR_default_breakpoint_scope) {
@@ -3416,8 +3275,7 @@
case MR_SPY_INTERFACE:
case MR_SPY_ENTRY:
fprintf(MR_mdb_out, "%s\n",
- MR_scope_report_msg[
- MR_default_breakpoint_scope]);
+ MR_scope_report_msg[MR_default_breakpoint_scope]);
break;
default:
@@ -3440,23 +3298,19 @@
if (MR_streq(words[1], "off")) {
MR_echo_commands = MR_FALSE;
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out,
- "Command echo disabled.\n");
+ fprintf(MR_mdb_out, "Command echo disabled.\n");
}
} else if (MR_streq(words[1], "on")) {
if (!MR_echo_commands) {
/*
- ** echo the `echo on' command
- ** This is needed for historical
- ** reasons (compatibility with
- ** our existing test suite).
+ ** Echo the `echo on' command. This is needed for historical
+ ** reasons (compatibility with our existing test suite).
*/
fprintf(MR_mdb_out, "echo on\n");
MR_echo_commands = MR_TRUE;
}
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out,
- "Command echo enabled.\n");
+ fprintf(MR_mdb_out, "Command echo enabled.\n");
}
} else {
MR_trace_usage("parameter", "echo");
@@ -3486,14 +3340,12 @@
MR_trace_print_alias(MR_mdb_out, words[1]);
} else {
if (MR_trace_valid_command(words[2])) {
- MR_trace_add_alias(words[1],
- words+2, word_count-2);
+ MR_trace_add_alias(words[1], words+2, word_count-2);
if (MR_trace_internal_interacting) {
MR_trace_print_alias(MR_mdb_out, words[1]);
}
} else {
- fprintf(MR_mdb_out, "`%s' is not a valid command.\n",
- words[2]);
+ fprintf(MR_mdb_out, "`%s' is not a valid command.\n", words[2]);
}
}
@@ -3508,14 +3360,12 @@
if (word_count == 2) {
if (MR_trace_remove_alias(words[1])) {
if (MR_trace_internal_interacting) {
- fprintf(MR_mdb_out, "Alias `%s' removed.\n",
- words[1]);
+ fprintf(MR_mdb_out, "Alias `%s' removed.\n", words[1]);
}
} else {
fflush(MR_mdb_out);
fprintf(MR_mdb_err,
- "Alias `%s' cannot be removed, "
- "since it does not exist.\n",
+ "Alias `%s' cannot be removed, since it does not exist.\n",
words[1]);
}
} else {
@@ -3544,8 +3394,7 @@
if (msg != NULL) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err,
- "Document category `%s' not added: "
- "%s.\n", words[2], msg);
+ "Document category `%s' not added: %s.\n", words[2], msg);
}
}
@@ -3567,13 +3416,11 @@
} else if (! MR_trace_is_natural_number(words[2], &slot)) {
MR_trace_usage("help", "document");
} else {
- msg = MR_trace_add_item(words[1], words[3], slot,
- help_text);
+ msg = MR_trace_add_item(words[1], words[3], slot, help_text);
if (msg != NULL) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err,
- "Document item `%s' in category `%s' "
- "not added: %s.\n",
+ "Document item `%s' in category `%s' not added: %s.\n",
words[3], words[1], msg);
}
}
@@ -3612,9 +3459,7 @@
fp = fopen(words[1], "w");
if (fp == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: cannot open file `%s' "
- "for output: %s.\n",
+ fprintf(MR_mdb_err, "mdb: cannot open file `%s' for output: %s.\n",
words[1], strerror(errno));
} else {
MR_trace_print_histogram(fp, "All-inclusive",
@@ -3622,9 +3467,7 @@
MR_trace_histogram_hwm);
if (fclose(fp) != 0) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error closing "
- "file `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error closing file `%s': %s.\n",
words[1], strerror(errno));
}
}
@@ -3655,9 +3498,7 @@
fp = fopen(words[1], "w");
if (fp == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: cannot open file `%s' "
- "for output: %s.\n",
+ fprintf(MR_mdb_err, "mdb: cannot open file `%s' for output: %s.\n",
words[1], strerror(errno));
} else {
MR_trace_print_histogram(fp, "Experimental",
@@ -3665,9 +3506,7 @@
MR_trace_histogram_hwm);
if (fclose(fp) != 0) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error closing "
- "file `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error closing file `%s': %s.\n",
words[1], strerror(errno));
}
}
@@ -3747,8 +3586,7 @@
if (MR_streq(words[1], "*")) {
problem = MR_trace_print_size_all(MR_mdb_out);
} else {
- problem = MR_trace_print_size_one(MR_mdb_out,
- words[1]);
+ problem = MR_trace_print_size_one(MR_mdb_out, words[1]);
}
if (problem != NULL) {
@@ -3784,11 +3622,9 @@
MR_debug_flag_info[i].MR_debug_flag_index];
name = MR_debug_flag_info[i].MR_debug_flag_name;
if (*flagptr) {
- fprintf(MR_mdb_out,
- "Flag %s is set.\n", name);
+ fprintf(MR_mdb_out, "Flag %s is set.\n", name);
} else {
- fprintf(MR_mdb_out,
- "Flag %s is clear.\n", name);
+ fprintf(MR_mdb_out, "Flag %s is clear.\n", name);
}
}
return KEEP_INTERACTING;
@@ -4049,13 +3885,13 @@
{
; /* the usage message has already been printed */
} else if (word_count == 1) {
- MR_trace_cmd_nondet_stack_2(event_info, detailed,
- frame_limit, line_limit);
+ MR_trace_cmd_nondet_stack_2(event_info, detailed, frame_limit,
+ line_limit);
} else if (word_count == 2 &&
MR_trace_is_natural_number(words[1], &spec_line_limit))
{
- MR_trace_cmd_nondet_stack_2(event_info, detailed,
- frame_limit, spec_line_limit);
+ MR_trace_cmd_nondet_stack_2(event_info, detailed, frame_limit,
+ spec_line_limit);
} else {
MR_trace_usage("developer", "nondet_stack");
}
@@ -4078,9 +3914,8 @@
int saved_level;
saved_level = MR_trace_current_level();
- MR_dump_nondet_stack_from_layout(MR_mdb_out, NULL,
- frame_limit, line_limit,
- MR_saved_maxfr(saved_regs), layout,
+ MR_dump_nondet_stack_from_layout(MR_mdb_out, NULL, frame_limit,
+ line_limit, MR_saved_maxfr(saved_regs), layout,
MR_saved_sp(saved_regs), MR_saved_curfr(saved_regs));
MR_trace_set_level(saved_level, MR_print_optionals);
} else {
@@ -4154,31 +3989,25 @@
if (word_count == 1) {
if (! MR_io_tabling_allowed) {
fprintf(MR_mdb_err,
- "This executable wasn't prepared "
- "for I/O tabling.\n");
+ "This executable wasn't prepared for I/O tabling.\n");
return KEEP_INTERACTING;
}
if (MR_io_tabling_phase == MR_IO_TABLING_BEFORE) {
- fprintf(MR_mdb_out,
- "I/O tabling has not yet started.\n");
+ fprintf(MR_mdb_out, "I/O tabling has not yet started.\n");
} else if (MR_io_tabling_phase == MR_IO_TABLING_DURING) {
- fprintf(MR_mdb_out,
- "I/O tabling has started.\n");
+ fprintf(MR_mdb_out, "I/O tabling has started.\n");
} else if (MR_io_tabling_phase == MR_IO_TABLING_AFTER) {
- fprintf(MR_mdb_out,
- "I/O tabling has stopped.\n");
+ fprintf(MR_mdb_out, "I/O tabling has stopped.\n");
} else {
- MR_fatal_error(
- "I/O tabling in impossible phase.\n");
+ MR_fatal_error("I/O tabling in impossible phase.\n");
}
} else if (word_count == 2 && (MR_streq(words[1], "start")
|| MR_streq(words[1], "begin")))
{
if (! MR_io_tabling_allowed) {
fprintf(MR_mdb_err,
- "This executable wasn't prepared "
- "for I/O tabling.\n");
+ "This executable wasn't prepared for I/O tabling.\n");
return KEEP_INTERACTING;
}
@@ -4186,65 +4015,51 @@
MR_io_tabling_phase = MR_IO_TABLING_DURING;
MR_io_tabling_start = MR_io_tabling_counter;
MR_io_tabling_end = MR_IO_ACTION_MAX;
- MR_io_tabling_start_event_num =
- event_info->MR_event_number;
+ MR_io_tabling_start_event_num = event_info->MR_event_number;
#ifdef MR_DEBUG_RETRY
MR_io_tabling_debug = MR_TRUE;
#endif
fprintf(MR_mdb_out, "I/O tabling started.\n");
} else if (MR_io_tabling_phase == MR_IO_TABLING_DURING) {
- fprintf(MR_mdb_out,
- "I/O tabling has already started.\n");
+ fprintf(MR_mdb_out, "I/O tabling has already started.\n");
} else if (MR_io_tabling_phase == MR_IO_TABLING_AFTER) {
- fprintf(MR_mdb_out,
- "I/O tabling has already stopped.\n");
+ fprintf(MR_mdb_out, "I/O tabling has already stopped.\n");
} else {
- MR_fatal_error(
- "I/O tabling in impossible phase.\n");
+ MR_fatal_error("I/O tabling in impossible phase.\n");
}
} else if (word_count == 2 && (MR_streq(words[1], "stop")
|| MR_streq(words[1], "end")))
{
if (! MR_io_tabling_allowed) {
fprintf(MR_mdb_err,
- "This executable wasn't prepared "
- "for I/O tabling.\n");
+ "This executable wasn't prepared for I/O tabling.\n");
return KEEP_INTERACTING;
}
if (MR_io_tabling_phase == MR_IO_TABLING_BEFORE) {
- fprintf(MR_mdb_out,
- "I/O tabling has not yet started.\n");
+ fprintf(MR_mdb_out, "I/O tabling has not yet started.\n");
} else if (MR_io_tabling_phase == MR_IO_TABLING_DURING) {
MR_io_tabling_phase = MR_IO_TABLING_AFTER;
MR_io_tabling_end = MR_io_tabling_counter_hwm;
- MR_io_tabling_stop_event_num =
- event_info->MR_event_number;
+ MR_io_tabling_stop_event_num = event_info->MR_event_number;
fprintf(MR_mdb_out, "I/O tabling stopped.\n");
} else if (MR_io_tabling_phase == MR_IO_TABLING_AFTER) {
- fprintf(MR_mdb_out,
- "I/O tabling has already stopped.\n");
+ fprintf(MR_mdb_out, "I/O tabling has already stopped.\n");
} else {
- MR_fatal_error(
- "I/O tabling in impossible phase.\n");
+ MR_fatal_error("I/O tabling in impossible phase.\n");
}
} else if (word_count == 2 && MR_streq(words[1], "stats")) {
if (! MR_io_tabling_allowed) {
fprintf(MR_mdb_err,
- "This executable wasn't prepared "
- "for I/O tabling.\n");
+ "This executable wasn't prepared for I/O tabling.\n");
return KEEP_INTERACTING;
}
fprintf(MR_mdb_out, "phase = %d\n", MR_io_tabling_phase);
- MR_print_unsigned_var(MR_mdb_out, "counter",
- MR_io_tabling_counter);
- MR_print_unsigned_var(MR_mdb_out, "hwm",
- MR_io_tabling_counter_hwm);
- MR_print_unsigned_var(MR_mdb_out, "start",
- MR_io_tabling_start);
- MR_print_unsigned_var(MR_mdb_out, "end",
- MR_io_tabling_end);
+ MR_print_unsigned_var(MR_mdb_out, "counter", MR_io_tabling_counter);
+ MR_print_unsigned_var(MR_mdb_out, "hwm", MR_io_tabling_counter_hwm);
+ MR_print_unsigned_var(MR_mdb_out, "start", MR_io_tabling_start);
+ MR_print_unsigned_var(MR_mdb_out, "end", MR_io_tabling_end);
} else if (word_count == 2 && MR_streq(words[1], "allow")) {
/*
** The "table_io allow" command allows the programmer to give
@@ -4276,8 +4091,7 @@
fp = fopen(words[1], "w");
if (fp == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error opening `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error opening `%s': %s.\n",
words[1], strerror(errno));
return KEEP_INTERACTING;
}
@@ -4304,8 +4118,7 @@
fp = fopen(words[1], "w");
if (fp == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error opening `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error opening `%s': %s.\n",
words[1], strerror(errno));
return KEEP_INTERACTING;
}
@@ -4332,8 +4145,7 @@
fp = fopen(words[1], "w");
if (fp == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error opening `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error opening `%s': %s.\n",
words[1], strerror(errno));
return KEEP_INTERACTING;
}
@@ -4354,15 +4166,12 @@
{
if (word_count == 2 && MR_streq(words[1], "off")) {
MR_print_optionals = MR_FALSE;
- MR_trace_set_level(MR_trace_current_level(),
- MR_print_optionals);
+ MR_trace_set_level(MR_trace_current_level(), MR_print_optionals);
} else if (word_count == 2 && MR_streq(words[1], "on")) {
MR_print_optionals = MR_TRUE;
- MR_trace_set_level(MR_trace_current_level(),
- MR_print_optionals);
+ MR_trace_set_level(MR_trace_current_level(), MR_print_optionals);
} else if (word_count == 1) {
- fprintf(MR_mdb_out,
- "optional values are %sbeing printed\n",
+ fprintf(MR_mdb_out, "optional values are %sbeing printed\n",
MR_print_optionals? "" : "not ");
} else {
MR_trace_usage("developer", "print_optionals");
@@ -4384,8 +4193,7 @@
MR_trace_have_unhid_events = MR_TRUE;
fprintf(MR_mdb_out, "Hidden events are exposed.\n");
} else if (word_count == 1) {
- fprintf(MR_mdb_out,
- "Hidden events are %s.\n",
+ fprintf(MR_mdb_out, "Hidden events are %s.\n",
MR_trace_unhide_events? "exposed" : "hidden");
} else {
MR_trace_usage("developer", "unhide_events");
@@ -4419,12 +4227,10 @@
for (i = 0; i < matches.match_proc_next; i++)
{
fprintf(MR_mdb_out, "%d: ", i);
- MR_print_proc_id_and_nl(MR_mdb_out,
- matches.match_procs[i]);
+ MR_print_proc_id_and_nl(MR_mdb_out, matches.match_procs[i]);
}
- sprintf(buf, "\nWhich procedure's table do you want to print "
- "(0-%d)? ",
+ sprintf(buf, "\nWhich procedure's table do you want to print (0-%d)? ",
matches.match_proc_next - 1);
line2 = MR_trace_getline(buf, MR_mdb_in, MR_mdb_out);
n = -1;
@@ -4469,8 +4275,7 @@
if (! MR_parse_proc_spec(words[1], &spec)) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: invalid procedure specification.\n");
+ fprintf(MR_mdb_err, "mdb: invalid procedure specification.\n");
return KEEP_INTERACTING;
}
@@ -4495,8 +4300,8 @@
case MR_EVAL_METHOD_TABLE_IO_DECL:
case MR_EVAL_METHOD_TABLE_IO_UNITIZE:
case MR_EVAL_METHOD_TABLE_IO_UNITIZE_DECL:
- fprintf(MR_mdb_out, "IO tabled predicates do not have"
- " their own tables.\n");
+ fprintf(MR_mdb_out,
+ "IO tabled predicates do not have their own tables.\n");
return KEEP_INTERACTING;
default:
@@ -4539,8 +4344,7 @@
break;
default:
fprintf(MR_mdb_out, "Sorry, can handle only "
- "integer, float and string arguments "
- "for now.\n");
+ "integer, float and string arguments for now.\n");
MR_GC_free(call_table_args);
return KEEP_INTERACTING;
}
@@ -4560,32 +4364,22 @@
switch (call_table_args[cur_arg].MR_cta_step) {
case MR_TABLE_STEP_INT:
- success =
- MR_trace_fill_in_int_table_arg_slot(
- &table_cur, cur_arg + 1,
- words[cur_arg],
- &call_table_args[cur_arg]);
+ success = MR_trace_fill_in_int_table_arg_slot(&table_cur,
+ cur_arg + 1, words[cur_arg], &call_table_args[cur_arg]);
break;
case MR_TABLE_STEP_FLOAT:
- success =
- MR_trace_fill_in_float_table_arg_slot(
- &table_cur, cur_arg + 1,
- words[cur_arg],
- &call_table_args[cur_arg]);
+ success = MR_trace_fill_in_float_table_arg_slot(&table_cur,
+ cur_arg + 1, words[cur_arg], &call_table_args[cur_arg]);
break;
case MR_TABLE_STEP_STRING:
- success =
- MR_trace_fill_in_string_table_arg_slot(
- &table_cur, cur_arg + 1,
- words[cur_arg],
- &call_table_args[cur_arg]);
+ success = MR_trace_fill_in_string_table_arg_slot(&table_cur,
+ cur_arg + 1, words[cur_arg], &call_table_args[cur_arg]);
break;
default:
- MR_fatal_error("arg not int, float or string "
- "after check");
+ MR_fatal_error("arg not int, float or string after check");
}
if (! success) {
@@ -4602,8 +4396,8 @@
** and we don't need to loop over all the entries.
*/
- MR_trace_cmd_table_print_tip(proc, num_inputs,
- call_table_args, table_cur);
+ MR_trace_cmd_table_print_tip(proc, num_inputs, call_table_args,
+ table_cur);
MR_GC_free(call_table_args);
return KEEP_INTERACTING;
}
@@ -4681,24 +4475,22 @@
switch (call_table_args[cur_arg].MR_cta_step) {
case MR_TABLE_STEP_INT:
- no_more = MR_update_int_table_arg_slot(
- &table_cur, &call_table_args[cur_arg]);
+ no_more = MR_update_int_table_arg_slot(&table_cur,
+ &call_table_args[cur_arg]);
break;
case MR_TABLE_STEP_FLOAT:
- no_more = MR_update_float_table_arg_slot(
- &table_cur, &call_table_args[cur_arg]);
+ no_more = MR_update_float_table_arg_slot(&table_cur,
+ &call_table_args[cur_arg]);
break;
case MR_TABLE_STEP_STRING:
- no_more = MR_update_string_table_arg_slot(
- &table_cur, &call_table_args[cur_arg]);
+ no_more = MR_update_string_table_arg_slot(&table_cur,
+ &call_table_args[cur_arg]);
break;
-
default:
- MR_fatal_error("arg not int, float or string "
- "after check");
+ MR_fatal_error("arg not int, float or string after check");
}
if (no_more) {
@@ -4718,8 +4510,8 @@
cur_arg++;
if (cur_arg >= num_inputs) {
- MR_trace_cmd_table_print_tip(proc, num_inputs,
- call_table_args, table_cur);
+ MR_trace_cmd_table_print_tip(proc, num_inputs, call_table_args,
+ table_cur);
num_tips++;
start_backtrack = MR_TRUE;
} else {
@@ -4753,15 +4545,14 @@
if (! MR_trace_is_integer(given_arg, &n))
{
- fprintf(MR_mdb_out, "argument %d is not an integer.\n",
- arg_num);
+ fprintf(MR_mdb_out, "argument %d is not an integer.\n", arg_num);
return MR_FALSE;
}
table_next = MR_int_hash_lookup(*table_cur_ptr, n);
if (table_next == NULL) {
- fprintf(MR_mdb_out, "call table does not contain "
- "%d in argument position %d.\n",
+ fprintf(MR_mdb_out,
+ "call table does not contain %d in argument position %d.\n",
n, arg_num);
return MR_FALSE;
}
@@ -4785,17 +4576,15 @@
MR_Float f;
MR_TrieNode table_next;
- if (! MR_trace_is_float(given_arg, &f))
- {
- fprintf(MR_mdb_out, "argument %d is not a float.\n",
- arg_num);
+ if (! MR_trace_is_float(given_arg, &f)) {
+ fprintf(MR_mdb_out, "argument %d is not a float.\n", arg_num);
return MR_FALSE;
}
table_next = MR_float_hash_lookup(*table_cur_ptr, f);
if (table_next == NULL) {
- fprintf(MR_mdb_out, "call table does not contain "
- "%f in argument position %d.\n",
+ fprintf(MR_mdb_out,
+ "call table does not contain %f in argument position %d.\n",
f, arg_num);
return MR_FALSE;
}
@@ -4823,8 +4612,8 @@
table_next = MR_string_hash_lookup(*table_cur_ptr, s);
if (table_next == NULL) {
- fprintf(MR_mdb_out, "call table does not contain "
- "%s in argument position %d.\n",
+ fprintf(MR_mdb_out,
+ "call table does not contain %s in argument position %d.\n",
s, arg_num);
return MR_FALSE;
}
@@ -4880,8 +4669,7 @@
call_table_arg_ptr->MR_cta_int_values[
call_table_arg_ptr->MR_cta_int_cur_index];
- table_next = MR_int_hash_lookup(
- call_table_arg_ptr->MR_cta_start_node,
+ table_next = MR_int_hash_lookup(call_table_arg_ptr->MR_cta_start_node,
call_table_arg_ptr->MR_cta_int_cur_value);
if (table_next == NULL) {
@@ -4932,8 +4720,7 @@
call_table_arg_ptr->MR_cta_float_values[
call_table_arg_ptr->MR_cta_float_cur_index];
- table_next = MR_float_hash_lookup(
- call_table_arg_ptr->MR_cta_start_node,
+ table_next = MR_float_hash_lookup(call_table_arg_ptr->MR_cta_start_node,
call_table_arg_ptr->MR_cta_float_cur_value);
if (table_next == NULL) {
@@ -5012,25 +4799,21 @@
switch (call_table_args[i].MR_cta_step) {
case MR_TABLE_STEP_INT:
fprintf(MR_mdb_out, "%d",
- call_table_args[i].
- MR_cta_int_cur_value);
+ call_table_args[i].MR_cta_int_cur_value);
break;
case MR_TABLE_STEP_FLOAT:
fprintf(MR_mdb_out, "%f",
- call_table_args[i].
- MR_cta_float_cur_value);
+ call_table_args[i].MR_cta_float_cur_value);
break;
case MR_TABLE_STEP_STRING:
fprintf(MR_mdb_out, "\"%s\"",
- call_table_args[i].
- MR_cta_string_cur_value);
+ call_table_args[i].MR_cta_string_cur_value);
break;
default:
- MR_fatal_error("arg not int, float or string "
- "after check");
+ MR_fatal_error("arg not int, float or string after check");
}
}
@@ -5167,14 +4950,12 @@
{
module_name = words[1];
name = words[2];
- type_ctor_info =
- MR_lookup_type_ctor_info(module_name, name, arity);
+ type_ctor_info = MR_lookup_type_ctor_info(module_name, name, arity);
if (type_ctor_info != NULL) {
- MR_print_type_ctor_info(MR_mdb_out, type_ctor_info,
- print_rep, print_functors);
+ MR_print_type_ctor_info(MR_mdb_out, type_ctor_info, print_rep,
+ print_functors);
} else {
- fprintf(MR_mdb_out,
- "there is no such type constructor\n");
+ fprintf(MR_mdb_out, "there is no such type constructor\n");
}
} else {
MR_trace_usage("developer", "type_ctor");
@@ -5208,16 +4989,13 @@
{
module_name = words[1];
name = words[2];
- type_class_decl_info =
- MR_lookup_type_class_decl_info(module_name, name,
- arity);
+ type_class_decl_info = MR_lookup_type_class_decl_info(module_name,
+ name, arity);
if (type_class_decl_info != NULL) {
- MR_print_class_decl_info(MR_mdb_out,
- type_class_decl_info, print_methods,
- print_instances);
+ MR_print_class_decl_info(MR_mdb_out, type_class_decl_info,
+ print_methods, print_instances);
} else {
- fprintf(MR_mdb_out,
- "there is no such type class\n");
+ fprintf(MR_mdb_out, "there is no such type class\n");
}
} else {
MR_trace_usage("developer", "class_decl");
@@ -5257,8 +5035,7 @@
list = MR_all_type_ctor_infos();
count = 0;
MR_for_dlist(element_ptr, list) {
- type_ctor_info = (MR_TypeCtorInfo)
- MR_dlist_data(element_ptr);
+ type_ctor_info = (MR_TypeCtorInfo) MR_dlist_data(element_ptr);
if (module_name != NULL && strcmp(module_name,
type_ctor_info->MR_type_ctor_module_name) != 0)
{
@@ -5268,8 +5045,8 @@
if (count > 0) {
fprintf(MR_mdb_out, "\n");
}
- MR_print_type_ctor_info(MR_mdb_out, type_ctor_info,
- print_rep, print_functors);
+ MR_print_type_ctor_info(MR_mdb_out, type_ctor_info, print_rep,
+ print_functors);
count++;
}
@@ -5277,8 +5054,7 @@
if (module_name == NULL) {
fprintf(MR_mdb_out, "in the program: %d\n", count);
} else {
- fprintf(MR_mdb_out, "in module %s: %d\n",
- module_name, count);
+ fprintf(MR_mdb_out, "in module %s: %d\n", module_name, count);
}
} else {
MR_trace_usage("developer", "class_decl");
@@ -5329,9 +5105,8 @@
if (count > 0) {
fprintf(MR_mdb_out, "\n");
}
- MR_print_class_decl_info(MR_mdb_out,
- type_class_decl_info, print_methods,
- print_instances);
+ MR_print_class_decl_info(MR_mdb_out, type_class_decl_info,
+ print_methods, print_instances);
count++;
}
@@ -5339,8 +5114,7 @@
if (module_name == NULL) {
fprintf(MR_mdb_out, "in the program: %d\n", count);
} else {
- fprintf(MR_mdb_out, "in module %s: %d\n",
- module_name, count);
+ fprintf(MR_mdb_out, "in module %s: %d\n", module_name, count);
}
} else {
MR_trace_usage("developer", "class_decl");
@@ -5372,21 +5146,18 @@
fp = fopen(filename, "w");
if (fp == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error opening `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error opening `%s': %s.\n",
filename, strerror(errno));
return KEEP_INTERACTING;
}
MR_dump_module_tables(fp, separate, uci);
if (fclose(fp) != 0) {
- fprintf(MR_mdb_err,
- "mdb: error writing to `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error writing to `%s': %s.\n",
filename, strerror(errno));
return KEEP_INTERACTING;
} else {
- fprintf(MR_mdb_out,
- "mdb: wrote table to `%s'.\n", filename);
+ fprintf(MR_mdb_out, "mdb: wrote table to `%s'.\n", filename);
}
} else {
MR_trace_usage("developer", "class_decl");
@@ -5414,8 +5185,7 @@
rep = MR_type_ctor_rep(type_ctor_info);
if (print_rep) {
- fprintf(fp, ": %s\n",
- MR_ctor_rep_name[MR_GET_ENUM_VALUE(rep)]);
+ fprintf(fp, ": %s\n", MR_ctor_rep_name[MR_GET_ENUM_VALUE(rep)]);
} else {
fprintf(fp, "\n");
}
@@ -5426,15 +5196,12 @@
case MR_TYPECTOR_REP_ENUM:
case MR_TYPECTOR_REP_ENUM_USEREQ:
for (i = 0; i < num_functors; i++) {
- enum_functor = type_ctor_info->
- MR_type_ctor_functors.
+ enum_functor = type_ctor_info->MR_type_ctor_functors.
MR_functors_enum[i];
if (i > 0) {
fprintf(fp, ", ");
}
- fprintf(fp, "%s/0",
- enum_functor->
- MR_enum_functor_name);
+ fprintf(fp, "%s/0", enum_functor->MR_enum_functor_name);
}
fprintf(fp, "\n");
break;
@@ -5442,17 +5209,13 @@
case MR_TYPECTOR_REP_DU:
case MR_TYPECTOR_REP_DU_USEREQ:
for (i = 0; i < num_functors; i++) {
- du_functor = type_ctor_info->
- MR_type_ctor_functors.
+ du_functor = type_ctor_info->MR_type_ctor_functors.
MR_functors_du[i];
if (i > 0) {
fprintf(fp, ", ");
}
- fprintf(fp, "%s/%d",
- du_functor->
- MR_du_functor_name,
- du_functor->
- MR_du_functor_orig_arity);
+ fprintf(fp, "%s/%d", du_functor->MR_du_functor_name,
+ du_functor-> MR_du_functor_orig_arity);
}
fprintf(fp, "\n");
break;
@@ -5460,17 +5223,13 @@
case MR_TYPECTOR_REP_RESERVED_ADDR:
case MR_TYPECTOR_REP_RESERVED_ADDR_USEREQ:
for (i = 0; i < num_functors; i++) {
- maybe_res_functor = &type_ctor_info->
- MR_type_ctor_functors.
+ maybe_res_functor = &type_ctor_info->MR_type_ctor_functors.
MR_functors_res[i];
if (i > 0) {
fprintf(fp, ", ");
}
- fprintf(fp, "%s/%d",
- maybe_res_functor->
- MR_maybe_res_name,
- maybe_res_functor->
- MR_maybe_res_arity);
+ fprintf(fp, "%s/%d", maybe_res_functor->MR_maybe_res_name,
+ maybe_res_functor-> MR_maybe_res_arity);
}
fprintf(fp, "\n");
break;
@@ -5479,11 +5238,9 @@
case MR_TYPECTOR_REP_NOTAG_USEREQ:
case MR_TYPECTOR_REP_NOTAG_GROUND:
case MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ:
- notag_functor = type_ctor_info->
- MR_type_ctor_functors.
+ notag_functor = type_ctor_info->MR_type_ctor_functors.
MR_functors_notag;
- fprintf(fp, "%s/1\n",
- notag_functor->MR_notag_functor_name);
+ fprintf(fp, "%s/1\n", notag_functor->MR_notag_functor_name);
break;
default:
@@ -5528,8 +5285,7 @@
fprintf(fp, "pred ");
}
- fprintf(fp, "%s/%d",
- method->MR_tc_method_name,
+ fprintf(fp, "%s/%d", method->MR_tc_method_name,
method->MR_tc_method_arity);
}
@@ -5541,8 +5297,7 @@
MR_for_dlist (element_ptr, list) {
instance = (MR_Instance) MR_dlist_data(element_ptr);
- if (instance->MR_tc_inst_type_class != type_class_decl)
- {
+ if (instance->MR_tc_inst_type_class != type_class_decl) {
MR_fatal_error("instance/type class mismatch");
}
@@ -5585,8 +5340,7 @@
&pseudo->MR_pti_var_arity_arity;
} else {
arity = type_ctor_info->MR_type_ctor_arity;
- pseudo_args = (MR_PseudoTypeInfo *)
- &pseudo->MR_pti_type_ctor_info;
+ pseudo_args = (MR_PseudoTypeInfo *) &pseudo->MR_pti_type_ctor_info;
}
if (type_ctor_info->MR_type_ctor_arity > 0) {
@@ -5611,12 +5365,11 @@
MR_bool ignore_errors;
ignore_errors = MR_FALSE;
- if (! MR_trace_options_ignore(&ignore_errors,
- &words, &word_count, "misc", "source"))
+ if (! MR_trace_options_ignore(&ignore_errors, &words, &word_count,
+ "misc", "source"))
{
; /* the usage message has already been printed */
- } else if (word_count == 2)
- {
+ } else if (word_count == 2) {
/*
** If the source fails, the error message
** will have already been printed by MR_trace_source
@@ -5642,8 +5395,7 @@
fp = fopen(words[1], "w");
if (fp == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error opening `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error opening `%s': %s.\n",
words[1], strerror(errno));
return KEEP_INTERACTING;
}
@@ -5665,27 +5417,22 @@
break;
default:
- MR_fatal_error("save cmd: "
- "invalid default scope");
+ MR_fatal_error("save cmd: invalid default scope");
}
MR_decl_print_all_trusted(fp, MR_TRUE);
if (found_error) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: could not save "
- "debugger state to %s.\n",
+ fprintf(MR_mdb_err, "mdb: could not save debugger state to %s.\n",
words[1]);
(void) fclose(fp);
} else if (fclose(fp) != 0) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: error closing `%s': %s.\n",
+ fprintf(MR_mdb_err, "mdb: error closing `%s': %s.\n",
words[1], strerror(errno));
} else {
- fprintf(MR_mdb_out,
- "Debugger state saved to %s.\n",
- words[1]);
+ fprintf(MR_mdb_out, "Debugger state saved to %s.\n", words[1]);
}
} else {
MR_trace_usage("misc", "save");
@@ -5702,30 +5449,26 @@
MR_bool confirmed;
confirmed = MR_FALSE;
- if (! MR_trace_options_confirmed(&confirmed,
- &words, &word_count, "misc", "quit"))
+ if (! MR_trace_options_confirmed(&confirmed, &words, &word_count,
+ "misc", "quit"))
{
; /* the usage message has already been printed */
} else if (word_count == 1) {
if (! confirmed) {
char *line2;
- line2 = MR_trace_getline("mdb: "
- "are you sure you want to quit? ",
+ line2 = MR_trace_getline("mdb: are you sure you want to quit? ",
MR_mdb_in, MR_mdb_out);
if (line2 == NULL) {
/* This means the user input EOF. */
confirmed = MR_TRUE;
} else {
int i = 0;
- while (line2[i] != '\0' &&
- MR_isspace(line2[i]))
- {
+ while (line2[i] != '\0' && MR_isspace(line2[i])) {
i++;
}
- if (line2[i] == 'y' || line2[i] == 'Y')
- {
+ if (line2[i] == 'y' || line2[i] == 'Y') {
confirmed = MR_TRUE;
}
@@ -5765,8 +5508,7 @@
if (MR_trace_have_unhid_events) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err,
- "mdb: dd doesn't work "
- "after `unhide_events on'.\n");
+ "mdb: dd doesn't work after `unhide_events on'.\n");
return KEEP_INTERACTING;
}
@@ -5867,9 +5609,8 @@
char buf[80];
char *line2;
- fprintf(MR_mdb_out, "Ambiguous predicate or "
- "function specification. The matches "
- "are:\n");
+ fprintf(MR_mdb_out, "Ambiguous predicate or function"
+ " specification. The matches are:\n");
for (i = 0; i < matches.match_proc_next; i++)
{
fprintf(MR_mdb_out, "%d: ", i);
@@ -5879,16 +5620,12 @@
sprintf(buf, "\nWhich predicate or function "
"do you want to trust (0-%d or *)? ",
matches.match_proc_next - 1);
- line2 = MR_trace_getline(buf,
- MR_mdb_in, MR_mdb_out);
+ line2 = MR_trace_getline(buf, MR_mdb_in, MR_mdb_out);
if (line2 == NULL) {
/* This means the user input EOF. */
fprintf(MR_mdb_out, "none of them\n");
} else if (MR_streq(line2, "*")) {
- for (i = 0;
- i < matches.match_proc_next;
- i++)
- {
+ for (i = 0; i < matches.match_proc_next; i++) {
MR_decl_add_trusted_pred_or_func(
matches.match_procs[i]);
@@ -5897,11 +5634,8 @@
matches.match_procs[i]);
}
MR_free(line2);
- }else if(MR_trace_is_natural_number(line2, &i))
- {
- if (0 <= i &&
- i < matches.match_proc_next)
- {
+ } else if(MR_trace_is_natural_number(line2, &i)) {
+ if (0 <= i && i < matches.match_proc_next) {
MR_decl_add_trusted_pred_or_func(
matches.match_procs[i]);
@@ -5909,8 +5643,7 @@
MR_print_pred_id_and_nl(MR_mdb_out,
matches.match_procs[i]);
} else {
- fprintf(MR_mdb_out,
- "no such match\n");
+ fprintf(MR_mdb_out, "no such match\n");
}
MR_free(line2);
} else {
@@ -5919,10 +5652,10 @@
}
}
}
- } else if (word_count == 3 && ((MR_streq(words[1], "std") &&
- MR_streq(words[2], "lib"))
- || (MR_streq(words[1], "standard") &&
- MR_streq(words[2], "library")))) {
+ } else if (word_count == 3 &&
+ ((MR_streq(words[1], "std") && MR_streq(words[2], "lib"))
+ || (MR_streq(words[1], "standard") && MR_streq(words[2], "library"))))
+ {
MR_decl_trust_standard_library();
fprintf(MR_mdb_out, "Trusting the Mercury standard library\n");
} else {
@@ -5941,8 +5674,7 @@
if (word_count == 2) {
if (MR_trace_is_natural_number(words[1], &i)) {
if (!MR_decl_remove_trusted(i)) {
- fprintf(MR_mdb_err, "mdb: no such trusted "
- "object\n");
+ fprintf(MR_mdb_err, "mdb: no such trusted object\n");
}
} else {
MR_trace_usage("dd", "untrust");
@@ -6045,8 +5777,7 @@
}
else
{
- MR_trace_source_server.server_name =
- MR_copy_string(server_name);
+ MR_trace_source_server.server_name = MR_copy_string(server_name);
msg = MR_trace_source_attach(&MR_trace_source_server, timeout,
verbose);
if (msg != NULL) {
@@ -6094,11 +5825,11 @@
if (MR_port_is_interface(event_info->MR_trace_port)) {
base_sp = MR_saved_sp(event_info->MR_saved_regs);
base_curfr = MR_saved_curfr(event_info->MR_saved_regs);
- parent = MR_find_nth_ancestor(event_info->MR_event_sll,
- 1, &base_sp, &base_curfr, &problem);
+ parent = MR_find_nth_ancestor(event_info->MR_event_sll, 1,
+ &base_sp, &base_curfr, &problem);
if (parent != NULL) {
- (void) MR_find_context(parent,
- &parent_filename, &parent_lineno);
+ (void) MR_find_context(parent, &parent_filename,
+ &parent_lineno);
}
}
@@ -6107,9 +5838,8 @@
&filename, &lineno);
}
- msg = MR_trace_source_sync(&MR_trace_source_server, filename,
- lineno, parent_filename, parent_lineno,
- verbose);
+ msg = MR_trace_source_sync(&MR_trace_source_server, filename, lineno,
+ parent_filename, parent_lineno, verbose);
if (msg != NULL) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err, "mdb: %s.\n", msg);
@@ -6263,7 +5993,7 @@
{ "interface", MR_no_argument, NULL, 'i' },
{ "ignore-entry", MR_required_argument, NULL, 'E' },
{ "ignore-interface", MR_required_argument, NULL, 'I' },
- { "print-list", MR_no_argument, NULL, 'p' },
+ { "print-list", MR_required_argument, NULL, 'p' },
{ "no-warn", MR_no_argument, NULL, 'n' },
{ "print", MR_no_argument, NULL, 'P' },
{ "stop", MR_no_argument, NULL, 'S' },
@@ -6308,15 +6038,12 @@
break;
case 'p':
- *print_list = MR_add_to_print_list_end(
- MR_BROWSE_FORMAT_FLAT, MR_optarg,
- warn, *print_list);
+ *print_list = MR_add_to_print_list_end(MR_BROWSE_FORMAT_FLAT,
+ MR_optarg, warn, *print_list);
break;
case 'E':
- if (! MR_trace_is_natural_number(MR_optarg,
- ignore_count))
- {
+ if (! MR_trace_is_natural_number(MR_optarg, ignore_count)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
@@ -6324,9 +6051,7 @@
break;
case 'I':
- if (! MR_trace_is_natural_number(MR_optarg,
- ignore_count))
- {
+ if (! MR_trace_is_natural_number(MR_optarg, ignore_count)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
@@ -6381,9 +6106,7 @@
switch (c) {
case 'E':
- if (! MR_trace_is_natural_number(MR_optarg,
- ignore_count))
- {
+ if (! MR_trace_is_natural_number(MR_optarg, ignore_count)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
@@ -6391,9 +6114,7 @@
break;
case 'I':
- if (! MR_trace_is_natural_number(MR_optarg,
- ignore_count))
- {
+ if (! MR_trace_is_natural_number(MR_optarg, ignore_count)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
@@ -6523,9 +6244,7 @@
break;
case 'f':
- if (! MR_trace_is_natural_number(MR_optarg,
- frame_limit))
- {
+ if (! MR_trace_is_natural_number(MR_optarg, frame_limit)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
@@ -6850,8 +6569,7 @@
case 't':
if (*close_window ||
- ! MR_trace_is_natural_number(MR_optarg,
- timeout))
+ ! MR_trace_is_natural_number(MR_optarg, timeout))
{
MR_trace_usage(cat, item);
return MR_FALSE;
@@ -6916,20 +6634,23 @@
case 'a':
*assume_all_io_is_tabled = MR_TRUE;
break;
+
case 'd':
- if (!MR_trace_is_natural_number(MR_optarg,
- depth_step_size)) {
+ if (!MR_trace_is_natural_number(MR_optarg, depth_step_size)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
break;
+
case 's':
- if (! MR_trace_is_valid_search_mode_string(
- MR_optarg, search_mode)) {
+ if (! MR_trace_is_valid_search_mode_string(MR_optarg,
+ search_mode))
+ {
MR_trace_usage(cat, item);
return MR_FALSE;
}
break;
+
default:
MR_trace_usage(cat, item);
return MR_FALSE;
@@ -7116,17 +6837,15 @@
int i;
next_char_slot = 0;
- while ((text = MR_trace_getline("cat> ", MR_mdb_in, MR_mdb_out))
- != NULL)
- {
+ while ((text = MR_trace_getline("cat> ", MR_mdb_in, MR_mdb_out)) != NULL) {
if (MR_streq(text, "end")) {
MR_free(text);
break;
}
line_len = strlen(text);
- MR_ensure_big_enough(next_char_slot + line_len + 2,
- doc_char, char, MR_INIT_DOC_CHARS);
+ MR_ensure_big_enough(next_char_slot + line_len + 2, doc_char, char,
+ MR_INIT_DOC_CHARS);
for (i = 0; i < line_len; i++) {
doc_chars[next_char_slot + i] = text[i];
}
@@ -7137,8 +6856,7 @@
MR_free(text);
}
- MR_ensure_big_enough(next_char_slot, doc_char, char,
- MR_INIT_DOC_CHARS);
+ MR_ensure_big_enough(next_char_slot, doc_char, char, MR_INIT_DOC_CHARS);
doc_chars[next_char_slot] = '\0';
return doc_chars;
}
@@ -7206,8 +6924,8 @@
if (*s != '\0') {
/* Only part of the first word constitutes a number. */
/* Put it in an extra word at the start. */
- MR_ensure_big_enough(raw_word_count, raw_word,
- char *, MR_INIT_WORD_COUNT);
+ MR_ensure_big_enough(raw_word_count, raw_word, char *,
+ MR_INIT_WORD_COUNT);
for (i = raw_word_count; i > 0; i--) {
raw_words[i] = raw_words[i-1];
@@ -7281,11 +6999,9 @@
return NULL;
}
- MR_ensure_big_enough(token_number, word, char *,
- MR_INIT_WORD_COUNT);
+ MR_ensure_big_enough(token_number, word, char *, MR_INIT_WORD_COUNT);
words[token_number] = line + char_pos;
- problem = MR_trace_break_off_one_word(line, char_pos,
- &new_char_pos);
+ problem = MR_trace_break_off_one_word(line, char_pos, &new_char_pos);
if (problem != NULL) {
return problem;
}
@@ -7303,7 +7019,7 @@
MR_bool another = MR_FALSE;
while (line[char_pos] != '\0') {
- if (!quoted && MR_isspace(line[char_pos])) {
+ if (! quoted && MR_isspace(line[char_pos])) {
another = MR_TRUE;
break;
}
@@ -7316,7 +7032,8 @@
lag++;
char_pos++;
if (line[char_pos] == '\0') {
- return "bad backslash"; }
+ return "bad backslash";
+ }
}
if (lag) {
@@ -7362,13 +7079,12 @@
if (MR_trace_lookup_alias(alias_key, &alias_words, &alias_word_count))
{
- MR_ensure_big_enough(*word_count + alias_word_count,
- *word, char *, MR_INIT_WORD_COUNT);
+ MR_ensure_big_enough(*word_count + alias_word_count, *word, char *,
+ MR_INIT_WORD_COUNT);
/* Move the original words (except the alias key) up. */
for (i = *word_count - 1; i >= alias_copy_start; i--) {
- (*words)[i + alias_word_count - alias_copy_start]
- = (*words)[i];
+ (*words)[i + alias_word_count - alias_copy_start] = (*words)[i];
}
/* Move the alias body to the words array. */
@@ -7641,31 +7357,25 @@
if (buf[i] != '\0' && !MR_isspace(buf[i])) {
switch (buf[i]) {
case 'a':
- cmd->MR_trace_print_level =
- MR_PRINT_LEVEL_ALL;
+ cmd->MR_trace_print_level = MR_PRINT_LEVEL_ALL;
break;
case 'n':
- cmd->MR_trace_print_level =
- MR_PRINT_LEVEL_NONE;
+ cmd->MR_trace_print_level = MR_PRINT_LEVEL_NONE;
break;
case 's':
- cmd->MR_trace_print_level =
- MR_PRINT_LEVEL_SOME;
+ cmd->MR_trace_print_level = MR_PRINT_LEVEL_SOME;
break;
case 'q':
MR_free(buf);
- return MR_trace_event_internal(
- cmd, MR_TRUE,
- NULL, event_info);
+ return MR_trace_event_internal(cmd, MR_TRUE, NULL,
+ event_info);
default:
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "unknown command, "
- "try again\n");
+ fprintf(MR_mdb_err, "unknown command, try again\n");
MR_free(buf);
goto try_again;
}
@@ -7710,16 +7420,13 @@
MR_Unsigned event_num;
MR_Unsigned call_num;
- event_num = MR_standardize_event_num(
- event_info->MR_event_number);
- call_num = MR_standardize_call_num(
- event_info->MR_call_seqno);
+ event_num = MR_standardize_event_num(event_info->MR_event_number);
+ call_num = MR_standardize_call_num(event_info->MR_call_seqno);
snprintf(buf, 64, "E%ld", (long) event_num);
fprintf(MR_mdb_out, "%8s: ", buf);
snprintf(buf, 64, "C%ld", (long) call_num);
fprintf(MR_mdb_out, "%6s ", buf);
- fprintf(MR_mdb_out, "%s",
- MR_port_names[event_info->MR_trace_port]);
+ fprintf(MR_mdb_out, "%s", MR_port_names[event_info->MR_trace_port]);
} else {
fprintf(MR_mdb_out, "%8ld: %6ld %2ld %s",
(long) event_info->MR_event_number,
@@ -7738,8 +7445,7 @@
parent = MR_find_nth_ancestor(event_info->MR_event_sll, 1,
&base_sp, &base_curfr, &problem);
if (parent != NULL) {
- (void) MR_find_context(parent, &parent_filename,
- &parent_lineno);
+ (void) MR_find_context(parent, &parent_filename, &parent_lineno);
}
}
@@ -7747,8 +7453,7 @@
MR_context_position, event_info->MR_event_sll->MR_sll_entry,
base_sp, base_curfr,
( MR_print_goal_paths ? event_info->MR_event_path : "" ),
- filename, lineno,
- MR_port_is_interface(event_info->MR_trace_port),
+ filename, lineno, MR_port_is_interface(event_info->MR_trace_port),
parent_filename, parent_lineno, indent);
}
@@ -8078,10 +7783,8 @@
const char *command;
const char *category;
- category = MR_trace_command_infos[command_index].
- MR_cmd_category;
- command = MR_trace_command_infos[command_index].
- MR_cmd_name;
+ category = MR_trace_command_infos[command_index].MR_cmd_category;
+ command = MR_trace_command_infos[command_index].MR_cmd_name;
command_index++;
*data = (void *) command_index;
@@ -8092,9 +7795,7 @@
*/
if (command == NULL) {
return NULL;
- } else if (category != NULL &&
- MR_strneq(word, command, word_len))
- {
+ } else if (category != NULL && MR_strneq(word, command, word_len)) {
return MR_copy_string(command);
}
}
Index: mercury_trace_source.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_source.c,v
retrieving revision 1.8
diff -u -b -r1.8 mercury_trace_source.c
--- mercury_trace_source.c 31 Oct 2002 16:20:51 -0000 1.8
+++ mercury_trace_source.c 27 Jan 2005 14:47:08 -0000
@@ -1,4 +1,7 @@
/*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
** Copyright (C) 2001-2002 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -110,17 +113,19 @@
** NULL, otherwise returns an error message.
*/
static const char *MR_trace_source_jump(const char *server_cmd,
- const char *server_name, const char *filename, int lineno,
- MR_bool verbose);
+ const char *server_name, const char *filename,
+ int lineno, MR_bool verbose);
/*
** Send the given key sequence to the vim server. Returns the status
** code of the shell command.
*/
static int MR_trace_source_send(const char *server_cmd,
- const char *server_name, const char *keys, MR_bool verbose);
+ const char *server_name, const char *keys,
+ MR_bool verbose);
-static int MR_verbose_system_call(const char *system_call, MR_bool verbose);
+static int MR_verbose_system_call(const char *system_call,
+ MR_bool verbose);
static const char *
MR_trace_source_check_display(void)
@@ -142,8 +147,7 @@
** Try running the server with '--version', and see if the
** output contains the string '+clientserver'.
*/
- sprintf(system_call,
- "%s --version 2>&1 | fgrep -q '+clientserver' %s",
+ sprintf(system_call, "%s --version 2>&1 | fgrep -q '+clientserver' %s",
server_cmd, (verbose ? "" : "> /dev/null 2>&1"));
status = MR_verbose_system_call(system_call, verbose);
if (status == 0) {
@@ -166,8 +170,7 @@
** insensitive.
*/
sprintf(system_call, "%s --serverlist | fgrep -iq '%s' %s",
- server_cmd, server_name,
- (verbose ? "" : "> /dev/null 2>&1"));
+ server_cmd, server_name, (verbose ? "" : "> /dev/null 2>&1"));
status = MR_verbose_system_call(system_call, verbose);
if (status == 0) {
return NULL;
@@ -266,8 +269,7 @@
** This should fail if there is no server with this
** name.
*/
- msg = MR_trace_source_check_server(real_server_cmd, name,
- verbose);
+ msg = MR_trace_source_check_server(real_server_cmd, name, verbose);
} while (msg == NULL);
#endif
@@ -277,9 +279,8 @@
** Start the server in read-only mode, to discourage the user
** from trying to edit the source.
*/
- sprintf(system_call, "%s %s -R --servername \"%s\" %s &",
- real_window_cmd, real_server_cmd, name,
- (verbose ? "" : "> /dev/null 2>&1"));
+ sprintf(system_call, "%s %s -R --servername \"%s\" %s &", real_window_cmd,
+ real_server_cmd, name, (verbose ? "" : "> /dev/null 2>&1"));
MR_verbose_system_call(system_call, verbose);
/*
@@ -304,10 +305,8 @@
if (server->split) {
/* Split the window. */
- status = MR_trace_source_send(real_server_cmd,
- server->server_name,
- MR_SOURCE_SERVER_RESET_STRING
- MR_SOURCE_SERVER_SPLIT_STRING,
+ status = MR_trace_source_send(real_server_cmd, server->server_name,
+ MR_SOURCE_SERVER_RESET_STRING MR_SOURCE_SERVER_SPLIT_STRING,
verbose);
if (status != 0) {
server->split = MR_FALSE;
@@ -332,8 +331,8 @@
real_server_cmd = MR_DEFAULT_SOURCE_SERVER_COMMAND;
}
- msg = MR_trace_source_check_server(real_server_cmd,
- server->server_name, verbose);
+ msg = MR_trace_source_check_server(real_server_cmd, server->server_name,
+ verbose);
if (msg == NULL) {
return NULL;
}
@@ -352,8 +351,9 @@
** take a second or more.
*/
volatile long i;
- for (i = 0; i < 100000000; i++)
- {}
+ for (i = 0; i < 100000000; i++) {
+ /* empty */;
+ }
#endif
msg = MR_trace_source_check_server(real_server_cmd,
server->server_name, verbose);
@@ -390,8 +390,8 @@
real_server_cmd = MR_DEFAULT_SOURCE_SERVER_COMMAND;
}
- msg = MR_trace_source_check_server(real_server_cmd,
- server->server_name, verbose);
+ msg = MR_trace_source_check_server(real_server_cmd, server->server_name,
+ verbose);
if (msg != NULL) {
return msg;
}
@@ -417,27 +417,22 @@
if (have_parent && have_current) {
/* Move to the secondary (top) window. */
- status = MR_trace_source_send(real_server_cmd,
- server->server_name,
- MR_SOURCE_SERVER_RESET_STRING
- MR_SOURCE_SERVER_TOP_STRING,
+ status = MR_trace_source_send(real_server_cmd, server->server_name,
+ MR_SOURCE_SERVER_RESET_STRING MR_SOURCE_SERVER_TOP_STRING,
verbose);
if (status != 0) {
return "warning: source synchronisation failed";
}
- msg = MR_trace_source_jump(real_server_cmd,
- server->server_name, filename, lineno,
- verbose);
+ msg = MR_trace_source_jump(real_server_cmd, server->server_name,
+ filename, lineno, verbose);
if (msg != NULL) {
return msg;
}
/* Move down one window to the primary. */
- status = MR_trace_source_send(real_server_cmd,
- server->server_name,
- MR_SOURCE_SERVER_RESET_STRING
- MR_SOURCE_SERVER_DOWN_STRING,
+ status = MR_trace_source_send(real_server_cmd, server->server_name,
+ MR_SOURCE_SERVER_RESET_STRING MR_SOURCE_SERVER_DOWN_STRING,
verbose);
if (status != 0) {
return "warning: source synchronisation failed";
@@ -446,12 +441,9 @@
/*
** Move to the primary (second from top) window.
*/
- status = MR_trace_source_send(real_server_cmd,
- server->server_name,
- MR_SOURCE_SERVER_RESET_STRING
- MR_SOURCE_SERVER_TOP_STRING
- MR_SOURCE_SERVER_DOWN_STRING,
- verbose);
+ status = MR_trace_source_send(real_server_cmd, server->server_name,
+ MR_SOURCE_SERVER_RESET_STRING MR_SOURCE_SERVER_TOP_STRING
+ MR_SOURCE_SERVER_DOWN_STRING, verbose);
if (status != 0) {
return "warning: source synchronisation failed";
}
@@ -464,16 +456,14 @@
** show the current context.
*/
if (have_parent) {
- msg = MR_trace_source_jump(real_server_cmd,
- server->server_name, parent_filename,
- parent_lineno, verbose);
+ msg = MR_trace_source_jump(real_server_cmd, server->server_name,
+ parent_filename, parent_lineno, verbose);
if (msg != NULL) {
return msg;
}
} else {
- msg = MR_trace_source_jump(real_server_cmd,
- server->server_name, filename, lineno,
- verbose);
+ msg = MR_trace_source_jump(real_server_cmd, server->server_name,
+ filename, lineno, verbose);
if (msg != NULL) {
return msg;
}
@@ -505,8 +495,7 @@
** mode since the previous command was sent.
*/
status = MR_trace_source_send(server_cmd, server_name,
- MR_SOURCE_SERVER_RESET_STRING
- MR_SOURCE_SERVER_CENTRE_STRING, verbose);
+ MR_SOURCE_SERVER_RESET_STRING MR_SOURCE_SERVER_CENTRE_STRING, verbose);
if (status != 0) {
return "warning: source synchronisation failed";
}
@@ -526,15 +515,14 @@
real_server_cmd = MR_DEFAULT_SOURCE_SERVER_COMMAND;
}
- msg = MR_trace_source_check_server(real_server_cmd,
- server->server_name, verbose);
+ msg = MR_trace_source_check_server(real_server_cmd, server->server_name,
+ verbose);
if (msg != NULL) {
return msg;
}
MR_trace_source_send(real_server_cmd, server->server_name,
- MR_SOURCE_SERVER_RESET_STRING
- MR_SOURCE_SERVER_QUIT_STRING, verbose);
+ MR_SOURCE_SERVER_RESET_STRING MR_SOURCE_SERVER_QUIT_STRING, verbose);
#if 0
/*
@@ -546,8 +534,8 @@
** We expect the following to fail. If it doesn't, the server
** hasn't closed properly.
*/
- msg = MR_trace_source_check_server(real_server_cmd,
- server->server_name, verbose);
+ msg = MR_trace_source_check_server(real_server_cmd, server->server_name,
+ verbose);
if (msg == NULL) {
return "warning: failed to close source server";
} else {
Index: mercury_trace_tables.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_tables.c,v
retrieving revision 1.32
diff -u -b -r1.32 mercury_trace_tables.c
--- mercury_trace_tables.c 17 Jan 2005 04:29:31 -0000 1.32
+++ mercury_trace_tables.c 27 Jan 2005 15:15:33 -0000
@@ -1,4 +1,7 @@
/*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
** Copyright (C) 1998-2005 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -50,17 +53,19 @@
static const MR_Module_Layout
*MR_search_module_info_by_name(const char *name);
-static MR_Dlist
- *MR_search_module_info_by_nickname(const char *name);
+static MR_Dlist *MR_search_module_info_by_nickname(const char *name);
static void MR_insert_module_info(const MR_Module_Layout *module);
static void MR_process_matching_procedures_in_module(
const MR_Module_Layout *module, MR_Proc_Spec *spec,
- void f(void *, const MR_Proc_Layout *), void *data);
+ void f(void *, const MR_Proc_Layout *),
+ void *data);
static void MR_process_line_layouts(const MR_Module_File_Layout
*file_layout, int line,
- MR_file_line_callback callback_func, int callback_arg);
+ MR_file_line_callback callback_func,
+ int callback_arg);
-static MR_bool MR_parse_trailing_number(char *start, char **end, int *number);
+static MR_bool MR_parse_trailing_number(char *start, char **end,
+ int *number);
static void MR_translate_double_underscores(char *str);
static char *MR_get_module_info_name(int slot);
@@ -119,17 +124,15 @@
if (verbose) {
fprintf(fp, "done.\n");
if (MR_module_info_next == 0) {
- fprintf(fp,
- "There are no debuggable modules.\n");
+ fprintf(fp, "There are no debuggable modules.\n");
} else if (MR_module_info_next == 1) {
- fprintf(fp, "There is one debuggable module, "
- "with %d procedures.\n",
+ fprintf(fp,
+ "There is one debuggable module, with %d procedures.\n",
MR_module_info_proc_count);
} else {
fprintf(fp, "There are %d debuggable modules, "
"with a total of %d procedures.\n",
- MR_module_info_next,
- MR_module_info_proc_count);
+ MR_module_info_next, MR_module_info_proc_count);
}
}
}
@@ -198,20 +201,15 @@
strcmp(MR_module_nicks[slot].MR_nick_name, nickname));
if (found) {
MR_module_nicks[slot].MR_nick_layouts =
- MR_dlist_addtail(
- MR_module_nicks[slot].MR_nick_layouts,
+ MR_dlist_addtail(MR_module_nicks[slot].MR_nick_layouts,
module);
} else {
- MR_GC_ensure_room_for_next(MR_module_nick,
- MR_Module_Nick, INIT_MODULE_TABLE_SIZE);
- MR_prepare_insert_into_sorted(MR_module_nicks,
- MR_module_nick_next,
- slot,
- strcmp(MR_module_nicks[slot].MR_nick_name,
- nickname));
+ MR_GC_ensure_room_for_next(MR_module_nick, MR_Module_Nick,
+ INIT_MODULE_TABLE_SIZE);
+ MR_prepare_insert_into_sorted(MR_module_nicks, MR_module_nick_next,
+ slot, strcmp(MR_module_nicks[slot].MR_nick_name, nickname));
MR_module_nicks[slot].MR_nick_name = nickname;
- MR_module_nicks[slot].MR_nick_layouts =
- MR_dlist_makelist(module);
+ MR_module_nicks[slot].MR_nick_layouts = MR_dlist_makelist(module);
}
nickname = strchr(nickname, '.');
@@ -226,13 +224,11 @@
const MR_Module_File_Layout *file_layout;
for (i = 0; i < MR_module_info_next; i++) {
- for (j = 0; j < MR_module_infos[i]->MR_ml_filename_count; j++)
- {
- file_layout = MR_module_infos[i]->
- MR_ml_module_file_layout[j];
+ for (j = 0; j < MR_module_infos[i]->MR_ml_filename_count; j++) {
+ file_layout = MR_module_infos[i]->MR_ml_module_file_layout[j];
if (MR_streq(file_layout->MR_mfl_filename, file)) {
- MR_process_line_layouts(file_layout, line,
- callback_func, callback_arg);
+ MR_process_line_layouts(file_layout, line, callback_func,
+ callback_arg);
}
}
}
@@ -254,9 +250,7 @@
** linenumber; we now find the *first* such label.
*/
- while (k > 0
- && file_layout->MR_mfl_label_lineno[k - 1] == line)
- {
+ while (k > 0 && file_layout->MR_mfl_label_lineno[k - 1] == line) {
k--;
}
@@ -315,21 +309,19 @@
if (module == NULL) {
modules = MR_search_module_info_by_nickname(name);
if (modules == NULL) {
- fprintf(fp, "There is no debugging info "
- "about module `%s'\n", name);
+ fprintf(fp,
+ "There is no debugging info about module `%s'\n", name);
return;
} else if (MR_dlist_length(modules) != 1) {
fprintf(fp, "Module name `%s' is ambiguous.\n", name);
fprintf(fp, "The matches are:\n");
MR_for_dlist (element_ptr, modules) {
- module = (const MR_Module_Layout *)
- MR_dlist_data(element_ptr);
+ module = (const MR_Module_Layout *) MR_dlist_data(element_ptr);
fprintf(fp, "%s\n", module->MR_ml_name);
}
return;
} else {
- module = (const MR_Module_Layout *)
- MR_dlist_first(modules);
+ module = (const MR_Module_Layout *) MR_dlist_first(modules);
}
}
@@ -426,9 +418,7 @@
** There must be at least one character before the qualifier.
*/
while (end > str) {
- if (*end == ':' || *end == '.'
- || (*end == '_' && *(end + 1) == '_'))
- {
+ if (*end == ':' || *end == '.' || (*end == '_' && *(end + 1) == '_')) {
if (*end == ':' || *end == '.') {
spec->MR_proc_name = end + 1;
} else {
@@ -494,11 +484,13 @@
static MR_bool
MR_parse_trailing_number(char *start, char **end, int *number)
{
- MR_bool found_digit = MR_FALSE;
- int power_of_10 = 1;
+ MR_bool found_digit;
+ int power_of_10;
char c;
char *tmp_end;
+ found_digit = MR_FALSE;
+ power_of_10 = 1;
*number = 0;
tmp_end = *end + 1;
@@ -584,27 +576,24 @@
module = MR_search_module_info_by_name(spec->MR_proc_module);
if (module != NULL) {
- MR_process_matching_procedures_in_module(
- module, spec, f, data);
+ MR_process_matching_procedures_in_module(module, spec, f, data);
} else {
const MR_Dlist *modules;
const MR_Dlist *element_ptr;
- modules = MR_search_module_info_by_nickname(
- spec->MR_proc_module);
+ modules = MR_search_module_info_by_nickname(spec->MR_proc_module);
MR_for_dlist (element_ptr, modules) {
- module = (const MR_Module_Layout *)
- MR_dlist_data(element_ptr);
- MR_process_matching_procedures_in_module(
- module, spec, f, data);
+ module = (const MR_Module_Layout *) MR_dlist_data(element_ptr);
+ MR_process_matching_procedures_in_module(module, spec, f,
+ data);
}
}
} else {
int i;
for (i = 0; i < MR_module_info_next; i++) {
- MR_process_matching_procedures_in_module(
- MR_module_infos[i], spec, f, data);
+ MR_process_matching_procedures_in_module(MR_module_infos[i], spec,
+ f, data);
}
}
}
@@ -689,10 +678,11 @@
void
MR_filter_user_preds(MR_Matches_Info *matches)
{
- int filter_pos = 0;
+ int filter_pos;
int i;
const MR_Proc_Layout *entry;
+ filter_pos = 0;
for(i = 0; i < matches->match_proc_next; i++) {
entry = matches->match_procs[i];
if (!MR_PROC_LAYOUT_IS_UCI(entry) &&
@@ -708,8 +698,8 @@
MR_Completer_List *
MR_trace_module_completer(const char *word, size_t word_len)
{
- return MR_trace_sorted_array_completer(word, word_len,
- MR_module_info_next, MR_get_module_info_name);
+ return MR_trace_sorted_array_completer(word, word_len, MR_module_info_next,
+ MR_get_module_info_name);
}
static char *
@@ -738,6 +728,7 @@
} else {
data->MR_complete_pf = -1;
}
+
data->MR_complete_name = MR_copy_string(word);
MR_translate_double_underscores(data->MR_complete_name);
data->MR_complete_name_len = strlen(data->MR_complete_name);
@@ -770,15 +761,13 @@
data->MR_unambiguous_matching_module = slot;
if (slot > 0 &&
MR_strneq(MR_module_infos[slot - 1]->MR_ml_name,
- data->MR_complete_name,
- data->MR_complete_name_len))
+ data->MR_complete_name, data->MR_complete_name_len))
{
data->MR_unambiguous_matching_module = -1;
}
if (slot < MR_module_info_next - 1 &&
MR_strneq(MR_module_infos[slot + 1]->MR_ml_name,
- data->MR_complete_name,
- data->MR_complete_name_len))
+ data->MR_complete_name, data->MR_complete_name_len))
{
data->MR_unambiguous_matching_module = -1;
}
@@ -787,8 +776,7 @@
}
return MR_new_completer_elem(MR_trace_breakpoint_completer_next,
- (MR_Completer_Data) data,
- MR_free_proc_completer_data);
+ (MR_Completer_Data) data, MR_free_proc_completer_data);
}
static char *
@@ -832,8 +820,8 @@
if (data->MR_complete_word_matches_module == 0 &&
MR_strneq(name, module_name, name_len))
{
- return MR_format_breakpoint_completion(
- data->MR_complete_pf, module_name, "");
+ return MR_format_breakpoint_completion(data->MR_complete_pf,
+ module_name, "");
} else {
goto try_completion;
}
@@ -931,30 +919,26 @@
name_len = data->MR_complete_name_len;
unqualified_name = name + data->MR_complete_word_matches_module;
- unqualified_name_len =
- name_len - data->MR_complete_word_matches_module;
+ unqualified_name_len = name_len - data->MR_complete_word_matches_module;
module_layout = MR_module_infos[data->MR_complete_current_module];
- proc_layout =
- module_layout->MR_ml_procs[data->MR_complete_current_proc];
+ proc_layout = module_layout->MR_ml_procs[data->MR_complete_current_proc];
if (
! MR_PROC_LAYOUT_IS_UCI(proc_layout) &&
( data->MR_complete_pf == -1 ||
- proc_layout->MR_sle_user.MR_user_pred_or_func ==
- data->MR_complete_pf
+ proc_layout->MR_sle_user.MR_user_pred_or_func == data->MR_complete_pf
) &&
- MR_strneq(proc_layout->MR_sle_user.MR_user_name,
- unqualified_name, unqualified_name_len))
+ MR_strneq(proc_layout->MR_sle_user.MR_user_name, unqualified_name,
+ unqualified_name_len))
{
if (data->MR_complete_word_matches_module != 0) {
complete_module = (char *) module_layout->MR_ml_name;
} else {
complete_module = NULL;
}
- completion = MR_format_breakpoint_completion(
- data->MR_complete_pf, complete_module,
- proc_layout->MR_sle_user.MR_user_name);
+ completion = MR_format_breakpoint_completion(data->MR_complete_pf,
+ complete_module, proc_layout->MR_sle_user.MR_user_name);
} else {
completion = NULL;
}
@@ -965,8 +949,7 @@
data->MR_complete_current_proc++;
if (data->MR_complete_word_matches_module != 0
- && data->MR_complete_current_proc >=
- module_layout->MR_ml_proc_count
+ && data->MR_complete_current_proc >= module_layout->MR_ml_proc_count
&& ! data->MR_complete_name_is_qualified)
{
/*
@@ -1082,10 +1065,8 @@
for (detism = 0; detism <= MR_DETISM_MAX; detism++) {
if (histogram[detism] > 0) {
- fprintf(fp, "%-10s %10d (%5.2f%%)\n",
- MR_detism_names[detism],
- histogram[detism],
- ((float) 100 * histogram[detism]) / total);
+ fprintf(fp, "%-10s %10d (%5.2f%%)\n", MR_detism_names[detism],
+ histogram[detism], ((float) 100 * histogram[detism]) / total);
}
}
fprintf(fp, "%-10s %10d\n", "all ", total);
@@ -1128,8 +1109,7 @@
total++;
if (0 <= label_layout->MR_sll_port &&
- label_layout->MR_sll_port
- < MR_PORT_NUM_PORTS)
+ label_layout->MR_sll_port < MR_PORT_NUM_PORTS)
{
histogram[label_layout->MR_sll_port]++;
}
@@ -1138,10 +1118,8 @@
}
for (port = 0; port < MR_PORT_NUM_PORTS; port++) {
- fprintf(fp, "%4s %10d (%5.2f%%)\n",
- MR_port_names[port],
- histogram[port],
- ((float) 100 * histogram[port]) / total);
+ fprintf(fp, "%4s %10d (%5.2f%%)\n", MR_port_names[port],
+ histogram[port], ((float) 100 * histogram[port]) / total);
}
fprintf(fp, "%s %10d\n", "all ", total);
}
@@ -1170,8 +1148,7 @@
for (module_num = 0; module_num < MR_module_info_next; module_num++) {
module_layout = MR_module_infos[module_num];
- total_string_table_bytes +=
- module_layout->MR_ml_string_table_size;
+ total_string_table_bytes += module_layout->MR_ml_string_table_size;
for (proc_num = 0;
proc_num < module_layout->MR_ml_proc_count;
@@ -1185,8 +1162,7 @@
}
var_names = proc_layout->MR_sle_used_var_names;
- num_var_nums =
- proc_layout->MR_sle_max_named_var_num + 1;
+ num_var_nums = proc_layout->MR_sle_max_named_var_num + 1;
total_var_num_table_entries += num_var_nums;
for (var_num = 0; var_num < num_var_nums; var_num++) {
Index: mercury_trace_util.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_util.c,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_trace_util.c
--- mercury_trace_util.c 20 Jul 2004 04:41:55 -0000 1.13
+++ mercury_trace_util.c 27 Jan 2005 15:15:49 -0000
@@ -1,4 +1,7 @@
/*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
** Copyright (C) 2000-2002, 2004 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
Index: mercury_trace_vars.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
retrieving revision 1.59
diff -u -b -r1.59 mercury_trace_vars.c
--- mercury_trace_vars.c 16 Aug 2004 03:51:16 -0000 1.59
+++ mercury_trace_vars.c 27 Jan 2005 15:19:19 -0000
@@ -872,8 +872,8 @@
arg_list = MR_list_empty();
i = next - 1;
for (headvar_num = arity; headvar_num > 0; headvar_num--) {
- if (i >= 0 && vars[var_slot_array[i]].MR_var_is_headvar
- == headvar_num)
+ if (i >= 0 &&
+ vars[var_slot_array[i]].MR_var_is_headvar == headvar_num)
{
slot = var_slot_array[i];
i--;
@@ -921,8 +921,8 @@
const char *problem;
MR_bool saved_io_tabling_enabled;
- problem = MR_trace_get_action(action_number, &proc_name,
- &is_func, &arg_list);
+ problem = MR_trace_get_action(action_number, &proc_name, &is_func,
+ &arg_list);
if (problem != NULL) {
return problem;
}
@@ -1036,7 +1036,8 @@
MR_point.MR_point_vars[i].MR_var_fullname));
if (success_count == 0) {
- return "the selected path does not exist in any of the variables with that name";
+ return "the selected path does not exist "
+ "in any of the variables with that name";
}
}
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list