library/bitmap.m:
Replace all uses of field access notation for things that are not
structure fields with getter functions and setter predicates.
Add the getter functions and setter predicates where they did not
exist before. Unlike the old "field :=" functions, the new setter
predicates lend themselves to state variable notation.
Replace nested applications of functions with sequences of calls
(usually a get/modify/set sequence) that is easier to read and
understand, partly because it gives meaningful names to the
intermediate values.
Where an operation was available as both a function and a predicate,
implement the function version in terms of the predicate version,
as is our convention in the rest of the Mercury implementation,
instead of vice versa.
In a few cases, where implementing the function in terms of the predicate
could lead to misleading exceptions (that refer to the name of the
predicate, not the function, even when the user called the function),
have two copies of the implementation that differ only in the
text of the exception(s) being thrown.
NEWS:
Document the added exported functions and predicates.
tests/hard_coded/bitmap_empty.m:
Replace io.write/io.nl sequences with io.write_line, including
one case where the io.nl was missing :-(
Fix misleading indentation.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
library/array.m:
library/array2d.m:
library/bitmap.m:
library/store.m:
library/thread.semaphore.m:
library/version_array2d.m:
library/version_bitmap.m:
library/version_hash_table.m:
library/version_store.m:
Delete predicates that were deprecated in Mercury 13.05 and before.
library/version_array.m
Delete the deprecated function new/2.
Deprecate unsafe_new/2 and unsafe_init/2 to replace it.
(We had overlooked this previously.)
library/string.m:
Delete the deprecated function set_char_char/3.
(We will leave the other deprecated procedures in this module
for at least another release.)
library/svlist.m:
library/svpqueue.m:
library/svstack.m:
Delete these modules: they were only ever needed as a transitional
mechanism.
library/library.m:
Conform to the above changes.
doc/Mmakefile:
Unrelated change: delete references to files that have been
deleted since we moved to git.
tests/hard_coded/*/*.m
tests/tabling/*.m:
Update test cases where they made use of predicates that have
now been deleted from the standard library.
Branches: main
Fix bitmap predicates which did not work correctly with empty bitmaps.
Note that `bitmap.to_string' now returns "<0:>" for an empty bitmap instead
of "<0:00>".
library/bitmap.m:
Add `in_range_rexcl' to check an index is in the range [0, num_bits).
Fix bounds checks on empty bitmaps in `^ bits' and `copy_bytes'.
Simplify other bounds checks using `in_range_rexcl'.
Make `byte_index_for_bit' return -1 if its argument is negative,
instead of 0. `byte_index_for_bit(NumBits - 1)' is used to get the
last byte index, so now loops over empty bitmaps will stop immediately
as the initial index must be greater than -1.
Make some code neater.
tests/hard_coded/Mmakefile:
tests/hard_coded/bitmap_empty.exp:
tests/hard_coded/bitmap_empty.m:
Add a test case.
NEWS:
Mention changed behaviour of `bitmap.to_string'.