Skip to content

Commit

Permalink
Mics: compat
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Jan 3, 2024
1 parent 4a471df commit eb56ab6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
11 changes: 10 additions & 1 deletion compiler/tests-ocaml/lib-digest/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(executables
(names md5 digests)
(names md5)
(libraries)
(modules md5)
(modes js))

(rule
Expand All @@ -17,8 +18,16 @@
(action
(diff md5.reference md5.referencejs)))

(executables
(names digests)
(libraries)
(enabled_if (>= %{ocaml_version} 5.2))
(modules digests)
(modes js))

(rule
(alias runtest)
(deps digests.bc.js)
(enabled_if (>= %{ocaml_version} 5.2))
(action
(run node ./digests.bc.js)))
5 changes: 5 additions & 0 deletions runtime/blake2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//Provides: blake2b
//Version: >= 5.2
var blake2b = (function () {
// Blake2B in pure Javascript
// Adapted from the reference implementation in RFC7693
Expand Down Expand Up @@ -306,6 +307,7 @@ function blake2bFinal (ctx) {
//Provides: caml_blake2_create
//Requires: caml_uint8_array_of_string
//Requires: blake2b
//Version: >= 5.2
function caml_blake2_create(hashlen, key){
key = caml_uint8_array_of_string(key);
if(key.length > 64) {
Expand All @@ -317,6 +319,7 @@ function caml_blake2_create(hashlen, key){
//Provides: caml_blake2_final
//Requires: caml_string_of_array
//Requires: blake2b
//Version: >= 5.2
function caml_blake2_final(ctx, hashlen) {
var r = blake2b.Final(ctx);
return caml_string_of_array(r);
Expand All @@ -325,6 +328,7 @@ function caml_blake2_final(ctx, hashlen) {
//Provides: caml_blake2_update
//Requires: blake2b
//Requires: caml_uint8_array_of_string
//Version: >= 5.2
function caml_blake2_update(ctx, buf, ofs, len){
var input = caml_uint8_array_of_string(buf);
input = input.subarray(ofs, ofs + len);
Expand All @@ -336,6 +340,7 @@ function caml_blake2_update(ctx, buf, ofs, len){
//Requires: caml_blake2_create
//Requires: caml_blake2_update
//Requires: caml_blake2_final
//Version: >= 5.2
function caml_blake2_string(hashlen, key, buf, ofs, len) {
var ctx = caml_blake2_create (hashlen, key);
caml_blake2_update(ctx, buf, ofs, len);
Expand Down
1 change: 1 addition & 0 deletions runtime/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function caml_ml_set_binary_mode(chanid,mode){

//Provides: caml_ml_is_binary_mode
//Requires: caml_ml_channels
//Version: >= 5.2
function caml_ml_is_binary_mode(chanid) {
var chan = caml_ml_channels[chanid];
return chan.file.flags.binary
Expand Down
1 change: 1 addition & 0 deletions runtime/sys.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ function caml_spacetime_only_works_for_native_code() {
}

//Provides: caml_xdg_defaults
//Version: >= 5.2
function caml_xdg_defaults(_unit) {
return 0; // empty list
}
Expand Down

0 comments on commit eb56ab6

Please sign in to comment.