Replace __ with . as the module qualifier symbol.
Replace references to io.state with just io.
Replace DCGs with state variables.
Replace (C->T;E) syntax for if-then-elses with (if C then T else E) syntax.
Replace if-then-elses with switches when possible and where this does not
affect what is being tested.
Replace separate pred and mode declarations with predmode declarations.
Put predicate and function declarations just before the definition
of the predicate or function.
Delete unneeded module qualifications on predicate and function declarations
and definitions.
Update .exp files (and if needed, .inp files) for the line number changes
that result from the above.
For tests that have more than one .exp file and where one of those files
is affected by the above, add a section to the source file header that says
which .exp file is for what grade, with XXXs for the (as yet) unknown parts.
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.
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.
Estimated hours taken: 1
Branches: main
tests/debugger/tabled_read_unitize.m:
Declare the `unitize' C foreign_proc to be thread-safe,
This is needed to prevent deadlocks in `.par' grades, since in
those grades it acquires the global lock and then calls back
Mercury code which tries to reacquire that lock.
Estimated hours taken: 16
Branches: main
Add two new annotations for foreign_procs, tabled_for_descendant_io and
tabled_for_io_unitize.
By adding the tabled_for_descendant_io annotation to a foreign_proc with I/O
states, the programmer is asserting that the foreign_proc itself doesn't do
I/O, and nor does any foreign language code it calls, though the Mercury
predicates it calls may.
By adding the tabled_for_io_unitize annotation to a foreign_proc with I/O
states, the programmer is saying that both the foreign_proc itself and the
Mercury predicates it calls may do I/O. To avoid the I/O tabling problems
that would arise on retries from Mercury code called by the foreign_proc,
the programmer is requesting that the debugger treat calls to the foreign_proc
as a unit. This means that if I/O tabling is turned on, then the implementation
will disable both debugging and I/O tabling inside Mercury code called from
the foreign_proc.
compiler/prog_data.m:
Add the tabled_for_descendant_io and tabled_for_io_unitize annotations.
Parameterize the eval_table_io eval_method to accommodate the
unitization of foreign_procs.
compiler/prog_io_pragma.m:
Add code to read in the tabled_for_descendant_io and
tabled_for_io_unitize annotations.
compiler/table_gen.m:
Handle the new annotations. Procedures with tabled_for_descendant_io
annotations don't need to be transformed at all; procedures with
tabled_for_io_unitize annotations need a small variation of the
existing transformation.
Fix an existing bug that made the HLDS not type-correct. Create new
variables with the appropriate type; do not assume all new variables
are c_pointers, since some are integers.
library/table_builtin.m:
Add two new predicates that table_gen.m emits calls to on either side
of the code of foreign_procs with tabled_for_io_unitize annotations.
compiler/hlds_out.m:
compiler/layout_out.m:
compiler/mercury_to_mercury.m:
Update the mechanisms for printing out eval methods.
compiler/hlds_pred.m:
Update the mechanisms for performing tests on eval methods.
Change some of the predicates involved to functions, partly in order
to make future maintenance easier.
compiler/det_analysis.m:
compiler/det_report.m:
compiler/make_hlds.m:
compiler/modes.m:
Conform to the change from predicates to functions.
runtime/mercury_trace_base.c:
Update the documentation of MR_trace_enabled.
runtime/mercury_stack_layout.h:
Add names for the new eval methods.
trace/mercury_trace.c:
Handle the new eval methods.
tests/debugger/tabled_read_unitize.{m,inp,exp,data}:
A new test case to check the handling of unitized foreign_procs.
tests/debugger/Mmakefile:
Turn on the new test case.