Skip to content

Commit

Permalink
Merge pull request #138 from hannesm/new
Browse files Browse the repository at this point in the history
cmdliner 1.1.0, remove bigarray-compat dependency
  • Loading branch information
dinosaure authored Apr 7, 2022
2 parents 1871eea + 0f82a37 commit c2744b7
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.17.0
version=0.21.0
module-item-spacing=compact
break-struct=natural
break-infix=fit-or-vertical
Expand Down
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions bin/pipe.ml
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,15 @@ let format =

let command =
let doc = "Pipe." in
let exits = Term.default_exits in
let man =
[
`S Manpage.s_description
; `P
"$(tname) reads from standard input and writes the \
compressed/decompressed data to standard output."
] in
Term.(ret (const run $ deflate $ format)), Term.info "pipe" ~exits ~doc ~man
let term = Term.(ret (const run $ deflate $ format))
and info = Cmd.info "pipe" ~doc ~man in
Cmd.v info term

let () = Term.(exit_status @@ eval command)
let () = exit (Cmd.eval' command)
1 change: 0 additions & 1 deletion bindings/stubs/gen_decompress_bindings.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open Ctypes
open Zl

let inflate i i_len o o_len =
let i = bigarray_of_ptr array1 i_len Bigarray.char i in
Expand Down
4 changes: 1 addition & 3 deletions decompress.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ run-test: [ "dune" "runtest" "-p" name "-j" jobs ]
depends: [
"ocaml" {>= "4.07.0"}
"dune" {>= "2.8.0"}
"base-bytes"
"bigarray-compat"
"cmdliner" {>= "1.0.0"}
"cmdliner" {>= "1.1.0"}
"optint" {>= "0.1.0"}
"checkseum" {>= "0.2.0"}
"bigstringaf" {with-test}
Expand Down
4 changes: 0 additions & 4 deletions lib/de.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[@@@landmark "auto"]

module Bigarray = Bigarray_compat (* XXX(dinosaure): MirageOS compatibility. *)

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

Expand Down Expand Up @@ -643,7 +641,6 @@ module Inf = struct
| End_of_inflate

and jump = Length | Extra_length | Distance | Extra_distance | Write

and ret = Await | Flush | End | K | Malformed of string

let malformedf fmt = kstrf (fun s -> Malformed s) fmt
Expand Down Expand Up @@ -3913,7 +3910,6 @@ module Lz77 = struct
let _8 = {good_length= 32; max_lazy= 128; nice_length= 258; max_chain= 1024}
let _9 = {good_length= 32; max_lazy= 258; nice_length= 258; max_chain= 4096}
let _mem_level = 8 (* default *)

let _hash_bits = _mem_level + 7
let _hash_size = 1 lsl _hash_bits
let _hash_mask = _hash_size - 1
Expand Down
3 changes: 0 additions & 3 deletions lib/de.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
functions even if they are available. Others libraries like [Bigstringaf]
serve the same purpose of a much better way. *)

module Bigarray = Bigarray_compat
(** MirageOS compatibility. *)

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
(** The type for [bigstring]. *)
Expand Down
13 changes: 6 additions & 7 deletions lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
(public_name decompress.de)
(modules de)
(ocamlopt_flags -O3 -unbox-closures -unbox-closures-factor 20)
(libraries optint checkseum bigarray-compat))
(libraries optint checkseum))

(library
(name lz)
(public_name decompress.lz)
(modules lz)
(ocamlopt_flags -O3 -unbox-closures -unbox-closures-factor 20)
(libraries optint checkseum bigarray-compat de))
(libraries optint checkseum de))

(library
(name rfc1951)
(public_name rfc1951)
(modules rfc1951)
(libraries optint checkseum bigarray-compat))
(libraries optint checkseum))

(rule
(deps de.ml)
Expand All @@ -28,19 +28,18 @@
(name zl)
(public_name decompress.zl)
(modules zl)
(libraries bigarray-compat optint checkseum de))
(libraries optint checkseum de))

(library
(name gz)
(public_name decompress.gz)
(modules gz)
(libraries bigarray-compat optint checkseum de))
(libraries optint checkseum de))

(library
(name lzo)
(public_name decompress.lzo)
(modules lzo)
(libraries bigarray-compat))
(modules lzo))

(alias
(name default)
Expand Down
2 changes: 0 additions & 2 deletions lib/gz.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ let io_buffer_size = 65536
let kstrf k fmt = Format.kasprintf k fmt
let invalid_arg fmt = Format.kasprintf invalid_arg fmt

module Bigarray = Bigarray_compat (* XXX(dinosaure): MirageOS compatibility. *)

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

Expand Down
3 changes: 0 additions & 3 deletions lib/gz.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
non-blocking streaming codec to {{:#decode}decode} and {{:#encode}encode}
GZIP encoding. It can efficiently work payload by payload without blocking IO. *)

module Bigarray = Bigarray_compat
(** MirageOS compatibility. *)

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
(** Type type for [bigstring]. *)
Expand Down
3 changes: 0 additions & 3 deletions lib/lz.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[@@@landmark "auto"]

module Bigarray = Bigarray_compat (* XXX(dinosaure): MirageOS compatibility. *)

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

Expand Down Expand Up @@ -149,7 +147,6 @@ let _7 = {good_length= 8; max_lazy= 32; nice_length= 128; max_chain= 256}
let _8 = {good_length= 32; max_lazy= 128; nice_length= 258; max_chain= 1024}
let _9 = {good_length= 32; max_lazy= 258; nice_length= 258; max_chain= 4096}
let _mem_level = 8 (* default *)

let _hash_bits = _mem_level + 7
let _hash_size = 1 lsl _hash_bits
let _hash_mask = _hash_size - 1
Expand Down
2 changes: 0 additions & 2 deletions lib/lz.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module Bigarray = Bigarray_compat

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

Expand Down
3 changes: 0 additions & 3 deletions lib/lzo.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module Bigarray = Bigarray_compat (* XXX(dinosaure): MirageOS compatibility. *)

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

Expand Down Expand Up @@ -177,7 +175,6 @@ type ('a, 'error) t =
| Lazy : ('a, 'error) t Lazy.t -> ('a, 'error) t

and 'a value = Byte : char value | Short : [ `LE | `BE ] -> int value

and state = State.t

type v = {
Expand Down
2 changes: 0 additions & 2 deletions lib/zl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ let io_buffer_size = 65536
let kstrf k fmt = Format.kasprintf k fmt
let invalid_arg fmt = Format.kasprintf invalid_arg fmt

module Bigarray = Bigarray_compat

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

Expand Down
3 changes: 0 additions & 3 deletions lib/zl.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
to {{:#decode}decode} and {{:#encode}encode} ZLIB encoding. It can
efficiently work payload by payload without blocking IO. *)

module Bigarray = Bigarray_compat
(** MirageOS compatibility. *)

type bigstring =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
(** The type for [bigstring]. *)
Expand Down
1 change: 0 additions & 1 deletion rfc1951.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ depends: [
"ocaml" {>= "4.07.0"}
"dune" {>= "2.8"}
"decompress" {= version}
"bigarray-compat"
"checkseum"
"optint"
"ctypes" {with-test & >= "0.18.0"}
Expand Down
12 changes: 6 additions & 6 deletions test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ let fuzz2 () =
; "\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e"
(* ~~~~~~~~~~~~~~~~ *)
; "\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e"
(* ~~~~~~~~~~~~~~~~ *); "\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x3a\x2c\x50"
(* ~~~~~~~~:,P *)
(* ~~~~~~~~~~~~~~~~ *)
; "\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x3a\x2c\x50" (* ~~~~~~~~:,P *)
] in
Alcotest.test_case "fuzz2" `Quick @@ fun () ->
let decoder =
Expand Down Expand Up @@ -401,8 +401,8 @@ let fuzz5 () =
let expected_output =
[
"\x1a\xca\x78\x78\x78\x78\x78\x78\x78\x50\x50\x37\x50\x50\x50\x50"
(* ..xxxxxxxPP7PPPP *); "\x50\x50\x50\x50\x50\x50\x50\x50\x50"
(* PPPPPPPPP *)
(* ..xxxxxxxPP7PPPP *)
; "\x50\x50\x50\x50\x50\x50\x50\x50\x50" (* PPPPPPPPP *)
] in
Alcotest.test_case "fuzz5" `Quick @@ fun () ->
let decoder = Inf.decoder (`String (String.concat "" input)) ~o ~w in
Expand Down Expand Up @@ -458,8 +458,8 @@ let fuzz9 () =
"\x9b\x01\x95\xfc\x51\xd2\xed\xc8\xce\xc8\xff\x80\x00\x00\x7f\xff"
(* ....Q........... *)
; "\x79\x2f\xe9\x51\x88\x7b\xb8\x2f\xef\xa5\x8c\xf8\xf1\xb6\xce\xc8"
(* y/.Q.{./........ *); "\xb8\xc8\xff\x2f\x00\x7f\x88\x7b\xbc"
(* .../...{. *)
(* y/.Q.{./........ *)
; "\xb8\xc8\xff\x2f\x00\x7f\x88\x7b\xbc" (* .../...{. *)
] in
let decoder = Inf.decoder (`String (String.concat "" inputs)) ~o ~w in
Alcotest.(check decode)
Expand Down
Loading

0 comments on commit c2744b7

Please sign in to comment.