diff options
author | Maxence Guesdon <maxence.guesdon@inria.fr> | 2001-12-04 16:59:56 +0000 |
---|---|---|
committer | Maxence Guesdon <maxence.guesdon@inria.fr> | 2001-12-04 16:59:56 +0000 |
commit | 639d7afb5c0c5e2038f7dd966091014d4bb12a16 (patch) | |
tree | bacc4ac78ead7323740c733594ae0f34f3e94f39 /otherlibs | |
parent | 7c41a9c9e6c97cb0c9dd20f16bc9594e5ad35aea (diff) |
commentaires après
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4101 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs')
-rw-r--r-- | otherlibs/bigarray/bigarray.mli | 276 | ||||
-rw-r--r-- | otherlibs/dbm/dbm.mli | 30 | ||||
-rw-r--r-- | otherlibs/dynlink/dynlink.mli | 19 | ||||
-rw-r--r-- | otherlibs/graph/graphics.mli | 139 | ||||
-rw-r--r-- | otherlibs/graph/graphicsX11.mli | 6 |
5 files changed, 250 insertions, 220 deletions
diff --git a/otherlibs/bigarray/bigarray.mli b/otherlibs/bigarray/bigarray.mli index b5c54d34a..a196dc33a 100644 --- a/otherlibs/bigarray/bigarray.mli +++ b/otherlibs/bigarray/bigarray.mli @@ -64,6 +64,7 @@ type int32_elt type int64_elt type nativeint_elt +type ('a, 'b) kind (** To each element kind is associated a Caml type, which is the type of Caml values that can be stored in the big array or read back from it. This type is not necessarily the same @@ -79,28 +80,38 @@ type nativeint_elt of the big array. The following predefined values of type [kind] list all possible associations of Caml types with element kinds: *) -type ('a, 'b) kind +val float32 : (float, float32_elt) kind (** See {!Bigarray.char}. *) -val float32: (float, float32_elt) kind + +val float64 : (float, float64_elt) kind (** See {!Bigarray.char}. *) -val float64: (float, float64_elt) kind + +val int8_signed : (int, int8_signed_elt) kind (** See {!Bigarray.char}. *) -val int8_signed: (int, int8_signed_elt) kind + +val int8_unsigned : (int, int8_unsigned_elt) kind (** See {!Bigarray.char}. *) -val int8_unsigned: (int, int8_unsigned_elt) kind + +val int16_signed : (int, int16_signed_elt) kind (** See {!Bigarray.char}. *) -val int16_signed: (int, int16_signed_elt) kind + +val int16_unsigned : (int, int16_unsigned_elt) kind (** See {!Bigarray.char}. *) -val int16_unsigned: (int, int16_unsigned_elt) kind + +val int : (int, int_elt) kind (** See {!Bigarray.char}. *) -val int: (int, int_elt) kind + +val int32 : (int32, int32_elt) kind (** See {!Bigarray.char}. *) -val int32: (int32, int32_elt) kind + +val int64 : (int64, int64_elt) kind (** See {!Bigarray.char}. *) -val int64: (int64, int64_elt) kind + +val nativeint : (nativeint, nativeint_elt) kind (** See {!Bigarray.char}. *) -val nativeint: (nativeint, nativeint_elt) kind + +val char : (char, int8_unsigned_elt) kind (** As shown by the types of the values above, big arrays of kind [float32_elt] and [float64_elt] are accessed using the Caml type [float]. Big arrays of @@ -113,12 +124,13 @@ val nativeint: (nativeint, nativeint_elt) kind 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 char: (char, int8_unsigned_elt) kind (** {2 Array layouts} *) -(** See {!Bigarray.fortran_layout}.*) type c_layout +(** See {!Bigarray.fortran_layout}.*) + +type fortran_layout (** To facilitate interoperability with existing C and Fortran code, this library supports two different memory layouts for big arrays, one compatible with the C conventions, @@ -140,12 +152,11 @@ type c_layout Each layout style is identified at the type level by the abstract types {!Bigarray.c_layout} and [fortran_layout] respectively. *) -type fortran_layout +type 'a layout (** The type ['a layout] represents one of the two supported memory layouts: C-style if ['a] is {!Bigarray.c_layout}, Fortran-style if ['a] is {!Bigarray.fortran_layout}. *) -type 'a layout (** {3 Supported layouts} @@ -154,13 +165,15 @@ type 'a layout the two supported layouts at the level of values. *) -val c_layout: c_layout layout -val fortran_layout: fortran_layout layout +val c_layout : c_layout layout +val fortran_layout : fortran_layout layout (** {2 Generic arrays (of arbitrarily many dimensions)} *) -module Genarray: sig +module Genarray : + sig + type ('a, 'b, 'c) t (** The type [Genarray.t] is the type of big arrays with variable numbers of dimensions. Any number of dimensions between 1 and 16 is supported. @@ -179,8 +192,9 @@ module Genarray: sig is the type of generic big arrays containing 32-bit floats in Fortran layout; reads and writes in this array use the Caml type [float]. *) - type ('a, 'b, 'c) t + external create: ('a, 'b) kind -> 'c layout -> int array -> ('a, 'b, 'c) t + = "bigarray_create" (** [Genarray.create kind layout dimensions] returns a new big array whose element kind is determined by the parameter [kind] (one of [float32], [float64], [int8_signed], etc) and whose layout is @@ -201,20 +215,19 @@ module Genarray: sig [Genarray.create] raises [Invalid_arg] if the number of dimensions is not in the range 1 to 16 inclusive, or if one of the dimensions is negative. *) - external create: ('a, 'b) kind -> 'c layout -> int array -> ('a, 'b, 'c) t - = "bigarray_create" - (** Return the number of dimensions of the given big array. *) external num_dims: ('a, 'b, 'c) t -> int = "bigarray_num_dims" + (** Return the number of dimensions of the given big array. *) + external nth_dim: ('a, 'b, 'c) t -> int -> int = "bigarray_dim" (** [Genarray.nth_dim a n] returns the [n]-th dimension of the big array [a]. The first dimension corresponds to [n = 0]; the second dimension corresponds to [n = 1]; the last dimension, to [n = Genarray.num_dims a - 1]. Raise [Invalid_arg] if [n] is less than 0 or greater or equal than [Genarray.num_dims a]. *) - external nth_dim: ('a, 'b, 'c) t -> int -> int = "bigarray_dim" + external get: ('a, 'b, 'c) t -> int array -> 'a = "bigarray_get_generic" (** Read an element of a generic big array. [Genarray.get a [|i1; ...; iN|]] returns the element of [a] whose coordinates are [i1] in the first dimension, [i2] in @@ -232,8 +245,9 @@ module Genarray: sig (The syntax [a.{...}] with one, two or three coordinates is reserved for accessing one-, two- and three-dimensional arrays as described below.) *) - external get: ('a, 'b, 'c) t -> int array -> 'a = "bigarray_get_generic" + external set: ('a, 'b, 'c) t -> int array -> 'a -> unit + = "bigarray_set_generic" (** Assign an element of a generic big array. [Genarray.set a [|i1; ...; iN|] v] stores the value [v] in the element of [a] whose coordinates are [i1] in the first dimension, @@ -249,9 +263,9 @@ module Genarray: sig (The syntax [a.{...} <- v] with one, two or three coordinates is reserved for updating one-, two- and three-dimensional arrays as described below.) *) - external set: ('a, 'b, 'c) t -> int array -> 'a -> unit - = "bigarray_set_generic" + external sub_left: ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t + = "bigarray_sub" (** Extract a sub-array of the given big array by restricting the first (left-most) dimension. [Genarray.sub_left a ofs len] returns a big array with the same number of dimensions as [a], @@ -268,9 +282,10 @@ module Genarray: sig Raise [Invalid_arg] if [ofs] and [len] do not designate a valid sub-array of [a], that is, if [ofs < 0], or [len < 0], or [ofs + len > Genarray.nth_dim a 0]. *) - external sub_left: ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t - = "bigarray_sub" + external sub_right: + ('a, 'b, fortran_layout) t -> int -> int -> ('a, 'b, fortran_layout) t + = "bigarray_sub" (** Extract a sub-array of the given big array by restricting the last (right-most) dimension. [Genarray.sub_right a ofs len] returns a big array with the same number of dimensions as [a], @@ -287,10 +302,10 @@ module Genarray: sig Raise [Invalid_arg] if [ofs] and [len] do not designate a valid sub-array of [a], that is, if [ofs < 1], or [len < 0], or [ofs + len > Genarray.nth_dim a (Genarray.num_dims a - 1)]. *) - external sub_right: - ('a, 'b, fortran_layout) t -> int -> int -> ('a, 'b, fortran_layout) t - = "bigarray_sub" + external slice_left: + ('a, 'b, c_layout) t -> int array -> ('a, 'b, c_layout) t + = "bigarray_slice" (** Extract a sub-array of lower dimension from the given big array by fixing one or several of the first (left-most) coordinates. [Genarray.slice_left a [|i1; ... ; iM|]] returns the ``slice'' @@ -305,10 +320,10 @@ module Genarray: sig [Genarray.slice_left] applies only to big arrays in C layout. Raise [Invalid_arg] if [M >= N], or if [[|i1; ... ; iM|]] is outside the bounds of [a]. *) - external slice_left: - ('a, 'b, c_layout) t -> int array -> ('a, 'b, c_layout) t - = "bigarray_slice" + external slice_right: + ('a, 'b, fortran_layout) t -> int array -> ('a, 'b, fortran_layout) t + = "bigarray_slice" (** Extract a sub-array of lower dimension from the given big array by fixing one or several of the last (right-most) coordinates. [Genarray.slice_right a [|i1; ... ; iM|]] returns the ``slice'' @@ -323,26 +338,26 @@ module Genarray: sig [Genarray.slice_right] applies only to big arrays in Fortran layout. Raise [Invalid_arg] if [M >= N], or if [[|i1; ... ; iM|]] is outside the bounds of [a]. *) - external slice_right: - ('a, 'b, fortran_layout) t -> int array -> ('a, 'b, fortran_layout) t - = "bigarray_slice" - (** Copy all elements of a big array in another big array. - [Genarray.blit src dst] copies all elements of [src] into - [dst]. Both arrays [src] and [dst] must have the same number of - dimensions and equal dimensions. Copying a sub-array of [src] - to a sub-array of [dst] can be achieved by applying [Genarray.blit] - to sub-array or slices of [src] and [dst]. *) external blit: ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit = "bigarray_blit" + (** Copy all elements of a big array in another big array. + [Genarray.blit src dst] copies all elements of [src] into + [dst]. Both arrays [src] and [dst] must have the same number of + dimensions and equal dimensions. Copying a sub-array of [src] + to a sub-array of [dst] can be achieved by applying [Genarray.blit] + to sub-array or slices of [src] and [dst]. *) + external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" (** Set all elements of a big array to a given value. [Genarray.fill a v] stores the value [v] in all elements of the big array [a]. Setting only some elements of [a] to [v] can be achieved by applying [Genarray.fill] to a sub-array or a slice of [a]. *) - external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" + external map_file: + Unix.file_descr -> ('a, 'b) kind -> 'c layout -> + bool -> int array -> ('a, 'b, 'c) t = "bigarray_map_file" (** Memory mapping of a file as a big array. [Genarray.map_file fd kind layout shared dims] returns a big array of kind [kind], layout [layout], @@ -375,10 +390,8 @@ module Genarray: sig mapped to the big array. If the file is smaller than the big array, the file is automatically grown to the size of the big array. This requires write permissions on [fd]. *) - external map_file: - Unix.file_descr -> ('a, 'b) kind -> 'c layout -> - bool -> int array -> ('a, 'b, 'c) t = "bigarray_map_file" -end + + end (** {2 One-dimensional arrays} *) @@ -388,283 +401,291 @@ end 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. *) -module Array1: sig +module Array1 : sig + type ('a, 'b, 'c) t (** The type of one-dimensional big arrays whose elements have Caml type ['a], representation kind ['b], and memory layout ['c]. *) - type ('a, 'b, 'c) t + val create: ('a, 'b) kind -> 'c layout -> int -> ('a, 'b, 'c) t (** [Array1.create kind layout dim] returns a new bigarray of one dimension, whose size is [dim]. [kind] and [layout] determine the array element kind and the array layout as described for [Genarray.create]. *) - val create: ('a, 'b) kind -> 'c layout -> int -> ('a, 'b, 'c) t + val dim: ('a, 'b, 'c) t -> int (** Return the size (dimension) of the given one-dimensional big array. *) - val dim: ('a, 'b, 'c) t -> int + external get: ('a, 'b, 'c) t -> int -> 'a = "%bigarray_ref_1" (** [Array1.get a x], or alternatively [a.{x}], returns the element of [a] at index [x]. [x] must be greater or equal than [0] and strictly less than [Array1.dim a] if [a] has C layout. If [a] has Fortran layout, [x] must be greater or equal than [1] and less or equal than [Array1.dim a]. Otherwise, [Invalid_arg] is raised. *) - external get: ('a, 'b, 'c) t -> int -> 'a = "%bigarray_ref_1" + external set: ('a, 'b, 'c) t -> int -> 'a -> unit = "%bigarray_set_1" (** [Array1.set a x v], also written [a.{x} <- v], stores the value [v] at index [x] in [a]. [x] must be inside the bounds of [a] as described in {!Bigarray.Array1.get}; otherwise, [Invalid_arg] is raised. *) - external set: ('a, 'b, 'c) t -> int -> 'a -> unit = "%bigarray_set_1" + external sub: ('a, 'b, 'c) t -> int -> int -> ('a, 'b, 'c) t + = "bigarray_sub" (** Extract a sub-array of the given one-dimensional big array. See [Genarray.sub_left] for more details. *) - external sub: ('a, 'b, 'c) t -> int -> int -> ('a, 'b, 'c) t - = "bigarray_sub" + external blit: ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit + = "bigarray_blit" (** Copy the first big array to the second big array. See [Genarray.blit] for more details. *) - external blit: ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit - = "bigarray_blit" + external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" (** Fill the given big array with the given value. See [Genarray.fill] for more details. *) - external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" + val of_array: ('a, 'b) kind -> 'c layout -> 'a array -> ('a, 'b, 'c) t (** Build a one-dimensional big array initialized from the given array. *) - val of_array: ('a, 'b) kind -> 'c layout -> 'a array -> ('a, 'b, 'c) t + val map_file: Unix.file_descr -> ('a, 'b) kind -> 'c layout -> + bool -> int -> ('a, 'b, 'c) t (** Memory mapping of a file as a one-dimensional big array. See {!Bigarray.Genarray.map_file} for more details. *) - val map_file: Unix.file_descr -> ('a, 'b) kind -> 'c layout -> - bool -> int -> ('a, 'b, 'c) t end + (** {2 Two-dimensional arrays} *) (** The [Array2] structure provides operations similar to those of {!Bigarray.Genarray}, but specialized to the case of two-dimensional arrays. *) -module Array2: sig +module Array2 : + sig + type ('a, 'b, 'c) t (** The type of two-dimensional big arrays whose elements have Caml type ['a], representation kind ['b], and memory layout ['c]. *) - type ('a, 'b, 'c) t + val create: ('a, 'b) kind -> 'c layout -> int -> int -> ('a, 'b, 'c) t (** [Array2.create kind layout dim1 dim2] returns a new bigarray of two dimension, whose size is [dim1] in the first dimension and [dim2] in the second dimension. [kind] and [layout] determine the array element kind and the array layout as described for {!Bigarray.Genarray.create}. *) - val create: ('a, 'b) kind -> 'c layout -> int -> int -> ('a, 'b, 'c) t - (** Return the first dimension of the given two-dimensional big array. *) val dim1: ('a, 'b, 'c) t -> int + (** Return the first dimension of the given two-dimensional big array. *) - (** Return the second dimension of the given two-dimensional big array. *) val dim2: ('a, 'b, 'c) t -> int + (** Return the second dimension of the given two-dimensional big array. *) + external get: ('a, 'b, 'c) t -> int -> int -> 'a = "%bigarray_ref_2" (** [Array2.get a x y], also written [a.{x,y}], returns the element of [a] at coordinates ([x], [y]). [x] and [y] must be within the bounds of [a], as described for {!Bigarray.Genarray.get}; otherwise, [Invalid_arg] is raised. *) - external get: ('a, 'b, 'c) t -> int -> int -> 'a = "%bigarray_ref_2" + external set: ('a, 'b, 'c) t -> int -> int -> 'a -> unit = "%bigarray_set_2" (** [Array2.set a x y v], or alternatively [a.{x,y} <- v], stores the value [v] at coordinates ([x], [y]) in [a]. [x] and [y] must be within the bounds of [a], as described for {!Bigarray.Genarray.set}; otherwise, [Invalid_arg] is raised. *) - external set: ('a, 'b, 'c) t -> int -> int -> 'a -> unit = "%bigarray_set_2" + external sub_left: ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t + = "bigarray_sub" (** Extract a two-dimensional sub-array of the given two-dimensional big array by restricting the first dimension. See {!Bigarray.Genarray.sub_left} for more details. [Array2.sub_left] applies only to arrays with C layout. *) - external sub_left: ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t - = "bigarray_sub" + external sub_right: + ('a, 'b, fortran_layout) t -> int -> int -> ('a, 'b, fortran_layout) t + = "bigarray_sub" (** Extract a two-dimensional sub-array of the given two-dimensional big array by restricting the second dimension. See {!Bigarray.Genarray.sub_right} for more details. [Array2.sub_right] applies only to arrays with Fortran layout. *) - external sub_right: - ('a, 'b, fortran_layout) t -> int -> int -> ('a, 'b, fortran_layout) t - = "bigarray_sub" + val slice_left: ('a, 'b, c_layout) t -> int -> ('a, 'b, c_layout) Array1.t (** Extract a row (one-dimensional slice) of the given two-dimensional big array. The integer parameter is the index of the row to extract. See {!Bigarray.Genarray.slice_left} for more details. [Array2.slice_left] applies only to arrays with C layout. *) - val slice_left: ('a, 'b, c_layout) t -> int -> ('a, 'b, c_layout) Array1.t + val slice_right: + ('a, 'b, fortran_layout) t -> int -> ('a, 'b, fortran_layout) Array1.t (** Extract a column (one-dimensional slice) of the given two-dimensional big array. The integer parameter is the index of the column to extract. See {!Bigarray.Genarray.slice_right} for more details. [Array2.slice_right] applies only to arrays with Fortran layout. *) - val slice_right: - ('a, 'b, fortran_layout) t -> int -> ('a, 'b, fortran_layout) Array1.t - (** Copy the first big array to the second big array. - See {!Bigarray.Genarray.blit} for more details. *) external blit: ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit = "bigarray_blit" + (** Copy the first big array to the second big array. + See {!Bigarray.Genarray.blit} for more details. *) + external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" (** Fill the given big array with the given value. See {!Bigarray.Genarray.fill} for more details. *) - external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" + val of_array: ('a, 'b) kind -> 'c layout -> 'a array array -> ('a, 'b, 'c) t (** Build a two-dimensional big array initialized from the given array of arrays. *) - val of_array: ('a, 'b) kind -> 'c layout -> 'a array array -> ('a, 'b, 'c) t - (** Memory mapping of a file as a two-dimensional big array. - See {!Bigarray.Genarray.map_file} for more details. *) val map_file: Unix.file_descr -> ('a, 'b) kind -> 'c layout -> bool -> int -> int -> ('a, 'b, 'c) t -end + (** Memory mapping of a file as a two-dimensional big array. + See {!Bigarray.Genarray.map_file} for more details. *) + + end (** {2 Three-dimensional arrays} *) (** The [Array3] structure provides operations similar to those of {!Bigarray.Genarray}, but specialized to the case of three-dimensional arrays. *) -module Array3: sig +module Array3 : + sig + type ('a, 'b, 'c) t (** The type of three-dimensional big arrays whose elements have Caml type ['a], representation kind ['b], and memory layout ['c]. *) - type ('a, 'b, 'c) t + val create: ('a, 'b) kind -> 'c layout -> int -> int -> int -> ('a, 'b, 'c) t (** [Array3.create kind layout dim1 dim2 dim3] returns a new bigarray of three dimension, whose size is [dim1] in the first dimension, [dim2] in the second dimension, and [dim3] in the third. [kind] and [layout] determine the array element kind and the array layout as described for {!Bigarray.Genarray.create}. *) - val create: ('a, 'b) kind -> 'c layout -> int -> int -> int -> ('a, 'b, 'c) t - (** Return the first dimension of the given three-dimensional big array. *) val dim1: ('a, 'b, 'c) t -> int + (** Return the first dimension of the given three-dimensional big array. *) - (** Return the second dimension of the given three-dimensional big array. *) val dim2: ('a, 'b, 'c) t -> int + (** Return the second dimension of the given three-dimensional big array. *) - (** Return the third dimension of the given three-dimensional big array. *) val dim3: ('a, 'b, 'c) t -> int + (** Return the third dimension of the given three-dimensional big array. *) + external get: ('a, 'b, 'c) t -> int -> int -> int -> 'a = "%bigarray_ref_3" (** [Array3.get a x y z], also written [a.{x,y,z}], returns the element of [a] at coordinates ([x], [y], [z]). [x], [y] and [z] must be within the bounds of [a], as described for {!Bigarray.Genarray.get}; otherwise, [Invalid_arg] is raised. *) - external get: ('a, 'b, 'c) t -> int -> int -> int -> 'a = "%bigarray_ref_3" + external set: ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unit + = "%bigarray_set_3" (** [Array3.set a x y v], or alternatively [a.{x,y,z} <- v], stores the value [v] at coordinates ([x], [y], [z]) in [a]. [x], [y] and [z] must be within the bounds of [a], as described for {!Bigarray.Genarray.set}; otherwise, [Invalid_arg] is raised. *) - external set: ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unit - = "%bigarray_set_3" + external sub_left: ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t + = "bigarray_sub" (** Extract a three-dimensional sub-array of the given three-dimensional big array by restricting the first dimension. See {!Bigarray.Genarray.sub_left} for more details. [Array3.sub_left] applies only to arrays with C layout. *) - external sub_left: ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) t - = "bigarray_sub" + external sub_right: + ('a, 'b, fortran_layout) t -> int -> int -> ('a, 'b, fortran_layout) t + = "bigarray_sub" (** Extract a three-dimensional sub-array of the given three-dimensional big array by restricting the second dimension. See {!Bigarray.Genarray.sub_right} for more details. [Array3.sub_right] applies only to arrays with Fortran layout. *) - external sub_right: - ('a, 'b, fortran_layout) t -> int -> int -> ('a, 'b, fortran_layout) t - = "bigarray_sub" + val slice_left_1: + ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) Array1.t (** Extract a one-dimensional slice of the given three-dimensional big array by fixing the first two coordinates. The integer parameters are the coordinates of the slice to extract. See {!Bigarray.Genarray.slice_left} for more details. [Array3.slice_left_1] applies only to arrays with C layout. *) - val slice_left_1: - ('a, 'b, c_layout) t -> int -> int -> ('a, 'b, c_layout) Array1.t + val slice_right_1: + ('a, 'b, fortran_layout) t -> + int -> int -> ('a, 'b, fortran_layout) Array1.t (** Extract a one-dimensional slice of the given three-dimensional big array by fixing the last two coordinates. The integer parameters are the coordinates of the slice to extract. See {!Bigarray.Genarray.slice_right} for more details. [Array3.slice_right_1] applies only to arrays with Fortran layout. *) - val slice_right_1: - ('a, 'b, fortran_layout) t -> - int -> int -> ('a, 'b, fortran_layout) Array1.t + val slice_left_2: ('a, 'b, c_layout) t -> int -> ('a, 'b, c_layout) Array2.t (** Extract a two-dimensional slice of the given three-dimensional big array by fixing the first coordinate. The integer parameter is the first coordinate of the slice to extract. See {!Bigarray.Genarray.slice_left} for more details. [Array3.slice_left_2] applies only to arrays with C layout. *) - val slice_left_2: ('a, 'b, c_layout) t -> int -> ('a, 'b, c_layout) Array2.t + val slice_right_2: + ('a, 'b, fortran_layout) t -> int -> ('a, 'b, fortran_layout) Array2.t (** Extract a two-dimensional slice of the given three-dimensional big array by fixing the last coordinate. The integer parameter is the coordinate of the slice to extract. See {!Bigarray.Genarray.slice_right} for more details. [Array3.slice_right_2] applies only to arrays with Fortran layout. *) - val slice_right_2: - ('a, 'b, fortran_layout) t -> int -> ('a, 'b, fortran_layout) Array2.t - (** Copy the first big array to the second big array. - See {!Bigarray.Genarray.blit} for more details. *) external blit: ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit = "bigarray_blit" + (** Copy the first big array to the second big array. + See {!Bigarray.Genarray.blit} for more details. *) + external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" (** Fill the given big array with the given value. See {!Bigarray.Genarray.fill} for more details. *) - external fill: ('a, 'b, 'c) t -> 'a -> unit = "bigarray_fill" - (** Build a three-dimensional big array initialized from the - given array of arrays of arrays. *) val of_array: ('a, 'b) kind -> 'c layout -> 'a array array array -> ('a, 'b, 'c) t + (** Build a three-dimensional big array initialized from the + given array of arrays of arrays. *) - (** Memory mapping of a file as a three-dimensional big array. - See {!Bigarray.Genarray.map_file} for more details. *) val map_file: Unix.file_descr -> ('a, 'b) kind -> 'c layout -> bool -> int -> int -> int -> ('a, 'b, 'c) t -end + (** Memory mapping of a file as a three-dimensional big array. + See {!Bigarray.Genarray.map_file} for more details. *) + + end (** {2 Coercions between generic big arrays and fixed-dimension big arrays} *) +external genarray_of_array1 : + ('a, 'b, 'c) Array1.t -> ('a, 'b, 'c) Genarray.t = "%identity" (** Return the generic big array corresponding to the given one-dimensional big array. *) -external genarray_of_array1: ('a, 'b, 'c) Array1.t -> ('a, 'b, 'c) Genarray.t - = "%identity" + +external genarray_of_array2 : + ('a, 'b, 'c) Array2.t -> ('a, 'b, 'c) Genarray.t = "%identity" (** Return the generic big array corresponding to the given two-dimensional big array. *) -external genarray_of_array2: ('a, 'b, 'c) Array2.t -> ('a, 'b, 'c) Genarray.t - = "%identity" + +external genarray_of_array3 : + ('a, 'b, 'c) Array3.t -> ('a, 'b, 'c) Genarray.t = "%identity" (** Return the generic big array corresponding to the given three-dimensional big array. *) -external genarray_of_array3: ('a, 'b, 'c) Array3.t -> ('a, 'b, 'c) Genarray.t - = "%identity" +val array1_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array1.t (** Return the one-dimensional big array corresponding to the given generic big array. Raise [Invalid_arg] if the generic big array does not have exactly one dimension. *) -val array1_of_genarray: ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array1.t +val array2_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array2.t (** Return the two-dimensional big array corresponding to the given generic big array. Raise [Invalid_arg] if the generic big array does not have exactly two dimensions. *) -val array2_of_genarray: ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array2.t +val array3_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array3.t (** Return the three-dimensional big array corresponding to the given generic big array. Raise [Invalid_arg] if the generic big array does not have exactly three dimensions. *) -val array3_of_genarray: ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array3.t (** {2 Re-shaping big arrays} *) +val reshape : ('a, 'b, 'c) Genarray.t -> int array -> ('a, 'b, 'c) Genarray.t (** [reshape b [|d1;...;dN|]] converts the big array [b] to a [N]-dimensional array of dimensions [d1]...[dN]. The returned array and the original array [b] share their data @@ -679,15 +700,14 @@ val array3_of_genarray: ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array3.t elements as the original big array [b]. That is, the product of the dimensions of [b] must be equal to [i1 * ... * iN]. Otherwise, [Invalid_arg] is raised. *) -val reshape: ('a, 'b, 'c) Genarray.t -> int array -> ('a, 'b, 'c) Genarray.t +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_1: ('a, 'b, 'c) Genarray.t -> int -> ('a, 'b, 'c) Array1.t +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_2: ('a, 'b, 'c) Genarray.t -> int -> int -> ('a, 'b, 'c) Array2.t +val reshape_3 : + ('a, 'b, 'c) Genarray.t -> int -> int -> int -> ('a, 'b, 'c) Array3.t (** Specialized version of {!Bigarray.reshape} for reshaping to three-dimensional arrays. *) -val reshape_3: - ('a, 'b, 'c) Genarray.t -> int -> int -> int -> ('a, 'b, 'c) Array3.t diff --git a/otherlibs/dbm/dbm.mli b/otherlibs/dbm/dbm.mli index d32dd8a72..a014422d0 100644 --- a/otherlibs/dbm/dbm.mli +++ b/otherlibs/dbm/dbm.mli @@ -14,18 +14,22 @@ (** Interface to the NDBM database. *) -(** The type of file descriptors opened on NDBM databases. *) type t +(** The type of file descriptors opened on NDBM databases. *) +type open_flag = + Dbm_rdonly + | Dbm_wronly + | Dbm_rdwr + | Dbm_create (** Flags for opening a database (see {!Dbm.opendbm}). *) -type open_flag = - Dbm_rdonly | Dbm_wronly | Dbm_rdwr | Dbm_create -(** Raised by the following functions when an error is encountered. *) exception Dbm_error of string +(** Raised by the following functions when an error is encountered. *) +val opendbm : string -> open_flag list -> int -> t (** Open a descriptor on an NDBM database. The first argument is the name of the database (without the [.dir] and [.pag] suffixes). The second argument is a list of flags: [Dbm_rdonly] opens @@ -34,42 +38,42 @@ exception Dbm_error of string database to be created if it does not already exist. The third argument is the permissions to give to the database files, if the database is created. *) -val opendbm : string -> open_flag list -> int -> t -(** Close the given descriptor. *) external close : t -> unit = "caml_dbm_close" +(** Close the given descriptor. *) +external find : t -> string -> string = "caml_dbm_fetch" (** [find db key] returns the data associated with the given [key] in the database opened for the descriptor [db]. Raise [Not_found] if the [key] has no associated data. *) -external find : t -> string -> string = "caml_dbm_fetch" +external add : t -> string -> string -> unit = "caml_dbm_insert" (** [add db key data] inserts the pair ([key], [data]) in the database [db]. If the database already contains data associated with [key], raise [Dbm_error "Entry already exists"]. *) -external add : t -> string -> string -> unit = "caml_dbm_insert" +external replace : t -> string -> string -> unit = "caml_dbm_replace" (** [replace db key data] inserts the pair ([key], [data]) in the database [db]. If the database already contains data associated with [key], that data is discarded and silently replaced by the new [data]. *) -external replace : t -> string -> string -> unit = "caml_dbm_replace" +external remove : t -> string -> unit = "caml_dbm_delete" (** [remove db key data] removes the data associated with [key] in [db]. If [key] has no associated data, raise [Dbm_error "dbm_delete"]. *) -external remove : t -> string -> unit = "caml_dbm_delete" -(** See {!Dbm.nextkey}.*) external firstkey : t -> string = "caml_dbm_firstkey" +(** See {!Dbm.nextkey}.*) + +external nextkey : t -> string = "caml_dbm_nextkey" (** Enumerate all keys in the given database, in an unspecified order. [firstkey db] returns the first key, and repeated calls to [nextkey db] return the remaining keys. [Not_found] is raised when all keys have been enumerated. *) -external nextkey : t -> string = "caml_dbm_nextkey" +val iter : (string -> string -> 'a) -> t -> unit (** [iter f db] applies [f] to each ([key], [data]) pair in the database [db]. [f] receives [key] as first argument and [data] as second argument. *) -val iter : (string -> string -> 'a) -> t -> unit diff --git a/otherlibs/dynlink/dynlink.mli b/otherlibs/dynlink/dynlink.mli index 061a2c821..b3916e6ff 100644 --- a/otherlibs/dynlink/dynlink.mli +++ b/otherlibs/dynlink/dynlink.mli @@ -14,21 +14,22 @@ (** Dynamic loading of bytecode object files. *) -(** Initialize the library. Must be called before [loadfile]. *) val init : unit -> unit +(** Initialize the library. Must be called before [loadfile]. *) +val loadfile : string -> unit (** Load the given bytecode object file and link it. All toplevel expressions in the loaded compilation unit are evaluated. No facilities are provided to access value names defined by the unit. Therefore, the unit must register itself its entry points with the main program, e.g. by modifying tables of functions. *) -val loadfile : string -> unit +val loadfile_private : string -> unit (** Same as [loadfile], except that the module loaded is not made available to other modules dynamically loaded afterwards. *) -val loadfile_private : string -> unit +val add_interfaces : string list -> string list -> unit (** [add_interfaces units path] grants dynamically-linked object files access to the compilation units named in list [units]. The interfaces ([.cmi] files) for these units are searched in @@ -37,30 +38,30 @@ val loadfile_private : string -> unit units composing the running program, not even the standard library. [add_interfaces] or {!Dynlink.add_available_units} (see below) must be called to grant access to some of the units. *) -val add_interfaces : string list -> string list -> unit +val add_available_units : (string * Digest.t) list -> unit (** Same as {!Dynlink.add_interfaces}, but instead of searching [.cmi] files to find the unit interfaces, uses the interface digests given for each unit. This way, the [.cmi] interface files need not be available at run-time. The digests can be extracted from [.cmi] files using the [extract_crc] program installed in the Objective Caml standard library directory. *) -val add_available_units : (string * Digest.t) list -> unit -(** Clear the list of compilation units accessible to dynamically-linked programs. *) val clear_available_units : unit -> unit +(** Clear the list of compilation units accessible to dynamically-linked programs. *) +val allow_unsafe_modules : bool -> unit (** Govern whether unsafe object files are allowed to be dynamically linked. A compilation unit is ``unsafe'' if it contains declarations of external functions, which can break type safety. By default, dynamic linking of unsafe object files is not allowed. *) -val allow_unsafe_modules : bool -> unit type linking_error = Undefined_global of string | Unavailable_primitive of string | Uninitialized_global of string + type error = Not_a_bytecode_file of string | Inconsistent_import of string @@ -71,12 +72,12 @@ type error = | File_not_found of string | Cannot_open_dll of string +exception Error of error (** Errors in dynamic linking are reported by raising the [Error] exception with a description of the error. *) -exception Error of error +val error_message : error -> string (** Convert an error description to a printable message. *) -val error_message: error -> string (**/**) diff --git a/otherlibs/graph/graphics.mli b/otherlibs/graph/graphics.mli index 79337a806..a9d4f48f2 100644 --- a/otherlibs/graph/graphics.mli +++ b/otherlibs/graph/graphics.mli @@ -14,62 +14,64 @@ (** Machine-independent graphics primitives. *) -(** Raised by the functions below when they encounter an error. *) exception Graphic_failure of string +(** Raised by the functions below when they encounter an error. *) (** {2 Initializations} *) +val open_graph : string -> unit (** Show the graphics window or switch the screen to graphic mode. The graphics window is cleared and the current point is set to (0, 0). The string argument is used to pass optional information on the desired graphics mode, the graphics window size, and so on. Its interpretation is implementation-dependent. If the empty string is given, a sensible default is selected. *) -val open_graph: string -> unit +val close_graph : unit -> unit (** Delete the graphics window or switch the screen back to text mode. *) -val close_graph: unit -> unit -(** Set the title of the graphics window. *) val set_window_title : string -> unit +(** Set the title of the graphics window. *) -(** Erase the graphics window. *) external clear_graph : unit -> unit = "gr_clear_graph" +(** Erase the graphics window. *) -(** See {!Graphics.size_y}. *) external size_x : unit -> int = "gr_size_x" +(** See {!Graphics.size_y}. *) + +external size_y : unit -> int = "gr_size_y" (** Return the size of the graphics window. Coordinates of the screen pixels range over [0 .. size_x()-1] and [0 .. size_y()-1]. Drawings outside of this rectangle are clipped, without causing an error. The origin (0,0) is at the lower left corner. *) -external size_y : unit -> int = "gr_size_y" (** {2 Colors} *) +type color = int (** A color is specified by its R, G, B components. Each component is in the range [0..255]. The three components are packed in an [int]: [0xRRGGBB], where [RR] are the two hexadecimal digits for the red component, [GG] for the green component, [BB] for the blue component. *) -type color = int +val rgb : int -> int -> int -> color (** [rgb r g b] returns the integer encoding the color with red component [r], green component [g], and blue component [b]. [r], [g] and [b] are in the range [0..255]. *) -val rgb: int -> int -> int -> color -(** Set the current drawing color. *) external set_color : color -> unit = "gr_set_color" +(** Set the current drawing color. *) +val background : color (** See {!Graphics.foreground}.*) -val background: color + +val foreground : color (** Default background and foreground colors (usually, either black foreground on a white background or white foreground on a black background). {!Graphics.clear_graph} fills the screen with the [background] color. The initial drawing color is [foreground]. *) -val foreground: color (** {3 Some predefined colors} *) @@ -86,204 +88,208 @@ val magenta : color (** {2 Point and line drawing} *) -(** Plot the given point with the current drawing color. *) external plot : int -> int -> unit = "gr_plot" +(** Plot the given point with the current drawing color. *) -(** Plot the given points with the current drawing color. *) val plots : (int * int) array -> unit +(** Plot the given points with the current drawing color. *) +external point_color : int -> int -> color = "gr_point_color" (** Return the color of the given point in the backing store (see "Double buffering" below). *) -external point_color : int -> int -> color = "gr_point_color" -(** Position the current point. *) external moveto : int -> int -> unit = "gr_moveto" +(** Position the current point. *) -(** [rmoveto dx dy] translates the current point by the given vector. *) val rmoveto : int -> int -> unit +(** [rmoveto dx dy] translates the current point by the given vector. *) -(** Return the abscissa of the current point. *) external current_x : unit -> int = "gr_current_x" +(** Return the abscissa of the current point. *) -(** Return the ordinate of the current point. *) external current_y : unit -> int = "gr_current_y" +(** Return the ordinate of the current point. *) -(** Return the position of the current point. *) val current_point : unit -> int * int +(** Return the position of the current point. *) +external lineto : int -> int -> unit = "gr_lineto" (** Draw a line with endpoints the current point and the given point, and move the current point to the given point. *) -external lineto : int -> int -> unit = "gr_lineto" +val rlineto : int -> int -> unit (** Draw a line with endpoints the current point and the current point translated of the given vector, and move the current point to this point. *) -val rlineto : int -> int -> unit +val curveto : int * int -> int * int -> int * int -> unit (** [curveto b c d] draws a cubic Bezier curve starting from the current point to point [d], with control points [b] and [c], and moves the current point to [d]. *) -val curveto : int * int -> int * int -> int * int -> unit +external draw_rect : int -> int -> int -> int -> unit = "gr_draw_rect" (** [draw_rect x y w h] draws the rectangle with lower left corner at [x,y], width [w] and height [h]. The current point is unchanged. *) -external draw_rect : int -> int -> int -> int -> unit = "gr_draw_rect" +val draw_poly_line : (int * int) array -> unit (** [draw_poly_line points] draws the line that joins the points given by the array argument. The array contains the coordinates of the vertices of the polygonal line, which need not be closed. The current point is unchanged. *) -val draw_poly_line : (int * int) array -> unit +val draw_poly : (int * int) array -> unit (** [draw_poly polygon] draws the given polygon. The array contains the coordinates of the vertices of the polygon. The current point is unchanged. *) -val draw_poly : (int * int) array -> unit +val draw_segments : (int * int * int * int) array -> unit (** [draw_segments segments] draws the segments given in the array argument. Each segment is specified as a quadruple [(x0, y0, x1, y1)] where [(x0, y0)] and [(x1, y1)] are the coordinates of the end points of the segment. The current point is unchanged. *) -val draw_segments : (int * int * int * int) array -> unit +external draw_arc : + int -> int -> int -> int -> int -> int -> + unit = "gr_draw_arc" "gr_draw_arc_nat" (** [draw_arc x y rx ry a1 a2] draws an elliptical arc with center [x,y], horizontal radius [rx], vertical radius [ry], from angle [a1] to angle [a2] (in degrees). The current point is unchanged. *) -external draw_arc : - int -> int -> int -> int -> int -> int -> unit - = "gr_draw_arc" "gr_draw_arc_nat" +val draw_ellipse : int -> int -> int -> int -> unit (** [draw_ellipse x y rx ry] draws an ellipse with center [x,y], horizontal radius [rx] and vertical radius [ry]. The current point is unchanged. *) -val draw_ellipse : int -> int -> int -> int -> unit +val draw_circle : int -> int -> int -> unit (** [draw_circle x y r] draws a circle with center [x,y] and radius [r]. The current point is unchanged. *) -val draw_circle : int -> int -> int -> unit +external set_line_width : int -> unit = "gr_set_line_width" (** Set the width of points and lines drawn with the functions above. Under X Windows, [set_line_width 0] selects a width of 1 pixel and a faster, but less precise drawing algorithm than the one used when [set_line_width 1] is specified. *) -external set_line_width : int -> unit = "gr_set_line_width" (** {2 Text drawing} *) -(** See {!Graphics.draw_string}.*) external draw_char : char -> unit = "gr_draw_char" +(** See {!Graphics.draw_string}.*) + +external draw_string : string -> unit = "gr_draw_string" (** Draw a character or a character string with lower left corner at current position. After drawing, the current position is set to the lower right corner of the text drawn. *) -external draw_string : string -> unit = "gr_draw_string" +external set_font : string -> unit = "gr_set_font" (** Set the font used for drawing text. The interpretation of the arguments to [set_font] is implementation-dependent. *) -external set_font : string -> unit = "gr_set_font" + +val set_text_size : int -> unit (** Set the character size used for drawing text. The interpretation of the arguments to [set_text_size] is implementation-dependent. *) -val set_text_size : int -> unit +external text_size : string -> int * int = "gr_text_size" (** Return the dimensions of the given text, if it were drawn with the current font and size. *) -external text_size : string -> int * int = "gr_text_size" (** {2 Filling} *) +external fill_rect : int -> int -> int -> int -> unit = "gr_fill_rect" (** [fill_rect x y w h] fills the rectangle with lower left corner at [x,y], width [w] and height [h], with the current color. *) -external fill_rect : int -> int -> int -> int -> unit = "gr_fill_rect" +external fill_poly : (int * int) array -> unit = "gr_fill_poly" (** Fill the given polygon with the current color. The array contains the coordinates of the vertices of the polygon. *) -external fill_poly : (int * int) array -> unit = "gr_fill_poly" +external fill_arc : + int -> int -> int -> int -> int -> int -> + unit = "gr_fill_arc" "gr_fill_arc_nat" (** Fill an elliptical pie slice with the current color. The parameters are the same as for {!Graphics.draw_arc}. *) -external fill_arc : - int -> int -> int -> int -> int -> int -> unit - = "gr_fill_arc" "gr_fill_arc_nat" + +val fill_ellipse : int -> int -> int -> int -> unit (** Fill an ellipse with the current color. The parameters are the same as for {!Graphics.draw_ellipse}. *) -val fill_ellipse : int -> int -> int -> int -> unit +val fill_circle : int -> int -> int -> unit (** Fill a circle with the current color. The parameters are the same as for {!Graphics.draw_circle}. *) -val fill_circle : int -> int -> int -> unit (** {2 Images} *) +type image (** The abstract type for images, in internal representation. Externally, images are represented as matrices of colors. *) -type image +val transp : color (** In matrices of colors, this color represent a ``transparent'' point: when drawing the corresponding image, all pixels on the screen corresponding to a transparent pixel in the image will not be modified, while other points will be set to the color of the corresponding point in the image. This allows superimposing an image over an existing background. *) -val transp : color +external make_image : color array array -> image = "gr_make_image" (** Convert the given color matrix to an image. Each sub-array represents one horizontal line. All sub-arrays must have the same length; otherwise, exception [Graphic_failure] is raised. *) -external make_image : color array array -> image = "gr_make_image" -(** Convert an image to a color matrix. *) external dump_image : image -> color array array = "gr_dump_image" +(** Convert an image to a color matrix. *) -(** Draw the given image with lower left corner at the given point. *) external draw_image : image -> int -> int -> unit = "gr_draw_image" +(** Draw the given image with lower left corner at the given point. *) +val get_image : int -> int -> int -> int -> image (** Capture the contents of a rectangle on the screen as an image. The parameters are the same as for {!Graphics.fill_rect}. *) -val get_image : int -> int -> int -> int -> image +external create_image : int -> int -> image = "gr_create_image" (** [create_image w h] returns a new image [w] pixels wide and [h] pixels tall, to be used in conjunction with [blit_image]. The initial image contents are random, except that no point is transparent. *) -external create_image : int -> int -> image = "gr_create_image" +external blit_image : image -> int -> int -> unit = "gr_blit_image" (** [blit_image img x y] copies screen pixels into the image [img], modifying [img] in-place. The pixels copied are those inside the rectangle with lower left corner at [x,y], and width and height equal to those of the image. Pixels that were transparent in [img] are left unchanged. *) -external blit_image : image -> int -> int -> unit = "gr_blit_image" (** {2 Mouse and keyboard events} *) -(** To report events. *) type status = { mouse_x : int; (** X coordinate of the mouse *) mouse_y : int; (** Y coordinate of the mouse *) button : bool; (** true if a mouse button is pressed *) keypressed : bool; (** true if a key has been pressed *) - key : char ; (** the character for the key pressed *) - } + key : char; (** the character for the key pressed *) + } +(** To report events. *) -(** To specify events to wait for. *) type event = Button_down (** A mouse button is pressed *) | Button_up (** A mouse button is released *) | Key_pressed (** A key is pressed *) | Mouse_motion (** The mouse is moved *) | Poll (** Don't wait; return immediately *) +(** To specify events to wait for. *) +external wait_next_event : event list -> status = "gr_wait_event" (** Wait until one of the events specified in the given event list occurs, and return the status of the mouse and keyboard at that time. If [Poll] is given in the event list, return immediately @@ -292,36 +298,36 @@ type event = outside the range [0..size_x()-1, 0..size_y()-1]. Keypresses are queued, and dequeued one by one when the [Key_pressed] event is specified. *) -external wait_next_event : event list -> status = "gr_wait_event" (** {2 Mouse and keyboard polling} *) +val mouse_pos : unit -> int * int (** Return the position of the mouse cursor, relative to the graphics window. If the mouse cursor is outside of the graphics window, [mouse_pos()] returns a point outside of the range [0..size_x()-1, 0..size_y()-1]. *) -val mouse_pos : unit -> int * int -(** Return [true] if the mouse button is pressed, [false] otherwise. *) val button_down : unit -> bool +(** Return [true] if the mouse button is pressed, [false] otherwise. *) +val read_key : unit -> char (** Wait for a key to be pressed, and return the corresponding character. Keypresses are queued. *) -val read_key : unit -> char +val key_pressed : unit -> bool (** Return [true] if a keypress is available; that is, if [read_key] would not block. *) -val key_pressed : unit -> bool (** {2 Sound} *) +external sound : int -> int -> unit = "gr_sound" (** [sound freq dur] plays a sound at frequency [freq] (in hertz) for a duration [dur] (in milliseconds). *) -external sound : int -> int -> unit = "gr_sound" (** {2 Double buffering} *) +val auto_synchronize : bool -> unit (** By default, drawing takes place both on the window displayed on screen, and in a memory area (the ``backing store''). The backing store image is used to re-paint the on-screen @@ -342,27 +348,26 @@ external sound : int -> int -> unit = "gr_sound" both on screen and in the backing store. The default drawing mode corresponds to [auto_synchronize true]. *) -val auto_synchronize : bool -> unit +external synchronize : unit -> unit = "gr_synchronize" (** Synchronize the backing store and the on-screen window, by copying the contents of the backing store onto the graphics window. *) -external synchronize : unit -> unit = "gr_synchronize" +external display_mode : bool -> unit = "gr_display_mode" (** Set display mode on or off. When turned on, drawings are done in the graphics window; when turned off, drawings do not affect the graphics window. This occurs independently of drawing into the backing store (see the function {!Graphics.remember_mode} below). Default display mode is on. *) -external display_mode : bool -> unit = "gr_display_mode" +external remember_mode : bool -> unit = "gr_remember_mode" (** Set remember mode on or off. When turned on, drawings are done in the backing store; when turned off, the backing store is unaffected by drawings. This occurs independently of drawing onto the graphics window (see the function {!Graphics.display_mode} above). Default remember mode is on. *) -external remember_mode : bool -> unit = "gr_remember_mode" diff --git a/otherlibs/graph/graphicsX11.mli b/otherlibs/graph/graphicsX11.mli index 12c5f6048..b213ec738 100644 --- a/otherlibs/graph/graphicsX11.mli +++ b/otherlibs/graph/graphicsX11.mli @@ -16,15 +16,15 @@ type window_id = string +val window_id : unit -> window_id (** Return the unique identifier of the Caml graphics window. The returned string is an unsigned 32 bits integer in decimal form. *) -val window_id : unit -> window_id +val open_subwindow : x:int -> y:int -> width:int -> height:int -> window_id (** Create a sub-window of the current Caml graphics window and return its identifier. *) -val open_subwindow : x:int -> y:int -> width:int -> height:int -> window_id -(** Close the sub-window having the given identifier. *) val close_subwindow : window_id -> unit +(** Close the sub-window having the given identifier. *) |