Files
mercury/tests/mmc_make/factt.m
Peter Wang 1bc5cadf25 Fix writing fact table file names in .module_dep files.
Commit 5f50259d16 inadvertently wrote out
the list of fact table file names in a .module_dep file without quoting,
so the .module_dep parser would fail to read it back.

compiler/make.module_dep_file.m:
    Write fact table file names in .module_dep files as quoted strings.

tests/mmc_make/Mmakefile:
tests/mmc_make/factt.m:
tests/mmc_make/factt_examples:
    Add a test case.
2022-12-05 17:29:03 +11:00

40 lines
1.0 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module factt.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
%---------------------------------------------------------------------------%
:- implementation.
:- import_module int.
:- import_module list.
:- import_module string.
:- pred example(int::in, int::out, int::out) is semidet.
:- pragma fact_table(example/3, "factt_examples").
%---------------------------------------------------------------------------%
main(!IO) :-
show_examples(1, !IO).
:- pred show_examples(int::in, io::di, io::uo) is det.
show_examples(Cur, !IO) :-
( if Cur > 50 then
true
else
( if example(Cur, A, B) then
io.format("%2d %2d %2d\n", [i(Cur), i(A), i(B)], !IO)
else
io.format("%2d - -\n", [i(Cur)], !IO)
),
show_examples(Cur + 1, !IO)
).