mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
tests/hard_coded/target_mlobjs_c.c:
Fix a bad use of printf.
tests/hard_coded/trace_goal_4.m:
tests/hard_coded/word_aligned_pointer.m:
tests/hard_coded/word_aligned_pointer_2.m:
tests/tabling/memo_non.m:
tests/tabling/table_foreign_output.m:
tests/tabling/test_enum.m:
Don't assume that MR_Integers are ints; print them using
MR_INTEGER_LENGTH_MODIFIER.
53 lines
1.5 KiB
Mathematica
53 lines
1.5 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
% Test foreign type assertion `word_aligned_pointer'.
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module word_aligned_pointer.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
:- import_module string.
|
|
|
|
:- import_module word_aligned_pointer_2.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
main(!IO) :-
|
|
% Construct values in different modules.
|
|
X = yes(make_foo),
|
|
Y = word_aligned_pointer_2.make_bar,
|
|
|
|
% Deconstruct in this module.
|
|
word_aligned_pointer.write_bar(X, !IO),
|
|
word_aligned_pointer.write_bar(Y, !IO),
|
|
|
|
% Deconstruct in the other module.
|
|
word_aligned_pointer_2.write_bar(X, !IO),
|
|
word_aligned_pointer_2.write_bar(Y, !IO).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- pred write_bar(bar::in, io::di, io::uo) is det.
|
|
|
|
write_bar(Bar, !IO) :-
|
|
(
|
|
Bar = yes(Foo),
|
|
io.format("yes(0x%x)\n", [i(get_foo(Foo))], !IO)
|
|
;
|
|
Bar = no,
|
|
io.write_string("no", !IO)
|
|
).
|
|
|
|
%---------------------------------------------------------------------------%
|