Skip to content
This repository was archived by the owner on Oct 24, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bigstring-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build: [
[ "dune" "runtest" "-p" name "-j" jobs ] {with-test}
]
depends: [
"dune" {>= "1.0"}
"dune" {>= "1.11"}
"bigstring"
"base-bigarray"
"base-bytes"
Expand Down
5 changes: 5 additions & 0 deletions configure.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let () =
print_string "let map_file = ";
if String.compare Sys.ocaml_version "4.06.0" < 0
then print_endline "Bigarray.Genarray.map_file"
else print_endline "Unix.map_file"
3 changes: 3 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name configure)
(modules Configure))
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(lang dune 1.0)
(lang dune 1.11)
(name bigstring)
3 changes: 2 additions & 1 deletion src/bigstring_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
(** {2 Memory-map} *)

let map_file_descr ?pos ?(shared=false) fd len =
Bigarray.Array1.map_file fd ?pos Bigarray.char Bigarray.c_layout shared len
Bigarray.array1_of_genarray @@
Bigstring_compat.map_file fd ?pos Bigarray.char Bigarray.c_layout shared [|len|]

let with_map_file ?pos ?len ?(mode=0o644) ?(flags=[Open_rdonly]) ?shared name f =
let ic = open_in_gen flags mode name in
Expand Down
7 changes: 6 additions & 1 deletion src/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
(rule
(target bigstring_compat.ml)
(action (with-stdout-to %{target}
(run %{project_root}/configure.bc))))

(library
(name bigstring)
(public_name bigstring)
Expand All @@ -8,7 +13,7 @@
(library
(name bigstring_unix)
(public_name bigstring-unix)
(modules Bigstring_unix)
(modules Bigstring_compat Bigstring_unix)
(flags :standard -warn-error -3) ; deprecation
(synopsis "Bigstrings from Unix memory mapping.")
(libraries bigstring unix))