From 81ca2f494d7beb0b45acbaa695853178fae62efc Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sat, 19 Apr 2014 18:37:26 +0100 Subject: [PATCH 1/4] Add ocp-indent to INSTALL list --- INSTALL.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/INSTALL.sh b/INSTALL.sh index 5195db3..4d9d69e 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -1,6 +1,6 @@ #!/bin/sh -opam install --yes \ +opam install -j 4 --yes \ core \ core_extended \ cryptokit \ @@ -16,7 +16,8 @@ opam install --yes \ cmdliner \ cow \ ocp-indent \ - ctypes + ctypes \ + ocp-index echo You also need Pygments installed. echo This is python-pygments in Debian From 66668cebb0f325967dff5962298217e1619f94f2 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sat, 19 Apr 2014 18:37:43 +0100 Subject: [PATCH 2/4] Cohttp_async now makes the HTTP body type abstract. Convert code to `Pipe.to_list (Cohttp_async.Body.to_pipe body)` to obtain the list of strings now. Note that this can be optimized to `Cohttp_async.Body.to_string` to remove the subsequent string concatenation, but I chose to minimise code churn for now. --- code/async/search.ml | 2 +- code/async/search_with_error_handling.ml | 2 +- code/async/search_with_timeout_no_leak.ml | 2 +- code/async/test.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/async/search.ml b/code/async/search.ml index c22c8c3..ef53ede 100644 --- a/code/async/search.ml +++ b/code/async/search.ml @@ -28,7 +28,7 @@ let get_definition_from_json json = let get_definition word = Cohttp_async.Client.get (query_uri word) >>= fun (_, body) -> - Pipe.to_list body + Pipe.to_list (Cohttp_async.Body.to_pipe body) >>| fun strings -> (word, get_definition_from_json (String.concat strings)) diff --git a/code/async/search_with_error_handling.ml b/code/async/search_with_error_handling.ml index 90d33fb..315fd63 100644 --- a/code/async/search_with_error_handling.ml +++ b/code/async/search_with_error_handling.ml @@ -30,7 +30,7 @@ let get_definition ~server word = try_with (fun () -> Cohttp_async.Client.get (query_uri ~server word) >>= fun (_, body) -> - Pipe.to_list body + Pipe.to_list (Cohttp_async.Body.to_pipe body) >>| fun strings -> (word, get_definition_from_json (String.concat strings))) >>| function diff --git a/code/async/search_with_timeout_no_leak.ml b/code/async/search_with_timeout_no_leak.ml index 0f779f1..2079877 100644 --- a/code/async/search_with_timeout_no_leak.ml +++ b/code/async/search_with_timeout_no_leak.ml @@ -29,7 +29,7 @@ let get_definition ~server ~interrupt word = try_with (fun () -> Cohttp_async.Client.get ~interrupt (query_uri ~server word) >>= fun (_, body) -> - Pipe.to_list body + Pipe.to_list (Cohttp_async.Body.to_pipe body) >>| fun strings -> (word, get_definition_from_json (String.concat strings))) >>| function diff --git a/code/async/test.txt b/code/async/test.txt index 736015d..7f0d180 100644 --- a/code/async/test.txt +++ b/code/async/test.txt @@ -1 +1 @@ -THIS IS ONLY A TEST. \ No newline at end of file +This is only a test. \ No newline at end of file From 64a13275e5cd33cf624239e9b215fdab9809753e Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sat, 19 Apr 2014 18:39:24 +0100 Subject: [PATCH 3/4] Core_bench no longer has a `name` parameter --- code/gc/run_barrier_bench.sh | 2 +- code/maps-and-hash-tables/run_map_vs_hash.sh | 2 +- code/maps-and-hash-tables/run_map_vs_hash2.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/gc/run_barrier_bench.sh b/code/gc/run_barrier_bench.sh index 9a04acf..28c3b00 100644 --- a/code/gc/run_barrier_bench.sh +++ b/code/gc/run_barrier_bench.sh @@ -1,2 +1,2 @@ corebuild -pkg core_bench barrier_bench.native -./barrier_bench.native -ascii name alloc +./barrier_bench.native -ascii alloc diff --git a/code/maps-and-hash-tables/run_map_vs_hash.sh b/code/maps-and-hash-tables/run_map_vs_hash.sh index a821504..233463f 100644 --- a/code/maps-and-hash-tables/run_map_vs_hash.sh +++ b/code/maps-and-hash-tables/run_map_vs_hash.sh @@ -1,2 +1,2 @@ corebuild -pkg core_bench map_vs_hash.native -./map_vs_hash.native -ascii -clear-columns name time speedup +./map_vs_hash.native -ascii -clear-columns time speedup diff --git a/code/maps-and-hash-tables/run_map_vs_hash2.sh b/code/maps-and-hash-tables/run_map_vs_hash2.sh index 91191bb..5c5d825 100644 --- a/code/maps-and-hash-tables/run_map_vs_hash2.sh +++ b/code/maps-and-hash-tables/run_map_vs_hash2.sh @@ -1,2 +1,2 @@ corebuild -pkg core_bench map_vs_hash2.native -./map_vs_hash2.native -ascii -clear-columns name time speedup +./map_vs_hash2.native -ascii -clear-columns time speedup From da5763135eac835d8567d9ff7c5207605ad9e0a2 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sat, 19 Apr 2014 18:39:49 +0100 Subject: [PATCH 4/4] Ctypes has a slightly different interface to handle errno checking --- code/ffi/datetime.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ffi/datetime.ml b/code/ffi/datetime.ml index 8d1ded3..841c55a 100644 --- a/code/ffi/datetime.ml +++ b/code/ffi/datetime.ml @@ -16,8 +16,8 @@ let () = seal timeval type timezone let timezone : timezone structure typ = structure "timezone" -let gettimeofday = foreign "gettimeofday" - (ptr timeval @-> ptr timezone @-> returning_checking_errno int) +let gettimeofday = foreign "gettimeofday" ~check_errno:true + (ptr timeval @-> ptr timezone @-> returning int) let time' () = time (from_voidp time_t null)