Merge pull request #611 from rgrinberg/move-io-stdune
Move Io to stdune
This commit is contained in:
commit
338f4c9ff2
|
@ -1,7 +1,6 @@
|
||||||
open Stdune
|
open Stdune
|
||||||
let sprintf = Printf.sprintf
|
let sprintf = Printf.sprintf
|
||||||
let eprintf = Printf.eprintf
|
let eprintf = Printf.eprintf
|
||||||
module Io = Jbuilder.Io
|
|
||||||
|
|
||||||
let ( ^/ ) = Filename.concat
|
let ( ^/ ) = Filename.concat
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(library
|
(library
|
||||||
((name configurator)
|
((name configurator)
|
||||||
(flags (:standard -safe-string))
|
(flags (:standard -safe-string))
|
||||||
(libraries (jbuilder stdune))
|
(libraries (stdune ocaml_config))
|
||||||
(preprocess no_preprocessing)))
|
(preprocess no_preprocessing)))
|
||||||
|
|
||||||
(jbuild_version 1)
|
(jbuild_version 1)
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
open Import
|
|
||||||
|
|
||||||
module P = Pervasives
|
module P = Pervasives
|
||||||
|
|
||||||
let open_in ?(binary=true) fn =
|
let open_in ?(binary=true) fn =
|
||||||
|
@ -12,10 +10,10 @@ let close_in = close_in
|
||||||
let close_out = close_out
|
let close_out = close_out
|
||||||
|
|
||||||
let with_file_in ?binary fn ~f =
|
let with_file_in ?binary fn ~f =
|
||||||
protectx (open_in ?binary fn) ~finally:close_in ~f
|
Exn.protectx (open_in ?binary fn) ~finally:close_in ~f
|
||||||
|
|
||||||
let with_file_out ?binary fn ~f =
|
let with_file_out ?binary fn ~f =
|
||||||
protectx (open_out ?binary fn) ~finally:close_out ~f
|
Exn.protectx (open_out ?binary fn) ~finally:close_out ~f
|
||||||
|
|
||||||
let with_lexbuf_from_file fn ~f =
|
let with_lexbuf_from_file fn ~f =
|
||||||
with_file_in fn ~f:(fun ic ->
|
with_file_in fn ~f:(fun ic ->
|
||||||
|
@ -68,10 +66,10 @@ let copy_channels =
|
||||||
let copy_file ~src ~dst =
|
let copy_file ~src ~dst =
|
||||||
with_file_in src ~f:(fun ic ->
|
with_file_in src ~f:(fun ic ->
|
||||||
let perm = (Unix.fstat (Unix.descr_of_in_channel ic)).st_perm in
|
let perm = (Unix.fstat (Unix.descr_of_in_channel ic)).st_perm in
|
||||||
protectx (P.open_out_gen
|
Exn.protectx (P.open_out_gen
|
||||||
[Open_wronly; Open_creat; Open_trunc; Open_binary]
|
[Open_wronly; Open_creat; Open_trunc; Open_binary]
|
||||||
perm
|
perm
|
||||||
dst)
|
dst)
|
||||||
~finally:close_out
|
~finally:close_out
|
||||||
~f:(fun oc ->
|
~f:(fun oc ->
|
||||||
copy_channels ic oc))
|
copy_channels ic oc))
|
|
@ -1,7 +1,5 @@
|
||||||
(** IO operations *)
|
(** IO operations *)
|
||||||
|
|
||||||
open Stdune
|
|
||||||
|
|
||||||
val open_in : ?binary:bool (* default true *) -> string -> in_channel
|
val open_in : ?binary:bool (* default true *) -> string -> in_channel
|
||||||
val open_out : ?binary:bool (* default true *) -> string -> out_channel
|
val open_out : ?binary:bool (* default true *) -> string -> out_channel
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(library
|
(library
|
||||||
((name stdune)
|
((name stdune)
|
||||||
(synopsis "Standard library of Dune")
|
(synopsis "Standard library of Dune")
|
||||||
(libraries (caml))))
|
(libraries (caml unix))))
|
||||||
|
|
|
@ -15,6 +15,7 @@ module Result = Result
|
||||||
module Set = Set
|
module Set = Set
|
||||||
module Staged = Staged
|
module Staged = Staged
|
||||||
module String = String
|
module String = String
|
||||||
|
module Io = Io
|
||||||
|
|
||||||
external reraise : exn -> _ = "%reraise"
|
external reraise : exn -> _ = "%reraise"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue