update to latest duniverse

This commit is contained in:
Anil Madhavapeddy 2020-04-14 18:30:49 +01:00
parent 00f9339817
commit 3743150a58
32 changed files with 151 additions and 64 deletions

View File

@ -7,7 +7,7 @@
((name ocaml-print-intf)) ((name ppx_jane)) ((name re)) ((name rwo)) ((name ocaml-print-intf)) ((name ppx_jane)) ((name re)) ((name rwo))
((name sexp_pretty)) ((name textwrap)) ((name tls)) ((name yojson)))) ((name sexp_pretty)) ((name textwrap)) ((name tls)) ((name yojson))))
(excludes (((name rwo)))) (pins ()) (pull_mode Source) (remotes ()) (excludes (((name rwo)))) (pins ()) (pull_mode Source) (remotes ())
(branch master))) (ocaml_compilers (4.10)) (branch master)))
(deps (deps
((opamverse ()) ((opamverse ())
(duniverse (duniverse
@ -253,11 +253,10 @@
(upstream https://github.com/ocurrent/ocaml-version.git) (upstream https://github.com/ocurrent/ocaml-version.git)
(ref ((t v2.4.0) (commit 1eb91307b47cb46508273d4f63faa95a8173a411))) (ref ((t v2.4.0) (commit 1eb91307b47cb46508273d4f63faa95a8173a411)))
(provided_packages (((name ocaml-version) (version (2.4.0)))))) (provided_packages (((name ocaml-version) (version (2.4.0))))))
((dir ocplib-endian.1.0+dune) ((dir ocplib-endian.1.1)
(upstream git://github.com/dune-universe/ocplib-endian.git) (upstream https://github.com/OCamlPro/ocplib-endian.git)
(ref (ref ((t 1.1) (commit 6ee41bb7f8f2bef103bcf4e05ace57597c0d2316)))
((t duniverse-1.0) (commit ebd4740799e0f9d018e75ede55c777335a564080))) (provided_packages (((name ocplib-endian) (version (1.1))))))
(provided_packages (((name ocplib-endian) (version (1.0+dune))))))
((dir octavius.1.2.2) ((dir octavius.1.2.2)
(upstream https://github.com/ocaml-doc/octavius.git) (upstream https://github.com/ocaml-doc/octavius.git)
(ref ((t v1.2.2) (commit 32223e1c69aae188643203c0f99b581f7576025d))) (ref ((t v1.2.2) (commit 32223e1c69aae188643203c0f99b581f7576025d)))

View File

@ -4,3 +4,20 @@
(using mdx 0.1) (using mdx 0.1)
(formatting disabled) (formatting disabled)
(generate_opam_files true)
(source (github realworldocaml/book))
(license ISC)
(authors "Anil Madhavapeddy" "Yaron Minsky")
(maintainers "anil@recoil.org")
(package
(name rwo)
(synopsis "Real World OCaml book sources")
(description "Scripts and sources to compile the Real World OCaml
second edition book. See https://realworldocaml.org/")
(depends
(ocaml (and (>= 4.09.0) (< 4.10.0))
)))

View File

@ -1,24 +0,0 @@
opam-version: "2.0"
authors: "Pierre Chambart"
maintainer: "pierre.chambart@ocamlpro.com"
homepage: "https://github.com/OCamlPro/ocplib-endian"
depends: [
"dune"
"ocaml"
"base-bytes"
"bigarray-compat"
"cppo" {>= "1.1.0"}
]
dev-repo: "git+https://github.com/dune-universe/ocplib-endian.git"
bug-reports: "https://github.com/OCamlPro/ocplib-endian/issues"
synopsis:
"Optimised functions to read and write int16/32/64 from strings and bigarrays, based on new primitives added in version 4.01."
description: """
The library implements three modules:
* [EndianString](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianString.cppo.mli) works directly on strings, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
* [EndianBytes](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBytes.cppo.mli) works directly on bytes, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
* [EndianBigstring](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBigstring.cppo.mli) works on bigstrings (Bigarrays of chars), and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;"""
build: [[ "dune" "build" "-p" name ]]
url {
src: "git://github.com/dune-universe/ocplib-endian.git#duniverse-1.0"
}

View File

@ -6,12 +6,14 @@ global:
- PACKAGE=ocplib-endian - PACKAGE=ocplib-endian
- TESTS=true - TESTS=true
env: env:
- OCAML_VERSION=4.09
- OCAML_VERSION=4.08 - OCAML_VERSION=4.08
- OCAML_VERSION=4.07 - OCAML_VERSION=4.07
- OCAML_VERSION=4.06 - OCAML_VERSION=4.06
- OCAML_VERSION=4.05 - OCAML_VERSION=4.05
- OCAML_VERSION=4.04 - OCAML_VERSION=4.04
- OCAML_VERSION=4.03 - OCAML_VERSION=4.03
- OCAML_VERSION=4.02
os: os:
- linux - linux
- osx - osx

View File

@ -1,15 +1,18 @@
1.2 1.1
--- ---
* Add the OPAM support for building the documentation
* Use the correct bytes_set primitive for OCaml >= 4.07.0
(issue #21 fixed in #22 @hhugo)
* Fix tests on big endian architectures
(issue #20 reported by @TC01 and @olafhering)
* Fix documentation typo (@bobot)
* Change cppo to a build dependency (@TheLortex)
* Port to Dune from jbuilder (@avsm) * Port to Dune from jbuilder (@avsm)
* Upgrade opam metadata to 2.0 format (@avsm) * Upgrade opam metadata to 2.0 format (@avsm)
* Remove code for OCaml <4.01 support, as the minimum * Remove code for OCaml <4.01 support, as the minimum
supported version is now OCaml 4.02+ (@avsm) supported version is now OCaml 4.02+ (@avsm)
* Build with jbuilder (unreleased, superseded by dune)
1.1
---------------
* Build with jbuilder
1.0 1.0
--------------- ---------------

View File

@ -9,3 +9,8 @@ The library implements three modules:
- [EndianBytes](src/endianBytes.cppo.mli) works directly on bytes, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts; - [EndianBytes](src/endianBytes.cppo.mli) works directly on bytes, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
- [EndianBigstring](src/endianBigstring.cppo.mli) works on bigstrings (Bigarrays of chars), and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts; - [EndianBigstring](src/endianBigstring.cppo.mli) works on bigstrings (Bigarrays of chars), and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
= Hacking =
The tests only pass in dune release profile. The debug mode prevents
cross module inlining, which prevents unboxing in the tests.

View File

@ -0,0 +1,30 @@
opam-version: "2.0"
name: "ocplib-endian"
synopsis: "Optimised functions to read and write int16/32/64 from strings and bigarrays"
description: """
The library implements three modules:
* [EndianString](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianString.mli) works directly on strings, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
* [EndianBytes](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBytes.mli) works directly on bytes, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
* [EndianBigstring](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBigstring.mli) works on bigstrings (Bigarrays of chars), and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts.
"""
maintainer: "pierre.chambart@ocamlpro.com"
authors: "Pierre Chambart"
homepage: "https://github.com/OCamlPro/ocplib-endian"
bug-reports: "https://github.com/OCamlPro/ocplib-endian/issues"
doc: "https://ocamlpro.github.io/ocplib-endian/ocplib-endian/"
depends: [
"base-bytes"
"ocaml" {>= "4.02.3"}
"cppo" {>= "1.1.0" & build}
"dune" {build & >= "1.0"}
]
build: [
["dune" "build" "-p" name "-j" jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}]
]
dev-repo: "git+https://github.com/OCamlPro/ocplib-endian.git"
url {
src: "https://github.com/OCamlPro/ocplib-endian/archive/1.1.tar.gz"
}

View File

@ -11,7 +11,7 @@
common.ml common.ml
common_401.ml) common_401.ml)
(action (action
(run %{bin:cppo} %{<} -o %{targets}))) (run %{bin:cppo} -V OCAML:%{ocaml_version} %{<} -o %{targets})))
(rule (rule
(targets endianBytes.mli) (targets endianBytes.mli)
@ -27,7 +27,7 @@
common.ml common.ml
common_401.ml) common_401.ml)
(action (action
(run %{bin:cppo} %{<} -o %{targets}))) (run %{bin:cppo} -V OCAML:%{ocaml_version} %{<} -o %{targets})))
(rule (rule
(targets endianBigstring.mli) (targets endianBigstring.mli)
@ -72,4 +72,4 @@
(wrapped false) (wrapped false)
(modules endianBigstring) (modules endianBigstring)
(ocamlopt_flags (:standard -inline 1000)) (ocamlopt_flags (:standard -inline 1000))
(libraries ocplib_endian bigarray-compat bytes)) (libraries ocplib_endian bigarray bytes))

View File

@ -15,7 +15,7 @@
(* *) (* *)
(************************************************************************) (************************************************************************)
open Bigarray_compat open Bigarray
type bigstring = (char, int8_unsigned_elt, c_layout) Array1.t type bigstring = (char, int8_unsigned_elt, c_layout) Array1.t

View File

@ -15,7 +15,7 @@
(* *) (* *)
(************************************************************************) (************************************************************************)
open Bigarray_compat open Bigarray
type bigstring = (char, int8_unsigned_elt, c_layout) Array1.t type bigstring = (char, int8_unsigned_elt, c_layout) Array1.t
module type EndianBigstringSig = sig module type EndianBigstringSig = sig

View File

@ -89,6 +89,8 @@ let unsafe_set_char (s:Bytes.t) off v =
#include "common.ml" #include "common.ml"
#if OCAML_VERSION < (4, 07, 0)
external unsafe_get_16 : Bytes.t -> int -> int = "%caml_string_get16u" external unsafe_get_16 : Bytes.t -> int -> int = "%caml_string_get16u"
external unsafe_get_32 : Bytes.t -> int -> int32 = "%caml_string_get32u" external unsafe_get_32 : Bytes.t -> int -> int32 = "%caml_string_get32u"
external unsafe_get_64 : Bytes.t -> int -> int64 = "%caml_string_get64u" external unsafe_get_64 : Bytes.t -> int -> int64 = "%caml_string_get64u"
@ -105,4 +107,24 @@ external set_16 : Bytes.t -> int -> int -> unit = "%caml_string_set16"
external set_32 : Bytes.t -> int -> int32 -> unit = "%caml_string_set32" external set_32 : Bytes.t -> int -> int32 -> unit = "%caml_string_set32"
external set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64" external set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64"
#else
external unsafe_get_16 : Bytes.t -> int -> int = "%caml_bytes_get16u"
external unsafe_get_32 : Bytes.t -> int -> int32 = "%caml_bytes_get32u"
external unsafe_get_64 : Bytes.t -> int -> int64 = "%caml_bytes_get64u"
external unsafe_set_16 : Bytes.t -> int -> int -> unit = "%caml_bytes_set16u"
external unsafe_set_32 : Bytes.t -> int -> int32 -> unit = "%caml_bytes_set32u"
external unsafe_set_64 : Bytes.t -> int -> int64 -> unit = "%caml_bytes_set64u"
external get_16 : Bytes.t -> int -> int = "%caml_bytes_get16"
external get_32 : Bytes.t -> int -> int32 = "%caml_bytes_get32"
external get_64 : Bytes.t -> int -> int64 = "%caml_bytes_get64"
external set_16 : Bytes.t -> int -> int -> unit = "%caml_bytes_set16"
external set_32 : Bytes.t -> int -> int32 -> unit = "%caml_bytes_set32"
external set_64 : Bytes.t -> int -> int64 -> unit = "%caml_bytes_set64"
#endif
#include "common_401.ml" #include "common_401.ml"

View File

@ -79,8 +79,7 @@ module type EndianBytesSig = sig
end end
module BigEndian : sig module BigEndian : sig
(** Functions reading according to Big Endian byte order without (** Functions reading according to Big Endian byte order *)
checking for overflow *)
include EndianBytesSig include EndianBytesSig

View File

@ -89,16 +89,30 @@ external unsafe_get_16 : string -> int -> int = "%caml_string_get16u"
external unsafe_get_32 : string -> int -> int32 = "%caml_string_get32u" external unsafe_get_32 : string -> int -> int32 = "%caml_string_get32u"
external unsafe_get_64 : string -> int -> int64 = "%caml_string_get64u" external unsafe_get_64 : string -> int -> int64 = "%caml_string_get64u"
external unsafe_set_16 : Bytes.t -> int -> int -> unit = "%caml_string_set16u"
external unsafe_set_32 : Bytes.t -> int -> int32 -> unit = "%caml_string_set32u"
external unsafe_set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64u"
external get_16 : string -> int -> int = "%caml_string_get16" external get_16 : string -> int -> int = "%caml_string_get16"
external get_32 : string -> int -> int32 = "%caml_string_get32" external get_32 : string -> int -> int32 = "%caml_string_get32"
external get_64 : string -> int -> int64 = "%caml_string_get64" external get_64 : string -> int -> int64 = "%caml_string_get64"
#if OCAML_VERSION < (4, 07, 0)
external unsafe_set_16 : Bytes.t -> int -> int -> unit = "%caml_string_set16u"
external unsafe_set_32 : Bytes.t -> int -> int32 -> unit = "%caml_string_set32u"
external unsafe_set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64u"
external set_16 : Bytes.t -> int -> int -> unit = "%caml_string_set16" external set_16 : Bytes.t -> int -> int -> unit = "%caml_string_set16"
external set_32 : Bytes.t -> int -> int32 -> unit = "%caml_string_set32" external set_32 : Bytes.t -> int -> int32 -> unit = "%caml_string_set32"
external set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64" external set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64"
#else
external unsafe_set_16 : Bytes.t -> int -> int -> unit = "%caml_bytes_set16u"
external unsafe_set_32 : Bytes.t -> int -> int32 -> unit = "%caml_bytes_set32u"
external unsafe_set_64 : Bytes.t -> int -> int64 -> unit = "%caml_bytes_set64u"
external set_16 : Bytes.t -> int -> int -> unit = "%caml_bytes_set16"
external set_32 : Bytes.t -> int -> int32 -> unit = "%caml_bytes_set32"
external set_64 : Bytes.t -> int -> int64 -> unit = "%caml_bytes_set64"
#endif
#include "common_401.ml" #include "common_401.ml"

View File

@ -27,9 +27,9 @@ let () =
Test_bytes.test1 (); Test_bytes.test1 ();
let stat1 = Gc.quick_stat () in let stat1 = Gc.quick_stat () in
Test_bytes.test2 (); Test_bytes.test2 ();
if Sys.word_size = 64 then Test_string.test_64 (); if Sys.word_size = 64 then Test_bytes.test_64 ();
let stat2 = Gc.quick_stat () in let stat2 = Gc.quick_stat () in
if Sys.word_size = 32 then Test_string.test_64 (); if Sys.word_size = 32 then Test_bytes.test_64 ();
let alloc3 = stat2.Gc.minor_words -. stat1.Gc.minor_words -. allocdiff in let alloc3 = stat2.Gc.minor_words -. stat1.Gc.minor_words -. allocdiff in
Printf.printf "bytes: allocated words %f\n%!" alloc3; Printf.printf "bytes: allocated words %f\n%!" alloc3;
(* we cannot ensure that there are no allocations only with the (* we cannot ensure that there are no allocations only with the

View File

@ -121,8 +121,8 @@ let test2 () =
if big_endian if big_endian
then begin then begin
NE.set_int16 s 0 0x1234; NE.set_int16 s 0 0x1234;
assert( BE.get_uint16 s 0 = 0xFEDC ); assert( BE.get_uint16 s 0 = 0x1234 );
assert( BE.get_uint16 s 1 = 0xDC00 ); assert( BE.get_uint16 s 1 = 0x3400 );
assert( BE.get_uint16 s 2 = 0 ) assert( BE.get_uint16 s 2 = 0 )
end; end;

View File

@ -115,8 +115,8 @@ let test2 () =
if big_endian if big_endian
then begin then begin
NE.set_int16 s 0 0x1234; NE.set_int16 s 0 0x1234;
assert( BE.get_uint16 (to_t s) 0 = 0xFEDC ); assert( BE.get_uint16 (to_t s) 0 = 0x1234 );
assert( BE.get_uint16 (to_t s) 1 = 0xDC00 ); assert( BE.get_uint16 (to_t s) 1 = 0x3400 );
assert( BE.get_uint16 (to_t s) 2 = 0 ) assert( BE.get_uint16 (to_t s) 2 = 0 )
end; end;

View File

@ -115,8 +115,8 @@ let test2 () =
if big_endian if big_endian
then begin then begin
NE.set_int16 s 0 0x1234; NE.set_int16 s 0 0x1234;
assert( BE.get_uint16 (to_t s) 0 = 0xFEDC ); assert( BE.get_uint16 (to_t s) 0 = 0x1234 );
assert( BE.get_uint16 (to_t s) 1 = 0xDC00 ); assert( BE.get_uint16 (to_t s) 1 = 0x3400 );
assert( BE.get_uint16 (to_t s) 2 = 0 ) assert( BE.get_uint16 (to_t s) 2 = 0 )
end; end;

View File

@ -1,20 +1,35 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0" opam-version: "2.0"
name: "rwo" synopsis: "Real World OCaml book sources"
version: "dev" description: """
maintainer: "Anil Madhavapeddy <anil@recoil.org>" Scripts and sources to compile the Real World OCaml
authors: ["Yaron Minsky" "Anil Madhavapeddy" "Jason Hickey"] second edition book. See https://realworldocaml.org/"""
maintainer: ["anil@recoil.org"]
authors: ["Anil Madhavapeddy" "Yaron Minsky"]
license: "ISC" license: "ISC"
homepage: "https://github.com/realworldocaml/book" homepage: "https://github.com/realworldocaml/book"
bug-reports: "https://github.com/realworldocaml/book/issues" bug-reports: "https://github.com/realworldocaml/book/issues"
synopsis: "Real World OCaml book sources"
depends: [ depends: [
"ocaml" {>= "4.09.0"} "dune" {>= "2.4"}
"dune" {>= "2.4.0"} "ocaml" {>= "4.09.0" & < "4.10.0"}
] ]
build: ["dune" "build"] build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/realworldocaml/book.git"
depexts: [ depexts: [
["tzdata"] {os-distribution = "ubuntu"} ["tzdata"] {os-distribution = "ubuntu"}
["tzdata"] {os-distribution = "debian"} ["tzdata"] {os-distribution = "debian"}
["tzdata"] {os-distribution = "alpine"} ["tzdata"] {os-distribution = "alpine"}
] ]
dev-repo: "git+https://github.com/realworldocaml/book.git"

5
rwo.opam.template Normal file
View File

@ -0,0 +1,5 @@
depexts: [
["tzdata"] {os-distribution = "ubuntu"}
["tzdata"] {os-distribution = "debian"}
["tzdata"] {os-distribution = "alpine"}
]