Skip to content

Commit

Permalink
Merge ac956ad into ba5b84e
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzhang committed Jan 29, 2018
2 parents ba5b84e + ac956ad commit 2bdfd21
Show file tree
Hide file tree
Showing 174 changed files with 6,046 additions and 6,165 deletions.
34 changes: 19 additions & 15 deletions jscomp/others/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,30 @@ bs_Hash.cmj : bs_Hash.cmi
bs_Queue.cmj : bs_Array.cmj bs_Queue.cmi
bs_List.cmj : bs_Array.cmj bs_List.cmi
bs_Sort.cmj : bs_Array.cmj bs_Sort.cmi
bs_Range.cmj :
bs_Range.cmj : bs_Range.cmi
bs_internalBucketsType.cmj : bs_Array.cmj bs_internalBucketsType.cmi
bs_internalSetBuckets.cmj : bs_internalBucketsType.cmj bs_Array.cmj bs.cmj \
bs_internalSetBuckets.cmi
bs_internalBuckets.cmj : bs_internalBucketsType.cmj bs_Array.cmj \
bs_internalBuckets.cmi
bs_HashMap.cmj : bs_internalBucketsType.cmj bs_internalBuckets.cmj \
bs_Hash.cmj bs_Bag.cmj bs_Array.cmj bs_HashMap.cmi
bs_Hash.cmj bs_Array.cmj bs_HashMap.cmi
bs_HashMultiMap.cmj : bs_internalBucketsType.cmj bs_internalBuckets.cmj \
bs_Hash.cmj bs_Bag.cmj bs_Array.cmj bs_HashMultiMap.cmi
bs_Hash.cmj bs_Array.cmj bs_HashMultiMap.cmi
bs_HashSet.cmj : bs_internalSetBuckets.cmj bs_internalBucketsType.cmj \
bs_Hash.cmj bs_Bag.cmj bs_Array.cmj bs.cmj bs_HashSet.cmi
bs_Hash.cmj bs_Array.cmj bs.cmj bs_HashSet.cmi
bs_HashSetString.cmj : bs_internalSetBuckets.cmj bs_internalBucketsType.cmj \
bs_Array.cmj bs.cmj bs_HashSetString.cmi
bs_HashSetInt.cmj : bs_internalSetBuckets.cmj bs_internalBucketsType.cmj \
bs_Array.cmj bs.cmj bs_HashSetInt.cmi
bs_Bag.cmj :
bs_BagM.cmj :
bs_Cmp.cmj : bs_Cmp.cmi
bs_Map.cmj : bs_internalAVLtree.cmj bs_Cmp.cmj bs_Bag.cmj bs_Array.cmj \
bs_Map.cmi
bs_SortedMapDict.cmj : bs_internalAVLtree.cmj bs_Cmp.cmj bs_Array.cmj \
bs_SortedMapDict.cmi
bs_SortedSetDict.cmj : bs_internalAVLset.cmj bs_Cmp.cmj bs_Array.cmj \
bs_SortedSetDict.cmi
bs_Map.cmj : bs_SortedMapDict.cmj bs_Cmp.cmj bs_Array.cmj bs_Map.cmi
bs_internalMapInt.cmj : bs_internalAVLtree.cmj bs_Sort.cmj bs_Array.cmj
bs_internalMapString.cmj : bs_internalAVLtree.cmj bs_Sort.cmj bs_Array.cmj
bs_MapString.cmj : bs_internalMapString.cmj bs_internalAVLtree.cmj \
Expand All @@ -58,12 +61,10 @@ bs_MapStringM.cmj : bs_internalMapString.cmj bs_internalAVLtree.cmj \
bs_SortString.cmj bs_Array.cmj bs_MapStringM.cmi
bs_MapIntM.cmj : bs_internalMapInt.cmj bs_internalAVLtree.cmj bs_SortInt.cmj \
bs_Array.cmj bs_MapIntM.cmi
bs_Set.cmj : bs_internalAVLset.cmj bs_Cmp.cmj bs_Bag.cmj bs_Array.cmj \
bs_Set.cmi
bs_SetM.cmj : bs_internalAVLset.cmj bs_Sort.cmj bs_Cmp.cmj bs_BagM.cmj \
bs_Array.cmj bs_SetM.cmi
bs_MapM.cmj : bs_internalAVLtree.cmj bs_Sort.cmj bs_Cmp.cmj bs_BagM.cmj \
bs_Array.cmj bs_MapM.cmi
bs_Set.cmj : bs_SortedSetDict.cmj bs_Cmp.cmj bs_Array.cmj bs_Set.cmi
bs_SetM.cmj : bs_internalAVLset.cmj bs_Sort.cmj bs_Cmp.cmj bs_Array.cmj \
bs_SetM.cmi
bs_MapM.cmj : bs_internalAVLtree.cmj bs_Cmp.cmj bs_Array.cmj bs_MapM.cmi
bs_internalSetInt.cmj : bs_internalAVLset.cmj bs_SortInt.cmj bs_Array.cmj
bs_internalSetString.cmj : bs_internalAVLset.cmj bs_SortString.cmj \
bs_Array.cmj
Expand Down Expand Up @@ -108,21 +109,24 @@ bs_Hash.cmi :
bs_Queue.cmi :
bs_List.cmi :
bs_Sort.cmi :
bs_Range.cmi :
bs_internalBucketsType.cmi :
bs_internalSetBuckets.cmi : bs_internalBucketsType.cmi
bs_internalBuckets.cmi : bs_internalBucketsType.cmi
bs_HashMap.cmi : bs_Hash.cmi
bs_HashMultiMap.cmi : bs_Hash.cmi bs_Bag.cmj
bs_HashMultiMap.cmi : bs_Hash.cmi
bs_HashSet.cmi : bs_Hash.cmi
bs_HashSetString.cmi :
bs_HashSetInt.cmi :
bs_Cmp.cmi :
bs_Map.cmi : bs_Cmp.cmi
bs_SortedMapDict.cmi : bs_Cmp.cmi
bs_SortedSetDict.cmi : bs_Cmp.cmi
bs_Map.cmi : bs_SortedMapDict.cmi bs_Cmp.cmi
bs_MapString.cmi :
bs_MapInt.cmi :
bs_MapStringM.cmi :
bs_MapIntM.cmi :
bs_Set.cmi : bs_Cmp.cmi
bs_Set.cmi : bs_SortedSetDict.cmi bs_Cmp.cmi
bs_SetM.cmi : bs_Cmp.cmi
bs_MapM.cmi : bs_Cmp.cmi
bs_SetInt.cmi :
Expand Down
2 changes: 2 additions & 0 deletions jscomp/others/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ SOURCE_LIST= node_path node_fs node_process dict node_module js_array js_string
bs_Bag\
bs_BagM\
bs_Cmp\
bs_SortedMapDict\
bs_SortedSetDict\
bs_Map\
bs_internalMapInt\
bs_internalMapString\
Expand Down
2 changes: 2 additions & 0 deletions jscomp/others/bs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ module SortInt = Bs_SortInt
module SortString = Bs_SortString
module Stack = Bs_Stack
module Range = Bs_Range
module SortedMapDict = Bs_SortedMapDict
module SortedSetDict = Bs_SortedSetDict
module Map = Bs_Map
module MapM = Bs_MapM
module Set = Bs_Set
Expand Down
6 changes: 3 additions & 3 deletions jscomp/others/bs_Array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ let zip xs ys =
done ;
s

let map2 xs ys f =
let zipBy xs ys f =
let lenx, leny = length xs, length ys in
let len = Pervasives.min lenx leny in
let s = makeUninitializedUnsafe len in
Expand Down Expand Up @@ -331,7 +331,7 @@ let every2 a b p =
else
everyAux2 a b 0 p lena

let equalTo = every2
let eq = every2

let rec everyCmpAux2 arr1 arr2 i b len =
if i = len then 0
Expand All @@ -341,7 +341,7 @@ let rec everyCmpAux2 arr1 arr2 i b len =
everyCmpAux2 arr1 arr2 (i + 1) b len
else c

let compareTo a b p =
let cmp a b p =
let lena = length a in
let lenb = length b in
if lena > lenb then 1
Expand Down
6 changes: 3 additions & 3 deletions jscomp/others/bs_Array.mli
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ val forEach: 'a array -> ('a -> unit [@bs]) -> unit

val map: 'a array -> ('a -> 'b [@bs]) -> 'b array

val map2: 'a array -> 'b array -> ('a -> 'b -> 'c [@bs]) -> 'c array
val zipBy: 'a array -> 'b array -> ('a -> 'b -> 'c [@bs]) -> 'c array

val keepBy: 'a array -> ('a -> bool [@bs]) -> 'a array

Expand All @@ -121,7 +121,7 @@ val every: 'a array -> ('a -> bool [@bs]) -> bool
(** [every2 a b] return false when [length a <> length b] *)
val every2: 'a array -> 'b array -> ('a -> 'b -> bool [@bs]) -> bool

val compareTo: 'a array -> 'a array -> ('a -> 'a -> int [@bs]) -> int
val equalTo: 'a array -> 'a array -> ('a -> 'a -> bool [@bs]) -> bool
val cmp: 'a array -> 'a array -> ('a -> 'a -> int [@bs]) -> int
val eq: 'a array -> 'a array -> ('a -> 'a -> bool [@bs]) -> bool

external truncateToLengthUnsafe: 'a array -> int -> unit = "length" [@@bs.set]
10 changes: 5 additions & 5 deletions jscomp/others/bs_Cmp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
type 'a compare = ('a -> 'a -> int [@bs])
type ('a,'id) cmp = 'a compare

external getCmp : ('a,'id) cmp -> 'a compare = "%identity"
external getCmpIntenral : ('a,'id) cmp -> 'a compare = "%identity"

module type S = sig
module type T = sig
type id
type t
val cmp : (t,id) cmp
end
type ('key, 'id) t = (module S with type t = 'key and type id = 'id)
type ('key, 'id) t = (module T with type t = 'key and type id = 'id)

module Make (M : sig
type t
Expand All @@ -47,12 +47,12 @@ end

let make
(type key)
(cmp : key -> key -> int [@bs])
~(cmp : key -> key -> int [@bs])
=
let module M = struct
type t = key
let cmp = cmp
end in
let module N = Make(M) in
(module N : S with type t = key)
(module N : T with type t = key)

25 changes: 13 additions & 12 deletions jscomp/others/bs_Cmp.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,25 @@ type 'a compare = 'a -> 'a -> int [@bs]
type ('a, 'id) cmp

(** only used for data structures, not exported for client usage *)
external getCmp : ('a,'id) cmp ->
'a compare = "%identity"
external getCmpIntenral: ('a,'id) cmp -> 'a compare = "%identity"

module type S = sig
module type T = sig
type id
type t
val cmp : (t,id) cmp
end

type ('key, 'id) t =
(module S with type t = 'key and type id = 'id)
(module T with type t = 'key and type id = 'id)

module Make ( M : sig
type t
val cmp : t compare
end) :
S with type t = M.t

val make:
('a -> 'a -> int [@bs]) ->
(module S with type t = 'a)

val make: cmp:'a compare -> (module T with type t = 'a)
(** [make cmp] create a dictionary to sign the data structure
For example:
{[
module N = make (fun[@bs] x y -> x - y)
]}
Such module [N] can be used to initiialize various datastructures,
[N.id] will be the idenetity
*)
10 changes: 5 additions & 5 deletions jscomp/others/bs_Hash.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

type ('a,'id) hash = ('a -> int [@bs])
type ('a, 'id) eq = ('a -> 'a -> bool [@bs])
external getHash : ('a,'id) hash -> ('a -> int [@bs]) = "%identity"
external getEq : ('a, 'id) eq -> ('a -> 'a -> bool [@bs]) = "%identity"
external getHashInternal : ('a,'id) hash -> ('a -> int [@bs]) = "%identity"
external getEqInternal : ('a, 'id) eq -> ('a -> 'a -> bool [@bs]) = "%identity"

module type S = sig
module type T = sig
type id
type t
val hash : (t,id) hash
val eq : (t,id) eq
end

type ('key, 'id) t = (module S with type t = 'key and type id = 'id)
type ('key, 'id) t = (module T with type t = 'key and type id = 'id)

module Make (M : sig
type t
Expand All @@ -37,5 +37,5 @@ let make
let eq = eq
end in
let module N = Make(M) in
(module N : S with type t = key)
(module N : T with type t = key)

10 changes: 5 additions & 5 deletions jscomp/others/bs_Hash.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
type ('a, 'id) hash
type ('a, 'id) eq

external getHash : ('a,'id) hash -> ('a -> int [@bs]) = "%identity"
external getEq : ('a, 'id) eq -> ('a -> 'a -> bool [@bs]) = "%identity"
external getHashInternal : ('a,'id) hash -> ('a -> int [@bs]) = "%identity"
external getEqInternal : ('a, 'id) eq -> ('a -> 'a -> bool [@bs]) = "%identity"

module type S = sig
module type T = sig
type id
type t
val hash : (t,id) hash
val eq : (t,id) eq
end

type ('key, 'id) t = (module S with type t = 'key and type id = 'id)
type ('key, 'id) t = (module T with type t = 'key and type id = 'id)

val make:
eq:('a -> 'a -> bool [@bs]) ->
hash:('a -> int [@bs]) ->
(module S with type t = 'a)
(module T with type t = 'a)

Loading

0 comments on commit 2bdfd21

Please sign in to comment.