summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
authorPierre Weis <Pierre.Weis@inria.fr>2000-12-28 13:07:42 +0000
committerPierre Weis <Pierre.Weis@inria.fr>2000-12-28 13:07:42 +0000
commit2116da4220acde3fdf11ac0ef0100e0166729bcd (patch)
tree3d09bdc4675c58823863bfe12c05e6cdd490d6f0 /stdlib
parent447c79eadec7db87abc782735c5b06ed4fd020e4 (diff)
Getting rid of obsolete boolean operators & and or
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3359 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/arg.ml2
-rw-r--r--stdlib/array.ml8
-rw-r--r--stdlib/filename.ml6
-rw-r--r--stdlib/format.ml33
-rw-r--r--stdlib/format.mli18
-rw-r--r--stdlib/marshal.ml2
-rw-r--r--stdlib/oo.ml6
-rw-r--r--stdlib/set.ml2
-rw-r--r--stdlib/string.ml8
9 files changed, 44 insertions, 41 deletions
diff --git a/stdlib/arg.ml b/stdlib/arg.ml
index 48c3343bf..3e7133e20 100644
--- a/stdlib/arg.ml
+++ b/stdlib/arg.ml
@@ -70,7 +70,7 @@ let parse speclist anonfun errmsg =
incr current;
while !current < l do
let s = Sys.argv.(!current) in
- if String.length s >= 1 & String.get s 0 = '-' then begin
+ if String.length s >= 1 && String.get s 0 = '-' then begin
let action =
try assoc3 s speclist
with Not_found -> stop (Unknown s)
diff --git a/stdlib/array.ml b/stdlib/array.ml
index 58e3f7ed9..38d99c066 100644
--- a/stdlib/array.ml
+++ b/stdlib/array.ml
@@ -84,7 +84,7 @@ let concat al =
in find_init al
let sub a ofs len =
- if ofs < 0 or len < 0 or ofs + len > length a then invalid_arg "Array.sub"
+ if ofs < 0 || len < 0 || ofs + len > length a then invalid_arg "Array.sub"
else if len = 0 then [||]
else begin
let r = create len (unsafe_get a ofs) in
@@ -93,13 +93,13 @@ let sub a ofs len =
end
let fill a ofs len v =
- if ofs < 0 or len < 0 or ofs + len > length a
+ if ofs < 0 || len < 0 || ofs + len > length a
then invalid_arg "Array.fill"
else for i = ofs to ofs + len - 1 do unsafe_set a i v done
let blit a1 ofs1 a2 ofs2 len =
- if len < 0 or ofs1 < 0 or ofs1 + len > length a1
- or ofs2 < 0 or ofs2 + len > length a2
+ if len < 0 || ofs1 < 0 || ofs1 + len > length a1
+ || ofs2 < 0 || ofs2 + len > length a2
then invalid_arg "Array.blit"
else if ofs1 < ofs2 then
(* Top-down copy *)
diff --git a/stdlib/filename.ml b/stdlib/filename.ml
index 1547d4ace..36c1e687e 100644
--- a/stdlib/filename.ml
+++ b/stdlib/filename.ml
@@ -17,7 +17,7 @@ module Unix = struct
let parent_dir_name = ".."
let concat dirname filename =
let l = String.length dirname in
- if l = 0 or dirname.[l-1] = '/'
+ if l = 0 || dirname.[l-1] = '/'
then dirname ^ filename
else dirname ^ "/" ^ filename
let is_relative n = String.length n < 1 || n.[0] <> '/';;
@@ -51,7 +51,7 @@ module Win32 = struct
let parent_dir_name = ".."
let concat dirname filename =
let l = String.length dirname in
- if l = 0 or (let c = dirname.[l-1] in c = '/' or c = '\\' or c = ':')
+ if l = 0 || (let c = dirname.[l-1] in c = '/' || c = '\\' || c = ':')
then dirname ^ filename
else dirname ^ "\\" ^ filename
let is_relative n =
@@ -101,7 +101,7 @@ module MacOS = struct
let parent_dir_name = ".."
let concat dirname filename =
let l = String.length dirname in
- if l = 0 or dirname.[l-1] = ':'
+ if l = 0 || dirname.[l-1] = ':'
then dirname ^ filename
else dirname ^ ":" ^ filename
let contains_colon n = String.contains n ':'
diff --git a/stdlib/format.ml b/stdlib/format.ml
index a512b1db1..0d3563f4f 100644
--- a/stdlib/format.ml
+++ b/stdlib/format.ml
@@ -780,14 +780,13 @@ let fprintf_out str out ppf format =
invalid_arg ("fprintf: bad %s format, " ^ format) in
if p > 0 && String.length s < p then begin
pp_print_as_string ppf
- (String.make (p - String.length s) ' ');
- pp_print_as_string ppf s
- end else if p < 0 && String.length s < -p then begin
+ (String.make (p - String.length s) ' ');
+ pp_print_as_string ppf s end else
+ if p < 0 && String.length s < -p then begin
pp_print_as_string ppf s;
pp_print_as_string ppf
- (String.make (-p - String.length s) ' ')
- end else
- pp_print_as_string ppf s
+ (String.make (-p - String.length s) ' ') end
+ else pp_print_as_string ppf s
end;
doprn (succ j))
| 'c' ->
@@ -807,25 +806,25 @@ let fprintf_out str out ppf format =
| 'b' ->
Obj.magic(fun b ->
pp_print_as_string ppf (string_of_bool b);
- doprn(succ j))
+ doprn (succ j))
| 'a' ->
if str then
Obj.magic(fun printer arg ->
pp_print_as_string ppf (printer () arg);
- doprn(succ j))
+ doprn (succ j))
else
Obj.magic(fun printer arg ->
printer ppf arg;
- doprn(succ j))
+ doprn (succ j))
| 't' ->
if str then
Obj.magic(fun printer ->
pp_print_as_string ppf (printer ());
- doprn(succ j))
+ doprn (succ j))
else
Obj.magic(fun printer ->
printer ppf;
- doprn(succ j))
+ doprn (succ j))
| c ->
format_invalid_arg "fprintf: unknown format " c
end
@@ -859,13 +858,13 @@ let fprintf_out str out ppf format =
let j = succ j in
if j >= limit then Pp_hbox, j else
begin match format.[j] with
- | 'o' ->
+ | 'o' ->
let j = succ j in
if j >= limit
then invalid_arg ("fprintf: bad box format " ^ format) else
begin match format.[j] with
| 'v' -> Pp_hovbox, succ j
- | c -> format_invalid_arg "fprintf: bad name " c end
+ | c -> format_invalid_arg "fprintf: bad box name " c end
| 'v' -> Pp_hvbox, succ j
| c -> Pp_hbox, j
end
@@ -885,17 +884,17 @@ let fprintf_out str out ppf format =
then invalid_arg "fprintf: bad break format" format
else pp_print_break ppf nspaces offset;
j
- | c -> pp_print_space ppf (); i
+ | c -> pp_print_space ppf (); i
and do_pp_open ppf i =
if i >= limit then begin pp_open_box_gen ppf 0 Pp_box; i end else
match format.[i] with
| '<' ->
- let k, j = get_box_kind (succ i) in
+ let kind, j = get_box_kind (succ i) in
let size, j = get_int "fprintf: bad box format " format j in
- pp_open_box_gen ppf size k;
+ pp_open_box_gen ppf size kind;
j
- | c -> pp_open_box_gen ppf 0 Pp_box; i
+ | c -> pp_open_box_gen ppf 0 Pp_box; i
in doprn 0;;
diff --git a/stdlib/format.mli b/stdlib/format.mli
index 964c879c1..66eccf97f 100644
--- a/stdlib/format.mli
+++ b/stdlib/format.mli
@@ -33,7 +33,8 @@
For instance, the sequence
[open_box (); print_string "x ="; print_space (); print_int 1; close_box ()]
that prints [x = 1] within a pretty-printing box, can be
- abbreviated as [printf "@\[%s@ %i@\]" "x =" 1]. *)
+ abbreviated as [printf "@\[%s@ %i@\]" "x =" 1], or even shorter
+ [printf "@\[x =@ %i@\]" 1]. *)
(* Rule of thumb for casual users of this library:
- use simple boxes (as obtained by [open_box 0]);
@@ -61,7 +62,7 @@
(*** Boxes *)
val open_box : int -> unit;;
(* [open_box d] opens a new pretty-printing box
- with offset [d].
+ with offset [d].
This box is the general purpose pretty-printing box.
Material in this box is displayed ``horizontal or vertical'':
break hints inside the box may lead to a new line, if there
@@ -107,7 +108,8 @@ val print_break : int -> int -> unit;;
(* Insert a break hint in a pretty-printing box.
[print_break nspaces offset] indicates that the line may
be split (a newline character is printed) at this point,
- if the contents of the current box does not fit on one line.
+ if the contents of the current box does not fit on the
+ current line.
If the line is split at that point, [offset] is added to
the current indentation. If the line is not split,
[nspaces] spaces are printed. *)
@@ -169,14 +171,14 @@ val open_hbox : unit -> unit;;
(new lines may still occur inside boxes nested deeper). *)
val open_vbox : int -> unit;;
(* [open_vbox d] opens a new pretty-printing box
- with offset [d].
+ with offset [d].
This box is ``vertical'': every break hint inside this
box leads to a new line.
When a new line is printed in the box, [d] is added to the
current indentation. *)
val open_hvbox : int -> unit;;
(* [open_hvbox d] opens a new pretty-printing box
- with offset [d].
+ with offset [d].
This box is ``horizontal-vertical'': it behaves as an
``horizontal'' box if it fits on a single line,
otherwise it behaves as a ``vertical'' box.
@@ -184,7 +186,7 @@ val open_hvbox : int -> unit;;
current indentation. *)
val open_hovbox : int -> unit;;
(* [open_hovbox d] opens a new pretty-printing box
- with offset [d].
+ with offset [d].
This box is ``horizontal or vertical'': break hints
inside this box may lead to a new line, if there is no more room
on the line to print the remainder of the box.
@@ -223,6 +225,7 @@ val get_ellipsis_text : unit -> string;;
val set_formatter_out_channel : out_channel -> unit;;
(* Redirect the pretty-printer output to the given channel. *)
+(*** Changing the meaning of printing material *)
val set_formatter_output_functions :
out:(buf:string -> pos:int -> len:int -> unit) ->
flush:(unit -> unit) -> unit;;
@@ -238,7 +241,8 @@ val get_formatter_output_functions :
unit -> (buf:string -> pos:int -> len:int -> unit) * (unit -> unit);;
(* Return the current output functions of the pretty-printer. *)
-(*** Changing the meaning of indentation and line breaking *)
+(*** Changing the meaning of pretty printing (indentation, line breaking,
+ and printing material) *)
val set_all_formatter_output_functions :
out:(buf:string -> pos:int -> len:int -> unit) ->
flush:(unit -> unit) ->
diff --git a/stdlib/marshal.ml b/stdlib/marshal.ml
index e18ee2862..cf49605d0 100644
--- a/stdlib/marshal.ml
+++ b/stdlib/marshal.ml
@@ -25,7 +25,7 @@ external to_buffer_unsafe:
= "output_value_to_buffer"
let to_buffer buff ofs len v flags =
- if ofs < 0 or len < 0 or ofs + len > String.length buff
+ if ofs < 0 || len < 0 || ofs + len > String.length buff
then invalid_arg "Marshal.to_buffer: substring out of bounds"
else to_buffer_unsafe buff ofs len v flags
diff --git a/stdlib/oo.ml b/stdlib/oo.ml
index 1ea69e90d..78abbbc3f 100644
--- a/stdlib/oo.ml
+++ b/stdlib/oo.ml
@@ -161,7 +161,7 @@ let rec except e =
let merge_buckets b1 b2 =
for i = 0 to bucket_size - 1 do
if
- (b2.(i) != dummy_item) & (b1.(i) != dummy_item) & (b2.(i) != b1.(i))
+ (b2.(i) != dummy_item) && (b1.(i) != dummy_item) && (b2.(i) != b1.(i))
then
raise Failed
done;
@@ -173,7 +173,7 @@ let merge_buckets b1 b2 =
b1
let rec choose bucket i =
- if (i > 0) & (!small_bucket_count > 0) then begin
+ if (i > 0) && (!small_bucket_count > 0) then begin
let n = Random.int !small_bucket_count in
if not (small_bucket !small_buckets.(n)) then begin
remove_bucket n; choose bucket i
@@ -189,7 +189,7 @@ let rec choose bucket i =
let compact b =
if
- (b != empty_bucket) & (bucket_version b = !version) & (small_bucket b)
+ (b != empty_bucket) && (bucket_version b = !version) && (small_bucket b)
then
choose b params.retry_count
else
diff --git a/stdlib/set.ml b/stdlib/set.ml
index 4ef4ed54f..c2e499ab1 100644
--- a/stdlib/set.ml
+++ b/stdlib/set.ml
@@ -113,7 +113,7 @@ module Make(Ord: OrderedType) =
Empty -> invalid_arg "Set.join"
| Node(l', x', r', _) as t' ->
let d = height l' - height r' in
- if d < -2 or d > 2 then join l' x' r' else t'
+ if d < -2 || d > 2 then join l' x' r' else t'
(* Merge two trees l and r into one.
All elements of l must precede the elements of r.
diff --git a/stdlib/string.ml b/stdlib/string.ml
index 5e4f36a21..21543abfb 100644
--- a/stdlib/string.ml
+++ b/stdlib/string.ml
@@ -37,7 +37,7 @@ let copy s =
r
let sub s ofs len =
- if ofs < 0 or len < 0 or ofs + len > length s
+ if ofs < 0 || len < 0 || ofs + len > length s
then invalid_arg "String.sub"
else begin
let r = create len in
@@ -46,13 +46,13 @@ let sub s ofs len =
end
let fill s ofs len c =
- if ofs < 0 or len < 0 or ofs + len > length s
+ if ofs < 0 || len < 0 || ofs + len > length s
then invalid_arg "String.fill"
else unsafe_fill s ofs len c
let blit s1 ofs1 s2 ofs2 len =
- if len < 0 or ofs1 < 0 or ofs1 + len > length s1
- or ofs2 < 0 or ofs2 + len > length s2
+ if len < 0 || ofs1 < 0 || ofs1 + len > length s1
+ || ofs2 < 0 || ofs2 + len > length s2
then invalid_arg "String.blit"
else unsafe_blit s1 ofs1 s2 ofs2 len