The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #37 from dinosaure/bytes_set16u

Use %caml_bytes_set16u when it's available (with dune-configurator)

authored by

Calascibetta Romain and committed by
GitHub
ad356681 520927d1

+63 -4
+2 -1
vendor/opam/base64/base64.opam
··· 17 17 depends: [ 18 18 "ocaml" {>="4.03.0"} 19 19 "base-bytes" 20 - "dune" {>= "1.0.1"} 20 + "dune-configurator" 21 + "dune" {>= "2.0"} 21 22 "bos" {with-test} 22 23 "rresult" {with-test} 23 24 "alcotest" {with-test}
vendor/opam/base64/config/.config.ml.swp

This is a binary file and will not be displayed.

+48
vendor/opam/base64/config/config.ml
··· 1 + module Config = Configurator.V1 2 + 3 + let pre407 = {ocaml|external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_string_set16u" [@@noalloc]|ocaml} 4 + let standard = {ocaml|external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_bytes_set16u" [@@noalloc]|ocaml} 5 + 6 + type t = 7 + { major : int 8 + ; minor : int 9 + ; patch : int option 10 + ; extra : string option } 11 + 12 + let v ?patch ?extra major minor = { major; minor; patch; extra; } 13 + 14 + let parse s = 15 + try Scanf.sscanf s "%d.%d.%d+%s" (fun major minor patch extra -> v ~patch ~extra major minor) 16 + with End_of_file | Scanf.Scan_failure _ -> 17 + ( try Scanf.sscanf s "%d.%d+%s" (fun major minor extra -> v ~extra major minor) 18 + with End_of_file | Scanf.Scan_failure _ -> 19 + ( try Scanf.sscanf s "%d.%d.%d" (fun major minor patch -> v ~patch major minor) 20 + with End_of_file | Scanf.Scan_failure _ -> 21 + Scanf.sscanf s "%d.%d" (fun major minor -> v major minor) ) ) 22 + 23 + let ( >|= ) x f = match x with 24 + | Some x -> Some (f x ) 25 + | None -> None 26 + 27 + let ocaml_cp ~src ~dst = 28 + let ic = open_in src in 29 + let oc = open_out dst in 30 + let bf = Bytes.create 0x1000 in 31 + let rec go () = match input ic bf 0 (Bytes.length bf) with 32 + | 0 -> () 33 + | len -> output oc bf 0 len ; go () 34 + | exception End_of_file -> () in 35 + go () ; close_in ic ; close_out oc 36 + ;; 37 + 38 + let () = 39 + Config.main ~name:"config-base64" @@ fun t -> 40 + match Config.ocaml_config_var t "version" >|= parse with 41 + | Some version -> 42 + let dst = "unsafe.ml" in 43 + 44 + if (version.major, version.minor) >= (4, 7) 45 + then ocaml_cp ~src:"unsafe_stable.ml" ~dst 46 + else ocaml_cp ~src:"unsafe_pre407.ml" ~dst 47 + | None -> Config.die "OCaml version is not available" 48 + | exception exn -> Config.die "Got an exception: %s" (Printexc.to_string exn)
+3
vendor/opam/base64/config/dune
··· 1 + (executable 2 + (name config) 3 + (libraries dune-configurator))
+1 -1
vendor/opam/base64/src/base64.ml
··· 32 32 33 33 let unsafe_get_uint8 t off = Char.code (String.unsafe_get t off) 34 34 let unsafe_set_uint8 t off v = Bytes.unsafe_set t off (Char.chr v) 35 + let unsafe_set_uint16 = Unsafe.unsafe_set_uint16 35 36 36 - external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_string_set16u" [@@noalloc] 37 37 external unsafe_get_uint16 : string -> int -> int = "%caml_string_get16u" [@@noalloc] 38 38 external swap16 : int -> int = "%bswap16" [@@noalloc] 39 39
+7 -2
vendor/opam/base64/src/dune
··· 1 1 (library 2 2 (name base64) 3 - (modules base64) 3 + (modules unsafe base64) 4 4 (public_name base64) 5 5 (libraries bytes)) 6 6 7 + (rule 8 + (targets unsafe.ml) 9 + (deps (:config ../config/config.exe) unsafe_pre407.ml unsafe_stable.ml) 10 + (action (run %{config}))) 11 + 7 12 (library 8 13 (name base64_rfc2045) 9 14 (modules base64_rfc2045) 10 15 (public_name base64.rfc2045) 11 - (libraries bytes)) 16 + (libraries bytes))
+1
vendor/opam/base64/src/unsafe_pre407.ml
··· 1 + external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_string_set16u" [@@noalloc]
+1
vendor/opam/base64/src/unsafe_stable.ml
··· 1 + external unsafe_set_uint16 : bytes -> int -> int -> unit = "%caml_bytes_set16u" [@@noalloc]