diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/.depend | 18 | ||||
-rwxr-xr-x | stdlib/Compflags | 5 | ||||
-rwxr-xr-x | stdlib/Makefile.shared | 17 | ||||
-rw-r--r-- | stdlib/arg.mli | 4 | ||||
-rw-r--r-- | stdlib/camlinternalMod.ml | 5 | ||||
-rw-r--r-- | stdlib/camlinternalMod.mli | 1 | ||||
-rw-r--r-- | stdlib/camlinternalOO.ml | 5 | ||||
-rw-r--r-- | stdlib/format.mli | 44 | ||||
-rw-r--r-- | stdlib/gc.mli | 7 | ||||
-rw-r--r-- | stdlib/hashtbl.mli | 3 | ||||
-rw-r--r-- | stdlib/pervasives.ml | 4 | ||||
-rw-r--r-- | stdlib/scanf.mli | 34 | ||||
-rw-r--r-- | stdlib/stdLabels.mli | 123 |
13 files changed, 82 insertions, 188 deletions
diff --git a/stdlib/.depend b/stdlib/.depend index 5d0147afe4..e5b65ad513 100644 --- a/stdlib/.depend +++ b/stdlib/.depend @@ -36,7 +36,7 @@ scanf.cmi : pervasives.cmi set.cmi : sort.cmi : stack.cmi : -stdLabels.cmi : +stdLabels.cmi : stringLabels.cmi listLabels.cmi arrayLabels.cmi stream.cmi : string.cmi : stringLabels.cmi : @@ -61,15 +61,15 @@ camlinternalMod.cmo : obj.cmi camlinternalOO.cmi array.cmi \ camlinternalMod.cmx : obj.cmx camlinternalOO.cmx array.cmx \ camlinternalMod.cmi camlinternalOO.cmo : sys.cmi string.cmi obj.cmi map.cmi list.cmi char.cmi \ - callback.cmi array.cmi camlinternalOO.cmi + array.cmi camlinternalOO.cmi camlinternalOO.cmx : sys.cmx string.cmx obj.cmx map.cmx list.cmx char.cmx \ - callback.cmx array.cmx camlinternalOO.cmi + array.cmx camlinternalOO.cmi char.cmo : char.cmi char.cmx : char.cmi complex.cmo : complex.cmi complex.cmx : complex.cmi -digest.cmo : string.cmi printf.cmi char.cmi digest.cmi -digest.cmx : string.cmx printf.cmx char.cmx digest.cmi +digest.cmo : string.cmi char.cmi digest.cmi +digest.cmx : string.cmx char.cmx digest.cmi filename.cmo : sys.cmi string.cmi random.cmi printf.cmi lazy.cmi buffer.cmi \ filename.cmi filename.cmx : sys.cmx string.cmx random.cmx printf.cmx lazy.cmx buffer.cmx \ @@ -171,15 +171,15 @@ camlinternalMod.cmo : obj.cmi camlinternalOO.cmi array.cmi \ camlinternalMod.p.cmx : obj.p.cmx camlinternalOO.p.cmx array.p.cmx \ camlinternalMod.cmi camlinternalOO.cmo : sys.cmi string.cmi obj.cmi map.cmi list.cmi char.cmi \ - callback.cmi array.cmi camlinternalOO.cmi + array.cmi camlinternalOO.cmi camlinternalOO.p.cmx : sys.p.cmx string.p.cmx obj.p.cmx map.p.cmx list.p.cmx char.p.cmx \ - callback.p.cmx array.p.cmx camlinternalOO.cmi + array.p.cmx camlinternalOO.cmi char.cmo : char.cmi char.p.cmx : char.cmi complex.cmo : complex.cmi complex.p.cmx : complex.cmi -digest.cmo : string.cmi printf.cmi char.cmi digest.cmi -digest.p.cmx : string.p.cmx printf.p.cmx char.p.cmx digest.cmi +digest.cmo : string.cmi char.cmi digest.cmi +digest.p.cmx : string.p.cmx char.p.cmx digest.cmi filename.cmo : sys.cmi string.cmi random.cmi printf.cmi lazy.cmi buffer.cmi \ filename.cmi filename.p.cmx : sys.p.cmx string.p.cmx random.p.cmx printf.p.cmx lazy.p.cmx buffer.p.cmx \ diff --git a/stdlib/Compflags b/stdlib/Compflags index 707487fd02..d0938af89a 100755 --- a/stdlib/Compflags +++ b/stdlib/Compflags @@ -20,9 +20,6 @@ case $1 in # make sure add_char is inlined (PR#5872) buffer.cm[io]|printf.cm[io]|format.cm[io]|scanf.cm[io]) echo ' -w A';; scanf.cmx|scanf.p.cmx) echo ' -inline 9';; - arrayLabels.cm[ox]|arrayLabels.p.cmx) echo ' -nolabels';; - listLabels.cm[ox]|listLabels.p.cmx) echo ' -nolabels';; - stringLabels.cm[ox]|stringLabels.p.cmx) echo ' -nolabels';; - moreLabels.cm[ox]|moreLabels.p.cmx) echo ' -nolabels';; + *Labels.cm[ox]|*Labels.p.cmx) echo ' -nolabels -trans-mod';; *) echo ' ';; esac diff --git a/stdlib/Makefile.shared b/stdlib/Makefile.shared index bb2ef88fda..80c40d6002 100755 --- a/stdlib/Makefile.shared +++ b/stdlib/Makefile.shared @@ -12,10 +12,13 @@ ######################################################################### include ../config/Makefile -CAMLC=$(CAMLC_BIN) -COMPFLAGS=-strict-sequence -w +33..39 -g -warn-error A -nostdlib -CAMLOPT=$(CAMLOPT_BIN) -OPTCOMPFLAGS=-warn-error A -nostdlib -g +RUNTIME=../boot/ocamlrun +COMPILER=../ocamlc +CAMLC=$(RUNTIME) $(COMPILER) +COMPFLAGS=-strict-sequence -w +33..39 -g -warn-error A -bin-annot -nostdlib +OPTCOMPILER=../ocamlopt +CAMLOPT=$(RUNTIME) $(OPTCOMPILER) +OPTCOMPFLAGS=-warn-error A -nostdlib -g -bin-annot CAMLDEP=../boot/ocamlrun ../tools/ocamldep OBJS=pervasives.cmo $(OTHERS) @@ -75,6 +78,12 @@ clean:: .ml.p.cmx: $(CAMLOPT) $(OPTCOMPFLAGS) `./Compflags $@` -p -c -o $*.p.cmx $< +# Dependencies on the compiler +$(OBJS) std_exit.cmo: $(COMPILER) +$(OBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER) +$(OBJS:.cmo=.cmx) std_exit.cmx: $(OPTCOMPILER) +$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: $(OPTCOMPILER) + # Dependencies on Pervasives (not tracked by ocamldep) $(OBJS) std_exit.cmo: pervasives.cmi $(OTHERS:.cmo=.cmi) std_exit.cmi: pervasives.cmi diff --git a/stdlib/arg.mli b/stdlib/arg.mli index 869d030e2c..e6e07316dc 100644 --- a/stdlib/arg.mli +++ b/stdlib/arg.mli @@ -94,7 +94,7 @@ val parse : *) val parse_dynamic : - (string * spec * string) list ref -> anon_fun -> string -> unit + (key * spec * doc) list ref -> anon_fun -> string -> unit (** Same as {!Arg.parse}, except that the [speclist] argument is a reference and may be updated during the parsing. A typical use for this feature is to parse command lines of the form: @@ -116,7 +116,7 @@ val parse_argv : ?current: int ref -> string array -> *) val parse_argv_dynamic : ?current:int ref -> string array -> - (string * spec * string) list ref -> anon_fun -> string -> unit + (key * spec * doc) list ref -> anon_fun -> string -> unit (** Same as {!Arg.parse_argv}, except that the [speclist] argument is a reference and may be updated during the parsing. See {!Arg.parse_dynamic}. diff --git a/stdlib/camlinternalMod.ml b/stdlib/camlinternalMod.ml index 20a65207f0..5f1882a2b4 100644 --- a/stdlib/camlinternalMod.ml +++ b/stdlib/camlinternalMod.ml @@ -16,6 +16,7 @@ type shape = | Lazy | Class | Module of shape array + | Value of Obj.t let rec init_mod loc shape = match shape with @@ -32,6 +33,8 @@ let rec init_mod loc shape = Obj.repr (CamlinternalOO.dummy_class loc) | Module comps -> Obj.repr (Array.map (init_mod loc) comps) + | Value v -> + v let overwrite o n = assert (Obj.size o >= Obj.size n); @@ -64,3 +67,5 @@ let rec update_mod shape o n = for i = 0 to Array.length comps - 1 do update_mod comps.(i) (Obj.field o i) (Obj.field n i) done + | Value v -> + overwrite o n diff --git a/stdlib/camlinternalMod.mli b/stdlib/camlinternalMod.mli index 4ec4fde1f2..96535d0e3a 100644 --- a/stdlib/camlinternalMod.mli +++ b/stdlib/camlinternalMod.mli @@ -20,6 +20,7 @@ type shape = | Lazy | Class | Module of shape array + | Value of Obj.t val init_mod: string * int * int -> shape -> Obj.t val update_mod: shape -> Obj.t -> Obj.t -> unit diff --git a/stdlib/camlinternalOO.ml b/stdlib/camlinternalOO.ml index c085096668..872a56065b 100644 --- a/stdlib/camlinternalOO.ml +++ b/stdlib/camlinternalOO.ml @@ -403,9 +403,12 @@ type tables = Empty | Cons of closure * tables * tables type mut_tables = {key: closure; mutable data: tables; mutable next: tables} external mut : tables -> mut_tables = "%identity" +external demut : mut_tables -> tables = "%identity" let build_path n keys tables = - let res = Cons (Obj.magic 0, Empty, Empty) in + (* Be careful not to create a seemingly immutable block, otherwise it could + be statically allocated. See #5779. *) + let res = demut {key = Obj.magic 0; data = Empty; next = Empty} in let r = ref res in for i = 0 to n do r := Cons (keys.(i), !r, Empty) diff --git a/stdlib/format.mli b/stdlib/format.mli index 1d8662bc6d..e7cbe506e6 100644 --- a/stdlib/format.mli +++ b/stdlib/format.mli @@ -381,21 +381,21 @@ type formatter_out_functions = { ;; val set_formatter_out_functions : formatter_out_functions -> unit;; -(** [set_formatter_out_functions out_funs] - Redirect the pretty-printer output to the functions [out_funs.out_string] - and [out_funs.out_flush] as described in +(** [set_formatter_out_functions f] + Redirect the pretty-printer output to the functions [f.out_string] + and [f.out_flush] as described in [set_formatter_output_functions]. In addition, the pretty-printer function - that outputs a newline is set to the function [out_funs.out_newline] and + that outputs a newline is set to the function [f.out_newline] and the function that outputs indentation spaces is set to the function - [out_funs.out_spaces]. + [f.out_spaces]. This way, you can change the meaning of indentation (which can be something else than just printing space characters) and the meaning of new lines opening (which can be connected to any other action needed by the - application at hand). The two functions [out_spaces] and [out_newline] are - normally connected to [out_string] and [out_flush]: respective default - values for [out_space] and [out_newline] are - [out_string (String.make n ' ') 0 n] and [out_string "\n" 0 1]. *) + application at hand). The two functions [f.out_spaces] and [f.out_newline] + are normally connected to [f.out_string] and [f.out_flush]: respective + default values for [f.out_space] and [f.out_newline] are + [f.out_string (String.make n ' ') 0 n] and [f.out_string "\n" 0 1]. *) val get_formatter_out_functions : unit -> formatter_out_functions;; (** Return the current output functions of the pretty-printer, @@ -567,14 +567,14 @@ val pp_get_formatter_out_functions : (** {6 Convenience formatting functions.} *) val pp_print_list: - ?pp_sep:(formatter -> unit -> unit) -> + ?pp_sep:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> (formatter -> 'a list -> unit) (** [pp_print_list ?pp_sep pp_v ppf l] prints the list [l]. [pp_v] is used on the elements of [l] and each element is separated by a call to [pp_sep] (defaults to {!pp_print_cut}). Does nothing on empty lists. - @since 4.02 + @since 4.02.0 *) val pp_print_text : formatter -> string -> unit @@ -582,7 +582,7 @@ val pp_print_text : formatter -> string -> unit respectively printed with {!pp_print_space} and {!pp_force_newline}. - @since 4.02 + @since 4.02.0 *) (** {6 [printf] like functions for pretty-printing.} *) @@ -652,9 +652,7 @@ val fprintf : formatter -> ('a, formatter, unit) format -> 'a;; It prints [x = 1] within a pretty-printing box. Note: If you need to prevent the interpretation of a [@] character as a - pretty-printing indication, escape it with a [%] character, as usual in - format strings. - @since 3.12.2 + pretty-printing indication, you can also escape it with a [%] character. *) @@ -717,14 +715,14 @@ val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b;; (** {6 Deprecated} *) val bprintf : Buffer.t -> ('a, formatter, unit) format -> 'a;; -(** A deprecated and error prone function. Do not use it. +(** @deprecated This function is error prone. Do not use it. If you need to print to some buffer [b], you must first define a formatter writing to [b], using [let to_b = formatter_of_buffer b]; then use regular calls to [Format.fprintf] on formatter [to_b]. *) val kprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b;; -(** A deprecated synonym for [ksprintf]. *) +(** @deprecated An alias for [ksprintf]. *) val set_all_formatter_output_functions : out:(string -> int -> int -> unit) -> @@ -733,8 +731,7 @@ val set_all_formatter_output_functions : spaces:(int -> unit) -> unit ;; -(** Deprecated. Subsumed by [set_formatter_out_functions]. - @since 4.00.0 +(** @deprecated Subsumed by [set_formatter_out_functions]. *) val get_all_formatter_output_functions : @@ -744,15 +741,13 @@ val get_all_formatter_output_functions : (unit -> unit) * (int -> unit) ;; -(** Deprecated. Subsumed by [get_formatter_out_functions]. - @since 4.00.0 +(** @deprecated Subsumed by [get_formatter_out_functions]. *) val pp_set_all_formatter_output_functions : formatter -> out:(string -> int -> int -> unit) -> flush:(unit -> unit) -> newline:(unit -> unit) -> spaces:(int -> unit) -> unit ;; -(** Deprecated. Subsumed by [pp_set_formatter_out_functions]. - @since 4.01.0 +(** @deprecated Subsumed by [pp_set_formatter_out_functions]. *) val pp_get_all_formatter_output_functions : @@ -760,6 +755,5 @@ val pp_get_all_formatter_output_functions : (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) * (int -> unit) ;; -(** Deprecated. Subsumed by [pp_get_formatter_out_functions]. - @since 4.01.0 +(** @deprecated Subsumed by [pp_get_formatter_out_functions]. *) diff --git a/stdlib/gc.mli b/stdlib/gc.mli index 5437ac0a44..d2f2d97611 100644 --- a/stdlib/gc.mli +++ b/stdlib/gc.mli @@ -86,8 +86,11 @@ type control = this parameter will trigger a minor collection. Default: 32k. *) mutable major_heap_increment : int; - (** The minimum number of words to add to the - major heap when increasing it. Default: 124k. *) + (** 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. *) mutable space_overhead : int; (** The major GC speed is computed from this parameter. diff --git a/stdlib/hashtbl.mli b/stdlib/hashtbl.mli index bb75751fe6..5424df40d1 100644 --- a/stdlib/hashtbl.mli +++ b/stdlib/hashtbl.mli @@ -68,7 +68,8 @@ val clear : ('a, 'b) t -> unit val reset : ('a, 'b) t -> unit (** Empty a hash table and shrink the size of the bucket table - to its initial size. *) + to its initial size. + @since 4.00.0 *) val copy : ('a, 'b) t -> ('a, 'b) t (** Return a copy of the given hashtable. *) diff --git a/stdlib/pervasives.ml b/stdlib/pervasives.ml index 43e23cc525..e4a07c3dea 100644 --- a/stdlib/pervasives.ml +++ b/stdlib/pervasives.ml @@ -85,8 +85,8 @@ external ( lsl ) : int -> int -> int = "%lslint" external ( lsr ) : int -> int -> int = "%lsrint" external ( asr ) : int -> int -> int = "%asrint" -let min_int = 1 lsl (if 1 lsl 31 = 0 then 30 else 62) -let max_int = min_int - 1 +let max_int = (-1) lsr 1 +let min_int = max_int + 1 (* Floating-point operations *) diff --git a/stdlib/scanf.mli b/stdlib/scanf.mli index 43bd3d05cb..a1b3d1acbf 100644 --- a/stdlib/scanf.mli +++ b/stdlib/scanf.mli @@ -322,30 +322,30 @@ val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner;; the format specified by the second letter for regular integers. - [Ld], [Li], [Lu], [Lx], [LX], [Lo]: reads an [int64] argument to the format specified by the second letter for regular integers. - - [\[ range \]]: reads characters that matches one of the characters + - [[ range ]]: reads characters that matches one of the characters mentioned in the range of characters [range] (or not mentioned in it, if the range starts with [^]). Reads a [string] that can be empty, if the next input character does not match the range. The set of characters from [c1] to [c2] (inclusively) is denoted by [c1-c2]. - Hence, [%\[0-9\]] returns a string representing a decimal number + Hence, [%[0-9]] returns a string representing a decimal number or an empty string if no decimal digit is found; similarly, - [%\[\\048-\\057\\065-\\070\]] returns a string of hexadecimal digits. + [%[0-9a-f]] returns a string of hexadecimal digits. If a closing bracket appears in a range, it must occur as the first character of the range (or just after the [^] in case of - range negation); hence [\[\]\]] matches a [\]] character and - [\[^\]\]] matches any character that is not [\]]. - Use [%%] and [%\@] to include a [%] or a [\@] in a range. + range negation); hence [[\]]] matches a [\]] character and + [[^\]]] matches any character that is not [\]]. + Use [%%] and [%@] to include a [%] or a [@] in a range. - [r]: user-defined reader. Takes the next [ri] formatted input function and applies it to the scanning buffer [ib] to read the next argument. The input function [ri] must therefore have type [Scanning.in_channel -> 'a] and the argument read has type ['a]. - - [\{ fmt %\}]: reads a format string argument. The format string + - [{ fmt %}]: reads a format string argument. The format string read must have the same type as the format string specification [fmt]. For instance, ["%{ %i %}"] reads any format string that can read a value of type [int]; hence, if [s] is the string ["fmt:\"number is %u\""], then [Scanf.sscanf s "fmt: %{%i%}"] succeeds and returns the format string ["number is %u"]. - - [\( fmt %\)]: scanning sub-format substitution. + - [( fmt %)]: scanning sub-format substitution. Reads a format string [rf] in the input, then goes on scanning with [rf] instead of scanning with [fmt]. The format string [rf] must have the same type as the format string @@ -357,21 +357,19 @@ val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner;; Hence, if [s] is the string ["\"%4d\"1234.00"], then [Scanf.sscanf s "%(%i%)" (fun fmt i -> fmt, i)] evaluates to [("%4d", 1234)]. - This behaviour is not mere format substitution, since the conversion returns the format string read as additional argument. If you need pure format substitution, use special flag [_] to discard the - extraneous argument: conversion [%_\( fmt %\)] reads a format string + extraneous argument: conversion [%_( fmt %)] reads a format string [rf] and then behaves the same as format string [rf]. Hence, if [s] is the string ["\"%4d\"1234.00"], then [Scanf.sscanf s "%_(%i%)"] is simply equivalent to [Scanf.sscanf "1234.00" "%4d"]. - - [l]: returns the number of lines read so far. - [n]: returns the number of characters read so far. - [N] or [L]: returns the number of tokens read so far. - [!]: matches the end of input condition. - [%]: matches one [%] character in the input. - - [\@]: matches one [\@] character in the input. + - [@]: matches one [@] character in the input. - [,]: does nothing. Following the [%] character that introduces a conversion, there may be @@ -383,7 +381,7 @@ val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner;; The field width is composed of an optional integer literal indicating the maximal width of the token to read. For instance, [%6d] reads an integer, having at most 6 decimal digits; - [%4f] reads a float with at most 4 characters; and [%8[\\000-\\255]] + [%4f] reads a float with at most 4 characters; and [%8[\000-\255]] returns the next 8 characters (or all the characters still available, if fewer than 8 characters are available in the input). @@ -408,18 +406,18 @@ val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner;; (** Scanning indications appear just after the string conversions [%s] and [%[ range ]] to delimit the end of the token. A scanning - indication is introduced by a [\@] character, followed by some + indication is introduced by a [@] character, followed by some plain character [c]. It means that the string token should end just before the next matching [c] (which is skipped). If no [c] character is encountered, the string token spreads as much as possible. For instance, ["%s@\t"] reads a string up to the next - tab character or to the end of input. If a [\@] character appears + tab character or to the end of input. If a [@] character appears anywhere else in the format string, it is treated as a plain character. Note: - - As usual in format strings, [%] and [\@] characters must be escaped - using [%%] and [%\@]; this rule still holds within range specifications + - As usual in format strings, [%] and [@] characters must be escaped + using [%%] and [%@]; this rule still holds within range specifications and scanning indications. For instance, ["%s@%%"] reads a string up to the next [%] character. - The scanning indications introduce slight differences in the syntax of @@ -428,7 +426,7 @@ val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner;; the [Format] module; hence, when producing formatted text to be scanned by [!Scanf.bscanf], it is wise to use printing functions from the [Format] module (or, if you need to use functions from [Printf], banish - or carefully double check the format strings that contain ['\@'] + or carefully double check the format strings that contain ['@'] characters). *) diff --git a/stdlib/stdLabels.mli b/stdlib/stdLabels.mli index bf9ef6547a..144936f170 100644 --- a/stdlib/stdLabels.mli +++ b/stdlib/stdLabels.mli @@ -20,123 +20,6 @@ in [arrayLabels.mli], [listLabels.mli] and [stringLabels.mli]. *) -module Array : - sig - external length : 'a array -> int = "%array_length" - external get : 'a array -> int -> 'a = "%array_safe_get" - external set : 'a array -> int -> 'a -> unit = "%array_safe_set" - external make : int -> 'a -> 'a array = "caml_make_vect" - external create : int -> 'a -> 'a array = "caml_make_vect" - val init : int -> f:(int -> 'a) -> 'a array - val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array - val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array - val append : 'a array -> 'a array -> 'a array - val concat : 'a array list -> 'a array - val sub : 'a array -> pos:int -> len:int -> 'a array - val copy : 'a array -> 'a array - val fill : 'a array -> pos:int -> len:int -> 'a -> unit - val blit : - src:'a array -> src_pos:int -> dst:'a array -> dst_pos:int -> len:int -> - unit - val to_list : 'a array -> 'a list - val of_list : 'a list -> 'a array - val iter : f:('a -> unit) -> 'a array -> unit - val map : f:('a -> 'b) -> 'a array -> 'b array - val iteri : f:(int -> 'a -> unit) -> 'a array -> unit - val mapi : f:(int -> 'a -> 'b) -> 'a array -> 'b array - val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b array -> 'a - val fold_right : f:('a -> 'b -> 'b) -> 'a array -> init:'b -> 'b - val sort : cmp:('a -> 'a -> int) -> 'a array -> unit - val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit - val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit - external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get" - external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" - end - -module List : - sig - val length : 'a list -> int - val hd : 'a list -> 'a - val tl : 'a list -> 'a list - val nth : 'a list -> int -> 'a - val rev : 'a list -> 'a list - val append : 'a list -> 'a list -> 'a list - val rev_append : 'a list -> 'a list -> 'a list - val concat : 'a list list -> 'a list - val flatten : 'a list list -> 'a list - val iter : f:('a -> unit) -> 'a list -> unit - val map : f:('a -> 'b) -> 'a list -> 'b list - val rev_map : f:('a -> 'b) -> 'a list -> 'b list - val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b list -> 'a - val fold_right : f:('a -> 'b -> 'b) -> 'a list -> init:'b -> 'b - val iter2 : f:('a -> 'b -> unit) -> 'a list -> 'b list -> unit - val map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list - val rev_map2 : f:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list - val fold_left2 : - f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b list -> 'c list -> 'a - val fold_right2 : - f:('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> init:'c -> 'c - val for_all : f:('a -> bool) -> 'a list -> bool - val exists : f:('a -> bool) -> 'a list -> bool - val for_all2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool - val exists2 : f:('a -> 'b -> bool) -> 'a list -> 'b list -> bool - val mem : 'a -> set:'a list -> bool - val memq : 'a -> set:'a list -> bool - val find : f:('a -> bool) -> 'a list -> 'a - val filter : f:('a -> bool) -> 'a list -> 'a list - val find_all : f:('a -> bool) -> 'a list -> 'a list - val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list - val assoc : 'a -> ('a * 'b) list -> 'b - val assq : 'a -> ('a * 'b) list -> 'b - val mem_assoc : 'a -> map:('a * 'b) list -> bool - val mem_assq : 'a -> map:('a * 'b) list -> bool - val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list - val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list - val split : ('a * 'b) list -> 'a list * 'b list - val combine : 'a list -> 'b list -> ('a * 'b) list - val sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list - val stable_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list - val fast_sort : cmp:('a -> 'a -> int) -> 'a list -> 'a list - val merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list - end - -module String : - sig - external length : string -> int = "%string_length" - external get : string -> int -> char = "%string_safe_get" - external set : string -> int -> char -> unit = "%string_safe_set" - external create : int -> string = "caml_create_string" - val make : int -> char -> string - val copy : string -> string - val sub : string -> pos:int -> len:int -> string - val fill : string -> pos:int -> len:int -> char -> unit - val blit : - src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int -> - unit - val concat : sep:string -> string list -> string - val iter : f:(char -> unit) -> string -> unit - val iteri : f:(int -> char -> unit) -> string -> unit - val map : f:(char -> char) -> string -> string - val trim : string -> string - val escaped : string -> string - val index : string -> char -> int - val rindex : string -> char -> int - val index_from : string -> int -> char -> int - val rindex_from : string -> int -> char -> int - val contains : string -> char -> bool - val contains_from : string -> int -> char -> bool - val rcontains_from : string -> int -> char -> bool - val uppercase : string -> string - val lowercase : string -> string - val capitalize : string -> string - val uncapitalize : string -> string - type t = string - val compare: t -> t -> int - external unsafe_get : string -> int -> char = "%string_unsafe_get" - external unsafe_set : string -> int -> char -> unit = "%string_unsafe_set" - external unsafe_blit : - src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int -> - unit = "caml_blit_string" "noalloc" - external unsafe_fill : string -> pos:int -> len:int -> char -> unit - = "caml_fill_string" "noalloc" - end +module Array = ArrayLabels +module List = ListLabels +module String = StringLabels |