mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
Estimated hours taken: 5 Use the same method of input for the browser as for the internal tracer. Previously, the browser did input via the Mercury library and the internal tracer did input via readline (if available). This did not work properly if files were redirected into stdin, which meant that test cases could not be written for the browser. This change also adds a test case. browser/util.m: Add a predicate, util__trace_getline/4, which does input via the same method used by the internal debugger. browser/parse.m: Call util__trace_getline/4 instead of io__read_line/3. browser/browse.m: Pass the prompt to browser/parse.m as a string, rather than printing it before calling. trace/mercury_trace_internal.c: trace/mercury_trace_internal.h: Declare MR_trace_getline extern. runtime/mercury_init.h: runtime/mercury_wrapper.c: runtime/mercury_wrapper.h: util/mkinit.c: Make MR_trace_getline available to the browser via a function pointer. tests/debugger/Mmakefile: Add the new test case. tests/debugger/browser_test.m: tests/debugger/browser_test.inp: tests/debugger/browser_test.exp: The new test case. runtime/mercury_trace_base.c: runtime/mercury_trace_base.h: Export MR_tracing_not_enabled() for use by browser/util.m.
45 lines
503 B
Mathematica
45 lines
503 B
Mathematica
:- module browser_test.
|
|
:- interface.
|
|
:- import_module io.
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
:- implementation.
|
|
|
|
:- type big
|
|
---> big(big, int, big)
|
|
; small.
|
|
|
|
main -->
|
|
{ big_data(Data) },
|
|
io__print(Data),
|
|
io__write_string(".\n").
|
|
|
|
:- pred big_data(big::out) is det.
|
|
|
|
big_data(Data) :-
|
|
Data = big(
|
|
big(
|
|
big(
|
|
small,
|
|
1,
|
|
small
|
|
),
|
|
2,
|
|
small
|
|
),
|
|
3,
|
|
big(
|
|
big(
|
|
small,
|
|
4,
|
|
big(
|
|
small,
|
|
5,
|
|
small
|
|
)
|
|
),
|
|
6,
|
|
small
|
|
)
|
|
).
|
|
|