Skip to content

Commit

Permalink
Merge cfa3b2b into ba5b84e
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzhang committed Jan 29, 2018
2 parents ba5b84e + cfa3b2b commit fddb2fd
Show file tree
Hide file tree
Showing 176 changed files with 6,330 additions and 6,417 deletions.
83 changes: 45 additions & 38 deletions jscomp/others/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -17,66 +17,70 @@ js_console.cmj :
js_result.cmj : js_result.cmi
js_mapperRt.cmj : js_mapperRt.cmi
bs_Array.cmj : js_math.cmj bs_Array.cmi
bs_internalAVLset.cmj : bs_Sort.cmj bs_Cmp.cmj bs_Array.cmj \
bs_internalAVLset.cmj : bs_SortArray.cmj bs_Cmp.cmj bs_Array.cmj \
bs_internalAVLset.cmi
bs_internalAVLtree.cmj : bs_Sort.cmj bs_Cmp.cmj bs_Array.cmj \
bs_internalAVLtree.cmj : bs_SortArray.cmj bs_Cmp.cmj bs_Array.cmj \
bs_internalAVLtree.cmi
bs_SetIntM.cmj : bs_internalSetInt.cmj bs_internalAVLset.cmj bs_SortInt.cmj \
bs_Array.cmj bs_SetIntM.cmi
bs_SetIntM.cmj : bs_internalSetInt.cmj bs_internalAVLset.cmj \
bs_SortArrayInt.cmj bs_Array.cmj bs_SetIntM.cmi
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_SortArray.cmj : bs_SortArrayString.cmj bs_SortArrayInt.cmj bs_Array.cmj \
bs_SortArray.cmi
bs_SortArrayInt.cmj : bs_Array.cmj bs_SortArrayInt.cmi
bs_SortArrayString.cmj : bs_Array.cmj bs_SortArrayString.cmi
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_internalMapInt.cmj : bs_internalAVLtree.cmj bs_Sort.cmj bs_Array.cmj
bs_internalMapString.cmj : bs_internalAVLtree.cmj bs_Sort.cmj bs_Array.cmj
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_SortArray.cmj bs_Array.cmj
bs_internalMapString.cmj : bs_internalAVLtree.cmj bs_SortArray.cmj \
bs_Array.cmj
bs_MapString.cmj : bs_internalMapString.cmj bs_internalAVLtree.cmj \
bs_Sort.cmj bs_Array.cmj bs_MapString.cmi
bs_MapInt.cmj : bs_internalMapInt.cmj bs_internalAVLtree.cmj bs_Sort.cmj \
bs_Array.cmj bs_MapInt.cmi
bs_Array.cmj bs_MapString.cmi
bs_MapInt.cmj : bs_internalMapInt.cmj bs_internalAVLtree.cmj bs_Array.cmj \
bs_MapInt.cmi
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_internalSetInt.cmj : bs_internalAVLset.cmj bs_SortInt.cmj bs_Array.cmj
bs_internalSetString.cmj : bs_internalAVLset.cmj bs_SortString.cmj \
bs_Array.cmj bs_MapStringM.cmi
bs_MapIntM.cmj : bs_internalMapInt.cmj bs_internalAVLtree.cmj bs_Array.cmj \
bs_MapIntM.cmi
bs_Set.cmj : bs_SortedSetDict.cmj bs_Cmp.cmj bs_Array.cmj bs_Set.cmi
bs_SetM.cmj : bs_internalAVLset.cmj bs_SortArray.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_SortArrayInt.cmj \
bs_Array.cmj
bs_internalSetString.cmj : bs_internalAVLset.cmj bs_SortArrayString.cmj \
bs_Array.cmj
bs_SetInt.cmj : bs_internalSetInt.cmj bs_internalAVLset.cmj bs_Array.cmj \
bs_SetInt.cmi
bs_SetIntM.cmj : bs_internalSetInt.cmj bs_internalAVLset.cmj bs_SortInt.cmj \
bs_Array.cmj bs_SetIntM.cmi
bs_SetIntM.cmj : bs_internalSetInt.cmj bs_internalAVLset.cmj \
bs_SortArrayInt.cmj bs_Array.cmj bs_SetIntM.cmi
bs_SetString.cmj : bs_internalSetString.cmj bs_internalAVLset.cmj \
bs_Array.cmj bs_SetString.cmi
bs_SetStringM.cmj : bs_internalSetString.cmj bs_internalAVLset.cmj \
bs_SortString.cmj bs_Array.cmj bs_SetStringM.cmi
bs_SortInt.cmj : bs_Array.cmj bs_SortInt.cmi
bs_SortString.cmj : bs_Array.cmj bs_SortString.cmi
bs_SortArrayString.cmj bs_Array.cmj bs_SetStringM.cmi
bs_Stack.cmj : bs_Stack.cmi
node_child_process.cmj : node.cmj
js_boolean.cmj : js_boolean.cmi
Expand Down Expand Up @@ -107,30 +111,33 @@ bs_SetIntM.cmi :
bs_Hash.cmi :
bs_Queue.cmi :
bs_List.cmi :
bs_Sort.cmi :
bs_SortArray.cmi : bs_SortArrayString.cmi bs_SortArrayInt.cmi
bs_SortArrayInt.cmi :
bs_SortArrayString.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 :
bs_SetIntM.cmi :
bs_SetString.cmi :
bs_SetStringM.cmi :
bs_SortInt.cmi :
bs_SortString.cmi :
bs_Stack.cmi :
js_boolean.cmi :
js_dict.cmi :
Expand Down
18 changes: 10 additions & 8 deletions jscomp/others/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ SOURCE_LIST= node_path node_fs node_process dict node_module js_array js_string
bs_Hash\
bs_Queue\
bs_List\
bs_Sort\
bs_SortArray\
bs_SortArrayInt\
bs_SortArrayString\
bs_Range\
bs_internalBucketsType\
bs_internalSetBuckets\
Expand All @@ -31,6 +33,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 All @@ -48,8 +52,6 @@ SOURCE_LIST= node_path node_fs node_process dict node_module js_array js_string
bs_SetIntM\
bs_SetString\
bs_SetStringM\
bs_SortInt\
bs_SortString\
bs_Stack\
node_child_process \
js_boolean js_math\
Expand Down Expand Up @@ -91,7 +93,7 @@ clean::
bs_internalSetInt.ml bs_internalSetString.ml \
bs_SetInt.ml bs_SetInt.mli bs_SetString.ml bs_SetString.mli \
bs_SetIntM.ml bs_SetIntM.mli bs_SetStringM.ml bs_SetStringM.mli\
bs_SortInt.ml bs_SortInt.mli bs_SortString.ml bs_SortString.mli\
bs_SortArrayInt.ml bs_SortArrayInt.mli bs_SortArrayString.ml bs_SortArrayString.mli\
bs_internalMapInt.ml bs_internalMapInt.mli \
bs_internalMapIntM.ml bs_internalMapIntM.mli \
bs_internalMapString.ml bs_internalMapString.mli\
Expand Down Expand Up @@ -160,13 +162,13 @@ bs_SetIntM.mli: setm.cppo.mli
bs_SetStringM.mli: setm.cppo.mli
cppo -D TYPE_STRING $^ > $@

bs_SortInt.ml : sort.cppo.ml
bs_SortArrayInt.ml : sort.cppo.ml
cppo -D TYPE_INT $^ >$@
bs_SortString.ml : sort.cppo.ml
bs_SortArrayString.ml : sort.cppo.ml
cppo -D TYPE_STRING $^ >$@
bs_SortInt.mli : sort.cppo.mli
bs_SortArrayInt.mli : sort.cppo.mli
cppo -D TYPE_INT $^ > $@
bs_SortString.mli : sort.cppo.mli
bs_SortArrayString.mli : sort.cppo.mli
cppo -D TYPE_STRING $^ > $@
endif

Expand Down
8 changes: 5 additions & 3 deletions jscomp/others/bs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ module HashSetInt = Bs_HashSetInt
module HashSetString = Bs_HashSetString
module HashMapString = Bs_HashMapString
module HashMapInt = Bs_HashMapInt
module Sort = Bs_Sort
module SortInt = Bs_SortInt
module SortString = Bs_SortString
module SortArray = Bs_SortArray
module SortArrayInt = Bs_SortArrayInt
module SortArrayString = Bs_SortArrayString
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)

0 comments on commit fddb2fd

Please sign in to comment.