Commit Graph

45 Commits

Author SHA1 Message Date
Zoltan Somogyi
47e867b5e0 Delete redundant module qualifiers. 2023-02-21 00:40:31 +11:00
Julien Fischer
e7d28ff90f Update copyright notices in stdlib.
library/*.m:
    As above.
2022-06-07 21:51:03 +10:00
Zoltan Somogyi
8ff61f8a4b Delete quotes from `VarNames' in stdlib comments.
In the Mercury standard library, every exported predicate or function
has (or at least *should* have) a comment that documents it, including
the meanings of its arguments. About 35-40% of these modules put `'s
(left and right quotes) around the names of the variable representing
those arguments. Some tried to do it consistently (though there were spots
with unquoted or half quoted names), while some did it only a few places.
This is inconsistent: we should either do it everywhere, or nowhere.
This diff makes it nowhere, because

- this is what the majority of the standard library modules do;
- this is what virtually all of the modules in the compiler, profiler,
  deep_profiler etc directories do;
- typing all those quotes when adding new predicates in modules that
  follow this convention is a pain in the ass; and because
- on many modern terminals, `' looks non-symmetrical and weird.

Likewise, the comment explaining a predicate often started with

    % `predname(arguments)' returns ...

This diff deletes these quotes as well, since they add nothing useful.

This diff does leave in place quotes around code fragments, both terms
and goals, where this helps delineate the boundaries of that fragment.
2022-03-07 11:49:00 +11:00
Zoltan Somogyi
06f81f1cf0 Add end_module declarations ...
.. to modules which did not yet have them.
2022-01-09 10:36:15 +11:00
Zoltan Somogyi
63dabcfcf8 Fix filling in partial terms that use direct_arg tags.
This fix uses the approach discussed on m-dev 2020 nov 16/17 for fixing
github issue #72, whose core problem is a need for information flow
back to a the caller from a callee when the callee fills in the
argument of a function symbol whose representation is a direct_arg tag.
In most cases when the callee fills in the value of an argument,
the caller can see it because the argument is in a word on the heap,
but when the function symbol uses a direct_arg tag, that is not the case.

compiler/direct_arg_in_out.m:
    A new module that implements the transformation proposed on m-dev.
    It creates a fresh clone variable every time an argument of a direct_arg
    tag function symbol is (or may be) updated. This can happen several
    times if a type has more than one function symbol with a direct_arg tag.
    Since the affected variable can be bound to only one function symbol
    at the start, its argument can be filled in only once, but the
    compiler cannot know in advance what function symbol the variable
    contains, and therefore which of the possibly several fill-in sites
    (which fill in the arguments of different function symbols) executed
    in sequence will actually update the variable.

    The transformation ensures that once a variable is cloned, it is
    never referred to again. It also ensures that in a branched control
    structure (if-then-else, disjunction or switch), all branches will use
    the *same* variable to represent the latest version of each cloned
    variable at the end, so that following code has a consistent view
    regardless of through which branch execution has reached it.

    There are three situations that the transformation cannot and does not
    handle.

    1. Situations in which the mode of an argument is either an inst variable,
       or an abstract inst. In either case, the pass cannot know whether
       it should apply its transformation to the argument.

    2. Situations where a procedure that has such an argument is
       exported to C code as a function. In that case, the C signature
       of the function we would generate would be different from what
       the user would normally expect. We could modify the documentation
       of the export pragma, but I don't think there much point due to
       lack of demand. (The problem cannot arise when targeting any language
       other than C, because we use direct_arg tags only with the low level
       data representation, which we only use for C.)

    3. Situations where a procedure that has such an argument is defined
       by foreign_proc. Again, dealing with the problem would require
       nontrivial changes to the documented interface between code in
       foreign_procs and the surrounding Mercury code, and I see no demand
       for code that could benefit from that.

    In these cases, this module generates error messages.

compiler/transform_hlds.m:
    Include the new module in the transform_hlds package.

    Delete unnecessary module qualification on some existing inclusions.
    Put some existing inclusions into a more meaningful order.

compiler/notes/compiler_design.html:
    Document the new pass. Fix some nearby prose.

compiler/lambda.m:
compiler/simplify_proc.m:
    Use a predicate exported by direct_arg_in_out.m to test, for each
    procedure, whether the procedure has any argument positions that are
    subject to the problem that direct_arg_in_out.m addresses.
    simplify_proc.m does this for all procedures it processes;
    lambda.m does this for all the procedures it creates from
    lambda expressions.

    Give a predicate in simplify_proc.m a better name.

    Sort a list of predicate names.

compiler/hlds_module.m:
    Add a field to the module_info that simplify_proc.m and lambda.m
    can use to tell direct_arg_in_out.m what work (if any) it needs to do.

compiler/mercury_compile_middle_passes.m:
    Invoke direct_arg_in_out.m if the new field in the HLDS indicates
    that it has some work to do. (In the vast majority of compiler invocations,
    it won't have any.)

compiler/hlds_pred.m:
    The new code in direct_arg_in_out.m creates a clone of each procedure
    affected by the problem, before deleting the originals (to make sure that
    no references to the unfixed versions of now-fixed procedures remain.)
    Make it possible to create exact clones of both predicates and procedures
    by adding two pairs of predicates, {pred,proc}_prepare_to_clone and
    {pred,proc}_create.

    Add the direct_arg_in_out transformation as a possible source
    of transformed predicates.

library/private_builtin.m:
    Add a new builtin operation, partial_inst_copy, that the new module
    generates calls to.

configure.ac:
    Require the installed compiler to recognize partial_inst_copy
    as a no_type_info builtin.

compiler/builtin_ops.m:
    Recognize the new builtin. (This was committed before the rest; the diff
    to private_builtin.m can be done only once the change to builtin_ops.m
    is part of the installed compiler.)

compiler/options.m:
    Add a way to test whether the builtin_ops.m in the installed compiler
    recognizes the new builtin.

compiler/dead_proc_elim.m:
    Do not delete the new primitive before direct_arg_in_out.m has had
    a chance to generate calls to it.

    Add an XXX.

compiler/error_util.m:
    Recognize the new module as a source of error messages.

compiler/pred_table.m:
    Add a pair of utility predicates to be used when looking up
    builtin predicates, for which the compiler writer knows that
    there should be exactly one match. These are used in direct_arg_in_out.m.

compiler/simplify_goal_call.m:
    Replace some existing code with calls to the new predicates
    in pred_table.m.

compiler/hlds_goal.m:
    Add modes to rename_vars_in_goal_expr that express the fact
    that when an atomic goal_expr has some variables renamed inside it,
    it does not suddenly become some *other* kind of goal_expr.
    New code in direct_arg_in_out.m relies on this.

compiler/hlds_out_goal.m:
    When the HLDS we are dumping out is malformed because it contains
    calls to predicates that have been deleted, the compiler used to abort
    at such calls. (I ran into this while debugging direct_arg_in_out.m.)

    Fix this. When such calls are encountered, we now print out as much
    information we can about the call, and prefix the call with an
    unmistakable prefix to draw attention to the problem.

compiler/inst_util.m:
    Fix a bug that prevented direct_arg_in_out.m from even being invoked
    on some test code for it.

    The bug was in code that we use to unify a headvar's initial inst
    with its final inst. When the initial inst was a non-ground bound_inst
    such as the ones used in tests/hard_coded/gh72.m, and the final inst
    was simply "ground", this code quite properly returned a bound_inst
    (which, unlike ground, can show the exact set of function symbols
    that the headvar could be bound to). The problem was that it
    reused the original bound_inst's test results, including the one
    that said the final inst is NOT ground, which of course is wrong
    for any inst unified with ground. Fix two instances of this bug.

compiler/modes.m:
    Make some of the code I had to traverse to find the bug in inst_util.m
    easier to read and understand.

    Replace some uses of booleans with bespoke enum types.

    Change the argument lists of some predicates to put related arguments
    next to each other.

    Give some variables more descriptive names.

compiler/layout_out.m:
    Conform to the change in hlds_pred.m.

compiler/var_locn.m:
    Fix a code generation bug. When filling-in the value of the argument
    of a function symbol represented by a direct_arg tag, the code we
    generated for it worked only if the direct_arg tag used 0
    as its ptag value. In the test cases we initially used for
    github issue 72, that was the case, but the new tests/hard_coded/gh72.m
    has direct_tag args that use other ptag values as well.

    Document the reason why the updated code works.

compiler/term_constr_initial.m:
    Add the new primitive predicate added to private_builtin.m,
    partial_inst_copy, to a table of builtins that do not take type_infos,
    even though their signatures contain type variables.

    Fix a bunch of old bugs: most other such primitives were not listed
    either.

mdbcomp/program_representation.m:
    Add partial_inst_copy to the master list of builtins that do not take
    type_infos even though their signatures contain type variables. (Done
    by an earlier commit.)

    Document the fact that any updates here require updates to
    term_constr_initial.m.

library/multi_map.m:
    We have long had multi_map.add and multi_map.set as synonyms,
    but we only had multi_map.reverse_set. Add multi_map.reverse_add
    as a synonym for it.

    Define the "set" versions in terms of the "add" versions,
    instead of vice versa.

NEWS:
    Document the new predicates in multi_map.m.

tests/hard_coded/gh72a.m:
    Fix typo.

tests/hard_coded/gh72.{m,exp}:
    A new, much more comprehensive test case than gh72a.m.
    This one tries to tickle github issue 72 in as many forms of code
    as I can think of.

tests/invalid/gh72_errors.{m,err_exp}:
    A test case for testing the generation of error messages for
    two out of the three kinds of situations that direct_arg_in_out.m
    cannot handle. (Proposals for how to test the third category welcome.)

tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
    Enable the two new test cases, as well as two old ones, gh72[ab].m,
    that previously we didn't pass.

tests/invalid/Mercury.option:
    Do not compile gh72_error.m with --errorcheck-only, since its errors
    are reported by a pass that --errorcheck-only does not invoke.
2021-01-13 05:35:40 +11:00
Zoltan Somogyi
a5e49ed7c4 Add sorted_keys and keys_as_set to more map modules.
library/multi_map.m:
library/one_or_more_map.m:
    Add sorted_keys and keys_as_set to both modules in both function and
    predicate forms.

library/map.m:
    Use meaningful variable names in related code.

NEWS:
    Announce the changes to multi_map. (The description of one_or_more_map
    is already "a copy of multi_map".)
2020-03-08 22:44:27 +11: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
95f8f56716 Delete unneeded $module args from calls to expect/unexpected. 2019-07-03 22:37:19 +02: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
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
Julien Fischer
4f1e258fbc Avoid excessive module qualification in some library modules.
library/multi_map.m:
library/rbtree.m:
library/pqueue.m:
    Avoid module qualifying clause heads.

    Minor formatting fixes.
2016-07-27 12:30:06 +10:00
Julien Fischer
a7159f86b0 Minor cleanups.
library/private_builtin.m:
library/multi_map.m:
compiler/hlds_module.m:
    Fix spelling.

library/rtree.m:
    Delete redundant module qualification from clause heads.
2016-07-01 10:48:47 +10:00
Zoltan Somogyi
44f9f1f405 Convert (C->T;E) to (if C then T else E). 2015-12-01 07:58:07 +11:00
Zoltan Somogyi
a4031fa62b Clarify documentation. 2015-09-03 00:20:56 +10:00
Zoltan Somogyi
556653a0b8 Improve multi_map.m.
Change the wording of the comments explaining predicates to be more
descriptive, as well as more consistent.

Consistently use K and V as the type variables for the keys and values.

Change variable names to be more consistent.

Use named aux predicates instead of lambdas.

Use cords to avoid reversing and unreversing lists when converting a multi_map
to a flat assoc list.

Avoid lots of memory allocations when counting all the values in a multi_map.

Put related predicates next to each other.
2015-09-01 23:21:13 +10:00
Zoltan Somogyi
32008490e7 Speed up the compiler, and improve error messages for bad insts.
On tools/speedtest -l, my three tests shows speedups between 7% and 12%
for this diff. For Dirk's stress test module, for which the compiler
spends almost all its time handling insts, the speedup was bigger:
the compilation time went from 3.6 to 2.3 seconds.

compiler/inst_user.m:
    A new module that pretests user defined bound insts, and records
    the results in the insts themselves, so that those tests won't
    have to be done repeatedly, each time the compiler needs their results.

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

compiler/mercury_compile_front_end.m:
    Invoke the new module.

compiler/inst_check.m:
    Rewrite this module to record, for each user defined bound inst, the type
    constructor(s) that the top-level bound insts match. This should allow a
    later diff to make inst_user.m more effective by pre-pushing the one
    matching type constructor into the inst, for insts that *do* have exactly
    *one* matching type constructor.

    The information needed for this also allows us to generate more precise
    error messages, fulfilling an earlier TODO.

compiler/hlds_data.m:
    Add a field to inst definitions to allow this recording.

    Don't hide the representation of the table of user insts. It just makes
    code working with it harder, and provides no benefit, since any useful
    structure imposed on top of the current simple map would require the
    lookups to be done *inside* the abstraction barrier, which the current
    design does not allow.

compiler/prog_data.m:
    Add a redundant field to the representation of data constructors (function
    symbols) in type definitions. This field holds the number of arguments
    of the function symbols, computed just once when the representation is
    created, rather than many times later on in many parts of the compiler.

compiler/prog_io_type_defn.m:
    Fill in the new redundant field when the constructor representations
    are created.

compiler/mode_util.m:
    Avoid the use of higher order code in a predicate that happens to be
    performance critical when compiling Dirk's stress test module.

compiler/add_mode.m:
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/du_type_layout.m:
compiler/equiv_type.m:
compiler/export.m:
compiler/hhf.m:
compiler/hlds_module.m:
compiler/hlds_out_module.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/make_tags.m:
compiler/mercury_to_mercury.m:
compiler/ml_type_gen.m:
compiler/module_qual.m:
compiler/post_typecheck.m:
compiler/prog_type.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/special_pred.m:
compiler/term_constr_build.m:
compiler/term_norm.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
    Conform to the changes above.

library/Mercury.options:
    Disable the trace flag that calls for the runtime testing of the invariants
    of the tree_bitset.m module. We have tested it far more than necessary,
    and it has been just overhead for a long time now. This helps speed up
    quantification, which takes nontrivial time on Dirk's module.

library/multi_map.m:
    Add a utility predicate needed above. It is a reverse set, i.e. a set
    with a value, key argument order.

    Put the code for the function versions of predicates next to the code
    for the predicate versions.

tests/warnings/inst_with_no_type.m:
tests/valid/inst_perf_bug_1.m:
    Fix indentation.

tests/warnings/inst_with_no_type.exp:
    Update this file to expect the new and improved error messages now
    generated by inst_check.m.
2015-02-28 14:40:34 +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
Julien Fischer
bed96b93ff Avoid module qualification in library interfaces where possible.
NOTE: this change does not affect the io module -- I've left that for a
separate change.

library/*.m:
	As per the recent change to the coding standard, avoid module
	qualification in library interfaces where possible.

	Reformat declarations and descriptive comments to better utilise
	any space freed up by the above.
2014-10-10 15:08:24 +11:00
Julien Fischer
266c1fac41 Fix a bug reported by Tomas By on mercury-bugs: the behaviour of
Branches: main, 11.07

Fix a bug reported by Tomas By on mercury-bugs: the behaviour of
multi_map.det_update/4 did not match the documentation.

library/multi_map.m:
	Fix the behaviour of det_update/4.

	Add replace/4, a semidet version of det_replace/4.

	Reformat some documentation.

NEWS:
	Announce the above fix and addition.

tests/hard_coded/multi_map_test.{m,exp}:
	Replace the existing test for multi_maps with something a bit
	stronger: in particular check the semantics of update, replace,
	insert and set.
2011-07-12 07:11:06 +00:00
Julien Fischer
9f68c330f0 Change the argument order of many of the predicates in the map, bimap, and
Branches: main

Change the argument order of many of the predicates in the map, bimap, and
multi_map modules so they are more conducive to the use of state variable
notation, i.e. make the order the same as in the sv* modules.

Prepare for the deprecation of the sv{bimap,map,multi_map} modules by
removing their use throughout the system.

library/bimap.m:
library/map.m:
library/multi_map.m:
	As above.
NEWS:
	Announce the change.

	Separate out the "highlights" from the "detailed listing" for
	the post-11.01 NEWS.

	Reorganise the announcement of the Unicode support.

benchmarks/*/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
extras/*/*.m:
mdbcomp/*.m:
profiler/*.m:
tests/*/*.m:
ssdb/*.m:
samples/*/*.m
slice/*.m:
	Conform to the above change.

	Remove any dependencies on the sv{bimap,map,multi_map} modules.
2011-05-03 04:35:04 +00:00
Julien Fischer
62cc99e241 Formatting and style fixes for standard library modules.
Estimated hours taken: 0.2
Branches: main

Formatting and style fixes for standard library modules.

Fix a bunch of minor problems, e.g. unnecessary module imports.

library/bitmap.m:
	s/memcpy/MR_memcpy/ in a spot.

	Call throw/1 rather than error/1 and don't import the require
	module.

library/term_to_xml.m:
	Don't import the require module.  It is unused here.

library/time.m:
	Add some missing `thread_safe' annotations.

library/bool.m:
library/cord.m:
library/gc.m:
library/multi_map.m:
library/queue.m:
library/rtti_implementation.m:
library/set.m:
library/set_bbbtree.m:
library/svarray.m:
library/svbag.m:
library/svbimap.m:
library/sveqvclass.m:
	Formatting and style fixes.
2007-03-06 05:48:34 +00:00
Peter Ross
84ffc0924d Fix --warn-unused-imports warnings in some of the modules.
Estimated hours taken: 4
Branches: main

library/*.m:
compiler/*.m:
	Fix --warn-unused-imports warnings in some of the modules.
2006-09-27 06:17:09 +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
459847a064 Move the univ, maybe, pair and unit types from std_util into their own
Estimated hours taken: 18
Branches: main

Move the univ, maybe, pair and unit types from std_util into their own
modules.  std_util still contains the general purpose higher-order programming
constructs.

library/std_util.m:
	Move univ, maybe, pair and unit (plus any other related types
	and procedures) into their own modules.

library/maybe.m:
	New module.  This contains the maybe and maybe_error types and
	the associated procedures.

library/pair.m:
	New module.  This contains the pair type and associated procedures.

library/unit.m:
	New module. This contains the types unit/0 and unit/1.

library/univ.m:
	New module. This contains the univ type and associated procedures.

library/library.m:
	Add the new modules.

library/private_builtin.m:
	Update the declaration of the type_ctor_info struct for univ.

runtime/mercury.h:
	Update the declaration for the type_ctor_info struct for univ.

runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
	Update the definition of MR_Univ.

runtime/mercury_init.h:
	Fix a comment: ML_type_name is now exported from type_desc.m.

compiler/mlds_to_il.m:
	Update the the name of the module that defines univs (which are
	handled specially by the il code generator.)

library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
	Conform to the above changes.  Import the new modules where they
	are needed; don't import std_util where it isn't needed.

	Fix formatting in lots of modules.  Delete duplicate module
	imports.

tests/*:
	Update the test suite to confrom to the above changes.
2006-03-29 08:09:58 +00:00
Zoltan Somogyi
b6b4647055 Add a function for use by the scanner generator.
Estimated hours taken: 0.5
Branches: main

library/eqvclass.m:
	Add a function for use by the scanner generator.

library/multi_map.m:
	Fix typo in comment.

NEWS:
	Mention the new function.
2006-03-13 04:00:13 +00:00
Zoltan Somogyi
b293bd999d Replace __ with . as the module qualifier everywhere.
Estimated hours taken: 1
Branches: main

library/*.m:
	Replace __ with . as the module qualifier everywhere.

tests/hard_coded/test_injection.exp:
	Replace __ with . as the module qualifier in expected exceptions.
2006-03-07 22:23:58 +00:00
Zoltan Somogyi
57b8f436eb Convert to four-space indentation most of the library modules that
Estimated hours taken: 4
Branches: main

library/*.m:
	Convert to four-space indentation most of the library modules that
	weren't already indented that way. Use predmode syntax where possible.
	In some modules, shorten long lines by deleting module name prefixes.
	Fix departures from our coding standards.

	In some modules, simplify code, mostly using field names and/or state
	variables.

	There are no changes in algorithms, except for neg_list in integer.m.
2005-10-17 11:35:22 +00:00
Zoltan Somogyi
88c7539230 Import only one module per line, as we already do in the compiler
Estimated hours taken: 0.3
Branches: main

library/*.m:
	Import only one module per line, as we already do in the compiler
	directory.
2005-06-16 04:08:07 +00:00
Julien Fischer
1532b7b0c1 Add a module with versions of the multi_map predicates
Estimated hours taken: 0.5
Branches: main, release

library/svmulti_map.m:
	Add a module with versions of the multi_map predicates
	that are conducive to the use of state variables.

library/multi_map.m:
	Fix up some minor problems with the documentation.

library/library.m:
NEWS:
	Mention the above addition.
2005-02-24 14:11:14 +00:00
Ralph Becket
d0bd460b8f Minor reformatting; added some renamed preds and funcs to improve
Estimated hours taken: 3
Branches: main, version-0_12-branch

library/array.m:
library/array2d.m:
library/assoc_list.m:
library/bag.m:
library/benchmarking.m:
library/bimap.m:
library/bintree_set.m:
library/bitmap.m:
library/bool.m:
library/builtin.m:
library/cord.m:
library/float.m:
library/graph.m:
library/group.m:
library/hash_table.m:
library/int.m:
library/lexer.m:
library/list.m:
library/map.m:
library/math.m:
library/multi_map.m:
library/ops.m:
library/parser.m:
library/rbtree.m:
library/set.m:
library/stack.m:
library/store.m:
library/string.m:
library/time.m:
	Minor reformatting; added some renamed preds and funcs to improve
	consistency of naming in the library; removed some preds and types that
	have been marked obsolete since 0.11.
2005-02-02 04:28:50 +00:00
Julien Fischer
d7022448f6 Fix some documentation in the multi_map module.
Estimated hours taken: 0.2
Branches: main

Fix some documentation in the multi_map module.

library/multi_map.m:
	Fix the documentation for multi_map.merge which was incomplete.

	s/implemention/implementation.
2005-01-27 03:45:24 +00:00
Julien Fischer
b13a50c7f6 Make the positioning of descriptive comments conform
Estimated hours taken: 3.5
Branches: main

Make the positioning of descriptive comments conform
to the coding standard for the following library modules.

Convert preds to predmode syntax where possible.

Make the ordering of related predicates and functions
conform to the coding standard, where the descriptive
comment makes it possible to do that.

Other minor changes are listed below.

library/bimap.m:
	Fix capitalisation of a few comments.

library/dir.m:
	s/throw an exception/throws an exception/.

library/exception.m:
	Fix the comment about the exception_result/1 type.
	There is only one type and an inst following the comment.

library/map.m:
	Remove the unique modes for map.set/4, map.delete/3 and
	map.delete_list/3.

library/rbtree.m:
	Remove the unique modes for rbtree.set/4, rbtree.delete/3,
	rbtree.remove/4, rbtree.remove_smallest/4 and rbtree.remove_largest/4.

library/tree234.m:
	Remove left over unique modes for preds.

library/set.m:
	XXX the ordering of procedures in this module is a bit strange.
library/set_bbbtree.m:
library/set_unordlist.m:
	Remove various unique modes for set operations like
	delete/3.  (Some of these were commented out anyway).

library/term_to_xml.m:
	Fix a spot where line width exceeded 79 characters.

library/array.m:
library/assoc_list.m:
library/random.m:
library/multi_map.m:
library/pqueue.m:
library/queue.m:
library/bool.m:
library/char.m:
library/construct.m:
library/counter.m:
library/deconstruct.m:
library/eqvclass.m:
library/gc.m:
library/io.m:
library/sparse_bitset.m:
library/stack.m:
library/std_util.m:
library/store.m:
library/string.m:
library/term.m:
library/term_io.m:
library/type_desc.m:
library/varset.m:
	As above.
2005-01-24 23:16:40 +00:00
Zoltan Somogyi
34011f5e75 Reduce the size of compiler-generated C source files even further.
Estimated hours taken: 8
Branches: main

Reduce the size of compiler-generated C source files even further. The
reduction is 3 to 6% in non-debug LLDS grades, but 25 to 35% in debug grades.
Together with my previous change, the size of parse_tree.modules.c has gone
from more than 25 Mb to less than 8 Mb.

The changes to the header files will be committed first, followed some days
later by the changes to the compiler to generate the new macros. This gives
time for people to "cvs update" their workspaces at their own pace before
a change in the installed compiler forces them to do so.

compiler/llds_out.m:
	Group the declarations of common_data structures, so that a single
	mention of the type name can be amortized over the declaration of many
	structures.

	Do not emit macro invocations needed only by time profiling unless
	we are doing time profiling.

	When emitting rvals, look for special cases in which we can emit
	shorter code: references to common_data structures and to
	type_ctor_info structures. Both occur a lot in the data structures
	the compiler generates in debugging grades.

	Record which type names have been declared, so we don't declare them
	twice.

	Convert some affected predicates to state variable syntax.

compiler/layout_out.m:
	When possible, emit a shorthand macro that declares a label as it
	defines its label layout structure.

compiler/rtti_out.m:
	Group the declarations of rtti data structures, so that a single
	mention of the type name can be amortized over the declaration of many
	structures.

compiler/llds.m:
	Put common_data structures into a separate type, to allow them to be
	manipulated independently.

	Add a helper predicate.

compiler/global_data.m:
	Conform to the changed types in llds.m.

compiler/name_mangle.m:
	Add some helper predicates for use in llds_out.m and rtti_out.m.

	Reorder some predicate definitions for consistency with their
	declarations.

compiler/rtti.m:
	Add a helper predicate.

compiler/trace.m:
	Instead of generating long canned code fragments, generate calls to
	macros that expand to those canned code fragments.

library/multi_map.m:
	Add function forms of the predicates in this module, for use in the
	modified compiler modules.

runtime/mercury_misc.h:
runtime/mercury_stack_layout.h:
runtime/mercury_trace_base.h:
runtime/mercury_type_info.h:
	Define the macros that the compiler now generates.

runtime/mercury_goto.h:
	Define macros used to implement the macros in the above four header
	files.

runtime/mercury_bootstrap.h:
	Move the definitions of bool, TRUE and FALSE to the section where they
	are defined only if the user asks for them. This is to avoid conflict
	with the module name "bool".

tests/hard_coded/pragma_import.m:
	Rename bool to MR_bool.
2004-04-05 05:08:52 +00:00
Zoltan Somogyi
6909674f14 Bring these modules up to date with our current style guidelines.
Estimated hours taken: 8
Branches: main

library/*.m:
	Bring these modules up to date with our current style guidelines.
	Use predmode declarations where appropriate. Use state variable syntax
	where appropriate. Reorder arguments where this makes it possible to
	to use state variable syntax. Standardize format of predicate
	description comments. Standardize indentation.
2004-03-15 23:49:36 +00:00
Simon Taylor
a399037d05 Add predicates multi_map.to_flat_assoc_list
Estimated hours taken: 0.25
Branches: main

NEWS:
library/multi_map.m:
	Add predicates multi_map.to_flat_assoc_list
	and multi_map.from_flat_assoc_list, which use
	assoc_lists containing one element per key-value
	pair, not one element per key and all its values.
2003-12-01 01:18:05 +00:00
Zoltan Somogyi
6554ef7daa Replace "is" with "=".
Estimated hours taken: 2
Branches: main

Replace "is" with "=".
Add field names where relevant.
Replace integers with counters where relevant.
2003-05-26 09:01:46 +00:00
Mark Brown
88940110b7 Fix multi_map__from_corresponding_lists so that it works as
Estimated hours taken: 0.25
Branches: main, release

library/multi_map.m:
	Fix multi_map__from_corresponding_lists so that it works as
	expected if a key appears more than once in the key list.

tests/hard_coded/Mmakefile:
tests/hard_coded/multi_map_test.exp:
tests/hard_coded/multi_map_test.m:
	Test case.
2002-08-20 00:44:20 +00:00
Zoltan Somogyi
2e611da98e Make {multi_,}map__is_empty more efficient.
Estimated hours taken: 0.5

Make {multi_,}map__is_empty more efficient.

library/tree234.m:
	Add a tree234__is_empty predicate.

library/map.m:
library/multi_map.m:
	Call tree234__is_empty instead of tree234__init, since this does not
	require a complicated unification.
2000-03-28 03:41:11 +00:00
Fergus Henderson
7cb525fde3 Undo Zoltan's bogus update of all the copyright dates.
Estimated hours taken: 0.5

library/*.m:
compiler/*.m:
	Undo Zoltan's bogus update of all the copyright dates.
	The dates in the copyright header should reflect the years
	in which the file was modified (and no, changes to the
	copyright header itself don't count as modifications).
1998-01-23 12:33:43 +00:00
Zoltan Somogyi
9ae7acc593 Update all the copyright dates for 1998.
Estimated hours taken: 0.5

library/*.m:
	Update all the copyright dates for 1998.
1998-01-13 10:01:32 +00:00
Fergus Henderson
04b720630b Update the copyright messages so that (a) they contain the correct years
and (b) they say "Copyright (C) ... _The_ University of Melbourne".
1997-07-27 15:09:59 +00:00
Fergus Henderson
bd4f0a839b Wrap long lines, to avoid formatting problems in the
Estimated hours taken: 1

library/*.m:
	Wrap long lines, to avoid formatting problems in the
	automatically-generated library reference manual.
1997-07-25 03:44:47 +00:00
Fergus Henderson
8bc7cca677 Fix missing `import_module' declarations detected by stayls's
Estimated hours taken: 0.25

library/multi_map.m:
library/prolog.m:
	Fix missing `import_module' declarations detected by stayls's
	changes to implement `use_module'.
1997-06-30 17:23:32 +00:00
Tyson Dowd
cbcb23d17b Enable --warn-interface-imports by default.
Estimated hours taken: 3

Enable --warn-interface-imports by default. This was turned off while
list and term were defined in mercury_builtin.m, since it caused many
warnings.

Fix all the unused interface imports that have been added since then.

compiler/options.m:
	Enable --warn-interface-imports by default.

compiler/module_qual.m:
	Fix formatting inconsistencies with module names in warning
	messages. (".m" was not appended to module names if there was
	only one module).

compiler/*.m:
library/*.m:
tests/invalid/type_loop.m:
tests/warnings/*.m:
	Remove usused interface imports, or move them into
	implementation (mostly bool, list and std_util).
1997-05-21 02:16:53 +00:00
Dylan Shuttleworth
37aa01f8b1 A new library file based on map.m, where the data-type is a list of things.
Estimated hours taken: _3___

A new library file based on map.m, where the data-type is a list of things.
This gives a vague one-to-many storage class.  It's based on map for
flexability, and doesn't achieve much more than map and list together, but
it is nice.  It is also completely untested.  I'm adding it now, because I
disappear for 12 months in 4 days time.

library/multi_map.m
	added this file.
1995-12-29 03:54:53 +00:00