[m-dev.] diff: echo commands correctly without readline
Mark Anthony BROWN
dougl at cs.mu.OZ.AU
Thu May 6 14:04:33 AEST 1999
Hi,
This fixes a bug which caused tests/debugger/queens.m to fail when
readline was not being used. Readline only echoes commands that come
from the input stream, not commands that were placed in the line queue
in the internal debugger. Previously, if readline was not used then
all commands were echoed, which meant that "retry" was echoed twice
in some circumstances.
Estimated hours taken: 2
trace/mercury_trace_internal.c:
Echo commands immediately after calling MR_trace_readline, if
readline is not being used, rather than while processing the
command. This is to ensure that echoing behaviour is the same
regardless of whether readline is being used or not.
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.40
diff -u -r1.40 mercury_trace_internal.c
--- mercury_trace_internal.c 1999/04/30 06:21:49 1.40
+++ mercury_trace_internal.c 1999/05/05 03:38:25
@@ -443,14 +443,6 @@
MR_insert_line_at_head(MR_copy_string(semicolon + 1));
}
- /* if we're using readline, then readline does the echoing */
-#ifdef MR_NO_USE_READLINE
- if (MR_echo_commands) {
- fputs(line, MR_mdb_out);
- putc('\n', MR_mdb_out);
- }
-#endif
-
problem = MR_trace_parse_line(line, &words, &word_max, &word_count);
if (problem != NULL) {
fflush(MR_mdb_out);
@@ -2245,7 +2237,17 @@
MR_trace_internal_interacting = TRUE;
- return MR_trace_readline(prompt, MR_mdb_in, MR_mdb_out);
+ line = MR_trace_readline(prompt, MR_mdb_in, MR_mdb_out);
+
+ /* if we're using readline, then readline does the echoing */
+#ifdef MR_NO_USE_READLINE
+ if (MR_echo_commands) {
+ fputs(line, MR_mdb_out);
+ putc('\n', MR_mdb_out);
+ }
+#endif
+
+ return line;
}
/*
--
Mark Brown (dougl at cs.mu.oz.au) )O+ | For Microsoft to win,
MEngSc student, | the customer must lose
Dept of Computer Science, Melbourne Uni | -- Eric S. Raymond
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list