Skip to content

Commit

Permalink
Update dependencies to support ocaml v4.14
Browse files Browse the repository at this point in the history
Also fixes deprecation errors of js_of_ocaml and fmt
  • Loading branch information
eilvelia committed Jun 29, 2022
1 parent 23e9576 commit 6c1b134
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ distrib:

.PHONY: lock
lock:
opam lock
opam lock camlproto
28 changes: 14 additions & 14 deletions camlproto.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ bug-reports: "https://github.com/Bannerets/camlproto/issues"
build: [["dune" "build" "-p" name "-j" jobs]]
run-test: [["dune" "runtest" "-p" name]]
depends: [
"ocaml" {>= "4.08.0"}
"ocaml" {>= "4.08.1"}
"dune" {>= "2.7.1"}
"ppx_expect" # can't be "with-test", since let%expect_test needs to be preprocessed away
"js_of_ocaml-compiler" {>= "3.2.0" & < "4.0"}
"js_of_ocaml-ppx" {>= "3.2.0" & < "4.0"}
"js_of_ocaml" {>= "3.2.0" & < "4.0"}
"base" {>= "v0.14.0"}
"js_of_ocaml-compiler" {>= "4.0"}
"js_of_ocaml-ppx" {>= "4.0"}
"js_of_ocaml" {>= "4.0"}
"bisect_ppx" {dev & >= "2.5.0"}
"base"
"cstruct" {>= "3.0.0"}
"ppx_expect" # cannot be "with-test" because let%expect_test should be preprocessed away
"ppx_let" # TODO: replace with (let*)?
"ppx_deriving"
"ppx_hash"
# "ppx_import" {>= "1.5" & < "2.0"}
"cstruct" # TODO: 0.6 does not work yet
"lwt"
"lwt_ppx"
"logs" {>= "0.6.0"}
"nocrypto" {>= "0.5.0"}
"logs"
"nocrypto" {>= "0.5.0"} # Note: Does not work with ocaml 4.08.0 (not 4.08.1)
"zarith"
"ezgzip"
"fmt" {>= "0.8.7"}
"ppx_let" {>= "v0.11.0"}
"ppx_deriving" {>= "4.3" & < "5.0"}
"ppx_hash"
# "ppx_import" {>= "1.5" & < "2.0"}
"fmt"
"menhir"
]
98 changes: 46 additions & 52 deletions camlproto.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -12,90 +12,84 @@ build: [["dune" "build" "-p" name "-j" jobs]]
run-test: [["dune" "runtest" "-p" name]]
depends: [
"astring" {= "0.8.5"}
"base" {= "v0.14.0"}
"base" {= "v0.14.3"}
"base-bigarray" {= "base"}
"base-bytes" {= "base"}
"base-threads" {= "base"}
"base-unix" {= "base"}
"bigarray-compat" {= "1.0.0"}
"biniou" {= "1.2.1"}
"camlzip" {= "1.10"}
"cmdliner" {= "1.0.4"}
"conf-gmp" {= "1"}
"conf-m4" {= "1"}
"conf-perl" {= "1"}
"conf-pkg-config" {= "1.3"}
"bigarray-compat" {= "1.1.0"}
"bisect_ppx" {dev & = "2.8.1"}
"camlzip" {= "1.11"}
"cmdliner" {= "1.1.1"}
"conf-gmp" {= "4"}
"conf-pkg-config" {= "2"}
"conf-zlib" {= "1"}
"cppo" {= "1.6.6"}
"cppo" {= "1.6.9"}
"cpuid" {= "0.1.2"}
"csexp" {= "1.5.1"}
"cstruct" {= "5.2.0"}
"cstruct-lwt" {= "5.2.0"}
"dune" {= "2.7.1"}
"dune-configurator" {= "2.7.0"}
"easy-format" {= "1.3.2"}
"dune" {= "3.3.1"}
"dune-configurator" {= "3.3.1"}
"ezgzip" {= "0.2.3"}
"fmt" {= "0.8.8"}
"fmt" {= "0.9.0"}
"jane-street-headers" {= "v0.14.0"}
"js_of_ocaml" {= "3.8.0"}
"js_of_ocaml-compiler" {= "3.8.0"}
"js_of_ocaml-ppx" {= "3.8.0"}
"jst-config" {= "v0.14.0"}
"js_of_ocaml" {= "4.0.0"}
"js_of_ocaml-compiler" {= "4.0.0"}
"js_of_ocaml-ppx" {= "4.0.0"}
"jst-config" {= "v0.14.1"}
"logs" {= "0.7.0"}
"lwt" {= "5.3.0"}
"lwt_ppx" {= "2.0.1"}
"menhir" {= "20200624"}
"menhirLib" {= "20200624"}
"menhirSdk" {= "20200624"}
"lwt" {= "5.6.1"}
"lwt_ppx" {= "2.1.0"}
"menhir" {= "20220210"}
"menhirLib" {= "20220210"}
"menhirSdk" {= "20220210"}
"mirage-no-solo5" {= "1"}
"mirage-no-xen" {= "1"}
"mmap" {= "1.1.0"}
"nocrypto" {= "0.5.4-2"}
"num" {= "1.3"}
"ocaml" {= "4.07.1"}
"ocaml-base-compiler" {= "4.07.1"}
"ocaml-compiler-libs" {= "v0.12.1"}
"ocaml-config" {= "1"}
"ocaml-migrate-parsetree" {= "1.7.3"}
"ocaml-secondary-compiler" {= "4.08.1-1"}
"ocaml-syntax-shims" {= "1.0.0"}
"ocamlbuild" {= "0.14.0"}
"ocamlfind" {= "1.8.1"}
"ocamlfind-secondary" {= "1.8.1"}
"num" {= "1.4"}
"ocaml" {= "4.14.0"}
"ocaml-base-compiler" {= "4.14.0"}
"ocaml-compiler-libs" {= "v0.12.4"}
"ocaml-config" {= "2"}
"ocaml-options-vanilla" {= "1"}
"ocamlbuild" {= "0.14.1"}
"ocamlfind" {= "1.9.5"}
"ocb-stubblr" {= "0.1.1-1"}
"ocplib-endian" {= "1.1"}
"ocplib-endian" {= "1.2"}
"octavius" {= "1.2.2"}
"parsexp" {= "v0.14.0"}
"parsexp" {= "v0.14.2"}
"ppx_assert" {= "v0.14.0"}
"ppx_base" {= "v0.14.0"}
"ppx_cold" {= "v0.14.0"}
"ppx_compare" {= "v0.14.0"}
"ppx_derivers" {= "1.2.1"}
"ppx_deriving" {= "4.5"}
"ppx_deriving" {= "5.2.1"}
"ppx_enumerate" {= "v0.14.0"}
"ppx_expect" {= "v0.14.0"}
"ppx_expect" {= "v0.14.2"}
"ppx_hash" {= "v0.14.0"}
"ppx_here" {= "v0.14.0"}
"ppx_inline_test" {= "v0.14.1"}
"ppx_js_style" {= "v0.14.0"}
"ppx_js_style" {= "v0.14.1"}
"ppx_let" {= "v0.14.0"}
"ppx_optcomp" {= "v0.14.0"}
"ppx_sexp_conv" {= "v0.14.1"}
"ppx_tools" {= "5.1+4.06.0"}
"ppx_tools_versioned" {= "5.4.0"}
"ppxfind" {= "1.4"}
"ppxlib" {= "0.15.0"}
"re" {= "1.9.0"}
"ppx_optcomp" {= "v0.14.3"}
"ppx_sexp_conv" {= "v0.14.3"}
"ppxlib" {= "0.25.1"}
"re" {= "1.10.4"}
"result" {= "1.5"}
"rresult" {= "0.6.0"}
"rresult" {= "0.7.0"}
"seq" {= "base"}
"sexplib" {= "v0.14.0"}
"sexplib0" {= "v0.14.0"}
"stdio" {= "v0.14.0"}
"stdlib-shims" {= "0.1.0"}
"stdlib-shims" {= "0.3.0"}
"time_now" {= "v0.14.0"}
"topkg" {= "1.0.2"}
"topkg" {= "1.0.5"}
"uchar" {= "0.0.2"}
"yojson" {= "1.7.0"}
"zarith" {= "1.9.1"}
"yojson" {= "2.0.0"}
"zarith" {= "1.12"}
]
authors: "Bannerets <[email protected]>"
url {
src: "git+file:///Users/save14/code/camlproto#master"
}
22 changes: 11 additions & 11 deletions src/platform/js/Bigint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ open Js_of_ocaml

type bigint

let int2bigInt: int -> bigint = Js.Unsafe.variable "int2bigInt"
let int2bigInt: int -> bigint = Js.Unsafe.pure_js_expr "int2bigInt"
(* external bigInt2str: bigint -> Js.js_string Js.t = "bigInt2str" *)
(* external str2bigInt: Js.js_string Js.t -> bigint = "bigInt2str" *)
(* external bitSize: bigint -> int = "bitSize" *)
(* external dup: bigint -> bigint = "dup"
external rightShift_: bigint -> int -> unit = "rightShift_"
external leftShift_: bigint -> int -> unit = "leftShift_" *)
let add: bigint -> bigint -> bigint = Js.Unsafe.variable "add"
let sub: bigint -> bigint -> bigint = Js.Unsafe.variable "sub"
let powMod: bigint -> bigint -> bigint -> bigint = Js.Unsafe.variable "powMod"
let greater: bigint -> bigint -> bool = Js.Unsafe.variable "greater"
let equals: bigint -> bigint -> bool = Js.Unsafe.variable "equals"
let add: bigint -> bigint -> bigint = Js.Unsafe.pure_js_expr "add"
let sub: bigint -> bigint -> bigint = Js.Unsafe.pure_js_expr "sub"
let powMod: bigint -> bigint -> bigint -> bigint = Js.Unsafe.pure_js_expr "powMod"
let greater: bigint -> bigint -> bool = Js.Unsafe.pure_js_expr "greater"
let equals: bigint -> bigint -> bool = Js.Unsafe.pure_js_expr "equals"

(* external arrayBufferFromHex
: Js.js_string Js.t -> Typed_array.arrayBuffer Js.t = "arrayBufferFromHex"
external arrayBufferToHex
: Typed_array.arrayBuffer Js.t -> Js.js_string Js.t = "arrayBufferToHex" *)

let bigInt2ArrayBuffer
: bigint -> Typed_array.arrayBuffer Js.t = Js.Unsafe.variable "bigInt2ArrayBuffer"
: bigint -> Typed_array.arrayBuffer Js.t = Js.Unsafe.pure_js_expr "bigInt2ArrayBuffer"

(* let arrayBuffer2bigInt
: Typed_array.arrayBuffer Js.t -> bigint = Js.Unsafe.variable "arrayBuffer2bigInt" *)
: Typed_array.arrayBuffer Js.t -> bigint = Js.Unsafe.pure_js_expr "arrayBuffer2bigInt" *)

let camlBigarray2bigInt
: Cstruct.buffer -> bigint = Js.Unsafe.variable "camlBigarray2bigInt"
: Cstruct.buffer -> bigint = Js.Unsafe.pure_js_expr "camlBigarray2bigInt"

let bigint_zero: bigint = Js.Unsafe.variable "leemon_zero"
let bigint_one: bigint = Js.Unsafe.variable "one"
let bigint_zero: bigint = Js.Unsafe.pure_js_expr "leemon_zero"
let bigint_one: bigint = Js.Unsafe.pure_js_expr "one"

(* TODO: Some bigint functions don't seem to work *)

Expand Down
2 changes: 1 addition & 1 deletion src/platform/js/Time.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ open! Base
open Js_of_ocaml

let get_current_time () =
let time: float = (Js.Unsafe.variable "Date")##now () in
let time: float = (Js.Unsafe.pure_js_expr "Date")##now () in
time /. 1000.0
8 changes: 4 additions & 4 deletions src/tl/lib/Codegen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ let build_comb store : _ -> comb Fmt.t =
| _, TypeExpr (tref, params) ->
Fmt.pf ppf "module %a = %a"
(build_module_name store) texpr
(pp_functor_appl ~sep:(Fmt.always " ")) (tref, params)
(pp_functor_appl ~sep:(Fmt.any " ")) (tref, params)
| _ -> ()
in
let pp_module_decls ppf comb : unit =
Expand Down Expand Up @@ -470,16 +470,16 @@ let build_comb store : _ -> comb Fmt.t =
(pp_t ~is_sig:true)
include_module_name
(match comb with
| `Constr _ -> Fmt.always ""
| `Constr _ -> Fmt.any ""
| `Func f -> fun ppf _ -> Fmt.pf ppf " and %a"
(pp_result_module ~is_sig:true) f) ()
pp_module_decls comb
pp_t
(result_module ~trailer:cut) comb
name_of_make_functor
(match comb with
| `Constr _ -> Fmt.always ""
| `Func _ -> Fmt.always "module ResultM = ResultM@,") ()
| `Constr _ -> Fmt.any ""
| `Func _ -> Fmt.any "module ResultM = ResultM@,") ()
magic
pp_arg_encodes (required_args, cond_args_map)
(my_pp_list pp_arg_decode ~trailer:cut) required_args
Expand Down

0 comments on commit 6c1b134

Please sign in to comment.