From 739dd4412c1af1c170ecdc9b42f427eea89cba2a Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 1 Apr 2021 22:16:40 -0400 Subject: [PATCH] prepare for 3.3 --- CHANGELOG.md | 25 +++++++++++++++++++++++++ README.md | 6 +++++- containers-data.opam | 2 +- containers-thread.opam | 2 +- containers.opam | 2 +- src/core/CCCanonical_sexp.mli | 2 +- src/core/CCChar.mli | 14 +++++++------- src/core/CCFormat.mli | 2 +- src/core/CCHashtbl.ml | 10 +++++----- src/core/CCHashtbl.mli | 20 ++++++++++---------- src/core/CCList.mli | 4 ++-- src/core/CCListLabels.mli | 4 ++-- src/core/CCMap.ml | 12 ++++++------ src/core/CCMap.mli | 12 ++++++------ src/core/CCSeq.mli | 4 ++-- src/core/CCSexp_intf.ml | 6 +++--- src/core/CCString.mli | 2 +- src/core/CCStringLabels.mli | 2 +- 18 files changed, 80 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63842cdfb..a88542fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 3.3 + +- feat: add code-generator for optimal bitfields; add tests +- new Canonical sexpr module with printer and parser + +- CCSeq: Add `for_all` and `exists` +- feat(sexp): expose last location in decoder +- feat(CCChar): add CCChar.Infix +- feat(CCString): add CCString.foldi +- feat(CCFormat): add `string_lines` combinator +- feat(CCList): update with regards to `partition_map` +- add `CCList.cons'` +- implement {of,add}_*_with family of function in `CCMap` with update (#352) +- add `CCMap.of_{list,iter,seq}_with` functions +- add `CCHashtbl.{of,add}_{list,seq,iter}_with` + +- Fix integer overflow warning on jsoo (#346) +- updated fuzzer scripts + +### Containers-thread + +- refactor(pool): less locking, fix deadlock, more parallelism +- feat(pool): keep one idle thread +- small optim in `Pool.sequence_a` + ## 3.2 - add CCEither module diff --git a/README.md b/README.md index a979bea87..e1194303d 100644 --- a/README.md +++ b/README.md @@ -431,7 +431,7 @@ map = - : string option = Some "33" ``` -### New types: `CCVector`, `CCHeap`, `CCResult` +### New types: `CCVector`, `CCHeap`, `CCResult`, `CCSexp` Containers also contains (!) a few datatypes that are not from the standard library but that are useful in a lot of situations: @@ -454,6 +454,10 @@ library but that are useful in a lot of situations: It uses the new `result` type from the standard library (or from the retrocompatibility package on opam) and provides many combinators for dealing with `result`. +- `CCSexp` and `CCCanonical_sexp`: + functorized printer and parser for S-expressions, respectively as + actual S-expressions (like `sexplib`) and as canonical binary-safe + S-expressions (like `csexp`) Now for a few examples: diff --git a/containers-data.opam b/containers-data.opam index 37a7449b1..094d1c44a 100644 --- a/containers-data.opam +++ b/containers-data.opam @@ -1,5 +1,5 @@ opam-version: "2.0" -version: "3.2" +version: "3.3" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "A set of advanced datatypes for containers" diff --git a/containers-thread.opam b/containers-thread.opam index 2da1c855c..d24a2e7ed 100644 --- a/containers-thread.opam +++ b/containers-thread.opam @@ -1,5 +1,5 @@ opam-version: "2.0" -version: "3.2" +version: "3.3" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "An extension of containers for threading" diff --git a/containers.opam b/containers.opam index 39d567eca..a83f5d15b 100644 --- a/containers.opam +++ b/containers.opam @@ -1,6 +1,6 @@ opam-version: "2.0" name: "containers" -version: "3.2" +version: "3.3" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "A modular, clean and powerful extension of the OCaml standard library" diff --git a/src/core/CCCanonical_sexp.mli b/src/core/CCCanonical_sexp.mli index 56ec327c3..d3320c0a2 100644 --- a/src/core/CCCanonical_sexp.mli +++ b/src/core/CCCanonical_sexp.mli @@ -6,7 +6,7 @@ See {{: https://en.wikipedia.org/wiki/Canonical_S-expressions} wikipedia}. These S-expressions are binary safe. - @since NEXT_RELEASE + @since 3.3 *) type 'a or_error = ('a, string) result diff --git a/src/core/CCChar.mli b/src/core/CCChar.mli index f0c626c3f..2103b06f8 100644 --- a/src/core/CCChar.mli +++ b/src/core/CCChar.mli @@ -40,26 +40,26 @@ val pp : Format.formatter -> t -> unit (** {2 Infix Operators} - @since NEXT_RELEASE *) + @since 3.3 *) module Infix : sig val (=) : t -> t -> bool - (** @since NEXT_RELEASE *) + (** @since 3.3 *) val (<>) : t -> t -> bool - (** @since NEXT_RELEASE *) + (** @since 3.3 *) val (<) : t -> t -> bool - (** @since NEXT_RELEASE *) + (** @since 3.3 *) val (>) : t -> t -> bool - (** @since NEXT_RELEASE *) + (** @since 3.3 *) val (<=) : t -> t -> bool - (** @since NEXT_RELEASE *) + (** @since 3.3 *) val (>=) : t -> t -> bool - (** @since NEXT_RELEASE *) + (** @since 3.3 *) end include module type of Infix diff --git a/src/core/CCFormat.mli b/src/core/CCFormat.mli index ec9145a42..85c5b8546 100644 --- a/src/core/CCFormat.mli +++ b/src/core/CCFormat.mli @@ -69,7 +69,7 @@ val string_lines : string printer place of spaces, unlike {!text}. This means an already formatted string can be displayed inside another formatter without mangling the indentation. - @since NEXT_RELEASE *) + @since 3.3 *) val char : char printer (** @since 0.14 *) diff --git a/src/core/CCHashtbl.ml b/src/core/CCHashtbl.ml index a2c470806..ed69ff882 100644 --- a/src/core/CCHashtbl.ml +++ b/src/core/CCHashtbl.ml @@ -236,7 +236,7 @@ module type S = sig (** Add the corresponding pairs to the table, using {!Hashtbl.add}. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val add_seq : 'a t -> (key * 'a) Seq.t -> unit (** Add the corresponding pairs to the table, using {!Hashtbl.add}. @@ -249,7 +249,7 @@ module type S = sig (** Add the corresponding pairs to the table, using {!Hashtbl.add}. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val of_iter : (key * 'a) iter -> 'a t (** From the given bindings, added in order. @@ -261,7 +261,7 @@ module type S = sig (** From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val of_seq : (key * 'a) Seq.t -> 'a t (** From the given bindings, added in order. @@ -274,7 +274,7 @@ module type S = sig (** From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val add_iter_count : int t -> key iter -> unit (** [add_iter_count tbl i] increments the count of each element of [i] @@ -313,7 +313,7 @@ module type S = sig (** [of_list l] builds a table from the given list [l] of bindings [k_i -> v_i]. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit (** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if diff --git a/src/core/CCHashtbl.mli b/src/core/CCHashtbl.mli index 43c79ee28..7a26b7906 100644 --- a/src/core/CCHashtbl.mli +++ b/src/core/CCHashtbl.mli @@ -78,7 +78,7 @@ module Poly : sig (** Add the corresponding pairs to the table, using {!Hashtbl.add}. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val add_seq : ('a,'b) Hashtbl.t -> ('a * 'b) Seq.t -> unit (** Add the corresponding pairs to the table, using {!Hashtbl.add}. @@ -91,7 +91,7 @@ module Poly : sig (** Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val of_iter : ('a * 'b) iter -> ('a,'b) Hashtbl.t (** From the given bindings, added in order. @@ -103,7 +103,7 @@ module Poly : sig (** From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val of_seq : ('a * 'b) Seq.t -> ('a,'b) Hashtbl.t (** From the given bindings, added in order. @@ -116,7 +116,7 @@ module Poly : sig (** From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val add_iter_count : ('a, int) Hashtbl.t -> 'a iter -> unit (** [add_iter_count tbl i] increments the count of each element of [i] @@ -155,7 +155,7 @@ module Poly : sig (** From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val update : ('a, 'b) Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit (** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if @@ -251,7 +251,7 @@ module type S = sig (** Add the corresponding pairs to the table, using {!Hashtbl.add}. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val add_seq : 'a t -> (key * 'a) Seq.t -> unit (** Add the corresponding pairs to the table, using {!Hashtbl.add}. @@ -264,7 +264,7 @@ module type S = sig (** Add the corresponding pairs to the table, using {!Hashtbl.add}. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val of_iter : (key * 'a) iter -> 'a t (** From the given bindings, added in order. @@ -276,7 +276,7 @@ module type S = sig (** From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val of_seq : (key * 'a) Seq.t -> 'a t (** From the given bindings, added in order. @@ -289,7 +289,7 @@ module type S = sig (** From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val add_iter_count : int t -> key iter -> unit (** [add_iter_count tbl i] increments the count of each element of [i] @@ -328,7 +328,7 @@ module type S = sig (** [of_list l] builds a table from the given list [l] of bindings [k_i -> v_i]. If a key occurs multiple times in the input, the values are combined using [f] in an unspecified order. - @since NEXT_RELEASE *) + @since 3.3 *) val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit (** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if diff --git a/src/core/CCList.mli b/src/core/CCList.mli index 17902aa19..0187304a6 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -43,7 +43,7 @@ val cons_maybe : 'a option -> 'a t -> 'a t val cons' : 'a t -> 'a -> 'a t (** [cons' l x] is the same as [x :: l]. This is convenient for fold functions such as {!List.fold_left} or {!Array.fold_left}. - @since NEXT_RELEASE *) + @since 3.3 *) val (@) : 'a t -> 'a t -> 'a t (** [l1 @ l2] is like [append l1 l2]. @@ -236,7 +236,7 @@ val partition_map_either : ('a -> ('b, 'c) CCEither.t) -> (** [partition_map_either f l] maps [f] on [l] and gather results in lists: - if [f x = Left y], adds [y] to the first list. - if [f x = Right z], adds [z] to the second list. - @since NEXT_RELEASE *) + @since 3.3 *) val partition_filter_map : ('a -> [<`Left of 'b | `Right of 'c | `Drop]) -> 'a list -> 'b list * 'c list diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index 0d9891e62..7e6318f41 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -42,7 +42,7 @@ val append : 'a t -> 'a t -> 'a t val cons' : 'a t -> 'a -> 'a t (** [cons' l x] is the same as [x :: l]. This is convenient for fold functions such as {!List.fold_left} or {!Array.fold_left}. - @since NEXT_RELEASE *) + @since 3.3 *) val cons_maybe : 'a option -> 'a t -> 'a t (** [cons_maybe (Some x) l] is [x :: l]. @@ -240,7 +240,7 @@ val partition_map_either : f:('a -> ('b, 'c) CCEither.t) -> (** [partition_map_either ~f l] maps [f] on [l] and gather results in lists: - if [f x = Left y], adds [y] to the first list. - if [f x = Right z], adds [z] to the second list. - @since NEXT_RELEASE *) + @since 3.3 *) val partition_filter_map : f:('a -> [<`Left of 'b | `Right of 'c | `Drop]) -> 'a list -> 'b list * 'c list diff --git a/src/core/CCMap.ml b/src/core/CCMap.ml index 3c66b923d..239ac76ec 100644 --- a/src/core/CCMap.ml +++ b/src/core/CCMap.ml @@ -77,7 +77,7 @@ module type S = sig val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Seq.t -> 'a t (** [add_seq ~f m l] adds the given seq [l] of bindings to the map [m], using [f] to combine values that have the same key. - @since NEXT_RELEASE *) + @since 3.3 *) val of_seq : (key * 'a) Seq.t -> 'a t (** [of_seq seq] builds a map from the given [Seq.t] of bindings. @@ -91,7 +91,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the seq than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val add_iter : 'a t -> (key * 'a) iter -> 'a t (** [add_iter m iter] adds the given [iter] of bindings to the map [m]. @@ -101,7 +101,7 @@ module type S = sig val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> 'a t (** [add_iter ~f m l] adds the given iter [l] of bindings to the map [m], using [f] to combine values that have the same key. - @since NEXT_RELEASE *) + @since 3.3 *) val of_iter : (key * 'a) iter -> 'a t (** [of_iter iter] builds a map from the given [iter] of bindings. @@ -114,7 +114,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the iter than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val to_iter : 'a t -> (key * 'a) iter (** [to_iter m] iterates on the whole map [m], creating an [iter] of bindings. @@ -133,7 +133,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the list than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val add_list : 'a t -> (key * 'a) list -> 'a t (** [add_list m l] adds the given list [l] of bindings to the map [m]. @@ -142,7 +142,7 @@ module type S = sig val add_list_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) list -> 'a t (** [add_list ~f m l] adds the given list [l] of bindings to the map [m], using [f] to combine values that have the same key. - @since NEXT_RELEASE *) + @since 3.3 *) val keys : _ t -> key iter (** [keys m] iterates on the keys of [m] only, creating an [iter] of keys. diff --git a/src/core/CCMap.mli b/src/core/CCMap.mli index 5b3a66b9a..76bfa18e8 100644 --- a/src/core/CCMap.mli +++ b/src/core/CCMap.mli @@ -87,7 +87,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the seq than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val of_seq : (key * 'a) Seq.t -> 'a t (** [of_seq seq] builds a map from the given [Seq.t] of bindings. @@ -101,7 +101,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the seq than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val add_iter : 'a t -> (key * 'a) iter -> 'a t (** [add_iter m iter] adds the given [iter] of bindings to the map [m]. @@ -114,7 +114,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the seq than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val of_iter : (key * 'a) iter -> 'a t (** [of_iter iter] builds a map from the given [iter] of bindings. @@ -127,7 +127,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the iter than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val to_iter : 'a t -> (key * 'a) iter (** [to_iter m] iterates on the whole map [m], creating an [iter] of bindings. @@ -146,7 +146,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the list than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val add_list : 'a t -> (key * 'a) list -> 'a t (** [add_list m l] adds the given list [l] of bindings to the map [m]. @@ -158,7 +158,7 @@ module type S = sig If a key occurs several times, all its bindings are combined using the function [f], with [f key v1 v2] being called with [v1] occurring later in the seq than [v2]. - @since NEXT_RELEASE *) + @since 3.3 *) val keys : _ t -> key iter (** [keys m] iterates on the keys of [m] only, creating an [iter] of keys. diff --git a/src/core/CCSeq.mli b/src/core/CCSeq.mli index aeefa30ba..77ae4ff02 100644 --- a/src/core/CCSeq.mli +++ b/src/core/CCSeq.mli @@ -131,14 +131,14 @@ val for_all : ('a -> bool) -> 'a t -> bool predicate [p]. That is, it returns [(p a1) && ... && (p an)] for a non-empty list and [true] if the sequence is empty. It consumes the sequence until it finds an element not satisfying the predicate. - @since NEXT_RELEASE *) + @since 3.3 *) val exists : ('a -> bool) -> 'a t -> bool (** [exists p [a1; ...; an]] checks if at least one element of the sequence satisfies the predicate [p]. That is, it returns [(p a1) || ... || (p an)] for a non-empty sequence and [false] if the list is empty. It consumes the sequence until it finds an element satisfying the predicate. - @since NEXT_RELEASE *) + @since 3.3 *) val flat_map : ('a -> 'b t) -> 'a t -> 'b t diff --git a/src/core/CCSexp_intf.ml b/src/core/CCSexp_intf.ml index e4bc206cb..c0b1db183 100644 --- a/src/core/CCSexp_intf.ml +++ b/src/core/CCSexp_intf.ml @@ -4,7 +4,7 @@ type 'a iter = ('a -> unit) -> unit type 'a gen = unit -> 'a option (** {2 Abstract representation of S-expressions} - @since NEXT_RELEASE *) + @since 3.3 *) module type BASIC_SEXP = sig type t @@ -126,7 +126,7 @@ module type S = sig type loc (** Locations for the S-expressions. - @since NEXT_RELEASE *) + @since 3.3 *) (** {2 Parsing} *) @@ -156,6 +156,6 @@ module type S = sig (** Last location for the decoder. In particular, after calling {!next}, this gives the location of the last token used in the result, which is useful in case of error. - @since NEXT_RELEASE *) + @since 3.3 *) end end diff --git a/src/core/CCString.mli b/src/core/CCString.mli index d27c0b134..2f0b9c0d4 100644 --- a/src/core/CCString.mli +++ b/src/core/CCString.mli @@ -37,7 +37,7 @@ val fold : ('a -> char -> 'a) -> 'a -> t -> 'a val foldi : ('a -> int -> char -> 'a) -> 'a -> t -> 'a (** [foldi f init s] is just like {!fold}, but it also passes in the index of each chars as second argument to the folded function [f]. - @since NEXT_RELEASE *) + @since 3.3 *) (** {2 Conversions} *) diff --git a/src/core/CCStringLabels.mli b/src/core/CCStringLabels.mli index 4b7cf55ba..757bd6495 100644 --- a/src/core/CCStringLabels.mli +++ b/src/core/CCStringLabels.mli @@ -37,7 +37,7 @@ val fold : f:('a -> char -> 'a) -> init:'a -> t -> 'a val foldi : f:('a -> int -> char -> 'a) -> 'a -> t -> 'a (** [foldi ~f init s] is just like {!fold}, but it also passes in the index of each chars as second argument to the folded function [f]. - @since NEXT_RELEASE *) + @since 3.3 *) (** {2 Conversions} *)