Debian Codegraph @

src/runtime.js

raw symbols SCIP
1 ///////// BIN_PROT
2
3 //Provides: caml_check_bound_bigstring
4 //Requires: caml_array_bound_error
5 function caml_check_bound_bigstring(bigstring, i){
6 if (i >>> 0 >= bigstring.data.length) caml_array_bound_error();
7 }
8
9 //Provides: bin_prot_blit_buf_float_array_stub
10 //Requires: caml_check_bound, caml_check_bound_bigstring
11 function bin_prot_blit_buf_float_array_stub(src_pos, src, dst_pos, dst, len){
12 if(len == 0) return 0;
13 caml_check_bound(dst,dst_pos); // first pos
14 caml_check_bound(dst,dst_pos+len-1); // last pos
15 caml_check_bound_bigstring(src, src_pos); /* first pos */
16 caml_check_bound_bigstring(src, src_pos + len * 8 - 1); /* last pos */
17 var view = new joo_global_object.Float64Array(len);
18 var buffer = new joo_global_object.Uint8Array(view.buffer);
19 buffer.set(src.data.subarray(src_pos, src_pos + (len * 8)));
20 for(var i = 0; i < len; i++){
21 // [+ 1] because the tag is at pos 0
22 dst[dst_pos+i+1] = view[i];
23 }
24 return 0
25 }
26 //Provides: bin_prot_blit_buf_bytes_stub
27 //Requires: caml_bigstring_blit_ba_to_bytes
28 function bin_prot_blit_buf_bytes_stub(src_pos, src, dst_pos, dst, len){
29 return caml_bigstring_blit_ba_to_bytes(src, src_pos, dst, dst_pos, len);
30 }
31 //Provides: bin_prot_blit_float_array_buf_stub
32 //Requires: caml_check_bound, caml_check_bound_bigstring
33 function bin_prot_blit_float_array_buf_stub(src_pos,src, dst_pos, dst, len){
34 if(len == 0) return 0
35 caml_check_bound (src, src_pos); // first pos
36 caml_check_bound (src, src_pos + len - 1); // last pos
37 caml_check_bound_bigstring(dst, dst_pos); /* first pos */
38 caml_check_bound_bigstring(dst, dst_pos + len * 8 - 1); /* last pos */
39 // [+ 1] because the tag is at pos 0
40 src_pos = src_pos + 1
41 var float64 = new joo_global_object.Float64Array(src.slice(src_pos,src_pos + len));
42 var float64_uint8 = new joo_global_object.Uint8Array(float64.buffer);
43 var view = dst.data.subarray(dst_pos, dst_pos + (len * 8));
44 view.set(float64_uint8);
45 return 0
46 }
47 //Provides: bin_prot_blit_string_buf_stub
48 //Requires: caml_bigstring_blit_string_to_ba
49 function bin_prot_blit_string_buf_stub (src_pos, src, dst_pos, dst, len){
50 return caml_bigstring_blit_string_to_ba(src,src_pos, dst, dst_pos,len);
51 }
52 //Provides: bin_prot_blit_bytes_buf_stub
53 //Requires: caml_bigstring_blit_string_to_ba
54 function bin_prot_blit_bytes_buf_stub (src_pos, src, dst_pos, dst, len){
55 return caml_bigstring_blit_string_to_ba(src,src_pos, dst, dst_pos,len);
56 }
57
58 //Provides: bin_prot_blit_buf_stub
59 //Requires: caml_bigstring_blit_ba_to_ba, bigstring_of_typed_array
60 function bin_prot_blit_buf_stub (src_pos, src, dst_pos, dst, len){
61 // [bin_prot_blit_buf_stub] is used with mixed bigarray kinds.
62 // Converter everything to bigarray of char before the blit.
63 if(src.kind != 12) // 12 is the char kind
64 src = bigstring_of_typed_array(src.data);
65 if(dst.kind != 12) // 12 is the char kind
66 dst = bigstring_of_typed_array(dst.data);
67 return caml_bigstring_blit_ba_to_ba(src,src_pos,dst,dst_pos,len);
68 }