Hello community, here is the log from the commit of package ocaml-extlib for openSUSE:Factory checked in at 2019-05-09 14:28:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ocaml-extlib (Old) and /work/SRC/openSUSE:Factory/.ocaml-extlib.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ocaml-extlib" Thu May 9 14:28:16 2019 rev:6 rq:701638 version:1.7.6 Changes: -------- --- /work/SRC/openSUSE:Factory/ocaml-extlib/ocaml-extlib.changes 2019-02-24 17:09:41.908518698 +0100 +++ /work/SRC/openSUSE:Factory/.ocaml-extlib.new.5148/ocaml-extlib.changes 2019-05-09 14:28:20.533929682 +0200 @@ -1,0 +2,12 @@ +Thu Mar 21 09:23:46 UTC 2019 - [email protected] + +- Update to upstream release 1.7.6 + * Restore compilation on 32-bit (remove patch fix32bit.patch). + * Sync with OCaml 4.07. + * Install with Makefile. + * IO: read_i32_as_int. + * Fix Dllist.skip with negative argument. + * Fix IO.read_bits 31. +- Use SPDX OCaml-LGPL-linking-exception. + +------------------------------------------------------------------- Old: ---- fix32bit.patch ocaml-extlib-1.7.4.tar.gz New: ---- ocaml-extlib-1.7.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ocaml-extlib.spec ++++++ --- /var/tmp/diff_new_pack.93zgS4/_old 2019-05-09 14:28:21.921932895 +0200 +++ /var/tmp/diff_new_pack.93zgS4/_new 2019-05-09 14:28:21.945932951 +0200 @@ -1,7 +1,7 @@ # # spec file for package ocaml-extlib # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2011 Andrew Psaltis <ampsaltis at gmail dot com> # # All modifications and additions to the file contributed by third parties @@ -18,16 +18,14 @@ Name: ocaml-extlib -Version: 1.7.4 +Version: 1.7.6 Release: 0 %{?ocaml_preserve_bytecode} Summary: OCaml ExtLib additions to the standard library -License: LGPL-2.1-or-later WITH OCaml-linking-exception +License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception Group: Development/Languages/OCaml Url: https://github.com/ygrek/ocaml-extlib Source0: https://github.com/ygrek/ocaml-extlib/archive/%{version}/%{name}-%{version}.tar.gz -# https://github.com/ygrek/ocaml-extlib/commit/21784d25591db39fe74ea2626bd703ba8b2b2181 -Patch0: fix32bit.patch BuildRequires: ocaml BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-rpm-macros >= 4.03 @@ -53,7 +51,6 @@ %prep %setup -q -n %{name}-%{version} -%patch0 -p1 %build make build doc -j1 ++++++ ocaml-extlib-1.7.4.tar.gz -> ocaml-extlib-1.7.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/.travis.yml new/ocaml-extlib-1.7.6/.travis.yml --- old/ocaml-extlib-1.7.4/.travis.yml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/.travis.yml 2019-03-03 17:33:48.000000000 +0100 @@ -2,12 +2,31 @@ sudo: required install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-opam.sh script: bash -ex .travis-opam.sh -env: - - OCAML_VERSION=4.02 - - OCAML_VERSION=4.03 - - OCAML_VERSION=4.04 - - OCAML_VERSION=4.05 - - OCAML_VERSION=4.06 -os: - - linux - - osx +matrix: + include: + - env: OCAML_VERSION=4.02 + os: osx + - env: OCAML_VERSION=4.03 + os: osx + - env: OCAML_VERSION=4.04 + os: osx + - env: OCAML_VERSION=4.05 + os: osx + - env: OCAML_VERSION=4.06 + os: osx + - env: OCAML_VERSION=4.02 + os: linux + - env: OCAML_VERSION=4.03 + os: linux + - env: OCAML_VERSION=4.04 + os: linux + - env: OCAML_VERSION=4.05 + os: linux + - env: OCAML_VERSION=4.06 + os: linux + - env: OCAML_VERSION=4.06 OPAM_SWITCH=4.06.1+32bit + os: linux + addons: + apt: + packages: + - gcc-multilib diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/CHANGES new/ocaml-extlib-1.7.6/CHANGES --- old/ocaml-extlib-1.7.4/CHANGES 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/CHANGES 2019-03-03 17:33:48.000000000 +0100 @@ -1,3 +1,13 @@ +1.7.6 (2019-03-03) +* fix Dllist.skip with negative argument (Virgile Robles) +* fix IO.read_bits 31 (Dan Korostelev) + +1.7.5 (2018-07-08) + * IO: restore compilation on 32-bit (broken in 1.7.3) + * sync with OCaml 4.07 + * install.ml is now deprecated, install with Makefile + + IO: read_i32_as_int + 1.7.4 (2018-03-12) * fix tests with OCaml 4.06 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/Makefile new/ocaml-extlib-1.7.6/Makefile --- old/ocaml-extlib-1.7.4/Makefile 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/Makefile 2019-03-03 17:33:48.000000000 +0100 @@ -1,6 +1,6 @@ VERSION:=$(shell git --git-dir=.git describe --always --long) -RELEASE:=1.7.4 +RELEASE:=1.7.6 ifndef VERSION VERSION:=$(RELEASE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/opam new/ocaml-extlib-1.7.6/opam --- old/ocaml-extlib-1.7.4/opam 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/opam 2019-03-03 17:33:48.000000000 +0100 @@ -1,10 +1,11 @@ -opam-version: "1.2" +opam-version: "2.0" maintainer: "[email protected]" homepage: "https://github.com/ygrek/ocaml-extlib" dev-repo: "git://github.com/ygrek/ocaml-extlib.git" bug-reports: "https://github.com/ygrek/ocaml-extlib/issues" doc: ["http://ygrek.org.ua/p/extlib/doc/"] license: "LGPL-2.1 with OCaml linking exception" +synopsis: "A complete yet small extension for OCaml standard library" authors: [ "Nicolas Cannasse" "Brian Hurt" @@ -21,15 +22,17 @@ ] build: [ [make "minimal=1" "build"] + [make "test"] {with-test} + [make "doc"] {with-doc} ] install: [ [make "minimal=1" "install"] ] -build-doc: [ [make "doc"] ] -build-test: [ [make "test"] ] remove: [ ["ocamlfind" "remove" "extlib"] ] depends: [ + "ocaml" "ocamlfind" {build} "cppo" {build} "base-bytes" {build} ] +flags: light-uninstall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/IO.ml new/ocaml-extlib-1.7.6/src/IO.ml --- old/ocaml-extlib-1.7.4/src/IO.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/IO.ml 2019-03-03 17:33:48.000000000 +0100 @@ -496,19 +496,22 @@ let sign_bit_i32 = lnot 0x7FFF_FFFF -let read_i31 ch = +let read_32 ~i31 ch = let ch1 = read_byte ch in let ch2 = read_byte ch in let ch3 = read_byte ch in let ch4 = read_byte ch in if ch4 land 128 <> 0 then begin - if ch4 land 64 = 0 then raise (Overflow "read_i31"); + if i31 && ch4 land 64 = 0 then raise (Overflow "read_i31"); ch1 lor (ch2 lsl 8) lor (ch3 lsl 16) lor ((ch4 land 127) lsl 24) lor sign_bit_i32 end else begin - if ch4 land 64 <> 0 then raise (Overflow "read_i31"); + if i31 && ch4 land 64 <> 0 then raise (Overflow "read_i31"); ch1 lor (ch2 lsl 8) lor (ch3 lsl 16) lor (ch4 lsl 24) end +let read_i31 ch = read_32 ~i31:true ch +let read_i32_as_int ch = read_32 ~i31:false ch + let read_i32 = read_i31 let read_real_i32 ch = @@ -570,11 +573,15 @@ write_byte ch (n asr 24) let write_i31 ch n = +#ifndef WORD_SIZE_32 if n < -0x4000_0000 || n > 0x3FFF_FFFF then raise (Overflow "write_i31"); +#endif write_32 ch n let write_i32 ch n = +#ifndef WORD_SIZE_32 if n < -0x8000_0000 || n > 0x7FFF_FFFF then raise (Overflow "write_i32"); +#endif write_32 ch n let write_real_i32 ch n = @@ -616,19 +623,22 @@ let sign_bit_i32 = lnot 0x7FFF_FFFF -let read_i31 ch = +let read_32 ~i31 ch = let ch4 = read_byte ch in let ch3 = read_byte ch in let ch2 = read_byte ch in let ch1 = read_byte ch in if ch4 land 128 <> 0 then begin - if ch4 land 64 = 0 then raise (Overflow "read_i31"); + if i31 && ch4 land 64 = 0 then raise (Overflow "read_i31"); ch1 lor (ch2 lsl 8) lor (ch3 lsl 16) lor ((ch4 land 127) lsl 24) lor sign_bit_i32 end else begin - if ch4 land 64 <> 0 then raise (Overflow "read_i31"); + if i31 && ch4 land 64 <> 0 then raise (Overflow "read_i31"); ch1 lor (ch2 lsl 8) lor (ch3 lsl 16) lor (ch4 lsl 24) end +let read_i31 ch = read_32 ~i31:true ch +let read_i32_as_int ch = read_32 ~i31:false ch + let read_i32 = read_i31 let read_real_i32 ch = @@ -674,11 +684,15 @@ write_byte ch n let write_i31 ch n = +#ifndef WORD_SIZE_32 if n < -0x4000_0000 || n > 0x3FFF_FFFF then raise (Overflow "write_i31"); +#endif write_32 ch n let write_i32 ch n = +#ifndef WORD_SIZE_32 if n < -0x8000_0000 || n > 0x7FFF_FFFF then raise (Overflow "write_i32"); +#endif write_32 ch n let write_real_i32 ch n = @@ -738,7 +752,7 @@ end else begin let k = read_byte b.ch in if b.nbits >= 24 then begin - if n >= 31 then raise Bits_error; + if n > 31 then raise Bits_error; let c = 8 + b.nbits - n in let d = b.bits land ((1 lsl b.nbits) - 1) in let d = (d lsl (8 - c)) lor (k lsr c) in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/IO.mli new/ocaml-extlib-1.7.6/src/IO.mli --- old/ocaml-extlib-1.7.4/src/IO.mli 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/IO.mli 2019-03-03 17:33:48.000000000 +0100 @@ -209,11 +209,14 @@ val read_i31 : input -> int (** Read a signed 32-bit integer. Raise [Overflow] if the - read integer cannot be represented as a Caml 31-bit integer. *) + read integer cannot be represented as an OCaml 31-bit integer. *) val read_i32 : input -> int (** Deprecated, same as read_i31 *) +val read_i32_as_int : input -> int +(** Read a signed 32-bit integer, represented as OCaml integer, wrapping around 31-bit int on 32-bit architecture *) + val read_real_i32 : input -> int32 (** Read a signed 32-bit integer as an OCaml int32. *) @@ -280,6 +283,7 @@ val read_i16 : input -> int val read_i31 : input -> int val read_i32 : input -> int + val read_i32_as_int : input -> int val read_real_i32 : input -> int32 val read_i64 : input -> int64 val read_float32 : input -> float diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/configure.ml new/ocaml-extlib-1.7.6/src/configure.ml --- old/ocaml-extlib-1.7.4/src/configure.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/configure.ml 2019-03-03 17:33:48.000000000 +0100 @@ -1,15 +1,14 @@ +open Printf + let show_bytes s = - let (_:int) = Sys.command (Printf.sprintf "ocamlfind query -format %s bytes" (Filename.quote s)) in () + let (_:int) = Sys.command (sprintf "ocamlfind query -format %s bytes" (Filename.quote s)) in () let () = match Sys.argv with | [|_;"-cppo-args"|] -> - print_endline (if Sys.ocaml_version >= "4.00.0" then "-D OCAML4 " else ""); - print_endline (if Sys.ocaml_version >= "4.02.0" then "-D OCAML4_02 " else ""); - print_endline (if Sys.ocaml_version >= "4.03.0" then "-D OCAML4_03 " else ""); - print_endline (if Sys.ocaml_version >= "4.04.0" then "-D OCAML4_04 " else ""); - print_endline (if Sys.ocaml_version >= "4.05.0" then "-D OCAML4_05 " else ""); - print_endline (if Sys.ocaml_version >= "4.06.0" then "-D OCAML4_06 " else ""); + let version = Scanf.sscanf Sys.ocaml_version "%d.%d." (fun major minor -> major * 100 + minor) in + printf "-D \\\"OCAML %d\\\"\n" version; + print_endline (if Sys.word_size = 32 then "-D WORD_SIZE_32 " else ""); show_bytes "-D WITH_BYTES"; exit 0 | [|_;"-compile-args"|] -> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/dllist.ml new/ocaml-extlib-1.7.6/src/dllist.ml --- old/ocaml-extlib-1.7.4/src/dllist.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/dllist.ml 2019-03-03 17:33:48.000000000 +0100 @@ -126,14 +126,14 @@ let prev node = node.prev let skip node idx = - let m = if idx > 0 then -1 else 1 in + let f = if idx > 0 then next else prev in let rec loop idx n = if idx == 0 then n else - loop (idx + m) n.next + loop (idx - 1) (f n) in - loop idx node + loop (abs idx) node let rev node = let rec loop next n = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extArray.ml new/ocaml-extlib-1.7.6/src/extArray.ml --- old/ocaml-extlib-1.7.4/src/extArray.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extArray.ml 2019-03-03 17:33:48.000000000 +0100 @@ -37,7 +37,7 @@ rev_in_place ys; ys -#ifndef OCAML4_03 +#if OCAML < 403 let for_all p xs = let n = length xs in let rec loop i = @@ -164,7 +164,7 @@ | Some x -> x | None -> assert false) -#ifndef OCAML4_03 +#if OCAML < 403 let iter2 f a1 a2 = if Array.length a1 <> Array.length a2 then raise (Invalid_argument "Array.iter2"); @@ -178,9 +178,9 @@ Array.init (Array.length a1) (fun i -> f a1.(i) a2.(i)) #endif -#ifdef OCAML4_03 +#if OCAML >= 403 #else -#ifdef OCAML4_02 +#if OCAML >= 402 let create_float = make_float #else let make_float n = make n 0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extArray.mli new/ocaml-extlib-1.7.6/src/extArray.mli --- old/ocaml-extlib-1.7.4/src/extArray.mli 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extArray.mli 2019-03-03 17:33:48.000000000 +0100 @@ -110,7 +110,7 @@ (** These functions are reimplemented in extlib when they are missing from the stdlib *) -#ifdef OCAML4_03 +#if OCAML >= 403 external create_float : int -> float array = "caml_make_float_vect" #else val create_float : int -> float array @@ -118,7 +118,7 @@ val make_float : int -> float array -#ifdef OCAML4_06 +#if OCAML >= 406 module Floatarray : sig external create : int -> floatarray = "caml_floatarray_create" @@ -164,4 +164,11 @@ external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" +#if OCAML >= 407 + (** [*_seq] functions were introduced in OCaml 4.07.0, and are _not_ implemented in extlib for older OCaml versions *) + val to_seq : 'a array -> 'a Seq.t + val to_seqi : 'a array -> (int * 'a) Seq.t + val of_seq : 'a Seq.t -> 'a array +#endif + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extBuffer.ml new/ocaml-extlib-1.7.6/src/extBuffer.ml --- old/ocaml-extlib-1.7.4/src/extBuffer.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extBuffer.ml 2019-03-03 17:33:48.000000000 +0100 @@ -4,7 +4,7 @@ include Buffer -#ifndef OCAML4_02 +#if OCAML < 402 (* The uses of unsafe_{of,to}_string above are not semantically justified, as the Buffer implementation may very well capture and share parts of its internal buffer, or of input string given as diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extBuffer.mli new/ocaml-extlib-1.7.6/src/extBuffer.mli --- old/ocaml-extlib-1.7.4/src/extBuffer.mli 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extBuffer.mli 2019-03-03 17:33:48.000000000 +0100 @@ -67,13 +67,13 @@ val output_buffer : out_channel -> t -> unit -#ifdef OCAML4_05 +#if OCAML >= 405 val truncate : t -> int -> unit #endif -#ifdef OCAML4_06 +#if OCAML >= 406 val add_utf_8_uchar : t -> Uchar.t -> unit val add_utf_16le_uchar : t -> Uchar.t -> unit @@ -81,4 +81,12 @@ #endif +#if OCAML >= 407 +(** [*_seq] functions were introduced in OCaml 4.07.0, and are _not_ implemented in extlib for older OCaml versions *) +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val add_seq : t -> char Seq.t -> unit +val of_seq : char Seq.t -> t +#endif + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extBytes.ml new/ocaml-extlib-1.7.6/src/extBytes.ml --- old/ocaml-extlib-1.7.4/src/extBytes.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extBytes.ml 2019-03-03 17:33:48.000000000 +0100 @@ -1,4 +1,4 @@ -#if defined OCAML4_02 || defined WITH_BYTES +#if OCAML >= 402 || defined WITH_BYTES module Bytes = Bytes #else module Bytes = struct diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extHashtbl.ml new/ocaml-extlib-1.7.6/src/extHashtbl.ml --- old/ocaml-extlib-1.7.4/src/extHashtbl.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extHashtbl.ml 2019-03-03 17:33:48.000000000 +0100 @@ -22,7 +22,7 @@ module Hashtbl = struct -#ifdef OCAML4 +#if OCAML >= 400 external old_hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc" #endif @@ -31,7 +31,7 @@ | Empty | Cons of 'a * 'b * ('a, 'b) h_bucketlist -#ifdef OCAML4 +#if OCAML >= 400 type ('a, 'b) h_t = { mutable size: int; mutable data: ('a, 'b) h_bucketlist array; @@ -47,7 +47,7 @@ include Hashtbl -#ifndef OCAML4 +#if OCAML < 400 let create ?random:_ n = Hashtbl.create (* no seed *) n #endif @@ -108,7 +108,7 @@ data = Array.map loop (h_conv h).data; } -#ifdef OCAML4 +#if OCAML >= 400 (* copied from stdlib :( *) let key_index h key = (* compatibility with old hash tables *) @@ -142,7 +142,7 @@ let pos = key_index h key in loop (Array.unsafe_get (h_conv h).data pos) -#ifndef OCAML4_05 +#if OCAML < 405 let find_opt h key = let rec loop = function | Empty -> None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extHashtbl.mli new/ocaml-extlib-1.7.6/src/extHashtbl.mli --- old/ocaml-extlib-1.7.4/src/extHashtbl.mli 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extHashtbl.mli 2019-03-03 17:33:48.000000000 +0100 @@ -70,11 +70,11 @@ (** Return the number of elements inserted into the Hashtbl (including duplicates) *) -#ifdef OCAML4 +#if OCAML >= 400 val reset : ('a,'b) t -> unit val randomize : unit -> unit - type statistics = { + type statistics = Hashtbl.statistics = { num_bindings: int; num_buckets: int; max_bucket_length: int; @@ -87,7 +87,7 @@ val seeded_hash : int -> 'a -> int #endif -#ifdef OCAML4_03 +#if OCAML >= 403 val is_randomized : unit -> bool val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit #endif @@ -95,8 +95,7 @@ (** {6 Older Functions} *) (** Please refer to the Ocaml Manual for documentation of these - functions. (note : functor support removed to avoid code - duplication). *) + functions. *) (** @before 4.00.0 [random] is ignored *) val create : ?random:bool -> int -> ('a, 'b) t @@ -113,8 +112,30 @@ val hash : 'a -> int val hash_param : int -> int -> 'a -> int +#if OCAML >= 407 + (** [*_seq] functions were introduced in OCaml 4.07.0, and are _not_ implemented in extlib for older OCaml versions *) + val to_seq : ('a,'b) t -> ('a * 'b) Seq.t + val to_seq_keys : ('a,_) t -> 'a Seq.t + val to_seq_values : (_,'b) t -> 'b Seq.t + val add_seq : ('a,'b) t -> ('a * 'b) Seq.t -> unit + val replace_seq : ('a,'b) t -> ('a * 'b) Seq.t -> unit + val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t +#endif + (** Functor interface forwards directly to stdlib implementation (i.e. no enum functions) *) +#if OCAML >= 407 + +module type HashedType = Hashtbl.HashedType +module type S = Hashtbl.S +module Make = Hashtbl.Make + +module type SeededHashedType = Hashtbl.SeededHashedType +module type SeededS = Hashtbl.SeededS +module MakeSeeded = Hashtbl.MakeSeeded + +#else + module type HashedType = sig type t @@ -128,33 +149,33 @@ type 'a t val create : int -> 'a t val clear : 'a t -> unit -#ifdef OCAML4 +#if OCAML >= 400 val reset : 'a t -> unit #endif val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit val find : 'a t -> key -> 'a -#ifdef OCAML4_05 +#if OCAML >= 405 val find_opt : 'a t -> key -> 'a option #endif val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit -#ifdef OCAML4_03 +#if OCAML >= 403 val filter_map_inplace: (key -> 'a -> 'a option) -> 'a t -> unit #endif val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b val length : 'a t -> int -#ifdef OCAML4 +#if OCAML >= 400 val stats: 'a t -> statistics #endif end module Make (H : HashedType) : S with type key = H.t -#ifdef OCAML4 +#if OCAML >= 400 module type SeededHashedType = sig type t @@ -173,14 +194,14 @@ val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit val find : 'a t -> key -> 'a -#ifdef OCAML4_05 +#if OCAML >= 405 val find_opt : 'a t -> key -> 'a option #endif val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit -#ifdef OCAML4_03 +#if OCAML >= 403 val filter_map_inplace: (key -> 'a -> 'a option) -> 'a t -> unit #endif val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b @@ -191,4 +212,6 @@ module MakeSeeded (H : SeededHashedType) : SeededS with type key = H.t #endif +#endif + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extList.ml new/ocaml-extlib-1.7.6/src/extList.ml --- old/ocaml-extlib-1.7.4/src/extList.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extList.ml 2019-03-03 17:33:48.000000000 +0100 @@ -369,9 +369,9 @@ let sort ?(cmp=compare) = List.sort cmp -#ifndef OCAML4_06 +#if OCAML < 406 let rec init size f = - if size = 0 then [] + if size = 0 then [] else if size < 0 then invalid_arg "ExtList.init" else let rec loop dst n = @@ -407,7 +407,7 @@ loop r 1 t; inj r -#ifndef OCAML4 +#if OCAML < 400 let iteri f l = let rec loop n = function | [] -> () @@ -523,11 +523,11 @@ r) h e in h.tl -#ifndef OCAML4_03 +#if OCAML < 403 let cons x l = x :: l #endif -#ifndef OCAML4_05 +#if OCAML < 405 let assoc_opt k l = try Some (assoc k l) with Not_found -> None let assq_opt k l = try Some (assq k l) with Not_found -> None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extList.mli new/ocaml-extlib-1.7.6/src/extList.mli --- old/ocaml-extlib-1.7.4/src/extList.mli 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extList.mli 2019-03-03 17:33:48.000000000 +0100 @@ -239,12 +239,18 @@ val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list -#ifdef OCAML4_02 +#if OCAML >= 402 val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list (** Same as {!List.sort}, but also remove duplicates. @since 4.02.0 *) #endif +#if OCAML >= 407 + (** [*_seq] functions were introduced in OCaml 4.07.0, and are _not_ implemented in extlib for older OCaml versions *) + val to_seq : 'a list -> 'a Seq.t + val of_seq : 'a Seq.t -> 'a list +#endif + (** {6 Exceptions} *) exception Empty_list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extString.ml new/ocaml-extlib-1.7.6/src/extString.ml --- old/ocaml-extlib-1.7.4/src/extString.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extString.ml 2019-03-03 17:33:48.000000000 +0100 @@ -26,7 +26,7 @@ include String -#ifndef OCAML4_02 +#if OCAML < 402 let init len f = let s = Bytes.create len in for i = 0 to len - 1 do @@ -99,7 +99,7 @@ done; sub s p (!l - p + 1) -#ifndef OCAML4 +#if OCAML < 400 let trim s = strip ~chars:" \t\r\n\012" s #endif @@ -184,7 +184,7 @@ (* 's' doesn't escape and will never be mutated again *) Bytes.unsafe_to_string s -#ifndef OCAML4 +#if OCAML < 400 let map f s = let len = length s in let sc = Bytes.create len in @@ -195,7 +195,7 @@ Bytes.unsafe_to_string sc #endif -#ifndef OCAML4_02 +#if OCAML < 402 let mapi f s = let len = length s in let sc = Bytes.create len in @@ -206,7 +206,7 @@ Bytes.unsafe_to_string sc #endif -#ifndef OCAML4 +#if OCAML < 400 let iteri f s = for i = 0 to length s - 1 do let () = f i (unsafe_get s i) in () @@ -281,7 +281,7 @@ with Invalid_string -> (false, String.sub str 0 (String.length str)) -#ifndef OCAML4_03 +#if OCAML < 403 let uppercase_ascii = uppercase let lowercase_ascii = lowercase let capitalize_ascii = capitalize @@ -290,7 +290,7 @@ let equal = (=) #endif -#ifndef OCAML4_04 +#if OCAML < 404 let split_on_char sep s = let r = ref [] in let j = ref (length s) in @@ -303,7 +303,7 @@ sub s 0 !j :: !r #endif -#ifndef OCAML4_05 +#if OCAML < 405 let rec index_rec_opt s lim i c = if i >= lim then None else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/extString.mli new/ocaml-extlib-1.7.6/src/extString.mli --- old/ocaml-extlib-1.7.4/src/extString.mli 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/extString.mli 2019-03-03 17:33:48.000000000 +0100 @@ -206,6 +206,13 @@ val compare : t -> t -> int val equal : t -> t -> bool +#if OCAML >= 407 + (** [*_seq] functions were introduced in OCaml 4.07.0, and are _not_ implemented in extlib for older OCaml versions *) + val to_seq : t -> char Seq.t + val to_seqi : t -> (int * char) Seq.t + val of_seq : char Seq.t -> t +#endif + (**/**) external unsafe_get : string -> int -> char = "%string_unsafe_get" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/src/install.ml new/ocaml-extlib-1.7.6/src/install.ml --- old/ocaml-extlib-1.7.4/src/install.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/src/install.ml 2019-03-03 17:33:48.000000000 +0100 @@ -196,9 +196,8 @@ if doc && not (Sys.file_exists doc_dir) then run (sprintf "mkdir %s" doc_dir); (* generate *) let defines = - (if Sys.ocaml_version >= "4.00.0" then "-D OCAML4" else "") - ^ " " ^ - (if Sys.ocaml_version >= "4.02.0" then "-D OCAML4_02" else "") + let version = Scanf.sscanf Sys.ocaml_version "%d.%d." (fun major minor -> major * 100 + minor) in + sprintf "-D 'OCAML %d' %s" version (if Sys.word_size = 32 then "-D WORD_SIZE_32 " else ""); in let pp = sprintf "-pp \"cppo %s\"" defines in let ocamlc fmt = ksprintf (fun s -> run (sprintf "ocamlc %s %s" pp s)) fmt in @@ -254,6 +253,7 @@ end; ;; try + print_endline "\nATTENTION! install.ml is deprecated and will be removed in next release. Please use Makefile instead.\n"; install(); print_endline "Done."; with diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/test/test_Dllist.ml new/ocaml-extlib-1.7.6/test/test_Dllist.ml --- old/ocaml-extlib-1.7.4/test/test_Dllist.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/test/test_Dllist.ml 2019-03-03 17:33:48.000000000 +0100 @@ -47,9 +47,17 @@ ignore (Dllist.promote lst); assert (Dllist.length lst = 2) (* returned 1, but should return 2 *) +let skip_both_ways () = + let lst = Dllist.create "left" in + ignore (Dllist.add lst "right"); + let lm = Dllist.append lst "middle" in + assert (Dllist.get (Dllist.skip lm 1) = "right"); + assert (Dllist.get (Dllist.skip lm (-1)) = "left") (* returned right *) + let () = Util.register "Dllist" [ "simple", test_simple; "regression_1", test_regression_1; "regression_2", test_regression_2; + "skip_both_ways", skip_both_ways; ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-extlib-1.7.4/test/test_IO.ml new/ocaml-extlib-1.7.6/test/test_IO.ml --- old/ocaml-extlib-1.7.4/test/test_IO.ml 2018-03-12 10:01:45.000000000 +0100 +++ new/ocaml-extlib-1.7.6/test/test_IO.ml 2019-03-03 17:33:48.000000000 +0100 @@ -72,14 +72,24 @@ () let test_i31 () = - let values = [~-0x40000000;-1;0;1;0x3FFFFFFF] in - let invalid = [~-0x40000001;0x40000000] in + let values = [~-0x4000_0000;-1;0;1;0x3FFF_FFFF] in + let invalid = if Sys.word_size = 32 then [] else [~-0x4000_0001;0x4000_0000] in let test = test_write_read values invalid string_of_int in test IO.write_i31 IO.read_i31; test IO.BigEndian.write_i31 IO.BigEndian.read_i31; () let test_i32 () = + let min_i32 = Int32.to_int Int32.min_int in + let max_i32 = Int32.to_int Int32.max_int in + let values = [~-0x4000_0000;-1;0;1;0x3FFF_FFFF] @ if Sys.word_size = 32 then [] else [min_i32;max_i32] in + let invalid = if Sys.word_size = 32 then [] else [min_i32-1;max_i32+1] in + let test = test_write_read values invalid string_of_int in + test IO.write_i32 IO.read_i32_as_int; + test IO.BigEndian.write_i32 IO.BigEndian.read_i32_as_int; + () + +let test_real_i32 () = let values = [Int32.min_int;-1l;0l;1l;Int32.max_int] in let invalid = [] in let test = test_write_read values invalid Int32.to_string in @@ -87,11 +97,20 @@ test IO.BigEndian.write_real_i32 IO.BigEndian.read_real_i32; () +let test_bits () = + let input = Bytes.make 4 (Char.chr 0xFF) in + let ch = IO.input_bits (IO.input_bytes input) in + let value = IO.read_bits ch 31 in + assert (value = (0b111_1111_1111_1111_1111_1111_1111_1111)); + () + let () = Util.register1 "IO" "i32" test_i32; + Util.register1 "IO" "real_i32" test_real_i32; Util.register1 "IO" "i31" test_i31; Util.register1 "IO" "u16" test_u16; Util.register1 "IO" "i16" test_i16; Util.register1 "IO" "u8" test_u8; Util.register1 "IO" "i8" test_i8; + Util.register1 "IO" "bits" test_bits; ()
