mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 21:35:49 +00:00
Estimated hours taken: 10 Branches: main Split the existing browser library into two libraries, by making the program_representation module into its own library. This is useful because the compiler refers to program_representation.m, whose code thus needs to be linked into compiler executables even if the compiler isn't compiled with debugging enabled. By creating a new library for this module, we avoid any chance of the linker dragging in the rest of the modules in the browser library. (This is a problem with an upcoming diff.). The name of the new library is "mdbcomp", because the intention is that it contain code that is shared between the debugger and the compiler. This means mostly the definitions of data structures that the compiler generates for the debugger, and the predicates that operate on them. Mmake.common.in: Allow MDB_COMP_ as a prefix for symbol names in the browser directory. Mmake.workspace: Add a make variable holding for the name of the new library, and add the name to the relevant lists of libraries. Avoid duplicating the lists of filenames that need to be updated when adding new libraries or changing their names. Mmakefile: Use make variables to refer to library names. browser/mdbcomp.m: browser/mer_mdbcomp.m: Add these files as the top modules of the new library. browser/program_representation.m: Make program_representation.m a submodule of mdbcomp, not mdb. browser/program_representation.m: browser/browser_info.m: Move a predicate from program_representation.m to browser_info.m to avoid the mdbcomp library depend on the browser library, since this would negate the point of the exercise. browser/mdb.m: Delete program_representation.m from the list of submodules. browser/Mmakefile: Update this file to handle the new module. browser/Mercury.options: Mention the new module. browser/*.m: Update the lists of imported modules. Import only one browser module per line. compiler/notes/overall_design.html: Document the new library. compiler/compile_target_code.m: Add the mdbcomp library to the list of libraries we need to link with. compiler/prog_rep.m: trace/mercury_trace_internal.c: Import program_representation.m by its new name. scripts/c2init.in: Centralize knowledge about which files need to be updated when the list of libraries changes here. scripts/c2init.in: scripts/ml.in: tools/binary: tools/binary_step: tools/bootcheck: tools/linear: tools/lml: Update the list of libraries programs are linked with.
46 lines
1.6 KiB
Mathematica
46 lines
1.6 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% Copyright (C) 2003 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU Library General
|
|
% Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% This is the top module of a library that contains information shared
|
|
% between the debugger and the compiler. This means mostly the definitions
|
|
% of data structures that the compiler generates for the debugger, and
|
|
% the predicates that operate on them.
|
|
%
|
|
% The compiler links in this library in all grades, but links in the mdb
|
|
% library (which also in this directory) only when debugging is enabled.
|
|
% Therefore the modules of the mdbcomp library should avoid importing any
|
|
% module of the mdb library.
|
|
|
|
:- module mdbcomp.
|
|
|
|
:- interface.
|
|
|
|
:- pred mdbcomp__version(string::out) is det.
|
|
|
|
:- include_module program_representation.
|
|
|
|
:- implementation.
|
|
|
|
% See library/library.m for why we implement this predicate this way.
|
|
|
|
:- pragma foreign_proc("C",
|
|
mdbcomp__version(Version::out),
|
|
[will_not_call_mercury, promise_pure, thread_safe],
|
|
"
|
|
MR_ConstString version_string;
|
|
|
|
version_string = MR_VERSION "", configured for "" MR_FULLARCH;
|
|
/*
|
|
** Cast away const needed here, because Mercury declares Version
|
|
** with type MR_String rather than MR_ConstString.
|
|
*/
|
|
Version = (MR_String) (MR_Word) version_string;
|
|
").
|
|
|
|
mdbcomp__version("unknown version").
|
|
|
|
%---------------------------------------------------------------------------%
|