arg.ml, arg.mli, string.mli: amelioration de la doc
array.mli, array.ml, random.ml: create -> make (coherence avec String) sys.ml, sys.mli: ajout max_string_length, max_array_length git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1706 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
1d41f4abb0
commit
c44e6f999a
|
@ -12,8 +12,8 @@ digest.cmo: string.cmi digest.cmi
|
|||
digest.cmx: string.cmx digest.cmi
|
||||
filename.cmo: string.cmi sys.cmi filename.cmi
|
||||
filename.cmx: string.cmx sys.cmx filename.cmi
|
||||
format.cmo: string.cmi format.cmi
|
||||
format.cmx: string.cmx format.cmi
|
||||
format.cmo: obj.cmi string.cmi format.cmi
|
||||
format.cmx: obj.cmx string.cmx format.cmi
|
||||
gc.cmo: printf.cmi gc.cmi
|
||||
gc.cmx: printf.cmx gc.cmi
|
||||
genlex.cmo: char.cmi hashtbl.cmi list.cmi stream.cmi string.cmi genlex.cmi
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
(* $Id$ *)
|
||||
|
||||
type spec =
|
||||
| Unit of (unit -> unit) (* Call the function with no argument *)
|
||||
| Unit of (unit -> unit) (* Call the function with unit argument *)
|
||||
| Set of bool ref (* Set the reference to true *)
|
||||
| Clear of bool ref (* Set the reference to false *)
|
||||
| String of (string -> unit) (* Call the function with a string argument *)
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*)
|
||||
|
||||
type spec =
|
||||
| Unit of (unit -> unit) (* Call the function with no argument *)
|
||||
| Unit of (unit -> unit) (* Call the function with unit argument *)
|
||||
| Set of bool ref (* Set the reference to true *)
|
||||
| Clear of bool ref (* Set the reference to false *)
|
||||
| String of (string -> unit) (* Call the function with a string argument *)
|
||||
|
|
|
@ -18,15 +18,18 @@ external get: 'a array -> int -> 'a = "%array_safe_get"
|
|||
external set: 'a array -> int -> 'a -> unit = "%array_safe_set"
|
||||
external unsafe_get: 'a array -> int -> 'a = "%array_unsafe_get"
|
||||
external unsafe_set: 'a array -> int -> 'a -> unit = "%array_unsafe_set"
|
||||
external make: int -> 'a -> 'a array = "make_vect"
|
||||
external create: int -> 'a -> 'a array = "make_vect"
|
||||
|
||||
let create_matrix sx sy init =
|
||||
let make_matrix sx sy init =
|
||||
let res = create sx [||] in
|
||||
for x = 0 to pred sx do
|
||||
unsafe_set res x (create sy init)
|
||||
done;
|
||||
res
|
||||
|
||||
let create_matrix = make_matrix
|
||||
|
||||
let copy a =
|
||||
let l = length a in
|
||||
if l = 0 then [||] else begin
|
||||
|
|
|
@ -28,16 +28,18 @@ external set: 'a array -> int -> 'a -> unit = "%array_safe_set"
|
|||
Raise [Invalid_argument "Array.set"] if [n] is outside the range
|
||||
0 to [Array.length a - 1].
|
||||
You can also write [a.(n) <- x] instead of [Array.set a n x]. *)
|
||||
external make: int -> 'a -> 'a array = "make_vect"
|
||||
external create: int -> 'a -> 'a array = "make_vect"
|
||||
(* [Array.create n x] returns a fresh array of length [n],
|
||||
(* [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. *)
|
||||
val make_matrix: int -> int -> 'a -> 'a array array
|
||||
val create_matrix: int -> int -> 'a -> 'a array array
|
||||
(* [Array.create_matrix dimx dimy e] returns a two-dimensional 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].
|
||||
|
|
|
@ -133,7 +133,7 @@ let rec sumsq v i0 i1 =
|
|||
|
||||
let chisquare g n r =
|
||||
if n <= 10 * r then invalid_arg "chisquare";
|
||||
let f = Array.create r 0 in
|
||||
let f = Array.make r 0 in
|
||||
for i = 1 to n do
|
||||
let t = g r in
|
||||
f.(t) <- f.(t) + 1
|
||||
|
|
|
@ -52,14 +52,14 @@ val fill : string -> int -> int -> char -> unit
|
|||
Raise [Invalid_argument] if [start] and [len] do not
|
||||
designate a valid substring of [s]. *)
|
||||
val blit : string -> int -> string -> int -> int -> unit
|
||||
(* [String.blit s1 o1 s2 o2 len] copies [len] characters
|
||||
from string [s1], starting at character number [o1], to string [s2],
|
||||
starting at character number [o2]. It works correctly even if
|
||||
[s1] and [s2] are the same string,
|
||||
(* [String.blit src srcoff dst dstoff len] copies [len] characters
|
||||
from string [src], starting at character number [srcoff], to
|
||||
string [dst], starting at character number [dstoff]. It works
|
||||
correctly even if [src] and [dst] are the same string,
|
||||
and the source and destination chunks overlap.
|
||||
Raise [Invalid_argument] if [o1] and [len] do not
|
||||
designate a valid substring of [s1], or if [o2] and [len] do not
|
||||
designate a valid substring of [s2]. *)
|
||||
Raise [Invalid_argument] if [srcoff] and [len] do not
|
||||
designate a valid substring of [src], or if [dstoff] and [len]
|
||||
do not designate a valid substring of [dst]. *)
|
||||
|
||||
val concat : string -> string list -> string
|
||||
(* [String.concat sep sl] catenates the list of strings [sl],
|
||||
|
|
|
@ -18,6 +18,8 @@ external get_argv: unit -> string array = "sys_get_argv"
|
|||
|
||||
let argv = get_argv()
|
||||
let (os_type, word_size) = get_config()
|
||||
let max_array_length = (1 lsl (word_size - 10)) - 1;;
|
||||
let max_string_length = word_size / 8 * max_array_length - 1;;
|
||||
|
||||
external file_exists: string -> bool = "sys_file_exists"
|
||||
external remove: string -> unit = "sys_remove"
|
||||
|
|
|
@ -43,6 +43,10 @@ val os_type: string
|
|||
val word_size: int
|
||||
(* Size of one word on the machine currently executing the Caml
|
||||
program, in bits: 32 or 64. *)
|
||||
val max_string_length: int
|
||||
(* Maximum length of a string. *)
|
||||
val max_array_length: int
|
||||
(* Maximum length of an array. *)
|
||||
|
||||
(*** Signal handling *)
|
||||
|
||||
|
|
Loading…
Reference in New Issue