mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-25 06:14:18 +00:00
pragmas but it now emits an error message saying what pragma in the "new" foreign language interface to use instead. (That will be deleted after the next release.) Remove support for nondet foreign code from the implementation. Add some bits from the old C interface chapter of the reference manual, about linking with C object files and the c_pointer type, to the chapter on the foreign language interface; delete the rest. Add an illustration of simulating nondet foreign code with Mercury clauses and (semi)deterministic foreign_procs. doc/reference_manual.texi: Delete the old C interface chapter. Add a section on linking against C object files to the C specific section of the foreign language interface chapter. (The old version of this was quite mmake-specific, the new version attempts to minimise this.) Mention the c_pointer type in section on C foreign types. Mention that nondet foreign_procs are not allowed. Give an example to use foreign code and nondeterminism. compiler/prog_io_pragma.m: Emit error messages when any of the pragmas used by the old C interface are encountered. compiler/prog_item.m: Delete the parse tree representation of import pragmas. compiler/gcc.m: Replace `:- pragma import' declarations with `:- pragma foreign_proc' declarations for C. compiler/add_heap_ops.m: compiler/add_trail_ops.m: compiler/add_pragma.m: compiler/deep_profiling.m: compiler/det_analysis.m: compiler/equiv_type.m: compiler/erl_call_gen.m: compiler/foreign.m: compiler/goal_util.m: compiler/hlds_out_goal.m: compiler/make_hlds_passes.m: compiler/make_hlds_warn.m: compiler/mercury_to_mercury.m compiler/ml_code_gen.m: compiler/module_qual.m: compiler/modules.m: compiler/polymorphism.m: compiler/pragma_c_gen.m: compiler/proc_gen.m: compiler/prog_data.m: compiler/recompilation.version.m: Delete stuff related the old C interface. tests/hard_coded_Mmakefile: tests/hard_coded/inline_nondet_pragma_c.*: tests/hard_coded/nondet_c.*: tests/hard_coded/nondet_pragma_c_bug.*: tests/hard_coded/pragma_import.*: Delete these tests. The features they exercise are no longer supported. tests/*/*.m: Replace uses of the old C interface with the new.
38 lines
543 B
Mathematica
38 lines
543 B
Mathematica
:- module method_impl.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- typeclass c(T) where [
|
|
pred m1(T::in, int::out) is det
|
|
].
|
|
|
|
:- type foo ---> foo.
|
|
:- type bar ---> bar.
|
|
|
|
:- pred foo_m1(foo::in, string::out) is det.
|
|
|
|
:- pred foo_m2(foo::in, int::in) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- instance c(foo) where [
|
|
pred(m1/2) is foo_m1
|
|
].
|
|
:- instance c(bar) where [
|
|
pred(m1/2) is bar_m1
|
|
].
|
|
|
|
main -->
|
|
[].
|
|
|
|
:- pragma foreign_code("C", "int foo_counter = 0;").
|
|
|
|
foo_m1(_, "forty two").
|
|
|
|
foo_m2(_, _).
|
|
|
|
|