Files
mercury/tests/submodules/mutable_parent.mutable_child.m
Zoltan Somogyi a618ab31e1 Insist that without mmc -f, module a.b.c be in a.b.c.m.
This should fix Mantis bug #489, which shows that without this,
the compiler can mistakenly believe that a file with a name such as lexer.m
contains a module of the standard library, rather than a submodule named
test.lexer.

compiler/parse_module.m:
    Require that :- module declarations specify the expected name.
    The name may be expected because it exactly matches the filename
    (as above), or because mmc -f has recorded the actual name
    as the expectation.

    Factor report_module_has_unexpected_name out of
    check_module_has_expected_name, since it is needed on its own.
    Simplify its code.

    Simplify the code for doing checks on :- end_module declarations.

doc/reference_manual.texi:
    Document this change in the reference manual.texi.

    Replace references to "the University of Melbourne Mercury implementation"
    with just "the Melbourne Mercury implementation".

slice/Mmakefile:
    Run mmc -f *.m before making dependencies, because the modules copied
    from mdbcomp have non-fully-qualified filenames.

*/Mmakefile:
    Delete inappropriate .PHONY directives from Mercury.modules targets.

    Include Mercury.modules among the files to be deleted by clean_local
    targets.

tests/submodules/ts.tsub.m:
    Provide the full name of this module in its :- module declaration.

tests/submodules/initialise_parent.initialise_child.m:
    Fix white space.

tests/submodules/*.*.m:
    Move separate submodules to their fully qualified filenames.
2020-01-12 22:13:01 +11:00

26 lines
795 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module mutable_parent.mutable_child.
:- interface.
:- pred run_child(io::di, io::uo) is det.
:- include_module mutable_grandchild.
:- implementation.
:- mutable(child_global, int, 200, ground,
[untrailed, attach_to_io_state]).
run_child(!IO) :-
io.write_string("In child ...\n", !IO),
get_parent_global(ParentGlobal, !IO),
get_child_global(ChildGlobal, !IO),
io.format(" parent_global = %d\n", [i(ParentGlobal)], !IO),
io.format(" child_global = %d\n", [i(ChildGlobal)], !IO),
set_parent_global(ParentGlobal + 1, !IO),
set_child_global(ChildGlobal + 1, !IO).