mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
77 lines
1.2 KiB
Mathematica
77 lines
1.2 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
|
|
:- module no_inline.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
|
|
:- pragma promise_pure(main/2).
|
|
main -->
|
|
{
|
|
impure bar(A),
|
|
impure bar(B),
|
|
impure bar(C),
|
|
impure bar(D)
|
|
},
|
|
io__write([A, B, C, D]),
|
|
io__write_string("\n").
|
|
|
|
:- pragma no_inline(bar/1).
|
|
:- impure pred bar(int::out) is det.
|
|
|
|
:- pragma foreign_proc("C",
|
|
bar(Value::out),
|
|
[will_not_call_mercury],
|
|
"
|
|
{
|
|
static int counter = 0;
|
|
|
|
Value = counter++;
|
|
}
|
|
").
|
|
|
|
:- pragma foreign_code("C#",
|
|
"
|
|
static int counter = 0;
|
|
").
|
|
:- pragma foreign_proc("C#",
|
|
bar(Value::out),
|
|
[],
|
|
"
|
|
Value = counter++;
|
|
").
|
|
|
|
:- pragma foreign_code("Java",
|
|
"
|
|
static int counter = 0;
|
|
").
|
|
:- pragma foreign_proc("Java",
|
|
bar(Value::out),
|
|
[],
|
|
"
|
|
Value = counter++;
|
|
").
|
|
|
|
:- pragma foreign_proc("Erlang",
|
|
bar(Value::out),
|
|
[],
|
|
"
|
|
case get(counter) of
|
|
undefined ->
|
|
Value = 0;
|
|
C ->
|
|
Value = C
|
|
end,
|
|
put(counter, Value + 1)
|
|
").
|