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.
Estimated hours taken: 4
Branches: main
Support impure initialise and finalise predicates in user code. In order to
support this the arity of the initialise or finalise predicate can no longer be
optionally omitted from the declaration. Supporting impure arity zero
initialise/finalise declarations removes the restriction that every module that
has an initialise/finalise declaration must import the io module.
Allow initialize/finalize to be used as synonyms for initialise/finalise.
Improve the documentation of initialise/finalise declarations.
In particular:
- mention the above changes.
- mention that they may be cc_multi.
- specify the order in which they invoked with respect to
standard library initialisation/finalisation.
- mention that these declarations are not currently available
on non-C backends.
compiler/make_hlds_passes.m:
Support impure user initialise/finalise predicates.
compiler/mercury_to_mercury.m:
Write out the arities of the predicates specified in
initialise and finalise declarations.
compiler/prog_data.m:
Add an arity field to the initialise and finalise items.
compiler/prog_io.m:
Don't allow the arity to be omitted in initialise and finalise
declarations.
compiler/module_qual.m:
compiler/modules.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the changes in the initialise and finalise items.
library/ops.m:
Add the alternate spellings of initialise and finalise to the ops
table.
doc/reference_manual.texi:
Update the ops table.
Mention that initialise and finalise predicates may be cc_multi.
Document impure initialisation and finalisation predicates.
Add some disclaimers: mutable, initialise and finalise declarations
are not implemented for the non-C backends.
tests/hard_coded/Mmakefile:
tests/hard_coded/impure_init_and_final.m:
tests/hard_coded/impure_init_and_final.exp:
Test impure initialise and finalise declarations.
tests/hard_coded/finalise_decl.m:
tests/hard_coded/intialise_decl.m:
Conform to the above changes. Also test the versions of the
declarations that use the -ize ending.
tests/hard_coded/sub-modules/finalise_parent.m:
tests/hard_coded/sub-modules/initialise_child.m:
tests/hard_coded/sub-modules/initialise_parent.m:
Conform to the above changes.
tests/invalid/bad_finalise.m:
tests/invalid/bad_finalise.err_exp:
tests/invalid/bad_initialise.m:
tests/invalid/bad_initialise.err_exp:
Extend these tests to check for missing or bad arities
in intialise or finalise declarations.
vim/syntax/mercury.vim:
Highlight recently added syntax appropriately.
Estimated hours taken: 16
Branches: main
Add support for initialisation predicates to be called before main/2 is
invoked. The new directive is `:- initialise initpredname.'
NEWS:
Mention the new functionality.
compiler/export.m:
`:- pragma export' also adds a C function declaration in the
generated C wrapper code to avoid C compiler warnings about
missing declarations.
compiler/hlds_module.m:
Added a new user_init_preds field to the module_info to
record the preds named in `initialise' directives.
Added predicates to access and update the new field.
The exported names are generated automatically.
compiler/llds.m:
Added a new field cfile_num_user_inits to c_file structure.
compiler/llds_out.m:
Add code to include the `REQUIRED_INIT initpredexportname' lines
in the comment section of the generated C that is recognised
by mkinit.
compiler/make_hlds_passes.m:
Handle the new `initialise' directives.
compiler/mercury_compile.m:
Make sure the list of user defined init pred export names is passed to
the C code construction preds.
compiler/mercury_to_mercury.m:
Handle the output of `initialise' directives.
compiler/module_qual.m:
compiler/modules.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Handle the new `initialise' item.
compiler/prog_data.m:
Add a new `initialise(sym_name)' item.
compiler/prog_io.m:
Add code to parse `initialise' directives.
compiler/prog_mode.m:
Add di_mode pred and func.
compiler/transform_llds.m:
Handle the extra field in c_file.
doc/reference_manual.texi:
Update the operator table in the reference manual.
Document the new `initialise' directive.
library/list.m:
Added index[01]_of_first_occurrence preds and
det_index[01]_of_first_occurrence funcs. I've often
had a need for these and they are used in looking up
initprednames in the new module_info field.
library/ops.m:
Add `initialise' as a prefix operator.
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
Add a new exported variable, MR_address_of_init_modules_required.
Call the function pointed to by this variable at the right point
during module initialisation.
test/hard_coded/Mmakefile:
test/hard_coded/initialise_decl.exp:
test/hard_coded/initialise_decl.m:
test/invalid/Mmakefile:
test/invalid/bad_initialise_decl.err_exp:
test/invalid/bad_initialise_decl.m:
Added test cases.
util/mkinit.c:
Now always checks C files for extra inits (previously you had to
explicitly supply the -x flag).