*/Mercury.options:
Specify module-specific Mercury compiler flags using
MCFLAGS-modulename += options
instead of
MCFLAGS-modulename = options
because unlike the latter, the former allows Mmake.params files
to add other options.
... instead of building a bunch of .c files.
Our tradition of adding an "s" at the end of a suffix to mean "all of the
files with the original suffix" had a problem when we added C# as a target
language. Until then, just as "os" stood for ".o files" when it occurred
as either a mmake target, mmc --make target, or mmake variable name component.
"cs" likewise stood for ".c files", but was now also needed to mean ".cs file".
We coped by keeping "cs" meaning ".c files", and adding "csharp" as a target
name synonym to mean ".cs file".
This diff keeps that synonym, but it changes
- the name needed to refer to ".c files" from "cs" to "all_cs"
- the name needed to refer to ".o files" from "os" to "all_os"
- the name needed to refer to ".pic_o files" from "pic_os" to "all_pic_os"
- the name needed to refer to ".cs files" from "css" to "all_css"
- the name needed to refer to ".java files" from "javas" to "all_javas"
- the name needed to refer to ".opt files" from "opts" to "all_opts"
- the name needed to refer to ".trans_opt files"
from "trans_opts" to "all_trans_opts"
It would be nice if we could apply this same change to all other similar
target names and mmake variable name suffixes, such as "ints" and "int3s",
but some of those names are already in use to mean semantically different
things. All of the names above that used to have the form "<ext>s" and
now have the form "all_<ext>s" stood for all the files with extension
".<ext>" that are prerequisites for building a linked target, i.e.
an executable or a library. But the mmake variable name suffixes
".all_mihs", ".all_mhs" and ".all_int0s" each stand for something subtly
different: the names of files that *may or may not exist", but which,
if they do exist, should be deleted by a clean or realclean target.
To make this breaking change easier to handle by users, this diff does
not simply redefine the meaning of ".all_int0s". (It does change the meaning
of the "cs" target, but the fact this will happen at some time has been
announced ages ago.) Instead, it defines three new mmake var suffixes,
".mihs_to_clean", ".mhs_to_clean" and ".int0s_to_clean", which are
synonyms for ".all_mihs", ".all_mhs" and ".all_int0s" respectively,
and announces that ".all_mihs", ".all_mhs" and ".all_int0s" are being
deprecated, and will have the above change of semantics applied to them
in the future.
NEWS.md:
Announce the breaking change.
compiler/make.top_level.m:
Stop treating the target "cs" as meaning "build all the .c files
for this program".
The code of classify_target_2 has long been semidet, but only in a way
that was not apparent to the compiler. Change the code to allow the
compiler to see its semidet nature while keeping the algorithm the same,
except for the change in the paragraph above.
This includes keeping e.g. "ints" as meaning "build all the .int/.int2
files needed by this program".
compiler/write_deps_file.m:
Stop generating mmake variables with suffixes ".cs", ".os", ".pic_os",
".javas" and ".css". The mmake variables with suffixes ".all_cs",
".all_os", ".all_pic_os", ".all_javas" and ".all_css" already existed.
All had the same value as the mmake variable without the "all",
with one exception: ".cs". However, in this case, the old (and still
current) value of ".all_cs" is what the value of ".cs" *should* have been.
Simplify some code.
The following changes in compiler/*.m are only cosmetic, but they helped me
rule out possible sources of problems with incomplete versions of this diff.
compiler/file_names.m:
Add a version of a fact_table_file_name_return_dirs which does not
return directories, since most of its callers don't need that info.
compiler/make.program_target.m:
Clarify code by making variable names more descriptive,
compiler/make.file_names.m:
compiler/make.module_target.m:
Conform to the changes above,
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
grade_lib/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
Rename os to all_os, cs to all_cs, css to all_css, javas to all_javas,
and opts to all_opts. (There were no occurrences of trans_opts to rename.)
Replace [s as sh command names in actions.
scripts/Mmake.vars.in:
Specify the names of mmake variables holding the names of sets of files
with a given extension directly, since for some of them, adding an "s"
at the end of the name of the extension does not generate the name
of the corresponding mmake variable anymore.
scripts/Mmake.rules:
Use the directly specified mmake variable names from Mmake.vars.in
in the rule for installing lbraries. Temporarily add some debugging
output to make suree that the updated nested mmake variable references
work as intended.
tools/bootcheck:
Specify the names of mmake targets for making all the files in a program
with a given extension directly, since adding an "s" at the end of the
name of the extension does not generate the name of the corresponding
mmake target anymore.
Print timestamps around the action of checking namespace cleanliness,
to allow the time taken by that action to be measured. (I kept track
of bootchecks as they happened while working on this diff, and found
this time to be nontrivial.)
configure.ac:
Require the installed compiler to support --allow-insts-as-modes
(and therefore its negation).
*/*_FLAGS.in:
Add -no-allow-ho-insts-as-modes as a default option.
compiler/bytecode_data.m:
compiler/deforest.m:
compiler/inst_graph.m:
compiler/introduce_parallelism.m:
compiler/mode_constraint_robdd.m:
compiler/mode_constraints.m:
compiler/mode_robdd.equiv_vars.m:
compiler/mode_robdd.implications.m:
compiler/mode_robdd.tfeirn.m:
compiler/parse_util.m:
compiler/recompilation.version.m:
compiler/set_of_var.m:
compiler/term_constr_fixpoint.m:
deep_profiler/array_util.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/dump.m:
deep_profiler/interface.m:
deep_profiler/program_representation_utils.m:
mdbcomp/program_representation.m:
Add in() wrappers around higher order insts used as modes.
Use simply "in" as the mode of functions with the default mode
and determinism.
Fix a few style issues.
Each of the new modules, and the updated browse.m, have significantly more
cohesion than the original browse.m.
browser/print_term.m:
A new module containing the parts of the old browse.m that dealt with
printing out terms or their components.
This module exports its services to the updated browse.m and
to trace/mercury_trace_vars.c.
browser/save_term.m:
A new module containing the parts of the old browse.m that dealt with
dumping terms to files.
This module exports its services to trace/mercury_trace_browse.c.
browser/term_paths.m:
A new module containing the parts of the old browse.m that dealt with
operations on paths in terms.
This module exports its services to the updated browse.m,
declarative_user.m, and print_term.m.
browser/browse.m:
Delete the code moved to the new modules.
browser/mdb.m:
Include the three new modules.
browser/term_to_html.m:
Add module qualifiers to some calls to reduce ambiguity.
browser/declarative_user.m:
ssdb/ssdb.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_vars.c:
Conform to the changes above.
browser/browse.m:
Group related predicates together,
Give predicates that implement browser commands a name that
reflects this fact.
Use state variables where this helps.
Stop exporting predicates that are used only in this module.
Add consider_used pragmas for unused predicates.
browser/MDB_FLAGS.in:
Enable --warn-dead-preds by default for all modules in this directory.
browser/browser_info.m:
Stop exporting predicates that are used only in this module.
Add consider_used pragmas for unused predicates.
browser/parse.m:
Add consider_used pragmas for unused predicates.
browser/browse.m:
Instead of passing a maybe(format) value to override a (to be calculated)
default value to the portray predicate and its variants, pass just
the selected format value.
The baffling bug was this:
mdb> p *
...
STATE_VARIABLE_Specs_0 (arg 4)
STATE_VARIABLE_Specs (arg 5) [conditional_spec("predicate `parse_tree.module_qual.qual_errors.warn_unused_interface_import'/4", warn_unused_interface_imports, yes, severity_warning, phase_parse_tree_to_hlds, [simplest_msg/2])]
mdb> p 4
STATE_VARIABLE_Specs_0 (arg 4)
[]
The baffling part was that "print *" did NOT print the value of !.Specs,
but "print 4" did.
browser/browse.m:
Fix this ancient bug. The problem was that "print *" DID in fact
print the value of !.Specs, but it printed it to the current output
stream in the program being debugged, which was NOT stdout at the time.
(This is quite rare, and it must be why this bug hasn't been fixed,
or probably even encountered, before now.)
The reason for the difference in the behavior of "print *" and "print 4"
is that
- the bug existed only in the code the implementation of the "flat"
format, which wrote to the current output stream; the code implementing
the other three formats (verbose, pretty and raw_pretty) write to
the selected debugger stream, which is set up correctly, and
- by default, "print *" selects the flat format, and "print 4" selects
one of the other formats.
The fix is to make the "flat" format write to the selected debugger
stream as well.
browser/io_action.m:
Use don't-care variables to handle the I/O state in a foreign_proc.
This avoids a warning about using an uninitialized variable from MSVC.
library/term_io.m:
Move the base operations of term_io.m to the structure we use
in parse_tree_out*.m in the compiler, where for every type X,
there is a function X_to_string, and two predicates write_X and format_X,
with the former operating on I/O states, and the latter operating on
arbitrary streams. The idea is to apply the "don't repeat yourself"
principle by having both X_to_string and write_X just call format_X.
Apply that principle here as well, with one minor exception,
which is that for some values of X, both write_X and format_X are
implemented in terms of X_to_string.
Impose the X_to_string, write_X, format_X naming scheme. The ancient code
already in term_io.m had (each for some values of X) had
- some of these functions/predicates missing
- inconsistent names, in that write_X/N did I/O while write_X/(N+1)
wrote to arbitrary streams
- names that were inconsistent in another way, in that write_X/N did
I/O of values of type X, but the function to convert X to string
was NOT named X_to_string.
Keep some of the misnamed functions around permanently, because
some of the names for fitting into the new scheme, such as
"escaped_string_to_string", would be strange.
Keep the rest of the misnamed functions and all the misnamed predicates
around temporarily, with commented-out obsolete pragmas. I expect
to make these pragmas active when the rest of term_io.m is converted
to this scheme.
To prepare for that, use string.builder, not string, as the
stream.writer instance to implement X_to_string, because of its
better algorithmic complexity, which is needed mainly for terms
of nontrivial size.
Consistently put operations on each X in the order X_to_string,
write_X and format_X.
NEWS.md:
List all the new predicates and functions.
configure.ac:
Require the installed compiler to contain the fix which allows
a typespec pragma for an obsolete predicate or function.
browser/interactive_query.m:
compiler/hlds_out_util.m:
compiler/parse_tree_out_clause.m:
compiler/parse_tree_out_cons_id.m:
compiler/parse_tree_out_info.m:
compiler/parse_tree_out_pragma.m:
compiler/parse_tree_out_sym_name.m:
compiler/parse_tree_out_type_repn.m:
library/pretty_printer.m:
library/stream.string_writer.m:
library/string.builder.m:
mdbcomp/trace_counts.m:
Update all references to the newly-obsolete predicates and functions.
library/string.to_string.m:
Improve variable names.
The usual mdb "dump" command puts every function symbol on its own line.
This guarantees that we generate any line that is too long to be displayed
on terminals, but it also generates output that is too stretched out
vertically for its structure to be readily apparent. Dumping the term
as a doc allows pretty_printer.m to put as many function symbols on a line
as would fit, without exceeding the maximum line length.
browser/browse.m:
Add save_term_to_file_doc, a way to save a (possibly synthetic)
browser term in a file, using an interface that works the same way
the predicate that saves browser terms as XML.
Inline a predicate at its only call site. Improve variable names.
trace/mercury_trace_browse.[ch]:
Add MR_trace_save_term_as_doc, as an interface function between
save_term_to_file_doc and the code of mercury_trace_cmd_browsing.c.
trace/mercury_trace_cmd_browsing.c:
Add support for a new -p/--prettyprint flag to the mdb "dump" command,
which asks for the given term to be dumped as a pretty_printer doc.
doc/user_guide.texi:
NEWS:
Document the new option.
library/pretty_printer.m:
NEWS:
Rename write_as_doc to write_doc_formatted, and fix its argument type.
tests/debugger/browser_test.inp:
Dump a term that we already dumped with "dump" with "dump -x" and
"dump -p" as well.
tests/debugger/browser_test.m:
Put the code to remove the files we are going to dump to
and then later to print the files we have dumped to into separate
predicates. This keeps most (but not all) line numbers unchanged
even though we now dump to more files.
tests/debugger/browser_test.exp3:
Update this file to account both for the extra output from the just-added
dump commands, and for the changes in line numbers.
Implement the error handling proposals from February 2022 on the
mercury-users list, and August 2022 on the mercury-reviews list.
We add io.system_error to the public interface of io.m
and document what its foreign representation is for each backend.
We allow io.error to optionally contain an io.system_error value,
and provide predicates to retrieve the io.system_error from an io.error.
The user may then inspect the system error via foreign code.
We also provide a predicate that takes an io.error and returns a name
for the system error it contains (if any). This makes it relatively easy
for Mercury programs to check for specific error conditions.
By returning platform-specific (actually, implementation-dependent)
error names, we are pushing the responsibility of mapping strings to
error conditions onto the application programmer. On the other hand, it
is not practical for us to map all possible system-specific error codes
to some common set of values. We could do it for a small set of common
error codes/exceptions, perhaps.
The standard library will construct io.error values containing
io.system_errors. However, we do not yet provide a facility for user
code to do the same.
library/io.m:
Move io.system_error to the public interface.
Change the internal representation of io.error to support containing
a io.system_error. An io.system_error may originate from an errno
value or a Windows system error code; the constructor distinguishes
those cases.
Add predicates to retrieve a system_error from io.error.
Add predicate to return the name of the system error in an io.error.
Replace make_err_msg with make_io_error_from_system_error.
Replace make_maybe_win32_err_msg with
make_io_error_from_maybe_win32_error.
Delete ML_make_err_msg and ML_make_win32_err_msg macros.
browser/listing.m:
library/bitmap.m:
library/dir.m:
library/io.call_system.m:
library/io.environment.m:
library/io.file.m:
library/io.text_read.m:
mdbcomp/program_representation.m:
Conform to changes.
Leave comments for followup work.
tools/generate_errno_name:
tools/generate_windows_error_name:
Add scripts to generate mercury_errno_name.c and
mercury_windows_error_name.c.
runtime/Mmakefile:
runtime/mercury_errno_name.c:
runtime/mercury_errno_name.h:
runtime/mercury_windows_error_name.c:
runtime/mercury_windows_error_name.h:
Add MR_errno_name() and MR_win32_error_name() functions,
used by io.m to convert error codes to string names.
tests/hard_coded/null_char.exp:
Update expected output.
Most modules that imported the old term.m need only a small subset
of its functionality. After this diff, most modules that used to import
term.m will need to import just one more module, and will import many
fewer predicates and functions in total.
library/term_int.m:
A new module carved out of term.m containing the predicates
that recognize terms containing integers, and the functions
that construct such terms.
While this job has *some* similarity to the job of the existing
term_conversion.m module, most modules in the compiler use only one
of those two modules, so merging them would not be a good idea.
library/term_subst.m:
A new module carved out of term.m containing code to do
substitutions and renames of various kinds.
Rename the occurs predicate as var_occurs_in_subst_term,
and occurs_list as var_occurs_in_subst_terms, since the latter
are much more descriptive. Change the argument order to match
the new names (var, subst, term/terms), as the old one did not
even have the term/terms and the substitution next to each other,
even though neither makes sense without the other.
library/term_unify.m:
A new module carved out of term.m containing code to do unifications.
Give all the predicates more meaningful names:
unify_term -> unify_terms
unify_term_list -> unify_term_lists
unify_term_dont_bind -> unify_terms_dont_bind
unify_term_list_dont_bind -> unify_term_lists_dont_bind
list_subsumes -> first_term_list_subsumes_second
library/term_vars.m:
A new module carved out of term.m containing code that find variables
in terms.
Give all the predicates more meaningful names:
vars -> vars_in_term
vars_2 -> vars_in_term_acc
vars_list -> vars_in_terms
contains_var -> term_contains_var
contains_var_list -> terms_contain_var
Don't move the function version of vars_2 to term_vars.m, effectively
deleting it, since operations that update an accumulator are awkward
for functions.
library/term.m:
Keep the moved predicates and functions in term.m, but
- change their implementation to simply call the moved copy, and
- obsolete the original in favor of the moved copy.
Eventually, after either the next release or the release after the next,
we should delete the obsoleted predicates and functions.
library/MODULES_DOC:
library/library.m:
Add the new modules as documented parts of the standard library.
browser/interactive_query.m:
compiler/analysis.file.m:
compiler/det_util.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/make_hlds_passes.m:
compiler/parse_class.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_item.m:
compiler/parse_mutable.m:
compiler/parse_pragma.m:
compiler/parse_pragma_analysis.m:
compiler/parse_sym_name.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_defn.m:
compiler/parse_util.m:
compiler/prog_ctgc.m:
compiler/prog_util.m:
compiler/recompilation.used_file.m:
compiler/recompilation.version.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/typecheck.m:
library/io.m:
library/term_conversion.m:
library/varset.m:
Conform to the changes above.
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.
browser/declarative_oracle.m:
Optimize table lookups when checking whether a procedure is trusted.
Instead of doing three separate lookups to test
- whether the module in which the procedure is in is trusted,
- whether the Mercury standard library is trusted, and this module
is in the Mercury standard library, and
- whether the predicate or function the procedure is in is trusted,
look up the module the procedure is in just once, then
- replace both of the first two lookups above with testing a single flag
each, and then
- look up the procedure in a map of trusted predicate or function names.
The last test should be faster than its old equivalent, because the map
it searches will be local to the module, whereas it used to be global.
Print the list of trusted entities (which this module calls trusted
"objects") in the same order regardless of whether we are printing
for users or as commands. The order will be the order in which they were
trusted.
Undo an unnecessary capitalization in the list of trusted objects.
browser/declarative_debugger.m:
Improve the style of some related code.
tests/debugger/save.exp:
tests/declarative_debugger/skip.exp:
tests/declarative_debugger/trust.exp:
Expect the changes described above in the list of trusted objects.
browser/declarative_oracle.m:
The code that checks whether the declarative debugger should trust
a module because it is a standard library module was apparently written
before any of module in the standard library had submodules, because
it checked the unqualified name of the module in question against
the *qualified* module names returned by the mercury_std_library_module
predicate.
For a long time after we had submodules such as thread.mvar.m in the
standard library, this caused no test failures, because our tests
did not execute code in those submodules. This changed with the breakup
of io.m. The move of the output_stream_2 predicate from io.m, which
this code recognized as trusted, to io.stream_ops.m, which it did not,
caused the declarative debugger to ask questions about the validity
of calls to it, which the caused the failure of the declarative_debugger/
all_trusted test case, due to its .inp file containing something other
than the corresponding answers.
Fix this for the case of module names of the forms a.b and a.b.c.
library/library.m:
Add a note to the mercury_std_library_module predicate to update
the code in declarative_oracle.m if we ever add a library module
whose fully qualified name has the form a.b.c.d.
tests/debugger/user_event_shallow.exp:
Update the expected output of this test for some ancient change.
tests/debugger/Mercury.options:
Specify the optimization level for the user_event_shallow test,
which eliminates one source of variability in the output.
Another source is intermodule optimization, which this diff does *not*
eliminate.
tests/debugger/all_solutions.exp:
tests/debugger/all_solutions.exp2:
tests/debugger/all_solutions.exp3:
tests/debugger/all_solutions.exp4:
tests/debugger/all_solutions.m:
The output of this test case in debug grades with intermodule optimization
did not match any of the .exp* files, though it differed from .exp2 only
in the text of an error message. (The difference was not a bug.)
Instead of adding this expected output as .exp5, use it to replace
the .exp3 file. This expected output file could not have been matched
in the last seven years, because it expects main/2 to be on line 16,
and that predicate's context has been line 20 since 2015.
Document the fact that .exp3 is the expected output for debug grade
bootchecks with intermodule optimization. This documentation changes
line numbers yet again, so update the line numbers in all the *other*
.exp* files as well.
tests/declarative_debugger/Mmakefile:
Fix indentation.
library/io.m:
library/io.stream_db.m:
Move the data types describing the stream database, and the
predicates and functions managing and accessing it, to the new
submodule io.stream_db.m. Move the declarations and definitions
of the global variables holding the dabase accordingly.
library/MODULES_UNDOC:
library/library.m:
List the new module as an undocumented new module.
browser/browse.m:
browser/browser_info.m:
library/stream.string_writer.m:
Get stream information from the new module.
library/io.call_system.m:
library/io.m:
As above.
browser/listing.m:
compiler/process_util.m:
Conform to the change above.
library/io.environment.m:
Delete stray ZZZ.
library/io.call_system.m:
Move the code in the "system access predicates" section of io.m
to this new module.
library/io.environment.m:
Move the predicates dealing with environment variables in io.m
to this new module.
library/io.m:
Delete the code moved to the new modules.
Leave behind in io.m "forwarding predicates", predicates that do nothing
except call the moved predicates in the new modules, to provide backward
compatibility. But do mark the forwarding predicates as obsolete,
to tell people to update their (at their leisure, since the obsoleteness
warning can be turned off).
Also leave behind in io.m the definitions of the types used
by some parameters of some of the moved predicates.
library/MODULES_DOC:
List the new modules among the documented modules.
library/library.m:
List the new modules, including io.file.m (added in a previous change)
among the documented standard library modules.
NEWS:
Announce the changes.
browser/browse.m:
browser/interactive_query.m:
compiler/fact_table.m:
compiler/handle_options.m:
compiler/make.module_target.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/optimize.m:
compiler/options_file.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
library/io.file.m:
mdbcomp/trace_counts.m:
ssdb/ssdb.m:
tests/general/environment.m:
tests/hard_coded/closeable_channel_test.m:
tests/hard_coded/setenv.m:
tests/hard_coded/system_sort.m:
Call the moved predicates directly in their new modules,
not indirectly through io.m.
library/io.file.m:
library/io.m:
Move two sections of io.m, the "file handling predicates" section
and the "handling temporary files" section to the new submodule io.file.m.
Leave behind in io.m "forwarding predicates", predicates that do nothing
except call the moved predicates in io.file.m, to provide backward
compatibility. But do mark the forwarding predicates as obsolete,
to tell people to update their (at their leisure, since the obsoleteness
warning can be turned off).
Also leave behind in io.m the definitions of the two types used
by some parameters of some of the moved predicates. Document the reason
why this is done.
library/MODULES_DOC:
List the new module among the documented modules.
NEWS:
Announce the changes.
browser/browse.m:
browser/interactive_query.m:
browser/listing.m:
compiler/analysis.file.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/fact_table.m:
compiler/file_util.m:
compiler/handle_options.m:
compiler/make.build.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/parse_module.m:
compiler/passes_aux.m:
compiler/prog_event.m:
compiler/recompilation.check.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
library/dir.m:
mdbcomp/program_representation.m:
ssdb/ssdb.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
In two modules, add a #include of fcntl.h in C code. These modules contain
C code that needs this #include, but until now, they got it via a copy
in an automatically generated C header file of a foreign_decl pragma
in io.m that contained that #include. This diff moves that foreign_decl
to io.file.m, removing that crutch.
tests/debugger/browser_test.m:
tests/hard_coded/bit_buffer_test.m:
tests/hard_coded/bitmap_test.m:
tests/hard_coded/construct_bug.m:
tests/hard_coded/dir_fold.m:
tests/hard_coded/dir_test.m:
tests/hard_coded/read_binary_int16.m:
tests/hard_coded/read_binary_int32.m:
tests/hard_coded/read_binary_int64.m:
tests/hard_coded/read_binary_uint16.m:
tests/hard_coded/read_binary_uint32.m:
tests/hard_coded/read_binary_uint64.m:
tests/hard_coded/read_bitmap_size.m:
tests/hard_coded/remove_file.m:
tests/hard_coded/write_binary.m:
tests/hard_coded/write_binary_int8.m:
tests/hard_coded/write_binary_multibyte_int.m:
tests/hard_coded/write_binary_uint8.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
Their replacements are the corresponding predicates in mercury_term_parser.m,
which they forwarded all their work to anyway.
library/term_io.m:
As above.
library/mercury_term_parser.m:
Move the definition of a type needed by the read_term* predicates
here from term_io.m.
NEWS:
Document the deletion.
browser/interactive_query.m:
compiler/fact_table.m:
compiler/parse_module.m:
compiler/recompilation.used_file.m:
library/io.m:
Conform to the change above.
tests/debugger/interpreter.m:
tests/general/interpreter.m:
Use read_term* from mercury_term_parser, not term_io.
These two tests started out as versions of the same file once upon a time,
but have diverged since. Replace them both with a single version that
works in both test directories, and has updated programming style.
tests/debugger/interpreter.exp2:
tests/debugger/interpreter.inp:
tests/general/interpreter.exp:
Conform to the changes (renames of some predicates, inlining of others,
using explicit streams, never complaining about empty argument lists,
and always printing query results) in interpreter.m.
tests/hard_coded/bug383.m:
tests/hard_coded/term_io_test.m:
Use read_term* from mercury_term_parser, not term_io.
In bug383.m, resolve an old type ambiguity to avoid a warning.
as the default for the Mercury system.
configure.ac:
Require the installed compiler to support this option.
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
grade_lib/GRADE_LIB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Specify this option as the default in their directories.
library/io.m:
Add a version of io.write_line_cc that takes an explicit stream argument.
NEWS:
Announce the addition.
browser/interactive_query.m:
Use the new predicate.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_user.m:
browser/diff.m:
browser/help.m:
browser/interactive_query.m:
browser/parse.m:
browser/util.m:
Replace implicit streams with explicit streams.
Shorten lines longer than 79 chars.
In some places, simplify some code, often using constructs such as
string.format that either did not exist or were too expensive to use
when the original code was written.
In some places, change predicate names that were not meaningful
without module qualification by *including* the module qualification
in the name (e.g. init -> browser_info_init).
In some places, add XXXs.
In browser_info.m, make the output stream *part* of the debugger type,
because without this, having the debugger type belong to the stream
typeclass does NOT make sense. (The typeclass instance for debugger
used to always write to the current output stream, which this diff
is replacing with the use of explicitly specified streams.)
In browse.m, consistently put stream arguments before other arguments.
In browse.m, when exporting Mercury predicates to C, export them
under names with the standard ML_BROWSE_ prefix, NOT under the name
of a *different* predicate with that prefix.
In diff.m, eliminate an unnecessary difference between what we print
when the difference between two terms is at the root, vs what we print
when the difference between two terms is lower down.
In interactive_query.m, when trying to write a program out to a file,
do NOT write the program to the current output stream if we cannot open
the file, since that would accomplish nothing useful.
Also in interactive_query.m, cleanup .dylib instead of .so on MacOS.
In util.m, delete some unused predicates.
In collect_lib.m, document why some code is not worth updating.
In declarative_oracle.m, rename predicates with previously-ambiguous
names.
browser/MDBFLAGS.in:
Specify --warn-implicit-stream-calls for all Mercury modules
in the browser directory from now.
trace/mercury_trace_browse.c:
trace/mercury_trace_cmd_browsing.c:
ssdb/ssdb.m:
Conform to the changes in browser/*.m.
tests/debugger/queens.{exp,exp2}:
Expect the extra output from browser/diff.m.
library/*.m:
Delete Erlang foreign code and foreign types.
Delete documentation specific to Erlang targets.
library/deconstruct.m:
Add pragma no_determinism_warning to allow functor_number_cc/3
to compile for now.
library/Mercury.options:
Delete workaround only needed when targetting Erlang.
browser/listing.m:
mdbcomp/rtti_access.m:
Delete Erlang foreign code and foreign types.
The 'browse --xml' command has not worked with current versions of
xsltproc for quite some time, but we have not received any bug reports,
nor has anyone tried to fix it. We have a method for interactively
exploring a term in 'browse --web' so IMHO there is no need to keep
support for 'browse --xml'.
browser/browse.m:
browser/browser_info.m:
browser/declarative_user.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
Delete code.
doc/mdb_categories:
doc/user_guide.texi:
Delete documentation.
configure.ac:
Don't search for a XUL browser and xsltproc.
scripts/mdbrc.in:
Delete 'xml_browser_cmd' and 'xml_tmp_filename' lines.
scripts/xul_tree.xsl:
Delete now unused file.
scripts/Mmakefile:
Conform to deletions.
tests/debugger/Mmakefile:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp3:
tests/debugger/browser_test.inp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
tests/declarative_debugger/browse_arg.exp:
tests/declarative_debugger/browse_arg.inp:
Don't test 'browse --xml' any longer.
extras/xml_stylesheets/README:
Delete reference to 'browse --xml' command.
NEWS:
Announce change.
... using an approach proposed by Peter, with an extra twist from Julien.
Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.
The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.
Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.
library/getopt.m:
library/getopt_io.m:
Make the changes described above.
library/Mmakefile:
Instead of building both getopt_io.m and getopt.m from getopt_template,
build getopt.m from getopt_io.m.
tools/bootcheck:
Delete references to getopt_template.
compiler/typecheck_errors.m:
When a type error involves one of the getopt/getopt_io predicates
whose interfaces are changed by this diff, tell the user about
how these changes could have caused the error, and thus what the
probable fix is.
compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
Use the updated getopt interface.
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Replace references to getopt_io.m with references to getopt.m.
tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
New test cases for the extra help
tests/invalid/Mmakefile:
Enable the new test cases.
browser/listing.m:
Use posix_spawnp() to call the external 'list' command instead of
io.call_system. This avoids characters in the command or arguments
being interpreted as shell meta characters by the system shell.
On platforms that do not support posix_spawn, print an error
message.
Redirect the standard output and standard error of the child process
to OutStrm and ErrStrm so that the external listing command outputs
to the mdb window when using 'mdb -w' or 'mdb --program-in-window'.
trace/mercury_trace_cmd_browsing.c:
Ensure the 'list' command does not pass a negative first line number
to the external listing command.
browser/listing.m
Add list_file_with_command which calls an external command to print
source listings instead of doing it internally. The implementation
is incomplete in that the external command's standard output and
standard error streams are not redirected into OutStrm and ErrStrm.
Rename mercury_stream_to_c_FILE_star to
mercury_stream_to_c_file_ptr.
Consolidate some output calls with string.format.
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
Add a 'list_cmd' command which sets or prints the current
external listing command.
trace/mercury_trace_cmd_browsing.c:
Make 'list' command call list_file_with_command if an external
listing command was set.
doc/user_guide.texi:
Document 'list_cmd' command.
tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
Update for new command.
NEWS:
Announce changes.
browser/help.m:
Simplify the data types representing the nested structure
of help information. Simplify the code of the predicates
that work on that structure.
Simplify some of the predicates, e.g. by having a search predicate
do *just* search.
Give types and predicates more meaningful names. Make argument order
more suitable for state-variables. Move a predicate next to its
only call site.
browser/declarative_user.m:
Conform to the change in help.m.
Replace two bools with values of bespoke types.
browser/declarative_debugger.m:
browser/declarative_oracle.m:
Conform to the changes in help.m and declarative_user.m.
doc/generate_mdb_doc:
Fix the vim modeline.
trace/mercury_trace_declarative.c:
trace/mercury_trace_help.c:
Conform to the changes in the browser directory.
util/info_to_mdb.c:
Switch from /**/ to // for comments.
Give a macro a meaningful name.
Fix indentation.
browser/util.m:
compiler/equiv_type_hlds.m:
compiler/inst_test.m:
library/construct.m:
library/io.m:
Ensure output variables are initialised in all code paths.
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.
However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.
browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
When creating stage 3, the bootcheck builds, in each directory,
only the files that it wants to compare against their stage 2 versions.
This means that it wants to build all the .c, .cs or .java files,
which it does via the cs, css and javas mmake targets.
The correct definitions of the rules of these targets depends on
whether mmc --make is being used or not, so we need at least two
sets of definitions: one for mmc --make, and for no mmc --make,
and conditionally selecting the appropriate one. The latter definition
has the problem that it refers to mmake variables that are intended
to be defined in .dv files created by mmc --generate-dependencies,
but until that has been run, those mmake variables are undefined.
Until now, the only directories that had both the mmc --make
and the no mmc --make definitions were the ones needed to build
the compiler. Bootchecks in the csharp and java grades, which
always use --make make, got errors when they tried to build
the directories that bootcheck builds after the compiler:
the slice, profiler, deep_prof and mfilterjavac directories.
This diff ensures that all directories we build in bootcheck
get all both versions of the os, cs, css, and javas targets.
In fact, they get two subversions of the no mmc --make version:
one for use in the presence of .dv files, and one for use in their
absence. The latter just builds the .dv files and invokes mmake
again. This avoids one source of warnings about undefined mmake
variables.
To avoid another source, make the rules for tags files and their
proxies depends on *.m instead of mmake variables such as $(mcov.ms),
since this makes sense even before making dependencies. The only price
is that any untracked Mercury source files in the directory have to
either be given some other suffix, or moved somewhere else.
Where relevant, make the mtags invocation prefer the master versions
of files that are copied from the mdbcomp directory to other directories,
since this is the only writeable version.
Make the os and cs rules consistently NOT build the _init.[co] files.
The way we use those files in bootcheck, we never need them;
when we need them, the right target to give is the executable anyway.
In the slice directory, don't put mcov between mtc_union and mtc_diff.
Eliminate unnecessary duplication, e.g. of sources in rules.
Eliminate double negatives in conditionals.
Fix formatting.
Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
Add "ft=make" to vim modelines. This is redundant for the files whose
names is Mmakefile, but it is needed for Mmake.common.
browser/Mmakefile:
compiler/Mmakefile:
Restore the .PHONY directives on the Mercury.modules target as their
absence is causing the source distribution builds to fail.
Add an XXX comment about this.
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.
grade_lib/GRADE_LIB_FLAGS.in:
A new file with default options for the grade_lib directory.
configure.ac:
Create GRADE_LIB_FLAGS from GRADE_LIB_FLAGS.in.
grade_lib/Mmakefile:
Make building GRADE_LIB_FLAGS possible.
Require building GRADE_LIB_FLAGS before any Mercury module is compiled.
Use GRADE_LIB_FLAGS as a source of default flags.
Use a directory-specific params file if it exists.
grade_lib/choose_grade.m:
grade_lib/grade_setup.m:
grade_lib/grade_structure.m:
grade_lib/grade_vars.m:
grade_lib/test_grades.m:
grade_lib/try_all_grade_structs.m:
Fix issues revealed by the flags in GRADE_LIB_FLAGS.
mdbcomp/MDBCOMP_FLAGS.in:
browser/Mmakefile:
Fix aesthetics.
browser/Mmakefile:
Delete .NOTPARALLEL target. The line appears to be only a leftover
for a workaround that was in place when the browser directory
contained both the mer_browser and mer_mdbcomp and libraries.
Delete other lines which have been commented out since
mdbcomp was moved to its own directory.
ssdb/Mmakefile:
Delete the same lines copied from browser/Mmakefile.