Commit Graph

40 Commits

Author SHA1 Message Date
Julien Fischer
a77da7b5ff More standard library fixes.
library/set_tree234.m:
    Delete a duplicate type_spec pragma.

library/set_bbbtree.m:
library/set_ctree234.m:
library/set_ordlist.m:
library/set_tree234.m:
library/stack.m:
library/store.m:
    Documentation and formatting fixes.
2026-02-20 14:42:38 +11:00
Julien Fischer
0b92543c5e Fix more library documentation errors.
library/*.m:
   As above.
2026-01-23 19:53:58 +11:00
Zoltan Somogyi
ca7385d2c7 Generate better diagnostics for parentheses mismatches.
When you have an unclosed (, [ or { in a clause, the diagnostic
you got did not tell you

- where the unclosed parenthesis was,
- which kind of parenthesis it was.

Fix this by including both pieces of information in the diagnostic.

Likewise, print more useful info for mixed-up parentheses,
such as [(]).

library/mercury_term_parser.m:
    When consuming a (, [ or { token, push it and its context on a stack.
    When consuming a ), ] or } token, pop off the top item from this stack,
    and generate a diagnostic if the close token does not match it.
    The one exception from this pushing and pulling is for code that
    handles the case where the open is followed immediately by
    the matching close, such as when parsing [] or {}.

    Print the contents of the stack also when getting to either
    the end of the term, or the end of the input, with a nonempty stack.

    Maintaining this stack has a small performance cost, but I expect
    it to be negligible, especially compared to the usefulness
    of the new detail in diagnostics,

    Completely rework the error handling parts of this module.
    The main changes are the following.

    First, the old code used to include *part* of the intended message
    in the pr_error structures it created, with a "Syntax error: "
    prefix being added later. Since this makes it hard to ensure
    that the error messages follow the rules of English, change this
    to generate each error message all at once.

    Second, the old code included the list of the remaining tokens
    in each pr_error structure. This was overkill, because the only part
    of this list that was used was the id and the context of the
    first token in the list. Apart from being inelegant, the main flaw
    of this approach was that in the case of premature end-of-file
    errors, the only token list available was token_nil, which
    of course contains neither a token nor its context. The old code
    compensated for it later by using the context of the *first* token
    of the whole term being parsed, which is ... less than useful.
    (The missing token is trivially replaced by "end-of-file".)

    The new code replaces the token list with the context, if it
    is available; if it is not, then later we compute the context
    of the last token in the whole token list. The new code
    does not return the token itself; instead, it includes
    its string version in the generated error message where appropriate.

    Third, as mentioned above, we now include info about unbalanced
    (), [] and {} pairs in diagnostics, as extra sentences.
    (These extra sentences are preceded by \n characters;
    see the change to parse_module.m below.)

    Fifth, to make the above possible without adding unnecesary
    complications, the diagnostic texts this module generates
    now always include the period at the ends of sentences:
    they are not added by the compiler.

    Fourth, we now consistently use "Syntax error at token abc:
    expected def, fgh, or xyz" phraseology.

library/mercury_term_lexer.m:
    Stop requiring the customers of this module to handle

    - integer_dot tokens, which are needed only by, and are
      an implementation detail of, the get_* family of predicates, and

    - eof tokens, which the lexer also never returns, converting each one
      into the end of its token list instead.

    The fact that the lexer never returned integer_dot tokens was
    documented, but the fact that it never returned eof tokens was not.

    The reason for this change was simply that I did not want to write
    two pieces of code to handle the out-of-input case in each affected
    spot in the parser: once for an eof token, and once for token_nil.

library/stack.m:
    Add a utility function needed by new code in mercury_term_parser.m.

compiler/parse_module.m:
    Stop adding a period at the ends of error messages generated by
    mercury_term_parser.m; mercury_term_parser.m now adds those itself.
    Do post-process those messages by turning any \n characters in them
    into nl format_pieces.

NEWS.md:
    Announce the change in mercury_term_lexer.m, and the
    new function in stack.m.

library/io.text_read.m:
    Unrelated bug fix, for which I discovered the need while
    working on the other library files: add a missing foreign import.

tests/invalid_nodepend/unbalanced.{m,err_exp}:
    A new test case to check the updated diagnostics.

tests/invalid_nodepend/Mmakefile:
    Enable the new test case.

tests/hard_coded/parse_number_from_string.exp:
tests/invalid_nodepend/impl_def_literal_syntax.err_exp:
tests/invalid_nodepend/invalid_binary_literal.err_exp:
tests/invalid_nodepend/invalid_float_literal.err_exp:
tests/invalid_nodepend/invalid_hex_literal.err_exp:
tests/invalid_nodepend/invalid_octal_literal.err_exp:
tests/invalid_nodepend/null_char.err_exp:
tests/invalid_nodepend/typeclass_test_1.err_exp:
tests/invalid_nodepend/unicode_1.err_exp:
tests/invalid_nodepend/unicode_2.err_exp:
tests/invalid_purity/purity_nonsense_2.err_exp:
    Expect the updated diagnostics.
2025-07-30 01:37:28 +02:00
Zoltan Somogyi
34e64a623b Replace "iff" with "if-and-only-if" in the library. 2025-06-08 10:33:56 +10: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
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
Julien Fischer
94535ec121 Fix spelling and formatting throughout the system.
configure.ac:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
ssdb/*.m:
runtime/mercury_conf.h.in:
runtime/*.[ch]:
scripts/Mmake.vars.in:
trace/*.[ch]:
util/*.c:
	Fix spelling and doubled-up words.

	Delete trailing whitespace.

	Convert tabs into spaces (where appropriate).
2015-12-02 18:46:14 +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
3a74d3fd88 Change the argument order of some predicates in the stack and pqueue modules in
Branches: main

Change the argument order of some predicates in the stack and pqueue modules in
order to make them more conducive to the use of state variable notation.

library/pqueue.m:
library/stack.m:
	Change the argument ordering as above.

	Rename some variables in stack.m.

library/svpqueue.m:
library/svstack.m:
	Make the predicates exported by these modules as obsolete.

NEWS:
	Announce the above changes.

compiler/code_info.m:
compiler/delay_info.m:
compiler/ml_gen_info.m:
compiler/mode_constraint_robdd.m:
compiler/mode_ordering.m:
	Conform to the above changes.
2012-01-24 05:23:07 +00:00
Julien Fischer
436e5a2616 Remove deprecated modules and (most) deprecated procedures from the standard
Branches: main

Remove deprecated modules and (most) deprecated procedures from the standard
library.  (The remaining deprecated procedures probably need to stick around
for at least another release in order to give people time to adapt their code.)

library/dir.m:
library/list.m:
library/stack.m:
library/string.m:
library/type_desc.m:
	Delete obsolete procedures.

library/svarray.m:
library/svbag.m:
library/svbimap.m:
library/sveqvclass.m:
library/svmap.m:
library/svmulti_map.m:
library/svqueue.m:
library/svset.m:
library/svvarset.m:
	Delete these modules, they are no longer required since the
	original predicates now have their arguments in the state-variable
	friendly order.

library/library.m:
	Delete the above modules.

compiler/frameopt.m:
compiler/par_loop_control.m:
compiler/rbmm.region_transformation.m:
browser/browser_test.m:
extras/windows_installer_generator/wix_gui.m:
samples/ultra_sub.m:
tests/hard_coded/rnd.m:
tests/hard_coded/type_spec_ho_term.m:
tests/hard_coded/xmlable_test.m:
	Conform to the above changes.
2012-01-03 11:04:49 +00:00
Julien Fischer
0e48dfc031 Mark procedures whose names use the suffix "_det" to indicate that the procedure
Branches: main

Mark procedures whose names use the suffix "_det" to indicate that the procedure
is a det version of a semidet procedure of the same name (modulo the suffix) as
obsolete.  The versions that use "det_" as a prefix should be used instead.
(The latter naming scheme is the one in general use throughout the standard
library.)

library/dir.m:
library/list.m:
library/stack.m:
	As above.

	Add versions with the "det_" suffix where they were not already
	present.

	Group function definitions together with the corresponding
	predicate definition.

library/cord.m:
library/erlang_rtti_implementation.m:
library/io.m:
library/string.m:
compiler/*.m:
browser/declarative_execution.m:
browser/declarative_tree.m:
ssdb/ssdb.m:
	Conform to the above changes.

library/Mercury.options:
	Delete a setting for a deleted module.

NEWS:
	Announce this change.
2011-05-10 04:12:28 +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
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
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
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
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
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
Zoltan Somogyi
dd42a6e9a5 Fix grammar and formatting error.
Estimated hours taken: 0.1

library/stack.m:
	Fix grammar and formatting error.
1999-06-06 05:08:27 +00:00
Zoltan Somogyi
d956412023 Fix some formatting.
Estimated hours taken: 0.5

library/portray.nl:
	Fix some formatting.

library/stack.m:
	Add a deterministic version of stack_top.
1998-06-25 04:21:01 +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
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
Fergus Henderson
fa5226ee67 Improve the documentation.
library/*.m:
	Improve the documentation.
	Add a "Stability: low/medium/high" comment to all modules,
	which describes the stability of the interface to that module.

ops.m:
	Add `:' as an infix operator.

require.m:
	Implement require/1, since higher-order predicates now work.

term.m:
	Use the type `comparison_result' from mercury_builtin.m,
	rather than defining an identical type `comparison'.
1995-10-05 11:31:52 +00:00
Andrew Bromage
4841071c9e Added stack__push_list and set__join. Cleaned up a couple of typos
in the documentation.
1995-06-12 04:11:17 +00:00
Zoltan Somogyi
549ca23f61 added a list__chunk primitive.
list:
	added a list__chunk primitive.

std_util:
	added bool__or_list, bool__and_list, and bool__not.

others:
	suppressed determinism warnings by changing declarations from nondet to
	multidet and with judicious use of semidet_fail and semidet_succeed.
1995-04-25 08:37:37 +00:00
Fergus Henderson
93a755d563 Add copyright notices.
library/*:
	Add copyright notices.
1995-03-28 16:19:34 +00:00
Fergus Henderson
d8c9479872 Override the MERCURY_LIB_OBJS variable when invoking ml.
Makefile.mercury:
	Override the MERCURY_LIB_OBJS variable when invoking ml.
	This avoids some bootstrapping problems.
	Also, add mercury_compile.nu.

Makefile.common:
	Bump NU-Prolog's -u option up to 2000 (8M), to avoid some memory
	problems.

array.nl, bintree.nl, char.nl, dir.nl, globals.nl, list.nl, map.nl, modes.nl,
prog_util.nl, stack.nl, std_util.nl, string.nl, term.nl:
	Avoid the use of implied modes.

code_info.nl, bimap.nl, make_hlds.nl, mercury_compile.nl,
mercury_to_mercury.nl, unify_proc.nl:
	Fix determinism errors which had previously not been discovered
	because of either implied modes or running out of memory.
	(Note that I had to change the interface to bimap__lookup, since
	it's not possible to make it bidirectional.)

code_util.nl, llds.nl, opt_debug.nl, value_number.nl:
	Rename `operator' as `binary_op'.

hlds.nl, code_info.nl, unify_gen.nl, llds.nl, opt_debug.nl, switch_gen.nl:
	*** Handle simple cases of higher-order pred terms. ***
	(We don't yet handle taking the address of an overloaded
	predicate or a predicate with multiple modes.
	We don't handle closures.  call/1 and call/N are not yet implemented.
	This has not yet been tested.)

make_hlds.nl:
	Modify the mode priority ordering so that semidet modes get
	selected before det ones.

llds.nl:
	Don't include the priority part of the mode number in the mangled
	label name.  *** Note: this will break some things! ***

mercury_compile.nl:
	Move the NU-Prolog hacks into mercury_compile.nu.nl.

switch_gen.nl:
	Fix a simple logic bug in handling the grab/slap of the code_info.

prog_io.nl, builtins.nl, int.nl:
	Fix bugs and omissions with handling of the new arithmetic operators.

prog_io.nl:
	As a quick hack, strip off calls to io__gc_call
	(this avoids spurious error messages which are due to
	the fact that we don't get mode analysis right in those cases).
1994-10-02 17:00:57 +00:00
Fergus Henderson
3e984e7793 Various bug fixes for non-deterministic code.
code_gen.nl, code_info.nl, disj_gen.nl, ite_gen.nl, switch_gen.nl:
	Various bug fixes for non-deterministic code.
	(nqueens now works! ;-)

live_vars.nl:
	Bug fix: initial liveness should be {input vars} not {output vars}.
	(Apologies from Thomas ;-).

llds.nl:
	Couple of minor bug fixes.  Added code to output redo().

io.nl, portray.nl, prog_io.nl, std_util.nu.nl, term_io.nu.nl:
	Change X.Xs into [X|Xs].

swi_builtin.nl, doit.pl:
	Add some support for SWI-Prolog.

set.nl, stack.nl:
	Suppress bogus SWI-Prolog singleton variables warnings in
	type declarations.

term_io.nu.nl:
	Remove some of the dependences on NU-Prologisms.
1994-08-14 12:14:51 +00:00
Fergus Henderson
e0a02e7adb Remove the unused `declared_determinsm' field in the goal_info.
hlds.nl, hlds_out.nl, det_analysis.nl:
	Remove the unused `declared_determinsm' field in the goal_info.
	Rename the `inferred_determinism' field as just `determism'.
	Add a new field `local_determinism'.  In det_analysis.nl,
	Plug the contents of the new `local_determinsm' field in the goal_info
	into the computation of the determinism for each goal.

det_analysis.nl, fix_errs.sed:
	For the cases which we currently don't handle correctly,
	generate incorrect code in preference to generating spurious
	error messages (we still have to handle these cases sometime,
	but this means that we can deal with them one at a time).

arg_info.nl, builtins.nl, code_gen.nl, delay_info.nl, det_analysis.nl,
getopt.nl, globals.nl, make_hlds.nl, modes.nl, mode_util.nl, stack.nl,
string.nl, string.nu.nl, term.nl, undef_modes.nl, varset.nl:
	Fix determinism errors uncovered by the changes in the determinism
	analysis.
1994-06-27 03:34:09 +00:00
Fergus Henderson
987bef62be Add determinism declarations. Fix a few determinism problems.
*.nl:
	Add determinism declarations.  Fix a few determinism problems.
1994-06-17 00:38:40 +00:00
Fergus Henderson
8bf2aacf0b Rename a whole bunch of predicates.
*.nl:
	Rename a whole bunch of predicates.
	Apart from some manual changes to list.nl, the changes
	were all generated by applying the following sed script:

/[^a-zA-Z_]goedel_expand(/s/goedel_expand(/prog_util__expand(/g
/[^a-zA-Z_]goedel_replace(/s/goedel_replace(/prog_util__replace(/g
/[^a-zA-Z_]to_upper(/s/to_upper(/char__to_upper(/g
/[^a-zA-Z_]to_lower(/s/to_lower(/char__to_lower(/g
/[^a-zA-Z_]is_upper(/s/is_upper(/char__is_upper(/g
/[^a-zA-Z_]is_lower(/s/is_lower(/char__is_lower(/g
/[^a-zA-Z_]is_alpha(/s/is_alpha(/char__is_alpha(/g
/[^a-zA-Z_]is_alnum(/s/is_alnum(/char__is_alnum(/g
/[^a-zA-Z_]is_alpha_or_underscore(/s/is_alpha_or_underscore(/char__is_alpha_or_underscore(/g
/[^a-zA-Z_]is_alnum_or_underscore(/s/is_alnum_or_underscore(/char__is_alnum_or_underscore(/g
/[^a-zA-Z_]is_digit(/s/is_digit(/char__is_digit(/g
/[^a-zA-Z_]lower_upper(/s/lower_upper(/char__lower_upper(/g
/[^a-zA-Z_]io__op(/s/io__op(/term_io__op(/g
/[^a-zA-Z_]io__current_ops(/s/io__current_ops(/term_io__current_ops(/g
/[^a-zA-Z_]io__read_term(/s/io__read_term(/term_io__read_term(/g
/[^a-zA-Z_]io__write_term(/s/io__write_term(/term_io__write_term(/g
/[^a-zA-Z_]io__write_constant(/s/io__write_constant(/term_io__write_constant(/g
/[^a-zA-Z_]io__write_variable(/s/io__write_variable(/term_io__write_variable(/g
/[^a-zA-Z_]mercury_quote_string(/s/mercury_quote_string(/term_io__quote_string(/g
/[^a-zA-Z_]mercury_quote_atom(/s/mercury_quote_atom(/term_io__quote_atom(/g
/[^a-zA-Z_]mercury_quote_char(/s/mercury_quote_char(/term_io__quote_char(/g
/[^a-zA-Z_]mercury_quote_single_char(/s/mercury_quote_single_char(/term_io__quote_single_char(/g
/[^a-zA-Z_]delay_info_/s/delay_info_/delay_info__/g
/[^a-zA-Z_]process_options(/s/process_options(/getopt__process_options(/g
/[^a-zA-Z_]lookup_option(/s/lookup_option(/globals__lookup_option(/g
/[^a-zA-Z_]append(/s/append(/list__append(/g
/[^a-zA-Z_]member(/s/member(/list__member(/g
/[^a-zA-Z_]merge(/s/merge(/list__merge(/g
/[^a-zA-Z_]member_chk(/s/member_chk(/list__member_chk(/g
/[^a-zA-Z_]length(/s/length(/list__length(/g
/[^a-zA-Z_]condense(/s/condense(/list__condense(/g
/[^a-zA-Z_]same_length(/s/same_length(/list__same_length(/g
/[^a-zA-Z_]split_list(/s/split_list(/list__split_list(/g
/[^a-zA-Z_]reverse(/s/reverse(/list__reverse(/g
/[^a-zA-Z_]delete(/s/delete(/list__delete(/g
/[^a-zA-Z_]delete_first(/s/delete_first(/list__delete_first(/g
/[^a-zA-Z_]sort(/s/sort(/list__sort(/g
/[^a-zA-Z_]nth_member_search(/s/nth_member_search(/list__nth_member_search(/g
/[^a-zA-Z_]nth_member_lookup(/s/nth_member_lookup(/list__nth_member_lookup(/g
/^goedel_expand(/s/goedel_expand(/prog_util__expand(/g
/^goedel_replace(/s/goedel_replace(/prog_util__replace(/g
/^to_upper(/s/to_upper(/char__to_upper(/g
/^to_lower(/s/to_lower(/char__to_lower(/g
/^is_upper(/s/is_upper(/char__is_upper(/g
/^is_lower(/s/is_lower(/char__is_lower(/g
/^is_alpha(/s/is_alpha(/char__is_alpha(/g
/^is_alnum(/s/is_alnum(/char__is_alnum(/g
/^is_alpha_or_underscore(/s/is_alpha_or_underscore(/char__is_alpha_or_underscore(/g
/^is_alnum_or_underscore(/s/is_alnum_or_underscore(/char__is_alnum_or_underscore(/g
/^is_digit(/s/is_digit(/char__is_digit(/g
/^lower_upper(/s/lower_upper(/char__lower_upper(/g
/^io__op(/s/io__op(/term_io__op(/g
/^io__current_ops(/s/io__current_ops(/term_io__current_ops(/g
/^io__read_term(/s/io__read_term(/term_io__read_term(/g
/^io__write_term(/s/io__write_term(/term_io__write_term(/g
/^io__write_constant(/s/io__write_constant(/term_io__write_constant(/g
/^io__write_variable(/s/io__write_variable(/term_io__write_variable(/g
/^mercury_quote_string(/s/mercury_quote_string(/term_io__quote_string(/g
/^mercury_quote_atom(/s/mercury_quote_atom(/term_io__quote_atom(/g
/^mercury_quote_char(/s/mercury_quote_char(/term_io__quote_char(/g
/^mercury_quote_single_char(/s/mercury_quote_single_char(/term_io__quote_single_char(/g
/^delay_info_/s/delay_info_/delay_info__/g
/^process_options(/s/process_options(/getopt__process_options(/g
/^lookup_option(/s/lookup_option(/globals__lookup_option(/g
/^append(/s/append(/list__append(/g
/^member(/s/member(/list__member(/g
/^merge(/s/merge(/list__merge(/g
/^member_chk(/s/member_chk(/list__member_chk(/g
/^length(/s/length(/list__length(/g
/^condense(/s/condense(/list__condense(/g
/^same_length(/s/same_length(/list__same_length(/g
/^split_list(/s/split_list(/list__split_list(/g
/^reverse(/s/reverse(/list__reverse(/g
/^delete(/s/delete(/list__delete(/g
/^delete_first(/s/delete_first(/list__delete_first(/g
/^sort(/s/sort(/list__sort(/g
/^nth_member_search(/s/nth_member_search(/list__nth_member_search(/g
/^nth_member_lookup(/s/nth_member_lookup(/list__nth_member_lookup(/g
/[^a-zA-Z_]delete_all(/s/delete_all(/list__delete_all(/g
/^delete_all(/s/delete_all(/list__delete_all(/g
1994-06-02 16:03:34 +00:00
Fergus Henderson
251413586a Added a couple of ADTs for the library.
stack.nl, queue.nl:
	Added a couple of ADTs for the library.
1994-04-25 17:56:04 +00:00