Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/debugger_interface.m:
browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_edt.m:
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_test.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/diff.m:
browser/dl.m:
browser/frame.m:
browser/help.m:
browser/interactive_query.m:
browser/io_action.m:
browser/listing.m:
browser/mdb.m:
browser/mer_browser.m:
browser/name_mangle.m:
browser/term_rep.m:
browser/tree234_cc.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
browser/MDB_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
Packages are modules whose only job is to serve as a container for submodules.
Modules like top_level.m, hlds.m, parse_tree.m and ll_backend.m are packages
in this (informal) sense.
Besides the include_module declarations for their submodules, most of the
packages in the compiler used to import some modules, mostly other packages
whose component modules their submodules may need. For example, ll_backend.m
used to import parse_tree.m. This meant that modules in the ll_backend package
did not have to import parse_tree.m before importing modules in the parse_tree
package.
However, this had a price. When we add a new module to the parse_tree package,
parse_tree.int would change, and this would require the recompilation of ALL
the modules in the ll_backend package, even the ones that did NOT import ANY
of the modules in the parse_tree package.
This happened even at one remove. Pretty much all modules in every one
of the backend have to import one or more modules in the hlds package,
and they therefore have import hlds.m. Since hlds.m imported transform_hlds.m,
any addition of a new middle pass to the transform_hlds package required
the recompilation of all backend modules, even in the usual case of the two
having nothing to do with each other.
This diff removes all import_module declarations from the packages,
and replaces them with import_module declarations in the modules that need
them. This includes only a SUBSET of their child modules and of the non-child
modules that import them.
Estimated hours taken: 3
Branches: main
Clean up in unused module imports in the Mercury system detected
by --warn-unused-imports.
analysis/*.m:
browser/*.m:
deep_profiler/*.m:
compiler/*.m:
library/*.m:
mdbcomp/*.m:
profiler/*.m:
slice/*.m:
Remove unused module imports.
Fix some minor departures from our coding standards.
analysis/Mercury.options:
browser/Mercury.options:
deep_profiler/Mercury.options:
compiler/Mercury.options:
library/Mercury.options:
mdbcomp/Mercury.options:
profiler/Mercury.options:
slice/Mercury.options:
Set --no-warn-unused-imports for those modules that are used as
packages or otherwise break --warn-unused-imports, e.g. because they
contain predicates with both foreign and Mercury clauses and some of
the imports only depend on the latter.
Estimated hours taken: 1
Branches: main
Use `pragma foreign_export' in preference to `pragma export' throughout
the Mercury distribution.
Convert more of the extras distribution to four-space indentation and
other minor cleanups.
browser/*.m:
library/*.m:
samples/*:
extras/*:
As above.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 2
Branches: main
browser/*.m:
Replace __ with . as the module qualifier everywhere in all the modules
of the browser directory. Convert the currently tab-indented modules
to four-space indentation. Delete some unnecessary module
qualifications. Change some type names and function symbols to avoid
ambiguities. Replace a bunch of uses of DCGs with state variable
notation.
Estimated hours taken: 8
Branches: main
Add two new capabilities to the debugger.
The first capability is the idea of "held variables", variables that the
debugger holds onto even when execution has left the event they came from.
You can hold onto a variable via the mdb command "hold varname heldvarname".
You can suffix the name of the existing variable with a term path, in which
case the new held variable will refer only to the specified part of the term.
Later mdb commands can refer to the held variable by prefixing its name with
a dollar sign. For example, after "hold HeadVar__1^2 x", "$x" will refer to
the term that was the second argument of HeadVar__1 at the program point
at which the "hold" command was executed.
The second capability is the ability to compute the diff of two terms and
express those diffs as the term paths of the function symbols at which the two
terms differ, instead of the line numbers you get by using save_to_file and the
usual Unix diff command. The mdb command is "diff var1 var2". We limit the
number of term paths of difference sites that we display at any one time;
the mdb diff command has options to control this.
NEWS:
Mention the new capabilities.
doc/user_guide.texi:
Document the new mdb commands "hold" and "diff", the new mdb command
"held_vars" which simply lists the names of all the held variables
(just as "vars" lists the names of all the nonheld variables currently
accessible), and the concept of held variables.
doc/mdb_categories:
Update this file for the new mdb commands and concepts.
browser/browse_diff.m:
This new module implements the diff operation on terms.
browser/mdb.m:
Add the new module to the list of submodules of the mdb package.
browser/*.m:
Minor cleanups, such as importing only one module per line; there
are no algorithmic changes.
trace/mercury_trace_hold_vars.[ch]:
This new module implements the database of held variables.
trace/Mmakefile:
Mention the new module.
trace/mercury_trace_internal.c:
Implement the three new mdb commands.
trace/mercury_trace_vars.[ch]:
Modify the functions that recognize variable specifications or
process them to work with held variables as well as variables from
the current environment. This required some reorganization of the
internals of this module.
Provide some a utility function, MR_trace_parse_lookup_var_path,
for converting a string representing the specification of a term
(a variable and possibly some path within it) to the type and value
of that term. Make the utility function this is based upon,
MR_lookup_unambiguous_var_spec, replace the previous but less capable
MR_convert_var_spec_to_type_value.
trace/mercury_trace_spy.c:
Conform to the change in mercury_trace_vars.c.
trace/mercury_trace_util.c:
Make a utility function more robust.
trace/mercury_trace_alias.c:
Minor cleanups.
tests/debugger/queens.{inp,exp*}:
Update this test case to test the debugger's new capabilities.
tests/debugger/completion.{inp,exp*}:
Update this test case to expect the new mdb commands, and avoid the
ambiguity between "help" and "held_vars".