File tree Expand file tree Collapse file tree 9 files changed +25
-33
lines changed
Expand file tree Collapse file tree 9 files changed +25
-33
lines changed Original file line number Diff line number Diff line change 1+ ## 0.1.2 (2019-02-12)
2+
3+ Update to dune 1.7 and clean up dependencies.
4+
15## 0.1.1 (2018-12-11)
26
37Fix bug where C memory was released prematurely.
Original file line number Diff line number Diff line change 11opam-version: "1.2"
22name: "cmph"
3- version: "0.1.1 "
3+ version: "0.1.2 "
44maintainer: "Jack Feser <
[email protected] >"
55authors: "Jack Feser <
[email protected] >"
66homepage: "https://github.com/jfeser/ocaml-cmph"
@@ -12,11 +12,10 @@ build: [
1212 ["dune" "build" "-p" name "-j" jobs]
1313]
1414depends: [
15- "dune" {build & >= "1.1 "}
15+ "dune" {build & >= "1.7 "}
1616 "ounit" {test & >= "2.0" & < "2.1"}
1717 "ctypes" {>= "0.14" & < "0.15"}
1818 "ctypes-foreign" {>= "0.4" & < "0.5"}
19- "base" {>= "v0.11" & < "v0.12"}
20- "stdio" {>= "v0.11" & < "v0.12"}
19+ "core" {>= "v0.11" & < "v0.12"}
2120 "ppx_sexp_conv" {>= "v0.11" & < "v0.12"}
2221]
Original file line number Diff line number Diff line change 1- (lang dune 1 .1)
1+ (lang dune 1 .7)
2+ (name cmph)
Original file line number Diff line number Diff line change 33(* 3. Generate the hash function. *)
44(* 4. Export the hash function by dumping to a file or outputting as a buffer. *)
55
6- open Base
7- open Stdio
6+ open Core
87open Ctypes
98open Foreign
109module Util = Util
Original file line number Diff line number Diff line change 66 (name cmph)
77 (public_name cmph)
88 (modules cmph util)
9- (libraries base stdio ctypes ctypes.foreign)
9+ (libraries core ctypes ctypes.foreign)
1010 (c_library_flags (:standard (:include flags) -lcmph))
1111 (preprocess (pps ppx_sexp_conv ppx_compare)))
1212
Original file line number Diff line number Diff line change 1- open Base
1+ open Core
22
33let with_output thunk =
44 let old_stdout = Unix. (dup stdout) in
55 let old_stderr = Unix. (dup stderr) in
6- let tmp_fn = Caml.Filename. temp_file " output" " log" in
7- let tmp_fd = Unix. (openfile tmp_fn [O_RDWR ; O_CREAT ; O_KEEPEXEC ] 0o600 ) in
8- Unix. (dup2 tmp_fd stdout) ;
9- Unix. (dup2 tmp_fd stderr) ;
6+ let tmp_fn = Filename. temp_file " output" " log" in
7+ let tmp_fd =
8+ Unix. (openfile tmp_fn ~mode: [O_RDWR ; O_CREAT ; O_KEEPEXEC ] ~perm: 0o600 )
9+ in
10+ Unix. (dup2 ~src: tmp_fd ~dst: stdout) ;
11+ Unix. (dup2 ~src: tmp_fd ~dst: stderr) ;
1012 let cleanup () =
11- Unix. (dup2 old_stdout stdout) ;
12- Unix. (dup2 old_stderr stderr) ;
13+ Unix. (dup2 ~src: old_stdout ~dst: stdout) ;
14+ Unix. (dup2 ~src: old_stderr ~dst: stderr) ;
1315 Unix. close old_stdout ;
1416 Unix. close old_stderr ;
15- assert (Unix. (lseek tmp_fd 0 SEEK_SET ) = 0 ) ;
16- let tot_len = Unix. ((fstat tmp_fd).st_size) in
17+ assert (Unix. (lseek tmp_fd 0L ~mode: SEEK_SET ) = 0L ) ;
18+ let tot_len = Unix. ((fstat tmp_fd).st_size) |> Int. of_int64_exn in
1719 let buf = Bytes. create tot_len in
1820 let rec read_all ofs rem_len =
1921 if rem_len < = 0 then ()
2022 else
21- let read_len = Unix. read tmp_fd buf ofs rem_len in
23+ let read_len = Unix. read tmp_fd ~ buf ~pos: ofs ~len: rem_len in
2224 let ofs = ofs + read_len in
2325 let rem_len = rem_len - read_len in
2426 read_all ofs rem_len
Original file line number Diff line number Diff line change 11(executables
2- (names vector test)
2+ (names test)
33 (libraries oUnit cmph))
44
55(alias
Original file line number Diff line number Diff line change 1- open Base
2- open Stdio
1+ open Core
32open OUnit2
43open Cmph
54open Util
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments