mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
Estimated hours taken: 10 Allow modules to be put in source files whose names do not directly match their the module names. When looking for the source for a module such as `foo:bar:baz', search for it first in `foo.bar.baz.m', then in `bar.baz.m', and finally in `baz.m'. compiler/prog_io.m: Change prog_io__read_module so that it returns the name of the module read, as determined by the `:- module' declaration. Add predicate `check_module_has_expected_name', for checking that this name matches what was expected. compiler/modules.m: Add read_mod_from_file, for reading a module given the file name, and generated_file_dependencies, for generating the dependencies of a module given the file name. (As opposed to the module name.) Change read_mod and read_mod_ignore_errors so that they search for `.m' files as described above, and return the name of the source file read. Also improve the efficiency of read_dependencies slightly: when reading in `.int' files, there's no need to call split_into_submodules, because we generate a seperate `.int' file for each submodule anyway. compiler/mercury_compile.m: Change the handling of command-line arguments. Arguments ending with `.m' are assumed to be file names, and other arguments are assumed to be module names. For file names, call read_mod_from_file instead of read_mod. compiler/handle_options.m: Change help message to reflect the above change to the semantics of command-line arguments. compiler/intermod.m: compiler/trans_opt.m: Fix a bug: call prog_io__read_opt_file instead of prog_io__read_module. doc/user_guide.texi: Document the above change to the semantics of command-line arguments. Update the "libraries" chapter to reflect our support for nested modules. tests/*/*.m: tests/*/*.exp: Fix a few incorrect module names in `:- module' declarations.
93 lines
2.8 KiB
Mathematica
93 lines
2.8 KiB
Mathematica
% This program tests whether the tracer works for procedures with
|
|
% lots of arguments (beyond NUM_REAL_REGS and MAX_REAL_REGS).
|
|
% At the moment, MAX_REAL_REGS is 32, so a procedure with 41 args
|
|
% is a full test.
|
|
|
|
:- module debugger_regs_lib.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state, io__state).
|
|
:- mode main(di, uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list, int.
|
|
|
|
main -->
|
|
% The purpose of list is to force the tracer to call the Mercury
|
|
% code to print a list of integers, when the input script asks
|
|
% for the outputs of data to be printed. In the past this was
|
|
% sufficed to cause part of the C stack to be overwritten.
|
|
% It also tests whether the values of A0 etc that the tracer prints
|
|
% are derived from the register contents produced by data,
|
|
% or from the register contents left there by the code that
|
|
% prints _List.
|
|
{ data(_List,
|
|
A0, A1, A2, A3, A4, A5, A6, A7, A8, A9,
|
|
B0, B1, B2, B3, B4, B5, B6, B7, B8, B9,
|
|
C0, C1, C2, C3, C4, C5, C6, C7, C8, C9,
|
|
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9) },
|
|
io__write_string(A0),
|
|
io__write_string(A1),
|
|
io__write_string(A2),
|
|
io__write_string(A3),
|
|
io__write_string(A4),
|
|
io__write_string(A5),
|
|
io__write_string(A6),
|
|
io__write_string(A7),
|
|
io__write_string(A8),
|
|
io__write_string(A9),
|
|
io__write_string("\n"),
|
|
io__write_string(B0),
|
|
io__write_string(B1),
|
|
io__write_string(B2),
|
|
io__write_string(B3),
|
|
io__write_string(B4),
|
|
io__write_string(B5),
|
|
io__write_string(B6),
|
|
io__write_string(B7),
|
|
io__write_string(B8),
|
|
io__write_string(B9),
|
|
io__write_string("\n"),
|
|
io__write_string(C0),
|
|
io__write_string(C1),
|
|
io__write_string(C2),
|
|
io__write_string(C3),
|
|
io__write_string(C4),
|
|
io__write_string(C5),
|
|
io__write_string(C6),
|
|
io__write_string(C7),
|
|
io__write_string(C8),
|
|
io__write_string(C9),
|
|
io__write_string("\n"),
|
|
io__write_string(D0),
|
|
io__write_string(D1),
|
|
io__write_string(D2),
|
|
io__write_string(D3),
|
|
io__write_string(D4),
|
|
io__write_string(D5),
|
|
io__write_string(D6),
|
|
io__write_string(D7),
|
|
io__write_string(D8),
|
|
io__write_string(D9),
|
|
io__write_string("\n").
|
|
|
|
:- pred data(list(int)::out,
|
|
string::out, string::out, string::out, string::out, string::out,
|
|
string::out, string::out, string::out, string::out, string::out,
|
|
string::out, string::out, string::out, string::out, string::out,
|
|
string::out, string::out, string::out, string::out, string::out,
|
|
string::out, string::out, string::out, string::out, string::out,
|
|
string::out, string::out, string::out, string::out, string::out,
|
|
string::out, string::out, string::out, string::out, string::out,
|
|
string::out, string::out, string::out, string::out, string::out) is det.
|
|
|
|
data([1, 2, 3, 4, 5],
|
|
"a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9",
|
|
"b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9",
|
|
"c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9",
|
|
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9").
|