Commit Graph

260 Commits

Author SHA1 Message Date
Julien Fischer
778e75f696 Fix problems in the library.
library/array.m:
library/builtin.m:
library/construct.m:
    Fix copy-and-paste errors.

library/arrayd2d.m:
    Use the mode array2d_di instead of array_di in a spot.

    Delete an extra space from an exception message.

library/bimap.m:
    Fix formatting.

library/bit_buffer.m:
    Fix inverted argument types.

library/dir.m:
    Say that make_single_directory/4 returns an error rather
    than saying that it fails.

library/io.m:
    Fix errors in obsolete pragmas.

library/assoc_list.m:
library/bag.m:
library/cord.m:
library/deconstruct.m:
library/enum.m:
library/fat_sparse_bitset.m:
library/getopt*.m:
library/int*.m:
library/io*.m:
library/type_desc.m:
    Fix documentation errors.

tests/hard_coded/array2d_from_array.exp:
    Conform to the changed exception message in array2d.m.
2026-02-19 15:24:59 +11:00
Zoltan Somogyi
62d9fcbe4b Ignore (mostly) comments inside foreign_procs.
compiler/foreign.m:
    When returning the list of identifiers inside a foreign_proc's code,
    ignore the contents of comments. This means that warnings about
    variable names that occur in the foreign_proc's argument list
    but do not occur in the foreign_proc's code cannot be shut up anymore
    by mention the variable name in comments.

    The "mostly" part is that typecheck.m still looks at the bodies
    of foreign_procs without knowing about comments. Fixing that
    will be part a future change.

NEWS.md:
    Announce this breaking change.

compiler/fact_table_gen.m:
    When we try to generate a foreign_proc's body for a fact table
    but cannot do so due to the fact table file not being readable,
    add a marker to the predicate that the fact table is for.

compiler/hlds_markers.m:
    Update the documentation of the existing predicate marker
    we use for this.

compiler/make_hlds_warn.m:
    Do not warn about singleton variables in foreign_proc bodies
    that are empty due to missing fact table files.

library/array.m:
library/io.file.m:
library/profiling_builtin.m:
library/stm_builtin.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
tests/invalid/erroneous_throw_promise.m:
tests/invalid/foreign_procs_exist_type.m:
tests/invalid/foreign_purity_mismatch.m:
tests/invalid/gh72_errors.m:
tests/invalid_purity/purity.m:
tests/valid/solv.m:
    Shut up warnings about singletons in foreign_procs by adding a _ prefix
    to the names of the relevant arguments, and delete the comments
    that can no longer do that job.

tests/invalid/foreign_purity_mismatch.err_exp:
tests/invalid/gh72_errors.err_exp:
tests/invalid/gh72_errors.err_exp2:
tests/invalid/gh72_errors.err_exp3:
tests/invalid_purity/purity.err_exp:
    Expect updated line numbers.

tests/warnings/warn_return.{m,err_exp}:
    Extend this test case to test that

    - we DO warn about return statements outside comments, but
    - we DO NOT warn about return statements inside comments.
2026-01-28 13:34:30 +11:00
Julien Fischer
b85f11b41d Fix library documentation errors.
library/*.m:
    As above.

library/getopt.m:
    Regenerate this file.
2026-01-22 21:22:38 +11:00
Zoltan Somogyi
94fadf1797 Add uint versions of array operations.
library/array.m:
    Add uint versions of most of this module's operations.

NEWS.md:
    Mention the new operations.

library/edit_distance.m:
    Use the new array operations to eliminate some casts.

library/edit_seq.m:
    Minor style fix.

tests/hard_coded/array_gen.{m,exp}:
tests/hard_coded/array_test_2.{m,exp}:
    Extend the tests of array.m's operations to the corresponding uint
    versions. Expect the output for the new versions.

tests/hard_coded/array_resize.m:
tests/hard_coded/array_shrink.m:
    Extend the tests of array.m's operations to the corresponding uint
    versions, but generate output only if their results differ from the
    original int versions. (They don't differ.)

tests/hard_coded/array_primitives.m:
    Style fixes.
2026-01-08 03:47:09 +11:00
Zoltan Somogyi
5cd669f432 Apply the new builtin in_range in one more place.
library/array2d.m:
    Use the new builtin for bounds checks.

library/array.m:
    Document why using the new builtin for bounds checks
    would probably not lead to a speedup.
2025-10-02 21:41:28 +10:00
Zoltan Somogyi
3f72528869 Update module stability levels. 2025-08-11 22:32:52 +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
89b05266a1 Provide alternatives to can-fail library functions.
library/array.m:
library/assoc_list.m:
library/bimap.m:
library/bitmap.m:
library/construct.m:
library/deconstruct.m:
library/dir.m:
library/hash_table.m:
library/injection.m:
library/io.stream_db.m:
library/kv_list.m:
library/list.m:
library/map.m:
library/robdd.m:
library/stream.string_writer.m:
library/term_conversion.m:
library/term_to_xml.m:
library/tree234.m:
library/type_desc.m:
library/version_hash_table.m:
    For nearly every ordinary function in this directory that can fail in its
    primary mode (all of which were semidet functions),

    - provide a semidet predicate as an alternative, if it did not
      already exist,

    - implement the function in terms of the predicate, instead of vice versa,

    - mark the semidet function as obsolete in favor of the semidet predicate
      version,

    - fix all the resulting warnings, and then

    - comment out the obsolete pragmas (at least for now).

    Note that this diff does not touch the semidet function in the
    enum typeclass, or the functions that implement that method
    in instances.

NEWS.md:
    Announce the new predicates in the (documented) modules of the library.

browser/term_rep.m:
compiler/lp_rational.m:
compiler/mcsolver.m:
compiler/mode_ordering.m:
compiler/mode_robdd.equiv_vars.m:
compiler/mode_robdd.implications.m:
compiler/old_type_constraints.m:
compiler/pickle.m:
compiler/prog_event.m:
compiler/type_ctor_info.m:
compiler/var_table.m:
tests/hard_coded/bitmap_empty.m:
tests/hard_coded/construct_mangle.m:
tests/hard_coded/construct_packed.m:
tests/hard_coded/construct_test.m:
tests/hard_coded/dummy_type_construct.m:
tests/hard_coded/expand.m:
tests/hard_coded/foreign_enum_rtti.m:
tests/hard_coded/subtype_rtti.m:
tests/hard_coded/term_to_univ_test.m:
tests/hard_coded/type_to_term.m:
tests/hard_coded/type_to_term_bug.m:
    Stop calling the semidet functions from the library that were temporarily
    marked obsolete.

    In a few places, add explicit type qualification to avoid warnings
    about unresolved polymorphism.

tests/hard_coded/test_injection.exp:
    Expect an abort message from the predicate version of a semidet function.

tests/declarative_debugger/ho_2.exp2:
    Update this .exp file for a previous commit.
2024-08-09 09:14:46 +02:00
Julien Fischer
db37031c3f Update copyright notices in standard library.
library/*.m:
     As above.
2024-08-08 00:04:42 +10:00
Peter Wang
362290595f Stop using higher order function insts as modes in the library.
library/array.m:
library/benchmarking.m:
library/bitmap.m:
library/hash_table.m:
library/list.m:
library/one_or_more.m:
library/set_bbbtree.m:
library/set_ctree234.m:
library/test_bitset.m:
library/thread.future.m:
library/version_hash_table.m:
    As above.
2023-07-27 13:55:54 +10:00
Zoltan Somogyi
219a387602 Stop using higher order insts as modes ...
... in a first batch of library modules.
2023-07-26 16:22:04 +02:00
Zoltan Somogyi
5cbcfaa0ed Move X_to_doc functions to pretty_printer.m.
library/array.m:
library/char.m:
library/float.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/list.m:
library/one_or_more.m:
library/string.m:
library/tree234.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
library/version_array.m:
    Mark the X_to_doc function in each of these modules as obsolete,
    and make it a forwarding function to the actual implementation
    in pretty_printer.m. The intention is that when these forwarding
    functions are eventually removed, this will also remove the dependency
    of these modules on pretty_printer.m. This should help at least some
    of these modules escape the giant SCC in the library's dependency graph.
    (It does not make sense that a library module that adds code to increment
    an int thereby becomes dependent on pretty_printer.m through int.m.)

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

    Fix the one_or_more_to_doc function, which was

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

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

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

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

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

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

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

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

NEWS:
    Announce all the user-visible changes above.
2022-12-27 18:27:52 +11:00
Zoltan Somogyi
3459266a7a Carve stdlib module ra_list.m out of bt_array.m.
library/ra_list.m:
    As above.

    Rename ra_list_lookup to ra_list_search, since it fails if the item
    to be accessed does not exist. Add a version, ra_list_lookup, which
    aborts in that case.

    Add predicates to append two ra_lists, and to convert ra_lists
    to just plain lists.

    Change the argument order of some predicates to be more
    state variable friendly.

    Add some documentation.

library/bt_array.m:
    Delete the moved code, and update the references to the changed predicates.

library/Mercury.options:
    Now that the ra_list predicates have been moved to their own module,
    stop giving bt_array.m a free pass on inconsistent predicate order.

library/MODULES_DOC:
library/library.m:
    Add ra_list.m as a documented module of the Mercury standard library.

library/array.m:
    Delete a predicate that served as a test for an ancient bug fix.

NEWS:
    Announce both the new ra_list module, and the deletion of the predicate
    from array.m.

tests/hard_coded/array_sort.m:
    Don't call the predicate deleted from array.m.

tests/hard_coded/ra_list_test.{m,exp}:
    A new test case to test operations on ra_lists.

tests/hard_coded/Mmakefile:
    Enable the new test case.
2022-06-11 11:11:30 +10:00
Zoltan Somogyi
e9d9726014 Organize array.m, bt_array.m and pprint.m.
library/array.m:
library/bt_array.m:
library/pprint.m:
    In each of these modules,

    - put related predicates next to each other,
    - put the groups of related predicates into a meaningful order, and
    - improve the documentation of some predicates, and
    - improve some variable names in the implementation, including giving
      explicit names to some function results.

library/Mercury.options:
    Enable the warning about inconsistent predicate order for two of those
    modules, but not bt_array.m, pending a decision about making its
    informal "submodule" an actual separate module.
2022-06-08 19:59:15 +10:00
Julien Fischer
e7d28ff90f Update copyright notices in stdlib.
library/*.m:
    As above.
2022-06-07 21:51:03 +10:00
Julien Fischer
bc79412af2 Delete the old random number generator.
It has been deprecated since Mercury 20.01.

library/random.m:
    Delete the old generator.

library/array.m:
    Delete the predicate random_permutation/4.

NEWS:
    Announce the above.

tests/hard_coded/string_hash.m:
    Update this test to use the new RNG framework.

tests/hard_coded/Mmakefile:
tests/hard_coded/random_permutation.{m,exp}:
tests/hard_coded/random_simple.{m,exp}:
    Delete these tests, they were specific to the old RNG.

extras/curs/samples/nibbles.m:
extras/solver_types/library/any_array.m:
    Replace use of the old RNG.
2022-03-15 16:08:48 +11: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
7c12474f98 Add array.generate_foldl2.
library/array.m:
    As above.

    Turn an aux function into a predicate to allow the use of state vars.

    Use more meaningful variable names.

NEWS:
    Announce the new predicate.
2021-08-20 15:34:13 +10:00
Julien Fischer
d44f4d5953 Add missing can_pass_as_mercury_type attribute.
library/array.m:
     Set the can_pass_as_mercury_type attribute on the C foreign_type
     for array/1.
2021-06-26 19:42:44 +10:00
Zoltan Somogyi
0d7c8a7654 Specify pred or func for all pragmas.
*/*.m:
    As above.

configure.ac:
    Require the installed compiler to support this capability.
2021-06-16 15:23:58 +10:00
Peter Wang
0d3fcbaae3 Delete Erlang code from library/mdbcomp/browser directories.
library/*.m:
    Delete Erlang foreign code and foreign types.

    Delete documentation specific to Erlang targets.

library/deconstruct.m:
    Add pragma no_determinism_warning to allow functor_number_cc/3
    to compile for now.

library/Mercury.options:
    Delete workaround only needed when targetting Erlang.

browser/listing.m:
mdbcomp/rtti_access.m:
    Delete Erlang foreign code and foreign types.
2020-10-28 14:10:56 +11: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
Zoltan Somogyi
a6228a9e1a Fix too-long lines. 2020-04-10 03:22:40 +10:00
Julien Fischer
86a767095f Fix a bug in the C# implementation of array.shrink/3.
library/array.m:
   Workaround the fact that C#'s 'is' operator has some fairly surprising
   behaviour with arrays of integer types.

tests/hard_coded/array_primitives.{m,exp}:
tests/hard_coded/array_shrinks.{m,exp}:
   Improve the coverage of these tests.
2019-09-05 17:06:24 +10:00
Julien Fischer
65f683e6f2 Fix arrays with fixed size integer elements for C#.
library/array.m
    Handle all integer types in the methods for creating and resizing arrays in
    the C# grades.
2019-08-29 22:08:26 +10:00
Zoltan Somogyi
a3786d4402 Expand two comments. 2019-08-16 13:07:46 +10:00
Julien Fischer
e876db7873 Adjust bounds checking behaviour of array.fetch_items/4.
Change array.fetch_items/4 to return an empty list for an empty range in the
case where the endpoints of that range are not within the array bounds.

library/array.m:
   As above.

deep_profiler/autopar_types.m:
   Undo Zoltan's recent workaround for the above behaviour.

tests/hard_coded/array_fetch_items.{m,ex}:
   Add tests for this behaviour.
2019-08-16 12:40:36 +10:00
Zoltan Somogyi
95f8f56716 Delete unneeded $module args from calls to expect/unexpected. 2019-07-03 22:37:19 +02:00
Julien Fischer
3a7254bca2 Improve the documentation for array.fetch_items.
Change the behaviour of the above predicate in the following ways:
- throw an index_out_of_bounds/0 exception instead of a software_error/0
  exception if either index is out of bounds.
- perform the out of bounds check before checking if the third argument is
  less than the second.

Add an more comprehensive test of fetch_items/4.

library/array.m:
    Make it clear that the range of indexes passed to fetch_items is
    inclusive.

    Throw an index_out_of_bounds/0 exception instead of a software_error/1
    exception if either of the indexes is out of bounds.

    Perform the array bounds check first, before checking if the third
    argument is less than the second.

    Document what happens if the upper index is less than the lower one.

    Fix a typo in the documentation of fill_range/4.

    Update the definition of to_list/2 to conform with the above change
    to the array bounds checks.

NEWS:
    Announce the above change to the semantics of fetch_items/0.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_fetch_items.{m,exp}:
    Add a more comprehensive
2018-12-24 06:15:23 +00:00
Julien Fischer
8d89c9ff37 Add array.swap/4 and array.unsafe_swap/4.
Report out-of-bounds errors more precisely for array.fill_range/5.

library/array.m:
    As above.

NEWS:
    Announce the addition.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_swap.{m,exp}:
    Add a test for array.swap/4.

tests/hard_coded/array_fill.exp:
    Conform to the second change above.
2018-11-12 06:40:46 +00:00
Julien Fischer
b049a5c3db Fix a problem with array.resize.
array.resize/4 has inconsistent behaviour across backends if its first argument
is negative; make it throw an exception if the first argument is negative.

library/array.m:
    As above.

NEWS:
    Announce the change.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_resize.{m,exp}:
    Add a more extensive test case for array.resize.
2018-11-12 03:52:32 +00:00
Julien Fischer
71a78fa98c Fix problems with array.shrink/3.
The behaviour of array.shrink/3 was not defined if its first argument was
negative.  If this occurred, the C backends would return an empty array, while
the non-C backends would abort.  This diff changes the behaviour of shrink/3 so
that it throws an exception if its first argument is negative.

The implementation of shrink/3 for the Java backend did not handle the case
where the array's element type was represented by the one the following Java
primitive types: byte, short, long and float.  Handle those cases.

library/array.m:
   Make the above fixes.

   Fix a typo in my previous commit.

NEWS:
   Note the change in behaviour if the first argument of shrink/3 is
   negative.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_shrink.{m,exp}:
   Add a test case.
2018-11-11 04:24:55 +00:00
Julien Fischer
4eda536190 Document exception conditions for array.init/3 and array.generate/2.
library/array.m:
    Document that the above will throw an exception if their first
    argument is < 0.
2018-11-09 12:21:51 +11:00
Julien Fischer
2b47521daa Fix an abort in the Java implementation of array.copy/2.
library/array.m:
     Handle all Java primitive types in the implementation of
     array.copy/2.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_copy.{m,exp}:
     Add a test case.
2018-11-09 11:55:45 +11:00
Julien Fischer
ee5f7f621d Add array.fill/3, array.fill_range/5 and array2d.fill/3.
library/array.m:
library/array2d.m:
    Add the new predicates.

    Add a note a likely problem with another predicate.

NEWS:
    Announce them.

tests/hard_coded/Mmakfile:
tests/hard_coded/array_fill.{m,exp}:
    Add a test case.
2018-11-08 10:15:03 +00:00
Zoltan Somogyi
c7f8ebbe2f Avoid warnings from --warn-non-contiguous-{clauses,foreign-procs}.
browser/collect_lib.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
compiler/make.util.m:
compiler/pickle.m:
compiler/process_util.m:
compiler/prog_event.m:
library/array.m:
library/benchmarking.m:
library/bit_buffer.m:
library/builtin.m:
library/char.m:
library/deconstruct.m:
library/dir.m:
library/erlang_rtti_implementation.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/io.m:
library/math.m:
library/mutvar.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.format.m:
library/string.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
ssdb/ssdb.m:
    As above. This mostly involved two things.

    The first was grouping foreign_procs by predicate instead of by language.
    In a few cases, this revealed that some predicates *had* no foreign_proc
    for a language, while related predicates did have one that just aborted
    if called. This diff adds similar aborting foreign_procs to predicate/
    language combinations that were missing them, when this seemed obviously
    the right thing to do.

    The second was moving pragmas about a predicate from the middle of the
    block of clauses of that predicate to the start of that block.
2018-10-19 11:01:33 +11:00
Julien Fischer
d51e2a5bbb Fix the modes of array.map.
library/array.m:
    The current modes for array.map do not match what the implementation
    actually does: specifically, map does not destructively update its
    input array argument.

    Call unsafe_init/3 in a few spots where it is safe to do so.

tests/hard_coded/ho_array_ops.{m,exp}:
    Extend this test to cover array.map.
2018-08-16 16:17:13 +10:00
Julien Fischer
c32c99b269 Minor improvement to equality and comparison for arrays.
library/array.m:
    Use unsafe lookups in the implementation of equality and
    comparison.  In these cases the lookups are safe since
    the necessary bounds checks are done by the caller.

    Avoid unnecessary module qualification.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_unify_compare.{m,exp}:
    Add a systematic test for array equality and comparison.
2018-08-15 09:46:49 +10:00
Julien Fischer
a3efc705a9 Change semantics of array.map_corresponding_foldl/6.
library/array.m:
    Make array.map_corresponding_foldl/6 throw an exception if the input
    arrays differ in size.   This brings its behaviour into line with that of
    the other "corresponding" predicates.  It also avoids the unsafe behaviour
    that can currently result when the second input array has fewer elements
    than the first.

    Add some additional modes to array.map_corresponding_foldl/6.

    Replace calls to error/1 with calls to unexpected/2 throughout this
    module.

NEWS:
    Announce the above change.

tests/hard_coded/ho_array_ops.{m,exp}:
    Extend this test to cover map_corresponding_foldl/6.
2018-08-14 11:08:49 +10:00
Julien Fischer
0dc0834973 Add foldl_corresponding/5 and foldl2_corresponding/7 for arrays.
library/array.m:
    Add the above predicates.

NEWS:
    Announce the additions.

tests/hard_coded/Mmakefile:
tests/hard_coded/ho_array_ops.{m,exp}:
    Add tests of the new predicates.
2018-08-14 11:08:49 +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
Julien Fischer
f54fe5f846 Update references to the IL backend.
browser/Mmakefile:
compiler/options.m:
library/array.m:
    As above.
2018-06-15 07:48:56 -04: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
41e2470633 Deprecate array least_index/greatest_index functions and add replacements.
library/array.m:
    Add det_least_index, semidet_least_index, det_greatest_index,
    semidet_greatest_index functions.

    Deprecate least_index, greatest_index with the intention of making
    them semidet eventually.

NEWS:
    Announce changes.
2018-04-08 13:57:52 +10:00
Peter Wang
6df99209b9 Improve documentation for array bounds predicates.
library/array.m:
library/bt_array.m:
    Do not assume that the lower bound is zero in the documentation for
    array.max.

    Make explicit the argument order of bounds/3 predicates
    and document behaviour on empty arrays.
2017-12-03 09:57:28 +11:00
Peter Wang
d7d1471881 Clarify behaviour of upper bounds functions for array types.
library/array.m:
library/bt_array.m:
library/version_array.m:
    As above.
2017-12-01 17:36:20 +11:00
Peter Wang
148891de0d Delete unused foreign exported procedures.
library/array.m:
library/bool.m:
library/exception.m:
library/type_desc.m:
    As above.
2016-10-06 11:45:30 +11:00
Julien Fischer
a369cef8af Allow foreign types to be Java primitive types.
Currently we only allow non-primitive Java types to used with foreign_type
pragmas.  This means that for foreign types that map on to Java primitive types
we have to use their boxed form (e.g. java.lang.Long, java.lang.Float etc) in
the foreign_type pragma.  Doing so results in unnecessary boxing and is a
source of errors (e.g. accidently comparing for reference equality instead of
value equality).

This change causes the MLDS->Java code generator to recognise primitive
foreign_types and generate code that works for them directly.   (In effect
their handling is not really different to how the builtin types are handled.)

doc/reference.texi:
     Change the language so Java foreign types are allowed to be a
     primitive Java types.

compiler/mlds_to_java.m:
     Recognise foreign types that are defined as primitive types in Java and
     generate code that avoids the need for (some) boxing of them.

library/array.m:
     Handle arrays of Java bytes, shorts, longs and floats specially.
     (boolean, char, int and double were already handled thus.)

NEWS:
     Announce the above.

tests/hard_coded/Mmakefile:
tests/hard_coded/test_java_foreign_primitive.{m,exp}:
     Test that foreign types work with primitive types in Java.
2016-04-13 16:37:29 +10:00
Julien Fischer
5054ccbe31 Fix spelling.
deep_profiler/dump.m:
deep_profiler/recursion_patterns.m:
library/array.m:
library/type_desc.m:
    As above.
2016-01-23 14:03:37 +11:00
Julien Fischer
3dd02876a5 Delete the MLDS->IL backend.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
    Delete the modules making up the MLDS->IL code generator.

compiler/globals.m:
compiler/prog_data.m:
    Delete IL as a target and foreign language.

compiler/prog_io_pragma.m:
    Delete the max_stack_size/1 foreign proc attribute.  This was only
    ever required by the IL backend.

compiler/options.m
    Delete options used for the IL backend.

compiler/write_deps_file.m:
    Don't generate mmake targets for .il files etc.

compiler/*.m:
    Conform to the above changes.

compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
    Conform to the above changes.

library/*.m:
    Delete IL foreign_proc and foreign_export pragmas.

README.DotNet:
    Delete this file.

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
    Conform the above changes.

configure.ac:
    Don't check that IL is a supported foreign language when performing the
    up-to-date check.

    Delete the '--enable-dotnet-grades' option.

scripts/Mmake.vars.in:
    Delete variables used for the IL backend (and in on case by the Aditi
    backend).

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
    Delete stuff related to the 'il' and 'ilc' grades.

doc/reference_manual.texi:
     Delete the documentation of the 'max_stack_size' option.

doc/user_guide.texi:
     Delete stuff related to the IL backend.

tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
	Delete these tests: they are no longer relevant.

tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
    Delete IL foreign_procs where necessary.

tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
    Conform to the above changes.
2015-09-21 11:34:46 +10:00