mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-29 08:14:31 +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.
75 lines
1.4 KiB
Mathematica
75 lines
1.4 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module foreign_enum_mod2.
|
|
:- interface.
|
|
|
|
:- type instrument.
|
|
|
|
:- type ingredient
|
|
---> eggs
|
|
; sugar
|
|
; flour
|
|
; milk.
|
|
|
|
:- func my_instrument = instrument.
|
|
|
|
:- implementation.
|
|
|
|
:- type instrument
|
|
---> violin
|
|
; piano
|
|
; xylophone.
|
|
|
|
:- type foo
|
|
---> foo
|
|
; bar
|
|
; baz.
|
|
|
|
my_instrument = piano.
|
|
|
|
% This should end up in the .int file.
|
|
%
|
|
:- pragma foreign_enum("C", ingredient/0, [
|
|
foreign_enum_mod2.eggs - "EGGS",
|
|
foreign_enum_mod2.sugar - "SUGAR",
|
|
foreign_enum_mod2.flour - "FLOUR",
|
|
foreign_enum_mod2.milk - "MILK"
|
|
]).
|
|
|
|
% As should this.
|
|
%
|
|
:- pragma foreign_enum("Java", ingredient/0, [
|
|
eggs - "Ingredient.EGGS",
|
|
sugar - "Ingredient.SUGAR",
|
|
flour - "Ingredient.FLOUR",
|
|
milk - "Ingredient.MILK"
|
|
]).
|
|
|
|
% This shouldn't since the type is not exported.
|
|
%
|
|
:- pragma foreign_enum("C", foo/0, [
|
|
foo - "3",
|
|
bar - "4",
|
|
baz - "5"
|
|
]).
|
|
|
|
% This shouldn't since the type is abstract.
|
|
%
|
|
:- pragma foreign_enum("C", instrument/0, [
|
|
violin - "100",
|
|
piano - "200",
|
|
xylophone - "300"
|
|
]).
|
|
|
|
:- pragma foreign_decl("C", "
|
|
|
|
#define EGGS 10
|
|
#define SUGAR 20
|
|
#define FLOUR 30
|
|
#define MILK 40
|
|
|
|
").
|
|
|