Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dune preliminaries 01 #1024

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,3 @@ qtest2/all_tests.ml
qtest.targets.log
setup.data
setup.log
src/batUnix.mli
src/batPervasives.mli
src/batInnerPervasives.ml
src/batHashtbl.ml
src/batMarshal.mli
src/batPrintexc.mli
src/batPrintf.ml
src/batPrintf.mli
src/batFormat.mli
src/batSys.mli
src/batBigarray.mli
src/batFilename.mli
30 changes: 9 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,21 @@ else
QTESTPKG = QTest2Lib
endif

INSTALL_FILES = _build/META _build/src/*.cma _build/src/*.cmi _build/src/*.mli \
toplevel/battop.ml _build/toplevel/*.cmi _build/toplevel/*.mli \
# Note: we do not currently install
# _build/toplevel/*.cma
# as there are no such files. If you create a proper library for batteries-help, you need to add *.cma
# to INSTALL_FILES.

INSTALL_FILES += \
_build/src/batteriesConfig.cmo _build/src/batteriesPrint.cmo _build/toplevel/batteriesHelp.cmo \
toplevel/ocamlinit build/ocaml

INSTALL_FILES = _build/META _build/src/*.cma \
battop.ml _build/src/*.cmi _build/src/*.mli \
_build/src/batteriesHelp.cmo _build/src/batteriesConfig.cmo _build/src/batteriesPrint.cmo \
ocamlinit build/ocaml
# the bin_annot flag in _tags is not handled by versions of ocamlbuild < 4.01.0
# hence we only install *.cmt{i} files if they were produced
ifneq ($(wildcard _build/src/*.cmt),)
INSTALL_FILES += _build/src/*.cmt
INSTALL_FILES += _build/toplevel/*.cmt
endif

ifneq ($(wildcard _build/src/*.cmti),)
INSTALL_FILES += _build/src/*.cmti
INSTALL_FILES += _build/toplevel/*.cmti
endif

OPT_INSTALL_FILES = \
_build/src/*.cmx _build/src/*.cmxa _build/src/*.cmxs \
_build/src/*.a _build/src/*.lib \
_build/toplevel/*.cmx _build/toplevel/*.cmxa _build/toplevel/*.cmxs \
_build/toplevel/*.a _build/toplevel/*.lib
OPT_INSTALL_FILES = _build/src/*.cmx _build/src/*.a _build/src/*.cmxa \
_build/src/*.cmxs _build/src/*.lib

ifneq ($(QTEST_SEED),)
QTEST_SEED_FLAG = --seed $(QTEST_SEED)
Expand All @@ -70,7 +57,7 @@ endif

# What to build
TARGETS = src/batteries.cma
TARGETS += toplevel/batteriesHelp.cmo
TARGETS += src/batteriesHelp.cmo
TARGETS += src/batteriesThread.cma
TARGETS += META
BENCH_TARGETS = benchsuite/bench_int.native
Expand Down Expand Up @@ -188,7 +175,8 @@ clean-prefilter:
# $(TESTFILES) from $(TESTABLE), and pass them to qtest from the
# `_build` directory.

DONTTEST=src/batteries_compattest.mlv \
DONTTEST=src/batteriesHelp.ml \
src/batteries_compattest.mlv \
src/batConcreteQueue_402.ml src/batConcreteQueue_403.ml
TESTABLE ?= $(filter-out $(DONTTEST),\
$(wildcard src/*.ml) $(wildcard src/*.mlv))
Expand Down
2 changes: 1 addition & 1 deletion _tags
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
true: package(bytes), warn_-3, bin_annot
"build": include
"src": include
"toplevel": include
"libs": include
"testsuite": include
"qtest": include
"benchsuite": include
Expand Down
7 changes: 2 additions & 5 deletions opam → batteries.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ maintainer: [
"Thibault Suzanne <thi.suzanne@gmail.com>"
]
authors: "OCaml batteries-included team"
homepage: "http://batteries.forge.ocamlcore.org/"
homepage: "https://github.com/ocaml-batteries-team/batteries-included"
bug-reports: "https://github.com/ocaml-batteries-team/batteries-included/issues"
dev-repo: "git://github.com/ocaml-batteries-team/batteries-included.git"
license: "LGPL-2.1-or-later with OCaml-LGPL-linking-exception"
Expand All @@ -23,9 +23,6 @@ depends: [
"ocamlbuild" {build}
"qtest" {with-test & >= "2.5"}
"qcheck" {with-test & >= "0.6" & < "0.14"}
"benchmark" {with-test & >= "1.6"}
"num"
]
#url {
# src: "https://github.com/ocaml-batteries-team/batteries-included/releases/download/vXXX/batteries-XXX.tar.gz"
# checksum: "md5=XXX"
#}
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/_tags
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ true: warn_error(-50)
<batteriesThread.*>: threads
<{batMap,batVect,batFile,batPervasives,batParserCo,batSet,batLogger,batPathGen,batSplay}.ml>: warn_z
<{batPervasives,batIMap,batLog}.ml>: warn_-9
<batteriesHelp.*>: compiler-libs

<batBigarray.*>: inline(3)
# necessary to inline ofs_of_layout on V<4.2
4 changes: 1 addition & 3 deletions src/batBig_int.mlv
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ let to_string_in_hexa = to_string_in_base 16

open BatNumber

module BaseBig_int = struct
module BaseBig_int : NUMERIC_BASE with type t = Big_int.big_int = struct
open Big_int

type t = big_int
Expand All @@ -133,8 +133,6 @@ module BaseBig_int = struct
let of_int = big_int_of_int

let compare = compare_big_int
let ord = BatOrd.ord compare
let equal a b = compare a b = 0

let of_float f =
try of_string (Printf.sprintf "%.0f" f)
Expand Down
4 changes: 0 additions & 4 deletions src/batBool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ module BaseBool : BatNumber.NUMERIC_BASE with type t = bool = struct

let compare = compare

let equal = (=)

let ord = BatOrd.ord compare

let of_int = function
| 0 -> false
| _ -> true
Expand Down
2 changes: 2 additions & 0 deletions src/batBool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ val ( -- ): t -> t -> t BatEnum.t
val ( --- ): t -> t -> t BatEnum.t
val operations : t BatNumber.numeric

include BatNumber.Bounded

(** {6 Submodules grouping all infix operators} *)

module Infix : BatNumber.Infix with type bat__infix_t = t
Expand Down
6 changes: 3 additions & 3 deletions src/batBytes.mliv
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,9 @@ let s = Bytes.of_string "hello"
##V>=4.4##external unsafe_set : t -> int -> char -> unit = "%bytes_unsafe_set"

##V<4.4##external unsafe_blit : t -> int -> t -> int -> int -> unit = "caml_blit_string" "noalloc"
##V>=4.4##external unsafe_blit : t -> int -> t -> int -> int -> unit = "caml_blit_bytes" "noalloc"
##V>=4.4##external unsafe_blit : t -> int -> t -> int -> int -> unit = "caml_blit_bytes" [@@noalloc]

##V<4.4##external unsafe_fill : t -> int -> int -> char -> unit = "caml_fill_string" "noalloc"
##V>=4.4##external unsafe_fill: t -> int -> int -> char -> unit = "caml_fill_bytes" "noalloc"
##V>=4.4##external unsafe_fill: t -> int -> int -> char -> unit = "caml_fill_bytes" [@@noalloc]

##V>=4.09##external unsafe_blit_string : string -> int -> bytes -> int -> int -> unit = "caml_blit_string" "noalloc"
##V>=4.09##external unsafe_blit_string : string -> int -> bytes -> int -> int -> unit = "caml_blit_string" [@@noalloc]
8 changes: 4 additions & 4 deletions src/batBytes.mlv
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ include Bytes
*)

(*$T mapi
mapi (fun _ -> Char.uppercase) (of_string "Five") |> to_string = "FIVE"
mapi (fun _ -> Char.uppercase) (of_string "") |> to_string = ""
mapi (fun _ -> Char.uppercase_ascii) (of_string "Five") |> to_string = "FIVE"
mapi (fun _ -> Char.uppercase_ascii) (of_string "") |> to_string = ""
mapi (fun _ -> String.of_char %> failwith) (of_string "") |> to_string = ""
mapi (fun i _c -> "0123456789".[9-i]) (of_string "0123456789") |> to_string = "9876543210"
ignore (let last = ref (-1) in mapi (fun i _c -> assert (i > !last); last := i; '0') (of_string "012345")); true
Expand All @@ -32,8 +32,8 @@ include Bytes
##V<4.0## sc

(*$T map
"Five" |> of_string |> map Char.uppercase |> to_string |> (=) "FIVE"
"" |> of_string |> map Char.uppercase |> to_string |> (=) ""
"Five" |> of_string |> map Char.uppercase_ascii |> to_string |> (=) "FIVE"
"" |> of_string |> map Char.uppercase_ascii |> to_string |> (=) ""
"" |> of_string |> map (String.of_char %> failwith) |> to_string |> (=) ""
*)

Expand Down
4 changes: 4 additions & 0 deletions src/batConcreteQueue_403.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
type 'a cell =
| Nil
| Cons of { content: 'a; mutable next: 'a cell }
[@@warning "-37"]
(* Disable warning 37 (Unused constructor):
Cons is never used to build values,
but it is used implicitly in [of_abstr] *)

type 'a t = {
mutable length: int;
Expand Down
44 changes: 0 additions & 44 deletions src/batEnum.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1597,47 +1597,3 @@ end
let id l = Monad.bind l Monad.return in \
List.enum l |> id |> List.of_enum = l)
*)

module Incubator = struct
open BatOrd

let int_eq (x:int) y = x = y
let int_ord (x:int) y =
if x > y then Gt
else if y > x then Lt
else Eq

let eq_elements eq_elt a1 a2 = for_all2 eq_elt a1 a2

let rec ord_elements ord_elt t u =
match (get t, get u) with
| (None, None) -> Eq
| (None, _) -> Lt
| (_, None) -> Gt
| (Some x, Some y) -> match ord_elt x y with
| Eq -> ord_elements ord_elt t u
| (Gt|Lt) as n -> n

let eq eq_elt t1 t2 =
bin_eq
int_eq (count t1) (count t2)
(eq_elements eq_elt) t1 t2

let ord ord_elt t1 t2 =
bin_ord
int_ord (count t1) (count t2)
(ord_elements ord_elt) t1 t2

module Eq (T : Eq) = struct
type 'a enum = 'a t
type t = T.t enum
let eq = eq T.eq
end

module Ord (T : Ord) = struct
type 'a enum = 'a t
type t = T.t enum
let ord = ord T.ord
end

end
6 changes: 5 additions & 1 deletion src/batFloat.mli
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ end

module Compare : BatNumber.Compare with type bat__compare_t = t

include (BatNumber.RefOps with type bat__refops_t = t)
include BatNumber.RefOps with type bat__refops_t = t

include BatNumber.Bounded with type bounded = t

(** {6 Boilerplate code}*)

Expand Down Expand Up @@ -447,6 +449,8 @@ sig
*)
val operations : t BatNumber.numeric

include BatNumber.Bounded with type bounded = t

(**
{6 Operations specific to floating-point numbers}
*)
Expand Down
2 changes: 2 additions & 0 deletions src/batInt32.mliv
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ val operations : t BatNumber.numeric
module Infix : BatNumber.Infix with type bat__infix_t = t
module Compare : BatNumber.Compare with type bat__compare_t = t

include BatNumber.Bounded with type bounded = t


(** {6 Boilerplate code}*)

Expand Down
5 changes: 2 additions & 3 deletions src/batLazyList.ml
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,8 @@ let concat lol =
ignore (concat (lazy (Cons ((let () = failwith "foo" in nil), nil)))); true
*)

(**
{6 Conversions}
*)
(** {6 Conversions} *)

(**
Eager conversion to list.
*)
Expand Down
4 changes: 1 addition & 3 deletions src/batMap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,6 @@ struct
external t_of_impl: 'a implementation -> 'a t = "%identity"
external impl_of_t: 'a t -> 'a implementation = "%identity"

type 'a iter = E | C of key * 'a * 'a implementation * 'a iter

let cardinal t = Concrete.cardinal (impl_of_t t)
let enum t = Concrete.enum (impl_of_t t)
let backwards t = Concrete.backwards (impl_of_t t)
Expand Down Expand Up @@ -1482,7 +1480,7 @@ let merge f m1 m2 = Concrete.merge f Pervasives.compare m1 m2
let bindings = Concrete.bindings

let compare cmp_val m1 m2 =
Concrete.compare Pervasives.compare Pervasives.compare m1 m2
Concrete.compare Pervasives.compare cmp_val m1 m2

let equal eq_val m1 m2 = Concrete.equal Pervasives.compare eq_val m1 m2

Expand Down
2 changes: 2 additions & 0 deletions src/batNativeint.mliv
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ val ( ** ) : t -> t -> t
*)
val operations : t BatNumber.numeric

include BatNumber.Bounded with type bounded = t

(** {6 Submodules grouping all infix operators} *)

module Infix : BatNumber.Infix with type bat__infix_t = t
Expand Down
2 changes: 0 additions & 2 deletions src/batText.ml
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ module Iter = struct

let copy i = {i with idx=i.idx; }

type t = iterator option

(* Initial iterator state: *)
let make rope = { leaf = UTF8.empty;
idx = UTF8.ByteIndex.first;
Expand Down
3 changes: 3 additions & 0 deletions toplevel/batteriesHelp.ml → src/batteriesHelp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ let result_of_completions table singular subject (l:completion list) =
inconsistency singular subject; (*Report internal inconsistency*)
None) l

(**A deconstructor for [completion].*)
let get_qualified {qualified = q; _} = q

(**
Look for a given subject inside one of the manuals

Expand Down
File renamed without changes.
Loading