Skip to content

Commit

Permalink
Whitespace normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
toton committed Dec 8, 2011
1 parent dd45536 commit 34be8cf
Show file tree
Hide file tree
Showing 19 changed files with 312 additions and 312 deletions.
4 changes: 2 additions & 2 deletions src/batDigest.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ExtDigest - Additional functions for MD5 message digests
* Copyright (C) 1996 Xavier Leroy, INRIA Rocquencourt
* Copyright (C) 2009 David Teller, LIFO, Universite d'Orleans
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
Expand Down Expand Up @@ -43,7 +43,7 @@ val channel : input -> int -> Digest.t
[End_of_file] if end-of-file is reached before [len] characters
are read. If [len] is negative, [Digest.channel ic len] reads
all characters from [ic] until end-of-file is reached and return
their digest.
their digest.
{b Note} This version of [channel] is currently very inefficient
if [len] < 0 and requires copying the whole input to a temporary
Expand Down
66 changes: 33 additions & 33 deletions src/batHashtbl.ml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(*
(*
* ExtHashtbl, extra functions over hashtables.
* Copyright (C) 1996 Xavier Leroy
* 2003 Nicolas Cannasse
* 2005 Damien Doligez
* 2009 David Rajchenbach-Teller, LIFO, Universite d'Orleans
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
Expand All @@ -20,7 +20,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)


(** {6 Import the contents of {!Hashtbl}}
Expand All @@ -45,7 +45,7 @@
type ('a, 'b) h_bucketlist =
| Empty
| Cons of 'a * 'b * ('a, 'b) h_bucketlist

type ('a, 'b) h_t = {
mutable size: int;
mutable data: ('a, 'b) h_bucketlist array
Expand All @@ -71,7 +71,7 @@
done;
tbl.data <- ndata;
end

let enum h =
let rec make ipos ibuck idata icount =
let pos = ref ipos in
Expand All @@ -88,7 +88,7 @@
let rec next() =
force();
match !buck with
| Empty ->
| Empty ->
if !hcount = 0 then raise BatEnum.No_more_elements;
incr pos;
buck := Array.unsafe_get !hdata !pos;
Expand All @@ -106,23 +106,23 @@
make !pos !buck !hdata !hcount
in
BatEnum.make ~next ~count ~clone
in
in
make (-1) Empty (Obj.magic()) (-1)

let keys h =
BatEnum.map (fun (k,_) -> k) (enum h)

let values h =
BatEnum.map (fun (_,v) -> v) (enum h)

let map f h =
let rec loop = function
| Empty -> Empty
| Cons (k,v,next) -> Cons (k,f k v,loop next)
in
h_make {
size = (h_conv h).size;
data = Array.map loop (h_conv h).data;
data = Array.map loop (h_conv h).data;
}

let remove_all h key =
Expand All @@ -138,7 +138,7 @@
in
let pos = (hash key) mod (Array.length hc.data) in
Array.unsafe_set hc.data pos (loop (Array.unsafe_get hc.data pos))

let find_default h key defval =
let rec loop = function
| Empty -> defval
Expand All @@ -147,7 +147,7 @@
in
let pos = (hash key) mod (Array.length (h_conv h).data) in
loop (Array.unsafe_get (h_conv h).data pos)

let find_option h key =
let rec loop = function
| Empty -> None
Expand All @@ -156,15 +156,15 @@
in
let pos = (hash key) mod (Array.length (h_conv h).data) in
loop (Array.unsafe_get (h_conv h).data pos)

let of_enum e =
let h = create (if BatEnum.fast_count e then BatEnum.count e else 0) in
BatEnum.iter (fun (k,v) -> add h k v) e;
h

let length h =
(h_conv h).size

let is_empty h = length h = 0

let print ?(first="{\n") ?(last="\n}") ?(sep=",\n") print_k print_v out t =
Expand Down Expand Up @@ -241,17 +241,17 @@
val values : 'a t -> 'a BatEnum.t
val enum : 'a t -> (key * 'a) BatEnum.t
val of_enum : (key * 'a) BatEnum.t -> 'a t
val print : ?first:string -> ?last:string -> ?sep:string ->
('a BatInnerIO.output -> key -> unit) ->
('a BatInnerIO.output -> 'b -> unit) ->
val print : ?first:string -> ?last:string -> ?sep:string ->
('a BatInnerIO.output -> key -> unit) ->
('a BatInnerIO.output -> 'b -> unit) ->
'a BatInnerIO.output -> 'b t -> unit

(** Operations on {!Hashtbl} without exceptions.*)
module Exceptionless :
sig
val find : 'a t -> key -> 'a option
end

(** Infix operators over a {!BatHashtbl} *)
module Infix :
sig
Expand All @@ -270,7 +270,7 @@
end

(** Operations on {!Hashtbl} with labels.
This module overrides a number of functions of {!Hashtbl} by
functions in which some arguments require labels. These labels are
there to improve readability and safety and to let you change the
Expand All @@ -292,7 +292,7 @@
end

end


module Make(H: HashedType): (S with type key = H.t) =
struct
Expand All @@ -306,19 +306,19 @@
let create = create
let clear = clear
let copy = copy
let safehash key = (H.hash key) land max_int
let add h key info =
let h = h_conv h in
let i = (safehash key) mod (Array.length h.data) in
let bucket = Cons(key, info, h.data.(i)) in
h.data.(i) <- bucket;
h.size <- succ h.size;
if h.size > Array.length h.data lsl 1 then resize safehash h
let remove h key =
let h = h_conv h in
let h = h_conv h in
let rec remove_bucket = function
Empty ->
Empty
Expand All @@ -328,13 +328,13 @@
else Cons(k, i, remove_bucket next) in
let i = (safehash key) mod (Array.length h.data) in
h.data.(i) <- remove_bucket h.data.(i)
let rec find_rec key = function
Empty ->
raise Not_found
| Cons(k, d, rest) ->
if H.equal key k then d else find_rec key rest
let find h key =
let h = h_conv h in
match h.data.((safehash key) mod (Array.length h.data)) with
Expand All @@ -349,7 +349,7 @@
Empty -> raise Not_found
| Cons(k3, d3, rest3) ->
if H.equal key k3 then d3 else find_rec key rest3
let find_all h key =
let rec find_in_bucket = function
Empty ->
Expand All @@ -359,7 +359,7 @@
then d :: find_in_bucket rest
else find_in_bucket rest in
find_in_bucket h.data.((safehash key) mod (Array.length h.data))
let replace h key info =
let rec replace_bucket = function
Empty ->
Expand All @@ -384,7 +384,7 @@
| Cons(k, d, rest) ->
H.equal k key || mem_in_bucket rest in
mem_in_bucket h.data.((safehash key) mod (Array.length h.data))*)

let iter = iter
let fold = fold
let length = length
Expand Down Expand Up @@ -435,7 +435,7 @@
result

let filter f t = filteri (fun k a -> f a) t

let filter_map f t =
let result = create 16 in
iter (fun k a -> match f k a with
Expand Down Expand Up @@ -471,7 +471,7 @@
module Cap =
struct
type ('a, 'b, 'c) t = ('a, 'b) Hashtbl.t constraint 'c = [< `Read | `Write ]

let create = create
external of_table : ('a, 'b) Hashtbl.t -> ('a, 'b, _ ) t = "%identity"
external to_table : ('a, 'b, [`Read | `Write]) t -> ('a, 'b) Hashtbl.t = "%identity"
Expand Down
Loading

0 comments on commit 34be8cf

Please sign in to comment.