Fix an old bug in mercury_float.h.

runtime/mercury_float.h:
    As above.
Impose a structure on library/string.m.

library/string.m:
    Group the predicates in this module into groups of related predicates,
    and put those groups of predicates into a logical order. Document
    this order.

    Remove some unnecessary promise_equivalent_clauses declarations.

    Give some variables and predicates better names, e.g. change the _2
    suffix on predicates that do loops to _loop.

    Move a predicate to string.format.m, since it is not exported, and
    it is not used anywhere else.

    Avoid overlong lines.

library/string.format.m:
    Add the moved predicate, with a better name and better variable names.
Clean up string.format.m some more.

library/string.format.m:
    Provide target predicates that format_call.m can call.

    Assume that we are running on at least a 32 bit platform.

    Convert (C->T;E) to (if C then T else E).

    Shorten too long lines.
Resolve the things I noticed cleaning up string.m.

library/string.m:
    Document why line and text_file are here.

    Clarify comments about surrogate code points.

    Document codepoint vs code_point.

    Remove the workaround for a very old bug in egcs.
Optimize the det_info structure.

compiler/det_util.m:
    Delete three fields from the det_info structure. Apparently they
    haven't been used for some time now.

    When updating other fields that are likely to be set to the old value,
    check whether the new value is the same as the old, and avoid allocating
    a new det_info structure if it is.
Document the new require_switch_arms_* scopes.

doc/reference_manual.texi:
    As above.

NEWS:
    Announce the new scopes.
Fix an old copy-and-paste bug.
Fix an old bug.

compiler/make_goal.m:
    Assignments are supposed to be det, not semidet. The only reason why
    this hasn't been caught before was that the only call site that could
    call make_simple_assign was never actually reached.
Update the list of the compiler's largest modules.
Standardize divider line lengths in the library.

library/*.m:
    As above.

tool/stdlines:
    A new shell script to do the job.
Factor out commonalities in builtin ops.

compiler/builtin_ops.m:
    Replace a flat list of clauses, one for each mode of each builtin
    predicate, with a nested set of switches that shows their relationships.

    Specialize the module's interface to the two uses cases the callers
    need: testing to see if a predicate is a builtin, used when setting
    the builtin_status of call goals, and actually generating code, used
    by the various backends.

compiler/hlds_pred.m:
    Switch to using the interface predicate for the first use case.

compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/erl_call_gen.m:
compiler/ml_call_gen.m:
    Switch to using the interface predicate for the second use case.
Specialize ALL calls to string.format and io.format.

Previously, we specialized calls to string.format and io.format only if
the format string specified no flags, widths, precisions or non-default
bases for any conversion. We now specialize calls to those predicates
regardless of the format string. To make this possible, we now have two
copies of the code to parse format strings.

library/string.parse_runtime.m:
    This new module, carved out out library/string.format.m, contains
    one of those copies. As the name suggests, this copy is used by
    the runtime system.

compiler/parse_string_format.m:
    This new module contains the other copy. As its location suggests,
    this copy is used by the compiler. The separate copy is necessary
    because the compiler's parsing needs are different from the runtime's.

    The main reason for the separation is that the compiler needs to be
    able to handle cases where widths and predicates are given by manifest
    constants, as well as when they are given by the values of variables
    at runtime (when the format string contains conversion specifiers
    such as "%*d"). Having the runtime handle this extra complexity
    would have inevitably increased the runtime's format string interpretation
    overhead, which is undesirable.

    The other reason is that compiler can afford to postprocess the result
    of the parsing in order to avoid having to concatenate two or more
    constant strings at runtime.

library/string.parse_util.m:
    Types and predicates that are common to the library and compiler copies
    of the format string parsing code.

compiler/format_call.m:
    We used to check whether format strings match the supplied list
    of values to be printed by invoking string.format on dummy inputs
    of the supplied types, and seeing whether you got an exception.
    We now call parse_string_format.m instead. Not only does this
    avoid shenanigans with exceptions (which the deep profiler cannot
    yet handle), but it also allows us to specialize all calls
    to string.format and io.format. We therefore do so.

    We used to specialize calls to io.format by creating a single string
    to be printed (using the machinery needed to specialize calls to
    string.format), and then printing that. This did unnecessary memory
    allocations to hold the intermediate strings. We now simply print
    each component one after the other, which avoids this overhead.

library/string.format.m:
    Add versions of the predicates that print chars, strings, ints and floats
    that are specialized to each possible situation about whether the caller
    specifies a width and/or a precision. This means that format_call.m
    doesn't have to generate code that allocates cells on the heap.

    Remove the code that was moved to new submodules of string.m.

compiler/simplify_proc.m:
    List the predicates in string.format.m that the compiler
    may generate calls to in the list of such predicates that we maintain
    to prevent dead_pred_elim from deleting them before format_call.m
    gets a chance to do its work.

compiler/module_imports.m:
    If the code of the module calls a predicate named "format" that
    may refer to string.format or io.format, then implicitly import
    the modules that contain the types and predicates that the code
    generated by format_call.m will refer to. Note that since this
    module_imports.m works on Mercury code that has not been module
    qualified yet, we have to use a conservative approximation.

    Reorganize the way we discover what library modules we have to
    implicitly import. Instead of a separate boolean for each piece
    of functionality that needs an implicit import, put them together
    into a structure. Due to Peter's work on argument packing some
    years back, this is now more efficient as well as more convenient
    that passing around a bunch of booleans. Also switch to passing
    around the structure as an accumulator, instead of having to do
    bool.ors all over the place.

    Since the code for computing the list of modules to be implicitly
    imported can sometimes add a library module to the list twice,
    sort that list and remove any duplicates.

    To make this possible, remove the version of the main predicate
    that appends the implicitly imported module names to a list of
    module names passed by our caller, since we don't want to sort
    THAT list of module names.

    Give the remaining version of that predicate that does this
    a name that better matches the names of related predicates.

compiler/modules.m:
    Conform to the change in module_imports.m. Mark some suspicious code
    with XXXs.

    Remove some redundant comments.

compiler/options.m:
doc/user_guide.texi:
    Add a new option that tells format_call.m what it should do
    when it finds more than one problem with a format string: whether
    it should print a message only for the first problem, or for all
    the problems. (The default is the latter.)

library/MODULES_DOC:
    A list of the all the Mercury source files in the library that
    should be included in the user guide.

library/MODULES_UNDOC:
    A list of the all the Mercury source files in the library that
    should NOT be included in the user guide.

library/library.m:
    Include the new publicly visible new submodule of string.m,
    (string.parse_util). And both string.parse_util and string.parse_runtime
    (which is NOT visible from outside string.m) to the list of modules
    in the Mercury standard library.

    Update the rules for where new library modules should be documented
    to account for non-publically-visible submodules, which we haven't had
    before. Document the need to include new modules in either MODULES_DOC
    or MODULES_UNDOC.

mdbcomp/builtin_modules.m:
    Provide convenient access for format_call.m to the names of the
    submodules of string.m that it needs access to.

library/Mmakefile:
    Add a new target, check_doc_undoc, which checks whether any source files
    are missing from MODULES_DOC or MODULES_UNDOC.

doc/Mmakefile:
    Read the list of modules to be documented from MODULES_DOC. This replaces
    old code that tried to list all the undocumented modules, but missed one:
    it referred to erlang_conf.m instead of erlang_builtin.m.

    When creating the library documentation, filter out any lines that
    contain the string NOTE_TO_IMPLEMENTORS. We now use this mechanism
    to include reminders to implementors in what would otherwise be a
    publically visible part of string.m.

tools/bootcheck:
    Copy MODULES_DOC and MODULES_UNDOC to the stage 2 and 3 library
    directories, since the check_doc_undoc target, which is invoked by
    "make all" in the library directory, needs them.

compiler/hlds_out_module.m:
    When dumping out the table of types, dump out discriminated union types
    in a style that follows our recommended coding style.
Optimize access to poly_infos.

compiler/polymorphism.m:
    Remove a field in poly_infos that wasn't being used. (It contained
    the pred_info.)

    Put the remaining fields into a more logical order.

    Remove unused setter predicates for read-only fields.

    For some setter predicates of the poly_info, the value being written
    is frequently the same as the old value in the written-to field.
    Make these setter predicates not do the update if it is unnecessary.

    Provide a predicate to set the rtti_varmaps at the same time as the
    varset and vartypes, since these are usually updated together, and
    this way we can avoid generating the intermediate poly_info.

    If we know in advance what the name of a new type_info variable should be,
    create it directly with that name; don't created with a different name,
    just to rename it immediately after.

    Give some predicates and variables more meaningful names.

tools/speedtest:
    Add an option, -m (for mix), that executes each under-test version
    of the compiler once before going back to repeat. This minimizes
    the probability that automatic speed throttling of the CPU (due
    e.g. to overheating) will systematically skew the timing results.
    If the executions of the different versions being tested is mixed
    together, any skew from throttling will have effects that are
    mostly random, not systematic.
Optimize updates to goal_infos.

compiler/polymorphism.m:
    For some setter predicates of the goal_info, the value being written
    is frequently the same as the old value in the written-to field.
    Make these setter predicates not do the update if it is unnecessary.
Make pointer_equal a builtin.

There was an inline pragma on its definition, but most programs, including
the compiler, are (most of the time) not compiled with the intermodule
optimization options that would allow this to take effect. Making it a builtin
gets around this "problem".

compiler/builtin_ops.m:
    Add private_builtin.pointer_equal as a builtin op.

    Factor out some more commonalities between existing builtin ops.

compiler/bytecode.m:
    Add the new pointer_equal_conservative op. The bytecode backend
    doesn't handle it, but then again, it doesn't handle really anything
    else either.

compiler/c_util.m:
    Handle the new operator, including adding a new category for it.

compiler/llds.m:
compiler/ml_global_data.m:
    Record the output type of the new operator.

compiler/llds_out_data.m:
    Generate code for the new operator for the LLDS backend.

compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
compiler/mlds_to_il.m:
    Generate code for the new operator for the MLDS backend
    when targeting C, C#, Java and IL respectively. The IL version
    just aborts, since I don't know IL well enough to know what
    code to generate for "false" (the conservative approximation,
    also used for Erlang), but this should be ok, since the backend
    is not functional anyway.

compiler/erl_call_gen.m:
    Generate code for the new operator for the ELDS backend.
    The code we generate always returns false, which is allowed by the
    operator, since this is a conservative approximation.

    Start using require_complete_switch to ensure that we handle all
    operators. Add code to handle the old operators that this code
    did not used to handle.

compiler/java_util.m:
    Add an XXX comment about a scheme to handle operators that does not allow
    anything similar to such a require_complete_switch.

compiler/opt_debug.m:
    Pretty print the new operator.

compiler/options.m:
    Allow the definition of builtins such as pointer_equal while this
    change is bootstrapped.

library/private_builtin.m:
    Remove the inline pragma from pointer_equal, because the compiler
    can't handle such a pragma for a builtin, even when being bootstrapped.
    This could be fixed, but isn't worth the bother. A compiler builtin
    is like an inline pragma that works even without intermodule optimization.
Fix a comment.

deep_profiler/read_profile.m:
    ix a comment.