Commit 081e6d52 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Start JSBN bindings

parent 4c13f50d
......@@ -2,4 +2,4 @@
<src/platform/native/*>: package(zarith), package(calendar), package(cryptokit)
<src/web/*.{ml,mli,byte,native,odoc}>: thread, package(eliom.server), syntax(camlp4o), package(lwt.syntax), package(csv)
<src/tool/tool_cmdline.*>: package(zarith), package(calendar), package(cryptokit), package(cmdliner), use_platform-native
<src/tool/tool_js.*>: package(js_of_ocaml), syntax(camlp4o), package(js_of_ocaml.syntax), use_platform-js
<src/tool/tool_js.*> or <src/platform/js/*>: package(js_of_ocaml), syntax(camlp4o), package(js_of_ocaml.syntax), use_platform-js
......@@ -3,3 +3,5 @@ src/lib/lib.cma
src/web/server.cma
src/tool/tool_js.js
src/tool/belenios_tool.html
src/tool/jsbn.js
src/tool/jsbn2.js
......@@ -104,5 +104,7 @@ let () = dispatch & function
platform_rules "js";
copy_rule "belenios-tool" ("src/tool/tool_cmdline" ^ exe_suffix) "belenios-tool";
copy_rule "jsbn" "ext/booth/js/jscrypto/jsbn.js" "src/tool/jsbn.js";
copy_rule "jsbn2" "ext/booth/js/jscrypto/jsbn2.js" "src/tool/jsbn2.js";
| _ -> ()
......@@ -33,19 +33,26 @@ let pseudo_rng x () = assert false
let random_string rng i = assert false
module Z = struct
type t = unit -> unit
let zero () = assert false
let one () = assert false
open Js.Unsafe
type t = any
let lib = variable "BigInteger"
let zero = get lib "ZERO"
let one = get lib "ONE"
let of_int x = assert false
let of_string x = assert false
let of_string x =
new_obj lib [| x |> Js.string |> inject |]
let of_string_base b x = assert false
let ( + ) x y = assert false
let ( - ) x y = assert false
let ( * ) x y = assert false
let ( + ) x y = meth_call x "add" [| y |]
let ( - ) x y = meth_call x "subtract" [| y |]
let ( * ) x y = meth_call x "multiply" [| y |]
let ( mod ) x y = assert false
let erem x y = assert false
let to_int x = assert false
let to_string x = assert false
let to_string x = meth_call x "toString" [| |] |> Js.to_string
let compare x y = assert false
let ( =% ) x y = assert false
let geq x y = assert false
......
......@@ -3,6 +3,8 @@
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Belenios Tool</title>
<script src="jsbn.js"></script>
<script src="jsbn2.js"></script>
<script src="tool_js.js"></script>
</head>
<body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment