Clean up library/string.m.

library/string.m:
    Avoid unnecessary use of higher order code in the implementation of
    string.format. Avoid the unnecessary insertion of empty manifest strings
    between actual format conversions.

    Represent the optional width and precision in string.format as integers,
    not strings, since the strings take up more space and require more time
    to create and to process.

    Simplify the code implementing word_wrap.

    Give some variables better names.

    Clarify some documentation.

    Call unexpected instead of error in cases where the source of a problem
    can only be a software bug inside string.m, and not bad input supplied
    from outside of it.

    Don't mention the arity of a predicate that is the source of an exception,
    since the predicate's identity is unambiguous even without the arity,
    and since other exceptions also don't mention arities.

library/require.m:
    Add two-argument versions of error/1 and func_error/1, to allow
    the name of the predicate and the error message to be passed separately,
    possible with the first being specified as $pred. string.m had several
    places where these were being appended on the fly.

library/char.m:
    Clarify some code.

NEWS:
    Mention the additions to require.m.
Carve two submodules out of string.m.

There are no algorithmic changes, though there are some name changes.

library/string.format.m:
    New submodule of string.m. Contains the parts of old string.m
    that implement string.format. About 1500 lines.

library/string.to_string.m:
    New submodule of string.m. Contains the parts of old string.m
    that implement string.string, string.string_ops and
    string.string_ops_noncanon. About 500 lines.

library/string.m:
    Replace the code that is now in the new submodules with includes
    of those submodules.

library/library.m:
    List the two new submodules. Fix some bitrot about where
    new library modules may need to be listed.

doc/Mmakefile:
    Do not document the two new submodules, since they are implementation
    details.
Generate a specific warning for X = f(X).

This warning is for when X is ground. When X is free (or otherwise nonground),
such unifications have always gotten an error.

compiler/mode_errors.m:
    Add a warning type for occur check violations with ground vars.

    Fix the grammar in the other two warnings generated by mode analysis.

compiler/modecheck_unify.m:
    Generate the new warning when appropriate.

    To make this possible, rewrite a previously 280-line predicate
    that was hard to understand because of its structure as well as its
    length into a smaller, better structured predicate less than half the size
    (a) by moving coherent pieces of it out into other predicates,
    some of which are now called more than once, thus reducing code
    duplication, and (b) by avoiding redundant work, to wit, optimizing
    the form of a unification when we have already decided that it has
    a mode error, and thus cannot be scheduled now.

compiler/prog_mode.m:
    Add a det version of an existing predicate.

compiler/inst_util.m:
    Remove a comment on a predicate implementation that duplicates the
    comment on the predicate's declaration.

compiler/modecheck_util.m:
    Minor fixes of comments.

compiler/superhomogeneous.m:
    Fix some bit rot: update the name of a predicate to match
    the name of the data it works on, which was changed a few
    years ago.

tests/invalid/occurs.err_exp:
tests/invalid/qualified_cons_id2.err_exp:
tests/warning/simple_code.exp:
tests/warning/unify_f_g.exp:
    Conform to the error message format we generate after the change
    to mode_errors.m.

tests/warning/unify_x_f_x.{m,exp}:
    A new test case to test the new functionality.

tests/warning/Mmakefile:
    Enable the new test case.
A step towards compiling away format strings.

library/string.format.m:
    Switch the representation of flags from a list of chars
    to a tuple of enums. This should make it easier to construct flags
    at compile time.

    Factor out the commonalities in handling the different format specifiers
    for printing unsigned ints, and for printing floats. This gives us
    predicates (such as gen_format_float) that format_call.m can generate
    calls to.

    Give some predicates, types and variables more meaningful names.

    Reorder some predicates' arguments to conform with the usual convention
    of inputs before outputs.

    Remove some unnecessary #includes in C code.

    Add XXXs as reminders of opportunities for further improvements.

library/string.m:
    Fix white space.
Merge remote-tracking branch 'upstream/master' into merge-java-on-windows