From 63119d6ccf4235849b21eebb24ef03c3a6807141 Mon Sep 17 00:00:00 2001 From: c-cube Date: Thu, 30 Jan 2025 03:35:54 +0000 Subject: [PATCH] deploy: 55eb9c2a2f0bf6e3a9b04a8c3ec41ae21778836a --- ocaml/Arch/index.html | 2 +- ocaml/Asmgen/index.html | 2 +- ocaml/Asmlibrarian/index.html | 2 +- ocaml/Asmlink/index.html | 2 +- ocaml/Asmpackager/index.html | 2 +- ocaml/Ast_helper/Const/index.html | 4 +- ocaml/Ast_helper/Exp/index.html | 11 +- ocaml/Ast_helper/Pat/index.html | 5 + ocaml/Ast_helper/Typ/index.html | 7 +- ocaml/Ast_iterator/index.html | 4 +- ocaml/Ast_mapper/index.html | 14 +- ocaml/Asttypes/index.html | 2 +- ocaml/Attr_helper/index.html | 4 +- ocaml/Backend_var/index.html | 2 +- ocaml/Btype/TypeHash/index.html | 2 +- ocaml/Btype/index.html | 14 +- ocaml/Builtin_attributes/index.html | 11 +- ocaml/Bytegen/index.html | 4 +- ocaml/Bytelibrarian/index.html | 2 +- ocaml/Bytelink/Dep/index.html | 2 +- ocaml/Bytelink/index.html | 7 +- ocaml/Bytepackager/index.html | 2 +- .../Engine/Make/argument-1-T/index.html | 8 +- .../EngineTypes/index.html | 2 +- .../EngineTypes/module-type-LOG/index.html | 6 + .../EngineTypes/module-type-TABLE/index.html | 8 +- .../Make/argument-3-ET/index.html | 8 +- .../LexerUtil/index.html | 3 +- .../StaticVersion/index.html | 2 +- .../MakeEngineTable/index.html | 8 +- ocaml/CamlinternalOO/index.html | 6 +- ocaml/Ccomp/index.html | 2 +- ocaml/Clambda/index.html | 2 +- ocaml/Clambda_primitives/index.html | 2 +- ocaml/Clflags/index.html | 2 +- ocaml/Cmi_format/index.html | 2 +- ocaml/Cmm/index.html | 4 +- ocaml/Cmm_helpers/index.html | 2 +- ocaml/Cmo_format/index.html | 2 +- ocaml/Cmt2annot/index.html | 2 +- ocaml/Cmt_format/index.html | 15 +- ocaml/Compenv/index.html | 2 +- ocaml/Compile_common/index.html | 12 +- ocaml/Compilenv/index.html | 4 +- ocaml/Config/index.html | 2 +- ocaml/Config_boot/index.html | 2 +- ocaml/Config_main/index.html | 2 +- ocaml/Ctype/Pattern_env/index.html | 2 + ocaml/Ctype/index.html | 39 +- ocaml/Datarepr/index.html | 4 +- ocaml/Depend/index.html | 2 +- ocaml/Diffing/index.html | 2 +- ocaml/Diffing_with_keys/index.html | 2 +- ocaml/Domainstate/index.html | 2 +- ocaml/Emitaux/index.html | 6 +- ocaml/Emitcode/index.html | 7 +- ocaml/Env/index.html | 34 +- ocaml/Envaux/index.html | 2 +- ocaml/Errortrace/index.html | 4 +- ocaml/Errortrace_report/index.html | 43 + ocaml/Flambda/index.html | 2 +- ocaml/Flambda_iterators/index.html | 4 +- ocaml/Format_doc/Doc/index.html | 9 + ocaml/Format_doc/index.html | 44 + ocaml/Freshening/index.html | 5 +- ocaml/Gprinttyp/Decoration/index.html | 2 + ocaml/Gprinttyp/index.html | 103 + ocaml/Ident/index.html | 2 +- ocaml/Includeclass/index.html | 8 +- ocaml/Includecore/index.html | 23 +- ocaml/Includemod/index.html | 25 +- ocaml/Includemod_errorprinter/index.html | 6 +- ocaml/Instruct/index.html | 2 +- ocaml/Lambda/index.html | 19 +- ocaml/Lexer/index.html | 2 +- ocaml/Linear/index.html | 2 +- ocaml/Linkdeps/index.html | 12 + ocaml/Load_path/Dir/index.html | 2 +- ocaml/Load_path/index.html | 10 +- ocaml/Local_store/index.html | 2 +- ocaml/Location/Doc/index.html | 2 + ocaml/Location/index.html | 24 +- ocaml/Mach/index.html | 2 +- ocaml/Main_args/Default/Main/index.html | 2 +- ocaml/Main_args/Default/Odoc_args/index.html | 2 +- ocaml/Main_args/Default/Optmain/index.html | 2 +- ocaml/Main_args/Default/Opttopmain/index.html | 2 +- ocaml/Main_args/Default/Topmain/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../module-type-Bytecomp_options/index.html | 2 +- .../module-type-Bytetop_options/index.html | 2 +- .../module-type-Common_options/index.html | 2 +- .../module-type-Compiler_options/index.html | 2 +- .../module-type-Core_options/index.html | 2 +- .../module-type-Ocamldoc_options/index.html | 2 +- .../module-type-Optcomp_options/index.html | 2 +- .../module-type-Opttop_options/index.html | 2 +- .../module-type-Toplevel_options/index.html | 2 +- ocaml/Matching/index.html | 21 +- ocaml/Meta/index.html | 5 +- ocaml/Misc/Color/index.html | 2 +- ocaml/Misc/LongString/index.html | 2 - ocaml/Misc/Stdlib/List/index.html | 2 +- ocaml/Misc/Stdlib/String/index.html | 4 +- ocaml/Misc/Style/index.html | 2 + ocaml/Misc/Utf8_lexeme/index.html | 2 + ocaml/Misc/index.html | 22 +- ocaml/Odoc_global/index.html | 2 +- ocaml/Odoc_info/index.html | 1 + ocaml/Odoc_parser/index.html | 2 +- ocaml/Oprint/index.html | 19 +- ocaml/Out_type/Ident_conflicts/index.html | 2 + ocaml/Out_type/Ident_names/index.html | 6 + ocaml/Out_type/Internal_names/index.html | 2 + ocaml/Out_type/Out_name/index.html | 2 + ocaml/Out_type/Variable_names/index.html | 2 + ocaml/Out_type/index.html | 59 + ocaml/Outcometree/index.html | 2 +- ocaml/Parmatch/index.html | 11 +- ocaml/Parser/index.html | 2 +- ocaml/Parsetree/index.html | 11 +- ocaml/Path/index.html | 2 +- ocaml/Patterns/General/index.html | 2 +- .../Persistent_signature/index.html | 2 +- ocaml/Persistent_env/index.html | 7 +- ocaml/Pparse/index.html | 2 +- ocaml/Pprintast/Doc/index.html | 2 + ocaml/Pprintast/index.html | 4 +- ocaml/Predef/index.html | 2 +- ocaml/Primitive/index.html | 2 +- ocaml/Printpat/Compat/index.html | 11 + ocaml/Printpat/index.html | 11 +- ocaml/Printtyp/Conflicts/index.html | 5 - ocaml/Printtyp/Doc/index.html | 12 + ocaml/Printtyp/Naming_context/index.html | 2 - ocaml/Printtyp/Out_name/index.html | 2 - ocaml/Printtyp/Subtype/index.html | 7 - ocaml/Printtyp/index.html | 147 +- .../Printtyp/module-type-Printers/index.html | 4 + ocaml/Proc/index.html | 2 +- ocaml/Rawprinttyp/index.html | 2 + ocaml/Rec_check/index.html | 5 - ocaml/Runtime_events/Callbacks/index.html | 2 +- ocaml/Runtime_events/Timestamp/index.html | 2 +- ocaml/Runtime_events/Type/index.html | 2 +- ocaml/Runtime_events/User/index.html | 2 +- ocaml/Runtime_events/index.html | 2 +- ocaml/Schedgen/index.html | 2 +- .../Selectgen/Effect_and_coeffect/index.html | 2 +- .../class-selector_generic/index.html | 4 +- ocaml/Shape/Item/index.html | 2 +- .../Make_reduce/argument-1-Context/index.html | 2 - ocaml/Shape/Make_reduce/index.html | 2 - ocaml/Shape/Map/index.html | 2 +- ocaml/Shape/Sig_component_kind/index.html | 2 +- ocaml/Shape/Uid/index.html | 2 +- ocaml/Shape/index.html | 4 +- .../Shape_reduce/Make/argument-1-_/index.html | 2 + ocaml/Shape_reduce/Make/index.html | 2 + ocaml/Shape_reduce/index.html | 2 + ocaml/Signature_group/index.html | 2 +- ocaml/Simplif/index.html | 2 +- ocaml/Stackframe/index.html | 2 + .../class-stackframe_generic/index.html | 2 + ocaml/Stackframegen/index.html | 2 + ocaml/Stdlib/Array/index.html | 4 +- ocaml/Stdlib/ArrayLabels/index.html | 8 +- ocaml/Stdlib/Atomic/index.html | 2 +- ocaml/Stdlib/Bigarray/index.html | 5 +- ocaml/Stdlib/Buffer/index.html | 2 +- ocaml/Stdlib/Bytes/index.html | 4 +- ocaml/Stdlib/BytesLabels/index.html | 4 +- ocaml/Stdlib/Digest/BLAKE128/index.html | 2 + ocaml/Stdlib/Digest/BLAKE256/index.html | 2 + ocaml/Stdlib/Digest/BLAKE512/index.html | 2 + ocaml/Stdlib/Digest/MD5/index.html | 2 + ocaml/Stdlib/Digest/index.html | 2 +- ocaml/Stdlib/Digest/module-type-S/index.html | 2 + ocaml/Stdlib/Domain/DLS/index.html | 2 +- ocaml/Stdlib/Domain/index.html | 2 +- ocaml/Stdlib/Dynarray/index.html | 108 + ocaml/Stdlib/Effect/Deep/index.html | 2 +- ocaml/Stdlib/Effect/index.html | 2 +- ocaml/Stdlib/Float/Array/index.html | 2 +- ocaml/Stdlib/Float/ArrayLabels/index.html | 2 +- ocaml/Stdlib/Float/index.html | 2 +- ocaml/Stdlib/Format/index.html | 16 +- ocaml/Stdlib/Fun/index.html | 2 +- ocaml/Stdlib/Gc/Memprof/index.html | 4 +- ocaml/Stdlib/Gc/index.html | 9 +- ocaml/Stdlib/Hashtbl/index.html | 2 +- ocaml/Stdlib/In_channel/index.html | 12 +- ocaml/Stdlib/Int/index.html | 2 +- ocaml/Stdlib/Lazy/index.html | 2 +- ocaml/Stdlib/List/index.html | 4 +- ocaml/Stdlib/ListLabels/index.html | 4 +- ocaml/Stdlib/Marshal/index.html | 2 +- ocaml/Stdlib/MoreLabels/Hashtbl/index.html | 2 +- ocaml/Stdlib/Obj/Closure/index.html | 2 - ocaml/Stdlib/Obj/index.html | 2 +- ocaml/Stdlib/Out_channel/index.html | 7 +- ocaml/Stdlib/Printexc/index.html | 4 +- ocaml/Stdlib/Queue/index.html | 2 +- ocaml/Stdlib/Random/State/index.html | 2 +- ocaml/Stdlib/Random/index.html | 2 +- ocaml/Stdlib/Seq/index.html | 2 +- ocaml/Stdlib/String/index.html | 4 +- ocaml/Stdlib/StringLabels/index.html | 4 +- ocaml/Stdlib/Sys/index.html | 2 +- ocaml/Stdlib/Uchar/index.html | 2 +- ocaml/Stdlib/index.html | 2 +- ocaml/Stdlib__Dynarray/index.html | 2 + ocaml/Subst/Unsafe/index.html | 14 + ocaml/Subst/index.html | 16 +- ocaml/Symtable/Compunit/Map/index.html | 8 + ocaml/Symtable/Compunit/Set/index.html | 3 + ocaml/Symtable/Compunit/index.html | 2 + ocaml/Symtable/Global/Map/index.html | 8 + ocaml/Symtable/Global/Set/index.html | 3 + ocaml/Symtable/Global/index.html | 2 + ocaml/Symtable/Predef/Map/index.html | 8 + ocaml/Symtable/Predef/Set/index.html | 3 + ocaml/Symtable/Predef/index.html | 2 + ocaml/Symtable/index.html | 11 +- ocaml/Syntaxerr/index.html | 2 +- ocaml/Tast_iterator/index.html | 2 +- ocaml/Thread_sanitizer/index.html | 2 + ocaml/Topcommon/index.html | 2 +- ocaml/Toploop/index.html | 16 +- ocaml/Translattribute/index.html | 15 +- ocaml/Translclass/index.html | 2 +- ocaml/Translcore/index.html | 2 +- ocaml/Translobj/index.html | 7 +- ocaml/Translprim/index.html | 2 +- ocaml/Typeclass/index.html | 6 +- ocaml/Typecore/index.html | 17 +- ocaml/Typedecl/index.html | 16 +- ocaml/Typedtree/index.html | 33 +- ocaml/Typemod/Sig_component_kind/index.html | 2 +- ocaml/Typemod/index.html | 15 +- ocaml/Typeopt/index.html | 2 +- ocaml/Types/TransientTypeHash/index.html | 2 + ocaml/Types/Transient_expr/index.html | 2 +- ocaml/Types/Variance/index.html | 2 +- ocaml/Types/index.html | 13 +- ocaml/Typetexp/index.html | 19 +- ocaml/Unit_info/Artifact/index.html | 2 + ocaml/Unit_info/index.html | 7 + ocaml/Unix/index.html | 28 +- ocaml/UnixLabels/index.html | 33 +- ocaml/Value_rec_check/index.html | 5 + ocaml/Value_rec_compiler/index.html | 5 + ocaml/Value_rec_types/index.html | 2 + ocaml/Warnings/index.html | 2 +- ocaml/X86_proc/index.html | 2 +- ocaml/_doc-dir/Changes | 1899 +++++++++++++++-- ocaml/_doc-dir/README.adoc | 90 +- ocaml/_doc-dir/README.win32.adoc | 153 +- ocaml/index.html | 2 +- tiny_httpd/Tiny_httpd_core/Atomic_/index.html | 2 +- tiny_httpd/Tiny_httpd_core/Route/index.html | 2 +- 265 files changed, 3039 insertions(+), 905 deletions(-) create mode 100644 ocaml/CamlinternalMenhirLib/EngineTypes/module-type-LOG/index.html create mode 100644 ocaml/Ctype/Pattern_env/index.html create mode 100644 ocaml/Errortrace_report/index.html create mode 100644 ocaml/Format_doc/Doc/index.html create mode 100644 ocaml/Format_doc/index.html create mode 100644 ocaml/Gprinttyp/Decoration/index.html create mode 100644 ocaml/Gprinttyp/index.html create mode 100644 ocaml/Linkdeps/index.html create mode 100644 ocaml/Location/Doc/index.html delete mode 100644 ocaml/Misc/LongString/index.html create mode 100644 ocaml/Misc/Style/index.html create mode 100644 ocaml/Misc/Utf8_lexeme/index.html create mode 100644 ocaml/Out_type/Ident_conflicts/index.html create mode 100644 ocaml/Out_type/Ident_names/index.html create mode 100644 ocaml/Out_type/Internal_names/index.html create mode 100644 ocaml/Out_type/Out_name/index.html create mode 100644 ocaml/Out_type/Variable_names/index.html create mode 100644 ocaml/Out_type/index.html create mode 100644 ocaml/Pprintast/Doc/index.html create mode 100644 ocaml/Printpat/Compat/index.html delete mode 100644 ocaml/Printtyp/Conflicts/index.html create mode 100644 ocaml/Printtyp/Doc/index.html delete mode 100644 ocaml/Printtyp/Naming_context/index.html delete mode 100644 ocaml/Printtyp/Out_name/index.html delete mode 100644 ocaml/Printtyp/Subtype/index.html create mode 100644 ocaml/Printtyp/module-type-Printers/index.html create mode 100644 ocaml/Rawprinttyp/index.html delete mode 100644 ocaml/Rec_check/index.html delete mode 100644 ocaml/Shape/Make_reduce/argument-1-Context/index.html delete mode 100644 ocaml/Shape/Make_reduce/index.html create mode 100644 ocaml/Shape_reduce/Make/argument-1-_/index.html create mode 100644 ocaml/Shape_reduce/Make/index.html create mode 100644 ocaml/Shape_reduce/index.html create mode 100644 ocaml/Stackframe/index.html create mode 100644 ocaml/Stackframegen/class-stackframe_generic/index.html create mode 100644 ocaml/Stackframegen/index.html create mode 100644 ocaml/Stdlib/Digest/BLAKE128/index.html create mode 100644 ocaml/Stdlib/Digest/BLAKE256/index.html create mode 100644 ocaml/Stdlib/Digest/BLAKE512/index.html create mode 100644 ocaml/Stdlib/Digest/MD5/index.html create mode 100644 ocaml/Stdlib/Digest/module-type-S/index.html create mode 100644 ocaml/Stdlib/Dynarray/index.html delete mode 100644 ocaml/Stdlib/Obj/Closure/index.html create mode 100644 ocaml/Stdlib__Dynarray/index.html create mode 100644 ocaml/Subst/Unsafe/index.html create mode 100644 ocaml/Symtable/Compunit/Map/index.html create mode 100644 ocaml/Symtable/Compunit/Set/index.html create mode 100644 ocaml/Symtable/Compunit/index.html create mode 100644 ocaml/Symtable/Global/Map/index.html create mode 100644 ocaml/Symtable/Global/Set/index.html create mode 100644 ocaml/Symtable/Global/index.html create mode 100644 ocaml/Symtable/Predef/Map/index.html create mode 100644 ocaml/Symtable/Predef/Set/index.html create mode 100644 ocaml/Symtable/Predef/index.html create mode 100644 ocaml/Thread_sanitizer/index.html create mode 100644 ocaml/Types/TransientTypeHash/index.html create mode 100644 ocaml/Unit_info/Artifact/index.html create mode 100644 ocaml/Unit_info/index.html create mode 100644 ocaml/Value_rec_check/index.html create mode 100644 ocaml/Value_rec_compiler/index.html create mode 100644 ocaml/Value_rec_types/index.html diff --git a/ocaml/Arch/index.html b/ocaml/Arch/index.html index 86b5b5cf..4182137d 100644 --- a/ocaml/Arch/index.html +++ b/ocaml/Arch/index.html @@ -1,5 +1,5 @@ -Arch (ocaml.Arch)

Module Arch

val command_line_options : (string * Stdlib.Arg.spec * string) list
type addressing_mode =
  1. | Ibased of string * int
  2. | Iindexed of int
  3. | Iindexed2 of int
  4. | Iscaled of int * int
  5. | Iindexed2scaled of int * int
type specific_operation =
  1. | Ilea of addressing_mode
  2. | Istore_int of nativeint * addressing_mode * bool
  3. | Ioffset_loc of int * addressing_mode
  4. | Ifloatarithmem of float_operation * addressing_mode
  5. | Ibswap of int
  6. | Isqrtf
  7. | Ifloatsqrtf of addressing_mode
  8. | Isextend32
  9. | Izextend32
and float_operation =
  1. | Ifloatadd
  2. | Ifloatsub
  3. | Ifloatmul
  4. | Ifloatdiv
val big_endian : bool
val size_addr : int
val size_int : int
val size_float : int
val allow_unaligned_access : bool
val division_crashes_on_overflow : bool
val identity_addressing : addressing_mode
val offset_addressing : addressing_mode -> int -> addressing_mode
val num_args_addressing : addressing_mode -> int
val print_addressing : +Arch (ocaml.Arch)

Module Arch

val command_line_options : (string * Stdlib.Arg.spec * string) list
type addressing_mode =
  1. | Ibased of string * int
  2. | Iindexed of int
  3. | Iindexed2 of int
  4. | Iscaled of int * int
  5. | Iindexed2scaled of int * int
type specific_operation =
  1. | Ilea of addressing_mode
  2. | Istore_int of nativeint * addressing_mode * bool
  3. | Ioffset_loc of int * addressing_mode
  4. | Ifloatarithmem of float_operation * addressing_mode
  5. | Ibswap of int
  6. | Isqrtf
  7. | Ifloatsqrtf of addressing_mode
  8. | Isextend32
  9. | Izextend32
and float_operation =
  1. | Ifloatadd
  2. | Ifloatsub
  3. | Ifloatmul
  4. | Ifloatdiv
val big_endian : bool
val size_addr : int
val size_int : int
val size_float : int
val allow_unaligned_access : bool
val division_crashes_on_overflow : bool
val identity_addressing : addressing_mode
val offset_addressing : addressing_mode -> int -> addressing_mode
val print_addressing : (Stdlib.Format.formatter -> 'a -> unit) -> addressing_mode -> Stdlib.Format.formatter -> diff --git a/ocaml/Asmgen/index.html b/ocaml/Asmgen/index.html index ffec48c1..95837210 100644 --- a/ocaml/Asmgen/index.html +++ b/ocaml/Asmgen/index.html @@ -11,7 +11,7 @@ middle_end:middle_end -> ppf_dump:Stdlib.Format.formatter -> Lambda.program -> - unit

Compile an implementation from Lambda using the given middle end.

val compile_implementation_linear : string -> progname:string -> unit
val compile_phrase : ppf_dump:Stdlib.Format.formatter -> Cmm.phrase -> unit
type error =
  1. | Assembler_error of string
  2. | Mismatched_for_pack of string option
  3. | Asm_generation of string * Emitaux.error
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
val compile_unit : + unit

Compile an implementation from Lambda using the given middle end.

val compile_implementation_linear : Unit_info.t -> unit
val compile_phrase : ppf_dump:Stdlib.Format.formatter -> Cmm.phrase -> unit
type error =
  1. | Assembler_error of string
  2. | Mismatched_for_pack of string option
  3. | Asm_generation of string * Emitaux.error
exception Error of error
val report_error : error Format_doc.format_printer
val report_error_doc : error Format_doc.printer
val compile_unit : output_prefix:string -> asm_filename:string -> keep_asm:bool -> diff --git a/ocaml/Asmlibrarian/index.html b/ocaml/Asmlibrarian/index.html index 1ed2ad42..25bc9bfd 100644 --- a/ocaml/Asmlibrarian/index.html +++ b/ocaml/Asmlibrarian/index.html @@ -1,2 +1,2 @@ -Asmlibrarian (ocaml.Asmlibrarian)

Module Asmlibrarian

val create_archive : string list -> string -> unit
type error =
  1. | File_not_found of string
  2. | Archiver_error of string
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
+Asmlibrarian (ocaml.Asmlibrarian)

Module Asmlibrarian

val create_archive : string list -> string -> unit
type error =
  1. | File_not_found of string
  2. | Archiver_error of string
exception Error of error
val report_error : error Format_doc.format_printer
val report_error_doc : error Format_doc.printer
diff --git a/ocaml/Asmlink/index.html b/ocaml/Asmlink/index.html index 19994ff1..b2c00aff 100644 --- a/ocaml/Asmlink/index.html +++ b/ocaml/Asmlink/index.html @@ -7,4 +7,4 @@ Misc.filepath -> Cmx_format.unit_infos -> Stdlib.Digest.t -> - unit
val extract_crc_interfaces : unit -> Misc.crcs
val extract_crc_implementations : unit -> Misc.crcs
type error =
  1. | File_not_found of Misc.filepath
  2. | Not_an_object_file of Misc.filepath
  3. | Missing_implementations of (Misc.modname * string list) list
  4. | Inconsistent_interface of Misc.modname * Misc.filepath * Misc.filepath
  5. | Inconsistent_implementation of Misc.modname * Misc.filepath * Misc.filepath
  6. | Assembler_error of Misc.filepath
  7. | Linking_error of int
  8. | Multiple_definition of Misc.modname * Misc.filepath * Misc.filepath
  9. | Missing_cmx of Misc.filepath * Misc.modname
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
+ unit
val extract_crc_interfaces : unit -> Misc.crcs
val extract_crc_implementations : unit -> Misc.crcs
type error =
  1. | File_not_found of Misc.filepath
  2. | Not_an_object_file of Misc.filepath
  3. | Inconsistent_interface of Misc.modname * Misc.filepath * Misc.filepath
  4. | Inconsistent_implementation of Misc.modname * Misc.filepath * Misc.filepath
  5. | Assembler_error of Misc.filepath
  6. | Linking_error of int
  7. | Missing_cmx of Misc.filepath * Misc.modname
exception Error of error
val report_error : error Format_doc.format_printer
val report_error_doc : error Format_doc.printer
diff --git a/ocaml/Asmpackager/index.html b/ocaml/Asmpackager/index.html index 6898f972..e8adfa49 100644 --- a/ocaml/Asmpackager/index.html +++ b/ocaml/Asmpackager/index.html @@ -5,4 +5,4 @@ string list -> string -> backend:(module Backend_intf.S) -> - unit
type error =
  1. | Illegal_renaming of string * string * string
  2. | Forward_reference of string * string
  3. | Wrong_for_pack of string * string
  4. | Linking_error
  5. | Assembler_error of string
  6. | File_not_found of string
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
+ unit
type error =
  1. | Illegal_renaming of string * string * string
  2. | Forward_reference of string * string
  3. | Wrong_for_pack of string * string
  4. | Linking_error
  5. | Assembler_error of string
  6. | File_not_found of string
exception Error of error
val report_error : error Format_doc.format_printer
val report_error_doc : error Format_doc.printer
diff --git a/ocaml/Ast_helper/Const/index.html b/ocaml/Ast_helper/Const/index.html index 7534d5f3..6a9f1fa5 100644 --- a/ocaml/Ast_helper/Const/index.html +++ b/ocaml/Ast_helper/Const/index.html @@ -1,6 +1,6 @@ -Const (ocaml.Ast_helper.Const)

Module Ast_helper.Const

val char : char -> Parsetree.constant
val string : +Const (ocaml.Ast_helper.Const)

Module Ast_helper.Const

val char : ?loc:loc -> char -> Parsetree.constant
val string : ?quotation_delimiter:string -> ?loc:Location.t -> string -> - Parsetree.constant
val integer : ?suffix:char -> string -> Parsetree.constant
val int : ?suffix:char -> int -> Parsetree.constant
val int32 : ?suffix:char -> int32 -> Parsetree.constant
val int64 : ?suffix:char -> int64 -> Parsetree.constant
val nativeint : ?suffix:char -> nativeint -> Parsetree.constant
val float : ?suffix:char -> string -> Parsetree.constant
+ Parsetree.constant
val integer : ?loc:loc -> ?suffix:char -> string -> Parsetree.constant
val int : ?loc:loc -> ?suffix:char -> int -> Parsetree.constant
val int32 : ?loc:loc -> ?suffix:char -> int32 -> Parsetree.constant
val int64 : ?loc:loc -> ?suffix:char -> int64 -> Parsetree.constant
val nativeint : ?loc:loc -> ?suffix:char -> nativeint -> Parsetree.constant
val float : ?loc:loc -> ?suffix:char -> string -> Parsetree.constant
diff --git a/ocaml/Ast_helper/Exp/index.html b/ocaml/Ast_helper/Exp/index.html index d62ed848..33747213 100644 --- a/ocaml/Ast_helper/Exp/index.html +++ b/ocaml/Ast_helper/Exp/index.html @@ -13,17 +13,12 @@ Asttypes.rec_flag -> Parsetree.value_binding list -> Parsetree.expression -> - Parsetree.expression
val function_ : ?loc:loc -> ?attrs:attrs -> - Parsetree.case list -> + Parsetree.function_param list -> + Parsetree.type_constraint option -> + Parsetree.function_body -> Parsetree.expression
val apply : ?loc:loc -> ?attrs:attrs -> diff --git a/ocaml/Ast_helper/Pat/index.html b/ocaml/Ast_helper/Pat/index.html index 0850c273..129428fe 100644 --- a/ocaml/Ast_helper/Pat/index.html +++ b/ocaml/Ast_helper/Pat/index.html @@ -59,6 +59,11 @@ ?loc:loc -> ?attrs:attrs -> Parsetree.pattern -> + Parsetree.pattern
val effect_ : + ?loc:loc -> + ?attrs:attrs -> + Parsetree.pattern -> + Parsetree.pattern -> Parsetree.pattern
val extension : ?loc:loc -> ?attrs:attrs -> diff --git a/ocaml/Ast_helper/Typ/index.html b/ocaml/Ast_helper/Typ/index.html index 6d73018a..07b8c53a 100644 --- a/ocaml/Ast_helper/Typ/index.html +++ b/ocaml/Ast_helper/Typ/index.html @@ -32,7 +32,7 @@ ?loc:loc -> ?attrs:attrs -> Parsetree.core_type -> - string -> + string with_loc -> Parsetree.core_type
val variant : ?loc:loc -> ?attrs:attrs -> @@ -49,6 +49,11 @@ ?attrs:attrs -> lid -> (lid * Parsetree.core_type) list -> + Parsetree.core_type
val open_ : + ?loc:loc -> + ?attrs:attrs -> + lid -> + Parsetree.core_type -> Parsetree.core_type
val extension : ?loc:loc -> ?attrs:attrs -> diff --git a/ocaml/Ast_iterator/index.html b/ocaml/Ast_iterator/index.html index c8d8291e..e3ee0b64 100644 --- a/ocaml/Ast_iterator/index.html +++ b/ocaml/Ast_iterator/index.html @@ -1,6 +1,6 @@ Ast_iterator (ocaml.Ast_iterator)

Module Ast_iterator

Ast_iterator.iterator enables AST inspection using open recursion. A typical mapper would be based on Ast_iterator.default_iterator, a trivial iterator, and will fall back on it for handling the syntax it does not modify.

Warning: this module is unstable and part of compiler-libs.

A generic Parsetree iterator

type iterator = {
  1. attribute : iterator -> Parsetree.attribute -> unit;
  2. attributes : iterator -> Parsetree.attribute list -> unit;
  3. binding_op : iterator -> Parsetree.binding_op -> unit;
  4. case : iterator -> Parsetree.case -> unit;
  5. cases : iterator -> Parsetree.case list -> unit;
  6. class_declaration : iterator -> Parsetree.class_declaration -> unit;
  7. class_description : iterator -> Parsetree.class_description -> unit;
  8. class_expr : iterator -> Parsetree.class_expr -> unit;
  9. class_field : iterator -> Parsetree.class_field -> unit;
  10. class_signature : iterator -> Parsetree.class_signature -> unit;
  11. class_structure : iterator -> Parsetree.class_structure -> unit;
  12. class_type : iterator -> Parsetree.class_type -> unit;
  13. class_type_declaration : iterator -> Parsetree.class_type_declaration -> unit;
  14. class_type_field : iterator -> Parsetree.class_type_field -> unit;
  15. constructor_declaration : iterator -> Parsetree.constructor_declaration -> - unit;
  16. expr : iterator -> Parsetree.expression -> unit;
  17. extension : iterator -> Parsetree.extension -> unit;
  18. extension_constructor : iterator -> Parsetree.extension_constructor -> unit;
  19. include_declaration : iterator -> Parsetree.include_declaration -> unit;
  20. include_description : iterator -> Parsetree.include_description -> unit;
  21. label_declaration : iterator -> Parsetree.label_declaration -> unit;
  22. location : iterator -> Location.t -> unit;
  23. module_binding : iterator -> Parsetree.module_binding -> unit;
  24. module_declaration : iterator -> Parsetree.module_declaration -> unit;
  25. module_substitution : iterator -> Parsetree.module_substitution -> unit;
  26. module_expr : iterator -> Parsetree.module_expr -> unit;
  27. module_type : iterator -> Parsetree.module_type -> unit;
  28. module_type_declaration : iterator -> + unit;
  29. directive_argument : iterator -> Parsetree.directive_argument -> unit;
  30. expr : iterator -> Parsetree.expression -> unit;
  31. extension : iterator -> Parsetree.extension -> unit;
  32. extension_constructor : iterator -> Parsetree.extension_constructor -> unit;
  33. include_declaration : iterator -> Parsetree.include_declaration -> unit;
  34. include_description : iterator -> Parsetree.include_description -> unit;
  35. label_declaration : iterator -> Parsetree.label_declaration -> unit;
  36. location : iterator -> Location.t -> unit;
  37. module_binding : iterator -> Parsetree.module_binding -> unit;
  38. module_declaration : iterator -> Parsetree.module_declaration -> unit;
  39. module_substitution : iterator -> Parsetree.module_substitution -> unit;
  40. module_expr : iterator -> Parsetree.module_expr -> unit;
  41. module_type : iterator -> Parsetree.module_type -> unit;
  42. module_type_declaration : iterator -> Parsetree.module_type_declaration -> - unit;
  43. open_declaration : iterator -> Parsetree.open_declaration -> unit;
  44. open_description : iterator -> Parsetree.open_description -> unit;
  45. pat : iterator -> Parsetree.pattern -> unit;
  46. payload : iterator -> Parsetree.payload -> unit;
  47. signature : iterator -> Parsetree.signature -> unit;
  48. signature_item : iterator -> Parsetree.signature_item -> unit;
  49. structure : iterator -> Parsetree.structure -> unit;
  50. structure_item : iterator -> Parsetree.structure_item -> unit;
  51. typ : iterator -> Parsetree.core_type -> unit;
  52. row_field : iterator -> Parsetree.row_field -> unit;
  53. object_field : iterator -> Parsetree.object_field -> unit;
  54. type_declaration : iterator -> Parsetree.type_declaration -> unit;
  55. type_extension : iterator -> Parsetree.type_extension -> unit;
  56. type_exception : iterator -> Parsetree.type_exception -> unit;
  57. type_kind : iterator -> Parsetree.type_kind -> unit;
  58. value_binding : iterator -> Parsetree.value_binding -> unit;
  59. value_description : iterator -> Parsetree.value_description -> unit;
  60. with_constraint : iterator -> Parsetree.with_constraint -> unit;
}

A iterator record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the iterator to be applied to children in the syntax tree.

val default_iterator : iterator

A default iterator, which implements a "do not do anything" mapping.

+ unit;
  • open_declaration : iterator -> Parsetree.open_declaration -> unit;
  • open_description : iterator -> Parsetree.open_description -> unit;
  • pat : iterator -> Parsetree.pattern -> unit;
  • payload : iterator -> Parsetree.payload -> unit;
  • signature : iterator -> Parsetree.signature -> unit;
  • signature_item : iterator -> Parsetree.signature_item -> unit;
  • structure : iterator -> Parsetree.structure -> unit;
  • structure_item : iterator -> Parsetree.structure_item -> unit;
  • toplevel_directive : iterator -> Parsetree.toplevel_directive -> unit;
  • toplevel_phrase : iterator -> Parsetree.toplevel_phrase -> unit;
  • typ : iterator -> Parsetree.core_type -> unit;
  • row_field : iterator -> Parsetree.row_field -> unit;
  • object_field : iterator -> Parsetree.object_field -> unit;
  • type_declaration : iterator -> Parsetree.type_declaration -> unit;
  • type_extension : iterator -> Parsetree.type_extension -> unit;
  • type_exception : iterator -> Parsetree.type_exception -> unit;
  • type_kind : iterator -> Parsetree.type_kind -> unit;
  • value_binding : iterator -> Parsetree.value_binding -> unit;
  • value_description : iterator -> Parsetree.value_description -> unit;
  • with_constraint : iterator -> Parsetree.with_constraint -> unit;
  • }

    A iterator record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the iterator to be applied to children in the syntax tree.

    val default_iterator : iterator

    A default iterator, which implements a "do not do anything" mapping.

    diff --git a/ocaml/Ast_mapper/index.html b/ocaml/Ast_mapper/index.html index 79fe775b..5cea1e82 100644 --- a/ocaml/Ast_mapper/index.html +++ b/ocaml/Ast_mapper/index.html @@ -8,7 +8,7 @@ let test_mapper argv = expr = fun mapper expr -> match expr with | { pexp_desc = Pexp_extension ({ txt = "test" }, PStr [])} -> - Ast_helper.Exp.constant (Const_int 42) + Ast_helper.Exp.constant (Pconst_integer ("42", None)) | other -> default_mapper.expr mapper other; } let () = @@ -26,7 +26,9 @@ let () = Parsetree.class_type_field -> Parsetree.class_type_field;
  • constant : mapper -> Parsetree.constant -> Parsetree.constant;
  • constructor_declaration : mapper -> Parsetree.constructor_declaration -> - Parsetree.constructor_declaration;
  • expr : mapper -> Parsetree.expression -> Parsetree.expression;
  • extension : mapper -> Parsetree.extension -> Parsetree.extension;
  • extension_constructor : mapper -> + Parsetree.constructor_declaration;
  • directive_argument : mapper -> + Parsetree.directive_argument -> + Parsetree.directive_argument;
  • expr : mapper -> Parsetree.expression -> Parsetree.expression;
  • extension : mapper -> Parsetree.extension -> Parsetree.extension;
  • extension_constructor : mapper -> Parsetree.extension_constructor -> Parsetree.extension_constructor;
  • include_declaration : mapper -> Parsetree.include_declaration -> @@ -50,7 +52,11 @@ let () = Parsetree.signature_item -> Parsetree.signature_item;
  • structure : mapper -> Parsetree.structure -> Parsetree.structure;
  • structure_item : mapper -> Parsetree.structure_item -> - Parsetree.structure_item;
  • typ : mapper -> Parsetree.core_type -> Parsetree.core_type;
  • type_declaration : mapper -> + Parsetree.structure_item;
  • toplevel_directive : mapper -> + Parsetree.toplevel_directive -> + Parsetree.toplevel_directive;
  • toplevel_phrase : mapper -> + Parsetree.toplevel_phrase -> + Parsetree.toplevel_phrase;
  • typ : mapper -> Parsetree.core_type -> Parsetree.core_type;
  • type_declaration : mapper -> Parsetree.type_declaration -> Parsetree.type_declaration;
  • type_extension : mapper -> Parsetree.type_extension -> @@ -60,7 +66,7 @@ let () = Parsetree.value_description -> Parsetree.value_description;
  • with_constraint : mapper -> Parsetree.with_constraint -> - Parsetree.with_constraint;
  • }

    A mapper record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the mapper to be applied to children in the syntax tree.

    val default_mapper : mapper

    A default mapper, which implements a "deep identity" mapping.

    Apply mappers to compilation units

    val tool_name : unit -> string

    Can be used within a ppx preprocessor to know which tool is calling it "ocamlc", "ocamlopt", "ocamldoc", "ocamldep", "ocaml", ... Some global variables that reflect command-line options are automatically synchronized between the calling tool and the ppx preprocessor: Clflags.include_dirs, Load_path, Clflags.open_modules, Clflags.for_package, Clflags.debug.

    val apply : source:string -> target:string -> mapper -> unit

    Apply a mapper (parametrized by the unit name) to a dumped parsetree found in the source file and put the result in the target file. The structure or signature field of the mapper is applied to the implementation or interface.

    val run_main : (string list -> mapper) -> unit

    Entry point to call to implement a standalone -ppx rewriter from a mapper, parametrized by the command line arguments. The current unit name can be obtained from Location.input_name. This function implements proper error reporting for uncaught exceptions.

    Registration API

    val register_function : (string -> (string list -> mapper) -> unit) ref
    val register : string -> (string list -> mapper) -> unit

    Apply the register_function. The default behavior is to run the mapper immediately, taking arguments from the process command line. This is to support a scenario where a mapper is linked as a stand-alone executable.

    It is possible to overwrite the register_function to define "-ppx drivers", which combine several mappers in a single process. Typically, a driver starts by defining register_function to a custom implementation, then lets ppx rewriters (linked statically or dynamically) register themselves, and then run all or some of them. It is also possible to have -ppx drivers apply rewriters to only specific parts of an AST.

    The first argument to register is a symbolic name to be used by the ppx driver.

    Convenience functions to write mappers

    val map_opt : ('a -> 'b) -> 'a option -> 'b option
    val extension_of_error : Location.error -> Parsetree.extension

    Encode an error into an 'ocaml.error' extension node which can be inserted in a generated Parsetree. The compiler will be responsible for reporting the error.

    val attribute_of_warning : Location.t -> string -> Parsetree.attribute

    Encode a warning message into an 'ocaml.ppwarning' attribute which can be inserted in a generated Parsetree. The compiler will be responsible for reporting the warning.

    Helper functions to call external mappers

    val add_ppx_context_str : + Parsetree.with_constraint;}

    A mapper record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the mapper to be applied to children in the syntax tree.

    val default_mapper : mapper

    A default mapper, which implements a "deep identity" mapping.

    Apply mappers to compilation units

    val tool_name : unit -> string

    Can be used within a ppx preprocessor to know which tool is calling it "ocamlc", "ocamlopt", "ocamldoc", "ocamldep", "ocaml", ... Some global variables that reflect command-line options are automatically synchronized between the calling tool and the ppx preprocessor: Clflags.include_dirs, Clflags.hidden_include_dirs, Load_path, Clflags.open_modules, Clflags.for_package, Clflags.debug.

    val apply : source:string -> target:string -> mapper -> unit

    Apply a mapper (parametrized by the unit name) to a dumped parsetree found in the source file and put the result in the target file. The structure or signature field of the mapper is applied to the implementation or interface.

    val run_main : (string list -> mapper) -> unit

    Entry point to call to implement a standalone -ppx rewriter from a mapper, parametrized by the command line arguments. The current unit name can be obtained from Location.input_name. This function implements proper error reporting for uncaught exceptions.

    Registration API

    val register_function : (string -> (string list -> mapper) -> unit) ref
    val register : string -> (string list -> mapper) -> unit

    Apply the register_function. The default behavior is to run the mapper immediately, taking arguments from the process command line. This is to support a scenario where a mapper is linked as a stand-alone executable.

    It is possible to overwrite the register_function to define "-ppx drivers", which combine several mappers in a single process. Typically, a driver starts by defining register_function to a custom implementation, then lets ppx rewriters (linked statically or dynamically) register themselves, and then run all or some of them. It is also possible to have -ppx drivers apply rewriters to only specific parts of an AST.

    The first argument to register is a symbolic name to be used by the ppx driver.

    Convenience functions to write mappers

    val map_opt : ('a -> 'b) -> 'a option -> 'b option
    val extension_of_error : Location.error -> Parsetree.extension

    Encode an error into an 'ocaml.error' extension node which can be inserted in a generated Parsetree. The compiler will be responsible for reporting the error.

    val attribute_of_warning : Location.t -> string -> Parsetree.attribute

    Encode a warning message into an 'ocaml.ppwarning' attribute which can be inserted in a generated Parsetree. The compiler will be responsible for reporting the warning.

    Helper functions to call external mappers

    val add_ppx_context_str : tool_name:string -> Parsetree.structure -> Parsetree.structure

    Extract information from the current environment and encode it into an attribute which is prepended to the list of structure items in order to pass the information to an external processor.

    val add_ppx_context_sig : diff --git a/ocaml/Asttypes/index.html b/ocaml/Asttypes/index.html index 4c6ea376..da52145d 100644 --- a/ocaml/Asttypes/index.html +++ b/ocaml/Asttypes/index.html @@ -1,2 +1,2 @@ -Asttypes (ocaml.Asttypes)

    Module Asttypes

    Auxiliary AST types used by parsetree and typedtree.

    Warning: this module is unstable and part of compiler-libs.

    type constant =
    1. | Const_int of int
    2. | Const_char of char
    3. | Const_string of string * Location.t * string option
    4. | Const_float of string
    5. | Const_int32 of int32
    6. | Const_int64 of int64
    7. | Const_nativeint of nativeint
    type rec_flag =
    1. | Nonrecursive
    2. | Recursive
    type direction_flag =
    1. | Upto
    2. | Downto
    type private_flag =
    1. | Private
    2. | Public
    type mutable_flag =
    1. | Immutable
    2. | Mutable
    type virtual_flag =
    1. | Virtual
    2. | Concrete
    type override_flag =
    1. | Override
    2. | Fresh
    type closed_flag =
    1. | Closed
    2. | Open
    type label = string
    type arg_label =
    1. | Nolabel
    2. | Labelled of string
      (*

      label:T -> ...

      *)
    3. | Optional of string
      (*

      ?label:T -> ...

      *)
    type 'a loc = 'a Location.loc = {
    1. txt : 'a;
    2. loc : Location.t;
    }
    type variance =
    1. | Covariant
    2. | Contravariant
    3. | NoVariance
    type injectivity =
    1. | Injective
    2. | NoInjectivity
    +Asttypes (ocaml.Asttypes)

    Module Asttypes

    Auxiliary AST types used by parsetree and typedtree.

    Warning: this module is unstable and part of compiler-libs.

    type constant =
    1. | Const_int of int
    2. | Const_char of char
    3. | Const_string of string * Location.t * string option
    4. | Const_float of string
    5. | Const_int32 of int32
    6. | Const_int64 of int64
    7. | Const_nativeint of nativeint
    type rec_flag =
    1. | Nonrecursive
    2. | Recursive
    type direction_flag =
    1. | Upto
    2. | Downto
    type private_flag =
    1. | Private
    2. | Public
    type mutable_flag =
    1. | Immutable
    2. | Mutable
    type virtual_flag =
    1. | Virtual
    2. | Concrete
    type override_flag =
    1. | Override
    2. | Fresh
    type closed_flag =
    1. | Closed
    2. | Open
    type label = string
    type arg_label =
    1. | Nolabel
    2. | Labelled of string
      (*

      label:T -> ...

      *)
    3. | Optional of string
      (*

      ?label:T -> ...

      *)
    type 'a loc = 'a Location.loc = {
    1. txt : 'a;
    2. loc : Location.t;
    }
    type variance =
    1. | Covariant
    2. | Contravariant
    3. | NoVariance
    type injectivity =
    1. | Injective
    2. | NoInjectivity
    val string_of_label : arg_label -> string
    diff --git a/ocaml/Attr_helper/index.html b/ocaml/Attr_helper/index.html index 5758c10a..413f5a87 100644 --- a/ocaml/Attr_helper/index.html +++ b/ocaml/Attr_helper/index.html @@ -1,5 +1,5 @@ Attr_helper (ocaml.Attr_helper)

    Module Attr_helper

    Helpers for attributes

    Warning: this module is unstable and part of compiler-libs.

    type error =
    1. | Multiple_attributes of string
    2. | No_payload_expected of string
    val get_no_payload_attribute : - string list -> + string -> Parsetree.attributes -> - string Asttypes.loc option

    The string list argument of the following functions is a list of alternative names for the attribute we are looking for. For instance:

    ["foo"; "ocaml.foo"]
    val has_no_payload_attribute : string list -> Parsetree.attributes -> bool
    exception Error of Location.t * error
    val report_error : Stdlib.Format.formatter -> error -> unit
    + string Asttypes.loc option

    The string argument of the following functions is the name of the attribute we are looking for. If the argument is "foo", these functions will find attributes with the name "foo" or "ocaml.foo"

    val has_no_payload_attribute : string -> Parsetree.attributes -> bool
    exception Error of Location.t * error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Backend_var/index.html b/ocaml/Backend_var/index.html index 451407b8..edf7d2df 100644 --- a/ocaml/Backend_var/index.html +++ b/ocaml/Backend_var/index.html @@ -1,2 +1,2 @@ -Backend_var (ocaml.Backend_var)

    Module Backend_var

    Variables used in the backend, optionally equipped with "provenance" information, used for the emission of debugging information.

    include module type of struct include Ident end
    type t = Ident.t
    include Identifiable.S with type t := t
    module T = Ident.T
    include Identifiable.Thing with type t := T.t
    include Hashtbl.HashedType with type t := T.t
    val equal : T.t -> T.t -> bool

    The equality predicate used to compare keys.

    val hash : T.t -> int

    A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

    • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
    • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
    • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
    include Map.OrderedType with type t := T.t
    val output : out_channel -> T.t -> unit
    val print : Stdlib.Format.formatter -> T.t -> unit
    module Set = Ident.Set
    module Map = Ident.Map
    module Tbl = Ident.Tbl
    val print_with_scope : Stdlib.Format.formatter -> t -> unit

    Same as print except that it will also add a "n" suffix if the scope of the argument is n.

    val create_scoped : scope:int -> string -> t
    val create_local : string -> t
    val create_persistent : string -> t
    val create_predef : string -> t
    val rename : t -> t

    Creates an identifier with the same name as the input, a fresh stamp, and no scope.

    • raises [Fatal_error]

      if called on a persistent / predef ident.

    val name : t -> string
    val unique_name : t -> string
    val unique_toplevel_name : t -> string
    val persistent : t -> bool
    val same : t -> t -> bool

    Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

    val compare : t -> t -> int
    val global : t -> bool
    val is_predef : t -> bool
    val scope : t -> int
    val lowest_scope : int
    val highest_scope : int
    val reinit : unit -> unit
    type 'a tbl = 'a Ident.tbl

    'a tbl represents association tables from identifiers to values of type 'a.

    'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

    find_all returns the bindings for all idents of a given name, most recently introduced first.

    In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

    Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

    You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

    val empty : 'a tbl
    val add : t -> 'a -> 'a tbl -> 'a tbl
    val find_same : t -> 'a tbl -> 'a
    val find_name : string -> 'a tbl -> t * 'a
    val find_all : string -> 'a tbl -> (t * 'a) list
    val find_all_seq : string -> 'a tbl -> (t * 'a) Stdlib.Seq.t
    val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val iter : (t -> 'a -> unit) -> 'a tbl -> unit
    val remove : t -> 'a tbl -> 'a tbl
    val make_key_generator : unit -> t -> t
    type backend_var = t
    module Provenance : sig ... end
    module With_provenance : sig ... end
    +Backend_var (ocaml.Backend_var)

    Module Backend_var

    Variables used in the backend, optionally equipped with "provenance" information, used for the emission of debugging information.

    include module type of struct include Ident end
    type t = Ident.t
    include Identifiable.S with type t := t
    module T = Ident.T
    include Identifiable.Thing with type t := T.t
    include Hashtbl.HashedType with type t := T.t
    val equal : T.t -> T.t -> bool

    The equality predicate used to compare keys.

    val hash : T.t -> int

    A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

    • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
    • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
    • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
    include Map.OrderedType with type t := T.t
    val output : out_channel -> T.t -> unit
    val print : Stdlib.Format.formatter -> T.t -> unit
    module Set = Ident.Set
    module Map = Ident.Map
    module Tbl = Ident.Tbl
    val doc_print : t Format_doc.printer
    val print_with_scope : t Format_doc.printer

    Same as print except that it will also add a "n" suffix if the scope of the argument is n.

    val create_scoped : scope:int -> string -> t
    val create_local : string -> t
    val create_persistent : string -> t
    val create_predef : string -> t
    val rename : t -> t

    Creates an identifier with the same name as the input, a fresh stamp, and no scope.

    • raises [Fatal_error]

      if called on a persistent / predef ident.

    val name : t -> string
    val unique_name : t -> string
    val unique_toplevel_name : t -> string
    val persistent : t -> bool
    val same : t -> t -> bool

    Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

    val compare_stamp : t -> t -> int

    Compare only the internal stamps, 0 if absent

    val compare : t -> t -> int

    Compare identifiers structurally, including the name

    val global : t -> bool
    val is_predef : t -> bool
    val scope : t -> int
    val lowest_scope : int
    val highest_scope : int
    val reinit : unit -> unit
    type 'a tbl = 'a Ident.tbl

    'a tbl represents association tables from identifiers to values of type 'a.

    'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

    find_all returns the bindings for all idents of a given name, most recently introduced first.

    In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

    Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

    You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

    val empty : 'a tbl
    val add : t -> 'a -> 'a tbl -> 'a tbl
    val find_same : t -> 'a tbl -> 'a
    val find_name : string -> 'a tbl -> t * 'a
    val find_all : string -> 'a tbl -> (t * 'a) list
    val find_all_seq : string -> 'a tbl -> (t * 'a) Stdlib.Seq.t
    val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val iter : (t -> 'a -> unit) -> 'a tbl -> unit
    val remove : t -> 'a tbl -> 'a tbl
    val make_key_generator : unit -> t -> t
    type backend_var = t
    module Provenance : sig ... end
    module With_provenance : sig ... end
    diff --git a/ocaml/Btype/TypeHash/index.html b/ocaml/Btype/TypeHash/index.html index 865a811a..234de7c8 100644 --- a/ocaml/Btype/TypeHash/index.html +++ b/ocaml/Btype/TypeHash/index.html @@ -1,2 +1,2 @@ -TypeHash (ocaml.Btype.TypeHash)

    Module Btype.TypeHash

    include Hashtbl.S with type key = Types.transient_expr
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    • since 4.00
    val copy : 'a t -> 'a t
    val find_opt : 'a t -> key -> 'a option
    • since 4.05
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • since 4.03
    val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
    val length : 'a t -> int
    val stats : 'a t -> Stdlib.Hashtbl.statistics
    • since 4.00
    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
    • since 4.07
    val to_seq_keys : _ t -> key Stdlib.Seq.t
    • since 4.07
    val to_seq_values : 'a t -> 'a Stdlib.Seq.t
    • since 4.07
    val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
    • since 4.07
    val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
    • since 4.07
    val add : 'a t -> Types.type_expr -> 'a -> unit
    val remove : 'a t -> Types.type_expr -> unit
    val find : 'a t -> Types.type_expr -> 'a
    val iter : (Types.type_expr -> 'a -> unit) -> 'a t -> unit
    +TypeHash (ocaml.Btype.TypeHash)

    Module Btype.TypeHash

    include Hashtbl.S with type key = Types.transient_expr
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    • since 4.00
    val copy : 'a t -> 'a t
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • since 4.03
    val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
    val length : 'a t -> int
    val stats : 'a t -> Stdlib.Hashtbl.statistics
    • since 4.00
    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
    • since 4.07
    val to_seq_keys : _ t -> key Stdlib.Seq.t
    • since 4.07
    val to_seq_values : 'a t -> 'a Stdlib.Seq.t
    • since 4.07
    val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
    • since 4.07
    val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
    • since 4.07
    val mem : 'a t -> Types.type_expr -> bool
    val add : 'a t -> Types.type_expr -> 'a -> unit
    val remove : 'a t -> Types.type_expr -> unit
    val find : 'a t -> Types.type_expr -> 'a
    val find_opt : 'a t -> Types.type_expr -> 'a option
    val iter : (Types.type_expr -> 'a -> unit) -> 'a t -> unit
    diff --git a/ocaml/Btype/index.html b/ocaml/Btype/index.html index 0407866e..f1c53c95 100644 --- a/ocaml/Btype/index.html +++ b/ocaml/Btype/index.html @@ -1,5 +1,5 @@ -Btype (ocaml.Btype)

    Module Btype

    module TypeSet : sig ... end
    module TypeMap : sig ... end
    module TypeHash : sig ... end
    module TypePairs : sig ... end
    val generic_level : int
    val newgenvar : ?name:string -> unit -> Types.type_expr
    val newgenstub : scope:int -> Types.type_expr
    val is_Tvar : Types.type_expr -> bool
    val is_Tunivar : Types.type_expr -> bool
    val is_Tconstr : Types.type_expr -> bool
    val dummy_method : Asttypes.label
    val is_fixed : Types.row_desc -> bool
    val has_fixed_explanation : Types.row_desc -> bool
    val fixed_explanation : Types.row_desc -> Types.fixed_explanation option
    val merge_fixed_explanation : +Btype (ocaml.Btype)

    Module Btype

    module TypeSet : sig ... end
    module TypeMap : sig ... end
    module TypeHash : sig ... end
    module TypePairs : sig ... end
    val generic_level : int
    val lowest_level : int
    val with_new_pool : level:int -> (unit -> 'a) -> 'a * Types.transient_expr list
    val add_to_pool : level:int -> Types.transient_expr -> unit
    val newty3 : level:int -> scope:int -> Types.type_desc -> Types.type_expr
    val newty2 : level:int -> Types.type_desc -> Types.type_expr
    val newgenvar : ?name:string -> unit -> Types.type_expr
    val newgenstub : scope:int -> Types.type_expr
    val is_Tvar : Types.type_expr -> bool
    val is_Tunivar : Types.type_expr -> bool
    val is_Tconstr : Types.type_expr -> bool
    val is_poly_Tpoly : Types.type_expr -> bool
    val dummy_method : Asttypes.label
    val type_kind_is_abstract : Types.type_declaration -> bool
    val label_is_poly : Types.label_description -> bool
    val is_fixed : Types.row_desc -> bool
    val has_fixed_explanation : Types.row_desc -> bool
    val fixed_explanation : Types.row_desc -> Types.fixed_explanation option
    val merge_fixed_explanation : Types.fixed_explanation option -> Types.fixed_explanation option -> Types.fixed_explanation option
    val static_row : Types.row_desc -> bool
    val hash_variant : Asttypes.label -> int
    val row_of_type : Types.type_expr -> Types.type_expr
    val has_constr_row : Types.type_expr -> bool
    val is_row_name : string -> bool
    val is_constr_row : allow_ident:bool -> Types.type_expr -> bool
    val set_static_row_name : Types.type_declaration -> Path.t -> unit
    val iter_type_expr : (Types.type_expr -> unit) -> Types.type_expr -> unit
    val fold_type_expr : @@ -15,11 +15,13 @@ unit
    type type_iterators = {
    1. it_signature : type_iterators -> Types.signature -> unit;
    2. it_signature_item : type_iterators -> Types.signature_item -> unit;
    3. it_value_description : type_iterators -> Types.value_description -> unit;
    4. it_type_declaration : type_iterators -> Types.type_declaration -> unit;
    5. it_extension_constructor : type_iterators -> + Types.constructor_arguments
    val mark_type : Types.type_mark -> Types.type_expr -> unit
    val mark_type_params : Types.type_mark -> Types.type_expr -> unit
    type 'a type_iterators = {
    1. it_signature : 'a type_iterators -> Types.signature -> unit;
    2. it_signature_item : 'a type_iterators -> Types.signature_item -> unit;
    3. it_value_description : 'a type_iterators -> Types.value_description -> unit;
    4. it_type_declaration : 'a type_iterators -> Types.type_declaration -> unit;
    5. it_extension_constructor : 'a type_iterators -> Types.extension_constructor -> - unit;
    6. it_module_declaration : type_iterators -> Types.module_declaration -> unit;
    7. it_modtype_declaration : type_iterators -> Types.modtype_declaration -> unit;
    8. it_class_declaration : type_iterators -> Types.class_declaration -> unit;
    9. it_class_type_declaration : type_iterators -> + unit;
    10. it_module_declaration : 'a type_iterators -> Types.module_declaration -> unit;
    11. it_modtype_declaration : 'a type_iterators -> + Types.modtype_declaration -> + unit;
    12. it_class_declaration : 'a type_iterators -> Types.class_declaration -> unit;
    13. it_class_type_declaration : 'a type_iterators -> Types.class_type_declaration -> - unit;
    14. it_functor_param : type_iterators -> Types.functor_parameter -> unit;
    15. it_module_type : type_iterators -> Types.module_type -> unit;
    16. it_class_type : type_iterators -> Types.class_type -> unit;
    17. it_type_kind : type_iterators -> Types.type_decl_kind -> unit;
    18. it_do_type_expr : type_iterators -> Types.type_expr -> unit;
    19. it_type_expr : type_iterators -> Types.type_expr -> unit;
    20. it_path : Path.t -> unit;
    }
    val type_iterators : type_iterators
    val unmark_iterators : type_iterators
    val copy_type_desc : + unit;
  • it_functor_param : 'a type_iterators -> Types.functor_parameter -> unit;
  • it_module_type : 'a type_iterators -> Types.module_type -> unit;
  • it_class_type : 'a type_iterators -> Types.class_type -> unit;
  • it_type_kind : 'a type_iterators -> Types.type_decl_kind -> unit;
  • it_do_type_expr : 'a type_iterators -> 'a;
  • it_type_expr : 'a type_iterators -> Types.type_expr -> unit;
  • it_path : Path.t -> unit;
  • }
    type type_iterators_full = (Types.type_expr -> unit) type_iterators
    type type_iterators_without_type_expr = (unit -> unit) type_iterators
    val type_iterators : Types.type_mark -> type_iterators_full
    val type_iterators_without_type_expr : type_iterators_without_type_expr
    val copy_type_desc : ?keep_names:bool -> (Types.type_expr -> Types.type_expr) -> Types.type_desc -> @@ -29,7 +31,7 @@ Types.row_desc -> bool -> Types.type_expr -> - Types.row_desc
    module For_copy : sig ... end
    val lowest_level : int
    val not_marked_node : Types.type_expr -> bool
    val logged_mark_node : Types.type_expr -> unit
    val try_logged_mark_node : Types.type_expr -> bool
    val flip_mark_node : Types.type_expr -> unit
    val try_mark_node : Types.type_expr -> bool
    val mark_type : Types.type_expr -> unit
    val mark_type_params : Types.type_expr -> unit
    val unmark_type : Types.type_expr -> unit
    val unmark_type_decl : Types.type_declaration -> unit
    val unmark_extension_constructor : Types.extension_constructor -> unit
    val unmark_class_type : Types.class_type -> unit
    val unmark_class_signature : Types.class_signature -> unit
    val find_expans : + Types.row_desc
    module For_copy : sig ... end
    val find_expans : Asttypes.private_flag -> Path.t -> Types.abbrev_memo -> @@ -49,4 +51,4 @@ Types.class_type
    val self_type_row : Types.class_type -> Types.type_expr
    val methods : Types.class_signature -> string list
    val virtual_methods : Types.class_signature -> string list
    val concrete_methods : Types.class_signature -> Types.MethSet.t
    val public_methods : Types.class_signature -> string list
    val instance_vars : Types.class_signature -> string list
    val virtual_instance_vars : Types.class_signature -> string list
    val concrete_instance_vars : Types.class_signature -> Types.VarSet.t
    val instance_variable_type : Asttypes.label -> Types.class_signature -> - Types.type_expr
    val print_raw : (Stdlib.Format.formatter -> Types.type_expr -> unit) ref
    val cstr_type_path : Types.constructor_description -> Path.t
    + Types.type_expr
    val cstr_type_path : Types.constructor_description -> Path.t
    diff --git a/ocaml/Builtin_attributes/index.html b/ocaml/Builtin_attributes/index.html index 8a5001e0..08116f04 100644 --- a/ocaml/Builtin_attributes/index.html +++ b/ocaml/Builtin_attributes/index.html @@ -1,12 +1,12 @@ -Builtin_attributes (ocaml.Builtin_attributes)

    Module Builtin_attributes

    Support for some of the builtin attributes

    Warning: this module is unstable and part of compiler-libs.

    val check_alerts : Location.t -> Parsetree.attributes -> string -> unit
    val check_alerts_inclusion : +Builtin_attributes (ocaml.Builtin_attributes)

    Module Builtin_attributes

    Support for the builtin attributes:

    • ocaml.alert
    • ocaml.boxed
    • ocaml.deprecated
    • ocaml.deprecated_mutable
    • ocaml.explicit_arity
    • ocaml.immediate
    • ocaml.immediate64
    • ocaml.inline
    • ocaml.inlined
    • ocaml.noalloc
    • ocaml.poll
    • ocaml.ppwarning
    • ocaml.specialise
    • ocaml.specialised
    • ocaml.tailcall
    • ocaml.tail_mod_cons
    • ocaml.unboxed
    • ocaml.untagged
    • ocaml.unrolled
    • ocaml.warnerror
    • ocaml.warning
    • ocaml.warn_on_literal_pattern

    Warning: this module is unstable and part of compiler-libs.

    Attribute tracking for warning 53

    type current_phase =
    1. | Parser
    2. | Invariant_check

    register_attr must be called on the locations of all attributes that should be tracked for the purpose of misplaced attribute warnings. In particular, it should be called on all attributes that are present in the source program except those that are contained in the payload of another attribute (because these may be left behind by a ppx and intentionally ignored by the compiler).

    The current_phase argument indicates when this function is being called

    • either when an attribute is created in the parser or when we see an attribute while running the check in the Ast_invariants module. This is used to ensure that we track only attributes from the final version of the parse tree: we skip adding attributes seen at parse time if we can see that a ppx will be run later, because the Ast_invariants check is always run on the result of a ppx.

    Note that the Ast_invariants check is also run on parse trees created from marshalled ast files if no ppx is being used, ensuring we don't miss attributes in that case.

    val register_attr : current_phase -> string Location.loc -> unit
    val mark_payload_attrs_used : Parsetree.payload -> unit

    Marks the attributes hiding in the payload of another attribute used, for the purposes of misplaced attribute warnings (see comment on current_phase above). In the parser, it's simplest to add these to the table and remove them later, rather than threading through state tracking whether we're in an attribute payload.

    val warn_unused : unit -> unit

    Issue misplaced attribute warnings for all attributes created with mk_internal but not yet marked used. Does nothing if compilation is stopped before lambda due to command-line flags.

    Warning 53 helpers for environment attributes

    Some attributes, like deprecation markers, do not affect the compilation of the definition on which they appear, but rather result in warnings on future uses of that definition. This is implemented by moving the raw attributes into the environment, where they will be noticed on future accesses.

    To make misplaced attribute warnings work appropriately for these attributes, we mark them "used" when they are moved into the environment. This is done with the helper functions in this section.

    val mark_alert_used : Parsetree.attribute -> unit

    Marks the attribute used for the purposes of misplaced attribute warnings if it is an alert. Call this when moving things allowed to have alert attributes into the environment.

    val mark_alerts_used : Parsetree.attributes -> unit

    The same as List.iter mark_alert_used.

    val mark_warn_on_literal_pattern_used : Parsetree.attributes -> unit

    Marks "warn_on_literal_pattern" attributes used for the purposes of misplaced attribute warnings. Call this when moving constructors into the environment.

    val mark_deprecated_mutable_used : Parsetree.attributes -> unit

    Marks "deprecated_mutable" attributes used for the purposes of misplaced attribute warnings. Call this when moving labels of mutable fields into the environment.

    Helpers for alert and warning attributes

    val check_alerts : Location.t -> Parsetree.attributes -> string -> unit
    val check_alerts_inclusion : def:Location.t -> use:Location.t -> Location.t -> Parsetree.attributes -> Parsetree.attributes -> string -> - unit
    val alerts_of_attrs : Parsetree.attributes -> Misc.alerts
    val alerts_of_sig : Parsetree.signature -> Misc.alerts
    val alerts_of_str : Parsetree.structure -> Misc.alerts
    val check_deprecated_mutable : + unit
    val alerts_of_attrs : Parsetree.attributes -> Misc.alerts
    val alerts_of_sig : mark:bool -> Parsetree.signature -> Misc.alerts
    val alerts_of_str : mark:bool -> Parsetree.structure -> Misc.alerts
    val check_deprecated_mutable : Location.t -> Parsetree.attributes -> string -> @@ -17,8 +17,11 @@ Parsetree.attributes -> Parsetree.attributes -> string -> - unit
    val check_no_alert : Parsetree.attributes -> unit
    val error_of_extension : Parsetree.extension -> Location.error
    val warning_attribute : ?ppwarning:bool -> Parsetree.attribute -> unit

    Apply warning settings from the specified attribute. "ocaml.warning"/"ocaml.warnerror" (and variants without the prefix) are processed and other attributes are ignored.

    Also implement ocaml.ppwarning (unless ~ppwarning:false is passed).

    val warning_scope : + unit
    val error_of_extension : Parsetree.extension -> Location.error
    val warning_attribute : ?ppwarning:bool -> Parsetree.attribute -> unit

    Apply warning settings from the specified attribute. "ocaml.warning"/"ocaml.warnerror" (and variants without the prefix) are processed and marked used for warning 53. Other attributes are ignored.

    Also implement ocaml.ppwarning (unless ~ppwarning:false is passed).

    val warning_scope : ?ppwarning:bool -> Parsetree.attributes -> (unit -> 'a) -> - 'a

    Execute a function in a new scope for warning settings. This means that the effect of any call to warning_attribute during the execution of this function will be discarded after execution.

    The function also takes a list of attributes which are processed with warning_attribute in the fresh scope before the function is executed.

    val warn_on_literal_pattern : Parsetree.attributes -> bool
    val explicit_arity : Parsetree.attributes -> bool
    val immediate : Parsetree.attributes -> bool
    val immediate64 : Parsetree.attributes -> bool
    val has_unboxed : Parsetree.attributes -> bool
    val has_boxed : Parsetree.attributes -> bool
    + 'a

    Execute a function in a new scope for warning settings. This means that the effect of any call to warning_attribute during the execution of this function will be discarded after execution.

    The function also takes a list of attributes which are processed with warning_attribute in the fresh scope before the function is executed.

    Helpers for searching for particular attributes

    val has_attribute : string -> Parsetree.attributes -> bool

    has_attribute name attrs is true if an attribute with name name or "ocaml." ^ name is present in attrs. It marks that attribute used for the purposes of misplaced attribute warnings.

    type attr_action =
    1. | Mark_used_only
    2. | Return

    select_attributes actions attrs finds the elements of attrs that appear in actions and either returns them or just marks them used, according to the corresponding attr_action.

    Each element (nm, action) of the actions list is an attribute along with an attr_action specifying what to do with that attribute. The action is used to accommodate different compiler configurations. If an attribute is used only in some compiler configurations, it's important that we still look for it and mark it used when compiling with other configurations. Otherwise, we would issue spurious misplaced attribute warnings.

    val select_attributes : + (string * attr_action) list -> + Parsetree.attributes -> + Parsetree.attributes
    val attr_equals_builtin : Parsetree.attribute -> string -> bool

    attr_equals_builtin attr s is true if the name of the attribute is s or "ocaml." ^ s. This is useful for manually inspecting attribute names, but note that doing so will not result in marking the attribute used for the purpose of warning 53, so it is usually preferable to use has_attribute or select_attributes.

    val warn_on_literal_pattern : Parsetree.attributes -> bool
    val explicit_arity : Parsetree.attributes -> bool
    val immediate : Parsetree.attributes -> bool
    val immediate64 : Parsetree.attributes -> bool
    val has_unboxed : Parsetree.attributes -> bool
    val has_boxed : Parsetree.attributes -> bool
    diff --git a/ocaml/Bytegen/index.html b/ocaml/Bytegen/index.html index 3f030373..2e785633 100644 --- a/ocaml/Bytegen/index.html +++ b/ocaml/Bytegen/index.html @@ -2,9 +2,7 @@ Bytegen (ocaml.Bytegen)

    Module Bytegen

    val compile_implementation : string -> Lambda.lambda -> - Instruct.instruction list
    val compile_phrase : - Lambda.lambda -> - Instruct.instruction list * Instruct.instruction list
    val merge_events : + Instruct.instruction list
    val compile_phrase : Lambda.lambda -> Instruct.instruction list * bool
    diff --git a/ocaml/Bytelibrarian/index.html b/ocaml/Bytelibrarian/index.html index e4b76f2f..1c0d0950 100644 --- a/ocaml/Bytelibrarian/index.html +++ b/ocaml/Bytelibrarian/index.html @@ -1,2 +1,2 @@ -Bytelibrarian (ocaml.Bytelibrarian)

    Module Bytelibrarian

    val create_archive : string list -> string -> unit
    type error =
    1. | File_not_found of string
    2. | Not_an_object_file of string
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    val reset : unit -> unit
    +Bytelibrarian (ocaml.Bytelibrarian)

    Module Bytelibrarian

    val create_archive : string list -> string -> unit
    type error =
    1. | File_not_found of string
    2. | Not_an_object_file of string
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    val reset : unit -> unit
    diff --git a/ocaml/Bytelink/Dep/index.html b/ocaml/Bytelink/Dep/index.html index a8567ec1..68537cbc 100644 --- a/ocaml/Bytelink/Dep/index.html +++ b/ocaml/Bytelink/Dep/index.html @@ -1,2 +1,2 @@ -Dep (ocaml.Bytelink.Dep)

    Module Bytelink.Dep

    The type of the set elements.

    val compare : t -> t -> int

    A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

    +Dep (ocaml.Bytelink.Dep)

    Module Bytelink.Dep

    The type of the set elements.

    val compare : t -> t -> int

    A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

    diff --git a/ocaml/Bytelink/index.html b/ocaml/Bytelink/index.html index b9af6cef..e5b53539 100644 --- a/ocaml/Bytelink/index.html +++ b/ocaml/Bytelink/index.html @@ -1,2 +1,7 @@ -Bytelink (ocaml.Bytelink)

    Module Bytelink

    module DepSet : Set.S with type elt = Dep.t
    val reset : unit -> unit
    val check_consistency : Misc.filepath -> Cmo_format.compilation_unit -> unit
    val extract_crc_interfaces : unit -> Misc.crcs
    type error =
    1. | File_not_found of Misc.filepath
    2. | Not_an_object_file of Misc.filepath
    3. | Wrong_object_name of Misc.filepath
    4. | Symbol_error of Misc.filepath * Symtable.error
    5. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
    6. | Custom_runtime
    7. | File_exists of Misc.filepath
    8. | Cannot_open_dll of Misc.filepath
    9. | Required_module_unavailable of Misc.modname * Misc.modname
    10. | Camlheader of string * Misc.filepath
    11. | Multiple_definition of Misc.modname * Misc.filepath * Misc.filepath
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    +Bytelink (ocaml.Bytelink)

    Module Bytelink

    module DepSet : Set.S with type elt = Dep.t
    val reset : unit -> unit
    val check_consistency : Misc.filepath -> Cmo_format.compilation_unit -> unit
    val linkdeps_unit : + Linkdeps.t -> + filename:string -> + Cmo_format.compilation_unit -> + unit
    val extract_crc_interfaces : unit -> Misc.crcs
    type error =
    1. | File_not_found of Misc.filepath
    2. | Not_an_object_file of Misc.filepath
    3. | Wrong_object_name of Misc.filepath
    4. | Symbol_error of Misc.filepath * Symtable.error
    5. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
    6. | Custom_runtime
    7. | File_exists of Misc.filepath
    8. | Cannot_open_dll of Misc.filepath
    9. | Camlheader of string * Misc.filepath
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Bytepackager/index.html b/ocaml/Bytepackager/index.html index 99451e25..b582d0bb 100644 --- a/ocaml/Bytepackager/index.html +++ b/ocaml/Bytepackager/index.html @@ -4,4 +4,4 @@ Env.t -> string list -> string -> - unit
    type error =
    1. | Forward_reference of string * Ident.t
    2. | Multiple_definition of string * Ident.t
    3. | Not_an_object_file of string
    4. | Illegal_renaming of string * string * string
    5. | File_not_found of string
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    + unit
    type error =
    1. | Forward_reference of string * Cmo_format.compunit
    2. | Multiple_definition of string * Cmo_format.compunit
    3. | Not_an_object_file of string
    4. | Illegal_renaming of Cmo_format.compunit * string * Cmo_format.compunit
    5. | File_not_found of string
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/index.html b/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/index.html index 07dff1c0..6618b7ef 100644 --- a/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/index.html +++ b/ocaml/CamlinternalMenhirLib/Engine/Make/argument-1-T/index.html @@ -12,6 +12,10 @@ ('env -> production -> 'answer) -> ('env -> 'answer) -> 'env -> - 'answer
    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val is_start : production -> bool
    exception Error
    type semantic_action = + 'answer
    val maybe_shift_t : state -> terminal -> state option

    maybe_shift_t s t determines whether there exists a transition out of the state s, labeled with the terminal symbol t, to some state s'. If so, it returns Some s'. Otherwise, it returns None.

    val may_reduce_prod : state -> terminal -> production -> bool

    may_reduce_prod s t prod determines whether in the state s, with lookahead symbol t, the automaton reduces production prod. This test accounts for the possible existence of a default reduction.

    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val lhs : production -> nonterminal
    val is_start : production -> bool
    exception Error
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : sig ... end
    + (state, semantic_value) EngineTypes.stack
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : + EngineTypes.LOG + with type state := state + and type terminal := terminal + and type production := production
    diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/index.html index eab36a2f..b022169d 100644 --- a/ocaml/CamlinternalMenhirLib/EngineTypes/index.html +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/index.html @@ -1,2 +1,2 @@ -EngineTypes (ocaml.CamlinternalMenhirLib.EngineTypes)

    Module CamlinternalMenhirLib.EngineTypes

    type ('state, 'semantic_value) stack = {
    1. state : 'state;
    2. semv : 'semantic_value;
    3. startp : Stdlib.Lexing.position;
    4. endp : Stdlib.Lexing.position;
    5. next : ('state, 'semantic_value) stack;
    }
    type ('state, 'semantic_value, 'token) env = {
    1. error : bool;
    2. triple : 'token * Stdlib.Lexing.position * Stdlib.Lexing.position;
    3. stack : ('state, 'semantic_value) stack;
    4. current : 'state;
    }
    module type TABLE = sig ... end
    module type MONOLITHIC_ENGINE = sig ... end
    module type INCREMENTAL_ENGINE_START = sig ... end
    module type ENGINE = sig ... end
    +EngineTypes (ocaml.CamlinternalMenhirLib.EngineTypes)

    Module CamlinternalMenhirLib.EngineTypes

    type ('state, 'semantic_value) stack = {
    1. state : 'state;
    2. semv : 'semantic_value;
    3. startp : Stdlib.Lexing.position;
    4. endp : Stdlib.Lexing.position;
    5. next : ('state, 'semantic_value) stack;
    }
    type ('state, 'semantic_value, 'token) env = {
    1. error : bool;
    2. triple : 'token * Stdlib.Lexing.position * Stdlib.Lexing.position;
    3. stack : ('state, 'semantic_value) stack;
    4. current : 'state;
    }
    module type LOG = sig ... end
    module type TABLE = sig ... end
    module type MONOLITHIC_ENGINE = sig ... end
    module type INCREMENTAL_ENGINE_START = sig ... end
    module type ENGINE = sig ... end
    diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-LOG/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-LOG/index.html new file mode 100644 index 00000000..db2e09e4 --- /dev/null +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-LOG/index.html @@ -0,0 +1,6 @@ + +LOG (ocaml.CamlinternalMenhirLib.EngineTypes.LOG)

    Module type EngineTypes.LOG

    type state
    type terminal
    type production
    val state : state -> unit
    val shift : terminal -> state -> unit
    val reduce_or_accept : production -> unit
    val lookahead_token : + terminal -> + Stdlib.Lexing.position -> + Stdlib.Lexing.position -> + unit
    val initiating_error_handling : unit -> unit
    val resuming_error_handling : unit -> unit
    val handling_error : state -> unit
    diff --git a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/index.html b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/index.html index dee60f2b..913f5c9f 100644 --- a/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/index.html +++ b/ocaml/CamlinternalMenhirLib/EngineTypes/module-type-TABLE/index.html @@ -12,6 +12,10 @@ ('env -> production -> 'answer) -> ('env -> 'answer) -> 'env -> - 'answer
    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val is_start : production -> bool
    exception Error
    type semantic_action = + 'answer
    val maybe_shift_t : state -> terminal -> state option

    maybe_shift_t s t determines whether there exists a transition out of the state s, labeled with the terminal symbol t, to some state s'. If so, it returns Some s'. Otherwise, it returns None.

    val may_reduce_prod : state -> terminal -> production -> bool

    may_reduce_prod s t prod determines whether in the state s, with lookahead symbol t, the automaton reduces production prod. This test accounts for the possible existence of a default reduction.

    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val lhs : production -> nonterminal
    val is_start : production -> bool
    exception Error
    type semantic_action = (state, semantic_value, token) env -> - (state, semantic_value) stack
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : sig ... end
    + (state, semantic_value) stack
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : + LOG + with type state := state + and type terminal := terminal + and type production := production
    diff --git a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/index.html b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/index.html index 4f6e16d0..adc215f7 100644 --- a/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/index.html +++ b/ocaml/CamlinternalMenhirLib/InspectionTableInterpreter/Make/argument-3-ET/index.html @@ -12,6 +12,10 @@ ('env -> production -> 'answer) -> ('env -> 'answer) -> 'env -> - 'answer
    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val is_start : production -> bool
    exception Error
    type semantic_action = + 'answer
    val maybe_shift_t : state -> terminal -> state option

    maybe_shift_t s t determines whether there exists a transition out of the state s, labeled with the terminal symbol t, to some state s'. If so, it returns Some s'. Otherwise, it returns None.

    val may_reduce_prod : state -> terminal -> production -> bool

    may_reduce_prod s t prod determines whether in the state s, with lookahead symbol t, the automaton reduces production prod. This test accounts for the possible existence of a default reduction.

    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val lhs : production -> nonterminal
    val is_start : production -> bool
    exception Error
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : sig ... end
    + (state, semantic_value) EngineTypes.stack
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : + EngineTypes.LOG + with type state := state + and type terminal := terminal + and type production := production
    diff --git a/ocaml/CamlinternalMenhirLib/LexerUtil/index.html b/ocaml/CamlinternalMenhirLib/LexerUtil/index.html index 2263bbbd..ee2c7c4e 100644 --- a/ocaml/CamlinternalMenhirLib/LexerUtil/index.html +++ b/ocaml/CamlinternalMenhirLib/LexerUtil/index.html @@ -1,2 +1,3 @@ -LexerUtil (ocaml.CamlinternalMenhirLib.LexerUtil)

    Module CamlinternalMenhirLib.LexerUtil

    val read : string -> string * Stdlib.Lexing.lexbuf
    val newline : Stdlib.Lexing.lexbuf -> unit
    +LexerUtil (ocaml.CamlinternalMenhirLib.LexerUtil)

    Module CamlinternalMenhirLib.LexerUtil

    init filename lexbuf initializes the lexing buffer lexbuf so that the positions that are subsequently read from it refer to the file filename. It returns lexbuf.

    val read : string -> string * Stdlib.Lexing.lexbuf

    read filename reads the entire contents of the file filename and returns a pair of this content (a string) and a lexing buffer that has been initialized, based on this string.

    val newline : Stdlib.Lexing.lexbuf -> unit

    newline lexbuf increments the line counter stored within lexbuf. It should be invoked by the lexer itself every time a newline character is consumed. This allows maintaining a current the line number in lexbuf.

    range (startpos, endpos) prints a textual description of the range delimited by the start and end positions startpos and endpos. This description is one line long and ends in a newline character. This description mentions the file name, the line number, and a range of characters on this line. The line number is correct only if newline has been correctly used, as described dabove.

    val tabulate : ('a -> bool) -> (unit -> 'a) -> unit -> 'a

    tabulate is_eof lexer tabulates the lexer lexer: that is, it immediately runs this lexer all the way until an EOF token is found, stores the tokens in an array in memory, and returns a new lexer which (when invoked) reads tokens from this array. The function lexer is not allowed to raise an exception, and must produce a finite stream of tokens: that is, after a finite number of invocations, it must return a token that is identified by the function is_eof as an EOF token.

    Both the existing lexer lexer and the new lexer returned by tabulate + is_eof lexer are functions of type unit -> 'a, where the type 'a is likely to be instantiated with a triple of a token and two positions, as per the revised lexer API described in the module Convert.

    diff --git a/ocaml/CamlinternalMenhirLib/StaticVersion/index.html b/ocaml/CamlinternalMenhirLib/StaticVersion/index.html index 4e36731f..1e0aeafc 100644 --- a/ocaml/CamlinternalMenhirLib/StaticVersion/index.html +++ b/ocaml/CamlinternalMenhirLib/StaticVersion/index.html @@ -1,2 +1,2 @@ -StaticVersion (ocaml.CamlinternalMenhirLib.StaticVersion)

    Module CamlinternalMenhirLib.StaticVersion

    val require_20210419 : unit
    +StaticVersion (ocaml.CamlinternalMenhirLib.StaticVersion)

    Module CamlinternalMenhirLib.StaticVersion

    val require_20231231 : unit
    diff --git a/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/index.html b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/index.html index b0d20a61..7f766fb7 100644 --- a/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/index.html +++ b/ocaml/CamlinternalMenhirLib/TableInterpreter/MakeEngineTable/index.html @@ -12,6 +12,10 @@ ('env -> production -> 'answer) -> ('env -> 'answer) -> 'env -> - 'answer
    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val is_start : production -> bool
    exception Error
    type semantic_action = + 'answer
    val maybe_shift_t : state -> terminal -> state option

    maybe_shift_t s t determines whether there exists a transition out of the state s, labeled with the terminal symbol t, to some state s'. If so, it returns Some s'. Otherwise, it returns None.

    val may_reduce_prod : state -> terminal -> production -> bool

    may_reduce_prod s t prod determines whether in the state s, with lookahead symbol t, the automaton reduces production prod. This test accounts for the possible existence of a default reduction.

    val goto_nt : state -> nonterminal -> state
    val goto_prod : state -> production -> state
    val maybe_goto_nt : state -> nonterminal -> state option
    val lhs : production -> nonterminal
    val is_start : production -> bool
    exception Error
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : sig ... end
    + (state, semantic_value) EngineTypes.stack
    val semantic_action : production -> semantic_action
    val may_reduce : state -> production -> bool
    val log : bool
    module Log : + EngineTypes.LOG + with type state := state + and type terminal := terminal + and type production := production
    diff --git a/ocaml/CamlinternalOO/index.html b/ocaml/CamlinternalOO/index.html index 607328c8..e4b5c428 100644 --- a/ocaml/CamlinternalOO/index.html +++ b/ocaml/CamlinternalOO/index.html @@ -8,11 +8,11 @@ string array -> string array -> string array -> - (t * (table -> obj -> Stdlib.Obj.t) * t * obj) -> + (t * (table -> obj -> Stdlib.Obj.t) * obj) -> bool -> Stdlib.Obj.t array
    val make_class : string array -> (table -> Stdlib.Obj.t -> t) -> - t * (table -> Stdlib.Obj.t -> t) * (Stdlib.Obj.t -> t) * Stdlib.Obj.t
    type init_table
    val make_class_store : string array -> (table -> t) -> init_table -> unit
    val dummy_class : + t * (table -> Stdlib.Obj.t -> t) * Stdlib.Obj.t
    type init_table
    val make_class_store : string array -> (table -> t) -> init_table -> unit
    val dummy_class : (string * int * int) -> - t * (table -> Stdlib.Obj.t -> t) * (Stdlib.Obj.t -> t) * Stdlib.Obj.t

    Objects

    val copy : < .. > as 'a -> 'a
    val create_object : table -> obj
    val create_object_opt : obj -> table -> obj
    val run_initializers : obj -> table -> unit
    val run_initializers_opt : obj -> obj -> table -> obj
    val create_object_and_run_initializers : obj -> table -> obj
    val send : obj -> tag -> t
    val sendcache : obj -> tag -> t -> int -> t
    val sendself : obj -> label -> t
    val get_public_method : obj -> tag -> closure

    Table cache

    type tables
    val lookup_tables : tables -> closure array -> tables

    Builtins to reduce code size

    type impl =
    1. | GetConst
    2. | GetVar
    3. | GetEnv
    4. | GetMeth
    5. | SetVar
    6. | AppConst
    7. | AppVar
    8. | AppEnv
    9. | AppMeth
    10. | AppConstConst
    11. | AppConstVar
    12. | AppConstEnv
    13. | AppConstMeth
    14. | AppVarConst
    15. | AppEnvConst
    16. | AppMethConst
    17. | MethAppConst
    18. | MethAppVar
    19. | MethAppEnv
    20. | MethAppMeth
    21. | SendConst
    22. | SendVar
    23. | SendEnv
    24. | SendMeth
    25. | Closure of closure

    Parameters

    type params = {
    1. mutable compact_table : bool;
    2. mutable copy_parent : bool;
    3. mutable clean_when_copying : bool;
    4. mutable retry_count : int;
    5. mutable bucket_small_size : int;
    }
    val params : params

    Statistics

    type stats = {
    1. classes : int;
    2. methods : int;
    3. inst_vars : int;
    }
    val stats : unit -> stats
    + t * (table -> Stdlib.Obj.t -> t) * Stdlib.Obj.t

    Objects

    val copy : < .. > as 'a -> 'a
    val create_object : table -> obj
    val create_object_opt : obj -> table -> obj
    val run_initializers : obj -> table -> unit
    val run_initializers_opt : obj -> obj -> table -> obj
    val create_object_and_run_initializers : obj -> table -> obj
    val send : obj -> tag -> t
    val sendcache : obj -> tag -> t -> int -> t
    val sendself : obj -> label -> t
    val get_public_method : obj -> tag -> closure

    Table cache

    type tables
    val lookup_tables : tables -> closure array -> tables

    Builtins to reduce code size

    type impl =
    1. | GetConst
    2. | GetVar
    3. | GetEnv
    4. | GetMeth
    5. | SetVar
    6. | AppConst
    7. | AppVar
    8. | AppEnv
    9. | AppMeth
    10. | AppConstConst
    11. | AppConstVar
    12. | AppConstEnv
    13. | AppConstMeth
    14. | AppVarConst
    15. | AppEnvConst
    16. | AppMethConst
    17. | MethAppConst
    18. | MethAppVar
    19. | MethAppEnv
    20. | MethAppMeth
    21. | SendConst
    22. | SendVar
    23. | SendEnv
    24. | SendMeth
    25. | Closure of closure

    Parameters

    type params = {
    1. mutable compact_table : bool;
    2. mutable copy_parent : bool;
    3. mutable clean_when_copying : bool;
    4. mutable retry_count : int;
    5. mutable bucket_small_size : int;
    }
    val params : params

    Statistics

    type stats = {
    1. classes : int;
    2. methods : int;
    3. inst_vars : int;
    }
    val stats : unit -> stats
    diff --git a/ocaml/Ccomp/index.html b/ocaml/Ccomp/index.html index 2d5e3d18..44547935 100644 --- a/ocaml/Ccomp/index.html +++ b/ocaml/Ccomp/index.html @@ -4,4 +4,4 @@ ?opt:string -> ?stable_name:string -> string -> - int
    val create_archive : string -> string list -> int
    val quote_files : response_files:bool -> string list -> string
    val quote_optfile : string option -> string
    val call_linker : link_mode -> string -> string list -> string -> int
    + int
    val create_archive : string -> string list -> int
    val quote_files : response_files:bool -> string list -> string
    val quote_optfile : string option -> string
    val call_linker : link_mode -> string -> string list -> string -> int
    diff --git a/ocaml/Clambda/index.html b/ocaml/Clambda/index.html index d0c04902..82e00215 100644 --- a/ocaml/Clambda/index.html +++ b/ocaml/Clambda/index.html @@ -5,7 +5,7 @@ * ulambda * ulambda
  • | Uphantom_let of Backend_var.With_provenance.t * uphantom_defining_expr option - * ulambda
  • | Uletrec of (Backend_var.With_provenance.t * ulambda) list * ulambda
  • | Uprim of Clambda_primitives.primitive * ulambda list * Debuginfo.t
  • | Uswitch of ulambda * ulambda_switch * Debuginfo.t
  • | Ustringswitch of ulambda * (string * ulambda) list * ulambda option
  • | Ustaticfail of int * ulambda list
  • | Ucatch of int + * ulambda
  • | Uprim of Clambda_primitives.primitive * ulambda list * Debuginfo.t
  • | Uswitch of ulambda * ulambda_switch * Debuginfo.t
  • | Ustringswitch of ulambda * (string * ulambda) list * ulambda option
  • | Ustaticfail of int * ulambda list
  • | Ucatch of int * (Backend_var.With_provenance.t * Lambda.value_kind) list * ulambda * ulambda
  • | Utrywith of ulambda * Backend_var.With_provenance.t * ulambda
  • | Uifthenelse of ulambda * ulambda * ulambda
  • | Usequence of ulambda * ulambda
  • | Uwhile of ulambda * ulambda
  • | Ufor of Backend_var.With_provenance.t diff --git a/ocaml/Clambda_primitives/index.html b/ocaml/Clambda_primitives/index.html index 2cf5db36..18cea044 100644 --- a/ocaml/Clambda_primitives/index.html +++ b/ocaml/Clambda_primitives/index.html @@ -1,2 +1,2 @@ -Clambda_primitives (ocaml.Clambda_primitives)

    Module Clambda_primitives

    type mutable_flag = Asttypes.mutable_flag
    type immediate_or_pointer = Lambda.immediate_or_pointer
    type initialization_or_assignment = Lambda.initialization_or_assignment
    type is_safe = Lambda.is_safe
    type boxed =
    1. | Boxed
    2. | Unboxed
    type memory_access_size =
    1. | Sixteen
    2. | Thirty_two
    3. | Sixty_four
    type primitive =
    1. | Pread_symbol of string
    2. | Pmakeblock of int * mutable_flag * block_shape
    3. | Pfield of int * immediate_or_pointer * mutable_flag
    4. | Pfield_computed
    5. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
    6. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
    7. | Pfloatfield of int
    8. | Psetfloatfield of int * initialization_or_assignment
    9. | Pduprecord of Types.record_representation * int
    10. | Prunstack
    11. | Pperform
    12. | Presume
    13. | Preperform
    14. | Pccall of Primitive.description
    15. | Praise of raise_kind
    16. | Psequand
    17. | Psequor
    18. | Pnot
    19. | Pnegint
    20. | Paddint
    21. | Psubint
    22. | Pmulint
    23. | Pdivint of is_safe
    24. | Pmodint of is_safe
    25. | Pandint
    26. | Porint
    27. | Pxorint
    28. | Plslint
    29. | Plsrint
    30. | Pasrint
    31. | Pintcomp of integer_comparison
    32. | Pcompare_ints
    33. | Pcompare_floats
    34. | Pcompare_bints of boxed_integer
    35. | Poffsetint of int
    36. | Poffsetref of int
    37. | Pintoffloat
    38. | Pfloatofint
    39. | Pnegfloat
    40. | Pabsfloat
    41. | Paddfloat
    42. | Psubfloat
    43. | Pmulfloat
    44. | Pdivfloat
    45. | Pfloatcomp of float_comparison
    46. | Pstringlength
    47. | Pstringrefu
    48. | Pstringrefs
    49. | Pbyteslength
    50. | Pbytesrefu
    51. | Pbytessetu
    52. | Pbytesrefs
    53. | Pbytessets
    54. | Pmakearray of array_kind * mutable_flag
      (*

      For Pmakearray, the list of arguments must not be empty. The empty array should be represented by a distinguished constant in the middle end.

      *)
    55. | Pduparray of array_kind * mutable_flag
      (*

      For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

      *)
    56. | Parraylength of array_kind
    57. | Parrayrefu of array_kind
    58. | Parraysetu of array_kind
    59. | Parrayrefs of array_kind
    60. | Parraysets of array_kind
    61. | Pisint
    62. | Pisout
    63. | Pbintofint of boxed_integer
    64. | Pintofbint of boxed_integer
    65. | Pcvtbint of boxed_integer * boxed_integer
    66. | Pnegbint of boxed_integer
    67. | Paddbint of boxed_integer
    68. | Psubbint of boxed_integer
    69. | Pmulbint of boxed_integer
    70. | Pdivbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    71. | Pmodbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    72. | Pandbint of boxed_integer
    73. | Porbint of boxed_integer
    74. | Pxorbint of boxed_integer
    75. | Plslbint of boxed_integer
    76. | Plsrbint of boxed_integer
    77. | Pasrbint of boxed_integer
    78. | Pbintcomp of boxed_integer * integer_comparison
    79. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
    80. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
    81. | Pbigarraydim of int
    82. | Pstring_load of memory_access_size * is_safe
    83. | Pbytes_load of memory_access_size * is_safe
    84. | Pbytes_set of memory_access_size * is_safe
    85. | Pbigstring_load of memory_access_size * is_safe
    86. | Pbigstring_set of memory_access_size * is_safe
    87. | Pbswap16
    88. | Pbbswap of boxed_integer
    89. | Pint_as_pointer
    90. | Patomic_load of {
      1. immediate_or_pointer : immediate_or_pointer;
      }
    91. | Patomic_exchange
    92. | Patomic_cas
    93. | Patomic_fetch_add
    94. | Popaque
    95. | Pdls_get
    and integer_comparison = Lambda.integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    and float_comparison = Lambda.float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    and array_kind = Lambda.array_kind =
    1. | Pgenarray
    2. | Paddrarray
    3. | Pintarray
    4. | Pfloatarray
    and value_kind = Lambda.value_kind =
    1. | Pgenval
    2. | Pfloatval
    3. | Pboxedintval of boxed_integer
    4. | Pintval
    and block_shape = Lambda.block_shape
    and boxed_integer = Primitive.boxed_integer =
    1. | Pnativeint
    2. | Pint32
    3. | Pint64
    and bigarray_kind = Lambda.bigarray_kind =
    1. | Pbigarray_unknown
    2. | Pbigarray_float32
    3. | Pbigarray_float64
    4. | Pbigarray_sint8
    5. | Pbigarray_uint8
    6. | Pbigarray_sint16
    7. | Pbigarray_uint16
    8. | Pbigarray_int32
    9. | Pbigarray_int64
    10. | Pbigarray_caml_int
    11. | Pbigarray_native_int
    12. | Pbigarray_complex32
    13. | Pbigarray_complex64
    and bigarray_layout = Lambda.bigarray_layout =
    1. | Pbigarray_unknown_layout
    2. | Pbigarray_c_layout
    3. | Pbigarray_fortran_layout
    and raise_kind = Lambda.raise_kind =
    1. | Raise_regular
    2. | Raise_reraise
    3. | Raise_notrace
    val equal : primitive -> primitive -> bool
    +Clambda_primitives (ocaml.Clambda_primitives)

    Module Clambda_primitives

    type mutable_flag = Asttypes.mutable_flag
    type immediate_or_pointer = Lambda.immediate_or_pointer
    type initialization_or_assignment = Lambda.initialization_or_assignment
    type is_safe = Lambda.is_safe
    type boxed =
    1. | Boxed
    2. | Unboxed
    type memory_access_size =
    1. | Sixteen
    2. | Thirty_two
    3. | Sixty_four
    type primitive =
    1. | Pread_symbol of string
    2. | Pmakeblock of int * mutable_flag * block_shape
    3. | Pfield of int * immediate_or_pointer * mutable_flag
    4. | Pfield_computed
    5. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
    6. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
    7. | Pfloatfield of int
    8. | Psetfloatfield of int * initialization_or_assignment
    9. | Pduprecord of Types.record_representation * int
    10. | Prunstack
    11. | Pperform
    12. | Presume
    13. | Preperform
    14. | Pccall of Primitive.description
    15. | Praise of raise_kind
    16. | Psequand
    17. | Psequor
    18. | Pnot
    19. | Pnegint
    20. | Paddint
    21. | Psubint
    22. | Pmulint
    23. | Pdivint of is_safe
    24. | Pmodint of is_safe
    25. | Pandint
    26. | Porint
    27. | Pxorint
    28. | Plslint
    29. | Plsrint
    30. | Pasrint
    31. | Pintcomp of integer_comparison
    32. | Pcompare_ints
    33. | Pcompare_floats
    34. | Pcompare_bints of boxed_integer
    35. | Poffsetint of int
    36. | Poffsetref of int
    37. | Pintoffloat
    38. | Pfloatofint
    39. | Pnegfloat
    40. | Pabsfloat
    41. | Paddfloat
    42. | Psubfloat
    43. | Pmulfloat
    44. | Pdivfloat
    45. | Pfloatcomp of float_comparison
    46. | Pstringlength
    47. | Pstringrefu
    48. | Pstringrefs
    49. | Pbyteslength
    50. | Pbytesrefu
    51. | Pbytessetu
    52. | Pbytesrefs
    53. | Pbytessets
    54. | Pmakearray of array_kind * mutable_flag
      (*

      For Pmakearray, the list of arguments must not be empty. The empty array should be represented by a distinguished constant in the middle end.

      *)
    55. | Pduparray of array_kind * mutable_flag
      (*

      For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

      *)
    56. | Parraylength of array_kind
    57. | Parrayrefu of array_kind
    58. | Parraysetu of array_kind
    59. | Parrayrefs of array_kind
    60. | Parraysets of array_kind
    61. | Pisint
    62. | Pisout
    63. | Pbintofint of boxed_integer
    64. | Pintofbint of boxed_integer
    65. | Pcvtbint of boxed_integer * boxed_integer
    66. | Pnegbint of boxed_integer
    67. | Paddbint of boxed_integer
    68. | Psubbint of boxed_integer
    69. | Pmulbint of boxed_integer
    70. | Pdivbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    71. | Pmodbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    72. | Pandbint of boxed_integer
    73. | Porbint of boxed_integer
    74. | Pxorbint of boxed_integer
    75. | Plslbint of boxed_integer
    76. | Plsrbint of boxed_integer
    77. | Pasrbint of boxed_integer
    78. | Pbintcomp of boxed_integer * integer_comparison
    79. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
    80. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
    81. | Pbigarraydim of int
    82. | Pstring_load of memory_access_size * is_safe
    83. | Pbytes_load of memory_access_size * is_safe
    84. | Pbytes_set of memory_access_size * is_safe
    85. | Pbigstring_load of memory_access_size * is_safe
    86. | Pbigstring_set of memory_access_size * is_safe
    87. | Pbswap16
    88. | Pbbswap of boxed_integer
    89. | Pint_as_pointer
    90. | Patomic_load of {
      1. immediate_or_pointer : immediate_or_pointer;
      }
    91. | Patomic_exchange
    92. | Patomic_cas
    93. | Patomic_fetch_add
    94. | Popaque
    95. | Pdls_get
    96. | Ppoll
    and integer_comparison = Lambda.integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    and float_comparison = Lambda.float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    and array_kind = Lambda.array_kind =
    1. | Pgenarray
    2. | Paddrarray
    3. | Pintarray
    4. | Pfloatarray
    and value_kind = Lambda.value_kind =
    1. | Pgenval
    2. | Pfloatval
    3. | Pboxedintval of boxed_integer
    4. | Pintval
    and block_shape = Lambda.block_shape
    and boxed_integer = Primitive.boxed_integer =
    1. | Pnativeint
    2. | Pint32
    3. | Pint64
    and bigarray_kind = Lambda.bigarray_kind =
    1. | Pbigarray_unknown
    2. | Pbigarray_float16
    3. | Pbigarray_float32
    4. | Pbigarray_float64
    5. | Pbigarray_sint8
    6. | Pbigarray_uint8
    7. | Pbigarray_sint16
    8. | Pbigarray_uint16
    9. | Pbigarray_int32
    10. | Pbigarray_int64
    11. | Pbigarray_caml_int
    12. | Pbigarray_native_int
    13. | Pbigarray_complex32
    14. | Pbigarray_complex64
    and bigarray_layout = Lambda.bigarray_layout =
    1. | Pbigarray_unknown_layout
    2. | Pbigarray_c_layout
    3. | Pbigarray_fortran_layout
    and raise_kind = Lambda.raise_kind =
    1. | Raise_regular
    2. | Raise_reraise
    3. | Raise_notrace
    val equal : primitive -> primitive -> bool
    diff --git a/ocaml/Clflags/index.html b/ocaml/Clflags/index.html index 5893954b..d44bd0ca 100644 --- a/ocaml/Clflags/index.html +++ b/ocaml/Clflags/index.html @@ -1,2 +1,2 @@ -Clflags (ocaml.Clflags)

    Module Clflags

    Command line flags

    module Int_arg_helper : sig ... end

    Optimization parameters represented as ints indexed by round number.

    module Float_arg_helper : sig ... end

    Optimization parameters represented as floats indexed by round number.

    type inlining_arguments = {
    1. inline_call_cost : int option;
    2. inline_alloc_cost : int option;
    3. inline_prim_cost : int option;
    4. inline_branch_cost : int option;
    5. inline_indirect_cost : int option;
    6. inline_lifting_benefit : int option;
    7. inline_branch_factor : float option;
    8. inline_max_depth : int option;
    9. inline_max_unroll : int option;
    10. inline_threshold : float option;
    11. inline_toplevel_threshold : int option;
    }
    val classic_arguments : inlining_arguments
    val o1_arguments : inlining_arguments
    val o2_arguments : inlining_arguments
    val o3_arguments : inlining_arguments
    val use_inlining_arguments_set : ?round:int -> inlining_arguments -> unit

    Set all the inlining arguments for a round. The default is set if no round is provided.

    val objfiles : string list ref
    val ccobjs : string list ref
    val dllibs : string list ref
    val cmi_file : string option ref
    val compile_only : bool ref
    val output_name : string option ref
    val include_dirs : string list ref
    val no_std_include : bool ref
    val no_cwd : bool ref
    val print_types : bool ref
    val make_archive : bool ref
    val debug : bool ref
    val debug_full : bool ref
    val unsafe : bool ref
    val use_linscan : bool ref
    val custom_runtime : bool ref
    val no_check_prims : bool ref
    val bytecode_compatible_32 : bool ref
    val output_c_object : bool ref
    val output_complete_object : bool ref
    val output_complete_executable : bool ref
    val all_ccopts : string list ref
    val classic : bool ref
    val nopervasives : bool ref
    val match_context_rows : int ref
    val safer_matching : bool ref
    val open_modules : string list ref
    val preprocessor : string option ref
    val all_ppx : string list ref
    val absname : bool ref
    val annotations : bool ref
    val binary_annotations : bool ref
    val use_threads : bool ref
    val noassert : bool ref
    val verbose : bool ref
    val noprompt : bool ref
    val nopromptcont : bool ref
    val init_file : string option ref
    val noinit : bool ref
    val noversion : bool ref
    val use_prims : string ref
    val use_runtime : string ref
    val plugin : bool ref
    val principal : bool ref
    val real_paths : bool ref
    val recursive_types : bool ref
    val strict_sequence : bool ref
    val strict_formats : bool ref
    val applicative_functors : bool ref
    val make_runtime : bool ref
    val c_compiler : string option ref
    val dllpaths : string list ref
    val make_package : bool ref
    val for_package : string option ref
    val error_size : int ref
    val float_const_prop : bool ref
    val transparent_modules : bool ref
    val unique_ids : bool ref
    val locations : bool ref
    val dump_source : bool ref
    val dump_parsetree : bool ref
    val dump_typedtree : bool ref
    val dump_shape : bool ref
    val dump_rawlambda : bool ref
    val dump_lambda : bool ref
    val dump_rawclambda : bool ref
    val dump_clambda : bool ref
    val dump_rawflambda : bool ref
    val dump_flambda : bool ref
    val dump_flambda_let : int option ref
    val dump_instr : bool ref
    val keep_camlprimc_file : bool ref
    val keep_asm_file : bool ref
    val optimize_for_speed : bool ref
    val dump_cmm : bool ref
    val dump_selection : bool ref
    val dump_cse : bool ref
    val dump_live : bool ref
    val dump_spill : bool ref
    val dump_split : bool ref
    val dump_interf : bool ref
    val dump_prefer : bool ref
    val dump_regalloc : bool ref
    val dump_reload : bool ref
    val dump_scheduling : bool ref
    val dump_linear : bool ref
    val dump_interval : bool ref
    val keep_startup_file : bool ref
    val dump_combine : bool ref
    val native_code : bool ref
    val default_inline_threshold : float
    val inline_threshold : Float_arg_helper.parsed ref
    val inlining_report : bool ref
    val simplify_rounds : int option ref
    val default_simplify_rounds : int ref
    val rounds : unit -> int
    val default_inline_max_unroll : int
    val inline_max_unroll : Int_arg_helper.parsed ref
    val default_inline_toplevel_threshold : int
    val inline_toplevel_threshold : Int_arg_helper.parsed ref
    val default_inline_call_cost : int
    val default_inline_alloc_cost : int
    val default_inline_prim_cost : int
    val default_inline_branch_cost : int
    val default_inline_indirect_cost : int
    val default_inline_lifting_benefit : int
    val inline_call_cost : Int_arg_helper.parsed ref
    val inline_alloc_cost : Int_arg_helper.parsed ref
    val inline_prim_cost : Int_arg_helper.parsed ref
    val inline_branch_cost : Int_arg_helper.parsed ref
    val inline_indirect_cost : Int_arg_helper.parsed ref
    val inline_lifting_benefit : Int_arg_helper.parsed ref
    val default_inline_branch_factor : float
    val inline_branch_factor : Float_arg_helper.parsed ref
    val dont_write_files : bool ref
    val std_include_flag : string -> string
    val std_include_dir : unit -> string list
    val shared : bool ref
    val dlcode : bool ref
    val pic_code : bool ref
    val runtime_variant : string ref
    val with_runtime : bool ref
    val force_slash : bool ref
    val keep_docs : bool ref
    val keep_locs : bool ref
    val opaque : bool ref
    val profile_columns : Profile.column list ref
    val flambda_invariant_checks : bool ref
    val unbox_closures : bool ref
    val unbox_closures_factor : int ref
    val default_unbox_closures_factor : int
    val unbox_free_vars_of_closures : bool ref
    val unbox_specialised_args : bool ref
    val clambda_checks : bool ref
    val cmm_invariants : bool ref
    val default_inline_max_depth : int
    val inline_max_depth : Int_arg_helper.parsed ref
    val remove_unused_arguments : bool ref
    val dump_flambda_verbose : bool ref
    val classic_inlining : bool ref
    val afl_instrument : bool ref
    val afl_inst_ratio : int ref
    val function_sections : bool ref
    val all_passes : string list ref
    val dumped_pass : string -> bool
    val set_dumped_pass : string -> bool -> unit
    val dump_into_file : bool ref
    val dump_dir : string option ref
    type 'a env_reader = {
    1. parse : string -> 'a option;
    2. print : 'a -> string;
    3. usage : string;
    4. env_var : string;
    }
    val color : Misc.Color.setting option ref
    val color_reader : Misc.Color.setting env_reader
    val error_style : Misc.Error_style.setting option ref
    val error_style_reader : Misc.Error_style.setting env_reader
    val unboxed_types : bool ref
    val insn_sched : bool ref
    val insn_sched_default : bool
    module Compiler_pass : sig ... end
    val stop_after : Compiler_pass.t option ref
    val should_stop_after : Compiler_pass.t -> bool
    val set_save_ir_after : Compiler_pass.t -> bool -> unit
    val should_save_ir_after : Compiler_pass.t -> bool
    val arg_spec : (string * Stdlib.Arg.spec * string) list ref
    val add_arguments : string -> (string * Stdlib.Arg.spec * string) list -> unit
    val create_usage_msg : string -> string
    val print_arguments : string -> unit
    val reset_arguments : unit -> unit
    +Clflags (ocaml.Clflags)

    Module Clflags

    Command line flags

    module Int_arg_helper : sig ... end

    Optimization parameters represented as ints indexed by round number.

    module Float_arg_helper : sig ... end

    Optimization parameters represented as floats indexed by round number.

    type inlining_arguments = {
    1. inline_call_cost : int option;
    2. inline_alloc_cost : int option;
    3. inline_prim_cost : int option;
    4. inline_branch_cost : int option;
    5. inline_indirect_cost : int option;
    6. inline_lifting_benefit : int option;
    7. inline_branch_factor : float option;
    8. inline_max_depth : int option;
    9. inline_max_unroll : int option;
    10. inline_threshold : float option;
    11. inline_toplevel_threshold : int option;
    }
    val classic_arguments : inlining_arguments
    val o1_arguments : inlining_arguments
    val o2_arguments : inlining_arguments
    val o3_arguments : inlining_arguments
    val use_inlining_arguments_set : ?round:int -> inlining_arguments -> unit

    Set all the inlining arguments for a round. The default is set if no round is provided.

    val objfiles : string list ref
    val ccobjs : string list ref
    val dllibs : string list ref
    val cmi_file : string option ref
    val compile_only : bool ref
    val output_name : string option ref
    val include_dirs : string list ref
    val hidden_include_dirs : string list ref
    val no_std_include : bool ref
    val no_cwd : bool ref
    val print_types : bool ref
    val make_archive : bool ref
    val debug : bool ref
    val debug_full : bool ref
    val unsafe : bool ref
    val use_linscan : bool ref
    val custom_runtime : bool ref
    val no_check_prims : bool ref
    val bytecode_compatible_32 : bool ref
    val output_c_object : bool ref
    val output_complete_object : bool ref
    val output_complete_executable : bool ref
    val all_ccopts : string list ref
    val classic : bool ref
    val nopervasives : bool ref
    val match_context_rows : int ref
    val safer_matching : bool ref
    val open_modules : string list ref
    val preprocessor : string option ref
    val all_ppx : string list ref
    val absname : bool ref
    val annotations : bool ref
    val binary_annotations : bool ref
    val store_occurrences : bool ref
    val use_threads : bool ref
    val noassert : bool ref
    val verbose : bool ref
    val noprompt : bool ref
    val nopromptcont : bool ref
    val init_file : string option ref
    val noinit : bool ref
    val noversion : bool ref
    val use_prims : string ref
    val use_runtime : string ref
    val plugin : bool ref
    val principal : bool ref
    val real_paths : bool ref
    val recursive_types : bool ref
    val strict_sequence : bool ref
    val strict_formats : bool ref
    val applicative_functors : bool ref
    val make_runtime : bool ref
    val c_compiler : string option ref
    val dllpaths : string list ref
    val make_package : bool ref
    val for_package : string option ref
    val error_size : int ref
    val float_const_prop : bool ref
    val transparent_modules : bool ref
    val unique_ids : bool ref
    val locations : bool ref
    val dump_source : bool ref
    val dump_parsetree : bool ref
    val dump_typedtree : bool ref
    val dump_shape : bool ref
    val dump_rawlambda : bool ref
    val dump_lambda : bool ref
    val dump_rawclambda : bool ref
    val dump_clambda : bool ref
    val dump_rawflambda : bool ref
    val dump_flambda : bool ref
    val dump_flambda_let : int option ref
    val dump_instr : bool ref
    val keep_camlprimc_file : bool ref
    val keep_asm_file : bool ref
    val optimize_for_speed : bool ref
    val dump_cmm : bool ref
    val dump_selection : bool ref
    val dump_cse : bool ref
    val dump_live : bool ref
    val dump_spill : bool ref
    val dump_split : bool ref
    val dump_interf : bool ref
    val dump_prefer : bool ref
    val dump_regalloc : bool ref
    val dump_reload : bool ref
    val dump_scheduling : bool ref
    val dump_linear : bool ref
    val dump_interval : bool ref
    val keep_startup_file : bool ref
    val dump_combine : bool ref
    val native_code : bool ref
    val default_inline_threshold : float
    val inline_threshold : Float_arg_helper.parsed ref
    val inlining_report : bool ref
    val simplify_rounds : int option ref
    val default_simplify_rounds : int ref
    val rounds : unit -> int
    val default_inline_max_unroll : int
    val inline_max_unroll : Int_arg_helper.parsed ref
    val default_inline_toplevel_threshold : int
    val inline_toplevel_threshold : Int_arg_helper.parsed ref
    val default_inline_call_cost : int
    val default_inline_alloc_cost : int
    val default_inline_prim_cost : int
    val default_inline_branch_cost : int
    val default_inline_indirect_cost : int
    val default_inline_lifting_benefit : int
    val inline_call_cost : Int_arg_helper.parsed ref
    val inline_alloc_cost : Int_arg_helper.parsed ref
    val inline_prim_cost : Int_arg_helper.parsed ref
    val inline_branch_cost : Int_arg_helper.parsed ref
    val inline_indirect_cost : Int_arg_helper.parsed ref
    val inline_lifting_benefit : Int_arg_helper.parsed ref
    val default_inline_branch_factor : float
    val inline_branch_factor : Float_arg_helper.parsed ref
    val dont_write_files : bool ref
    val std_include_flag : string -> string
    val std_include_dir : unit -> string list
    val shared : bool ref
    val dlcode : bool ref
    val pic_code : bool ref
    val runtime_variant : string ref
    val with_runtime : bool ref
    val force_slash : bool ref
    val keep_docs : bool ref
    val keep_locs : bool ref
    val opaque : bool ref
    val profile_columns : Profile.column list ref
    val flambda_invariant_checks : bool ref
    val unbox_closures : bool ref
    val unbox_closures_factor : int ref
    val default_unbox_closures_factor : int
    val unbox_free_vars_of_closures : bool ref
    val unbox_specialised_args : bool ref
    val clambda_checks : bool ref
    val cmm_invariants : bool ref
    val default_inline_max_depth : int
    val inline_max_depth : Int_arg_helper.parsed ref
    val remove_unused_arguments : bool ref
    val dump_flambda_verbose : bool ref
    val classic_inlining : bool ref
    val afl_instrument : bool ref
    val afl_inst_ratio : int ref
    val function_sections : bool ref
    val all_passes : string list ref
    val dumped_pass : string -> bool
    val set_dumped_pass : string -> bool -> unit
    val dump_into_file : bool ref
    val dump_dir : string option ref
    val keyword_edition : string option ref
    val parse_keyword_edition : string -> (int * int) option * string list
    type 'a env_reader = {
    1. parse : string -> 'a option;
    2. print : 'a -> string;
    3. usage : string;
    4. env_var : string;
    }
    val color : Misc.Color.setting option ref
    val color_reader : Misc.Color.setting env_reader
    val error_style : Misc.Error_style.setting option ref
    val error_style_reader : Misc.Error_style.setting env_reader
    val unboxed_types : bool ref
    val insn_sched : bool ref
    val insn_sched_default : bool
    module Compiler_pass : sig ... end
    val stop_after : Compiler_pass.t option ref
    val should_stop_after : Compiler_pass.t -> bool
    val set_save_ir_after : Compiler_pass.t -> bool -> unit
    val should_save_ir_after : Compiler_pass.t -> bool
    val arg_spec : (string * Stdlib.Arg.spec * string) list ref
    val add_arguments : string -> (string * Stdlib.Arg.spec * string) list -> unit
    val create_usage_msg : string -> string
    val print_arguments : string -> unit
    val reset_arguments : unit -> unit
    diff --git a/ocaml/Cmi_format/index.html b/ocaml/Cmi_format/index.html index 9ece0e72..aa96f0d4 100644 --- a/ocaml/Cmi_format/index.html +++ b/ocaml/Cmi_format/index.html @@ -1,2 +1,2 @@ -Cmi_format (ocaml.Cmi_format)

    Module Cmi_format

    type pers_flags =
    1. | Rectypes
    2. | Alerts of Misc.alerts
    3. | Opaque
    type cmi_infos = {
    1. cmi_name : Misc.modname;
    2. cmi_sign : Types.signature_item list;
    3. cmi_crcs : Misc.crcs;
    4. cmi_flags : pers_flags list;
    }
    val output_cmi : string -> out_channel -> cmi_infos -> Stdlib.Digest.t
    val input_cmi : in_channel -> cmi_infos
    val read_cmi : string -> cmi_infos
    type error =
    1. | Not_an_interface of Misc.filepath
    2. | Wrong_version_interface of Misc.filepath * string
    3. | Corrupted_interface of Misc.filepath
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    +Cmi_format (ocaml.Cmi_format)

    Module Cmi_format

    type pers_flags =
    1. | Rectypes
    2. | Alerts of Misc.alerts
    3. | Opaque
    type cmi_infos = {
    1. cmi_name : Misc.modname;
    2. cmi_sign : Types.signature_item list;
    3. cmi_crcs : Misc.crcs;
    4. cmi_flags : pers_flags list;
    }
    val output_cmi : string -> out_channel -> cmi_infos -> Stdlib.Digest.t
    val input_cmi : in_channel -> cmi_infos
    val read_cmi : string -> cmi_infos
    type error =
    1. | Not_an_interface of Misc.filepath
    2. | Wrong_version_interface of Misc.filepath * string
    3. | Corrupted_interface of Misc.filepath
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Cmm/index.html b/ocaml/Cmm/index.html index e12eef08..ad2c52bd 100644 --- a/ocaml/Cmm/index.html +++ b/ocaml/Cmm/index.html @@ -2,7 +2,7 @@ Cmm (ocaml.Cmm)

    Module Cmm

    type machtype_component =
    1. | Val
    2. | Addr
    3. | Int
    4. | Float
    type machtype = machtype_component array
    val typ_void : machtype
    val typ_val : machtype
    val typ_addr : machtype
    val typ_int : machtype
    val typ_float : machtype

    Least upper bound of two machtype_components.

    val ge_component : machtype_component -> machtype_component -> bool

    Returns true iff the first supplied machtype_component is greater than or equal to the second under the relation used by lub_component.

    type exttype =
    1. | XInt
      (*

      r OCaml value, word-sized integer

      *)
    2. | XInt32
      (*

      r 32-bit integer

      *)
    3. | XInt64
      (*

      r 64-bit integer

      *)
    4. | XFloat
      (*

      r double-precision FP number

      *)

    A variant of machtype used to describe arguments to external C functions

    val machtype_of_exttype : exttype -> machtype
    val machtype_of_exttype_list : exttype list -> machtype
    type integer_comparison = Lambda.integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    val negate_integer_comparison : integer_comparison -> integer_comparison
    val swap_integer_comparison : integer_comparison -> integer_comparison
    type float_comparison = Lambda.float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    val negate_float_comparison : float_comparison -> float_comparison
    val swap_float_comparison : float_comparison -> float_comparison
    type label = int
    val new_label : unit -> label
    val set_label : label -> unit
    val cur_label : unit -> label
    type rec_flag =
    1. | Nonrecursive
    2. | Recursive
    type phantom_defining_expr =
    1. | Cphantom_const_int of Targetint.t
      (*

      The phantom-let-bound variable is a constant integer. The argument must be the tagged representation of an integer within the range of type int on the target. (Analogously to Cconst_int.)

      *)
    2. | Cphantom_const_symbol of string
      (*

      The phantom-let-bound variable is an alias for a symbol.

      *)
    3. | Cphantom_var of Backend_var.t
      (*

      The phantom-let-bound variable is an alias for another variable. The aliased variable must not be a bound by a phantom let.

      *)
    4. | Cphantom_offset_var of {
      1. var : Backend_var.t;
      2. offset_in_words : int;
      }
      (*

      The phantom-let-bound-variable's value is defined by adding the given number of words to the pointer contained in the given identifier.

      *)
    5. | Cphantom_read_field of {
      1. var : Backend_var.t;
      2. field : int;
      }
      (*

      The phantom-let-bound-variable's value is found by adding the given number of words to the pointer contained in the given identifier, then dereferencing.

      *)
    6. | Cphantom_read_symbol_field of {
      1. sym : string;
      2. field : int;
      }
      (*

      As for Uphantom_read_var_field, but with the pointer specified by a symbol.

      *)
    7. | Cphantom_block of {
      1. tag : int;
      2. fields : Backend_var.t list;
      }
      (*

      The phantom-let-bound variable points at a block with the given structure.

      *)
    type memory_chunk =
    1. | Byte_unsigned
    2. | Byte_signed
    3. | Sixteen_unsigned
    4. | Sixteen_signed
    5. | Thirtytwo_unsigned
    6. | Thirtytwo_signed
    7. | Word_int
    8. | Word_val
    9. | Single
    10. | Double
    and operation =
    1. | Capply of machtype
    2. | Cextcall of string * machtype * exttype list * bool
      (*

      The machtype is the machine type of the result. The exttype list describes the unboxing types of the arguments. An empty list means "all arguments are machine words XInt". The boolean indicates whether the function may allocate.

      *)
    3. | Cload of {
      1. memory_chunk : memory_chunk;
      2. mutability : Asttypes.mutable_flag;
      3. is_atomic : bool;
      }
    4. | Calloc
    5. | Cstore of memory_chunk * Lambda.initialization_or_assignment
    6. | Caddi
    7. | Csubi
    8. | Cmuli
    9. | Cmulhi
    10. | Cdivi
    11. | Cmodi
    12. | Cand
    13. | Cor
    14. | Cxor
    15. | Clsl
    16. | Clsr
    17. | Casr
    18. | Ccmpi of integer_comparison
    19. | Caddv
    20. | Cadda
    21. | Ccmpa of integer_comparison
    22. | Cnegf
    23. | Cabsf
    24. | Caddf
    25. | Csubf
    26. | Cmulf
    27. | Cdivf
    28. | Cfloatofint
    29. | Cintoffloat
    30. | Ccmpf of float_comparison
    31. | Craise of Lambda.raise_kind
    32. | Ccheckbound
    33. | Copaque
    34. | Cdls_get
    and expression =
    1. | Cconst_int of int * Debuginfo.t
    2. | Cconst_natint of nativeint * Debuginfo.t
    3. | Cconst_float of float * Debuginfo.t
    4. | Cconst_symbol of string * Debuginfo.t
    5. | Cvar of Backend_var.t
    6. | Clet of Backend_var.With_provenance.t * expression * expression
    7. | Clet_mut of Backend_var.With_provenance.t * machtype * expression * expression
    8. | Cphantom_let of Backend_var.With_provenance.t + machtype_component

    Least upper bound of two machtype_components.

    val ge_component : machtype_component -> machtype_component -> bool

    Returns true iff the first supplied machtype_component is greater than or equal to the second under the relation used by lub_component.

    type exttype =
    1. | XInt
      (*

      r OCaml value, word-sized integer

      *)
    2. | XInt32
      (*

      r 32-bit integer

      *)
    3. | XInt64
      (*

      r 64-bit integer

      *)
    4. | XFloat
      (*

      r double-precision FP number

      *)

    A variant of machtype used to describe arguments to external C functions

    val machtype_of_exttype : exttype -> machtype
    val machtype_of_exttype_list : exttype list -> machtype
    type integer_comparison = Lambda.integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    val negate_integer_comparison : integer_comparison -> integer_comparison
    val swap_integer_comparison : integer_comparison -> integer_comparison
    type float_comparison = Lambda.float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    val negate_float_comparison : float_comparison -> float_comparison
    val swap_float_comparison : float_comparison -> float_comparison
    type label = int
    val new_label : unit -> label
    val set_label : label -> unit
    val cur_label : unit -> label
    type rec_flag =
    1. | Nonrecursive
    2. | Recursive
    type phantom_defining_expr =
    1. | Cphantom_const_int of Targetint.t
      (*

      The phantom-let-bound variable is a constant integer. The argument must be the tagged representation of an integer within the range of type int on the target. (Analogously to Cconst_int.)

      *)
    2. | Cphantom_const_symbol of string
      (*

      The phantom-let-bound variable is an alias for a symbol.

      *)
    3. | Cphantom_var of Backend_var.t
      (*

      The phantom-let-bound variable is an alias for another variable. The aliased variable must not be a bound by a phantom let.

      *)
    4. | Cphantom_offset_var of {
      1. var : Backend_var.t;
      2. offset_in_words : int;
      }
      (*

      The phantom-let-bound-variable's value is defined by adding the given number of words to the pointer contained in the given identifier.

      *)
    5. | Cphantom_read_field of {
      1. var : Backend_var.t;
      2. field : int;
      }
      (*

      The phantom-let-bound-variable's value is found by adding the given number of words to the pointer contained in the given identifier, then dereferencing.

      *)
    6. | Cphantom_read_symbol_field of {
      1. sym : string;
      2. field : int;
      }
      (*

      As for Uphantom_read_var_field, but with the pointer specified by a symbol.

      *)
    7. | Cphantom_block of {
      1. tag : int;
      2. fields : Backend_var.t list;
      }
      (*

      The phantom-let-bound variable points at a block with the given structure.

      *)
    type memory_chunk =
    1. | Byte_unsigned
    2. | Byte_signed
    3. | Sixteen_unsigned
    4. | Sixteen_signed
    5. | Thirtytwo_unsigned
    6. | Thirtytwo_signed
    7. | Word_int
    8. | Word_val
    9. | Single
    10. | Double
    and operation =
    1. | Capply of machtype
    2. | Cextcall of string * machtype * exttype list * bool
      (*

      The machtype is the machine type of the result. The exttype list describes the unboxing types of the arguments. An empty list means "all arguments are machine words XInt". The boolean indicates whether the function may allocate.

      *)
    3. | Cload of {
      1. memory_chunk : memory_chunk;
      2. mutability : Asttypes.mutable_flag;
      3. is_atomic : bool;
      }
    4. | Calloc
    5. | Cstore of memory_chunk * Lambda.initialization_or_assignment
    6. | Caddi
    7. | Csubi
    8. | Cmuli
    9. | Cmulhi
    10. | Cdivi
    11. | Cmodi
    12. | Cand
    13. | Cor
    14. | Cxor
    15. | Clsl
    16. | Clsr
    17. | Casr
    18. | Ccmpi of integer_comparison
    19. | Caddv
    20. | Cadda
    21. | Ccmpa of integer_comparison
    22. | Cnegf
    23. | Cabsf
    24. | Caddf
    25. | Csubf
    26. | Cmulf
    27. | Cdivf
    28. | Cfloatofint
    29. | Cintoffloat
    30. | Ccmpf of float_comparison
    31. | Craise of Lambda.raise_kind
    32. | Ccheckbound
    33. | Copaque
    34. | Cdls_get
    35. | Cpoll
    and expression =
    1. | Cconst_int of int * Debuginfo.t
    2. | Cconst_natint of nativeint * Debuginfo.t
    3. | Cconst_float of float * Debuginfo.t
    4. | Cconst_symbol of string * Debuginfo.t
    5. | Cvar of Backend_var.t
    6. | Clet of Backend_var.With_provenance.t * expression * expression
    7. | Clet_mut of Backend_var.With_provenance.t * machtype * expression * expression
    8. | Cphantom_let of Backend_var.With_provenance.t * phantom_defining_expr option * expression
    9. | Cassign of Backend_var.t * expression
    10. | Ctuple of expression list
    11. | Cop of operation * expression list * Debuginfo.t
    12. | Csequence of expression * expression
    13. | Cifthenelse of expression * Debuginfo.t @@ -21,7 +21,7 @@ * expression
    14. | Cexit of int * expression list
    15. | Ctrywith of expression * Backend_var.With_provenance.t * expression - * Debuginfo.t

    Every basic block should have a corresponding Debuginfo.t for its beginning.

    type codegen_option =
    1. | Reduce_code_size
    2. | No_CSE
    type fundecl = {
    1. fun_name : string;
    2. fun_args : (Backend_var.With_provenance.t * machtype) list;
    3. fun_body : expression;
    4. fun_codegen_options : codegen_option list;
    5. fun_poll : Lambda.poll_attribute;
    6. fun_dbg : Debuginfo.t;
    }
    type data_item =
    1. | Cdefine_symbol of string
    2. | Cglobal_symbol of string
    3. | Cint8 of int
    4. | Cint16 of int
    5. | Cint32 of nativeint
    6. | Cint of nativeint
    7. | Csingle of float
    8. | Cdouble of float
    9. | Csymbol_address of string
    10. | Cstring of string
    11. | Cskip of int
    12. | Calign of int
    type phrase =
    1. | Cfunction of fundecl
    2. | Cdata of data_item list
    val ccatch : + * Debuginfo.t
  • | Creturn_addr
    (*

    Return address saved in the current call frame

    *)
  • Every basic block should have a corresponding Debuginfo.t for its beginning.

    type codegen_option =
    1. | Reduce_code_size
    2. | No_CSE
    type fundecl = {
    1. fun_name : string;
    2. fun_args : (Backend_var.With_provenance.t * machtype) list;
    3. fun_body : expression;
    4. fun_codegen_options : codegen_option list;
    5. fun_poll : Lambda.poll_attribute;
    6. fun_dbg : Debuginfo.t;
    }
    type data_item =
    1. | Cdefine_symbol of string
    2. | Cglobal_symbol of string
    3. | Cint8 of int
    4. | Cint16 of int
    5. | Cint32 of nativeint
    6. | Cint of nativeint
    7. | Csingle of float
    8. | Cdouble of float
    9. | Csymbol_address of string
    10. | Cstring of string
    11. | Cskip of int
    12. | Calign of int
    type phrase =
    1. | Cfunction of fundecl
    2. | Cdata of data_item list
    val ccatch : (int * (Backend_var.With_provenance.t * machtype) list * expression diff --git a/ocaml/Cmm_helpers/index.html b/ocaml/Cmm_helpers/index.html index c1f16fda..f882965d 100644 --- a/ocaml/Cmm_helpers/index.html +++ b/ocaml/Cmm_helpers/index.html @@ -52,7 +52,7 @@ Debuginfo.t -> Cmm.expression -> Cmm.expression -> - Cmm.expression
    val create_loop : Cmm.expression -> Debuginfo.t -> Cmm.expression

    Loop construction (while true do expr done). Used to be represented as Cloop.

    val raise_symbol : Debuginfo.t -> string -> Cmm.expression

    Exception raising

    Convert a tagged integer into a raw integer with boolean meaning

    Float boxing and unboxing

    val unbox_float : Debuginfo.t -> Cmm.expression -> Cmm.expression
    val box_complex : + Cmm.expression
    val create_loop : Cmm.expression -> Debuginfo.t -> Cmm.expression

    Loop construction (while true do expr done). Used to be represented as Cloop.

    val raise_symbol : Debuginfo.t -> string -> Cmm.expression

    Exception raising

    Convert a tagged integer into a raw integer with boolean meaning

    Float boxing and unboxing

    val unbox_float : Debuginfo.t -> Cmm.expression -> Cmm.expression
    val float_of_float16 : Debuginfo.t -> Cmm.expression -> Cmm.expression

    Conversions for 16-bit floats

    val float16_of_float : Debuginfo.t -> Cmm.expression -> Cmm.expression
    val box_complex : Debuginfo.t -> Cmm.expression -> Cmm.expression -> diff --git a/ocaml/Cmo_format/index.html b/ocaml/Cmo_format/index.html index f6dd7ad3..ae8ccd3c 100644 --- a/ocaml/Cmo_format/index.html +++ b/ocaml/Cmo_format/index.html @@ -1,2 +1,2 @@ -Cmo_format (ocaml.Cmo_format)

    Module Cmo_format

    type reloc_info =
    1. | Reloc_literal of Stdlib.Obj.t
    2. | Reloc_getglobal of Ident.t
    3. | Reloc_setglobal of Ident.t
    4. | Reloc_primitive of string
    type compilation_unit = {
    1. cu_name : Misc.modname;
    2. mutable cu_pos : int;
    3. cu_codesize : int;
    4. cu_reloc : (reloc_info * int) list;
    5. cu_imports : Misc.crcs;
    6. cu_required_globals : Ident.t list;
    7. cu_primitives : string list;
    8. mutable cu_debug : int;
    9. cu_debugsize : int;
    }
    type library = {
    1. lib_units : compilation_unit list;
    2. lib_custom : bool;
    3. lib_ccobjs : string list;
    4. lib_ccopts : string list;
    5. lib_dllibs : string list;
    }
    +Cmo_format (ocaml.Cmo_format)

    Module Cmo_format

    type modname = string
    type crcs = (modname * Stdlib.Digest.t option) list
    type compunit =
    1. | Compunit of string
    type predef =
    1. | Predef_exn of string
    type reloc_info =
    1. | Reloc_literal of Stdlib.Obj.t
    2. | Reloc_getcompunit of compunit
    3. | Reloc_getpredef of predef
    4. | Reloc_setcompunit of compunit
    5. | Reloc_primitive of string
    type compilation_unit = {
    1. cu_name : compunit;
    2. mutable cu_pos : int;
    3. cu_codesize : int;
    4. cu_reloc : (reloc_info * int) list;
    5. cu_imports : crcs;
    6. cu_required_compunits : compunit list;
    7. cu_primitives : string list;
    8. mutable cu_debug : int;
    9. cu_debugsize : int;
    }
    type library = {
    1. lib_units : compilation_unit list;
    2. lib_custom : bool;
    3. lib_ccobjs : string list;
    4. lib_ccopts : string list;
    5. lib_dllibs : string list;
    }
    diff --git a/ocaml/Cmt2annot/index.html b/ocaml/Cmt2annot/index.html index 32edb19d..1c64211d 100644 --- a/ocaml/Cmt2annot/index.html +++ b/ocaml/Cmt2annot/index.html @@ -4,4 +4,4 @@ sourcefile:string option -> use_summaries:bool -> Cmt_format.binary_annots -> - unit
    + unit
    val iterator : scope:Location.t -> bool -> Tast_iterator.iterator
    val binary_part : Tast_iterator.iterator -> Cmt_format.binary_part -> unit
    diff --git a/ocaml/Cmt_format/index.html b/ocaml/Cmt_format/index.html index de8724b6..07cb9d82 100644 --- a/ocaml/Cmt_format/index.html +++ b/ocaml/Cmt_format/index.html @@ -1,15 +1,14 @@ Cmt_format (ocaml.Cmt_format)

    Module Cmt_format

    cmt and cmti files format.

    The layout of a cmt file is as follows: <cmt> := {<cmi>} <cmt magic> {cmt infos} {<source info>} where <cmi> is the cmi file format: <cmi> := <cmi magic> <cmi info>. More precisely, the optional <cmi> part must be present if and only if the file is:

    Thus, we provide a common reading function for cmi and cmt(i) files which returns an option for each of the three parts: cmi info, cmt info, source info.

    type binary_annots =
    1. | Packed of Types.signature * string list
    2. | Implementation of Typedtree.structure
    3. | Interface of Typedtree.signature
    4. | Partial_implementation of binary_part array
    5. | Partial_interface of binary_part array
    and binary_part =
    1. | Partial_structure of Typedtree.structure
    2. | Partial_structure_item of Typedtree.structure_item
    3. | Partial_expression of Typedtree.expression
    4. | Partial_pattern : 'k Typedtree.pattern_category - * 'k Typedtree.general_pattern -> binary_part
    5. | Partial_class_expr of Typedtree.class_expr
    6. | Partial_signature of Typedtree.signature
    7. | Partial_signature_item of Typedtree.signature_item
    8. | Partial_module_type of Typedtree.module_type
    type cmt_infos = {
    1. cmt_modname : Misc.modname;
    2. cmt_annots : binary_annots;
    3. cmt_value_dependencies : (Types.value_description * Types.value_description) - list;
    4. cmt_comments : (string * Location.t) list;
    5. cmt_args : string array;
    6. cmt_sourcefile : string option;
    7. cmt_builddir : string;
    8. cmt_loadpath : string list;
    9. cmt_source_digest : string option;
    10. cmt_initial_env : Env.t;
    11. cmt_imports : Misc.crcs;
    12. cmt_interface_digest : Stdlib.Digest.t option;
    13. cmt_use_summaries : bool;
    14. cmt_uid_to_loc : Location.t Shape.Uid.Tbl.t;
    15. cmt_impl_shape : Shape.t option;
    }
    type error =
    1. | Not_a_typedtree of string
    exception Error of error
    val read : string -> Cmi_format.cmi_infos option * cmt_infos option

    read filename opens filename, and extract both the cmi_infos, if it exists, and the cmt_infos, if it exists. Thus, it can be used with .cmi, .cmt and .cmti files.

    .cmti files always contain a cmi_infos at the beginning. .cmt files only contain a cmi_infos at the beginning if there is no associated .cmti file.

    val read_cmt : string -> cmt_infos
    val read_cmi : string -> Cmi_format.cmi_infos
    val save_cmt : - string -> - string -> + * 'k Typedtree.general_pattern -> binary_part
  • | Partial_class_expr of Typedtree.class_expr
  • | Partial_signature of Typedtree.signature
  • | Partial_signature_item of Typedtree.signature_item
  • | Partial_module_type of Typedtree.module_type
  • type dependency_kind =
    1. | Definition_to_declaration
    2. | Declaration_to_declaration
    type cmt_infos = {
    1. cmt_modname : Misc.modname;
    2. cmt_annots : binary_annots;
    3. cmt_declaration_dependencies : (dependency_kind + * Typedtree.Uid.t + * Typedtree.Uid.t) + list;
    4. cmt_comments : (string * Location.t) list;
    5. cmt_args : string array;
    6. cmt_sourcefile : string option;
    7. cmt_builddir : string;
    8. cmt_loadpath : Load_path.paths;
    9. cmt_source_digest : string option;
    10. cmt_initial_env : Env.t;
    11. cmt_imports : Misc.crcs;
    12. cmt_interface_digest : Stdlib.Digest.t option;
    13. cmt_use_summaries : bool;
    14. cmt_uid_to_decl : Typedtree.item_declaration Shape.Uid.Tbl.t;
    15. cmt_impl_shape : Shape.t option;
    16. cmt_ident_occurrences : (Longident.t Location.loc * Shape_reduce.result) list;
    }
    type error =
    1. | Not_a_typedtree of string
    exception Error of error
    val read : string -> Cmi_format.cmi_infos option * cmt_infos option

    read filename opens filename, and extract both the cmi_infos, if it exists, and the cmt_infos, if it exists. Thus, it can be used with .cmi, .cmt and .cmti files.

    .cmti files always contain a cmi_infos at the beginning. .cmt files only contain a cmi_infos at the beginning if there is no associated .cmti file.

    val read_cmt : string -> cmt_infos
    val read_cmi : string -> Cmi_format.cmi_infos
    val save_cmt : + Unit_info.Artifact.t -> binary_annots -> - string option -> Env.t -> Cmi_format.cmi_infos option -> Shape.t option -> - unit

    save_cmt filename modname binary_annots sourcefile initial_env cmi writes a cmt(i) file.

    val read_magic_number : in_channel -> string
    val clear : unit -> unit
    val add_saved_type : binary_part -> unit
    val get_saved_types : unit -> binary_part list
    val set_saved_types : binary_part list -> unit
    val record_value_dependency : - Types.value_description -> - Types.value_description -> + unit

    save_cmt filename modname binary_annots sourcefile initial_env cmi writes a cmt(i) file.

    val read_magic_number : in_channel -> string
    val clear : unit -> unit
    val add_saved_type : binary_part -> unit
    val get_saved_types : unit -> binary_part list
    val set_saved_types : binary_part list -> unit
    val record_declaration_dependency : + (dependency_kind * Typedtree.Uid.t * Typedtree.Uid.t) -> unit
    diff --git a/ocaml/Compenv/index.html b/ocaml/Compenv/index.html index d22c909e..a37f87d3 100644 --- a/ocaml/Compenv/index.html +++ b/ocaml/Compenv/index.html @@ -1,5 +1,5 @@ -Compenv (ocaml.Compenv)

    Module Compenv

    exception Exit_with_status of int
    val module_of_filename : string -> string -> string
    val output_prefix : string -> string
    val extract_output : string option -> string
    val default_output : string option -> string
    val print_version_and_library : string -> 'a
    val print_version_string : unit -> 'a
    val print_standard_library : unit -> 'a
    val fatal : string -> 'a
    val first_ccopts : string list ref
    val first_ppx : string list ref
    val first_include_dirs : string list ref
    val last_include_dirs : string list ref
    val get_objfiles : with_ocamlparam:bool -> string list
    val last_objfiles : string list ref
    val first_objfiles : string list ref
    val stop_early : bool ref
    val has_linker_inputs : bool ref
    type filename = string
    type readenv_position =
    1. | Before_args
    2. | Before_compile of filename
    val readenv : Stdlib.Format.formatter -> readenv_position -> unit
    val is_unit_name : string -> bool
    val check_unit_name : string -> string -> unit
    type deferred_action =
    1. | ProcessImplementation of string
    2. | ProcessInterface of string
    3. | ProcessCFile of string
    4. | ProcessOtherFile of string
    5. | ProcessObjects of string list
    6. | ProcessDLLs of string list
    val c_object_of_filename : string -> string
    val defer : deferred_action -> unit
    val anonymous : string -> unit
    val impl : string -> unit
    val intf : string -> unit
    val process_deferred_actions : +Compenv (ocaml.Compenv)

    Module Compenv

    exception Exit_with_status of int
    val output_prefix : string -> string
    val extract_output : string option -> string
    val default_output : string option -> string
    val print_version_and_library : string -> 'a
    val print_version_string : unit -> 'a
    val print_standard_library : unit -> 'a
    val fatal : string -> 'a
    val first_ccopts : string list ref
    val first_ppx : string list ref
    val first_include_dirs : string list ref
    val last_include_dirs : string list ref
    val get_objfiles : with_ocamlparam:bool -> string list
    val last_objfiles : string list ref
    val first_objfiles : string list ref
    val stop_early : bool ref
    val has_linker_inputs : bool ref
    type filename = string
    type readenv_position =
    1. | Before_args
    2. | Before_compile of filename
    val readenv : Stdlib.Format.formatter -> readenv_position -> unit
    type deferred_action =
    1. | ProcessImplementation of string
    2. | ProcessInterface of string
    3. | ProcessCFile of string
    4. | ProcessOtherFile of string
    5. | ProcessObjects of string list
    6. | ProcessDLLs of string list
    val c_object_of_filename : string -> string
    val defer : deferred_action -> unit
    val anonymous : string -> unit
    val impl : string -> unit
    val intf : string -> unit
    val process_deferred_actions : (Stdlib.Format.formatter * (start_from:Clflags.Compiler_pass.t -> source_file:string -> diff --git a/ocaml/Compile_common/index.html b/ocaml/Compile_common/index.html index 077eeefa..8a3b975d 100644 --- a/ocaml/Compile_common/index.html +++ b/ocaml/Compile_common/index.html @@ -1,12 +1,14 @@ -Compile_common (ocaml.Compile_common)

    Module Compile_common

    Common compilation pipeline between bytecode and native.

    Initialization

    type info = {
    1. source_file : string;
    2. module_name : string;
    3. output_prefix : string;
    4. env : Env.t;
    5. ppf_dump : Stdlib.Format.formatter;
    6. tool_name : string;
    7. native : bool;
    }

    Information needed to compile a file.

    val with_info : +Compile_common (ocaml.Compile_common)

    Module Compile_common

    Common compilation pipeline between bytecode and native.

    Initialization

    type info = {
    1. target : Unit_info.t;
    2. env : Env.t;
    3. ppf_dump : Stdlib.Format.formatter;
    4. tool_name : string;
    5. native : bool;
    }

    Information needed to compile a file.

    val with_info : native:bool -> tool_name:string -> - source_file:string -> - output_prefix:string -> dump_ext:string -> + Unit_info.t -> (info -> 'a) -> - 'a

    with_info ~native ~tool_name ~source_file ~output_prefix ~dump_ext k invokes its continuation k with an info structure built from its input, after initializing various global variables. This info structure and the initialized global state are not valid anymore after the continuation returns.

    Due to current implementation limitations in the compiler, it is unsafe to try to compile several distinct compilation units by calling with_info several times.

    Interfaces

    val parse_intf : info -> Parsetree.signature

    parse_intf info parses an interface (usually an .mli file).

    val typecheck_intf : info -> Parsetree.signature -> Typedtree.signature

    typecheck_intf info parsetree typechecks an interface and returns the typedtree of the associated signature.

    val emit_signature : info -> Parsetree.signature -> Typedtree.signature -> unit

    emit_signature info parsetree typedtree emits the .cmi file containing the given signature.

    val interface : info -> unit

    The complete compilation pipeline for interfaces.

    Implementations

    val parse_impl : info -> Parsetree.structure

    parse_impl info parses an implementation (usually an .ml file).

    typecheck_impl info parsetree typechecks an implementation and returns the typedtree of the associated module, its public interface, and a coercion against that public interface.

    val implementation : + 'a

    with_info ~native ~tool_name ~dump_ext unit_info k invokes its continuation k with an info structure passed as input, after initializing various global variables. This info structure and the initialized global state are not valid anymore after the continuation returns.

    Due to current implementation limitations in the compiler, it is unsafe to try to compile several distinct compilation units by calling with_info several times.

    Interfaces

    val parse_intf : info -> Parsetree.signature

    parse_intf info parses an interface (usually an .mli file).

    val typecheck_intf : + info -> + Parsetree.signature -> + Misc.alerts * Typedtree.signature

    typecheck_intf info parsetree typechecks an interface and returns the typedtree of the associated signature.

    val emit_signature : info -> Misc.alerts -> Typedtree.signature -> unit

    emit_signature info parsetree typedtree emits the .cmi file containing the given signature.

    val interface : info -> unit

    The complete compilation pipeline for interfaces.

    Implementations

    val parse_impl : info -> Parsetree.structure

    parse_impl info parses an implementation (usually an .ml file).

    typecheck_impl info parsetree typechecks an implementation and returns the typedtree of the associated module, its public interface, and a coercion against that public interface.

    val implementation : info -> backend:(info -> Typedtree.implementation -> unit) -> - unit

    The complete compilation pipeline for implementations.

    Build artifacts

    val cmo : info -> string
    val cmx : info -> string
    val obj : info -> string
    val annot : info -> string

    Return the filename of some compiler build artifacts associated with the file being compiled.

    + unit

    The complete compilation pipeline for implementations.

    diff --git a/ocaml/Compilenv/index.html b/ocaml/Compilenv/index.html index 294631c1..fa809a15 100644 --- a/ocaml/Compilenv/index.html +++ b/ocaml/Compilenv/index.html @@ -1,8 +1,8 @@ Compilenv (ocaml.Compilenv)

    Module Compilenv

    val imported_sets_of_closures_table : - Simple_value_approx.function_declarations option Set_of_closures_id.Tbl.t
    val reset : ?packname:string -> string -> unit
    val unit_id_from_name : string -> Ident.t
    val current_unit_infos : unit -> Cmx_format.unit_infos
    val current_unit_name : unit -> string
    val current_unit_linkage_name : unit -> Linkage_name.t
    val current_unit : unit -> Compilation_unit.t
    val current_unit_symbol : unit -> Symbol.t
    val make_symbol : ?unitname:string -> string option -> string
    val symbol_in_current_unit : string -> bool
    val is_predefined_exception : Symbol.t -> bool
    val unit_for_global : Ident.t -> Compilation_unit.t
    val symbol_for_global : Ident.t -> string
    val symbol_for_global' : Ident.t -> Symbol.t
    val global_approx : Ident.t -> Clambda.value_approximation
    val set_global_approx : Clambda.value_approximation -> unit
    val record_global_approx_toplevel : unit -> unit
    val set_export_info : Export_info.t -> unit
    val approx_env : unit -> Export_info.t
    val approx_for_global : Compilation_unit.t -> Export_info.t option
    val need_curry_fun : int -> unit
    val need_apply_fun : int -> unit
    val need_send_fun : int -> unit
    val new_const_symbol : unit -> string
    val closure_symbol : Closure_id.t -> Symbol.t
    val function_label : Closure_id.t -> string
    val reset : ?packname:string -> string -> unit
    val unit_id_from_name : string -> Ident.t
    val current_unit_infos : unit -> Cmx_format.unit_infos
    val current_unit_name : unit -> string
    val current_unit_linkage_name : unit -> Linkage_name.t
    val current_unit : unit -> Compilation_unit.t
    val current_unit_symbol : unit -> Symbol.t
    val symbol_separator : char
    val make_symbol : ?unitname:string -> string option -> string
    val symbol_in_current_unit : string -> bool
    val is_predefined_exception : Symbol.t -> bool
    val unit_for_global : Ident.t -> Compilation_unit.t
    val symbol_for_global : Ident.t -> string
    val symbol_for_global' : Ident.t -> Symbol.t
    val global_approx : Ident.t -> Clambda.value_approximation
    val set_global_approx : Clambda.value_approximation -> unit
    val record_global_approx_toplevel : unit -> unit
    val set_export_info : Export_info.t -> unit
    val approx_env : unit -> Export_info.t
    val approx_for_global : Compilation_unit.t -> Export_info.t option
    val need_curry_fun : int -> unit
    val need_apply_fun : int -> unit
    val need_send_fun : int -> unit
    val new_const_symbol : unit -> string
    val closure_symbol : Closure_id.t -> Symbol.t
    val function_label : Closure_id.t -> string
    val new_structured_constant : Clambda.ustructured_constant -> shared:bool -> string
    val structured_constants : unit -> Clambda.preallocated_constant list
    val clear_structured_constants : unit -> unit
    val structured_constant_of_symbol : string -> - Clambda.ustructured_constant option
    val add_exported_constant : string -> unit
    type structured_constants
    val snapshot : unit -> structured_constants
    val backtrack : structured_constants -> unit
    val read_unit_info : string -> Cmx_format.unit_infos * Stdlib.Digest.t
    val write_unit_info : Cmx_format.unit_infos -> string -> unit
    val save_unit_info : string -> unit
    val cache_unit_info : Cmx_format.unit_infos -> unit
    val require_global : Ident.t -> unit
    val read_library_info : string -> Cmx_format.library_infos
    type error =
    1. | Not_a_unit_info of string
    2. | Corrupted_unit_info of string
    3. | Illegal_renaming of string * string * string
    4. | Mismatching_for_pack of string * string * string * string option
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    + Clambda.ustructured_constant option
    val add_exported_constant : string -> unit
    type structured_constants
    val snapshot : unit -> structured_constants
    val backtrack : structured_constants -> unit
    val read_unit_info : string -> Cmx_format.unit_infos * Stdlib.Digest.t
    val write_unit_info : Cmx_format.unit_infos -> string -> unit
    val save_unit_info : string -> unit
    val cache_unit_info : Cmx_format.unit_infos -> unit
    val require_global : Ident.t -> unit
    val read_library_info : string -> Cmx_format.library_infos
    type error =
    1. | Not_a_unit_info of string
    2. | Corrupted_unit_info of string
    3. | Illegal_renaming of string * string * string
    4. | Mismatching_for_pack of string * string * string * string option
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Config/index.html b/ocaml/Config/index.html index de0dcabb..813bbde1 100644 --- a/ocaml/Config/index.html +++ b/ocaml/Config/index.html @@ -1,2 +1,2 @@ -Config (ocaml.Config)

    Module Config

    System configuration

    Warning: this module is unstable and part of compiler-libs.

    val version : string

    The current version number of the system

    val bindir : string

    The directory containing the binary programs

    val standard_library : string

    The directory containing the standard libraries

    val ccomp_type : string

    The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

    val c_compiler : string

    The compiler to use for compiling C files

    val c_output_obj : string

    Name of the option of the C compiler for specifying the output file

    val c_has_debug_prefix_map : bool

    Whether the C compiler supports -fdebug-prefix-map

    val as_has_debug_prefix_map : bool

    Whether the assembler supports --debug-prefix-map

    val ocamlc_cflags : string

    The flags ocamlc should pass to the C compiler

    val ocamlc_cppflags : string

    The flags ocamlc should pass to the C preprocessor

    val ocamlopt_cflags : string
    • deprecated

      ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

    val ocamlopt_cppflags : string
    • deprecated

      ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

    val bytecomp_c_libraries : string

    The C libraries to link with custom runtimes

    val native_c_libraries : string

    The C libraries to link with native-code programs

    val native_pack_linker : string

    The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

    val mkdll : string

    The linker command line to build dynamic libraries.

    val mkexe : string

    The linker command line to build executables.

    val mkmaindll : string

    The linker command line to build main programs as dlls.

    val default_rpath : string

    Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

    val mksharedlibrpath : string

    Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

    val ar : string

    Name of the ar command, or "" if not needed (MSVC)

    val interface_suffix : string ref

    Suffix for interface file names

    val exec_magic_number : string

    Magic number for bytecode executable files

    val cmi_magic_number : string

    Magic number for compiled interface files

    val cmo_magic_number : string

    Magic number for object bytecode files

    val cma_magic_number : string

    Magic number for archive files

    val cmx_magic_number : string

    Magic number for compilation unit descriptions

    val cmxa_magic_number : string

    Magic number for libraries of compilation unit descriptions

    val ast_intf_magic_number : string

    Magic number for file holding an interface syntax tree

    val ast_impl_magic_number : string

    Magic number for file holding an implementation syntax tree

    val cmxs_magic_number : string

    Magic number for dynamically-loadable plugins

    val cmt_magic_number : string

    Magic number for compiled interface files

    val linear_magic_number : string

    Magic number for Linear internal representation files

    val max_tag : int

    Biggest tag that can be stored in the header of a regular block.

    val lazy_tag : int

    Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

    val max_young_wosize : int

    Maximal size of arrays that are directly allocated in the minor heap

    val stack_threshold : int

    Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

    val stack_safety_margin : int

    Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

    val native_compiler : bool

    Whether the native compiler is available or not

    • since 5.1
    val architecture : string

    Name of processor type for the native-code compiler

    val model : string

    Name of processor submodel for the native-code compiler

    val system : string

    Name of operating system for the native-code compiler

    val asm : string

    The assembler (and flags) to use for assembling ocamlopt-generated code.

    val asm_cfi_supported : bool

    Whether assembler understands CFI directives

    val with_frame_pointers : bool

    Whether assembler should maintain frame pointers

    val ext_obj : string

    Extension for object files, e.g. .o under Unix.

    val ext_asm : string

    Extension for assembler files, e.g. .s under Unix.

    val ext_lib : string

    Extension for library files, e.g. .a under Unix.

    val ext_dll : string

    Extension for dynamically-loaded libraries, e.g. .so under Unix.

    val ext_exe : string

    Extension for executable programs, e.g. .exe under Windows.

    • since 4.12
    val default_executable_name : string

    Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

    val systhread_supported : bool

    Whether the system thread library is implemented

    val flexdll_dirs : string list

    Directories needed for the FlexDLL objects

    val host : string

    Whether the compiler is a cross-compiler

    val target : string

    Whether the compiler is a cross-compiler

    val flambda : bool

    Whether the compiler was configured for flambda

    val with_flambda_invariants : bool

    Whether the invariants checks for flambda are enabled

    val with_cmm_invariants : bool

    Whether the invariants checks for Cmm are enabled

    val reserved_header_bits : int

    How many bits of a block's header are reserved

    val flat_float_array : bool

    Whether the compiler and runtime automagically flatten float arrays

    val function_sections : bool

    Whether the compiler was configured to generate each function in a separate section

    val windows_unicode : bool

    Whether Windows Unicode runtime is enabled

    val naked_pointers : bool

    Whether the runtime supports naked pointers

    • since 4.14
    val supports_shared_libraries : bool

    Whether shared libraries are supported

    • since 4.08

    Whether native shared libraries are supported

    • since 5.1
    val afl_instrument : bool

    Whether afl-fuzz instrumentation is generated by default

    val ar_supports_response_files : bool

    Whether ar supports @FILE arguments.

    val print_config : out_channel -> unit

    Access to configuration values

    val config_var : string -> string option

    the configuration value of a variable, if it exists

    +Config (ocaml.Config)

    Module Config

    System configuration

    Warning: this module is unstable and part of compiler-libs.

    val version : string

    The current version number of the system

    val bindir : string

    The directory containing the binary programs

    val standard_library : string

    The directory containing the standard libraries

    val ccomp_type : string

    The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

    val c_compiler : string

    The compiler to use for compiling C files

    val c_output_obj : string

    Name of the option of the C compiler for specifying the output file

    val c_has_debug_prefix_map : bool

    Whether the C compiler supports -fdebug-prefix-map

    val as_has_debug_prefix_map : bool

    Whether the assembler supports --debug-prefix-map

    val bytecode_cflags : string

    The flags ocamlc should pass to the C compiler

    val bytecode_cppflags : string

    The flags ocamlc should pass to the C preprocessor

    val native_cflags : string

    The flags ocamlopt should pass to the C compiler

    val native_cppflags : string

    The flags ocamlopt should pass to the C preprocessor

    val bytecomp_c_libraries : string

    The C libraries to link with custom runtimes

    val native_c_libraries : string

    The C libraries to link with native-code programs

    val native_ldflags : string
    val native_pack_linker : string

    The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

    val mkdll : string

    The linker command line to build dynamic libraries.

    val mkexe : string

    The linker command line to build executables.

    val mkmaindll : string

    The linker command line to build main programs as dlls.

    val default_rpath : string

    Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

    val mksharedlibrpath : string

    Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

    val ar : string

    Name of the ar command, or "" if not needed (MSVC)

    val interface_suffix : string ref

    Suffix for interface file names

    val exec_magic_number : string

    Magic number for bytecode executable files

    val cmi_magic_number : string

    Magic number for compiled interface files

    val cmo_magic_number : string

    Magic number for object bytecode files

    val cma_magic_number : string

    Magic number for archive files

    val cmx_magic_number : string

    Magic number for compilation unit descriptions

    val cmxa_magic_number : string

    Magic number for libraries of compilation unit descriptions

    val ast_intf_magic_number : string

    Magic number for file holding an interface syntax tree

    val ast_impl_magic_number : string

    Magic number for file holding an implementation syntax tree

    val cmxs_magic_number : string

    Magic number for dynamically-loadable plugins

    val cmt_magic_number : string

    Magic number for compiled interface files

    val linear_magic_number : string

    Magic number for Linear internal representation files

    val max_tag : int

    Biggest tag that can be stored in the header of a regular block.

    val lazy_tag : int

    Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

    val max_young_wosize : int

    Maximal size of arrays that are directly allocated in the minor heap

    val stack_threshold : int

    Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

    val stack_safety_margin : int

    Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

    val native_compiler : bool

    Whether the native compiler is available or not

    • since 5.1
    val architecture : string

    Name of processor type for the native-code compiler

    val model : string

    Name of processor submodel for the native-code compiler

    val system : string

    Name of operating system for the native-code compiler

    val asm : string

    The assembler (and flags) to use for assembling ocamlopt-generated code.

    val asm_cfi_supported : bool

    Whether assembler understands CFI directives

    val with_frame_pointers : bool

    Whether assembler should maintain frame pointers

    val ext_obj : string

    Extension for object files, e.g. .o under Unix.

    val ext_asm : string

    Extension for assembler files, e.g. .s under Unix.

    val ext_lib : string

    Extension for library files, e.g. .a under Unix.

    val ext_dll : string

    Extension for dynamically-loaded libraries, e.g. .so under Unix.

    val ext_exe : string

    Extension for executable programs, e.g. .exe under Windows.

    • since 4.12
    val default_executable_name : string

    Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

    val systhread_supported : bool

    Whether the system thread library is implemented

    val flexdll_dirs : string list

    Directories needed for the FlexDLL objects

    val host : string

    Whether the compiler is a cross-compiler

    val target : string

    Whether the compiler is a cross-compiler

    val flambda : bool

    Whether the compiler was configured for flambda

    val with_flambda_invariants : bool

    Whether the invariants checks for flambda are enabled

    val with_cmm_invariants : bool

    Whether the invariants checks for Cmm are enabled

    val reserved_header_bits : int

    How many bits of a block's header are reserved

    val flat_float_array : bool

    Whether the compiler and runtime automagically flatten float arrays

    val function_sections : bool

    Whether the compiler was configured to generate each function in a separate section

    val windows_unicode : bool

    Whether Windows Unicode runtime is enabled

    val naked_pointers : bool

    Whether the runtime supports naked pointers

    • since 4.14
    val supports_shared_libraries : bool

    Whether shared libraries are supported

    • since 4.08

    Whether native shared libraries are supported

    • since 5.1
    val afl_instrument : bool

    Whether afl-fuzz instrumentation is generated by default

    val ar_supports_response_files : bool

    Whether ar supports @FILE arguments.

    val tsan : bool

    Whether ThreadSanitizer instrumentation is enabled

    val print_config : out_channel -> unit

    Access to configuration values

    val config_var : string -> string option

    the configuration value of a variable, if it exists

    diff --git a/ocaml/Config_boot/index.html b/ocaml/Config_boot/index.html index ba830c87..3c53aaea 100644 --- a/ocaml/Config_boot/index.html +++ b/ocaml/Config_boot/index.html @@ -1,2 +1,2 @@ -Config_boot (ocaml.Config_boot)

    Module Config_boot

    System configuration

    Warning: this module is unstable and part of compiler-libs.

    val version : string

    The current version number of the system

    val bindir : string

    The directory containing the binary programs

    val standard_library : string

    The directory containing the standard libraries

    val ccomp_type : string

    The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

    val c_compiler : string

    The compiler to use for compiling C files

    val c_output_obj : string

    Name of the option of the C compiler for specifying the output file

    val c_has_debug_prefix_map : bool

    Whether the C compiler supports -fdebug-prefix-map

    val as_has_debug_prefix_map : bool

    Whether the assembler supports --debug-prefix-map

    val ocamlc_cflags : string

    The flags ocamlc should pass to the C compiler

    val ocamlc_cppflags : string

    The flags ocamlc should pass to the C preprocessor

    val ocamlopt_cflags : string
    • deprecated

      ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

    val ocamlopt_cppflags : string
    • deprecated

      ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

    val bytecomp_c_libraries : string

    The C libraries to link with custom runtimes

    val native_c_libraries : string

    The C libraries to link with native-code programs

    val native_pack_linker : string

    The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

    val mkdll : string

    The linker command line to build dynamic libraries.

    val mkexe : string

    The linker command line to build executables.

    val mkmaindll : string

    The linker command line to build main programs as dlls.

    val default_rpath : string

    Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

    val mksharedlibrpath : string

    Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

    val ar : string

    Name of the ar command, or "" if not needed (MSVC)

    val interface_suffix : string ref

    Suffix for interface file names

    val exec_magic_number : string

    Magic number for bytecode executable files

    val cmi_magic_number : string

    Magic number for compiled interface files

    val cmo_magic_number : string

    Magic number for object bytecode files

    val cma_magic_number : string

    Magic number for archive files

    val cmx_magic_number : string

    Magic number for compilation unit descriptions

    val cmxa_magic_number : string

    Magic number for libraries of compilation unit descriptions

    val ast_intf_magic_number : string

    Magic number for file holding an interface syntax tree

    val ast_impl_magic_number : string

    Magic number for file holding an implementation syntax tree

    val cmxs_magic_number : string

    Magic number for dynamically-loadable plugins

    val cmt_magic_number : string

    Magic number for compiled interface files

    val linear_magic_number : string

    Magic number for Linear internal representation files

    val max_tag : int

    Biggest tag that can be stored in the header of a regular block.

    val lazy_tag : int

    Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

    val max_young_wosize : int

    Maximal size of arrays that are directly allocated in the minor heap

    val stack_threshold : int

    Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

    val stack_safety_margin : int

    Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

    val native_compiler : bool

    Whether the native compiler is available or not

    • since 5.1
    val architecture : string

    Name of processor type for the native-code compiler

    val model : string

    Name of processor submodel for the native-code compiler

    val system : string

    Name of operating system for the native-code compiler

    val asm : string

    The assembler (and flags) to use for assembling ocamlopt-generated code.

    val asm_cfi_supported : bool

    Whether assembler understands CFI directives

    val with_frame_pointers : bool

    Whether assembler should maintain frame pointers

    val ext_obj : string

    Extension for object files, e.g. .o under Unix.

    val ext_asm : string

    Extension for assembler files, e.g. .s under Unix.

    val ext_lib : string

    Extension for library files, e.g. .a under Unix.

    val ext_dll : string

    Extension for dynamically-loaded libraries, e.g. .so under Unix.

    val ext_exe : string

    Extension for executable programs, e.g. .exe under Windows.

    • since 4.12
    val default_executable_name : string

    Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

    val systhread_supported : bool

    Whether the system thread library is implemented

    val flexdll_dirs : string list

    Directories needed for the FlexDLL objects

    val host : string

    Whether the compiler is a cross-compiler

    val target : string

    Whether the compiler is a cross-compiler

    val flambda : bool

    Whether the compiler was configured for flambda

    val with_flambda_invariants : bool

    Whether the invariants checks for flambda are enabled

    val with_cmm_invariants : bool

    Whether the invariants checks for Cmm are enabled

    val reserved_header_bits : int

    How many bits of a block's header are reserved

    val flat_float_array : bool

    Whether the compiler and runtime automagically flatten float arrays

    val function_sections : bool

    Whether the compiler was configured to generate each function in a separate section

    val windows_unicode : bool

    Whether Windows Unicode runtime is enabled

    val naked_pointers : bool

    Whether the runtime supports naked pointers

    • since 4.14
    val supports_shared_libraries : bool

    Whether shared libraries are supported

    • since 4.08

    Whether native shared libraries are supported

    • since 5.1
    val afl_instrument : bool

    Whether afl-fuzz instrumentation is generated by default

    val ar_supports_response_files : bool

    Whether ar supports @FILE arguments.

    val print_config : out_channel -> unit

    Access to configuration values

    val config_var : string -> string option

    the configuration value of a variable, if it exists

    +Config_boot (ocaml.Config_boot)

    Module Config_boot

    System configuration

    Warning: this module is unstable and part of compiler-libs.

    val version : string

    The current version number of the system

    val bindir : string

    The directory containing the binary programs

    val standard_library : string

    The directory containing the standard libraries

    val ccomp_type : string

    The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

    val c_compiler : string

    The compiler to use for compiling C files

    val c_output_obj : string

    Name of the option of the C compiler for specifying the output file

    val c_has_debug_prefix_map : bool

    Whether the C compiler supports -fdebug-prefix-map

    val as_has_debug_prefix_map : bool

    Whether the assembler supports --debug-prefix-map

    val bytecode_cflags : string

    The flags ocamlc should pass to the C compiler

    val bytecode_cppflags : string

    The flags ocamlc should pass to the C preprocessor

    val native_cflags : string

    The flags ocamlopt should pass to the C compiler

    val native_cppflags : string

    The flags ocamlopt should pass to the C preprocessor

    val bytecomp_c_libraries : string

    The C libraries to link with custom runtimes

    val native_c_libraries : string

    The C libraries to link with native-code programs

    val native_ldflags : string
    val native_pack_linker : string

    The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

    val mkdll : string

    The linker command line to build dynamic libraries.

    val mkexe : string

    The linker command line to build executables.

    val mkmaindll : string

    The linker command line to build main programs as dlls.

    val default_rpath : string

    Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

    val mksharedlibrpath : string

    Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

    val ar : string

    Name of the ar command, or "" if not needed (MSVC)

    val interface_suffix : string ref

    Suffix for interface file names

    val exec_magic_number : string

    Magic number for bytecode executable files

    val cmi_magic_number : string

    Magic number for compiled interface files

    val cmo_magic_number : string

    Magic number for object bytecode files

    val cma_magic_number : string

    Magic number for archive files

    val cmx_magic_number : string

    Magic number for compilation unit descriptions

    val cmxa_magic_number : string

    Magic number for libraries of compilation unit descriptions

    val ast_intf_magic_number : string

    Magic number for file holding an interface syntax tree

    val ast_impl_magic_number : string

    Magic number for file holding an implementation syntax tree

    val cmxs_magic_number : string

    Magic number for dynamically-loadable plugins

    val cmt_magic_number : string

    Magic number for compiled interface files

    val linear_magic_number : string

    Magic number for Linear internal representation files

    val max_tag : int

    Biggest tag that can be stored in the header of a regular block.

    val lazy_tag : int

    Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

    val max_young_wosize : int

    Maximal size of arrays that are directly allocated in the minor heap

    val stack_threshold : int

    Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

    val stack_safety_margin : int

    Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

    val native_compiler : bool

    Whether the native compiler is available or not

    • since 5.1
    val architecture : string

    Name of processor type for the native-code compiler

    val model : string

    Name of processor submodel for the native-code compiler

    val system : string

    Name of operating system for the native-code compiler

    val asm : string

    The assembler (and flags) to use for assembling ocamlopt-generated code.

    val asm_cfi_supported : bool

    Whether assembler understands CFI directives

    val with_frame_pointers : bool

    Whether assembler should maintain frame pointers

    val ext_obj : string

    Extension for object files, e.g. .o under Unix.

    val ext_asm : string

    Extension for assembler files, e.g. .s under Unix.

    val ext_lib : string

    Extension for library files, e.g. .a under Unix.

    val ext_dll : string

    Extension for dynamically-loaded libraries, e.g. .so under Unix.

    val ext_exe : string

    Extension for executable programs, e.g. .exe under Windows.

    • since 4.12
    val default_executable_name : string

    Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

    val systhread_supported : bool

    Whether the system thread library is implemented

    val flexdll_dirs : string list

    Directories needed for the FlexDLL objects

    val host : string

    Whether the compiler is a cross-compiler

    val target : string

    Whether the compiler is a cross-compiler

    val flambda : bool

    Whether the compiler was configured for flambda

    val with_flambda_invariants : bool

    Whether the invariants checks for flambda are enabled

    val with_cmm_invariants : bool

    Whether the invariants checks for Cmm are enabled

    val reserved_header_bits : int

    How many bits of a block's header are reserved

    val flat_float_array : bool

    Whether the compiler and runtime automagically flatten float arrays

    val function_sections : bool

    Whether the compiler was configured to generate each function in a separate section

    val windows_unicode : bool

    Whether Windows Unicode runtime is enabled

    val naked_pointers : bool

    Whether the runtime supports naked pointers

    • since 4.14
    val supports_shared_libraries : bool

    Whether shared libraries are supported

    • since 4.08

    Whether native shared libraries are supported

    • since 5.1
    val afl_instrument : bool

    Whether afl-fuzz instrumentation is generated by default

    val ar_supports_response_files : bool

    Whether ar supports @FILE arguments.

    val tsan : bool

    Whether ThreadSanitizer instrumentation is enabled

    val print_config : out_channel -> unit

    Access to configuration values

    val config_var : string -> string option

    the configuration value of a variable, if it exists

    diff --git a/ocaml/Config_main/index.html b/ocaml/Config_main/index.html index 268e7ed4..bf4d56ac 100644 --- a/ocaml/Config_main/index.html +++ b/ocaml/Config_main/index.html @@ -1,2 +1,2 @@ -Config_main (ocaml.Config_main)

    Module Config_main

    System configuration

    Warning: this module is unstable and part of compiler-libs.

    val version : string

    The current version number of the system

    val bindir : string

    The directory containing the binary programs

    val standard_library : string

    The directory containing the standard libraries

    val ccomp_type : string

    The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

    val c_compiler : string

    The compiler to use for compiling C files

    val c_output_obj : string

    Name of the option of the C compiler for specifying the output file

    val c_has_debug_prefix_map : bool

    Whether the C compiler supports -fdebug-prefix-map

    val as_has_debug_prefix_map : bool

    Whether the assembler supports --debug-prefix-map

    val ocamlc_cflags : string

    The flags ocamlc should pass to the C compiler

    val ocamlc_cppflags : string

    The flags ocamlc should pass to the C preprocessor

    val ocamlopt_cflags : string
    • deprecated

      ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

    val ocamlopt_cppflags : string
    • deprecated

      ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

    val bytecomp_c_libraries : string

    The C libraries to link with custom runtimes

    val native_c_libraries : string

    The C libraries to link with native-code programs

    val native_pack_linker : string

    The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

    val mkdll : string

    The linker command line to build dynamic libraries.

    val mkexe : string

    The linker command line to build executables.

    val mkmaindll : string

    The linker command line to build main programs as dlls.

    val default_rpath : string

    Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

    val mksharedlibrpath : string

    Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

    val ar : string

    Name of the ar command, or "" if not needed (MSVC)

    val interface_suffix : string ref

    Suffix for interface file names

    val exec_magic_number : string

    Magic number for bytecode executable files

    val cmi_magic_number : string

    Magic number for compiled interface files

    val cmo_magic_number : string

    Magic number for object bytecode files

    val cma_magic_number : string

    Magic number for archive files

    val cmx_magic_number : string

    Magic number for compilation unit descriptions

    val cmxa_magic_number : string

    Magic number for libraries of compilation unit descriptions

    val ast_intf_magic_number : string

    Magic number for file holding an interface syntax tree

    val ast_impl_magic_number : string

    Magic number for file holding an implementation syntax tree

    val cmxs_magic_number : string

    Magic number for dynamically-loadable plugins

    val cmt_magic_number : string

    Magic number for compiled interface files

    val linear_magic_number : string

    Magic number for Linear internal representation files

    val max_tag : int

    Biggest tag that can be stored in the header of a regular block.

    val lazy_tag : int

    Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

    val max_young_wosize : int

    Maximal size of arrays that are directly allocated in the minor heap

    val stack_threshold : int

    Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

    val stack_safety_margin : int

    Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

    val native_compiler : bool

    Whether the native compiler is available or not

    • since 5.1
    val architecture : string

    Name of processor type for the native-code compiler

    val model : string

    Name of processor submodel for the native-code compiler

    val system : string

    Name of operating system for the native-code compiler

    val asm : string

    The assembler (and flags) to use for assembling ocamlopt-generated code.

    val asm_cfi_supported : bool

    Whether assembler understands CFI directives

    val with_frame_pointers : bool

    Whether assembler should maintain frame pointers

    val ext_obj : string

    Extension for object files, e.g. .o under Unix.

    val ext_asm : string

    Extension for assembler files, e.g. .s under Unix.

    val ext_lib : string

    Extension for library files, e.g. .a under Unix.

    val ext_dll : string

    Extension for dynamically-loaded libraries, e.g. .so under Unix.

    val ext_exe : string

    Extension for executable programs, e.g. .exe under Windows.

    • since 4.12
    val default_executable_name : string

    Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

    val systhread_supported : bool

    Whether the system thread library is implemented

    val flexdll_dirs : string list

    Directories needed for the FlexDLL objects

    val host : string

    Whether the compiler is a cross-compiler

    val target : string

    Whether the compiler is a cross-compiler

    val flambda : bool

    Whether the compiler was configured for flambda

    val with_flambda_invariants : bool

    Whether the invariants checks for flambda are enabled

    val with_cmm_invariants : bool

    Whether the invariants checks for Cmm are enabled

    val reserved_header_bits : int

    How many bits of a block's header are reserved

    val flat_float_array : bool

    Whether the compiler and runtime automagically flatten float arrays

    val function_sections : bool

    Whether the compiler was configured to generate each function in a separate section

    val windows_unicode : bool

    Whether Windows Unicode runtime is enabled

    val naked_pointers : bool

    Whether the runtime supports naked pointers

    • since 4.14
    val supports_shared_libraries : bool

    Whether shared libraries are supported

    • since 4.08

    Whether native shared libraries are supported

    • since 5.1
    val afl_instrument : bool

    Whether afl-fuzz instrumentation is generated by default

    val ar_supports_response_files : bool

    Whether ar supports @FILE arguments.

    val print_config : out_channel -> unit

    Access to configuration values

    val config_var : string -> string option

    the configuration value of a variable, if it exists

    +Config_main (ocaml.Config_main)

    Module Config_main

    System configuration

    Warning: this module is unstable and part of compiler-libs.

    val version : string

    The current version number of the system

    val bindir : string

    The directory containing the binary programs

    val standard_library : string

    The directory containing the standard libraries

    val ccomp_type : string

    The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

    val c_compiler : string

    The compiler to use for compiling C files

    val c_output_obj : string

    Name of the option of the C compiler for specifying the output file

    val c_has_debug_prefix_map : bool

    Whether the C compiler supports -fdebug-prefix-map

    val as_has_debug_prefix_map : bool

    Whether the assembler supports --debug-prefix-map

    val bytecode_cflags : string

    The flags ocamlc should pass to the C compiler

    val bytecode_cppflags : string

    The flags ocamlc should pass to the C preprocessor

    val native_cflags : string

    The flags ocamlopt should pass to the C compiler

    val native_cppflags : string

    The flags ocamlopt should pass to the C preprocessor

    val bytecomp_c_libraries : string

    The C libraries to link with custom runtimes

    val native_c_libraries : string

    The C libraries to link with native-code programs

    val native_ldflags : string
    val native_pack_linker : string

    The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

    val mkdll : string

    The linker command line to build dynamic libraries.

    val mkexe : string

    The linker command line to build executables.

    val mkmaindll : string

    The linker command line to build main programs as dlls.

    val default_rpath : string

    Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

    val mksharedlibrpath : string

    Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

    val ar : string

    Name of the ar command, or "" if not needed (MSVC)

    val interface_suffix : string ref

    Suffix for interface file names

    val exec_magic_number : string

    Magic number for bytecode executable files

    val cmi_magic_number : string

    Magic number for compiled interface files

    val cmo_magic_number : string

    Magic number for object bytecode files

    val cma_magic_number : string

    Magic number for archive files

    val cmx_magic_number : string

    Magic number for compilation unit descriptions

    val cmxa_magic_number : string

    Magic number for libraries of compilation unit descriptions

    val ast_intf_magic_number : string

    Magic number for file holding an interface syntax tree

    val ast_impl_magic_number : string

    Magic number for file holding an implementation syntax tree

    val cmxs_magic_number : string

    Magic number for dynamically-loadable plugins

    val cmt_magic_number : string

    Magic number for compiled interface files

    val linear_magic_number : string

    Magic number for Linear internal representation files

    val max_tag : int

    Biggest tag that can be stored in the header of a regular block.

    val lazy_tag : int

    Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

    val max_young_wosize : int

    Maximal size of arrays that are directly allocated in the minor heap

    val stack_threshold : int

    Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

    val stack_safety_margin : int

    Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

    val native_compiler : bool

    Whether the native compiler is available or not

    • since 5.1
    val architecture : string

    Name of processor type for the native-code compiler

    val model : string

    Name of processor submodel for the native-code compiler

    val system : string

    Name of operating system for the native-code compiler

    val asm : string

    The assembler (and flags) to use for assembling ocamlopt-generated code.

    val asm_cfi_supported : bool

    Whether assembler understands CFI directives

    val with_frame_pointers : bool

    Whether assembler should maintain frame pointers

    val ext_obj : string

    Extension for object files, e.g. .o under Unix.

    val ext_asm : string

    Extension for assembler files, e.g. .s under Unix.

    val ext_lib : string

    Extension for library files, e.g. .a under Unix.

    val ext_dll : string

    Extension for dynamically-loaded libraries, e.g. .so under Unix.

    val ext_exe : string

    Extension for executable programs, e.g. .exe under Windows.

    • since 4.12
    val default_executable_name : string

    Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

    val systhread_supported : bool

    Whether the system thread library is implemented

    val flexdll_dirs : string list

    Directories needed for the FlexDLL objects

    val host : string

    Whether the compiler is a cross-compiler

    val target : string

    Whether the compiler is a cross-compiler

    val flambda : bool

    Whether the compiler was configured for flambda

    val with_flambda_invariants : bool

    Whether the invariants checks for flambda are enabled

    val with_cmm_invariants : bool

    Whether the invariants checks for Cmm are enabled

    val reserved_header_bits : int

    How many bits of a block's header are reserved

    val flat_float_array : bool

    Whether the compiler and runtime automagically flatten float arrays

    val function_sections : bool

    Whether the compiler was configured to generate each function in a separate section

    val windows_unicode : bool

    Whether Windows Unicode runtime is enabled

    val naked_pointers : bool

    Whether the runtime supports naked pointers

    • since 4.14
    val supports_shared_libraries : bool

    Whether shared libraries are supported

    • since 4.08

    Whether native shared libraries are supported

    • since 5.1
    val afl_instrument : bool

    Whether afl-fuzz instrumentation is generated by default

    val ar_supports_response_files : bool

    Whether ar supports @FILE arguments.

    val tsan : bool

    Whether ThreadSanitizer instrumentation is enabled

    val print_config : out_channel -> unit

    Access to configuration values

    val config_var : string -> string option

    the configuration value of a variable, if it exists

    diff --git a/ocaml/Ctype/Pattern_env/index.html b/ocaml/Ctype/Pattern_env/index.html new file mode 100644 index 00000000..ead9ec11 --- /dev/null +++ b/ocaml/Ctype/Pattern_env/index.html @@ -0,0 +1,2 @@ + +Pattern_env (ocaml.Ctype.Pattern_env)

    Module Ctype.Pattern_env

    type t = private {
    1. mutable env : Env.t;
    2. equations_scope : int;
    3. allow_recursive_equations : bool;
    }
    val make : Env.t -> equations_scope:int -> allow_recursive_equations:bool -> t
    val copy : ?equations_scope:int -> t -> t
    val set_env : t -> Env.t -> unit
    diff --git a/ocaml/Ctype/index.html b/ocaml/Ctype/index.html index e8c41ff9..c88e8e30 100644 --- a/ocaml/Ctype/index.html +++ b/ocaml/Ctype/index.html @@ -1,5 +1,12 @@ -Ctype (ocaml.Ctype)

    Module Ctype

    exception Unify of Errortrace.unification_error
    exception Equality of Errortrace.equality_error
    exception Moregen of Errortrace.moregen_error
    exception Subtype of Errortrace.Subtype.error
    exception Tags of Asttypes.label * Asttypes.label
    exception Cannot_expand
    exception Cannot_apply
    exception Matches_failure of Env.t * Errortrace.unification_error
    exception Incompatible
    val with_local_level : ?post:('a -> unit) -> (unit -> 'a) -> 'a
    val with_local_level_if : bool -> (unit -> 'a) -> post:('a -> unit) -> 'a
    val with_local_level_iter : (unit -> 'a * 'b list) -> post:('b -> unit) -> 'a
    val with_local_level_iter_if : +Ctype (ocaml.Ctype)

    Module Ctype

    exception Unify of Errortrace.unification_error
    exception Equality of Errortrace.equality_error
    exception Moregen of Errortrace.moregen_error
    exception Subtype of Errortrace.Subtype.error
    exception Tags of Asttypes.label * Asttypes.label
    exception Cannot_expand
    exception Cannot_apply
    exception Matches_failure of Env.t * Errortrace.unification_error
    exception Incompatible
    val with_local_level_generalize : + ?before_generalize:('a -> unit) -> + (unit -> 'a) -> + 'a
    val with_local_level_generalize_if : + bool -> + ?before_generalize:('a -> unit) -> + (unit -> 'a) -> + 'a
    val with_local_level_generalize_structure : (unit -> 'a) -> 'a
    val with_local_level_generalize_structure_if : bool -> (unit -> 'a) -> 'a
    val with_local_level_generalize_structure_if_principal : (unit -> 'a) -> 'a
    val with_local_level_generalize_for_class : (unit -> 'a) -> 'a
    val with_local_level : ?post:('a -> unit) -> (unit -> 'a) -> 'a
    val with_local_level_if : bool -> (unit -> 'a) -> post:('a -> unit) -> 'a
    val with_local_level_iter : (unit -> 'a * 'b list) -> post:('b -> unit) -> 'a
    val with_local_level_iter_if : bool -> (unit -> 'a * 'b list) -> post:('b -> unit) -> @@ -35,14 +42,14 @@ * (Asttypes.label * Types.row_field * Types.row_field) list
    val filter_row_fields : bool -> (Asttypes.label * Types.row_field) list -> - (Asttypes.label * Types.row_field) list
    val generalize : Types.type_expr -> unit
    val lower_contravariant : Env.t -> Types.type_expr -> unit
    val lower_variables_only : Env.t -> int -> Types.type_expr -> unit
    val enforce_current_level : Env.t -> Types.type_expr -> unit
    val generalize_structure : Types.type_expr -> unit
    val generalize_class_type : Types.class_type -> unit
    val generalize_class_type_structure : Types.class_type -> unit
    val generalize_class_signature_spine : Env.t -> Types.class_signature -> unit
    val correct_levels : Types.type_expr -> Types.type_expr
    val limited_generalize : Types.type_expr -> Types.type_expr -> unit
    val limited_generalize_class_type : Types.type_expr -> Types.class_type -> unit
    val fully_generic : Types.type_expr -> bool
    val check_scope_escape : Env.t -> int -> Types.type_expr -> unit
    val instance : ?partial:bool -> Types.type_expr -> Types.type_expr
    val generic_instance : Types.type_expr -> Types.type_expr
    val instance_list : Types.type_expr list -> Types.type_expr list
    val new_local_type : + (Asttypes.label * Types.row_field) list
    val lower_contravariant : Env.t -> Types.type_expr -> unit
    val lower_variables_only : Env.t -> int -> Types.type_expr -> unit
    val enforce_current_level : Env.t -> Types.type_expr -> unit
    val generalize_class_signature_spine : Types.class_signature -> unit
    val limited_generalize : Types.type_expr -> inside:Types.type_expr -> unit
    val limited_generalize_class_type : + Types.type_expr -> + inside:Types.class_type -> + unit
    val duplicate_type : Types.type_expr -> Types.type_expr
    val fully_generic : Types.type_expr -> bool
    val check_scope_escape : Env.t -> int -> Types.type_expr -> unit
    val instance : ?partial:bool -> Types.type_expr -> Types.type_expr
    val generic_instance : Types.type_expr -> Types.type_expr
    val instance_list : Types.type_expr list -> Types.type_expr list
    val new_local_type : ?loc:Location.t -> ?manifest_and_scope:(Types.type_expr * int) -> - unit -> - Types.type_declaration
    val existential_name : - Types.constructor_description -> - Types.type_expr -> - string
    type existential_treatment =
    1. | Keep_existentials_flexible
    2. | Make_existentials_abstract of {
      1. env : Env.t ref;
      2. scope : int;
      }
    val instance_constructor : + Types.type_origin -> + Types.type_declaration
    module Pattern_env : sig ... end
    type existential_treatment =
    1. | Keep_existentials_flexible
    2. | Make_existentials_abstract of Pattern_env.t
    val instance_parameterized_type : @@ -56,7 +63,7 @@ Types.class_type -> Types.type_expr list * Types.class_type
    val instance_poly : ?keep_names:bool -> - bool -> + fixed:bool -> Types.type_expr list -> Types.type_expr -> Types.type_expr list * Types.type_expr
    val polyfy : @@ -64,7 +71,7 @@ Types.type_expr -> Types.type_expr list -> Types.type_expr * bool
    val instance_label : - bool -> + fixed:bool -> Types.label_description -> Types.type_expr list * Types.type_expr * Types.type_expr
    val apply : ?use_current_level:bool -> @@ -86,10 +93,8 @@ Types.type_expr
    type typedecl_extraction_result =
    1. | Typedecl of Path.t * Path.t * Types.type_declaration
    2. | Has_no_typedecl
    3. | May_have_typedecl
    val extract_concrete_typedecl : Env.t -> Types.type_expr -> - typedecl_extraction_result
    val unify : Env.t -> Types.type_expr -> Types.type_expr -> unit
    val unify_gadt : - equations_level:int -> - allow_recursive_equations:bool -> - Env.t ref -> + typedecl_extraction_result
    val get_new_abstract_name : Env.t -> string -> string
    val unify : Env.t -> Types.type_expr -> Types.type_expr -> unit
    val unify_var : Env.t -> Types.type_expr -> Types.type_expr -> unit
    val filter_arrow : @@ -106,7 +111,7 @@ Env.t -> Types.type_expr -> Types.type_expr -> - unit
    val does_match : Env.t -> Types.type_expr -> Types.type_expr -> bool
    val reify_univars : Env.t -> Types.type_expr -> Types.type_expr
    type filter_arrow_failure =
    1. | Unification_error of Errortrace.unification_error
    2. | Label_mismatch of {
      1. got : Asttypes.arg_label;
      2. expected : Asttypes.arg_label;
      3. expected_type : Types.type_expr;
      }
    3. | Not_a_function
    exception Filter_arrow_failed of filter_arrow_failure
    type filter_method_failure =
    1. | Unification_error of Errortrace.unification_error
    2. | Not_a_method
    3. | Not_an_object of Types.type_expr
    exception Filter_method_failed of filter_method_failure
    type class_match_failure =
    1. | CM_Virtual_class
    2. | CM_Parameter_arity_mismatch of int * int
    3. | CM_Type_parameter_mismatch of Env.t * Errortrace.equality_error
    4. | CM_Class_type_mismatch of Env.t * Types.class_type * Types.class_type
    5. | CM_Parameter_mismatch of Env.t * Errortrace.moregen_error
    6. | CM_Val_type_mismatch of string * Env.t * Errortrace.comparison_error
    7. | CM_Meth_type_mismatch of string * Env.t * Errortrace.comparison_error
    8. | CM_Non_mutable_value of string
    9. | CM_Non_concrete_value of string
    10. | CM_Missing_value of string
    11. | CM_Missing_method of string
    12. | CM_Hide_public of string
    13. | CM_Hide_virtual of string * string
    14. | CM_Public_method of string
    15. | CM_Private_method of string
    16. | CM_Virtual_method of string
    val match_class_types : + unit
    val does_match : Env.t -> Types.type_expr -> Types.type_expr -> bool
    val reify_univars : Env.t -> Types.type_expr -> Types.type_expr
    type filter_arrow_failure =
    1. | Unification_error of Errortrace.unification_error
    2. | Label_mismatch of {
      1. got : Asttypes.arg_label;
      2. expected : Asttypes.arg_label;
      3. expected_type : Types.type_expr;
      }
    3. | Not_a_function
    exception Filter_arrow_failed of filter_arrow_failure
    type filter_method_failure =
    1. | Unification_error of Errortrace.unification_error
    2. | Not_a_method
    3. | Not_an_object of Types.type_expr
    exception Filter_method_failed of filter_method_failure
    type class_match_failure =
    1. | CM_Virtual_class
    2. | CM_Parameter_arity_mismatch of int * int
    3. | CM_Type_parameter_mismatch of int * Env.t * Errortrace.equality_error
    4. | CM_Class_type_mismatch of Env.t * Types.class_type * Types.class_type
    5. | CM_Parameter_mismatch of int * Env.t * Errortrace.moregen_error
    6. | CM_Val_type_mismatch of string * Env.t * Errortrace.comparison_error
    7. | CM_Meth_type_mismatch of string * Env.t * Errortrace.comparison_error
    8. | CM_Non_mutable_value of string
    9. | CM_Non_concrete_value of string
    10. | CM_Missing_value of string
    11. | CM_Missing_method of string
    12. | CM_Hide_public of string
    13. | CM_Hide_virtual of string * string
    14. | CM_Public_method of string
    15. | CM_Private_method of string
    16. | CM_Virtual_method of string
    val match_class_types : ?trace:bool -> Env.t -> Types.class_type -> @@ -175,16 +180,16 @@ Types.class_type_declaration -> Types.class_type_declaration
    val is_contractive : Env.t -> Path.t -> bool
    val normalize_type : Types.type_expr -> unit
    val nongen_vars_in_schema : Env.t -> Types.type_expr -> Btype.TypeSet.t option
    val nongen_vars_in_class_declaration : Types.class_declaration -> - Btype.TypeSet.t option
    type variable_kind =
    1. | Row_variable
    2. | Type_variable
    type closed_class_failure = {
    1. free_variable : Types.type_expr * variable_kind;
    2. meth : string;
    3. meth_ty : Types.type_expr;
    }
    val free_variables : ?env:Env.t -> Types.type_expr -> Types.type_expr list
    val closed_type_decl : Types.type_declaration -> Types.type_expr option
    val closed_extension_constructor : + Btype.TypeSet.t option
    type variable_kind =
    1. | Row_variable
    2. | Type_variable
    type closed_class_failure = {
    1. free_variable : Types.type_expr * variable_kind;
    2. meth : string;
    3. meth_ty : Types.type_expr;
    }
    val free_variables : ?env:Env.t -> Types.type_expr -> Types.type_expr list
    val closed_type_expr : ?env:Env.t -> Types.type_expr -> bool
    val closed_type_decl : Types.type_declaration -> Types.type_expr option
    val closed_extension_constructor : Types.extension_constructor -> Types.type_expr option
    val closed_class : Types.type_expr list -> Types.class_signature -> - closed_class_failure option
    val arity : Types.type_expr -> int
    val collapse_conj_params : Env.t -> Types.type_expr list -> unit
    val get_current_level : unit -> int
    val wrap_trace_gadt_instances : Env.t -> ('a -> 'b) -> 'a -> 'b
    val immediacy : Env.t -> Types.type_expr -> Type_immediacy.t
    val package_subtype : + closed_class_failure option
    val arity : Types.type_expr -> int
    val collapse_conj_params : Env.t -> Types.type_expr list -> unit
    val get_current_level : unit -> int
    val wrap_trace_gadt_instances : ?force:bool -> Env.t -> ('a -> 'b) -> 'a -> 'b
    val immediacy : Env.t -> Types.type_expr -> Type_immediacy.t
    val package_subtype : (Env.t -> Path.t -> (Longident.t * Types.type_expr) list -> Path.t -> (Longident.t * Types.type_expr) list -> - bool) + (unit, Errortrace.first_class_module) Stdlib.Result.t) ref
    val mcomp : Env.t -> Types.type_expr -> Types.type_expr -> unit
    diff --git a/ocaml/Datarepr/index.html b/ocaml/Datarepr/index.html index 8e3ceacd..4e8dddd7 100644 --- a/ocaml/Datarepr/index.html +++ b/ocaml/Datarepr/index.html @@ -1,13 +1,13 @@ Datarepr (ocaml.Datarepr)

    Module Datarepr

    val extension_descr : - current_unit:string -> + current_unit:Unit_info.t option -> Path.t -> Types.extension_constructor -> Types.constructor_description
    val labels_of_type : Path.t -> Types.type_declaration -> (Ident.t * Types.label_description) list
    val constructors_of_type : - current_unit:string -> + current_unit:Unit_info.t option -> Path.t -> Types.type_declaration -> (Ident.t * Types.constructor_description) list
    exception Constr_not_found
    val find_constr_by_tag : diff --git a/ocaml/Depend/index.html b/ocaml/Depend/index.html index ca1c28dd..e600c3f9 100644 --- a/ocaml/Depend/index.html +++ b/ocaml/Depend/index.html @@ -1,2 +1,2 @@ -Depend (ocaml.Depend)

    Module Depend

    Module dependencies.

    Warning: this module is unstable and part of compiler-libs.

    module String = Misc.Stdlib.String
    type map_tree =
    1. | Node of String.Set.t * bound_map
    and bound_map = map_tree String.Map.t
    val make_leaf : string -> map_tree
    val make_node : bound_map -> map_tree
    val weaken_map : String.Set.t -> map_tree -> map_tree
    val free_structure_names : String.Set.t ref
    val pp_deps : string list ref

    dependencies found by preprocessing tools

    val open_module : bound_map -> Longident.t -> bound_map
    val add_use_file : bound_map -> Parsetree.toplevel_phrase list -> unit
    val add_signature : bound_map -> Parsetree.signature -> unit
    val add_implementation : bound_map -> Parsetree.structure -> unit
    val add_implementation_binding : bound_map -> Parsetree.structure -> bound_map
    val add_signature_binding : bound_map -> Parsetree.signature -> bound_map
    +Depend (ocaml.Depend)

    Module Depend

    Module dependencies.

    Warning: this module is unstable and part of compiler-libs.

    module String = Misc.Stdlib.String
    type map_tree =
    1. | Node of String.Set.t * bound_map
    and bound_map = map_tree String.Map.t
    val make_leaf : string -> map_tree
    val make_node : bound_map -> map_tree
    val weaken_map : String.Set.t -> map_tree -> map_tree
    val free_structure_names : String.Set.t ref

    Collect free module identifiers in the a.s.t.

    val pp_deps : string list ref

    Dependencies found by preprocessing tools.

    val open_module : bound_map -> Longident.t -> bound_map
    val add_use_file : bound_map -> Parsetree.toplevel_phrase list -> unit
    val add_signature : bound_map -> Parsetree.signature -> unit
    val add_implementation : bound_map -> Parsetree.structure -> unit
    val add_implementation_binding : bound_map -> Parsetree.structure -> bound_map
    val add_signature_binding : bound_map -> Parsetree.signature -> bound_map
    diff --git a/ocaml/Diffing/index.html b/ocaml/Diffing/index.html index b57cfdd2..f95354de 100644 --- a/ocaml/Diffing/index.html +++ b/ocaml/Diffing/index.html @@ -1,2 +1,2 @@ -Diffing (ocaml.Diffing)

    Module Diffing

    Parametric diffing

    This module implements diffing over lists of arbitrary content. It is parameterized by

    • The content of the two lists
    • The equality witness when an element is kept
    • The diffing witness when an element is changed

    Diffing is extended to maintain state depending on the computed changes while walking through the two lists.

    The underlying algorithm is a modified Wagner-Fischer algorithm (see <https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm>).

    We provide the following guarantee: Given two lists l and r, if different patches result in different states, we say that the state diverges.

    • We always return the optimal patch on prefixes of l and r on which state does not diverge.
    • Otherwise, we return a correct but non-optimal patch where subpatches with no divergent states are optimal for the given initial state.

    More precisely, the optimality of Wagner-Fischer depends on the property that the edit-distance between a k-prefix of the left input and a l-prefix of the right input d(k,l) satisfies

    d(k,l) = min ( del_cost + d(k-1,l), insert_cost + d(k,l-1), change_cost + d(k-1,l-1) )

    Under this hypothesis, it is optimal to choose greedily the state of the minimal patch transforming the left k-prefix into the right l-prefix as a representative of the states of all possible patches transforming the left k-prefix into the right l-prefix.

    If this property is not satisfied, we can still choose greedily a representative state. However, the computed patch is no more guaranteed to be globally optimal. Nevertheless, it is still a correct patch, which is even optimal among all explored patches.

    module type Defs = sig ... end

    The core types of a diffing implementation

    type change_kind =
    1. | Deletion
    2. | Insertion
    3. | Modification
    4. | Preservation

    The kind of changes which is used to share printing and styling across implementation

    val prefix : Stdlib.Format.formatter -> (int * change_kind) -> unit
    val style : change_kind -> Misc.Color.style list
    type ('left, 'right, 'eq, 'diff) change =
    1. | Delete of 'left
    2. | Insert of 'right
    3. | Keep of 'left * 'right * 'eq
    4. | Change of 'left * 'right * 'diff
    val classify : (_, _, _, _) change -> change_kind
    module Define (D : Defs) : sig ... end

    Define(Defs) creates the diffing types from the types defined in Defs and the functors that need to be instantatied with the diffing algorithm parameters

    +Diffing (ocaml.Diffing)

    Module Diffing

    Parametric diffing

    This module implements diffing over lists of arbitrary content. It is parameterized by

    • The content of the two lists
    • The equality witness when an element is kept
    • The diffing witness when an element is changed

    Diffing is extended to maintain state depending on the computed changes while walking through the two lists.

    The underlying algorithm is a modified Wagner-Fischer algorithm (see <https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm>).

    We provide the following guarantee: Given two lists l and r, if different patches result in different states, we say that the state diverges.

    • We always return the optimal patch on prefixes of l and r on which state does not diverge.
    • Otherwise, we return a correct but non-optimal patch where subpatches with no divergent states are optimal for the given initial state.

    More precisely, the optimality of Wagner-Fischer depends on the property that the edit-distance between a k-prefix of the left input and a l-prefix of the right input d(k,l) satisfies

    d(k,l) = min ( del_cost + d(k-1,l), insert_cost + d(k,l-1), change_cost + d(k-1,l-1) )

    Under this hypothesis, it is optimal to choose greedily the state of the minimal patch transforming the left k-prefix into the right l-prefix as a representative of the states of all possible patches transforming the left k-prefix into the right l-prefix.

    If this property is not satisfied, we can still choose greedily a representative state. However, the computed patch is no more guaranteed to be globally optimal. Nevertheless, it is still a correct patch, which is even optimal among all explored patches.

    module type Defs = sig ... end

    The core types of a diffing implementation

    type change_kind =
    1. | Deletion
    2. | Insertion
    3. | Modification
    4. | Preservation

    The kind of changes which is used to share printing and styling across implementation

    val prefix : (int * change_kind) Format_doc.printer
    val style : change_kind -> Misc.Style.style list
    type ('left, 'right, 'eq, 'diff) change =
    1. | Delete of 'left
    2. | Insert of 'right
    3. | Keep of 'left * 'right * 'eq
    4. | Change of 'left * 'right * 'diff
    val classify : (_, _, _, _) change -> change_kind
    module Define (D : Defs) : sig ... end

    Define(Defs) creates the diffing types from the types defined in Defs and the functors that need to be instantatied with the diffing algorithm parameters

    diff --git a/ocaml/Diffing_with_keys/index.html b/ocaml/Diffing_with_keys/index.html index e5139139..8172bd5d 100644 --- a/ocaml/Diffing_with_keys/index.html +++ b/ocaml/Diffing_with_keys/index.html @@ -1,2 +1,2 @@ -Diffing_with_keys (ocaml.Diffing_with_keys)

    Module Diffing_with_keys

    When diffing lists where each element has a distinct key, we can refine the diffing patch by introducing two composite edit moves: swaps and moves.

    Swaps exchange the position of two elements. Swap cost is set to 2 * change - epsilon. Moves change the position of one element. Move cost is set to delete + addition - epsilon.

    When the cost delete + addition is greater than change and with those specific weights, the optimal patch with Swaps and Moves can be computed directly and cheaply from the original optimal patch.

    type 'a with_pos = {
    1. pos : int;
    2. data : 'a;
    }
    val with_pos : 'a list -> 'a with_pos list
    type ('l, 'r, 'diff) mismatch =
    1. | Name of {
      1. pos : int;
      2. got : string;
      3. expected : string;
      4. types_match : bool;
      }
    2. | Type of {
      1. pos : int;
      2. got : 'l;
      3. expected : 'r;
      4. reason : 'diff;
      }
    type ('l, 'r, 'diff) change =
    1. | Change of ('l, 'r, 'diff) mismatch
    2. | Swap of {
      1. pos : int * int;
      2. first : string;
      3. last : string;
      }
    3. | Move of {
      1. name : string;
      2. got : int;
      3. expected : int;
      }
    4. | Insert of {
      1. pos : int;
      2. insert : 'r;
      }
    5. | Delete of {
      1. pos : int;
      2. delete : 'l;
      }

    This specialized version of changes introduces two composite changes: Move and Swap

    val prefix : Stdlib.Format.formatter -> ('l, 'r, 'diff) change -> unit
    module Define (D : Diffing.Defs with type eq := unit) : sig ... end
    +Diffing_with_keys (ocaml.Diffing_with_keys)

    Module Diffing_with_keys

    When diffing lists where each element has a distinct key, we can refine the diffing patch by introducing two composite edit moves: swaps and moves.

    Swaps exchange the position of two elements. Swap cost is set to 2 * change - epsilon. Moves change the position of one element. Move cost is set to delete + addition - epsilon.

    When the cost delete + addition is greater than change and with those specific weights, the optimal patch with Swaps and Moves can be computed directly and cheaply from the original optimal patch.

    type 'a with_pos = {
    1. pos : int;
    2. data : 'a;
    }
    val with_pos : 'a list -> 'a with_pos list
    type ('l, 'r, 'diff) mismatch =
    1. | Name of {
      1. pos : int;
      2. got : string;
      3. expected : string;
      4. types_match : bool;
      }
    2. | Type of {
      1. pos : int;
      2. got : 'l;
      3. expected : 'r;
      4. reason : 'diff;
      }
    type ('l, 'r, 'diff) change =
    1. | Change of ('l, 'r, 'diff) mismatch
    2. | Swap of {
      1. pos : int * int;
      2. first : string;
      3. last : string;
      }
    3. | Move of {
      1. name : string;
      2. got : int;
      3. expected : int;
      }
    4. | Insert of {
      1. pos : int;
      2. insert : 'r;
      }
    5. | Delete of {
      1. pos : int;
      2. delete : 'l;
      }

    This specialized version of changes introduces two composite changes: Move and Swap

    val prefix : ('l, 'r, 'diff) change Format_doc.printer
    module Define (D : Diffing.Defs with type eq := unit) : sig ... end
    diff --git a/ocaml/Domainstate/index.html b/ocaml/Domainstate/index.html index 27734c8a..a379cf47 100644 --- a/ocaml/Domainstate/index.html +++ b/ocaml/Domainstate/index.html @@ -1,2 +1,2 @@ -Domainstate (ocaml.Domainstate)

    Module Domainstate

    val stack_ctx_words : int
    type t =
    1. | Domain_young_limit
    2. | Domain_young_ptr
    3. | Domain_young_start
    4. | Domain_young_end
    5. | Domain_young_trigger
    6. | Domain_current_stack
    7. | Domain_exn_handler
    8. | Domain_action_pending
    9. | Domain_c_stack
    10. | Domain_stack_cache
    11. | Domain_gc_regs_buckets
    12. | Domain_gc_regs
    13. | Domain_minor_tables
    14. | Domain_mark_stack
    15. | Domain_marking_done
    16. | Domain_sweeping_done
    17. | Domain_allocated_words
    18. | Domain_swept_words
    19. | Domain_major_slice_epoch
    20. | Domain_local_roots
    21. | Domain_ephe_info
    22. | Domain_final_info
    23. | Domain_backtrace_pos
    24. | Domain_backtrace_active
    25. | Domain_backtrace_buffer
    26. | Domain_backtrace_last_exn
    27. | Domain_compare_unordered
    28. | Domain_oo_next_id_local
    29. | Domain_requested_major_slice
    30. | Domain_requested_global_major_slice
    31. | Domain_requested_minor_gc
    32. | Domain_requested_external_interrupt
    33. | Domain_parser_trace
    34. | Domain_minor_heap_wsz
    35. | Domain_shared_heap
    36. | Domain_id
    37. | Domain_unique_id
    38. | Domain_dls_root
    39. | Domain_extra_heap_resources
    40. | Domain_extra_heap_resources_minor
    41. | Domain_dependent_size
    42. | Domain_dependent_allocated
    43. | Domain_slice_target
    44. | Domain_slice_budget
    45. | Domain_major_work_done_between_slices
    46. | Domain_extern_state
    47. | Domain_intern_state
    48. | Domain_stat_minor_words
    49. | Domain_stat_promoted_words
    50. | Domain_stat_major_words
    51. | Domain_stat_forced_major_collections
    52. | Domain_stat_blocks_marked
    53. | Domain_inside_stw_handler
    54. | Domain_trap_sp_off
    55. | Domain_trap_barrier_off
    56. | Domain_trap_barrier_block
    57. | Domain_external_raise
    58. | Domain_extra_params
    val idx_of_field : t -> int
    +Domainstate (ocaml.Domainstate)

    Module Domainstate

    val stack_ctx_words : int
    type t =
    1. | Domain_young_limit
    2. | Domain_young_ptr
    3. | Domain_young_start
    4. | Domain_young_end
    5. | Domain_young_trigger
    6. | Domain_current_stack
    7. | Domain_exn_handler
    8. | Domain_action_pending
    9. | Domain_c_stack
    10. | Domain_stack_cache
    11. | Domain_gc_regs_buckets
    12. | Domain_gc_regs
    13. | Domain_minor_tables
    14. | Domain_mark_stack
    15. | Domain_marking_done
    16. | Domain_sweeping_done
    17. | Domain_allocated_words
    18. | Domain_allocated_words_direct
    19. | Domain_swept_words
    20. | Domain_major_slice_epoch
    21. | Domain_local_roots
    22. | Domain_ephe_info
    23. | Domain_final_info
    24. | Domain_backtrace_pos
    25. | Domain_backtrace_active
    26. | Domain_backtrace_buffer
    27. | Domain_backtrace_last_exn
    28. | Domain_compare_unordered
    29. | Domain_oo_next_id_local
    30. | Domain_requested_major_slice
    31. | Domain_requested_global_major_slice
    32. | Domain_requested_minor_gc
    33. | Domain_requested_external_interrupt
    34. | Domain_parser_trace
    35. | Domain_minor_heap_wsz
    36. | Domain_shared_heap
    37. | Domain_id
    38. | Domain_unique_id
    39. | Domain_dls_root
    40. | Domain_extra_heap_resources
    41. | Domain_extra_heap_resources_minor
    42. | Domain_dependent_size
    43. | Domain_dependent_allocated
    44. | Domain_slice_target
    45. | Domain_slice_budget
    46. | Domain_major_work_done_between_slices
    47. | Domain_extern_state
    48. | Domain_intern_state
    49. | Domain_stat_minor_words
    50. | Domain_stat_promoted_words
    51. | Domain_stat_major_words
    52. | Domain_stat_forced_major_collections
    53. | Domain_stat_blocks_marked
    54. | Domain_inside_stw_handler
    55. | Domain_trap_sp_off
    56. | Domain_trap_barrier_off
    57. | Domain_trap_barrier_block
    58. | Domain_external_raise
    59. | Domain_memprof
    60. | Domain_memprof_young_trigger
    61. | Domain_extra_params
    val idx_of_field : t -> int
    diff --git a/ocaml/Emitaux/index.html b/ocaml/Emitaux/index.html index aab80f64..7eaec26f 100644 --- a/ocaml/Emitaux/index.html +++ b/ocaml/Emitaux/index.html @@ -8,8 +8,4 @@ frame_size:int -> live_offset:int list -> frame_debuginfo -> - unit
    type emit_frame_actions = {
    1. efa_code_label : int -> unit;
    2. efa_data_label : int -> unit;
    3. efa_8 : int -> unit;
    4. efa_16 : int -> unit;
    5. efa_32 : int32 -> unit;
    6. efa_word : int -> unit;
    7. efa_align : int -> unit;
    8. efa_label_rel : int -> int32 -> unit;
    9. efa_def_label : int -> unit;
    10. efa_string : string -> unit;
    }
    val emit_frames : emit_frame_actions -> unit
    val is_generic_function : string -> bool
    val cfi_startproc : unit -> unit
    val cfi_endproc : unit -> unit
    val cfi_adjust_cfa_offset : int -> unit
    val cfi_offset : reg:int -> offset:int -> unit
    val cfi_def_cfa_offset : int -> unit
    val cfi_remember_state : unit -> unit
    val cfi_restore_state : unit -> unit
    val cfi_def_cfa_register : reg:int -> unit
    val binary_backend_available : bool ref

    Is a binary backend available. If yes, we don't need to generate the textual assembly file (unless the user request it with -S).

    val create_asm_file : bool ref

    Are we actually generating the textual assembly file?

    type error =
    1. | Stack_frame_too_large of int
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    type preproc_stack_check_result = {
    1. max_frame_size : int;
    2. contains_nontail_calls : bool;
    }
    val preproc_stack_check : - fun_body:Linear.instruction -> - frame_size:int -> - trap_size:int -> - preproc_stack_check_result
    + unit
    type emit_frame_actions = {
    1. efa_code_label : int -> unit;
    2. efa_data_label : int -> unit;
    3. efa_8 : int -> unit;
    4. efa_16 : int -> unit;
    5. efa_32 : int32 -> unit;
    6. efa_word : int -> unit;
    7. efa_align : int -> unit;
    8. efa_label_rel : int -> int32 -> unit;
    9. efa_def_label : int -> unit;
    10. efa_string : string -> unit;
    }
    val emit_frames : emit_frame_actions -> unit
    val is_generic_function : string -> bool
    val cfi_startproc : unit -> unit
    val cfi_endproc : unit -> unit
    val cfi_adjust_cfa_offset : int -> unit
    val cfi_offset : reg:int -> offset:int -> unit
    val cfi_def_cfa_offset : int -> unit
    val cfi_remember_state : unit -> unit
    val cfi_restore_state : unit -> unit
    val cfi_def_cfa_register : reg:int -> unit
    val binary_backend_available : bool ref

    Is a binary backend available. If yes, we don't need to generate the textual assembly file (unless the user request it with -S).

    val create_asm_file : bool ref

    Are we actually generating the textual assembly file?

    type error =
    1. | Stack_frame_too_large of int
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    val emit_named_text_section : string -> char -> unit
    diff --git a/ocaml/Emitcode/index.html b/ocaml/Emitcode/index.html index 8e8c9b97..ebf9784c 100644 --- a/ocaml/Emitcode/index.html +++ b/ocaml/Emitcode/index.html @@ -1,14 +1,13 @@ Emitcode (ocaml.Emitcode)

    Module Emitcode

    val to_file : out_channel -> - string -> - string -> + Unit_info.Artifact.t -> required_globals:Ident.Set.t -> Instruct.instruction list -> unit
    val to_packed_file : out_channel -> diff --git a/ocaml/Env/index.html b/ocaml/Env/index.html index 54cb1179..e2b64b74 100644 --- a/ocaml/Env/index.html +++ b/ocaml/Env/index.html @@ -1,8 +1,8 @@ -Env (ocaml.Env)

    Module Env

    val register_uid : Types.Uid.t -> Location.t -> unit
    val get_uid_to_loc_tbl : unit -> Location.t Types.Uid.Tbl.t
    type value_unbound_reason =
    1. | Val_unbound_instance_variable
    2. | Val_unbound_self
    3. | Val_unbound_ancestor
    4. | Val_unbound_ghost_recursive of Location.t
    type module_unbound_reason =
    1. | Mod_unbound_illegal_recursion
    type summary =
    1. | Env_empty
    2. | Env_value of summary * Ident.t * Types.value_description
    3. | Env_type of summary * Ident.t * Types.type_declaration
    4. | Env_extension of summary * Ident.t * Types.extension_constructor
    5. | Env_module of summary +Env (ocaml.Env)

      Module Env

      type value_unbound_reason =
      1. | Val_unbound_instance_variable
      2. | Val_unbound_self
      3. | Val_unbound_ancestor
      4. | Val_unbound_ghost_recursive of Location.t
      type module_unbound_reason =
      1. | Mod_unbound_illegal_recursion
      type summary =
      1. | Env_empty
      2. | Env_value of summary * Ident.t * Types.value_description
      3. | Env_type of summary * Ident.t * Types.type_declaration
      4. | Env_extension of summary * Ident.t * Types.extension_constructor
      5. | Env_module of summary * Ident.t * Types.module_presence - * Types.module_declaration
      6. | Env_modtype of summary * Ident.t * Types.modtype_declaration
      7. | Env_class of summary * Ident.t * Types.class_declaration
      8. | Env_cltype of summary * Ident.t * Types.class_type_declaration
      9. | Env_open of summary * Path.t
        (*

        The string set argument of Env_open represents a list of module names to skip, i.e. that won't be imported in the toplevel namespace.

        *)
      10. | Env_functor_arg of summary * Ident.t
      11. | Env_constraints of summary * Types.type_declaration Path.Map.t
      12. | Env_copy_types of summary
      13. | Env_persistent of summary * Ident.t
      14. | Env_value_unbound of summary * string * value_unbound_reason
      15. | Env_module_unbound of summary * string * module_unbound_reason
      type address =
      1. | Aident of Ident.t
      2. | Adot of address * int
      type t
      val empty : t
      val initial : t
      val diff : t -> t -> Ident.t list
      type type_descr_kind = + * Types.module_declaration
    6. | Env_modtype of summary * Ident.t * Types.modtype_declaration
    7. | Env_class of summary * Ident.t * Types.class_declaration
    8. | Env_cltype of summary * Ident.t * Types.class_type_declaration
    9. | Env_open of summary * Path.t
      (*

      The string set argument of Env_open represents a list of module names to skip, i.e. that won't be imported in the toplevel namespace.

      *)
    10. | Env_functor_arg of summary * Ident.t
    11. | Env_constraints of summary * Types.type_declaration Path.Map.t
    12. | Env_copy_types of summary
    13. | Env_persistent of summary * Ident.t
    14. | Env_value_unbound of summary * string * value_unbound_reason
    15. | Env_module_unbound of summary * string * module_unbound_reason
    type address =
    1. | Aident of Ident.t
    2. | Adot of address * int
    type t
    val empty : t
    val initial : t
    val diff : t -> t -> Ident.t list
    val same_type_declarations : t -> t -> bool
    type type_descriptions = type_descr_kind
    type iter_cont
    val iter_types : (Path.t -> (Path.t * Types.type_declaration) -> unit) -> t -> @@ -126,8 +126,15 @@ Ident.t -> Types.value_description -> t -> - t
    val add_type : check:bool -> Ident.t -> Types.type_declaration -> t -> t
    val add_extension : + t
    val add_type : check:bool -> + ?shape:Shape.t -> + Ident.t -> + Types.type_declaration -> + t -> + t
    val add_extension : + check:bool -> + ?shape:Shape.t -> rebind:bool -> Ident.t -> Types.extension_constructor -> @@ -164,7 +171,7 @@ Ident.t -> Subst.Lazy.modtype_declaration -> t -> - t
    val add_class : Ident.t -> Types.class_declaration -> t -> t
    val add_cltype : Ident.t -> Types.class_type_declaration -> t -> t
    val add_local_type : Path.t -> Types.type_declaration -> t -> t
    val add_persistent_structure : Ident.t -> t -> t
    val persistent_structures_of_dir : Load_path.Dir.t -> Misc.Stdlib.String.Set.t
    val filter_non_loaded_persistent : (Ident.t -> bool) -> t -> t
    val add_signature : Types.signature -> t -> t
    val open_signature : + t
    val add_class : Ident.t -> Types.class_declaration -> t -> t
    val add_cltype : Ident.t -> Types.class_type_declaration -> t -> t
    val add_local_constraint : Path.t -> Types.type_declaration -> t -> t
    val add_persistent_structure : Ident.t -> t -> t
    val persistent_structures_of_dir : Load_path.Dir.t -> Misc.Stdlib.String.Set.t
    val filter_non_loaded_persistent : (Ident.t -> bool) -> t -> t
    val add_signature : Types.signature -> t -> t
    val open_signature : ?used_slot:bool ref -> ?loc:Location.t -> ?toplevel:bool -> @@ -228,23 +235,22 @@ Shape.t -> Types.signature -> t -> - Types.signature * Shape.Map.t * t
    val enter_unbound_value : string -> value_unbound_reason -> t -> t
    val enter_unbound_module : string -> module_unbound_reason -> t -> t
    val reset_cache : unit -> unit
    val reset_cache_toplevel : unit -> unit
    val set_unit_name : string -> unit
    val get_unit_name : unit -> string
    val read_signature : Misc.modname -> Misc.filepath -> Types.signature
    val save_signature : + Types.signature * Shape.Map.t * t
    val enter_unbound_value : string -> value_unbound_reason -> t -> t
    val enter_unbound_module : string -> module_unbound_reason -> t -> t
    val reset_cache : unit -> unit
    val reset_cache_toplevel : unit -> unit
    val set_current_unit : Unit_info.t -> unit
    val get_current_unit : unit -> Unit_info.t option
    val get_current_unit_name : unit -> string
    val read_signature : Unit_info.Artifact.t -> Types.signature
    val save_signature_with_imports : alerts:Misc.alerts -> Types.signature -> - Misc.modname -> - Misc.filepath -> + Unit_info.Artifact.t -> Misc.crcs -> - Cmi_format.cmi_infos
    val crc_of_unit : Misc.modname -> Stdlib.Digest.t
    val imports : unit -> Misc.crcs
    val import_crcs : source:string -> Misc.crcs -> unit
    val is_imported_opaque : Misc.modname -> bool
    val register_import_as_opaque : Misc.modname -> unit
    val summary : t -> summary
    val keep_only_summary : t -> t
    val env_of_only_summary : (summary -> Subst.t -> t) -> t -> t
    type error =
    1. | Missing_module of Location.t * Path.t * Path.t
    2. | Illegal_value_name of Location.t * string
    3. | Lookup_error of Location.t * t * lookup_error
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    val report_lookup_error : + Cmi_format.cmi_infos
    val crc_of_unit : Misc.modname -> Stdlib.Digest.t
    val imports : unit -> Misc.crcs
    val import_crcs : source:string -> Misc.crcs -> unit
    val is_imported_opaque : Misc.modname -> bool
    val register_import_as_opaque : Misc.modname -> unit
    val summary : t -> summary
    val keep_only_summary : t -> t
    val env_of_only_summary : (summary -> Subst.t -> t) -> t -> t
    type error =
    1. | Missing_module of Location.t * Path.t * Path.t
    2. | Illegal_value_name of Location.t * string
    3. | Lookup_error of Location.t * t * lookup_error
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    val report_lookup_error : Location.t -> t -> - Stdlib.Format.formatter -> - lookup_error -> - unit
    val in_signature : bool -> t -> t
    val is_in_signature : t -> bool
    val set_value_used_callback : Types.value_description -> (unit -> unit) -> unit
    val set_type_used_callback : + lookup_error Format_doc.format_printer
    val report_lookup_error_doc : + Location.t -> + t -> + lookup_error Format_doc.printer
    val in_signature : bool -> t -> t
    val is_in_signature : t -> bool
    val set_value_used_callback : Types.value_description -> (unit -> unit) -> unit
    val set_type_used_callback : Types.type_declaration -> ((unit -> unit) -> unit) -> unit
    val check_functor_application : @@ -265,7 +271,7 @@ Subst.Lazy.modtype -> Path.t -> Subst.Lazy.modtype) - ref
    val same_constr : (t -> Types.type_expr -> Types.type_expr -> bool) ref
    val print_longident : (Stdlib.Format.formatter -> Longident.t -> unit) ref
    val print_path : (Stdlib.Format.formatter -> Path.t -> unit) ref

    Folds

    val fold_values : + ref
    val same_constr : (t -> Types.type_expr -> Types.type_expr -> bool) ref
    val print_path : Path.t Format_doc.printer ref

    Folds

    val fold_values : (string -> Path.t -> Types.value_description -> 'a -> 'a) -> Longident.t option -> t -> diff --git a/ocaml/Envaux/index.html b/ocaml/Envaux/index.html index a821dbc2..daa41277 100644 --- a/ocaml/Envaux/index.html +++ b/ocaml/Envaux/index.html @@ -1,2 +1,2 @@ -Envaux (ocaml.Envaux)

    Module Envaux

    val env_from_summary : Env.summary -> Subst.t -> Env.t
    val reset_cache : unit -> unit
    val env_of_only_summary : Env.t -> Env.t
    type error =
    1. | Module_not_found of Path.t
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    +Envaux (ocaml.Envaux)

    Module Envaux

    val env_from_summary : Env.summary -> Subst.t -> Env.t
    val reset_cache : unit -> unit
    val env_of_only_summary : Env.t -> Env.t
    type error =
    1. | Module_not_found of Path.t
    exception Error of error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Errortrace/index.html b/ocaml/Errortrace/index.html index 0b3b186b..f19cf435 100644 --- a/ocaml/Errortrace/index.html +++ b/ocaml/Errortrace/index.html @@ -1,7 +1,7 @@ -Errortrace (ocaml.Errortrace)

    Module Errortrace

    type position =
    1. | First
    2. | Second
    val swap_position : position -> position
    val print_pos : Stdlib.Format.formatter -> position -> unit
    type expanded_type = {
    1. ty : Types.type_expr;
    2. expanded : Types.type_expr;
    }
    val trivial_expansion : Types.type_expr -> expanded_type

    trivial_expansion ty creates an expanded_type whose expansion is also ty. Usually, you want Ctype.expand_type instead, since the expansion carries useful information; however, in certain circumstances, the error is about the expansion of the type, meaning that actually performing the expansion produces more confusing or inaccurate output.

    type 'a diff = {
    1. got : 'a;
    2. expected : 'a;
    }
    val map_diff : ('a -> 'b) -> 'a diff -> 'b diff

    map_diff f {expected;got} is {expected=f expected; got=f got}

    type 'a escape_kind =
    1. | Constructor of Path.t
    2. | Univ of Types.type_expr
    3. | Self
    4. | Module_type of Path.t
    5. | Equation of 'a
    6. | Constraint

    Scope escape related errors

    type 'a escape = {
    1. kind : 'a escape_kind;
    2. context : Types.type_expr option;
    }
    val map_escape : ('a -> 'b) -> 'a escape -> 'b escape
    val explain : 'a list -> (prev:'a option -> 'a -> 'b option) -> 'b option
    type unification = private
    1. | Unification

    Type indices

    type comparison = private
    1. | Comparison
    type fixed_row_case =
    1. | Cannot_be_closed
    2. | Cannot_add_tags of string list
    type 'variety variant =
    1. | Incompatible_types_for : string -> _ variant
    2. | No_tags : position * (Asttypes.label * Types.row_field) list -> _ variant
    3. | No_intersection : unification variant
    4. | Fixed_row : position +Errortrace (ocaml.Errortrace)

      Module Errortrace

      type position =
      1. | First
      2. | Second
      val swap_position : position -> position
      type expanded_type = {
      1. ty : Types.type_expr;
      2. expanded : Types.type_expr;
      }
      val trivial_expansion : Types.type_expr -> expanded_type

      trivial_expansion ty creates an expanded_type whose expansion is also ty. Usually, you want Ctype.expand_type instead, since the expansion carries useful information; however, in certain circumstances, the error is about the expansion of the type, meaning that actually performing the expansion produces more confusing or inaccurate output.

      type 'a diff = {
      1. got : 'a;
      2. expected : 'a;
      }
      val map_diff : ('a -> 'b) -> 'a diff -> 'b diff

      map_diff f {expected;got} is {expected=f expected; got=f got}

      type 'a escape_kind =
      1. | Constructor of Path.t
      2. | Univ of Types.type_expr
      3. | Self
      4. | Module_type of Path.t
      5. | Equation of 'a
      6. | Constraint

      Scope escape related errors

      type 'a escape = {
      1. kind : 'a escape_kind;
      2. context : Types.type_expr option;
      }
      val map_escape : ('a -> 'b) -> 'a escape -> 'b escape
      val explain : 'a list -> (prev:'a option -> 'a -> 'b option) -> 'b option
      type unification = private
      1. | Unification

      Type indices

      type comparison = private
      1. | Comparison
      type fixed_row_case =
      1. | Cannot_be_closed
      2. | Cannot_add_tags of string list
      type 'variety variant =
      1. | Incompatible_types_for : string -> _ variant
      2. | No_tags : position * (Asttypes.label * Types.row_field) list -> _ variant
      3. | No_intersection : unification variant
      4. | Fixed_row : position * fixed_row_case - * Types.fixed_explanation -> unification variant
      5. | Presence_not_guaranteed_for : position * string -> comparison variant
      6. | Openness : position -> comparison variant
      type 'variety obj =
      1. | Missing_field : position * string -> _ obj
      2. | Abstract_row : position -> _ obj
      3. | Self_cannot_be_closed : unification obj
      type ('a, 'variety) elt =
      1. | Diff : 'a diff -> ('a, _) elt
      2. | Variant : 'variety variant -> ('a, 'variety) elt
      3. | Obj : 'variety obj -> ('a, 'variety) elt
      4. | Escape : 'a escape -> ('a, _) elt
      5. | Incompatible_fields : {
        1. name : string;
        2. diff : Types.type_expr diff;
        } -> ('a, _) elt
      6. | Rec_occur : Types.type_expr * Types.type_expr -> ('a, _) elt
      type ('a, 'variety) t = ('a, 'variety) elt list
      type 'variety trace = (Types.type_expr, 'variety) t
      type 'variety error = (expanded_type, 'variety) t
      val map : ('a -> 'b) -> ('a, 'variety) t -> ('b, 'variety) t
      val incompatible_fields : + * Types.fixed_explanation -> unification variant
    5. | Presence_not_guaranteed_for : position * string -> comparison variant
    6. | Openness : position -> comparison variant
    type 'variety obj =
    1. | Missing_field : position * string -> _ obj
    2. | Abstract_row : position -> _ obj
    3. | Self_cannot_be_closed : unification obj
    type first_class_module =
    1. | Package_cannot_scrape of Path.t
    2. | Package_inclusion of Format_doc.doc
    3. | Package_coercion of Format_doc.doc
    type ('a, 'variety) elt =
    1. | Diff : 'a diff -> ('a, _) elt
    2. | Variant : 'variety variant -> ('a, 'variety) elt
    3. | Obj : 'variety obj -> ('a, 'variety) elt
    4. | Escape : 'a escape -> ('a, _) elt
    5. | Function_label_mismatch of Asttypes.arg_label diff
    6. | Incompatible_fields : {
      1. name : string;
      2. diff : Types.type_expr diff;
      } -> ('a, _) elt
    7. | First_class_module : first_class_module -> ('a, _) elt
    8. | Rec_occur : Types.type_expr * Types.type_expr -> ('a, _) elt
    type ('a, 'variety) t = ('a, 'variety) elt list
    type 'variety trace = (Types.type_expr, 'variety) t
    type 'variety error = (expanded_type, 'variety) t
    val map : ('a -> 'b) -> ('a, 'variety) t -> ('b, 'variety) t
    val incompatible_fields : name:string -> got:Types.type_expr -> expected:Types.type_expr -> diff --git a/ocaml/Errortrace_report/index.html b/ocaml/Errortrace_report/index.html new file mode 100644 index 00000000..3f60af65 --- /dev/null +++ b/ocaml/Errortrace_report/index.html @@ -0,0 +1,43 @@ + +Errortrace_report (ocaml.Errortrace_report)

    Module Errortrace_report

    Functions for reporting core level type errors.

    val ambiguous_type : + Format_doc.formatter -> + Env.t -> + (Path.t * Path.t) -> + (Path.t * Path.t) list -> + Format_doc.t -> + Format_doc.t -> + Format_doc.t -> + unit
    val unification : + Format_doc.formatter -> + Env.t -> + Errortrace.unification_error -> + ?type_expected_explanation:Format_doc.t -> + Format_doc.t -> + Format_doc.t -> + unit
    val subtype : + Format_doc.formatter -> + Env.t -> + Errortrace.Subtype.error -> + string -> + unit
    diff --git a/ocaml/Flambda/index.html b/ocaml/Flambda/index.html index 39779fa4..719fd6d3 100644 --- a/ocaml/Flambda/index.html +++ b/ocaml/Flambda/index.html @@ -1,5 +1,5 @@ -Flambda (ocaml.Flambda)

    Module Flambda

    Intermediate language used for tree-based analysis and optimization.

    type call_kind =
    1. | Indirect
    2. | Direct of Closure_id.t

    Whether the callee in a function application is known at compile time.

    type const =
    1. | Int of int
    2. | Char of char
      (*

      Char is kept separate from Int to improve printing

      *)

    Simple constants. ("Structured constants" are rewritten to invocations of Pmakeblock so that they easily take part in optimizations.)

    type apply = {
    1. func : Variable.t;
    2. args : Variable.t list;
    3. kind : call_kind;
    4. dbg : Debuginfo.t;
    5. inline : Lambda.inline_attribute;
      (*

      Instructions from the source code as to whether the callee should be inlined.

      *)
    6. specialise : Lambda.specialise_attribute;
      (*

      Instructions from the source code as to whether the callee should be specialised.

      *)
    }

    The application of a function to a list of arguments.

    type assign = {
    1. being_assigned : Mutable_variable.t;
    2. new_value : Variable.t;
    }

    The update of a mutable variable. Mutable variables are distinct from immutable variables in Flambda.

    type send = {
    1. kind : Lambda.meth_kind;
    2. meth : Variable.t;
    3. obj : Variable.t;
    4. args : Variable.t list;
    5. dbg : Debuginfo.t;
    }

    The invocation of a method.

    type project_closure = Projection.project_closure

    For details on these types, see projection.mli.

    type move_within_set_of_closures = Projection.move_within_set_of_closures
    type project_var = Projection.project_var
    type specialised_to = {
    1. var : Variable.t;
      (*

      The "outer variable".

      *)
    2. projection : Projection.t option;
      (*

      The projecting_from value (see projection.mli) of any projection must be another free variable or specialised argument (depending on whether this record type is involved in free_vars or specialised_args respectively) in the same set of closures. As such, this field describes a relation of projections between either the free_vars or the specialised_args.

      *)
    }

    See free_vars and specialised_args, below.

    type t =
    1. | Var of Variable.t
    2. | Let of let_expr
    3. | Let_mutable of let_mutable
    4. | Let_rec of (Variable.t * named) list * t
      (*

      CR-someday lwhite: give Let_rec the same fields as Let.

      *)
    5. | Apply of apply
    6. | Send of send
    7. | Assign of assign
    8. | If_then_else of Variable.t * t * t
    9. | Switch of Variable.t * switch
    10. | String_switch of Variable.t * (string * t) list * t option
      (*

      Restrictions on Lambda.Lstringswitch also apply to String_switch.

      *)
    11. | Static_raise of Static_exception.t * Variable.t list
    12. | Static_catch of Static_exception.t * Variable.t list * t * t
    13. | Try_with of t * Variable.t * t
    14. | While of t * t
    15. | For of for_loop
    16. | Proved_unreachable

    Flambda terms are partitioned in a pseudo-ANF manner; many terms are required to be let-bound. This in particular ensures there is always a variable name for an expression that may be lifted out (for example if it is found to be constant). Note: All bound variables in Flambda terms must be distinct. Flambda_invariants verifies this.

    and named =
    1. | Symbol of Symbol.t
    2. | Const of const
    3. | Allocated_const of Allocated_const.t
    4. | Read_mutable of Mutable_variable.t
    5. | Read_symbol_field of Symbol.t * int
      (*

      During the lifting of let bindings to program constructions after closure conversion, we generate symbols and their corresponding definitions (which may or may not be constant), together with field accesses to such symbols. We would like it to be the case that such field accesses are simplified to the relevant component of the symbol concerned. (The rationale is to generate efficient code and share constants as expected: see e.g. tests/asmcomp/staticalloc.ml.) The components of the symbol would be identified by other symbols. This sort of access pattern is feasible because the top-level structure of symbols is statically allocated and fixed at compile time. It may seem that Prim (Pfield, ...) expressions could be used to perform the field accesses. However for simplicity, to avoid having to keep track of properties of individual fields of blocks, Inconstant_idents never deems a Prim (Pfield, ...) expression to be constant. This would in general prevent field accesses to symbols from being simplified in the way we would like, since Lift_constants would not assign new symbols (i.e. the things we would like to simplify to) to the various projections from the symbols in question. To circumvent this problem we use Read_symbol_field when generating projections from the top level of symbols. Owing to the properties of symbols described above, such expressions may be eligible for declaration as constant by Inconstant_idents (and thus themselves lifted to another symbol), without any further complication. Read_symbol_field may only be used when the definition of the symbol is in scope in the program. For external unresolved symbols, Pfield may still be used; it will be changed to Read_symbol_field by Inline_and_simplify when (and if) the symbol is imported.

      *)
    6. | Set_of_closures of set_of_closures
    7. | Project_closure of project_closure
    8. | Move_within_set_of_closures of move_within_set_of_closures
    9. | Project_var of project_var
    10. | Prim of Clambda_primitives.primitive * Variable.t list * Debuginfo.t
    11. | Expr of t
      (*

      ANF escape hatch.

      *)

    Values of type named will always be let-bound to a Variable.t.

    and let_expr = private {
    1. var : Variable.t;
    2. defining_expr : named;
    3. body : t;
    4. free_vars_of_defining_expr : Variable.Set.t;
      (*

      A cache of the free variables in the defining expression of the let.

      *)
    5. free_vars_of_body : Variable.Set.t;
      (*

      A cache of the free variables of the body of the let. This is an important optimization.

      *)
    }
    and let_mutable = {
    1. var : Mutable_variable.t;
    2. initial_value : Variable.t;
    3. contents_kind : Lambda.value_kind;
    4. body : t;
    }
    and set_of_closures = private {
    1. function_decls : function_declarations;
    2. free_vars : specialised_to Variable.Map.t;
      (*

      Mapping from all variables free in the body of the function_decls to variables in scope at the definition point of the set_of_closures. The domain of this map is sometimes known as the "variables bound by the closure".

      *)
    3. specialised_args : specialised_to Variable.Map.t;
      (*

      Parameters whose corresponding arguments are known to always alias a particular value. These are the only parameters that may, during Inline_and_simplify, have non-unknown approximations.

      An argument may only be specialised to a variable in the scope of the corresponding set of closures declaration. Usually, that variable itself also appears in the position of the specialised argument at all call sites of the function. However it may also be the case (for example in code generated as a result of Augment_specialised_args) that the various call sites of such a function have differing variables in the position of the specialised argument. This is permissible *so long as it is certain they all alias the same value*. Great care must be taken in transformations that result in this situation since there are no invariant checks for correctness.

      As an example, supposing all call sites of f are represented here: let x = ... in +Flambda (ocaml.Flambda)

      Module Flambda

      Intermediate language used for tree-based analysis and optimization.

      type call_kind =
      1. | Indirect
      2. | Direct of Closure_id.t

      Whether the callee in a function application is known at compile time.

      type const =
      1. | Int of int
      2. | Char of char
        (*

        Char is kept separate from Int to improve printing

        *)

      Simple constants. ("Structured constants" are rewritten to invocations of Pmakeblock so that they easily take part in optimizations.)

      type apply = {
      1. func : Variable.t;
      2. args : Variable.t list;
      3. kind : call_kind;
      4. dbg : Debuginfo.t;
      5. inline : Lambda.inline_attribute;
        (*

        Instructions from the source code as to whether the callee should be inlined.

        *)
      6. specialise : Lambda.specialise_attribute;
        (*

        Instructions from the source code as to whether the callee should be specialised.

        *)
      }

      The application of a function to a list of arguments.

      type assign = {
      1. being_assigned : Mutable_variable.t;
      2. new_value : Variable.t;
      }

      The update of a mutable variable. Mutable variables are distinct from immutable variables in Flambda.

      type send = {
      1. kind : Lambda.meth_kind;
      2. meth : Variable.t;
      3. obj : Variable.t;
      4. args : Variable.t list;
      5. dbg : Debuginfo.t;
      }

      The invocation of a method.

      type project_closure = Projection.project_closure

      For details on these types, see projection.mli.

      type move_within_set_of_closures = Projection.move_within_set_of_closures
      type project_var = Projection.project_var
      type specialised_to = {
      1. var : Variable.t;
        (*

        The "outer variable".

        *)
      2. projection : Projection.t option;
        (*

        The projecting_from value (see projection.mli) of any projection must be another free variable or specialised argument (depending on whether this record type is involved in free_vars or specialised_args respectively) in the same set of closures. As such, this field describes a relation of projections between either the free_vars or the specialised_args.

        *)
      }

      See free_vars and specialised_args, below.

      type t =
      1. | Var of Variable.t
      2. | Let of let_expr
      3. | Let_mutable of let_mutable
      4. | Apply of apply
      5. | Send of send
      6. | Assign of assign
      7. | If_then_else of Variable.t * t * t
      8. | Switch of Variable.t * switch
      9. | String_switch of Variable.t * (string * t) list * t option
        (*

        Restrictions on Lambda.Lstringswitch also apply to String_switch.

        *)
      10. | Static_raise of Static_exception.t * Variable.t list
      11. | Static_catch of Static_exception.t * Variable.t list * t * t
      12. | Try_with of t * Variable.t * t
      13. | While of t * t
      14. | For of for_loop
      15. | Proved_unreachable

      Flambda terms are partitioned in a pseudo-ANF manner; many terms are required to be let-bound. This in particular ensures there is always a variable name for an expression that may be lifted out (for example if it is found to be constant). Note: All bound variables in Flambda terms must be distinct. Flambda_invariants verifies this.

      and named =
      1. | Symbol of Symbol.t
      2. | Const of const
      3. | Allocated_const of Allocated_const.t
      4. | Read_mutable of Mutable_variable.t
      5. | Read_symbol_field of Symbol.t * int
        (*

        During the lifting of let bindings to program constructions after closure conversion, we generate symbols and their corresponding definitions (which may or may not be constant), together with field accesses to such symbols. We would like it to be the case that such field accesses are simplified to the relevant component of the symbol concerned. (The rationale is to generate efficient code and share constants as expected: see e.g. tests/asmcomp/staticalloc.ml.) The components of the symbol would be identified by other symbols. This sort of access pattern is feasible because the top-level structure of symbols is statically allocated and fixed at compile time. It may seem that Prim (Pfield, ...) expressions could be used to perform the field accesses. However for simplicity, to avoid having to keep track of properties of individual fields of blocks, Inconstant_idents never deems a Prim (Pfield, ...) expression to be constant. This would in general prevent field accesses to symbols from being simplified in the way we would like, since Lift_constants would not assign new symbols (i.e. the things we would like to simplify to) to the various projections from the symbols in question. To circumvent this problem we use Read_symbol_field when generating projections from the top level of symbols. Owing to the properties of symbols described above, such expressions may be eligible for declaration as constant by Inconstant_idents (and thus themselves lifted to another symbol), without any further complication. Read_symbol_field may only be used when the definition of the symbol is in scope in the program. For external unresolved symbols, Pfield may still be used; it will be changed to Read_symbol_field by Inline_and_simplify when (and if) the symbol is imported.

        *)
      6. | Set_of_closures of set_of_closures
      7. | Project_closure of project_closure
      8. | Move_within_set_of_closures of move_within_set_of_closures
      9. | Project_var of project_var
      10. | Prim of Clambda_primitives.primitive * Variable.t list * Debuginfo.t
      11. | Expr of t
        (*

        ANF escape hatch.

        *)

      Values of type named will always be let-bound to a Variable.t.

      and let_expr = private {
      1. var : Variable.t;
      2. defining_expr : named;
      3. body : t;
      4. free_vars_of_defining_expr : Variable.Set.t;
        (*

        A cache of the free variables in the defining expression of the let.

        *)
      5. free_vars_of_body : Variable.Set.t;
        (*

        A cache of the free variables of the body of the let. This is an important optimization.

        *)
      }
      and let_mutable = {
      1. var : Mutable_variable.t;
      2. initial_value : Variable.t;
      3. contents_kind : Lambda.value_kind;
      4. body : t;
      }
      and set_of_closures = private {
      1. function_decls : function_declarations;
      2. free_vars : specialised_to Variable.Map.t;
        (*

        Mapping from all variables free in the body of the function_decls to variables in scope at the definition point of the set_of_closures. The domain of this map is sometimes known as the "variables bound by the closure".

        *)
      3. specialised_args : specialised_to Variable.Map.t;
        (*

        Parameters whose corresponding arguments are known to always alias a particular value. These are the only parameters that may, during Inline_and_simplify, have non-unknown approximations.

        An argument may only be specialised to a variable in the scope of the corresponding set of closures declaration. Usually, that variable itself also appears in the position of the specialised argument at all call sites of the function. However it may also be the case (for example in code generated as a result of Augment_specialised_args) that the various call sites of such a function have differing variables in the position of the specialised argument. This is permissible *so long as it is certain they all alias the same value*. Great care must be taken in transformations that result in this situation since there are no invariant checks for correctness.

        As an example, supposing all call sites of f are represented here: let x = ... in let f a b c = ... in let y = ... in f x y 1; diff --git a/ocaml/Flambda_iterators/index.html b/ocaml/Flambda_iterators/index.html index 4065a37e..9c82bad2 100644 --- a/ocaml/Flambda_iterators/index.html +++ b/ocaml/Flambda_iterators/index.html @@ -25,10 +25,10 @@ unit

      val iter_on_set_of_closures_of_program : Flambda.program -> f:(constant:bool -> Flambda.set_of_closures -> unit) -> - unit
      val iter_all_immutable_let_and_let_rec_bindings : + unit
      val iter_all_immutable_let_bindings : Flambda.t -> f:(Variable.t -> Flambda.named -> unit) -> - unit
      val iter_all_toplevel_immutable_let_and_let_rec_bindings : + unit
      val iter_all_toplevel_immutable_let_bindings : Flambda.t -> f:(Variable.t -> Flambda.named -> unit) -> unit
      val iter_exprs_at_toplevel_of_program : diff --git a/ocaml/Format_doc/Doc/index.html b/ocaml/Format_doc/Doc/index.html new file mode 100644 index 00000000..e08b5137 --- /dev/null +++ b/ocaml/Format_doc/Doc/index.html @@ -0,0 +1,9 @@ + +Doc (ocaml.Format_doc.Doc)

      Module Format_doc.Doc

      Definitions and immutable API for composing documents

      Type definitions and core functions

      type box_type =
      1. | H
      2. | V
      3. | HV
      4. | HoV
      5. | B

      Format box types

      type stag = Stdlib.Format.stag
      type element =
      1. | Text of string
      2. | With_size of int
      3. | Open_box of {
        1. kind : box_type;
        2. indent : int;
        }
      4. | Close_box
      5. | Open_tag of Stdlib.Format.stag
      6. | Close_tag
      7. | Open_tbox
      8. | Tab_break of {
        1. width : int;
        2. offset : int;
        }
      9. | Set_tab
      10. | Close_tbox
      11. | Simple_break of {
        1. spaces : int;
        2. indent : int;
        }
      12. | Break of {
        1. fits : (string * int * string) as 'a;
        2. breaks : 'a;
        }
      13. | Flush of {
        1. newline : bool;
        }
      14. | Newline
      15. | If_newline
      16. | Deprecated of Stdlib.Format.formatter -> unit
        (*

        Escape hatch: a Format printer used to provide backward-compatibility for user-defined printer (from the #install_printer toplevel directive for instance).

        *)

      Base formatting instruction recognized by Format

      type t

      Immutable document type

      type ('a, 'b) fmt = ('a, t, t, 'b) format4
      type printer0 = t -> t
      type 'a printer = 'a -> printer0
      val empty : t

      Empty document

      val format : Stdlib.Format.formatter -> t -> unit

      format ppf doc sends the format instruction of doc to the Format's formatter doc.

      val fold : ('acc -> element -> 'acc) -> 'acc -> t -> 'acc

      Fold over a document as a sequence of instructions

      val msg : ('a, t) fmt -> 'a

      msg and kmsg produce a document from a format string and its argument

      val kmsg : (t -> 'b) -> ('a, 'b) fmt -> 'a
      val printf : ('a, printer0) fmt -> 'a

      printf and kprintf produce a printer from a format string and its argument

      val kprintf : (t -> 'b) -> ('a, t -> 'b) fmt -> 'a
      val open_box : box_type -> int -> printer0

      The functions below mirror Format printers, without the pp_print_ prefix naming convention

      val close_box : printer0
      val text : string printer
      val string : string printer
      val bytes : bytes printer
      val with_size : int printer
      val int : int printer
      val float : float printer
      val char : char printer
      val bool : bool printer
      val space : printer0
      val cut : printer0
      val break : spaces:int -> indent:int -> printer0
      val custom_break : fits:(string * int * string) as 'a -> breaks:'a -> printer0
      val force_newline : printer0
      val if_newline : printer0
      val flush : printer0
      val force_stop : printer0
      val open_tbox : printer0
      val set_tab : printer0
      val tab : printer0
      val tab_break : width:int -> offset:int -> printer0
      val close_tbox : printer0
      val open_tag : stag printer
      val close_tag : printer0
      val list : ?sep:printer0 -> 'a printer -> 'a list printer
      val iter : + ?sep:printer0 -> + iter:(('a -> unit) -> 'b -> unit) -> + 'a printer -> + 'b printer
      val array : ?sep:printer0 -> 'a printer -> 'a array printer
      val seq : ?sep:printer0 -> 'a printer -> 'a Stdlib.Seq.t printer
      val option : ?none:printer0 -> 'a printer -> 'a option printer
      val result : ok:'a printer -> error:'e printer -> ('a, 'e) result printer
      val either : + left:'a printer -> + right:'b printer -> + ('a, 'b) Stdlib.Either.t printer
      diff --git a/ocaml/Format_doc/index.html b/ocaml/Format_doc/index.html new file mode 100644 index 00000000..c33d06d0 --- /dev/null +++ b/ocaml/Format_doc/index.html @@ -0,0 +1,44 @@ + +Format_doc (ocaml.Format_doc)

      Module Format_doc

      Composable document for the Format formatting engine.

      This module introduces a pure and immutable document type which represents a sequence of formatting instructions to be printed by a formatting engine at later point. At the same time, it also provides format string interpreter which produces this document type from format string and their associated printers.

      The module is designed to be source compatible with code defining format printers: replacing `Format` by `Format_doc` in your code will convert `Format` printers to `Format_doc` printers.

      module Doc : sig ... end

      Definitions and immutable API for composing documents

      Compatibility API

      The functions and types below provides source compatibility with format printers and conversion function from Format_doc printers to Format printers. The reverse direction is implemented using an escape hatch in the formatting instruction and should only be used to preserve backward compatibility.

      type doc = Doc.t
      type t = doc
      type formatter
      type 'a printer = formatter -> 'a -> unit
      val formatter : doc ref -> formatter

      formatter rdoc creates a formatter that updates the rdoc reference

      type 'a format_printer = Stdlib.Format.formatter -> 'a -> unit

      Translate a Format_doc printer to a Format one.

      val compat : 'a printer -> 'a format_printer
      val compat1 : ('p1 -> 'a printer) -> 'p1 -> 'a format_printer
      val compat2 : ('p1 -> 'p2 -> 'a printer) -> 'p1 -> 'p2 -> 'a format_printer
      val deprecated_printer : (Stdlib.Format.formatter -> unit) -> formatter -> unit

      If necessary, embbed a Format printer inside a formatting instruction stream. This breaks every guarantees provided by Format_doc.

      val deprecated : 'a format_printer -> 'a printer
      val deprecated1 : ('p1 -> 'a format_printer) -> 'p1 -> 'a printer

      Format string interpreters

      val fprintf : formatter -> ('a, formatter, unit) format -> 'a
      val kfprintf : + (formatter -> 'a) -> + formatter -> + ('b, formatter, unit, 'a) format4 -> + 'b
      val asprintf : ('a, formatter, unit, string) format4 -> 'a
      val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b
      val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a
      val kdprintf : + ((formatter -> unit) -> 'a) -> + ('b, formatter, unit, 'a) format4 -> + 'b
      val doc_printf : ('a, formatter, unit, doc) format4 -> 'a

      doc_printf and kdoc_printf creates a document directly

      val kdoc_printf : (doc -> 'r) -> ('a, formatter, unit, 'r) format4 -> 'a

      Compatibility with Doc

      val doc_printer : 'a printer -> 'a Doc.printer
      val pp_doc : doc printer

      Source compatibility with Format

      String printers

      val pp_print_string : string printer
      val pp_print_substring : pos:int -> len:int -> string printer
      val pp_print_text : string printer
      val pp_print_bytes : bytes printer
      val pp_print_as : formatter -> int -> string -> unit
      val pp_print_substring_as : + pos:int -> + len:int -> + formatter -> + int -> + string -> + unit

      Primitive type printers

      val pp_print_char : char printer
      val pp_print_int : int printer
      val pp_print_float : float printer
      val pp_print_bool : bool printer
      val pp_print_nothing : unit printer

      Printer combinators

      val pp_print_iter : + ?pp_sep:unit printer -> + (('a -> unit) -> 'b -> unit) -> + 'a printer -> + 'b printer
      val pp_print_list : ?pp_sep:unit printer -> 'a printer -> 'a list printer
      val pp_print_array : ?pp_sep:unit printer -> 'a printer -> 'a array printer
      val pp_print_seq : + ?pp_sep:unit printer -> + 'a printer -> + 'a Stdlib.Seq.t printer
      val pp_print_option : ?none:unit printer -> 'a printer -> 'a option printer
      val pp_print_result : + ok:'a printer -> + error:'e printer -> + ('a, 'e) result printer
      val pp_print_either : + left:'a printer -> + right:'b printer -> + ('a, 'b) Stdlib.Either.t printer

      Boxes and tags

      val pp_open_stag : Stdlib.Format.stag printer
      val pp_close_stag : unit printer
      val pp_open_box : int printer
      val pp_close_box : unit printer

      Break hints

      val pp_print_space : unit printer
      val pp_print_cut : unit printer
      val pp_print_break : formatter -> int -> int -> unit
      val pp_print_custom_break : + formatter -> + fits:(string * int * string) as 'c -> + breaks:'c -> + unit

      Tabulations

      val pp_open_tbox : unit printer
      val pp_close_tbox : unit printer
      val pp_set_tab : unit printer
      val pp_print_tab : unit printer
      val pp_print_tbreak : formatter -> int -> int -> unit

      Newlines and flushing

      val pp_print_if_newline : unit printer
      val pp_force_newline : unit printer
      val pp_print_flush : unit printer
      val pp_print_newline : unit printer

      Compiler specific functions

      Separators

      val comma : unit printer

      Compiler output

      val pp_two_columns : + ?sep:string -> + ?max_lines:int -> + formatter -> + (string * string) list -> + unit

      pp_two_columns ?sep ?max_lines ppf l prints the lines in l as two columns separated by sep ("|" by default). max_lines can be used to indicate a maximum number of lines to print -- an ellipsis gets inserted at the middle if the input has too many lines.

      Example:

      pp_two_columns ~max_lines:3 Format.std_formatter [
      +      "abc", "hello";
      +      "def", "zzz";
      +      "a"  , "bllbl";
      +      "bb" , "dddddd";
      +    ]

      prints

          abc | hello
      +    ...
      +    bb  | dddddd
      diff --git a/ocaml/Freshening/index.html b/ocaml/Freshening/index.html index 7711d3da..d1d3be3e 100644 --- a/ocaml/Freshening/index.html +++ b/ocaml/Freshening/index.html @@ -1,5 +1,8 @@ -Freshening (ocaml.Freshening)

      Module Freshening

      Freshening of various identifiers.

      type t

      A table used for freshening variables and static exception identifiers.

      type subst = t
      val empty : t

      The freshening that does nothing. This is the unique inactive freshening.

      val is_empty : t -> bool
      val activate : t -> t

      Activate the freshening. Without activation, operations to request freshenings have no effect (cf. the documentation below for add_variable). As such, the inactive renaming is unique.

      val empty_preserving_activation_state : t -> t

      Given the inactive freshening, return the same; otherwise, return an empty active freshening.

      val add_variable : t -> Variable.t -> Variable.t * t

      add_variable t var If t is active: It returns a fresh variable new_var and adds var -> new_var to the freshening. If a renaming other_var -> var or symbol -> var was already present in t, it will also add other_var -> new_var and symbol -> new_var. If t is inactive, this is the identity.

      val add_variables' : t -> Variable.t list -> Variable.t list * t

      Like add_variable, but for multiple variables, each freshened separately.

      val add_variables : t -> (Variable.t * 'a) list -> (Variable.t * 'a) list * t

      Like add_variables', but passes through the second component of the input list unchanged.

      val add_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t * t

      Like add_variable, but for mutable variables.

      val add_static_exception : t -> Static_exception.t -> Static_exception.t * t

      As for add_variable, but for static exception identifiers.

      val apply_variable : t -> Variable.t -> Variable.t

      apply_variable t var applies the freshening t to var. If no renaming is specified in t for var it is returned unchanged.

      val apply_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t

      As for apply_variable, but for mutable variables.

      val apply_static_exception : t -> Static_exception.t -> Static_exception.t

      As for apply_variable, but for static exception identifiers.

      val rewrite_recursive_calls_with_symbols : +Freshening (ocaml.Freshening)

      Module Freshening

      Freshening of various identifiers.

      type t

      A table used for freshening variables and static exception identifiers.

      type subst = t
      val empty : t

      The freshening that does nothing. This is the unique inactive freshening.

      val is_empty : t -> bool
      val activate : t -> t

      Activate the freshening. Without activation, operations to request freshenings have no effect (cf. the documentation below for add_variable). As such, the inactive renaming is unique.

      val empty_preserving_activation_state : t -> t

      Given the inactive freshening, return the same; otherwise, return an empty active freshening.

      val add_variable : t -> Variable.t -> Variable.t * t

      add_variable t var If t is active: It returns a fresh variable new_var and adds var -> new_var to the freshening. If a renaming other_var -> var or symbol -> var was already present in t, it will also add other_var -> new_var and symbol -> new_var. If t is inactive, this is the identity.

      val add_variables' : t -> Variable.t list -> Variable.t list * t

      Like add_variable, but for multiple variables, each freshened separately.

      val add_variables : t -> (Variable.t * 'a) list -> (Variable.t * 'a) list * t

      Like add_variables', but passes through the second component of the input list unchanged.

      val add_variables3 : + t -> + (Variable.t * 'a * 'b) list -> + (Variable.t * 'a * 'b) list * t

      Like add_variables', but passes through the other components of the input list unchanged.

      val add_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t * t

      Like add_variable, but for mutable variables.

      val add_static_exception : t -> Static_exception.t -> Static_exception.t * t

      As for add_variable, but for static exception identifiers.

      val apply_variable : t -> Variable.t -> Variable.t

      apply_variable t var applies the freshening t to var. If no renaming is specified in t for var it is returned unchanged.

      val apply_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t

      As for apply_variable, but for mutable variables.

      val apply_static_exception : t -> Static_exception.t -> Static_exception.t

      As for apply_variable, but for static exception identifiers.

      val rewrite_recursive_calls_with_symbols : t -> Flambda.function_declarations -> make_closure_symbol:(Closure_id.t -> Symbol.t) -> diff --git a/ocaml/Gprinttyp/Decoration/index.html b/ocaml/Gprinttyp/Decoration/index.html new file mode 100644 index 00000000..75a12dad --- /dev/null +++ b/ocaml/Gprinttyp/Decoration/index.html @@ -0,0 +1,2 @@ + +Decoration (ocaml.Gprinttyp.Decoration)

      Module Gprinttyp.Decoration

      Node and decoration types

      type color =
      1. | Named of string
      2. | HSL of {
        1. h : float;
        2. s : float;
        3. l : float;
        }
      val green : color
      val blue : color
      val red : color
      val purple : color
      val hsl : h:float -> s:float -> l:float -> color
      type style =
      1. | Filled of color option
      2. | Dotted
      3. | Dash
      type shape =
      1. | Ellipse
      2. | Circle
      3. | Diamond
      type property =
      1. | Color of color
      2. | Font_color of color
      3. | Style of style
      4. | Label of string list
      5. | Shape of shape
      val filled : color -> property
      val txt : string -> property
      val make : property list -> decoration
      diff --git a/ocaml/Gprinttyp/index.html b/ocaml/Gprinttyp/index.html new file mode 100644 index 00000000..ee34e035 --- /dev/null +++ b/ocaml/Gprinttyp/index.html @@ -0,0 +1,103 @@ + +Gprinttyp (ocaml.Gprinttyp)

      Module Gprinttyp

      This module provides function for printing type expressions as digraph using graphviz format. This is mostly aimed at providing a better representation of type expressions during debugging session.

      A type node is printed as

      .------------.
      +| <desc>  id |---->
      +|            |--->
      +.------------.

      where the description part might be:

      • a path: list/8!
      • a type variable: 'name, α, β, γ
      • * for tuples
      • for arrows type
      • an universal type variable: [β]∀, 'name ∀, ...
      • [mod X with ...] for a first class module
      • for a universal type binder

      The more complex encoding for polymorphic variants and object types uses nodes as head of the subgraph representing those types

      • [obj...] for the head of an object subgraph
      • [Nil] for the end of an object subgraph
      • [Row...] for the head of a polymorphic variant subgraph
      • [Subst] for a temporary substitution node

      Then each nodes is relied by arrows to any of its children types.

      • Type variables, universal type variables, Nil, and Subst nodes don't have children.
      • For tuples, the children types are the elements of the tuple. For instance, int * float is represented as

        .------.   0     .-------.
        +| *  1 |-------->| int! 2|
        +.------.         .-------.
        +   |
        +   | 1
        +   v
        + .----------.
        + | float! 3 |
        + .----------.
      • For arrows, the children types are the type of the argument and the result type. For instance, for int -> float:

        .------.   0     .-------.
        +| →  4 |-------->| int! 2|
        +.------.         .-------.
        +   |
        +   | 1
        +   v
        + .----------.
        + | float! 3 |
        + .----------.
      • For type constructor, like list the main children nodes are the argument types. For instance, (int,float) result is represented as:
      .-------------.   0     .-------.
      +| Result.t  5 |-------->| int! 2|
      +.-------------.         .-------.
      +   |
      +   | 1
      +   v
      + .----------.
      + | float! 3 |
      + .----------.

      Moreover, type abbreviations might be linked to the expanded nodes. If I define: type 'a pair = 'a * 'a, a type expression int pair might correspond to the nodes:

      .--------.   0    .--------.
      +| pair 6 |------> | int! 2 |
      +.--------.        .--------.
      +   ┆                  ^
      +   ┆ expand           |
      +   ┆                  |
      +.------.   0 + 1      |
      +| *  7 |------>-------.
      +.------.
      • Universal type binders have two kind of children: bound variables, and the main body. For instance, 'a. 'a -> 'a is represented as

        .------.   bind    .-------.
        +|  ∀ 8 |----------> | 𝛼 10 |
        +.------.            .------.
        +   |                  ^
        +   |                  |
        +   v                  |
        +.------.   0 + 1      |
        +| →  9 |------>-------.
        +.------.
      • [Subst] node are children are the type graph guarded by the substitution node, and an eventual link to the parent row variable.
      • The children of first-class modules are the type expressions that may appear in the right hand side of constraints. For instance, module M with type t = 'a and type u = 'b is represented as

        .----------------------.   0     .-----.
        +| [mod M with t, u] 11 |-------->| 𝛼 12|
        +.----------------------.         .-----
        +   |
        +   | 1
        +   v
        + .------.
        + | 𝛽 13 |
        + .------.
      • The children of obj (resp. row) are the methods (resp. constructor) of the object type (resp. polymorphic variant). Each method is then linked to its type. To make them easier to read they are grouped inside graphviz cluster. For instance, <a:int; m:'self; ..> as 'self will be represented as:
      .----------------.
      +| .----------.    |
      +| | [obj] 14 |<------<-----<-----.
      +| .----------.    |              |
      +|       ┆         |              |
      +| .-------------. |    .------.  |    .-------.
      +| | a public 15 |----->| ∀ 18 |----->| int! 2 |
      +| .-------------. |    .------.  |    .-------.
      +|        ┆        |              |
      +| .-------------. |   .------.   |
      +| | m public 16 |-----| ∀ 19 |>--|
      +| .------------.  |   .------.
      +|     ┆           |
      +|     ┆ row var   |
      +|     ┆           |
      +|   .-------.     |
      +|   | '_ 17 |     |
      +|   .-------.     |
      +.-----------------.
      type digraph

      Digraph with nodes, edges, hyperedges and subgraphes

      type params

      Various possible choices on how to represent types, see the params functions for more detail.

      type element

      Graph element, see the node, edge and hyperedge function

      type decoration

      Visual decoration on graph elements, see the Decoration module.

      val types : + title:string -> + params -> + (decoration * Types.type_expr) list -> + unit

      Print a graph to the file asprintf "%s/%04d-%s-%a.dot" + dump_dir + session_unique_id + title + pp_context context +

      If the dump_dir flag is not set, the local directory is used. See the context type on how and why to setup the context.

      val nodes : title:string -> params -> (decoration * element) list -> unit

      Full version of types that allow to print any kind of graph element

      val params : + ?elide_links:bool -> + ?expansion_as_hyperedge:bool -> + ?short_ids:bool -> + ?colorize:bool -> + ?follow_expansions:bool -> + unit -> + params

      Choice of details for printing type graphes:

      • if elide_links is true link nodes are not displayed (default:true)
      • with expansion_as_hyperedge, memoized constructor expansion are displayed as a hyperedge between the node storing the memoized expansion, the expanded node and the expansion (default:false).
      • with short_ids, we use an independent counter for node ids, in order to have shorter ids for small digraphs (default:true).
      • with colorize nodes are colorized according to their typechecker ids (default:true).
      • with follow_expansions, we add memoized type constructor expansions to the digraph (default:true).
      val update_params : + ?elide_links:bool -> + ?expansion_as_hyperedge:bool -> + ?short_ids:bool -> + ?colorize:bool -> + ?follow_expansions:bool -> + params -> + params

      Update an existing params with new values.

      val node : Types.type_expr -> element
      type dir =
      1. | Toward
      2. | From
      val hyperedge : (dir * decoration * Types.type_expr) list -> element

      Edges between more than two elements.

      module Decoration : sig ... end

      Digraph construction and printing

      val make : params -> (decoration * element) list -> digraph
      val add : params -> (decoration * element) list -> digraph -> digraph
      val add_subgraph : + params -> + decoration -> + (decoration * element) list -> + digraph -> + digraph

      add a subgraph to a digraph, only fresh nodes are added to the subgraph

      val group_nodes : (decoration * digraph) -> digraph -> digraph

      groups existing nodes inside a subgraph

      val pp : Stdlib.Format.formatter -> digraph -> unit

      Debugging helper functions

      Generic print debugging function

      val debug_on : (unit -> bool) ref

      Conditional graph printing

      val debug_off : (unit -> 'a) -> 'a

      debug_off f switches off debugging before running f.

      val debug : (unit -> unit) -> unit

      debug f runs f when !debug_on ()

      Node tracking functions

      val register_type : (decoration * Types.type_expr) -> unit

      register_type (lbl,ty) adds the type t to all graph printed until forget is called

      val register_subgraph : + params -> + ?decoration:decoration -> + Types.type_expr list -> + unit

      register_subgraph params tys groups together all types reachable from tys at this point in printed digraphs, until forget is called

      val forget : unit -> unit

      Forget all recorded context types

      type 'a context

      Contextual information

      Those functions can be used to modify the filename of the generated digraphs. Use those functions to provide contextual information on a graph emitted during an execution trace.

      val global : string context
      val set_context : 'a context -> 'a -> unit
      val with_context : 'a context -> 'a -> (unit -> 'b) -> 'b
      diff --git a/ocaml/Ident/index.html b/ocaml/Ident/index.html index 42a6a37f..7872296c 100644 --- a/ocaml/Ident/index.html +++ b/ocaml/Ident/index.html @@ -1,2 +1,2 @@ -Ident (ocaml.Ident)

      Module Ident

      type t
      include Identifiable.S with type t := t
      module T : Identifiable.Thing with type t = t
      include Identifiable.Thing with type t := T.t
      include Hashtbl.HashedType with type t := T.t
      val equal : T.t -> T.t -> bool

      The equality predicate used to compare keys.

      val hash : T.t -> int

      A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

      • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
      • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
      • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
      include Map.OrderedType with type t := T.t
      val output : out_channel -> T.t -> unit
      val print : Stdlib.Format.formatter -> T.t -> unit
      module Set : Identifiable.Set with module T := T
      module Map : Identifiable.Map with module T := T
      module Tbl : Identifiable.Tbl with module T := T
      val print_with_scope : Stdlib.Format.formatter -> t -> unit

      Same as print except that it will also add a "n" suffix if the scope of the argument is n.

      val create_scoped : scope:int -> string -> t
      val create_local : string -> t
      val create_persistent : string -> t
      val create_predef : string -> t
      val rename : t -> t

      Creates an identifier with the same name as the input, a fresh stamp, and no scope.

      • raises [Fatal_error]

        if called on a persistent / predef ident.

      val name : t -> string
      val unique_name : t -> string
      val unique_toplevel_name : t -> string
      val persistent : t -> bool
      val same : t -> t -> bool

      Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

      val compare : t -> t -> int
      val global : t -> bool
      val is_predef : t -> bool
      val scope : t -> int
      val lowest_scope : int
      val highest_scope : int
      val reinit : unit -> unit
      type 'a tbl

      'a tbl represents association tables from identifiers to values of type 'a.

      'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

      find_all returns the bindings for all idents of a given name, most recently introduced first.

      In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

      Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

      You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

      val empty : 'a tbl
      val add : t -> 'a -> 'a tbl -> 'a tbl
      val find_same : t -> 'a tbl -> 'a
      val find_name : string -> 'a tbl -> t * 'a
      val find_all : string -> 'a tbl -> (t * 'a) list
      val find_all_seq : string -> 'a tbl -> (t * 'a) Stdlib.Seq.t
      val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
      val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
      val iter : (t -> 'a -> unit) -> 'a tbl -> unit
      val remove : t -> 'a tbl -> 'a tbl
      val make_key_generator : unit -> t -> t
      +Ident (ocaml.Ident)

      Module Ident

      type t
      include Identifiable.S with type t := t
      module T : Identifiable.Thing with type t = t
      include Identifiable.Thing with type t := T.t
      include Hashtbl.HashedType with type t := T.t
      val equal : T.t -> T.t -> bool

      The equality predicate used to compare keys.

      val hash : T.t -> int

      A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

      • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
      • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
      • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
      include Map.OrderedType with type t := T.t
      val output : out_channel -> T.t -> unit
      val print : Stdlib.Format.formatter -> T.t -> unit
      module Set : Identifiable.Set with module T := T
      module Map : Identifiable.Map with module T := T
      module Tbl : Identifiable.Tbl with module T := T
      val doc_print : t Format_doc.printer
      val print_with_scope : t Format_doc.printer

      Same as print except that it will also add a "n" suffix if the scope of the argument is n.

      val create_scoped : scope:int -> string -> t
      val create_local : string -> t
      val create_persistent : string -> t
      val create_predef : string -> t
      val rename : t -> t

      Creates an identifier with the same name as the input, a fresh stamp, and no scope.

      • raises [Fatal_error]

        if called on a persistent / predef ident.

      val name : t -> string
      val unique_name : t -> string
      val unique_toplevel_name : t -> string
      val persistent : t -> bool
      val same : t -> t -> bool

      Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

      val compare_stamp : t -> t -> int

      Compare only the internal stamps, 0 if absent

      val compare : t -> t -> int

      Compare identifiers structurally, including the name

      val global : t -> bool
      val is_predef : t -> bool
      val scope : t -> int
      val lowest_scope : int
      val highest_scope : int
      val reinit : unit -> unit
      type 'a tbl

      'a tbl represents association tables from identifiers to values of type 'a.

      'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

      find_all returns the bindings for all idents of a given name, most recently introduced first.

      In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

      Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

      You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

      val empty : 'a tbl
      val add : t -> 'a -> 'a tbl -> 'a tbl
      val find_same : t -> 'a tbl -> 'a
      val find_name : string -> 'a tbl -> t * 'a
      val find_all : string -> 'a tbl -> (t * 'a) list
      val find_all_seq : string -> 'a tbl -> (t * 'a) Stdlib.Seq.t
      val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
      val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
      val iter : (t -> 'a -> unit) -> 'a tbl -> unit
      val remove : t -> 'a tbl -> 'a tbl
      val make_key_generator : unit -> t -> t
      diff --git a/ocaml/Includeclass/index.html b/ocaml/Includeclass/index.html index fd7d6de3..8b82466c 100644 --- a/ocaml/Includeclass/index.html +++ b/ocaml/Includeclass/index.html @@ -13,7 +13,7 @@ Types.class_declaration -> Types.class_declaration -> Ctype.class_match_failure list
      val report_error : - Printtyp.type_or_scheme -> - Stdlib.Format.formatter -> - Ctype.class_match_failure list -> - unit
      + Out_type.type_or_scheme -> + Ctype.class_match_failure list Format_doc.format_printer
      diff --git a/ocaml/Includecore/index.html b/ocaml/Includecore/index.html index ff2d176f..2c1d5202 100644 --- a/ocaml/Includecore/index.html +++ b/ocaml/Includecore/index.html @@ -28,24 +28,27 @@ Ident.t -> Types.extension_constructor -> Types.extension_constructor -> - extension_constructor_mismatch option
      val report_value_mismatch : + extension_constructor_mismatch option
      val value_descriptions_consistency : + Env.t -> + Types.value_description -> + Types.value_description -> + Typedtree.module_coercion

      The functions value_descriptions_consistency and type_declarations_consistency check if two declaration are consistent. Declarations are consistent when there exists an environment such that the first declaration is a subtype of the second one.

      Notably, if a type declaration td1 is consistent with td2 then a type expression te which is well-formed with the td2 declaration in scope is still well-formed with the td1 declaration: E, td2 |- te => E, td1 + |- te.

      val type_declarations_consistency : + Env.t -> + Types.type_declaration -> + Types.type_declaration -> + type_mismatch option
      val report_value_mismatch : string -> string -> Env.t -> - Stdlib.Format.formatter -> - value_mismatch -> - unit
      val report_type_mismatch : + value_mismatch Format_doc.printer
      val report_type_mismatch : string -> string -> string -> Env.t -> - Stdlib.Format.formatter -> - type_mismatch -> - unit
      val report_extension_constructor_mismatch : + type_mismatch Format_doc.printer
      val report_extension_constructor_mismatch : string -> string -> string -> Env.t -> - Stdlib.Format.formatter -> - extension_constructor_mismatch -> - unit
      + extension_constructor_mismatch Format_doc.printer
    diff --git a/ocaml/Includemod/index.html b/ocaml/Includemod/index.html index f12921b5..204c467d 100644 --- a/ocaml/Includemod/index.html +++ b/ocaml/Includemod/index.html @@ -1,22 +1,27 @@ -Includemod (ocaml.Includemod)

    Module Includemod

    type mark =
    1. | Mark_both
      (*

      Mark definitions used from both arguments

      *)
    2. | Mark_positive
      (*

      Mark definitions used from the positive (first) argument

      *)
    3. | Mark_negative
      (*

      Mark definitions used from the negative (second) argument

      *)
    4. | Mark_neither
      (*

      Do not mark definitions used from either argument

      *)

    Type describing which arguments of an inclusion to consider as used for the usage warnings. Mark_both is the default.

    module Error : sig ... end
    type explanation = Env.t * Error.all
    type field_kind =
    1. | Field_value
    2. | Field_type
    3. | Field_exception
    4. | Field_typext
    5. | Field_module
    6. | Field_modtype
    7. | Field_class
    8. | Field_classtype
    type field_desc = {
    1. name : string;
    2. kind : field_kind;
    }
    val kind_of_field_desc : field_desc -> string
    val field_desc : field_kind -> Ident.t -> field_desc
    module FieldMap : Map.S with type key = field_desc

    Map indexed by both field types and names. This avoids name clashes between different sorts of fields such as values and types.

    val item_ident_name : Types.signature_item -> Ident.t * Location.t * field_desc
    val is_runtime_component : Types.signature_item -> bool
    val modtypes : +Includemod (ocaml.Includemod)

    Module Includemod

    module Error : sig ... end
    type explanation = Env.t * Error.all
    type field_kind =
    1. | Field_value
    2. | Field_type
    3. | Field_exception
    4. | Field_typext
    5. | Field_module
    6. | Field_modtype
    7. | Field_class
    8. | Field_classtype
    type field_desc = {
    1. name : string;
    2. kind : field_kind;
    }
    val kind_of_field_desc : field_desc -> string
    val field_desc : field_kind -> Ident.t -> field_desc
    module FieldMap : Map.S with type key = field_desc

    Map indexed by both field types and names. This avoids name clashes between different sorts of fields such as values and types.

    val item_ident_name : Types.signature_item -> Ident.t * Location.t * field_desc
    val is_runtime_component : Types.signature_item -> bool
    val modtypes : loc:Location.t -> Env.t -> - mark:mark -> + mark:bool -> Types.module_type -> Types.module_type -> - Typedtree.module_coercion
    val modtypes_with_shape : + Typedtree.module_coercion
    val modtypes_consistency : + loc:Location.t -> + Env.t -> + Types.module_type -> + Types.module_type -> + unit
    val modtypes_with_shape : shape:Shape.t -> loc:Location.t -> Env.t -> - mark:mark -> + mark:bool -> Types.module_type -> Types.module_type -> Typedtree.module_coercion * Shape.t
    val strengthened_module_decl : loc:Location.t -> aliasable:bool -> Env.t -> - mark:mark -> + mark:bool -> Types.module_declaration -> Path.t -> Types.module_declaration -> @@ -34,12 +39,12 @@ Types.module_type -> unit
    val signatures : Env.t -> - mark:mark -> + mark:bool -> Types.signature -> Types.signature -> - Typedtree.module_coercion
    val compunit : + Typedtree.module_coercion
    val check_implementation : Env.t -> Types.signature -> Types.signature -> unit

    Check an implementation against an interface

    val compunit : Env.t -> - mark:mark -> + mark:bool -> string -> Types.signature -> string -> @@ -48,7 +53,7 @@ Typedtree.module_coercion * Shape.t
    val type_declarations : loc:Location.t -> Env.t -> - mark:mark -> + mark:bool -> Ident.t -> Types.type_declaration -> Types.type_declaration -> @@ -72,7 +77,7 @@ * Ctype.class_match_failure list
  • | Class_declarations of Ident.t * Types.class_declaration * Types.class_declaration - * Ctype.class_match_failure list
  • | Unbound_module_path of Path.t
  • | Invalid_module_alias of Path.t
  • type pos =
    1. | Module of Ident.t
    2. | Modtype of Ident.t
    3. | Arg of Types.functor_parameter
    4. | Body of Types.functor_parameter
    exception Error of explanation
    exception Apply_error of {
    1. loc : Location.t;
    2. env : Env.t;
    3. lid_app : Longident.t option;
    4. mty_f : Types.module_type;
    5. args : (Error.functor_arg_descr * Types.module_type) list;
    }
    val expand_module_alias : + * Ctype.class_match_failure list
  • | Unbound_module_path of Path.t
  • | Invalid_module_alias of Path.t
  • type pos =
    1. | Module of Ident.t
    2. | Modtype of Ident.t
    3. | Arg of Types.functor_parameter
    4. | Body of Types.functor_parameter
    exception Error of explanation
    type application_name =
    1. | Anonymous_functor
      (*

      (functor (_:sig end) -> struct end)(Int)

      *)
    2. | Full_application_path of Longident.t
      (*

      F(G(X).P)(Y)

      *)
    3. | Named_leftmost_functor of Longident.t
      (*

      F(struct end)...(...)

      *)
    exception Apply_error of {
    1. loc : Location.t;
    2. env : Env.t;
    3. app_name : application_name;
    4. mty_f : Types.module_type;
    5. args : (Error.functor_arg_descr * Types.module_type) list;
    }
    val expand_module_alias : strengthen:bool -> Env.t -> Path.t -> diff --git a/ocaml/Includemod_errorprinter/index.html b/ocaml/Includemod_errorprinter/index.html index 4846b3d5..1c4487a7 100644 --- a/ocaml/Includemod_errorprinter/index.html +++ b/ocaml/Includemod_errorprinter/index.html @@ -1,2 +1,6 @@ -Includemod_errorprinter (ocaml.Includemod_errorprinter)

    Module Includemod_errorprinter

    val register : unit -> unit
    +Includemod_errorprinter (ocaml.Includemod_errorprinter)

    Module Includemod_errorprinter

    val coercion_in_package_subtype : + Env.t -> + Types.module_type -> + Typedtree.module_coercion -> + Format_doc.doc
    val register : unit -> unit
    diff --git a/ocaml/Instruct/index.html b/ocaml/Instruct/index.html index 5a9eb491..bce62713 100644 --- a/ocaml/Instruct/index.html +++ b/ocaml/Instruct/index.html @@ -1,2 +1,2 @@ -Instruct (ocaml.Instruct)

    Module Instruct

    type compilation_env = {
    1. ce_stack : int Ident.tbl;
    2. ce_heap : int Ident.tbl;
    3. ce_rec : int Ident.tbl;
    }
    type debug_event = {
    1. mutable ev_pos : int;
    2. ev_module : string;
    3. ev_loc : Location.t;
    4. ev_kind : debug_event_kind;
    5. ev_defname : string;
    6. ev_info : debug_event_info;
    7. ev_typenv : Env.summary;
    8. ev_typsubst : Subst.t;
    9. ev_compenv : compilation_env;
    10. ev_stacksize : int;
    11. ev_repr : debug_event_repr;
    }
    and debug_event_kind =
    1. | Event_before
    2. | Event_after of Types.type_expr
    3. | Event_pseudo
    and debug_event_info =
    1. | Event_function
    2. | Event_return of int
    3. | Event_other
    and debug_event_repr =
    1. | Event_none
    2. | Event_parent of int ref
    3. | Event_child of int ref
    type label = int
    type instruction =
    1. | Klabel of label
    2. | Kacc of int
    3. | Kenvacc of int
    4. | Kpush
    5. | Kpop of int
    6. | Kassign of int
    7. | Kpush_retaddr of label
    8. | Kapply of int
    9. | Kappterm of int * int
    10. | Kreturn of int
    11. | Krestart
    12. | Kgrab of int
    13. | Kclosure of label * int
    14. | Kclosurerec of label list * int
    15. | Koffsetclosure of int
    16. | Kgetglobal of Ident.t
    17. | Ksetglobal of Ident.t
    18. | Kconst of Lambda.structured_constant
    19. | Kmakeblock of int * int
    20. | Kmakefloatblock of int
    21. | Kgetfield of int
    22. | Ksetfield of int
    23. | Kgetfloatfield of int
    24. | Ksetfloatfield of int
    25. | Kvectlength
    26. | Kgetvectitem
    27. | Ksetvectitem
    28. | Kgetstringchar
    29. | Kgetbyteschar
    30. | Ksetbyteschar
    31. | Kbranch of label
    32. | Kbranchif of label
    33. | Kbranchifnot of label
    34. | Kstrictbranchif of label
    35. | Kstrictbranchifnot of label
    36. | Kswitch of label array * label array
    37. | Kboolnot
    38. | Kpushtrap of label
    39. | Kpoptrap
    40. | Kraise of Lambda.raise_kind
    41. | Kcheck_signals
    42. | Kccall of string * int
    43. | Knegint
    44. | Kaddint
    45. | Ksubint
    46. | Kmulint
    47. | Kdivint
    48. | Kmodint
    49. | Kandint
    50. | Korint
    51. | Kxorint
    52. | Klslint
    53. | Klsrint
    54. | Kasrint
    55. | Kintcomp of Lambda.integer_comparison
    56. | Koffsetint of int
    57. | Koffsetref of int
    58. | Kisint
    59. | Kisout
    60. | Kgetmethod
    61. | Kgetpubmet of int
    62. | Kgetdynmet
    63. | Kevent of debug_event
    64. | Kperform
    65. | Kresume
    66. | Kresumeterm of int
    67. | Kreperformterm of int
    68. | Kstop
    val immed_min : int
    val immed_max : int
    +Instruct (ocaml.Instruct)

    Module Instruct

    type closure_entry =
    1. | Free_variable of int
    2. | Function of int
    type closure_env =
    1. | Not_in_closure
    2. | In_closure of {
      1. entries : closure_entry Ident.tbl;
      2. env_pos : int;
      }
    type compilation_env = {
    1. ce_stack : int Ident.tbl;
    2. ce_closure : closure_env;
    }
    type debug_event = {
    1. mutable ev_pos : int;
    2. ev_module : string;
    3. ev_loc : Location.t;
    4. ev_kind : debug_event_kind;
    5. ev_defname : string;
    6. ev_info : debug_event_info;
    7. ev_typenv : Env.summary;
    8. ev_typsubst : Subst.t;
    9. ev_compenv : compilation_env;
    10. ev_stacksize : int;
    11. ev_repr : debug_event_repr;
    }
    and debug_event_kind =
    1. | Event_before
    2. | Event_after of Types.type_expr
    3. | Event_pseudo
    and debug_event_info =
    1. | Event_function
    2. | Event_return of int
    3. | Event_other
    and debug_event_repr =
    1. | Event_none
    2. | Event_parent of int ref
    3. | Event_child of int ref
    type label = int
    type instruction =
    1. | Klabel of label
    2. | Kacc of int
    3. | Kenvacc of int
    4. | Kpush
    5. | Kpop of int
    6. | Kassign of int
    7. | Kpush_retaddr of label
    8. | Kapply of int
    9. | Kappterm of int * int
    10. | Kreturn of int
    11. | Krestart
    12. | Kgrab of int
    13. | Kclosure of label * int
    14. | Kclosurerec of label list * int
    15. | Koffsetclosure of int
    16. | Kgetglobal of Ident.t
    17. | Ksetglobal of Ident.t
    18. | Kconst of Lambda.structured_constant
    19. | Kmakeblock of int * int
    20. | Kmakefloatblock of int
    21. | Kgetfield of int
    22. | Ksetfield of int
    23. | Kgetfloatfield of int
    24. | Ksetfloatfield of int
    25. | Kvectlength
    26. | Kgetvectitem
    27. | Ksetvectitem
    28. | Kgetstringchar
    29. | Kgetbyteschar
    30. | Ksetbyteschar
    31. | Kbranch of label
    32. | Kbranchif of label
    33. | Kbranchifnot of label
    34. | Kstrictbranchif of label
    35. | Kstrictbranchifnot of label
    36. | Kswitch of label array * label array
    37. | Kboolnot
    38. | Kpushtrap of label
    39. | Kpoptrap
    40. | Kraise of Lambda.raise_kind
    41. | Kcheck_signals
    42. | Kccall of string * int
    43. | Knegint
    44. | Kaddint
    45. | Ksubint
    46. | Kmulint
    47. | Kdivint
    48. | Kmodint
    49. | Kandint
    50. | Korint
    51. | Kxorint
    52. | Klslint
    53. | Klsrint
    54. | Kasrint
    55. | Kintcomp of Lambda.integer_comparison
    56. | Koffsetint of int
    57. | Koffsetref of int
    58. | Kisint
    59. | Kisout
    60. | Kgetmethod
    61. | Kgetpubmet of int
    62. | Kgetdynmet
    63. | Kevent of debug_event
    64. | Kperform
    65. | Kresume
    66. | Kresumeterm of int
    67. | Kreperformterm of int
    68. | Kstop
    val immed_min : int
    val immed_max : int
    diff --git a/ocaml/Lambda/index.html b/ocaml/Lambda/index.html index 64765864..a95e654f 100644 --- a/ocaml/Lambda/index.html +++ b/ocaml/Lambda/index.html @@ -1,27 +1,34 @@ -Lambda (ocaml.Lambda)

    Module Lambda

    type compile_time_constant =
    1. | Big_endian
    2. | Word_size
    3. | Int_size
    4. | Max_wosize
    5. | Ostype_unix
    6. | Ostype_win32
    7. | Ostype_cygwin
    8. | Backend_type
    type immediate_or_pointer =
    1. | Immediate
    2. | Pointer
    type initialization_or_assignment =
    1. | Assignment
    2. | Heap_initialization
    3. | Root_initialization
    type is_safe =
    1. | Safe
    2. | Unsafe
    type primitive =
    1. | Pbytes_to_string
    2. | Pbytes_of_string
    3. | Pignore
    4. | Pgetglobal of Ident.t
    5. | Psetglobal of Ident.t
    6. | Pmakeblock of int * Asttypes.mutable_flag * block_shape
    7. | Pfield of int * immediate_or_pointer * Asttypes.mutable_flag
    8. | Pfield_computed
    9. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
    10. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
    11. | Pfloatfield of int
    12. | Psetfloatfield of int * initialization_or_assignment
    13. | Pduprecord of Types.record_representation * int
    14. | Prunstack
    15. | Pperform
    16. | Presume
    17. | Preperform
    18. | Pccall of Primitive.description
    19. | Praise of raise_kind
    20. | Psequand
    21. | Psequor
    22. | Pnot
    23. | Pnegint
    24. | Paddint
    25. | Psubint
    26. | Pmulint
    27. | Pdivint of is_safe
    28. | Pmodint of is_safe
    29. | Pandint
    30. | Porint
    31. | Pxorint
    32. | Plslint
    33. | Plsrint
    34. | Pasrint
    35. | Pintcomp of integer_comparison
    36. | Pcompare_ints
    37. | Pcompare_floats
    38. | Pcompare_bints of boxed_integer
    39. | Poffsetint of int
    40. | Poffsetref of int
    41. | Pintoffloat
    42. | Pfloatofint
    43. | Pnegfloat
    44. | Pabsfloat
    45. | Paddfloat
    46. | Psubfloat
    47. | Pmulfloat
    48. | Pdivfloat
    49. | Pfloatcomp of float_comparison
    50. | Pstringlength
    51. | Pstringrefu
    52. | Pstringrefs
    53. | Pbyteslength
    54. | Pbytesrefu
    55. | Pbytessetu
    56. | Pbytesrefs
    57. | Pbytessets
    58. | Pmakearray of array_kind * Asttypes.mutable_flag
    59. | Pduparray of array_kind * Asttypes.mutable_flag
      (*

      For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

      *)
    60. | Parraylength of array_kind
    61. | Parrayrefu of array_kind
    62. | Parraysetu of array_kind
    63. | Parrayrefs of array_kind
    64. | Parraysets of array_kind
    65. | Pisint
    66. | Pisout
    67. | Pbintofint of boxed_integer
    68. | Pintofbint of boxed_integer
    69. | Pcvtbint of boxed_integer * boxed_integer
    70. | Pnegbint of boxed_integer
    71. | Paddbint of boxed_integer
    72. | Psubbint of boxed_integer
    73. | Pmulbint of boxed_integer
    74. | Pdivbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    75. | Pmodbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    76. | Pandbint of boxed_integer
    77. | Porbint of boxed_integer
    78. | Pxorbint of boxed_integer
    79. | Plslbint of boxed_integer
    80. | Plsrbint of boxed_integer
    81. | Pasrbint of boxed_integer
    82. | Pbintcomp of boxed_integer * integer_comparison
    83. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
    84. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
    85. | Pbigarraydim of int
    86. | Pstring_load_16 of bool
    87. | Pstring_load_32 of bool
    88. | Pstring_load_64 of bool
    89. | Pbytes_load_16 of bool
    90. | Pbytes_load_32 of bool
    91. | Pbytes_load_64 of bool
    92. | Pbytes_set_16 of bool
    93. | Pbytes_set_32 of bool
    94. | Pbytes_set_64 of bool
    95. | Pbigstring_load_16 of bool
    96. | Pbigstring_load_32 of bool
    97. | Pbigstring_load_64 of bool
    98. | Pbigstring_set_16 of bool
    99. | Pbigstring_set_32 of bool
    100. | Pbigstring_set_64 of bool
    101. | Pctconst of compile_time_constant
    102. | Pbswap16
    103. | Pbbswap of boxed_integer
    104. | Pint_as_pointer
    105. | Patomic_load of {
      1. immediate_or_pointer : immediate_or_pointer;
      }
    106. | Patomic_exchange
    107. | Patomic_cas
    108. | Patomic_fetch_add
    109. | Popaque
    110. | Pdls_get
    and integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    and float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    and array_kind =
    1. | Pgenarray
    2. | Paddrarray
    3. | Pintarray
    4. | Pfloatarray
    and value_kind =
    1. | Pgenval
    2. | Pfloatval
    3. | Pboxedintval of boxed_integer
    4. | Pintval
    and block_shape = value_kind list option
    and boxed_integer = Primitive.boxed_integer =
    1. | Pnativeint
    2. | Pint32
    3. | Pint64
    and bigarray_kind =
    1. | Pbigarray_unknown
    2. | Pbigarray_float32
    3. | Pbigarray_float64
    4. | Pbigarray_sint8
    5. | Pbigarray_uint8
    6. | Pbigarray_sint16
    7. | Pbigarray_uint16
    8. | Pbigarray_int32
    9. | Pbigarray_int64
    10. | Pbigarray_caml_int
    11. | Pbigarray_native_int
    12. | Pbigarray_complex32
    13. | Pbigarray_complex64
    and bigarray_layout =
    1. | Pbigarray_unknown_layout
    2. | Pbigarray_c_layout
    3. | Pbigarray_fortran_layout
    and raise_kind =
    1. | Raise_regular
    2. | Raise_reraise
    3. | Raise_notrace
    val equal_primitive : primitive -> primitive -> bool
    val equal_value_kind : value_kind -> value_kind -> bool
    val equal_boxed_integer : boxed_integer -> boxed_integer -> bool
    type structured_constant =
    1. | Const_base of Asttypes.constant
    2. | Const_block of int * structured_constant list
    3. | Const_float_array of string list
    4. | Const_immstring of string
    type tailcall_attribute =
    1. | Tailcall_expectation of bool
    2. | Default_tailcall
    type inline_attribute =
    1. | Always_inline
    2. | Never_inline
    3. | Hint_inline
    4. | Unroll of int
    5. | Default_inline
    val equal_inline_attribute : inline_attribute -> inline_attribute -> bool
    type specialise_attribute =
    1. | Always_specialise
    2. | Never_specialise
    3. | Default_specialise
    val equal_specialise_attribute : +Lambda (ocaml.Lambda)

    Module Lambda

    type compile_time_constant =
    1. | Big_endian
    2. | Word_size
    3. | Int_size
    4. | Max_wosize
    5. | Ostype_unix
    6. | Ostype_win32
    7. | Ostype_cygwin
    8. | Backend_type
    type immediate_or_pointer =
    1. | Immediate
    2. | Pointer
    type initialization_or_assignment =
    1. | Assignment
    2. | Heap_initialization
    3. | Root_initialization
    type is_safe =
    1. | Safe
    2. | Unsafe
    type primitive =
    1. | Pbytes_to_string
    2. | Pbytes_of_string
    3. | Pignore
    4. | Pgetglobal of Ident.t
    5. | Psetglobal of Ident.t
    6. | Pmakeblock of int * Asttypes.mutable_flag * block_shape
    7. | Pfield of int * immediate_or_pointer * Asttypes.mutable_flag
    8. | Pfield_computed
    9. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
    10. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
    11. | Pfloatfield of int
    12. | Psetfloatfield of int * initialization_or_assignment
    13. | Pduprecord of Types.record_representation * int
    14. | Prunstack
    15. | Pperform
    16. | Presume
    17. | Preperform
    18. | Pccall of Primitive.description
    19. | Praise of raise_kind
    20. | Psequand
    21. | Psequor
    22. | Pnot
    23. | Pnegint
    24. | Paddint
    25. | Psubint
    26. | Pmulint
    27. | Pdivint of is_safe
    28. | Pmodint of is_safe
    29. | Pandint
    30. | Porint
    31. | Pxorint
    32. | Plslint
    33. | Plsrint
    34. | Pasrint
    35. | Pintcomp of integer_comparison
    36. | Pcompare_ints
    37. | Pcompare_floats
    38. | Pcompare_bints of boxed_integer
    39. | Poffsetint of int
    40. | Poffsetref of int
    41. | Pintoffloat
    42. | Pfloatofint
    43. | Pnegfloat
    44. | Pabsfloat
    45. | Paddfloat
    46. | Psubfloat
    47. | Pmulfloat
    48. | Pdivfloat
    49. | Pfloatcomp of float_comparison
    50. | Pstringlength
    51. | Pstringrefu
    52. | Pstringrefs
    53. | Pbyteslength
    54. | Pbytesrefu
    55. | Pbytessetu
    56. | Pbytesrefs
    57. | Pbytessets
    58. | Pmakearray of array_kind * Asttypes.mutable_flag
    59. | Pduparray of array_kind * Asttypes.mutable_flag
      (*

      For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

      *)
    60. | Parraylength of array_kind
    61. | Parrayrefu of array_kind
    62. | Parraysetu of array_kind
    63. | Parrayrefs of array_kind
    64. | Parraysets of array_kind
    65. | Pisint
    66. | Pisout
    67. | Pbintofint of boxed_integer
    68. | Pintofbint of boxed_integer
    69. | Pcvtbint of boxed_integer * boxed_integer
    70. | Pnegbint of boxed_integer
    71. | Paddbint of boxed_integer
    72. | Psubbint of boxed_integer
    73. | Pmulbint of boxed_integer
    74. | Pdivbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    75. | Pmodbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    76. | Pandbint of boxed_integer
    77. | Porbint of boxed_integer
    78. | Pxorbint of boxed_integer
    79. | Plslbint of boxed_integer
    80. | Plsrbint of boxed_integer
    81. | Pasrbint of boxed_integer
    82. | Pbintcomp of boxed_integer * integer_comparison
    83. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
    84. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
    85. | Pbigarraydim of int
    86. | Pstring_load_16 of bool
    87. | Pstring_load_32 of bool
    88. | Pstring_load_64 of bool
    89. | Pbytes_load_16 of bool
    90. | Pbytes_load_32 of bool
    91. | Pbytes_load_64 of bool
    92. | Pbytes_set_16 of bool
    93. | Pbytes_set_32 of bool
    94. | Pbytes_set_64 of bool
    95. | Pbigstring_load_16 of bool
    96. | Pbigstring_load_32 of bool
    97. | Pbigstring_load_64 of bool
    98. | Pbigstring_set_16 of bool
    99. | Pbigstring_set_32 of bool
    100. | Pbigstring_set_64 of bool
    101. | Pctconst of compile_time_constant
    102. | Pbswap16
    103. | Pbbswap of boxed_integer
    104. | Pint_as_pointer
    105. | Patomic_load of {
      1. immediate_or_pointer : immediate_or_pointer;
      }
    106. | Patomic_exchange
    107. | Patomic_cas
    108. | Patomic_fetch_add
    109. | Popaque
    110. | Pdls_get
    111. | Ppoll
    and integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    and float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    and array_kind =
    1. | Pgenarray
    2. | Paddrarray
    3. | Pintarray
    4. | Pfloatarray
    and value_kind =
    1. | Pgenval
    2. | Pfloatval
    3. | Pboxedintval of boxed_integer
    4. | Pintval
    and block_shape = value_kind list option
    and boxed_integer = Primitive.boxed_integer =
    1. | Pnativeint
    2. | Pint32
    3. | Pint64
    and bigarray_kind =
    1. | Pbigarray_unknown
    2. | Pbigarray_float16
    3. | Pbigarray_float32
    4. | Pbigarray_float64
    5. | Pbigarray_sint8
    6. | Pbigarray_uint8
    7. | Pbigarray_sint16
    8. | Pbigarray_uint16
    9. | Pbigarray_int32
    10. | Pbigarray_int64
    11. | Pbigarray_caml_int
    12. | Pbigarray_native_int
    13. | Pbigarray_complex32
    14. | Pbigarray_complex64
    and bigarray_layout =
    1. | Pbigarray_unknown_layout
    2. | Pbigarray_c_layout
    3. | Pbigarray_fortran_layout
    and raise_kind =
    1. | Raise_regular
    2. | Raise_reraise
    3. | Raise_notrace
    val equal_primitive : primitive -> primitive -> bool
    val equal_value_kind : value_kind -> value_kind -> bool
    val equal_boxed_integer : boxed_integer -> boxed_integer -> bool
    type structured_constant =
    1. | Const_base of Asttypes.constant
    2. | Const_block of int * structured_constant list
    3. | Const_float_array of string list
    4. | Const_immstring of string
    type tailcall_attribute =
    1. | Tailcall_expectation of bool
    2. | Default_tailcall
    type inline_attribute =
    1. | Always_inline
    2. | Never_inline
    3. | Hint_inline
    4. | Unroll of int
    5. | Default_inline
    val equal_inline_attribute : inline_attribute -> inline_attribute -> bool
    type specialise_attribute =
    1. | Always_specialise
    2. | Never_specialise
    3. | Default_specialise
    val equal_specialise_attribute : specialise_attribute -> specialise_attribute -> - bool
    type local_attribute =
    1. | Always_local
    2. | Never_local
    3. | Default_local
    type poll_attribute =
    1. | Error_poll
    2. | Default_poll
    type function_kind =
    1. | Curried
    2. | Tupled
    type let_kind =
    1. | Strict
    2. | Alias
    3. | StrictOpt
    type meth_kind =
    1. | Self
    2. | Public
    3. | Cached
    val equal_meth_kind : meth_kind -> meth_kind -> bool
    type shared_code = (int * int) list
    type function_attribute = {
    1. inline : inline_attribute;
    2. specialise : specialise_attribute;
    3. local : local_attribute;
    4. poll : poll_attribute;
    5. is_a_functor : bool;
    6. stub : bool;
    7. tmc_candidate : bool;
    }
    type scoped_location = Debuginfo.Scoped_location.t
    type lambda =
    1. | Lvar of Ident.t
    2. | Lmutvar of Ident.t
    3. | Lconst of structured_constant
    4. | Lapply of lambda_apply
    5. | Lfunction of lfunction
    6. | Llet of let_kind * value_kind * Ident.t * lambda * lambda
    7. | Lmutlet of value_kind * Ident.t * lambda * lambda
    8. | Lletrec of (Ident.t * lambda) list * lambda
    9. | Lprim of primitive * lambda list * scoped_location
    10. | Lswitch of lambda * lambda_switch * scoped_location
    11. | Lstringswitch of lambda + bool
    type local_attribute =
    1. | Always_local
    2. | Never_local
    3. | Default_local
    type poll_attribute =
    1. | Error_poll
    2. | Default_poll
    type function_kind =
    1. | Curried
    2. | Tupled
    type let_kind =
    1. | Strict
    2. | Alias
    3. | StrictOpt
    type meth_kind =
    1. | Self
    2. | Public
    3. | Cached
    val equal_meth_kind : meth_kind -> meth_kind -> bool
    type shared_code = (int * int) list
    type function_attribute = {
    1. inline : inline_attribute;
    2. specialise : specialise_attribute;
    3. local : local_attribute;
    4. poll : poll_attribute;
    5. is_a_functor : bool;
    6. stub : bool;
    7. tmc_candidate : bool;
    8. may_fuse_arity : bool;
    }
    type scoped_location = Debuginfo.Scoped_location.t
    type lambda =
    1. | Lvar of Ident.t
    2. | Lmutvar of Ident.t
    3. | Lconst of structured_constant
    4. | Lapply of lambda_apply
    5. | Lfunction of lfunction
    6. | Llet of let_kind * value_kind * Ident.t * lambda * lambda
    7. | Lmutlet of value_kind * Ident.t * lambda * lambda
    8. | Lletrec of rec_binding list * lambda
    9. | Lprim of primitive * lambda list * scoped_location
    10. | Lswitch of lambda * lambda_switch * scoped_location
    11. | Lstringswitch of lambda * (string * lambda) list * lambda option - * scoped_location
    12. | Lstaticraise of int * lambda list
    13. | Lstaticcatch of lambda * int * (Ident.t * value_kind) list * lambda
    14. | Ltrywith of lambda * Ident.t * lambda
    15. | Lifthenelse of lambda * lambda * lambda
    16. | Lsequence of lambda * lambda
    17. | Lwhile of lambda * lambda
    18. | Lfor of Ident.t * lambda * lambda * Asttypes.direction_flag * lambda
    19. | Lassign of Ident.t * lambda
    20. | Lsend of meth_kind * lambda * lambda * lambda list * scoped_location
    21. | Levent of lambda * lambda_event
    22. | Lifused of Ident.t * lambda
    and lfunction = private {
    1. kind : function_kind;
    2. params : (Ident.t * value_kind) list;
    3. return : value_kind;
    4. body : lambda;
    5. attr : function_attribute;
    6. loc : scoped_location;
    }
    and lambda_apply = {
    1. ap_func : lambda;
    2. ap_args : lambda list;
    3. ap_loc : scoped_location;
    4. ap_tailcall : tailcall_attribute;
    5. ap_inlined : inline_attribute;
    6. ap_specialised : specialise_attribute;
    }
    and lambda_switch = {
    1. sw_numconsts : int;
    2. sw_consts : (int * lambda) list;
    3. sw_numblocks : int;
    4. sw_blocks : (int * lambda) list;
    5. sw_failaction : lambda option;
    }
    and lambda_event = {
    1. lev_loc : scoped_location;
    2. lev_kind : lambda_event_kind;
    3. lev_repr : int ref option;
    4. lev_env : Env.t;
    }
    and lambda_event_kind =
    1. | Lev_before
    2. | Lev_after of Types.type_expr
    3. | Lev_function
    4. | Lev_pseudo
    type program = {
    1. module_ident : Ident.t;
    2. main_module_block_size : int;
    3. required_globals : Ident.Set.t;
    4. code : lambda;
    }
    val make_key : lambda -> lambda option
    val const_unit : structured_constant
    val const_int : int -> structured_constant
    val lambda_unit : lambda
    val name_lambda : let_kind -> lambda -> (Ident.t -> lambda) -> lambda
    val name_lambda_list : lambda list -> (lambda list -> lambda) -> lambda
    val lfunction : + * scoped_location
  • | Lstaticraise of int * lambda list
  • | Lstaticcatch of lambda * int * (Ident.t * value_kind) list * lambda
  • | Ltrywith of lambda * Ident.t * lambda
  • | Lifthenelse of lambda * lambda * lambda
  • | Lsequence of lambda * lambda
  • | Lwhile of lambda * lambda
  • | Lfor of Ident.t * lambda * lambda * Asttypes.direction_flag * lambda
  • | Lassign of Ident.t * lambda
  • | Lsend of meth_kind * lambda * lambda * lambda list * scoped_location
  • | Levent of lambda * lambda_event
  • | Lifused of Ident.t * lambda
  • and rec_binding = {
    1. id : Ident.t;
    2. def : lfunction;
    }
    and lfunction = private {
    1. kind : function_kind;
    2. params : (Ident.t * value_kind) list;
    3. return : value_kind;
    4. body : lambda;
    5. attr : function_attribute;
    6. loc : scoped_location;
    }
    and lambda_apply = {
    1. ap_func : lambda;
    2. ap_args : lambda list;
    3. ap_loc : scoped_location;
    4. ap_tailcall : tailcall_attribute;
    5. ap_inlined : inline_attribute;
    6. ap_specialised : specialise_attribute;
    }
    and lambda_switch = {
    1. sw_numconsts : int;
    2. sw_consts : (int * lambda) list;
    3. sw_numblocks : int;
    4. sw_blocks : (int * lambda) list;
    5. sw_failaction : lambda option;
    }
    and lambda_event = {
    1. lev_loc : scoped_location;
    2. lev_kind : lambda_event_kind;
    3. lev_repr : int ref option;
    4. lev_env : Env.t;
    }
    and lambda_event_kind =
    1. | Lev_before
    2. | Lev_after of Types.type_expr
    3. | Lev_function
    4. | Lev_pseudo
    type program = {
    1. module_ident : Ident.t;
    2. main_module_block_size : int;
    3. required_globals : Ident.Set.t;
    4. code : lambda;
    }
    val make_key : lambda -> lambda option
    val const_unit : structured_constant
    val const_int : int -> structured_constant
    val lambda_unit : lambda
    val dummy_constant : lambda

    dummy_constant produces a plecholder value with a recognizable bit pattern (currently 0xBBBB in its tagged form)

    val name_lambda : let_kind -> lambda -> (Ident.t -> lambda) -> lambda
    val name_lambda_list : lambda list -> (lambda list -> lambda) -> lambda
    val lfunction : kind:function_kind -> params:(Ident.t * value_kind) list -> return:value_kind -> body:lambda -> attr:function_attribute -> loc:scoped_location -> - lambda
    val iter_head_constructor : (lambda -> unit) -> lambda -> unit

    iter_head_constructor f lam apply f to only the first level of sub expressions of lam. It does not recursively traverse the expression.

    val shallow_iter : + lambda
    val lfunction' : + kind:function_kind -> + params:(Ident.t * value_kind) list -> + return:value_kind -> + body:lambda -> + attr:function_attribute -> + loc:scoped_location -> + lfunction
    val iter_head_constructor : (lambda -> unit) -> lambda -> unit

    iter_head_constructor f lam apply f to only the first level of sub expressions of lam. It does not recursively traverse the expression.

    val shallow_iter : tail:(lambda -> unit) -> non_tail:(lambda -> unit) -> lambda -> - unit

    Same as iter_head_constructor, but use a different callback for sub-terms which are in tail position or not.

    val transl_prim : string -> string -> lambda

    Translate a value from a persistent module. For instance:

    transl_internal_value "CamlinternalLazy" "force"
    val free_variables : lambda -> Ident.Set.t
    val transl_module_path : scoped_location -> Env.t -> Path.t -> lambda
    val transl_value_path : scoped_location -> Env.t -> Path.t -> lambda
    val transl_extension_path : scoped_location -> Env.t -> Path.t -> lambda
    val transl_class_path : scoped_location -> Env.t -> Path.t -> lambda
    val make_sequence : ('a -> lambda) -> 'a list -> lambda
    val subst : + unit

    Same as iter_head_constructor, but use a different callback for sub-terms which are in tail position or not.

    val transl_prim : string -> string -> lambda

    Translate a value from a persistent module. For instance:

    transl_internal_value "CamlinternalLazy" "force"
    val is_evaluated : lambda -> bool

    is_evaluated lam returns true if lam is either a constant, a variable or a function abstract.

    val free_variables : lambda -> Ident.Set.t
    val transl_module_path : scoped_location -> Env.t -> Path.t -> lambda
    val transl_value_path : scoped_location -> Env.t -> Path.t -> lambda
    val transl_extension_path : scoped_location -> Env.t -> Path.t -> lambda
    val transl_class_path : scoped_location -> Env.t -> Path.t -> lambda
    val make_sequence : ('a -> lambda) -> 'a list -> lambda
    val subst : (Ident.t -> Types.value_description -> Env.t -> Env.t) -> ?freshen_bound_variables:bool -> lambda Ident.Map.t -> lambda -> - lambda

    subst update_env ?freshen_bound_variables s lt applies a substitution s to the lambda-term lt.

    Assumes that the image of the substitution is out of reach of the bound variables of the lambda-term (no capture).

    update_env is used to refresh the environment contained in debug events.

    freshen_bound_variables, which defaults to false, freshens the bound variables within lt.

    val rename : Ident.t Ident.Map.t -> lambda -> lambda

    A version of subst specialized for the case where we're just renaming idents.

    val duplicate : lambda -> lambda

    Duplicate a term, freshening all locally-bound identifiers.

    val map : (lambda -> lambda) -> lambda -> lambda

    Bottom-up rewriting, applying the function on each node from the leaves to the root.

    val shallow_map : (lambda -> lambda) -> lambda -> lambda

    Rewrite each immediate sub-term with the function.

    val bind : let_kind -> Ident.t -> lambda -> lambda -> lambda
    val bind_with_value_kind : + lambda

    subst update_env ?freshen_bound_variables s lt applies a substitution s to the lambda-term lt.

    Assumes that the image of the substitution is out of reach of the bound variables of the lambda-term (no capture).

    update_env is used to refresh the environment contained in debug events.

    freshen_bound_variables, which defaults to false, freshens the bound variables within lt.

    val rename : Ident.t Ident.Map.t -> lambda -> lambda

    A version of subst specialized for the case where we're just renaming idents.

    val duplicate_function : lfunction -> lfunction

    Duplicate a term, freshening all locally-bound identifiers.

    val map : (lambda -> lambda) -> lambda -> lambda

    Bottom-up rewriting, applying the function on each node from the leaves to the root.

    val map_lfunction : (lambda -> lambda) -> lfunction -> lfunction

    Apply the given transformation on the function's body

    val shallow_map : (lambda -> lambda) -> lambda -> lambda

    Rewrite each immediate sub-term with the function.

    val bind : let_kind -> Ident.t -> lambda -> lambda -> lambda
    val bind_with_value_kind : let_kind -> (Ident.t * value_kind) -> lambda -> diff --git a/ocaml/Lexer/index.html b/ocaml/Lexer/index.html index f75caba5..9ab9a20f 100644 --- a/ocaml/Lexer/index.html +++ b/ocaml/Lexer/index.html @@ -1,5 +1,5 @@ -Lexer (ocaml.Lexer)

    Module Lexer

    The lexical analyzer

    Warning: this module is unstable and part of compiler-libs.

    val init : unit -> unit
    val skip_hash_bang : Stdlib.Lexing.lexbuf -> unit
    type error =
    1. | Illegal_character of char
    2. | Illegal_escape of string * string option
    3. | Reserved_sequence of string * string option
    4. | Unterminated_comment of Location.t
    5. | Unterminated_string
    6. | Unterminated_string_in_comment of Location.t * Location.t
    7. | Empty_character_literal
    8. | Keyword_as_label of string
    9. | Invalid_literal of string
    10. | Invalid_directive of string * string option
    exception Error of error * Location.t
    val in_comment : unit -> bool
    val in_string : unit -> bool
    val print_warnings : bool ref
    val handle_docstrings : bool ref
    val comments : unit -> (string * Location.t) list
    val token_with_comments : Stdlib.Lexing.lexbuf -> Parser.token
    val set_preprocessor : +Lexer (ocaml.Lexer)

    Module Lexer

    The lexical analyzer

    Warning: this module is unstable and part of compiler-libs.

    val init : ?keyword_edition:((int * int) option * string list) -> unit -> unit
    val skip_hash_bang : Stdlib.Lexing.lexbuf -> unit
    type error =
    1. | Illegal_character of char
    2. | Illegal_escape of string * string option
    3. | Reserved_sequence of string * string option
    4. | Unterminated_comment of Location.t
    5. | Unterminated_string
    6. | Unterminated_string_in_comment of Location.t * Location.t
    7. | Empty_character_literal
    8. | Keyword_as_label of string
    9. | Capitalized_label of string
    10. | Invalid_literal of string
    11. | Invalid_directive of string * string option
    12. | Invalid_encoding of string
    13. | Invalid_char_in_ident of Stdlib.Uchar.t
    14. | Non_lowercase_delimiter of string
    15. | Capitalized_raw_identifier of string
    16. | Unknown_keyword of string
    exception Error of error * Location.t
    val in_comment : unit -> bool
    val in_string : unit -> bool
    val is_keyword : string -> bool
    val print_warnings : bool ref
    val handle_docstrings : bool ref
    val comments : unit -> (string * Location.t) list
    val token_with_comments : Stdlib.Lexing.lexbuf -> Parser.token
    val set_preprocessor : (unit -> unit) -> ((Stdlib.Lexing.lexbuf -> Parser.token) -> Stdlib.Lexing.lexbuf -> diff --git a/ocaml/Linear/index.html b/ocaml/Linear/index.html index 0442deaa..c89ea688 100644 --- a/ocaml/Linear/index.html +++ b/ocaml/Linear/index.html @@ -4,4 +4,4 @@ Reg.t array -> Reg.t array -> instruction -> - instruction
    val invert_test : Mach.test -> Mach.test
    type fundecl = {
    1. fun_name : string;
    2. fun_args : Reg.Set.t;
    3. fun_body : instruction;
    4. fun_fast : bool;
    5. fun_dbg : Debuginfo.t;
    6. fun_tailrec_entry_point_label : label;
    7. fun_contains_calls : bool;
    8. fun_num_stack_slots : int array;
    9. fun_frame_required : bool;
    10. fun_prologue_required : bool;
    }
    + instruction
    val invert_test : Mach.test -> Mach.test
    type fundecl = {
    1. fun_name : string;
    2. fun_args : Reg.Set.t;
    3. fun_body : instruction;
    4. fun_fast : bool;
    5. fun_dbg : Debuginfo.t;
    6. fun_tailrec_entry_point_label : label;
    7. fun_contains_nontail_calls : bool;
    8. fun_num_stack_slots : int array;
    9. fun_frame_required : bool;
    10. fun_extra_stack_used : int;
    }
    diff --git a/ocaml/Linkdeps/index.html b/ocaml/Linkdeps/index.html new file mode 100644 index 00000000..030c57d9 --- /dev/null +++ b/ocaml/Linkdeps/index.html @@ -0,0 +1,12 @@ + +Linkdeps (ocaml.Linkdeps)

    Module Linkdeps

    type t

    The state of the linking check. It keeps track of compilation units provided and required so far.

    type compunit = string
    type filename = string
    val create : complete:bool -> t

    create ~complete returns an empty state. If complete is true, missing compilation units will be treated as errors.

    val add : + t -> + filename:filename -> + compunit:compunit -> + provides:compunit list -> + requires:compunit list -> + unit

    add t ~filename ~compunit ~provides ~requires registers the compilation unit compunit found in filename to t.

    • provides are units and sub-units provided by compunit
    • requires are units required by compunit

    add should be called in reverse topological order.

    val required : t -> compunit -> bool

    required t compunit returns true if compunit is a dependency of previously added compilation units.

    type compunit_and_source = {
    1. compunit : compunit;
    2. filename : filename;
    }
    type error =
    1. | Missing_implementations of (compunit * compunit_and_source list) list
    2. | Multiple_definitions of (compunit * filename list) list
    val check : t -> error option

    check t should be called once all the compilation units to be linked have been added. It returns some error if:

    • There are some missing implementations and complete is true
    • Some implementation appear before their dependencies
    val report_error : + print_filename:string Format_doc.printer -> + error Format_doc.format_printer
    val report_error_doc : + print_filename:string Format_doc.printer -> + error Format_doc.printer
    diff --git a/ocaml/Load_path/Dir/index.html b/ocaml/Load_path/Dir/index.html index 43a199f3..ac389c08 100644 --- a/ocaml/Load_path/Dir/index.html +++ b/ocaml/Load_path/Dir/index.html @@ -1,2 +1,2 @@ -Dir (ocaml.Load_path.Dir)

    Module Load_path.Dir

    type t

    Represent one directory in the load path.

    val create : string -> t
    val path : t -> string
    val files : t -> string list

    All the files in that directory. This doesn't include files in sub-directories of this directory.

    val find : t -> string -> string option

    find dir fn returns the full path to fn in dir.

    val find_uncap : t -> string -> string option

    As find, but search also for uncapitalized name, i.e. if name is Foo.ml, either /path/Foo.ml or /path/foo.ml may be returned.

    +Dir (ocaml.Load_path.Dir)

    Module Load_path.Dir

    type t

    Represent one directory in the load path.

    val create : hidden:bool -> string -> t
    val path : t -> string
    val files : t -> string list

    All the files in that directory. This doesn't include files in sub-directories of this directory.

    val hidden : t -> bool

    If the modules in this directory should not be bound in the initial scope

    val find : t -> string -> string option

    find dir fn returns the full path to fn in dir.

    val find_normalized : t -> string -> string option

    As find, but search also for uncapitalized name, i.e. if name is Foo.ml, either /path/Foo.ml or /path/foo.ml may be returned.

    diff --git a/ocaml/Load_path/index.html b/ocaml/Load_path/index.html index 729516f7..e8332061 100644 --- a/ocaml/Load_path/index.html +++ b/ocaml/Load_path/index.html @@ -1,5 +1,11 @@ -Load_path (ocaml.Load_path)

    Module Load_path

    Management of include directories.

    This module offers a high level interface to locating files in the load path, which is constructed from -I command line flags and a few other parameters.

    It makes the assumption that the contents of include directories doesn't change during the execution of the compiler.

    val add_dir : string -> unit

    Add a directory to the end of the load path (i.e. at lowest priority.)

    val remove_dir : string -> unit

    Remove a directory from the load path

    val reset : unit -> unit

    Remove all directories

    module Dir : sig ... end
    type auto_include_callback = +Load_path (ocaml.Load_path)

    Module Load_path

    Management of include directories.

    This module offers a high level interface to locating files in the load path, which is constructed from -I and -H command line flags and a few other parameters.

    It makes the assumption that the contents of include directories doesn't change during the execution of the compiler.

    val add_dir : hidden:bool -> string -> unit

    Add a directory to the end of the load path (i.e. at lowest priority.)

    val remove_dir : string -> unit

    Remove a directory from the load path

    val reset : unit -> unit

    Remove all directories

    module Dir : sig ... end
    type auto_include_callback = (Dir.t -> string -> string option) -> string -> - string

    The type of callback functions on for init ~auto_include

    val no_auto_include : auto_include_callback

    No automatic directory inclusion: misses in the load path raise Not_found as normal.

    val init : auto_include:auto_include_callback -> string list -> unit

    init l is the same as reset (); List.iter add_dir (List.rev l)

    val auto_include_otherlibs : (string -> unit) -> auto_include_callback

    auto_include_otherlibs alert is a callback function to be passed to Load_path.init and automatically adds -I +lib to the load path after calling alert lib.

    val get_paths : unit -> string list

    Return the list of directories passed to add_dir so far.

    val find : string -> string

    Locate a file in the load path. Raise Not_found if the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn't contain a directory separator.

    val find_uncap : string -> string

    Same as find, but search also for uncapitalized name, i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

    val add : Dir.t -> unit

    Old name for append_dir

    • deprecated
    val append_dir : Dir.t -> unit

    append_dir d adds d to the end of the load path (i.e. at lowest priority.

    val prepend_dir : Dir.t -> unit

    prepend_dir d adds d to the start of the load path (i.e. at highest priority.

    val get : unit -> Dir.t list

    Same as get_paths (), except that it returns a Dir.t list.

    + string

    The type of callback functions on for init ~auto_include

    val no_auto_include : auto_include_callback

    No automatic directory inclusion: misses in the load path raise Not_found as normal.

    val init : + auto_include:auto_include_callback -> + visible:string list -> + hidden:string list -> + unit

    init ~visible ~hidden is the same as reset (); + List.iter add_dir (List.rev hidden); + List.iter add_dir (List.rev visible)

    val auto_include_otherlibs : (string -> unit) -> auto_include_callback

    auto_include_otherlibs alert is a callback function to be passed to Load_path.init and automatically adds -I +lib to the load path after calling alert lib.

    val get_path_list : unit -> string list

    Return the list of directories passed to add_dir so far.

    type paths = {
    1. visible : string list;
    2. hidden : string list;
    }
    val get_paths : unit -> paths

    Return the directories passed to add_dir so far.

    val find : string -> string

    Locate a file in the load path. Raise Not_found if the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn't contain a directory separator.

    val find_normalized : string -> string

    Same as find, but search also for normalized unit name (see Misc.normalized_unit_filename), i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

    type visibility =
    1. | Visible
    2. | Hidden
    val find_normalized_with_visibility : string -> string * visibility

    Same as find_normalized, but also reports whether the cmi was found in a -I directory (Visible) or a -H directory (Hidden)

    val add : Dir.t -> unit

    Old name for append_dir

    • deprecated
    val append_dir : Dir.t -> unit

    append_dir d adds d to the end of the load path (i.e. at lowest priority.

    val prepend_dir : Dir.t -> unit

    prepend_dir d adds d to the start of the load path (i.e. at highest priority.

    val get_visible : unit -> Dir.t list

    Same as get_paths (), except that it returns a Dir.t list, and doesn't include the -H paths.

    diff --git a/ocaml/Local_store/index.html b/ocaml/Local_store/index.html index 715961ea..36d07dc8 100644 --- a/ocaml/Local_store/index.html +++ b/ocaml/Local_store/index.html @@ -1,2 +1,2 @@ -Local_store (ocaml.Local_store)

    Module Local_store

    This module provides some facilities for creating references (and hash tables) which can easily be snapshoted and restored to an arbitrary version.

    It is used throughout the frontend (read: typechecker), to register all (well, hopefully) the global state. Thus making it easy for tools like Merlin to go back and forth typechecking different files.

    Creators

    val s_ref : 'a -> 'a ref

    Similar to Stdlib.ref, except the allocated reference is registered into the store.

    val s_table : ('a -> 'b) -> 'a -> 'b ref

    Used to register hash tables. Those also need to be placed into refs to be easily swapped out, but one can't just "snapshot" the initial value to create fresh instances, so instead an initializer is required.

    Use it like this:

    let my_table = s_table Hashtbl.create 42

    State management

    Note: all the following functions are currently unused inside the compiler codebase. Merlin is their only user at the moment.

    type store
    val fresh : unit -> store

    Returns a fresh instance of the store.

    The first time this function is called, it snapshots the value of all the registered references, later calls to fresh will return instances initialized to those values.

    val with_store : store -> (unit -> 'a) -> 'a

    with_store s f resets all the registered references to the value they have in s for the run of f. If f updates any of the registered refs, s is updated to remember those changes.

    val reset : unit -> unit

    Resets all the references to the initial snapshot (i.e. to the same values that new instances start with).

    val is_bound : unit -> bool

    Returns true when a store is active (i.e. when called from the callback passed to with_store), false otherwise.

    +Local_store (ocaml.Local_store)

    Module Local_store

    This module provides some facilities for creating references (and hash tables) which can easily be snapshotted and restored to an arbitrary version.

    It is used throughout the frontend (read: typechecker), to register all (well, hopefully) the global state. Thus making it easy for tools like Merlin to go back and forth typechecking different files.

    Creators

    val s_ref : 'a -> 'a ref

    Similar to Stdlib.ref, except the allocated reference is registered into the store.

    val s_table : ('a -> 'b) -> 'a -> 'b ref

    Used to register hash tables. Those also need to be placed into refs to be easily swapped out, but one can't just "snapshot" the initial value to create fresh instances, so instead an initializer is required.

    Use it like this:

    let my_table = s_table Hashtbl.create 42

    State management

    Note: all the following functions are currently unused inside the compiler codebase. Merlin is their only user at the moment.

    type store
    val fresh : unit -> store

    Returns a fresh instance of the store.

    The first time this function is called, it snapshots the value of all the registered references, later calls to fresh will return instances initialized to those values.

    val with_store : store -> (unit -> 'a) -> 'a

    with_store s f resets all the registered references to the value they have in s for the run of f. If f updates any of the registered refs, s is updated to remember those changes.

    val reset : unit -> unit

    Resets all the references to the initial snapshot (i.e. to the same values that new instances start with).

    val is_bound : unit -> bool

    Returns true when a store is active (i.e. when called from the callback passed to with_store), false otherwise.

    diff --git a/ocaml/Location/Doc/index.html b/ocaml/Location/Doc/index.html new file mode 100644 index 00000000..e6a23f50 --- /dev/null +++ b/ocaml/Location/Doc/index.html @@ -0,0 +1,2 @@ + +Doc (ocaml.Location.Doc)

    Module Location.Doc

    val separate_new_message : unit Format_doc.printer
    val filename : string Format_doc.printer
    val quoted_filename : string Format_doc.printer
    val locs : t list Format_doc.printer
    diff --git a/ocaml/Location/index.html b/ocaml/Location/index.html index 26c80a92..6d9e61ba 100644 --- a/ocaml/Location/index.html +++ b/ocaml/Location/index.html @@ -1,16 +1,16 @@ -Location (ocaml.Location)

    Module Location

    Source code locations (ranges of positions), used in parsetree.

    Warning: this module is unstable and part of compiler-libs.

    type t = Warnings.loc = {
    1. loc_start : Stdlib.Lexing.position;
    2. loc_end : Stdlib.Lexing.position;
    3. loc_ghost : bool;
    }

    Note on the use of Lexing.position in this module. If pos_fname = "", then use !input_name instead. If pos_lnum = -1, then pos_bol = 0. Use pos_cnum and re-parse the file to get the line and character numbers. Else all fields are correct.

    val none : t

    An arbitrary value of type t; describes an empty ghost range.

    val is_none : t -> bool

    True for Location.none, false any other location

    val in_file : string -> t

    Return an empty ghost range located in a given file.

    val init : Stdlib.Lexing.lexbuf -> string -> unit

    Set the file name and line number of the lexbuf to be the start of the named file.

    val curr : Stdlib.Lexing.lexbuf -> t

    Get the location of the current token from the lexbuf.

    val symbol_rloc : unit -> t
    val symbol_gloc : unit -> t
    val rhs_loc : int -> t

    rhs_loc n returns the location of the symbol at position n, starting at 1, in the current parser rule.

    val rhs_interval : int -> int -> t
    val get_pos_info : Stdlib.Lexing.position -> string * int * int

    file, line, char

    type 'a loc = {
    1. txt : 'a;
    2. loc : t;
    }
    val mknoloc : 'a -> 'a loc
    val mkloc : 'a -> t -> 'a loc

    Input info

    val input_name : string ref
    val input_lexbuf : Stdlib.Lexing.lexbuf option ref
    val input_phrase_buffer : Stdlib.Buffer.t option ref

    Toplevel-specific functions

    val echo_eof : unit -> unit
    val separate_new_message : Stdlib.Format.formatter -> unit
    val reset : unit -> unit

    Rewriting path

    val rewrite_absolute_path : string -> string

    rewrite_absolute_path path rewrites path to honor the BUILD_PATH_PREFIX_MAP variable if it is set. It does not check whether path is absolute or not. The result is as follows:

    • If BUILD_PATH_PREFIX_MAP is not set, just return path.
    • otherwise, rewrite using the mapping (and if there are no matching prefixes that will just return path).

    See the BUILD_PATH_PREFIX_MAP spec

    val rewrite_find_first_existing : string -> string option

    rewrite_find_first_existing path uses a BUILD_PATH_PREFIX_MAP mapping and tries to find a source in mapping that maps to a result that exists in the file system. There are the following return values:

    • None, means either

      • BUILD_PATH_PREFIX_MAP is not set and path does not exists, or
      • no source prefixes of path in the mapping were found,
    • Some target, means target exists and either

      • BUILD_PATH_PREFIX_MAP is not set and target = path, or
      • target is the first file (in priority order) that path mapped to that exists in the file system.
    • Not_found raised, means some source prefixes in the map were found that matched path, but none of them existed in the file system. The caller should catch this and issue an appropriate error message.

    See the BUILD_PATH_PREFIX_MAP spec

    val rewrite_find_all_existing_dirs : string -> string list

    rewrite_find_all_existing_dirs dir accumulates a list of existing directories, dirs, that are the result of mapping a potentially abstract directory, dir, over all the mapping pairs in the BUILD_PATH_PREFIX_MAP environment variable, if any. The list dirs will be in priority order (head as highest priority).

    The possible results are:

    • [], means either

      • BUILD_PATH_PREFIX_MAP is not set and dir is not an existing directory, or
      • if set, then there were no matching prefixes of dir.
    • Some dirs, means dirs are the directories found. Either

      • BUILD_PATH_PREFIX_MAP is not set and dirs = [dir], or
      • it was set and dirs are the mapped existing directories.
    • Not_found raised, means some source prefixes in the map were found that matched dir, but none of mapping results were existing directories (possibly due to misconfiguration). The caller should catch this and issue an appropriate error message.

    See the BUILD_PATH_PREFIX_MAP spec

    val absolute_path : string -> string

    absolute_path path first makes an absolute path, s from path, prepending the current working directory if path was relative. Then s is rewritten using rewrite_absolute_path. Finally the result is normalized by eliminating instances of '.' or '..'.

    Printing locations

    val show_filename : string -> string

    In -absname mode, return the absolute path for this filename. Otherwise, returns the filename unchanged.

    val print_filename : Stdlib.Format.formatter -> string -> unit
    val print_loc : Stdlib.Format.formatter -> t -> unit
    val print_locs : Stdlib.Format.formatter -> t list -> unit

    Toplevel-specific location highlighting

    val highlight_terminfo : +Location (ocaml.Location)

    Module Location

    Source code locations (ranges of positions), used in parsetree.

    Warning: this module is unstable and part of compiler-libs.

    type t = Warnings.loc = {
    1. loc_start : Stdlib.Lexing.position;
    2. loc_end : Stdlib.Lexing.position;
    3. loc_ghost : bool;
    }

    Note on the use of Lexing.position in this module. If pos_fname = "", then use !input_name instead. If pos_lnum = -1, then pos_bol = 0. Use pos_cnum and re-parse the file to get the line and character numbers. Else all fields are correct.

    val none : t

    An arbitrary value of type t; describes an empty ghost range.

    val is_none : t -> bool

    True for Location.none, false any other location

    val in_file : string -> t

    Return an empty ghost range located in a given file.

    val init : Stdlib.Lexing.lexbuf -> string -> unit

    Set the file name and line number of the lexbuf to be the start of the named file.

    val curr : Stdlib.Lexing.lexbuf -> t

    Get the location of the current token from the lexbuf.

    val symbol_rloc : unit -> t
    val symbol_gloc : unit -> t
    val rhs_loc : int -> t

    rhs_loc n returns the location of the symbol at position n, starting at 1, in the current parser rule.

    val rhs_interval : int -> int -> t
    val get_pos_info : Stdlib.Lexing.position -> string * int * int

    file, line, char

    type 'a loc = {
    1. txt : 'a;
    2. loc : t;
    }
    val mknoloc : 'a -> 'a loc
    val mkloc : 'a -> t -> 'a loc

    Input info

    val input_name : string ref
    val input_lexbuf : Stdlib.Lexing.lexbuf option ref
    val input_phrase_buffer : Stdlib.Buffer.t option ref

    Toplevel-specific functions

    val echo_eof : unit -> unit
    val reset : unit -> unit

    Rewriting path

    val rewrite_absolute_path : string -> string

    rewrite_absolute_path path rewrites path to honor the BUILD_PATH_PREFIX_MAP variable if it is set. It does not check whether path is absolute or not. The result is as follows:

    • If BUILD_PATH_PREFIX_MAP is not set, just return path.
    • otherwise, rewrite using the mapping (and if there are no matching prefixes that will just return path).

    See the BUILD_PATH_PREFIX_MAP spec

    val rewrite_find_first_existing : string -> string option

    rewrite_find_first_existing path uses a BUILD_PATH_PREFIX_MAP mapping and tries to find a source in mapping that maps to a result that exists in the file system. There are the following return values:

    • None, means either

      • BUILD_PATH_PREFIX_MAP is not set and path does not exists, or
      • no source prefixes of path in the mapping were found,
    • Some target, means target exists and either

      • BUILD_PATH_PREFIX_MAP is not set and target = path, or
      • target is the first file (in priority order) that path mapped to that exists in the file system.
    • Not_found raised, means some source prefixes in the map were found that matched path, but none of them existed in the file system. The caller should catch this and issue an appropriate error message.

    See the BUILD_PATH_PREFIX_MAP spec

    val rewrite_find_all_existing_dirs : string -> string list

    rewrite_find_all_existing_dirs dir accumulates a list of existing directories, dirs, that are the result of mapping a potentially abstract directory, dir, over all the mapping pairs in the BUILD_PATH_PREFIX_MAP environment variable, if any. The list dirs will be in priority order (head as highest priority).

    The possible results are:

    • [], means either

      • BUILD_PATH_PREFIX_MAP is not set and dir is not an existing directory, or
      • if set, then there were no matching prefixes of dir.
    • Some dirs, means dirs are the directories found. Either

      • BUILD_PATH_PREFIX_MAP is not set and dirs = [dir], or
      • it was set and dirs are the mapped existing directories.
    • Not_found raised, means some source prefixes in the map were found that matched dir, but none of mapping results were existing directories (possibly due to misconfiguration). The caller should catch this and issue an appropriate error message.

    See the BUILD_PATH_PREFIX_MAP spec

    val absolute_path : string -> string

    absolute_path path first makes an absolute path, s from path, prepending the current working directory if path was relative. Then s is rewritten using rewrite_absolute_path. Finally the result is normalized by eliminating instances of '.' or '..'.

    Printing locations

    val show_filename : string -> string

    In -absname mode, return the absolute path for this filename. Otherwise, returns the filename unchanged.

    val print_filename : Stdlib.Format.formatter -> string -> unit
    val print_loc : Stdlib.Format.formatter -> t -> unit
    val print_locs : Stdlib.Format.formatter -> t list -> unit
    val separate_new_message : Stdlib.Format.formatter -> unit
    module Doc : sig ... end

    Toplevel-specific location highlighting

    val highlight_terminfo : Stdlib.Lexing.lexbuf -> Stdlib.Format.formatter -> t list -> - unit

    Reporting errors and warnings

    The type of reports and report printers

    type msg = (Stdlib.Format.formatter -> unit) loc
    val msg : ?loc:t -> ('a, Stdlib.Format.formatter, unit, msg) format4 -> 'a
    type report_kind =
    1. | Report_error
    2. | Report_warning of string
    3. | Report_warning_as_error of string
    4. | Report_alert of string
    5. | Report_alert_as_error of string
    type report = {
    1. kind : report_kind;
    2. main : msg;
    3. sub : msg list;
    }
    type report_printer = {
    1. pp : report_printer -> Stdlib.Format.formatter -> report -> unit;
    2. pp_report_kind : report_printer -> + unit

    Reporting errors and warnings

    The type of reports and report printers

    type msg = Format_doc.t loc
    val msg : ?loc:t -> ('a, Format_doc.formatter, unit, msg) format4 -> 'a
    type report_kind =
    1. | Report_error
    2. | Report_warning of string
    3. | Report_warning_as_error of string
    4. | Report_alert of string
    5. | Report_alert_as_error of string
    type report = {
    1. kind : report_kind;
    2. main : msg;
    3. sub : msg list;
    4. footnote : Format_doc.t option;
    }
    type report_printer = {
    1. pp : report_printer -> Stdlib.Format.formatter -> report -> unit;
    2. pp_report_kind : report_printer -> report -> Stdlib.Format.formatter -> report_kind -> unit;
    3. pp_main_loc : report_printer -> report -> Stdlib.Format.formatter -> t -> unit;
    4. pp_main_txt : report_printer -> report -> Stdlib.Format.formatter -> - (Stdlib.Format.formatter -> unit) -> + Format_doc.t -> unit;
    5. pp_submsgs : report_printer -> report -> Stdlib.Format.formatter -> @@ -22,21 +22,21 @@ unit;
    6. pp_submsg_txt : report_printer -> report -> Stdlib.Format.formatter -> - (Stdlib.Format.formatter -> unit) -> - unit;
    }

    A printer for reports, defined using open-recursion. The goal is to make it easy to define new printers by re-using code from existing ones.

    Report printers used in the compiler

    val batch_mode_printer : report_printer
    val terminfo_toplevel_printer : Stdlib.Lexing.lexbuf -> report_printer
    val best_toplevel_printer : unit -> report_printer

    Detects the terminal capabilities and selects an adequate printer

    Printing a report

    val print_report : Stdlib.Format.formatter -> report -> unit

    Display an error or warning report.

    val report_printer : (unit -> report_printer) ref

    Hook for redefining the printer of reports.

    The hook is a unit -> report_printer and not simply a report_printer: this is useful so that it can detect the type of the output (a file, a terminal, ...) and select a printer accordingly.

    val default_report_printer : unit -> report_printer

    Original report printer for use in hooks.

    Reporting warnings

    Converting a Warnings.t into a report

    val report_warning : t -> Warnings.t -> report option

    report_warning loc w produces a report for the given warning w, or None if the warning is not to be printed.

    val warning_reporter : (t -> Warnings.t -> report option) ref

    Hook for intercepting warnings.

    val default_warning_reporter : t -> Warnings.t -> report option

    Original warning reporter for use in hooks.

    Printing warnings

    val formatter_for_warnings : Stdlib.Format.formatter ref
    val print_warning : t -> Stdlib.Format.formatter -> Warnings.t -> unit

    Prints a warning. This is simply the composition of report_warning and print_report.

    val prerr_warning : t -> Warnings.t -> unit

    Same as print_warning, but uses !formatter_for_warnings as output formatter.

    Reporting alerts

    Converting an Alert.t into a report

    val report_alert : t -> Warnings.alert -> report option

    report_alert loc w produces a report for the given alert w, or None if the alert is not to be printed.

    val alert_reporter : (t -> Warnings.alert -> report option) ref

    Hook for intercepting alerts.

    val default_alert_reporter : t -> Warnings.alert -> report option

    Original alert reporter for use in hooks.

    Printing alerts

    val print_alert : t -> Stdlib.Format.formatter -> Warnings.alert -> unit

    Prints an alert. This is simply the composition of report_alert and print_report.

    val prerr_alert : t -> Warnings.alert -> unit

    Same as print_alert, but uses !formatter_for_warnings as output formatter.

    val deprecated : ?def:t -> ?use:t -> t -> string -> unit

    Prints a deprecation alert.

    val alert : ?def:t -> ?use:t -> kind:string -> t -> string -> unit

    Prints an arbitrary alert.

    val auto_include_alert : string -> unit

    Prints an alert that -I +lib has been automatically added to the load path

    val deprecated_script_alert : string -> unit

    deprecated_script_alert command prints an alert that command foo has been deprecated in favour of command ./foo

    Reporting errors

    type error = report

    An error is a report which report_kind must be Report_error.

    val error : ?loc:t -> ?sub:msg list -> string -> error
    val errorf : + Format_doc.t -> + unit;}

    A printer for reports, defined using open-recursion. The goal is to make it easy to define new printers by re-using code from existing ones.

    Report printers used in the compiler

    val batch_mode_printer : report_printer
    val terminfo_toplevel_printer : Stdlib.Lexing.lexbuf -> report_printer
    val best_toplevel_printer : unit -> report_printer

    Detects the terminal capabilities and selects an adequate printer

    Printing a report

    val print_report : Stdlib.Format.formatter -> report -> unit

    Display an error or warning report.

    val report_printer : (unit -> report_printer) ref

    Hook for redefining the printer of reports.

    The hook is a unit -> report_printer and not simply a report_printer: this is useful so that it can detect the type of the output (a file, a terminal, ...) and select a printer accordingly.

    val default_report_printer : unit -> report_printer

    Original report printer for use in hooks.

    Reporting warnings

    Converting a Warnings.t into a report

    val report_warning : t -> Warnings.t -> report option

    report_warning loc w produces a report for the given warning w, or None if the warning is not to be printed.

    val warning_reporter : (t -> Warnings.t -> report option) ref

    Hook for intercepting warnings.

    val default_warning_reporter : t -> Warnings.t -> report option

    Original warning reporter for use in hooks.

    Printing warnings

    val formatter_for_warnings : Stdlib.Format.formatter ref
    val print_warning : t -> Stdlib.Format.formatter -> Warnings.t -> unit

    Prints a warning. This is simply the composition of report_warning and print_report.

    val prerr_warning : t -> Warnings.t -> unit

    Same as print_warning, but uses !formatter_for_warnings as output formatter.

    Reporting alerts

    Converting an Alert.t into a report

    val report_alert : t -> Warnings.alert -> report option

    report_alert loc w produces a report for the given alert w, or None if the alert is not to be printed.

    val alert_reporter : (t -> Warnings.alert -> report option) ref

    Hook for intercepting alerts.

    val default_alert_reporter : t -> Warnings.alert -> report option

    Original alert reporter for use in hooks.

    Printing alerts

    val print_alert : t -> Stdlib.Format.formatter -> Warnings.alert -> unit

    Prints an alert. This is simply the composition of report_alert and print_report.

    val prerr_alert : t -> Warnings.alert -> unit

    Same as print_alert, but uses !formatter_for_warnings as output formatter.

    val deprecated : ?def:t -> ?use:t -> t -> string -> unit

    Prints a deprecation alert.

    val alert : ?def:t -> ?use:t -> kind:string -> t -> string -> unit

    Prints an arbitrary alert.

    val auto_include_alert : string -> unit

    Prints an alert that -I +lib has been automatically added to the load path

    val deprecated_script_alert : string -> unit

    deprecated_script_alert command prints an alert that command foo has been deprecated in favour of command ./foo

    Reporting errors

    type error = report

    An error is a report which report_kind must be Report_error.

    type delayed_msg = unit -> Format_doc.t option
    val error : ?loc:t -> ?sub:msg list -> ?footnote:delayed_msg -> string -> error
    val errorf : ?loc:t -> ?sub:msg list -> - ('a, Stdlib.Format.formatter, unit, error) format4 -> + ?footnote:delayed_msg -> + ('a, Format_doc.formatter, unit, error) format4 -> 'a
    val error_of_printer : ?loc:t -> ?sub:msg list -> - (Stdlib.Format.formatter -> 'a -> unit) -> + ?footnote:delayed_msg -> + (Format_doc.formatter -> 'a -> unit) -> 'a -> - error
    val error_of_printer_file : - (Stdlib.Format.formatter -> 'a -> unit) -> - 'a -> - error

    Automatically reporting errors for raised exceptions

    val register_error_of_exn : (exn -> error option) -> unit

    Each compiler module which defines a custom type of exception which can surface as a user-visible error should register a "printer" for this exception using register_error_of_exn. The result of the printer is an error value containing a location, a message, and optionally sub-messages (each of them being located as well).

    val error_of_exn : exn -> [ `Ok of error | `Already_displayed ] option
    exception Error of error

    Raising Error e signals an error e; the exception will be caught and the error will be printed.

    exception Already_displayed_error

    Raising Already_displayed_error signals an error which has already been printed. The exception will be caught, but nothing will be printed

    val raise_errorf : + error
    val error_of_printer_file : (Format_doc.formatter -> 'a -> unit) -> 'a -> error

    Automatically reporting errors for raised exceptions

    val register_error_of_exn : (exn -> error option) -> unit

    Each compiler module which defines a custom type of exception which can surface as a user-visible error should register a "printer" for this exception using register_error_of_exn. The result of the printer is an error value containing a location, a message, and optionally sub-messages (each of them being located as well).

    val error_of_exn : exn -> [ `Ok of error | `Already_displayed ] option
    exception Error of error

    Raising Error e signals an error e; the exception will be caught and the error will be printed.

    exception Already_displayed_error

    Raising Already_displayed_error signals an error which has already been printed. The exception will be caught, but nothing will be printed

    val raise_errorf : ?loc:t -> ?sub:msg list -> - ('a, Stdlib.Format.formatter, unit, 'b) format4 -> + ?footnote:delayed_msg -> + ('a, Format_doc.formatter, unit, 'b) format4 -> 'a
    val report_exception : Stdlib.Format.formatter -> exn -> unit

    Reraise the exception if it is unknown.

    diff --git a/ocaml/Mach/index.html b/ocaml/Mach/index.html index d46c3a1e..2a6821ac 100644 --- a/ocaml/Mach/index.html +++ b/ocaml/Mach/index.html @@ -1,5 +1,5 @@ -Mach (ocaml.Mach)

    Module Mach

    type integer_comparison =
    1. | Isigned of Cmm.integer_comparison
    2. | Iunsigned of Cmm.integer_comparison
    type integer_operation =
    1. | Iadd
    2. | Isub
    3. | Imul
    4. | Imulh
    5. | Idiv
    6. | Imod
    7. | Iand
    8. | Ior
    9. | Ixor
    10. | Ilsl
    11. | Ilsr
    12. | Iasr
    13. | Icomp of integer_comparison
    14. | Icheckbound
    type float_comparison = Cmm.float_comparison
    type test =
    1. | Itruetest
    2. | Ifalsetest
    3. | Iinttest of integer_comparison
    4. | Iinttest_imm of integer_comparison * int
    5. | Ifloattest of float_comparison
    6. | Ioddtest
    7. | Ieventest
    type operation =
    1. | Imove
    2. | Ispill
    3. | Ireload
    4. | Iconst_int of nativeint
    5. | Iconst_float of int64
    6. | Iconst_symbol of string
    7. | Icall_ind
    8. | Icall_imm of {
      1. func : string;
      }
    9. | Itailcall_ind
    10. | Itailcall_imm of {
      1. func : string;
      }
    11. | Iextcall of {
      1. func : string;
      2. ty_res : Cmm.machtype;
      3. ty_args : Cmm.exttype list;
      4. alloc : bool;
      5. stack_ofs : int;
      }
    12. | Istackoffset of int
    13. | Iload of {
      1. memory_chunk : Cmm.memory_chunk;
      2. addressing_mode : Arch.addressing_mode;
      3. mutability : Asttypes.mutable_flag;
      4. is_atomic : bool;
      }
    14. | Istore of Cmm.memory_chunk * Arch.addressing_mode * bool
    15. | Ialloc of {
      1. bytes : int;
      2. dbginfo : Debuginfo.alloc_dbginfo;
      }
    16. | Iintop of integer_operation
    17. | Iintop_imm of integer_operation * int
    18. | Icompf of float_comparison
    19. | Inegf
    20. | Iabsf
    21. | Iaddf
    22. | Isubf
    23. | Imulf
    24. | Idivf
    25. | Ifloatofint
    26. | Iintoffloat
    27. | Iopaque
    28. | Ispecific of Arch.specific_operation
    29. | Ipoll of {
      1. return_label : Cmm.label option;
      }
    30. | Idls_get
    type instruction = {
    1. desc : instruction_desc;
    2. next : instruction;
    3. arg : Reg.t array;
    4. res : Reg.t array;
    5. dbg : Debuginfo.t;
    6. mutable live : Reg.Set.t;
    }
    and instruction_desc =
    1. | Iend
    2. | Iop of operation
    3. | Ireturn
    4. | Iifthenelse of test * instruction * instruction
    5. | Iswitch of int array * instruction array
    6. | Icatch of Cmm.rec_flag * (int * instruction) list * instruction
    7. | Iexit of int
    8. | Itrywith of instruction * instruction
    9. | Iraise of Lambda.raise_kind
    type fundecl = {
    1. fun_name : string;
    2. fun_args : Reg.t array;
    3. fun_body : instruction;
    4. fun_codegen_options : Cmm.codegen_option list;
    5. fun_dbg : Debuginfo.t;
    6. fun_poll : Lambda.poll_attribute;
    7. fun_num_stack_slots : int array;
    8. fun_contains_calls : bool;
    }
    val dummy_instr : instruction
    val end_instr : unit -> instruction
    val instr_cons : +Mach (ocaml.Mach)

    Module Mach

    type integer_comparison =
    1. | Isigned of Cmm.integer_comparison
    2. | Iunsigned of Cmm.integer_comparison
    type integer_operation =
    1. | Iadd
    2. | Isub
    3. | Imul
    4. | Imulh
    5. | Idiv
    6. | Imod
    7. | Iand
    8. | Ior
    9. | Ixor
    10. | Ilsl
    11. | Ilsr
    12. | Iasr
    13. | Icomp of integer_comparison
    14. | Icheckbound
    type float_comparison = Cmm.float_comparison
    type test =
    1. | Itruetest
    2. | Ifalsetest
    3. | Iinttest of integer_comparison
    4. | Iinttest_imm of integer_comparison * int
    5. | Ifloattest of float_comparison
    6. | Ioddtest
    7. | Ieventest
    type operation =
    1. | Imove
    2. | Ispill
    3. | Ireload
    4. | Iconst_int of nativeint
    5. | Iconst_float of int64
    6. | Iconst_symbol of string
    7. | Icall_ind
    8. | Icall_imm of {
      1. func : string;
      }
    9. | Itailcall_ind
    10. | Itailcall_imm of {
      1. func : string;
      }
    11. | Iextcall of {
      1. func : string;
      2. ty_res : Cmm.machtype;
      3. ty_args : Cmm.exttype list;
      4. alloc : bool;
      5. stack_ofs : int;
      }
    12. | Istackoffset of int
    13. | Iload of {
      1. memory_chunk : Cmm.memory_chunk;
      2. addressing_mode : Arch.addressing_mode;
      3. mutability : Asttypes.mutable_flag;
      4. is_atomic : bool;
      }
    14. | Istore of Cmm.memory_chunk * Arch.addressing_mode * bool
    15. | Ialloc of {
      1. bytes : int;
      2. dbginfo : Debuginfo.alloc_dbginfo;
      }
    16. | Iintop of integer_operation
    17. | Iintop_imm of integer_operation * int
    18. | Icompf of float_comparison
    19. | Inegf
    20. | Iabsf
    21. | Iaddf
    22. | Isubf
    23. | Imulf
    24. | Idivf
    25. | Ifloatofint
    26. | Iintoffloat
    27. | Iopaque
    28. | Ispecific of Arch.specific_operation
    29. | Ipoll of {
      1. return_label : Cmm.label option;
      }
    30. | Idls_get
    31. | Ireturn_addr
      (*

      Retrieve the return address from the stack frame

      *)
    type instruction = {
    1. desc : instruction_desc;
    2. next : instruction;
    3. arg : Reg.t array;
    4. res : Reg.t array;
    5. dbg : Debuginfo.t;
    6. mutable live : Reg.Set.t;
    }
    and instruction_desc =
    1. | Iend
    2. | Iop of operation
    3. | Ireturn
    4. | Iifthenelse of test * instruction * instruction
    5. | Iswitch of int array * instruction array
    6. | Icatch of Cmm.rec_flag * (int * instruction) list * instruction
    7. | Iexit of int
    8. | Itrywith of instruction * instruction
    9. | Iraise of Lambda.raise_kind
    type fundecl = {
    1. fun_name : string;
    2. fun_args : Reg.t array;
    3. fun_body : instruction;
    4. fun_codegen_options : Cmm.codegen_option list;
    5. fun_dbg : Debuginfo.t;
    6. fun_poll : Lambda.poll_attribute;
    7. fun_num_stack_slots : int array;
    }
    val dummy_instr : instruction
    val end_instr : unit -> instruction
    val instr_cons : instruction_desc -> Reg.t array -> Reg.t array -> diff --git a/ocaml/Main_args/Default/Main/index.html b/ocaml/Main_args/Default/Main/index.html index 226bf3d6..acfe2a54 100644 --- a/ocaml/Main_args/Default/Main/index.html +++ b/ocaml/Main_args/Default/Main/index.html @@ -1,2 +1,2 @@ -Main (ocaml.Main_args.Default.Main)

    Module Default.Main

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    +Main (ocaml.Main_args.Default.Main)

    Module Default.Main

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _binannot_occurrences : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    diff --git a/ocaml/Main_args/Default/Odoc_args/index.html b/ocaml/Main_args/Default/Odoc_args/index.html index a78158fe..890cec38 100644 --- a/ocaml/Main_args/Default/Odoc_args/index.html +++ b/ocaml/Main_args/Default/Odoc_args/index.html @@ -1,2 +1,2 @@ -Odoc_args (ocaml.Main_args.Default.Odoc_args)

    Module Default.Odoc_args

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    +Odoc_args (ocaml.Main_args.Default.Odoc_args)

    Module Default.Odoc_args

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    diff --git a/ocaml/Main_args/Default/Optmain/index.html b/ocaml/Main_args/Default/Optmain/index.html index 994dce4e..d0673173 100644 --- a/ocaml/Main_args/Default/Optmain/index.html +++ b/ocaml/Main_args/Default/Optmain/index.html @@ -1,2 +1,2 @@ -Optmain (ocaml.Main_args.Default.Optmain)

    Module Default.Optmain

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    +Optmain (ocaml.Main_args.Default.Optmain)

    Module Default.Optmain

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _binannot_occurrences : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    diff --git a/ocaml/Main_args/Default/Opttopmain/index.html b/ocaml/Main_args/Default/Opttopmain/index.html index 83d7bcdc..067668bf 100644 --- a/ocaml/Main_args/Default/Opttopmain/index.html +++ b/ocaml/Main_args/Default/Opttopmain/index.html @@ -1,2 +1,2 @@ -Opttopmain (ocaml.Main_args.Default.Opttopmain)

    Module Default.Opttopmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    +Opttopmain (ocaml.Main_args.Default.Opttopmain)

    Module Default.Opttopmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _prompt : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    diff --git a/ocaml/Main_args/Default/Topmain/index.html b/ocaml/Main_args/Default/Topmain/index.html index c5c228aa..ee630b54 100644 --- a/ocaml/Main_args/Default/Topmain/index.html +++ b/ocaml/Main_args/Default/Topmain/index.html @@ -1,2 +1,2 @@ -Topmain (ocaml.Main_args.Default.Topmain)

    Module Default.Topmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    +Topmain (ocaml.Main_args.Default.Topmain)

    Module Default.Topmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _prompt : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    diff --git a/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html b/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html index 10ff9bc2..20367b75 100644 --- a/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html +++ b/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_bytecomp_options._)

    Parameter Make_bytecomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    +_ (ocaml.Main_args.Make_bytecomp_options._)

    Parameter Make_bytecomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _binannot_occurrences : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    diff --git a/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html b/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html index e22a2bc8..a2f7da38 100644 --- a/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html +++ b/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_bytetop_options._)

    Parameter Make_bytetop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    +_ (ocaml.Main_args.Make_bytetop_options._)

    Parameter Make_bytetop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _prompt : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    diff --git a/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html b/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html index 0af8c670..31832b98 100644 --- a/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html +++ b/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_ocamldoc_options._)

    Parameter Make_ocamldoc_options._

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    +_ (ocaml.Main_args.Make_ocamldoc_options._)

    Parameter Make_ocamldoc_options._

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    diff --git a/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html b/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html index cdef208c..9317b21e 100644 --- a/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html +++ b/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_optcomp_options._)

    Parameter Make_optcomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    +_ (ocaml.Main_args.Make_optcomp_options._)

    Parameter Make_optcomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _binannot_occurrences : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    diff --git a/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html b/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html index 5691bd37..5a5eec47 100644 --- a/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html +++ b/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_opttop_options._)

    Parameter Make_opttop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    +_ (ocaml.Main_args.Make_opttop_options._)

    Parameter Make_opttop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _prompt : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    diff --git a/ocaml/Main_args/module-type-Bytecomp_options/index.html b/ocaml/Main_args/module-type-Bytecomp_options/index.html index a7054041..71077906 100644 --- a/ocaml/Main_args/module-type-Bytecomp_options/index.html +++ b/ocaml/Main_args/module-type-Bytecomp_options/index.html @@ -1,2 +1,2 @@ -Bytecomp_options (ocaml.Main_args.Bytecomp_options)

    Module type Main_args.Bytecomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    +Bytecomp_options (ocaml.Main_args.Bytecomp_options)

    Module type Main_args.Bytecomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _binannot_occurrences : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    diff --git a/ocaml/Main_args/module-type-Bytetop_options/index.html b/ocaml/Main_args/module-type-Bytetop_options/index.html index 1ecb866a..d1a58682 100644 --- a/ocaml/Main_args/module-type-Bytetop_options/index.html +++ b/ocaml/Main_args/module-type-Bytetop_options/index.html @@ -1,2 +1,2 @@ -Bytetop_options (ocaml.Main_args.Bytetop_options)

    Module type Main_args.Bytetop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    +Bytetop_options (ocaml.Main_args.Bytetop_options)

    Module type Main_args.Bytetop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _prompt : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    diff --git a/ocaml/Main_args/module-type-Common_options/index.html b/ocaml/Main_args/module-type-Common_options/index.html index e1d7f468..d975abe4 100644 --- a/ocaml/Main_args/module-type-Common_options/index.html +++ b/ocaml/Main_args/module-type-Common_options/index.html @@ -1,2 +1,2 @@ -Common_options (ocaml.Main_args.Common_options)

    Module type Main_args.Common_options

    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    +Common_options (ocaml.Main_args.Common_options)

    Module type Main_args.Common_options

    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    diff --git a/ocaml/Main_args/module-type-Compiler_options/index.html b/ocaml/Main_args/module-type-Compiler_options/index.html index d332ebd8..ebbf61b7 100644 --- a/ocaml/Main_args/module-type-Compiler_options/index.html +++ b/ocaml/Main_args/module-type-Compiler_options/index.html @@ -1,2 +1,2 @@ -Compiler_options (ocaml.Main_args.Compiler_options)

    Module type Main_args.Compiler_options

    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    +Compiler_options (ocaml.Main_args.Compiler_options)

    Module type Main_args.Compiler_options

    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _binannot_occurrences : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    diff --git a/ocaml/Main_args/module-type-Core_options/index.html b/ocaml/Main_args/module-type-Core_options/index.html index 6814f3f8..eddc2587 100644 --- a/ocaml/Main_args/module-type-Core_options/index.html +++ b/ocaml/Main_args/module-type-Core_options/index.html @@ -1,2 +1,2 @@ -Core_options (ocaml.Main_args.Core_options)

    Module type Main_args.Core_options

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    +Core_options (ocaml.Main_args.Core_options)

    Module type Main_args.Core_options

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    diff --git a/ocaml/Main_args/module-type-Ocamldoc_options/index.html b/ocaml/Main_args/module-type-Ocamldoc_options/index.html index a34e199c..a60241f6 100644 --- a/ocaml/Main_args/module-type-Ocamldoc_options/index.html +++ b/ocaml/Main_args/module-type-Ocamldoc_options/index.html @@ -1,2 +1,2 @@ -Ocamldoc_options (ocaml.Main_args.Ocamldoc_options)

    Module type Main_args.Ocamldoc_options

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    +Ocamldoc_options (ocaml.Main_args.Ocamldoc_options)

    Module type Main_args.Ocamldoc_options

    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    diff --git a/ocaml/Main_args/module-type-Optcomp_options/index.html b/ocaml/Main_args/module-type-Optcomp_options/index.html index 33f4149d..285e853f 100644 --- a/ocaml/Main_args/module-type-Optcomp_options/index.html +++ b/ocaml/Main_args/module-type-Optcomp_options/index.html @@ -1,2 +1,2 @@ -Optcomp_options (ocaml.Main_args.Optcomp_options)

    Module type Main_args.Optcomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    +Optcomp_options (ocaml.Main_args.Optcomp_options)

    Module type Main_args.Optcomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _binannot_occurrences : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _no_g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    diff --git a/ocaml/Main_args/module-type-Opttop_options/index.html b/ocaml/Main_args/module-type-Opttop_options/index.html index 404a9d65..c84ce62a 100644 --- a/ocaml/Main_args/module-type-Opttop_options/index.html +++ b/ocaml/Main_args/module-type-Opttop_options/index.html @@ -1,2 +1,2 @@ -Opttop_options (ocaml.Main_args.Opttop_options)

    Module type Main_args.Opttop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    +Opttop_options (ocaml.Main_args.Opttop_options)

    Module type Main_args.Opttop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _prompt : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    diff --git a/ocaml/Main_args/module-type-Toplevel_options/index.html b/ocaml/Main_args/module-type-Toplevel_options/index.html index a1258d8e..84632de6 100644 --- a/ocaml/Main_args/module-type-Toplevel_options/index.html +++ b/ocaml/Main_args/module-type-Toplevel_options/index.html @@ -1,2 +1,2 @@ -Toplevel_options (ocaml.Main_args.Toplevel_options)

    Module type Main_args.Toplevel_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    +Toplevel_options (ocaml.Main_args.Toplevel_options)

    Module type Main_args.Toplevel_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _no_absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _H : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _keywords : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safer_matching : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _prompt : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    diff --git a/ocaml/Matching/index.html b/ocaml/Matching/index.html index 84825db6..9883e43d 100644 --- a/ocaml/Matching/index.html +++ b/ocaml/Matching/index.html @@ -11,6 +11,13 @@ Location.t -> Lambda.lambda -> (Typedtree.pattern * Lambda.lambda) list -> + Lambda.lambda
    val for_let : scopes:Debuginfo.Scoped_location.scopes -> Location.t -> @@ -29,7 +36,19 @@ Ident.t list -> (Typedtree.pattern list * Lambda.lambda) list -> Typedtree.partial -> - Lambda.lambda
    exception Cannot_flatten
    val flatten_pattern : int -> Typedtree.pattern -> Typedtree.pattern list
    val expand_stringswitch : + Lambda.lambda
    val for_optional_arg_default : + scopes:Debuginfo.Scoped_location.scopes -> + Location.t -> + Typedtree.pattern -> + default_arg:Lambda.lambda -> + param:Ident.t -> + Lambda.lambda -> + Lambda.lambda

    for_optional_arg_default pat body ~default_arg ~param is:

    let $pat =
    +  match $param with
    +  | Some x -> x
    +  | None -> $default_arg
    +in
    +$body
    exception Cannot_flatten
    val flatten_pattern : int -> Typedtree.pattern -> Typedtree.pattern list
    val expand_stringswitch : Lambda.scoped_location -> Lambda.lambda -> (string * Lambda.lambda) list -> diff --git a/ocaml/Meta/index.html b/ocaml/Meta/index.html index d044fb2d..8a866e47 100644 --- a/ocaml/Meta/index.html +++ b/ocaml/Meta/index.html @@ -1,10 +1,11 @@ Meta (ocaml.Meta)

    Module Meta

    val global_data : unit -> Stdlib.Obj.t array
    val realloc_global_data : int -> unit
    type closure = unit -> Stdlib.Obj.t
    type bytecode
    val reify_bytecode : - bytes array -> + (char, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) + Stdlib.Bigarray.Array1.t -> Instruct.debug_event list array -> string option -> bytecode * closure
    val release_bytecode : bytecode -> unit
    val invoke_traced_function : Stdlib.Obj.raw_data -> Stdlib.Obj.t -> Stdlib.Obj.t -> - Stdlib.Obj.t
    val get_section_table : unit -> (string * Stdlib.Obj.t) list
    + Stdlib.Obj.t
    diff --git a/ocaml/Misc/Color/index.html b/ocaml/Misc/Color/index.html index 487d1f41..0b1a19cc 100644 --- a/ocaml/Misc/Color/index.html +++ b/ocaml/Misc/Color/index.html @@ -1,2 +1,2 @@ -Color (ocaml.Misc.Color)

    Module Misc.Color

    type color =
    1. | Black
    2. | Red
    3. | Green
    4. | Yellow
    5. | Blue
    6. | Magenta
    7. | Cyan
    8. | White
    type style =
    1. | FG of color
    2. | BG of color
    3. | Bold
    4. | Reset
    type Stdlib.Format.stag +=
    1. | Style of style list
    val ansi_of_style_l : style list -> string
    type styles = {
    1. error : style list;
    2. warning : style list;
    3. loc : style list;
    4. hint : style list;
    }
    val default_styles : styles
    val get_styles : unit -> styles
    val set_styles : styles -> unit
    type setting =
    1. | Auto
    2. | Always
    3. | Never
    val default_setting : setting
    val setup : setting option -> unit
    val set_color_tag_handling : Stdlib.Format.formatter -> unit
    +Color (ocaml.Misc.Color)

    Module Misc.Color

    Color support detection

    type setting =
    1. | Auto
    2. | Always
    3. | Never
    val default_setting : setting
    diff --git a/ocaml/Misc/LongString/index.html b/ocaml/Misc/LongString/index.html deleted file mode 100644 index 877af8e8..00000000 --- a/ocaml/Misc/LongString/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -LongString (ocaml.Misc.LongString)

    Module Misc.LongString

    type t = bytes array
    val create : int -> t
    val length : t -> int
    val get : t -> int -> char
    val set : t -> int -> char -> unit
    val blit : t -> int -> t -> int -> int -> unit
    val blit_string : string -> int -> t -> int -> int -> unit
    val output : out_channel -> t -> int -> int -> unit
    val input_bytes_into : t -> in_channel -> int -> unit
    val input_bytes : in_channel -> int -> t
    diff --git a/ocaml/Misc/Stdlib/List/index.html b/ocaml/Misc/Stdlib/List/index.html index 4e3cdff5..2196a7c7 100644 --- a/ocaml/Misc/Stdlib/List/index.html +++ b/ocaml/Misc/Stdlib/List/index.html @@ -1,5 +1,5 @@ -List (ocaml.Misc.Stdlib.List)

    Module Stdlib.List

    Extensions to the List module

    type 'a t = 'a list
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    The lexicographic order supported by the provided order. There is no constraint on the relative lengths of the lists.

    val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

    Returns true if and only if the given lists have the same length and content with respect to the given equality function.

    val some_if_all_elements_are_some : 'a option t -> 'a t option

    If all elements of the given list are Some _ then Some xs is returned with the xs being the contents of those Somes, with order preserved. Otherwise return None.

    val map2_prefix : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t * 'b t

    let r1, r2 = map2_prefix f l1 l2 If l1 is of length n and l2 = h2 @ t2 with h2 of length n, r1 is List.map2 f l1 h1 and r2 is t2.

    val split_at : int -> 'a t -> 'a t * 'a t

    split_at n l returns the pair before, after where before is the n first elements of l and after the remaining ones. If l has less than n elements, raises Invalid_argument.

    val is_prefix : equal:('a -> 'a -> bool) -> 'a list -> of_:'a list -> bool

    Returns true if and only if the given list, with respect to the given equality function on list members, is a prefix of the list of_.

    type 'a longest_common_prefix_result = private {
    1. longest_common_prefix : 'a list;
    2. first_without_longest_common_prefix : 'a list;
    3. second_without_longest_common_prefix : 'a list;
    }
    val find_and_chop_longest_common_prefix : +List (ocaml.Misc.Stdlib.List)

    Module Stdlib.List

    Extensions to the List module

    type 'a t = 'a list
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    The lexicographic order supported by the provided order. There is no constraint on the relative lengths of the lists.

    val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

    Returns true if and only if the given lists have the same length and content with respect to the given equality function.

    val some_if_all_elements_are_some : 'a option t -> 'a t option

    If all elements of the given list are Some _ then Some xs is returned with the xs being the contents of those Somes, with order preserved. Otherwise return None.

    val map2_prefix : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t * 'b t

    let r1, r2 = map2_prefix f l1 l2 If l1 is of length n and l2 = h2 @ t2 with h2 of length n, r1 is List.map2 f l1 h1 and r2 is t2.

    val iteri2 : (int -> 'a -> 'b -> unit) -> 'a list -> 'b list -> unit

    Same as List.iter2, but the function is applied to the index of the element as first argument (counting from 0)

    val split_at : int -> 'a t -> 'a t * 'a t

    split_at n l returns the pair before, after where before is the n first elements of l and after the remaining ones. If l has less than n elements, raises Invalid_argument.

    val chunks_of : int -> 'a t -> 'a t t

    chunks_of n t returns a list of nonempty lists whose concatenation is equal to the original list. Every list has n elements, except for possibly the last list, which may have fewer. chunks_of raises if n <= 0.

    val is_prefix : equal:('a -> 'a -> bool) -> 'a list -> of_:'a list -> bool

    Returns true if and only if the given list, with respect to the given equality function on list members, is a prefix of the list of_.

    type 'a longest_common_prefix_result = private {
    1. longest_common_prefix : 'a list;
    2. first_without_longest_common_prefix : 'a list;
    3. second_without_longest_common_prefix : 'a list;
    }
    val find_and_chop_longest_common_prefix : equal:('a -> 'a -> bool) -> first:'a list -> second:'a list -> diff --git a/ocaml/Misc/Stdlib/String/index.html b/ocaml/Misc/Stdlib/String/index.html index 975dc26f..34a17e8c 100644 --- a/ocaml/Misc/Stdlib/String/index.html +++ b/ocaml/Misc/Stdlib/String/index.html @@ -1,3 +1,3 @@ -String (ocaml.Misc.Stdlib.String)

    Module Stdlib.String

    Extensions to the String module

    include module type of Stdlib.String

    Strings

    type t = string

    The type for strings.

    val make : int -> char -> string

    make n c is a string of length n with each index holding the character c.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_string_length.

    val init : int -> (int -> char) -> string

    init n f is a string of length n with index i holding the character f i (called in increasing index order).

    • raises Invalid_argument

      if n < 0 or n > Sys.max_string_length.

    • since 4.02
    val empty : string

    The empty string.

    • since 4.13
    val length : string -> int

    length s is the length (number of bytes/characters) of s.

    val get : string -> int -> char

    get s i is the character at index i in s. This is the same as writing s.[i].

    • raises Invalid_argument

      if i not an index of s.

    val of_bytes : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    • since 4.13
    val to_bytes : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    • since 4.13
    val blit : string -> int -> bytes -> int -> int -> unit

    Same as Bytes.blit_string which should be preferred.

    Concatenating

    Note. The Stdlib.(^) binary operator concatenates two strings.

    val concat : string -> string list -> string

    concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    val cat : string -> string -> string

    cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    • since 4.13

    Predicates and comparisons

    val equal : t -> t -> bool

    equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

    • since 4.03 (4.05 in StringLabels)
    val compare : t -> t -> int

    compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

    val starts_with : prefix:string -> string -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13
    val ends_with : suffix:string -> string -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13
    val contains_from : string -> int -> char -> bool

    contains_from s start c is true if and only if c appears in s after position start.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : string -> int -> char -> bool

    rcontains_from s stop c is true if and only if c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val contains : string -> char -> bool

    contains s c is String.contains_from s 0 c.

    Extracting substrings

    val sub : string -> int -> int -> string

    sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val split_on_char : char -> string -> string list

    split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

    The function's result is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) - (split_on_char sep s) = s).
    • No string in the result contains the sep character.
    • since 4.04 (4.05 in StringLabels)

    Transforming

    val map : (char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00
    val mapi : (int -> char -> char) -> string -> string

    mapi f s is like map but the index of the character is also passed to f.

    • since 4.02
    val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13
    val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13
    val exists : (char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)

    Traversing

    val iter : (char -> unit) -> string -> unit

    iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : (int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Stdlib.Seq.t

    to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Stdlib.Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Stdlib.Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13
    val hash : t -> int

    An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

    • since 5.0
    val seeded_hash : int -> t -> int

    A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

    • since 5.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13
    module Set : Set.S with type elt = string
    module Map : Map.S with type key = string
    module Tbl : Hashtbl.S with type key = string
    val print : Stdlib.Format.formatter -> t -> unit
    val for_all : (char -> bool) -> t -> bool
    +String (ocaml.Misc.Stdlib.String)

    Module Stdlib.String

    Extensions to the String module

    include module type of Stdlib.String

    Strings

    type t = string

    The type for strings.

    val make : int -> char -> string

    make n c is a string of length n with each index holding the character c.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_string_length.

    val init : int -> (int -> char) -> string

    init n f is a string of length n with index i holding the character f i (called in increasing index order).

    • raises Invalid_argument

      if n < 0 or n > Sys.max_string_length.

    • since 4.02
    val empty : string

    The empty string.

    • since 4.13
    val length : string -> int

    length s is the length (number of bytes/characters) of s.

    val get : string -> int -> char

    get s i is the character at index i in s. This is the same as writing s.[i].

    • raises Invalid_argument

      if i not an index of s.

    val of_bytes : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    • since 4.13
    val to_bytes : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    • since 4.13
    val blit : string -> int -> bytes -> int -> int -> unit

    Same as Bytes.blit_string which should be preferred.

    Concatenating

    Note. The Stdlib.(^) binary operator concatenates two strings.

    val concat : string -> string list -> string

    concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    val cat : string -> string -> string

    cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    • since 4.13

    Predicates and comparisons

    val equal : t -> t -> bool

    equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

    • since 4.03 (4.05 in StringLabels)
    val compare : t -> t -> int

    compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

    val starts_with : prefix:string -> string -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13
    val ends_with : suffix:string -> string -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13
    val contains_from : string -> int -> char -> bool

    contains_from s start c is true if and only if c appears in s after position start.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : string -> int -> char -> bool

    rcontains_from s stop c is true if and only if c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val contains : string -> char -> bool

    contains s c is String.contains_from s 0 c.

    Extracting substrings

    val sub : string -> int -> int -> string

    sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val split_on_char : char -> string -> string list

    split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep. If s is empty, the result is the singleton list [""].

    The function's result is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
    • No string in the result contains the sep character.
    • since 4.04 (4.05 in StringLabels)

    Transforming

    val map : (char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00
    val mapi : (int -> char -> char) -> string -> string

    mapi f s is like map but the index of the character is also passed to f.

    • since 4.02
    val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13
    val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13
    val exists : (char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03 (4.05 in StringLabels)

    Traversing

    val iter : (char -> unit) -> string -> unit

    iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : (int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Stdlib.Seq.t

    to_seq s is a sequence made of the string's characters in increasing order.

    • since 4.07
    val to_seqi : t -> (int * char) Stdlib.Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Stdlib.Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13
    val hash : t -> int

    An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

    • since 5.0
    val seeded_hash : int -> t -> int

    A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

    • since 5.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13
    module Set : Set.S with type elt = string
    module Map : Map.S with type key = string
    module Tbl : Hashtbl.S with type key = string
    val print : Stdlib.Format.formatter -> t -> unit
    val for_all : (char -> bool) -> t -> bool
    diff --git a/ocaml/Misc/Style/index.html b/ocaml/Misc/Style/index.html new file mode 100644 index 00000000..a4de1a91 --- /dev/null +++ b/ocaml/Misc/Style/index.html @@ -0,0 +1,2 @@ + +Style (ocaml.Misc.Style)

    Module Misc.Style

    type color =
    1. | Black
    2. | Red
    3. | Green
    4. | Yellow
    5. | Blue
    6. | Magenta
    7. | Cyan
    8. | White
    type style =
    1. | FG of color
    2. | BG of color
    3. | Bold
    4. | Reset
    type Stdlib.Format.stag +=
    1. | Style of style list
    val ansi_of_style_l : style list -> string
    type tag_style = {
    1. ansi : style list;
    2. text_open : string;
    3. text_close : string;
    }
    type styles = {
    1. error : tag_style;
    2. warning : tag_style;
    3. loc : tag_style;
    4. hint : tag_style;
    5. inline_code : tag_style;
    }
    val as_inline_code : 'a Format_doc.printer -> 'a Format_doc.printer
    val inline_code : string Format_doc.printer
    val default_styles : styles
    val get_styles : unit -> styles
    val set_styles : styles -> unit
    val setup : Color.setting option -> unit
    val set_tag_handling : Stdlib.Format.formatter -> unit
    diff --git a/ocaml/Misc/Utf8_lexeme/index.html b/ocaml/Misc/Utf8_lexeme/index.html new file mode 100644 index 00000000..81633d45 --- /dev/null +++ b/ocaml/Misc/Utf8_lexeme/index.html @@ -0,0 +1,2 @@ + +Utf8_lexeme (ocaml.Misc.Utf8_lexeme)

    Module Misc.Utf8_lexeme

    type t = string
    val normalize : string -> (t, t) Stdlib.Result.t

    Normalize the given UTF-8 encoded string. Invalid UTF-8 sequences results in a error and are replaced by U+FFFD. Identifier characters are put in NFC normalized form. Other Unicode characters are left unchanged.

    val capitalize : string -> (t, t) Stdlib.Result.t

    Like normalize, but if the string starts with a lowercase identifier character, it is replaced by the corresponding uppercase character. Subsequent characters are not changed.

    val uncapitalize : string -> (t, t) Stdlib.Result.t

    Like normalize, but if the string starts with an uppercase identifier character, it is replaced by the corresponding lowercase character. Subsequent characters are not changed.

    val is_capitalized : t -> bool

    Returns true if the given normalized string starts with an uppercase identifier character, false otherwise. May return wrong results if the string is not normalized.

    val is_valid_identifier : t -> bool

    Check whether the given normalized string is a valid OCaml identifier:

    • all characters are identifier characters
    • it does not start with a digit or a single quote
    val is_lowercase : t -> bool

    Returns true if the given normalized string only contains lowercase identifier character, false otherwise. May return wrong results if the string is not normalized.

    type validation_result =
    1. | Valid
    2. | Invalid_character of Stdlib.Uchar.t
      (*

      Character not allowed

      *)
    3. | Invalid_beginning of Stdlib.Uchar.t
      (*

      Character not allowed as first char

      *)
    val validate_identifier : ?with_dot:bool -> t -> validation_result

    Like is_valid_identifier, but returns a more detailed error code. Dots can be allowed to extend support to path-like identifiers.

    val starts_like_a_valid_identifier : t -> bool

    Checks whether the given normalized string starts with an identifier character other than a digit or a single quote. Subsequent characters are not checked.

    diff --git a/ocaml/Misc/index.html b/ocaml/Misc/index.html index 63aeb56d..7857d093 100644 --- a/ocaml/Misc/index.html +++ b/ocaml/Misc/index.html @@ -1,5 +1,5 @@ -Misc (ocaml.Misc)

    Module Misc

    Miscellaneous useful types and functions

    Warning: this module is unstable and part of compiler-libs.

    Reporting fatal errors

    val fatal_error : string -> 'a

    Raise the Fatal_error exception with the given string.

    val fatal_errorf : ('a, Stdlib.Format.formatter, unit, 'b) format4 -> 'a

    Format the arguments according to the given format string and raise Fatal_error with the resulting string.

    exception Fatal_error

    Exceptions and finalization

    val try_finally : +Misc (ocaml.Misc)

    Module Misc

    Miscellaneous useful types and functions

    Warning: this module is unstable and part of compiler-libs.

    Reporting fatal errors

    val fatal_error : string -> 'a

    Raise the Fatal_error exception with the given string.

    val fatal_errorf : ('a, Stdlib.Format.formatter, unit, 'b) format4 -> 'a

    Format the arguments according to the given format string and raise Fatal_error with the resulting string.

    exception Fatal_error

    Exceptions and finalization

    val try_finally : ?always:(unit -> unit) -> ?exceptionally:(unit -> unit) -> (unit -> 'a) -> @@ -12,26 +12,14 @@ Misc.try_finally (Emitcode.to_file oc modulename objfile); Warnings.check_fatal ()) ~always:(fun () -> close_out oc) - ~exceptionally:(fun _exn -> remove_file objfile);

    If exceptionally fail with an exception, it is propagated as usual.

    If always or exceptionally use exceptions internally for control-flow but do not raise, then try_finally is careful to preserve any exception backtrace coming from work or always for easier debugging.

    val reraise_preserving_backtrace : exn -> (unit -> unit) -> 'a

    reraise_preserving_backtrace e f is (f (); raise e) except that the current backtrace is preserved, even if f uses exceptions internally.

    List operations

    val map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list

    map_end f l t is map f l @ t, just more efficient.

    val map_left_right : ('a -> 'b) -> 'a list -> 'b list

    Like List.map, with guaranteed left-to-right evaluation order

    val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

    Same as List.for_all but for a binary predicate. In addition, this for_all2 never fails: given two lists with different lengths, it returns false.

    val replicate_list : 'a -> int -> 'a list

    replicate_list elem n is the list with n elements all identical to elem.

    val list_remove : 'a -> 'a list -> 'a list

    list_remove x l returns a copy of l with the first element equal to x removed.

    val split_last : 'a list -> 'a list * 'a

    Return the last element and the other elements of the given list.

    Hash table operations

    val create_hashtable : int -> ('a * 'b) list -> ('a, 'b) Stdlib.Hashtbl.t

    Create a hashtable with the given initial size and fills it with the given bindings.

    Extensions to the standard library

    module Stdlib : sig ... end

    Operations on files and file paths

    val find_in_path : string list -> string -> string

    Search a file in a list of directories.

    val find_in_path_rel : string list -> string -> string

    Search a relative file in a list of directories.

    val find_in_path_uncap : string list -> string -> string

    Same, but search also for uncapitalized name, i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

    val remove_file : string -> unit

    Delete the given file if it exists and is a regular file. Does nothing for other kinds of files. Never raises an error.

    val expand_directory : string -> string -> string

    expand_directory alt file eventually expands a + at the beginning of file into alt (an alternate root directory)

    val split_path_contents : ?sep:char -> string -> string list

    split_path_contents ?sep s interprets s as the value of a "PATH"-like variable and returns the corresponding list of directories. s is split using the platform-specific delimiter, or ~sep if it is passed.

    Returns the empty list if s is empty.

    val copy_file : in_channel -> out_channel -> unit

    copy_file ic oc reads the contents of file ic and copies them to oc. It stops when encountering EOF on ic.

    val copy_file_chunk : in_channel -> out_channel -> int -> unit

    copy_file_chunk ic oc n reads n bytes from ic and copies them to oc. It raises End_of_file when encountering EOF on ic.

    val string_of_file : in_channel -> string

    string_of_file ic reads the contents of file ic and copies them to a string. It stops when encountering EOF on ic.

    val output_to_file_via_temporary : + ~exceptionally:(fun _exn -> remove_file objfile);

    If exceptionally fail with an exception, it is propagated as usual.

    If always or exceptionally use exceptions internally for control-flow but do not raise, then try_finally is careful to preserve any exception backtrace coming from work or always for easier debugging.

    val reraise_preserving_backtrace : exn -> (unit -> unit) -> 'a

    reraise_preserving_backtrace e f is (f (); raise e) except that the current backtrace is preserved, even if f uses exceptions internally.

    List operations

    val map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list

    map_end f l t is map f l @ t, just more efficient.

    val rev_map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list

    map_end f l t is map f (rev l) @ t, just more efficient.

    val map_left_right : ('a -> 'b) -> 'a list -> 'b list

    Like List.map, with guaranteed left-to-right evaluation order

    val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

    Same as List.for_all but for a binary predicate. In addition, this for_all2 never fails: given two lists with different lengths, it returns false.

    val replicate_list : 'a -> int -> 'a list

    replicate_list elem n is the list with n elements all identical to elem.

    val list_remove : 'a -> 'a list -> 'a list

    list_remove x l returns a copy of l with the first element equal to x removed.

    val split_last : 'a list -> 'a list * 'a

    Return the last element and the other elements of the given list.

    Hash table operations

    val create_hashtable : int -> ('a * 'b) list -> ('a, 'b) Stdlib.Hashtbl.t

    Create a hashtable with the given initial size and fills it with the given bindings.

    Extensions to the standard library

    module Stdlib : sig ... end

    Operations on files and file paths

    val find_in_path : string list -> string -> string

    Search a file in a list of directories.

    val find_in_path_rel : string list -> string -> string

    Search a relative file in a list of directories.

    val normalized_unit_filename : string -> (string, string) Stdlib.Result.t

    Normalize file name Foo.ml to foo.ml, using NFC and case-folding. Return Error if the input is not a valid utf-8 byte sequence

    val find_in_path_normalized : string list -> string -> string

    Same as find_in_path_rel , but search also for normalized unit filename, i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

    val remove_file : string -> unit

    Delete the given file if it exists and is a regular file. Does nothing for other kinds of files. Never raises an error.

    val expand_directory : string -> string -> string

    expand_directory alt file eventually expands a + at the beginning of file into alt (an alternate root directory)

    val split_path_contents : ?sep:char -> string -> string list

    split_path_contents ?sep s interprets s as the value of a "PATH"-like variable and returns the corresponding list of directories. s is split using the platform-specific delimiter, or ~sep if it is passed.

    Returns the empty list if s is empty.

    val copy_file : in_channel -> out_channel -> unit

    copy_file ic oc reads the contents of file ic and copies them to oc. It stops when encountering EOF on ic.

    val copy_file_chunk : in_channel -> out_channel -> int -> unit

    copy_file_chunk ic oc n reads n bytes from ic and copies them to oc. It raises End_of_file when encountering EOF on ic.

    val string_of_file : in_channel -> string

    string_of_file ic reads the contents of file ic and copies them to a string. It stops when encountering EOF on ic.

    val output_to_file_via_temporary : ?mode:open_flag list -> string -> (string -> out_channel -> 'a) -> - 'a

    Produce output in temporary file, then rename it (as atomically as possible) to the desired output file name. output_to_file_via_temporary filename fn opens a temporary file which is passed to fn (name + output channel). When fn returns, the channel is closed and the temporary file is renamed to filename.

    val protect_writing_to_file : filename:string -> f:(out_channel -> 'a) -> 'a

    Open the given filename for writing (in binary mode), pass the out_channel to the given function, then close the channel. If the function raises an exception then filename will be removed.

    val concat_null_terminated : string list -> string

    concat_null_terminated [x1;x2; ... xn] is x1 ^ "\000" ^ x2 ^ "\000" ^ ... ^ xn ^ "\000"

    val split_null_terminated : string -> string list

    split_null_terminated s is similar String.split_on_char '\000' but ignores the trailing separator, if any

    val chop_extensions : string -> string

    Return the given file name without its extensions. The extensions is the longest suffix starting with a period and not including a directory separator, .xyz.uvw for instance.

    Return the given name if it does not contain an extension.

    Integer operations

    val log2 : int -> int

    log2 n returns s such that n = 1 lsl s if n is a power of 2

    val align : int -> int -> int

    align n a rounds n upwards to a multiple of a (a power of 2).

    val no_overflow_add : int -> int -> bool

    no_overflow_add n1 n2 returns true if the computation of n1 + n2 does not overflow.

    val no_overflow_sub : int -> int -> bool

    no_overflow_sub n1 n2 returns true if the computation of n1 - n2 does not overflow.

    val no_overflow_mul : int -> int -> bool

    no_overflow_mul n1 n2 returns true if the computation of n1 * n2 does not overflow.

    val no_overflow_lsl : int -> int -> bool

    no_overflow_lsl n k returns true if the computation of n lsl k does not overflow.

    module Int_literal_converter : sig ... end
    val find_first_mono : (int -> bool) -> int

    find_first_mono p takes an integer predicate p : int -> bool that we assume: 1. is monotonic on natural numbers: if a <= b then p a implies p b, 2. is satisfied for some natural numbers in range 0; max_int (this is equivalent to: p max_int = true).

    find_first_mono p is the smallest natural number N that satisfies p, computed in O(log(N)) calls to p.

    Our implementation supports two cases where the preconditions on p are not respected:

    • If p is always false, we silently return max_int instead of looping or crashing.
    • If p is non-monotonic but eventually true, we return some satisfying value.

    String operations

    val search_substring : string -> string -> int -> int

    search_substring pat str start returns the position of the first occurrence of string pat in string str. Search starts at offset start in str. Raise Not_found if pat does not occur.

    val replace_substring : before:string -> after:string -> string -> string

    replace_substring ~before ~after str replaces all occurrences of before with after in str and returns the resulting string.

    val rev_split_words : string -> string list

    rev_split_words s splits s in blank-separated words, and returns the list of words in reverse order.

    val cut_at : string -> char -> string * string

    String.cut_at s c returns a pair containing the sub-string before the first occurrence of c in s, and the sub-string after the first occurrence of c in s. let (before, after) = String.cut_at s c in - before ^ String.make 1 c ^ after is the identity if s contains c.

    Raise Not_found if the character does not appear in the string

    • since 4.01
    val ordinal_suffix : int -> string

    ordinal_suffix n is the appropriate suffix to append to the numeral n as an ordinal number: 1 -> "st", 2 -> "nd", 3 -> "rd", 4 -> "th", and so on. Handles larger numbers (e.g., 42 -> "nd") and the numbers 11--13 (which all get "th") correctly.

    val normalise_eol : string -> string

    normalise_eol s returns a fresh copy of s with any '\r' characters removed. Intended for pre-processing text which will subsequently be printed on a channel which performs EOL transformations (i.e. Windows)

    val delete_eol_spaces : string -> string

    delete_eol_spaces s returns a fresh copy of s with any end of line spaces removed. Intended to normalize the output of the toplevel for tests.

    Operations on references

    type ref_and_value =
    1. | R : 'a ref * 'a -> ref_and_value
    val protect_refs : ref_and_value list -> (unit -> 'a) -> 'a

    protect_refs l f temporarily sets r to v for each R (r, v) in l while executing f. The previous contents of the references is restored even if f raises an exception, without altering the exception backtrace.

    val get_ref : 'a list ref -> 'a list

    get_ref lr returns the content of the list reference lr and reset its content to the empty list.

    val set_or_ignore : ('a -> 'b option) -> 'b option ref -> 'a -> unit

    set_or_ignore f opt x sets opt to f x if it returns Some _, or leaves it unmodified if it returns None.

    Operations on triples and quadruples

    val fst3 : ('a * 'b * 'c) -> 'a
    val snd3 : ('a * 'b * 'c) -> 'b
    val thd3 : ('a * 'b * 'c) -> 'c
    val fst4 : ('a * 'b * 'c * 'd) -> 'a
    val snd4 : ('a * 'b * 'c * 'd) -> 'b
    val thd4 : ('a * 'b * 'c * 'd) -> 'c
    val for4 : ('a * 'b * 'c * 'd) -> 'd

    Long strings

    ``Long strings'' are mutable arrays of characters that are not limited in length to Sys.max_string_length.

    module LongString : sig ... end

    Spell checking and ``did you mean'' suggestions

    val edit_distance : string -> string -> int -> int option

    edit_distance a b cutoff computes the edit distance between strings a and b. To help efficiency, it uses a cutoff: if the distance d is smaller than cutoff, it returns Some d, else None.

    The distance algorithm currently used is Damerau-Levenshtein: it computes the number of insertion, deletion, substitution of letters, or swapping of adjacent letters to go from one word to the other. The particular algorithm may change in the future.

    val spellcheck : string list -> string -> string list

    spellcheck env name takes a list of names env that exist in the current environment and an erroneous name, and returns a list of suggestions taken from env, that are close enough to name that it may be a typo for one of them.

    val did_you_mean : Stdlib.Format.formatter -> (unit -> string list) -> unit

    did_you_mean ppf get_choices hints that the user may have meant one of the option returned by calling get_choices. It does nothing if the returned list is empty.

    The unit -> ... thunking is meant to delay any potentially-slow computation (typically computing edit-distance with many things from the current environment) to when the hint message is to be printed. You should print an understandable error message before calling did_you_mean, so that users get a clear notification of the failure even if producing the hint is slow.

    Colored terminal output

    module Color : sig ... end
    module Error_style : sig ... end

    Formatted output

    val print_if : + 'a

    Produce output in temporary file, then rename it (as atomically as possible) to the desired output file name. output_to_file_via_temporary filename fn opens a temporary file which is passed to fn (name + output channel). When fn returns, the channel is closed and the temporary file is renamed to filename.

    val protect_writing_to_file : filename:string -> f:(out_channel -> 'a) -> 'a

    Open the given filename for writing (in binary mode), pass the out_channel to the given function, then close the channel. If the function raises an exception then filename will be removed.

    val concat_null_terminated : string list -> string

    concat_null_terminated [x1;x2; ... xn] is x1 ^ "\000" ^ x2 ^ "\000" ^ ... ^ xn ^ "\000"

    val split_null_terminated : string -> string list

    split_null_terminated s is similar String.split_on_char '\000' but ignores the trailing separator, if any

    val chop_extensions : string -> string

    Return the given file name without its extensions. The extensions is the longest suffix starting with a period and not including a directory separator, .xyz.uvw for instance.

    Return the given name if it does not contain an extension.

    Integer operations

    val log2 : int -> int

    log2 n returns s such that n = 1 lsl s if n is a power of 2

    val align : int -> int -> int

    align n a rounds n upwards to a multiple of a (a power of 2).

    val no_overflow_add : int -> int -> bool

    no_overflow_add n1 n2 returns true if the computation of n1 + n2 does not overflow.

    val no_overflow_sub : int -> int -> bool

    no_overflow_sub n1 n2 returns true if the computation of n1 - n2 does not overflow.

    val no_overflow_mul : int -> int -> bool

    no_overflow_mul n1 n2 returns true if the computation of n1 * n2 does not overflow.

    val no_overflow_lsl : int -> int -> bool

    no_overflow_lsl n k returns true if the computation of n lsl k does not overflow.

    val letter_of_int : int -> string
    module Int_literal_converter : sig ... end
    val find_first_mono : (int -> bool) -> int

    find_first_mono p takes an integer predicate p : int -> bool that we assume: 1. is monotonic on natural numbers: if a <= b then p a implies p b, 2. is satisfied for some natural numbers in range 0; max_int (this is equivalent to: p max_int = true).

    find_first_mono p is the smallest natural number N that satisfies p, computed in O(log(N)) calls to p.

    Our implementation supports two cases where the preconditions on p are not respected:

    • If p is always false, we silently return max_int instead of looping or crashing.
    • If p is non-monotonic but eventually true, we return some satisfying value.

    String operations

    val search_substring : string -> string -> int -> int

    search_substring pat str start returns the position of the first occurrence of string pat in string str. Search starts at offset start in str. Raise Not_found if pat does not occur.

    val replace_substring : before:string -> after:string -> string -> string

    replace_substring ~before ~after str replaces all occurrences of before with after in str and returns the resulting string.

    val rev_split_words : string -> string list

    rev_split_words s splits s in blank-separated words, and returns the list of words in reverse order.

    val cut_at : string -> char -> string * string

    String.cut_at s c returns a pair containing the sub-string before the first occurrence of c in s, and the sub-string after the first occurrence of c in s. let (before, after) = String.cut_at s c in + before ^ String.make 1 c ^ after is the identity if s contains c.

    Raise Not_found if the character does not appear in the string

    • since 4.01
    val ordinal_suffix : int -> string

    ordinal_suffix n is the appropriate suffix to append to the numeral n as an ordinal number: 1 -> "st", 2 -> "nd", 3 -> "rd", 4 -> "th", and so on. Handles larger numbers (e.g., 42 -> "nd") and the numbers 11--13 (which all get "th") correctly.

    val normalise_eol : string -> string

    normalise_eol s returns a fresh copy of s with any '\r' characters removed. Intended for pre-processing text which will subsequently be printed on a channel which performs EOL transformations (i.e. Windows)

    val delete_eol_spaces : string -> string

    delete_eol_spaces s returns a fresh copy of s with any end of line spaces removed. Intended to normalize the output of the toplevel for tests.

    Operations on references

    type ref_and_value =
    1. | R : 'a ref * 'a -> ref_and_value
    val protect_refs : ref_and_value list -> (unit -> 'a) -> 'a

    protect_refs l f temporarily sets r to v for each R (r, v) in l while executing f. The previous contents of the references is restored even if f raises an exception, without altering the exception backtrace.

    val get_ref : 'a list ref -> 'a list

    get_ref lr returns the content of the list reference lr and reset its content to the empty list.

    val set_or_ignore : ('a -> 'b option) -> 'b option ref -> 'a -> unit

    set_or_ignore f opt x sets opt to f x if it returns Some _, or leaves it unmodified if it returns None.

    Operations on triples and quadruples

    val fst3 : ('a * 'b * 'c) -> 'a
    val snd3 : ('a * 'b * 'c) -> 'b
    val thd3 : ('a * 'b * 'c) -> 'c
    val fst4 : ('a * 'b * 'c * 'd) -> 'a
    val snd4 : ('a * 'b * 'c * 'd) -> 'b
    val thd4 : ('a * 'b * 'c * 'd) -> 'c
    val for4 : ('a * 'b * 'c * 'd) -> 'd

    Spell checking and ``did you mean'' suggestions

    val edit_distance : string -> string -> int -> int option

    edit_distance a b cutoff computes the edit distance between strings a and b. To help efficiency, it uses a cutoff: if the distance d is smaller than cutoff, it returns Some d, else None.

    The distance algorithm currently used is Damerau-Levenshtein: it computes the number of insertion, deletion, substitution of letters, or swapping of adjacent letters to go from one word to the other. The particular algorithm may change in the future.

    val spellcheck : string list -> string -> string list

    spellcheck env name takes a list of names env that exist in the current environment and an erroneous name, and returns a list of suggestions taken from env, that are close enough to name that it may be a typo for one of them.

    val did_you_mean : Format_doc.formatter -> (unit -> string list) -> unit

    did_you_mean ppf get_choices hints that the user may have meant one of the option returned by calling get_choices. It does nothing if the returned list is empty.

    The unit -> ... thunking is meant to delay any potentially-slow computation (typically computing edit-distance with many things from the current environment) to when the hint message is to be printed. You should print an understandable error message before calling did_you_mean, so that users get a clear notification of the failure even if producing the hint is slow.

    module Color : sig ... end

    Styling handling for terminal output

    module Style : sig ... end
    module Error_style : sig ... end

    Formatted output

    val print_if : Stdlib.Format.formatter -> bool ref -> (Stdlib.Format.formatter -> 'a -> unit) -> 'a -> - 'a

    print_if ppf flag fmt x prints x with fmt on ppf if b is true.

    val pp_two_columns : - ?sep:string -> - ?max_lines:int -> - Stdlib.Format.formatter -> - (string * string) list -> - unit

    pp_two_columns ?sep ?max_lines ppf l prints the lines in l as two columns separated by sep ("|" by default). max_lines can be used to indicate a maximum number of lines to print -- an ellipsis gets inserted at the middle if the input has too many lines.

    Example:

    pp_two_columns ~max_lines:3 Format.std_formatter [
    -      "abc", "hello";
    -      "def", "zzz";
    -      "a"  , "bllbl";
    -      "bb" , "dddddd";
    -    ]

    prints

        abc | hello
    -    ...
    -    bb  | dddddd
    val print_see_manual : Stdlib.Format.formatter -> int list -> unit

    See manual section

    Displaying configuration variables

    val show_config_and_exit : unit -> unit

    Display the values of all compiler configuration variables from module Config, then exit the program with code 0.

    val show_config_variable_and_exit : string -> unit

    Display the value of the given configuration variable, then exit the program with code 0.

    Handling of build maps

    Build maps cause the compiler to normalize file names embedded in object files, thus leading to more reproducible builds.

    val get_build_path_prefix_map : unit -> Build_path_prefix_map.map option

    Returns the map encoded in the BUILD_PATH_PREFIX_MAP environment variable.

    val debug_prefix_map_flags : unit -> string list

    Returns the list of --debug-prefix-map flags to be passed to the assembler, built from the BUILD_PATH_PREFIX_MAP environment variable.

    Handling of magic numbers

    module Magic_number : sig ... end

    a typical magic number is "Caml1999I011"; it is formed of an alphanumeric prefix, here Caml1990I, followed by a version, here 011. The prefix identifies the kind of the versioned data: here the I indicates that it is the magic number for .cmi files.

    Miscellaneous type aliases

    type filepath = string
    type modname = string
    type crcs = (modname * Stdlib.Digest.t option) list
    type alerts = string Stdlib.String.Map.t
    + 'a

    print_if ppf flag fmt x prints x with fmt on ppf if b is true.

    val print_see_manual : int list Format_doc.printer

    See manual section

    Displaying configuration variables

    val show_config_and_exit : unit -> unit

    Display the values of all compiler configuration variables from module Config, then exit the program with code 0.

    val show_config_variable_and_exit : string -> unit

    Display the value of the given configuration variable, then exit the program with code 0.

    Handling of build maps

    Build maps cause the compiler to normalize file names embedded in object files, thus leading to more reproducible builds.

    val get_build_path_prefix_map : unit -> Build_path_prefix_map.map option

    Returns the map encoded in the BUILD_PATH_PREFIX_MAP environment variable.

    val debug_prefix_map_flags : unit -> string list

    Returns the list of --debug-prefix-map flags to be passed to the assembler, built from the BUILD_PATH_PREFIX_MAP environment variable.

    Handling of magic numbers

    module Magic_number : sig ... end

    a typical magic number is "Caml1999I011"; it is formed of an alphanumeric prefix, here Caml1990I, followed by a version, here 011. The prefix identifies the kind of the versioned data: here the I indicates that it is the magic number for .cmi files.

    Minimal support for Unicode characters in identifiers

    Characters allowed in identifiers are, currently:

    • ASCII letters A-Z a-z
    • Latin-1 letters (U+00C0 - U+00FF except U+00D7 and U+00F7)
    • Character sequences which normalize to the above character under NFC
    • digits 0-9, underscore, single quote
    module Utf8_lexeme : sig ... end

    Miscellaneous type aliases

    type filepath = string
    type modname = string
    type crcs = (modname * Stdlib.Digest.t option) list
    type alerts = string Stdlib.String.Map.t
    diff --git a/ocaml/Odoc_global/index.html b/ocaml/Odoc_global/index.html index 76169510..889f2414 100644 --- a/ocaml/Odoc_global/index.html +++ b/ocaml/Odoc_global/index.html @@ -1,2 +1,2 @@ -Odoc_global (ocaml.Odoc_global)

    Module Odoc_global

    type source_file =
    1. | Impl_file of string
    2. | Intf_file of string
    3. | Text_file of string
    val include_dirs : string list ref
    val merge_options : Odoc_types.merge_option list ref
    val classic : bool ref
    val dump : string option ref
    val load : string list ref
    val sort_modules : bool ref
    val no_stop : bool ref
    val no_custom_tags : bool ref
    val remove_stars : bool ref
    val keep_code : bool ref
    val inverse_merge_ml_mli : bool ref
    val filter_with_module_constraints : bool ref
    val hidden_modules : string list ref
    val files : source_file list ref
    val errors : int ref
    val warn_error : bool ref
    val show_missed_crossref : bool ref
    val pwarning : string -> unit
    val out_file : string ref
    val verbose : bool ref
    val intro_file : string option ref
    val title : string option ref
    val target_dir : string ref
    val with_toc : bool ref
    val with_index : bool ref
    val with_header : bool ref
    val with_trailer : bool ref
    val initially_opened_module : string ref
    val library_namespace : string ref
    +Odoc_global (ocaml.Odoc_global)

    Module Odoc_global

    type source_file =
    1. | Impl_file of string
    2. | Intf_file of string
    3. | Text_file of string
    val include_dirs : string list ref
    val hidden_include_dirs : string list ref
    val merge_options : Odoc_types.merge_option list ref
    val classic : bool ref
    val dump : string option ref
    val load : string list ref
    val sort_modules : bool ref
    val no_stop : bool ref
    val no_custom_tags : bool ref
    val remove_stars : bool ref
    val keep_code : bool ref
    val inverse_merge_ml_mli : bool ref
    val filter_with_module_constraints : bool ref
    val hidden_modules : string list ref
    val files : source_file list ref
    val errors : int ref
    val warn_error : bool ref
    val show_missed_crossref : bool ref
    val pwarning : string -> unit
    val out_file : string ref
    val verbose : bool ref
    val intro_file : string option ref
    val title : string option ref
    val target_dir : string ref
    val with_toc : bool ref
    val with_index : bool ref
    val with_header : bool ref
    val with_trailer : bool ref
    val initially_opened_module : string ref
    val library_namespace : string ref
    diff --git a/ocaml/Odoc_info/index.html b/ocaml/Odoc_info/index.html index ebd6c9be..71dd3415 100644 --- a/ocaml/Odoc_info/index.html +++ b/ocaml/Odoc_info/index.html @@ -6,6 +6,7 @@ string

    This function returns a string representing a Types.module_type.

    • parameter complete

      indicates if we must print complete signatures or just sig end. Default is false.

    • parameter code

      if complete = false and the type contains something else than identificators and functors, then the given code is used.

    val string_of_class_type : ?complete:bool -> Types.class_type -> string

    This function returns a string representing a Types.class_type.

    • parameter complete

      indicates if we must print complete signatures or just object end. Default is false.

    val string_of_text : text -> string

    Get a string from a text.

    val string_of_info : info -> string

    Get a string from an info structure.

    val string_of_type : Type.t_type -> string
    • returns

      a string to describe the given type.

    val string_of_record : Type.record_field list -> string
    val string_of_type_extension : Extension.t_type_extension -> string
    • returns

      a string to describe the given type extension.

    val string_of_exception : Exception.t_exception -> string
    • returns

      a string to describe the given exception.

    val string_of_value : Value.t_value -> string
    • returns

      a string to describe the given value.

    val string_of_attribute : Value.t_attribute -> string
    • returns

      a string to describe the given attribute.

    val string_of_method : Value.t_method -> string
    • returns

      a string to describe the given method.

    Miscellaneous functions

    val first_sentence_of_text : text -> text

    Return the first sentence (until the first dot followed by a blank or the first blank line) of a text. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

    val first_sentence_and_rest_of_text : text -> text * text

    Return the first sentence (until the first dot followed by a blank or the first blank line) of a text, and the remaining text after. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

    val text_no_title_no_list : text -> text

    Return the given text without any title or list.

    val text_concat : Odoc_types.text -> Odoc_types.text list -> Odoc_types.text

    concat sep l concats the given list of text l, each separated with the text sep.

    val get_titles_in_text : text -> (int * string option * text) list

    Return the list of titles in a text. A title is a title level, an optional label and a text.

    val create_index_lists : 'a list -> ('a -> string) -> 'a list list

    Take a sorted list of elements, a function to get the name of an element and return the list of list of elements, where each list group elements beginning by the same letter. Since the original list is sorted, elements whose name does not begin with a letter should be in the first returned list.

    val remove_option : Types.type_expr -> Types.type_expr

    Take a type and remove the option top constructor. This is useful when printing labels, we then remove the top option constructor for optional labels.

    val is_optional : Asttypes.arg_label -> bool

    Return true if the given label is optional.

    val label_name : Asttypes.arg_label -> string

    Return the label name for the given label, i.e. removes the beginning '?' if present.

    val use_hidden_modules : Name.t -> Name.t

    Return the given name where the module name or part of it was removed, according to the list of modules which must be hidden (cf Odoc_args.hidden_modules)

    val verbose : string -> unit

    Print the given string if the verbose mode is activated.

    val warning : string -> unit

    Print a warning message to stderr. If warnings must be treated as errors, then the error counter is incremented.

    val print_warnings : bool ref

    A flag to indicate whether ocamldoc warnings must be printed or not.

    val errors : int ref

    Increment this counter when an error is encountered. The ocamldoc tool will print the number of errors encountered exit with code 1 if this number is greater than 0.

    val apply_opt : ('a -> 'b) -> 'a option -> 'b option

    Apply a function to an optional value.

    val apply_if_equal : ('a -> 'a) -> 'a -> 'a -> 'a

    Apply a function to a first value if it is not different from a second value. If the two values are different, return the second one.

    val text_of_string : string -> text

    text_of_string s returns the text structure from the given string.

    val text_string_of_text : text -> string

    text_string_of_text text returns the string representing the given text. This string can then be parsed again by Odoc_info.text_of_string.

    val info_of_string : string -> info

    info_of_string s parses the given string like a regular ocamldoc comment and return an Odoc_info.info structure.

    • returns

      an empty structure if there was a syntax error. TODO: change this

    val info_of_comment_file : Module.t_module list -> string -> info

    info_of_comment_file file parses the given file and return an Odoc_info.info structure. The content of the file must have the same syntax as the content of a special comment. The given module list is used for cross reference.

    • raises Failure

      if the file could not be opened or there is a syntax error.

    val remove_ending_newline : string -> string

    remove_ending_newline s returns s without the optional ending newline.

    Research in elements

    module Scan : sig ... end

    Scanning of collected information

    module Dep : sig ... end

    Computation of dependencies.

    Some global variables

    module Global : sig ... end
    val analyse_files : ?merge_options:Odoc_types.merge_option list -> ?include_dirs:string list -> + ?hidden_include_dirs:string list -> ?labels:bool -> ?sort_modules:bool -> ?no_stop:bool -> diff --git a/ocaml/Odoc_parser/index.html b/ocaml/Odoc_parser/index.html index cd60c0d8..1a5257a5 100644 --- a/ocaml/Odoc_parser/index.html +++ b/ocaml/Odoc_parser/index.html @@ -1,5 +1,5 @@ -Odoc_parser (ocaml.Odoc_parser)

    Module Odoc_parser

    type token =
    1. | Description of string * string option
    2. | See_url of string
    3. | See_file of string
    4. | See_doc of string
    5. | T_PARAM
    6. | T_AUTHOR
    7. | T_VERSION
    8. | T_SEE
    9. | T_SINCE
    10. | T_BEFORE
    11. | T_DEPRECATED
    12. | T_RAISES
    13. | T_RETURN
    14. | T_CUSTOM of string
    15. | EOF
    16. | Desc of string
    val main : +Odoc_parser (ocaml.Odoc_parser)

    Module Odoc_parser

    type token =
    1. | Description of string * string option
    2. | See_url of string
    3. | See_file of string
    4. | See_doc of string
    5. | T_PARAM of string
    6. | T_AUTHOR
    7. | T_VERSION
    8. | T_SEE
    9. | T_SINCE
    10. | T_BEFORE of string
    11. | T_DEPRECATED
    12. | T_RAISES of string
    13. | T_RETURN
    14. | T_CUSTOM of string
    15. | EOF
    16. | Desc of string
    val main : (Stdlib.Lexing.lexbuf -> token) -> Stdlib.Lexing.lexbuf -> (string * string option) option
    val info_part2 : diff --git a/ocaml/Oprint/index.html b/ocaml/Oprint/index.html index be0597e7..65d59c97 100644 --- a/ocaml/Oprint/index.html +++ b/ocaml/Oprint/index.html @@ -1,18 +1,3 @@ -Oprint (ocaml.Oprint)

    Module Oprint

    val out_label : - (Stdlib.Format.formatter -> - (string * bool * Outcometree.out_type) -> - unit) - ref
    val out_type_args : - (Stdlib.Format.formatter -> Outcometree.out_type list -> unit) ref
    val out_class_type : - (Stdlib.Format.formatter -> Outcometree.out_class_type -> unit) ref
    val out_module_type : - (Stdlib.Format.formatter -> Outcometree.out_module_type -> unit) ref
    val out_sig_item : - (Stdlib.Format.formatter -> Outcometree.out_sig_item -> unit) ref
    val out_signature : - (Stdlib.Format.formatter -> Outcometree.out_sig_item list -> unit) ref
    val out_functor_parameters : - (Stdlib.Format.formatter -> - (string option * Outcometree.out_module_type) option list -> - unit) - ref
    val out_type_extension : - (Stdlib.Format.formatter -> Outcometree.out_type_extension -> unit) ref
    val out_phrase : - (Stdlib.Format.formatter -> Outcometree.out_phrase -> unit) ref
    val parenthesized_ident : string -> bool
    +Oprint (ocaml.Oprint)

    Module Oprint

    type 'a printer = 'a Format_doc.printer ref
    type 'a toplevel_printer = (Stdlib.Format.formatter -> 'a -> unit) ref
    val out_type_args : Outcometree.out_type list printer
    val out_class_type : Outcometree.out_class_type printer
    val out_module_type : Outcometree.out_module_type printer
    val out_signature : Outcometree.out_sig_item list printer
    val out_functor_parameters : + (string option * Outcometree.out_module_type) option list printer
    val out_type_extension : Outcometree.out_type_extension printer
    val parenthesized_ident : string -> bool
    diff --git a/ocaml/Out_type/Ident_conflicts/index.html b/ocaml/Out_type/Ident_conflicts/index.html new file mode 100644 index 00000000..4d891e76 --- /dev/null +++ b/ocaml/Out_type/Ident_conflicts/index.html @@ -0,0 +1,2 @@ + +Ident_conflicts (ocaml.Out_type.Ident_conflicts)

    Module Out_type.Ident_conflicts

    The Ident_conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

    val exists : unit -> bool

    exists() returns true if the current naming context renamed an identifier to avoid a name collision

    type explanation = {
    1. kind : Shape.Sig_component_kind.t;
    2. name : string;
    3. root_name : string;
    4. location : Location.t;
    }
    val list_explanations : unit -> explanation list

    list_explanations() return the list of conflict explanations collected up to this point, and reset the list of collected explanations

    val print_located_explanations : explanation list Format_doc.printer
    val err_print : Format_doc.formatter -> unit
    val err_msg : unit -> Format_doc.doc option

    err_msg () return an error message if there are pending conflict explanations at this point. It is often important to check for conflicts after all printing is done, thus the delayed nature of err_msg

    val reset : unit -> unit
    diff --git a/ocaml/Out_type/Ident_names/index.html b/ocaml/Out_type/Ident_names/index.html new file mode 100644 index 00000000..5458af1c --- /dev/null +++ b/ocaml/Out_type/Ident_names/index.html @@ -0,0 +1,6 @@ + +Ident_names (ocaml.Out_type.Ident_names)

    Module Out_type.Ident_names

    Disambiguation for identifiers, e.g. the two type constructors named t in the type of f in

    type t = A
    +module M = struct
    +  type t = B
    + let f A = B
    +end

    should be disambiguated to t/2->t

    val enable : bool -> unit

    When contextual names are enabled, the mapping between identifiers and names is ensured to be one-to-one.

    val with_fuzzy : Ident.t -> (unit -> 'a) -> 'a

    with_fuzzy id f locally disable ident disambiguation for id within f

    diff --git a/ocaml/Out_type/Internal_names/index.html b/ocaml/Out_type/Internal_names/index.html new file mode 100644 index 00000000..e433e88b --- /dev/null +++ b/ocaml/Out_type/Internal_names/index.html @@ -0,0 +1,2 @@ + +Internal_names (ocaml.Out_type.Internal_names)

    Module Out_type.Internal_names

    Register internal typechecker names ($0,$a) appearing in the outcometree

    val add : Path.t -> unit
    val reset : unit -> unit
    val print_explanations : Env.t -> Format_doc.formatter -> unit
    diff --git a/ocaml/Out_type/Out_name/index.html b/ocaml/Out_type/Out_name/index.html new file mode 100644 index 00000000..a801cae3 --- /dev/null +++ b/ocaml/Out_type/Out_name/index.html @@ -0,0 +1,2 @@ + +Out_name (ocaml.Out_type.Out_name)

    Module Out_type.Out_name

    Path name, which were mutable at some point

    val create : string -> Outcometree.out_name
    val print : Outcometree.out_name -> string
    diff --git a/ocaml/Out_type/Variable_names/index.html b/ocaml/Out_type/Variable_names/index.html new file mode 100644 index 00000000..796f95fe --- /dev/null +++ b/ocaml/Out_type/Variable_names/index.html @@ -0,0 +1,2 @@ + +Variable_names (ocaml.Out_type.Variable_names)

    Module Out_type.Variable_names

    Naming choice for type variable names ('a, 'b, ...), for instance the two classes of distinct type variables in

    let repeat x y = x, y, y, x

    should be printed printed as 'a -> 'b -> 'a * 'b * 'b * 'a.

    val add_subst : (Types.type_expr * Types.type_expr) list -> unit

    Add external type equalities

    val reserve : Types.type_expr -> unit

    reserve ty registers the variable names appearing in ty

    diff --git a/ocaml/Out_type/index.html b/ocaml/Out_type/index.html new file mode 100644 index 00000000..9937fc06 --- /dev/null +++ b/ocaml/Out_type/index.html @@ -0,0 +1,59 @@ + +Out_type (ocaml.Out_type)

    Module Out_type

    Functions for representing type expressions and module types as outcometree (with as 'a aliases for cycles) and printing them. All functions below depends on global contexts that keep track of

    • If labels are disabled
    • Current printing environment
    • Shortest equivalent paths
    • Conflicts for identifier names
    • Names chosen for type variables
    • Aliases used for representing cycles or row variables
    • Uses of internal names

    Whenever possible, it is advised to use the simpler functions available in Printtyp which take care of setting up this naming context. The functions below are needed when one needs to share a common naming context (or part of it) between different calls to printing functions (or in order to implement Printtyp).

    Wrapping functions

    val wrap_printing_env : error:bool -> Env.t -> (unit -> 'a) -> 'a

    Call the function using the environment for type path shortening This affects all the printing and tree cration functions functions below Also, if ~error:true, then disable the loading of cmis

    val with_labels : bool -> (unit -> 'a) -> 'a

    with_labels false disable labels in function types

    Printing idents and paths

    val ident_name : + Shape.Sig_component_kind.t option -> + Ident.t -> + Outcometree.out_name
    val tree_of_path : ?disambiguation:bool -> Path.t -> Outcometree.out_ident
    val namespaced_tree_of_path : + Shape.Sig_component_kind.t -> + Path.t -> + Outcometree.out_ident
    val tree_of_type_path : Path.t -> Outcometree.out_ident

    Specialized functions for printing types with short-paths

    val same_path : Types.type_expr -> Types.type_expr -> bool

    same_path ty ty2 is true when there is an equation ty=ty2 in the short-path scope

    val rewrite_double_underscore_paths : Env.t -> Path.t -> Path.t

    Simple heuristic to rewrite Foo__bar.* as Foo.Bar.* when Foo.Bar is an alias for Foo__bar. This pattern is used by the stdlib.

    Printing type expressions

    Printing type expressions requires to translate the internal graph based representation into to an Outcometree closer to the source syntax. In order to do so, the printing is generally split in three phase:

    • A preparation phase which in particular
    • marks cycles
    • chooses user-facing names for type variables
    • An outcometree generation phase, where we emit an outcometree as a ready-for-printing representation of trees (represented by the various tree_of_* functions)
    • Printing proper
    val prepare_for_printing : Types.type_expr list -> unit

    prepare_for_printing resets the global naming environment, a la reset_except_conflicts, and prepares the types for printing by reserving variable names and marking cycles. Any type variables that are shared between multiple types in the input list will be given the same name when printed with prepared_type_expr.

    val add_type_to_preparation : Types.type_expr -> unit

    add_type_to_preparation ty extend a previous type expression preparation to the type expression ty

    type type_or_scheme =
    1. | Type
    2. | Type_scheme

    In Type_scheme mode, non-generic types variables are printed as weakly polymorphic type variables.

    tree_of_typexp generate the outcometree for a prepared type expression.

    val prepared_type_scheme : Types.type_expr Format_doc.printer
    val prepared_type_expr : Types.type_expr Format_doc.printer

    The printers prepared_type_expr and prepared_type_scheme should only be used on prepared types. Types can be prepared by initially calling prepare_for_printing or adding them later to the preparation with add_type_to_preparation.

    Calling this function on non-prepared types may cause a stack overflow (see #8860) due to cycles in the printed types.

    See Printtyp.type_expr for a safer but less flexible printer.

    val type_expr_with_reserved_names : Types.type_expr Format_doc.printer

    type_expr_with_reserved_names can print "half-prepared" type expression. A "half-prepared" type expression should have had its names reserved (with Variable_names.reserve), but should not have had its cycles marked.

    type 'a diff =
    1. | Same of 'a
    2. | Diff of 'a * 'a
    val trees_of_type_expansion : + type_or_scheme -> + Errortrace.expanded_type -> + Outcometree.out_type diff
    val hide_variant_name : Types.type_expr -> Types.type_expr
    val prepare_type_constructor_arguments : Types.constructor_arguments -> unit

    Label and constructors

    val tree_of_constructor_arguments : + Types.constructor_arguments -> + Outcometree.out_type list
    val add_constructor_to_preparation : Types.constructor_declaration -> unit
    val tree_of_extension_constructor : + Ident.t -> + Types.extension_constructor -> + Types.ext_status -> + Outcometree.out_sig_item
    val extension_constructor_args_and_ret_type_subtree : + Types.constructor_arguments -> + Types.type_expr option -> + Outcometree.out_type list * Outcometree.out_type option
    val add_extension_constructor_to_preparation : + Types.extension_constructor -> + unit
    val prepared_extension_constructor : + Ident.t -> + Types.extension_constructor Format_doc.printer

    Declarations

    val tree_of_type_declaration : + Ident.t -> + Types.type_declaration -> + Types.rec_status -> + Outcometree.out_sig_item
    val add_type_declaration_to_preparation : + Ident.t -> + Types.type_declaration -> + unit
    val prepared_type_declaration : + Ident.t -> + Types.type_declaration Format_doc.printer
    val tree_of_value_description : + Ident.t -> + Types.value_description -> + Outcometree.out_sig_item
    val tree_of_modtype_declaration : + Ident.t -> + Types.modtype_declaration -> + Outcometree.out_sig_item
    val tree_of_class_declaration : + Ident.t -> + Types.class_declaration -> + Types.rec_status -> + Outcometree.out_sig_item
    val tree_of_cltype_declaration : + Ident.t -> + Types.class_type_declaration -> + Types.rec_status -> + Outcometree.out_sig_item

    Module types

    val tree_of_module : + Ident.t -> + ?ellipsis:bool -> + Types.module_type -> + Types.rec_status -> + Outcometree.out_sig_item
    val tree_of_signature : Types.signature -> Outcometree.out_sig_item list
    val tree_of_class_type : + type_or_scheme -> + Types.class_type -> + Outcometree.out_class_type
    val prepare_class_type : Types.class_type -> unit
    val print_items : + (Env.t -> Types.signature_item -> 'a option) -> + Env.t -> + Types.signature_item list -> + (Outcometree.out_sig_item * 'a option) list

    Toplevel printing

    Naming contexts

    module Out_name : sig ... end

    Path name, which were mutable at some point

    module Ident_names : sig ... end

    Disambiguation for identifiers, e.g. the two type constructors named t in the type of f in

    module Ident_conflicts : sig ... end

    The Ident_conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

    module Variable_names : sig ... end

    Naming choice for type variable names ('a, 'b, ...), for instance the two classes of distinct type variables in

    module Internal_names : sig ... end

    Register internal typechecker names ($0,$a) appearing in the outcometree

    val reset : unit -> unit

    Reset all contexts

    val reset_except_conflicts : unit -> unit

    Reset all contexts except for conflicts

    diff --git a/ocaml/Outcometree/index.html b/ocaml/Outcometree/index.html index 34c1e438..f37096a0 100644 --- a/ocaml/Outcometree/index.html +++ b/ocaml/Outcometree/index.html @@ -1,5 +1,5 @@ -Outcometree (ocaml.Outcometree)

    Module Outcometree

    type out_name = {
    1. mutable printed_name : string;
    }

    An out_name is a string representation of an identifier which can be rewritten on the fly to avoid name collisions

    type out_ident =
    1. | Oide_apply of out_ident * out_ident
    2. | Oide_dot of out_ident * string
    3. | Oide_ident of out_name
    type out_string =
    1. | Ostr_string
    2. | Ostr_bytes
    type out_attribute = {
    1. oattr_name : string;
    }
    type out_value =
    1. | Oval_array of out_value list
    2. | Oval_char of char
    3. | Oval_constr of out_ident * out_value list
    4. | Oval_ellipsis
    5. | Oval_float of float
    6. | Oval_int of int
    7. | Oval_int32 of int32
    8. | Oval_int64 of int64
    9. | Oval_nativeint of nativeint
    10. | Oval_list of out_value list
    11. | Oval_printer of Stdlib.Format.formatter -> unit
    12. | Oval_record of (out_ident * out_value) list
    13. | Oval_string of string * int * out_string
    14. | Oval_stuff of string
    15. | Oval_tuple of out_value list
    16. | Oval_variant of string * out_value option
    type out_type_param = string * (Asttypes.variance * Asttypes.injectivity)
    type out_type =
    1. | Otyp_abstract
    2. | Otyp_open
    3. | Otyp_alias of {
      1. non_gen : bool;
      2. aliased : out_type;
      3. alias : string;
      }
    4. | Otyp_arrow of string * out_type * out_type
    5. | Otyp_class of out_ident * out_type list
    6. | Otyp_constr of out_ident * out_type list
    7. | Otyp_manifest of out_type * out_type
    8. | Otyp_object of {
      1. fields : (string * out_type) list;
      2. open_row : bool;
      }
    9. | Otyp_record of (string * bool * out_type) list
    10. | Otyp_stuff of string
    11. | Otyp_sum of out_constructor list
    12. | Otyp_tuple of out_type list
    13. | Otyp_var of bool * string
    14. | Otyp_variant of out_variant * bool * string list option
    15. | Otyp_poly of string list * out_type
    16. | Otyp_module of out_ident * (string * out_type) list
    17. | Otyp_attribute of out_type * out_attribute
    and out_constructor = {
    1. ocstr_name : string;
    2. ocstr_args : out_type list;
    3. ocstr_return_type : out_type option;
    }
    and out_variant =
    1. | Ovar_fields of (string * bool * out_type list) list
    2. | Ovar_typ of out_type
    type out_class_type =
    1. | Octy_constr of out_ident * out_type list
    2. | Octy_arrow of string * out_type * out_class_type
    3. | Octy_signature of out_type option * out_class_sig_item list
    and out_class_sig_item =
    1. | Ocsg_constraint of out_type * out_type
    2. | Ocsg_method of string * bool * bool * out_type
    3. | Ocsg_value of string * bool * bool * out_type
    type out_module_type =
    1. | Omty_abstract
    2. | Omty_functor of (string option * out_module_type) option * out_module_type
    3. | Omty_ident of out_ident
    4. | Omty_signature of out_sig_item list
    5. | Omty_alias of out_ident
    and out_sig_item =
    1. | Osig_class of bool +Outcometree (ocaml.Outcometree)

      Module Outcometree

      type out_name = {
      1. mutable printed_name : string;
      }

      An out_name is a string representation of an identifier which can be rewritten on the fly to avoid name collisions

      type out_ident =
      1. | Oide_apply of out_ident * out_ident
      2. | Oide_dot of out_ident * string
      3. | Oide_ident of out_name
      type out_string =
      1. | Ostr_string
      2. | Ostr_bytes
      type out_attribute = {
      1. oattr_name : string;
      }
      type out_value =
      1. | Oval_array of out_value list
      2. | Oval_char of char
      3. | Oval_constr of out_ident * out_value list
      4. | Oval_ellipsis
      5. | Oval_float of float
      6. | Oval_int of int
      7. | Oval_int32 of int32
      8. | Oval_int64 of int64
      9. | Oval_nativeint of nativeint
      10. | Oval_list of out_value list
      11. | Oval_printer of Format_doc.formatter -> unit
      12. | Oval_record of (out_ident * out_value) list
      13. | Oval_string of string * int * out_string
      14. | Oval_stuff of string
      15. | Oval_tuple of out_value list
      16. | Oval_variant of string * out_value option
      17. | Oval_lazy of out_value
      type out_type_param = {
      1. ot_non_gen : bool;
      2. ot_name : string;
      3. ot_variance : Asttypes.variance * Asttypes.injectivity;
      }
      type out_type =
      1. | Otyp_abstract
      2. | Otyp_open
      3. | Otyp_alias of {
        1. non_gen : bool;
        2. aliased : out_type;
        3. alias : string;
        }
      4. | Otyp_arrow of Asttypes.arg_label * out_type * out_type
      5. | Otyp_class of out_ident * out_type list
      6. | Otyp_constr of out_ident * out_type list
      7. | Otyp_manifest of out_type * out_type
      8. | Otyp_object of {
        1. fields : (string * out_type) list;
        2. open_row : bool;
        }
      9. | Otyp_record of out_label list
      10. | Otyp_stuff of string
      11. | Otyp_sum of out_constructor list
      12. | Otyp_tuple of out_type list
      13. | Otyp_var of bool * string
      14. | Otyp_variant of out_variant * bool * string list option
      15. | Otyp_poly of string list * out_type
      16. | Otyp_module of out_ident * (string * out_type) list
      17. | Otyp_attribute of out_type * out_attribute
      and out_label = {
      1. olab_name : string;
      2. olab_mut : Asttypes.mutable_flag;
      3. olab_type : out_type;
      }
      and out_constructor = {
      1. ocstr_name : string;
      2. ocstr_args : out_type list;
      3. ocstr_return_type : out_type option;
      }
      and out_variant =
      1. | Ovar_fields of (string * bool * out_type list) list
      2. | Ovar_typ of out_type
      type out_class_type =
      1. | Octy_constr of out_ident * out_type list
      2. | Octy_arrow of Asttypes.arg_label * out_type * out_class_type
      3. | Octy_signature of out_type option * out_class_sig_item list
      and out_class_sig_item =
      1. | Ocsg_constraint of out_type * out_type
      2. | Ocsg_method of string * bool * bool * out_type
      3. | Ocsg_value of string * bool * bool * out_type
      type out_module_type =
      1. | Omty_abstract
      2. | Omty_functor of (string option * out_module_type) option * out_module_type
      3. | Omty_ident of out_ident
      4. | Omty_signature of out_sig_item list
      5. | Omty_alias of out_ident
      and out_sig_item =
      1. | Osig_class of bool * string * out_type_param list * out_class_type diff --git a/ocaml/Parmatch/index.html b/ocaml/Parmatch/index.html index 94cf65e9..a6fa0076 100644 --- a/ocaml/Parmatch/index.html +++ b/ocaml/Parmatch/index.html @@ -1,14 +1,11 @@ -Parmatch (ocaml.Parmatch)

        Module Parmatch

        Detection of partial matches and unused match cases.

        val const_compare : Asttypes.constant -> Asttypes.constant -> int

        const_compare c1 c2 compares the actual values represented by c1 and c2, while simply using Stdlib.compare would compare the representations.

        cf. MPR#5758

        val le_pat : Typedtree.pattern -> Typedtree.pattern -> bool

        le_pat p q means: forall V, V matches q implies V matches p

        val le_pats : Typedtree.pattern list -> Typedtree.pattern list -> bool

        le_pats (p1 .. pm) (q1 .. qn) means: forall i <= m, le_pat pi qi

        module Compat (_ : sig ... end) : sig ... end

        Exported compatibility functor, abstracted over constructor equality

        exception Empty

        lub p q is a pattern that matches all values matched by p and q. May raise Empty, when p and q are not compatible.

        val lubs : +Parmatch (ocaml.Parmatch)

        Module Parmatch

        Detection of partial matches and unused match cases.

        type 'pattern parmatch_case = {
        1. pattern : 'pattern;
        2. has_guard : bool;
        3. needs_refute : bool;
          (*

          true if the program text claims the case is unreachable, a la function _ -> .

          *)
        }

        Most checks in this file need not access all information about a case, and just need a few pieces of information. parmatch_case is those few pieces of information.

        type 'category typed_case := 'category Typedtree.general_pattern parmatch_case
        val typed_case : 'category Typedtree.case -> 'category typed_case
        val const_compare : Asttypes.constant -> Asttypes.constant -> int

        const_compare c1 c2 compares the actual values represented by c1 and c2, while simply using Stdlib.compare would compare the representations.

        cf. MPR#5758

        val le_pat : Typedtree.pattern -> Typedtree.pattern -> bool

        le_pat p q means: forall V, V matches q implies V matches p

        val le_pats : Typedtree.pattern list -> Typedtree.pattern list -> bool

        le_pats (p1 .. pm) (q1 .. qn) means: forall i <= m, le_pat pi qi

        module Compat (_ : sig ... end) : sig ... end

        Exported compatibility functor, abstracted over constructor equality

        exception Empty

        lub p q is a pattern that matches all values matched by p and q. May raise Empty, when p and q are not compatible.

        val lubs : Typedtree.pattern list -> Typedtree.pattern list -> Typedtree.pattern list

        lubs [p1; ...; pn] [q1; ...; qk], where n < k, is [lub p1 q1; ...; lub pk qk].

        val get_mins : ('a -> 'a -> bool) -> 'a list -> 'a list
        val set_args : Typedtree.pattern -> Typedtree.pattern list -> - Typedtree.pattern list

        Those two functions recombine one pattern and its arguments: For instance: (_,_)::p1::p2::rem -> (p1, p2)::rem The second one will replace mutable arguments by '_'

        val set_args_erase_mutable : - Typedtree.pattern -> - Typedtree.pattern list -> - Typedtree.pattern list
        val pat_of_constr : + Typedtree.pattern list

        This function recombines one pattern and its arguments: For instance: (_,_)::p1::p2::rem -> (p1, p2)::rem

        val complete_constrs : @@ -20,8 +17,8 @@ unit

        check_partial pred loc caselist and check_unused refute pred caselist are called with a function pred which will be given counter-example candidates: they may be partially ill-typed, and have to be type-checked to extract a valid counter-example. pred returns a valid counter-example or None. refute indicates that check_unused was called on a refutation clause.

        val check_unused : (bool -> Typedtree.pattern -> Typedtree.pattern option) -> - Typedtree.value Typedtree.case list -> + Typedtree.value typed_case list -> unit
        val irrefutable : Typedtree.pattern -> bool
        val inactive : partial:Typedtree.partial -> Typedtree.pattern -> bool

        An inactive pattern is a pattern, matching against which can be duplicated, erased or delayed without change in observable behavior of the program. Patterns containing (lazy _) subpatterns or reads of mutable fields are active.

        val check_ambiguous_bindings : Typedtree.value Typedtree.case list -> unit
        val some_private_tag : Asttypes.label
        diff --git a/ocaml/Parser/index.html b/ocaml/Parser/index.html index 324f623c..ee73c532 100644 --- a/ocaml/Parser/index.html +++ b/ocaml/Parser/index.html @@ -1,5 +1,5 @@ -Parser (ocaml.Parser)

        Module Parser

        type token =
        1. | WITH
        2. | WHILE
        3. | WHEN
        4. | VIRTUAL
        5. | VAL
        6. | UNDERSCORE
        7. | UIDENT of string
        8. | TYPE
        9. | TRY
        10. | TRUE
        11. | TO
        12. | TILDE
        13. | THEN
        14. | STRUCT
        15. | STRING of string * Location.t * string option
        16. | STAR
        17. | SIG
        18. | SEMISEMI
        19. | SEMI
        20. | RPAREN
        21. | REC
        22. | RBRACKET
        23. | RBRACE
        24. | QUOTED_STRING_ITEM of string * Location.t * string * Location.t * string option
        25. | QUOTED_STRING_EXPR of string * Location.t * string * Location.t * string option
        26. | QUOTE
        27. | QUESTION
        28. | PRIVATE
        29. | PREFIXOP of string
        30. | PLUSEQ
        31. | PLUSDOT
        32. | PLUS
        33. | PERCENT
        34. | OR
        35. | OPTLABEL of string
        36. | OPEN
        37. | OF
        38. | OBJECT
        39. | NONREC
        40. | NEW
        41. | MUTABLE
        42. | MODULE
        43. | MINUSGREATER
        44. | MINUSDOT
        45. | MINUS
        46. | METHOD
        47. | MATCH
        48. | LPAREN
        49. | LIDENT of string
        50. | LETOP of string
        51. | LET
        52. | LESSMINUS
        53. | LESS
        54. | LBRACKETPERCENTPERCENT
        55. | LBRACKETPERCENT
        56. | LBRACKETLESS
        57. | LBRACKETGREATER
        58. | LBRACKETBAR
        59. | LBRACKETATATAT
        60. | LBRACKETATAT
        61. | LBRACKETAT
        62. | LBRACKET
        63. | LBRACELESS
        64. | LBRACE
        65. | LAZY
        66. | LABEL of string
        67. | INT of string * char option
        68. | INITIALIZER
        69. | INHERIT
        70. | INFIXOP4 of string
        71. | INFIXOP3 of string
        72. | INFIXOP2 of string
        73. | INFIXOP1 of string
        74. | INFIXOP0 of string
        75. | INCLUDE
        76. | IN
        77. | IF
        78. | HASHOP of string
        79. | HASH
        80. | GREATERRBRACKET
        81. | GREATERRBRACE
        82. | GREATER
        83. | FUNCTOR
        84. | FUNCTION
        85. | FUN
        86. | FOR
        87. | FLOAT of string * char option
        88. | FALSE
        89. | EXTERNAL
        90. | EXCEPTION
        91. | EQUAL
        92. | EOL
        93. | EOF
        94. | END
        95. | ELSE
        96. | DOWNTO
        97. | DOTOP of string
        98. | DOTDOT
        99. | DOT
        100. | DONE
        101. | DOCSTRING of Docstrings.docstring
        102. | DO
        103. | CONSTRAINT
        104. | COMMENT of string * Location.t
        105. | COMMA
        106. | COLONGREATER
        107. | COLONEQUAL
        108. | COLONCOLON
        109. | COLON
        110. | CLASS
        111. | CHAR of char
        112. | BEGIN
        113. | BARRBRACKET
        114. | BARBAR
        115. | BAR
        116. | BANG
        117. | BACKQUOTE
        118. | ASSERT
        119. | AS
        120. | ANDOP of string
        121. | AND
        122. | AMPERSAND
        123. | AMPERAMPER
        exception Error
        val use_file : +Parser (ocaml.Parser)

        Module Parser

        type token =
        1. | WITH
        2. | WHILE
        3. | WHEN
        4. | VIRTUAL
        5. | VAL
        6. | UNDERSCORE
        7. | UIDENT of string
        8. | TYPE
        9. | TRY
        10. | TRUE
        11. | TO
        12. | TILDE
        13. | THEN
        14. | STRUCT
        15. | STRING of string * Location.t * string option
        16. | STAR
        17. | SIG
        18. | SEMISEMI
        19. | SEMI
        20. | RPAREN
        21. | REC
        22. | RBRACKET
        23. | RBRACE
        24. | QUOTED_STRING_ITEM of string * Location.t * string * Location.t * string option
        25. | QUOTED_STRING_EXPR of string * Location.t * string * Location.t * string option
        26. | QUOTE
        27. | QUESTION
        28. | PRIVATE
        29. | PREFIXOP of string
        30. | PLUSEQ
        31. | PLUSDOT
        32. | PLUS
        33. | PERCENT
        34. | OR
        35. | OPTLABEL of string
        36. | OPEN
        37. | OF
        38. | OBJECT
        39. | NONREC
        40. | NEW
        41. | MUTABLE
        42. | MODULE
        43. | MINUSGREATER
        44. | MINUSDOT
        45. | MINUS
        46. | METHOD
        47. | METAOCAML_ESCAPE
        48. | METAOCAML_BRACKET_OPEN
        49. | METAOCAML_BRACKET_CLOSE
        50. | MATCH
        51. | LPAREN
        52. | LIDENT of string
        53. | LETOP of string
        54. | LET
        55. | LESSMINUS
        56. | LESS
        57. | LBRACKETPERCENTPERCENT
        58. | LBRACKETPERCENT
        59. | LBRACKETLESS
        60. | LBRACKETGREATER
        61. | LBRACKETBAR
        62. | LBRACKETATATAT
        63. | LBRACKETATAT
        64. | LBRACKETAT
        65. | LBRACKET
        66. | LBRACELESS
        67. | LBRACE
        68. | LAZY
        69. | LABEL of string
        70. | INT of string * char option
        71. | INITIALIZER
        72. | INHERIT
        73. | INFIXOP4 of string
        74. | INFIXOP3 of string
        75. | INFIXOP2 of string
        76. | INFIXOP1 of string
        77. | INFIXOP0 of string
        78. | INCLUDE
        79. | IN
        80. | IF
        81. | HASHOP of string
        82. | HASH
        83. | GREATERRBRACKET
        84. | GREATERRBRACE
        85. | GREATER
        86. | FUNCTOR
        87. | FUNCTION
        88. | FUN
        89. | FOR
        90. | FLOAT of string * char option
        91. | FALSE
        92. | EXTERNAL
        93. | EXCEPTION
        94. | EQUAL
        95. | EOL
        96. | EOF
        97. | END
        98. | ELSE
        99. | EFFECT
        100. | DOWNTO
        101. | DOTOP of string
        102. | DOTDOT
        103. | DOT
        104. | DONE
        105. | DOCSTRING of Docstrings.docstring
        106. | DO
        107. | CONSTRAINT
        108. | COMMENT of string * Location.t
        109. | COMMA
        110. | COLONGREATER
        111. | COLONEQUAL
        112. | COLONCOLON
        113. | COLON
        114. | CLASS
        115. | CHAR of char
        116. | BEGIN
        117. | BARRBRACKET
        118. | BARBAR
        119. | BAR
        120. | BANG
        121. | BACKQUOTE
        122. | ASSERT
        123. | AS
        124. | ANDOP of string
        125. | AND
        126. | AMPERSAND
        127. | AMPERAMPER
        exception Error
        val toplevel_phrase : diff --git a/ocaml/Parsetree/index.html b/ocaml/Parsetree/index.html index 016516eb..629aa84f 100644 --- a/ocaml/Parsetree/index.html +++ b/ocaml/Parsetree/index.html @@ -1,13 +1,16 @@ -Parsetree (ocaml.Parsetree)

        Module Parsetree

        Abstract syntax tree produced by parsing

        Warning: this module is unstable and part of compiler-libs.

        type constant =
        1. | Pconst_integer of string * char option
          (*

          Integer constants such as 3 3l 3L 3n.

          Suffixes [g-z][G-Z] are accepted by the parser. Suffixes except 'l', 'L' and 'n' are rejected by the typechecker

          *)
        2. | Pconst_char of char
          (*

          Character such as 'c'.

          *)
        3. | Pconst_string of string * Location.t * string option
          (*

          Constant string such as "constant" or {delim|other constant|delim}.

          The location span the content of the string, without the delimiters.

          *)
        4. | Pconst_float of string * char option
          (*

          Float constant such as 3.4, 2e5 or 1.4e-4.

          Suffixes g-zG-Z are accepted by the parser. Suffixes are rejected by the typechecker.

          *)
        type location_stack = Location.t list

        Extension points

        type attribute = {
        1. attr_name : string Asttypes.loc;
        2. attr_payload : payload;
        3. attr_loc : Location.t;
        }

        Attributes such as [\@id ARG] and [\@\@id ARG].

        Metadata containers passed around within the AST. The compiler ignores unknown attributes.

        and extension = string Asttypes.loc * payload

        Extension points such as [%id ARG] and [%%id ARG].

        Sub-language placeholder -- rejected by the typechecker.

        and attributes = attribute list
        and payload =
        1. | PStr of structure
        2. | PSig of signature
          (*

          : SIG in an attribute or an extension point

          *)
        3. | PTyp of core_type
          (*

          : T in an attribute or an extension point

          *)
        4. | PPat of pattern * expression option
          (*

          ? P or ? P when E, in an attribute or an extension point

          *)

        Core language

        Type expressions

        and core_type = {
        1. ptyp_desc : core_type_desc;
        2. ptyp_loc : Location.t;
        3. ptyp_loc_stack : location_stack;
        4. ptyp_attributes : attributes;
          (*

          ... [\@id1] [\@id2]

          *)
        }
        and core_type_desc =
        1. | Ptyp_any
          (*

          _

          *)
        2. | Ptyp_var of string
          (*

          A type variable such as 'a

          *)
        3. | Ptyp_arrow of Asttypes.arg_label * core_type * core_type
          (*

          Ptyp_arrow(lbl, T1, T2) represents:

          *)
        4. | Ptyp_tuple of core_type list
          (*

          Ptyp_tuple([T1 ; ... ; Tn]) represents a product type T1 * ... * Tn.

          Invariant: n >= 2.

          *)
        5. | Ptyp_constr of Longident.t Asttypes.loc * core_type list
          (*

          Ptyp_constr(lident, l) represents:

          • tconstr when l=[],
          • T tconstr when l=[T],
          • (T1, ..., Tn) tconstr when l=[T1 ; ... ; Tn].
          *)
        6. | Ptyp_object of object_field list * Asttypes.closed_flag
          (*

          Ptyp_object([ l1:T1; ...; ln:Tn ], flag) represents:

          • < l1:T1; ...; ln:Tn > when flag is Closed,
          • < l1:T1; ...; ln:Tn; .. > when flag is Open.
          *)
        7. | Ptyp_class of Longident.t Asttypes.loc * core_type list
          (*

          Ptyp_class(tconstr, l) represents:

          • #tconstr when l=[],
          • T #tconstr when l=[T],
          • (T1, ..., Tn) #tconstr when l=[T1 ; ... ; Tn].
          *)
        8. | Ptyp_alias of core_type * string
          (*

          T as 'a.

          *)
        9. | Ptyp_variant of row_field list +Parsetree (ocaml.Parsetree)

          Module Parsetree

          Abstract syntax tree produced by parsing

          Warning: this module is unstable and part of compiler-libs.

          type constant = {
          1. pconst_desc : constant_desc;
          2. pconst_loc : Location.t;
          }
          and constant_desc =
          1. | Pconst_integer of string * char option
            (*

            Integer constants such as 3 3l 3L 3n.

            Suffixes [g-z][G-Z] are accepted by the parser. Suffixes except 'l', 'L' and 'n' are rejected by the typechecker

            *)
          2. | Pconst_char of char
            (*

            Character such as 'c'.

            *)
          3. | Pconst_string of string * Location.t * string option
            (*

            Constant string such as "constant" or {delim|other constant|delim}.

            The location span the content of the string, without the delimiters.

            *)
          4. | Pconst_float of string * char option
            (*

            Float constant such as 3.4, 2e5 or 1.4e-4.

            Suffixes g-zG-Z are accepted by the parser. Suffixes are rejected by the typechecker.

            *)
          type location_stack = Location.t list

          Extension points

          type attribute = {
          1. attr_name : string Asttypes.loc;
          2. attr_payload : payload;
          3. attr_loc : Location.t;
          }

          Attributes such as [\@id ARG] and [\@\@id ARG].

          Metadata containers passed around within the AST. The compiler ignores unknown attributes.

          and extension = string Asttypes.loc * payload

          Extension points such as [%id ARG] and [%%id ARG].

          Sub-language placeholder -- rejected by the typechecker.

          and attributes = attribute list
          and payload =
          1. | PStr of structure
          2. | PSig of signature
            (*

            : SIG in an attribute or an extension point

            *)
          3. | PTyp of core_type
            (*

            : T in an attribute or an extension point

            *)
          4. | PPat of pattern * expression option
            (*

            ? P or ? P when E, in an attribute or an extension point

            *)

          Core language

          Type expressions

          and core_type = {
          1. ptyp_desc : core_type_desc;
          2. ptyp_loc : Location.t;
          3. ptyp_loc_stack : location_stack;
          4. ptyp_attributes : attributes;
            (*

            ... [\@id1] [\@id2]

            *)
          }
          and core_type_desc =
          1. | Ptyp_any
            (*

            _

            *)
          2. | Ptyp_var of string
            (*

            A type variable such as 'a

            *)
          3. | Ptyp_arrow of Asttypes.arg_label * core_type * core_type
            (*

            Ptyp_arrow(lbl, T1, T2) represents:

            *)
          4. | Ptyp_tuple of core_type list
            (*

            Ptyp_tuple([T1 ; ... ; Tn]) represents a product type T1 * ... * Tn.

            Invariant: n >= 2.

            *)
          5. | Ptyp_constr of Longident.t Asttypes.loc * core_type list
            (*

            Ptyp_constr(lident, l) represents:

            • tconstr when l=[],
            • T tconstr when l=[T],
            • (T1, ..., Tn) tconstr when l=[T1 ; ... ; Tn].
            *)
          6. | Ptyp_object of object_field list * Asttypes.closed_flag
            (*

            Ptyp_object([ l1:T1; ...; ln:Tn ], flag) represents:

            • < l1:T1; ...; ln:Tn > when flag is Closed,
            • < l1:T1; ...; ln:Tn; .. > when flag is Open.
            *)
          7. | Ptyp_class of Longident.t Asttypes.loc * core_type list
            (*

            Ptyp_class(tconstr, l) represents:

            • #tconstr when l=[],
            • T #tconstr when l=[T],
            • (T1, ..., Tn) #tconstr when l=[T1 ; ... ; Tn].
            *)
          8. | Ptyp_alias of core_type * string Asttypes.loc
            (*

            T as 'a.

            *)
          9. | Ptyp_variant of row_field list * Asttypes.closed_flag - * Asttypes.label list option
            (*

            Ptyp_variant([`A;`B], flag, labels) represents:

            • [ `A|`B ] when flag is Closed, and labels is None,
            • [> `A|`B ] when flag is Open, and labels is None,
            • [< `A|`B ] when flag is Closed, and labels is Some [],
            • [< `A|`B > `X `Y ] when flag is Closed, and labels is Some ["X";"Y"].
            *)
          10. | Ptyp_poly of string Asttypes.loc list * core_type
            (*

            'a1 ... 'an. T

            Can only appear in the following context:

            • As the core_type of a Ppat_constraint node corresponding to a constraint on a let-binding:

              let x : 'a1 ... 'an. T = e ...
            *)
          11. | Ptyp_package of package_type
            (*

            (module S).

            *)
          12. | Ptyp_extension of extension
            (*

            [%id].

            *)
          and package_type = + * Asttypes.label list option
          (*

          Ptyp_variant([`A;`B], flag, labels) represents:

          • [ `A|`B ] when flag is Closed, and labels is None,
          • [> `A|`B ] when flag is Open, and labels is None,
          • [< `A|`B ] when flag is Closed, and labels is Some [],
          • [< `A|`B > `X `Y ] when flag is Closed, and labels is Some ["X";"Y"].
          *)
        10. | Ptyp_poly of string Asttypes.loc list * core_type
          (*

          'a1 ... 'an. T

          Can only appear in the following context:

          • As the core_type of a Ppat_constraint node corresponding to a constraint on a let-binding:

            let x : 'a1 ... 'an. T = e ...
          *)
        11. | Ptyp_package of package_type
          (*

          (module S).

          *)
        12. | Ptyp_open of Longident.t Asttypes.loc * core_type
          (*

          M.(T)

          *)
        13. | Ptyp_extension of extension
          (*

          [%id].

          *)

        As package_type typed values:

        • (S, []) represents (module S),
        • (S, [(t1, T1) ; ... ; (tn, Tn)]) represents (module S with type t1 = T1 and ... and tn = Tn).
        and row_field = {
        1. prf_desc : row_field_desc;
        2. prf_loc : Location.t;
        3. prf_attributes : attributes;
        }
        and row_field_desc =
        1. | Rtag of Asttypes.label Asttypes.loc * bool * core_type list
          (*

          Rtag(`A, b, l) represents:

          • `A when b is true and l is [],
          • `A of T when b is false and l is [T],
          • `A of T1 & .. & Tn when b is false and l is [T1;...Tn],
          • `A of & T1 & .. & Tn when b is true and l is [T1;...Tn].
          • The bool field is true if the tag contains a constant (empty) constructor.
          • & occurs when several types are used for the same constructor (see 4.2 in the manual)
          *)
        2. | Rinherit of core_type
          (*

          [ | t ]

          *)
        and object_field = {
        1. pof_desc : object_field_desc;
        2. pof_loc : Location.t;
        3. pof_attributes : attributes;
        }
        and object_field_desc =
        1. | Otag of Asttypes.label Asttypes.loc * core_type
        2. | Oinherit of core_type

        Patterns

        and pattern = {
        1. ppat_desc : pattern_desc;
        2. ppat_loc : Location.t;
        3. ppat_loc_stack : location_stack;
        4. ppat_attributes : attributes;
          (*

          ... [\@id1] [\@id2]

          *)
        }
        and pattern_desc =
        1. | Ppat_any
          (*

          The pattern _.

          *)
        2. | Ppat_var of string Asttypes.loc
          (*

          A variable pattern such as x

          *)
        3. | Ppat_alias of pattern * string Asttypes.loc
          (*

          An alias pattern such as P as 'a

          *)
        4. | Ppat_constant of constant
          (*

          Patterns such as 1, 'a', "true", 1.0, 1l, 1L, 1n

          *)
        5. | Ppat_interval of constant * constant
          (*

          Patterns such as 'a'..'z'.

          Other forms of interval are recognized by the parser but rejected by the type-checker.

          *)
        6. | Ppat_tuple of pattern list
          (*

          Patterns (P1, ..., Pn).

          Invariant: n >= 2

          *)
        7. | Ppat_construct of Longident.t Asttypes.loc - * (string Asttypes.loc list * pattern) option
          (*

          Ppat_construct(C, args) represents:

          • C when args is None,
          • C P when args is Some ([], P)
          • C (P1, ..., Pn) when args is Some ([], Ppat_tuple [P1; ...; Pn])
          • C (type a b) P when args is Some ([a; b], P)
          *)
        8. | Ppat_variant of Asttypes.label * pattern option
          (*

          Ppat_variant(`A, pat) represents:

          • `A when pat is None,
          • `A P when pat is Some P
          *)
        9. | Ppat_record of (Longident.t Asttypes.loc * pattern) list * Asttypes.closed_flag
          (*

          Ppat_record([(l1, P1) ; ... ; (ln, Pn)], flag) represents:

          • { l1=P1; ...; ln=Pn } when flag is Closed
          • { l1=P1; ...; ln=Pn; _} when flag is Open

          Invariant: n > 0

          *)
        10. | Ppat_array of pattern list
          (*

          Pattern [| P1; ...; Pn |]

          *)
        11. | Ppat_or of pattern * pattern
          (*

          Pattern P1 | P2

          *)
        12. | Ppat_constraint of pattern * core_type
          (*

          Pattern (P : T)

          *)
        13. | Ppat_type of Longident.t Asttypes.loc
          (*

          Pattern #tconst

          *)
        14. | Ppat_lazy of pattern
          (*

          Pattern lazy P

          *)
        15. | Ppat_unpack of string option Asttypes.loc
          (*

          Ppat_unpack(s) represents:

          • (module P) when s is Some "P"
          • (module _) when s is None

          Note: (module P : S) is represented as Ppat_constraint(Ppat_unpack(Some "P"), Ptyp_package S)

          *)
        16. | Ppat_exception of pattern
          (*

          Pattern exception P

          *)
        17. | Ppat_extension of extension
          (*

          Pattern [%id]

          *)
        18. | Ppat_open of Longident.t Asttypes.loc * pattern
          (*

          Pattern M.(P)

          *)

        Value expressions

        and expression = {
        1. pexp_desc : expression_desc;
        2. pexp_loc : Location.t;
        3. pexp_loc_stack : location_stack;
        4. pexp_attributes : attributes;
          (*

          ... [\@id1] [\@id2]

          *)
        }
        and expression_desc =
        1. | Pexp_ident of Longident.t Asttypes.loc
          (*

          Identifiers such as x and M.x

          *)
        2. | Pexp_constant of constant
          (*

          Expressions constant such as 1, 'a', "true", 1.0, 1l, 1L, 1n

          *)
        3. | Pexp_let of Asttypes.rec_flag * value_binding list * expression
          (*

          Pexp_let(flag, [(P1,E1) ; ... ; (Pn,En)], E) represents:

          • let P1 = E1 and ... and Pn = EN in E when flag is Nonrecursive,
          • let rec P1 = E1 and ... and Pn = EN in E when flag is Recursive.
          *)
        4. | Pexp_function of case list
          (*

          function P1 -> E1 | ... | Pn -> En

          *)
        5. | Pexp_fun of Asttypes.arg_label * expression option * pattern * expression
          (*

          Pexp_fun(lbl, exp0, P, E1) represents:

          • fun P -> E1 when lbl is Nolabel and exp0 is None
          • fun ~l:P -> E1 when lbl is Labelled l and exp0 is None
          • fun ?l:P -> E1 when lbl is Optional l and exp0 is None
          • fun ?l:(P = E0) -> E1 when lbl is Optional l and exp0 is Some E0

          Notes:

          • If E0 is provided, only Optional is allowed.
          • fun P1 P2 .. Pn -> E1 is represented as nested Pexp_fun.
          • let f P = E is represented using Pexp_fun.
          *)
        6. | Pexp_apply of expression * (Asttypes.arg_label * expression) list
          (*

          Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)]) represents E0 ~l1:E1 ... ~ln:En

          li can be Nolabel (non labeled argument), Labelled (labelled arguments) or Optional (optional argument).

          Invariant: n > 0

          *)
        7. | Pexp_match of expression * case list
          (*

          match E0 with P1 -> E1 | ... | Pn -> En

          *)
        8. | Pexp_try of expression * case list
          (*

          try E0 with P1 -> E1 | ... | Pn -> En

          *)
        9. | Pexp_tuple of expression list
          (*

          Expressions (E1, ..., En)

          Invariant: n >= 2

          *)
        10. | Pexp_construct of Longident.t Asttypes.loc * expression option
          (*

          Pexp_construct(C, exp) represents:

          • C when exp is None,
          • C E when exp is Some E,
          • C (E1, ..., En) when exp is Some (Pexp_tuple[E1;...;En])
          *)
        11. | Pexp_variant of Asttypes.label * expression option
          (*

          Pexp_variant(`A, exp) represents

          • `A when exp is None
          • `A E when exp is Some E
          *)
        12. | Pexp_record of (Longident.t Asttypes.loc * expression) list * expression option
          (*

          Pexp_record([(l1,P1) ; ... ; (ln,Pn)], exp0) represents

          • { l1=P1; ...; ln=Pn } when exp0 is None
          • { E0 with l1=P1; ...; ln=Pn } when exp0 is Some E0

          Invariant: n > 0

          *)
        13. | Pexp_field of expression * Longident.t Asttypes.loc
          (*

          E.l

          *)
        14. | Pexp_setfield of expression * Longident.t Asttypes.loc * expression
          (*

          E1.l <- E2

          *)
        15. | Pexp_array of expression list
          (*

          [| E1; ...; En |]

          *)
        16. | Pexp_ifthenelse of expression * expression * expression option
          (*

          if E1 then E2 else E3

          *)
        17. | Pexp_sequence of expression * expression
          (*

          E1; E2

          *)
        18. | Pexp_while of expression * expression
          (*

          while E1 do E2 done

          *)
        19. | Pexp_for of pattern + * (string Asttypes.loc list * pattern) option
          (*

          Ppat_construct(C, args) represents:

          • C when args is None,
          • C P when args is Some ([], P)
          • C (P1, ..., Pn) when args is Some ([], Ppat_tuple [P1; ...; Pn])
          • C (type a b) P when args is Some ([a; b], P)
          *)
        20. | Ppat_variant of Asttypes.label * pattern option
          (*

          Ppat_variant(`A, pat) represents:

          • `A when pat is None,
          • `A P when pat is Some P
          *)
        21. | Ppat_record of (Longident.t Asttypes.loc * pattern) list * Asttypes.closed_flag
          (*

          Ppat_record([(l1, P1) ; ... ; (ln, Pn)], flag) represents:

          • { l1=P1; ...; ln=Pn } when flag is Closed
          • { l1=P1; ...; ln=Pn; _} when flag is Open

          Invariant: n > 0

          *)
        22. | Ppat_array of pattern list
          (*

          Pattern [| P1; ...; Pn |]

          *)
        23. | Ppat_or of pattern * pattern
          (*

          Pattern P1 | P2

          *)
        24. | Ppat_constraint of pattern * core_type
          (*

          Pattern (P : T)

          *)
        25. | Ppat_type of Longident.t Asttypes.loc
          (*

          Pattern #tconst

          *)
        26. | Ppat_lazy of pattern
          (*

          Pattern lazy P

          *)
        27. | Ppat_unpack of string option Asttypes.loc
          (*

          Ppat_unpack(s) represents:

          • (module P) when s is Some "P"
          • (module _) when s is None

          Note: (module P : S) is represented as Ppat_constraint(Ppat_unpack(Some "P"), Ptyp_package S)

          *)
        28. | Ppat_exception of pattern
          (*

          Pattern exception P

          *)
        29. | Ppat_effect of pattern * pattern
        30. | Ppat_extension of extension
          (*

          Pattern [%id]

          *)
        31. | Ppat_open of Longident.t Asttypes.loc * pattern
          (*

          Pattern M.(P)

          *)

        Value expressions

        and expression = {
        1. pexp_desc : expression_desc;
        2. pexp_loc : Location.t;
        3. pexp_loc_stack : location_stack;
        4. pexp_attributes : attributes;
          (*

          ... [\@id1] [\@id2]

          *)
        }
        and expression_desc =
        1. | Pexp_ident of Longident.t Asttypes.loc
          (*

          Identifiers such as x and M.x

          *)
        2. | Pexp_constant of constant
          (*

          Expressions constant such as 1, 'a', "true", 1.0, 1l, 1L, 1n

          *)
        3. | Pexp_let of Asttypes.rec_flag * value_binding list * expression
          (*

          Pexp_let(flag, [(P1,E1) ; ... ; (Pn,En)], E) represents:

          • let P1 = E1 and ... and Pn = EN in E when flag is Nonrecursive,
          • let rec P1 = E1 and ... and Pn = EN in E when flag is Recursive.
          *)
        4. | Pexp_function of function_param list * type_constraint option * function_body
          (*

          Pexp_function ([P1; ...; Pn], C, body) represents any construct involving fun or function, including:

          • fun P1 ... Pn -> E when body = Pfunction_body E
          • fun P1 ... Pn -> function p1 -> e1 | ... | pm -> em when body = Pfunction_cases [ p1 -> e1; ...; pm -> em ]

          C represents a type constraint or coercion placed immediately before the arrow, e.g. fun P1 ... Pn : ty -> ... when C = Some (Pconstraint ty).

          A function must have parameters. Pexp_function (params, _, body) must have non-empty params or a Pfunction_cases _ body.

          *)
        5. | Pexp_apply of expression * (Asttypes.arg_label * expression) list
          (*

          Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)]) represents E0 ~l1:E1 ... ~ln:En

          li can be Nolabel (non labeled argument), Labelled (labelled arguments) or Optional (optional argument).

          Invariant: n > 0

          *)
        6. | Pexp_match of expression * case list
          (*

          match E0 with P1 -> E1 | ... | Pn -> En

          *)
        7. | Pexp_try of expression * case list
          (*

          try E0 with P1 -> E1 | ... | Pn -> En

          *)
        8. | Pexp_tuple of expression list
          (*

          Expressions (E1, ..., En)

          Invariant: n >= 2

          *)
        9. | Pexp_construct of Longident.t Asttypes.loc * expression option
          (*

          Pexp_construct(C, exp) represents:

          • C when exp is None,
          • C E when exp is Some E,
          • C (E1, ..., En) when exp is Some (Pexp_tuple[E1;...;En])
          *)
        10. | Pexp_variant of Asttypes.label * expression option
          (*

          Pexp_variant(`A, exp) represents

          • `A when exp is None
          • `A E when exp is Some E
          *)
        11. | Pexp_record of (Longident.t Asttypes.loc * expression) list * expression option
          (*

          Pexp_record([(l1,P1) ; ... ; (ln,Pn)], exp0) represents

          • { l1=P1; ...; ln=Pn } when exp0 is None
          • { E0 with l1=P1; ...; ln=Pn } when exp0 is Some E0

          Invariant: n > 0

          *)
        12. | Pexp_field of expression * Longident.t Asttypes.loc
          (*

          E.l

          *)
        13. | Pexp_setfield of expression * Longident.t Asttypes.loc * expression
          (*

          E1.l <- E2

          *)
        14. | Pexp_array of expression list
          (*

          [| E1; ...; En |]

          *)
        15. | Pexp_ifthenelse of expression * expression * expression option
          (*

          if E1 then E2 else E3

          *)
        16. | Pexp_sequence of expression * expression
          (*

          E1; E2

          *)
        17. | Pexp_while of expression * expression
          (*

          while E1 do E2 done

          *)
        18. | Pexp_for of pattern * expression * expression * Asttypes.direction_flag - * expression
          (*

          Pexp_for(i, E1, E2, direction, E3) represents:

          • for i = E1 to E2 do E3 done when direction is Upto
          • for i = E1 downto E2 do E3 done when direction is Downto
          *)
        19. | Pexp_constraint of expression * core_type
          (*

          (E : T)

          *)
        20. | Pexp_coerce of expression * core_type option * core_type
          (*

          Pexp_coerce(E, from, T) represents

          • (E :> T) when from is None,
          • (E : T0 :> T) when from is Some T0.
          *)
        21. | Pexp_send of expression * Asttypes.label Asttypes.loc
          (*

          E # m

          *)
        22. | Pexp_new of Longident.t Asttypes.loc
          (*

          new M.c

          *)
        23. | Pexp_setinstvar of Asttypes.label Asttypes.loc * expression
          (*

          x <- 2

          *)
        24. | Pexp_override of (Asttypes.label Asttypes.loc * expression) list
          (*

          {< x1 = E1; ...; xn = En >}

          *)
        25. | Pexp_letmodule of string option Asttypes.loc * module_expr * expression
          (*

          let module M = ME in E

          *)
        26. | Pexp_letexception of extension_constructor * expression
          (*

          let exception C in E

          *)
        27. | Pexp_assert of expression
          (*

          assert E.

          Note: assert false is treated in a special way by the type-checker.

          *)
        28. | Pexp_lazy of expression
          (*

          lazy E

          *)
        29. | Pexp_poly of expression * core_type option
          (*

          Used for method bodies.

          Can only be used as the expression under Cfk_concrete for methods (not values).

          *)
        30. | Pexp_object of class_structure
          (*

          object ... end

          *)
        31. | Pexp_newtype of string Asttypes.loc * expression
          (*

          fun (type t) -> E

          *)
        32. | Pexp_pack of module_expr
          (*

          (module ME).

          (module ME : S) is represented as Pexp_constraint(Pexp_pack ME, Ptyp_package S)

          *)
        33. | Pexp_open of open_declaration * expression
          (*
          • M.(E)
          • let open M in E
          • let open! M in E
          *)
        34. | Pexp_letop of letop
          (*
          • let* P = E0 in E1
          • let* P0 = E00 and* P1 = E01 in E1
          *)
        35. | Pexp_extension of extension
          (*

          [%id]

          *)
        36. | Pexp_unreachable
          (*

          .

          *)
        and case = {
        1. pc_lhs : pattern;
        2. pc_guard : expression option;
        3. pc_rhs : expression;
        }

        Values of type case represents (P -> E) or (P when E0 -> E)

        and letop = {
        1. let_ : binding_op;
        2. ands : binding_op list;
        3. body : expression;
        }
        and binding_op = {
        1. pbop_op : string Asttypes.loc;
        2. pbop_pat : pattern;
        3. pbop_exp : expression;
        4. pbop_loc : Location.t;
        }

        Value descriptions

        and value_description = {
        1. pval_name : string Asttypes.loc;
        2. pval_type : core_type;
        3. pval_prim : string list;
        4. pval_attributes : attributes;
          (*

          ... [\@\@id1] [\@\@id2]

          *)
        5. pval_loc : Location.t;
        }

        Values of type value_description represents:

        • val x: T, when pval_prim is []
        • external x: T = "s1" ... "sn" when pval_prim is ["s1";..."sn"]

        Type declarations

        and type_declaration = {
        1. ptype_name : string Asttypes.loc;
        2. ptype_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
          (*

          ('a1,...'an) t

          *)
        3. ptype_cstrs : (core_type * core_type * Location.t) list;
          (*

          ... constraint T1=T1' ... constraint Tn=Tn'

          *)
        4. ptype_kind : type_kind;
        5. ptype_private : Asttypes.private_flag;
          (*

          for = private ...

          *)
        6. ptype_manifest : core_type option;
          (*

          represents = T

          *)
        7. ptype_attributes : attributes;
          (*

          ... [\@\@id1] [\@\@id2]

          *)
        8. ptype_loc : Location.t;
        }

        Here are type declarations and their representation, for various ptype_kind and ptype_manifest values:

        • type t when type_kind is Ptype_abstract, and manifest is None,
        • type t = T0 when type_kind is Ptype_abstract, and manifest is Some T0,
        • type t = C of T | ... when type_kind is Ptype_variant, and manifest is None,
        • type t = T0 = C of T | ... when type_kind is Ptype_variant, and manifest is Some T0,
        • type t = {l: T; ...} when type_kind is Ptype_record, and manifest is None,
        • type t = T0 = {l : T; ...} when type_kind is Ptype_record, and manifest is Some T0,
        • type t = .. when type_kind is Ptype_open, and manifest is None.
        and type_kind =
        1. | Ptype_abstract
        2. | Ptype_variant of constructor_declaration list
        3. | Ptype_record of label_declaration list
          (*

          Invariant: non-empty list

          *)
        4. | Ptype_open
        and label_declaration = {
        1. pld_name : string Asttypes.loc;
        2. pld_mutable : Asttypes.mutable_flag;
        3. pld_type : core_type;
        4. pld_loc : Location.t;
        5. pld_attributes : attributes;
          (*

          l : T [\@id1] [\@id2]

          *)
        }

        Note: T can be a Ptyp_poly.

        and constructor_declaration = {
        1. pcd_name : string Asttypes.loc;
        2. pcd_vars : string Asttypes.loc list;
        3. pcd_args : constructor_arguments;
        4. pcd_res : core_type option;
        5. pcd_loc : Location.t;
        6. pcd_attributes : attributes;
          (*

          C of ... [\@id1] [\@id2]

          *)
        }
        and constructor_arguments =
        1. | Pcstr_tuple of core_type list
        2. | Pcstr_record of label_declaration list
          (*

          Values of type constructor_declaration represents the constructor arguments of:

          • C of T1 * ... * Tn when res = None, and args = Pcstr_tuple [T1; ... ; Tn],
          • C: T0 when res = Some T0, and args = Pcstr_tuple [],
          • C: T1 * ... * Tn -> T0 when res = Some T0, and args = Pcstr_tuple [T1; ... ; Tn],
          • C of {...} when res = None, and args = Pcstr_record [...],
          • C: {...} -> T0 when res = Some T0, and args = Pcstr_record [...].
          *)
        and type_extension = {
        1. ptyext_path : Longident.t Asttypes.loc;
        2. ptyext_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
        3. ptyext_constructors : extension_constructor list;
        4. ptyext_private : Asttypes.private_flag;
        5. ptyext_loc : Location.t;
        6. ptyext_attributes : attributes;
          (*

          ... \@\@id1 \@\@id2

          *)
        }

        Definition of new extensions constructors for the extensive sum type t (type t += ...).

        and extension_constructor = {
        1. pext_name : string Asttypes.loc;
        2. pext_kind : extension_constructor_kind;
        3. pext_loc : Location.t;
        4. pext_attributes : attributes;
          (*

          C of ... [\@id1] [\@id2]

          *)
        }
        and type_exception = {
        1. ptyexn_constructor : extension_constructor;
        2. ptyexn_loc : Location.t;
        3. ptyexn_attributes : attributes;
          (*

          ... [\@\@id1] [\@\@id2]

          *)
        }

        Definition of a new exception (exception E).

        and extension_constructor_kind =
        1. | Pext_decl of string Asttypes.loc list + * expression
          (*

          Pexp_for(i, E1, E2, direction, E3) represents:

          • for i = E1 to E2 do E3 done when direction is Upto
          • for i = E1 downto E2 do E3 done when direction is Downto
          *)
        2. | Pexp_constraint of expression * core_type
          (*

          (E : T)

          *)
        3. | Pexp_coerce of expression * core_type option * core_type
          (*

          Pexp_coerce(E, from, T) represents

          • (E :> T) when from is None,
          • (E : T0 :> T) when from is Some T0.
          *)
        4. | Pexp_send of expression * Asttypes.label Asttypes.loc
          (*

          E # m

          *)
        5. | Pexp_new of Longident.t Asttypes.loc
          (*

          new M.c

          *)
        6. | Pexp_setinstvar of Asttypes.label Asttypes.loc * expression
          (*

          x <- 2

          *)
        7. | Pexp_override of (Asttypes.label Asttypes.loc * expression) list
          (*

          {< x1 = E1; ...; xn = En >}

          *)
        8. | Pexp_letmodule of string option Asttypes.loc * module_expr * expression
          (*

          let module M = ME in E

          *)
        9. | Pexp_letexception of extension_constructor * expression
          (*

          let exception C in E

          *)
        10. | Pexp_assert of expression
          (*

          assert E.

          Note: assert false is treated in a special way by the type-checker.

          *)
        11. | Pexp_lazy of expression
          (*

          lazy E

          *)
        12. | Pexp_poly of expression * core_type option
          (*

          Used for method bodies.

          Can only be used as the expression under Cfk_concrete for methods (not values).

          *)
        13. | Pexp_object of class_structure
          (*

          object ... end

          *)
        14. | Pexp_newtype of string Asttypes.loc * expression
          (*

          fun (type t) -> E

          *)
        15. | Pexp_pack of module_expr
          (*

          (module ME).

          (module ME : S) is represented as Pexp_constraint(Pexp_pack ME, Ptyp_package S)

          *)
        16. | Pexp_open of open_declaration * expression
          (*
          • M.(E)
          • let open M in E
          • let open! M in E
          *)
        17. | Pexp_letop of letop
          (*
          • let* P = E0 in E1
          • let* P0 = E00 and* P1 = E01 in E1
          *)
        18. | Pexp_extension of extension
          (*

          [%id]

          *)
        19. | Pexp_unreachable
          (*

          .

          *)
        and case = {
        1. pc_lhs : pattern;
        2. pc_guard : expression option;
        3. pc_rhs : expression;
        }

        Values of type case represents (P -> E) or (P when E0 -> E)

        and letop = {
        1. let_ : binding_op;
        2. ands : binding_op list;
        3. body : expression;
        }
        and binding_op = {
        1. pbop_op : string Asttypes.loc;
        2. pbop_pat : pattern;
        3. pbop_exp : expression;
        4. pbop_loc : Location.t;
        }
        and function_param_desc =
        1. | Pparam_val of Asttypes.arg_label * expression option * pattern
          (*

          Pparam_val (lbl, exp0, P) represents the parameter:

          Note: If E0 is provided, only Optional is allowed.

          *)
        2. | Pparam_newtype of string Asttypes.loc
          (*

          Pparam_newtype x represents the parameter (type x). x carries the location of the identifier, whereas the pparam_loc on the enclosing function_param node is the location of the (type x) as a whole.

          Multiple parameters (type a b c) are represented as multiple Pparam_newtype nodes, let's say:

          [ { pparam_kind = Pparam_newtype a; pparam_loc = loc1 };
          +  { pparam_kind = Pparam_newtype b; pparam_loc = loc2 };
          +  { pparam_kind = Pparam_newtype c; pparam_loc = loc3 };
          +]

          Here, the first loc loc1 is the location of (type a b c), and the subsequent locs loc2 and loc3 are the same as loc1, except marked as ghost locations. The locations on a, b, c, correspond to the variables a, b, and c in the source code.

          *)
        and function_param = {
        1. pparam_loc : Location.t;
        2. pparam_desc : function_param_desc;
        }
        and function_body =
        1. | Pfunction_body of expression
        2. | Pfunction_cases of case list * Location.t * attributes
          (*

          In Pfunction_cases (_, loc, attrs), the location extends from the start of the function keyword to the end of the last case. The compiler will only use typechecking-related attributes from attrs, e.g. enabling or disabling a warning.

          *)

        See the comment on Pexp_function.

        and type_constraint =
        1. | Pconstraint of core_type
        2. | Pcoerce of core_type option * core_type
          (*

          See the comment on Pexp_function.

          *)

        Value descriptions

        and value_description = {
        1. pval_name : string Asttypes.loc;
        2. pval_type : core_type;
        3. pval_prim : string list;
        4. pval_attributes : attributes;
          (*

          ... [\@\@id1] [\@\@id2]

          *)
        5. pval_loc : Location.t;
        }

        Values of type value_description represents:

        • val x: T, when pval_prim is []
        • external x: T = "s1" ... "sn" when pval_prim is ["s1";..."sn"]

        Type declarations

        and type_declaration = {
        1. ptype_name : string Asttypes.loc;
        2. ptype_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
          (*

          ('a1,...'an) t

          *)
        3. ptype_cstrs : (core_type * core_type * Location.t) list;
          (*

          ... constraint T1=T1' ... constraint Tn=Tn'

          *)
        4. ptype_kind : type_kind;
        5. ptype_private : Asttypes.private_flag;
          (*

          for = private ...

          *)
        6. ptype_manifest : core_type option;
          (*

          represents = T

          *)
        7. ptype_attributes : attributes;
          (*

          ... [\@\@id1] [\@\@id2]

          *)
        8. ptype_loc : Location.t;
        }

        Here are type declarations and their representation, for various ptype_kind and ptype_manifest values:

        • type t when type_kind is Ptype_abstract, and manifest is None,
        • type t = T0 when type_kind is Ptype_abstract, and manifest is Some T0,
        • type t = C of T | ... when type_kind is Ptype_variant, and manifest is None,
        • type t = T0 = C of T | ... when type_kind is Ptype_variant, and manifest is Some T0,
        • type t = {l: T; ...} when type_kind is Ptype_record, and manifest is None,
        • type t = T0 = {l : T; ...} when type_kind is Ptype_record, and manifest is Some T0,
        • type t = .. when type_kind is Ptype_open, and manifest is None.
        and type_kind =
        1. | Ptype_abstract
        2. | Ptype_variant of constructor_declaration list
        3. | Ptype_record of label_declaration list
          (*

          Invariant: non-empty list

          *)
        4. | Ptype_open
        and label_declaration = {
        1. pld_name : string Asttypes.loc;
        2. pld_mutable : Asttypes.mutable_flag;
        3. pld_type : core_type;
        4. pld_loc : Location.t;
        5. pld_attributes : attributes;
          (*

          l : T [\@id1] [\@id2]

          *)
        }

        Note: T can be a Ptyp_poly.

        and constructor_declaration = {
        1. pcd_name : string Asttypes.loc;
        2. pcd_vars : string Asttypes.loc list;
        3. pcd_args : constructor_arguments;
        4. pcd_res : core_type option;
        5. pcd_loc : Location.t;
        6. pcd_attributes : attributes;
          (*

          C of ... [\@id1] [\@id2]

          *)
        }
        and constructor_arguments =
        1. | Pcstr_tuple of core_type list
        2. | Pcstr_record of label_declaration list
          (*

          Values of type constructor_declaration represents the constructor arguments of:

          • C of T1 * ... * Tn when res = None, and args = Pcstr_tuple [T1; ... ; Tn],
          • C: T0 when res = Some T0, and args = Pcstr_tuple [],
          • C: T1 * ... * Tn -> T0 when res = Some T0, and args = Pcstr_tuple [T1; ... ; Tn],
          • C of {...} when res = None, and args = Pcstr_record [...],
          • C: {...} -> T0 when res = Some T0, and args = Pcstr_record [...].
          *)
        and type_extension = {
        1. ptyext_path : Longident.t Asttypes.loc;
        2. ptyext_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
        3. ptyext_constructors : extension_constructor list;
        4. ptyext_private : Asttypes.private_flag;
        5. ptyext_loc : Location.t;
        6. ptyext_attributes : attributes;
          (*

          ... \@\@id1 \@\@id2

          *)
        }

        Definition of new extensions constructors for the extensive sum type t (type t += ...).

        and extension_constructor = {
        1. pext_name : string Asttypes.loc;
        2. pext_kind : extension_constructor_kind;
        3. pext_loc : Location.t;
        4. pext_attributes : attributes;
          (*

          C of ... [\@id1] [\@id2]

          *)
        }
        and type_exception = {
        1. ptyexn_constructor : extension_constructor;
        2. ptyexn_loc : Location.t;
        3. ptyexn_attributes : attributes;
          (*

          ... [\@\@id1] [\@\@id2]

          *)
        }

        Definition of a new exception (exception E).

        and extension_constructor_kind =
        1. | Pext_decl of string Asttypes.loc list * constructor_arguments * core_type option
          (*

          Pext_decl(existentials, c_args, t_opt) describes a new extension constructor. It can be:

          • C of T1 * ... * Tn when:

            • existentials is [],
            • c_args is [T1; ...; Tn],
            • t_opt is None
          • C: T0 when

            • existentials is [],
            • c_args is [],
            • t_opt is Some T0.
          • C: T1 * ... * Tn -> T0 when

            • existentials is [],
            • c_args is [T1; ...; Tn],
            • t_opt is Some T0.
          • C: 'a... . T1 * ... * Tn -> T0 when

            • existentials is ['a;...],
            • c_args is [T1; ... ; Tn],
            • t_opt is Some T0.
          *)
        2. | Pext_rebind of Longident.t Asttypes.loc
          (*

          Pext_rebind(D) re-export the constructor D with the new name C

          *)

        Class language

        Type expressions for the class language

        and class_type = {
        1. pcty_desc : class_type_desc;
        2. pcty_loc : Location.t;
        3. pcty_attributes : attributes;
          (*

          ... [\@id1] [\@id2]

          *)
        }
        and class_type_desc =
        1. | Pcty_constr of Longident.t Asttypes.loc * core_type list
          (*
          • c
          • ['a1, ..., 'an] c
          *)
        2. | Pcty_signature of class_signature
          (*

          object ... end

          *)
        3. | Pcty_arrow of Asttypes.arg_label * core_type * class_type
          (*

          Pcty_arrow(lbl, T, CT) represents:

          *)
        4. | Pcty_extension of extension
          (*

          %id

          *)
        5. | Pcty_open of open_description * class_type
          (*

          let open M in CT

          *)
        and class_signature = {
        1. pcsig_self : core_type;
        2. pcsig_fields : class_type_field list;
        }

        Values of type class_signature represents:

        and class_type_field = {
        1. pctf_desc : class_type_field_desc;
        2. pctf_loc : Location.t;
        3. pctf_attributes : attributes;
          (*

          ... [\@\@id1] [\@\@id2]

          *)
        }
        and class_type_field_desc =
        1. | Pctf_inherit of class_type
          (*

          inherit CT

          *)
        2. | Pctf_val of Asttypes.label Asttypes.loc * Asttypes.mutable_flag diff --git a/ocaml/Path/index.html b/ocaml/Path/index.html index 35f59703..186d4fd2 100644 --- a/ocaml/Path/index.html +++ b/ocaml/Path/index.html @@ -1,2 +1,2 @@ -Path (ocaml.Path)

          Module Path

          type t =
          1. | Pident of Ident.t
            (*

            Examples: x, List, int

            *)
          2. | Pdot of t * string
            (*

            Examples: List.map, Float.Array

            *)
          3. | Papply of t * t
            (*

            Examples: Set.Make(Int), Map.Make(Set.Make(Int))

            *)
          4. | Pextra_ty of t * extra_ty
            (*

            Pextra_ty (p, extra) are additional paths of types introduced by specific OCaml constructs. See below.

            *)
          and extra_ty =
          1. | Pcstr_ty of string
            (*

            Pextra_ty (p, Pcstr_ty c) is the type of the inline record for constructor c inside type p.

            For example, in

            type 'a t = Nil | Cons of {hd : 'a; tl : 'a t}

            The inline record type {hd : 'a; tl : 'a t} cannot be named by the user in the surface syntax, but internally it has the path Pextra_ty (Pident `t`, Pcstr_ty "Cons").

            *)
          2. | Pext_ty
            (*

            Pextra_ty (p, Pext_ty) is the type of the inline record for the extension constructor p.

            For example, in

            type exn += Error of {loc : loc; msg : string}

            The inline record type {loc : loc; msg : string} cannot be named by the user in the surface syntax, but internally it has the path Pextra_ty (Pident `Error`, Pext_ty).

            *)
          val same : t -> t -> bool
          val compare : t -> t -> int
          val compare_extra : extra_ty -> extra_ty -> int
          val find_free_opt : Ident.t list -> t -> Ident.t option
          val exists_free : Ident.t list -> t -> bool
          val scope : t -> int
          val flatten : t -> [ `Contains_apply | `Ok of Ident.t * string list ]
          val name : ?paren:(string -> bool) -> t -> string
          val head : t -> Ident.t
          val print : Stdlib.Format.formatter -> t -> unit
          val heads : t -> Ident.t list
          val last : t -> string
          val is_constructor_typath : t -> bool
          module Map : Map.S with type key = t
          module Set : Set.S with type elt = t
          +Path (ocaml.Path)

          Module Path

          type t =
          1. | Pident of Ident.t
            (*

            Examples: x, List, int

            *)
          2. | Pdot of t * string
            (*

            Examples: List.map, Float.Array

            *)
          3. | Papply of t * t
            (*

            Examples: Set.Make(Int), Map.Make(Set.Make(Int))

            *)
          4. | Pextra_ty of t * extra_ty
            (*

            Pextra_ty (p, extra) are additional paths of types introduced by specific OCaml constructs. See below.

            *)
          and extra_ty =
          1. | Pcstr_ty of string
            (*

            Pextra_ty (p, Pcstr_ty c) is the type of the inline record for constructor c inside type p.

            For example, in

            type 'a t = Nil | Cons of {hd : 'a; tl : 'a t}

            The inline record type {hd : 'a; tl : 'a t} cannot be named by the user in the surface syntax, but internally it has the path Pextra_ty (Pident `t`, Pcstr_ty "Cons").

            *)
          2. | Pext_ty
            (*

            Pextra_ty (p, Pext_ty) is the type of the inline record for the extension constructor p.

            For example, in

            type exn += Error of {loc : loc; msg : string}

            The inline record type {loc : loc; msg : string} cannot be named by the user in the surface syntax, but internally it has the path Pextra_ty (Pident `Error`, Pext_ty).

            *)
          val same : t -> t -> bool
          val compare : t -> t -> int
          val compare_extra : extra_ty -> extra_ty -> int
          val find_free_opt : Ident.t list -> t -> Ident.t option
          val exists_free : Ident.t list -> t -> bool
          val scope : t -> int
          val flatten : t -> [ `Contains_apply | `Ok of Ident.t * string list ]
          val name : ?paren:(string -> bool) -> t -> string
          val head : t -> Ident.t
          val print : t Format_doc.printer
          val heads : t -> Ident.t list
          val last : t -> string
          val is_constructor_typath : t -> bool
          module Map : Map.S with type key = t
          module Set : Set.S with type elt = t
          diff --git a/ocaml/Patterns/General/index.html b/ocaml/Patterns/General/index.html index 79e9df73..565722e2 100644 --- a/ocaml/Patterns/General/index.html +++ b/ocaml/Patterns/General/index.html @@ -1,2 +1,2 @@ -General (ocaml.Patterns.General)

          Module Patterns.General

          type view = [
          1. | Half_simple.view
          2. | `Var of Ident.t * string Asttypes.loc
          3. | `Alias of Typedtree.pattern * Ident.t * string Asttypes.loc
          ]
          val strip_vars : pattern -> Half_simple.pattern
          +General (ocaml.Patterns.General)

          Module Patterns.General

          type view = [
          1. | Half_simple.view
          2. | `Var of Ident.t * string Asttypes.loc * Types.Uid.t
          3. | `Alias of Typedtree.pattern * Ident.t * string Asttypes.loc * Types.Uid.t
          ]
          val strip_vars : pattern -> Half_simple.pattern
          diff --git a/ocaml/Persistent_env/Persistent_signature/index.html b/ocaml/Persistent_env/Persistent_signature/index.html index 69af4297..5fba65a1 100644 --- a/ocaml/Persistent_env/Persistent_signature/index.html +++ b/ocaml/Persistent_env/Persistent_signature/index.html @@ -1,2 +1,2 @@ -Persistent_signature (ocaml.Persistent_env.Persistent_signature)

          Module Persistent_env.Persistent_signature

          type t = {
          1. filename : string;
            (*

            Name of the file containing the signature.

            *)
          2. cmi : Cmi_format.cmi_infos;
          }
          val load : (unit_name:string -> t option) ref

          Function used to load a persistent signature. The default is to look for the .cmi file in the load path. This function can be overridden to load it from memory, for instance to build a self-contained toplevel.

          +Persistent_signature (ocaml.Persistent_env.Persistent_signature)

          Module Persistent_env.Persistent_signature

          type t = {
          1. filename : string;
            (*

            Name of the file containing the signature.

            *)
          2. cmi : Cmi_format.cmi_infos;
          3. visibility : Load_path.visibility;
          }
          val load : (allow_hidden:bool -> unit_name:string -> t option) ref

          Function used to load a persistent signature. The default is to look for the .cmi file in the load path. This function can be overridden to load it from memory, for instance to build a self-contained toplevel.

          diff --git a/ocaml/Persistent_env/index.html b/ocaml/Persistent_env/index.html index 76bbdf08..005d7f45 100644 --- a/ocaml/Persistent_env/index.html +++ b/ocaml/Persistent_env/index.html @@ -1,11 +1,12 @@ Persistent_env (ocaml.Persistent_env)

          Module Persistent_env

          module Consistbl : - module type of struct include Consistbl.Make(Misc.Stdlib.String) end
          type error =
          1. | Illegal_renaming of Misc.modname * Misc.modname * Misc.filepath
          2. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
          3. | Need_recursive_types of Misc.modname
          exception Error of error
          val report_error : Stdlib.Format.formatter -> error -> unit
          module Persistent_signature : sig ... end
          type can_load_cmis =
          1. | Can_load_cmis
          2. | Cannot_load_cmis of Lazy_backtrack.log
          type 'a t
          val empty : unit -> 'a t
          val clear : 'a t -> unit
          val clear_missing : 'a t -> unit
          val fold : 'a t -> (Misc.modname -> 'a -> 'b -> 'b) -> 'b -> 'b
          val read : + module type of struct include Consistbl.Make(Misc.Stdlib.String) end
          type error =
          1. | Illegal_renaming of Misc.modname * Misc.modname * Misc.filepath
          2. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
          3. | Need_recursive_types of Misc.modname
          exception Error of error
          val report_error : error Format_doc.format_printer
          val report_error_doc : error Format_doc.printer
          module Persistent_signature : sig ... end
          type can_load_cmis =
          1. | Can_load_cmis
          2. | Cannot_load_cmis of Lazy_backtrack.log
          type 'a t
          val empty : unit -> 'a t
          val clear : 'a t -> unit
          val clear_missing : 'a t -> unit
          val fold : 'a t -> (Misc.modname -> 'a -> 'b -> 'b) -> 'b -> 'b
          val read : 'a t -> (Persistent_signature.t -> 'a) -> Unit_info.Artifact.t -> 'a
          val find : + allow_hidden:bool -> 'a t -> (Persistent_signature.t -> 'a) -> Misc.modname -> - Misc.filepath -> - 'a
          val find : 'a t -> (Persistent_signature.t -> 'a) -> Misc.modname -> 'a
          val find_in_cache : 'a t -> Misc.modname -> 'a option
          val check : + 'a
          val find_in_cache : 'a t -> Misc.modname -> 'a option
          val check : + allow_hidden:bool -> 'a t -> (Persistent_signature.t -> 'a) -> loc:Location.t -> diff --git a/ocaml/Pparse/index.html b/ocaml/Pparse/index.html index 28239f5f..d712e0b8 100644 --- a/ocaml/Pparse/index.html +++ b/ocaml/Pparse/index.html @@ -17,4 +17,4 @@ ?restore:bool -> tool_name:string -> Parsetree.signature -> - Parsetree.signature
          val report_error : Stdlib.Format.formatter -> error -> unit
          val parse_implementation : tool_name:string -> string -> Parsetree.structure
          val parse_interface : tool_name:string -> string -> Parsetree.signature
          val call_external_preprocessor : string -> string -> string
          val open_and_check_magic : string -> string -> in_channel * bool
          + Parsetree.signature
        val report_error : error Format_doc.format_printer
        val report_error_doc : error Format_doc.printer
        val parse_implementation : tool_name:string -> string -> Parsetree.structure
        val parse_interface : tool_name:string -> string -> Parsetree.signature
        val call_external_preprocessor : string -> string -> string
        val open_and_check_magic : string -> string -> in_channel * bool
        diff --git a/ocaml/Pprintast/Doc/index.html b/ocaml/Pprintast/Doc/index.html new file mode 100644 index 00000000..21391240 --- /dev/null +++ b/ocaml/Pprintast/Doc/index.html @@ -0,0 +1,2 @@ + +Doc (ocaml.Pprintast.Doc)

        Module Pprintast.Doc

        Format_doc functions for error messages

        val tyvar : string Format_doc.printer
        val nominal_exp : Parsetree.expression -> Format_doc.t option

        Returns a format document if the expression reads nicely as the subject of a sentence in a error message.

        diff --git a/ocaml/Pprintast/index.html b/ocaml/Pprintast/index.html index 9d82ebbe..8feee91f 100644 --- a/ocaml/Pprintast/index.html +++ b/ocaml/Pprintast/index.html @@ -1,5 +1,5 @@ -Pprintast (ocaml.Pprintast)

        Module Pprintast

        Pretty-printers for Parsetree

        Warning: this module is unstable and part of compiler-libs.

        type space_formatter = (unit, Stdlib.Format.formatter, unit) format
        val longident : Stdlib.Format.formatter -> Longident.t -> unit
        val expression : Stdlib.Format.formatter -> Parsetree.expression -> unit
        val string_of_expression : Parsetree.expression -> string
        val core_type : Stdlib.Format.formatter -> Parsetree.core_type -> unit
        val signature : Stdlib.Format.formatter -> Parsetree.signature -> unit
        val structure : Stdlib.Format.formatter -> Parsetree.structure -> unit
        val string_of_structure : Parsetree.structure -> string
        val module_expr : Stdlib.Format.formatter -> Parsetree.module_expr -> unit
        val toplevel_phrase : +Pprintast (ocaml.Pprintast)

        Module Pprintast

        Pretty-printers for Parsetree

        Warning: this module is unstable and part of compiler-libs.

        type space_formatter = (unit, Stdlib.Format.formatter, unit) format
        val longident : Stdlib.Format.formatter -> Longident.t -> unit
        val constr : Stdlib.Format.formatter -> Longident.t -> unit
        val expression : Stdlib.Format.formatter -> Parsetree.expression -> unit
        val string_of_expression : Parsetree.expression -> string
        val core_type : Stdlib.Format.formatter -> Parsetree.core_type -> unit
        val signature : Stdlib.Format.formatter -> Parsetree.signature -> unit
        val structure : Stdlib.Format.formatter -> Parsetree.structure -> unit
        val string_of_structure : Parsetree.structure -> string
        val module_expr : Stdlib.Format.formatter -> Parsetree.module_expr -> unit
        val toplevel_phrase : Stdlib.Format.formatter -> Parsetree.toplevel_phrase -> unit
        val class_field : Stdlib.Format.formatter -> Parsetree.class_field -> unit
        val class_type_field : @@ -11,4 +11,4 @@ unit
        val signature_item : Stdlib.Format.formatter -> Parsetree.signature_item -> - unit
        val tyvar : Stdlib.Format.formatter -> string -> unit

        Print a type variable name, taking care of the special treatment required for the single quote character in second position.

        + unit
        val tyvar_of_name : string -> string

        Turn a type variable name into a valid identifier, taking care of the special treatment required for the single quote character in second position, or for keywords by escaping them with \#. No-op on "_".

        val tyvar : Stdlib.Format.formatter -> string -> unit

        Print a type variable name as a valid identifier, taking care of the special treatment required for the single quote character in second position, or for keywords by escaping them with \#. No-op on "_".

        module Doc : sig ... end

        Format_doc functions for error messages

        diff --git a/ocaml/Predef/index.html b/ocaml/Predef/index.html index 01a3cffd..9660c127 100644 --- a/ocaml/Predef/index.html +++ b/ocaml/Predef/index.html @@ -1,5 +1,5 @@ -Predef (ocaml.Predef)

        Module Predef

        val type_int : Types.type_expr
        val type_char : Types.type_expr
        val type_string : Types.type_expr
        val type_bytes : Types.type_expr
        val type_float : Types.type_expr
        val type_bool : Types.type_expr
        val type_unit : Types.type_expr
        val type_exn : Types.type_expr
        val type_array : Types.type_expr -> Types.type_expr
        val type_list : Types.type_expr -> Types.type_expr
        val type_option : Types.type_expr -> Types.type_expr
        val type_nativeint : Types.type_expr
        val type_int32 : Types.type_expr
        val type_int64 : Types.type_expr
        val type_lazy_t : Types.type_expr -> Types.type_expr
        val type_extension_constructor : Types.type_expr
        val type_floatarray : Types.type_expr
        val path_int : Path.t
        val path_char : Path.t
        val path_string : Path.t
        val path_bytes : Path.t
        val path_float : Path.t
        val path_bool : Path.t
        val path_unit : Path.t
        val path_exn : Path.t
        val path_array : Path.t
        val path_list : Path.t
        val path_option : Path.t
        val path_nativeint : Path.t
        val path_int32 : Path.t
        val path_int64 : Path.t
        val path_lazy_t : Path.t
        val path_extension_constructor : Path.t
        val path_floatarray : Path.t
        val path_match_failure : Path.t
        val path_assert_failure : Path.t
        val path_undefined_recursive_module : Path.t
        val ident_false : Ident.t
        val ident_true : Ident.t
        val ident_void : Ident.t
        val ident_nil : Ident.t
        val ident_cons : Ident.t
        val ident_none : Ident.t
        val ident_some : Ident.t
        val build_initial_env : +Predef (ocaml.Predef)

        Module Predef

        val type_int : Types.type_expr
        val type_char : Types.type_expr
        val type_string : Types.type_expr
        val type_bytes : Types.type_expr
        val type_float : Types.type_expr
        val type_bool : Types.type_expr
        val type_unit : Types.type_expr
        val type_exn : Types.type_expr
        val type_continuation : Types.type_expr -> Types.type_expr -> Types.type_expr
        val type_array : Types.type_expr -> Types.type_expr
        val type_list : Types.type_expr -> Types.type_expr
        val type_option : Types.type_expr -> Types.type_expr
        val type_nativeint : Types.type_expr
        val type_int32 : Types.type_expr
        val type_int64 : Types.type_expr
        val type_lazy_t : Types.type_expr -> Types.type_expr
        val type_extension_constructor : Types.type_expr
        val type_floatarray : Types.type_expr
        val path_int : Path.t
        val path_char : Path.t
        val path_string : Path.t
        val path_bytes : Path.t
        val path_float : Path.t
        val path_bool : Path.t
        val path_unit : Path.t
        val path_exn : Path.t
        val path_eff : Path.t
        val path_array : Path.t
        val path_list : Path.t
        val path_option : Path.t
        val path_nativeint : Path.t
        val path_int32 : Path.t
        val path_int64 : Path.t
        val path_lazy_t : Path.t
        val path_extension_constructor : Path.t
        val path_floatarray : Path.t
        val path_continuation : Path.t
        val path_match_failure : Path.t
        val path_assert_failure : Path.t
        val path_undefined_recursive_module : Path.t
        val ident_false : Ident.t
        val ident_true : Ident.t
        val ident_void : Ident.t
        val ident_nil : Ident.t
        val ident_cons : Ident.t
        val ident_none : Ident.t
        val ident_some : Ident.t
        val build_initial_env : (Ident.t -> Types.type_declaration -> 'a -> 'a) -> (Ident.t -> Types.extension_constructor -> 'a -> 'a) -> 'a -> diff --git a/ocaml/Primitive/index.html b/ocaml/Primitive/index.html index 1ba985bd..eeb6a411 100644 --- a/ocaml/Primitive/index.html +++ b/ocaml/Primitive/index.html @@ -1,5 +1,5 @@ -Primitive (ocaml.Primitive)

        Module Primitive

        type boxed_integer =
        1. | Pnativeint
        2. | Pint32
        3. | Pint64
        type native_repr =
        1. | Same_as_ocaml_repr
        2. | Unboxed_float
        3. | Unboxed_integer of boxed_integer
        4. | Untagged_int
        type description = private {
        1. prim_name : string;
        2. prim_arity : int;
        3. prim_alloc : bool;
        4. prim_native_name : string;
        5. prim_native_repr_args : native_repr list;
        6. prim_native_repr_res : native_repr;
        }
        val simple : name:string -> arity:int -> alloc:bool -> description
        val make : +Primitive (ocaml.Primitive)

        Module Primitive

        type boxed_integer =
        1. | Pnativeint
        2. | Pint32
        3. | Pint64
        type native_repr =
        1. | Same_as_ocaml_repr
        2. | Unboxed_float
        3. | Unboxed_integer of boxed_integer
        4. | Untagged_immediate
        type description = private {
        1. prim_name : string;
        2. prim_arity : int;
        3. prim_alloc : bool;
        4. prim_native_name : string;
        5. prim_native_repr_args : native_repr list;
        6. prim_native_repr_res : native_repr;
        }
        val simple : name:string -> arity:int -> alloc:bool -> description
        val make : name:string -> alloc:bool -> native_name:string -> diff --git a/ocaml/Printpat/Compat/index.html b/ocaml/Printpat/Compat/index.html new file mode 100644 index 00000000..db9d0c19 --- /dev/null +++ b/ocaml/Printpat/Compat/index.html @@ -0,0 +1,11 @@ + +Compat (ocaml.Printpat.Compat)

        Module Printpat.Compat

        val pretty_pat : + Stdlib.Format.formatter -> + 'k Typedtree.general_pattern -> + unit
        val pretty_line : + Stdlib.Format.formatter -> + 'k Typedtree.general_pattern list -> + unit
        val pretty_matrix : + Stdlib.Format.formatter -> + 'k Typedtree.general_pattern list list -> + unit
        diff --git a/ocaml/Printpat/index.html b/ocaml/Printpat/index.html index 2c4172ab..47fa01e7 100644 --- a/ocaml/Printpat/index.html +++ b/ocaml/Printpat/index.html @@ -1,11 +1,2 @@ -Printpat (ocaml.Printpat)

        Module Printpat

        val pretty_const : Asttypes.constant -> string
        val top_pretty : - Stdlib.Format.formatter -> - 'k Typedtree.general_pattern -> - unit
        val pretty_pat : 'k Typedtree.general_pattern -> unit
        val pretty_line : - Stdlib.Format.formatter -> - 'k Typedtree.general_pattern list -> - unit
        val pretty_matrix : - Stdlib.Format.formatter -> - 'k Typedtree.general_pattern list list -> - unit
        +Printpat (ocaml.Printpat)

        Module Printpat

        val pretty_const : Asttypes.constant -> string
        module Compat : sig ... end
        diff --git a/ocaml/Printtyp/Conflicts/index.html b/ocaml/Printtyp/Conflicts/index.html deleted file mode 100644 index f48c5024..00000000 --- a/ocaml/Printtyp/Conflicts/index.html +++ /dev/null @@ -1,5 +0,0 @@ - -Conflicts (ocaml.Printtyp.Conflicts)

        Module Printtyp.Conflicts

        The Conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

        val exists : unit -> bool

        exists() returns true if the current naming context renamed an identifier to avoid a name collision

        type explanation = {
        1. kind : Shape.Sig_component_kind.t;
        2. name : string;
        3. root_name : string;
        4. location : Location.t;
        }
        val list_explanations : unit -> explanation list

        list_explanations() return the list of conflict explanations collected up to this point, and reset the list of collected explanations

        val print_located_explanations : - Stdlib.Format.formatter -> - explanation list -> - unit
        val print_explanations : Stdlib.Format.formatter -> unit

        Print all conflict explanations collected up to this point

        val reset : unit -> unit
        diff --git a/ocaml/Printtyp/Doc/index.html b/ocaml/Printtyp/Doc/index.html new file mode 100644 index 00000000..89478e83 --- /dev/null +++ b/ocaml/Printtyp/Doc/index.html @@ -0,0 +1,12 @@ + +Doc (ocaml.Printtyp.Doc)

        Module Printtyp.Doc

        val wrap_printing_env : error:bool -> Env.t -> (unit -> 'a) -> 'a

        Call the function using the environment for type path shortening This affects all the printing functions below Also, if ~error:true, then disable the loading of cmis

        val type_path : Path.t Format_doc.printer

        Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.

        Print out a type. This will pick names for type variables, and will not reuse names for common type variables shared across multiple type expressions. (It will also reset the printing state, which matters for other type formatters such as prepared_type_expr.) If you want multiple types to use common names for type variables, see Out_type.prepare_for_printing and Out_type.prepared_type_expr.

        val shared_type_scheme : Types.type_expr Format_doc.printer

        shared_type_scheme is very similar to type_scheme, but does not reset the printing context first. This is intended to be used in cases where the printing should have a particularly wide context, such as documentation generators; most use cases, such as error messages, have narrower contexts for which type_scheme is better suited.

        val extension_constructor : + Ident.t -> + Types.extension_constructor Format_doc.printer

        Prints extension constructor with the type signature: type ('a, 'b) bar += A of float

        val extension_only_constructor : + Ident.t -> + Types.extension_constructor Format_doc.printer

        Prints only extension constructor without type signature: A of float

        val modtype_declaration : + Ident.t -> + Types.modtype_declaration Format_doc.printer
        diff --git a/ocaml/Printtyp/Naming_context/index.html b/ocaml/Printtyp/Naming_context/index.html deleted file mode 100644 index b85ef84f..00000000 --- a/ocaml/Printtyp/Naming_context/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Naming_context (ocaml.Printtyp.Naming_context)

        Module Printtyp.Naming_context

        val enable : bool -> unit

        When contextual names are enabled, the mapping between identifiers and names is ensured to be one-to-one.

        diff --git a/ocaml/Printtyp/Out_name/index.html b/ocaml/Printtyp/Out_name/index.html deleted file mode 100644 index bc2b5ece..00000000 --- a/ocaml/Printtyp/Out_name/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Out_name (ocaml.Printtyp.Out_name)

        Module Printtyp.Out_name

        val create : string -> Outcometree.out_name
        val print : Outcometree.out_name -> string
        diff --git a/ocaml/Printtyp/Subtype/index.html b/ocaml/Printtyp/Subtype/index.html deleted file mode 100644 index 79c21906..00000000 --- a/ocaml/Printtyp/Subtype/index.html +++ /dev/null @@ -1,7 +0,0 @@ - -Subtype (ocaml.Printtyp.Subtype)

        Module Printtyp.Subtype

        val report_error : - Stdlib.Format.formatter -> - Env.t -> - Errortrace.Subtype.error -> - string -> - unit
        diff --git a/ocaml/Printtyp/index.html b/ocaml/Printtyp/index.html index 658ada66..b40dcf6a 100644 --- a/ocaml/Printtyp/index.html +++ b/ocaml/Printtyp/index.html @@ -1,132 +1,23 @@ -Printtyp (ocaml.Printtyp)

        Module Printtyp

        val longident : Stdlib.Format.formatter -> Longident.t -> unit
        val ident : Stdlib.Format.formatter -> Ident.t -> unit
        val namespaced_ident : Shape.Sig_component_kind.t -> Ident.t -> string
        val tree_of_path : Path.t -> Outcometree.out_ident
        val path : Stdlib.Format.formatter -> Path.t -> unit
        val string_of_path : Path.t -> string
        val type_path : Stdlib.Format.formatter -> Path.t -> unit

        Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.

        module Out_name : sig ... end
        type namespace := Shape.Sig_component_kind.t option
        val strings_of_paths : namespace -> Path.t list -> string list

        Print a list of paths, using the same naming context to avoid name collisions

        val raw_type_expr : Stdlib.Format.formatter -> Types.type_expr -> unit
        val string_of_label : Asttypes.arg_label -> string
        val wrap_printing_env : error:bool -> Env.t -> (unit -> 'a) -> 'a
        module Naming_context : sig ... end
        module Conflicts : sig ... end

        The Conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

        val reset : unit -> unit
        val type_expr : Stdlib.Format.formatter -> Types.type_expr -> unit

        Print out a type. This will pick names for type variables, and will not reuse names for common type variables shared across multiple type expressions. (It will also reset the printing state, which matters for other type formatters such as prepared_type_expr.) If you want multiple types to use common names for type variables, see prepare_for_printing and prepared_type_expr.

        val prepare_for_printing : Types.type_expr list -> unit

        prepare_for_printing resets the global printing environment, a la reset, and prepares the types for printing by reserving names and marking loops. Any type variables that are shared between multiple types in the input list will be given the same name when printed with prepared_type_expr.

        val add_type_to_preparation : Types.type_expr -> unit

        add_type_to_preparation ty extend a previous type expression preparation to the type expression ty

        val prepared_type_expr : Stdlib.Format.formatter -> Types.type_expr -> unit

        The function prepared_type_expr is a less-safe but more-flexible version of type_expr that should only be called on type_exprs that have been passed to prepare_for_printing. Unlike type_expr, this function does no extra work before printing a type; in particular, this means that any loops in the type expression may cause a stack overflow (see #8860) since this function does not mark any loops. The benefit of this is that if multiple type expressions are prepared simultaneously and then printed with prepared_type_expr, they will use the same names for the same type variables.

        val constructor_arguments : - Stdlib.Format.formatter -> - Types.constructor_arguments -> - unit
        val tree_of_type_scheme : Types.type_expr -> Outcometree.out_type
        val type_scheme : Stdlib.Format.formatter -> Types.type_expr -> unit
        val prepared_type_scheme : Stdlib.Format.formatter -> Types.type_expr -> unit
        val shared_type_scheme : Stdlib.Format.formatter -> Types.type_expr -> unit

        shared_type_scheme is very similar to type_scheme, but does not reset the printing context first. This is intended to be used in cases where the printing should have a particularly wide context, such as documentation generators; most use cases, such as error messages, have narrower contexts for which type_scheme is better suited.

        val tree_of_value_description : - Ident.t -> - Types.value_description -> - Outcometree.out_sig_item
        val value_description : - Ident.t -> - Stdlib.Format.formatter -> - Types.value_description -> - unit
        val add_constructor_to_preparation : Types.constructor_declaration -> unit
        val prepared_constructor : - Stdlib.Format.formatter -> - Types.constructor_declaration -> - unit
        val constructor : - Stdlib.Format.formatter -> - Types.constructor_declaration -> - unit
        val tree_of_type_declaration : - Ident.t -> - Types.type_declaration -> - Types.rec_status -> - Outcometree.out_sig_item
        val add_type_declaration_to_preparation : - Ident.t -> - Types.type_declaration -> - unit
        val prepared_type_declaration : - Ident.t -> - Stdlib.Format.formatter -> - Types.type_declaration -> - unit
        val type_declaration : - Ident.t -> - Stdlib.Format.formatter -> - Types.type_declaration -> - unit
        val tree_of_extension_constructor : - Ident.t -> - Types.extension_constructor -> - Types.ext_status -> - Outcometree.out_sig_item
        val add_extension_constructor_to_preparation : - Types.extension_constructor -> - unit
        val prepared_extension_constructor : - Ident.t -> - Stdlib.Format.formatter -> - Types.extension_constructor -> - unit
        val extension_constructor : - Ident.t -> - Stdlib.Format.formatter -> - Types.extension_constructor -> - unit
        val extension_only_constructor : - Ident.t -> - Stdlib.Format.formatter -> - Types.extension_constructor -> - unit
        val tree_of_module : - Ident.t -> - ?ellipsis:bool -> - Types.module_type -> - Types.rec_status -> - Outcometree.out_sig_item
        val signature : Stdlib.Format.formatter -> Types.signature -> unit
        val tree_of_modtype_declaration : - Ident.t -> - Types.modtype_declaration -> - Outcometree.out_sig_item
        val functor_parameters : - sep:(Stdlib.Format.formatter -> unit -> unit) -> - ('b -> Stdlib.Format.formatter -> unit) -> - (Ident.t option * 'b) list -> - Stdlib.Format.formatter -> - unit

        Print a list of functor parameters while adjusting the printing environment for each functor argument.

        Currently, we are disabling disambiguation for functor argument name to avoid the need to track the moving association between identifiers and syntactic names in situation like:

        got: (X: sig module type T end) (Y:X.T) (X:sig module type T end) (Z:X.T) expect: (_: sig end) (Y:X.T) (_:sig end) (Z:X.T)

        type type_or_scheme =
        1. | Type
        2. | Type_scheme
        val tree_of_signature : Types.signature -> Outcometree.out_sig_item list
        val modtype_declaration : - Ident.t -> - Stdlib.Format.formatter -> - Types.modtype_declaration -> - unit
        val class_type : Stdlib.Format.formatter -> Types.class_type -> unit
        val tree_of_class_declaration : - Ident.t -> - Types.class_declaration -> - Types.rec_status -> - Outcometree.out_sig_item
        val class_declaration : - Ident.t -> - Stdlib.Format.formatter -> - Types.class_declaration -> - unit
        val tree_of_cltype_declaration : - Ident.t -> - Types.class_type_declaration -> - Types.rec_status -> - Outcometree.out_sig_item
        val cltype_declaration : - Ident.t -> - Stdlib.Format.formatter -> - Types.class_type_declaration -> - unit
        val type_expansion : - type_or_scheme -> - Stdlib.Format.formatter -> - Errortrace.expanded_type -> - unit
        val report_ambiguous_type_error : - Stdlib.Format.formatter -> - Env.t -> - (Path.t * Path.t) -> - (Path.t * Path.t) list -> - (Stdlib.Format.formatter -> unit) -> - (Stdlib.Format.formatter -> unit) -> - (Stdlib.Format.formatter -> unit) -> - unit
        val report_unification_error : - Stdlib.Format.formatter -> - Env.t -> - Errortrace.unification_error -> - ?type_expected_explanation:(Stdlib.Format.formatter -> unit) -> - (Stdlib.Format.formatter -> unit) -> - (Stdlib.Format.formatter -> unit) -> - unit
        val report_equality_error : - Stdlib.Format.formatter -> - type_or_scheme -> - Env.t -> - Errortrace.equality_error -> - (Stdlib.Format.formatter -> unit) -> - (Stdlib.Format.formatter -> unit) -> - unit
        val report_moregen_error : - Stdlib.Format.formatter -> - type_or_scheme -> - Env.t -> - Errortrace.moregen_error -> - (Stdlib.Format.formatter -> unit) -> - (Stdlib.Format.formatter -> unit) -> - unit
        val report_comparison_error : - Stdlib.Format.formatter -> - type_or_scheme -> - Env.t -> - Errortrace.comparison_error -> - (Stdlib.Format.formatter -> unit) -> - (Stdlib.Format.formatter -> unit) -> - unit
        module Subtype : sig ... end
        val print_items : - (Env.t -> Types.signature_item -> 'a option) -> - Env.t -> - Types.signature_item list -> - (Outcometree.out_sig_item * 'a option) list
        val rewrite_double_underscore_paths : Env.t -> Path.t -> Path.t
        val printed_signature : +Printtyp (ocaml.Printtyp)

        Module Printtyp

        Printing functions

        type namespace := Shape.Sig_component_kind.t
        val namespaced_ident : namespace -> Ident.t -> string
        val string_of_path : Path.t -> string
        val strings_of_paths : namespace -> Path.t list -> string list

        Print a list of paths, using the same naming context to avoid name collisions

        val printed_signature : string -> Stdlib.Format.formatter -> Types.signature -> - unit

        printed_signature sourcefile ppf sg print the signature sg of sourcefile with potential warnings for name collisions

        + unit

        printed_signature sourcefile ppf sg print the signature sg of sourcefile with potential warnings for name collisions

        module type Printers := sig ... end
        module Doc : Printers with type 'a printer := 'a Format_doc.printer

        For compatibility with Format printers

        include Printers with type 'a printer := 'a Format_doc.format_printer
        val wrap_printing_env : error:bool -> Env.t -> (unit -> 'a) -> 'a

        Call the function using the environment for type path shortening This affects all the printing functions below Also, if ~error:true, then disable the loading of cmis

        Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.

        Print out a type. This will pick names for type variables, and will not reuse names for common type variables shared across multiple type expressions. (It will also reset the printing state, which matters for other type formatters such as prepared_type_expr.) If you want multiple types to use common names for type variables, see Out_type.prepare_for_printing and Out_type.prepared_type_expr.

        shared_type_scheme is very similar to type_scheme, but does not reset the printing context first. This is intended to be used in cases where the printing should have a particularly wide context, such as documentation generators; most use cases, such as error messages, have narrower contexts for which type_scheme is better suited.

        Prints extension constructor with the type signature: type ('a, 'b) bar += A of float

        val extension_only_constructor : + Ident.t -> + Types.extension_constructor Format_doc.format_printer

        Prints only extension constructor without type signature: A of float

        diff --git a/ocaml/Printtyp/module-type-Printers/index.html b/ocaml/Printtyp/module-type-Printers/index.html new file mode 100644 index 00000000..50b989ac --- /dev/null +++ b/ocaml/Printtyp/module-type-Printers/index.html @@ -0,0 +1,4 @@ + +Printers (ocaml.Printtyp.Printers)

        Module type Printtyp.Printers

        val wrap_printing_env : error:bool -> Env.t -> (unit -> 'a) -> 'a

        Call the function using the environment for type path shortening This affects all the printing functions below Also, if ~error:true, then disable the loading of cmis

        type 'a printer
        val longident : Longident.t printer
        val ident : Ident.t printer
        val path : Path.t printer
        val type_path : Path.t printer

        Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.

        val type_expr : Types.type_expr printer

        Print out a type. This will pick names for type variables, and will not reuse names for common type variables shared across multiple type expressions. (It will also reset the printing state, which matters for other type formatters such as prepared_type_expr.) If you want multiple types to use common names for type variables, see Out_type.prepare_for_printing and Out_type.prepared_type_expr.

        val type_scheme : Types.type_expr printer
        val shared_type_scheme : Types.type_expr printer

        shared_type_scheme is very similar to type_scheme, but does not reset the printing context first. This is intended to be used in cases where the printing should have a particularly wide context, such as documentation generators; most use cases, such as error messages, have narrower contexts for which type_scheme is better suited.

        val constructor_arguments : Types.constructor_arguments printer
        val extension_constructor : Ident.t -> Types.extension_constructor printer

        Prints extension constructor with the type signature: type ('a, 'b) bar += A of float

        val extension_only_constructor : Ident.t -> Types.extension_constructor printer

        Prints only extension constructor without type signature: A of float

        val value_description : Ident.t -> Types.value_description printer
        val type_declaration : Ident.t -> Types.type_declaration printer
        val modtype_declaration : Ident.t -> Types.modtype_declaration printer
        val class_declaration : Ident.t -> Types.class_declaration printer
        val cltype_declaration : Ident.t -> Types.class_type_declaration printer
        val signature : Types.signature printer
        val class_type : Types.class_type printer
        diff --git a/ocaml/Proc/index.html b/ocaml/Proc/index.html index c52b2397..9236970c 100644 --- a/ocaml/Proc/index.html +++ b/ocaml/Proc/index.html @@ -1,2 +1,2 @@ -Proc (ocaml.Proc)

        Module Proc

        val word_addressed : bool
        val num_register_classes : int
        val register_class : Reg.t -> int
        val num_available_registers : int array
        val first_available_register : int array
        val register_name : int -> string
        val phys_reg : int -> Reg.t
        val rotate_registers : bool
        val loc_arguments : Cmm.machtype -> Reg.t array * int
        val loc_results : Cmm.machtype -> Reg.t array
        val loc_parameters : Cmm.machtype -> Reg.t array
        val loc_external_arguments : Cmm.exttype list -> Reg.t array array * int
        val loc_external_results : Cmm.machtype -> Reg.t array
        val loc_exn_bucket : Reg.t
        val max_arguments_for_tailcalls : int
        val safe_register_pressure : Mach.operation -> int
        val max_register_pressure : Mach.operation -> int array
        val destroyed_at_oper : Mach.instruction_desc -> Reg.t array
        val destroyed_at_raise : Reg.t array
        val destroyed_at_reloadretaddr : Reg.t array
        val frame_required : Mach.fundecl -> bool
        val prologue_required : Mach.fundecl -> bool
        val dwarf_register_numbers : reg_class:int -> int array

        For a given register class, the DWARF register numbering for that class. Given an allocated register with location Reg n and class reg_class, the returned array contains the corresponding DWARF register number at index n - first_available_register.(reg_class).

        val stack_ptr_dwarf_register_number : int

        The DWARF register number corresponding to the stack pointer.

        val assemble_file : string -> string -> int
        val init : unit -> unit
        +Proc (ocaml.Proc)

        Module Proc

        val num_register_classes : int
        val register_class : Reg.t -> int
        val num_available_registers : int array
        val first_available_register : int array
        val register_name : int -> string
        val phys_reg : int -> Reg.t
        val rotate_registers : bool
        val loc_arguments : Cmm.machtype -> Reg.t array * int
        val loc_results : Cmm.machtype -> Reg.t array
        val loc_parameters : Cmm.machtype -> Reg.t array
        val loc_external_arguments : Cmm.exttype list -> Reg.t array array * int
        val loc_external_results : Cmm.machtype -> Reg.t array
        val loc_exn_bucket : Reg.t
        val max_arguments_for_tailcalls : int
        val safe_register_pressure : Mach.operation -> int
        val max_register_pressure : Mach.operation -> int array
        val destroyed_at_oper : Mach.instruction_desc -> Reg.t array
        val destroyed_at_raise : Reg.t array
        val destroyed_at_reloadretaddr : Reg.t array
        val dwarf_register_numbers : reg_class:int -> int array

        For a given register class, the DWARF register numbering for that class. Given an allocated register with location Reg n and class reg_class, the returned array contains the corresponding DWARF register number at index n - first_available_register.(reg_class).

        val stack_ptr_dwarf_register_number : int

        The DWARF register number corresponding to the stack pointer.

        val assemble_file : string -> string -> int
        val init : unit -> unit
        diff --git a/ocaml/Rawprinttyp/index.html b/ocaml/Rawprinttyp/index.html new file mode 100644 index 00000000..8108150e --- /dev/null +++ b/ocaml/Rawprinttyp/index.html @@ -0,0 +1,2 @@ + +Rawprinttyp (ocaml.Rawprinttyp)

        Module Rawprinttyp

        This module provides function(s) for printing the internal representation of type expressions. It is targetted at internal use when debbuging the compiler itself.

        val type_expr : Stdlib.Format.formatter -> Types.type_expr -> unit
        diff --git a/ocaml/Rec_check/index.html b/ocaml/Rec_check/index.html deleted file mode 100644 index fedb7ab6..00000000 --- a/ocaml/Rec_check/index.html +++ /dev/null @@ -1,5 +0,0 @@ - -Rec_check (ocaml.Rec_check)

        Module Rec_check

        exception Illegal_expr
        val is_valid_recursive_expression : - Ident.t list -> - Typedtree.expression -> - bool
        val is_valid_class_expr : Ident.t list -> Typedtree.class_expr -> bool
        diff --git a/ocaml/Runtime_events/Callbacks/index.html b/ocaml/Runtime_events/Callbacks/index.html index 9b3ede21..7d1adfcd 100644 --- a/ocaml/Runtime_events/Callbacks/index.html +++ b/ocaml/Runtime_events/Callbacks/index.html @@ -1,5 +1,5 @@ -Callbacks (ocaml.Runtime_events.Callbacks)

        Module Runtime_events.Callbacks

        type t

        Type of callbacks

        val create : +Callbacks (ocaml.Runtime_events.Callbacks)

        Module Runtime_events.Callbacks

        type t

        Type of callbacks.

        val create : ?runtime_begin:(int -> Timestamp.t -> runtime_phase -> unit) -> ?runtime_end:(int -> Timestamp.t -> runtime_phase -> unit) -> ?runtime_counter:(int -> Timestamp.t -> runtime_counter -> int -> unit) -> diff --git a/ocaml/Runtime_events/Timestamp/index.html b/ocaml/Runtime_events/Timestamp/index.html index 4c9c16d8..65f608bd 100644 --- a/ocaml/Runtime_events/Timestamp/index.html +++ b/ocaml/Runtime_events/Timestamp/index.html @@ -1,2 +1,2 @@ -Timestamp (ocaml.Runtime_events.Timestamp)

        Module Runtime_events.Timestamp

        type t

        Type for the int64 timestamp to allow for future changes

        val to_int64 : t -> int64
        +Timestamp (ocaml.Runtime_events.Timestamp)

        Module Runtime_events.Timestamp

        type t

        Type for the int64 timestamp to allow for future changes.

        val to_int64 : t -> int64
        diff --git a/ocaml/Runtime_events/Type/index.html b/ocaml/Runtime_events/Type/index.html index 2211048c..169920e7 100644 --- a/ocaml/Runtime_events/Type/index.html +++ b/ocaml/Runtime_events/Type/index.html @@ -1,5 +1,5 @@ -Type (ocaml.Runtime_events.Type)

        Module Runtime_events.Type

        type 'a t

        The type for a user event content type

        val unit : unit t

        An event that has no data associated with it

        type span =
        1. | Begin
        2. | End
        val span : span t

        An event that has a beginning and an end

        val int : int t

        An event containing an integer value

        val register : +Type (ocaml.Runtime_events.Type)

        Module Runtime_events.Type

        type 'a t

        The type for a user event content type.

        val unit : unit t

        An event that has no data associated with it.

        type span =
        1. | Begin
        2. | End
        val span : span t

        An event that has a beginning and an end.

        val int : int t

        An event containing an integer value.

        val register : encode:(bytes -> 'a -> int) -> decode:(bytes -> int -> 'a) -> 'a t

        Registers a custom type by providing an encoder and a decoder. The encoder writes the value in the provided buffer and returns the number of bytes written. The decoder gets a slice of the buffer of specified length, and returns the decoded value.

        The maximum value length is 1024 bytes.

        diff --git a/ocaml/Runtime_events/User/index.html b/ocaml/Runtime_events/User/index.html index f970878a..6449d838 100644 --- a/ocaml/Runtime_events/User/index.html +++ b/ocaml/Runtime_events/User/index.html @@ -1,2 +1,2 @@ -User (ocaml.Runtime_events.User)

        Module Runtime_events.User

        User events is a way for libraries to provide runtime events that can be consumed by other tools. These events can carry known data types or custom values. The current maximum number of user events is 8192.

        type tag = ..

        The type for a user event tag. Tags are used to discriminate between user events of the same type

        type 'value t

        The type for a user event. User events describe their tag, carried data type and an unique string-based name

        val register : string -> tag -> 'value Type.t -> 'value t

        register name tag ty registers a new event with an unique name, carrying a tag and values of type ty

        val write : 'value t -> 'value -> unit

        write t v records a new event t with value v

        val name : _ t -> string

        name t is the uniquely identifying name of event t

        val tag : 'a t -> tag

        tag t is the associated tag of event t, when it is known. An event can be unknown if it was not registered in the consumer program.

        +User (ocaml.Runtime_events.User)

        Module Runtime_events.User

        User events is a way for libraries to provide runtime events that can be consumed by other tools. These events can carry known data types or custom values. The current maximum number of user events is 8192.

        type tag = ..

        The type for a user event tag. Tags are used to discriminate between user events of the same type.

        type 'value t

        The type for a user event. User events describe their tag, carried data type and an unique string-based name.

        val register : string -> tag -> 'value Type.t -> 'value t

        register name tag ty registers a new event with an unique name, carrying a tag and values of type ty.

        val write : 'value t -> 'value -> unit

        write t v emits value v for event t.

        val name : _ t -> string

        name t is the unique identifying name of event t.

        val tag : 'a t -> tag

        tag t is the associated tag of event t, when it is known. An event can be unknown if it was not registered in the consumer program.

        diff --git a/ocaml/Runtime_events/index.html b/ocaml/Runtime_events/index.html index fde422ef..1f49be9a 100644 --- a/ocaml/Runtime_events/index.html +++ b/ocaml/Runtime_events/index.html @@ -1,2 +1,2 @@ -Runtime_events (ocaml.Runtime_events)

        Module Runtime_events

        Runtime events - ring buffer-based runtime tracing

        This module enables users to enable and subscribe to tracing events from the Garbage Collector and other parts of the OCaml runtime. This can be useful for diagnostic or performance monitoring purposes. This module can be used to subscribe to events for the current process or external processes asynchronously.

        When enabled (either via setting the OCAML_RUNTIME_EVENTS_START environment variable or calling Runtime_events.start) a file with the pid of the process and extension .events will be created. By default this is in the current directory but can be over-ridden by the OCAML_RUNTIME_EVENTS_DIR environment variable. Each domain maintains its own ring buffer in a section of the larger file into which it emits events.

        There is additionally a set of C APIs in runtime_events.h that can enable zero-impact monitoring of the current process or bindings for other languages.

        The runtime events system's behaviour can be controlled by the following environment variables:

        • OCAML_RUNTIME_EVENTS_START if set will cause the runtime events system to be started as part of the OCaml runtime initialization.
        • OCAML_RUNTIME_EVENTS_DIR sets the directory where the runtime events ring buffers will be located. If not present the program's working directory will be used.
        • OCAML_RUNTIME_EVENTS_PRESERVE if set will prevent the OCaml runtime from removing its ring buffers when it terminates. This can help if monitoring very short running programs.
        type runtime_counter =
        1. | EV_C_FORCE_MINOR_ALLOC_SMALL
        2. | EV_C_FORCE_MINOR_MAKE_VECT
        3. | EV_C_FORCE_MINOR_SET_MINOR_HEAP_SIZE
        4. | EV_C_FORCE_MINOR_MEMPROF
        5. | EV_C_MINOR_PROMOTED
        6. | EV_C_MINOR_ALLOCATED
        7. | EV_C_REQUEST_MAJOR_ALLOC_SHR
        8. | EV_C_REQUEST_MAJOR_ADJUST_GC_SPEED
        9. | EV_C_REQUEST_MINOR_REALLOC_REF_TABLE
        10. | EV_C_REQUEST_MINOR_REALLOC_EPHE_REF_TABLE
        11. | EV_C_REQUEST_MINOR_REALLOC_CUSTOM_TABLE
        12. | EV_C_MAJOR_HEAP_POOL_WORDS
          (*

          Total words in a Domain's major heap pools. This is the sum of unallocated and live words in each pool.

          • since 5.1
          *)
        13. | EV_C_MAJOR_HEAP_POOL_LIVE_WORDS
          (*

          Current live words in a Domain's major heap pools.

          • since 5.1
          *)
        14. | EV_C_MAJOR_HEAP_LARGE_WORDS
          (*

          Total words of a Domain's major heap large allocations. A large allocation is an allocation larger than the largest sized pool.

          • since 5.1
          *)
        15. | EV_C_MAJOR_HEAP_POOL_FRAG_WORDS
          (*

          Words in a Domain's major heap pools lost to fragmentation. This is due to there not being a pool with the exact size of an allocation and a larger sized pool needing to be used.

          • since 5.1
          *)
        16. | EV_C_MAJOR_HEAP_POOL_LIVE_BLOCKS
          (*

          Live blocks of a Domain's major heap pools.

          • since 5.1
          *)
        17. | EV_C_MAJOR_HEAP_LARGE_BLOCKS
          (*

          Live blocks of a Domain's major heap large allocations.

          • since 5.1
          *)

        The type for counter events emitted by the runtime

        type runtime_phase =
        1. | EV_EXPLICIT_GC_SET
        2. | EV_EXPLICIT_GC_STAT
        3. | EV_EXPLICIT_GC_MINOR
        4. | EV_EXPLICIT_GC_MAJOR
        5. | EV_EXPLICIT_GC_FULL_MAJOR
        6. | EV_EXPLICIT_GC_COMPACT
        7. | EV_MAJOR
        8. | EV_MAJOR_SWEEP
        9. | EV_MAJOR_MARK_ROOTS
        10. | EV_MAJOR_MARK
        11. | EV_MINOR
        12. | EV_MINOR_LOCAL_ROOTS
        13. | EV_MINOR_FINALIZED
        14. | EV_EXPLICIT_GC_MAJOR_SLICE
        15. | EV_FINALISE_UPDATE_FIRST
        16. | EV_FINALISE_UPDATE_LAST
        17. | EV_INTERRUPT_REMOTE
        18. | EV_MAJOR_EPHE_MARK
        19. | EV_MAJOR_EPHE_SWEEP
        20. | EV_MAJOR_FINISH_MARKING
        21. | EV_MAJOR_GC_CYCLE_DOMAINS
        22. | EV_MAJOR_GC_PHASE_CHANGE
        23. | EV_MAJOR_GC_STW
        24. | EV_MAJOR_MARK_OPPORTUNISTIC
        25. | EV_MAJOR_SLICE
        26. | EV_MAJOR_FINISH_CYCLE
        27. | EV_MINOR_CLEAR
        28. | EV_MINOR_FINALIZERS_OLDIFY
        29. | EV_MINOR_GLOBAL_ROOTS
        30. | EV_MINOR_LEAVE_BARRIER
        31. | EV_STW_API_BARRIER
        32. | EV_STW_HANDLER
        33. | EV_STW_LEADER
        34. | EV_MAJOR_FINISH_SWEEPING
        35. | EV_MINOR_FINALIZERS_ADMIN
        36. | EV_MINOR_REMEMBERED_SET
        37. | EV_MINOR_REMEMBERED_SET_PROMOTE
        38. | EV_MINOR_LOCAL_ROOTS_PROMOTE
        39. | EV_DOMAIN_CONDITION_WAIT
        40. | EV_DOMAIN_RESIZE_HEAP_RESERVATION

        The type for span events emitted by the runtime

        type lifecycle =
        1. | EV_RING_START
        2. | EV_RING_STOP
        3. | EV_RING_PAUSE
        4. | EV_RING_RESUME
        5. | EV_FORK_PARENT
        6. | EV_FORK_CHILD
        7. | EV_DOMAIN_SPAWN
        8. | EV_DOMAIN_TERMINATE

        Lifecycle events for the ring itself

        val lifecycle_name : lifecycle -> string

        Return a string representation of a given lifecycle event type

        val runtime_phase_name : runtime_phase -> string

        Return a string representation of a given runtime phase event type

        val runtime_counter_name : runtime_counter -> string

        Return a string representation of a given runtime counter type

        type cursor

        Type of the cursor used when consuming

        module Timestamp : sig ... end
        module Type : sig ... end
        module User : sig ... end

        User events is a way for libraries to provide runtime events that can be consumed by other tools. These events can carry known data types or custom values. The current maximum number of user events is 8192.

        module Callbacks : sig ... end
        val start : unit -> unit

        start () will start the collection of events in the runtime if not already started.

        Events can be consumed by creating a cursor with create_cursor and providing a set of callbacks to be called for each type of event.

        val pause : unit -> unit

        pause () will pause the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

        val resume : unit -> unit

        resume () will resume the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

        val create_cursor : (string * int) option -> cursor

        create_cursor path_pid creates a cursor to read from an runtime_events. Cursors can be created for runtime_events in and out of process. A runtime_events ring-buffer may have multiple cursors reading from it at any point in time and a program may have multiple cursors open concurrently (for example if multiple consumers want different sets of events). If path_pid is None then a cursor is created for the current process. Otherwise the pair contains a string path to the directory that contains the pid.events file and int pid for the runtime_events of an external process to monitor.

        val free_cursor : cursor -> unit

        Free a previously created runtime_events cursor

        val read_poll : cursor -> Callbacks.t -> int option -> int

        read_poll cursor callbacks max_option calls the corresponding functions on callbacks for up to max_option events read off cursor's runtime_events and returns the number of events read.

        +Runtime_events (ocaml.Runtime_events)

        Module Runtime_events

        Runtime events - ring buffer-based runtime tracing

        This module enables users to enable and subscribe to tracing events from the Garbage Collector and other parts of the OCaml runtime. This can be useful for diagnostic or performance monitoring purposes. This module can be used to subscribe to events for the current process or external processes asynchronously.

        When enabled (either via setting the OCAML_RUNTIME_EVENTS_START environment variable or calling Runtime_events.start) a file with the pid of the process and extension .events will be created. By default this is in the current directory but can be over-ridden by the OCAML_RUNTIME_EVENTS_DIR environment variable. Each domain maintains its own ring buffer in a section of the larger file into which it emits events.

        There is additionally a set of C APIs in runtime_events.h that can enable zero-impact monitoring of the current process or bindings for other languages.

        The runtime events system's behaviour can be controlled by the following environment variables:

        • OCAML_RUNTIME_EVENTS_START if set will cause the runtime events system to be started as part of the OCaml runtime initialization.
        • OCAML_RUNTIME_EVENTS_DIR sets the directory where the runtime events ring buffers will be located. If not present the program's working directory will be used.
        • OCAML_RUNTIME_EVENTS_PRESERVE if set will prevent the OCaml runtime from removing its ring buffers when it terminates. This can help if monitoring very short running programs.
        type runtime_counter =
        1. | EV_C_FORCE_MINOR_ALLOC_SMALL
          (*

          Triggering of a minor collection due to a full minor heap.

          • since 5.0
          *)
        2. | EV_C_FORCE_MINOR_MAKE_VECT
          (*

          Triggering of a minor collection due to Array.make.

          • since 5.0
          *)
        3. | EV_C_FORCE_MINOR_SET_MINOR_HEAP_SIZE
          (*

          Triggering of a minor collection due to Gc.minor_heap_size.

          • since 5.0
          *)
        4. | EV_C_FORCE_MINOR_MEMPROF
          (*

          Triggering of a minor collection during memprof young sampling.

          • since 5.3
          *)
        5. | EV_C_MINOR_PROMOTED
          (*

          Total words promoted from the minor heap to the major in the last minor collection.

          • since 5.0
          *)
        6. | EV_C_MINOR_ALLOCATED
          (*

          Total bytes allocated in the minor heap in the last minor collection.

          • since 5.0
          *)
        7. | EV_C_REQUEST_MAJOR_ALLOC_SHR
          (*

          Major slice requested due to allocation in major heap.

          • since 5.0
          *)
        8. | EV_C_REQUEST_MAJOR_ADJUST_GC_SPEED
          (*

          Major slice requested by caml_adjust_gc_speed.

          • since 5.0
          *)
        9. | EV_C_REQUEST_MINOR_REALLOC_REF_TABLE
          (*

          Triggering of a minor collection due to ref table reallocation.

          • since 5.0
          *)
        10. | EV_C_REQUEST_MINOR_REALLOC_EPHE_REF_TABLE
          (*

          Triggering of a minor collection due to ephe_ref table reallocation.

          • since 5.0
          *)
        11. | EV_C_REQUEST_MINOR_REALLOC_CUSTOM_TABLE
          (*

          Triggering of a minor collection due to custom table reallocation.

          • since 5.0
          *)
        12. | EV_C_MAJOR_HEAP_POOL_WORDS
          (*

          Total words in a Domain's major heap pools. This is the sum of unallocated and live words in each pool.

          • since 5.1
          *)
        13. | EV_C_MAJOR_HEAP_POOL_LIVE_WORDS
          (*

          Current live words in a Domain's major heap pools.

          • since 5.1
          *)
        14. | EV_C_MAJOR_HEAP_LARGE_WORDS
          (*

          Total words of a Domain's major heap large allocations. A large allocation is an allocation larger than the largest sized pool.

          • since 5.1
          *)
        15. | EV_C_MAJOR_HEAP_POOL_FRAG_WORDS
          (*

          Words in a Domain's major heap pools lost to fragmentation. This is due to there not being a pool with the exact size of an allocation and a larger sized pool needing to be used.

          • since 5.1
          *)
        16. | EV_C_MAJOR_HEAP_POOL_LIVE_BLOCKS
          (*

          Live blocks of a Domain's major heap pools.

          • since 5.1
          *)
        17. | EV_C_MAJOR_HEAP_LARGE_BLOCKS
          (*

          Live blocks of a Domain's major heap large allocations.

          • since 5.1
          *)
        18. | EV_C_MAJOR_HEAP_WORDS
          (*

          Major heap size in words of a Domain.

          • since 5.3
          *)
        19. | EV_C_MAJOR_ALLOCATED_WORDS
          (*

          Allocations to the major heap of this Domain in words, since the last major slice.

          • since 5.3
          *)
        20. | EV_C_MAJOR_ALLOCATED_WORK
          (*

          The amount of major GC 'work' needing to be done as a result of allocations to the major heap of this Domain in words, since the last major slice.

          • since 5.3
          *)
        21. | EV_C_MAJOR_DEPENDENT_WORK
          (*

          The amount of major GC 'work' needing to be done as a result of dependent allocations to the major heap of this Domain in words, since the last major slice. Dependent memory is non-heap memory that depends on heap memory being collected in order to be freed.

          • since 5.3
          *)
        22. | EV_C_MAJOR_EXTRA_WORK
          (*

          The amount of major GC 'work' needing to be done as a result of extra non-memory resources that are dependent on heap memory being collected in order to be freed.

          • since 5.3
          *)
        23. | EV_C_MAJOR_WORK_COUNTER
          (*

          The global amount of major GC 'work' done by all domains since the program began.

          • since 5.3
          *)
        24. | EV_C_MAJOR_ALLOC_COUNTER
          (*

          The global words of major GC allocations done by all domains since the program began.

          • since 5.3
          *)
        25. | EV_C_MAJOR_SLICE_TARGET
          (*

          The target amount of global 'work' that should be done by all domains at the end of the major slice (see EV_C_MAJOR_SLICE_COUNTER).

          • since 5.3
          *)
        26. | EV_C_MAJOR_SLICE_BUDGET
          (*

          The budget in 'work' that a domain has to do during the major slice.

          • since 5.3
          *)

        The type for counter events emitted by the runtime. Counter events are used to measure a quantity at a point in time or record the occurence of an event. In the latter case their value will be one.

        type runtime_phase =
        1. | EV_EXPLICIT_GC_SET
          (*

          Event spanning a call to Gc.set.

          • since 5.0
          *)
        2. | EV_EXPLICIT_GC_STAT
          (*

          Event spanning a call to Gc.stat.

          • since 5.0
          *)
        3. | EV_EXPLICIT_GC_MINOR
          (*

          Event spanning a call to Gc.minor, which forces a minor collection.

          • since 5.0
          *)
        4. | EV_EXPLICIT_GC_MAJOR
          (*

          Event spanning a call to Gc.major, which forces a major collection.

          • since 5.0
          *)
        5. | EV_EXPLICIT_GC_FULL_MAJOR
          (*

          Event spanning a call to Gc.full_major, which forces a full major collection.

          • since 5.0
          *)
        6. | EV_EXPLICIT_GC_COMPACT
          (*

          Event spanning a call to Gc.compact, which triggers a compaction.

          • since 5.0
          *)
        7. | EV_MAJOR
          (*

          Event spanning any major GC work.

          • since 5.0
          *)
        8. | EV_MAJOR_SWEEP
          (*

          Event spanning the sweeping work of a major GC.

          • since 5.0
          *)
        9. | EV_MAJOR_MARK_ROOTS
          (*

          Event spanning the marking of roots in a major GC.

          • since 5.0
          *)
        10. | EV_MAJOR_MEMPROF_ROOTS
          (*

          Event spanning the marking of memprof roots in a major GC.

          • since 5.3
          *)
        11. | EV_MAJOR_MARK
          (*

          Event spanning the marking of the heap in a major GC.

          • since 5.0
          *)
        12. | EV_MINOR
          (*

          Event spanning any minor GC work.

          • since 5.0
          *)
        13. | EV_MINOR_LOCAL_ROOTS
          (*

          Event spanning the scanning and major allocation of local roots during a minor GC.

          • since 5.0
          *)
        14. | EV_MINOR_MEMPROF_ROOTS
          (*

          Event spanning the scanning and promotion of memprof roots in a minor GC.

          • since 5.3
          *)
        15. | EV_MINOR_MEMPROF_CLEAN
          (*

          Event spanning cleaning and updating of memprof structures at the end of a minor GC.

          • since 5.3
          *)
        16. | EV_MINOR_FINALIZED
          (*

          Event spanning the running of finalisers for dead custom blocks at the end of a minor GC.

          • since 5.0
          *)
        17. | EV_EXPLICIT_GC_MAJOR_SLICE
          (*

          Event spanning a call to Gc.major_slice.

          • since 5.0
          *)
        18. | EV_FINALISE_UPDATE_FIRST
          (*

          Event spanning time spent in the first phase of finalisation at the end of a major GC cycle.

          • since 5.0
          *)
        19. | EV_FINALISE_UPDATE_LAST
          (*

          Event spanning time spent in the last phase of finalisation at the end of a major GC cycle.

          • since 5.0
          *)
        20. | EV_INTERRUPT_REMOTE
          (*

          Event spanning work triggered by an interrupt from another domain. This is usually a stop-the-world request.

          • since 5.0
          *)
        21. | EV_MAJOR_EPHE_MARK
          (*

          Event spanning the marking of ephemeron tables in a major GC.

          • since 5.0
          *)
        22. | EV_MAJOR_EPHE_SWEEP
          (*

          Event spanning the sweeping of ephemeron tables in a major GC.

          • since 5.0
          *)
        23. | EV_MAJOR_FINISH_MARKING
          (*

          Event spanning work done at the end of marking in a major GC.

          • since 5.0
          *)
        24. | EV_MAJOR_GC_CYCLE_DOMAINS
          (*

          Event spanning work done at the end of a major GC cycle. This includes a minor collection.

          • since 5.0
          *)
        25. | EV_MAJOR_GC_PHASE_CHANGE
          (*

          Event spanning the change of phase in the major GC which involves a global barrier.

          • since 5.0
          *)
        26. | EV_MAJOR_GC_STW
          (*

          Event spanning the stop-the-world phase done at the end of a major GC cycle.

          • since 5.0
          *)
        27. | EV_MAJOR_MARK_OPPORTUNISTIC
          (*

          Event spanning the work done during opportunistic marking in a major GC.

          • since 5.0
          *)
        28. | EV_MAJOR_SLICE
          (*

          Event spanning the work done during a major slice in a major GC.

          • since 5.0
          *)
        29. | EV_MAJOR_FINISH_CYCLE
          (*

          Event spanning attempts to drive all domains to the end of a major GC cycle.

          • since 5.0
          *)
        30. | EV_MINOR_CLEAR
          (*

          Event spanning the cleaning of the minor heap and supporting structures at the end of a minor GC.

          • since 5.0
          *)
        31. | EV_MINOR_FINALIZERS_OLDIFY
          (*

          Event spanning the promotion of finalisers during a minor GC.

          • since 5.0
          *)
        32. | EV_MINOR_GLOBAL_ROOTS
          (*

          Event spanning the scanning and major allocation of global roots during a minor GC.

          • since 5.0
          *)
        33. | EV_MINOR_LEAVE_BARRIER
          (*

          Event spanning the time spent in the barrier at the end of a minor GC, waiting for all domains to finish their work.

          • since 5.0
          *)
        34. | EV_STW_API_BARRIER
          (*

          Event spanning the time spent waiting for all other domains to reach the stop-the-world entry barrier.

          • since 5.0
          *)
        35. | EV_STW_HANDLER
          (*

          Event spanning the time spent in the stop-the-world handler, including time spent in the stop-the-world callback itself.

          • since 5.0
          *)
        36. | EV_STW_LEADER
          (*

          Event spanning the time spent as the leader of a stop-the-world.

          • since 5.0
          *)
        37. | EV_MAJOR_FINISH_SWEEPING
          (*

          Event spanning the time spent finishing sweeping when forced to as part of domain termination.

          • since 5.0
          *)
        38. | EV_MAJOR_MEMPROF_CLEAN
          (*

          Event spanning the time spent cleaning memprof structures at the end of a major GC.

          • since 5.3
          *)
        39. | EV_MINOR_FINALIZERS_ADMIN
          (*

          Event spanning finalisers book-keeping at the end of a minor GC.

          • since 5.0
          *)
        40. | EV_MINOR_REMEMBERED_SET
          (*

          Event spanning the scanning and major allocation of remembered sets during a minor GC.

          • since 5.0
          *)
        41. | EV_MINOR_REMEMBERED_SET_PROMOTE
          (*

          Event spanning the promotion of blocks in the remembered set and global roots during a minor GC.

          • since 5.0
          *)
        42. | EV_MINOR_LOCAL_ROOTS_PROMOTE
          (*

          Event spanning the promotion of local roots during a minor GC.

          • since 5.0
          *)
        43. | EV_DOMAIN_CONDITION_WAIT
          (*

          Event spanning waiting in Condition.wait.

          • since 5.0
          *)
        44. | EV_DOMAIN_RESIZE_HEAP_RESERVATION
          (*

          Event spanning resizing the domain heap reservation, as a result of minor heap size changes.

          • since 5.0
          *)
        45. | EV_COMPACT
          (*

          Event spanning compaction of the heap during a call to Gc.compact.

          • since 5.2
          *)
        46. | EV_COMPACT_EVACUATE
          (*

          Event spanning evacuating major GC pools during a compaction.

          • since 5.2
          *)
        47. | EV_COMPACT_FORWARD
          (*

          Event spanning the walking of the heap to update changed pointers after an evacuation during a compaction.

          • since 5.2
          *)
        48. | EV_COMPACT_RELEASE
          (*

          Event spanning releasing the evacuated pools at the end of a compaction.

          • since 5.2
          *)

        The type for span events emitted by the runtime.

        type lifecycle =
        1. | EV_RING_START
          (*

          Event indicating that the Runtime_events ring buffer has been started. Includes the PID of the process as an argument.

          • since 5.0
          *)
        2. | EV_RING_STOP
          (*

          Event indicating that the Runtime_events ring buffer has been stopped.

          • since 5.0
          *)
        3. | EV_RING_PAUSE
          (*

          Event indicating that the Runtime_events ring buffer has been paused.

          • since 5.0
          *)
        4. | EV_RING_RESUME
          (*

          Event indicating that the Runtime_events ring buffer has been resumed.

          • since 5.0
          *)
        5. | EV_FORK_PARENT
          (*

          Event indicating that a fork has occurred and the current domain is the parent. Includes the PID of the child as an argument.

          • since 5.0
          *)
        6. | EV_FORK_CHILD
          (*

          Event indicating that a fork has occurred and the current domain is the child.

          • since 5.0
          *)
        7. | EV_DOMAIN_SPAWN
          (*

          Event indicating that a new domain has been spawned. Includes the PID of the new domain as an argument.

          • since 5.0
          *)
        8. | EV_DOMAIN_TERMINATE
          (*

          Event indicating that a domain has terminated. Includes the PID of the domain as an argument.

          • since 5.0
          *)

        Lifecycle events for Runtime_events and domains.

        val lifecycle_name : lifecycle -> string

        Return a string representation of a given lifecycle event type.

        val runtime_phase_name : runtime_phase -> string

        Return a string representation of a given runtime phase event type.

        val runtime_counter_name : runtime_counter -> string

        Return a string representation of a given runtime counter type.

        type cursor

        Type of the cursor used when consuming.

        module Timestamp : sig ... end
        module Type : sig ... end
        module User : sig ... end

        User events is a way for libraries to provide runtime events that can be consumed by other tools. These events can carry known data types or custom values. The current maximum number of user events is 8192.

        module Callbacks : sig ... end
        val start : unit -> unit

        start () will start the collection of events in the runtime if not already started.

        Events can be consumed by creating a cursor with create_cursor and providing a set of callbacks to be called for each type of event.

        val path : unit -> string option

        If runtime events are being collected, path () returns Some p where p is a path to the runtime events file. Otherwise, it returns None.

        val pause : unit -> unit

        pause () will pause the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

        val resume : unit -> unit

        resume () will resume the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

        val create_cursor : (string * int) option -> cursor

        create_cursor path_pid creates a cursor to read from an runtime_events. Cursors can be created for runtime_events in and out of process. A runtime_events ring-buffer may have multiple cursors reading from it at any point in time and a program may have multiple cursors open concurrently (for example if multiple consumers want different sets of events). If path_pid is None then a cursor is created for the current process. Otherwise the pair contains a string path to the directory that contains the pid.events file and int pid for the runtime_events of an external process to monitor.

        val free_cursor : cursor -> unit

        Free a previously created runtime_events cursor.

        val read_poll : cursor -> Callbacks.t -> int option -> int

        read_poll cursor callbacks max_option calls the corresponding functions on callbacks for up to max_option events read off cursor's runtime_events and returns the number of events read.

        diff --git a/ocaml/Schedgen/index.html b/ocaml/Schedgen/index.html index 254e5158..9778bb85 100644 --- a/ocaml/Schedgen/index.html +++ b/ocaml/Schedgen/index.html @@ -1,2 +1,2 @@ -Schedgen (ocaml.Schedgen)

        Module Schedgen

        type code_dag_node = {
        1. instr : Linear.instruction;
        2. delay : int;
        3. mutable sons : (code_dag_node * int) list;
        4. mutable date : int;
        5. mutable length : int;
        6. mutable ancestors : int;
        7. mutable emitted_ancestors : int;
        }
        class virtual scheduler_generic : object ... end
        val reset : unit -> unit
        +Schedgen (ocaml.Schedgen)

        Module Schedgen

        type code_dag_node = {
        1. instr : Linear.instruction;
        2. delay : int;
        3. mutable sons : (code_dag_node * int) list;
        4. mutable date : int;
        5. mutable length : int;
        6. mutable ancestors : int;
        7. mutable emitted_ancestors : int;
        }
        class virtual scheduler_generic : object ... end
        diff --git a/ocaml/Selectgen/Effect_and_coeffect/index.html b/ocaml/Selectgen/Effect_and_coeffect/index.html index 4023cd28..0c6a8ca6 100644 --- a/ocaml/Selectgen/Effect_and_coeffect/index.html +++ b/ocaml/Selectgen/Effect_and_coeffect/index.html @@ -1,2 +1,2 @@ -Effect_and_coeffect (ocaml.Selectgen.Effect_and_coeffect)

        Module Selectgen.Effect_and_coeffect

        type t
        val none : t
        val arbitrary : t
        val effect : t -> Effect.t
        val coeffect : t -> Coeffect.t
        val effect_only : Effect.t -> t
        val coeffect_only : Coeffect.t -> t
        val join : t -> t -> t
        val join_list_map : 'a list -> ('a -> t) -> t
        +Effect_and_coeffect (ocaml.Selectgen.Effect_and_coeffect)

        Module Selectgen.Effect_and_coeffect

        type t
        val none : t
        val arbitrary : t
        val effect_ : t -> Effect.t
        val coeffect : t -> Coeffect.t
        val effect_only : Effect.t -> t
        val coeffect_only : Coeffect.t -> t
        val join : t -> t -> t
        val join_list_map : 'a list -> ('a -> t) -> t
        diff --git a/ocaml/Selectgen/class-selector_generic/index.html b/ocaml/Selectgen/class-selector_generic/index.html index 9455098c..b77c73ed 100644 --- a/ocaml/Selectgen/class-selector_generic/index.html +++ b/ocaml/Selectgen/class-selector_generic/index.html @@ -23,7 +23,7 @@ unit
        method emit_extcall_args : environment -> Cmm.exttype list -> Cmm.expression list -> - Reg.t array * int
        method emit_stores : environment -> Cmm.expression list -> Reg.t array -> unit
        method mark_call : unit
        method mark_tailcall : unit
        method mark_c_tailcall : unit
        method mark_instr : Mach.instruction_desc -> unit
        method emit_fundecl : future_funcnames:Misc.Stdlib.String.Set.t -> + Reg.t array * int
        method emit_stores : environment -> Cmm.expression list -> Reg.t array -> unit
        method emit_fundecl : future_funcnames:Misc.Stdlib.String.Set.t -> Cmm.fundecl -> Mach.fundecl
        method extract_onto : Mach.instruction -> Mach.instruction
        method extract : Mach.instruction
        method insert : environment -> Mach.instruction_desc -> @@ -42,4 +42,4 @@ Reg.t array -> Reg.t array -> int -> - unit
        method insert_moves : environment -> Reg.t array -> Reg.t array -> unit
        method emit_expr : environment -> Cmm.expression -> Reg.t array option
        method emit_tail : environment -> Cmm.expression -> unit
        val contains_calls : bool ref
        + unit
        method insert_moves : environment -> Reg.t array -> Reg.t array -> unit
        method emit_expr : environment -> Cmm.expression -> Reg.t array option
        method emit_tail : environment -> Cmm.expression -> unit
        diff --git a/ocaml/Shape/Item/index.html b/ocaml/Shape/Item/index.html index 721dd1c4..fe0876af 100644 --- a/ocaml/Shape/Item/index.html +++ b/ocaml/Shape/Item/index.html @@ -1,2 +1,2 @@ -Item (ocaml.Shape.Item)

        Module Shape.Item

        type t
        val make : string -> Sig_component_kind.t -> t
        val value : Ident.t -> t
        val type_ : Ident.t -> t
        val module_ : Ident.t -> t
        val module_type : Ident.t -> t
        val extension_constructor : Ident.t -> t
        val class_ : Ident.t -> t
        val class_type : Ident.t -> t
        module Map : Map.S with type key = t
        +Item (ocaml.Shape.Item)

        Module Shape.Item

        Shape's items are elements of a structure or, in the case of constructors and labels, elements of a record or variants definition seen as a structure. These structures model module components and nested types' constructors and labels.

        type t = string * Sig_component_kind.t
        val name : t -> string
        val kind : t -> Sig_component_kind.t
        val make : string -> Sig_component_kind.t -> t
        val value : Ident.t -> t
        val type_ : Ident.t -> t
        val constr : Ident.t -> t
        val label : Ident.t -> t
        val module_ : Ident.t -> t
        val module_type : Ident.t -> t
        val extension_constructor : Ident.t -> t
        val class_ : Ident.t -> t
        val class_type : Ident.t -> t
        val print : Stdlib.Format.formatter -> t -> unit
        module Map : Map.S with type key = t
        diff --git a/ocaml/Shape/Make_reduce/argument-1-Context/index.html b/ocaml/Shape/Make_reduce/argument-1-Context/index.html deleted file mode 100644 index 5d694d2f..00000000 --- a/ocaml/Shape/Make_reduce/argument-1-Context/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Context (ocaml.Shape.Make_reduce.Context)

        Parameter Make_reduce.Context

        type env
        val fuel : int
        val read_unit_shape : unit_name:string -> t option
        val find_shape : env -> Ident.t -> t
        diff --git a/ocaml/Shape/Make_reduce/index.html b/ocaml/Shape/Make_reduce/index.html deleted file mode 100644 index ab184436..00000000 --- a/ocaml/Shape/Make_reduce/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Make_reduce (ocaml.Shape.Make_reduce)

        Module Shape.Make_reduce

        The Make_reduce functor is used to generate a reduction function for shapes.

        It is parametrized by:

        • an environment and a function to find shapes by path in that environment
        • a function to load the shape of an external compilation unit
        • some fuel, which is used to bound recursion when dealing with recursive shapes introduced by recursive modules. (FTR: merlin currently uses a fuel of 10, which seems to be enough for most practical examples)

        Parameters

        module Context : sig ... end

        Signature

        val reduce : Context.env -> t -> t
        diff --git a/ocaml/Shape/Map/index.html b/ocaml/Shape/Map/index.html index 099ad3e9..5186c1d8 100644 --- a/ocaml/Shape/Map/index.html +++ b/ocaml/Shape/Map/index.html @@ -1,2 +1,2 @@ -Map (ocaml.Shape.Map)

        Module Shape.Map

        type shape = t
        type nonrec t = t Item.Map.t
        val empty : t
        val add : t -> Item.t -> shape -> t
        val add_value : t -> Ident.t -> Uid.t -> t
        val add_value_proj : t -> Ident.t -> shape -> t
        val add_type : t -> Ident.t -> Uid.t -> t
        val add_type_proj : t -> Ident.t -> shape -> t
        val add_module : t -> Ident.t -> shape -> t
        val add_module_proj : t -> Ident.t -> shape -> t
        val add_module_type : t -> Ident.t -> Uid.t -> t
        val add_module_type_proj : t -> Ident.t -> shape -> t
        val add_extcons : t -> Ident.t -> Uid.t -> t
        val add_extcons_proj : t -> Ident.t -> shape -> t
        val add_class : t -> Ident.t -> Uid.t -> t
        val add_class_proj : t -> Ident.t -> shape -> t
        val add_class_type : t -> Ident.t -> Uid.t -> t
        val add_class_type_proj : t -> Ident.t -> shape -> t
        +Map (ocaml.Shape.Map)

        Module Shape.Map

        type shape = t
        type nonrec t = t Item.Map.t
        val empty : t
        val add : t -> Item.t -> shape -> t
        val add_value : t -> Ident.t -> Uid.t -> t
        val add_value_proj : t -> Ident.t -> shape -> t
        val add_type : t -> Ident.t -> shape -> t
        val add_type_proj : t -> Ident.t -> shape -> t
        val add_constr : t -> Ident.t -> shape -> t
        val add_constr_proj : t -> Ident.t -> shape -> t
        val add_label : t -> Ident.t -> Uid.t -> t
        val add_label_proj : t -> Ident.t -> shape -> t
        val add_module : t -> Ident.t -> shape -> t
        val add_module_proj : t -> Ident.t -> shape -> t
        val add_module_type : t -> Ident.t -> Uid.t -> t
        val add_module_type_proj : t -> Ident.t -> shape -> t
        val add_extcons : t -> Ident.t -> shape -> t
        val add_extcons_proj : t -> Ident.t -> shape -> t
        val add_class : t -> Ident.t -> Uid.t -> t
        val add_class_proj : t -> Ident.t -> shape -> t
        val add_class_type : t -> Ident.t -> Uid.t -> t
        val add_class_type_proj : t -> Ident.t -> shape -> t
        diff --git a/ocaml/Shape/Sig_component_kind/index.html b/ocaml/Shape/Sig_component_kind/index.html index e5cbbbc5..d4056ad9 100644 --- a/ocaml/Shape/Sig_component_kind/index.html +++ b/ocaml/Shape/Sig_component_kind/index.html @@ -1,2 +1,2 @@ -Sig_component_kind (ocaml.Shape.Sig_component_kind)

        Module Shape.Sig_component_kind

        type t =
        1. | Value
        2. | Type
        3. | Module
        4. | Module_type
        5. | Extension_constructor
        6. | Class
        7. | Class_type
        val to_string : t -> string
        val can_appear_in_types : t -> bool

        Whether the name of a component of that kind can appear in a type.

        +Sig_component_kind (ocaml.Shape.Sig_component_kind)

        Module Shape.Sig_component_kind

        type t =
        1. | Value
        2. | Type
        3. | Constructor
        4. | Label
        5. | Module
        6. | Module_type
        7. | Extension_constructor
        8. | Class
        9. | Class_type
        val to_string : t -> string
        val can_appear_in_types : t -> bool

        Whether the name of a component of that kind can appear in a type.

        diff --git a/ocaml/Shape/Uid/index.html b/ocaml/Shape/Uid/index.html index e3b29973..5c74d289 100644 --- a/ocaml/Shape/Uid/index.html +++ b/ocaml/Shape/Uid/index.html @@ -1,2 +1,2 @@ -Uid (ocaml.Shape.Uid)

        Module Shape.Uid

        type t = private
        1. | Compilation_unit of string
        2. | Item of {
          1. comp_unit : string;
          2. id : int;
          }
        3. | Internal
        4. | Predef of string
        val reinit : unit -> unit
        val mk : current_unit:string -> t
        val of_compilation_unit_id : Ident.t -> t
        val of_predef_id : Ident.t -> t
        val internal_not_actually_unique : t
        val for_actual_declaration : t -> bool
        include Identifiable.S with type t := t
        module T : Identifiable.Thing with type t = t
        include Identifiable.Thing with type t := T.t
        include Hashtbl.HashedType with type t := T.t
        val equal : T.t -> T.t -> bool

        The equality predicate used to compare keys.

        val hash : T.t -> int

        A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

        • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
        • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
        • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
        include Map.OrderedType with type t := T.t
        val compare : T.t -> T.t -> int

        A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

        val output : out_channel -> T.t -> unit
        val print : Stdlib.Format.formatter -> T.t -> unit
        module Set : Identifiable.Set with module T := T
        module Map : Identifiable.Map with module T := T
        module Tbl : Identifiable.Tbl with module T := T
        +Uid (ocaml.Shape.Uid)

        Module Shape.Uid

        A Uid.t is associated to every declaration in signatures and implementations. They uniquely identify bindings in the program. When associated with these bindings' locations they are useful to external tools when trying to jump to an identifier's declaration or definition. They are stored to that effect in the uid_to_decl table of cmt files.

        type t = private
        1. | Compilation_unit of string
        2. | Item of {
          1. comp_unit : string;
          2. id : int;
          3. from : Unit_info.intf_or_impl;
          }
        3. | Internal
        4. | Predef of string
        val reinit : unit -> unit
        val mk : current_unit:Unit_info.t option -> t
        val of_compilation_unit_id : Ident.t -> t
        val of_predef_id : Ident.t -> t
        val internal_not_actually_unique : t
        val for_actual_declaration : t -> bool
        include Identifiable.S with type t := t
        module T : Identifiable.Thing with type t = t
        include Identifiable.Thing with type t := T.t
        include Hashtbl.HashedType with type t := T.t
        val equal : T.t -> T.t -> bool

        The equality predicate used to compare keys.

        val hash : T.t -> int

        A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

        • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
        • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
        • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
        include Map.OrderedType with type t := T.t
        val compare : T.t -> T.t -> int

        A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.

        val output : out_channel -> T.t -> unit
        val print : Stdlib.Format.formatter -> T.t -> unit
        module Set : Identifiable.Set with module T := T
        module Map : Identifiable.Map with module T := T
        module Tbl : Identifiable.Tbl with module T := T
        diff --git a/ocaml/Shape/index.html b/ocaml/Shape/index.html index 23c83fbb..baf00854 100644 --- a/ocaml/Shape/index.html +++ b/ocaml/Shape/index.html @@ -1,6 +1,6 @@ -Shape (ocaml.Shape)

        Module Shape

        module Uid : sig ... end
        module Sig_component_kind : sig ... end
        module Item : sig ... end
        type var = Ident.t
        type t = {
        1. uid : Uid.t option;
        2. desc : desc;
        }
        and desc =
        1. | Var of var
        2. | Abs of var * t
        3. | App of t * t
        4. | Struct of t Item.Map.t
        5. | Leaf
        6. | Proj of t * Item.t
        7. | Comp_unit of string
        val print : Stdlib.Format.formatter -> t -> unit
        val for_unnamed_functor_param : var
        val fresh_var : ?name:string -> Uid.t -> var * t
        val var : Uid.t -> Ident.t -> t
        val abs : ?uid:Uid.t -> var -> t -> t
        val app : ?uid:Uid.t -> t -> arg:t -> t
        val str : ?uid:Uid.t -> t Item.Map.t -> t
        val proj : ?uid:Uid.t -> t -> Item.t -> t
        val leaf : Uid.t -> t
        val decompose_abs : t -> (var * t) option
        val for_persistent_unit : string -> t
        val leaf_for_unpack : t
        module Map : sig ... end
        val dummy_mod : t
        val of_path : +Shape (ocaml.Shape)

        Module Shape

        Shapes are an abstract representation of modules' implementations which allow the tracking of definitions through functor applications and other module-level operations.

        The Shape of a compilation unit is elaborated during typing, partially reduced (without loading external shapes) and written to the cmt file.

        External tools can retrieve the definition of any value (or type, or module, etc) by following this procedure:

        • Build the Shape corresponding to the value's path: let shape = Env.shape_of_path ~namespace env path
        • Instantiate the Shape_reduce.Make functor with a way to load shapes from external units and to looks for shapes in the environment (usually using Env.shape_of_path).
        • Completely reduce the shape: let shape = My_reduce.(weak_)reduce env shape
        • The Uid.t stored in the reduced shape should be the one of the definition. However, if the approximate field of the reduced shape is true then the Uid.t will not correspond to the definition, but to the closest parent module's uid. This happens when Shape reduction gets stuck, for example when hitting first-class modules.
        • The location of the definition can be easily found with the cmt_format.cmt_uid_to_decl table of the corresponding compilation unit.

        See:

        module Uid : sig ... end

        A Uid.t is associated to every declaration in signatures and implementations. They uniquely identify bindings in the program. When associated with these bindings' locations they are useful to external tools when trying to jump to an identifier's declaration or definition. They are stored to that effect in the uid_to_decl table of cmt files.

        module Sig_component_kind : sig ... end
        module Item : sig ... end

        Shape's items are elements of a structure or, in the case of constructors and labels, elements of a record or variants definition seen as a structure. These structures model module components and nested types' constructors and labels.

        type var = Ident.t
        type t = {
        1. uid : Uid.t option;
        2. desc : desc;
        3. approximated : bool;
        }
        and desc =
        1. | Var of var
        2. | Abs of var * t
        3. | App of t * t
        4. | Struct of t Item.Map.t
        5. | Alias of t
        6. | Leaf
        7. | Proj of t * Item.t
        8. | Comp_unit of string
        9. | Error of string
        val print : Stdlib.Format.formatter -> t -> unit
        val strip_head_aliases : t -> t
        val for_unnamed_functor_param : var
        val fresh_var : ?name:string -> Uid.t -> var * t
        val var : Uid.t -> Ident.t -> t
        val abs : ?uid:Uid.t -> var -> t -> t
        val app : ?uid:Uid.t -> t -> arg:t -> t
        val str : ?uid:Uid.t -> t Item.Map.t -> t
        val alias : ?uid:Uid.t -> t -> t
        val proj : ?uid:Uid.t -> t -> Item.t -> t
        val leaf : Uid.t -> t
        val decompose_abs : t -> (var * t) option
        val for_persistent_unit : string -> t
        val leaf_for_unpack : t
        module Map : sig ... end
        val dummy_mod : t
        val of_path : find_shape:(Sig_component_kind.t -> Ident.t -> t) -> namespace:Sig_component_kind.t -> Path.t -> - t
        val set_uid_if_none : t -> Uid.t -> t
        module Make_reduce (Context : sig ... end) : sig ... end

        The Make_reduce functor is used to generate a reduction function for shapes.

        val local_reduce : t -> t
        + t

        This function returns the shape corresponding to a given path. It requires a callback to find shapes in the environment. It is generally more useful to rely directly on the Env.shape_of_path function to get the shape associated with a given path.

        val set_uid_if_none : t -> Uid.t -> t
        diff --git a/ocaml/Shape_reduce/Make/argument-1-_/index.html b/ocaml/Shape_reduce/Make/argument-1-_/index.html new file mode 100644 index 00000000..84434826 --- /dev/null +++ b/ocaml/Shape_reduce/Make/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (ocaml.Shape_reduce.Make._)

        Parameter Make._

        val fuel : int
        val read_unit_shape : unit_name:string -> Shape.t option
        diff --git a/ocaml/Shape_reduce/Make/index.html b/ocaml/Shape_reduce/Make/index.html new file mode 100644 index 00000000..127bf752 --- /dev/null +++ b/ocaml/Shape_reduce/Make/index.html @@ -0,0 +1,2 @@ + +Make (ocaml.Shape_reduce.Make)

        Module Shape_reduce.Make

        The Make functor is used to generate a reduction function for shapes.

        It is parametrized by:

        • a function to load the shape of an external compilation unit
        • some fuel, which is used to bound recursion when dealing with recursive shapes introduced by recursive modules. (FTR: merlin currently uses a fuel of 10, which seems to be enough for most practical examples)

        Usage warning: To ensure good performances, every reduction made with the same instance of that functor share the same ident-based memoization tables. Such an instance should only be used to perform reduction inside a unique compilation unit to prevent conflicting entries in these memoization tables.

        Parameters

        module _ : sig ... end

        Signature

        val reduce : Env.t -> Shape.t -> Shape.t
        val reduce_for_uid : Env.t -> Shape.t -> result

        Perform weak reduction and return the head's uid if any. If reduction was incomplete the partially reduced shape is returned.

        diff --git a/ocaml/Shape_reduce/index.html b/ocaml/Shape_reduce/index.html new file mode 100644 index 00000000..17d9744a --- /dev/null +++ b/ocaml/Shape_reduce/index.html @@ -0,0 +1,2 @@ + +Shape_reduce (ocaml.Shape_reduce)

        Module Shape_reduce

        type result =
        1. | Resolved of Shape.Uid.t
          (*

          Shape reduction succeeded and a uid was found

          *)
        2. | Resolved_alias of Shape.Uid.t * result
          (*

          Reduction led to an alias

          *)
        3. | Unresolved of Shape.t
          (*

          Result still contains Comp_unit terms

          *)
        4. | Approximated of Shape.Uid.t option
          (*

          Reduction failed: it can arrive with first-class modules for example

          *)
        5. | Internal_error_missing_uid
          (*

          Reduction succeeded but no uid was found, this should never happen

          *)

        The result of reducing a shape and looking for its uid

        val print_result : Stdlib.Format.formatter -> result -> unit
        module Make (_ : sig ... end) : sig ... end

        The Make functor is used to generate a reduction function for shapes.

        val local_reduce : Env.t -> Shape.t -> Shape.t

        local_reduce will not reduce shapes that require loading external compilation units.

        val local_reduce_for_uid : Env.t -> Shape.t -> result

        local_reduce_for_uid will not reduce shapes that require loading external compilation units.

        diff --git a/ocaml/Signature_group/index.html b/ocaml/Signature_group/index.html index 62f237dd..23033dac 100644 --- a/ocaml/Signature_group/index.html +++ b/ocaml/Signature_group/index.html @@ -4,4 +4,4 @@ Types.signature_item -> ('a * in_place_patch) option)
        -> Types.signature -> - ('a * Types.signature) option

        !replace_in_place patch sg replaces the first element of the signature for which patch ~rec_group ~ghosts component returns Some (value,patch). The rec_group argument is the remaining part of the mutually recursive group of component. The ghosts list is the current prefix of ghost components associated to component

        + ('a * Types.signature) option

        !replace_in_place patch sg replaces the first element of the signature for which patch ~ghosts component returns Some (value,patch). The ghosts list is the current prefix of ghost components associated to component

        diff --git a/ocaml/Simplif/index.html b/ocaml/Simplif/index.html index 1b7c7bc9..b6fd3f3d 100644 --- a/ocaml/Simplif/index.html +++ b/ocaml/Simplif/index.html @@ -7,4 +7,4 @@ body:Lambda.lambda -> attr:Lambda.function_attribute -> loc:Lambda.scoped_location -> - (Ident.t * Lambda.lambda) list
        + Lambda.rec_binding list
        diff --git a/ocaml/Stackframe/index.html b/ocaml/Stackframe/index.html new file mode 100644 index 00000000..35da8abc --- /dev/null +++ b/ocaml/Stackframe/index.html @@ -0,0 +1,2 @@ + +Stackframe (ocaml.Stackframe)

        Module Stackframe

        val trap_handler_size : int
        diff --git a/ocaml/Stackframegen/class-stackframe_generic/index.html b/ocaml/Stackframegen/class-stackframe_generic/index.html new file mode 100644 index 00000000..2b528bae --- /dev/null +++ b/ocaml/Stackframegen/class-stackframe_generic/index.html @@ -0,0 +1,2 @@ + +stackframe_generic (ocaml.Stackframegen.stackframe_generic)

        Class Stackframegen.stackframe_generic

        method virtual trap_handler_size : int
        method is_call : Mach.instruction_desc -> bool
        method frame_required : Mach.fundecl -> bool -> bool
        method analyze : Mach.fundecl -> analysis_result
        diff --git a/ocaml/Stackframegen/index.html b/ocaml/Stackframegen/index.html new file mode 100644 index 00000000..f8703500 --- /dev/null +++ b/ocaml/Stackframegen/index.html @@ -0,0 +1,2 @@ + +Stackframegen (ocaml.Stackframegen)

        Module Stackframegen

        type analysis_result = {
        1. contains_nontail_calls : bool;
          (*

          Whether the function contains non-tail calls to OCaml functions. Calls to C functions don't count.

          *)
        2. frame_required : bool;
          (*

          Whether the function must allocate a stack frame on entry, for one of the following reasons:

          • some local variables are stack-allocated
          • the function needs to save its return address on the stack, e.g.: -- it contains a non-tail call to an OCaml function -- it calls a C function -- it contains an allocation or a poll point -- it performs an array bound check (on some ports)
          *)
        3. extra_stack_used : int;
          (*

          Amount of stack space used, in bytes, in addition to the initial stack frame. This counts trap handlers and "outgoing" stack slots used for parameter passing.

          *)
        }
        class virtual stackframe_generic : object ... end
        diff --git a/ocaml/Stdlib/Array/index.html b/ocaml/Stdlib/Array/index.html index ff202b6d..459e8a93 100644 --- a/ocaml/Stdlib/Array/index.html +++ b/ocaml/Stdlib/Array/index.html @@ -1,9 +1,9 @@ -Array (ocaml.Stdlib.Array)

        Module Stdlib.Array

        Array operations.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a array

        An alias for the type of arrays.

        val length : 'a array -> int

        Return the length (number of elements) of the given array.

        val get : 'a array -> int -> 'a

        get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

        val set : 'a array -> int -> 'a -> unit

        set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

        val make : int -> 'a -> 'a array

        make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val create_float : int -> float array

        create_float n returns a fresh float array of length n, with uninitialized data.

        • since 4.03
        val init : int -> (int -> 'a) -> 'a array

        init n f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied in order to the integers 0 to n-1.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

        val make_matrix : int -> int -> 'a -> 'a array array

        make_matrix dimx dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

        • raises Invalid_argument

          if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val append : 'a array -> 'a array -> 'a array

        append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

        val concat : 'a array list -> 'a array

        Same as append, but concatenates a list of arrays.

        val sub : 'a array -> int -> int -> 'a array

        sub a pos len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : 'a array -> 'a array

        copy a returns a copy of a, that is, a fresh array containing the same elements as a.

        val fill : 'a array -> int -> int -> 'a -> unit

        fill a pos len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

        val blit : 'a array -> int -> 'a array -> int -> int -> unit

        blit src src_pos dst dst_pos len copies len elements from array src, starting at element number src_pos, to array dst, starting at element number dst_pos. It works correctly even if src and dst are the same array, and the source and destination chunks overlap.

        • raises Invalid_argument

          if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

        val to_list : 'a array -> 'a list

        to_list a returns the list of all the elements of a.

        val of_list : 'a list -> 'a array

        of_list l returns a fresh array containing the elements of l.

        • raises Invalid_argument

          if the length of l is greater than Sys.max_array_length.

        Iterators

        val iter : ('a -> unit) -> 'a array -> unit

        iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

        val iteri : (int -> 'a -> unit) -> 'a array -> unit

        Same as iter, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val map : ('a -> 'b) -> 'a array -> 'b array

        map f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

        val map_inplace : ('a -> 'a) -> 'a array -> unit

        map_inplace f a applies function f to all elements of a, and updates their values in place.

        • since 5.1
        val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array

        Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val mapi_inplace : (int -> 'a -> 'a) -> 'a array -> unit

        Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        • since 5.1
        val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a array -> 'acc

        fold_left f init a computes f (... (f (f init a.(0)) a.(1)) ...) a.(n-1), where n is the length of the array a.

        val fold_left_map : +Array (ocaml.Stdlib.Array)

        Module Stdlib.Array

        Array operations.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a array

        An alias for the type of arrays.

        val length : 'a array -> int

        Return the length (number of elements) of the given array.

        val get : 'a array -> int -> 'a

        get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

        val set : 'a array -> int -> 'a -> unit

        set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

        val make : int -> 'a -> 'a array

        make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val create_float : int -> float array

        create_float n returns a fresh float array of length n, with uninitialized data.

        • since 4.03
        val init : int -> (int -> 'a) -> 'a array

        init n f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied in order to the integers 0 to n-1.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

        val make_matrix : int -> int -> 'a -> 'a array array

        make_matrix dimx dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

        • raises Invalid_argument

          if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val init_matrix : int -> int -> (int -> int -> 'a) -> 'a array array

        init_matrix dimx dimy f returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy, where the element at index (x,y) is initialized with f x y. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

        • since 5.2
        val append : 'a array -> 'a array -> 'a array

        append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

        val concat : 'a array list -> 'a array

        Same as append, but concatenates a list of arrays.

        val sub : 'a array -> int -> int -> 'a array

        sub a pos len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : 'a array -> 'a array

        copy a returns a copy of a, that is, a fresh array containing the same elements as a.

        val fill : 'a array -> int -> int -> 'a -> unit

        fill a pos len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

        val blit : 'a array -> int -> 'a array -> int -> int -> unit

        blit src src_pos dst dst_pos len copies len elements from array src, starting at element number src_pos, to array dst, starting at element number dst_pos. It works correctly even if src and dst are the same array, and the source and destination chunks overlap.

        • raises Invalid_argument

          if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

        val to_list : 'a array -> 'a list

        to_list a returns the list of all the elements of a.

        val of_list : 'a list -> 'a array

        of_list l returns a fresh array containing the elements of l.

        • raises Invalid_argument

          if the length of l is greater than Sys.max_array_length.

        Iterators

        val iter : ('a -> unit) -> 'a array -> unit

        iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

        val iteri : (int -> 'a -> unit) -> 'a array -> unit

        Same as iter, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val map : ('a -> 'b) -> 'a array -> 'b array

        map f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

        val map_inplace : ('a -> 'a) -> 'a array -> unit

        map_inplace f a applies function f to all elements of a, and updates their values in place.

        • since 5.1
        val mapi : (int -> 'a -> 'b) -> 'a array -> 'b array

        Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val mapi_inplace : (int -> 'a -> 'a) -> 'a array -> unit

        Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        • since 5.1
        val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a array -> 'acc

        fold_left f init a computes f (... (f (f init a.(0)) a.(1)) ...) a.(n-1), where n is the length of the array a.

        val fold_left_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a array -> - 'acc * 'b array

        fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

        • since 4.13
        val fold_right : ('a -> 'acc -> 'acc) -> 'a array -> 'acc -> 'acc

        fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

        Iterators on two arrays

        val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit

        iter2 f a b applies function f to all the elements of a and b.

        • since 4.03 (4.05 in ArrayLabels)
        val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

        map2 f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        • since 4.03 (4.05 in ArrayLabels)

        Array scanning

        val for_all : ('a -> bool) -> 'a array -> bool

        for_all f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        • since 4.03
        val exists : ('a -> bool) -> 'a array -> bool

        exists f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        • since 4.03
        val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as for_all, but for a two-argument predicate.

        • since 4.11
        val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as exists, but for a two-argument predicate.

        • since 4.11
        val mem : 'a -> 'a array -> bool

        mem a set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

        • since 4.03
        val memq : 'a -> 'a array -> bool

        Same as mem, but uses physical equality instead of structural equality to compare list elements.

        • since 4.03
        val find_opt : ('a -> bool) -> 'a array -> 'a option

        find_opt f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

        • since 4.13
        val find_index : ('a -> bool) -> 'a array -> int option

        find_index f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : ('a -> 'b option) -> 'a array -> 'b option

        find_map f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.13
        val find_mapi : (int -> 'a -> 'b option) -> 'a array -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Arrays of pairs

        val split : ('a * 'b) array -> 'a array * 'b array

        split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

        • since 4.13
        val combine : 'a array -> 'b array -> ('a * 'b) array

        combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

        • since 4.13

        Sorting

        val sort : ('a -> 'a -> int) -> 'a array -> unit

        Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if and only if i >= j
        val stable_sort : ('a -> 'a -> int) -> 'a array -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

        val fast_sort : ('a -> 'a -> int) -> 'a array -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        Arrays and Sequences

        val to_seq : 'a array -> 'a Seq.t

        Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : 'a array -> (int * 'a) Seq.t

        Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a array

        Create an array from the generator

        • since 4.07

        Arrays and concurrency safety

        Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
        +  'acc * 'b array

        fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

        • since 4.13
        val fold_right : ('a -> 'acc -> 'acc) -> 'a array -> 'acc -> 'acc

        fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

        Iterators on two arrays

        val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit

        iter2 f a b applies function f to all the elements of a and b.

        • since 4.03 (4.05 in ArrayLabels)
        val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

        map2 f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        • since 4.03 (4.05 in ArrayLabels)

        Array scanning

        val for_all : ('a -> bool) -> 'a array -> bool

        for_all f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        • since 4.03
        val exists : ('a -> bool) -> 'a array -> bool

        exists f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        • since 4.03
        val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as for_all, but for a two-argument predicate.

        • since 4.11
        val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as exists, but for a two-argument predicate.

        • since 4.11
        val mem : 'a -> 'a array -> bool

        mem a set is true if and only if a is structurally equal to an element of set (i.e. there is an x in set such that compare a x = 0).

        • since 4.03
        val memq : 'a -> 'a array -> bool

        Same as mem, but uses physical equality instead of structural equality to compare array elements.

        • since 4.03
        val find_opt : ('a -> bool) -> 'a array -> 'a option

        find_opt f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

        • since 4.13
        val find_index : ('a -> bool) -> 'a array -> int option

        find_index f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : ('a -> 'b option) -> 'a array -> 'b option

        find_map f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.13
        val find_mapi : (int -> 'a -> 'b option) -> 'a array -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Arrays of pairs

        val split : ('a * 'b) array -> 'a array * 'b array

        split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

        • since 4.13
        val combine : 'a array -> 'b array -> ('a * 'b) array

        combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

        • since 4.13

        Sorting and shuffling

        val sort : ('a -> 'a -> int) -> 'a array -> unit

        Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if i >= j
        val stable_sort : ('a -> 'a -> int) -> 'a array -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

        val fast_sort : ('a -> 'a -> int) -> 'a array -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        val shuffle : rand:(int -> int) -> 'a array -> unit

        shuffle rand a randomly permutes a's element using rand for randomness. The distribution of permutations is uniform.

        rand must be such that a call to rand n returns a uniformly distributed random number in the range [0;n-1]. Random.int can be used for this (do not forget to initialize the generator).

        • since 5.2

        Arrays and Sequences

        val to_seq : 'a array -> 'a Seq.t

        Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : 'a array -> (int * 'a) Seq.t

        Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a array

        Create an array from the generator

        • since 4.07

        Arrays and concurrency safety

        Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
         let a = Array.make size 1
         let d1 = Domain.spawn (fun () ->
            Array.iteri (fun i x -> a.(i) <- x + 1) a
        diff --git a/ocaml/Stdlib/ArrayLabels/index.html b/ocaml/Stdlib/ArrayLabels/index.html
        index 18c11991..d02d10f9 100644
        --- a/ocaml/Stdlib/ArrayLabels/index.html
        +++ b/ocaml/Stdlib/ArrayLabels/index.html
        @@ -1,5 +1,9 @@
         
        -ArrayLabels (ocaml.Stdlib.ArrayLabels)

        Module Stdlib.ArrayLabels

        Array operations.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a array

        An alias for the type of arrays.

        val length : 'a array -> int

        Return the length (number of elements) of the given array.

        val get : 'a array -> int -> 'a

        get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

        val set : 'a array -> int -> 'a -> unit

        set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

        val make : int -> 'a -> 'a array

        make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val create_float : int -> float array

        create_float n returns a fresh float array of length n, with uninitialized data.

        • since 4.03
        val init : int -> f:(int -> 'a) -> 'a array

        init n ~f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied in order to the integers 0 to n-1.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

        val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array

        make_matrix ~dimx ~dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

        • raises Invalid_argument

          if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val append : 'a array -> 'a array -> 'a array

        append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

        val concat : 'a array list -> 'a array

        Same as append, but concatenates a list of arrays.

        val sub : 'a array -> pos:int -> len:int -> 'a array

        sub a ~pos ~len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : 'a array -> 'a array

        copy a returns a copy of a, that is, a fresh array containing the same elements as a.

        val fill : 'a array -> pos:int -> len:int -> 'a -> unit

        fill a ~pos ~len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

        val blit : +ArrayLabels (ocaml.Stdlib.ArrayLabels)

        Module Stdlib.ArrayLabels

        Array operations.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a array

        An alias for the type of arrays.

        val length : 'a array -> int

        Return the length (number of elements) of the given array.

        val get : 'a array -> int -> 'a

        get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

        val set : 'a array -> int -> 'a -> unit

        set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

        val make : int -> 'a -> 'a array

        make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val create_float : int -> float array

        create_float n returns a fresh float array of length n, with uninitialized data.

        • since 4.03
        val init : int -> f:(int -> 'a) -> 'a array

        init n ~f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied in order to the integers 0 to n-1.

        • raises Invalid_argument

          if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

        val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array

        make_matrix ~dimx ~dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

        • raises Invalid_argument

          if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

        val init_matrix : + dimx:int -> + dimy:int -> + f:(int -> int -> 'a) -> + 'a array array

        init_matrix ~dimx ~dimy ~f returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy, where the element at index (x,y) is initialized with f x y. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

        • since 5.2
        val append : 'a array -> 'a array -> 'a array

        append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

        val concat : 'a array list -> 'a array

        Same as append, but concatenates a list of arrays.

        val sub : 'a array -> pos:int -> len:int -> 'a array

        sub a ~pos ~len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : 'a array -> 'a array

        copy a returns a copy of a, that is, a fresh array containing the same elements as a.

        val fill : 'a array -> pos:int -> len:int -> 'a -> unit

        fill a ~pos ~len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

        val blit : src:'a array -> src_pos:int -> dst:'a array -> @@ -9,7 +13,7 @@ f:('acc -> 'a -> 'acc * 'b) -> init:'acc -> 'a array -> - 'acc * 'b array

        fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

        • since 4.13
        val fold_right : f:('a -> 'acc -> 'acc) -> 'a array -> init:'acc -> 'acc

        fold_right ~f a ~init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

        Iterators on two arrays

        val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit

        iter2 ~f a b applies function f to all the elements of a and b.

        • since 4.05
        val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

        map2 ~f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        • since 4.05

        Array scanning

        val for_all : f:('a -> bool) -> 'a array -> bool

        for_all ~f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        • since 4.03
        val exists : f:('a -> bool) -> 'a array -> bool

        exists ~f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        • since 4.03
        val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as for_all, but for a two-argument predicate.

        • since 4.11
        val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as exists, but for a two-argument predicate.

        • since 4.11
        val mem : 'a -> set:'a array -> bool

        mem a ~set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

        • since 4.03
        val memq : 'a -> set:'a array -> bool

        Same as mem, but uses physical equality instead of structural equality to compare list elements.

        • since 4.03
        val find_opt : f:('a -> bool) -> 'a array -> 'a option

        find_opt ~f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

        • since 4.13
        val find_index : f:('a -> bool) -> 'a array -> int option

        find_index ~f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : f:('a -> 'b option) -> 'a array -> 'b option

        find_map ~f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.13
        val find_mapi : f:(int -> 'a -> 'b option) -> 'a array -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Arrays of pairs

        val split : ('a * 'b) array -> 'a array * 'b array

        split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

        • since 4.13
        val combine : 'a array -> 'b array -> ('a * 'b) array

        combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

        • since 4.13

        Sorting

        val sort : cmp:('a -> 'a -> int) -> 'a array -> unit

        Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if and only if i >= j
        val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

        val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        Arrays and Sequences

        val to_seq : 'a array -> 'a Seq.t

        Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : 'a array -> (int * 'a) Seq.t

        Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a array

        Create an array from the generator

        • since 4.07

        Arrays and concurrency safety

        Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
        +  'acc * 'b array

        fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

        • since 4.13
        val fold_right : f:('a -> 'acc -> 'acc) -> 'a array -> init:'acc -> 'acc

        fold_right ~f a ~init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

        Iterators on two arrays

        val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit

        iter2 ~f a b applies function f to all the elements of a and b.

        • since 4.05
        val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

        map2 ~f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        • since 4.05

        Array scanning

        val for_all : f:('a -> bool) -> 'a array -> bool

        for_all ~f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        • since 4.03
        val exists : f:('a -> bool) -> 'a array -> bool

        exists ~f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        • since 4.03
        val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as for_all, but for a two-argument predicate.

        • since 4.11
        val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

        Same as exists, but for a two-argument predicate.

        • since 4.11
        val mem : 'a -> set:'a array -> bool

        mem a ~set is true if and only if a is structurally equal to an element of set (i.e. there is an x in set such that compare a x = 0).

        • since 4.03
        val memq : 'a -> set:'a array -> bool

        Same as mem, but uses physical equality instead of structural equality to compare array elements.

        • since 4.03
        val find_opt : f:('a -> bool) -> 'a array -> 'a option

        find_opt ~f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

        • since 4.13
        val find_index : f:('a -> bool) -> 'a array -> int option

        find_index ~f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : f:('a -> 'b option) -> 'a array -> 'b option

        find_map ~f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.13
        val find_mapi : f:(int -> 'a -> 'b option) -> 'a array -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Arrays of pairs

        val split : ('a * 'b) array -> 'a array * 'b array

        split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

        • since 4.13
        val combine : 'a array -> 'b array -> ('a * 'b) array

        combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

        • since 4.13

        Sorting and shuffling

        val sort : cmp:('a -> 'a -> int) -> 'a array -> unit

        Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if i >= j
        val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

        val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        val shuffle : rand:(int -> int) -> 'a array -> unit

        shuffle ~rand a randomly permutes a's element using rand for randomness. The distribution of permutations is uniform.

        rand must be such that a call to rand n returns a uniformly distributed random number in the range [0;n-1]. Random.int can be used for this (do not forget to initialize the generator).

        • since 5.2

        Arrays and Sequences

        val to_seq : 'a array -> 'a Seq.t

        Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : 'a array -> (int * 'a) Seq.t

        Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a array

        Create an array from the generator

        • since 4.07

        Arrays and concurrency safety

        Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
         let a = ArrayLabels.make size 1
         let d1 = Domain.spawn (fun () ->
            ArrayLabels.iteri ~f:(fun i x -> a.(i) <- x + 1) a
        diff --git a/ocaml/Stdlib/Atomic/index.html b/ocaml/Stdlib/Atomic/index.html
        index b148c223..21c58c4e 100644
        --- a/ocaml/Stdlib/Atomic/index.html
        +++ b/ocaml/Stdlib/Atomic/index.html
        @@ -1,5 +1,5 @@
         
        -Atomic (ocaml.Stdlib.Atomic)

        Module Stdlib.Atomic

        Atomic references.

        See the examples below. See 'Memory model: The hard bits' chapter in the manual.

        • since 4.12
        type !'a t

        An atomic (mutable) reference to a value of type 'a.

        val make : 'a -> 'a t

        Create an atomic reference.

        val get : 'a t -> 'a

        Get the current value of the atomic reference.

        val set : 'a t -> 'a -> unit

        Set a new value for the atomic reference.

        val exchange : 'a t -> 'a -> 'a

        Set a new value for the atomic reference, and return the current value.

        val compare_and_set : 'a t -> 'a -> 'a -> bool

        compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

        val fetch_and_add : int t -> int -> int

        fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

        val incr : int t -> unit

        incr r atomically increments the value of r by 1.

        val decr : int t -> unit

        decr r atomically decrements the value of r by 1.

        Examples

        Basic Thread Coordination

        A basic use case is to have global counters that are updated in a thread-safe way, for example to keep some sorts of metrics over IOs performed by the program. Another basic use case is to coordinate the termination of threads in a given program, for example when one thread finds an answer, or when the program is shut down by the user.

        Here, for example, we're going to try to find a number whose hash satisfies a basic property. To do that, we'll run multiple threads which will try random numbers until they find one that works.

        Of course the output below is a sample run and will change every time the program is run.

        (* use for termination *)
        +Atomic (ocaml.Stdlib.Atomic)

        Module Stdlib.Atomic

        Atomic references.

        See the examples below. See 'Memory model: The hard bits' chapter in the manual.

        • since 4.12
        type !'a t

        An atomic (mutable) reference to a value of type 'a.

        val make : 'a -> 'a t

        Create an atomic reference.

        val make_contended : 'a -> 'a t

        Create an atomic reference that is alone on a cache line. It occupies 4-16x the memory of one allocated with make v.

        The primary purpose is to prevent false-sharing and the resulting performance degradation. When a CPU performs an atomic operation, it temporarily takes ownership of an entire cache line that contains the atomic reference. If multiple atomic references share the same cache line, modifying these disjoint memory regions simultaneously becomes impossible, which can create a bottleneck. Hence, as a general guideline, if an atomic reference is experiencing contention, assigning it its own cache line may enhance performance.

        val get : 'a t -> 'a

        Get the current value of the atomic reference.

        val set : 'a t -> 'a -> unit

        Set a new value for the atomic reference.

        val exchange : 'a t -> 'a -> 'a

        Set a new value for the atomic reference, and return the current value.

        val compare_and_set : 'a t -> 'a -> 'a -> bool

        compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

        val fetch_and_add : int t -> int -> int

        fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

        val incr : int t -> unit

        incr r atomically increments the value of r by 1.

        val decr : int t -> unit

        decr r atomically decrements the value of r by 1.

        Examples

        Basic Thread Coordination

        A basic use case is to have global counters that are updated in a thread-safe way, for example to keep some sorts of metrics over IOs performed by the program. Another basic use case is to coordinate the termination of threads in a given program, for example when one thread finds an answer, or when the program is shut down by the user.

        Here, for example, we're going to try to find a number whose hash satisfies a basic property. To do that, we'll run multiple threads which will try random numbers until they find one that works.

        Of course the output below is a sample run and will change every time the program is run.

        (* use for termination *)
         let stop_all_threads = Atomic.make false
         
         (* total number of individual attempts to find a number *)
        diff --git a/ocaml/Stdlib/Bigarray/index.html b/ocaml/Stdlib/Bigarray/index.html
        index 464dbd30..ccf339ad 100644
        --- a/ocaml/Stdlib/Bigarray/index.html
        +++ b/ocaml/Stdlib/Bigarray/index.html
        @@ -1,12 +1,13 @@
         
        -Bigarray (ocaml.Stdlib.Bigarray)

        Module Stdlib.Bigarray

        Large, multi-dimensional, numerical arrays.

        This module implements multi-dimensional arrays of integers and floating-point numbers, thereafter referred to as 'Bigarrays', to distinguish them from the standard OCaml arrays described in Array.

        The implementation allows efficient sharing of large numerical arrays between OCaml code and C or Fortran numerical libraries.

        The main differences between 'Bigarrays' and standard OCaml arrays are as follows:

        • Bigarrays are not limited in size, unlike OCaml arrays. (Normal float arrays are limited to 2,097,151 elements on a 32-bit platform, and normal arrays of other types to 4,194,303 elements.)
        • Bigarrays are multi-dimensional. Any number of dimensions between 0 and 16 is supported. In contrast, OCaml arrays are mono-dimensional and require encoding multi-dimensional arrays as arrays of arrays.
        • Bigarrays can only contain integers and floating-point numbers, while OCaml arrays can contain arbitrary OCaml data types.
        • Bigarrays provide more space-efficient storage of integer and floating-point elements than normal OCaml arrays, in particular because they support 'small' types such as single-precision floats and 8 and 16-bit integers, in addition to the standard OCaml types of double-precision floats and 32 and 64-bit integers.
        • The memory layout of Bigarrays is entirely compatible with that of arrays in C and Fortran, allowing large arrays to be passed back and forth between OCaml code and C / Fortran code with no data copying at all.
        • Bigarrays support interesting high-level operations that normal arrays do not provide efficiently, such as extracting sub-arrays and 'slicing' a multi-dimensional array along certain dimensions, all without any copying.

        Users of this module are encouraged to do open Bigarray in their source, then refer to array types and operations via short dot notation, e.g. Array1.t or Array2.sub.

        Bigarrays support all the OCaml ad-hoc polymorphic operations:

        Element kinds

        Bigarrays can contain elements of the following kinds:

        Each element kind is represented at the type level by one of the *_elt types defined below (defined with a single constructor instead of abstract types for technical injectivity reasons).

        • since 4.07 Moved from otherlibs to stdlib.
        type float32_elt =
        1. | Float32_elt
        type float64_elt =
        1. | Float64_elt
        type int8_signed_elt =
        1. | Int8_signed_elt
        type int8_unsigned_elt =
        1. | Int8_unsigned_elt
        type int16_signed_elt =
        1. | Int16_signed_elt
        type int16_unsigned_elt =
        1. | Int16_unsigned_elt
        type int32_elt =
        1. | Int32_elt
        type int64_elt =
        1. | Int64_elt
        type int_elt =
        1. | Int_elt
        type nativeint_elt =
        1. | Nativeint_elt
        type complex32_elt =
        1. | Complex32_elt
        type complex64_elt =
        1. | Complex64_elt
        type ('a, 'b) kind =
        1. | Float32 : (float, float32_elt) kind
        2. | Float64 : (float, float64_elt) kind
        3. | Int8_signed : (int, int8_signed_elt) kind
        4. | Int8_unsigned : (int, int8_unsigned_elt) kind
        5. | Int16_signed : (int, int16_signed_elt) kind
        6. | Int16_unsigned : (int, int16_unsigned_elt) kind
        7. | Int32 : (int32, int32_elt) kind
        8. | Int64 : (int64, int64_elt) kind
        9. | Int : (int, int_elt) kind
        10. | Nativeint : (nativeint, nativeint_elt) kind
        11. | Complex32 : (Complex.t, complex32_elt) kind
        12. | Complex64 : (Complex.t, complex64_elt) kind
        13. | Char : (char, int8_unsigned_elt) kind

        To each element kind is associated an OCaml type, which is the type of OCaml values that can be stored in the Bigarray or read back from it. This type is not necessarily the same as the type of the array elements proper: for instance, a Bigarray whose elements are of kind float32_elt contains 32-bit single precision floats, but reading or writing one of its elements from OCaml uses the OCaml type float, which is 64-bit double precision floats.

        The GADT type ('a, 'b) kind captures this association of an OCaml type 'a for values read or written in the Bigarray, and of an element kind 'b which represents the actual contents of the Bigarray. Its constructors list all possible associations of OCaml types with element kinds, and are re-exported below for backward-compatibility reasons.

        Using a generalized algebraic datatype (GADT) here allows writing well-typed polymorphic functions whose return type depend on the argument type, such as:

        let zero : type a b. (a, b) kind -> a = function
        +Bigarray (ocaml.Stdlib.Bigarray)

        Module Stdlib.Bigarray

        Large, multi-dimensional, numerical arrays.

        This module implements multi-dimensional arrays of integers and floating-point numbers, thereafter referred to as 'Bigarrays', to distinguish them from the standard OCaml arrays described in Array.

        The implementation allows efficient sharing of large numerical arrays between OCaml code and C or Fortran numerical libraries.

        The main differences between 'Bigarrays' and standard OCaml arrays are as follows:

        • Bigarrays are not limited in size, unlike OCaml arrays. (Normal float arrays are limited to 2,097,151 elements on a 32-bit platform, and normal arrays of other types to 4,194,303 elements.)
        • Bigarrays are multi-dimensional. Any number of dimensions between 0 and 16 is supported. In contrast, OCaml arrays are mono-dimensional and require encoding multi-dimensional arrays as arrays of arrays.
        • Bigarrays can only contain integers and floating-point numbers, while OCaml arrays can contain arbitrary OCaml data types.
        • Bigarrays provide more space-efficient storage of integer and floating-point elements than normal OCaml arrays, in particular because they support 'small' types such as single-precision floats and 8 and 16-bit integers, in addition to the standard OCaml types of double-precision floats and 32 and 64-bit integers.
        • The memory layout of Bigarrays is entirely compatible with that of arrays in C and Fortran, allowing large arrays to be passed back and forth between OCaml code and C / Fortran code with no data copying at all.
        • Bigarrays support interesting high-level operations that normal arrays do not provide efficiently, such as extracting sub-arrays and 'slicing' a multi-dimensional array along certain dimensions, all without any copying.

        Users of this module are encouraged to do open Bigarray in their source, then refer to array types and operations via short dot notation, e.g. Array1.t or Array2.sub.

        Bigarrays support all the OCaml ad-hoc polymorphic operations:

        Element kinds

        Bigarrays can contain elements of the following kinds:

        Each element kind is represented at the type level by one of the *_elt types defined below (defined with a single constructor instead of abstract types for technical injectivity reasons).

        • since 4.07 Moved from otherlibs to stdlib.
        • since 5.2 Added float16_elt element kind.
        type float16_elt =
        1. | Float16_elt
        type float32_elt =
        1. | Float32_elt
        type float64_elt =
        1. | Float64_elt
        type int8_signed_elt =
        1. | Int8_signed_elt
        type int8_unsigned_elt =
        1. | Int8_unsigned_elt
        type int16_signed_elt =
        1. | Int16_signed_elt
        type int16_unsigned_elt =
        1. | Int16_unsigned_elt
        type int32_elt =
        1. | Int32_elt
        type int64_elt =
        1. | Int64_elt
        type int_elt =
        1. | Int_elt
        type nativeint_elt =
        1. | Nativeint_elt
        type complex32_elt =
        1. | Complex32_elt
        type complex64_elt =
        1. | Complex64_elt
        type ('a, 'b) kind =
        1. | Float32 : (float, float32_elt) kind
        2. | Float64 : (float, float64_elt) kind
        3. | Int8_signed : (int, int8_signed_elt) kind
        4. | Int8_unsigned : (int, int8_unsigned_elt) kind
        5. | Int16_signed : (int, int16_signed_elt) kind
        6. | Int16_unsigned : (int, int16_unsigned_elt) kind
        7. | Int32 : (int32, int32_elt) kind
        8. | Int64 : (int64, int64_elt) kind
        9. | Int : (int, int_elt) kind
        10. | Nativeint : (nativeint, nativeint_elt) kind
        11. | Complex32 : (Complex.t, complex32_elt) kind
        12. | Complex64 : (Complex.t, complex64_elt) kind
        13. | Char : (char, int8_unsigned_elt) kind
        14. | Float16 : (float, float16_elt) kind

        To each element kind is associated an OCaml type, which is the type of OCaml values that can be stored in the Bigarray or read back from it. This type is not necessarily the same as the type of the array elements proper: for instance, a Bigarray whose elements are of kind float32_elt contains 32-bit single precision floats, but reading or writing one of its elements from OCaml uses the OCaml type float, which is 64-bit double precision floats.

        The GADT type ('a, 'b) kind captures this association of an OCaml type 'a for values read or written in the Bigarray, and of an element kind 'b which represents the actual contents of the Bigarray. Its constructors list all possible associations of OCaml types with element kinds, and are re-exported below for backward-compatibility reasons.

        Using a generalized algebraic datatype (GADT) here allows writing well-typed polymorphic functions whose return type depend on the argument type, such as:

        let zero : type a b. (a, b) kind -> a = function
           | Float32 -> 0.0 | Complex32 -> Complex.zero
           | Float64 -> 0.0 | Complex64 -> Complex.zero
        +  | Float16 -> 0.0
           | Int8_signed -> 0 | Int8_unsigned -> 0
           | Int16_signed -> 0 | Int16_unsigned -> 0
           | Int32 -> 0l | Int64 -> 0L
           | Int -> 0 | Nativeint -> 0n
        -  | Char -> '\000'
        val float32 : (float, float32_elt) kind
        val float64 : (float, float64_elt) kind
        val complex32 : (Complex.t, complex32_elt) kind
        val complex64 : (Complex.t, complex64_elt) kind
        val int8_signed : (int, int8_signed_elt) kind
        val int8_unsigned : (int, int8_unsigned_elt) kind
        val int16_signed : (int, int16_signed_elt) kind
        val int16_unsigned : (int, int16_unsigned_elt) kind
        val int : (int, int_elt) kind
        val int32 : (int32, int32_elt) kind
        val int64 : (int64, int64_elt) kind
        val nativeint : (nativeint, nativeint_elt) kind
        val char : (char, int8_unsigned_elt) kind

        As shown by the types of the values above, Bigarrays of kind float32_elt and float64_elt are accessed using the OCaml type float. Bigarrays of complex kinds complex32_elt, complex64_elt are accessed with the OCaml type Complex.t. Bigarrays of integer kinds are accessed using the smallest OCaml integer type large enough to represent the array elements: int for 8- and 16-bit integer Bigarrays, as well as OCaml-integer Bigarrays; int32 for 32-bit integer Bigarrays; int64 for 64-bit integer Bigarrays; and nativeint for platform-native integer Bigarrays. Finally, Bigarrays of kind int8_unsigned_elt can also be accessed as arrays of characters instead of arrays of small integers, by using the kind value char instead of int8_unsigned.

        val kind_size_in_bytes : ('a, 'b) kind -> int

        kind_size_in_bytes k is the number of bytes used to store an element of type k.

        • since 4.03

        Array layouts

        type c_layout =
        1. | C_layout_typ
        type fortran_layout =
        1. | Fortran_layout_typ

        To facilitate interoperability with existing C and Fortran code, this library supports two different memory layouts for Bigarrays, one compatible with the C conventions, the other compatible with the Fortran conventions.

        In the C-style layout, array indices start at 0, and multi-dimensional arrays are laid out in row-major format. That is, for a two-dimensional array, all elements of row 0 are contiguous in memory, followed by all elements of row 1, etc. In other terms, the array elements at (x,y) and (x, y+1) are adjacent in memory.

        In the Fortran-style layout, array indices start at 1, and multi-dimensional arrays are laid out in column-major format. That is, for a two-dimensional array, all elements of column 0 are contiguous in memory, followed by all elements of column 1, etc. In other terms, the array elements at (x,y) and (x+1, y) are adjacent in memory.

        Each layout style is identified at the type level by the phantom types Bigarray.c_layout and Bigarray.fortran_layout respectively.

        Supported layouts

        The GADT type 'a layout represents one of the two supported memory layouts: C-style or Fortran-style. Its constructors are re-exported as values below for backward-compatibility reasons.

        type 'a layout =
        1. | C_layout : c_layout layout
        2. | Fortran_layout : fortran_layout layout
        val c_layout : c_layout layout
        val fortran_layout : fortran_layout layout

        Generic arrays (of arbitrarily many dimensions)

        module Genarray : sig ... end

        Zero-dimensional arrays

        module Array0 : sig ... end

        Zero-dimensional arrays. The Array0 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of zero-dimensional arrays that only contain a single scalar value. Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

        One-dimensional arrays

        module Array1 : sig ... end

        One-dimensional arrays. The Array1 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of one-dimensional arrays. (The Array2 and Array3 structures below provide operations specialized for two- and three-dimensional arrays.) Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

        Two-dimensional arrays

        module Array2 : sig ... end

        Two-dimensional arrays. The Array2 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of two-dimensional arrays.

        Three-dimensional arrays

        module Array3 : sig ... end

        Three-dimensional arrays. The Array3 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of three-dimensional arrays.

        Coercions between generic Bigarrays and fixed-dimension Bigarrays

        val genarray_of_array0 : ('a, 'b, 'c) Array0.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given zero-dimensional Bigarray.

        • since 4.05
        val genarray_of_array1 : ('a, 'b, 'c) Array1.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given one-dimensional Bigarray.

        val genarray_of_array2 : ('a, 'b, 'c) Array2.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given two-dimensional Bigarray.

        val genarray_of_array3 : ('a, 'b, 'c) Array3.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given three-dimensional Bigarray.

        val array0_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

        Return the zero-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly zero dimension.

        • since 4.05
        val array1_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array1.t

        Return the one-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly one dimension.

        val array2_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array2.t

        Return the two-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly two dimensions.

        val array3_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array3.t

        Return the three-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly three dimensions.

        Re-shaping Bigarrays

        val reshape : ('a, 'b, 'c) Genarray.t -> int array -> ('a, 'b, 'c) Genarray.t

        reshape b [|d1;...;dN|] converts the Bigarray b to a N-dimensional array of dimensions d1...dN. The returned array and the original array b share their data and have the same layout. For instance, assuming that b is a one-dimensional array of dimension 12, reshape b [|3;4|] returns a two-dimensional array b' of dimensions 3 and 4. If b has C layout, the element (x,y) of b' corresponds to the element x * 3 + y of b. If b has Fortran layout, the element (x,y) of b' corresponds to the element x + (y - 1) * 4 of b. The returned Bigarray must have exactly the same number of elements as the original Bigarray b. That is, the product of the dimensions of b must be equal to i1 * ... * iN. Otherwise, Invalid_argument is raised.

        val reshape_0 : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

        Specialized version of Bigarray.reshape for reshaping to zero-dimensional arrays.

        • since 4.05
        val reshape_1 : ('a, 'b, 'c) Genarray.t -> int -> ('a, 'b, 'c) Array1.t

        Specialized version of Bigarray.reshape for reshaping to one-dimensional arrays.

        val reshape_2 : ('a, 'b, 'c) Genarray.t -> int -> int -> ('a, 'b, 'c) Array2.t

        Specialized version of Bigarray.reshape for reshaping to two-dimensional arrays.

        val reshape_3 : + | Char -> '\000'
        • since 5.2 Constructor Float16 for the GADT.
        val float16 : (float, float16_elt) kind

        See Bigarray.char.

        • since 5.2
        val float32 : (float, float32_elt) kind
        val float64 : (float, float64_elt) kind
        val complex32 : (Complex.t, complex32_elt) kind
        val complex64 : (Complex.t, complex64_elt) kind
        val int8_signed : (int, int8_signed_elt) kind
        val int8_unsigned : (int, int8_unsigned_elt) kind
        val int16_signed : (int, int16_signed_elt) kind
        val int16_unsigned : (int, int16_unsigned_elt) kind
        val int : (int, int_elt) kind

        See Bigarray.char and Element kinds.

        Beware that this is a bigarray containing OCaml integers (signed, 31 bits on 32-bit architectures, 63 bits on 64-bit architectures), which does not match the C int type.

        val int32 : (int32, int32_elt) kind
        val int64 : (int64, int64_elt) kind
        val nativeint : (nativeint, nativeint_elt) kind
        val char : (char, int8_unsigned_elt) kind

        As shown by the types of the values above, Bigarrays of kind float16_elt, float32_elt and float64_elt are accessed using the OCaml type float. Bigarrays of complex kinds complex32_elt, complex64_elt are accessed with the OCaml type Complex.t. Bigarrays of integer kinds are accessed using the smallest OCaml integer type large enough to represent the array elements: int for 8- and 16-bit integer Bigarrays, as well as OCaml-integer Bigarrays; int32 for 32-bit integer Bigarrays; int64 for 64-bit integer Bigarrays; and nativeint for platform-native integer Bigarrays. Finally, Bigarrays of kind int8_unsigned_elt can also be accessed as arrays of characters instead of arrays of small integers, by using the kind value char instead of int8_unsigned.

        val kind_size_in_bytes : ('a, 'b) kind -> int

        kind_size_in_bytes k is the number of bytes used to store an element of type k.

        • since 4.03

        Array layouts

        type c_layout =
        1. | C_layout_typ
        type fortran_layout =
        1. | Fortran_layout_typ

        To facilitate interoperability with existing C and Fortran code, this library supports two different memory layouts for Bigarrays, one compatible with the C conventions, the other compatible with the Fortran conventions.

        In the C-style layout, array indices start at 0, and multi-dimensional arrays are laid out in row-major format. That is, for a two-dimensional array, all elements of row 0 are contiguous in memory, followed by all elements of row 1, etc. In other terms, the array elements at (x,y) and (x, y+1) are adjacent in memory.

        In the Fortran-style layout, array indices start at 1, and multi-dimensional arrays are laid out in column-major format. That is, for a two-dimensional array, all elements of column 0 are contiguous in memory, followed by all elements of column 1, etc. In other terms, the array elements at (x,y) and (x+1, y) are adjacent in memory.

        Each layout style is identified at the type level by the phantom types Bigarray.c_layout and Bigarray.fortran_layout respectively.

        Supported layouts

        The GADT type 'a layout represents one of the two supported memory layouts: C-style or Fortran-style. Its constructors are re-exported as values below for backward-compatibility reasons.

        type 'a layout =
        1. | C_layout : c_layout layout
        2. | Fortran_layout : fortran_layout layout
        val c_layout : c_layout layout
        val fortran_layout : fortran_layout layout

        Generic arrays (of arbitrarily many dimensions)

        module Genarray : sig ... end

        Zero-dimensional arrays

        module Array0 : sig ... end

        Zero-dimensional arrays. The Array0 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of zero-dimensional arrays that only contain a single scalar value. Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

        One-dimensional arrays

        module Array1 : sig ... end

        One-dimensional arrays. The Array1 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of one-dimensional arrays. (The Array2 and Array3 structures below provide operations specialized for two- and three-dimensional arrays.) Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

        Two-dimensional arrays

        module Array2 : sig ... end

        Two-dimensional arrays. The Array2 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of two-dimensional arrays.

        Three-dimensional arrays

        module Array3 : sig ... end

        Three-dimensional arrays. The Array3 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of three-dimensional arrays.

        Coercions between generic Bigarrays and fixed-dimension Bigarrays

        val genarray_of_array0 : ('a, 'b, 'c) Array0.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given zero-dimensional Bigarray.

        • since 4.05
        val genarray_of_array1 : ('a, 'b, 'c) Array1.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given one-dimensional Bigarray.

        val genarray_of_array2 : ('a, 'b, 'c) Array2.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given two-dimensional Bigarray.

        val genarray_of_array3 : ('a, 'b, 'c) Array3.t -> ('a, 'b, 'c) Genarray.t

        Return the generic Bigarray corresponding to the given three-dimensional Bigarray.

        val array0_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

        Return the zero-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly zero dimension.

        • since 4.05
        val array1_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array1.t

        Return the one-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly one dimension.

        val array2_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array2.t

        Return the two-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly two dimensions.

        val array3_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array3.t

        Return the three-dimensional Bigarray corresponding to the given generic Bigarray.

        • raises Invalid_argument

          if the generic Bigarray does not have exactly three dimensions.

        Re-shaping Bigarrays

        val reshape : ('a, 'b, 'c) Genarray.t -> int array -> ('a, 'b, 'c) Genarray.t

        reshape b [|d1;...;dN|] converts the Bigarray b to a N-dimensional array of dimensions d1...dN. The returned array and the original array b share their data and have the same layout. For instance, assuming that b is a one-dimensional array of dimension 12, reshape b [|3;4|] returns a two-dimensional array b' of dimensions 3 and 4. If b has C layout, the element (x,y) of b' corresponds to the element x * 3 + y of b. If b has Fortran layout, the element (x,y) of b' corresponds to the element x + (y - 1) * 4 of b. The returned Bigarray must have exactly the same number of elements as the original Bigarray b. That is, the product of the dimensions of b must be equal to i1 * ... * iN. Otherwise, Invalid_argument is raised.

        val reshape_0 : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

        Specialized version of Bigarray.reshape for reshaping to zero-dimensional arrays.

        • since 4.05
        val reshape_1 : ('a, 'b, 'c) Genarray.t -> int -> ('a, 'b, 'c) Array1.t

        Specialized version of Bigarray.reshape for reshaping to one-dimensional arrays.

        val reshape_2 : ('a, 'b, 'c) Genarray.t -> int -> int -> ('a, 'b, 'c) Array2.t

        Specialized version of Bigarray.reshape for reshaping to two-dimensional arrays.

        val reshape_3 : ('a, 'b, 'c) Genarray.t -> int -> int -> diff --git a/ocaml/Stdlib/Buffer/index.html b/ocaml/Stdlib/Buffer/index.html index 41e80e50..9e39dfaa 100644 --- a/ocaml/Stdlib/Buffer/index.html +++ b/ocaml/Stdlib/Buffer/index.html @@ -2,4 +2,4 @@ Buffer (ocaml.Stdlib.Buffer)

        Module Stdlib.Buffer

        Extensible buffers.

        This module implements buffers that automatically expand as necessary. It provides accumulative concatenation of strings in linear time (instead of quadratic time when strings are concatenated pairwise). For example:

        let concat_strings ss =
           let b = Buffer.create 16 in
             List.iter (Buffer.add_string b) ss;
        -    Buffer.contents b

        Unsynchronized accesses

        Unsynchronized accesses to a buffer may lead to an invalid buffer state. Thus, concurrent accesses to a buffer must be synchronized (for instance with a Mutex.t).

        type t

        The abstract type of buffers.

        val create : int -> t

        create n returns a fresh buffer, initially empty. The n parameter is the initial size of the internal byte sequence that holds the buffer contents. That byte sequence is automatically reallocated when more than n characters are stored in the buffer, but shrinks back to n characters when reset is called. For best performance, n should be of the same order of magnitude as the number of characters that are expected to be stored in the buffer (for instance, 80 for a buffer that holds one output line). Nothing bad will happen if the buffer grows beyond that limit, however. In doubt, take n = 16 for instance. If n is not between 1 and Sys.max_string_length, it will be clipped to that interval.

        val contents : t -> string

        Return a copy of the current contents of the buffer. The buffer itself is unchanged.

        val to_bytes : t -> bytes

        Return a copy of the current contents of the buffer. The buffer itself is unchanged.

        • since 4.02
        val sub : t -> int -> int -> string

        Buffer.sub b off len returns a copy of len bytes from the current contents of the buffer b, starting at offset off.

        val blit : t -> int -> bytes -> int -> int -> unit

        Buffer.blit src srcoff dst dstoff len copies len characters from the current contents of the buffer src, starting at offset srcoff to dst, starting at character dstoff.

        • raises Invalid_argument

          if srcoff and len do not designate a valid range of src, or if dstoff and len do not designate a valid range of dst.

        • since 3.11.2
        val nth : t -> int -> char

        Get the n-th character of the buffer.

        val length : t -> int

        Return the number of characters currently contained in the buffer.

        val clear : t -> unit

        Empty the buffer.

        val reset : t -> unit

        Empty the buffer and deallocate the internal byte sequence holding the buffer contents, replacing it with the initial internal byte sequence of length n that was allocated by Buffer.create n. For long-lived buffers that may have grown a lot, reset allows faster reclamation of the space used by the buffer.

        val output_buffer : out_channel -> t -> unit

        output_buffer oc b writes the current contents of buffer b on the output channel oc.

        val truncate : t -> int -> unit

        truncate b len truncates the length of b to len Note: the internal byte sequence is not shortened.

        • since 4.05

        Appending

        Note: all add_* operations can raise Failure if the internal byte sequence of the buffer would need to grow beyond Sys.max_string_length.

        val add_char : t -> char -> unit

        add_char b c appends the character c at the end of buffer b.

        val add_utf_8_uchar : t -> Uchar.t -> unit

        add_utf_8_uchar b u appends the UTF-8 encoding of u at the end of buffer b.

        • since 4.06
        val add_utf_16le_uchar : t -> Uchar.t -> unit

        add_utf_16le_uchar b u appends the UTF-16LE encoding of u at the end of buffer b.

        • since 4.06
        val add_utf_16be_uchar : t -> Uchar.t -> unit

        add_utf_16be_uchar b u appends the UTF-16BE encoding of u at the end of buffer b.

        • since 4.06
        val add_string : t -> string -> unit

        add_string b s appends the string s at the end of buffer b.

        val add_bytes : t -> bytes -> unit

        add_bytes b s appends the byte sequence s at the end of buffer b.

        • since 4.02
        val add_substring : t -> string -> int -> int -> unit

        add_substring b s ofs len takes len characters from offset ofs in string s and appends them at the end of buffer b.

        val add_subbytes : t -> bytes -> int -> int -> unit

        add_subbytes b s ofs len takes len characters from offset ofs in byte sequence s and appends them at the end of buffer b.

        • since 4.02
        val add_substitute : t -> (string -> string) -> string -> unit

        add_substitute b f s appends the string pattern s at the end of buffer b with substitution. The substitution process looks for variables into the pattern and substitutes each variable name by its value, as obtained by applying the mapping f to the variable name. Inside the string pattern, a variable name immediately follows a non-escaped $ character and is one of the following:

        • a non empty sequence of alphanumeric or _ characters,
        • an arbitrary sequence of characters enclosed by a pair of matching parentheses or curly brackets. An escaped $ character is a $ that immediately follows a backslash character; it then stands for a plain $.
        • raises Not_found

          if the closing character of a parenthesized variable cannot be found.

        val add_buffer : t -> t -> unit

        add_buffer b1 b2 appends the current contents of buffer b2 at the end of buffer b1. b2 is not modified.

        val add_channel : t -> in_channel -> int -> unit

        add_channel b ic n reads at most n characters from the input channel ic and stores them at the end of buffer b.

        • raises End_of_file

          if the channel contains fewer than n characters. In this case, the characters are still added to the buffer, so as to avoid loss of data.

        Buffers and Sequences

        val to_seq : t -> char Seq.t

        Iterate on the buffer, in increasing order.

        The behavior is not specified if the buffer is modified during iteration.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        Iterate on the buffer, in increasing order, yielding indices along chars.

        The behavior is not specified if the buffer is modified during iteration.

        • since 4.07
        val add_seq : t -> char Seq.t -> unit

        Add chars to the buffer

        • since 4.07
        val of_seq : char Seq.t -> t

        Create a buffer from the generator

        • since 4.07

        Binary encoding of integers

        The functions in this section append binary encodings of integers to buffers.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. Functions that encode these values truncate their inputs to their least significant bytes.

        val add_uint8 : t -> int -> unit

        add_uint8 b i appends a binary unsigned 8-bit integer i to b.

        • since 4.08
        val add_int8 : t -> int -> unit

        add_int8 b i appends a binary signed 8-bit integer i to b.

        • since 4.08
        val add_uint16_ne : t -> int -> unit

        add_uint16_ne b i appends a binary native-endian unsigned 16-bit integer i to b.

        • since 4.08
        val add_uint16_be : t -> int -> unit

        add_uint16_be b i appends a binary big-endian unsigned 16-bit integer i to b.

        • since 4.08
        val add_uint16_le : t -> int -> unit

        add_uint16_le b i appends a binary little-endian unsigned 16-bit integer i to b.

        • since 4.08
        val add_int16_ne : t -> int -> unit

        add_int16_ne b i appends a binary native-endian signed 16-bit integer i to b.

        • since 4.08
        val add_int16_be : t -> int -> unit

        add_int16_be b i appends a binary big-endian signed 16-bit integer i to b.

        • since 4.08
        val add_int16_le : t -> int -> unit

        add_int16_le b i appends a binary little-endian signed 16-bit integer i to b.

        • since 4.08
        val add_int32_ne : t -> int32 -> unit

        add_int32_ne b i appends a binary native-endian 32-bit integer i to b.

        • since 4.08
        val add_int32_be : t -> int32 -> unit

        add_int32_be b i appends a binary big-endian 32-bit integer i to b.

        • since 4.08
        val add_int32_le : t -> int32 -> unit

        add_int32_le b i appends a binary little-endian 32-bit integer i to b.

        • since 4.08
        val add_int64_ne : t -> int64 -> unit

        add_int64_ne b i appends a binary native-endian 64-bit integer i to b.

        • since 4.08
        val add_int64_be : t -> int64 -> unit

        add_int64_be b i appends a binary big-endian 64-bit integer i to b.

        • since 4.08
        val add_int64_le : t -> int64 -> unit

        add_int64_ne b i appends a binary little-endian 64-bit integer i to b.

        • since 4.08
        + Buffer.contents b

        Unsynchronized accesses

        Unsynchronized accesses to a buffer may lead to an invalid buffer state. Thus, concurrent accesses to a buffer must be synchronized (for instance with a Mutex.t).

        type t

        The abstract type of buffers.

        val create : int -> t

        create n returns a fresh buffer, initially empty. The n parameter is the initial size of the internal byte sequence that holds the buffer contents. That byte sequence is automatically reallocated when more than n characters are stored in the buffer, but shrinks back to n characters when reset is called. For best performance, n should be of the same order of magnitude as the number of characters that are expected to be stored in the buffer (for instance, 80 for a buffer that holds one output line). Nothing bad will happen if the buffer grows beyond that limit, however. In doubt, take n = 16 for instance. If n is not between 1 and Sys.max_string_length, it will be clipped to that interval.

        val contents : t -> string

        Return a copy of the current contents of the buffer. The buffer itself is unchanged.

        val to_bytes : t -> bytes

        Return a copy of the current contents of the buffer. The buffer itself is unchanged.

        • since 4.02
        val sub : t -> int -> int -> string

        Buffer.sub b off len returns a copy of len bytes from the current contents of the buffer b, starting at offset off.

        val blit : t -> int -> bytes -> int -> int -> unit

        Buffer.blit src srcoff dst dstoff len copies len characters from the current contents of the buffer src, starting at offset srcoff to dst, starting at character dstoff.

        • raises Invalid_argument

          if srcoff and len do not designate a valid range of src, or if dstoff and len do not designate a valid range of dst.

        • since 3.11.2
        val nth : t -> int -> char

        Get the n-th character of the buffer.

        val length : t -> int

        Return the number of characters currently contained in the buffer.

        val clear : t -> unit

        Empty the buffer.

        val reset : t -> unit

        Empty the buffer and deallocate the internal byte sequence holding the buffer contents, replacing it with the initial internal byte sequence of length n that was allocated by Buffer.create n. For long-lived buffers that may have grown a lot, reset allows faster reclamation of the space used by the buffer.

        val output_buffer : out_channel -> t -> unit

        output_buffer oc b writes the current contents of buffer b on the output channel oc.

        val truncate : t -> int -> unit

        truncate b len truncates the length of b to len Note: the internal byte sequence is not shortened.

        • since 4.05

        Appending

        Note: all add_* operations can raise Failure if the internal byte sequence of the buffer would need to grow beyond Sys.max_string_length.

        val add_char : t -> char -> unit

        add_char b c appends the character c at the end of buffer b.

        val add_utf_8_uchar : t -> Uchar.t -> unit

        add_utf_8_uchar b u appends the UTF-8 encoding of u at the end of buffer b.

        • since 4.06
        val add_utf_16le_uchar : t -> Uchar.t -> unit

        add_utf_16le_uchar b u appends the UTF-16LE encoding of u at the end of buffer b.

        • since 4.06
        val add_utf_16be_uchar : t -> Uchar.t -> unit

        add_utf_16be_uchar b u appends the UTF-16BE encoding of u at the end of buffer b.

        • since 4.06
        val add_string : t -> string -> unit

        add_string b s appends the string s at the end of buffer b.

        val add_bytes : t -> bytes -> unit

        add_bytes b s appends the byte sequence s at the end of buffer b.

        • since 4.02
        val add_substring : t -> string -> int -> int -> unit

        add_substring b s ofs len takes len characters from offset ofs in string s and appends them at the end of buffer b.

        val add_subbytes : t -> bytes -> int -> int -> unit

        add_subbytes b s ofs len takes len characters from offset ofs in byte sequence s and appends them at the end of buffer b.

        • since 4.02
        val add_substitute : t -> (string -> string) -> string -> unit

        add_substitute b f s appends the string pattern s at the end of buffer b with substitution. The substitution process looks for variable references in the pattern and substitutes each variable reference with its value, as obtained by applying the mapping f to the variable name. Inside the string pattern, a variable reference is a non-escaped $ immediately followed by a variable name, which is one of the following:

        • a non empty sequence of alphanumeric or _ characters,
        • an arbitrary sequence of characters enclosed by a pair of matching parentheses or curly brackets. An escaped $ character is a $ that immediately follows a backslash character; the two characters together stand for a plain $.
        val add_buffer : t -> t -> unit

        add_buffer b1 b2 appends the current contents of buffer b2 at the end of buffer b1. b2 is not modified.

        val add_channel : t -> in_channel -> int -> unit

        add_channel b ic n reads at most n characters from the input channel ic and stores them at the end of buffer b.

        • raises End_of_file

          if the channel contains fewer than n characters. In this case, the characters are still added to the buffer, so as to avoid loss of data.

        Buffers and Sequences

        val to_seq : t -> char Seq.t

        Iterate on the buffer, in increasing order.

        The behavior is not specified if the buffer is modified during iteration.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        Iterate on the buffer, in increasing order, yielding indices along chars.

        The behavior is not specified if the buffer is modified during iteration.

        • since 4.07
        val add_seq : t -> char Seq.t -> unit

        Add chars to the buffer

        • since 4.07
        val of_seq : char Seq.t -> t

        Create a buffer from the generator

        • since 4.07

        Binary encoding of integers

        The functions in this section append binary encodings of integers to buffers.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. Functions that encode these values truncate their inputs to their least significant bytes.

        val add_uint8 : t -> int -> unit

        add_uint8 b i appends a binary unsigned 8-bit integer i to b.

        • since 4.08
        val add_int8 : t -> int -> unit

        add_int8 b i appends a binary signed 8-bit integer i to b.

        • since 4.08
        val add_uint16_ne : t -> int -> unit

        add_uint16_ne b i appends a binary native-endian unsigned 16-bit integer i to b.

        • since 4.08
        val add_uint16_be : t -> int -> unit

        add_uint16_be b i appends a binary big-endian unsigned 16-bit integer i to b.

        • since 4.08
        val add_uint16_le : t -> int -> unit

        add_uint16_le b i appends a binary little-endian unsigned 16-bit integer i to b.

        • since 4.08
        val add_int16_ne : t -> int -> unit

        add_int16_ne b i appends a binary native-endian signed 16-bit integer i to b.

        • since 4.08
        val add_int16_be : t -> int -> unit

        add_int16_be b i appends a binary big-endian signed 16-bit integer i to b.

        • since 4.08
        val add_int16_le : t -> int -> unit

        add_int16_le b i appends a binary little-endian signed 16-bit integer i to b.

        • since 4.08
        val add_int32_ne : t -> int32 -> unit

        add_int32_ne b i appends a binary native-endian 32-bit integer i to b.

        • since 4.08
        val add_int32_be : t -> int32 -> unit

        add_int32_be b i appends a binary big-endian 32-bit integer i to b.

        • since 4.08
        val add_int32_le : t -> int32 -> unit

        add_int32_le b i appends a binary little-endian 32-bit integer i to b.

        • since 4.08
        val add_int64_ne : t -> int64 -> unit

        add_int64_ne b i appends a binary native-endian 64-bit integer i to b.

        • since 4.08
        val add_int64_be : t -> int64 -> unit

        add_int64_be b i appends a binary big-endian 64-bit integer i to b.

        • since 4.08
        val add_int64_le : t -> int64 -> unit

        add_int64_ne b i appends a binary little-endian 64-bit integer i to b.

        • since 4.08
        diff --git a/ocaml/Stdlib/Bytes/index.html b/ocaml/Stdlib/Bytes/index.html index b411beda..d72e1900 100644 --- a/ocaml/Stdlib/Bytes/index.html +++ b/ocaml/Stdlib/Bytes/index.html @@ -1,12 +1,12 @@ Bytes (ocaml.Stdlib.Bytes)

        Module Stdlib.Bytes

        Byte sequence operations.

        A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing.

        Given a byte sequence s of length l, we can access each of the l bytes of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the byte at index n is between positions n and n+1.

        Two parameters start and len are said to designate a valid range of s if len >= 0 and start and start+len are valid positions in s.

        Byte sequences can be modified in place, for instance via the set and blit functions described below. See also strings (module String), which are almost the same data structure, but cannot be modified in place.

        Bytes are represented by the OCaml type char.

        The labeled version of this module can be used as described in the StdLabels module.

        • since 4.02
        val length : bytes -> int

        Return the length (number of bytes) of the argument.

        val get : bytes -> int -> char

        get s n returns the byte at index n in argument s.

        val set : bytes -> int -> char -> unit

        set s n c modifies s in place, replacing the byte at index n with c.

        val create : int -> bytes

        create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

        val make : int -> char -> bytes

        make n c returns a new byte sequence of length n, filled with the byte c.

        val init : int -> (int -> char) -> bytes

        init n f returns a fresh byte sequence of length n, with character i initialized to the result of f i (in increasing index order).

        val empty : bytes

        A byte sequence of size 0.

        val copy : bytes -> bytes

        Return a new byte sequence that contains the same bytes as the argument.

        val of_string : string -> bytes

        Return a new byte sequence that contains the same bytes as the given string.

        val to_string : bytes -> string

        Return a new string that contains the same bytes as the given byte sequence.

        val sub : bytes -> int -> int -> bytes

        sub s pos len returns a new byte sequence of length len, containing the subsequence of s that starts at position pos and has length len.

        val sub_string : bytes -> int -> int -> string

        Same as sub but return a string instead of a byte sequence.

        val extend : bytes -> int -> int -> bytes

        extend s left right returns a new byte sequence that contains the bytes of s, with left uninitialized bytes prepended and right uninitialized bytes appended to it. If left or right is negative, then bytes are removed (instead of appended) from the corresponding side of s.

        • since 4.05 in BytesLabels
        val fill : bytes -> int -> int -> char -> unit

        fill s pos len c modifies s in place, replacing len characters with c, starting at pos.

        val blit : bytes -> int -> bytes -> int -> int -> unit

        blit src src_pos dst dst_pos len copies len bytes from byte sequence src, starting at index src_pos, to byte sequence dst, starting at index dst_pos. It works correctly even if src and dst are the same byte sequence, and the source and destination intervals overlap.

        • raises Invalid_argument

          if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

        val blit_string : string -> int -> bytes -> int -> int -> unit

        blit_string src src_pos dst dst_pos len copies len bytes from string src, starting at index src_pos, to byte sequence dst, starting at index dst_pos.

        • raises Invalid_argument

          if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

        • since 4.05 in BytesLabels
        val concat : bytes -> bytes list -> bytes

        concat sep sl concatenates the list of byte sequences sl, inserting the separator byte sequence sep between each, and returns the result as a new byte sequence.

        val cat : bytes -> bytes -> bytes

        cat s1 s2 concatenates s1 and s2 and returns the result as a new byte sequence.

        • since 4.05 in BytesLabels
        val iter : (char -> unit) -> bytes -> unit

        iter f s applies function f in turn to all the bytes of s. It is equivalent to f (get s 0); f (get s 1); ...; f (get s (length s - 1)); ().

        val iteri : (int -> char -> unit) -> bytes -> unit

        Same as iter, but the function is applied to the index of the byte as first argument and the byte itself as second argument.

        val map : (char -> char) -> bytes -> bytes

        map f s applies function f in turn to all the bytes of s (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

        val mapi : (int -> char -> char) -> bytes -> bytes

        mapi f s calls f with each character of s and its index (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

        val fold_left : ('acc -> char -> 'acc) -> 'acc -> bytes -> 'acc

        fold_left f x s computes f (... (f (f x (get s 0)) (get s 1)) ...) (get s (n-1)), where n is the length of s.

        • since 4.13
        val fold_right : (char -> 'acc -> 'acc) -> bytes -> 'acc -> 'acc

        fold_right f s x computes f (get s 0) (f (get s 1) ( ... (f (get s (n-1)) x) ...)), where n is the length of s.

        • since 4.13
        val for_all : (char -> bool) -> bytes -> bool

        for_all p s checks if all characters in s satisfy the predicate p.

        • since 4.13
        val exists : (char -> bool) -> bytes -> bool

        exists p s checks if at least one character of s satisfies the predicate p.

        • since 4.13
        val trim : bytes -> bytes

        Return a copy of the argument, without leading and trailing whitespace. The bytes regarded as whitespace are the ASCII characters ' ', '\012', '\n', '\r', and '\t'.

        val escaped : bytes -> bytes

        Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote.

        val index : bytes -> char -> int

        index s c returns the index of the first occurrence of byte c in s.

        val index_opt : bytes -> char -> int option

        index_opt s c returns the index of the first occurrence of byte c in s or None if c does not occur in s.

        • since 4.05
        val rindex : bytes -> char -> int

        rindex s c returns the index of the last occurrence of byte c in s.

        val rindex_opt : bytes -> char -> int option

        rindex_opt s c returns the index of the last occurrence of byte c in s or None if c does not occur in s.

        • since 4.05
        val index_from : bytes -> int -> char -> int

        index_from s i c returns the index of the first occurrence of byte c in s after position i. index s c is equivalent to index_from s 0 c.

        • raises Not_found

          if c does not occur in s after position i.

        val index_from_opt : bytes -> int -> char -> int option

        index_from_opt s i c returns the index of the first occurrence of byte c in s after position i or None if c does not occur in s after position i. index_opt s c is equivalent to index_from_opt s 0 c.

        • since 4.05
        val rindex_from : bytes -> int -> char -> int

        rindex_from s i c returns the index of the last occurrence of byte c in s before position i+1. rindex s c is equivalent to rindex_from s (length s - 1) c.

        • raises Not_found

          if c does not occur in s before position i+1.

        val rindex_from_opt : bytes -> int -> char -> int option

        rindex_from_opt s i c returns the index of the last occurrence of byte c in s before position i+1 or None if c does not occur in s before position i+1. rindex_opt s c is equivalent to rindex_from s (length s - 1) c.

        • since 4.05
        val contains : bytes -> char -> bool

        contains s c tests if byte c appears in s.

        val contains_from : bytes -> int -> char -> bool

        contains_from s start c tests if byte c appears in s after position start. contains s c is equivalent to contains_from - s 0 c.

        val rcontains_from : bytes -> int -> char -> bool

        rcontains_from s stop c tests if byte c appears in s before position stop+1.

        val uppercase_ascii : bytes -> bytes

        Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        val lowercase_ascii : bytes -> bytes

        Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        val capitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        val uncapitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        type t = bytes

        An alias for the type of byte sequences.

        val compare : t -> t -> int

        The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

        val equal : t -> t -> bool

        The equality function for byte sequences.

        • since 4.03 (4.05 in BytesLabels)
        val starts_with : prefix:bytes -> bytes -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:bytes -> bytes -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13

        Unsafe conversions (for advanced users)

        This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

        val unsafe_to_string : bytes -> string

        Unsafely convert a byte sequence into a string.

        To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

        • Unique ownership: the data may be accessed and mutated
        • Shared ownership: the data has several owners, that may only access it, not mutate it.

        Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

        unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

        There are two valid use-cases that respect this ownership discipline:

        1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

        let string_init len f : string =
        +    s 0 c.

        val rcontains_from : bytes -> int -> char -> bool

        rcontains_from s stop c tests if byte c appears in s before position stop+1.

        val uppercase_ascii : bytes -> bytes

        Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        val lowercase_ascii : bytes -> bytes

        Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        val capitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        val uncapitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in BytesLabels)
        type t = bytes

        An alias for the type of byte sequences.

        val compare : t -> t -> int

        The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

        val equal : t -> t -> bool

        The equality function for byte sequences.

        • since 4.03 (4.05 in BytesLabels)
        val starts_with : prefix:bytes -> bytes -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:bytes -> bytes -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13

        Unsafe conversions (for advanced users)

        This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

        val unsafe_to_string : bytes -> string

        Unsafely convert a byte sequence into a string.

        To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

        • Unique ownership: the data may be accessed and mutated
        • Shared ownership: the data has several owners, that may only access it, not mutate it.

        Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

        unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

        There are two valid use-cases that respect this ownership discipline:

        1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

        let string_init len f : string =
           let s = Bytes.create len in
           for i = 0 to len - 1 do Bytes.set s i (f i) done;
           Bytes.unsafe_to_string s

        This function is safe because the byte sequence s will never be accessed or mutated after unsafe_to_string is called. The string_init code gives up ownership of s, and returns the ownership of the resulting string to its caller.

        Note that it would be unsafe if s was passed as an additional parameter to the function f as it could escape this way and be mutated in the future -- string_init would give up ownership of s to pass it to f, and could not call unsafe_to_string safely.

        We have provided the String.init, String.map and String.mapi functions to cover most cases of building new strings. You should prefer those over to_string or unsafe_to_string whenever applicable.

        2. Temporarily giving ownership of a byte sequence to a function that expects a uniquely owned string and returns ownership back, so that we can mutate the sequence again after the call ended.

        let bytes_length (s : bytes) =
           String.length (Bytes.unsafe_to_string s)

        In this use-case, we do not promise that s will never be mutated after the call to bytes_length s. The String.length function temporarily borrows unique ownership of the byte sequence (and sees it as a string), but returns this ownership back to the caller, which may assume that s is still a valid byte sequence after the call. Note that this is only correct because we know that String.length does not capture its argument -- it could escape by a side-channel such as a memoization combinator.

        The caller may not mutate s while the string is borrowed (it has temporarily given up ownership). This affects concurrent programs, but also higher-order functions: if String.length returned a closure to be called later, s should not be mutated until this closure is fully applied and returns ownership.

        val unsafe_of_string : string -> bytes

        Unsafely convert a shared string to a byte sequence that should not be mutated.

        The same ownership discipline that makes unsafe_to_string correct applies to unsafe_of_string: you may use it if you were the owner of the string value, and you will own the return bytes in the same mode.

        In practice, unique ownership of string values is extremely difficult to reason about correctly. You should always assume strings are shared, never uniquely owned.

        For example, string literals are implicitly shared by the compiler, so you never uniquely own them.

        let incorrect = Bytes.unsafe_of_string "hello"
        -let s = Bytes.of_string "hello"

        The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

        Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

        The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

        val split_on_char : char -> bytes -> bytes list

        split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character.

        The function's output is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) +let s = Bytes.of_string "hello"

        The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

        Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

        The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

        val split_on_char : char -> bytes -> bytes list

        split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character. If s is empty, the result is the singleton list [empty].

        The function's output is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) (Bytes.split_on_char sep s) = s).
        • No byte sequence in the result contains the sep character.
        • since 4.13

        Iterators

        val to_seq : t -> char Seq.t

        Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        Iterate on the string, in increasing order, yielding indices along chars

        • since 4.07
        val of_seq : char Seq.t -> t

        Create a string from the generator

        • since 4.07

        UTF codecs and validations

        • since 4.14

        UTF-8

        val get_utf_8_uchar : t -> int -> Uchar.utf_decode

        get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

        val set_utf_8_uchar : t -> int -> Uchar.t -> int

        set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

        val is_valid_utf_8 : t -> bool

        is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

        UTF-16BE

        val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

        get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

        val set_utf_16be_uchar : t -> int -> Uchar.t -> int

        set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

        val is_valid_utf_16be : t -> bool

        is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

        UTF-16LE

        val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

        get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

        val set_utf_16le_uchar : t -> int -> Uchar.t -> int

        set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

        val is_valid_utf_16le : t -> bool

        is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

        Binary encoding/decoding of integers

        The functions in this section binary encode and decode integers to and from byte sequences.

        All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

        • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
        • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
        val get_uint8 : bytes -> int -> int

        get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

        • since 4.08
        val get_int8 : bytes -> int -> int

        get_int8 b i is b's signed 8-bit integer starting at byte index i.

        • since 4.08
        val get_uint16_ne : bytes -> int -> int

        get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

        • since 4.08
        val get_uint16_be : bytes -> int -> int

        get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

        • since 4.08
        val get_uint16_le : bytes -> int -> int

        get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

        • since 4.08
        val get_int16_ne : bytes -> int -> int

        get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

        • since 4.08
        val get_int16_be : bytes -> int -> int

        get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

        • since 4.08
        val get_int16_le : bytes -> int -> int

        get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

        • since 4.08
        val get_int32_ne : bytes -> int -> int32

        get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

        • since 4.08
        val get_int32_be : bytes -> int -> int32

        get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

        • since 4.08
        val get_int32_le : bytes -> int -> int32

        get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

        • since 4.08
        val get_int64_ne : bytes -> int -> int64

        get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

        • since 4.08
        val get_int64_be : bytes -> int -> int64

        get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

        • since 4.08
        val get_int64_le : bytes -> int -> int64

        get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

        • since 4.08
        val set_uint8 : bytes -> int -> int -> unit

        set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

        • since 4.08
        val set_int8 : bytes -> int -> int -> unit

        set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

        • since 4.08
        val set_uint16_ne : bytes -> int -> int -> unit

        set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_uint16_be : bytes -> int -> int -> unit

        set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_uint16_le : bytes -> int -> int -> unit

        set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int16_ne : bytes -> int -> int -> unit

        set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int16_be : bytes -> int -> int -> unit

        set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int16_le : bytes -> int -> int -> unit

        set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int32_ne : bytes -> int -> int32 -> unit

        set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

        • since 4.08
        val set_int32_be : bytes -> int -> int32 -> unit

        set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

        • since 4.08
        val set_int32_le : bytes -> int -> int32 -> unit

        set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

        • since 4.08
        val set_int64_ne : bytes -> int -> int64 -> unit

        set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

        • since 4.08
        val set_int64_be : bytes -> int -> int64 -> unit

        set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

        • since 4.08
        val set_int64_le : bytes -> int -> int64 -> unit

        set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

        • since 4.08

        Byte sequences and concurrency safety

        Care must be taken when concurrently accessing byte sequences from multiple domains: accessing a byte sequence will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every byte sequence operation that accesses more than one byte is not atomic. This includes iteration and scanning.

        For example, consider the following program:

        let size = 100_000_000
         let b = Bytes.make size  ' '
         let update b f ()  =
        diff --git a/ocaml/Stdlib/BytesLabels/index.html b/ocaml/Stdlib/BytesLabels/index.html
        index 8624875d..66b585ef 100644
        --- a/ocaml/Stdlib/BytesLabels/index.html
        +++ b/ocaml/Stdlib/BytesLabels/index.html
        @@ -13,12 +13,12 @@
           len:int ->
           unit

        blit_string ~src ~src_pos ~dst ~dst_pos ~len copies len bytes from string src, starting at index src_pos, to byte sequence dst, starting at index dst_pos.

        • raises Invalid_argument

          if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

        • since 4.05 in BytesLabels
        val concat : sep:bytes -> bytes list -> bytes

        concat ~sep sl concatenates the list of byte sequences sl, inserting the separator byte sequence sep between each, and returns the result as a new byte sequence.

        val cat : bytes -> bytes -> bytes

        cat s1 s2 concatenates s1 and s2 and returns the result as a new byte sequence.

        • since 4.05 in BytesLabels
        val iter : f:(char -> unit) -> bytes -> unit

        iter ~f s applies function f in turn to all the bytes of s. It is equivalent to f (get s 0); f (get s 1); ...; f (get s (length s - 1)); ().

        val iteri : f:(int -> char -> unit) -> bytes -> unit

        Same as iter, but the function is applied to the index of the byte as first argument and the byte itself as second argument.

        val map : f:(char -> char) -> bytes -> bytes

        map ~f s applies function f in turn to all the bytes of s (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

        val mapi : f:(int -> char -> char) -> bytes -> bytes

        mapi ~f s calls f with each character of s and its index (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

        val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> bytes -> 'acc

        fold_left f x s computes f (... (f (f x (get s 0)) (get s 1)) ...) (get s (n-1)), where n is the length of s.

        • since 4.13
        val fold_right : f:(char -> 'acc -> 'acc) -> bytes -> init:'acc -> 'acc

        fold_right f s x computes f (get s 0) (f (get s 1) ( ... (f (get s (n-1)) x) ...)), where n is the length of s.

        • since 4.13
        val for_all : f:(char -> bool) -> bytes -> bool

        for_all p s checks if all characters in s satisfy the predicate p.

        • since 4.13
        val exists : f:(char -> bool) -> bytes -> bool

        exists p s checks if at least one character of s satisfies the predicate p.

        • since 4.13
        val trim : bytes -> bytes

        Return a copy of the argument, without leading and trailing whitespace. The bytes regarded as whitespace are the ASCII characters ' ', '\012', '\n', '\r', and '\t'.

        val escaped : bytes -> bytes

        Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote.

        val index : bytes -> char -> int

        index s c returns the index of the first occurrence of byte c in s.

        val index_opt : bytes -> char -> int option

        index_opt s c returns the index of the first occurrence of byte c in s or None if c does not occur in s.

        • since 4.05
        val rindex : bytes -> char -> int

        rindex s c returns the index of the last occurrence of byte c in s.

        val rindex_opt : bytes -> char -> int option

        rindex_opt s c returns the index of the last occurrence of byte c in s or None if c does not occur in s.

        • since 4.05
        val index_from : bytes -> int -> char -> int

        index_from s i c returns the index of the first occurrence of byte c in s after position i. index s c is equivalent to index_from s 0 c.

        • raises Not_found

          if c does not occur in s after position i.

        val index_from_opt : bytes -> int -> char -> int option

        index_from_opt s i c returns the index of the first occurrence of byte c in s after position i or None if c does not occur in s after position i. index_opt s c is equivalent to index_from_opt s 0 c.

        • since 4.05
        val rindex_from : bytes -> int -> char -> int

        rindex_from s i c returns the index of the last occurrence of byte c in s before position i+1. rindex s c is equivalent to rindex_from s (length s - 1) c.

        • raises Not_found

          if c does not occur in s before position i+1.

        val rindex_from_opt : bytes -> int -> char -> int option

        rindex_from_opt s i c returns the index of the last occurrence of byte c in s before position i+1 or None if c does not occur in s before position i+1. rindex_opt s c is equivalent to rindex_from s (length s - 1) c.

        • since 4.05
        val contains : bytes -> char -> bool

        contains s c tests if byte c appears in s.

        val contains_from : bytes -> int -> char -> bool

        contains_from s start c tests if byte c appears in s after position start. contains s c is equivalent to contains_from - s 0 c.

        val rcontains_from : bytes -> int -> char -> bool

        rcontains_from s stop c tests if byte c appears in s before position stop+1.

        val uppercase_ascii : bytes -> bytes

        Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.05
        val lowercase_ascii : bytes -> bytes

        Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.05
        val capitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

        • since 4.05
        val uncapitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

        • since 4.05
        type t = bytes

        An alias for the type of byte sequences.

        val compare : t -> t -> int

        The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

        val equal : t -> t -> bool

        The equality function for byte sequences.

        • since 4.05
        val starts_with : prefix:bytes -> bytes -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:bytes -> bytes -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13

        Unsafe conversions (for advanced users)

        This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

        val unsafe_to_string : bytes -> string

        Unsafely convert a byte sequence into a string.

        To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

        • Unique ownership: the data may be accessed and mutated
        • Shared ownership: the data has several owners, that may only access it, not mutate it.

        Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

        unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

        There are two valid use-cases that respect this ownership discipline:

        1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

        let string_init len f : string =
        +    s 0 c.

        val rcontains_from : bytes -> int -> char -> bool

        rcontains_from s stop c tests if byte c appears in s before position stop+1.

        val uppercase_ascii : bytes -> bytes

        Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.05
        val lowercase_ascii : bytes -> bytes

        Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.05
        val capitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

        • since 4.05
        val uncapitalize_ascii : bytes -> bytes

        Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

        • since 4.05
        type t = bytes

        An alias for the type of byte sequences.

        val compare : t -> t -> int

        The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

        val equal : t -> t -> bool

        The equality function for byte sequences.

        • since 4.05
        val starts_with : prefix:bytes -> bytes -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:bytes -> bytes -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13

        Unsafe conversions (for advanced users)

        This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

        val unsafe_to_string : bytes -> string

        Unsafely convert a byte sequence into a string.

        To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

        • Unique ownership: the data may be accessed and mutated
        • Shared ownership: the data has several owners, that may only access it, not mutate it.

        Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

        unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

        There are two valid use-cases that respect this ownership discipline:

        1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

        let string_init len f : string =
           let s = Bytes.create len in
           for i = 0 to len - 1 do Bytes.set s i (f i) done;
           Bytes.unsafe_to_string s

        This function is safe because the byte sequence s will never be accessed or mutated after unsafe_to_string is called. The string_init code gives up ownership of s, and returns the ownership of the resulting string to its caller.

        Note that it would be unsafe if s was passed as an additional parameter to the function f as it could escape this way and be mutated in the future -- string_init would give up ownership of s to pass it to f, and could not call unsafe_to_string safely.

        We have provided the String.init, String.map and String.mapi functions to cover most cases of building new strings. You should prefer those over to_string or unsafe_to_string whenever applicable.

        2. Temporarily giving ownership of a byte sequence to a function that expects a uniquely owned string and returns ownership back, so that we can mutate the sequence again after the call ended.

        let bytes_length (s : bytes) =
           String.length (Bytes.unsafe_to_string s)

        In this use-case, we do not promise that s will never be mutated after the call to bytes_length s. The String.length function temporarily borrows unique ownership of the byte sequence (and sees it as a string), but returns this ownership back to the caller, which may assume that s is still a valid byte sequence after the call. Note that this is only correct because we know that String.length does not capture its argument -- it could escape by a side-channel such as a memoization combinator.

        The caller may not mutate s while the string is borrowed (it has temporarily given up ownership). This affects concurrent programs, but also higher-order functions: if String.length returned a closure to be called later, s should not be mutated until this closure is fully applied and returns ownership.

        val unsafe_of_string : string -> bytes

        Unsafely convert a shared string to a byte sequence that should not be mutated.

        The same ownership discipline that makes unsafe_to_string correct applies to unsafe_of_string: you may use it if you were the owner of the string value, and you will own the return bytes in the same mode.

        In practice, unique ownership of string values is extremely difficult to reason about correctly. You should always assume strings are shared, never uniquely owned.

        For example, string literals are implicitly shared by the compiler, so you never uniquely own them.

        let incorrect = Bytes.unsafe_of_string "hello"
        -let s = Bytes.of_string "hello"

        The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

        Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

        The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

        val split_on_char : sep:char -> bytes -> bytes list

        split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character.

        The function's output is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) +let s = Bytes.of_string "hello"

          The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

          Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

          The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

        val split_on_char : sep:char -> bytes -> bytes list

        split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character. If s is empty, the result is the singleton list [empty].

        The function's output is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) (Bytes.split_on_char sep s) = s).
        • No byte sequence in the result contains the sep character.
        • since 4.13

        Iterators

        val to_seq : t -> char Seq.t

        Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        Iterate on the string, in increasing order, yielding indices along chars

        • since 4.07
        val of_seq : char Seq.t -> t

        Create a string from the generator

        • since 4.07

        UTF codecs and validations

        • since 4.14

        UTF-8

        val get_utf_8_uchar : t -> int -> Uchar.utf_decode

        get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

        val set_utf_8_uchar : t -> int -> Uchar.t -> int

        set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

        val is_valid_utf_8 : t -> bool

        is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

        UTF-16BE

        val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

        get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

        val set_utf_16be_uchar : t -> int -> Uchar.t -> int

        set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

        val is_valid_utf_16be : t -> bool

        is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

        UTF-16LE

        val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

        get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

        val set_utf_16le_uchar : t -> int -> Uchar.t -> int

        set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

        val is_valid_utf_16le : t -> bool

        is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

        Binary encoding/decoding of integers

        The functions in this section binary encode and decode integers to and from byte sequences.

        All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

        • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
        • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
        val get_uint8 : bytes -> int -> int

        get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

        • since 4.08
        val get_int8 : bytes -> int -> int

        get_int8 b i is b's signed 8-bit integer starting at byte index i.

        • since 4.08
        val get_uint16_ne : bytes -> int -> int

        get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

        • since 4.08
        val get_uint16_be : bytes -> int -> int

        get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

        • since 4.08
        val get_uint16_le : bytes -> int -> int

        get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

        • since 4.08
        val get_int16_ne : bytes -> int -> int

        get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

        • since 4.08
        val get_int16_be : bytes -> int -> int

        get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

        • since 4.08
        val get_int16_le : bytes -> int -> int

        get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

        • since 4.08
        val get_int32_ne : bytes -> int -> int32

        get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

        • since 4.08
        val get_int32_be : bytes -> int -> int32

        get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

        • since 4.08
        val get_int32_le : bytes -> int -> int32

        get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

        • since 4.08
        val get_int64_ne : bytes -> int -> int64

        get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

        • since 4.08
        val get_int64_be : bytes -> int -> int64

        get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

        • since 4.08
        val get_int64_le : bytes -> int -> int64

        get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

        • since 4.08
        val set_uint8 : bytes -> int -> int -> unit

        set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

        • since 4.08
        val set_int8 : bytes -> int -> int -> unit

        set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

        • since 4.08
        val set_uint16_ne : bytes -> int -> int -> unit

        set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_uint16_be : bytes -> int -> int -> unit

        set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_uint16_le : bytes -> int -> int -> unit

        set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int16_ne : bytes -> int -> int -> unit

        set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int16_be : bytes -> int -> int -> unit

        set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int16_le : bytes -> int -> int -> unit

        set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

        • since 4.08
        val set_int32_ne : bytes -> int -> int32 -> unit

        set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

        • since 4.08
        val set_int32_be : bytes -> int -> int32 -> unit

        set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

        • since 4.08
        val set_int32_le : bytes -> int -> int32 -> unit

        set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

        • since 4.08
        val set_int64_ne : bytes -> int -> int64 -> unit

        set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

        • since 4.08
        val set_int64_be : bytes -> int -> int64 -> unit

        set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

        • since 4.08
        val set_int64_le : bytes -> int -> int64 -> unit

        set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

        • since 4.08

        Byte sequences and concurrency safety

        Care must be taken when concurrently accessing byte sequences from multiple domains: accessing a byte sequence will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every byte sequence operation that accesses more than one byte is not atomic. This includes iteration and scanning.

        For example, consider the following program:

        let size = 100_000_000
         let b = Bytes.make size  ' '
         let update b f ()  =
        diff --git a/ocaml/Stdlib/Digest/BLAKE128/index.html b/ocaml/Stdlib/Digest/BLAKE128/index.html
        new file mode 100644
        index 00000000..29a5590d
        --- /dev/null
        +++ b/ocaml/Stdlib/Digest/BLAKE128/index.html
        @@ -0,0 +1,2 @@
        +
        +BLAKE128 (ocaml.Stdlib.Digest.BLAKE128)

        Module Digest.BLAKE128

        BLAKE128 is the BLAKE2b hash function producing 128-bit (16-byte) digests. It is cryptographically secure. However, the small size of the digests enables brute-force attacks in 2{^64} attempts.

        • since 5.2
        type t = string

        The type of digests.

        val hash_length : int

        The length of digests, in bytes.

        val compare : t -> t -> int

        Compare two digests, with the same specification as Stdlib.compare.

        val equal : t -> t -> bool

        Test two digests for equality.

        val string : string -> t

        Return the digest of the given string.

        val bytes : bytes -> t

        Return the digest of the given byte sequence.

        val substring : string -> int -> int -> t

        substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

        val subbytes : bytes -> int -> int -> t

        subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

        val channel : in_channel -> int -> t

        Read characters from the channel and return their digest. See Digest.channel for the full specification.

        val file : string -> t

        Return the digest of the file whose name is given.

        val output : out_channel -> t -> unit

        Write a digest on the given output channel.

        val input : in_channel -> t

        Read a digest from the given input channel.

        val to_hex : t -> string

        Return the printable hexadecimal representation of the given digest.

        val of_hex : string -> t

        Convert a hexadecimal representation back into the corresponding digest.

        • raises Invalid_argument

          if the length of the argument is not 2 * hash_length, or if the arguments contains non-hexadecimal characters.

        diff --git a/ocaml/Stdlib/Digest/BLAKE256/index.html b/ocaml/Stdlib/Digest/BLAKE256/index.html new file mode 100644 index 00000000..5513c9c1 --- /dev/null +++ b/ocaml/Stdlib/Digest/BLAKE256/index.html @@ -0,0 +1,2 @@ + +BLAKE256 (ocaml.Stdlib.Digest.BLAKE256)

        Module Digest.BLAKE256

        BLAKE256 is the BLAKE2b hash function producing 256-bit (32-byte) digests. It is cryptographically secure, and the digests are large enough to thwart brute-force attacks.

        • since 5.2
        type t = string

        The type of digests.

        val hash_length : int

        The length of digests, in bytes.

        val compare : t -> t -> int

        Compare two digests, with the same specification as Stdlib.compare.

        val equal : t -> t -> bool

        Test two digests for equality.

        val string : string -> t

        Return the digest of the given string.

        val bytes : bytes -> t

        Return the digest of the given byte sequence.

        val substring : string -> int -> int -> t

        substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

        val subbytes : bytes -> int -> int -> t

        subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

        val channel : in_channel -> int -> t

        Read characters from the channel and return their digest. See Digest.channel for the full specification.

        val file : string -> t

        Return the digest of the file whose name is given.

        val output : out_channel -> t -> unit

        Write a digest on the given output channel.

        val input : in_channel -> t

        Read a digest from the given input channel.

        val to_hex : t -> string

        Return the printable hexadecimal representation of the given digest.

        val of_hex : string -> t

        Convert a hexadecimal representation back into the corresponding digest.

        • raises Invalid_argument

          if the length of the argument is not 2 * hash_length, or if the arguments contains non-hexadecimal characters.

        diff --git a/ocaml/Stdlib/Digest/BLAKE512/index.html b/ocaml/Stdlib/Digest/BLAKE512/index.html new file mode 100644 index 00000000..474789d5 --- /dev/null +++ b/ocaml/Stdlib/Digest/BLAKE512/index.html @@ -0,0 +1,2 @@ + +BLAKE512 (ocaml.Stdlib.Digest.BLAKE512)

        Module Digest.BLAKE512

        BLAKE512 is the BLAKE2b hash function producing 512-bit (64-byte) digests. It is cryptographically secure, and the digests are large enough to thwart brute-force attacks.

        • since 5.2
        type t = string

        The type of digests.

        val hash_length : int

        The length of digests, in bytes.

        val compare : t -> t -> int

        Compare two digests, with the same specification as Stdlib.compare.

        val equal : t -> t -> bool

        Test two digests for equality.

        val string : string -> t

        Return the digest of the given string.

        val bytes : bytes -> t

        Return the digest of the given byte sequence.

        val substring : string -> int -> int -> t

        substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

        val subbytes : bytes -> int -> int -> t

        subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

        val channel : in_channel -> int -> t

        Read characters from the channel and return their digest. See Digest.channel for the full specification.

        val file : string -> t

        Return the digest of the file whose name is given.

        val output : out_channel -> t -> unit

        Write a digest on the given output channel.

        val input : in_channel -> t

        Read a digest from the given input channel.

        val to_hex : t -> string

        Return the printable hexadecimal representation of the given digest.

        val of_hex : string -> t

        Convert a hexadecimal representation back into the corresponding digest.

        • raises Invalid_argument

          if the length of the argument is not 2 * hash_length, or if the arguments contains non-hexadecimal characters.

        diff --git a/ocaml/Stdlib/Digest/MD5/index.html b/ocaml/Stdlib/Digest/MD5/index.html new file mode 100644 index 00000000..4939fc03 --- /dev/null +++ b/ocaml/Stdlib/Digest/MD5/index.html @@ -0,0 +1,2 @@ + +MD5 (ocaml.Stdlib.Digest.MD5)

        Module Digest.MD5

        MD5 is the MD5 hash function. It produces 128-bit (16-byte) digests and is not cryptographically secure at all. It should be used only for compatibility with earlier designs that mandate the use of MD5.

        • since 5.2
        type t = string

        The type of digests.

        val hash_length : int

        The length of digests, in bytes.

        val compare : t -> t -> int

        Compare two digests, with the same specification as Stdlib.compare.

        val equal : t -> t -> bool

        Test two digests for equality.

        val string : string -> t

        Return the digest of the given string.

        val bytes : bytes -> t

        Return the digest of the given byte sequence.

        val substring : string -> int -> int -> t

        substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

        val subbytes : bytes -> int -> int -> t

        subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

        val channel : in_channel -> int -> t

        Read characters from the channel and return their digest. See Digest.channel for the full specification.

        val file : string -> t

        Return the digest of the file whose name is given.

        val output : out_channel -> t -> unit

        Write a digest on the given output channel.

        val input : in_channel -> t

        Read a digest from the given input channel.

        val to_hex : t -> string

        Return the printable hexadecimal representation of the given digest.

        val of_hex : string -> t

        Convert a hexadecimal representation back into the corresponding digest.

        • raises Invalid_argument

          if the length of the argument is not 2 * hash_length, or if the arguments contains non-hexadecimal characters.

        diff --git a/ocaml/Stdlib/Digest/index.html b/ocaml/Stdlib/Digest/index.html index cf682267..130c02c0 100644 --- a/ocaml/Stdlib/Digest/index.html +++ b/ocaml/Stdlib/Digest/index.html @@ -1,2 +1,2 @@ -Digest (ocaml.Stdlib.Digest)

        Module Stdlib.Digest

        MD5 message digest.

        This module provides functions to compute 128-bit 'digests' of arbitrary-length strings or files. The algorithm used is MD5.

        The MD5 hash function is not cryptographically secure. Hence, this module should not be used for security-sensitive applications. More recent, stronger cryptographic primitives should be used instead.

        type t = string

        The type of digests: 16-character strings.

        val compare : t -> t -> int

        The comparison function for 16-character digest, with the same specification as Stdlib.compare and the implementation shared with String.compare. Along with the type t, this function compare allows the module Digest to be passed as argument to the functors Set.Make and Map.Make.

        • since 4.00
        val equal : t -> t -> bool

        The equal function for 16-character digest.

        • since 4.03
        val string : string -> t

        Return the digest of the given string.

        val bytes : bytes -> t

        Return the digest of the given byte sequence.

        • since 4.02
        val substring : string -> int -> int -> t

        Digest.substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

        val subbytes : bytes -> int -> int -> t

        Digest.subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

        • since 4.02
        val channel : in_channel -> int -> t

        If len is nonnegative, Digest.channel ic len reads len characters from channel ic and returns their digest, or raises End_of_file if end-of-file is reached before len characters are read. If len is negative, Digest.channel ic len reads all characters from ic until end-of-file is reached and return their digest.

        val file : string -> t

        Return the digest of the file whose name is given.

        val output : out_channel -> t -> unit

        Write a digest on the given output channel.

        val input : in_channel -> t

        Read a digest from the given input channel.

        val to_hex : t -> string

        Return the printable hexadecimal representation of the given digest.

        val from_hex : string -> t

        Convert a hexadecimal representation back into the corresponding digest.

        • raises Invalid_argument

          if the argument is not exactly 32 hexadecimal characters.

        • since 4.00
        +Digest (ocaml.Stdlib.Digest)

        Module Stdlib.Digest

        Message digest.

        This module provides functions to compute 'digests', also known as 'hashes', of arbitrary-length strings or files. The supported hashing algorithms are BLAKE2 and MD5.

        Basic functions

        The functions in this section use the MD5 hash function to produce 128-bit digests (16 bytes). MD5 is not cryptographically secure. Hence, these functions should not be used for security-sensitive applications. The BLAKE2 functions below are cryptographically secure.

        type t = string

        The type of digests: 16-byte strings.

        val compare : t -> t -> int

        The comparison function for 16-byte digests, with the same specification as Stdlib.compare and the implementation shared with String.compare. Along with the type t, this function compare allows the module Digest to be passed as argument to the functors Set.Make and Map.Make.

        • since 4.00
        val equal : t -> t -> bool

        The equal function for 16-byte digests.

        • since 4.03
        val string : string -> t

        Return the digest of the given string.

        val bytes : bytes -> t

        Return the digest of the given byte sequence.

        • since 4.02
        val substring : string -> int -> int -> t

        Digest.substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

        val subbytes : bytes -> int -> int -> t

        Digest.subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

        • since 4.02
        val channel : in_channel -> int -> t

        If len is nonnegative, Digest.channel ic len reads len characters from channel ic and returns their digest, or raises End_of_file if end-of-file is reached before len characters are read. If len is negative, Digest.channel ic len reads all characters from ic until end-of-file is reached and return their digest.

        val file : string -> t

        Return the digest of the file whose name is given.

        val output : out_channel -> t -> unit

        Write a digest on the given output channel.

        val input : in_channel -> t

        Read a digest from the given input channel.

        val to_hex : t -> string

        Return the printable hexadecimal representation of the given digest.

        val of_hex : string -> t

        Convert a hexadecimal representation back into the corresponding digest.

        • raises Invalid_argument

          if the argument is not exactly 32 hexadecimal characters.

        • since 5.2
        val from_hex : string -> t

        Same function as Digest.of_hex.

        • since 4.00

        Generic interface

        module type S = sig ... end

        The signature for a hash function that produces digests of length hash_length from character strings, byte arrays, and files.

        Specific hash functions

        module BLAKE128 : S

        BLAKE128 is the BLAKE2b hash function producing 128-bit (16-byte) digests. It is cryptographically secure. However, the small size of the digests enables brute-force attacks in 2{^64} attempts.

        module BLAKE256 : S

        BLAKE256 is the BLAKE2b hash function producing 256-bit (32-byte) digests. It is cryptographically secure, and the digests are large enough to thwart brute-force attacks.

        module BLAKE512 : S

        BLAKE512 is the BLAKE2b hash function producing 512-bit (64-byte) digests. It is cryptographically secure, and the digests are large enough to thwart brute-force attacks.

        module MD5 : S

        MD5 is the MD5 hash function. It produces 128-bit (16-byte) digests and is not cryptographically secure at all. It should be used only for compatibility with earlier designs that mandate the use of MD5.

        diff --git a/ocaml/Stdlib/Digest/module-type-S/index.html b/ocaml/Stdlib/Digest/module-type-S/index.html new file mode 100644 index 00000000..c56e7ab4 --- /dev/null +++ b/ocaml/Stdlib/Digest/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ocaml.Stdlib.Digest.S)

        Module type Digest.S

        The signature for a hash function that produces digests of length hash_length from character strings, byte arrays, and files.

        • since 5.2
        type t = string

        The type of digests.

        val hash_length : int

        The length of digests, in bytes.

        val compare : t -> t -> int

        Compare two digests, with the same specification as Stdlib.compare.

        val equal : t -> t -> bool

        Test two digests for equality.

        val string : string -> t

        Return the digest of the given string.

        val bytes : bytes -> t

        Return the digest of the given byte sequence.

        val substring : string -> int -> int -> t

        substring s ofs len returns the digest of the substring of s starting at index ofs and containing len characters.

        val subbytes : bytes -> int -> int -> t

        subbytes s ofs len returns the digest of the subsequence of s starting at index ofs and containing len bytes.

        val channel : in_channel -> int -> t

        Read characters from the channel and return their digest. See Digest.channel for the full specification.

        val file : string -> t

        Return the digest of the file whose name is given.

        val output : out_channel -> t -> unit

        Write a digest on the given output channel.

        val input : in_channel -> t

        Read a digest from the given input channel.

        val to_hex : t -> string

        Return the printable hexadecimal representation of the given digest.

        val of_hex : string -> t

        Convert a hexadecimal representation back into the corresponding digest.

        • raises Invalid_argument

          if the length of the argument is not 2 * hash_length, or if the arguments contains non-hexadecimal characters.

        diff --git a/ocaml/Stdlib/Domain/DLS/index.html b/ocaml/Stdlib/Domain/DLS/index.html index 5485e7fb..f91ab938 100644 --- a/ocaml/Stdlib/Domain/DLS/index.html +++ b/ocaml/Stdlib/Domain/DLS/index.html @@ -1,5 +1,5 @@ -DLS (ocaml.Stdlib.Domain.DLS)

        Module Domain.DLS

        Domain-local Storage

        type 'a key

        Type of a DLS key

        val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key

        new_key f returns a new key bound to initialiser f for accessing , domain-local variables.

        If split_from_parent is not provided, the value for a new domain will be computed on-demand by the new domain: the first get call will call the initializer f and store that value.

        If split_from_parent is provided, spawning a domain will derive the child value (for this key) from the parent value. This computation happens in the parent domain and it always happens, regardless of whether the child domain will use it. If the splitting function is expensive or requires child-side computation, consider using 'a Lazy.t key:

        let init () = ...
        +DLS (ocaml.Stdlib.Domain.DLS)

        Module Domain.DLS

        Domain-local Storage

        type 'a key

        Type of a DLS key

        val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key

        new_key f returns a new key bound to initialiser f for accessing domain-local variables.

        If split_from_parent is not provided, the value for a new domain will be computed on-demand by the new domain: the first get call will call the initializer f and store that value.

        Warning. f may be called several times if another call to get occurs during initialization on the same domain. Only the 'first' value computed will be used, the other now-useless values will be discarded. Your initialization function should support this situation, or contain logic to detect this case and fail.

        If split_from_parent is provided, spawning a domain will derive the child value (for this key) from the parent value. This computation happens in the parent domain and it always happens, regardless of whether the child domain will use it. If the splitting function is expensive or requires child-side computation, consider using 'a Lazy.t key:

        let init () = ...
         
         let split_from_parent parent_value =
           ... parent-side computation ...;
        diff --git a/ocaml/Stdlib/Domain/index.html b/ocaml/Stdlib/Domain/index.html
        index b3538012..3d2c8aaa 100644
        --- a/ocaml/Stdlib/Domain/index.html
        +++ b/ocaml/Stdlib/Domain/index.html
        @@ -2,4 +2,4 @@
         Domain (ocaml.Stdlib.Domain)

        Module Stdlib.Domain

        • alert unstable The Domain interface may change in incompatible ways in the future.

        Domains.

        See 'Parallel programming' chapter in the manual.

        • since 5.0
        • alert unstable The Domain interface may change in incompatible ways in the future.
        type !'a t

        A domain of type 'a t runs independently, eventually producing a result of type 'a, or an exception

        val spawn : (unit -> 'a) -> 'a t

        spawn f creates a new domain that runs in parallel with the current domain.

        • raises Failure

          if the program has insufficient resources to create another domain.

        val join : 'a t -> 'a

        join d blocks until domain d runs to completion. If d results in a value, then that is returned by join d. If d raises an uncaught exception, then that is re-raised by join d.

        type id = private int

        Domains have unique integer identifiers

        val get_id : 'a t -> id

        get_id d returns the identifier of the domain d

        val self : unit -> id

        self () is the identifier of the currently running domain

        val before_first_spawn : (unit -> unit) -> unit

        before_first_spawn f registers f to be called before the first domain is spawned by the program. The functions registered with before_first_spawn are called on the main (initial) domain. The functions registered with before_first_spawn are called in 'first in, first out' order: the oldest function added with before_first_spawn is called first.

        val at_exit : (unit -> unit) -> unit

        at_exit f registers f to be called when the current domain exits. Note that at_exit callbacks are domain-local and only apply to the calling domain. The registered functions are called in 'last in, first out' order: the function most recently added with at_exit is called first. An example:

        let temp_file_key = Domain.DLS.new_key (fun _ ->
           let tmp = snd (Filename.open_temp_file "" "") in
           Domain.at_exit (fun () -> close_out_noerr tmp);
        -  tmp)

        The snippet above creates a key that when retrieved for the first time will open a temporary file and register an at_exit callback to close it, thus guaranteeing the descriptor is not leaked in case the current domain exits.

        val cpu_relax : unit -> unit

        If busy-waiting, calling cpu_relax () between iterations will improve performance on some CPU architectures

        val is_main_domain : unit -> bool

        is_main_domain () returns true if called from the initial domain.

        The recommended maximum number of domains which should be running simultaneously (including domains already running).

        The value returned is at least 1.

        module DLS : sig ... end

        Domain-local Storage

        + tmp)

        The snippet above creates a key that when retrieved for the first time will open a temporary file and register an at_exit callback to close it, thus guaranteeing the descriptor is not leaked in case the current domain exits.

        val cpu_relax : unit -> unit

        If busy-waiting, calling cpu_relax () between iterations will improve performance on some CPU architectures

        val is_main_domain : unit -> bool

        is_main_domain () returns true if called from the initial domain.

        The recommended maximum number of domains which should be running simultaneously (including domains already running).

        The value returned is at least 1.

        val self_index : unit -> int

        The index of the current domain. It is an integer unique among currently-running domains, in the interval 0; N-1 where N is the peak number of domains running simultaneously so far.

        The index of a terminated domain may be reused for a new domain. Use (Domain.self () :> int) instead for an identifier unique among all domains ever created by the program.

        • since 5.3
        module DLS : sig ... end

        Domain-local Storage

        diff --git a/ocaml/Stdlib/Dynarray/index.html b/ocaml/Stdlib/Dynarray/index.html new file mode 100644 index 00000000..605d3924 --- /dev/null +++ b/ocaml/Stdlib/Dynarray/index.html @@ -0,0 +1,108 @@ + +Dynarray (ocaml.Stdlib.Dynarray)

        Module Stdlib.Dynarray

        Dynamic arrays.

        The Array module provide arrays of fixed length. Dynarray provides arrays whose length can change over time, by adding or removing elements at the end of the array.

        This is typically used to accumulate elements whose number is not known in advance or changes during computation, while also providing fast access to elements at arbitrary indices.

        let dynarray_of_list li =
        +  let arr = Dynarray.create () in
        +  List.iter (fun v -> Dynarray.add_last arr v) li;
        +  arr

        The Buffer module provides similar features, but it is specialized for accumulating characters into a dynamically-resized string.

        The Stack module provides a last-in first-out data structure that can be easily implemented on top of dynamic arrays.

        • since 5.2

        Unsynchronized accesses

        Concurrent accesses to dynamic arrays must be synchronized (for instance with a Mutex.t). Unsynchronized accesses to a dynamic array are a programming error that may lead to an invalid dynamic array state, on which some operations would fail with an Invalid_argument exception.

        Dynamic arrays

        type !'a t

        A dynamic array containing values of type 'a.

        A dynamic array a provides constant-time get and set operations on indices between 0 and Dynarray.length a - 1 included. Its length may change over time by adding or removing elements to the end of the array.

        We say that an index into a dynarray a is valid if it is in 0 .. length a - 1 and invalid otherwise.

        val create : unit -> 'a t

        create () is a new, empty array.

        val make : int -> 'a -> 'a t

        make n x is a new array of length n, filled with x.

        val init : int -> (int -> 'a) -> 'a t

        init n f is a new array a of length n, such that get a i is f i. In other words, the elements of a are f 0, then f 1, then f 2... and f (n - 1) last, evaluated in that order.

        This is similar to Array.init.

        val get : 'a t -> int -> 'a

        get a i is the i-th element of a, starting with index 0.

        val set : 'a t -> int -> 'a -> unit

        set a i x sets the i-th element of a to be x.

        i must be a valid index. set does not add new elements to the array -- see add_last to add an element.

        val length : 'a t -> int

        length a is the number of elements in the array.

        val is_empty : 'a t -> bool

        is_empty a is true if a is empty, that is, if length a = 0.

        val get_last : 'a t -> 'a

        get_last a is the element of a at index length a - 1.

        val find_last : 'a t -> 'a option

        find_last a is None if a is empty and Some (get_last a) otherwise.

        val copy : 'a t -> 'a t

        copy a is a shallow copy of a, a new array containing the same elements as a.

        Adding elements

        Note: all operations adding elements raise Invalid_argument if the length needs to grow beyond Sys.max_array_length.

        val add_last : 'a t -> 'a -> unit

        add_last a x adds the element x at the end of the array a.

        val append_array : 'a t -> 'a array -> unit

        append_array a b adds all elements of b at the end of a, in the order they appear in b.

        For example:

        let a = Dynarray.of_list [1;2] in
        +Dynarray.append_array a [|3; 4|];
        +assert (Dynarray.to_list a = [1; 2; 3; 4])
        val append_list : 'a t -> 'a list -> unit

        Like append_array but with a list.

        val append : 'a t -> 'a t -> unit

        append a b is like append_array a b, but b is itself a dynamic array instead of a fixed-size array.

        Warning: append a a is a programming error because it iterates on a and adds elements to it at the same time -- see the Iteration section below. It fails with Invalid_argument. If you really want to append a copy of a to itself, you can use Dynarray.append_array a (Dynarray.to_array a) which copies a into a temporary array.

        val append_seq : 'a t -> 'a Seq.t -> unit

        Like append_array but with a sequence.

        Warning: append_seq a (to_seq_reentrant a) simultaneously traverses a and adds element to it; the ordering of those operations is unspecified, and may result in an infinite loop -- the new elements may in turn be produced by to_seq_reentrant a and get added again and again.

        val append_iter : 'a t -> (('a -> unit) -> 'x -> unit) -> 'x -> unit

        append_iter a iter x adds each element of x to the end of a. This is iter (add_last a) x.

        For example, append_iter a List.iter [1;2;3] would add elements 1, 2, and then 3 at the end of a. append_iter a Queue.iter q adds elements from the queue q.

        val blit : + src:'a t -> + src_pos:int -> + dst:'a t -> + dst_pos:int -> + len:int -> + unit

        blit ~src ~src_pos ~dst ~dst_pos ~len copies len elements from a source dynarray src, starting at index src_pos, to a destination dynarray dst, starting at index dst_pos. It works correctly even if src and dst are the same array, and the source and destination chunks overlap.

        Unlike Array.blit, Dynarray.blit can extend the destination array with new elements: it is valid to call blit even when dst_pos + len is larger than length dst. The only requirement is that dst_pos must be at most length dst (included), so that there is no gap between the current elements and the blit region.

        • raises Invalid_argument

          if src_pos and len do not designate a valid subarray of src, or if dst_pos is strictly below 0 or strictly above length dst.

        Removing elements

        val pop_last_opt : 'a t -> 'a option

        pop_last_opt a removes and returns the last element of a, or None if the array is empty.

        val pop_last : 'a t -> 'a

        pop_last a removes and returns the last element of a.

        val remove_last : 'a t -> unit

        remove_last a removes the last element of a, if any. It does nothing if a is empty.

        val truncate : 'a t -> int -> unit

        truncate a n truncates a to have at most n elements.

        It removes elements whose index is greater or equal to n. It does nothing if n >= length a.

        truncate a n is equivalent to:

        if n < 0 then invalid_argument "...";
        +while length a > n do
        +  remove_last a
        +done
        val clear : 'a t -> unit

        clear a is truncate a 0, it removes all the elements of a.

        Iteration

        The iteration functions traverse the elements of a dynamic array. Traversals of a are computed in increasing index order: from the element of index 0 to the element of index length a - 1.

        It is a programming error to change the length of an array (by adding or removing elements) during an iteration on the array. Any iteration function will fail with Invalid_argument if it detects such a length change.

        val iter : ('a -> unit) -> 'a t -> unit

        iter f a calls f on each element of a.

        val iteri : (int -> 'a -> unit) -> 'a t -> unit

        iteri f a calls f i x for each x at index i in a.

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f a is a new array of elements of the form f x for each element x of a.

        For example, if the elements of a are x0, x1, x2, then the elements of b are f x0, f x1, f x2.

        val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t

        mapi f a is a new array of elements of the form f i x for each element x of a at index i.

        For example, if the elements of a are x0, x1, x2, then the elements of b are f 0 x0, f 1 x1, f 2 x2.

        val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

        fold_left f acc a folds f over a in order, starting with accumulator acc.

        For example, if the elements of a are x0, x1, then fold f acc a is

        let acc = f acc x0 in
        +let acc = f acc x1 in
        +acc
        val fold_right : ('a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

        fold_right f a acc computes f x0 (f x1 (... (f xn acc) ...)) where x0, x1, ..., xn are the elements of a.

        val filter : ('a -> bool) -> 'a t -> 'a t

        filter f a is a new array of all the elements of a that satisfy f. In other words, it is an array b such that, for each element x in a in order, x is added to b if f x is true.

        For example, filter (fun x -> x >= 0) a is a new array of all non-negative elements of a, in order.

        val filter_map : ('a -> 'b option) -> 'a t -> 'b t

        filter_map f a is a new array of elements y such that f x is Some y for an element x of a. In others words, it is an array b such that, for each element x of a in order:

        • if f x = Some y, then y is added to b,
        • if f x = None, then no element is added to b.

        For example, filter_map int_of_string_opt inputs returns a new array of integers read from the strings in inputs, ignoring strings that cannot be converted to integers.

        Dynarray scanning

        val exists : ('a -> bool) -> 'a t -> bool

        exists f a is true if some element of a satisfies f.

        For example, if the elements of a are x0, x1, x2, then exists f a is f x0 || f x1 || f x2.

        val for_all : ('a -> bool) -> 'a t -> bool

        for_all f a is true if all elements of a satisfy f. This includes the case where a is empty.

        For example, if the elements of a are x0, x1, then exists f a is f x0 && f x1 && f x2.

        val mem : 'a -> 'a t -> bool

        mem a set is true if and only if a is structurally equal to an element of set (i.e. there is an x in set such that compare a x = 0).

        • since 5.3
        val memq : 'a -> 'a t -> bool

        Same as mem, but uses physical equality instead of structural equality to compare array elements.

        • since 5.3
        val find_opt : ('a -> bool) -> 'a t -> 'a option

        find_opt f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

        • since 5.3
        val find_index : ('a -> bool) -> 'a t -> int option

        find_index f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.3
        val find_map : ('a -> 'b option) -> 'a t -> 'b option

        find_map f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

        • since 5.3
        val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.3

        Comparison functions

        Comparison functions iterate over their arguments; it is a programming error to change their length during the iteration, see the Iteration section above.

        val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

        equal eq a b holds when a and b have the same length, and for all indices i we have eq (get a i) (get b i).

        • since 5.3
        val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

        Provided the function cmp defines a preorder on elements, compare cmp a b compares first a and b by their length, and then, if equal, by their elements according to the lexicographic preorder.

        For more details on comparison functions, see Array.sort.

        • since 5.3

        Conversions to other data structures

        Note: the of_* functions raise Invalid_argument if the length needs to grow beyond Sys.max_array_length.

        The to_* functions, except those specifically marked "reentrant", iterate on their dynarray argument. In particular it is a programming error if the length of the dynarray changes during their execution, and the conversion functions raise Invalid_argument if they observe such a change.

        val of_array : 'a array -> 'a t

        of_array arr returns a dynamic array corresponding to the fixed-sized array a. Operates in O(n) time by making a copy.

        val to_array : 'a t -> 'a array

        to_array a returns a fixed-sized array corresponding to the dynamic array a. This always allocate a new array and copies elements into it.

        val of_list : 'a list -> 'a t

        of_list l is the array containing the elements of l in the same order.

        val to_list : 'a t -> 'a list

        to_list a is a list with the elements contained in the array a.

        val of_seq : 'a Seq.t -> 'a t

        of_seq seq is an array containing the same elements as seq.

        It traverses seq once and will terminate only if seq is finite.

        val to_seq : 'a t -> 'a Seq.t

        to_seq a is the sequence of elements get a 0, get a 1... get a (length a - 1).

        val to_seq_reentrant : 'a t -> 'a Seq.t

        to_seq_reentrant a is a reentrant variant of to_seq, in the sense that one may still access its elements after the length of a has changed.

        Demanding the i-th element of the resulting sequence (which can happen zero, one or several times) will access the i-th element of a at the time of the demand. The sequence stops if a has less than i elements at this point.

        val to_seq_rev : 'a t -> 'a Seq.t

        to_seq_rev a is the sequence of elements get a (l - 1), get a (l - 2)... get a 0, where l is length a at the time to_seq_rev is invoked.

        val to_seq_rev_reentrant : 'a t -> 'a Seq.t

        to_seq_rev_reentrant a is a reentrant variant of to_seq_rev, in the sense that one may still access its elements after the length of a has changed.

        Elements that have been removed from the array by the time they are demanded in the sequence are skipped.

        Advanced topics for performance

        Backing array, capacity

        Internally, a dynamic array uses a backing array (a fixed-size array as provided by the Array module) whose length is greater or equal to the length of the dynamic array. We define the capacity of a dynamic array as the length of its backing array.

        The capacity of a dynamic array is relevant in advanced scenarios, when reasoning about the performance of dynamic array programs:

        • The memory usage of a dynamic array is proportional to its capacity, rather than its length.
        • When there is no empty space left at the end of the backing array, adding elements requires allocating a new, larger backing array.

        The implementation uses a standard exponential reallocation strategy which guarantees amortized constant-time operation; in particular, the total capacity of all backing arrays allocated over the lifetime of a dynamic array is at worst proportional to the total number of elements added.

        In other words, users need not care about capacity and reallocations, and they will get reasonable behavior by default. However, in some performance-sensitive scenarios the functions below can help control memory usage or guarantee an optimal number of reallocations.

        val capacity : 'a t -> int

        capacity a is the length of a's backing array.

        val ensure_capacity : 'a t -> int -> unit

        ensure_capacity a n makes sure that the capacity of a is at least n.

        • raises Invalid_argument

          if the requested capacity is outside the range 0 .. Sys.max_array_length.

          An example would be to reimplement of_array without using init:

          let of_array arr =
          +  let a = Dynarray.create () in
          +  Dynarray.ensure_capacity a (Array.length arr);
          +  Array.iter (fun v -> add_last a v) arr

          Using ensure_capacity guarantees that at most one reallocation will take place, instead of possibly several.

          Without this ensure_capacity hint, the number of resizes would be logarithmic in the length of arr, creating a constant-factor slowdown noticeable when arr is large.

        val ensure_extra_capacity : 'a t -> int -> unit

        ensure_extra_capacity a n is ensure_capacity a (length a + n), it makes sure that a has room for n extra items.

        • raises Invalid_argument

          if the total requested capacity is outside the range 0 .. Sys.max_array_length.

          A use case would be to implement append_array:

          let append_array a arr =
          +  ensure_extra_capacity a (Array.length arr);
          +  Array.iter (fun v -> add_last a v) arr
        val fit_capacity : 'a t -> unit

        fit_capacity a reallocates a backing array if necessary, so that the resulting capacity is exactly length a, with no additional empty space at the end. This can be useful to make sure there is no memory wasted on a long-lived array.

        Note that calling fit_capacity breaks the amortized complexity guarantees provided by the default reallocation strategy. Calling it repeatedly on an array may have quadratic complexity, both in time and in total number of words allocated.

        If you know that a dynamic array has reached its final length, which will remain fixed in the future, it is sufficient to call to_array and only keep the resulting fixed-size array. fit_capacity is useful when you need to keep a dynamic array for eventual future resizes.

        val set_capacity : 'a t -> int -> unit

        set_capacity a n reallocates a backing array if necessary, so that the resulting capacity is exactly n. In particular, all elements of index n or greater are removed.

        Like fit_capacity, this function breaks the amortized complexity guarantees provided by the reallocation strategy. Calling it repeatedly on an array may have quadratic complexity, both in time and in total number of words allocated.

        This is an advanced function; in particular, ensure_capacity should be preferred to increase the capacity, as it preserves those amortized guarantees.

        val reset : 'a t -> unit

        reset a clears a and replaces its backing array by an empty array.

        It is equivalent to set_capacity a 0 or clear a; fit_capacity a.

        No leaks: preservation of memory liveness

        The user-provided values reachable from a dynamic array a are exactly the elements in the indices 0 to length a - 1. In particular, no user-provided values are "leaked" by being present in the backing array at index length a or later.

        Code examples

        Min-heaps for mutable priority queues

        We can use dynamic arrays to implement a mutable priority queue. A priority queue provides a function to add elements, and a function to extract the minimum element -- according to some comparison function.

        (* We present our priority queues as a functor
        +   parametrized on the comparison function. *)
        +module Heap (Elem : Map.OrderedType) : sig
        +  type t
        +  val create : unit -> t
        +  val add : t -> Elem.t -> unit
        +  val pop_min : t -> Elem.t option
        +end = struct
        +
        +  (* Our priority queues are implemented using the standard "min heap"
        +     data structure, a dynamic array representing a binary tree. *)
        +  type t = Elem.t Dynarray.t
        +  let create = Dynarray.create
        +
        + (* The node of index [i] has as children the nodes of index [2 * i + 1]
        +    and [2 * i + 2] -- if they are valid indices in the dynarray. *)
        +  let left_child i = 2 * i + 1
        +  let right_child i = 2 * i + 2
        +  let parent_node i = (i - 1) / 2
        +
        +  (* We use indexing operators for convenient notations. *)
        +  let ( .!() ) = Dynarray.get
        +  let ( .!()<- ) = Dynarray.set
        +
        +  (* Auxiliary functions to compare and swap two elements
        +     in the dynamic array. *)
        +  let order h i j =
        +    Elem.compare h.!(i) h.!(j)
        +
        +  let swap h i j =
        +    let v = h.!(i) in
        +    h.!(i) <- h.!(j);
        +    h.!(j) <- v
        +
        +  (* We say that a heap respects the "heap ordering" if the value of
        +     each node is smaller than the value of its children. The
        +     algorithm manipulates arrays that respect the heap algorithm,
        +     except for one node whose value may be too small or too large.
        +
        +     The auxiliary functions [heap_up] and [heap_down] take
        +     such a misplaced value, and move it "up" (respectively: "down")
        +     the tree by permuting it with its parent value (respectively:
        +     a child value) until the heap ordering is restored. *)
        +
        +  let rec heap_up h i =
        +    if i = 0 then () else
        +    let parent = parent_node i in
        +    if order h i parent < 0 then
        +      (swap h i parent; heap_up h parent)
        +
        +  and heap_down h ~len i =
        +    let left, right = left_child i, right_child i in
        +    if left >= len then () (* no child, stop *) else
        +    let smallest =
        +      if right >= len then left (* no right child *) else
        +      if order h left right < 0 then left else right
        +    in
        +    if order h i smallest > 0 then
        +      (swap h i smallest; heap_down h ~len smallest)
        +
        +  let add h s =
        +    let i = Dynarray.length h in
        +    Dynarray.add_last h s;
        +    heap_up h i
        +
        +  let pop_min h =
        +    if Dynarray.is_empty h then None
        +    else begin
        +      (* Standard trick: swap the 'best' value at index 0
        +         with the last value of the array. *)
        +      let last = Dynarray.length h - 1 in
        +      swap h 0 last;
        +      (* At this point [pop_last] returns the 'best' value,
        +         and leaves a heap with one misplaced element at index [0]. *)
        +      let best = Dynarray.pop_last h in
        +      (* Restore the heap ordering -- does nothing if the heap is empty. *)
        +      heap_down h ~len:last 0;
        +      Some best
        +    end
        +end

        The production code from which this example was inspired includes logic to free the backing array when the heap becomes empty, only in the case where the capacity is above a certain threshold. This can be done by calling the following function from pop:

        let shrink h =
        +  if Dynarray.length h = 0 && Dynarray.capacity h > 1 lsl 18 then
        +    Dynarray.reset h

        The Heap functor can be used to implement a sorting function, by adding all elements into a priority queue and then extracting them in order.

        let heap_sort (type a) cmp li =
        +  let module Heap = Heap(struct type t = a let compare = cmp end) in
        +  let heap = Heap.create () in
        +  List.iter (Heap.add heap) li;
        +  List.map (fun _ -> Heap.pop_min heap |> Option.get) li
        diff --git a/ocaml/Stdlib/Effect/Deep/index.html b/ocaml/Stdlib/Effect/Deep/index.html index 6b908c1a..0a4671e8 100644 --- a/ocaml/Stdlib/Effect/Deep/index.html +++ b/ocaml/Stdlib/Effect/Deep/index.html @@ -1,5 +1,5 @@ -Deep (ocaml.Stdlib.Effect.Deep)

        Module Effect.Deep

        Deep handlers

        type ('a, 'b) continuation

        ('a,'b) continuation is a delimited continuation that expects a 'a value and returns a 'b value.

        val continue : ('a, 'b) continuation -> 'a -> 'b

        continue k x resumes the continuation k by passing x to k.

        val discontinue : ('a, 'b) continuation -> exn -> 'b

        discontinue k e resumes the continuation k by raising the exception e in k.

        val discontinue_with_backtrace : +Deep (ocaml.Stdlib.Effect.Deep)

        Module Effect.Deep

        Deep handlers

        type nonrec ('a, 'b) continuation = ('a, 'b) continuation

        ('a,'b) continuation is a delimited continuation that expects a 'a value and returns a 'b value.

        val continue : ('a, 'b) continuation -> 'a -> 'b

        continue k x resumes the continuation k by passing x to k.

        val discontinue : ('a, 'b) continuation -> exn -> 'b

        discontinue k e resumes the continuation k by raising the exception e in k.

        val discontinue_with_backtrace : ('a, 'b) continuation -> exn -> Printexc.raw_backtrace -> diff --git a/ocaml/Stdlib/Effect/index.html b/ocaml/Stdlib/Effect/index.html index 7f13be68..df0a6757 100644 --- a/ocaml/Stdlib/Effect/index.html +++ b/ocaml/Stdlib/Effect/index.html @@ -1,2 +1,2 @@ -Effect (ocaml.Stdlib.Effect)

        Module Stdlib.Effect

        • alert unstable The Effect interface may change in incompatible ways in the future.

        Effects.

        See 'Language extensions/Effect handlers' section in the manual.

        • since 5.0
        • alert unstable The Effect interface may change in incompatible ways in the future.
        type _ t = ..

        The type of effects.

        exception Unhandled : 'a t -> exn

        Unhandled e is raised when effect e is performed and there is no handler for it.

        exception Continuation_already_resumed

        Exception raised when a continuation is continued or discontinued more than once.

        val perform : 'a t -> 'a

        perform e performs an effect e.

        • raises Unhandled

          if there is no handler for e.

        module Deep : sig ... end

        Deep handlers

        module Shallow : sig ... end
        +Effect (ocaml.Stdlib.Effect)

        Module Stdlib.Effect

        • alert unstable The Effect interface may change in incompatible ways in the future.

        Effects.

        See 'Language extensions/Effect handlers' section in the manual.

        • since 5.0
        • alert unstable The Effect interface may change in incompatible ways in the future.
        type 'a t = 'a eff = ..

        The type of effects.

        exception Unhandled : 'a t -> exn

        Unhandled e is raised when effect e is performed and there is no handler for it.

        exception Continuation_already_resumed

        Exception raised when a continuation is continued or discontinued more than once.

        val perform : 'a t -> 'a

        perform e performs an effect e.

        • raises Unhandled

          if there is no handler for e.

        module Deep : sig ... end

        Deep handlers

        module Shallow : sig ... end
        diff --git a/ocaml/Stdlib/Float/Array/index.html b/ocaml/Stdlib/Float/Array/index.html index 2b83f3b8..145c352c 100644 --- a/ocaml/Stdlib/Float/Array/index.html +++ b/ocaml/Stdlib/Float/Array/index.html @@ -1,5 +1,5 @@ -Array (ocaml.Stdlib.Float.Array)

        Module Float.Array

        Float arrays with packed representation.

        type t = floatarray

        The type of float arrays with packed representation.

        • since 4.08
        val length : t -> int

        Return the length (number of elements) of the given floatarray.

        val get : t -> int -> float

        get a n returns the element number n of floatarray a.

        val set : t -> int -> float -> unit

        set a n x modifies floatarray a in place, replacing element number n with x.

        val make : int -> float -> t

        make n x returns a fresh floatarray of length n, initialized with x.

        val create : int -> t

        create n returns a fresh floatarray of length n, with uninitialized data.

        val init : int -> (int -> float) -> t

        init n f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied to the integers 0 to n-1.

        val append : t -> t -> t

        append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

        val concat : t list -> t

        Same as append, but concatenates a list of floatarrays.

        val sub : t -> int -> int -> t

        sub a pos len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : t -> t

        copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

        val fill : t -> int -> int -> float -> unit

        fill a pos len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

        val blit : t -> int -> t -> int -> int -> unit

        blit src src_pos dst dst_pos len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

        • raises Invalid_argument

          if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

        val to_list : t -> float list

        to_list a returns the list of all the elements of a.

        val of_list : float list -> t

        of_list l returns a fresh floatarray containing the elements of l.

        • raises Invalid_argument

          if the length of l is greater than Sys.max_floatarray_length.

        Iterators

        val iter : (float -> unit) -> t -> unit

        iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

        val iteri : (int -> float -> unit) -> t -> unit

        Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

        val map : (float -> float) -> t -> t

        map f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        val map_inplace : (float -> float) -> t -> unit

        map_inplace f a applies function f to all elements of a, and updates their values in place.

        • since 5.1
        val mapi : (int -> float -> float) -> t -> t

        Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val mapi_inplace : (int -> float -> float) -> t -> unit

        Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        • since 5.1
        val fold_left : ('acc -> float -> 'acc) -> 'acc -> t -> 'acc

        fold_left f x init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

        val fold_right : (float -> 'acc -> 'acc) -> t -> 'acc -> 'acc

        fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

        Iterators on two arrays

        val iter2 : (float -> float -> unit) -> t -> t -> unit

        Array.iter2 f a b applies function f to all the elements of a and b.

        val map2 : (float -> float -> float) -> t -> t -> t

        map2 f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        Array scanning

        val for_all : (float -> bool) -> t -> bool

        for_all f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        val exists : (float -> bool) -> t -> bool

        exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        val mem : float -> t -> bool

        mem a set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

        val mem_ieee : float -> t -> bool

        Same as mem, but uses IEEE equality instead of structural equality.

        Array searching

        val find_opt : (float -> bool) -> t -> float option
        val find_index : (float -> bool) -> t -> int option

        find_index f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : (float -> 'a option) -> t -> 'a option
        val find_mapi : (int -> float -> 'a option) -> t -> 'a option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Sorting

        val sort : (float -> float -> int) -> t -> unit

        Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if and only if i >= j
        val stable_sort : (float -> float -> int) -> t -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

        val fast_sort : (float -> float -> int) -> t -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        Float arrays and Sequences

        val to_seq : t -> float Seq.t

        Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

        val to_seqi : t -> (int * float) Seq.t

        Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

        val of_seq : float Seq.t -> t

        Create an array from the generator.

        val map_to_array : (float -> 'a) -> t -> 'a array

        map_to_array f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

        val map_from_array : ('a -> float) -> 'a array -> t

        map_from_array f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        Arrays and concurrency safety

        Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
        +Array (ocaml.Stdlib.Float.Array)

        Module Float.Array

        Float arrays with packed representation.

        type t = floatarray

        The type of float arrays with packed representation.

        • since 4.08
        val length : t -> int

        Return the length (number of elements) of the given floatarray.

        val get : t -> int -> float

        get a n returns the element number n of floatarray a.

        val set : t -> int -> float -> unit

        set a n x modifies floatarray a in place, replacing element number n with x.

        val make : int -> float -> t

        make n x returns a fresh floatarray of length n, initialized with x.

        val create : int -> t

        create n returns a fresh floatarray of length n, with uninitialized data.

        val init : int -> (int -> float) -> t

        init n f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied to the integers 0 to n-1.

        val make_matrix : int -> int -> float -> t array

        make_matrix dimx dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy, where all elements are initialized with e.

        • since 5.2
        val init_matrix : int -> int -> (int -> int -> float) -> t array

        init_matrix dimx dimy f returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy, where the element at index (x,y) is initialized with f x y.

        • since 5.2
        val append : t -> t -> t

        append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

        val concat : t list -> t

        Same as append, but concatenates a list of floatarrays.

        val sub : t -> int -> int -> t

        sub a pos len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : t -> t

        copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

        val fill : t -> int -> int -> float -> unit

        fill a pos len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

        val blit : t -> int -> t -> int -> int -> unit

        blit src src_pos dst dst_pos len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

        • raises Invalid_argument

          if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

        val to_list : t -> float list

        to_list a returns the list of all the elements of a.

        val of_list : float list -> t

        of_list l returns a fresh floatarray containing the elements of l.

        • raises Invalid_argument

          if the length of l is greater than Sys.max_floatarray_length.

        Iterators

        val iter : (float -> unit) -> t -> unit

        iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

        val iteri : (int -> float -> unit) -> t -> unit

        Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

        val map : (float -> float) -> t -> t

        map f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        val map_inplace : (float -> float) -> t -> unit

        map_inplace f a applies function f to all elements of a, and updates their values in place.

        • since 5.1
        val mapi : (int -> float -> float) -> t -> t

        Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val mapi_inplace : (int -> float -> float) -> t -> unit

        Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        • since 5.1
        val fold_left : ('acc -> float -> 'acc) -> 'acc -> t -> 'acc

        fold_left f x init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

        val fold_right : (float -> 'acc -> 'acc) -> t -> 'acc -> 'acc

        fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

        Iterators on two arrays

        val iter2 : (float -> float -> unit) -> t -> t -> unit

        Array.iter2 f a b applies function f to all the elements of a and b.

        val map2 : (float -> float -> float) -> t -> t -> t

        map2 f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        Array scanning

        val for_all : (float -> bool) -> t -> bool

        for_all f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        val exists : (float -> bool) -> t -> bool

        exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        val mem : float -> t -> bool

        mem a set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

        val mem_ieee : float -> t -> bool

        Same as mem, but uses IEEE equality instead of structural equality.

        Array searching

        val find_opt : (float -> bool) -> t -> float option
        val find_index : (float -> bool) -> t -> int option

        find_index f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : (float -> 'a option) -> t -> 'a option
        val find_mapi : (int -> float -> 'a option) -> t -> 'a option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Sorting and shuffling

        val sort : (float -> float -> int) -> t -> unit

        Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if i >= j
        val stable_sort : (float -> float -> int) -> t -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

        val fast_sort : (float -> float -> int) -> t -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        val shuffle : rand:(int -> int) -> t -> unit

        shuffle rand a randomly permutes a's elements using rand for randomness. The distribution of permutations is uniform.

        rand must be such that a call to rand n returns a uniformly distributed random number in the range [0;n-1]. Random.int can be used for this (do not forget to initialize the generator).

        • since 5.2

        Float arrays and Sequences

        val to_seq : t -> float Seq.t

        Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

        val to_seqi : t -> (int * float) Seq.t

        Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

        val of_seq : float Seq.t -> t

        Create an array from the generator.

        val map_to_array : (float -> 'a) -> t -> 'a array

        map_to_array f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

        val map_from_array : ('a -> float) -> 'a array -> t

        map_from_array f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        Arrays and concurrency safety

        Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
         let a = Float.Array.make size 1.
         let update a f () =
            Float.Array.iteri (fun i x -> Float.Array.set a i (f x)) a
        diff --git a/ocaml/Stdlib/Float/ArrayLabels/index.html b/ocaml/Stdlib/Float/ArrayLabels/index.html
        index 0fe5f50d..eda213f6 100644
        --- a/ocaml/Stdlib/Float/ArrayLabels/index.html
        +++ b/ocaml/Stdlib/Float/ArrayLabels/index.html
        @@ -1,5 +1,5 @@
         
        -ArrayLabels (ocaml.Stdlib.Float.ArrayLabels)

        Module Float.ArrayLabels

        Float arrays with packed representation (labeled functions).

        type t = floatarray

        The type of float arrays with packed representation.

        • since 4.08
        val length : t -> int

        Return the length (number of elements) of the given floatarray.

        val get : t -> int -> float

        get a n returns the element number n of floatarray a.

        val set : t -> int -> float -> unit

        set a n x modifies floatarray a in place, replacing element number n with x.

        val make : int -> float -> t

        make n x returns a fresh floatarray of length n, initialized with x.

        val create : int -> t

        create n returns a fresh floatarray of length n, with uninitialized data.

        val init : int -> f:(int -> float) -> t

        init n ~f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied to the integers 0 to n-1.

        val append : t -> t -> t

        append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

        val concat : t list -> t

        Same as append, but concatenates a list of floatarrays.

        val sub : t -> pos:int -> len:int -> t

        sub a ~pos ~len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : t -> t

        copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

        val fill : t -> pos:int -> len:int -> float -> unit

        fill a ~pos ~len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

        val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit

        blit ~src ~src_pos ~dst ~dst_pos ~len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

        • raises Invalid_argument

          if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

        val to_list : t -> float list

        to_list a returns the list of all the elements of a.

        val of_list : float list -> t

        of_list l returns a fresh floatarray containing the elements of l.

        • raises Invalid_argument

          if the length of l is greater than Sys.max_floatarray_length.

        Iterators

        val iter : f:(float -> unit) -> t -> unit

        iter ~f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

        val iteri : f:(int -> float -> unit) -> t -> unit

        Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

        val map : f:(float -> float) -> t -> t

        map ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        val map_inplace : f:(float -> float) -> t -> unit

        map_inplace f a applies function f to all elements of a, and updates their values in place.

        • since 5.1
        val mapi : f:(int -> float -> float) -> t -> t

        Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val mapi_inplace : f:(int -> float -> float) -> t -> unit

        Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        • since 5.1
        val fold_left : f:('acc -> float -> 'acc) -> init:'acc -> t -> 'acc

        fold_left ~f x ~init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

        val fold_right : f:(float -> 'acc -> 'acc) -> t -> init:'acc -> 'acc

        fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

        Iterators on two arrays

        val iter2 : f:(float -> float -> unit) -> t -> t -> unit

        Array.iter2 ~f a b applies function f to all the elements of a and b.

        val map2 : f:(float -> float -> float) -> t -> t -> t

        map2 ~f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        Array scanning

        val for_all : f:(float -> bool) -> t -> bool

        for_all ~f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        val exists : f:(float -> bool) -> t -> bool

        exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        val mem : float -> set:t -> bool

        mem a ~set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

        val mem_ieee : float -> set:t -> bool

        Same as mem, but uses IEEE equality instead of structural equality.

        Array searching

        val find_opt : f:(float -> bool) -> t -> float option
        val find_index : f:(float -> bool) -> t -> int option

        find_index ~f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : f:(float -> 'a option) -> t -> 'a option
        val find_mapi : f:(int -> float -> 'a option) -> t -> 'a option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Sorting

        val sort : cmp:(float -> float -> int) -> t -> unit

        Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if and only if i >= j
        val stable_sort : cmp:(float -> float -> int) -> t -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

        val fast_sort : cmp:(float -> float -> int) -> t -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        Float arrays and Sequences

        val to_seq : t -> float Seq.t

        Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

        val to_seqi : t -> (int * float) Seq.t

        Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

        val of_seq : float Seq.t -> t

        Create an array from the generator.

        val map_to_array : f:(float -> 'a) -> t -> 'a array

        map_to_array ~f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

        val map_from_array : f:('a -> float) -> 'a array -> t

        map_from_array ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        Arrays and concurrency safety

        Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
        +ArrayLabels (ocaml.Stdlib.Float.ArrayLabels)

        Module Float.ArrayLabels

        Float arrays with packed representation (labeled functions).

        type t = floatarray

        The type of float arrays with packed representation.

        • since 4.08
        val length : t -> int

        Return the length (number of elements) of the given floatarray.

        val get : t -> int -> float

        get a n returns the element number n of floatarray a.

        val set : t -> int -> float -> unit

        set a n x modifies floatarray a in place, replacing element number n with x.

        val make : int -> float -> t

        make n x returns a fresh floatarray of length n, initialized with x.

        val create : int -> t

        create n returns a fresh floatarray of length n, with uninitialized data.

        val init : int -> f:(int -> float) -> t

        init n ~f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied to the integers 0 to n-1.

        val make_matrix : dimx:int -> dimy:int -> float -> t array

        make_matrix ~dimx ~dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy, where all elements are initialized with e.

        • since 5.2
        val init_matrix : dimx:int -> dimy:int -> f:(int -> int -> float) -> t array

        init_matrix ~dimx ~dimy ~f returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy, where the element at index (x,y) is initialized with f x y.

        • since 5.2
        val append : t -> t -> t

        append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

        val concat : t list -> t

        Same as append, but concatenates a list of floatarrays.

        val sub : t -> pos:int -> len:int -> t

        sub a ~pos ~len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

        • raises Invalid_argument

          if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

        val copy : t -> t

        copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

        val fill : t -> pos:int -> len:int -> float -> unit

        fill a ~pos ~len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

        val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit

        blit ~src ~src_pos ~dst ~dst_pos ~len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

        • raises Invalid_argument

          if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

        val to_list : t -> float list

        to_list a returns the list of all the elements of a.

        val of_list : float list -> t

        of_list l returns a fresh floatarray containing the elements of l.

        • raises Invalid_argument

          if the length of l is greater than Sys.max_floatarray_length.

        Iterators

        val iter : f:(float -> unit) -> t -> unit

        iter ~f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

        val iteri : f:(int -> float -> unit) -> t -> unit

        Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

        val map : f:(float -> float) -> t -> t

        map ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        val map_inplace : f:(float -> float) -> t -> unit

        map_inplace f a applies function f to all elements of a, and updates their values in place.

        • since 5.1
        val mapi : f:(int -> float -> float) -> t -> t

        Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        val mapi_inplace : f:(int -> float -> float) -> t -> unit

        Same as map_inplace, but the function is applied to the index of the element as first argument, and the element itself as second argument.

        • since 5.1
        val fold_left : f:('acc -> float -> 'acc) -> init:'acc -> t -> 'acc

        fold_left ~f x ~init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

        val fold_right : f:(float -> 'acc -> 'acc) -> t -> init:'acc -> 'acc

        fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

        Iterators on two arrays

        val iter2 : f:(float -> float -> unit) -> t -> t -> unit

        Array.iter2 ~f a b applies function f to all the elements of a and b.

        val map2 : f:(float -> float -> float) -> t -> t -> t

        map2 ~f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

        Array scanning

        val for_all : f:(float -> bool) -> t -> bool

        for_all ~f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

        val exists : f:(float -> bool) -> t -> bool

        exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

        val mem : float -> set:t -> bool

        mem a ~set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

        val mem_ieee : float -> set:t -> bool

        Same as mem, but uses IEEE equality instead of structural equality.

        Array searching

        val find_opt : f:(float -> bool) -> t -> float option
        val find_index : f:(float -> bool) -> t -> int option

        find_index ~f a returns Some i, where i is the index of the first element of the array a that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : f:(float -> 'a option) -> t -> 'a option
        val find_mapi : f:(int -> float -> 'a option) -> t -> 'a option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1

        Sorting and shuffling

        val sort : cmp:(float -> float -> int) -> t -> unit

        Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

        The current implementation uses Heap Sort. It runs in constant stack space.

        Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

        • cmp x y > 0 if and only if cmp y x < 0
        • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

        When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

        • cmp a.(i) a.(j) >= 0 if i >= j
        val stable_sort : cmp:(float -> float -> int) -> t -> unit

        Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

        The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

        val fast_sort : cmp:(float -> float -> int) -> t -> unit

        Same as sort or stable_sort, whichever is faster on typical input.

        val shuffle : rand:(int -> int) -> t -> unit

        shuffle ~rand a randomly permutes a's elements using rand for randomness. The distribution of permutations is uniform.

        rand must be such that a call to rand n returns a uniformly distributed random number in the range [0;n-1]. Random.int can be used for this (do not forget to initialize the generator).

        • since 5.2

        Float arrays and Sequences

        val to_seq : t -> float Seq.t

        Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

        val to_seqi : t -> (int * float) Seq.t

        Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

        val of_seq : float Seq.t -> t

        Create an array from the generator.

        val map_to_array : f:(float -> 'a) -> t -> 'a array

        map_to_array ~f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

        val map_from_array : f:('a -> float) -> 'a array -> t

        map_from_array ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

        Arrays and concurrency safety

        Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

        Atomicity

        Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

        For example, consider the following program:

        let size = 100_000_000
         let a = Float.ArrayLabels.make size 1.
         let update a f () =
            Float.ArrayLabels.iteri ~f:(fun i x -> Float.Array.set a i (f x)) a
        diff --git a/ocaml/Stdlib/Float/index.html b/ocaml/Stdlib/Float/index.html
        index 0f4eb20f..f08c56c3 100644
        --- a/ocaml/Stdlib/Float/index.html
        +++ b/ocaml/Stdlib/Float/index.html
        @@ -1,2 +1,2 @@
         
        -Float (ocaml.Stdlib.Float)

        Module Stdlib.Float

        Floating-point arithmetic.

        OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. Floating-point operations never raise an exception on overflow, underflow, division by zero, etc. Instead, special IEEE numbers are returned as appropriate, such as infinity for 1.0 /. 0.0, neg_infinity for -1.0 /. 0.0, and nan ('not a number') for 0.0 /. 0.0. These special numbers then propagate through floating-point computations as expected: for instance, 1.0 /. infinity is 0.0, basic arithmetic operations (+., -., *., /.) with nan as an argument return nan, ...

        • since 4.07
        val zero : float

        The floating point 0.

        • since 4.08
        val one : float

        The floating-point 1.

        • since 4.08
        val minus_one : float

        The floating-point -1.

        • since 4.08
        val neg : float -> float

        Unary negation.

        val add : float -> float -> float

        Floating-point addition.

        val sub : float -> float -> float

        Floating-point subtraction.

        val mul : float -> float -> float

        Floating-point multiplication.

        val div : float -> float -> float

        Floating-point division.

        val fma : float -> float -> float -> float

        fma x y z returns x * y + z, with a best effort for computing this expression with a single rounding, using either hardware instructions (providing full IEEE compliance) or a software emulation.

        On 64-bit Cygwin, 64-bit mingw-w64 and MSVC 2017 and earlier, this function may be emulated owing to known bugs on limitations on these platforms. Note: since software emulation of the fma is costly, make sure that you are using hardware fma support if performance matters.

        • since 4.08
        val rem : float -> float -> float

        rem a b returns the remainder of a with respect to b. The returned value is a -. n *. b, where n is the quotient a /. b rounded towards zero to an integer.

        val succ : float -> float

        succ x returns the floating point number right after x i.e., the smallest floating-point number greater than x. See also next_after.

        • since 4.08
        val pred : float -> float

        pred x returns the floating-point number right before x i.e., the greatest floating-point number smaller than x. See also next_after.

        • since 4.08
        val abs : float -> float

        abs f returns the absolute value of f.

        val infinity : float

        Positive infinity.

        val neg_infinity : float

        Negative infinity.

        val nan : float

        A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for 'not a number'. Any floating-point operation with nan as argument returns nan as result, unless otherwise specified in IEEE 754 standard. As for floating-point comparisons, =, <, <=, > and >= return false and <> returns true if one or both of their arguments is nan.

        nan is quiet_nan since 5.1; it was a signaling NaN before.

        val signaling_nan : float

        Signaling NaN. The corresponding signals do not raise OCaml exception, but the value can be useful for interoperability with C libraries.

        • since 5.1
        val quiet_nan : float

        Quiet NaN.

        • since 5.1
        val pi : float

        The constant pi.

        val max_float : float

        The largest positive finite value of type float.

        val min_float : float

        The smallest positive, non-zero, non-denormalized value of type float.

        val epsilon : float

        The difference between 1.0 and the smallest exactly representable floating-point number greater than 1.0.

        val is_finite : float -> bool

        is_finite x is true if and only if x is finite i.e., not infinite and not nan.

        • since 4.08
        val is_infinite : float -> bool

        is_infinite x is true if and only if x is infinity or neg_infinity.

        • since 4.08
        val is_nan : float -> bool

        is_nan x is true if and only if x is not a number (see nan).

        • since 4.08
        val is_integer : float -> bool

        is_integer x is true if and only if x is an integer.

        • since 4.08
        val of_int : int -> float

        Convert an integer to floating-point.

        val to_int : float -> int

        Truncate the given floating-point number to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

        val of_string : string -> float

        Convert the given string to a float. The string is read in decimal (by default) or in hexadecimal (marked by 0x or 0X). The format of decimal floating-point numbers is [-] dd.ddd (e|E) [+|-] dd , where d stands for a decimal digit. The format of hexadecimal floating-point numbers is [-] 0(x|X) hh.hhh (p|P) [+|-] dd , where h stands for an hexadecimal digit and d for a decimal digit. In both cases, at least one of the integer and fractional parts must be given; the exponent part is optional. The _ (underscore) character can appear anywhere in the string and is ignored. Depending on the execution platforms, other representations of floating-point numbers can be accepted, but should not be relied upon.

        • raises Failure

          if the given string is not a valid representation of a float.

        val of_string_opt : string -> float option

        Same as of_string, but returns None instead of raising.

        val to_string : float -> string

        Return a string representation of a floating-point number.

        This conversion can involve a loss of precision. For greater control over the manner in which the number is printed, see Printf.

        This function is an alias for Stdlib.string_of_float.

        type fpclass = fpclass =
        1. | FP_normal
          (*

          Normal number, none of the below

          *)
        2. | FP_subnormal
          (*

          Number very close to 0.0, has reduced precision

          *)
        3. | FP_zero
          (*

          Number is 0.0 or -0.0

          *)
        4. | FP_infinite
          (*

          Number is positive or negative infinity

          *)
        5. | FP_nan
          (*

          Not a number: result of an undefined operation

          *)

        The five classes of floating-point numbers, as determined by the classify_float function.

        val classify_float : float -> fpclass

        Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.

        val pow : float -> float -> float

        Exponentiation.

        val sqrt : float -> float

        Square root.

        val cbrt : float -> float

        Cube root.

        • since 4.13
        val exp : float -> float

        Exponential.

        val exp2 : float -> float

        Base 2 exponential function.

        • since 4.13
        val log : float -> float

        Natural logarithm.

        val log10 : float -> float

        Base 10 logarithm.

        val log2 : float -> float

        Base 2 logarithm.

        • since 4.13
        val expm1 : float -> float

        expm1 x computes exp x -. 1.0, giving numerically-accurate results even if x is close to 0.0.

        val log1p : float -> float

        log1p x computes log(1.0 +. x) (natural logarithm), giving numerically-accurate results even if x is close to 0.0.

        val cos : float -> float

        Cosine. Argument is in radians.

        val sin : float -> float

        Sine. Argument is in radians.

        val tan : float -> float

        Tangent. Argument is in radians.

        val acos : float -> float

        Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.

        val asin : float -> float

        Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.

        val atan : float -> float

        Arc tangent. Result is in radians and is between -pi/2 and pi/2.

        val atan2 : float -> float -> float

        atan2 y x returns the arc tangent of y /. x. The signs of x and y are used to determine the quadrant of the result. Result is in radians and is between -pi and pi.

        val hypot : float -> float -> float

        hypot x y returns sqrt(x *. x +. y *. y), that is, the length of the hypotenuse of a right-angled triangle with sides of length x and y, or, equivalently, the distance of the point (x,y) to origin. If one of x or y is infinite, returns infinity even if the other is nan.

        val cosh : float -> float

        Hyperbolic cosine. Argument is in radians.

        val sinh : float -> float

        Hyperbolic sine. Argument is in radians.

        val tanh : float -> float

        Hyperbolic tangent. Argument is in radians.

        val acosh : float -> float

        Hyperbolic arc cosine. The argument must fall within the range [1.0, inf]. Result is in radians and is between 0.0 and inf.

        • since 4.13
        val asinh : float -> float

        Hyperbolic arc sine. The argument and result range over the entire real line. Result is in radians.

        • since 4.13
        val atanh : float -> float

        Hyperbolic arc tangent. The argument must fall within the range [-1.0, 1.0]. Result is in radians and ranges over the entire real line.

        • since 4.13
        val erf : float -> float

        Error function. The argument ranges over the entire real line. The result is always within [-1.0, 1.0].

        • since 4.13
        val erfc : float -> float

        Complementary error function (erfc x = 1 - erf x). The argument ranges over the entire real line. The result is always within [-1.0, 1.0].

        • since 4.13
        val trunc : float -> float

        trunc x rounds x to the nearest integer whose absolute value is less than or equal to x.

        • since 4.08
        val round : float -> float

        round x rounds x to the nearest integer with ties (fractional values of 0.5) rounded away from zero, regardless of the current rounding direction. If x is an integer, +0., -0., nan, or infinite, x itself is returned.

        On 64-bit mingw-w64, this function may be emulated owing to a bug in the C runtime library (CRT) on this platform.

        • since 4.08
        val ceil : float -> float

        Round above to an integer value. ceil f returns the least integer value greater than or equal to f. The result is returned as a float.

        val floor : float -> float

        Round below to an integer value. floor f returns the greatest integer value less than or equal to f. The result is returned as a float.

        val next_after : float -> float -> float

        next_after x y returns the next representable floating-point value following x in the direction of y. More precisely, if y is greater (resp. less) than x, it returns the smallest (resp. largest) representable number greater (resp. less) than x. If x equals y, the function returns y. If x or y is nan, a nan is returned. Note that next_after max_float infinity = infinity and that next_after 0. infinity is the smallest denormalized positive number. If x is the smallest denormalized positive number, next_after x 0. = 0.

        • since 4.08
        val copy_sign : float -> float -> float

        copy_sign x y returns a float whose absolute value is that of x and whose sign is that of y. If x is nan, returns nan. If y is nan, returns either x or -. x, but it is not specified which.

        val sign_bit : float -> bool

        sign_bit x is true if and only if the sign bit of x is set. For example sign_bit 1. and signbit 0. are false while sign_bit (-1.) and sign_bit (-0.) are true.

        • since 4.08
        val frexp : float -> float * int

        frexp f returns the pair of the significant and the exponent of f. When f is zero, the significant x and the exponent n of f are equal to zero. When f is non-zero, they are defined by f = x *. 2 ** n and 0.5 <= x < 1.0.

        val ldexp : float -> int -> float

        ldexp x n returns x *. 2 ** n.

        val modf : float -> float * float

        modf f returns the pair of the fractional and integral part of f.

        type t = float

        An alias for the type of floating-point numbers.

        val compare : t -> t -> int

        compare x y returns 0 if x is equal to y, a negative integer if x is less than y, and a positive integer if x is greater than y. compare treats nan as equal to itself and less than any other float value. This treatment of nan ensures that compare defines a total ordering relation.

        val equal : t -> t -> bool

        The equal function for floating-point numbers, compared using compare.

        val min : t -> t -> t

        min x y returns the minimum of x and y. It returns nan when x or y is nan. Moreover min (-0.) (+0.) = -0.

        • since 4.08
        val max : float -> float -> float

        max x y returns the maximum of x and y. It returns nan when x or y is nan. Moreover max (-0.) (+0.) = +0.

        • since 4.08
        val min_max : float -> float -> float * float

        min_max x y is (min x y, max x y), just more efficient.

        • since 4.08
        val min_num : t -> t -> t

        min_num x y returns the minimum of x and y treating nan as missing values. If both x and y are nan, nan is returned. Moreover min_num (-0.) (+0.) = -0.

        • since 4.08
        val max_num : t -> t -> t

        max_num x y returns the maximum of x and y treating nan as missing values. If both x and y are nan nan is returned. Moreover max_num (-0.) (+0.) = +0.

        • since 4.08
        val min_max_num : float -> float -> float * float

        min_max_num x y is (min_num x y, max_num x y), just more efficient. Note that in particular min_max_num x nan = (x, x) and min_max_num nan y = (y, y).

        • since 4.08
        val seeded_hash : int -> t -> int

        A seeded hash function for floats, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.1
        val hash : t -> int

        An unseeded hash function for floats, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        module Array : sig ... end

        Float arrays with packed representation.

        module ArrayLabels : sig ... end

        Float arrays with packed representation (labeled functions).

        +Float (ocaml.Stdlib.Float)

        Module Stdlib.Float

        Floating-point arithmetic.

        OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. Floating-point operations never raise an exception on overflow, underflow, division by zero, etc. Instead, special IEEE numbers are returned as appropriate, such as infinity for 1.0 /. 0.0, neg_infinity for -1.0 /. 0.0, and nan ('not a number') for 0.0 /. 0.0. These special numbers then propagate through floating-point computations as expected: for instance, 1.0 /. infinity is 0.0, basic arithmetic operations (+., -., *., /.) with nan as an argument return nan, ...

        • since 4.07
        val zero : float

        The floating point 0.

        • since 4.08
        val one : float

        The floating-point 1.

        • since 4.08
        val minus_one : float

        The floating-point -1.

        • since 4.08
        val neg : float -> float

        Unary negation.

        val add : float -> float -> float

        Floating-point addition.

        val sub : float -> float -> float

        Floating-point subtraction.

        val mul : float -> float -> float

        Floating-point multiplication.

        val div : float -> float -> float

        Floating-point division.

        val fma : float -> float -> float -> float

        fma x y z returns x * y + z, with a best effort for computing this expression with a single rounding, using either hardware instructions (providing full IEEE compliance) or a software emulation.

        On 64-bit Cygwin, 64-bit mingw-w64 and MSVC 2017 and earlier, this function may be emulated owing to known bugs on limitations on these platforms. Note: since software emulation of the fma is costly, make sure that you are using hardware fma support if performance matters.

        • since 4.08
        val rem : float -> float -> float

        rem a b returns the remainder of a with respect to b. The returned value is a -. n *. b, where n is the quotient a /. b rounded towards zero to an integer.

        val succ : float -> float

        succ x returns the floating point number right after x i.e., the smallest floating-point number greater than x. See also next_after.

        • since 4.08
        val pred : float -> float

        pred x returns the floating-point number right before x i.e., the greatest floating-point number smaller than x. See also next_after.

        • since 4.08
        val abs : float -> float

        abs f returns the absolute value of f.

        val infinity : float

        Positive infinity.

        val neg_infinity : float

        Negative infinity.

        val nan : float

        A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for 'not a number'. Any floating-point operation with nan as argument returns nan as result, unless otherwise specified in IEEE 754 standard. As for floating-point comparisons, =, <, <=, > and >= return false and <> returns true if one or both of their arguments is nan.

        nan is quiet_nan since 5.1; it was a signaling NaN before.

        val signaling_nan : float

        Signaling NaN. The corresponding signals do not raise OCaml exception, but the value can be useful for interoperability with C libraries.

        • since 5.1
        val quiet_nan : float

        Quiet NaN.

        • since 5.1
        val pi : float

        The constant pi.

        val max_float : float

        The largest positive finite value of type float.

        val min_float : float

        The smallest positive, non-zero, non-denormalized value of type float.

        val epsilon : float

        The difference between 1.0 and the smallest exactly representable floating-point number greater than 1.0.

        val is_finite : float -> bool

        is_finite x is true if and only if x is finite i.e., not infinite and not nan.

        • since 4.08
        val is_infinite : float -> bool

        is_infinite x is true if and only if x is infinity or neg_infinity.

        • since 4.08
        val is_nan : float -> bool

        is_nan x is true if and only if x is not a number (see nan).

        • since 4.08
        val is_integer : float -> bool

        is_integer x is true if and only if x is an integer.

        • since 4.08
        val of_int : int -> float

        Convert an integer to floating-point.

        val to_int : float -> int

        Truncate the given floating-point number to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

        val of_string : string -> float

        Convert the given string to a float. The string is read in decimal (by default) or in hexadecimal (marked by 0x or 0X). The format of decimal floating-point numbers is [-] dd.ddd (e|E) [+|-] dd , where d stands for a decimal digit. The format of hexadecimal floating-point numbers is [-] 0(x|X) hh.hhh (p|P) [+|-] dd , where h stands for an hexadecimal digit and d for a decimal digit. In both cases, at least one of the integer and fractional parts must be given; the exponent part is optional. The _ (underscore) character can appear anywhere in the string and is ignored. Depending on the execution platforms, other representations of floating-point numbers can be accepted, but should not be relied upon.

        • raises Failure

          if the given string is not a valid representation of a float.

        val of_string_opt : string -> float option

        Same as of_string, but returns None instead of raising.

        val to_string : float -> string

        Return a string representation of a floating-point number.

        This conversion can involve a loss of precision. For greater control over the manner in which the number is printed, see Printf.

        This function is an alias for Stdlib.string_of_float.

        type fpclass = fpclass =
        1. | FP_normal
          (*

          Normal number, none of the below

          *)
        2. | FP_subnormal
          (*

          Number very close to 0.0, has reduced precision

          *)
        3. | FP_zero
          (*

          Number is 0.0 or -0.0

          *)
        4. | FP_infinite
          (*

          Number is positive or negative infinity

          *)
        5. | FP_nan
          (*

          Not a number: result of an undefined operation

          *)

        The five classes of floating-point numbers, as determined by the classify_float function.

        val classify_float : float -> fpclass

        Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.

        val pow : float -> float -> float

        Exponentiation.

        val sqrt : float -> float

        Square root.

        val cbrt : float -> float

        Cube root.

        • since 4.13
        val exp : float -> float

        Exponential.

        val exp2 : float -> float

        Base 2 exponential function.

        • since 4.13
        val log : float -> float

        Natural logarithm.

        val log10 : float -> float

        Base 10 logarithm.

        val log2 : float -> float

        Base 2 logarithm.

        • since 4.13
        val expm1 : float -> float

        expm1 x computes exp x -. 1.0, giving numerically-accurate results even if x is close to 0.0.

        val log1p : float -> float

        log1p x computes log(1.0 +. x) (natural logarithm), giving numerically-accurate results even if x is close to 0.0.

        val cos : float -> float

        Cosine. Argument is in radians.

        val sin : float -> float

        Sine. Argument is in radians.

        val tan : float -> float

        Tangent. Argument is in radians.

        val acos : float -> float

        Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.

        val asin : float -> float

        Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.

        val atan : float -> float

        Arc tangent. Result is in radians and is between -pi/2 and pi/2.

        val atan2 : float -> float -> float

        atan2 y x returns the arc tangent of y /. x. The signs of x and y are used to determine the quadrant of the result. Result is in radians and is between -pi and pi.

        val hypot : float -> float -> float

        hypot x y returns sqrt(x *. x +. y *. y), that is, the length of the hypotenuse of a right-angled triangle with sides of length x and y, or, equivalently, the distance of the point (x,y) to origin. If one of x or y is infinite, returns infinity even if the other is nan.

        val cosh : float -> float

        Hyperbolic cosine. Argument is in radians.

        val sinh : float -> float

        Hyperbolic sine. Argument is in radians.

        val tanh : float -> float

        Hyperbolic tangent. Argument is in radians.

        val acosh : float -> float

        Hyperbolic arc cosine. The argument must fall within the range [1.0, inf]. Result is in radians and is between 0.0 and inf.

        • since 4.13
        val asinh : float -> float

        Hyperbolic arc sine. The argument and result range over the entire real line. Result is in radians.

        • since 4.13
        val atanh : float -> float

        Hyperbolic arc tangent. The argument must fall within the range [-1.0, 1.0]. Result is in radians and ranges over the entire real line.

        • since 4.13
        val erf : float -> float

        Error function. The argument ranges over the entire real line. The result is always within [-1.0, 1.0].

        • since 4.13
        val erfc : float -> float

        Complementary error function (erfc x = 1 - erf x). The argument ranges over the entire real line. The result is always within [0.0, 2.0].

        • since 4.13
        val trunc : float -> float

        trunc x rounds x to the nearest integer whose absolute value is less than or equal to x.

        • since 4.08
        val round : float -> float

        round x rounds x to the nearest integer with ties (fractional values of 0.5) rounded away from zero, regardless of the current rounding direction. If x is an integer, +0., -0., nan, or infinite, x itself is returned.

        On 64-bit mingw-w64, this function may be emulated owing to a bug in the C runtime library (CRT) on this platform.

        • since 4.08
        val ceil : float -> float

        Round above to an integer value. ceil f returns the least integer value greater than or equal to f. The result is returned as a float.

        val floor : float -> float

        Round below to an integer value. floor f returns the greatest integer value less than or equal to f. The result is returned as a float.

        val next_after : float -> float -> float

        next_after x y returns the next representable floating-point value following x in the direction of y. More precisely, if y is greater (resp. less) than x, it returns the smallest (resp. largest) representable number greater (resp. less) than x. If x equals y, the function returns y. If x or y is nan, a nan is returned. Note that next_after max_float infinity = infinity and that next_after 0. infinity is the smallest denormalized positive number. If x is the smallest denormalized positive number, next_after x 0. = 0.

        • since 4.08
        val copy_sign : float -> float -> float

        copy_sign x y returns a float whose absolute value is that of x and whose sign is that of y. If x is nan, returns nan. If y is nan, returns either x or -. x, but it is not specified which.

        val sign_bit : float -> bool

        sign_bit x is true if and only if the sign bit of x is set. For example sign_bit 1. and signbit 0. are false while sign_bit (-1.) and sign_bit (-0.) are true.

        • since 4.08
        val frexp : float -> float * int

        frexp f returns the pair of the significant and the exponent of f. When f is zero, the significant x and the exponent n of f are equal to zero. When f is non-zero, they are defined by f = x *. 2 ** n and 0.5 <= x < 1.0.

        val ldexp : float -> int -> float

        ldexp x n returns x *. 2 ** n.

        val modf : float -> float * float

        modf f returns the pair of the fractional and integral part of f.

        type t = float

        An alias for the type of floating-point numbers.

        val compare : t -> t -> int

        compare x y returns 0 if x is equal to y, a negative integer if x is less than y, and a positive integer if x is greater than y. compare treats nan as equal to itself and less than any other float value. This treatment of nan ensures that compare defines a total ordering relation.

        val equal : t -> t -> bool

        The equal function for floating-point numbers, compared using compare.

        val min : t -> t -> t

        min x y returns the minimum of x and y. It returns nan when x or y is nan. Moreover min (-0.) (+0.) = -0.

        • since 4.08
        val max : float -> float -> float

        max x y returns the maximum of x and y. It returns nan when x or y is nan. Moreover max (-0.) (+0.) = +0.

        • since 4.08
        val min_max : float -> float -> float * float

        min_max x y is (min x y, max x y), just more efficient.

        • since 4.08
        val min_num : t -> t -> t

        min_num x y returns the minimum of x and y treating nan as missing values. If both x and y are nan, nan is returned. Moreover min_num (-0.) (+0.) = -0.

        • since 4.08
        val max_num : t -> t -> t

        max_num x y returns the maximum of x and y treating nan as missing values. If both x and y are nan nan is returned. Moreover max_num (-0.) (+0.) = +0.

        • since 4.08
        val min_max_num : float -> float -> float * float

        min_max_num x y is (min_num x y, max_num x y), just more efficient. Note that in particular min_max_num x nan = (x, x) and min_max_num nan y = (y, y).

        • since 4.08
        val seeded_hash : int -> t -> int

        A seeded hash function for floats, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.1
        val hash : t -> int

        An unseeded hash function for floats, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        module Array : sig ... end

        Float arrays with packed representation.

        module ArrayLabels : sig ... end

        Float arrays with packed representation (labeled functions).

        diff --git a/ocaml/Stdlib/Format/index.html b/ocaml/Stdlib/Format/index.html index 91d1b471..f311cd06 100644 --- a/ocaml/Stdlib/Format/index.html +++ b/ocaml/Stdlib/Format/index.html @@ -5,7 +5,13 @@ Format.print_string "PRETTY"; Stdlib.print_string ">"; Format.print_string "TEXT"; -
        leads to output <>PRETTYTEXT.

        Formatters

        type formatter

        Abstract data corresponding to a pretty-printer (also called a formatter) and all its machinery. See also Defining formatters.

        Pretty-printing boxes

        The pretty-printing engine uses the concepts of pretty-printing box and break hint to drive indentation and line splitting behavior of the pretty-printer.

        Each different pretty-printing box kind introduces a specific line splitting policy:

        • within an horizontal box, break hints never split the line (but the line may be split in a box nested deeper),
        • within a vertical box, break hints always split the line,
        • within an horizontal/vertical box, if the box fits on the current line then break hints never split the line, otherwise break hint always split the line,
        • within a compacting box, a break hint never splits the line, unless there is no more room on the current line.

        Note that line splitting policy is box specific: the policy of a box does not rule the policy of inner boxes. For instance, if a vertical box is nested in an horizontal box, all break hints within the vertical box will split the line.

        Moreover, opening a box after the maximum indentation limit splits the line whether or not the box would end up fitting on the line.

        val pp_open_box : formatter -> int -> unit
        val open_box : int -> unit

        pp_open_box ppf d opens a new compacting pretty-printing box with offset d in the formatter ppf.

        Within this box, the pretty-printer prints as much as possible material on every line.

        A break hint splits the line if there is no more room on the line to print the remainder of the box.

        Within this box, the pretty-printer emphasizes the box structure: if a structural box does not fit fully on a simple line, a break hint also splits the line if the splitting ``moves to the left'' (i.e. the new line gets an indentation smaller than the one of the current line).

        This box is the general purpose pretty-printing box.

        If the pretty-printer splits the line in the box, offset d is added to the current indentation.

        val pp_close_box : formatter -> unit -> unit
        val close_box : unit -> unit

        Closes the most recently open pretty-printing box.

        val pp_open_hbox : formatter -> unit -> unit
        val open_hbox : unit -> unit

        pp_open_hbox ppf () opens a new 'horizontal' pretty-printing box.

        This box prints material on a single line.

        Break hints in a horizontal box never split the line. (Line splitting may still occur inside boxes nested deeper).

        val pp_open_vbox : formatter -> int -> unit
        val open_vbox : int -> unit

        pp_open_vbox ppf d opens a new 'vertical' pretty-printing box with offset d.

        This box prints material on as many lines as break hints in the box.

        Every break hint in a vertical box splits the line.

        If the pretty-printer splits the line in the box, d is added to the current indentation.

        val pp_open_hvbox : formatter -> int -> unit
        val open_hvbox : int -> unit

        pp_open_hvbox ppf d opens a new 'horizontal/vertical' pretty-printing box with offset d.

        This box behaves as an horizontal box if it fits on a single line, otherwise it behaves as a vertical box.

        If the pretty-printer splits the line in the box, d is added to the current indentation.

        val pp_open_hovbox : formatter -> int -> unit
        val open_hovbox : int -> unit

        pp_open_hovbox ppf d opens a new 'horizontal-or-vertical' pretty-printing box with offset d.

        This box prints material as much as possible on every line.

        A break hint splits the line if there is no more room on the line to print the remainder of the box.

        If the pretty-printer splits the line in the box, d is added to the current indentation.

        Formatting functions

        val pp_print_string : formatter -> string -> unit
        val print_string : string -> unit

        pp_print_string ppf s prints s in the current pretty-printing box.

        val pp_print_bytes : formatter -> bytes -> unit
        val print_bytes : bytes -> unit

        pp_print_bytes ppf b prints b in the current pretty-printing box.

        • since 4.13
        val pp_print_as : formatter -> int -> string -> unit
        val print_as : int -> string -> unit

        pp_print_as ppf len s prints s in the current pretty-printing box. The pretty-printer formats s as if it were of length len.

        val pp_print_int : formatter -> int -> unit
        val print_int : int -> unit

        Print an integer in the current pretty-printing box.

        val pp_print_float : formatter -> float -> unit
        val print_float : float -> unit

        Print a floating point number in the current pretty-printing box.

        val pp_print_char : formatter -> char -> unit
        val print_char : char -> unit

        Print a character in the current pretty-printing box.

        val pp_print_bool : formatter -> bool -> unit
        val print_bool : bool -> unit

        Print a boolean in the current pretty-printing box.

        Break hints

        A 'break hint' tells the pretty-printer to output some space or split the line whichever way is more appropriate to the current pretty-printing box splitting rules.

        Break hints are used to separate printing items and are mandatory to let the pretty-printer correctly split lines and indent items.

        Simple break hints are:

        • the 'space': output a space or split the line if appropriate,
        • the 'cut': split the line if appropriate.

        Note: the notions of space and line splitting are abstract for the pretty-printing engine, since those notions can be completely redefined by the programmer. However, in the pretty-printer default setting, ``output a space'' simply means printing a space character (ASCII code 32) and ``split the line'' means printing a newline character (ASCII code 10).

        val pp_print_space : formatter -> unit -> unit
        val print_space : unit -> unit

        pp_print_space ppf () emits a 'space' break hint: the pretty-printer may split the line at this point, otherwise it prints one space.

        pp_print_space ppf () is equivalent to pp_print_break ppf 1 0.

        val pp_print_cut : formatter -> unit -> unit
        val print_cut : unit -> unit

        pp_print_cut ppf () emits a 'cut' break hint: the pretty-printer may split the line at this point, otherwise it prints nothing.

        pp_print_cut ppf () is equivalent to pp_print_break ppf 0 0.

        val pp_print_break : formatter -> int -> int -> unit
        val print_break : int -> int -> unit

        pp_print_break ppf nspaces offset emits a 'full' break hint: the pretty-printer may split the line at this point, otherwise it prints nspaces spaces.

        If the pretty-printer splits the line, offset is added to the current indentation.

        val pp_print_custom_break : + leads to output <>PRETTYTEXT.

        Formatters

        type formatter

        Abstract data corresponding to a pretty-printer (also called a formatter) and all its machinery. See also Defining formatters.

        Pretty-printing boxes

        The pretty-printing engine uses the concepts of pretty-printing box and break hint to drive indentation and line splitting behavior of the pretty-printer.

        Each different pretty-printing box kind introduces a specific line splitting policy:

        • within an horizontal box, break hints never split the line (but the line may be split in a box nested deeper),
        • within a vertical box, break hints always split the line,
        • within an horizontal/vertical box, if the box fits on the current line then break hints never split the line, otherwise break hint always split the line,
        • within a compacting box, a break hint never splits the line, unless there is no more room on the current line.

        Note that line splitting policy is box specific: the policy of a box does not rule the policy of inner boxes. For instance, if a vertical box is nested in an horizontal box, all break hints within the vertical box will split the line.

        Moreover, opening a box after the maximum indentation limit splits the line whether or not the box would end up fitting on the line.

        val pp_open_box : formatter -> int -> unit
        val open_box : int -> unit

        pp_open_box ppf d opens a new compacting pretty-printing box with offset d in the formatter ppf.

        Within this box, the pretty-printer prints as much as possible material on every line.

        A break hint splits the line if there is no more room on the line to print the remainder of the box.

        Within this box, the pretty-printer emphasizes the box structure: if a structural box does not fit fully on a simple line, a break hint also splits the line if the splitting ``moves to the left'' (i.e. the new line gets an indentation smaller than the one of the current line).

        This box is the general purpose pretty-printing box.

        If the pretty-printer splits the line in the box, offset d is added to the current indentation.

        val pp_close_box : formatter -> unit -> unit
        val close_box : unit -> unit

        Closes the most recently open pretty-printing box.

        val pp_open_hbox : formatter -> unit -> unit
        val open_hbox : unit -> unit

        pp_open_hbox ppf () opens a new 'horizontal' pretty-printing box.

        This box prints material on a single line.

        Break hints in a horizontal box never split the line. (Line splitting may still occur inside boxes nested deeper).

        val pp_open_vbox : formatter -> int -> unit
        val open_vbox : int -> unit

        pp_open_vbox ppf d opens a new 'vertical' pretty-printing box with offset d.

        This box prints material on as many lines as break hints in the box.

        Every break hint in a vertical box splits the line.

        If the pretty-printer splits the line in the box, d is added to the current indentation.

        val pp_open_hvbox : formatter -> int -> unit
        val open_hvbox : int -> unit

        pp_open_hvbox ppf d opens a new 'horizontal/vertical' pretty-printing box with offset d.

        This box behaves as an horizontal box if it fits on a single line, otherwise it behaves as a vertical box.

        If the pretty-printer splits the line in the box, d is added to the current indentation.

        val pp_open_hovbox : formatter -> int -> unit
        val open_hovbox : int -> unit

        pp_open_hovbox ppf d opens a new 'horizontal-or-vertical' pretty-printing box with offset d.

        This box prints material as much as possible on every line.

        A break hint splits the line if there is no more room on the line to print the remainder of the box.

        If the pretty-printer splits the line in the box, d is added to the current indentation.

        Formatting functions

        val pp_print_string : formatter -> string -> unit
        val print_string : string -> unit

        pp_print_string ppf s prints s in the current pretty-printing box.

        val pp_print_substring : pos:int -> len:int -> formatter -> string -> unit
        val print_substring : pos:int -> len:int -> string -> unit

        pp_print_substring ~pos ~len ppf s prints the substring of s that starts at position pos and stops at position pos+len in the current pretty-printing box.

        • since 5.3
        val pp_print_bytes : formatter -> bytes -> unit
        val print_bytes : bytes -> unit

        pp_print_bytes ppf b prints b in the current pretty-printing box.

        • since 4.13
        val pp_print_as : formatter -> int -> string -> unit
        val print_as : int -> string -> unit

        pp_print_as ppf len s prints s in the current pretty-printing box. The pretty-printer formats s as if it were of length len.

        val pp_print_substring_as : + pos:int -> + len:int -> + formatter -> + int -> + string -> + unit
        val print_substring_as : pos:int -> len:int -> int -> string -> unit

        pp_print_substring_as ~first ~len ppf len_as s prints the substring of s that starts at position pos and stop at position pos+len in the current pretty-printing box as if it were of length len_as.

        • since 5.1
        val pp_print_int : formatter -> int -> unit
        val print_int : int -> unit

        Print an integer in the current pretty-printing box.

        val pp_print_float : formatter -> float -> unit
        val print_float : float -> unit

        Print a floating point number in the current pretty-printing box.

        val pp_print_char : formatter -> char -> unit
        val print_char : char -> unit

        Print a character in the current pretty-printing box.

        val pp_print_bool : formatter -> bool -> unit
        val print_bool : bool -> unit

        Print a boolean in the current pretty-printing box.

        val pp_print_nothing : formatter -> unit -> unit

        Print nothing.

        • since 5.2

        Break hints

        A 'break hint' tells the pretty-printer to output some space or split the line whichever way is more appropriate to the current pretty-printing box splitting rules.

        Break hints are used to separate printing items and are mandatory to let the pretty-printer correctly split lines and indent items.

        Simple break hints are:

        • the 'space': output a space or split the line if appropriate,
        • the 'cut': split the line if appropriate.

        Note: the notions of space and line splitting are abstract for the pretty-printing engine, since those notions can be completely redefined by the programmer. However, in the pretty-printer default setting, ``output a space'' simply means printing a space character (ASCII code 32) and ``split the line'' means printing a newline character (ASCII code 10).

        val pp_print_space : formatter -> unit -> unit
        val print_space : unit -> unit

        pp_print_space ppf () emits a 'space' break hint: the pretty-printer may split the line at this point, otherwise it prints one space.

        pp_print_space ppf () is equivalent to pp_print_break ppf 1 0.

        val pp_print_cut : formatter -> unit -> unit
        val print_cut : unit -> unit

        pp_print_cut ppf () emits a 'cut' break hint: the pretty-printer may split the line at this point, otherwise it prints nothing.

        pp_print_cut ppf () is equivalent to pp_print_break ppf 0 0.

        val pp_print_break : formatter -> int -> int -> unit
        val print_break : int -> int -> unit

        pp_print_break ppf nspaces offset emits a 'full' break hint: the pretty-printer may split the line at this point, otherwise it prints nspaces spaces.

        If the pretty-printer splits the line, offset is added to the current indentation.

        val pp_print_custom_break : formatter -> fits:(string * int * string) -> breaks:(string * int * string) -> @@ -14,8 +20,8 @@ b; c; ]

        You can do this as follows:

        printf "@[<v 0>[@;<0 2>@[<v 0>a;@,b;@,c@]%t]@]@\n"
        -  (pp_print_custom_break ~fits:("", 0, "") ~breaks:(";", 0, ""))
        • since 4.08
        val pp_force_newline : formatter -> unit -> unit
        val force_newline : unit -> unit

        Force a new line in the current pretty-printing box.

        The pretty-printer must split the line at this point,

        Not the normal way of pretty-printing, since imperative line splitting may interfere with current line counters and box size calculation. Using break hints within an enclosing vertical box is a better alternative.

        val pp_print_if_newline : formatter -> unit -> unit
        val print_if_newline : unit -> unit

        Execute the next formatting command if the preceding line has just been split. Otherwise, ignore the next formatting command.

        Pretty-printing termination

        val pp_print_flush : formatter -> unit -> unit
        val print_flush : unit -> unit

        End of pretty-printing: resets the pretty-printer to initial state.

        All open pretty-printing boxes are closed, all pending text is printed. In addition, the pretty-printer low level output device is flushed to ensure that all pending text is really displayed.

        Note: never use print_flush in the normal course of a pretty-printing routine, since the pretty-printer uses a complex buffering machinery to properly indent the output; manually flushing those buffers at random would conflict with the pretty-printer strategy and result to poor rendering.

        Only consider using print_flush when displaying all pending material is mandatory (for instance in case of interactive use when you want the user to read some text) and when resetting the pretty-printer state will not disturb further pretty-printing.

        Warning: If the output device of the pretty-printer is an output channel, repeated calls to print_flush means repeated calls to Stdlib.flush to flush the out channel; these explicit flush calls could foil the buffering strategy of output channels and could dramatically impact efficiency.

        val pp_print_newline : formatter -> unit -> unit
        val print_newline : unit -> unit

        End of pretty-printing: resets the pretty-printer to initial state.

        All open pretty-printing boxes are closed, all pending text is printed.

        Equivalent to print_flush with a new line emitted on the pretty-printer low-level output device immediately before the device is flushed. See corresponding words of caution for print_flush.

        Note: this is not the normal way to output a new line; the preferred method is using break hints within a vertical pretty-printing box.

        Margin

        val pp_set_margin : formatter -> int -> unit
        val set_margin : int -> unit

        pp_set_margin ppf d sets the right margin to d (in characters): the pretty-printer splits lines that overflow the right margin according to the break hints given. Setting the margin to d means that the formatting engine aims at printing at most d-1 characters per line. Nothing happens if d is smaller than 2. If d is too large, the right margin is set to the maximum admissible value (which is greater than 10 ^ 9). If d is less than the current maximum indentation limit, the maximum indentation limit is decreased while trying to preserve a minimal ratio max_indent/margin>=50% and if possible the current difference margin - max_indent.

        See also pp_set_geometry.

        val pp_get_margin : formatter -> unit -> int
        val get_margin : unit -> int

        Returns the position of the right margin.

        Maximum indentation limit

        val pp_set_max_indent : formatter -> int -> unit
        val set_max_indent : int -> unit

        pp_set_max_indent ppf d sets the maximum indentation limit of lines to d (in characters): once this limit is reached, new pretty-printing boxes are rejected to the left, unless the enclosing box fully fits on the current line. As an illustration,

        set_margin 10; set_max_indent 5; printf "@[123456@[7@]89A@]@." 

        yields

        123456
        -789A

        because the nested box "@[7@]" is opened after the maximum indentation limit (7>5) and its parent box does not fit on the current line. Either decreasing the length of the parent box to make it fit on a line:

        printf "@[123456@[7@]89@]@." 

        or opening an intermediary box before the maximum indentation limit which fits on the current line

        printf "@[123@[456@[7@]89@]A@]@." 

        avoids the rejection to the left of the inner boxes and print respectively "123456789" and "123456789A" . Note also that vertical boxes never fit on a line whereas horizontal boxes always fully fit on the current line. Opening a box may split a line whereas the contents may have fit. If this behavior is problematic, it can be curtailed by setting the maximum indentation limit to margin - 1. Note that setting the maximum indentation limit to margin is invalid.

        Nothing happens if d is smaller than 2.

        If d is too large, the limit is set to the maximum admissible value (which is greater than 10 ^ 9).

        If d is greater or equal than the current margin, it is ignored, and the current maximum indentation limit is kept.

        See also pp_set_geometry.

        val pp_get_max_indent : formatter -> unit -> int
        val get_max_indent : unit -> int

        Return the maximum indentation limit (in characters).

        Geometry

        Geometric functions can be used to manipulate simultaneously the coupled variables, margin and maximum indentation limit.

        type geometry = {
        1. max_indent : int;
        2. margin : int;
        }
        • since 4.08
        val check_geometry : geometry -> bool

        Check if the formatter geometry is valid: 1 < max_indent < margin

        • since 4.08
        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

        pp_set_geometry ppf ~max_indent ~margin sets both the margin and maximum indentation limit for ppf.

        When 1 < max_indent < margin, pp_set_geometry ppf ~max_indent ~margin is equivalent to pp_set_margin ppf margin; pp_set_max_indent ppf max_indent; and avoids the subtly incorrect pp_set_max_indent ppf max_indent; pp_set_margin ppf margin;

        Outside of this domain, pp_set_geometry raises an invalid argument exception whereas pp_safe_set_geometry does nothing.

        • since 4.08
        val pp_update_geometry : formatter -> (geometry -> geometry) -> unit

        pp_update_geometry ppf (fun geo -> { geo with ... }) lets you update a formatter's geometry in a way that is robust to extension of the geometry record with new fields.

        Raises an invalid argument exception if the returned geometry does not satisfy check_geometry.

        • since 4.11
        val update_geometry : (geometry -> geometry) -> unit
        val pp_get_geometry : formatter -> unit -> geometry
        val get_geometry : unit -> geometry

        Return the current geometry of the formatter

        • since 4.08

        Maximum formatting depth

        The maximum formatting depth is the maximum number of pretty-printing boxes simultaneously open.

        Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

        val pp_set_max_boxes : formatter -> int -> unit
        val set_max_boxes : int -> unit

        pp_set_max_boxes ppf max sets the maximum number of pretty-printing boxes simultaneously open.

        Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

        Nothing happens if max is smaller than 2.

        val pp_get_max_boxes : formatter -> unit -> int
        val get_max_boxes : unit -> int

        Returns the maximum number of pretty-printing boxes allowed before ellipsis.

        val pp_over_max_boxes : formatter -> unit -> bool
        val over_max_boxes : unit -> bool

        Tests if the maximum number of pretty-printing boxes allowed have already been opened.

        Tabulation boxes

        A tabulation box prints material on lines divided into cells of fixed length. A tabulation box provides a simple way to display vertical columns of left adjusted text.

        This box features command set_tab to define cell boundaries, and command print_tab to move from cell to cell and split the line when there is no more cells to print on the line.

        Note: printing within tabulation box is line directed, so arbitrary line splitting inside a tabulation box leads to poor rendering. Yet, controlled use of tabulation boxes allows simple printing of columns within module Format.

        val pp_open_tbox : formatter -> unit -> unit
        val open_tbox : unit -> unit

        open_tbox () opens a new tabulation box.

        This box prints lines separated into cells of fixed width.

        Inside a tabulation box, special tabulation markers defines points of interest on the line (for instance to delimit cell boundaries). Function Format.set_tab sets a tabulation marker at insertion point.

        A tabulation box features specific tabulation breaks to move to next tabulation marker or split the line. Function Format.print_tbreak prints a tabulation break.

        val pp_close_tbox : formatter -> unit -> unit
        val close_tbox : unit -> unit

        Closes the most recently opened tabulation box.

        val pp_set_tab : formatter -> unit -> unit
        val set_tab : unit -> unit

        Sets a tabulation marker at current insertion point.

        val pp_print_tab : formatter -> unit -> unit
        val print_tab : unit -> unit

        print_tab () emits a 'next' tabulation break hint: if not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right, or the pretty-printer splits the line and insertion point moves to the leftmost tabulation marker.

        It is equivalent to print_tbreak 0 0.

        val pp_print_tbreak : formatter -> int -> int -> unit
        val print_tbreak : int -> int -> unit

        print_tbreak nspaces offset emits a 'full' tabulation break hint.

        If not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right and the pretty-printer prints nspaces spaces.

        If there is no next tabulation marker on the right, the pretty-printer splits the line at this point, then insertion point moves to the leftmost tabulation marker of the box.

        If the pretty-printer splits the line, offset is added to the current indentation.

        Ellipsis

        val pp_set_ellipsis_text : formatter -> string -> unit
        val set_ellipsis_text : string -> unit

        Set the text of the ellipsis printed when too many pretty-printing boxes are open (a single dot, ., by default).

        val pp_get_ellipsis_text : formatter -> unit -> string
        val get_ellipsis_text : unit -> string

        Return the text of the ellipsis.

        Semantic tags

        type stag = ..

        Semantic tags (or simply tags) are user's defined annotations to associate user's specific operations to printed entities.

        Common usage of semantic tags is text decoration to get specific font or text size rendering for a display device, or marking delimitation of entities (e.g. HTML or TeX elements or terminal escape sequences). More sophisticated usage of semantic tags could handle dynamic modification of the pretty-printer behavior to properly print the material within some specific tags. For instance, we can define an RGB tag like so:

        type stag += RGB of {r:int;g:int;b:int}

        In order to properly delimit printed entities, a semantic tag must be opened before and closed after the entity. Semantic tags must be properly nested like parentheses using pp_open_stag and pp_close_stag.

        Tag specific operations occur any time a tag is opened or closed, At each occurrence, two kinds of operations are performed tag-marking and tag-printing:

        • The tag-marking operation is the simpler tag specific operation: it simply writes a tag specific string into the output device of the formatter. Tag-marking does not interfere with line-splitting computation.
        • The tag-printing operation is the more involved tag specific operation: it can print arbitrary material to the formatter. Tag-printing is tightly linked to the current pretty-printer operations.

        Roughly speaking, tag-marking is commonly used to get a better rendering of texts in the rendering device, while tag-printing allows fine tuning of printing routines to print the same entity differently according to the semantic tags (i.e. print additional material or even omit parts of the output).

        More precisely: when a semantic tag is opened or closed then both and successive 'tag-printing' and 'tag-marking' operations occur:

        • Tag-printing a semantic tag means calling the formatter specific function print_open_stag (resp. print_close_stag) with the name of the tag as argument: that tag-printing function can then print any regular material to the formatter (so that this material is enqueued as usual in the formatter queue for further line splitting computation).
        • Tag-marking a semantic tag means calling the formatter specific function mark_open_stag (resp. mark_close_stag) with the name of the tag as argument: that tag-marking function can then return the 'tag-opening marker' (resp. `tag-closing marker') for direct output into the output device of the formatter.

        Being written directly into the output device of the formatter, semantic tag marker strings are not considered as part of the printing material that drives line splitting (in other words, the length of the strings corresponding to tag markers is considered as zero for line splitting).

        Thus, semantic tag handling is in some sense transparent to pretty-printing and does not interfere with usual indentation. Hence, a single pretty-printing routine can output both simple 'verbatim' material or richer decorated output depending on the treatment of tags. By default, tags are not active, hence the output is not decorated with tag information. Once set_tags is set to true, the pretty-printer engine honors tags and decorates the output accordingly.

        Default tag-marking functions behave the HTML way: string tags are enclosed in "<" and ">" while other tags are ignored; hence, opening marker for tag string "t" is "<t>" and closing marker is "</t>".

        Default tag-printing functions just do nothing.

        Tag-marking and tag-printing functions are user definable and can be set by calling set_formatter_stag_functions.

        Semantic tag operations may be set on or off with set_tags. Tag-marking operations may be set on or off with set_mark_tags. Tag-printing operations may be set on or off with set_print_tags.

        • since 4.08
        type tag = string
        type stag +=
        1. | String_tag of tag
          (*

          String_tag s is a string tag s. String tags can be inserted either by explicitly using the constructor String_tag or by using the dedicated format syntax "@{<s> ... @}".

          • since 4.08
          *)
        val pp_open_stag : formatter -> stag -> unit
        val open_stag : stag -> unit

        pp_open_stag ppf t opens the semantic tag named t.

        The print_open_stag tag-printing function of the formatter is called with t as argument; then the opening tag marker for t, as given by mark_open_stag t, is written into the output device of the formatter.

        • since 4.08
        val pp_close_stag : formatter -> unit -> unit
        val close_stag : unit -> unit

        pp_close_stag ppf () closes the most recently opened semantic tag t.

        The closing tag marker, as given by mark_close_stag t, is written into the output device of the formatter; then the print_close_stag tag-printing function of the formatter is called with t as argument.

        • since 4.08
        val pp_set_tags : formatter -> bool -> unit
        val set_tags : bool -> unit

        pp_set_tags ppf b turns on or off the treatment of semantic tags (default is off).

        val pp_set_print_tags : formatter -> bool -> unit
        val set_print_tags : bool -> unit

        pp_set_print_tags ppf b turns on or off the tag-printing operations.

        val pp_set_mark_tags : formatter -> bool -> unit
        val set_mark_tags : bool -> unit

        pp_set_mark_tags ppf b turns on or off the tag-marking operations.

        val pp_get_print_tags : formatter -> unit -> bool
        val get_print_tags : unit -> bool

        Return the current status of tag-printing operations.

        val pp_get_mark_tags : formatter -> unit -> bool
        val get_mark_tags : unit -> bool

        Return the current status of tag-marking operations.

        val pp_set_formatter_out_channel : formatter -> out_channel -> unit

        Redirecting the standard formatter output

        val set_formatter_out_channel : out_channel -> unit

        Redirect the standard pretty-printer output to the given channel. (All the output functions of the standard formatter are set to the default output functions printing to the given channel.)

        set_formatter_out_channel is equivalent to pp_set_formatter_out_channel std_formatter.

        val pp_set_formatter_output_functions : + (pp_print_custom_break ~fits:("", 0, "") ~breaks:(";", 0, ""))
        • since 4.08
        val pp_force_newline : formatter -> unit -> unit
        val force_newline : unit -> unit

        Force a new line in the current pretty-printing box.

        The pretty-printer must split the line at this point,

        Not the normal way of pretty-printing, since imperative line splitting may interfere with current line counters and box size calculation. Using break hints within an enclosing vertical box is a better alternative.

        val pp_print_if_newline : formatter -> unit -> unit
        val print_if_newline : unit -> unit

        Execute the next formatting command if the preceding line has just been split. Otherwise, ignore the next formatting command.

        Pretty-printing termination

        val pp_print_flush : formatter -> unit -> unit
        val print_flush : unit -> unit

        End of pretty-printing: resets the pretty-printer to initial state.

        All open pretty-printing boxes are closed, all pending text is printed. In addition, the pretty-printer low level output device is flushed to ensure that all pending text is really displayed.

        Note: never use print_flush in the normal course of a pretty-printing routine, since the pretty-printer uses a complex buffering machinery to properly indent the output; manually flushing those buffers at random would conflict with the pretty-printer strategy and result to poor rendering.

        Only consider using print_flush when displaying all pending material is mandatory (for instance in case of interactive use when you want the user to read some text) and when resetting the pretty-printer state will not disturb further pretty-printing.

        Warning: If the output device of the pretty-printer is an output channel, repeated calls to print_flush means repeated calls to Stdlib.flush to flush the out channel; these explicit flush calls could foil the buffering strategy of output channels and could dramatically impact efficiency.

        val pp_print_newline : formatter -> unit -> unit
        val print_newline : unit -> unit

        End of pretty-printing: resets the pretty-printer to initial state.

        All open pretty-printing boxes are closed, all pending text is printed.

        Equivalent to print_flush with a new line emitted on the pretty-printer low-level output device immediately before the device is flushed. See corresponding words of caution for print_flush.

        Note: this is not the normal way to output a new line; the preferred method is using break hints within a vertical pretty-printing box.

        Margin

        val pp_infinity : int

        pp_infinity is the maximal size of the margin. Its exact value is implementation dependent but is guaranteed to be greater than 109.

        • since 5.2
        val pp_set_margin : formatter -> int -> unit
        val set_margin : int -> unit

        pp_set_margin ppf d sets the right margin to d (in characters): the pretty-printer splits lines that overflow the right margin according to the break hints given. Setting the margin to d means that the formatting engine aims at printing at most d-1 characters per line. Nothing happens if d is smaller than 2. If d >= pp_infinity, the right margin is set to pp_infinity - 1. If d is less than the current maximum indentation limit, the maximum indentation limit is decreased while trying to preserve a minimal ratio max_indent/margin>=50% and if possible the current difference margin - max_indent.

        See also pp_set_geometry.

        val pp_get_margin : formatter -> unit -> int
        val get_margin : unit -> int

        Returns the position of the right margin.

        Maximum indentation limit

        val pp_set_max_indent : formatter -> int -> unit
        val set_max_indent : int -> unit

        pp_set_max_indent ppf d sets the maximum indentation limit of lines to d (in characters): once this limit is reached, new pretty-printing boxes are rejected to the left, unless the enclosing box fully fits on the current line. As an illustration,

        set_margin 10; set_max_indent 5; printf "@[123456@[7@]89A@]@." 

        yields

        123456
        +789A

        because the nested box "@[7@]" is opened after the maximum indentation limit (7>5) and its parent box does not fit on the current line. Either decreasing the length of the parent box to make it fit on a line:

        printf "@[123456@[7@]89@]@." 

        or opening an intermediary box before the maximum indentation limit which fits on the current line

        printf "@[123@[456@[7@]89@]A@]@." 

        avoids the rejection to the left of the inner boxes and print respectively "123456789" and "123456789A" . Note also that vertical boxes never fit on a line whereas horizontal boxes always fully fit on the current line. Opening a box may split a line whereas the contents may have fit. If this behavior is problematic, it can be curtailed by setting the maximum indentation limit to margin - 1. Note that setting the maximum indentation limit to margin is invalid.

        Nothing happens if d is smaller than 2.

        If d is greater than the current margin, it is ignored, and the current maximum indentation limit is kept.

        See also pp_set_geometry.

        val pp_get_max_indent : formatter -> unit -> int
        val get_max_indent : unit -> int

        Return the maximum indentation limit (in characters).

        Geometry

        Geometric functions can be used to manipulate simultaneously the coupled variables, margin and maximum indentation limit.

        type geometry = {
        1. max_indent : int;
        2. margin : int;
        }
        • since 4.08
        val check_geometry : geometry -> bool

        Check if the formatter geometry is valid: 1 < max_indent < margin < pp_infinity

        • since 4.08
        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

        pp_set_geometry ppf ~max_indent ~margin sets both the margin and maximum indentation limit for ppf.

        When 1 < max_indent < margin < pp_infinity, pp_set_geometry ppf ~max_indent ~margin is equivalent to pp_set_margin ppf margin; pp_set_max_indent ppf max_indent; and avoids the subtly incorrect pp_set_max_indent ppf max_indent; pp_set_margin ppf margin;

        Outside of this domain, pp_set_geometry raises an invalid argument exception whereas pp_safe_set_geometry does nothing.

        • since 4.08
        val pp_update_geometry : formatter -> (geometry -> geometry) -> unit

        pp_update_geometry ppf (fun geo -> { geo with ... }) lets you update a formatter's geometry in a way that is robust to extension of the geometry record with new fields.

        Raises an invalid argument exception if the returned geometry does not satisfy check_geometry.

        • since 4.11
        val update_geometry : (geometry -> geometry) -> unit
        val pp_get_geometry : formatter -> unit -> geometry
        val get_geometry : unit -> geometry

        Return the current geometry of the formatter

        • since 4.08

        Maximum formatting depth

        The maximum formatting depth is the maximum number of pretty-printing boxes simultaneously open.

        Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

        val pp_set_max_boxes : formatter -> int -> unit
        val set_max_boxes : int -> unit

        pp_set_max_boxes ppf max sets the maximum number of pretty-printing boxes simultaneously open.

        Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

        Nothing happens if max is smaller than 2.

        val pp_get_max_boxes : formatter -> unit -> int
        val get_max_boxes : unit -> int

        Returns the maximum number of pretty-printing boxes allowed before ellipsis.

        val pp_over_max_boxes : formatter -> unit -> bool
        val over_max_boxes : unit -> bool

        Tests if the maximum number of pretty-printing boxes allowed have already been opened.

        Tabulation boxes

        A tabulation box prints material on lines divided into cells of fixed length. A tabulation box provides a simple way to display vertical columns of left adjusted text.

        This box features command set_tab to define cell boundaries, and command print_tab to move from cell to cell and split the line when there is no more cells to print on the line.

        Note: printing within tabulation box is line directed, so arbitrary line splitting inside a tabulation box leads to poor rendering. Yet, controlled use of tabulation boxes allows simple printing of columns within module Format.

        val pp_open_tbox : formatter -> unit -> unit
        val open_tbox : unit -> unit

        open_tbox () opens a new tabulation box.

        This box prints lines separated into cells of fixed width.

        Inside a tabulation box, special tabulation markers defines points of interest on the line (for instance to delimit cell boundaries). Function Format.set_tab sets a tabulation marker at insertion point.

        A tabulation box features specific tabulation breaks to move to next tabulation marker or split the line. Function Format.print_tbreak prints a tabulation break.

        val pp_close_tbox : formatter -> unit -> unit
        val close_tbox : unit -> unit

        Closes the most recently opened tabulation box.

        val pp_set_tab : formatter -> unit -> unit
        val set_tab : unit -> unit

        Sets a tabulation marker at current insertion point.

        val pp_print_tab : formatter -> unit -> unit
        val print_tab : unit -> unit

        print_tab () emits a 'next' tabulation break hint: if not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right, or the pretty-printer splits the line and insertion point moves to the leftmost tabulation marker.

        It is equivalent to print_tbreak 0 0.

        val pp_print_tbreak : formatter -> int -> int -> unit
        val print_tbreak : int -> int -> unit

        print_tbreak nspaces offset emits a 'full' tabulation break hint.

        If not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right and the pretty-printer prints nspaces spaces.

        If there is no next tabulation marker on the right, the pretty-printer splits the line at this point, then insertion point moves to the leftmost tabulation marker of the box.

        If the pretty-printer splits the line, offset is added to the current indentation.

        Ellipsis

        val pp_set_ellipsis_text : formatter -> string -> unit
        val set_ellipsis_text : string -> unit

        Set the text of the ellipsis printed when too many pretty-printing boxes are open (a single dot, ., by default).

        val pp_get_ellipsis_text : formatter -> unit -> string
        val get_ellipsis_text : unit -> string

        Return the text of the ellipsis.

        Semantic tags

        type stag = ..

        Semantic tags (or simply tags) are user's defined annotations to associate user's specific operations to printed entities.

        Common usage of semantic tags is text decoration to get specific font or text size rendering for a display device, or marking delimitation of entities (e.g. HTML or TeX elements or terminal escape sequences). More sophisticated usage of semantic tags could handle dynamic modification of the pretty-printer behavior to properly print the material within some specific tags. For instance, we can define an RGB tag like so:

        type stag += RGB of {r:int;g:int;b:int}

        In order to properly delimit printed entities, a semantic tag must be opened before and closed after the entity. Semantic tags must be properly nested like parentheses using pp_open_stag and pp_close_stag.

        Tag specific operations occur any time a tag is opened or closed, At each occurrence, two kinds of operations are performed tag-marking and tag-printing:

        • The tag-marking operation is the simpler tag specific operation: it simply writes a tag specific string into the output device of the formatter. Tag-marking does not interfere with line-splitting computation.
        • The tag-printing operation is the more involved tag specific operation: it can print arbitrary material to the formatter. Tag-printing is tightly linked to the current pretty-printer operations.

        Roughly speaking, tag-marking is commonly used to get a better rendering of texts in the rendering device, while tag-printing allows fine tuning of printing routines to print the same entity differently according to the semantic tags (i.e. print additional material or even omit parts of the output).

        More precisely: when a semantic tag is opened or closed then both and successive 'tag-printing' and 'tag-marking' operations occur:

        • Tag-printing a semantic tag means calling the formatter specific function print_open_stag (resp. print_close_stag) with the name of the tag as argument: that tag-printing function can then print any regular material to the formatter (so that this material is enqueued as usual in the formatter queue for further line splitting computation).
        • Tag-marking a semantic tag means calling the formatter specific function mark_open_stag (resp. mark_close_stag) with the name of the tag as argument: that tag-marking function can then return the 'tag-opening marker' (resp. `tag-closing marker') for direct output into the output device of the formatter.

        Being written directly into the output device of the formatter, semantic tag marker strings are not considered as part of the printing material that drives line splitting (in other words, the length of the strings corresponding to tag markers is considered as zero for line splitting).

        Thus, semantic tag handling is in some sense transparent to pretty-printing and does not interfere with usual indentation. Hence, a single pretty-printing routine can output both simple 'verbatim' material or richer decorated output depending on the treatment of tags. By default, tags are not active, hence the output is not decorated with tag information. Once set_tags is set to true, the pretty-printer engine honors tags and decorates the output accordingly.

        Default tag-marking functions behave the HTML way: string tags are enclosed in "<" and ">" while other tags are ignored; hence, opening marker for tag string "t" is "<t>" and closing marker is "</t>".

        Default tag-printing functions just do nothing.

        Tag-marking and tag-printing functions are user definable and can be set by calling set_formatter_stag_functions.

        Semantic tag operations may be set on or off with set_tags. Tag-marking operations may be set on or off with set_mark_tags. Tag-printing operations may be set on or off with set_print_tags.

        • since 4.08
        type tag = string
        type stag +=
        1. | String_tag of tag
          (*

          String_tag s is a string tag s. String tags can be inserted either by explicitly using the constructor String_tag or by using the dedicated format syntax "@{<s> ... @}".

          • since 4.08
          *)
        val pp_open_stag : formatter -> stag -> unit
        val open_stag : stag -> unit

        pp_open_stag ppf t opens the semantic tag named t.

        The print_open_stag tag-printing function of the formatter is called with t as argument; then the opening tag marker for t, as given by mark_open_stag t, is written into the output device of the formatter.

        • since 4.08
        val pp_close_stag : formatter -> unit -> unit
        val close_stag : unit -> unit

        pp_close_stag ppf () closes the most recently opened semantic tag t.

        The closing tag marker, as given by mark_close_stag t, is written into the output device of the formatter; then the print_close_stag tag-printing function of the formatter is called with t as argument.

        • since 4.08
        val pp_set_tags : formatter -> bool -> unit
        val set_tags : bool -> unit

        pp_set_tags ppf b turns on or off the treatment of semantic tags (default is off).

        val pp_set_print_tags : formatter -> bool -> unit
        val set_print_tags : bool -> unit

        pp_set_print_tags ppf b turns on or off the tag-printing operations.

        val pp_set_mark_tags : formatter -> bool -> unit
        val set_mark_tags : bool -> unit

        pp_set_mark_tags ppf b turns on or off the tag-marking operations.

        val pp_get_print_tags : formatter -> unit -> bool
        val get_print_tags : unit -> bool

        Return the current status of tag-printing operations.

        val pp_get_mark_tags : formatter -> unit -> bool
        val get_mark_tags : unit -> bool

        Return the current status of tag-marking operations.

        val pp_set_formatter_out_channel : formatter -> out_channel -> unit

        Redirecting the standard formatter output

        val set_formatter_out_channel : out_channel -> unit

        Redirect the standard pretty-printer output to the given channel. (All the output functions of the standard formatter are set to the default output functions printing to the given channel.)

        set_formatter_out_channel is equivalent to pp_set_formatter_out_channel std_formatter.

        val pp_set_formatter_output_functions : formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> @@ -45,7 +51,7 @@ (string -> int -> int -> unit) -> (unit -> unit) -> formatter

        make_formatter out flush returns a new formatter that outputs with function out, and flushes with function flush.

        For instance,

        make_formatter
        -  (Stdlib.output oc)
        +  (Stdlib.output_substring oc)
           (fun () -> Stdlib.flush oc)

        returns a formatter to the Stdlib.out_channel oc.

        val make_synchronized_formatter : (string -> int -> int -> unit) -> (unit -> unit) -> @@ -119,7 +125,7 @@ val pp_pair : Format.formatter -> int * bool -> unit = <fun> l: [(0, true); (1, false); (2, true); (3, false); (4, true); (5, false); (6, true); (7, false); (8, true); (9, false); (10, true); (11, false); (12, true); (13, false); (14, true); (15, false); (16, true); - (17, false); (18, true); (19, false)]

        What this does, briefly, is:

        • pp_pair prints a pair bool*int surrounded in "(" ")". It takes a formatter (into which formatting happens), and the pair itself. When printing is done it returns ().
        • Format.printf "l = [@[<hov>%a@]]@." ... l is like printf, but with additional formatting instructions (denoted with "@"). The pair "@<hov>" and "@" is a "horizontal-or-vertical box".
        • "@." ends formatting with a newline. It is similar to "\n" but is also aware of the Format.formatter's state. Do not use "\n" with Format.
        • "%a" is a formatting instruction, like "%d" or "%s" for printf. However, where "%d" prints an integer and "%s" prints a string, "%a" takes a printer (of type Format.formatter -> 'a -> unit) and a value (of type 'a) and applies the printer to the value. This is key to compositionality of printers.
        • We build a list printer using Format.pp_print_list ~pp_sep:(...) pp_pair. pp_print_list takes an element printer and returns a list printer. The ?pp_sep optional argument, if provided, is called in between each element to print a separator.
        • Here, for a separator, we use (fun out () -> Format.fprintf out ";@ "). It prints ";", and then "@ " which is a breaking space (either it prints " ", or it prints a newline if the box is about to overflow). This "@ " is responsible for the list printing splitting into several lines.

        If we omit "@ ", we get an ugly single-line print:

        # Format.printf "l: [@[<hov>%a@]]@."
        +      (17, false); (18, true); (19, false)]

        What this does, briefly, is:

        • pp_pair prints a pair bool*int surrounded in "(" ")". It takes a formatter (into which formatting happens), and the pair itself. When printing is done it returns ().
        • Format.printf "l = [@[<hov>%a@]]@." ... l is like printf, but with additional formatting instructions (denoted with "@"). The pair "@[<hov>" and "@]" is a "horizontal-or-vertical box".
        • "@." ends formatting with a newline. It is similar to "\n" but is also aware of the Format.formatter's state. Do not use "\n" with Format.
        • "%a" is a formatting instruction, like "%d" or "%s" for printf. However, where "%d" prints an integer and "%s" prints a string, "%a" takes a printer (of type Format.formatter -> 'a -> unit) and a value (of type 'a) and applies the printer to the value. This is key to compositionality of printers.
        • We build a list printer using Format.pp_print_list ~pp_sep:(...) pp_pair. pp_print_list takes an element printer and returns a list printer. The ?pp_sep optional argument, if provided, is called in between each element to print a separator.
        • Here, for a separator, we use (fun out () -> Format.fprintf out ";@ "). It prints ";", and then "@ " which is a breaking space (either it prints " ", or it prints a newline if the box is about to overflow). This "@ " is responsible for the list printing splitting into several lines.

        If we omit "@ ", we get an ugly single-line print:

        # Format.printf "l: [@[<hov>%a@]]@."
               Format.(pp_print_list ~pp_sep:(fun out () -> fprintf out "; ") pp_pair) l
           l: [(0, true); (1, false); (2, true); (* ... *); (18, true); (19, false)]
         - : unit = ()

        Generally, it is good practice to define custom printers for important types in your program. If, for example, you were to define basic geometry types like so:

        type point = {
        diff --git a/ocaml/Stdlib/Fun/index.html b/ocaml/Stdlib/Fun/index.html
        index 037a852d..e7573ef8 100644
        --- a/ocaml/Stdlib/Fun/index.html
        +++ b/ocaml/Stdlib/Fun/index.html
        @@ -1,2 +1,2 @@
         
        -Fun (ocaml.Stdlib.Fun)

        Module Stdlib.Fun

        Function manipulation.

        • since 4.08

        Combinators

        val id : 'a -> 'a

        id is the identity function. For any argument x, id x is x.

        val const : 'a -> _ -> 'a

        const c is a function that always returns the value c. For any argument x, (const c) x is c.

        val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c

        flip f reverses the argument order of the binary function f. For any arguments x and y, (flip f) x y is f y x.

        val negate : ('a -> bool) -> 'a -> bool

        negate p is the negation of the predicate function p. For any argument x, (negate p) x is not (p x).

        Exception handling

        val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a

        protect ~finally work invokes work () and then finally () before work () returns with its value or an exception. In the latter case the exception is re-raised after finally (). If finally () raises an exception, then the exception Finally_raised is raised instead.

        protect can be used to enforce local invariants whether work () returns normally or raises an exception. However, it does not protect against unexpected exceptions raised inside finally () such as Stdlib.Out_of_memory, Stdlib.Stack_overflow, or asynchronous exceptions raised by signal handlers (e.g. Sys.Break).

        Note: It is a programming error if other kinds of exceptions are raised by finally, as any exception raised in work () will be lost in the event of a Finally_raised exception. Therefore, one should make sure to handle those inside the finally.

        exception Finally_raised of exn

        Finally_raised exn is raised by protect ~finally work when finally raises an exception exn. This exception denotes either an unexpected exception or a programming error. As a general rule, one should not catch a Finally_raised exception except as part of a catch-all handler.

        +Fun (ocaml.Stdlib.Fun)

        Module Stdlib.Fun

        Function manipulation.

        • since 4.08

        Combinators

        val id : 'a -> 'a

        id is the identity function. For any argument x, id x is x.

        val const : 'a -> _ -> 'a

        const c is a function that always returns the value c. For any argument x, (const c) x is c.

        val compose : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c

        compose f g is a function composition of applying g then f. For any arguments f, g, and x, compose f g x is f (g x).

        • since 5.2
        val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c

        flip f reverses the argument order of the binary function f. For any arguments x and y, (flip f) x y is f y x.

        val negate : ('a -> bool) -> 'a -> bool

        negate p is the negation of the predicate function p. For any argument x, (negate p) x is not (p x).

        Exception handling

        val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a

        protect ~finally work invokes work () and then finally () before work () returns with its value or an exception. In the latter case the exception is re-raised after finally (). If finally () raises an exception, then the exception Finally_raised is raised instead.

        protect can be used to enforce local invariants whether work () returns normally or raises an exception. However, it does not protect against unexpected exceptions raised inside finally () such as Stdlib.Out_of_memory, Stdlib.Stack_overflow, or asynchronous exceptions raised by signal handlers (e.g. Sys.Break).

        Note: It is a programming error if other kinds of exceptions are raised by finally, as any exception raised in work () will be lost in the event of a Finally_raised exception. Therefore, one should make sure to handle those inside the finally.

        exception Finally_raised of exn

        Finally_raised exn is raised by protect ~finally work when finally raises an exception exn. This exception denotes either an unexpected exception or a programming error. As a general rule, one should not catch a Finally_raised exception except as part of a catch-all handler.

        diff --git a/ocaml/Stdlib/Gc/Memprof/index.html b/ocaml/Stdlib/Gc/Memprof/index.html index c1de7c97..f6f8a8d3 100644 --- a/ocaml/Stdlib/Gc/Memprof/index.html +++ b/ocaml/Stdlib/Gc/Memprof/index.html @@ -1,6 +1,6 @@ -Memprof (ocaml.Stdlib.Gc.Memprof)

        Module Gc.Memprof

        Memprof is a sampling engine for allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

        Since blocks are composed of several words, a block can potentially be sampled several times. If a block is sampled several times, then each of the callback is called once for each event of this block: the multiplicity is given in the n_samples field of the allocation structure.

        This engine makes it possible to implement a low-overhead memory profiler as an OCaml library.

        Note: this API is EXPERIMENTAL. It may change without prior notice.

        type allocation_source =
        1. | Normal
        2. | Marshal
        3. | Custom
        type allocation = private {
        1. n_samples : int;
          (*

          The number of samples in this block (>= 1).

          *)
        2. size : int;
          (*

          The size of the block, in words, excluding the header.

          *)
        3. source : allocation_source;
          (*

          The type of the allocation.

          *)
        4. callstack : Printexc.raw_backtrace;
          (*

          The callstack for the allocation.

          *)
        }

        The type of metadata associated with allocations. This is the type of records passed to the callback triggered by the sampling of an allocation.

        type ('minor, 'major) tracker = {
        1. alloc_minor : allocation -> 'minor option;
        2. alloc_major : allocation -> 'major option;
        3. promote : 'minor -> 'major option;
        4. dealloc_minor : 'minor -> unit;
        5. dealloc_major : 'major -> unit;
        }

        A ('minor, 'major) tracker describes how memprof should track sampled blocks over their lifetime, keeping a user-defined piece of metadata for each of them: 'minor is the type of metadata to keep for minor blocks, and 'major the type of metadata for major blocks.

        When using threads, it is guaranteed that allocation callbacks are always run in the thread where the allocation takes place.

        If an allocation-tracking or promotion-tracking function returns None, memprof stops tracking the corresponding value.

        val null_tracker : ('minor, 'major) tracker

        Default callbacks simply return None or ()

        val start : +Memprof (ocaml.Stdlib.Gc.Memprof)

        Module Gc.Memprof

        Memprof is a profiling engine which randomly samples allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

        Since blocks are composed of several words, a block can potentially be sampled several times. If a block is sampled several times, then each of the callbacks is called once for each event of this block: the multiplicity is given in the n_samples field of the allocation structure.

        This engine makes it possible to implement a low-overhead memory profiler as an OCaml library.

        Note: this API is EXPERIMENTAL. It may change without prior notice.

        type t

        the type of a profile

        type allocation_source =
        1. | Normal
        2. | Marshal
        3. | Custom
        type allocation = private {
        1. n_samples : int;
          (*

          The number of samples in this block (>= 1).

          *)
        2. size : int;
          (*

          The size of the block, in words, excluding the header.

          *)
        3. source : allocation_source;
          (*

          The cause of the allocation.

          *)
        4. callstack : Printexc.raw_backtrace;
          (*

          The callstack for the allocation.

          *)
        }

        The type of metadata associated with allocations. This is the type of records passed to the callback triggered by the sampling of an allocation.

        type ('minor, 'major) tracker = {
        1. alloc_minor : allocation -> 'minor option;
        2. alloc_major : allocation -> 'major option;
        3. promote : 'minor -> 'major option;
        4. dealloc_minor : 'minor -> unit;
        5. dealloc_major : 'major -> unit;
        }

        A ('minor, 'major) tracker describes how memprof should track sampled blocks over their lifetime, keeping a user-defined piece of metadata for each of them: 'minor is the type of metadata to keep for minor blocks, and 'major the type of metadata for major blocks.

        The member functions in a tracker are called callbacks.

        If an allocation or promotion callback raises an exception or returns None, memprof stops tracking the corresponding block.

        val null_tracker : ('minor, 'major) tracker

        Default callbacks simply return None or ()

        val start : sampling_rate:float -> ?callstack_size:int -> ('minor, 'major) tracker -> - unit

        Start the sampling with the given parameters. Fails if sampling is already active.

        The parameter sampling_rate is the sampling rate in samples per word (including headers). Usually, with cheap callbacks, a rate of 1e-4 has no visible effect on performance, and 1e-3 causes the program to run a few percent slower

        The parameter callstack_size is the length of the callstack recorded at every sample. Its default is max_int.

        The parameter tracker determines how to track sampled blocks over their lifetime in the minor and major heap.

        Sampling is temporarily disabled when calling a callback for the current thread. So they do not need to be re-entrant if the program is single-threaded. However, if threads are used, it is possible that a context switch occurs during a callback, in this case the callback functions must be re-entrant.

        Note that the callback can be postponed slightly after the actual event. The callstack passed to the callback is always accurate, but the program state may have evolved.

        val stop : unit -> unit

        Stop the sampling. Fails if sampling is not active.

        This function does not allocate memory.

        All the already tracked blocks are discarded. If there are pending postponed callbacks, they may be discarded.

        Calling stop when a callback is running can lead to callbacks not being called even though some events happened.

        + t

        Start a profile with the given parameters. Raises an exception if a profile is already sampling in the current domain.

        Sampling begins immediately. The parameter sampling_rate is the sampling rate in samples per word (including headers). Usually, with cheap callbacks, a rate of 1e-4 has no visible effect on performance, and 1e-3 causes the program to run a few percent slower. 0.0 <= sampling_rate <= 1.0.

        The parameter callstack_size is the length of the callstack recorded at every sample. Its default is max_int.

        The parameter tracker determines how to track sampled blocks over their lifetime in the minor and major heap.

        Sampling and running callbacks are temporarily disabled on the current thread when calling a callback, so callbacks do not need to be re-entrant if the program is single-threaded and single-domain. However, if threads or multiple domains are used, it is possible that several callbacks will run in parallel. In this case, callback functions must be re-entrant.

        Note that a callback may be postponed slightly after the actual event. The callstack passed to an allocation callback always accurately reflects the allocation, but the program state may have evolved between the allocation and the call to the callback.

        If a new thread or domain is created when the current domain is sampling for a profile, the child thread or domain joins that profile (using the same sampling_rate, callstack_size, and tracker callbacks).

        An allocation callback is always run by the thread which allocated the block. If the thread exits or the profile is stopped before the callback is called, the allocation callback is not called and the block is not tracked.

        Each subsequent callback is generally run by the domain which allocated the block. If the domain terminates or the profile is stopped before the callback is called, the callback may be run by a different domain.

        Different domains may sample for different profiles simultaneously.

        val stop : unit -> unit

        Stop sampling for the current profile. Fails if no profile is sampling in the current domain. Stops sampling in all threads and domains sharing the profile.

        Promotion and deallocation callbacks from a profile may run after stop is called, until discard is applied to the profile.

        A profile is implicitly stopped (but not discarded) if all domains and threads sampling for it are terminated.

        val discard : t -> unit

        Discards all profiling state for a stopped profile, which prevents any more callbacks for it. Raises an exception if called on a profile which has not been stopped.

        diff --git a/ocaml/Stdlib/Gc/index.html b/ocaml/Stdlib/Gc/index.html index 2a97657b..d01f6941 100644 --- a/ocaml/Stdlib/Gc/index.html +++ b/ocaml/Stdlib/Gc/index.html @@ -1,2 +1,9 @@ -Gc (ocaml.Stdlib.Gc)

        Module Stdlib.Gc

        Memory management control and statistics; finalised values.

        type stat = {
        1. minor_words : float;
          (*

          Number of words allocated in the minor heap since the program was started.

          *)
        2. promoted_words : float;
          (*

          Number of words allocated in the minor heap that survived a minor collection and were moved to the major heap since the program was started.

          *)
        3. major_words : float;
          (*

          Number of words allocated in the major heap, including the promoted words, since the program was started.

          *)
        4. minor_collections : int;
          (*

          Number of minor collections since the program was started.

          *)
        5. major_collections : int;
          (*

          Number of major collection cycles completed since the program was started.

          *)
        6. heap_words : int;
          (*

          Total size of the major heap, in words.

          *)
        7. heap_chunks : int;
          (*

          Number of contiguous pieces of memory that make up the major heap. This metrics is currently not available in OCaml 5: the field value is always 0.

          *)
        8. live_words : int;
          (*

          Number of words of live data in the major heap, including the header words.

          Note that "live" words refers to every word in the major heap that isn't currently known to be collectable, which includes words that have become unreachable by the program after the start of the previous gc cycle. It is typically much simpler and more predictable to call Gc.full_major (or Gc.compact) then computing gc stats, as then "live" words has the simple meaning of "reachable by the program". One caveat is that a single call to Gc.full_major will not reclaim values that have a finaliser from Gc.finalise (this does not apply to Gc.finalise_last). If this caveat matters, simply call Gc.full_major twice instead of once.

          *)
        9. live_blocks : int;
          (*

          Number of live blocks in the major heap.

          See live_words for a caveat about what "live" means.

          *)
        10. free_words : int;
          (*

          Number of words in the free list.

          *)
        11. free_blocks : int;
          (*

          Number of blocks in the free list. This metrics is currently not available in OCaml 5: the field value is always 0.

          *)
        12. largest_free : int;
          (*

          Size (in words) of the largest block in the free list. This metrics is currently not available in OCaml 5: the field value is always 0.

          *)
        13. fragments : int;
          (*

          Number of wasted words due to fragmentation. These are 1-words free blocks placed between two live blocks. They are not available for allocation.

          *)
        14. compactions : int;
          (*

          Number of heap compactions since the program was started.

          *)
        15. top_heap_words : int;
          (*

          Maximum size reached by the major heap, in words.

          *)
        16. stack_size : int;
          (*

          Current size of the stack, in words. This metrics is currently not available in OCaml 5: the field value is always 0.

          • since 3.12
          *)
        17. forced_major_collections : int;
          (*

          Number of forced full major collections completed since the program was started.

          • since 4.12
          *)
        }

        The memory management counters are returned in a stat record. These counters give values for the whole program.

        The total amount of memory allocated by the program since it was started is (in words) minor_words + major_words - promoted_words. Multiply by the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get the number of bytes.

        type control = {
        1. minor_heap_size : int;
          (*

          The size (in words) of the minor heap. Changing this parameter will trigger a minor collection. The total size of the minor heap used by this program is the sum of the heap sizes of the active domains. Default: 256k.

          *)
        2. major_heap_increment : int;
          (*

          How much to add to the major heap when increasing it. If this number is less than or equal to 1000, it is a percentage of the current heap size (i.e. setting it to 100 will double the heap size at each increase). If it is more than 1000, it is a fixed number of words that will be added to the heap. Default: 15.

          *)
        3. space_overhead : int;
          (*

          The major GC speed is computed from this parameter. This is the memory that will be "wasted" because the GC does not immediately collect unreachable blocks. It is expressed as a percentage of the memory used for live data. The GC will work more (use more CPU time and collect blocks more eagerly) if space_overhead is smaller. Default: 120.

          *)
        4. verbose : int;
          (*

          This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:

          • 0x001 Start and end of major GC cycle.
          • 0x002 Minor collection and major GC slice.
          • 0x004 Growing and shrinking of the heap.
          • 0x008 Resizing of stacks and memory manager tables.
          • 0x010 Heap compaction.
          • 0x020 Change of GC parameters.
          • 0x040 Computation of major GC slice size.
          • 0x080 Calling of finalisation functions.
          • 0x100 Bytecode executable and shared library search at start-up.
          • 0x200 Computation of compaction-triggering condition.
          • 0x400 Output GC statistics at program exit. Default: 0.
          *)
        5. max_overhead : int;
          (*

          Heap compaction is triggered when the estimated amount of "wasted" memory is more than max_overhead percent of the amount of live data. If max_overhead is set to 0, heap compaction is triggered at the end of each major GC cycle (this setting is intended for testing purposes only). If max_overhead >= 1000000, compaction is never triggered. If compaction is permanently disabled, it is strongly suggested to set allocation_policy to 2. Default: 500.

          *)
        6. stack_limit : int;
          (*

          The maximum size of the fiber stacks (in words). Default: 1024k.

          *)
        7. allocation_policy : int;
          (*

          The policy used for allocating in the major heap. Possible values are 0, 1 and 2.

          • 0 is the next-fit policy, which is usually fast but can result in fragmentation, increasing memory consumption.
          • 1 is the first-fit policy, which avoids fragmentation but has corner cases (in certain realistic workloads) where it is sensibly slower.
          • 2 is the best-fit policy, which is fast and avoids fragmentation. In our experiments it is faster and uses less memory than both next-fit and first-fit. (since OCaml 4.10)

          The default is best-fit.

          On one example that was known to be bad for next-fit and first-fit, next-fit takes 28s using 855Mio of memory, first-fit takes 47s using 566Mio of memory, best-fit takes 27s using 545Mio of memory.

          Note: If you change to next-fit, you may need to reduce the space_overhead setting, for example using 80 instead of the default 120 which is tuned for best-fit. Otherwise, your program will need more memory.

          Note: changing the allocation policy at run-time forces a heap compaction, which is a lengthy operation unless the heap is small (e.g. at the start of the program).

          Default: 2.

          • since 3.11
          *)
        8. window_size : int;
          (*

          The size of the window used by the major GC for smoothing out variations in its workload. This is an integer between 1 and 50. Default: 1.

          • since 4.03
          *)
        9. custom_major_ratio : int;
          (*

          Target ratio of floating garbage to major heap size for out-of-heap memory held by custom values located in the major heap. The GC speed is adjusted to try to use this much memory for dead values that are not yet collected. Expressed as a percentage of major heap size. The default value keeps the out-of-heap floating garbage about the same size as the in-heap overhead. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 44.

          • since 4.08
          *)
        10. custom_minor_ratio : int;
          (*

          Bound on floating garbage for out-of-heap memory held by custom values in the minor heap. A minor GC is triggered when this much memory is held by custom values located in the minor heap. Expressed as a percentage of minor heap size. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 100.

          • since 4.08
          *)
        11. custom_minor_max_size : int;
          (*

          Maximum amount of out-of-heap memory for each custom value allocated in the minor heap. Custom values that hold more than this many bytes are allocated on the major heap. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 70000 bytes.

          • since 4.08
          *)
        }

        The GC parameters are given as a control record. Note that these parameters can also be initialised by setting the OCAMLRUNPARAM environment variable. See the documentation of ocamlrun.

        val stat : unit -> stat

        Return the current values of the memory management counters in a stat record that represent the program's total memory stats. This function causes a full major collection.

        val quick_stat : unit -> stat

        Same as stat except that live_words, live_blocks, free_words, free_blocks, largest_free, and fragments are set to 0. Due to per-domain buffers it may only represent the state of the program's total memory usage since the last minor collection. This function is much faster than stat because it does not need to trigger a full major collection.

        val counters : unit -> float * float * float

        Return (minor_words, promoted_words, major_words) for the current domain or potentially previous domains. This function is as fast as quick_stat.

        val minor_words : unit -> float

        Number of words allocated in the minor heap by this domain or potentially previous domains. This number is accurate in byte-code programs, but only an approximation in programs compiled to native code.

        In native code this function does not allocate.

        • since 4.04
        val get : unit -> control

        Return the current values of the GC parameters in a control record.

        • alert unsynchronized_access GC parameters are a mutable global state.
        val set : control -> unit

        set r changes the GC parameters according to the control record r. The normal usage is: Gc.set { (Gc.get()) with Gc.verbose = 0x00d }

        • alert unsynchronized_access GC parameters are a mutable global state.
        val minor : unit -> unit

        Trigger a minor collection.

        val major_slice : int -> int

        major_slice n Do a minor collection and a slice of major collection. n is the size of the slice: the GC will do enough work to free (on average) n words of memory. If n = 0, the GC will try to do enough work to ensure that the next automatic slice has no work to do. This function returns an unspecified integer (currently: 0).

        val major : unit -> unit

        Do a minor collection and finish the current major collection cycle.

        val full_major : unit -> unit

        Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks.

        val compact : unit -> unit

        Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.

        val print_stat : out_channel -> unit

        Print the current values of the memory management counters (in human-readable form) of the total program into the channel argument.

        val allocated_bytes : unit -> float

        Return the number of bytes allocated by this domain and potentially a previous domain. It is returned as a float to avoid overflow problems with int on 32-bit machines.

        val get_minor_free : unit -> int

        Return the current size of the free space inside the minor heap of this domain.

        • since 4.03
        val finalise : ('a -> unit) -> 'a -> unit

        finalise f v registers f as a finalisation function for v. v must be heap-allocated. f will be called with v as argument at some point between the first time v becomes unreachable (including through weak pointers) and the time v is collected by the GC. Several functions can be registered for the same value, or even several instances of the same function. Each instance will be called once (or never, if the program terminates before v becomes unreachable).

        The GC will call the finalisation functions in the order of deallocation. When several values become unreachable at the same time (i.e. during the same GC cycle), the finalisation functions will be called in the reverse order of the corresponding calls to finalise. If finalise is called in the same order as the values are allocated, that means each value is finalised before the values it depends upon. Of course, this becomes false if additional dependencies are introduced by assignments.

        In the presence of multiple OCaml threads it should be assumed that any particular finaliser may be executed in any of the threads.

        Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected:

        • let v = ... in Gc.finalise (fun _ -> ...v...) v

        Instead you should make sure that v is not in the closure of the finalisation function by writing:

        • let f = fun x -> ... let v = ... in Gc.finalise f v

        The f function can use all features of OCaml, including assignments that make the value reachable again. It can also loop forever (in this case, the other finalisation functions will not be called during the execution of f, unless it calls finalise_release). It can call finalise on v or other values to register other functions or even itself. It can raise an exception; in this case the exception will interrupt whatever the program was doing when the function was called.

        finalise will raise Invalid_argument if v is not guaranteed to be heap-allocated. Some examples of values that are not heap-allocated are integers, constant constructors, booleans, the empty array, the empty list, the unit value. The exact list of what is heap-allocated or not is implementation-dependent. Some constant values can be heap-allocated but never deallocated during the lifetime of the program, for example a list of integer constants; this is also implementation-dependent. Note that values of types float are sometimes allocated and sometimes not, so finalising them is unsafe, and finalise will also raise Invalid_argument for them. Values of type 'a Lazy.t (for any 'a) are like float in this respect, except that the compiler sometimes optimizes them in a way that prevents finalise from detecting them. In this case, it will not raise Invalid_argument, but you should still avoid calling finalise on lazy values.

        The results of calling String.make, Bytes.make, Bytes.create, Array.make, and Stdlib.ref are guaranteed to be heap-allocated and non-constant except when the length argument is 0.

        val finalise_last : (unit -> unit) -> 'a -> unit

        same as finalise except the value is not given as argument. So you can't use the given value for the computation of the finalisation function. The benefit is that the function is called after the value is unreachable for the last time instead of the first time. So contrary to finalise the value will never be reachable again or used again. In particular every weak pointer and ephemeron that contained this value as key or data is unset before running the finalisation function. Moreover the finalisation functions attached with finalise are always called before the finalisation functions attached with finalise_last.

        • since 4.04
        val finalise_release : unit -> unit

        A finalisation function may call finalise_release to tell the GC that it can launch the next finalisation function without waiting for the current one to return.

        type alarm

        An alarm is a piece of data that calls a user function at the end of each major GC cycle. The following functions are provided to create and delete alarms.

        val create_alarm : (unit -> unit) -> alarm

        create_alarm f will arrange for f to be called at the end of each major GC cycle, not caused by f itself, starting with the current cycle or the next one. A value of type alarm is returned that you can use to call delete_alarm.

        val delete_alarm : alarm -> unit

        delete_alarm a will stop the calls to the function associated to a. Calling delete_alarm a again has no effect.

        val eventlog_pause : unit -> unit
        • deprecated Use Runtime_events.pause instead.
        val eventlog_resume : unit -> unit
        • deprecated Use Runtime_events.resume instead.
        module Memprof : sig ... end

        Memprof is a sampling engine for allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

        +Gc (ocaml.Stdlib.Gc)

        Module Stdlib.Gc

        Memory management control and statistics; finalised values.

        type stat = {
        1. minor_words : float;
          (*

          Number of words allocated in the minor heap since the program was started.

          *)
        2. promoted_words : float;
          (*

          Number of words allocated in the minor heap that survived a minor collection and were moved to the major heap since the program was started.

          *)
        3. major_words : float;
          (*

          Number of words allocated in the major heap, including the promoted words, since the program was started.

          *)
        4. minor_collections : int;
          (*

          Number of minor collections since the program was started.

          *)
        5. major_collections : int;
          (*

          Number of major collection cycles completed since the program was started.

          *)
        6. heap_words : int;
          (*

          Total size of the major heap, in words.

          *)
        7. heap_chunks : int;
          (*

          Number of contiguous pieces of memory that make up the major heap. This metric is currently not available in OCaml 5: the field value is always 0.

          *)
        8. live_words : int;
          (*

          Number of words of live data in the major heap, including the header words.

          Note that "live" words refers to every word in the major heap that isn't currently known to be collectable, which includes words that have become unreachable by the program after the start of the previous gc cycle. It is typically much simpler and more predictable to call Gc.full_major (or Gc.compact) then computing gc stats, as then "live" words has the simple meaning of "reachable by the program". One caveat is that a single call to Gc.full_major will not reclaim values that have a finaliser from Gc.finalise (this does not apply to Gc.finalise_last). If this caveat matters, simply call Gc.full_major twice instead of once.

          *)
        9. live_blocks : int;
          (*

          Number of live blocks in the major heap.

          See live_words for a caveat about what "live" means.

          *)
        10. free_words : int;
          (*

          Number of words in the free list.

          *)
        11. free_blocks : int;
          (*

          Number of blocks in the free list. This metric is currently not available in OCaml 5: the field value is always 0.

          *)
        12. largest_free : int;
          (*

          Size (in words) of the largest block in the free list. This metric is currently not available in OCaml 5: the field value is always 0.

          *)
        13. fragments : int;
          (*

          Number of wasted words due to fragmentation. These are 1-words free blocks placed between two live blocks. They are not available for allocation.

          *)
        14. compactions : int;
          (*

          Number of heap compactions since the program was started.

          *)
        15. top_heap_words : int;
          (*

          Maximum size reached by the major heap, in words.

          *)
        16. stack_size : int;
          (*

          Current size of the stack, in words. This metric is currently not available in OCaml 5: the field value is always 0.

          • since 3.12
          *)
        17. forced_major_collections : int;
          (*

          Number of forced full major collections completed since the program was started.

          • since 4.12
          *)
        }

        The memory management counters are returned in a stat record. These counters give values for the whole program.

        The total amount of memory allocated by the program since it was started is (in words) minor_words + major_words - promoted_words. Multiply by the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get the number of bytes.

        type control = {
        1. minor_heap_size : int;
          (*

          The size (in words) of the minor heap. Changing this parameter will trigger a minor collection. The total size of the minor heap used by this program is the sum of the heap sizes of the active domains. Default: 256k.

          *)
        2. major_heap_increment : int;
          (*

          How much to add to the major heap when increasing it. If this number is less than or equal to 1000, it is a percentage of the current heap size (i.e. setting it to 100 will double the heap size at each increase). If it is more than 1000, it is a fixed number of words that will be added to the heap.

          This field is currently not available in OCaml 5: the field value is always 0.

          *)
        3. space_overhead : int;
          (*

          The major GC speed is computed from this parameter. This is the memory that will be "wasted" because the GC does not immediately collect unreachable blocks. It is expressed as a percentage of the memory used for live data. The GC will work more (use more CPU time and collect blocks more eagerly) if space_overhead is smaller. Default: 120.

          *)
        4. verbose : int;
          (*

          This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:

          • 0x001 Start and end of major GC cycle.
          • 0x002 Minor collection and major GC slice.
          • 0x004 Growing and shrinking of the heap.
          • 0x008 Resizing of stacks and memory manager tables.
          • 0x010 Heap compaction.
          • 0x020 Change of GC parameters.
          • 0x040 Computation of major GC slice size.
          • 0x080 Calling of finalisation functions.
          • 0x100 Bytecode executable and shared library search at start-up.
          • 0x200 Computation of compaction-triggering condition.
          • 0x400 Output GC statistics at program exit. Default: 0.
          *)
        5. max_overhead : int;
          (*

          Heap compaction is triggered when the estimated amount of "wasted" memory is more than max_overhead percent of the amount of live data. If max_overhead is set to 0, heap compaction is triggered at the end of each major GC cycle (this setting is intended for testing purposes only). If max_overhead >= 1000000, compaction is never triggered.

          This field is currently not available in OCaml 5: the field value is always 0.

          *)
        6. stack_limit : int;
          (*

          The maximum size of the fiber stacks (in words). Default: 128M.

          *)
        7. allocation_policy : int;
          (*

          The policy used for allocating in the major heap.

          This field is currently not available in OCaml 5: the field value is always 0.

          Prior to OCaml 5.0, possible values were 0, 1 and 2.

          • 0 was the next-fit policy
          • 1 was the first-fit policy (since OCaml 3.11)
          • 2 was the best-fit policy (since OCaml 4.10)
          • since 3.11
          *)
        8. window_size : int;
          (*

          The size of the window used by the major GC for smoothing out variations in its workload. This is an integer between 1 and 50.

          • since 4.03

          This field is currently not available in OCaml 5: the field value is always 0.

          *)
        9. custom_major_ratio : int;
          (*

          Target ratio of floating garbage to major heap size for out-of-heap memory held by custom values located in the major heap. The GC speed is adjusted to try to use this much memory for dead values that are not yet collected. Expressed as a percentage of major heap size. The default value keeps the out-of-heap floating garbage about the same size as the in-heap overhead. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 44.

          • since 4.08
          *)
        10. custom_minor_ratio : int;
          (*

          Bound on floating garbage for out-of-heap memory held by custom values in the minor heap. A minor GC is triggered when this much memory is held by custom values located in the minor heap. Expressed as a percentage of minor heap size. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 100.

          • since 4.08
          *)
        11. custom_minor_max_size : int;
          (*

          Maximum amount of out-of-heap memory for each custom value allocated in the minor heap. Custom values that hold more than this many bytes are allocated on the major heap. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 70000 bytes.

          • since 4.08
          *)
        }

        The GC parameters are given as a control record. Note that these parameters can also be initialised by setting the OCAMLRUNPARAM environment variable. See the documentation of ocamlrun.

        val stat : unit -> stat

        Return the current values of the memory management counters in a stat record that represents the program's total memory stats. The heap_chunks, free_blocks, largest_free, and stack_size metrics are currently not available in OCaml 5: their returned field values are therefore 0. This function causes a full major collection.

        val quick_stat : unit -> stat

        Returns a record with the current values of the memory management counters like stat. Unlike stat, quick_stat does not perform a full major collection, and hence, is much faster. However, quick_stat reports the counters sampled at the last minor collection or at the end of the last major collection cycle (whichever is the latest). Hence, the memory stats returned by quick_stat are not instantaneously accurate.

        val counters : unit -> float * float * float

        Return (minor_words, promoted_words, major_words) for the current domain or potentially previous domains. This function is as fast as quick_stat.

        val minor_words : unit -> float

        Number of words allocated in the minor heap by this domain or potentially previous domains. This number is accurate in byte-code programs, but only an approximation in programs compiled to native code.

        In native code this function does not allocate.

        • since 4.04
        val get : unit -> control

        Return the current values of the GC parameters in a control record.

        The major_heap_increment, max_overhead, allocation_policy, and window_size fields are currently not available in OCaml 5: their returned field values are therefore 0.

        • alert unsynchronized_access GC parameters are a mutable global state.
        val set : control -> unit

        set r changes the GC parameters according to the control record r. The normal usage is: Gc.set { (Gc.get()) with Gc.verbose = 0x00d }

        The major_heap_increment, max_overhead, allocation_policy, and window_size fields are currently not available in OCaml 5: setting them therefore has no effect.

        • alert unsynchronized_access GC parameters are a mutable global state.
        val minor : unit -> unit

        Trigger a minor collection.

        val major_slice : int -> int

        major_slice n Do a minor collection and a slice of major collection. n is the size of the slice: the GC will do enough work to free (on average) n words of memory. If n = 0, the GC will try to do enough work to ensure that the next automatic slice has no work to do. This function returns an unspecified integer (currently: 0).

        val major : unit -> unit

        Do a minor collection and finish the current major collection cycle.

        val full_major : unit -> unit

        Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks.

        val compact : unit -> unit

        Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.

        val print_stat : out_channel -> unit

        Print the current values of the memory management counters (in human-readable form) of the total program into the channel argument.

        val allocated_bytes : unit -> float

        Return the number of bytes allocated by this domain and potentially a previous domain. It is returned as a float to avoid overflow problems with int on 32-bit machines.

        val get_minor_free : unit -> int

        Return the current size of the free space inside the minor heap of this domain.

        • since 4.03
        val finalise : ('a -> unit) -> 'a -> unit

        finalise f v registers f as a finalisation function for v. v must be heap-allocated. f will be called with v as argument at some point between the first time v becomes unreachable (including through weak pointers) and the time v is collected by the GC. Several functions can be registered for the same value, or even several instances of the same function. Each instance will be called once (or never, if the program terminates before v becomes unreachable).

        The GC will call the finalisation functions in the order of deallocation. When several values become unreachable at the same time (i.e. during the same GC cycle), the finalisation functions will be called in the reverse order of the corresponding calls to finalise. If finalise is called in the same order as the values are allocated, that means each value is finalised before the values it depends upon. Of course, this becomes false if additional dependencies are introduced by assignments.

        In the presence of multiple OCaml threads it should be assumed that any particular finaliser may be executed in any of the threads.

        Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected:

        • let v = ... in Gc.finalise (fun _ -> ...v...) v

        Instead you should make sure that v is not in the closure of the finalisation function by writing:

        • let f = fun x -> ... let v = ... in Gc.finalise f v

        The f function can use all features of OCaml, including assignments that make the value reachable again. It can also loop forever (in this case, the other finalisation functions will not be called during the execution of f, unless it calls finalise_release). It can call finalise on v or other values to register other functions or even itself. It can raise an exception; in this case the exception will interrupt whatever the program was doing when the function was called.

        finalise will raise Invalid_argument if v is not guaranteed to be heap-allocated. Some examples of values that are not heap-allocated are integers, constant constructors, booleans, the empty array, the empty list, the unit value. The exact list of what is heap-allocated or not is implementation-dependent. Some constant values can be heap-allocated but never deallocated during the lifetime of the program, for example a list of integer constants; this is also implementation-dependent. Note that values of types float are sometimes allocated and sometimes not, so finalising them is unsafe, and finalise will also raise Invalid_argument for them. Values of type 'a Lazy.t (for any 'a) are like float in this respect, except that the compiler sometimes optimizes them in a way that prevents finalise from detecting them. In this case, it will not raise Invalid_argument, but you should still avoid calling finalise on lazy values.

        The results of calling String.make, Bytes.make, Bytes.create, Array.make, and Stdlib.ref are guaranteed to be heap-allocated and non-constant except when the length argument is 0.

        val finalise_last : (unit -> unit) -> 'a -> unit

        same as finalise except the value is not given as argument. So you can't use the given value for the computation of the finalisation function. The benefit is that the function is called after the value is unreachable for the last time instead of the first time. So contrary to finalise the value will never be reachable again or used again. In particular every weak pointer and ephemeron that contained this value as key or data is unset before running the finalisation function. Moreover the finalisation functions attached with finalise are always called before the finalisation functions attached with finalise_last.

        • since 4.04
        val finalise_release : unit -> unit

        A finalisation function may call finalise_release to tell the GC that it can launch the next finalisation function without waiting for the current one to return.

        type alarm

        An alarm is a piece of data that calls a user function at the end of major GC cycle. The following functions are provided to create and delete alarms.

        val create_alarm : (unit -> unit) -> alarm

        create_alarm f will arrange for f to be called at the end of major GC cycles, not caused by f itself, starting with the current cycle or the next one. f will run on the same domain that created the alarm, until the domain exits or delete_alarm is called. A value of type alarm is returned that you can use to call delete_alarm.

        It is not guaranteed that the Gc alarm runs at the end of every major GC cycle, but it is guaranteed that it will run eventually.

        As an example, here is a crude way to interrupt a function if the memory consumption of the program exceeds a given limit in MB, suitable for use in the toplevel:

        let run_with_memory_limit (limit : int) (f : unit -> 'a) : 'a =
        +  let limit_memory () =
        +    let mem = Gc.(quick_stat ()).heap_words in
        +    if mem / (1024 * 1024) > limit / (Sys.word_size / 8) then
        +      raise Out_of_memory
        +  in
        +  let alarm = Gc.create_alarm limit_memory in
        +  Fun.protect f ~finally:(fun () -> Gc.delete_alarm alarm ; Gc.compact ())
        val delete_alarm : alarm -> unit

        delete_alarm a will stop the calls to the function associated to a. Calling delete_alarm a again has no effect.

        val eventlog_pause : unit -> unit
        • deprecated Use Runtime_events.pause instead.
        val eventlog_resume : unit -> unit
        • deprecated Use Runtime_events.resume instead.
        module Memprof : sig ... end

        Memprof is a profiling engine which randomly samples allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

        diff --git a/ocaml/Stdlib/Hashtbl/index.html b/ocaml/Stdlib/Hashtbl/index.html index 4bdb4685..8f058f51 100644 --- a/ocaml/Stdlib/Hashtbl/index.html +++ b/ocaml/Stdlib/Hashtbl/index.html @@ -1,5 +1,5 @@ -Hashtbl (ocaml.Stdlib.Hashtbl)

        Module Stdlib.Hashtbl

        Hash tables and hash functions.

        Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see find, find_opt) is normally very fast, often faster than the equivalent lookup in Map.

        The functors Make and MakeSeeded can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key.

        Warning a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup.

        The polymorphic t hash table is useful in simpler cases or in interactive environments. It uses the polymorphic hash function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality (=).

        See the examples section.

        Unsynchronized accesses

        Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

        Generic interface

        type (!'a, !'b) t

        The type of hash tables from type 'a to type 'b.

        val create : ?random:bool -> int -> ('a, 'b) t

        Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

        The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

        A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

        A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

        If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

        • before 4.00

          the ~random parameter was not present and all hash tables were created in non-randomized mode.

        val clear : ('a, 'b) t -> unit

        Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

        val reset : ('a, 'b) t -> unit

        Empty a hash table and shrink the size of the bucket table to its initial size.

        • since 4.00
        val copy : ('a, 'b) t -> ('a, 'b) t

        Return a copy of the given hashtable.

        val add : ('a, 'b) t -> 'a -> 'b -> unit

        Hashtbl.add tbl key data adds a binding of key to data in table tbl.

        Warning: Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

        If you desire the classic behavior of replacing elements, see replace.

        val find : ('a, 'b) t -> 'a -> 'b

        Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

        val find_opt : ('a, 'b) t -> 'a -> 'b option

        Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

        • since 4.05
        val find_all : ('a, 'b) t -> 'a -> 'b list

        Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

        val mem : ('a, 'b) t -> 'a -> bool

        Hashtbl.mem tbl x checks if x is bound in tbl.

        val remove : ('a, 'b) t -> 'a -> unit

        Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

        val replace : ('a, 'b) t -> 'a -> 'b -> unit

        Hashtbl.replace tbl key data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

        val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit

        Hashtbl.iter f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

        The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

        If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

        The behavior is not specified if the hash table is modified by f during the iteration.

        val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit

        Hashtbl.filter_map_inplace f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

        Other comments for iter apply as well.

        • since 4.03
        val fold : ('a -> 'b -> 'acc -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc

        Hashtbl.fold f tbl init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

        The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

        If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

        The behavior is not specified if the hash table is modified by f during the iteration.

        val length : ('a, 'b) t -> int

        Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

        val randomize : unit -> unit

        After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

        It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time before any domains are created.

        Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

        • since 4.00
        val is_randomized : unit -> bool

        Return true if the tables are currently created in randomized mode by default, false otherwise.

        • since 4.03
        val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

        Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

        rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

        • since 4.12
        type statistics = {
        1. num_bindings : int;
          (*

          Number of bindings present in the table. Same value as returned by length.

          *)
        2. num_buckets : int;
          (*

          Number of buckets in the table.

          *)
        3. max_bucket_length : int;
          (*

          Maximal number of bindings per bucket.

          *)
        4. bucket_histogram : int array;
          (*

          Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

          *)
        }
        • since 4.00
        val stats : ('a, 'b) t -> statistics

        Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

        • since 4.00

        Hash tables and Sequences

        val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

        Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

        The behavior is not specified if the hash table is modified during the iteration.

        • since 4.07
        val to_seq_keys : ('a, _) t -> 'a Seq.t

        Same as Seq.map fst (to_seq m)

        • since 4.07
        val to_seq_values : (_, 'b) t -> 'b Seq.t

        Same as Seq.map snd (to_seq m)

        • since 4.07
        val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

        Add the given bindings to the table, using add

        • since 4.07
        val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

        Add the given bindings to the table, using replace

        • since 4.07
        val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

        Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

        • since 4.07

        Functorial interface

        The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

        For instance, one might want to specialize a table for integer keys:

        module IntHash =
        +Hashtbl (ocaml.Stdlib.Hashtbl)

        Module Stdlib.Hashtbl

        Hash tables and hash functions.

        Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see find, find_opt) is normally very fast, often faster than the equivalent lookup in Map.

        The functors Make and MakeSeeded can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key.

        Warning a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup.

        The polymorphic t hash table is useful in simpler cases or in interactive environments. It uses the polymorphic hash function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality (=).

        See the examples section.

        Unsynchronized accesses

        Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

        Generic interface

        type (!'a, !'b) t

        The type of hash tables from type 'a to type 'b.

        val create : ?random:bool -> int -> ('a, 'b) t

        Hashtbl.create n creates a new, empty hash table, with initial size greater or equal to the suggested size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess. If n is very small or negative then it is disregarded and a small default size is used.

        The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

        A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

        A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

        If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

        • before 4.00

          the ~random parameter was not present and all hash tables were created in non-randomized mode.

        val clear : ('a, 'b) t -> unit

        Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

        val reset : ('a, 'b) t -> unit

        Empty a hash table and shrink the size of the bucket table to its initial size.

        • since 4.00
        val copy : ('a, 'b) t -> ('a, 'b) t

        Return a copy of the given hashtable.

        val add : ('a, 'b) t -> 'a -> 'b -> unit

        Hashtbl.add tbl key data adds a binding of key to data in table tbl.

        Warning: Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

        If you desire the classic behavior of replacing elements, see replace.

        val find : ('a, 'b) t -> 'a -> 'b

        Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

        val find_opt : ('a, 'b) t -> 'a -> 'b option

        Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

        • since 4.05
        val find_all : ('a, 'b) t -> 'a -> 'b list

        Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

        val mem : ('a, 'b) t -> 'a -> bool

        Hashtbl.mem tbl x checks if x is bound in tbl.

        val remove : ('a, 'b) t -> 'a -> unit

        Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

        val replace : ('a, 'b) t -> 'a -> 'b -> unit

        Hashtbl.replace tbl key data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

        val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit

        Hashtbl.iter f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

        The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

        If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

        The behavior is not specified if the hash table is modified by f during the iteration.

        val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit

        Hashtbl.filter_map_inplace f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

        Other comments for iter apply as well.

        • since 4.03
        val fold : ('a -> 'b -> 'acc -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc

        Hashtbl.fold f tbl init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

        The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

        If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

        The behavior is not specified if the hash table is modified by f during the iteration.

        val length : ('a, 'b) t -> int

        Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

        val randomize : unit -> unit

        After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

        It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time before any domains are created.

        Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

        • since 4.00
        val is_randomized : unit -> bool

        Return true if the tables are currently created in randomized mode by default, false otherwise.

        • since 4.03
        val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

        Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

        rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

        • since 4.12
        type statistics = {
        1. num_bindings : int;
          (*

          Number of bindings present in the table. Same value as returned by length.

          *)
        2. num_buckets : int;
          (*

          Number of buckets in the table.

          *)
        3. max_bucket_length : int;
          (*

          Maximal number of bindings per bucket.

          *)
        4. bucket_histogram : int array;
          (*

          Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

          *)
        }
        • since 4.00
        val stats : ('a, 'b) t -> statistics

        Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

        • since 4.00

        Hash tables and Sequences

        val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

        Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

        The behavior is not specified if the hash table is modified during the iteration.

        • since 4.07
        val to_seq_keys : ('a, _) t -> 'a Seq.t

        Same as Seq.map fst (to_seq m)

        • since 4.07
        val to_seq_values : (_, 'b) t -> 'b Seq.t

        Same as Seq.map snd (to_seq m)

        • since 4.07
        val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

        Add the given bindings to the table, using add

        • since 4.07
        val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

        Add the given bindings to the table, using replace

        • since 4.07
        val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

        Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

        • since 4.07

        Functorial interface

        The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

        For instance, one might want to specialize a table for integer keys:

        module IntHash =
           struct
             type t = int
             let equal i j = i=j
        diff --git a/ocaml/Stdlib/In_channel/index.html b/ocaml/Stdlib/In_channel/index.html
        index 7dd52fba..8bc56616 100644
        --- a/ocaml/Stdlib/In_channel/index.html
        +++ b/ocaml/Stdlib/In_channel/index.html
        @@ -1,3 +1,13 @@
         
         In_channel (ocaml.Stdlib.In_channel)

        Module Stdlib.In_channel

        Input channels.

        This module provides functions for working with input channels.

        See the example section below.

        • since 4.14

        Channels

        type t = in_channel

        The type of input channel.

        type open_flag = open_flag =
        1. | Open_rdonly
          (*

          open for reading.

          *)
        2. | Open_wronly
          (*

          open for writing.

          *)
        3. | Open_append
          (*

          open for appending: always write at end of file.

          *)
        4. | Open_creat
          (*

          create the file if it does not exist.

          *)
        5. | Open_trunc
          (*

          empty the file if it already exists.

          *)
        6. | Open_excl
          (*

          fail if Open_creat and the file already exists.

          *)
        7. | Open_binary
          (*

          open in binary mode (no conversion).

          *)
        8. | Open_text
          (*

          open in text mode (may perform conversions).

          *)
        9. | Open_nonblock
          (*

          open in non-blocking mode.

          *)

        Opening modes for open_gen.

        val stdin : t

        The standard input for the process.

        val open_bin : string -> t

        Open the named file for reading, and return a new input channel on that file, positioned at the beginning of the file.

        val open_text : string -> t

        Same as open_bin, but the file is opened in text mode, so that newline translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like open_bin.

        val open_gen : open_flag list -> int -> string -> t

        open_gen mode perm filename opens the named file for reading, as described above. The extra arguments mode and perm specify the opening mode and file permissions. open_text and open_bin are special cases of this function.

        val with_open_bin : string -> (t -> 'a) -> 'a

        with_open_bin fn f opens a channel ic on file fn and returns f - ic. After f returns, either with a value or by raising an exception, ic is guaranteed to be closed.

        val with_open_text : string -> (t -> 'a) -> 'a

        Like with_open_bin, but the channel is opened in text mode (see open_text).

        val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

        Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

        val close : t -> unit

        Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close, which does nothing when applied to an already closed channel.

        val close_noerr : t -> unit

        Same as close, but ignore all errors.

        Input

        val input_char : t -> char option

        Read one character from the given input channel. Returns None if there are no more characters to read.

        val input_byte : t -> int option

        Same as input_char, but return the 8-bit integer representing the character. Returns None if the end of file was reached.

        val input_line : t -> string option

        input_line ic reads characters from ic until a newline or the end of file is reached. Returns the string of all characters read, without the newline (if any). Returns None if the end of the file has been reached. In particular, this will be the case if the last line of input is empty.

        A newline is the character \n unless the file is open in text mode and Sys.win32 is true in which case it is the sequence of characters \r\n.

        val really_input_string : t -> int -> string option

        really_input_string ic len reads len characters from channel ic and returns them in a new string. Returns None if the end of file is reached before len characters have been read.

        If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

        val input_all : t -> string

        input_all ic reads all remaining data from ic.

        If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

        val input_lines : t -> string list

        input_lines ic reads lines using input_line until the end of file is reached. It returns the list of all lines read, in the order they were read. The newline characters that terminate lines are not included in the returned strings. Empty lines produce empty strings.

        • since 5.1

        Advanced input

        val input : t -> bytes -> int -> int -> int

        input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached.

        Use really_input to read exactly len characters.

        val really_input : t -> bytes -> int -> int -> unit option

        really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

        Returns None if the end of file is reached before len characters have been read.

        If the same channel is read concurrently by multiple threads, the bytes read by really_input are not guaranteed to be contiguous.

        val fold_lines : ('acc -> string -> 'acc) -> 'acc -> t -> 'acc

        fold_lines f init ic reads lines from ic using input_line until the end of file is reached, and successively passes each line to function f in the style of a fold. More precisely, if lines l1, ..., lN are read, fold_lines f init ic computes f (... (f (f init l1) l2) ...) lN. If f has no side effects, this is equivalent to List.fold_left f init (In_channel.input_lines ic), but is more efficient since it does not construct the list of all lines read.

        • since 5.1

        Seeking

        val seek : t -> int64 -> unit

        seek chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

        val pos : t -> int64

        Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

        Attributes

        val length : t -> int64

        Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

        val set_binary_mode : t -> bool -> unit

        set_binary_mode ic true sets the channel ic to binary mode: no translations take place during input.

        set_binary_mode ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n.

        This function has no effect under operating systems that do not distinguish between text mode and binary mode.

        val isatty : t -> bool

        isatty ic is true if ic refers to a terminal or console window, false otherwise.

        • since 5.1

        Examples

        Reading the contents of a file:

        let read_file file = In_channel.with_open_bin file In_channel.input_all

        Reading a line from stdin:

        let user_input () = In_channel.input_line In_channel.stdin
        + ic
        . After f returns, either with a value or by raising an exception, ic is guaranteed to be closed.

        val with_open_text : string -> (t -> 'a) -> 'a

        Like with_open_bin, but the channel is opened in text mode (see open_text).

        val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

        Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

        val close : t -> unit

        Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close, which does nothing when applied to an already closed channel.

        val close_noerr : t -> unit

        Same as close, but ignore all errors.

        Input

        val input_char : t -> char option

        Read one character from the given input channel. Returns None if there are no more characters to read.

        val input_byte : t -> int option

        Same as input_char, but return the 8-bit integer representing the character. Returns None if the end of file was reached.

        val input_line : t -> string option

        input_line ic reads characters from ic until a newline or the end of file is reached. Returns the string of all characters read, without the newline (if any). Returns None if the end of the file has been reached. In particular, this will be the case if the last line of input is empty.

        A newline is the character \n unless the file is open in text mode and Sys.win32 is true in which case it is the sequence of characters \r\n.

        val really_input_string : t -> int -> string option

        really_input_string ic len reads len characters from channel ic and returns them in a new string. Returns None if the end of file is reached before len characters have been read.

        If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

        val input_all : t -> string

        input_all ic reads all remaining data from ic.

        If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

        val input_lines : t -> string list

        input_lines ic reads lines using input_line until the end of file is reached. It returns the list of all lines read, in the order they were read. The newline characters that terminate lines are not included in the returned strings. Empty lines produce empty strings.

        • since 5.1

        Advanced input

        val input : t -> bytes -> int -> int -> int

        input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached.

        Use really_input to read exactly len characters.

        val input_bigarray : + t -> + (_, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> + int -> + int

        Same as input, but read the data into a bigarray.

        • since 5.2
        val really_input : t -> bytes -> int -> int -> unit option

        really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

        Returns None if the end of file is reached before len characters have been read.

        If the same channel is read concurrently by multiple threads, the bytes read by really_input are not guaranteed to be contiguous.

        val really_input_bigarray : + t -> + (_, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> + int -> + unit option

        Same as really_input, but read the data into a bigarray.

        • since 5.2
        val fold_lines : ('acc -> string -> 'acc) -> 'acc -> t -> 'acc

        fold_lines f init ic reads lines from ic using input_line until the end of file is reached, and successively passes each line to function f in the style of a fold. More precisely, if lines l1, ..., lN are read, fold_lines f init ic computes f (... (f (f init l1) l2) ...) lN. If f has no side effects, this is equivalent to List.fold_left f init (In_channel.input_lines ic), but is more efficient since it does not construct the list of all lines read.

        • since 5.1

        Seeking

        val seek : t -> int64 -> unit

        seek chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

        val pos : t -> int64

        Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

        Attributes

        val length : t -> int64

        Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

        val set_binary_mode : t -> bool -> unit

        set_binary_mode ic true sets the channel ic to binary mode: no translations take place during input.

        set_binary_mode ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n.

        This function has no effect under operating systems that do not distinguish between text mode and binary mode.

        val is_binary_mode : t -> bool

        is_binary_mode ic returns whether the channel ic is in binary mode (see set_binary_mode).

        • since 5.2
        val isatty : t -> bool

        isatty ic is true if ic refers to a terminal or console window, false otherwise.

        • since 5.1

        Examples

        Reading the contents of a file:

        let read_file file = In_channel.with_open_bin file In_channel.input_all

        Reading a line from stdin:

        let user_input () = In_channel.input_line In_channel.stdin
        diff --git a/ocaml/Stdlib/Int/index.html b/ocaml/Stdlib/Int/index.html index 63718b6d..d1e6db98 100644 --- a/ocaml/Stdlib/Int/index.html +++ b/ocaml/Stdlib/Int/index.html @@ -1,2 +1,2 @@ -Int (ocaml.Stdlib.Int)

        Module Stdlib.Int

        Integer values.

        Integers are Sys.int_size bits wide and use two's complement representation. All operations are taken modulo 2Sys.int_size. They do not fail on overflow.

        • since 4.08

        Integers

        type t = int

        The type for integer values.

        val zero : int

        zero is the integer 0.

        val one : int

        one is the integer 1.

        val minus_one : int

        minus_one is the integer -1.

        val neg : int -> int

        neg x is ~-x.

        val add : int -> int -> int

        add x y is the addition x + y.

        val sub : int -> int -> int

        sub x y is the subtraction x - y.

        val mul : int -> int -> int

        mul x y is the multiplication x * y.

        val div : int -> int -> int

        div x y is the division x / y. See Stdlib.(/) for details.

        val rem : int -> int -> int

        rem x y is the remainder x mod y. See Stdlib.(mod) for details.

        val succ : int -> int

        succ x is add x 1.

        val pred : int -> int

        pred x is sub x 1.

        val abs : int -> int

        abs x is the absolute value of x. That is x if x is positive and neg x if x is negative. Warning. This may be negative if the argument is min_int.

        val max_int : int

        max_int is the greatest representable integer, 2{^[Sys.int_size - 1]} - 1.

        val min_int : int

        min_int is the smallest representable integer, -2{^[Sys.int_size - 1]}.

        val logand : int -> int -> int

        logand x y is the bitwise logical and of x and y.

        val logor : int -> int -> int

        logor x y is the bitwise logical or of x and y.

        val logxor : int -> int -> int

        logxor x y is the bitwise logical exclusive or of x and y.

        val lognot : int -> int

        lognot x is the bitwise logical negation of x.

        val shift_left : int -> int -> int

        shift_left x n shifts x to the left by n bits. The result is unspecified if n < 0 or n > Sys.int_size.

        val shift_right : int -> int -> int

        shift_right x n shifts x to the right by n bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if n < 0 or n > Sys.int_size.

        val shift_right_logical : int -> int -> int

        shift_right x n shifts x to the right by n bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if n < 0 or n > Sys.int_size.

        Predicates and comparisons

        val equal : int -> int -> bool

        equal x y is true if and only if x = y.

        val compare : int -> int -> int

        compare x y is Stdlib.compare x y but more efficient.

        val min : int -> int -> int

        Return the smaller of the two arguments.

        • since 4.13
        val max : int -> int -> int

        Return the greater of the two arguments.

        • since 4.13

        Converting

        val to_float : int -> float

        to_float x is x as a floating point number.

        val of_float : float -> int

        of_float x truncates x to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

        val to_string : int -> string

        to_string x is the written representation of x in decimal.

        val seeded_hash : int -> int -> int

        A seeded hash function for ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.1
        val hash : int -> int

        An unseeded hash function for ints, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        • since 5.1
        +Int (ocaml.Stdlib.Int)

        Module Stdlib.Int

        Integer values.

        Integers are Sys.int_size bits wide and use two's complement representation. All operations are taken modulo 2Sys.int_size. They do not fail on overflow.

        • since 4.08

        Integers

        type t = int

        The type for integer values.

        val zero : int

        zero is the integer 0.

        val one : int

        one is the integer 1.

        val minus_one : int

        minus_one is the integer -1.

        val neg : int -> int

        neg x is ~-x.

        val add : int -> int -> int

        add x y is the addition x + y.

        val sub : int -> int -> int

        sub x y is the subtraction x - y.

        val mul : int -> int -> int

        mul x y is the multiplication x * y.

        val div : int -> int -> int

        div x y is the division x / y. See Stdlib.(/) for details.

        val rem : int -> int -> int

        rem x y is the remainder x mod y. See Stdlib.(mod) for details.

        val succ : int -> int

        succ x is add x 1.

        val pred : int -> int

        pred x is sub x 1.

        val abs : int -> int

        abs x is the absolute value of x. That is x if x is positive and neg x if x is negative. Warning. This may be negative if the argument is min_int.

        val max_int : int

        max_int is the greatest representable integer, 2Sys.int_size - 1-1.

        val min_int : int

        min_int is the smallest representable integer, -2Sys.int_size - 1.

        val logand : int -> int -> int

        logand x y is the bitwise logical and of x and y.

        val logor : int -> int -> int

        logor x y is the bitwise logical or of x and y.

        val logxor : int -> int -> int

        logxor x y is the bitwise logical exclusive or of x and y.

        val lognot : int -> int

        lognot x is the bitwise logical negation of x.

        val shift_left : int -> int -> int

        shift_left x n shifts x to the left by n bits. The result is unspecified if n < 0 or n > Sys.int_size.

        val shift_right : int -> int -> int

        shift_right x n shifts x to the right by n bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if n < 0 or n > Sys.int_size.

        val shift_right_logical : int -> int -> int

        shift_right x n shifts x to the right by n bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if n < 0 or n > Sys.int_size.

        Predicates and comparisons

        val equal : int -> int -> bool

        equal x y is true if and only if x = y.

        val compare : int -> int -> int

        compare x y is Stdlib.compare x y but more efficient.

        val min : int -> int -> int

        Return the smaller of the two arguments.

        • since 4.13
        val max : int -> int -> int

        Return the greater of the two arguments.

        • since 4.13

        Converting

        val to_float : int -> float

        to_float x is x as a floating point number.

        val of_float : float -> int

        of_float x truncates x to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

        val to_string : int -> string

        to_string x is the written representation of x in decimal.

        val seeded_hash : int -> int -> int

        A seeded hash function for ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.1
        val hash : int -> int

        An unseeded hash function for ints, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        • since 5.1
        diff --git a/ocaml/Stdlib/Lazy/index.html b/ocaml/Stdlib/Lazy/index.html index 8697eb2f..c7702e38 100644 --- a/ocaml/Stdlib/Lazy/index.html +++ b/ocaml/Stdlib/Lazy/index.html @@ -2,4 +2,4 @@ Lazy (ocaml.Stdlib.Lazy)

        Module Stdlib.Lazy

        Deferred computations.

        type 'a t = 'a CamlinternalLazy.t

        A value of type 'a Lazy.t is a deferred computation, called a suspension, that has a result of type 'a. The special expression syntax lazy (expr) makes a suspension of the computation of expr, without computing expr itself yet. "Forcing" the suspension will then compute expr and return its result. Matching a suspension with the special pattern syntax lazy(pattern) also computes the underlying expression and tries to bind it to pattern:

        let lazy_option_map f x =
         match x with
         | lazy (Some x) -> Some (Lazy.force f x)
        -| _ -> None

        Note: If lazy patterns appear in multiple cases in a pattern-matching, lazy expressions may be forced even outside of the case ultimately selected by the pattern matching. In the example above, the suspension x is always computed.

        Note: lazy_t is the built-in type constructor used by the compiler for the lazy keyword. You should not use it directly. Always use Lazy.t instead.

        Note: Lazy.force is not concurrency-safe. If you use this module with multiple fibers, systhreads or domains, then you will need to add some locks. The module however ensures memory-safety, and hence, concurrently accessing this module will not lead to a crash but the behaviour is unspecified.

        Note: if the program is compiled with the -rectypes option, ill-founded recursive definitions of the form let rec x = lazy x or let rec x = lazy(lazy(...(lazy x))) are accepted by the type-checker and lead, when forced, to ill-formed values that trigger infinite loops in the garbage collector and other parts of the run-time system. Without the -rectypes option, such ill-founded recursive definitions are rejected by the type-checker.

        exception Undefined

        Raised when forcing a suspension concurrently from multiple fibers, systhreads or domains, or when the suspension tries to force itself recursively.

        val force : 'a t -> 'a

        force x forces the suspension x and returns its result. If x has already been forced, Lazy.force x returns the same value again without recomputing it. If it raised an exception, the same exception is raised again.

        Iterators

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f x returns a suspension that, when forced, forces x and applies f to its value.

        It is equivalent to lazy (f (Lazy.force x)).

        • since 4.13

        Reasoning on already-forced suspensions

        val is_val : 'a t -> bool

        is_val x returns true if x has already been forced and did not raise an exception.

        • since 4.00
        val from_val : 'a -> 'a t

        from_val v evaluates v first (as any function would) and returns an already-forced suspension of its result. It is the same as let x = v in lazy x, but uses dynamic tests to optimize suspension creation in some cases.

        • since 4.00
        val map_val : ('a -> 'b) -> 'a t -> 'b t

        map_val f x applies f directly if x is already forced, otherwise it behaves as map f x.

        When x is already forced, this behavior saves the construction of a suspension, but on the other hand it performs more work eagerly that may not be useful if you never force the function result.

        If f raises an exception, it will be raised immediately when is_val x, or raised only when forcing the thunk otherwise.

        If map_val f x does not raise an exception, then is_val (map_val f x) is equal to is_val x.

        • since 4.13

        Advanced

        The following definitions are for advanced uses only; they require familiary with the lazy compilation scheme to be used appropriately.

        val from_fun : (unit -> 'a) -> 'a t

        from_fun f is the same as lazy (f ()) but slightly more efficient.

        It should only be used if the function f is already defined. In particular it is always less efficient to write from_fun (fun () -> expr) than lazy expr.

        • since 4.00
        val force_val : 'a t -> 'a

        force_val x forces the suspension x and returns its result. If x has already been forced, force_val x returns the same value again without recomputing it.

        If the computation of x raises an exception, it is unspecified whether force_val x raises the same exception or Undefined.

        • raises Undefined

          if the forcing of x tries to force x itself recursively.

        +| _ -> None

        Note: If lazy patterns appear in multiple cases in a pattern-matching, lazy expressions may be forced even outside of the case ultimately selected by the pattern matching. In the example above, the suspension x is always computed.

        Note: lazy_t is the built-in type constructor used by the compiler for the lazy keyword. You should not use it directly. Always use Lazy.t instead.

        Note: Lazy.force is not concurrency-safe. If you use this module with multiple fibers, systhreads or domains, then you will need to add some locks. The module however ensures memory-safety, and hence, concurrently accessing this module will not lead to a crash but the behaviour is unspecified.

        Note: if the program is compiled with the -rectypes option, ill-founded recursive definitions of the form let rec x = lazy x or let rec x = lazy(lazy(...(lazy x))) are accepted by the type-checker and lead, when forced, to ill-formed values that trigger infinite loops in the garbage collector and other parts of the run-time system. Without the -rectypes option, such ill-founded recursive definitions are rejected by the type-checker.

        exception Undefined

        Raised when forcing a suspension concurrently from multiple fibers, systhreads or domains, or when the suspension tries to force itself recursively.

        val force : 'a t -> 'a

        force x forces the suspension x and returns its result. If x has already been forced, Lazy.force x returns the same value again without recomputing it. If it raised an exception, the same exception is raised again.

        Iterators

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f x returns a suspension that, when forced, forces x and applies f to its value.

        It is equivalent to lazy (f (Lazy.force x)).

        • since 4.13

        Reasoning on already-forced suspensions

        val is_val : 'a t -> bool

        is_val x returns true if x has already been forced and did not raise an exception.

        • since 4.00
        val from_val : 'a -> 'a t

        from_val v evaluates v first (as any function would) and returns an already-forced suspension of its result. It is the same as let x = v in lazy x, but uses dynamic tests to optimize suspension creation in some cases.

        • since 4.00
        val map_val : ('a -> 'b) -> 'a t -> 'b t

        map_val f x applies f directly if x is already forced, otherwise it behaves as map f x.

        When x is already forced, this behavior saves the construction of a suspension, but on the other hand it performs more work eagerly that may not be useful if you never force the function result.

        If f raises an exception, it will be raised immediately when is_val x, or raised only when forcing the thunk otherwise.

        If map_val f x does not raise an exception, then is_val (map_val f x) is equal to is_val x.

        • since 4.13

        Advanced

        The following definitions are for advanced uses only; they require familiarity with the lazy compilation scheme to be used appropriately.

        val from_fun : (unit -> 'a) -> 'a t

        from_fun f is the same as lazy (f ()) but slightly more efficient.

        It should only be used if the function f is already defined. In particular it is always less efficient to write from_fun (fun () -> expr) than lazy expr.

        • since 4.00
        val force_val : 'a t -> 'a

        force_val x forces the suspension x and returns its result. If x has already been forced, force_val x returns the same value again without recomputing it.

        If the computation of x raises an exception, it is unspecified whether force_val x raises the same exception or Undefined.

        • raises Undefined

          if the forcing of x tries to force x itself recursively.

        diff --git a/ocaml/Stdlib/List/index.html b/ocaml/Stdlib/List/index.html index 57d411bf..d3d38810 100644 --- a/ocaml/Stdlib/List/index.html +++ b/ocaml/Stdlib/List/index.html @@ -1,5 +1,5 @@ -List (ocaml.Stdlib.List)

        Module Stdlib.List

        List operations.

        Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

        The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a list =
        1. | []
        2. | :: of 'a * 'a list

        An alias for the type of lists.

        val length : 'a list -> int

        Return the length (number of elements) of the given list.

        val compare_lengths : 'a list -> 'b list -> int

        Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

        • since 4.05
        val compare_length_with : 'a list -> int -> int

        Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

        • since 4.05
        val is_empty : 'a list -> bool

        is_empty l is true if and only if l has no elements. It is equivalent to compare_length_with l 0 = 0.

        • since 5.1
        val cons : 'a -> 'a list -> 'a list

        cons x xs is x :: xs

        • since 4.03 (4.05 in ListLabels)
        val hd : 'a list -> 'a

        Return the first element of the given list.

        • raises Failure

          if the list is empty.

        val tl : 'a list -> 'a list

        Return the given list without its first element.

        • raises Failure

          if the list is empty.

        val nth : 'a list -> int -> 'a

        Return the n-th element of the given list. The first element (head of the list) is at position 0.

        • raises Failure

          if the list is too short.

        val nth_opt : 'a list -> int -> 'a option

        Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

        • since 4.05
        val rev : 'a list -> 'a list

        List reversal.

        val init : int -> (int -> 'a) -> 'a list

        init len f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

        • since 4.06
        val append : 'a list -> 'a list -> 'a list

        append l0 l1 appends l1 to l0. Same function as the infix operator @.

        • since 5.1 this function is tail-recursive.
        val rev_append : 'a list -> 'a list -> 'a list

        rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2.

        val concat : 'a list list -> 'a list

        Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

        val flatten : 'a list list -> 'a list

        Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

        Comparison

        val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool

        equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

        Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

        • since 4.12
        val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int

        compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

        • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
        • the empty list [] is strictly smaller than non-empty lists

        Note: the cmp function will be called even if the lists have different lengths.

        • since 4.12

        Iterators

        val iter : ('a -> unit) -> 'a list -> unit

        iter f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

        val iteri : (int -> 'a -> unit) -> 'a list -> unit

        Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val map : ('a -> 'b) -> 'a list -> 'b list

        map f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f.

        val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list

        Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val rev_map : ('a -> 'b) -> 'a list -> 'b list

        rev_map f l gives the same result as rev (map f l), but is more efficient.

        val filter_map : ('a -> 'b option) -> 'a list -> 'b list

        filter_map f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

        • since 4.08
        val concat_map : ('a -> 'b list) -> 'a list -> 'b list

        concat_map f l gives the same result as concat (map f l). Tail-recursive.

        • since 4.10
        val fold_left_map : +List (ocaml.Stdlib.List)

        Module Stdlib.List

        List operations.

        Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

        The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a list =
        1. | []
        2. | :: of 'a * 'a list

        An alias for the type of lists.

        val length : 'a list -> int

        Return the length (number of elements) of the given list.

        val compare_lengths : 'a list -> 'b list -> int

        Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

        • since 4.05
        val compare_length_with : 'a list -> int -> int

        Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

        • since 4.05
        val is_empty : 'a list -> bool

        is_empty l is true if and only if l has no elements. It is equivalent to compare_length_with l 0 = 0.

        • since 5.1
        val cons : 'a -> 'a list -> 'a list

        cons x xs is x :: xs

        • since 4.03 (4.05 in ListLabels)
        val hd : 'a list -> 'a

        Return the first element of the given list.

        • raises Failure

          if the list is empty.

        val tl : 'a list -> 'a list

        Return the given list without its first element.

        • raises Failure

          if the list is empty.

        val nth : 'a list -> int -> 'a

        Return the n-th element of the given list. The first element (head of the list) is at position 0.

        • raises Failure

          if the list is too short.

        val nth_opt : 'a list -> int -> 'a option

        Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

        • since 4.05
        val rev : 'a list -> 'a list

        List reversal.

        val init : int -> (int -> 'a) -> 'a list

        init len f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

        • since 4.06
        val append : 'a list -> 'a list -> 'a list

        append l0 l1 appends l1 to l0. Same function as the infix operator @.

        • since 5.1 this function is tail-recursive.
        val rev_append : 'a list -> 'a list -> 'a list

        rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2.

        val concat : 'a list list -> 'a list

        Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

        val flatten : 'a list list -> 'a list

        Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

        Comparison

        val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool

        equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

        Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

        • since 4.12
        val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int

        compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

        • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
        • the empty list [] is strictly smaller than non-empty lists

        Note: the cmp function will be called even if the lists have different lengths.

        • since 4.12

        Iterators

        val iter : ('a -> unit) -> 'a list -> unit

        iter f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

        val iteri : (int -> 'a -> unit) -> 'a list -> unit

        Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val map : ('a -> 'b) -> 'a list -> 'b list

        map f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f.

        val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list

        Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val rev_map : ('a -> 'b) -> 'a list -> 'b list

        rev_map f l gives the same result as rev (map f l), but is more efficient.

        val filter_map : ('a -> 'b option) -> 'a list -> 'b list

        filter_map f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

        • since 4.08
        val concat_map : ('a -> 'b list) -> 'a list -> 'b list

        concat_map f l gives the same result as concat (map f l). Tail-recursive.

        • since 4.10
        val fold_left_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> @@ -13,4 +13,4 @@ 'a list -> 'b list -> 'acc -> - 'acc

        fold_right2 f [a1; ...; an] [b1; ...; bn] init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

        • raises Invalid_argument

          if the two lists are determined to have different lengths. Not tail-recursive.

        List scanning

        val for_all : ('a -> bool) -> 'a list -> bool

        for_all f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

        val exists : ('a -> bool) -> 'a list -> bool

        exists f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

        val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as for_all, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as exists, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val mem : 'a -> 'a list -> bool

        mem a set is true if and only if a is equal to an element of set.

        val memq : 'a -> 'a list -> bool

        Same as mem, but uses physical equality instead of structural equality to compare list elements.

        List searching

        val find : ('a -> bool) -> 'a list -> 'a

        find f l returns the first element of the list l that satisfies the predicate f.

        • raises Not_found

          if there is no value that satisfies f in the list l.

        val find_opt : ('a -> bool) -> 'a list -> 'a option

        find f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

        • since 4.05
        val find_index : ('a -> bool) -> 'a list -> int option

        find_index f xs returns Some i, where i is the index of the first element of the list xs that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : ('a -> 'b option) -> 'a list -> 'b option

        find_map f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.10
        val find_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1
        val filter : ('a -> bool) -> 'a list -> 'a list

        filter f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

        val find_all : ('a -> bool) -> 'a list -> 'a list

        find_all is another name for filter.

        val filteri : (int -> 'a -> bool) -> 'a list -> 'a list

        Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.11
        val partition : ('a -> bool) -> 'a list -> 'a list * 'a list

        partition f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

        val partition_map : ('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

        partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

        • if f x is Left y1, then y1 is in l1, and
        • if f x is Right y2, then y2 is in l2.

        The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

        In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

        • since 4.12

        Association lists

        val assoc : 'a -> ('a * 'b) list -> 'b

        assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

        • raises Not_found

          if there is no value associated with a in the list l.

        val assoc_opt : 'a -> ('a * 'b) list -> 'b option

        assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

        • since 4.05
        val assq : 'a -> ('a * 'b) list -> 'b

        Same as assoc, but uses physical equality instead of structural equality to compare keys.

        val assq_opt : 'a -> ('a * 'b) list -> 'b option

        Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

        • since 4.05
        val mem_assoc : 'a -> ('a * 'b) list -> bool

        Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

        val mem_assq : 'a -> ('a * 'b) list -> bool

        Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

        val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

        remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

        val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

        Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

        Lists of pairs

        val split : ('a * 'b) list -> 'a list * 'b list

        Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

        val combine : 'a list -> 'b list -> ('a * 'b) list

        Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

        • raises Invalid_argument

          if the two lists have different lengths. Not tail-recursive.

        Sorting

        val sort : ('a -> 'a -> int) -> 'a list -> 'a list

        Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort or stable_sort, whichever is faster on typical input.

        val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but also remove duplicates.

        • since 4.02 (4.03 in ListLabels)
        val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

        Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

        Lists and Sequences

        val to_seq : 'a list -> 'a Seq.t

        Iterate on the list.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a list

        Create a list from a sequence.

        • since 4.07
        + 'acc

        fold_right2 f [a1; ...; an] [b1; ...; bn] init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

        • raises Invalid_argument

          if the two lists are determined to have different lengths. Not tail-recursive.

        List scanning

        val for_all : ('a -> bool) -> 'a list -> bool

        for_all f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

        val exists : ('a -> bool) -> 'a list -> bool

        exists f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

        val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as for_all, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as exists, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val mem : 'a -> 'a list -> bool

        mem a set is true if and only if a is equal to an element of set.

        val memq : 'a -> 'a list -> bool

        Same as mem, but uses physical equality instead of structural equality to compare list elements.

        List searching

        val find : ('a -> bool) -> 'a list -> 'a

        find f l returns the first element of the list l that satisfies the predicate f.

        • raises Not_found

          if there is no value that satisfies f in the list l.

        val find_opt : ('a -> bool) -> 'a list -> 'a option

        find f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

        • since 4.05
        val find_index : ('a -> bool) -> 'a list -> int option

        find_index f xs returns Some i, where i is the index of the first element of the list xs that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : ('a -> 'b option) -> 'a list -> 'b option

        find_map f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.10
        val find_mapi : (int -> 'a -> 'b option) -> 'a list -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1
        val filter : ('a -> bool) -> 'a list -> 'a list

        filter f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

        val find_all : ('a -> bool) -> 'a list -> 'a list

        find_all is another name for filter.

        val filteri : (int -> 'a -> bool) -> 'a list -> 'a list

        Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.11

        List manipulation

        val take : int -> 'a list -> 'a list

        take n l returns the prefix of l of length n, or a copy of l if n > length l.

        n must be nonnegative.

        • since 5.3
        val drop : int -> 'a list -> 'a list

        drop n l returns the suffix of l after n elements, or [] if n > length l.

        n must be nonnegative.

        • since 5.3
        val take_while : ('a -> bool) -> 'a list -> 'a list

        take_while p l is the longest (possibly empty) prefix of l containing only elements that satisfy p.

        • since 5.3
        val drop_while : ('a -> bool) -> 'a list -> 'a list

        drop_while p l is the longest (possibly empty) suffix of l starting at the first element that does not satisfy p.

        • since 5.3
        val partition : ('a -> bool) -> 'a list -> 'a list * 'a list

        partition f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

        val partition_map : ('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

        partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

        • if f x is Left y1, then y1 is in l1, and
        • if f x is Right y2, then y2 is in l2.

        The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

        In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

        • since 4.12

        Association lists

        val assoc : 'a -> ('a * 'b) list -> 'b

        assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

        • raises Not_found

          if there is no value associated with a in the list l.

        val assoc_opt : 'a -> ('a * 'b) list -> 'b option

        assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

        • since 4.05
        val assq : 'a -> ('a * 'b) list -> 'b

        Same as assoc, but uses physical equality instead of structural equality to compare keys.

        val assq_opt : 'a -> ('a * 'b) list -> 'b option

        Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

        • since 4.05
        val mem_assoc : 'a -> ('a * 'b) list -> bool

        Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

        val mem_assq : 'a -> ('a * 'b) list -> bool

        Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

        val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

        remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

        val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

        Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

        Lists of pairs

        val split : ('a * 'b) list -> 'a list * 'b list

        Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

        val combine : 'a list -> 'b list -> ('a * 'b) list

        Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

        • raises Invalid_argument

          if the two lists have different lengths. Not tail-recursive.

        Sorting

        val sort : ('a -> 'a -> int) -> 'a list -> 'a list

        Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort or stable_sort, whichever is faster on typical input.

        val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but also remove duplicates.

        • since 4.02 (4.03 in ListLabels)
        val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

        Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

        Lists and Sequences

        val to_seq : 'a list -> 'a Seq.t

        Iterate on the list.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a list

        Create a list from a sequence.

        • since 4.07
        diff --git a/ocaml/Stdlib/ListLabels/index.html b/ocaml/Stdlib/ListLabels/index.html index 81a51b1b..f0f2dbc4 100644 --- a/ocaml/Stdlib/ListLabels/index.html +++ b/ocaml/Stdlib/ListLabels/index.html @@ -1,5 +1,5 @@ -ListLabels (ocaml.Stdlib.ListLabels)

        Module Stdlib.ListLabels

        List operations.

        Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

        The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a list =
        1. | []
        2. | :: of 'a * 'a list

        An alias for the type of lists.

        val length : 'a list -> int

        Return the length (number of elements) of the given list.

        val compare_lengths : 'a list -> 'b list -> int

        Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

        • since 4.05
        val compare_length_with : 'a list -> len:int -> int

        Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

        • since 4.05
        val is_empty : 'a list -> bool

        is_empty l is true if and only if l has no elements. It is equivalent to compare_length_with l 0 = 0.

        • since 5.1
        val cons : 'a -> 'a list -> 'a list

        cons x xs is x :: xs

        • since 4.05
        val hd : 'a list -> 'a

        Return the first element of the given list.

        • raises Failure

          if the list is empty.

        val tl : 'a list -> 'a list

        Return the given list without its first element.

        • raises Failure

          if the list is empty.

        val nth : 'a list -> int -> 'a

        Return the n-th element of the given list. The first element (head of the list) is at position 0.

        • raises Failure

          if the list is too short.

        val nth_opt : 'a list -> int -> 'a option

        Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

        • since 4.05
        val rev : 'a list -> 'a list

        List reversal.

        val init : len:int -> f:(int -> 'a) -> 'a list

        init ~len ~f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

        • since 4.06
        val append : 'a list -> 'a list -> 'a list

        append l0 l1 appends l1 to l0. Same function as the infix operator @.

        • since 5.1 this function is tail-recursive.
        val rev_append : 'a list -> 'a list -> 'a list

        rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2.

        val concat : 'a list list -> 'a list

        Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

        val flatten : 'a list list -> 'a list

        Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

        Comparison

        val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool

        equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

        Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

        • since 4.12
        val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int

        compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

        • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
        • the empty list [] is strictly smaller than non-empty lists

        Note: the cmp function will be called even if the lists have different lengths.

        • since 4.12

        Iterators

        val iter : f:('a -> unit) -> 'a list -> unit

        iter ~f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

        val iteri : f:(int -> 'a -> unit) -> 'a list -> unit

        Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val map : f:('a -> 'b) -> 'a list -> 'b list

        map ~f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f.

        val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list

        Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val rev_map : f:('a -> 'b) -> 'a list -> 'b list

        rev_map ~f l gives the same result as rev (map f l), but is more efficient.

        val filter_map : f:('a -> 'b option) -> 'a list -> 'b list

        filter_map ~f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

        • since 4.08
        val concat_map : f:('a -> 'b list) -> 'a list -> 'b list

        concat_map ~f l gives the same result as concat (map f l). Tail-recursive.

        • since 4.10
        val fold_left_map : +ListLabels (ocaml.Stdlib.ListLabels)

        Module Stdlib.ListLabels

        List operations.

        Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

        The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

        The labeled version of this module can be used as described in the StdLabels module.

        type 'a t = 'a list =
        1. | []
        2. | :: of 'a * 'a list

        An alias for the type of lists.

        val length : 'a list -> int

        Return the length (number of elements) of the given list.

        val compare_lengths : 'a list -> 'b list -> int

        Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

        • since 4.05
        val compare_length_with : 'a list -> len:int -> int

        Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

        • since 4.05
        val is_empty : 'a list -> bool

        is_empty l is true if and only if l has no elements. It is equivalent to compare_length_with l 0 = 0.

        • since 5.1
        val cons : 'a -> 'a list -> 'a list

        cons x xs is x :: xs

        • since 4.05
        val hd : 'a list -> 'a

        Return the first element of the given list.

        • raises Failure

          if the list is empty.

        val tl : 'a list -> 'a list

        Return the given list without its first element.

        • raises Failure

          if the list is empty.

        val nth : 'a list -> int -> 'a

        Return the n-th element of the given list. The first element (head of the list) is at position 0.

        • raises Failure

          if the list is too short.

        val nth_opt : 'a list -> int -> 'a option

        Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

        • since 4.05
        val rev : 'a list -> 'a list

        List reversal.

        val init : len:int -> f:(int -> 'a) -> 'a list

        init ~len ~f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

        • since 4.06
        val append : 'a list -> 'a list -> 'a list

        append l0 l1 appends l1 to l0. Same function as the infix operator @.

        • since 5.1 this function is tail-recursive.
        val rev_append : 'a list -> 'a list -> 'a list

        rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2.

        val concat : 'a list list -> 'a list

        Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

        val flatten : 'a list list -> 'a list

        Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

        Comparison

        val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool

        equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

        Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

        • since 4.12
        val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int

        compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

        • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
        • the empty list [] is strictly smaller than non-empty lists

        Note: the cmp function will be called even if the lists have different lengths.

        • since 4.12

        Iterators

        val iter : f:('a -> unit) -> 'a list -> unit

        iter ~f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

        val iteri : f:(int -> 'a -> unit) -> 'a list -> unit

        Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val map : f:('a -> 'b) -> 'a list -> 'b list

        map ~f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f.

        val mapi : f:(int -> 'a -> 'b) -> 'a list -> 'b list

        Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.00
        val rev_map : f:('a -> 'b) -> 'a list -> 'b list

        rev_map ~f l gives the same result as rev (map f l), but is more efficient.

        val filter_map : f:('a -> 'b option) -> 'a list -> 'b list

        filter_map ~f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

        • since 4.08
        val concat_map : f:('a -> 'b list) -> 'a list -> 'b list

        concat_map ~f l gives the same result as concat (map f l). Tail-recursive.

        • since 4.10
        val fold_left_map : f:('acc -> 'a -> 'acc * 'b) -> init:'acc -> 'a list -> @@ -13,4 +13,4 @@ 'a list -> 'b list -> init:'acc -> - 'acc

        fold_right2 ~f [a1; ...; an] [b1; ...; bn] ~init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

        • raises Invalid_argument

          if the two lists are determined to have different lengths. Not tail-recursive.

        List scanning

        val for_all : f:('a -> bool) -> 'a list -> bool

        for_all ~f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

        val exists : f:('a -> bool) -> 'a list -> bool

        exists ~f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

        val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as for_all, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as exists, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val mem : 'a -> set:'a list -> bool

        mem a ~set is true if and only if a is equal to an element of set.

        val memq : 'a -> set:'a list -> bool

        Same as mem, but uses physical equality instead of structural equality to compare list elements.

        List searching

        val find : f:('a -> bool) -> 'a list -> 'a

        find ~f l returns the first element of the list l that satisfies the predicate f.

        • raises Not_found

          if there is no value that satisfies f in the list l.

        val find_opt : f:('a -> bool) -> 'a list -> 'a option

        find ~f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

        • since 4.05
        val find_index : f:('a -> bool) -> 'a list -> int option

        find_index ~f xs returns Some i, where i is the index of the first element of the list xs that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : f:('a -> 'b option) -> 'a list -> 'b option

        find_map ~f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.10
        val find_mapi : f:(int -> 'a -> 'b option) -> 'a list -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1
        val filter : f:('a -> bool) -> 'a list -> 'a list

        filter ~f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

        val find_all : f:('a -> bool) -> 'a list -> 'a list

        find_all is another name for filter.

        val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list

        Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.11
        val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list

        partition ~f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

        val partition_map : f:('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

        partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

        • if f x is Left y1, then y1 is in l1, and
        • if f x is Right y2, then y2 is in l2.

        The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

        In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

        • since 4.12

        Association lists

        val assoc : 'a -> ('a * 'b) list -> 'b

        assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

        • raises Not_found

          if there is no value associated with a in the list l.

        val assoc_opt : 'a -> ('a * 'b) list -> 'b option

        assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

        • since 4.05
        val assq : 'a -> ('a * 'b) list -> 'b

        Same as assoc, but uses physical equality instead of structural equality to compare keys.

        val assq_opt : 'a -> ('a * 'b) list -> 'b option

        Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

        • since 4.05
        val mem_assoc : 'a -> map:('a * 'b) list -> bool

        Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

        val mem_assq : 'a -> map:('a * 'b) list -> bool

        Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

        val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

        remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

        val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

        Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

        Lists of pairs

        val split : ('a * 'b) list -> 'a list * 'b list

        Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

        val combine : 'a list -> 'b list -> ('a * 'b) list

        Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

        • raises Invalid_argument

          if the two lists have different lengths. Not tail-recursive.

        Sorting

        val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort or stable_sort, whichever is faster on typical input.

        val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but also remove duplicates.

        • since 4.03
        val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

        Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge ~cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

        Lists and Sequences

        val to_seq : 'a list -> 'a Seq.t

        Iterate on the list.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a list

        Create a list from a sequence.

        • since 4.07
        + 'acc

        fold_right2 ~f [a1; ...; an] [b1; ...; bn] ~init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

        • raises Invalid_argument

          if the two lists are determined to have different lengths. Not tail-recursive.

        List scanning

        val for_all : f:('a -> bool) -> 'a list -> bool

        for_all ~f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

        val exists : f:('a -> bool) -> 'a list -> bool

        exists ~f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

        val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as for_all, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool

        Same as exists, but for a two-argument predicate.

        • raises Invalid_argument

          if the two lists are determined to have different lengths.

        val mem : 'a -> set:'a list -> bool

        mem a ~set is true if and only if a is equal to an element of set.

        val memq : 'a -> set:'a list -> bool

        Same as mem, but uses physical equality instead of structural equality to compare list elements.

        List searching

        val find : f:('a -> bool) -> 'a list -> 'a

        find ~f l returns the first element of the list l that satisfies the predicate f.

        • raises Not_found

          if there is no value that satisfies f in the list l.

        val find_opt : f:('a -> bool) -> 'a list -> 'a option

        find ~f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

        • since 4.05
        val find_index : f:('a -> bool) -> 'a list -> int option

        find_index ~f xs returns Some i, where i is the index of the first element of the list xs that satisfies f x, if there is such an element.

        It returns None if there is no such element.

        • since 5.1
        val find_map : f:('a -> 'b option) -> 'a list -> 'b option

        find_map ~f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

        • since 4.10
        val find_mapi : f:(int -> 'a -> 'b option) -> 'a list -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 5.1
        val filter : f:('a -> bool) -> 'a list -> 'a list

        filter ~f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

        val find_all : f:('a -> bool) -> 'a list -> 'a list

        find_all is another name for filter.

        val filteri : f:(int -> 'a -> bool) -> 'a list -> 'a list

        Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        • since 4.11

        List manipulation

        val take : int -> 'a list -> 'a list

        take n l returns the prefix of l of length n, or a copy of l if n > length l.

        n must be nonnegative.

        • since 5.3
        val drop : int -> 'a list -> 'a list

        drop n l returns the suffix of l after n elements, or [] if n > length l.

        n must be nonnegative.

        • since 5.3
        val take_while : f:('a -> bool) -> 'a list -> 'a list

        take_while p l is the longest (possibly empty) prefix of l containing only elements that satisfy p.

        • since 5.3
        val drop_while : f:('a -> bool) -> 'a list -> 'a list

        drop_while p l is the longest (possibly empty) suffix of l starting at the first element that does not satisfy p.

        • since 5.3
        val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list

        partition ~f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

        val partition_map : f:('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

        partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

        • if f x is Left y1, then y1 is in l1, and
        • if f x is Right y2, then y2 is in l2.

        The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

        In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

        • since 4.12

        Association lists

        val assoc : 'a -> ('a * 'b) list -> 'b

        assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

        • raises Not_found

          if there is no value associated with a in the list l.

        val assoc_opt : 'a -> ('a * 'b) list -> 'b option

        assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

        • since 4.05
        val assq : 'a -> ('a * 'b) list -> 'b

        Same as assoc, but uses physical equality instead of structural equality to compare keys.

        val assq_opt : 'a -> ('a * 'b) list -> 'b option

        Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

        • since 4.05
        val mem_assoc : 'a -> map:('a * 'b) list -> bool

        Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

        val mem_assq : 'a -> map:('a * 'b) list -> bool

        Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

        val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

        remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

        val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

        Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

        Lists of pairs

        val split : ('a * 'b) list -> 'a list * 'b list

        Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

        val combine : 'a list -> 'b list -> ('a * 'b) list

        Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

        • raises Invalid_argument

          if the two lists have different lengths. Not tail-recursive.

        Sorting

        val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

        The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

        val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort or stable_sort, whichever is faster on typical input.

        val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list

        Same as sort, but also remove duplicates.

        • since 4.03
        val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

        Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge ~cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

        Lists and Sequences

        val to_seq : 'a list -> 'a Seq.t

        Iterate on the list.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a list

        Create a list from a sequence.

        • since 4.07
        diff --git a/ocaml/Stdlib/Marshal/index.html b/ocaml/Stdlib/Marshal/index.html index 69bba603..dfdd3a53 100644 --- a/ocaml/Stdlib/Marshal/index.html +++ b/ocaml/Stdlib/Marshal/index.html @@ -1,2 +1,2 @@ -Marshal (ocaml.Stdlib.Marshal)

        Module Stdlib.Marshal

        Marshaling of data structures.

        This module provides functions to encode arbitrary data structures as sequences of bytes, which can then be written on a file or sent over a pipe or network connection. The bytes can then be read back later, possibly in another process, and decoded back into a data structure. The format for the byte sequences is compatible across all machines for a given version of OCaml.

        Warning: marshaling is currently not type-safe. The type of marshaled data is not transmitted along the value of the data, making it impossible to check that the data read back possesses the type expected by the context. In particular, the result type of the Marshal.from_* functions is given as 'a, but this is misleading: the returned OCaml value does not possess type 'a for all 'a; it has one, unique type which cannot be determined at compile-time. The programmer should explicitly give the expected type of the returned value, using the following syntax:

        • (Marshal.from_channel chan : type). Anything can happen at run-time if the object in the file does not belong to the given type.

        Values of extensible variant types, for example exceptions (of extensible type exn), returned by the unmarshaller should not be pattern-matched over through match ... with or try ... with, because unmarshalling does not preserve the information required for matching their constructors. Structural equalities with other extensible variant values does not work either. Most other uses such as Printexc.to_string, will still work as expected.

        The representation of marshaled values is not human-readable, and uses bytes that are not printable characters. Therefore, input and output channels used in conjunction with Marshal.to_channel and Marshal.from_channel must be opened in binary mode, using e.g. open_out_bin or open_in_bin; channels opened in text mode will cause unmarshaling errors on platforms where text channels behave differently than binary channels, e.g. Windows.

        type extern_flags =
        1. | No_sharing
          (*

          Don't preserve sharing

          *)
        2. | Closures
          (*

          Send function closures

          *)
        3. | Compat_32
          (*

          Ensure 32-bit compatibility

          *)

        The flags to the Marshal.to_* functions below.

        val to_channel : out_channel -> 'a -> extern_flags list -> unit

        Marshal.to_channel chan v flags writes the representation of v on channel chan. The flags argument is a possibly empty list of flags that governs the marshaling behavior with respect to sharing, functional values, and compatibility between 32- and 64-bit platforms.

        If flags does not contain Marshal.No_sharing, circularities and sharing inside the value v are detected and preserved in the sequence of bytes produced. In particular, this guarantees that marshaling always terminates. Sharing between values marshaled by successive calls to Marshal.to_channel is neither detected nor preserved, though. If flags contains Marshal.No_sharing, sharing is ignored. This results in faster marshaling if v contains no shared substructures, but may cause slower marshaling and larger byte representations if v actually contains sharing, or even non-termination if v contains cycles.

        If flags does not contain Marshal.Closures, marshaling fails when it encounters a functional value inside v: only 'pure' data structures, containing neither functions nor objects, can safely be transmitted between different programs. If flags contains Marshal.Closures, functional values will be marshaled as a the position in the code of the program together with the values corresponding to the free variables captured in the closure. In this case, the output of marshaling can only be read back in processes that run exactly the same program, with exactly the same compiled code. (This is checked at un-marshaling time, using an MD5 digest of the code transmitted along with the code position.)

        The exact definition of which free variables are captured in a closure is not specified and can vary between bytecode and native code (and according to optimization flags). In particular, a function value accessing a global reference may or may not include the reference in its closure. If it does, unmarshaling the corresponding closure will create a new reference, different from the global one.

        If flags contains Marshal.Compat_32, marshaling fails when it encounters an integer value outside the range [-2{^30}, 2{^30}-1] of integers that are representable on a 32-bit platform. This ensures that marshaled data generated on a 64-bit platform can be safely read back on a 32-bit platform. If flags does not contain Marshal.Compat_32, integer values outside the range [-2{^30}, 2{^30}-1] are marshaled, and can be read back on a 64-bit platform, but will cause an error at un-marshaling time when read back on a 32-bit platform. The Mashal.Compat_32 flag only matters when marshaling is performed on a 64-bit platform; it has no effect if marshaling is performed on a 32-bit platform.

        • raises Failure

          if chan is not in binary mode.

        val to_bytes : 'a -> extern_flags list -> bytes

        Marshal.to_bytes v flags returns a byte sequence containing the representation of v. The flags argument has the same meaning as for Marshal.to_channel.

        • since 4.02
        val to_string : 'a -> extern_flags list -> string

        Same as to_bytes but return the result as a string instead of a byte sequence.

        val to_buffer : bytes -> int -> int -> 'a -> extern_flags list -> int

        Marshal.to_buffer buff ofs len v flags marshals the value v, storing its byte representation in the sequence buff, starting at index ofs, and writing at most len bytes. It returns the number of bytes actually written to the sequence. If the byte representation of v does not fit in len characters, the exception Failure is raised.

        val from_channel : in_channel -> 'a

        Marshal.from_channel chan reads from channel chan the byte representation of a structured value, as produced by one of the Marshal.to_* functions, and reconstructs and returns the corresponding value.

        • raises End_of_file

          if chan is already at the end of the file.

        • raises Failure

          if the end of the file is reached during unmarshalling itself or if chan is not in binary mode.

        val from_bytes : bytes -> int -> 'a

        Marshal.from_bytes buff ofs unmarshals a structured value like Marshal.from_channel does, except that the byte representation is not read from a channel, but taken from the byte sequence buff, starting at position ofs. The byte sequence is not mutated.

        • since 4.02
        val from_string : string -> int -> 'a

        Same as from_bytes but take a string as argument instead of a byte sequence.

        val header_size : int

        The bytes representing a marshaled value are composed of a fixed-size header and a variable-sized data part, whose size can be determined from the header. Marshal.header_size is the size, in bytes, of the header. Marshal.data_size buff ofs is the size, in bytes, of the data part, assuming a valid header is stored in buff starting at position ofs. Finally, Marshal.total_size buff ofs is the total size, in bytes, of the marshaled value. Both Marshal.data_size and Marshal.total_size raise Failure if buff, ofs does not contain a valid header.

        To read the byte representation of a marshaled value into a byte sequence, the program needs to read first Marshal.header_size bytes into the sequence, then determine the length of the remainder of the representation using Marshal.data_size, make sure the sequence is large enough to hold the remaining data, then read it, and finally call Marshal.from_bytes to unmarshal the value.

        val data_size : bytes -> int -> int
        val total_size : bytes -> int -> int
        +Marshal (ocaml.Stdlib.Marshal)

        Module Stdlib.Marshal

        Marshaling of data structures.

        This module provides functions to encode arbitrary data structures as sequences of bytes, which can then be written on a file or sent over a pipe or network connection. The bytes can then be read back later, possibly in another process, and decoded back into a data structure. The format for the byte sequences is compatible across all machines for a given version of OCaml.

        Warning: marshaling is currently not type-safe. The type of marshaled data is not transmitted along the value of the data, making it impossible to check that the data read back possesses the type expected by the context. In particular, the result type of the Marshal.from_* functions is given as 'a, but this is misleading: the returned OCaml value does not possess type 'a for all 'a; it has one, unique type which cannot be determined at compile-time. The programmer should explicitly give the expected type of the returned value, using the following syntax:

        • (Marshal.from_channel chan : type). Anything can happen at run-time if the object in the file does not belong to the given type.

        Values of extensible variant types, for example exceptions (of extensible type exn), returned by the unmarshaller should not be pattern-matched over through match ... with or try ... with, because unmarshalling does not preserve the information required for matching their constructors. Structural equalities with other extensible variant values does not work either. Most other uses such as Printexc.to_string, will still work as expected.

        The representation of marshaled values is not human-readable, and uses bytes that are not printable characters. Therefore, input and output channels used in conjunction with Marshal.to_channel and Marshal.from_channel must be opened in binary mode, using e.g. open_out_bin or open_in_bin; channels opened in text mode will cause unmarshaling errors on platforms where text channels behave differently than binary channels, e.g. Windows.

        type extern_flags =
        1. | No_sharing
          (*

          Don't preserve sharing

          *)
        2. | Closures
          (*

          Send function closures

          *)
        3. | Compat_32
          (*

          Ensure 32-bit compatibility

          *)

        The flags to the Marshal.to_* functions below.

        val to_channel : out_channel -> 'a -> extern_flags list -> unit

        Marshal.to_channel chan v flags writes the representation of v on channel chan. The flags argument is a possibly empty list of flags that governs the marshaling behavior with respect to sharing, functional values, and compatibility between 32- and 64-bit platforms.

        If flags does not contain Marshal.No_sharing, circularities and sharing inside the value v are detected and preserved in the sequence of bytes produced. In particular, this guarantees that marshaling always terminates. Sharing between values marshaled by successive calls to Marshal.to_channel is neither detected nor preserved, though. If flags contains Marshal.No_sharing, sharing is ignored. This results in faster marshaling if v contains no shared substructures, but may cause slower marshaling and larger byte representations if v actually contains sharing, or even non-termination if v contains cycles.

        If flags does not contain Marshal.Closures, marshaling fails when it encounters a functional value inside v: only 'pure' data structures, containing neither functions nor objects, can safely be transmitted between different programs. If flags contains Marshal.Closures, functional values will be marshaled as a the position in the code of the program together with the values corresponding to the free variables captured in the closure. In this case, the output of marshaling can only be read back in processes that run exactly the same program, with exactly the same compiled code. (This is checked at un-marshaling time, using an MD5 digest of the code transmitted along with the code position.)

        The exact definition of which free variables are captured in a closure is not specified and can vary between bytecode and native code (and according to optimization flags). In particular, a function value accessing a global reference may or may not include the reference in its closure. If it does, unmarshaling the corresponding closure will create a new reference, different from the global one.

        If flags contains Marshal.Compat_32, marshaling fails when it encounters an integer value outside the range -230, 230-1 of integers that are representable on a 32-bit platform. This ensures that marshaled data generated on a 64-bit platform can be safely read back on a 32-bit platform. If flags does not contain Marshal.Compat_32, integer values outside the range -230, 230-1 are marshaled, and can be read back on a 64-bit platform, but will cause an error at un-marshaling time when read back on a 32-bit platform. The Mashal.Compat_32 flag only matters when marshaling is performed on a 64-bit platform; it has no effect if marshaling is performed on a 32-bit platform.

        • raises Failure

          if chan is not in binary mode.

        val to_bytes : 'a -> extern_flags list -> bytes

        Marshal.to_bytes v flags returns a byte sequence containing the representation of v. The flags argument has the same meaning as for Marshal.to_channel.

        • since 4.02
        val to_string : 'a -> extern_flags list -> string

        Same as to_bytes but return the result as a string instead of a byte sequence.

        val to_buffer : bytes -> int -> int -> 'a -> extern_flags list -> int

        Marshal.to_buffer buff ofs len v flags marshals the value v, storing its byte representation in the sequence buff, starting at index ofs, and writing at most len bytes. It returns the number of bytes actually written to the sequence. If the byte representation of v does not fit in len characters, the exception Failure is raised.

        val from_channel : in_channel -> 'a

        Marshal.from_channel chan reads from channel chan the byte representation of a structured value, as produced by one of the Marshal.to_* functions, and reconstructs and returns the corresponding value.

        • raises End_of_file

          if chan is already at the end of the file.

        • raises Failure

          if the end of the file is reached during unmarshalling itself or if chan is not in binary mode.

        val from_bytes : bytes -> int -> 'a

        Marshal.from_bytes buff ofs unmarshals a structured value like Marshal.from_channel does, except that the byte representation is not read from a channel, but taken from the byte sequence buff, starting at position ofs. The byte sequence is not mutated.

        • since 4.02
        val from_string : string -> int -> 'a

        Same as from_bytes but take a string as argument instead of a byte sequence.

        val header_size : int

        The bytes representing a marshaled value are composed of a fixed-size header and a variable-sized data part, whose size can be determined from the header. Marshal.header_size is the size, in bytes, of the header. Marshal.data_size buff ofs is the size, in bytes, of the data part, assuming a valid header is stored in buff starting at position ofs. Finally, Marshal.total_size buff ofs is the total size, in bytes, of the marshaled value. Both Marshal.data_size and Marshal.total_size raise Failure if buff, ofs does not contain a valid header.

        To read the byte representation of a marshaled value into a byte sequence, the program needs to read first Marshal.header_size bytes into the sequence, then determine the length of the remainder of the representation using Marshal.data_size, make sure the sequence is large enough to hold the remaining data, then read it, and finally call Marshal.from_bytes to unmarshal the value.

        val data_size : bytes -> int -> int
        val total_size : bytes -> int -> int

        Marshal and domain safety

        Care must be taken when marshaling a mutable value that may be modified by a different domain. Mutating a value that is being marshaled (i.e., turned into a sequence of bytes) is a programming error and might result in surprising values (when unmarshaling) due to tearing, since marshaling involves byte-per-byte copy.

        diff --git a/ocaml/Stdlib/MoreLabels/Hashtbl/index.html b/ocaml/Stdlib/MoreLabels/Hashtbl/index.html index fd13c6ce..bd1100d8 100644 --- a/ocaml/Stdlib/MoreLabels/Hashtbl/index.html +++ b/ocaml/Stdlib/MoreLabels/Hashtbl/index.html @@ -1,5 +1,5 @@ -Hashtbl (ocaml.Stdlib.MoreLabels.Hashtbl)

        Module MoreLabels.Hashtbl

        Hash tables and hash functions.

        Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see find, find_opt) is normally very fast, often faster than the equivalent lookup in Map.

        The functors Make and MakeSeeded can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key.

        Warning a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup.

        The polymorphic t hash table is useful in simpler cases or in interactive environments. It uses the polymorphic hash function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality (=).

        See the examples section.

        Unsynchronized accesses

        Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

        Generic interface

        type (!'a, !'b) t = ('a, 'b) Hashtbl.t

        The type of hash tables from type 'a to type 'b.

        val create : ?random:bool -> int -> ('a, 'b) t

        Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

        The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

        A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

        A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

        If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

        • before 4.00

          the ~random parameter was not present and all hash tables were created in non-randomized mode.

        val clear : ('a, 'b) t -> unit

        Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

        val reset : ('a, 'b) t -> unit

        Empty a hash table and shrink the size of the bucket table to its initial size.

        • since 4.00
        val copy : ('a, 'b) t -> ('a, 'b) t

        Return a copy of the given hashtable.

        val add : ('a, 'b) t -> key:'a -> data:'b -> unit

        Hashtbl.add tbl ~key ~data adds a binding of key to data in table tbl.

        Warning: Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

        If you desire the classic behavior of replacing elements, see replace.

        val find : ('a, 'b) t -> 'a -> 'b

        Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

        val find_opt : ('a, 'b) t -> 'a -> 'b option

        Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

        • since 4.05
        val find_all : ('a, 'b) t -> 'a -> 'b list

        Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

        val mem : ('a, 'b) t -> 'a -> bool

        Hashtbl.mem tbl x checks if x is bound in tbl.

        val remove : ('a, 'b) t -> 'a -> unit

        Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

        val replace : ('a, 'b) t -> key:'a -> data:'b -> unit

        Hashtbl.replace tbl ~key ~data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

        val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit

        Hashtbl.iter ~f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

        The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

        If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

        The behavior is not specified if the hash table is modified by f during the iteration.

        val filter_map_inplace : +Hashtbl (ocaml.Stdlib.MoreLabels.Hashtbl)

        Module MoreLabels.Hashtbl

        Hash tables and hash functions.

        Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see find, find_opt) is normally very fast, often faster than the equivalent lookup in Map.

        The functors Make and MakeSeeded can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key.

        Warning a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup.

        The polymorphic t hash table is useful in simpler cases or in interactive environments. It uses the polymorphic hash function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality (=).

        See the examples section.

        Unsynchronized accesses

        Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

        Generic interface

        type (!'a, !'b) t = ('a, 'b) Hashtbl.t

        The type of hash tables from type 'a to type 'b.

        val create : ?random:bool -> int -> ('a, 'b) t

        Hashtbl.create n creates a new, empty hash table, with initial size greater or equal to the suggested size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess. If n is very small or negative then it is disregarded and a small default size is used.

        The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

        A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

        A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

        If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

        • before 4.00

          the ~random parameter was not present and all hash tables were created in non-randomized mode.

        val clear : ('a, 'b) t -> unit

        Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

        val reset : ('a, 'b) t -> unit

        Empty a hash table and shrink the size of the bucket table to its initial size.

        • since 4.00
        val copy : ('a, 'b) t -> ('a, 'b) t

        Return a copy of the given hashtable.

        val add : ('a, 'b) t -> key:'a -> data:'b -> unit

        Hashtbl.add tbl ~key ~data adds a binding of key to data in table tbl.

        Warning: Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

        If you desire the classic behavior of replacing elements, see replace.

        val find : ('a, 'b) t -> 'a -> 'b

        Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

        val find_opt : ('a, 'b) t -> 'a -> 'b option

        Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

        • since 4.05
        val find_all : ('a, 'b) t -> 'a -> 'b list

        Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

        val mem : ('a, 'b) t -> 'a -> bool

        Hashtbl.mem tbl x checks if x is bound in tbl.

        val remove : ('a, 'b) t -> 'a -> unit

        Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

        val replace : ('a, 'b) t -> key:'a -> data:'b -> unit

        Hashtbl.replace tbl ~key ~data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

        val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit

        Hashtbl.iter ~f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

        The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

        If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

        The behavior is not specified if the hash table is modified by f during the iteration.

        val filter_map_inplace : f:(key:'a -> data:'b -> 'b option) -> ('a, 'b) t -> unit

        Hashtbl.filter_map_inplace ~f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

        Other comments for iter apply as well.

        • since 4.03
        val fold : diff --git a/ocaml/Stdlib/Obj/Closure/index.html b/ocaml/Stdlib/Obj/Closure/index.html deleted file mode 100644 index e678e791..00000000 --- a/ocaml/Stdlib/Obj/Closure/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Closure (ocaml.Stdlib.Obj.Closure)

        Module Obj.Closure

        type info = {
        1. arity : int;
        2. start_env : int;
        }
        val info : t -> info
        diff --git a/ocaml/Stdlib/Obj/index.html b/ocaml/Stdlib/Obj/index.html index a7285fd8..3a6e6e19 100644 --- a/ocaml/Stdlib/Obj/index.html +++ b/ocaml/Stdlib/Obj/index.html @@ -1,2 +1,2 @@ -Obj (ocaml.Stdlib.Obj)

        Module Stdlib.Obj

        Operations on internal representations of values.

        Not for the casual user.

        type t
        type raw_data = nativeint
        val repr : 'a -> t
        val obj : t -> 'a
        val magic : 'a -> 'b
        val is_block : t -> bool
        val is_int : t -> bool
        val tag : t -> int
        val size : t -> int
        val reachable_words : t -> int

        Computes the total size (in words, including the headers) of all heap blocks accessible from the argument. Statically allocated blocks are included.

        • since 4.04
        val field : t -> int -> t
        val set_field : t -> int -> t -> unit

        When using flambda:

        set_field MUST NOT be called on immutable blocks. (Blocks allocated in C stubs, or with new_block below, are always considered mutable.)

        The same goes for set_double_field.

        For experts only: set_field et al can be made safe by first wrapping the block in Sys.opaque_identity, so any information about its contents will not be propagated.

        val double_field : t -> int -> float
        val set_double_field : t -> int -> float -> unit
        val raw_field : t -> int -> raw_data
        val set_raw_field : t -> int -> raw_data -> unit
        val new_block : int -> int -> t
        val dup : t -> t
        val add_offset : t -> Int32.t -> t
        val with_tag : int -> t -> t
        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 Closure : sig ... end
        module Extension_constructor : sig ... end
        module Ephemeron : sig ... end

        Ephemeron with arbitrary arity and untyped

        +Obj (ocaml.Stdlib.Obj)

        Module Stdlib.Obj

        Operations on internal representations of values.

        Not for the casual user.

        type t
        type raw_data = nativeint
        val repr : 'a -> t
        val obj : t -> 'a
        val magic : 'a -> 'b
        val is_block : t -> bool
        val is_int : t -> bool
        val tag : t -> int
        val size : t -> int
        val reachable_words : t -> int

        Computes the total size (in words, including the headers) of all heap blocks accessible from the argument. Statically allocated blocks are included.

        • since 4.04
        val field : t -> int -> t
        val set_field : t -> int -> t -> unit

        When using flambda:

        set_field MUST NOT be called on immutable blocks. (Blocks allocated in C stubs, or with new_block below, are always considered mutable.)

        The same goes for set_double_field.

        For experts only: set_field et al can be made safe by first wrapping the block in Sys.opaque_identity, so any information about its contents will not be propagated.

        val double_field : t -> int -> float
        val set_double_field : t -> int -> float -> unit
        val raw_field : t -> int -> raw_data
        val set_raw_field : t -> int -> raw_data -> unit
        val new_block : int -> int -> t
        val dup : t -> t
        val add_offset : t -> Int32.t -> t
        val with_tag : int -> t -> t
        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 ... end
        module Ephemeron : sig ... end

        Ephemeron with arbitrary arity and untyped

        diff --git a/ocaml/Stdlib/Out_channel/index.html b/ocaml/Stdlib/Out_channel/index.html index 1806eb17..818db3bc 100644 --- a/ocaml/Stdlib/Out_channel/index.html +++ b/ocaml/Stdlib/Out_channel/index.html @@ -1,5 +1,10 @@ Out_channel (ocaml.Stdlib.Out_channel)

        Module Stdlib.Out_channel

        Output channels.

        This module provides functions for working with output channels.

        See the example section below.

        • since 4.14

        Channels

        type t = out_channel

        The type of output channel.

        type open_flag = open_flag =
        1. | Open_rdonly
          (*

          open for reading.

          *)
        2. | Open_wronly
          (*

          open for writing.

          *)
        3. | Open_append
          (*

          open for appending: always write at end of file.

          *)
        4. | Open_creat
          (*

          create the file if it does not exist.

          *)
        5. | Open_trunc
          (*

          empty the file if it already exists.

          *)
        6. | Open_excl
          (*

          fail if Open_creat and the file already exists.

          *)
        7. | Open_binary
          (*

          open in binary mode (no conversion).

          *)
        8. | Open_text
          (*

          open in text mode (may perform conversions).

          *)
        9. | Open_nonblock
          (*

          open in non-blocking mode.

          *)

        Opening modes for open_gen.

        val stdout : t

        The standard output for the process.

        val stderr : t

        The standard error output for the process.

        val open_bin : string -> t

        Open the named file for writing, and return a new output channel on that file, positioned at the beginning of the file. The file is truncated to zero length if it already exists. It is created if it does not already exists.

        val open_text : string -> t

        Same as open_bin, but the file is opened in text mode, so that newline translation takes place during writes. On operating systems that do not distinguish between text mode and binary mode, this function behaves like open_bin.

        val open_gen : open_flag list -> int -> string -> t

        open_gen mode perm filename opens the named file for writing, as described above. The extra argument mode specifies the opening mode. The extra argument perm specifies the file permissions, in case the file must be created. open_text and open_bin are special cases of this function.

        val with_open_bin : string -> (t -> 'a) -> 'a

        with_open_bin fn f opens a channel oc on file fn and returns f - oc. After f returns, either with a value or by raising an exception, oc is guaranteed to be closed.

        val with_open_text : string -> (t -> 'a) -> 'a

        Like with_open_bin, but the channel is opened in text mode (see open_text).

        val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

        Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

        val close : t -> unit

        Close the given channel, flushing all buffered write operations. Output functions raise a Sys_error exception when they are applied to a closed output channel, except close and flush, which do nothing when applied to an already closed channel. Note that close may raise Sys_error if the operating system signals an error when flushing or closing.

        val close_noerr : t -> unit

        Same as close, but ignore all errors.

        Output

        val output_char : t -> char -> unit

        Write the character on the given output channel.

        val output_byte : t -> int -> unit

        Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.

        val output_string : t -> string -> unit

        Write the string on the given output channel.

        val output_bytes : t -> bytes -> unit

        Write the byte sequence on the given output channel.

        Advanced output

        val output : t -> bytes -> int -> int -> unit

        output oc buf pos len writes len characters from byte sequence buf, starting at offset pos, to the given output channel oc.

        val output_substring : t -> string -> int -> int -> unit

        Same as output but take a string as argument instead of a byte sequence.

        Flushing

        val flush : t -> unit

        Flush the buffer associated with the given output channel, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.

        val flush_all : unit -> unit

        Flush all open output channels; ignore errors.

        Seeking

        val seek : t -> int64 -> unit

        seek chan pos sets the current writing position to pos for channel chan. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.

        val pos : t -> int64

        Return the current writing position for the given channel. Does not work on channels opened with the Open_append flag (returns unspecified results).

        For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

        Attributes

        val length : t -> int64

        Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless.

        val set_binary_mode : t -> bool -> unit

        set_binary_mode oc true sets the channel oc to binary mode: no translations take place during output.

        set_binary_mode oc false sets the channel oc to text mode: depending on the operating system, some translations may take place during output. For instance, under Windows, end-of-lines will be translated from \n to \r\n.

        This function has no effect under operating systems that do not distinguish between text mode and binary mode.

        val set_buffered : t -> bool -> unit

        set_buffered oc true sets the channel oc to buffered mode. In this mode, data output on oc will be buffered until either the internal buffer is full or the function flush or flush_all is called, at which point it will be sent to the output device.

        set_buffered oc false sets the channel oc to unbuffered mode. In this mode, data output on oc will be sent to the output device immediately.

        All channels are open in buffered mode by default.

        val is_buffered : t -> bool

        is_buffered oc returns whether the channel oc is buffered (see set_buffered).

        val isatty : t -> bool

        isatty oc is true if oc refers to a terminal or console window, false otherwise.

        • since 5.1

        Examples

        Writing the contents of a file:

        let write_file file s =
        +    oc. After f returns, either with a value or by raising an exception, oc is guaranteed to be closed.

        val with_open_text : string -> (t -> 'a) -> 'a

        Like with_open_bin, but the channel is opened in text mode (see open_text).

        val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

        Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

        val close : t -> unit

        Close the given channel, flushing all buffered write operations. Output functions raise a Sys_error exception when they are applied to a closed output channel, except close and flush, which do nothing when applied to an already closed channel. Note that close may raise Sys_error if the operating system signals an error when flushing or closing.

        val close_noerr : t -> unit

        Same as close, but ignore all errors.

        Output

        val output_char : t -> char -> unit

        Write the character on the given output channel.

        val output_byte : t -> int -> unit

        Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.

        val output_string : t -> string -> unit

        Write the string on the given output channel.

        val output_bytes : t -> bytes -> unit

        Write the byte sequence on the given output channel.

        Advanced output

        val output : t -> bytes -> int -> int -> unit

        output oc buf pos len writes len characters from byte sequence buf, starting at offset pos, to the given output channel oc.

        val output_substring : t -> string -> int -> int -> unit

        Same as output but take a string as argument instead of a byte sequence.

        val output_bigarray : + t -> + (_, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> + int -> + int -> + unit

        Same as output but take the data from a bigarray.

        • since 5.2

        Flushing

        val flush : t -> unit

        Flush the buffer associated with the given output channel, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.

        val flush_all : unit -> unit

        Flush all open output channels; ignore errors.

        Seeking

        val seek : t -> int64 -> unit

        seek chan pos sets the current writing position to pos for channel chan. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.

        val pos : t -> int64

        Return the current writing position for the given channel. Does not work on channels opened with the Open_append flag (returns unspecified results).

        For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

        Attributes

        val length : t -> int64

        Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless.

        val set_binary_mode : t -> bool -> unit

        set_binary_mode oc true sets the channel oc to binary mode: no translations take place during output.

        set_binary_mode oc false sets the channel oc to text mode: depending on the operating system, some translations may take place during output. For instance, under Windows, end-of-lines will be translated from \n to \r\n.

        This function has no effect under operating systems that do not distinguish between text mode and binary mode.

        val is_binary_mode : t -> bool

        is_binary_mode oc returns whether the channel oc is in binary mode (see set_binary_mode).

        • since 5.2
        val set_buffered : t -> bool -> unit

        set_buffered oc true sets the channel oc to buffered mode. In this mode, data output on oc will be buffered until either the internal buffer is full or the function flush or flush_all is called, at which point it will be sent to the output device.

        set_buffered oc false sets the channel oc to unbuffered mode. In this mode, data output on oc will be sent to the output device immediately.

        All channels are open in buffered mode by default.

        val is_buffered : t -> bool

        is_buffered oc returns whether the channel oc is buffered (see set_buffered).

        val isatty : t -> bool

        isatty oc is true if oc refers to a terminal or console window, false otherwise.

        • since 5.1

        Examples

        Writing the contents of a file:

        let write_file file s =
           Out_channel.with_open_bin file
             (fun oc -> Out_channel.output_string oc s))
        diff --git a/ocaml/Stdlib/Printexc/index.html b/ocaml/Stdlib/Printexc/index.html index 147ffaed..e03cc3b2 100644 --- a/ocaml/Stdlib/Printexc/index.html +++ b/ocaml/Stdlib/Printexc/index.html @@ -1,8 +1,8 @@ Printexc (ocaml.Stdlib.Printexc)

        Module Stdlib.Printexc

        Facilities for printing exceptions and inspecting current call stack.

        type t = exn = ..

        The type of exception values.

        val to_string : exn -> string

        Printexc.to_string e returns a string representation of the exception e.

        val to_string_default : exn -> string

        Printexc.to_string_default e returns a string representation of the exception e, ignoring all registered exception printers.

        • since 4.09
        val print : ('a -> 'b) -> 'a -> 'b

        Printexc.print fn x applies fn to x and returns the result. If the evaluation of fn x raises any exception, the name of the exception is printed on standard error output, and the exception is raised again. The typical use is to catch and report exceptions that escape a function application.

        val catch : ('a -> 'b) -> 'a -> 'b

        Printexc.catch fn x is similar to Printexc.print, but aborts the program with exit code 2 after printing the uncaught exception. This function is deprecated: the runtime system is now able to print uncaught exceptions as precisely as Printexc.catch does. Moreover, calling Printexc.catch makes it harder to track the location of the exception using the debugger or the stack backtrace facility. So, do not use Printexc.catch in new code.

        • deprecated This function is no longer needed.
        val print_backtrace : out_channel -> unit

        Printexc.print_backtrace oc prints an exception backtrace on the output channel oc. The backtrace lists the program locations where the most-recently raised exception was raised and where it was propagated through function calls.

        If the call is not inside an exception handler, the returned backtrace is unspecified. If the call is after some exception-catching code (before in the handler, or in a when-guard during the matching of the exception handler), the backtrace may correspond to a later exception than the handled one.

        • since 3.11
        val get_backtrace : unit -> string

        Printexc.get_backtrace () returns a string containing the same exception backtrace that Printexc.print_backtrace would print. Same restriction usage than print_backtrace.

        • since 3.11
        val record_backtrace : bool -> unit

        Printexc.record_backtrace b turns recording of exception backtraces on (if b = true) or off (if b = false). Initially, backtraces are not recorded, unless the b flag is given to the program through the OCAMLRUNPARAM variable.

        • since 3.11
        val backtrace_status : unit -> bool

        Printexc.backtrace_status() returns true if exception backtraces are currently recorded, false if not.

        • since 3.11
        val register_printer : (exn -> string option) -> unit

        Printexc.register_printer fn registers fn as an exception printer. The printer should return None or raise an exception if it does not know how to convert the passed exception, and Some - s with s the resulting string if it can convert the passed exception. Exceptions raised by the printer are ignored.

        When converting an exception into a string, the printers will be invoked in the reverse order of their registrations, until a printer returns a Some s value (if no such printer exists, the runtime will use a generic printer).

        When using this mechanism, one should be aware that an exception backtrace is attached to the thread that saw it raised, rather than to the exception itself. Practically, it means that the code related to fn should not use the backtrace if it has itself raised an exception before.

        • since 3.11.2
        val use_printers : exn -> string option

        Printexc.use_printers e returns None if there are no registered printers and Some s with else as the resulting string otherwise.

        • since 4.09

        Raw backtraces

        type raw_backtrace

        The type raw_backtrace stores a backtrace in a low-level format, which can be converted to usable form using raw_backtrace_entries and backtrace_slots_of_raw_entry below.

        Converting backtraces to backtrace_slots is slower than capturing the backtraces. If an application processes many backtraces, it can be useful to use raw_backtrace to avoid or delay conversion.

        Raw backtraces cannot be marshalled. If you need marshalling, you should use the array returned by the backtrace_slots function of the next section.

        • since 4.01
        type raw_backtrace_entry = private int

        A raw_backtrace_entry is an element of a raw_backtrace.

        Each raw_backtrace_entry is an opaque integer, whose value is not stable between different programs, or even between different runs of the same binary.

        A raw_backtrace_entry can be converted to a usable form using backtrace_slots_of_raw_entry below. Note that, due to inlining, a single raw_backtrace_entry may convert to several backtrace_slots. Since the values of a raw_backtrace_entry are not stable, they cannot be marshalled. If they are to be converted, the conversion must be done by the process that generated them.

        Again due to inlining, there may be multiple distinct raw_backtrace_entry values that convert to equal backtrace_slots. However, if two raw_backtrace_entrys are equal as integers, then they represent the same backtrace_slots.

        • since 4.12
        val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array
        • since 4.12
        val get_raw_backtrace : unit -> raw_backtrace

        Printexc.get_raw_backtrace () returns the same exception backtrace that Printexc.print_backtrace would print, but in a raw format. Same restriction usage than print_backtrace.

        • since 4.01
        val print_raw_backtrace : out_channel -> raw_backtrace -> unit

        Print a raw backtrace in the same format Printexc.print_backtrace uses.

        • since 4.01
        val raw_backtrace_to_string : raw_backtrace -> string

        Return a string from a raw backtrace, in the same format Printexc.get_backtrace uses.

        • since 4.01
        val raise_with_backtrace : exn -> raw_backtrace -> 'a

        Reraise the exception using the given raw_backtrace for the origin of the exception

        • since 4.05

        Current call stack

        val get_callstack : int -> raw_backtrace

        Printexc.get_callstack n returns a description of the top of the call stack on the current program point (for the current thread), with at most n entries. (Note: this function is not related to exceptions at all, despite being part of the Printexc module.)

        • since 4.01

        Uncaught exceptions

        val default_uncaught_exception_handler : exn -> raw_backtrace -> unit

        Printexc.default_uncaught_exception_handler prints the exception and backtrace on standard error output.

        • since 4.11
        val set_uncaught_exception_handler : (exn -> raw_backtrace -> unit) -> unit

        Printexc.set_uncaught_exception_handler fn registers fn as the handler for uncaught exceptions. The default handler is Printexc.default_uncaught_exception_handler.

        Note that when fn is called all the functions registered with Stdlib.at_exit have already been called. Because of this you must make sure any output channel fn writes on is flushed.

        Also note that exceptions raised by user code in the interactive toplevel are not passed to this function as they are caught by the toplevel itself.

        If fn raises an exception, both the exceptions passed to fn and raised by fn will be printed with their respective backtrace.

        • since 4.02

        Manipulation of backtrace information

        These functions are used to traverse the slots of a raw backtrace and extract information from them in a programmer-friendly format.

        type backtrace_slot

        The abstract type backtrace_slot represents a single slot of a backtrace.

        • since 4.02
        val backtrace_slots : raw_backtrace -> backtrace_slot array option

        Returns the slots of a raw backtrace, or None if none of them contain useful information.

        In the return array, the slot at index 0 corresponds to the most recent function call, raise, or primitive get_backtrace call in the trace.

        Some possible reasons for returning None are as follow:

        • none of the slots in the trace come from modules compiled with debug information (-g)
        • the program is a bytecode program that has not been linked with debug information enabled (ocamlc -g)
        • since 4.02
        val backtrace_slots_of_raw_entry : + s with s the resulting string if it can convert the passed exception. Exceptions raised by the printer are ignored.

        When converting an exception into a string, the printers will be invoked in the reverse order of their registrations, until a printer returns a Some s value (if no such printer exists, the runtime will use a generic printer).

        When using this mechanism, one should be aware that an exception backtrace is attached to the thread that saw it raised, rather than to the exception itself. Practically, it means that the code related to fn should not use the backtrace if it has itself raised an exception before.

        • since 3.11.2
        val use_printers : exn -> string option

        Printexc.use_printers e returns None if there are no registered printers and Some s with s the resulting string otherwise.

        • since 4.09

        Raw backtraces

        type raw_backtrace

        The type raw_backtrace stores a backtrace in a low-level format, which can be converted to usable form using raw_backtrace_entries and backtrace_slots_of_raw_entry below.

        Converting backtraces to backtrace_slots is slower than capturing the backtraces. If an application processes many backtraces, it can be useful to use raw_backtrace to avoid or delay conversion.

        Raw backtraces cannot be marshalled. If you need marshalling, you should use the array returned by the backtrace_slots function of the next section.

        • since 4.01
        type raw_backtrace_entry = private int

        A raw_backtrace_entry is an element of a raw_backtrace.

        Each raw_backtrace_entry is an opaque integer, whose value is not stable between different programs, or even between different runs of the same binary.

        A raw_backtrace_entry can be converted to a usable form using backtrace_slots_of_raw_entry below. Note that, due to inlining, a single raw_backtrace_entry may convert to several backtrace_slots. Since the values of a raw_backtrace_entry are not stable, they cannot be marshalled. If they are to be converted, the conversion must be done by the process that generated them.

        Again due to inlining, there may be multiple distinct raw_backtrace_entry values that convert to equal backtrace_slots. However, if two raw_backtrace_entrys are equal as integers, then they represent the same backtrace_slots.

        • since 4.12
        val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array
        • since 4.12
        val get_raw_backtrace : unit -> raw_backtrace

        Printexc.get_raw_backtrace () returns the same exception backtrace that Printexc.print_backtrace would print, but in a raw format. Same restriction usage than print_backtrace.

        • since 4.01
        val print_raw_backtrace : out_channel -> raw_backtrace -> unit

        Print a raw backtrace in the same format Printexc.print_backtrace uses.

        • since 4.01
        val raw_backtrace_to_string : raw_backtrace -> string

        Return a string from a raw backtrace, in the same format Printexc.get_backtrace uses.

        • since 4.01
        val raise_with_backtrace : exn -> raw_backtrace -> 'a

        Reraise the exception using the given raw_backtrace for the origin of the exception

        • since 4.05

        Current call stack

        val get_callstack : int -> raw_backtrace

        Printexc.get_callstack n returns a description of the top of the call stack on the current program point (for the current thread), with at most n entries. (Note: this function is not related to exceptions at all, despite being part of the Printexc module.)

        • since 4.01

        Uncaught exceptions

        val default_uncaught_exception_handler : exn -> raw_backtrace -> unit

        Printexc.default_uncaught_exception_handler prints the exception and backtrace on standard error output.

        • since 4.11
        val set_uncaught_exception_handler : (exn -> raw_backtrace -> unit) -> unit

        Printexc.set_uncaught_exception_handler fn registers fn as the handler for uncaught exceptions. The default handler is Printexc.default_uncaught_exception_handler.

        Note that when fn is called all the functions registered with Stdlib.at_exit have already been called. Because of this you must make sure any output channel fn writes on is flushed.

        Also note that exceptions raised by user code in the interactive toplevel are not passed to this function as they are caught by the toplevel itself.

        If fn raises an exception, both the exceptions passed to fn and raised by fn will be printed with their respective backtrace.

        • since 4.02

        Manipulation of backtrace information

        These functions are used to traverse the slots of a raw backtrace and extract information from them in a programmer-friendly format.

        type backtrace_slot

        The abstract type backtrace_slot represents a single slot of a backtrace.

        • since 4.02
        val backtrace_slots : raw_backtrace -> backtrace_slot array option

        Returns the slots of a raw backtrace, or None if none of them contain useful information.

        In the return array, the slot at index 0 corresponds to the most recent function call, raise, or primitive get_backtrace call in the trace.

        Some possible reasons for returning None are as follow:

        • none of the slots in the trace come from modules compiled with debug information (-g)
        • the program is a bytecode program that has not been linked with debug information enabled (ocamlc -g)
        • since 4.02
        val backtrace_slots_of_raw_entry : raw_backtrace_entry -> - backtrace_slot array option

        Returns the slots of a single raw backtrace entry, or None if this entry lacks debug information.

        Slots are returned in the same order as backtrace_slots: the slot at index 0 is the most recent call, raise, or primitive, and subsequent slots represent callers.

        • since 4.12
        type location = {
        1. filename : string;
        2. line_number : int;
        3. start_char : int;
        4. end_char : int;
        }

        The type of location information found in backtraces. start_char and end_char are positions relative to the beginning of the line.

        • since 4.02
        module Slot : sig ... end

        Raw backtrace slots

        type raw_backtrace_slot

        This type is used to iterate over the slots of a raw_backtrace. For most purposes, backtrace_slots_of_raw_entry is easier to use.

        Like raw_backtrace_entry, values of this type are process-specific and must absolutely not be marshalled, and are unsafe to use for this reason (marshalling them may not fail, but un-marshalling and using the result will result in undefined behavior).

        Elements of this type can still be compared and hashed: when two elements are equal, then they represent the same source location (the converse is not necessarily true in presence of inlining, for example).

        • since 4.02
        val raw_backtrace_length : raw_backtrace -> int

        raw_backtrace_length bckt returns the number of slots in the backtrace bckt.

        • since 4.02
        val get_raw_backtrace_slot : raw_backtrace -> int -> raw_backtrace_slot

        get_raw_backtrace_slot bckt pos returns the slot in position pos in the backtrace bckt.

        • since 4.02
        val convert_raw_backtrace_slot : raw_backtrace_slot -> backtrace_slot

        Extracts the user-friendly backtrace_slot from a low-level raw_backtrace_slot.

        • since 4.02
        val get_raw_backtrace_next_slot : + backtrace_slot array option

        Returns the slots of a single raw backtrace entry, or None if this entry lacks debug information.

        Slots are returned in the same order as backtrace_slots: the slot at index 0 is the most recent call, raise, or primitive, and subsequent slots represent callers.

        • since 4.12
        type location = {
        1. filename : string;
        2. line_number : int;
        3. start_char : int;
        4. end_char : int;
        5. end_line : int;
          (*
          • since 5.2
          *)
        6. end_col : int;
          (*
          • since 5.2
          *)
        }

        The type of location information found in backtraces. start_char and end_char are positions relative to the beginning of line_number. end_col is relative to the beginning of end_line.

        • since 4.02
        module Slot : sig ... end

        Raw backtrace slots

        type raw_backtrace_slot

        This type is used to iterate over the slots of a raw_backtrace. For most purposes, backtrace_slots_of_raw_entry is easier to use.

        Like raw_backtrace_entry, values of this type are process-specific and must absolutely not be marshalled, and are unsafe to use for this reason (marshalling them may not fail, but un-marshalling and using the result will result in undefined behavior).

        Elements of this type can still be compared and hashed: when two elements are equal, then they represent the same source location (the converse is not necessarily true in presence of inlining, for example).

        • since 4.02
        val raw_backtrace_length : raw_backtrace -> int

        raw_backtrace_length bckt returns the number of slots in the backtrace bckt.

        • since 4.02
        val get_raw_backtrace_slot : raw_backtrace -> int -> raw_backtrace_slot

        get_raw_backtrace_slot bckt pos returns the slot in position pos in the backtrace bckt.

        • since 4.02
        val convert_raw_backtrace_slot : raw_backtrace_slot -> backtrace_slot

        Extracts the user-friendly backtrace_slot from a low-level raw_backtrace_slot.

        • since 4.02
        val get_raw_backtrace_next_slot : raw_backtrace_slot -> raw_backtrace_slot option

        get_raw_backtrace_next_slot slot returns the next slot inlined, if any.

        Sample code to iterate over all frames (inlined and non-inlined):

        (* Iterate over inlined frames *)
         let rec iter_raw_backtrace_slot f slot =
        diff --git a/ocaml/Stdlib/Queue/index.html b/ocaml/Stdlib/Queue/index.html
        index 30d37c4d..a5859cd7 100644
        --- a/ocaml/Stdlib/Queue/index.html
        +++ b/ocaml/Stdlib/Queue/index.html
        @@ -1,5 +1,5 @@
         
        -Queue (ocaml.Stdlib.Queue)

        Module Stdlib.Queue

        First-in first-out queues.

        This module implements queues (FIFOs), with in-place modification. See the example section below.

        Unsynchronized accesses

        Unsynchronized accesses to a queue may lead to an invalid queue state. Thus, concurrent accesses to queues must be synchronized (for instance with a Mutex.t).

        type !'a t

        The type of queues containing elements of type 'a.

        exception Empty

        Raised when Queue.take or Queue.peek is applied to an empty queue.

        val create : unit -> 'a t

        Return a new queue, initially empty.

        val add : 'a -> 'a t -> unit

        add x q adds the element x at the end of the queue q.

        val push : 'a -> 'a t -> unit

        push is a synonym for add.

        val take : 'a t -> 'a

        take q removes and returns the first element in queue q, or raises Empty if the queue is empty.

        val take_opt : 'a t -> 'a option

        take_opt q removes and returns the first element in queue q, or returns None if the queue is empty.

        • since 4.08
        val pop : 'a t -> 'a

        pop is a synonym for take.

        val peek : 'a t -> 'a

        peek q returns the first element in queue q, without removing it from the queue, or raises Empty if the queue is empty.

        val peek_opt : 'a t -> 'a option

        peek_opt q returns the first element in queue q, without removing it from the queue, or returns None if the queue is empty.

        • since 4.08
        val top : 'a t -> 'a

        top is a synonym for peek.

        val clear : 'a t -> unit

        Discard all elements from a queue.

        val copy : 'a t -> 'a t

        Return a copy of the given queue.

        val is_empty : 'a t -> bool

        Return true if the given queue is empty, false otherwise.

        val length : 'a t -> int

        Return the number of elements in a queue.

        val iter : ('a -> unit) -> 'a t -> unit

        iter f q applies f in turn to all elements of q, from the least recently entered to the most recently entered. The queue itself is unchanged.

        val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

        fold f accu q is equivalent to List.fold_left f accu l, where l is the list of q's elements. The queue remains unchanged.

        val transfer : 'a t -> 'a t -> unit

        transfer q1 q2 adds all of q1's elements at the end of the queue q2, then clears q1. It is equivalent to the sequence iter (fun x -> add x q2) q1; clear q1, but runs in constant time.

        Iterators

        val to_seq : 'a t -> 'a Seq.t

        Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration.

        • since 4.07
        val add_seq : 'a t -> 'a Seq.t -> unit

        Add the elements from a sequence to the end of the queue.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a t

        Create a queue from a sequence.

        • since 4.07

        Examples

        Basic Example

        A basic example:

        # let q = Queue.create ()
        +Queue (ocaml.Stdlib.Queue)

        Module Stdlib.Queue

        First-in first-out queues.

        This module implements queues (FIFOs), with in-place modification. See the example section below.

        Unsynchronized accesses

        Unsynchronized accesses to a queue may lead to an invalid queue state. Thus, concurrent accesses to queues must be synchronized (for instance with a Mutex.t).

        type !'a t

        The type of queues containing elements of type 'a.

        exception Empty

        Raised when Queue.take or Queue.peek is applied to an empty queue.

        val create : unit -> 'a t

        Return a new queue, initially empty.

        val add : 'a -> 'a t -> unit

        add x q adds the element x at the end of the queue q.

        val push : 'a -> 'a t -> unit

        push is a synonym for add.

        val take : 'a t -> 'a

        take q removes and returns the first element in queue q, or raises Empty if the queue is empty.

        val take_opt : 'a t -> 'a option

        take_opt q removes and returns the first element in queue q, or returns None if the queue is empty.

        • since 4.08
        val pop : 'a t -> 'a

        pop is a synonym for take.

        val peek : 'a t -> 'a

        peek q returns the first element in queue q, without removing it from the queue, or raises Empty if the queue is empty.

        val peek_opt : 'a t -> 'a option

        peek_opt q returns the first element in queue q, without removing it from the queue, or returns None if the queue is empty.

        • since 4.08
        val top : 'a t -> 'a

        top is a synonym for peek.

        val drop : 'a t -> unit

        drop q removes the first element in queue q, or raises Empty if the queue is empty.

        • since 5.3
        val clear : 'a t -> unit

        Discard all elements from a queue.

        val copy : 'a t -> 'a t

        Return a copy of the given queue.

        val is_empty : 'a t -> bool

        Return true if the given queue is empty, false otherwise.

        val length : 'a t -> int

        Return the number of elements in a queue.

        val iter : ('a -> unit) -> 'a t -> unit

        iter f q applies f in turn to all elements of q, from the least recently entered to the most recently entered. The queue itself is unchanged.

        val fold : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

        fold f accu q is equivalent to List.fold_left f accu l, where l is the list of q's elements. The queue remains unchanged.

        val transfer : 'a t -> 'a t -> unit

        transfer q1 q2 adds all of q1's elements at the end of the queue q2, then clears q1. It is equivalent to the sequence iter (fun x -> add x q2) q1; clear q1, but runs in constant time.

        Iterators

        val to_seq : 'a t -> 'a Seq.t

        Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration.

        • since 4.07
        val add_seq : 'a t -> 'a Seq.t -> unit

        Add the elements from a sequence to the end of the queue.

        • since 4.07
        val of_seq : 'a Seq.t -> 'a t

        Create a queue from a sequence.

        • since 4.07

        Examples

        Basic Example

        A basic example:

        # let q = Queue.create ()
         val q : '_weak1 Queue.t = <abstr>
         
         
        diff --git a/ocaml/Stdlib/Random/State/index.html b/ocaml/Stdlib/Random/State/index.html
        index 2a6d5009..03581f93 100644
        --- a/ocaml/Stdlib/Random/State/index.html
        +++ b/ocaml/Stdlib/Random/State/index.html
        @@ -1,2 +1,2 @@
         
        -State (ocaml.Stdlib.Random.State)

        Module Random.State

        type t

        The type of PRNG states.

        val make : int array -> t

        Create a new state and initialize it with the given seed.

        val make_self_init : unit -> t

        Create a new state and initialize it with a random seed chosen in a system-dependent way. The seed is obtained as described in Random.self_init.

        val copy : t -> t

        Return a copy of the given state.

        val bits : t -> int
        val int : t -> int -> int
        val full_int : t -> int -> int
        val int32 : t -> Int32.t -> Int32.t
        val nativeint : t -> Nativeint.t -> Nativeint.t
        val int64 : t -> Int64.t -> Int64.t
        val float : t -> float -> float
        val bool : t -> bool
        val bits32 : t -> Int32.t
        val bits64 : t -> Int64.t
        val nativebits : t -> Nativeint.t

        These functions are the same as the basic functions, except that they use (and update) the given PRNG state instead of the default one.

        val split : t -> t

        Draw a fresh PRNG state from the given PRNG state. (The given PRNG state is modified.) The new PRNG is statistically independent from the given PRNG. Data can be drawn from both PRNGs, in any order, without risk of correlation. Both PRNGs can be split later, arbitrarily many times.

        • since 5.0
        val to_binary_string : t -> string

        Serializes the PRNG state into an immutable sequence of bytes. See of_binary_string for deserialization.

        The string type is intended here for serialization only, the encoding is not human-readable and may not be printable.

        Note that the serialization format may differ across OCaml versions.

        • since 5.1
        val of_binary_string : string -> t

        Deserializes a byte sequence obtained by calling to_binary_string. The resulting PRNG state will produce the same random numbers as the state that was passed as input to to_binary_string.

        • raises Failure

          if the input is not in the expected format.

          Note that the serialization format may differ across OCaml versions.

          Unlike the functions provided by the Marshal module, this function either produces a valid state or fails cleanly with a Failure exception. It can be safely used on user-provided, untrusted inputs.

        • since 5.1
        +State (ocaml.Stdlib.Random.State)

        Module Random.State

        type t

        The type of PRNG states.

        val make : int array -> t

        Create a new state and initialize it with the given seed.

        val make_self_init : unit -> t

        Create a new state and initialize it with a random seed chosen in a system-dependent way. The seed is obtained as described in Random.self_init.

        val copy : t -> t

        Return a copy of the given state.

        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

        These functions are the same as the basic functions, except that they use (and update) the given PRNG state instead of the default one.

        val split : t -> t

        Draw a fresh PRNG state from the given PRNG state. (The given PRNG state is modified.) The new PRNG is statistically independent from the given PRNG. Data can be drawn from both PRNGs, in any order, without risk of correlation. Both PRNGs can be split later, arbitrarily many times.

        • since 5.0
        val to_binary_string : t -> string

        Serializes the PRNG state into an immutable sequence of bytes. See of_binary_string for deserialization.

        The string type is intended here for serialization only, the encoding is not human-readable and may not be printable.

        Note that the serialization format may differ across OCaml versions.

        • since 5.1
        val of_binary_string : string -> t

        Deserializes a byte sequence obtained by calling to_binary_string. The resulting PRNG state will produce the same random numbers as the state that was passed as input to to_binary_string.

        • raises Failure

          if the input is not in the expected format.

          Note that the serialization format may differ across OCaml versions.

          Unlike the functions provided by the Marshal module, this function either produces a valid state or fails cleanly with a Failure exception. It can be safely used on user-provided, untrusted inputs.

        • since 5.1
        diff --git a/ocaml/Stdlib/Random/index.html b/ocaml/Stdlib/Random/index.html index 56f1b613..d7d34adb 100644 --- a/ocaml/Stdlib/Random/index.html +++ b/ocaml/Stdlib/Random/index.html @@ -1,2 +1,2 @@ -Random (ocaml.Stdlib.Random)

        Module Stdlib.Random

        Pseudo-random number generators (PRNG).

        With multiple domains, each domain has its own generator that evolves independently of the generators of other domains. When a domain is created, its generator is initialized by splitting the state of the generator associated with the parent domain.

        In contrast, all threads within a domain share the same domain-local generator. Independent generators can be created with the Random.split function and used with the functions from the Random.State module.

        Basic functions

        val init : int -> unit

        Initialize the domain-local generator, using the argument as a seed. The same seed will always yield the same sequence of numbers.

        val full_init : int array -> unit

        Same as Random.init but takes more data as seed.

        val self_init : unit -> unit

        Initialize the domain-local generator with a random seed chosen in a system-dependent way. If /dev/urandom is available on the host machine, it is used to provide a highly random initial seed. Otherwise, a less random seed is computed from system parameters (current time, process IDs, domain-local state).

        val bits : unit -> int

        Return 30 random bits in a nonnegative integer.

        • before 5.0

          used a different algorithm (affects all the following functions)

        val int : int -> int

        Random.int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0 and less than 230.

        val full_int : int -> int

        Random.full_int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound may be any positive integer.

        If bound is less than 230, Random.full_int bound is equal to Random.int bound. If bound is greater than 230 (on 64-bit systems or non-standard environments, such as JavaScript), Random.full_int returns a value, where Random.int raises Stdlib.Invalid_argument.

        • since 4.13
        val int32 : Int32.t -> Int32.t

        Random.int32 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

        val nativeint : Nativeint.t -> Nativeint.t

        Random.nativeint bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

        val int64 : Int64.t -> Int64.t

        Random.int64 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

        val float : float -> float

        Random.float bound returns a random floating-point number between 0 and bound (inclusive). If bound is negative, the result is negative or zero. If bound is 0, the result is 0.

        val bool : unit -> bool

        Random.bool () returns true or false with probability 0.5 each.

        val bits32 : unit -> Int32.t

        Random.bits32 () returns 32 random bits as an integer between Int32.min_int and Int32.max_int.

        • since 4.14
        val bits64 : unit -> Int64.t

        Random.bits64 () returns 64 random bits as an integer between Int64.min_int and Int64.max_int.

        • since 4.14
        val nativebits : unit -> Nativeint.t

        Random.nativebits () returns 32 or 64 random bits (depending on the bit width of the platform) as an integer between Nativeint.min_int and Nativeint.max_int.

        • since 4.14

        Advanced functions

        The functions from module State manipulate the current state of the random generator explicitly. This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program.

        module State : sig ... end
        val get_state : unit -> State.t

        get_state() returns a fresh copy of the current state of the domain-local generator (which is used by the basic functions).

        val set_state : State.t -> unit

        set_state s updates the current state of the domain-local generator (which is used by the basic functions) by copying the state s into it.

        val split : unit -> State.t

        Draw a fresh PRNG state from the current state of the domain-local generator used by the default functions. (The state of the domain-local generator is modified.) See Random.State.split.

        • since 5.0
        +Random (ocaml.Stdlib.Random)

        Module Stdlib.Random

        Pseudo-random number generators (PRNG).

        With multiple domains, each domain has its own generator that evolves independently of the generators of other domains. When a domain is created, its generator is initialized by splitting the state of the generator associated with the parent domain.

        In contrast, all threads within a domain share the same domain-local generator. Independent generators can be created with the Random.split function and used with the functions from the Random.State module.

        • before 5.0

          Random value generation used a different algorithm. This affects all the functions in this module which return random values.

        Basic functions

        val init : int -> unit

        Initialize the domain-local generator, using the argument as a seed. The same seed will always yield the same sequence of numbers.

        val full_init : int array -> unit

        Same as Random.init but takes more data as seed.

        val self_init : unit -> unit

        Initialize the domain-local generator with a random seed chosen in a system-dependent way. If /dev/urandom is available on the host machine, it is used to provide a highly random initial seed. Otherwise, a less random seed is computed from system parameters (current time, process IDs, domain-local state).

        val bits : unit -> int

        Return 30 random bits in a nonnegative integer.

        val int : int -> int

        Random.int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0 and less than 230.

        val full_int : int -> int

        Random.full_int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound may be any positive integer.

        If bound is less than 231, then Random.full_int bound yields identical output across systems with varying int sizes.

        If bound is less than 230, then Random.full_int bound is equal to Random.int bound.

        If bound is at least 230 (on 64-bit systems, or non-standard environments such as JavaScript), then Random.full_int returns a value whereas Random.int raises Stdlib.Invalid_argument.

        • since 4.13
        val int_in_range : min:int -> max:int -> int

        Random.int_in_range ~min ~max returns a random integer between min (inclusive) and max (inclusive). Both min and max are allowed to be negative; min must be less than or equal to max.

        If both bounds fit in 32-bit signed integers (that is, if -231 <= min and max < 231), then int_in_range yields identical output across systems with varying int sizes.

        • since 5.2
        val int32 : Int32.t -> Int32.t

        Random.int32 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

        val int32_in_range : min:int32 -> max:int32 -> int32

        Random.int32_in_range ~min ~max returns a random integer between min (inclusive) and max (inclusive). Both min and max are allowed to be negative; min must be less than or equal to max.

        • since 5.2
        val nativeint : Nativeint.t -> Nativeint.t

        Random.nativeint bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

        val nativeint_in_range : min:nativeint -> max:nativeint -> nativeint

        Random.nativeint_in_range ~min ~max returns a random integer between min (inclusive) and max (inclusive). Both min and max are allowed to be negative; min must be less than or equal to max.

        • since 5.2
        val int64 : Int64.t -> Int64.t

        Random.int64 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

        val int64_in_range : min:int64 -> max:int64 -> int64

        Random.int64_in_range ~min ~max returns a random integer between min (inclusive) and max (inclusive). Both min and max are allowed to be negative; min must be less than or equal to max.

        • since 5.2
        val float : float -> float

        Random.float bound returns a random floating-point number between 0 and bound (inclusive). If bound is negative, the result is negative or zero. If bound is 0, the result is 0.

        val bool : unit -> bool

        Random.bool () returns true or false with probability 0.5 each.

        val bits32 : unit -> Int32.t

        Random.bits32 () returns 32 random bits as an integer between Int32.min_int and Int32.max_int.

        • since 4.14
        val bits64 : unit -> Int64.t

        Random.bits64 () returns 64 random bits as an integer between Int64.min_int and Int64.max_int.

        • since 4.14
        val nativebits : unit -> Nativeint.t

        Random.nativebits () returns 32 or 64 random bits (depending on the bit width of the platform) as an integer between Nativeint.min_int and Nativeint.max_int.

        • since 4.14

        Advanced functions

        The functions from module State manipulate the current state of the random generator explicitly. This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program.

        module State : sig ... end
        val get_state : unit -> State.t

        get_state() returns a fresh copy of the current state of the domain-local generator (which is used by the basic functions).

        val set_state : State.t -> unit

        set_state s updates the current state of the domain-local generator (which is used by the basic functions) by copying the state s into it.

        val split : unit -> State.t

        Draw a fresh PRNG state from the current state of the domain-local generator used by the default functions. (The state of the domain-local generator is modified.) See Random.State.split.

        • since 5.0
        diff --git a/ocaml/Stdlib/Seq/index.html b/ocaml/Stdlib/Seq/index.html index f8a2b0b0..f3a1c059 100644 --- a/ocaml/Stdlib/Seq/index.html +++ b/ocaml/Stdlib/Seq/index.html @@ -1,2 +1,2 @@ -Seq (ocaml.Stdlib.Seq)

        Module Stdlib.Seq

        Sequences.

        A sequence of type 'a Seq.t can be thought of as a delayed list, that is, a list whose elements are computed only when they are demanded by a consumer. This allows sequences to be produced and transformed lazily (one element at a time) rather than eagerly (all elements at once). This also allows constructing conceptually infinite sequences.

        The type 'a Seq.t is defined as a synonym for unit -> 'a Seq.node. This is a function type: therefore, it is opaque. The consumer can query a sequence in order to request the next element (if there is one), but cannot otherwise inspect the sequence in any way.

        Because it is opaque, the type 'a Seq.t does not reveal whether a sequence is:

        • persistent, which means that the sequence can be used as many times as desired, producing the same elements every time, just like an immutable list; or
        • ephemeral, which means that the sequence is not persistent. Querying an ephemeral sequence might have an observable side effect, such as incrementing a mutable counter. As a common special case, an ephemeral sequence can be affine, which means that it must be queried at most once.

        It also does not reveal whether the elements of the sequence are:

        • pre-computed and stored in memory, which means that querying the sequence is cheap;
        • computed when first demanded and then stored in memory, which means that querying the sequence once can be expensive, but querying the same sequence again is cheap; or
        • re-computed every time they are demanded, which may or may not be cheap.

        It is up to the programmer to keep these distinctions in mind so as to understand the time and space requirements of sequences.

        For the sake of simplicity, most of the documentation that follows is written under the implicit assumption that the sequences at hand are persistent. We normally do not point out when or how many times each function is invoked, because that would be too verbose. For instance, in the description of map, we write: "if xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ...". If we wished to be more explicit, we could point out that the transformation takes place on demand: that is, the elements of map f xs are computed only when they are demanded. In other words, the definition let ys = map f xs terminates immediately and does not invoke f. The function call f x0 takes place only when the first element of ys is demanded, via the function call ys(). Furthermore, calling ys() twice causes f x0 to be called twice as well. If one wishes for f to be applied at most once to each element of xs, even in scenarios where ys is queried more than once, then one should use let ys = memoize (map f xs).

        As a general rule, the functions that build sequences, such as map, filter, scan, take, etc., produce sequences whose elements are computed only on demand. The functions that eagerly consume sequences, such as is_empty, find, length, iter, fold_left, etc., are the functions that force computation to take place.

        When possible, we recommend using sequences rather than dispensers (functions of type unit -> 'a option that produce elements upon demand). Whereas sequences can be persistent or ephemeral, dispensers are always ephemeral, and are typically more difficult to work with than sequences. Two conversion functions, to_dispenser and of_dispenser, are provided.

        • since 4.07
        type 'a t = unit -> 'a node

        A sequence xs of type 'a t is a delayed list of elements of type 'a. Such a sequence is queried by performing a function application xs(). This function application returns a node, allowing the caller to determine whether the sequence is empty or nonempty, and in the latter case, to obtain its head and tail.

        and +'a node =
        1. | Nil
        2. | Cons of 'a * 'a t

        A node is either Nil, which means that the sequence is empty, or Cons (x, xs), which means that x is the first element of the sequence and that xs is the remainder of the sequence.

        Consuming sequences

        The functions in this section consume their argument, a sequence, either partially or completely:

        • is_empty and uncons consume the sequence down to depth 1. That is, they demand the first argument of the sequence, if there is one.
        • iter, fold_left, length, etc., consume the sequence all the way to its end. They terminate only if the sequence is finite.
        • for_all, exists, find, etc. consume the sequence down to a certain depth, which is a priori unpredictable.

        Similarly, among the functions that consume two sequences, one can distinguish two groups:

        • iter2 and fold_left2 consume both sequences all the way to the end, provided the sequences have the same length.
        • for_all2, exists2, equal, compare consume the sequences down to a certain depth, which is a priori unpredictable.

        The functions that consume two sequences can be applied to two sequences of distinct lengths: in that case, the excess elements in the longer sequence are ignored. (It may be the case that one excess element is demanded, even though this element is not used.)

        None of the functions in this section is lazy. These functions are consumers: they force some computation to take place.

        val is_empty : 'a t -> bool

        is_empty xs determines whether the sequence xs is empty.

        It is recommended that the sequence xs be persistent. Indeed, is_empty xs demands the head of the sequence xs, so, if xs is ephemeral, it may be the case that xs cannot be used any more after this call has taken place.

        • since 4.14
        val uncons : 'a t -> ('a * 'a t) option

        If xs is empty, then uncons xs is None.

        If xs is nonempty, then uncons xs is Some (x, ys) where x is the head of the sequence and ys its tail.

        • since 4.14
        val length : 'a t -> int

        length xs is the length of the sequence xs.

        The sequence xs must be finite.

        • since 4.14
        val iter : ('a -> unit) -> 'a t -> unit

        iter f xs invokes f x successively for every element x of the sequence xs, from left to right.

        It terminates only if the sequence xs is finite.

        val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

        fold_left f _ xs invokes f _ x successively for every element x of the sequence xs, from left to right.

        An accumulator of type 'a is threaded through the calls to f.

        It terminates only if the sequence xs is finite.

        val iteri : (int -> 'a -> unit) -> 'a t -> unit

        iteri f xs invokes f i x successively for every element x located at index i in the sequence xs.

        It terminates only if the sequence xs is finite.

        iteri f xs is equivalent to iter (fun (i, x) -> f i x) (zip (ints 0) xs).

        • since 4.14
        val fold_lefti : ('acc -> int -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

        fold_lefti f _ xs invokes f _ i x successively for every element x located at index i of the sequence xs.

        An accumulator of type 'b is threaded through the calls to f.

        It terminates only if the sequence xs is finite.

        fold_lefti f accu xs is equivalent to fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs).

        • since 4.14
        val for_all : ('a -> bool) -> 'a t -> bool

        for_all p xs determines whether all elements x of the sequence xs satisfy p x.

        The sequence xs must be finite.

        • since 4.14
        val exists : ('a -> bool) -> 'a t -> bool

        exists xs p determines whether at least one element x of the sequence xs satisfies p x.

        The sequence xs must be finite.

        • since 4.14
        val find : ('a -> bool) -> 'a t -> 'a option

        find p xs returns Some x, where x is the first element of the sequence xs that satisfies p x, if there is such an element.

        It returns None if there is no such element.

        The sequence xs must be finite.

        • since 4.14
        val find_index : ('a -> bool) -> 'a t -> int option

        find_index p xs returns Some i, where i is the index of the first element of the sequence xs that satisfies p x, if there is such an element.

        It returns None if there is no such element.

        The sequence xs must be finite.

        • since 5.1
        val find_map : ('a -> 'b option) -> 'a t -> 'b option

        find_map f xs returns Some y, where x is the first element of the sequence xs such that f x = Some _, if there is such an element, and where y is defined by f x = Some y.

        It returns None if there is no such element.

        The sequence xs must be finite.

        • since 4.14
        val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        The sequence xs must be finite.

        • since 5.1
        val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit

        iter2 f xs ys invokes f x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

        If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        Iteration terminates only if at least one of the sequences xs and ys is finite.

        iter2 f xs ys is equivalent to iter (fun (x, y) -> f x y) (zip xs ys).

        • since 4.14
        val fold_left2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc

        fold_left2 f _ xs ys invokes f _ x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

        An accumulator of type 'a is threaded through the calls to f.

        If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        Iteration terminates only if at least one of the sequences xs and ys is finite.

        fold_left2 f accu xs ys is equivalent to fold_left (fun accu (x, y) -> f accu x y) (zip xs ys).

        • since 4.14
        val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

        for_all2 p xs ys determines whether all pairs (x, y) of elements drawn synchronously from the sequences xs and ys satisfy p x y.

        If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. In particular, if xs or ys is empty, then for_all2 p xs ys is true. This is where for_all2 and equal differ: equal eq xs ys can be true only if xs and ys have the same length.

        At least one of the sequences xs and ys must be finite.

        for_all2 p xs ys is equivalent to for_all (fun b -> b) (map2 p xs ys).

        • since 4.14
        val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

        exists2 p xs ys determines whether some pair (x, y) of elements drawn synchronously from the sequences xs and ys satisfies p x y.

        If the sequences xs and ys have different lengths, then iteration must stop as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        At least one of the sequences xs and ys must be finite.

        exists2 p xs ys is equivalent to exists (fun b -> b) (map2 p xs ys).

        • since 4.14
        val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

        Provided the function eq defines an equality on elements, equal eq xs ys determines whether the sequences xs and ys are pointwise equal.

        At least one of the sequences xs and ys must be finite.

        • since 4.14
        val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int

        Provided the function cmp defines a preorder on elements, compare cmp xs ys compares the sequences xs and ys according to the lexicographic preorder.

        For more details on comparison functions, see Array.sort.

        At least one of the sequences xs and ys must be finite.

        • since 4.14

        Constructing sequences

        The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

        val empty : 'a t

        empty is the empty sequence. It has no elements. Its length is 0.

        val return : 'a -> 'a t

        return x is the sequence whose sole element is x. Its length is 1.

        val cons : 'a -> 'a t -> 'a t

        cons x xs is the sequence that begins with the element x, followed with the sequence xs.

        Writing cons (f()) xs causes the function call f() to take place immediately. For this call to be delayed until the sequence is queried, one must instead write (fun () -> Cons(f(), xs)).

        • since 4.11
        val init : int -> (int -> 'a) -> 'a t

        init n f is the sequence f 0; f 1; ...; f (n-1).

        n must be nonnegative.

        If desired, the infinite sequence f 0; f 1; ... can be defined as map f (ints 0).

        • since 4.14
        val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t

        unfold constructs a sequence out of a step function and an initial state.

        If f u is None then unfold f u is the empty sequence. If f u is Some (x, u') then unfold f u is the nonempty sequence cons x (unfold f u').

        For example, unfold (function [] -> None | h :: t -> Some (h, t)) l is equivalent to List.to_seq l.

        • since 4.11
        val repeat : 'a -> 'a t

        repeat x is the infinite sequence where the element x is repeated indefinitely.

        repeat x is equivalent to cycle (return x).

        • since 4.14
        val forever : (unit -> 'a) -> 'a t

        forever f is an infinite sequence where every element is produced (on demand) by the function call f().

        For instance, forever Random.bool is an infinite sequence of random bits.

        forever f is equivalent to map f (repeat ()).

        • since 4.14
        val cycle : 'a t -> 'a t

        cycle xs is the infinite sequence that consists of an infinite number of repetitions of the sequence xs.

        If xs is an empty sequence, then cycle xs is empty as well.

        Consuming (a prefix of) the sequence cycle xs once can cause the sequence xs to be consumed more than once. Therefore, xs must be persistent.

        • since 4.14
        val iterate : ('a -> 'a) -> 'a -> 'a t

        iterate f x is the infinite sequence whose elements are x, f x, f (f x), and so on.

        In other words, it is the orbit of the function f, starting at x.

        • since 4.14

        Transforming sequences

        The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f xs is the image of the sequence xs through the transformation f.

        If xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ....

        val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t

        mapi is analogous to map, but applies the function f to an index and an element.

        mapi f xs is equivalent to map2 f (ints 0) xs.

        • since 4.14
        val filter : ('a -> bool) -> 'a t -> 'a t

        filter p xs is the sequence of the elements x of xs that satisfy p x.

        In other words, filter p xs is the sequence xs, deprived of the elements x such that p x is false.

        val filter_map : ('a -> 'b option) -> 'a t -> 'b t

        filter_map f xs is the sequence of the elements y such that f x = Some y, where x ranges over xs.

        filter_map f xs is equivalent to map Option.get (filter Option.is_some (map f xs)).

        val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t

        If xs is a sequence [x0; x1; x2; ...], then scan f a0 xs is a sequence of accumulators [a0; a1; a2; ...] where a1 is f a0 x0, a2 is f a1 x1, and so on.

        Thus, scan f a0 xs is conceptually related to fold_left f a0 xs. However, instead of performing an eager iteration and immediately returning the final accumulator, it returns a sequence of accumulators.

        For instance, scan (+) 0 transforms a sequence of integers into the sequence of its partial sums.

        If xs has length n then scan f a0 xs has length n+1.

        • since 4.14
        val take : int -> 'a t -> 'a t

        take n xs is the sequence of the first n elements of xs.

        If xs has fewer than n elements, then take n xs is equivalent to xs.

        n must be nonnegative.

        • since 4.14
        val drop : int -> 'a t -> 'a t

        drop n xs is the sequence xs, deprived of its first n elements.

        If xs has fewer than n elements, then drop n xs is empty.

        n must be nonnegative.

        drop is lazy: the first n+1 elements of the sequence xs are demanded only when the first element of drop n xs is demanded. For this reason, drop 1 xs is not equivalent to tail xs, which queries xs immediately.

        • since 4.14
        val take_while : ('a -> bool) -> 'a t -> 'a t

        take_while p xs is the longest prefix of the sequence xs where every element x satisfies p x.

        • since 4.14
        val drop_while : ('a -> bool) -> 'a t -> 'a t

        drop_while p xs is the sequence xs, deprived of the prefix take_while p xs.

        • since 4.14
        val group : ('a -> 'a -> bool) -> 'a t -> 'a t t

        Provided the function eq defines an equality on elements, group eq xs is the sequence of the maximal runs of adjacent duplicate elements of the sequence xs.

        Every element of group eq xs is a nonempty sequence of equal elements.

        The concatenation concat (group eq xs) is equal to xs.

        Consuming group eq xs, and consuming the sequences that it contains, can cause xs to be consumed more than once. Therefore, xs must be persistent.

        • since 4.14
        val memoize : 'a t -> 'a t

        The sequence memoize xs has the same elements as the sequence xs.

        Regardless of whether xs is ephemeral or persistent, memoize xs is persistent: even if it is queried several times, xs is queried at most once.

        The construction of the sequence memoize xs internally relies on suspensions provided by the module Lazy. These suspensions are not thread-safe. Therefore, the sequence memoize xs must not be queried by multiple threads concurrently.

        • since 4.14
        exception Forced_twice

        This exception is raised when a sequence returned by once (or a suffix of it) is queried more than once.

        • since 4.14
        val once : 'a t -> 'a t

        The sequence once xs has the same elements as the sequence xs.

        Regardless of whether xs is ephemeral or persistent, once xs is an ephemeral sequence: it can be queried at most once. If it (or a suffix of it) is queried more than once, then the exception Forced_twice is raised. This can be useful, while debugging or testing, to ensure that a sequence is consumed at most once.

        • raises Forced_twice

          if once xs, or a suffix of it, is queried more than once.

        • since 4.14
        val transpose : 'a t t -> 'a t t

        If xss is a matrix (a sequence of rows), then transpose xss is the sequence of the columns of the matrix xss.

        The rows of the matrix xss are not required to have the same length.

        The matrix xss is not required to be finite (in either direction).

        The matrix xss must be persistent.

        • since 4.14

        Combining sequences

        val append : 'a t -> 'a t -> 'a t

        append xs ys is the concatenation of the sequences xs and ys.

        Its elements are the elements of xs, followed by the elements of ys.

        • since 4.11
        val concat : 'a t t -> 'a t

        If xss is a sequence of sequences, then concat xss is its concatenation.

        If xss is the sequence xs0; xs1; ... then concat xss is the sequence xs0 @ xs1 @ ....

        • since 4.13
        val flat_map : ('a -> 'b t) -> 'a t -> 'b t

        flat_map f xs is equivalent to concat (map f xs).

        val concat_map : ('a -> 'b t) -> 'a t -> 'b t

        concat_map f xs is equivalent to concat (map f xs).

        concat_map is an alias for flat_map.

        • since 4.13
        val zip : 'a t -> 'b t -> ('a * 'b) t

        zip xs ys is the sequence of pairs (x, y) drawn synchronously from the sequences xs and ys.

        If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        zip xs ys is equivalent to map2 (fun a b -> (a, b)) xs ys.

        • since 4.14
        val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

        map2 f xs ys is the sequence of the elements f x y, where the pairs (x, y) are drawn synchronously from the sequences xs and ys.

        If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        map2 f xs ys is equivalent to map (fun (x, y) -> f x y) (zip xs ys).

        • since 4.14
        val interleave : 'a t -> 'a t -> 'a t

        interleave xs ys is the sequence that begins with the first element of xs, continues with the first element of ys, and so on.

        When one of the sequences xs and ys is exhausted, interleave xs ys continues with the rest of the other sequence.

        • since 4.14
        val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t

        If the sequences xs and ys are sorted according to the total preorder cmp, then sorted_merge cmp xs ys is the sorted sequence obtained by merging the sequences xs and ys.

        For more details on comparison functions, see Array.sort.

        • since 4.14
        val product : 'a t -> 'b t -> ('a * 'b) t

        product xs ys is the Cartesian product of the sequences xs and ys.

        For every element x of xs and for every element y of ys, the pair (x, y) appears once as an element of product xs ys.

        The order in which the pairs appear is unspecified.

        The sequences xs and ys are not required to be finite.

        The sequences xs and ys must be persistent.

        • since 4.14
        val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

        The sequence map_product f xs ys is the image through f of the Cartesian product of the sequences xs and ys.

        For every element x of xs and for every element y of ys, the element f x y appears once as an element of map_product f xs ys.

        The order in which these elements appear is unspecified.

        The sequences xs and ys are not required to be finite.

        The sequences xs and ys must be persistent.

        map_product f xs ys is equivalent to map (fun (x, y) -> f x y) (product xs ys).

        • since 4.14

        Splitting a sequence into two sequences

        val unzip : ('a * 'b) t -> 'a t * 'b t

        unzip transforms a sequence of pairs into a pair of sequences.

        unzip xs is equivalent to (map fst xs, map snd xs).

        Querying either of the sequences returned by unzip xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use unzip (memoize xs).

        • since 4.14
        val split : ('a * 'b) t -> 'a t * 'b t

        split is an alias for unzip.

        • since 4.14
        val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> 'b t * 'c t

        partition_map f xs returns a pair of sequences (ys, zs), where:

        • ys is the sequence of the elements y such that f x = Left y, where x ranges over xs;
        • zs is the sequence of the elements z such that f x = Right z, where x ranges over xs.

        partition_map f xs is equivalent to a pair of filter_map Either.find_left (map f xs) and filter_map Either.find_right (map f xs).

        Querying either of the sequences returned by partition_map f xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use partition_map f (memoize xs).

        • since 4.14
        val partition : ('a -> bool) -> 'a t -> 'a t * 'a t

        partition p xs returns a pair of the subsequence of the elements of xs that satisfy p and the subsequence of the elements of xs that do not satisfy p.

        partition p xs is equivalent to filter p xs, filter (fun x -> not (p x)) xs.

        Consuming both of the sequences returned by partition p xs causes xs to be consumed twice and causes the function f to be applied twice to each element of the list. Therefore, f should be pure and cheap. Furthermore, xs should be persistent and cheap. If that is not the case, use partition p (memoize xs).

        • since 4.14

        Converting between sequences and dispensers

        A dispenser is a representation of a sequence as a function of type unit -> 'a option. Every time this function is invoked, it returns the next element of the sequence. When there are no more elements, it returns None. A dispenser has mutable internal state, therefore is ephemeral: the sequence that it represents can be consumed at most once.

        val of_dispenser : (unit -> 'a option) -> 'a t

        of_dispenser it is the sequence of the elements produced by the dispenser it. It is an ephemeral sequence: it can be consumed at most once. If a persistent sequence is needed, use memoize (of_dispenser it).

        • since 4.14
        val to_dispenser : 'a t -> unit -> 'a option

        to_dispenser xs is a fresh dispenser on the sequence xs.

        This dispenser has mutable internal state, which is not protected by a lock; so, it must not be used by several threads concurrently.

        • since 4.14

        Sequences of integers

        val ints : int -> int t

        ints i is the infinite sequence of the integers beginning at i and counting up.

        • since 4.14
        +Seq (ocaml.Stdlib.Seq)

        Module Stdlib.Seq

        Sequences.

        A sequence of type 'a Seq.t can be thought of as a delayed list, that is, a list whose elements are computed only when they are demanded by a consumer. This allows sequences to be produced and transformed lazily (one element at a time) rather than eagerly (all elements at once). This also allows constructing conceptually infinite sequences.

        The type 'a Seq.t is defined as a synonym for unit -> 'a Seq.node. This is a function type: therefore, it is opaque. The consumer can query a sequence in order to request the next element (if there is one), but cannot otherwise inspect the sequence in any way.

        Because it is opaque, the type 'a Seq.t does not reveal whether a sequence is:

        • persistent, which means that the sequence can be used as many times as desired, producing the same elements every time, just like an immutable list; or
        • ephemeral, which means that the sequence is not persistent. Querying an ephemeral sequence might have an observable side effect, such as incrementing a mutable counter. As a common special case, an ephemeral sequence can be affine, which means that it must be queried at most once.

        It also does not reveal whether the elements of the sequence are:

        • pre-computed and stored in memory, which means that querying the sequence is cheap;
        • computed when first demanded and then stored in memory, which means that querying the sequence once can be expensive, but querying the same sequence again is cheap; or
        • re-computed every time they are demanded, which may or may not be cheap.

        It is up to the programmer to keep these distinctions in mind so as to understand the time and space requirements of sequences.

        For the sake of simplicity, most of the documentation that follows is written under the implicit assumption that the sequences at hand are persistent. We normally do not point out when or how many times each function is invoked, because that would be too verbose. For instance, in the description of map, we write: "if xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ...". If we wished to be more explicit, we could point out that the transformation takes place on demand: that is, the elements of map f xs are computed only when they are demanded. In other words, the definition let ys = map f xs terminates immediately and does not invoke f. The function call f x0 takes place only when the first element of ys is demanded, via the function call ys(). Furthermore, calling ys() twice causes f x0 to be called twice as well. If one wishes for f to be applied at most once to each element of xs, even in scenarios where ys is queried more than once, then one should use let ys = memoize (map f xs).

        As a general rule, the functions that build sequences, such as map, filter, scan, take, etc., produce sequences whose elements are computed only on demand. The functions that eagerly consume sequences, such as is_empty, find, length, iter, fold_left, etc., are the functions that force computation to take place.

        When possible, we recommend using sequences rather than dispensers (functions of type unit -> 'a option that produce elements upon demand). Whereas sequences can be persistent or ephemeral, dispensers are always ephemeral, and are typically more difficult to work with than sequences. Two conversion functions, to_dispenser and of_dispenser, are provided.

        • since 4.07
        type 'a t = unit -> 'a node

        A sequence xs of type 'a t is a delayed list of elements of type 'a. Such a sequence is queried by performing a function application xs(). This function application returns a node, allowing the caller to determine whether the sequence is empty or nonempty, and in the latter case, to obtain its head and tail.

        and +'a node =
        1. | Nil
        2. | Cons of 'a * 'a t

        A node is either Nil, which means that the sequence is empty, or Cons (x, xs), which means that x is the first element of the sequence and that xs is the remainder of the sequence.

        Consuming sequences

        The functions in this section consume their argument, a sequence, either partially or completely:

        • is_empty and uncons consume the sequence down to depth 1. That is, they demand the first argument of the sequence, if there is one.
        • iter, fold_left, length, etc., consume the sequence all the way to its end. They terminate only if the sequence is finite.
        • for_all, exists, find, etc. consume the sequence down to a certain depth, which is a priori unpredictable.

        Similarly, among the functions that consume two sequences, one can distinguish two groups:

        • iter2 and fold_left2 consume both sequences all the way to the end, provided the sequences have the same length.
        • for_all2, exists2, equal, compare consume the sequences down to a certain depth, which is a priori unpredictable.

        The functions that consume two sequences can be applied to two sequences of distinct lengths: in that case, the excess elements in the longer sequence are ignored. (It may be the case that one excess element is demanded, even though this element is not used.)

        None of the functions in this section is lazy. These functions are consumers: they force some computation to take place.

        val is_empty : 'a t -> bool

        is_empty xs determines whether the sequence xs is empty.

        It is recommended that the sequence xs be persistent. Indeed, is_empty xs demands the head of the sequence xs, so, if xs is ephemeral, it may be the case that xs cannot be used any more after this call has taken place.

        • since 4.14
        val uncons : 'a t -> ('a * 'a t) option

        If xs is empty, then uncons xs is None.

        If xs is nonempty, then uncons xs is Some (x, ys) where x is the head of the sequence and ys its tail.

        • since 4.14
        val length : 'a t -> int

        length xs is the length of the sequence xs.

        The sequence xs must be finite.

        • since 4.14
        val iter : ('a -> unit) -> 'a t -> unit

        iter f xs invokes f x successively for every element x of the sequence xs, from left to right.

        It terminates only if the sequence xs is finite.

        val fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

        fold_left f _ xs invokes f _ x successively for every element x of the sequence xs, from left to right.

        An accumulator of type 'a is threaded through the calls to f.

        It terminates only if the sequence xs is finite.

        val iteri : (int -> 'a -> unit) -> 'a t -> unit

        iteri f xs invokes f i x successively for every element x located at index i in the sequence xs.

        It terminates only if the sequence xs is finite.

        iteri f xs is equivalent to iter (fun (i, x) -> f i x) (zip (ints 0) xs).

        • since 4.14
        val fold_lefti : ('acc -> int -> 'a -> 'acc) -> 'acc -> 'a t -> 'acc

        fold_lefti f _ xs invokes f _ i x successively for every element x located at index i of the sequence xs.

        An accumulator of type 'b is threaded through the calls to f.

        It terminates only if the sequence xs is finite.

        fold_lefti f accu xs is equivalent to fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs).

        • since 4.14
        val for_all : ('a -> bool) -> 'a t -> bool

        for_all p xs determines whether all elements x of the sequence xs satisfy p x.

        The sequence xs must be finite.

        • since 4.14
        val exists : ('a -> bool) -> 'a t -> bool

        exists xs p determines whether at least one element x of the sequence xs satisfies p x.

        The sequence xs must be finite.

        • since 4.14
        val find : ('a -> bool) -> 'a t -> 'a option

        find p xs returns Some x, where x is the first element of the sequence xs that satisfies p x, if there is such an element.

        It returns None if there is no such element.

        The sequence xs must be finite.

        • since 4.14
        val find_index : ('a -> bool) -> 'a t -> int option

        find_index p xs returns Some i, where i is the index of the first element of the sequence xs that satisfies p x, if there is such an element.

        It returns None if there is no such element.

        The sequence xs must be finite.

        • since 5.1
        val find_map : ('a -> 'b option) -> 'a t -> 'b option

        find_map f xs returns Some y, where x is the first element of the sequence xs such that f x = Some _, if there is such an element, and where y is defined by f x = Some y.

        It returns None if there is no such element.

        The sequence xs must be finite.

        • since 4.14
        val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

        Same as find_map, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

        The sequence xs must be finite.

        • since 5.1
        val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit

        iter2 f xs ys invokes f x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

        If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        Iteration terminates only if at least one of the sequences xs and ys is finite.

        iter2 f xs ys is equivalent to iter (fun (x, y) -> f x y) (zip xs ys).

        • since 4.14
        val fold_left2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc

        fold_left2 f _ xs ys invokes f _ x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

        An accumulator of type 'a is threaded through the calls to f.

        If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        Iteration terminates only if at least one of the sequences xs and ys is finite.

        fold_left2 f accu xs ys is equivalent to fold_left (fun accu (x, y) -> f accu x y) (zip xs ys).

        • since 4.14
        val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

        for_all2 p xs ys determines whether all pairs (x, y) of elements drawn synchronously from the sequences xs and ys satisfy p x y.

        If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. In particular, if xs or ys is empty, then for_all2 p xs ys is true. This is where for_all2 and equal differ: equal eq xs ys can be true only if xs and ys have the same length.

        At least one of the sequences xs and ys must be finite.

        for_all2 p xs ys is equivalent to for_all (fun b -> b) (map2 p xs ys).

        • since 4.14
        val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

        exists2 p xs ys determines whether some pair (x, y) of elements drawn synchronously from the sequences xs and ys satisfies p x y.

        If the sequences xs and ys have different lengths, then iteration must stop as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        At least one of the sequences xs and ys must be finite.

        exists2 p xs ys is equivalent to exists (fun b -> b) (map2 p xs ys).

        • since 4.14
        val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

        Provided the function eq defines an equality on elements, equal eq xs ys determines whether the sequences xs and ys are pointwise equal.

        At least one of the sequences xs and ys must be finite.

        • since 4.14
        val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int

        Provided the function cmp defines a preorder on elements, compare cmp xs ys compares the sequences xs and ys according to the lexicographic preorder.

        For more details on comparison functions, see Array.sort.

        At least one of the sequences xs and ys must be finite.

        • since 4.14

        Constructing sequences

        The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

        val empty : 'a t

        empty is the empty sequence. It has no elements. Its length is 0.

        val return : 'a -> 'a t

        return x is the sequence whose sole element is x. Its length is 1.

        val cons : 'a -> 'a t -> 'a t

        cons x xs is the sequence that begins with the element x, followed with the sequence xs.

        Writing cons (f()) xs causes the function call f() to take place immediately. For this call to be delayed until the sequence is queried, one must instead write (fun () -> Cons(f(), xs)).

        • since 4.11
        val init : int -> (int -> 'a) -> 'a t

        init n f is the sequence f 0; f 1; ...; f (n-1).

        n must be nonnegative.

        If desired, the infinite sequence f 0; f 1; ... can be defined as map f (ints 0).

        • since 4.14
        val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t

        unfold constructs a sequence out of a step function and an initial state.

        If f u is None then unfold f u is the empty sequence. If f u is Some (x, u') then unfold f u is the nonempty sequence cons x (unfold f u').

        For example, unfold (function [] -> None | h :: t -> Some (h, t)) l is equivalent to List.to_seq l.

        • since 4.11
        val repeat : 'a -> 'a t

        repeat x is the infinite sequence where the element x is repeated indefinitely.

        repeat x is equivalent to cycle (return x).

        • since 4.14
        val forever : (unit -> 'a) -> 'a t

        forever f is an infinite sequence where every element is produced (on demand) by the function call f().

        For instance, forever Random.bool is an infinite sequence of random bits.

        forever f is equivalent to map f (repeat ()).

        • since 4.14
        val cycle : 'a t -> 'a t

        cycle xs is the infinite sequence that consists of an infinite number of repetitions of the sequence xs.

        If xs is an empty sequence, then cycle xs is empty as well.

        Consuming (a prefix of) the sequence cycle xs once can cause the sequence xs to be consumed more than once. Therefore, xs must be persistent.

        • since 4.14
        val iterate : ('a -> 'a) -> 'a -> 'a t

        iterate f x is the infinite sequence whose elements are x, f x, f (f x), and so on.

        In other words, it is the orbit of the function f, starting at x.

        • since 4.14

        Transforming sequences

        The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f xs is the image of the sequence xs through the transformation f.

        If xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ....

        val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t

        mapi is analogous to map, but applies the function f to an index and an element.

        mapi f xs is equivalent to map2 f (ints 0) xs.

        • since 4.14
        val filter : ('a -> bool) -> 'a t -> 'a t

        filter p xs is the sequence of the elements x of xs that satisfy p x.

        In other words, filter p xs is the sequence xs, deprived of the elements x such that p x is false.

        val filter_map : ('a -> 'b option) -> 'a t -> 'b t

        filter_map f xs is the sequence of the elements y such that f x = Some y, where x ranges over xs.

        filter_map f xs is equivalent to map Option.get (filter Option.is_some (map f xs)).

        val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t

        If xs is a sequence [x0; x1; x2; ...], then scan f a0 xs is a sequence of accumulators [a0; a1; a2; ...] where a1 is f a0 x0, a2 is f a1 x1, and so on.

        Thus, scan f a0 xs is conceptually related to fold_left f a0 xs. However, instead of performing an eager iteration and immediately returning the final accumulator, it returns a sequence of accumulators.

        For instance, scan (+) 0 transforms a sequence of integers into the sequence of its partial sums.

        If xs has length n then scan f a0 xs has length n+1.

        • since 4.14
        val take : int -> 'a t -> 'a t

        take n xs is the sequence of the first n elements of xs.

        If xs has fewer than n elements, then take n xs is equivalent to xs.

        n must be nonnegative.

        • since 4.14
        val drop : int -> 'a t -> 'a t

        drop n xs is the sequence xs, deprived of its first n elements.

        If xs has fewer than n elements, then drop n xs is empty.

        n must be nonnegative.

        drop is lazy: the first n+1 elements of the sequence xs are demanded only when the first element of drop n xs is demanded.

        • since 4.14
        val take_while : ('a -> bool) -> 'a t -> 'a t

        take_while p xs is the longest prefix of the sequence xs where every element x satisfies p x.

        • since 4.14
        val drop_while : ('a -> bool) -> 'a t -> 'a t

        drop_while p xs is the sequence xs, deprived of the prefix take_while p xs.

        • since 4.14
        val group : ('a -> 'a -> bool) -> 'a t -> 'a t t

        Provided the function eq defines an equality on elements, group eq xs is the sequence of the maximal runs of adjacent duplicate elements of the sequence xs.

        Every element of group eq xs is a nonempty sequence of equal elements.

        The concatenation concat (group eq xs) is equal to xs.

        Consuming group eq xs, and consuming the sequences that it contains, can cause xs to be consumed more than once. Therefore, xs must be persistent.

        • since 4.14
        val memoize : 'a t -> 'a t

        The sequence memoize xs has the same elements as the sequence xs.

        Regardless of whether xs is ephemeral or persistent, memoize xs is persistent: even if it is queried several times, xs is queried at most once.

        The construction of the sequence memoize xs internally relies on suspensions provided by the module Lazy. These suspensions are not thread-safe. Therefore, the sequence memoize xs must not be queried by multiple threads concurrently.

        • since 4.14
        exception Forced_twice

        This exception is raised when a sequence returned by once (or a suffix of it) is queried more than once.

        • since 4.14
        val once : 'a t -> 'a t

        The sequence once xs has the same elements as the sequence xs.

        Regardless of whether xs is ephemeral or persistent, once xs is an ephemeral sequence: it can be queried at most once. If it (or a suffix of it) is queried more than once, then the exception Forced_twice is raised. This can be useful, while debugging or testing, to ensure that a sequence is consumed at most once.

        • raises Forced_twice

          if once xs, or a suffix of it, is queried more than once.

        • since 4.14
        val transpose : 'a t t -> 'a t t

        If xss is a matrix (a sequence of rows), then transpose xss is the sequence of the columns of the matrix xss.

        The rows of the matrix xss are not required to have the same length.

        The matrix xss is not required to be finite (in either direction).

        The matrix xss must be persistent.

        • since 4.14

        Combining sequences

        val append : 'a t -> 'a t -> 'a t

        append xs ys is the concatenation of the sequences xs and ys.

        Its elements are the elements of xs, followed by the elements of ys.

        • since 4.11
        val concat : 'a t t -> 'a t

        If xss is a sequence of sequences, then concat xss is its concatenation.

        If xss is the sequence xs0; xs1; ... then concat xss is the sequence xs0 @ xs1 @ ....

        • since 4.13
        val flat_map : ('a -> 'b t) -> 'a t -> 'b t

        flat_map f xs is equivalent to concat (map f xs).

        val concat_map : ('a -> 'b t) -> 'a t -> 'b t

        concat_map f xs is equivalent to concat (map f xs).

        concat_map is an alias for flat_map.

        • since 4.13
        val zip : 'a t -> 'b t -> ('a * 'b) t

        zip xs ys is the sequence of pairs (x, y) drawn synchronously from the sequences xs and ys.

        If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        zip xs ys is equivalent to map2 (fun a b -> (a, b)) xs ys.

        • since 4.14
        val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

        map2 f xs ys is the sequence of the elements f x y, where the pairs (x, y) are drawn synchronously from the sequences xs and ys.

        If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

        map2 f xs ys is equivalent to map (fun (x, y) -> f x y) (zip xs ys).

        • since 4.14
        val interleave : 'a t -> 'a t -> 'a t

        interleave xs ys is the sequence that begins with the first element of xs, continues with the first element of ys, and so on.

        When one of the sequences xs and ys is exhausted, interleave xs ys continues with the rest of the other sequence.

        • since 4.14
        val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t

        If the sequences xs and ys are sorted according to the total preorder cmp, then sorted_merge cmp xs ys is the sorted sequence obtained by merging the sequences xs and ys.

        For more details on comparison functions, see Array.sort.

        • since 4.14
        val product : 'a t -> 'b t -> ('a * 'b) t

        product xs ys is the Cartesian product of the sequences xs and ys.

        For every element x of xs and for every element y of ys, the pair (x, y) appears once as an element of product xs ys.

        The order in which the pairs appear is unspecified.

        The sequences xs and ys are not required to be finite.

        The sequences xs and ys must be persistent.

        • since 4.14
        val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

        The sequence map_product f xs ys is the image through f of the Cartesian product of the sequences xs and ys.

        For every element x of xs and for every element y of ys, the element f x y appears once as an element of map_product f xs ys.

        The order in which these elements appear is unspecified.

        The sequences xs and ys are not required to be finite.

        The sequences xs and ys must be persistent.

        map_product f xs ys is equivalent to map (fun (x, y) -> f x y) (product xs ys).

        • since 4.14

        Splitting a sequence into two sequences

        val unzip : ('a * 'b) t -> 'a t * 'b t

        unzip transforms a sequence of pairs into a pair of sequences.

        unzip xs is equivalent to (map fst xs, map snd xs).

        Querying either of the sequences returned by unzip xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use unzip (memoize xs).

        • since 4.14
        val split : ('a * 'b) t -> 'a t * 'b t

        split is an alias for unzip.

        • since 4.14
        val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> 'b t * 'c t

        partition_map f xs returns a pair of sequences (ys, zs), where:

        • ys is the sequence of the elements y such that f x = Left y, where x ranges over xs;
        • zs is the sequence of the elements z such that f x = Right z, where x ranges over xs.

        partition_map f xs is equivalent to a pair of filter_map Either.find_left (map f xs) and filter_map Either.find_right (map f xs).

        Querying either of the sequences returned by partition_map f xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use partition_map f (memoize xs).

        • since 4.14
        val partition : ('a -> bool) -> 'a t -> 'a t * 'a t

        partition p xs returns a pair of the subsequence of the elements of xs that satisfy p and the subsequence of the elements of xs that do not satisfy p.

        partition p xs is equivalent to filter p xs, filter (fun x -> not (p x)) xs.

        Consuming both of the sequences returned by partition p xs causes xs to be consumed twice and causes the function f to be applied twice to each element of the list. Therefore, f should be pure and cheap. Furthermore, xs should be persistent and cheap. If that is not the case, use partition p (memoize xs).

        • since 4.14

        Converting between sequences and dispensers

        A dispenser is a representation of a sequence as a function of type unit -> 'a option. Every time this function is invoked, it returns the next element of the sequence. When there are no more elements, it returns None. A dispenser has mutable internal state, therefore is ephemeral: the sequence that it represents can be consumed at most once.

        val of_dispenser : (unit -> 'a option) -> 'a t

        of_dispenser it is the sequence of the elements produced by the dispenser it. It is an ephemeral sequence: it can be consumed at most once. If a persistent sequence is needed, use memoize (of_dispenser it).

        • since 4.14
        val to_dispenser : 'a t -> unit -> 'a option

        to_dispenser xs is a fresh dispenser on the sequence xs.

        This dispenser has mutable internal state, which is not protected by a lock; so, it must not be used by several threads concurrently.

        • since 4.14

        Sequences of integers

        val ints : int -> int t

        ints i is the infinite sequence of the integers beginning at i and counting up.

        • since 4.14
        diff --git a/ocaml/Stdlib/String/index.html b/ocaml/Stdlib/String/index.html index 49f6ecc4..6d0c358b 100644 --- a/ocaml/Stdlib/String/index.html +++ b/ocaml/Stdlib/String/index.html @@ -2,5 +2,5 @@ String (ocaml.Stdlib.String)

        Module Stdlib.String

        Strings.

        A string s of length n is an indexable and immutable sequence of n bytes. For historical reasons these bytes are referred to as characters.

        The semantics of string functions is defined in terms of indices and positions. These are depicted and described as follows.

        positions  0   1   2   3   4    n-1    n
                    +---+---+---+---+     +-----+
           indices  | 0 | 1 | 2 | 3 | ... | n-1 |
        -           +---+---+---+---+     +-----+
        • An index i of s is an integer in the range [0;n-1]. It represents the ith byte (character) of s which can be accessed using the constant time string indexing operator s.[i].
        • A position i of s is an integer in the range [0;n]. It represents either the point at the beginning of the string, or the point between two indices, or the point at the end of the string. The ith byte index is between position i and i+1.

        Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

        Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

        Past mutability. Before OCaml 4.02, strings used to be modifiable in place like Bytes.t mutable sequences of bytes. OCaml 4 had various compiler flags and configuration options to support the transition period from mutable to immutable strings. Those options are no longer available, and strings are now always immutable.

        The labeled version of this module can be used as described in the StdLabels module.

        Strings

        type t = string

        The type for strings.

        val make : int -> char -> string

        make n c is a string of length n with each index holding the character c.

        val init : int -> (int -> char) -> string

        init n f is a string of length n with index i holding the character f i (called in increasing index order).

        • since 4.02
        val empty : string

        The empty string.

        • since 4.13
        val length : string -> int

        length s is the length (number of bytes/characters) of s.

        val get : string -> int -> char

        get s i is the character at index i in s. This is the same as writing s.[i].

        val of_bytes : bytes -> string

        Return a new string that contains the same bytes as the given byte sequence.

        • since 4.13
        val to_bytes : string -> bytes

        Return a new byte sequence that contains the same bytes as the given string.

        • since 4.13
        val blit : string -> int -> bytes -> int -> int -> unit

        Same as Bytes.blit_string which should be preferred.

        Concatenating

        Note. The Stdlib.(^) binary operator concatenates two strings.

        val concat : string -> string list -> string

        concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

        val cat : string -> string -> string

        cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

        • since 4.13

        Predicates and comparisons

        val equal : t -> t -> bool

        equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

        • since 4.03 (4.05 in StringLabels)
        val compare : t -> t -> int

        compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

        val starts_with : prefix:string -> string -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:string -> string -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13
        val contains_from : string -> int -> char -> bool

        contains_from s start c is true if and only if c appears in s after position start.

        val rcontains_from : string -> int -> char -> bool

        rcontains_from s stop c is true if and only if c appears in s before position stop+1.

        val contains : string -> char -> bool

        contains s c is String.contains_from s 0 c.

        Extracting substrings

        val sub : string -> int -> int -> string

        sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

        val split_on_char : char -> string -> string list

        split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

        The function's result is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) - (split_on_char sep s) = s).
        • No string in the result contains the sep character.
        • since 4.04 (4.05 in StringLabels)

        Transforming

        val map : (char -> char) -> string -> string

        map f s is the string resulting from applying f to all the characters of s in increasing order.

        • since 4.00
        val mapi : (int -> char -> char) -> string -> string

        mapi f s is like map but the index of the character is also passed to f.

        • since 4.02
        val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc

        fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

        • since 4.13
        val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc

        fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

        • since 4.13
        val for_all : (char -> bool) -> string -> bool

        for_all p s checks if all characters in s satisfy the predicate p.

        • since 4.13
        val exists : (char -> bool) -> string -> bool

        exists p s checks if at least one character of s satisfies the predicate p.

        • since 4.13
        val trim : string -> string

        trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

        • since 4.00
        val escaped : string -> string

        escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

        All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

        The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

        val uppercase_ascii : string -> string

        uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)
        val lowercase_ascii : string -> string

        lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)
        val capitalize_ascii : string -> string

        capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)
        val uncapitalize_ascii : string -> string

        uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)

        Traversing

        val iter : (char -> unit) -> string -> unit

        iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

        val iteri : (int -> char -> unit) -> string -> unit

        iteri is like iter, but the function is also given the corresponding character index.

        • since 4.00

        Searching

        val index_from : string -> int -> char -> int

        index_from s i c is the index of the first occurrence of c in s after position i.

        • raises Not_found

          if c does not occur in s after position i.

        val index_from_opt : string -> int -> char -> int option

        index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

        • since 4.05
        val rindex_from : string -> int -> char -> int

        rindex_from s i c is the index of the last occurrence of c in s before position i+1.

        • raises Not_found

          if c does not occur in s before position i+1.

        val rindex_from_opt : string -> int -> char -> int option

        rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

        • since 4.05
        val index : string -> char -> int

        index s c is String.index_from s 0 c.

        val index_opt : string -> char -> int option

        index_opt s c is String.index_from_opt s 0 c.

        • since 4.05
        val rindex : string -> char -> int

        rindex s c is String.rindex_from s (length s - 1) c.

        val rindex_opt : string -> char -> int option

        rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

        • since 4.05

        Strings and Sequences

        val to_seq : t -> char Seq.t

        to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        to_seqi s is like to_seq but also tuples the corresponding index.

        • since 4.07
        val of_seq : char Seq.t -> t

        of_seq s is a string made of the sequence's characters.

        • since 4.07

        UTF decoding and validations

        • since 4.14

        UTF-8

        val get_utf_8_uchar : t -> int -> Uchar.utf_decode

        get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

        val is_valid_utf_8 : t -> bool

        is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

        UTF-16BE

        val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

        get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

        val is_valid_utf_16be : t -> bool

        is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

        UTF-16LE

        val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

        get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

        val is_valid_utf_16le : t -> bool

        is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

        Binary decoding of integers

        The functions in this section binary decode integers from strings.

        All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

        val get_uint8 : string -> int -> int

        get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

        • since 4.13
        val get_int8 : string -> int -> int

        get_int8 b i is b's signed 8-bit integer starting at character index i.

        • since 4.13
        val get_uint16_ne : string -> int -> int

        get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_be : string -> int -> int

        get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_le : string -> int -> int

        get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_ne : string -> int -> int

        get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_be : string -> int -> int

        get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_le : string -> int -> int

        get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int32_ne : string -> int -> int32

        get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

        • since 4.13
        val hash : t -> int

        An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        • since 5.0
        val seeded_hash : int -> t -> int

        A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.0
        val get_int32_be : string -> int -> int32

        get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int32_le : string -> int -> int32

        get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int64_ne : string -> int -> int64

        get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_be : string -> int -> int64

        get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_le : string -> int -> int64

        get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

        • since 4.13
        + +---+---+---+---+ +-----+
        • An index i of s is an integer in the range [0;n-1]. It represents the ith byte (character) of s which can be accessed using the constant time string indexing operator s.[i].
        • A position i of s is an integer in the range [0;n]. It represents either the point at the beginning of the string, or the point between two indices, or the point at the end of the string. The ith byte index is between position i and i+1.

        Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

        Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

        Past mutability. Before OCaml 4.02, strings used to be modifiable in place like Bytes.t mutable sequences of bytes. OCaml 4 had various compiler flags and configuration options to support the transition period from mutable to immutable strings. Those options are no longer available, and strings are now always immutable.

        The labeled version of this module can be used as described in the StdLabels module.

        Strings

        type t = string

        The type for strings.

        val make : int -> char -> string

        make n c is a string of length n with each index holding the character c.

        val init : int -> (int -> char) -> string

        init n f is a string of length n with index i holding the character f i (called in increasing index order).

        • since 4.02
        val empty : string

        The empty string.

        • since 4.13
        val length : string -> int

        length s is the length (number of bytes/characters) of s.

        val get : string -> int -> char

        get s i is the character at index i in s. This is the same as writing s.[i].

        val of_bytes : bytes -> string

        Return a new string that contains the same bytes as the given byte sequence.

        • since 4.13
        val to_bytes : string -> bytes

        Return a new byte sequence that contains the same bytes as the given string.

        • since 4.13
        val blit : string -> int -> bytes -> int -> int -> unit

        Same as Bytes.blit_string which should be preferred.

        Concatenating

        Note. The Stdlib.(^) binary operator concatenates two strings.

        val concat : string -> string list -> string

        concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

        val cat : string -> string -> string

        cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

        • since 4.13

        Predicates and comparisons

        val equal : t -> t -> bool

        equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

        • since 4.03 (4.05 in StringLabels)
        val compare : t -> t -> int

        compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

        val starts_with : prefix:string -> string -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:string -> string -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13
        val contains_from : string -> int -> char -> bool

        contains_from s start c is true if and only if c appears in s after position start.

        val rcontains_from : string -> int -> char -> bool

        rcontains_from s stop c is true if and only if c appears in s before position stop+1.

        val contains : string -> char -> bool

        contains s c is String.contains_from s 0 c.

        Extracting substrings

        val sub : string -> int -> int -> string

        sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

        val split_on_char : char -> string -> string list

        split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep. If s is empty, the result is the singleton list [""].

        The function's result is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
        • No string in the result contains the sep character.
        • since 4.04 (4.05 in StringLabels)

        Transforming

        val map : (char -> char) -> string -> string

        map f s is the string resulting from applying f to all the characters of s in increasing order.

        • since 4.00
        val mapi : (int -> char -> char) -> string -> string

        mapi f s is like map but the index of the character is also passed to f.

        • since 4.02
        val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc

        fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

        • since 4.13
        val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc

        fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

        • since 4.13
        val for_all : (char -> bool) -> string -> bool

        for_all p s checks if all characters in s satisfy the predicate p.

        • since 4.13
        val exists : (char -> bool) -> string -> bool

        exists p s checks if at least one character of s satisfies the predicate p.

        • since 4.13
        val trim : string -> string

        trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

        • since 4.00
        val escaped : string -> string

        escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

        All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

        The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

        val uppercase_ascii : string -> string

        uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)
        val lowercase_ascii : string -> string

        lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)
        val capitalize_ascii : string -> string

        capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)
        val uncapitalize_ascii : string -> string

        uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

        • since 4.03 (4.05 in StringLabels)

        Traversing

        val iter : (char -> unit) -> string -> unit

        iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

        val iteri : (int -> char -> unit) -> string -> unit

        iteri is like iter, but the function is also given the corresponding character index.

        • since 4.00

        Searching

        val index_from : string -> int -> char -> int

        index_from s i c is the index of the first occurrence of c in s after position i.

        • raises Not_found

          if c does not occur in s after position i.

        val index_from_opt : string -> int -> char -> int option

        index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

        • since 4.05
        val rindex_from : string -> int -> char -> int

        rindex_from s i c is the index of the last occurrence of c in s before position i+1.

        • raises Not_found

          if c does not occur in s before position i+1.

        val rindex_from_opt : string -> int -> char -> int option

        rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

        • since 4.05
        val index : string -> char -> int

        index s c is String.index_from s 0 c.

        val index_opt : string -> char -> int option

        index_opt s c is String.index_from_opt s 0 c.

        • since 4.05
        val rindex : string -> char -> int

        rindex s c is String.rindex_from s (length s - 1) c.

        val rindex_opt : string -> char -> int option

        rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

        • since 4.05

        Strings and Sequences

        val to_seq : t -> char Seq.t

        to_seq s is a sequence made of the string's characters in increasing order.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        to_seqi s is like to_seq but also tuples the corresponding index.

        • since 4.07
        val of_seq : char Seq.t -> t

        of_seq s is a string made of the sequence's characters.

        • since 4.07

        UTF decoding and validations

        • since 4.14

        UTF-8

        val get_utf_8_uchar : t -> int -> Uchar.utf_decode

        get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

        val is_valid_utf_8 : t -> bool

        is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

        UTF-16BE

        val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

        get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

        val is_valid_utf_16be : t -> bool

        is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

        UTF-16LE

        val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

        get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

        val is_valid_utf_16le : t -> bool

        is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

        Binary decoding of integers

        The functions in this section binary decode integers from strings.

        All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

        val get_uint8 : string -> int -> int

        get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

        • since 4.13
        val get_int8 : string -> int -> int

        get_int8 b i is b's signed 8-bit integer starting at character index i.

        • since 4.13
        val get_uint16_ne : string -> int -> int

        get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_be : string -> int -> int

        get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_le : string -> int -> int

        get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_ne : string -> int -> int

        get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_be : string -> int -> int

        get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_le : string -> int -> int

        get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int32_ne : string -> int -> int32

        get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

        • since 4.13
        val hash : t -> int

        An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        • since 5.0
        val seeded_hash : int -> t -> int

        A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.0
        val get_int32_be : string -> int -> int32

        get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int32_le : string -> int -> int32

        get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int64_ne : string -> int -> int64

        get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_be : string -> int -> int64

        get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_le : string -> int -> int64

        get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

        • since 4.13
        diff --git a/ocaml/Stdlib/StringLabels/index.html b/ocaml/Stdlib/StringLabels/index.html index 2d595722..ee781b7c 100644 --- a/ocaml/Stdlib/StringLabels/index.html +++ b/ocaml/Stdlib/StringLabels/index.html @@ -8,5 +8,5 @@ dst:bytes -> dst_pos:int -> len:int -> - unit

        Same as Bytes.blit_string which should be preferred.

        Concatenating

        Note. The Stdlib.(^) binary operator concatenates two strings.

        val concat : sep:string -> string list -> string

        concat ~sep ss concatenates the list of strings ss, inserting the separator string sep between each.

        val cat : string -> string -> string

        cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

        • since 4.13

        Predicates and comparisons

        val equal : t -> t -> bool

        equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

        • since 4.05
        val compare : t -> t -> int

        compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

        val starts_with : prefix:string -> string -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:string -> string -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13
        val contains_from : string -> int -> char -> bool

        contains_from s start c is true if and only if c appears in s after position start.

        val rcontains_from : string -> int -> char -> bool

        rcontains_from s stop c is true if and only if c appears in s before position stop+1.

        val contains : string -> char -> bool

        contains s c is String.contains_from s 0 c.

        Extracting substrings

        val sub : string -> pos:int -> len:int -> string

        sub s ~pos ~len is a string of length len, containing the substring of s that starts at position pos and has length len.

        val split_on_char : sep:char -> string -> string list

        split_on_char ~sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

        The function's result is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) - (split_on_char sep s) = s).
        • No string in the result contains the sep character.
        • since 4.05

        Transforming

        val map : f:(char -> char) -> string -> string

        map f s is the string resulting from applying f to all the characters of s in increasing order.

        • since 4.00
        val mapi : f:(int -> char -> char) -> string -> string

        mapi ~f s is like map but the index of the character is also passed to f.

        • since 4.02
        val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> string -> 'acc

        fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

        • since 4.13
        val fold_right : f:(char -> 'acc -> 'acc) -> string -> init:'acc -> 'acc

        fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

        • since 4.13
        val for_all : f:(char -> bool) -> string -> bool

        for_all p s checks if all characters in s satisfy the predicate p.

        • since 4.13
        val exists : f:(char -> bool) -> string -> bool

        exists p s checks if at least one character of s satisfies the predicate p.

        • since 4.13
        val trim : string -> string

        trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

        • since 4.00
        val escaped : string -> string

        escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

        All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

        The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

        val uppercase_ascii : string -> string

        uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.05
        val lowercase_ascii : string -> string

        lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.05
        val capitalize_ascii : string -> string

        capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

        • since 4.05
        val uncapitalize_ascii : string -> string

        uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

        • since 4.05

        Traversing

        val iter : f:(char -> unit) -> string -> unit

        iter ~f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

        val iteri : f:(int -> char -> unit) -> string -> unit

        iteri is like iter, but the function is also given the corresponding character index.

        • since 4.00

        Searching

        val index_from : string -> int -> char -> int

        index_from s i c is the index of the first occurrence of c in s after position i.

        • raises Not_found

          if c does not occur in s after position i.

        val index_from_opt : string -> int -> char -> int option

        index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

        • since 4.05
        val rindex_from : string -> int -> char -> int

        rindex_from s i c is the index of the last occurrence of c in s before position i+1.

        • raises Not_found

          if c does not occur in s before position i+1.

        val rindex_from_opt : string -> int -> char -> int option

        rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

        • since 4.05
        val index : string -> char -> int

        index s c is String.index_from s 0 c.

        val index_opt : string -> char -> int option

        index_opt s c is String.index_from_opt s 0 c.

        • since 4.05
        val rindex : string -> char -> int

        rindex s c is String.rindex_from s (length s - 1) c.

        val rindex_opt : string -> char -> int option

        rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

        • since 4.05

        Strings and Sequences

        val to_seq : t -> char Seq.t

        to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        to_seqi s is like to_seq but also tuples the corresponding index.

        • since 4.07
        val of_seq : char Seq.t -> t

        of_seq s is a string made of the sequence's characters.

        • since 4.07

        UTF decoding and validations

        • since 4.14

        UTF-8

        val get_utf_8_uchar : t -> int -> Uchar.utf_decode

        get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

        val is_valid_utf_8 : t -> bool

        is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

        UTF-16BE

        val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

        get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

        val is_valid_utf_16be : t -> bool

        is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

        UTF-16LE

        val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

        get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

        val is_valid_utf_16le : t -> bool

        is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

        Binary decoding of integers

        The functions in this section binary decode integers from strings.

        All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

        val get_uint8 : string -> int -> int

        get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

        • since 4.13
        val get_int8 : string -> int -> int

        get_int8 b i is b's signed 8-bit integer starting at character index i.

        • since 4.13
        val get_uint16_ne : string -> int -> int

        get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_be : string -> int -> int

        get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_le : string -> int -> int

        get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_ne : string -> int -> int

        get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_be : string -> int -> int

        get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_le : string -> int -> int

        get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int32_ne : string -> int -> int32

        get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

        • since 4.13
        val hash : t -> int

        An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        • since 5.0
        val seeded_hash : int -> t -> int

        A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.0
        val get_int32_be : string -> int -> int32

        get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int32_le : string -> int -> int32

        get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int64_ne : string -> int -> int64

        get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_be : string -> int -> int64

        get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_le : string -> int -> int64

        get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

        • since 4.13
        + unit

        Same as Bytes.blit_string which should be preferred.

        Concatenating

        Note. The Stdlib.(^) binary operator concatenates two strings.

        val concat : sep:string -> string list -> string

        concat ~sep ss concatenates the list of strings ss, inserting the separator string sep between each.

        val cat : string -> string -> string

        cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

        • since 4.13

        Predicates and comparisons

        val equal : t -> t -> bool

        equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

        • since 4.05
        val compare : t -> t -> int

        compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

        val starts_with : prefix:string -> string -> bool

        starts_with ~prefix s is true if and only if s starts with prefix.

        • since 4.13
        val ends_with : suffix:string -> string -> bool

        ends_with ~suffix s is true if and only if s ends with suffix.

        • since 4.13
        val contains_from : string -> int -> char -> bool

        contains_from s start c is true if and only if c appears in s after position start.

        val rcontains_from : string -> int -> char -> bool

        rcontains_from s stop c is true if and only if c appears in s before position stop+1.

        val contains : string -> char -> bool

        contains s c is String.contains_from s 0 c.

        Extracting substrings

        val sub : string -> pos:int -> len:int -> string

        sub s ~pos ~len is a string of length len, containing the substring of s that starts at position pos and has length len.

        val split_on_char : sep:char -> string -> string list

        split_on_char ~sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep. If s is empty, the result is the singleton list [""].

        The function's result is specified by the following invariants:

        • The list is not empty.
        • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
        • No string in the result contains the sep character.
        • since 4.05

        Transforming

        val map : f:(char -> char) -> string -> string

        map f s is the string resulting from applying f to all the characters of s in increasing order.

        • since 4.00
        val mapi : f:(int -> char -> char) -> string -> string

        mapi ~f s is like map but the index of the character is also passed to f.

        • since 4.02
        val fold_left : f:('acc -> char -> 'acc) -> init:'acc -> string -> 'acc

        fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

        • since 4.13
        val fold_right : f:(char -> 'acc -> 'acc) -> string -> init:'acc -> 'acc

        fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

        • since 4.13
        val for_all : f:(char -> bool) -> string -> bool

        for_all p s checks if all characters in s satisfy the predicate p.

        • since 4.13
        val exists : f:(char -> bool) -> string -> bool

        exists p s checks if at least one character of s satisfies the predicate p.

        • since 4.13
        val trim : string -> string

        trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

        • since 4.00
        val escaped : string -> string

        escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

        All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

        The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

        val uppercase_ascii : string -> string

        uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

        • since 4.05
        val lowercase_ascii : string -> string

        lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

        • since 4.05
        val capitalize_ascii : string -> string

        capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

        • since 4.05
        val uncapitalize_ascii : string -> string

        uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

        • since 4.05

        Traversing

        val iter : f:(char -> unit) -> string -> unit

        iter ~f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

        val iteri : f:(int -> char -> unit) -> string -> unit

        iteri is like iter, but the function is also given the corresponding character index.

        • since 4.00

        Searching

        val index_from : string -> int -> char -> int

        index_from s i c is the index of the first occurrence of c in s after position i.

        • raises Not_found

          if c does not occur in s after position i.

        val index_from_opt : string -> int -> char -> int option

        index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

        • since 4.05
        val rindex_from : string -> int -> char -> int

        rindex_from s i c is the index of the last occurrence of c in s before position i+1.

        • raises Not_found

          if c does not occur in s before position i+1.

        val rindex_from_opt : string -> int -> char -> int option

        rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

        • since 4.05
        val index : string -> char -> int

        index s c is String.index_from s 0 c.

        val index_opt : string -> char -> int option

        index_opt s c is String.index_from_opt s 0 c.

        • since 4.05
        val rindex : string -> char -> int

        rindex s c is String.rindex_from s (length s - 1) c.

        val rindex_opt : string -> char -> int option

        rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

        • since 4.05

        Strings and Sequences

        val to_seq : t -> char Seq.t

        to_seq s is a sequence made of the string's characters in increasing order.

        • since 4.07
        val to_seqi : t -> (int * char) Seq.t

        to_seqi s is like to_seq but also tuples the corresponding index.

        • since 4.07
        val of_seq : char Seq.t -> t

        of_seq s is a string made of the sequence's characters.

        • since 4.07

        UTF decoding and validations

        • since 4.14

        UTF-8

        val get_utf_8_uchar : t -> int -> Uchar.utf_decode

        get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

        val is_valid_utf_8 : t -> bool

        is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

        UTF-16BE

        val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

        get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

        val is_valid_utf_16be : t -> bool

        is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

        UTF-16LE

        val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

        get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

        val is_valid_utf_16le : t -> bool

        is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

        Binary decoding of integers

        The functions in this section binary decode integers from strings.

        All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

        Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

        32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

        8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

        val get_uint8 : string -> int -> int

        get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

        • since 4.13
        val get_int8 : string -> int -> int

        get_int8 b i is b's signed 8-bit integer starting at character index i.

        • since 4.13
        val get_uint16_ne : string -> int -> int

        get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_be : string -> int -> int

        get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_uint16_le : string -> int -> int

        get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_ne : string -> int -> int

        get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_be : string -> int -> int

        get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int16_le : string -> int -> int

        get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

        • since 4.13
        val get_int32_ne : string -> int -> int32

        get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

        • since 4.13
        val hash : t -> int

        An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

        • since 5.0
        val seeded_hash : int -> t -> int

        A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

        • since 5.0
        val get_int32_be : string -> int -> int32

        get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int32_le : string -> int -> int32

        get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

        • since 4.13
        val get_int64_ne : string -> int -> int64

        get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_be : string -> int -> int64

        get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

        • since 4.13
        val get_int64_le : string -> int -> int64

        get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

        • since 4.13
        diff --git a/ocaml/Stdlib/Sys/index.html b/ocaml/Stdlib/Sys/index.html index 960363d5..4ef6c545 100644 --- a/ocaml/Stdlib/Sys/index.html +++ b/ocaml/Stdlib/Sys/index.html @@ -1,4 +1,4 @@ -Sys (ocaml.Stdlib.Sys)

        Module Stdlib.Sys

        System interface.

        Every function in this module raises Sys_error with an informative message when the underlying system call signal an error.

        val argv : string array

        The command line arguments given to the process. The first element is the command name used to invoke the program. The following elements are the command-line arguments given to the program.

        val executable_name : string

        The name of the file containing the executable currently running. This name may be absolute or relative to the current directory, depending on the platform and whether the program was compiled to bytecode or a native executable.

        val file_exists : string -> bool

        Test if a file with the given name exists.

        val is_directory : string -> bool

        Returns true if the given name refers to a directory, false if it refers to another kind of file.

        • raises Sys_error

          if no file exists with the given name.

        • since 3.10
        val is_regular_file : string -> bool

        Returns true if the given name refers to a regular file, false if it refers to another kind of file.

        • raises Sys_error

          if no file exists with the given name.

        • since 5.1
        val remove : string -> unit

        Remove the given file name from the file system.

        val rename : string -> string -> unit

        Rename a file or directory. rename oldpath newpath renames the file or directory called oldpath, giving it newpath as its new name, moving it between (parent) directories if needed. If a file named newpath already exists, its contents will be replaced with those of oldpath. Depending on the operating system, the metadata (permissions, owner, etc) of newpath can either be preserved or be replaced by those of oldpath.

        • since 4.06 concerning the "replace existing file" behavior
        val getenv : string -> string

        Return the value associated to a variable in the process environment.

        val getenv_opt : string -> string option

        Return the value associated to a variable in the process environment or None if the variable is unbound.

        • since 4.05
        val command : string -> int

        Execute the given shell command and return its exit code.

        The argument of Sys.command is generally the name of a command followed by zero, one or several arguments, separated by whitespace. The given argument is interpreted by a shell: either the Windows shell cmd.exe for the Win32 ports of OCaml, or the POSIX shell sh for other ports. It can contain shell builtin commands such as echo, and also special characters such as file redirections > and <, which will be honored by the shell.

        Conversely, whitespace or special shell characters occurring in command names or in their arguments must be quoted or escaped so that the shell does not interpret them. The quoting rules vary between the POSIX shell and the Windows shell. The Filename.quote_command performs the appropriate quoting given a command name, a list of arguments, and optional file redirections.

        val time : unit -> float

        Return the processor time, in seconds, used by the program since the beginning of execution.

        val chdir : string -> unit

        Change the current working directory of the process.

        val mkdir : string -> int -> unit

        Create a directory with the given permissions.

        • since 4.12
        val rmdir : string -> unit

        Remove an empty directory.

        • since 4.12
        val getcwd : unit -> string

        Return the current working directory of the process.

        val readdir : string -> string array

        Return the names of all files present in the given directory. Names denoting the current directory and the parent directory ("." and ".." in Unix) are not returned. Each string in the result is a file name rather than a complete path. There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

        val interactive : bool ref

        This reference is initially set to false in standalone programs and to true if the code is being executed under the interactive toplevel system ocaml.

        • alert unsynchronized_access The interactive status is a mutable global state.
        val os_type : string

        Operating system currently executing the OCaml program. One of

        • "Unix" (for all Unix versions, including Linux and Mac OS X),
        • "Win32" (for MS-Windows, OCaml compiled with MSVC++ or MinGW-w64),
        • "Cygwin" (for MS-Windows, OCaml compiled with Cygwin).
        type backend_type =
        1. | Native
        2. | Bytecode
        3. | Other of string

        Currently, the official distribution only supports Native and Bytecode, but it can be other backends with alternative compilers, for example, javascript.

        • since 4.04
        val backend_type : backend_type

        Backend type currently executing the OCaml program.

        • since 4.04
        val unix : bool

        True if Sys.os_type = "Unix".

        • since 4.01
        val win32 : bool

        True if Sys.os_type = "Win32".

        • since 4.01
        val cygwin : bool

        True if Sys.os_type = "Cygwin".

        • since 4.01
        val word_size : int

        Size of one word on the machine currently executing the OCaml program, in bits: 32 or 64.

        val int_size : int

        Size of int, in bits. It is 31 (resp. 63) when using OCaml on a 32-bit (resp. 64-bit) platform. It may differ for other implementations, e.g. it can be 32 bits when compiling to JavaScript.

        • since 4.03
        val big_endian : bool

        Whether the machine currently executing the Caml program is big-endian.

        • since 4.00
        val max_string_length : int

        Maximum length of strings and byte sequences.

        val max_array_length : int

        Maximum length of a normal array (i.e. any array whose elements are not of type float). The maximum length of a float array is max_floatarray_length if OCaml was configured with --enable-flat-float-array and max_array_length if configured with --disable-flat-float-array.

        val max_floatarray_length : int

        Maximum length of a floatarray. This is also the maximum length of a float array when OCaml is configured with --enable-flat-float-array.

        val runtime_variant : unit -> string

        Return the name of the runtime variant the program is running on. This is normally the argument given to -runtime-variant at compile time, but for byte-code it can be changed after compilation.

        • since 4.03
        val runtime_parameters : unit -> string

        Return the value of the runtime parameters, in the same format as the contents of the OCAMLRUNPARAM environment variable.

        • since 4.03

        Signal handling

        type signal_behavior =
        1. | Signal_default
        2. | Signal_ignore
        3. | Signal_handle of int -> unit

        What to do when receiving a signal:

        • Signal_default: take the default behavior (usually: abort the program)
        • Signal_ignore: ignore the signal
        • Signal_handle f: call function f, giving it the signal number as argument.
        val signal : int -> signal_behavior -> signal_behavior

        Set the behavior of the system on receipt of a given signal. The first argument is the signal number. Return the behavior previously associated with the signal. If the signal number is invalid (or not available on your system), an Invalid_argument exception is raised.

        val set_signal : int -> signal_behavior -> unit

        Same as Sys.signal but return value is ignored.

        Signal numbers for the standard POSIX signals.

        val sigabrt : int

        Abnormal termination

        val sigalrm : int

        Timeout

        val sigfpe : int

        Arithmetic exception

        val sighup : int

        Hangup on controlling terminal

        val sigill : int

        Invalid hardware instruction

        val sigint : int

        Interactive interrupt (ctrl-C)

        val sigkill : int

        Termination (cannot be ignored)

        val sigpipe : int

        Broken pipe

        val sigquit : int

        Interactive termination

        val sigsegv : int

        Invalid memory reference

        val sigterm : int

        Termination

        val sigusr1 : int

        Application-defined signal 1

        val sigusr2 : int

        Application-defined signal 2

        val sigchld : int

        Child process terminated

        val sigcont : int

        Continue

        val sigstop : int

        Stop

        val sigtstp : int

        Interactive stop

        val sigttin : int

        Terminal read from background process

        val sigttou : int

        Terminal write from background process

        val sigvtalrm : int

        Timeout in virtual time

        val sigprof : int

        Profiling interrupt

        val sigbus : int

        Bus error

        • since 4.03
        val sigpoll : int

        Pollable event

        • since 4.03
        val sigsys : int

        Bad argument to routine

        • since 4.03
        val sigtrap : int

        Trace/breakpoint trap

        • since 4.03
        val sigurg : int

        Urgent condition on socket

        • since 4.03
        val sigxcpu : int

        Timeout in cpu time

        • since 4.03
        val sigxfsz : int

        File size limit exceeded

        • since 4.03
        exception Break

        Exception raised on interactive interrupt if Sys.catch_break is on.

        val catch_break : bool -> unit

        catch_break governs whether interactive interrupt (ctrl-C) terminates the program or raises the Break exception. Call catch_break true to enable raising Break, and catch_break false to let the system terminate the program on user interrupt.

        val ocaml_version : string

        ocaml_version is the version of OCaml. It is a string of the form "major.minor[.patchlevel][(+|~)additional-info]", where major, minor, and patchlevel are integers, and additional-info is an arbitrary string. The [.patchlevel] part was absent before version 3.08.0 and became mandatory from 3.08.0 onwards. The [(+|~)additional-info] part may be absent.

        val development_version : bool

        true if this is a development version, false otherwise.

        • since 4.14
        type extra_prefix =
        1. | Plus
        2. | Tilde
          (*
          • since 4.14
          *)
        type extra_info = extra_prefix * string
        • since 4.14
        type ocaml_release_info = {
        1. major : int;
        2. minor : int;
        3. patchlevel : int;
        4. extra : extra_info option;
        }
        • since 4.14
        val ocaml_release : ocaml_release_info

        ocaml_release is the version of OCaml.

        • since 4.14
        val enable_runtime_warnings : bool -> unit

        Control whether the OCaml runtime system can emit warnings on stderr. Currently, the only supported warning is triggered when a channel created by open_* functions is finalized without being closed. Runtime warnings are disabled by default.

        • since 4.03
        • alert unsynchronized_access The status of runtime warnings is a mutable global state.
        val runtime_warnings_enabled : unit -> bool

        Return whether runtime warnings are currently enabled.

        • since 4.03
        • alert unsynchronized_access The status of runtime warnings is a mutable global state.

        Optimization

        val opaque_identity : 'a -> 'a

        For the purposes of optimization, opaque_identity behaves like an unknown (and thus possibly side-effecting) function.

        At runtime, opaque_identity disappears altogether.

        A typical use of this function is to prevent pure computations from being optimized away in benchmarking loops. For example:

        for _round = 1 to 100_000 do
        +Sys (ocaml.Stdlib.Sys)

        Module Stdlib.Sys

        System interface.

        Every function in this module raises Sys_error with an informative message when the underlying system call signal an error.

        val argv : string array

        The command line arguments given to the process. The first element is the command name used to invoke the program. The following elements are the command-line arguments given to the program.

        val executable_name : string

        The name of the file containing the executable currently running. This name may be absolute or relative to the current directory, depending on the platform and whether the program was compiled to bytecode or a native executable.

        val file_exists : string -> bool

        Test if a file with the given name exists.

        val is_directory : string -> bool

        Returns true if the given name refers to a directory, false if it refers to another kind of file.

        • raises Sys_error

          if no file exists with the given name.

        • since 3.10
        val is_regular_file : string -> bool

        Returns true if the given name refers to a regular file, false if it refers to another kind of file.

        • raises Sys_error

          if no file exists with the given name.

        • since 5.1
        val remove : string -> unit

        Remove the given file name from the file system.

        val rename : string -> string -> unit

        Rename a file or directory. rename oldpath newpath renames the file or directory called oldpath, giving it newpath as its new name, moving it between (parent) directories if needed. If a file named newpath already exists, its contents will be replaced with those of oldpath. Depending on the operating system, the metadata (permissions, owner, etc) of newpath can either be preserved or be replaced by those of oldpath.

        • since 4.06 concerning the "replace existing file" behavior
        val getenv : string -> string

        Return the value associated to a variable in the process environment.

        val getenv_opt : string -> string option

        Return the value associated to a variable in the process environment or None if the variable is unbound.

        • since 4.05
        val command : string -> int

        Execute the given shell command and return its exit code.

        The argument of Sys.command is generally the name of a command followed by zero, one or several arguments, separated by whitespace. The given argument is interpreted by a shell: either the Windows shell cmd.exe for the Win32 ports of OCaml, or the POSIX shell sh for other ports. It can contain shell builtin commands such as echo, and also special characters such as file redirections > and <, which will be honored by the shell.

        Conversely, whitespace or special shell characters occurring in command names or in their arguments must be quoted or escaped so that the shell does not interpret them. The quoting rules vary between the POSIX shell and the Windows shell. The Filename.quote_command performs the appropriate quoting given a command name, a list of arguments, and optional file redirections.

        val time : unit -> float

        Return the processor time, in seconds, used by the program since the beginning of execution.

        val chdir : string -> unit

        Change the current working directory of the process.

        val mkdir : string -> int -> unit

        Create a directory with the given permissions.

        • since 4.12
        val rmdir : string -> unit

        Remove an empty directory.

        • since 4.12
        val getcwd : unit -> string

        Return the current working directory of the process.

        val readdir : string -> string array

        Return the names of all files present in the given directory. Names denoting the current directory and the parent directory ("." and ".." in Unix) are not returned. Each string in the result is a file name rather than a complete path. There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

        val interactive : bool ref

        This reference is initially set to false in standalone programs and to true if the code is being executed under the interactive toplevel system ocaml.

        • alert unsynchronized_access The interactive status is a mutable global state.
        val os_type : string

        Operating system currently executing the OCaml program. One of

        • "Unix" (for all Unix versions, including Linux and Mac OS X),
        • "Win32" (for MS-Windows, OCaml compiled with MSVC++ or MinGW-w64),
        • "Cygwin" (for MS-Windows, OCaml compiled with Cygwin).
        type backend_type =
        1. | Native
        2. | Bytecode
        3. | Other of string

        Currently, the official distribution only supports Native and Bytecode, but it can be other backends with alternative compilers, for example, javascript.

        • since 4.04
        val backend_type : backend_type

        Backend type currently executing the OCaml program.

        • since 4.04
        val unix : bool

        True if Sys.os_type = "Unix".

        • since 4.01
        val win32 : bool

        True if Sys.os_type = "Win32".

        • since 4.01
        val cygwin : bool

        True if Sys.os_type = "Cygwin".

        • since 4.01
        val word_size : int

        Size of one word on the machine currently executing the OCaml program, in bits: 32 or 64.

        val int_size : int

        Size of int, in bits. It is 31 (resp. 63) when using OCaml on a 32-bit (resp. 64-bit) platform. It may differ for other implementations, e.g. it can be 32 bits when compiling to JavaScript.

        • since 4.03
        val big_endian : bool

        Whether the machine currently executing the Caml program is big-endian.

        • since 4.00
        val max_string_length : int

        Maximum length of strings and byte sequences.

        val max_array_length : int

        Maximum length of a normal array (i.e. any array whose elements are not of type float). The maximum length of a float array is max_floatarray_length if OCaml was configured with --enable-flat-float-array and max_array_length if configured with --disable-flat-float-array.

        val max_floatarray_length : int

        Maximum length of a floatarray. This is also the maximum length of a float array when OCaml is configured with --enable-flat-float-array.

        val runtime_variant : unit -> string

        Return the name of the runtime variant the program is running on. This is normally the argument given to -runtime-variant at compile time, but for byte-code it can be changed after compilation.

        • since 4.03
        val runtime_parameters : unit -> string

        Return the value of the runtime parameters, in the same format as the contents of the OCAMLRUNPARAM environment variable.

        • since 4.03
        val poll_actions : unit -> unit

        Run any pending runtime actions, such as minor collections, major GC slices, signal handlers, finalizers, or memprof callbacks.

        • since 5.3

        Signal handling

        type signal_behavior =
        1. | Signal_default
        2. | Signal_ignore
        3. | Signal_handle of int -> unit

        What to do when receiving a signal:

        • Signal_default: take the default behavior (usually: abort the program)
        • Signal_ignore: ignore the signal
        • Signal_handle f: call function f, giving it the signal number as argument.
        val signal : int -> signal_behavior -> signal_behavior

        Set the behavior of the system on receipt of a given signal. The first argument is the signal number. Return the behavior previously associated with the signal. If the signal number is invalid (or not available on your system), an Invalid_argument exception is raised.

        val set_signal : int -> signal_behavior -> unit

        Same as Sys.signal but return value is ignored.

        Signal numbers for the standard POSIX signals.

        val sigabrt : int

        Abnormal termination

        val sigalrm : int

        Timeout

        val sigfpe : int

        Arithmetic exception

        val sighup : int

        Hangup on controlling terminal

        val sigill : int

        Invalid hardware instruction

        val sigint : int

        Interactive interrupt (ctrl-C)

        val sigkill : int

        Termination (cannot be ignored)

        val sigpipe : int

        Broken pipe

        val sigquit : int

        Interactive termination

        val sigsegv : int

        Invalid memory reference

        val sigterm : int

        Termination

        val sigusr1 : int

        Application-defined signal 1

        val sigusr2 : int

        Application-defined signal 2

        val sigchld : int

        Child process terminated

        val sigcont : int

        Continue

        val sigstop : int

        Stop

        val sigtstp : int

        Interactive stop

        val sigttin : int

        Terminal read from background process

        val sigttou : int

        Terminal write from background process

        val sigvtalrm : int

        Timeout in virtual time

        val sigprof : int

        Profiling interrupt

        val sigbus : int

        Bus error

        • since 4.03
        val sigpoll : int

        Pollable event

        • since 4.03
        val sigsys : int

        Bad argument to routine

        • since 4.03
        val sigtrap : int

        Trace/breakpoint trap

        • since 4.03
        val sigurg : int

        Urgent condition on socket

        • since 4.03
        val sigxcpu : int

        Timeout in cpu time

        • since 4.03
        val sigxfsz : int

        File size limit exceeded

        • since 4.03
        exception Break

        Exception raised on interactive interrupt if Sys.catch_break is enabled.

        val catch_break : bool -> unit

        catch_break governs whether interactive interrupt (ctrl-C) terminates the program or raises the Break exception. Call catch_break true to enable raising Break, and catch_break false to let the system terminate the program on user interrupt.

        Inside multi-threaded programs, the Break exception will arise in any one of the active threads, and will keep arising on further interactive interrupt until all threads are terminated. Use signal masks from Thread.sigmask to direct the interrupt towards a specific thread.

        val ocaml_version : string

        ocaml_version is the version of OCaml. It is a string of the form "major.minor[.patchlevel][(+|~)additional-info]", where major, minor, and patchlevel are integers, and additional-info is an arbitrary string. The [.patchlevel] part was absent before version 3.08.0 and became mandatory from 3.08.0 onwards. The [(+|~)additional-info] part may be absent.

        val development_version : bool

        true if this is a development version, false otherwise.

        • since 4.14
        type extra_prefix =
        1. | Plus
        2. | Tilde
          (*
          • since 4.14
          *)
        type extra_info = extra_prefix * string
        • since 4.14
        type ocaml_release_info = {
        1. major : int;
        2. minor : int;
        3. patchlevel : int;
        4. extra : extra_info option;
        }
        • since 4.14
        val ocaml_release : ocaml_release_info

        ocaml_release is the version of OCaml.

        • since 4.14
        val enable_runtime_warnings : bool -> unit

        Control whether the OCaml runtime system can emit warnings on stderr. Currently, the only supported warning is triggered when a channel created by open_* functions is finalized without being closed. Runtime warnings are disabled by default.

        • since 4.03
        • alert unsynchronized_access The status of runtime warnings is a mutable global state.
        val runtime_warnings_enabled : unit -> bool

        Return whether runtime warnings are currently enabled.

        • since 4.03
        • alert unsynchronized_access The status of runtime warnings is a mutable global state.

        Optimization

        val opaque_identity : 'a -> 'a

        For the purposes of optimization, opaque_identity behaves like an unknown (and thus possibly side-effecting) function.

        At runtime, opaque_identity disappears altogether. However, it does prevent the argument from being garbage collected until the location where the call would have occurred.

        A typical use of this function is to prevent pure computations from being optimized away in benchmarking loops. For example:

        for _round = 1 to 100_000 do
           ignore (Sys.opaque_identity (my_pure_computation ()))
         done
        • since 4.03
        module Immediate64 : sig ... end

        This module allows to define a type t with the immediate64 attribute. This attribute means that the type is immediate on 64 bit architectures. On other architectures, it might or might not be immediate.

        diff --git a/ocaml/Stdlib/Uchar/index.html b/ocaml/Stdlib/Uchar/index.html index e9a904c6..17be077e 100644 --- a/ocaml/Stdlib/Uchar/index.html +++ b/ocaml/Stdlib/Uchar/index.html @@ -1,2 +1,2 @@ -Uchar (ocaml.Stdlib.Uchar)

        Module Stdlib.Uchar

        Unicode characters.

        • since 4.03
        type t

        The type for Unicode characters.

        A value of this type represents a Unicode scalar value which is an integer in the ranges 0x0000...0xD7FF or 0xE000...0x10FFFF.

        val min : t

        min is U+0000.

        val max : t

        max is U+10FFFF.

        val bom : t

        bom is U+FEFF, the byte order mark (BOM) character.

        • since 4.06
        val rep : t

        rep is U+FFFD, the replacement character.

        • since 4.06
        val succ : t -> t

        succ u is the scalar value after u in the set of Unicode scalar values.

        val pred : t -> t

        pred u is the scalar value before u in the set of Unicode scalar values.

        val is_valid : int -> bool

        is_valid n is true if and only if n is a Unicode scalar value (i.e. in the ranges 0x0000...0xD7FF or 0xE000...0x10FFFF).

        val of_int : int -> t

        of_int i is i as a Unicode character.

        val to_int : t -> int

        to_int u is u as an integer.

        val is_char : t -> bool

        is_char u is true if and only if u is a latin1 OCaml character.

        val of_char : char -> t

        of_char c is c as a Unicode character.

        val to_char : t -> char

        to_char u is u as an OCaml latin1 character.

        val equal : t -> t -> bool

        equal u u' is u = u'.

        val compare : t -> t -> int

        compare u u' is Stdlib.compare u u'.

        val hash : t -> int

        hash u associates a non-negative integer to u.

        UTF codecs tools

        • since 4.14
        type utf_decode

        The type for UTF decode results. Values of this type represent the result of a Unicode Transformation Format decoding attempt.

        val utf_decode_is_valid : utf_decode -> bool

        utf_decode_is_valid d is true if and only if d holds a valid decode.

        val utf_decode_uchar : utf_decode -> t

        utf_decode_uchar d is the Unicode character decoded by d if utf_decode_is_valid d is true and Uchar.rep otherwise.

        val utf_decode_length : utf_decode -> int

        utf_decode_length d is the number of elements from the source that were consumed by the decode d. This is always strictly positive and smaller or equal to 4. The kind of source elements depends on the actual decoder; for the decoders of the standard library this function always returns a length in bytes.

        val utf_decode : int -> t -> utf_decode

        utf_decode n u is a valid UTF decode for u that consumed n elements from the source for decoding. n must be positive and smaller or equal to 4 (this is not checked by the module).

        val utf_decode_invalid : int -> utf_decode

        utf_decode_invalid n is an invalid UTF decode that consumed n elements from the source to error. n must be positive and smaller or equal to 4 (this is not checked by the module). The resulting decode has rep as the decoded Unicode character.

        val utf_8_byte_length : t -> int

        utf_8_byte_length u is the number of bytes needed to encode u in UTF-8.

        val utf_16_byte_length : t -> int

        utf_16_byte_length u is the number of bytes needed to encode u in UTF-16.

        +Uchar (ocaml.Stdlib.Uchar)

        Module Stdlib.Uchar

        Unicode characters.

        • since 4.03
        type t

        The type for Unicode characters.

        A value of this type represents a Unicode scalar value which is an integer in the ranges 0x0000...0xD7FF or 0xE000...0x10FFFF.

        val min : t

        min is U+0000.

        val max : t

        max is U+10FFFF.

        val bom : t

        bom is U+FEFF, the byte order mark (BOM) character.

        • since 4.06
        val rep : t

        rep is U+FFFD, the replacement character.

        • since 4.06
        val succ : t -> t

        succ u is the scalar value after u in the set of Unicode scalar values.

        val pred : t -> t

        pred u is the scalar value before u in the set of Unicode scalar values.

        val is_valid : int -> bool

        is_valid n is true if and only if n is a Unicode scalar value (i.e. in the ranges 0x0000...0xD7FF or 0xE000...0x10FFFF).

        val of_int : int -> t

        of_int i is i as a Unicode character.

        val to_int : t -> int

        to_int u is u as an integer.

        val is_char : t -> bool

        is_char u is true if and only if u is a latin1 OCaml character.

        val of_char : char -> t

        of_char c is c as a Unicode character.

        val to_char : t -> char

        to_char u is u as an OCaml latin1 character.

        val equal : t -> t -> bool

        equal u u' is u = u'.

        val compare : t -> t -> int

        compare u u' is Stdlib.compare u u'.

        val seeded_hash : int -> t -> int

        seeded_hash seed u A seeded hash function with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as an argument to the functor Hashtbl.MakeSeeded.

        • since 5.3
        val hash : t -> int

        An unseeded hash function with the same output value as Hashtbl.hash. This function allows this module to be passed as an argument to the functor Hashtbl.Make.

        • since 5.3

        UTF codecs tools

        • since 4.14
        type utf_decode

        The type for UTF decode results. Values of this type represent the result of a Unicode Transformation Format decoding attempt.

        val utf_decode_is_valid : utf_decode -> bool

        utf_decode_is_valid d is true if and only if d holds a valid decode.

        val utf_decode_uchar : utf_decode -> t

        utf_decode_uchar d is the Unicode character decoded by d if utf_decode_is_valid d is true and Uchar.rep otherwise.

        val utf_decode_length : utf_decode -> int

        utf_decode_length d is the number of elements from the source that were consumed by the decode d. This is always strictly positive and smaller or equal to 4. The kind of source elements depends on the actual decoder; for the decoders of the standard library this function always returns a length in bytes.

        val utf_decode : int -> t -> utf_decode

        utf_decode n u is a valid UTF decode for u that consumed n elements from the source for decoding. n must be positive and smaller or equal to 4 (this is not checked by the module).

        val utf_decode_invalid : int -> utf_decode

        utf_decode_invalid n is an invalid UTF decode that consumed n elements from the source to error. n must be positive and smaller or equal to 4 (this is not checked by the module). The resulting decode has rep as the decoded Unicode character.

        val utf_8_byte_length : t -> int

        utf_8_byte_length u is the number of bytes needed to encode u in UTF-8.

        val utf_16_byte_length : t -> int

        utf_16_byte_length u is the number of bytes needed to encode u in UTF-16.

        diff --git a/ocaml/Stdlib/index.html b/ocaml/Stdlib/index.html index f94cc8d5..8d35de9f 100644 --- a/ocaml/Stdlib/index.html +++ b/ocaml/Stdlib/index.html @@ -5,4 +5,4 @@ ('a, 'b, 'c, 'd, 'e, 'f) format6

        format_of_string s returns a format string read from the string literal s. Note: format_of_string can not convert a string argument that is not a literal. If you need this functionality, use the more general Scanf.format_from_string function.

        val (^^) : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('f, 'b, 'c, 'e, 'g, 'h) format6 -> - ('a, 'b, 'c, 'd, 'g, 'h) format6

        f1 ^^ f2 catenates format strings f1 and f2. The result is a format string that behaves as the concatenation of format strings f1 and f2: in case of formatted output, it accepts arguments from f1, then arguments from f2; in case of formatted input, it returns results from f1, then results from f2. Right-associative operator, see Ocaml_operators for more information.

        Program termination

        val exit : int -> 'a

        Terminate the process, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. All open output channels are flushed with flush_all. The callbacks registered with Domain.at_exit are called followed by those registered with Stdlib.at_exit.

        An implicit exit 0 is performed each time a program terminates normally. An implicit exit 2 is performed if the program terminates early because of an uncaught exception.

        val at_exit : (unit -> unit) -> unit

        Register the given function to be called at program termination time. The functions registered with at_exit will be called when the program does any of the following:

        • executes Stdlib.exit
        • terminates, either normally or because of an uncaught exception
        • executes the C function caml_shutdown. The functions are called in 'last in, first out' order: the function most recently added with at_exit is called first.

        Standard library modules

        module Arg : sig ... end

        Parsing of command line arguments.

        module Array : sig ... end

        Array operations.

        module ArrayLabels : sig ... end

        Array operations.

        module Atomic : sig ... end

        Atomic references.

        module Bigarray : sig ... end

        Large, multi-dimensional, numerical arrays.

        module Bool : sig ... end

        Boolean values.

        module Buffer : sig ... end

        Extensible buffers.

        module Bytes : sig ... end

        Byte sequence operations.

        module BytesLabels : sig ... end

        Byte sequence operations.

        module Callback : sig ... end

        Registering OCaml values with the C runtime.

        module Char : sig ... end

        Character operations.

        module Complex : sig ... end

        Complex numbers.

        module Condition : sig ... end

        Condition variables.

        module Digest : sig ... end

        MD5 message digest.

        module Domain : sig ... end
        module Effect : sig ... end
        module Either : sig ... end

        Either type.

        module Ephemeron : sig ... end

        Ephemerons and weak hash tables.

        module Filename : sig ... end

        Operations on file names.

        module Float : sig ... end

        Floating-point arithmetic.

        module Format : sig ... end

        Pretty-printing.

        module Fun : sig ... end

        Function manipulation.

        module Gc : sig ... end

        Memory management control and statistics; finalised values.

        module Hashtbl : sig ... end

        Hash tables and hash functions.

        module In_channel : sig ... end

        Input channels.

        module Int : sig ... end

        Integer values.

        module Int32 : sig ... end

        32-bit integers.

        module Int64 : sig ... end

        64-bit integers.

        module Lazy : sig ... end

        Deferred computations.

        module Lexing : sig ... end

        The run-time library for lexers generated by ocamllex.

        module List : sig ... end

        List operations.

        module ListLabels : sig ... end

        List operations.

        module Map : sig ... end

        Association tables over ordered types.

        module Marshal : sig ... end

        Marshaling of data structures.

        module MoreLabels : sig ... end

        Extra labeled libraries.

        module Mutex : sig ... end

        Locks for mutual exclusion.

        module Nativeint : sig ... end

        Processor-native integers.

        module Obj : sig ... end

        Operations on internal representations of values.

        module Oo : sig ... end

        Operations on objects

        module Option : sig ... end

        Option values.

        module Out_channel : sig ... end

        Output channels.

        module Parsing : sig ... end

        The run-time library for parsers generated by ocamlyacc.

        module Printexc : sig ... end

        Facilities for printing exceptions and inspecting current call stack.

        module Printf : sig ... end

        Formatted output functions.

        module Queue : sig ... end

        First-in first-out queues.

        module Random : sig ... end

        Pseudo-random number generators (PRNG).

        module Result : sig ... end

        Result values.

        module Scanf : sig ... end

        Formatted input functions.

        module Semaphore : sig ... end

        Semaphores

        module Seq : sig ... end

        Sequences.

        module Set : sig ... end

        Sets over ordered types.

        module Stack : sig ... end

        Last-in first-out stacks.

        module StdLabels : sig ... end

        Standard labeled libraries.

        module String : sig ... end

        Strings.

        module StringLabels : sig ... end

        Strings.

        module Sys : sig ... end

        System interface.

        module Type : sig ... end

        Type introspection.

        module Uchar : sig ... end

        Unicode characters.

        module Unit : sig ... end

        Unit values.

        module Weak : sig ... end

        Arrays of weak pointers and hash sets of weak pointers.

        + ('a, 'b, 'c, 'd, 'g, 'h) format6

        f1 ^^ f2 catenates format strings f1 and f2. The result is a format string that behaves as the concatenation of format strings f1 and f2: in case of formatted output, it accepts arguments from f1, then arguments from f2; in case of formatted input, it returns results from f1, then results from f2. Right-associative operator, see Ocaml_operators for more information.

        Program termination

        val exit : int -> 'a

        Terminate the process, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. All open output channels are flushed with flush_all. The callbacks registered with Domain.at_exit are called followed by those registered with Stdlib.at_exit.

        An implicit exit 0 is performed each time a program terminates normally. An implicit exit 2 is performed if the program terminates early because of an uncaught exception.

        val at_exit : (unit -> unit) -> unit

        Register the given function to be called at program termination time. The functions registered with at_exit will be called when the program does any of the following:

        • executes Stdlib.exit
        • terminates, either normally or because of an uncaught exception
        • executes the C function caml_shutdown. The functions are called in 'last in, first out' order: the function most recently added with at_exit is called first.

        Standard library modules

        module Arg : sig ... end

        Parsing of command line arguments.

        module Array : sig ... end

        Array operations.

        module ArrayLabels : sig ... end

        Array operations.

        module Atomic : sig ... end

        Atomic references.

        module Bigarray : sig ... end

        Large, multi-dimensional, numerical arrays.

        module Bool : sig ... end

        Boolean values.

        module Buffer : sig ... end

        Extensible buffers.

        module Bytes : sig ... end

        Byte sequence operations.

        module BytesLabels : sig ... end

        Byte sequence operations.

        module Callback : sig ... end

        Registering OCaml values with the C runtime.

        module Char : sig ... end

        Character operations.

        module Complex : sig ... end

        Complex numbers.

        module Condition : sig ... end

        Condition variables.

        module Digest : sig ... end

        Message digest.

        module Domain : sig ... end
        module Dynarray : sig ... end

        Dynamic arrays.

        module Effect : sig ... end
        module Either : sig ... end

        Either type.

        module Ephemeron : sig ... end

        Ephemerons and weak hash tables.

        module Filename : sig ... end

        Operations on file names.

        module Float : sig ... end

        Floating-point arithmetic.

        module Format : sig ... end

        Pretty-printing.

        module Fun : sig ... end

        Function manipulation.

        module Gc : sig ... end

        Memory management control and statistics; finalised values.

        module Hashtbl : sig ... end

        Hash tables and hash functions.

        module In_channel : sig ... end

        Input channels.

        module Int : sig ... end

        Integer values.

        module Int32 : sig ... end

        32-bit integers.

        module Int64 : sig ... end

        64-bit integers.

        module Lazy : sig ... end

        Deferred computations.

        module Lexing : sig ... end

        The run-time library for lexers generated by ocamllex.

        module List : sig ... end

        List operations.

        module ListLabels : sig ... end

        List operations.

        module Map : sig ... end

        Association tables over ordered types.

        module Marshal : sig ... end

        Marshaling of data structures.

        module MoreLabels : sig ... end

        Extra labeled libraries.

        module Mutex : sig ... end

        Locks for mutual exclusion.

        module Nativeint : sig ... end

        Processor-native integers.

        module Obj : sig ... end

        Operations on internal representations of values.

        module Oo : sig ... end

        Operations on objects

        module Option : sig ... end

        Option values.

        module Out_channel : sig ... end

        Output channels.

        module Parsing : sig ... end

        The run-time library for parsers generated by ocamlyacc.

        module Printexc : sig ... end

        Facilities for printing exceptions and inspecting current call stack.

        module Printf : sig ... end

        Formatted output functions.

        module Queue : sig ... end

        First-in first-out queues.

        module Random : sig ... end

        Pseudo-random number generators (PRNG).

        module Result : sig ... end

        Result values.

        module Scanf : sig ... end

        Formatted input functions.

        module Semaphore : sig ... end

        Semaphores

        module Seq : sig ... end

        Sequences.

        module Set : sig ... end

        Sets over ordered types.

        module Stack : sig ... end

        Last-in first-out stacks.

        module StdLabels : sig ... end

        Standard labeled libraries.

        module String : sig ... end

        Strings.

        module StringLabels : sig ... end

        Strings.

        module Sys : sig ... end

        System interface.

        module Type : sig ... end

        Type introspection.

        module Uchar : sig ... end

        Unicode characters.

        module Unit : sig ... end

        Unit values.

        module Weak : sig ... end

        Arrays of weak pointers and hash sets of weak pointers.

        diff --git a/ocaml/Stdlib__Dynarray/index.html b/ocaml/Stdlib__Dynarray/index.html new file mode 100644 index 00000000..56ea68fc --- /dev/null +++ b/ocaml/Stdlib__Dynarray/index.html @@ -0,0 +1,2 @@ + +Stdlib__Dynarray (ocaml.Stdlib__Dynarray)

        Module Stdlib__Dynarray

        This module is hidden.

        diff --git a/ocaml/Subst/Unsafe/index.html b/ocaml/Subst/Unsafe/index.html new file mode 100644 index 00000000..71a5a113 --- /dev/null +++ b/ocaml/Subst/Unsafe/index.html @@ -0,0 +1,14 @@ + +Unsafe (ocaml.Subst.Unsafe)

        Module Subst.Unsafe

        type t = unsafe subst

        Unsafe substitutions introduced by with constraints, local substitutions (type t := int * int) or recursive module check.

        val add_modtype : Ident.t -> Types.module_type -> 'any subst -> t

        Replacing a module type name S by a non-path signature is unsafe as the packed module type (module S) becomes ill-formed.

        val add_modtype_path : Path.t -> Types.module_type -> 'any subst -> t
        val add_type_path : Path.t -> Path.t -> t -> t

        Deep editing inside a module type require to retypecheck the module, for applicative functors in path and module aliases.

        val add_type_function : + Path.t -> + params:Types.type_expr list -> + body:Types.type_expr -> + t -> + t
        val add_module_path : Path.t -> Path.t -> t -> t
        type error =
        1. | Fcm_type_substituted_away of Path.t * Types.module_type
        type 'a res := ('a, error) result
        val type_declaration : + t -> + Types.type_declaration -> + Types.type_declaration res
        val signature_item : + scoping -> + t -> + Types.signature_item -> + Types.signature_item res
        val signature : scoping -> t -> Types.signature -> Types.signature res
        val compose : t -> t -> t res

        Composition of substitutions is eager and fails when the two substitution are incompatible, for example module type t := sig end is not compatible with module type s := sig type t=(module t) end

        diff --git a/ocaml/Subst/index.html b/ocaml/Subst/index.html index 4c418d03..0b6df983 100644 --- a/ocaml/Subst/index.html +++ b/ocaml/Subst/index.html @@ -1,16 +1,11 @@ -Subst (ocaml.Subst)

        Module Subst

        type t
        val identity : t
        val add_type : Ident.t -> Path.t -> t -> t
        val add_type_path : Path.t -> Path.t -> t -> t
        val add_type_function : - Path.t -> - params:Types.type_expr list -> - body:Types.type_expr -> - t -> - t
        val add_module : Ident.t -> Path.t -> t -> t
        val add_module_path : Path.t -> Path.t -> t -> t
        val add_modtype : Ident.t -> Types.module_type -> t -> t
        val add_modtype_path : Path.t -> Types.module_type -> t -> t
        val for_saving : t -> t
        val reset_for_saving : unit -> unit
        val change_locs : t -> Location.t -> t
        val module_path : t -> Path.t -> Path.t
        val type_path : t -> Path.t -> Path.t
        val modtype_path : t -> Path.t -> Path.t
        val type_expr : t -> Types.type_expr -> Types.type_expr
        val class_type : t -> Types.class_type -> Types.class_type
        val value_description : t -> Types.value_description -> Types.value_description
        val type_declaration : t -> Types.type_declaration -> Types.type_declaration
        val extension_constructor : +Subst (ocaml.Subst)

        Module Subst

        Substitutions

        Substitutions are used to translate a type from one context to another. This requires substituting paths for identifiers, and possibly also lowering the level of non-generic variables so that they are inferior to the maximum level of the new context.

        Substitutions can also be used to create a "clean" copy of a type. Indeed, non-variable node of a type are duplicated, with their levels set to generic level. That way, the resulting type is well-formed (decreasing levels), even if the original one was not.

        In the presence of local substitutions for module types, a substitution for a type expression may fail to produce a well-formed type. In order to confine this issue to local substitutions, the type of substitutions is split into a safe and unsafe variant. Only unsafe substitutions may expand a module type path into a generic module type.

        type +'k subst

        Type familly for substitutions

        type safe = [
        1. | `Safe
        ]
        type unsafe = [
        1. | `Unsafe
        ]
        type t = safe subst

        Standard substitution

        val identity : 'a subst
        val unsafe : t -> unsafe subst
        val add_type : Ident.t -> Path.t -> 'k subst -> 'k subst
        val add_module : Ident.t -> Path.t -> 'k subst -> 'k subst
        val add_modtype : Ident.t -> Path.t -> 'k subst -> 'k subst
        val for_saving : t -> t
        val reset_for_saving : unit -> unit
        val change_locs : 'k subst -> Location.t -> 'k subst
        val module_path : t -> Path.t -> Path.t
        val type_path : t -> Path.t -> Path.t
        val modtype_path : t -> Path.t -> Path.t
        val type_expr : t -> Types.type_expr -> Types.type_expr
        val class_type : t -> Types.class_type -> Types.class_type
        val value_description : t -> Types.value_description -> Types.value_description
        val type_declaration : t -> Types.type_declaration -> Types.type_declaration
        val class_declaration : t -> Types.class_declaration -> Types.class_declaration
        type scoping =
        1. | Keep
        2. | Make_local
        3. | Rescope of int
        val signature : scoping -> t -> Types.signature -> Types.signature
        val signature_item : + Types.class_type_declaration

        When applied to a signature item, a substitution not only modifies the types present in its declaration, but also refreshes the identifier of the item. Effectively this creates new declarations, and so one should decide what the scope of this new declaration should be.

        This is decided by the scoping argument passed to the following functions.

        type scoping =
        1. | Keep
        2. | Make_local
        3. | Rescope of int
        val signature : scoping -> t -> Types.signature -> Types.signature
        val signature_item : scoping -> t -> Types.signature_item -> @@ -22,9 +17,4 @@ scoping -> t -> Types.module_declaration -> - Types.module_declaration
        val compose : t -> t -> t
        val ctype_apply_env_empty : - (Types.type_expr list -> - Types.type_expr -> - Types.type_expr list -> - Types.type_expr) - ref
        module Lazy : sig ... end
        + Types.module_declaration
        val compose : t -> t -> t

        Composition of substitutions: apply (compose s1 s2) x = apply s2 (apply s1 x) *

        module Unsafe : sig ... end
        module Lazy : sig ... end
        diff --git a/ocaml/Symtable/Compunit/Map/index.html b/ocaml/Symtable/Compunit/Map/index.html new file mode 100644 index 00000000..a1997e5a --- /dev/null +++ b/ocaml/Symtable/Compunit/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Symtable.Compunit.Map)

        Module Compunit.Map

        Maps

        type key = t

        The type of the map keys.

        type !+'a t

        The type of maps from type key to type 'a.

        val empty : 'a t

        The empty map.

        val add : key -> 'a -> 'a t -> 'a t

        add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

        • before 4.03

          Physical equality was not ensured.

        val add_to_list : key -> 'a -> 'a list t -> 'a list t

        add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

        • since 5.1
        val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

        update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

        • since 4.06
        val singleton : key -> 'a -> 'a t

        singleton x y returns the one-element map that contains a binding y for x.

        • since 3.12
        val remove : key -> 'a t -> 'a t

        remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

        • before 4.03

          Physical equality was not ensured.

        val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

        merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

        • since 3.12
        val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

        union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

        • f' _key None None = None
        • f' _key (Some v) None = Some v
        • f' _key None (Some v) = Some v
        • f' key (Some v1) (Some v2) = f key v1 v2
        • since 4.03
        val cardinal : 'a t -> int

        Return the number of bindings of a map.

        • since 3.12

        Bindings

        val bindings : 'a t -> (key * 'a) list

        Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

        • since 3.12
        val min_binding : 'a t -> key * 'a

        Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

        • since 3.12
        val min_binding_opt : 'a t -> (key * 'a) option

        Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

        • since 4.05
        val max_binding : 'a t -> key * 'a

        Same as min_binding, but returns the binding with the largest key in the given map.

        • since 3.12
        val max_binding_opt : 'a t -> (key * 'a) option

        Same as min_binding_opt, but returns the binding with the largest key in the given map.

        • since 4.05
        val choose : 'a t -> key * 'a

        Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

        • since 3.12
        val choose_opt : 'a t -> (key * 'a) option

        Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

        • since 4.05

        Searching

        val find : key -> 'a t -> 'a

        find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

        val find_opt : key -> 'a t -> 'a option

        find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

        • since 4.05
        val find_first : (key -> bool) -> 'a t -> key * 'a

        find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

        For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

        • since 4.05
        val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

        find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

        • since 4.05
        val find_last : (key -> bool) -> 'a t -> key * 'a

        find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

        • since 4.05
        val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

        find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

        • since 4.05

        Traversing

        val iter : (key -> 'a -> unit) -> 'a t -> unit

        iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

        val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

        fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

        Transforming

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

        val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

        Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

        val filter : (key -> 'a -> bool) -> 'a t -> 'a t

        filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

        • since 3.12
        • before 4.03

          Physical equality was not ensured.

        val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

        filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

        • if f k v is None then k is not in the result,
        • if f k v is Some v' then the binding (k, v') is in the output map.

        For example, the following function on maps whose values are lists

        filter_map
        +  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
        +  m

        drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

        • since 4.11
        val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

        partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

        • since 3.12
        val split : key -> 'a t -> 'a t * 'a option * 'a t

        split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

        • since 3.12

        Predicates and comparisons

        val is_empty : 'a t -> bool

        Test whether a map is empty or not.

        val mem : key -> 'a t -> bool

        mem x m returns true if m contains a binding for x, and false otherwise.

        val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

        equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

        val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

        Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

        val for_all : (key -> 'a -> bool) -> 'a t -> bool

        for_all f m checks if all the bindings of the map satisfy the predicate f.

        • since 3.12
        val exists : (key -> 'a -> bool) -> 'a t -> bool

        exists f m checks if at least one binding of the map satisfies the predicate f.

        • since 3.12

        Converting

        val to_list : 'a t -> (key * 'a) list

        to_list m is bindings m.

        • since 5.1
        val of_list : (key * 'a) list -> 'a t

        of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

        • since 5.1
        val to_seq : 'a t -> (key * 'a) Seq.t

        Iterate on the whole map, in ascending order of keys

        • since 4.07
        val to_rev_seq : 'a t -> (key * 'a) Seq.t

        Iterate on the whole map, in descending order of keys

        • since 4.12
        val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

        to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

        • since 4.07
        val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

        Add the given bindings to the map, in order.

        • since 4.07
        val of_seq : (key * 'a) Seq.t -> 'a t

        Build a map from the given bindings

        • since 4.07
        diff --git a/ocaml/Symtable/Compunit/Set/index.html b/ocaml/Symtable/Compunit/Set/index.html new file mode 100644 index 00000000..e796d641 --- /dev/null +++ b/ocaml/Symtable/Compunit/Set/index.html @@ -0,0 +1,3 @@ + +Set (ocaml.Symtable.Compunit.Set)

        Module Compunit.Set

        Sets

        type elt = t

        The type of the set elements.

        type t

        The type of sets.

        val empty : t

        The empty set.

        val add : elt -> t -> t

        add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val singleton : elt -> t

        singleton x returns the one-element set containing only x.

        val remove : elt -> t -> t

        remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val union : t -> t -> t

        Set union.

        val inter : t -> t -> t

        Set intersection.

        val disjoint : t -> t -> bool

        Test if two sets are disjoint.

        • since 4.08
        val diff : t -> t -> t

        Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

        val cardinal : t -> int

        Return the number of elements of a set.

        Elements

        val elements : t -> elt list

        Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

        val min_elt : t -> elt

        Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

        val min_elt_opt : t -> elt option

        Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

        • since 4.05
        val max_elt : t -> elt

        Same as min_elt, but returns the largest element of the given set.

        val max_elt_opt : t -> elt option

        Same as min_elt_opt, but returns the largest element of the given set.

        • since 4.05
        val choose : t -> elt

        Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

        val choose_opt : t -> elt option

        Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

        • since 4.05

        Searching

        val find : elt -> t -> elt

        find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

        • since 4.01
        val find_opt : elt -> t -> elt option

        find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

        • since 4.05
        val find_first : (elt -> bool) -> t -> elt

        find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

        For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

        • since 4.05
        val find_first_opt : (elt -> bool) -> t -> elt option

        find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

        • since 4.05
        val find_last : (elt -> bool) -> t -> elt

        find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

        • since 4.05
        val find_last_opt : (elt -> bool) -> t -> elt option

        find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

        • since 4.05

        Traversing

        val iter : (elt -> unit) -> t -> unit

        iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

        val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

        fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

        Transforming

        val map : (elt -> elt) -> t -> t

        map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

        The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

        If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

        • since 4.04
        val filter : (elt -> bool) -> t -> t

        filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val filter_map : (elt -> elt option) -> t -> t

        filter_map f s returns the set of all v such that f x = Some v for some element x of s.

        For example,

        filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

        is the set of halves of the even elements of s.

        If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

        • since 4.11
        val partition : (elt -> bool) -> t -> t * t

        partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

        val split : elt -> t -> t * bool * t

        split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

        Predicates and comparisons

        val is_empty : t -> bool

        Test whether a set is empty or not.

        val mem : elt -> t -> bool

        mem x s tests whether x belongs to the set s.

        val equal : t -> t -> bool

        equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

        val compare : t -> t -> int

        Total ordering between sets. Can be used as the ordering function for doing sets of sets.

        val subset : t -> t -> bool

        subset s1 s2 tests whether the set s1 is a subset of the set s2.

        val for_all : (elt -> bool) -> t -> bool

        for_all f s checks if all elements of the set satisfy the predicate f.

        val exists : (elt -> bool) -> t -> bool

        exists f s checks if at least one element of the set satisfies the predicate f.

        Converting

        val to_list : t -> elt list

        to_list s is elements s.

        • since 5.1
        val of_list : elt list -> t

        of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

        • since 4.02
        val to_seq_from : elt -> t -> elt Seq.t

        to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

        • since 4.07
        val to_seq : t -> elt Seq.t

        Iterate on the whole set, in ascending order

        • since 4.07
        val to_rev_seq : t -> elt Seq.t

        Iterate on the whole set, in descending order

        • since 4.12
        val add_seq : elt Seq.t -> t -> t

        Add the given elements to the set, in order.

        • since 4.07
        val of_seq : elt Seq.t -> t

        Build a set from the given bindings

        • since 4.07
        diff --git a/ocaml/Symtable/Compunit/index.html b/ocaml/Symtable/Compunit/index.html new file mode 100644 index 00000000..05d9ffdc --- /dev/null +++ b/ocaml/Symtable/Compunit/index.html @@ -0,0 +1,2 @@ + +Compunit (ocaml.Symtable.Compunit)

        Module Symtable.Compunit

        val name : t -> string
        val is_packed : Cmo_format.compunit -> bool
        val to_ident : Cmo_format.compunit -> Ident.t
        module Set : Set.S with type elt = t
        module Map : Map.S with type key = t
        diff --git a/ocaml/Symtable/Global/Map/index.html b/ocaml/Symtable/Global/Map/index.html new file mode 100644 index 00000000..9582c134 --- /dev/null +++ b/ocaml/Symtable/Global/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Symtable.Global.Map)

        Module Global.Map

        Maps

        type key = t

        The type of the map keys.

        type !+'a t

        The type of maps from type key to type 'a.

        val empty : 'a t

        The empty map.

        val add : key -> 'a -> 'a t -> 'a t

        add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

        • before 4.03

          Physical equality was not ensured.

        val add_to_list : key -> 'a -> 'a list t -> 'a list t

        add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

        • since 5.1
        val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

        update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

        • since 4.06
        val singleton : key -> 'a -> 'a t

        singleton x y returns the one-element map that contains a binding y for x.

        • since 3.12
        val remove : key -> 'a t -> 'a t

        remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

        • before 4.03

          Physical equality was not ensured.

        val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

        merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

        • since 3.12
        val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

        union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

        • f' _key None None = None
        • f' _key (Some v) None = Some v
        • f' _key None (Some v) = Some v
        • f' key (Some v1) (Some v2) = f key v1 v2
        • since 4.03
        val cardinal : 'a t -> int

        Return the number of bindings of a map.

        • since 3.12

        Bindings

        val bindings : 'a t -> (key * 'a) list

        Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

        • since 3.12
        val min_binding : 'a t -> key * 'a

        Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

        • since 3.12
        val min_binding_opt : 'a t -> (key * 'a) option

        Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

        • since 4.05
        val max_binding : 'a t -> key * 'a

        Same as min_binding, but returns the binding with the largest key in the given map.

        • since 3.12
        val max_binding_opt : 'a t -> (key * 'a) option

        Same as min_binding_opt, but returns the binding with the largest key in the given map.

        • since 4.05
        val choose : 'a t -> key * 'a

        Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

        • since 3.12
        val choose_opt : 'a t -> (key * 'a) option

        Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

        • since 4.05

        Searching

        val find : key -> 'a t -> 'a

        find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

        val find_opt : key -> 'a t -> 'a option

        find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

        • since 4.05
        val find_first : (key -> bool) -> 'a t -> key * 'a

        find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

        For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

        • since 4.05
        val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

        find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

        • since 4.05
        val find_last : (key -> bool) -> 'a t -> key * 'a

        find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

        • since 4.05
        val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

        find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

        • since 4.05

        Traversing

        val iter : (key -> 'a -> unit) -> 'a t -> unit

        iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

        val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

        fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

        Transforming

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

        val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

        Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

        val filter : (key -> 'a -> bool) -> 'a t -> 'a t

        filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

        • since 3.12
        • before 4.03

          Physical equality was not ensured.

        val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

        filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

        • if f k v is None then k is not in the result,
        • if f k v is Some v' then the binding (k, v') is in the output map.

        For example, the following function on maps whose values are lists

        filter_map
        +  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
        +  m

        drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

        • since 4.11
        val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

        partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

        • since 3.12
        val split : key -> 'a t -> 'a t * 'a option * 'a t

        split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

        • since 3.12

        Predicates and comparisons

        val is_empty : 'a t -> bool

        Test whether a map is empty or not.

        val mem : key -> 'a t -> bool

        mem x m returns true if m contains a binding for x, and false otherwise.

        val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

        equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

        val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

        Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

        val for_all : (key -> 'a -> bool) -> 'a t -> bool

        for_all f m checks if all the bindings of the map satisfy the predicate f.

        • since 3.12
        val exists : (key -> 'a -> bool) -> 'a t -> bool

        exists f m checks if at least one binding of the map satisfies the predicate f.

        • since 3.12

        Converting

        val to_list : 'a t -> (key * 'a) list

        to_list m is bindings m.

        • since 5.1
        val of_list : (key * 'a) list -> 'a t

        of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

        • since 5.1
        val to_seq : 'a t -> (key * 'a) Seq.t

        Iterate on the whole map, in ascending order of keys

        • since 4.07
        val to_rev_seq : 'a t -> (key * 'a) Seq.t

        Iterate on the whole map, in descending order of keys

        • since 4.12
        val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

        to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

        • since 4.07
        val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

        Add the given bindings to the map, in order.

        • since 4.07
        val of_seq : (key * 'a) Seq.t -> 'a t

        Build a map from the given bindings

        • since 4.07
        diff --git a/ocaml/Symtable/Global/Set/index.html b/ocaml/Symtable/Global/Set/index.html new file mode 100644 index 00000000..2a03cee8 --- /dev/null +++ b/ocaml/Symtable/Global/Set/index.html @@ -0,0 +1,3 @@ + +Set (ocaml.Symtable.Global.Set)

        Module Global.Set

        Sets

        type elt = t

        The type of the set elements.

        type t

        The type of sets.

        val empty : t

        The empty set.

        val add : elt -> t -> t

        add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val singleton : elt -> t

        singleton x returns the one-element set containing only x.

        val remove : elt -> t -> t

        remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val union : t -> t -> t

        Set union.

        val inter : t -> t -> t

        Set intersection.

        val disjoint : t -> t -> bool

        Test if two sets are disjoint.

        • since 4.08
        val diff : t -> t -> t

        Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

        val cardinal : t -> int

        Return the number of elements of a set.

        Elements

        val elements : t -> elt list

        Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

        val min_elt : t -> elt

        Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

        val min_elt_opt : t -> elt option

        Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

        • since 4.05
        val max_elt : t -> elt

        Same as min_elt, but returns the largest element of the given set.

        val max_elt_opt : t -> elt option

        Same as min_elt_opt, but returns the largest element of the given set.

        • since 4.05
        val choose : t -> elt

        Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

        val choose_opt : t -> elt option

        Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

        • since 4.05

        Searching

        val find : elt -> t -> elt

        find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

        • since 4.01
        val find_opt : elt -> t -> elt option

        find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

        • since 4.05
        val find_first : (elt -> bool) -> t -> elt

        find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

        For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

        • since 4.05
        val find_first_opt : (elt -> bool) -> t -> elt option

        find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

        • since 4.05
        val find_last : (elt -> bool) -> t -> elt

        find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

        • since 4.05
        val find_last_opt : (elt -> bool) -> t -> elt option

        find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

        • since 4.05

        Traversing

        val iter : (elt -> unit) -> t -> unit

        iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

        val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

        fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

        Transforming

        val map : (elt -> elt) -> t -> t

        map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

        The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

        If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

        • since 4.04
        val filter : (elt -> bool) -> t -> t

        filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val filter_map : (elt -> elt option) -> t -> t

        filter_map f s returns the set of all v such that f x = Some v for some element x of s.

        For example,

        filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

        is the set of halves of the even elements of s.

        If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

        • since 4.11
        val partition : (elt -> bool) -> t -> t * t

        partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

        val split : elt -> t -> t * bool * t

        split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

        Predicates and comparisons

        val is_empty : t -> bool

        Test whether a set is empty or not.

        val mem : elt -> t -> bool

        mem x s tests whether x belongs to the set s.

        val equal : t -> t -> bool

        equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

        val compare : t -> t -> int

        Total ordering between sets. Can be used as the ordering function for doing sets of sets.

        val subset : t -> t -> bool

        subset s1 s2 tests whether the set s1 is a subset of the set s2.

        val for_all : (elt -> bool) -> t -> bool

        for_all f s checks if all elements of the set satisfy the predicate f.

        val exists : (elt -> bool) -> t -> bool

        exists f s checks if at least one element of the set satisfies the predicate f.

        Converting

        val to_list : t -> elt list

        to_list s is elements s.

        • since 5.1
        val of_list : elt list -> t

        of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

        • since 4.02
        val to_seq_from : elt -> t -> elt Seq.t

        to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

        • since 4.07
        val to_seq : t -> elt Seq.t

        Iterate on the whole set, in ascending order

        • since 4.07
        val to_rev_seq : t -> elt Seq.t

        Iterate on the whole set, in descending order

        • since 4.12
        val add_seq : elt Seq.t -> t -> t

        Add the given elements to the set, in order.

        • since 4.07
        val of_seq : elt Seq.t -> t

        Build a set from the given bindings

        • since 4.07
        diff --git a/ocaml/Symtable/Global/index.html b/ocaml/Symtable/Global/index.html new file mode 100644 index 00000000..4c8013ea --- /dev/null +++ b/ocaml/Symtable/Global/index.html @@ -0,0 +1,2 @@ + +Global (ocaml.Symtable.Global)

        Module Symtable.Global

        type t =
        1. | Glob_compunit of Cmo_format.compunit
        2. | Glob_predef of Cmo_format.predef
        val name : t -> string
        val description : t Format_doc.printer
        val of_ident : Ident.t -> t option
        module Set : Set.S with type elt = t
        module Map : Map.S with type key = t
        diff --git a/ocaml/Symtable/Predef/Map/index.html b/ocaml/Symtable/Predef/Map/index.html new file mode 100644 index 00000000..a2a50723 --- /dev/null +++ b/ocaml/Symtable/Predef/Map/index.html @@ -0,0 +1,8 @@ + +Map (ocaml.Symtable.Predef.Map)

        Module Predef.Map

        Maps

        type key = t

        The type of the map keys.

        type !+'a t

        The type of maps from type key to type 'a.

        val empty : 'a t

        The empty map.

        val add : key -> 'a -> 'a t -> 'a t

        add key data m returns a map containing the same bindings as m, plus a binding of key to data. If key was already bound in m to a value that is physically equal to data, m is returned unchanged (the result of the function is then physically equal to m). Otherwise, the previous binding of key in m disappears.

        • before 4.03

          Physical equality was not ensured.

        val add_to_list : key -> 'a -> 'a list t -> 'a list t

        add_to_list key data m is m with key mapped to l such that l is data :: Map.find key m if key was bound in m and [v] otherwise.

        • since 5.1
        val update : key -> ('a option -> 'a option) -> 'a t -> 'a t

        update key f m returns a map containing the same bindings as m, except for the binding of key. Depending on the value of y where y is f (find_opt key m), the binding of key is added, removed or updated. If y is None, the binding is removed if it exists; otherwise, if y is Some z then key is associated to z in the resulting map. If key was already bound in m to a value that is physically equal to z, m is returned unchanged (the result of the function is then physically equal to m).

        • since 4.06
        val singleton : key -> 'a -> 'a t

        singleton x y returns the one-element map that contains a binding y for x.

        • since 3.12
        val remove : key -> 'a t -> 'a t

        remove x m returns a map containing the same bindings as m, except for x which is unbound in the returned map. If x was not in m, m is returned unchanged (the result of the function is then physically equal to m).

        • before 4.03

          Physical equality was not ensured.

        val merge : + (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> + 'b t -> + 'c t

        merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

        • since 3.12
        val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

        union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

        • f' _key None None = None
        • f' _key (Some v) None = Some v
        • f' _key None (Some v) = Some v
        • f' key (Some v1) (Some v2) = f key v1 v2
        • since 4.03
        val cardinal : 'a t -> int

        Return the number of bindings of a map.

        • since 3.12

        Bindings

        val bindings : 'a t -> (key * 'a) list

        Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

        • since 3.12
        val min_binding : 'a t -> key * 'a

        Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

        • since 3.12
        val min_binding_opt : 'a t -> (key * 'a) option

        Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

        • since 4.05
        val max_binding : 'a t -> key * 'a

        Same as min_binding, but returns the binding with the largest key in the given map.

        • since 3.12
        val max_binding_opt : 'a t -> (key * 'a) option

        Same as min_binding_opt, but returns the binding with the largest key in the given map.

        • since 4.05
        val choose : 'a t -> key * 'a

        Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

        • since 3.12
        val choose_opt : 'a t -> (key * 'a) option

        Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

        • since 4.05

        Searching

        val find : key -> 'a t -> 'a

        find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

        val find_opt : key -> 'a t -> 'a option

        find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

        • since 4.05
        val find_first : (key -> bool) -> 'a t -> key * 'a

        find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

        For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

        • since 4.05
        val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

        find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

        • since 4.05
        val find_last : (key -> bool) -> 'a t -> key * 'a

        find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

        • since 4.05
        val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

        find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

        • since 4.05

        Traversing

        val iter : (key -> 'a -> unit) -> 'a t -> unit

        iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

        val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc

        fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

        Transforming

        val map : ('a -> 'b) -> 'a t -> 'b t

        map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

        val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t

        Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

        val filter : (key -> 'a -> bool) -> 'a t -> 'a t

        filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

        • since 3.12
        • before 4.03

          Physical equality was not ensured.

        val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

        filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

        • if f k v is None then k is not in the result,
        • if f k v is Some v' then the binding (k, v') is in the output map.

        For example, the following function on maps whose values are lists

        filter_map
        +  (fun _k li -> match li with [] -> None | _::tl -> Some tl)
        +  m

        drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

        • since 4.11
        val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

        partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

        • since 3.12
        val split : key -> 'a t -> 'a t * 'a option * 'a t

        split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

        • since 3.12

        Predicates and comparisons

        val is_empty : 'a t -> bool

        Test whether a map is empty or not.

        val mem : key -> 'a t -> bool

        mem x m returns true if m contains a binding for x, and false otherwise.

        val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

        equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

        val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

        Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

        val for_all : (key -> 'a -> bool) -> 'a t -> bool

        for_all f m checks if all the bindings of the map satisfy the predicate f.

        • since 3.12
        val exists : (key -> 'a -> bool) -> 'a t -> bool

        exists f m checks if at least one binding of the map satisfies the predicate f.

        • since 3.12

        Converting

        val to_list : 'a t -> (key * 'a) list

        to_list m is bindings m.

        • since 5.1
        val of_list : (key * 'a) list -> 'a t

        of_list bs adds the bindings of bs to the empty map, in list order (if a key is bound twice in bs the last one takes over).

        • since 5.1
        val to_seq : 'a t -> (key * 'a) Seq.t

        Iterate on the whole map, in ascending order of keys

        • since 4.07
        val to_rev_seq : 'a t -> (key * 'a) Seq.t

        Iterate on the whole map, in descending order of keys

        • since 4.12
        val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

        to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

        • since 4.07
        val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

        Add the given bindings to the map, in order.

        • since 4.07
        val of_seq : (key * 'a) Seq.t -> 'a t

        Build a map from the given bindings

        • since 4.07
        diff --git a/ocaml/Symtable/Predef/Set/index.html b/ocaml/Symtable/Predef/Set/index.html new file mode 100644 index 00000000..26adce71 --- /dev/null +++ b/ocaml/Symtable/Predef/Set/index.html @@ -0,0 +1,3 @@ + +Set (ocaml.Symtable.Predef.Set)

        Module Predef.Set

        Sets

        type elt = t

        The type of the set elements.

        type t

        The type of sets.

        val empty : t

        The empty set.

        val add : elt -> t -> t

        add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val singleton : elt -> t

        singleton x returns the one-element set containing only x.

        val remove : elt -> t -> t

        remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val union : t -> t -> t

        Set union.

        val inter : t -> t -> t

        Set intersection.

        val disjoint : t -> t -> bool

        Test if two sets are disjoint.

        • since 4.08
        val diff : t -> t -> t

        Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

        val cardinal : t -> int

        Return the number of elements of a set.

        Elements

        val elements : t -> elt list

        Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

        val min_elt : t -> elt

        Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

        val min_elt_opt : t -> elt option

        Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

        • since 4.05
        val max_elt : t -> elt

        Same as min_elt, but returns the largest element of the given set.

        val max_elt_opt : t -> elt option

        Same as min_elt_opt, but returns the largest element of the given set.

        • since 4.05
        val choose : t -> elt

        Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

        val choose_opt : t -> elt option

        Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

        • since 4.05

        Searching

        val find : elt -> t -> elt

        find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

        • since 4.01
        val find_opt : elt -> t -> elt option

        find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

        • since 4.05
        val find_first : (elt -> bool) -> t -> elt

        find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

        For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

        • since 4.05
        val find_first_opt : (elt -> bool) -> t -> elt option

        find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

        • since 4.05
        val find_last : (elt -> bool) -> t -> elt

        find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

        • since 4.05
        val find_last_opt : (elt -> bool) -> t -> elt option

        find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

        • since 4.05

        Traversing

        val iter : (elt -> unit) -> t -> unit

        iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

        val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc

        fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

        Transforming

        val map : (elt -> elt) -> t -> t

        map f s is the set whose elements are f a0,f a1... f + aN, where a0,a1...aN are the elements of s.

        The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

        If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

        • since 4.04
        val filter : (elt -> bool) -> t -> t

        filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

        • before 4.03

          Physical equality was not ensured.

        val filter_map : (elt -> elt option) -> t -> t

        filter_map f s returns the set of all v such that f x = Some v for some element x of s.

        For example,

        filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

        is the set of halves of the even elements of s.

        If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

        • since 4.11
        val partition : (elt -> bool) -> t -> t * t

        partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

        val split : elt -> t -> t * bool * t

        split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

        Predicates and comparisons

        val is_empty : t -> bool

        Test whether a set is empty or not.

        val mem : elt -> t -> bool

        mem x s tests whether x belongs to the set s.

        val equal : t -> t -> bool

        equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

        val compare : t -> t -> int

        Total ordering between sets. Can be used as the ordering function for doing sets of sets.

        val subset : t -> t -> bool

        subset s1 s2 tests whether the set s1 is a subset of the set s2.

        val for_all : (elt -> bool) -> t -> bool

        for_all f s checks if all elements of the set satisfy the predicate f.

        val exists : (elt -> bool) -> t -> bool

        exists f s checks if at least one element of the set satisfies the predicate f.

        Converting

        val to_list : t -> elt list

        to_list s is elements s.

        • since 5.1
        val of_list : elt list -> t

        of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

        • since 4.02
        val to_seq_from : elt -> t -> elt Seq.t

        to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

        • since 4.07
        val to_seq : t -> elt Seq.t

        Iterate on the whole set, in ascending order

        • since 4.07
        val to_rev_seq : t -> elt Seq.t

        Iterate on the whole set, in descending order

        • since 4.12
        val add_seq : elt Seq.t -> t -> t

        Add the given elements to the set, in order.

        • since 4.07
        val of_seq : elt Seq.t -> t

        Build a set from the given bindings

        • since 4.07
        diff --git a/ocaml/Symtable/Predef/index.html b/ocaml/Symtable/Predef/index.html new file mode 100644 index 00000000..f3c9cb46 --- /dev/null +++ b/ocaml/Symtable/Predef/index.html @@ -0,0 +1,2 @@ + +Predef (ocaml.Symtable.Predef)

        Module Symtable.Predef

        module Set : Set.S with type elt = t
        module Map : Map.S with type key = t
        diff --git a/ocaml/Symtable/index.html b/ocaml/Symtable/index.html index aba8d3f9..19a5ebdf 100644 --- a/ocaml/Symtable/index.html +++ b/ocaml/Symtable/index.html @@ -1,5 +1,10 @@ -Symtable (ocaml.Symtable)

        Module Symtable

        val init : unit -> unit
        val patch_object : - Misc.LongString.t -> +Symtable (ocaml.Symtable)

        Module Symtable

        module Compunit : sig ... end
        module Predef : sig ... end
        module Global : sig ... end
        val init : unit -> unit
        val require_primitive : string -> unit
        val initial_global_table : unit -> Stdlib.Obj.t array
        val output_global_map : out_channel -> unit
        val output_primitive_names : out_channel -> unit
        val output_primitive_table : out_channel -> unit
        val data_global_map : unit -> Stdlib.Obj.t
        val data_primitive_names : unit -> string
        val init_toplevel : unit -> (string * Stdlib.Digest.t option) list
        val update_global_table : unit -> unit
        val get_global_value : Ident.t -> Stdlib.Obj.t
        val is_global_defined : Ident.t -> bool
        val assign_global_value : Ident.t -> Stdlib.Obj.t -> unit
        val get_global_position : Ident.t -> int
        val check_global_initialized : (Cmo_format.reloc_info * int) list -> unit
        val defined_globals : (Cmo_format.reloc_info * int) list -> Ident.t list
        val required_globals : (Cmo_format.reloc_info * int) list -> Ident.t list
        type global_map
        val empty_global_map : global_map
        val current_state : unit -> global_map
        val restore_state : global_map -> unit
        val hide_additions : global_map -> unit
        val filter_global_map : (Ident.t -> bool) -> global_map -> global_map
        val iter_global_map : (Ident.t -> int -> unit) -> global_map -> unit
        val is_defined_in_global_map : global_map -> Ident.t -> bool
        type error =
        1. | Undefined_global of string
        2. | Unavailable_primitive of string
        3. | Wrong_vm of string
        4. | Uninitialized_global of string
        exception Error of error
        val report_error : Stdlib.Format.formatter -> error -> unit
        val reset : unit -> unit
        + unit
        val require_primitive : string -> unit
        val initial_global_table : unit -> Stdlib.Obj.t array
        val output_global_map : out_channel -> unit
        val output_primitive_names : out_channel -> unit
        val output_primitive_table : out_channel -> unit
        val data_global_map : unit -> Stdlib.Obj.t
        val data_primitive_names : unit -> string list
        val init_toplevel : unit -> (string * Stdlib.Digest.t option) list
        val update_global_table : unit -> unit
        val get_global_value : Global.t -> Stdlib.Obj.t
        val is_global_defined : Global.t -> bool
        val assign_global_value : Global.t -> Stdlib.Obj.t -> unit
        val get_global_position : Global.t -> int
        val check_global_initialized : (Cmo_format.reloc_info * int) list -> unit
        val initialized_compunits : + (Cmo_format.reloc_info * int) list -> + Cmo_format.compunit list
        val required_compunits : + (Cmo_format.reloc_info * int) list -> + Cmo_format.compunit list
        type global_map
        val empty_global_map : global_map
        val current_state : unit -> global_map
        val restore_state : global_map -> unit
        val hide_additions : global_map -> unit
        val filter_global_map : (Global.t -> bool) -> global_map -> global_map
        val iter_global_map : (Global.t -> int -> unit) -> global_map -> unit
        val is_defined_in_global_map : global_map -> Global.t -> bool
        type error =
        1. | Undefined_global of Global.t
        2. | Unavailable_primitive of string
        3. | Wrong_vm of string
        4. | Uninitialized_global of Global.t
        exception Error of error
        val report_error : error Format_doc.format_printer
        val report_error_doc : error Format_doc.printer
        val reset : unit -> unit
        diff --git a/ocaml/Syntaxerr/index.html b/ocaml/Syntaxerr/index.html index f71e587a..8e14f69a 100644 --- a/ocaml/Syntaxerr/index.html +++ b/ocaml/Syntaxerr/index.html @@ -1,2 +1,2 @@ -Syntaxerr (ocaml.Syntaxerr)

        Module Syntaxerr

        Auxiliary type for reporting syntax errors

        Warning: this module is unstable and part of compiler-libs.

        type error =
        1. | Unclosed of Location.t * string * Location.t * string
        2. | Expecting of Location.t * string
        3. | Not_expecting of Location.t * string
        4. | Applicative_path of Location.t
        5. | Variable_in_scope of Location.t * string
        6. | Other of Location.t
        7. | Ill_formed_ast of Location.t * string
        8. | Invalid_package_type of Location.t * string
        9. | Removed_string_set of Location.t
        exception Error of error
        exception Escape_error
        val location_of_error : error -> Location.t
        val ill_formed_ast : Location.t -> string -> 'a
        +Syntaxerr (ocaml.Syntaxerr)

        Module Syntaxerr

        Auxiliary type for reporting syntax errors

        Warning: this module is unstable and part of compiler-libs.

        type invalid_package_type =
        1. | Parameterized_types
        2. | Constrained_types
        3. | Private_types
        4. | Not_with_type
        5. | Neither_identifier_nor_with_type
        type error =
        1. | Unclosed of Location.t * string * Location.t * string
        2. | Expecting of Location.t * string
        3. | Not_expecting of Location.t * string
        4. | Applicative_path of Location.t
        5. | Variable_in_scope of Location.t * string
        6. | Other of Location.t
        7. | Ill_formed_ast of Location.t * string
        8. | Invalid_package_type of Location.t * invalid_package_type
        9. | Removed_string_set of Location.t
        exception Error of error
        exception Escape_error
        val location_of_error : error -> Location.t
        val ill_formed_ast : Location.t -> string -> 'a
        diff --git a/ocaml/Tast_iterator/index.html b/ocaml/Tast_iterator/index.html index bcabaad5..413bb97e 100644 --- a/ocaml/Tast_iterator/index.html +++ b/ocaml/Tast_iterator/index.html @@ -5,4 +5,4 @@ (Asttypes.rec_flag * Typedtree.type_declaration list) -> unit;
      2. type_extension : iterator -> Typedtree.type_extension -> unit;
      3. type_exception : iterator -> Typedtree.type_exception -> unit;
      4. type_kind : iterator -> Typedtree.type_kind -> unit;
      5. value_binding : iterator -> Typedtree.value_binding -> unit;
      6. value_bindings : iterator -> (Asttypes.rec_flag * Typedtree.value_binding list) -> - unit;
      7. value_description : iterator -> Typedtree.value_description -> unit;
      8. with_constraint : iterator -> Typedtree.with_constraint -> unit;
      }
      val default_iterator : iterator
      + unit;
    2. value_description : iterator -> Typedtree.value_description -> unit;
    3. with_constraint : iterator -> Typedtree.with_constraint -> unit;
    4. item_declaration : iterator -> Typedtree.item_declaration -> unit;
    }
    val default_iterator : iterator
    diff --git a/ocaml/Thread_sanitizer/index.html b/ocaml/Thread_sanitizer/index.html new file mode 100644 index 00000000..a7c9a3ee --- /dev/null +++ b/ocaml/Thread_sanitizer/index.html @@ -0,0 +1,2 @@ + +Thread_sanitizer (ocaml.Thread_sanitizer)

    Module Thread_sanitizer

    Instrumentation of memory accesses to use ThreadSanitizer (TSan) for data race detection. This module contains an instrumentation pass on Cmm, where most of the instrumentation happens.

    TSan requires to instrument all memory accesses (to mutable data), thread spawning and joining, mutex operations, and all such events that are relevant for parallelism. Thread and mutex operations are instrumented by the C compiler via the runtime. Instrumentation calls are FFI (C) calls.

    TSan also requires to instrument the entry and exit of each function. TSan records function entries and exits along with other events in a history in to be able to print backtraces of an event (memory access, mutex creation...) when needed.

    In addition to this static instrumentation, we must let TSan know when a function is exited due to an exception or when performing effect, or re-entered when resuming a continuation. This dynamic instrumentation is performed by dedicated runtime functions in runtime/tsan.c. These functions are called from the assembly chunks of the runtime.

    val instrument : Cmm.expression -> Cmm.expression

    Instrumentation of a Cmm.expression: instrument memory accesses, and surround the expression by external calls to __tsan_func_entry and __tsan_func_exit. If the expression tail is a function call, then __tsan_func_exit is inserted before that call.

    val wrap_entry_exit : Cmm.expression -> Cmm.expression

    Surround an expression by external calls to __tsan_func_entry and __tsan_func_exit. If the expression tail is a function call, then __tsan_func_exit is inserted before that call.

    val init_code : unit -> Cmm.expression

    Call to __tsan_init, which should be called at least once in the compiled program, before other __tsan_* API functions. __tsan_init is idempotent, i.e. can be called more than once without consequences.

    diff --git a/ocaml/Topcommon/index.html b/ocaml/Topcommon/index.html index c2b5b3c7..fdf55eeb 100644 --- a/ocaml/Topcommon/index.html +++ b/ocaml/Topcommon/index.html @@ -2,4 +2,4 @@ Topcommon (ocaml.Topcommon)

    Module Topcommon

    This module provides common implementations for internals of Toploop, for bytecode and native code (see Topeval for the diverging parts of the implementation).

    You should not use it directly, refer to the functions in Toploop instead.

    type evaluation_outcome =
    1. | Result of Stdlib.Obj.t
    2. | Exception of exn
    val backtrace : string option ref
    val parse_mod_use_file : string -> Stdlib.Lexing.lexbuf -> - Parsetree.toplevel_phrase list
    val refill_lexbuf : bytes -> int -> int
    + Parsetree.toplevel_phrase list
    val comment_prompt_override : bool ref
    val refill_lexbuf : bytes -> int -> int
    diff --git a/ocaml/Toploop/index.html b/ocaml/Toploop/index.html index d4edec00..fb159f7d 100644 --- a/ocaml/Toploop/index.html +++ b/ocaml/Toploop/index.html @@ -1,5 +1,9 @@ -Toploop (ocaml.Toploop)

    Module Toploop

    type input =
    1. | Stdin
    2. | File of string
    3. | String of string
    val getvalue : string -> Stdlib.Obj.t
    val setvalue : string -> Stdlib.Obj.t -> unit
    val filename_of_input : input -> string
    val set_paths : ?auto_include:Load_path.auto_include_callback -> unit -> unit
    val loop : Stdlib.Format.formatter -> unit
    val run_script : Stdlib.Format.formatter -> input -> string array -> bool
    type directive_fun =
    1. | Directive_none of unit -> unit
    2. | Directive_string of string -> unit
    3. | Directive_int of int -> unit
    4. | Directive_ident of Longident.t -> unit
    5. | Directive_bool of bool -> unit
    type directive_info = {
    1. section : string;
    2. doc : string;
    }
    val add_directive : string -> directive_fun -> directive_info -> unit
    val get_directive : string -> directive_fun option
    val get_directive_info : string -> directive_info option
    val all_directive_names : unit -> string list
    val directive_table : (string, directive_fun) Stdlib.Hashtbl.t
    • deprecated
    val directive_info_table : (string, directive_info) Stdlib.Hashtbl.t
    • deprecated
    val toplevel_env : Env.t ref
    val initialize_toplevel_env : unit -> unit
    val print_exception_outcome : Stdlib.Format.formatter -> exn -> unit
    val execute_phrase : +Toploop (ocaml.Toploop)

    Module Toploop

    type input =
    1. | Stdin
    2. | File of string
    3. | String of string
    val getvalue : string -> Stdlib.Obj.t
    val setvalue : string -> Stdlib.Obj.t -> unit
    val filename_of_input : input -> string
    val set_paths : + ?auto_include:Load_path.auto_include_callback -> + ?dir:string -> + unit -> + unit
    val loop : Stdlib.Format.formatter -> unit
    val run_script : Stdlib.Format.formatter -> input -> string array -> bool
    type directive_fun =
    1. | Directive_none of unit -> unit
    2. | Directive_string of string -> unit
    3. | Directive_int of int -> unit
    4. | Directive_ident of Longident.t -> unit
    5. | Directive_bool of bool -> unit
    type directive_info = {
    1. section : string;
    2. doc : string;
    }
    val add_directive : string -> directive_fun -> directive_info -> unit
    val get_directive : string -> directive_fun option
    val get_directive_info : string -> directive_info option
    val all_directive_names : unit -> string list
    val directive_table : (string, directive_fun) Stdlib.Hashtbl.t
    • deprecated
    val directive_info_table : (string, directive_info) Stdlib.Hashtbl.t
    • deprecated
    val toplevel_env : Env.t ref
    val initialize_toplevel_env : unit -> unit
    val print_exception_outcome : Stdlib.Format.formatter -> exn -> unit
    val execute_phrase : bool -> Stdlib.Format.formatter -> Parsetree.toplevel_phrase -> @@ -38,11 +42,5 @@ unit
    val remove_printer : Path.t -> unit
    val max_printer_depth : int ref
    val max_printer_steps : int ref
    val parse_toplevel_phrase : (Stdlib.Lexing.lexbuf -> Parsetree.toplevel_phrase) ref
    val parse_use_file : (Stdlib.Lexing.lexbuf -> Parsetree.toplevel_phrase list) ref
    val print_location : Stdlib.Format.formatter -> Location.t -> unit
    val print_error : Stdlib.Format.formatter -> Location.error -> unit
    val print_warning : Location.t -> Stdlib.Format.formatter -> Warnings.t -> unit
    val input_name : string ref
    val print_out_value : - (Stdlib.Format.formatter -> Outcometree.out_value -> unit) ref
    val print_out_type : - (Stdlib.Format.formatter -> Outcometree.out_type -> unit) ref
    val print_out_class_type : - (Stdlib.Format.formatter -> Outcometree.out_class_type -> unit) ref
    val print_out_module_type : - (Stdlib.Format.formatter -> Outcometree.out_module_type -> unit) ref
    val print_out_type_extension : - (Stdlib.Format.formatter -> Outcometree.out_type_extension -> unit) ref
    val print_out_sig_item : - (Stdlib.Format.formatter -> Outcometree.out_sig_item -> unit) ref
    val print_out_signature : - (Stdlib.Format.formatter -> Outcometree.out_sig_item list -> unit) ref
    val print_out_phrase : - (Stdlib.Format.formatter -> Outcometree.out_phrase -> unit) ref
    val read_interactive_input : (string -> bytes -> int -> int * bool) ref
    val toplevel_startup_hook : (unit -> unit) ref
    type event = ..
    type event +=
    1. | Startup
    2. | After_setup
    val add_hook : (event -> unit) -> unit
    val run_hooks : event -> unit
    val may_trace : bool ref
    val override_sys_argv : string array -> unit
    + (Stdlib.Format.formatter -> Outcometree.out_value -> unit) ref
    type 'a oprinter := 'a Oprint.printer
    val print_out_type : Outcometree.out_type oprinter
    val print_out_class_type : Outcometree.out_class_type oprinter
    val print_out_module_type : Outcometree.out_module_type oprinter
    val print_out_type_extension : Outcometree.out_type_extension oprinter
    val print_out_sig_item : Outcometree.out_sig_item oprinter
    val print_out_signature : Outcometree.out_sig_item list oprinter
    val print_out_phrase : + (Stdlib.Format.formatter -> Outcometree.out_phrase -> unit) ref
    val read_interactive_input : (string -> bytes -> int -> int * bool) ref
    val toplevel_startup_hook : (unit -> unit) ref
    type event = ..
    type event +=
    1. | Startup
    2. | After_setup
    val add_hook : (event -> unit) -> unit
    val run_hooks : event -> unit
    val may_trace : bool ref
    val override_sys_argv : string array -> unit
    val split_path : string -> string list

    split_path path splits path according to the PATH-splitting conventions of the platform. On Unix, this is exactly String.split_on_char ':' path. On Windows, entries are separated by semicolons. Sections of entries may be double-quoted (which allows semicolons in filenames to be quoted). The double-quote characters are stripped (i.e. f"o"o = foo; also split_path "foo\";\";bar" = ["foo;"; "bar"])

    val preload_objects : string list ref

    List of compilation units to be loaded before entering the interactive loop.

    val prepare : Stdlib.Format.formatter -> ?input:input -> unit -> bool

    Setup the load paths and initial toplevel environment and load compilation units in preload_objects.

    diff --git a/ocaml/Translattribute/index.html b/ocaml/Translattribute/index.html index aa1f00cb..93547dbd 100644 --- a/ocaml/Translattribute/index.html +++ b/ocaml/Translattribute/index.html @@ -1,8 +1,5 @@ -Translattribute (ocaml.Translattribute)

    Module Translattribute

    val check_attribute : Typedtree.expression -> Parsetree.attribute -> unit
    val check_attribute_on_module : - Typedtree.module_expr -> - Parsetree.attribute -> - unit
    val add_inline_attribute : +Translattribute (ocaml.Translattribute)

    Module Translattribute

    val add_inline_attribute : Lambda.lambda -> Location.t -> Parsetree.attributes -> @@ -16,15 +13,11 @@ Lambda.lambda -> Location.t -> Parsetree.attributes -> - Lambda.lambda
    val get_local_attribute : Parsetree.attributes -> Lambda.local_attribute
    val get_and_remove_inlined_attribute : - Typedtree.expression -> - Lambda.inline_attribute * Typedtree.expression
    val get_and_remove_inlined_attribute_on_module : + Lambda.lambda
    val get_local_attribute : Parsetree.attributes -> Lambda.local_attribute
    val get_inlined_attribute : Typedtree.expression -> Lambda.inline_attribute
    val get_inlined_attribute_on_module : Typedtree.module_expr -> - Lambda.inline_attribute * Typedtree.module_expr
    val get_and_remove_specialised_attribute : + Lambda.inline_attribute
    val add_function_attributes : + Lambda.specialise_attribute
    val get_tailcall_attribute : Typedtree.expression -> Lambda.tailcall_attribute
    val add_function_attributes : Lambda.lambda -> Location.t -> Parsetree.attributes -> diff --git a/ocaml/Translclass/index.html b/ocaml/Translclass/index.html index b100babb..8fc9911b 100644 --- a/ocaml/Translclass/index.html +++ b/ocaml/Translclass/index.html @@ -6,4 +6,4 @@ string list -> Typedtree.class_expr -> Asttypes.virtual_flag -> - Lambda.lambda
    type error =
    1. | Tags of string * string
    exception Error of Location.t * error
    val report_error : Stdlib.Format.formatter -> error -> unit
    + Lambda.lambda * Value_rec_types.recursive_binding_kind
    type error =
    1. | Tags of string * string
    exception Error of Location.t * error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Translcore/index.html b/ocaml/Translcore/index.html index 4d0a397c..97da8d0e 100644 --- a/ocaml/Translcore/index.html +++ b/ocaml/Translcore/index.html @@ -24,7 +24,7 @@ Lambda.lambda
    type error =
    1. | Free_super_var
    2. | Unreachable_reached
    exception Error of Location.t * error
    val report_error : Stdlib.Format.formatter -> error -> unit
    val transl_module : + Lambda.lambda
    type error =
    1. | Free_super_var
    2. | Unreachable_reached
    exception Error of Location.t * error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    val transl_module : (scopes:Debuginfo.Scoped_location.scopes -> Typedtree.module_coercion -> Path.t option -> diff --git a/ocaml/Translobj/index.html b/ocaml/Translobj/index.html index db448b1c..5f7add2d 100644 --- a/ocaml/Translobj/index.html +++ b/ocaml/Translobj/index.html @@ -4,4 +4,9 @@ int -> ('a -> Lambda.lambda) -> 'a -> - int * Lambda.lambda
    val method_ids : Ident.Set.t ref
    val oo_wrap : Env.t -> bool -> ('a -> Lambda.lambda) -> 'a -> Lambda.lambda
    val oo_add_class : Ident.t -> Env.t * bool
    val reset : unit -> unit
    + int * Lambda.lambda
    val method_ids : Ident.Set.t ref
    val oo_wrap : Env.t -> bool -> ('a -> Lambda.lambda) -> 'a -> Lambda.lambda
    val oo_wrap_gen : + Env.t -> + bool -> + ('a -> Lambda.lambda * 'b) -> + 'a -> + Lambda.lambda * 'b
    val oo_add_class : Ident.t -> Env.t * bool
    val reset : unit -> unit
    diff --git a/ocaml/Translprim/index.html b/ocaml/Translprim/index.html index 9ff18be5..dbad35ad 100644 --- a/ocaml/Translprim/index.html +++ b/ocaml/Translprim/index.html @@ -22,4 +22,4 @@ Typedtree.expression option -> Lambda.lambda list -> Typedtree.expression list -> - Lambda.lambda
    type error =
    1. | Unknown_builtin_primitive of string
    2. | Wrong_arity_builtin_primitive of string
    exception Error of Location.t * error
    val report_error : Stdlib.Format.formatter -> error -> unit
    + Lambda.lambda
    type error =
    1. | Unknown_builtin_primitive of string
    2. | Wrong_arity_builtin_primitive of string
    exception Error of Location.t * error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Typeclass/index.html b/ocaml/Typeclass/index.html index 46839a73..bf15dd5f 100644 --- a/ocaml/Typeclass/index.html +++ b/ocaml/Typeclass/index.html @@ -13,11 +13,9 @@ Parsetree.class_description list -> class_type_info list * Env.t
    type kind =
    1. | Object
    2. | Class
    3. | Class_type
    type error =
    1. | Unconsistent_constraint of Errortrace.unification_error
    2. | Field_type_mismatch of string * string * Errortrace.unification_error
    3. | Unexpected_field of Types.type_expr * string
    4. | Structure_expected of Types.class_type
    5. | Cannot_apply of Types.class_type
    6. | Apply_wrong_label of Asttypes.arg_label
    7. | Pattern_type_clash of Types.type_expr
    8. | Repeated_parameter
    9. | Unbound_class_2 of Longident.t
    10. | Unbound_class_type_2 of Longident.t
    11. | Abbrev_type_clash of Types.type_expr * Types.type_expr * Types.type_expr
    12. | Constructor_type_mismatch of string * Errortrace.unification_error
    13. | Virtual_class of kind * string list * string list
    14. | Undeclared_methods of kind * string list
    15. | Parameter_arity_mismatch of Longident.t * int * int
    16. | Parameter_mismatch of Errortrace.unification_error
    17. | Bad_parameters of Ident.t * Types.type_expr list * Types.type_expr list
    18. | Bad_class_type_parameters of Ident.t * Types.type_expr list - * Types.type_expr list
    19. | Class_match_failure of Ctype.class_match_failure list
    20. | Unbound_val of string
    21. | Unbound_type_var of Stdlib.Format.formatter -> - unit - * Ctype.closed_class_failure
    22. | Non_generalizable_class of {
      1. id : Ident.t;
      2. clty : Types.class_declaration;
      3. nongen_vars : Types.type_expr list;
      }
    23. | Cannot_coerce_self of Types.type_expr
    24. | Non_collapsable_conjunction of Ident.t + * Types.type_expr list
    25. | Class_match_failure of Ctype.class_match_failure list
    26. | Unbound_val of string
    27. | Unbound_type_var of Format_doc.t * Ctype.closed_class_failure
    28. | Non_generalizable_class of {
      1. id : Ident.t;
      2. clty : Types.class_declaration;
      3. nongen_vars : Types.type_expr list;
      }
    29. | Cannot_coerce_self of Types.type_expr
    30. | Non_collapsable_conjunction of Ident.t * Types.class_declaration - * Errortrace.unification_error
    31. | Self_clash of Errortrace.unification_error
    32. | Mutability_mismatch of string * Asttypes.mutable_flag
    33. | No_overriding of string * string
    34. | Duplicate of string * string
    35. | Closing_self_type of Types.class_signature
    exception Error of Location.t * Env.t * error
    exception Error_forward of Location.error
    val report_error : Env.t -> Stdlib.Format.formatter -> error -> unit
    val type_open_descr : + * Errortrace.unification_error
  • | Self_clash of Errortrace.unification_error
  • | Mutability_mismatch of string * Asttypes.mutable_flag
  • | No_overriding of string * string
  • | Duplicate of string * string
  • | Closing_self_type of Types.class_signature
  • exception Error of Location.t * Env.t * error
    exception Error_forward of Location.error
    val report_error : Env.t -> Stdlib.Format.formatter -> error -> unit
    val report_error_doc : Env.t -> error Format_doc.printer
    val type_open_descr : (?used_slot:bool ref -> Env.t -> Parsetree.open_description -> diff --git a/ocaml/Typecore/index.html b/ocaml/Typecore/index.html index a401eba3..b18a6959 100644 --- a/ocaml/Typecore/index.html +++ b/ocaml/Typecore/index.html @@ -1,8 +1,8 @@ -Typecore (ocaml.Typecore)

    Module Typecore

    type type_forcing_context =
    1. | If_conditional
    2. | If_no_else_branch
    3. | While_loop_conditional
    4. | While_loop_body
    5. | For_loop_start_index
    6. | For_loop_stop_index
    7. | For_loop_body
    8. | Assert_condition
    9. | Sequence_left_hand_side
    10. | When_guard
    type type_expected = private {
    1. ty : Types.type_expr;
    2. explanation : type_forcing_context option;
    }
    type pattern_variable = {
    1. pv_id : Ident.t;
    2. pv_type : Types.type_expr;
    3. pv_loc : Location.t;
    4. pv_as_var : bool;
    5. pv_attributes : Typedtree.attributes;
    }
    val mk_expected : +Typecore (ocaml.Typecore)

    Module Typecore

    type type_forcing_context =
    1. | If_conditional
    2. | If_no_else_branch
    3. | While_loop_conditional
    4. | While_loop_body
    5. | For_loop_start_index
    6. | For_loop_stop_index
    7. | For_loop_body
    8. | Assert_condition
    9. | Sequence_left_hand_side
    10. | When_guard
    type type_expected = private {
    1. ty : Types.type_expr;
    2. explanation : type_forcing_context option;
    }
    type pattern_variable_kind =
    1. | Std_var
    2. | As_var
    3. | Continuation_var
    type pattern_variable = {
    1. pv_id : Ident.t;
    2. pv_type : Types.type_expr;
    3. pv_loc : Location.t;
    4. pv_kind : pattern_variable_kind;
    5. pv_attributes : Typedtree.attributes;
    6. pv_uid : Types.Uid.t;
    }
    val mk_expected : ?explanation:type_forcing_context -> Types.type_expr -> - type_expected
    val is_nonexpansive : Typedtree.expression -> bool
    module Datatype_kind : sig ... end
    type wrong_name = {
    1. type_path : Path.t;
    2. kind : Datatype_kind.t;
    3. name : string Asttypes.loc;
    4. valid_names : string list;
    }
    type wrong_kind_context =
    1. | Pattern
    2. | Expression of type_forcing_context option
    type wrong_kind_sort =
    1. | Constructor
    2. | Record
    3. | Boolean
    4. | List
    5. | Unit
    type existential_restriction =
    1. | At_toplevel
      (*

      no existential types at the toplevel

      *)
    2. | In_group
      (*

      nor with let ... and ...

      *)
    3. | In_rec
      (*

      or recursive definition

      *)
    4. | With_attributes
      (*

      or let[@any_attribute] = ...

      *)
    5. | In_class_args
      (*

      or in class arguments class c (...) = ...

      *)
    6. | In_class_def
      (*

      or in class c = let ... in ...

      *)
    7. | In_self_pattern
      (*

      or in self pattern

      *)
    type module_patterns_restriction =
    1. | Modules_allowed of {
      1. scope : int;
      }
    2. | Modules_rejected
    val type_binding : + type_expected
    val is_nonexpansive : Typedtree.expression -> bool
    module Datatype_kind : sig ... end
    type wrong_name = {
    1. type_path : Path.t;
    2. kind : Datatype_kind.t;
    3. name : string Asttypes.loc;
    4. valid_names : string list;
    }
    type wrong_kind_context =
    1. | Pattern
    2. | Expression of type_forcing_context option
    type wrong_kind_sort =
    1. | Constructor
    2. | Record
    3. | Boolean
    4. | List
    5. | Unit
    type existential_restriction =
    1. | At_toplevel
      (*

      no existential types at the toplevel

      *)
    2. | In_group
      (*

      nor with let ... and ...

      *)
    3. | In_rec
      (*

      or recursive definition

      *)
    4. | With_attributes
      (*

      or let[@any_attribute] = ...

      *)
    5. | In_class_args
      (*

      or in class arguments class c (...) = ...

      *)
    6. | In_class_def
      (*

      or in class c = let ... in ...

      *)
    7. | In_self_pattern
      (*

      or in self pattern

      *)
    val type_binding : Env.t -> Asttypes.rec_flag -> Parsetree.value_binding list -> @@ -25,13 +25,11 @@ Parsetree.pattern -> Typedtree.pattern * pattern_variable list
    val type_expect : - ?in_function:(Location.t * Types.type_expr) -> Env.t -> Parsetree.expression -> type_expected -> @@ -44,15 +42,15 @@ Env.t -> Types.type_expr -> Location.t -> - Typedtree.expression
    val extract_option_type : Env.t -> Types.type_expr -> Types.type_expr
    val generalizable : int -> Types.type_expr -> bool
    val generalize_structure_exp : Typedtree.expression -> unit
    val reset_delayed_checks : unit -> unit
    val force_delayed_checks : unit -> unit
    val name_pattern : string -> Typedtree.pattern list -> Ident.t
    val name_cases : string -> Typedtree.value Typedtree.case list -> Ident.t
    val self_coercion : (Path.t * Location.t list ref) list ref
    type error =
    1. | Constructor_arity_mismatch of Longident.t * int * int
    2. | Label_mismatch of Longident.t * Errortrace.unification_error
    3. | Pattern_type_clash : Errortrace.unification_error + Typedtree.expression
    val extract_option_type : Env.t -> Types.type_expr -> Types.type_expr
    val generalizable : int -> Types.type_expr -> bool
    val reset_delayed_checks : unit -> unit
    val force_delayed_checks : unit -> unit
    val name_pattern : string -> Typedtree.pattern list -> Ident.t
    val name_cases : string -> Typedtree.value Typedtree.case list -> Ident.t
    val self_coercion : (Path.t * Location.t list ref) list ref
    type existential_binding =
    1. | Bind_already_bound
    2. | Bind_not_in_scope
    3. | Bind_non_locally_abstract
    type error =
    1. | Constructor_arity_mismatch of Longident.t * int * int
    2. | Label_mismatch of Longident.t * Errortrace.unification_error
    3. | Pattern_type_clash : Errortrace.unification_error * Parsetree.pattern_desc option -> error
    4. | Or_pattern_type_clash of Ident.t * Errortrace.unification_error
    5. | Multiply_bound_variable of string
    6. | Orpat_vars of Ident.t * Ident.t list
    7. | Expr_type_clash of Errortrace.unification_error * type_forcing_context option - * Parsetree.expression_desc option
    8. | Apply_non_function of {
      1. funct : Typedtree.expression;
      2. func_ty : Types.type_expr;
      3. res_ty : Types.type_expr;
      4. previous_arg_loc : Location.t;
      5. extra_arg_loc : Location.t;
      }
    9. | Apply_wrong_label of Asttypes.arg_label * Types.type_expr * bool
    10. | Label_multiply_defined of string
    11. | Label_missing of Ident.t list
    12. | Label_not_mutable of Longident.t
    13. | Wrong_name of string * type_expected * wrong_name
    14. | Name_type_mismatch of Datatype_kind.t + * Parsetree.expression option
    15. | Function_arity_type_clash of {
      1. syntactic_arity : int;
      2. type_constraint : Types.type_expr;
      3. trace : Errortrace.unification_error;
      }
    16. | Apply_non_function of {
      1. funct : Typedtree.expression;
      2. func_ty : Types.type_expr;
      3. res_ty : Types.type_expr;
      4. previous_arg_loc : Location.t;
      5. extra_arg_loc : Location.t;
      }
    17. | Apply_wrong_label of Asttypes.arg_label * Types.type_expr * bool
    18. | Label_multiply_defined of string
    19. | Label_missing of Ident.t list
    20. | Label_not_mutable of Longident.t
    21. | Wrong_name of string * type_expected * wrong_name
    22. | Name_type_mismatch of Datatype_kind.t * Longident.t * Path.t * Path.t * (Path.t * Path.t) list
    23. | Invalid_format of string
    24. | Not_an_object of Types.type_expr * type_forcing_context option
    25. | Undefined_method of Types.type_expr * string * string list option
    26. | Undefined_self_method of string * string list
    27. | Virtual_class of Longident.t
    28. | Private_type of Types.type_expr
    29. | Private_label of Longident.t * Types.type_expr
    30. | Private_constructor of Types.constructor_description * Types.type_expr
    31. | Unbound_instance_variable of string * string list
    32. | Instance_variable_not_mutable of string
    33. | Not_subtype of Errortrace.Subtype.error
    34. | Outside_class
    35. | Value_multiply_overridden of string
    36. | Coercion_failure of Errortrace.expanded_type * Errortrace.unification_error - * bool
    37. | Not_a_function of Types.type_expr * type_forcing_context option
    38. | Too_many_arguments of Types.type_expr * type_forcing_context option
    39. | Abstract_wrong_label of {
      1. got : Asttypes.arg_label;
      2. expected : Asttypes.arg_label;
      3. expected_type : Types.type_expr;
      4. explanation : type_forcing_context option;
      }
    40. | Scoping_let_module of string * Types.type_expr
    41. | Not_a_polymorphic_variant_type of Longident.t
    42. | Incoherent_label_order
    43. | Less_general of string * Errortrace.unification_error
    44. | Modules_not_allowed
    45. | Cannot_infer_signature
    46. | Not_a_packed_module of Types.type_expr
    47. | Unexpected_existential of existential_restriction * string * string list
    48. | Invalid_interval
    49. | Invalid_for_loop_index
    50. | No_value_clauses
    51. | Exception_pattern_disallowed
    52. | Mixed_value_and_exception_patterns_under_guard
    53. | Inlined_record_escape
    54. | Inlined_record_expected
    55. | Unrefuted_pattern of Typedtree.pattern
    56. | Invalid_extension_constructor_payload
    57. | Not_an_extension_constructor
    58. | Literal_overflow of string
    59. | Unknown_literal of string * char
    60. | Illegal_letrec_pat
    61. | Illegal_letrec_expr
    62. | Illegal_class_expr
    63. | Letop_type_clash of string * Errortrace.unification_error
    64. | Andop_type_clash of string * Errortrace.unification_error
    65. | Bindings_type_clash of Errortrace.unification_error
    66. | Unbound_existential of Ident.t list * Types.type_expr
    67. | Missing_type_constraint
    68. | Wrong_expected_kind of wrong_kind_sort * wrong_kind_context * Types.type_expr
    69. | Expr_not_a_record_type of Types.type_expr
    exception Error of Location.t * Env.t * error
    exception Error_forward of Location.error
    val report_error : loc:Location.t -> Env.t -> error -> Location.error
    val type_module : + * bool
  • | Not_a_function of Types.type_expr * type_forcing_context option
  • | Too_many_arguments of Types.type_expr * type_forcing_context option
  • | Abstract_wrong_label of {
    1. got : Asttypes.arg_label;
    2. expected : Asttypes.arg_label;
    3. expected_type : Types.type_expr;
    4. explanation : type_forcing_context option;
    }
  • | Scoping_let_module of string * Types.type_expr
  • | Not_a_polymorphic_variant_type of Longident.t
  • | Incoherent_label_order
  • | Less_general of string * Errortrace.unification_error
  • | Modules_not_allowed
  • | Cannot_infer_signature
  • | Not_a_packed_module of Types.type_expr
  • | Unexpected_existential of existential_restriction * string
  • | Invalid_interval
  • | Invalid_for_loop_index
  • | No_value_clauses
  • | Exception_pattern_disallowed
  • | Mixed_value_and_exception_patterns_under_guard
  • | Effect_pattern_below_toplevel
  • | Invalid_continuation_pattern
  • | Inlined_record_escape
  • | Inlined_record_expected
  • | Unrefuted_pattern of Typedtree.pattern
  • | Invalid_extension_constructor_payload
  • | Not_an_extension_constructor
  • | Literal_overflow of string
  • | Unknown_literal of string * char
  • | Illegal_letrec_pat
  • | Illegal_letrec_expr
  • | Illegal_class_expr
  • | Letop_type_clash of string * Errortrace.unification_error
  • | Andop_type_clash of string * Errortrace.unification_error
  • | Bindings_type_clash of Errortrace.unification_error
  • | Unbound_existential of Ident.t list * Types.type_expr
  • | Bind_existential of existential_binding * Ident.t * Types.type_expr
  • | Missing_type_constraint
  • | Wrong_expected_kind of wrong_kind_sort * wrong_kind_context * Types.type_expr
  • | Expr_not_a_record_type of Types.type_expr
  • exception Error of Location.t * Env.t * error
    exception Error_forward of Location.error
    val report_error : loc:Location.t -> Env.t -> error -> Location.error
    val type_open : (?used_slot:bool ref -> Asttypes.override_flag -> @@ -76,7 +74,10 @@ Path.t -> (Longident.t * Types.type_expr) list -> Typedtree.module_expr * (Longident.t * Types.type_expr) list) - ref
    val check_recursive_bindings : Env.t -> Typedtree.value_binding list -> unit
    val check_recursive_class_bindings : + ref
    val annotate_recursive_bindings : + Env.t -> + Typedtree.value_binding list -> + Typedtree.value_binding list
    val check_recursive_class_bindings : Env.t -> Ident.t list -> Typedtree.class_expr list -> diff --git a/ocaml/Typedecl/index.html b/ocaml/Typedecl/index.html index dbf54e51..4049a3a2 100644 --- a/ocaml/Typedecl/index.html +++ b/ocaml/Typedecl/index.html @@ -3,18 +3,18 @@ Env.t -> Asttypes.rec_flag -> Parsetree.type_declaration list -> - Typedtree.type_declaration list * Env.t
    val transl_exception : + Typedtree.type_declaration list * Env.t * Shape.t list
    val transl_type_exception : + Typedtree.extension_constructor * Env.t * Shape.t
    val transl_type_exception : Env.t -> Parsetree.type_exception -> - Typedtree.type_exception * Env.t
    val transl_type_extension : + Typedtree.type_exception * Env.t * Shape.t
    val transl_type_extension : bool -> Env.t -> Location.t -> Parsetree.type_extension -> - Typedtree.type_extension * Env.t
    val transl_value_decl : + Typedtree.type_extension * Env.t * Shape.t list
    val transl_value_decl : Env.t -> Location.t -> Parsetree.value_description -> @@ -25,7 +25,11 @@ sig_decl:Types.type_declaration -> outer_env:Env.t -> Parsetree.type_declaration -> - Typedtree.type_declaration
    val abstract_type_decl : injective:bool -> int -> Types.type_declaration
    val approx_type_decl : + Typedtree.type_declaration
    val transl_package_constraint : + loc:Location.t -> + Env.t -> + Types.type_expr -> + Types.type_declaration
    val abstract_type_decl : injective:bool -> int -> Types.type_declaration
    val approx_type_decl : Parsetree.type_declaration list -> (Ident.t * Types.type_declaration) list
    val check_recmod_typedecl : Env.t -> @@ -40,4 +44,4 @@ Types.type_declaration -> unit
    val is_fixed_type : Parsetree.type_declaration -> bool
    type native_repr_kind =
    1. | Unboxed
    2. | Untagged
    type reaching_type_path = reaching_type_step list
    and reaching_type_step =
    1. | Expands_to of Types.type_expr * Types.type_expr
    2. | Contains of Types.type_expr * Types.type_expr
    type error =
    1. | Repeated_parameter
    2. | Duplicate_constructor of string
    3. | Too_many_constructors
    4. | Duplicate_label of string
    5. | Recursive_abbrev of string * Env.t * reaching_type_path
    6. | Cycle_in_def of string * Env.t * reaching_type_path
    7. | Definition_mismatch of Types.type_expr * Env.t - * Includecore.type_mismatch option
    8. | Constraint_failed of Env.t * Errortrace.unification_error
    9. | Inconsistent_constraint of Env.t * Errortrace.unification_error
    10. | Type_clash of Env.t * Errortrace.unification_error
    11. | Non_regular of {
      1. definition : Path.t;
      2. used_as : Types.type_expr;
      3. defined_as : Types.type_expr;
      4. reaching_path : reaching_type_path;
      }
    12. | Null_arity_external
    13. | Missing_native_external
    14. | Unbound_type_var of Types.type_expr * Types.type_declaration
    15. | Cannot_extend_private_type of Path.t
    16. | Not_extensible_type of Path.t
    17. | Extension_mismatch of Path.t * Env.t * Includecore.type_mismatch
    18. | Rebind_wrong_type of Longident.t * Env.t * Errortrace.unification_error
    19. | Rebind_mismatch of Longident.t * Path.t * Path.t
    20. | Rebind_private of Longident.t
    21. | Variance of Typedecl_variance.error
    22. | Unavailable_type_constructor of Path.t
    23. | Unbound_type_var_ext of Types.type_expr * Types.extension_constructor
    24. | Val_in_structure
    25. | Multiple_native_repr_attributes
    26. | Cannot_unbox_or_untag_type of native_repr_kind
    27. | Deep_unbox_or_untag_attribute of native_repr_kind
    28. | Immediacy of Typedecl_immediacy.error
    29. | Separability of Typedecl_separability.error
    30. | Bad_unboxed_attribute of string
    31. | Boxed_and_unboxed
    32. | Nonrec_gadt
    33. | Invalid_private_row_declaration of Types.type_expr
    exception Error of Location.t * error
    val report_error : Stdlib.Format.formatter -> error -> unit
    + * Includecore.type_mismatch option
  • | Constraint_failed of Env.t * Errortrace.unification_error
  • | Inconsistent_constraint of Env.t * Errortrace.unification_error
  • | Type_clash of Env.t * Errortrace.unification_error
  • | Non_regular of {
    1. definition : Path.t;
    2. used_as : Types.type_expr;
    3. defined_as : Types.type_expr;
    4. reaching_path : reaching_type_path;
    }
  • | Null_arity_external
  • | Missing_native_external
  • | Unbound_type_var of Types.type_expr * Types.type_declaration
  • | Cannot_extend_private_type of Path.t
  • | Not_extensible_type of Path.t
  • | Extension_mismatch of Path.t * Env.t * Includecore.type_mismatch
  • | Rebind_wrong_type of Longident.t * Env.t * Errortrace.unification_error
  • | Rebind_mismatch of Longident.t * Path.t * Path.t
  • | Rebind_private of Longident.t
  • | Variance of Typedecl_variance.error
  • | Unavailable_type_constructor of Path.t
  • | Unbound_type_var_ext of Types.type_expr * Types.extension_constructor
  • | Val_in_structure
  • | Multiple_native_repr_attributes
  • | Cannot_unbox_or_untag_type of native_repr_kind
  • | Deep_unbox_or_untag_attribute of native_repr_kind
  • | Immediacy of Typedecl_immediacy.error
  • | Separability of Typedecl_separability.error
  • | Bad_unboxed_attribute of string
  • | Boxed_and_unboxed
  • | Nonrec_gadt
  • | Invalid_private_row_declaration of Types.type_expr
  • exception Error of Location.t * error
    val report_error : error Format_doc.format_printer
    val report_error_doc : error Format_doc.printer
    diff --git a/ocaml/Typedtree/index.html b/ocaml/Typedtree/index.html index 6dd65f7e..39928c65 100644 --- a/ocaml/Typedtree/index.html +++ b/ocaml/Typedtree/index.html @@ -1,11 +1,12 @@ -Typedtree (ocaml.Typedtree)

    Module Typedtree

    Abstract syntax tree after typing

    By comparison with Parsetree:

    • Every Longindent.t is accompanied by a resolved Path.t.
    type partial =
    1. | Partial
    2. | Total

    Extension points

    type attribute = Parsetree.attribute
    type attributes = attribute list

    Core language

    type value =
    1. | Value_pattern
    type computation =
    1. | Computation_pattern
    type _ pattern_category =
    1. | Value : value pattern_category
    2. | Computation : computation pattern_category
    type pattern = value general_pattern
    and 'k general_pattern = 'k pattern_desc pattern_data
    and 'a pattern_data = {
    1. pat_desc : 'a;
    2. pat_loc : Location.t;
    3. pat_extra : (pat_extra * Location.t * attributes) list;
    4. pat_type : Types.type_expr;
    5. pat_env : Env.t;
    6. pat_attributes : attributes;
    }
    and pat_extra =
    1. | Tpat_constraint of core_type
      (*

      P : T pat_desc = P +Typedtree (ocaml.Typedtree)

      Module Typedtree

      Abstract syntax tree after typing

      By comparison with Parsetree:

      • Every Longindent.t is accompanied by a resolved Path.t.
      module Uid = Shape.Uid
      type partial =
      1. | Partial
      2. | Total

      Extension points

      type attribute = Parsetree.attribute
      type attributes = attribute list

      Core language

      type value =
      1. | Value_pattern
      type computation =
      1. | Computation_pattern
      type _ pattern_category =
      1. | Value : value pattern_category
      2. | Computation : computation pattern_category
      type pattern = value general_pattern
      and 'k general_pattern = 'k pattern_desc pattern_data
      and 'a pattern_data = {
      1. pat_desc : 'a;
      2. pat_loc : Location.t;
      3. pat_extra : (pat_extra * Location.t * attributes) list;
      4. pat_type : Types.type_expr;
      5. pat_env : Env.t;
      6. pat_attributes : attributes;
      }
      and pat_extra =
      1. | Tpat_constraint of core_type
        (*

        P : T pat_desc = P ; pat_extra = (Tpat_constraint T, _, _) :: ...

        *)
      2. | Tpat_type of Path.t * Longident.t Asttypes.loc
        (*

        #tconst pat_desc = disjunction ; pat_extra = (Tpat_type (P, "tconst"), _, _) :: ...

        where disjunction is a Tpat_or _ representing the branches of tconst.

        *)
      3. | Tpat_open of Path.t * Longident.t Asttypes.loc * Env.t
      4. | Tpat_unpack
        (*

        (module P) pat_desc = Tpat_var "P" ; pat_extra = (Tpat_unpack, _, _) :: ... (module _) pat_desc = Tpat_any - ; pat_extra = (Tpat_unpack, _, _) :: ...

        *)
      and 'k pattern_desc =
      1. | Tpat_any : value pattern_desc
        (*

        _

        *)
      2. | Tpat_var : Ident.t * string Asttypes.loc -> value pattern_desc
        (*

        x

        *)
      3. | Tpat_alias : value general_pattern + ; pat_extra = (Tpat_unpack, _, _) :: ...

        *)
    and 'k pattern_desc =
    1. | Tpat_any : value pattern_desc
      (*

      _

      *)
    2. | Tpat_var : Ident.t * string Asttypes.loc * Uid.t -> value pattern_desc
      (*

      x

      *)
    3. | Tpat_alias : value general_pattern * Ident.t - * string Asttypes.loc -> value pattern_desc
      (*

      P as a

      *)
    4. | Tpat_constant : Asttypes.constant -> value pattern_desc
      (*

      1, 'a', "true", 1.0, 1l, 1L, 1n

      *)
    5. | Tpat_tuple : value general_pattern list -> value pattern_desc
      (*

      (P1, ..., Pn)

      Invariant: n >= 2

      *)
    6. | Tpat_construct : Longident.t Asttypes.loc + * string Asttypes.loc + * Uid.t -> value pattern_desc
      (*

      P as a

      *)
    7. | Tpat_constant : Asttypes.constant -> value pattern_desc
      (*

      1, 'a', "true", 1.0, 1l, 1L, 1n

      *)
    8. | Tpat_tuple : value general_pattern list -> value pattern_desc
      (*

      (P1, ..., Pn)

      Invariant: n >= 2

      *)
    9. | Tpat_construct : Longident.t Asttypes.loc * Types.constructor_description * value general_pattern list * (Ident.t Asttypes.loc list * core_type) option -> value pattern_desc
      (*

      C (, None) C P (P, None) C (P1, ..., Pn) (P1; ...; Pn, None) C (P : t) (P, Some (, t)) C (P1, ..., Pn : t) (P1; ...; Pn, Some (, t)) C (type a) (P : t) (P, Some (a, t)) C (type a) (P1, ..., Pn : t) (P1; ...; Pn, Some (a, t))

      *)
    10. | Tpat_variant : Asttypes.label @@ -16,10 +17,10 @@ list * Asttypes.closed_flag -> value pattern_desc
      (*

      l1=P1; ...; ln=Pn (flag = Closed) l1=P1; ...; ln=Pn; _ (flag = Open)

      Invariant: n > 0

      *)
    11. | Tpat_array : value general_pattern list -> value pattern_desc
      (*

      | P1; ...; Pn |

      *)
    12. | Tpat_lazy : value general_pattern -> value pattern_desc
      (*

      lazy P

      *)
    13. | Tpat_value : tpat_value_argument -> computation pattern_desc
      (*

      P

      Invariant: Tpat_value pattern should not carry pat_attributes or pat_extra metadata coming from user syntax, which must be on the inner pattern node -- to facilitate searching for a certain value pattern constructor with a specific attributed.

      To enforce this restriction, we made the argument of the Tpat_value constructor a private synonym of pattern, requiring you to use the as_computation_pattern function below instead of using the Tpat_value constructor directly.

      *)
    14. | Tpat_exception : value general_pattern -> computation pattern_desc
      (*

      exception P

      *)
    15. | Tpat_or : 'k general_pattern * 'k general_pattern - * Types.row_desc option -> 'k pattern_desc
      (*

      P1 | P2

      row_desc = Some _ when translating Ppat_type _, None otherwise.

      *)
    and tpat_value_argument = private value general_pattern
    and expression = {
    1. exp_desc : expression_desc;
    2. exp_loc : Location.t;
    3. exp_extra : (exp_extra * Location.t * attributes) list;
    4. exp_type : Types.type_expr;
    5. exp_env : Env.t;
    6. exp_attributes : attributes;
    }
    and exp_extra =
    1. | Texp_constraint of core_type
      (*

      E : T

      *)
    2. | Texp_coerce of core_type option * core_type
      (*

      E :> T Texp_coerce (None, T) E : T0 :> T Texp_coerce (Some T0, T)

      *)
    3. | Texp_poly of core_type option
      (*

      Used for method bodies.

      *)
    4. | Texp_newtype of string
      (*

      fun (type t) ->

      *)
    and expression_desc =
    1. | Texp_ident of Path.t * Longident.t Asttypes.loc * Types.value_description
      (*

      x M.x

      *)
    2. | Texp_constant of Asttypes.constant
      (*

      1, 'a', "true", 1.0, 1l, 1L, 1n

      *)
    3. | Texp_let of Asttypes.rec_flag * value_binding list * expression
      (*

      let P1 = E1 and ... and Pn = EN in E (flag = Nonrecursive) let rec P1 = E1 and ... and Pn = EN in E (flag = Recursive)

      *)
    4. | Texp_function of {
      1. arg_label : Asttypes.arg_label;
      2. param : Ident.t;
      3. cases : value case list;
      4. partial : partial;
      }
      (*

      Pexp_fun and Pexp_function both translate to Texp_function. See Parsetree for more details.

      param is the identifier that is to be used to name the parameter of the function.

      partial = Partial if the pattern match is partial Total otherwise.

      *)
    5. | Texp_apply of expression * (Asttypes.arg_label * expression option) list
      (*

      E0 ~l1:E1 ... ~ln:En

      The expression can be None if the expression is abstracted over this argument. It currently appears when a label is applied.

      For example: let f x ~y = x + y in f ~y:3

      The resulting typedtree for the application is: Texp_apply (Texp_ident "f/1037", (Nolabel, None); + * Types.row_desc option -> 'k pattern_desc

      (*

      P1 | P2

      row_desc = Some _ when translating Ppat_type _, None otherwise.

      *)
    and tpat_value_argument = private value general_pattern
    and expression = {
    1. exp_desc : expression_desc;
    2. exp_loc : Location.t;
    3. exp_extra : (exp_extra * Location.t * attributes) list;
    4. exp_type : Types.type_expr;
    5. exp_env : Env.t;
    6. exp_attributes : attributes;
    }
    and exp_extra =
    1. | Texp_constraint of core_type
      (*

      E : T

      *)
    2. | Texp_coerce of core_type option * core_type
      (*

      E :> T Texp_coerce (None, T) E : T0 :> T Texp_coerce (Some T0, T)

      *)
    3. | Texp_poly of core_type option
      (*

      Used for method bodies.

      *)
    4. | Texp_newtype of string
      (*

      fun (type t) ->

      *)
    and expression_desc =
    1. | Texp_ident of Path.t * Longident.t Asttypes.loc * Types.value_description
      (*

      x M.x

      *)
    2. | Texp_constant of Asttypes.constant
      (*

      1, 'a', "true", 1.0, 1l, 1L, 1n

      *)
    3. | Texp_let of Asttypes.rec_flag * value_binding list * expression
      (*

      let P1 = E1 and ... and Pn = EN in E (flag = Nonrecursive) let rec P1 = E1 and ... and Pn = EN in E (flag = Recursive)

      *)
    4. | Texp_function of function_param list * function_body
      (*

      fun P0 P1 -> function p1 -> e1 | p2 -> e2 (body = Tfunction_cases _) fun P0 P1 -> E (body = Tfunction_body _)

      This construct has the same arity as the originating Pexp_function. Arity determines when side-effects for effectful parameters are run (e.g. optional argument defaults, matching against lazy patterns). Parameters' effects are run left-to-right when an n-ary function is saturated with n arguments.

      *)
    5. | Texp_apply of expression * (Asttypes.arg_label * expression option) list
      (*

      E0 ~l1:E1 ... ~ln:En

      The expression can be None if the expression is abstracted over this argument. It currently appears when a label is applied.

      For example: let f x ~y = x + y in f ~y:3

      The resulting typedtree for the application is: Texp_apply (Texp_ident "f/1037", (Nolabel, None); (Labelled "y", Some (Texp_constant Const_int 3)) - )

      *)
    6. | Texp_match of expression * computation case list * partial
      (*

      match E0 with | P1 -> E1 | P2 | exception P3 -> E2 | exception P4 -> E3

      Texp_match (E0, [(P1, E1); (P2 | exception P3, E2); - (exception P4, E3)], _)

      *)
    7. | Texp_try of expression * value case list
      (*

      try E with P1 -> E1 | ... | PN -> EN

      *)
    8. | Texp_tuple of expression list
      (*

      (E1, ..., EN)

      *)
    9. | Texp_construct of Longident.t Asttypes.loc + )

      *)
  • | Texp_match of expression * computation case list * value case list * partial
    (*

    match E0 with | P1 -> E1 | P2 | exception P3 -> E2 | exception P4 -> E3 | effect P4 k -> E4

    Texp_match (E0, [(P1, E1); (P2 | exception P3, E2); + (exception P4, E3)], [(P4, E4)], _)

    *)
  • | Texp_try of expression * value case list * value case list
    (*

    try E with | P1 -> E1 | effect P2 k -> E2 Texp_try (E, [(P1, E1)], [(P2, E2)])

    *)
  • | Texp_tuple of expression list
    (*

    (E1, ..., EN)

    *)
  • | Texp_construct of Longident.t Asttypes.loc * Types.constructor_description * expression list
    (*

    C C E E C (E1, ..., En) E1;...;En

    *)
  • | Texp_variant of Asttypes.label * expression option
  • | Texp_record of {
    1. fields : (Types.label_description * record_label_definition) array;
    2. representation : Types.record_representation;
    3. extended_expression : expression option;
    }
    (*

    l1=P1; ...; ln=Pn (extended_expression = None) E0 with l1=P1; ...; ln=Pn (extended_expression = Some E0)

    Invariant: n > 0

    If the type is l1: t1; l2: t2 , the expression E0 with t2=P2 is represented as Texp_record fields = [| l1, Kept t1; l2 Override P2 |]; representation; extended_expression = Some E0

    *)
  • | Texp_field of expression * Longident.t Asttypes.loc * Types.label_description
  • | Texp_setfield of expression @@ -34,7 +35,7 @@ * string option Asttypes.loc * Types.module_presence * module_expr - * expression
  • | Texp_letexception of extension_constructor * expression
  • | Texp_assert of expression * Location.t
  • | Texp_lazy of expression
  • | Texp_object of class_structure * string list
  • | Texp_pack of module_expr
  • | Texp_letop of {
    1. let_ : binding_op;
    2. ands : binding_op list;
    3. param : Ident.t;
    4. body : value case;
    5. partial : partial;
    }
  • | Texp_unreachable
  • | Texp_extension_constructor of Longident.t Asttypes.loc * Path.t
  • | Texp_open of open_declaration * expression
    (*

    let open! M in e

    *)
  • and meth =
    1. | Tmeth_name of string
    2. | Tmeth_val of Ident.t
    3. | Tmeth_ancestor of Ident.t * Path.t
    and 'k case = {
    1. c_lhs : 'k general_pattern;
    2. c_guard : expression option;
    3. c_rhs : expression;
    }
    and record_label_definition =
    1. | Kept of Types.type_expr * Asttypes.mutable_flag
    2. | Overridden of Longident.t Asttypes.loc * expression
    and binding_op = {
    1. bop_op_path : Path.t;
    2. bop_op_name : string Asttypes.loc;
    3. bop_op_val : Types.value_description;
    4. bop_op_type : Types.type_expr;
    5. bop_exp : expression;
    6. bop_loc : Location.t;
    }
    and class_expr = {
    1. cl_desc : class_expr_desc;
    2. cl_loc : Location.t;
    3. cl_type : Types.class_type;
    4. cl_env : Env.t;
    5. cl_attributes : attributes;
    }
    and class_expr_desc =
    1. | Tcl_ident of Path.t * Longident.t Asttypes.loc * core_type list
    2. | Tcl_structure of class_structure
    3. | Tcl_fun of Asttypes.arg_label + * expression
    4. | Texp_letexception of extension_constructor * expression
    5. | Texp_assert of expression * Location.t
    6. | Texp_lazy of expression
    7. | Texp_object of class_structure * string list
    8. | Texp_pack of module_expr
    9. | Texp_letop of {
      1. let_ : binding_op;
      2. ands : binding_op list;
      3. param : Ident.t;
      4. body : value case;
      5. partial : partial;
      }
    10. | Texp_unreachable
    11. | Texp_extension_constructor of Longident.t Asttypes.loc * Path.t
    12. | Texp_open of open_declaration * expression
      (*

      let open! M in e

      *)
    and meth =
    1. | Tmeth_name of string
    2. | Tmeth_val of Ident.t
    3. | Tmeth_ancestor of Ident.t * Path.t
    and 'k case = {
    1. c_lhs : 'k general_pattern;
    2. c_cont : Ident.t option;
    3. c_guard : expression option;
    4. c_rhs : expression;
    }
    and function_param = {
    1. fp_arg_label : Asttypes.arg_label;
    2. fp_param : Ident.t;
      (*

      fp_param is the identifier that is to be used to name the parameter of the function.

      *)
    3. fp_partial : partial;
      (*

      fp_partial = Partial if the pattern match is partial Total otherwise.

      *)
    4. fp_kind : function_param_kind;
    5. fp_newtypes : string Asttypes.loc list;
      (*

      fp_newtypes are the new type declarations that come *after* that parameter. The newtypes that come before the first parameter are placed as exp_extras on the Texp_function node. This is just used in Untypeast.

      *)
    6. fp_loc : Location.t;
      (*

      fp_loc is the location of the entire value parameter, not including the fp_newtypes.

      *)
    }
    and function_param_kind =
    1. | Tparam_pat of pattern
      (*

      Tparam_pat p is a non-optional argument with pattern p.

      *)
    2. | Tparam_optional_default of pattern * expression
      (*

      Tparam_optional_default (p, e) is an optional argument p with default value e, i.e. ?x:(p = e). If the parameter is of type a option, the pattern and expression are of type a.

      *)
    and function_body =
    1. | Tfunction_body of expression
    2. | Tfunction_cases of {
      1. cases : value case list;
      2. partial : partial;
      3. param : Ident.t;
      4. loc : Location.t;
      5. exp_extra : exp_extra option;
      6. attributes : attributes;
        (*

        attributes is just used in untypeast.

        *)
      }
      (*

      The function body binds a final argument in Tfunction_cases, and this argument is pattern-matched against the cases.

      *)
    and record_label_definition =
    1. | Kept of Types.type_expr * Asttypes.mutable_flag
    2. | Overridden of Longident.t Asttypes.loc * expression
    and binding_op = {
    1. bop_op_path : Path.t;
    2. bop_op_name : string Asttypes.loc;
    3. bop_op_val : Types.value_description;
    4. bop_op_type : Types.type_expr;
    5. bop_exp : expression;
    6. bop_loc : Location.t;
    }
    and class_expr = {
    1. cl_desc : class_expr_desc;
    2. cl_loc : Location.t;
    3. cl_type : Types.class_type;
    4. cl_env : Env.t;
    5. cl_attributes : attributes;
    }
    and class_expr_desc =
    1. | Tcl_ident of Path.t * Longident.t Asttypes.loc * core_type list
    2. | Tcl_structure of class_structure
    3. | Tcl_fun of Asttypes.arg_label * pattern * (Ident.t * expression) list * class_expr @@ -57,25 +58,27 @@ * Types.module_type * module_type_constraint * module_coercion
      (*

      ME (constraint = Tmodtype_implicit) (ME : MT) (constraint = Tmodtype_explicit MT)

      *)
    4. | Tmod_unpack of expression * Types.module_type
    and structure = {
    1. str_items : structure_item list;
    2. str_type : Types.signature;
    3. str_final_env : Env.t;
    }
    and structure_item = {
    1. str_desc : structure_item_desc;
    2. str_loc : Location.t;
    3. str_env : Env.t;
    }
    and structure_item_desc =
    1. | Tstr_eval of expression * attributes
    2. | Tstr_value of Asttypes.rec_flag * value_binding list
    3. | Tstr_primitive of value_description
    4. | Tstr_type of Asttypes.rec_flag * type_declaration list
    5. | Tstr_typext of type_extension
    6. | Tstr_exception of type_exception
    7. | Tstr_module of module_binding
    8. | Tstr_recmodule of module_binding list
    9. | Tstr_modtype of module_type_declaration
    10. | Tstr_open of open_declaration
    11. | Tstr_class of (class_declaration * string list) list
    12. | Tstr_class_type of (Ident.t * string Asttypes.loc * class_type_declaration) - list
    13. | Tstr_include of include_declaration
    14. | Tstr_attribute of attribute
    and module_binding = {
    1. mb_id : Ident.t option;
    2. mb_name : string option Asttypes.loc;
    3. mb_presence : Types.module_presence;
    4. mb_expr : module_expr;
    5. mb_attributes : attributes;
    6. mb_loc : Location.t;
    }
    and value_binding = {
    1. vb_pat : pattern;
    2. vb_expr : expression;
    3. vb_attributes : attributes;
    4. vb_loc : Location.t;
    }
    and module_coercion =
    1. | Tcoerce_none
    2. | Tcoerce_structure of (int * module_coercion) list - * (Ident.t * int * module_coercion) list
    3. | Tcoerce_functor of module_coercion * module_coercion
    4. | Tcoerce_primitive of primitive_coercion
    5. | Tcoerce_alias of Env.t * Path.t * module_coercion
    and module_type = {
    1. mty_desc : module_type_desc;
    2. mty_type : Types.module_type;
    3. mty_env : Env.t;
    4. mty_loc : Location.t;
    5. mty_attributes : attributes;
    }
    and module_type_desc =
    1. | Tmty_ident of Path.t * Longident.t Asttypes.loc
    2. | Tmty_signature of signature
    3. | Tmty_functor of functor_parameter * module_type
    4. | Tmty_with of module_type - * (Path.t * Longident.t Asttypes.loc * with_constraint) list
    5. | Tmty_typeof of module_expr
    6. | Tmty_alias of Path.t * Longident.t Asttypes.loc
    and primitive_coercion = {
    1. pc_desc : Primitive.description;
    2. pc_type : Types.type_expr;
    3. pc_env : Env.t;
    4. pc_loc : Location.t;
    }
    and signature = {
    1. sig_items : signature_item list;
    2. sig_type : Types.signature;
    3. sig_final_env : Env.t;
    }
    and signature_item = {
    1. sig_desc : signature_item_desc;
    2. sig_env : Env.t;
    3. sig_loc : Location.t;
    }
    and signature_item_desc =
    1. | Tsig_value of value_description
    2. | Tsig_type of Asttypes.rec_flag * type_declaration list
    3. | Tsig_typesubst of type_declaration list
    4. | Tsig_typext of type_extension
    5. | Tsig_exception of type_exception
    6. | Tsig_module of module_declaration
    7. | Tsig_modsubst of module_substitution
    8. | Tsig_recmodule of module_declaration list
    9. | Tsig_modtype of module_type_declaration
    10. | Tsig_modtypesubst of module_type_declaration
    11. | Tsig_open of open_description
    12. | Tsig_include of include_description
    13. | Tsig_class of class_description list
    14. | Tsig_class_type of class_type_declaration list
    15. | Tsig_attribute of attribute
    and module_declaration = {
    1. md_id : Ident.t option;
    2. md_name : string option Asttypes.loc;
    3. md_presence : Types.module_presence;
    4. md_type : module_type;
    5. md_attributes : attributes;
    6. md_loc : Location.t;
    }
    and module_substitution = {
    1. ms_id : Ident.t;
    2. ms_name : string Asttypes.loc;
    3. ms_manifest : Path.t;
    4. ms_txt : Longident.t Asttypes.loc;
    5. ms_attributes : attributes;
    6. ms_loc : Location.t;
    }
    and module_type_declaration = {
    1. mtd_id : Ident.t;
    2. mtd_name : string Asttypes.loc;
    3. mtd_type : module_type option;
    4. mtd_attributes : attributes;
    5. mtd_loc : Location.t;
    }
    and 'a open_infos = {
    1. open_expr : 'a;
    2. open_bound_items : Types.signature;
    3. open_override : Asttypes.override_flag;
    4. open_env : Env.t;
    5. open_loc : Location.t;
    6. open_attributes : attribute list;
    }
    and open_description = (Path.t * Longident.t Asttypes.loc) open_infos
    and open_declaration = module_expr open_infos
    and 'a include_infos = {
    1. incl_mod : 'a;
    2. incl_type : Types.signature;
    3. incl_loc : Location.t;
    4. incl_attributes : attribute list;
    }
    and include_description = module_type include_infos
    and include_declaration = module_expr include_infos
    and with_constraint =
    1. | Twith_type of type_declaration
    2. | Twith_module of Path.t * Longident.t Asttypes.loc
    3. | Twith_modtype of module_type
    4. | Twith_typesubst of type_declaration
    5. | Twith_modsubst of Path.t * Longident.t Asttypes.loc
    6. | Twith_modtypesubst of module_type
    and core_type = {
    1. mutable ctyp_desc : core_type_desc;
      (*

      mutable because of Typeclass.declare_method

      *)
    2. mutable ctyp_type : Types.type_expr;
      (*

      mutable because of Typeclass.declare_method

      *)
    3. ctyp_env : Env.t;
    4. ctyp_loc : Location.t;
    5. ctyp_attributes : attributes;
    }
    and core_type_desc =
    1. | Ttyp_any
    2. | Ttyp_var of string
    3. | Ttyp_arrow of Asttypes.arg_label * core_type * core_type
    4. | Ttyp_tuple of core_type list
    5. | Ttyp_constr of Path.t * Longident.t Asttypes.loc * core_type list
    6. | Ttyp_object of object_field list * Asttypes.closed_flag
    7. | Ttyp_class of Path.t * Longident.t Asttypes.loc * core_type list
    8. | Ttyp_alias of core_type * string
    9. | Ttyp_variant of row_field list + list
    10. | Tstr_include of include_declaration
    11. | Tstr_attribute of attribute
    and module_binding = {
    1. mb_id : Ident.t option;
      (*

      None for module _ = struct ... end

      *)
    2. mb_name : string option Asttypes.loc;
    3. mb_uid : Uid.t;
    4. mb_presence : Types.module_presence;
    5. mb_expr : module_expr;
    6. mb_attributes : attributes;
    7. mb_loc : Location.t;
    }
    and value_binding = {
    1. vb_pat : pattern;
    2. vb_expr : expression;
    3. vb_rec_kind : Value_rec_types.recursive_binding_kind;
    4. vb_attributes : attributes;
    5. vb_loc : Location.t;
    }
    and module_coercion =
    1. | Tcoerce_none
    2. | Tcoerce_structure of (int * module_coercion) list + * (Ident.t * int * module_coercion) list
    3. | Tcoerce_functor of module_coercion * module_coercion
    4. | Tcoerce_primitive of primitive_coercion
      (*

      External declaration coerced to a regular value.

      module M : sig val ext : a -> b end =
      +struct external ext : a -> b = "my_c_function" end

      Only occurs inside a Tcoerce_structure coercion.

      *)
    5. | Tcoerce_alias of Env.t * Path.t * module_coercion
      (*

      Module alias coerced to a regular module.

      module M : sig module Sub : T end =
      +struct module Sub = Some_alias end

      Only occurs inside a Tcoerce_structure coercion.

      *)
    and module_type = {
    1. mty_desc : module_type_desc;
    2. mty_type : Types.module_type;
    3. mty_env : Env.t;
    4. mty_loc : Location.t;
    5. mty_attributes : attributes;
    }
    and module_type_desc =
    1. | Tmty_ident of Path.t * Longident.t Asttypes.loc
    2. | Tmty_signature of signature
    3. | Tmty_functor of functor_parameter * module_type
    4. | Tmty_with of module_type + * (Path.t * Longident.t Asttypes.loc * with_constraint) list
    5. | Tmty_typeof of module_expr
    6. | Tmty_alias of Path.t * Longident.t Asttypes.loc
    and primitive_coercion = {
    1. pc_desc : Primitive.description;
    2. pc_type : Types.type_expr;
    3. pc_env : Env.t;
    4. pc_loc : Location.t;
    }
    and signature = {
    1. sig_items : signature_item list;
    2. sig_type : Types.signature;
    3. sig_final_env : Env.t;
    }
    and signature_item = {
    1. sig_desc : signature_item_desc;
    2. sig_env : Env.t;
    3. sig_loc : Location.t;
    }
    and signature_item_desc =
    1. | Tsig_value of value_description
    2. | Tsig_type of Asttypes.rec_flag * type_declaration list
    3. | Tsig_typesubst of type_declaration list
    4. | Tsig_typext of type_extension
    5. | Tsig_exception of type_exception
    6. | Tsig_module of module_declaration
    7. | Tsig_modsubst of module_substitution
    8. | Tsig_recmodule of module_declaration list
    9. | Tsig_modtype of module_type_declaration
    10. | Tsig_modtypesubst of module_type_declaration
    11. | Tsig_open of open_description
    12. | Tsig_include of include_description
    13. | Tsig_class of class_description list
    14. | Tsig_class_type of class_type_declaration list
    15. | Tsig_attribute of attribute
    and module_declaration = {
    1. md_id : Ident.t option;
    2. md_name : string option Asttypes.loc;
    3. md_uid : Uid.t;
    4. md_presence : Types.module_presence;
    5. md_type : module_type;
    6. md_attributes : attributes;
    7. md_loc : Location.t;
    }
    and module_substitution = {
    1. ms_id : Ident.t;
    2. ms_name : string Asttypes.loc;
    3. ms_uid : Uid.t;
    4. ms_manifest : Path.t;
    5. ms_txt : Longident.t Asttypes.loc;
    6. ms_attributes : attributes;
    7. ms_loc : Location.t;
    }
    and module_type_declaration = {
    1. mtd_id : Ident.t;
    2. mtd_name : string Asttypes.loc;
    3. mtd_uid : Uid.t;
    4. mtd_type : module_type option;
    5. mtd_attributes : attributes;
    6. mtd_loc : Location.t;
    }
    and 'a open_infos = {
    1. open_expr : 'a;
    2. open_bound_items : Types.signature;
    3. open_override : Asttypes.override_flag;
    4. open_env : Env.t;
    5. open_loc : Location.t;
    6. open_attributes : attribute list;
    }
    and open_description = (Path.t * Longident.t Asttypes.loc) open_infos
    and open_declaration = module_expr open_infos
    and 'a include_infos = {
    1. incl_mod : 'a;
    2. incl_type : Types.signature;
    3. incl_loc : Location.t;
    4. incl_attributes : attribute list;
    }
    and include_description = module_type include_infos
    and include_declaration = module_expr include_infos
    and with_constraint =
    1. | Twith_type of type_declaration
    2. | Twith_module of Path.t * Longident.t Asttypes.loc
    3. | Twith_modtype of module_type
    4. | Twith_typesubst of type_declaration
    5. | Twith_modsubst of Path.t * Longident.t Asttypes.loc
    6. | Twith_modtypesubst of module_type
    and core_type = {
    1. mutable ctyp_desc : core_type_desc;
      (*

      mutable because of Typeclass.declare_method

      *)
    2. mutable ctyp_type : Types.type_expr;
      (*

      mutable because of Typeclass.declare_method

      *)
    3. ctyp_env : Env.t;
    4. ctyp_loc : Location.t;
    5. ctyp_attributes : attributes;
    }
    and core_type_desc =
    1. | Ttyp_any
    2. | Ttyp_var of string
    3. | Ttyp_arrow of Asttypes.arg_label * core_type * core_type
    4. | Ttyp_tuple of core_type list
    5. | Ttyp_constr of Path.t * Longident.t Asttypes.loc * core_type list
    6. | Ttyp_object of object_field list * Asttypes.closed_flag
    7. | Ttyp_class of Path.t * Longident.t Asttypes.loc * core_type list
    8. | Ttyp_alias of core_type * string Asttypes.loc
    9. | Ttyp_variant of row_field list * Asttypes.closed_flag - * Asttypes.label list option
    10. | Ttyp_poly of string list * core_type
    11. | Ttyp_package of package_type
    and package_type = {
    1. pack_path : Path.t;
    2. pack_fields : (Longident.t Asttypes.loc * core_type) list;
    3. pack_type : Types.module_type;
    4. pack_txt : Longident.t Asttypes.loc;
    }
    and row_field = {
    1. rf_desc : row_field_desc;
    2. rf_loc : Location.t;
    3. rf_attributes : attributes;
    }
    and row_field_desc =
    1. | Ttag of string Asttypes.loc * bool * core_type list
    2. | Tinherit of core_type
    and object_field = {
    1. of_desc : object_field_desc;
    2. of_loc : Location.t;
    3. of_attributes : attributes;
    }
    and object_field_desc =
    1. | OTtag of string Asttypes.loc * core_type
    2. | OTinherit of core_type
    and value_description = {
    1. val_id : Ident.t;
    2. val_name : string Asttypes.loc;
    3. val_desc : core_type;
    4. val_val : Types.value_description;
    5. val_prim : string list;
    6. val_loc : Location.t;
    7. val_attributes : attributes;
    }
    and type_declaration = {
    1. typ_id : Ident.t;
    2. typ_name : string Asttypes.loc;
    3. typ_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
    4. typ_type : Types.type_declaration;
    5. typ_cstrs : (core_type * core_type * Location.t) list;
    6. typ_kind : type_kind;
    7. typ_private : Asttypes.private_flag;
    8. typ_manifest : core_type option;
    9. typ_loc : Location.t;
    10. typ_attributes : attributes;
    }
    and type_kind =
    1. | Ttype_abstract
    2. | Ttype_variant of constructor_declaration list
    3. | Ttype_record of label_declaration list
    4. | Ttype_open
    and label_declaration = {
    1. ld_id : Ident.t;
    2. ld_name : string Asttypes.loc;
    3. ld_mutable : Asttypes.mutable_flag;
    4. ld_type : core_type;
    5. ld_loc : Location.t;
    6. ld_attributes : attributes;
    }
    and constructor_declaration = {
    1. cd_id : Ident.t;
    2. cd_name : string Asttypes.loc;
    3. cd_vars : string Asttypes.loc list;
    4. cd_args : constructor_arguments;
    5. cd_res : core_type option;
    6. cd_loc : Location.t;
    7. cd_attributes : attributes;
    }
    and constructor_arguments =
    1. | Cstr_tuple of core_type list
    2. | Cstr_record of label_declaration list
    and type_extension = {
    1. tyext_path : Path.t;
    2. tyext_txt : Longident.t Asttypes.loc;
    3. tyext_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
    4. tyext_constructors : extension_constructor list;
    5. tyext_private : Asttypes.private_flag;
    6. tyext_loc : Location.t;
    7. tyext_attributes : attributes;
    }
    and type_exception = {
    1. tyexn_constructor : extension_constructor;
    2. tyexn_loc : Location.t;
    3. tyexn_attributes : attribute list;
    }
    and extension_constructor = {
    1. ext_id : Ident.t;
    2. ext_name : string Asttypes.loc;
    3. ext_type : Types.extension_constructor;
    4. ext_kind : extension_constructor_kind;
    5. ext_loc : Location.t;
    6. ext_attributes : attributes;
    }
    and extension_constructor_kind =
    1. | Text_decl of string Asttypes.loc list + * Asttypes.label list option
    2. | Ttyp_poly of string list * core_type
    3. | Ttyp_package of package_type
    4. | Ttyp_open of Path.t * Longident.t Asttypes.loc * core_type
    and package_type = {
    1. pack_path : Path.t;
    2. pack_fields : (Longident.t Asttypes.loc * core_type) list;
    3. pack_type : Types.module_type;
    4. pack_txt : Longident.t Asttypes.loc;
    }
    and row_field = {
    1. rf_desc : row_field_desc;
    2. rf_loc : Location.t;
    3. rf_attributes : attributes;
    }
    and row_field_desc =
    1. | Ttag of string Asttypes.loc * bool * core_type list
    2. | Tinherit of core_type
    and object_field = {
    1. of_desc : object_field_desc;
    2. of_loc : Location.t;
    3. of_attributes : attributes;
    }
    and object_field_desc =
    1. | OTtag of string Asttypes.loc * core_type
    2. | OTinherit of core_type
    and value_description = {
    1. val_id : Ident.t;
    2. val_name : string Asttypes.loc;
    3. val_desc : core_type;
    4. val_val : Types.value_description;
    5. val_prim : string list;
    6. val_loc : Location.t;
    7. val_attributes : attributes;
    }
    and type_declaration = {
    1. typ_id : Ident.t;
    2. typ_name : string Asttypes.loc;
    3. typ_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
    4. typ_type : Types.type_declaration;
    5. typ_cstrs : (core_type * core_type * Location.t) list;
    6. typ_kind : type_kind;
    7. typ_private : Asttypes.private_flag;
    8. typ_manifest : core_type option;
    9. typ_loc : Location.t;
    10. typ_attributes : attributes;
    }
    and type_kind =
    1. | Ttype_abstract
    2. | Ttype_variant of constructor_declaration list
    3. | Ttype_record of label_declaration list
    4. | Ttype_open
    and label_declaration = {
    1. ld_id : Ident.t;
    2. ld_name : string Asttypes.loc;
    3. ld_uid : Uid.t;
    4. ld_mutable : Asttypes.mutable_flag;
    5. ld_type : core_type;
    6. ld_loc : Location.t;
    7. ld_attributes : attributes;
    }
    and constructor_declaration = {
    1. cd_id : Ident.t;
    2. cd_name : string Asttypes.loc;
    3. cd_uid : Uid.t;
    4. cd_vars : string Asttypes.loc list;
    5. cd_args : constructor_arguments;
    6. cd_res : core_type option;
    7. cd_loc : Location.t;
    8. cd_attributes : attributes;
    }
    and constructor_arguments =
    1. | Cstr_tuple of core_type list
    2. | Cstr_record of label_declaration list
    and type_extension = {
    1. tyext_path : Path.t;
    2. tyext_txt : Longident.t Asttypes.loc;
    3. tyext_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
    4. tyext_constructors : extension_constructor list;
    5. tyext_private : Asttypes.private_flag;
    6. tyext_loc : Location.t;
    7. tyext_attributes : attributes;
    }
    and type_exception = {
    1. tyexn_constructor : extension_constructor;
    2. tyexn_loc : Location.t;
    3. tyexn_attributes : attribute list;
    }
    and extension_constructor = {
    1. ext_id : Ident.t;
    2. ext_name : string Asttypes.loc;
    3. ext_type : Types.extension_constructor;
    4. ext_kind : extension_constructor_kind;
    5. ext_loc : Location.t;
    6. ext_attributes : attributes;
    }
    and extension_constructor_kind =
    1. | Text_decl of string Asttypes.loc list * constructor_arguments * core_type option
    2. | Text_rebind of Path.t * Longident.t Asttypes.loc
    and class_type = {
    1. cltyp_desc : class_type_desc;
    2. cltyp_type : Types.class_type;
    3. cltyp_env : Env.t;
    4. cltyp_loc : Location.t;
    5. cltyp_attributes : attributes;
    }
    and class_type_desc =
    1. | Tcty_constr of Path.t * Longident.t Asttypes.loc * core_type list
    2. | Tcty_signature of class_signature
    3. | Tcty_arrow of Asttypes.arg_label * core_type * class_type
    4. | Tcty_open of open_description * class_type
    and class_signature = {
    1. csig_self : core_type;
    2. csig_fields : class_type_field list;
    3. csig_type : Types.class_signature;
    }
    and class_type_field = {
    1. ctf_desc : class_type_field_desc;
    2. ctf_loc : Location.t;
    3. ctf_attributes : attributes;
    }
    and class_type_field_desc =
    1. | Tctf_inherit of class_type
    2. | Tctf_val of string * Asttypes.mutable_flag * Asttypes.virtual_flag * core_type
    3. | Tctf_method of string * Asttypes.private_flag * Asttypes.virtual_flag - * core_type
    4. | Tctf_constraint of core_type * core_type
    5. | Tctf_attribute of attribute
    and class_declaration = class_expr class_infos
    and class_description = class_type class_infos
    and class_type_declaration = class_type class_infos
    and 'a class_infos = {
    1. ci_virt : Asttypes.virtual_flag;
    2. ci_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
    3. ci_id_name : string Asttypes.loc;
    4. ci_id_class : Ident.t;
    5. ci_id_class_type : Ident.t;
    6. ci_id_object : Ident.t;
    7. ci_expr : 'a;
    8. ci_decl : Types.class_declaration;
    9. ci_type_decl : Types.class_type_declaration;
    10. ci_loc : Location.t;
    11. ci_attributes : attributes;
    }
    type implementation = {
    1. structure : structure;
    2. coercion : module_coercion;
    3. signature : Types.signature;
    4. shape : Shape.t;
    }

    A typechecked implementation including its module structure, its exported signature, and a coercion of the module against that signature.

    If an .mli file is present, the signature will come from that file and be the exported signature of the module.

    If there isn't one, the signature will be inferred from the module structure.

    val as_computation_pattern : pattern -> computation general_pattern

    as_computation_pattern p is a computation pattern with description Tpat_value p, which enforces a correct placement of pat_attributes and pat_extra metadata (on the inner value pattern, rather than on the computation pattern).

    val classify_pattern_desc : 'k pattern_desc -> 'k pattern_category
    val classify_pattern : 'k general_pattern -> 'k pattern_category
    type pattern_action = {
    1. f : 'k. 'k general_pattern -> unit;
    }
    val shallow_iter_pattern_desc : pattern_action -> 'k pattern_desc -> unit
    type pattern_transformation = {
    1. f : 'k. 'k general_pattern -> 'k general_pattern;
    }
    val shallow_map_pattern_desc : + * core_type
  • | Tctf_constraint of core_type * core_type
  • | Tctf_attribute of attribute
  • and class_declaration = class_expr class_infos
    and class_description = class_type class_infos
    and class_type_declaration = class_type class_infos
    and 'a class_infos = {
    1. ci_virt : Asttypes.virtual_flag;
    2. ci_params : (core_type * (Asttypes.variance * Asttypes.injectivity)) list;
    3. ci_id_name : string Asttypes.loc;
    4. ci_id_class : Ident.t;
    5. ci_id_class_type : Ident.t;
    6. ci_id_object : Ident.t;
    7. ci_expr : 'a;
    8. ci_decl : Types.class_declaration;
    9. ci_type_decl : Types.class_type_declaration;
    10. ci_loc : Location.t;
    11. ci_attributes : attributes;
    }
    type implementation = {
    1. structure : structure;
    2. coercion : module_coercion;
    3. signature : Types.signature;
    4. shape : Shape.t;
    }

    A typechecked implementation including its module structure, its exported signature, and a coercion of the module against that signature.

    If an .mli file is present, the signature will come from that file and be the exported signature of the module.

    If there isn't one, the signature will be inferred from the module structure.

    type item_declaration =
    1. | Value of value_description
    2. | Value_binding of value_binding
    3. | Type of type_declaration
    4. | Constructor of constructor_declaration
    5. | Extension_constructor of extension_constructor
    6. | Label of label_declaration
    7. | Module of module_declaration
    8. | Module_substitution of module_substitution
    9. | Module_binding of module_binding
    10. | Module_type of module_type_declaration
    11. | Class of class_declaration
    12. | Class_type of class_type_declaration
      (*

      item_declaration groups together items that correspond to the syntactic category of "declarations" which include types, values, modules, etc. declarations in signatures and their definitions in implementations.

      *)
    val as_computation_pattern : pattern -> computation general_pattern

    as_computation_pattern p is a computation pattern with description Tpat_value p, which enforces a correct placement of pat_attributes and pat_extra metadata (on the inner value pattern, rather than on the computation pattern).

    val classify_pattern_desc : 'k pattern_desc -> 'k pattern_category
    val classify_pattern : 'k general_pattern -> 'k pattern_category
    type pattern_action = {
    1. f : 'k. 'k general_pattern -> unit;
    }
    val shallow_iter_pattern_desc : pattern_action -> 'k pattern_desc -> unit
    type pattern_transformation = {
    1. f : 'k. 'k general_pattern -> 'k general_pattern;
    }
    val shallow_map_pattern_desc : pattern_transformation -> 'k pattern_desc -> 'k pattern_desc
    val iter_general_pattern : pattern_action -> 'k general_pattern -> unit
    val iter_pattern : (pattern -> unit) -> pattern -> unit
    type pattern_predicate = {
    1. f : 'k. 'k general_pattern -> bool;
    }
    val exists_general_pattern : pattern_predicate -> 'k general_pattern -> bool
    val exists_pattern : (pattern -> bool) -> pattern -> bool
    val let_bound_idents : value_binding list -> Ident.t list
    val let_bound_idents_full : value_binding list -> - (Ident.t * string Asttypes.loc * Types.type_expr) list
    val alpha_pat : + (Ident.t * string Asttypes.loc * Types.type_expr * Types.Uid.t) list
    val alpha_pat : (Ident.t * Ident.t) list -> 'k general_pattern -> 'k general_pattern

    Alpha conversion of patterns

    val mknoloc : 'a -> 'a Asttypes.loc
    val mkloc : 'a -> Location.t -> 'a Asttypes.loc
    val pat_bound_idents : 'k general_pattern -> Ident.t list
    val pat_bound_idents_full : 'k general_pattern -> - (Ident.t * string Asttypes.loc * Types.type_expr) list
    val split_pattern : + (Ident.t * string Asttypes.loc * Types.type_expr * Types.Uid.t) list
    val split_pattern : computation general_pattern -> - pattern option * pattern option

    Splits an or pattern into its value (left) and exception (right) parts.

    val exp_is_nominal : expression -> bool

    Whether an expression looks nice as the subject of a sentence in a error message.

    + pattern option * pattern option

    Splits an or pattern into its value (left) and exception (right) parts.

    diff --git a/ocaml/Typemod/Sig_component_kind/index.html b/ocaml/Typemod/Sig_component_kind/index.html index 00c77a2d..6672c529 100644 --- a/ocaml/Typemod/Sig_component_kind/index.html +++ b/ocaml/Typemod/Sig_component_kind/index.html @@ -1,2 +1,2 @@ -Sig_component_kind (ocaml.Typemod.Sig_component_kind)

    Module Typemod.Sig_component_kind

    type t =
    1. | Value
    2. | Type
    3. | Module
    4. | Module_type
    5. | Extension_constructor
    6. | Class
    7. | Class_type
    val to_string : t -> string
    +Sig_component_kind (ocaml.Typemod.Sig_component_kind)

    Module Typemod.Sig_component_kind

    type t =
    1. | Value
    2. | Type
    3. | Constructor
    4. | Label
    5. | Module
    6. | Module_type
    7. | Extension_constructor
    8. | Class
    9. | Class_type
    val to_string : t -> string
    diff --git a/ocaml/Typemod/index.html b/ocaml/Typemod/index.html index 7ed21f4d..7ef1f349 100644 --- a/ocaml/Typemod/index.html +++ b/ocaml/Typemod/index.html @@ -9,32 +9,27 @@ Env.t -> Parsetree.structure -> Typedtree.structure * Types.signature * Signature_names.t * Shape.t * Env.t
    val type_implementation : - string -> - string -> - string -> + Unit_info.t -> Env.t -> Parsetree.structure -> - Typedtree.implementation
    val type_interface : Env.t -> Parsetree.signature -> Typedtree.signature
    val transl_signature : Env.t -> Parsetree.signature -> Typedtree.signature
    val check_nongen_signature : Env.t -> Types.signature -> unit
    val modtype_of_package : + Typedtree.implementation
    val type_interface : Env.t -> Parsetree.signature -> Typedtree.signature
    val check_nongen_signature : Env.t -> Types.signature -> unit
    val modtype_of_package : Env.t -> Location.t -> Path.t -> (Longident.t * Types.type_expr) list -> Types.module_type
    val path_of_module : Typedtree.module_expr -> Path.t option
    val save_signature : - string -> + Unit_info.t -> Typedtree.signature -> - string -> - string -> Env.t -> Cmi_format.cmi_infos -> unit
    val package_units : Env.t -> string list -> - string -> - string -> + Unit_info.Artifact.t -> Typedtree.module_coercion
    val initial_env : loc:Location.t -> initially_opened_module:string option -> open_implicit_modules:string list -> Env.t
    module Sig_component_kind : sig ... end
    type hiding_error =
    1. | Illegal_shadowing of {
      1. shadowed_item_id : Ident.t;
      2. shadowed_item_kind : Sig_component_kind.t;
      3. shadowed_item_loc : Location.t;
      4. shadower_id : Ident.t;
      5. user_id : Ident.t;
      6. user_kind : Sig_component_kind.t;
      7. user_loc : Location.t;
      }
    2. | Appears_in_signature of {
      1. opened_item_id : Ident.t;
      2. opened_item_kind : Sig_component_kind.t;
      3. user_id : Ident.t;
      4. user_kind : Sig_component_kind.t;
      5. user_loc : Location.t;
      }
    type error =
    1. | Cannot_apply of Types.module_type
    2. | Not_included of Includemod.explanation
    3. | Cannot_eliminate_dependency of Types.module_type
    4. | Signature_expected
    5. | Structure_expected of Types.module_type
    6. | With_no_component of Longident.t
    7. | With_mismatch of Longident.t * Includemod.explanation
    8. | With_makes_applicative_functor_ill_typed of Longident.t * Path.t - * Includemod.explanation
    9. | With_changes_module_alias of Longident.t * Ident.t * Path.t
    10. | With_cannot_remove_constrained_type
    11. | Repeated_name of Sig_component_kind.t * string
    12. | Non_generalizable of {
      1. vars : Types.type_expr list;
      2. expression : Types.type_expr;
      }
    13. | Non_generalizable_module of {
      1. vars : Types.type_expr list;
      2. item : Types.value_description;
      3. mty : Types.module_type;
      }
    14. | Implementation_is_required of string
    15. | Interface_not_compiled of string
    16. | Not_allowed_in_functor_body
    17. | Not_a_packed_module of Types.type_expr
    18. | Incomplete_packed_module of Types.type_expr
    19. | Scoping_pack of Longident.t * Types.type_expr
    20. | Recursive_module_require_explicit_type
    21. | Apply_generative
    22. | Cannot_scrape_alias of Path.t
    23. | Cannot_scrape_package_type of Path.t
    24. | Badly_formed_signature of string * Typedecl.error
    25. | Cannot_hide_id of hiding_error
    26. | Invalid_type_subst_rhs
    27. | Unpackable_local_modtype_subst of Path.t
    28. | With_cannot_remove_packed_modtype of Path.t * Types.module_type
    exception Error of Location.t * Env.t * error
    exception Error_forward of Location.error
    val report_error : Env.t -> loc:Location.t -> error -> Location.error
    + * Includemod.explanation
  • | With_changes_module_alias of Longident.t * Ident.t * Path.t
  • | With_cannot_remove_constrained_type
  • | With_package_manifest of Longident.t * Types.type_expr
  • | Repeated_name of Sig_component_kind.t * string
  • | Non_generalizable of {
    1. vars : Types.type_expr list;
    2. expression : Types.type_expr;
    }
  • | Non_generalizable_module of {
    1. vars : Types.type_expr list;
    2. item : Types.value_description;
    3. mty : Types.module_type;
    }
  • | Implementation_is_required of string
  • | Interface_not_compiled of string
  • | Not_allowed_in_functor_body
  • | Not_a_packed_module of Types.type_expr
  • | Incomplete_packed_module of Types.type_expr
  • | Scoping_pack of Longident.t * Types.type_expr
  • | Recursive_module_require_explicit_type
  • | Apply_generative
  • | Cannot_scrape_alias of Path.t
  • | Cannot_scrape_package_type of Path.t
  • | Badly_formed_signature of string * Typedecl.error
  • | Cannot_hide_id of hiding_error
  • | Invalid_type_subst_rhs
  • | Non_packable_local_modtype_subst of Path.t
  • | With_cannot_remove_packed_modtype of Path.t * Types.module_type
  • | Cannot_alias of Path.t
  • exception Error of Location.t * Env.t * error
    exception Error_forward of Location.error
    val report_error : Env.t -> loc:Location.t -> error -> Location.error
    diff --git a/ocaml/Typeopt/index.html b/ocaml/Typeopt/index.html index 42a7eb5b..262914a0 100644 --- a/ocaml/Typeopt/index.html +++ b/ocaml/Typeopt/index.html @@ -8,7 +8,7 @@ Lambda.immediate_or_pointer
    val array_type_kind : Env.t -> Types.type_expr -> Lambda.array_kind
    val array_pattern_kind : Typedtree.pattern -> Lambda.array_kind
    val bigarray_type_kind_and_layout : Env.t -> Types.type_expr -> - Lambda.bigarray_kind * Lambda.bigarray_layout
    val value_kind : Env.t -> Types.type_expr -> Lambda.value_kind
    val function_return_value_kind : Env.t -> Types.type_expr -> Lambda.value_kind
    val classify_lazy_argument : + Lambda.bigarray_kind * Lambda.bigarray_layout
    val value_kind : Env.t -> Types.type_expr -> Lambda.value_kind
    val classify_lazy_argument : Typedtree.expression -> [ `Constant_or_function | `Float_that_cannot_be_shortcut diff --git a/ocaml/Types/TransientTypeHash/index.html b/ocaml/Types/TransientTypeHash/index.html new file mode 100644 index 00000000..475112ad --- /dev/null +++ b/ocaml/Types/TransientTypeHash/index.html @@ -0,0 +1,2 @@ + +TransientTypeHash (ocaml.Types.TransientTypeHash)

    Module Types.TransientTypeHash

    type key = transient_expr
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    • since 4.00
    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
    • since 4.05
    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
    • since 4.03
    val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    • since 4.00
    val to_seq : 'a t -> (key * 'a) Seq.t
    • since 4.07
    val to_seq_keys : _ t -> key Seq.t
    • since 4.07
    val to_seq_values : 'a t -> 'a Seq.t
    • since 4.07
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t
    • since 4.07
    diff --git a/ocaml/Types/Transient_expr/index.html b/ocaml/Types/Transient_expr/index.html index df8fa591..28e118e3 100644 --- a/ocaml/Types/Transient_expr/index.html +++ b/ocaml/Types/Transient_expr/index.html @@ -1,2 +1,2 @@ -Transient_expr (ocaml.Types.Transient_expr)

    Module Types.Transient_expr

    Operations on transient_expr

    val create : type_desc -> level:int -> scope:int -> id:int -> transient_expr
    val set_desc : transient_expr -> type_desc -> unit
    val set_level : transient_expr -> int -> unit
    val set_scope : transient_expr -> int -> unit
    val type_expr : transient_expr -> type_expr
    val coerce : type_expr -> transient_expr

    Coerce without normalizing with repr

    val set_stub_desc : type_expr -> type_desc -> unit

    Instantiate a not yet instantiated stub. Fail if already instantiated.

    +Transient_expr (ocaml.Types.Transient_expr)

    Module Types.Transient_expr

    Operations on transient_expr

    val create : type_desc -> level:int -> scope:int -> id:int -> transient_expr
    val get_scope : transient_expr -> int
    val get_marks : transient_expr -> int
    val set_desc : transient_expr -> type_desc -> unit
    val set_level : transient_expr -> int -> unit
    val set_scope : transient_expr -> int -> unit
    val type_expr : transient_expr -> type_expr
    val coerce : type_expr -> transient_expr

    Coerce without normalizing with repr

    val set_stub_desc : type_expr -> type_desc -> unit

    Instantiate a not yet instantiated stub. Fail if already instantiated.

    val try_mark_node : type_mark -> transient_expr -> bool
    diff --git a/ocaml/Types/Variance/index.html b/ocaml/Types/Variance/index.html index 5b850e2b..e00369b4 100644 --- a/ocaml/Types/Variance/index.html +++ b/ocaml/Types/Variance/index.html @@ -1,2 +1,2 @@ -Variance (ocaml.Types.Variance)

    Module Types.Variance

    type t
    type f =
    1. | May_pos
    2. | May_neg
    3. | May_weak
    4. | Inj
    5. | Pos
    6. | Neg
    7. | Inv
    val null : t
    val full : t
    val covariant : t
    val unknown : t
    val union : t -> t -> t
    val inter : t -> t -> t
    val subset : t -> t -> bool
    val eq : t -> t -> bool
    val set : f -> t -> t
    val set_if : bool -> f -> t -> t
    val mem : f -> t -> bool
    val conjugate : t -> t
    val compose : t -> t -> t
    val strengthen : t -> t
    val get_upper : t -> bool * bool
    val get_lower : t -> bool * bool * bool
    val unknown_signature : injective:bool -> arity:int -> t list

    The most pessimistic variance for a completely unknown type.

    +Variance (ocaml.Types.Variance)

    Module Types.Variance

    type t
    type f =
    1. | May_pos
    2. | May_neg
    3. | May_weak
    4. | Inj
    5. | Pos
    6. | Neg
    7. | Inv
    val null : t
    val full : t
    val covariant : t
    val contravariant : t
    val unknown : t
    val union : t -> t -> t
    val inter : t -> t -> t
    val subset : t -> t -> bool
    val eq : t -> t -> bool
    val set : f -> t -> t
    val set_if : bool -> f -> t -> t
    val mem : f -> t -> bool
    val conjugate : t -> t
    val compose : t -> t -> t
    val strengthen : t -> t
    val get_upper : t -> bool * bool
    val get_lower : t -> bool * bool * bool
    val unknown_signature : injective:bool -> arity:int -> t list

    The most pessimistic variance for a completely unknown type.

    diff --git a/ocaml/Types/index.html b/ocaml/Types/index.html index dbd591be..0440423a 100644 --- a/ocaml/Types/index.html +++ b/ocaml/Types/index.html @@ -1,6 +1,6 @@ Types (ocaml.Types)

    Module Types

    Representation of types and declarations

    Types defines the representation of types and declarations (that is, the content of module signatures).

    CMI files are made of marshalled types.

    Asttypes exposes basic definitions shared both by Parsetree and Types.

    type type_expr

    Type expressions for the core language.

    The type_desc variant defines all the possible type expressions one can find in OCaml. type_expr wraps this with some annotations.

    The level field tracks the level of polymorphism associated to a type, guiding the generalization algorithm. Put shortly, when referring to a type in a given environment, both the type and the environment have a level. If the type has an higher level, then it can be considered fully polymorphic (type variables will be printed as 'a), otherwise it'll be weakly polymorphic, or non generalized (type variables printed as '_a). See http://okmij.org/ftp/ML/generalization.html for more information.

    Note about type_declaration: one should not make the confusion between type_expr and type_declaration.

    type_declaration refers specifically to the type construct in OCaml language, where you create and name a new type or type alias.

    type_expr is used when you refer to existing types, e.g. when annotating the expected type of a value.

    Also, as the type system of OCaml is generative, a type_declaration can have the side-effect of introducing a new type constructor, different from all other known types. Whereas type_expr is a pure construct which allows referring to existing types.

    Note on mutability: TBD.

    type row_desc
    type row_field
    type field_kind
    type commutable
    type type_desc =
    1. | Tvar of string option
      (*

      Tvar (Some "a") ==> 'a or '_a Tvar None ==> _

      *)
    2. | Tarrow of Asttypes.arg_label * type_expr * type_expr * commutable
      (*

      Tarrow (Nolabel, e1, e2, c) ==> e1 -> e2 Tarrow (Labelled "l", e1, e2, c) ==> l:e1 -> e2 Tarrow (Optional "l", e1, e2, c) ==> ?l:e1 -> e2

      See commutable for the last argument.

      *)
    3. | Ttuple of type_expr list
      (*

      Ttuple [t1;...;tn] ==> (t1 * ... * tn)

      *)
    4. | Tconstr of Path.t * type_expr list * abbrev_memo ref
      (*

      Tconstr (`A.B.t', [t1;...;tn], _) ==> (t1,...,tn) A.B.t The last parameter keep tracks of known expansions, see abbrev_memo.

      *)
    5. | Tobject of type_expr * (Path.t * type_expr list) option ref
      (*

      Tobject (`f1:t1;...;fn: tn', `None') ==> < f1: t1; ...; fn: tn > f1, fn are represented as a linked list of types using Tfield and Tnil constructors.

      Tobject (_, `Some (`A.ct', [t1;...;tn]') ==> (t1, ..., tn) A.ct. where A.ct is the type of some class.

      There are also special cases for so-called "class-types", cf. Typeclass and Ctype.set_object_name:

      Tobject (Tfield(_,_,...(Tfield(_,_,rv)...), - Some(`A.#ct`, [rv;t1;...;tn]) ==> (t1, ..., tn) #A.ct Tobject (_, Some(`A.#ct`, [Tnil;t1;...;tn]) ==> (t1, ..., tn) A.ct

      where rv is the hidden row variable.

      *)
    6. | Tfield of string * field_kind * type_expr * type_expr
      (*

      Tfield ("foo", field_public, t, ts) ==> <...; foo : t; ts>

      *)
    7. | Tnil
      (*

      Tnil ==> <...; >

      *)
    8. | Tsubst of type_expr * type_expr option
      (*

      Tsubst is used temporarily to store information in low-level functions manipulating representation of types, such as instantiation or copy. The first argument contains a copy of the original node. The second is available only when the first is the row variable of a polymorphic variant. It then contains a copy of the whole variant. This constructor should not appear outside of these cases.

      *)
    9. | Tvariant of row_desc
      (*

      Representation of polymorphic variants, see row_desc.

      *)
    10. | Tunivar of string option
      (*

      Occurrence of a type variable introduced by a forall quantifier / Tpoly.

      *)
    11. | Tpoly of type_expr * type_expr list
      (*

      Tpoly (ty,tyl) ==> 'a1... 'an. ty, where 'a1 ... 'an are names given to types in tyl and occurrences of those types in ty.

      *)
    12. | Tpackage of Path.t * (Longident.t * type_expr) list
      (*

      Type of a first-class module (a.k.a package).

      *)
    and fixed_explanation =
    1. | Univar of type_expr
      (*

      The row type was bound to an univar

      *)
    2. | Fixed_private
      (*

      The row type is private

      *)
    3. | Reified of Path.t
      (*

      The row was reified

      *)
    4. | Rigid
      (*

      The row type was made rigid during constraint verification

      *)
    and abbrev_memo =
    1. | Mnil
      (*

      No known abbreviation

      *)
    2. | Mcons of Asttypes.private_flag * Path.t * type_expr * type_expr * abbrev_memo
      (*

      Found one abbreviation. A valid abbreviation should be at least as visible and reachable by the same path. The first expression is the abbreviation and the second the expansion.

      *)

    abbrev_memo allows one to keep track of different expansions of a type alias. This is done for performance purposes.

    For instance, when defining type 'a pair = 'a * 'a, when one refers to an 'a pair, it is just a shortcut for the 'a * 'a type. This expansion will be stored in the abbrev_memo of the corresponding Tconstr node.

    In practice, abbrev_memo behaves like list of expansions with a mutable tail.

    Note on marshalling: abbrev_memo must not appear in saved types. Btype, with cleanup_abbrev and memo, takes care of tracking and removing abbreviations.

    commutable is a flag appended to every arrow type.

    When typing an application, if the type of the functional is known, its type is instantiated with commu_ok arrows, otherwise as commu_var ().

    When the type is not known, the application will be used to infer the actual type. This is fragile in presence of labels where there is no principal type.

    Two incompatible applications must rely on is_commu_ok arrows, otherwise they will trigger an error.

    let f g = g ~a:() ~b:(); g ~b:() ~a:();

    Error: This function is applied to arguments in an order different from other calls. This is only allowed when the real type is known.

    val is_commu_ok : commutable -> bool
    val commu_ok : commutable
    val commu_var : unit -> commutable

    field_kind indicates the accessibility of a method.

    An Fprivate field may become Fpublic or Fabsent during unification, but not the other way round.

    The same field_kind is kept shared when copying Tfield nodes so that the copies of the self-type of a class share the same accessibility (see also PR#10539).

    type field_kind_view =
    1. | Fprivate
    2. | Fpublic
    3. | Fabsent
    val field_kind_repr : field_kind -> field_kind_view
    val field_public : field_kind
    val field_absent : field_kind
    val field_private : unit -> field_kind
    val field_kind_internal_repr : field_kind -> field_kind

    Getters for type_expr; calls repr before answering a value

    val get_desc : type_expr -> type_desc
    val get_level : type_expr -> int
    val get_scope : type_expr -> int
    val get_id : type_expr -> int
    type transient_expr = private {
    1. mutable desc : type_desc;
    2. mutable level : int;
    3. mutable scope : int;
    4. id : int;
    }

    Transient type_expr. Should only be used immediately after Transient_expr.repr

    module Transient_expr : sig ... end

    Operations on transient_expr

    val create_expr : type_desc -> level:int -> scope:int -> id:int -> type_expr

    Functions and definitions moved from Btype

    val newty3 : level:int -> scope:int -> type_desc -> type_expr

    Create a type with a fresh id

    val newty2 : level:int -> type_desc -> type_expr

    Create a type with a fresh id and no scope

    module TransientTypeOps : sig ... end

    Comparisons for functors

    Comparisons for type_expr; cannot be used for functors

    val eq_type : type_expr -> type_expr -> bool
    val compare_type : type_expr -> type_expr -> int

    Constructor and accessors for row_desc

    `X | `Y (row_closed = true) < `X | `Y (row_closed = true) > `X | `Y (row_closed = false) < `X | `Y > `X (row_closed = true)

    type t = > `X as 'a (row_more = Tvar a) type t = private > `X (row_more = Tconstr ("t#row", , ref Mnil))

    And for:

    let f = function `X -> `X -> | `Y -> `X

    the type of "f" will be a Tarrow whose lhs will (basically) be:

    Tvariant row_fields = [("X", _)]; + Some(`A.#ct`, [rv;t1;...;tn]) ==> (t1, ..., tn) #A.ct Tobject (_, Some(`A.#ct`, [Tnil;t1;...;tn]) ==> (t1, ..., tn) A.ct

    where rv is the hidden row variable.

    *)
  • | Tfield of string * field_kind * type_expr * type_expr
    (*

    Tfield ("foo", field_public, t, ts) ==> <...; foo : t; ts>

    *)
  • | Tnil
    (*

    Tnil ==> <...; >

    *)
  • | Tsubst of type_expr * type_expr option
    (*

    Tsubst is used temporarily to store information in low-level functions manipulating representation of types, such as instantiation or copy. The first argument contains a copy of the original node. The second is available only when the first is the row variable of a polymorphic variant. It then contains a copy of the whole variant. This constructor should not appear outside of these cases.

    *)
  • | Tvariant of row_desc
    (*

    Representation of polymorphic variants, see row_desc.

    *)
  • | Tunivar of string option
    (*

    Occurrence of a type variable introduced by a forall quantifier / Tpoly.

    *)
  • | Tpoly of type_expr * type_expr list
    (*

    Tpoly (ty,tyl) ==> 'a1... 'an. ty, where 'a1 ... 'an are names given to types in tyl and occurrences of those types in ty.

    *)
  • | Tpackage of Path.t * (Longident.t * type_expr) list
    (*

    Type of a first-class module (a.k.a package).

    *)
  • and fixed_explanation =
    1. | Univar of type_expr
      (*

      The row type was bound to an univar

      *)
    2. | Fixed_private
      (*

      The row type is private

      *)
    3. | Reified of Path.t
      (*

      The row was reified

      *)
    4. | Rigid
      (*

      The row type was made rigid during constraint verification

      *)
    and abbrev_memo =
    1. | Mnil
      (*

      No known abbreviation

      *)
    2. | Mcons of Asttypes.private_flag * Path.t * type_expr * type_expr * abbrev_memo
      (*

      Found one abbreviation. A valid abbreviation should be at least as visible and reachable by the same path. The first expression is the abbreviation and the second the expansion.

      *)

    abbrev_memo allows one to keep track of different expansions of a type alias. This is done for performance purposes.

    For instance, when defining type 'a pair = 'a * 'a, when one refers to an 'a pair, it is just a shortcut for the 'a * 'a type. This expansion will be stored in the abbrev_memo of the corresponding Tconstr node.

    In practice, abbrev_memo behaves like list of expansions with a mutable tail.

    Note on marshalling: abbrev_memo must not appear in saved types. Btype, with cleanup_abbrev and memo, takes care of tracking and removing abbreviations.

    commutable is a flag appended to every arrow type.

    When typing an application, if the type of the functional is known, its type is instantiated with commu_ok arrows, otherwise as commu_var ().

    When the type is not known, the application will be used to infer the actual type. This is fragile in presence of labels where there is no principal type.

    Two incompatible applications must rely on is_commu_ok arrows, otherwise they will trigger an error.

    let f g = g ~a:() ~b:(); g ~b:() ~a:();

    Error: This function is applied to arguments in an order different from other calls. This is only allowed when the real type is known.

    val is_commu_ok : commutable -> bool
    val commu_ok : commutable
    val commu_var : unit -> commutable

    field_kind indicates the accessibility of a method.

    An Fprivate field may become Fpublic or Fabsent during unification, but not the other way round.

    The same field_kind is kept shared when copying Tfield nodes so that the copies of the self-type of a class share the same accessibility (see also PR#10539).

    type field_kind_view =
    1. | Fprivate
    2. | Fpublic
    3. | Fabsent
    val field_kind_repr : field_kind -> field_kind_view
    val field_public : field_kind
    val field_absent : field_kind
    val field_private : unit -> field_kind
    val field_kind_internal_repr : field_kind -> field_kind

    Getters for type_expr; calls repr before answering a value

    val get_desc : type_expr -> type_desc
    val get_level : type_expr -> int
    val get_scope : type_expr -> int
    val get_id : type_expr -> int
    type type_mark

    Access to marks. They are stored in the scope field.

    val with_type_mark : (type_mark -> 'a) -> 'a
    val not_marked_node : type_mark -> type_expr -> bool
    val try_mark_node : type_mark -> type_expr -> bool
    type transient_expr = private {
    1. mutable desc : type_desc;
    2. mutable level : int;
    3. mutable scope : scope_field;
    4. id : int;
    }

    Transient type_expr. Should only be used immediately after Transient_expr.repr

    and scope_field
    module Transient_expr : sig ... end

    Operations on transient_expr

    val create_expr : type_desc -> level:int -> scope:int -> id:int -> type_expr

    Functions and definitions moved from Btype

    val proto_newty3 : level:int -> scope:int -> type_desc -> transient_expr

    Create a type with a fresh id

    module TransientTypeOps : sig ... end

    Comparisons for functors

    Comparisons for type_expr; cannot be used for functors

    val eq_type : type_expr -> type_expr -> bool
    val compare_type : type_expr -> type_expr -> int

    Constructor and accessors for row_desc

    `X | `Y (row_closed = true) < `X | `Y (row_closed = true) > `X | `Y (row_closed = false) < `X | `Y > `X (row_closed = true)

    type t = > `X as 'a (row_more = Tvar a) type t = private > `X (row_more = Tconstr ("t#row", , ref Mnil))

    And for:

    let f = function `X -> `X -> | `Y -> `X

    the type of "f" will be a Tarrow whose lhs will (basically) be:

    Tvariant row_fields = [("X", _)]; row_more = Tvariant { row_fields = [("Y", _)]; row_more = @@ -17,14 +17,19 @@ no_arg:bool -> type_expr list -> matched:bool -> - row_field

    val rf_either_of : type_expr option -> row_field
    val eq_row_field_ext : row_field -> row_field -> bool
    val changed_row_field_exts : row_field list -> (unit -> unit) -> bool
    val match_row_field : + row_field
    val rf_either_of : type_expr option -> row_field
    val eq_row_field_ext : row_field -> row_field -> bool
    val changed_row_field_exts : row_field list -> (unit -> unit) -> bool
    type row_field_cell
    val match_row_field : present:(type_expr option -> 'a) -> absent:(unit -> 'a) -> - either:(bool -> type_expr list -> bool -> row_field option -> 'a) -> + either: + (bool -> + type_expr list -> + bool -> + (row_field_cell * row_field option) -> + 'a) -> row_field -> 'a
    module Uid = Shape.Uid
    module MethSet : Set.S with type elt = string
    module VarSet : Set.S with type elt = string
    module Meths : Map.S with type key = string
    module Vars : Map.S with type key = string
    type value_description = {
    1. val_type : type_expr;
    2. val_kind : value_kind;
    3. val_loc : Location.t;
    4. val_attributes : Parsetree.attributes;
    5. val_uid : Uid.t;
    }
    and value_kind =
    1. | Val_reg
    2. | Val_prim of Primitive.description
    3. | Val_ivar of Asttypes.mutable_flag * string
    4. | Val_self of class_signature * self_meths * Ident.t Vars.t * string
    5. | Val_anc of class_signature * Ident.t Meths.t * string
    and self_meths =
    1. | Self_concrete of Ident.t Meths.t
    2. | Self_virtual of Ident.t Meths.t ref
    and class_signature = {
    1. csig_self : type_expr;
    2. mutable csig_self_row : type_expr;
    3. mutable csig_vars : (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) Vars.t;
    4. mutable csig_meths : (method_privacy * Asttypes.virtual_flag * type_expr) - Meths.t;
    }
    and method_privacy =
    1. | Mpublic
    2. | Mprivate of field_kind
    module Variance : sig ... end
    module Separability : sig ... end

    see Typedecl_separability for an explanation of separability and separability modes.

    type type_declaration = {
    1. type_params : type_expr list;
    2. type_arity : int;
    3. type_kind : type_decl_kind;
    4. type_private : Asttypes.private_flag;
    5. type_manifest : type_expr option;
    6. type_variance : Variance.t list;
    7. type_separability : Separability.t list;
    8. type_is_newtype : bool;
    9. type_expansion_scope : int;
    10. type_loc : Location.t;
    11. type_attributes : Parsetree.attributes;
    12. type_immediate : Type_immediacy.t;
    13. type_unboxed_default : bool;
    14. type_uid : Uid.t;
    }
    and ('lbl, 'cstr) type_kind =
    1. | Type_abstract
    2. | Type_record of 'lbl list * record_representation
    3. | Type_variant of 'cstr list * variant_representation
    4. | Type_open
    and record_representation =
    1. | Record_regular
    2. | Record_float
    3. | Record_unboxed of bool
    4. | Record_inlined of int
    5. | Record_extension of Path.t
    and variant_representation =
    1. | Variant_regular
    2. | Variant_unboxed
    and label_declaration = {
    1. ld_id : Ident.t;
    2. ld_mutable : Asttypes.mutable_flag;
    3. ld_type : type_expr;
    4. ld_loc : Location.t;
    5. ld_attributes : Parsetree.attributes;
    6. ld_uid : Uid.t;
    }
    and constructor_declaration = {
    1. cd_id : Ident.t;
    2. cd_args : constructor_arguments;
    3. cd_res : type_expr option;
    4. cd_loc : Location.t;
    5. cd_attributes : Parsetree.attributes;
    6. cd_uid : Uid.t;
    }
    and constructor_arguments =
    1. | Cstr_tuple of type_expr list
    2. | Cstr_record of label_declaration list
    type extension_constructor = {
    1. ext_type_path : Path.t;
    2. ext_type_params : type_expr list;
    3. ext_args : constructor_arguments;
    4. ext_ret_type : type_expr option;
    5. ext_private : Asttypes.private_flag;
    6. ext_loc : Location.t;
    7. ext_attributes : Parsetree.attributes;
    8. ext_uid : Uid.t;
    }
    and type_transparence =
    1. | Type_public
    2. | Type_new
    3. | Type_private
    type class_type =
    1. | Cty_constr of Path.t * type_expr list * class_type
    2. | Cty_signature of class_signature
    3. | Cty_arrow of Asttypes.arg_label * type_expr * class_type
    type class_declaration = {
    1. cty_params : type_expr list;
    2. mutable cty_type : class_type;
    3. cty_path : Path.t;
    4. cty_new : type_expr option;
    5. cty_variance : Variance.t list;
    6. cty_loc : Location.t;
    7. cty_attributes : Parsetree.attributes;
    8. cty_uid : Uid.t;
    }
    type class_type_declaration = {
    1. clty_params : type_expr list;
    2. clty_type : class_type;
    3. clty_path : Path.t;
    4. clty_hash_type : type_declaration;
    5. clty_variance : Variance.t list;
    6. clty_loc : Location.t;
    7. clty_attributes : Parsetree.attributes;
    8. clty_uid : Uid.t;
    }
    type visibility =
    1. | Exported
    2. | Hidden
    type module_type =
    1. | Mty_ident of Path.t
    2. | Mty_signature of signature
    3. | Mty_functor of functor_parameter * module_type
    4. | Mty_alias of Path.t
    and functor_parameter =
    1. | Unit
    2. | Named of Ident.t option * module_type
    and module_presence =
    1. | Mp_present
    2. | Mp_absent
    and signature = signature_item list
    and signature_item =
    1. | Sig_value of Ident.t * value_description * visibility
    2. | Sig_type of Ident.t * type_declaration * rec_status * visibility
    3. | Sig_typext of Ident.t * extension_constructor * ext_status * visibility
    4. | Sig_module of Ident.t + Meths.t;
    }
    and method_privacy =
    1. | Mpublic
    2. | Mprivate of field_kind
    module Variance : sig ... end
    module Separability : sig ... end

    see Typedecl_separability for an explanation of separability and separability modes.

    type type_declaration = {
    1. type_params : type_expr list;
    2. type_arity : int;
    3. type_kind : type_decl_kind;
    4. type_private : Asttypes.private_flag;
    5. type_manifest : type_expr option;
    6. type_variance : Variance.t list;
    7. type_separability : Separability.t list;
    8. type_is_newtype : bool;
    9. type_expansion_scope : int;
    10. type_loc : Location.t;
    11. type_attributes : Parsetree.attributes;
    12. type_immediate : Type_immediacy.t;
    13. type_unboxed_default : bool;
    14. type_uid : Uid.t;
    }
    and ('lbl, 'cstr) type_kind =
    1. | Type_abstract of type_origin
    2. | Type_record of 'lbl list * record_representation
    3. | Type_variant of 'cstr list * variant_representation
    4. | Type_open
    and type_origin =
    1. | Definition
    2. | Rec_check_regularity
    3. | Existential of string
    and record_representation =
    1. | Record_regular
    2. | Record_float
    3. | Record_unboxed of bool
    4. | Record_inlined of int
    5. | Record_extension of Path.t
    and variant_representation =
    1. | Variant_regular
    2. | Variant_unboxed
    and label_declaration = {
    1. ld_id : Ident.t;
    2. ld_mutable : Asttypes.mutable_flag;
    3. ld_type : type_expr;
    4. ld_loc : Location.t;
    5. ld_attributes : Parsetree.attributes;
    6. ld_uid : Uid.t;
    }
    and constructor_declaration = {
    1. cd_id : Ident.t;
    2. cd_args : constructor_arguments;
    3. cd_res : type_expr option;
    4. cd_loc : Location.t;
    5. cd_attributes : Parsetree.attributes;
    6. cd_uid : Uid.t;
    }
    and constructor_arguments =
    1. | Cstr_tuple of type_expr list
    2. | Cstr_record of label_declaration list
    type extension_constructor = {
    1. ext_type_path : Path.t;
    2. ext_type_params : type_expr list;
    3. ext_args : constructor_arguments;
    4. ext_ret_type : type_expr option;
    5. ext_private : Asttypes.private_flag;
    6. ext_loc : Location.t;
    7. ext_attributes : Parsetree.attributes;
    8. ext_uid : Uid.t;
    }
    and type_transparence =
    1. | Type_public
    2. | Type_new
    3. | Type_private
    type class_type =
    1. | Cty_constr of Path.t * type_expr list * class_type
    2. | Cty_signature of class_signature
    3. | Cty_arrow of Asttypes.arg_label * type_expr * class_type
    type class_declaration = {
    1. cty_params : type_expr list;
    2. mutable cty_type : class_type;
    3. cty_path : Path.t;
    4. cty_new : type_expr option;
    5. cty_variance : Variance.t list;
    6. cty_loc : Location.t;
    7. cty_attributes : Parsetree.attributes;
    8. cty_uid : Uid.t;
    }
    type class_type_declaration = {
    1. clty_params : type_expr list;
    2. clty_type : class_type;
    3. clty_path : Path.t;
    4. clty_hash_type : type_declaration;
    5. clty_variance : Variance.t list;
    6. clty_loc : Location.t;
    7. clty_attributes : Parsetree.attributes;
    8. clty_uid : Uid.t;
    }
    type visibility =
    1. | Exported
    2. | Hidden
    type module_type =
    1. | Mty_ident of Path.t
    2. | Mty_signature of signature
    3. | Mty_functor of functor_parameter * module_type
    4. | Mty_alias of Path.t
    and functor_parameter =
    1. | Unit
    2. | Named of Ident.t option * module_type
    and module_presence =
    1. | Mp_present
    2. | Mp_absent
    and signature = signature_item list
    and signature_item =
    1. | Sig_value of Ident.t * value_description * visibility
    2. | Sig_type of Ident.t * type_declaration * rec_status * visibility
    3. | Sig_typext of Ident.t * extension_constructor * ext_status * visibility
    4. | Sig_module of Ident.t * module_presence * module_declaration * rec_status diff --git a/ocaml/Typetexp/index.html b/ocaml/Typetexp/index.html index 529674ee..ccf5d172 100644 --- a/ocaml/Typetexp/index.html +++ b/ocaml/Typetexp/index.html @@ -1,5 +1,12 @@ -Typetexp (ocaml.Typetexp)

      Module Typetexp

      module TyVarEnv : sig ... end
      val valid_tyvar_name : string -> bool
      val transl_simple_type : +Typetexp (ocaml.Typetexp)

      Module Typetexp

      module TyVarEnv : sig ... end
      val type_open : + (?used_slot:bool ref -> + Asttypes.override_flag -> + Env.t -> + Location.t -> + Longident.t Asttypes.loc -> + Path.t * Env.t) + ref
      val valid_tyvar_name : string -> bool
      val transl_simple_type : Env.t -> ?univars:TyVarEnv.poly_univars -> closed:bool -> @@ -10,6 +17,12 @@ Typedtree.core_type
      val transl_simple_type_delayed : Env.t -> Parsetree.core_type -> - Typedtree.core_type * Types.type_expr * (unit -> unit)
      val transl_type_scheme : Env.t -> Parsetree.core_type -> Typedtree.core_type
      val transl_type_param : Env.t -> Parsetree.core_type -> Typedtree.core_type
      exception Already_bound
      type error =
      1. | Unbound_type_variable of string * string list
      2. | No_type_wildcards
      3. | Undefined_type_constructor of Path.t
      4. | Type_arity_mismatch of Longident.t * int * int
      5. | Bound_type_variable of string
      6. | Recursive_type
      7. | Unbound_row_variable of Longident.t
      8. | Type_mismatch of Errortrace.unification_error
      9. | Alias_type_mismatch of Errortrace.unification_error
      10. | Present_has_conjunction of string
      11. | Present_has_no_type of string
      12. | Constructor_mismatch of Types.type_expr * Types.type_expr
      13. | Not_a_variant of Types.type_expr
      14. | Variant_tags of string * string
      15. | Invalid_variable_name of string
      16. | Cannot_quantify of string * Types.type_expr
      17. | Multiple_constraints_on_type of Longident.t
      18. | Method_mismatch of string * Types.type_expr * Types.type_expr
      19. | Opened_object of Path.t option
      20. | Not_an_object of Types.type_expr
      exception Error of Location.t * Env.t * error
      val report_error : Env.t -> Stdlib.Format.formatter -> error -> unit
      val transl_modtype_longident : + Typedtree.core_type * Types.type_expr * (unit -> unit)
      val transl_type_scheme : Env.t -> Parsetree.core_type -> Typedtree.core_type
      val transl_type_param : Env.t -> Parsetree.core_type -> Typedtree.core_type
      exception Already_bound
      type error =
      1. | Unbound_type_variable of string * string list
      2. | No_type_wildcards
      3. | Undefined_type_constructor of Path.t
      4. | Type_arity_mismatch of Longident.t * int * int
      5. | Bound_type_variable of string
      6. | Recursive_type
      7. | Type_mismatch of Errortrace.unification_error
      8. | Alias_type_mismatch of Errortrace.unification_error
      9. | Present_has_conjunction of string
      10. | Present_has_no_type of string
      11. | Constructor_mismatch of Types.type_expr * Types.type_expr
      12. | Not_a_variant of Types.type_expr
      13. | Variant_tags of string * string
      14. | Invalid_variable_name of string
      15. | Cannot_quantify of string * Types.type_expr
      16. | Multiple_constraints_on_type of Longident.t
      17. | Method_mismatch of string * Types.type_expr * Types.type_expr
      18. | Opened_object of Path.t option
      19. | Not_an_object of Types.type_expr
      exception Error of Location.t * Env.t * error
      val report_error : Env.t -> error Format_doc.format_printer
      val report_error_doc : Env.t -> error Format_doc.printer
      val transl_modtype_longident : (Location.t -> Env.t -> Longident.t -> Path.t) ref
      val transl_modtype : - (Env.t -> Parsetree.module_type -> Typedtree.module_type) ref
      + (Env.t -> Parsetree.module_type -> Typedtree.module_type) ref
      val check_package_with_type_constraints : + (Location.t -> + Env.t -> + Types.module_type -> + (Longident.t Asttypes.loc * Typedtree.core_type) list -> + Types.module_type) + ref
      diff --git a/ocaml/Unit_info/Artifact/index.html b/ocaml/Unit_info/Artifact/index.html new file mode 100644 index 00000000..843bde56 --- /dev/null +++ b/ocaml/Unit_info/Artifact/index.html @@ -0,0 +1,2 @@ + +Artifact (ocaml.Unit_info.Artifact)

      Module Unit_info.Artifact

      Build artifacts

      type t

      Metadata for a single compilation artifact:

      • the module name associated to the artifact
      • the filesystem path
      • the input source file if it exists
      val source_file : t -> filename option

      source_file a is the source file of a if it exists.

      val prefix : t -> file_prefix

      prefix a is the filename prefix of the compilation artifact.

      val filename : t -> filename

      filename u is the filesystem path for a compilation artifact.

      val modname : t -> modname

      modname a is the module name of the compilation artifact.

      val from_filename : filename -> t

      from_filename filename reconstructs the module name modname_from_source filename associated to the artifact filename.

      diff --git a/ocaml/Unit_info/index.html b/ocaml/Unit_info/index.html new file mode 100644 index 00000000..f9a1b7b2 --- /dev/null +++ b/ocaml/Unit_info/index.html @@ -0,0 +1,7 @@ + +Unit_info (ocaml.Unit_info)

      Module Unit_info

      This module centralize the handling of compilation files and their metadata.

      Maybe more importantly, this module provides functions for deriving module names from strings or filenames.

      Module name convention and computation

      type intf_or_impl =
      1. | Intf
      2. | Impl
      type modname = string
      type filename = string
      type file_prefix = string
      type error =
      1. | Invalid_encoding of filename
      exception Error of error
      val modulize : string -> modname

      modulize s capitalizes the first letter of s.

      val normalize : string -> string

      normalize s uncapitalizes the first letter of s.

      val lax_modname_from_source : filename -> modname

      lax_modname_from_source filename is modulize stem where stem is the basename of the filename filename stripped from all its extensions. For instance, modname_from_source "/pa.th/x.ml.pp" is "X".

      val strict_modname_from_source : filename -> modname

      Same as lax_modname_from_source but raises an error.Invalid_encoding error on filename with invalid utf8 encoding.

      Module name validation function

      val is_unit_name : modname -> bool

      is_unit_name name is true only if name can be used as a valid module name.

      Metadata for compilation unit

      type t

      Metadata for a compilation unit:

      • the module name associated to the unit
      • the filename prefix (dirname + basename with all extensions stripped) for compilation artifacts
      • the input source file For instance, when calling ocamlopt dir/x.mli -o target/y.cmi,
      • the input source file is dir/x.mli
      • the module name is Y
      • the prefix is target/y
      val source_file : t -> filename

      source_file u is the source file of u.

      val prefix : t -> file_prefix

      prefix u is the filename prefix of the unit.

      val modname : t -> modname

      modname u or artifact_modname a is the module name of the unit or compilation artifact.

      val kind : t -> intf_or_impl

      kind u is the kind (interface or implementation) of the unit.

      val check_unit_name : t -> unit

      check_unit_name u prints a warning if the derived module name modname u should not be used as a module name as specified by is_unit_name ~strict:true.

      val make : + ?check_modname:bool -> + source_file:filename -> + intf_or_impl -> + file_prefix -> + t

      make ~check ~source_file kind prefix associates both the source_file and the module name modname_from_source target_prefix to the prefix filesystem path prefix.

      If check_modname=true, this function emits a warning if the derived module name is not valid according to check_unit_name.

      module Artifact : sig ... end

      Derived build artifact metadata

      val cmi : t -> Artifact.t

      Those functions derive a specific artifact metadata from an unit metadata.

      val cmo : t -> Artifact.t
      val cmx : t -> Artifact.t
      val obj : t -> Artifact.t
      val cmt : t -> Artifact.t
      val cmti : t -> Artifact.t
      val annot : t -> Artifact.t
      val companion_obj : Artifact.t -> Artifact.t

      The functions below change the type of an artifact by updating the extension of its filename. Those functions purposefully do not cover all artifact kinds because we want to track which artifacts are assumed to be bundled together.

      val companion_cmt : Artifact.t -> Artifact.t
      val companion_cmi : Artifact.t -> Artifact.t

      Beware that companion_cmi a strips all extensions from the filename of a before adding the ".cmi" suffix contrarily to the other functions which only remove the rightmost extension. In other words, the companion cmi of a file something.d.cmo is something.cmi and not something.d.cmi.

      Mli and cmi derived from implementation files

      The compilation of module implementation changes in presence of mli and cmi files, the function belows help to handle this.

      val mli_from_source : t -> filename

      mli_from_source u is the interface source filename associated to the unit u. The actual suffix depends on Config.interface_suffix.

      val mli_from_artifact : Artifact.t -> filename

      mli_from_artifact t is the name of the interface source file derived from the artifact t. This variant is necessary when handling artifacts derived from an unknown source files (e.g. packed modules).

      val is_cmi : Artifact.t -> bool

      Check if the artifact is a cmi

      val find_normalized_cmi : t -> Artifact.t

      find_normalized_cmi u finds in the load_path a file matching the module name modname u.

      • raises Not_found

        if no such cmi exists

      diff --git a/ocaml/Unix/index.html b/ocaml/Unix/index.html index 3fc2c040..0d603d89 100644 --- a/ocaml/Unix/index.html +++ b/ocaml/Unix/index.html @@ -1,5 +1,23 @@ -Unix (ocaml.Unix)

      Module Unix

      Interface to the Unix system.

      To use the labeled version of this module, add module Unix = UnixLabels in your implementation.

      Note: all the functions of this module (except error_message and handle_unix_error) are liable to raise the Unix_error exception whenever the underlying system call signals an error.

      Error report

      type error =
      1. | E2BIG
        (*

        Argument list too long

        *)
      2. | EACCES
        (*

        Permission denied

        *)
      3. | EAGAIN
        (*

        Resource temporarily unavailable; try again

        *)
      4. | EBADF
        (*

        Bad file descriptor

        *)
      5. | EBUSY
        (*

        Resource unavailable

        *)
      6. | ECHILD
        (*

        No child process

        *)
      7. | EDEADLK
        (*

        Resource deadlock would occur

        *)
      8. | EDOM
        (*

        Domain error for math functions, etc.

        *)
      9. | EEXIST
        (*

        File exists

        *)
      10. | EFAULT
        (*

        Bad address

        *)
      11. | EFBIG
        (*

        File too large

        *)
      12. | EINTR
        (*

        Function interrupted by signal

        *)
      13. | EINVAL
        (*

        Invalid argument

        *)
      14. | EIO
        (*

        Hardware I/O error

        *)
      15. | EISDIR
        (*

        Is a directory

        *)
      16. | EMFILE
        (*

        Too many open files by the process

        *)
      17. | ENAMETOOLONG
        (*

        Filename too long

        *)
      18. | ENFILE
        (*

        Too many open files in the system

        *)
      19. | ENODEV
        (*

        No such device

        *)
      20. | ENOENT
        (*

        No such file or directory

        *)
      21. | ENOEXEC
        (*

        Not an executable file

        *)
      22. | ENOLCK
        (*

        No locks available

        *)
      23. | ENOMEM
        (*

        Not enough memory

        *)
      24. | ENOSPC
        (*

        No space left on device

        *)
      25. | ENOSYS
        (*

        Function not supported

        *)
      26. | ENOTDIR
        (*

        Not a directory

        *)
      27. | ENOTEMPTY
        (*

        Directory not empty

        *)
      28. | ENOTTY
        (*

        Inappropriate I/O control operation

        *)
      29. | ENXIO
        (*

        No such device or address

        *)
      30. | EPERM
        (*

        Operation not permitted

        *)
      31. | EPIPE
        (*

        Broken pipe

        *)
      32. | ERANGE
        (*

        Result too large

        *)
      33. | EROFS
        (*

        Read-only file system

        *)
      34. | ESPIPE
        (*

        Invalid seek e.g. on a pipe

        *)
      35. | ESRCH
        (*

        No such process

        *)
      36. | EXDEV
        (*

        Invalid link

        *)
      37. | EWOULDBLOCK
        (*

        Operation would block

        *)
      38. | EINPROGRESS
        (*

        Operation now in progress

        *)
      39. | EALREADY
        (*

        Operation already in progress

        *)
      40. | ENOTSOCK
        (*

        Socket operation on non-socket

        *)
      41. | EDESTADDRREQ
        (*

        Destination address required

        *)
      42. | EMSGSIZE
        (*

        Message too long

        *)
      43. | EPROTOTYPE
        (*

        Protocol wrong type for socket

        *)
      44. | ENOPROTOOPT
        (*

        Protocol not available

        *)
      45. | EPROTONOSUPPORT
        (*

        Protocol not supported

        *)
      46. | ESOCKTNOSUPPORT
        (*

        Socket type not supported

        *)
      47. | EOPNOTSUPP
        (*

        Operation not supported on socket

        *)
      48. | EPFNOSUPPORT
        (*

        Protocol family not supported

        *)
      49. | EAFNOSUPPORT
        (*

        Address family not supported by protocol family

        *)
      50. | EADDRINUSE
        (*

        Address already in use

        *)
      51. | EADDRNOTAVAIL
        (*

        Can't assign requested address

        *)
      52. | ENETDOWN
        (*

        Network is down

        *)
      53. | ENETUNREACH
        (*

        Network is unreachable

        *)
      54. | ENETRESET
        (*

        Network dropped connection on reset

        *)
      55. | ECONNABORTED
        (*

        Software caused connection abort

        *)
      56. | ECONNRESET
        (*

        Connection reset by peer

        *)
      57. | ENOBUFS
        (*

        No buffer space available

        *)
      58. | EISCONN
        (*

        Socket is already connected

        *)
      59. | ENOTCONN
        (*

        Socket is not connected

        *)
      60. | ESHUTDOWN
        (*

        Can't send after socket shutdown

        *)
      61. | ETOOMANYREFS
        (*

        Too many references: can't splice

        *)
      62. | ETIMEDOUT
        (*

        Connection timed out

        *)
      63. | ECONNREFUSED
        (*

        Connection refused

        *)
      64. | EHOSTDOWN
        (*

        Host is down

        *)
      65. | EHOSTUNREACH
        (*

        No route to host

        *)
      66. | ELOOP
        (*

        Too many levels of symbolic links

        *)
      67. | EOVERFLOW
        (*

        File size or position not representable

        *)
      68. | EUNKNOWNERR of int
        (*

        Unknown error

        *)

      The type of error codes. Errors defined in the POSIX standard and additional errors from UNIX98 and BSD. All other errors are mapped to EUNKNOWNERR.

      exception Unix_error of error * string * string

      Raised by the system calls below when an error is encountered. The first component is the error code; the second component is the function name; the third component is the string parameter to the function, if it has one, or the empty string otherwise.

      UnixLabels.Unix_error and Unix.Unix_error are the same, and catching one will catch the other.

      val error_message : error -> string

      Return a string describing the given error code.

      val handle_unix_error : ('a -> 'b) -> 'a -> 'b

      handle_unix_error f x applies f to x and returns the result. If the exception Unix_error is raised, it prints a message describing the error and exits with code 2.

      Access to the process environment

      val environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. The returned array is empty if the process has special privileges.

      val unsafe_environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. Unlike environment, this function returns a populated array even if the process has special privileges. See the documentation for unsafe_getenv for more details.

      • since 4.06 (4.12 in UnixLabels)
      val getenv : string -> string

      Return the value associated to a variable in the process environment, unless the process has special privileges.

      • raises Not_found

        if the variable is unbound or the process has special privileges.

        This function is identical to Sys.getenv.

      val unsafe_getenv : string -> string

      Return the value associated to a variable in the process environment.

      Unlike getenv, this function returns the value even if the process has special privileges. It is considered unsafe because the programmer of a setuid or setgid program must be careful to avoid using maliciously crafted environment variables in the search path for executables, the locations for temporary files or logs, and the like.

      • raises Not_found

        if the variable is unbound.

      • since 4.06
      val putenv : string -> string -> unit

      putenv name value sets the value associated to a variable in the process environment. name is the name of the environment variable, and value its new associated value.

      Process handling

      type process_status =
      1. | WEXITED of int
        (*

        The process terminated normally by exit; the argument is the return code.

        *)
      2. | WSIGNALED of int
        (*

        The process was killed by a signal; the argument is the signal number.

        *)
      3. | WSTOPPED of int
        (*

        The process was stopped by a signal; the argument is the signal number.

        *)

      The termination status of a process. See module Sys for the definitions of the standard signal numbers. Note that they are not the numbers used by the OS.

      On Windows: only WEXITED is used (as there are no inter-process signals) but with specific return codes to indicate special termination causes. Look for NTSTATUS values in the Windows documentation to decode such error return codes. In particular, STATUS_ACCESS_VIOLATION error code is the 32-bit 0xC0000005: as Int32.of_int 0xC0000005 is -1073741819, WEXITED -1073741819 is the Windows equivalent of WSIGNALED Sys.sigsegv.

      type wait_flag =
      1. | WNOHANG
        (*

        Do not block if no child has died yet, but immediately return with a pid equal to 0.

        *)
      2. | WUNTRACED
        (*

        Report also the children that receive stop signals.

        *)

      Flags for waitpid.

      val execv : string -> string array -> 'a

      execv prog args execute the program in file prog, with the arguments args, and the current process environment. These execv* functions never return: on success, the current program is replaced by the new one.

      On Windows: the CRT simply spawns a new process and exits the current one. This will have unwanted consequences if e.g. another process is waiting on the current one. Using create_process or one of the open_process_* functions instead is recommended.

      val execve : string -> string array -> string array -> 'a

      Same as execv, except that the third argument provides the environment to the program executed.

      val execvp : string -> string array -> 'a

      Same as execv, except that the program is searched in the path.

      val execvpe : string -> string array -> string array -> 'a

      Same as execve, except that the program is searched in the path.

      val fork : unit -> int

      Fork a new process. The returned integer is 0 for the child process, the pid of the child process for the parent process.

      • raises Invalid_argument

        on Windows. Use create_process or threads instead.

      val wait : unit -> int * process_status

      Wait until one of the children processes die, and return its pid and termination status.

      • raises Invalid_argument

        on Windows. Use waitpid instead.

      val waitpid : wait_flag list -> int -> int * process_status

      Same as wait, but waits for the child process whose pid is given. A pid of -1 means wait for any child. A pid of 0 means wait for any child in the same process group as the current process. Negative pid arguments represent process groups. The list of options indicates whether waitpid should return immediately without waiting, and whether it should report stopped children.

      On Windows: can only wait for a given PID, not any child process.

      val system : string -> process_status

      Execute the given command, wait until it terminates, and return its termination status. The string is interpreted by the shell /bin/sh (or the command interpreter cmd.exe on Windows) and therefore can contain redirections, quotes, variables, etc. To properly quote whitespace and shell special characters occurring in file names or command arguments, the use of Filename.quote_command is recommended. The result WEXITED 127 indicates that the shell couldn't be executed.

      val _exit : int -> 'a

      Terminate the calling process immediately, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. Unlike Stdlib.exit, Unix._exit performs no finalization whatsoever: functions registered with Stdlib.at_exit are not called, input/output channels are not flushed, and the C run-time system is not finalized either.

      The typical use of Unix._exit is after a Unix.fork operation, when the child process runs into a fatal error and must exit. In this case, it is preferable to not perform any finalization action in the child process, as these actions could interfere with similar actions performed by the parent process. For example, output channels should not be flushed by the child process, as the parent process may flush them again later, resulting in duplicate output.

      • since 4.12
      val getpid : unit -> int

      Return the pid of the process.

      val getppid : unit -> int

      Return the pid of the parent process.

      • raises Invalid_argument

        on Windows (because it is meaningless)

      val nice : int -> int

      Change the process priority. The integer argument is added to the ``nice'' value. (Higher values of the ``nice'' value mean lower priorities.) Return the new nice value.

      • raises Invalid_argument

        on Windows

      Basic file input/output

      type file_descr

      The abstract type of file descriptors.

      val stdin : file_descr

      File descriptor for standard input.

      val stdout : file_descr

      File descriptor for standard output.

      val stderr : file_descr

      File descriptor for standard error.

      type open_flag =
      1. | O_RDONLY
        (*

        Open for reading

        *)
      2. | O_WRONLY
        (*

        Open for writing

        *)
      3. | O_RDWR
        (*

        Open for reading and writing

        *)
      4. | O_NONBLOCK
        (*

        Open in non-blocking mode

        *)
      5. | O_APPEND
        (*

        Open for append

        *)
      6. | O_CREAT
        (*

        Create if nonexistent

        *)
      7. | O_TRUNC
        (*

        Truncate to 0 length if existing

        *)
      8. | O_EXCL
        (*

        Fail if existing

        *)
      9. | O_NOCTTY
        (*

        Don't make this dev a controlling tty

        *)
      10. | O_DSYNC
        (*

        Writes complete as `Synchronised I/O data integrity completion'

        *)
      11. | O_SYNC
        (*

        Writes complete as `Synchronised I/O file integrity completion'

        *)
      12. | O_RSYNC
        (*

        Reads complete as writes (depending on O_SYNC/O_DSYNC)

        *)
      13. | O_SHARE_DELETE
        (*

        Windows only: allow the file to be deleted while still open

        *)
      14. | O_CLOEXEC
        (*

        Set the close-on-exec flag on the descriptor returned by openfile. See set_close_on_exec for more information.

        *)
      15. | O_KEEPEXEC
        (*

        Clear the close-on-exec flag. This is currently the default.

        *)

      The flags to openfile.

      type file_perm = int

      The type of file access rights, e.g. 0o640 is read and write for user, read for group, none for others

      val openfile : string -> open_flag list -> file_perm -> file_descr

      Open the named file with the given flags. Third argument is the permissions to give to the file if it is created (see umask). Return a file descriptor on the named file.

      val close : file_descr -> unit

      Close a file descriptor.

      val fsync : file_descr -> unit

      Flush file buffers to disk.

      • since 4.08 (4.12 in UnixLabels)
      val read : file_descr -> bytes -> int -> int -> int

      read fd buf pos len reads len bytes from descriptor fd, storing them in byte sequence buf, starting at position pos in buf. Return the number of bytes actually read.

      val write : file_descr -> bytes -> int -> int -> int

      write fd buf pos len writes len bytes to descriptor fd, taking them from byte sequence buf, starting at position pos in buff. Return the number of bytes actually written. write repeats the writing operation until all bytes have been written or an error occurs.

      val single_write : file_descr -> bytes -> int -> int -> int

      Same as write, but attempts to write only once. Thus, if an error occurs, single_write guarantees that no data has been written.

      val write_substring : file_descr -> string -> int -> int -> int

      Same as write, but take the data from a string instead of a byte sequence.

      • since 4.02
      val single_write_substring : file_descr -> string -> int -> int -> int

      Same as single_write, but take the data from a string instead of a byte sequence.

      • since 4.02

      Interfacing with the standard input/output library

      val in_channel_of_descr : file_descr -> in_channel

      Create an input channel reading from the given descriptor. The channel is initially in binary mode; use set_binary_mode_in ic false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_in always fails on channels created with this function.

      Beware that input channels are buffered, so more characters may have been read from the descriptor than those accessed using channel functions. Channels also keep a copy of the current position in the file.

      Closing the channel ic returned by in_channel_of_descr fd using close_in ic also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      If several channels are created on the same descriptor, one of the channels must be closed, but not the others. Consider for example a descriptor s connected to a socket and two channels ic = in_channel_of_descr s and oc = out_channel_of_descr s. The recommended closing protocol is to perform close_out oc, which flushes buffered output to the socket then closes the socket. The ic channel must not be closed and will be collected by the GC eventually.

      val out_channel_of_descr : file_descr -> out_channel

      Create an output channel writing on the given descriptor. The channel is initially in binary mode; use set_binary_mode_out oc false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_out always fails on channels created with this function.

      Beware that output channels are buffered, so you may have to call Stdlib.flush to ensure that all data has been sent to the descriptor. Channels also keep a copy of the current position in the file.

      Closing the channel oc returned by out_channel_of_descr fd using close_out oc also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      See Unix.in_channel_of_descr for a discussion of the closing protocol when several channels are created on the same descriptor.

      val descr_of_in_channel : in_channel -> file_descr

      Return the descriptor corresponding to an input channel.

      val descr_of_out_channel : out_channel -> file_descr

      Return the descriptor corresponding to an output channel.

      Seeking and truncating

      type seek_command =
      1. | SEEK_SET
        (*

        indicates positions relative to the beginning of the file

        *)
      2. | SEEK_CUR
        (*

        indicates positions relative to the current position

        *)
      3. | SEEK_END
        (*

        indicates positions relative to the end of the file

        *)

      Positioning modes for lseek.

      val lseek : file_descr -> int -> seek_command -> int

      Set the current position for a file descriptor, and return the resulting offset (from the beginning of the file).

      val truncate : string -> int -> unit

      Truncates the named file to the given size.

      val ftruncate : file_descr -> int -> unit

      Truncates the file corresponding to the given descriptor to the given size.

      File status

      type file_kind =
      1. | S_REG
        (*

        Regular file

        *)
      2. | S_DIR
        (*

        Directory

        *)
      3. | S_CHR
        (*

        Character device

        *)
      4. | S_BLK
        (*

        Block device

        *)
      5. | S_LNK
        (*

        Symbolic link

        *)
      6. | S_FIFO
        (*

        Named pipe

        *)
      7. | S_SOCK
        (*

        Socket

        *)
      type stats = {
      1. st_dev : int;
        (*

        Device number

        *)
      2. st_ino : int;
        (*

        Inode number

        *)
      3. st_kind : file_kind;
        (*

        Kind of the file

        *)
      4. st_perm : file_perm;
        (*

        Access rights

        *)
      5. st_uid : int;
        (*

        User id of the owner

        *)
      6. st_gid : int;
        (*

        Group ID of the file's group

        *)
      7. st_rdev : int;
        (*

        Device ID (if special file)

        *)
      8. st_size : int;
        (*

        Size in bytes

        *)
      9. st_atime : float;
        (*

        Last access time

        *)
      10. st_mtime : float;
        (*

        Last modification time

        *)
      11. st_ctime : float;
        (*

        Last status change time

        *)
      }

      The information returned by the stat calls.

      val stat : string -> stats

      Return the information for the named file.

      val lstat : string -> stats

      Same as stat, but in case the file is a symbolic link, return the information for the link itself.

      val fstat : file_descr -> stats

      Return the information for the file associated with the given descriptor.

      val isatty : file_descr -> bool

      Return true if the given file descriptor refers to a terminal or console window, false otherwise.

      File operations on large files

      module LargeFile : sig ... end

      File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

      Mapping files into memory

      val map_file : +Unix (ocaml.Unix)

      Module Unix

      Interface to the Unix system.

      To use the labeled version of this module, add module Unix = UnixLabels in your implementation.

      Note: all the functions of this module (except error_message and handle_unix_error) are liable to raise the Unix_error exception whenever the underlying system call signals an error.

      Error report

      type error =
      1. | E2BIG
        (*

        Argument list too long

        *)
      2. | EACCES
        (*

        Permission denied

        *)
      3. | EAGAIN
        (*

        Resource temporarily unavailable; try again

        *)
      4. | EBADF
        (*

        Bad file descriptor

        *)
      5. | EBUSY
        (*

        Resource unavailable

        *)
      6. | ECHILD
        (*

        No child process

        *)
      7. | EDEADLK
        (*

        Resource deadlock would occur

        *)
      8. | EDOM
        (*

        Domain error for math functions, etc.

        *)
      9. | EEXIST
        (*

        File exists

        *)
      10. | EFAULT
        (*

        Bad address

        *)
      11. | EFBIG
        (*

        File too large

        *)
      12. | EINTR
        (*

        Function interrupted by signal

        *)
      13. | EINVAL
        (*

        Invalid argument

        *)
      14. | EIO
        (*

        Hardware I/O error

        *)
      15. | EISDIR
        (*

        Is a directory

        *)
      16. | EMFILE
        (*

        Too many open files by the process

        *)
      17. | ENAMETOOLONG
        (*

        Filename too long

        *)
      18. | ENFILE
        (*

        Too many open files in the system

        *)
      19. | ENODEV
        (*

        No such device

        *)
      20. | ENOENT
        (*

        No such file or directory

        *)
      21. | ENOEXEC
        (*

        Not an executable file

        *)
      22. | ENOLCK
        (*

        No locks available

        *)
      23. | ENOMEM
        (*

        Not enough memory

        *)
      24. | ENOSPC
        (*

        No space left on device

        *)
      25. | ENOSYS
        (*

        Function not supported

        *)
      26. | ENOTDIR
        (*

        Not a directory

        *)
      27. | ENOTEMPTY
        (*

        Directory not empty

        *)
      28. | ENOTTY
        (*

        Inappropriate I/O control operation

        *)
      29. | ENXIO
        (*

        No such device or address

        *)
      30. | EPERM
        (*

        Operation not permitted

        *)
      31. | EPIPE
        (*

        Broken pipe

        *)
      32. | ERANGE
        (*

        Result too large

        *)
      33. | EROFS
        (*

        Read-only file system

        *)
      34. | ESPIPE
        (*

        Invalid seek e.g. on a pipe

        *)
      35. | ESRCH
        (*

        No such process

        *)
      36. | EXDEV
        (*

        Invalid link

        *)
      37. | EWOULDBLOCK
        (*

        Operation would block

        *)
      38. | EINPROGRESS
        (*

        Operation now in progress

        *)
      39. | EALREADY
        (*

        Operation already in progress

        *)
      40. | ENOTSOCK
        (*

        Socket operation on non-socket

        *)
      41. | EDESTADDRREQ
        (*

        Destination address required

        *)
      42. | EMSGSIZE
        (*

        Message too long

        *)
      43. | EPROTOTYPE
        (*

        Protocol wrong type for socket

        *)
      44. | ENOPROTOOPT
        (*

        Protocol not available

        *)
      45. | EPROTONOSUPPORT
        (*

        Protocol not supported

        *)
      46. | ESOCKTNOSUPPORT
        (*

        Socket type not supported

        *)
      47. | EOPNOTSUPP
        (*

        Operation not supported on socket

        *)
      48. | EPFNOSUPPORT
        (*

        Protocol family not supported

        *)
      49. | EAFNOSUPPORT
        (*

        Address family not supported by protocol family

        *)
      50. | EADDRINUSE
        (*

        Address already in use

        *)
      51. | EADDRNOTAVAIL
        (*

        Can't assign requested address

        *)
      52. | ENETDOWN
        (*

        Network is down

        *)
      53. | ENETUNREACH
        (*

        Network is unreachable

        *)
      54. | ENETRESET
        (*

        Network dropped connection on reset

        *)
      55. | ECONNABORTED
        (*

        Software caused connection abort

        *)
      56. | ECONNRESET
        (*

        Connection reset by peer

        *)
      57. | ENOBUFS
        (*

        No buffer space available

        *)
      58. | EISCONN
        (*

        Socket is already connected

        *)
      59. | ENOTCONN
        (*

        Socket is not connected

        *)
      60. | ESHUTDOWN
        (*

        Can't send after socket shutdown

        *)
      61. | ETOOMANYREFS
        (*

        Too many references: can't splice

        *)
      62. | ETIMEDOUT
        (*

        Connection timed out

        *)
      63. | ECONNREFUSED
        (*

        Connection refused

        *)
      64. | EHOSTDOWN
        (*

        Host is down

        *)
      65. | EHOSTUNREACH
        (*

        No route to host

        *)
      66. | ELOOP
        (*

        Too many levels of symbolic links

        *)
      67. | EOVERFLOW
        (*

        File size or position not representable

        *)
      68. | EUNKNOWNERR of int
        (*

        Unknown error

        *)

      The type of error codes. Errors defined in the POSIX standard and additional errors from UNIX98 and BSD. All other errors are mapped to EUNKNOWNERR.

      exception Unix_error of error * string * string

      Raised by the system calls below when an error is encountered. The first component is the error code; the second component is the function name; the third component is the string parameter to the function, if it has one, or the empty string otherwise.

      UnixLabels.Unix_error and Unix.Unix_error are the same, and catching one will catch the other.

      val error_message : error -> string

      Return a string describing the given error code.

      val handle_unix_error : ('a -> 'b) -> 'a -> 'b

      handle_unix_error f x applies f to x and returns the result. If the exception Unix_error is raised, it prints a message describing the error and exits with code 2.

      Access to the process environment

      val environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. The returned array is empty if the process has special privileges.

      val unsafe_environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. Unlike environment, this function returns a populated array even if the process has special privileges. See the documentation for unsafe_getenv for more details.

      • since 4.06 (4.12 in UnixLabels)
      val getenv : string -> string

      Return the value associated to a variable in the process environment, unless the process has special privileges.

      • raises Not_found

        if the variable is unbound or the process has special privileges.

        This function is identical to Sys.getenv.

      val unsafe_getenv : string -> string

      Return the value associated to a variable in the process environment.

      Unlike getenv, this function returns the value even if the process has special privileges. It is considered unsafe because the programmer of a setuid or setgid program must be careful to avoid using maliciously crafted environment variables in the search path for executables, the locations for temporary files or logs, and the like.

      • raises Not_found

        if the variable is unbound.

      • since 4.06
      val putenv : string -> string -> unit

      putenv name value sets the value associated to a variable in the process environment. name is the name of the environment variable, and value its new associated value.

      Process handling

      type process_status =
      1. | WEXITED of int
        (*

        The process terminated normally by exit; the argument is the return code.

        *)
      2. | WSIGNALED of int
        (*

        The process was killed by a signal; the argument is the signal number.

        *)
      3. | WSTOPPED of int
        (*

        The process was stopped by a signal; the argument is the signal number.

        *)

      The termination status of a process. See module Sys for the definitions of the standard signal numbers. Note that they are not the numbers used by the OS.

      On Windows: only WEXITED is used (as there are no inter-process signals) but with specific return codes to indicate special termination causes. Look for NTSTATUS values in the Windows documentation to decode such error return codes. In particular, STATUS_ACCESS_VIOLATION error code is the 32-bit 0xC0000005: as Int32.of_int 0xC0000005 is -1073741819, WEXITED -1073741819 is the Windows equivalent of WSIGNALED Sys.sigsegv.

      type wait_flag =
      1. | WNOHANG
        (*

        Do not block if no child has died yet, but immediately return with a pid equal to 0.

        *)
      2. | WUNTRACED
        (*

        Report also the children that receive stop signals.

        *)

      Flags for waitpid.

      val execv : string -> string array -> 'a

      execv prog args execute the program in file prog, with the arguments args, and the current process environment. Note that the first argument, args.(0), is by convention the filename of the program being executed, just like Sys.argv.(0). These execv* functions never return: on success, the current program is replaced by the new one.

      On Windows: the CRT simply spawns a new process and exits the current one. This will have unwanted consequences if e.g. another process is waiting on the current one. Using create_process or one of the open_process_* functions instead is recommended.

      val execve : string -> string array -> string array -> 'a

      Same as execv, except that the third argument provides the environment to the program executed.

      val execvp : string -> string array -> 'a

      Same as execv, except that the program is searched in the path.

      val execvpe : string -> string array -> string array -> 'a

      Same as execve, except that the program is searched in the path.

      val fork : unit -> int

      Fork a new process. The returned integer is 0 for the child process, the pid of the child process for the parent process. It fails if the OCaml process is multi-core (any domain has been spawned). In addition, if any thread from the Thread module has been spawned, then the child process might be in a corrupted state.

      • raises Invalid_argument

        on Windows. Use create_process or threads instead.

      • raises Failure

        if any domain has been spawned.

      val wait : unit -> int * process_status

      Wait until one of the children processes die, and return its pid and termination status.

      • raises Invalid_argument

        on Windows. Use waitpid instead.

      val waitpid : wait_flag list -> int -> int * process_status

      Same as wait, but waits for the child process whose pid is given. A pid of -1 means wait for any child. A pid of 0 means wait for any child in the same process group as the current process. Negative pid arguments represent process groups. The list of options indicates whether waitpid should return immediately without waiting, and whether it should report stopped children.

      On Windows: can only wait for a given PID, not any child process.

      val system : string -> process_status

      Execute the given command, wait until it terminates, and return its termination status. The string is interpreted by the shell /bin/sh (or the command interpreter cmd.exe on Windows) and therefore can contain redirections, quotes, variables, etc. To properly quote whitespace and shell special characters occurring in file names or command arguments, the use of Filename.quote_command is recommended. The result WEXITED 127 indicates that the shell couldn't be executed.

      val _exit : int -> 'a

      Terminate the calling process immediately, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. Unlike Stdlib.exit, Unix._exit performs no finalization whatsoever: functions registered with Stdlib.at_exit are not called, input/output channels are not flushed, and the C run-time system is not finalized either.

      The typical use of Unix._exit is after a Unix.fork operation, when the child process runs into a fatal error and must exit. In this case, it is preferable to not perform any finalization action in the child process, as these actions could interfere with similar actions performed by the parent process. For example, output channels should not be flushed by the child process, as the parent process may flush them again later, resulting in duplicate output.

      • since 4.12
      val getpid : unit -> int

      Return the pid of the process.

      val getppid : unit -> int

      Return the pid of the parent process.

      • raises Invalid_argument

        on Windows (because it is meaningless)

      val nice : int -> int

      Change the process priority. The integer argument is added to the ``nice'' value. (Higher values of the ``nice'' value mean lower priorities.) Return the new nice value.

      • raises Invalid_argument

        on Windows

      Basic file input/output

      type file_descr

      The abstract type of file descriptors.

      val stdin : file_descr

      File descriptor for standard input.

      val stdout : file_descr

      File descriptor for standard output.

      val stderr : file_descr

      File descriptor for standard error.

      type open_flag =
      1. | O_RDONLY
        (*

        Open for reading

        *)
      2. | O_WRONLY
        (*

        Open for writing

        *)
      3. | O_RDWR
        (*

        Open for reading and writing

        *)
      4. | O_NONBLOCK
        (*

        Open in non-blocking mode

        *)
      5. | O_APPEND
        (*

        Open for append

        *)
      6. | O_CREAT
        (*

        Create if nonexistent

        *)
      7. | O_TRUNC
        (*

        Truncate to 0 length if existing

        *)
      8. | O_EXCL
        (*

        Fail if existing

        *)
      9. | O_NOCTTY
        (*

        Don't make this dev a controlling tty

        *)
      10. | O_DSYNC
        (*

        Writes complete as `Synchronised I/O data integrity completion'

        *)
      11. | O_SYNC
        (*

        Writes complete as `Synchronised I/O file integrity completion'

        *)
      12. | O_RSYNC
        (*

        Reads complete as writes (depending on O_SYNC/O_DSYNC)

        *)
      13. | O_SHARE_DELETE
        (*

        Windows only: allow the file to be deleted while still open

        *)
      14. | O_CLOEXEC
        (*

        Set the close-on-exec flag on the descriptor returned by openfile. See set_close_on_exec for more information.

        *)
      15. | O_KEEPEXEC
        (*

        Clear the close-on-exec flag. This is currently the default.

        *)

      The flags to openfile.

      type file_perm = int

      The type of file access rights, e.g. 0o640 is read and write for user, read for group, none for others

      val openfile : string -> open_flag list -> file_perm -> file_descr

      Open the named file with the given flags. Third argument is the permissions to give to the file if it is created (see umask). Return a file descriptor on the named file.

      val close : file_descr -> unit

      Close a file descriptor.

      val fsync : file_descr -> unit

      Flush file buffers to disk.

      • since 4.08 (4.12 in UnixLabels)
      val read : file_descr -> bytes -> int -> int -> int

      read fd buf pos len reads len bytes from descriptor fd, storing them in byte sequence buf, starting at position pos in buf. Return the number of bytes actually read.

      val read_bigarray : + file_descr -> + (_, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) + Stdlib.Bigarray.Array1.t -> + int -> + int -> + int

      Same as read, but read the data into a bigarray.

      • since 5.2
      val write : file_descr -> bytes -> int -> int -> int

      write fd buf pos len writes len bytes to descriptor fd, taking them from byte sequence buf, starting at position pos in buff. Return the number of bytes actually written. write repeats the writing operation until all bytes have been written or an error occurs.

      val write_bigarray : + file_descr -> + (_, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) + Stdlib.Bigarray.Array1.t -> + int -> + int -> + int

      Same as write, but take the data from a bigarray.

      • since 5.2
      val single_write : file_descr -> bytes -> int -> int -> int

      Same as write, but attempts to write only once. Thus, if an error occurs, single_write guarantees that no data has been written.

      val write_substring : file_descr -> string -> int -> int -> int

      Same as write, but take the data from a string instead of a byte sequence.

      • since 4.02
      val single_write_substring : file_descr -> string -> int -> int -> int

      Same as single_write, but take the data from a string instead of a byte sequence.

      • since 4.02
      val single_write_bigarray : + file_descr -> + (_, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) + Stdlib.Bigarray.Array1.t -> + int -> + int -> + int

      Same as single_write, but take the data from a bigarray.

      • since 5.2

      Interfacing with the standard input/output library

      val in_channel_of_descr : file_descr -> in_channel

      Create an input channel reading from the given descriptor. The channel is initially in binary mode; use set_binary_mode_in ic false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_in always fails on channels created with this function.

      Beware that input channels are buffered, so more characters may have been read from the descriptor than those accessed using channel functions. Channels also keep a copy of the current position in the file.

      Closing the channel ic returned by in_channel_of_descr fd using close_in ic also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      If several channels are created on the same descriptor, one of the channels must be closed, but not the others. Consider for example a descriptor s connected to a socket and two channels ic = in_channel_of_descr s and oc = out_channel_of_descr s. The recommended closing protocol is to perform close_out oc, which flushes buffered output to the socket then closes the socket. The ic channel must not be closed and will be collected by the GC eventually.

      val out_channel_of_descr : file_descr -> out_channel

      Create an output channel writing on the given descriptor. The channel is initially in binary mode; use set_binary_mode_out oc false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_out always fails on channels created with this function.

      Beware that output channels are buffered, so you may have to call Stdlib.flush to ensure that all data has been sent to the descriptor. Channels also keep a copy of the current position in the file.

      Closing the channel oc returned by out_channel_of_descr fd using close_out oc also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      See Unix.in_channel_of_descr for a discussion of the closing protocol when several channels are created on the same descriptor.

      val descr_of_in_channel : in_channel -> file_descr

      Return the descriptor corresponding to an input channel.

      val descr_of_out_channel : out_channel -> file_descr

      Return the descriptor corresponding to an output channel.

      Seeking and truncating

      type seek_command =
      1. | SEEK_SET
        (*

        indicates positions relative to the beginning of the file

        *)
      2. | SEEK_CUR
        (*

        indicates positions relative to the current position

        *)
      3. | SEEK_END
        (*

        indicates positions relative to the end of the file

        *)

      Positioning modes for lseek.

      val lseek : file_descr -> int -> seek_command -> int

      Set the current position for a file descriptor, and return the resulting offset (from the beginning of the file).

      val truncate : string -> int -> unit

      Truncates the named file to the given size.

      val ftruncate : file_descr -> int -> unit

      Truncates the file corresponding to the given descriptor to the given size.

      File status

      type file_kind =
      1. | S_REG
        (*

        Regular file

        *)
      2. | S_DIR
        (*

        Directory

        *)
      3. | S_CHR
        (*

        Character device

        *)
      4. | S_BLK
        (*

        Block device

        *)
      5. | S_LNK
        (*

        Symbolic link

        *)
      6. | S_FIFO
        (*

        Named pipe

        *)
      7. | S_SOCK
        (*

        Socket

        *)
      type stats = {
      1. st_dev : int;
        (*

        Device number

        *)
      2. st_ino : int;
        (*

        Inode number

        *)
      3. st_kind : file_kind;
        (*

        Kind of the file

        *)
      4. st_perm : file_perm;
        (*

        Access rights

        *)
      5. st_uid : int;
        (*

        User id of the owner

        *)
      6. st_gid : int;
        (*

        Group ID of the file's group

        *)
      7. st_rdev : int;
        (*

        Device ID (if special file)

        *)
      8. st_size : int;
        (*

        Size in bytes

        *)
      9. st_atime : float;
        (*

        Last access time

        *)
      10. st_mtime : float;
        (*

        Last modification time

        *)
      11. st_ctime : float;
        (*

        Last status change time

        *)
      }

      The information returned by the stat calls.

      val stat : string -> stats

      Return the information for the named file.

      val lstat : string -> stats

      Same as stat, but in case the file is a symbolic link, return the information for the link itself.

      val fstat : file_descr -> stats

      Return the information for the file associated with the given descriptor.

      val isatty : file_descr -> bool

      Return true if the given file descriptor refers to a terminal or console window, false otherwise.

      File operations on large files

      module LargeFile : sig ... end

      File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

      Mapping files into memory

      val map_file : file_descr -> ?pos:int64 -> ('a, 'b) Stdlib.Bigarray.kind -> @@ -12,7 +30,7 @@ file_descr -> file_descr -> file_descr -> - int

      create_process prog args stdin stdout stderr creates a new process that executes the program in file prog, with arguments args. The pid of the new process is returned immediately; the new process executes concurrently with the current process. The standard input and outputs of the new process are connected to the descriptors stdin, stdout and stderr. Passing e.g. Unix.stdout for stdout prevents the redirection and causes the new process to have the same standard output as the current process. The executable file prog is searched in the path. The new process has the same environment as the current process.

      val create_process_env : + int

      create_process prog args stdin stdout stderr creates a new process that executes the program in file prog, with arguments args. Note that the first argument, args.(0), is by convention the filename of the program being executed, just like Sys.argv.(0). The pid of the new process is returned immediately; the new process executes concurrently with the current process. The standard input and outputs of the new process are connected to the descriptors stdin, stdout and stderr. Passing e.g. Unix.stdout for stdout prevents the redirection and causes the new process to have the same standard output as the current process. The executable file prog is searched in the path. The new process has the same environment as the current process.

      val create_process_env : string -> string array -> string array -> @@ -22,11 +40,11 @@ int

      create_process_env prog args env stdin stdout stderr works as create_process, except that the extra argument env specifies the environment passed to the program.

      val open_process_in : string -> in_channel

      High-level pipe and process management. This function runs the given command in parallel with the program. The standard output of the command is redirected to a pipe, which can be read via the returned input channel. The command is interpreted by the shell /bin/sh (or cmd.exe on Windows), cf. system. The Filename.quote_command function can be used to quote the command and its arguments as appropriate for the shell being used. If the command does not need to be run through the shell, open_process_args_in can be used as a more robust and more efficient alternative to open_process_in.

      val open_process_out : string -> out_channel

      Same as open_process_in, but redirect the standard input of the command to a pipe. Data written to the returned output channel is sent to the standard input of the command. Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization. If the command does not need to be run through the shell, open_process_args_out can be used instead of open_process_out.

      val open_process : string -> in_channel * out_channel

      Same as open_process_out, but redirects both the standard input and standard output of the command to pipes connected to the two returned channels. The input channel is connected to the output of the command, and the output channel to the input of the command. If the command does not need to be run through the shell, open_process_args can be used instead of open_process.

      val open_process_full : string -> string array -> - in_channel * out_channel * in_channel

      Similar to open_process, but the second argument specifies the environment passed to the command. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the command. If the command does not need to be run through the shell, open_process_args_full can be used instead of open_process_full.

      val open_process_args : string -> string array -> in_channel * out_channel

      open_process_args prog args runs the program prog with arguments args. Note that the first argument is by convention the filename of the program being executed, just like Sys.argv.(0). The new process executes concurrently with the current process. The standard input and output of the new process are redirected to pipes, which can be respectively read and written via the returned channels. The input channel is connected to the output of the program, and the output channel to the input of the program.

      Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization.

      The executable file prog is searched for in the path. This behaviour changed in 4.12; previously prog was looked up only in the current directory.

      The new process has the same environment as the current process.

      • since 4.08
      val open_process_args_in : string -> string array -> in_channel

      Same as open_process_args, but redirects only the standard output of the new process.

      • since 4.08
      val open_process_args_out : string -> string array -> out_channel

      Same as open_process_args, but redirects only the standard input of the new process.

      • since 4.08
      val open_process_args_full : + in_channel * out_channel * in_channel

      Similar to open_process, but the second argument specifies the environment passed to the command. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the command. If the command does not need to be run through the shell, open_process_args_full can be used instead of open_process_full.

      val open_process_args : string -> string array -> in_channel * out_channel

      open_process_args prog args runs the program prog with arguments args. Note that the first argument, args.(0), is by convention the filename of the program being executed, just like Sys.argv.(0). The new process executes concurrently with the current process. The standard input and output of the new process are redirected to pipes, which can be respectively read and written via the returned channels. The input channel is connected to the output of the program, and the output channel to the input of the program.

      Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization.

      The executable file prog is searched for in the path. This behaviour changed in 4.12; previously prog was looked up only in the current directory.

      The new process has the same environment as the current process.

      • since 4.08
      val open_process_args_in : string -> string array -> in_channel

      Same as open_process_args, but redirects only the standard output of the new process.

      • since 4.08
      val open_process_args_out : string -> string array -> out_channel

      Same as open_process_args, but redirects only the standard input of the new process.

      • since 4.08
      val open_process_args_full : string -> string array -> string array -> - in_channel * out_channel * in_channel

      Similar to open_process_args, but the third argument specifies the environment passed to the new process. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the program.

      • since 4.08
      val process_in_pid : in_channel -> int

      Return the pid of a process opened via open_process_in or open_process_args_in.

      • since 4.08 (4.12 in UnixLabels)
      val process_out_pid : out_channel -> int

      Return the pid of a process opened via open_process_out or open_process_args_out.

      • since 4.08 (4.12 in UnixLabels)
      val process_pid : (in_channel * out_channel) -> int

      Return the pid of a process opened via open_process or open_process_args.

      • since 4.08 (4.12 in UnixLabels)
      val process_full_pid : (in_channel * out_channel * in_channel) -> int

      Return the pid of a process opened via open_process_full or open_process_args_full.

      • since 4.08 (4.12 in UnixLabels)
      val close_process_in : in_channel -> process_status

      Close channels opened by open_process_in, wait for the associated command to terminate, and return its termination status.

      val close_process_out : out_channel -> process_status

      Close channels opened by open_process_out, wait for the associated command to terminate, and return its termination status.

      val close_process : (in_channel * out_channel) -> process_status

      Close channels opened by open_process, wait for the associated command to terminate, and return its termination status.

      val close_process_full : + in_channel * out_channel * in_channel

      Similar to open_process_args, but the third argument specifies the environment passed to the new process. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the program.

      • since 4.08
      val process_in_pid : in_channel -> int

      Return the pid of a process opened via open_process_args_in or the pid of the shell opened via open_process_in.

      • since 4.08 (4.12 in UnixLabels)
      val process_out_pid : out_channel -> int

      Return the pid of a process opened via open_process_args_out or the pid of the shell opened via open_process_out.

      • since 4.08 (4.12 in UnixLabels)
      val process_pid : (in_channel * out_channel) -> int

      Return the pid of a process opened via open_process_args or the pid of the shell opened via open_process_args.

      • since 4.08 (4.12 in UnixLabels)
      val process_full_pid : (in_channel * out_channel * in_channel) -> int

      Return the pid of a process opened via open_process_args_full or the pid of the shell opened via open_process_full.

      • since 4.08 (4.12 in UnixLabels)
      val close_process_in : in_channel -> process_status

      Close channels opened by open_process_in, wait for the associated command to terminate, and return its termination status.

      val close_process_out : out_channel -> process_status

      Close channels opened by open_process_out, wait for the associated command to terminate, and return its termination status.

      val close_process : (in_channel * out_channel) -> process_status

      Close channels opened by open_process, wait for the associated command to terminate, and return its termination status.

      val close_process_full : (in_channel * out_channel * in_channel) -> process_status

      Close channels opened by open_process_full, wait for the associated command to terminate, and return its termination status.

      symlink ?to_dir src dst creates the file dst as a symbolic link to the file src. On Windows, ~to_dir indicates if the symbolic link points to a directory or a file; if omitted, symlink examines src using stat and picks appropriately, if src does not exist then false is assumed (for this reason, it is recommended that the ~to_dir parameter be specified in new code). On Unix, ~to_dir is ignored.

      Windows symbolic links are available in Windows Vista onwards. There are some important differences between Windows symlinks and their POSIX counterparts.

      Windows symbolic links come in two flavours: directory and regular, which designate whether the symbolic link points to a directory or a file. The type must be correct - a directory symlink which actually points to a file cannot be selected with chdir and a file symlink which actually points to a directory cannot be read or written (note that Cygwin's emulation layer ignores this distinction).

      When symbolic links are created to existing targets, this distinction doesn't matter and symlink will automatically create the correct kind of symbolic link. The distinction matters when a symbolic link is created to a non-existent target.

      The other caveat is that by default symbolic links are a privileged operation. Administrators will always need to be running elevated (or with UAC disabled) and by default normal user accounts need to be granted the SeCreateSymbolicLinkPrivilege via Local Security Policy (secpol.msc) or via Active Directory.

      has_symlink can be used to check that a process is able to create symbolic links.

      Returns true if the user is able to create symbolic links. On Windows, this indicates that the user not only has the SeCreateSymbolicLinkPrivilege but is also running elevated, if necessary. On other platforms, this is simply indicates that the symlink system call is available.

      • since 4.03

      Read the contents of a symbolic link.

      Polling

      val select : file_descr list -> @@ -61,7 +79,7 @@ int -> msg_flag list -> sockaddr -> - int

      Same as sendto, but take the data from a string instead of a byte sequence.

      • since 4.02

      Socket options

      type socket_bool_option =
      1. | SO_DEBUG
        (*

        Record debugging information

        *)
      2. | SO_BROADCAST
        (*

        Permit sending of broadcast messages

        *)
      3. | SO_REUSEADDR
        (*

        Allow reuse of local addresses for bind

        *)
      4. | SO_KEEPALIVE
        (*

        Keep connection active

        *)
      5. | SO_DONTROUTE
        (*

        Bypass the standard routing algorithms

        *)
      6. | SO_OOBINLINE
        (*

        Leave out-of-band data in line

        *)
      7. | SO_ACCEPTCONN
        (*

        Report whether socket listening is enabled

        *)
      8. | TCP_NODELAY
        (*

        Control the Nagle algorithm for TCP sockets

        *)
      9. | IPV6_ONLY
        (*

        Forbid binding an IPv6 socket to an IPv4 address

        *)
      10. | SO_REUSEPORT
        (*

        Allow reuse of address and port bindings

        *)

      The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

      type socket_int_option =
      1. | SO_SNDBUF
        (*

        Size of send buffer

        *)
      2. | SO_RCVBUF
        (*

        Size of received buffer

        *)
      3. | SO_ERROR
        (*

        Deprecated. Use getsockopt_error instead.

        • deprecated Use Unix.getsockopt_error instead.
        *)
      4. | SO_TYPE
        (*

        Report the socket type

        *)
      5. | SO_RCVLOWAT
        (*

        Minimum number of bytes to process for input operations

        *)
      6. | SO_SNDLOWAT
        (*

        Minimum number of bytes to process for output operations

        *)

      The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

      type socket_optint_option =
      1. | SO_LINGER
        (*

        Whether to linger on closed connections that have data present, and for how long (in seconds)

        *)

      The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

      type socket_float_option =
      1. | SO_RCVTIMEO
        (*

        Timeout for input operations

        *)
      2. | SO_SNDTIMEO
        (*

        Timeout for output operations

        *)

      The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

      val getsockopt : file_descr -> socket_bool_option -> bool

      Return the current status of a boolean-valued option in the given socket.

      val setsockopt : file_descr -> socket_bool_option -> bool -> unit

      Set or clear a boolean-valued option in the given socket.

      val getsockopt_int : file_descr -> socket_int_option -> int

      Same as getsockopt for an integer-valued socket option.

      val setsockopt_int : file_descr -> socket_int_option -> int -> unit

      Same as setsockopt for an integer-valued socket option.

      val getsockopt_optint : file_descr -> socket_optint_option -> int option

      Same as getsockopt for a socket option whose value is an int option.

      val setsockopt_optint : + int

      Same as sendto, but take the data from a string instead of a byte sequence.

      • since 4.02

      Socket options

      type socket_bool_option =
      1. | SO_DEBUG
        (*

        Record debugging information

        *)
      2. | SO_BROADCAST
        (*

        Permit sending of broadcast messages

        *)
      3. | SO_REUSEADDR
        (*

        Allow reuse of local addresses for bind

        *)
      4. | SO_KEEPALIVE
        (*

        Keep connection active

        *)
      5. | SO_DONTROUTE
        (*

        Bypass the standard routing algorithms

        *)
      6. | SO_OOBINLINE
        (*

        Leave out-of-band data in line

        *)
      7. | SO_ACCEPTCONN
        (*

        Report whether socket listening is enabled

        *)
      8. | TCP_NODELAY
        (*

        Control the Nagle algorithm for TCP sockets

        *)
      9. | IPV6_ONLY
        (*

        Forbid binding an IPv6 socket to an IPv4 address

        *)
      10. | SO_REUSEPORT
        (*

        Allow reuse of address and port bindings.

        • since 4.12.
        *)

      The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

      type socket_int_option =
      1. | SO_SNDBUF
        (*

        Size of send buffer

        *)
      2. | SO_RCVBUF
        (*

        Size of received buffer

        *)
      3. | SO_ERROR
        (*

        Deprecated. Use getsockopt_error instead.

        • deprecated Use Unix.getsockopt_error instead.
        *)
      4. | SO_TYPE
        (*

        Report the socket type

        *)
      5. | SO_RCVLOWAT
        (*

        Minimum number of bytes to process for input operations

        *)
      6. | SO_SNDLOWAT
        (*

        Minimum number of bytes to process for output operations

        *)

      The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

      type socket_optint_option =
      1. | SO_LINGER
        (*

        Whether to linger on closed connections that have data present, and for how long (in seconds)

        *)

      The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

      type socket_float_option =
      1. | SO_RCVTIMEO
        (*

        Timeout for input operations

        *)
      2. | SO_SNDTIMEO
        (*

        Timeout for output operations

        *)

      The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

      val getsockopt : file_descr -> socket_bool_option -> bool

      Return the current status of a boolean-valued option in the given socket.

      val setsockopt : file_descr -> socket_bool_option -> bool -> unit

      Set or clear a boolean-valued option in the given socket.

      val getsockopt_int : file_descr -> socket_int_option -> int

      Same as getsockopt for an integer-valued socket option.

      val setsockopt_int : file_descr -> socket_int_option -> int -> unit

      Same as setsockopt for an integer-valued socket option.

      val getsockopt_optint : file_descr -> socket_optint_option -> int option

      Same as getsockopt for a socket option whose value is an int option.

      val setsockopt_optint : file_descr -> socket_optint_option -> int option -> diff --git a/ocaml/UnixLabels/index.html b/ocaml/UnixLabels/index.html index bcb52a87..2c885c68 100644 --- a/ocaml/UnixLabels/index.html +++ b/ocaml/UnixLabels/index.html @@ -1,10 +1,31 @@ -UnixLabels (ocaml.UnixLabels)

      Module UnixLabels

      Interface to the Unix system.

      To use the labeled version of this module, add module Unix = UnixLabels in your implementation.

      Note: all the functions of this module (except error_message and handle_unix_error) are liable to raise the Unix_error exception whenever the underlying system call signals an error.

      Error report

      type error = Unix.error =
      1. | E2BIG
        (*

        Argument list too long

        *)
      2. | EACCES
        (*

        Permission denied

        *)
      3. | EAGAIN
        (*

        Resource temporarily unavailable; try again

        *)
      4. | EBADF
        (*

        Bad file descriptor

        *)
      5. | EBUSY
        (*

        Resource unavailable

        *)
      6. | ECHILD
        (*

        No child process

        *)
      7. | EDEADLK
        (*

        Resource deadlock would occur

        *)
      8. | EDOM
        (*

        Domain error for math functions, etc.

        *)
      9. | EEXIST
        (*

        File exists

        *)
      10. | EFAULT
        (*

        Bad address

        *)
      11. | EFBIG
        (*

        File too large

        *)
      12. | EINTR
        (*

        Function interrupted by signal

        *)
      13. | EINVAL
        (*

        Invalid argument

        *)
      14. | EIO
        (*

        Hardware I/O error

        *)
      15. | EISDIR
        (*

        Is a directory

        *)
      16. | EMFILE
        (*

        Too many open files by the process

        *)
      17. | ENAMETOOLONG
        (*

        Filename too long

        *)
      18. | ENFILE
        (*

        Too many open files in the system

        *)
      19. | ENODEV
        (*

        No such device

        *)
      20. | ENOENT
        (*

        No such file or directory

        *)
      21. | ENOEXEC
        (*

        Not an executable file

        *)
      22. | ENOLCK
        (*

        No locks available

        *)
      23. | ENOMEM
        (*

        Not enough memory

        *)
      24. | ENOSPC
        (*

        No space left on device

        *)
      25. | ENOSYS
        (*

        Function not supported

        *)
      26. | ENOTDIR
        (*

        Not a directory

        *)
      27. | ENOTEMPTY
        (*

        Directory not empty

        *)
      28. | ENOTTY
        (*

        Inappropriate I/O control operation

        *)
      29. | ENXIO
        (*

        No such device or address

        *)
      30. | EPERM
        (*

        Operation not permitted

        *)
      31. | EPIPE
        (*

        Broken pipe

        *)
      32. | ERANGE
        (*

        Result too large

        *)
      33. | EROFS
        (*

        Read-only file system

        *)
      34. | ESPIPE
        (*

        Invalid seek e.g. on a pipe

        *)
      35. | ESRCH
        (*

        No such process

        *)
      36. | EXDEV
        (*

        Invalid link

        *)
      37. | EWOULDBLOCK
        (*

        Operation would block

        *)
      38. | EINPROGRESS
        (*

        Operation now in progress

        *)
      39. | EALREADY
        (*

        Operation already in progress

        *)
      40. | ENOTSOCK
        (*

        Socket operation on non-socket

        *)
      41. | EDESTADDRREQ
        (*

        Destination address required

        *)
      42. | EMSGSIZE
        (*

        Message too long

        *)
      43. | EPROTOTYPE
        (*

        Protocol wrong type for socket

        *)
      44. | ENOPROTOOPT
        (*

        Protocol not available

        *)
      45. | EPROTONOSUPPORT
        (*

        Protocol not supported

        *)
      46. | ESOCKTNOSUPPORT
        (*

        Socket type not supported

        *)
      47. | EOPNOTSUPP
        (*

        Operation not supported on socket

        *)
      48. | EPFNOSUPPORT
        (*

        Protocol family not supported

        *)
      49. | EAFNOSUPPORT
        (*

        Address family not supported by protocol family

        *)
      50. | EADDRINUSE
        (*

        Address already in use

        *)
      51. | EADDRNOTAVAIL
        (*

        Can't assign requested address

        *)
      52. | ENETDOWN
        (*

        Network is down

        *)
      53. | ENETUNREACH
        (*

        Network is unreachable

        *)
      54. | ENETRESET
        (*

        Network dropped connection on reset

        *)
      55. | ECONNABORTED
        (*

        Software caused connection abort

        *)
      56. | ECONNRESET
        (*

        Connection reset by peer

        *)
      57. | ENOBUFS
        (*

        No buffer space available

        *)
      58. | EISCONN
        (*

        Socket is already connected

        *)
      59. | ENOTCONN
        (*

        Socket is not connected

        *)
      60. | ESHUTDOWN
        (*

        Can't send after socket shutdown

        *)
      61. | ETOOMANYREFS
        (*

        Too many references: can't splice

        *)
      62. | ETIMEDOUT
        (*

        Connection timed out

        *)
      63. | ECONNREFUSED
        (*

        Connection refused

        *)
      64. | EHOSTDOWN
        (*

        Host is down

        *)
      65. | EHOSTUNREACH
        (*

        No route to host

        *)
      66. | ELOOP
        (*

        Too many levels of symbolic links

        *)
      67. | EOVERFLOW
        (*

        File size or position not representable

        *)
      68. | EUNKNOWNERR of int
        (*

        Unknown error

        *)

      The type of error codes. Errors defined in the POSIX standard and additional errors from UNIX98 and BSD. All other errors are mapped to EUNKNOWNERR.

      exception Unix_error of error * string * string

      Raised by the system calls below when an error is encountered. The first component is the error code; the second component is the function name; the third component is the string parameter to the function, if it has one, or the empty string otherwise.

      UnixLabels.Unix_error and Unix.Unix_error are the same, and catching one will catch the other.

      val error_message : error -> string

      Return a string describing the given error code.

      val handle_unix_error : ('a -> 'b) -> 'a -> 'b

      handle_unix_error f x applies f to x and returns the result. If the exception Unix_error is raised, it prints a message describing the error and exits with code 2.

      Access to the process environment

      val environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. The returned array is empty if the process has special privileges.

      val unsafe_environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. Unlike environment, this function returns a populated array even if the process has special privileges. See the documentation for unsafe_getenv for more details.

      • since 4.12
      val getenv : string -> string

      Return the value associated to a variable in the process environment, unless the process has special privileges.

      • raises Not_found

        if the variable is unbound or the process has special privileges.

        This function is identical to Sys.getenv.

      val unsafe_getenv : string -> string

      Return the value associated to a variable in the process environment.

      Unlike getenv, this function returns the value even if the process has special privileges. It is considered unsafe because the programmer of a setuid or setgid program must be careful to avoid using maliciously crafted environment variables in the search path for executables, the locations for temporary files or logs, and the like.

      • raises Not_found

        if the variable is unbound.

      • since 4.06
      val putenv : string -> string -> unit

      putenv name value sets the value associated to a variable in the process environment. name is the name of the environment variable, and value its new associated value.

      Process handling

      type process_status = Unix.process_status =
      1. | WEXITED of int
        (*

        The process terminated normally by exit; the argument is the return code.

        *)
      2. | WSIGNALED of int
        (*

        The process was killed by a signal; the argument is the signal number.

        *)
      3. | WSTOPPED of int
        (*

        The process was stopped by a signal; the argument is the signal number.

        *)

      The termination status of a process. See module Sys for the definitions of the standard signal numbers. Note that they are not the numbers used by the OS.

      On Windows: only WEXITED is used (as there are no inter-process signals) but with specific return codes to indicate special termination causes. Look for NTSTATUS values in the Windows documentation to decode such error return codes. In particular, STATUS_ACCESS_VIOLATION error code is the 32-bit 0xC0000005: as Int32.of_int 0xC0000005 is -1073741819, WEXITED -1073741819 is the Windows equivalent of WSIGNALED Sys.sigsegv.

      type wait_flag = Unix.wait_flag =
      1. | WNOHANG
        (*

        Do not block if no child has died yet, but immediately return with a pid equal to 0.

        *)
      2. | WUNTRACED
        (*

        Report also the children that receive stop signals.

        *)

      Flags for waitpid.

      val execv : prog:string -> args:string array -> 'a

      execv ~prog ~args execute the program in file prog, with the arguments args, and the current process environment. These execv* functions never return: on success, the current program is replaced by the new one.

      On Windows: the CRT simply spawns a new process and exits the current one. This will have unwanted consequences if e.g. another process is waiting on the current one. Using create_process or one of the open_process_* functions instead is recommended.

      val execve : prog:string -> args:string array -> env:string array -> 'a

      Same as execv, except that the third argument provides the environment to the program executed.

      val execvp : prog:string -> args:string array -> 'a

      Same as execv, except that the program is searched in the path.

      val execvpe : prog:string -> args:string array -> env:string array -> 'a

      Same as execve, except that the program is searched in the path.

      val fork : unit -> int

      Fork a new process. The returned integer is 0 for the child process, the pid of the child process for the parent process.

      • raises Invalid_argument

        on Windows. Use create_process or threads instead.

      val wait : unit -> int * process_status

      Wait until one of the children processes die, and return its pid and termination status.

      • raises Invalid_argument

        on Windows. Use waitpid instead.

      val waitpid : mode:wait_flag list -> int -> int * process_status

      Same as wait, but waits for the child process whose pid is given. A pid of -1 means wait for any child. A pid of 0 means wait for any child in the same process group as the current process. Negative pid arguments represent process groups. The list of options indicates whether waitpid should return immediately without waiting, and whether it should report stopped children.

      On Windows: can only wait for a given PID, not any child process.

      val system : string -> process_status

      Execute the given command, wait until it terminates, and return its termination status. The string is interpreted by the shell /bin/sh (or the command interpreter cmd.exe on Windows) and therefore can contain redirections, quotes, variables, etc. To properly quote whitespace and shell special characters occurring in file names or command arguments, the use of Filename.quote_command is recommended. The result WEXITED 127 indicates that the shell couldn't be executed.

      val _exit : int -> 'a

      Terminate the calling process immediately, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. Unlike Stdlib.exit, Unix._exit performs no finalization whatsoever: functions registered with Stdlib.at_exit are not called, input/output channels are not flushed, and the C run-time system is not finalized either.

      The typical use of Unix._exit is after a Unix.fork operation, when the child process runs into a fatal error and must exit. In this case, it is preferable to not perform any finalization action in the child process, as these actions could interfere with similar actions performed by the parent process. For example, output channels should not be flushed by the child process, as the parent process may flush them again later, resulting in duplicate output.

      • since 4.12
      val getpid : unit -> int

      Return the pid of the process.

      val getppid : unit -> int

      Return the pid of the parent process.

      • raises Invalid_argument

        on Windows (because it is meaningless)

      val nice : int -> int

      Change the process priority. The integer argument is added to the ``nice'' value. (Higher values of the ``nice'' value mean lower priorities.) Return the new nice value.

      • raises Invalid_argument

        on Windows

      Basic file input/output

      type file_descr = Unix.file_descr

      The abstract type of file descriptors.

      val stdin : file_descr

      File descriptor for standard input.

      val stdout : file_descr

      File descriptor for standard output.

      val stderr : file_descr

      File descriptor for standard error.

      type open_flag = Unix.open_flag =
      1. | O_RDONLY
        (*

        Open for reading

        *)
      2. | O_WRONLY
        (*

        Open for writing

        *)
      3. | O_RDWR
        (*

        Open for reading and writing

        *)
      4. | O_NONBLOCK
        (*

        Open in non-blocking mode

        *)
      5. | O_APPEND
        (*

        Open for append

        *)
      6. | O_CREAT
        (*

        Create if nonexistent

        *)
      7. | O_TRUNC
        (*

        Truncate to 0 length if existing

        *)
      8. | O_EXCL
        (*

        Fail if existing

        *)
      9. | O_NOCTTY
        (*

        Don't make this dev a controlling tty

        *)
      10. | O_DSYNC
        (*

        Writes complete as `Synchronised I/O data integrity completion'

        *)
      11. | O_SYNC
        (*

        Writes complete as `Synchronised I/O file integrity completion'

        *)
      12. | O_RSYNC
        (*

        Reads complete as writes (depending on O_SYNC/O_DSYNC)

        *)
      13. | O_SHARE_DELETE
        (*

        Windows only: allow the file to be deleted while still open

        *)
      14. | O_CLOEXEC
        (*

        Set the close-on-exec flag on the descriptor returned by openfile. See set_close_on_exec for more information.

        *)
      15. | O_KEEPEXEC
        (*

        Clear the close-on-exec flag. This is currently the default.

        *)

      The flags to openfile.

      type file_perm = int

      The type of file access rights, e.g. 0o640 is read and write for user, read for group, none for others

      val openfile : string -> mode:open_flag list -> perm:file_perm -> file_descr

      Open the named file with the given flags. Third argument is the permissions to give to the file if it is created (see umask). Return a file descriptor on the named file.

      val close : file_descr -> unit

      Close a file descriptor.

      val fsync : file_descr -> unit

      Flush file buffers to disk.

      • since 4.12
      val read : file_descr -> buf:bytes -> pos:int -> len:int -> int

      read fd ~buf ~pos ~len reads len bytes from descriptor fd, storing them in byte sequence buf, starting at position pos in buf. Return the number of bytes actually read.

      val write : file_descr -> buf:bytes -> pos:int -> len:int -> int

      write fd ~buf ~pos ~len writes len bytes to descriptor fd, taking them from byte sequence buf, starting at position pos in buff. Return the number of bytes actually written. write repeats the writing operation until all bytes have been written or an error occurs.

      val single_write : file_descr -> buf:bytes -> pos:int -> len:int -> int

      Same as write, but attempts to write only once. Thus, if an error occurs, single_write guarantees that no data has been written.

      val write_substring : file_descr -> buf:string -> pos:int -> len:int -> int

      Same as write, but take the data from a string instead of a byte sequence.

      • since 4.02
      val single_write_substring : +UnixLabels (ocaml.UnixLabels)

      Module UnixLabels

      Interface to the Unix system.

      To use the labeled version of this module, add module Unix = UnixLabels in your implementation.

      Note: all the functions of this module (except error_message and handle_unix_error) are liable to raise the Unix_error exception whenever the underlying system call signals an error.

      Error report

      type error = Unix.error =
      1. | E2BIG
        (*

        Argument list too long

        *)
      2. | EACCES
        (*

        Permission denied

        *)
      3. | EAGAIN
        (*

        Resource temporarily unavailable; try again

        *)
      4. | EBADF
        (*

        Bad file descriptor

        *)
      5. | EBUSY
        (*

        Resource unavailable

        *)
      6. | ECHILD
        (*

        No child process

        *)
      7. | EDEADLK
        (*

        Resource deadlock would occur

        *)
      8. | EDOM
        (*

        Domain error for math functions, etc.

        *)
      9. | EEXIST
        (*

        File exists

        *)
      10. | EFAULT
        (*

        Bad address

        *)
      11. | EFBIG
        (*

        File too large

        *)
      12. | EINTR
        (*

        Function interrupted by signal

        *)
      13. | EINVAL
        (*

        Invalid argument

        *)
      14. | EIO
        (*

        Hardware I/O error

        *)
      15. | EISDIR
        (*

        Is a directory

        *)
      16. | EMFILE
        (*

        Too many open files by the process

        *)
      17. | ENAMETOOLONG
        (*

        Filename too long

        *)
      18. | ENFILE
        (*

        Too many open files in the system

        *)
      19. | ENODEV
        (*

        No such device

        *)
      20. | ENOENT
        (*

        No such file or directory

        *)
      21. | ENOEXEC
        (*

        Not an executable file

        *)
      22. | ENOLCK
        (*

        No locks available

        *)
      23. | ENOMEM
        (*

        Not enough memory

        *)
      24. | ENOSPC
        (*

        No space left on device

        *)
      25. | ENOSYS
        (*

        Function not supported

        *)
      26. | ENOTDIR
        (*

        Not a directory

        *)
      27. | ENOTEMPTY
        (*

        Directory not empty

        *)
      28. | ENOTTY
        (*

        Inappropriate I/O control operation

        *)
      29. | ENXIO
        (*

        No such device or address

        *)
      30. | EPERM
        (*

        Operation not permitted

        *)
      31. | EPIPE
        (*

        Broken pipe

        *)
      32. | ERANGE
        (*

        Result too large

        *)
      33. | EROFS
        (*

        Read-only file system

        *)
      34. | ESPIPE
        (*

        Invalid seek e.g. on a pipe

        *)
      35. | ESRCH
        (*

        No such process

        *)
      36. | EXDEV
        (*

        Invalid link

        *)
      37. | EWOULDBLOCK
        (*

        Operation would block

        *)
      38. | EINPROGRESS
        (*

        Operation now in progress

        *)
      39. | EALREADY
        (*

        Operation already in progress

        *)
      40. | ENOTSOCK
        (*

        Socket operation on non-socket

        *)
      41. | EDESTADDRREQ
        (*

        Destination address required

        *)
      42. | EMSGSIZE
        (*

        Message too long

        *)
      43. | EPROTOTYPE
        (*

        Protocol wrong type for socket

        *)
      44. | ENOPROTOOPT
        (*

        Protocol not available

        *)
      45. | EPROTONOSUPPORT
        (*

        Protocol not supported

        *)
      46. | ESOCKTNOSUPPORT
        (*

        Socket type not supported

        *)
      47. | EOPNOTSUPP
        (*

        Operation not supported on socket

        *)
      48. | EPFNOSUPPORT
        (*

        Protocol family not supported

        *)
      49. | EAFNOSUPPORT
        (*

        Address family not supported by protocol family

        *)
      50. | EADDRINUSE
        (*

        Address already in use

        *)
      51. | EADDRNOTAVAIL
        (*

        Can't assign requested address

        *)
      52. | ENETDOWN
        (*

        Network is down

        *)
      53. | ENETUNREACH
        (*

        Network is unreachable

        *)
      54. | ENETRESET
        (*

        Network dropped connection on reset

        *)
      55. | ECONNABORTED
        (*

        Software caused connection abort

        *)
      56. | ECONNRESET
        (*

        Connection reset by peer

        *)
      57. | ENOBUFS
        (*

        No buffer space available

        *)
      58. | EISCONN
        (*

        Socket is already connected

        *)
      59. | ENOTCONN
        (*

        Socket is not connected

        *)
      60. | ESHUTDOWN
        (*

        Can't send after socket shutdown

        *)
      61. | ETOOMANYREFS
        (*

        Too many references: can't splice

        *)
      62. | ETIMEDOUT
        (*

        Connection timed out

        *)
      63. | ECONNREFUSED
        (*

        Connection refused

        *)
      64. | EHOSTDOWN
        (*

        Host is down

        *)
      65. | EHOSTUNREACH
        (*

        No route to host

        *)
      66. | ELOOP
        (*

        Too many levels of symbolic links

        *)
      67. | EOVERFLOW
        (*

        File size or position not representable

        *)
      68. | EUNKNOWNERR of int
        (*

        Unknown error

        *)

      The type of error codes. Errors defined in the POSIX standard and additional errors from UNIX98 and BSD. All other errors are mapped to EUNKNOWNERR.

      exception Unix_error of error * string * string

      Raised by the system calls below when an error is encountered. The first component is the error code; the second component is the function name; the third component is the string parameter to the function, if it has one, or the empty string otherwise.

      UnixLabels.Unix_error and Unix.Unix_error are the same, and catching one will catch the other.

      val error_message : error -> string

      Return a string describing the given error code.

      val handle_unix_error : ('a -> 'b) -> 'a -> 'b

      handle_unix_error f x applies f to x and returns the result. If the exception Unix_error is raised, it prints a message describing the error and exits with code 2.

      Access to the process environment

      val environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. The returned array is empty if the process has special privileges.

      val unsafe_environment : unit -> string array

      Return the process environment, as an array of strings with the format ``variable=value''. Unlike environment, this function returns a populated array even if the process has special privileges. See the documentation for unsafe_getenv for more details.

      • since 4.12
      val getenv : string -> string

      Return the value associated to a variable in the process environment, unless the process has special privileges.

      • raises Not_found

        if the variable is unbound or the process has special privileges.

        This function is identical to Sys.getenv.

      val unsafe_getenv : string -> string

      Return the value associated to a variable in the process environment.

      Unlike getenv, this function returns the value even if the process has special privileges. It is considered unsafe because the programmer of a setuid or setgid program must be careful to avoid using maliciously crafted environment variables in the search path for executables, the locations for temporary files or logs, and the like.

      • raises Not_found

        if the variable is unbound.

      • since 4.06
      val putenv : string -> string -> unit

      putenv name value sets the value associated to a variable in the process environment. name is the name of the environment variable, and value its new associated value.

      Process handling

      type process_status = Unix.process_status =
      1. | WEXITED of int
        (*

        The process terminated normally by exit; the argument is the return code.

        *)
      2. | WSIGNALED of int
        (*

        The process was killed by a signal; the argument is the signal number.

        *)
      3. | WSTOPPED of int
        (*

        The process was stopped by a signal; the argument is the signal number.

        *)

      The termination status of a process. See module Sys for the definitions of the standard signal numbers. Note that they are not the numbers used by the OS.

      On Windows: only WEXITED is used (as there are no inter-process signals) but with specific return codes to indicate special termination causes. Look for NTSTATUS values in the Windows documentation to decode such error return codes. In particular, STATUS_ACCESS_VIOLATION error code is the 32-bit 0xC0000005: as Int32.of_int 0xC0000005 is -1073741819, WEXITED -1073741819 is the Windows equivalent of WSIGNALED Sys.sigsegv.

      type wait_flag = Unix.wait_flag =
      1. | WNOHANG
        (*

        Do not block if no child has died yet, but immediately return with a pid equal to 0.

        *)
      2. | WUNTRACED
        (*

        Report also the children that receive stop signals.

        *)

      Flags for waitpid.

      val execv : prog:string -> args:string array -> 'a

      execv prog args execute the program in file prog, with the arguments args, and the current process environment. Note that the first argument, args.(0), is by convention the filename of the program being executed, just like Sys.argv.(0). These execv* functions never return: on success, the current program is replaced by the new one.

      On Windows: the CRT simply spawns a new process and exits the current one. This will have unwanted consequences if e.g. another process is waiting on the current one. Using create_process or one of the open_process_* functions instead is recommended.

      val execve : prog:string -> args:string array -> env:string array -> 'a

      Same as execv, except that the third argument provides the environment to the program executed.

      val execvp : prog:string -> args:string array -> 'a

      Same as execv, except that the program is searched in the path.

      val execvpe : prog:string -> args:string array -> env:string array -> 'a

      Same as execve, except that the program is searched in the path.

      val fork : unit -> int

      Fork a new process. The returned integer is 0 for the child process, the pid of the child process for the parent process. It fails if the OCaml process is multi-core (any domain has been spawned). In addition, if any thread from the Thread module has been spawned, then the child process might be in a corrupted state.

      • raises Invalid_argument

        on Windows. Use create_process or threads instead.

      • raises Failure

        if any domain has been spawned.

      val wait : unit -> int * process_status

      Wait until one of the children processes die, and return its pid and termination status.

      • raises Invalid_argument

        on Windows. Use waitpid instead.

      val waitpid : mode:wait_flag list -> int -> int * process_status

      Same as wait, but waits for the child process whose pid is given. A pid of -1 means wait for any child. A pid of 0 means wait for any child in the same process group as the current process. Negative pid arguments represent process groups. The list of options indicates whether waitpid should return immediately without waiting, and whether it should report stopped children.

      On Windows: can only wait for a given PID, not any child process.

      val system : string -> process_status

      Execute the given command, wait until it terminates, and return its termination status. The string is interpreted by the shell /bin/sh (or the command interpreter cmd.exe on Windows) and therefore can contain redirections, quotes, variables, etc. To properly quote whitespace and shell special characters occurring in file names or command arguments, the use of Filename.quote_command is recommended. The result WEXITED 127 indicates that the shell couldn't be executed.

      val _exit : int -> 'a

      Terminate the calling process immediately, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. Unlike Stdlib.exit, Unix._exit performs no finalization whatsoever: functions registered with Stdlib.at_exit are not called, input/output channels are not flushed, and the C run-time system is not finalized either.

      The typical use of Unix._exit is after a Unix.fork operation, when the child process runs into a fatal error and must exit. In this case, it is preferable to not perform any finalization action in the child process, as these actions could interfere with similar actions performed by the parent process. For example, output channels should not be flushed by the child process, as the parent process may flush them again later, resulting in duplicate output.

      • since 4.12
      val getpid : unit -> int

      Return the pid of the process.

      val getppid : unit -> int

      Return the pid of the parent process.

      • raises Invalid_argument

        on Windows (because it is meaningless)

      val nice : int -> int

      Change the process priority. The integer argument is added to the ``nice'' value. (Higher values of the ``nice'' value mean lower priorities.) Return the new nice value.

      • raises Invalid_argument

        on Windows

      Basic file input/output

      type file_descr = Unix.file_descr

      The abstract type of file descriptors.

      val stdin : file_descr

      File descriptor for standard input.

      val stdout : file_descr

      File descriptor for standard output.

      val stderr : file_descr

      File descriptor for standard error.

      type open_flag = Unix.open_flag =
      1. | O_RDONLY
        (*

        Open for reading

        *)
      2. | O_WRONLY
        (*

        Open for writing

        *)
      3. | O_RDWR
        (*

        Open for reading and writing

        *)
      4. | O_NONBLOCK
        (*

        Open in non-blocking mode

        *)
      5. | O_APPEND
        (*

        Open for append

        *)
      6. | O_CREAT
        (*

        Create if nonexistent

        *)
      7. | O_TRUNC
        (*

        Truncate to 0 length if existing

        *)
      8. | O_EXCL
        (*

        Fail if existing

        *)
      9. | O_NOCTTY
        (*

        Don't make this dev a controlling tty

        *)
      10. | O_DSYNC
        (*

        Writes complete as `Synchronised I/O data integrity completion'

        *)
      11. | O_SYNC
        (*

        Writes complete as `Synchronised I/O file integrity completion'

        *)
      12. | O_RSYNC
        (*

        Reads complete as writes (depending on O_SYNC/O_DSYNC)

        *)
      13. | O_SHARE_DELETE
        (*

        Windows only: allow the file to be deleted while still open

        *)
      14. | O_CLOEXEC
        (*

        Set the close-on-exec flag on the descriptor returned by openfile. See set_close_on_exec for more information.

        *)
      15. | O_KEEPEXEC
        (*

        Clear the close-on-exec flag. This is currently the default.

        *)

      The flags to openfile.

      type file_perm = int

      The type of file access rights, e.g. 0o640 is read and write for user, read for group, none for others

      val openfile : string -> mode:open_flag list -> perm:file_perm -> file_descr

      Open the named file with the given flags. Third argument is the permissions to give to the file if it is created (see umask). Return a file descriptor on the named file.

      val close : file_descr -> unit

      Close a file descriptor.

      val fsync : file_descr -> unit

      Flush file buffers to disk.

      • since 4.12
      val read : file_descr -> buf:bytes -> pos:int -> len:int -> int

      read fd ~buf ~pos ~len reads len bytes from descriptor fd, storing them in byte sequence buf, starting at position pos in buf. Return the number of bytes actually read.

      val read_bigarray : + file_descr -> + buf: + (_, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) + Stdlib.Bigarray.Array1.t -> + pos:int -> + len:int -> + int

      Same as read, but read the data into a bigarray.

      • since 5.2
      val write : file_descr -> buf:bytes -> pos:int -> len:int -> int

      write fd ~buf ~pos ~len writes len bytes to descriptor fd, taking them from byte sequence buf, starting at position pos in buff. Return the number of bytes actually written. write repeats the writing operation until all bytes have been written or an error occurs.

      val write_bigarray : + file_descr -> + buf: + (_, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) + Stdlib.Bigarray.Array1.t -> + pos:int -> + len:int -> + int

      Same as write, but take the data from a bigarray.

      • since 5.2
      val single_write : file_descr -> buf:bytes -> pos:int -> len:int -> int

      Same as write, but attempts to write only once. Thus, if an error occurs, single_write guarantees that no data has been written.

      val write_substring : file_descr -> buf:string -> pos:int -> len:int -> int

      Same as write, but take the data from a string instead of a byte sequence.

      • since 4.02
      val single_write_substring : file_descr -> buf:string -> pos:int -> len:int -> - int

      Same as single_write, but take the data from a string instead of a byte sequence.

      • since 4.02

      Interfacing with the standard input/output library

      val in_channel_of_descr : file_descr -> in_channel

      Create an input channel reading from the given descriptor. The channel is initially in binary mode; use set_binary_mode_in ic false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_in always fails on channels created with this function.

      Beware that input channels are buffered, so more characters may have been read from the descriptor than those accessed using channel functions. Channels also keep a copy of the current position in the file.

      Closing the channel ic returned by in_channel_of_descr fd using close_in ic also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      If several channels are created on the same descriptor, one of the channels must be closed, but not the others. Consider for example a descriptor s connected to a socket and two channels ic = in_channel_of_descr s and oc = out_channel_of_descr s. The recommended closing protocol is to perform close_out oc, which flushes buffered output to the socket then closes the socket. The ic channel must not be closed and will be collected by the GC eventually.

      val out_channel_of_descr : file_descr -> out_channel

      Create an output channel writing on the given descriptor. The channel is initially in binary mode; use set_binary_mode_out oc false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_out always fails on channels created with this function.

      Beware that output channels are buffered, so you may have to call Stdlib.flush to ensure that all data has been sent to the descriptor. Channels also keep a copy of the current position in the file.

      Closing the channel oc returned by out_channel_of_descr fd using close_out oc also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      See Unix.in_channel_of_descr for a discussion of the closing protocol when several channels are created on the same descriptor.

      val descr_of_in_channel : in_channel -> file_descr

      Return the descriptor corresponding to an input channel.

      val descr_of_out_channel : out_channel -> file_descr

      Return the descriptor corresponding to an output channel.

      Seeking and truncating

      type seek_command = Unix.seek_command =
      1. | SEEK_SET
        (*

        indicates positions relative to the beginning of the file

        *)
      2. | SEEK_CUR
        (*

        indicates positions relative to the current position

        *)
      3. | SEEK_END
        (*

        indicates positions relative to the end of the file

        *)

      Positioning modes for lseek.

      val lseek : file_descr -> int -> mode:seek_command -> int

      Set the current position for a file descriptor, and return the resulting offset (from the beginning of the file).

      val truncate : string -> len:int -> unit

      Truncates the named file to the given size.

      val ftruncate : file_descr -> len:int -> unit

      Truncates the file corresponding to the given descriptor to the given size.

      File status

      type file_kind = Unix.file_kind =
      1. | S_REG
        (*

        Regular file

        *)
      2. | S_DIR
        (*

        Directory

        *)
      3. | S_CHR
        (*

        Character device

        *)
      4. | S_BLK
        (*

        Block device

        *)
      5. | S_LNK
        (*

        Symbolic link

        *)
      6. | S_FIFO
        (*

        Named pipe

        *)
      7. | S_SOCK
        (*

        Socket

        *)
      type stats = Unix.stats = {
      1. st_dev : int;
        (*

        Device number

        *)
      2. st_ino : int;
        (*

        Inode number

        *)
      3. st_kind : file_kind;
        (*

        Kind of the file

        *)
      4. st_perm : file_perm;
        (*

        Access rights

        *)
      5. st_uid : int;
        (*

        User id of the owner

        *)
      6. st_gid : int;
        (*

        Group ID of the file's group

        *)
      7. st_rdev : int;
        (*

        Device ID (if special file)

        *)
      8. st_size : int;
        (*

        Size in bytes

        *)
      9. st_atime : float;
        (*

        Last access time

        *)
      10. st_mtime : float;
        (*

        Last modification time

        *)
      11. st_ctime : float;
        (*

        Last status change time

        *)
      }

      The information returned by the stat calls.

      val stat : string -> stats

      Return the information for the named file.

      val lstat : string -> stats

      Same as stat, but in case the file is a symbolic link, return the information for the link itself.

      val fstat : file_descr -> stats

      Return the information for the file associated with the given descriptor.

      val isatty : file_descr -> bool

      Return true if the given file descriptor refers to a terminal or console window, false otherwise.

      File operations on large files

      module LargeFile : sig ... end

      File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

      Mapping files into memory

      val map_file : + int

      Same as single_write, but take the data from a string instead of a byte sequence.

      • since 4.02
      val single_write_bigarray : + file_descr -> + buf: + (_, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) + Stdlib.Bigarray.Array1.t -> + pos:int -> + len:int -> + int

      Same as single_write, but take the data from a bigarray.

      • since 5.2

      Interfacing with the standard input/output library

      val in_channel_of_descr : file_descr -> in_channel

      Create an input channel reading from the given descriptor. The channel is initially in binary mode; use set_binary_mode_in ic false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_in always fails on channels created with this function.

      Beware that input channels are buffered, so more characters may have been read from the descriptor than those accessed using channel functions. Channels also keep a copy of the current position in the file.

      Closing the channel ic returned by in_channel_of_descr fd using close_in ic also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      If several channels are created on the same descriptor, one of the channels must be closed, but not the others. Consider for example a descriptor s connected to a socket and two channels ic = in_channel_of_descr s and oc = out_channel_of_descr s. The recommended closing protocol is to perform close_out oc, which flushes buffered output to the socket then closes the socket. The ic channel must not be closed and will be collected by the GC eventually.

      val out_channel_of_descr : file_descr -> out_channel

      Create an output channel writing on the given descriptor. The channel is initially in binary mode; use set_binary_mode_out oc false if text mode is desired. Text mode is supported only if the descriptor refers to a file or pipe, but is not supported if it refers to a socket.

      On Windows: Stdlib.set_binary_mode_out always fails on channels created with this function.

      Beware that output channels are buffered, so you may have to call Stdlib.flush to ensure that all data has been sent to the descriptor. Channels also keep a copy of the current position in the file.

      Closing the channel oc returned by out_channel_of_descr fd using close_out oc also closes the underlying descriptor fd. It is incorrect to close both the channel ic and the descriptor fd.

      See Unix.in_channel_of_descr for a discussion of the closing protocol when several channels are created on the same descriptor.

      val descr_of_in_channel : in_channel -> file_descr

      Return the descriptor corresponding to an input channel.

      val descr_of_out_channel : out_channel -> file_descr

      Return the descriptor corresponding to an output channel.

      Seeking and truncating

      type seek_command = Unix.seek_command =
      1. | SEEK_SET
        (*

        indicates positions relative to the beginning of the file

        *)
      2. | SEEK_CUR
        (*

        indicates positions relative to the current position

        *)
      3. | SEEK_END
        (*

        indicates positions relative to the end of the file

        *)

      Positioning modes for lseek.

      val lseek : file_descr -> int -> mode:seek_command -> int

      Set the current position for a file descriptor, and return the resulting offset (from the beginning of the file).

      val truncate : string -> len:int -> unit

      Truncates the named file to the given size.

      val ftruncate : file_descr -> len:int -> unit

      Truncates the file corresponding to the given descriptor to the given size.

      File status

      type file_kind = Unix.file_kind =
      1. | S_REG
        (*

        Regular file

        *)
      2. | S_DIR
        (*

        Directory

        *)
      3. | S_CHR
        (*

        Character device

        *)
      4. | S_BLK
        (*

        Block device

        *)
      5. | S_LNK
        (*

        Symbolic link

        *)
      6. | S_FIFO
        (*

        Named pipe

        *)
      7. | S_SOCK
        (*

        Socket

        *)
      type stats = Unix.stats = {
      1. st_dev : int;
        (*

        Device number

        *)
      2. st_ino : int;
        (*

        Inode number

        *)
      3. st_kind : file_kind;
        (*

        Kind of the file

        *)
      4. st_perm : file_perm;
        (*

        Access rights

        *)
      5. st_uid : int;
        (*

        User id of the owner

        *)
      6. st_gid : int;
        (*

        Group ID of the file's group

        *)
      7. st_rdev : int;
        (*

        Device ID (if special file)

        *)
      8. st_size : int;
        (*

        Size in bytes

        *)
      9. st_atime : float;
        (*

        Last access time

        *)
      10. st_mtime : float;
        (*

        Last modification time

        *)
      11. st_ctime : float;
        (*

        Last status change time

        *)
      }

      The information returned by the stat calls.

      val stat : string -> stats

      Return the information for the named file.

      val lstat : string -> stats

      Same as stat, but in case the file is a symbolic link, return the information for the link itself.

      val fstat : file_descr -> stats

      Return the information for the file associated with the given descriptor.

      val isatty : file_descr -> bool

      Return true if the given file descriptor refers to a terminal or console window, false otherwise.

      File operations on large files

      module LargeFile : sig ... end

      File operations on large files. This sub-module provides 64-bit variants of the functions lseek (for positioning a file descriptor), truncate and ftruncate (for changing the size of a file), and stat, lstat and fstat (for obtaining information on files). These alternate functions represent positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), thus allowing operating on files whose sizes are greater than max_int.

      Mapping files into memory

      val map_file : file_descr -> ?pos:int64 -> kind:('a, 'b) Stdlib.Bigarray.kind -> @@ -17,7 +38,7 @@ stdin:file_descr -> stdout:file_descr -> stderr:file_descr -> - int

      create_process ~prog ~args ~stdin ~stdout ~stderr creates a new process that executes the program in file prog, with arguments args. The pid of the new process is returned immediately; the new process executes concurrently with the current process. The standard input and outputs of the new process are connected to the descriptors stdin, stdout and stderr. Passing e.g. Unix.stdout for stdout prevents the redirection and causes the new process to have the same standard output as the current process. The executable file prog is searched in the path. The new process has the same environment as the current process.

      val create_process_env : + int

      create_process ~prog ~args ~stdin ~stdout ~stderr creates a new process that executes the program in file prog, with arguments args. Note that the first argument, args.(0), is by convention the filename of the program being executed, just like Sys.argv.(0). The pid of the new process is returned immediately; the new process executes concurrently with the current process. The standard input and outputs of the new process are connected to the descriptors stdin, stdout and stderr. Passing e.g. Unix.stdout for stdout prevents the redirection and causes the new process to have the same standard output as the current process. The executable file prog is searched in the path. The new process has the same environment as the current process.

      val create_process_env : prog:string -> args:string array -> env:string array -> @@ -27,11 +48,11 @@ int

      create_process_env ~prog ~args ~env ~stdin ~stdout ~stderr works as create_process, except that the extra argument env specifies the environment passed to the program.

      val open_process_in : string -> in_channel

      High-level pipe and process management. This function runs the given command in parallel with the program. The standard output of the command is redirected to a pipe, which can be read via the returned input channel. The command is interpreted by the shell /bin/sh (or cmd.exe on Windows), cf. system. The Filename.quote_command function can be used to quote the command and its arguments as appropriate for the shell being used. If the command does not need to be run through the shell, open_process_args_in can be used as a more robust and more efficient alternative to open_process_in.

      val open_process_out : string -> out_channel

      Same as open_process_in, but redirect the standard input of the command to a pipe. Data written to the returned output channel is sent to the standard input of the command. Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization. If the command does not need to be run through the shell, open_process_args_out can be used instead of open_process_out.

      val open_process : string -> in_channel * out_channel

      Same as open_process_out, but redirects both the standard input and standard output of the command to pipes connected to the two returned channels. The input channel is connected to the output of the command, and the output channel to the input of the command. If the command does not need to be run through the shell, open_process_args can be used instead of open_process.

      val open_process_full : string -> env:string array -> - in_channel * out_channel * in_channel

      Similar to open_process, but the second argument specifies the environment passed to the command. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the command. If the command does not need to be run through the shell, open_process_args_full can be used instead of open_process_full.

      val open_process_args : string -> string array -> in_channel * out_channel

      open_process_args prog args runs the program prog with arguments args. Note that the first argument is by convention the filename of the program being executed, just like Sys.argv.(0). The new process executes concurrently with the current process. The standard input and output of the new process are redirected to pipes, which can be respectively read and written via the returned channels. The input channel is connected to the output of the program, and the output channel to the input of the program.

      Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization.

      The executable file prog is searched for in the path. This behaviour changed in 4.12; previously prog was looked up only in the current directory.

      The new process has the same environment as the current process.

      • since 4.08
      val open_process_args_in : string -> string array -> in_channel

      Same as open_process_args, but redirects only the standard output of the new process.

      • since 4.08
      val open_process_args_out : string -> string array -> out_channel

      Same as open_process_args, but redirects only the standard input of the new process.

      • since 4.08
      val open_process_args_full : + in_channel * out_channel * in_channel

      Similar to open_process, but the second argument specifies the environment passed to the command. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the command. If the command does not need to be run through the shell, open_process_args_full can be used instead of open_process_full.

      val open_process_args : string -> string array -> in_channel * out_channel

      open_process_args prog args runs the program prog with arguments args. Note that the first argument, args.(0), is by convention the filename of the program being executed, just like Sys.argv.(0). The new process executes concurrently with the current process. The standard input and output of the new process are redirected to pipes, which can be respectively read and written via the returned channels. The input channel is connected to the output of the program, and the output channel to the input of the program.

      Warning: writes on output channels are buffered, hence be careful to call Stdlib.flush at the right times to ensure correct synchronization.

      The executable file prog is searched for in the path. This behaviour changed in 4.12; previously prog was looked up only in the current directory.

      The new process has the same environment as the current process.

      • since 4.08
      val open_process_args_in : string -> string array -> in_channel

      Same as open_process_args, but redirects only the standard output of the new process.

      • since 4.08
      val open_process_args_out : string -> string array -> out_channel

      Same as open_process_args, but redirects only the standard input of the new process.

      • since 4.08
      val open_process_args_full : string -> string array -> string array -> - in_channel * out_channel * in_channel

      Similar to open_process_args, but the third argument specifies the environment passed to the new process. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the program.

      • since 4.08
      val process_in_pid : in_channel -> int

      Return the pid of a process opened via open_process_in or open_process_args_in.

      • since 4.12
      val process_out_pid : out_channel -> int

      Return the pid of a process opened via open_process_out or open_process_args_out.

      • since 4.12
      val process_pid : (in_channel * out_channel) -> int

      Return the pid of a process opened via open_process or open_process_args.

      • since 4.12
      val process_full_pid : (in_channel * out_channel * in_channel) -> int

      Return the pid of a process opened via open_process_full or open_process_args_full.

      • since 4.12
      val close_process_in : in_channel -> process_status

      Close channels opened by open_process_in, wait for the associated command to terminate, and return its termination status.

      val close_process_out : out_channel -> process_status

      Close channels opened by open_process_out, wait for the associated command to terminate, and return its termination status.

      val close_process : (in_channel * out_channel) -> process_status

      Close channels opened by open_process, wait for the associated command to terminate, and return its termination status.

      val close_process_full : + in_channel * out_channel * in_channel

      Similar to open_process_args, but the third argument specifies the environment passed to the new process. The result is a triple of channels connected respectively to the standard output, standard input, and standard error of the program.

      • since 4.08
      val process_in_pid : in_channel -> int

      Return the pid of a process opened via open_process_args_in or the pid of the shell opened via open_process_in.

      • since 4.12
      val process_out_pid : out_channel -> int

      Return the pid of a process opened via open_process_args_out or the pid of the shell opened via open_process_out.

      • since 4.12
      val process_pid : (in_channel * out_channel) -> int

      Return the pid of a process opened via open_process_args or the pid of the shell opened via open_process_args.

      • since 4.12
      val process_full_pid : (in_channel * out_channel * in_channel) -> int

      Return the pid of a process opened via open_process_args_full or the pid of the shell opened via open_process_full.

      • since 4.12
      val close_process_in : in_channel -> process_status

      Close channels opened by open_process_in, wait for the associated command to terminate, and return its termination status.

      val close_process_out : out_channel -> process_status

      Close channels opened by open_process_out, wait for the associated command to terminate, and return its termination status.

      val close_process : (in_channel * out_channel) -> process_status

      Close channels opened by open_process, wait for the associated command to terminate, and return its termination status.

      val close_process_full : (in_channel * out_channel * in_channel) -> process_status

      Close channels opened by open_process_full, wait for the associated command to terminate, and return its termination status.

      symlink ?to_dir ~src ~dst creates the file dst as a symbolic link to the file src. On Windows, ~to_dir indicates if the symbolic link points to a directory or a file; if omitted, symlink examines src using stat and picks appropriately, if src does not exist then false is assumed (for this reason, it is recommended that the ~to_dir parameter be specified in new code). On Unix, ~to_dir is ignored.

      Windows symbolic links are available in Windows Vista onwards. There are some important differences between Windows symlinks and their POSIX counterparts.

      Windows symbolic links come in two flavours: directory and regular, which designate whether the symbolic link points to a directory or a file. The type must be correct - a directory symlink which actually points to a file cannot be selected with chdir and a file symlink which actually points to a directory cannot be read or written (note that Cygwin's emulation layer ignores this distinction).

      When symbolic links are created to existing targets, this distinction doesn't matter and symlink will automatically create the correct kind of symbolic link. The distinction matters when a symbolic link is created to a non-existent target.

      The other caveat is that by default symbolic links are a privileged operation. Administrators will always need to be running elevated (or with UAC disabled) and by default normal user accounts need to be granted the SeCreateSymbolicLinkPrivilege via Local Security Policy (secpol.msc) or via Active Directory.

      has_symlink can be used to check that a process is able to create symbolic links.

      Returns true if the user is able to create symbolic links. On Windows, this indicates that the user not only has the SeCreateSymbolicLinkPrivilege but is also running elevated, if necessary. On other platforms, this is simply indicates that the symlink system call is available.

      • since 4.03

      Read the contents of a symbolic link.

      Polling

      val select : read:file_descr list -> @@ -89,7 +110,7 @@ len:int -> mode:msg_flag list -> sockaddr -> - int

      Same as sendto, but take the data from a string instead of a byte sequence.

      • since 4.02

      Socket options

      type socket_bool_option = Unix.socket_bool_option =
      1. | SO_DEBUG
        (*

        Record debugging information

        *)
      2. | SO_BROADCAST
        (*

        Permit sending of broadcast messages

        *)
      3. | SO_REUSEADDR
        (*

        Allow reuse of local addresses for bind

        *)
      4. | SO_KEEPALIVE
        (*

        Keep connection active

        *)
      5. | SO_DONTROUTE
        (*

        Bypass the standard routing algorithms

        *)
      6. | SO_OOBINLINE
        (*

        Leave out-of-band data in line

        *)
      7. | SO_ACCEPTCONN
        (*

        Report whether socket listening is enabled

        *)
      8. | TCP_NODELAY
        (*

        Control the Nagle algorithm for TCP sockets

        *)
      9. | IPV6_ONLY
        (*

        Forbid binding an IPv6 socket to an IPv4 address

        *)
      10. | SO_REUSEPORT
        (*

        Allow reuse of address and port bindings

        *)

      The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

      type socket_int_option = Unix.socket_int_option =
      1. | SO_SNDBUF
        (*

        Size of send buffer

        *)
      2. | SO_RCVBUF
        (*

        Size of received buffer

        *)
      3. | SO_ERROR
        (*

        Deprecated. Use getsockopt_error instead.

        • deprecated Use Unix.getsockopt_error instead.
        *)
      4. | SO_TYPE
        (*

        Report the socket type

        *)
      5. | SO_RCVLOWAT
        (*

        Minimum number of bytes to process for input operations

        *)
      6. | SO_SNDLOWAT
        (*

        Minimum number of bytes to process for output operations

        *)

      The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

      type socket_optint_option = Unix.socket_optint_option =
      1. | SO_LINGER
        (*

        Whether to linger on closed connections that have data present, and for how long (in seconds)

        *)

      The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

      type socket_float_option = Unix.socket_float_option =
      1. | SO_RCVTIMEO
        (*

        Timeout for input operations

        *)
      2. | SO_SNDTIMEO
        (*

        Timeout for output operations

        *)

      The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

      val getsockopt : file_descr -> socket_bool_option -> bool

      Return the current status of a boolean-valued option in the given socket.

      val setsockopt : file_descr -> socket_bool_option -> bool -> unit

      Set or clear a boolean-valued option in the given socket.

      val getsockopt_int : file_descr -> socket_int_option -> int

      Same as getsockopt for an integer-valued socket option.

      val setsockopt_int : file_descr -> socket_int_option -> int -> unit

      Same as setsockopt for an integer-valued socket option.

      val getsockopt_optint : file_descr -> socket_optint_option -> int option

      Same as getsockopt for a socket option whose value is an int option.

      val setsockopt_optint : + int

      Same as sendto, but take the data from a string instead of a byte sequence.

      • since 4.02

      Socket options

      type socket_bool_option = Unix.socket_bool_option =
      1. | SO_DEBUG
        (*

        Record debugging information

        *)
      2. | SO_BROADCAST
        (*

        Permit sending of broadcast messages

        *)
      3. | SO_REUSEADDR
        (*

        Allow reuse of local addresses for bind

        *)
      4. | SO_KEEPALIVE
        (*

        Keep connection active

        *)
      5. | SO_DONTROUTE
        (*

        Bypass the standard routing algorithms

        *)
      6. | SO_OOBINLINE
        (*

        Leave out-of-band data in line

        *)
      7. | SO_ACCEPTCONN
        (*

        Report whether socket listening is enabled

        *)
      8. | TCP_NODELAY
        (*

        Control the Nagle algorithm for TCP sockets

        *)
      9. | IPV6_ONLY
        (*

        Forbid binding an IPv6 socket to an IPv4 address

        *)
      10. | SO_REUSEPORT
        (*

        Allow reuse of address and port bindings.

        • since 4.12.
        *)

      The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

      type socket_int_option = Unix.socket_int_option =
      1. | SO_SNDBUF
        (*

        Size of send buffer

        *)
      2. | SO_RCVBUF
        (*

        Size of received buffer

        *)
      3. | SO_ERROR
        (*

        Deprecated. Use getsockopt_error instead.

        • deprecated Use Unix.getsockopt_error instead.
        *)
      4. | SO_TYPE
        (*

        Report the socket type

        *)
      5. | SO_RCVLOWAT
        (*

        Minimum number of bytes to process for input operations

        *)
      6. | SO_SNDLOWAT
        (*

        Minimum number of bytes to process for output operations

        *)

      The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

      type socket_optint_option = Unix.socket_optint_option =
      1. | SO_LINGER
        (*

        Whether to linger on closed connections that have data present, and for how long (in seconds)

        *)

      The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

      type socket_float_option = Unix.socket_float_option =
      1. | SO_RCVTIMEO
        (*

        Timeout for input operations

        *)
      2. | SO_SNDTIMEO
        (*

        Timeout for output operations

        *)

      The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

      val getsockopt : file_descr -> socket_bool_option -> bool

      Return the current status of a boolean-valued option in the given socket.

      val setsockopt : file_descr -> socket_bool_option -> bool -> unit

      Set or clear a boolean-valued option in the given socket.

      val getsockopt_int : file_descr -> socket_int_option -> int

      Same as getsockopt for an integer-valued socket option.

      val setsockopt_int : file_descr -> socket_int_option -> int -> unit

      Same as setsockopt for an integer-valued socket option.

      val getsockopt_optint : file_descr -> socket_optint_option -> int option

      Same as getsockopt for a socket option whose value is an int option.

      val setsockopt_optint : file_descr -> socket_optint_option -> int option -> diff --git a/ocaml/Value_rec_check/index.html b/ocaml/Value_rec_check/index.html new file mode 100644 index 00000000..2865b5e3 --- /dev/null +++ b/ocaml/Value_rec_check/index.html @@ -0,0 +1,5 @@ + +Value_rec_check (ocaml.Value_rec_check)

      Module Value_rec_check

      val is_valid_recursive_expression : + Ident.t list -> + Typedtree.expression -> + Value_rec_types.recursive_binding_kind option
      val is_valid_class_expr : Ident.t list -> Typedtree.class_expr -> bool
      diff --git a/ocaml/Value_rec_compiler/index.html b/ocaml/Value_rec_compiler/index.html new file mode 100644 index 00000000..f2fdd8d3 --- /dev/null +++ b/ocaml/Value_rec_compiler/index.html @@ -0,0 +1,5 @@ + +Value_rec_compiler (ocaml.Value_rec_compiler)

      Module Value_rec_compiler

      diff --git a/ocaml/Value_rec_types/index.html b/ocaml/Value_rec_types/index.html new file mode 100644 index 00000000..7626dc70 --- /dev/null +++ b/ocaml/Value_rec_types/index.html @@ -0,0 +1,2 @@ + +Value_rec_types (ocaml.Value_rec_types)

      Module Value_rec_types

      Types related to the compilation of value let-recs (non-functional recursive definitions)

      type recursive_binding_kind =
      1. | Static
        (*

        Bindings for which some kind of pre-allocation scheme is possible. The expression is allowed to be recursive, as long as its definition does not inspect recursively defined values.

        *)
      2. | Dynamic
        (*

        Bindings for which pre-allocation is not possible. The expression is not allowed to refer to any recursive variable.

        *)

      The kind of recursive bindings, as computed by Value_rec_check.classify_expression

      diff --git a/ocaml/Warnings/index.html b/ocaml/Warnings/index.html index 0723ab58..71a59e67 100644 --- a/ocaml/Warnings/index.html +++ b/ocaml/Warnings/index.html @@ -1,2 +1,2 @@ -Warnings (ocaml.Warnings)

      Module Warnings

      Warning definitions

      Warning: this module is unstable and part of compiler-libs.

      type loc = {
      1. loc_start : Stdlib.Lexing.position;
      2. loc_end : Stdlib.Lexing.position;
      3. loc_ghost : bool;
      }
      val ghost_loc_in_file : string -> loc

      Return an empty ghost range located in a given file

      type field_usage_warning =
      1. | Unused
      2. | Not_read
      3. | Not_mutated
      type constructor_usage_warning =
      1. | Unused
      2. | Not_constructed
      3. | Only_exported_private
      type t =
      1. | Comment_start
      2. | Comment_not_end
      3. | Fragile_match of string
      4. | Ignored_partial_application
      5. | Labels_omitted of string list
      6. | Method_override of string list
      7. | Partial_match of string
      8. | Missing_record_field_pattern of string
      9. | Non_unit_statement
      10. | Redundant_case
      11. | Redundant_subpat
      12. | Instance_variable_override of string list
      13. | Illegal_backslash
      14. | Implicit_public_methods of string list
      15. | Unerasable_optional_argument
      16. | Undeclared_virtual_method of string
      17. | Not_principal of string
      18. | Non_principal_labels of string
      19. | Ignored_extra_argument
      20. | Nonreturning_statement
      21. | Preprocessor of string
      22. | Useless_record_with
      23. | Bad_module_name of string
      24. | All_clauses_guarded
      25. | Unused_var of string
      26. | Unused_var_strict of string
      27. | Wildcard_arg_to_constant_constr
      28. | Eol_in_string
      29. | Duplicate_definitions of string * string * string * string
      30. | Unused_value_declaration of string
      31. | Unused_open of string
      32. | Unused_type_declaration of string
      33. | Unused_for_index of string
      34. | Unused_ancestor of string
      35. | Unused_constructor of string * constructor_usage_warning
      36. | Unused_extension of string * bool * constructor_usage_warning
      37. | Unused_rec_flag
      38. | Name_out_of_scope of string * string list * bool
      39. | Ambiguous_name of string list * string list * bool * string
      40. | Disambiguated_name of string
      41. | Nonoptional_label of string
      42. | Open_shadow_identifier of string * string
      43. | Open_shadow_label_constructor of string * string
      44. | Bad_env_variable of string * string
      45. | Attribute_payload of string * string
      46. | Eliminated_optional_arguments of string list
      47. | No_cmi_file of string * string option
      48. | Unexpected_docstring of bool
      49. | Wrong_tailcall_expectation of bool
      50. | Fragile_literal_pattern
      51. | Misplaced_attribute of string
      52. | Duplicated_attribute of string
      53. | Inlining_impossible of string
      54. | Unreachable_case
      55. | Ambiguous_var_in_pattern_guard of string list
      56. | No_cmx_file of string
      57. | Flambda_assignment_to_non_mutable_value
      58. | Unused_module of string
      59. | Unboxable_type_in_prim_decl of string
      60. | Constraint_on_gadt
      61. | Erroneous_printed_signature of string
      62. | Unsafe_array_syntax_without_parsing
      63. | Redefining_unit of string
      64. | Unused_open_bang of string
      65. | Unused_functor_parameter of string
      66. | Match_on_mutable_state_prevent_uncurry
      67. | Unused_field of string * field_usage_warning
      68. | Missing_mli
      69. | Unused_tmc_attribute
      70. | Tmc_breaks_tailcall
      71. | Generative_application_expects_unit
      type alert = {
      1. kind : string;
      2. message : string;
      3. def : loc;
      4. use : loc;
      }
      val parse_options : bool -> string -> alert option
      val parse_alert_option : string -> unit

      Disable/enable alerts based on the parameter to the -alert command-line option. Raises Arg.Bad if the string is not a valid specification.

      val without_warnings : (unit -> 'a) -> 'a

      Run the thunk with all warnings and alerts disabled.

      val is_active : t -> bool
      val is_error : t -> bool
      val defaults_w : string
      val defaults_warn_error : string
      type reporting_information = {
      1. id : string;
      2. message : string;
      3. is_error : bool;
      4. sub_locs : (loc * string) list;
      }
      val report : t -> [ `Active of reporting_information | `Inactive ]
      val report_alert : alert -> [ `Active of reporting_information | `Inactive ]
      exception Errors
      val check_fatal : unit -> unit
      val reset_fatal : unit -> unit
      val help_warnings : unit -> unit
      type state
      val backup : unit -> state
      val restore : state -> unit
      val with_state : state -> (unit -> 'a) -> 'a
      val mk_lazy : (unit -> 'a) -> 'a Stdlib.Lazy.t

      Like Lazy.of_fun, but the function is applied with the warning/alert settings at the time mk_lazy is called.

      type description = {
      1. number : int;
      2. names : string list;
      3. description : string;
      4. since : Stdlib.Sys.ocaml_release_info option;
      }
      val descriptions : description list
      +Warnings (ocaml.Warnings)

      Module Warnings

      Warning definitions

      Warning: this module is unstable and part of compiler-libs.

      type loc = {
      1. loc_start : Stdlib.Lexing.position;
      2. loc_end : Stdlib.Lexing.position;
      3. loc_ghost : bool;
      }
      val ghost_loc_in_file : string -> loc

      Return an empty ghost range located in a given file

      type field_usage_warning =
      1. | Unused
      2. | Not_read
      3. | Not_mutated
      type constructor_usage_warning =
      1. | Unused
      2. | Not_constructed
      3. | Only_exported_private
      type t =
      1. | Comment_start
      2. | Comment_not_end
      3. | Fragile_match of string
      4. | Ignored_partial_application
      5. | Labels_omitted of string list
      6. | Method_override of string list
      7. | Partial_match of string
      8. | Missing_record_field_pattern of string
      9. | Non_unit_statement
      10. | Redundant_case
      11. | Redundant_subpat
      12. | Instance_variable_override of string list
      13. | Illegal_backslash
      14. | Implicit_public_methods of string list
      15. | Unerasable_optional_argument
      16. | Undeclared_virtual_method of string
      17. | Not_principal of Format_doc.t
      18. | Non_principal_labels of string
      19. | Ignored_extra_argument
      20. | Nonreturning_statement
      21. | Preprocessor of string
      22. | Useless_record_with
      23. | Bad_module_name of string
      24. | All_clauses_guarded
      25. | Unused_var of string
      26. | Unused_var_strict of string
      27. | Wildcard_arg_to_constant_constr
      28. | Eol_in_string
      29. | Duplicate_definitions of string * string * string * string
      30. | Unused_value_declaration of string
      31. | Unused_open of string
      32. | Unused_type_declaration of string
      33. | Unused_for_index of string
      34. | Unused_ancestor of string
      35. | Unused_constructor of string * constructor_usage_warning
      36. | Unused_extension of string * bool * constructor_usage_warning
      37. | Unused_rec_flag
      38. | Name_out_of_scope of string * string list * bool
      39. | Ambiguous_name of string list * string list * bool * string
      40. | Disambiguated_name of string
      41. | Nonoptional_label of string
      42. | Open_shadow_identifier of string * string
      43. | Open_shadow_label_constructor of string * string
      44. | Bad_env_variable of string * string
      45. | Attribute_payload of string * string
      46. | Eliminated_optional_arguments of string list
      47. | No_cmi_file of string * string option
      48. | Unexpected_docstring of bool
      49. | Wrong_tailcall_expectation of bool
      50. | Fragile_literal_pattern
      51. | Misplaced_attribute of string
      52. | Duplicated_attribute of string
      53. | Inlining_impossible of string
      54. | Unreachable_case
      55. | Ambiguous_var_in_pattern_guard of string list
      56. | No_cmx_file of string
      57. | Flambda_assignment_to_non_mutable_value
      58. | Unused_module of string
      59. | Unboxable_type_in_prim_decl of string
      60. | Constraint_on_gadt
      61. | Erroneous_printed_signature of string
      62. | Unsafe_array_syntax_without_parsing
      63. | Redefining_unit of string
      64. | Unused_open_bang of string
      65. | Unused_functor_parameter of string
      66. | Match_on_mutable_state_prevent_uncurry
      67. | Unused_field of string * field_usage_warning
      68. | Missing_mli
      69. | Unused_tmc_attribute
      70. | Tmc_breaks_tailcall
      71. | Generative_application_expects_unit
      72. | Degraded_to_partial_match
      type alert = {
      1. kind : string;
      2. message : string;
      3. def : loc;
      4. use : loc;
      }
      val parse_options : bool -> string -> alert option
      val parse_alert_option : string -> unit

      Disable/enable alerts based on the parameter to the -alert command-line option. Raises Arg.Bad if the string is not a valid specification.

      val without_warnings : (unit -> 'a) -> 'a

      Run the thunk with all warnings and alerts disabled.

      val is_active : t -> bool
      val is_error : t -> bool
      val defaults_w : string
      val defaults_warn_error : string
      type reporting_information = {
      1. id : string;
      2. message : string;
      3. is_error : bool;
      4. sub_locs : (loc * string) list;
      }
      val report : t -> [ `Active of reporting_information | `Inactive ]
      val report_alert : alert -> [ `Active of reporting_information | `Inactive ]
      exception Errors
      val check_fatal : unit -> unit
      val reset_fatal : unit -> unit
      val help_warnings : unit -> unit
      type state
      val backup : unit -> state
      val restore : state -> unit
      val with_state : state -> (unit -> 'a) -> 'a
      val mk_lazy : (unit -> 'a) -> 'a Stdlib.Lazy.t

      Like Lazy.of_fun, but the function is applied with the warning/alert settings at the time mk_lazy is called.

      type description = {
      1. number : int;
      2. names : string list;
      3. description : string;
      4. since : Stdlib.Sys.ocaml_release_info option;
      }
      val descriptions : description list
      diff --git a/ocaml/X86_proc/index.html b/ocaml/X86_proc/index.html index c40bff46..909a9600 100644 --- a/ocaml/X86_proc/index.html +++ b/ocaml/X86_proc/index.html @@ -1,5 +1,5 @@ -X86_proc (ocaml.X86_proc)

      Module X86_proc

      Definitions shared between the 32 and 64 bit Intel backends.

      Helpers for textual emitters

      val string_of_reg8l : X86_ast.reg64 -> string
      val string_of_reg8h : X86_ast.reg8h -> string
      val string_of_reg16 : X86_ast.reg64 -> string
      val string_of_reg32 : X86_ast.reg64 -> string
      val string_of_reg64 : X86_ast.reg64 -> string
      val string_of_registerf : X86_ast.registerf -> string
      val string_of_string_literal : string -> string
      val string_of_condition : X86_ast.condition -> string
      val string_of_float_condition : X86_ast.float_condition -> string
      val string_of_symbol : string -> string -> string
      val string_of_rounding : X86_ast.rounding -> string
      val buf_bytes_directive : Stdlib.Buffer.t -> string -> string -> unit

      Buffer of assembly code

      val emit : X86_ast.instruction -> unit
      val directive : X86_ast.asm_line -> unit
      val reset_asm_code : unit -> unit

      Code emission

      val generate_code : (X86_ast.asm_line list -> unit) option -> unit

      Post-process the stream of instructions. Dump it (using the provided syntax emitter) in a file (if provided) and compile it with an internal assembler (if registered through register_internal_assembler).

      val assemble_file : string -> string -> int

      Generate an object file corresponding to the last call to generate_code. An internal assembler is used if available (and the input file is ignored). Otherwise, the source asm file with an external assembler.

      System detection

      type system =
      1. | S_macosx
      2. | S_gnu
      3. | S_cygwin
      4. | S_solaris
      5. | S_win32
      6. | S_linux_elf
      7. | S_bsd_elf
      8. | S_beos
      9. | S_mingw
      10. | S_win64
      11. | S_linux
      12. | S_mingw64
      13. | S_freebsd
      14. | S_netbsd
      15. | S_openbsd
      16. | S_unknown
      val system : system
      val masm : bool
      val windows : bool
      val use_plt : bool

      Whether calls need to go via the PLT.

      Support for plumbing a binary code emitter

      val register_internal_assembler : +X86_proc (ocaml.X86_proc)

      Module X86_proc

      Definitions shared between the 32 and 64 bit Intel backends.

      Helpers for textual emitters

      val string_of_reg8l : X86_ast.reg64 -> string
      val string_of_reg8h : X86_ast.reg8h -> string
      val string_of_reg16 : X86_ast.reg64 -> string
      val string_of_reg32 : X86_ast.reg64 -> string
      val string_of_reg64 : X86_ast.reg64 -> string
      val string_of_registerf : X86_ast.registerf -> string
      val string_of_string_literal : string -> string
      val string_of_condition : X86_ast.condition -> string
      val string_of_float_condition : X86_ast.float_condition -> string
      val string_of_symbol : string -> string -> string
      val string_of_rounding : X86_ast.rounding -> string
      val buf_bytes_directive : Stdlib.Buffer.t -> string -> string -> unit

      Buffer of assembly code

      val emit : X86_ast.instruction -> unit
      val directive : X86_ast.asm_line -> unit
      val reset_asm_code : unit -> unit

      Code emission

      val generate_code : (X86_ast.asm_line list -> unit) option -> unit

      Post-process the stream of instructions. Dump it (using the provided syntax emitter) in a file (if provided) and compile it with an internal assembler (if registered through register_internal_assembler).

      val assemble_file : string -> string -> int

      Generate an object file corresponding to the last call to generate_code. An internal assembler is used if available (and the input file is ignored). Otherwise, the source asm file with an external assembler.

      System detection

      type system =
      1. | S_macosx
      2. | S_gnu
      3. | S_cygwin
      4. | S_solaris
      5. | S_beos
      6. | S_win64
      7. | S_linux
      8. | S_mingw64
      9. | S_freebsd
      10. | S_netbsd
      11. | S_openbsd
      12. | S_unknown
      val system : system
      val masm : bool
      val windows : bool
      val use_plt : bool

      Whether calls need to go via the PLT.

      Support for plumbing a binary code emitter

      val register_internal_assembler : (X86_ast.asm_program -> string -> unit) -> unit
      val with_internal_assembler : (X86_ast.asm_program -> string -> unit) -> diff --git a/ocaml/_doc-dir/Changes b/ocaml/_doc-dir/Changes index 61509659..971216bb 100644 --- a/ocaml/_doc-dir/Changes +++ b/ocaml/_doc-dir/Changes @@ -1,3 +1,1590 @@ +OCaml 5.3.0 (8 January 2025) +---------------------------- + +(Changes that can break existing programs are marked with a "*") + +### Restored backend: + +- #12954: Restore the MSVC port + (David Allsopp, Antonin Décimo, Samuel Hym, and Miod Vallat, review by Nicolás + Ojeda Bär) + +- #13093: Allow building the MSVC port with clang-cl. + (Antonin Décimo, review by Nicolás Ojeda Bär, Samuel Hym, + David Allsopp and Sébastien Hinderer) + +### Language features: + +- #12828, #13283: Add short syntax for dependent functor types `(X:A) -> ...` + (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer) + +- #12309, #13158: Add syntax support for deep effect handlers + (Leo White, Tom Kelly, Anil Madhavapeddy, KC Sivaramakrishnan, Xavier Leroy + and Florian Angeletti, review by the same, Hugo Heuzard, and Ulysse Gérard) + +- #11736, #12664, #13628: Support utf-8 encoded source files and latin-9 + compatible identifiers. + (Xavier Leroy and Florian Angeletti, review by Daniel Bünzli and + Jules Aguillon) + +### Type system + +- #11891, #12507: Allow to name new locally abstract types in constructor type + annotations. + (Jacques Garrigue, report and review by Gabriel Scherer and Florian Angeletti) + +### Runtime system: + +- #13419: Fix memory bugs in runtime events system. + (B. Szilvasy and Nick Barnes, review by Miod Vallat, Nick Barnes, + Tim McGilchrist, and Gabriel Scherer) + +- #13364: Emit major slice counters in the runtime events. + (KC Sivaramakrishnan and Sadiq Jaffer, review by Gabriel Scherer) + +- #13382: Add more documentation for Runtime_events types + (Sadiq Jaffer, review by Tim McGilchrist, Miod Vallat and KC Sivaramakrishnan) + +- #13370: Fix a low-probability crash when calling Gc.counters. + (Demi Marie Obenour, review by Gabriel Scherer) + +- #13272: Allow maximum number of domains to be specified as a OCAMLRUNPARAM + parameter. + (KC Sivaramakrishnan, review by Guillaume Munch-Maccagnoni, Miod Vallat, + Gabriel Scherer, David Allsopp, request by Zachary Yedidia). + +- #11911, #12923: Multicore statistical memory profiling. + This restores a notable OCaml 4 feature that was missing + in OCaml 5. + (Nick Barnes, review by Stephen Dolan, Jacques-Henri Jourdan + and Guillaume Munch-Maccagnoni). + +- #12579: OS-based Synchronisation for Stop-the-World Sections + (B. Szilvasy, review by Miod Vallat, Nick Barnes, Olivier Nicole, + Gabriel Scherer and Damien Doligez) + +- #12789: Restore caml_unregister_frametable from OCaml 4 + (Frédéric Recoules, review by Gabriel Scherer) + +- #13003: new, more consistent names for array-creation C functions + (Gabriel Scherer, review by Olivier Nicole) + +- #13013: introduce a `caml_result` type to supersede the + use of 'encoded exception values' in the FFI. + (Gabriel Scherer, review by Damien Doligez, + Guillaume Munch-Maccagnoni and Xavier Leroy, + suggested by Guillaume Munch-Maccagnoni) + +- #12407, #13226: Resource-handling improvements: add + exception-returning variants for all exception-raising functions in + `caml/fail.h`, for the purpose of cleaning-up state and resources + before raising. + (Guillaume Munch-Maccagnoni, review by Damien Doligez, Xavier Leroy + and Gabriel Scherer) + +- #13086: Avoid spurious major GC slices. + (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer + and Stephen Dolan) + +- #11779, #13117: Improve logic for fiber stack alignment. + (Miod Vallat, report by Damien Doligez, review by Gabriel Scherer) + +- #12839: Remove ATOMIC_UINTNAT_INIT from camlatomic.h (as part of a larger + cleanup of camlatomic.h) + (David Allsopp, review by Antonin Décimo, Sébastien Hinderer, Samuel Hym, + Guillaume Munch-Maccagnoni and Miod Vallat) + +- #13163: Enable frame pointers on macOS x86_64 + (Tim McGilchrist, review by Sébastien Hinderer and Fabrice Buoro) + +- #12951: Constify constructors and flags tables in C code (take 2). + Now these tables will go in the readonly segment, where they belong. + (Antonin Décimo, review by David Allsopp) + +- #10696: Introduce __has_attribute and __has_c_attributes in + to test the support of specific atributes in C + code. Introduce fallthrough as a wrapper around the fallthrough + attribute. + (Antonin Décimo, review by Nicolás Ojeda Bär, Xavier Leroy, and + Gabriel Scherer) + +- #13083: Use macros from limits.h to avoid signed-integer wrap-around. + Introduce CAML_{U,}INTNAT_{MIN,MAX} macros to expose {u,}intnat limits. + (Antonin Décimo, review by Nick Barnes, Xavier Leroy, Gabriel Scherer, + and Miod Vallat) + +- #13239: Check whether the compiler supports the labels as values + extension to enable threaded code interpretation. + (Antonin Décimo, review by Miod Vallat) + +- #13238: Enable software prefetching on x86 and x86_64 when building + with MSVC or clang-cl. + (Antonin Décimo, review by Miod Vallat) + +- #13241, #13261, #13271: Add CFI_SIGNAL_FRAME to ARM64 and RiscV runtimes, + for the purpose of displaying backtraces correctly in GDB. + (Tim McGilchrist, review by Miod Vallat, Gabriel Scherer and + KC Sivaramakrishnan) + +- #13139: Simplify CAMLalign to always use C23/C++11 alignas or C11 + _Alignas. Ensures that stat data is always aligned to the best + boundary. + (Antonin Décimo, review by Miod Vallat and Xavier Leroy) + +- #13280: Check for support of compiler attributes. Allows using + compiler attributes with clang-cl. + (Antonin Décimo, review by Miod Vallat) + +- #13243: Enable C compiler warnings internally when building with + clang-cl or MSVC. Provide fixes too. + (Antonin Décimo, review by Miod Vallat and Xavier Leroy) + +- #13242: Define and use unreachable and trap annotation, and clean-up some + runtime assertions. + (Antonin Décimo, review by Miod Vallat, Gabriel Scherer, and David Allsopp) + +- #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks + so that it no longer produces dangling registered bytecode fragments. + (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, + review by Miod Vallat) + +- #13407: Add Runtime_events.EV_EMPTY_MINOR + (Thomas Leonard) + +- #13522: Confirm runtime events ring is still active after callback. + (KC Sivaramakrishnan, review by Sadiq Jaffer and Miod Vallat) + +- #13529: Do not write to event ring after going out of stw participant set. + (KC Sivaramakrishnan, review by Sadiq Jaffer) + +### Code generation and optimizations: + +- #13014: Enable compile-time option -function-sections on all previously + unsupported native backends (POWER, riscv64 and s390x) + (Miod Vallat, review by Nicolás Ojeda Bär) + +- #7241, #12555, #13076, #13138, #13338, #13152, #13153, #13154: + fix a soundness bug in the pattern-matching compiler + when side-effects mutate the scrutinee during matching. + (Gabriel Scherer, review by Nick Roberts) + +- #13341: a warning when the pattern-matching compiler pessimizes code + because side-effects may mutate the scrutinee during + matching. (This warning is disabled by default, as this rarely + happens and its performance impact is typically not noticeable.) + (Gabriel Scherer, review by Nick Roberts, Florian Angeletti + and David Allsopp) + +- #13179: Fix evaluation of toplevel lets in classes containing + local opens + (Vincent Laviron, review by Hugo Heuzard, Nathanaëlle Courant + and Gabriel Scherer) + +- #13543: Remove some String-Bytes conversion from the stdlib to behave better + with js_of_ocaml + (Hugo Heuzard, review by Gabriel Scherer) + +### Standard library: + +- #12884: Add `Queue.drop` + (Léo Andrès, review by Nicolás Ojeda Bär and Gabriel Scherer) + +- #13168: In Array.shuffle, clarify the code that validates the + result of the user-supplied function `rand`, and improve the + error message that is produced when this result is invalid. + (François Pottier, review by Florian Angeletti, Daniel Bünzli + and Gabriel Scherer) + +- #12133: Expose support for printing substrings in Format + (Florian Angeletti, review by Daniel Bünzli, Gabriel Scherer + and Nicolás Ojeda Bär) + +- #12869: Add List.take, List.drop, List.take_while and List.drop_while + (Kate Deplaix and Oscar Butler-Aldridge, review by Nicolás Ojeda Bär, + Craig Ferguson and Gabriel Scherer) + +- #12885: move Dynarray to an unboxed representation + (Gabriel Scherer, suggestions by Vincent Laviron, + review by Olivier Nicole and Simon Cruanes, Yann Leray, Alain Frisch) + +- #13047: Add Sys.poll_actions to (only) run pending runtime actions. + (Nick Barnes, review by Gabriel Scherer, Guillaume Munch-Maccagnoni, and + Vincent Laviron) + +- #13144: Dynarray.{equal, compare} + (Gabriel Scherer, + review by Jeremy Yallop, Daniel Bünzli and Olivier Nicole, + request by Olivier Nicole) + +- #13171: expose `Domain.self_index : unit -> int` (a somewhat-dense + indexing of currently-running domains) for advanced use-cases of + domain-indexed concurrent data structures. + (Gabriel Scherer, + review by KC Sivaramakrishnan, Miod Vallat and Nicolás Ojeda Bär, + report by Vesa Karvonen) + +- #13197: Dynarray.blit, which allows to extend the destination + dynarray (0 <= dst_pos <= dst_length). + (Gabriel Scherer, report by Hazem Elmasry, + review by Olivier Nicole, Hazem Elmasry and Nicolás Ojeda Bär) + +* #13240: Add Uchar.seeded_hash, Change Uchar.hash implementation. + Previously, Uchar.hash was aliased to Uchar.to_int. If you need that behavior, + change your module instantiation from eg `module HT = Hashtbl.Make(Uchar)` to + ``` + module HT = Hashtbl.Make(struct + ... + let hash = Uchar.to_int + end) + ``` + If the current implementation is desired, and you have a hashtable module `HT` + (produced with the `Make` functor) in persistent storage, use `HT.rebuild` to + ensure it doesn't break when reading from or writing to buckets. + (Hazem ElMasry, review by Gabriel Scherer and Nicolás Ojeda Bär) + +- #13318: Fix regression in GC alarms, and fix them for flambda. + (Guillaume Munch-Maccagnoni, report by Benjamin Monate, review by + Vincent Laviron and Gabriel Scherer) + +- #13296: Add mem, memq, find_opt, find_index, find_map and find_mapi + to Dynarray. + (Jake H, review by Gabriel Scherer and Florian Angeletti) + +### Other libraries: + +- #11996: release the dependency of dynlink on compilerlibs. + (Sébastien Hinderer and Stephen Dolan, review by Damien Doligez and + Hugo Heuzard) + +- #13326: Implement Unix.O_APPEND on windows. + (Romain Beauxis, review by Miod Vallat, Gabriel Scherer and Antonin Décimo) + +### Tools: + +- #11716: ocamllex: mismatched parentheses and curly brackets are now caught + by ocamllex, instead of causing invalid OCaml code to be generated. + (Demi Marie Obenour, review by Damien Doligez and Xavier Leroy) + +- #12904: Run the testsuite with ThreadSanitizer on a PR when label + `run-thread-sanitizer` is added + (Olivier Nicole, suggested by Sébastien Hinderer and David Allsopp, review by + Gabriel Scherer) + +* #13114: Support ocamldebug remote debugging over IPv6 on all + platforms, and over Unix domain sockets on Windows. + (Antonin Décimo, review by Gabriel Scherer and Miod Vallat) + +- #13136: Rewrite GDB extensions and macros in debugger-agnostic Python, and add + LLDB support for them. + (Nick Barnes, review by Tim McGilchrist and Gabriel Scherer) + +### Toplevel: + +- #12891: Improved styling for initial prompt + (Florian Angeletti, review by Gabriel Scherer) + +- #13053: Improved display of builtin types such as `_ list` when aliased. + (Samuel Vivien, review by Florian Angeletti) + +### Manual and documentation: + +- #13370: Document that that temporary variables holding GCd pointers must + not be live across a GC. + (Demi Marie Obenour) + +- #12298: Manual: emphasize that Bigarray.int refers to an OCaml integer, + which does not match the C int type. + (Edwin Török, review by Florian Angeletti) + +- #12868: Manual: simplify style colours of the post-processed manual and API + HTML pages, and fix the search button icon + (Yawar Amin, review by Simon Grondin, Gabriel Scherer, and Florian Angeletti) + +- #12949: document OCaml release cycles and version strings in + `release-info/introduction.md`. + (Florian Angeletti, review by Fabrice Buoro, Kate Deplaix, Damien Doligez, and + Gabriel Scherer) + +- #12976: Manual: use webman//*.html and + webman//api/ for OCaml.org HTML manual generation + (Shakthi Kannan, review by Hannes Mehnert, and Florian Angeletti) + +- #13045: Emphasize caution about behaviour of custom block finalizers. + (Nick Barnes) + +- #13216: document the new `caml_result` type in the FFI chapter of the manual. + (Gabriel Scherer, review by Miod Vallat, Daniel Bünzli, Nick Barnes, + Guillaume Munch-Maccagnoni and Antonin Décimo) + +- #13287: stdlib/sys.mli: Update documentation on Sys.opaque_identity + following #9412. + (Matt Walker, review by Guillaume Munch-Maccagnoni and Vincent Laviron) + +- #13295: Use syntax for deep effect handlers in the effect handlers manual + page. + (KC Sivaramakrishnan, review by Anil Madhavapeddy, Florian Angeletti and Miod + Vallat) + +- #13424: Fix `Gc.quick_stat` documentation to clarify that returned fields + `live_words`, `live_blocks`, `free_words`, and `fragments` are not zero. + (Jan Midtgaard, review by Damien Doligez and KC Sivaramakrishnan) + +- #13440: Update documentation of `Gc.{control,get,set}` to reflect fields + not currently supported on OCaml 5. + (Jan Midtgaard, review by Gabriel Scherer) + +- #13469, #13474, #13535: Document that [Hashtbl.create n] creates a hash table + with a default minimal size, even if [n] is very small or negative. + (Antonin Décimo, Nick Bares, report by Nikolaus Huber and Jan Midtgaard, + review by Florian Angeletti, Anil Madhavapeddy, Gabriel Scherer, + and Miod Vallat) + +- #13666: Rewrite parts of the example code around nested lists in Chapter 6 + (Polymorphism and its limitations -> Polymorphic recursion) giving the + "depth" function [in the non-polymorphically-recursive part of the example] + a much more sensible behavior; also fix a typo and some formatting. + (Frank Steffahn, review by Florian Angeletti) + +- #13668: Document the basic support for unicode identifiers and the switch to + UTF-8 encoded Unicode text for OCaml source file + (Florian Angeletti, review by Nicolás Ojeda Bär and Daniel Bünzli) + +### Compiler user-interface and warnings: + +* #12084, #13669, #13673: Check link order when creating archive and when using + ocamlopt. + (Hugo Heuzard, review by Stefan Muenzel and Sébastien Hinderer) + +- #12980: Explain type mismatch involving first-class modules by including + the module level error message + (Florian Angeletti, review by Vincent Laviron) + +- #12985, #12988: Better error messages for partially applied functors. + (Florian Angeletti, report by Arthur Wendling, review by Gabriel Scherer) + +- #13034, #13260: Better error messages for mismatched function labels + (Florian Angeletti, report by Daniel Bünzli, review by Gabriel Scherer and + Samuel Vivien) + +- #13051: Add a "Syntax error" to error messages for invalid package signatures. + (Samuel Vivien, review by Gabriel Scherer) + +- #13099: Fix erroneous loading of cmis for some module type errors. + (Nick Roberts, review by Florian Angeletti) + +- #13151, name conflicts explanation as a footnote + (Florian Angeletti, review by Gabriel Scherer) + +- #13228: Re-export Cmt2annot.{iterator,binary_part} which had become hidden + since #11288 and broke ocamlbrowser. + (David Allsopp, report by Jacques Garrigue, review by Sébastien Hinderer) + +- #13251: Register printer for errors in Emitaux + (Vincent Laviron, review by Miod Vallat and Florian Angeletti) + +- #13255: Re-enable warning 34 for unused locally abstract types + (Nick Roberts, review by Chris Casinghino and Florian Angeletti) + +- #12182: Improve the type clash error message. + For example, this message: + This expression has type ... + is changed into: + The constant "42" has type ... + (Jules Aguillon, review by Gabriel Scherer and Florian Angeletti) + +- #13471: add `-keywords ` flag to define the list of keywords + recognized by the lexer, for instance `-keywords 5.2` disable the `effect` + keyword. + (Florian Angeletti, review by Gabriel Scherer) + +### Internal/compiler-libs changes: + +- #11129, #11148: enforce that ppxs do not produce `parsetree`s with + an empty list of universally quantified type variables + (`. int -> int` instead of `'a . int -> int'`) + (Florian Angeletti, report by Simmo Saan, review by Gabriel Scherer) + +- #12534: document and refactor Matching.mk_failaction_pos + (Gabriel Scherer, review by Vincent Laviron and Nick Roberts) + +- #13076: change the handling of Match_failure exits in the pattern-matching + compiler, to prepare for a complete fix for #7241 + (Gabriel Scherer, review by Thomas Refis and Nick Roberts) + +- #12896: Simplify the compilation of custom bytecode runtimes by explicitly + compiling the primitives file before calling the linker. Tidy-up both the + generating code and the output itself for C code being generated by the + bytecode linker in `-custom` and `-output-*` modes. + (David Allsopp, Antonin Décimo and Samuel Hym, review by Vincent Laviron) + +- #12932: Remove useless code in Typecore.type_label_exp (was a fix for #4862) + (Jacques Garrigue, review by Gabriel Scherer) + +- #12943: Make transient_expr.scope a bitfield, and use it to store marks. + Marks are automatically allocated, and removed when leaving their scope. + Falls back to using TransientTypeSet when marks are exhausted. + (Jacques Garrigue and Takafumi Saikawa, review by Basile Clément) + +- #12946: Make generalization automatic when leaving scope. + As a result, the `Ctype.generalize*` and `Ctype.correct_levels` functions + were removed. The latter is now called `Ctype.duplicate_type`. + (Jacques Garrigue and Takafumi Saikawa, review by Richard Eisenberg) + +- #12968: Attach location to constants in the parsetree + (Jules Aguillon, review by Gabriel Scherer) + +- #12959, #13055: Avoid an internal error on recursive module type inconsistency + (Florian Angeletti, review by Jacques Garrigue and Gabriel Scherer) + +- #13049: graphical debugging printer for types + (Florian Angeletti, review by Gabriel Scherer) + +- #13074, #13082, #13084: refactoring in the pattern-matching compiler + (Gabriel Scherer, review by Thomas Refis, Vincent Laviron and Nick Roberts) + +- #13067: rework volatile memory access rules under TSan to consider properly + aligned smaller-than-register read operations as atomic, which gets rid of + false positives on s390x + (Miod Vallat, review by Fabien Buoro) + +- #13162: Use quoted strings to clarify code being generated. + (Antonin Décimo, review by Miod Vallat and Gabriel Scherer) + +- #13015: Emit floating-point literals in .rodata section on ELF arm64 + platforms (Linux, *BSD). + (Miod Vallat, review by Nicolás Ojeda Bär) + +- #13169, #13311: Introduce a document data type for compiler messages + rather than relying on `Format.formatter -> unit` closures. + (Florian Angeletti, review by Gabriel Scherer) + +- #13193: Remove the unused env_init field from class blocks + (Vincent Laviron, review by Jacques Garrigue) + +- #13257: integrate MetaOCaml in the Menhir grammar to ease MetaOCaml + maintenance. This is a purely internal change: there is no support + in the lexer, so no change to the surface OCaml grammar. + (Oleg Kiselyov, Gabriel Scherer and Florian Angeletti, + review by Jeremy Yallop) + +- #13286: Distinguish unique identifiers `Shape.Uid.t` according to their + provenance: either an implementation or an interface. + (Ulysse Gérard, review by Florian Angeletti and Leo White) + +- #13289: Use C99 for loop to reduce the scope of the for loop iterator. + (Antonin Décimo, review by Miod Vallat and Gabriel Scherer) + +- #13308: keep track of relations between declaration in the cmt files. This is + useful information for external tools for navigation and analysis purposis. + (Ulysse Gérard, Florian Angeletti, review by Florian Angeletti and Gabriel + Scherer) + +- #13336: compiler-libs, split the `Printtyp` in three to only keep + "user-friendly" functions in the `Printtyp` module. + (Florian Angeletti, review by Gabriel Scherer) + +- #13361: split runtime/array.c functions to consistently expose + uniform_array and floatarray versions, use floatarray versions + in Float.Array. + (Gabriel Scherer, review by Nicolás Ojeda Bär) + +- #13507: A small refactoring to [free_vars] to make it a bit faster + by not allocating a list when the list is not necessary. + (Richard Eisenberg, review by Jacques Garrigue) + +### Build system: + +- #12909: Reorganise how MKEXE_VIA_CC is built to make it correct for MSVC by + grouping all the linker flags at the end of the C compiler commandline + (David Allsopp and Samuel Hym, review by Nicolás Ojeda Bär) + +- #12992, #13009: Check that flexlink can be executed only when building in a + native windows environment. + (Romain Beauxis, review by David Allsopp and Sébastien Hinderer) + +- #12996: Only link with -lgcc_eh when available. + (Romain Beauxis, review by David Allsopp and Miod Vallat) + +* #13200: Do not use CFLAGS for linking. + (Sébastien Hinderer, review by Gabriel Scherer, Antonin Décimo, + Miod Vallat and Samuel Hym) + +- #13201, #13244: Fix and speedup builds with TSan. + (Sébastien Hinderer, review by Miod Vallat, Gabriel Scherer and + Olivier Nicole) + +* #12578, #12589, #13322, #13519: Use configured CFLAGS and CPPFLAGS *only* + during the build of the compiler itself. Do not use them when + compiling third-party C sources through the compiler. Flags for + compiling third-party C sources can still be specified at configure + time in the COMPILER_{BYTECODE,NATIVE}_{CFLAGS,CPPFLAGS} + configuration variables. + (Sébastien Hinderer, report by William Hu, review by David Allsopp) + +- #13285: continue the merge of the sub-makefiles into the root + Makefile started with #11243, #11248, #11268, #11420, #11675, + #12198, #12321, #12586, #12616, #12706 and #13048. + (Sébastien Hinderer, review by David Allsopp and Florian Angeletti) + +### Bug fixes: + +- #12854: Add a test in the regression suite that flags the bug #12825. + (Luc Maranget) + +- #12888: fix printing of uncaught exceptions in `.cmo` files passed on the + command-line of the toplevel. + (Nicolás Ojeda Bär, review by Florian Angeletti, report by Daniel Bünzli) + +- #12910, #12920: Fix an unsound interaction between first-class modules + and polymorphic records by saving and restoring univar_pairs. + (Stephen Dolan, review by Gabriel Scherer, report by Jeremy Yallop) + +- #12994: Remove un-used and unsafe caml_drop_continuation + (Tim McGilchrist, reviewed by Gabriel Scherer and Miod Vallat) + +- #12963: Restore caml_runtime_parameters implementation. This primitive allows + programs to query the runtime parameters supplied to an OCaml program. + Implementation missing since OCaml 5.0. + (Tim McGilchrist, reviewed by David Allsopp and Miod Vallat) + +- #13012: parsing: Fix dropped attributes after a '-' or '+' + The syntax '-(1 [@foo])' was incorrectly parsed as '-1'. + (Jules Aguillon, reviewed by Gabriel Scherer, report by Gabriel Scherer) + +* #13070: On Windows, when configured with bootstrapped flexdll, don't add + +flexdll to the search path when -nostdlib is specified (which then means + -L no longer gets passed to the system linker). + (David Allsopp, review by Florian Angeletti) + +- #13089: Fix bug in `runtime_events` library which could result in garbled + output under Windows. + (B. Szilvasy, review by Nicolás Ojeda Bär and Miod Vallat) + +- #13088: A few type-checker behaviors look at a type to see if there are + any labeled arguments in it. This sometimes required expansion, which + could, in obscure scenarios, result in superfluous type errors. + (Richard Eisenberg, review by Gabriel Scherer and Jacques Garrigue) + +- #13103: FreeBSD/amd64: properly annotate .o files with non-executable stack + notes (Konstantin Belousov, review by Nicolás Ojeda Bär) + +- #13150: improve a transitive-closure computation algorithm in the flambda + middle-end to avoid a compilation time blowup on Menhir-generated code + (Florian Weimer, review by Gabriel Scherer and Pierre Chambart, + report by Richard Jones) + +- #13166: Fix a MinGW/MSVC Sys.rename regression on renaming a parent directory + to an empty child directory. + (Jan Midtgaard, review by Antonin Décimo, Sébastien Hinderer, and + David Allsopp) + +- #13185, #13192: Reject type-level module aliases on functor parameter + inside signatures. + (Jacques Garrigue, report by Richard Eisenberg, review by Florian Angeletti) + +- #13170: Fix a bug that would result in some floating alerts `[@@@alert ...]` + incorrectly triggering Warning 53. + (Nicolás Ojeda Bär, review by Chris Casinghino and Florian Angeletti) + +- #13203: Do not issue warning 53 if the compiler is stopping before attributes + have been accurately marked. + (Chris Casinghino, review by Florian Angeletti) + +- #13207: Be sure to reload the register caching the exception handler in + caml_c_call and caml_c_call_stack_args, as its value may have been changed + if the OCaml stack is expanded during a callback. + (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and + Xavier Leroy) + +- #13209: Fix configure test that checks whether `ar` supports `@FILE` + arguments. + (Nicolás Ojeda Bär, report by Boris D.) + +- #13221: Compute more accurate instruction sizes for branch relocation on + POWER. + (Miod Vallat, review by Gabriel Scherer) + +- #13252: Rework register assignment in the interpreter code on m68k on Linux, + due to the %a5 register being used by Glibc. + (Miod Vallat, report by Stéphane Glondu, review by Gabriel Scherer and + Xavier Leroy) + +- #13247: Disable lib_unix/kill test for MacOS AMD64 with TSan, linking + to llvm bug report causing infinite signal loops. + (Tim McGilchrist, review by Olivier Nicole, Miod Vallat, Sébastien Hinderer + and Gabriel Scherer) + +- #13234, #13267: Open runtime events file in read-write mode on armel + (armv5) systems due to atomic operations limitations on that + platform. + (Stéphane Glondu, review by Miod Vallat and Vincent Laviron) + +- #13273: Fix a call to test in configure.ac that was causing errors when + LDFLAGS contains several words. + (Stéphane Glondu, review by Miod Vallat) + +- #13290: Fix uninitialized and out of bounds reads in runtime_events_consumer.c + (Edwin Török, review by Miod Vallat and Antonin Décimo) + +- #13306: An algorithm in the type-checker that checks two types for equality + could sometimes, in theory, return the wrong answer. This patch fixes the + oversight. No known program triggers the bug. + (Richard Eisenberg, review by Florian Angeletti) + +- #13400: Initialize th->signal_stack to avoid free of uninitialized data + if the user calls caml_c_thread_unregister on the main thread. + (Richard W.M. Jones, review by Guillaume Munch-Maccagnoni and + Gabriel Scherer) + +- #13140: POWER back-end: fix issue with call to `caml_call_realloc_stack` + from a DLL + (Xavier Leroy, review by Miod Vallat) + +- #13263, #13560: fix printing true and false in toplevel and error + messages (no more unexpected \#true) + (Florian Angeletti, report by Samuel Vivien, review by Gabriel Scherer) + +- #13388, #13540: raises an error message (and not an internal compiler error) + when two local substitutions are incompatible (for instance `module type + S:=sig end type t:=(module S)`) + (Florian Angeletti, report by Nailen Matschke, review by Gabriel Scherer, and + Leo White) + +- #13408: Fix misplaced debug runtime assertion triggerable by a race + between domain exit and backup thread + (Miod Vallat and Gabriel Scherer, report by Jan Midtgaard) + +- #13417: `Filename.quote_command`: fix handling of forward slashes in program + path under Win32. + (Nicolás Ojeda Bär, review by David Allsopp and Damien Doligez) + +- #13501: Regression on mutually recursive types caused by #12180. + Resuscitate Typedecl.update_type. + (Jacques Garrigue and Takafumi Saikawa, review by Florian Angeletti, Richard + Eisenberg and Gabriel Scherer) + +- #13502: Fix misindexing related to `Gc.finalise_last` that could prevent + finalisers from being run. + (Nick Roberts, review by Mark Shinwell) + +- #13495, #13514: Fix typechecker crash while typing objects + (Jacques Garrigue, report by Nicolás Ojeda Bär, review by + Nicolas Ojeda Bär, Gabriel Scherer, Stephen Dolan, Florian Angeletti) + +- #13391, #13551: fix a printing bug with `-dsource` when using + raw literal inside a locally abstract type constraint + (i.e. `let f: type \#for. ... `) + (Florian Angeletti, report by Nick Roberts, review by Richard Eisenberg) + +- #13520: Fix compilation of native-code version of systhreads. Bytecode fields + were being included in the thread descriptors. + (David Allsopp, review by Sébastien Hinderer and Miod Vallat) + +- #13541, #13591: Fix headers for C++ inclusion. + (Antonin Décimo, review by Nick Barnes, report by Kate Deplaix) + +- #13579, #13583: Unsoundness involving non-injective types + gadts + (Jacques Garrigue, report by @v-gb, + review by Richard Eisenberg and Florian Angeletti) + +- #13598: Falsely triggered warning 56 [unreachable-case] + This was caused by unproper protection of the retyping function. + (Jacques Garrigue, report by Tõivo Leedjärv, review by Florian Angeletti) + +- #13603, #13604: fix source printing in the presence of the escaped raw + identifier `\#mod`. + (Florian Angeletti, report by Chris Casinghino, review by Gabriel Scherer) + +OCaml 5.2.0 (13 May 2024) +------------------------- + +(Changes that can break existing programs are marked with a "*") + +### Restored and new backends: + +- #12276, #12601: native-code compilation for POWER (64 bits, little-endian) + (Xavier Leroy, review by KC Sivaramakrishnan, Anil Madhavapeddy, + and Stephen Dolan) + +- #12667: extend the latter to POWER 64 bits, big-endian, ELFv2 ABI + (A. Wilcox, review by Xavier Leroy) + +### Language features: + +- #12295, #12568: Give `while true' a polymorphic type, similarly to + `assert false' + (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer, + suggestion by Rodolphe Lepigre and John Whitington) + +- #12315: Use type annotations from arguments in let rec + (Stephen Dolan, review by Gabriel Scherer) + +- #11252, RFC 27: Support raw identifier syntax \#foo + (Stephen Dolan, review by David Allsopp, Gabriel Scherer and Olivier Nicole) + +- #12044: Add local module open syntax for types. + ``` + module A = struct + type t = int + type r = unit + type s = string + end + + type example = A.(t * r * s) + ``` + (Alistair O'Brien, review by Gabriel Scherer, Nicolás Ojeda Bär + and Florian Angeletti) + +- #12456: Document the incompatibility between effects on the one + hand, and `caml_callback` and asynchronous callbacks (signal + handlers, finalisers, memprof callbacks...) on the other hand. + (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan) + +- #12375: allow use of [@untagged] for all immediate types like char, bool, + and variant with only constant constructors. + (Christophe Raffalli, review by Gabriel Scherer) + +* #12502: the compiler now normalizes the newline sequence \r\n to + a single \n character during lexing, to guarantee that the semantics + of newlines in string literals is not modified by Windows tools + transforming \n into \r\n in source files. + Warning 29 [eol-in-string] is not emitted anymore, as the normalization + gives a more robust semantics to newlines in string literals. + (Gabriel Scherer and Damien Doligez, review by Daniel Bünzli, David + Allsopp, Andreas Rossberg, Xavier Leroy, report by Andreas Rossberg) + +- #13130: minor fixes to pprintast for raw identifiers and local module open + syntax for types. + (Chet Murthy, review by Gabriel Scherer) + +### Type system: + +- #12313, #11799: Do not re-build as-pattern type when a ground type annotation + is given. This allows to work around problems with GADTs in as-patterns. + (Jacques Garrigue, report by Leo White, review by Gabriel Scherer) + +### Runtime system: + +- #12193: Re-introduce GC compaction for shared pools + Adds a parallel compactor for the shared pools (which contain major heap + blocks sized less than 128 words). Explicit only for now, on calls to + `Gc.compact`. + (Sadiq Jaffer, Nick Barnes, review by Anil Madhavapeddy, Damien Doligez, + David Allsopp, Miod Vallat, Artem Pianykh, Stephen Dolan, Mark Shinwell + and KC Sivaramakrishnan) + +- #12850: Update Gc.quick_stat data at the end of major cycles and compaction + This PR adds an additional caml_collect_gc_stats_sample_stw to the major heap + cycling stw. This means that Gc.quick_stat now actually reflects the state of + the heap after a major cycle or compaction. + (Sadiq Jaffer, review by Miod Vallat and Gabriel Scherer) + +- #12859: Ensure Gc.compact does a full major before the compactor runs + (Sadiq Jaffer, review by Leo White, Mark Shinwell, Gabriel Scherer, + Josh Berdine, David Allsopp and KC Sivaramakrishnan) + +- #10111: Increase the detail of location information for debugging events to + allow the end line number and character offset to be reported. + (David Allsopp, review by Nick Barnes, Enguerrand Decorne and Stephen Dolan) + +- #10403, #12202: introduce `caml_ext_table_add_noexc` that does not + raise `Out_of_memory` exceptions and use it inside the blocking sections + of `caml_read_directory`. Also, check for overflows in ext table sizes. + (Xavier Leroy, report by Arseniy Alekseyev, review by Gabriel Scherer) + +- #11332, #12702: make sure `Bool_val(v)` has type `bool` in C++ + (Xavier Leroy, report by ygrek, review by Gabriel Scherer) + +- #12772, #12787: Avoid using _Bool in public headers for the sake of C++ + compatibility + (Guillaume Munch-Maccagnoni, report by KC Sivaramakrishnan, review + by Xavier Leroy and KC Sivaramakrishnan) + +- #12223: Constify constructors and flags tables in C code. Now these + tables will go in the readonly segment, where they belong. + (Antonin Décimo, review by Gabriel Scherer and Xavier Leroy) + +- #12234: make instrumented time calculation more thread-safe on macOS. + (Anil Madhavapeddy, review by Daniel Bünzli and Xavier Leroy) + +- #12235, #12468: introduce and use the `CAMLnoret` macro as + a lighter alternative to `CAMLnoreturn_start` / `CAMLnoreturn_end`. + Implement it so as to conform with C11, C23, C++11, C++17. + (Xavier Leroy and Dhruv Maroo, with help from Antonin Décimo, review by + Gabriel Scherer and David Allsopp) + +- #12275: caml/stack.h: more abstract macros to describe OCaml stacks and + how to traverse them, supporting more stack layouts. + (Xavier Leroy, review by KC Sivaramakrishnan and Fabrice Buoro) + +- #12268: deliver `Out_of_memory` exception if domain creation fails + due to memory resource exhaustion. It was previous always a `Failure`. + (Anil Madhavapeddy, review by David Allsopp) + +- #12300, #12314: Discard out_channel buffered data on permanent I/O error + (Xavier Leroy, report by Török Edwin, review by Anil Madhavapeddy + and Nicolás Ojeda Bär) + +- #11386: Simplifications and fixes to multicore systhreads implementation. + (Guillaume Munch-Maccagnoni, review by Anil Madhavapeddy and KC + Sivaramakrishnan) + +- #12875, #12879, #12882: Execute preemptive systhread switching as a + delayed pending action. This ensures that one can reason within the + FFI that no mutation happens on the same domain when allocating on + the OCaml heap from C, consistently with OCaml 4. This also fixes + further bugs with the multicore systhreads implementation. + (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark + Shinwell, review by Nick Barnes and Stephen Dolan) + +- #12408: `Domain.spawn` no longer leaks its functional argument for + the whole duration of the children domain lifetime. + (Guillaume Munch-Maccagnoni, review by Gabriel Scherer) + +- #12409: Fix unsafety and deadlocks should an asynchronous exception + arise at specific locations during domain creation and shutdown. + (Guillaume Munch-Maccagnoni, review by Gabriel Scherer) + +- #12114: Add ThreadSanitizer support + (Fabrice Buoro and Olivier Nicole, based on an initial work by Anmol Sahoo, + review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc + Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer) + +- #11911, #12381: Restore statmemprof functionality in part, with + some API changes in Gc.Memprof. + (Nick Barnes, review by Jacques-Henri Jourdan + and Guillaume Munch-Maccagnoni). + +- #12430: Simplify dynamic bytecode loading in Meta.reify_bytecode + (Stephen Dolan, review by Sébastien Hinderer, Vincent Laviron and Xavier + Leroy) + +- #12489: Fix an error-handling bug in caml_alloc_sprintf + (Stephen Dolan, report by Chris Casinghino, review by Jeremy Yallop + and Xavier Leroy) + +- #11307: Finish adapting the implementation of asynchronous actions for + multicore: soundness, liveness, and performance issues. + Do not crash if a signal handler is called from an unregistered C + thread, and other possible soundness issues. Prevent issues where join + on other domains could make the toplevel unresponsible to Ctrl-C. Avoid + needless repeated polling in C code when callbacks cannot run + immediately. + (Guillaume Munch-Maccagnoni, review by Enguerrand Decorne, Xavier + Leroy, and KC Sivaramakrishnan) + +- #12634: Simplify TSan backtrace bookkeeping upon raise + (Olivier Nicole and Fabrice Buoro, review by Gabriel Scherer) + +* #12686: Some primitives had the wrong types to be callable from the bytecode + interpreter. Either fix their types, mark them as `CAMLexport` instead of + `CAMLprim`, or remove them entirely if no longer used. + (Xavier Leroy, review by David Allsopp) + +- #12700, continuing #11763 and trying to address #12660: + Use the correct types for primitives when generating the table of primitives + used by ocamlrun. + (Xavier Leroy, motivation, review and improvements by Antonin Décimo) + +- #12345, #12710: Fix issues with finaliser orphaning at domain termination + (KC Sivaramakrishnan, report by Gabriel Scherer, review by Gabriel Scherer, + Sadiq Jaffer and Fabrice Buoro) + +- #12599: Refactor Dynlink startup to avoid parsing bytecode sections twice + (Stephen Dolan, review by David Allsopp, Hugo Heuzard, Damien Doligez and + Xavier Leroy) + +- #12678, #12898: free channel buffers on close rather than on finalization + (Damien Doligez, review by Jan Midtgaard and Gabriel Scherer, report + by Jan Midtgaard) + +- #12681: Fix TSan false positives due to volatile write handling + (Olivier Nicole, Fabrice Buoro and Anmol Sahoo, review by Luc Maranget, + Gabriel Scherer, Hernan Ponce de Leon and Xavier Leroy) + +- #12743: Use pthread_sigmask instead of sigprocmask + Updates usage of sigprocmask to pthread_sigmask in otherlibs/unix. + (Max Slater, review by Miod Vallat and Xavier Leroy) + +- #12769: Unify MSVC and MinGW-w64 code paths, by always using WinAPI + directly. + (David Allsopp, Antonin Décimo, and Samuel Hym, review by Nicolas + Ojeda Bar) + +- #11911, #12382, #12383: Restore statmemprof functionality in part + (backtrace buffers, per-thread and per-domain data structures, + GC/allocation interface). (Nick Barnes, review by Gabriel Scherer, + Fabrice Buoro, Sadiq Jaffer, Guillaume Munch-Maccagnoni, and + Jacques-Henri Jourdan). + +- #12735: Store both ends of the stack chain in continuations + (Leo White, review by Miod Vallat and KC Sivaramakrishnan) + +- #12746: Simplify and clean up TSan annotations + (Olivier Nicole, review by Miod Vallat and Fabrice Buoro) + +- #12809: Add ThreadSanitizer support to FreeBSD/amd64 + (Miod Vallat, review by Gabriel Scherer) + +- #12810: Port ThreadSanitizer support to Linux and macOS on arm64 + (Miod Vallat, review by Tim McGilchrist) + +- #12811: Define and use the CAMLthread_local macro for TLS variables. + (Antonin Décimo and Samuel Hym, review by Miod Vallat and Xavier Leroy) + +- #12814: More detailed failure messages from `input_value` and `Marshal.from_*` + (Xavier Leroy, review by Stephen Dolan and Anil Madhavapeddy) + +- #12815: Correctly format multi-line locations in exception backtraces, in the + style that the compiler driver uses. + (David Allsopp, review by Gabriel Scherer) + +- #12773, #12830, #12834: Rewrite `caml_c_thread_(un)register` to fix + various bugs. + (Guillaume Munch-Maccagnoni, reported by Miod Vallat, suggested by + Hari Hara Naveen S, reviewed by Fabrice Buoro, Gabriel Scherer and + Miod Vallat) + +- #12876: Port ThreadSanitizer support to Linux on POWER + (Miod Vallat, review by Tim McGilchrist) + +- #12886: Reinitialize IO mutexes after fork + (Max Slater, review by Guillaume Munch-Maccagnoni and Xavier Leroy) + +- #12907: Port ThreadSanitizer support to Linux on RiscV + (Miod Vallat, review by Nicolás Ojeda Bär and Fabrice Buoro) + +- #12915: Port ThreadSanitizer support to Linux on s390x + (Miod Vallat, review by Tim McGilchrist) + +- #12934: Fix data races between marking and sweeping functions + (Olivier Nicole, suggested by Stephen Dolan, review by Gabriel Scherer, + Miod Vallat and Damien Doligez) + +### Code generation and optimizations: + +- #11239: on x86-64 and RISC-V, reduce alignment of OCaml stacks from 16 to 8. + This reduces stack usage. It's only C stacks that require 16-alignment. + (Xavier Leroy, review by Gabriel Scherer and Stephen Dolan) + +- #12311: on POWER, 32-bit FP numbers stored in memory (e.g. in bigarrays) + were not correctly rounded sometimes. + (Xavier Leroy, review by Anil Madhavapeddy and Tim McGilchrist) + +- #12551, #12608, #12782, #12596: Overhaul of recursive value compilation. + Non-function recursive bindings are now forbidden from Lambda onwards, + and compiled using a new Value_rec_compiler module. + (Vincent Laviron and Lunia Ayanides, review by Gabriel Scherer, + Stefan Muenzel and Nathanaëlle Courant) + +- #1809, #12181: rewrite `compare x y op 0` to `x op y` when values are integers + (Xavier Clerc, Stefan Muenzel, review by Gabriel Scherer and Vincent Laviron) + +- #12825: disable common subexpression elimination for atomic loads... again. + (Gabriel Scherer, review by KC Sivaramakrishnan, Xavier Leroy + and Vincent Laviron, report by Vesa Karvonen) + +### Standard library: + +- #12716: Add `Format.pp_print_nothing` function. + (Léo Andrès, review by Gabriel Scherer and Nicolás Ojeda Bär) + +- #11563: Add the Dynarray module to the stdlib. Dynamic arrays are + arrays whose length can be changed by adding or removing elements at + the end, similar to 'vectors' in C++ or Rust. + (Gabriel Scherer, Simon Cruanes and Florian Angeletti, review by + Daniel Bünzli, Guillaume Munch-Maccagnoni, Clément Allain, + Damien Doligez, Wiktor Kuchta and Pieter Goetschalckx) + +* #6732, #12423: Make Buffer.add_substitute surjective and fix its + documentation. + (Damien Doligez, review by Antonin Décimo) + +* #10775, #12499: Half-precision floating-point elements in Bigarray. + (Anton Yabchinskiy, review by Xavier Leroy and Nicolás Ojeda Bär) + +- #11517, #12477: Expose pp_infinity in interface of the format module, and + check that margin is less than pp_infinity when setting or checking geometry. + (Janith Petangoda, reported by Simmo Saan, reviewed by Florian Angeletti, + Simmo Saan, Josh Berdine and Gabriel Scherer) + +- #12217: Add `Array.shuffle`. + (Daniel Bünzli, review by Nicolás Ojeda Bär, David Allsopp and Alain Frisch) + +- #12212: Add cache-aligned constructor for atomics. The patch ensures that + all allocations (of the right size) in the shared heap are aligned. + (Bartosz Modelski with Gabriel Scherer, Guillaume Munch-Maccagnoni, + Xavier Leroy, review by Alain Frisch, Anil Madhavapeddy, Gabriel Scherer, + Guillaume Munch-Maccagnoni, KC Sivaramakrishnan, Stefan Muenzel, + Xavier Leroy) + +- #12307: Add BLAKE2b hashing and an MD5 submodule to the Digest module. + (Xavier Leroy, review by Olivier Nicole, Gabriel Scherer, Wiktor Kuchta, + Daniel Bünzli, David Allsopp) + +- #12365: Add In_channel.input_bigarray, In_channel.really_input_bigarray, + Out_channel.output_bigarray, Unix.read_bigarray, Unix.write_bigarray, + Unix.single_write_bigarray. + (Nicolás Ojeda Bär, review by Jeremy Yallop, Xavier Leroy, Gabriel Scherer, + David Allsopp) + +- #12455: Add `Array.init_matrix`, `Float.Array.make_matrix`, + `Float.Array.init_matrix`. + (Glen Mével, review by Xavier Leroy, Gabriel Scherer, Jeremy Yallop, + Nicolas Ojeda Bar) + +* #12455: `Array.make_matrix dimx dimy f` now raises `Invalid_argument` + when `dimx = 0 && dimy < 0` This was already specified but not enforced. + (Glen Mével, report by Jeremy Yallop, review by Nicolas Ojeda Bar) + +- #12459: Add `Random.int_in_range`, `Random.int32_in_range`, + `Random.int64_in_range`, `Random.nativeint_in_range`, + and their counterpart in `Random.State`. + (Glen Mével and Xavier Leroy, review by Gabriel Scherer, Xavier Leroy, + Florian Angeletti) + +- #12459: `Random`: restore compatibility between 32-bit integers (JavaScript) + and 63-bit integers (64-bit OCaml). + For `Random.full_int` this was guaranteed in 4.14 but wrongly removed in 5.0. + (Xavier Leroy, review by Glen Mével) + +- #12511: Minor performance improvements and cleanups in the implementation + of modules Int32, Int64, and Nativeint + (Xavier Leroy, review by Gabriel Scherer and Daniel Bünzli) + +- #12558: Adapt GC alarms for multicore and fix their documentation. + (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan + and Gabriel Scherer) + +- #12625: Remove the Closure module from Obj + (Vincent Laviron, review by Xavier Leroy) + +- #12758, #12998: Remove the `Marshal.Compression` flag to the + `Marshal.to_*` functions. The compilers are still able to use + ZSTD compression for compilation artefacts. + This is a forward port and clean-up of the emergency fix that was introduced + in OCaml 5.1.1 by #12734. + (Xavier Leroy, review by Damien Doligez) + +- #12784: Fix computation of minor-heap allocation in Gc.counters() + and Gc.allocated_bytes(). (Nick Barnes, review by Gabriel Scherer) + +- #12770: Add `Fun.compose`. + (Justin Frank, review by Nicolás Ojeda Bär, Daniel Bünzli and Jeremy Yallop) + +- #12845: Add `{In,Out}_channel.is_binary_mode` as the dual of + `set_binary_mode`. This function was previously only available in the internal + C API. + (David Allsopp, review by Nicolás Ojeda Bär and Xavier Leroy) + +### Other libraries: + +- #12213: Dynlink library, improve legibility of error messages + (Samuel Hym, review by Gabriel Scherer and Nicolás Ojeda Bär) + +* #12686: Runtime_events library, C API: define + `caml_runtime_events_{start,pause,resume}` as returning `void` + instead of `value`. + (Xavier Leroy, review by David Allsopp) + +### Tools: + +- #12340: testsuite: collect known issues with current -short-paths + implementation for existential types + (Florian Angeletti, Samuel Hym, review by Florian Angeletti and Thomas Refis) + +- #12147: ocamllex: Allow carriage returns at the end of line directives. + (SeungCheol Jung, review by Nicolás Ojeda Bär) + +- #12260: Fix invalid_argument on some external or module aliases in ocamlnat + (Fabian Hemmer, review by Vincent Laviron) + +- #12185: New script language for ocamltest. + (Damien Doligez with Florian Angeletti, Sébastien Hinderer, Gabriel Scherer, + review by Sébastien Hinderer and Gabriel Scherer) + +- #12371: ocamltest: fix recursive expansion of variables. + (Antonin Décimo, Damien Doligez, review by Sébastien Hinderer, + Damien Doligez, Gabriel Scherer, and Xavier Leroy) + +* #12497, #12613: Make ocamlc/ocamlopt fail with an error when no + input files are specified to build an executable. + (Antonin Décimo, review by Sébastien Hinderer) + +- #12576: ocamldep: various refactors. + (Antonin Décimo, review by Florian Angeletti, Gabriel Scherer, and Léo Andrès) + +- #12615: ocamldoc: get rid of the odoc_literate and odoc_todo generators. + (Sébastien Hinderer, review by Gabriel Scherer and Florian Angeletti) + +- #12624: Use $XDG_CONFIG_DIRS in addition to $XDG_CONFIG_HOME when searching + for init.ml and use this to extend init.ml support to the toplevel when + running on Windows. + (David Allsopp, report by Jonah Beckford, review by Nicolás Ojeda Bär and + Antonin Décimo) + +- #12688: Setting the env variable `NO_COLOR` with an empty value no longer + has effects. Previously, setting `NO_COLOR` with any value, including + the empty value, would disable colors (unless `OCAML_COLOR` is also set). + After this change, the user must set `NO_COLOR` with an non-empty value + to disable colors. This reflects a specification clarification/change + from the upstream website at https://no-color.org. + (Favonia, review by Gabriel Scherer) + +- #12744: ocamltest: run tests in recursive subdirs more eagerly + (Nick Roberts, review by Nicolás Ojeda Bär) + +- #12901, 12908: ocamllex: add overflow checks to prevent generating incorrect + lexers; use unsigned numbers in the table encoding when possible. + (Vincent Laviron, report by Edwin Török, review by Xavier Leroy) + +### Manual and documentation: + +- #12338: clarification of the documentation of process related function in + the unix module regarding the first element of args and shell's pid. + (Christophe Raffalli, review by Florian Angeletti) + +- #12473: Document in runtime/memory.c our current understanding of + accesses to the OCaml heap from the C runtime code -- the problem + of hybrid programs mixing two memory models. + (Gabriel Scherer and Guillaume Munch-Maccagnoni, review by Olivier + Nicole and Xavier Leroy) + +- #12694: Document in runtime/tsan.c the TSan instrumentation choices and the + consequences with regard to the memory model. + (Olivier Nicole, review by Miod Vallat, Gabriel Scherer, Guillaume + Munch-Maccagnoni and Fabrice Buoro) + +- #12802: Add manual chapter about ThreadSanitizer support + (Olivier Nicole, review by Miod Vallat, Sebastien Hinderer, Fabrice Buoro, + Gabriel Scherer and KC Sivaramakrishnan) + +- #12819: Clarify which runtime interactions are allowed in custom ops + (Basile Clément, review by Guillaume Munch-Maccagnoni and Xavier Leroy) + +- #12840: manual: update runtime tracing chapter for custom events (ex #12335) + (Lucas Pluvinage, Sadiq Jaffer and Olivier Nicole, review by Gabriel Scherer, + David Allsopp, Tim McGilchrist and Thomas Leonard) + +- #13066, update OCAMLRUNPARAM documentation for the stack size parameter l + (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and + Miod Vallat) + +- #13078: update Format tutorial on structural boxes to mention alignment + questions. + (Edwin Török, review by Florian Angeletti) + +- #13092: document the existence of the `[@@poll error]` built-in attribute + (Florian Angeletti, review by Gabriel Scherer) + +### Compiler user-interface and warnings: + +* #10613, #12405: Simplify the values used for the system variable (`system:` in + `ocamlopt -config` or the `Config.system` constant). In particular, s390x and + ppc64 now report "linux" instead of "elf"; all variants of 32-bit ARM on Linux + now report "linux"; OpenBSD now reports "openbsd" instead of "bsd" for 32-bit + ARM; FreeBSD, NetBSD and OpenBSD now report the same value for both x86_64 and + x86_32; x86_32 systems matching *bsd but not freebsd*, netbsd* or openbsd* + are no longer identified (as on x86_64); x86_32 Linux now reports "linux" + instead of "linux_elf". + (David Allsopp, request by Kate Deplaix, review by Sébastien Hinderer and + Xavier Leroy) + +- #11989, #12246, RFC 31: New flag, -H, to allow for transitive dependencies + without including them in the initial environment. + (Chris Casinghino, François Bobot, and Gabriel Scherer, review by Leo White + and Stefan Muenzel, RFC by François Bobot) + +- #12247: configure: --disable-ocamldebug can now be used instead + of --disable-debugger (which remains available for compatibility) + (Gabriel Scherer, review by Damien Doligez and Sébastien Hinderer) + +- #12199: improve the error message for non-overriding `inherit!` + (Florian Angeletti, review by Jules Aguillon) + +- #12210: uniform style for inline code in compiler messages + (Florian Angeletti, review by Gabriel Scherer) + +* #12278, #:12325: Remove the OCAML_FLEXLINK environment variable from the + compiler drivers. This environment variable was previously used as part of the + FlexDLL bootstrap procedure and existed solely for that purpose. Its removal + greatly simplifies both the build system and testsuite machinery. + (David Allsopp, review by Sébastien Hinderer) + +- #12347: error messages: always report missing polyvariant tags + (Florian Angeletti, report by Tianbo Hao, review by Gabriel Scherer) + +- #12224, specialized error message when trying to apply non-functor + module (e.g `module M = Int(Int)`) + (Florian Angeletti, review by Gabriel Scherer) + +- #12451: Warning 53 (misplaced attributes) now works for all attributes. + (Chris Casinghino, review by Florian Angeletti) + +- #12622: Give hints about existential types appearing in error messages + (Leo White, review by Gabriel Scherer and Florian Angeletti) + +- #12671: When a class type parameter or class parameter does not match, + identify which parameter in the error message, instead of saying + "A type parameter" or "A parameter". + (Stefan Muenzel, review by Gabriel Scherer) + +- #12679: Add more detail to the error message and manual in case of + invalid module type substitutions. + (Stefan Muenzel, review by Gabriel Scherer and Florian Angeletti) + +- #12750: Display the command executed to extract primitives in + `ocamlc -verbose`. + (David Allsopp, review by Nicolás Ojeda Bär) + +- #12777: Add details about the actual and expected method types to the method + mismatch error messages. + (Javier Chávarri, review by Gabriel Scherer and Florian Angeletti) + +* #12942: Fix an line ordering in some module inclusion error messages + (Nick Roberts, review by Florian Angeletti, report by Carl Eastlund) + +### Internal/compiler-libs changes: + +- #12639: parsing: Attach a location to the RHS of Ptyp_alias + and improve the 'alias type mismatch' error message. + (Jules Aguillon, review by Florian Angeletti) + +- #12447: Remove 32-bit targets from X86_proc.system + (Masanori Ogino, review by David Allsopp) + +- #12216, #12248: Prevent reordering of atomic loads during instruction + scheduling. This is for reference, as instruction scheduling is currently + unused in OCaml 5. + (Xavier Leroy, report by Luc Maranget and KC Sivaramakrishnan, + review by Nicolás Ojeda Bär) + +- #12025: Split Typecore.unify_pat_types into two + to avoid unnecessary references to the environment in type_pat + (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer) + +- #12031: Use dedicated types to represent names of compilation units + and predefined exceptions in CMO files. + (Sébastien Hinderer, review by Florian Angeletti, Thomas Refis, + Gabriel Scherer, Vincent Laviron, Pierre Chambart, Luke Maurer, + Hugo Heuzard, Xavier Leroy and Damien Doligez) + +- #12109: Pack parameters to unification in unification_environment + (Takafumi Saikawa and Jacques Garrigue, review by Richard Eisenberg) + +- #12331, #12361: Pack the unification data for pattern checking in Typecore + (Takafumi Saikawa and Jacques Garrigue, + review by Gabriel Scherer, Thomas Refis and Florian Angeletti) + +- #12229: Remove global mutable state for typechecking patterns + in Typecore in favor of local mutable state. + (Nick Roberts, review by Takafumi Saikawa) + +- #12236, #12386, #12391, #12496, #12673: Use syntax as sole determiner of arity + This changes function arity to be based solely on the source program's + parsetree. Previously, the heuristic for arity had more subtle heuristics + that involved type information about patterns. Function arity is important + because it determines when a pattern match's effects run and is an input + into the fast path for function application. + + This change affects tooling: it changes the function constructs in parsetree + and typedtree. + + See https://github.com/ocaml/RFCs/pull/32 for the original RFC. + + (Nick Roberts; review by Richard Eisenberg, Leo White, and Gabriel Scherer; + RFC by Stephen Dolan) + +- #12542: Minor bugfix to #12236: restore dropped call to `instance` + (Nick Roberts, review by Jacques Garrigue) + +- #12242: Move the computation of stack frame parameters to a separate + `Stackframe` module, and save the parameters in the results of the + `Linearize` pass + (Xavier Leroy, review by KC Sivaramakrishnan and Mark Shinwell) + +- #12442: document jump summaries in the pattern-matching compiler + (Gabriel Scherer and Thomas Refis, review by Florian Angeletti + and Vincent Laviron) + +- #12446, #12792: remove the hooks machinery around channel locking + in runtime/io.c + (Gabriel Scherer, review by Xavier Leroy) + +- #12389, #12544, #12984, #12987: centralize the handling of metadata for + compilation units and artifacts in preparation for better unicode support for + OCaml source files. + (Florian Angeletti, review by Vincent Laviron and Gabriel Scherer) + +- #12532, #12553: improve readability of the pattern-matching debug output + (Gabriel Scherer, review by Thomas Refis) + +- #12537: Use C11/C++11 standard static assertion. + (Antonin Décimo, review by Sebastien Hinderer, Xavier Leroy, + and KC Sivaramakrishnan) + +- #12169: runtime: document and enforce naming conventions around STW sections. + (Gabriel Scherer, review by Enguerrand Decorne, Miod Vallat, B. Szilvasy + and Nick Barnes, report by KC Sivaramakrishnan) + +- #12669 : Clean up some global state handling in schedgen + (Stefan Muenzel, review by Miod Vallat and Gabriel Scherer) + +- #12640: Make the module separator used in symbol names configurable + (Miod Vallat, review by Hugo Heuzard and Xavier Leroy) + +- #12691 : Clean up Ctype.expand_abbrev_gen and + rename Env.add_local_type to add_local_constraint + (Takafumi Saikawa and Jacques Garrigue, review by Florian Angeletti) + +- #12786 : Clean up the algorithm of Ctype.limited_generalize + (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer) + +- #10691: Ast_mapper, Ast_iterator: add functions directive_argument, + toplevel_directive and toplevel_phrase. + (Guillaume Petiot, review by Gabriel Scherer and Kate Deplaix) + +- #12764: Move all installable headers in `caml/` sub-directories. + (Antonin Décimo, review by Gabriel Scherer and David Allsopp) + +- #12508 : Add compiler-side support for project-wide occurrences in Merlin, by + generating index tables of all identifier occurrences. This extra data in .cmt + files is only added when the new flag -bin-annot-occurrences is passed. + (Ulysse Gérard, Nathanaëlle Courant, suggestions by Gabriel Scherer and Thomas + Refis, review by Florian Angeletti, Gabriel Scherer and Thomas Refis) + +- #12914: Slightly change the s390x assembly dialect in order to build with + Clang's integrated assembler. + (Miod Vallat, review by Gabriel Scherer) + +- #13001: do not read_back entire shapes to get aliases' uids when building the + usages index + (Ulysse Gérard, review by Gabriel Scherer and Nathanaëlle Courant) + +### Build system: + +- #12198, #12321, #12586, #12616, #12706, #13048: continue the merge of the + sub-makefiles into the root Makefile started with #11243, #11248, + #11268, #11420 and #11675. + (Sébastien Hinderer, review by David Allsopp and Florian Angeletti) + +- #12569, #12570: remove 'otherlibraries' as a prerequisite for 'runtop'; + use 'runtop-with-otherlibs' to use a library from otherlibs/ + (Gabriel Scherer, review by Sébastien Hinderer, suggestion by David Allsopp) + +- #12652: Make magic numbers easier to bump and duplicate. + (Sébastien Hinderer, review by Antonin Décimo, David Allsopp and Florian + Angeletti) + +* #12751: --with-target-bindir configure option implemented. This option + refers to the location of the runtime binaries on the target system for a + cross-compiler and is embedded in executables produced by ocamlc. It does + not affect the bytecode executables installed as part of the build. The old + mechanism `make TARGET_BINDIR=..` no longer works. + (David Allsopp, review by Damien Doligez, Xavier Leroy and Olivier Nicole) + +- #12768, #13030: Detect mingw-w64 coupling with GCC or LLVM, detect clang-cl, + and fix C compiler feature detection on macOS. + (Antonin Décimo, review by Miod Vallat and Sébastien Hinderer) + +### Bug fixes: + +- #10652, #12720: fix evaluation order in presence of optional arguments + (Jacques Garrigue, report by Leo White, review by Vincent Laviron) + +- #12595, #12597: fix a race in `caml_clear_gc_stats_sample` + (Gabriel Scherer, review by B. Szilvasy, report by B. Szilvasy) + +- #12580: Fix location of alias pattern variables. + (Chris Casinghino, review Gabriel Scherer, report by Milo Davis) + +- #12583: Add a closing event for when `EV_MAJOR_EPHE_MARK` is complete + (Sudha Parimala, review by Gabriel Scherer) + +- #12566: caml_output_value_to_malloc wrongly uses `caml_stat_alloc` + instead of `malloc` since 4.06, breaking (in pooled mode) user code + that uses `free` on the result. Symmetrically, + caml_input_value_from_malloc should use `free`. + (Gabriel Scherer, review by Xavier Leroy and Enguerrand Decorne, + report by Ido Yariv) + +- #12490: Unix: protect the popen_processes hashtable with a mutex + (Gabriel Scherer, report by Olivier Nicole, review by Xavier Leroy) + +- #11931: Fix tricky typing bug with type substitutions + (Stephen Dolan, review by Leo White and Jacques Garrigue) + +- #12037, #12171: Fix get_extern_state potential NULL dereference. + (Alexander Skvortsov, report by Török Edwin, + design by Gabriel Scherer, Xavier Leroy) + +- #12635: Fix get_intern_state potential NULL dereference. + (Antonin Décimo, review by KC Sivaramakrishnan) + +- #12032, #12059: Bug fixes related to compilation of recursive definitions + (Vincent Laviron, report by Victoire Noizet, review by Gabriel Scherer) + +* #12145: Loopy constraints cause ocamlc to loop. + Fixed by completely removing the call to `update_type` in + `Typedecl.transl_type_decl`, as the expansion is already checked by + `check_regularity`. As a result, recursion is more polymorphic, + which may cause some (essentially wrong) type declarations to have + unbound type variables, and some constraints unrelated to the concrete + type to be ignored (see tests/typing-misc/constraints.ml). + (Jacques Garrigue, report by Richard Eisenberg, review by Leo White) + +- #12207, #12222: Make closure computation linear in the number of recursive + functions instead of quadratic + (Vincent Laviron, report by François Pottier, review by Nathanaëlle Courant + and Gabriel Scherer) + +- #11040, #12591: fix a data race in major_gc.c + (Gabriel Scherer, review by Guillaume Munch-Maccagnoni + and KC Sivaramakrishnan, report by Sadiq Jaffer) + +- #12238, #12403, #12698: read input files in one go to avoid source reprinting + issues. + (Gabriel Scherer, report by Mike Spivey and Vincent Laviron, review by + Nicolás Ojeda Bär, Xavier Leroy and Jeremy Yallop) + +- #12334, #12368: Bad error message with mutually recursive abbreviations + (Jacques Garrigue, report by Richard Eisenberg, review by Gabriel Scherer + and Richard Eisenberg) + +- #12401: `seek_in` and `seek_out` sometimes returned normally when given + negative offsets, instead of failing. Now both functions should consistently + raise `Sys_error` in this case. + (Nicolás Ojeda Bär, review by Gabriel Scherer) + +- #12267: Fix stack alignment computation + (Miod Vallat, report by Jan Midtgaard, review by Gabriel Scherer) + +- #12395, #12404: Fix thread-unsafety in the fallback implementation of + `Unix.create_process` (the one used when `posix_spawnp` is unavailable) + (Xavier Leroy, report by Chris Vine, review by Nicolás Ojeda Bär) + +- #12949: open shadowing mistriggers + (Gabriel Scherer, review by Florian Angeletti, report by Andreas Rossberg) + +- #12526: Honor `ocaml.inline always` attribute on functions with + optional arguments and default values in the Closure backend + (Alain Frisch, review by Vincent Laviron) + +- #12677, #12889: make Domain.DLS thread-safe + (Gabriel Scherer, review by Olivier Nicole and Damien Doligez, + report by Vesa Karvonen) + +- #12561: Fix crash when combining TSan and frame-pointers + (Fabrice Buoro and Olivier Nicole, report by Jan Midtgaard, review by Miod + Vallat and Gabriel Scherer) + +- #12482: Rework bounds checking code in the POWER backend + (Miod Vallat and Xavier Leroy, report by Jan Midtgaard, review by + KC Sivaramakrishnan) + +- #12528, #12703: Avoid pointer arithmetic overflow in Tag_val macro + (very likely harmless, but can trigger alarms) + (Xavier Leroy, report by Sam Goldman, review by Guillaume Munch-Maccagnoni) + +- #12593: TSan should handle Effect.Unhandled correctly + (Fabrice Buoro and Olivier Nicole, report by Jan Midtgaard and Miod Vallat, + review by Gabriel Scherer) + +- #12684: fix locations filename in AST produced by the `-pp` option + (Gabriel Scherer, review by Florian Angeletti) + +- #12714: check whether macros are defined before using them to ensure + that the headers can always be used in code which turns on -Wundef + (or equivalent). + (Antonin Décimo, review by Miod Vallat, Gabriel Scherer, + Xavier Leroy, and David Allsopp) + +- #12726: fix segmentation fault under Windows when executing a bytecode file if + the runtime (`ocamlrun.exe`) cannot be found. + (Vadim Zborovskii, Nicolás Ojeda Bär, report by Vadim Zborovskii, review by + David Allsopp) + +- #12727, #12730: fix bug with value let-rec and labelled applications + (Vincent Laviron, review by Gabriel Scherer) + +* #12751: Always keep within the 128 character limit for shebang lines. Previous + fix in #8622 handled building the compiler with a long prefix; this patch + extends this to the bytecode executables emitted by that compiler. + (David Allsopp, review by Damien Doligez, Xavier Leroy and Olivier Nicole) + +- #12755: Fix data race on global pools arrays of pool_freelist + (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer) + +- #12796, #12801: Fix memory corruption in caml_unix_alloc_sockaddr + (Thomas Leonard, review by Nicolás Ojeda Bär) + +- #12737: Fix data races in minor_gc.c and caml_natdynlink_open + (Olivier Nicole, review by Stefan Muenzel, Miod Vallat, Guillaume + Munch-Maccagnoni, Gabriel Scherer and Xavier Leroy) + +- #12831: Fix call to caml_call_realloc_stack for s390x in PIC mode + (Vincent Laviron, report by Jerry James, review by Miod Vallat) + +* #12837: Show non-generalizable type parameters in type definitions + Changes type of type parameters in outcometree.mli. + (Jacques Garrigue, review by Richard Eisenberg) + +- #12897: fix locking bugs in Runtime_events + (Gabriel Scherer and Thomas Leonard, + review by Olivier Nicole, Vincent Laviron and Damien Doligez, + report by Thomas Leonard) + +- #12851: Fix race between runtime events teardown and event emission + (Olivier Nicole, review by Miod Vallat and Gabriel Scherer) + +- #12860: Fix an assertion that wasn't taking into account the possibility of an + ephemeron pointing at static data. + (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan) + +- #12861: Fix a possible crash in the `threads` library. + (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan) + +- #11040, #12894: Silence false data race observed between caml_shared_try_alloc + and oldify. Introduces macros to call tsan annotations which help annotate + a ``happens before'' relationship. + (Hari Hara Naveen S and Olivier Nicole, + review by Gabriel Scherer and Miod Vallat) + +- #12958: Fix tail-modulo-cons compilation of try-with, && and || + expressions. + (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by + Gabriel Scherer) + +- #12919: Fix register corruption in caml_callback2_asm on s390x. + (Miod Vallat, review by Gabriel Scherer) + +- #12924, #12930: Rework package constraint checking to improve interaction with + immediacy + (Chris Casinghino and Florian Angeletti, review by Florian Angeletti and + Richard Eisenberg) + +- #12969: Fix a data race in caml_darken_cont + (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer and Miod Vallat) + +- #12971, #12974: fix an uncaught Ctype.Escape exception on some + invalid programs forming recursive types. + (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani) + +- #13019: Remove linking instructions for the Unix library from threads.cma + (this was done for threads.cmxa in OCaml 3.11). Eliminates warnings from + new lld when using threads.cma of duplicated libraries. + (David Allsopp, review by Nicolás Ojeda Bär) + +- #13058: Add TSan instrumentation to caml_call_gc(), since it may raise + exceptions. + (Fabrice Buoro, Olivier Nicole, Gabriel Scherer and Miod Vallat) + +- #13079: Save and restore frame pointer across Iextcall on ARM64 + (Tim McGilchrist, review by KC Sivaramakrishnan and Miod Vallat) + +- #13094: Fix undefined behavior of left-shifting a negative number. + (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär) + OCaml 5.1.1 (8 December 2023) ---------------------------- @@ -45,7 +1632,7 @@ OCaml 5.1.1 (8 December 2023) (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer) - #12712, #12742: fix an assertion boundary case in `caml_reset_young_limit` - (Jan Midtgaard, review by Guillaume Munch-Maccagnoni) + (Jan Midtgaard, review by Guillaume Munch-Maccagnoni and KC Sivaramakrishnan) - #12713, #12715: disable common subexpression elimination for atomic loads (Gabriel Scherer and Vincent Laviron, @@ -61,6 +1648,10 @@ OCaml 5.1.1 (8 December 2023) executables with a C++ linker. (Shayne Fletcher, review by Antonin Décimo and Xavier Leroy) +- #12491, #12493, #12500, #12754: Do not change GC pace when creating + sub-arrays of bigarrays + (Xavier Leroy, report by Ido Yariv, analysis by Gabriel Scherer, + review by Gabriel Scherer and Fabrice Buoro) OCaml 5.1.0 (14 September 2023) ------------------------------- @@ -99,7 +1690,7 @@ OCaml 5.1.0 (14 September 2023) `Seq.find_mapi`, `Seq.find_index`, `Array.find_mapi`, `Array.find_index`, `Float.Array.find_opt`, `Float.Array.find_index`, `Float.Array.find_map`, `Float.Array.find_mapi`. - (Sima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär) + (Tima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär) - #11410: Add Set.to_list, Map.to_list, Map.of_list, `Map.add_to_list: key -> 'a -> 'a list t -> 'a list t`. @@ -171,7 +1762,7 @@ OCaml 5.1.0 (14 September 2023) fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc fold_left_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list ... - (Valentin Gatien-Baron and Francois Berenger, + (Valentin Gatien-Baron and François Berenger, review by Gabriel Scherer and Nicolás Ojeda Bär) - #11354: Hashtbl.find_all is now tail-recursive. @@ -252,7 +1843,7 @@ Some of those changes will benefit all OCaml packages. (Fabrice Buoro and Stephen Dolan, review by Gabriel Scherer and Sadiq Jaffer) - #11144: Restore frame-pointers support for amd64 - (Fabrice Buoro, review by Frederic Bour and KC Sivaramakrishnan) + (Fabrice Buoro, review by Frédéric Bour and KC Sivaramakrishnan) - #11935: Load frametables of dynlink'd modules in batch (Stephen Dolan, review by David Allsopp and Guillaume Munch-Maccagnoni) @@ -334,10 +1925,10 @@ Some of those changes will benefit all OCaml packages. to set up to get flexdll working changed (David Allsopp and Samuel Hym, light review by Xavier Leroy) -- #12491, #12493, #12500, #12754: Do not change GC pace when creating - sub-arrays of bigarrays - (Xavier Leroy, report by Ido Yariv, analysis by Gabriel Scherer, - review by Gabriel Scherer and Fabrice Buoro) +* #12512: Add volatile casts to FFI macros to enforce memory model (technically + a breaking change although no opam package seemed broken by it.) + (Olivier Nicole, suggested by Guillaume Munch-Maccagnoni, review by Gabriel + Scherer and Xavier Leroy) ### Language features: @@ -361,7 +1952,7 @@ Some of those changes will benefit all OCaml packages. was made based on the type of `F`. With this patch, we now distinguish these two application forms; writing `F (struct end)` for a generative functor leads to new warning 73. - (Frederic Bour and Richard Eisenberg, review by Florian Angeletti) + (Frédéric Bour and Richard Eisenberg, review by Florian Angeletti) - #9975, #11365: Make empty types (`type t = |`) immediate. @@ -682,9 +2273,6 @@ Some of those changes will benefit all OCaml packages. - #11691, #11706: use __asm__ instead of asm for strict ISO C conformance (Xavier Leroy, report by Gregg Reynolds , review by Sadiq Jaffer) -- #11764: add prototypes to old-style C function definitions and declarations - (Antonin Décimo, review by Xavier Leroy) - - #11693: Remove use of C99 Variable Length Arrays (VLAs) in the runtime. (David Allsopp, review by Xavier Leroy, Guillaume Munch-Maccagnoni, Stefan Muenzel and Gabriel Scherer) @@ -753,11 +2341,6 @@ Some of those changes will benefit all OCaml packages. - #10856: Add location, attribute(s) visitors to Tast_mapper/Tast_iterator (Yan Dong, review by Nicolás Ojeda Bär and Gabriel Scherer) -- #11763, #11759, #11861: Enable stricter C compilation warnings, use - strict prototypes on primitives. - (Antonin Décimo, review by Xavier Leroy, David Allsopp and Sébastien - Hinderer) - - #11933: Use the correct machtype when reading the code pointer from closures (Nathanaëlle Courant, review by Gabriel Scherer and Vincent Laviron) @@ -794,10 +2377,6 @@ Some of those changes will benefit all OCaml packages. lists for simpler printing of manual references (Stefan Muenzel, review by Florian Angeletti) -- #12509: Use strict prototypes on primitives when generating a standalone - bytecode executable (`ocamlc -custom`). - (Antonin Décimo, review by Xavier Leroy) - ### Build system: - #11844: Reduce verbosity of `make` logs by printing program invocations in @@ -806,9 +2385,6 @@ Some of those changes will benefit all OCaml packages. (Xavier Leroy, Nicolás Ojeda Bär, review by Sébastien Hinderer) -- #11590: Allow installing to a destination path containing spaces. - (Élie Brami, review by Sébastien Hinderer and David Allsopp) - - #11243, #11248, #11268, #11420, #11675: merge the sub-makefiles into the root Makefile. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti) @@ -823,13 +2399,12 @@ Some of those changes will benefit all OCaml packages. with ZSTD support. (David Allsopp, review by Sébastien Hinderer) -- #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 - so that code sections remain readable, as needed for closure marshaling. - (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and - Sébastien Hinderer) - ### Bug fixes: +- #8813, #12029: In the toplevel, let the user type several phrases in one line + (Damien Doligez, report by Daniel Bünzli, review by Gabriel Scherer and + Wiktor Kuchta) + - #12062: fix runtime events consumer: when events are dropped they shouldn't be parsed. (Lucas Pluvinage) @@ -862,7 +2437,7 @@ Some of those changes will benefit all OCaml packages. - #11450, #12018: Fix erroneous functor error messages that were too eager to cast `struct end` functor arguments as unit modules in `F(struct end)`. - (Florian Angetti, review by Gabriel Scherer) + (Florian Angeletti, review by Gabriel Scherer) - #11643: Add missing test declaration to float_compare test, so that it will run. @@ -896,7 +2471,7 @@ Some of those changes will benefit all OCaml packages. - #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). Reserve the shadow store for the ABI in the c_stack_link struct instead of - explictly when calling C functions. This simultaneously reduces the number of + explicitly when calling C functions. This simultaneously reduces the number of stack pointer manipulations and also fixes a bug when calling noalloc functions where the shadow store was not being reserved. (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and @@ -931,7 +2506,7 @@ Some of those changes will benefit all OCaml packages. - #12075: auto-detect whether `ar` support @FILE arguments at configure-time to avoid using this feature with toolchains that do not support it (eg FreeBSD/Darwin). - (Nicolás Ojeda Bär, review by Xavier Leroy, David Allsop, Javier + (Nicolás Ojeda Bär, review by Xavier Leroy, David Allsopp, Javier Chávarri, Anil Madhavapeddy) - #12103, 12104: fix a concurrency memory-safety bug in Buffer @@ -1159,14 +2734,10 @@ OCaml 5.0.0 (15 December 2022) - #10972: ARM64 multicore support: OCaml & C stack separation; dynamic stack size checks; fiber and effects support. - (Tom Kelly and Xavier Leroy, review by KC Sivaramakrishnan, Xavier Leroy + (Tom Kelly and Xavier Leroy, review by KC Sivaramakrishnan, Xavier Leroy, Guillaume Munch-Maccagnoni, Eduardo Rafael, Stephen Dolan and Gabriel Scherer) -* #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems - (emitted for Linux in #8805) - (Hannes Mehnert, review by Nicolás Ojeda Bär) - ### Standard library: - #10742: Use LXM as the pseudo-random number generator for module Random. @@ -1250,7 +2821,7 @@ OCaml 5.0.0 (15 December 2022) - #11309, #11424, #11427, #11545: Add Domain.recommended_domain_count. (Christiano Haesbaert, Konstantin Belousov, review by David Allsopp, - KC Sivaramakrishnan, Gabriel Scherer, Nicolas Ojeda Bar) + KC Sivaramakrishnan, Gabriel Scherer, Nicolás Ojeda Bär) - #11461, #11466: Fix gethostbyaddr for IPv6 arguments and make it domain-safe (Olivier Nicole, Nicolás Ojeda Bär, David Allsopp and Xavier Leroy, @@ -1341,9 +2912,6 @@ OCaml 5.0.0 (15 December 2022) (Sébastien Hinderer, review by David Allsopp, Florian Angeletti and Xavier Leroy) -- #11184, #11670: Stop calling ranlib on created / installed libraries - (Sébastien Hinderer and Xavier Leroy, review by the same) - - #11253: Deprecate `ocaml script` and `ocamlnat` script where `script` has no extension and is an implicit basename. (David Allsopp, review by Florian Angeletti and Sébastien Hinderer) @@ -1416,22 +2984,11 @@ OCaml 5.0.0 (15 December 2022) - #11294: Switch minimum required autoconf to 2.71. (David Allsopp, review by Xavier Leroy) -- #11370, #11373: Don't pass CFLAGS to flexlink during configure. - (David Allsopp, report by William Hu, review by Xavier Leroy and - Sébastien Hinderer) - -- #11487: Thwart FMA test optimization during configure - (William Hu, review by David Allsopp and Sébastien Hinderer) - - #11097: Build native-code compilers on NetBSD/aarch64 (Kate Deplaix, review by Anil Madhavapeddy) ### Bug fixes: -- #10768, #11340: Fix typechecking regression when combining first class - modules and GADTs. - (Jacques Garrigue, report by François Thiré, review by Matthew Ryan) - - #10790: don't drop variance and injectivity annotations when pretty printing `with` constraints (for example, `with type +!'a t = ...`). (Florian Angeletti, report by Luke Maurer, review by Matthew Ryan and @@ -1472,22 +3029,6 @@ OCaml 5.0.0 (15 December 2022) socket and deadlock the parent. (Antonin Décimo, review by Xavier Leroy) -- #11194, #11609: Fix inconsistent type variable names in "unbound type var" - messages - (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and - Gabriel Scherer) - -- #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when - calling virtual methods introduced by constraining the self type from within - the class definition. - (Nicolás Ojeda Bär, review by Leo White) - -- #11263, #11267: caml/misc.h: check whether `_MSC_VER` is defined before using - it to ensure that the headers can always be used in code which turns on - -Wundef (or equivalent). - (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and - Sébastien Hinderer) - - #11289, #11405: fix some leaks on systhread termination (Fabrice Buoro, Enguerrand Decorne, Gabriel Scherer, review by Xavier Leroy and Florian Angeletti, report by Romain Beauxis) @@ -1503,6 +3044,111 @@ OCaml 5.0.0 (15 December 2022) of both shadowing warnings and the `-bin-annot` compiler flag. (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer) +- #11482, #11542: Fix random crash in large closure allocation + (Damien Doligez, report by Thierry Martinez and Vincent Laviron, review by + Xavier Leroy) + +- #11508, #11509: make Bytes.escaped domain-safe + (Christiano Haesbaert and Gabriel Scherer, + review by Xavier Leroy, + report by Jan Midtgaard and Tom Kelly) + +- #11576: Fix bug in Bigarray.Genarray.init in the the case of zero-dimensional + arrays. + (Nicolás Ojeda Bär, Jeremy Yallop, report by Masayuki Takeda, review by Jeremy + Yallop and Florian Angeletti) + +- #11587: Prevent integer comparison from being used on pointers + (Vincent Laviron, review by Gabriel Scherer) + +- #11662, #11673: fix a memory leak when using Dynlink, + the bug was only present in development version of OCaml 5. + (Stephen Dolan, report by Andre Maroneze, review by Gabriel Scherer) + + +OCaml 4.14 maintenance version +------------------------------ + +### Runtime system: + +- #11764, #12577: Add prototypes to old-style C function definitions + and declarations. + (Antonin Décimo, review by Xavier Leroy and Nick Barnes) + +- #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. + (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien + Hinderer and Nick Barnes) + +### Build system: + +- #11590: Allow installing to a destination path containing spaces. + (Élie Brami, review by Sébastien Hinderer and David Allsopp) + +- #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 + so that code sections remain readable, as needed for closure marshaling. + (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and + Sébastien Hinderer) + +- #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid + illegal instruction errors on certain CPUs. + (Michael Hendricks, review by Miod Vallat) + +### Bug fixes: + +- #12878: fix incorrect treatment of injectivity for private recursive types. + (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue) + +- #12971, #12974: fix an uncaught Ctype.Escape exception on some + invalid programs forming recursive types. + (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani) + +- #12264, #12289: Fix compact_allocate to avoid a pathological case + that causes very slow compaction. + (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer) + +* #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems + (emitted for Linux in #8805) + (Hannes Mehnert, review by Nicolás Ojeda Bär) + +- #13448, #13449: fix a code-generation bug on unsafe array accesses + at type int32, int64, nativeint, which has been introduced in OCaml 4.04. + (Gabriel Scherer, review by Nicolás Ojeda Bär and Vincent Laviron, + report by Raphaël Bocquet and Simon Cruanes) + +OCaml 4.14.1 (20 December 2022) +------------------------------ + +### Compiler user-interface and warnings: + +- #11184, #11670: Stop calling ranlib on created / installed libraries + (Sébastien Hinderer and Xavier Leroy, review by the same) + +### Build system: + +- #11370, #11373: Don't pass CFLAGS to flexlink during configure. + (David Allsopp, report by William Hu, review by Xavier Leroy and + Sébastien Hinderer) + +- #11487: Thwart FMA test optimization during configure + (William Hu, review by David Allsopp and Sébastien Hinderer) + +### Bug fixes: + +- #10768, #11340: Fix typechecking regression when combining first class + modules and GADTs. + (Jacques Garrigue, report by François Thiré, review by Matthew Ryan) + +- #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when + calling virtual methods introduced by constraining the self type from within + the class definition. + (Nicolás Ojeda Bär, review by Leo White) + +- #11263, #11267: caml/{memory,misc}.h: check whether `_MSC_VER` is defined + before using it to ensure that the headers can always be used in code which + turns on -Wundef (or equivalent). + (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and + Sébastien Hinderer) + - #11392, #11392: assertion failure with -rectypes and external definitions (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev) @@ -1513,34 +3159,21 @@ OCaml 5.0.0 (15 December 2022) mingw-w64 i686 port. (David Allsopp, review by Xavier Leroy and Sébastien Hinderer) -- #11482, #11542: Fix random crash in large closure allocation - (Damien Doligez, report by Thierry Martinez and Vincent Laviron, review by - Xavier Leroy) - -- #11508, #11509: make Bytes.escaped domain-safe - (Christiano Haesbaert and Gabriel Scherer, - review by Xavier Leroy, - report by Jan Midtgaard and Tom Kelly) +- #11489, #11496: More prudent deallocation of alternate signal stack + (Xavier Leroy, report by @rajdakin, review by Florian Angeletti) - #11516, #11524: Fix the `deprecated_mutable` attribute. (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti) -- #11576: Fix bug in Bigarray.Genarray.init in the the case of zero-dimensional - arrays. - (Nicolás Ojeda Bär, Jeremy Yallop, report by Masayuki Takeda, review by Jeremy - Yallop and Florian Angeletti) - -- #11587: Prevent integer comparison from being used on pointers - (Vincent Laviron, review by Gabriel Scherer) +- #11194, #11609: Fix inconsistent type variable names in "unbound type var" + messages + (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and + Gabriel Scherer) - #11622: Prevent stack overflow when printing a constructor or record mismatch error involving recursive types. (Florian Angeletti, review by Gabriel Scherer) -- #11662, #11673: fix a memory leak when using Dynlink, - the bug was only present in development version of OCaml 5. - (Stephen Dolan, report by Andre Maroneze, review by Gabriel Scherer) - - #11732: Ensure that types from packed modules are always generalised (Stephen Dolan and Leo White, review by Jacques Garrigue) @@ -1556,6 +3189,15 @@ OCaml 5.0.0 (15 December 2022) (Gabriel Scherer, review by Jacques Garrigue and Florian Angeletti, report by Yaron Minsky) +- #11768, #11788: Fix crash at start-up of bytecode programs in + no-naked-pointers mode caused by wrong initialization of caml_global_data + (Xavier Leroy, report by Etienne Millon, review by Gabriel Scherer) + +- #11803, #11808: on x86, the destination of an integer comparison must be + a register, it cannot be a stack slot. + (Vincent Laviron, review by Xavier Leroy, report by + Emilio Jesús Gallego Arias) + OCaml 4.14.0 (28 March 2022) ---------------------------- @@ -1674,7 +3316,7 @@ OCaml 4.14.0 (28 March 2022) * #10583, #10998: Add over 40 new functions in Seq. (François Pottier and Simon Cruanes, review by Nicolás Ojeda Bär, - Daniel Bünzli, Naëla Courant, Craig Ferguson, Wiktor Kuchta, + Daniel Bünzli, Nathanaëlle Courant, Craig Ferguson, Wiktor Kuchta, Xavier Leroy, Guillaume Munch-Maccagnoni, Raphaël Proust, Gabriel Scherer and Thierry Martinez) @@ -1786,7 +3428,7 @@ OCaml 4.14.0 (28 March 2022) (Dong An, review by Xavier Leroy and David Allsopp) - #10397: Document exceptions raised by Unix module functions on Windows - (Martin Jambon, review by Daniel Bünzli, David Alsopp, Damien Doligez, + (Martin Jambon, review by Daniel Bünzli, David Allsopp, Damien Doligez, Xavier Leroy, and Florian Angeletti) - #10589: Fix many typos (excess/inconsistent spaces) in the HTML manual. @@ -1853,7 +3495,7 @@ OCaml 4.14.0 (28 March 2022) - #8516: Change representation of class signatures (Leo White, review by Thomas Refis) -- #9444: -dtypedtree, print more explictly extra nodes in pattern ast. +- #9444: -dtypedtree, print more explicitly extra nodes in pattern ast. (Frédéric Bour, review by Gabriel Scherer) - #10337: Normalize type_expr nodes on access @@ -2176,7 +3818,7 @@ OCaml 4.13.0 (24 September 2021) A mostly-internal change that preserves more information in errors during type checking; most significantly, it split the errors from unification, moregen, and type equality into three different types. - (Antal Spector-Zabusky and Mekhrubon Tuarev, review by Leo White, + (Antal Spector-Zabusky and Mekhrubon Turaev, review by Leo White, Florian Angeletti, and Jacques Garrigue) - #9994: Make Types.type_expr a private type, and abstract marking mechanism @@ -2271,14 +3913,14 @@ OCaml 4.13.0 (24 September 2021) - #10250, #10266: Dynamically allocate alternate signal stacks to accommodate changes in Glibc 2.34. - (Xavier Leroy, reports by Tomasz Kłoczko and R.W.M. Jones, review by Anil + (Xavier Leroy, reports by Tomasz Kłoczko and Richard Jones, review by Anil Madhavapeddy, Stephen Dolan, and Florian Angeletti) ### Code generation and optimizations: - #1400: Add an optional invariants check on Cmm, which can be activated with the -dcmm-invariants flag - (Vincent Laviron, with help from Sebastien Hinderer, review by Stephen Dolan + (Vincent Laviron, with help from Sébastien Hinderer, review by Stephen Dolan and David Allsopp) - #9562, #367: Allow CSE of immutable loads across stores @@ -2314,7 +3956,7 @@ OCaml 4.13.0 (24 September 2021) - #9487, #9489: Add Random.full_int which allows 62-bit bounds on 64-bit systems. - (David Allsopp, request by Francois Berenger, review by Xavier Leroy and + (David Allsopp, request by François Berenger, review by Xavier Leroy and Damien Doligez) - #9961: Add Array.fold_left_map. @@ -2466,7 +4108,7 @@ OCaml 4.13.0 (24 September 2021) (Gabriel Scherer, review by Thomas Refis and Florian Angeletti) - #9827: Replace references with functions arguments in Simplif - (Anukriti Kumar, review by Vincent Laviron and David Allsop) + (Anukriti Kumar, review by Vincent Laviron and David Allsopp) - #10007: Driver.compile_common: when typing a .ml file, return the compilation unit signature (inferred or from the .cmi) in addition @@ -2728,7 +4370,7 @@ OCaml 4.13.0 (24 September 2021) - #10584, #10856: Standard Library documentation build no longer fails if optional libraries have been disabled. - (David Allsopp, report by Yuri Victorovich review by Florian Angeletti) + (David Allsopp, report by Yuri Victorovich, review by Florian Angeletti) - #10593: Fix untyping of patterns without named existential quantifiers. This bug was only present in the beta version of OCaml 4.13.0. @@ -2841,8 +4483,8 @@ OCaml 4.12.0 (24 February 2021) I/O locks are not held while it runs. A polling point was removed from caml_leave_blocking_section, and one added to caml_raise. (Stephen Dolan, review by Goswin von Brederlow, Xavier Leroy, Damien - Doligez, Anil Madhavapeddy, Guillaume Munch-Maccagnoni and Jacques- - Henri Jourdan) + Doligez, Anil Madhavapeddy, Guillaume Munch-Maccagnoni + and Jacques-Henri Jourdan) * #5154, #9569, #9734: Add `Val_none`, `Some_val`, `Is_none`, `Is_some`, `caml_alloc_some`, and `Tag_some`. As these macros are sometimes defined by @@ -2976,7 +4618,7 @@ OCaml 4.12.0 (24 February 2021) - #10050: update {PUSH,}OFFSETCLOSURE* bytecode instructions to match new representation for closures - (Nathanaël Courant, review by Xavier Leroy) + (Nathanaëlle Courant, review by Xavier Leroy) - #9728: Take advantage of the new closure representation to simplify the compaction algorithm and remove its dependence on the page table @@ -3275,7 +4917,7 @@ OCaml 4.12.0 (24 February 2021) report by Alex Fedoseev through Hongbo Zhang) - #9514: optimize pattern-matching exhaustivity analysis in the single-row case - (Gabriel Scherer, review by Stephen DOlan) + (Gabriel Scherer, review by Stephen Dolan) - #9442: refactor the implementation of the [@tailcall] attribute to allow for a structured attribute payload @@ -3308,7 +4950,7 @@ OCaml 4.12.0 (24 February 2021) not low (Chet Murthy, review by Florian Angeletti) - #9590: fix pprint of extension constructors (and exceptions) that rebind - (Chet Murthy, review by octachron@) + (Chet Murthy, review by Florian Angeletti) - #9963: Centralized tracking of frontend's global state (Frédéric Bour and Thomas Refis, review by Gabriel Scherer) @@ -3366,7 +5008,7 @@ OCaml 4.12.0 (24 February 2021) - #7902, #9556: Type-checker infers recursive type, even though -rectypes is off. - (Jacques Garrigue, report by Francois Pottier, review by Leo White) + (Jacques Garrigue, report by François Pottier, review by Leo White) - #8746: Hashtbl: Restore ongoing traversal status after filter_map_inplace (Mehdi Bouaziz, review by Alain Frisch) @@ -3772,7 +5414,7 @@ OCaml 4.11.0 (19 August 2020) (Glenn Slotte, review by Florian Angeletti) - #9410, #9422: replaced naive fibonacci example with gcd - (Anukriti Kumar, review by San Vu Ngoc, Florian Angeletti, Léo Andrès) + (Anukriti Kumar, review by San Vũ Ngọc, Florian Angeletti, Léo Andrès) - #9541: Add a documentation page for the instrumented runtime; additional changes to option names in the instrumented runtime. @@ -3870,7 +5512,7 @@ OCaml 4.11.0 (19 August 2020) Caml_inline to stop abuse of the inline keyword on MSVC and to help ensure that only static inline is used in the codebase (erroneous instance in runtime/win32.c removed). - (David Allsopp, review by Oliver Andrieu and Xavier Leroy) + (David Allsopp, review by Olivier Andrieu and Xavier Leroy) - #8934: Stop relying on location to track usage (Thomas Refis, review by Gabriel Radanne) @@ -3970,7 +5612,7 @@ OCaml 4.11.0 (19 August 2020) - #9011: Allow linking .cmxa files with no units on MSVC by not requiring the .lib file to be present. - (David Allsopp, report by Dimitry Bely, review by Xavier Leroy) + (David Allsopp, report by Dmitry Bely, review by Xavier Leroy) - #9064: Relax the level handling when unifying row fields (Leo White, review by Jacques Garrigue) @@ -4403,7 +6045,7 @@ OCaml 4.10.0 (21 February 2020) locate an `.ocamlinit` file. Reads an `$XDG_CONFIG_HOME/ocaml/init.ml` file before trying to lookup `~/.ocamlinit`. On Windows the behaviour is unchanged. - (Daniel C. Bünzli, review by David Allsopp, Armaël Guéneau and + (Daniel Bünzli, review by David Allsopp, Armaël Guéneau and Nicolás Ojeda Bär) - #9113: ocamldoc: fix the rendering of multi-line code blocks @@ -4411,7 +6053,7 @@ OCaml 4.10.0 (21 February 2020) (Gabriel Scherer, review by Florian Angeletti) - #9127, #9130: ocamldoc: fix the formatting of closing brace in record types. - (David Allsopp, report by San Vu Ngoc) + (David Allsopp, report by San Vũ Ngọc) - #9181: make objinfo work on Cygwin and look for the caml_plugin_header symbol in both the static and the dynamic symbol tables. @@ -4718,7 +6360,7 @@ OCaml 4.09.0 (19 September 2019) - #2112: Fix Thread.yield unfairness with busy threads yielding to each other. (Andrew Hunter, review by Jacques-Henri Jourdan, Spiros Eliopoulos, Stephen - Weeks, & Mark Shinwell) + Weeks, Mark Shinwell) - #7903, #2306: Make Thread.delay interruptible by signals again (Xavier Leroy, review by Jacques-Henri Jourdan and Edwin Török) @@ -5180,7 +6822,7 @@ OCaml 4.08.0 (13 June 2019) ### Other libraries: - #2533, #1839, #1949: added Unix.fsync - (Francois Berenger, Nicolás Ojeda Bär, review by Daniel Bünzli, David Allsopp + (François Berenger, Nicolás Ojeda Bär, review by Daniel Bünzli, David Allsopp and ygrek) - #1792, #7794: Add Unix.open_process_args{,_in,_out,_full} similar to @@ -5956,7 +7598,7 @@ OCaml 4.07.0 (10 July 2018) - #7528, #1500: add a Format.pp_set_geometry function to avoid memory effects in set_margin and set_max_indent. (Florian Angeletti, review by Richard Bonichon, Gabriel Radanne, - Gabiel Scherer and Pierre Weis) + Gabriel Scherer and Pierre Weis) - #7690, #1528: fix the float_of_string function for hexadecimal floats with very large values of the exponent. @@ -6110,15 +7752,15 @@ OCaml 4.07.0 (10 July 2018) (Hugo Heuzard, reviewed by Nicolás Ojeda Bär) - #1627: Reduce cmx sizes by sharing variable names (Flambda only). - (Fuyong Quah, Leo White, review by Xavier Clerc) + (Fu Yong Quah, Leo White, review by Xavier Clerc) - #1665: reduce the size of cmx files in classic mode by dropping the bodies of functions that will not be inlined. - (Fuyong Quah, review by Leo White and Pierre Chambart) + (Fu Yong Quah, review by Leo White and Pierre Chambart) - #1666: reduce the size of cmx files in classic mode by dropping the bodies of functions that cannot be reached from the module block. - (Fuyong Quah, review by Leo White and Pierre Chambart) + (Fu Yong Quah, review by Leo White and Pierre Chambart) - #1686: Turn off by default flambda invariants checks. (Pierre Chambart) @@ -6444,7 +8086,7 @@ OCaml 4.07.0 (10 July 2018) (Jacques Garrigue, report by kantian) - #7751, #1657: The toplevel prints some concrete types as abstract. - (Jacques Garrigue, report by Matej Kosik) + (Jacques Garrigue, report by Matej Košík) - #7765, #1718: When unmarshaling bigarrays, protect against integer overflows in size computations. @@ -6954,7 +8596,7 @@ OCaml 4.06.0 (3 Nov 2017): - #1012: ocamlyacc, fix parsing of raw strings and nested comments, as well as the handling of ' characters in identifiers. - (Demi Obenour) + (Demi Marie Obenour) - #1045: ocamldep, add a "-shared" option to generate dependencies for native plugin files (i.e. .cmxs files) @@ -7214,7 +8856,7 @@ OCaml 4.06.0 (3 Nov 2017): (Leo White) - #7261: Warn on type constraints in GADT declarations - (Jacques Garrigue, report by Fabrice Le Botlan) + (Jacques Garrigue, report by Didier Le Botlan) - #7321: Private type in signature clashes with type definition via functor instantiation @@ -7474,7 +9116,7 @@ OCaml 4.05.0 (13 Jul 2017): - #7279, #710: `Weak.get_copy` `Ephemeron.*_copy` doesn't copy custom blocks anymore - (François Bobot, Alain Frisch, bug reported by Martin R. Neuhäußer, + (François Bobot, Alain Frisch, report by Martin R. Neuhäußer, review by Thomas Braibant and Damien Doligez) * #7500, #1081: Remove Uchar.dump @@ -8136,7 +9778,7 @@ OCaml 4.04.0 (4 Nov 2016): - #427: Obj.is_block is now an inlined OCaml function instead of a C external. This should be faster. - (Demi Obenour) + (Demi Marie Obenour) - #580: Optimize immutable float records (Pierre Chambart, review by Mark Shinwell) @@ -8278,7 +9920,7 @@ OCaml 4.04.0 (4 Nov 2016): * #512, #587: Installed `ocamlc`, `ocamlopt`, and `ocamllex` are now the native-code versions of the tools, if those versions were built. - (Demi Obenour) + (Demi Marie Obenour) - #525: fix build on OpenIndiana (Sergey Avseyev, review by Damien Doligez) @@ -8580,9 +10222,9 @@ OCaml 4.03.0 (25 Apr 2016): (Alain Frisch) - #6943: native-code generator for POWER/PowerPC 64 bits, both in - big-endian (ppc64) and little-endian (ppc64le) configuration. - (Xavier Leroy, with inspiration from RedHat's unofficial ppc64 and ppc64le - ports) + big-endian (ppc64) and little-endian (ppc64le) configuration, + inspired from RedHat's unofficial ppc64 and ppc64le ports + (Xavier Leroy) - #6979: better code generation in x86-32 backend for copying floats to the stack @@ -8700,7 +10342,7 @@ OCaml 4.03.0 (25 Apr 2016): settings that are currently the default: `-alias-deps`, `-app-funct`, `-no-keep-docs`, `-no-keep-locs`, `-no-principal`, `-no-rectypes`, `-no-strict-formats` - (Demi Obenour) + (Demi Marie Obenour) - #545: use reraise to preserve backtrace on `match .. with exception e -> raise e` @@ -9297,7 +10939,7 @@ OCaml 4.03.0 (25 Apr 2016): - #220: minor -dsource error on recursive modules (Hongbo Zhang) -- #228: fix a dangling internal pointer in (bytecode )debug_info +- #228: fix a dangling internal pointer in (bytecode) debug_info (Gabriel Scherer and Mark Shinwell and Xavier Leroy) - #233: Make CamlinternalMod.init_mod robust to optimization @@ -9649,7 +11291,7 @@ Bug fixes: (Jacques Garrigue, report by David Sheets) - #6768: Typechecker overflow the stack on cyclic type (Jacques Garrigue, report by user 'darktenaibre') -- #6770: (duplicate of #6686) +- #6770: duplicate of #6686 - #6772: asmrun/signals_asm.c doesn't compile on NetBSD/i386 (Kenji Tokudome) - #6775: Digest.file leaks file descriptor on error @@ -10281,7 +11923,7 @@ Bug fixes: - #4788: wrong error message when executable file is not found for backtrace (Damien Doligez, report by Claudio Sacerdoti Coen) - #4812: otherlibs/unix: add extern int code_of_unix_error (value error); - (Goswin von Berdelow) + (Goswin von Brederlow) - #4887: input_char after close_in crashes ocaml (msvc runtime) (Alain Frisch and Christoph Bauer, report by ygrek) - #4994: ocaml-mode doesn't work with xemacs21 @@ -10311,7 +11953,7 @@ Bug fixes: - #5350: missing return code checks in the runtime system (Xavier Leroy) - #5468: ocamlbuild should preserve order of parametric tags - (Wojciech Meyer, report by Dario Texeira) + (Wojciech Meyer, report by Dario Teixeira) - #5551: Avoid repeated lookups for missing cmi files (Alain Frisch) - #5552: unrecognized gcc option -no-cpp-precomp @@ -10596,7 +12238,6 @@ Tools: - #6030: Improve performance of -annot (Guillaume Melquiond, Alain Frisch) - OCaml 4.00.1 (5 Oct 2012): -------------------------- @@ -13108,7 +14749,7 @@ Objective Caml 2.00 (19 Aug 1998): - Check for overflow when generating the tables for the automaton. - Error messages in generated .ml file now point to .mll source. - Added "let = " to name regular expressions - (inspired by Christian Lindig's patch). + (inspired by Christian Lindig). * ocamlyacc: - Better error recovery in presence of EOF tokens. diff --git a/ocaml/_doc-dir/README.adoc b/ocaml/_doc-dir/README.adoc index 8f4ca178..7e622fcd 100644 --- a/ocaml/_doc-dir/README.adoc +++ b/ocaml/_doc-dir/README.adoc @@ -1,23 +1,18 @@ -=== ⚠️ CAUTION - -The developer team released OCaml 5.0.0 in December 2022. This release sports a +[CAUTION] +==== +The developer team released OCaml 5.0.0 in December 2022. OCaml 5.x features a full rewrite of its runtime system for shared-memory parallel programming using domains and native support for concurrent programming using effect handlers. -Owing to the large number of changes, the initial 5.0 release is more -experimental than usual. It is recommended that all users wanting a stable -release use the 4.14 release which will continue to be supported and updated -while 5.x reaches feature and stability parity. Similarly, if you need one of -the ports not yet supported in the 5.0 release you must use the 4.14 release. - -The initial release of OCaml 5.0 only supports the native compiler under ARM64 -and x86-64 architectures under Linux, macOS and the BSDs. On Windows, only the -MinGW-w64 port is supported. Support for other 64-bit architectures and -systems will be added back in later releases. On 32-bit systems, only the -bytecode compiler will be supported. +Owing to the large number of changes, especially to the garbage collector, +OCaml 4.14 (the final release in the OCaml 4.x series, originally released in +March 2022) remains supported for the time being. Maintainers of existing +codebases are strongly encouraged to evaluate OCaml 5.x and to report any +performance degradations on our issue tracker. +==== |===== -| Branch `trunk` | Branch `5.0` | Branch `4.14` | Branch `4.13` +| Branch `trunk` | Branch `5.2` | Branch `5.1` | Branch `5.0` | Branch `4.14` | image:https://github.com/ocaml/ocaml/workflows/Build/badge.svg?branch=trunk["Github CI Build Status (trunk branch)", link="https://github.com/ocaml/ocaml/actions?query=workflow%3ABuild"] @@ -25,18 +20,22 @@ bytecode compiler will be supported. link="https://github.com/ocaml/ocaml/actions?query=workflow%3AHygiene"] image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=trunk&svg=true["AppVeyor Build Status (trunk branch)", link="https://ci.appveyor.com/project/avsm/ocaml"] +| image:https://github.com/ocaml/ocaml/workflows/Build/badge.svg?branch=5.2["Github CI Build Status (5.2 branch)", + link="https://github.com/ocaml/ocaml/actions?query=workflow%3ABuild"] + image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=5.2&svg=true["AppVeyor Build Status (5.2 branch)", + link="https://ci.appveyor.com/project/avsm/ocaml"] +| image:https://github.com/ocaml/ocaml/workflows/Build/badge.svg?branch=5.1["Github CI Build Status (5.1 branch)", + link="https://github.com/ocaml/ocaml/actions?query=workflow%3ABuild"] + image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=5.1&svg=true["AppVeyor Build Status (5.1 branch)", + link="https://ci.appveyor.com/project/avsm/ocaml"] | image:https://github.com/ocaml/ocaml/workflows/Build/badge.svg?branch=5.0["Github CI Build Status (5.0 branch)", link="https://github.com/ocaml/ocaml/actions?query=workflow%3ABuild"] image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=5.0&svg=true["AppVeyor Build Status (5.0 branch)", link="https://ci.appveyor.com/project/avsm/ocaml"] | image:https://github.com/ocaml/ocaml/workflows/Build/badge.svg?branch=4.14["Github CI Build Status (4.14 branch)", - link="https://github.com/ocaml/ocaml/actions?query=workflow%3Amain"] + link="https://github.com/ocaml/ocaml/actions?query=workflow%3ABuild"] image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=4.14&svg=true["AppVeyor Build Status (4.14 branch)", link="https://ci.appveyor.com/project/avsm/ocaml"] -| image:https://travis-ci.org/ocaml/ocaml.svg?branch=4.13["TravisCI Build Status (4.13 branch)", - link="https://travis-ci.org/ocaml/ocaml"] - image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=4.13&svg=true["AppVeyor Build Status (4.13 branch)", - link="https://ci.appveyor.com/project/avsm/ocaml"] |===== = README = @@ -64,9 +63,9 @@ compiler currently runs on the following platforms: |==== | | Tier 1 (actively maintained) | Tier 2 (maintained when possible) -| x86 64 bits | Linux, macOS, Windows, FreeBSD | NetBSD, OpenBSD -| ARM 64 bits | Linux, macOS | FreeBSD -| Power 64 bits | Linux | +| x86 64 bits | Linux, macOS, Windows, FreeBSD | NetBSD, OpenBSD, OmniOS (Solaris) +| ARM 64 bits | Linux, macOS | FreeBSD, OpenBSD, NetBSD +| Power 64 bits | Linux (little-endian, ABIv2) | Linux (big-endian, ABIv2) | RISC-V 64 bits | Linux | | IBM Z (s390x) | Linux | |==== @@ -74,11 +73,14 @@ compiler currently runs on the following platforms: Other operating systems for the processors above have not been tested, but the compiler may work under other operating systems with little work. +❗ From OCaml 5.0 onwards, native compilation is available only on 64-bit +systems. Native compilation on 32-bit systems is no longer available, nor +are there plans to bring it back. == Copyright All files marked "Copyright INRIA" in this distribution are -Copyright (C) 1996-2022 Institut National de Recherche en Informatique et +Copyright (C) 1996-2023 Institut National de Recherche en Informatique et en Automatique (INRIA) and distributed under the conditions stated in file LICENSE. @@ -93,7 +95,7 @@ Windows, see link:README.win32.adoc[]. The OCaml manual is distributed in HTML, PDF, and Emacs Info files. It is available at -https://ocaml.org/releases/latest/manual.html +https://ocaml.org/manual/latest/ == Availability @@ -101,6 +103,14 @@ The complete OCaml distribution can be accessed at https://ocaml.org/docs/install.html +== Releases + +More information about when and how new releases of OCaml are published is +available at link:release-info/introduction.md[], see also +link:release-info/calendar.md[] for a prospective calendar for future OCaml +versions. For past versions, link:release-info/News[] contains a short +description of major changes in previous versions. + == Keeping in Touch with the Caml Community There is an active and friendly discussion forum at @@ -116,10 +126,6 @@ You can subscribe and access list archives via the Web interface at https://sympa.inria.fr/sympa/subscribe/caml-list -An alternative archive of the mailing list is also available at - -https://inbox.ocaml.org/ - There also exist other mailing lists, chat channels, and various other forums around the internet for getting in touch with the OCaml and ML family language community. These can be accessed at @@ -138,20 +144,26 @@ To be effective, bug reports should include a complete program (preferably small) that exhibits the unexpected behavior, and the configuration you are using (machine type, etc). +== Contributing + For information on contributing to OCaml, see link:HACKING.adoc[] and link:CONTRIBUTING.md[]. == Separately maintained components Some libraries and tools which used to be part of the OCaml distribution are -now maintained separately. Please use the issue trackers at their respective -new homes: +now maintained separately and distributed as OPAM packages. +Please use the issue trackers at their respective new homes: -- https://github.com/ocaml/camlp-streams/issues[The Stream and Genlex standard library modules] (removed in OCaml 5.0) -- https://github.com/ocaml/graphics/issues[The Graphics library] (removed in OCaml 4.09) -- https://github.com/ocaml/num/issues[The Num library] (removed in OCaml 4.06) -- https://github.com/ocaml/ocamlbuild/issues[The OCamlbuild tool] (removed in OCaml 4.03) -- https://github.com/camlp4/camlp4/issues[The camlp4 tool] (removed in OCaml 4.02) -- https://github.com/garrigue/labltk/issues[The LablTk library] (removed in OCaml 4.02) -- https://github.com/ocaml/dbm/issues[The CamlDBM library] (removed in OCaml 4.00) -- https://github.com/xavierleroy/ocamltopwin/issues[The OCamlWinTop Windows toplevel] (removed in OCaml 4.00) +|==== +| Library | Removed since | OPAM package + +| https://github.com/ocaml/camlp-streams/issues[The Stream and Genlex standard library modules] | OCaml 5.0 | `camlp-streams` +| https://github.com/ocaml/graphics/issues[The Graphics library] | OCaml 4.09 | `graphics` +| https://github.com/ocaml/num/issues[The Num library] | OCaml 4.06 | `num` +| https://github.com/ocaml/ocamlbuild/issues[The OCamlbuild tool] | OCaml 4.03 | `ocamlbuild` +| https://github.com/camlp4/camlp4/issues[The camlp4 tool] | OCaml 4.02 | `camlp4` +| https://github.com/garrigue/labltk/issues[The LablTk library] | OCaml 4.02 | `labltk` +| https://github.com/ocaml/dbm/issues[The CamlDBM library] | OCaml 4.00 | `dbm` +| https://github.com/xavierleroy/ocamltopwin/issues[The OCamlWinTop Windows toplevel] | OCaml 4.00 | none +|===== diff --git a/ocaml/_doc-dir/README.win32.adoc b/ocaml/_doc-dir/README.win32.adoc index 3668526e..aa7cfd09 100644 --- a/ocaml/_doc-dir/README.win32.adoc +++ b/ocaml/_doc-dir/README.win32.adoc @@ -1,20 +1,3 @@ -=== ⚠️ CAUTION - -The developer team is currently preparing the release of OCaml 5.0. This release -sports a full rewrite of its runtime system for shared-memory parallel -programming using domains and native support for concurrent programming using -effect handlers. - -Owing to the large number of changes, the initial 5.0 release will be more -experimental than usual. It is recommended that all users wanting a stable -release use the 4.14 release which will continue to be supported and updated -while 5.0 reaches feature and stability parity. Similarly, if you need one of -the ports not yet supported in the 5.0 release you must use the 4.14 release. - -The MSVC port is presently not supported, but will hopefully be added back in -later releases. On 32-bit systems, only the bytecode compiler is supported. -Native-code support for these 32-bit systems is under discussion. - = Release notes for the Microsoft Windows ports of OCaml = :toc: macro @@ -23,7 +6,7 @@ available in 32 and 64-bit versions: - native Windows, built with the Microsoft C/C++ Optimizing Compiler - native Windows, built using the MinGW-w64 version of GCC - - Cygwin (http://www.cygwin.com[www.cygwin.com]) + - Cygwin (https://www.cygwin.com[https://www.cygwin.com]) Here is a summary of the main differences between these ports: @@ -31,7 +14,7 @@ Here is a summary of the main differences between these ports: | | Native Microsoft | Native MinGW-w64 | Cygwin 4+^| Third-party software required | for base bytecode system | none | none | none -| for `ocamlc -custom` | Microsoft Visual C++ | Cygwin | Cygwin +| for `ocamlc -custom` | Microsoft Visual C++ | Cygwin | Cygwin | for native-code generation | Microsoft Visual C++ | Cygwin | Cygwin 4+^| Features | Speed of bytecode interpreter | 70% | 100% | 100% @@ -44,7 +27,7 @@ Here is a summary of the main differences between these ports: [[tb1]] (*):: Executables generated by the native GCC package in Cygwin are linked with the Cygwin DLL and require this to be distributed with your programs. -Executables generated by Microsoft Visual C++ or the MinGW-w64 compilers (even +Executables generated by Microsoft Visual {cpp} or the MinGW-w64 compilers (even when run in Cygwin as `i686-w64-mingw32-gcc` or `x86_64-w64-mingw32-gcc`) are not linked against this DLL. Prior to Cygwin 2.5.2 (the Cygwin version can be obtained with `uname -r`) the Cygwin DLL is distributed under the GPL, requiring @@ -62,8 +45,8 @@ Cygwin aims to provide a Unix-like environment on Windows, and the build procedure for it is the same as for other flavours of Unix. See link:INSTALL.adoc[] for full instructions. -The native ports require Windows Vista or later and naturally the 64-bit versions -need a 64-bit edition of Windows (note that this is both to run *and* build). +OCaml requires Windows 8 or later and naturally the 64-bit versions need a +64-bit edition of Windows (note that this is both to run *and* build). The two native Windows ports have to be built differently, and the remainder of this document gives more information. @@ -84,14 +67,14 @@ Unless you are also compiling the Cygwin port of OCaml, you do not need the [[bmflex]] In addition to Cygwin, FlexDLL must also be installed, which is available from -https://github.com/alainfrisch/flexdll. A binary distribution is available; +https://github.com/ocaml/flexdll. A binary distribution is available; instructions on how to build FlexDLL from sources, including how to bootstrap FlexDLL and OCaml are given <>. Unless you bootstrap FlexDLL, you will need to ensure that the directory to which you install FlexDLL is included in your `PATH` environment variable. Note: binary distributions of FlexDLL are compatible only with Visual Studio 2013 and -earlier; for Visual Studio 2015 and later, you will need to compile the C -objects from source, or configure ocaml with the `--with-flexdll` option. +earlier; for the MSVC port of OCaml, you will need to compile the C objects from +source, or configure ocaml with the `--with-flexdll` option. The base bytecode system (ocamlc, ocaml, ocamllex, ocamlyacc, ...) of all three ports runs without any additional tools. @@ -104,21 +87,19 @@ The native-code compiler (`ocamlopt`) and static linking of OCaml bytecode with C code (`ocamlc -custom`) require a Microsoft Visual C/C++ Compiler and the `flexlink` tool (see <>). -Any edition (including Express/Community editions) of Microsoft Visual Studio -2008 or later may be used to provide the required Windows headers and the C -compiler. Additionally, some older Microsoft Windows SDKs include the -Visual C/C++ Compiler as well as the Build Tools for Visual Studio. +The OCaml runtime requires C11 atomics, which are available in +Visual Studio 2022 (starting from release 17.8). Earlier versions (either of +Visual Studio 2022 17.7 and earlier or Visual Studio 2019 and earlier) cannot +be used to compile OCaml. In addition to the paid versions of Visual Studio, +OCaml can be compiled with either Visual Studio 2022 Community or Build Tools +for Visual Studio 2022. The following components are needed (the precise version +numbers may differ, but this should not matter): + + - MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) _for compiling with cl_ + - C++ Clang Compiler for Windows (16.0.5) _for compiling with clang-cl_ + - C++/CLI support for v143 build tools (Latest) + - Windows 11 SDK (10.0.22621.0) -|===== -| | `cl` Version | Express | SDK/Build Tools -| Visual Studio 2008 | 15.00.x.x | 32-bit only | Windows SDK 7.0 also provides 32/64-bit compilers -| Visual Studio 2010 | 16.00.x.x | 32-bit only | Windows SDK 7.1 also provides 32/64-bit compilers -| Visual Studio 2012 | 17.00.x.x | 32/64-bit | -| Visual Studio 2013 | 18.00.x.x | 32/64-bit | -| Visual Studio 2015 | 19.00.x.x | 32/64-bit | Build Tools for Visual Studio 2015 also provides 32/64-bit compilers -| Visual Studio 2017 | 19.10.x.x | 32/64-bit | Build Tools for Visual Studio 2017 also provides 32/64-bit compilers -| Visual Studio 2019 | 19.20.x.x | 32/64-bit | Build Tools for Visual Studio 2019 also provides 32/64-bit compilers -|===== === COMPILATION FROM THE SOURCES @@ -130,62 +111,21 @@ the WinZip Options Window.) Microsoft Visual C/C++ is designed to be used from special developer mode Command Prompts which set the environment variables for the required compiler. -There are multiple ways of setting up your environment ready for their use. The -simplest is to start the appropriate command prompt shortcut from the program -group of the compiler you have installed. - -The details differ depending on whether you are using a Windows SDK to provide -the compiler or Microsoft Visual Studio itself. - -For the Windows SDK, there is only one command prompt called "CMD Shell" in -versions 6.1 and 7.0 and "Windows SDK 7.1 Command Prompt" in version 7.1. This -launches a Command Prompt which will usually select a `DEBUG` build environment -for the operating system that you are running. You should then run: - - SetEnv /Release /x86 - -for 32-bit or: - - SetEnv /Release /x64 - -for 64-bit. For Visual Studio 2008-2013, you need to use one of the shortcuts in -the "Visual Studio Tools" program group under the main program group for the -version of Visual Studio you installed. For Visual Studio 2015 and 2017, you -need to use the shortcuts in the "Windows Desktop Command Prompts" (2015) or -"VC" (2017) group under the "Visual Studio Tools" group. - -Unlike `SetEnv` for the Windows SDK, the architecture is selected by using a -different shortcut, rather than by running a command. - -For Visual Studio 2008-2010, excluding version-specific prefixes, these are -named "Command Prompt" for 32-bit and "x64 Cross Tools Command Prompt" or -"x64 Win64 Command Prompt" for 64-bit. It does not matter whether you use a -"Cross Tools" or "Win64" version for x64, this simply refers to whether the -compiler itself is a 32-bit or 64-bit program; both produce 64-bit output and -work with OCaml. - -For Visual Studio 2012 and 2013, both x86 and x64 Command Prompt shortcuts -indicate if they are the "Native Tools" or "Cross Tools" versions. Visual Studio -2015 and 2017 make the shortcuts even clearer by including the full name of the -architecture. - -The Build Tools for Visual Studio 2015 and 2017 provide shortcuts similar to -the ones of their respective Visual Studio version. - -You cannot at present use a cross-compiler to compile 64-bit OCaml on 32-bit -Windows. +The easiest way to access these is via the "Visual Studio 2022" group added to +the Start Menu by the installer, for example using the +"x64 Native Tools Command Prompt for VS 2022" shortcut. Once you have started a Command Prompt, you can verify that you have the compiler you are expecting simply by running: cl - Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86 + Microsoft (R) C/C++ Optimizing Compiler Version 19.38.33133 for x64 ... You then need to start Cygwin from this Command Prompt. Assuming you have -installed it to its default location of `C:\cygwin`, simply run: +installed it to its default location of `C:\cygwin64`, simply run: - C:\cygwin\bin\mintty - + C:\cygwin64\bin\mintty - (note the space and hyphen at the end of the command). @@ -204,15 +144,15 @@ the top-level of the OCaml distribution by running: If you forget to do this, `make` will fail relatively quickly as it will be unable to link `ocamlrun`. -Now run: - - ./configure --build=x86_64-pc-cygwin --host=i686-pc-windows - -for 32-bit, or: +For 64-bit, now run: ./configure --build=x86_64-pc-cygwin --host=x86_64-pc-windows -for 64-bit. +or, for 32-bit: + + ./configure --build=x86_64-pc-cygwin --host=i686-pc-windows + +If you wish to compile with Clang, add `CC=clang-cl`. Finally, use `make` to build the system, e.g. @@ -258,8 +198,8 @@ package for 64-bit. - The Cygwin version of flexdll does not work with this port. - The standalone mingw toolchain from the MinGW-w64 project - (http://mingw-w64.org/) is not supported. Please use the version packaged in - Cygwin instead. + (https://www.mingw-w64.org/) is not supported. Please use the version + packaged in Cygwin instead. === COMPILATION FROM THE SOURCES @@ -269,15 +209,13 @@ The command-line tools must be compiled from the Unix source distribution use WinZip, you will need to deselect "TAR file smart CR/LF conversion" in the WinZip Options Window.) -Now run: - - ./configure --build=x86_64-pc-cygwin --host=i686-w64-mingw32 - -for 32-bit, or: +For 64-bit, now run: ./configure --build=x86_64-pc-cygwin --host=x86_64-w64-mingw32 -for 64-bit. +or, for 32-bit: + + ./configure --build=x86_64-pc-cygwin --host=i686-w64-mingw32 Finally, use `make` to build the system, e.g. @@ -286,7 +224,8 @@ Finally, use `make` to build the system, e.g. After installing, you will need to ensure that `ocamlopt` (or `ocamlc -custom`) can access the C compiler. You can do this either by using OCaml from Cygwin's -bash or by adding Cygwin's bin directory (e.g. `C:\cygwin\bin`) to your `PATH`. +bash or by adding Cygwin's bin directory (e.g. `C:\cygwin64\bin`) to your +`PATH`. * Libraries available in this port: `dynlink`, `num`, `str`, `threads`, and large parts of `unix`. @@ -307,10 +246,10 @@ You must extract the FlexDLL sources for Version 0.35 or later in the directory done in one of three ways: * Extracting the sources from a tarball from - https://github.com/alainfrisch/flexdll/releases + https://github.com/ocaml/flexdll/releases * Cloning the git repository by running: + - git clone https://github.com/alainfrisch/flexdll.git + git clone https://github.com/ocaml/flexdll.git * If you are compiling from a git clone of the OCaml repository, instead of using a sources tarball, you can run: @@ -339,10 +278,10 @@ OCaml adds to this legacy mode a new "Unicode" mode, where filenames are UTF-8 encoded strings. In addition to filenames, this applies to environment variables and command-line arguments. -The mode must be decided before building the system, by tweaking -the `WINDOWS_UNICODE` variable in `Makefile.config`. A value of 1 -enables the the new "Unicode" mode, while a value of 0 maintains -the legacy mode. +The mode must be decided before building the system, by tweaking the +`WINDOWS_UNICODE_MODE` environment variable when calling `configure`. +The default, or a value of `compatible`, enables the new "Unicode" +mode, while a value of `ansi` maintains the legacy mode. Technically, both modes use the Windows "wide" API, where filenames and other strings are made of 16-bit entities, usually interpreted as diff --git a/ocaml/index.html b/ocaml/index.html index 858a0237..8bbc4bde 100644 --- a/ocaml/index.html +++ b/ocaml/index.html @@ -1,2 +1,2 @@ -index (ocaml.index)

      Package ocaml

      Stdlib

      Threads

      • Event First-class synchronous communication.
      • Thread Lightweight threads for Posix 1003.1c and Win32.

      Compiler libs

      Package info

      changes-files
      license-files
      readme-files
      +index (ocaml.index)

      Package ocaml

      Stdlib

      Threads

      • Event First-class synchronous communication.
      • Thread Lightweight threads for Posix 1003.1c and Win32.

      Compiler libs

      Package info

      changes-files
      license-files
      readme-files
      diff --git a/tiny_httpd/Tiny_httpd_core/Atomic_/index.html b/tiny_httpd/Tiny_httpd_core/Atomic_/index.html index a02c5118..7a3a5666 100644 --- a/tiny_httpd/Tiny_httpd_core/Atomic_/index.html +++ b/tiny_httpd/Tiny_httpd_core/Atomic_/index.html @@ -1,5 +1,5 @@ -Atomic_ (tiny_httpd.Tiny_httpd_core.Atomic_)

      Module Tiny_httpd_core.Atomic_

      include module type of struct include Stdlib.Atomic end
      type !'a t = 'a Stdlib.Atomic.t

      An atomic (mutable) reference to a value of type 'a.

      val make : 'a -> 'a t

      Create an atomic reference.

      val get : 'a t -> 'a

      Get the current value of the atomic reference.

      val set : 'a t -> 'a -> unit

      Set a new value for the atomic reference.

      val exchange : 'a t -> 'a -> 'a

      Set a new value for the atomic reference, and return the current value.

      val compare_and_set : 'a t -> 'a -> 'a -> bool

      compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

      val fetch_and_add : int t -> int -> int

      fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

      val incr : int t -> unit

      incr r atomically increments the value of r by 1.

      val decr : int t -> unit

      decr r atomically decrements the value of r by 1.

      Examples

      Basic Thread Coordination

      A basic use case is to have global counters that are updated in a thread-safe way, for example to keep some sorts of metrics over IOs performed by the program. Another basic use case is to coordinate the termination of threads in a given program, for example when one thread finds an answer, or when the program is shut down by the user.

      Here, for example, we're going to try to find a number whose hash satisfies a basic property. To do that, we'll run multiple threads which will try random numbers until they find one that works.

      Of course the output below is a sample run and will change every time the program is run.

      (* use for termination *)
      +Atomic_ (tiny_httpd.Tiny_httpd_core.Atomic_)

      Module Tiny_httpd_core.Atomic_

      include module type of struct include Stdlib.Atomic end
      type !'a t = 'a Stdlib.Atomic.t

      An atomic (mutable) reference to a value of type 'a.

      val make : 'a -> 'a t

      Create an atomic reference.

      val make_contended : 'a -> 'a t

      Create an atomic reference that is alone on a cache line. It occupies 4-16x the memory of one allocated with make v.

      The primary purpose is to prevent false-sharing and the resulting performance degradation. When a CPU performs an atomic operation, it temporarily takes ownership of an entire cache line that contains the atomic reference. If multiple atomic references share the same cache line, modifying these disjoint memory regions simultaneously becomes impossible, which can create a bottleneck. Hence, as a general guideline, if an atomic reference is experiencing contention, assigning it its own cache line may enhance performance.

      val get : 'a t -> 'a

      Get the current value of the atomic reference.

      val set : 'a t -> 'a -> unit

      Set a new value for the atomic reference.

      val exchange : 'a t -> 'a -> 'a

      Set a new value for the atomic reference, and return the current value.

      val compare_and_set : 'a t -> 'a -> 'a -> bool

      compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

      val fetch_and_add : int t -> int -> int

      fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

      val incr : int t -> unit

      incr r atomically increments the value of r by 1.

      val decr : int t -> unit

      decr r atomically decrements the value of r by 1.

      Examples

      Basic Thread Coordination

      A basic use case is to have global counters that are updated in a thread-safe way, for example to keep some sorts of metrics over IOs performed by the program. Another basic use case is to coordinate the termination of threads in a given program, for example when one thread finds an answer, or when the program is shut down by the user.

      Here, for example, we're going to try to find a number whose hash satisfies a basic property. To do that, we'll run multiple threads which will try random numbers until they find one that works.

      Of course the output below is a sample run and will change every time the program is run.

      (* use for termination *)
       let stop_all_threads = Atomic.make false
       
       (* total number of individual attempts to find a number *)
      diff --git a/tiny_httpd/Tiny_httpd_core/Route/index.html b/tiny_httpd/Tiny_httpd_core/Route/index.html
      index fb32c176..97d4b976 100644
      --- a/tiny_httpd/Tiny_httpd_core/Route/index.html
      +++ b/tiny_httpd/Tiny_httpd_core/Route/index.html
      @@ -1,2 +1,2 @@
       
      -Route (tiny_httpd.Tiny_httpd_core.Route)

      Module Tiny_httpd_core.Route

      Routing

      Basic type-safe routing of handlers based on URL paths. This is optional, it is possible to only define the root handler with something like Routes.

      • since 0.6
      type ('a, 'b) comp

      An atomic component of a path

      type ('a, 'b) t

      A route, composed of path components

      val int : (int -> 'a, 'a) comp

      Matches an integer.

      val string : (string -> 'a, 'a) comp

      Matches a string not containing '/' and binds it as is.

      val string_urlencoded : (string -> 'a, 'a) comp

      Matches a URL-encoded string, and decodes it.

      val exact : string -> ('a, 'a) comp

      exact "s" matches "s" and nothing else.

      val return : ('a, 'a) t

      Matches the empty path.

      val rest_of_path : (string -> 'a, 'a) t

      Matches a string, even containing '/'. This will match the entirety of the remaining route.

      • since 0.7
      val rest_of_path_urlencoded : (string -> 'a, 'a) t

      Matches a string, even containing '/', an URL-decode it. This will match the entirety of the remaining route.

      • since 0.7
      val (@/) : ('a, 'b) comp -> ('b, 'c) t -> ('a, 'c) t

      comp / route matches "foo/bar/…" iff comp matches "foo", and route matches "bar/…".

      val exact_path : string -> ('a, 'b) t -> ('a, 'b) t

      exact_path "foo/bar/..." r is equivalent to exact "foo" @/ exact "bar" @/ ... @/ r

      • since 0.11 *
      val pp : Stdlib.Format.formatter -> (_, _) t -> unit

      Print the route.

      • since 0.7
      val to_string : (_, _) t -> string

      Print the route.

      • since 0.7
      module Private_ : sig ... end
      +Route (tiny_httpd.Tiny_httpd_core.Route)

      Module Tiny_httpd_core.Route

      Routing

      Basic type-safe routing of handlers based on URL paths. This is optional, it is possible to only define the root handler with something like Routes.

      • since 0.6
      type ('a, 'b) comp

      An atomic component of a path

      type ('a, 'b) t

      A route, composed of path components

      val int : (int -> 'a, 'a) comp

      Matches an integer.

      val string : (string -> 'a, 'a) comp

      Matches a string not containing '/' and binds it as is.

      val string_urlencoded : (string -> 'a, 'a) comp

      Matches a URL-encoded string, and decodes it.

      val exact : string -> ('a, 'a) comp

      exact "s" matches "s" and nothing else.

      val return : ('a, 'a) t

      Matches the empty path.

      val rest_of_path : (string -> 'a, 'a) t

      Matches a string, even containing '/'. This will match the entirety of the remaining route.

      • since 0.7
      val rest_of_path_urlencoded : (string -> 'a, 'a) t

      Matches a string, even containing '/', and URL-decode it (piecewise). This will match the entirety of the remaining route.

      • since 0.7
      val (@/) : ('a, 'b) comp -> ('b, 'c) t -> ('a, 'c) t

      comp / route matches "foo/bar/…" iff comp matches "foo", and route matches "bar/…".

      val exact_path : string -> ('a, 'b) t -> ('a, 'b) t

      exact_path "foo/bar/..." r is equivalent to exact "foo" @/ exact "bar" @/ ... @/ r

      • since 0.11 *
      val pp : Stdlib.Format.formatter -> (_, _) t -> unit

      Print the route.

      • since 0.7
      val to_string : (_, _) t -> string

      Print the route.

      • since 0.7
      module Private_ : sig ... end