Commit Graph

102 Commits

Author SHA1 Message Date
Zoltan Somogyi
5cbcfaa0ed Move X_to_doc functions to pretty_printer.m.
library/array.m:
library/char.m:
library/float.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/list.m:
library/one_or_more.m:
library/string.m:
library/tree234.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
library/version_array.m:
    Mark the X_to_doc function in each of these modules as obsolete,
    and make it a forwarding function to the actual implementation
    in pretty_printer.m. The intention is that when these forwarding
    functions are eventually removed, this will also remove the dependency
    of these modules on pretty_printer.m. This should help at least some
    of these modules escape the giant SCC in the library's dependency graph.
    (It does not make sense that a library module that adds code to increment
    an int thereby becomes dependent on pretty_printer.m through int.m.)

library/pretty_printer.m:
    Move all the X_to_doc functions from the above modules here.

    Fix the one_or_more_to_doc function, which was

    - missing the comma between the two arguments of the one_or_more
      function symbol, and

    - would print "..., ...]" instead of just "...]" at the end of the
      tail list when that list exceeded the limits of the specified pp_params.

    Rename one of the moved types along with its function symbols,
    to reduce ambiguity.

    Put arrays before their indexes in the argument lists of some of
    the moved functions.

    Some of the moved X_to_doc functions for compound types returned
    a doc that had an indent wrapper. These indents differed between the
    various X_to_doc functions without any visible reason, but they are
    also redundant. The callers can trivially add such wrappers if they
    want to, but taking them off, if they want them off, is harder.
    Eliminate the problem by deleting all such indent wrappers.

    Add formatters for the intN, uintN and one_or_more types to the
    default formatter map. Their previous absence was an oversight.

    Add a function, get_formatter_map_entry_types, that returns the ids
    of the types in the formatter_map given to the function. It is intended
    for tests/hard_coded/test_pretty_printer_defaults.m, but is exported
    for anyone to use.

tests/hard_coded/test_pretty_printer_defaults.{m,exp}:
    Use get_formatter_map_entry_types to print the default formatter map
    in a format that is much more easily readable.

NEWS:
    Announce all the user-visible changes above.
2022-12-27 18:27:52 +11:00
Julien Fischer
e7d28ff90f Update copyright notices in stdlib.
library/*.m:
    As above.
2022-06-07 21:51:03 +10:00
Zoltan Somogyi
8055577a7f Optimize the common case in instmap_delta_restrict.
compiler/instmap.m:
    Before code generation, the MLDS backend recomputes all nonlocal sets,
    because the MLDS code generator needs them to contain exact information,
    but the compiler's rules allow the nonlocal sets in goal_infos
    to overapproximate the true nonlocals set. Since instmap_deltas can
    contain a variable as a key only if that variable is in the nonlocals set,
    this also involved calling instmap_delta_restrict to ensure this.

    However, while the nonlocals sets of goal_infos *may* include variables
    that are not true nonlocals, they typically do not do so. This diff
    adds conditionally-enabled code to record information about this,
    and the results show that 90+% of calls to instmap_delta_restrict
    make no changes to the instmap_delta. This diff therefore also
    special-cases the handling of such calls. The reason why I believe
    this to be worthwhile is that in a deep profiled compiler run,
    I observed that the instmap_delta_restrict predicate accounted for
    about 1.4% of the call counts, and about 1.3% of the memory allocated.

library/map.m:
library/tree234.m:
    Add the library predicates needed by the special case code.

    Use predmode declarations in some other places.

NEWS:
    Mention the new library predicates.

compiler/mercury_compile_main.m:
    Invoke the predicate in instmap.m that, if statistics collection
    was enabled, appends its results to a file.

tools/restrict_stats:
    A script to summarize the contents of that file.
2022-04-02 16:35:18 +11:00
Zoltan Somogyi
f1927afe0b Break a source file info parse_tree_module_srcs ...
... instead of into raw_compilation_units. Besides being more convenient to
work on, a parse_tree_module_src encodes in its type a significant number
of invariants that a raw_compilation unit does not.

compiler/split_parse_tree_src.m:
    Immediately after creating a raw_compilation_unit for one of the modules
    in a potentially multi-module source file, convert it to a
    parse_tree_module_src.

    Fix an old problem that can come up in contrived erroneous code.
    Specifically, when a submodule is both nested inside its parent module,
    *and* it also has an explicit include_module declaration, we used to
    record the contexts of both "inclusions", after generating an error
    message. The more rigorous checking that later code now does on the
    resulting inclusion map would look at this "duplicate inclusion"
    and generate *another* error message. To avoid this redundant message,
    do not record the contexts of erroneous inclusions for which a message
    has already been generated.

compiler/grab_modules.m:
    Operate on parse_tree_module_srcs instead of raw_compilation_units.
    This allows us to avoid having code for doing what converting the
    raw_compilation_unit to a parse_tree_module_src has already done.
    In fact, that conversion code does a better job. The old code assumed
    that all implicitly available modules are used in the interface,
    whereas in fact only some should be used in the interface, with
    the rest being used in the implementation section.

compiler/module_imports.m:
    Make the predicates that create module_and_imports structures
    take a parse_tree_module_src instead of a raw_compilation_unit
    as input. For now, we convert the parse_tree_module_src back to
    a raw_compilation_unit for further processing, but I intend
    a later diff to change this. Nevertheless, one immediate change
    is that init_module_and_imports now stores the *actual*
    parse_tree_module_src in the module_and_imports structure,
    not a dummy.

compiler/prog_item.m:
    Do not include a list of foreign_enum items in the interface section
    of a parse_tree_module_src, since such items are not allowed to occur
    in interface sections.

    For the same reason, delete the field for foreign_enums in the interface
    sections of .int0 and .int files.

compiler/check_raw_comp_unit.m:
    Operate on parse_tree_module_srcs instead of raw_compilation_units.

compiler/comp_unit_interface.m:
    Operate on parse_tree_module_srcs instead of raw_compilation_units.

    Do not expect any foreign_enum items in interface sections, since
    they are not allowed there.

compiler/read_modules.m:
    Provide a mechanism to remember having read a parse_tree_module_src.

compiler/write_module_interface_files.m:
    Operate on parse_tree_module_srcs instead of raw_compilation_units.

compiler/get_dependencies.m:
    Add a new version of an existing utility predicate. The old one operated
    on raw item lists, the new one operates on parse_tree_module_srcs.
    To make this possible, factor out the code pieces that operate on
    each non-ignored kind of item.

compiler/item_util.m:
    Add some new utility predicates/functions.

compiler/convert_parse_tree.m:
    Conform to the change in prog_item.m. (We already generated an error
    message for a foreign_enum item in the interface, but still passed around
    a list of foreign_enum items that was guaranteed to be stay empty.)

compiler/make.module_dep_file.m:
    Conform to the changes above.

    Use explicit streams in one place.

    Do not pass an unneeded argument.

compiler/check_parse_tree_type_defns.m:
compiler/equiv_type.m:
compiler/make_hlds_separate_items.m:
    Conform to the change in prog_item.m.

compiler/mercury_compile_main.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
    Conform to the changes above.

library/map.m:
library/tree234.m:
    Add foldl6, foldl6_values and foldr6 predicates. An earlier version
    of this diff needed foldl6, and I added the others for symmetry.

NEWS:
    Announce the new library predicates.

tests/invalid/bad_mutable.m:
    Export something, to avoid a warning about not exporting anything.

tests/invalid_submodules/duplicate_module.m:
tests/invalid_submodules/duplicate_module_test.m:
    Update programming style.
2021-07-19 13:23:28 +10:00
Zoltan Somogyi
0d7c8a7654 Specify pred or func for all pragmas.
*/*.m:
    As above.

configure.ac:
    Require the installed compiler to support this capability.
2021-06-16 15:23:58 +10:00
Zoltan Somogyi
d302810ecf Add some utility predicates, and make some cleanups.
library/list.m:
    Add a predicate version of map_corresponding3.

    Move a predicate next to its only call site.

    Use more meaningful variable names.

library/map.m:
library/tree234.m:
    Add several predicates: foldl4_values, foldl5_values, filter_map_values
    and filter_map_values_only.

library/multi_map.m:
    Embed an implicit assertion in a call.

library/set_ordlist.m:
    Give a predicate a better name.

library/NEWS:
    Announce the new additions.

    Put the list of updated library modules back into alphabetical order.

tests/hard_coded/test_map_filter.{m,exp}:
    Test the one wholly new utility predicate.
2020-02-27 19:23:17 +11:00
Zoltan Somogyi
a9ab1ae596 Add map_foldl4.
library/map.m:
library/tree234.m:
    As above.

NEWS:
    Mention the additions.
2019-09-25 08:58:15 +10:00
Zoltan Somogyi
95f8f56716 Delete unneeded $module args from calls to expect/unexpected. 2019-07-03 22:37:19 +02:00
Zoltan Somogyi
e9430b115a Prep for recording simple type representations in .int3 files.
compiler/decide_type_repn.m:
    New module for computing the set of type representation items
    to put into the interface files of a module. For now, it generates
    this information only for .int3 files.

compiler/parse_tree.m:
compiler/notes/compiler_design.html:
    Add the new module to the parse_tree package.

compiler/comp_unit_interface.m:
    Invoke the new module to add type representation items to .int3 files
    if the experiment option has the right value. Give it the information
    it needs to do its job.

compiler/add_foreign_enum.m:
    Export a predicate for use by decide_type_repn.m. Maybe eventually
    it should be *moved* to decide_type_repn.m.

compiler/hlds_data.m:
compiler/prog_data.m:
    Change the representation of lists of constructors in a type
    from lists, which can be empty, with one_or_more, which cannot.
    This encodes the invariant that a type constructor cannot have
    zero data constructors in the structure of the type.

compiler/prog_item.m:
    Change the representation of lists of constructors in a type
    from lists, which can be empty, with one_or_more, which cannot.
    This encodes the invariant that a type constructor cannot have
    zero data constructors in the structure of the type.

    Include information about assertions in type representation items
    about foreign types.

    Do not record whether a type whose representation item says its values
    are guaranteed to be word aligned is a Mercury type or a foreign type.
    We generate such items only for Mercury types; for foreign types,
    their assertions will contain that information. We need this separation
    because when we generate .int3 files, we don't the backend that we will
    eventually generate code for, and thus do not know whether a given
    foreign type declaration is in effect on that backend or not.

compiler/parse_tree_out.m:
    Fix the printing of type representation items.

compiler/prog_type.m:
    Conform to the changes above, and delete an unused predicate.

compiler/parse_type_repn.m:
    Factor out some common code.

    Fix an old bug about yes/no vs du_repn/no_du_repn.

    Conform to the changes above.

compiler/parse_pragma.m:
    Export a predicate for parse_type_repn.m.

    Note a possible improvement.

    Conform to the changes above.

compiler/add_special_pred.m:
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/det_report.m:
compiler/du_type_layout.m:
compiler/equiv_type.m:
compiler/hlds_out_module.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_pragma.m:
compiler/parse_type_defn.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/resolve_unify_functor.m:
compiler/special_pred.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_norm.m:
compiler/type_util.m:
compiler/untupling.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
    Conform to the changes above.

compiler/simplify_goal_ite.m:
    Add a comment.

compiler/canonicalize_interface.m:
compiler/get_dependencies.m:
    Do not abort when seeing type representation items.

compiler/mmakefiles.m:
    Delete a predicate that this diff adds to list.m.

library/list.m:
    Add new predicates to convert from one_or_more to list
    and vice versa.

NEWS:
    Announce the new predicates.

library/bimap.m:
library/map.m:
library/tree234.m:
    Expand a comment.
2019-05-27 11:45:10 +02:00
Zoltan Somogyi
ae4b736fdd Implement warnings for suspicious recursion.
compiler/simplify_goal_call.m:
    If the --warn-suspicious-recursion option is set, and if the warning
    isn't disabled, generate warnings for two different kinds of suspicious
    recursion. They are both related to, but separate from, the warning
    we have long generated for infinite recursion, which occurs when
    the input args of a recursive call are the same as the corresponding
    args in the clause head.

    Both kinds suspicious recursion look at the input args of a recursive call
    that are NOT the same as the corresponding args in the clause head.
    Both require these args to have non-unique modes. (If they have unique
    modes, then the depth of the recursion may be controlled by state outside
    the view of the Mercury compiler, which means that a warning would be
    likely to be misleading.)

    The first kind is when all these args use state variable notation.
    Most of the time, we use state var notation to denote the data structures
    updated by the recursive code; having variables using such notation
    *controlling* the recursion is much less common, and much more likely
    to be unintended. The motivation for the new option was this infinitely
    looping code, which resulted from neglecting to s/[X | Xs]/Xs/ after
    cutting-and-pasting the clause head to the recursive call.

    p([X | Xs], !S) :-
        ...,
        p([X | Xs], !S).

    The other kind of suspicious recursive call we warn about involve
    input arguments where the base names of the input arguments (the part
    before any numeric suffixes) seem be switched between the clause head
    and the recursive call, as here:

    q(As0, Bs0, ...) :-
        ...,
        q(Bs1, As, ...).

compiler/mercury_compile_main.m:
    Disable style warnings when invoked with --make-optimization-interface
    or its transitive variant. Without this, warnings about suspicious
    recursion would get reported in such invocations.

    Move a test from a callee to a caller to allow the callee to be
    less indented.

compiler/options.m:
    Export functionality to mercury_compile_main.m to make the above possible.

library/string.m:
    Add a predicate to convert a string to *reverse* char list directly.

    Note a discrepancy between the documentation and the implementation
    of the old predicate the new one is based on (which converts a string
    to a forward char list).

NEWS:
    Note the new predicate in string.m.

compiler/cse_detection.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/deforest.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/distance_granularity.m:
compiler/frameopt.m:
compiler/inst_util.m:
compiler/lp_rational.m:
compiler/matching.m:
compiler/modes.m:
compiler/old_type_constraints.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.region_arguments.m:
compiler/recompilation.usage.m:
compiler/stratify.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.indirect.m:
compiler/typeclasses.m:
compiler/use_local_vars.m:
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
library/bit_buffer.read.m:
library/bit_buffer.write.m:
library/calendar.m:
library/diet.m:
library/lexer.m:
library/parser.m:
library/parsing_utils.m:
library/ranges.m:
library/set_ctree234.m:
library/set_tree234.m:
library/string.parse_util.m:
library/tree234.m:
library/varset.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
profiler/demangle.m:
    Avoid warnings for suspicious recursion. In most cases, do this by
    wrapping disable_warning scopes around the affected recursive calls;
    in a few cases, do this by changing the code.

tests/warnings/suspicious_recursion.{m,exp}:
    A test case for the new warnings.

tests/warnings/Mercury.options:
tests/warnings/Mmakefile:
    Enable the new test case.
2019-05-01 21:29:05 +10:00
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
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.
2018-06-09 17:43:12 +10:00
Zoltan Somogyi
8fbfb8b52d Specify the type for more inst definitions. 2017-11-09 16:20:33 +11:00
Zoltan Somogyi
d9e576a2b2 Specify the type for inst definitions.
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
mdbcomp/*.m:
ssdb/*.m:
    Specify the type constructor for every inst definition that lists
    the functors that values of that type may be bound to.

    In library/maybe.m, delete the inst maybe_errors/1, because
    (a) its name is misleading, since it is for the maybe_error/1 type (no s),
    and (b) there is already an inst with the non-misleading name maybe_error
    which had an identical definition.

    In compiler/dep_par_conj.m, delete two insts that were duplicates
    of insts defined in hlds_goal.m, and replace references to them
    accordingly.
2017-11-08 16:54:18 +11:00
Peter Wang
4af0c874af Clarify meaning of "abort" in library documentation.
library/assoc_list.m:
library/bag.m:
library/bimap.m:
library/calendar.m:
library/char.m:
library/digraph.m:
library/list.m:
library/map.m:
library/multi_map.m:
library/psqueue.m:
library/rbtree.m:
library/string.m:
library/term.m:
library/tree234.m:
library/type_desc.m:
library/univ.m:
library/varset.m:
    Replace most occurrences of "abort" with "throw an exception".

    Slightly improve the documentation for map.search, map.lookup,
    map.inverse_search.

library/deconstruct.m:
    Replace "abort" with "runtime abort" where that is meant.
2017-10-09 21:48:29 +11:00
Zoltan Somogyi
5057ab7e04 Use explicit streams in some library modules.
library/backjump.m:
library/exception.m:
library/getopt_io.m:
library/psqueue.m:
library/set_ctree234.m:
library/set_tree234.m:
library/tree234.m:
    Avoid using implicit streams.

library/io.m:
    Add a version of the write_cc predicate that allows callers
    to specify an explicit stream.

    Fix what seems like an old bug in read_binary_file_as_bitmap: it was not
    reading from the file at all.

    Use explicit module qualification in some places to make the code more
    readable.

library/table_statistics.m:
    Add a version of the write_table_stats predicate that allows callers
    to specify an explicit stream.

    Avoid using implicit streams inside the module as well.

library/term_io.m:
    Add versions of the predicates that read terms that allow callers
    to specify an explicit stream.

    Avoid using implicit streams inside the module as well.

library/parser.m:
    Add module qualifications that are needed after the new addition of new
    predicates to term_io.m.

library/stream.m:
library/stream.string_writer.m:
    Fix style.
2016-10-30 00:49:21 +11:00
Zoltan Somogyi
95ff02b1bf Add options to check the ordering of module contents.
One option, --warn-non-contiguous-decls, generates warnings if the
mode declarations of a predicate or function aren't in a contiguous block
immediately following the pred or func declaration. Since this is a rare
kind of "style error", this option is enabled by default.

Two options, --warn-inconsistent-pred-order-clauses and
--warn-inconsistent-pred-order-foreign-procs, warn about inconsistencies
between (a) the order in which predicates (and functions) are declared,
and (b) the order in which they are defined. The two options differ in
their scope. The latter applies to all predicates and functions defined
in the module, while the former applies only to those whose definitions
include Mercury clauses.

Since an exported predicate or function may need nonexported auxiliary
predicates and/or functions, imposing a single order the declarations and
definitions of *all* the predicates and functions in a module is not a good
idea. Instead, both options divide the predicates and functions defined
in a module two groups, the exported and the nonexported, and expect
a consistent order only within each group.

The result is output that looks like this:

    time.m:021: Warning: the order of the declarations and definitions of the
    time.m:021:   exported predicates is inconsistent, as shown by this diff:
    time.m:021:
    time.m:021:   --- declaration order
    time.m:021:   +++ definition order
    time.m:021:   @@ -1,7 +1,7 @@
    time.m:021:    predicate `clock'/3
    time.m:021:   -predicate `time'/3
    time.m:021:    predicate `times'/4
    time.m:021:    function `clk_tck'/0
    time.m:021:   +predicate `time'/3
    time.m:021:    function `difftime'/2
    time.m:021:    predicate `localtime'/4
    time.m:021:    function `localtime'/1

compiler/options.m:
doc/user_guide.texi:
    Add the new options.

compiler/style_checks.m:
    A new module that generates the new warnings if warranted.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Include and document the new module.

compiler/mercury_compile_front_end.m:
    Invoke the new module if any of the three new options is set.

compiler/hlds_pred.m:
    Record the item number of every predicate, function, and mode declaration
    in the module being compiled. We need this for information for the
    new warnings.

compiler/hlds_module.m:
    Record the context of the module declaration. We use this context
    for warnings about inconsistent order, since there isn't a better one.

compiler/hlds_clauses.m:
    Add a mechanism to retrieve the item numbers of a set of clauses
    even if they are contiguous.

    Document some old data types.

compiler/error_util.m:
    Add a new phase for style checks.

compiler/accumulator.m:
compiler/add_class.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/from_ground_term_util.m:
compiler/lambda.m:
compiler/make_hlds.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/par_loop_control.m:
compiler/polymorphism.m:
compiler/stm_expand.m:
compiler/table_gen.m:
compiler/unify_proc.m:
    Conform the changes to the HLDS above.

compiler/typecheck_errors.m:
    Fix style of error messages.

library/array2d.m:
library/assoc_list.m:
library/benchmarking.m:
library/bit_buffer.write.m:
library/bool.m:
library/builtin.m:
library/construct.m:
library/cord.m:
library/counter.m:
library/float.m:
library/injection.m:
library/lazy.m:
library/lexer.m:
library/ops.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/prolog.m:
library/queue.m:
library/rational.m:
library/require.m:
library/stack.m:
library/std_util.m:
library/store.m:
library/thread.semaphore.m:
library/tree234.m:
library/univ.m:
library/version_store.m:
    Move declarations or definitions around to avoid some of the warnings
    that we can now generate. (There are many more left.)

    Make some minor style improvements in the process.

tests/warnings/inconsistent_pred_order.{m,exp}:
tests/warnings/non_contiguous_decls.{m,exp}:
    New test cases to test the new options. They are both copies of
    tests/benchmarks/queens.m, with intentionally-screwed-up style.

tests/warnings/Mmakefile:
    Enable the new test cases.

tests/warnings/Mercury.options:
    Specify the options being tested for the new test cases.

tests/benchmarks/queens.m:
    Bring the style of this module up to date (before copying it).

tests/invalid/mode_decl_in_wrong_section.err_exp:
    Expect the warnings we now generate.
2016-10-15 17:26:32 +11:00
Julien Fischer
46bfc2e549 Do not module qualify clause heads in library modules.
library/*.m:
    As above.

library/tree234.m:
    Fix spelling.

    Use spaces instead of tabs in some spots.
2016-08-10 11:55:55 +10:00
Zoltan Somogyi
f0ffbbc13c Convert (C->T;E) to (if C then T else E). 2015-12-01 05:35:29 +11:00
Zoltan Somogyi
4d172ad8f0 Make set_tree234.sorted_list_to_set use sortedness.
Also, add set_tree234.rev_sorted_list_to_set.

library/set_tree234.m:
    As above. The implementation of both predicates is copied from tree234.m,
    mutatis mutandis.

    Add the applicable type specializations.

    Put the nearby predicates in a more logical order.

library/set_ctree234.m:
    Replace the existing implementation of set_ctree234.sorted_list_to_set
    with a copy of the one in set_tree234.m.

    Add an implementation of set_ctree234.rev_sorted_list_to_set.

library/tree234.m:
    Make some code clearer.
2015-01-05 07:19:16 +11:00
Julien Fischer
370a297517 Add map.{foldl,foldr}5/12.
Add missing (mdi, muo) and semidet modes for map.foldl4 (foldr4 already has
them).

Strip unnecessary module qualification from the interface of the tree234 module
as per the current coding standard.

library/map.m:
	Add the above predicates.

	Add missing modes for map.foldl4/10.

library/tree234.m:
	Implement foldl5/12 and foldr5/12.

	Add missing modes for tree234.foldl4/10.

	Strip unnecessary module qualification.

NEWS:
	Announce the above additions.
2014-11-30 20:47:23 +11:00
Zoltan Somogyi
7f9791aa26 Standardize divider line lengths in the library.
library/*.m:
    As above.

tool/stdlines:
    A new shell script to do the job.
2014-11-23 22:05:34 +11:00
Peter Wang
f0032d3ae3 Modify code for stricter mode checking.
The following changes are necessary to compile the code following an
upcoming change to the mode checker.  Some of them are mode errors.

browser/declarative_oracle.m:
	The result of `query_oracle_kb' should be specific
	to avoid mode errors in callers.

compiler/accumulator.m:
	Help the compiler infer the declared inst.

compiler/mode_robdd.tfeirn.m:
	`zero' must be declared to return a normalised tfeirn value to
	avoid mode errors.  Change `one' for symmetry.

	`var_restrict_true' and `var_restrict_false' may return
	unnormalised tfeirn values (judging by the code).

	Modify `normalise' to help the compiler infer
	the declared inst.

compiler/tupling.m:
deep_profiler/autopar_find_best_par.m:
	Delete final insts that the compiler cannot verify.

library/tree234.m:
	Help the mode checker out using an explicit switch.

tests/hard_coded/bitmap_test.m:
tests/hard_coded/bitmap_tester.m:
	Add missing modes.
2014-10-10 16:13:34 +11:00
Julien Fischer
36f58a2d48 Add some more standard library procedures.
library/bimap.m:
	Add a predicate for testing semantic equality of bimaps.

library/assoc_list.m:
	Add fold_values with two or three accumulator arguments.

library/int.m:
	Add fold_{up,down} with three accumulator arguments.

library/map.m:
library/tree234.m;
	Add foldl_values with two or three accumulator arguments.

NEWS:
	Announce the above additions.

	Reformat the existing changes to the pqueue module slightly
2013-12-17 11:42:01 +11:00
Julien Fischer
0b0d3fc2fc Final changes for 13.05.2 release.
NEWS:
   Adjust some of the 13.05.2 NEWS entries.

library/tree234.m:
library/version_hash_table.m:
    The private_builtin module is implicitly imported via a use_module
2013-10-31 02:58:01 +11:00
Paul Bone
5c72797dc6 Implement map.equal/2
The unification operation on 2-3-4 trees tests if they are structurally
equal.  They might also be considered equal if their sets of key-value pairs
are equivalent.  I've created an equal/2 predicate in the tree234 and
map modules in the standard library to test this.

library/tree234.m:
    Implement a predicate to test for tree234 equivalence.

library/map.m:
    Forward map.equal/2 to tree234.equal/2.

NEWS:
    Announce this change in the news file.

tests/general/map_equal.m:
tests/general/map_equal.exp:
    Add test case for map.equal/2

tests/general/Mmakefile:
    Include the new test case.
2013-10-20 17:49:57 +11:00
Zoltan Somogyi
283f46e649 This diff makes three main changes to try to speed up the compiler:
Estimated hours taken: 16
Branches: main

This diff makes three main changes to try to speed up the compiler:

- Avoid a double traversal of a map in const_struct.m.

- Speed up that double traversal in const_struct.m when possible.

- Remove any variables eliminated by the conversion of
  from_ground_term_construct scopes to const structs from the procedure's
  varset and vartypes. Do so in bulk, if that seems to be worthwhile.

These together speed up the compiler by about 7% when compiling
training_cars_full.m. About two-thirds of that is from the first change,
almost a third is from the second, and a tiny bit from the third.

----------------------------

All the above changes rely on changes in the library.

library/tree234.m:
	Add a new predicate, search_insert(K, V, MaybeOldV, !Tree). If K
	is in !.Tree with value OldV, it sets MaybeOldV to yes(OldV) and
	leaves !Tree unchanged. If K is not in !.Tree, it inserts it into
	!Tree with value V. Basically, it does a search and an insert
	in ONE traversal, and is the map equivalent of the insert_new
	predicates I added to all the set modules recently.

	Put all the predicates in the module into a logical order.

	Replace all the calls to error with calls to unexpected. Replace
	all the sanity checks that called to require with calls to expect,
	and put them inside conditionally-enable trace scopes.

	Add a predicate for a quick-and-dirty estimate of the size of a tree.
	This is to support delete_sorted_list in map.m.

library/map.m:
	Make the new tree234.search_insert predicate accessible in the
	map module.

	Add a predicate for removing a *sorted* list of elements from a map,
	since this is more efficient if we are removing a large fraction
	of the map's elements.

library/varset.m:
	Implement a predicate that is analogous to the new delete_sorted_list
	predicate in map.m, and is implemented using it.

	Speed up varset.delete_vars even if the vars aren't sorted.

NEWS:
	Note the new predicates.

----------------------------

compiler/const_struct.m:
	Use the new capability of map.m to combine two traversals into one.
	(Change 1 at the top.)

	Divide the csdb_struct_map into two maps, one whose cons_ids are
	cons/3, and one for every other cons_id. Make the key of the map
	for the cons/3 cons_ids a structure that has its most distinctive
	components at the start, to reduce the cost of comparisons in lookups.
	(Change 2 at the top.)

----------------------------

compiler/simplify.m:
	When converting from_ground_term_construct scopes into constant
	structures, remove the eliminated variables from the varset and
	vartypes. (Change 3 at the top.)

	Restructure the simplify_info and its access predicates, in several
	respects:

	- Make all accesses to the fields through access predicates,
	  to allow profiling to count how frequently each is used.

	- Instead of including the det_info in the simplify_info, include
	  its components.

	- Separate the simplify_info into a main and a sub info, with the
	  main one being an 8 word structure containing only the most
	  frequently accessed fields. Some of these previously required
	  going through two structures (simplify_info and det_info).

	- Eliminate a field that was unused. (We no longer need to recompute
	  instmap deltas for atomic goals.)

	- Eliminate some other unused access predicates (setters for read-only
	  fields).

	- Separate the remaining access predicates from simple wrappers around
	  them. Put all the access predicates in an order that mirrors the
	  order of the fields in the simplify_info and sub_simplify_info
	  structures.

	- Give some predicates better names.

compiler/pd_util.m:
compiler/common.m:
	Conform to the above changes.

----------------------------

compiler/det_util.m:
	Put the arguments of a predicate into a more logical order.

compiler/det_analysis.m:
	Give some predicates more meaningful names.
2012-06-14 07:03:57 +00:00
Julien Fischer
ea2281af23 Add additional modes to map.foldr/4, map.foldr/6 etc.
Branches: main, 11.07

Add additional modes to map.foldr/4, map.foldr/6 etc.

library/map.m:
library/tree234.m:
	Add the new modes.
2012-04-14 15:00:21 +00:00
Julien Fischer
b2f25476d0 Fix bug #248: make the argument order of the singleton_set/2 predicates in the
Branches: main, 11.07 (partial)

Fix bug #248: make the argument order of the singleton_set/2 predicates in the
various set modules in the standard library consistent.  (This breaks backwards
compatibility but in a fairly minor way.)

Add the predicate is_singleton/2 to those set modules that do not already
provide it.

Fix a bug in the implementation of set_unordlist.singleton_set/2.

library/set.m:
library/set_bbbtree.m:
library/set_ctree234.m:
library/set_ordlist.m:
library/set_unordlist.m:
	Swap the argument order of singleton_set/2.

	Add is_singleton/2 where it wasn't already present.

library/set_unordlist.m:
	Fix a bug: singleton_set/2 failed to take account of
	the fact that the representation could contain duplicates
	in the singleton_setT::out, set_unordlist(T)::in) mode.
	The fix is to sort and remove the duplicates before checking
	whether the set is singleton.

NEWS:
	Announce the above changes.

library/eqvclass.m:
library/tree234.m:
compiler/accumulator.m:
compiler/code_info.m:
compiler/graph_colour.m:
compiler/higher_order.m:
compiler/lp_rational.m:
compiler/ml_tag_switch.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/proc_gen.m:
compiler/prog_mode.m:
compiler/term_pass1.m:
compiler/type_constraints.m:
compiler/unneeded_code.m:
compiler/var_locn.m:
deep_profiler/autopar_costs.m:
deep_profiler/var_use_analysis.m:
tests/general/set_test.m:
	Conform to the above changes.

tests/hard_coded/Mmakefile:
tests/hard_coded/singleton_dups.{m,exp}:
	Add a regression test for the problem with set_unordlist.singleton_set/2.
2012-01-17 15:49:47 +00:00
Julien Fischer
79f3d95511 Add the predicate map.keys_and_values/3 to the standrad library.
Branches: main, 11.07

Add the predicate map.keys_and_values/3 to the standrad library.

library/map.m:
library/tree234.m:
	Add the new predicate.

NEWS:
	Announce the new predicate.

tests/hard_coded/Mmakefile:
tests/hard_coded/test_keys_and_values.{m,exp}:
	Test the new predicate.
2012-01-15 14:49:36 +00:00
Julien Fischer
baf2ee19e9 Change the argument order of predicates in the rbtree and tree234 modules
Branches: main

Change the argument order of predicates in the rbtree and tree234 modules
to make them more conducive to the use of state variable notation.
(This change will break existing code that uses these modules but such
modules should be quite rare; most existing code uses the map module.)

library/rbtree.m:
	Change argument orderings as above.

	Add further modes for the foldl predicates that have
	(mostly-)unique accumulators.

library/tree234.m:
	Change argument orderings as above.

library/map.m:
profiler/generate_output.m:
tests/debugger/declarative/mapinit.m:
tests/hard_coded/transform_value.m:
	Conform to the above changes.

NEWS:
	Announce the above changes.
2011-05-18 15:40:35 +00:00
Julien Fischer
9ae7fe6b70 Change the argument ordering of predicates in the set module.
Branches: main

Change the argument ordering of predicates in the set module.

library/set.m:
	Change predicate argument orders to match the versions
	in the svset module.

	Group function definitions with the corresponding predicates
	rather than at the end of the file.

	Delete Ralph's comments regarding the argument order in the
	module interface: readers of the library reference guide are
	unlikely to be interested in his opinion of the argument ordering
	ten or so years ago.

	Add extra modes for set.map/3 and set.map_fold/5.

library/svset.m:
library/eqvclass.m:
library/tree234.m:
library/varset.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
mdbcomp/trace_counts.m:
extras/moose/grammar.m:
extras/moose/lalr.m:
extras/moose/moose.m:
tests/hard_coded/bitset_tester.m:
	Conform to the above change.

NEWS:
	Announce the above changes.
2011-05-06 05:03:29 +00:00
Julien Fischer
ed204ca082 Add functions for creating singleton maps (of various sorts) to the standard
Branches: main

Add functions for creating singleton maps (of various sorts) to the standard
library.  The rationale for this to replace the following sequence of code,
which occurs a lot throughout the Mercury system:

    map.init(Map0),
    map.det_insert(SomeKey, SomeValue, Map0, Map)

library/bimap.m:
library/injection.m:
library/map.m:
library/rbtree.m:
library/tree234.m:
	Add the new function singleton/2 that takes single key-value
	pair as arguments and returns a new map.

compiler/disj_gen.m:
	Avoid ambiguity in a spot.

NEWS:
	Announce the additions.
2011-05-05 04:35:34 +00:00
Julien Fischer
e2d64ebbe0 Add semidet modes with (mostly-)unique accumulators for many of the fold-style
Branches: main

Add semidet modes with (mostly-)unique accumulators for many of the fold-style
predicates in the standard library that didn't already have such modes.

library/bimap.m:
library/cord.m:
library/list.m:
library/map.m:
library/tree234.m:
	As above.

NEWS:
	Announce the above additions.
2010-11-22 06:02:14 +00:00
Peter Wang
cfbc28ac58 Add cc_multi modes for map.foldl2 and tree234.foldl2.
Branches: main, 10.04

library/map.m:
library/tree234.m:
        Add cc_multi modes for map.foldl2 and tree234.foldl2.

NEWS:
        Announce the additions.
2010-07-28 02:10:09 +00:00
Zoltan Somogyi
62d7496a7e Significant further improvements in the worst-case behavior of the compiler
Estimated hours taken: 16
Branches: main

Significant further improvements in the worst-case behavior of the compiler
when working on code such as zm_eq20.m and zm_coerce_tuples.m. On my laptop,
zm_eq20.m and zm_coerce_tuples.m now compile in 2.5s and 12.9s respectively;
the times before were 86.4s and 54.0s. The sizes of the stage 110 HLDS dumps
(the stage just after lambda expansion) go from 8.5Mb and 760Mb (!) to
just 0.4Mb and 7.4Mb respectively.

compiler/polymorphism.m:
	Remember not just which typeinfos we have constructed, but also what
	type_ctor_infos, base_typeclass_infos and typeclass_infos we have
	constructed, so that we don't have to construct them again for code
	that is executed later.

	The maintenance of the additional maps adds some overhead that in
	typical code probably cannot be made back through the resulting
	reductions in the workload of later compiler passes. However,
	the avoidance of horrible worst-case behavior trumps small increases
	in normal-case runtime.

	For zm_coerce_tuples, polymorphism.m now generates as good HLDS code
	as can be expected within each lambda expression. There is still
	a lot of duplicated code, with each copy being in a different lambda
	expression, but factoring out these commonalities will require a
	fundamentally different approach.

	Avoid using the misleading prefix "TypeClassInfo_" on the names of
	variables holding base_typeclass_infos.

compiler/ml_elim_nested.m:
	Don't look for static definitions where they cannot occur anymore.

	When deciding whether a definition needs to be hoisted out,
	don't look for it being used in later static definitions,
	since all the static definitions are now elsewhere.

	In order to avoid running the compiler out of nondet stack space
	on zm_coerce_tuples.m, avoid the use of enumerating all the
	definitions in a potentially huge piece of MLDS by backtracking.

compiler/hlds_rtti.m:
	Avoid enumerating all the members of a potentially huge list
	by backtracking in order to avoid running the compiler out of nondet
	stack space on zm_coerce_tuples.m.

	I first tried to do this by constructing the list with det code,
	but this turned out not to fix the underlying problem, which was that
	almost all of the list's elements were copies of each other, and we
	then had to get rid of the copies. The actual fix is to gather the
	types we need directly as a set.

	Provide restrict_rtti_varmaps for use by lambda.m.

	Give the field names of the rtti_varmaps type a distinguishing prefix.

compiler/lambda.m:
	The fundamental reason for the bad performance of the equiv_type_hlds
	pass on zm_coerce_tuples.m was that even with the recent improvements
	to polymorphism.m, a couple of big predicates had about ten thousand
	variables each, and when lambda.m created about 200 new procedures
	from the lambda expressions inside them, it duplicated those huge
	vartypes and rtti_varmaps for each one.

	The fix is to restrict the vartypes and the rtti_varmaps of both
	the newly created procedures and the old procedure they were taken from
	to the variables that actually occur in them.

	We could potentially avoid the need to restrict the rtti_varmap
	of the original procedure for the new procedures created for lambda
	goals by having polymorphism.m give each rhs_lambda_goal its own
	rtti_varmap in the first place, but that would be future work.

	Use the "no lambda" version of quantification after the lambda pass,
	since we have just removed all the lambdas from the goal being
	quantified.

	Give the predicates of this module more expressive names.

compiler/mercury_compile.m:
	Conform to the change in lambda.m.

compiler/equiv_type_hlds.m:
	Use specialized versions of the predicates in equiv_type.m, since
	the general versions do some things (finding circularities, recording
	used modules) that this pass does not need. Use some new predicates
	from the standard library to reduce overhead.

compiler/ml_optimize.m:
	In order to avoid running the compiler out of nondet stack space
	on zm_coerce_tuples.m, avoid the use of enumerating all the members
	of a potentially huge list by backtracking.

	Move a cheap test before a more expensive one.

compiler/modes.m:
compiler/modecheck_unify.m:
	Avoid some unnecessary overheads when modechecking typeinfos and
	related variables. One overhead was iteration over a list of exactly
	one element, another is a redundant lookup of the variable's type,
	and the third is the redundant setting of the unify context.

compiler/inst_match.m:
	Use set_tree234s instead sets to keep track of expansions in one group
	of predicates indicated by benchmarking.

library/list.m:
	Add a new predicate, list.find_first_match, which is a version of
	filter that returns only the first matching item. This is for use
	in ml_elim_nested.m.

	Make list.sort_and_remove_dups remove duplicates as it goes,
	not all at the end, since this (a) allows us to avoid a separate
	duplicate-elimination pass at the end, and (b) any duplicate eliminated
	in one merge pass reduces the workload for any later merge passes.

	Put some code in its proper order, since preserving tail recursion
	in Prolog is no longer an issue.

library/map.m:
	Add  versions of map.foldl{,2,3} and map.map_foldl{,2,3} that do not
	pass the key to the higher order argument, for use by some of the
	compiler modules above.

	Group the declarations of all the foldr predicates together.

library/tree.m:
	Make the same changes as in map.m, in order to implement map.m's new
	predicates.

library/varset.m:
	Minor style improvements.

library/set_tree234.m:
	Fix a wrong comment.

NEWS:
	Mention the new additions to the library.
2009-09-16 02:32:56 +00:00
Zoltan Somogyi
163869a21f Add map_foldl3 predicates to both modules.
Estimated hours taken: 0.1
Branches: main

library/map.m:
library/tree_234.m:
NEWS:
	Add map_foldl3 predicates to both modules.
2009-09-04 02:53:52 +00:00
Zoltan Somogyi
5af57da91d Further compiler speedups.
Estimated hours taken: 4
Branches: main

Further compiler speedups.

library/varset.m:
	Speed up predicates by avoding making the same decisions over and over
	again.

library/tree234.m:
library/map.m:
NEWS:
	Add tree234.map_values_only and map.map_values_only.

compiler/add_pragma.m:
compiler/analysis.m:
compiler/code_info.m:
compiler/cse_detection.m:
compiler/cse_detection.m:
compiler/equiv_type_hlds.m:
compiler/global_data.m:
compiler/hlds_out.m:
compiler/hlds_rtti.m:
compiler/inst_graph.m:
compiler/lp_rational.m:
compiler/hlds_out.m:
compiler/mlds_to_il.m:
compiler/modules.m:
compiler/par_conj_gen.m:
compiler/polymorphism.m:
compiler/prog_data.m:
compiler/prog_type_subst.m:
compiler/recompilation.version.m:
compiler/simplify.m:
compiler/stack_layout.m:
compiler/type_util.m:
compiler/unneeded_code.m:
	Use the new predicates.

compiler/mark_static_terms.m:
	Do not bother traversing from_ground_term_construct scopes.

	Remove a redundant test.

compiler/ml_unify_gen.m:
	Speed up a predicate by avoding making the same decisions over and over
	again.

compiler/mlds.m:
	Factor out some code.

compiler/typecheck_info.m:
	Operate on vartypes directly as maps; don't transform them
	unnecessarily into association lists.

	Do not bother to apply empty substitutions.
2009-09-03 23:07:33 +00:00
Ian MacLarty
7a3a7e5621 Add mdi/muo modes for foldl and foldr.
Estimated hours taken: 0.1
Branches: main

library/map.m:
library/tree234.m:
	Add mdi/muo modes for foldl and foldr.
2009-02-16 03:27:19 +00:00
Ian MacLarty
a049c59faf Add cc_multi modes for map.foldl and map.foldr.
Estimated time taken: 0.1
Branches: main

Add cc_multi modes for map.foldl and map.foldr.

library/map.m:
library/tree234.m:
	Add cc_multi modes for foldl and foldr.
2009-02-15 23:46:23 +00:00
Zoltan Somogyi
a11fc97c95 Add and use the capability of building 234 trees directly.
Estimated hours taken: 16
Branches: main

Add and use the capability of building 234 trees directly.

library/tree234.m:
	Add new predicates for converting sorted assoc lists (both ascending
	and descending) directly to trees. These should be significantly more
	efficient than the existing assoc_list_to_tree234 predicate, which
	does not assume sortedness, and thus inserts each element individually.
	The main source of the efficiency improvement is that we avoid the
	creation of lots of intermediate trees.

	Add some sanity check predicates in the part of the module that
	is not included in the documentation.

library/map.m:
	Add a new predicate for creating a map from a reverse sorted assoc
	list.

	Modify the existing predicate for creating a map from a sorted assoc
	list to use the new predicate in tree234.m, which should be more
	efficient.

	Since the new implementation of this predicate doesn't allow
	duplicates, modify map.old_merge, which cannot ensure the absence of
	duplicates, to call the old general implementation (which is not
	reliant on sortedness or duplicate-freedom) instead.

NEWS:
	Mention the publically visible new predicates, and the change in
	map.from_sorted_assoc_list.

compiler/code_info.m:
compiler/equiv_type.m:
compiler/intermod.m:
compiler/var_locn.m:
	Use the new, faster predicates when possible.

compiler/hlds_goal.m:
compiler/instmap.m:
	Give some variables better names.

tests/hard_coded/tree234_sorted_insert.{m,exp}:
	New test case to check the new functionality.

tests/hard_coded/Mmakefile:
	Enable the new test case.
2009-01-02 03:12:09 +00:00
Peter Wang
311976395b Extend `--warn-insts-without-matching-type' to warn about insts defined in the
Branches: main

Extend `--warn-insts-without-matching-type' to warn about insts defined in the
interface which refer to constructors of types defined in the implementation.
This is usually done because Mercury doesn't (yet) support abstract insts so
the inst is exported while keeping the type abstract.  However, it is not
really safe.  Other modules, can see the function symbols from the inst but
cannot match them up to constructors from the type definition.  Hence those
constructors never get module qualified.

This is related to Mantis bug #26.

compiler/inst_check.m:
	Check that exported inst definitions have a matching type that is
	visible (we can see its constructors) in the interface.

	Fix some spelling.

compiler/mode_robdd.tfeirn.m:
library/array2d.m:
library/hash_table.m:
library/tree234.m:
	Export previously abstract types in "secret" interface sections,
	where necessary to avoid the warning.

tests/warnings/inst_with_no_type.exp:
	Update expected output.

tests/warnings/inst_with_no_type.m:
	Fix a comment.
2008-08-08 05:02:21 +00:00
Julien Fischer
93c2d488dd Improve support for mostly-uniqueness in the standard library.
Estimated hours taken: 1
Branches: main

Improve support for mostly-uniqueness in the standard library.

library/bimap.m:
library/list.m:
library/map.m:
library/set.m:
library/tree234.m:
	Add modes to fold style predicates with mostly-unique accumulators.

	Add semidet versions of fold style predicate with unique accumulators.

	Re-order the mode declarations for the above predicates; in a lot
	of cases the ordering made it difficult to see if a required mode
	was actually present.  The new ordering is by determinism and then
	by uniqueness.

NEWS:
	Announce the additions.
2008-07-31 06:34:47 +00:00
Zoltan Somogyi
9469c4ec96 Fix formatting.
Estimated hours taken: 0.1
Branches: main

library/string.m:
library/tree234.m:
	Fix formatting.
2007-09-10 04:45:07 +00:00
Ralph Becket
67ec243a51 Define pretty_printer formatters for some common standard library types.
Estimated hours taken: 4
Branches: main

Define pretty_printer formatters for some common standard library types.
Include these formatters in the default pretty_printer formatter_map.
Add a useful function to the pretty_printer interface.

library/array.m:
library/char.m:
library/float.m:
library/int.m:
library/list.m:
library/string.m:
library/tree234.m:
	Add <type>_to_doc functions.

library/pretty_printer.m:
	Added function format_arg/1.
	Initialise the default formatter_map to use the <type>_to_doc
	functions.

tests/hard_coded/Mmakefile:
tests/hard_coded/test_pretty_printer_defaults.exp:
tests/hard_coded/test_pretty_printer_defaults.m:
	Test case.
2007-08-14 04:21:09 +00:00
Ralph Becket
9d72f5cc85 Add the foldr family to map and tree234.
Estimated hours taken: 2
Branches: main

Add the foldr family to map and tree234.

NEWS:
	Mention this change.

library/map.m:
library/tree234.m:
	Added the foldr family.

tests/hard_coded/Mmakefile:
tests/hard_coded/map_fold.exp:
tests/hard_coded/map_fold.m:
	Add a test case for map.foldl/foldr.
2007-07-30 06:03:08 +00:00
Julien Fischer
ede1b66f7f Make a few minor cleanups to the map and tree234 modules.
Estimated hours taken: 0.2
Branches: main

Make a few minor cleanups to the map and tree234 modules.

library/tree234.m:
	Comment out a bunch of unique modes that are unused.

	Minor style fixes.

library/map.m:
	Use state variables in a couple of spots.
2007-02-06 05:55:58 +00:00
Julien Fischer
9cd94b5c72 Various minor cleanups and syntax updates for the standard library.
Estimated hours taken: 1
Branches: main

Various minor cleanups and syntax updates for the standard library.
There are no changes to any algorithms.

library/injection.m:
library/set.m:
library/sparse_bitset.m:
	Use promise_equivalent_clauses where appropriate.

library/set_ordlist.m:
library/set_unordlist.m:
	Convert these module to 4-space indentation:
		Convert these module to 4-space indentation

library/*.m:
	Convert some if-then-elses into switches.

	Remove unnecessary module qualification - this is related
	mainly to the breakup of std_util and the fact that on
	the 0.13 branche we had two versions of the all-solutions
	predicates.

	Various other style cleanups.

vim/syntax/mercury.vim:
	Highlight promise_equivalent_clauses appropriately.
2006-10-23 00:33:04 +00:00
Zoltan Somogyi
8064833716 Add a couple of modes to map_foldl2.
Estimated hours taken: 0.1
Branches: main

library/map.m:
library/tree234.m:
	Add a couple of modes to map_foldl2.
2006-04-28 02:48:00 +00:00
Julien Fischer
e0f5ac47db Make it easier for vi to jump past the initial comments
Estimated hours taken: 0.1
Branches: main

library/*.m:
	Make it easier for vi to jump past the initial comments
	at the head of a module.
2006-04-19 05:18:00 +00:00
Julien Fischer
5e92224eec Improve the library reference manual by formatting the beginning of
Estimated hours taken: 0.2
Branches: main, release

library/*.m:
	Improve the library reference manual by formatting the beginning of
	library modules consistently.

library/integer.m:
	Fix some bad indentation.
2006-04-13 06:08:05 +00:00