nixpkgs/pkgs/development/ocaml-modules/genspio/genspio.patch
2024-08-08 21:38:40 +02:00

715 lines
27 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

diff --git a/src/examples/downloader.ml b/src/examples/downloader.ml
index 93638e5..a785549 100644
--- a/src/examples/downloader.ml
+++ b/src/examples/downloader.ml
@@ -1,5 +1,5 @@
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let downloader () =
let open Genspio.EDSL in
@@ -154,7 +154,7 @@ let downloader () =
; string " -> not HTTP(s) or FTP: NOT IMPLEMENTED" ] ] ) ] )
let () =
- match Caml.Sys.argv |> Array.to_list |> List.tl_exn with
+ match Stdlib.Sys.argv |> Array.to_list |> List.tl_exn with
| ["make"; path] -> (
let script = Genspio.Compile.to_many_lines (downloader ()) in
let content =
@@ -163,12 +163,12 @@ let () =
match path with
| "-" -> Fmt.pr "\n`````\n%s`````\n%!" content
| other ->
- let o = Caml.open_out other in
- Caml.Printf.fprintf o "%s%!" content ;
- Caml.close_out o )
+ let o = Stdlib.open_out other in
+ Stdlib.Printf.fprintf o "%s%!" content ;
+ Stdlib.close_out o )
| other ->
Fmt.epr "Wrong command line: [%s]\n"
(List.map ~f:(Fmt.str "%S") other |> String.concat ~sep:"; ") ;
Fmt.epr "Usage:\n%s make <path>\n Create the downloader script.\n%!"
- Caml.Sys.argv.(0) ;
- Caml.exit 1
+ Stdlib.Sys.argv.(0) ;
+ Stdlib.exit 1
diff --git a/src/examples/multigit.ml b/src/examples/multigit.ml
index e05885c..b0e5fd2 100644
--- a/src/examples/multigit.ml
+++ b/src/examples/multigit.ml
@@ -7,7 +7,7 @@
$genspio_multigit $BINNPATH
*)
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let ( // ) = Filename.concat
let msg fmt = Fmt.kstr (Fmt.epr "%s\n%!") fmt
@@ -62,7 +62,7 @@ end
let version_string =
Fmt.str "%s (Genspio: %s)"
- (try Caml.Sys.getenv "multigit_version" with _ -> "0")
+ (try Stdlib.Sys.getenv "multigit_version" with _ -> "0")
Genspio.Meta.version
module Multi_status = struct
@@ -504,7 +504,7 @@ end
let cmdf fmt =
Fmt.kstr
(fun s ->
- match Caml.Sys.command s with
+ match Stdlib.Sys.command s with
| 0 -> ()
| other -> Fmt.kstr failwith "CMD: %S failed with %d" s other )
fmt
@@ -531,13 +531,13 @@ module Meta_repository = struct
let cmd_to_string_list cmd =
let i = Unix.open_process_in cmd in
let rec loop acc =
- try loop (Caml.input_line i :: acc)
- with _ -> Caml.close_in i ; List.rev acc in
+ try loop (Stdlib.input_line i :: acc)
+ with _ -> Stdlib.close_in i ; List.rev acc in
loop []
let readme_md ~path:_ ~output =
- let o = Caml.open_out output in
- let open Caml.Format in
+ let o = Stdlib.open_out output in
+ let open Stdlib.Format in
let fmt = formatter_of_out_channel o in
let out f = fprintf fmt f in
let sec c s = out "%s\n%s\n\n" s (String.make (String.length s) c) in
@@ -591,7 +591,7 @@ module Meta_repository = struct
par "" ;
section "Authors / Making-of" ;
par
- "This repository is generated by an OCaml program which itself was \
+ "This repository is generated by an OStdlib.program which itself was \
written by [Seb Mondet](https://seb.mondet.org), it uses the \
[Genspio](https://smondet.gitlab.io/genspio-doc/) EDSL library, and \
serves as one of its examples of usage, see also its \
@@ -599,7 +599,7 @@ module Meta_repository = struct
par
"Similarly, you may check out the <https://github.com/smondet/cosc> \
repository, which is also a bunch of shell scripts maintained by an \
- OCaml program." ;
+ OStdlib.program." ;
section "Example Session / Demo" ;
let git_repos_top = "/tmp/git-repos-example" in
let git_repos_hammerlab = git_repos_top // "hammerlab" in
@@ -724,21 +724,21 @@ end
*)
let () =
- let path = Caml.Sys.argv.(1) in
+ let path = Stdlib.Sys.argv.(1) in
cmdf "mkdir -p %s" (Filename.quote path) ;
let repomode =
- try String.(Caml.Sys.getenv "repomode" = "true") with _ -> false in
+ try String.(Stdlib.Sys.getenv "repomode" = "true") with _ -> false in
let output filename script long_description =
let gms = if repomode then path // "bin" // filename else path // filename in
msg "Outputting %S" gms ;
cmdf "mkdir -p %s" Filename.(quote (dirname gms)) ;
- let o = Caml.open_out gms in
- Caml.Format.(
+ let o = Stdlib.open_out gms in
+ Stdlib.Format.(
fprintf
(formatter_of_out_channel o)
"#!/bin/sh\n\n%s\n\n%a\n"
( long_description ()
- @ [ "The following is generated by an OCaml program using the \
+ @ [ "The following is generated by an OStdlib.program using the \
Genspio EDSL."; "See <https://smondet.gitlab.io/genspio-doc/>."
]
|> List.map ~f:(Fmt.str "# %s")
@@ -746,7 +746,7 @@ let () =
Genspio.Compile.To_slow_flow.Script.pp_posix
(Genspio.Compile.To_slow_flow.compile
(script () |> Genspio.Transform.Constant_propagation.process) )) ;
- Caml.close_out o ;
+ Stdlib.close_out o ;
cmdf "chmod +x %s" (Filename.quote gms) in
Multi_status.(output name script long_description) ;
Activity_report.(output name script long_description) ;
diff --git a/src/examples/service_composer.ml b/src/examples/service_composer.ml
index ef3c69b..b52969f 100644
--- a/src/examples/service_composer.ml
+++ b/src/examples/service_composer.ml
@@ -36,7 +36,7 @@
`cosc config show` is actually able to call `cosc-configuration-display`.
*)
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let ( // ) = Filename.concat
let msg fmt = Fmt.kstr (Fmt.epr "%s\n%!") fmt
@@ -46,7 +46,7 @@ module Gedsl = Genspio.EDSL
let cmdf fmt =
Fmt.kstr
(fun s ->
- match Caml.Sys.command s with
+ match Stdlib.Sys.command s with
| 0 -> ()
| other -> Fmt.kstr failwith "CMD: %S failed with %d" s other )
fmt
@@ -87,24 +87,24 @@ module Script = struct
output_path // String.concat ~sep:"-" (root :: t.relative_path)
```
- The function `write` is the only real I/O of this whole OCaml program.
+ The function `write` is the only real I/O of this whole OStdlib.program.
*)
let write ?(compiler = `Slow_flow) t ~output_path ~root =
let path = output_path // String.concat ~sep:"-" (root :: t.relative_path) in
- let o = Caml.open_out path in
+ let o = Stdlib.open_out path in
msg "Outputting “%s” to %s\n%!" t.description path ;
( match compiler with
| `Slow_flow ->
Fmt.(
pf
- (Caml.Format.formatter_of_out_channel o)
+ (Stdlib.Format.formatter_of_out_channel o)
"#!/bin/sh\n\n%a\n" Genspio.Compile.To_slow_flow.Script.pp_posix
(Genspio.Compile.To_slow_flow.compile
(t.make ~root |> Genspio.Transform.Constant_propagation.process) ))
| `Standard ->
- Caml.Printf.fprintf o "#!/bin/sh\n\n%s\n"
+ Stdlib.Printf.fprintf o "#!/bin/sh\n\n%s\n"
(Genspio.Compile.to_many_lines (t.make ~root)) ) ;
- Caml.close_out o ; cmdf "chmod +x %s" path
+ Stdlib.close_out o ; cmdf "chmod +x %s" path
end
(*md Configuration of the scripts is bootstrapped with an environment
@@ -275,7 +275,7 @@ module Manual = struct
(Environment.var_configuration_path env)
env.Environment.default_configuration_path root root
@ par
- "The scripts are generated by an OCaml program which uses the \
+ "The scripts are generated by an OStdlib.program which uses the \
[Genspio](https://smondet.gitlab.io/genspio-doc) EDSL/library. \
The code generator serves as one of the usage examples of the \
library, see its \
@@ -341,7 +341,7 @@ module Manual = struct
let image = "smondet/genspio-doc-dockerfiles:apps406" in
Fmt.kstr par
"If you have [`opam`](https://opam.ocaml.org), setting up the \
- genspio repository is easy (only simple, pure OCaml \
+ genspio repository is easy (only simple, pure OStdlib.\
dependencies), if not, or if you just like Docker™, the \
generator is available in the `%s` image, see:"
image
@@ -912,7 +912,7 @@ module Example_script = struct
let basic env root =
let call s = Fmt.str "%s %s" root s in
let conf = "/tmp/example-basic.d" in
- let cmt fmt = Fmt.str Caml.("# " ^^ fmt) in
+ let cmt fmt = Fmt.str Stdlib.("# " ^^ fmt) in
( "basic"
, [ cmt "We setup the configuration root path:"
; Fmt.str "export %s=%s" (Environment.var_configuration_path env) conf
@@ -1051,13 +1051,13 @@ let make ?default_configuration_path ?default_screen_name ~name ~output_path ()
let () =
let anon = ref [] in
let anon_fun p = anon := p :: !anon in
- let usage = Fmt.str "%s [-help] <path>" Caml.Sys.argv.(0) in
+ let usage = Fmt.str "%s [-help] <path>" Stdlib.Sys.argv.(0) in
let name = ref None in
let output_path = ref None in
let config_path = ref None in
let screen_name = ref None in
let output_readme = ref false in
- let module Arg = Caml.Arg in
+ let module Arg = Stdlib.Arg in
let args =
Arg.align
[ ( "--name"
@@ -1077,7 +1077,7 @@ let () =
, Fmt.str "<script-name> Where to write the scripts." ) ] in
Arg.parse args anon_fun usage ;
List.iter !anon ~f:(msg "Ignoring %s") ;
- let die () = Caml.exit 2 in
+ let die () = Stdlib.exit 2 in
let need opt = function
| Some o -> o
| None ->
diff --git a/src/examples/small.ml b/src/examples/small.ml
index f6e4504..8c776a6 100644
--- a/src/examples/small.ml
+++ b/src/examples/small.ml
@@ -1,10 +1,10 @@
open! Base
-let examples = ref ([] : (Caml.out_channel -> unit) list)
+let examples = ref ([] : (Stdlib.out_channel -> unit) list)
let example ?show name description code =
let f o =
- Caml.Printf.fprintf o
+ Stdlib.Printf.fprintf o
"let () = examples := Example.make ~ocaml:%S %s %S %S %s :: !examples\n"
code
(match show with None -> "" | Some s -> Fmt.str "~show:%s" s)
@@ -303,7 +303,7 @@ Genspio.EDSL.(
(******************************************************************************)
let () =
- let open Caml in
+ let open Stdlib.in
let open Printf in
let o = open_out Sys.argv.(1) in
fprintf o "%s"
@@ -318,7 +318,7 @@ let examples = ref []
fprintf o "%s"
{ocaml|
let () =
- List.iter (List.rev !examples) ~f:(Example.run Caml.Format.std_formatter)
+ List.iter (List.rev !examples) ~f:(Example.run Stdlib.Format.std_formatter)
|ocaml} ;
close_out o ;
printf "%s: Done.\n%!" Sys.argv.(0)
diff --git a/src/examples/vm_tester.ml b/src/examples/vm_tester.ml
index f8272b9..59c81e0 100644
--- a/src/examples/vm_tester.ml
+++ b/src/examples/vm_tester.ml
@@ -1,5 +1,5 @@
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let ( // ) = Filename.concat
@@ -18,7 +18,7 @@ module Shell_script = struct
try String.sub ~pos:0 ~len:40 m with _ -> m
let path {name; content; _} =
- let open Caml in
+ let open Stdlib.in
let hash = Marshal.to_string content [] |> Digest.string |> Digest.to_hex in
let tag = String.sub hash 0 8 in
"_scripts" // Fmt.str "%s_%s.sh" (sanitize_name name) tag
@@ -54,7 +54,7 @@ module Run_environment = struct
let tmp_name_of_url = function
| Http (url, ext) ->
- ("_cache" // Caml.Digest.(string url |> to_hex))
+ ("_cache" // Stdlib.Digest.(string url |> to_hex))
^ Option.value_map ~default:"" ext ~f:(fun `Xz -> ".xz")
let make_files files =
@@ -410,14 +410,14 @@ end
let cmdf fmt =
Fmt.kstr
(fun cmd ->
- match Caml.Sys.command cmd with
+ match Stdlib.Sys.command cmd with
| 0 -> ()
| other -> Fmt.kstr failwith "Command %S did not return 0: %d" cmd other
)
fmt
let write_lines p l =
- let open Caml in
+ let open Stdlib.in
let o = open_out p in
Base.List.iter l ~f:(Printf.fprintf o "%s\n") ;
close_out o
@@ -427,7 +427,7 @@ let () =
Fmt.kstr
(fun s ->
Fmt.epr "Wrong CLI: %s\n%!" s ;
- Caml.exit 2 )
+ Stdlib.exit 2 )
fmt in
let example = ref None in
let path = ref None in
@@ -458,7 +458,7 @@ let () =
with
| Some s -> s
| None -> fail "Don't know VM %S" arg ) in
- let module Arg = Caml.Arg in
+ let module Arg = Stdlib.Arg in
let args =
Arg.align
[ ( "--ssh-port"
diff --git a/src/lib/EDSL.ml b/src/lib/EDSL.ml
index 9663489..9d31805 100644
--- a/src/lib/EDSL.ml
+++ b/src/lib/EDSL.ml
@@ -5,7 +5,7 @@ type c_string = Language.c_string
type byte_array = Language.byte_array
type fd_redirection = Language.fd_redirection
-let ( // ) = Caml.Filename.concat
+let ( // ) = Stdlib.Filename.concat
open Language.Construct
include Language.Construct.Base
@@ -109,7 +109,7 @@ let tmp_file ?tmp_dir name : file =
[ get_tmp_dir; str "/"
; str
(Fmt.str "genspio-tmp-file-%s-%s" clean
- Caml.Digest.(string name |> to_hex) ) ] in
+ Stdlib.Digest.(string name |> to_hex) ) ] in
let tmp = Str.concat_list [path; string "-tmp"] in
object (_self)
method get = get_stdout (call [string "cat"; path])
@@ -172,7 +172,7 @@ module Command_line = struct
let variable {switches; _} =
Fmt.str "%s_%s" prefix
( String.concat ~sep:"" switches
- |> Caml.Digest.string |> Caml.Digest.to_hex ) in
+ |> Stdlib.Digest.string |> Stdlib.Digest.to_hex ) in
let inits = ref [] in
let to_init s = inits := s :: !inits in
let cases = ref [] in
@@ -331,7 +331,7 @@ let fresh_name suf =
object
method v = 42
end in
- Fmt.str "g-%d-%d-%s" (Caml.Oo.id x) (Random.int 100_000) suf
+ Fmt.str "g-%d-%d-%s" (Stdlib.Oo.id x) (Random.int 100_000) suf
let sanitize_name n =
String.map n ~f:(function
diff --git a/src/lib/EDSL_v0.ml b/src/lib/EDSL_v0.ml
index 1ac12de..dd82023 100644
--- a/src/lib/EDSL_v0.ml
+++ b/src/lib/EDSL_v0.ml
@@ -5,7 +5,7 @@ type c_string = Language.c_string
type byte_array = Language.byte_array
type fd_redirection = Language.fd_redirection
-let ( // ) = Caml.Filename.concat
+let ( // ) = Stdlib.Filename.concat
include Language.Construct
@@ -63,7 +63,7 @@ let tmp_file ?tmp_dir name : file =
[ get_tmp_dir; c_string "/"
; c_string
(Fmt.str "genspio-tmp-file-%s-%s" clean
- Caml.Digest.(string name |> to_hex) ) ] in
+ Stdlib.Digest.(string name |> to_hex) ) ] in
let tmp = C_string.concat_list [path; string "-tmp"] in
object (self)
method get = get_stdout (call [string "cat"; path])
@@ -127,7 +127,7 @@ module Command_line = struct
let variable {switches; _} =
Fmt.str "%s_%s" prefix
( String.concat ~sep:"" switches
- |> Caml.Digest.string |> Caml.Digest.to_hex ) in
+ |> Stdlib.Digest.string |> Stdlib.Digest.to_hex ) in
let inits = ref [] in
let to_init s = inits := s :: !inits in
let cases = ref [] in
@@ -139,7 +139,7 @@ module Command_line = struct
let bool_of_var var = getenv (string var) |> Bool.of_string in
let anon_tmp =
Fmt.kstr tmp_file "parse-cli-%s"
- Caml.(Marshal.to_string options [] |> Digest.string |> Digest.to_hex)
+ Stdlib.(Marshal.to_string options [] |> Digest.string |> Digest.to_hex)
in
let anon = anon_tmp#get |> Elist.deserialize_to_c_string_list in
let applied_action =
@@ -293,7 +293,7 @@ let fresh_name suf =
object
method v = 42
end in
- Fmt.str "g-%d-%d-%s" (Caml.Oo.id x) (Random.int 100_000) suf
+ Fmt.str "g-%d-%d-%s" (Stdlib.Oo.id x) (Random.int 100_000) suf
let sanitize_name n =
String.map n ~f:(function
diff --git a/src/lib/common.ml b/src/lib/common.ml
index fe9cfee..d98d697 100644
--- a/src/lib/common.ml
+++ b/src/lib/common.ml
@@ -4,7 +4,7 @@ module Unique_name = struct
let x = ref 0
let create prefix =
- Caml.incr x ;
+ Stdlib.incr x ;
Fmt.str "%s_%d_%d" prefix !x (Random.int 100_000)
let variable = create
diff --git a/src/lib/compile.ml b/src/lib/compile.ml
index 12cc836..d365e37 100644
--- a/src/lib/compile.ml
+++ b/src/lib/compile.ml
@@ -53,7 +53,7 @@ module To_posix = struct
(fun ppf s -> pf ppf "@[`%s`@]" s) )
more )
()
- |> Caml.Filename.quote in
+ |> Stdlib.Filename.quote in
str " printf -- '%%s\\n' %s >&2 " msg_str
let one_liner =
@@ -116,7 +116,7 @@ let to_many_lines ?max_argument_length ?no_trap e =
to_legacy `Multi_line ?max_argument_length ?no_trap e
let quick_run_exn ?max_argument_length ?no_trap e =
- match to_many_lines ?max_argument_length ?no_trap e |> Caml.Sys.command with
+ match to_many_lines ?max_argument_length ?no_trap e |> Stdlib.Sys.command with
| 0 -> ()
| other -> Fmt.failwith "Command returned %d" other
@@ -125,7 +125,7 @@ let to_string_hum e = Fmt.str "%a" pp_hum e
let to_one_line_hum e =
let buf = Buffer.create 42 in
- let formatter = Caml.Format.formatter_of_buffer buf in
- Caml.Format.pp_set_margin formatter 10_000_000 ;
- Caml.Format.fprintf formatter "@[<h>%a@]@?" pp_hum e ;
+ let formatter = Stdlib.Format.formatter_of_buffer buf in
+ Stdlib.Format.pp_set_margin formatter 10_000_000 ;
+ Stdlib.Format.fprintf formatter "@[<h>%a@]@?" pp_hum e ;
Buffer.contents buf
diff --git a/src/lib/language.ml b/src/lib/language.ml
index cf7b810..6f71027 100644
--- a/src/lib/language.ml
+++ b/src/lib/language.ml
@@ -1,7 +1,7 @@
open Common
(* Here we use the legacy module (too much code to change at once): *)
-module Format = Caml.Format
+module Format = Stdlib.Format
type c_string = C_string
type byte_array = Byte_Array
diff --git a/src/lib/standard_compiler.ml b/src/lib/standard_compiler.ml
index 7e639c6..bc8848b 100644
--- a/src/lib/standard_compiler.ml
+++ b/src/lib/standard_compiler.ml
@@ -147,7 +147,7 @@ let rec to_ir : type a. _ -> _ -> a Language.t -> internal_representation =
match c_str with
| Byte_array_to_c_string (Literal (Literal.String s))
when Literal.Str.easy_to_escape s ->
- argument (Caml.Filename.quote s |> check_length)
+ argument (Stdlib.Filename.quote s |> check_length)
| Byte_array_to_c_string (Literal (Literal.String s))
when Literal.Str.impossible_to_escape_for_variable s ->
error ~comment_backtrace:comments (`Not_a_c_string s)
diff --git a/src/lib/to_slow_flow.ml b/src/lib/to_slow_flow.ml
index e1305ce..0f812aa 100644
--- a/src/lib/to_slow_flow.ml
+++ b/src/lib/to_slow_flow.ml
@@ -33,10 +33,10 @@ let expand_octal_command ~remove_l s =
let m = ref 0
let var_name ?expression ?script tag =
- Caml.incr m ;
+ Stdlib.incr m ;
let stag = String.map tag ~f:(function '-' -> '_' | a -> a) in
Fmt.str "genspio_%s_%d_%d_%s" stag (Random.int 100_000_000) !m
- Caml.(
+ Stdlib.(
Marshal.to_string (expression, script) [Marshal.Closures]
|> Digest.string |> Digest.to_hex)
@@ -49,7 +49,7 @@ module Tmp_db = struct
let make ?(deletion_grouping = 20) how =
let default_tmpdir =
match how with
- | `Fresh -> Caml.Filename.concat "/tmp" (var_name "tmpdir")
+ | `Fresh -> Stdlib.Filename.concat "/tmp" (var_name "tmpdir")
| `Use p -> p in
{default_tmpdir; tmp_file_db= []; deletion_grouping}
@@ -122,10 +122,10 @@ module Script = struct
let v = Fmt.str "$(%s)" (expand_octal_command ~remove_l:false oct) in
if not arithmetic then Fmt.str "\"%s\"" v else v
| Literal_value s ->
- let v = Caml.Filename.quote s in
+ let v = Stdlib.Filename.quote s in
if arithmetic then Fmt.str "$(printf -- %s)" v else v
| File s ->
- let v = Fmt.str "$(cat %s)" (Caml.Filename.quote s) in
+ let v = Fmt.str "$(cat %s)" (Stdlib.Filename.quote s) in
if not arithmetic then Fmt.str "\"%s\"" v else v
| Tmp_file_in_variable s ->
(* Parameters.(tmp_file_db := s :: !tmp_file_db) ; *)
@@ -150,7 +150,7 @@ module Script = struct
| Literal_value s -> string_to_octal s
| File f ->
Fmt.str "$(cat %s | od -t o1 -An -v | tr -d ' \\n')"
- (Caml.Filename.quote f)
+ (Stdlib.Filename.quote f)
| Tmp_file_in_variable f ->
(* Parameters.(tmp_file_db := f :: !tmp_file_db) ; *)
Fmt.str "$(cat \"${%s}\" | od -t o1 -An -v | tr -d ' \\n')" f
@@ -162,7 +162,7 @@ module Script = struct
| Unit -> assert false
| Raw_inline s -> s
| Literal_value _ -> assert false
- | File f -> Caml.Filename.quote f
+ | File f -> Stdlib.Filename.quote f
| Tmp_file_in_variable f ->
(* Parameters.(tmp_file_db := f :: !tmp_file_db) ; *)
Fmt.str "\"${%s}\"" f
@@ -343,7 +343,7 @@ let rec to_ir : type a. fail_commands:_ -> tmpdb:_ -> a t -> Script.t =
let esc = string_to_octal v ~prefix:"\\" in
mk (rawf "printf -- '%s' > %s" esc tmparg, tmp)
| Literal_value v ->
- mk (rawf "printf -- '%%s' %s > %s" (Caml.Filename.quote v) tmparg, tmp)
+ mk (rawf "printf -- '%%s' %s > %s" (Stdlib.Filename.quote v) tmparg, tmp)
| File p -> mk (rawf ":", make [] (File p))
| Tmp_file_in_variable p -> mk (rawf "cp \"${%s}\" %s" p tmparg, tmp)
| Raw_inline s -> mk (rawf "printf -- '%%s' %s > %s" s tmparg, tmp)
@@ -725,7 +725,7 @@ let compile ?(default_tmpdir = `Fresh) ?(signal_name = "USR1")
let fail_commands s =
match trap with
| `Exit_with _ ->
- [ rawf "printf '%%s\\n' %s > %s " (Caml.Filename.quote s) tmparg
+ [ rawf "printf '%%s\\n' %s > %s " (Stdlib.Filename.quote s) tmparg
; rawf "kill -s %s ${%s}" signal_name pid ]
| `None ->
failwith "You cannot use the `fail` construct with no `trap` strategy"
@@ -851,9 +851,9 @@ let test () =
let ir = compile expr in
fprintf std_formatter "==== TEST %d ====\n%a\n%!" idx Script.pp_posix ir ;
let script_file = Fmt.str "/tmp/script-%d.sh" idx in
- let o = Caml.open_out script_file in
+ let o = Stdlib.open_out script_file in
fprintf (formatter_of_out_channel o) "\n%a\n%!" Script.pp_posix ir ;
- Caml.flush o ;
- Caml.close_out o ;
- let res = Fmt.kstr Caml.Sys.command "sh %s" script_file in
+ Stdlib.flush o ;
+ Stdlib.close_out o ;
+ let res = Fmt.kstr Stdlib.Sys.command "sh %s" script_file in
fprintf std_formatter "\nRESULT: %d\n" res )
diff --git a/src/lib/transform.ml b/src/lib/transform.ml
index a1f16a3..78bb202 100644
--- a/src/lib/transform.ml
+++ b/src/lib/transform.ml
@@ -370,7 +370,7 @@ module Constant_propagation = struct
let count = ref 0 in
let check ?trace name e res =
let p = process ?trace e in
- Caml.incr count ;
+ Stdlib.incr count ;
match Poly.(p = res) with
| true -> ()
| false ->
diff --git a/src/test-lib/test_lib.ml b/src/test-lib/test_lib.ml
index eba7adf..ecf765d 100644
--- a/src/test-lib/test_lib.ml
+++ b/src/test-lib/test_lib.ml
@@ -1,9 +1,9 @@
open! Base
-let ( // ) = Caml.Filename.concat
+let ( // ) = Stdlib.Filename.concat
-module Filename = Caml.Filename
-module Sys = Caml.Sys
+module Filename = Stdlib.Filename
+module Sys = Stdlib.Sys
module Test = struct
type t =
@@ -82,7 +82,7 @@ module Shell_directory = struct
if String.length long > 30 then String.sub long ~pos:0 ~len:30
else long )
(List.length args) returns
- Caml.(
+ Stdlib.(
Marshal.to_string script [Marshal.Closures]
|> Digest.string |> Digest.to_hex
|> fun s -> String.sub s 0 10)
@@ -358,9 +358,9 @@ module Example = struct
( match Genspio.Compile.To_posix.(string ~options:multi_line) code with
| Ok script ->
let tmp = Filename.temp_file "genspio-example" ".sh" in
- let o = Caml.open_out tmp in
- Caml.Printf.fprintf o "\n%s\n" script ;
- Caml.close_out o ;
+ let o = Stdlib.open_out tmp in
+ Stdlib.Printf.fprintf o "\n%s\n" script ;
+ Stdlib.close_out o ;
(* ff fmt "@[<hov 2>* Compiled:@ `%s`@ (%d bytes)@]@\n" tmp (String.length script); *)
let out = Filename.temp_file "genspio-example" ".out" in
let err = Filename.temp_file "genspio-example" ".err" in
@@ -371,10 +371,10 @@ module Example = struct
let show_file name path =
let fence = String.make 50 '`' in
ff fmt "@\n%s:@\n@\n%s@\n" name fence ;
- let i = Caml.open_in path in
+ let i = Stdlib.open_in path in
let rec loop () =
try
- ff fmt "%c" @@ Caml.input_char i ;
+ ff fmt "%c" @@ Stdlib.input_char i ;
loop ()
with _ -> () in
loop () ; ff fmt "@\n%s@\n@\n" fence in
diff --git a/src/test/main.ml b/src/test/main.ml
index 3374bdf..44d4e3f 100644
--- a/src/test/main.ml
+++ b/src/test/main.ml
@@ -1,5 +1,5 @@
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
open Tests.Test_lib
module Compile = Genspio.Language
module Construct = Genspio.EDSL_v0
@@ -635,7 +635,7 @@ let () =
@@ exits ~name:"getenv" 25
(let open Construct in
let alternate_get_env v =
- (* We cannot use OCaml's Sys.getenv because the compilation output may
+ (* We cannot use OStdlib.s Sys.getenv because the compilation output may
be run on a different host/system (through SSH or alike). *)
exec ["sh"; "-c"; Fmt.str "echo ${%s} | tr -d '\\n'" v]
|> get_stdout |> Byte_array.to_c in
@@ -1224,14 +1224,14 @@ let () =
Fmt.kstr
(fun s ->
Fmt.epr "Error: %s\nUsage: %s\n%!" s usage ;
- Caml.exit 1 )
+ Stdlib.exit 1 )
fmt in
let anon_fun p = anon := p :: !anon in
let no_compilation_tests = ref false in
let extra_slow_flow_tests = ref false in
let extra_transform_cp_tests = ref false in
let filter_tests = ref None in
- let module Arg = Caml.Arg in
+ let module Arg = Stdlib.Arg in
let args =
Arg.align
[ ( "--important-shells"
@@ -1294,13 +1294,13 @@ let () =
let todo = Test_directory.contents testdir ~path testlist in
List.iter todo ~f:(function
| `File (p, v) ->
- let mo = Caml.open_out p in
- Caml.Printf.fprintf mo "%s\n" v ;
- Caml.close_out mo
+ let mo = Stdlib.open_out p in
+ Stdlib.Printf.fprintf mo "%s\n" v ;
+ Stdlib.close_out mo
| `Directory v -> Fmt.kstr Sys.command "mkdir -p '%s'" v |> ignore ) ) ;
let errors =
if !no_compilation_tests then false else compilation_error_tests () in
if !extra_slow_flow_tests then Genspio.To_slow_flow.test () ;
if !extra_transform_cp_tests then
Genspio.Transform.Constant_propagation.test () ;
- Caml.exit (if errors then 23 else 0)
+ Stdlib.exit (if errors then 23 else 0)