Commit Graph

59 Commits

Author SHA1 Message Date
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
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
58ea6ffff2 Delete old obsolete predicates and functions.
library/*.m:
    Specifically, delete any predicates and functions whose `pragma obsolete'
    dates from 2018 or before. Keep the ones that were obsoleted
    only this year or last year.

NEWS:
    Announce the changes.

tests/debugger/io_tab_goto.m:
tests/debugger/tabled_read.m:
tests/declarative_debugger/io_stream_test.m:
tests/declarative_debugger/tabled_read_decl.m:
tests/declarative_debugger/tabled_read_decl_goto.m:
tests/general/array_test.m:
tests/hard_coded/mutable_init_impure.m:
tests/hard_coded/remove_file.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
    Replace references to predicates and functions that this diff deletes
    with their suggested replacements.

    In several test cases, bring the programming style up to date.

tests/hard_coded/shift_test.{m,exp}:
    Most of this test case tested the now-deleted legacy shift operations.
    Replace these with tests of their non-legacy versions, including
    testing for the expected exceptions.

tests/hard_coded/shift_test.{m,exp}:
    Don't pass --no-warn-obsolete when compiling shift_test.m anymore.
2020-08-18 11:57:47 +10:00
Julien Fischer
f89054f165 Use error($pred, "...") in more spots in the standard library.
Also, throw software_error/1 exceptions rather than directly throwing strings
in a few spots.

Undo special Ralph-style formatting.

library/*.:
    As above.

tests/hard_coded/array2d_from_array.exp:
tests/hard_coded/array2d.exp:
tests/hard_coded/test_injection.exp:
   Update to conform with the above change.
2019-10-15 17:48:36 +11:00
Zoltan Somogyi
95f8f56716 Delete unneeded $module args from calls to expect/unexpected. 2019-07-03 22:37:19 +02:00
Zoltan Somogyi
a12692a0de Replace /* */ comments with // in the library.
Keep the old style comments where they do not go to the end of the line,
or where it is important that the comment line not have a // on it.
2018-06-21 18:55:08 +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
aaea852184 Creation of singleton bags.
library/bag.m:
    Add a function for creating singleton bags.

compiler/term_traversal.m:
    Use the new function in couple of spots.

NEWS:
    Announce the above addition.
2017-05-07 03:23:30 +10:00
Julien Fischer
5896264b9b Efficient insertion of duplicate items into bags.
library/bag.m:
    Add predicates and a function for efficiently inserting multiple copies of
    an item into a bag.

NEWS:
    Announce the above additions.

tests/hard_coded/bag_various.{m,exp}:
    Extend this test to cover the above.
2017-05-07 02:39:53 +10:00
Julien Fischer
87eb8fde68 Avoid module qualifying clause heads.
library/bag.m:
    As above.
2017-05-06 22:47:14 +10:00
Zoltan Somogyi
618e34a9ba Address Julien's review comments on bag.m.
library/bag.m:
    Obsolete to_set_without_duplicates.

    Remove the list skeleton insts.

library/list.m:
    Add an empty list inst.

NEWS:
    Announce the changes in bag.m.
2015-09-17 21:38:39 +10:00
Zoltan Somogyi
9a7a7d4e9c Reserve the type names known to Mercury.
We have traditionally allowed type definitions like this

:- type int(A, B, C)
    --->    f1(A)
    ;       f2(B)
    ;       f3(C).

even though "int" is a type name that is built into Mercury, just with
a different arity.

This diff reserves those type names, generating errors for any attempts
to define them in user code.

compiler/prog_io_util.m:
    We used to parse types by trying to match the input term against
    one pattern after another. If one pattern didn't match, for any reason,
    we went on to the next, the final being to assume that the term's top
    functor is the name of a user defined type. This happened even if
    the top functor was the name of a builtin type or a word (such as "pred"
    that constructed types), but it either had the wrong number of arguments,
    or one of the arguments itself had a problem. This lead to a confusing
    error message being generated.

    We now effectively look at the top functor of the term, and if it is
    the name of a builtin inst or mode construct, then we parse it as that
    construct requires, and never fall back to interpreting it as a user
    defined inst. (To get even better diagnostics, we will need to convert
    some utility predicates from indicating the failure of parsing by
    failing to indicating it by returning a list of error_specs.)

compiler/prog_io_type_defn.m:
    Enforce the prohibition against defining builtin type names,
    even with different module qualifiers and/or arities.

    Changes the predicates that parse the different kinds of type definitions
    to not stop at the first errors they encounter, but to print all
    the errors they can find.

    When a type parameter of a type definition is repeated, include its name
    in the error message.

    Delete some out-of-date comments.

compiler/prog_io_mode_defn.m:
    When an inst parameter of an inst or mode definition is repeated,
    include its name in the error message.

library/bag.m:
    Add a predicate that returns only the repeated items in a bag.

doc/reference_manual.texi:
    Document the list of reserved inst names.

    We could document the list of reserved mode names, but probably
    no-one would want to define those anyway, so the list would probably
    be more confusing than helpful.

tests/invalid/reserved.{m,err_exp}:
    Expect an error message for the attempted redefinition of a builtin type.

    Add a valid type as well, and use that to test the error messages
    for bad inst definitions. This changes the line numbers; expect the new
    line numbers.

tests/invalid/bigtest.err_exp:
tests/invalid/uu_type.err_exp:
    Expect an error message for the attempted redefinition of a builtin type.

tests/invalid/errors.err_exp:
    Expect a more precise error message.
2015-09-04 06:28:10 +10:00
Zoltan Somogyi
90462e8c36 Improve bag.m.
library/bag.m:
    The old implementations of bag.subtract, bag.least_upper_bound,
    bag.union, bag.intersect iterated over their second bag arguments,
    and did a logarithmic amount of work in each iteration. This is good
    if the second bag is small, but not if it is big. Keep those
    implementations as the implementation of bag.subtract_small,
    bag.least_upper_bound_small etc, and replace the implementation
    of bag.subtract etc with code that iterates over the assoc_list version
    of both bags. This does work that linear in total size of the two sets.

    Replace the implementation of bag.subset_compare with one
    that actually works.

    Replace the implementation of bag.is_subbag with one that
    does significantly less work.

    Group related predicates together.

    Improve the documentation of the exported predicates.

    Use a more descriptive and more consistent set of variable names.

tests/hard_coded/test_bag.{m,exp}:
    A new test case, to test the new algorithms in bag.m.

tests/hard_coded/Mmakefile:
    Enable the new test case.
2015-09-02 05:57:46 +10:00
Zoltan Somogyi
b6b9e4063a Convert (C->T;E) to (if C then T else E). 2015-08-22 22:03:57 +10: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
04eede5b11 Add additional fold predicates for bags and assoc_lists.
library/assoc_list.m:
	Add foldl2_values/6.

library/bag.m:
	Add foldl/4 and foldl2/6.

NEWS:
	Announce the above additions.
2013-11-22 16:59:39 +11:00
Zoltan Somogyi
d00ea69529 Switch from using set(prog_var), which is represented using set_ordlist,
Estimated hours taken: 12
Branches: main

Switch from using set(prog_var), which is represented using set_ordlist,
to set_of_progvar, which is represented using tree_bitset, for most sets
of variables in the compiler, including the nonlocals sets in goal_infos.

This diff yields about a 5% speedup when compiling the training_cars_full.m
stress test, but also about a 1% slowdown on tools/speedtest. Both of these
are with the current default state in which tree_bitset is compiled with
a whole bunch of sanity checks. If these are disabled, we get roughly a 1%
speedup on tools/speedtest. I intend to disable those sanity checks after
a shakedown period of a week or two in which the updated version of the
compiler is installed on our platforms.

compiler/hlds_goal.m:
	Replace almost all occurrences of set(prog_var) with set_of_progvar.
	The main exceptions are the types supporting rbmm.

compiler/set_of_var.m:
	Add some more predicates and functions that previous existed on sets
	but not yet on set_of_vars.

compiler/*.m:
	Conform to the change in hlds_goal.m, and make similar changes
	in set representations.

library/bag.m:
	Add a predicate and function for creating a bag from a sorted list.
	We already had them for creating a bag from a set, but a set_of_progvar
	shouldn't have to be converted to a set.

library/robdd.m:
	Fix deviations from our programming style.
2011-08-16 03:26:40 +00:00
Julien Fischer
6a8844236b Protect a reference to GC_stackbottom with #ifdef MR_BOEHM_GC.
Branches: main

util/mkinit.c:
	Protect a reference to GC_stackbottom with #ifdef MR_BOEHM_GC.

library/bag.m:
	Fix some inconsistent indentation.
2011-06-08 04:19:58 +00:00
Julien Fischer
309879db90 Change the argument ordering of predicates in the bag module in
Branches: main

Change the argument ordering of predicates in the bag module in
order to make them more conducive to the use of state variable notation.

library/bag.m:
	Make the above changes.

	Shift function definitions so that they placed with
	the corresponding predicate definitions rather than
	all being grouped at the end of the module.

library/svbag.m:
library/svqueue.m:
compiler/add_pragma.m:
compiler/term_pass2.m:
compiler/term_traversal.m:
compiler/term_util.m:
tests/hard_coded/construct_bug_submodule.m:
	Conform to the above change and remove dependencies on the
	svbag module.

NEWS:
	Announce the change.
2011-05-03 14:22:15 +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
Peter Wang
948541b739 Fix a problem in MLDS grades using --det-copy-out (java, il) where dummy
Branches: main

Fix a problem in MLDS grades using --det-copy-out (java, il) where dummy
arguments in predicates would prevent tail calls being marked as such.

Also make a few predicates tail recursive.

compiler/ml_code_gen.m:
        With the --det-copy-out option, don't list dummy output variables as
        copy out variables.  This led to `return' statements containing dummy
        output variables, but a call prior to a `return' statement wouldn't
        have dummy outputs, so ml_tailcall.m wouldn't recognise the call as a
        tail call.

compiler/mlds_to_java.m:
        Delete a hack that drops dummy variables in return statements.

compiler/mercury_compile.m:
        Make backend_pass_by_preds_2 tail recursive.  Otherwise a compiler
        built in the java grade runs out of stack space compiling some
        larger modules.

library/bag.m:
        Make tail recursion more obvious in a few predicates.
2009-06-15 06:52:43 +00:00
Julien Fischer
f87f4e03ab Wrap the definitions of the standard library's stack/1 and bag/1 types in
Estimated hours taken: 0.5
Branches: main

Wrap the definitions of the standard library's stack/1 and bag/1 types in
notag wrappers.  This prevents problems with overlapping instances when they
are used in type class instance definitions and in the case of bag/1 makes it
usable in such definitions (the current definitions does not conform to
what is allowed in instance heads under the current system.)

This change does mean that the source code for these modules is a little
more verbose, but this is outweighed by the fact that the behaviour with
instances is much less surprising than it was.

library/bag.m:
library/stack.m:
	Define these types using notag wrappers rather than equivalence types.
2008-06-02 04:55:00 +00:00
Peter Wang
7e908b95da Type specialise some bag procedures for variables. This results in a 1.1%
Estimated hours taken: 0.5
Branches: main

Type specialise some bag procedures for variables.  This results in a 1.1%
speedup on neptune.

library/bag.m:
library/svbag.m:
	As above.
2008-02-29 06:54:07 +00:00
Zoltan Somogyi
042e0c13bd Fix some whitespace.
Estimated hours taken: 0.1
Branches: main

library/bag.m:
	Fix some whitespace.
2007-11-26 02:09:10 +00:00
Ondrej Bojar
63a60f056f Add functions bag.count/1, bag.count_unique/1 and predicates bag.member/2
Estimated hours taken: 1
Branch: main

Add functions bag.count/1, bag.count_unique/1 and predicates bag.member/2
and bag.member/3 to the bag module.

NEWS:
    Announce the new predicates and functions.
    Minor indentation unification.

library/bag.m:
    New functions and predicates.

tests/hard_coded/bag_various.m:
tests/hard_coded/bag_various.exp:
    A simple testcase for the new predicates, with expected results.

tests/hard_coded/Mmakefile:
    Enabled the test.
2007-03-12 02:19:31 +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
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
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
5c78901138 Convert to four-space indentation.
Estimated hours taken: 0.5
Branches: main

library/array2d.m:
library/assoc_list.m:
library/bag.m:
library/benchmarking.m:
library/bimap.m:
library/bintree.m:
library/bintree_set.m:
	Convert to four-space indentation.
2005-09-19 05:07:51 +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
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
Zoltan Somogyi
e4da5e1c94 Fix performance problems in the compiler when handling automatically generated
Estimated hours taken: 10
Branches: main

Fix performance problems in the compiler when handling automatically generated
code (specifically, code generated by caribou). These depend on new facilities
in the library.

Fix a problem with the debugger: get the debugger to stop when given an
interrupt signal. (I needed this fix to find the performance problems above.)
The problem was that the variable set by the interrupt handler wasn't the
right one.

library/map.m:
	The map__overlay predicate takes time linear in the new map.
	However, sometimes the compiler wants to overlay a large map on a small
	one. Add a new version, map__overlay_large_map, which does the same job
	but whose complexity is linear in the size of the old map.

library/set.m:
library/set__ordlist.m:
	Add a new version of set__divide specialized to a situation that
	occurs in some performance-critical code in the compiler. This lowers
	the complexity from quadratic to linear.

library/bag.m:
	Add predicates for operating on sets alongside for predicates for
	operating on lists. These should be able to exploit the sortedness
	of the set, although we don't do so yet.

library/svbag.m:
	Add this new module to make some of the changes to the compiler easier.

library/library.m:
NEWS:
	Mention the new module.

compiler/instmap.m:
	Use either map__overlay or map__overlay_large_map, depending on which
	one is likely to be more efficient.

compiler/deforest.m:
compiler/goal_util.m:
compiler/mode_util.m:
compiler/simplify.m:
compiler/table_gen.m:
	Conform to the changes in instmap.m.

compiler/liveness.m:
	Use the specialized version of set__divide.

compiler/mode_info.m:
	The original representation of liveness information in the mode
	analyzer had a fast insert operation, but a slow delete operation
	and a lookup operation that is *very* slow when analyzing long
	conjunctions. Replace that representation with a more direct
	and more compact representation with slower insert operation
	but much faster lookup operation and significantly faster delete
	operation.

compiler/modes.m:
compiler/unique_modes.m:
	Conform to the changes in mode_info.m.

trace/mercury_trace.c:
	Make the debugger's interrupt handler set the variable actually used
	by MR_trace to select which function to call.

runtime/mercury_trace_base.[ch]:
	Make MR_selected_trace_func_ptr volatile, since it is now set from
	an interrupt handler.

runtime/mercury_wrapper.[ch]:
	Make MR_trace_handler non-volatile, since it is no longer set from
	an interrupt handler. Change its name to MR_exec_trace_handler to
	reflect the fact that it is not the only trace handler.

util/mkinit.c:
	Refer to MR_trace_handler by its new name.
2005-01-10 05:23:56 +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
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
Simon Taylor
dedcf29a30 Make the function versions of predicates appear in the
Estimated hours taken: 2.5

library/*.m
	Make the function versions of predicates appear in the
	Mercury Library Reference Manual.
2000-11-12 08:51:39 +00:00
Fergus Henderson
6a6e5495ed Ralph Becket <rwab1@cam.sri.com>'s changes to add functions for
Estimated hours taken: 6

library/pqueue.m:
library/assoc_list.m:
library/getopt.m:
library/bag.m:
library/bimap.m:
library/bintree.m:
library/bintree_set.m:
library/bt_array.m:
library/eqvclass.m:
library/graph.m:
library/group.m:
library/queue.m:
library/rbtree.m:
library/stack.m:
library/term.m:
library/varset.m:
library/tree234.m:
library/relation.m:
library/set.m:
library/set_bbbtree.m:
library/set_ordlist.m:
library/set_unordlist.m:
	Ralph Becket <rwab1@cam.sri.com>'s changes to add functions for
	the remaining output det predicates in a number of modules in the
	standard library.  Basically, for each

		:- pred f(in, ..., in, out) is det.

	he has added the declaration

		:- func f(in, ..., in) = out.

	and definition

		f(X1, ..., Xn) = Y :-
			f(X1, ..., Xn, Y).

	The changes were made using a mostly automatic process.
1999-10-30 04:16:13 +00:00
Thomas Conway
c4f17bfda5 fix the implementation of bag intersection, which was
Estimated hours taken: 0.5

library/bag.m:
	fix the implementation of bag intersection, which was
	completely bogus.
1999-08-27 04:40:58 +00:00
Fergus Henderson
14728289fa Remove support for NU-Prolog and SICStus Prolog.
Estimated hours taken: 5

Remove support for NU-Prolog and SICStus Prolog.

The reasons for this are:
(a) We now have a proper working debugger, so we don't need to use
    NU-Prolog or SICStus Prolog for debugging.
(b) The Prolog support was only ever a hack, not a proper solution;
    Mercury language features like functions or mode reordering
    were never supported.
(c) It was a maintenance problem.

compiler/make_hlds.m:
	Warn that NU-Prolog `when' declarations are deprecated.

compiler/prog_io.m:
	Update a comment to say that NU-Prolog `when' declarations
	are now deprecated.

library/*.m:
	Delete `when' declarations.

configure.in:
bindist/bindist.configure.in:
	Delete the autoconf tests for NU-Prolog and SICStus Prolog.
	Delete the stuff for generating the NU-Prolog and SICStus Prolog
	scripts.

tools/bootcheck:
	Delete the options for testing using SICStus Prolog.

library/Mmakefile:
	Delete the rules for building NU-Prolog and SICStus Prolog stuff.

library/library.nu.nl.in:
	library/swi_*.m:
	library/*.nu.nl:
library/array.nu.nl:
library/assoc_list.nu.nl:
library/char.nu.nl:
library/float.nu.nl:
library/int.nu.nl:
library/io.nu.nl:
library/library.nu.nl.in:
library/map.nu.nl:
library/mercury_builtin.nu.nl:
library/nc_builtin.nl:
library/require.nu.nl:
library/sp_builtin.nl:
library/sp_lib.nl:
library/std_util.nu.nl:
library/store.nu.nl:
library/string.nu.nl:
library/swi_builtin.m:
library/swi_lib.m:
library/term_io.nu.nl:
	Delete these files.

scripts/mnc.in:
scripts/mnp.in:
scripts/mnl.in:
scripts/msc.in:
scripts/msl.in:
scripts/msp.in:
	Delete these files.

doc/user_guide.texi:
	Delete the documentation about the Prolog support.

NEWS:
w3/news/newsdb.inc:
        Mention that we've removed the Prolog support.
1999-03-15 08:48:36 +00:00
Simon Taylor
b946f163c0 Add a new predicate bag__count_value/3 which returns how
Estimated hours taken: 0.1

library/bag.m:
	Add a new predicate bag__count_value/3 which returns how
	many of a value a bag contains.

NEWS:
	Mention bag__count_value/3.
1998-12-03 04:59:36 +00:00
Andrew Bromage
85522c4196 Add two predicates to bag.m, bag__remove_list/3 and
Estimated hours taken: 0.5

library/bag.m:
	Add two predicates to bag.m, bag__remove_list/3 and
	bag__det_remove_list/3.

	Add an extra line to each pred comment in the interface to
	make them a bit more readable.

NEWS:
	Note the new predicates.
1998-03-10 05:40:21 +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
Zoltan Somogyi
b4813457c9 A rewrite of termination analysis to make it significantly easier to modify,
Estimated hours taken: 60

A rewrite of termination analysis to make it significantly easier to modify,
and to extend its capabilities.

compiler/error_util.m:
	A new file containing code that makes it easier to generate
	nicely formatted error messages.

compiler/termination.m:
	Updates to reflect the changes to the representation of termination
	information.

	Instead of doing pass 1 on all SCCs and then pass 2 on all SCCs,
	we now do both pass 1 and 2 on an SCC before moving on to the next.

	Do not insist that either all procedures in an SCC are
	compiler-generated or all are user-written, since this need not be
	true in the presence of user-defined equality predicates.

	Clarify the structure of the code that handles builtins and compiler
	generated predicates.

	Concentrate all the code for updating module_infos in this module.
	Previously it was scattered in several places in several files.

	Put all the code for writing out termination information at the
	end of the module in a logical order.

compiler/term_traversal.m:
	A new file containing code used by both pass 1 and pass 2 to
	traverse procedure bodies.

compiler/term_pass1.m:
	Use the new traversal module.

	Clarify the fixpoint computation on the set of output supplier
	arguments.

	Remove duplicates from the list of equations given to the solver.
	This avoids a det stack overflow in lp.m when doing termination
	analysis on options.m.

	If an output argument of a predicate makes sense only in the absence
	of errors, then return it only in the absence of errors.

compiler/term_pass2.m:
	Use the new traversal module. Unlike the previous code, this allows us
	to ignore recursive calls with input arguments bigger than the head
	if those calls occur after goals that cannot succeed (since those
	calls will never be reached).

	Implement a better way of doing single argument analysis, which
	(unlike the previous version) works in the presence of mutual recursion
	and other calls between the recursive call and the start of the clause.

	Implement a more precise way of checking for recursions that don't
	cause termination problems. We now allow calls from p to q in which
	the recursive input supplier arguments can grow, provided that on
	any path on which q can call p, directly or indirectly, the recursive
	input supplier arguments shrink by a greater amount.

	If an output argument of a predicate makes sense only in the absence
	of errors, then return it only in the absence of errors.

compiler/term_util.m:
	Updates to reflect the changes to the representation of termination
	information.

	Reorder to put related code together.

	Change the interface of several predicates to better reflect the
	way they are used.

	Add some more utility predicates.

compiler/term_errors.m:
	Small changes to the set of possible errors, and major changes in
	the way the messages are printed out (we now use error_util).

compiler/options.m:
	Change --term-single-arg from being a bool to an int option,
	whose value indicates the maximum size of an SCC in which we try
	single argument analysis. (Large SCCs can cause single-arg analysis
	to require a lot of iterations.)

	Add an (int) option that controls the max number of paths
	that we are willing to analyze (analyzing too many paths can cause
	det stack overflow).

	Add an (int) option that controls the max number of causes of
	nontermination that we print out.

compiler/hlds_pred.m:
	Use two separate slots in the proc_info to hold argument size data
	and termination info, instead of the single slot used until now.
	The two kinds of information are produced and used separately.

	Make the layout of the get and set procedures for proc_infos more
	regular, to facilitate later updates.

	The procedures proc_info_{,set_}variables did the same work as
	proc_info_{,set_}varset. To eliminate potential confusion, I
	removed the first set.

compiler/*.m:
	Change proc_info_{,set_}variables to proc_info_{,set_}varset.

compiler/hlds_out.m:
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
	Change the code to handle the arg size data and the termination
	info separately.

compiler/prog_data.m:
	Change the internal representation of termination_info pragmas to
	hold the arg size data and the termination info separately.

compiler/prog_io_pragma.m:
	Change the external representation of termination_info pragmas to
	group the arg size data together with the output supplier data,
	to which it is logically connected.

compiler/module_qual.m:
compiler/modules.m:
	Change the code to accommodate the change to the internal
	representation of termination_info pragmas.

compiler/notes/compiler_design.html:
	Fix some documentation rot, and clarify some points.

	Document termination analysis.

doc/user_guide.texi:
	Document --term-single-arg and the new options.

	Remove spaces from the ends of lines.

library/bag.m:
	Add a new predicate, bag__least_upper_bound.

	Fix code that would do the wrong thing if executed by Prolog.

	Remove spaces from the ends of lines.

library/list.m:
	Add a new predicate, list__take_upto.

library/set{,_ordlist}.m:
	Add a new predicate, set{,_ordlist}__count.

tests/term/*:
	A bunch of new test cases to test the behaviour of termination
	analysis. They are the small benchmark suite from our paper.

tests/Mmakefile:
	Enable the new test case directory.
1997-12-22 10:01:33 +00:00
Christopher Rodd Speirs
cb19d3e7c1 Added a bag__to_list/2 predicate which produces a sorted
Estimated hours taken: 0.5

library/bag.m:
	Added a bag__to_list/2 predicate which produces a sorted
	list from a bag.  Each value appears in the list as many times
	as it appears in the bag.  Also fixed a mistake in a comment.
1997-10-04 06:16:50 +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
Tyson Dowd
327a5131e2 Remove support for term_to_type and type_to_term implemented as special
Estimated hours taken: 5

Remove support for term_to_type and type_to_term implemented as special
preds.  Remove support for one-cell and one-or-two-cell type_infos (now
shared-one-or-two-cell type_infos). Move definitions that were in
mercury_builtin.m back to where they belong.

This code has been removed because it is no longer used, and was no
longer being maintained but was still quite complex.

compiler/globals.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/options.m:
	Remove one_cell and one_or_two_cell from type_info methods.

compiler/polymorphism.m:
	Remove term_to_type and type_to_term support.
	Remove one_cell and one_or_two_cell from type_info methods.
	Fix documentation to reflect the new situation.

compiler/special_pred.m:
compiler/unify_proc.m:
	Remove term_to_type and type_to_term support.

library/list.m:
	Put the definition of `list' back into list.m

library/mercury_builtin.m:
	Take the definitions of `list', `term', `var', `var__supply',
	etc, out of this module.
	Remove type_to_term, term_to_type, det_term_to_type,
	term__init_var_supply, term__create_var, term__var_to_int
	and term__context_init.
	Remove references to USE_TYPE_TO_TERM and #ifdefs around
	SHARED_ONE_OR_TWO_CELL_TYPE_INFO.

library/std_util.m:
	Remove references ONE_OR_TWO_CELL_TYPE_INFO, and code that
	handles one-cell typeinfo comparisons.

library/term.m:
	Add type_to_term, term_to_type, det_term_to_type,
	term__init_var_supply, term__create_var, term__var_to_int
	and term__context_init back to term.m.
	Add new implementation of type_to_term/2.

library/uniq_array.m:
	Fix a typo in a comment - term_to_type/3 instead of term_to_type/2.

runtime/call.mod:
	Remove special case code for unify, compare, index for
	one-cell typeinfos.
	Remove code for type_to_term/2.

runtime/type_info.h:
	Remove references to ONE_CELL_TYPE_INFO or ONE_OR_TWO_CELL_TYPE_INFO.
	Make sure only SHARED_ONE_OR_TWO_CELL_TYPE_INFO.
	Remove references to USE_TYPE_TO_TERM.

compiler/base_type_layout.m:
compiler/bytecode_gen.m:
compiler/code_util.m:
compiler/delay_slot.m:
compiler/det_util.m:
compiler/fact_table.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/mode_debug.m:
compiler/tree.m:
library/bag.m:
library/queue.m:
	Import module `list' or `term' (or both).
1997-05-20 01:52:55 +00:00