remove shims, require OCaml >= 4.08

This commit is contained in:
Simon Cruanes 2023-05-04 12:32:42 -04:00
parent 29cabc46eb
commit 303686319d
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
7 changed files with 5 additions and 74 deletions

View file

@ -11,12 +11,8 @@ build: [
["dune" "runtest" "-p" name "-j" jobs] {with-test & arch != "arm32" & arch != "x86_32"} ["dune" "runtest" "-p" name "-j" jobs] {with-test & arch != "arm32" & arch != "x86_32"}
] ]
depends: [ depends: [
"base-bytes" "ocaml" { >= "4.08.0" }
"result"
"seq"
"ocaml" { >= "4.03.0" }
"dune" { >= "2.0" } "dune" { >= "2.0" }
"dune-configurator"
"qcheck-core" {with-test} "qcheck-core" {with-test}
"ounit2" {with-test} "ounit2" {with-test}
"mdx" {with-test & >= "1.3" } "mdx" {with-test & >= "1.3" }

View file

@ -1,9 +1,5 @@
(* This file is free software, part of iter. See file "license" for more details. *) (* This file is free software, part of iter. See file "license" for more details. *)
(** {1 Simple and Efficient Iterators} *)
open Iter_shims_
type 'a t = ('a -> unit) -> unit type 'a t = ('a -> unit) -> unit
(** Iter abstract iterator type *) (** Iter abstract iterator type *)

View file

@ -2,7 +2,8 @@
(** {1 Interface and Helpers for bigarrays} *) (** {1 Interface and Helpers for bigarrays} *)
open! IterBigarrayShims_ let bigarray_map_file fd ty lay b len =
Unix.map_file fd ty lay b [| len |] |> Bigarray.array1_of_genarray
let of_bigarray b yield = let of_bigarray b yield =
let len = Bigarray.Array1.dim b in let len = Bigarray.Array1.dim b in

View file

@ -2,19 +2,6 @@
(name iter_bigarray) (name iter_bigarray)
(public_name iter.bigarray) (public_name iter.bigarray)
(libraries iter bigarray unix) (libraries iter bigarray unix)
(modules IterBigarray IterBigarrayShims_) (modules IterBigarray)
(wrapped false) (wrapped false)
(optional)) (optional))
(executable
(name mkshims)
(modules mkshims)
(libraries dune.configurator))
(rule
(targets IterBigarrayShims_.ml)
(deps mkshims.exe)
(action
(with-stdout-to
%{targets}
(run ./mkshims.exe))))

View file

@ -1,21 +0,0 @@
module C = Configurator.V1
let shims_pre_408 =
"\nopen! Bigarray\nlet bigarray_map_file = Bigarray.Array1.map_file\n"
let shims_post_408 =
"\n\
let bigarray_map_file fd ty lay b len =\n\
\ Unix.map_file fd ty lay b [| len |] |> Bigarray.array1_of_genarray\n"
let () =
C.main ~name:"mkshims" (fun c ->
let version = C.ocaml_config_var_exn c "version" in
let major, minor =
Scanf.sscanf version "%u.%u" (fun maj min -> maj, min)
in
print_endline
(if (major, minor) >= (4, 8) then
shims_post_408
else
shims_pre_408))

View file

@ -1,21 +1,9 @@
(executable
(name mkshims)
(modules mkshims)
(libraries dune.configurator))
(rule
(targets Iter_shims_.ml)
(deps mkshims.exe)
(action
(with-stdout-to
%{targets}
(run ./mkshims.exe))))
(library (library
(name iter) (name iter)
(public_name iter) (public_name iter)
(wrapped false) (wrapped false)
(modules Iter IterLabels Iter_shims_) (modules Iter IterLabels)
(flags :standard -w +a -warn-error -a+8 -nolabels) (flags :standard -w +a -warn-error -a+8 -nolabels)
(libraries bytes result seq)) (libraries bytes result seq))

View file

@ -1,16 +0,0 @@
module C = Configurator.V1
let shims_pre_408 = "module Stdlib = Pervasives"
let shims_post_408 = "module Stdlib = Stdlib"
let () =
C.main ~name:"mkshims" (fun c ->
let version = C.ocaml_config_var_exn c "version" in
let major, minor =
Scanf.sscanf version "%u.%u" (fun maj min -> maj, min)
in
print_endline
(if (major, minor) >= (4, 8) then
shims_post_408
else
shims_pre_408))