Improve standardization of .int* files.

compiler/write_module_interface_files.m:
    Do the above in two distinct respects.

    The first respect is the motivating example for this change.
    With the old version of the compiler, when this declaration sequence

        :- pred decl xyz/4
        :- mode decl for pred xyz/4
        :- func decl xyz/4
        :- mode decl for func xyz/4

    is reordered by the user to this declaration sequence

        :- func decl xyz/4
        :- mode decl for func xyz/4
        :- pred decl xyz/4
        :- mode decl for pred xyz/4

    the standardized order in the .int file also changes, causing all modules
    that depend on this one to be compiled.

    The second respect was that given two mode declarations for the same
    predicate (or function) in which one explicitly listed a mode for
    all argumments but the other did not, supplying that mode via
    a with_inst annotation, such as this:

        :- mode decl for pred xyz/4
        :- mode decl for pred xyz/3 with_inst ...

    the standardization could change the order of those declarations,
    which changes the semantics of the program. I don't remember ever hearing
    of this occurring in practice, since with_inst annotations are very rare
    and (to a lesser extent) so are predicates with more than one mode,
    but it *could* happen. I realized this when trying to fix the first
    problem.

    Fix both the correctness problem by leaving the order of both
    pred and mode declarations for a symname complete alone if any
    of those declarations is missing information about either the
    actual arity or the pred_or_func nature of the "predicate".

    Fix the "too much recompilation" problem by ordering pred and mode
    declarations not just by sym_name and arity, but also by pred_or_func
    status, in the (by far the more common) case that none of the pred
    and mode declarations for a symname are missing any arity or
    pred_or_func information.
