Files
mercury/browser/mdb.m
Zoltan Somogyi 9047bdbf05 Improve programming style in the browser directory.
browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/interactive_query.m:
browser/listing.m:
browser/parse.m:
browser/util.m:
    Rename some predicates to avoid ambiguity.

    Factor out common code.

    If some versions of a field of a structure have names in a predicate
    (by being stored in a named variable), then give all *other* versions
    of that field in that structure names in that predicate as well.

    If a field of a structure is used more than once in a predicate,
    then again, store it in a named variable.

    Reorder predicate arguments to put state variables last.

    Use io.format instead of sequences of calls to io.write_string.

    In declarative_user.m, note a probable bug (in a position where
    it is probably rarely stumbled upon).

    In listing.m, use a consistent naming scheme to differentiate
    between Mercury streams and their C counterparts.

    Replace if-then-else chains with switches where possible.

browser/name_mangle.m:
    Note bit rot.

browser/browse.m:
    Conform to the changes above.

library/io.m:
    Improve predicate and variable names.

browser/mdb.m:
browser/mer_browser.m:
browser/percent_encoding.m:
browser/term_rep.m:
browser/tree234_cc.m:
library/library.m:
    Improve comments.
2022-07-03 13:55:54 +10:00

74 lines
2.4 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%---------------------------------------------------------------------------%
% Copyright (C) 1998-2006 The University of Melbourne.
% Copyright (C) 2017-2018 The Mercury team.
% This file is distributed under the terms specified in COPYING.LIB.
%---------------------------------------------------------------------------%
:- module mdb.
:- interface.
:- pred mdb.version(string::out) is det.
% These interface modules are used directly by the test programs
% or the libmer_trace library.
:- include_module browse.
:- include_module browser_info.
:- include_module browser_term.
:- include_module collect_lib.
:- include_module cterm.
:- include_module debugger_interface.
:- include_module declarative_debugger.
:- include_module declarative_execution.
:- include_module diff.
:- include_module help.
:- include_module interactive_query.
:- include_module io_action.
:- include_module listing.
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
:- implementation.
:- include_module declarative_analyser.
:- include_module declarative_edt.
:- include_module declarative_oracle.
:- include_module declarative_tree.
:- include_module declarative_user.
:- include_module frame.
:- include_module parse.
:- include_module percent_encoding.
:- include_module sized_pretty.
:- include_module term_rep.
:- include_module term_to_html.
:- include_module util.
% XXX these modules are more generally useful, but the
% dynamic linking library is not yet installed anywhere.
:- include_module dl.
:- include_module name_mangle.
%---------------------------------------------------------------------------%
% See library/library.m for why we implement this predicate this way.
:- pragma foreign_proc("C",
mdb.version(Version::out),
[will_not_call_mercury, promise_pure, thread_safe],
"
MR_ConstString version_string =
MR_VERSION "", configured for "" MR_FULLARCH;
// We need to cast away const here, because Mercury declares Version
// to have type MR_String, not MR_ConstString.
Version = (MR_String) (MR_Word) version_string;
").
mdb.version("unknown version").
%---------------------------------------------------------------------------%
:- end_module mdb.
%---------------------------------------------------------------------------%