OCaml compiler library : Misc

`sig
val fatal_error : string -> 'a
val fatal_errorf :
('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a
exception Fatal_error
val try_finally :
?always:(unit -> unit) ->
?exceptionally:(unit -> unit) -> (unit -> 'a) -> 'a
val reraise_preserving_backtrace : exn -> (unit -> unit) -> 'a
val map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list
val rev_map_end : ('a -> 'b) -> 'a list -> 'b list -> 'b list
val map_left_right : ('a -> 'b) -> 'a list -> 'b list
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val replicate_list : 'a -> int -> 'a list
val list_remove : 'a -> 'a list -> 'a list
val split_last : 'a list -> 'a list * 'a
val repeated_label : (string option * 'a) list -> string option
val create_hashtable : int -> ('a * 'b) list -> ('a, 'b) Stdlib.Hashtbl.t
module Stdlib :
sig
module List :
sig
type 'a t = 'a list
val compare :
('a -> 'a -> int) ->
'a Misc.Stdlib.List.t -> 'a Misc.Stdlib.List.t -> int
val equal :
('a -> 'a -> bool) ->
'a Misc.Stdlib.List.t -> 'a Misc.Stdlib.List.t -> bool
val some_if_all_elements_are_some :
'a option Misc.Stdlib.List.t -> 'a Misc.Stdlib.List.t option
val map2_prefix :
('a -> 'b -> 'c) ->
'a Misc.Stdlib.List.t ->
'b Misc.Stdlib.List.t ->
'c Misc.Stdlib.List.t * 'b Misc.Stdlib.List.t
val iteri2 :
(int -> 'a -> 'b -> unit) -> 'a list -> 'b list -> unit
val split_at :
int ->
'a Misc.Stdlib.List.t ->
'a Misc.Stdlib.List.t * 'a Misc.Stdlib.List.t
val chunks_of :
int ->
'a Misc.Stdlib.List.t -> 'a Misc.Stdlib.List.t Misc.Stdlib.List.t
val is_prefix :
equal:('a -> 'a -> bool) -> 'a list -> of_:'a list -> bool
type 'a longest_common_prefix_result = private {
longest_common_prefix : 'a list;
first_without_longest_common_prefix : 'a list;
second_without_longest_common_prefix : 'a list;
}
val find_and_chop_longest_common_prefix :
equal:('a -> 'a -> bool) ->
first:'a list ->
second:'a list ->
'a Misc.Stdlib.List.longest_common_prefix_result
end
module Option :
sig
type 'a t = 'a option
val print :
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter -> 'a Misc.Stdlib.Option.t -> unit
end
module Array :
sig
val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val for_alli : (int -> 'a -> bool) -> 'a array -> bool
val all_somes : 'a option array -> 'a array option
end
module String :
sig
type t = string
val make : int -> char -> string
val init : int -> (int -> char) -> string
val empty : string
external length : string -> int = "%string_length"
external get : string -> int -> char = "%string_safe_get"
val of_bytes : bytes -> string
val to_bytes : string -> bytes
val blit : string -> int -> bytes -> int -> int -> unit
val concat : string -> string list -> string
val cat : string -> string -> string
val equal : t -> t -> bool
val compare : t -> t -> int
val starts_with : prefix:string -> string -> bool
val ends_with : suffix:string -> string -> bool
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val contains : string -> char -> bool
val sub : string -> int -> int -> string
val split_on_char : char -> string -> string list
val map : (char -> char) -> string -> string
val mapi : (int -> char -> char) -> string -> string
val fold_left : ('acc -> char -> 'acc) -> 'acc -> string -> 'acc
val fold_right : (char -> 'acc -> 'acc) -> string -> 'acc -> 'acc
val exists : (char -> bool) -> string -> bool
val trim : string -> string
val escaped : string -> string
val uppercase_ascii : string -> string
val lowercase_ascii : string -> string
val capitalize_ascii : string -> string
val uncapitalize_ascii : string -> string
val iter : (char -> unit) -> string -> unit
val iteri : (int -> char -> unit) -> string -> unit
val index_from : string -> int -> char -> int
val index_from_opt : string -> int -> char -> int option
val rindex_from : string -> int -> char -> int
val rindex_from_opt : string -> int -> char -> int option
val index : string -> char -> int
val index_opt : string -> char -> int option
val rindex : string -> char -> int
val rindex_opt : string -> char -> int option
val to_seq : t -> char Seq.t
val to_seqi : t -> (int * char) Seq.t
val of_seq : char Seq.t -> t
val get_utf_8_uchar : t -> int -> Uchar.utf_decode
val is_valid_utf_8 : t -> bool
val get_utf_16be_uchar : t -> int -> Uchar.utf_decode
val is_valid_utf_16be : t -> bool
val get_utf_16le_uchar : t -> int -> Uchar.utf_decode
val is_valid_utf_16le : t -> bool
val edit_distance : ?limit:int -> t -> t -> int
val spellcheck :
?max_dist:(string -> int) ->
((string -> unit) -> unit) -> string -> string list
val get_uint8 : string -> int -> int
val get_int8 : string -> int -> int
val get_uint16_ne : string -> int -> int
val get_uint16_be : string -> int -> int
val get_uint16_le : string -> int -> int
val get_int16_ne : string -> int -> int
val get_int16_be : string -> int -> int
val get_int16_le : string -> int -> int
val get_int32_ne : string -> int -> int32
val hash : t -> int
val seeded_hash : int -> t -> int
val get_int32_be : string -> int -> int32
val get_int32_le : string -> int -> int32
val get_int64_ne : string -> int -> int64
val get_int64_be : string -> int -> int64
val get_int64_le : string -> int -> int64
external unsafe_get : string -> int -> char = "%string_unsafe_get"
external unsafe_blit : string -> int -> bytes -> int -> int -> unit
= "caml_blit_string" [@@noalloc]
module Set :
sig
type elt = string
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_list : t -> elt list
val of_list : elt list -> t
val to_seq_from : elt -> t -> elt Seq.t
val to_seq : t -> elt Seq.t
val to_rev_seq : t -> elt Seq.t
val add_seq : elt Seq.t -> t -> t
val of_seq : elt Seq.t -> t
end
module Map :
sig
type key = string
type +!'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge :
(key -> 'a option -> 'b option -> 'c option) ->
'a t -> 'b t -> 'c t
val union :
(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) Seq.t
val to_rev_seq : 'a t -> (key * 'a) Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t
val of_seq : (key * 'a) Seq.t -> 'a t
end
module Tbl :
sig
type key = string
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val filter_map_inplace :
(key -> 'a -> 'a option) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val length : 'a t -> int
val stats : 'a t -> Stdlib__Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Seq.t
val to_seq_keys : 'a t -> key Seq.t
val to_seq_values : 'a t -> 'a Seq.t
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
end
val print : Stdlib.Format.formatter -> t -> unit
val for_all : (char -> bool) -> t -> bool
end
external compare : 'a -> 'a -> int = "%compare"
end
val find_in_path : string list -> string -> string
val find_in_path_rel : string list -> string -> string
val normalized_unit_filename : string -> (string, string) Stdlib.Result.t
val find_in_path_normalized : string list -> string -> string
val remove_file : string -> unit
val expand_directory : string -> string -> string
val split_path_contents : ?sep:char -> string -> string list
val copy_file : Stdlib.in_channel -> Stdlib.out_channel -> unit
val copy_file_chunk :
Stdlib.in_channel -> Stdlib.out_channel -> int -> unit
val string_of_file : Stdlib.in_channel -> string
val output_to_file_via_temporary :
?mode:Stdlib.open_flag list ->
string -> (string -> Stdlib.out_channel -> 'a) -> 'a
val protect_writing_to_file :
filename:string -> f:(Stdlib.out_channel -> 'a) -> 'a
val concat_null_terminated : string list -> string
val split_null_terminated : string -> string list
val chop_extensions : string -> string
val log2 : int -> int
val align : int -> int -> int
val no_overflow_add : int -> int -> bool
val no_overflow_sub : int -> int -> bool
val no_overflow_mul : int -> int -> bool
val no_overflow_lsl : int -> int -> bool
val letter_of_int : int -> string
module Int_literal_converter :
sig
val int : string -> int
val int32 : string -> int32
val int64 : string -> int64
val nativeint : string -> nativeint
end
val find_first_mono : (int -> bool) -> int
val search_substring : string -> string -> int -> int
val replace_substring : before:string -> after:string -> string -> string
val rev_split_words : string -> string list
val cut_at : string -> char -> string * string
val ordinal_suffix : int -> string
val normalise_eol : string -> string
val delete_eol_spaces : string -> string
type ref_and_value = R : 'a Stdlib.ref * 'a -> Misc.ref_and_value
val protect_refs : Misc.ref_and_value list -> (unit -> 'a) -> 'a
val get_ref : 'a list Stdlib.ref -> 'a list
val set_or_ignore : ('a -> 'b option) -> 'b option Stdlib.ref -> 'a -> unit
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
val edit_distance : string -> string -> int -> int option
val spellcheck : string list -> string -> string list
val align_hint :
prefix:string ->
main:Format_doc.t -> hint:Format_doc.t -> Format_doc.t * Format_doc.t
val align_error_hint :
main:Format_doc.t -> hint:Format_doc.t -> Format_doc.t * Format_doc.t
val aligned_hint :
prefix:string ->
Format_doc.formatter ->
('a, Format_doc.formatter, unit, Format_doc.t option -> unit)
Stdlib.format4 -> 'a
val did_you_mean :
?pp:string Format_doc.printer -> string list -> Format_doc.t option
module Color :
sig
type setting = Auto | Always | Never
val default_setting : Misc.Color.setting
val is_enabled : unit -> bool
end
module Style :
sig
type color =
Black
| Red
| Green
| Yellow
| Blue
| Magenta
| Cyan
| White
type style =
FG of Misc.Style.color
| BG of Misc.Style.color
| Bold
| Reset
type Stdlib.Format.stag += Style of Misc.Style.style list
val ansi_of_style_l : Misc.Style.style list -> string
type tag_style = {
ansi : Misc.Style.style list;
text_open : string;
text_close : string;
}
type styles = {
error : Misc.Style.tag_style;
warning : Misc.Style.tag_style;
loc : Misc.Style.tag_style;
hint : Misc.Style.tag_style;
inline_code : Misc.Style.tag_style;
}
val hint : Format_doc.formatter -> unit
val as_inline_code : 'a Format_doc.printer -> 'a Format_doc.printer
val inline_code : string Format_doc.printer
val default_styles : Misc.Style.styles
val get_styles : unit -> Misc.Style.styles
val set_styles : Misc.Style.styles -> unit
val setup : Misc.Color.setting option -> unit
val set_tag_handling : Stdlib.Format.formatter -> unit
end
module Error_style :
sig
type setting = Contextual | Short
val default_setting : Misc.Error_style.setting
end
val print_if :
Stdlib.Format.formatter ->
bool Stdlib.ref -> (Stdlib.Format.formatter -> 'a -> unit) -> 'a -> 'a
val print_see_manual : int list Format_doc.printer
val show_config_and_exit : unit -> unit
val show_config_variable_and_exit : string -> unit
val get_build_path_prefix_map : unit -> Build_path_prefix_map.map option
val debug_prefix_map_flags : unit -> string list
module Magic_number :
sig
type native_obj_config = { flambda : bool; }
val native_obj_config : Misc.Magic_number.native_obj_config
type version = int
type kind =
Exec
| Cmi
| Cmo
| Cma
| Cmx of Misc.Magic_number.native_obj_config
| Cmxa of Misc.Magic_number.native_obj_config
| Cmxs
| Cmt
| Ast_impl
| Ast_intf
type info = {
kind : Misc.Magic_number.kind;
version : Misc.Magic_number.version;
}
type raw = string
type parse_error = Truncated of string | Not_a_magic_number of string
val explain_parse_error :
Misc.Magic_number.kind option ->
Misc.Magic_number.parse_error -> string
val parse :
Misc.Magic_number.raw ->
(Misc.Magic_number.info, Misc.Magic_number.parse_error) Stdlib.result
val read_info :
Stdlib.in_channel ->
(Misc.Magic_number.info, Misc.Magic_number.parse_error) Stdlib.result
val magic_length : int
type 'a unexpected = { expected : 'a; actual : 'a; }
type unexpected_error =
Kind of Misc.Magic_number.kind Misc.Magic_number.unexpected
| Version of Misc.Magic_number.kind *
Misc.Magic_number.version Misc.Magic_number.unexpected
val check_current :
Misc.Magic_number.kind ->
Misc.Magic_number.info ->
(unit, Misc.Magic_number.unexpected_error) Stdlib.result
val explain_unexpected_error :
Misc.Magic_number.unexpected_error -> string
type error =
Parse_error of Misc.Magic_number.parse_error
| Unexpected_error of Misc.Magic_number.unexpected_error
val read_current_info :
expected_kind:Misc.Magic_number.kind option ->
Stdlib.in_channel ->
(Misc.Magic_number.info, Misc.Magic_number.error) Stdlib.result
val string_of_kind : Misc.Magic_number.kind -> string
val human_name_of_kind : Misc.Magic_number.kind -> string
val current_raw : Misc.Magic_number.kind -> Misc.Magic_number.raw
val current_version :
Misc.Magic_number.kind -> Misc.Magic_number.version
type raw_kind = string
val parse_kind :
Misc.Magic_number.raw_kind -> Misc.Magic_number.kind option
val raw_kind : Misc.Magic_number.kind -> Misc.Magic_number.raw_kind
val raw : Misc.Magic_number.info -> Misc.Magic_number.raw
val all_kinds : Misc.Magic_number.kind list
end
module Utf8_lexeme :
sig
type t = string
val normalize :
string -> (Misc.Utf8_lexeme.t, Misc.Utf8_lexeme.t) Stdlib.Result.t
val capitalize :
string -> (Misc.Utf8_lexeme.t, Misc.Utf8_lexeme.t) Stdlib.Result.t
val uncapitalize :
string -> (Misc.Utf8_lexeme.t, Misc.Utf8_lexeme.t) Stdlib.Result.t
val is_capitalized : Misc.Utf8_lexeme.t -> bool
val is_valid_identifier : Misc.Utf8_lexeme.t -> bool
val is_lowercase : Misc.Utf8_lexeme.t -> bool
type validation_result =
Valid
| Invalid_character of Stdlib.Uchar.t
| Invalid_beginning of Stdlib.Uchar.t
val validate_identifier :
?with_dot:bool ->
Misc.Utf8_lexeme.t -> Misc.Utf8_lexeme.validation_result
val starts_like_a_valid_identifier : Misc.Utf8_lexeme.t -> bool
end
type filepath = string
type modname = string
type crcs = (Misc.modname * Stdlib.Digest.t option) list
type alerts = string Misc.Stdlib.String.Map.t
end`