From fe7b6daecd7b7a11873b599913036cc51f49f136 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Sun, 18 May 2025 20:30:59 +0100 Subject: [PATCH 1/4] Add new to_list function from OCaml 5.1.0 --- BitMaskSet.ml | 3 +++ BitMaskSet.mli | 12 ++++++++++++ CHANGES.txt | 4 ++++ bitmasks.opam | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/BitMaskSet.ml b/BitMaskSet.ml index b371a9a..6c03539 100644 --- a/BitMaskSet.ml +++ b/BitMaskSet.ml @@ -44,6 +44,7 @@ module type S = val find_first_opt : (elt -> bool) -> t -> elt option val find_last : (elt -> bool) -> t -> elt val find_last_opt : (elt -> bool) -> t -> elt option + val to_list : t -> elt list val of_list : elt list -> t val to_seq_from : elt -> t -> elt Seq.t val to_seq : t -> elt Seq.t @@ -518,6 +519,8 @@ module Make(Mask : BitMask) : sig in f [] topbit highest shiftsInv + let to_list = elements + let min_elt set = let set = Mask.logand set Mask.mask in diff --git a/BitMaskSet.mli b/BitMaskSet.mli index 529b362..e94f509 100644 --- a/BitMaskSet.mli +++ b/BitMaskSet.mli @@ -75,6 +75,11 @@ module type S = val find_last : (elt -> bool) -> t -> elt val find_last_opt : (elt -> bool) -> t -> elt option + (* ****************************************************************************************** * + * Added in 5.1.0. * + * ****************************************************************************************** *) + val to_list : t -> elt list + (* ****************************************************************************************** * * Added in 4.02.0. * * ****************************************************************************************** *) @@ -422,6 +427,13 @@ module Make (Mask : BitMask) : @since 1.1.0 *) + val to_list : t -> Mask.t list + (** + [to_list s] is {!elements}[ s]. + + @since 1.5.0 + *) + val of_list : Mask.t list -> t (** [of_list l] creates a bitmask from a list of elements. For bitmasks, this is just a diff --git a/CHANGES.txt b/CHANGES.txt index 278e5bc..31ec573 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +????-??-?? David Allsopp + Version 1.5.1 +* Add new to_list function introduced in OCaml 5.1.0 + 2021-08-03 David Allsopp Version 1.4.0 * Add new to_rev_seq function introduced in OCaml 4.12.0 diff --git a/bitmasks.opam b/bitmasks.opam index 4979374..06a61e9 100644 --- a/bitmasks.opam +++ b/bitmasks.opam @@ -1,5 +1,5 @@ opam-version: "2.0" -version: "1.4.1" +version: "1.5.0" maintainer: "david.allsopp@metastack.com" authors: [ "David Allsopp" ] license: "BSD-3-clause with OCaml linking exception" From 2b910a27e3b55b2be5a057cc31eb25bc9ea361c3 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Sun, 18 May 2025 20:34:27 +0100 Subject: [PATCH 2/4] Expand GHA matrix to 5.3.0 --- .github/workflows/testing.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9b4910b..f346cb3 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -20,16 +20,22 @@ jobs: - 4.09.1 - 4.10.2 - 4.11.2 - - 4.12.0 + - 4.12.1 + - 4.13.1 + - 4.14.2 + - 5.0.0 + - 5.1.1 + - 5.2.1 + - 5.3.0 include: - os: windows-latest ocaml-version: 4.02.3 - os: windows-latest - ocaml-version: 4.12.0 + ocaml-version: 5.3.0 - os: macos-latest ocaml-version: 4.02.3 - os: macos-latest - ocaml-version: 4.12.0 + ocaml-version: 5.3.0 runs-on: ${{ matrix.os }} From ea2bd94f941647633a542b13bd59c68026d5c940 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Sun, 18 May 2025 21:46:28 +0100 Subject: [PATCH 3/4] Update workflow --- .github/workflows/testing.yml | 66 ++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f346cb3..6d86f60 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -4,51 +4,59 @@ on: [push, pull_request] jobs: build: + name: build (${{ matrix.os }}, ${{ matrix.ocaml.version || matrix.ocaml }}) strategy: fail-fast: false matrix: - os: - - ubuntu-latest - ocaml-version: - - 4.02.3 - - 4.03.0 - - 4.04.2 - - 4.05.0 - - 4.06.1 - - 4.07.1 - - 4.08.1 - - 4.09.1 - - 4.10.2 - - 4.11.2 - - 4.12.1 - - 4.13.1 - - 4.14.2 - - 5.0.0 - - 5.1.1 - - 5.2.1 - - 5.3.0 + os: ['ubuntu-latest'] + ocaml: [{version: '4.02', + repo: 'archive: git+https://github.com/ocaml/opam-repository-archive.git'}, + '4.03', + '4.04', + '4.05', + '4.06', + '4.07', + '4.08', + '4.09', + '4.10', + '4.11', + '4.12', + '4.13', + '4.14', + '5.0', + '5.1', + '5.2', + '5.3'] include: - os: windows-latest - ocaml-version: 4.02.3 + ocaml: '4.13' - os: windows-latest - ocaml-version: 5.3.0 + ocaml: '5.3' + - os: macos-13 + ocaml: {version: '4.02', + pin: 'camlp-streams git+https://github.com/dra27/camlp-streams.git#old', + repo: 'archive: git+https://github.com/ocaml/opam-repository-archive.git'} - os: macos-latest - ocaml-version: 4.02.3 - - os: macos-latest - ocaml-version: 5.3.0 + ocaml: '5.3' runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Set-up OCaml ${{ matrix.ocaml-version }} - uses: avsm/setup-ocaml@v1 + - name: Set-up OCaml ${{ matrix.build.ocaml }} + uses: ocaml/setup-ocaml@v3 with: - ocaml-version: ${{ matrix.ocaml-version }} + ocaml-compiler: ${{ matrix.ocaml.version || matrix.ocaml }} + opam-repositories: |- + default: git+https://github.com/ocaml/opam-repository.git + ${{ matrix.ocaml.repo }} - run: opam pin add bitmasks.dev . --no-action + - name: ${{ matrix.ocaml.pin && format('opam pin add {0}', matrix.ocaml.pin) || 'opam pin hhotfixes' }} + if: matrix.ocaml.pin + run: opam pin add --no-action ${{ matrix.ocaml.pin }} - run: opam install . --deps-only --with-doc --with-test - run: opam exec -- dune build @install @runtest - run: opam exec -- make doc From 1db54d214f381eb6326c856932fd334e68888172 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Sun, 18 May 2025 21:59:33 +0100 Subject: [PATCH 4/4] Sync SPDX licence --- bitmasks.opam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitmasks.opam b/bitmasks.opam index 06a61e9..07ca0f1 100644 --- a/bitmasks.opam +++ b/bitmasks.opam @@ -2,7 +2,7 @@ opam-version: "2.0" version: "1.5.0" maintainer: "david.allsopp@metastack.com" authors: [ "David Allsopp" ] -license: "BSD-3-clause with OCaml linking exception" +license: "BSD-3-clause" homepage: "https://metastack.github.io/bitmasks" dev-repo: "git+https://github.com/metastack/bitmasks.git" bug-reports: "https://github.com/metastack/bitmasks/issues"