-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from samoht/fmt
Use ocamlformat 0.14.1
- Loading branch information
Showing
18 changed files
with
809 additions
and
659 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version = 0.14.1 | ||
break-infix = fit-or-vertical | ||
parse-docstrings = true | ||
indicate-multiline-delimiters=no | ||
nested-match=align | ||
sequence-style=separator | ||
break-before-in=auto | ||
if-then-else=keyword-first |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name benchmarks) | ||
(libraries base64 core_bench)) | ||
(libraries base64 core_bench)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,54 @@ | ||
module Config = Configurator.V1 | ||
|
||
let pre407 = {ocaml|external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_string_set16u" [@@noalloc]|ocaml} | ||
let standard = {ocaml|external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_bytes_set16u" [@@noalloc]|ocaml} | ||
let pre407 = | ||
{ocaml|external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_string_set16u" [@@noalloc]|ocaml} | ||
|
||
type t = | ||
{ major : int | ||
; minor : int | ||
; patch : int option | ||
; extra : string option } | ||
let standard = | ||
{ocaml|external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_bytes_set16u" [@@noalloc]|ocaml} | ||
|
||
let v ?patch ?extra major minor = { major; minor; patch; extra; } | ||
type t = { major : int; minor : int; patch : int option; extra : string option } | ||
|
||
let v ?patch ?extra major minor = { major; minor; patch; extra } | ||
|
||
let parse s = | ||
try Scanf.sscanf s "%d.%d.%d+%s" (fun major minor patch extra -> v ~patch ~extra major minor) | ||
with End_of_file | Scanf.Scan_failure _ -> | ||
( try Scanf.sscanf s "%d.%d+%s" (fun major minor extra -> v ~extra major minor) | ||
try | ||
Scanf.sscanf s "%d.%d.%d+%s" (fun major minor patch extra -> | ||
v ~patch ~extra major minor) | ||
with End_of_file | Scanf.Scan_failure _ -> ( | ||
try | ||
Scanf.sscanf s "%d.%d+%s" (fun major minor extra -> v ~extra major minor) | ||
with End_of_file | Scanf.Scan_failure _ -> ( | ||
try | ||
Scanf.sscanf s "%d.%d.%d" (fun major minor patch -> | ||
v ~patch major minor) | ||
with End_of_file | Scanf.Scan_failure _ -> | ||
( try Scanf.sscanf s "%d.%d.%d" (fun major minor patch -> v ~patch major minor) | ||
with End_of_file | Scanf.Scan_failure _ -> | ||
Scanf.sscanf s "%d.%d" (fun major minor -> v major minor) ) ) | ||
Scanf.sscanf s "%d.%d" (fun major minor -> v major minor))) | ||
|
||
let ( >|= ) x f = match x with | ||
| Some x -> Some (f x ) | ||
| None -> None | ||
let ( >|= ) x f = match x with Some x -> Some (f x) | None -> None | ||
|
||
let ocaml_cp ~src ~dst = | ||
let ic = open_in src in | ||
let oc = open_out dst in | ||
let bf = Bytes.create 0x1000 in | ||
let rec go () = match input ic bf 0 (Bytes.length bf) with | ||
let rec go () = | ||
match input ic bf 0 (Bytes.length bf) with | ||
| 0 -> () | ||
| len -> output oc bf 0 len ; go () | ||
| len -> | ||
output oc bf 0 len ; | ||
go () | ||
| exception End_of_file -> () in | ||
go () ; close_in ic ; close_out oc | ||
;; | ||
go () ; | ||
close_in ic ; | ||
close_out oc | ||
|
||
let () = | ||
Config.main ~name:"config-base64" @@ fun t -> | ||
match Config.ocaml_config_var t "version" >|= parse with | ||
| Some version -> | ||
let dst = "unsafe.ml" in | ||
let dst = "unsafe.ml" in | ||
|
||
if (version.major, version.minor) >= (4, 7) | ||
then ocaml_cp ~src:"unsafe_stable.ml" ~dst | ||
else ocaml_cp ~src:"unsafe_pre407.ml" ~dst | ||
if (version.major, version.minor) >= (4, 7) | ||
then ocaml_cp ~src:"unsafe_stable.ml" ~dst | ||
else ocaml_cp ~src:"unsafe_pre407.ml" ~dst | ||
| None -> Config.die "OCaml version is not available" | ||
| exception exn -> Config.die "Got an exception: %s" (Printexc.to_string exn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
(lang dune 1.0) | ||
(lang dune 2.0) | ||
(name base64) | ||
(version dev) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.