From d719efa713bcbcdb39bbf1d07cca1ef12d429b1d Mon Sep 17 00:00:00 2001 From: Thierry Martinez Date: Wed, 12 Aug 2026 12:58:03 +0200 Subject: [PATCH 1/4] Update tools to extract interfaces with OCaml 5.5 --- tools/dump_interfaces.sh | 2 +- tools/interface_dumper.ml | 18 ++--- tools/interface_generator.ml | 143 +++++++++++++++++------------------ tools/interface_tools.ml | 12 +++ tools/interface_tools.mli | 8 ++ 5 files changed, 101 insertions(+), 82 deletions(-) diff --git a/tools/dump_interfaces.sh b/tools/dump_interfaces.sh index 749b385..f510517 100755 --- a/tools/dump_interfaces.sh +++ b/tools/dump_interfaces.sh @@ -6,7 +6,7 @@ set -e # 4.07.0 \ # 4.08 4.09 4.10 4.11 4.12 4.13 4.14 -for ocaml_version in 5.2 5.1 5.0; do +for ocaml_version in 5.5 5.4 5.3; do target_dir=../interfaces/$ocaml_version # ocaml_version=ocaml-variants.4.10.0+beta2 # target_dir=../interfaces/4.10.0 diff --git a/tools/interface_dumper.ml b/tools/interface_dumper.ml index 34ab184..a89091e 100644 --- a/tools/interface_dumper.ml +++ b/tools/interface_dumper.ml @@ -74,9 +74,9 @@ let refine_signature_item ~module_name match signature_item.psig_desc with | Psig_value value_description -> let pstr_desc : Parsetree.structure_item_desc = - Pstr_eval (Ast_helper.Exp.ident (Location.mkloc (Longident.Ldot ( - Lident module_name, value_description.pval_name.txt)) - !Ast_helper.default_loc), []) in + Pstr_eval (Ast_helper.Exp.ident (Interface_tools.with_default_loc (Longident.Ldot ( + Interface_tools.with_default_loc (Longident.Lident module_name), + Interface_tools.with_default_loc value_description.pval_name.txt))), []) in let s = interpret (Ptop_def [{ pstr_desc; pstr_loc = Location.none }]) in let lines = String.split_on_char '\n' s in let rec chop_warning lines = @@ -115,7 +115,7 @@ let self_name ~(module_name : Longident.t) (type_declaration : Parsetree.type_de if module_name = Lident "Pervasives" then Lident type_declaration.ptype_name.txt else - Ldot (module_name, type_declaration.ptype_name.txt) + Interface_tools.ldot module_name type_declaration.ptype_name.txt let rec remove_self_aliases_of_type_declaration ~module_name (type_declaration : Parsetree.type_declaration) = @@ -129,8 +129,8 @@ let rec remove_self_aliases_of_module_type ~module_name (module_type : Parsetree.module_type) = match module_type.pmty_desc with | Pmty_functor (Named (var, arg), body) -> - let module_name : Longident.t = - Lapply (module_name, Lident (Option.get var.txt)) in + let module_name = + Interface_tools.lapply module_name (Longident.Lident (Option.get var.txt)) in let body = remove_self_aliases_of_module_type ~module_name body in { module_type with pmty_desc = Pmty_functor (Named (var, arg), body) } | Pmty_signature s -> @@ -147,8 +147,8 @@ and remove_self_aliases_of_signature_item ~module_name List.map @@ remove_self_aliases_of_type_declaration ~module_name in { item with psig_desc = Psig_type (rec_flag, list) } | Psig_module module_declaration -> - let module_name : Longident.t = - Ldot (module_name, Option.get module_declaration.pmd_name.txt) in + let module_name = + Interface_tools.ldot module_name (Option.get module_declaration.pmd_name.txt) in let pmd_type = remove_self_aliases_of_module_type ~module_name module_declaration.pmd_type in { item with psig_desc = Psig_module { module_declaration with pmd_type }} @@ -207,7 +207,7 @@ let module_type_of_name ~command_line ~module_name = Ast_helper.Exp.apply (Ast_helper.Exp.ident (Location.mkloc (Longident.Lident "exit") !Ast_helper.default_loc)) - [Nolabel, Ast_helper.Exp.constant (Pconst_integer ("0", None))])]) in + [Nolabel, Ast_helper.Exp.constant (Interface_tools.loc_constant (Interface_tools.with_default_loc (Parsetree.Pconst_integer ("0", None))))])]) in module_type) let main () = diff --git a/tools/interface_generator.ml b/tools/interface_generator.ml index d09fd90..827ecd7 100644 --- a/tools/interface_generator.ml +++ b/tools/interface_generator.ml @@ -78,7 +78,7 @@ let rec is_core_type_isomorphic kind (t : Parsetree.core_type) is_core_type_isomorphic kind u u' && is_core_type_isomorphic kind v v' | Ptyp_tuple l, Ptyp_tuple l' -> - List.equal (is_core_type_isomorphic kind) l l' + List.equal (is_tuple_field_isomorphic kind) l l' | Ptyp_constr (c, args), Ptyp_constr (c', args') -> let eq_c, args, args' = match kind, (c.txt, args), (c'.txt, args') with @@ -114,6 +114,11 @@ and is_object_field_isomorphic kind (f : Parsetree.object_field) is_core_type_isomorphic kind t t' | _ -> false +and is_tuple_field_isomorphic kind ((l, t) : string option * Parsetree.core_type) + ((l', t') : string option * Parsetree.core_type) = + Option.equal String.equal l l' && + is_core_type_isomorphic kind t t' + let is_label_declaration_isomorphic kind (l : Parsetree.label_declaration) (l' : Parsetree.label_declaration) = Name.equal l.pld_name l'.pld_name && @@ -481,7 +486,7 @@ let qualify_type_decl ~module_name (type_decl : Parsetree.type_declaration) = | Private -> { type_decl with ptype_private = Public; ptype_manifest = Some (Ast_helper.Typ.constr - { txt = Longident.Ldot (module_name, type_decl.ptype_name.txt); + { txt = Longident.Ldot (Interface_tools.with_default_loc module_name, Interface_tools.with_default_loc type_decl.ptype_name.txt); loc = type_decl.ptype_name.loc } (List.map fst type_decl.ptype_params)) } | Public -> @@ -490,7 +495,7 @@ let qualify_type_decl ~module_name (type_decl : Parsetree.type_declaration) = Option.map @@ fun (ty : Parsetree.core_type) -> match ty.ptyp_desc with | Ptyp_constr ({ txt = Lident "fpclass"; loc }, []) -> - let txt = Longident.Ldot (Lident "Stdlib", "fpclass") in + let txt = Interface_tools.ldot (Lident "Stdlib") "fpclass" in let ptyp_desc = Parsetree.Ptyp_constr ({ Location.txt; loc }, []) in { ty with ptyp_desc } @@ -502,7 +507,7 @@ let qualify_type_decl ~module_name (type_decl : Parsetree.type_declaration) = && ident <> "list" && ident <> "bool" && ident <> "array" && ident <> "exn" && ident <> "int" && ident <> "unit" && ident <> "in_channel" && ident <> "out_channel" -> - let txt = Longident.Ldot (module_name, ident) in + let txt = Interface_tools.ldot module_name ident in let ptyp_desc = Parsetree.Ptyp_constr ({ Location.txt; loc }, args) in { ty with ptyp_desc } @@ -531,82 +536,82 @@ let rec compat_core_type ~module_name (core_type : Parsetree.core_type) = compat_core_type ~module_name right) in { core_type with ptyp_desc } | Ptyp_tuple args -> - let args = List.map (compat_core_type ~module_name) args in + let args = List.map (fun (l, ty) -> l, compat_core_type ~module_name ty) args in let ptyp_desc = Parsetree.Ptyp_tuple args in { core_type with ptyp_desc } - | Ptyp_constr ({ loc; txt = Ldot (Lident "CamlinternalLazy", "t") }, [arg]) -> + | Ptyp_constr ({ loc; txt = Ldot ({txt = Lident "CamlinternalLazy"}, {txt = "t"}) }, [arg]) -> let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__init", "lazy_t") }, [arg]) in + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__init") "lazy_t" }, [arg]) in { core_type with ptyp_desc } | Ptyp_constr ({ loc; txt = Lident "bytes" }, []) -> let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__init", "bytes") }, []) in + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__init") "bytes" }, []) in { core_type with ptyp_desc } | Ptyp_constr ({ loc; txt = Lident "floatarray" }, []) -> let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__init", "floatarray") }, []) in + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__init") "floatarray" }, []) in { core_type with ptyp_desc } | Ptyp_constr ({ loc; txt = Lident "result" }, [v; e]) -> let v = compat_core_type ~module_name v in let e = compat_core_type ~module_name e in let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__pervasives", "result") }, + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__pervasives") "result" }, [v; e]) in { core_type with ptyp_desc } - | Ptyp_constr ({ loc; txt = Ldot (Lident "Seq", "t") }, [arg]) -> + | Ptyp_constr ({ loc; txt = Ldot ({txt = Lident "Seq"}, {txt="t"}) }, [arg]) -> let arg = compat_core_type ~module_name arg in let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__seq", "t") }, + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__seq") "t" }, [compat_core_type ~module_name arg]) in { core_type with ptyp_desc } - | Ptyp_constr ({ loc; txt = Ldot (Lident "Stdlib", t) }, args) -> + | Ptyp_constr ({ loc; txt = Ldot ({txt = Lident "Stdlib"}, {txt = t}) }, args) -> let args = List.map (compat_core_type ~module_name) args in let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__stdlib", t) }, + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__stdlib") t }, args) in { core_type with ptyp_desc } - | Ptyp_constr ({ loc; txt = Ldot (Lident "Uchar", t) }, []) -> + | Ptyp_constr ({ loc; txt = Ldot ({txt = Lident "Uchar"}, {txt= t}) }, []) -> let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__uchar", t) }, []) in + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__uchar") t }, []) in { core_type with ptyp_desc } - | Ptyp_constr ({ loc; txt = Ldot (Lident "Hashtbl", "statistics") }, []) -> + | Ptyp_constr ({ loc; txt = Ldot ({txt = Lident "Hashtbl"}, {txt= "statistics"}) }, []) -> let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__hashtbl_ext", "statistics") }, + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__hashtbl_ext") "statistics" }, []) in { core_type with ptyp_desc } | Ptyp_constr ({ loc; txt = - Ldot (Lapply (Ldot (Lident "Hashtbl", "MakeSeeded"), - Lident "H"), "t") }, args) -> + Ldot ({txt = Lapply ({txt = Ldot ({ txt = Lident "Hashtbl"}, {txt = "MakeSeeded"})}, + {txt = Lident "H"})}, {txt = "t"}) }, args) -> let args = List.map (compat_core_type ~module_name) args in let ptyp_desc = Parsetree.Ptyp_constr ({ loc; txt = - Ldot (Lapply (Ldot (Lident "Stdcompat__hashtbl_ext", - "MakeSeeded"), Lident "H"), "t") }, + Interface_tools.ldot (Interface_tools.lapply (Interface_tools.ldot (Lident "Stdcompat__hashtbl_ext") + "MakeSeeded") (Lident "H")) "t" }, args) in { core_type with ptyp_desc } - | Ptyp_constr ({ loc; txt = Ldot (Lident "Either", "t") }, [a; b]) -> + | Ptyp_constr ({ loc; txt = Ldot ({txt = Lident "Either"}, {txt = "t"}) }, [a; b]) -> let ptyp_desc = Parsetree.Ptyp_constr - ({ loc; txt = Ldot (Lident "Stdcompat__either", "t") }, [a; b]) in + ({ loc; txt = Interface_tools.ldot (Lident "Stdcompat__either") "t" }, [a; b]) in { core_type with ptyp_desc } | Ptyp_constr (constr, args) -> let rec remove_module_name (constr : Longident.t) : Longident.t = match constr with - | Ldot (module_name', x) -> + | Ldot ({txt = module_name'}, {txt = x}) -> if module_name = module_name' then Lident x else - Ldot (remove_module_name module_name', x) + Interface_tools.ldot (remove_module_name module_name') x | _ -> constr in let constr = { constr with txt = remove_module_name constr.txt } in let ptyp_desc = @@ -655,10 +660,10 @@ let compat_type_kind ~module_name let remove_injectivity ptype_params = List.map (fun (ty, (v, _)) -> (ty, (v, Asttypes.NoInjectivity))) ptype_params -let compat_type_declaration ~module_name +let compat_type_declaration ~(module_name : Longident.t) (type_decl : Parsetree.type_declaration) = - match Longident.Ldot (module_name, type_decl.ptype_name.txt) with - | Ldot (Lident "Pervasives", "format6") -> + match module_name, type_decl.ptype_name.txt with + | Lident "Pervasives", "format6" -> let ptype_manifest = match type_decl.ptype_manifest with | Some ( @@ -666,34 +671,27 @@ let compat_type_declaration ~module_name let ptyp_desc = Parsetree.Ptyp_constr ({ loc; - txt = Ldot (Lident "Stdcompat__init", "format6") }, args) in + txt = Interface_tools.ldot (Lident "Stdcompat__init") "format6" }, args) in Some { core_type with ptyp_desc } | _ -> assert false in { type_decl with ptype_manifest } - | Lident "result" -> - { type_decl with ptype_manifest = - Some (core_type_of_desc - (Ptyp_constr - (loc_of_txt - (Longident.Ldot - (Lident "Stdcompat__pervasives", "result")), []))) } - | Ldot (Lident "Hashtbl", "statistics") -> + | Lident "Hashtbl", "statistics" -> { type_decl with ptype_manifest = Some (core_type_of_desc (Ptyp_constr (loc_of_txt - (Longident.Ldot - (Lident "Stdcompat__hashtbl_ext", "statistics")), []))) } - | Ldot (Lapply (Ldot (Lident "Hashtbl", "MakeSeeded"), Lident "H"), "t") -> + (Interface_tools.ldot + (Lident "Stdcompat__hashtbl_ext") "statistics"), []))) } + | Lapply ({txt = Ldot ({txt = Lident "Hashtbl"}, {txt = "MakeSeeded"})}, {txt = Lident "H"}), "t" -> { type_decl with ptype_manifest = Some (core_type_of_desc (Ptyp_constr (loc_of_txt - (Longident.Ldot - (Lapply - (Ldot - (Lident "Stdcompat__hashtbl_ext", "MakeSeeded"), - Lident "H"), "t")), + (Interface_tools.ldot + (Interface_tools.lapply + (Interface_tools.ldot + (Lident "Stdcompat__hashtbl_ext") "MakeSeeded") + (Lident "H")) "t"), type_decl.ptype_params |> List.map fst))) } | _ -> (* @@ -717,7 +715,7 @@ let compat_type_declaration ~module_name when name = type_decl.ptype_name.txt -> None | Some { ptyp_desc = Parsetree.Ptyp_constr - ({ txt = Ldot (module_name', name) }, _) } + ({ txt = Ldot ({txt = module_name'}, { txt = name}) }, _) } when name = type_decl.ptype_name.txt && module_name = module_name' -> None | Some ( @@ -727,7 +725,7 @@ let compat_type_declaration ~module_name let ptyp_desc = Parsetree.Ptyp_constr ({ loc; - txt = Ldot (Lident "Stdcompat__init", "bytes") }, args) in + txt = Interface_tools.ldot (Lident "Stdcompat__init") "bytes" }, args) in Some { core_type with ptyp_desc } | Some ptype_manifest -> Some (compat_core_type ~module_name ptype_manifest) in @@ -783,7 +781,7 @@ let rec compat_signature_item ~module_name ~reference_version ~version { item with psig_desc = Psig_value value_desc} | Psig_module module_declaration -> let module_name = - Longident.Ldot (module_name, Option.get module_declaration.pmd_name.txt) in + Interface_tools.ldot module_name (Option.get module_declaration.pmd_name.txt) in let pmd_type = module_declaration.pmd_type |> compat_module_type ~module_name ~reference_version ~version in @@ -801,14 +799,14 @@ and compat_module_type ~module_name ~reference_version ~version (module_type : Parsetree.module_type) = match module_type.pmty_desc with | Pmty_ident - ({ txt = Ldot (Lident "Hashtbl", "SeededHashedType") } as longident) -> + ({ txt = Ldot ({txt = Lident "Hashtbl"}, {txt = "SeededHashedType"}) } as longident) -> let longident = { longident with txt = - if module_name = Ldot (Lident "Hashtbl", "MakeSeeded") then + if module_name = Interface_tools.ldot (Lident "Hashtbl") "MakeSeeded" then Longident.Lident "SeededHashedType" else - Longident.Ldot - (Lident "Stdcompat__hashtbl", "SeededHashedType") } in + Interface_tools.ldot + (Lident "Stdcompat__hashtbl") "SeededHashedType" } in { module_type with pmty_desc = Pmty_ident longident } | Pmty_signature signature -> let signature = @@ -822,7 +820,7 @@ and compat_module_type ~module_name ~reference_version ~version (compat_module_type ~module_name ~reference_version ~version) (Some arg) in let module_name = - Longident.Lapply (module_name, Lident (Option.get var.txt)) in + Interface_tools.lapply module_name (Lident (Option.get var.txt)) in let body = compat_module_type ~module_name ~reference_version ~version body in { module_type with pmty_desc = Pmty_functor (Named (var, Option.get arg), body) } @@ -973,7 +971,7 @@ let find_prim_opt version pval_name prim = let modules : Longident.t list = if Interface_tools.Version.compare version { major = 4; minor = 6; patch = 0 } >= 0 then - Ldot (Lident "Array", "Floatarray") :: modules + Interface_tools.ldot (Lident "Array") "Floatarray" :: modules else modules in modules |> List.find_map @@ @@ -1090,9 +1088,8 @@ let version_signature_item ~reference_version ~module_name ~signatures pmty_desc = Pmty_alias { loc = Location.none; txt = - Ldot - (module_name, - (Option.get module_declaration.pmd_name.txt)) }; + Interface_tools.ldot module_name + (Option.get module_declaration.pmd_name.txt) }; pmty_loc = Location.none; pmty_attributes = [] }} else @@ -1301,25 +1298,27 @@ let rec format_default_item ~module_name formatter match item.psig_desc with | Psig_type (rec_flag, [{ ptype_name = { txt = "result" }} as type_decl]) -> let ptyp_desc = Parsetree.Ptyp_constr ( - { txt = Ldot (Lident "Result", "result"); loc = Location.none }, + { txt = Interface_tools.ldot (Lident "Result") "result"; loc = Location.none }, [type_of_desc (Ptyp_var "a"); type_of_desc (Ptyp_var "b")]) in let manifest = type_of_desc ptyp_desc in let type_decl' = { type_decl with ptype_manifest = Some manifest } in - format_with_without "UCHAR_PKG" format_sig_type formatter - (rec_flag, [type_decl']) (rec_flag, [type_decl]) + (*format_with_without "UCHAR_PKG" format_sig_type formatter + (rec_flag, [type_decl']) (rec_flag, [type_decl])*) + format_sig_type formatter (rec_flag, [type_decl]) | Psig_type (rec_flag, [{ ptype_name = { txt = "t" }} as type_decl]) when module_name = Longident.Lident "Uchar" -> let ptyp_desc = Parsetree.Ptyp_constr ( - { txt = Ldot (Lident "Uchar", "t"); loc = Location.none }, + { txt = Interface_tools.ldot (Lident "Uchar") "t"; loc = Location.none }, []) in let manifest = type_of_desc ptyp_desc in let type_decl' = { type_decl with ptype_manifest = Some manifest } in - format_with_without "UCHAR_PKG" format_sig_type formatter - (rec_flag, [type_decl']) (rec_flag, [type_decl]) + (*format_with_without "UCHAR_PKG" format_sig_type formatter + (rec_flag, [type_decl']) (rec_flag, [type_decl])*) + format_sig_type formatter (rec_flag, [type_decl]) | Psig_type (rec_flag, [{ ptype_name = { txt = "t" }} as type_decl]) when module_name = Longident.Lident "Either" -> let ptyp_desc = Parsetree.Ptyp_constr ( - { txt = Ldot (Lident "Stdcompat__init", "either"); loc = Location.none }, + { txt = Interface_tools.ldot (Lident "Stdcompat__init") "either"; loc = Location.none }, List.map fst type_decl.ptype_params) in let manifest = type_of_desc ptyp_desc in let type_decl = { type_decl with ptype_manifest = Some manifest } in @@ -1457,15 +1456,15 @@ let add_self_type_manifest_to_type_decl ~(module_name : Longident.t) | None -> let module_name : Longident.t = match module_name with - | Lapply (Ldot (Lident "Hashtbl", "MakeSeeded"), Lident "H") -> - Lapply (Ldot (Lident "Stdcompat__hashtbl_ext", "MakeSeeded"), - Lident "H") + | Lapply ({txt = Ldot ({txt = Lident "Hashtbl"}, { txt = "MakeSeeded" })}, {txt = Lident "H"}) -> + Interface_tools.lapply (Interface_tools.ldot (Lident "Stdcompat__hashtbl_ext") "MakeSeeded") + (Lident "H") | _ -> module_name in { type_decl with ptype_manifest = let params = type_decl.ptype_params |> List.map fst in Some (Ast_helper.Typ.constr ({ loc = Location.none; txt = - Ldot (module_name, type_decl.ptype_name.txt) }) params)} + Interface_tools.ldot module_name type_decl.ptype_name.txt }) params)} | Some manifest -> type_decl let rec add_self_type_manifest ~module_name (item : Parsetree.signature_item) = @@ -1477,7 +1476,7 @@ let rec add_self_type_manifest ~module_name (item : Parsetree.signature_item) = | Psig_value _ | Psig_modtype _ | Psig_exception _ -> item | Psig_module module_declaration -> let module_name : Longident.t = - Ldot (module_name, Option.get module_declaration.pmd_name.txt) in + Interface_tools.ldot module_name (Option.get module_declaration.pmd_name.txt) in { item with psig_desc = Psig_module { module_declaration with pmd_type = module_declaration.pmd_type |> (add_self_type_manifest_to_module_type ~module_name) }} @@ -1500,7 +1499,7 @@ and add_self_type_manifest_to_module_type ~module_name (add_self_type_manifest_to_module_type ~module_name) in *) let module_name : Longident.t = - Lapply (module_name, Lident (Option.get var.txt)) in + Interface_tools.lapply module_name (Lident (Option.get var.txt)) in let body = body |> add_self_type_manifest_to_module_type ~module_name in { module_type with pmty_desc = Pmty_functor (Named (var, arg), body) } | Pmty_with (ty, cstr) -> @@ -1625,7 +1624,7 @@ let main _argv = "Option"; "Parsing"; "Printexc"; "Printf"; "Queue"; "Random"; "Result"; "Scanf"; "Seq"; "Set"; "Stack"; "StdLabels"; "String"; "StringLabels"; "Sys"; "Uchar"; "Weak"; "In_channel"; "Out_channel"; "Unit"] in - let versions = ["5.2"; "5.1"; "5.0"; "4.14"; "4.13"; "4.12"; "4.11"; "4.10"; "4.09"; "4.08"; "4.07"; "4.06"; "4.05"; "4.04"; "4.03"; "4.02"; "4.01"; "4.00"; "3.12"; "3.11"; "3.10"; "3.09"; "3.08"; "3.07"] in + let versions = ["5.5"; "5.4"; "5.3"; "5.2"; "5.1"; "5.0"; "4.14"; "4.13"; "4.12"; "4.11"; "4.10"; "4.09"; "4.08"; "4.07"; "4.06"; "4.05"; "4.04"; "4.03"; "4.02"; "4.01"; "4.00"; "3.12"; "3.11"; "3.10"; "3.09"; "3.08"; "3.07"] in List.iter (do_module versions) modules let () = diff --git a/tools/interface_tools.ml b/tools/interface_tools.ml index a061b4a..84daf1f 100644 --- a/tools/interface_tools.ml +++ b/tools/interface_tools.ml @@ -152,3 +152,15 @@ module String = struct let suffix_from s pos = sub s pos (length s - pos) end + +let with_default_loc value = + Location.mkloc value !Ast_helper.default_loc + +let loc_constant (value : Parsetree.constant_desc Location.loc) : Parsetree.constant = + { pconst_desc = value.txt; pconst_loc = value.loc } + +let ldot (m : Longident.t) (s : string) : Longident.t = + Ldot (with_default_loc m, with_default_loc s) + +let lapply (i : Longident.t) (j : Longident.t) : Longident.t = + Lapply (with_default_loc i, with_default_loc j) diff --git a/tools/interface_tools.mli b/tools/interface_tools.mli index 4d87f31..92bbafd 100644 --- a/tools/interface_tools.mli +++ b/tools/interface_tools.mli @@ -78,3 +78,11 @@ module String : sig val suffix_from : string -> int -> string end + +val with_default_loc : 'a -> 'a Location.loc + +val loc_constant : Parsetree.constant_desc Location.loc -> Parsetree.constant + +val ldot : Longident.t -> string -> Longident.t + +val lapply : Longident.t -> Longident.t -> Longident.t From 4377f67b4fe13e52616f7b9a3db5ff13b39b55cc Mon Sep 17 00:00:00 2001 From: Thierry Martinez Date: Wed, 12 Aug 2026 12:58:43 +0200 Subject: [PATCH 2/4] Add extracted interfaces from OCaml 5.3, 5.4, and 5.5 --- interfaces/5.3/arg.mli | 44 ++++ interfaces/5.3/array.mli | 60 +++++ interfaces/5.3/arrayLabels.mli | 63 ++++++ interfaces/5.3/atomic.mli | 10 + interfaces/5.3/bool.mli | 13 ++ interfaces/5.3/buffer.mli | 41 ++++ interfaces/5.3/bytes.mli | 101 +++++++++ interfaces/5.3/bytesLabels.mli | 104 +++++++++ interfaces/5.3/callback.mli | 2 + interfaces/5.3/char.mli | 11 + interfaces/5.3/complex.mli | 21 ++ interfaces/5.3/digest.mli | 35 +++ interfaces/5.3/domain.mli | 19 ++ interfaces/5.3/either.mli | 22 ++ interfaces/5.3/ephemeron.mli | 240 ++++++++++++++++++++ interfaces/5.3/filename.mli | 28 +++ interfaces/5.3/float.mli | 227 +++++++++++++++++++ interfaces/5.3/format.mli | 217 ++++++++++++++++++ interfaces/5.3/fun.mli | 7 + interfaces/5.3/gc.mli | 83 +++++++ interfaces/5.3/hashtbl.mli | 150 +++++++++++++ interfaces/5.3/in_channel.mli | 43 ++++ interfaces/5.3/int32.mli | 49 ++++ interfaces/5.3/int64.mli | 53 +++++ interfaces/5.3/lazy.mli | 9 + interfaces/5.3/lexing.mli | 54 +++++ interfaces/5.3/list.mli | 76 +++++++ interfaces/5.3/listLabels.mli | 76 +++++++ interfaces/5.3/map.mli | 100 +++++++++ interfaces/5.3/marshal.mli | 16 ++ interfaces/5.3/moreLabels.mli | 372 ++++++++++++++++++++++++++++++ interfaces/5.3/nativeint.mli | 47 ++++ interfaces/5.3/obj.mli | 66 ++++++ interfaces/5.3/oo.mli | 4 + interfaces/5.3/option.mli | 19 ++ interfaces/5.3/out_channel.mli | 41 ++++ interfaces/5.3/parsing.mli | 36 +++ interfaces/5.3/printexc.mli | 52 +++++ interfaces/5.3/printf.mli | 17 ++ interfaces/5.3/queue.mli | 22 ++ interfaces/5.3/random.mli | 46 ++++ interfaces/5.3/result.mli | 26 +++ interfaces/5.3/scanf.mli | 46 ++++ interfaces/5.3/seq.mli | 63 ++++++ interfaces/5.3/set.mli | 98 ++++++++ interfaces/5.3/stack.mli | 18 ++ interfaces/5.3/stdLabels.mli | 4 + interfaces/5.3/stdlib.mli | 327 +++++++++++++++++++++++++++ interfaces/5.3/string.mli | 71 ++++++ interfaces/5.3/stringLabels.mli | 72 ++++++ interfaces/5.3/sys.mli | 105 +++++++++ interfaces/5.3/uchar.mli | 27 +++ interfaces/5.3/unit.mli | 5 + interfaces/5.3/weak.mli | 46 ++++ interfaces/5.4/arg.mli | 44 ++++ interfaces/5.4/array.mli | 62 +++++ interfaces/5.4/arrayLabels.mli | 65 ++++++ interfaces/5.4/atomic.mli | 21 ++ interfaces/5.4/bool.mli | 16 ++ interfaces/5.4/buffer.mli | 41 ++++ interfaces/5.4/bytes.mli | 101 +++++++++ interfaces/5.4/bytesLabels.mli | 104 +++++++++ interfaces/5.4/callback.mli | 2 + interfaces/5.4/char.mli | 35 +++ interfaces/5.4/complex.mli | 21 ++ interfaces/5.4/digest.mli | 35 +++ interfaces/5.4/domain.mli | 19 ++ interfaces/5.4/either.mli | 25 +++ interfaces/5.4/ephemeron.mli | 240 ++++++++++++++++++++ interfaces/5.4/filename.mli | 28 +++ interfaces/5.4/float.mli | 231 +++++++++++++++++++ interfaces/5.4/format.mli | 222 ++++++++++++++++++ interfaces/5.4/fun.mli | 7 + interfaces/5.4/gc.mli | 90 ++++++++ interfaces/5.4/hashtbl.mli | 150 +++++++++++++ interfaces/5.4/in_channel.mli | 43 ++++ interfaces/5.4/int32.mli | 49 ++++ interfaces/5.4/int64.mli | 53 +++++ interfaces/5.4/lazy.mli | 9 + interfaces/5.4/lexing.mli | 54 +++++ interfaces/5.4/list.mli | 77 +++++++ interfaces/5.4/listLabels.mli | 77 +++++++ interfaces/5.4/map.mli | 100 +++++++++ interfaces/5.4/marshal.mli | 16 ++ interfaces/5.4/moreLabels.mli | 372 ++++++++++++++++++++++++++++++ interfaces/5.4/nativeint.mli | 47 ++++ interfaces/5.4/obj.mli | 66 ++++++ interfaces/5.4/oo.mli | 4 + interfaces/5.4/option.mli | 19 ++ interfaces/5.4/out_channel.mli | 41 ++++ interfaces/5.4/parsing.mli | 36 +++ interfaces/5.4/printexc.mli | 52 +++++ interfaces/5.4/printf.mli | 17 ++ interfaces/5.4/queue.mli | 22 ++ interfaces/5.4/random.mli | 46 ++++ interfaces/5.4/result.mli | 38 ++++ interfaces/5.4/scanf.mli | 46 ++++ interfaces/5.4/seq.mli | 65 ++++++ interfaces/5.4/set.mli | 98 ++++++++ interfaces/5.4/stack.mli | 18 ++ interfaces/5.4/stdLabels.mli | 4 + interfaces/5.4/stdlib.mli | 331 +++++++++++++++++++++++++++ interfaces/5.4/string.mli | 75 +++++++ interfaces/5.4/stringLabels.mli | 76 +++++++ interfaces/5.4/sys.mli | 113 ++++++++++ interfaces/5.4/uchar.mli | 29 +++ interfaces/5.4/unit.mli | 5 + interfaces/5.4/weak.mli | 46 ++++ interfaces/5.5/arg.mli | 44 ++++ interfaces/5.5/array.mli | 63 ++++++ interfaces/5.5/arrayLabels.mli | 67 ++++++ interfaces/5.5/atomic.mli | 21 ++ interfaces/5.5/bool.mli | 16 ++ interfaces/5.5/buffer.mli | 41 ++++ interfaces/5.5/bytes.mli | 101 +++++++++ interfaces/5.5/bytesLabels.mli | 104 +++++++++ interfaces/5.5/callback.mli | 2 + interfaces/5.5/char.mli | 35 +++ interfaces/5.5/complex.mli | 21 ++ interfaces/5.5/digest.mli | 35 +++ interfaces/5.5/domain.mli | 20 ++ interfaces/5.5/either.mli | 25 +++ interfaces/5.5/ephemeron.mli | 240 ++++++++++++++++++++ interfaces/5.5/filename.mli | 28 +++ interfaces/5.5/float.mli | 231 +++++++++++++++++++ interfaces/5.5/format.mli | 239 ++++++++++++++++++++ interfaces/5.5/fun.mli | 7 + interfaces/5.5/gc.mli | 98 ++++++++ interfaces/5.5/hashtbl.mli | 160 +++++++++++++ interfaces/5.5/in_channel.mli | 43 ++++ interfaces/5.5/int32.mli | 59 +++++ interfaces/5.5/int64.mli | 63 ++++++ interfaces/5.5/lazy.mli | 17 ++ interfaces/5.5/lexing.mli | 54 +++++ interfaces/5.5/list.mli | 79 +++++++ interfaces/5.5/listLabels.mli | 79 +++++++ interfaces/5.5/map.mli | 102 +++++++++ interfaces/5.5/marshal.mli | 16 ++ interfaces/5.5/moreLabels.mli | 386 ++++++++++++++++++++++++++++++++ interfaces/5.5/nativeint.mli | 57 +++++ interfaces/5.5/obj.mli | 66 ++++++ interfaces/5.5/oo.mli | 4 + interfaces/5.5/option.mli | 30 +++ interfaces/5.5/out_channel.mli | 41 ++++ interfaces/5.5/parsing.mli | 36 +++ interfaces/5.5/printexc.mli | 52 +++++ interfaces/5.5/printf.mli | 32 +++ interfaces/5.5/queue.mli | 22 ++ interfaces/5.5/random.mli | 46 ++++ interfaces/5.5/result.mli | 38 ++++ interfaces/5.5/scanf.mli | 46 ++++ interfaces/5.5/seq.mli | 66 ++++++ interfaces/5.5/set.mli | 100 +++++++++ interfaces/5.5/stack.mli | 18 ++ interfaces/5.5/stdLabels.mli | 4 + interfaces/5.5/stdlib.mli | 331 +++++++++++++++++++++++++++ interfaces/5.5/string.mli | 106 +++++++++ interfaces/5.5/stringLabels.mli | 109 +++++++++ interfaces/5.5/sys.mli | 114 ++++++++++ interfaces/5.5/uchar.mli | 29 +++ interfaces/5.5/unit.mli | 5 + interfaces/5.5/weak.mli | 46 ++++ 162 files changed, 11201 insertions(+) create mode 100644 interfaces/5.3/arg.mli create mode 100644 interfaces/5.3/array.mli create mode 100644 interfaces/5.3/arrayLabels.mli create mode 100644 interfaces/5.3/atomic.mli create mode 100644 interfaces/5.3/bool.mli create mode 100644 interfaces/5.3/buffer.mli create mode 100644 interfaces/5.3/bytes.mli create mode 100644 interfaces/5.3/bytesLabels.mli create mode 100644 interfaces/5.3/callback.mli create mode 100644 interfaces/5.3/char.mli create mode 100644 interfaces/5.3/complex.mli create mode 100644 interfaces/5.3/digest.mli create mode 100644 interfaces/5.3/domain.mli create mode 100644 interfaces/5.3/either.mli create mode 100644 interfaces/5.3/ephemeron.mli create mode 100644 interfaces/5.3/filename.mli create mode 100644 interfaces/5.3/float.mli create mode 100644 interfaces/5.3/format.mli create mode 100644 interfaces/5.3/fun.mli create mode 100644 interfaces/5.3/gc.mli create mode 100644 interfaces/5.3/hashtbl.mli create mode 100644 interfaces/5.3/in_channel.mli create mode 100644 interfaces/5.3/int32.mli create mode 100644 interfaces/5.3/int64.mli create mode 100644 interfaces/5.3/lazy.mli create mode 100644 interfaces/5.3/lexing.mli create mode 100644 interfaces/5.3/list.mli create mode 100644 interfaces/5.3/listLabels.mli create mode 100644 interfaces/5.3/map.mli create mode 100644 interfaces/5.3/marshal.mli create mode 100644 interfaces/5.3/moreLabels.mli create mode 100644 interfaces/5.3/nativeint.mli create mode 100644 interfaces/5.3/obj.mli create mode 100644 interfaces/5.3/oo.mli create mode 100644 interfaces/5.3/option.mli create mode 100644 interfaces/5.3/out_channel.mli create mode 100644 interfaces/5.3/parsing.mli create mode 100644 interfaces/5.3/printexc.mli create mode 100644 interfaces/5.3/printf.mli create mode 100644 interfaces/5.3/queue.mli create mode 100644 interfaces/5.3/random.mli create mode 100644 interfaces/5.3/result.mli create mode 100644 interfaces/5.3/scanf.mli create mode 100644 interfaces/5.3/seq.mli create mode 100644 interfaces/5.3/set.mli create mode 100644 interfaces/5.3/stack.mli create mode 100644 interfaces/5.3/stdLabels.mli create mode 100644 interfaces/5.3/stdlib.mli create mode 100644 interfaces/5.3/string.mli create mode 100644 interfaces/5.3/stringLabels.mli create mode 100644 interfaces/5.3/sys.mli create mode 100644 interfaces/5.3/uchar.mli create mode 100644 interfaces/5.3/unit.mli create mode 100644 interfaces/5.3/weak.mli create mode 100644 interfaces/5.4/arg.mli create mode 100644 interfaces/5.4/array.mli create mode 100644 interfaces/5.4/arrayLabels.mli create mode 100644 interfaces/5.4/atomic.mli create mode 100644 interfaces/5.4/bool.mli create mode 100644 interfaces/5.4/buffer.mli create mode 100644 interfaces/5.4/bytes.mli create mode 100644 interfaces/5.4/bytesLabels.mli create mode 100644 interfaces/5.4/callback.mli create mode 100644 interfaces/5.4/char.mli create mode 100644 interfaces/5.4/complex.mli create mode 100644 interfaces/5.4/digest.mli create mode 100644 interfaces/5.4/domain.mli create mode 100644 interfaces/5.4/either.mli create mode 100644 interfaces/5.4/ephemeron.mli create mode 100644 interfaces/5.4/filename.mli create mode 100644 interfaces/5.4/float.mli create mode 100644 interfaces/5.4/format.mli create mode 100644 interfaces/5.4/fun.mli create mode 100644 interfaces/5.4/gc.mli create mode 100644 interfaces/5.4/hashtbl.mli create mode 100644 interfaces/5.4/in_channel.mli create mode 100644 interfaces/5.4/int32.mli create mode 100644 interfaces/5.4/int64.mli create mode 100644 interfaces/5.4/lazy.mli create mode 100644 interfaces/5.4/lexing.mli create mode 100644 interfaces/5.4/list.mli create mode 100644 interfaces/5.4/listLabels.mli create mode 100644 interfaces/5.4/map.mli create mode 100644 interfaces/5.4/marshal.mli create mode 100644 interfaces/5.4/moreLabels.mli create mode 100644 interfaces/5.4/nativeint.mli create mode 100644 interfaces/5.4/obj.mli create mode 100644 interfaces/5.4/oo.mli create mode 100644 interfaces/5.4/option.mli create mode 100644 interfaces/5.4/out_channel.mli create mode 100644 interfaces/5.4/parsing.mli create mode 100644 interfaces/5.4/printexc.mli create mode 100644 interfaces/5.4/printf.mli create mode 100644 interfaces/5.4/queue.mli create mode 100644 interfaces/5.4/random.mli create mode 100644 interfaces/5.4/result.mli create mode 100644 interfaces/5.4/scanf.mli create mode 100644 interfaces/5.4/seq.mli create mode 100644 interfaces/5.4/set.mli create mode 100644 interfaces/5.4/stack.mli create mode 100644 interfaces/5.4/stdLabels.mli create mode 100644 interfaces/5.4/stdlib.mli create mode 100644 interfaces/5.4/string.mli create mode 100644 interfaces/5.4/stringLabels.mli create mode 100644 interfaces/5.4/sys.mli create mode 100644 interfaces/5.4/uchar.mli create mode 100644 interfaces/5.4/unit.mli create mode 100644 interfaces/5.4/weak.mli create mode 100644 interfaces/5.5/arg.mli create mode 100644 interfaces/5.5/array.mli create mode 100644 interfaces/5.5/arrayLabels.mli create mode 100644 interfaces/5.5/atomic.mli create mode 100644 interfaces/5.5/bool.mli create mode 100644 interfaces/5.5/buffer.mli create mode 100644 interfaces/5.5/bytes.mli create mode 100644 interfaces/5.5/bytesLabels.mli create mode 100644 interfaces/5.5/callback.mli create mode 100644 interfaces/5.5/char.mli create mode 100644 interfaces/5.5/complex.mli create mode 100644 interfaces/5.5/digest.mli create mode 100644 interfaces/5.5/domain.mli create mode 100644 interfaces/5.5/either.mli create mode 100644 interfaces/5.5/ephemeron.mli create mode 100644 interfaces/5.5/filename.mli create mode 100644 interfaces/5.5/float.mli create mode 100644 interfaces/5.5/format.mli create mode 100644 interfaces/5.5/fun.mli create mode 100644 interfaces/5.5/gc.mli create mode 100644 interfaces/5.5/hashtbl.mli create mode 100644 interfaces/5.5/in_channel.mli create mode 100644 interfaces/5.5/int32.mli create mode 100644 interfaces/5.5/int64.mli create mode 100644 interfaces/5.5/lazy.mli create mode 100644 interfaces/5.5/lexing.mli create mode 100644 interfaces/5.5/list.mli create mode 100644 interfaces/5.5/listLabels.mli create mode 100644 interfaces/5.5/map.mli create mode 100644 interfaces/5.5/marshal.mli create mode 100644 interfaces/5.5/moreLabels.mli create mode 100644 interfaces/5.5/nativeint.mli create mode 100644 interfaces/5.5/obj.mli create mode 100644 interfaces/5.5/oo.mli create mode 100644 interfaces/5.5/option.mli create mode 100644 interfaces/5.5/out_channel.mli create mode 100644 interfaces/5.5/parsing.mli create mode 100644 interfaces/5.5/printexc.mli create mode 100644 interfaces/5.5/printf.mli create mode 100644 interfaces/5.5/queue.mli create mode 100644 interfaces/5.5/random.mli create mode 100644 interfaces/5.5/result.mli create mode 100644 interfaces/5.5/scanf.mli create mode 100644 interfaces/5.5/seq.mli create mode 100644 interfaces/5.5/set.mli create mode 100644 interfaces/5.5/stack.mli create mode 100644 interfaces/5.5/stdLabels.mli create mode 100644 interfaces/5.5/stdlib.mli create mode 100644 interfaces/5.5/string.mli create mode 100644 interfaces/5.5/stringLabels.mli create mode 100644 interfaces/5.5/sys.mli create mode 100644 interfaces/5.5/uchar.mli create mode 100644 interfaces/5.5/unit.mli create mode 100644 interfaces/5.5/weak.mli diff --git a/interfaces/5.3/arg.mli b/interfaces/5.3/arg.mli new file mode 100644 index 0000000..60f0886 --- /dev/null +++ b/interfaces/5.3/arg.mli @@ -0,0 +1,44 @@ +type spec = + | Unit of (unit -> unit) + | Bool of (bool -> unit) + | Set of bool ref + | Clear of bool ref + | String of (string -> unit) + | Set_string of string ref + | Int of (int -> unit) + | Set_int of int ref + | Float of (float -> unit) + | Set_float of float ref + | Tuple of spec list + | Symbol of string list * (string -> unit) + | Rest of (string -> unit) + | Rest_all of (string list -> unit) + | Expand of (string -> string array) +type key = string +type doc = string +type usage_msg = string +type anon_fun = string -> unit +val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit +val parse_dynamic : + (key * spec * doc) list ref -> anon_fun -> usage_msg -> unit +val parse_argv : + ?current:int ref -> + string array -> (key * spec * doc) list -> anon_fun -> usage_msg -> unit +val parse_argv_dynamic : + ?current:int ref -> + string array -> (key * spec * doc) list ref -> anon_fun -> string -> unit +val parse_and_expand_argv_dynamic : + int ref -> + string array ref -> + (key * spec * doc) list ref -> anon_fun -> string -> unit +val parse_expand : (key * spec * doc) list -> anon_fun -> usage_msg -> unit +exception Help of string +exception Bad of string +val usage : (key * spec * doc) list -> usage_msg -> unit +val usage_string : (key * spec * doc) list -> usage_msg -> string +val align : ?limit:int -> (key * spec * doc) list -> (key * spec * doc) list +val current : int ref +val read_arg : string -> string array +val read_arg0 : string -> string array +val write_arg : string -> string array -> unit +val write_arg0 : string -> string array -> unit diff --git a/interfaces/5.3/array.mli b/interfaces/5.3/array.mli new file mode 100644 index 0000000..224e257 --- /dev/null +++ b/interfaces/5.3/array.mli @@ -0,0 +1,60 @@ +type 'a t = 'a array +external length : 'a array -> int = "%array_length" +external get : 'a array -> int -> 'a = "%array_safe_get" +external set : 'a array -> int -> 'a -> unit = "%array_safe_set" +external make : int -> 'a -> 'a array = "caml_array_make" +external create_float : int -> float array = "caml_array_create_float" +val init : int -> (int -> 'a) -> 'a array +val make_matrix : int -> int -> 'a -> 'a array array +val init_matrix : int -> int -> (int -> int -> 'a) -> 'a array array +val append : 'a array -> 'a array -> 'a array +val concat : 'a array list -> 'a array +val sub : 'a array -> int -> int -> 'a array +val copy : 'a array -> 'a array +val fill : 'a array -> int -> int -> 'a -> unit +val blit : 'a array -> int -> 'a array -> int -> int -> unit +val to_list : 'a array -> 'a list +val of_list : 'a list -> 'a array +val iter : ('a -> unit) -> 'a array -> unit +val iteri : (int -> 'a -> unit) -> 'a array -> unit +val map : ('a -> 'b) -> 'a array -> 'b array +val map_inplace : ('a -> 'a) -> 'a array -> unit +val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array +val mapi_inplace : (int -> 'a -> 'a) -> 'a array -> unit +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a array -> 'acc +val fold_left_map : + ('acc -> 'a -> ('acc * 'b)) -> 'acc -> 'a array -> ('acc * 'b array) +val fold_right : ('a -> 'acc -> 'acc) -> 'a array -> 'acc -> 'acc +val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit +val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array +val for_all : ('a -> bool) -> 'a array -> bool +val exists : ('a -> bool) -> 'a array -> bool +val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val mem : 'a -> 'a array -> bool +val memq : 'a -> 'a array -> bool +val find_opt : ('a -> bool) -> 'a array -> 'a option +val find_index : ('a -> bool) -> 'a array -> int option +val find_map : ('a -> 'b option) -> 'a array -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a array -> 'b option +val split : ('a * 'b) array -> ('a array * 'b array) +val combine : 'a array -> 'b array -> ('a * 'b) array +val sort : ('a -> 'a -> int) -> 'a array -> unit +val stable_sort : ('a -> 'a -> int) -> 'a array -> unit +val fast_sort : ('a -> 'a -> int) -> 'a array -> unit +val shuffle : rand:(int -> int) -> 'a array -> unit +val to_seq : 'a array -> 'a Seq.t +val to_seqi : 'a array -> (int * 'a) Seq.t +val of_seq : 'a Seq.t -> 'a array +external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" +external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" +module Floatarray : +sig + external create : int -> floatarray = "caml_floatarray_create" + external length : floatarray -> int = "%floatarray_length" + external get : floatarray -> int -> float = "%floatarray_safe_get" + external set : floatarray -> int -> float -> unit = "%floatarray_safe_set" + external unsafe_get : floatarray -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : + floatarray -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.3/arrayLabels.mli b/interfaces/5.3/arrayLabels.mli new file mode 100644 index 0000000..9b397a5 --- /dev/null +++ b/interfaces/5.3/arrayLabels.mli @@ -0,0 +1,63 @@ +type 'a t = 'a array +external length : 'a array -> int = "%array_length" +external get : 'a array -> int -> 'a = "%array_safe_get" +external set : 'a array -> int -> 'a -> unit = "%array_safe_set" +external make : int -> 'a -> 'a array = "caml_array_make" +external create_float : int -> float array = "caml_array_create_float" +val init : int -> f:(int -> 'a) -> 'a array +val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array +val init_matrix : + dimx:int -> dimy:int -> f:(int -> int -> 'a) -> 'a array array +val append : 'a array -> 'a array -> 'a array +val concat : 'a array list -> 'a array +val sub : 'a array -> pos:int -> len:int -> 'a array +val copy : 'a array -> 'a array +val fill : 'a array -> pos:int -> len:int -> 'a -> unit +val blit : + src:'a array -> + src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> unit +val to_list : 'a array -> 'a list +val of_list : 'a list -> 'a array +val iter : f:('a -> unit) -> 'a array -> unit +val iteri : f:(int -> 'a -> unit) -> 'a array -> unit +val map : f:('a -> 'b) -> 'a array -> 'b array +val map_inplace : f:('a -> 'a) -> 'a array -> unit +val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array +val mapi_inplace : f:(int -> 'a -> 'a) -> 'a array -> unit +val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a array -> 'acc +val fold_left_map : + f:('acc -> 'a -> ('acc * 'b)) -> init:'acc -> 'a array -> ('acc * 'b array) +val fold_right : f:('a -> 'acc -> 'acc) -> 'a array -> init:'acc -> 'acc +val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit +val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array +val for_all : f:('a -> bool) -> 'a array -> bool +val exists : f:('a -> bool) -> 'a array -> bool +val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val mem : 'a -> set:'a array -> bool +val memq : 'a -> set:'a array -> bool +val find_opt : f:('a -> bool) -> 'a array -> 'a option +val find_index : f:('a -> bool) -> 'a array -> int option +val find_map : f:('a -> 'b option) -> 'a array -> 'b option +val find_mapi : f:(int -> 'a -> 'b option) -> 'a array -> 'b option +val split : ('a * 'b) array -> ('a array * 'b array) +val combine : 'a array -> 'b array -> ('a * 'b) array +val sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val shuffle : rand:(int -> int) -> 'a array -> unit +val to_seq : 'a array -> 'a Seq.t +val to_seqi : 'a array -> (int * 'a) Seq.t +val of_seq : 'a Seq.t -> 'a array +external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" +external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" +module Floatarray : +sig + external create : int -> floatarray = "caml_floatarray_create" + external length : floatarray -> int = "%floatarray_length" + external get : floatarray -> int -> float = "%floatarray_safe_get" + external set : floatarray -> int -> float -> unit = "%floatarray_safe_set" + external unsafe_get : floatarray -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : + floatarray -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.3/atomic.mli b/interfaces/5.3/atomic.mli new file mode 100644 index 0000000..8bc7a84 --- /dev/null +++ b/interfaces/5.3/atomic.mli @@ -0,0 +1,10 @@ +type !'a t +val make : 'a -> 'a t +val make_contended : 'a -> 'a t +val get : 'a t -> 'a +val set : 'a t -> 'a -> unit +val exchange : 'a t -> 'a -> 'a +val compare_and_set : 'a t -> 'a -> 'a -> bool +val fetch_and_add : int t -> int -> int +val incr : int t -> unit +val decr : int t -> unit diff --git a/interfaces/5.3/bool.mli b/interfaces/5.3/bool.mli new file mode 100644 index 0000000..7b103fe --- /dev/null +++ b/interfaces/5.3/bool.mli @@ -0,0 +1,13 @@ +type t = bool = + | false + | true +val not : bool -> bool +external (&&) : bool -> bool -> bool = "%sequand" +external (||) : bool -> bool -> bool = "%sequor" +val equal : bool -> bool -> bool +val compare : bool -> bool -> int +val to_int : bool -> int +val to_float : bool -> float +val to_string : bool -> string +val seeded_hash : int -> bool -> int +val hash : bool -> int diff --git a/interfaces/5.3/buffer.mli b/interfaces/5.3/buffer.mli new file mode 100644 index 0000000..939ff6b --- /dev/null +++ b/interfaces/5.3/buffer.mli @@ -0,0 +1,41 @@ +type t +val create : int -> t +val contents : t -> string +val to_bytes : t -> bytes +val sub : t -> int -> int -> string +val blit : t -> int -> bytes -> int -> int -> unit +val nth : t -> int -> char +val length : t -> int +val clear : t -> unit +val reset : t -> unit +val output_buffer : out_channel -> t -> unit +val truncate : t -> int -> unit +val add_char : t -> char -> unit +val add_utf_8_uchar : t -> Uchar.t -> unit +val add_utf_16le_uchar : t -> Uchar.t -> unit +val add_utf_16be_uchar : t -> Uchar.t -> unit +val add_string : t -> string -> unit +val add_bytes : t -> bytes -> unit +val add_substring : t -> string -> int -> int -> unit +val add_subbytes : t -> bytes -> int -> int -> unit +val add_substitute : t -> (string -> string) -> string -> unit +val add_buffer : t -> t -> unit +val add_channel : t -> in_channel -> int -> unit +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val add_seq : t -> char Seq.t -> unit +val of_seq : char Seq.t -> t +val add_uint8 : t -> int -> unit +val add_int8 : t -> int -> unit +val add_uint16_ne : t -> int -> unit +val add_uint16_be : t -> int -> unit +val add_uint16_le : t -> int -> unit +val add_int16_ne : t -> int -> unit +val add_int16_be : t -> int -> unit +val add_int16_le : t -> int -> unit +val add_int32_ne : t -> int32 -> unit +val add_int32_be : t -> int32 -> unit +val add_int32_le : t -> int32 -> unit +val add_int64_ne : t -> int64 -> unit +val add_int64_be : t -> int64 -> unit +val add_int64_le : t -> int64 -> unit diff --git a/interfaces/5.3/bytes.mli b/interfaces/5.3/bytes.mli new file mode 100644 index 0000000..35ce14a --- /dev/null +++ b/interfaces/5.3/bytes.mli @@ -0,0 +1,101 @@ +external length : bytes -> int = "%bytes_length" +external get : bytes -> int -> char = "%bytes_safe_get" +external set : bytes -> int -> char -> unit = "%bytes_safe_set" +external create : int -> bytes = "caml_create_bytes" +val make : int -> char -> bytes +val init : int -> (int -> char) -> bytes +val empty : bytes +val copy : bytes -> bytes +val of_string : string -> bytes +val to_string : bytes -> string +val sub : bytes -> int -> int -> bytes +val sub_string : bytes -> int -> int -> string +val extend : bytes -> int -> int -> bytes +val fill : bytes -> int -> int -> char -> unit +val blit : bytes -> int -> bytes -> int -> int -> unit +val blit_string : string -> int -> bytes -> int -> int -> unit +val concat : bytes -> bytes list -> bytes +val cat : bytes -> bytes -> bytes +val iter : (char -> unit) -> bytes -> unit +val iteri : (int -> char -> unit) -> bytes -> unit +val map : (char -> char) -> bytes -> bytes +val mapi : (int -> char -> char) -> bytes -> bytes +val fold_left : ('acc -> char -> 'acc) -> 'acc -> bytes -> 'acc +val fold_right : (char -> 'acc -> 'acc) -> bytes -> 'acc -> 'acc +val for_all : (char -> bool) -> bytes -> bool +val exists : (char -> bool) -> bytes -> bool +val trim : bytes -> bytes +val escaped : bytes -> bytes +val index : bytes -> char -> int +val index_opt : bytes -> char -> int option +val rindex : bytes -> char -> int +val rindex_opt : bytes -> char -> int option +val index_from : bytes -> int -> char -> int +val index_from_opt : bytes -> int -> char -> int option +val rindex_from : bytes -> int -> char -> int +val rindex_from_opt : bytes -> int -> char -> int option +val contains : bytes -> char -> bool +val contains_from : bytes -> int -> char -> bool +val rcontains_from : bytes -> int -> char -> bool +val uppercase_ascii : bytes -> bytes +val lowercase_ascii : bytes -> bytes +val capitalize_ascii : bytes -> bytes +val uncapitalize_ascii : bytes -> bytes +type t = bytes +val compare : t -> t -> int +val equal : t -> t -> bool +val starts_with : prefix:bytes -> bytes -> bool +val ends_with : suffix:bytes -> bytes -> bool +val unsafe_to_string : bytes -> string +val unsafe_of_string : string -> bytes +val split_on_char : char -> bytes -> bytes list +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val set_utf_8_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val set_utf_16be_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val set_utf_16le_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16le : t -> bool +val get_uint8 : bytes -> int -> int +val get_int8 : bytes -> int -> int +val get_uint16_ne : bytes -> int -> int +val get_uint16_be : bytes -> int -> int +val get_uint16_le : bytes -> int -> int +val get_int16_ne : bytes -> int -> int +val get_int16_be : bytes -> int -> int +val get_int16_le : bytes -> int -> int +val get_int32_ne : bytes -> int -> int32 +val get_int32_be : bytes -> int -> int32 +val get_int32_le : bytes -> int -> int32 +val get_int64_ne : bytes -> int -> int64 +val get_int64_be : bytes -> int -> int64 +val get_int64_le : bytes -> int -> int64 +val set_uint8 : bytes -> int -> int -> unit +val set_int8 : bytes -> int -> int -> unit +val set_uint16_ne : bytes -> int -> int -> unit +val set_uint16_be : bytes -> int -> int -> unit +val set_uint16_le : bytes -> int -> int -> unit +val set_int16_ne : bytes -> int -> int -> unit +val set_int16_be : bytes -> int -> int -> unit +val set_int16_le : bytes -> int -> int -> unit +val set_int32_ne : bytes -> int -> int32 -> unit +val set_int32_be : bytes -> int -> int32 -> unit +val set_int32_le : bytes -> int -> int32 -> unit +val set_int64_ne : bytes -> int -> int64 -> unit +val set_int64_be : bytes -> int -> int64 -> unit +val set_int64_le : bytes -> int -> int64 -> unit +external unsafe_get : bytes -> int -> char = "%bytes_unsafe_get" +external unsafe_set : bytes -> int -> char -> unit = "%bytes_unsafe_set" +external unsafe_blit : + bytes -> int -> bytes -> int -> int -> unit = "caml_blit_bytes"[@@noalloc ] +external unsafe_blit_string : + string -> int -> bytes -> int -> int -> unit = "caml_blit_string"[@@noalloc + ] +external unsafe_fill : + bytes -> int -> int -> char -> unit = "caml_fill_bytes"[@@noalloc ] +val unsafe_escape : bytes -> bytes diff --git a/interfaces/5.3/bytesLabels.mli b/interfaces/5.3/bytesLabels.mli new file mode 100644 index 0000000..5d01ea1 --- /dev/null +++ b/interfaces/5.3/bytesLabels.mli @@ -0,0 +1,104 @@ +external length : bytes -> int = "%bytes_length" +external get : bytes -> int -> char = "%bytes_safe_get" +external set : bytes -> int -> char -> unit = "%bytes_safe_set" +external create : int -> bytes = "caml_create_bytes" +val make : int -> char -> bytes +val init : int -> f:(int -> char) -> bytes +val empty : bytes +val copy : bytes -> bytes +val of_string : string -> bytes +val to_string : bytes -> string +val sub : bytes -> pos:int -> len:int -> bytes +val sub_string : bytes -> pos:int -> len:int -> string +val extend : bytes -> left:int -> right:int -> bytes +val fill : bytes -> pos:int -> len:int -> char -> unit +val blit : + src:bytes -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val blit_string : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val concat : sep:bytes -> bytes list -> bytes +val cat : bytes -> bytes -> bytes +val iter : f:(char -> unit) -> bytes -> unit +val iteri : f:(int -> char -> unit) -> bytes -> unit +val map : f:(char -> char) -> bytes -> bytes +val mapi : f:(int -> char -> char) -> bytes -> bytes +val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> bytes -> 'acc +val fold_right : f:(char -> 'acc -> 'acc) -> bytes -> init:'acc -> 'acc +val for_all : f:(char -> bool) -> bytes -> bool +val exists : f:(char -> bool) -> bytes -> bool +val trim : bytes -> bytes +val escaped : bytes -> bytes +val index : bytes -> char -> int +val index_opt : bytes -> char -> int option +val rindex : bytes -> char -> int +val rindex_opt : bytes -> char -> int option +val index_from : bytes -> int -> char -> int +val index_from_opt : bytes -> int -> char -> int option +val rindex_from : bytes -> int -> char -> int +val rindex_from_opt : bytes -> int -> char -> int option +val contains : bytes -> char -> bool +val contains_from : bytes -> int -> char -> bool +val rcontains_from : bytes -> int -> char -> bool +val uppercase_ascii : bytes -> bytes +val lowercase_ascii : bytes -> bytes +val capitalize_ascii : bytes -> bytes +val uncapitalize_ascii : bytes -> bytes +type t = bytes +val compare : t -> t -> int +val equal : t -> t -> bool +val starts_with : prefix:bytes -> bytes -> bool +val ends_with : suffix:bytes -> bytes -> bool +val unsafe_to_string : bytes -> string +val unsafe_of_string : string -> bytes +val split_on_char : sep:char -> bytes -> bytes list +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val set_utf_8_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val set_utf_16be_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val set_utf_16le_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16le : t -> bool +val get_uint8 : bytes -> int -> int +val get_int8 : bytes -> int -> int +val get_uint16_ne : bytes -> int -> int +val get_uint16_be : bytes -> int -> int +val get_uint16_le : bytes -> int -> int +val get_int16_ne : bytes -> int -> int +val get_int16_be : bytes -> int -> int +val get_int16_le : bytes -> int -> int +val get_int32_ne : bytes -> int -> int32 +val get_int32_be : bytes -> int -> int32 +val get_int32_le : bytes -> int -> int32 +val get_int64_ne : bytes -> int -> int64 +val get_int64_be : bytes -> int -> int64 +val get_int64_le : bytes -> int -> int64 +val set_uint8 : bytes -> int -> int -> unit +val set_int8 : bytes -> int -> int -> unit +val set_uint16_ne : bytes -> int -> int -> unit +val set_uint16_be : bytes -> int -> int -> unit +val set_uint16_le : bytes -> int -> int -> unit +val set_int16_ne : bytes -> int -> int -> unit +val set_int16_be : bytes -> int -> int -> unit +val set_int16_le : bytes -> int -> int -> unit +val set_int32_ne : bytes -> int -> int32 -> unit +val set_int32_be : bytes -> int -> int32 -> unit +val set_int32_le : bytes -> int -> int32 -> unit +val set_int64_ne : bytes -> int -> int64 -> unit +val set_int64_be : bytes -> int -> int64 -> unit +val set_int64_le : bytes -> int -> int64 -> unit +external unsafe_get : bytes -> int -> char = "%bytes_unsafe_get" +external unsafe_set : bytes -> int -> char -> unit = "%bytes_unsafe_set" +external unsafe_blit : + src:bytes -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_bytes"[@@noalloc ] +external unsafe_blit_string : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_string"[@@noalloc ] +external unsafe_fill : + bytes -> pos:int -> len:int -> char -> unit = "caml_fill_bytes"[@@noalloc ] +val unsafe_escape : bytes -> bytes diff --git a/interfaces/5.3/callback.mli b/interfaces/5.3/callback.mli new file mode 100644 index 0000000..d825854 --- /dev/null +++ b/interfaces/5.3/callback.mli @@ -0,0 +1,2 @@ +val register : string -> 'a -> unit +val register_exception : string -> exn -> unit diff --git a/interfaces/5.3/char.mli b/interfaces/5.3/char.mli new file mode 100644 index 0000000..f19aac9 --- /dev/null +++ b/interfaces/5.3/char.mli @@ -0,0 +1,11 @@ +external code : char -> int = "%identity" +val chr : int -> char +val escaped : char -> string +val lowercase_ascii : char -> char +val uppercase_ascii : char -> char +type t = char +val compare : t -> t -> int +val equal : t -> t -> bool +val seeded_hash : int -> t -> int +val hash : t -> int +external unsafe_chr : int -> char = "%identity" diff --git a/interfaces/5.3/complex.mli b/interfaces/5.3/complex.mli new file mode 100644 index 0000000..f3275a5 --- /dev/null +++ b/interfaces/5.3/complex.mli @@ -0,0 +1,21 @@ +type t = { + re: float ; + im: float } +val zero : t +val one : t +val i : t +val neg : t -> t +val conj : t -> t +val add : t -> t -> t +val sub : t -> t -> t +val mul : t -> t -> t +val inv : t -> t +val div : t -> t -> t +val sqrt : t -> t +val norm2 : t -> float +val norm : t -> float +val arg : t -> float +val polar : float -> float -> t +val exp : t -> t +val log : t -> t +val pow : t -> t -> t diff --git a/interfaces/5.3/digest.mli b/interfaces/5.3/digest.mli new file mode 100644 index 0000000..b3fe1aa --- /dev/null +++ b/interfaces/5.3/digest.mli @@ -0,0 +1,35 @@ +type t = string +val compare : t -> t -> int +val equal : t -> t -> bool +val string : string -> t +val bytes : bytes -> t +val substring : string -> int -> int -> t +val subbytes : bytes -> int -> int -> t +val channel : in_channel -> int -> t +val file : string -> t +val output : out_channel -> t -> unit +val input : in_channel -> t +val to_hex : t -> string +val of_hex : string -> t +val from_hex : string -> t +module type S = + sig + type t = string + val hash_length : int + val compare : t -> t -> int + val equal : t -> t -> bool + val string : string -> t + val bytes : bytes -> t + val substring : string -> int -> int -> t + val subbytes : bytes -> int -> int -> t + val channel : in_channel -> int -> t + val file : string -> t + val output : out_channel -> t -> unit + val input : in_channel -> t + val to_hex : t -> string + val of_hex : string -> t + end +module BLAKE128 : S +module BLAKE256 : S +module BLAKE512 : S +module MD5 : S diff --git a/interfaces/5.3/domain.mli b/interfaces/5.3/domain.mli new file mode 100644 index 0000000..a3d29a6 --- /dev/null +++ b/interfaces/5.3/domain.mli @@ -0,0 +1,19 @@ +type !'a t +val spawn : (unit -> 'a) -> 'a t +val join : 'a t -> 'a +type id = private int +val get_id : 'a t -> id +val self : unit -> id +val before_first_spawn : (unit -> unit) -> unit +val at_exit : (unit -> unit) -> unit +val cpu_relax : unit -> unit +val is_main_domain : unit -> bool +val recommended_domain_count : unit -> int +val self_index : unit -> int +module DLS : +sig + type 'a key + val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key + val get : 'a key -> 'a + val set : 'a key -> 'a -> unit +end diff --git a/interfaces/5.3/either.mli b/interfaces/5.3/either.mli new file mode 100644 index 0000000..14f1099 --- /dev/null +++ b/interfaces/5.3/either.mli @@ -0,0 +1,22 @@ +type ('a, 'b) t = + | Left of 'a + | Right of 'b +val left : 'a -> ('a, 'b) t +val right : 'b -> ('a, 'b) t +val is_left : ('a, 'b) t -> bool +val is_right : ('a, 'b) t -> bool +val find_left : ('a, 'b) t -> 'a option +val find_right : ('a, 'b) t -> 'b option +val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t +val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t +val map : + left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t +val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c +val iter : left:('a -> unit) -> right:('b -> unit) -> ('a, 'b) t -> unit +val for_all : left:('a -> bool) -> right:('b -> bool) -> ('a, 'b) t -> bool +val equal : + left:('a -> 'a -> bool) -> + right:('b -> 'b -> bool) -> ('a, 'b) t -> ('a, 'b) t -> bool +val compare : + left:('a -> 'a -> int) -> + right:('b -> 'b -> int) -> ('a, 'b) t -> ('a, 'b) t -> int diff --git a/interfaces/5.3/ephemeron.mli b/interfaces/5.3/ephemeron.mli new file mode 100644 index 0000000..5f5db4f --- /dev/null +++ b/interfaces/5.3/ephemeron.mli @@ -0,0 +1,240 @@ +module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end +module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end +module K1 : +sig + type ('k, 'd) t + val make : 'k -> 'd -> ('k, 'd) t + val query : ('k, 'd) t -> 'k -> 'd option + module Make : + (H : Hashtbl.HashedType) -> + sig + type key = H.t + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H : Hashtbl.SeededHashedType) -> + sig + type key = H.t + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k, 'd) t + val make : unit -> ('k, 'd) t + val add : ('k, 'd) t -> 'k -> 'd -> unit + val remove : ('k, 'd) t -> 'k -> unit + val find : ('k, 'd) t -> 'k -> 'd option + val length : ('k, 'd) t -> int + val clear : ('k, 'd) t -> unit + end +end +module K2 : +sig + type ('k1, 'k2, 'd) t + val make : 'k1 -> 'k2 -> 'd -> ('k1, 'k2, 'd) t + val query : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option + module Make : + (H1 : Hashtbl.HashedType) -> + (H2 : Hashtbl.HashedType) -> + sig + type key = (H1.t * H2.t) + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H1 : Hashtbl.SeededHashedType) -> + (H2 : Hashtbl.SeededHashedType) -> + sig + type key = (H1.t * H2.t) + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k1, 'k2, 'd) t + val make : unit -> ('k1, 'k2, 'd) t + val add : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd -> unit + val remove : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> unit + val find : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option + val length : ('k1, 'k2, 'd) t -> int + val clear : ('k1, 'k2, 'd) t -> unit + end +end +module Kn : +sig + type ('k, 'd) t + val make : 'k array -> 'd -> ('k, 'd) t + val query : ('k, 'd) t -> 'k array -> 'd option + module Make : + (H : Hashtbl.HashedType) -> + sig + type key = H.t array + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H : Hashtbl.SeededHashedType) -> + sig + type key = H.t array + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k, 'd) t + val make : unit -> ('k, 'd) t + val add : ('k, 'd) t -> 'k array -> 'd -> unit + val remove : ('k, 'd) t -> 'k array -> unit + val find : ('k, 'd) t -> 'k array -> 'd option + val length : ('k, 'd) t -> int + val clear : ('k, 'd) t -> unit + end +end diff --git a/interfaces/5.3/filename.mli b/interfaces/5.3/filename.mli new file mode 100644 index 0000000..472c189 --- /dev/null +++ b/interfaces/5.3/filename.mli @@ -0,0 +1,28 @@ +val current_dir_name : string +val parent_dir_name : string +val dir_sep : string +val concat : string -> string -> string +val is_relative : string -> bool +val is_implicit : string -> bool +val check_suffix : string -> string -> bool +val chop_suffix : string -> string -> string +val chop_suffix_opt : suffix:string -> string -> string option +val extension : string -> string +val remove_extension : string -> string +val chop_extension : string -> string +val basename : string -> string +val dirname : string -> string +val null : string +val temp_file : ?temp_dir:string -> string -> string -> string +val open_temp_file : + ?mode:open_flag list -> + ?perms:int -> + ?temp_dir:string -> string -> string -> (string * out_channel) +val temp_dir : ?temp_dir:string -> ?perms:int -> string -> string -> string +val get_temp_dir_name : unit -> string +val set_temp_dir_name : string -> unit +val quote : string -> string +val quote_command : + string -> + ?stdin:string -> + ?stdout:string -> ?stderr:string -> string list -> string diff --git a/interfaces/5.3/float.mli b/interfaces/5.3/float.mli new file mode 100644 index 0000000..d0b838a --- /dev/null +++ b/interfaces/5.3/float.mli @@ -0,0 +1,227 @@ +val zero : float +val one : float +val minus_one : float +external neg : float -> float = "%negfloat" +external add : float -> float -> float = "%addfloat" +external sub : float -> float -> float = "%subfloat" +external mul : float -> float -> float = "%mulfloat" +external div : float -> float -> float = "%divfloat" +external fma : float -> float -> float -> float = "caml_fma_float" "caml_fma" +[@@unboxed ][@@noalloc ] +external rem : float -> float -> float = "caml_fmod_float" "fmod"[@@unboxed ] +[@@noalloc ] +val succ : float -> float +val pred : float -> float +external abs : float -> float = "%absfloat" +val infinity : float +val neg_infinity : float +val nan : float +val signaling_nan : float +val quiet_nan : float +val pi : float +val max_float : float +val min_float : float +val epsilon : float +val is_finite : float -> bool +val is_infinite : float -> bool +val is_nan : float -> bool +val is_integer : float -> bool +external of_int : int -> float = "%floatofint" +external to_int : float -> int = "%intoffloat" +external of_string : string -> float = "caml_float_of_string" +val of_string_opt : string -> float option +val to_string : float -> string +type fpclass = fpclass = + | FP_normal + | FP_subnormal + | FP_zero + | FP_infinite + | FP_nan +external classify_float : + ((float)[@unboxed ]) -> fpclass = "caml_classify_float" + "caml_classify_float_unboxed"[@@noalloc ] +external pow : float -> float -> float = "caml_power_float" "pow"[@@unboxed ] +[@@noalloc ] +external sqrt : float -> float = "caml_sqrt_float" "sqrt"[@@unboxed ] +[@@noalloc ] +external cbrt : float -> float = "caml_cbrt_float" "caml_cbrt"[@@unboxed ] +[@@noalloc ] +external exp : float -> float = "caml_exp_float" "exp"[@@unboxed ][@@noalloc + ] +external exp2 : float -> float = "caml_exp2_float" "caml_exp2"[@@unboxed ] +[@@noalloc ] +external log : float -> float = "caml_log_float" "log"[@@unboxed ][@@noalloc + ] +external log10 : float -> float = "caml_log10_float" "log10"[@@unboxed ] +[@@noalloc ] +external log2 : float -> float = "caml_log2_float" "caml_log2"[@@unboxed ] +[@@noalloc ] +external expm1 : float -> float = "caml_expm1_float" "caml_expm1"[@@unboxed ] +[@@noalloc ] +external log1p : float -> float = "caml_log1p_float" "caml_log1p"[@@unboxed ] +[@@noalloc ] +external cos : float -> float = "caml_cos_float" "cos"[@@unboxed ][@@noalloc + ] +external sin : float -> float = "caml_sin_float" "sin"[@@unboxed ][@@noalloc + ] +external tan : float -> float = "caml_tan_float" "tan"[@@unboxed ][@@noalloc + ] +external acos : float -> float = "caml_acos_float" "acos"[@@unboxed ] +[@@noalloc ] +external asin : float -> float = "caml_asin_float" "asin"[@@unboxed ] +[@@noalloc ] +external atan : float -> float = "caml_atan_float" "atan"[@@unboxed ] +[@@noalloc ] +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" +[@@unboxed ][@@noalloc ] +external hypot : float -> float -> float = "caml_hypot_float" "caml_hypot" +[@@unboxed ][@@noalloc ] +external cosh : float -> float = "caml_cosh_float" "cosh"[@@unboxed ] +[@@noalloc ] +external sinh : float -> float = "caml_sinh_float" "sinh"[@@unboxed ] +[@@noalloc ] +external tanh : float -> float = "caml_tanh_float" "tanh"[@@unboxed ] +[@@noalloc ] +external acosh : float -> float = "caml_acosh_float" "caml_acosh"[@@unboxed ] +[@@noalloc ] +external asinh : float -> float = "caml_asinh_float" "caml_asinh"[@@unboxed ] +[@@noalloc ] +external atanh : float -> float = "caml_atanh_float" "caml_atanh"[@@unboxed ] +[@@noalloc ] +external erf : float -> float = "caml_erf_float" "caml_erf"[@@unboxed ] +[@@noalloc ] +external erfc : float -> float = "caml_erfc_float" "caml_erfc"[@@unboxed ] +[@@noalloc ] +external trunc : float -> float = "caml_trunc_float" "caml_trunc"[@@unboxed ] +[@@noalloc ] +external round : float -> float = "caml_round_float" "caml_round"[@@unboxed ] +[@@noalloc ] +external ceil : float -> float = "caml_ceil_float" "ceil"[@@unboxed ] +[@@noalloc ] +external floor : float -> float = "caml_floor_float" "floor"[@@unboxed ] +[@@noalloc ] +external next_after : + float -> float -> float = "caml_nextafter_float" "caml_nextafter"[@@unboxed + ] +[@@noalloc ] +external copy_sign : + float -> float -> float = "caml_copysign_float" "caml_copysign"[@@unboxed ] +[@@noalloc ] +external sign_bit : + ((float)[@unboxed ]) -> bool = "caml_signbit_float" "caml_signbit"[@@noalloc + ] +external frexp : float -> (float * int) = "caml_frexp_float" +external ldexp : + ((float)[@unboxed ]) -> ((int)[@untagged ]) -> ((float)[@unboxed ]) = + "caml_ldexp_float" "caml_ldexp_float_unboxed"[@@noalloc ] +external modf : float -> (float * float) = "caml_modf_float" +type t = float +val compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : float -> float -> float +val min_max : float -> float -> (float * float) +val min_num : t -> t -> t +val max_num : t -> t -> t +val min_max_num : float -> float -> (float * float) +val seeded_hash : int -> t -> int +val hash : t -> int +module Array : +sig + type t = floatarray + val length : t -> int + val get : t -> int -> float + val set : t -> int -> float -> unit + val make : int -> float -> t + val create : int -> t + val init : int -> (int -> float) -> t + val make_matrix : int -> int -> float -> t array + val init_matrix : int -> int -> (int -> int -> float) -> t array + val append : t -> t -> t + val concat : t list -> t + val sub : t -> int -> int -> t + val copy : t -> t + val fill : t -> int -> int -> float -> unit + val blit : t -> int -> t -> int -> int -> unit + val to_list : t -> float list + val of_list : float list -> t + val iter : (float -> unit) -> t -> unit + val iteri : (int -> float -> unit) -> t -> unit + val map : (float -> float) -> t -> t + val map_inplace : (float -> float) -> t -> unit + val mapi : (int -> float -> float) -> t -> t + val mapi_inplace : (int -> float -> float) -> t -> unit + val fold_left : ('acc -> float -> 'acc) -> 'acc -> t -> 'acc + val fold_right : (float -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val iter2 : (float -> float -> unit) -> t -> t -> unit + val map2 : (float -> float -> float) -> t -> t -> t + val for_all : (float -> bool) -> t -> bool + val exists : (float -> bool) -> t -> bool + val mem : float -> t -> bool + val mem_ieee : float -> t -> bool + val find_opt : (float -> bool) -> t -> float option + val find_index : (float -> bool) -> t -> int option + val find_map : (float -> 'a option) -> t -> 'a option + val find_mapi : (int -> float -> 'a option) -> t -> 'a option + val sort : (float -> float -> int) -> t -> unit + val stable_sort : (float -> float -> int) -> t -> unit + val fast_sort : (float -> float -> int) -> t -> unit + val shuffle : rand:(int -> int) -> t -> unit + val to_seq : t -> float Seq.t + val to_seqi : t -> (int * float) Seq.t + val of_seq : float Seq.t -> t + val map_to_array : (float -> 'a) -> t -> 'a array + val map_from_array : ('a -> float) -> 'a array -> t + external unsafe_get : t -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : t -> int -> float -> unit = "%floatarray_unsafe_set" +end +module ArrayLabels : +sig + type t = floatarray + val length : t -> int + val get : t -> int -> float + val set : t -> int -> float -> unit + val make : int -> float -> t + val create : int -> t + val init : int -> f:(int -> float) -> t + val make_matrix : dimx:int -> dimy:int -> float -> t array + val init_matrix : + dimx:int -> dimy:int -> f:(int -> int -> float) -> t array + val append : t -> t -> t + val concat : t list -> t + val sub : t -> pos:int -> len:int -> t + val copy : t -> t + val fill : t -> pos:int -> len:int -> float -> unit + val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit + val to_list : t -> float list + val of_list : float list -> t + val iter : f:(float -> unit) -> t -> unit + val iteri : f:(int -> float -> unit) -> t -> unit + val map : f:(float -> float) -> t -> t + val map_inplace : f:(float -> float) -> t -> unit + val mapi : f:(int -> float -> float) -> t -> t + val mapi_inplace : f:(int -> float -> float) -> t -> unit + val fold_left : f:('acc -> float -> 'acc) -> init:'acc -> t -> 'acc + val fold_right : f:(float -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val iter2 : f:(float -> float -> unit) -> t -> t -> unit + val map2 : f:(float -> float -> float) -> t -> t -> t + val for_all : f:(float -> bool) -> t -> bool + val exists : f:(float -> bool) -> t -> bool + val mem : float -> set:t -> bool + val mem_ieee : float -> set:t -> bool + val find_opt : f:(float -> bool) -> t -> float option + val find_index : f:(float -> bool) -> t -> int option + val find_map : f:(float -> 'a option) -> t -> 'a option + val find_mapi : f:(int -> float -> 'a option) -> t -> 'a option + val sort : cmp:(float -> float -> int) -> t -> unit + val stable_sort : cmp:(float -> float -> int) -> t -> unit + val fast_sort : cmp:(float -> float -> int) -> t -> unit + val shuffle : rand:(int -> int) -> t -> unit + val to_seq : t -> float Seq.t + val to_seqi : t -> (int * float) Seq.t + val of_seq : float Seq.t -> t + val map_to_array : f:(float -> 'a) -> t -> 'a array + val map_from_array : f:('a -> float) -> 'a array -> t + external unsafe_get : t -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : t -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.3/format.mli b/interfaces/5.3/format.mli new file mode 100644 index 0000000..7ce8b45 --- /dev/null +++ b/interfaces/5.3/format.mli @@ -0,0 +1,217 @@ +type formatter +val pp_open_box : formatter -> int -> unit +val open_box : int -> unit +val pp_close_box : formatter -> unit -> unit +val close_box : unit -> unit +val pp_open_hbox : formatter -> unit -> unit +val open_hbox : unit -> unit +val pp_open_vbox : formatter -> int -> unit +val open_vbox : int -> unit +val pp_open_hvbox : formatter -> int -> unit +val open_hvbox : int -> unit +val pp_open_hovbox : formatter -> int -> unit +val open_hovbox : int -> unit +val pp_print_string : formatter -> string -> unit +val print_string : string -> unit +val pp_print_substring : pos:int -> len:int -> formatter -> string -> unit +val print_substring : pos:int -> len:int -> string -> unit +val pp_print_bytes : formatter -> bytes -> unit +val print_bytes : bytes -> unit +val pp_print_as : formatter -> int -> string -> unit +val print_as : int -> string -> unit +val pp_print_substring_as : + pos:int -> len:int -> formatter -> int -> string -> unit +val print_substring_as : pos:int -> len:int -> int -> string -> unit +val pp_print_int : formatter -> int -> unit +val print_int : int -> unit +val pp_print_float : formatter -> float -> unit +val print_float : float -> unit +val pp_print_char : formatter -> char -> unit +val print_char : char -> unit +val pp_print_bool : formatter -> bool -> unit +val print_bool : bool -> unit +val pp_print_nothing : formatter -> unit -> unit +val pp_print_space : formatter -> unit -> unit +val print_space : unit -> unit +val pp_print_cut : formatter -> unit -> unit +val print_cut : unit -> unit +val pp_print_break : formatter -> int -> int -> unit +val print_break : int -> int -> unit +val pp_print_custom_break : + formatter -> + fits:(string * int * string) -> breaks:(string * int * string) -> unit +val pp_force_newline : formatter -> unit -> unit +val force_newline : unit -> unit +val pp_print_if_newline : formatter -> unit -> unit +val print_if_newline : unit -> unit +val pp_print_flush : formatter -> unit -> unit +val print_flush : unit -> unit +val pp_print_newline : formatter -> unit -> unit +val print_newline : unit -> unit +val pp_infinity : int +val pp_set_margin : formatter -> int -> unit +val set_margin : int -> unit +val pp_get_margin : formatter -> unit -> int +val get_margin : unit -> int +val pp_set_max_indent : formatter -> int -> unit +val set_max_indent : int -> unit +val pp_get_max_indent : formatter -> unit -> int +val get_max_indent : unit -> int +type geometry = { + max_indent: int ; + margin: int } +val check_geometry : geometry -> bool +val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit +val set_geometry : max_indent:int -> margin:int -> unit +val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit +val safe_set_geometry : max_indent:int -> margin:int -> unit +val pp_update_geometry : formatter -> (geometry -> geometry) -> unit +val update_geometry : (geometry -> geometry) -> unit +val pp_get_geometry : formatter -> unit -> geometry +val get_geometry : unit -> geometry +val pp_set_max_boxes : formatter -> int -> unit +val set_max_boxes : int -> unit +val pp_get_max_boxes : formatter -> unit -> int +val get_max_boxes : unit -> int +val pp_over_max_boxes : formatter -> unit -> bool +val over_max_boxes : unit -> bool +val pp_open_tbox : formatter -> unit -> unit +val open_tbox : unit -> unit +val pp_close_tbox : formatter -> unit -> unit +val close_tbox : unit -> unit +val pp_set_tab : formatter -> unit -> unit +val set_tab : unit -> unit +val pp_print_tab : formatter -> unit -> unit +val print_tab : unit -> unit +val pp_print_tbreak : formatter -> int -> int -> unit +val print_tbreak : int -> int -> unit +val pp_set_ellipsis_text : formatter -> string -> unit +val set_ellipsis_text : string -> unit +val pp_get_ellipsis_text : formatter -> unit -> string +val get_ellipsis_text : unit -> string +type stag = .. +type tag = string +type stag += + | String_tag of tag +val pp_open_stag : formatter -> stag -> unit +val open_stag : stag -> unit +val pp_close_stag : formatter -> unit -> unit +val close_stag : unit -> unit +val pp_set_tags : formatter -> bool -> unit +val set_tags : bool -> unit +val pp_set_print_tags : formatter -> bool -> unit +val set_print_tags : bool -> unit +val pp_set_mark_tags : formatter -> bool -> unit +val set_mark_tags : bool -> unit +val pp_get_print_tags : formatter -> unit -> bool +val get_print_tags : unit -> bool +val pp_get_mark_tags : formatter -> unit -> bool +val get_mark_tags : unit -> bool +val pp_set_formatter_out_channel : formatter -> out_channel -> unit +val set_formatter_out_channel : out_channel -> unit +val pp_set_formatter_output_functions : + formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> unit +val set_formatter_output_functions : + (string -> int -> int -> unit) -> (unit -> unit) -> unit +val pp_get_formatter_output_functions : + formatter -> unit -> ((string -> int -> int -> unit) * (unit -> unit)) +val get_formatter_output_functions : + unit -> ((string -> int -> int -> unit) * (unit -> unit)) +type formatter_out_functions = + { + out_string: string -> int -> int -> unit ; + out_flush: unit -> unit ; + out_newline: unit -> unit ; + out_spaces: int -> unit ; + out_indent: int -> unit } +val pp_set_formatter_out_functions : + formatter -> formatter_out_functions -> unit +val set_formatter_out_functions : formatter_out_functions -> unit +val pp_get_formatter_out_functions : + formatter -> unit -> formatter_out_functions +val get_formatter_out_functions : unit -> formatter_out_functions +type formatter_stag_functions = + { + mark_open_stag: stag -> string ; + mark_close_stag: stag -> string ; + print_open_stag: stag -> unit ; + print_close_stag: stag -> unit } +val pp_set_formatter_stag_functions : + formatter -> formatter_stag_functions -> unit +val set_formatter_stag_functions : formatter_stag_functions -> unit +val pp_get_formatter_stag_functions : + formatter -> unit -> formatter_stag_functions +val get_formatter_stag_functions : unit -> formatter_stag_functions +val formatter_of_out_channel : out_channel -> formatter +val synchronized_formatter_of_out_channel : + out_channel -> formatter Domain.DLS.key +val std_formatter : formatter +val get_std_formatter : unit -> formatter +val err_formatter : formatter +val get_err_formatter : unit -> formatter +val formatter_of_buffer : Buffer.t -> formatter +val stdbuf : Buffer.t +val get_stdbuf : unit -> Buffer.t +val str_formatter : formatter +val get_str_formatter : unit -> formatter +val flush_str_formatter : unit -> string +val make_formatter : + (string -> int -> int -> unit) -> (unit -> unit) -> formatter +val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> formatter Domain.DLS.key +val formatter_of_out_functions : formatter_out_functions -> formatter +type symbolic_output_item = + | Output_flush + | Output_newline + | Output_string of string + | Output_spaces of int + | Output_indent of int +type symbolic_output_buffer +val make_symbolic_output_buffer : unit -> symbolic_output_buffer +val clear_symbolic_output_buffer : symbolic_output_buffer -> unit +val get_symbolic_output_buffer : + symbolic_output_buffer -> symbolic_output_item list +val flush_symbolic_output_buffer : + symbolic_output_buffer -> symbolic_output_item list +val add_symbolic_output_item : + symbolic_output_buffer -> symbolic_output_item -> unit +val formatter_of_symbolic_output_buffer : symbolic_output_buffer -> formatter +val pp_print_iter : + ?pp_sep:(formatter -> unit -> unit) -> + (('a -> unit) -> 'b -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'b -> unit +val pp_print_list : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a list -> unit +val pp_print_array : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a array -> unit +val pp_print_seq : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a Seq.t -> unit +val pp_print_text : formatter -> string -> unit +val pp_print_option : + ?none:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a option -> unit +val pp_print_result : + ok:(formatter -> 'a -> unit) -> + error:(formatter -> 'e -> unit) -> formatter -> ('a, 'e) result -> unit +val pp_print_either : + left:(formatter -> 'a -> unit) -> + right:(formatter -> 'b -> unit) -> formatter -> ('a, 'b) Either.t -> unit +val fprintf : formatter -> ('a, formatter, unit) format -> 'a +val printf : ('a, formatter, unit) format -> 'a +val eprintf : ('a, formatter, unit) format -> 'a +val sprintf : ('a, unit, string) format -> 'a +val asprintf : ('a, formatter, unit, string) format4 -> 'a +val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a +val ifprintf : formatter -> ('a, formatter, unit) format -> 'a +val kfprintf : + (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b +val kdprintf : + ((formatter -> unit) -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b +val ikfprintf : + (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b +val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b +val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b diff --git a/interfaces/5.3/fun.mli b/interfaces/5.3/fun.mli new file mode 100644 index 0000000..0099086 --- /dev/null +++ b/interfaces/5.3/fun.mli @@ -0,0 +1,7 @@ +external id : 'a -> 'a = "%identity" +val const : 'a -> 'b -> 'a +val compose : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c +val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c +val negate : ('a -> bool) -> 'a -> bool +val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a +exception Finally_raised of exn diff --git a/interfaces/5.3/gc.mli b/interfaces/5.3/gc.mli new file mode 100644 index 0000000..5658a81 --- /dev/null +++ b/interfaces/5.3/gc.mli @@ -0,0 +1,83 @@ +type stat = + { + minor_words: float ; + promoted_words: float ; + major_words: float ; + minor_collections: int ; + major_collections: int ; + heap_words: int ; + heap_chunks: int ; + live_words: int ; + live_blocks: int ; + free_words: int ; + free_blocks: int ; + largest_free: int ; + fragments: int ; + compactions: int ; + top_heap_words: int ; + stack_size: int ; + forced_major_collections: int } +type control = + { + minor_heap_size: int ; + major_heap_increment: int ; + space_overhead: int ; + verbose: int ; + max_overhead: int ; + stack_limit: int ; + allocation_policy: int ; + window_size: int ; + custom_major_ratio: int ; + custom_minor_ratio: int ; + custom_minor_max_size: int } +external stat : unit -> stat = "caml_gc_stat" +external quick_stat : unit -> stat = "caml_gc_quick_stat" +external counters : unit -> (float * float * float) = "caml_gc_counters" +external minor_words : + unit -> ((float)[@unboxed ]) = "caml_gc_minor_words" + "caml_gc_minor_words_unboxed" +external get : unit -> control = "caml_gc_get" +external set : control -> unit = "caml_gc_set" +external minor : unit -> unit = "caml_gc_minor" +external major_slice : int -> int = "caml_gc_major_slice" +external major : unit -> unit = "caml_gc_major" +external full_major : unit -> unit = "caml_gc_full_major" +external compact : unit -> unit = "caml_gc_compaction" +val print_stat : out_channel -> unit +val allocated_bytes : unit -> float +external get_minor_free : unit -> int = "caml_get_minor_free" +val finalise : ('a -> unit) -> 'a -> unit +val finalise_last : (unit -> unit) -> 'a -> unit +val finalise_release : unit -> unit +type alarm +val create_alarm : (unit -> unit) -> alarm +val delete_alarm : alarm -> unit +val eventlog_pause : unit -> unit +val eventlog_resume : unit -> unit +module Memprof : +sig + type t + type allocation_source = + | Normal + | Marshal + | Custom + type allocation = private + { + n_samples: int ; + size: int ; + source: allocation_source ; + callstack: Printexc.raw_backtrace } + type ('minor, 'major) tracker = + { + alloc_minor: allocation -> 'minor option ; + alloc_major: allocation -> 'major option ; + promote: 'minor -> 'major option ; + dealloc_minor: 'minor -> unit ; + dealloc_major: 'major -> unit } + val null_tracker : ('minor, 'major) tracker + val start : + sampling_rate:float -> + ?callstack_size:int -> ('minor, 'major) tracker -> t + val stop : unit -> unit + val discard : t -> unit +end diff --git a/interfaces/5.3/hashtbl.mli b/interfaces/5.3/hashtbl.mli new file mode 100644 index 0000000..360ec39 --- /dev/null +++ b/interfaces/5.3/hashtbl.mli @@ -0,0 +1,150 @@ +type (!'a, !'b) t +val create : ?random:bool -> int -> ('a, 'b) t +val clear : ('a, 'b) t -> unit +val reset : ('a, 'b) t -> unit +val copy : ('a, 'b) t -> ('a, 'b) t +val add : ('a, 'b) t -> 'a -> 'b -> unit +val find : ('a, 'b) t -> 'a -> 'b +val find_opt : ('a, 'b) t -> 'a -> 'b option +val find_all : ('a, 'b) t -> 'a -> 'b list +val mem : ('a, 'b) t -> 'a -> bool +val remove : ('a, 'b) t -> 'a -> unit +val replace : ('a, 'b) t -> 'a -> 'b -> unit +val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit +val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit +val fold : ('a -> 'b -> 'acc -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc +val length : ('a, 'b) t -> int +val randomize : unit -> unit +val is_randomized : unit -> bool +val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t +type statistics = + { + num_bindings: int ; + num_buckets: int ; + max_bucket_length: int ; + bucket_histogram: int array } +val stats : ('a, 'b) t -> statistics +val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t +val to_seq_keys : ('a, 'b) t -> 'a Seq.t +val to_seq_values : ('a, 'b) t -> 'b Seq.t +val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t +module type HashedType = + sig type t val equal : t -> t -> bool val hash : t -> int end +module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module Make : +(H : HashedType) -> + sig + type key = H.t + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module type SeededHashedType = + sig type t val equal : t -> t -> bool val seeded_hash : int -> t -> int end +module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module MakeSeeded : +(H : SeededHashedType) -> + sig + type key = H.t + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +val hash : 'a -> int +val seeded_hash : int -> 'a -> int +val hash_param : int -> int -> 'a -> int +val seeded_hash_param : int -> int -> int -> 'a -> int diff --git a/interfaces/5.3/in_channel.mli b/interfaces/5.3/in_channel.mli new file mode 100644 index 0000000..2309613 --- /dev/null +++ b/interfaces/5.3/in_channel.mli @@ -0,0 +1,43 @@ +type t = in_channel +type open_flag = open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val stdin : t +val open_bin : string -> t +val open_text : string -> t +val open_gen : open_flag list -> int -> string -> t +val with_open_bin : string -> (t -> 'a) -> 'a +val with_open_text : string -> (t -> 'a) -> 'a +val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a +val close : t -> unit +val close_noerr : t -> unit +val input_char : t -> char option +val input_byte : t -> int option +val input_line : t -> string option +val really_input_string : t -> int -> string option +val input_all : t -> string +val input_lines : t -> string list +val input : t -> bytes -> int -> int -> int +val input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> int +val really_input : t -> bytes -> int -> int -> unit option +val really_input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit option +val fold_lines : ('acc -> string -> 'acc) -> 'acc -> t -> 'acc +val seek : t -> int64 -> unit +val pos : t -> int64 +val length : t -> int64 +val set_binary_mode : t -> bool -> unit +val is_binary_mode : t -> bool +val isatty : t -> bool diff --git a/interfaces/5.3/int32.mli b/interfaces/5.3/int32.mli new file mode 100644 index 0000000..f884f59 --- /dev/null +++ b/interfaces/5.3/int32.mli @@ -0,0 +1,49 @@ +val zero : int32 +val one : int32 +val minus_one : int32 +external neg : int32 -> int32 = "%int32_neg" +external add : int32 -> int32 -> int32 = "%int32_add" +external sub : int32 -> int32 -> int32 = "%int32_sub" +external mul : int32 -> int32 -> int32 = "%int32_mul" +external div : int32 -> int32 -> int32 = "%int32_div" +val unsigned_div : int32 -> int32 -> int32 +external rem : int32 -> int32 -> int32 = "%int32_mod" +val unsigned_rem : int32 -> int32 -> int32 +val succ : int32 -> int32 +val pred : int32 -> int32 +val abs : int32 -> int32 +val max_int : int32 +val min_int : int32 +external logand : int32 -> int32 -> int32 = "%int32_and" +external logor : int32 -> int32 -> int32 = "%int32_or" +external logxor : int32 -> int32 -> int32 = "%int32_xor" +val lognot : int32 -> int32 +external shift_left : int32 -> int -> int32 = "%int32_lsl" +external shift_right : int32 -> int -> int32 = "%int32_asr" +external shift_right_logical : int32 -> int -> int32 = "%int32_lsr" +external of_int : int -> int32 = "%int32_of_int" +external to_int : int32 -> int = "%int32_to_int" +val unsigned_to_int : int32 -> int option +external of_float : + float -> int32 = "caml_int32_of_float" "caml_int32_of_float_unboxed" +[@@unboxed ][@@noalloc ] +external to_float : + int32 -> float = "caml_int32_to_float" "caml_int32_to_float_unboxed" +[@@unboxed ][@@noalloc ] +external of_string : string -> int32 = "caml_int32_of_string" +val of_string_opt : string -> int32 option +val to_string : int32 -> string +external bits_of_float : + float -> int32 = "caml_int32_bits_of_float" + "caml_int32_bits_of_float_unboxed"[@@unboxed ][@@noalloc ] +external float_of_bits : + int32 -> float = "caml_int32_float_of_bits" + "caml_int32_float_of_bits_unboxed"[@@unboxed ][@@noalloc ] +type t = int32 +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.3/int64.mli b/interfaces/5.3/int64.mli new file mode 100644 index 0000000..14ec94b --- /dev/null +++ b/interfaces/5.3/int64.mli @@ -0,0 +1,53 @@ +val zero : int64 +val one : int64 +val minus_one : int64 +external neg : int64 -> int64 = "%int64_neg" +external add : int64 -> int64 -> int64 = "%int64_add" +external sub : int64 -> int64 -> int64 = "%int64_sub" +external mul : int64 -> int64 -> int64 = "%int64_mul" +external div : int64 -> int64 -> int64 = "%int64_div" +val unsigned_div : int64 -> int64 -> int64 +external rem : int64 -> int64 -> int64 = "%int64_mod" +val unsigned_rem : int64 -> int64 -> int64 +val succ : int64 -> int64 +val pred : int64 -> int64 +val abs : int64 -> int64 +val max_int : int64 +val min_int : int64 +external logand : int64 -> int64 -> int64 = "%int64_and" +external logor : int64 -> int64 -> int64 = "%int64_or" +external logxor : int64 -> int64 -> int64 = "%int64_xor" +val lognot : int64 -> int64 +external shift_left : int64 -> int -> int64 = "%int64_lsl" +external shift_right : int64 -> int -> int64 = "%int64_asr" +external shift_right_logical : int64 -> int -> int64 = "%int64_lsr" +external of_int : int -> int64 = "%int64_of_int" +external to_int : int64 -> int = "%int64_to_int" +val unsigned_to_int : int64 -> int option +external of_float : + float -> int64 = "caml_int64_of_float" "caml_int64_of_float_unboxed" +[@@unboxed ][@@noalloc ] +external to_float : + int64 -> float = "caml_int64_to_float" "caml_int64_to_float_unboxed" +[@@unboxed ][@@noalloc ] +external of_int32 : int32 -> int64 = "%int64_of_int32" +external to_int32 : int64 -> int32 = "%int64_to_int32" +external of_nativeint : nativeint -> int64 = "%int64_of_nativeint" +external to_nativeint : int64 -> nativeint = "%int64_to_nativeint" +external of_string : string -> int64 = "caml_int64_of_string" +val of_string_opt : string -> int64 option +val to_string : int64 -> string +external bits_of_float : + float -> int64 = "caml_int64_bits_of_float" + "caml_int64_bits_of_float_unboxed"[@@unboxed ][@@noalloc ] +external float_of_bits : + int64 -> float = "caml_int64_float_of_bits" + "caml_int64_float_of_bits_unboxed"[@@unboxed ][@@noalloc ] +type t = int64 +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.3/lazy.mli b/interfaces/5.3/lazy.mli new file mode 100644 index 0000000..2129b8c --- /dev/null +++ b/interfaces/5.3/lazy.mli @@ -0,0 +1,9 @@ +type 'a t = 'a CamlinternalLazy.t +exception Undefined +external force : 'a t -> 'a = "%lazy_force" +val map : ('a -> 'b) -> 'a t -> 'b t +val is_val : 'a t -> bool +val from_val : 'a -> 'a t +val map_val : ('a -> 'b) -> 'a t -> 'b t +val from_fun : (unit -> 'a) -> 'a t +val force_val : 'a t -> 'a diff --git a/interfaces/5.3/lexing.mli b/interfaces/5.3/lexing.mli new file mode 100644 index 0000000..0e5297c --- /dev/null +++ b/interfaces/5.3/lexing.mli @@ -0,0 +1,54 @@ +type position = + { + pos_fname: string ; + pos_lnum: int ; + pos_bol: int ; + pos_cnum: int } +val dummy_pos : position +type lexbuf = + { + refill_buff: lexbuf -> unit ; + mutable lex_buffer: bytes ; + mutable lex_buffer_len: int ; + mutable lex_abs_pos: int ; + mutable lex_start_pos: int ; + mutable lex_curr_pos: int ; + mutable lex_last_pos: int ; + mutable lex_last_action: int ; + mutable lex_eof_reached: bool ; + mutable lex_mem: int array ; + mutable lex_start_p: position ; + mutable lex_curr_p: position } +val from_channel : ?with_positions:bool -> in_channel -> lexbuf +val from_string : ?with_positions:bool -> string -> lexbuf +val from_function : ?with_positions:bool -> (bytes -> int -> int) -> lexbuf +val set_position : lexbuf -> position -> unit +val set_filename : lexbuf -> string -> unit +val with_positions : lexbuf -> bool +val lexeme : lexbuf -> string +val lexeme_char : lexbuf -> int -> char +val lexeme_start : lexbuf -> int +val lexeme_end : lexbuf -> int +val lexeme_start_p : lexbuf -> position +val lexeme_end_p : lexbuf -> position +val new_line : lexbuf -> unit +val flush_input : lexbuf -> unit +val sub_lexeme : lexbuf -> int -> int -> string +val sub_lexeme_opt : lexbuf -> int -> int -> string option +val sub_lexeme_char : lexbuf -> int -> char +val sub_lexeme_char_opt : lexbuf -> int -> char option +type lex_tables = + { + lex_base: string ; + lex_backtrk: string ; + lex_default: string ; + lex_trans: string ; + lex_check: string ; + lex_base_code: string ; + lex_backtrk_code: string ; + lex_default_code: string ; + lex_trans_code: string ; + lex_check_code: string ; + lex_code: string } +val engine : lex_tables -> int -> lexbuf -> int +val new_engine : lex_tables -> int -> lexbuf -> int diff --git a/interfaces/5.3/list.mli b/interfaces/5.3/list.mli new file mode 100644 index 0000000..dcb2f6b --- /dev/null +++ b/interfaces/5.3/list.mli @@ -0,0 +1,76 @@ +type 'a t = 'a list = + | [] + | (::) of 'a * 'a list +val length : 'a list -> int +val compare_lengths : 'a list -> 'b list -> int +val compare_length_with : 'a list -> int -> int +val is_empty : 'a list -> bool +val cons : 'a -> 'a list -> 'a list +val hd : 'a list -> 'a +val tl : 'a list -> 'a list +val nth : 'a list -> int -> 'a +val nth_opt : 'a list -> int -> 'a option +val rev : 'a list -> 'a list +val init : int -> (int -> 'a) -> 'a list +val append : 'a list -> 'a list -> 'a list +val rev_append : 'a list -> 'a list -> 'a list +val concat : 'a list list -> 'a list +val flatten : 'a list list -> 'a list +val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool +val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int +val iter : ('a -> unit) -> 'a list -> unit +val iteri : (int -> 'a -> unit) -> 'a list -> unit +val map : ('a -> 'b) -> 'a list -> 'b list +val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list +val rev_map : ('a -> 'b) -> 'a list -> 'b list +val filter_map : ('a -> 'b option) -> 'a list -> 'b list +val concat_map : ('a -> 'b list) -> 'a list -> 'b list +val fold_left_map : + ('acc -> 'a -> ('acc * 'b)) -> 'acc -> 'a list -> ('acc * 'b list) +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc +val fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc +val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit +val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val fold_left2 : + ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a list -> 'b list -> 'acc +val fold_right2 : + ('a -> 'b -> 'acc -> 'acc) -> 'a list -> 'b list -> 'acc -> 'acc +val for_all : ('a -> bool) -> 'a list -> bool +val exists : ('a -> bool) -> 'a list -> bool +val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val mem : 'a -> 'a list -> bool +val memq : 'a -> 'a list -> bool +val find : ('a -> bool) -> 'a list -> 'a +val find_opt : ('a -> bool) -> 'a list -> 'a option +val find_index : ('a -> bool) -> 'a list -> int option +val find_map : ('a -> 'b option) -> 'a list -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b option +val filter : ('a -> bool) -> 'a list -> 'a list +val find_all : ('a -> bool) -> 'a list -> 'a list +val filteri : (int -> 'a -> bool) -> 'a list -> 'a list +val take : int -> 'a list -> 'a list +val drop : int -> 'a list -> 'a list +val take_while : ('a -> bool) -> 'a list -> 'a list +val drop_while : ('a -> bool) -> 'a list -> 'a list +val partition : ('a -> bool) -> 'a list -> ('a list * 'a list) +val partition_map : + ('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) +val assoc : 'a -> ('a * 'b) list -> 'b +val assoc_opt : 'a -> ('a * 'b) list -> 'b option +val assq : 'a -> ('a * 'b) list -> 'b +val assq_opt : 'a -> ('a * 'b) list -> 'b option +val mem_assoc : 'a -> ('a * 'b) list -> bool +val mem_assq : 'a -> ('a * 'b) list -> bool +val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list +val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list +val split : ('a * 'b) list -> ('a list * 'b list) +val combine : 'a list -> 'b list -> ('a * 'b) list +val sort : ('a -> 'a -> int) -> 'a list -> 'a list +val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list +val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list +val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list +val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list +val to_seq : 'a list -> 'a Seq.t +val of_seq : 'a Seq.t -> 'a list diff --git a/interfaces/5.3/listLabels.mli b/interfaces/5.3/listLabels.mli new file mode 100644 index 0000000..bb79bd6 --- /dev/null +++ b/interfaces/5.3/listLabels.mli @@ -0,0 +1,76 @@ +type 'a t = 'a list = + | [] + | (::) of 'a * 'a list +val length : 'a list -> int +val compare_lengths : 'a list -> 'b list -> int +val compare_length_with : 'a list -> len:int -> int +val is_empty : 'a list -> bool +val cons : 'a -> 'a list -> 'a list +val hd : 'a list -> 'a +val tl : 'a list -> 'a list +val nth : 'a list -> int -> 'a +val nth_opt : 'a list -> int -> 'a option +val rev : 'a list -> 'a list +val init : len:int -> f:(int -> 'a) -> 'a list +val append : 'a list -> 'a list -> 'a list +val rev_append : 'a list -> 'a list -> 'a list +val concat : 'a list list -> 'a list +val flatten : 'a list list -> 'a list +val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool +val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int +val iter : f:('a -> unit) -> 'a list -> unit +val iteri : f:(int -> 'a -> unit) -> 'a list -> unit +val map : f:('a -> 'b) -> 'a list -> 'b list +val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list +val rev_map : f:('a -> 'b) -> 'a list -> 'b list +val filter_map : f:('a -> 'b option) -> 'a list -> 'b list +val concat_map : f:('a -> 'b list) -> 'a list -> 'b list +val fold_left_map : + f:('acc -> 'a -> ('acc * 'b)) -> init:'acc -> 'a list -> ('acc * 'b list) +val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a list -> 'acc +val fold_right : f:('a -> 'acc -> 'acc) -> 'a list -> init:'acc -> 'acc +val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit +val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val fold_left2 : + f:('acc -> 'a -> 'b -> 'acc) -> init:'acc -> 'a list -> 'b list -> 'acc +val fold_right2 : + f:('a -> 'b -> 'acc -> 'acc) -> 'a list -> 'b list -> init:'acc -> 'acc +val for_all : f:('a -> bool) -> 'a list -> bool +val exists : f:('a -> bool) -> 'a list -> bool +val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val mem : 'a -> set:'a list -> bool +val memq : 'a -> set:'a list -> bool +val find : f:('a -> bool) -> 'a list -> 'a +val find_opt : f:('a -> bool) -> 'a list -> 'a option +val find_index : f:('a -> bool) -> 'a list -> int option +val find_map : f:('a -> 'b option) -> 'a list -> 'b option +val find_mapi : f:(int -> 'a -> 'b option) -> 'a list -> 'b option +val filter : f:('a -> bool) -> 'a list -> 'a list +val find_all : f:('a -> bool) -> 'a list -> 'a list +val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list +val take : int -> 'a list -> 'a list +val drop : int -> 'a list -> 'a list +val take_while : f:('a -> bool) -> 'a list -> 'a list +val drop_while : f:('a -> bool) -> 'a list -> 'a list +val partition : f:('a -> bool) -> 'a list -> ('a list * 'a list) +val partition_map : + f:('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) +val assoc : 'a -> ('a * 'b) list -> 'b +val assoc_opt : 'a -> ('a * 'b) list -> 'b option +val assq : 'a -> ('a * 'b) list -> 'b +val assq_opt : 'a -> ('a * 'b) list -> 'b option +val mem_assoc : 'a -> map:('a * 'b) list -> bool +val mem_assq : 'a -> map:('a * 'b) list -> bool +val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list +val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list +val split : ('a * 'b) list -> ('a list * 'b list) +val combine : 'a list -> 'b list -> ('a * 'b) list +val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list +val to_seq : 'a list -> 'a Seq.t +val of_seq : 'a Seq.t -> 'a list diff --git a/interfaces/5.3/map.mli b/interfaces/5.3/map.mli new file mode 100644 index 0000000..07f6901 --- /dev/null +++ b/interfaces/5.3/map.mli @@ -0,0 +1,100 @@ +module type OrderedType = sig type t val compare : t -> t -> int end +module type S = + sig + type key + type +!'a t + val empty : 'a t + val add : key -> 'a -> 'a t -> 'a t + val add_to_list : key -> 'a -> 'a list t -> 'a list t + val update : key -> ('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t + val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : (key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option + val find_last : (key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option + val iter : (key -> 'a -> unit) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val map : ('a -> 'b) -> 'a t -> 'b t + val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t + val filter : (key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : (key -> 'a -> bool) -> 'a t -> bool + val exists : (key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end +module Make : +(Ord : OrderedType) -> + sig + type key = Ord.t + type +!'a t + val empty : 'a t + val add : key -> 'a -> 'a t -> 'a t + val add_to_list : key -> 'a -> 'a list t -> 'a list t + val update : key -> ('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t + val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : (key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option + val find_last : (key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option + val iter : (key -> 'a -> unit) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val map : ('a -> 'b) -> 'a t -> 'b t + val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t + val filter : (key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : (key -> 'a -> bool) -> 'a t -> bool + val exists : (key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end diff --git a/interfaces/5.3/marshal.mli b/interfaces/5.3/marshal.mli new file mode 100644 index 0000000..2902fd4 --- /dev/null +++ b/interfaces/5.3/marshal.mli @@ -0,0 +1,16 @@ +type extern_flags = + | No_sharing + | Closures + | Compat_32 +val to_channel : out_channel -> 'a -> extern_flags list -> unit +external to_bytes : + 'a -> extern_flags list -> bytes = "caml_output_value_to_bytes" +external to_string : + 'a -> extern_flags list -> string = "caml_output_value_to_string" +val to_buffer : bytes -> int -> int -> 'a -> extern_flags list -> int +val from_channel : in_channel -> 'a +val from_bytes : bytes -> int -> 'a +val from_string : string -> int -> 'a +val header_size : int +val data_size : bytes -> int -> int +val total_size : bytes -> int -> int diff --git a/interfaces/5.3/moreLabels.mli b/interfaces/5.3/moreLabels.mli new file mode 100644 index 0000000..2b3056d --- /dev/null +++ b/interfaces/5.3/moreLabels.mli @@ -0,0 +1,372 @@ +module Hashtbl : +sig + type ('a, 'b) t = ('a, 'b) Hashtbl.t + val create : ?random:bool -> int -> ('a, 'b) t + val clear : ('a, 'b) t -> unit + val reset : ('a, 'b) t -> unit + val copy : ('a, 'b) t -> ('a, 'b) t + val add : ('a, 'b) t -> key:'a -> data:'b -> unit + val find : ('a, 'b) t -> 'a -> 'b + val find_opt : ('a, 'b) t -> 'a -> 'b option + val find_all : ('a, 'b) t -> 'a -> 'b list + val mem : ('a, 'b) t -> 'a -> bool + val remove : ('a, 'b) t -> 'a -> unit + val replace : ('a, 'b) t -> key:'a -> data:'b -> unit + val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit + val filter_map_inplace : + f:(key:'a -> data:'b -> 'b option) -> ('a, 'b) t -> unit + val fold : + f:(key:'a -> data:'b -> 'acc -> 'acc) -> ('a, 'b) t -> init:'acc -> 'acc + val length : ('a, 'b) t -> int + val randomize : unit -> unit + val is_randomized : unit -> bool + val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t + type statistics = Hashtbl.statistics = + { + num_bindings: int ; + num_buckets: int ; + max_bucket_length: int ; + bucket_histogram: int array } + val stats : ('a, 'b) t -> statistics + val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t + val to_seq_keys : ('a, 'b) t -> 'a Seq.t + val to_seq_values : ('a, 'b) t -> 'b Seq.t + val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit + val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit + val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t + module type HashedType = + sig type t val equal : t -> t -> bool val hash : t -> int end + module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module Make : + (H : HashedType) -> + sig + type key = H.t + type 'a t = 'a Hashtbl.Make(H).t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module type SeededHashedType = + sig type t val equal : t -> t -> bool val seeded_hash : int -> t -> int + end + module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module MakeSeeded : + (H : SeededHashedType) -> + sig + type key = H.t + type 'a t = 'a Hashtbl.MakeSeeded(H).t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + val hash : 'a -> int + val seeded_hash : int -> 'a -> int + val hash_param : int -> int -> 'a -> int + val seeded_hash_param : int -> int -> int -> 'a -> int +end +module Map : +sig + module type OrderedType = sig type t val compare : t -> t -> int end + module type S = + sig + type key + type +!'a t + val empty : 'a t + val add : key:key -> data:'a -> 'a t -> 'a t + val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t + val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t + val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : f:(key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val find_last : f:(key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val map : f:('a -> 'b) -> 'a t -> 'b t + val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t + val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : f:(key -> 'a -> bool) -> 'a t -> bool + val exists : f:(key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end + module Make : + (Ord : OrderedType) -> + sig + type key = Ord.t + type 'a t = 'a Map.Make(Ord).t + val empty : 'a t + val add : key:key -> data:'a -> 'a t -> 'a t + val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t + val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t + val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : f:(key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val find_last : f:(key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val map : f:('a -> 'b) -> 'a t -> 'b t + val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t + val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : f:(key -> 'a -> bool) -> 'a t -> bool + val exists : f:(key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end +end +module Set : +sig + module type OrderedType = sig type t val compare : t -> t -> int end + module type S = + sig + type elt + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : f:(elt -> bool) -> t -> elt + val find_first_opt : f:(elt -> bool) -> t -> elt option + val find_last : f:(elt -> bool) -> t -> elt + val find_last_opt : f:(elt -> bool) -> t -> elt option + val iter : f:(elt -> unit) -> t -> unit + val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val map : f:(elt -> elt) -> t -> t + val filter : f:(elt -> bool) -> t -> t + val filter_map : f:(elt -> elt option) -> t -> t + val partition : f:(elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : f:(elt -> bool) -> t -> bool + val exists : f:(elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end + module Make : + (Ord : OrderedType) -> + sig + type elt = Ord.t + type t = Set.Make(Ord).t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : f:(elt -> bool) -> t -> elt + val find_first_opt : f:(elt -> bool) -> t -> elt option + val find_last : f:(elt -> bool) -> t -> elt + val find_last_opt : f:(elt -> bool) -> t -> elt option + val iter : f:(elt -> unit) -> t -> unit + val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val map : f:(elt -> elt) -> t -> t + val filter : f:(elt -> bool) -> t -> t + val filter_map : f:(elt -> elt option) -> t -> t + val partition : f:(elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : f:(elt -> bool) -> t -> bool + val exists : f:(elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end +end diff --git a/interfaces/5.3/nativeint.mli b/interfaces/5.3/nativeint.mli new file mode 100644 index 0000000..0c2db5c --- /dev/null +++ b/interfaces/5.3/nativeint.mli @@ -0,0 +1,47 @@ +val zero : nativeint +val one : nativeint +val minus_one : nativeint +external neg : nativeint -> nativeint = "%nativeint_neg" +external add : nativeint -> nativeint -> nativeint = "%nativeint_add" +external sub : nativeint -> nativeint -> nativeint = "%nativeint_sub" +external mul : nativeint -> nativeint -> nativeint = "%nativeint_mul" +external div : nativeint -> nativeint -> nativeint = "%nativeint_div" +val unsigned_div : nativeint -> nativeint -> nativeint +external rem : nativeint -> nativeint -> nativeint = "%nativeint_mod" +val unsigned_rem : nativeint -> nativeint -> nativeint +val succ : nativeint -> nativeint +val pred : nativeint -> nativeint +val abs : nativeint -> nativeint +val size : int +val max_int : nativeint +val min_int : nativeint +external logand : nativeint -> nativeint -> nativeint = "%nativeint_and" +external logor : nativeint -> nativeint -> nativeint = "%nativeint_or" +external logxor : nativeint -> nativeint -> nativeint = "%nativeint_xor" +val lognot : nativeint -> nativeint +external shift_left : nativeint -> int -> nativeint = "%nativeint_lsl" +external shift_right : nativeint -> int -> nativeint = "%nativeint_asr" +external shift_right_logical : + nativeint -> int -> nativeint = "%nativeint_lsr" +external of_int : int -> nativeint = "%nativeint_of_int" +external to_int : nativeint -> int = "%nativeint_to_int" +val unsigned_to_int : nativeint -> int option +external of_float : + float -> nativeint = "caml_nativeint_of_float" + "caml_nativeint_of_float_unboxed"[@@unboxed ][@@noalloc ] +external to_float : + nativeint -> float = "caml_nativeint_to_float" + "caml_nativeint_to_float_unboxed"[@@unboxed ][@@noalloc ] +external of_int32 : int32 -> nativeint = "%nativeint_of_int32" +external to_int32 : nativeint -> int32 = "%nativeint_to_int32" +external of_string : string -> nativeint = "caml_nativeint_of_string" +val of_string_opt : string -> nativeint option +val to_string : nativeint -> string +type t = nativeint +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.3/obj.mli b/interfaces/5.3/obj.mli new file mode 100644 index 0000000..d6d0e07 --- /dev/null +++ b/interfaces/5.3/obj.mli @@ -0,0 +1,66 @@ +type t +type raw_data = nativeint +external repr : 'a -> t = "%identity" +external obj : t -> 'a = "%identity" +external magic : 'a -> 'b = "%identity" +val is_block : t -> bool +external is_int : t -> bool = "%obj_is_int" +external tag : t -> int = "caml_obj_tag"[@@noalloc ] +external size : t -> int = "%obj_size" +external reachable_words : t -> int = "caml_obj_reachable_words" +external field : t -> int -> t = "%obj_field" +external set_field : t -> int -> t -> unit = "%obj_set_field" +val double_field : t -> int -> float +val set_double_field : t -> int -> float -> unit +external raw_field : t -> int -> raw_data = "caml_obj_raw_field" +external set_raw_field : + t -> int -> raw_data -> unit = "caml_obj_set_raw_field" +external new_block : int -> int -> t = "caml_obj_block" +external dup : t -> t = "caml_obj_dup" +external add_offset : t -> Int32.t -> t = "caml_obj_add_offset" +external with_tag : int -> t -> t = "caml_obj_with_tag" +val first_non_constant_constructor_tag : int +val last_non_constant_constructor_tag : int +val forcing_tag : int +val cont_tag : int +val lazy_tag : int +val closure_tag : int +val object_tag : int +val infix_tag : int +val forward_tag : int +val no_scan_tag : int +val abstract_tag : int +val string_tag : int +val double_tag : int +val double_array_tag : int +val custom_tag : int +val int_tag : int +val out_of_heap_tag : int +val unaligned_tag : int +module Extension_constructor : +sig + type t = extension_constructor + val of_val : 'a -> t + val name : t -> string + val id : t -> int +end +module Ephemeron : +sig + type obj_t = t + type t + val create : int -> t + val length : t -> int + val get_key : t -> int -> obj_t option + val get_key_copy : t -> int -> obj_t option + val set_key : t -> int -> obj_t -> unit + val unset_key : t -> int -> unit + val check_key : t -> int -> bool + val blit_key : t -> int -> t -> int -> int -> unit + val get_data : t -> obj_t option + val get_data_copy : t -> obj_t option + val set_data : t -> obj_t -> unit + val unset_data : t -> unit + val check_data : t -> bool + val blit_data : t -> t -> unit + val max_ephe_length : int +end diff --git a/interfaces/5.3/oo.mli b/interfaces/5.3/oo.mli new file mode 100644 index 0000000..7a03b33 --- /dev/null +++ b/interfaces/5.3/oo.mli @@ -0,0 +1,4 @@ +val copy : (< .. > as 'a) -> 'a +external id : < .. > -> int = "%field1" +val new_method : string -> CamlinternalOO.tag +val public_method_label : string -> CamlinternalOO.tag diff --git a/interfaces/5.3/option.mli b/interfaces/5.3/option.mli new file mode 100644 index 0000000..9d309eb --- /dev/null +++ b/interfaces/5.3/option.mli @@ -0,0 +1,19 @@ +type 'a t = 'a option = + | None + | Some of 'a +val none : 'a option +val some : 'a -> 'a option +val value : 'a option -> default:'a -> 'a +val get : 'a option -> 'a +val bind : 'a option -> ('a -> 'b option) -> 'b option +val join : 'a option option -> 'a option +val map : ('a -> 'b) -> 'a option -> 'b option +val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a +val iter : ('a -> unit) -> 'a option -> unit +val is_none : 'a option -> bool +val is_some : 'a option -> bool +val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool +val compare : ('a -> 'a -> int) -> 'a option -> 'a option -> int +val to_result : none:'e -> 'a option -> ('a, 'e) result +val to_list : 'a option -> 'a list +val to_seq : 'a option -> 'a Seq.t diff --git a/interfaces/5.3/out_channel.mli b/interfaces/5.3/out_channel.mli new file mode 100644 index 0000000..2331a26 --- /dev/null +++ b/interfaces/5.3/out_channel.mli @@ -0,0 +1,41 @@ +type t = out_channel +type open_flag = open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val stdout : t +val stderr : t +val open_bin : string -> t +val open_text : string -> t +val open_gen : open_flag list -> int -> string -> t +val with_open_bin : string -> (t -> 'a) -> 'a +val with_open_text : string -> (t -> 'a) -> 'a +val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a +val close : t -> unit +val close_noerr : t -> unit +val output_char : t -> char -> unit +val output_byte : t -> int -> unit +val output_string : t -> string -> unit +val output_bytes : t -> bytes -> unit +val output : t -> bytes -> int -> int -> unit +val output_substring : t -> string -> int -> int -> unit +val output_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit +val flush : t -> unit +val flush_all : unit -> unit +val seek : t -> int64 -> unit +val pos : t -> int64 +val length : t -> int64 +val set_binary_mode : t -> bool -> unit +val is_binary_mode : t -> bool +val set_buffered : t -> bool -> unit +val is_buffered : t -> bool +val isatty : t -> bool diff --git a/interfaces/5.3/parsing.mli b/interfaces/5.3/parsing.mli new file mode 100644 index 0000000..68f1243 --- /dev/null +++ b/interfaces/5.3/parsing.mli @@ -0,0 +1,36 @@ +val symbol_start : unit -> int +val symbol_end : unit -> int +val rhs_start : int -> int +val rhs_end : int -> int +val symbol_start_pos : unit -> Lexing.position +val symbol_end_pos : unit -> Lexing.position +val rhs_start_pos : int -> Lexing.position +val rhs_end_pos : int -> Lexing.position +val clear_parser : unit -> unit +exception Parse_error +val set_trace : bool -> bool +type parser_env +type parse_tables = + { + actions: (parser_env -> Obj.t) array ; + transl_const: int array ; + transl_block: int array ; + lhs: string ; + len: string ; + defred: string ; + dgoto: string ; + sindex: string ; + rindex: string ; + gindex: string ; + tablesize: int ; + table: string ; + check: string ; + error_function: string -> unit ; + names_const: string ; + names_block: string } +exception YYexit of Obj.t +val yyparse : + parse_tables -> int -> (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'b +val peek_val : parser_env -> int -> 'a +val is_current_lookahead : 'a -> bool +val parse_error : string -> unit diff --git a/interfaces/5.3/printexc.mli b/interfaces/5.3/printexc.mli new file mode 100644 index 0000000..171ec13 --- /dev/null +++ b/interfaces/5.3/printexc.mli @@ -0,0 +1,52 @@ +type t = exn = .. +val to_string : exn -> string +val to_string_default : exn -> string +val print : ('a -> 'b) -> 'a -> 'b +val catch : ('a -> 'b) -> 'a -> 'b +val print_backtrace : out_channel -> unit +val get_backtrace : unit -> string +val record_backtrace : bool -> unit +val backtrace_status : unit -> bool +val register_printer : (exn -> string option) -> unit +val use_printers : exn -> string option +type raw_backtrace +type raw_backtrace_entry = private int +val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array +val get_raw_backtrace : unit -> raw_backtrace +val print_raw_backtrace : out_channel -> raw_backtrace -> unit +val raw_backtrace_to_string : raw_backtrace -> string +external raise_with_backtrace : + exn -> raw_backtrace -> 'a = "%raise_with_backtrace" +external get_callstack : int -> raw_backtrace = "caml_get_current_callstack" +val default_uncaught_exception_handler : exn -> raw_backtrace -> unit +val set_uncaught_exception_handler : (exn -> raw_backtrace -> unit) -> unit +type backtrace_slot +val backtrace_slots : raw_backtrace -> backtrace_slot array option +val backtrace_slots_of_raw_entry : + raw_backtrace_entry -> backtrace_slot array option +type location = + { + filename: string ; + line_number: int ; + start_char: int ; + end_char: int ; + end_line: int ; + end_col: int } +module Slot : +sig + type t = backtrace_slot + val is_raise : t -> bool + val is_inline : t -> bool + val location : t -> location option + val name : t -> string option + val format : int -> t -> string option +end +type raw_backtrace_slot +val raw_backtrace_length : raw_backtrace -> int +val get_raw_backtrace_slot : raw_backtrace -> int -> raw_backtrace_slot +val convert_raw_backtrace_slot : raw_backtrace_slot -> backtrace_slot +val get_raw_backtrace_next_slot : + raw_backtrace_slot -> raw_backtrace_slot option +val exn_slot_id : exn -> int +val exn_slot_name : exn -> string +val string_of_extension_constructor : Obj.t -> string diff --git a/interfaces/5.3/printf.mli b/interfaces/5.3/printf.mli new file mode 100644 index 0000000..d66ad22 --- /dev/null +++ b/interfaces/5.3/printf.mli @@ -0,0 +1,17 @@ +val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a +val printf : ('a, out_channel, unit) format -> 'a +val eprintf : ('a, out_channel, unit) format -> 'a +val sprintf : ('a, unit, string) format -> 'a +val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +val ifprintf : 'b -> ('a, 'b, 'c, unit) format4 -> 'a +val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +val kfprintf : + (out_channel -> 'd) -> + out_channel -> ('a, out_channel, unit, 'd) format4 -> 'a +val ikfprintf : ('b -> 'd) -> 'b -> ('a, 'b, 'c, 'd) format4 -> 'a +val ksprintf : (string -> 'd) -> ('a, unit, string, 'd) format4 -> 'a +val kbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +val ikbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +val kprintf : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a diff --git a/interfaces/5.3/queue.mli b/interfaces/5.3/queue.mli new file mode 100644 index 0000000..551a327 --- /dev/null +++ b/interfaces/5.3/queue.mli @@ -0,0 +1,22 @@ +type !'a t +exception Empty +val create : unit -> 'a t +val add : 'a -> 'a t -> unit +val push : 'a -> 'a t -> unit +val take : 'a t -> 'a +val take_opt : 'a t -> 'a option +val pop : 'a t -> 'a +val peek : 'a t -> 'a +val peek_opt : 'a t -> 'a option +val top : 'a t -> 'a +val drop : 'a t -> unit +val clear : 'a t -> unit +val copy : 'a t -> 'a t +val is_empty : 'a t -> bool +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val transfer : 'a t -> 'a t -> unit +val to_seq : 'a t -> 'a Seq.t +val add_seq : 'a t -> 'a Seq.t -> unit +val of_seq : 'a Seq.t -> 'a t diff --git a/interfaces/5.3/random.mli b/interfaces/5.3/random.mli new file mode 100644 index 0000000..f1f49e8 --- /dev/null +++ b/interfaces/5.3/random.mli @@ -0,0 +1,46 @@ +val init : int -> unit +val full_init : int array -> unit +val self_init : unit -> unit +val bits : unit -> int +val int : int -> int +val full_int : int -> int +val int_in_range : min:int -> max:int -> int +val int32 : Int32.t -> Int32.t +val int32_in_range : min:int32 -> max:int32 -> int32 +val nativeint : Nativeint.t -> Nativeint.t +val nativeint_in_range : min:nativeint -> max:nativeint -> nativeint +val int64 : Int64.t -> Int64.t +val int64_in_range : min:int64 -> max:int64 -> int64 +val float : float -> float +val bool : unit -> bool +val bits32 : unit -> Int32.t +val bits64 : unit -> Int64.t +val nativebits : unit -> Nativeint.t +module State : +sig + type t + val make : int array -> t + val make_self_init : unit -> t + val copy : t -> t + val bits : t -> int + val int : t -> int -> int + val full_int : t -> int -> int + val int_in_range : t -> min:int -> max:int -> int + val int32 : t -> Int32.t -> Int32.t + val int32_in_range : t -> min:int32 -> max:int32 -> int32 + val nativeint : t -> Nativeint.t -> Nativeint.t + val nativeint_in_range : t -> min:nativeint -> max:nativeint -> nativeint + val int64 : t -> Int64.t -> Int64.t + val int64_in_range : t -> min:int64 -> max:int64 -> int64 + val float : t -> float -> float + val bool : t -> bool + val bits32 : t -> Int32.t + val bits64 : t -> Int64.t + val nativebits : t -> Nativeint.t + val split : t -> t + val to_binary_string : t -> string + val of_binary_string : string -> t +end +val get_state : unit -> State.t +val set_state : State.t -> unit +val split : unit -> State.t diff --git a/interfaces/5.3/result.mli b/interfaces/5.3/result.mli new file mode 100644 index 0000000..06f96e6 --- /dev/null +++ b/interfaces/5.3/result.mli @@ -0,0 +1,26 @@ +type ('a, 'e) t = ('a, 'e) result = + | Ok of 'a + | Error of 'e +val ok : 'a -> ('a, 'e) result +val error : 'e -> ('a, 'e) result +val value : ('a, 'e) result -> default:'a -> 'a +val get_ok : ('a, 'e) result -> 'a +val get_error : ('a, 'e) result -> 'e +val bind : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result +val join : (('a, 'e) result, 'e) result -> ('a, 'e) result +val map : ('a -> 'b) -> ('a, 'e) result -> ('b, 'e) result +val map_error : ('e -> 'f) -> ('a, 'e) result -> ('a, 'f) result +val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) result -> 'c +val iter : ('a -> unit) -> ('a, 'e) result -> unit +val iter_error : ('e -> unit) -> ('a, 'e) result -> unit +val is_ok : ('a, 'e) result -> bool +val is_error : ('a, 'e) result -> bool +val equal : + ok:('a -> 'a -> bool) -> + error:('e -> 'e -> bool) -> ('a, 'e) result -> ('a, 'e) result -> bool +val compare : + ok:('a -> 'a -> int) -> + error:('e -> 'e -> int) -> ('a, 'e) result -> ('a, 'e) result -> int +val to_option : ('a, 'e) result -> 'a option +val to_list : ('a, 'e) result -> 'a list +val to_seq : ('a, 'e) result -> 'a Seq.t diff --git a/interfaces/5.3/scanf.mli b/interfaces/5.3/scanf.mli new file mode 100644 index 0000000..6827794 --- /dev/null +++ b/interfaces/5.3/scanf.mli @@ -0,0 +1,46 @@ +module Scanning : +sig + type in_channel + type scanbuf = in_channel + val stdin : in_channel + type file_name = string + val open_in : file_name -> in_channel + val open_in_bin : file_name -> in_channel + val close_in : in_channel -> unit + val from_file : file_name -> in_channel + val from_file_bin : string -> in_channel + val from_string : string -> in_channel + val from_function : (unit -> char) -> in_channel + val from_channel : Stdlib.in_channel -> in_channel + val end_of_input : in_channel -> bool + val beginning_of_input : in_channel -> bool + val name_of_input : in_channel -> string +end +type ('a, 'b, 'c, 'd) scanner = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd, 'd) format6 -> 'c +type ('a, 'b, 'c, 'd) scanner_opt = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd option, 'd) format6 -> 'c +exception Scan_failure of string +val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner +val bscanf_opt : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner_opt +val sscanf : string -> ('a, 'b, 'c, 'd) scanner +val sscanf_opt : string -> ('a, 'b, 'c, 'd) scanner_opt +val scanf : ('a, 'b, 'c, 'd) scanner +val scanf_opt : ('a, 'b, 'c, 'd) scanner_opt +val kscanf : + Scanning.in_channel -> + (Scanning.in_channel -> exn -> 'd) -> ('a, 'b, 'c, 'd) scanner +val ksscanf : + string -> (Scanning.in_channel -> exn -> 'd) -> ('a, 'b, 'c, 'd) scanner +val bscanf_format : + Scanning.in_channel -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> 'g +val sscanf_format : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> 'g +val format_from_string : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 +val unescaped : string -> string diff --git a/interfaces/5.3/seq.mli b/interfaces/5.3/seq.mli new file mode 100644 index 0000000..3602b2e --- /dev/null +++ b/interfaces/5.3/seq.mli @@ -0,0 +1,63 @@ +type 'a t = unit -> 'a node +and 'a node = + | Nil + | Cons of 'a * 'a t +val is_empty : 'a t -> bool +val uncons : 'a t -> ('a * 'a t) option +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val iteri : (int -> 'a -> unit) -> 'a t -> unit +val fold_lefti : ('acc -> int -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val for_all : ('a -> bool) -> 'a t -> bool +val exists : ('a -> bool) -> 'a t -> bool +val find : ('a -> bool) -> 'a t -> 'a option +val find_index : ('a -> bool) -> 'a t -> int option +val find_map : ('a -> 'b option) -> 'a t -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option +val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit +val fold_left2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc +val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int +val empty : 'a t +val return : 'a -> 'a t +val cons : 'a -> 'a t -> 'a t +val init : int -> (int -> 'a) -> 'a t +val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t +val repeat : 'a -> 'a t +val forever : (unit -> 'a) -> 'a t +val cycle : 'a t -> 'a t +val iterate : ('a -> 'a) -> 'a -> 'a t +val map : ('a -> 'b) -> 'a t -> 'b t +val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t +val filter : ('a -> bool) -> 'a t -> 'a t +val filter_map : ('a -> 'b option) -> 'a t -> 'b t +val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t +val take : int -> 'a t -> 'a t +val drop : int -> 'a t -> 'a t +val take_while : ('a -> bool) -> 'a t -> 'a t +val drop_while : ('a -> bool) -> 'a t -> 'a t +val group : ('a -> 'a -> bool) -> 'a t -> 'a t t +val memoize : 'a t -> 'a t +exception Forced_twice +val once : 'a t -> 'a t +val transpose : 'a t t -> 'a t t +val append : 'a t -> 'a t -> 'a t +val concat : 'a t t -> 'a t +val flat_map : ('a -> 'b t) -> 'a t -> 'b t +val concat_map : ('a -> 'b t) -> 'a t -> 'b t +val zip : 'a t -> 'b t -> ('a * 'b) t +val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t +val interleave : 'a t -> 'a t -> 'a t +val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t +val product : 'a t -> 'b t -> ('a * 'b) t +val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t +val unzip : ('a * 'b) t -> ('a t * 'b t) +val split : ('a * 'b) t -> ('a t * 'b t) +val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> ('b t * 'c t) +val partition : ('a -> bool) -> 'a t -> ('a t * 'a t) +val of_dispenser : (unit -> 'a option) -> 'a t +val to_dispenser : 'a t -> unit -> 'a option +val ints : int -> int t diff --git a/interfaces/5.3/set.mli b/interfaces/5.3/set.mli new file mode 100644 index 0000000..90c3c45 --- /dev/null +++ b/interfaces/5.3/set.mli @@ -0,0 +1,98 @@ +module type OrderedType = sig type t val compare : t -> t -> int end +module type S = + sig + type elt + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : (elt -> bool) -> t -> elt + val find_first_opt : (elt -> bool) -> t -> elt option + val find_last : (elt -> bool) -> t -> elt + val find_last_opt : (elt -> bool) -> t -> elt option + val iter : (elt -> unit) -> t -> unit + val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val map : (elt -> elt) -> t -> t + val filter : (elt -> bool) -> t -> t + val filter_map : (elt -> elt option) -> t -> t + val partition : (elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : (elt -> bool) -> t -> bool + val exists : (elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end +module Make : +(Ord : OrderedType) -> + sig + type elt = Ord.t + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : (elt -> bool) -> t -> elt + val find_first_opt : (elt -> bool) -> t -> elt option + val find_last : (elt -> bool) -> t -> elt + val find_last_opt : (elt -> bool) -> t -> elt option + val iter : (elt -> unit) -> t -> unit + val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val map : (elt -> elt) -> t -> t + val filter : (elt -> bool) -> t -> t + val filter_map : (elt -> elt option) -> t -> t + val partition : (elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : (elt -> bool) -> t -> bool + val exists : (elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end diff --git a/interfaces/5.3/stack.mli b/interfaces/5.3/stack.mli new file mode 100644 index 0000000..a0d39d1 --- /dev/null +++ b/interfaces/5.3/stack.mli @@ -0,0 +1,18 @@ +type !'a t +exception Empty +val create : unit -> 'a t +val push : 'a -> 'a t -> unit +val pop : 'a t -> 'a +val pop_opt : 'a t -> 'a option +val drop : 'a t -> unit +val top : 'a t -> 'a +val top_opt : 'a t -> 'a option +val clear : 'a t -> unit +val copy : 'a t -> 'a t +val is_empty : 'a t -> bool +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val to_seq : 'a t -> 'a Seq.t +val add_seq : 'a t -> 'a Seq.t -> unit +val of_seq : 'a Seq.t -> 'a t diff --git a/interfaces/5.3/stdLabels.mli b/interfaces/5.3/stdLabels.mli new file mode 100644 index 0000000..d86b996 --- /dev/null +++ b/interfaces/5.3/stdLabels.mli @@ -0,0 +1,4 @@ +module Array = ArrayLabels +module Bytes = BytesLabels +module List = ListLabels +module String = StringLabels diff --git a/interfaces/5.3/stdlib.mli b/interfaces/5.3/stdlib.mli new file mode 100644 index 0000000..413719d --- /dev/null +++ b/interfaces/5.3/stdlib.mli @@ -0,0 +1,327 @@ +external raise : exn -> 'a = "%raise" +external raise_notrace : exn -> 'a = "%raise_notrace" +val invalid_arg : string -> 'a +val failwith : string -> 'a +exception Exit +exception Match_failure of (string * int * int) +exception Assert_failure of (string * int * int) +exception Invalid_argument of string +exception Failure of string +exception Not_found +exception Out_of_memory +exception Stack_overflow +exception Sys_error of string +exception End_of_file +exception Division_by_zero +exception Sys_blocked_io +exception Undefined_recursive_module of (string * int * int) +external (=) : 'a -> 'a -> bool = "%equal" +external (<>) : 'a -> 'a -> bool = "%notequal" +external (<) : 'a -> 'a -> bool = "%lessthan" +external (>) : 'a -> 'a -> bool = "%greaterthan" +external (<=) : 'a -> 'a -> bool = "%lessequal" +external (>=) : 'a -> 'a -> bool = "%greaterequal" +external compare : 'a -> 'a -> int = "%compare" +val min : 'a -> 'a -> 'a +val max : 'a -> 'a -> 'a +external (==) : 'a -> 'a -> bool = "%eq" +external (!=) : 'a -> 'a -> bool = "%noteq" +external not : bool -> bool = "%boolnot" +external (&&) : bool -> bool -> bool = "%sequand" +external (||) : bool -> bool -> bool = "%sequor" +external __LOC__ : string = "%loc_LOC" +external __FILE__ : string = "%loc_FILE" +external __LINE__ : int = "%loc_LINE" +external __MODULE__ : string = "%loc_MODULE" +external __POS__ : (string * int * int * int) = "%loc_POS" +external __FUNCTION__ : string = "%loc_FUNCTION" +external __LOC_OF__ : 'a -> (string * 'a) = "%loc_LOC" +external __LINE_OF__ : 'a -> (int * 'a) = "%loc_LINE" +external __POS_OF__ : 'a -> ((string * int * int * int) * 'a) = "%loc_POS" +external (|>) : 'a -> ('a -> 'b) -> 'b = "%revapply" +external (@@) : ('a -> 'b) -> 'a -> 'b = "%apply" +external (~-) : int -> int = "%negint" +external (~+) : int -> int = "%identity" +external succ : int -> int = "%succint" +external pred : int -> int = "%predint" +external (+) : int -> int -> int = "%addint" +external (-) : int -> int -> int = "%subint" +external ( * ) : int -> int -> int = "%mulint" +external (/) : int -> int -> int = "%divint" +external \#mod : int -> int -> int = "%modint" +val abs : int -> int +val max_int : int +val min_int : int +external \#land : int -> int -> int = "%andint" +external \#lor : int -> int -> int = "%orint" +external \#lxor : int -> int -> int = "%xorint" +val lnot : int -> int +external \#lsl : int -> int -> int = "%lslint" +external \#lsr : int -> int -> int = "%lsrint" +external \#asr : int -> int -> int = "%asrint" +external (~-.) : float -> float = "%negfloat" +external (~+.) : float -> float = "%identity" +external (+.) : float -> float -> float = "%addfloat" +external (-.) : float -> float -> float = "%subfloat" +external ( *. ) : float -> float -> float = "%mulfloat" +external (/.) : float -> float -> float = "%divfloat" +external ( ** ) : float -> float -> float = "caml_power_float" "pow"[@@unboxed + ] +[@@noalloc ] +external sqrt : float -> float = "caml_sqrt_float" "sqrt"[@@unboxed ] +[@@noalloc ] +external exp : float -> float = "caml_exp_float" "exp"[@@unboxed ][@@noalloc + ] +external log : float -> float = "caml_log_float" "log"[@@unboxed ][@@noalloc + ] +external log10 : float -> float = "caml_log10_float" "log10"[@@unboxed ] +[@@noalloc ] +external expm1 : float -> float = "caml_expm1_float" "caml_expm1"[@@unboxed ] +[@@noalloc ] +external log1p : float -> float = "caml_log1p_float" "caml_log1p"[@@unboxed ] +[@@noalloc ] +external cos : float -> float = "caml_cos_float" "cos"[@@unboxed ][@@noalloc + ] +external sin : float -> float = "caml_sin_float" "sin"[@@unboxed ][@@noalloc + ] +external tan : float -> float = "caml_tan_float" "tan"[@@unboxed ][@@noalloc + ] +external acos : float -> float = "caml_acos_float" "acos"[@@unboxed ] +[@@noalloc ] +external asin : float -> float = "caml_asin_float" "asin"[@@unboxed ] +[@@noalloc ] +external atan : float -> float = "caml_atan_float" "atan"[@@unboxed ] +[@@noalloc ] +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" +[@@unboxed ][@@noalloc ] +external hypot : float -> float -> float = "caml_hypot_float" "caml_hypot" +[@@unboxed ][@@noalloc ] +external cosh : float -> float = "caml_cosh_float" "cosh"[@@unboxed ] +[@@noalloc ] +external sinh : float -> float = "caml_sinh_float" "sinh"[@@unboxed ] +[@@noalloc ] +external tanh : float -> float = "caml_tanh_float" "tanh"[@@unboxed ] +[@@noalloc ] +external acosh : float -> float = "caml_acosh_float" "caml_acosh"[@@unboxed ] +[@@noalloc ] +external asinh : float -> float = "caml_asinh_float" "caml_asinh"[@@unboxed ] +[@@noalloc ] +external atanh : float -> float = "caml_atanh_float" "caml_atanh"[@@unboxed ] +[@@noalloc ] +external ceil : float -> float = "caml_ceil_float" "ceil"[@@unboxed ] +[@@noalloc ] +external floor : float -> float = "caml_floor_float" "floor"[@@unboxed ] +[@@noalloc ] +external abs_float : float -> float = "%absfloat" +external copysign : + float -> float -> float = "caml_copysign_float" "caml_copysign"[@@unboxed ] +[@@noalloc ] +external mod_float : float -> float -> float = "caml_fmod_float" "fmod" +[@@unboxed ][@@noalloc ] +external frexp : float -> (float * int) = "caml_frexp_float" +external ldexp : + ((float)[@unboxed ]) -> ((int)[@untagged ]) -> ((float)[@unboxed ]) = + "caml_ldexp_float" "caml_ldexp_float_unboxed"[@@noalloc ] +external modf : float -> (float * float) = "caml_modf_float" +external float : int -> float = "%floatofint" +external float_of_int : int -> float = "%floatofint" +external truncate : float -> int = "%intoffloat" +external int_of_float : float -> int = "%intoffloat" +val infinity : float +val neg_infinity : float +val nan : float +val max_float : float +val min_float : float +val epsilon_float : float +type fpclass = + | FP_normal + | FP_subnormal + | FP_zero + | FP_infinite + | FP_nan +external classify_float : + ((float)[@unboxed ]) -> fpclass = "caml_classify_float" + "caml_classify_float_unboxed"[@@noalloc ] +val (^) : string -> string -> string +external int_of_char : char -> int = "%identity" +val char_of_int : int -> char +external ignore : 'a -> unit = "%ignore" +val string_of_bool : bool -> string +val bool_of_string_opt : string -> bool option +val bool_of_string : string -> bool +val string_of_int : int -> string +val int_of_string_opt : string -> int option +external int_of_string : string -> int = "caml_int_of_string" +val string_of_float : float -> string +val float_of_string_opt : string -> float option +external float_of_string : string -> float = "caml_float_of_string" +external fst : ('a * 'b) -> 'a = "%field0" +external snd : ('a * 'b) -> 'b = "%field1" +val (@) : 'a list -> 'a list -> 'a list +type in_channel +type out_channel +val stdin : in_channel +val stdout : out_channel +val stderr : out_channel +val print_char : char -> unit +val print_string : string -> unit +val print_bytes : bytes -> unit +val print_int : int -> unit +val print_float : float -> unit +val print_endline : string -> unit +val print_newline : unit -> unit +val prerr_char : char -> unit +val prerr_string : string -> unit +val prerr_bytes : bytes -> unit +val prerr_int : int -> unit +val prerr_float : float -> unit +val prerr_endline : string -> unit +val prerr_newline : unit -> unit +val read_line : unit -> string +val read_int_opt : unit -> int option +val read_int : unit -> int +val read_float_opt : unit -> float option +val read_float : unit -> float +type open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val open_out : string -> out_channel +val open_out_bin : string -> out_channel +val open_out_gen : open_flag list -> int -> string -> out_channel +val flush : out_channel -> unit +val flush_all : unit -> unit +val output_char : out_channel -> char -> unit +val output_string : out_channel -> string -> unit +val output_bytes : out_channel -> bytes -> unit +val output : out_channel -> bytes -> int -> int -> unit +val output_substring : out_channel -> string -> int -> int -> unit +val output_byte : out_channel -> int -> unit +val output_binary_int : out_channel -> int -> unit +val output_value : out_channel -> 'a -> unit +val seek_out : out_channel -> int -> unit +val pos_out : out_channel -> int +val out_channel_length : out_channel -> int +val close_out : out_channel -> unit +val close_out_noerr : out_channel -> unit +val set_binary_mode_out : out_channel -> bool -> unit +val open_in : string -> in_channel +val open_in_bin : string -> in_channel +val open_in_gen : open_flag list -> int -> string -> in_channel +val input_char : in_channel -> char +val input_line : in_channel -> string +val input : in_channel -> bytes -> int -> int -> int +val really_input : in_channel -> bytes -> int -> int -> unit +val really_input_string : in_channel -> int -> string +val input_byte : in_channel -> int +val input_binary_int : in_channel -> int +val input_value : in_channel -> 'a +val seek_in : in_channel -> int -> unit +val pos_in : in_channel -> int +val in_channel_length : in_channel -> int +val close_in : in_channel -> unit +val close_in_noerr : in_channel -> unit +val set_binary_mode_in : in_channel -> bool -> unit +module LargeFile : +sig + val seek_out : out_channel -> int64 -> unit + val pos_out : out_channel -> int64 + val out_channel_length : out_channel -> int64 + val seek_in : in_channel -> int64 -> unit + val pos_in : in_channel -> int64 + val in_channel_length : in_channel -> int64 +end +type 'a ref = { + mutable contents: 'a } +external ref : 'a -> 'a ref = "%makemutable" +external (!) : 'a ref -> 'a = "%field0" +external (:=) : 'a ref -> 'a -> unit = "%setfield0" +external incr : int ref -> unit = "%incr" +external decr : int ref -> unit = "%decr" +type ('a, 'b) result = + | Ok of 'a + | Error of 'b +type ('a, 'b, 'c, 'd, 'e, 'f) format6 = + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6 +type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6 +type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4 +val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string +external format_of_string : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 = + "%identity" +val (^^) : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6 +val exit : int -> 'a +val at_exit : (unit -> unit) -> unit +val valid_float_lexem : string -> string +val unsafe_really_input : in_channel -> bytes -> int -> int -> unit +val do_at_exit : unit -> unit +val do_domain_local_at_exit : (unit -> unit) ref +module Arg = Arg +module Array = Array +module ArrayLabels = ArrayLabels +module Atomic = Atomic +module Bigarray = Bigarray +module Bool = Bool +module Buffer = Buffer +module Bytes = Bytes +module BytesLabels = BytesLabels +module Callback = Callback +module Char = Char +module Complex = Complex +module Condition = Condition +module Digest = Digest +module Domain = Domain +module Dynarray = Dynarray +module Effect = Effect +module Either = Either +module Ephemeron = Ephemeron +module Filename = Filename +module Float = Float +module Format = Format +module Fun = Fun +module Gc = Gc +module Hashtbl = Hashtbl +module In_channel = In_channel +module Int = Int +module Int32 = Int32 +module Int64 = Int64 +module Lazy = Lazy +module Lexing = Lexing +module List = List +module ListLabels = ListLabels +module Map = Map +module Marshal = Marshal +module MoreLabels = MoreLabels +module Mutex = Mutex +module Nativeint = Nativeint +module Obj = Obj +module Oo = Oo +module Option = Option +module Out_channel = Out_channel +module Parsing = Parsing +module Printexc = Printexc +module Printf = Printf +module Queue = Queue +module Random = Random +module Result = Result +module Scanf = Scanf +module Semaphore = Semaphore +module Seq = Seq +module Set = Set +module Stack = Stack +module StdLabels = StdLabels +module String = String +module StringLabels = StringLabels +module Sys = Sys +module Type = Type +module Uchar = Uchar +module Unit = Unit +module Weak = Weak diff --git a/interfaces/5.3/string.mli b/interfaces/5.3/string.mli new file mode 100644 index 0000000..137369a --- /dev/null +++ b/interfaces/5.3/string.mli @@ -0,0 +1,71 @@ +type t = string +val make : int -> char -> string +val init : int -> (int -> char) -> string +val empty : string +external length : string -> int = "%string_length" +external get : string -> int -> char = "%string_safe_get" +val of_bytes : bytes -> string +val to_bytes : string -> bytes +val blit : string -> int -> bytes -> int -> int -> unit +val concat : string -> string list -> string +val cat : string -> string -> string +val equal : t -> t -> bool +val compare : t -> t -> int +val starts_with : prefix:string -> string -> bool +val ends_with : suffix:string -> string -> bool +val contains_from : string -> int -> char -> bool +val rcontains_from : string -> int -> char -> bool +val contains : string -> char -> bool +val sub : string -> int -> int -> string +val split_on_char : char -> string -> string list +val map : (char -> char) -> string -> string +val mapi : (int -> char -> char) -> string -> string +val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc +val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc +val for_all : (char -> bool) -> string -> bool +val exists : (char -> bool) -> string -> bool +val trim : string -> string +val escaped : string -> string +val uppercase_ascii : string -> string +val lowercase_ascii : string -> string +val capitalize_ascii : string -> string +val uncapitalize_ascii : string -> string +val iter : (char -> unit) -> string -> unit +val iteri : (int -> char -> unit) -> string -> unit +val index_from : string -> int -> char -> int +val index_from_opt : string -> int -> char -> int option +val rindex_from : string -> int -> char -> int +val rindex_from_opt : string -> int -> char -> int option +val index : string -> char -> int +val index_opt : string -> char -> int option +val rindex : string -> char -> int +val rindex_opt : string -> char -> int option +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16le : t -> bool +val get_uint8 : string -> int -> int +val get_int8 : string -> int -> int +val get_uint16_ne : string -> int -> int +val get_uint16_be : string -> int -> int +val get_uint16_le : string -> int -> int +val get_int16_ne : string -> int -> int +val get_int16_be : string -> int -> int +val get_int16_le : string -> int -> int +val get_int32_ne : string -> int -> int32 +val hash : t -> int +val seeded_hash : int -> t -> int +val get_int32_be : string -> int -> int32 +val get_int32_le : string -> int -> int32 +val get_int64_ne : string -> int -> int64 +val get_int64_be : string -> int -> int64 +val get_int64_le : string -> int -> int64 +external unsafe_get : string -> int -> char = "%string_unsafe_get" +external unsafe_blit : + string -> int -> bytes -> int -> int -> unit = "caml_blit_string"[@@noalloc + ] diff --git a/interfaces/5.3/stringLabels.mli b/interfaces/5.3/stringLabels.mli new file mode 100644 index 0000000..d753cbc --- /dev/null +++ b/interfaces/5.3/stringLabels.mli @@ -0,0 +1,72 @@ +type t = string +val make : int -> char -> string +val init : int -> f:(int -> char) -> string +val empty : string +external length : string -> int = "%string_length" +external get : string -> int -> char = "%string_safe_get" +val of_bytes : bytes -> string +val to_bytes : string -> bytes +val blit : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val concat : sep:string -> string list -> string +val cat : string -> string -> string +val equal : t -> t -> bool +val compare : t -> t -> int +val starts_with : prefix:string -> string -> bool +val ends_with : suffix:string -> string -> bool +val contains_from : string -> int -> char -> bool +val rcontains_from : string -> int -> char -> bool +val contains : string -> char -> bool +val sub : string -> pos:int -> len:int -> string +val split_on_char : sep:char -> string -> string list +val map : f:(char -> char) -> string -> string +val mapi : f:(int -> char -> char) -> string -> string +val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> string -> 'acc +val fold_right : f:(char -> 'acc -> 'acc) -> string -> init:'acc -> 'acc +val for_all : f:(char -> bool) -> string -> bool +val exists : f:(char -> bool) -> string -> bool +val trim : string -> string +val escaped : string -> string +val uppercase_ascii : string -> string +val lowercase_ascii : string -> string +val capitalize_ascii : string -> string +val uncapitalize_ascii : string -> string +val iter : f:(char -> unit) -> string -> unit +val iteri : f:(int -> char -> unit) -> string -> unit +val index_from : string -> int -> char -> int +val index_from_opt : string -> int -> char -> int option +val rindex_from : string -> int -> char -> int +val rindex_from_opt : string -> int -> char -> int option +val index : string -> char -> int +val index_opt : string -> char -> int option +val rindex : string -> char -> int +val rindex_opt : string -> char -> int option +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16le : t -> bool +val get_uint8 : string -> int -> int +val get_int8 : string -> int -> int +val get_uint16_ne : string -> int -> int +val get_uint16_be : string -> int -> int +val get_uint16_le : string -> int -> int +val get_int16_ne : string -> int -> int +val get_int16_be : string -> int -> int +val get_int16_le : string -> int -> int +val get_int32_ne : string -> int -> int32 +val hash : t -> int +val seeded_hash : int -> t -> int +val get_int32_be : string -> int -> int32 +val get_int32_le : string -> int -> int32 +val get_int64_ne : string -> int -> int64 +val get_int64_be : string -> int -> int64 +val get_int64_le : string -> int -> int64 +external unsafe_get : string -> int -> char = "%string_unsafe_get" +external unsafe_blit : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_string"[@@noalloc ] diff --git a/interfaces/5.3/sys.mli b/interfaces/5.3/sys.mli new file mode 100644 index 0000000..6c2d632 --- /dev/null +++ b/interfaces/5.3/sys.mli @@ -0,0 +1,105 @@ +external argv : string array = "%sys_argv" +val executable_name : string +external file_exists : string -> bool = "caml_sys_file_exists" +external is_directory : string -> bool = "caml_sys_is_directory" +external is_regular_file : string -> bool = "caml_sys_is_regular_file" +external remove : string -> unit = "caml_sys_remove" +external rename : string -> string -> unit = "caml_sys_rename" +external getenv : string -> string = "caml_sys_getenv" +val getenv_opt : string -> string option +external command : string -> int = "caml_sys_system_command" +external time : + unit -> ((float)[@unboxed ]) = "caml_sys_time" "caml_sys_time_unboxed" +[@@noalloc ] +external chdir : string -> unit = "caml_sys_chdir" +external mkdir : string -> int -> unit = "caml_sys_mkdir" +external rmdir : string -> unit = "caml_sys_rmdir" +external getcwd : unit -> string = "caml_sys_getcwd" +external readdir : string -> string array = "caml_sys_read_directory" +val interactive : bool ref +val os_type : string +type backend_type = + | Native + | Bytecode + | Other of string +val backend_type : backend_type +val unix : bool +val win32 : bool +val cygwin : bool +val word_size : int +val int_size : int +val big_endian : bool +val max_string_length : int +val max_array_length : int +val max_floatarray_length : int +external runtime_variant : unit -> string = "caml_runtime_variant" +external runtime_parameters : unit -> string = "caml_runtime_parameters" +external poll_actions : unit -> unit = "%poll" +type signal_behavior = + | Signal_default + | Signal_ignore + | Signal_handle of (int -> unit) +external signal : + int -> signal_behavior -> signal_behavior = "caml_install_signal_handler" +val set_signal : int -> signal_behavior -> unit +val sigabrt : int +val sigalrm : int +val sigfpe : int +val sighup : int +val sigill : int +val sigint : int +val sigkill : int +val sigpipe : int +val sigquit : int +val sigsegv : int +val sigterm : int +val sigusr1 : int +val sigusr2 : int +val sigchld : int +val sigcont : int +val sigstop : int +val sigtstp : int +val sigttin : int +val sigttou : int +val sigvtalrm : int +val sigprof : int +val sigbus : int +val sigpoll : int +val sigsys : int +val sigtrap : int +val sigurg : int +val sigxcpu : int +val sigxfsz : int +exception Break +val catch_break : bool -> unit +val ocaml_version : string +val development_version : bool +type extra_prefix = + | Plus + | Tilde +type extra_info = (extra_prefix * string) +type ocaml_release_info = + { + major: int ; + minor: int ; + patchlevel: int ; + extra: extra_info option } +val ocaml_release : ocaml_release_info +val enable_runtime_warnings : bool -> unit +val runtime_warnings_enabled : unit -> bool +external opaque_identity : 'a -> 'a = "%opaque" +module Immediate64 : +sig + module type Non_immediate = sig type t end + module type Immediate = sig type t[@@immediate ] end + module Make : + (Immediate : Immediate) -> + (Non_immediate : Non_immediate) -> + sig + type t[@@immediate64 ] + type 'a repr = + | Immediate: Immediate.t repr + | Non_immediate: Non_immediate.t repr + val repr : t repr + end +end diff --git a/interfaces/5.3/uchar.mli b/interfaces/5.3/uchar.mli new file mode 100644 index 0000000..5b38001 --- /dev/null +++ b/interfaces/5.3/uchar.mli @@ -0,0 +1,27 @@ +type t[@@immediate ] +val min : t +val max : t +val bom : t +val rep : t +val succ : t -> t +val pred : t -> t +val is_valid : int -> bool +val of_int : int -> t +val unsafe_of_int : int -> t +val to_int : t -> int +val is_char : t -> bool +val of_char : char -> t +val to_char : t -> char +val unsafe_to_char : t -> char +val equal : t -> t -> bool +val compare : t -> t -> int +val seeded_hash : int -> t -> int +val hash : t -> int +type utf_decode[@@immediate ] +val utf_decode_is_valid : utf_decode -> bool +val utf_decode_uchar : utf_decode -> t +val utf_decode_length : utf_decode -> int +val utf_decode : int -> t -> utf_decode +val utf_decode_invalid : int -> utf_decode +val utf_8_byte_length : t -> int +val utf_16_byte_length : t -> int diff --git a/interfaces/5.3/unit.mli b/interfaces/5.3/unit.mli new file mode 100644 index 0000000..1efbc15 --- /dev/null +++ b/interfaces/5.3/unit.mli @@ -0,0 +1,5 @@ +type t = unit = + | () +val equal : t -> t -> bool +val compare : t -> t -> int +val to_string : t -> string diff --git a/interfaces/5.3/weak.mli b/interfaces/5.3/weak.mli new file mode 100644 index 0000000..15fe75a --- /dev/null +++ b/interfaces/5.3/weak.mli @@ -0,0 +1,46 @@ +type !'a t +val create : int -> 'a t +val length : 'a t -> int +val set : 'a t -> int -> 'a option -> unit +val get : 'a t -> int -> 'a option +val get_copy : 'a t -> int -> 'a option +val check : 'a t -> int -> bool +val fill : 'a t -> int -> int -> 'a option -> unit +val blit : 'a t -> int -> 'a t -> int -> int -> unit +module type S = + sig + type data + type t + val create : int -> t + val clear : t -> unit + val merge : t -> data -> data + val add : t -> data -> unit + val remove : t -> data -> unit + val find : t -> data -> data + val find_opt : t -> data -> data option + val find_all : t -> data -> data list + val mem : t -> data -> bool + val iter : (data -> unit) -> t -> unit + val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val count : t -> int + val stats : t -> (int * int * int * int * int * int) + end +module Make : +(H : Hashtbl.HashedType) -> + sig + type data = H.t + type t + val create : int -> t + val clear : t -> unit + val merge : t -> data -> data + val add : t -> data -> unit + val remove : t -> data -> unit + val find : t -> data -> data + val find_opt : t -> data -> data option + val find_all : t -> data -> data list + val mem : t -> data -> bool + val iter : (data -> unit) -> t -> unit + val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val count : t -> int + val stats : t -> (int * int * int * int * int * int) + end diff --git a/interfaces/5.4/arg.mli b/interfaces/5.4/arg.mli new file mode 100644 index 0000000..60f0886 --- /dev/null +++ b/interfaces/5.4/arg.mli @@ -0,0 +1,44 @@ +type spec = + | Unit of (unit -> unit) + | Bool of (bool -> unit) + | Set of bool ref + | Clear of bool ref + | String of (string -> unit) + | Set_string of string ref + | Int of (int -> unit) + | Set_int of int ref + | Float of (float -> unit) + | Set_float of float ref + | Tuple of spec list + | Symbol of string list * (string -> unit) + | Rest of (string -> unit) + | Rest_all of (string list -> unit) + | Expand of (string -> string array) +type key = string +type doc = string +type usage_msg = string +type anon_fun = string -> unit +val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit +val parse_dynamic : + (key * spec * doc) list ref -> anon_fun -> usage_msg -> unit +val parse_argv : + ?current:int ref -> + string array -> (key * spec * doc) list -> anon_fun -> usage_msg -> unit +val parse_argv_dynamic : + ?current:int ref -> + string array -> (key * spec * doc) list ref -> anon_fun -> string -> unit +val parse_and_expand_argv_dynamic : + int ref -> + string array ref -> + (key * spec * doc) list ref -> anon_fun -> string -> unit +val parse_expand : (key * spec * doc) list -> anon_fun -> usage_msg -> unit +exception Help of string +exception Bad of string +val usage : (key * spec * doc) list -> usage_msg -> unit +val usage_string : (key * spec * doc) list -> usage_msg -> string +val align : ?limit:int -> (key * spec * doc) list -> (key * spec * doc) list +val current : int ref +val read_arg : string -> string array +val read_arg0 : string -> string array +val write_arg : string -> string array -> unit +val write_arg0 : string -> string array -> unit diff --git a/interfaces/5.4/array.mli b/interfaces/5.4/array.mli new file mode 100644 index 0000000..6413d98 --- /dev/null +++ b/interfaces/5.4/array.mli @@ -0,0 +1,62 @@ +type 'a t = 'a array +external length : 'a array -> int = "%array_length" +external get : 'a array -> int -> 'a = "%array_safe_get" +external set : 'a array -> int -> 'a -> unit = "%array_safe_set" +external make : int -> 'a -> 'a array = "caml_array_make" +external create_float : int -> float array = "caml_array_create_float" +val init : int -> (int -> 'a) -> 'a array +val make_matrix : int -> int -> 'a -> 'a array array +val init_matrix : int -> int -> (int -> int -> 'a) -> 'a array array +val append : 'a array -> 'a array -> 'a array +val concat : 'a array list -> 'a array +val sub : 'a array -> int -> int -> 'a array +val copy : 'a array -> 'a array +val fill : 'a array -> int -> int -> 'a -> unit +val blit : 'a array -> int -> 'a array -> int -> int -> unit +val to_list : 'a array -> 'a list +val of_list : 'a list -> 'a array +val equal : ('a -> 'a -> bool) -> 'a array -> 'a array -> bool +val compare : ('a -> 'a -> int) -> 'a array -> 'a array -> int +val iter : ('a -> unit) -> 'a array -> unit +val iteri : (int -> 'a -> unit) -> 'a array -> unit +val map : ('a -> 'b) -> 'a array -> 'b array +val map_inplace : ('a -> 'a) -> 'a array -> unit +val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array +val mapi_inplace : (int -> 'a -> 'a) -> 'a array -> unit +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a array -> 'acc +val fold_left_map : + ('acc -> 'a -> ('acc * 'b)) -> 'acc -> 'a array -> ('acc * 'b array) +val fold_right : ('a -> 'acc -> 'acc) -> 'a array -> 'acc -> 'acc +val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit +val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array +val for_all : ('a -> bool) -> 'a array -> bool +val exists : ('a -> bool) -> 'a array -> bool +val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val mem : 'a -> 'a array -> bool +val memq : 'a -> 'a array -> bool +val find_opt : ('a -> bool) -> 'a array -> 'a option +val find_index : ('a -> bool) -> 'a array -> int option +val find_map : ('a -> 'b option) -> 'a array -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a array -> 'b option +val split : ('a * 'b) array -> ('a array * 'b array) +val combine : 'a array -> 'b array -> ('a * 'b) array +val sort : ('a -> 'a -> int) -> 'a array -> unit +val stable_sort : ('a -> 'a -> int) -> 'a array -> unit +val fast_sort : ('a -> 'a -> int) -> 'a array -> unit +val shuffle : rand:(int -> int) -> 'a array -> unit +val to_seq : 'a array -> 'a Seq.t +val to_seqi : 'a array -> (int * 'a) Seq.t +val of_seq : 'a Seq.t -> 'a array +external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" +external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" +module Floatarray : +sig + external create : int -> floatarray = "caml_floatarray_create" + external length : floatarray -> int = "%floatarray_length" + external get : floatarray -> int -> float = "%floatarray_safe_get" + external set : floatarray -> int -> float -> unit = "%floatarray_safe_set" + external unsafe_get : floatarray -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : + floatarray -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.4/arrayLabels.mli b/interfaces/5.4/arrayLabels.mli new file mode 100644 index 0000000..a518e64 --- /dev/null +++ b/interfaces/5.4/arrayLabels.mli @@ -0,0 +1,65 @@ +type 'a t = 'a array +external length : 'a array -> int = "%array_length" +external get : 'a array -> int -> 'a = "%array_safe_get" +external set : 'a array -> int -> 'a -> unit = "%array_safe_set" +external make : int -> 'a -> 'a array = "caml_array_make" +external create_float : int -> float array = "caml_array_create_float" +val init : int -> f:(int -> 'a) -> 'a array +val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array +val init_matrix : + dimx:int -> dimy:int -> f:(int -> int -> 'a) -> 'a array array +val append : 'a array -> 'a array -> 'a array +val concat : 'a array list -> 'a array +val sub : 'a array -> pos:int -> len:int -> 'a array +val copy : 'a array -> 'a array +val fill : 'a array -> pos:int -> len:int -> 'a -> unit +val blit : + src:'a array -> + src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> unit +val to_list : 'a array -> 'a list +val of_list : 'a list -> 'a array +val equal : eq:('a -> 'a -> bool) -> 'a array -> 'a array -> bool +val compare : cmp:('a -> 'a -> int) -> 'a array -> 'a array -> int +val iter : f:('a -> unit) -> 'a array -> unit +val iteri : f:(int -> 'a -> unit) -> 'a array -> unit +val map : f:('a -> 'b) -> 'a array -> 'b array +val map_inplace : f:('a -> 'a) -> 'a array -> unit +val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array +val mapi_inplace : f:(int -> 'a -> 'a) -> 'a array -> unit +val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a array -> 'acc +val fold_left_map : + f:('acc -> 'a -> ('acc * 'b)) -> init:'acc -> 'a array -> ('acc * 'b array) +val fold_right : f:('a -> 'acc -> 'acc) -> 'a array -> init:'acc -> 'acc +val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit +val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array +val for_all : f:('a -> bool) -> 'a array -> bool +val exists : f:('a -> bool) -> 'a array -> bool +val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val mem : 'a -> set:'a array -> bool +val memq : 'a -> set:'a array -> bool +val find_opt : f:('a -> bool) -> 'a array -> 'a option +val find_index : f:('a -> bool) -> 'a array -> int option +val find_map : f:('a -> 'b option) -> 'a array -> 'b option +val find_mapi : f:(int -> 'a -> 'b option) -> 'a array -> 'b option +val split : ('a * 'b) array -> ('a array * 'b array) +val combine : 'a array -> 'b array -> ('a * 'b) array +val sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val shuffle : rand:(int -> int) -> 'a array -> unit +val to_seq : 'a array -> 'a Seq.t +val to_seqi : 'a array -> (int * 'a) Seq.t +val of_seq : 'a Seq.t -> 'a array +external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" +external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" +module Floatarray : +sig + external create : int -> floatarray = "caml_floatarray_create" + external length : floatarray -> int = "%floatarray_length" + external get : floatarray -> int -> float = "%floatarray_safe_get" + external set : floatarray -> int -> float -> unit = "%floatarray_safe_set" + external unsafe_get : floatarray -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : + floatarray -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.4/atomic.mli b/interfaces/5.4/atomic.mli new file mode 100644 index 0000000..4905c0d --- /dev/null +++ b/interfaces/5.4/atomic.mli @@ -0,0 +1,21 @@ +type !'a t +val make : 'a -> 'a t +val make_contended : 'a -> 'a t +val get : 'a t -> 'a +val set : 'a t -> 'a -> unit +val exchange : 'a t -> 'a -> 'a +val compare_and_set : 'a t -> 'a -> 'a -> bool +val fetch_and_add : int t -> int -> int +val incr : int t -> unit +val decr : int t -> unit +module Loc : +sig + type 'a t = 'a atomic_loc + external get : 'a t -> 'a = "%atomic_load_loc" + val set : 'a t -> 'a -> unit + external exchange : 'a t -> 'a -> 'a = "%atomic_exchange_loc" + external compare_and_set : 'a t -> 'a -> 'a -> bool = "%atomic_cas_loc" + external fetch_and_add : int t -> int -> int = "%atomic_fetch_add_loc" + val incr : int t -> unit + val decr : int t -> unit +end diff --git a/interfaces/5.4/bool.mli b/interfaces/5.4/bool.mli new file mode 100644 index 0000000..93acb51 --- /dev/null +++ b/interfaces/5.4/bool.mli @@ -0,0 +1,16 @@ +type t = bool = + | false + | true +val not : bool -> bool +external (&&) : bool -> bool -> bool = "%sequand" +external (||) : bool -> bool -> bool = "%sequor" +val logand : bool -> bool -> bool +val logor : bool -> bool -> bool +val logxor : bool -> bool -> bool +val equal : bool -> bool -> bool +val compare : bool -> bool -> int +val to_int : bool -> int +val to_float : bool -> float +val to_string : bool -> string +val seeded_hash : int -> bool -> int +val hash : bool -> int diff --git a/interfaces/5.4/buffer.mli b/interfaces/5.4/buffer.mli new file mode 100644 index 0000000..939ff6b --- /dev/null +++ b/interfaces/5.4/buffer.mli @@ -0,0 +1,41 @@ +type t +val create : int -> t +val contents : t -> string +val to_bytes : t -> bytes +val sub : t -> int -> int -> string +val blit : t -> int -> bytes -> int -> int -> unit +val nth : t -> int -> char +val length : t -> int +val clear : t -> unit +val reset : t -> unit +val output_buffer : out_channel -> t -> unit +val truncate : t -> int -> unit +val add_char : t -> char -> unit +val add_utf_8_uchar : t -> Uchar.t -> unit +val add_utf_16le_uchar : t -> Uchar.t -> unit +val add_utf_16be_uchar : t -> Uchar.t -> unit +val add_string : t -> string -> unit +val add_bytes : t -> bytes -> unit +val add_substring : t -> string -> int -> int -> unit +val add_subbytes : t -> bytes -> int -> int -> unit +val add_substitute : t -> (string -> string) -> string -> unit +val add_buffer : t -> t -> unit +val add_channel : t -> in_channel -> int -> unit +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val add_seq : t -> char Seq.t -> unit +val of_seq : char Seq.t -> t +val add_uint8 : t -> int -> unit +val add_int8 : t -> int -> unit +val add_uint16_ne : t -> int -> unit +val add_uint16_be : t -> int -> unit +val add_uint16_le : t -> int -> unit +val add_int16_ne : t -> int -> unit +val add_int16_be : t -> int -> unit +val add_int16_le : t -> int -> unit +val add_int32_ne : t -> int32 -> unit +val add_int32_be : t -> int32 -> unit +val add_int32_le : t -> int32 -> unit +val add_int64_ne : t -> int64 -> unit +val add_int64_be : t -> int64 -> unit +val add_int64_le : t -> int64 -> unit diff --git a/interfaces/5.4/bytes.mli b/interfaces/5.4/bytes.mli new file mode 100644 index 0000000..35ce14a --- /dev/null +++ b/interfaces/5.4/bytes.mli @@ -0,0 +1,101 @@ +external length : bytes -> int = "%bytes_length" +external get : bytes -> int -> char = "%bytes_safe_get" +external set : bytes -> int -> char -> unit = "%bytes_safe_set" +external create : int -> bytes = "caml_create_bytes" +val make : int -> char -> bytes +val init : int -> (int -> char) -> bytes +val empty : bytes +val copy : bytes -> bytes +val of_string : string -> bytes +val to_string : bytes -> string +val sub : bytes -> int -> int -> bytes +val sub_string : bytes -> int -> int -> string +val extend : bytes -> int -> int -> bytes +val fill : bytes -> int -> int -> char -> unit +val blit : bytes -> int -> bytes -> int -> int -> unit +val blit_string : string -> int -> bytes -> int -> int -> unit +val concat : bytes -> bytes list -> bytes +val cat : bytes -> bytes -> bytes +val iter : (char -> unit) -> bytes -> unit +val iteri : (int -> char -> unit) -> bytes -> unit +val map : (char -> char) -> bytes -> bytes +val mapi : (int -> char -> char) -> bytes -> bytes +val fold_left : ('acc -> char -> 'acc) -> 'acc -> bytes -> 'acc +val fold_right : (char -> 'acc -> 'acc) -> bytes -> 'acc -> 'acc +val for_all : (char -> bool) -> bytes -> bool +val exists : (char -> bool) -> bytes -> bool +val trim : bytes -> bytes +val escaped : bytes -> bytes +val index : bytes -> char -> int +val index_opt : bytes -> char -> int option +val rindex : bytes -> char -> int +val rindex_opt : bytes -> char -> int option +val index_from : bytes -> int -> char -> int +val index_from_opt : bytes -> int -> char -> int option +val rindex_from : bytes -> int -> char -> int +val rindex_from_opt : bytes -> int -> char -> int option +val contains : bytes -> char -> bool +val contains_from : bytes -> int -> char -> bool +val rcontains_from : bytes -> int -> char -> bool +val uppercase_ascii : bytes -> bytes +val lowercase_ascii : bytes -> bytes +val capitalize_ascii : bytes -> bytes +val uncapitalize_ascii : bytes -> bytes +type t = bytes +val compare : t -> t -> int +val equal : t -> t -> bool +val starts_with : prefix:bytes -> bytes -> bool +val ends_with : suffix:bytes -> bytes -> bool +val unsafe_to_string : bytes -> string +val unsafe_of_string : string -> bytes +val split_on_char : char -> bytes -> bytes list +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val set_utf_8_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val set_utf_16be_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val set_utf_16le_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16le : t -> bool +val get_uint8 : bytes -> int -> int +val get_int8 : bytes -> int -> int +val get_uint16_ne : bytes -> int -> int +val get_uint16_be : bytes -> int -> int +val get_uint16_le : bytes -> int -> int +val get_int16_ne : bytes -> int -> int +val get_int16_be : bytes -> int -> int +val get_int16_le : bytes -> int -> int +val get_int32_ne : bytes -> int -> int32 +val get_int32_be : bytes -> int -> int32 +val get_int32_le : bytes -> int -> int32 +val get_int64_ne : bytes -> int -> int64 +val get_int64_be : bytes -> int -> int64 +val get_int64_le : bytes -> int -> int64 +val set_uint8 : bytes -> int -> int -> unit +val set_int8 : bytes -> int -> int -> unit +val set_uint16_ne : bytes -> int -> int -> unit +val set_uint16_be : bytes -> int -> int -> unit +val set_uint16_le : bytes -> int -> int -> unit +val set_int16_ne : bytes -> int -> int -> unit +val set_int16_be : bytes -> int -> int -> unit +val set_int16_le : bytes -> int -> int -> unit +val set_int32_ne : bytes -> int -> int32 -> unit +val set_int32_be : bytes -> int -> int32 -> unit +val set_int32_le : bytes -> int -> int32 -> unit +val set_int64_ne : bytes -> int -> int64 -> unit +val set_int64_be : bytes -> int -> int64 -> unit +val set_int64_le : bytes -> int -> int64 -> unit +external unsafe_get : bytes -> int -> char = "%bytes_unsafe_get" +external unsafe_set : bytes -> int -> char -> unit = "%bytes_unsafe_set" +external unsafe_blit : + bytes -> int -> bytes -> int -> int -> unit = "caml_blit_bytes"[@@noalloc ] +external unsafe_blit_string : + string -> int -> bytes -> int -> int -> unit = "caml_blit_string"[@@noalloc + ] +external unsafe_fill : + bytes -> int -> int -> char -> unit = "caml_fill_bytes"[@@noalloc ] +val unsafe_escape : bytes -> bytes diff --git a/interfaces/5.4/bytesLabels.mli b/interfaces/5.4/bytesLabels.mli new file mode 100644 index 0000000..5d01ea1 --- /dev/null +++ b/interfaces/5.4/bytesLabels.mli @@ -0,0 +1,104 @@ +external length : bytes -> int = "%bytes_length" +external get : bytes -> int -> char = "%bytes_safe_get" +external set : bytes -> int -> char -> unit = "%bytes_safe_set" +external create : int -> bytes = "caml_create_bytes" +val make : int -> char -> bytes +val init : int -> f:(int -> char) -> bytes +val empty : bytes +val copy : bytes -> bytes +val of_string : string -> bytes +val to_string : bytes -> string +val sub : bytes -> pos:int -> len:int -> bytes +val sub_string : bytes -> pos:int -> len:int -> string +val extend : bytes -> left:int -> right:int -> bytes +val fill : bytes -> pos:int -> len:int -> char -> unit +val blit : + src:bytes -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val blit_string : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val concat : sep:bytes -> bytes list -> bytes +val cat : bytes -> bytes -> bytes +val iter : f:(char -> unit) -> bytes -> unit +val iteri : f:(int -> char -> unit) -> bytes -> unit +val map : f:(char -> char) -> bytes -> bytes +val mapi : f:(int -> char -> char) -> bytes -> bytes +val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> bytes -> 'acc +val fold_right : f:(char -> 'acc -> 'acc) -> bytes -> init:'acc -> 'acc +val for_all : f:(char -> bool) -> bytes -> bool +val exists : f:(char -> bool) -> bytes -> bool +val trim : bytes -> bytes +val escaped : bytes -> bytes +val index : bytes -> char -> int +val index_opt : bytes -> char -> int option +val rindex : bytes -> char -> int +val rindex_opt : bytes -> char -> int option +val index_from : bytes -> int -> char -> int +val index_from_opt : bytes -> int -> char -> int option +val rindex_from : bytes -> int -> char -> int +val rindex_from_opt : bytes -> int -> char -> int option +val contains : bytes -> char -> bool +val contains_from : bytes -> int -> char -> bool +val rcontains_from : bytes -> int -> char -> bool +val uppercase_ascii : bytes -> bytes +val lowercase_ascii : bytes -> bytes +val capitalize_ascii : bytes -> bytes +val uncapitalize_ascii : bytes -> bytes +type t = bytes +val compare : t -> t -> int +val equal : t -> t -> bool +val starts_with : prefix:bytes -> bytes -> bool +val ends_with : suffix:bytes -> bytes -> bool +val unsafe_to_string : bytes -> string +val unsafe_of_string : string -> bytes +val split_on_char : sep:char -> bytes -> bytes list +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val set_utf_8_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val set_utf_16be_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val set_utf_16le_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16le : t -> bool +val get_uint8 : bytes -> int -> int +val get_int8 : bytes -> int -> int +val get_uint16_ne : bytes -> int -> int +val get_uint16_be : bytes -> int -> int +val get_uint16_le : bytes -> int -> int +val get_int16_ne : bytes -> int -> int +val get_int16_be : bytes -> int -> int +val get_int16_le : bytes -> int -> int +val get_int32_ne : bytes -> int -> int32 +val get_int32_be : bytes -> int -> int32 +val get_int32_le : bytes -> int -> int32 +val get_int64_ne : bytes -> int -> int64 +val get_int64_be : bytes -> int -> int64 +val get_int64_le : bytes -> int -> int64 +val set_uint8 : bytes -> int -> int -> unit +val set_int8 : bytes -> int -> int -> unit +val set_uint16_ne : bytes -> int -> int -> unit +val set_uint16_be : bytes -> int -> int -> unit +val set_uint16_le : bytes -> int -> int -> unit +val set_int16_ne : bytes -> int -> int -> unit +val set_int16_be : bytes -> int -> int -> unit +val set_int16_le : bytes -> int -> int -> unit +val set_int32_ne : bytes -> int -> int32 -> unit +val set_int32_be : bytes -> int -> int32 -> unit +val set_int32_le : bytes -> int -> int32 -> unit +val set_int64_ne : bytes -> int -> int64 -> unit +val set_int64_be : bytes -> int -> int64 -> unit +val set_int64_le : bytes -> int -> int64 -> unit +external unsafe_get : bytes -> int -> char = "%bytes_unsafe_get" +external unsafe_set : bytes -> int -> char -> unit = "%bytes_unsafe_set" +external unsafe_blit : + src:bytes -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_bytes"[@@noalloc ] +external unsafe_blit_string : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_string"[@@noalloc ] +external unsafe_fill : + bytes -> pos:int -> len:int -> char -> unit = "caml_fill_bytes"[@@noalloc ] +val unsafe_escape : bytes -> bytes diff --git a/interfaces/5.4/callback.mli b/interfaces/5.4/callback.mli new file mode 100644 index 0000000..d825854 --- /dev/null +++ b/interfaces/5.4/callback.mli @@ -0,0 +1,2 @@ +val register : string -> 'a -> unit +val register_exception : string -> exn -> unit diff --git a/interfaces/5.4/char.mli b/interfaces/5.4/char.mli new file mode 100644 index 0000000..8fa8fd4 --- /dev/null +++ b/interfaces/5.4/char.mli @@ -0,0 +1,35 @@ +type t = char +external code : char -> int = "%identity" +val chr : int -> char +val escaped : char -> string +val compare : t -> t -> int +val equal : t -> t -> bool +module Ascii : +sig + val min : char + val max : char + val is_valid : char -> bool + val is_upper : char -> bool + val is_lower : char -> bool + val is_letter : char -> bool + val is_alphanum : char -> bool + val is_white : char -> bool + val is_blank : char -> bool + val is_graphic : char -> bool + val is_print : char -> bool + val is_control : char -> bool + val is_digit : char -> bool + val digit_to_int : char -> int + val digit_of_int : int -> char + val is_hex_digit : char -> bool + val hex_digit_to_int : char -> int + val lower_hex_digit_of_int : int -> char + val upper_hex_digit_of_int : int -> char + val uppercase : char -> char + val lowercase : char -> char +end +val lowercase_ascii : char -> char +val uppercase_ascii : char -> char +val seeded_hash : int -> t -> int +val hash : t -> int +external unsafe_chr : int -> char = "%identity" diff --git a/interfaces/5.4/complex.mli b/interfaces/5.4/complex.mli new file mode 100644 index 0000000..f3275a5 --- /dev/null +++ b/interfaces/5.4/complex.mli @@ -0,0 +1,21 @@ +type t = { + re: float ; + im: float } +val zero : t +val one : t +val i : t +val neg : t -> t +val conj : t -> t +val add : t -> t -> t +val sub : t -> t -> t +val mul : t -> t -> t +val inv : t -> t +val div : t -> t -> t +val sqrt : t -> t +val norm2 : t -> float +val norm : t -> float +val arg : t -> float +val polar : float -> float -> t +val exp : t -> t +val log : t -> t +val pow : t -> t -> t diff --git a/interfaces/5.4/digest.mli b/interfaces/5.4/digest.mli new file mode 100644 index 0000000..b3fe1aa --- /dev/null +++ b/interfaces/5.4/digest.mli @@ -0,0 +1,35 @@ +type t = string +val compare : t -> t -> int +val equal : t -> t -> bool +val string : string -> t +val bytes : bytes -> t +val substring : string -> int -> int -> t +val subbytes : bytes -> int -> int -> t +val channel : in_channel -> int -> t +val file : string -> t +val output : out_channel -> t -> unit +val input : in_channel -> t +val to_hex : t -> string +val of_hex : string -> t +val from_hex : string -> t +module type S = + sig + type t = string + val hash_length : int + val compare : t -> t -> int + val equal : t -> t -> bool + val string : string -> t + val bytes : bytes -> t + val substring : string -> int -> int -> t + val subbytes : bytes -> int -> int -> t + val channel : in_channel -> int -> t + val file : string -> t + val output : out_channel -> t -> unit + val input : in_channel -> t + val to_hex : t -> string + val of_hex : string -> t + end +module BLAKE128 : S +module BLAKE256 : S +module BLAKE512 : S +module MD5 : S diff --git a/interfaces/5.4/domain.mli b/interfaces/5.4/domain.mli new file mode 100644 index 0000000..a3d29a6 --- /dev/null +++ b/interfaces/5.4/domain.mli @@ -0,0 +1,19 @@ +type !'a t +val spawn : (unit -> 'a) -> 'a t +val join : 'a t -> 'a +type id = private int +val get_id : 'a t -> id +val self : unit -> id +val before_first_spawn : (unit -> unit) -> unit +val at_exit : (unit -> unit) -> unit +val cpu_relax : unit -> unit +val is_main_domain : unit -> bool +val recommended_domain_count : unit -> int +val self_index : unit -> int +module DLS : +sig + type 'a key + val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key + val get : 'a key -> 'a + val set : 'a key -> 'a -> unit +end diff --git a/interfaces/5.4/either.mli b/interfaces/5.4/either.mli new file mode 100644 index 0000000..cc6687e --- /dev/null +++ b/interfaces/5.4/either.mli @@ -0,0 +1,25 @@ +type ('a, 'b) t = + | Left of 'a + | Right of 'b +val left : 'a -> ('a, 'b) t +val right : 'b -> ('a, 'b) t +val is_left : ('a, 'b) t -> bool +val is_right : ('a, 'b) t -> bool +val get_left : ('a, 'b) t -> 'a +val get_right : ('a, 'b) t -> 'b +val find_left : ('a, 'b) t -> 'a option +val find_right : ('a, 'b) t -> 'b option +val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t +val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t +val map : + left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t +val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c +val retract : ('a, 'a) t -> 'a +val iter : left:('a -> unit) -> right:('b -> unit) -> ('a, 'b) t -> unit +val for_all : left:('a -> bool) -> right:('b -> bool) -> ('a, 'b) t -> bool +val equal : + left:('a -> 'a -> bool) -> + right:('b -> 'b -> bool) -> ('a, 'b) t -> ('a, 'b) t -> bool +val compare : + left:('a -> 'a -> int) -> + right:('b -> 'b -> int) -> ('a, 'b) t -> ('a, 'b) t -> int diff --git a/interfaces/5.4/ephemeron.mli b/interfaces/5.4/ephemeron.mli new file mode 100644 index 0000000..5f5db4f --- /dev/null +++ b/interfaces/5.4/ephemeron.mli @@ -0,0 +1,240 @@ +module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end +module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end +module K1 : +sig + type ('k, 'd) t + val make : 'k -> 'd -> ('k, 'd) t + val query : ('k, 'd) t -> 'k -> 'd option + module Make : + (H : Hashtbl.HashedType) -> + sig + type key = H.t + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H : Hashtbl.SeededHashedType) -> + sig + type key = H.t + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k, 'd) t + val make : unit -> ('k, 'd) t + val add : ('k, 'd) t -> 'k -> 'd -> unit + val remove : ('k, 'd) t -> 'k -> unit + val find : ('k, 'd) t -> 'k -> 'd option + val length : ('k, 'd) t -> int + val clear : ('k, 'd) t -> unit + end +end +module K2 : +sig + type ('k1, 'k2, 'd) t + val make : 'k1 -> 'k2 -> 'd -> ('k1, 'k2, 'd) t + val query : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option + module Make : + (H1 : Hashtbl.HashedType) -> + (H2 : Hashtbl.HashedType) -> + sig + type key = (H1.t * H2.t) + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H1 : Hashtbl.SeededHashedType) -> + (H2 : Hashtbl.SeededHashedType) -> + sig + type key = (H1.t * H2.t) + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k1, 'k2, 'd) t + val make : unit -> ('k1, 'k2, 'd) t + val add : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd -> unit + val remove : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> unit + val find : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option + val length : ('k1, 'k2, 'd) t -> int + val clear : ('k1, 'k2, 'd) t -> unit + end +end +module Kn : +sig + type ('k, 'd) t + val make : 'k array -> 'd -> ('k, 'd) t + val query : ('k, 'd) t -> 'k array -> 'd option + module Make : + (H : Hashtbl.HashedType) -> + sig + type key = H.t array + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H : Hashtbl.SeededHashedType) -> + sig + type key = H.t array + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k, 'd) t + val make : unit -> ('k, 'd) t + val add : ('k, 'd) t -> 'k array -> 'd -> unit + val remove : ('k, 'd) t -> 'k array -> unit + val find : ('k, 'd) t -> 'k array -> 'd option + val length : ('k, 'd) t -> int + val clear : ('k, 'd) t -> unit + end +end diff --git a/interfaces/5.4/filename.mli b/interfaces/5.4/filename.mli new file mode 100644 index 0000000..472c189 --- /dev/null +++ b/interfaces/5.4/filename.mli @@ -0,0 +1,28 @@ +val current_dir_name : string +val parent_dir_name : string +val dir_sep : string +val concat : string -> string -> string +val is_relative : string -> bool +val is_implicit : string -> bool +val check_suffix : string -> string -> bool +val chop_suffix : string -> string -> string +val chop_suffix_opt : suffix:string -> string -> string option +val extension : string -> string +val remove_extension : string -> string +val chop_extension : string -> string +val basename : string -> string +val dirname : string -> string +val null : string +val temp_file : ?temp_dir:string -> string -> string -> string +val open_temp_file : + ?mode:open_flag list -> + ?perms:int -> + ?temp_dir:string -> string -> string -> (string * out_channel) +val temp_dir : ?temp_dir:string -> ?perms:int -> string -> string -> string +val get_temp_dir_name : unit -> string +val set_temp_dir_name : string -> unit +val quote : string -> string +val quote_command : + string -> + ?stdin:string -> + ?stdout:string -> ?stderr:string -> string list -> string diff --git a/interfaces/5.4/float.mli b/interfaces/5.4/float.mli new file mode 100644 index 0000000..75ea38d --- /dev/null +++ b/interfaces/5.4/float.mli @@ -0,0 +1,231 @@ +val zero : float +val one : float +val minus_one : float +external neg : float -> float = "%negfloat" +external add : float -> float -> float = "%addfloat" +external sub : float -> float -> float = "%subfloat" +external mul : float -> float -> float = "%mulfloat" +external div : float -> float -> float = "%divfloat" +external fma : float -> float -> float -> float = "caml_fma_float" "caml_fma" +[@@unboxed ][@@noalloc ] +external rem : float -> float -> float = "caml_fmod_float" "fmod"[@@unboxed ] +[@@noalloc ] +val succ : float -> float +val pred : float -> float +external abs : float -> float = "%absfloat" +val infinity : float +val neg_infinity : float +val nan : float +val signaling_nan : float +val quiet_nan : float +val pi : float +val max_float : float +val min_float : float +val epsilon : float +val is_finite : float -> bool +val is_infinite : float -> bool +val is_nan : float -> bool +val is_integer : float -> bool +external of_int : int -> float = "%floatofint" +external to_int : float -> int = "%intoffloat" +external of_string : string -> float = "caml_float_of_string" +val of_string_opt : string -> float option +val to_string : float -> string +type fpclass = fpclass = + | FP_normal + | FP_subnormal + | FP_zero + | FP_infinite + | FP_nan +external classify_float : + ((float)[@unboxed ]) -> fpclass = "caml_classify_float" + "caml_classify_float_unboxed"[@@noalloc ] +external pow : float -> float -> float = "caml_power_float" "pow"[@@unboxed ] +[@@noalloc ] +external sqrt : float -> float = "caml_sqrt_float" "sqrt"[@@unboxed ] +[@@noalloc ] +external cbrt : float -> float = "caml_cbrt_float" "caml_cbrt"[@@unboxed ] +[@@noalloc ] +external exp : float -> float = "caml_exp_float" "exp"[@@unboxed ][@@noalloc + ] +external exp2 : float -> float = "caml_exp2_float" "caml_exp2"[@@unboxed ] +[@@noalloc ] +external log : float -> float = "caml_log_float" "log"[@@unboxed ][@@noalloc + ] +external log10 : float -> float = "caml_log10_float" "log10"[@@unboxed ] +[@@noalloc ] +external log2 : float -> float = "caml_log2_float" "caml_log2"[@@unboxed ] +[@@noalloc ] +external expm1 : float -> float = "caml_expm1_float" "caml_expm1"[@@unboxed ] +[@@noalloc ] +external log1p : float -> float = "caml_log1p_float" "caml_log1p"[@@unboxed ] +[@@noalloc ] +external cos : float -> float = "caml_cos_float" "cos"[@@unboxed ][@@noalloc + ] +external sin : float -> float = "caml_sin_float" "sin"[@@unboxed ][@@noalloc + ] +external tan : float -> float = "caml_tan_float" "tan"[@@unboxed ][@@noalloc + ] +external acos : float -> float = "caml_acos_float" "acos"[@@unboxed ] +[@@noalloc ] +external asin : float -> float = "caml_asin_float" "asin"[@@unboxed ] +[@@noalloc ] +external atan : float -> float = "caml_atan_float" "atan"[@@unboxed ] +[@@noalloc ] +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" +[@@unboxed ][@@noalloc ] +external hypot : float -> float -> float = "caml_hypot_float" "caml_hypot" +[@@unboxed ][@@noalloc ] +external cosh : float -> float = "caml_cosh_float" "cosh"[@@unboxed ] +[@@noalloc ] +external sinh : float -> float = "caml_sinh_float" "sinh"[@@unboxed ] +[@@noalloc ] +external tanh : float -> float = "caml_tanh_float" "tanh"[@@unboxed ] +[@@noalloc ] +external acosh : float -> float = "caml_acosh_float" "caml_acosh"[@@unboxed ] +[@@noalloc ] +external asinh : float -> float = "caml_asinh_float" "caml_asinh"[@@unboxed ] +[@@noalloc ] +external atanh : float -> float = "caml_atanh_float" "caml_atanh"[@@unboxed ] +[@@noalloc ] +external erf : float -> float = "caml_erf_float" "caml_erf"[@@unboxed ] +[@@noalloc ] +external erfc : float -> float = "caml_erfc_float" "caml_erfc"[@@unboxed ] +[@@noalloc ] +external trunc : float -> float = "caml_trunc_float" "caml_trunc"[@@unboxed ] +[@@noalloc ] +external round : float -> float = "caml_round_float" "caml_round"[@@unboxed ] +[@@noalloc ] +external ceil : float -> float = "caml_ceil_float" "ceil"[@@unboxed ] +[@@noalloc ] +external floor : float -> float = "caml_floor_float" "floor"[@@unboxed ] +[@@noalloc ] +external next_after : + float -> float -> float = "caml_nextafter_float" "caml_nextafter"[@@unboxed + ] +[@@noalloc ] +external copy_sign : + float -> float -> float = "caml_copysign_float" "caml_copysign"[@@unboxed ] +[@@noalloc ] +external sign_bit : + ((float)[@unboxed ]) -> bool = "caml_signbit_float" "caml_signbit"[@@noalloc + ] +external frexp : float -> (float * int) = "caml_frexp_float" +external ldexp : + ((float)[@unboxed ]) -> ((int)[@untagged ]) -> ((float)[@unboxed ]) = + "caml_ldexp_float" "caml_ldexp_float_unboxed"[@@noalloc ] +external modf : float -> (float * float) = "caml_modf_float" +type t = float +val compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : float -> float -> float +val min_max : float -> float -> (float * float) +val min_num : t -> t -> t +val max_num : t -> t -> t +val min_max_num : float -> float -> (float * float) +val seeded_hash : int -> t -> int +val hash : t -> int +module Array : +sig + type t = floatarray + val length : t -> int + val get : t -> int -> float + val set : t -> int -> float -> unit + val make : int -> float -> t + val create : int -> t + val init : int -> (int -> float) -> t + val make_matrix : int -> int -> float -> t array + val init_matrix : int -> int -> (int -> int -> float) -> t array + val append : t -> t -> t + val concat : t list -> t + val sub : t -> int -> int -> t + val copy : t -> t + val fill : t -> int -> int -> float -> unit + val blit : t -> int -> t -> int -> int -> unit + val to_list : t -> float list + val of_list : float list -> t + val equal : (float -> float -> bool) -> t -> t -> bool + val compare : (float -> float -> int) -> t -> t -> int + val iter : (float -> unit) -> t -> unit + val iteri : (int -> float -> unit) -> t -> unit + val map : (float -> float) -> t -> t + val map_inplace : (float -> float) -> t -> unit + val mapi : (int -> float -> float) -> t -> t + val mapi_inplace : (int -> float -> float) -> t -> unit + val fold_left : ('acc -> float -> 'acc) -> 'acc -> t -> 'acc + val fold_right : (float -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val iter2 : (float -> float -> unit) -> t -> t -> unit + val map2 : (float -> float -> float) -> t -> t -> t + val for_all : (float -> bool) -> t -> bool + val exists : (float -> bool) -> t -> bool + val mem : float -> t -> bool + val mem_ieee : float -> t -> bool + val find_opt : (float -> bool) -> t -> float option + val find_index : (float -> bool) -> t -> int option + val find_map : (float -> 'a option) -> t -> 'a option + val find_mapi : (int -> float -> 'a option) -> t -> 'a option + val sort : (float -> float -> int) -> t -> unit + val stable_sort : (float -> float -> int) -> t -> unit + val fast_sort : (float -> float -> int) -> t -> unit + val shuffle : rand:(int -> int) -> t -> unit + val to_seq : t -> float Seq.t + val to_seqi : t -> (int * float) Seq.t + val of_seq : float Seq.t -> t + val map_to_array : (float -> 'a) -> t -> 'a array + val map_from_array : ('a -> float) -> 'a array -> t + external unsafe_get : t -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : t -> int -> float -> unit = "%floatarray_unsafe_set" +end +module ArrayLabels : +sig + type t = floatarray + val length : t -> int + val get : t -> int -> float + val set : t -> int -> float -> unit + val make : int -> float -> t + val create : int -> t + val init : int -> f:(int -> float) -> t + val make_matrix : dimx:int -> dimy:int -> float -> t array + val init_matrix : + dimx:int -> dimy:int -> f:(int -> int -> float) -> t array + val append : t -> t -> t + val concat : t list -> t + val sub : t -> pos:int -> len:int -> t + val copy : t -> t + val fill : t -> pos:int -> len:int -> float -> unit + val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit + val to_list : t -> float list + val of_list : float list -> t + val equal : eq:(float -> float -> bool) -> t -> t -> bool + val compare : cmp:(float -> float -> int) -> t -> t -> int + val iter : f:(float -> unit) -> t -> unit + val iteri : f:(int -> float -> unit) -> t -> unit + val map : f:(float -> float) -> t -> t + val map_inplace : f:(float -> float) -> t -> unit + val mapi : f:(int -> float -> float) -> t -> t + val mapi_inplace : f:(int -> float -> float) -> t -> unit + val fold_left : f:('acc -> float -> 'acc) -> init:'acc -> t -> 'acc + val fold_right : f:(float -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val iter2 : f:(float -> float -> unit) -> t -> t -> unit + val map2 : f:(float -> float -> float) -> t -> t -> t + val for_all : f:(float -> bool) -> t -> bool + val exists : f:(float -> bool) -> t -> bool + val mem : float -> set:t -> bool + val mem_ieee : float -> set:t -> bool + val find_opt : f:(float -> bool) -> t -> float option + val find_index : f:(float -> bool) -> t -> int option + val find_map : f:(float -> 'a option) -> t -> 'a option + val find_mapi : f:(int -> float -> 'a option) -> t -> 'a option + val sort : cmp:(float -> float -> int) -> t -> unit + val stable_sort : cmp:(float -> float -> int) -> t -> unit + val fast_sort : cmp:(float -> float -> int) -> t -> unit + val shuffle : rand:(int -> int) -> t -> unit + val to_seq : t -> float Seq.t + val to_seqi : t -> (int * float) Seq.t + val of_seq : float Seq.t -> t + val map_to_array : f:(float -> 'a) -> t -> 'a array + val map_from_array : f:('a -> float) -> 'a array -> t + external unsafe_get : t -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : t -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.4/format.mli b/interfaces/5.4/format.mli new file mode 100644 index 0000000..5131e31 --- /dev/null +++ b/interfaces/5.4/format.mli @@ -0,0 +1,222 @@ +type formatter +val pp_open_box : formatter -> int -> unit +val open_box : int -> unit +val pp_close_box : formatter -> unit -> unit +val close_box : unit -> unit +val pp_open_hbox : formatter -> unit -> unit +val open_hbox : unit -> unit +val pp_open_vbox : formatter -> int -> unit +val open_vbox : int -> unit +val pp_open_hvbox : formatter -> int -> unit +val open_hvbox : int -> unit +val pp_open_hovbox : formatter -> int -> unit +val open_hovbox : int -> unit +val pp_print_string : formatter -> string -> unit +val print_string : string -> unit +val pp_print_substring : pos:int -> len:int -> formatter -> string -> unit +val print_substring : pos:int -> len:int -> string -> unit +val pp_print_bytes : formatter -> bytes -> unit +val print_bytes : bytes -> unit +val pp_print_as : formatter -> int -> string -> unit +val print_as : int -> string -> unit +val pp_print_substring_as : + pos:int -> len:int -> formatter -> int -> string -> unit +val print_substring_as : pos:int -> len:int -> int -> string -> unit +val pp_print_int : formatter -> int -> unit +val print_int : int -> unit +val pp_print_float : formatter -> float -> unit +val print_float : float -> unit +val pp_print_char : formatter -> char -> unit +val print_char : char -> unit +val pp_print_bool : formatter -> bool -> unit +val print_bool : bool -> unit +val pp_print_nothing : formatter -> unit -> unit +val pp_print_space : formatter -> unit -> unit +val print_space : unit -> unit +val pp_print_cut : formatter -> unit -> unit +val print_cut : unit -> unit +val pp_print_break : formatter -> int -> int -> unit +val print_break : int -> int -> unit +val pp_print_custom_break : + formatter -> + fits:(string * int * string) -> breaks:(string * int * string) -> unit +val pp_force_newline : formatter -> unit -> unit +val force_newline : unit -> unit +val pp_print_if_newline : formatter -> unit -> unit +val print_if_newline : unit -> unit +val pp_print_flush : formatter -> unit -> unit +val print_flush : unit -> unit +val pp_print_newline : formatter -> unit -> unit +val print_newline : unit -> unit +val pp_infinity : int +val pp_set_margin : formatter -> int -> unit +val set_margin : int -> unit +val pp_get_margin : formatter -> unit -> int +val get_margin : unit -> int +val pp_set_max_indent : formatter -> int -> unit +val set_max_indent : int -> unit +val pp_get_max_indent : formatter -> unit -> int +val get_max_indent : unit -> int +type geometry = { + max_indent: int ; + margin: int } +val check_geometry : geometry -> bool +val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit +val set_geometry : max_indent:int -> margin:int -> unit +val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit +val safe_set_geometry : max_indent:int -> margin:int -> unit +val pp_update_geometry : formatter -> (geometry -> geometry) -> unit +val update_geometry : (geometry -> geometry) -> unit +val pp_get_geometry : formatter -> unit -> geometry +val get_geometry : unit -> geometry +val pp_set_max_boxes : formatter -> int -> unit +val set_max_boxes : int -> unit +val pp_get_max_boxes : formatter -> unit -> int +val get_max_boxes : unit -> int +val pp_over_max_boxes : formatter -> unit -> bool +val over_max_boxes : unit -> bool +val pp_open_tbox : formatter -> unit -> unit +val open_tbox : unit -> unit +val pp_close_tbox : formatter -> unit -> unit +val close_tbox : unit -> unit +val pp_set_tab : formatter -> unit -> unit +val set_tab : unit -> unit +val pp_print_tab : formatter -> unit -> unit +val print_tab : unit -> unit +val pp_print_tbreak : formatter -> int -> int -> unit +val print_tbreak : int -> int -> unit +val pp_set_ellipsis_text : formatter -> string -> unit +val set_ellipsis_text : string -> unit +val pp_get_ellipsis_text : formatter -> unit -> string +val get_ellipsis_text : unit -> string +type stag = .. +type tag = string +type stag += + | String_tag of tag +val pp_open_stag : formatter -> stag -> unit +val open_stag : stag -> unit +val pp_close_stag : formatter -> unit -> unit +val close_stag : unit -> unit +val pp_set_tags : formatter -> bool -> unit +val set_tags : bool -> unit +val pp_set_print_tags : formatter -> bool -> unit +val set_print_tags : bool -> unit +val pp_set_mark_tags : formatter -> bool -> unit +val set_mark_tags : bool -> unit +val pp_get_print_tags : formatter -> unit -> bool +val get_print_tags : unit -> bool +val pp_get_mark_tags : formatter -> unit -> bool +val get_mark_tags : unit -> bool +val pp_set_formatter_out_channel : formatter -> out_channel -> unit +val set_formatter_out_channel : out_channel -> unit +val pp_set_formatter_output_functions : + formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> unit +val set_formatter_output_functions : + (string -> int -> int -> unit) -> (unit -> unit) -> unit +val pp_get_formatter_output_functions : + formatter -> unit -> ((string -> int -> int -> unit) * (unit -> unit)) +val get_formatter_output_functions : + unit -> ((string -> int -> int -> unit) * (unit -> unit)) +type formatter_out_functions = + { + out_string: string -> int -> int -> unit ; + out_width: string -> pos:int -> len:int -> int ; + out_flush: unit -> unit ; + out_newline: unit -> unit ; + out_spaces: int -> unit ; + out_indent: int -> unit } +val pp_set_formatter_out_functions : + formatter -> formatter_out_functions -> unit +val set_formatter_out_functions : formatter_out_functions -> unit +val pp_get_formatter_out_functions : + formatter -> unit -> formatter_out_functions +val get_formatter_out_functions : unit -> formatter_out_functions +val utf_8_scalar_width : string -> pos:int -> len:int -> int +val ascii_width : string -> pos:int -> len:int -> int +type formatter_stag_functions = + { + mark_open_stag: stag -> string ; + mark_close_stag: stag -> string ; + print_open_stag: stag -> unit ; + print_close_stag: stag -> unit } +val pp_set_formatter_stag_functions : + formatter -> formatter_stag_functions -> unit +val set_formatter_stag_functions : formatter_stag_functions -> unit +val pp_get_formatter_stag_functions : + formatter -> unit -> formatter_stag_functions +val get_formatter_stag_functions : unit -> formatter_stag_functions +val formatter_of_out_channel : out_channel -> formatter +val synchronized_formatter_of_out_channel : + out_channel -> formatter Domain.DLS.key +val std_formatter : formatter +val get_std_formatter : unit -> formatter +val err_formatter : formatter +val get_err_formatter : unit -> formatter +val formatter_of_buffer : Buffer.t -> formatter +val stdbuf : Buffer.t +val get_stdbuf : unit -> Buffer.t +val str_formatter : formatter +val get_str_formatter : unit -> formatter +val flush_str_formatter : unit -> string +val make_formatter : + (string -> int -> int -> unit) -> (unit -> unit) -> formatter +val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> formatter Domain.DLS.key +val formatter_of_out_functions : formatter_out_functions -> formatter +type symbolic_output_item = + | Output_flush + | Output_newline + | Output_string of string + | Output_spaces of int + | Output_indent of int +type symbolic_output_buffer +val make_symbolic_output_buffer : unit -> symbolic_output_buffer +val clear_symbolic_output_buffer : symbolic_output_buffer -> unit +val get_symbolic_output_buffer : + symbolic_output_buffer -> symbolic_output_item list +val flush_symbolic_output_buffer : + symbolic_output_buffer -> symbolic_output_item list +val add_symbolic_output_item : + symbolic_output_buffer -> symbolic_output_item -> unit +val formatter_of_symbolic_output_buffer : symbolic_output_buffer -> formatter +val pp_print_iter : + ?pp_sep:(formatter -> unit -> unit) -> + (('a -> unit) -> 'b -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'b -> unit +val pp_print_list : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a list -> unit +val pp_print_array : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a array -> unit +val pp_print_seq : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a Seq.t -> unit +val pp_print_text : formatter -> string -> unit +val format_text : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 +val pp_print_option : + ?none:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a option -> unit +val pp_print_result : + ok:(formatter -> 'a -> unit) -> + error:(formatter -> 'e -> unit) -> formatter -> ('a, 'e) result -> unit +val pp_print_either : + left:(formatter -> 'a -> unit) -> + right:(formatter -> 'b -> unit) -> formatter -> ('a, 'b) Either.t -> unit +val fprintf : formatter -> ('a, formatter, unit) format -> 'a +val printf : ('a, formatter, unit) format -> 'a +val eprintf : ('a, formatter, unit) format -> 'a +val sprintf : ('a, unit, string) format -> 'a +val asprintf : ('a, formatter, unit, string) format4 -> 'a +val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a +val ifprintf : formatter -> ('a, formatter, unit) format -> 'a +val kfprintf : + (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b +val kdprintf : + ((formatter -> unit) -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b +val ikfprintf : + (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b +val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b +val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b diff --git a/interfaces/5.4/fun.mli b/interfaces/5.4/fun.mli new file mode 100644 index 0000000..0099086 --- /dev/null +++ b/interfaces/5.4/fun.mli @@ -0,0 +1,7 @@ +external id : 'a -> 'a = "%identity" +val const : 'a -> 'b -> 'a +val compose : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c +val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c +val negate : ('a -> bool) -> 'a -> bool +val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a +exception Finally_raised of exn diff --git a/interfaces/5.4/gc.mli b/interfaces/5.4/gc.mli new file mode 100644 index 0000000..c7bd2d1 --- /dev/null +++ b/interfaces/5.4/gc.mli @@ -0,0 +1,90 @@ +type stat = + { + minor_words: float ; + promoted_words: float ; + major_words: float ; + minor_collections: int ; + major_collections: int ; + heap_words: int ; + heap_chunks: int ; + live_words: int ; + live_blocks: int ; + free_words: int ; + free_blocks: int ; + largest_free: int ; + fragments: int ; + compactions: int ; + top_heap_words: int ; + stack_size: int ; + forced_major_collections: int } +type control = + { + minor_heap_size: int ; + major_heap_increment: int ; + space_overhead: int ; + verbose: int ; + max_overhead: int ; + stack_limit: int ; + allocation_policy: int ; + window_size: int ; + custom_major_ratio: int ; + custom_minor_ratio: int ; + custom_minor_max_size: int } +external stat : unit -> stat = "caml_gc_stat" +external quick_stat : unit -> stat = "caml_gc_quick_stat" +external counters : unit -> (float * float * float) = "caml_gc_counters" +external minor_words : + unit -> ((float)[@unboxed ]) = "caml_gc_minor_words" + "caml_gc_minor_words_unboxed" +external get : unit -> control = "caml_gc_get" +external set : control -> unit = "caml_gc_set" +external minor : unit -> unit = "caml_gc_minor" +external major_slice : int -> int = "caml_gc_major_slice" +external major : unit -> unit = "caml_gc_major" +external full_major : unit -> unit = "caml_gc_full_major" +external compact : unit -> unit = "caml_gc_compaction" +val print_stat : out_channel -> unit +val allocated_bytes : unit -> float +external get_minor_free : unit -> int = "caml_get_minor_free" +val finalise : ('a -> unit) -> 'a -> unit +val finalise_last : (unit -> unit) -> 'a -> unit +val finalise_release : unit -> unit +type alarm +val create_alarm : (unit -> unit) -> alarm +val delete_alarm : alarm -> unit +val eventlog_pause : unit -> unit +val eventlog_resume : unit -> unit +module Memprof : +sig + type t + type allocation_source = + | Normal + | Marshal + | Custom + | Map_file + val string_of_allocation_source : allocation_source -> string + type allocation = private + { + n_samples: int ; + size: int ; + source: allocation_source ; + callstack: Printexc.raw_backtrace } + type ('minor, 'major) tracker = + { + alloc_minor: allocation -> 'minor option ; + alloc_major: allocation -> 'major option ; + promote: 'minor -> 'major option ; + dealloc_minor: 'minor -> unit ; + dealloc_major: 'major -> unit } + val null_tracker : ('minor, 'major) tracker + val start : + sampling_rate:float -> + ?callstack_size:int -> ('minor, 'major) tracker -> t + val stop : unit -> unit + val discard : t -> unit +end +type suspended_collection_work +external ramp_up : + (unit -> 'a) -> ('a * suspended_collection_work) = "caml_ml_gc_ramp_up" +external ramp_down : + suspended_collection_work -> unit = "caml_ml_gc_ramp_down" diff --git a/interfaces/5.4/hashtbl.mli b/interfaces/5.4/hashtbl.mli new file mode 100644 index 0000000..360ec39 --- /dev/null +++ b/interfaces/5.4/hashtbl.mli @@ -0,0 +1,150 @@ +type (!'a, !'b) t +val create : ?random:bool -> int -> ('a, 'b) t +val clear : ('a, 'b) t -> unit +val reset : ('a, 'b) t -> unit +val copy : ('a, 'b) t -> ('a, 'b) t +val add : ('a, 'b) t -> 'a -> 'b -> unit +val find : ('a, 'b) t -> 'a -> 'b +val find_opt : ('a, 'b) t -> 'a -> 'b option +val find_all : ('a, 'b) t -> 'a -> 'b list +val mem : ('a, 'b) t -> 'a -> bool +val remove : ('a, 'b) t -> 'a -> unit +val replace : ('a, 'b) t -> 'a -> 'b -> unit +val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit +val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit +val fold : ('a -> 'b -> 'acc -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc +val length : ('a, 'b) t -> int +val randomize : unit -> unit +val is_randomized : unit -> bool +val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t +type statistics = + { + num_bindings: int ; + num_buckets: int ; + max_bucket_length: int ; + bucket_histogram: int array } +val stats : ('a, 'b) t -> statistics +val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t +val to_seq_keys : ('a, 'b) t -> 'a Seq.t +val to_seq_values : ('a, 'b) t -> 'b Seq.t +val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t +module type HashedType = + sig type t val equal : t -> t -> bool val hash : t -> int end +module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module Make : +(H : HashedType) -> + sig + type key = H.t + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module type SeededHashedType = + sig type t val equal : t -> t -> bool val seeded_hash : int -> t -> int end +module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module MakeSeeded : +(H : SeededHashedType) -> + sig + type key = H.t + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +val hash : 'a -> int +val seeded_hash : int -> 'a -> int +val hash_param : int -> int -> 'a -> int +val seeded_hash_param : int -> int -> int -> 'a -> int diff --git a/interfaces/5.4/in_channel.mli b/interfaces/5.4/in_channel.mli new file mode 100644 index 0000000..2309613 --- /dev/null +++ b/interfaces/5.4/in_channel.mli @@ -0,0 +1,43 @@ +type t = in_channel +type open_flag = open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val stdin : t +val open_bin : string -> t +val open_text : string -> t +val open_gen : open_flag list -> int -> string -> t +val with_open_bin : string -> (t -> 'a) -> 'a +val with_open_text : string -> (t -> 'a) -> 'a +val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a +val close : t -> unit +val close_noerr : t -> unit +val input_char : t -> char option +val input_byte : t -> int option +val input_line : t -> string option +val really_input_string : t -> int -> string option +val input_all : t -> string +val input_lines : t -> string list +val input : t -> bytes -> int -> int -> int +val input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> int +val really_input : t -> bytes -> int -> int -> unit option +val really_input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit option +val fold_lines : ('acc -> string -> 'acc) -> 'acc -> t -> 'acc +val seek : t -> int64 -> unit +val pos : t -> int64 +val length : t -> int64 +val set_binary_mode : t -> bool -> unit +val is_binary_mode : t -> bool +val isatty : t -> bool diff --git a/interfaces/5.4/int32.mli b/interfaces/5.4/int32.mli new file mode 100644 index 0000000..f884f59 --- /dev/null +++ b/interfaces/5.4/int32.mli @@ -0,0 +1,49 @@ +val zero : int32 +val one : int32 +val minus_one : int32 +external neg : int32 -> int32 = "%int32_neg" +external add : int32 -> int32 -> int32 = "%int32_add" +external sub : int32 -> int32 -> int32 = "%int32_sub" +external mul : int32 -> int32 -> int32 = "%int32_mul" +external div : int32 -> int32 -> int32 = "%int32_div" +val unsigned_div : int32 -> int32 -> int32 +external rem : int32 -> int32 -> int32 = "%int32_mod" +val unsigned_rem : int32 -> int32 -> int32 +val succ : int32 -> int32 +val pred : int32 -> int32 +val abs : int32 -> int32 +val max_int : int32 +val min_int : int32 +external logand : int32 -> int32 -> int32 = "%int32_and" +external logor : int32 -> int32 -> int32 = "%int32_or" +external logxor : int32 -> int32 -> int32 = "%int32_xor" +val lognot : int32 -> int32 +external shift_left : int32 -> int -> int32 = "%int32_lsl" +external shift_right : int32 -> int -> int32 = "%int32_asr" +external shift_right_logical : int32 -> int -> int32 = "%int32_lsr" +external of_int : int -> int32 = "%int32_of_int" +external to_int : int32 -> int = "%int32_to_int" +val unsigned_to_int : int32 -> int option +external of_float : + float -> int32 = "caml_int32_of_float" "caml_int32_of_float_unboxed" +[@@unboxed ][@@noalloc ] +external to_float : + int32 -> float = "caml_int32_to_float" "caml_int32_to_float_unboxed" +[@@unboxed ][@@noalloc ] +external of_string : string -> int32 = "caml_int32_of_string" +val of_string_opt : string -> int32 option +val to_string : int32 -> string +external bits_of_float : + float -> int32 = "caml_int32_bits_of_float" + "caml_int32_bits_of_float_unboxed"[@@unboxed ][@@noalloc ] +external float_of_bits : + int32 -> float = "caml_int32_float_of_bits" + "caml_int32_float_of_bits_unboxed"[@@unboxed ][@@noalloc ] +type t = int32 +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.4/int64.mli b/interfaces/5.4/int64.mli new file mode 100644 index 0000000..14ec94b --- /dev/null +++ b/interfaces/5.4/int64.mli @@ -0,0 +1,53 @@ +val zero : int64 +val one : int64 +val minus_one : int64 +external neg : int64 -> int64 = "%int64_neg" +external add : int64 -> int64 -> int64 = "%int64_add" +external sub : int64 -> int64 -> int64 = "%int64_sub" +external mul : int64 -> int64 -> int64 = "%int64_mul" +external div : int64 -> int64 -> int64 = "%int64_div" +val unsigned_div : int64 -> int64 -> int64 +external rem : int64 -> int64 -> int64 = "%int64_mod" +val unsigned_rem : int64 -> int64 -> int64 +val succ : int64 -> int64 +val pred : int64 -> int64 +val abs : int64 -> int64 +val max_int : int64 +val min_int : int64 +external logand : int64 -> int64 -> int64 = "%int64_and" +external logor : int64 -> int64 -> int64 = "%int64_or" +external logxor : int64 -> int64 -> int64 = "%int64_xor" +val lognot : int64 -> int64 +external shift_left : int64 -> int -> int64 = "%int64_lsl" +external shift_right : int64 -> int -> int64 = "%int64_asr" +external shift_right_logical : int64 -> int -> int64 = "%int64_lsr" +external of_int : int -> int64 = "%int64_of_int" +external to_int : int64 -> int = "%int64_to_int" +val unsigned_to_int : int64 -> int option +external of_float : + float -> int64 = "caml_int64_of_float" "caml_int64_of_float_unboxed" +[@@unboxed ][@@noalloc ] +external to_float : + int64 -> float = "caml_int64_to_float" "caml_int64_to_float_unboxed" +[@@unboxed ][@@noalloc ] +external of_int32 : int32 -> int64 = "%int64_of_int32" +external to_int32 : int64 -> int32 = "%int64_to_int32" +external of_nativeint : nativeint -> int64 = "%int64_of_nativeint" +external to_nativeint : int64 -> nativeint = "%int64_to_nativeint" +external of_string : string -> int64 = "caml_int64_of_string" +val of_string_opt : string -> int64 option +val to_string : int64 -> string +external bits_of_float : + float -> int64 = "caml_int64_bits_of_float" + "caml_int64_bits_of_float_unboxed"[@@unboxed ][@@noalloc ] +external float_of_bits : + int64 -> float = "caml_int64_float_of_bits" + "caml_int64_float_of_bits_unboxed"[@@unboxed ][@@noalloc ] +type t = int64 +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.4/lazy.mli b/interfaces/5.4/lazy.mli new file mode 100644 index 0000000..2129b8c --- /dev/null +++ b/interfaces/5.4/lazy.mli @@ -0,0 +1,9 @@ +type 'a t = 'a CamlinternalLazy.t +exception Undefined +external force : 'a t -> 'a = "%lazy_force" +val map : ('a -> 'b) -> 'a t -> 'b t +val is_val : 'a t -> bool +val from_val : 'a -> 'a t +val map_val : ('a -> 'b) -> 'a t -> 'b t +val from_fun : (unit -> 'a) -> 'a t +val force_val : 'a t -> 'a diff --git a/interfaces/5.4/lexing.mli b/interfaces/5.4/lexing.mli new file mode 100644 index 0000000..0e5297c --- /dev/null +++ b/interfaces/5.4/lexing.mli @@ -0,0 +1,54 @@ +type position = + { + pos_fname: string ; + pos_lnum: int ; + pos_bol: int ; + pos_cnum: int } +val dummy_pos : position +type lexbuf = + { + refill_buff: lexbuf -> unit ; + mutable lex_buffer: bytes ; + mutable lex_buffer_len: int ; + mutable lex_abs_pos: int ; + mutable lex_start_pos: int ; + mutable lex_curr_pos: int ; + mutable lex_last_pos: int ; + mutable lex_last_action: int ; + mutable lex_eof_reached: bool ; + mutable lex_mem: int array ; + mutable lex_start_p: position ; + mutable lex_curr_p: position } +val from_channel : ?with_positions:bool -> in_channel -> lexbuf +val from_string : ?with_positions:bool -> string -> lexbuf +val from_function : ?with_positions:bool -> (bytes -> int -> int) -> lexbuf +val set_position : lexbuf -> position -> unit +val set_filename : lexbuf -> string -> unit +val with_positions : lexbuf -> bool +val lexeme : lexbuf -> string +val lexeme_char : lexbuf -> int -> char +val lexeme_start : lexbuf -> int +val lexeme_end : lexbuf -> int +val lexeme_start_p : lexbuf -> position +val lexeme_end_p : lexbuf -> position +val new_line : lexbuf -> unit +val flush_input : lexbuf -> unit +val sub_lexeme : lexbuf -> int -> int -> string +val sub_lexeme_opt : lexbuf -> int -> int -> string option +val sub_lexeme_char : lexbuf -> int -> char +val sub_lexeme_char_opt : lexbuf -> int -> char option +type lex_tables = + { + lex_base: string ; + lex_backtrk: string ; + lex_default: string ; + lex_trans: string ; + lex_check: string ; + lex_base_code: string ; + lex_backtrk_code: string ; + lex_default_code: string ; + lex_trans_code: string ; + lex_check_code: string ; + lex_code: string } +val engine : lex_tables -> int -> lexbuf -> int +val new_engine : lex_tables -> int -> lexbuf -> int diff --git a/interfaces/5.4/list.mli b/interfaces/5.4/list.mli new file mode 100644 index 0000000..a4b74d4 --- /dev/null +++ b/interfaces/5.4/list.mli @@ -0,0 +1,77 @@ +type 'a t = 'a list = + | [] + | (::) of 'a * 'a list +val length : 'a list -> int +val compare_lengths : 'a list -> 'b list -> int +val compare_length_with : 'a list -> int -> int +val is_empty : 'a list -> bool +val cons : 'a -> 'a list -> 'a list +val singleton : 'a -> 'a list +val hd : 'a list -> 'a +val tl : 'a list -> 'a list +val nth : 'a list -> int -> 'a +val nth_opt : 'a list -> int -> 'a option +val rev : 'a list -> 'a list +val init : int -> (int -> 'a) -> 'a list +val append : 'a list -> 'a list -> 'a list +val rev_append : 'a list -> 'a list -> 'a list +val concat : 'a list list -> 'a list +val flatten : 'a list list -> 'a list +val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool +val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int +val iter : ('a -> unit) -> 'a list -> unit +val iteri : (int -> 'a -> unit) -> 'a list -> unit +val map : ('a -> 'b) -> 'a list -> 'b list +val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list +val rev_map : ('a -> 'b) -> 'a list -> 'b list +val filter_map : ('a -> 'b option) -> 'a list -> 'b list +val concat_map : ('a -> 'b list) -> 'a list -> 'b list +val fold_left_map : + ('acc -> 'a -> ('acc * 'b)) -> 'acc -> 'a list -> ('acc * 'b list) +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc +val fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc +val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit +val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val fold_left2 : + ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a list -> 'b list -> 'acc +val fold_right2 : + ('a -> 'b -> 'acc -> 'acc) -> 'a list -> 'b list -> 'acc -> 'acc +val for_all : ('a -> bool) -> 'a list -> bool +val exists : ('a -> bool) -> 'a list -> bool +val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val mem : 'a -> 'a list -> bool +val memq : 'a -> 'a list -> bool +val find : ('a -> bool) -> 'a list -> 'a +val find_opt : ('a -> bool) -> 'a list -> 'a option +val find_index : ('a -> bool) -> 'a list -> int option +val find_map : ('a -> 'b option) -> 'a list -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b option +val filter : ('a -> bool) -> 'a list -> 'a list +val find_all : ('a -> bool) -> 'a list -> 'a list +val filteri : (int -> 'a -> bool) -> 'a list -> 'a list +val take : int -> 'a list -> 'a list +val drop : int -> 'a list -> 'a list +val take_while : ('a -> bool) -> 'a list -> 'a list +val drop_while : ('a -> bool) -> 'a list -> 'a list +val partition : ('a -> bool) -> 'a list -> ('a list * 'a list) +val partition_map : + ('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) +val assoc : 'a -> ('a * 'b) list -> 'b +val assoc_opt : 'a -> ('a * 'b) list -> 'b option +val assq : 'a -> ('a * 'b) list -> 'b +val assq_opt : 'a -> ('a * 'b) list -> 'b option +val mem_assoc : 'a -> ('a * 'b) list -> bool +val mem_assq : 'a -> ('a * 'b) list -> bool +val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list +val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list +val split : ('a * 'b) list -> ('a list * 'b list) +val combine : 'a list -> 'b list -> ('a * 'b) list +val sort : ('a -> 'a -> int) -> 'a list -> 'a list +val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list +val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list +val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list +val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list +val to_seq : 'a list -> 'a Seq.t +val of_seq : 'a Seq.t -> 'a list diff --git a/interfaces/5.4/listLabels.mli b/interfaces/5.4/listLabels.mli new file mode 100644 index 0000000..7a4af7e --- /dev/null +++ b/interfaces/5.4/listLabels.mli @@ -0,0 +1,77 @@ +type 'a t = 'a list = + | [] + | (::) of 'a * 'a list +val length : 'a list -> int +val compare_lengths : 'a list -> 'b list -> int +val compare_length_with : 'a list -> len:int -> int +val is_empty : 'a list -> bool +val cons : 'a -> 'a list -> 'a list +val singleton : 'a -> 'a list +val hd : 'a list -> 'a +val tl : 'a list -> 'a list +val nth : 'a list -> int -> 'a +val nth_opt : 'a list -> int -> 'a option +val rev : 'a list -> 'a list +val init : len:int -> f:(int -> 'a) -> 'a list +val append : 'a list -> 'a list -> 'a list +val rev_append : 'a list -> 'a list -> 'a list +val concat : 'a list list -> 'a list +val flatten : 'a list list -> 'a list +val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool +val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int +val iter : f:('a -> unit) -> 'a list -> unit +val iteri : f:(int -> 'a -> unit) -> 'a list -> unit +val map : f:('a -> 'b) -> 'a list -> 'b list +val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list +val rev_map : f:('a -> 'b) -> 'a list -> 'b list +val filter_map : f:('a -> 'b option) -> 'a list -> 'b list +val concat_map : f:('a -> 'b list) -> 'a list -> 'b list +val fold_left_map : + f:('acc -> 'a -> ('acc * 'b)) -> init:'acc -> 'a list -> ('acc * 'b list) +val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a list -> 'acc +val fold_right : f:('a -> 'acc -> 'acc) -> 'a list -> init:'acc -> 'acc +val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit +val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val fold_left2 : + f:('acc -> 'a -> 'b -> 'acc) -> init:'acc -> 'a list -> 'b list -> 'acc +val fold_right2 : + f:('a -> 'b -> 'acc -> 'acc) -> 'a list -> 'b list -> init:'acc -> 'acc +val for_all : f:('a -> bool) -> 'a list -> bool +val exists : f:('a -> bool) -> 'a list -> bool +val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val mem : 'a -> set:'a list -> bool +val memq : 'a -> set:'a list -> bool +val find : f:('a -> bool) -> 'a list -> 'a +val find_opt : f:('a -> bool) -> 'a list -> 'a option +val find_index : f:('a -> bool) -> 'a list -> int option +val find_map : f:('a -> 'b option) -> 'a list -> 'b option +val find_mapi : f:(int -> 'a -> 'b option) -> 'a list -> 'b option +val filter : f:('a -> bool) -> 'a list -> 'a list +val find_all : f:('a -> bool) -> 'a list -> 'a list +val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list +val take : int -> 'a list -> 'a list +val drop : int -> 'a list -> 'a list +val take_while : f:('a -> bool) -> 'a list -> 'a list +val drop_while : f:('a -> bool) -> 'a list -> 'a list +val partition : f:('a -> bool) -> 'a list -> ('a list * 'a list) +val partition_map : + f:('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) +val assoc : 'a -> ('a * 'b) list -> 'b +val assoc_opt : 'a -> ('a * 'b) list -> 'b option +val assq : 'a -> ('a * 'b) list -> 'b +val assq_opt : 'a -> ('a * 'b) list -> 'b option +val mem_assoc : 'a -> map:('a * 'b) list -> bool +val mem_assq : 'a -> map:('a * 'b) list -> bool +val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list +val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list +val split : ('a * 'b) list -> ('a list * 'b list) +val combine : 'a list -> 'b list -> ('a * 'b) list +val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list +val to_seq : 'a list -> 'a Seq.t +val of_seq : 'a Seq.t -> 'a list diff --git a/interfaces/5.4/map.mli b/interfaces/5.4/map.mli new file mode 100644 index 0000000..07f6901 --- /dev/null +++ b/interfaces/5.4/map.mli @@ -0,0 +1,100 @@ +module type OrderedType = sig type t val compare : t -> t -> int end +module type S = + sig + type key + type +!'a t + val empty : 'a t + val add : key -> 'a -> 'a t -> 'a t + val add_to_list : key -> 'a -> 'a list t -> 'a list t + val update : key -> ('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t + val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : (key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option + val find_last : (key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option + val iter : (key -> 'a -> unit) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val map : ('a -> 'b) -> 'a t -> 'b t + val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t + val filter : (key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : (key -> 'a -> bool) -> 'a t -> bool + val exists : (key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end +module Make : +(Ord : OrderedType) -> + sig + type key = Ord.t + type +!'a t + val empty : 'a t + val add : key -> 'a -> 'a t -> 'a t + val add_to_list : key -> 'a -> 'a list t -> 'a list t + val update : key -> ('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t + val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : (key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option + val find_last : (key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option + val iter : (key -> 'a -> unit) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val map : ('a -> 'b) -> 'a t -> 'b t + val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t + val filter : (key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : (key -> 'a -> bool) -> 'a t -> bool + val exists : (key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end diff --git a/interfaces/5.4/marshal.mli b/interfaces/5.4/marshal.mli new file mode 100644 index 0000000..2902fd4 --- /dev/null +++ b/interfaces/5.4/marshal.mli @@ -0,0 +1,16 @@ +type extern_flags = + | No_sharing + | Closures + | Compat_32 +val to_channel : out_channel -> 'a -> extern_flags list -> unit +external to_bytes : + 'a -> extern_flags list -> bytes = "caml_output_value_to_bytes" +external to_string : + 'a -> extern_flags list -> string = "caml_output_value_to_string" +val to_buffer : bytes -> int -> int -> 'a -> extern_flags list -> int +val from_channel : in_channel -> 'a +val from_bytes : bytes -> int -> 'a +val from_string : string -> int -> 'a +val header_size : int +val data_size : bytes -> int -> int +val total_size : bytes -> int -> int diff --git a/interfaces/5.4/moreLabels.mli b/interfaces/5.4/moreLabels.mli new file mode 100644 index 0000000..2b3056d --- /dev/null +++ b/interfaces/5.4/moreLabels.mli @@ -0,0 +1,372 @@ +module Hashtbl : +sig + type ('a, 'b) t = ('a, 'b) Hashtbl.t + val create : ?random:bool -> int -> ('a, 'b) t + val clear : ('a, 'b) t -> unit + val reset : ('a, 'b) t -> unit + val copy : ('a, 'b) t -> ('a, 'b) t + val add : ('a, 'b) t -> key:'a -> data:'b -> unit + val find : ('a, 'b) t -> 'a -> 'b + val find_opt : ('a, 'b) t -> 'a -> 'b option + val find_all : ('a, 'b) t -> 'a -> 'b list + val mem : ('a, 'b) t -> 'a -> bool + val remove : ('a, 'b) t -> 'a -> unit + val replace : ('a, 'b) t -> key:'a -> data:'b -> unit + val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit + val filter_map_inplace : + f:(key:'a -> data:'b -> 'b option) -> ('a, 'b) t -> unit + val fold : + f:(key:'a -> data:'b -> 'acc -> 'acc) -> ('a, 'b) t -> init:'acc -> 'acc + val length : ('a, 'b) t -> int + val randomize : unit -> unit + val is_randomized : unit -> bool + val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t + type statistics = Hashtbl.statistics = + { + num_bindings: int ; + num_buckets: int ; + max_bucket_length: int ; + bucket_histogram: int array } + val stats : ('a, 'b) t -> statistics + val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t + val to_seq_keys : ('a, 'b) t -> 'a Seq.t + val to_seq_values : ('a, 'b) t -> 'b Seq.t + val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit + val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit + val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t + module type HashedType = + sig type t val equal : t -> t -> bool val hash : t -> int end + module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module Make : + (H : HashedType) -> + sig + type key = H.t + type 'a t = 'a Hashtbl.Make(H).t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module type SeededHashedType = + sig type t val equal : t -> t -> bool val seeded_hash : int -> t -> int + end + module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module MakeSeeded : + (H : SeededHashedType) -> + sig + type key = H.t + type 'a t = 'a Hashtbl.MakeSeeded(H).t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + val hash : 'a -> int + val seeded_hash : int -> 'a -> int + val hash_param : int -> int -> 'a -> int + val seeded_hash_param : int -> int -> int -> 'a -> int +end +module Map : +sig + module type OrderedType = sig type t val compare : t -> t -> int end + module type S = + sig + type key + type +!'a t + val empty : 'a t + val add : key:key -> data:'a -> 'a t -> 'a t + val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t + val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t + val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : f:(key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val find_last : f:(key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val map : f:('a -> 'b) -> 'a t -> 'b t + val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t + val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : f:(key -> 'a -> bool) -> 'a t -> bool + val exists : f:(key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end + module Make : + (Ord : OrderedType) -> + sig + type key = Ord.t + type 'a t = 'a Map.Make(Ord).t + val empty : 'a t + val add : key:key -> data:'a -> 'a t -> 'a t + val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t + val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t + val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : f:(key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val find_last : f:(key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val map : f:('a -> 'b) -> 'a t -> 'b t + val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t + val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : f:(key -> 'a -> bool) -> 'a t -> bool + val exists : f:(key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end +end +module Set : +sig + module type OrderedType = sig type t val compare : t -> t -> int end + module type S = + sig + type elt + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : f:(elt -> bool) -> t -> elt + val find_first_opt : f:(elt -> bool) -> t -> elt option + val find_last : f:(elt -> bool) -> t -> elt + val find_last_opt : f:(elt -> bool) -> t -> elt option + val iter : f:(elt -> unit) -> t -> unit + val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val map : f:(elt -> elt) -> t -> t + val filter : f:(elt -> bool) -> t -> t + val filter_map : f:(elt -> elt option) -> t -> t + val partition : f:(elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : f:(elt -> bool) -> t -> bool + val exists : f:(elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end + module Make : + (Ord : OrderedType) -> + sig + type elt = Ord.t + type t = Set.Make(Ord).t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : f:(elt -> bool) -> t -> elt + val find_first_opt : f:(elt -> bool) -> t -> elt option + val find_last : f:(elt -> bool) -> t -> elt + val find_last_opt : f:(elt -> bool) -> t -> elt option + val iter : f:(elt -> unit) -> t -> unit + val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val map : f:(elt -> elt) -> t -> t + val filter : f:(elt -> bool) -> t -> t + val filter_map : f:(elt -> elt option) -> t -> t + val partition : f:(elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : f:(elt -> bool) -> t -> bool + val exists : f:(elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end +end diff --git a/interfaces/5.4/nativeint.mli b/interfaces/5.4/nativeint.mli new file mode 100644 index 0000000..0c2db5c --- /dev/null +++ b/interfaces/5.4/nativeint.mli @@ -0,0 +1,47 @@ +val zero : nativeint +val one : nativeint +val minus_one : nativeint +external neg : nativeint -> nativeint = "%nativeint_neg" +external add : nativeint -> nativeint -> nativeint = "%nativeint_add" +external sub : nativeint -> nativeint -> nativeint = "%nativeint_sub" +external mul : nativeint -> nativeint -> nativeint = "%nativeint_mul" +external div : nativeint -> nativeint -> nativeint = "%nativeint_div" +val unsigned_div : nativeint -> nativeint -> nativeint +external rem : nativeint -> nativeint -> nativeint = "%nativeint_mod" +val unsigned_rem : nativeint -> nativeint -> nativeint +val succ : nativeint -> nativeint +val pred : nativeint -> nativeint +val abs : nativeint -> nativeint +val size : int +val max_int : nativeint +val min_int : nativeint +external logand : nativeint -> nativeint -> nativeint = "%nativeint_and" +external logor : nativeint -> nativeint -> nativeint = "%nativeint_or" +external logxor : nativeint -> nativeint -> nativeint = "%nativeint_xor" +val lognot : nativeint -> nativeint +external shift_left : nativeint -> int -> nativeint = "%nativeint_lsl" +external shift_right : nativeint -> int -> nativeint = "%nativeint_asr" +external shift_right_logical : + nativeint -> int -> nativeint = "%nativeint_lsr" +external of_int : int -> nativeint = "%nativeint_of_int" +external to_int : nativeint -> int = "%nativeint_to_int" +val unsigned_to_int : nativeint -> int option +external of_float : + float -> nativeint = "caml_nativeint_of_float" + "caml_nativeint_of_float_unboxed"[@@unboxed ][@@noalloc ] +external to_float : + nativeint -> float = "caml_nativeint_to_float" + "caml_nativeint_to_float_unboxed"[@@unboxed ][@@noalloc ] +external of_int32 : int32 -> nativeint = "%nativeint_of_int32" +external to_int32 : nativeint -> int32 = "%nativeint_to_int32" +external of_string : string -> nativeint = "caml_nativeint_of_string" +val of_string_opt : string -> nativeint option +val to_string : nativeint -> string +type t = nativeint +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.4/obj.mli b/interfaces/5.4/obj.mli new file mode 100644 index 0000000..d6d0e07 --- /dev/null +++ b/interfaces/5.4/obj.mli @@ -0,0 +1,66 @@ +type t +type raw_data = nativeint +external repr : 'a -> t = "%identity" +external obj : t -> 'a = "%identity" +external magic : 'a -> 'b = "%identity" +val is_block : t -> bool +external is_int : t -> bool = "%obj_is_int" +external tag : t -> int = "caml_obj_tag"[@@noalloc ] +external size : t -> int = "%obj_size" +external reachable_words : t -> int = "caml_obj_reachable_words" +external field : t -> int -> t = "%obj_field" +external set_field : t -> int -> t -> unit = "%obj_set_field" +val double_field : t -> int -> float +val set_double_field : t -> int -> float -> unit +external raw_field : t -> int -> raw_data = "caml_obj_raw_field" +external set_raw_field : + t -> int -> raw_data -> unit = "caml_obj_set_raw_field" +external new_block : int -> int -> t = "caml_obj_block" +external dup : t -> t = "caml_obj_dup" +external add_offset : t -> Int32.t -> t = "caml_obj_add_offset" +external with_tag : int -> t -> t = "caml_obj_with_tag" +val first_non_constant_constructor_tag : int +val last_non_constant_constructor_tag : int +val forcing_tag : int +val cont_tag : int +val lazy_tag : int +val closure_tag : int +val object_tag : int +val infix_tag : int +val forward_tag : int +val no_scan_tag : int +val abstract_tag : int +val string_tag : int +val double_tag : int +val double_array_tag : int +val custom_tag : int +val int_tag : int +val out_of_heap_tag : int +val unaligned_tag : int +module Extension_constructor : +sig + type t = extension_constructor + val of_val : 'a -> t + val name : t -> string + val id : t -> int +end +module Ephemeron : +sig + type obj_t = t + type t + val create : int -> t + val length : t -> int + val get_key : t -> int -> obj_t option + val get_key_copy : t -> int -> obj_t option + val set_key : t -> int -> obj_t -> unit + val unset_key : t -> int -> unit + val check_key : t -> int -> bool + val blit_key : t -> int -> t -> int -> int -> unit + val get_data : t -> obj_t option + val get_data_copy : t -> obj_t option + val set_data : t -> obj_t -> unit + val unset_data : t -> unit + val check_data : t -> bool + val blit_data : t -> t -> unit + val max_ephe_length : int +end diff --git a/interfaces/5.4/oo.mli b/interfaces/5.4/oo.mli new file mode 100644 index 0000000..7a03b33 --- /dev/null +++ b/interfaces/5.4/oo.mli @@ -0,0 +1,4 @@ +val copy : (< .. > as 'a) -> 'a +external id : < .. > -> int = "%field1" +val new_method : string -> CamlinternalOO.tag +val public_method_label : string -> CamlinternalOO.tag diff --git a/interfaces/5.4/option.mli b/interfaces/5.4/option.mli new file mode 100644 index 0000000..9d309eb --- /dev/null +++ b/interfaces/5.4/option.mli @@ -0,0 +1,19 @@ +type 'a t = 'a option = + | None + | Some of 'a +val none : 'a option +val some : 'a -> 'a option +val value : 'a option -> default:'a -> 'a +val get : 'a option -> 'a +val bind : 'a option -> ('a -> 'b option) -> 'b option +val join : 'a option option -> 'a option +val map : ('a -> 'b) -> 'a option -> 'b option +val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a +val iter : ('a -> unit) -> 'a option -> unit +val is_none : 'a option -> bool +val is_some : 'a option -> bool +val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool +val compare : ('a -> 'a -> int) -> 'a option -> 'a option -> int +val to_result : none:'e -> 'a option -> ('a, 'e) result +val to_list : 'a option -> 'a list +val to_seq : 'a option -> 'a Seq.t diff --git a/interfaces/5.4/out_channel.mli b/interfaces/5.4/out_channel.mli new file mode 100644 index 0000000..2331a26 --- /dev/null +++ b/interfaces/5.4/out_channel.mli @@ -0,0 +1,41 @@ +type t = out_channel +type open_flag = open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val stdout : t +val stderr : t +val open_bin : string -> t +val open_text : string -> t +val open_gen : open_flag list -> int -> string -> t +val with_open_bin : string -> (t -> 'a) -> 'a +val with_open_text : string -> (t -> 'a) -> 'a +val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a +val close : t -> unit +val close_noerr : t -> unit +val output_char : t -> char -> unit +val output_byte : t -> int -> unit +val output_string : t -> string -> unit +val output_bytes : t -> bytes -> unit +val output : t -> bytes -> int -> int -> unit +val output_substring : t -> string -> int -> int -> unit +val output_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit +val flush : t -> unit +val flush_all : unit -> unit +val seek : t -> int64 -> unit +val pos : t -> int64 +val length : t -> int64 +val set_binary_mode : t -> bool -> unit +val is_binary_mode : t -> bool +val set_buffered : t -> bool -> unit +val is_buffered : t -> bool +val isatty : t -> bool diff --git a/interfaces/5.4/parsing.mli b/interfaces/5.4/parsing.mli new file mode 100644 index 0000000..68f1243 --- /dev/null +++ b/interfaces/5.4/parsing.mli @@ -0,0 +1,36 @@ +val symbol_start : unit -> int +val symbol_end : unit -> int +val rhs_start : int -> int +val rhs_end : int -> int +val symbol_start_pos : unit -> Lexing.position +val symbol_end_pos : unit -> Lexing.position +val rhs_start_pos : int -> Lexing.position +val rhs_end_pos : int -> Lexing.position +val clear_parser : unit -> unit +exception Parse_error +val set_trace : bool -> bool +type parser_env +type parse_tables = + { + actions: (parser_env -> Obj.t) array ; + transl_const: int array ; + transl_block: int array ; + lhs: string ; + len: string ; + defred: string ; + dgoto: string ; + sindex: string ; + rindex: string ; + gindex: string ; + tablesize: int ; + table: string ; + check: string ; + error_function: string -> unit ; + names_const: string ; + names_block: string } +exception YYexit of Obj.t +val yyparse : + parse_tables -> int -> (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'b +val peek_val : parser_env -> int -> 'a +val is_current_lookahead : 'a -> bool +val parse_error : string -> unit diff --git a/interfaces/5.4/printexc.mli b/interfaces/5.4/printexc.mli new file mode 100644 index 0000000..171ec13 --- /dev/null +++ b/interfaces/5.4/printexc.mli @@ -0,0 +1,52 @@ +type t = exn = .. +val to_string : exn -> string +val to_string_default : exn -> string +val print : ('a -> 'b) -> 'a -> 'b +val catch : ('a -> 'b) -> 'a -> 'b +val print_backtrace : out_channel -> unit +val get_backtrace : unit -> string +val record_backtrace : bool -> unit +val backtrace_status : unit -> bool +val register_printer : (exn -> string option) -> unit +val use_printers : exn -> string option +type raw_backtrace +type raw_backtrace_entry = private int +val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array +val get_raw_backtrace : unit -> raw_backtrace +val print_raw_backtrace : out_channel -> raw_backtrace -> unit +val raw_backtrace_to_string : raw_backtrace -> string +external raise_with_backtrace : + exn -> raw_backtrace -> 'a = "%raise_with_backtrace" +external get_callstack : int -> raw_backtrace = "caml_get_current_callstack" +val default_uncaught_exception_handler : exn -> raw_backtrace -> unit +val set_uncaught_exception_handler : (exn -> raw_backtrace -> unit) -> unit +type backtrace_slot +val backtrace_slots : raw_backtrace -> backtrace_slot array option +val backtrace_slots_of_raw_entry : + raw_backtrace_entry -> backtrace_slot array option +type location = + { + filename: string ; + line_number: int ; + start_char: int ; + end_char: int ; + end_line: int ; + end_col: int } +module Slot : +sig + type t = backtrace_slot + val is_raise : t -> bool + val is_inline : t -> bool + val location : t -> location option + val name : t -> string option + val format : int -> t -> string option +end +type raw_backtrace_slot +val raw_backtrace_length : raw_backtrace -> int +val get_raw_backtrace_slot : raw_backtrace -> int -> raw_backtrace_slot +val convert_raw_backtrace_slot : raw_backtrace_slot -> backtrace_slot +val get_raw_backtrace_next_slot : + raw_backtrace_slot -> raw_backtrace_slot option +val exn_slot_id : exn -> int +val exn_slot_name : exn -> string +val string_of_extension_constructor : Obj.t -> string diff --git a/interfaces/5.4/printf.mli b/interfaces/5.4/printf.mli new file mode 100644 index 0000000..d66ad22 --- /dev/null +++ b/interfaces/5.4/printf.mli @@ -0,0 +1,17 @@ +val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a +val printf : ('a, out_channel, unit) format -> 'a +val eprintf : ('a, out_channel, unit) format -> 'a +val sprintf : ('a, unit, string) format -> 'a +val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +val ifprintf : 'b -> ('a, 'b, 'c, unit) format4 -> 'a +val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +val kfprintf : + (out_channel -> 'd) -> + out_channel -> ('a, out_channel, unit, 'd) format4 -> 'a +val ikfprintf : ('b -> 'd) -> 'b -> ('a, 'b, 'c, 'd) format4 -> 'a +val ksprintf : (string -> 'd) -> ('a, unit, string, 'd) format4 -> 'a +val kbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +val ikbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +val kprintf : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a diff --git a/interfaces/5.4/queue.mli b/interfaces/5.4/queue.mli new file mode 100644 index 0000000..551a327 --- /dev/null +++ b/interfaces/5.4/queue.mli @@ -0,0 +1,22 @@ +type !'a t +exception Empty +val create : unit -> 'a t +val add : 'a -> 'a t -> unit +val push : 'a -> 'a t -> unit +val take : 'a t -> 'a +val take_opt : 'a t -> 'a option +val pop : 'a t -> 'a +val peek : 'a t -> 'a +val peek_opt : 'a t -> 'a option +val top : 'a t -> 'a +val drop : 'a t -> unit +val clear : 'a t -> unit +val copy : 'a t -> 'a t +val is_empty : 'a t -> bool +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val transfer : 'a t -> 'a t -> unit +val to_seq : 'a t -> 'a Seq.t +val add_seq : 'a t -> 'a Seq.t -> unit +val of_seq : 'a Seq.t -> 'a t diff --git a/interfaces/5.4/random.mli b/interfaces/5.4/random.mli new file mode 100644 index 0000000..f1f49e8 --- /dev/null +++ b/interfaces/5.4/random.mli @@ -0,0 +1,46 @@ +val init : int -> unit +val full_init : int array -> unit +val self_init : unit -> unit +val bits : unit -> int +val int : int -> int +val full_int : int -> int +val int_in_range : min:int -> max:int -> int +val int32 : Int32.t -> Int32.t +val int32_in_range : min:int32 -> max:int32 -> int32 +val nativeint : Nativeint.t -> Nativeint.t +val nativeint_in_range : min:nativeint -> max:nativeint -> nativeint +val int64 : Int64.t -> Int64.t +val int64_in_range : min:int64 -> max:int64 -> int64 +val float : float -> float +val bool : unit -> bool +val bits32 : unit -> Int32.t +val bits64 : unit -> Int64.t +val nativebits : unit -> Nativeint.t +module State : +sig + type t + val make : int array -> t + val make_self_init : unit -> t + val copy : t -> t + val bits : t -> int + val int : t -> int -> int + val full_int : t -> int -> int + val int_in_range : t -> min:int -> max:int -> int + val int32 : t -> Int32.t -> Int32.t + val int32_in_range : t -> min:int32 -> max:int32 -> int32 + val nativeint : t -> Nativeint.t -> Nativeint.t + val nativeint_in_range : t -> min:nativeint -> max:nativeint -> nativeint + val int64 : t -> Int64.t -> Int64.t + val int64_in_range : t -> min:int64 -> max:int64 -> int64 + val float : t -> float -> float + val bool : t -> bool + val bits32 : t -> Int32.t + val bits64 : t -> Int64.t + val nativebits : t -> Nativeint.t + val split : t -> t + val to_binary_string : t -> string + val of_binary_string : string -> t +end +val get_state : unit -> State.t +val set_state : State.t -> unit +val split : unit -> State.t diff --git a/interfaces/5.4/result.mli b/interfaces/5.4/result.mli new file mode 100644 index 0000000..80db98e --- /dev/null +++ b/interfaces/5.4/result.mli @@ -0,0 +1,38 @@ +type ('a, 'e) t = ('a, 'e) result = + | Ok of 'a + | Error of 'e +val ok : 'a -> ('a, 'e) result +val error : 'e -> ('a, 'e) result +val value : ('a, 'e) result -> default:'a -> 'a +val get_ok : ('a, 'e) result -> 'a +val get_ok' : ('a, string) result -> 'a +val get_error : ('a, 'e) result -> 'e +val error_to_failure : ('a, string) result -> 'a +val bind : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result +val join : (('a, 'e) result, 'e) result -> ('a, 'e) result +val map : ('a -> 'b) -> ('a, 'e) result -> ('b, 'e) result +val product : ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result +val map_error : ('e -> 'f) -> ('a, 'e) result -> ('a, 'f) result +val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) result -> 'c +val retract : ('a, 'a) result -> 'a +val iter : ('a -> unit) -> ('a, 'e) result -> unit +val iter_error : ('e -> unit) -> ('a, 'e) result -> unit +val is_ok : ('a, 'e) result -> bool +val is_error : ('a, 'e) result -> bool +val equal : + ok:('a -> 'a -> bool) -> + error:('e -> 'e -> bool) -> ('a, 'e) result -> ('a, 'e) result -> bool +val compare : + ok:('a -> 'a -> int) -> + error:('e -> 'e -> int) -> ('a, 'e) result -> ('a, 'e) result -> int +val to_option : ('a, 'e) result -> 'a option +val to_list : ('a, 'e) result -> 'a list +val to_seq : ('a, 'e) result -> 'a Seq.t +module Syntax : +sig + val ( let* ) : + ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result + val ( and* ) : ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result + val (let+) : ('a, 'e) result -> ('a -> 'b) -> ('b, 'e) result + val (and+) : ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result +end diff --git a/interfaces/5.4/scanf.mli b/interfaces/5.4/scanf.mli new file mode 100644 index 0000000..6827794 --- /dev/null +++ b/interfaces/5.4/scanf.mli @@ -0,0 +1,46 @@ +module Scanning : +sig + type in_channel + type scanbuf = in_channel + val stdin : in_channel + type file_name = string + val open_in : file_name -> in_channel + val open_in_bin : file_name -> in_channel + val close_in : in_channel -> unit + val from_file : file_name -> in_channel + val from_file_bin : string -> in_channel + val from_string : string -> in_channel + val from_function : (unit -> char) -> in_channel + val from_channel : Stdlib.in_channel -> in_channel + val end_of_input : in_channel -> bool + val beginning_of_input : in_channel -> bool + val name_of_input : in_channel -> string +end +type ('a, 'b, 'c, 'd) scanner = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd, 'd) format6 -> 'c +type ('a, 'b, 'c, 'd) scanner_opt = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd option, 'd) format6 -> 'c +exception Scan_failure of string +val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner +val bscanf_opt : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner_opt +val sscanf : string -> ('a, 'b, 'c, 'd) scanner +val sscanf_opt : string -> ('a, 'b, 'c, 'd) scanner_opt +val scanf : ('a, 'b, 'c, 'd) scanner +val scanf_opt : ('a, 'b, 'c, 'd) scanner_opt +val kscanf : + Scanning.in_channel -> + (Scanning.in_channel -> exn -> 'd) -> ('a, 'b, 'c, 'd) scanner +val ksscanf : + string -> (Scanning.in_channel -> exn -> 'd) -> ('a, 'b, 'c, 'd) scanner +val bscanf_format : + Scanning.in_channel -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> 'g +val sscanf_format : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> 'g +val format_from_string : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 +val unescaped : string -> string diff --git a/interfaces/5.4/seq.mli b/interfaces/5.4/seq.mli new file mode 100644 index 0000000..7077655 --- /dev/null +++ b/interfaces/5.4/seq.mli @@ -0,0 +1,65 @@ +type 'a t = unit -> 'a node +and 'a node = + | Nil + | Cons of 'a * 'a t +val is_empty : 'a t -> bool +val uncons : 'a t -> ('a * 'a t) option +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val iteri : (int -> 'a -> unit) -> 'a t -> unit +val fold_lefti : ('acc -> int -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val for_all : ('a -> bool) -> 'a t -> bool +val exists : ('a -> bool) -> 'a t -> bool +val find : ('a -> bool) -> 'a t -> 'a option +val find_index : ('a -> bool) -> 'a t -> int option +val find_map : ('a -> 'b option) -> 'a t -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option +val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit +val fold_left2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc +val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int +val empty : 'a t +val return : 'a -> 'a t +val cons : 'a -> 'a t -> 'a t +val singleton : 'a -> 'a t +val init : int -> (int -> 'a) -> 'a t +val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t +val repeat : 'a -> 'a t +val forever : (unit -> 'a) -> 'a t +val cycle : 'a t -> 'a t +val iterate : ('a -> 'a) -> 'a -> 'a t +val map : ('a -> 'b) -> 'a t -> 'b t +val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t +val filter : ('a -> bool) -> 'a t -> 'a t +val filteri : (int -> 'a -> bool) -> 'a t -> 'a t +val filter_map : ('a -> 'b option) -> 'a t -> 'b t +val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t +val take : int -> 'a t -> 'a t +val drop : int -> 'a t -> 'a t +val take_while : ('a -> bool) -> 'a t -> 'a t +val drop_while : ('a -> bool) -> 'a t -> 'a t +val group : ('a -> 'a -> bool) -> 'a t -> 'a t t +val memoize : 'a t -> 'a t +exception Forced_twice +val once : 'a t -> 'a t +val transpose : 'a t t -> 'a t t +val append : 'a t -> 'a t -> 'a t +val concat : 'a t t -> 'a t +val flat_map : ('a -> 'b t) -> 'a t -> 'b t +val concat_map : ('a -> 'b t) -> 'a t -> 'b t +val zip : 'a t -> 'b t -> ('a * 'b) t +val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t +val interleave : 'a t -> 'a t -> 'a t +val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t +val product : 'a t -> 'b t -> ('a * 'b) t +val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t +val unzip : ('a * 'b) t -> ('a t * 'b t) +val split : ('a * 'b) t -> ('a t * 'b t) +val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> ('b t * 'c t) +val partition : ('a -> bool) -> 'a t -> ('a t * 'a t) +val of_dispenser : (unit -> 'a option) -> 'a t +val to_dispenser : 'a t -> unit -> 'a option +val ints : int -> int t diff --git a/interfaces/5.4/set.mli b/interfaces/5.4/set.mli new file mode 100644 index 0000000..90c3c45 --- /dev/null +++ b/interfaces/5.4/set.mli @@ -0,0 +1,98 @@ +module type OrderedType = sig type t val compare : t -> t -> int end +module type S = + sig + type elt + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : (elt -> bool) -> t -> elt + val find_first_opt : (elt -> bool) -> t -> elt option + val find_last : (elt -> bool) -> t -> elt + val find_last_opt : (elt -> bool) -> t -> elt option + val iter : (elt -> unit) -> t -> unit + val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val map : (elt -> elt) -> t -> t + val filter : (elt -> bool) -> t -> t + val filter_map : (elt -> elt option) -> t -> t + val partition : (elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : (elt -> bool) -> t -> bool + val exists : (elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end +module Make : +(Ord : OrderedType) -> + sig + type elt = Ord.t + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : (elt -> bool) -> t -> elt + val find_first_opt : (elt -> bool) -> t -> elt option + val find_last : (elt -> bool) -> t -> elt + val find_last_opt : (elt -> bool) -> t -> elt option + val iter : (elt -> unit) -> t -> unit + val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val map : (elt -> elt) -> t -> t + val filter : (elt -> bool) -> t -> t + val filter_map : (elt -> elt option) -> t -> t + val partition : (elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : (elt -> bool) -> t -> bool + val exists : (elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end diff --git a/interfaces/5.4/stack.mli b/interfaces/5.4/stack.mli new file mode 100644 index 0000000..a0d39d1 --- /dev/null +++ b/interfaces/5.4/stack.mli @@ -0,0 +1,18 @@ +type !'a t +exception Empty +val create : unit -> 'a t +val push : 'a -> 'a t -> unit +val pop : 'a t -> 'a +val pop_opt : 'a t -> 'a option +val drop : 'a t -> unit +val top : 'a t -> 'a +val top_opt : 'a t -> 'a option +val clear : 'a t -> unit +val copy : 'a t -> 'a t +val is_empty : 'a t -> bool +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val to_seq : 'a t -> 'a Seq.t +val add_seq : 'a t -> 'a Seq.t -> unit +val of_seq : 'a Seq.t -> 'a t diff --git a/interfaces/5.4/stdLabels.mli b/interfaces/5.4/stdLabels.mli new file mode 100644 index 0000000..d86b996 --- /dev/null +++ b/interfaces/5.4/stdLabels.mli @@ -0,0 +1,4 @@ +module Array = ArrayLabels +module Bytes = BytesLabels +module List = ListLabels +module String = StringLabels diff --git a/interfaces/5.4/stdlib.mli b/interfaces/5.4/stdlib.mli new file mode 100644 index 0000000..85d382e --- /dev/null +++ b/interfaces/5.4/stdlib.mli @@ -0,0 +1,331 @@ +external raise : exn -> 'a = "%raise" +external raise_notrace : exn -> 'a = "%raise_notrace" +val invalid_arg : string -> 'a +val failwith : string -> 'a +exception Exit +exception Match_failure of (string * int * int) +exception Assert_failure of (string * int * int) +exception Invalid_argument of string +exception Failure of string +exception Not_found +exception Out_of_memory +exception Stack_overflow +exception Sys_error of string +exception End_of_file +exception Division_by_zero +exception Sys_blocked_io +exception Undefined_recursive_module of (string * int * int) +external (=) : 'a -> 'a -> bool = "%equal" +external (<>) : 'a -> 'a -> bool = "%notequal" +external (<) : 'a -> 'a -> bool = "%lessthan" +external (>) : 'a -> 'a -> bool = "%greaterthan" +external (<=) : 'a -> 'a -> bool = "%lessequal" +external (>=) : 'a -> 'a -> bool = "%greaterequal" +external compare : 'a -> 'a -> int = "%compare" +val min : 'a -> 'a -> 'a +val max : 'a -> 'a -> 'a +external (==) : 'a -> 'a -> bool = "%eq" +external (!=) : 'a -> 'a -> bool = "%noteq" +external not : bool -> bool = "%boolnot" +external (&&) : bool -> bool -> bool = "%sequand" +external (||) : bool -> bool -> bool = "%sequor" +external __LOC__ : string = "%loc_LOC" +external __FILE__ : string = "%loc_FILE" +external __LINE__ : int = "%loc_LINE" +external __MODULE__ : string = "%loc_MODULE" +external __POS__ : (string * int * int * int) = "%loc_POS" +external __FUNCTION__ : string = "%loc_FUNCTION" +external __LOC_OF__ : 'a -> (string * 'a) = "%loc_LOC" +external __LINE_OF__ : 'a -> (int * 'a) = "%loc_LINE" +external __POS_OF__ : 'a -> ((string * int * int * int) * 'a) = "%loc_POS" +external (|>) : 'a -> ('a -> 'b) -> 'b = "%revapply" +external (@@) : ('a -> 'b) -> 'a -> 'b = "%apply" +external (~-) : int -> int = "%negint" +external (~+) : int -> int = "%identity" +external succ : int -> int = "%succint" +external pred : int -> int = "%predint" +external (+) : int -> int -> int = "%addint" +external (-) : int -> int -> int = "%subint" +external ( * ) : int -> int -> int = "%mulint" +external (/) : int -> int -> int = "%divint" +external \#mod : int -> int -> int = "%modint" +val abs : int -> int +val max_int : int +val min_int : int +external \#land : int -> int -> int = "%andint" +external \#lor : int -> int -> int = "%orint" +external \#lxor : int -> int -> int = "%xorint" +val lnot : int -> int +external \#lsl : int -> int -> int = "%lslint" +external \#lsr : int -> int -> int = "%lsrint" +external \#asr : int -> int -> int = "%asrint" +external (~-.) : float -> float = "%negfloat" +external (~+.) : float -> float = "%identity" +external (+.) : float -> float -> float = "%addfloat" +external (-.) : float -> float -> float = "%subfloat" +external ( *. ) : float -> float -> float = "%mulfloat" +external (/.) : float -> float -> float = "%divfloat" +external ( ** ) : float -> float -> float = "caml_power_float" "pow"[@@unboxed + ] +[@@noalloc ] +external sqrt : float -> float = "caml_sqrt_float" "sqrt"[@@unboxed ] +[@@noalloc ] +external exp : float -> float = "caml_exp_float" "exp"[@@unboxed ][@@noalloc + ] +external log : float -> float = "caml_log_float" "log"[@@unboxed ][@@noalloc + ] +external log10 : float -> float = "caml_log10_float" "log10"[@@unboxed ] +[@@noalloc ] +external expm1 : float -> float = "caml_expm1_float" "caml_expm1"[@@unboxed ] +[@@noalloc ] +external log1p : float -> float = "caml_log1p_float" "caml_log1p"[@@unboxed ] +[@@noalloc ] +external cos : float -> float = "caml_cos_float" "cos"[@@unboxed ][@@noalloc + ] +external sin : float -> float = "caml_sin_float" "sin"[@@unboxed ][@@noalloc + ] +external tan : float -> float = "caml_tan_float" "tan"[@@unboxed ][@@noalloc + ] +external acos : float -> float = "caml_acos_float" "acos"[@@unboxed ] +[@@noalloc ] +external asin : float -> float = "caml_asin_float" "asin"[@@unboxed ] +[@@noalloc ] +external atan : float -> float = "caml_atan_float" "atan"[@@unboxed ] +[@@noalloc ] +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" +[@@unboxed ][@@noalloc ] +external hypot : float -> float -> float = "caml_hypot_float" "caml_hypot" +[@@unboxed ][@@noalloc ] +external cosh : float -> float = "caml_cosh_float" "cosh"[@@unboxed ] +[@@noalloc ] +external sinh : float -> float = "caml_sinh_float" "sinh"[@@unboxed ] +[@@noalloc ] +external tanh : float -> float = "caml_tanh_float" "tanh"[@@unboxed ] +[@@noalloc ] +external acosh : float -> float = "caml_acosh_float" "caml_acosh"[@@unboxed ] +[@@noalloc ] +external asinh : float -> float = "caml_asinh_float" "caml_asinh"[@@unboxed ] +[@@noalloc ] +external atanh : float -> float = "caml_atanh_float" "caml_atanh"[@@unboxed ] +[@@noalloc ] +external ceil : float -> float = "caml_ceil_float" "ceil"[@@unboxed ] +[@@noalloc ] +external floor : float -> float = "caml_floor_float" "floor"[@@unboxed ] +[@@noalloc ] +external abs_float : float -> float = "%absfloat" +external copysign : + float -> float -> float = "caml_copysign_float" "caml_copysign"[@@unboxed ] +[@@noalloc ] +external mod_float : float -> float -> float = "caml_fmod_float" "fmod" +[@@unboxed ][@@noalloc ] +external frexp : float -> (float * int) = "caml_frexp_float" +external ldexp : + ((float)[@unboxed ]) -> ((int)[@untagged ]) -> ((float)[@unboxed ]) = + "caml_ldexp_float" "caml_ldexp_float_unboxed"[@@noalloc ] +external modf : float -> (float * float) = "caml_modf_float" +external float : int -> float = "%floatofint" +external float_of_int : int -> float = "%floatofint" +external truncate : float -> int = "%intoffloat" +external int_of_float : float -> int = "%intoffloat" +val infinity : float +val neg_infinity : float +val nan : float +val max_float : float +val min_float : float +val epsilon_float : float +type fpclass = + | FP_normal + | FP_subnormal + | FP_zero + | FP_infinite + | FP_nan +external classify_float : + ((float)[@unboxed ]) -> fpclass = "caml_classify_float" + "caml_classify_float_unboxed"[@@noalloc ] +val (^) : string -> string -> string +external int_of_char : char -> int = "%identity" +val char_of_int : int -> char +external ignore : 'a -> unit = "%ignore" +val string_of_bool : bool -> string +val bool_of_string_opt : string -> bool option +val bool_of_string : string -> bool +val string_of_int : int -> string +val int_of_string_opt : string -> int option +external int_of_string : string -> int = "caml_int_of_string" +val string_of_float : float -> string +val float_of_string_opt : string -> float option +external float_of_string : string -> float = "caml_float_of_string" +external fst : ('a * 'b) -> 'a = "%field0" +external snd : ('a * 'b) -> 'b = "%field1" +val (@) : 'a list -> 'a list -> 'a list +type in_channel +type out_channel +val stdin : in_channel +val stdout : out_channel +val stderr : out_channel +val print_char : char -> unit +val print_string : string -> unit +val print_bytes : bytes -> unit +val print_int : int -> unit +val print_float : float -> unit +val print_endline : string -> unit +val print_newline : unit -> unit +val prerr_char : char -> unit +val prerr_string : string -> unit +val prerr_bytes : bytes -> unit +val prerr_int : int -> unit +val prerr_float : float -> unit +val prerr_endline : string -> unit +val prerr_newline : unit -> unit +val read_line : unit -> string +val read_int_opt : unit -> int option +val read_int : unit -> int +val read_float_opt : unit -> float option +val read_float : unit -> float +type open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val open_out : string -> out_channel +val open_out_bin : string -> out_channel +val open_out_gen : open_flag list -> int -> string -> out_channel +val flush : out_channel -> unit +val flush_all : unit -> unit +val output_char : out_channel -> char -> unit +val output_string : out_channel -> string -> unit +val output_bytes : out_channel -> bytes -> unit +val output : out_channel -> bytes -> int -> int -> unit +val output_substring : out_channel -> string -> int -> int -> unit +val output_byte : out_channel -> int -> unit +val output_binary_int : out_channel -> int -> unit +val output_value : out_channel -> 'a -> unit +val seek_out : out_channel -> int -> unit +val pos_out : out_channel -> int +val out_channel_length : out_channel -> int +val close_out : out_channel -> unit +val close_out_noerr : out_channel -> unit +val set_binary_mode_out : out_channel -> bool -> unit +val open_in : string -> in_channel +val open_in_bin : string -> in_channel +val open_in_gen : open_flag list -> int -> string -> in_channel +val input_char : in_channel -> char +val input_line : in_channel -> string +val input : in_channel -> bytes -> int -> int -> int +val really_input : in_channel -> bytes -> int -> int -> unit +val really_input_string : in_channel -> int -> string +val input_byte : in_channel -> int +val input_binary_int : in_channel -> int +val input_value : in_channel -> 'a +val seek_in : in_channel -> int -> unit +val pos_in : in_channel -> int +val in_channel_length : in_channel -> int +val close_in : in_channel -> unit +val close_in_noerr : in_channel -> unit +val set_binary_mode_in : in_channel -> bool -> unit +module LargeFile : +sig + val seek_out : out_channel -> int64 -> unit + val pos_out : out_channel -> int64 + val out_channel_length : out_channel -> int64 + val seek_in : in_channel -> int64 -> unit + val pos_in : in_channel -> int64 + val in_channel_length : in_channel -> int64 +end +type 'a ref = { + mutable contents: 'a } +external ref : 'a -> 'a ref = "%makemutable" +external (!) : 'a ref -> 'a = "%field0" +external (:=) : 'a ref -> 'a -> unit = "%setfield0" +external incr : int ref -> unit = "%incr" +external decr : int ref -> unit = "%decr" +type ('a, 'b) result = + | Ok of 'a + | Error of 'b +type ('a, 'b, 'c, 'd, 'e, 'f) format6 = + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6 +type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6 +type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4 +val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string +external format_of_string : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 = + "%identity" +val (^^) : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6 +val exit : int -> 'a +val at_exit : (unit -> unit) -> unit +val valid_float_lexem : string -> string +val unsafe_really_input : in_channel -> bytes -> int -> int -> unit +val do_at_exit : unit -> unit +val do_domain_local_at_exit : (unit -> unit) ref +module Arg = Arg +module Array = Array +module ArrayLabels = ArrayLabels +module Atomic = Atomic +module Bigarray = Bigarray +module Bool = Bool +module Buffer = Buffer +module Bytes = Bytes +module BytesLabels = BytesLabels +module Callback = Callback +module Char = Char +module Complex = Complex +module Condition = Condition +module Digest = Digest +module Domain = Domain +module Dynarray = Dynarray +module Pqueue = Pqueue +module Effect = Effect +module Either = Either +module Ephemeron = Ephemeron +module Filename = Filename +module Float = Float +module Format = Format +module Fun = Fun +module Gc = Gc +module Hashtbl = Hashtbl +module Iarray = Iarray +module In_channel = In_channel +module Int = Int +module Int32 = Int32 +module Int64 = Int64 +module Lazy = Lazy +module Lexing = Lexing +module List = List +module ListLabels = ListLabels +module Map = Map +module Marshal = Marshal +module MoreLabels = MoreLabels +module Mutex = Mutex +module Nativeint = Nativeint +module Obj = Obj +module Oo = Oo +module Option = Option +module Out_channel = Out_channel +module Pair = Pair +module Parsing = Parsing +module Printexc = Printexc +module Printf = Printf +module Queue = Queue +module Random = Random +module Result = Result +module Repr = Repr +module Scanf = Scanf +module Semaphore = Semaphore +module Seq = Seq +module Set = Set +module Stack = Stack +module StdLabels = StdLabels +module String = String +module StringLabels = StringLabels +module Sys = Sys +module Type = Type +module Uchar = Uchar +module Unit = Unit +module Weak = Weak diff --git a/interfaces/5.4/string.mli b/interfaces/5.4/string.mli new file mode 100644 index 0000000..de645e0 --- /dev/null +++ b/interfaces/5.4/string.mli @@ -0,0 +1,75 @@ +type t = string +val make : int -> char -> string +val init : int -> (int -> char) -> string +val empty : string +external length : string -> int = "%string_length" +external get : string -> int -> char = "%string_safe_get" +val of_bytes : bytes -> string +val to_bytes : string -> bytes +val blit : string -> int -> bytes -> int -> int -> unit +val concat : string -> string list -> string +val cat : string -> string -> string +val equal : t -> t -> bool +val compare : t -> t -> int +val starts_with : prefix:string -> string -> bool +val ends_with : suffix:string -> string -> bool +val contains_from : string -> int -> char -> bool +val rcontains_from : string -> int -> char -> bool +val contains : string -> char -> bool +val sub : string -> int -> int -> string +val split_on_char : char -> string -> string list +val map : (char -> char) -> string -> string +val mapi : (int -> char -> char) -> string -> string +val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc +val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc +val for_all : (char -> bool) -> string -> bool +val exists : (char -> bool) -> string -> bool +val trim : string -> string +val escaped : string -> string +val uppercase_ascii : string -> string +val lowercase_ascii : string -> string +val capitalize_ascii : string -> string +val uncapitalize_ascii : string -> string +val iter : (char -> unit) -> string -> unit +val iteri : (int -> char -> unit) -> string -> unit +val index_from : string -> int -> char -> int +val index_from_opt : string -> int -> char -> int option +val rindex_from : string -> int -> char -> int +val rindex_from_opt : string -> int -> char -> int option +val index : string -> char -> int +val index_opt : string -> char -> int option +val rindex : string -> char -> int +val rindex_opt : string -> char -> int option +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16le : t -> bool +val edit_distance : ?limit:int -> t -> t -> int +val spellcheck : + ?max_dist:(string -> int) -> + ((string -> unit) -> unit) -> string -> string list +val get_uint8 : string -> int -> int +val get_int8 : string -> int -> int +val get_uint16_ne : string -> int -> int +val get_uint16_be : string -> int -> int +val get_uint16_le : string -> int -> int +val get_int16_ne : string -> int -> int +val get_int16_be : string -> int -> int +val get_int16_le : string -> int -> int +val get_int32_ne : string -> int -> int32 +val hash : t -> int +val seeded_hash : int -> t -> int +val get_int32_be : string -> int -> int32 +val get_int32_le : string -> int -> int32 +val get_int64_ne : string -> int -> int64 +val get_int64_be : string -> int -> int64 +val get_int64_le : string -> int -> int64 +external unsafe_get : string -> int -> char = "%string_unsafe_get" +external unsafe_blit : + string -> int -> bytes -> int -> int -> unit = "caml_blit_string"[@@noalloc + ] diff --git a/interfaces/5.4/stringLabels.mli b/interfaces/5.4/stringLabels.mli new file mode 100644 index 0000000..2174f6c --- /dev/null +++ b/interfaces/5.4/stringLabels.mli @@ -0,0 +1,76 @@ +type t = string +val make : int -> char -> string +val init : int -> f:(int -> char) -> string +val empty : string +external length : string -> int = "%string_length" +external get : string -> int -> char = "%string_safe_get" +val of_bytes : bytes -> string +val to_bytes : string -> bytes +val blit : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val concat : sep:string -> string list -> string +val cat : string -> string -> string +val equal : t -> t -> bool +val compare : t -> t -> int +val starts_with : prefix:string -> string -> bool +val ends_with : suffix:string -> string -> bool +val contains_from : string -> int -> char -> bool +val rcontains_from : string -> int -> char -> bool +val contains : string -> char -> bool +val sub : string -> pos:int -> len:int -> string +val split_on_char : sep:char -> string -> string list +val map : f:(char -> char) -> string -> string +val mapi : f:(int -> char -> char) -> string -> string +val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> string -> 'acc +val fold_right : f:(char -> 'acc -> 'acc) -> string -> init:'acc -> 'acc +val for_all : f:(char -> bool) -> string -> bool +val exists : f:(char -> bool) -> string -> bool +val trim : string -> string +val escaped : string -> string +val uppercase_ascii : string -> string +val lowercase_ascii : string -> string +val capitalize_ascii : string -> string +val uncapitalize_ascii : string -> string +val iter : f:(char -> unit) -> string -> unit +val iteri : f:(int -> char -> unit) -> string -> unit +val index_from : string -> int -> char -> int +val index_from_opt : string -> int -> char -> int option +val rindex_from : string -> int -> char -> int +val rindex_from_opt : string -> int -> char -> int option +val index : string -> char -> int +val index_opt : string -> char -> int option +val rindex : string -> char -> int +val rindex_opt : string -> char -> int option +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16le : t -> bool +val edit_distance : ?limit:int -> t -> t -> int +val spellcheck : + ?max_dist:(string -> int) -> + ((string -> unit) -> unit) -> string -> string list +val get_uint8 : string -> int -> int +val get_int8 : string -> int -> int +val get_uint16_ne : string -> int -> int +val get_uint16_be : string -> int -> int +val get_uint16_le : string -> int -> int +val get_int16_ne : string -> int -> int +val get_int16_be : string -> int -> int +val get_int16_le : string -> int -> int +val get_int32_ne : string -> int -> int32 +val hash : t -> int +val seeded_hash : int -> t -> int +val get_int32_be : string -> int -> int32 +val get_int32_le : string -> int -> int32 +val get_int64_ne : string -> int -> int64 +val get_int64_be : string -> int -> int64 +val get_int64_le : string -> int -> int64 +external unsafe_get : string -> int -> char = "%string_unsafe_get" +external unsafe_blit : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_string"[@@noalloc ] diff --git a/interfaces/5.4/sys.mli b/interfaces/5.4/sys.mli new file mode 100644 index 0000000..b1bd2a0 --- /dev/null +++ b/interfaces/5.4/sys.mli @@ -0,0 +1,113 @@ +external argv : string array = "%sys_argv" +val executable_name : string +external file_exists : string -> bool = "caml_sys_file_exists" +external is_directory : string -> bool = "caml_sys_is_directory" +external is_regular_file : string -> bool = "caml_sys_is_regular_file" +external remove : string -> unit = "caml_sys_remove" +external rename : string -> string -> unit = "caml_sys_rename" +external getenv : string -> string = "caml_sys_getenv" +val getenv_opt : string -> string option +external command : string -> int = "caml_sys_system_command" +external time : + unit -> ((float)[@unboxed ]) = "caml_sys_time" "caml_sys_time_unboxed" +[@@noalloc ] +external chdir : string -> unit = "caml_sys_chdir" +external mkdir : string -> int -> unit = "caml_sys_mkdir" +external rmdir : string -> unit = "caml_sys_rmdir" +external getcwd : unit -> string = "caml_sys_getcwd" +external readdir : string -> string array = "caml_sys_read_directory" +val io_buffer_size : int +val interactive : bool ref +val os_type : string +type backend_type = + | Native + | Bytecode + | Other of string +val backend_type : backend_type +val unix : bool +val win32 : bool +val cygwin : bool +val word_size : int +val int_size : int +val big_endian : bool +val max_string_length : int +val max_array_length : int +val max_floatarray_length : int +external runtime_variant : unit -> string = "caml_runtime_variant" +external runtime_parameters : unit -> string = "caml_runtime_parameters" +external poll_actions : unit -> unit = "%poll" +type signal = int +type signal_behavior = + | Signal_default + | Signal_ignore + | Signal_handle of (signal -> unit) +external signal : + signal -> signal_behavior -> signal_behavior = + "caml_install_signal_handler" +val set_signal : signal -> signal_behavior -> unit +val sigabrt : signal +val sigalrm : signal +val sigfpe : signal +val sighup : signal +val sigill : signal +val sigint : signal +val sigkill : signal +val sigpipe : signal +val sigquit : signal +val sigsegv : signal +val sigterm : signal +val sigusr1 : signal +val sigusr2 : signal +val sigchld : signal +val sigcont : signal +val sigstop : signal +val sigtstp : signal +val sigttin : signal +val sigttou : signal +val sigvtalrm : signal +val sigprof : signal +val sigbus : signal +val sigpoll : signal +val sigsys : signal +val sigtrap : signal +val sigurg : signal +val sigxcpu : signal +val sigxfsz : signal +val sigio : signal +val sigwinch : signal +val signal_to_string : signal -> string +val signal_of_int : int -> signal +val signal_to_int : signal -> int +exception Break +val catch_break : bool -> unit +val ocaml_version : string +val development_version : bool +type extra_prefix = + | Plus + | Tilde +type extra_info = (extra_prefix * string) +type ocaml_release_info = + { + major: int ; + minor: int ; + patchlevel: int ; + extra: extra_info option } +val ocaml_release : ocaml_release_info +val enable_runtime_warnings : bool -> unit +val runtime_warnings_enabled : unit -> bool +external opaque_identity : 'a -> 'a = "%opaque" +module Immediate64 : +sig + module type Non_immediate = sig type t end + module type Immediate = sig type t[@@immediate ] end + module Make : + (Immediate : Immediate) -> + (Non_immediate : Non_immediate) -> + sig + type t[@@immediate64 ] + type 'a repr = + | Immediate: Immediate.t repr + | Non_immediate: Non_immediate.t repr + val repr : t repr + end +end diff --git a/interfaces/5.4/uchar.mli b/interfaces/5.4/uchar.mli new file mode 100644 index 0000000..d4058aa --- /dev/null +++ b/interfaces/5.4/uchar.mli @@ -0,0 +1,29 @@ +type t[@@immediate ] +val min : t +val max : t +val bom : t +val rep : t +val succ : t -> t +val pred : t -> t +val is_valid : int -> bool +val of_int : int -> t +val unsafe_of_int : int -> t +val to_int : t -> int +val is_char : t -> bool +val of_char : char -> t +val to_char : t -> char +val unsafe_to_char : t -> char +val equal : t -> t -> bool +val compare : t -> t -> int +val seeded_hash : int -> t -> int +val hash : t -> int +type utf_decode[@@immediate ] +val utf_decode_is_valid : utf_decode -> bool +val utf_decode_uchar : utf_decode -> t +val utf_decode_length : utf_decode -> int +val utf_decode : int -> t -> utf_decode +val utf_decode_invalid : int -> utf_decode +val utf_8_decode_length_of_byte : char -> int +val max_utf_8_decode_length : int +val utf_8_byte_length : t -> int +val utf_16_byte_length : t -> int diff --git a/interfaces/5.4/unit.mli b/interfaces/5.4/unit.mli new file mode 100644 index 0000000..1efbc15 --- /dev/null +++ b/interfaces/5.4/unit.mli @@ -0,0 +1,5 @@ +type t = unit = + | () +val equal : t -> t -> bool +val compare : t -> t -> int +val to_string : t -> string diff --git a/interfaces/5.4/weak.mli b/interfaces/5.4/weak.mli new file mode 100644 index 0000000..15fe75a --- /dev/null +++ b/interfaces/5.4/weak.mli @@ -0,0 +1,46 @@ +type !'a t +val create : int -> 'a t +val length : 'a t -> int +val set : 'a t -> int -> 'a option -> unit +val get : 'a t -> int -> 'a option +val get_copy : 'a t -> int -> 'a option +val check : 'a t -> int -> bool +val fill : 'a t -> int -> int -> 'a option -> unit +val blit : 'a t -> int -> 'a t -> int -> int -> unit +module type S = + sig + type data + type t + val create : int -> t + val clear : t -> unit + val merge : t -> data -> data + val add : t -> data -> unit + val remove : t -> data -> unit + val find : t -> data -> data + val find_opt : t -> data -> data option + val find_all : t -> data -> data list + val mem : t -> data -> bool + val iter : (data -> unit) -> t -> unit + val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val count : t -> int + val stats : t -> (int * int * int * int * int * int) + end +module Make : +(H : Hashtbl.HashedType) -> + sig + type data = H.t + type t + val create : int -> t + val clear : t -> unit + val merge : t -> data -> data + val add : t -> data -> unit + val remove : t -> data -> unit + val find : t -> data -> data + val find_opt : t -> data -> data option + val find_all : t -> data -> data list + val mem : t -> data -> bool + val iter : (data -> unit) -> t -> unit + val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val count : t -> int + val stats : t -> (int * int * int * int * int * int) + end diff --git a/interfaces/5.5/arg.mli b/interfaces/5.5/arg.mli new file mode 100644 index 0000000..60f0886 --- /dev/null +++ b/interfaces/5.5/arg.mli @@ -0,0 +1,44 @@ +type spec = + | Unit of (unit -> unit) + | Bool of (bool -> unit) + | Set of bool ref + | Clear of bool ref + | String of (string -> unit) + | Set_string of string ref + | Int of (int -> unit) + | Set_int of int ref + | Float of (float -> unit) + | Set_float of float ref + | Tuple of spec list + | Symbol of string list * (string -> unit) + | Rest of (string -> unit) + | Rest_all of (string list -> unit) + | Expand of (string -> string array) +type key = string +type doc = string +type usage_msg = string +type anon_fun = string -> unit +val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit +val parse_dynamic : + (key * spec * doc) list ref -> anon_fun -> usage_msg -> unit +val parse_argv : + ?current:int ref -> + string array -> (key * spec * doc) list -> anon_fun -> usage_msg -> unit +val parse_argv_dynamic : + ?current:int ref -> + string array -> (key * spec * doc) list ref -> anon_fun -> string -> unit +val parse_and_expand_argv_dynamic : + int ref -> + string array ref -> + (key * spec * doc) list ref -> anon_fun -> string -> unit +val parse_expand : (key * spec * doc) list -> anon_fun -> usage_msg -> unit +exception Help of string +exception Bad of string +val usage : (key * spec * doc) list -> usage_msg -> unit +val usage_string : (key * spec * doc) list -> usage_msg -> string +val align : ?limit:int -> (key * spec * doc) list -> (key * spec * doc) list +val current : int ref +val read_arg : string -> string array +val read_arg0 : string -> string array +val write_arg : string -> string array -> unit +val write_arg0 : string -> string array -> unit diff --git a/interfaces/5.5/array.mli b/interfaces/5.5/array.mli new file mode 100644 index 0000000..a332549 --- /dev/null +++ b/interfaces/5.5/array.mli @@ -0,0 +1,63 @@ +type 'a t = 'a array +external length : 'a array -> int = "%array_length" +external get : 'a array -> int -> 'a = "%array_safe_get" +external set : 'a array -> int -> 'a -> unit = "%array_safe_set" +external make : int -> 'a -> 'a array = "caml_array_make" +external create_float : int -> float array = "caml_array_create_float" +val init : int -> (int -> 'a) -> 'a array +val make_matrix : int -> int -> 'a -> 'a array array +val init_matrix : int -> int -> (int -> int -> 'a) -> 'a array array +val append : 'a array -> 'a array -> 'a array +val concat : 'a array list -> 'a array +val sub : 'a array -> int -> int -> 'a array +val copy : 'a array -> 'a array +val fill : 'a array -> int -> int -> 'a -> unit +val blit : 'a array -> int -> 'a array -> int -> int -> unit +val to_list : 'a array -> 'a list +val of_list : 'a list -> 'a array +val equal : ('a -> 'a -> bool) -> 'a array -> 'a array -> bool +val compare : ('a -> 'a -> int) -> 'a array -> 'a array -> int +val iter : ('a -> unit) -> 'a array -> unit +val iteri : (int -> 'a -> unit) -> 'a array -> unit +val map : ('a -> 'b) -> 'a array -> 'b array +val map_inplace : ('a -> 'a) -> 'a array -> unit +val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array +val mapi_inplace : (int -> 'a -> 'a) -> 'a array -> unit +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a array -> 'acc +val fold_left_map : + ('acc -> 'a -> ('acc * 'b)) -> 'acc -> 'a array -> ('acc * 'b array) +val fold_right : ('a -> 'acc -> 'acc) -> 'a array -> 'acc -> 'acc +val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit +val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array +val for_all : ('a -> bool) -> 'a array -> bool +val exists : ('a -> bool) -> 'a array -> bool +val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val mem : 'a -> 'a array -> bool +val memq : 'a -> 'a array -> bool +val find_opt : ('a -> bool) -> 'a array -> 'a option +val find_index : ('a -> bool) -> 'a array -> int option +val find_map : ('a -> 'b option) -> 'a array -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a array -> 'b option +val split : ('a * 'b) array -> ('a array * 'b array) +val combine : 'a array -> 'b array -> ('a * 'b) array +val sort : ('a -> 'a -> int) -> 'a array -> unit +val stable_sort : ('a -> 'a -> int) -> 'a array -> unit +val stable_sort_sub : ('a -> 'a -> int) -> 'a array -> int -> int -> unit +val fast_sort : ('a -> 'a -> int) -> 'a array -> unit +val shuffle : rand:(int -> int) -> 'a array -> unit +val to_seq : 'a array -> 'a Seq.t +val to_seqi : 'a array -> (int * 'a) Seq.t +val of_seq : 'a Seq.t -> 'a array +external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" +external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" +module Floatarray : +sig + external create : int -> floatarray = "caml_floatarray_create" + external length : floatarray -> int = "%floatarray_length" + external get : floatarray -> int -> float = "%floatarray_safe_get" + external set : floatarray -> int -> float -> unit = "%floatarray_safe_set" + external unsafe_get : floatarray -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : + floatarray -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.5/arrayLabels.mli b/interfaces/5.5/arrayLabels.mli new file mode 100644 index 0000000..83b7fd2 --- /dev/null +++ b/interfaces/5.5/arrayLabels.mli @@ -0,0 +1,67 @@ +type 'a t = 'a array +external length : 'a array -> int = "%array_length" +external get : 'a array -> int -> 'a = "%array_safe_get" +external set : 'a array -> int -> 'a -> unit = "%array_safe_set" +external make : int -> 'a -> 'a array = "caml_array_make" +external create_float : int -> float array = "caml_array_create_float" +val init : int -> f:(int -> 'a) -> 'a array +val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array +val init_matrix : + dimx:int -> dimy:int -> f:(int -> int -> 'a) -> 'a array array +val append : 'a array -> 'a array -> 'a array +val concat : 'a array list -> 'a array +val sub : 'a array -> pos:int -> len:int -> 'a array +val copy : 'a array -> 'a array +val fill : 'a array -> pos:int -> len:int -> 'a -> unit +val blit : + src:'a array -> + src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> unit +val to_list : 'a array -> 'a list +val of_list : 'a list -> 'a array +val equal : eq:('a -> 'a -> bool) -> 'a array -> 'a array -> bool +val compare : cmp:('a -> 'a -> int) -> 'a array -> 'a array -> int +val iter : f:('a -> unit) -> 'a array -> unit +val iteri : f:(int -> 'a -> unit) -> 'a array -> unit +val map : f:('a -> 'b) -> 'a array -> 'b array +val map_inplace : f:('a -> 'a) -> 'a array -> unit +val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array +val mapi_inplace : f:(int -> 'a -> 'a) -> 'a array -> unit +val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a array -> 'acc +val fold_left_map : + f:('acc -> 'a -> ('acc * 'b)) -> init:'acc -> 'a array -> ('acc * 'b array) +val fold_right : f:('a -> 'acc -> 'acc) -> 'a array -> init:'acc -> 'acc +val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit +val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array +val for_all : f:('a -> bool) -> 'a array -> bool +val exists : f:('a -> bool) -> 'a array -> bool +val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool +val mem : 'a -> set:'a array -> bool +val memq : 'a -> set:'a array -> bool +val find_opt : f:('a -> bool) -> 'a array -> 'a option +val find_index : f:('a -> bool) -> 'a array -> int option +val find_map : f:('a -> 'b option) -> 'a array -> 'b option +val find_mapi : f:(int -> 'a -> 'b option) -> 'a array -> 'b option +val split : ('a * 'b) array -> ('a array * 'b array) +val combine : 'a array -> 'b array -> ('a * 'b) array +val sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val stable_sort_sub : + cmp:('a -> 'a -> int) -> 'a array -> pos:int -> len:int -> unit +val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit +val shuffle : rand:(int -> int) -> 'a array -> unit +val to_seq : 'a array -> 'a Seq.t +val to_seqi : 'a array -> (int * 'a) Seq.t +val of_seq : 'a Seq.t -> 'a array +external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" +external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" +module Floatarray : +sig + external create : int -> floatarray = "caml_floatarray_create" + external length : floatarray -> int = "%floatarray_length" + external get : floatarray -> int -> float = "%floatarray_safe_get" + external set : floatarray -> int -> float -> unit = "%floatarray_safe_set" + external unsafe_get : floatarray -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : + floatarray -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.5/atomic.mli b/interfaces/5.5/atomic.mli new file mode 100644 index 0000000..4905c0d --- /dev/null +++ b/interfaces/5.5/atomic.mli @@ -0,0 +1,21 @@ +type !'a t +val make : 'a -> 'a t +val make_contended : 'a -> 'a t +val get : 'a t -> 'a +val set : 'a t -> 'a -> unit +val exchange : 'a t -> 'a -> 'a +val compare_and_set : 'a t -> 'a -> 'a -> bool +val fetch_and_add : int t -> int -> int +val incr : int t -> unit +val decr : int t -> unit +module Loc : +sig + type 'a t = 'a atomic_loc + external get : 'a t -> 'a = "%atomic_load_loc" + val set : 'a t -> 'a -> unit + external exchange : 'a t -> 'a -> 'a = "%atomic_exchange_loc" + external compare_and_set : 'a t -> 'a -> 'a -> bool = "%atomic_cas_loc" + external fetch_and_add : int t -> int -> int = "%atomic_fetch_add_loc" + val incr : int t -> unit + val decr : int t -> unit +end diff --git a/interfaces/5.5/bool.mli b/interfaces/5.5/bool.mli new file mode 100644 index 0000000..93acb51 --- /dev/null +++ b/interfaces/5.5/bool.mli @@ -0,0 +1,16 @@ +type t = bool = + | false + | true +val not : bool -> bool +external (&&) : bool -> bool -> bool = "%sequand" +external (||) : bool -> bool -> bool = "%sequor" +val logand : bool -> bool -> bool +val logor : bool -> bool -> bool +val logxor : bool -> bool -> bool +val equal : bool -> bool -> bool +val compare : bool -> bool -> int +val to_int : bool -> int +val to_float : bool -> float +val to_string : bool -> string +val seeded_hash : int -> bool -> int +val hash : bool -> int diff --git a/interfaces/5.5/buffer.mli b/interfaces/5.5/buffer.mli new file mode 100644 index 0000000..939ff6b --- /dev/null +++ b/interfaces/5.5/buffer.mli @@ -0,0 +1,41 @@ +type t +val create : int -> t +val contents : t -> string +val to_bytes : t -> bytes +val sub : t -> int -> int -> string +val blit : t -> int -> bytes -> int -> int -> unit +val nth : t -> int -> char +val length : t -> int +val clear : t -> unit +val reset : t -> unit +val output_buffer : out_channel -> t -> unit +val truncate : t -> int -> unit +val add_char : t -> char -> unit +val add_utf_8_uchar : t -> Uchar.t -> unit +val add_utf_16le_uchar : t -> Uchar.t -> unit +val add_utf_16be_uchar : t -> Uchar.t -> unit +val add_string : t -> string -> unit +val add_bytes : t -> bytes -> unit +val add_substring : t -> string -> int -> int -> unit +val add_subbytes : t -> bytes -> int -> int -> unit +val add_substitute : t -> (string -> string) -> string -> unit +val add_buffer : t -> t -> unit +val add_channel : t -> in_channel -> int -> unit +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val add_seq : t -> char Seq.t -> unit +val of_seq : char Seq.t -> t +val add_uint8 : t -> int -> unit +val add_int8 : t -> int -> unit +val add_uint16_ne : t -> int -> unit +val add_uint16_be : t -> int -> unit +val add_uint16_le : t -> int -> unit +val add_int16_ne : t -> int -> unit +val add_int16_be : t -> int -> unit +val add_int16_le : t -> int -> unit +val add_int32_ne : t -> int32 -> unit +val add_int32_be : t -> int32 -> unit +val add_int32_le : t -> int32 -> unit +val add_int64_ne : t -> int64 -> unit +val add_int64_be : t -> int64 -> unit +val add_int64_le : t -> int64 -> unit diff --git a/interfaces/5.5/bytes.mli b/interfaces/5.5/bytes.mli new file mode 100644 index 0000000..35ce14a --- /dev/null +++ b/interfaces/5.5/bytes.mli @@ -0,0 +1,101 @@ +external length : bytes -> int = "%bytes_length" +external get : bytes -> int -> char = "%bytes_safe_get" +external set : bytes -> int -> char -> unit = "%bytes_safe_set" +external create : int -> bytes = "caml_create_bytes" +val make : int -> char -> bytes +val init : int -> (int -> char) -> bytes +val empty : bytes +val copy : bytes -> bytes +val of_string : string -> bytes +val to_string : bytes -> string +val sub : bytes -> int -> int -> bytes +val sub_string : bytes -> int -> int -> string +val extend : bytes -> int -> int -> bytes +val fill : bytes -> int -> int -> char -> unit +val blit : bytes -> int -> bytes -> int -> int -> unit +val blit_string : string -> int -> bytes -> int -> int -> unit +val concat : bytes -> bytes list -> bytes +val cat : bytes -> bytes -> bytes +val iter : (char -> unit) -> bytes -> unit +val iteri : (int -> char -> unit) -> bytes -> unit +val map : (char -> char) -> bytes -> bytes +val mapi : (int -> char -> char) -> bytes -> bytes +val fold_left : ('acc -> char -> 'acc) -> 'acc -> bytes -> 'acc +val fold_right : (char -> 'acc -> 'acc) -> bytes -> 'acc -> 'acc +val for_all : (char -> bool) -> bytes -> bool +val exists : (char -> bool) -> bytes -> bool +val trim : bytes -> bytes +val escaped : bytes -> bytes +val index : bytes -> char -> int +val index_opt : bytes -> char -> int option +val rindex : bytes -> char -> int +val rindex_opt : bytes -> char -> int option +val index_from : bytes -> int -> char -> int +val index_from_opt : bytes -> int -> char -> int option +val rindex_from : bytes -> int -> char -> int +val rindex_from_opt : bytes -> int -> char -> int option +val contains : bytes -> char -> bool +val contains_from : bytes -> int -> char -> bool +val rcontains_from : bytes -> int -> char -> bool +val uppercase_ascii : bytes -> bytes +val lowercase_ascii : bytes -> bytes +val capitalize_ascii : bytes -> bytes +val uncapitalize_ascii : bytes -> bytes +type t = bytes +val compare : t -> t -> int +val equal : t -> t -> bool +val starts_with : prefix:bytes -> bytes -> bool +val ends_with : suffix:bytes -> bytes -> bool +val unsafe_to_string : bytes -> string +val unsafe_of_string : string -> bytes +val split_on_char : char -> bytes -> bytes list +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val set_utf_8_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val set_utf_16be_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val set_utf_16le_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16le : t -> bool +val get_uint8 : bytes -> int -> int +val get_int8 : bytes -> int -> int +val get_uint16_ne : bytes -> int -> int +val get_uint16_be : bytes -> int -> int +val get_uint16_le : bytes -> int -> int +val get_int16_ne : bytes -> int -> int +val get_int16_be : bytes -> int -> int +val get_int16_le : bytes -> int -> int +val get_int32_ne : bytes -> int -> int32 +val get_int32_be : bytes -> int -> int32 +val get_int32_le : bytes -> int -> int32 +val get_int64_ne : bytes -> int -> int64 +val get_int64_be : bytes -> int -> int64 +val get_int64_le : bytes -> int -> int64 +val set_uint8 : bytes -> int -> int -> unit +val set_int8 : bytes -> int -> int -> unit +val set_uint16_ne : bytes -> int -> int -> unit +val set_uint16_be : bytes -> int -> int -> unit +val set_uint16_le : bytes -> int -> int -> unit +val set_int16_ne : bytes -> int -> int -> unit +val set_int16_be : bytes -> int -> int -> unit +val set_int16_le : bytes -> int -> int -> unit +val set_int32_ne : bytes -> int -> int32 -> unit +val set_int32_be : bytes -> int -> int32 -> unit +val set_int32_le : bytes -> int -> int32 -> unit +val set_int64_ne : bytes -> int -> int64 -> unit +val set_int64_be : bytes -> int -> int64 -> unit +val set_int64_le : bytes -> int -> int64 -> unit +external unsafe_get : bytes -> int -> char = "%bytes_unsafe_get" +external unsafe_set : bytes -> int -> char -> unit = "%bytes_unsafe_set" +external unsafe_blit : + bytes -> int -> bytes -> int -> int -> unit = "caml_blit_bytes"[@@noalloc ] +external unsafe_blit_string : + string -> int -> bytes -> int -> int -> unit = "caml_blit_string"[@@noalloc + ] +external unsafe_fill : + bytes -> int -> int -> char -> unit = "caml_fill_bytes"[@@noalloc ] +val unsafe_escape : bytes -> bytes diff --git a/interfaces/5.5/bytesLabels.mli b/interfaces/5.5/bytesLabels.mli new file mode 100644 index 0000000..5d01ea1 --- /dev/null +++ b/interfaces/5.5/bytesLabels.mli @@ -0,0 +1,104 @@ +external length : bytes -> int = "%bytes_length" +external get : bytes -> int -> char = "%bytes_safe_get" +external set : bytes -> int -> char -> unit = "%bytes_safe_set" +external create : int -> bytes = "caml_create_bytes" +val make : int -> char -> bytes +val init : int -> f:(int -> char) -> bytes +val empty : bytes +val copy : bytes -> bytes +val of_string : string -> bytes +val to_string : bytes -> string +val sub : bytes -> pos:int -> len:int -> bytes +val sub_string : bytes -> pos:int -> len:int -> string +val extend : bytes -> left:int -> right:int -> bytes +val fill : bytes -> pos:int -> len:int -> char -> unit +val blit : + src:bytes -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val blit_string : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val concat : sep:bytes -> bytes list -> bytes +val cat : bytes -> bytes -> bytes +val iter : f:(char -> unit) -> bytes -> unit +val iteri : f:(int -> char -> unit) -> bytes -> unit +val map : f:(char -> char) -> bytes -> bytes +val mapi : f:(int -> char -> char) -> bytes -> bytes +val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> bytes -> 'acc +val fold_right : f:(char -> 'acc -> 'acc) -> bytes -> init:'acc -> 'acc +val for_all : f:(char -> bool) -> bytes -> bool +val exists : f:(char -> bool) -> bytes -> bool +val trim : bytes -> bytes +val escaped : bytes -> bytes +val index : bytes -> char -> int +val index_opt : bytes -> char -> int option +val rindex : bytes -> char -> int +val rindex_opt : bytes -> char -> int option +val index_from : bytes -> int -> char -> int +val index_from_opt : bytes -> int -> char -> int option +val rindex_from : bytes -> int -> char -> int +val rindex_from_opt : bytes -> int -> char -> int option +val contains : bytes -> char -> bool +val contains_from : bytes -> int -> char -> bool +val rcontains_from : bytes -> int -> char -> bool +val uppercase_ascii : bytes -> bytes +val lowercase_ascii : bytes -> bytes +val capitalize_ascii : bytes -> bytes +val uncapitalize_ascii : bytes -> bytes +type t = bytes +val compare : t -> t -> int +val equal : t -> t -> bool +val starts_with : prefix:bytes -> bytes -> bool +val ends_with : suffix:bytes -> bytes -> bool +val unsafe_to_string : bytes -> string +val unsafe_of_string : string -> bytes +val split_on_char : sep:char -> bytes -> bytes list +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val set_utf_8_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val set_utf_16be_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val set_utf_16le_uchar : t -> int -> Uchar.t -> int +val is_valid_utf_16le : t -> bool +val get_uint8 : bytes -> int -> int +val get_int8 : bytes -> int -> int +val get_uint16_ne : bytes -> int -> int +val get_uint16_be : bytes -> int -> int +val get_uint16_le : bytes -> int -> int +val get_int16_ne : bytes -> int -> int +val get_int16_be : bytes -> int -> int +val get_int16_le : bytes -> int -> int +val get_int32_ne : bytes -> int -> int32 +val get_int32_be : bytes -> int -> int32 +val get_int32_le : bytes -> int -> int32 +val get_int64_ne : bytes -> int -> int64 +val get_int64_be : bytes -> int -> int64 +val get_int64_le : bytes -> int -> int64 +val set_uint8 : bytes -> int -> int -> unit +val set_int8 : bytes -> int -> int -> unit +val set_uint16_ne : bytes -> int -> int -> unit +val set_uint16_be : bytes -> int -> int -> unit +val set_uint16_le : bytes -> int -> int -> unit +val set_int16_ne : bytes -> int -> int -> unit +val set_int16_be : bytes -> int -> int -> unit +val set_int16_le : bytes -> int -> int -> unit +val set_int32_ne : bytes -> int -> int32 -> unit +val set_int32_be : bytes -> int -> int32 -> unit +val set_int32_le : bytes -> int -> int32 -> unit +val set_int64_ne : bytes -> int -> int64 -> unit +val set_int64_be : bytes -> int -> int64 -> unit +val set_int64_le : bytes -> int -> int64 -> unit +external unsafe_get : bytes -> int -> char = "%bytes_unsafe_get" +external unsafe_set : bytes -> int -> char -> unit = "%bytes_unsafe_set" +external unsafe_blit : + src:bytes -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_bytes"[@@noalloc ] +external unsafe_blit_string : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_string"[@@noalloc ] +external unsafe_fill : + bytes -> pos:int -> len:int -> char -> unit = "caml_fill_bytes"[@@noalloc ] +val unsafe_escape : bytes -> bytes diff --git a/interfaces/5.5/callback.mli b/interfaces/5.5/callback.mli new file mode 100644 index 0000000..d825854 --- /dev/null +++ b/interfaces/5.5/callback.mli @@ -0,0 +1,2 @@ +val register : string -> 'a -> unit +val register_exception : string -> exn -> unit diff --git a/interfaces/5.5/char.mli b/interfaces/5.5/char.mli new file mode 100644 index 0000000..8fa8fd4 --- /dev/null +++ b/interfaces/5.5/char.mli @@ -0,0 +1,35 @@ +type t = char +external code : char -> int = "%identity" +val chr : int -> char +val escaped : char -> string +val compare : t -> t -> int +val equal : t -> t -> bool +module Ascii : +sig + val min : char + val max : char + val is_valid : char -> bool + val is_upper : char -> bool + val is_lower : char -> bool + val is_letter : char -> bool + val is_alphanum : char -> bool + val is_white : char -> bool + val is_blank : char -> bool + val is_graphic : char -> bool + val is_print : char -> bool + val is_control : char -> bool + val is_digit : char -> bool + val digit_to_int : char -> int + val digit_of_int : int -> char + val is_hex_digit : char -> bool + val hex_digit_to_int : char -> int + val lower_hex_digit_of_int : int -> char + val upper_hex_digit_of_int : int -> char + val uppercase : char -> char + val lowercase : char -> char +end +val lowercase_ascii : char -> char +val uppercase_ascii : char -> char +val seeded_hash : int -> t -> int +val hash : t -> int +external unsafe_chr : int -> char = "%identity" diff --git a/interfaces/5.5/complex.mli b/interfaces/5.5/complex.mli new file mode 100644 index 0000000..f3275a5 --- /dev/null +++ b/interfaces/5.5/complex.mli @@ -0,0 +1,21 @@ +type t = { + re: float ; + im: float } +val zero : t +val one : t +val i : t +val neg : t -> t +val conj : t -> t +val add : t -> t -> t +val sub : t -> t -> t +val mul : t -> t -> t +val inv : t -> t +val div : t -> t -> t +val sqrt : t -> t +val norm2 : t -> float +val norm : t -> float +val arg : t -> float +val polar : float -> float -> t +val exp : t -> t +val log : t -> t +val pow : t -> t -> t diff --git a/interfaces/5.5/digest.mli b/interfaces/5.5/digest.mli new file mode 100644 index 0000000..b3fe1aa --- /dev/null +++ b/interfaces/5.5/digest.mli @@ -0,0 +1,35 @@ +type t = string +val compare : t -> t -> int +val equal : t -> t -> bool +val string : string -> t +val bytes : bytes -> t +val substring : string -> int -> int -> t +val subbytes : bytes -> int -> int -> t +val channel : in_channel -> int -> t +val file : string -> t +val output : out_channel -> t -> unit +val input : in_channel -> t +val to_hex : t -> string +val of_hex : string -> t +val from_hex : string -> t +module type S = + sig + type t = string + val hash_length : int + val compare : t -> t -> int + val equal : t -> t -> bool + val string : string -> t + val bytes : bytes -> t + val substring : string -> int -> int -> t + val subbytes : bytes -> int -> int -> t + val channel : in_channel -> int -> t + val file : string -> t + val output : out_channel -> t -> unit + val input : in_channel -> t + val to_hex : t -> string + val of_hex : string -> t + end +module BLAKE128 : S +module BLAKE256 : S +module BLAKE512 : S +module MD5 : S diff --git a/interfaces/5.5/domain.mli b/interfaces/5.5/domain.mli new file mode 100644 index 0000000..844c990 --- /dev/null +++ b/interfaces/5.5/domain.mli @@ -0,0 +1,20 @@ +type !'a t +val spawn : (unit -> 'a) -> 'a t +val join : 'a t -> 'a +type id = private int +val get_id : 'a t -> id +val self : unit -> id +val before_first_spawn : (unit -> unit) -> unit +val at_exit : (unit -> unit) -> unit +val cpu_relax : unit -> unit +val is_main_domain : unit -> bool +val count : unit -> int +val recommended_domain_count : unit -> int +val self_index : unit -> int +module DLS : +sig + type 'a key + val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key + val get : 'a key -> 'a + val set : 'a key -> 'a -> unit +end diff --git a/interfaces/5.5/either.mli b/interfaces/5.5/either.mli new file mode 100644 index 0000000..cc6687e --- /dev/null +++ b/interfaces/5.5/either.mli @@ -0,0 +1,25 @@ +type ('a, 'b) t = + | Left of 'a + | Right of 'b +val left : 'a -> ('a, 'b) t +val right : 'b -> ('a, 'b) t +val is_left : ('a, 'b) t -> bool +val is_right : ('a, 'b) t -> bool +val get_left : ('a, 'b) t -> 'a +val get_right : ('a, 'b) t -> 'b +val find_left : ('a, 'b) t -> 'a option +val find_right : ('a, 'b) t -> 'b option +val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t +val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t +val map : + left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t +val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c +val retract : ('a, 'a) t -> 'a +val iter : left:('a -> unit) -> right:('b -> unit) -> ('a, 'b) t -> unit +val for_all : left:('a -> bool) -> right:('b -> bool) -> ('a, 'b) t -> bool +val equal : + left:('a -> 'a -> bool) -> + right:('b -> 'b -> bool) -> ('a, 'b) t -> ('a, 'b) t -> bool +val compare : + left:('a -> 'a -> int) -> + right:('b -> 'b -> int) -> ('a, 'b) t -> ('a, 'b) t -> int diff --git a/interfaces/5.5/ephemeron.mli b/interfaces/5.5/ephemeron.mli new file mode 100644 index 0000000..5f5db4f --- /dev/null +++ b/interfaces/5.5/ephemeron.mli @@ -0,0 +1,240 @@ +module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end +module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end +module K1 : +sig + type ('k, 'd) t + val make : 'k -> 'd -> ('k, 'd) t + val query : ('k, 'd) t -> 'k -> 'd option + module Make : + (H : Hashtbl.HashedType) -> + sig + type key = H.t + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H : Hashtbl.SeededHashedType) -> + sig + type key = H.t + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k, 'd) t + val make : unit -> ('k, 'd) t + val add : ('k, 'd) t -> 'k -> 'd -> unit + val remove : ('k, 'd) t -> 'k -> unit + val find : ('k, 'd) t -> 'k -> 'd option + val length : ('k, 'd) t -> int + val clear : ('k, 'd) t -> unit + end +end +module K2 : +sig + type ('k1, 'k2, 'd) t + val make : 'k1 -> 'k2 -> 'd -> ('k1, 'k2, 'd) t + val query : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option + module Make : + (H1 : Hashtbl.HashedType) -> + (H2 : Hashtbl.HashedType) -> + sig + type key = (H1.t * H2.t) + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H1 : Hashtbl.SeededHashedType) -> + (H2 : Hashtbl.SeededHashedType) -> + sig + type key = (H1.t * H2.t) + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k1, 'k2, 'd) t + val make : unit -> ('k1, 'k2, 'd) t + val add : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd -> unit + val remove : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> unit + val find : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option + val length : ('k1, 'k2, 'd) t -> int + val clear : ('k1, 'k2, 'd) t -> unit + end +end +module Kn : +sig + type ('k, 'd) t + val make : 'k array -> 'd -> ('k, 'd) t + val query : ('k, 'd) t -> 'k array -> 'd option + module Make : + (H : Hashtbl.HashedType) -> + sig + type key = H.t array + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module MakeSeeded : + (H : Hashtbl.SeededHashedType) -> + sig + type key = H.t array + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val mem : 'a t -> key -> bool + val length : 'a t -> int + val stats : 'a t -> Hashtbl.statistics + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + val clean : 'a t -> unit + val stats_alive : 'a t -> Hashtbl.statistics + end + module Bucket : + sig + type ('k, 'd) t + val make : unit -> ('k, 'd) t + val add : ('k, 'd) t -> 'k array -> 'd -> unit + val remove : ('k, 'd) t -> 'k array -> unit + val find : ('k, 'd) t -> 'k array -> 'd option + val length : ('k, 'd) t -> int + val clear : ('k, 'd) t -> unit + end +end diff --git a/interfaces/5.5/filename.mli b/interfaces/5.5/filename.mli new file mode 100644 index 0000000..472c189 --- /dev/null +++ b/interfaces/5.5/filename.mli @@ -0,0 +1,28 @@ +val current_dir_name : string +val parent_dir_name : string +val dir_sep : string +val concat : string -> string -> string +val is_relative : string -> bool +val is_implicit : string -> bool +val check_suffix : string -> string -> bool +val chop_suffix : string -> string -> string +val chop_suffix_opt : suffix:string -> string -> string option +val extension : string -> string +val remove_extension : string -> string +val chop_extension : string -> string +val basename : string -> string +val dirname : string -> string +val null : string +val temp_file : ?temp_dir:string -> string -> string -> string +val open_temp_file : + ?mode:open_flag list -> + ?perms:int -> + ?temp_dir:string -> string -> string -> (string * out_channel) +val temp_dir : ?temp_dir:string -> ?perms:int -> string -> string -> string +val get_temp_dir_name : unit -> string +val set_temp_dir_name : string -> unit +val quote : string -> string +val quote_command : + string -> + ?stdin:string -> + ?stdout:string -> ?stderr:string -> string list -> string diff --git a/interfaces/5.5/float.mli b/interfaces/5.5/float.mli new file mode 100644 index 0000000..75ea38d --- /dev/null +++ b/interfaces/5.5/float.mli @@ -0,0 +1,231 @@ +val zero : float +val one : float +val minus_one : float +external neg : float -> float = "%negfloat" +external add : float -> float -> float = "%addfloat" +external sub : float -> float -> float = "%subfloat" +external mul : float -> float -> float = "%mulfloat" +external div : float -> float -> float = "%divfloat" +external fma : float -> float -> float -> float = "caml_fma_float" "caml_fma" +[@@unboxed ][@@noalloc ] +external rem : float -> float -> float = "caml_fmod_float" "fmod"[@@unboxed ] +[@@noalloc ] +val succ : float -> float +val pred : float -> float +external abs : float -> float = "%absfloat" +val infinity : float +val neg_infinity : float +val nan : float +val signaling_nan : float +val quiet_nan : float +val pi : float +val max_float : float +val min_float : float +val epsilon : float +val is_finite : float -> bool +val is_infinite : float -> bool +val is_nan : float -> bool +val is_integer : float -> bool +external of_int : int -> float = "%floatofint" +external to_int : float -> int = "%intoffloat" +external of_string : string -> float = "caml_float_of_string" +val of_string_opt : string -> float option +val to_string : float -> string +type fpclass = fpclass = + | FP_normal + | FP_subnormal + | FP_zero + | FP_infinite + | FP_nan +external classify_float : + ((float)[@unboxed ]) -> fpclass = "caml_classify_float" + "caml_classify_float_unboxed"[@@noalloc ] +external pow : float -> float -> float = "caml_power_float" "pow"[@@unboxed ] +[@@noalloc ] +external sqrt : float -> float = "caml_sqrt_float" "sqrt"[@@unboxed ] +[@@noalloc ] +external cbrt : float -> float = "caml_cbrt_float" "caml_cbrt"[@@unboxed ] +[@@noalloc ] +external exp : float -> float = "caml_exp_float" "exp"[@@unboxed ][@@noalloc + ] +external exp2 : float -> float = "caml_exp2_float" "caml_exp2"[@@unboxed ] +[@@noalloc ] +external log : float -> float = "caml_log_float" "log"[@@unboxed ][@@noalloc + ] +external log10 : float -> float = "caml_log10_float" "log10"[@@unboxed ] +[@@noalloc ] +external log2 : float -> float = "caml_log2_float" "caml_log2"[@@unboxed ] +[@@noalloc ] +external expm1 : float -> float = "caml_expm1_float" "caml_expm1"[@@unboxed ] +[@@noalloc ] +external log1p : float -> float = "caml_log1p_float" "caml_log1p"[@@unboxed ] +[@@noalloc ] +external cos : float -> float = "caml_cos_float" "cos"[@@unboxed ][@@noalloc + ] +external sin : float -> float = "caml_sin_float" "sin"[@@unboxed ][@@noalloc + ] +external tan : float -> float = "caml_tan_float" "tan"[@@unboxed ][@@noalloc + ] +external acos : float -> float = "caml_acos_float" "acos"[@@unboxed ] +[@@noalloc ] +external asin : float -> float = "caml_asin_float" "asin"[@@unboxed ] +[@@noalloc ] +external atan : float -> float = "caml_atan_float" "atan"[@@unboxed ] +[@@noalloc ] +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" +[@@unboxed ][@@noalloc ] +external hypot : float -> float -> float = "caml_hypot_float" "caml_hypot" +[@@unboxed ][@@noalloc ] +external cosh : float -> float = "caml_cosh_float" "cosh"[@@unboxed ] +[@@noalloc ] +external sinh : float -> float = "caml_sinh_float" "sinh"[@@unboxed ] +[@@noalloc ] +external tanh : float -> float = "caml_tanh_float" "tanh"[@@unboxed ] +[@@noalloc ] +external acosh : float -> float = "caml_acosh_float" "caml_acosh"[@@unboxed ] +[@@noalloc ] +external asinh : float -> float = "caml_asinh_float" "caml_asinh"[@@unboxed ] +[@@noalloc ] +external atanh : float -> float = "caml_atanh_float" "caml_atanh"[@@unboxed ] +[@@noalloc ] +external erf : float -> float = "caml_erf_float" "caml_erf"[@@unboxed ] +[@@noalloc ] +external erfc : float -> float = "caml_erfc_float" "caml_erfc"[@@unboxed ] +[@@noalloc ] +external trunc : float -> float = "caml_trunc_float" "caml_trunc"[@@unboxed ] +[@@noalloc ] +external round : float -> float = "caml_round_float" "caml_round"[@@unboxed ] +[@@noalloc ] +external ceil : float -> float = "caml_ceil_float" "ceil"[@@unboxed ] +[@@noalloc ] +external floor : float -> float = "caml_floor_float" "floor"[@@unboxed ] +[@@noalloc ] +external next_after : + float -> float -> float = "caml_nextafter_float" "caml_nextafter"[@@unboxed + ] +[@@noalloc ] +external copy_sign : + float -> float -> float = "caml_copysign_float" "caml_copysign"[@@unboxed ] +[@@noalloc ] +external sign_bit : + ((float)[@unboxed ]) -> bool = "caml_signbit_float" "caml_signbit"[@@noalloc + ] +external frexp : float -> (float * int) = "caml_frexp_float" +external ldexp : + ((float)[@unboxed ]) -> ((int)[@untagged ]) -> ((float)[@unboxed ]) = + "caml_ldexp_float" "caml_ldexp_float_unboxed"[@@noalloc ] +external modf : float -> (float * float) = "caml_modf_float" +type t = float +val compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : float -> float -> float +val min_max : float -> float -> (float * float) +val min_num : t -> t -> t +val max_num : t -> t -> t +val min_max_num : float -> float -> (float * float) +val seeded_hash : int -> t -> int +val hash : t -> int +module Array : +sig + type t = floatarray + val length : t -> int + val get : t -> int -> float + val set : t -> int -> float -> unit + val make : int -> float -> t + val create : int -> t + val init : int -> (int -> float) -> t + val make_matrix : int -> int -> float -> t array + val init_matrix : int -> int -> (int -> int -> float) -> t array + val append : t -> t -> t + val concat : t list -> t + val sub : t -> int -> int -> t + val copy : t -> t + val fill : t -> int -> int -> float -> unit + val blit : t -> int -> t -> int -> int -> unit + val to_list : t -> float list + val of_list : float list -> t + val equal : (float -> float -> bool) -> t -> t -> bool + val compare : (float -> float -> int) -> t -> t -> int + val iter : (float -> unit) -> t -> unit + val iteri : (int -> float -> unit) -> t -> unit + val map : (float -> float) -> t -> t + val map_inplace : (float -> float) -> t -> unit + val mapi : (int -> float -> float) -> t -> t + val mapi_inplace : (int -> float -> float) -> t -> unit + val fold_left : ('acc -> float -> 'acc) -> 'acc -> t -> 'acc + val fold_right : (float -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val iter2 : (float -> float -> unit) -> t -> t -> unit + val map2 : (float -> float -> float) -> t -> t -> t + val for_all : (float -> bool) -> t -> bool + val exists : (float -> bool) -> t -> bool + val mem : float -> t -> bool + val mem_ieee : float -> t -> bool + val find_opt : (float -> bool) -> t -> float option + val find_index : (float -> bool) -> t -> int option + val find_map : (float -> 'a option) -> t -> 'a option + val find_mapi : (int -> float -> 'a option) -> t -> 'a option + val sort : (float -> float -> int) -> t -> unit + val stable_sort : (float -> float -> int) -> t -> unit + val fast_sort : (float -> float -> int) -> t -> unit + val shuffle : rand:(int -> int) -> t -> unit + val to_seq : t -> float Seq.t + val to_seqi : t -> (int * float) Seq.t + val of_seq : float Seq.t -> t + val map_to_array : (float -> 'a) -> t -> 'a array + val map_from_array : ('a -> float) -> 'a array -> t + external unsafe_get : t -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : t -> int -> float -> unit = "%floatarray_unsafe_set" +end +module ArrayLabels : +sig + type t = floatarray + val length : t -> int + val get : t -> int -> float + val set : t -> int -> float -> unit + val make : int -> float -> t + val create : int -> t + val init : int -> f:(int -> float) -> t + val make_matrix : dimx:int -> dimy:int -> float -> t array + val init_matrix : + dimx:int -> dimy:int -> f:(int -> int -> float) -> t array + val append : t -> t -> t + val concat : t list -> t + val sub : t -> pos:int -> len:int -> t + val copy : t -> t + val fill : t -> pos:int -> len:int -> float -> unit + val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit + val to_list : t -> float list + val of_list : float list -> t + val equal : eq:(float -> float -> bool) -> t -> t -> bool + val compare : cmp:(float -> float -> int) -> t -> t -> int + val iter : f:(float -> unit) -> t -> unit + val iteri : f:(int -> float -> unit) -> t -> unit + val map : f:(float -> float) -> t -> t + val map_inplace : f:(float -> float) -> t -> unit + val mapi : f:(int -> float -> float) -> t -> t + val mapi_inplace : f:(int -> float -> float) -> t -> unit + val fold_left : f:('acc -> float -> 'acc) -> init:'acc -> t -> 'acc + val fold_right : f:(float -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val iter2 : f:(float -> float -> unit) -> t -> t -> unit + val map2 : f:(float -> float -> float) -> t -> t -> t + val for_all : f:(float -> bool) -> t -> bool + val exists : f:(float -> bool) -> t -> bool + val mem : float -> set:t -> bool + val mem_ieee : float -> set:t -> bool + val find_opt : f:(float -> bool) -> t -> float option + val find_index : f:(float -> bool) -> t -> int option + val find_map : f:(float -> 'a option) -> t -> 'a option + val find_mapi : f:(int -> float -> 'a option) -> t -> 'a option + val sort : cmp:(float -> float -> int) -> t -> unit + val stable_sort : cmp:(float -> float -> int) -> t -> unit + val fast_sort : cmp:(float -> float -> int) -> t -> unit + val shuffle : rand:(int -> int) -> t -> unit + val to_seq : t -> float Seq.t + val to_seqi : t -> (int * float) Seq.t + val of_seq : float Seq.t -> t + val map_to_array : f:(float -> 'a) -> t -> 'a array + val map_from_array : f:('a -> float) -> 'a array -> t + external unsafe_get : t -> int -> float = "%floatarray_unsafe_get" + external unsafe_set : t -> int -> float -> unit = "%floatarray_unsafe_set" +end diff --git a/interfaces/5.5/format.mli b/interfaces/5.5/format.mli new file mode 100644 index 0000000..d30149f --- /dev/null +++ b/interfaces/5.5/format.mli @@ -0,0 +1,239 @@ +type formatter +val pp_open_box : formatter -> int -> unit +val open_box : int -> unit +val pp_close_box : formatter -> unit -> unit +val close_box : unit -> unit +val pp_open_hbox : formatter -> unit -> unit +val open_hbox : unit -> unit +val pp_open_vbox : formatter -> int -> unit +val open_vbox : int -> unit +val pp_open_hvbox : formatter -> int -> unit +val open_hvbox : int -> unit +val pp_open_hovbox : formatter -> int -> unit +val open_hovbox : int -> unit +val pp_print_string : formatter -> string -> unit +val print_string : string -> unit +val pp_print_substring : pos:int -> len:int -> formatter -> string -> unit +val print_substring : pos:int -> len:int -> string -> unit +val pp_print_bytes : formatter -> bytes -> unit +val print_bytes : bytes -> unit +val pp_print_as : formatter -> int -> string -> unit +val print_as : int -> string -> unit +val pp_print_substring_as : + pos:int -> len:int -> formatter -> int -> string -> unit +val print_substring_as : pos:int -> len:int -> int -> string -> unit +val pp_print_int : formatter -> int -> unit +val print_int : int -> unit +val pp_print_float : formatter -> float -> unit +val print_float : float -> unit +val pp_print_char : formatter -> char -> unit +val print_char : char -> unit +val pp_print_bool : formatter -> bool -> unit +val print_bool : bool -> unit +val pp_print_nothing : formatter -> unit -> unit +val pp_print_space : formatter -> unit -> unit +val print_space : unit -> unit +val pp_print_cut : formatter -> unit -> unit +val print_cut : unit -> unit +val pp_print_break : formatter -> int -> int -> unit +val print_break : int -> int -> unit +val pp_print_custom_break : + formatter -> + fits:(string * int * string) -> breaks:(string * int * string) -> unit +val pp_force_newline : formatter -> unit -> unit +val force_newline : unit -> unit +val pp_print_if_newline : formatter -> unit -> unit +val print_if_newline : unit -> unit +val pp_print_flush : formatter -> unit -> unit +val print_flush : unit -> unit +val pp_print_newline : formatter -> unit -> unit +val print_newline : unit -> unit +val pp_infinity : int +val pp_set_margin : formatter -> int -> unit +val set_margin : int -> unit +val pp_get_margin : formatter -> unit -> int +val get_margin : unit -> int +val pp_set_max_indent : formatter -> int -> unit +val set_max_indent : int -> unit +val pp_get_max_indent : formatter -> unit -> int +val get_max_indent : unit -> int +type geometry = { + max_indent: int ; + margin: int } +val check_geometry : geometry -> bool +val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit +val set_geometry : max_indent:int -> margin:int -> unit +val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit +val safe_set_geometry : max_indent:int -> margin:int -> unit +val pp_update_geometry : formatter -> (geometry -> geometry) -> unit +val update_geometry : (geometry -> geometry) -> unit +val pp_get_geometry : formatter -> unit -> geometry +val get_geometry : unit -> geometry +val pp_set_max_boxes : formatter -> int -> unit +val set_max_boxes : int -> unit +val pp_get_max_boxes : formatter -> unit -> int +val get_max_boxes : unit -> int +val pp_over_max_boxes : formatter -> unit -> bool +val over_max_boxes : unit -> bool +val pp_open_tbox : formatter -> unit -> unit +val open_tbox : unit -> unit +val pp_close_tbox : formatter -> unit -> unit +val close_tbox : unit -> unit +val pp_set_tab : formatter -> unit -> unit +val set_tab : unit -> unit +val pp_print_tab : formatter -> unit -> unit +val print_tab : unit -> unit +val pp_print_tbreak : formatter -> int -> int -> unit +val print_tbreak : int -> int -> unit +val pp_set_ellipsis_text : formatter -> string -> unit +val set_ellipsis_text : string -> unit +val pp_get_ellipsis_text : formatter -> unit -> string +val get_ellipsis_text : unit -> string +type stag = .. +type tag = string +type stag += + | String_tag of tag +val pp_open_stag : formatter -> stag -> unit +val open_stag : stag -> unit +val pp_close_stag : formatter -> unit -> unit +val close_stag : unit -> unit +val pp_set_tags : formatter -> bool -> unit +val set_tags : bool -> unit +val pp_set_print_tags : formatter -> bool -> unit +val set_print_tags : bool -> unit +val pp_set_mark_tags : formatter -> bool -> unit +val set_mark_tags : bool -> unit +val pp_get_print_tags : formatter -> unit -> bool +val get_print_tags : unit -> bool +val pp_get_mark_tags : formatter -> unit -> bool +val get_mark_tags : unit -> bool +val pp_set_formatter_out_channel : formatter -> out_channel -> unit +val set_formatter_out_channel : out_channel -> unit +val pp_set_formatter_output_functions : + formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> unit +val set_formatter_output_functions : + (string -> int -> int -> unit) -> (unit -> unit) -> unit +val pp_get_formatter_output_functions : + formatter -> unit -> ((string -> int -> int -> unit) * (unit -> unit)) +val get_formatter_output_functions : + unit -> ((string -> int -> int -> unit) * (unit -> unit)) +type formatter_out_functions = + { + out_string: string -> int -> int -> unit ; + out_width: string -> pos:int -> len:int -> int ; + out_flush: unit -> unit ; + out_newline: unit -> unit ; + out_spaces: int -> unit ; + out_indent: int -> unit } +val pp_set_formatter_out_functions : + formatter -> formatter_out_functions -> unit +val set_formatter_out_functions : formatter_out_functions -> unit +val pp_get_formatter_out_functions : + formatter -> unit -> formatter_out_functions +val get_formatter_out_functions : unit -> formatter_out_functions +val utf_8_scalar_width : string -> pos:int -> len:int -> int +val ascii_width : string -> pos:int -> len:int -> int +type formatter_stag_functions = + { + mark_open_stag: stag -> string ; + mark_close_stag: stag -> string ; + print_open_stag: stag -> unit ; + print_close_stag: stag -> unit } +val pp_set_formatter_stag_functions : + formatter -> formatter_stag_functions -> unit +val set_formatter_stag_functions : formatter_stag_functions -> unit +val pp_get_formatter_stag_functions : + formatter -> unit -> formatter_stag_functions +val get_formatter_stag_functions : unit -> formatter_stag_functions +val formatter_of_out_channel : out_channel -> formatter +val synchronized_formatter_of_out_channel : + out_channel -> formatter Domain.DLS.key +val std_formatter : formatter +val get_std_formatter : unit -> formatter +val err_formatter : formatter +val get_err_formatter : unit -> formatter +val formatter_of_buffer : Buffer.t -> formatter +val stdbuf : Buffer.t +val get_stdbuf : unit -> Buffer.t +val str_formatter : formatter +val get_str_formatter : unit -> formatter +val flush_str_formatter : unit -> string +val make_formatter : + (string -> int -> int -> unit) -> (unit -> unit) -> formatter +val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> formatter Domain.DLS.key +val formatter_of_out_functions : formatter_out_functions -> formatter +type symbolic_output_item = + | Output_flush + | Output_newline + | Output_string of string + | Output_spaces of int + | Output_indent of int +type symbolic_output_buffer +val make_symbolic_output_buffer : unit -> symbolic_output_buffer +val clear_symbolic_output_buffer : symbolic_output_buffer -> unit +val get_symbolic_output_buffer : + symbolic_output_buffer -> symbolic_output_item list +val flush_symbolic_output_buffer : + symbolic_output_buffer -> symbolic_output_item list +val add_symbolic_output_item : + symbolic_output_buffer -> symbolic_output_item -> unit +val formatter_of_symbolic_output_buffer : symbolic_output_buffer -> formatter +val pp_print_iter : + ?pp_sep:(formatter -> unit -> unit) -> + (('a -> unit) -> 'b -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'b -> unit +val pp_print_list : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a list -> unit +val pp_print_array : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a array -> unit +val pp_print_seq : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a Seq.t -> unit +val pp_print_text : formatter -> string -> unit +val format_text : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 +val pp_print_option : + ?none:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a option -> unit +val pp_print_result : + ok:(formatter -> 'a -> unit) -> + error:(formatter -> 'e -> unit) -> formatter -> ('a, 'e) result -> unit +val pp_print_either : + left:(formatter -> 'a -> unit) -> + right:(formatter -> 'b -> unit) -> formatter -> ('a, 'b) Either.t -> unit +val fprintf : formatter -> ('a, formatter, unit) format -> 'a +val printf : ('a, formatter, unit) format -> 'a +val eprintf : ('a, formatter, unit) format -> 'a +val sprintf : ('a, unit, string) format -> 'a +val asprintf : ('a, formatter, unit, string) format4 -> 'a +val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a +val ifprintf : formatter -> ('a, formatter, unit) format -> 'a +val kfprintf : + (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b +val kdprintf : + ((formatter -> unit) -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b +val ikfprintf : + (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b +val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b +val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b +module Args : +sig + type ('a, 'r) t = + | []: ('r, 'r) t + | (::): 'a * ('b, 'r) t -> ('a -> 'b, 'r) t + val apply : 'a -> ('a, 'r) t -> 'r + val (@) : ('a, 'r1) t -> ('r1, 'r2) t -> ('a, 'r2) t +end +val lfprintf : + formatter -> ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +val lprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +val leprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +val lasprintf : + ('a, formatter, unit, string) format4 -> ('a, string) Args.t -> string +val ldprintf : + ('a, formatter, unit, unit) format4 -> + ('a, unit) Args.t -> formatter -> unit diff --git a/interfaces/5.5/fun.mli b/interfaces/5.5/fun.mli new file mode 100644 index 0000000..2ef26ce --- /dev/null +++ b/interfaces/5.5/fun.mli @@ -0,0 +1,7 @@ +val id : 'a -> 'a +val const : 'a -> 'b -> 'a +val compose : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c +val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c +val negate : ('a -> bool) -> 'a -> bool +val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a +exception Finally_raised of exn diff --git a/interfaces/5.5/gc.mli b/interfaces/5.5/gc.mli new file mode 100644 index 0000000..06139d4 --- /dev/null +++ b/interfaces/5.5/gc.mli @@ -0,0 +1,98 @@ +type stat = + { + minor_words: float ; + promoted_words: float ; + major_words: float ; + minor_collections: int ; + major_collections: int ; + heap_words: int ; + heap_chunks: int ; + live_words: int ; + live_blocks: int ; + free_words: int ; + free_blocks: int ; + largest_free: int ; + fragments: int ; + compactions: int ; + top_heap_words: int ; + stack_size: int ; + forced_major_collections: int ; + live_stacks_words: int } +type control = + { + minor_heap_size: int ; + major_heap_increment: int ; + space_overhead: int ; + verbose: int ; + max_overhead: int ; + stack_limit: int ; + allocation_policy: int ; + window_size: int ; + custom_major_ratio: int ; + custom_minor_ratio: int ; + custom_minor_max_size: int } +external stat : unit -> stat = "caml_gc_stat" +external quick_stat : unit -> stat = "caml_gc_quick_stat" +external counters : unit -> (float * float * float) = "caml_gc_counters" +external minor_words : + unit -> ((float)[@unboxed ]) = "caml_gc_minor_words" + "caml_gc_minor_words_unboxed" +external get : unit -> control = "caml_gc_get" +external set : control -> unit = "caml_gc_set" +external minor : unit -> unit = "caml_gc_minor" +external major_slice : int -> int = "caml_gc_major_slice" +external major : unit -> unit = "caml_gc_major" +external full_major : unit -> unit = "caml_gc_full_major" +external compact : unit -> unit = "caml_gc_compaction" +val print_stat : out_channel -> unit +val allocated_bytes : unit -> float +external get_minor_free : unit -> int = "caml_get_minor_free" +val finalise : ('a -> unit) -> 'a -> unit +val finalise_last : (unit -> unit) -> 'a -> unit +val finalise_release : unit -> unit +type alarm +val create_alarm : (unit -> unit) -> alarm +val delete_alarm : alarm -> unit +val eventlog_pause : unit -> unit +val eventlog_resume : unit -> unit +module Memprof : +sig + type t + type allocation_source = + | Normal + | Marshal + | Custom + | Map_file + val string_of_allocation_source : allocation_source -> string + type allocation = private + { + n_samples: int ; + size: int ; + source: allocation_source ; + callstack: Printexc.raw_backtrace } + type ('minor, 'major) tracker = + { + alloc_minor: allocation -> 'minor option ; + alloc_major: allocation -> 'major option ; + promote: 'minor -> 'major option ; + dealloc_minor: 'minor -> unit ; + dealloc_major: 'major -> unit } + val null_tracker : ('minor, 'major) tracker + val start : + sampling_rate:float -> + ?callstack_size:int -> ('minor, 'major) tracker -> t + val is_sampling : unit -> bool + val stop : unit -> unit + val discard : t -> unit +end +type suspended_collection_work +external ramp_up : + (unit -> 'a) -> ('a * suspended_collection_work) = "caml_ml_gc_ramp_up" +external ramp_down : + suspended_collection_work -> unit = "caml_ml_gc_ramp_down" +module Tweak : +sig + val set : string -> int -> unit + val get : string -> int + val list_active : unit -> (string * int) list +end diff --git a/interfaces/5.5/hashtbl.mli b/interfaces/5.5/hashtbl.mli new file mode 100644 index 0000000..f78e28d --- /dev/null +++ b/interfaces/5.5/hashtbl.mli @@ -0,0 +1,160 @@ +type (!'a, !'b) t +val create : ?random:bool -> int -> ('a, 'b) t +val clear : ('a, 'b) t -> unit +val reset : ('a, 'b) t -> unit +val copy : ('a, 'b) t -> ('a, 'b) t +val add : ('a, 'b) t -> 'a -> 'b -> unit +val find : ('a, 'b) t -> 'a -> 'b +val find_opt : ('a, 'b) t -> 'a -> 'b option +val find_all : ('a, 'b) t -> 'a -> 'b list +val mem : ('a, 'b) t -> 'a -> bool +val remove : ('a, 'b) t -> 'a -> unit +val find_and_remove : ('a, 'b) t -> 'a -> 'b option +val replace : ('a, 'b) t -> 'a -> 'b -> unit +val find_and_replace : ('a, 'b) t -> 'a -> 'b -> 'b option +val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit +val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit +val fold : ('a -> 'b -> 'acc -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc +val length : ('a, 'b) t -> int +val randomize : unit -> unit +val is_randomized : unit -> bool +val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t +type statistics = + { + num_bindings: int ; + num_buckets: int ; + max_bucket_length: int ; + bucket_histogram: int array } +val stats : ('a, 'b) t -> statistics +val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t +val to_seq_keys : ('a, 'b) t -> 'a Seq.t +val to_seq_values : ('a, 'b) t -> 'b Seq.t +val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t +module type HashedType = + sig type t val equal : t -> t -> bool val hash : t -> int end +module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val find_and_replace : 'a t -> key -> 'a -> 'a option + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module Make : +(H : HashedType) -> + sig + type key = H.t + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val find_and_replace : 'a t -> key -> 'a -> 'a option + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module type SeededHashedType = + sig type t val equal : t -> t -> bool val seeded_hash : int -> t -> int end +module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val find_and_replace : 'a t -> key -> 'a -> 'a option + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +module MakeSeeded : +(H : SeededHashedType) -> + sig + type key = H.t + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key -> 'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key -> 'a -> unit + val find_and_replace : 'a t -> key -> 'a -> 'a option + val mem : 'a t -> key -> bool + val iter : (key -> 'a -> unit) -> 'a t -> unit + val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end +val hash : 'a -> int +val seeded_hash : int -> 'a -> int +val hash_param : int -> int -> 'a -> int +val seeded_hash_param : int -> int -> int -> 'a -> int diff --git a/interfaces/5.5/in_channel.mli b/interfaces/5.5/in_channel.mli new file mode 100644 index 0000000..2309613 --- /dev/null +++ b/interfaces/5.5/in_channel.mli @@ -0,0 +1,43 @@ +type t = in_channel +type open_flag = open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val stdin : t +val open_bin : string -> t +val open_text : string -> t +val open_gen : open_flag list -> int -> string -> t +val with_open_bin : string -> (t -> 'a) -> 'a +val with_open_text : string -> (t -> 'a) -> 'a +val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a +val close : t -> unit +val close_noerr : t -> unit +val input_char : t -> char option +val input_byte : t -> int option +val input_line : t -> string option +val really_input_string : t -> int -> string option +val input_all : t -> string +val input_lines : t -> string list +val input : t -> bytes -> int -> int -> int +val input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> int +val really_input : t -> bytes -> int -> int -> unit option +val really_input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit option +val fold_lines : ('acc -> string -> 'acc) -> 'acc -> t -> 'acc +val seek : t -> int64 -> unit +val pos : t -> int64 +val length : t -> int64 +val set_binary_mode : t -> bool -> unit +val is_binary_mode : t -> bool +val isatty : t -> bool diff --git a/interfaces/5.5/int32.mli b/interfaces/5.5/int32.mli new file mode 100644 index 0000000..f3ed3da --- /dev/null +++ b/interfaces/5.5/int32.mli @@ -0,0 +1,59 @@ +val zero : int32 +val one : int32 +val minus_one : int32 +external neg : int32 -> int32 = "%int32_neg" +external add : int32 -> int32 -> int32 = "%int32_add" +external sub : int32 -> int32 -> int32 = "%int32_sub" +external mul : int32 -> int32 -> int32 = "%int32_mul" +external div : int32 -> int32 -> int32 = "%int32_div" +val unsigned_div : int32 -> int32 -> int32 +external rem : int32 -> int32 -> int32 = "%int32_mod" +val unsigned_rem : int32 -> int32 -> int32 +val fdiv : int32 -> int32 -> int32 +val cdiv : int32 -> int32 -> int32 +val ediv : int32 -> int32 -> int32 +val erem : int32 -> int32 -> int32 +val succ : int32 -> int32 +val pred : int32 -> int32 +val abs : int32 -> int32 +val max_int : int32 +val min_int : int32 +external logand : int32 -> int32 -> int32 = "%int32_and" +external logor : int32 -> int32 -> int32 = "%int32_or" +external logxor : int32 -> int32 -> int32 = "%int32_xor" +val lognot : int32 -> int32 +external shift_left : int32 -> int -> int32 = "%int32_lsl" +external shift_right : int32 -> int -> int32 = "%int32_asr" +external shift_right_logical : int32 -> int -> int32 = "%int32_lsr" +external of_int : int -> int32 = "%int32_of_int" +external to_int : int32 -> int = "%int32_to_int" +val unsigned_to_int : int32 -> int option +external of_float : + float -> int32 = "caml_int32_of_float" "caml_int32_of_float_unboxed" +[@@unboxed ][@@noalloc ] +external to_float : + int32 -> float = "caml_int32_to_float" "caml_int32_to_float_unboxed" +[@@unboxed ][@@noalloc ] +external of_string : string -> int32 = "caml_int32_of_string" +val of_string_opt : string -> int32 option +val to_string : int32 -> string +external bits_of_float : + float -> int32 = "caml_int32_bits_of_float" + "caml_int32_bits_of_float_unboxed"[@@unboxed ][@@noalloc ] +external float_of_bits : + int32 -> float = "caml_int32_float_of_bits" + "caml_int32_float_of_bits_unboxed"[@@unboxed ][@@noalloc ] +type t = int32 +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val popcount : t -> int +val unsigned_bitsize : t -> int +val signed_bitsize : t -> int +val leading_zeros : t -> int +val leading_sign_bits : t -> int +val trailing_zeros : t -> int +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.5/int64.mli b/interfaces/5.5/int64.mli new file mode 100644 index 0000000..047ee80 --- /dev/null +++ b/interfaces/5.5/int64.mli @@ -0,0 +1,63 @@ +val zero : int64 +val one : int64 +val minus_one : int64 +external neg : int64 -> int64 = "%int64_neg" +external add : int64 -> int64 -> int64 = "%int64_add" +external sub : int64 -> int64 -> int64 = "%int64_sub" +external mul : int64 -> int64 -> int64 = "%int64_mul" +external div : int64 -> int64 -> int64 = "%int64_div" +val unsigned_div : int64 -> int64 -> int64 +external rem : int64 -> int64 -> int64 = "%int64_mod" +val unsigned_rem : int64 -> int64 -> int64 +val fdiv : int64 -> int64 -> int64 +val cdiv : int64 -> int64 -> int64 +val ediv : int64 -> int64 -> int64 +val erem : int64 -> int64 -> int64 +val succ : int64 -> int64 +val pred : int64 -> int64 +val abs : int64 -> int64 +val max_int : int64 +val min_int : int64 +external logand : int64 -> int64 -> int64 = "%int64_and" +external logor : int64 -> int64 -> int64 = "%int64_or" +external logxor : int64 -> int64 -> int64 = "%int64_xor" +val lognot : int64 -> int64 +external shift_left : int64 -> int -> int64 = "%int64_lsl" +external shift_right : int64 -> int -> int64 = "%int64_asr" +external shift_right_logical : int64 -> int -> int64 = "%int64_lsr" +external of_int : int -> int64 = "%int64_of_int" +external to_int : int64 -> int = "%int64_to_int" +val unsigned_to_int : int64 -> int option +external of_float : + float -> int64 = "caml_int64_of_float" "caml_int64_of_float_unboxed" +[@@unboxed ][@@noalloc ] +external to_float : + int64 -> float = "caml_int64_to_float" "caml_int64_to_float_unboxed" +[@@unboxed ][@@noalloc ] +external of_int32 : int32 -> int64 = "%int64_of_int32" +external to_int32 : int64 -> int32 = "%int64_to_int32" +external of_nativeint : nativeint -> int64 = "%int64_of_nativeint" +external to_nativeint : int64 -> nativeint = "%int64_to_nativeint" +external of_string : string -> int64 = "caml_int64_of_string" +val of_string_opt : string -> int64 option +val to_string : int64 -> string +external bits_of_float : + float -> int64 = "caml_int64_bits_of_float" + "caml_int64_bits_of_float_unboxed"[@@unboxed ][@@noalloc ] +external float_of_bits : + int64 -> float = "caml_int64_float_of_bits" + "caml_int64_float_of_bits_unboxed"[@@unboxed ][@@noalloc ] +type t = int64 +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val popcount : t -> int +val unsigned_bitsize : t -> int +val signed_bitsize : t -> int +val leading_zeros : t -> int +val leading_sign_bits : t -> int +val trailing_zeros : t -> int +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.5/lazy.mli b/interfaces/5.5/lazy.mli new file mode 100644 index 0000000..3eed000 --- /dev/null +++ b/interfaces/5.5/lazy.mli @@ -0,0 +1,17 @@ +type 'a t = 'a CamlinternalLazy.t +exception Undefined +external force : 'a t -> 'a = "%lazy_force" +val map : ('a -> 'b) -> 'a t -> 'b t +val is_val : 'a t -> bool +val from_val : 'a -> 'a t +val map_val : ('a -> 'b) -> 'a t -> 'b t +val from_fun : (unit -> 'a) -> 'a t +val force_val : 'a t -> 'a +module Mutexed : +sig + type !'a t + val is_val : 'a t -> bool + val from_val : 'a -> 'a t + val from_fun : (unit -> 'a) -> 'a t + val force : 'a t -> 'a +end diff --git a/interfaces/5.5/lexing.mli b/interfaces/5.5/lexing.mli new file mode 100644 index 0000000..0e5297c --- /dev/null +++ b/interfaces/5.5/lexing.mli @@ -0,0 +1,54 @@ +type position = + { + pos_fname: string ; + pos_lnum: int ; + pos_bol: int ; + pos_cnum: int } +val dummy_pos : position +type lexbuf = + { + refill_buff: lexbuf -> unit ; + mutable lex_buffer: bytes ; + mutable lex_buffer_len: int ; + mutable lex_abs_pos: int ; + mutable lex_start_pos: int ; + mutable lex_curr_pos: int ; + mutable lex_last_pos: int ; + mutable lex_last_action: int ; + mutable lex_eof_reached: bool ; + mutable lex_mem: int array ; + mutable lex_start_p: position ; + mutable lex_curr_p: position } +val from_channel : ?with_positions:bool -> in_channel -> lexbuf +val from_string : ?with_positions:bool -> string -> lexbuf +val from_function : ?with_positions:bool -> (bytes -> int -> int) -> lexbuf +val set_position : lexbuf -> position -> unit +val set_filename : lexbuf -> string -> unit +val with_positions : lexbuf -> bool +val lexeme : lexbuf -> string +val lexeme_char : lexbuf -> int -> char +val lexeme_start : lexbuf -> int +val lexeme_end : lexbuf -> int +val lexeme_start_p : lexbuf -> position +val lexeme_end_p : lexbuf -> position +val new_line : lexbuf -> unit +val flush_input : lexbuf -> unit +val sub_lexeme : lexbuf -> int -> int -> string +val sub_lexeme_opt : lexbuf -> int -> int -> string option +val sub_lexeme_char : lexbuf -> int -> char +val sub_lexeme_char_opt : lexbuf -> int -> char option +type lex_tables = + { + lex_base: string ; + lex_backtrk: string ; + lex_default: string ; + lex_trans: string ; + lex_check: string ; + lex_base_code: string ; + lex_backtrk_code: string ; + lex_default_code: string ; + lex_trans_code: string ; + lex_check_code: string ; + lex_code: string } +val engine : lex_tables -> int -> lexbuf -> int +val new_engine : lex_tables -> int -> lexbuf -> int diff --git a/interfaces/5.5/list.mli b/interfaces/5.5/list.mli new file mode 100644 index 0000000..54cf3dd --- /dev/null +++ b/interfaces/5.5/list.mli @@ -0,0 +1,79 @@ +type 'a t = 'a list = + | [] + | (::) of 'a * 'a list +val length : 'a list -> int +val compare_lengths : 'a list -> 'b list -> int +val compare_length_with : 'a list -> int -> int +val is_empty : 'a list -> bool +val cons : 'a -> 'a list -> 'a list +val singleton : 'a -> 'a list +val hd : 'a list -> 'a +val tl : 'a list -> 'a list +val nth : 'a list -> int -> 'a +val nth_opt : 'a list -> int -> 'a option +val rev : 'a list -> 'a list +val init : int -> (int -> 'a) -> 'a list +val append : 'a list -> 'a list -> 'a list +val rev_append : 'a list -> 'a list -> 'a list +val concat : 'a list list -> 'a list +val flatten : 'a list list -> 'a list +val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool +val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int +val iter : ('a -> unit) -> 'a list -> unit +val iteri : (int -> 'a -> unit) -> 'a list -> unit +val map : ('a -> 'b) -> 'a list -> 'b list +val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list +val rev_map : ('a -> 'b) -> 'a list -> 'b list +val filter_map : ('a -> 'b option) -> 'a list -> 'b list +val filter_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b list +val concat_map : ('a -> 'b list) -> 'a list -> 'b list +val fold_left_map : + ('acc -> 'a -> ('acc * 'b)) -> 'acc -> 'a list -> ('acc * 'b list) +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc +val fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc +val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit +val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val fold_left2 : + ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a list -> 'b list -> 'acc +val fold_right2 : + ('a -> 'b -> 'acc -> 'acc) -> 'a list -> 'b list -> 'acc -> 'acc +val for_all : ('a -> bool) -> 'a list -> bool +val exists : ('a -> bool) -> 'a list -> bool +val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val mem : 'a -> 'a list -> bool +val memq : 'a -> 'a list -> bool +val find : ('a -> bool) -> 'a list -> 'a +val find_opt : ('a -> bool) -> 'a list -> 'a option +val find_index : ('a -> bool) -> 'a list -> int option +val find_map : ('a -> 'b option) -> 'a list -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b option +val filter : ('a -> bool) -> 'a list -> 'a list +val find_all : ('a -> bool) -> 'a list -> 'a list +val filteri : (int -> 'a -> bool) -> 'a list -> 'a list +val take : int -> 'a list -> 'a list +val drop : int -> 'a list -> 'a list +val take_while : ('a -> bool) -> 'a list -> 'a list +val drop_while : ('a -> bool) -> 'a list -> 'a list +val partition : ('a -> bool) -> 'a list -> ('a list * 'a list) +val partition_map : + ('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) +val assoc : 'a -> ('a * 'b) list -> 'b +val assoc_opt : 'a -> ('a * 'b) list -> 'b option +val assq : 'a -> ('a * 'b) list -> 'b +val assq_opt : 'a -> ('a * 'b) list -> 'b option +val mem_assoc : 'a -> ('a * 'b) list -> bool +val mem_assq : 'a -> ('a * 'b) list -> bool +val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list +val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list +val split : ('a * 'b) list -> ('a list * 'b list) +val split_map : ('c -> ('a * 'b)) -> 'c list -> ('a list * 'b list) +val combine : 'a list -> 'b list -> ('a * 'b) list +val sort : ('a -> 'a -> int) -> 'a list -> 'a list +val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list +val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list +val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list +val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list +val to_seq : 'a list -> 'a Seq.t +val of_seq : 'a Seq.t -> 'a list diff --git a/interfaces/5.5/listLabels.mli b/interfaces/5.5/listLabels.mli new file mode 100644 index 0000000..6f991f5 --- /dev/null +++ b/interfaces/5.5/listLabels.mli @@ -0,0 +1,79 @@ +type 'a t = 'a list = + | [] + | (::) of 'a * 'a list +val length : 'a list -> int +val compare_lengths : 'a list -> 'b list -> int +val compare_length_with : 'a list -> len:int -> int +val is_empty : 'a list -> bool +val cons : 'a -> 'a list -> 'a list +val singleton : 'a -> 'a list +val hd : 'a list -> 'a +val tl : 'a list -> 'a list +val nth : 'a list -> int -> 'a +val nth_opt : 'a list -> int -> 'a option +val rev : 'a list -> 'a list +val init : len:int -> f:(int -> 'a) -> 'a list +val append : 'a list -> 'a list -> 'a list +val rev_append : 'a list -> 'a list -> 'a list +val concat : 'a list list -> 'a list +val flatten : 'a list list -> 'a list +val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool +val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int +val iter : f:('a -> unit) -> 'a list -> unit +val iteri : f:(int -> 'a -> unit) -> 'a list -> unit +val map : f:('a -> 'b) -> 'a list -> 'b list +val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list +val rev_map : f:('a -> 'b) -> 'a list -> 'b list +val filter_map : f:('a -> 'b option) -> 'a list -> 'b list +val filter_mapi : f:(int -> 'a -> 'b option) -> 'a list -> 'b list +val concat_map : f:('a -> 'b list) -> 'a list -> 'b list +val fold_left_map : + f:('acc -> 'a -> ('acc * 'b)) -> init:'acc -> 'a list -> ('acc * 'b list) +val fold_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a list -> 'acc +val fold_right : f:('a -> 'acc -> 'acc) -> 'a list -> init:'acc -> 'acc +val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit +val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list +val fold_left2 : + f:('acc -> 'a -> 'b -> 'acc) -> init:'acc -> 'a list -> 'b list -> 'acc +val fold_right2 : + f:('a -> 'b -> 'acc -> 'acc) -> 'a list -> 'b list -> init:'acc -> 'acc +val for_all : f:('a -> bool) -> 'a list -> bool +val exists : f:('a -> bool) -> 'a list -> bool +val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool +val mem : 'a -> set:'a list -> bool +val memq : 'a -> set:'a list -> bool +val find : f:('a -> bool) -> 'a list -> 'a +val find_opt : f:('a -> bool) -> 'a list -> 'a option +val find_index : f:('a -> bool) -> 'a list -> int option +val find_map : f:('a -> 'b option) -> 'a list -> 'b option +val find_mapi : f:(int -> 'a -> 'b option) -> 'a list -> 'b option +val filter : f:('a -> bool) -> 'a list -> 'a list +val find_all : f:('a -> bool) -> 'a list -> 'a list +val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list +val take : int -> 'a list -> 'a list +val drop : int -> 'a list -> 'a list +val take_while : f:('a -> bool) -> 'a list -> 'a list +val drop_while : f:('a -> bool) -> 'a list -> 'a list +val partition : f:('a -> bool) -> 'a list -> ('a list * 'a list) +val partition_map : + f:('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) +val assoc : 'a -> ('a * 'b) list -> 'b +val assoc_opt : 'a -> ('a * 'b) list -> 'b option +val assq : 'a -> ('a * 'b) list -> 'b +val assq_opt : 'a -> ('a * 'b) list -> 'b option +val mem_assoc : 'a -> map:('a * 'b) list -> bool +val mem_assq : 'a -> map:('a * 'b) list -> bool +val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list +val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list +val split : ('a * 'b) list -> ('a list * 'b list) +val split_map : f:('c -> ('a * 'b)) -> 'c list -> ('a list * 'b list) +val combine : 'a list -> 'b list -> ('a * 'b) list +val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list +val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list +val to_seq : 'a list -> 'a Seq.t +val of_seq : 'a Seq.t -> 'a list diff --git a/interfaces/5.5/map.mli b/interfaces/5.5/map.mli new file mode 100644 index 0000000..6a9f8f6 --- /dev/null +++ b/interfaces/5.5/map.mli @@ -0,0 +1,102 @@ +module type OrderedType = sig type t val compare : t -> t -> int end +module type S = + sig + type key + type +!'a t + val empty : 'a t + val add : key -> 'a -> 'a t -> 'a t + val add_to_list : key -> 'a -> 'a list t -> 'a list t + val update : key -> ('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t + val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : (key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option + val find_last : (key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option + val iter : (key -> 'a -> unit) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val map : ('a -> 'b) -> 'a t -> 'b t + val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t + val filter : (key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val is_singleton : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : (key -> 'a -> bool) -> 'a t -> bool + val exists : (key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end +module Make : +(Ord : OrderedType) -> + sig + type key = Ord.t + type +!'a t + val empty : 'a t + val add : key -> 'a -> 'a t -> 'a t + val add_to_list : key -> 'a -> 'a list t -> 'a list t + val update : key -> ('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t + val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : (key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option + val find_last : (key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option + val iter : (key -> 'a -> unit) -> 'a t -> unit + val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc + val map : ('a -> 'b) -> 'a t -> 'b t + val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t + val filter : (key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val is_singleton : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : (key -> 'a -> bool) -> 'a t -> bool + val exists : (key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end diff --git a/interfaces/5.5/marshal.mli b/interfaces/5.5/marshal.mli new file mode 100644 index 0000000..2902fd4 --- /dev/null +++ b/interfaces/5.5/marshal.mli @@ -0,0 +1,16 @@ +type extern_flags = + | No_sharing + | Closures + | Compat_32 +val to_channel : out_channel -> 'a -> extern_flags list -> unit +external to_bytes : + 'a -> extern_flags list -> bytes = "caml_output_value_to_bytes" +external to_string : + 'a -> extern_flags list -> string = "caml_output_value_to_string" +val to_buffer : bytes -> int -> int -> 'a -> extern_flags list -> int +val from_channel : in_channel -> 'a +val from_bytes : bytes -> int -> 'a +val from_string : string -> int -> 'a +val header_size : int +val data_size : bytes -> int -> int +val total_size : bytes -> int -> int diff --git a/interfaces/5.5/moreLabels.mli b/interfaces/5.5/moreLabels.mli new file mode 100644 index 0000000..1fb9542 --- /dev/null +++ b/interfaces/5.5/moreLabels.mli @@ -0,0 +1,386 @@ +module Hashtbl : +sig + type ('a, 'b) t = ('a, 'b) Hashtbl.t + val create : ?random:bool -> int -> ('a, 'b) t + val clear : ('a, 'b) t -> unit + val reset : ('a, 'b) t -> unit + val copy : ('a, 'b) t -> ('a, 'b) t + val add : ('a, 'b) t -> key:'a -> data:'b -> unit + val find : ('a, 'b) t -> 'a -> 'b + val find_opt : ('a, 'b) t -> 'a -> 'b option + val find_all : ('a, 'b) t -> 'a -> 'b list + val mem : ('a, 'b) t -> 'a -> bool + val remove : ('a, 'b) t -> 'a -> unit + val find_and_remove : ('a, 'b) t -> 'a -> 'b option + val replace : ('a, 'b) t -> key:'a -> data:'b -> unit + val find_and_replace : ('a, 'b) t -> key:'a -> data:'b -> 'b option + val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit + val filter_map_inplace : + f:(key:'a -> data:'b -> 'b option) -> ('a, 'b) t -> unit + val fold : + f:(key:'a -> data:'b -> 'acc -> 'acc) -> ('a, 'b) t -> init:'acc -> 'acc + val length : ('a, 'b) t -> int + val randomize : unit -> unit + val is_randomized : unit -> bool + val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t + type statistics = Hashtbl.statistics = + { + num_bindings: int ; + num_buckets: int ; + max_bucket_length: int ; + bucket_histogram: int array } + val stats : ('a, 'b) t -> statistics + val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t + val to_seq_keys : ('a, 'b) t -> 'a Seq.t + val to_seq_values : ('a, 'b) t -> 'b Seq.t + val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit + val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit + val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t + module type HashedType = + sig type t val equal : t -> t -> bool val hash : t -> int end + module type S = + sig + type key + type !'a t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val find_and_replace : 'a t -> key:key -> data:'a -> 'a option + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module Make : + (H : HashedType) -> + sig + type key = H.t + type 'a t = 'a Hashtbl.Make(H).t + val create : int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val find_and_replace : 'a t -> key:key -> data:'a -> 'a option + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module type SeededHashedType = + sig type t val equal : t -> t -> bool val seeded_hash : int -> t -> int + end + module type SeededS = + sig + type key + type !'a t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val find_and_replace : 'a t -> key:key -> data:'a -> 'a option + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + module MakeSeeded : + (H : SeededHashedType) -> + sig + type key = H.t + type 'a t = 'a Hashtbl.MakeSeeded(H).t + val create : ?random:bool -> int -> 'a t + val clear : 'a t -> unit + val reset : 'a t -> unit + val copy : 'a t -> 'a t + val add : 'a t -> key:key -> data:'a -> unit + val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option + val find : 'a t -> key -> 'a + val find_opt : 'a t -> key -> 'a option + val find_all : 'a t -> key -> 'a list + val replace : 'a t -> key:key -> data:'a -> unit + val find_and_replace : 'a t -> key:key -> data:'a -> 'a option + val mem : 'a t -> key -> bool + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val filter_map_inplace : + f:(key:key -> data:'a -> 'a option) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val length : 'a t -> int + val stats : 'a t -> statistics + val to_seq : 'a t -> (key * 'a) Seq.t + val to_seq_keys : 'a t -> key Seq.t + val to_seq_values : 'a t -> 'a Seq.t + val add_seq : 'a t -> (key * 'a) Seq.t -> unit + val replace_seq : 'a t -> (key * 'a) Seq.t -> unit + val of_seq : (key * 'a) Seq.t -> 'a t + end + val hash : 'a -> int + val seeded_hash : int -> 'a -> int + val hash_param : int -> int -> 'a -> int + val seeded_hash_param : int -> int -> int -> 'a -> int +end +module Map : +sig + module type OrderedType = sig type t val compare : t -> t -> int end + module type S = + sig + type key + type +!'a t + val empty : 'a t + val add : key:key -> data:'a -> 'a t -> 'a t + val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t + val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t + val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : f:(key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val find_last : f:(key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val map : f:('a -> 'b) -> 'a t -> 'b t + val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t + val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val is_singleton : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : f:(key -> 'a -> bool) -> 'a t -> bool + val exists : f:(key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end + module Make : + (Ord : OrderedType) -> + sig + type key = Ord.t + type 'a t = 'a Map.Make(Ord).t + val empty : 'a t + val add : key:key -> data:'a -> 'a t -> 'a t + val add_to_list : key:key -> data:'a -> 'a list t -> 'a list t + val update : key:key -> f:('a option -> 'a option) -> 'a t -> 'a t + val singleton : key -> 'a -> 'a t + val remove : key -> 'a t -> 'a t + val merge : + f:(key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t + val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t + val cardinal : 'a t -> int + val bindings : 'a t -> (key * 'a) list + val min_binding : 'a t -> (key * 'a) + val min_binding_opt : 'a t -> (key * 'a) option + val max_binding : 'a t -> (key * 'a) + val max_binding_opt : 'a t -> (key * 'a) option + val choose : 'a t -> (key * 'a) + val choose_opt : 'a t -> (key * 'a) option + val find : key -> 'a t -> 'a + val find_opt : key -> 'a t -> 'a option + val find_first : f:(key -> bool) -> 'a t -> (key * 'a) + val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val find_last : f:(key -> bool) -> 'a t -> (key * 'a) + val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option + val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit + val fold : + f:(key:key -> data:'a -> 'acc -> 'acc) -> 'a t -> init:'acc -> 'acc + val map : f:('a -> 'b) -> 'a t -> 'b t + val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t + val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t + val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t + val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) + val split : key -> 'a t -> ('a t * 'a option * 'a t) + val is_empty : 'a t -> bool + val is_singleton : 'a t -> bool + val mem : key -> 'a t -> bool + val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int + val for_all : f:(key -> 'a -> bool) -> 'a t -> bool + val exists : f:(key -> 'a -> bool) -> 'a t -> bool + val to_list : 'a t -> (key * 'a) list + val of_list : (key * 'a) list -> 'a t + val to_seq : 'a t -> (key * 'a) Seq.t + val to_rev_seq : 'a t -> (key * 'a) Seq.t + val to_seq_from : key -> 'a t -> (key * 'a) Seq.t + val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t + val of_seq : (key * 'a) Seq.t -> 'a t + end +end +module Set : +sig + module type OrderedType = sig type t val compare : t -> t -> int end + module type S = + sig + type elt + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : f:(elt -> bool) -> t -> elt + val find_first_opt : f:(elt -> bool) -> t -> elt option + val find_last : f:(elt -> bool) -> t -> elt + val find_last_opt : f:(elt -> bool) -> t -> elt option + val iter : f:(elt -> unit) -> t -> unit + val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val map : f:(elt -> elt) -> t -> t + val filter : f:(elt -> bool) -> t -> t + val filter_map : f:(elt -> elt option) -> t -> t + val partition : f:(elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val is_singleton : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : f:(elt -> bool) -> t -> bool + val exists : f:(elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end + module Make : + (Ord : OrderedType) -> + sig + type elt = Ord.t + type t = Set.Make(Ord).t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : f:(elt -> bool) -> t -> elt + val find_first_opt : f:(elt -> bool) -> t -> elt option + val find_last : f:(elt -> bool) -> t -> elt + val find_last_opt : f:(elt -> bool) -> t -> elt option + val iter : f:(elt -> unit) -> t -> unit + val fold : f:(elt -> 'acc -> 'acc) -> t -> init:'acc -> 'acc + val map : f:(elt -> elt) -> t -> t + val filter : f:(elt -> bool) -> t -> t + val filter_map : f:(elt -> elt option) -> t -> t + val partition : f:(elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val is_singleton : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : f:(elt -> bool) -> t -> bool + val exists : f:(elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end +end diff --git a/interfaces/5.5/nativeint.mli b/interfaces/5.5/nativeint.mli new file mode 100644 index 0000000..1308ffc --- /dev/null +++ b/interfaces/5.5/nativeint.mli @@ -0,0 +1,57 @@ +val zero : nativeint +val one : nativeint +val minus_one : nativeint +external neg : nativeint -> nativeint = "%nativeint_neg" +external add : nativeint -> nativeint -> nativeint = "%nativeint_add" +external sub : nativeint -> nativeint -> nativeint = "%nativeint_sub" +external mul : nativeint -> nativeint -> nativeint = "%nativeint_mul" +external div : nativeint -> nativeint -> nativeint = "%nativeint_div" +val unsigned_div : nativeint -> nativeint -> nativeint +external rem : nativeint -> nativeint -> nativeint = "%nativeint_mod" +val unsigned_rem : nativeint -> nativeint -> nativeint +val fdiv : nativeint -> nativeint -> nativeint +val cdiv : nativeint -> nativeint -> nativeint +val ediv : nativeint -> nativeint -> nativeint +val erem : nativeint -> nativeint -> nativeint +val succ : nativeint -> nativeint +val pred : nativeint -> nativeint +val abs : nativeint -> nativeint +val size : int +val max_int : nativeint +val min_int : nativeint +external logand : nativeint -> nativeint -> nativeint = "%nativeint_and" +external logor : nativeint -> nativeint -> nativeint = "%nativeint_or" +external logxor : nativeint -> nativeint -> nativeint = "%nativeint_xor" +val lognot : nativeint -> nativeint +external shift_left : nativeint -> int -> nativeint = "%nativeint_lsl" +external shift_right : nativeint -> int -> nativeint = "%nativeint_asr" +external shift_right_logical : + nativeint -> int -> nativeint = "%nativeint_lsr" +external of_int : int -> nativeint = "%nativeint_of_int" +external to_int : nativeint -> int = "%nativeint_to_int" +val unsigned_to_int : nativeint -> int option +external of_float : + float -> nativeint = "caml_nativeint_of_float" + "caml_nativeint_of_float_unboxed"[@@unboxed ][@@noalloc ] +external to_float : + nativeint -> float = "caml_nativeint_to_float" + "caml_nativeint_to_float_unboxed"[@@unboxed ][@@noalloc ] +external of_int32 : int32 -> nativeint = "%nativeint_of_int32" +external to_int32 : nativeint -> int32 = "%nativeint_to_int32" +external of_string : string -> nativeint = "caml_nativeint_of_string" +val of_string_opt : string -> nativeint option +val to_string : nativeint -> string +type t = nativeint +val compare : t -> t -> int +val unsigned_compare : t -> t -> int +val equal : t -> t -> bool +val min : t -> t -> t +val max : t -> t -> t +val popcount : t -> int +val unsigned_bitsize : t -> int +val signed_bitsize : t -> int +val leading_zeros : t -> int +val leading_sign_bits : t -> int +val trailing_zeros : t -> int +val seeded_hash : int -> t -> int +val hash : t -> int diff --git a/interfaces/5.5/obj.mli b/interfaces/5.5/obj.mli new file mode 100644 index 0000000..d6d0e07 --- /dev/null +++ b/interfaces/5.5/obj.mli @@ -0,0 +1,66 @@ +type t +type raw_data = nativeint +external repr : 'a -> t = "%identity" +external obj : t -> 'a = "%identity" +external magic : 'a -> 'b = "%identity" +val is_block : t -> bool +external is_int : t -> bool = "%obj_is_int" +external tag : t -> int = "caml_obj_tag"[@@noalloc ] +external size : t -> int = "%obj_size" +external reachable_words : t -> int = "caml_obj_reachable_words" +external field : t -> int -> t = "%obj_field" +external set_field : t -> int -> t -> unit = "%obj_set_field" +val double_field : t -> int -> float +val set_double_field : t -> int -> float -> unit +external raw_field : t -> int -> raw_data = "caml_obj_raw_field" +external set_raw_field : + t -> int -> raw_data -> unit = "caml_obj_set_raw_field" +external new_block : int -> int -> t = "caml_obj_block" +external dup : t -> t = "caml_obj_dup" +external add_offset : t -> Int32.t -> t = "caml_obj_add_offset" +external with_tag : int -> t -> t = "caml_obj_with_tag" +val first_non_constant_constructor_tag : int +val last_non_constant_constructor_tag : int +val forcing_tag : int +val cont_tag : int +val lazy_tag : int +val closure_tag : int +val object_tag : int +val infix_tag : int +val forward_tag : int +val no_scan_tag : int +val abstract_tag : int +val string_tag : int +val double_tag : int +val double_array_tag : int +val custom_tag : int +val int_tag : int +val out_of_heap_tag : int +val unaligned_tag : int +module Extension_constructor : +sig + type t = extension_constructor + val of_val : 'a -> t + val name : t -> string + val id : t -> int +end +module Ephemeron : +sig + type obj_t = t + type t + val create : int -> t + val length : t -> int + val get_key : t -> int -> obj_t option + val get_key_copy : t -> int -> obj_t option + val set_key : t -> int -> obj_t -> unit + val unset_key : t -> int -> unit + val check_key : t -> int -> bool + val blit_key : t -> int -> t -> int -> int -> unit + val get_data : t -> obj_t option + val get_data_copy : t -> obj_t option + val set_data : t -> obj_t -> unit + val unset_data : t -> unit + val check_data : t -> bool + val blit_data : t -> t -> unit + val max_ephe_length : int +end diff --git a/interfaces/5.5/oo.mli b/interfaces/5.5/oo.mli new file mode 100644 index 0000000..7a03b33 --- /dev/null +++ b/interfaces/5.5/oo.mli @@ -0,0 +1,4 @@ +val copy : (< .. > as 'a) -> 'a +external id : < .. > -> int = "%field1" +val new_method : string -> CamlinternalOO.tag +val public_method_label : string -> CamlinternalOO.tag diff --git a/interfaces/5.5/option.mli b/interfaces/5.5/option.mli new file mode 100644 index 0000000..ab99805 --- /dev/null +++ b/interfaces/5.5/option.mli @@ -0,0 +1,30 @@ +type 'a t = 'a option = + | None + | Some of 'a +val none : 'a option +val some : 'a -> 'a option +val value : 'a option -> default:'a -> 'a +val get : 'a option -> 'a +val bind : 'a option -> ('a -> 'b option) -> 'b option +val join : 'a option option -> 'a option +val map : ('a -> 'b) -> 'a option -> 'b option +val product : 'a option -> 'b option -> ('a * 'b) option +val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a +val iter : ('a -> unit) -> 'a option -> unit +val blend : ('a -> 'a -> 'a) -> 'a option -> 'a option -> 'a option +val for_all : ('a -> bool) -> 'a option -> bool +val exists : ('a -> bool) -> 'a option -> bool +val is_none : 'a option -> bool +val is_some : 'a option -> bool +val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool +val compare : ('a -> 'a -> int) -> 'a option -> 'a option -> int +val to_result : none:'e -> 'a option -> ('a, 'e) result +val to_list : 'a option -> 'a list +val to_seq : 'a option -> 'a Seq.t +module Syntax : +sig + val ( let* ) : 'a option -> ('a -> 'b option) -> 'b option + val ( and* ) : 'a option -> 'b option -> ('a * 'b) option + val (let+) : 'a option -> ('a -> 'b) -> 'b option + val (and+) : 'a option -> 'b option -> ('a * 'b) option +end diff --git a/interfaces/5.5/out_channel.mli b/interfaces/5.5/out_channel.mli new file mode 100644 index 0000000..2331a26 --- /dev/null +++ b/interfaces/5.5/out_channel.mli @@ -0,0 +1,41 @@ +type t = out_channel +type open_flag = open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val stdout : t +val stderr : t +val open_bin : string -> t +val open_text : string -> t +val open_gen : open_flag list -> int -> string -> t +val with_open_bin : string -> (t -> 'a) -> 'a +val with_open_text : string -> (t -> 'a) -> 'a +val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a +val close : t -> unit +val close_noerr : t -> unit +val output_char : t -> char -> unit +val output_byte : t -> int -> unit +val output_string : t -> string -> unit +val output_bytes : t -> bytes -> unit +val output : t -> bytes -> int -> int -> unit +val output_substring : t -> string -> int -> int -> unit +val output_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit +val flush : t -> unit +val flush_all : unit -> unit +val seek : t -> int64 -> unit +val pos : t -> int64 +val length : t -> int64 +val set_binary_mode : t -> bool -> unit +val is_binary_mode : t -> bool +val set_buffered : t -> bool -> unit +val is_buffered : t -> bool +val isatty : t -> bool diff --git a/interfaces/5.5/parsing.mli b/interfaces/5.5/parsing.mli new file mode 100644 index 0000000..68f1243 --- /dev/null +++ b/interfaces/5.5/parsing.mli @@ -0,0 +1,36 @@ +val symbol_start : unit -> int +val symbol_end : unit -> int +val rhs_start : int -> int +val rhs_end : int -> int +val symbol_start_pos : unit -> Lexing.position +val symbol_end_pos : unit -> Lexing.position +val rhs_start_pos : int -> Lexing.position +val rhs_end_pos : int -> Lexing.position +val clear_parser : unit -> unit +exception Parse_error +val set_trace : bool -> bool +type parser_env +type parse_tables = + { + actions: (parser_env -> Obj.t) array ; + transl_const: int array ; + transl_block: int array ; + lhs: string ; + len: string ; + defred: string ; + dgoto: string ; + sindex: string ; + rindex: string ; + gindex: string ; + tablesize: int ; + table: string ; + check: string ; + error_function: string -> unit ; + names_const: string ; + names_block: string } +exception YYexit of Obj.t +val yyparse : + parse_tables -> int -> (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'b +val peek_val : parser_env -> int -> 'a +val is_current_lookahead : 'a -> bool +val parse_error : string -> unit diff --git a/interfaces/5.5/printexc.mli b/interfaces/5.5/printexc.mli new file mode 100644 index 0000000..171ec13 --- /dev/null +++ b/interfaces/5.5/printexc.mli @@ -0,0 +1,52 @@ +type t = exn = .. +val to_string : exn -> string +val to_string_default : exn -> string +val print : ('a -> 'b) -> 'a -> 'b +val catch : ('a -> 'b) -> 'a -> 'b +val print_backtrace : out_channel -> unit +val get_backtrace : unit -> string +val record_backtrace : bool -> unit +val backtrace_status : unit -> bool +val register_printer : (exn -> string option) -> unit +val use_printers : exn -> string option +type raw_backtrace +type raw_backtrace_entry = private int +val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array +val get_raw_backtrace : unit -> raw_backtrace +val print_raw_backtrace : out_channel -> raw_backtrace -> unit +val raw_backtrace_to_string : raw_backtrace -> string +external raise_with_backtrace : + exn -> raw_backtrace -> 'a = "%raise_with_backtrace" +external get_callstack : int -> raw_backtrace = "caml_get_current_callstack" +val default_uncaught_exception_handler : exn -> raw_backtrace -> unit +val set_uncaught_exception_handler : (exn -> raw_backtrace -> unit) -> unit +type backtrace_slot +val backtrace_slots : raw_backtrace -> backtrace_slot array option +val backtrace_slots_of_raw_entry : + raw_backtrace_entry -> backtrace_slot array option +type location = + { + filename: string ; + line_number: int ; + start_char: int ; + end_char: int ; + end_line: int ; + end_col: int } +module Slot : +sig + type t = backtrace_slot + val is_raise : t -> bool + val is_inline : t -> bool + val location : t -> location option + val name : t -> string option + val format : int -> t -> string option +end +type raw_backtrace_slot +val raw_backtrace_length : raw_backtrace -> int +val get_raw_backtrace_slot : raw_backtrace -> int -> raw_backtrace_slot +val convert_raw_backtrace_slot : raw_backtrace_slot -> backtrace_slot +val get_raw_backtrace_next_slot : + raw_backtrace_slot -> raw_backtrace_slot option +val exn_slot_id : exn -> int +val exn_slot_name : exn -> string +val string_of_extension_constructor : Obj.t -> string diff --git a/interfaces/5.5/printf.mli b/interfaces/5.5/printf.mli new file mode 100644 index 0000000..31b640b --- /dev/null +++ b/interfaces/5.5/printf.mli @@ -0,0 +1,32 @@ +val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a +val printf : ('a, out_channel, unit) format -> 'a +val eprintf : ('a, out_channel, unit) format -> 'a +val sprintf : ('a, unit, string) format -> 'a +val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +val ifprintf : 'b -> ('a, 'b, 'c, unit) format4 -> 'a +val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +val kfprintf : + (out_channel -> 'd) -> + out_channel -> ('a, out_channel, unit, 'd) format4 -> 'a +val ikfprintf : ('b -> 'd) -> 'b -> ('a, 'b, 'c, 'd) format4 -> 'a +val ksprintf : (string -> 'd) -> ('a, unit, string, 'd) format4 -> 'a +val kbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +val ikbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +module Args : +sig + type ('a, 'r) t = + | []: ('r, 'r) t + | (::): 'a * ('b, 'r) t -> ('a -> 'b, 'r) t + val apply : 'a -> ('a, 'r) t -> 'r + val (@) : ('a, 'r1) t -> ('r1, 'r2) t -> ('a, 'r2) t +end +val lfprintf : + out_channel -> ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +val lbprintf : + Buffer.t -> ('a, Buffer.t, unit) format -> ('a, unit) Args.t -> unit +val lprintf : ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +val leprintf : ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +val lsprintf : ('a, unit, string) format -> ('a, string) Args.t -> string +val kprintf : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a diff --git a/interfaces/5.5/queue.mli b/interfaces/5.5/queue.mli new file mode 100644 index 0000000..551a327 --- /dev/null +++ b/interfaces/5.5/queue.mli @@ -0,0 +1,22 @@ +type !'a t +exception Empty +val create : unit -> 'a t +val add : 'a -> 'a t -> unit +val push : 'a -> 'a t -> unit +val take : 'a t -> 'a +val take_opt : 'a t -> 'a option +val pop : 'a t -> 'a +val peek : 'a t -> 'a +val peek_opt : 'a t -> 'a option +val top : 'a t -> 'a +val drop : 'a t -> unit +val clear : 'a t -> unit +val copy : 'a t -> 'a t +val is_empty : 'a t -> bool +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val transfer : 'a t -> 'a t -> unit +val to_seq : 'a t -> 'a Seq.t +val add_seq : 'a t -> 'a Seq.t -> unit +val of_seq : 'a Seq.t -> 'a t diff --git a/interfaces/5.5/random.mli b/interfaces/5.5/random.mli new file mode 100644 index 0000000..f1f49e8 --- /dev/null +++ b/interfaces/5.5/random.mli @@ -0,0 +1,46 @@ +val init : int -> unit +val full_init : int array -> unit +val self_init : unit -> unit +val bits : unit -> int +val int : int -> int +val full_int : int -> int +val int_in_range : min:int -> max:int -> int +val int32 : Int32.t -> Int32.t +val int32_in_range : min:int32 -> max:int32 -> int32 +val nativeint : Nativeint.t -> Nativeint.t +val nativeint_in_range : min:nativeint -> max:nativeint -> nativeint +val int64 : Int64.t -> Int64.t +val int64_in_range : min:int64 -> max:int64 -> int64 +val float : float -> float +val bool : unit -> bool +val bits32 : unit -> Int32.t +val bits64 : unit -> Int64.t +val nativebits : unit -> Nativeint.t +module State : +sig + type t + val make : int array -> t + val make_self_init : unit -> t + val copy : t -> t + val bits : t -> int + val int : t -> int -> int + val full_int : t -> int -> int + val int_in_range : t -> min:int -> max:int -> int + val int32 : t -> Int32.t -> Int32.t + val int32_in_range : t -> min:int32 -> max:int32 -> int32 + val nativeint : t -> Nativeint.t -> Nativeint.t + val nativeint_in_range : t -> min:nativeint -> max:nativeint -> nativeint + val int64 : t -> Int64.t -> Int64.t + val int64_in_range : t -> min:int64 -> max:int64 -> int64 + val float : t -> float -> float + val bool : t -> bool + val bits32 : t -> Int32.t + val bits64 : t -> Int64.t + val nativebits : t -> Nativeint.t + val split : t -> t + val to_binary_string : t -> string + val of_binary_string : string -> t +end +val get_state : unit -> State.t +val set_state : State.t -> unit +val split : unit -> State.t diff --git a/interfaces/5.5/result.mli b/interfaces/5.5/result.mli new file mode 100644 index 0000000..80db98e --- /dev/null +++ b/interfaces/5.5/result.mli @@ -0,0 +1,38 @@ +type ('a, 'e) t = ('a, 'e) result = + | Ok of 'a + | Error of 'e +val ok : 'a -> ('a, 'e) result +val error : 'e -> ('a, 'e) result +val value : ('a, 'e) result -> default:'a -> 'a +val get_ok : ('a, 'e) result -> 'a +val get_ok' : ('a, string) result -> 'a +val get_error : ('a, 'e) result -> 'e +val error_to_failure : ('a, string) result -> 'a +val bind : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result +val join : (('a, 'e) result, 'e) result -> ('a, 'e) result +val map : ('a -> 'b) -> ('a, 'e) result -> ('b, 'e) result +val product : ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result +val map_error : ('e -> 'f) -> ('a, 'e) result -> ('a, 'f) result +val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) result -> 'c +val retract : ('a, 'a) result -> 'a +val iter : ('a -> unit) -> ('a, 'e) result -> unit +val iter_error : ('e -> unit) -> ('a, 'e) result -> unit +val is_ok : ('a, 'e) result -> bool +val is_error : ('a, 'e) result -> bool +val equal : + ok:('a -> 'a -> bool) -> + error:('e -> 'e -> bool) -> ('a, 'e) result -> ('a, 'e) result -> bool +val compare : + ok:('a -> 'a -> int) -> + error:('e -> 'e -> int) -> ('a, 'e) result -> ('a, 'e) result -> int +val to_option : ('a, 'e) result -> 'a option +val to_list : ('a, 'e) result -> 'a list +val to_seq : ('a, 'e) result -> 'a Seq.t +module Syntax : +sig + val ( let* ) : + ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result + val ( and* ) : ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result + val (let+) : ('a, 'e) result -> ('a -> 'b) -> ('b, 'e) result + val (and+) : ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result +end diff --git a/interfaces/5.5/scanf.mli b/interfaces/5.5/scanf.mli new file mode 100644 index 0000000..6827794 --- /dev/null +++ b/interfaces/5.5/scanf.mli @@ -0,0 +1,46 @@ +module Scanning : +sig + type in_channel + type scanbuf = in_channel + val stdin : in_channel + type file_name = string + val open_in : file_name -> in_channel + val open_in_bin : file_name -> in_channel + val close_in : in_channel -> unit + val from_file : file_name -> in_channel + val from_file_bin : string -> in_channel + val from_string : string -> in_channel + val from_function : (unit -> char) -> in_channel + val from_channel : Stdlib.in_channel -> in_channel + val end_of_input : in_channel -> bool + val beginning_of_input : in_channel -> bool + val name_of_input : in_channel -> string +end +type ('a, 'b, 'c, 'd) scanner = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd, 'd) format6 -> 'c +type ('a, 'b, 'c, 'd) scanner_opt = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd option, 'd) format6 -> 'c +exception Scan_failure of string +val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner +val bscanf_opt : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner_opt +val sscanf : string -> ('a, 'b, 'c, 'd) scanner +val sscanf_opt : string -> ('a, 'b, 'c, 'd) scanner_opt +val scanf : ('a, 'b, 'c, 'd) scanner +val scanf_opt : ('a, 'b, 'c, 'd) scanner_opt +val kscanf : + Scanning.in_channel -> + (Scanning.in_channel -> exn -> 'd) -> ('a, 'b, 'c, 'd) scanner +val ksscanf : + string -> (Scanning.in_channel -> exn -> 'd) -> ('a, 'b, 'c, 'd) scanner +val bscanf_format : + Scanning.in_channel -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> 'g +val sscanf_format : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + (('a, 'b, 'c, 'd, 'e, 'f) format6 -> 'g) -> 'g +val format_from_string : + string -> + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 +val unescaped : string -> string diff --git a/interfaces/5.5/seq.mli b/interfaces/5.5/seq.mli new file mode 100644 index 0000000..d5462a4 --- /dev/null +++ b/interfaces/5.5/seq.mli @@ -0,0 +1,66 @@ +type 'a t = unit -> 'a node +and 'a node = + | Nil + | Cons of 'a * 'a t +val is_empty : 'a t -> bool +val uncons : 'a t -> ('a * 'a t) option +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val iteri : (int -> 'a -> unit) -> 'a t -> unit +val fold_lefti : ('acc -> int -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val for_all : ('a -> bool) -> 'a t -> bool +val exists : ('a -> bool) -> 'a t -> bool +val find : ('a -> bool) -> 'a t -> 'a option +val find_index : ('a -> bool) -> 'a t -> int option +val find_map : ('a -> 'b option) -> 'a t -> 'b option +val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option +val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit +val fold_left2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc +val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool +val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int +val empty : 'a t +val return : 'a -> 'a t +val cons : 'a -> 'a t -> 'a t +val singleton : 'a -> 'a t +val init : int -> (int -> 'a) -> 'a t +val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t +val repeat : 'a -> 'a t +val forever : (unit -> 'a) -> 'a t +val cycle : 'a t -> 'a t +val iterate : ('a -> 'a) -> 'a -> 'a t +val delay : (unit -> 'a t) -> 'a t +val map : ('a -> 'b) -> 'a t -> 'b t +val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t +val filter : ('a -> bool) -> 'a t -> 'a t +val filteri : (int -> 'a -> bool) -> 'a t -> 'a t +val filter_map : ('a -> 'b option) -> 'a t -> 'b t +val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t +val take : int -> 'a t -> 'a t +val drop : int -> 'a t -> 'a t +val take_while : ('a -> bool) -> 'a t -> 'a t +val drop_while : ('a -> bool) -> 'a t -> 'a t +val group : ('a -> 'a -> bool) -> 'a t -> 'a t t +val memoize : 'a t -> 'a t +exception Forced_twice +val once : 'a t -> 'a t +val transpose : 'a t t -> 'a t t +val append : 'a t -> 'a t -> 'a t +val concat : 'a t t -> 'a t +val flat_map : ('a -> 'b t) -> 'a t -> 'b t +val concat_map : ('a -> 'b t) -> 'a t -> 'b t +val zip : 'a t -> 'b t -> ('a * 'b) t +val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t +val interleave : 'a t -> 'a t -> 'a t +val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t +val product : 'a t -> 'b t -> ('a * 'b) t +val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t +val unzip : ('a * 'b) t -> ('a t * 'b t) +val split : ('a * 'b) t -> ('a t * 'b t) +val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> ('b t * 'c t) +val partition : ('a -> bool) -> 'a t -> ('a t * 'a t) +val of_dispenser : (unit -> 'a option) -> 'a t +val to_dispenser : 'a t -> unit -> 'a option +val ints : int -> int t diff --git a/interfaces/5.5/set.mli b/interfaces/5.5/set.mli new file mode 100644 index 0000000..83ea1fa --- /dev/null +++ b/interfaces/5.5/set.mli @@ -0,0 +1,100 @@ +module type OrderedType = sig type t val compare : t -> t -> int end +module type S = + sig + type elt + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : (elt -> bool) -> t -> elt + val find_first_opt : (elt -> bool) -> t -> elt option + val find_last : (elt -> bool) -> t -> elt + val find_last_opt : (elt -> bool) -> t -> elt option + val iter : (elt -> unit) -> t -> unit + val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val map : (elt -> elt) -> t -> t + val filter : (elt -> bool) -> t -> t + val filter_map : (elt -> elt option) -> t -> t + val partition : (elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val is_singleton : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : (elt -> bool) -> t -> bool + val exists : (elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end +module Make : +(Ord : OrderedType) -> + sig + type elt = Ord.t + type t + val empty : t + val add : elt -> t -> t + val singleton : elt -> t + val remove : elt -> t -> t + val union : t -> t -> t + val inter : t -> t -> t + val disjoint : t -> t -> bool + val diff : t -> t -> t + val cardinal : t -> int + val elements : t -> elt list + val min_elt : t -> elt + val min_elt_opt : t -> elt option + val max_elt : t -> elt + val max_elt_opt : t -> elt option + val choose : t -> elt + val choose_opt : t -> elt option + val find : elt -> t -> elt + val find_opt : elt -> t -> elt option + val find_first : (elt -> bool) -> t -> elt + val find_first_opt : (elt -> bool) -> t -> elt option + val find_last : (elt -> bool) -> t -> elt + val find_last_opt : (elt -> bool) -> t -> elt option + val iter : (elt -> unit) -> t -> unit + val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val map : (elt -> elt) -> t -> t + val filter : (elt -> bool) -> t -> t + val filter_map : (elt -> elt option) -> t -> t + val partition : (elt -> bool) -> t -> (t * t) + val split : elt -> t -> (t * bool * t) + val is_empty : t -> bool + val is_singleton : t -> bool + val mem : elt -> t -> bool + val equal : t -> t -> bool + val compare : t -> t -> int + val subset : t -> t -> bool + val for_all : (elt -> bool) -> t -> bool + val exists : (elt -> bool) -> t -> bool + val to_list : t -> elt list + val of_list : elt list -> t + val to_seq_from : elt -> t -> elt Seq.t + val to_seq : t -> elt Seq.t + val to_rev_seq : t -> elt Seq.t + val add_seq : elt Seq.t -> t -> t + val of_seq : elt Seq.t -> t + end diff --git a/interfaces/5.5/stack.mli b/interfaces/5.5/stack.mli new file mode 100644 index 0000000..a0d39d1 --- /dev/null +++ b/interfaces/5.5/stack.mli @@ -0,0 +1,18 @@ +type !'a t +exception Empty +val create : unit -> 'a t +val push : 'a -> 'a t -> unit +val pop : 'a t -> 'a +val pop_opt : 'a t -> 'a option +val drop : 'a t -> unit +val top : 'a t -> 'a +val top_opt : 'a t -> 'a option +val clear : 'a t -> unit +val copy : 'a t -> 'a t +val is_empty : 'a t -> bool +val length : 'a t -> int +val iter : ('a -> unit) -> 'a t -> unit +val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc +val to_seq : 'a t -> 'a Seq.t +val add_seq : 'a t -> 'a Seq.t -> unit +val of_seq : 'a Seq.t -> 'a t diff --git a/interfaces/5.5/stdLabels.mli b/interfaces/5.5/stdLabels.mli new file mode 100644 index 0000000..d86b996 --- /dev/null +++ b/interfaces/5.5/stdLabels.mli @@ -0,0 +1,4 @@ +module Array = ArrayLabels +module Bytes = BytesLabels +module List = ListLabels +module String = StringLabels diff --git a/interfaces/5.5/stdlib.mli b/interfaces/5.5/stdlib.mli new file mode 100644 index 0000000..85d382e --- /dev/null +++ b/interfaces/5.5/stdlib.mli @@ -0,0 +1,331 @@ +external raise : exn -> 'a = "%raise" +external raise_notrace : exn -> 'a = "%raise_notrace" +val invalid_arg : string -> 'a +val failwith : string -> 'a +exception Exit +exception Match_failure of (string * int * int) +exception Assert_failure of (string * int * int) +exception Invalid_argument of string +exception Failure of string +exception Not_found +exception Out_of_memory +exception Stack_overflow +exception Sys_error of string +exception End_of_file +exception Division_by_zero +exception Sys_blocked_io +exception Undefined_recursive_module of (string * int * int) +external (=) : 'a -> 'a -> bool = "%equal" +external (<>) : 'a -> 'a -> bool = "%notequal" +external (<) : 'a -> 'a -> bool = "%lessthan" +external (>) : 'a -> 'a -> bool = "%greaterthan" +external (<=) : 'a -> 'a -> bool = "%lessequal" +external (>=) : 'a -> 'a -> bool = "%greaterequal" +external compare : 'a -> 'a -> int = "%compare" +val min : 'a -> 'a -> 'a +val max : 'a -> 'a -> 'a +external (==) : 'a -> 'a -> bool = "%eq" +external (!=) : 'a -> 'a -> bool = "%noteq" +external not : bool -> bool = "%boolnot" +external (&&) : bool -> bool -> bool = "%sequand" +external (||) : bool -> bool -> bool = "%sequor" +external __LOC__ : string = "%loc_LOC" +external __FILE__ : string = "%loc_FILE" +external __LINE__ : int = "%loc_LINE" +external __MODULE__ : string = "%loc_MODULE" +external __POS__ : (string * int * int * int) = "%loc_POS" +external __FUNCTION__ : string = "%loc_FUNCTION" +external __LOC_OF__ : 'a -> (string * 'a) = "%loc_LOC" +external __LINE_OF__ : 'a -> (int * 'a) = "%loc_LINE" +external __POS_OF__ : 'a -> ((string * int * int * int) * 'a) = "%loc_POS" +external (|>) : 'a -> ('a -> 'b) -> 'b = "%revapply" +external (@@) : ('a -> 'b) -> 'a -> 'b = "%apply" +external (~-) : int -> int = "%negint" +external (~+) : int -> int = "%identity" +external succ : int -> int = "%succint" +external pred : int -> int = "%predint" +external (+) : int -> int -> int = "%addint" +external (-) : int -> int -> int = "%subint" +external ( * ) : int -> int -> int = "%mulint" +external (/) : int -> int -> int = "%divint" +external \#mod : int -> int -> int = "%modint" +val abs : int -> int +val max_int : int +val min_int : int +external \#land : int -> int -> int = "%andint" +external \#lor : int -> int -> int = "%orint" +external \#lxor : int -> int -> int = "%xorint" +val lnot : int -> int +external \#lsl : int -> int -> int = "%lslint" +external \#lsr : int -> int -> int = "%lsrint" +external \#asr : int -> int -> int = "%asrint" +external (~-.) : float -> float = "%negfloat" +external (~+.) : float -> float = "%identity" +external (+.) : float -> float -> float = "%addfloat" +external (-.) : float -> float -> float = "%subfloat" +external ( *. ) : float -> float -> float = "%mulfloat" +external (/.) : float -> float -> float = "%divfloat" +external ( ** ) : float -> float -> float = "caml_power_float" "pow"[@@unboxed + ] +[@@noalloc ] +external sqrt : float -> float = "caml_sqrt_float" "sqrt"[@@unboxed ] +[@@noalloc ] +external exp : float -> float = "caml_exp_float" "exp"[@@unboxed ][@@noalloc + ] +external log : float -> float = "caml_log_float" "log"[@@unboxed ][@@noalloc + ] +external log10 : float -> float = "caml_log10_float" "log10"[@@unboxed ] +[@@noalloc ] +external expm1 : float -> float = "caml_expm1_float" "caml_expm1"[@@unboxed ] +[@@noalloc ] +external log1p : float -> float = "caml_log1p_float" "caml_log1p"[@@unboxed ] +[@@noalloc ] +external cos : float -> float = "caml_cos_float" "cos"[@@unboxed ][@@noalloc + ] +external sin : float -> float = "caml_sin_float" "sin"[@@unboxed ][@@noalloc + ] +external tan : float -> float = "caml_tan_float" "tan"[@@unboxed ][@@noalloc + ] +external acos : float -> float = "caml_acos_float" "acos"[@@unboxed ] +[@@noalloc ] +external asin : float -> float = "caml_asin_float" "asin"[@@unboxed ] +[@@noalloc ] +external atan : float -> float = "caml_atan_float" "atan"[@@unboxed ] +[@@noalloc ] +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" +[@@unboxed ][@@noalloc ] +external hypot : float -> float -> float = "caml_hypot_float" "caml_hypot" +[@@unboxed ][@@noalloc ] +external cosh : float -> float = "caml_cosh_float" "cosh"[@@unboxed ] +[@@noalloc ] +external sinh : float -> float = "caml_sinh_float" "sinh"[@@unboxed ] +[@@noalloc ] +external tanh : float -> float = "caml_tanh_float" "tanh"[@@unboxed ] +[@@noalloc ] +external acosh : float -> float = "caml_acosh_float" "caml_acosh"[@@unboxed ] +[@@noalloc ] +external asinh : float -> float = "caml_asinh_float" "caml_asinh"[@@unboxed ] +[@@noalloc ] +external atanh : float -> float = "caml_atanh_float" "caml_atanh"[@@unboxed ] +[@@noalloc ] +external ceil : float -> float = "caml_ceil_float" "ceil"[@@unboxed ] +[@@noalloc ] +external floor : float -> float = "caml_floor_float" "floor"[@@unboxed ] +[@@noalloc ] +external abs_float : float -> float = "%absfloat" +external copysign : + float -> float -> float = "caml_copysign_float" "caml_copysign"[@@unboxed ] +[@@noalloc ] +external mod_float : float -> float -> float = "caml_fmod_float" "fmod" +[@@unboxed ][@@noalloc ] +external frexp : float -> (float * int) = "caml_frexp_float" +external ldexp : + ((float)[@unboxed ]) -> ((int)[@untagged ]) -> ((float)[@unboxed ]) = + "caml_ldexp_float" "caml_ldexp_float_unboxed"[@@noalloc ] +external modf : float -> (float * float) = "caml_modf_float" +external float : int -> float = "%floatofint" +external float_of_int : int -> float = "%floatofint" +external truncate : float -> int = "%intoffloat" +external int_of_float : float -> int = "%intoffloat" +val infinity : float +val neg_infinity : float +val nan : float +val max_float : float +val min_float : float +val epsilon_float : float +type fpclass = + | FP_normal + | FP_subnormal + | FP_zero + | FP_infinite + | FP_nan +external classify_float : + ((float)[@unboxed ]) -> fpclass = "caml_classify_float" + "caml_classify_float_unboxed"[@@noalloc ] +val (^) : string -> string -> string +external int_of_char : char -> int = "%identity" +val char_of_int : int -> char +external ignore : 'a -> unit = "%ignore" +val string_of_bool : bool -> string +val bool_of_string_opt : string -> bool option +val bool_of_string : string -> bool +val string_of_int : int -> string +val int_of_string_opt : string -> int option +external int_of_string : string -> int = "caml_int_of_string" +val string_of_float : float -> string +val float_of_string_opt : string -> float option +external float_of_string : string -> float = "caml_float_of_string" +external fst : ('a * 'b) -> 'a = "%field0" +external snd : ('a * 'b) -> 'b = "%field1" +val (@) : 'a list -> 'a list -> 'a list +type in_channel +type out_channel +val stdin : in_channel +val stdout : out_channel +val stderr : out_channel +val print_char : char -> unit +val print_string : string -> unit +val print_bytes : bytes -> unit +val print_int : int -> unit +val print_float : float -> unit +val print_endline : string -> unit +val print_newline : unit -> unit +val prerr_char : char -> unit +val prerr_string : string -> unit +val prerr_bytes : bytes -> unit +val prerr_int : int -> unit +val prerr_float : float -> unit +val prerr_endline : string -> unit +val prerr_newline : unit -> unit +val read_line : unit -> string +val read_int_opt : unit -> int option +val read_int : unit -> int +val read_float_opt : unit -> float option +val read_float : unit -> float +type open_flag = + | Open_rdonly + | Open_wronly + | Open_append + | Open_creat + | Open_trunc + | Open_excl + | Open_binary + | Open_text + | Open_nonblock +val open_out : string -> out_channel +val open_out_bin : string -> out_channel +val open_out_gen : open_flag list -> int -> string -> out_channel +val flush : out_channel -> unit +val flush_all : unit -> unit +val output_char : out_channel -> char -> unit +val output_string : out_channel -> string -> unit +val output_bytes : out_channel -> bytes -> unit +val output : out_channel -> bytes -> int -> int -> unit +val output_substring : out_channel -> string -> int -> int -> unit +val output_byte : out_channel -> int -> unit +val output_binary_int : out_channel -> int -> unit +val output_value : out_channel -> 'a -> unit +val seek_out : out_channel -> int -> unit +val pos_out : out_channel -> int +val out_channel_length : out_channel -> int +val close_out : out_channel -> unit +val close_out_noerr : out_channel -> unit +val set_binary_mode_out : out_channel -> bool -> unit +val open_in : string -> in_channel +val open_in_bin : string -> in_channel +val open_in_gen : open_flag list -> int -> string -> in_channel +val input_char : in_channel -> char +val input_line : in_channel -> string +val input : in_channel -> bytes -> int -> int -> int +val really_input : in_channel -> bytes -> int -> int -> unit +val really_input_string : in_channel -> int -> string +val input_byte : in_channel -> int +val input_binary_int : in_channel -> int +val input_value : in_channel -> 'a +val seek_in : in_channel -> int -> unit +val pos_in : in_channel -> int +val in_channel_length : in_channel -> int +val close_in : in_channel -> unit +val close_in_noerr : in_channel -> unit +val set_binary_mode_in : in_channel -> bool -> unit +module LargeFile : +sig + val seek_out : out_channel -> int64 -> unit + val pos_out : out_channel -> int64 + val out_channel_length : out_channel -> int64 + val seek_in : in_channel -> int64 -> unit + val pos_in : in_channel -> int64 + val in_channel_length : in_channel -> int64 +end +type 'a ref = { + mutable contents: 'a } +external ref : 'a -> 'a ref = "%makemutable" +external (!) : 'a ref -> 'a = "%field0" +external (:=) : 'a ref -> 'a -> unit = "%setfield0" +external incr : int ref -> unit = "%incr" +external decr : int ref -> unit = "%decr" +type ('a, 'b) result = + | Ok of 'a + | Error of 'b +type ('a, 'b, 'c, 'd, 'e, 'f) format6 = + ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6 +type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6 +type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4 +val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string +external format_of_string : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 = + "%identity" +val (^^) : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> + ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6 +val exit : int -> 'a +val at_exit : (unit -> unit) -> unit +val valid_float_lexem : string -> string +val unsafe_really_input : in_channel -> bytes -> int -> int -> unit +val do_at_exit : unit -> unit +val do_domain_local_at_exit : (unit -> unit) ref +module Arg = Arg +module Array = Array +module ArrayLabels = ArrayLabels +module Atomic = Atomic +module Bigarray = Bigarray +module Bool = Bool +module Buffer = Buffer +module Bytes = Bytes +module BytesLabels = BytesLabels +module Callback = Callback +module Char = Char +module Complex = Complex +module Condition = Condition +module Digest = Digest +module Domain = Domain +module Dynarray = Dynarray +module Pqueue = Pqueue +module Effect = Effect +module Either = Either +module Ephemeron = Ephemeron +module Filename = Filename +module Float = Float +module Format = Format +module Fun = Fun +module Gc = Gc +module Hashtbl = Hashtbl +module Iarray = Iarray +module In_channel = In_channel +module Int = Int +module Int32 = Int32 +module Int64 = Int64 +module Lazy = Lazy +module Lexing = Lexing +module List = List +module ListLabels = ListLabels +module Map = Map +module Marshal = Marshal +module MoreLabels = MoreLabels +module Mutex = Mutex +module Nativeint = Nativeint +module Obj = Obj +module Oo = Oo +module Option = Option +module Out_channel = Out_channel +module Pair = Pair +module Parsing = Parsing +module Printexc = Printexc +module Printf = Printf +module Queue = Queue +module Random = Random +module Result = Result +module Repr = Repr +module Scanf = Scanf +module Semaphore = Semaphore +module Seq = Seq +module Set = Set +module Stack = Stack +module StdLabels = StdLabels +module String = String +module StringLabels = StringLabels +module Sys = Sys +module Type = Type +module Uchar = Uchar +module Unit = Unit +module Weak = Weak diff --git a/interfaces/5.5/string.mli b/interfaces/5.5/string.mli new file mode 100644 index 0000000..b333b16 --- /dev/null +++ b/interfaces/5.5/string.mli @@ -0,0 +1,106 @@ +type t = string +val make : int -> char -> string +val init : int -> (int -> char) -> string +val empty : string +external length : string -> int = "%string_length" +external get : string -> int -> char = "%string_safe_get" +val of_char : char -> string +val of_bytes : bytes -> string +val to_bytes : string -> bytes +val blit : string -> int -> bytes -> int -> int -> unit +val concat : string -> string list -> string +val cat : string -> string -> string +val equal : t -> t -> bool +val compare : t -> t -> int +val is_empty : string -> bool +val starts_with : prefix:string -> string -> bool +val ends_with : suffix:string -> string -> bool +val includes : affix:string -> string -> bool +val contains_from : string -> int -> char -> bool +val rcontains_from : string -> int -> char -> bool +val contains : string -> char -> bool +val sub : string -> int -> int -> string +val take_first : int -> string -> string +val take_last : int -> string -> string +val drop_first : int -> string -> string +val drop_last : int -> string -> string +val cut_first : int -> string -> (string * string) +val cut_last : int -> string -> (string * string) +val take_first_while : (char -> bool) -> string -> string +val take_last_while : (char -> bool) -> string -> string +val drop_first_while : (char -> bool) -> string -> string +val drop_last_while : (char -> bool) -> string -> string +val cut_first_while : (char -> bool) -> string -> (string * string) +val cut_last_while : (char -> bool) -> string -> (string * string) +val split_first : sep:string -> string -> (string * string) option +val split_last : sep:string -> string -> (string * string) option +val split_all : sep:string -> ?drop:(string -> bool) -> string -> string list +val rsplit_all : + sep:string -> ?drop:(string -> bool) -> string -> string list +val split_on_char : char -> string -> string list +val map : (char -> char) -> string -> string +val mapi : (int -> char -> char) -> string -> string +val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc +val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc +val for_all : (char -> bool) -> string -> bool +val exists : (char -> bool) -> string -> bool +val trim : string -> string +val escaped : string -> string +val uppercase_ascii : string -> string +val lowercase_ascii : string -> string +val capitalize_ascii : string -> string +val uncapitalize_ascii : string -> string +val iter : (char -> unit) -> string -> unit +val iteri : (int -> char -> unit) -> string -> unit +val find_first_index : (char -> bool) -> ?start:int -> string -> int option +val find_last_index : (char -> bool) -> ?start:int -> string -> int option +val index_from : string -> int -> char -> int +val index_from_opt : string -> int -> char -> int option +val rindex_from : string -> int -> char -> int +val rindex_from_opt : string -> int -> char -> int option +val index : string -> char -> int +val index_opt : string -> char -> int option +val rindex : string -> char -> int +val rindex_opt : string -> char -> int option +val find_first : sub:string -> ?start:int -> string -> int option +val find_last : sub:string -> ?start:int -> string -> int option +val find_all : + sub:string -> (int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc +val rfind_all : + sub:string -> (int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc +val replace_first : sub:string -> by:string -> ?start:int -> string -> string +val replace_last : sub:string -> by:string -> ?start:int -> string -> string +val replace_all : sub:string -> by:string -> ?start:int -> string -> string +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16le : t -> bool +val edit_distance : ?limit:int -> t -> t -> int +val spellcheck : + ?max_dist:(string -> int) -> + ((string -> unit) -> unit) -> string -> string list +val get_uint8 : string -> int -> int +val get_int8 : string -> int -> int +val get_uint16_ne : string -> int -> int +val get_uint16_be : string -> int -> int +val get_uint16_le : string -> int -> int +val get_int16_ne : string -> int -> int +val get_int16_be : string -> int -> int +val get_int16_le : string -> int -> int +val get_int32_ne : string -> int -> int32 +val hash : t -> int +val seeded_hash : int -> t -> int +val get_int32_be : string -> int -> int32 +val get_int32_le : string -> int -> int32 +val get_int64_ne : string -> int -> int64 +val get_int64_be : string -> int -> int64 +val get_int64_le : string -> int -> int64 +external unsafe_get : string -> int -> char = "%string_unsafe_get" +external unsafe_blit : + string -> int -> bytes -> int -> int -> unit = "caml_blit_string"[@@noalloc + ] diff --git a/interfaces/5.5/stringLabels.mli b/interfaces/5.5/stringLabels.mli new file mode 100644 index 0000000..b6c883f --- /dev/null +++ b/interfaces/5.5/stringLabels.mli @@ -0,0 +1,109 @@ +type t = string +val make : int -> char -> string +val init : int -> f:(int -> char) -> string +val empty : string +external length : string -> int = "%string_length" +external get : string -> int -> char = "%string_safe_get" +val of_char : char -> string +val of_bytes : bytes -> string +val to_bytes : string -> bytes +val blit : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit +val concat : sep:string -> string list -> string +val cat : string -> string -> string +val equal : t -> t -> bool +val compare : t -> t -> int +val is_empty : string -> bool +val starts_with : prefix:string -> string -> bool +val ends_with : suffix:string -> string -> bool +val includes : affix:string -> string -> bool +val contains_from : string -> int -> char -> bool +val rcontains_from : string -> int -> char -> bool +val contains : string -> char -> bool +val sub : string -> pos:int -> len:int -> string +val take_first : int -> string -> string +val take_last : int -> string -> string +val drop_first : int -> string -> string +val drop_last : int -> string -> string +val cut_first : int -> string -> (string * string) +val cut_last : int -> string -> (string * string) +val take_first_while : (char -> bool) -> string -> string +val take_last_while : (char -> bool) -> string -> string +val drop_first_while : (char -> bool) -> string -> string +val drop_last_while : (char -> bool) -> string -> string +val cut_first_while : (char -> bool) -> string -> (string * string) +val cut_last_while : (char -> bool) -> string -> (string * string) +val split_first : sep:string -> string -> (string * string) option +val split_last : sep:string -> string -> (string * string) option +val split_all : sep:string -> ?drop:(string -> bool) -> string -> string list +val rsplit_all : + sep:string -> ?drop:(string -> bool) -> string -> string list +val split_on_char : sep:char -> string -> string list +val map : f:(char -> char) -> string -> string +val mapi : f:(int -> char -> char) -> string -> string +val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> string -> 'acc +val fold_right : f:(char -> 'acc -> 'acc) -> string -> init:'acc -> 'acc +val for_all : f:(char -> bool) -> string -> bool +val exists : f:(char -> bool) -> string -> bool +val trim : string -> string +val escaped : string -> string +val uppercase_ascii : string -> string +val lowercase_ascii : string -> string +val capitalize_ascii : string -> string +val uncapitalize_ascii : string -> string +val iter : f:(char -> unit) -> string -> unit +val iteri : f:(int -> char -> unit) -> string -> unit +val find_first_index : (char -> bool) -> ?start:int -> string -> int option +val find_last_index : (char -> bool) -> ?start:int -> string -> int option +val index_from : string -> int -> char -> int +val index_from_opt : string -> int -> char -> int option +val rindex_from : string -> int -> char -> int +val rindex_from_opt : string -> int -> char -> int option +val index : string -> char -> int +val index_opt : string -> char -> int option +val rindex : string -> char -> int +val rindex_opt : string -> char -> int option +val find_first : sub:string -> ?start:int -> string -> int option +val find_last : sub:string -> ?start:int -> string -> int option +val find_all : + sub:string -> + f:(int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc +val rfind_all : + sub:string -> + f:(int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc +val replace_first : sub:string -> by:string -> ?start:int -> string -> string +val replace_last : sub:string -> by:string -> ?start:int -> string -> string +val replace_all : sub:string -> by:string -> ?start:int -> string -> string +val to_seq : t -> char Seq.t +val to_seqi : t -> (int * char) Seq.t +val of_seq : char Seq.t -> t +val get_utf_8_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_8 : t -> bool +val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16be : t -> bool +val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +val is_valid_utf_16le : t -> bool +val edit_distance : ?limit:int -> t -> t -> int +val spellcheck : + ?max_dist:(string -> int) -> + ((string -> unit) -> unit) -> string -> string list +val get_uint8 : string -> int -> int +val get_int8 : string -> int -> int +val get_uint16_ne : string -> int -> int +val get_uint16_be : string -> int -> int +val get_uint16_le : string -> int -> int +val get_int16_ne : string -> int -> int +val get_int16_be : string -> int -> int +val get_int16_le : string -> int -> int +val get_int32_ne : string -> int -> int32 +val hash : t -> int +val seeded_hash : int -> t -> int +val get_int32_be : string -> int -> int32 +val get_int32_le : string -> int -> int32 +val get_int64_ne : string -> int -> int64 +val get_int64_be : string -> int -> int64 +val get_int64_le : string -> int -> int64 +external unsafe_get : string -> int -> char = "%string_unsafe_get" +external unsafe_blit : + src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> unit = + "caml_blit_string"[@@noalloc ] diff --git a/interfaces/5.5/sys.mli b/interfaces/5.5/sys.mli new file mode 100644 index 0000000..f1ad84a --- /dev/null +++ b/interfaces/5.5/sys.mli @@ -0,0 +1,114 @@ +external argv : string array = "%sys_argv" +val executable_name : string +val runtime_executable : string +external file_exists : string -> bool = "caml_sys_file_exists" +external is_directory : string -> bool = "caml_sys_is_directory" +external is_regular_file : string -> bool = "caml_sys_is_regular_file" +external remove : string -> unit = "caml_sys_remove" +external rename : string -> string -> unit = "caml_sys_rename" +external getenv : string -> string = "caml_sys_getenv" +val getenv_opt : string -> string option +external command : string -> int = "caml_sys_system_command" +external time : + unit -> ((float)[@unboxed ]) = "caml_sys_time" "caml_sys_time_unboxed" +[@@noalloc ] +external chdir : string -> unit = "caml_sys_chdir" +external mkdir : string -> int -> unit = "caml_sys_mkdir" +external rmdir : string -> unit = "caml_sys_rmdir" +external getcwd : unit -> string = "caml_sys_getcwd" +external readdir : string -> string array = "caml_sys_read_directory" +val io_buffer_size : int +val interactive : bool ref +val os_type : string +type backend_type = + | Native + | Bytecode + | Other of string +val backend_type : backend_type +val unix : bool +val win32 : bool +val cygwin : bool +val word_size : int +val int_size : int +val big_endian : bool +val max_string_length : int +val max_array_length : int +val max_floatarray_length : int +external runtime_variant : unit -> string = "caml_runtime_variant" +external runtime_parameters : unit -> string = "caml_runtime_parameters" +external poll_actions : unit -> unit = "%poll" +type signal = int +type signal_behavior = + | Signal_default + | Signal_ignore + | Signal_handle of (signal -> unit) +external signal : + signal -> signal_behavior -> signal_behavior = + "caml_install_signal_handler" +val set_signal : signal -> signal_behavior -> unit +val sigabrt : signal +val sigalrm : signal +val sigfpe : signal +val sighup : signal +val sigill : signal +val sigint : signal +val sigkill : signal +val sigpipe : signal +val sigquit : signal +val sigsegv : signal +val sigterm : signal +val sigusr1 : signal +val sigusr2 : signal +val sigchld : signal +val sigcont : signal +val sigstop : signal +val sigtstp : signal +val sigttin : signal +val sigttou : signal +val sigvtalrm : signal +val sigprof : signal +val sigbus : signal +val sigpoll : signal +val sigsys : signal +val sigtrap : signal +val sigurg : signal +val sigxcpu : signal +val sigxfsz : signal +val sigio : signal +val sigwinch : signal +val signal_to_string : signal -> string +val signal_of_int : int -> signal +val signal_to_int : signal -> int +exception Break +val catch_break : bool -> unit +val ocaml_version : string +val development_version : bool +type extra_prefix = + | Plus + | Tilde +type extra_info = (extra_prefix * string) +type ocaml_release_info = + { + major: int ; + minor: int ; + patchlevel: int ; + extra: extra_info option } +val ocaml_release : ocaml_release_info +val enable_runtime_warnings : bool -> unit +val runtime_warnings_enabled : unit -> bool +external opaque_identity : 'a -> 'a = "%opaque" +module Immediate64 : +sig + module type Non_immediate = sig type t end + module type Immediate = sig type t[@@immediate ] end + module Make : + (Immediate : Immediate) -> + (Non_immediate : Non_immediate) -> + sig + type t[@@immediate64 ] + type 'a repr = + | Immediate: Immediate.t repr + | Non_immediate: Non_immediate.t repr + val repr : t repr + end +end diff --git a/interfaces/5.5/uchar.mli b/interfaces/5.5/uchar.mli new file mode 100644 index 0000000..d4058aa --- /dev/null +++ b/interfaces/5.5/uchar.mli @@ -0,0 +1,29 @@ +type t[@@immediate ] +val min : t +val max : t +val bom : t +val rep : t +val succ : t -> t +val pred : t -> t +val is_valid : int -> bool +val of_int : int -> t +val unsafe_of_int : int -> t +val to_int : t -> int +val is_char : t -> bool +val of_char : char -> t +val to_char : t -> char +val unsafe_to_char : t -> char +val equal : t -> t -> bool +val compare : t -> t -> int +val seeded_hash : int -> t -> int +val hash : t -> int +type utf_decode[@@immediate ] +val utf_decode_is_valid : utf_decode -> bool +val utf_decode_uchar : utf_decode -> t +val utf_decode_length : utf_decode -> int +val utf_decode : int -> t -> utf_decode +val utf_decode_invalid : int -> utf_decode +val utf_8_decode_length_of_byte : char -> int +val max_utf_8_decode_length : int +val utf_8_byte_length : t -> int +val utf_16_byte_length : t -> int diff --git a/interfaces/5.5/unit.mli b/interfaces/5.5/unit.mli new file mode 100644 index 0000000..1efbc15 --- /dev/null +++ b/interfaces/5.5/unit.mli @@ -0,0 +1,5 @@ +type t = unit = + | () +val equal : t -> t -> bool +val compare : t -> t -> int +val to_string : t -> string diff --git a/interfaces/5.5/weak.mli b/interfaces/5.5/weak.mli new file mode 100644 index 0000000..15fe75a --- /dev/null +++ b/interfaces/5.5/weak.mli @@ -0,0 +1,46 @@ +type !'a t +val create : int -> 'a t +val length : 'a t -> int +val set : 'a t -> int -> 'a option -> unit +val get : 'a t -> int -> 'a option +val get_copy : 'a t -> int -> 'a option +val check : 'a t -> int -> bool +val fill : 'a t -> int -> int -> 'a option -> unit +val blit : 'a t -> int -> 'a t -> int -> int -> unit +module type S = + sig + type data + type t + val create : int -> t + val clear : t -> unit + val merge : t -> data -> data + val add : t -> data -> unit + val remove : t -> data -> unit + val find : t -> data -> data + val find_opt : t -> data -> data option + val find_all : t -> data -> data list + val mem : t -> data -> bool + val iter : (data -> unit) -> t -> unit + val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val count : t -> int + val stats : t -> (int * int * int * int * int * int) + end +module Make : +(H : Hashtbl.HashedType) -> + sig + type data = H.t + type t + val create : int -> t + val clear : t -> unit + val merge : t -> data -> data + val add : t -> data -> unit + val remove : t -> data -> unit + val find : t -> data -> data + val find_opt : t -> data -> data option + val find_all : t -> data -> data list + val mem : t -> data -> bool + val iter : (data -> unit) -> t -> unit + val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc + val count : t -> int + val stats : t -> (int * int * int * int * int * int) + end From 8bbec2b9ecca6e9c3583eb9d812ca94163047831 Mon Sep 17 00:00:00 2001 From: Thierry Martinez Date: Wed, 12 Aug 2026 12:59:31 +0200 Subject: [PATCH 3/4] Update shims for OCaml 5.4 and 5.5 --- CHANGES.md | 4 + Makefile.am | 22 +- Makefile.in | 155 ++++-- aclocal.m4 | 72 ++- configure | 234 ++++++++- configure.ac | 4 + dune | 8 +- dune-rules.inc | 16 + stdcompat.opam | 4 +- stdcompat__array.ml.in | 390 +++++++++++--- stdcompat__array_s.mli.in | 95 ++-- stdcompat__atomic.ml.in | 14 + stdcompat__atomic_s.mli.in | 14 + stdcompat__bool.ml.in | 8 + stdcompat__bool_s.mli.in | 9 + stdcompat__buffer_s.mli.in | 126 ++--- stdcompat__bytes_s.mli.in | 140 ++--- stdcompat__char.ml.in | 64 +++ stdcompat__char_s.mli.in | 26 +- stdcompat__domain.ml.in | 4 + stdcompat__domain_s.mli.in | 9 +- stdcompat__either.ml.in | 17 + stdcompat__either_s.mli.in | 9 + stdcompat__ephemeron_s.mli.in | 80 +-- stdcompat__float.ml.in | 98 ++-- stdcompat__float_s.mli.in | 34 +- stdcompat__format.ml.in | 88 +++- stdcompat__format_s.mli.in | 280 +++++++--- stdcompat__fun_s.mli.in | 15 +- stdcompat__generic_array.ml | 75 +++ stdcompat__generic_array.mli | 61 +++ stdcompat__generic_int.ml.in | 83 +++ stdcompat__generic_int.mli | 1 + stdcompat__generic_int_s.mli.in | 65 +++ stdcompat__hashtbl.ml.in | 61 ++- stdcompat__hashtbl_s.mli.in | 297 +++-------- stdcompat__in_channel_s.mli.in | 26 +- stdcompat__int.ml.in | 8 + stdcompat__int32.ml.in | 20 +- stdcompat__int32_s.mli.in | 30 ++ stdcompat__int64.ml.in | 20 +- stdcompat__int64_s.mli.in | 30 ++ stdcompat__int_s.mli.in | 29 + stdcompat__lazy.ml.in | 14 + stdcompat__lazy_s.mli.in | 21 +- stdcompat__list.ml.in | 26 + stdcompat__list_s.mli.in | 90 ++-- stdcompat__map.ml.in | 41 +- stdcompat__map_s.mli.in | 106 +--- stdcompat__moreLabels.ml.in | 24 +- stdcompat__moreLabels_s.mli.in | 82 +-- stdcompat__nativeint.ml.in | 20 +- stdcompat__nativeint_s.mli.in | 30 ++ stdcompat__option.ml.in | 31 ++ stdcompat__option_s.mli.in | 44 +- stdcompat__out_channel_s.mli.in | 13 +- stdcompat__printexc_s.mli.in | 8 +- stdcompat__printf.ml.in | 21 +- stdcompat__printf_s.mli.in | 148 ++++-- stdcompat__queue_s.mli.in | 47 +- stdcompat__random_s.mli.in | 118 +++-- stdcompat__result.ml.in | 29 + stdcompat__result_s.mli.in | 85 ++- stdcompat__seq.ml.in | 21 + stdcompat__seq_s.mli.in | 31 +- stdcompat__set.ml.in | 36 +- stdcompat__set_s.mli.in | 39 +- stdcompat__stack_s.mli.in | 95 +--- stdcompat__stdlib.ml.in | 10 +- stdcompat__stdlib_s.mli.in | 8 +- stdcompat__string.ml.in | 310 +++++++++++ stdcompat__string_s.mli.in | 228 ++++++-- stdcompat__sys.ml.in | 51 ++ stdcompat__sys_s.mli.in | 279 +++++----- stdcompat__uchar.ml.in | 17 + stdcompat__uchar_s.mli.in | 22 +- stdcompat__utf8.ml | 15 + stdcompat__utf8.mli | 1 + stdcompat__weak_s.mli.in | 10 +- stdcompat_tests.ml.in | 900 +++++++++++++++++++++++++++++++- 80 files changed, 4441 insertions(+), 1475 deletions(-) create mode 100644 stdcompat__generic_array.ml create mode 100644 stdcompat__generic_array.mli create mode 100644 stdcompat__generic_int.ml.in create mode 100644 stdcompat__generic_int.mli create mode 100644 stdcompat__generic_int_s.mli.in create mode 100644 stdcompat__utf8.ml create mode 100644 stdcompat__utf8.mli diff --git a/CHANGES.md b/CHANGES.md index 686a778..7a17f96 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +# Unreleased + +- Compatibility with OCaml 5.3, 5.4, and 5.5 + # Version 20 - Compatibility with OCaml 5.1 and 5.2 diff --git a/Makefile.am b/Makefile.am index 81f9f02..8a303ce 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,7 @@ EXTRA_DIST= stdcompat.opam dune stdcompat.ml stdcompat__native.ml_byte \ stdcompat__native.ml_native stdcompat_tests.ml stdcompat__native.mli \ stdcompat__pervasives.mli stdcompat__arg.mli stdcompat__lazy.mli \ stdcompat__char.mli stdcompat__uchar.mli stdcompat__sys.mli stdcompat__buffer.mli \ + stdcompat__utf8.mli \ stdcompat__string.mli stdcompat__stringLabels.mli stdcompat__bytes.mli \ stdcompat__bytesLabels.mli stdcompat__list.mli \ stdcompat__listLabels.mli \ @@ -11,8 +12,11 @@ EXTRA_DIST= stdcompat.opam dune stdcompat.ml stdcompat__native.ml_byte \ stdcompat__hashtbl.mli stdcompat__set.mli \ stdcompat__map.mli stdcompat__weak.mli \ stdcompat__digest.mli stdcompat__nativeint.mli \ + stdcompat__generic_int_s.mli \ + stdcompat__generic_int.mli \ stdcompat__int.mli \ stdcompat__int64.mli stdcompat__int32.mli stdcompat__filename.mli \ + stdcompat__generic_array.mli \ stdcompat__array.mli stdcompat__arrayLabels.mli \ stdcompat__float.mli stdcompat__queue.mli stdcompat__ephemeron.mli \ stdcompat__moreLabels.mli stdcompat__lexing.mli \ @@ -33,21 +37,25 @@ MODULES = stdcompat__init.ml stdcompat__root.ml \ stdcompat__pervasives_s.ml stdcompat__arg_s.ml stdcompat__lazy_s.ml \ stdcompat__char_s.ml stdcompat__uchar_s.ml stdcompat__uchar.ml \ stdcompat__buffer_s.ml \ - stdcompat__string_s.ml stdcompat__stringLabels_s.ml stdcompat__bytes_s.ml \ + stdcompat__bytes_s.ml \ stdcompat__bytesLabels_s.ml \ + stdcompat__string_s.ml stdcompat__stringLabels_s.ml \ stdcompat__list_s.ml \ stdcompat__listLabels_s.ml \ stdcompat__stack_s.ml \ stdcompat__list.ml \ - stdcompat__hashtbl_ext.ml stdcompat__hashtbl_s.ml stdcompat__set_s.ml \ + stdcompat__hashtbl_ext.ml stdcompat__hashtbl_s.ml stdcompat__hashtbl.ml \ + stdcompat__set_s.ml \ stdcompat__map_s.ml stdcompat__weak_s.ml stdcompat__sys_s.ml \ - stdcompat__digest_s.ml stdcompat__nativeint_s.ml \ + stdcompat__digest_s.ml \ + stdcompat__generic_int.ml \ + stdcompat__nativeint_s.ml \ stdcompat__int_s.ml \ stdcompat__int64_s.ml stdcompat__int32_s.ml stdcompat__filename_s.ml \ + stdcompat__generic_array.ml \ stdcompat__array_s.ml stdcompat__arrayLabels_s.ml \ stdcompat__dynarray_s.ml stdcompat__dynarray.ml \ stdcompat__float_s.ml stdcompat__queue_s.ml \ - stdcompat__hashtbl.ml \ stdcompat__ephemeron_s.ml \ stdcompat__moreLabels_s.ml stdcompat__lexing_s.ml \ stdcompat__pervasives.ml \ @@ -64,6 +72,8 @@ MODULES = stdcompat__init.ml stdcompat__root.ml \ stdcompat__option.ml \ stdcompat__buffer.ml stdcompat__sys.ml \ stdcompat__bytes.ml stdcompat__bytesLabels.ml \ + stdcompat__utf8.ml \ + stdcompat__int.ml \ stdcompat__string.ml stdcompat__stringLabels.ml \ stdcompat__filename.ml \ stdcompat__listLabels.ml \ @@ -71,7 +81,7 @@ MODULES = stdcompat__init.ml stdcompat__root.ml \ stdcompat__map.ml stdcompat__weak.ml \ stdcompat__random.ml \ stdcompat__digest.ml stdcompat__nativeint.ml \ - stdcompat__int.ml stdcompat__int64.ml stdcompat__int32.ml \ + stdcompat__int64.ml stdcompat__int32.ml \ stdcompat__array.ml stdcompat__arrayLabels.ml \ stdcompat__float.ml stdcompat__queue.ml stdcompat__ephemeron.ml \ stdcompat__moreLabels.ml stdcompat__lexing.ml \ @@ -174,6 +184,8 @@ stdcompat__native.cmo : stdcompat__native.ml_byte stdcompat__native.cmi stdcompat__native.cmx : stdcompat__native.ml_native stdcompat__native.cmi $(OCAMLOPT) $(OCAMLCFLAGS) -c -impl stdcompat__native.ml_native +stdcompat__generic_int.cmi: stdcompat__generic_int_s.cmi + .PHONY : depend depend : .depend diff --git a/Makefile.in b/Makefile.in index ae4875d..7916558 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. +# Makefile.in generated by automake 1.18.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2024 Free Software Foundation, Inc. +# Copyright (C) 1994-2025 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -119,42 +119,43 @@ CONFIG_CLEAN_FILES = META stdcompat__hashtbl_ext.mli \ stdcompat__either_s.mli stdcompat__ephemeron_s.mli \ stdcompat__filename_s.mli stdcompat__float_s.mli \ stdcompat__format_s.mli stdcompat__fun_s.mli \ - stdcompat__hashtbl_s.mli stdcompat__in_channel_s.mli \ - stdcompat__int_s.mli stdcompat__int32_s.mli \ - stdcompat__int64_s.mli stdcompat__lazy_s.mli \ - stdcompat__lexing_s.mli stdcompat__list_s.mli \ - stdcompat__listLabels_s.mli stdcompat__map_s.mli \ - stdcompat__moreLabels_s.mli stdcompat__nativeint_s.mli \ - stdcompat__option_s.mli stdcompat__out_channel_s.mli \ - stdcompat__printexc_s.mli stdcompat__printf_s.mli \ - stdcompat__queue_s.mli stdcompat__random_s.mli \ - stdcompat__result_s.mli stdcompat__seq_s.mli \ - stdcompat__set_s.mli stdcompat__stack_s.mli \ - stdcompat__string_s.mli stdcompat__stringLabels_s.mli \ - stdcompat__sys_s.mli stdcompat__uchar_s.mli \ - stdcompat__weak_s.mli stdcompat__unit_s.mli \ - stdcompat__stdlib_s.mli stdcompat__pervasives_s.ml \ - stdcompat__arg_s.ml stdcompat__array_s.ml \ - stdcompat__arrayLabels_s.ml stdcompat__atomic_s.ml \ - stdcompat__bool_s.ml stdcompat__buffer_s.ml \ - stdcompat__bytes_s.ml stdcompat__bytesLabels_s.ml \ - stdcompat__char_s.ml stdcompat__digest_s.ml \ - stdcompat__domain_s.ml stdcompat__dynarray_s.ml \ - stdcompat__either_s.ml stdcompat__ephemeron_s.ml \ - stdcompat__filename_s.ml stdcompat__float_s.ml \ - stdcompat__format_s.ml stdcompat__fun_s.ml \ - stdcompat__hashtbl_s.ml stdcompat__int_s.ml \ - stdcompat__int32_s.ml stdcompat__int64_s.ml \ - stdcompat__lazy_s.ml stdcompat__lexing_s.ml \ - stdcompat__list_s.ml stdcompat__listLabels_s.ml \ - stdcompat__map_s.ml stdcompat__moreLabels_s.ml \ - stdcompat__nativeint_s.ml stdcompat__option_s.ml \ - stdcompat__printexc_s.ml stdcompat__printf_s.ml \ - stdcompat__queue_s.ml stdcompat__random_s.ml \ - stdcompat__result_s.ml stdcompat__seq_s.ml stdcompat__set_s.ml \ - stdcompat__stack_s.ml stdcompat__stdlib_s.ml \ - stdcompat__string_s.ml stdcompat__stringLabels_s.ml \ - stdcompat__sys_s.ml stdcompat__uchar_s.ml stdcompat__weak_s.ml \ + stdcompat__generic_int_s.mli stdcompat__hashtbl_s.mli \ + stdcompat__in_channel_s.mli stdcompat__int_s.mli \ + stdcompat__int32_s.mli stdcompat__int64_s.mli \ + stdcompat__lazy_s.mli stdcompat__lexing_s.mli \ + stdcompat__list_s.mli stdcompat__listLabels_s.mli \ + stdcompat__map_s.mli stdcompat__moreLabels_s.mli \ + stdcompat__nativeint_s.mli stdcompat__option_s.mli \ + stdcompat__out_channel_s.mli stdcompat__printexc_s.mli \ + stdcompat__printf_s.mli stdcompat__queue_s.mli \ + stdcompat__random_s.mli stdcompat__result_s.mli \ + stdcompat__seq_s.mli stdcompat__set_s.mli \ + stdcompat__stack_s.mli stdcompat__string_s.mli \ + stdcompat__stringLabels_s.mli stdcompat__sys_s.mli \ + stdcompat__uchar_s.mli stdcompat__weak_s.mli \ + stdcompat__unit_s.mli stdcompat__stdlib_s.mli \ + stdcompat__pervasives_s.ml stdcompat__arg_s.ml \ + stdcompat__array_s.ml stdcompat__arrayLabels_s.ml \ + stdcompat__atomic_s.ml stdcompat__bool_s.ml \ + stdcompat__buffer_s.ml stdcompat__bytes_s.ml \ + stdcompat__bytesLabels_s.ml stdcompat__char_s.ml \ + stdcompat__digest_s.ml stdcompat__domain_s.ml \ + stdcompat__dynarray_s.ml stdcompat__either_s.ml \ + stdcompat__ephemeron_s.ml stdcompat__filename_s.ml \ + stdcompat__float_s.ml stdcompat__format_s.ml \ + stdcompat__fun_s.ml stdcompat__hashtbl_s.ml \ + stdcompat__int_s.ml stdcompat__int32_s.ml \ + stdcompat__int64_s.ml stdcompat__lazy_s.ml \ + stdcompat__lexing_s.ml stdcompat__list_s.ml \ + stdcompat__listLabels_s.ml stdcompat__map_s.ml \ + stdcompat__moreLabels_s.ml stdcompat__nativeint_s.ml \ + stdcompat__option_s.ml stdcompat__printexc_s.ml \ + stdcompat__printf_s.ml stdcompat__queue_s.ml \ + stdcompat__random_s.ml stdcompat__result_s.ml \ + stdcompat__seq_s.ml stdcompat__set_s.ml stdcompat__stack_s.ml \ + stdcompat__stdlib_s.ml stdcompat__string_s.ml \ + stdcompat__stringLabels_s.ml stdcompat__sys_s.ml \ + stdcompat__uchar_s.ml stdcompat__weak_s.ml \ stdcompat__in_channel_s.ml stdcompat__out_channel_s.ml \ stdcompat__unit_s.ml stdcompat__pervasives.ml \ stdcompat__arg.ml stdcompat__array.ml \ @@ -165,9 +166,10 @@ CONFIG_CLEAN_FILES = META stdcompat__hashtbl_ext.mli \ stdcompat__dynarray.ml stdcompat__either.ml \ stdcompat__ephemeron.ml stdcompat__filename.ml \ stdcompat__float.ml stdcompat__format.ml stdcompat__fun.ml \ - stdcompat__hashtbl.ml stdcompat__int.ml stdcompat__int32.ml \ - stdcompat__int64.ml stdcompat__lazy.ml stdcompat__lexing.ml \ - stdcompat__list.ml stdcompat__listLabels.ml stdcompat__map.ml \ + stdcompat__hashtbl.ml stdcompat__generic_int.ml \ + stdcompat__int.ml stdcompat__int32.ml stdcompat__int64.ml \ + stdcompat__lazy.ml stdcompat__lexing.ml stdcompat__list.ml \ + stdcompat__listLabels.ml stdcompat__map.ml \ stdcompat__moreLabels.ml stdcompat__nativeint.ml \ stdcompat__option.ml stdcompat__printexc.ml \ stdcompat__printf.ml stdcompat__queue.ml stdcompat__random.ml \ @@ -301,6 +303,8 @@ am__DIST_COMMON = $(srcdir)/META.in $(srcdir)/Makefile.in \ $(srcdir)/stdcompat__format_s.mli.in \ $(srcdir)/stdcompat__fun.ml.in $(srcdir)/stdcompat__fun.mli.in \ $(srcdir)/stdcompat__fun_s.mli.in \ + $(srcdir)/stdcompat__generic_int.ml.in \ + $(srcdir)/stdcompat__generic_int_s.mli.in \ $(srcdir)/stdcompat__hashtbl.ml.in \ $(srcdir)/stdcompat__hashtbl.mli.in \ $(srcdir)/stdcompat__hashtbl_ext.ml.in \ @@ -450,6 +454,8 @@ BEGIN_BEFORE_5_0_0 = @BEGIN_BEFORE_5_0_0@ BEGIN_BEFORE_5_1_0 = @BEGIN_BEFORE_5_1_0@ BEGIN_BEFORE_5_2_0 = @BEGIN_BEFORE_5_2_0@ BEGIN_BEFORE_5_3_0 = @BEGIN_BEFORE_5_3_0@ +BEGIN_BEFORE_5_4_0 = @BEGIN_BEFORE_5_4_0@ +BEGIN_BEFORE_5_5_0 = @BEGIN_BEFORE_5_5_0@ BEGIN_FROM_3_07_0 = @BEGIN_FROM_3_07_0@ BEGIN_FROM_3_08_0 = @BEGIN_FROM_3_08_0@ BEGIN_FROM_3_09_0 = @BEGIN_FROM_3_09_0@ @@ -476,6 +482,8 @@ BEGIN_FROM_5_0_0 = @BEGIN_FROM_5_0_0@ BEGIN_FROM_5_1_0 = @BEGIN_FROM_5_1_0@ BEGIN_FROM_5_2_0 = @BEGIN_FROM_5_2_0@ BEGIN_FROM_5_3_0 = @BEGIN_FROM_5_3_0@ +BEGIN_FROM_5_4_0 = @BEGIN_FROM_5_4_0@ +BEGIN_FROM_5_5_0 = @BEGIN_FROM_5_5_0@ BEGIN_WITHOUT_CYGWIN = @BEGIN_WITHOUT_CYGWIN@ BEGIN_WITHOUT_FLAMBDA2 = @BEGIN_WITHOUT_FLAMBDA2@ BEGIN_WITHOUT_MAGIC = @BEGIN_WITHOUT_MAGIC@ @@ -516,6 +524,8 @@ C_BEGIN_BEFORE_5_0_0 = @C_BEGIN_BEFORE_5_0_0@ C_BEGIN_BEFORE_5_1_0 = @C_BEGIN_BEFORE_5_1_0@ C_BEGIN_BEFORE_5_2_0 = @C_BEGIN_BEFORE_5_2_0@ C_BEGIN_BEFORE_5_3_0 = @C_BEGIN_BEFORE_5_3_0@ +C_BEGIN_BEFORE_5_4_0 = @C_BEGIN_BEFORE_5_4_0@ +C_BEGIN_BEFORE_5_5_0 = @C_BEGIN_BEFORE_5_5_0@ C_BEGIN_FROM_3_07_0 = @C_BEGIN_FROM_3_07_0@ C_BEGIN_FROM_3_08_0 = @C_BEGIN_FROM_3_08_0@ C_BEGIN_FROM_3_09_0 = @C_BEGIN_FROM_3_09_0@ @@ -542,6 +552,8 @@ C_BEGIN_FROM_5_0_0 = @C_BEGIN_FROM_5_0_0@ C_BEGIN_FROM_5_1_0 = @C_BEGIN_FROM_5_1_0@ C_BEGIN_FROM_5_2_0 = @C_BEGIN_FROM_5_2_0@ C_BEGIN_FROM_5_3_0 = @C_BEGIN_FROM_5_3_0@ +C_BEGIN_FROM_5_4_0 = @C_BEGIN_FROM_5_4_0@ +C_BEGIN_FROM_5_5_0 = @C_BEGIN_FROM_5_5_0@ C_BEGIN_WITHOUT_CYGWIN = @C_BEGIN_WITHOUT_CYGWIN@ C_BEGIN_WITHOUT_FLAMBDA2 = @C_BEGIN_WITHOUT_FLAMBDA2@ C_BEGIN_WITHOUT_MAGIC = @C_BEGIN_WITHOUT_MAGIC@ @@ -578,6 +590,8 @@ C_END_BEFORE_5_0_0 = @C_END_BEFORE_5_0_0@ C_END_BEFORE_5_1_0 = @C_END_BEFORE_5_1_0@ C_END_BEFORE_5_2_0 = @C_END_BEFORE_5_2_0@ C_END_BEFORE_5_3_0 = @C_END_BEFORE_5_3_0@ +C_END_BEFORE_5_4_0 = @C_END_BEFORE_5_4_0@ +C_END_BEFORE_5_5_0 = @C_END_BEFORE_5_5_0@ C_END_FROM_3_07_0 = @C_END_FROM_3_07_0@ C_END_FROM_3_08_0 = @C_END_FROM_3_08_0@ C_END_FROM_3_09_0 = @C_END_FROM_3_09_0@ @@ -604,6 +618,8 @@ C_END_FROM_5_0_0 = @C_END_FROM_5_0_0@ C_END_FROM_5_1_0 = @C_END_FROM_5_1_0@ C_END_FROM_5_2_0 = @C_END_FROM_5_2_0@ C_END_FROM_5_3_0 = @C_END_FROM_5_3_0@ +C_END_FROM_5_4_0 = @C_END_FROM_5_4_0@ +C_END_FROM_5_5_0 = @C_END_FROM_5_5_0@ C_END_WITHOUT_CYGWIN = @C_END_WITHOUT_CYGWIN@ C_END_WITHOUT_FLAMBDA2 = @C_END_WITHOUT_FLAMBDA2@ C_END_WITHOUT_MAGIC = @C_END_WITHOUT_MAGIC@ @@ -644,6 +660,8 @@ END_BEFORE_5_0_0 = @END_BEFORE_5_0_0@ END_BEFORE_5_1_0 = @END_BEFORE_5_1_0@ END_BEFORE_5_2_0 = @END_BEFORE_5_2_0@ END_BEFORE_5_3_0 = @END_BEFORE_5_3_0@ +END_BEFORE_5_4_0 = @END_BEFORE_5_4_0@ +END_BEFORE_5_5_0 = @END_BEFORE_5_5_0@ END_FROM_3_07_0 = @END_FROM_3_07_0@ END_FROM_3_08_0 = @END_FROM_3_08_0@ END_FROM_3_09_0 = @END_FROM_3_09_0@ @@ -670,6 +688,8 @@ END_FROM_5_0_0 = @END_FROM_5_0_0@ END_FROM_5_1_0 = @END_FROM_5_1_0@ END_FROM_5_2_0 = @END_FROM_5_2_0@ END_FROM_5_3_0 = @END_FROM_5_3_0@ +END_FROM_5_4_0 = @END_FROM_5_4_0@ +END_FROM_5_5_0 = @END_FROM_5_5_0@ END_WITHOUT_CYGWIN = @END_WITHOUT_CYGWIN@ END_WITHOUT_FLAMBDA2 = @END_WITHOUT_FLAMBDA2@ END_WITHOUT_MAGIC = @END_WITHOUT_MAGIC@ @@ -774,6 +794,7 @@ EXTRA_DIST = stdcompat.opam dune stdcompat.ml stdcompat__native.ml_byte \ stdcompat__native.ml_native stdcompat_tests.ml stdcompat__native.mli \ stdcompat__pervasives.mli stdcompat__arg.mli stdcompat__lazy.mli \ stdcompat__char.mli stdcompat__uchar.mli stdcompat__sys.mli stdcompat__buffer.mli \ + stdcompat__utf8.mli \ stdcompat__string.mli stdcompat__stringLabels.mli stdcompat__bytes.mli \ stdcompat__bytesLabels.mli stdcompat__list.mli \ stdcompat__listLabels.mli \ @@ -781,8 +802,11 @@ EXTRA_DIST = stdcompat.opam dune stdcompat.ml stdcompat__native.ml_byte \ stdcompat__hashtbl.mli stdcompat__set.mli \ stdcompat__map.mli stdcompat__weak.mli \ stdcompat__digest.mli stdcompat__nativeint.mli \ + stdcompat__generic_int_s.mli \ + stdcompat__generic_int.mli \ stdcompat__int.mli \ stdcompat__int64.mli stdcompat__int32.mli stdcompat__filename.mli \ + stdcompat__generic_array.mli \ stdcompat__array.mli stdcompat__arrayLabels.mli \ stdcompat__float.mli stdcompat__queue.mli stdcompat__ephemeron.mli \ stdcompat__moreLabels.mli stdcompat__lexing.mli \ @@ -803,21 +827,25 @@ MODULES = stdcompat__init.ml stdcompat__root.ml \ stdcompat__pervasives_s.ml stdcompat__arg_s.ml stdcompat__lazy_s.ml \ stdcompat__char_s.ml stdcompat__uchar_s.ml stdcompat__uchar.ml \ stdcompat__buffer_s.ml \ - stdcompat__string_s.ml stdcompat__stringLabels_s.ml stdcompat__bytes_s.ml \ + stdcompat__bytes_s.ml \ stdcompat__bytesLabels_s.ml \ + stdcompat__string_s.ml stdcompat__stringLabels_s.ml \ stdcompat__list_s.ml \ stdcompat__listLabels_s.ml \ stdcompat__stack_s.ml \ stdcompat__list.ml \ - stdcompat__hashtbl_ext.ml stdcompat__hashtbl_s.ml stdcompat__set_s.ml \ + stdcompat__hashtbl_ext.ml stdcompat__hashtbl_s.ml stdcompat__hashtbl.ml \ + stdcompat__set_s.ml \ stdcompat__map_s.ml stdcompat__weak_s.ml stdcompat__sys_s.ml \ - stdcompat__digest_s.ml stdcompat__nativeint_s.ml \ + stdcompat__digest_s.ml \ + stdcompat__generic_int.ml \ + stdcompat__nativeint_s.ml \ stdcompat__int_s.ml \ stdcompat__int64_s.ml stdcompat__int32_s.ml stdcompat__filename_s.ml \ + stdcompat__generic_array.ml \ stdcompat__array_s.ml stdcompat__arrayLabels_s.ml \ stdcompat__dynarray_s.ml stdcompat__dynarray.ml \ stdcompat__float_s.ml stdcompat__queue_s.ml \ - stdcompat__hashtbl.ml \ stdcompat__ephemeron_s.ml \ stdcompat__moreLabels_s.ml stdcompat__lexing_s.ml \ stdcompat__pervasives.ml \ @@ -834,6 +862,8 @@ MODULES = stdcompat__init.ml stdcompat__root.ml \ stdcompat__option.ml \ stdcompat__buffer.ml stdcompat__sys.ml \ stdcompat__bytes.ml stdcompat__bytesLabels.ml \ + stdcompat__utf8.ml \ + stdcompat__int.ml \ stdcompat__string.ml stdcompat__stringLabels.ml \ stdcompat__filename.ml \ stdcompat__listLabels.ml \ @@ -841,7 +871,7 @@ MODULES = stdcompat__init.ml stdcompat__root.ml \ stdcompat__map.ml stdcompat__weak.ml \ stdcompat__random.ml \ stdcompat__digest.ml stdcompat__nativeint.ml \ - stdcompat__int.ml stdcompat__int64.ml stdcompat__int32.ml \ + stdcompat__int64.ml stdcompat__int32.ml \ stdcompat__array.ml stdcompat__arrayLabels.ml \ stdcompat__float.ml stdcompat__queue.ml stdcompat__ephemeron.ml \ stdcompat__moreLabels.ml stdcompat__lexing.ml \ @@ -974,6 +1004,8 @@ stdcompat__format_s.mli: $(top_builddir)/config.status $(srcdir)/stdcompat__form cd $(top_builddir) && $(SHELL) ./config.status $@ stdcompat__fun_s.mli: $(top_builddir)/config.status $(srcdir)/stdcompat__fun_s.mli.in cd $(top_builddir) && $(SHELL) ./config.status $@ +stdcompat__generic_int_s.mli: $(top_builddir)/config.status $(srcdir)/stdcompat__generic_int_s.mli.in + cd $(top_builddir) && $(SHELL) ./config.status $@ stdcompat__hashtbl_s.mli: $(top_builddir)/config.status $(srcdir)/stdcompat__hashtbl_s.mli.in cd $(top_builddir) && $(SHELL) ./config.status $@ stdcompat__in_channel_s.mli: $(top_builddir)/config.status $(srcdir)/stdcompat__in_channel_s.mli.in @@ -1168,6 +1200,8 @@ stdcompat__fun.ml: $(top_builddir)/config.status $(srcdir)/stdcompat__fun.ml.in cd $(top_builddir) && $(SHELL) ./config.status $@ stdcompat__hashtbl.ml: $(top_builddir)/config.status $(srcdir)/stdcompat__hashtbl.ml.in cd $(top_builddir) && $(SHELL) ./config.status $@ +stdcompat__generic_int.ml: $(top_builddir)/config.status $(srcdir)/stdcompat__generic_int.ml.in + cd $(top_builddir) && $(SHELL) ./config.status $@ stdcompat__int.ml: $(top_builddir)/config.status $(srcdir)/stdcompat__int.ml.in cd $(top_builddir) && $(SHELL) ./config.status $@ stdcompat__int32.ml: $(top_builddir)/config.status $(srcdir)/stdcompat__int32.ml.in @@ -1365,6 +1399,7 @@ ctags CTAGS: cscope cscopelist: + distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -1415,6 +1450,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) +dist-bzip3: distdir + tardir=$(distdir) && $(am__tar) | bzip3 -c >$(distdir).tar.bz3 + $(am__post_remove_distdir) + dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) @@ -1459,6 +1498,8 @@ distcheck: dist eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.bz3*) \ + bzip3 -dc $(distdir).tar.bz3 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ @@ -1648,16 +1689,16 @@ uninstall-am: uninstall-mypkgSCRIPTS .MAKE: install-am install-exec-am install-strip .PHONY: all all-am am--refresh check check-am clean clean-generic \ - cscopelist-am ctags-am dist dist-all dist-bzip2 dist-gzip \ - dist-lzip dist-shar dist-tarZ dist-xz dist-zip dist-zstd \ - distcheck distclean distclean-generic distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-exec-hook \ - install-html install-html-am install-info install-info-am \ - install-man install-mypkgSCRIPTS install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + cscopelist-am ctags-am dist dist-all dist-bzip2 dist-bzip3 \ + dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ + dist-zstd distcheck distclean distclean-generic distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-exec-hook install-html install-html-am install-info \ + install-info-am install-man install-mypkgSCRIPTS install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am \ uninstall-mypkgSCRIPTS @@ -1705,6 +1746,8 @@ stdcompat__native.cmo : stdcompat__native.ml_byte stdcompat__native.cmi stdcompat__native.cmx : stdcompat__native.ml_native stdcompat__native.cmi $(OCAMLOPT) $(OCAMLCFLAGS) -c -impl stdcompat__native.ml_native +stdcompat__generic_int.cmi: stdcompat__generic_int_s.cmi + .PHONY : depend depend : .depend diff --git a/aclocal.m4 b/aclocal.m4 index 0ed5382..958534c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.17 -*- Autoconf -*- +# generated automatically by aclocal 1.18.1 -*- Autoconf -*- -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2025 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2024 Free Software Foundation, Inc. +# Copyright (C) 2002-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.17' +[am__api_version='1.18' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.17], [], +m4_if([$1], [1.18.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.17])dnl +[AM_AUTOMAKE_VERSION([1.18.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2024 Free Software Foundation, Inc. +# Copyright (C) 1997-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -143,7 +143,7 @@ fi])]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -243,8 +243,9 @@ AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_IF_OPTION([tar-v7], [_AM_PROG_TAR([v7])], + [_AM_PROG_TAR([ustar])])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], @@ -320,7 +321,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -341,7 +342,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2024 Free Software Foundation, Inc. +# Copyright (C) 2003-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -363,7 +364,7 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -398,7 +399,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2024 Free Software Foundation, Inc. +# Copyright (C) 1997-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -432,7 +433,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -461,7 +462,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 2022-2024 Free Software Foundation, Inc. +# Copyright (C) 2022-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -477,9 +478,26 @@ AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) AC_SUBST(am__rm_f_notfound) ]) +# Copyright (C) 2001-2025 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2024 Free Software Foundation, Inc. +# Copyright (C) 1996-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -648,10 +666,12 @@ am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_RESULT([no]) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_RESULT([no]) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac @@ -704,7 +724,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2024 Free Software Foundation, Inc. +# Copyright (C) 2009-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -773,9 +793,13 @@ fi # empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_REQUIRE([_AM_SILENT_RULES]) -AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])]) +AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])m4_newline +dnl We intentionally force a newline after the assignment, since a) nothing +dnl good can come of more text following, and b) that was the behavior +dnl before 1.17. See https://bugs.gnu.org/72267. +]) -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -803,7 +827,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2024 Free Software Foundation, Inc. +# Copyright (C) 2006-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -822,7 +846,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2024 Free Software Foundation, Inc. +# Copyright (C) 2004-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -957,7 +981,7 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -# Copyright (C) 2022-2024 Free Software Foundation, Inc. +# Copyright (C) 2022-2025 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/configure b/configure index 2ea0682..b1ac7aa 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for stdcompat 21. +# Generated by GNU Autoconf 2.72 for stdcompat 22. # # Report bugs to . # @@ -603,8 +603,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='stdcompat' PACKAGE_TARNAME='stdcompat' -PACKAGE_VERSION='21' -PACKAGE_STRING='stdcompat 21' +PACKAGE_VERSION='22' +PACKAGE_STRING='stdcompat 22' PACKAGE_BUGREPORT='https://github.com/ocamllibs/stdcompat/issues' PACKAGE_URL='https://github.com/ocamllibs/stdcompat/' @@ -656,6 +656,22 @@ C_END_WITH_WIN32 C_BEGIN_WITH_WIN32 END_WITH_WIN32 BEGIN_WITH_WIN32 +C_END_BEFORE_5_5_0 +C_BEGIN_BEFORE_5_5_0 +END_BEFORE_5_5_0 +BEGIN_BEFORE_5_5_0 +C_END_FROM_5_5_0 +C_BEGIN_FROM_5_5_0 +END_FROM_5_5_0 +BEGIN_FROM_5_5_0 +C_END_BEFORE_5_4_0 +C_BEGIN_BEFORE_5_4_0 +END_BEFORE_5_4_0 +BEGIN_BEFORE_5_4_0 +C_END_FROM_5_4_0 +C_BEGIN_FROM_5_4_0 +END_FROM_5_4_0 +BEGIN_FROM_5_4_0 C_END_BEFORE_5_3_0 C_BEGIN_BEFORE_5_3_0 END_BEFORE_5_3_0 @@ -1526,7 +1542,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -'configure' configures stdcompat 21 to adapt to many kinds of systems. +'configure' configures stdcompat 22 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1593,7 +1609,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of stdcompat 21:";; + short | recursive ) echo "Configuration of stdcompat 22:";; esac cat <<\_ACEOF @@ -1675,7 +1691,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -stdcompat configure 21 +stdcompat configure 22 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -1712,7 +1728,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by stdcompat $as_me 21, which was +It was created by stdcompat $as_me 22, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -2151,7 +2167,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.17' +am__api_version='1.18' @@ -2421,10 +2437,14 @@ am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac @@ -2851,7 +2871,7 @@ fi # Define the identity of the package. PACKAGE='stdcompat' - VERSION='21' + VERSION='22' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -2889,9 +2909,133 @@ AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' +_am_tools='gnutar plaintar pax cpio none' + +# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5 +printf %s "checking whether UID '$am_uid' is supported by ustar format... " >&6; } + if test x$am_uid = xunknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ancient id detected; assuming current UID is ok, but dist-ustar might not work" >&5 +printf "%s\n" "$as_me: WARNING: ancient id detected; assuming current UID is ok, but dist-ustar might not work" >&2;} + elif test $am_uid -le $am_max_uid; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + _am_tools=none + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5 +printf %s "checking whether GID '$am_gid' is supported by ustar format... " >&6; } + if test x$gm_gid = xunknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ancient id detected; assuming current GID is ok, but dist-ustar might not work" >&5 +printf "%s\n" "$as_me: WARNING: ancient id detected; assuming current GID is ok, but dist-ustar might not work" >&2;} + elif test $am_gid -le $am_max_gid; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + _am_tools=none + fi -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 +printf %s "checking how to create a ustar tar archive... " >&6; } + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_ustar-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + { echo "$as_me:$LINENO: $_am_tar --version" >&5 + ($_am_tar --version) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && break + done + am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x ustar -w "$$tardir"' + am__tar_='pax -L -x ustar -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H ustar -L' + am__tar_='find "$tardir" -print | cpio -o -H ustar -L' + am__untar='cpio -i -H ustar -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_ustar}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 + (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + rm -rf conftest.dir + if test -s conftest.tar; then + { echo "$as_me:$LINENO: $am__untar &5 + ($am__untar &5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + { echo "$as_me:$LINENO: cat conftest.dir/file" >&5 + (cat conftest.dir/file) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + if test ${am_cv_prog_tar_ustar+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) am_cv_prog_tar_ustar=$_am_tool ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 +printf "%s\n" "$am_cv_prog_tar_ustar" >&6; } @@ -5171,6 +5315,64 @@ else case e in #( + ;; +esac +fi +if test `printf "$OCAMLVERSION\n5.4.0" | sort | head -n1` = 5.4.0 +then : + + + + + BEGIN_BEFORE_5_4_0='(*' + + END_BEFORE_5_4_0='*)' + + C_BEGIN_BEFORE_5_4_0='#if 0' + + C_END_BEFORE_5_4_0='#endif' + +else case e in #( + e) BEGIN_FROM_5_4_0='(*' + + END_FROM_5_4_0='*)' + + C_BEGIN_FROM_5_4_0='#if 0' + + C_END_FROM_5_4_0='#endif' + + + + + ;; +esac +fi +if test `printf "$OCAMLVERSION\n5.5.0" | sort | head -n1` = 5.5.0 +then : + + + + + BEGIN_BEFORE_5_5_0='(*' + + END_BEFORE_5_5_0='*)' + + C_BEGIN_BEFORE_5_5_0='#if 0' + + C_END_BEFORE_5_5_0='#endif' + +else case e in #( + e) BEGIN_FROM_5_5_0='(*' + + END_FROM_5_5_0='*)' + + C_BEGIN_FROM_5_5_0='#if 0' + + C_END_FROM_5_5_0='#endif' + + + + ;; esac fi @@ -5428,6 +5630,8 @@ ac_config_files="$ac_config_files stdcompat__format_s.mli" ac_config_files="$ac_config_files stdcompat__fun_s.mli" +ac_config_files="$ac_config_files stdcompat__generic_int_s.mli" + ac_config_files="$ac_config_files stdcompat__hashtbl_s.mli" ac_config_files="$ac_config_files stdcompat__in_channel_s.mli" @@ -5622,6 +5826,8 @@ ac_config_files="$ac_config_files stdcompat__fun.ml" ac_config_files="$ac_config_files stdcompat__hashtbl.ml" +ac_config_files="$ac_config_files stdcompat__generic_int.ml" + ac_config_files="$ac_config_files stdcompat__int.ml" ac_config_files="$ac_config_files stdcompat__int32.ml" @@ -6364,7 +6570,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by stdcompat $as_me 21, which was +This file was extended by stdcompat $as_me 22, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6420,7 +6626,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -stdcompat config.status 21 +stdcompat config.status 22 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" @@ -6564,6 +6770,7 @@ do "stdcompat__float_s.mli") CONFIG_FILES="$CONFIG_FILES stdcompat__float_s.mli" ;; "stdcompat__format_s.mli") CONFIG_FILES="$CONFIG_FILES stdcompat__format_s.mli" ;; "stdcompat__fun_s.mli") CONFIG_FILES="$CONFIG_FILES stdcompat__fun_s.mli" ;; + "stdcompat__generic_int_s.mli") CONFIG_FILES="$CONFIG_FILES stdcompat__generic_int_s.mli" ;; "stdcompat__hashtbl_s.mli") CONFIG_FILES="$CONFIG_FILES stdcompat__hashtbl_s.mli" ;; "stdcompat__in_channel_s.mli") CONFIG_FILES="$CONFIG_FILES stdcompat__in_channel_s.mli" ;; "stdcompat__int_s.mli") CONFIG_FILES="$CONFIG_FILES stdcompat__int_s.mli" ;; @@ -6661,6 +6868,7 @@ do "stdcompat__format.ml") CONFIG_FILES="$CONFIG_FILES stdcompat__format.ml" ;; "stdcompat__fun.ml") CONFIG_FILES="$CONFIG_FILES stdcompat__fun.ml" ;; "stdcompat__hashtbl.ml") CONFIG_FILES="$CONFIG_FILES stdcompat__hashtbl.ml" ;; + "stdcompat__generic_int.ml") CONFIG_FILES="$CONFIG_FILES stdcompat__generic_int.ml" ;; "stdcompat__int.ml") CONFIG_FILES="$CONFIG_FILES stdcompat__int.ml" ;; "stdcompat__int32.ml") CONFIG_FILES="$CONFIG_FILES stdcompat__int32.ml" ;; "stdcompat__int64.ml") CONFIG_FILES="$CONFIG_FILES stdcompat__int64.ml" ;; diff --git a/configure.ac b/configure.ac index 1ccb7a0..c0ac19a 100644 --- a/configure.ac +++ b/configure.ac @@ -185,6 +185,8 @@ AC_WITH_OCAML_VERSION([5_0_0], [5.0.0]) AC_WITH_OCAML_VERSION([5_1_0], [5.1.0]) AC_WITH_OCAML_VERSION([5_2_0], [5.2.0]) AC_WITH_OCAML_VERSION([5_3_0], [5.3.0]) +AC_WITH_OCAML_VERSION([5_4_0], [5.4.0]) +AC_WITH_OCAML_VERSION([5_5_0], [5.5.0]) AS_IF([test "x$target_os_type" = "xWin32"], [AC_WITH_BLOCK([WIN32])], @@ -260,6 +262,7 @@ AC_CONFIG_FILES([stdcompat__filename_s.mli]) AC_CONFIG_FILES([stdcompat__float_s.mli]) AC_CONFIG_FILES([stdcompat__format_s.mli]) AC_CONFIG_FILES([stdcompat__fun_s.mli]) +AC_CONFIG_FILES([stdcompat__generic_int_s.mli]) AC_CONFIG_FILES([stdcompat__hashtbl_s.mli]) AC_CONFIG_FILES([stdcompat__in_channel_s.mli]) AC_CONFIG_FILES([stdcompat__int_s.mli]) @@ -357,6 +360,7 @@ AC_CONFIG_FILES([stdcompat__float.ml]) AC_CONFIG_FILES([stdcompat__format.ml]) AC_CONFIG_FILES([stdcompat__fun.ml]) AC_CONFIG_FILES([stdcompat__hashtbl.ml]) +AC_CONFIG_FILES([stdcompat__generic_int.ml]) AC_CONFIG_FILES([stdcompat__int.ml]) AC_CONFIG_FILES([stdcompat__int32.ml]) AC_CONFIG_FILES([stdcompat__int64.ml]) diff --git a/dune b/dune index 118317b..c0531da 100644 --- a/dune +++ b/dune @@ -43,6 +43,9 @@ stdcompat__format_s stdcompat__fun stdcompat__fun_s + stdcompat__generic_array + stdcompat__generic_int + stdcompat__generic_int_s stdcompat__hashtbl stdcompat__hashtbl_ext stdcompat__hashtbl_s @@ -106,9 +109,12 @@ stdcompat__uchar_s stdcompat__unit stdcompat__unit_s + stdcompat__utf8 stdcompat__weak stdcompat__weak_s - stdcompat)) + stdcompat) + (modules_without_implementation + stdcompat__generic_int_s)) (executable (name stdcompat_tests) diff --git a/dune-rules.inc b/dune-rules.inc index f1bbad6..b7e973f 100644 --- a/dune-rules.inc +++ b/dune-rules.inc @@ -230,6 +230,22 @@ (with-stdin-from stdcompat__fun_s.mli.in (with-stdout-to stdcompat__fun_s.mli (run %{gen} --source-type ocaml))))) +(rule + (targets stdcompat__generic_int.ml) + (deps + (:gen tools/stdcompatpp.exe) stdcompat__generic_int.ml.in) + (action + (with-stdin-from stdcompat__generic_int.ml.in + (with-stdout-to stdcompat__generic_int.ml + (run %{gen} --source-type ocaml))))) +(rule + (targets stdcompat__generic_int_s.mli) + (deps + (:gen tools/stdcompatpp.exe) stdcompat__generic_int_s.mli.in) + (action + (with-stdin-from stdcompat__generic_int_s.mli.in + (with-stdout-to stdcompat__generic_int_s.mli + (run %{gen} --source-type ocaml))))) (rule (targets stdcompat__hashtbl_s.mli) (deps diff --git a/stdcompat.opam b/stdcompat.opam index 5fda3fe..d5451a0 100644 --- a/stdcompat.opam +++ b/stdcompat.opam @@ -2,13 +2,13 @@ opam-version: "2.0" synopsis: "Compatibility module for OCaml standard library" description: "Compatibility module for OCaml standard library allowing programs to use some recent additions to the OCaml standard library while preserving the ability to be compiled on former versions of OCaml." -maintainer: "Sébastien Hinderer " +maintainer: "Sébastien Hinderer " authors: "Thierry Martinez " license: "LGPL-2.1-or-later" homepage: "https://github.com/ocamllibs/stdcompat" bug-reports: "https://github.com/ocamllibs/stdcompat/issues" depends: [ - "ocaml" {>= "4.11" & < "5.4"} + "ocaml" {>= "4.11" & < "5.6"} "dune" {>= "2.0"} ] build: [ diff --git a/stdcompat__array.ml.in b/stdcompat__array.ml.in index 8bb2998..a762a90 100644 --- a/stdcompat__array.ml.in +++ b/stdcompat__array.ml.in @@ -37,29 +37,11 @@ let fold_left_map f init array = item') array in !r, array' -let rec find_opt_rec f array i = - if i >= length array then - None - else - let item = unsafe_get array i in - if f item then - Some item - else - find_opt_rec f array (succ i) - -let find_opt f array = - find_opt_rec f array 0 - -let rec find_map_rec f array i = - if i >= length array then - None - else - match f (unsafe_get array i) with - | None -> find_map_rec f array (succ i) - | Some _ as result -> result +let find_opt p a = + Stdcompat__generic_array.find_opt ~length ~unsafe_get p a -let find_map f array = - find_map_rec f array 0 +let find_map f a = + Stdcompat__generic_array.find_map ~length ~unsafe_get f a let split array = let l = length array in @@ -84,29 +66,17 @@ let combine array_fst array_snd = @END_BEFORE_4_13_0@ @BEGIN_BEFORE_4_11_0@ -exception Iter - -let for_all2 f array1 array2 = - if length array1 <> length array2 then - invalid_arg "Array.for_all2"; - try - for i = 0 to length array1 - 1 do - if not (f (unsafe_get array1 i) (unsafe_get array2 i)) then - raise Iter - done; - true - with Iter -> false +let for_all2 p a1 a2 = + Stdcompat__generic_array.for_all2 ~caller:"Array.for_all2" + ~length1:length ~length2:length + ~unsafe_get1:unsafe_get ~unsafe_get2:unsafe_get + p a1 a2 let exists2 f array1 array2 = - if length array1 <> length array2 then - invalid_arg "Array.exists2"; - try - for i = 0 to length array1 - 1 do - if f (unsafe_get array1 i) (unsafe_get array2 i) then - raise Iter - done; - false - with Iter -> true + Stdcompat__generic_array.exists2 ~caller:"Array.exists2" + ~length1:length ~length2:length + ~unsafe_get1:unsafe_get ~unsafe_get2:unsafe_get + p a1 a2 @END_BEFORE_4_11_0@ @BEGIN_BEFORE_4_03_0@ @@ -123,23 +93,11 @@ let map2 f array1 array2 = init (length array1) (fun i -> f (unsafe_get array1 i) (unsafe_get array2 i)) -let for_all f array = - try - for i = 0 to length array - 1 do - if not (f (unsafe_get array i)) then - raise Iter - done; - true - with Iter -> false +let for_all p a = + Stdcompat__generic_array.for_all ~length ~unsafe_get p a let exists f array = - try - for i = 0 to length array - 1 do - if f (unsafe_get array i) then - raise Iter - done; - false - with Iter -> true + Stdcompat__generic_array.exists ~length ~unsafe_get p a let mem item = exists (( = ) item) @@ -196,36 +154,296 @@ let of_seq g = @END_BEFORE_4_07_1@ @BEGIN_BEFORE_5_1_0@ -let map_inplace f array = - for i = 0 to length array - 1 do - unsafe_set array i (f (unsafe_get array i)) - done +let map_inplace f a = + Stdcompat__generic_array.map_inplace ~length ~unsafe_get ~unsafe_set f a -let mapi_inplace f array = - for i = 0 to length array - 1 do - unsafe_set array i (f i (unsafe_get array i)) - done +let mapi_inplace f a = + Stdcompat__generic_array.mapi_inplace ~length ~unsafe_get ~unsafe_set f a -let rec find_index_from index p array = - if index < length array then - if p (unsafe_get array index) then - Some index - else - find_index_from (succ index) p array - else - None +let find_index p a = + Stdcompat__generic_array.find_index ~length ~unsafe_get p a -let find_index p array = - find_index_from 0 p array +let find_mapi f a = + Stdcompat__generic_array.find_mapi ~length ~unsafe_get f a +@END_BEFORE_5_1_0@ -let rec find_mapi_from index f array = - if index < length array then - match f index (unsafe_get array index) with - | None -> find_mapi_from (succ index) f array - | some -> some - else - None +@BEGIN_BEFORE_5_4_0@ +let equal eq a b = + Stdcompat__generic_array.equal ~length ~unsafe_get eq a b + +let compare cmp a b = + Stdcompat__generic_array.compare ~length ~unsafe_get cmp a b +@END_BEFORE_5_4_0@ + +@BEGIN_BEFORE_5_5_0@ +(* Generated with ChatGPT (Free version, 2026-08-08) + with the following prompt: + + Implement powersort in OCaml. + The interface should be: + val stable_sort_sub : ('a -> 'a -> int) -> 'a array -> int -> int -> unit +*) + +type run = { + mutable start : int; + mutable len : int; + mutable power : int; + } + +let stable_sort_sub cmp a ofs len = + if len < 2 then + () + else begin + let last = ofs + len in + + (* Powersort's minrun heuristic, with MAX_MINRUN = 64. *) + let minrun n = + let r = ref 0 in + let n = ref n in + while !n >= 64 do + r := !r lor (!n land 1); + n := !n lsr 1 + done; + !n + !r + in + + (* Stable binary insertion sort of a[lo .. hi), where + a[lo .. start) is already sorted. *) + let binary_sort lo start hi = + for i = start to hi - 1 do + let x = a.(i) in + let left = ref lo in + let right = ref i in + + (* Upper bound: equal elements already in the sorted + prefix stay before x, hence stability. *) + while !left < !right do + let m = !left + ((!right - !left) lsr 1) in + if cmp x a.(m) < 0 then + right := m + else + left := m + 1 + done; + + let j = ref i in + while !j > !left do + a.(!j) <- a.(!j - 1); + decr j + done; + a.(!left) <- x + done + in + + (* Find a natural run starting at lo. + + Equal elements belong to ascending runs. A descending run is + necessarily strictly descending, so reversing it is stable. *) + let find_run lo = + let p = ref (lo + 1) in + if !p = last then + last + else if cmp a.(!p) a.(lo) < 0 then begin + (* Strictly descending. *) + incr p; + while !p < last && cmp a.(!p) a.(!p - 1) < 0 do + incr p + done; + + let i = ref lo in + let j = ref (!p - 1) in + while !i < !j do + let x = a.(!i) in + a.(!i) <- a.(!j); + a.(!j) <- x; + incr i; + decr j + done; + !p + end else begin + (* Non-decreasing. *) + incr p; + while !p < last && cmp a.(!p) a.(!p - 1) >= 0 do + incr p + done; + !p + end + in + + (* + Compute the Powersort node power of the boundary between + + [s1, s1+n1) + [s1+n1, s1+n1+n2) + + This is the number of common leading bits of the two run + midpoints, as fractions of the whole array. + + We use doubled midpoints so everything remains integral. + *) + let node_power s1 n1 n2 n = + let rec loop result a b = + let result = result + 1 in + if a >= n then + loop result (a - n) (b - n) + else if b >= n then + result + else + loop result (a lsl 1) (b lsl 1) + in + loop 0 (2 * s1 + n1) (2 * s1 + n1 + n1 + n2) + in + + (* The stack has logarithmic size in Powersort. *) + let stack = Array.make (max 32 (Sys.int_size * 2)) + { start = 0; len = 0; power = 0 } in + let top = ref 0 in + + let ensure_stack () = + if !top = Array.length stack then + invalid_arg "stable_sort_sub: run stack overflow" + in + + (* Temporary storage. We grow it to the size of the smaller + run whenever a merge requires it. *) + let tmp = ref [||] in + + let ensure_tmp n = + if Array.length !tmp < n then + tmp := Array.make n a.(ofs) + in + + (* Merge adjacent sorted runs [lo,mid) and [mid,hi). + + Only the smaller run is copied. *) + let merge lo mid hi = + let n1 = mid - lo in + let n2 = hi - mid in + + if n1 = 0 || n2 = 0 then + () + else if cmp a.(mid - 1) a.(mid) <= 0 then + (* Already merged. *) + () + else if n1 <= n2 then begin + (* Copy the left run and merge forwards. *) + ensure_tmp n1; + Array.blit a lo !tmp 0 n1; + + let i = ref 0 in + let j = ref mid in + let k = ref lo in + + while !i < n1 && !j < hi do + if cmp !tmp.(!i) a.(!j) <= 0 then begin + a.(!k) <- !tmp.(!i); + incr i + end else begin + a.(!k) <- a.(!j); + incr j + end; + incr k + done; + + while !i < n1 do + a.(!k) <- !tmp.(!i); + incr i; + incr k + done + end else begin + (* Copy the right run and merge backwards. + + On equality we take from the right run first, because + we're filling the result from right to left. *) + ensure_tmp n2; + Array.blit a mid !tmp 0 n2; + + let i = ref (mid - 1) in + let j = ref (n2 - 1) in + let k = ref (hi - 1) in + + while !i >= lo && !j >= 0 do + if cmp a.(!i) !tmp.(!j) > 0 then begin + a.(!k) <- a.(!i); + decr i + end else begin + a.(!k) <- !tmp.(!j); + decr j + end; + decr k + done; + + while !j >= 0 do + a.(!k) <- !tmp.(!j); + decr j; + decr k + done + end + in + + (* Merge runs at stack positions i and i+1. *) + let merge_at i = + let r1 = stack.(i) in + let r2 = stack.(i + 1) in + + merge r1.start (r1.start + r1.len) + (r2.start + r2.len); + + r1.len <- r1.len + r2.len; + + (* Remove r2 from the stack. *) + for j = i + 1 to !top - 2 do + stack.(j) <- stack.(j + 1) + done; + decr top + in + + let mr = minrun len in + let pos = ref ofs in + + while !pos < last do + let start = !pos in + let natural_end = find_run start in + let natural_len = natural_end - start in + + let run_len = + if natural_len < mr && natural_end < last then begin + let n = min mr (last - start) in + binary_sort start natural_end (start + n); + n + end else + natural_len + in + + let run = { start; len = run_len; power = 0 } in + + if !top > 0 then begin + let previous = stack.(!top - 1) in + let power = + node_power previous.start previous.len run.len len + in + + (* Powers on the stack are strictly increasing. + Close every node whose power is larger than the + boundary we have just discovered. *) + while !top > 1 && + stack.(!top - 2).power > power do + merge_at (!top - 2) + done; + + (* The power belongs to the boundary after the current + top run, so it is stored in the current top entry. *) + stack.(!top - 1).power <- power + end; + + ensure_stack (); + stack.(!top) <- run; + incr top; + pos := start + run_len + done; -let find_mapi f array = - find_mapi_from 0 f array -@END_BEFORE_5_1_0@ + (* Finish the merge tree. *) + while !top > 1 do + merge_at (!top - 2) + done + end +@END_BEFORE_5_5_0@ diff --git a/stdcompat__array_s.mli.in b/stdcompat__array_s.mli.in index 837ac58..d839158 100644 --- a/stdcompat__array_s.mli.in +++ b/stdcompat__array_s.mli.in @@ -23,6 +23,45 @@ val unsafe_set : Stdcompat__init.floatarray -> int -> float -> unit end (** @since 4.06.0: module Floatarray = Array.Floatarray *) +val stable_sort_sub : ('a -> 'a -> int) -> 'a array -> int -> int -> unit +(** @since 5.5.0: + val stable_sort_sub : ('a -> 'a -> int) -> 'a array -> int -> int -> unit *) + +@BEGIN_FROM_5_5_0@ +val to_seq : 'a array -> 'a Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seq : 'a array -> 'a Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : 'a array -> 'a Seq.t + *) + +@BEGIN_FROM_5_5_0@ +val to_seqi : 'a array -> (int * 'a) Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seqi : 'a array -> (int * 'a) Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seqi : 'a array -> (int * 'a) Seq.t + *) + +@BEGIN_FROM_5_5_0@ +val of_seq : 'a Seq.t -> 'a array +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val of_seq : 'a Stdcompat__seq.t -> 'a array +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : 'a Seq.t -> 'a array + *) + +val equal : ('a -> 'a -> bool) -> 'a array -> 'a array -> bool +(** @since 5.4.0: + val equal : ('a -> 'a -> bool) -> 'a array -> 'a array -> bool *) + +val compare : ('a -> 'a -> int) -> 'a array -> 'a array -> int +(** @since 5.4.0: + val compare : ('a -> 'a -> int) -> 'a array -> 'a array -> int *) + val init_matrix : int -> int -> (int -> int -> 'a) -> 'a array array (** @since 5.2.0: val init_matrix : int -> int -> (int -> int -> 'a) -> 'a array array *) @@ -86,46 +125,22 @@ val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool (** @since 4.11.0: val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool *) -@BEGIN_FROM_4_07_0@ -val to_seq : 'a array -> 'a Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seq : 'a array -> 'a Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq : 'a array -> 'a Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val to_seqi : 'a array -> (int * 'a) Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seqi : 'a array -> (int * 'a) Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seqi : 'a array -> (int * 'a) Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val of_seq : 'a Seq.t -> 'a array -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val of_seq : 'a Stdcompat__seq.t -> 'a array -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val of_seq : 'a Seq.t -> 'a array - *) - -@BEGIN_FROM_4_03_0@ -@BEGIN_BEFORE_5_3_0@ -external create_float : int -> float array = "caml_make_float_vect" -@END_BEFORE_5_3_0@ @BEGIN_FROM_5_3_0@ -external create_float: int -> float array = "caml_array_create_float" +external create_float : int -> float array = "caml_array_create_float" @END_FROM_5_3_0@ +@BEGIN_BEFORE_5_3_0@ +@BEGIN_FROM_4_03_0@ +external create_float : int -> float array = "caml_make_float_vect" @END_FROM_4_03_0@ @BEGIN_BEFORE_4_03_0@ val create_float : int -> float array @END_BEFORE_4_03_0@ -(** @since 4.03.0: - external create_float : int -> float array = "caml_make_float_vect" + +@END_BEFORE_5_3_0@ +(** @since 5.3.0: + external create_float : int -> float array = "caml_array_create_float" +@since 4.03.0: +external create_float : int -> float array = "caml_make_float_vect" *) val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit @@ -157,18 +172,20 @@ external get : 'a array -> int -> 'a = "%array_safe_get" external set : 'a array -> int -> 'a -> unit = "%array_safe_set" (** Alias for {!Array.set} *) -@BEGIN_FROM_3_08_0@ -@BEGIN_BEFORE_5_3_0@ -external make : int -> 'a -> 'a array = "caml_make_vect" -@END_BEFORE_5_3_0@ @BEGIN_FROM_5_3_0@ external make : int -> 'a -> 'a array = "caml_array_make" @END_FROM_5_3_0@ +@BEGIN_BEFORE_5_3_0@ +@BEGIN_FROM_3_08_0@ +external make : int -> 'a -> 'a array = "caml_make_vect" @END_FROM_3_08_0@ @BEGIN_BEFORE_3_08_0@ external make : int -> 'a -> 'a array = "make_vect" @END_BEFORE_3_08_0@ -(** @since 3.08.0: external make : int -> 'a -> 'a array = "caml_make_vect" + +@END_BEFORE_5_3_0@ +(** @since 5.3.0: external make : int -> 'a -> 'a array = "caml_array_make" +@since 3.08.0: external make : int -> 'a -> 'a array = "caml_make_vect" @since 3.07.0: external make : int -> 'a -> 'a array = "make_vect" *) diff --git a/stdcompat__atomic.ml.in b/stdcompat__atomic.ml.in index 51cb910..56d379d 100644 --- a/stdcompat__atomic.ml.in +++ b/stdcompat__atomic.ml.in @@ -36,3 +36,17 @@ let decr = decr @BEGIN_BEFORE_5_2_0@ let make_contended = make @END_BEFORE_5_2_0@ + +@BEGIN_BEFORE_5_4_0@ +type 'a u = 'a t +module Loc = struct + type 'a t = 'a u + let get = get + let set = set + let exchange = exchange + let compare_and_set = compare_and_set + let fetch_and_add = fetch_and_add + let incr = incr + let decr = decr +end +@END_BEFORE_5_4_0@ diff --git a/stdcompat__atomic_s.mli.in b/stdcompat__atomic_s.mli.in index a011852..7e05164 100644 --- a/stdcompat__atomic_s.mli.in +++ b/stdcompat__atomic_s.mli.in @@ -14,6 +14,20 @@ type 'a t (** @since 4.12.0: type !'a t *) +@BEGIN_FROM_5_4_0@ +module Loc = Atomic.Loc +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +module Loc : +sig type 'a t val get : 'a t -> 'a +val set : 'a t -> 'a -> unit val exchange : 'a t -> 'a -> 'a +val compare_and_set : 'a t -> 'a -> 'a -> bool +val fetch_and_add : int t -> int -> int val incr : int t -> unit +val decr : int t -> unit end +@END_BEFORE_5_4_0@ +(** @since 5.4.0: module Loc = Atomic.Loc + *) + val make_contended : 'a -> 'a t (** @since 5.2.0: val make_contended : 'a -> 'a t *) diff --git a/stdcompat__bool.ml.in b/stdcompat__bool.ml.in index 594c512..e59687c 100644 --- a/stdcompat__bool.ml.in +++ b/stdcompat__bool.ml.in @@ -32,3 +32,11 @@ let hash = Hashtbl.hash let seeded_hash = Stdcompat__hashtbl.seeded_hash @END_BEFORE_5_1_0@ + +@BEGIN_BEFORE_5_4_0@ +let logand = (&&) + +let logor = (||) + +let logxor = (<>) +@END_BEFORE_5_4_0@ diff --git a/stdcompat__bool_s.mli.in b/stdcompat__bool_s.mli.in index ed4ebfc..ab5a079 100644 --- a/stdcompat__bool_s.mli.in +++ b/stdcompat__bool_s.mli.in @@ -14,6 +14,15 @@ type t = bool = | true *) +val logand : bool -> bool -> bool +(** @since 5.4.0: val logand : bool -> bool -> bool *) + +val logor : bool -> bool -> bool +(** @since 5.4.0: val logor : bool -> bool -> bool *) + +val logxor : bool -> bool -> bool +(** @since 5.4.0: val logxor : bool -> bool -> bool *) + val seeded_hash : int -> bool -> int (** @since 5.1.0: val seeded_hash : int -> bool -> int *) diff --git a/stdcompat__buffer_s.mli.in b/stdcompat__buffer_s.mli.in index b46a7aa..5e0e193 100644 --- a/stdcompat__buffer_s.mli.in +++ b/stdcompat__buffer_s.mli.in @@ -2,6 +2,69 @@ module type S = sig type t = Buffer.t (** Alias for {!Buffer.t} *) +@BEGIN_FROM_5_5_0@ +val add_utf_8_uchar : t -> Uchar.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val add_utf_8_uchar : t -> Stdcompat__uchar.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val add_utf_8_uchar : t -> Uchar.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val add_utf_16le_uchar : t -> Uchar.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val add_utf_16le_uchar : t -> Stdcompat__uchar.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val add_utf_16le_uchar : t -> Uchar.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val add_utf_16be_uchar : t -> Uchar.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val add_utf_16be_uchar : t -> Stdcompat__uchar.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val add_utf_16be_uchar : t -> Uchar.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val to_seq : t -> char Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seq : t -> char Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : t -> char Seq.t + *) + +@BEGIN_FROM_5_5_0@ +val to_seqi : t -> (int * char) Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seqi : t -> (int * char) Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seqi : t -> (int * char) Seq.t + *) + +@BEGIN_FROM_5_5_0@ +val add_seq : t -> char Seq.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val add_seq : t -> char Stdcompat__seq.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val add_seq : t -> char Seq.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val of_seq : char Seq.t -> t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val of_seq : char Stdcompat__seq.t -> t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : char Seq.t -> t + *) + val add_uint8 : t -> int -> unit (** @since 4.08.0: val add_uint8 : t -> int -> unit *) @@ -44,69 +107,6 @@ val add_int64_be : t -> int64 -> unit val add_int64_le : t -> int64 -> unit (** @since 4.08.0: val add_int64_le : t -> int64 -> unit *) -@BEGIN_FROM_4_07_0@ -val to_seq : t -> char Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seq : t -> char Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq : t -> char Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val to_seqi : t -> (int * char) Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seqi : t -> (int * char) Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seqi : t -> (int * char) Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val add_seq : t -> char Seq.t -> unit -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val add_seq : t -> char Stdcompat__seq.t -> unit -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val add_seq : t -> char Seq.t -> unit - *) - -@BEGIN_FROM_4_07_0@ -val of_seq : char Seq.t -> t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val of_seq : char Stdcompat__seq.t -> t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val of_seq : char Seq.t -> t - *) - -@BEGIN_FROM_4_06_0@ -val add_utf_8_uchar : t -> Uchar.t -> unit -@END_FROM_4_06_0@ -@BEGIN_BEFORE_4_06_0@ -val add_utf_8_uchar : t -> Stdcompat__uchar.t -> unit -@END_BEFORE_4_06_0@ -(** @since 4.06.0: val add_utf_8_uchar : t -> Uchar.t -> unit - *) - -@BEGIN_FROM_4_06_0@ -val add_utf_16le_uchar : t -> Uchar.t -> unit -@END_FROM_4_06_0@ -@BEGIN_BEFORE_4_06_0@ -val add_utf_16le_uchar : t -> Stdcompat__uchar.t -> unit -@END_BEFORE_4_06_0@ -(** @since 4.06.0: val add_utf_16le_uchar : t -> Uchar.t -> unit - *) - -@BEGIN_FROM_4_06_0@ -val add_utf_16be_uchar : t -> Uchar.t -> unit -@END_FROM_4_06_0@ -@BEGIN_BEFORE_4_06_0@ -val add_utf_16be_uchar : t -> Stdcompat__uchar.t -> unit -@END_BEFORE_4_06_0@ -(** @since 4.06.0: val add_utf_16be_uchar : t -> Uchar.t -> unit - *) - val truncate : t -> int -> unit (** @since 4.05.0: val truncate : t -> int -> unit *) diff --git a/stdcompat__bytes_s.mli.in b/stdcompat__bytes_s.mli.in index 7553daa..23294db 100644 --- a/stdcompat__bytes_s.mli.in +++ b/stdcompat__bytes_s.mli.in @@ -8,75 +8,102 @@ type t = Stdcompat__init.bytes (** @since 4.02.0: type t = bytes *) -@BEGIN_FROM_5_0_0@ -val unsafe_escape : bytes -> bytes -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ -val unsafe_escape : Stdcompat__init.bytes -> Stdcompat__init.bytes -@END_BEFORE_5_0_0@ -(** @since 5.0.0: val unsafe_escape : bytes -> bytes +@BEGIN_FROM_5_5_0@ +val to_seq : t -> char Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seq : t -> char Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : t -> char Seq.t + *) + +@BEGIN_FROM_5_5_0@ +val to_seqi : t -> (int * char) Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seqi : t -> (int * char) Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seqi : t -> (int * char) Seq.t *) -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ +val of_seq : char Seq.t -> t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val of_seq : char Stdcompat__seq.t -> t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : char Seq.t -> t + *) + +@BEGIN_FROM_5_5_0@ val get_utf_8_uchar : t -> int -> Uchar.utf_decode -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val get_utf_8_uchar : t -> int -> Stdcompat__uchar.utf_decode -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val get_utf_8_uchar : t -> int -> Uchar.utf_decode +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_utf_8_uchar : t -> int -> Uchar.utf_decode *) -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ val set_utf_8_uchar : t -> int -> Uchar.t -> int -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val set_utf_8_uchar : t -> int -> Stdcompat__uchar.t -> int -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val set_utf_8_uchar : t -> int -> Uchar.t -> int +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val set_utf_8_uchar : t -> int -> Uchar.t -> int *) -val is_valid_utf_8 : t -> bool -(** @since 4.14.0: val is_valid_utf_8 : t -> bool *) - -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ val get_utf_16be_uchar : t -> int -> Uchar.utf_decode -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val get_utf_16be_uchar : t -> int -> Stdcompat__uchar.utf_decode -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_utf_16be_uchar : t -> int -> Uchar.utf_decode *) -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ val set_utf_16be_uchar : t -> int -> Uchar.t -> int -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val set_utf_16be_uchar : t -> int -> Stdcompat__uchar.t -> int -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val set_utf_16be_uchar : t -> int -> Uchar.t -> int +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val set_utf_16be_uchar : t -> int -> Uchar.t -> int *) -val is_valid_utf_16be : t -> bool -(** @since 4.14.0: val is_valid_utf_16be : t -> bool *) - -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ val get_utf_16le_uchar : t -> int -> Uchar.utf_decode -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val get_utf_16le_uchar : t -> int -> Stdcompat__uchar.utf_decode -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_utf_16le_uchar : t -> int -> Uchar.utf_decode *) -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ val set_utf_16le_uchar : t -> int -> Uchar.t -> int -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val set_utf_16le_uchar : t -> int -> Stdcompat__uchar.t -> int -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val set_utf_16le_uchar : t -> int -> Uchar.t -> int +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val set_utf_16le_uchar : t -> int -> Uchar.t -> int + *) + +@BEGIN_FROM_5_0_0@ +val unsafe_escape : bytes -> bytes +@END_FROM_5_0_0@ +@BEGIN_BEFORE_5_0_0@ +val unsafe_escape : Stdcompat__init.bytes -> Stdcompat__init.bytes +@END_BEFORE_5_0_0@ +(** @since 5.0.0: val unsafe_escape : bytes -> bytes *) +val is_valid_utf_8 : t -> bool +(** @since 4.14.0: val is_valid_utf_8 : t -> bool *) + +val is_valid_utf_16be : t -> bool +(** @since 4.14.0: val is_valid_utf_16be : t -> bool *) + val is_valid_utf_16le : t -> bool (** @since 4.14.0: val is_valid_utf_16le : t -> bool *) @@ -439,33 +466,6 @@ val set_int64_le : Stdcompat__init.bytes -> int -> int64 -> unit (** @since 4.08.0: val set_int64_le : bytes -> int -> int64 -> unit *) -@BEGIN_FROM_4_07_0@ -val to_seq : t -> char Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seq : t -> char Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq : t -> char Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val to_seqi : t -> (int * char) Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seqi : t -> (int * char) Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seqi : t -> (int * char) Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val of_seq : char Seq.t -> t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val of_seq : char Stdcompat__seq.t -> t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val of_seq : char Seq.t -> t - *) - @BEGIN_FROM_4_05_0@ val index_opt : bytes -> char -> int option @END_FROM_4_05_0@ diff --git a/stdcompat__char.ml.in b/stdcompat__char.ml.in index 2d30c28..e938d25 100644 --- a/stdcompat__char.ml.in +++ b/stdcompat__char.ml.in @@ -13,3 +13,67 @@ let hash = Hashtbl.hash let seeded_hash = Stdcompat__hashtbl.seeded_hash @END_BEFORE_5_1_0@ + +@BEGIN_BEFORE_5_4_0@ +module Ascii = struct + let min = '\000' + let max = '\x7F' + let is_valid c = c <= max + let is_upper c = 'A' <= c && c <= 'Z' + let is_lower c = 'a' <= c && c <= 'z' + let is_letter c = is_upper c || is_lower c + let is_digit c = '0' <= c && c <= '9' + let is_alphanum c = is_digit c || is_letter c + let is_white c = c = '\t' || c = '\n' || c = '\x0b' || c = '\x0c' || c = '\r' || c = ' ' + let is_blank c = c = ' ' || c = '\t' + let is_graphic c = c > ' ' && c < max + let is_print c = c = ' ' || is_graphic c + let is_control c = c < ' ' || c = max + + let digit_to_int c = + if not (is_digit c) then + invalid_arg "digit_to_int"; + int_of_char c - int_of_char '0' + + let digit_of_int n = + char_of_int (abs (n mod 10) + int_of_char '0') + + let is_hex_digit c = is_digit c || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f' + + let hex_digit_to_int c = + if is_digit c then + digit_to_int c + else if c >= 'A' && c <= 'F' then + int_of_char c - int_of_char 'A' + 10 + else if c >= 'a' && c <= 'f' then + int_of_char c - int_of_char 'a' + 10 + else + invalid_arg "hex_digit_to_int" + + let lower_hex_digit_of_int n = + let v = abs (n mod 16) in + if v < 10 then + digit_of_int v + else + char_of_int (v - 10 + int_of_char 'a') + + let upper_hex_digit_of_int n = + let v = abs (n mod 16) in + if v < 10 then + digit_of_int v + else + char_of_int (v - 10 + int_of_char 'A') + + let uppercase c = + if is_lower c then + char_of_int (int_of_char c - int_of_char 'a' + int_of_char 'A') + else + c + + let lowercase c = + if is_upper c then + char_of_int (int_of_char c - int_of_char 'A' + int_of_char 'a') + else + c +end +@END_BEFORE_5_4_0@ diff --git a/stdcompat__char_s.mli.in b/stdcompat__char_s.mli.in index 9d433bf..dad1da0 100644 --- a/stdcompat__char_s.mli.in +++ b/stdcompat__char_s.mli.in @@ -2,21 +2,41 @@ module type S = sig type t = char (** Alias for {!Char.t} *) +@BEGIN_FROM_5_4_0@ +module Ascii = Char.Ascii +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +module Ascii : +sig val min : char val max : char val is_valid : char -> bool +val is_upper : char -> bool val is_lower : char -> bool +val is_letter : char -> bool val is_alphanum : char -> bool +val is_white : char -> bool val is_blank : char -> bool +val is_graphic : char -> bool val is_print : char -> bool +val is_control : char -> bool val is_digit : char -> bool +val digit_to_int : char -> int val digit_of_int : int -> char +val is_hex_digit : char -> bool val hex_digit_to_int : char -> int +val lower_hex_digit_of_int : int -> char +val upper_hex_digit_of_int : int -> char val uppercase : char -> char +val lowercase : char -> char end +@END_BEFORE_5_4_0@ +(** @since 5.4.0: module Ascii = Char.Ascii + *) + val seeded_hash : int -> t -> int (** @since 5.1.0: val seeded_hash : int -> t -> int *) val hash : t -> int (** @since 5.1.0: val hash : t -> int *) +val equal : t -> t -> bool +(** @since 4.03.0: val equal : t -> t -> bool *) + val lowercase_ascii : char -> char (** @since 4.03.0: val lowercase_ascii : char -> char *) val uppercase_ascii : char -> char (** @since 4.03.0: val uppercase_ascii : char -> char *) -val equal : t -> t -> bool -(** @since 4.03.0: val equal : t -> t -> bool *) - external code : char -> int = "%identity" (** Alias for {!Char.code} *) diff --git a/stdcompat__domain.ml.in b/stdcompat__domain.ml.in index bae0711..5d4998d 100644 --- a/stdcompat__domain.ml.in +++ b/stdcompat__domain.ml.in @@ -73,3 +73,7 @@ let recommended_domain_count () = @BEGIN_BEFORE_5_3_0@ let self_index () = failwith "not implemented" @END_BEFORE_5_3_0@ + +@BEGIN_BEFORE_5_5_0@ +let count () = failwith "not implemented" +@END_BEFORE_5_5_0@ diff --git a/stdcompat__domain_s.mli.in b/stdcompat__domain_s.mli.in index 2f0ab0b..7e53989 100644 --- a/stdcompat__domain_s.mli.in +++ b/stdcompat__domain_s.mli.in @@ -41,6 +41,12 @@ val get : 'a key -> 'a val set : 'a key -> 'a -> unit end (** @since 5.0.0: module DLS = Domain.DLS *) +val count : unit -> int +(** @since 5.5.0: val count : unit -> int *) + +val self_index : unit -> int +(** @since 5.3.0: val self_index : unit -> int *) + val spawn : (unit -> 'a) -> 'a t (** @since 5.0.0: val spawn : (unit -> 'a) -> 'a t *) @@ -68,7 +74,4 @@ val is_main_domain : unit -> bool val recommended_domain_count : unit -> int (** @since 5.0.0: val recommended_domain_count : unit -> int *) -val self_index : unit -> int -(** @since 5.3: self_index : unit -> int *) - end diff --git a/stdcompat__either.ml.in b/stdcompat__either.ml.in index 12e342a..b9b02af 100644 --- a/stdcompat__either.ml.in +++ b/stdcompat__either.ml.in @@ -68,3 +68,20 @@ let compare ~left ~right e1 e2 = | Left _, Right _ -> -1 | Right _, Left _ -> 1 @END_BEFORE_4_12_0@ + +@BEGIN_BEFORE_5_4_0@ +let get_left e = + match e with + | Left v -> v + | Right _ -> invalid_arg "get_left: Right _" + +let get_right e = + match e with + | Left _ -> invalid_arg "get_right: Left _" + | Right v -> v + +let retract e = + match e with + | Left v -> v + | Right v -> v +@END_BEFORE_5_4_0@ diff --git a/stdcompat__either_s.mli.in b/stdcompat__either_s.mli.in index 3927419..1239acf 100644 --- a/stdcompat__either_s.mli.in +++ b/stdcompat__either_s.mli.in @@ -14,6 +14,15 @@ type ('a, 'b) t = ('a, 'b) Stdcompat__init.either = | Right of 'b *) +val get_left : ('a, 'b) t -> 'a +(** @since 5.4.0: val get_left : ('a, 'b) t -> 'a *) + +val get_right : ('a, 'b) t -> 'b +(** @since 5.4.0: val get_right : ('a, 'b) t -> 'b *) + +val retract : ('a, 'a) t -> 'a +(** @since 5.4.0: val retract : ('a, 'a) t -> 'a *) + val left : 'a -> ('a, 'b) t (** @since 4.12.0: val left : 'a -> ('a, 'b) t *) diff --git a/stdcompat__ephemeron_s.mli.in b/stdcompat__ephemeron_s.mli.in index 41fedc6..1fe9b5d 100644 --- a/stdcompat__ephemeron_s.mli.in +++ b/stdcompat__ephemeron_s.mli.in @@ -1,5 +1,4 @@ module type S = sig -@BEGIN_FROM_5_0_0@ module type S = sig type key @BEGIN_FROM_4_12_0@ type !'a t @END_FROM_4_12_0@ @@ -17,29 +16,7 @@ val replace_seq : 'a t -> (key * 'a) Seq.t -> unit val of_seq : (key * 'a) Seq.t -> 'a t val clean : 'a t -> unit val stats_alive : 'a t -> Hashtbl.statistics end -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ -module type S = -sig type key -@BEGIN_FROM_4_12_0@ -type !'a t -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -type 'a t -@END_BEFORE_4_12_0@ -val create : int -> 'a t val clear : 'a t -> unit -val reset : 'a t -> unit val copy : 'a t -> 'a t -val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit -val mem : 'a t -> key -> bool val length : 'a t -> int -val stats : 'a t -> Stdcompat__hashtbl_ext.statistics -val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t val clean : 'a t -> unit -val stats_alive : 'a t -> Stdcompat__hashtbl_ext.statistics end -@END_BEFORE_5_0_0@ -(** @since 5.0.0: +(** @since 5.5.0: module type S = sig type key @@ -65,7 +42,6 @@ val stats_alive : 'a t -> Stdcompat__hashtbl_ext.statistics end end *) -@BEGIN_FROM_5_0_0@ module type SeededS = sig type key @BEGIN_FROM_4_12_0@ type !'a t @END_FROM_4_12_0@ @@ -84,29 +60,7 @@ val replace_seq : 'a t -> (key * 'a) Seq.t -> unit val of_seq : (key * 'a) Seq.t -> 'a t val clean : 'a t -> unit val stats_alive : 'a t -> Hashtbl.statistics end -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ -module type SeededS = -sig type key -@BEGIN_FROM_4_12_0@ -type !'a t -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -type 'a t -@END_BEFORE_4_12_0@ -val create : ?random:bool -> int -> 'a t -val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t -val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit -val mem : 'a t -> key -> bool val length : 'a t -> int -val stats : 'a t -> Stdcompat__hashtbl_ext.statistics -val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t val clean : 'a t -> unit -val stats_alive : 'a t -> Stdcompat__hashtbl_ext.statistics end -@END_BEFORE_5_0_0@ -(** @since 5.0.0: +(** @since 5.5.0: module type SeededS = sig type key @@ -132,10 +86,10 @@ val stats_alive : 'a t -> Stdcompat__hashtbl_ext.statistics end end *) -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ module K1 = Ephemeron.K1 -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module K1 : sig type ('k, 'd) t val make : 'k -> 'd -> ('k, 'd) t val query : ('k, 'd) t -> 'k -> 'd option @@ -171,14 +125,14 @@ val add : ('k, 'd) t -> 'k -> 'd -> unit val remove : ('k, 'd) t -> 'k -> unit val find : ('k, 'd) t -> 'k -> 'd option val length : ('k, 'd) t -> int val clear : ('k, 'd) t -> unit end end -@END_BEFORE_5_0_0@ -(** @since 5.0.0: module K1 = Ephemeron.K1 +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module K1 = Ephemeron.K1 *) -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ module K2 = Ephemeron.K2 -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module K2 : sig type ('k1, 'k2, 'd) t val make : 'k1 -> 'k2 -> 'd -> ('k1, 'k2, 'd) t val query : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option @@ -218,14 +172,14 @@ val remove : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> unit val find : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option val length : ('k1, 'k2, 'd) t -> int val clear : ('k1, 'k2, 'd) t -> unit end end -@END_BEFORE_5_0_0@ -(** @since 5.0.0: module K2 = Ephemeron.K2 +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module K2 = Ephemeron.K2 *) -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ module Kn = Ephemeron.Kn -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Kn : sig type ('k, 'd) t val make : 'k array -> 'd -> ('k, 'd) t val query : ('k, 'd) t -> 'k array -> 'd option @@ -261,8 +215,8 @@ val add : ('k, 'd) t -> 'k array -> 'd -> unit val remove : ('k, 'd) t -> 'k array -> unit val find : ('k, 'd) t -> 'k array -> 'd option val length : ('k, 'd) t -> int val clear : ('k, 'd) t -> unit end end -@END_BEFORE_5_0_0@ -(** @since 5.0.0: module Kn = Ephemeron.Kn +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Kn = Ephemeron.Kn *) end diff --git a/stdcompat__float.ml.in b/stdcompat__float.ml.in index 40af9d8..c00b216 100644 --- a/stdcompat__float.ml.in +++ b/stdcompat__float.ml.in @@ -1,7 +1,7 @@ @BEGIN_FROM_5_2_0@ include Float @END_FROM_5_2_0@ -@BEGIN_BEFORE_5_2_0@ +@BEGIN_BEFORE_5_4_0@ module Array = struct @BEGIN_FROM_4_08_0@ @@ -158,17 +158,11 @@ module Array = struct done; result - let for_all f a = - let len = length a in - let rec aux i = - i >= len || f (unsafe_get a i) && aux (succ i) in - aux 0 + let for_all p a = + Stdcompat__generic_array.for_all ~length ~unsafe_get p a let exists f a = - let len = length a in - let rec aux i = - i < len && (f (unsafe_get a i) || aux (succ i)) in - aux 0 + Stdcompat__generic_array.exists ~length ~unsafe_get p a let mem x a = exists (fun y -> compare x y = 0) a @@ -221,68 +215,29 @@ module Array = struct let map_from_array f a = init (Array.length a) (fun i -> f (Array.unsafe_get a i)) - -@END_BEFORE_4_08_0@ + @END_BEFORE_4_08_0@ @BEGIN_BEFORE_5_1_0@ - let map_inplace f array = - for i = 0 to length array - 1 do - unsafe_set array i (f (unsafe_get array i)) - done + let map_inplace f a = + Stdcompat__generic_array.map_inplace ~length ~unsafe_get ~unsafe_set f a - let mapi_inplace f array = - for i = 0 to length array - 1 do - unsafe_set array i (f i (unsafe_get array i)) - done + let mapi_inplace f a = + Stdcompat__generic_array.mapi_inplace ~length ~unsafe_get ~unsafe_set f a - let rec find_opt_from index f array = - if index < length array then - let v = unsafe_get array index in - if f v then - Some v - else - find_opt_from (succ index) f array - else - None + let find_opt p a = + Stdcompat__generic_array.find_opt ~length ~unsafe_get p a - let find_opt f array = - find_opt_from 0 f array + let find_index p a = + Stdcompat__generic_array.find_index ~length ~unsafe_get p a - let rec find_index_from index p array = - if index < length array then - if p (unsafe_get array index) then - Some index - else - find_index_from (succ index) p array - else - None - - let find_index p array = - find_index_from 0 p array - - let rec find_map_from index f array = - if index < length array then - match f (unsafe_get array index) with - | None -> find_map_from (succ index) f array - | some -> some - else - None - - let find_map f array = - find_map_from 0 f array + let find_map f a = + Stdcompat__generic_array.find_map ~length ~unsafe_get f a - let rec find_mapi_from index f array = - if index < length array then - match f index (unsafe_get array index) with - | None -> find_mapi_from (succ index) f array - | some -> some - else - None - - let find_mapi f array = - find_mapi_from 0 f array + let find_mapi f a = + Stdcompat__generic_array.find_mapi ~length ~unsafe_get f a @END_BEFORE_5_1_0@ + @BEGIN_BEFORE_5_2_0@ let make_matrix m n x = Array.init m (fun _ -> make n x) @@ -296,6 +251,15 @@ module Array = struct unsafe_set array i (get array j); unsafe_set array j tmp done + @END_BEFORE_5_2_0@ + + @BEGIN_BEFORE_5_4_0@ + let equal eq a b = + Stdcompat__generic_array.equal ~length ~unsafe_get eq a b + + let compare cmp a b = + Stdcompat__generic_array.compare ~length ~unsafe_get cmp a b + @END_BEFORE_5_4_0@ end module ArrayLabels = struct @@ -367,12 +331,18 @@ module ArrayLabels = struct let init_matrix ~dimx ~dimy ~f = Array.init_matrix dimx dimy f let shuffle ~rand a = Array.shuffle rand a + +@BEGIN_BEFORE_5_4_0@ + let equal = Array.equal + + let compare = Array.compare +@END_BEFORE_5_4_0@ end @BEGIN_FROM_4_07_0@ include (Float : module type of Float with module Array := Array and module ArrayLabels := ArrayLabels) @END_FROM_4_07_0@ -@END_BEFORE_5_2_0@ +@END_BEFORE_5_4_0@ @BEGIN_BEFORE_4_07_0@ type fpclass = Pervasives.fpclass = | FP_normal diff --git a/stdcompat__float_s.mli.in b/stdcompat__float_s.mli.in index 85bd8a4..a24a7be 100644 --- a/stdcompat__float_s.mli.in +++ b/stdcompat__float_s.mli.in @@ -33,10 +33,10 @@ type t = float (** @since 4.07.0: type t = float *) -@BEGIN_FROM_5_2_0@ +@BEGIN_FROM_5_5_0@ module Array = Float.Array -@END_FROM_5_2_0@ -@BEGIN_BEFORE_5_2_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ @BEGIN_FROM_4_06_0@ module Array : sig type t = Stdcompat__init.floatarray val length : t -> int @@ -49,7 +49,10 @@ val append : t -> t -> t val concat : t list -> t val sub : t -> int -> int -> t val copy : t -> t val fill : t -> int -> int -> float -> unit val blit : t -> int -> t -> int -> int -> unit val to_list : t -> float list -val of_list : float list -> t val iter : (float -> unit) -> t -> unit +val of_list : float list -> t +val equal : (float -> float -> bool) -> t -> t -> bool +val compare : (float -> float -> int) -> t -> t -> int +val iter : (float -> unit) -> t -> unit val iteri : (int -> float -> unit) -> t -> unit val map : (float -> float) -> t -> t val map_inplace : (float -> float) -> t -> unit @@ -92,7 +95,10 @@ val append : t -> t -> t val concat : t list -> t val sub : t -> int -> int -> t val copy : t -> t val fill : t -> int -> int -> float -> unit val blit : t -> int -> t -> int -> int -> unit val to_list : t -> float list -val of_list : float list -> t val iter : (float -> unit) -> t -> unit +val of_list : float list -> t +val equal : (float -> float -> bool) -> t -> t -> bool +val compare : (float -> float -> int) -> t -> t -> int +val iter : (float -> unit) -> t -> unit val iteri : (int -> float -> unit) -> t -> unit val map : (float -> float) -> t -> t val map_inplace : (float -> float) -> t -> unit @@ -122,14 +128,14 @@ val unsafe_get : t -> int -> float val unsafe_set : t -> int -> float -> unit end @END_BEFORE_4_06_0@ -@END_BEFORE_5_2_0@ -(** @since 5.2.0: module Array = Float.Array +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Array = Float.Array *) -@BEGIN_FROM_5_2_0@ +@BEGIN_FROM_5_5_0@ module ArrayLabels = Float.ArrayLabels -@END_FROM_5_2_0@ -@BEGIN_BEFORE_5_2_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ @BEGIN_FROM_4_06_0@ module ArrayLabels : sig type t = Stdcompat__init.floatarray val length : t -> int @@ -143,6 +149,8 @@ val sub : t -> pos:int -> len:int -> t val copy : t -> t val fill : t -> pos:int -> len:int -> float -> unit val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit val to_list : t -> float list val of_list : float list -> t +val equal : eq:(float -> float -> bool) -> t -> t -> bool +val compare : cmp:(float -> float -> int) -> t -> t -> int val iter : f:(float -> unit) -> t -> unit val iteri : f:(int -> float -> unit) -> t -> unit val map : f:(float -> float) -> t -> t @@ -187,6 +195,8 @@ val sub : t -> pos:int -> len:int -> t val copy : t -> t val fill : t -> pos:int -> len:int -> float -> unit val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit val to_list : t -> float list val of_list : float list -> t +val equal : eq:(float -> float -> bool) -> t -> t -> bool +val compare : cmp:(float -> float -> int) -> t -> t -> int val iter : f:(float -> unit) -> t -> unit val iteri : f:(int -> float -> unit) -> t -> unit val map : f:(float -> float) -> t -> t @@ -217,8 +227,8 @@ val unsafe_get : t -> int -> float val unsafe_set : t -> int -> float -> unit end @END_BEFORE_4_06_0@ -@END_BEFORE_5_2_0@ -(** @since 5.2.0: module ArrayLabels = Float.ArrayLabels +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module ArrayLabels = Float.ArrayLabels *) val signaling_nan : float diff --git a/stdcompat__format.ml.in b/stdcompat__format.ml.in index 2c90cf7..959ad7a 100644 --- a/stdcompat__format.ml.in +++ b/stdcompat__format.ml.in @@ -1,12 +1,12 @@ -@BEGIN_FROM_4_06_0@ +@BEGIN_FROM_5_4_0@ include Format -@END_FROM_4_06_0@ +@END_FROM_5_4_0@ @BEGIN_BEFORE_5_2_0@ let pp_print_nothing _fmt () = () let pp_infinity = 1000000010 @END_BEFORE_5_2_0@ -@BEGIN_BEFORE_4_06_0@ +@BEGIN_BEFORE_5_4_0@ @BEGIN_FROM_4_01_0@ include (Format : module type of struct include Format end with type formatter_out_functions := Format.formatter_out_functions) @@ -18,6 +18,7 @@ include Format type formatter_out_functions = { out_string: string -> int -> int -> unit ; + out_width : string -> pos:int -> len:int -> int; out_flush: unit -> unit ; out_newline: unit -> unit ; out_spaces: int -> unit ; @@ -25,16 +26,35 @@ type formatter_out_functions = @BEGIN_FROM_4_01_0@ let downgrade_formatter_out_functions functions = - let { out_string; out_flush; out_newline; out_spaces; out_indent = _ } = + let { out_string; out_width = _; out_flush; out_newline; out_spaces; + @BEGIN_FROM_4_05_0@ + out_indent; + @END_FROM_4_05_0@ + @BEGIN_BEFORE_4_05_0@ + out_indent = _; + @END_BEFORE_4_05_0@ + } = functions in - { Format.out_string; out_flush; out_newline; out_spaces } + { Format.out_string; out_flush; out_newline; out_spaces; + @BEGIN_FROM_4_05_0@ + out_indent; + @END_FROM_4_05_0@ + } let upgrade_formatter_out_functions functions = - let { Format.out_string; out_flush; out_newline; out_spaces } = + let { Format.out_string; out_flush; out_newline; out_spaces; + @BEGIN_FROM_4_05_0@ + out_indent; + @END_FROM_4_05_0@ + } = functions in + let out_width _ = + failwith "Not implemented." in + @BEGIN_BEFORE_4_05_0@ let out_indent _ = failwith "Not implemented." in - { out_string; out_flush; out_newline; out_spaces; out_indent } + @END_BEFORE_4_05_0@ + { out_string; out_width; out_flush; out_newline; out_spaces; out_indent } let pp_set_formatter_out_functions fmt functions = Format.pp_set_formatter_out_functions fmt @@ -63,7 +83,7 @@ let pp_get_formatter_out_functions _ = let get_formatter_out_functions _ = failwith "Not implemented." @END_BEFORE_4_01_0@ -@END_BEFORE_4_06_0@ +@END_BEFORE_5_4_0@ @BEGIN_BEFORE_4_01_0@ let asprintf _ = @@ -173,6 +193,13 @@ type formatter_stag_functions = @END_BEFORE_4_08_0@ +@BEGIN_FROM_4_06_0@ +@BEGIN_BEFORE_5_4_0@ +let formatter_of_out_functions functions = + formatter_of_out_functions (downgrade_formatter_out_functions functions) +@END_BEFORE_5_4_0@ +@END_FROM_4_06_0@ + @BEGIN_BEFORE_4_06_0@ let formatter_of_out_functions _ = failwith "Not implemented." @@ -339,3 +366,48 @@ let print_substring_as ~pos ~len _as_len _v = pp_print_substring_as ~pos ~len (DLS.get std_formatter_key) as_len v *) @END_BEFORE_5_3_0@ + +@BEGIN_BEFORE_5_4_0@ +let utf_8_scalar_width s ~pos ~len = + Stdcompat__utf8.utf_8_scalar_width s ~pos ~len + +let ascii_width _ ~pos:_ ~len = len + +let format_text _ = + failwith "Not implemented." +@END_BEFORE_5_4_0@ + +@BEGIN_BEFORE_5_5_0@ +module Args = struct + type ('a, 'r) t = + | []: ('r, 'r) t + | (::): 'a * ('b, 'r) t -> ('a -> 'b, 'r) t + + let rec apply : type a r . a -> (a, r) t -> r = + fun f args -> + match args with + | [] -> f + | hd :: tl -> apply (f hd) tl + + let rec (@) : type a r1 r2 . (a, r1) t -> (r1, r2) t -> (a, r2) t = + fun a1 a2 -> + match a1 with + | [] -> a2 + | hd :: tl -> hd :: (tl @ a2) +end + +let lfprintf fmt pp args = + Args.apply (fprintf fmt pp) args + +let lprintf pp args = + Args.apply (printf pp) args + +let leprintf pp args = + Args.apply (eprintf pp) args + +let lasprintf pp args = + Args.apply (asprintf pp) args + +let ldprintf pp args fmt = + lfprintf fmt pp args +@END_BEFORE_5_5_0@ diff --git a/stdcompat__format_s.mli.in b/stdcompat__format_s.mli.in index 9c2883d..fa9b717 100644 --- a/stdcompat__format_s.mli.in +++ b/stdcompat__format_s.mli.in @@ -40,28 +40,31 @@ type stag type tag = string (** Alias for {!Format.tag} *) -@BEGIN_FROM_4_06_0@ +@BEGIN_FROM_5_4_0@ type formatter_out_functions = Format.formatter_out_functions = { out_string: string -> int -> int -> unit ; + out_width: string -> pos:int -> len:int -> int ; out_flush: unit -> unit ; out_newline: unit -> unit ; out_spaces: int -> unit ; out_indent: int -> unit } -@END_FROM_4_06_0@ -@BEGIN_BEFORE_4_06_0@ +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ type formatter_out_functions = { out_string: string -> int -> int -> unit ; + out_width: string -> pos:int -> len:int -> int ; out_flush: unit -> unit ; out_newline: unit -> unit ; out_spaces: int -> unit ; out_indent: int -> unit } -@END_BEFORE_4_06_0@ -(** @since 4.06.0: +@END_BEFORE_5_4_0@ +(** @since 5.4.0: type formatter_out_functions = { out_string: string -> int -> int -> unit ; + out_width: string -> pos:int -> len:int -> int ; out_flush: unit -> unit ; out_newline: unit -> unit ; out_spaces: int -> unit ; @@ -127,6 +130,210 @@ type symbolic_output_buffer (** @since 4.06.0: type symbolic_output_buffer *) +@BEGIN_FROM_5_5_0@ +module Args = Format.Args +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +module Args : sig @BEGIN_FROM_4_00_0@ +type ('a, 'r) t = + | []: ('r, 'r) t + | (::): 'a * ('b, 'r) t -> ('a -> 'b, 'r) t +@END_FROM_4_00_0@ +@BEGIN_BEFORE_4_00_0@ +type ('a, 'r) t = + | [] + | (::) of 'a * ('b, 'r) t +@END_BEFORE_4_00_0@ + val apply : 'a -> ('a, 'r) t -> 'r +val (@) : ('a, 'r1) t -> ('r1, 'r2) t -> ('a, 'r2) t +end +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Args = Format.Args + *) + +@BEGIN_FROM_5_5_0@ +val synchronized_formatter_of_out_channel : + out_channel -> formatter Stdcompat__domain.DLS.key +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val synchronized_formatter_of_out_channel : + out_channel -> formatter Stdcompat__domain.DLS.key +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val synchronized_formatter_of_out_channel : + out_channel -> formatter Domain.DLS.key + *) + +@BEGIN_FROM_5_5_0@ +val formatter_of_buffer : Buffer.t -> formatter +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val formatter_of_buffer : Buffer.t -> formatter +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val formatter_of_buffer : Buffer.t -> formatter + *) + +@BEGIN_FROM_5_5_0@ +val stdbuf : Buffer.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val stdbuf : Buffer.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val stdbuf : Buffer.t + *) + +@BEGIN_FROM_5_5_0@ +val get_stdbuf : unit -> Buffer.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val get_stdbuf : unit -> Buffer.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_stdbuf : unit -> Buffer.t + *) + +@BEGIN_FROM_5_5_0@ +val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> formatter Stdcompat__domain.DLS.key +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> formatter Stdcompat__domain.DLS.key +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> formatter Domain.DLS.key + *) + +@BEGIN_FROM_5_5_0@ +val pp_print_seq : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a Seq.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val pp_print_seq : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a Stdcompat__seq.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val pp_print_seq : + ?pp_sep:(formatter -> unit -> unit) -> + (formatter -> 'a -> unit) -> formatter -> 'a Seq.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val pp_print_either : + left:(formatter -> 'a -> unit) -> + right:(formatter -> 'b -> unit) -> formatter -> ('a, 'b) Either.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val pp_print_either : + left:(formatter -> 'a -> unit) -> + right:(formatter -> 'b -> unit) -> + formatter -> ('a, 'b) Stdcompat__either.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val pp_print_either : + left:(formatter -> 'a -> unit) -> + right:(formatter -> 'b -> unit) -> + formatter -> ('a, 'b) Either.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val lfprintf : + formatter -> ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val lfprintf : + formatter -> ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val lfprintf : + formatter -> ('a, formatter, unit) format -> ('a, unit) Args.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val lprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val lprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val lprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val leprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val leprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val leprintf : ('a, formatter, unit) format -> ('a, unit) Args.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val lasprintf : + ('a, formatter, unit, string) format4 -> ('a, string) Args.t -> string +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val lasprintf : + ('a, formatter, unit, string) format4 -> ('a, string) Args.t -> string +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val lasprintf : + ('a, formatter, unit, string) format4 -> ('a, string) Args.t -> string + *) + +@BEGIN_FROM_5_5_0@ +val ldprintf : + ('a, formatter, unit, unit) format4 -> + ('a, unit) Args.t -> formatter -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val ldprintf : + ('a, formatter, unit, unit) format4 -> + ('a, unit) Args.t -> formatter -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val ldprintf : + ('a, formatter, unit, unit) format4 -> + ('a, unit) Args.t -> formatter -> unit + *) + +val utf_8_scalar_width : string -> pos:int -> len:int -> int +(** @since 5.4.0: + val utf_8_scalar_width : string -> pos:int -> len:int -> int *) + +val ascii_width : string -> pos:int -> len:int -> int +(** @since 5.4.0: val ascii_width : string -> pos:int -> len:int -> int *) + +val format_text : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 +(** @since 5.4.0: + val format_text : + ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 *) + +val pp_print_substring : pos:int -> len:int -> formatter -> string -> unit +(** @since 5.3.0: + val pp_print_substring : + pos:int -> len:int -> formatter -> string -> unit *) + +val print_substring : pos:int -> len:int -> string -> unit +(** @since 5.3.0: val print_substring : pos:int -> len:int -> string -> unit *) + +val pp_print_substring_as : + pos:int -> len:int -> formatter -> int -> string -> unit +(** @since 5.3.0: + val pp_print_substring_as : + pos:int -> len:int -> formatter -> int -> string -> unit *) + +val print_substring_as : pos:int -> len:int -> int -> string -> unit +(** @since 5.3.0: + val print_substring_as : pos:int -> len:int -> int -> string -> unit *) + val pp_print_nothing : formatter -> unit -> unit (** @since 5.2.0: val pp_print_nothing : formatter -> unit -> unit *) @@ -151,32 +358,15 @@ val pp_print_array : ?pp_sep:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> formatter -> 'a array -> unit *) -val synchronized_formatter_of_out_channel : - out_channel -> formatter Stdcompat__domain.DLS.key -(** @since 5.0.0: - val synchronized_formatter_of_out_channel : - out_channel -> formatter Stdcompat__domain.DLS.key *) - val get_std_formatter : unit -> formatter (** @since 5.0.0: val get_std_formatter : unit -> formatter *) val get_err_formatter : unit -> formatter (** @since 5.0.0: val get_err_formatter : unit -> formatter *) -val get_stdbuf : unit -> Buffer.t -(** @since 5.0.0: val get_stdbuf : unit -> Buffer.t *) - val get_str_formatter : unit -> formatter (** @since 5.0.0: val get_str_formatter : unit -> formatter *) -val make_synchronized_formatter : - (string -> int -> int -> unit) -> - (unit -> unit) -> formatter Stdcompat__domain.DLS.key -(** @since 5.0.0: - val make_synchronized_formatter : - (string -> int -> int -> unit) -> - (unit -> unit) -> formatter Stdcompat__domain.DLS.key *) - @BEGIN_FROM_4_13_0@ val pp_print_bytes : formatter -> bytes -> unit @END_FROM_4_13_0@ @@ -195,40 +385,6 @@ val print_bytes : Stdcompat__init.bytes -> unit (** @since 4.13.0: val print_bytes : bytes -> unit *) -@BEGIN_FROM_4_13_0@ -val pp_print_either : - left:(formatter -> 'a -> unit) -> - right:(formatter -> 'b -> unit) -> formatter -> ('a, 'b) Either.t -> unit -@END_FROM_4_13_0@ -@BEGIN_BEFORE_4_13_0@ -val pp_print_either : - left:(formatter -> 'a -> unit) -> - right:(formatter -> 'b -> unit) -> - formatter -> ('a, 'b) Stdcompat__either.t -> unit -@END_BEFORE_4_13_0@ -(** @since 4.13.0: - val pp_print_either : - left:(formatter -> 'a -> unit) -> - right:(formatter -> 'b -> unit) -> - formatter -> ('a, 'b) Either.t -> unit - *) - -@BEGIN_FROM_4_12_0@ -val pp_print_seq : - ?pp_sep:(formatter -> unit -> unit) -> - (formatter -> 'a -> unit) -> formatter -> 'a Seq.t -> unit -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -val pp_print_seq : - ?pp_sep:(formatter -> unit -> unit) -> - (formatter -> 'a -> unit) -> formatter -> 'a Stdcompat__seq.t -> unit -@END_BEFORE_4_12_0@ -(** @since 4.12.0: - val pp_print_seq : - ?pp_sep:(formatter -> unit -> unit) -> - (formatter -> 'a -> unit) -> formatter -> 'a Seq.t -> unit - *) - val pp_update_geometry : formatter -> (geometry -> geometry) -> unit (** @since 4.11.0: val pp_update_geometry : formatter -> (geometry -> geometry) -> unit *) @@ -472,12 +628,6 @@ val open_hovbox : int -> unit val pp_print_string : formatter -> string -> unit (** Alias for {!Format.pp_print_string} *) -val pp_print_substring : pos:int -> len:int -> formatter -> string -> unit -val print_substring : pos:int -> len:int -> string -> unit -val pp_print_substring_as : - pos:int -> len:int -> formatter -> int -> string -> unit -val print_substring_as : pos:int -> len:int -> int -> string -> unit - val print_string : string -> unit (** Alias for {!Format.print_string} *) @@ -868,12 +1018,6 @@ val std_formatter : formatter val err_formatter : formatter (** Alias for {!Format.err_formatter} *) -val formatter_of_buffer : Buffer.t -> formatter -(** Alias for {!Format.formatter_of_buffer} *) - -val stdbuf : Buffer.t -(** Alias for {!Format.stdbuf} *) - val str_formatter : formatter (** Alias for {!Format.str_formatter} *) diff --git a/stdcompat__fun_s.mli.in b/stdcompat__fun_s.mli.in index 343187e..c53abba 100644 --- a/stdcompat__fun_s.mli.in +++ b/stdcompat__fun_s.mli.in @@ -5,8 +5,21 @@ exception Finally_raised of exn val compose : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c (** @since 5.2.0: val compose : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c *) +@BEGIN_FROM_5_5_0@ +val id : 'a -> 'a +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +@BEGIN_FROM_4_08_0@ external id : 'a -> 'a = "%identity" -(** @since 4.08.0: external id : 'a -> 'a = "%identity" *) +@END_FROM_4_08_0@ +@BEGIN_BEFORE_4_08_0@ +val id : 'a -> 'a +@END_BEFORE_4_08_0@ + +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val id : 'a -> 'a +@since 4.08.0: external id : 'a -> 'a = "%identity" + *) val const : 'a -> 'b -> 'a (** @since 4.08.0: val const : 'a -> 'b -> 'a *) diff --git a/stdcompat__generic_array.ml b/stdcompat__generic_array.ml new file mode 100644 index 0000000..a7e7c1d --- /dev/null +++ b/stdcompat__generic_array.ml @@ -0,0 +1,75 @@ +let rec for_all_aux ~len ~unsafe_get p a i = + i >= len || p (unsafe_get a i) && for_all_aux ~len ~unsafe_get p a (succ i) + +let for_all ~length ~unsafe_get p a = + for_all_aux ~len:(length a) ~unsafe_get p a 0 + +let exists ~length ~unsafe_get p a = + not (for_all ~length ~unsafe_get (fun e -> not (p e)) a) + +let rec for_all2_aux ~len ~unsafe_get1 ~unsafe_get2 p a1 a2 i = + i >= len || + p (unsafe_get1 a1 i) (unsafe_get2 a2 i) + && for_all2_aux ~len ~unsafe_get1 ~unsafe_get2 p a1 a2 (succ i) + +let for_all2 ~caller ~length1 ~unsafe_get1 ~length2 ~unsafe_get2 p a1 a2 = + let len1 = length1 a1 in + let len2 = length2 a2 in + if len1 <> len2 then + invalid_arg caller; + for_all2_aux ~len:len1 ~unsafe_get1 ~unsafe_get2 p a1 a2 0 + +let exists2 ~caller ~length1 ~unsafe_get1 ~length2 ~unsafe_get2 p a1 a2 = + not (for_all2 ~caller ~length1 ~unsafe_get1 ~length2 ~unsafe_get2 + (fun e1 e2 -> not (p e1 e2)) a1 a2) + +let rec find_mapi_aux ~len ~unsafe_get f a i = + if i >= len then + None + else + match f i (unsafe_get a i) with + | Some _ as some -> some + | None -> find_mapi_aux ~len ~unsafe_get f a (succ i) + +let find_mapi ~length ~unsafe_get f a = + find_mapi_aux ~len:(length a) ~unsafe_get f a 0 + +let find_map ~length ~unsafe_get f a = + find_mapi ~length ~unsafe_get (fun _i -> f) a + +let find_opt ~length ~unsafe_get p a = + find_mapi ~length ~unsafe_get (fun _i v -> if p v then Some v else None) a + +let find_index ~length ~unsafe_get p a = + find_mapi ~length ~unsafe_get (fun i v -> if p v then Some i else None) a + +let mapi_inplace ~length ~unsafe_get ~unsafe_set f a = + for i = 0 to length a - 1 do + unsafe_set a i (f i (unsafe_get a i)) + done + +let map_inplace ~length ~unsafe_get ~unsafe_set f a = + mapi_inplace ~length ~unsafe_get ~unsafe_set (fun _i -> f) a + +let equal ~length ~unsafe_get p a1 a2 = + let len = length a1 in + len = length a2 && + for_all2_aux ~len ~unsafe_get1:unsafe_get ~unsafe_get2:unsafe_get p a1 a2 0 + +let chain_compare cmp f = + if cmp = 0 then + f () + else + cmp + +let rec compare_aux ~len ~unsafe_get cmp a1 a2 i = + if i >= len then + 0 + else + chain_compare (cmp (unsafe_get a1 i) (unsafe_get a2 i)) (fun () -> + compare_aux ~len ~unsafe_get cmp a1 a2 (succ i)) + +let compare ~length ~unsafe_get cmp a1 a2 = + let len = length a1 in + chain_compare (Int.compare len (length a2)) (fun () -> + compare_aux ~len ~unsafe_get cmp a1 a2 0) diff --git a/stdcompat__generic_array.mli b/stdcompat__generic_array.mli new file mode 100644 index 0000000..dc8125e --- /dev/null +++ b/stdcompat__generic_array.mli @@ -0,0 +1,61 @@ +val for_all : + length:('a -> int) -> unsafe_get:('a -> int -> 'e) -> + ('e -> bool) -> 'a -> bool + +val for_all2 : + caller:string -> + length1:('a1 -> int) -> unsafe_get1:('a1 -> int -> 'e1) -> + length2:('a2 -> int) -> unsafe_get2:('a2 -> int -> 'e2) -> + ('e1 -> 'e2 -> bool) -> 'a1 -> 'a2 -> bool + +val exists : + length:('a -> int) -> unsafe_get:('a -> int -> 'e) -> + ('e -> bool) -> 'a -> bool + +val exists2 : + caller:string -> + length1:('a1 -> int) -> unsafe_get1:('a1 -> int -> 'e1) -> + length2:('a2 -> int) -> unsafe_get2:('a2 -> int -> 'e2) -> + ('e1 -> 'e2 -> bool) -> 'a1 -> 'a2 -> bool + +val find_mapi : + length:('a -> int) -> + unsafe_get:('a -> int -> 'e) -> + (int -> 'e -> 'b option) -> 'a -> 'b option + +val find_map : + length:('a -> int) -> + unsafe_get:('a -> int -> 'e) -> + ('e -> 'b option) -> 'a -> 'b option + +val find_opt : + length:('a -> int) -> + unsafe_get:('a -> int -> 'e) -> + ('e -> bool) -> 'a -> 'e option + +val find_index : + length:('a -> int) -> + unsafe_get:('a -> int -> 'e) -> + ('e -> bool) -> 'a -> int option + +val mapi_inplace : + length:('a -> int) -> + unsafe_get:('a -> int -> 'e) -> + unsafe_set:('a -> int -> 'e -> unit) -> + (int -> 'e -> 'e) -> 'a -> unit + +val map_inplace : + length:('a -> int) -> + unsafe_get:('a -> int -> 'e) -> + unsafe_set:('a -> int -> 'e -> unit) -> + ('e -> 'e) -> 'a -> unit + +val equal : + length:('a -> int) -> unsafe_get:('a -> int -> 'e) -> + ('e -> 'e -> bool) -> 'a -> 'a -> bool + +val chain_compare : int -> (unit -> int) -> int + +val compare : + length:('a -> int) -> unsafe_get:('a -> int -> 'e) -> + ('e -> 'e -> int) -> 'a -> 'a -> int diff --git a/stdcompat__generic_int.ml.in b/stdcompat__generic_int.ml.in new file mode 100644 index 0000000..60241aa --- /dev/null +++ b/stdcompat__generic_int.ml.in @@ -0,0 +1,83 @@ +module Make (X : Stdcompat__generic_int_s.S) = struct + @BEGIN_BEFORE_4_13_0@ + let min i j = + if compare i j >= 0 then j + else i + + let max i j = + if compare i j >= 0 then i + else j + @END_BEFORE_4_13_0@ + + @BEGIN_BEFORE_5_1_0@ + let hash = Hashtbl.hash + + let seeded_hash = Stdcompat__hashtbl.seeded_hash + @END_BEFORE_5_1_0@ + + @BEGIN_BEFORE_5_5_0@ + let fdiv x y = + let d = X.div x y in + if (x >= X.zero) <> (y >= X.zero) && X.rem x y <> X.zero then + X.pred d + else + d + + let cdiv x y = + let d = X.div x y in + if (x >= X.zero) = (y >= X.zero) && X.rem x y <> X.zero then + X.succ d + else + d + + let ediv x y = + if y < X.zero then + cdiv x y + else + fdiv x y + + let erem x y = + let r = X.rem x y in + if r < X.zero then + X.neg r + else + r + + let rec popcount_aux count x = + if x = X.zero then + count + else + let count' = if X.logand x X.one = X.one then count + 1 else count in + popcount_aux count' (X.shift_right_logical x 1) + + let popcount x = + popcount_aux 0 x + + let rec unsigned_bitsize_aux count x = + if x = X.zero then + count + else + unsigned_bitsize_aux (count + 1) (X.shift_right_logical x 1) + + let unsigned_bitsize x = + unsigned_bitsize_aux 0 x + + let signed_bitsize x = + if x >= X.zero then + unsigned_bitsize x + 1 + else + unsigned_bitsize (X.lognot x) + 1 + + let leading_zeros x = + X.bitsize - unsigned_bitsize x + + let leading_sign_bits x = + X.bitsize - signed_bitsize x + + let trailing_zeros x = + if x = X.zero then + X.bitsize + else + unsigned_bitsize (X.sub (X.logand x (X.neg x)) X.one) + @END_BEFORE_5_5_0@ +end diff --git a/stdcompat__generic_int.mli b/stdcompat__generic_int.mli new file mode 100644 index 0000000..7686f23 --- /dev/null +++ b/stdcompat__generic_int.mli @@ -0,0 +1 @@ +module Make (X : Stdcompat__generic_int_s.S) : Stdcompat__generic_int_s.F with type t := X.t diff --git a/stdcompat__generic_int_s.mli.in b/stdcompat__generic_int_s.mli.in new file mode 100644 index 0000000..ffcb60a --- /dev/null +++ b/stdcompat__generic_int_s.mli.in @@ -0,0 +1,65 @@ +module type S = sig + type t + + val bitsize : int + + val zero : t + + val one : t + + val neg : t -> t + + val pred : t -> t + + val succ : t -> t + + val sub : t -> t -> t + + val div : t -> t -> t + + val rem : t -> t -> t + + val lognot : t -> t + + val logand : t -> t -> t + + val shift_right_logical : t -> int -> t +end + +module type F = sig + type t + + @BEGIN_BEFORE_4_13_0@ + val min : t -> t -> t + + val max : t -> t -> t + @END_BEFORE_4_13_0@ + + @BEGIN_BEFORE_5_1_0@ + val seeded_hash : int -> t -> int + + val hash : t -> int + @END_BEFORE_5_1_0@ + + @BEGIN_BEFORE_5_5_0@ + val fdiv : t -> t -> t + + val cdiv : t -> t -> t + + val ediv : t -> t -> t + + val erem : t -> t -> t + + val popcount : t -> int + + val unsigned_bitsize : t -> int + + val signed_bitsize : t -> int + + val leading_zeros : t -> int + + val leading_sign_bits : t -> int + + val trailing_zeros : t -> int + @END_BEFORE_5_5_0@ +end diff --git a/stdcompat__hashtbl.ml.in b/stdcompat__hashtbl.ml.in index 39a8ede..267b6fd 100644 --- a/stdcompat__hashtbl.ml.in +++ b/stdcompat__hashtbl.ml.in @@ -177,10 +177,12 @@ module type S = sig val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit + val find_and_replace : 'a t -> key -> 'a -> 'a option val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit @@ -195,10 +197,10 @@ module type S = sig val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ module Make = Hashtbl.Make -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Make (H : HashedType) = struct include Hashtbl.Make (H) @@ -251,7 +253,7 @@ module Make (H : HashedType) = struct let length (table : 'a t) = let table : (key, 'a) Stdcompat__hashtbl_ext.internal = Obj.magic table in table.Stdcompat__hashtbl_ext.size -@END_WITH_MAGIC@ +y@END_WITH_MAGIC@ @BEGIN_WITHOUT_MAGIC@ let length table = fold (fun _ _ counter -> succ counter) table 0 @@ -272,8 +274,18 @@ module Make (H : HashedType) = struct Stdcompat__hashtbl_ext.stats ~length h @END_WITHOUT_MAGIC@ @END_BEFORE_4_00_0@ + + let find_and_replace h k v = + let old = find_opt h k in + replace h k v; + old + + let find_and_remove h k = + let old = find_opt h k in + remove h k; + old end -@END_BEFORE_4_07_0@ +@END_BEFORE_5_5_0@ module type SeededHashedType = sig type t @@ -297,10 +309,12 @@ module type SeededS = sig val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit + val find_and_replace : 'a t -> key -> 'a -> 'a option val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit @@ -315,10 +329,10 @@ module type SeededS = sig val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ module MakeSeeded = Hashtbl.MakeSeeded -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module MakeSeeded (H : SeededHashedType) = struct include Stdcompat__hashtbl_ext.MakeSeeded (H) @@ -390,8 +404,18 @@ let length table = bucket_histogram = [| |]; } @END_BEFORE_4_00_0@ + + let find_and_replace h k v = + let old = find_opt h k in + replace h k v; + old + + let find_and_remove h k = + let old = find_opt h k in + remove h k; + old end -@END_BEFORE_5_0_0@ +@END_BEFORE_5_5_0@ @BEGIN_FROM_4_12_0@ let rebuild = Hashtbl.rebuild @@ -402,3 +426,22 @@ let rebuild ?random tbl = iter (add result) tbl; result @END_BEFORE_4_12_0@ + + +@BEGIN_FROM_5_5_0@ +let find_and_remove = Hashtbl.find_and_remove + +let find_and_replace = Hashtbl.find_and_replace +@END_FROM_5_5_0@ + +@BEGIN_BEFORE_5_5_0@ +let find_and_replace h k v = + let old = find_opt h k in + replace h k v; + old + +let find_and_remove h k = + let old = find_opt h k in + remove h k; + old +@END_BEFORE_5_5_0@ diff --git a/stdcompat__hashtbl_s.mli.in b/stdcompat__hashtbl_s.mli.in index aeb8ad4..8a7cebd 100644 --- a/stdcompat__hashtbl_s.mli.in +++ b/stdcompat__hashtbl_s.mli.in @@ -37,7 +37,6 @@ module type HashedType = sig type t val equal : t -> t -> bool val hash : t -> int end (** Alias for {!Hashtbl.HashedType} *) -@BEGIN_FROM_5_1_0@ module type S = sig type key @BEGIN_FROM_4_12_0@ type !'a t @END_FROM_4_12_0@ @@ -46,10 +45,12 @@ type 'a t @END_BEFORE_4_12_0@ val create : int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit -val remove : 'a t -> key -> unit val find : 'a t -> key -> 'a +val remove : 'a t -> key -> unit +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list -val replace : 'a t -> key -> 'a -> unit val mem : 'a t -> key -> bool -val iter : (key -> 'a -> unit) -> 'a t -> unit +val replace : 'a t -> key -> 'a -> unit +val find_and_replace : 'a t -> key -> 'a -> 'a option +val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc val length : 'a t -> int val stats : 'a t -> statistics @@ -59,120 +60,20 @@ val add_seq : 'a t -> (key * 'a) Seq.t -> unit val replace_seq : 'a t -> (key * 'a) Seq.t -> unit val of_seq : (key * 'a) Seq.t -> 'a t end -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ -@BEGIN_FROM_4_07_0@ -module type S = sig type key @BEGIN_FROM_4_12_0@ -type !'a t -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -type 'a t -@END_BEFORE_4_12_0@ - val create : int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit -val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit -val remove : 'a t -> key -> unit val find : 'a t -> key -> 'a -val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list -val replace : 'a t -> key -> 'a -> unit val mem : 'a t -> key -> bool -val iter : (key -> 'a -> unit) -> 'a t -> unit -val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit -val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b -val length : 'a t -> int val stats : 'a t -> statistics -val to_seq : 'a t -> (key * 'a) Seq.t val to_seq_keys : 'a t -> key Seq.t -val to_seq_values : 'a t -> 'a Seq.t -val add_seq : 'a t -> (key * 'a) Seq.t -> unit -val replace_seq : 'a t -> (key * 'a) Seq.t -> unit -val of_seq : (key * 'a) Seq.t -> 'a t -end -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -module type S = -sig type key type 'a t val create : int -> 'a t val clear : 'a t -> unit -val reset : 'a t -> unit val copy : 'a t -> 'a t -val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit -val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit -val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit -val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc -val length : 'a t -> int val stats : 'a t -> statistics -val to_seq : 'a t -> (key * 'a) Stdcompat__seq.t -val to_seq_keys : 'a t -> key Stdcompat__seq.t -val to_seq_values : 'a t -> 'a Stdcompat__seq.t -val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@END_BEFORE_4_07_0@ -@END_BEFORE_5_1_0@ -(** @since 5.1.0: - module type S = - sig - type key - type !'a t - val create : int -> 'a t - val clear : 'a t -> unit - val reset : 'a t -> unit - val copy : 'a t -> 'a t - val add : 'a t -> key -> 'a -> unit - val remove : 'a t -> key -> unit - val find : 'a t -> key -> 'a - val find_opt : 'a t -> key -> 'a option - val find_all : 'a t -> key -> 'a list - val replace : 'a t -> key -> 'a -> unit - val mem : 'a t -> key -> bool - val iter : (key -> 'a -> unit) -> 'a t -> unit - val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit - val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc - val length : 'a t -> int - val stats : 'a t -> statistics - val to_seq : 'a t -> (key * 'a) Seq.t - val to_seq_keys : 'a t -> key Seq.t - val to_seq_values : 'a t -> 'a Seq.t - val add_seq : 'a t -> (key * 'a) Seq.t -> unit - val replace_seq : 'a t -> (key * 'a) Seq.t -> unit - val of_seq : (key * 'a) Seq.t -> 'a t - end -@since 4.07.0: -module type S = - sig - type key - type !'a t - val create : int -> 'a t - val clear : 'a t -> unit - val reset : 'a t -> unit - val copy : 'a t -> 'a t - val add : 'a t -> key -> 'a -> unit - val remove : 'a t -> key -> unit - val find : 'a t -> key -> 'a - val find_opt : 'a t -> key -> 'a option - val find_all : 'a t -> key -> 'a list - val replace : 'a t -> key -> 'a -> unit - val mem : 'a t -> key -> bool - val iter : (key -> 'a -> unit) -> 'a t -> unit - val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit - val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b - val length : 'a t -> int - val stats : 'a t -> statistics - val to_seq : 'a t -> (key * 'a) Seq.t - val to_seq_keys : 'a t -> key Seq.t - val to_seq_values : 'a t -> 'a Seq.t - val add_seq : 'a t -> (key * 'a) Seq.t -> unit - val replace_seq : 'a t -> (key * 'a) Seq.t -> unit - val of_seq : (key * 'a) Seq.t -> 'a t - end - *) - -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ module Make = Hashtbl.Make -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Make : functor (H : HashedType) -> sig type key = H.t type 'a t = 'a Hashtbl.Make(H).t val create : int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a +val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list +val replace : 'a t -> key -> 'a -> unit +val find_and_replace : 'a t -> key -> 'a -> 'a option val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc @@ -183,8 +84,8 @@ val to_seq_values : 'a t -> 'a Stdcompat__seq.t val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@END_BEFORE_4_07_0@ -(** @since 4.07.0: module Make = Hashtbl.Make +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Make = Hashtbl.Make *) @BEGIN_FROM_5_0_0@ @@ -201,7 +102,6 @@ sig type t val equal : t -> t -> bool val seeded_hash : int -> t -> int end end *) -@BEGIN_FROM_5_1_0@ module type SeededS = sig type key @BEGIN_FROM_4_12_0@ type !'a t @END_FROM_4_12_0@ @@ -211,8 +111,10 @@ type 'a t val create : ?random:bool -> int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a +val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list +val replace : 'a t -> key -> 'a -> unit +val find_and_replace : 'a t -> key -> 'a -> 'a option val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc @@ -223,52 +125,7 @@ val add_seq : 'a t -> (key * 'a) Seq.t -> unit val replace_seq : 'a t -> (key * 'a) Seq.t -> unit val of_seq : (key * 'a) Seq.t -> 'a t end -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ -@BEGIN_FROM_4_07_0@ -module type SeededS = sig type key @BEGIN_FROM_4_12_0@ -type !'a t -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -type 'a t -@END_BEFORE_4_12_0@ - val create : ?random:bool -> int -> 'a t val clear : 'a t -> unit -val reset : 'a t -> unit val copy : 'a t -> 'a t -val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit -val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit -val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit -val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b -val length : 'a t -> int val stats : 'a t -> statistics -val to_seq : 'a t -> (key * 'a) Seq.t val to_seq_keys : 'a t -> key Seq.t -val to_seq_values : 'a t -> 'a Seq.t -val add_seq : 'a t -> (key * 'a) Seq.t -> unit -val replace_seq : 'a t -> (key * 'a) Seq.t -> unit -val of_seq : (key * 'a) Seq.t -> 'a t -end -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -module type SeededS = -sig type key type 'a t val create : ?random:bool -> int -> 'a t -val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t -val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit -val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit -val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit -val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc -val length : 'a t -> int val stats : 'a t -> statistics -val to_seq : 'a t -> (key * 'a) Stdcompat__seq.t -val to_seq_keys : 'a t -> key Stdcompat__seq.t -val to_seq_values : 'a t -> 'a Stdcompat__seq.t -val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit -val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@END_BEFORE_4_07_0@ - -@END_BEFORE_5_1_0@ -(** @since 5.1.0: +(** @since 5.5.0: module type SeededS = sig type key @@ -279,10 +136,12 @@ val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit + val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit + val find_and_replace : 'a t -> key -> 'a -> 'a option val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit @@ -296,48 +155,22 @@ val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end val replace_seq : 'a t -> (key * 'a) Seq.t -> unit val of_seq : (key * 'a) Seq.t -> 'a t end -@since 4.07.0: -module type SeededS = - sig - type key - type !'a t - val create : ?random:bool -> int -> 'a t - val clear : 'a t -> unit - val reset : 'a t -> unit - val copy : 'a t -> 'a t - val add : 'a t -> key -> 'a -> unit - val remove : 'a t -> key -> unit - val find : 'a t -> key -> 'a - val find_opt : 'a t -> key -> 'a option - val find_all : 'a t -> key -> 'a list - val replace : 'a t -> key -> 'a -> unit - val mem : 'a t -> key -> bool - val iter : (key -> 'a -> unit) -> 'a t -> unit - val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit - val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b - val length : 'a t -> int - val stats : 'a t -> statistics - val to_seq : 'a t -> (key * 'a) Seq.t - val to_seq_keys : 'a t -> key Seq.t - val to_seq_values : 'a t -> 'a Seq.t - val add_seq : 'a t -> (key * 'a) Seq.t -> unit - val replace_seq : 'a t -> (key * 'a) Seq.t -> unit - val of_seq : (key * 'a) Seq.t -> 'a t - end *) -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ module MakeSeeded = Hashtbl.MakeSeeded -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module MakeSeeded : functor (H : SeededHashedType) -> sig type key = H.t type 'a t = 'a Stdcompat__hashtbl_ext.MakeSeeded(H).t val create : ?random:bool -> int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a +val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list +val replace : 'a t -> key -> 'a -> unit +val find_and_replace : 'a t -> key -> 'a -> 'a option val mem : 'a t -> key -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc @@ -348,67 +181,73 @@ val to_seq_values : 'a t -> 'a Stdcompat__seq.t val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@END_BEFORE_5_0_0@ -(** @since 5.0.0: module MakeSeeded = Hashtbl.MakeSeeded +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module MakeSeeded = Hashtbl.MakeSeeded *) -val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t -(** @since 4.12.0: val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t *) +val find_and_remove : ('a, 'b) t -> 'a -> 'b option +(** @since 5.5.0: val find_and_remove : ('a, 'b) t -> 'a -> 'b option *) + +val find_and_replace : ('a, 'b) t -> 'a -> 'b -> 'b option +(** @since 5.5.0: val find_and_replace : ('a, 'b) t -> 'a -> 'b -> 'b option *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val to_seq : ('a, 'b) t -> ('a * 'b) Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val to_seq_keys : ('a, 'b) t -> 'a Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val to_seq_keys : ('a, 'b) t -> 'a Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq_keys : ('a, 'b) t -> 'a Seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq_keys : ('a, 'b) t -> 'a Seq.t *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val to_seq_values : ('a, 'b) t -> 'b Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val to_seq_values : ('a, 'b) t -> 'b Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq_values : ('a, 'b) t -> 'b Seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq_values : ('a, 'b) t -> 'b Seq.t *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val add_seq : ('a, 'b) t -> ('a * 'b) Stdcompat__seq.t -> unit -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val replace_seq : ('a, 'b) t -> ('a * 'b) Stdcompat__seq.t -> unit -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val of_seq : ('a * 'b) Stdcompat__seq.t -> ('a, 'b) t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t *) +val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t +(** @since 4.12.0: val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t *) + val find_opt : ('a, 'b) t -> 'a -> 'b option (** @since 4.05.0: val find_opt : ('a, 'b) t -> 'a -> 'b option *) diff --git a/stdcompat__in_channel_s.mli.in b/stdcompat__in_channel_s.mli.in index 7545b4e..d727ef8 100644 --- a/stdcompat__in_channel_s.mli.in +++ b/stdcompat__in_channel_s.mli.in @@ -45,25 +45,43 @@ type open_flag = | Open_nonblock *) +@BEGIN_FROM_5_5_0@ val input_bigarray : t -> ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> int -> int -> int -(** @since 5.2.0: +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> int +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val input_bigarray : t -> ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - -> int -> int -> int *) + -> int -> int -> int + *) +@BEGIN_FROM_5_5_0@ val really_input_bigarray : t -> ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> int -> int -> unit option -(** @since 5.2.0: +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val really_input_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit option +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val really_input_bigarray : t -> ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - -> int -> int -> unit option *) + -> int -> int -> unit option + *) val is_binary_mode : t -> bool (** @since 5.2.0: val is_binary_mode : t -> bool *) diff --git a/stdcompat__int.ml.in b/stdcompat__int.ml.in index 46dcc9a..f7d3c6e 100644 --- a/stdcompat__int.ml.in +++ b/stdcompat__int.ml.in @@ -30,3 +30,11 @@ external to_float : int -> float = "%floatofint" external of_float : float -> int = "%intoffloat" let to_string = string_of_int @END_BEFORE_4_08_0@ + +@BEGIN_BEFORE_5_5_0@ +include (Stdcompat__generic_int.Make (struct + include Int + + let bitsize = 63 +end)) +@END_BEFORE_5_5_0@ diff --git a/stdcompat__int32.ml.in b/stdcompat__int32.ml.in index 1592254..573bc6f 100644 --- a/stdcompat__int32.ml.in +++ b/stdcompat__int32.ml.in @@ -1,15 +1,5 @@ include Int32 -@BEGIN_BEFORE_4_13_0@ -let min i j = - if compare i j >= 0 then j - else i - -let max i j = - if compare i j >= 0 then i - else j -@END_BEFORE_4_13_0@ - @BEGIN_BEFORE_4_08_0@ let unsigned_compare i j = compare (sub i min_int) (sub j min_int) @@ -91,8 +81,10 @@ let bits_of_float f = unsigned @END_BEFORE_3_08_0@ -@BEGIN_BEFORE_5_1_0@ -let hash = Hashtbl.hash +@BEGIN_BEFORE_5_5_0@ +include (Stdcompat__generic_int.Make (struct + include Int32 -let seeded_hash = Stdcompat__hashtbl.seeded_hash -@END_BEFORE_5_1_0@ + let bitsize = 32 +end)) +@END_BEFORE_5_5_0@ diff --git a/stdcompat__int32_s.mli.in b/stdcompat__int32_s.mli.in index 7cae551..97a9eed 100644 --- a/stdcompat__int32_s.mli.in +++ b/stdcompat__int32_s.mli.in @@ -2,6 +2,36 @@ module type S = sig type t = int32 (** Alias for {!Int32.t} *) +val fdiv : int32 -> int32 -> int32 +(** @since 5.5.0: val fdiv : int32 -> int32 -> int32 *) + +val cdiv : int32 -> int32 -> int32 +(** @since 5.5.0: val cdiv : int32 -> int32 -> int32 *) + +val ediv : int32 -> int32 -> int32 +(** @since 5.5.0: val ediv : int32 -> int32 -> int32 *) + +val erem : int32 -> int32 -> int32 +(** @since 5.5.0: val erem : int32 -> int32 -> int32 *) + +val popcount : t -> int +(** @since 5.5.0: val popcount : t -> int *) + +val unsigned_bitsize : t -> int +(** @since 5.5.0: val unsigned_bitsize : t -> int *) + +val signed_bitsize : t -> int +(** @since 5.5.0: val signed_bitsize : t -> int *) + +val leading_zeros : t -> int +(** @since 5.5.0: val leading_zeros : t -> int *) + +val leading_sign_bits : t -> int +(** @since 5.5.0: val leading_sign_bits : t -> int *) + +val trailing_zeros : t -> int +(** @since 5.5.0: val trailing_zeros : t -> int *) + val seeded_hash : int -> t -> int (** @since 5.1.0: val seeded_hash : int -> t -> int *) diff --git a/stdcompat__int64.ml.in b/stdcompat__int64.ml.in index 6964cc8..96b05a7 100644 --- a/stdcompat__int64.ml.in +++ b/stdcompat__int64.ml.in @@ -1,15 +1,5 @@ include Int64 -@BEGIN_BEFORE_4_13_0@ -let min i j = - if compare i j >= 0 then j - else i - -let max i j = - if compare i j >= 0 then i - else j -@END_BEFORE_4_13_0@ - @BEGIN_BEFORE_4_08_0@ let unsigned_compare i j = compare (sub i min_int) (sub j min_int) @@ -46,8 +36,10 @@ let of_string_opt s = Stdcompat__tools.option_fail of_string s @END_BEFORE_4_05_0@ -@BEGIN_BEFORE_5_1_0@ -let hash = Hashtbl.hash +@BEGIN_BEFORE_5_5_0@ +include (Stdcompat__generic_int.Make (struct + include Int64 -let seeded_hash = Stdcompat__hashtbl.seeded_hash -@END_BEFORE_5_1_0@ + let bitsize = 64 +end)) +@END_BEFORE_5_5_0@ diff --git a/stdcompat__int64_s.mli.in b/stdcompat__int64_s.mli.in index ca9bdd1..6e9dd50 100644 --- a/stdcompat__int64_s.mli.in +++ b/stdcompat__int64_s.mli.in @@ -2,6 +2,36 @@ module type S = sig type t = int64 (** Alias for {!Int64.t} *) +val fdiv : int64 -> int64 -> int64 +(** @since 5.5.0: val fdiv : int64 -> int64 -> int64 *) + +val cdiv : int64 -> int64 -> int64 +(** @since 5.5.0: val cdiv : int64 -> int64 -> int64 *) + +val ediv : int64 -> int64 -> int64 +(** @since 5.5.0: val ediv : int64 -> int64 -> int64 *) + +val erem : int64 -> int64 -> int64 +(** @since 5.5.0: val erem : int64 -> int64 -> int64 *) + +val popcount : t -> int +(** @since 5.5.0: val popcount : t -> int *) + +val unsigned_bitsize : t -> int +(** @since 5.5.0: val unsigned_bitsize : t -> int *) + +val signed_bitsize : t -> int +(** @since 5.5.0: val signed_bitsize : t -> int *) + +val leading_zeros : t -> int +(** @since 5.5.0: val leading_zeros : t -> int *) + +val leading_sign_bits : t -> int +(** @since 5.5.0: val leading_sign_bits : t -> int *) + +val trailing_zeros : t -> int +(** @since 5.5.0: val trailing_zeros : t -> int *) + val seeded_hash : int -> t -> int (** @since 5.1.0: val seeded_hash : int -> t -> int *) diff --git a/stdcompat__int_s.mli.in b/stdcompat__int_s.mli.in index b38c575..942f21f 100644 --- a/stdcompat__int_s.mli.in +++ b/stdcompat__int_s.mli.in @@ -9,6 +9,10 @@ module type S = sig external mul : int -> int -> int = "%mulint" external div : int -> int -> int = "%divint" external rem : int -> int -> int = "%modint" + val fdiv : int -> int -> int + val cdiv : int -> int -> int + val ediv : int -> int -> int + val erem : int -> int -> int external succ : int -> int = "%succint" external pred : int -> int = "%predint" val abs : int -> int @@ -23,7 +27,32 @@ module type S = sig external shift_right_logical : int -> int -> int = "%lsrint" val equal : int -> int -> bool val compare : int -> int -> int + val min : int -> int -> int + val max : int -> int -> int + + val popcount : t -> int + (** @since 5.5.0: val popcount : t -> int *) + + val unsigned_bitsize : t -> int + (** @since 5.5.0: val unsigned_bitsize : t -> int *) + + val signed_bitsize : t -> int + (** @since 5.5.0: val signed_bitsize : t -> int *) + + val leading_zeros : t -> int + (** @since 5.5.0: val leading_zeros : t -> int *) + + val leading_sign_bits : t -> int + (** @since 5.5.0: val leading_sign_bits : t -> int *) + + val trailing_zeros : t -> int + (** @since 5.5.0: val trailing_zeros : t -> int *) + external to_float : int -> float = "%floatofint" external of_float : float -> int = "%intoffloat" val to_string : int -> string + + val seeded_hash : int -> int -> int + + val hash : int -> int end diff --git a/stdcompat__lazy.ml.in b/stdcompat__lazy.ml.in index f81594c..a8dce81 100644 --- a/stdcompat__lazy.ml.in +++ b/stdcompat__lazy.ml.in @@ -18,3 +18,17 @@ let map_val f v = else map f v @END_BEFORE_4_13_0@ + +@BEGIN_BEFORE_5_5_0@ +module Mutexed = struct + type 'a t = 'a Lazy.t + + let is_val = is_val + + let from_val = from_val + + let from_fun = from_fun + + let force = force +end +@END_BEFORE_5_5_0@ diff --git a/stdcompat__lazy_s.mli.in b/stdcompat__lazy_s.mli.in index 9cfa732..92459c0 100644 --- a/stdcompat__lazy_s.mli.in +++ b/stdcompat__lazy_s.mli.in @@ -1,16 +1,27 @@ module type S = sig -@BEGIN_FROM_4_08_0@ +@BEGIN_FROM_5_5_0@ type 'a t = 'a CamlinternalLazy.t -@END_FROM_4_08_0@ -@BEGIN_BEFORE_4_08_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ type 'a t = 'a Stdcompat__init.lazy_t -@END_BEFORE_4_08_0@ -(** @since 4.08.0: type 'a t = 'a CamlinternalLazy.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: type 'a t = 'a CamlinternalLazy.t *) exception Undefined (** Alias for {!Lazy.Undefined} *) +@BEGIN_FROM_5_5_0@ +module Mutexed = Lazy.Mutexed +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +module Mutexed : +sig type 'a t val is_val : 'a t -> bool val from_val : 'a -> 'a t +val from_fun : (unit -> 'a) -> 'a t val force : 'a t -> 'a end +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Mutexed = Lazy.Mutexed + *) + val map : ('a -> 'b) -> 'a t -> 'b t (** @since 4.13.0: val map : ('a -> 'b) -> 'a t -> 'b t *) diff --git a/stdcompat__list.ml.in b/stdcompat__list.ml.in index a732b97..5e38ef2 100644 --- a/stdcompat__list.ml.in +++ b/stdcompat__list.ml.in @@ -246,3 +246,29 @@ let rec drop_while p = function @END_BEFORE_5_3_0@ + +@BEGIN_BEFORE_5_4_0@ +let singleton x = [x] +@END_BEFORE_5_4_0@ + +@BEGIN_BEFORE_5_5_0@ +let filter_mapi f list = + let rec aux index accu list = + match list with + | [] -> rev accu + | head :: tail -> + let accu' = + match f index head with + | None -> accu + | Some head' -> head' :: accu in + aux (succ index) accu' tail in + aux 0 [] list + +let rec split_map f l = + match l with + | [] -> [], [] + | hd :: tl -> + let hd_a, hd_b = f hd in + let tl_a, tl_b = split_map f tl in + hd_a :: tl_a, hd_b :: tl_b +@END_BEFORE_5_5_0@ diff --git a/stdcompat__list_s.mli.in b/stdcompat__list_s.mli.in index eff4508..01f5ff7 100644 --- a/stdcompat__list_s.mli.in +++ b/stdcompat__list_s.mli.in @@ -24,6 +24,60 @@ type 'a t = 'a list | (::) of 'a * 'a list *) +val filter_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b list +(** @since 5.5.0: + val filter_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b list *) + +@BEGIN_FROM_5_5_0@ +val partition_map : + ('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val partition_map : + ('a -> ('b, 'c) Stdcompat__either.t) -> 'a list -> ('b list * 'c list) +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val partition_map : + ('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) + *) + +val split_map : ('c -> ('a * 'b)) -> 'c list -> ('a list * 'b list) +(** @since 5.5.0: + val split_map : ('c -> ('a * 'b)) -> 'c list -> ('a list * 'b list) *) + +@BEGIN_FROM_5_5_0@ +val to_seq : 'a list -> 'a Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seq : 'a list -> 'a Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : 'a list -> 'a Seq.t + *) + +@BEGIN_FROM_5_5_0@ +val of_seq : 'a Seq.t -> 'a list +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val of_seq : 'a Stdcompat__seq.t -> 'a list +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : 'a Seq.t -> 'a list + *) + +val singleton : 'a -> 'a list +(** @since 5.4.0: val singleton : 'a -> 'a list *) + +val take : int -> 'a list -> 'a list +(** @since 5.3.0: val take : int -> 'a list -> 'a list *) + +val drop : int -> 'a list -> 'a list +(** @since 5.3.0: val drop : int -> 'a list -> 'a list *) + +val take_while : ('a -> bool) -> 'a list -> 'a list +(** @since 5.3.0: val take_while : ('a -> bool) -> 'a list -> 'a list *) + +val drop_while : ('a -> bool) -> 'a list -> 'a list +(** @since 5.3.0: val drop_while : ('a -> bool) -> 'a list -> 'a list *) + val is_empty : 'a list -> bool (** @since 5.1.0: val is_empty : 'a list -> bool *) @@ -42,19 +96,6 @@ val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int (** @since 4.12.0: val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int *) -@BEGIN_FROM_4_12_0@ -val partition_map : - ('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -val partition_map : - ('a -> ('b, 'c) Stdcompat__either.t) -> 'a list -> ('b list * 'c list) -@END_BEFORE_4_12_0@ -(** @since 4.12.0: - val partition_map : - ('a -> ('b, 'c) Either.t) -> 'a list -> ('b list * 'c list) - *) - @BEGIN_FROM_5_1_0@ val fold_left_map : ('acc -> 'a -> ('acc * 'b)) -> 'acc -> 'a list -> ('acc * 'b list) @@ -90,24 +131,6 @@ val find_map : ('a -> 'b option) -> 'a list -> 'b option val filter_map : ('a -> 'b option) -> 'a list -> 'b list (** @since 4.08.0: val filter_map : ('a -> 'b option) -> 'a list -> 'b list *) -@BEGIN_FROM_4_07_0@ -val to_seq : 'a list -> 'a Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seq : 'a list -> 'a Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq : 'a list -> 'a Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val of_seq : 'a Seq.t -> 'a list -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val of_seq : 'a Stdcompat__seq.t -> 'a list -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val of_seq : 'a Seq.t -> 'a list - *) - val init : int -> (int -> 'a) -> 'a list (** @since 4.06.0: val init : int -> (int -> 'a) -> 'a list *) @@ -302,9 +325,4 @@ val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list (** Alias for {!List.merge} *) -val take : int -> 'a list -> 'a list -val drop : int -> 'a list -> 'a list -val take_while : ('a -> bool) -> 'a list -> 'a list -val drop_while : ('a -> bool) -> 'a list -> 'a list - end diff --git a/stdcompat__map.ml.in b/stdcompat__map.ml.in index cd5d81e..ed01451 100644 --- a/stdcompat__map.ml.in +++ b/stdcompat__map.ml.in @@ -34,7 +34,9 @@ val filter : (key -> 'a -> bool) -> 'a t -> 'a t val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) val split : key -> 'a t -> ('a t * 'a option * 'a t) -val is_empty : 'a t -> bool val mem : key -> 'a t -> bool +val is_empty : 'a t -> bool +val is_singleton : 'a t -> bool +val mem : key -> 'a t -> bool val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int val for_all : (key -> 'a -> bool) -> 'a t -> bool @@ -47,10 +49,10 @@ val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t val of_seq : (key * 'a) Seq.t -> 'a t end -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Make = Map.Make -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Make (Ord : OrderedType) = struct include Map.Make (Ord) @@ -62,22 +64,22 @@ module Make (Ord : OrderedType) = struct @END_BEFORE_4_07_0@ @BEGIN_WITH_MAGIC@ - @BEGIN_BEFORE_4_12_0@ + @BEGIN_BEFORE_5_5_0@ type 'a internal = | Empty | Node of 'a internal * key * 'a * 'a internal * int @BEGIN_FROM_4_02_0@ [@@ocaml.warning "-37"] @END_FROM_4_02_0@ - @END_BEFORE_4_12_0@ + @END_BEFORE_5_5_0@ @BEGIN_BEFORE_4_11_0@ external t_of_internal : 'a internal -> 'a t = "%identity" @END_BEFORE_4_11_0@ - @BEGIN_BEFORE_4_12_0@ + @BEGIN_BEFORE_5_5_0@ external internal_of_t : 'a t -> 'a internal = "%identity" - @END_BEFORE_4_12_0@ + @END_BEFORE_5_5_0@ @BEGIN_BEFORE_4_05_0@ let rec min_binding_aux l v d = @@ -609,7 +611,6 @@ module Make (Ord : OrderedType) = struct equal_aux (cons_enum r1 e1) (cons_enum r2 e2) in equal_aux (cons_enum m1 End) (cons_enum m2 End) - let equal eq (map : 'a t) (map' : 'a t) = let map : 'a internal = internal_of_t map in let map' : 'a internal = internal_of_t map' in @@ -878,5 +879,25 @@ module Make (Ord : OrderedType) = struct let of_list l = List.fold_left (fun acc (key, value) -> add key value acc) empty l @END_BEFORE_5_1_0@ + +@BEGIN_BEFORE_5_5_0@ + @BEGIN_WITH_MAGIC@ + let is_singleton m = + match internal_of_t m with + Node (Empty, _key, _v, Empty, _w) -> true + | Empty + | Node (Node _, _, _, _, _) + | Node (_, _, _, Node _, _) -> false + @END_WITH_MAGIC@ + @BEGIN_WITHOUT_MAGIC@ + let is_singleton m = + let has_one_element = ref false in + try + iter (fun _ _ -> if !has_one_element then raise Exit else has_one_element := true) m; + !has_one_element + with Exit -> + false + @END_WITHOUT_MAGIC@ +@END_BEFORE_5_5_0@ end -@END_BEFORE_5_1_0@ +@END_BEFORE_5_5_0@ diff --git a/stdcompat__map_s.mli.in b/stdcompat__map_s.mli.in index 4a08dd7..54b3946 100644 --- a/stdcompat__map_s.mli.in +++ b/stdcompat__map_s.mli.in @@ -2,7 +2,6 @@ module type S = sig module type OrderedType = sig type t val compare : t -> t -> int end (** Alias for {!Map.OrderedType} *) -@BEGIN_FROM_5_1_0@ module type S = sig type key @BEGIN_FROM_4_12_0@ type +!'a t @END_FROM_4_12_0@ @@ -35,7 +34,9 @@ val filter : (key -> 'a -> bool) -> 'a t -> 'a t val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) val split : key -> 'a t -> ('a t * 'a option * 'a t) -val is_empty : 'a t -> bool val mem : key -> 'a t -> bool +val is_empty : 'a t -> bool +val is_singleton : 'a t -> bool +val mem : key -> 'a t -> bool val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int val for_all : (key -> 'a -> bool) -> 'a t -> bool @@ -47,55 +48,7 @@ val to_seq_from : key -> 'a t -> (key * 'a) Seq.t val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t val of_seq : (key * 'a) Seq.t -> 'a t end -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ -module type S = -sig type key -@BEGIN_FROM_4_12_0@ -type +!'a t -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -type +'a t -@END_BEFORE_4_12_0@ -val empty : 'a t val add : key -> 'a -> 'a t -> 'a t -val add_to_list : key -> 'a -> 'a list t -> 'a list t -val update : key -> ('a option -> 'a option) -> 'a t -> 'a t -val singleton : key -> 'a -> 'a t val remove : key -> 'a t -> 'a t -val merge : - (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t -val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t -val cardinal : 'a t -> int val bindings : 'a t -> (key * 'a) list -val min_binding : 'a t -> (key * 'a) -val min_binding_opt : 'a t -> (key * 'a) option -val max_binding : 'a t -> (key * 'a) -val max_binding_opt : 'a t -> (key * 'a) option -val choose : 'a t -> (key * 'a) val choose_opt : 'a t -> (key * 'a) option -val find : key -> 'a t -> 'a val find_opt : key -> 'a t -> 'a option -val find_first : (key -> bool) -> 'a t -> (key * 'a) -val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option -val find_last : (key -> bool) -> 'a t -> (key * 'a) -val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option -val iter : (key -> 'a -> unit) -> 'a t -> unit -val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc -val map : ('a -> 'b) -> 'a t -> 'b t -val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t -val filter : (key -> 'a -> bool) -> 'a t -> 'a t -val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t -val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) -val split : key -> 'a t -> ('a t * 'a option * 'a t) -val is_empty : 'a t -> bool val mem : key -> 'a t -> bool -val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool -val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int -val for_all : (key -> 'a -> bool) -> 'a t -> bool -val exists : (key -> 'a -> bool) -> 'a t -> bool -val to_list : 'a t -> (key * 'a) list val of_list : (key * 'a) list -> 'a t -val to_seq : 'a t -> (key * 'a) Stdcompat__seq.t -val to_rev_seq : 'a t -> (key * 'a) Stdcompat__seq.t -val to_seq_from : key -> 'a t -> (key * 'a) Stdcompat__seq.t -val add_seq : (key * 'a) Stdcompat__seq.t -> 'a t -> 'a t -val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@END_BEFORE_5_1_0@ -(** @since 5.1.0: +(** @since 5.5.0: module type S = sig type key @@ -133,6 +86,7 @@ val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) val split : key -> 'a t -> ('a t * 'a option * 'a t) val is_empty : 'a t -> bool + val is_singleton : 'a t -> bool val mem : key -> 'a t -> bool val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int @@ -148,52 +102,14 @@ val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end end *) -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Make = Map.Make -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Make : -functor (Ord : OrderedType) -> -sig type key = Ord.t type +'a t = 'a Map.Make(Ord).t val empty : 'a t -val add : key -> 'a -> 'a t -> 'a t -val add_to_list : key -> 'a -> 'a list t -> 'a list t -val update : key -> ('a option -> 'a option) -> 'a t -> 'a t -val singleton : key -> 'a -> 'a t val remove : key -> 'a t -> 'a t -val merge : - (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t -val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t -val cardinal : 'a t -> int val bindings : 'a t -> (key * 'a) list -val min_binding : 'a t -> (key * 'a) -val min_binding_opt : 'a t -> (key * 'a) option -val max_binding : 'a t -> (key * 'a) -val max_binding_opt : 'a t -> (key * 'a) option -val choose : 'a t -> (key * 'a) val choose_opt : 'a t -> (key * 'a) option -val find : key -> 'a t -> 'a val find_opt : key -> 'a t -> 'a option -val find_first : (key -> bool) -> 'a t -> (key * 'a) -val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option -val find_last : (key -> bool) -> 'a t -> (key * 'a) -val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option -val iter : (key -> 'a -> unit) -> 'a t -> unit -val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc -val map : ('a -> 'b) -> 'a t -> 'b t -val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t -val filter : (key -> 'a -> bool) -> 'a t -> 'a t -val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t -val partition : (key -> 'a -> bool) -> 'a t -> ('a t * 'a t) -val split : key -> 'a t -> ('a t * 'a option * 'a t) -val is_empty : 'a t -> bool val mem : key -> 'a t -> bool -val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool -val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int -val for_all : (key -> 'a -> bool) -> 'a t -> bool -val exists : (key -> 'a -> bool) -> 'a t -> bool -val to_list : 'a t -> (key * 'a) list val of_list : (key * 'a) list -> 'a t -val to_seq : 'a t -> (key * 'a) Stdcompat__seq.t -val to_rev_seq : 'a t -> (key * 'a) Stdcompat__seq.t -val to_seq_from : key -> 'a t -> (key * 'a) Stdcompat__seq.t -val add_seq : (key * 'a) Stdcompat__seq.t -> 'a t -> 'a t -val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end -@END_BEFORE_5_1_0@ -(** @since 5.1.0: module Make = Map.Make +functor (Ord : OrderedType) -> S with type key = Ord.t and type +'a t = 'a Map.Make(Ord).t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Make = Map.Make *) end diff --git a/stdcompat__moreLabels.ml.in b/stdcompat__moreLabels.ml.in index 43ba01e..ad6fa67 100644 --- a/stdcompat__moreLabels.ml.in +++ b/stdcompat__moreLabels.ml.in @@ -1,20 +1,20 @@ -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ module Hashtbl = MoreLabels.Hashtbl -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Hashtbl = Stdcompat__hashtbl -@END_BEFORE_5_0_0@ +@END_BEFORE_5_5_0@ -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Map = MoreLabels.Map -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Map = Stdcompat__map -@END_BEFORE_5_1_0@ +@END_BEFORE_5_5_0@ -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Set = MoreLabels.Set -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Set = Stdcompat__set -@END_BEFORE_5_1_0@ +@END_BEFORE_5_5_0@ diff --git a/stdcompat__moreLabels_s.mli.in b/stdcompat__moreLabels_s.mli.in index 2242313..ce90da2 100644 --- a/stdcompat__moreLabels_s.mli.in +++ b/stdcompat__moreLabels_s.mli.in @@ -1,8 +1,8 @@ module type S = sig -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ module Hashtbl = MoreLabels.Hashtbl -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Hashtbl : sig type ('a, 'b) t = ('a, 'b) Hashtbl.t val create : ?random:bool -> int -> ('a, 'b) t val clear : ('a, 'b) t -> unit @@ -12,7 +12,9 @@ val find : ('a, 'b) t -> 'a -> 'b val find_opt : ('a, 'b) t -> 'a -> 'b option val find_all : ('a, 'b) t -> 'a -> 'b list val mem : ('a, 'b) t -> 'a -> bool val remove : ('a, 'b) t -> 'a -> unit +val find_and_remove : ('a, 'b) t -> 'a -> 'b option val replace : ('a, 'b) t -> key:'a -> data:'b -> unit +val find_and_replace : ('a, 'b) t -> key:'a -> data:'b -> 'b option val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit val filter_map_inplace : f:(key:'a -> data:'b -> 'b option) -> ('a, 'b) t -> unit @@ -38,18 +40,19 @@ module type HashedType = sig type t val equal : t -> t -> bool val hash : t -> int end module type S = sig type key - @BEGIN_FROM_4_12_0@ - type !'a t - @END_FROM_4_12_0@ - @BEGIN_BEFORE_4_12_0@ - type 'a t - @END_BEFORE_4_12_0@ +@BEGIN_FROM_4_12_0@ +type !'a t +@END_FROM_4_12_0@ +@BEGIN_BEFORE_4_12_0@ +type 'a t +@END_BEFORE_4_12_0@ val create : int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key:key -> data:'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a +val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key:key -> data:'a -> unit +val find_and_replace : 'a t -> key:key -> data:'a -> 'a option val mem : 'a t -> key -> bool val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit @@ -67,9 +70,10 @@ functor (H : HashedType) -> sig type key = H.t type 'a t = 'a Hashtbl.Make(H).t val create : int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key:key -> data:'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a +val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key:key -> data:'a -> unit +val find_and_replace : 'a t -> key:key -> data:'a -> 'a option val mem : 'a t -> key -> bool val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit @@ -95,9 +99,10 @@ type 'a t val create : ?random:bool -> int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key:key -> data:'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a +val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key:key -> data:'a -> unit +val find_and_replace : 'a t -> key:key -> data:'a -> 'a option val mem : 'a t -> key -> bool val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit @@ -116,9 +121,10 @@ sig type key = H.t type 'a t = 'a Stdcompat__hashtbl_ext.MakeSeeded(H).t val create : ?random:bool -> int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key:key -> data:'a -> unit val remove : 'a t -> key -> unit -val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option -val find_all : 'a t -> key -> 'a list +val find_and_remove : 'a t -> key -> 'a option val find : 'a t -> key -> 'a +val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key:key -> data:'a -> unit +val find_and_replace : 'a t -> key:key -> data:'a -> 'a option val mem : 'a t -> key -> bool val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit @@ -133,14 +139,14 @@ val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end val hash : 'a -> int val seeded_hash : int -> 'a -> int val hash_param : int -> int -> 'a -> int val seeded_hash_param : int -> int -> int -> 'a -> int end -@END_BEFORE_5_0_0@ -(** @since 5.0.0: module Hashtbl = MoreLabels.Hashtbl +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Hashtbl = MoreLabels.Hashtbl *) -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Map = MoreLabels.Map -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Map : sig module type OrderedType = sig type t val compare : t -> t -> int end module type S = @@ -179,7 +185,8 @@ val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) val split : key -> 'a t -> ('a t * 'a option * 'a t) -val is_empty : 'a t -> bool val mem : key -> 'a t -> bool +val is_empty : 'a t -> bool val is_singleton : 'a t -> bool +val mem : key -> 'a t -> bool val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int val for_all : f:(key -> 'a -> bool) -> 'a t -> bool @@ -220,7 +227,8 @@ val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t val partition : f:(key -> 'a -> bool) -> 'a t -> ('a t * 'a t) val split : key -> 'a t -> ('a t * 'a option * 'a t) -val is_empty : 'a t -> bool val mem : key -> 'a t -> bool +val is_empty : 'a t -> bool val is_singleton : 'a t -> bool +val mem : key -> 'a t -> bool val equal : cmp:('a -> 'a -> bool) -> 'a t -> 'a t -> bool val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int val for_all : f:(key -> 'a -> bool) -> 'a t -> bool @@ -231,14 +239,14 @@ val to_rev_seq : 'a t -> (key * 'a) Stdcompat__seq.t val to_seq_from : key -> 'a t -> (key * 'a) Stdcompat__seq.t val add_seq : (key * 'a) Stdcompat__seq.t -> 'a t -> 'a t val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t end end -@END_BEFORE_5_1_0@ -(** @since 5.1.0: module Map = MoreLabels.Map +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Map = MoreLabels.Map *) -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Set = MoreLabels.Set -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Set : sig module type OrderedType = sig type t val compare : t -> t -> int end module type S = @@ -260,9 +268,9 @@ val map : f:(elt -> elt) -> t -> t val filter : f:(elt -> bool) -> t -> t val filter_map : f:(elt -> elt option) -> t -> t val partition : f:(elt -> bool) -> t -> (t * t) val split : elt -> t -> (t * bool * t) val is_empty : t -> bool -val mem : elt -> t -> bool val equal : t -> t -> bool -val compare : t -> t -> int val subset : t -> t -> bool -val for_all : f:(elt -> bool) -> t -> bool +val is_singleton : t -> bool val mem : elt -> t -> bool +val equal : t -> t -> bool val compare : t -> t -> int +val subset : t -> t -> bool val for_all : f:(elt -> bool) -> t -> bool val exists : f:(elt -> bool) -> t -> bool val to_list : t -> elt list val of_list : elt list -> t val to_seq_from : elt -> t -> elt Stdcompat__seq.t @@ -290,9 +298,9 @@ val map : f:(elt -> elt) -> t -> t val filter : f:(elt -> bool) -> t -> t val filter_map : f:(elt -> elt option) -> t -> t val partition : f:(elt -> bool) -> t -> (t * t) val split : elt -> t -> (t * bool * t) val is_empty : t -> bool -val mem : elt -> t -> bool val equal : t -> t -> bool -val compare : t -> t -> int val subset : t -> t -> bool -val for_all : f:(elt -> bool) -> t -> bool +val is_singleton : t -> bool val mem : elt -> t -> bool +val equal : t -> t -> bool val compare : t -> t -> int +val subset : t -> t -> bool val for_all : f:(elt -> bool) -> t -> bool val exists : f:(elt -> bool) -> t -> bool val to_list : t -> elt list val of_list : elt list -> t val to_seq_from : elt -> t -> elt Stdcompat__seq.t @@ -300,8 +308,8 @@ val to_seq : t -> elt Stdcompat__seq.t val to_rev_seq : t -> elt Stdcompat__seq.t val add_seq : elt Stdcompat__seq.t -> t -> t val of_seq : elt Stdcompat__seq.t -> t end end -@END_BEFORE_5_1_0@ -(** @since 5.1.0: module Set = MoreLabels.Set +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Set = MoreLabels.Set *) end diff --git a/stdcompat__nativeint.ml.in b/stdcompat__nativeint.ml.in index c69fede..55ff809 100644 --- a/stdcompat__nativeint.ml.in +++ b/stdcompat__nativeint.ml.in @@ -1,15 +1,5 @@ include Nativeint -@BEGIN_BEFORE_4_13_0@ -let min i j = - if compare i j >= 0 then j - else i - -let max i j = - if compare i j >= 0 then i - else j -@END_BEFORE_4_13_0@ - @BEGIN_BEFORE_4_08_0@ let unsigned_compare i j = compare (sub i min_int) (sub j min_int) @@ -46,8 +36,10 @@ let of_string_opt s = Stdcompat__tools.option_fail of_string s @END_BEFORE_4_05_0@ -@BEGIN_BEFORE_5_1_0@ -let hash = Hashtbl.hash +@BEGIN_BEFORE_5_5_0@ +include (Stdcompat__generic_int.Make (struct + include Nativeint -let seeded_hash = Stdcompat__hashtbl.seeded_hash -@END_BEFORE_5_1_0@ + let bitsize = 64 +end)) +@END_BEFORE_5_5_0@ diff --git a/stdcompat__nativeint_s.mli.in b/stdcompat__nativeint_s.mli.in index 2a62d2a..db3f121 100644 --- a/stdcompat__nativeint_s.mli.in +++ b/stdcompat__nativeint_s.mli.in @@ -2,6 +2,36 @@ module type S = sig type t = nativeint (** Alias for {!Nativeint.t} *) +val fdiv : nativeint -> nativeint -> nativeint +(** @since 5.5.0: val fdiv : nativeint -> nativeint -> nativeint *) + +val cdiv : nativeint -> nativeint -> nativeint +(** @since 5.5.0: val cdiv : nativeint -> nativeint -> nativeint *) + +val ediv : nativeint -> nativeint -> nativeint +(** @since 5.5.0: val ediv : nativeint -> nativeint -> nativeint *) + +val erem : nativeint -> nativeint -> nativeint +(** @since 5.5.0: val erem : nativeint -> nativeint -> nativeint *) + +val popcount : t -> int +(** @since 5.5.0: val popcount : t -> int *) + +val unsigned_bitsize : t -> int +(** @since 5.5.0: val unsigned_bitsize : t -> int *) + +val signed_bitsize : t -> int +(** @since 5.5.0: val signed_bitsize : t -> int *) + +val leading_zeros : t -> int +(** @since 5.5.0: val leading_zeros : t -> int *) + +val leading_sign_bits : t -> int +(** @since 5.5.0: val leading_sign_bits : t -> int *) + +val trailing_zeros : t -> int +(** @since 5.5.0: val trailing_zeros : t -> int *) + val seeded_hash : int -> t -> int (** @since 5.1.0: val seeded_hash : int -> t -> int *) diff --git a/stdcompat__option.ml.in b/stdcompat__option.ml.in index fff3651..d2ae22f 100644 --- a/stdcompat__option.ml.in +++ b/stdcompat__option.ml.in @@ -77,3 +77,34 @@ let to_seq o = | Some v -> fun () -> Stdcompat__seq.Cons (v, Stdcompat__seq.empty) | None -> Stdcompat__seq.empty @END_BEFORE_4_08_0@ + +@BEGIN_BEFORE_5_5_0@ +let product o o' = + match o, o' with + | None, _ | _, None -> None + | Some v, Some v' -> Some (v, v') + +let blend f o o' = + match o, o' with + | None, None -> None + | Some v, None + | None, Some v -> Some v + | Some v, Some v' -> Some (f v v') + +let for_all f o = + match o with + | None -> true + | Some v -> f v + +let exists f o = + match o with + | None -> false + | Some v -> f v + +module Syntax = struct + let ( let* ) = bind + let ( and* ) = product + let (let+) o f = map f o + let (and+) = product +end +@END_BEFORE_5_5_0@ diff --git a/stdcompat__option_s.mli.in b/stdcompat__option_s.mli.in index 54195f9..19de79c 100644 --- a/stdcompat__option_s.mli.in +++ b/stdcompat__option_s.mli.in @@ -14,6 +14,41 @@ type 'a t = 'a option = | Some of 'a *) +@BEGIN_FROM_5_5_0@ +module Syntax = Option.Syntax +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +module Syntax : +sig val ( let* ) : 'a option -> ('a -> 'b option) -> 'b option +val ( and* ) : 'a option -> 'b option -> ('a * 'b) option +val (let+) : 'a option -> ('a -> 'b) -> 'b option +val (and+) : 'a option -> 'b option -> ('a * 'b) option end +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Syntax = Option.Syntax + *) + +val product : 'a option -> 'b option -> ('a * 'b) option +(** @since 5.5.0: val product : 'a option -> 'b option -> ('a * 'b) option *) + +val blend : ('a -> 'a -> 'a) -> 'a option -> 'a option -> 'a option +(** @since 5.5.0: + val blend : ('a -> 'a -> 'a) -> 'a option -> 'a option -> 'a option *) + +val for_all : ('a -> bool) -> 'a option -> bool +(** @since 5.5.0: val for_all : ('a -> bool) -> 'a option -> bool *) + +val exists : ('a -> bool) -> 'a option -> bool +(** @since 5.5.0: val exists : ('a -> bool) -> 'a option -> bool *) + +@BEGIN_FROM_5_5_0@ +val to_seq : 'a option -> 'a Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seq : 'a option -> 'a Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : 'a option -> 'a Seq.t + *) + val none : 'a option (** @since 4.08.0: val none : 'a option *) @@ -67,13 +102,4 @@ val to_result : none:'e -> 'a option -> ('a, 'e) Stdcompat__pervasives.result val to_list : 'a option -> 'a list (** @since 4.08.0: val to_list : 'a option -> 'a list *) -@BEGIN_FROM_4_08_0@ -val to_seq : 'a option -> 'a Seq.t -@END_FROM_4_08_0@ -@BEGIN_BEFORE_4_08_0@ -val to_seq : 'a option -> 'a Stdcompat__seq.t -@END_BEFORE_4_08_0@ -(** @since 4.08.0: val to_seq : 'a option -> 'a Seq.t - *) - end diff --git a/stdcompat__out_channel_s.mli.in b/stdcompat__out_channel_s.mli.in index a846e63..d0dc673 100644 --- a/stdcompat__out_channel_s.mli.in +++ b/stdcompat__out_channel_s.mli.in @@ -45,15 +45,24 @@ type open_flag = | Open_nonblock *) +@BEGIN_FROM_5_5_0@ val output_bigarray : t -> ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> int -> int -> unit -(** @since 5.2.0: +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val output_bigarray : + t -> + ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> int -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val output_bigarray : t -> ('a, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - -> int -> int -> unit *) + -> int -> int -> unit + *) val is_binary_mode : t -> bool (** @since 5.2.0: val is_binary_mode : t -> bool *) diff --git a/stdcompat__printexc_s.mli.in b/stdcompat__printexc_s.mli.in index da153fd..aa64dae 100644 --- a/stdcompat__printexc_s.mli.in +++ b/stdcompat__printexc_s.mli.in @@ -105,8 +105,14 @@ type raw_backtrace_slot (** @since 4.02.0: type raw_backtrace_slot *) +@BEGIN_FROM_5_5_0@ val string_of_extension_constructor : Obj.t -> string -(** @since 5.0.0: val string_of_extension_constructor : Obj.t -> string *) +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val string_of_extension_constructor : Obj.t -> string +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val string_of_extension_constructor : Obj.t -> string + *) val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array (** @since 4.12.0: diff --git a/stdcompat__printf.ml.in b/stdcompat__printf.ml.in index d162333..c286ef0 100644 --- a/stdcompat__printf.ml.in +++ b/stdcompat__printf.ml.in @@ -1,3 +1,5 @@ +include Printf + @BEGIN_BEFORE_4_11_0@ let not_implemented _ = failwith "Stdcompat.Printf is not implemented yet. Please fill an issue: https://github.com/ocamllibs/stdcompat/issues ." @@ -21,4 +23,21 @@ let ksprintf = not_implemented let ikfprintf = not_implemented @END_BEFORE_4_01_0@ -include Printf +@BEGIN_BEFORE_5_5_0@ +module Args = Stdcompat__format.Args + +let lfprintf chan pp args = + Args.apply (fprintf chan pp) args + +let lbprintf buf pp args = + Args.apply (bprintf buf pp) args + +let lprintf pp args = + Args.apply (printf pp) args + +let leprintf pp args = + Args.apply (eprintf pp) args + +let lsprintf pp args = + Args.apply (sprintf pp) args +@END_BEFORE_5_5_0@ diff --git a/stdcompat__printf_s.mli.in b/stdcompat__printf_s.mli.in index a0a9900..0ca56b9 100644 --- a/stdcompat__printf_s.mli.in +++ b/stdcompat__printf_s.mli.in @@ -1,13 +1,127 @@ module type S = sig +@BEGIN_FROM_5_5_0@ +module Args = Printf.Args +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +module Args : sig @BEGIN_FROM_4_00_0@ +type ('a, 'r) t = + | []: ('r, 'r) t + | (::): 'a * ('b, 'r) t -> ('a -> 'b, 'r) t +@END_FROM_4_00_0@ +@BEGIN_BEFORE_4_00_0@ +type ('a, 'r) t = + | [] + | (::) of 'a * ('b, 'r) t +@END_BEFORE_4_00_0@ + val apply : 'a -> ('a, 'r) t -> 'r +val (@) : ('a, 'r1) t -> ('r1, 'r2) t -> ('a, 'r2) t +end +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Args = Printf.Args + *) + +@BEGIN_FROM_5_5_0@ +val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a + *) + +@BEGIN_FROM_5_5_0@ val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a -(** @since 4.11.0: - val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a *) +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val ibprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a + *) +@BEGIN_FROM_5_5_0@ +val kbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val kbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val kbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a + *) + +@BEGIN_FROM_5_5_0@ val ikbprintf : (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a -(** @since 4.11.0: +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val ikbprintf : + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val ikbprintf : - (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a *) + (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a + *) + +@BEGIN_FROM_5_5_0@ +val lfprintf : + out_channel -> ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val lfprintf : + out_channel -> ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val lfprintf : + out_channel -> + ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val lbprintf : + Buffer.t -> ('a, Buffer.t, unit) format -> ('a, unit) Args.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val lbprintf : + Buffer.t -> ('a, Buffer.t, unit) format -> ('a, unit) Args.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val lbprintf : + Buffer.t -> ('a, Buffer.t, unit) format -> ('a, unit) Args.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val lprintf : ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val lprintf : ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val lprintf : ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val leprintf : ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val leprintf : ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val leprintf : + ('a, out_channel, unit) format -> ('a, unit) Args.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val lsprintf : ('a, unit, string) format -> ('a, string) Args.t -> string +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val lsprintf : ('a, unit, string) format -> ('a, string) Args.t -> string +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val lsprintf : ('a, unit, string) format -> ('a, string) Args.t -> string + *) @BEGIN_FROM_4_03_0@ val ifprintf : 'b -> ('a, 'b, 'c, unit) format4 -> 'a @@ -40,29 +154,6 @@ val ikfprintf : ('b -> 'd) -> 'b -> ('a, 'b, 'c, 'd) format4 -> 'a (** @since 4.03.0: val ikfprintf : ('b -> 'd) -> 'b -> ('a, 'b, 'c, 'd) format4 -> 'a *) -@BEGIN_FROM_4_03_0@ -val kbprintf : - (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a -@END_FROM_4_03_0@ -@BEGIN_BEFORE_4_03_0@ -@BEGIN_FROM_3_10_0@ -val kbprintf : - (Buffer.t -> 'a) -> Buffer.t -> ('b, Buffer.t, unit, 'a) format4 -> 'b -@END_FROM_3_10_0@ -@BEGIN_BEFORE_3_10_0@ -val kbprintf : - (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a -@END_BEFORE_3_10_0@ - -@END_BEFORE_4_03_0@ -(** @since 4.03.0: - val kbprintf : - (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> 'a -@since 3.10.0: -val kbprintf : - (Buffer.t -> 'a) -> Buffer.t -> ('b, Buffer.t, unit, 'a) format4 -> 'b - *) - @BEGIN_FROM_4_03_0@ val kfprintf : (out_channel -> 'd) -> @@ -121,9 +212,6 @@ val eprintf : ('a, out_channel, unit) format -> 'a val sprintf : ('a, unit, string) format -> 'a (** Alias for {!Printf.sprintf} *) -val bprintf : Buffer.t -> ('a, Buffer.t, unit) format -> 'a -(** Alias for {!Printf.bprintf} *) - @BEGIN_FROM_4_03_0@ val kprintf : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a @END_FROM_4_03_0@ diff --git a/stdcompat__queue_s.mli.in b/stdcompat__queue_s.mli.in index 2e5984f..17e46bb 100644 --- a/stdcompat__queue_s.mli.in +++ b/stdcompat__queue_s.mli.in @@ -11,39 +11,42 @@ type 'a t = 'a Queue.t exception Empty (** Alias for {!Queue.Empty} *) -val take_opt : 'a t -> 'a option -(** @since 4.08.0: val take_opt : 'a t -> 'a option *) - -val peek_opt : 'a t -> 'a option -(** @since 4.08.0: val peek_opt : 'a t -> 'a option *) - -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val to_seq : 'a t -> 'a Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val to_seq : 'a t -> 'a Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq : 'a t -> 'a Seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : 'a t -> 'a Seq.t *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val add_seq : 'a t -> 'a Seq.t -> unit -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val add_seq : 'a t -> 'a Stdcompat__seq.t -> unit -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val add_seq : 'a t -> 'a Seq.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val add_seq : 'a t -> 'a Seq.t -> unit *) -@BEGIN_FROM_4_07_0@ +@BEGIN_FROM_5_5_0@ val of_seq : 'a Seq.t -> 'a t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val of_seq : 'a Stdcompat__seq.t -> 'a t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val of_seq : 'a Seq.t -> 'a t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : 'a Seq.t -> 'a t *) +val drop : 'a t -> unit +(** @since 5.3.0: val drop : 'a t -> unit *) + +val take_opt : 'a t -> 'a option +(** @since 4.08.0: val take_opt : 'a t -> 'a option *) + +val peek_opt : 'a t -> 'a option +(** @since 4.08.0: val peek_opt : 'a t -> 'a option *) + val create : unit -> 'a t (** Alias for {!Queue.create} *) @@ -100,6 +103,4 @@ val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a val transfer : 'a t -> 'a t -> unit (** Alias for {!Queue.transfer} *) -val drop : 'a t -> unit - end diff --git a/stdcompat__random_s.mli.in b/stdcompat__random_s.mli.in index 40ddb9a..b162c4b 100644 --- a/stdcompat__random_s.mli.in +++ b/stdcompat__random_s.mli.in @@ -1,8 +1,8 @@ module type S = sig -@BEGIN_FROM_5_2_0@ +@BEGIN_FROM_5_5_0@ module State = Random.State -@END_FROM_5_2_0@ -@BEGIN_BEFORE_5_2_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module State : sig type t val make : int array -> t val make_self_init : unit -> t val copy : t -> t val bits : t -> int val int : t -> int -> int @@ -18,8 +18,89 @@ val float : t -> float -> float val bool : t -> bool val bits32 : t -> Int32.t val bits64 : t -> Int64.t val nativebits : t -> Nativeint.t val split : t -> t val to_binary_string : t -> string val of_binary_string : string -> t end -@END_BEFORE_5_2_0@ -(** @since 5.2.0: module State = Random.State +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module State = Random.State + *) + +@BEGIN_FROM_5_5_0@ +val int32 : Int32.t -> Int32.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val int32 : Int32.t -> Int32.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val int32 : Int32.t -> Int32.t + *) + +@BEGIN_FROM_5_5_0@ +val nativeint : Nativeint.t -> Nativeint.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val nativeint : Nativeint.t -> Nativeint.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val nativeint : Nativeint.t -> Nativeint.t + *) + +@BEGIN_FROM_5_5_0@ +val int64 : Int64.t -> Int64.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val int64 : Int64.t -> Int64.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val int64 : Int64.t -> Int64.t + *) + +@BEGIN_FROM_5_5_0@ +val bits32 : unit -> Int32.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val bits32 : unit -> Int32.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val bits32 : unit -> Int32.t + *) + +@BEGIN_FROM_5_5_0@ +val bits64 : unit -> Int64.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val bits64 : unit -> Int64.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val bits64 : unit -> Int64.t + *) + +@BEGIN_FROM_5_5_0@ +val nativebits : unit -> Nativeint.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val nativebits : unit -> Nativeint.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val nativebits : unit -> Nativeint.t + *) + +@BEGIN_FROM_5_5_0@ +val get_state : unit -> State.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val get_state : unit -> State.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_state : unit -> State.t + *) + +@BEGIN_FROM_5_5_0@ +val set_state : State.t -> unit +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val set_state : State.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val set_state : State.t -> unit + *) + +@BEGIN_FROM_5_5_0@ +val split : unit -> State.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val split : unit -> State.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val split : unit -> State.t *) val int_in_range : min:int -> max:int -> int @@ -35,18 +116,6 @@ val nativeint_in_range : min:nativeint -> max:nativeint -> nativeint val int64_in_range : min:int64 -> max:int64 -> int64 (** @since 5.2.0: val int64_in_range : min:int64 -> max:int64 -> int64 *) -val split : unit -> State.t -(** @since 5.0.0: val split : unit -> State.t *) - -val bits32 : unit -> Int32.t -(** @since 4.14.0: val bits32 : unit -> Int32.t *) - -val bits64 : unit -> Int64.t -(** @since 4.14.0: val bits64 : unit -> Int64.t *) - -val nativebits : unit -> Nativeint.t -(** @since 4.14.0: val nativebits : unit -> Nativeint.t *) - val full_int : int -> int (** @since 4.13.0: val full_int : int -> int *) @@ -65,25 +134,10 @@ val bits : unit -> int val int : int -> int (** Alias for {!Random.int} *) -val int32 : Int32.t -> Int32.t -(** Alias for {!Random.int32} *) - -val nativeint : Nativeint.t -> Nativeint.t -(** Alias for {!Random.nativeint} *) - -val int64 : Int64.t -> Int64.t -(** Alias for {!Random.int64} *) - val float : float -> float (** Alias for {!Random.float} *) val bool : unit -> bool (** Alias for {!Random.bool} *) -val get_state : unit -> State.t -(** Alias for {!Random.get_state} *) - -val set_state : State.t -> unit -(** Alias for {!Random.set_state} *) - end diff --git a/stdcompat__result.ml.in b/stdcompat__result.ml.in index 8a46f98..72f596a 100644 --- a/stdcompat__result.ml.in +++ b/stdcompat__result.ml.in @@ -99,3 +99,32 @@ let to_seq r = | Ok v -> fun () -> Stdcompat__seq.Cons (v, Stdcompat__seq.empty) | Error _ -> Stdcompat__seq.empty @END_BEFORE_4_08_0@ + +@BEGIN_BEFORE_5_4_0@ +let get_ok' r = + match r with + | Ok v -> v + | Error err -> invalid_arg err + +let error_to_failure r = + match r with + | Ok v -> v + | Error err -> failwith err + +let product r r' = + match r, r' with + | Ok v, Ok v' -> Ok (v, v') + | Error err, _ | _, Error err -> Error err + +let retract r = + match r with + | Ok v -> v + | Error err -> err + +module Syntax = struct + let ( let* ) = bind + let ( and* ) = product + let (let+) r f = map f r + let (and+) = product +end +@END_BEFORE_5_4_0@ diff --git a/stdcompat__result_s.mli.in b/stdcompat__result_s.mli.in index b4a12fe..ce9897a 100644 --- a/stdcompat__result_s.mli.in +++ b/stdcompat__result_s.mli.in @@ -15,6 +15,82 @@ type ('a, 'e) t = ('a, 'e) Stdcompat__pervasives.result = | Error of 'e *) +@BEGIN_FROM_5_4_0@ +module Syntax = Result.Syntax +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +module Syntax : +sig +val ( let* ) : + ('a, 'e) Stdcompat__pervasives.result -> + ('a -> ('b, 'e) Stdcompat__pervasives.result) -> + ('b, 'e) Stdcompat__pervasives.result +val ( and* ) : + ('a, 'e) Stdcompat__pervasives.result -> + ('b, 'e) Stdcompat__pervasives.result -> + (('a * 'b), 'e) Stdcompat__pervasives.result +val (let+) : + ('a, 'e) Stdcompat__pervasives.result -> + ('a -> 'b) -> ('b, 'e) Stdcompat__pervasives.result +val (and+) : + ('a, 'e) Stdcompat__pervasives.result -> + ('b, 'e) Stdcompat__pervasives.result -> + (('a * 'b), 'e) Stdcompat__pervasives.result +end +@END_BEFORE_5_4_0@ +(** @since 5.4.0: module Syntax = Result.Syntax + *) + +@BEGIN_FROM_5_5_0@ +val to_seq : ('a, 'e) result -> 'a Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seq : ('a, 'e) Stdcompat__pervasives.result -> 'a Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : ('a, 'e) result -> 'a Seq.t + *) + +@BEGIN_FROM_5_4_0@ +val get_ok' : ('a, string) result -> 'a +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +val get_ok' : ('a, string) Stdcompat__pervasives.result -> 'a +@END_BEFORE_5_4_0@ +(** @since 5.4.0: val get_ok' : ('a, string) result -> 'a + *) + +@BEGIN_FROM_5_4_0@ +val error_to_failure : ('a, string) result -> 'a +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +val error_to_failure : ('a, string) Stdcompat__pervasives.result -> 'a +@END_BEFORE_5_4_0@ +(** @since 5.4.0: val error_to_failure : ('a, string) result -> 'a + *) + +@BEGIN_FROM_5_4_0@ +val product : ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +val product : + ('a, 'e) Stdcompat__pervasives.result -> + ('b, 'e) Stdcompat__pervasives.result -> + (('a * 'b), 'e) Stdcompat__pervasives.result +@END_BEFORE_5_4_0@ +(** @since 5.4.0: + val product : + ('a, 'e) result -> ('b, 'e) result -> (('a * 'b), 'e) result + *) + +@BEGIN_FROM_5_4_0@ +val retract : ('a, 'a) result -> 'a +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +val retract : ('a, 'a) Stdcompat__pervasives.result -> 'a +@END_BEFORE_5_4_0@ +(** @since 5.4.0: val retract : ('a, 'a) result -> 'a + *) + @BEGIN_FROM_4_08_0@ val ok : 'a -> ('a, 'e) result @END_FROM_4_08_0@ @@ -213,13 +289,4 @@ val to_list : ('a, 'e) Stdcompat__pervasives.result -> 'a list (** @since 4.08.0: val to_list : ('a, 'e) result -> 'a list *) -@BEGIN_FROM_4_08_0@ -val to_seq : ('a, 'e) result -> 'a Seq.t -@END_FROM_4_08_0@ -@BEGIN_BEFORE_4_08_0@ -val to_seq : ('a, 'e) Stdcompat__pervasives.result -> 'a Stdcompat__seq.t -@END_BEFORE_4_08_0@ -(** @since 4.08.0: val to_seq : ('a, 'e) result -> 'a Seq.t - *) - end diff --git a/stdcompat__seq.ml.in b/stdcompat__seq.ml.in index 5d1f0e9..ab61810 100644 --- a/stdcompat__seq.ml.in +++ b/stdcompat__seq.ml.in @@ -415,3 +415,24 @@ let rec find_mapi_from index f seq = let find_mapi f seq = find_mapi_from 0 f seq @END_BEFORE_5_1_0@ + +@BEGIN_BEFORE_5_4_0@ +let singleton v () = Cons (v, empty) + +let rec filteri_aux i f s () = + match s () with + | Nil -> Nil + | Cons (hd, tl) -> + let tl' = filteri_aux (succ i) f tl in + if f i hd then + Cons (hd, tl') + else + tl' () + +let filteri f s = + filteri_aux 0 f s +@END_BEFORE_5_4_0@ + +@BEGIN_BEFORE_5_5_0@ +let delay f () = f () () +@END_BEFORE_5_5_0@ diff --git a/stdcompat__seq_s.mli.in b/stdcompat__seq_s.mli.in index 0834383..1d07c2b 100644 --- a/stdcompat__seq_s.mli.in +++ b/stdcompat__seq_s.mli.in @@ -21,6 +21,26 @@ and 'a node = 'a Stdcompat__init.seq_node = exception Forced_twice (** Alias for {!Seq.Forced_twice} *) +val delay : (unit -> 'a t) -> 'a t +(** @since 5.5.0: val delay : (unit -> 'a t) -> 'a t *) + +@BEGIN_FROM_5_5_0@ +val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> ('b t * 'c t) +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val partition_map : + ('a -> ('b, 'c) Stdcompat__either.t) -> 'a t -> ('b t * 'c t) +@END_BEFORE_5_5_0@ +(** @since 5.5.0: + val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> ('b t * 'c t) + *) + +val singleton : 'a -> 'a t +(** @since 5.4.0: val singleton : 'a -> 'a t *) + +val filteri : (int -> 'a -> bool) -> 'a t -> 'a t +(** @since 5.4.0: val filteri : (int -> 'a -> bool) -> 'a t -> 'a t *) + val find_index : ('a -> bool) -> 'a t -> int option (** @since 5.1.0: val find_index : ('a -> bool) -> 'a t -> int option *) @@ -173,17 +193,6 @@ val unzip : ('a * 'b) t -> ('a t * 'b t) val split : ('a * 'b) t -> ('a t * 'b t) (** @since 4.14.0: val split : ('a * 'b) t -> ('a t * 'b t) *) -@BEGIN_FROM_4_14_0@ -val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> ('b t * 'c t) -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ -val partition_map : - ('a -> ('b, 'c) Stdcompat__either.t) -> 'a t -> ('b t * 'c t) -@END_BEFORE_4_14_0@ -(** @since 4.14.0: - val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> ('b t * 'c t) - *) - val partition : ('a -> bool) -> 'a t -> ('a t * 'a t) (** @since 4.14.0: val partition : ('a -> bool) -> 'a t -> ('a t * 'a t) *) diff --git a/stdcompat__set.ml.in b/stdcompat__set.ml.in index 526c2bf..36431a2 100644 --- a/stdcompat__set.ml.in +++ b/stdcompat__set.ml.in @@ -18,6 +18,7 @@ val map : (elt -> elt) -> t -> t val filter : (elt -> bool) -> t -> t val filter_map : (elt -> elt option) -> t -> t val partition : (elt -> bool) -> t -> (t * t) val split : elt -> t -> (t * bool * t) val is_empty : t -> bool +val is_singleton : t -> bool val mem : elt -> t -> bool val equal : t -> t -> bool val compare : t -> t -> int val subset : t -> t -> bool val for_all : (elt -> bool) -> t -> bool @@ -26,28 +27,28 @@ val of_list : elt list -> t val to_seq_from : elt -> t -> elt Seq.t val to_seq : t -> elt Seq.t val to_rev_seq : t -> elt Seq.t val add_seq : elt Seq.t -> t -> t val of_seq : elt Seq.t -> t end -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Make = Set.Make -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Make (Ord : OrderedType) = struct include Set.Make (Ord) @BEGIN_WITH_MAGIC@ - @BEGIN_BEFORE_4_12_0@ + @BEGIN_BEFORE_5_5_0@ type internal = Empty | Node of internal * elt * internal * int @BEGIN_FROM_4_02_0@ [@@ocaml.warning "-37"] @END_FROM_4_02_0@ - @END_BEFORE_4_12_0@ + @END_BEFORE_5_5_0@ @BEGIN_BEFORE_4_11_0@ external t_of_internal : internal -> t = "%identity" @END_BEFORE_4_11_0@ - @BEGIN_BEFORE_4_12_0@ + @BEGIN_BEFORE_5_5_0@ external internal_of_t : t -> internal = "%identity" - @END_BEFORE_4_12_0@ + @END_BEFORE_5_5_0@ @END_WITH_MAGIC@ @BEGIN_BEFORE_4_12_0@ @@ -553,5 +554,24 @@ module Make (Ord : OrderedType) = struct let to_list s = elements s @END_BEFORE_5_1_0@ +@BEGIN_BEFORE_5_5_0@ + @BEGIN_WITH_MAGIC@ + let is_singleton m = + match internal_of_t m with + Node (Empty, _key, Empty, _w) -> true + | Empty + | Node (Node _, _, _, _) + | Node (_, _, Node _, _) -> false + @END_WITH_MAGIC@ + @BEGIN_WITHOUT_MAGIC@ + let is_singleton m = + let has_one_element = ref false in + try + iter (fun _ -> if !has_one_element then raise Exit else has_one_element := true) m; + !has_one_element + with Exit -> + false + @END_WITHOUT_MAGIC@ +@END_BEFORE_5_5_0@ end -@END_BEFORE_5_1_0@ +@END_BEFORE_5_5_0@ diff --git a/stdcompat__set_s.mli.in b/stdcompat__set_s.mli.in index 31a99c9..699af2c 100644 --- a/stdcompat__set_s.mli.in +++ b/stdcompat__set_s.mli.in @@ -2,7 +2,7 @@ module type S = sig module type OrderedType = sig type t val compare : t -> t -> int end (** Alias for {!Set.OrderedType} *) -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module type S = sig type elt type t val empty : t val add : elt -> t -> t val singleton : elt -> t val remove : elt -> t -> t val union : t -> t -> t @@ -22,15 +22,15 @@ val map : (elt -> elt) -> t -> t val filter : (elt -> bool) -> t -> t val filter_map : (elt -> elt option) -> t -> t val partition : (elt -> bool) -> t -> (t * t) val split : elt -> t -> (t * bool * t) val is_empty : t -> bool -val mem : elt -> t -> bool val equal : t -> t -> bool -val compare : t -> t -> int val subset : t -> t -> bool -val for_all : (elt -> bool) -> t -> bool +val is_singleton : t -> bool val mem : elt -> t -> bool +val equal : t -> t -> bool val compare : t -> t -> int +val subset : t -> t -> bool val for_all : (elt -> bool) -> t -> bool val exists : (elt -> bool) -> t -> bool val to_list : t -> elt list val of_list : elt list -> t val to_seq_from : elt -> t -> elt Seq.t val to_seq : t -> elt Seq.t val to_rev_seq : t -> elt Seq.t val add_seq : elt Seq.t -> t -> t val of_seq : elt Seq.t -> t end -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module type S = sig type elt type t val empty : t val add : elt -> t -> t val singleton : elt -> t val remove : elt -> t -> t val union : t -> t -> t @@ -50,9 +50,9 @@ val map : (elt -> elt) -> t -> t val filter : (elt -> bool) -> t -> t val filter_map : (elt -> elt option) -> t -> t val partition : (elt -> bool) -> t -> (t * t) val split : elt -> t -> (t * bool * t) val is_empty : t -> bool -val mem : elt -> t -> bool val equal : t -> t -> bool -val compare : t -> t -> int val subset : t -> t -> bool -val for_all : (elt -> bool) -> t -> bool +val is_singleton : t -> bool val mem : elt -> t -> bool +val equal : t -> t -> bool val compare : t -> t -> int +val subset : t -> t -> bool val for_all : (elt -> bool) -> t -> bool val exists : (elt -> bool) -> t -> bool val to_list : t -> elt list val of_list : elt list -> t val to_seq_from : elt -> t -> elt Stdcompat__seq.t @@ -60,8 +60,8 @@ val to_seq : t -> elt Stdcompat__seq.t val to_rev_seq : t -> elt Stdcompat__seq.t val add_seq : elt Stdcompat__seq.t -> t -> t val of_seq : elt Stdcompat__seq.t -> t end -@END_BEFORE_5_1_0@ -(** @since 5.1.0: +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module type S = sig type elt @@ -96,6 +96,7 @@ val of_seq : elt Stdcompat__seq.t -> t end val partition : (elt -> bool) -> t -> (t * t) val split : elt -> t -> (t * bool * t) val is_empty : t -> bool + val is_singleton : t -> bool val mem : elt -> t -> bool val equal : t -> t -> bool val compare : t -> t -> int @@ -112,10 +113,10 @@ val of_seq : elt Stdcompat__seq.t -> t end end *) -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ module Make = Set.Make -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Make : functor (Ord : OrderedType) -> sig type elt = Ord.t type t = Set.Make(Ord).t val empty : t @@ -136,9 +137,9 @@ val map : (elt -> elt) -> t -> t val filter : (elt -> bool) -> t -> t val filter_map : (elt -> elt option) -> t -> t val partition : (elt -> bool) -> t -> (t * t) val split : elt -> t -> (t * bool * t) val is_empty : t -> bool -val mem : elt -> t -> bool val equal : t -> t -> bool -val compare : t -> t -> int val subset : t -> t -> bool -val for_all : (elt -> bool) -> t -> bool +val is_singleton : t -> bool val mem : elt -> t -> bool +val equal : t -> t -> bool val compare : t -> t -> int +val subset : t -> t -> bool val for_all : (elt -> bool) -> t -> bool val exists : (elt -> bool) -> t -> bool val to_list : t -> elt list val of_list : elt list -> t val to_seq_from : elt -> t -> elt Stdcompat__seq.t @@ -146,8 +147,8 @@ val to_seq : t -> elt Stdcompat__seq.t val to_rev_seq : t -> elt Stdcompat__seq.t val add_seq : elt Stdcompat__seq.t -> t -> t val of_seq : elt Stdcompat__seq.t -> t end -@END_BEFORE_5_1_0@ -(** @since 5.1.0: module Make = Set.Make +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Make = Set.Make *) end diff --git a/stdcompat__stack_s.mli.in b/stdcompat__stack_s.mli.in index 498d706..3920b65 100644 --- a/stdcompat__stack_s.mli.in +++ b/stdcompat__stack_s.mli.in @@ -1,104 +1,47 @@ module type S = sig -@BEGIN_FROM_5_1_0@ @BEGIN_FROM_4_12_0@ type !'a t = 'a Stack.t @END_FROM_4_12_0@ @BEGIN_BEFORE_4_12_0@ type 'a t = 'a Stack.t @END_BEFORE_4_12_0@ - -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ -@BEGIN_FROM_5_0_0@ -type 'a t -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ -@BEGIN_FROM_4_12_0@ -type !'a t = 'a Stack.t -@END_FROM_4_12_0@ -@BEGIN_BEFORE_4_12_0@ -type 'a t = 'a Stack.t -@END_BEFORE_4_12_0@ - -@END_BEFORE_5_0_0@ - -@END_BEFORE_5_1_0@ (** @since 5.1.0: type !'a t -@since 3.07.0: type !'a t +@since 3.07.0: type 'a t *) exception Empty (** Alias for {!Stack.Empty} *) -val drop : 'a t -> unit -(** @since 5.1.0: val drop : 'a t -> unit *) - -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ val to_seq : 'a t -> 'a Seq.t -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ -@BEGIN_FROM_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val to_seq : 'a t -> 'a Stdcompat__seq.t -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ -@BEGIN_FROM_4_07_0@ -val to_seq : 'a t -> 'a Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seq : 'a t -> 'a Stdcompat__seq.t -@END_BEFORE_4_07_0@ - -@END_BEFORE_5_0_0@ - -@END_BEFORE_5_1_0@ -(** @since 5.1.0: val to_seq : 'a t -> 'a Seq.t -@since 4.07.0: val to_seq : 'a t -> 'a Seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : 'a t -> 'a Seq.t *) -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ val add_seq : 'a t -> 'a Seq.t -> unit -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ -@BEGIN_FROM_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val add_seq : 'a t -> 'a Stdcompat__seq.t -> unit -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ -@BEGIN_FROM_4_07_0@ -val add_seq : 'a t -> 'a Seq.t -> unit -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val add_seq : 'a t -> 'a Stdcompat__seq.t -> unit -@END_BEFORE_4_07_0@ - -@END_BEFORE_5_0_0@ - -@END_BEFORE_5_1_0@ -(** @since 5.1.0: val add_seq : 'a t -> 'a Seq.t -> unit -@since 4.07.0: val add_seq : 'a t -> 'a Seq.t -> unit +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val add_seq : 'a t -> 'a Seq.t -> unit *) -@BEGIN_FROM_5_1_0@ +@BEGIN_FROM_5_5_0@ val of_seq : 'a Seq.t -> 'a t -@END_FROM_5_1_0@ -@BEGIN_BEFORE_5_1_0@ -@BEGIN_FROM_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val of_seq : 'a Stdcompat__seq.t -> 'a t -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ -@BEGIN_FROM_4_07_0@ -val of_seq : 'a Seq.t -> 'a t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val of_seq : 'a Stdcompat__seq.t -> 'a t -@END_BEFORE_4_07_0@ - -@END_BEFORE_5_0_0@ - -@END_BEFORE_5_1_0@ -(** @since 5.1.0: val of_seq : 'a Seq.t -> 'a t -@since 4.07.0: val of_seq : 'a Seq.t -> 'a t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : 'a Seq.t -> 'a t *) +val drop : 'a t -> unit +(** @since 5.1.0: val drop : 'a t -> unit *) + val pop_opt : 'a t -> 'a option (** @since 4.08.0: val pop_opt : 'a t -> 'a option *) diff --git a/stdcompat__stdlib.ml.in b/stdcompat__stdlib.ml.in index e6a7962..786c70c 100644 --- a/stdcompat__stdlib.ml.in +++ b/stdcompat__stdlib.ml.in @@ -1,7 +1,7 @@ -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ include Stdlib -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Pervasives = Stdcompat__pervasives include Pervasives @@ -74,8 +74,6 @@ module Fun = Stdcompat__fun module Gc = Gc -module Genlex = Genlex - module Hashtbl = Stdcompat__hashtbl module In_channel = Stdcompat__in_channel @@ -151,4 +149,4 @@ module Uchar = Stdcompat__uchar module Unit = Stdcompat__unit module Weak = Stdcompat__weak -@END_BEFORE_5_0_0@ +@END_BEFORE_5_5_0@ diff --git a/stdcompat__stdlib_s.mli.in b/stdcompat__stdlib_s.mli.in index 4bff379..e2213e5 100644 --- a/stdcompat__stdlib_s.mli.in +++ b/stdcompat__stdlib_s.mli.in @@ -1,10 +1,10 @@ module type S = sig -@BEGIN_FROM_5_0_0@ +@BEGIN_FROM_5_5_0@ include module type of struct include Stdlib end -@END_FROM_5_0_0@ -@BEGIN_BEFORE_5_0_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Pervasives : Stdcompat__pervasives_s.S include Stdcompat__pervasives_s.S @@ -164,5 +164,5 @@ module type S = sig module Unit : Stdcompat__unit_s.S module Weak : Stdcompat__weak_s.S -@END_BEFORE_5_0_0@ +@END_BEFORE_5_5_0@ end diff --git a/stdcompat__string.ml.in b/stdcompat__string.ml.in index 1a35dff..8953879 100644 --- a/stdcompat__string.ml.in +++ b/stdcompat__string.ml.in @@ -152,3 +152,313 @@ let seeded_hash = Stdcompat__hashtbl.seeded_hash let hash = Hashtbl.hash @END_BEFORE_5_0_0@ + +@BEGIN_BEFORE_5_4_0@ +let edit_distance ?limit:_ a b = + let d = Array.make_matrix (length a + 1) (length b + 1) 0 in + for i = 0 to length a do + d.(i).(0) <- i + done; + for j = 0 to length b do + d.(0).(j) <- j + done; + for i = 1 to length a do + for j = 1 to length b do + let cost = + if unsafe_get a (i - 1) = unsafe_get b (j - 1) then + 0 + else + 1 in + let cost_deletion = d.(i - 1).(j) + 1 in + let cost_insertion = d.(i).(j - 1) + 1 in + let cost_subst = d.(i - 1).(j - 1) + cost in + let cost_min = + Stdcompat__int.min + (Stdcompat__int.min cost_deletion cost_insertion) cost_subst in + let cost_min' = + if i > 1 && j > 1 && unsafe_get a (i - 1) = unsafe_get b (j - 2) + && unsafe_get a (i - 2) = unsafe_get b (j - 1) then + Stdcompat__int.min cost_min (d.(i - 2).(j - 2) + cost) + else + cost_min in + d.(i).(j) <- cost_min' + done; + done; + d.(length a).(length b) + +let default_max_dist s = + let w = Stdcompat__utf8.utf_8_scalar_width s ~pos:0 ~len:(length s) in + if w <= 2 then + 0 + else if w <= 4 then + 1 + else + 2 + +let spellcheck ?(max_dist = default_max_dist) iter_dict s = + let best_score_ref = ref (max_dist s) in + let best_matches = ref [] in + let f s' = + let best_score = !best_score_ref in + let dist = edit_distance ~limit:(succ best_score) s s' in + if dist = best_score then + best_matches := s' :: !best_matches + else if dist < best_score then + begin + best_score_ref := dist; + best_matches := [s']; + end in + iter_dict f; + List.rev !best_matches +@END_BEFORE_5_4_0@ + +@BEGIN_BEFORE_5_5_0@ +let of_char c = make 1 c + +let is_empty s = s = "" + +let take_first n s = + if n <= 0 then + "" + else if n >= length s then + s + else + sub s 0 n + +let take_last n s = + if n <= 0 then + "" + else if n >= length s then + s + else + sub s (length s - n) n + +let drop_first n s = + if n <= 0 then + s + else if n >= length s then + "" + else + sub s n (length s - n) + +let drop_last n s = + if n <= 0 then + s + else if n >= length s then + "" + else + sub s 0 (length s - n) + +let cut_first n s = + if n <= 0 then + "", s + else if n >= length s then + s, "" + else + sub s 0 n, sub s n (length s - n) + +let cut_last n s = + if n <= 0 then + s, "" + else if n >= length s then + "", s + else + sub s 0 (length s - n), sub s (length s - n) n + +let rec find_first_index_aux p start s = + if start >= length s then + None + else if p (unsafe_get s start) then + Some start + else + find_first_index_aux p (start + 1) s + +let check_valid_position i len_s caller = + if i < 0 || i > len_s then + invalid_arg caller + +let find_first_index p ?(start = 0) s = + check_valid_position start (length s) "find_first_index"; + find_first_index_aux p start s + +let rec find_last_index_aux p start s = + if start < 0 then + None + else if p (unsafe_get s start) then + Some start + else + find_last_index_aux p (start - 1) s + +let find_last_index p ?start s = + let start = + match start with + | None -> length s - 1 + | Some start -> + check_valid_position start (length s) "find_last_index"; + if start < length s then + start + else + length s - 1 in + find_last_index_aux p start s + +let take_first_while p s = + match find_first_index (fun c -> not (p c)) s with + | None -> s + | Some i -> take_first i s + +let take_last_while p s = + match find_last_index (fun c -> not (p c)) s with + | None -> s + | Some i -> take_last (length s - i - 1) s + +let drop_first_while p s = + match find_first_index (fun c -> not (p c)) s with + | None -> "" + | Some i -> drop_first i s + +let drop_last_while p s = + match find_last_index (fun c -> not (p c)) s with + | None -> "" + | Some i -> drop_last (length s - i - 1) s + +let cut_first_while p s = + match find_first_index (fun c -> not (p c)) s with + | None -> s, "" + | Some i -> cut_first i s + +let cut_last_while p s = + match find_last_index (fun c -> not (p c)) s with + | None -> "", s + | Some i -> cut_last (length s - i - 1) s + +let rec sub_equal sub sub_start s start len = + if len <= 0 then + true + else + unsafe_get sub sub_start = unsafe_get s start && + sub_equal sub (sub_start + 1) s (start + 1) (len - 1) + +let rec find_first_aux sub start s = + if start > length s - length sub then + None + else if sub_equal sub 0 s start (length sub) then + Some start + else + find_first_aux sub (start + 1) s + +let find_first ~sub ?(start = 0) s = + check_valid_position start (length s) "find_first"; + find_first_aux sub start s + +let rec find_last_aux sub start s = + if start < 0 then + None + else if sub_equal sub 0 s start (length sub) then + Some start + else + find_last_aux sub (start - 1) s + +let check_find_last_start sub start s caller = + let max = length s - length sub in + match start with + | None -> max + | Some start -> + check_valid_position start (length s) caller; + Stdcompat__int.min start max + +let find_last ~sub ?start s = + let start = check_find_last_start sub start s "find_last" in + find_last_aux sub start s + +let includes ~affix s = + match find_first ~sub:affix s with + | None -> false + | Some _index -> true + +let split_first ~sep s = + match find_first sep s with + | None -> None + | Some index -> Some (sub s 0 index, sub s (index + length sep) (length s - length sep - index)) + +let split_last ~sep s = + match find_last sep s with + | None -> None + | Some index -> Some (sub s 0 index, sub s (index + length sep) (length s - length sep - index)) + +let rec find_all_aux sub f start s acc = + match find_first_aux sub start s with + | None -> acc + | Some index -> + let acc' = f index acc in + let start' = index + Stdcompat__int.max (length sub) 1 in + find_all_aux sub f start' s acc' + +let find_all ~sub f ?(start = 0) s acc = + check_valid_position start (length s) "find_all"; + find_all_aux sub f start s acc + +let rec rfind_all_aux sub f start s acc = + match find_last_aux sub start s with + | None -> acc + | Some index -> + let acc' = f index acc in + if index = 0 then + acc' + else + rfind_all_aux sub f (index - Stdcompat__int.max (length sub) 1) s acc' + +let rfind_all ~sub f ?start s acc = + let start = check_find_last_start sub start s "rfind_all" in + rfind_all_aux sub f start s acc + +let split_add_acc drop s index (last_index, l) = + let subs = sub s last_index (index - last_index) in + match drop with + | Some drop when drop subs -> l + | _ -> subs :: l + +let split_acc len_sep drop s index (last_index, l) = + let l' = split_add_acc drop s index (last_index, l) in + (index + len_sep, l') + +let split_all_from ?start ~sep ?drop s = + let acc = find_all sep (split_acc (length sep) drop s) ?start s (0, []) in + List.rev (split_add_acc drop s (length s) acc) + +let split_all ~sep ?drop s = + split_all_from sep ?drop s + +let rsplit_add_acc drop s index (last_index, l) = + let subs = sub s index (last_index - index) in + match drop with + | Some drop when drop subs -> l + | _ -> subs :: l + +let rsplit_acc len_sep drop s index (last_index, l) = + let l' = rsplit_add_acc drop s (index + len_sep) (last_index, l) in + (index, l') + +let rsplit_all ~sep ?drop s = + let acc = rfind_all sep (rsplit_acc (length sep) drop s) s (length s, []) in + rsplit_add_acc drop s 0 acc + +let unsafe_replace_at len_sub ~by index s = + let b = Stdcompat__bytes.create (length s + length by - len_sub) in + Stdcompat__bytes.blit_string s 0 b 0 index; + Stdcompat__bytes.blit_string by 0 b index (length by); + Stdcompat__bytes.blit_string s (index + len_sub) b (index + length by) (length s - index - len_sub); + Stdcompat__bytes.unsafe_to_string b + +let replace_first ~sub ~by ?start s = + match find_first sub ?start s with + | None -> s + | Some index -> unsafe_replace_at (length sub) by index s + +let replace_last ~sub ~by ?start s = + match find_last sub ?start s with + | None -> s + | Some index -> unsafe_replace_at (length sub) by index s + +let replace_all ~sub ~by ?start s = + concat by (split_all_from ?start sub s) +@END_BEFORE_5_5_0@ diff --git a/stdcompat__string_s.mli.in b/stdcompat__string_s.mli.in index 18561a8..cef957d 100644 --- a/stdcompat__string_s.mli.in +++ b/stdcompat__string_s.mli.in @@ -2,45 +2,196 @@ module type S = sig type t = string (** Alias for {!String.t} *) -val hash : t -> int -(** @since 5.0.0: val hash : t -> int *) +val of_char : char -> string +(** @since 5.5.0: val of_char : char -> string *) -val seeded_hash : int -> t -> int -(** @since 5.0.0: val seeded_hash : int -> t -> int *) +val is_empty : string -> bool +(** @since 5.5.0: val is_empty : string -> bool *) + +val includes : affix:string -> string -> bool +(** @since 5.5.0: val includes : affix:string -> string -> bool *) + +val take_first : int -> string -> string +(** @since 5.5.0: val take_first : int -> string -> string *) + +val take_last : int -> string -> string +(** @since 5.5.0: val take_last : int -> string -> string *) + +val drop_first : int -> string -> string +(** @since 5.5.0: val drop_first : int -> string -> string *) + +val drop_last : int -> string -> string +(** @since 5.5.0: val drop_last : int -> string -> string *) + +val cut_first : int -> string -> (string * string) +(** @since 5.5.0: val cut_first : int -> string -> (string * string) *) + +val cut_last : int -> string -> (string * string) +(** @since 5.5.0: val cut_last : int -> string -> (string * string) *) + +val take_first_while : (char -> bool) -> string -> string +(** @since 5.5.0: val take_first_while : (char -> bool) -> string -> string *) + +val take_last_while : (char -> bool) -> string -> string +(** @since 5.5.0: val take_last_while : (char -> bool) -> string -> string *) + +val drop_first_while : (char -> bool) -> string -> string +(** @since 5.5.0: val drop_first_while : (char -> bool) -> string -> string *) + +val drop_last_while : (char -> bool) -> string -> string +(** @since 5.5.0: val drop_last_while : (char -> bool) -> string -> string *) + +val cut_first_while : (char -> bool) -> string -> (string * string) +(** @since 5.5.0: + val cut_first_while : (char -> bool) -> string -> (string * string) *) + +val cut_last_while : (char -> bool) -> string -> (string * string) +(** @since 5.5.0: + val cut_last_while : (char -> bool) -> string -> (string * string) *) + +val split_first : sep:string -> string -> (string * string) option +(** @since 5.5.0: + val split_first : sep:string -> string -> (string * string) option *) + +val split_last : sep:string -> string -> (string * string) option +(** @since 5.5.0: + val split_last : sep:string -> string -> (string * string) option *) + +val split_all : sep:string -> ?drop:(string -> bool) -> string -> string list +(** @since 5.5.0: + val split_all : + sep:string -> ?drop:(string -> bool) -> string -> string list *) + +val rsplit_all : + sep:string -> ?drop:(string -> bool) -> string -> string list +(** @since 5.5.0: + val rsplit_all : + sep:string -> ?drop:(string -> bool) -> string -> string list *) + +val find_first_index : (char -> bool) -> ?start:int -> string -> int option +(** @since 5.5.0: + val find_first_index : + (char -> bool) -> ?start:int -> string -> int option *) + +val find_last_index : (char -> bool) -> ?start:int -> string -> int option +(** @since 5.5.0: + val find_last_index : + (char -> bool) -> ?start:int -> string -> int option *) + +val find_first : sub:string -> ?start:int -> string -> int option +(** @since 5.5.0: + val find_first : sub:string -> ?start:int -> string -> int option *) + +val find_last : sub:string -> ?start:int -> string -> int option +(** @since 5.5.0: + val find_last : sub:string -> ?start:int -> string -> int option *) + +val find_all : + sub:string -> (int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc +(** @since 5.5.0: + val find_all : + sub:string -> + (int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc *) + +val rfind_all : + sub:string -> (int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc +(** @since 5.5.0: + val rfind_all : + sub:string -> + (int -> 'acc -> 'acc) -> ?start:int -> string -> 'acc -> 'acc *) + +val replace_first : sub:string -> by:string -> ?start:int -> string -> string +(** @since 5.5.0: + val replace_first : + sub:string -> by:string -> ?start:int -> string -> string *) + +val replace_last : sub:string -> by:string -> ?start:int -> string -> string +(** @since 5.5.0: + val replace_last : + sub:string -> by:string -> ?start:int -> string -> string *) + +val replace_all : sub:string -> by:string -> ?start:int -> string -> string +(** @since 5.5.0: + val replace_all : + sub:string -> by:string -> ?start:int -> string -> string *) + +@BEGIN_FROM_5_5_0@ +val to_seq : t -> char Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seq : t -> char Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seq : t -> char Seq.t + *) + +@BEGIN_FROM_5_5_0@ +val to_seqi : t -> (int * char) Seq.t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val to_seqi : t -> (int * char) Stdcompat__seq.t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val to_seqi : t -> (int * char) Seq.t + *) -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ +val of_seq : char Seq.t -> t +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ +val of_seq : char Stdcompat__seq.t -> t +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val of_seq : char Seq.t -> t + *) + +@BEGIN_FROM_5_5_0@ val get_utf_8_uchar : t -> int -> Uchar.utf_decode -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val get_utf_8_uchar : t -> int -> Stdcompat__uchar.utf_decode -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val get_utf_8_uchar : t -> int -> Uchar.utf_decode +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_utf_8_uchar : t -> int -> Uchar.utf_decode *) -val is_valid_utf_8 : t -> bool -(** @since 4.14.0: val is_valid_utf_8 : t -> bool *) - -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ val get_utf_16be_uchar : t -> int -> Uchar.utf_decode -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val get_utf_16be_uchar : t -> int -> Stdcompat__uchar.utf_decode -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val get_utf_16be_uchar : t -> int -> Uchar.utf_decode +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_utf_16be_uchar : t -> int -> Uchar.utf_decode *) -val is_valid_utf_16be : t -> bool -(** @since 4.14.0: val is_valid_utf_16be : t -> bool *) - -@BEGIN_FROM_4_14_0@ +@BEGIN_FROM_5_5_0@ val get_utf_16le_uchar : t -> int -> Uchar.utf_decode -@END_FROM_4_14_0@ -@BEGIN_BEFORE_4_14_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ val get_utf_16le_uchar : t -> int -> Stdcompat__uchar.utf_decode -@END_BEFORE_4_14_0@ -(** @since 4.14.0: val get_utf_16le_uchar : t -> int -> Uchar.utf_decode +@END_BEFORE_5_5_0@ +(** @since 5.5.0: val get_utf_16le_uchar : t -> int -> Uchar.utf_decode *) +val edit_distance : ?limit:int -> t -> t -> int +(** @since 5.4.0: val edit_distance : ?limit:int -> t -> t -> int *) + +val spellcheck : + ?max_dist:(string -> int) -> + ((string -> unit) -> unit) -> string -> string list +(** @since 5.4.0: + val spellcheck : + ?max_dist:(string -> int) -> + ((string -> unit) -> unit) -> string -> string list *) + +val hash : t -> int +(** @since 5.0.0: val hash : t -> int *) + +val seeded_hash : int -> t -> int +(** @since 5.0.0: val seeded_hash : int -> t -> int *) + +val is_valid_utf_8 : t -> bool +(** @since 4.14.0: val is_valid_utf_8 : t -> bool *) + +val is_valid_utf_16be : t -> bool +(** @since 4.14.0: val is_valid_utf_16be : t -> bool *) + val is_valid_utf_16le : t -> bool (** @since 4.14.0: val is_valid_utf_16le : t -> bool *) @@ -156,33 +307,6 @@ val get_int64_be : string -> int -> int64 val get_int64_le : string -> int -> int64 (** @since 4.13.0: val get_int64_le : string -> int -> int64 *) -@BEGIN_FROM_4_07_0@ -val to_seq : t -> char Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seq : t -> char Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seq : t -> char Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val to_seqi : t -> (int * char) Seq.t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val to_seqi : t -> (int * char) Stdcompat__seq.t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val to_seqi : t -> (int * char) Seq.t - *) - -@BEGIN_FROM_4_07_0@ -val of_seq : char Seq.t -> t -@END_FROM_4_07_0@ -@BEGIN_BEFORE_4_07_0@ -val of_seq : char Stdcompat__seq.t -> t -@END_BEFORE_4_07_0@ -(** @since 4.07.0: val of_seq : char Seq.t -> t - *) - val index_from_opt : string -> int -> char -> int option (** @since 4.05.0: val index_from_opt : string -> int -> char -> int option *) diff --git a/stdcompat__sys.ml.in b/stdcompat__sys.ml.in index e8d2842..e221c9e 100644 --- a/stdcompat__sys.ml.in +++ b/stdcompat__sys.ml.in @@ -141,3 +141,54 @@ let is_regular_file _path = @BEGIN_BEFORE_5_3_0@ let poll_actions () = failwith "not implemented" @END_BEFORE_5_3_0@ + +@BEGIN_BEFORE_5_4_0@ +type signal = int + +let io_buffer_size = 65536 + +let sigio = -29 + +let sigwinch = -30 + +let signal_to_string s = + if s = sigabrt then "SIGABRT" + else if s = sigalrm then "SIGALRM" + else if s = sigfpe then "SIGFPE" + else if s = sighup then "SIGHUP" + else if s = sigill then "SIGILL" + else if s = sigint then "SIGINT" + else if s = sigkill then "SIGKILL" + else if s = sigpipe then "SIGPIPE" + else if s = sigquit then "SIGQUIT" + else if s = sigsegv then "SIGSEGV" + else if s = sigterm then "SIGTERM" + else if s = sigusr1 then "SIGUSR1" + else if s = sigusr2 then "SIGUSR2" + else if s = sigchld then "SIGCHLD" + else if s = sigcont then "SIGCONT" + else if s = sigstop then "SIGSTOP" + else if s = sigtstp then "SIGTSTP" + else if s = sigttin then "SIGTTIN" + else if s = sigttou then "SIGTTOU" + else if s = sigvtalrm then "SIGVTALRM" + else if s = sigprof then "SIGPROF" + else if s = sigbus then "SIGBUS" + else if s = sigpoll then "SIGPOLL" + else if s = sigsys then "SIGSYS" + else if s = sigtrap then "SIGTRAP" + else if s = sigurg then "SIGURG" + else if s = sigxcpu then "SIGXCPU" + else if s = sigxfsz then "SIGXFSZ" + else if s = sigio then "SIGIO" + else if s = sigwinch then "SIGWINCH" + else "SIG(" ^ string_of_int s ^ ")" + +let signal_of_int i = i + +let signal_to_int i = i +@END_BEFORE_5_4_0@ + +@BEGIN_BEFORE_5_5_0@ +let runtime_executable = executable_name +@END_BEFORE_5_5_0@ diff --git a/stdcompat__sys_s.mli.in b/stdcompat__sys_s.mli.in index e435582..7e8f271 100644 --- a/stdcompat__sys_s.mli.in +++ b/stdcompat__sys_s.mli.in @@ -17,11 +17,33 @@ type backend_type = | Other of string *) +@BEGIN_FROM_5_4_0@ +type signal = int +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +type signal = int +@END_BEFORE_5_4_0@ +(** @since 5.4.0: type signal = int + *) + +@BEGIN_FROM_5_4_0@ type signal_behavior = Sys.signal_behavior = | Signal_default | Signal_ignore - | Signal_handle of (int -> unit) -(** Alias for {!Sys.signal_behavior} *) + | Signal_handle of (signal -> unit) +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +type signal_behavior = + | Signal_default + | Signal_ignore + | Signal_handle of (signal -> unit) +@END_BEFORE_5_4_0@ +(** @since 5.4.0: + type signal_behavior = + | Signal_default + | Signal_ignore + | Signal_handle of (signal -> unit) + *) exception Break (** Alias for {!Sys.Break} *) @@ -75,10 +97,10 @@ type ocaml_release_info = extra: extra_info option } *) -@BEGIN_FROM_4_10_0@ +@BEGIN_FROM_5_5_0@ module Immediate64 = Sys.Immediate64 -@END_FROM_4_10_0@ -@BEGIN_BEFORE_4_10_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Immediate64 : sig module type Non_immediate = sig type t end module type Immediate = sig @BEGIN_FROM_4_02_0@ @@ -109,8 +131,139 @@ type 'a repr = @END_BEFORE_4_00_0@ val repr : t repr end end -@END_BEFORE_4_10_0@ -(** @since 4.10.0: module Immediate64 = Sys.Immediate64 +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Immediate64 = Sys.Immediate64 + *) + +val runtime_executable : string +(** @since 5.5.0: val runtime_executable : string *) + +val io_buffer_size : int +(** @since 5.4.0: val io_buffer_size : int *) + +@BEGIN_FROM_5_4_0@ +external signal : + signal -> signal_behavior -> signal_behavior = + "caml_install_signal_handler" +@END_FROM_5_4_0@ +@BEGIN_BEFORE_5_4_0@ +val signal : signal -> signal_behavior -> signal_behavior +@END_BEFORE_5_4_0@ +(** @since 5.4.0: + external signal : + signal -> signal_behavior -> signal_behavior = + "caml_install_signal_handler" + *) + +val set_signal : signal -> signal_behavior -> unit +(** @since 5.4.0: val set_signal : signal -> signal_behavior -> unit *) + +val sigabrt : signal +(** @since 5.4.0: val sigabrt : signal *) + +val sigalrm : signal +(** @since 5.4.0: val sigalrm : signal *) + +val sigfpe : signal +(** @since 5.4.0: val sigfpe : signal *) + +val sighup : signal +(** @since 5.4.0: val sighup : signal *) + +val sigill : signal +(** @since 5.4.0: val sigill : signal *) + +val sigint : signal +(** @since 5.4.0: val sigint : signal *) + +val sigkill : signal +(** @since 5.4.0: val sigkill : signal *) + +val sigpipe : signal +(** @since 5.4.0: val sigpipe : signal *) + +val sigquit : signal +(** @since 5.4.0: val sigquit : signal *) + +val sigsegv : signal +(** @since 5.4.0: val sigsegv : signal *) + +val sigterm : signal +(** @since 5.4.0: val sigterm : signal *) + +val sigusr1 : signal +(** @since 5.4.0: val sigusr1 : signal *) + +val sigusr2 : signal +(** @since 5.4.0: val sigusr2 : signal *) + +val sigchld : signal +(** @since 5.4.0: val sigchld : signal *) + +val sigcont : signal +(** @since 5.4.0: val sigcont : signal *) + +val sigstop : signal +(** @since 5.4.0: val sigstop : signal *) + +val sigtstp : signal +(** @since 5.4.0: val sigtstp : signal *) + +val sigttin : signal +(** @since 5.4.0: val sigttin : signal *) + +val sigttou : signal +(** @since 5.4.0: val sigttou : signal *) + +val sigvtalrm : signal +(** @since 5.4.0: val sigvtalrm : signal *) + +val sigprof : signal +(** @since 5.4.0: val sigprof : signal *) + +val sigbus : signal +(** @since 5.4.0: val sigbus : signal *) + +val sigpoll : signal +(** @since 5.4.0: val sigpoll : signal *) + +val sigsys : signal +(** @since 5.4.0: val sigsys : signal *) + +val sigtrap : signal +(** @since 5.4.0: val sigtrap : signal *) + +val sigurg : signal +(** @since 5.4.0: val sigurg : signal *) + +val sigxcpu : signal +(** @since 5.4.0: val sigxcpu : signal *) + +val sigxfsz : signal +(** @since 5.4.0: val sigxfsz : signal *) + +val sigio : signal +(** @since 5.4.0: val sigio : signal *) + +val sigwinch : signal +(** @since 5.4.0: val sigwinch : signal *) + +val signal_to_string : signal -> string +(** @since 5.4.0: val signal_to_string : signal -> string *) + +val signal_of_int : int -> signal +(** @since 5.4.0: val signal_of_int : int -> signal *) + +val signal_to_int : signal -> int +(** @since 5.4.0: val signal_to_int : signal -> int *) + +@BEGIN_FROM_5_3_0@ +external poll_actions : unit -> unit = "%poll" +@END_FROM_5_3_0@ +@BEGIN_BEFORE_5_3_0@ +val poll_actions : unit -> unit +@END_BEFORE_5_3_0@ +(** @since 5.3.0: external poll_actions : unit -> unit = "%poll" *) @BEGIN_FROM_5_1_0@ @@ -179,27 +332,6 @@ val runtime_parameters : unit -> string external runtime_parameters : unit -> string = "caml_runtime_parameters" *) -val sigbus : int -(** @since 4.03.0: val sigbus : int *) - -val sigpoll : int -(** @since 4.03.0: val sigpoll : int *) - -val sigsys : int -(** @since 4.03.0: val sigsys : int *) - -val sigtrap : int -(** @since 4.03.0: val sigtrap : int *) - -val sigurg : int -(** @since 4.03.0: val sigurg : int *) - -val sigxcpu : int -(** @since 4.03.0: val sigxcpu : int *) - -val sigxfsz : int -(** @since 4.03.0: val sigxfsz : int *) - val enable_runtime_warnings : bool -> unit (** @since 4.03.0: val enable_runtime_warnings : bool -> unit *) @@ -372,101 +504,10 @@ val max_string_length : int val max_array_length : int (** Alias for {!Sys.max_array_length} *) -@BEGIN_FROM_3_08_0@ -external signal : - int -> signal_behavior -> signal_behavior = "caml_install_signal_handler" -@END_FROM_3_08_0@ -@BEGIN_BEFORE_3_08_0@ -external signal : - int -> signal_behavior -> signal_behavior = "install_signal_handler" -@END_BEFORE_3_08_0@ -(** @since 3.08.0: - external signal : - int -> signal_behavior -> signal_behavior = - "caml_install_signal_handler" -@since 3.07.0: -external signal : - int -> signal_behavior -> signal_behavior = "install_signal_handler" - *) - -val set_signal : int -> signal_behavior -> unit -(** Alias for {!Sys.set_signal} *) - -val sigabrt : int -(** Alias for {!Sys.sigabrt} *) - -val sigalrm : int -(** Alias for {!Sys.sigalrm} *) - -val sigfpe : int -(** Alias for {!Sys.sigfpe} *) - -val sighup : int -(** Alias for {!Sys.sighup} *) - -val sigill : int -(** Alias for {!Sys.sigill} *) - -val sigint : int -(** Alias for {!Sys.sigint} *) - -val sigkill : int -(** Alias for {!Sys.sigkill} *) - -val sigpipe : int -(** Alias for {!Sys.sigpipe} *) - -val sigquit : int -(** Alias for {!Sys.sigquit} *) - -val sigsegv : int -(** Alias for {!Sys.sigsegv} *) - -val sigterm : int -(** Alias for {!Sys.sigterm} *) - -val sigusr1 : int -(** Alias for {!Sys.sigusr1} *) - -val sigusr2 : int -(** Alias for {!Sys.sigusr2} *) - -val sigchld : int -(** Alias for {!Sys.sigchld} *) - -val sigcont : int -(** Alias for {!Sys.sigcont} *) - -val sigstop : int -(** Alias for {!Sys.sigstop} *) - -val sigtstp : int -(** Alias for {!Sys.sigtstp} *) - -val sigttin : int -(** Alias for {!Sys.sigttin} *) - -val sigttou : int -(** Alias for {!Sys.sigttou} *) - -val sigvtalrm : int -(** Alias for {!Sys.sigvtalrm} *) - -val sigprof : int -(** Alias for {!Sys.sigprof} *) - val catch_break : bool -> unit (** Alias for {!Sys.catch_break} *) val ocaml_version : string (** Alias for {!Sys.ocaml_version} *) -@BEGIN_FROM_5_3_0@ -external poll_actions : unit -> unit = "%poll" -@END_FROM_5_3_0@ - -@BEGIN_BEFORE_5_3_0@ -val poll_actions : unit -> unit -@END_BEFORE_5_3_0@ - end diff --git a/stdcompat__uchar.ml.in b/stdcompat__uchar.ml.in index 3dc63fd..1bf2d0e 100644 --- a/stdcompat__uchar.ml.in +++ b/stdcompat__uchar.ml.in @@ -42,3 +42,20 @@ external seeded_hash_param : int -> int -> int -> 'a -> int = "caml_hash" [@@noalloc] let seeded_hash seed x = seeded_hash_param 10 100 seed x @END_BEFORE_5_3_0@ + +@BEGIN_BEFORE_5_4_0@ +let utf_8_decode_length_of_byte c = + let i = int_of_char c in + if i land 0b1_000_0000 = 0 then + 1 + else if i land 0b111_000_00 = 0b110_000_00 then + 2 + else if i land 0b1111_0000 = 0b1110_0000 then + 3 + else if i land 0b11111_000 = 0b11110_000 then + 4 + else + 0 + +let max_utf_8_decode_length = 4 +@END_BEFORE_5_4_0@ diff --git a/stdcompat__uchar_s.mli.in b/stdcompat__uchar_s.mli.in index f7d5917..5cb8f87 100644 --- a/stdcompat__uchar_s.mli.in +++ b/stdcompat__uchar_s.mli.in @@ -11,8 +11,17 @@ type t = Uchar.t @BEGIN_BEFORE_4_14_0@ @BEGIN_FROM_4_03_0@ type t = Uchar.t - @END_FROM_4_03_0@ +@BEGIN_BEFORE_4_03_0@ +@BEGIN_FROM_4_02_0@ +type t[@@immediate ] +@END_FROM_4_02_0@ +@BEGIN_BEFORE_4_02_0@ +type t +@END_BEFORE_4_02_0@ + +@END_BEFORE_4_03_0@ + @END_BEFORE_4_14_0@ (** @since 4.14.0: type t[@@immediate ] @since 4.03.0: type t @@ -39,6 +48,15 @@ type utf_decode (** @since 4.14.0: type utf_decode[@@immediate ] *) +val utf_8_decode_length_of_byte : char -> int +(** @since 5.4.0: val utf_8_decode_length_of_byte : char -> int *) + +val max_utf_8_decode_length : int +(** @since 5.4.0: val max_utf_8_decode_length : int *) + +val seeded_hash : int -> t -> int +(** @since 5.3.0: val seeded_hash : int -> t -> int *) + val utf_decode_is_valid : utf_decode -> bool (** @since 4.14.0: val utf_decode_is_valid : utf_decode -> bool *) @@ -108,8 +126,6 @@ val equal : t -> t -> bool val compare : t -> t -> int (** @since 4.03.0: val compare : t -> t -> int *) -val seeded_hash : int -> t -> int - val hash : t -> int (** @since 4.03.0: val hash : t -> int *) diff --git a/stdcompat__utf8.ml b/stdcompat__utf8.ml new file mode 100644 index 0000000..b3aab29 --- /dev/null +++ b/stdcompat__utf8.ml @@ -0,0 +1,15 @@ +let rec utf_8_scalar_width_aux count s pos len = + if len <= 0 then + count + else + let c = String.unsafe_get s pos in + let c_len = + match Stdcompat__uchar.utf_8_decode_length_of_byte c with + | 0 -> 1 + | c_len -> c_len in + utf_8_scalar_width_aux (succ count) s (pos + c_len) (len - c_len) + +let utf_8_scalar_width s ~pos ~len = + if pos < 0 || len < 0 || String.length s < pos + len then + invalid_arg "utf_8_scalar_width: invalid bounds"; + utf_8_scalar_width_aux 0 s pos len diff --git a/stdcompat__utf8.mli b/stdcompat__utf8.mli new file mode 100644 index 0000000..cdc31ba --- /dev/null +++ b/stdcompat__utf8.mli @@ -0,0 +1 @@ +val utf_8_scalar_width : string -> pos:int -> len:int -> int diff --git a/stdcompat__weak_s.mli.in b/stdcompat__weak_s.mli.in index 8b277ae..7787917 100644 --- a/stdcompat__weak_s.mli.in +++ b/stdcompat__weak_s.mli.in @@ -81,10 +81,10 @@ module type S = end *) -@BEGIN_FROM_4_05_0@ +@BEGIN_FROM_5_5_0@ module Make = Weak.Make -@END_FROM_4_05_0@ -@BEGIN_BEFORE_4_05_0@ +@END_FROM_5_5_0@ +@BEGIN_BEFORE_5_5_0@ module Make : functor (H : Hashtbl.HashedType) -> sig type data = H.t type t = Weak.Make(H).t val create : int -> t @@ -95,8 +95,8 @@ val find_all : t -> data -> data list val mem : t -> data -> bool val iter : (data -> unit) -> t -> unit val fold : (data -> 'acc -> 'acc) -> t -> 'acc -> 'acc val count : t -> int val stats : t -> (int * int * int * int * int * int) end -@END_BEFORE_4_05_0@ -(** @since 4.05.0: module Make = Weak.Make +@END_BEFORE_5_5_0@ +(** @since 5.5.0: module Make = Weak.Make *) val create : int -> 'a t diff --git a/stdcompat_tests.ml.in b/stdcompat_tests.ml.in index a7ce2e1..3bbef5e 100644 --- a/stdcompat_tests.ml.in +++ b/stdcompat_tests.ml.in @@ -868,10 +868,6 @@ let test_seq_4_14 () = test_seq_to_dispenser (); test_seq_ints () -let test_int32_min_max () = - assert (Stdcompat.Int32.min 1l 2l = 1l); - assert (Stdcompat.Int32.max 1l 2l = 2l) - let test_int32_unsigned_compare () = assert (Stdcompat.Int32.unsigned_compare 1l 2l < 0); assert (Stdcompat.Int32.unsigned_compare (-1l) 2l > 0) @@ -967,6 +963,779 @@ let test_channels () = Stdcompat.In_channel.input_all = "world"); Sys.remove "testfile" +let test_set_is_singleton () = + let module S = Stdcompat.Set.Make (Stdcompat.Int) in + assert (S.is_singleton (S.singleton 0)); + assert (not (S.is_singleton S.empty)); + assert (not (S.is_singleton (S.of_list [0; 1]))) + +let test_map_is_singleton () = + let module M = Stdcompat.Map.Make (Stdcompat.Int) in + assert (M.is_singleton (M.singleton 0 ())); + assert (not (M.is_singleton M.empty)); + assert (not (M.is_singleton (M.of_list [0, "a"; 1, "b"]))) + +let test_seq_singleton () = + assert (Stdcompat.List.of_seq (Stdcompat.Seq.singleton 1) = [1]) + +let test_seq_filteri () = + let f i j = + assert (i = j); + i mod 2 = 0 in + assert (Stdcompat.List.of_seq (Stdcompat.Seq.filteri f (Stdcompat.Seq.take 10 (Stdcompat.Seq.ints 0))) = [0;2;4;6;8]) + +let test_seq_delay () = + let executed = ref false in + let s = Stdcompat.Seq.delay (fun () -> + executed := true; + Stdcompat.Seq.empty) in + assert (not !executed); + assert (Stdcompat.Seq.is_empty s); + assert !executed + +let test_list_singleton () = + assert (Stdcompat.List.singleton 1 = [1]) + +let test_list_filter_mapi () = + assert (Stdcompat.List.filter_mapi (fun i s -> if s = "" then None else Some (i, s)) ["a"; ""; "b"] = [0, "a"; 2, "b"]) + +let test_list_split_map () = + assert (Stdcompat.List.split_map (fun i -> (i - 1, i + 1)) [1; 2; 3] = ([0; 1; 2], [2; 3; 4])) + +type empty = { absurd: 'a. 'a } + +let test_either_get_left () = + assert (Stdcompat.Either.get_left (Left 0) = 0); + try + (Stdcompat.Either.get_left (Right "") : empty).absurd + with Invalid_argument _ -> + () + +let test_either_get_right () = + assert (Stdcompat.Either.get_right (Right "") = ""); + try + (Stdcompat.Either.get_right (Left 0) : empty).absurd + with Invalid_argument _ -> + () + +let test_either_retract () = + assert (Stdcompat.Either.retract (Left 0) = 0); + assert (Stdcompat.Either.retract (Right "") = "") + +let test_option_product () = + assert (Stdcompat.Option.product (Some 0) (Some "") = Some (0, "")); + assert (Stdcompat.Option.product (Some 0) None = None); + assert (Stdcompat.Option.product None (Some "") = None); + assert (Stdcompat.Option.product None None = None) + +let test_option_blend () = + assert (Stdcompat.Option.blend (-) (Some 3) (Some 1) = Some 2); + assert (Stdcompat.Option.blend (+) (Some 0) None = Some 0); + assert (Stdcompat.Option.blend (+) None (Some 1) = Some 1); + assert (Stdcompat.Option.blend (+) None None = None) + +let test_option_for_all () = + assert (Stdcompat.Option.for_all (fun i -> i mod 2 = 0) (Some 0)); + assert (not (Stdcompat.Option.for_all (fun i -> i mod 2 = 0) (Some 1))); + assert (Stdcompat.Option.for_all (fun i -> i mod 2 = 0) None) + +let test_option_exists () = + assert (Stdcompat.Option.exists (fun i -> i mod 2 = 0) (Some 0)); + assert (not (Stdcompat.Option.exists (fun i -> i mod 2 = 0) (Some 1))); + assert (not (Stdcompat.Option.exists (fun i -> i mod 2 = 0) None)) + +let test_result_get_ok' () = + assert (Stdcompat.Result.get_ok' (Ok 0) = 0); + try + Stdcompat.Result.get_ok' (Error "msg") + with Invalid_argument s -> + assert (s = "msg") + +let test_result_error_to_failure () = + assert (Stdcompat.Result.error_to_failure (Ok 0) = 0); + try + Stdcompat.Result.error_to_failure (Error "msg") + with Failure s -> + assert (s = "msg") + +let test_result_product () = + assert (Stdcompat.Result.product (Ok 0) (Ok "") = Ok (0, "")); + assert (Stdcompat.Result.product (Ok 0) (Error "") = Error ""); + assert (Stdcompat.Result.product (Error 0) (Ok "") = Error 0); + assert (Stdcompat.Result.product (Error 0) (Error 1) = Error 0) + +let test_result_retract () = + assert (Stdcompat.Result.retract (Ok 0) = 0); + assert (Stdcompat.Result.retract (Error "") = "") + +let test_format_utf_8_scalar_width () = + assert (Stdcompat.Format.utf_8_scalar_width "abcd" ~pos:1 ~len:2 = 2); + assert (Stdcompat.Format.utf_8_scalar_width "abéçd" ~pos:1 ~len:5 = 3); + assert (Stdcompat.Format.utf_8_scalar_width "ab桁çd" ~pos:2 ~len:5 = 2) + +let test_int_min () = + assert (Stdcompat.Int.min 1 2 = 1) + +let test_int_max () = + assert (Stdcompat.Int.max 1 2 = 2) + +let test_int_fdiv () = + assert (Stdcompat.Int.fdiv 8 2 = 4); + assert (Stdcompat.Int.fdiv 9 2 = 4); + assert (Stdcompat.Int.fdiv (-8) 2 = -4); + assert (Stdcompat.Int.fdiv (-9) 2 = -5); + assert (Stdcompat.Int.fdiv 8 (-2) = -4); + assert (Stdcompat.Int.fdiv 9 (-2) = -5); + assert (Stdcompat.Int.fdiv 1 2 = 0); + assert (Stdcompat.Int.fdiv (-1) 2 = -1); + assert (Stdcompat.Int.fdiv 1 (-2) = -1) + +let test_int_cdiv () = + assert (Stdcompat.Int.cdiv 8 2 = 4); + assert (Stdcompat.Int.cdiv 9 2 = 5); + assert (Stdcompat.Int.cdiv (-8) 2 = -4); + assert (Stdcompat.Int.cdiv (-9) 2 = -4); + assert (Stdcompat.Int.cdiv 8 (-2) = -4); + assert (Stdcompat.Int.cdiv 9 (-2) = -4); + assert (Stdcompat.Int.cdiv 1 2 = 1); + assert (Stdcompat.Int.cdiv (-1) 2 = 0); + assert (Stdcompat.Int.cdiv 1 (-2) = 0) + +let test_int_ediv () = + assert (Stdcompat.Int.ediv 8 2 = 4); + assert (Stdcompat.Int.ediv 9 2 = 4); + assert (Stdcompat.Int.ediv (-8) 2 = -4); + assert (Stdcompat.Int.ediv (-9) 2 = -5); + assert (Stdcompat.Int.ediv 8 (-2) = -4); + assert (Stdcompat.Int.ediv 9 (-2) = -4); + assert (Stdcompat.Int.ediv 1 2 = 0); + assert (Stdcompat.Int.ediv (-1) 2 = -1); + assert (Stdcompat.Int.ediv 1 (-2) = 0) + +let test_int_erem () = + assert (Stdcompat.Int.erem 8 2 = 0); + assert (Stdcompat.Int.erem 9 2 = 1); + assert (Stdcompat.Int.erem (-8) 2 = 0); + assert (Stdcompat.Int.erem (-9) 2 = 1); + assert (Stdcompat.Int.erem 8 (-2) = 0); + assert (Stdcompat.Int.erem 9 (-2) = 1); + assert (Stdcompat.Int.erem 1 2 = 1); + assert (Stdcompat.Int.erem (-1) 2 = 1); + assert (Stdcompat.Int.erem 1 (-2) = 1) + +let test_int_popcount () = + assert (Stdcompat.Int.popcount 6 = 2); + assert (Stdcompat.Int.popcount (-6) = 61) + +let test_int_unsigned_bitsize () = + assert (Stdcompat.Int.unsigned_bitsize 14 = 4); + assert (Stdcompat.Int.unsigned_bitsize (-14) = 63) + +let test_int_signed_bitsize () = + assert (Stdcompat.Int.signed_bitsize 14 = 5); + assert (Stdcompat.Int.signed_bitsize (-14) = 5); + assert (Stdcompat.Int.signed_bitsize 16 = 6); + assert (Stdcompat.Int.signed_bitsize (-16) = 5) + +let test_int_leading_zeros () = + assert (Stdcompat.Int.leading_zeros 14 = 59); + assert (Stdcompat.Int.leading_zeros (-14) = 0) + +let test_int_leading_sign_bits () = + assert (Stdcompat.Int.leading_sign_bits 14 = 58); + assert (Stdcompat.Int.leading_sign_bits (-14) = 58); + assert (Stdcompat.Int.leading_sign_bits 16 = 57); + assert (Stdcompat.Int.leading_sign_bits (-16) = 58) + +let test_int_trailing_zeros () = + assert (Stdcompat.Int.trailing_zeros 0 = 63); + assert (Stdcompat.Int.trailing_zeros 4 = 2); + assert (Stdcompat.Int.trailing_zeros Stdcompat.Int.min_int = 62) + +let test_nativeint_min () = + assert (Stdcompat.Nativeint.min 1n 2n = 1n) + +let test_nativeint_max () = + assert (Stdcompat.Nativeint.max 1n 2n = 2n) + +let test_nativeint_fdiv () = + assert (Stdcompat.Nativeint.fdiv 8n 2n = 4n); + assert (Stdcompat.Nativeint.fdiv 9n 2n = 4n); + assert (Stdcompat.Nativeint.fdiv (-8n) 2n = -4n); + assert (Stdcompat.Nativeint.fdiv (-9n) 2n = -5n); + assert (Stdcompat.Nativeint.fdiv 8n (-2n) = -4n); + assert (Stdcompat.Nativeint.fdiv 9n (-2n) = -5n); + assert (Stdcompat.Nativeint.fdiv 1n 2n = 0n); + assert (Stdcompat.Nativeint.fdiv (-1n) 2n = -1n); + assert (Stdcompat.Nativeint.fdiv 1n (-2n) = -1n) + +let test_nativeint_cdiv () = + assert (Stdcompat.Nativeint.cdiv 8n 2n = 4n); + assert (Stdcompat.Nativeint.cdiv 9n 2n = 5n); + assert (Stdcompat.Nativeint.cdiv (-8n) 2n = -4n); + assert (Stdcompat.Nativeint.cdiv (-9n) 2n = -4n); + assert (Stdcompat.Nativeint.cdiv 8n (-2n) = -4n); + assert (Stdcompat.Nativeint.cdiv 9n (-2n) = -4n); + assert (Stdcompat.Nativeint.cdiv 1n 2n = 1n); + assert (Stdcompat.Nativeint.cdiv (-1n) 2n = 0n); + assert (Stdcompat.Nativeint.cdiv 1n (-2n) = 0n) + +let test_nativeint_ediv () = + assert (Stdcompat.Nativeint.ediv 8n 2n = 4n); + assert (Stdcompat.Nativeint.ediv 9n 2n = 4n); + assert (Stdcompat.Nativeint.ediv (-8n) 2n = -4n); + assert (Stdcompat.Nativeint.ediv (-9n) 2n = -5n); + assert (Stdcompat.Nativeint.ediv 8n (-2n) = -4n); + assert (Stdcompat.Nativeint.ediv 9n (-2n) = -4n); + assert (Stdcompat.Nativeint.ediv 1n 2n = 0n); + assert (Stdcompat.Nativeint.ediv (-1n) 2n = -1n); + assert (Stdcompat.Nativeint.ediv 1n (-2n) = 0n) + +let test_nativeint_erem () = + assert (Stdcompat.Nativeint.erem 8n 2n = 0n); + assert (Stdcompat.Nativeint.erem 9n 2n = 1n); + assert (Stdcompat.Nativeint.erem (-8n) 2n = 0n); + assert (Stdcompat.Nativeint.erem (-9n) 2n = 1n); + assert (Stdcompat.Nativeint.erem 8n (-2n) = 0n); + assert (Stdcompat.Nativeint.erem 9n (-2n) = 1n); + assert (Stdcompat.Nativeint.erem 1n 2n = 1n); + assert (Stdcompat.Nativeint.erem (-1n) 2n = 1n); + assert (Stdcompat.Nativeint.erem 1n (-2n) = 1n) + +let test_nativeint_popcount () = + assert (Stdcompat.Nativeint.popcount 6n = 2); + assert (Stdcompat.Nativeint.popcount (-6n) = 30) + +let test_nativeint_unsigned_bitsize () = + assert (Stdcompat.Nativeint.unsigned_bitsize 14n = 4); + assert (Stdcompat.Nativeint.unsigned_bitsize (-14n) = 64) + +let test_nativeint_signed_bitsize () = + assert (Stdcompat.Nativeint.signed_bitsize 14n = 5); + assert (Stdcompat.Nativeint.signed_bitsize (-14n) = 5); + assert (Stdcompat.Nativeint.signed_bitsize 16n = 6); + assert (Stdcompat.Nativeint.signed_bitsize (-16n) = 5) + +let test_nativeint_leading_zeros () = + assert (Stdcompat.Nativeint.leading_zeros 14n = 60); + assert (Stdcompat.Nativeint.leading_zeros (-14n) = 0) + +let test_nativeint_leading_sign_bits () = + assert (Stdcompat.Nativeint.leading_sign_bits 14n = 59); + assert (Stdcompat.Nativeint.leading_sign_bits (-14n) = 59); + assert (Stdcompat.Nativeint.leading_sign_bits 16n = 58); + assert (Stdcompat.Nativeint.leading_sign_bits (-16n) = 59) + +let test_nativeint_trailing_zeros () = + assert (Stdcompat.Nativeint.trailing_zeros 0n = 64); + assert (Stdcompat.Nativeint.trailing_zeros 4n = 2); + assert (Stdcompat.Nativeint.trailing_zeros Stdcompat.Nativeint.min_int = 63) + +let test_int32_min () = + assert (Stdcompat.Int32.min 1l 2l = 1l) + +let test_int32_max () = + assert (Stdcompat.Int32.max 1l 2l = 2l) + +let test_int32_fdiv () = + assert (Stdcompat.Int32.fdiv 8l 2l = 4l); + assert (Stdcompat.Int32.fdiv 9l 2l = 4l); + assert (Stdcompat.Int32.fdiv (-8l) 2l = -4l); + assert (Stdcompat.Int32.fdiv (-9l) 2l = -5l); + assert (Stdcompat.Int32.fdiv 8l (-2l) = -4l); + assert (Stdcompat.Int32.fdiv 9l (-2l) = -5l); + assert (Stdcompat.Int32.fdiv 1l 2l = 0l); + assert (Stdcompat.Int32.fdiv (-1l) 2l = -1l); + assert (Stdcompat.Int32.fdiv 1l (-2l) = -1l) + +let test_int32_cdiv () = + assert (Stdcompat.Int32.cdiv 8l 2l = 4l); + assert (Stdcompat.Int32.cdiv 9l 2l = 5l); + assert (Stdcompat.Int32.cdiv (-8l) 2l = -4l); + assert (Stdcompat.Int32.cdiv (-9l) 2l = -4l); + assert (Stdcompat.Int32.cdiv 8l (-2l) = -4l); + assert (Stdcompat.Int32.cdiv 9l (-2l) = -4l); + assert (Stdcompat.Int32.cdiv 1l 2l = 1l); + assert (Stdcompat.Int32.cdiv (-1l) 2l = 0l); + assert (Stdcompat.Int32.cdiv 1l (-2l) = 0l) + +let test_int32_ediv () = + assert (Stdcompat.Int32.ediv 8l 2l = 4l); + assert (Stdcompat.Int32.ediv 9l 2l = 4l); + assert (Stdcompat.Int32.ediv (-8l) 2l = -4l); + assert (Stdcompat.Int32.ediv (-9l) 2l = -5l); + assert (Stdcompat.Int32.ediv 8l (-2l) = -4l); + assert (Stdcompat.Int32.ediv 9l (-2l) = -4l); + assert (Stdcompat.Int32.ediv 1l 2l = 0l); + assert (Stdcompat.Int32.ediv (-1l) 2l = -1l); + assert (Stdcompat.Int32.ediv 1l (-2l) = 0l) + +let test_int32_erem () = + assert (Stdcompat.Int32.erem 8l 2l = 0l); + assert (Stdcompat.Int32.erem 9l 2l = 1l); + assert (Stdcompat.Int32.erem (-8l) 2l = 0l); + assert (Stdcompat.Int32.erem (-9l) 2l = 1l); + assert (Stdcompat.Int32.erem 8l (-2l) = 0l); + assert (Stdcompat.Int32.erem 9l (-2l) = 1l); + assert (Stdcompat.Int32.erem 1l 2l = 1l); + assert (Stdcompat.Int32.erem (-1l) 2l = 1l); + assert (Stdcompat.Int32.erem 1l (-2l) = 1l) + +let test_int32_popcount () = + assert (Stdcompat.Int32.popcount 6l = 2); + assert (Stdcompat.Int32.popcount (-6l) = 30) + +let test_int32_unsigned_bitsize () = + assert (Stdcompat.Int32.unsigned_bitsize 14l = 4); + assert (Stdcompat.Int32.unsigned_bitsize (-14l) = 32) + +let test_int32_signed_bitsize () = + assert (Stdcompat.Int32.signed_bitsize 14l = 5); + assert (Stdcompat.Int32.signed_bitsize (-14l) = 5); + assert (Stdcompat.Int32.signed_bitsize 16l = 6); + assert (Stdcompat.Int32.signed_bitsize (-16l) = 5) + +let test_int32_leading_zeros () = + assert (Stdcompat.Int32.leading_zeros 14l = 28); + assert (Stdcompat.Int32.leading_zeros (-14l) = 0) + +let test_int32_leading_sign_bits () = + assert (Stdcompat.Int32.leading_sign_bits 14l = 27); + assert (Stdcompat.Int32.leading_sign_bits (-14l) = 27); + assert (Stdcompat.Int32.leading_sign_bits 16l = 26); + assert (Stdcompat.Int32.leading_sign_bits (-16l) = 27) + +let test_int32_trailing_zeros () = + assert (Stdcompat.Int32.trailing_zeros 0l = 32); + assert (Stdcompat.Int32.trailing_zeros 4l = 2); + assert (Stdcompat.Int32.trailing_zeros Stdcompat.Int32.min_int = 31) + +let test_int64_min () = + assert (Stdcompat.Int64.min 1L 2L = 1L) + +let test_int64_max () = + assert (Stdcompat.Int64.max 1L 2L = 2L) + +let test_int64_fdiv () = + assert (Stdcompat.Int64.fdiv 8L 2L = 4L); + assert (Stdcompat.Int64.fdiv 9L 2L = 4L); + assert (Stdcompat.Int64.fdiv (-8L) 2L = -4L); + assert (Stdcompat.Int64.fdiv (-9L) 2L = -5L); + assert (Stdcompat.Int64.fdiv 8L (-2L) = -4L); + assert (Stdcompat.Int64.fdiv 9L (-2L) = -5L); + assert (Stdcompat.Int64.fdiv 1L 2L = 0L); + assert (Stdcompat.Int64.fdiv (-1L) 2L = -1L); + assert (Stdcompat.Int64.fdiv 1L (-2L) = -1L) + +let test_int64_cdiv () = + assert (Stdcompat.Int64.cdiv 8L 2L = 4L); + assert (Stdcompat.Int64.cdiv 9L 2L = 5L); + assert (Stdcompat.Int64.cdiv (-8L) 2L = -4L); + assert (Stdcompat.Int64.cdiv (-9L) 2L = -4L); + assert (Stdcompat.Int64.cdiv 8L (-2L) = -4L); + assert (Stdcompat.Int64.cdiv 9L (-2L) = -4L); + assert (Stdcompat.Int64.cdiv 1L 2L = 1L); + assert (Stdcompat.Int64.cdiv (-1L) 2L = 0L); + assert (Stdcompat.Int64.cdiv 1L (-2L) = 0L) + +let test_int64_ediv () = + assert (Stdcompat.Int64.ediv 8L 2L = 4L); + assert (Stdcompat.Int64.ediv 9L 2L = 4L); + assert (Stdcompat.Int64.ediv (-8L) 2L = -4L); + assert (Stdcompat.Int64.ediv (-9L) 2L = -5L); + assert (Stdcompat.Int64.ediv 8L (-2L) = -4L); + assert (Stdcompat.Int64.ediv 9L (-2L) = -4L); + assert (Stdcompat.Int64.ediv 1L 2L = 0L); + assert (Stdcompat.Int64.ediv (-1L) 2L = -1L); + assert (Stdcompat.Int64.ediv 1L (-2L) = 0L) + +let test_int64_erem () = + assert (Stdcompat.Int64.erem 8L 2L = 0L); + assert (Stdcompat.Int64.erem 9L 2L = 1L); + assert (Stdcompat.Int64.erem (-8L) 2L = 0L); + assert (Stdcompat.Int64.erem (-9L) 2L = 1L); + assert (Stdcompat.Int64.erem 8L (-2L) = 0L); + assert (Stdcompat.Int64.erem 9L (-2L) = 1L); + assert (Stdcompat.Int64.erem 1L 2L = 1L); + assert (Stdcompat.Int64.erem (-1L) 2L = 1L); + assert (Stdcompat.Int64.erem 1L (-2L) = 1L) + +let test_int64_popcount () = + assert (Stdcompat.Int64.popcount 6L = 2); + assert (Stdcompat.Int64.popcount (-6L) = 30) + +let test_int64_unsigned_bitsize () = + assert (Stdcompat.Int64.unsigned_bitsize 14L = 4); + assert (Stdcompat.Int64.unsigned_bitsize (-14L) = 64) + +let test_int64_signed_bitsize () = + assert (Stdcompat.Int64.signed_bitsize 14L = 5); + assert (Stdcompat.Int64.signed_bitsize (-14L) = 5); + assert (Stdcompat.Int64.signed_bitsize 16L = 6); + assert (Stdcompat.Int64.signed_bitsize (-16L) = 5) + +let test_int64_leading_zeros () = + assert (Stdcompat.Int64.leading_zeros 14L = 60); + assert (Stdcompat.Int64.leading_zeros (-14L) = 0) + +let test_int64_leading_sign_bits () = + assert (Stdcompat.Int64.leading_sign_bits 14L = 59); + assert (Stdcompat.Int64.leading_sign_bits (-14L) = 59); + assert (Stdcompat.Int64.leading_sign_bits 16L = 58); + assert (Stdcompat.Int64.leading_sign_bits (-16L) = 59) + +let test_int64_trailing_zeros () = + assert (Stdcompat.Int64.trailing_zeros 0L = 64); + assert (Stdcompat.Int64.trailing_zeros 4L = 2); + assert (Stdcompat.Int64.trailing_zeros Stdcompat.Int64.min_int = 63) + +let test_bool_logand () = + assert (Stdcompat.Bool.logand true true = true); + assert (Stdcompat.Bool.logand true false = false); + let no_shortcut = ref false in + assert (Stdcompat.Bool.logand false (no_shortcut := true; true) = false); + assert !no_shortcut; + let no_shortcut = ref false in + assert (Stdcompat.Bool.logand false (no_shortcut := true; false) = false); + assert !no_shortcut + +let test_bool_logor () = + let no_shortcut = ref false in + assert (Stdcompat.Bool.logor true (no_shortcut := true; true) = true); + assert !no_shortcut; + let no_shortcut = ref false in + assert (Stdcompat.Bool.logor true (no_shortcut := true; false) = true); + assert !no_shortcut; + assert (Stdcompat.Bool.logor false true = true); + assert (Stdcompat.Bool.logor false false = false) + +let test_bool_logxor () = + assert (Stdcompat.Bool.logxor true true = false); + assert (Stdcompat.Bool.logxor true false = true); + assert (Stdcompat.Bool.logxor false true = true); + assert (Stdcompat.Bool.logxor false false = false) + +let for_all_char f = + try + for i = 0 to 0xFF do + if not (f (char_of_int i)) then + raise Exit + done; + true + with Exit -> + false + +let test_char_ascii_is_valid () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_valid c = (c <= '\x7F'))) + +let test_char_ascii_is_upper () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_upper c = ('A' <= c && c <= 'Z'))) + +let test_char_ascii_is_lower () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_lower c = ('a' <= c && c <= 'z'))) + +let test_char_ascii_is_letter () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_letter c = (Stdcompat.Char.Ascii.is_upper c || Stdcompat.Char.Ascii.is_lower c))) + +let test_char_ascii_is_digit () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_digit c = ('0' <= c && c <= '9'))) + +let test_char_ascii_is_alphanum () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_alphanum c = (Stdcompat.Char.Ascii.is_digit c || Stdcompat.Char.Ascii.is_letter c))) + +let test_char_ascii_is_white () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_white c = (c = '\t' || c = '\n' || c = '\x0b' || c = '\x0c' || c = '\r' || c = ' '))) + +let test_char_ascii_is_blank () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_blank c = (c = ' ' || c = '\t'))) + +let test_char_ascii_is_graphic () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_graphic c = (c >= '\x21' && c <= '\x7E'))) + +let test_char_ascii_is_print () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_print c = (c >= '\x20' && c <= '\x7E'))) + +let test_char_ascii_is_control () = + assert (for_all_char (fun c -> Stdcompat.Char.Ascii.is_control c = (c <= '\x1F' || c = '\x7F'))) + +let test_char_ascii_digit_to_int () = + assert (Stdcompat.Char.Ascii.digit_to_int '0' = 0); + assert (Stdcompat.Char.Ascii.digit_to_int '9' = 9) + +let test_char_ascii_digit_of_int () = + assert (Stdcompat.Char.Ascii.digit_of_int 0 = '0'); + assert (Stdcompat.Char.Ascii.digit_of_int 627 = '7'); + assert (Stdcompat.Char.Ascii.digit_of_int (-627) = '7') + +let test_char_ascii_hex_digit_to_int () = + assert (Stdcompat.Char.Ascii.hex_digit_to_int '0' = 0); + assert (Stdcompat.Char.Ascii.hex_digit_to_int '9' = 9); + assert (Stdcompat.Char.Ascii.hex_digit_to_int 'a' = 10); + assert (Stdcompat.Char.Ascii.hex_digit_to_int 'A' = 10); + assert (Stdcompat.Char.Ascii.hex_digit_to_int 'f' = 15); + assert (Stdcompat.Char.Ascii.hex_digit_to_int 'F' = 15) + +let test_char_ascii_lower_hex_digit_of_int () = + assert (Stdcompat.Char.Ascii.lower_hex_digit_of_int 0 = '0'); + assert (Stdcompat.Char.Ascii.lower_hex_digit_of_int 0x8F = 'f'); + assert (Stdcompat.Char.Ascii.lower_hex_digit_of_int (-0x7A) = 'a') + +let test_char_ascii_upper_hex_digit_of_int () = + assert (Stdcompat.Char.Ascii.upper_hex_digit_of_int 0 = '0'); + assert (Stdcompat.Char.Ascii.upper_hex_digit_of_int 0x8F = 'F'); + assert (Stdcompat.Char.Ascii.upper_hex_digit_of_int (-0x7A) = 'A') + +let test_char_ascii_uppercase () = + assert (Stdcompat.Char.Ascii.uppercase 'a' = 'A'); + assert (Stdcompat.Char.Ascii.uppercase 'z' = 'Z'); + assert (Stdcompat.Char.Ascii.uppercase 'A' = 'A'); + assert (Stdcompat.Char.Ascii.uppercase '+' = '+') + +let test_char_ascii_lowercase () = + assert (Stdcompat.Char.Ascii.lowercase 'A' = 'a'); + assert (Stdcompat.Char.Ascii.lowercase 'Z' = 'z'); + assert (Stdcompat.Char.Ascii.lowercase 'a' = 'a'); + assert (Stdcompat.Char.Ascii.lowercase '+' = '+') + +let test_string_edit_distance () = + assert (Stdcompat.String.edit_distance "" "" = 0); + assert (Stdcompat.String.edit_distance "" "ab" = 2); + assert (Stdcompat.String.edit_distance "ca" "abc" = 3) + +let test_string_spellcheck () = + let dict = ["abc"; "bact"] in + let iter_dict yield = List.iter yield dict in + assert (Stdcompat.String.spellcheck iter_dict "ab" = []); + assert (Stdcompat.String.spellcheck iter_dict "abd" = ["abc"]); + assert (Stdcompat.String.spellcheck iter_dict "bac" = ["abc"; "bact"]) + +let test_string_of_char () = + assert (Stdcompat.String.of_char 'a' = "a") + +let test_string_is_empty () = + assert (Stdcompat.String.is_empty "" = true); + assert (Stdcompat.String.is_empty " " = false) + +let test_string_take_first () = + assert (Stdcompat.String.take_first 2 "tests" = "te"); + assert (Stdcompat.String.take_first 6 "tests" = "tests"); + assert (Stdcompat.String.take_first (-1) "tests" = "") + +let test_string_take_last () = + assert (Stdcompat.String.take_last 2 "tests" = "ts"); + assert (Stdcompat.String.take_last 6 "tests" = "tests"); + assert (Stdcompat.String.take_last (-1) "tests" = "") + +let test_string_drop_first () = + assert (Stdcompat.String.drop_first 2 "tests" = "sts"); + assert (Stdcompat.String.drop_first 6 "tests" = ""); + assert (Stdcompat.String.drop_first (-1) "tests" = "tests") + +let test_string_drop_last () = + assert (Stdcompat.String.drop_last 2 "tests" = "tes"); + assert (Stdcompat.String.drop_last 6 "tests" = ""); + assert (Stdcompat.String.drop_last (-1) "tests" = "tests") + +let test_string_cut_first () = + assert (Stdcompat.String.cut_first 2 "tests" = ("te", "sts")); + assert (Stdcompat.String.cut_first 6 "tests" = ("tests", "")); + assert (Stdcompat.String.cut_first (-1) "tests" = ("", "tests")) + +let test_string_cut_last () = + assert (Stdcompat.String.cut_last 2 "tests" = ("tes", "ts")); + assert (Stdcompat.String.cut_last 6 "tests" = ("", "tests")); + assert (Stdcompat.String.cut_last (-1) "tests" = ("tests", "")) + +let raises_invalid_argument f = + try + let _ = f () in + false + with Invalid_argument _ -> + true + +let test_string_find_first_index () = + assert (Stdcompat.String.find_first_index ((=) 'a') "" = None); + assert (Stdcompat.String.find_first_index ((=) 'a') "baca" = Some 1); + assert (Stdcompat.String.find_first_index ((=) 'a') "bc" = None); + assert (Stdcompat.String.find_first_index ((=) 'a') ~start:1 "baca" = Some 1); + assert (Stdcompat.String.find_first_index ((=) 'a') ~start:2 "baca" = Some 3); + assert (Stdcompat.String.find_first_index ((=) 'a') ~start:4 "baca" = None); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_first_index ((=) 'a') ~start:5 "baca")); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_first_index ((=) 'a') ~start:(-1) "baca")) + +let test_string_find_last_index () = + assert (Stdcompat.String.find_last_index ((=) 'a') "" = None); + assert (Stdcompat.String.find_last_index ((=) 'a') "baca" = Some 3); + assert (Stdcompat.String.find_last_index ((=) 'a') "bc" = None); + assert (Stdcompat.String.find_last_index ((=) 'a') ~start:3 "baca" = Some 3); + assert (Stdcompat.String.find_last_index ((=) 'a') ~start:2 "baca" = Some 1); + assert (Stdcompat.String.find_last_index ((=) 'a') ~start:1 "baca" = Some 1); + assert (Stdcompat.String.find_last_index ((=) 'a') ~start:0 "baca" = None); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_last_index ((=) 'a') ~start:5 "baca")); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_last_index ((=) 'a') ~start:(-1) "baca")) + +let test_string_take_first_while () = + assert (Stdcompat.String.take_first_while ((=) 'a') "" = ""); + assert (Stdcompat.String.take_first_while ((=) 'a') "aaa" = "aaa"); + assert (Stdcompat.String.take_first_while ((=) 'a') "aabc" = "aa"); + assert (Stdcompat.String.take_first_while ((=) 'a') "bc" = "") + +let test_string_take_last_while () = + assert (Stdcompat.String.take_last_while ((=) 'a') "" = ""); + assert (Stdcompat.String.take_last_while ((=) 'a') "aaa" = "aaa"); + assert (Stdcompat.String.take_last_while ((=) 'a') "bcaa" = "aa"); + assert (Stdcompat.String.take_last_while ((=) 'a') "bc" = "") + +let test_string_drop_first_while () = + assert (Stdcompat.String.drop_first_while ((=) 'a') "" = ""); + assert (Stdcompat.String.drop_first_while ((=) 'a') "aaa" = ""); + assert (Stdcompat.String.drop_first_while ((=) 'a') "aabc" = "bc"); + assert (Stdcompat.String.drop_first_while ((=) 'a') "bc" = "bc") + +let test_string_drop_last_while () = + assert (Stdcompat.String.drop_last_while ((=) 'a') "" = ""); + assert (Stdcompat.String.drop_last_while ((=) 'a') "aaa" = ""); + assert (Stdcompat.String.drop_last_while ((=) 'a') "bcaa" = "bc"); + assert (Stdcompat.String.drop_last_while ((=) 'a') "bc" = "bc") + +let test_string_cut_first_while () = + assert (Stdcompat.String.cut_first_while ((=) 'a') "" = ("", "")); + assert (Stdcompat.String.cut_first_while ((=) 'a') "aaa" = ("aaa", "")); + assert (Stdcompat.String.cut_first_while ((=) 'a') "aabc" = ("aa", "bc")); + assert (Stdcompat.String.cut_first_while ((=) 'a') "bc" = ("", "bc")) + +let test_string_cut_last_while () = + assert (Stdcompat.String.cut_last_while ((=) 'a') "" = ("", "")); + assert (Stdcompat.String.cut_last_while ((=) 'a') "aaa" = ("", "aaa")); + assert (Stdcompat.String.cut_last_while ((=) 'a') "bcaa" = ("bc", "aa")); + assert (Stdcompat.String.cut_last_while ((=) 'a') "bc" = ("bc", "")) + +let test_string_find_first () = + assert (Stdcompat.String.find_first ~sub:"ababc" "abababc" = Some 2); + assert (Stdcompat.String.find_first ~sub:"ababc" "ababab" = None); + assert (Stdcompat.String.find_first ~sub:"ababc" "ababcababc" = Some 0); + assert (Stdcompat.String.find_first ~sub:"ababc" ~start:1 "ababcababc" = Some 5); + assert (Stdcompat.String.find_first ~sub:"" ~start:1 "abc" = Some 1); + assert (Stdcompat.String.find_first ~sub:"" "" = Some 0); + assert (Stdcompat.String.find_first ~sub:"a" "" = None); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_first ~sub:"" ~start:5 "baca")); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_first ~sub:"baca" ~start:(-1) "baca")) + +let test_string_find_last () = + assert (Stdcompat.String.find_last ~sub:"ababc" "abababc" = Some 2); + assert (Stdcompat.String.find_last ~sub:"ababc" "ababab" = None); + assert (Stdcompat.String.find_last ~sub:"ababc" "ababcababc" = Some 5); + assert (Stdcompat.String.find_last ~sub:"ababc" ~start:5 "ababcababc" = Some 5); + assert (Stdcompat.String.find_last ~sub:"ababc" ~start:4 "ababcababc" = Some 0); + assert (Stdcompat.String.find_last ~sub:"" ~start:1 "abc" = Some 1); + assert (Stdcompat.String.find_last ~sub:"" "" = Some 0); + assert (Stdcompat.String.find_last ~sub:"a" "" = None); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_last ~sub:"" ~start:5 "baca")); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_last ~sub:"baca" ~start:(-1) "baca")) + +let test_string_find_all () = + assert (Stdcompat.String.find_all ~sub:"abab" Stdcompat.List.cons "ababababab" [] = [4; 0]); + assert (Stdcompat.String.find_all ~sub:"abab" Stdcompat.List.cons ~start:1 "ababababab" [] = [6; 2]); + assert (Stdcompat.String.find_all ~sub:"" Stdcompat.List.cons "abc" [] = [3; 2; 1; 0]); + assert (Stdcompat.String.find_all ~sub:"" Stdcompat.List.cons "" [] = [0]); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_all ~sub:"" Stdcompat.List.cons ~start:5 "baca" [])); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.find_all ~sub:"baca" Stdcompat.List.cons ~start:(-1) "baca" [])) + +let test_string_rfind_all () = + assert (Stdcompat.String.rfind_all ~sub:"abab" Stdcompat.List.cons "ababababab" [] = [2; 6]); + assert (Stdcompat.String.rfind_all ~sub:"abab" Stdcompat.List.cons ~start:6 "ababababab" [] = [2; 6]); + assert (Stdcompat.String.rfind_all ~sub:"abab" Stdcompat.List.cons ~start:5 "ababababab" [] = [0; 4]); + assert (Stdcompat.String.rfind_all ~sub:"" Stdcompat.List.cons "abc" [] = [0; 1; 2; 3]); + assert (Stdcompat.String.rfind_all ~sub:"" Stdcompat.List.cons "" [] = [0]); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.rfind_all ~sub:"" Stdcompat.List.cons ~start:5 "baca" [])); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.rfind_all ~sub:"baca" Stdcompat.List.cons ~start:(-1) "baca" [])) + +let test_string_includes () = + assert (Stdcompat.String.includes ~affix:"ababc" "abababcab"); + assert (not (Stdcompat.String.includes ~affix:"ababc" "abababab")); + assert (Stdcompat.String.includes ~affix:"" "abababab"); + assert (not (Stdcompat.String.includes ~affix:"ababc" "")) + +let test_string_split_first () = + assert (Stdcompat.String.split_first ~sep:"abab" "ababababab" = Some ("", "ababab")); + assert (Stdcompat.String.split_first ~sep:"" "abab" = Some ("", "abab")); + assert (Stdcompat.String.split_first ~sep:"xyz" "abab" = None) + +let test_string_split_last () = + assert (Stdcompat.String.split_last ~sep:"abab" "ababababab" = Some ("ababab", "")); + assert (Stdcompat.String.split_last ~sep:"" "abab" = Some ("abab", "")); + assert (Stdcompat.String.split_last ~sep:"xyz" "abab" = None) + +let test_string_split_all () = + assert (Stdcompat.String.split_all ~sep:"abab" "ababababab" = [""; ""; "ab"]); + assert (Stdcompat.String.split_all ~sep:"abab" ~drop:(fun s -> s = "y") "ababxababy" = [""; "x"]); + assert (Stdcompat.String.split_all ~sep:"" "abab" = [""; "a"; "b"; "a"; "b"; ""]) + +let test_string_rsplit_all () = + assert (Stdcompat.String.rsplit_all ~sep:"abab" "ababababab" = ["ab"; ""; ""]); + assert (Stdcompat.String.rsplit_all ~sep:"abab" ~drop:(fun s -> s = "y") "ababxababy" = [""; "x"]); + assert (Stdcompat.String.rsplit_all ~sep:"" "abab" = [""; "a"; "b"; "a"; "b"; ""]) + +let test_string_replace_first () = + assert (Stdcompat.String.replace_first ~sub:"abab" ~by:"xyz" "ababababab" = "xyzababab"); + assert (Stdcompat.String.replace_first ~sub:"abab" ~by:"xyz" ~start:1 "ababababab" = "abxyzabab"); + assert (Stdcompat.String.replace_first ~sub:"" ~by:"xyz" ~start:1 "abab" = "axyzbab"); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.replace_first ~sub:"" ~by:"" ~start:5 "baca")); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.replace_first ~sub:"baca" ~by:"" ~start:(-1) "baca")) + +let test_string_replace_last () = + assert (Stdcompat.String.replace_last ~sub:"abab" ~by:"xyz" "ababababab" = "abababxyz"); + assert (Stdcompat.String.replace_last ~sub:"abab" ~by:"xyz" ~start:6 "ababababab" = "abababxyz"); + assert (Stdcompat.String.replace_last ~sub:"abab" ~by:"xyz" ~start:5 "ababababab" = "ababxyzab"); + assert (Stdcompat.String.replace_last ~sub:"" ~by:"xyz" ~start:1 "abab" = "axyzbab"); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.replace_last ~sub:"" ~by:"" ~start:5 "baca")); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.replace_last ~sub:"baca" ~by:"" ~start:(-1) "baca")) + +let test_string_replace_all () = + assert (Stdcompat.String.replace_all ~sub:"abab" ~by:"xyz" "ababababab" = "xyzxyzab"); + assert (Stdcompat.String.replace_all ~sub:"abab" ~by:"xyz" ~start:1 "ababababab" = "abxyzxyz"); + assert (Stdcompat.String.replace_all ~sub:"" ~by:"xyz" ~start:1 "abab" = "axyzbxyzaxyzbxyz"); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.replace_all ~sub:"" ~by:"" ~start:5 "baca")); + assert (raises_invalid_argument (fun () -> + Stdcompat.String.replace_all ~sub:"baca" ~by:"" ~start:(-1) "baca")) + +let test_array_equal () = + assert (Stdcompat.Array.equal Stdcompat.Int.equal [||] [||]); + assert (Stdcompat.Array.equal Stdcompat.Int.equal [|1; 2|] [|1; 2|]); + assert (not (Stdcompat.Array.equal Stdcompat.Int.equal [|1; 2|] [|1; 3|])); + assert (not (Stdcompat.Array.equal Stdcompat.Int.equal [|1|] [|1; 3|])); + assert (not (Stdcompat.Array.equal Stdcompat.Int.equal [|1; 2|] [|1|])) + +let test_array_compare () = + assert (Stdcompat.Array.compare Stdcompat.Int.compare [||] [||] = 0); + assert (Stdcompat.Array.compare Stdcompat.Int.compare [|1; 2|] [|1; 2|] = 0); + assert (Stdcompat.Array.compare Stdcompat.Int.compare [|1; 2; 3|] [|1; 3; 2|] < 0); + assert (Stdcompat.Array.compare Stdcompat.Int.compare [|1; 3; 2|] [|1; 2; 3|] > 0); + assert (Stdcompat.Array.compare Stdcompat.Int.compare [|1|] [|1; 3|] < 0); + assert (Stdcompat.Array.compare Stdcompat.Int.compare [|1; 2|] [|1|] > 0) + +let test_array_stable_sort_sub () = + let a = [|0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10|] in + Stdcompat.Array.stable_sort_sub (fun i j -> Stdcompat.Int.compare (j / 2) (i / 2)) a 1 (Array.length a - 2); + assert (a = [|0; 8; 9; 6; 7; 4; 5; 2; 3; 1; 10|]) + let tests () = testing "hypot" (fun () -> assert (Stdcompat.hypot 3. 4. = 5.); @@ -1481,7 +2250,6 @@ let tests () = test_format_pp_print_seq (); test_either (); test_seq_concat (); - test_int32_min_max (); test_int32_unsigned_compare (); test_array_fold_left_map (); test_array_find_opt (); @@ -1495,6 +2263,128 @@ let tests () = test_string_starts_with (); test_string_ends_with (); test_channels (); + testing "Set.is_singleton" test_set_is_singleton; + testing "Map.is_singleton" test_map_is_singleton; + testing "Seq.singleton" test_seq_singleton; + testing "Seq.filteri" test_seq_filteri; + testing "Seq.delay" test_seq_delay; + testing "List.singleton" test_list_singleton; + testing "List.filter_mapi" test_list_filter_mapi; + testing "List.split_map" test_list_split_map; + testing "Either.get_left" test_either_get_left; + testing "Either.get_right" test_either_get_right; + testing "Either.retract" test_either_retract; + testing "Option.product" test_option_product; + testing "Option.blend" test_option_blend; + testing "Option.for_all" test_option_for_all; + testing "Option.exists" test_option_exists; + testing "Result.get_ok'" test_result_get_ok'; + testing "Result.error_to_failure" test_result_error_to_failure; + testing "Result.product" test_result_product; + testing "Result.retract" test_result_retract; + testing "Format.utf_8_scalar_width" test_format_utf_8_scalar_width; + testing "Int.min" test_int_min; + testing "Int.max" test_int_max; + testing "Int.fdiv" test_int_fdiv; + testing "Int.cdiv" test_int_cdiv; + testing "Int.ediv" test_int_ediv; + testing "Int.erem" test_int_erem; + testing "Int.popcount" test_int_erem; + testing "Int.unsigned_bitsize" test_int_unsigned_bitsize; + testing "Int.signed_bitsize" test_int_signed_bitsize; + testing "Int.leading_zeros" test_int_leading_zeros; + testing "Int.leading_sign_bits" test_int_leading_sign_bits; + testing "Int.trailing_zeros" test_int_trailing_zeros; + testing "Nativeint.min" test_nativeint_min; + testing "Nativeint.max" test_nativeint_max; + testing "Nativeint.fdiv" test_nativeint_fdiv; + testing "Nativeint.cdiv" test_nativeint_cdiv; + testing "Nativeint.ediv" test_nativeint_ediv; + testing "Nativeint.erem" test_nativeint_erem; + testing "Nativeint.popcount" test_nativeint_erem; + testing "Nativeint.unsigned_bitsize" test_nativeint_unsigned_bitsize; + testing "Nativeint.signed_bitsize" test_nativeint_signed_bitsize; + testing "Nativeint.leading_zeros" test_nativeint_leading_zeros; + testing "Nativeint.leading_sign_bits" test_nativeint_leading_sign_bits; + testing "Nativeint.trailing_zeros" test_nativeint_trailing_zeros; + testing "Int32.min" test_int32_min; + testing "Int32.max" test_int32_max; + testing "Int32.fdiv" test_int32_fdiv; + testing "Int32.cdiv" test_int32_cdiv; + testing "Int32.ediv" test_int32_ediv; + testing "Int32.erem" test_int32_erem; + testing "Int32.popcount" test_int32_erem; + testing "Int32.unsigned_bitsize" test_int32_unsigned_bitsize; + testing "Int32.signed_bitsize" test_int32_signed_bitsize; + testing "Int32.leading_zeros" test_int32_leading_zeros; + testing "Int32.leading_sign_bits" test_int32_leading_sign_bits; + testing "Int32.trailing_zeros" test_int32_trailing_zeros; + testing "Int64.min" test_int64_min; + testing "Int64.max" test_int64_max; + testing "Int64.fdiv" test_int64_fdiv; + testing "Int64.cdiv" test_int64_cdiv; + testing "Int64.ediv" test_int64_ediv; + testing "Int64.erem" test_int64_erem; + testing "Int64.popcount" test_int64_erem; + testing "Int64.unsigned_bitsize" test_int64_unsigned_bitsize; + testing "Int64.signed_bitsize" test_int64_signed_bitsize; + testing "Int64.leading_zeros" test_int64_leading_zeros; + testing "Int64.leading_sign_bits" test_int64_leading_sign_bits; + testing "Int64.trailing_zeros" test_int64_trailing_zeros; + testing "Bool.logand" test_bool_logand; + testing "Bool.logor" test_bool_logor; + testing "Bool.logxor" test_bool_logxor; + testing "Char.Ascii.is_valid" test_char_ascii_is_valid; + testing "Char.Ascii.is_upper" test_char_ascii_is_upper; + testing "Char.Ascii.is_lower" test_char_ascii_is_lower; + testing "Char.Ascii.is_letter" test_char_ascii_is_letter; + testing "Char.Ascii.is_digit" test_char_ascii_is_digit; + testing "Char.Ascii.is_alphanum" test_char_ascii_is_alphanum; + testing "Char.Ascii.is_white" test_char_ascii_is_white; + testing "Char.Ascii.is_blank" test_char_ascii_is_blank; + testing "Char.Ascii.is_graphic" test_char_ascii_is_graphic; + testing "Char.Ascii.is_print" test_char_ascii_is_print; + testing "Char.Ascii.is_control" test_char_ascii_is_control; + testing "Char.Ascii.digit_to_int" test_char_ascii_digit_to_int; + testing "Char.Ascii.digit_of_int" test_char_ascii_digit_of_int; + testing "Char.Ascii.hex_digit_to_int" test_char_ascii_hex_digit_to_int; + testing "Char.Ascii.lower_hex_digit_of_int" test_char_ascii_lower_hex_digit_of_int; + testing "Char.Ascii.upper_hex_digit_of_int" test_char_ascii_upper_hex_digit_of_int; + testing "Char.Ascii.lowercase" test_char_ascii_lowercase; + testing "Char.Ascii.uppercase" test_char_ascii_uppercase; + testing "String.edit_distance" test_string_edit_distance; + testing "String.spellcheck" test_string_spellcheck; + testing "String.of_char" test_string_of_char; + testing "String.is_empty" test_string_is_empty; + testing "String.take_first" test_string_take_first; + testing "String.take_last" test_string_take_last; + testing "String.drop_first" test_string_drop_first; + testing "String.drop_last" test_string_drop_last; + testing "String.cut_first" test_string_cut_first; + testing "String.cut_last" test_string_cut_last; + testing "String.find_first_index" test_string_find_first_index; + testing "String.find_last_index" test_string_find_last_index; + testing "String.take_first_while" test_string_take_first_while; + testing "String.take_last_while" test_string_take_last_while; + testing "String.drop_first_while" test_string_drop_first_while; + testing "String.drop_last_while" test_string_drop_last_while; + testing "String.cut_first_while" test_string_cut_first_while; + testing "String.cut_last_while" test_string_cut_last_while; + testing "String.find_first" test_string_find_first; + testing "String.find_last" test_string_find_last; + testing "String.find_all" test_string_find_all; + testing "String.rfind_all" test_string_rfind_all; + testing "String.includes" test_string_includes; + testing "String.split_first" test_string_split_first; + testing "String.split_last" test_string_split_last; + testing "String.split_all" test_string_split_all; + testing "String.rsplit_all" test_string_rsplit_all; + testing "String.replace_first" test_string_replace_first; + testing "String.replace_last" test_string_replace_last; + testing "String.replace_all" test_string_replace_all; + testing "Array.equal" test_array_equal; + testing "Array.compare" test_array_compare; + testing "Array.stable_sort_sub" test_array_stable_sort_sub; () let () = From 96ae0561c98c07ba30ec991061ae9e5f8b41c4f3 Mon Sep 17 00:00:00 2001 From: Thierry Martinez Date: Wed, 12 Aug 2026 13:01:39 +0200 Subject: [PATCH 4/4] Add OCaml 5.4 and 5.5 to CI --- .github/workflows/check-generated-files.yml | 4 ++++ .github/workflows/main.yml | 4 ++++ tools/compiler_version.ml | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/.github/workflows/check-generated-files.yml b/.github/workflows/check-generated-files.yml index 906cc52..bbc9237 100644 --- a/.github/workflows/check-generated-files.yml +++ b/.github/workflows/check-generated-files.yml @@ -20,6 +20,8 @@ jobs: - 5.1.x - 5.2.x - 5.3.x + - 5.4.x + - 5.5.x runs-on: ubuntu-latest steps: - name: Checkout @@ -45,6 +47,8 @@ jobs: - 5.1.x - 5.2.x - 5.3.x + - 5.4.x + - 5.5.x runs-on: ${{ matrix.os }} steps: - name: Checkout diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e0a3be..81368af 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,6 +24,8 @@ jobs: - 5.1.x - 5.2.x - 5.3.x + - 5.4.x + - 5.5.x runs-on: ubuntu-latest steps: - name: Checkout @@ -53,6 +55,8 @@ jobs: - 5.1.x - 5.2.x - 5.3.x + - 5.4.x + - 5.5.x runs-on: ${{ matrix.os }} steps: - name: Checkout diff --git a/tools/compiler_version.ml b/tools/compiler_version.ml index f675a20..2c9779f 100644 --- a/tools/compiler_version.ml +++ b/tools/compiler_version.ml @@ -81,12 +81,17 @@ let v4_13_1 = mk 4 13 1 let v4_14_0 = mk 4 14 0 let v4_14_1 = mk 4 14 1 let v4_14_2 = mk 4 14 2 +let v4_14_3 = mk 4 14 3 +let v4_14_4 = mk 4 14 4 let v5_0_0 = mk 5 0 0 let v5_1_0 = mk 5 1 0 let v5_1_1 = mk 5 1 1 let v5_2_0 = mk 5 2 0 let v5_2_1 = mk 5 2 1 let v5_3_0 = mk 5 3 0 +let v5_4_0 = mk 5 4 0 +let v5_4_1 = mk 5 4 1 +let v5_5_0 = mk 5 5 0 let known_versions = [ @@ -127,12 +132,17 @@ let known_versions = v4_14_0; v4_14_1; v4_14_2; + v4_14_3; + v4_14_4; v5_0_0; v5_1_0; v5_1_1; v5_2_0; v5_2_1; v5_3_0; + v5_4_0; + v5_4_1; + v5_5_0; ] let is_known v = List.mem v known_versions