diff: control of command feedback in the debugger
Zoltan Somogyi
zs at cs.mu.OZ.AU
Tue Nov 3 20:13:06 AEDT 1998
trace/mercury_trace_internal.c:
Set things up so that commands such as "alias" and "printlevel"
give feedback only if they are invoked interactively.
Zoltan.
cvs diff: Diffing .
Index: mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.6
diff -u -u -r1.6 mercury_trace_internal.c
--- mercury_trace_internal.c 1998/10/30 05:12:17 1.6
+++ mercury_trace_internal.c 1998/11/03 08:58:48
@@ -81,6 +81,12 @@
static bool MR_echo_commands = FALSE;
+/*
+** We print confirmation of commands (e.g. new aliases) if this is TRUE.
+*/
+
+static bool MR_trace_internal_interacting = FALSE;
+
typedef struct MR_Line_Struct {
char *MR_line_contents;
struct MR_Line_Struct *MR_line_next;
@@ -850,13 +856,22 @@
if (word_count == 2) {
if (streq(words[1], "none")) {
MR_default_print_level = MR_PRINT_LEVEL_NONE;
- printf("Default print level set to `none'.\n");
+ if (MR_trace_internal_interacting) {
+ printf("Default print level set to "
+ "`none'.\n");
+ }
} else if (streq(words[1], "some")) {
MR_default_print_level = MR_PRINT_LEVEL_SOME;
- printf("Default print level set to `some'.\n");
+ if (MR_trace_internal_interacting) {
+ printf("Default print level set to "
+ "`some'.\n");
+ }
} else if (streq(words[1], "all")) {
MR_default_print_level = MR_PRINT_LEVEL_ALL;
- printf("Default print level set to `all'.\n");
+ if (MR_trace_internal_interacting) {
+ printf("Default print level set to "
+ "`all'.\n");
+ }
} else {
MR_trace_help_cat_item("parameter",
"printlevel");
@@ -887,14 +902,20 @@
if (word_count == 2) {
if (streq(words[1], "off")) {
MR_scroll_control = FALSE;
- printf("Scroll control disabled.\n");
+ if (MR_trace_internal_interacting) {
+ printf("Scroll control disabled.\n");
+ }
} else if (streq(words[1], "on")) {
MR_scroll_control = TRUE;
- printf("Scroll control enabled.\n");
+ if (MR_trace_internal_interacting) {
+ printf("Scroll control enabled.\n");
+ }
} else if (MR_trace_is_number(words[1], &n)) {
MR_scroll_limit = n;
- printf("Scroll window size set to %d.\n",
- MR_scroll_limit);
+ if (MR_trace_internal_interacting) {
+ printf("Scroll window size set to "
+ "%d.\n", MR_scroll_limit);
+ }
} else {
MR_trace_help_cat_item("parameter", "scroll");
}
@@ -914,10 +935,14 @@
if (word_count == 2) {
if (streq(words[1], "off")) {
MR_echo_commands = FALSE;
- printf("Command echo disabled.\n");
+ if (MR_trace_internal_interacting) {
+ printf("Command echo disabled.\n");
+ }
} else if (streq(words[1], "on")) {
MR_echo_commands = TRUE;
- printf("Command echo enabled.\n");
+ if (MR_trace_internal_interacting) {
+ printf("Command echo enabled.\n");
+ }
} else {
MR_trace_help_cat_item("parameter", "echo");
}
@@ -940,7 +965,9 @@
if (MR_trace_valid_command(words[2])) {
MR_trace_add_alias(words[1],
words+2, word_count-2);
- MR_trace_print_alias(stdout, words[1]);
+ if (MR_trace_internal_interacting) {
+ MR_trace_print_alias(stdout, words[1]);
+ }
} else {
printf("%s is not a valid command.\n",
words[2]);
@@ -949,7 +976,10 @@
} else if (streq(words[0], "unalias")) {
if (word_count == 2) {
if (MR_trace_remove_alias(words[1])) {
- printf("Alias `%s' removed.\n", words[1]);
+ if (MR_trace_internal_interacting) {
+ printf("Alias `%s' removed.\n",
+ words[1]);
+ }
} else {
printf("Alias `%s' cannot be removed, "
"since it does not exist.\n",
@@ -1963,6 +1993,8 @@
while ((line = MR_trace_getline_raw(fp)) != NULL) {
MR_insert_line_at_tail(line);
}
+
+ MR_trace_internal_interacting = FALSE;
}
/*
@@ -1983,6 +2015,7 @@
return line;
}
+ MR_trace_internal_interacting = TRUE;
printf("%s", prompt);
fflush(stdout);
More information about the developers
mailing list