@@ -39,6 +39,7 @@ function caml_alloc_dummy_infix() {
3939}
4040
4141//Provides: caml_obj_is_block const (const)
42+ //Version: < 4.12
4243function caml_obj_is_block ( x ) {
4344 return + Array . isArray ( x ) ;
4445}
@@ -55,6 +56,7 @@ function caml_obj_tag(x) {
5556}
5657
5758//Provides: caml_obj_set_tag (mutable, const)
59+ //Version: < 5.0
5860function caml_obj_set_tag ( x , tag ) {
5961 x [ 0 ] = tag ;
6062 return 0 ;
@@ -86,20 +88,23 @@ function caml_obj_dup(x) {
8688
8789//Provides: caml_obj_truncate (mutable, const)
8890//Requires: caml_invalid_argument
91+ //Version: < 5.0
8992function caml_obj_truncate ( x , s ) {
9093 if ( s <= 0 || s + 1 > x . length ) caml_invalid_argument ( "Obj.truncate" ) ;
9194 if ( x . length !== s + 1 ) x . length = s + 1 ;
9295 return 0 ;
9396}
9497
9598//Provides: caml_obj_make_forward
99+ //Version: < 5.0
96100function caml_obj_make_forward ( b , v ) {
97101 b [ 0 ] = 250 ;
98102 b [ 1 ] = v ;
99103 return 0 ;
100104}
101105
102106//Provides: caml_obj_compare_and_swap
107+ //Version: >= 5.0
103108function caml_obj_compare_and_swap ( x , i , old , n ) {
104109 if ( x [ i + 1 ] === old ) {
105110 x [ i + 1 ] = n ;
@@ -109,6 +114,7 @@ function caml_obj_compare_and_swap(x, i, old, n) {
109114}
110115
111116//Provides: caml_obj_is_shared
117+ //Version: >= 5.0
112118function caml_obj_is_shared ( x ) {
113119 return 1 ;
114120}
@@ -182,6 +188,7 @@ function caml_obj_add_offset(v, offset) {
182188}
183189
184190//Provides: caml_obj_update_tag
191+ //Version: >= 5.0
185192function caml_obj_update_tag ( b , o , n ) {
186193 if ( b [ 0 ] === o ) {
187194 b [ 0 ] = n ;
@@ -192,6 +199,7 @@ function caml_obj_update_tag(b, o, n) {
192199
193200//Provides: caml_lazy_update_to_forcing
194201//Requires: caml_obj_update_tag
202+ //Version: >= 5.0
195203function caml_lazy_update_to_forcing ( o ) {
196204 if (
197205 Array . isArray ( o ) &&
@@ -206,20 +214,23 @@ function caml_lazy_update_to_forcing(o) {
206214
207215//Provides: caml_lazy_update_to_forward
208216//Requires: caml_obj_update_tag
217+ //Version: >= 5.0
209218function caml_lazy_update_to_forward ( o ) {
210219 caml_obj_update_tag ( o , 244 , 250 ) ;
211220 return 0 ; // unit
212221}
213222
214223//Provides: caml_lazy_reset_to_lazy
215224//Requires: caml_obj_update_tag
225+ //Version: >= 5.0
216226function caml_lazy_reset_to_lazy ( o ) {
217227 caml_obj_update_tag ( o , 244 , 246 ) ;
218228 return 0 ;
219229}
220230
221231//Provides: caml_lazy_read_result
222232//Requires: caml_obj_tag
233+ //Version: >= 5.0
223234function caml_lazy_read_result ( o ) {
224235 return caml_obj_tag ( o ) === 250 ? o [ 1 ] : o ;
225236}
0 commit comments