Remove cross-module deps

This commit is contained in:
Jacques-Pascal Deplaix 2017-11-07 12:05:43 +01:00
parent 9f54a2fc73
commit ffba89de53
12 changed files with 39 additions and 22 deletions

18
_oasis
View file

@ -42,22 +42,28 @@ Library "containers"
CCFun, CCHash, CCInt, CCBool, CCFloat, CCArray, CCRef, CCSet,
CCOrd, CCRandom, CCString, CCHashtbl, CCMap, CCFormat, CCIO,
CCInt64, CCChar, CCResult, CCParse, CCArray_slice,
CCListLabels, CCArrayLabels, CCEqual, CCPervasives,
CCListLabels, CCArrayLabels, CCEqual,
Containers
BuildDepends: bytes, result
BuildDepends: bytes, result, containers.pervasives
# BuildDepends: bytes, bisect_ppx
Library "containers_pervasives"
Path: src/pervasives
Modules: CCPervasives
FindlibParent: containers
FindlibName: pervasives
Library "containers_unix"
Path: src/unix
Modules: CCUnix
BuildDepends: containers, unix
BuildDepends: bytes, result, unix, containers.pervasives
FindlibParent: containers
FindlibName: unix
Library "containers_sexp"
Path: src/sexp
Modules: CCSexp, CCSexp_lex
BuildDepends: containers
BuildDepends: bytes, result, containers.pervasives
FindlibParent: containers
FindlibName: sexp
@ -71,7 +77,7 @@ Library "containers_data"
CCHashSet, CCBitField,
CCHashTrie, CCWBTree, CCRAL, CCSimple_queue,
CCImmutArray, CCHet, CCZipper
BuildDepends: containers
BuildDepends: bytes, containers.pervasives
# BuildDepends: bytes, bisect_ppx
FindlibParent: containers
FindlibName: data
@ -79,7 +85,7 @@ Library "containers_data"
Library "containers_iter"
Path: src/iter
Modules: CCKTree, CCKList, CCLazy_list
BuildDepends: containers
BuildDepends: containers.pervasives
FindlibParent: containers
FindlibName: iter

2
_tags
View file

@ -161,4 +161,4 @@ true: annot, bin_annot
<src/**/*.ml> and not <src/misc/*.ml>: warn(+a-4-44-58-60@8)
true: no_alias_deps, safe_string, short_paths
<src/**/*Labels.cm*>: nolabels
not <src/core/CCPervasives.*>: open(CCPervasives)
not <src/pervasives/CCPervasives.*>: open(CCPervasives)

View file

@ -74,9 +74,11 @@ let is_zero_ n = match n.cell with
| Two _
| Three _ -> false
let bool_eq (b1 : bool) b2 = Pervasives.(=) b1 b2
let is_empty d =
let res = d.size = 0 in
assert (CCBool.equal res (is_zero_ d.cur));
assert (bool_eq res (is_zero_ d.cur));
res
let push_front d x =

View file

@ -125,7 +125,9 @@ module Make(X : ORD) : S with type key = X.t = struct
let mem ~inj x map =
try
CCOpt.is_some (inj.get (M.find x map))
match inj.get (M.find x map) with
| Some _ -> true
| None -> false
with Not_found -> false
let iter_keys ~f map =

View file

@ -86,7 +86,9 @@ let copy tbl = Hashtbl.copy tbl
let mem ~inj tbl x =
try
CCOpt.is_some (inj.get (Hashtbl.find tbl x))
match inj.get (Hashtbl.find tbl x) with
| Some _ -> true
| None -> false
with Not_found -> false
(*$R

View file

@ -23,7 +23,11 @@ let make_ hd tl = match hd with
| [] -> {hd=List.rev tl; tl=[] }
| _::_ -> {hd; tl; }
let is_empty q = CCList.is_empty q.hd
let list_is_empty = function
| [] -> true
| _::_ -> false
let is_empty q = list_is_empty q.hd
let push x q = make_ q.hd (x :: q.tl)
@ -31,7 +35,7 @@ let snoc q x = push x q
let peek_exn q =
match q.hd with
| [] -> assert (CCList.is_empty q.tl); invalid_arg "Queue.peek"
| [] -> assert (list_is_empty q.tl); invalid_arg "Queue.peek"
| x::_ -> x
let peek q = match q.hd with
@ -40,7 +44,7 @@ let peek q = match q.hd with
let pop_exn q =
match q.hd with
| [] -> assert (CCList.is_empty q.tl); invalid_arg "Queue.peek"
| [] -> assert (list_is_empty q.tl); invalid_arg "Queue.peek"
| x::hd' ->
let q' = make_ hd' q.tl in
x, q'

View file

@ -19,7 +19,6 @@ module type WORD = sig
val compare : char_ -> char_ -> int
val to_seq : t -> char_ sequence
val of_list : char_ list -> t
val equal : t -> t -> bool
end
module type S = sig
@ -528,7 +527,7 @@ module Make(W : WORD)
| Empty -> 0
| Cons (_, t') -> size t'
| Node (v, map) ->
let s = if CCOpt.is_none v then 0 else 1 in
let s = match v with None -> 0 | Some _ -> 1 in
M.fold
(fun _ t' acc -> size t' + acc)
map s
@ -746,7 +745,6 @@ module MakeArray(X : ORDERED) = Make(struct
let compare = X.compare
let to_seq a k = Array.iter k a
let of_list = Array.of_list
let equal = CCArray.equal (fun x y -> X.compare x y = 0)
end)
module MakeList(X : ORDERED) = Make(struct
@ -755,7 +753,6 @@ module MakeList(X : ORDERED) = Make(struct
let compare = X.compare
let to_seq a k = List.iter k a
let of_list l = l
let equal = CCList.equal (fun x y -> X.compare x y = 0)
end)
module String = Make(struct
@ -767,5 +764,4 @@ module String = Make(struct
let buf = Buffer.create (List.length l) in
List.iter (fun c -> Buffer.add_char buf c) l;
Buffer.contents buf
let equal = CCString.equal
end)

View file

@ -19,7 +19,6 @@ module type WORD = sig
val compare : char_ -> char_ -> int
val to_seq : t -> char_ sequence
val of_list : char_ list -> t
val equal : t -> t -> bool
end
module type S = sig

View file

@ -141,13 +141,17 @@ module FQ = struct
let empty = _make [] []
let is_empty q = CCList.is_empty q.hd
let list_is_empty = function
| [] -> true
| _::_ -> false
let is_empty q = list_is_empty q.hd
let push q x = _make q.hd (x::q.tl)
let pop_exn q =
match q.hd with
| [] -> assert (CCList.is_empty q.tl); raise Empty
| [] -> assert (list_is_empty q.tl); raise Empty
| x::hd' ->
let q' = _make hd' q.tl in
x, q'

View file

@ -20,9 +20,11 @@
| Escaped_int_1 of int
| Escaped_int_2 of int
let char_eq (c1 : char) c2 = Pervasives.(=) c1 c2
(* remove quotes + unescape *)
let remove_quotes lexbuf s =
assert (CCChar.equal s.[0] '"' && CCChar.equal s.[String.length s - 1] '"');
assert (char_eq s.[0] '"' && char_eq s.[String.length s - 1] '"');
let buf = Buffer.create (String.length s) in
let st = ref Not_escaped in
for i = 1 to String.length s-2 do