summaryrefslogtreecommitdiffstats
path: root/otherlibs
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2004-11-09 14:24:40 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2004-11-09 14:24:40 +0000
commita173c47090b3b86865b7096f146c16986e930734 (patch)
tree295d901fa97cb89b1ce510a1fac3f7309c311b57 /otherlibs
parentd113ba55c5244edbf598741132b9f4f01258ef41 (diff)
Suppression string_misc (PR#2891) + unused variable
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6672 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs')
-rw-r--r--otherlibs/num/.depend10
-rw-r--r--otherlibs/num/Makefile2
-rw-r--r--otherlibs/num/Makefile.nt2
-rw-r--r--otherlibs/num/big_int.ml1
-rw-r--r--otherlibs/num/ratio.ml11
-rw-r--r--otherlibs/num/string_misc.ml20
-rw-r--r--otherlibs/num/string_misc.mli16
7 files changed, 10 insertions, 52 deletions
diff --git a/otherlibs/num/.depend b/otherlibs/num/.depend
index 406a6bf58..b2da6333b 100644
--- a/otherlibs/num/.depend
+++ b/otherlibs/num/.depend
@@ -1,6 +1,6 @@
-bng.o: bng.c bng.h bng_ppc.c bng_digit.c
bng_alpha.o: bng_alpha.c
bng_amd64.o: bng_amd64.c
+bng.o: bng.c bng.h bng_digit.c
bng_digit.o: bng_digit.c
bng_ia32.o: bng_ia32.c
bng_mips.o: bng_mips.c
@@ -28,9 +28,5 @@ nat.cmo: int_misc.cmi nat.cmi
nat.cmx: int_misc.cmx nat.cmi
num.cmo: arith_flags.cmi big_int.cmi int_misc.cmi nat.cmi ratio.cmi num.cmi
num.cmx: arith_flags.cmx big_int.cmx int_misc.cmx nat.cmx ratio.cmx num.cmi
-ratio.cmo: arith_flags.cmi big_int.cmi int_misc.cmi nat.cmi string_misc.cmi \
- ratio.cmi
-ratio.cmx: arith_flags.cmx big_int.cmx int_misc.cmx nat.cmx string_misc.cmx \
- ratio.cmi
-string_misc.cmo: string_misc.cmi
-string_misc.cmx: string_misc.cmi
+ratio.cmo: arith_flags.cmi big_int.cmi int_misc.cmi nat.cmi ratio.cmi
+ratio.cmx: arith_flags.cmx big_int.cmx int_misc.cmx nat.cmx ratio.cmi
diff --git a/otherlibs/num/Makefile b/otherlibs/num/Makefile
index 41abb9fe7..981cfd2eb 100644
--- a/otherlibs/num/Makefile
+++ b/otherlibs/num/Makefile
@@ -26,7 +26,7 @@ CAMLOPT=../../ocamlcompopt.sh
MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
COMPFLAGS=-w sY -warn-error Ay
-CAMLOBJS=int_misc.cmo string_misc.cmo nat.cmo big_int.cmo arith_flags.cmo \
+CAMLOBJS=int_misc.cmo nat.cmo big_int.cmo arith_flags.cmo \
ratio.cmo num.cmo arith_status.cmo
CMIFILES=big_int.cmi nat.cmi num.cmi ratio.cmi arith_status.cmi
diff --git a/otherlibs/num/Makefile.nt b/otherlibs/num/Makefile.nt
index a36a3d3b9..369469295 100644
--- a/otherlibs/num/Makefile.nt
+++ b/otherlibs/num/Makefile.nt
@@ -24,7 +24,7 @@ CFLAGS=-O -I../../byterun \
CAMLC=../../boot/ocamlrun ../../ocamlc -I ../../boot -w s
CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -w s
-CAMLOBJS=int_misc.cmo string_misc.cmo nat.cmo big_int.cmo arith_flags.cmo \
+CAMLOBJS=int_misc.cmo nat.cmo big_int.cmo arith_flags.cmo \
ratio.cmo num.cmo arith_status.cmo
CMIFILES=big_int.cmi nat.cmi num.cmi ratio.cmi arith_status.cmi
diff --git a/otherlibs/num/big_int.ml b/otherlibs/num/big_int.ml
index 5d556daa7..ddd5d7313 100644
--- a/otherlibs/num/big_int.ml
+++ b/otherlibs/num/big_int.ml
@@ -461,7 +461,6 @@ let power_big_int_positive_big_int bi1 bi2 =
0 -> unit_big_int
| -1 -> invalid_arg "power_big_int_positive_big_int"
| _ -> let nat = bi2.abs_value
- and off = 0
and len_bi2 = num_digits_big_int bi2 in
let bi1_len = num_digits_big_int bi1 in
let res_len = int_of_big_int (mult_int_big_int bi1_len bi2) in
diff --git a/otherlibs/num/ratio.ml b/otherlibs/num/ratio.ml
index 500236420..3e86d84c1 100644
--- a/otherlibs/num/ratio.ml
+++ b/otherlibs/num/ratio.ml
@@ -12,7 +12,6 @@
(***********************************************************************)
open Int_misc
-open String_misc
open Nat
open Big_int
open Arith_flags
@@ -552,14 +551,14 @@ let string_of_ratio r =
scientifique. *)
let ratio_of_string s =
- let n = index_char s '/' 0 in
- if n = -1 then
+ try
+ let n = String.index s '/' in
+ create_ratio (sys_big_int_of_string s 0 n)
+ (sys_big_int_of_string s (n+1) (String.length s - n - 1))
+ with Not_found ->
{ numerator = big_int_of_string s;
denominator = unit_big_int;
normalized = true }
- else
- create_ratio (sys_big_int_of_string s 0 n)
- (sys_big_int_of_string s (n+1) (String.length s - n - 1))
(* Coercion with type float *)
diff --git a/otherlibs/num/string_misc.ml b/otherlibs/num/string_misc.ml
deleted file mode 100644
index b6e33b9b7..000000000
--- a/otherlibs/num/string_misc.ml
+++ /dev/null
@@ -1,20 +0,0 @@
-(***********************************************************************)
-(* *)
-(* Objective Caml *)
-(* *)
-(* Valerie Menissier-Morain, projet Cristal, INRIA Rocquencourt *)
-(* *)
-(* Copyright 1996 Institut National de Recherche en Informatique et *)
-(* en Automatique. All rights reserved. This file is distributed *)
-(* under the terms of the GNU Library General Public License, with *)
-(* the special exception on linking described in file ../../LICENSE. *)
-(* *)
-(***********************************************************************)
-
-(* $Id$ *)
-
-let rec index_char str chr pos =
- if pos >= String.length str then -1
- else if String.get str pos = chr then pos
- else index_char str chr (pos + 1)
-;;
diff --git a/otherlibs/num/string_misc.mli b/otherlibs/num/string_misc.mli
deleted file mode 100644
index ef89c91b8..000000000
--- a/otherlibs/num/string_misc.mli
+++ /dev/null
@@ -1,16 +0,0 @@
-(***********************************************************************)
-(* *)
-(* Objective Caml *)
-(* *)
-(* Valerie Menissier-Morain, projet Cristal, INRIA Rocquencourt *)
-(* *)
-(* Copyright 1996 Institut National de Recherche en Informatique et *)
-(* en Automatique. All rights reserved. This file is distributed *)
-(* under the terms of the GNU Library General Public License, with *)
-(* the special exception on linking described in file ../../LICENSE. *)
-(* *)
-(***********************************************************************)
-
-(* $Id$ *)
-
-val index_char: string -> char -> int -> int