diff options
author | Pierre Weis <Pierre.Weis@inria.fr> | 1998-12-02 10:39:36 +0000 |
---|---|---|
committer | Pierre Weis <Pierre.Weis@inria.fr> | 1998-12-02 10:39:36 +0000 |
commit | d0abd87e0bee6d1fad4eda5fbfbdeacb496e3bed (patch) | |
tree | 07d659d91974e55c0eb12c588078225bafc16820 | |
parent | ec7e60cf1bf13d00c776c73f0bd12c61ac43ab71 (diff) |
Ajout des fonctions int_of_float, float_of_int et bool_of_string.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2209 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | otherlibs/threads/pervasives.ml | 8 | ||||
-rw-r--r-- | otherlibs/threads/threadUnix.ml | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/otherlibs/threads/pervasives.ml b/otherlibs/threads/pervasives.ml index 4b61dcb54..c2834ac98 100644 --- a/otherlibs/threads/pervasives.ml +++ b/otherlibs/threads/pervasives.ml @@ -5,7 +5,7 @@ (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) -(* Automatique. Distributed only by permission. *) +(* en Automatique. Distributed only by permission. *) (* *) (***********************************************************************) @@ -107,7 +107,9 @@ external frexp : float -> float * int = "frexp_float" external ldexp : float -> int -> float = "ldexp_float" external modf : float -> float * float = "modf_float" "modf" external float : int -> float = "%floatofint" +external float_of_int : int -> float = "%floatofint" external truncate : float -> int = "%intoffloat" +external int_of_float : float -> int = "%intoffloat" (* String operations -- more in module String *) @@ -135,6 +137,10 @@ external format_float: string -> float -> string = "format_float" let string_of_bool b = if b then "true" else "false" +let bool_of_string = function + | "true" -> true + | "false" -> false + | _ -> invalid_arg "string_of_bool" let string_of_int n = format_int "%d" n diff --git a/otherlibs/threads/threadUnix.ml b/otherlibs/threads/threadUnix.ml index e22a26a63..a20bdf876 100644 --- a/otherlibs/threads/threadUnix.ml +++ b/otherlibs/threads/threadUnix.ml @@ -178,6 +178,6 @@ let establish_server server_fun sockaddr = close_in inchan; close_out outchan; exit 0 - | id -> close s; waitpid [] id (* Reclaim the son *); () + | id -> close s; let _ = waitpid [] id (* Reclaim the son *) in () done |