fix primitives for marshal
parent
ad6304d7ec
commit
e227fb007d
|
@ -694,7 +694,7 @@ CAMLprim value caml_output_value(value vchan, value v, value flags)
|
||||||
CAMLreturn (Val_unit);
|
CAMLreturn (Val_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAMLprim value caml_output_value_to_string(value v, value flags)
|
CAMLprim value caml_output_value_to_bytes(value v, value flags)
|
||||||
{
|
{
|
||||||
char header[32];
|
char header[32];
|
||||||
int header_len;
|
int header_len;
|
||||||
|
@ -722,6 +722,11 @@ CAMLprim value caml_output_value_to_string(value v, value flags)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAMLprim value caml_output_value_to_string(value v, value flags)
|
||||||
|
{
|
||||||
|
return caml_output_value_to_bytes(v,flags);
|
||||||
|
}
|
||||||
|
|
||||||
CAMLexport intnat caml_output_value_to_block(value v, value flags,
|
CAMLexport intnat caml_output_value_to_block(value v, value flags,
|
||||||
char * buf, intnat len)
|
char * buf, intnat len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -777,7 +777,7 @@ CAMLprim value caml_input_value_to_outside_heap(value vchan)
|
||||||
CAMLreturn (res);
|
CAMLreturn (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAMLexport value caml_input_val_from_string(value str, intnat ofs)
|
CAMLexport value caml_input_val_from_bytes(value str, intnat ofs)
|
||||||
{
|
{
|
||||||
CAMLparam1 (str);
|
CAMLparam1 (str);
|
||||||
CAMLlocal1 (obj);
|
CAMLlocal1 (obj);
|
||||||
|
@ -801,7 +801,12 @@ CAMLexport value caml_input_val_from_string(value str, intnat ofs)
|
||||||
|
|
||||||
CAMLprim value caml_input_value_from_string(value str, value ofs)
|
CAMLprim value caml_input_value_from_string(value str, value ofs)
|
||||||
{
|
{
|
||||||
return caml_input_val_from_string(str, Long_val(ofs));
|
return caml_input_val_from_bytes(str, Long_val(ofs));
|
||||||
|
}
|
||||||
|
|
||||||
|
CAMLprim value caml_input_value_from_bytes(value str, value ofs)
|
||||||
|
{
|
||||||
|
return caml_input_val_from_bytes(str, Long_val(ofs));
|
||||||
}
|
}
|
||||||
|
|
||||||
static value input_val_from_block(struct marshal_header * h)
|
static value input_val_from_block(struct marshal_header * h)
|
||||||
|
|
|
@ -19,7 +19,7 @@ type extern_flags =
|
||||||
| Compat_32
|
| Compat_32
|
||||||
|
|
||||||
external to_bytes: 'a -> extern_flags list -> bytes
|
external to_bytes: 'a -> extern_flags list -> bytes
|
||||||
= "caml_output_value_to_string"
|
= "caml_output_value_to_bytes"
|
||||||
|
|
||||||
external to_string: 'a -> extern_flags list -> string
|
external to_string: 'a -> extern_flags list -> string
|
||||||
= "caml_output_value_to_string"
|
= "caml_output_value_to_string"
|
||||||
|
@ -37,8 +37,7 @@ let to_buffer buff ofs len v flags =
|
||||||
else to_buffer_unsafe buff ofs len v flags
|
else to_buffer_unsafe buff ofs len v flags
|
||||||
|
|
||||||
external from_channel: in_channel -> 'a = "caml_input_value"
|
external from_channel: in_channel -> 'a = "caml_input_value"
|
||||||
external from_bytes_unsafe: bytes -> int -> 'a
|
external from_bytes_unsafe: bytes -> int -> 'a = "caml_input_value_from_bytes"
|
||||||
= "caml_input_value_from_string"
|
|
||||||
external data_size_unsafe: bytes -> int -> int = "caml_marshal_data_size"
|
external data_size_unsafe: bytes -> int -> int = "caml_marshal_data_size"
|
||||||
|
|
||||||
let header_size = 20
|
let header_size = 20
|
||||||
|
|
|
@ -22,7 +22,7 @@ type extern_flags =
|
||||||
external to_channel: out_channel -> 'a -> extern_flags list -> unit
|
external to_channel: out_channel -> 'a -> extern_flags list -> unit
|
||||||
= "caml_output_value"
|
= "caml_output_value"
|
||||||
external to_bytes: 'a -> extern_flags list -> bytes
|
external to_bytes: 'a -> extern_flags list -> bytes
|
||||||
= "caml_output_value_to_string"
|
= "caml_output_value_to_bytes"
|
||||||
external to_string: 'a -> extern_flags list -> string
|
external to_string: 'a -> extern_flags list -> string
|
||||||
= "caml_output_value_to_string"
|
= "caml_output_value_to_string"
|
||||||
external to_buffer_unsafe:
|
external to_buffer_unsafe:
|
||||||
|
@ -41,8 +41,7 @@ let to_buffer buff ofs len v flags =
|
||||||
*)
|
*)
|
||||||
|
|
||||||
external from_channel: in_channel -> 'a = "caml_input_value"
|
external from_channel: in_channel -> 'a = "caml_input_value"
|
||||||
external from_bytes_unsafe: bytes -> int -> 'a
|
external from_bytes_unsafe: bytes -> int -> 'a = "caml_input_value_from_bytes"
|
||||||
= "caml_input_value_from_string"
|
|
||||||
external data_size_unsafe: bytes -> int -> int = "caml_marshal_data_size"
|
external data_size_unsafe: bytes -> int -> int = "caml_marshal_data_size"
|
||||||
|
|
||||||
let header_size = 20
|
let header_size = 20
|
||||||
|
|
|
@ -112,7 +112,7 @@ val to_channel : out_channel -> 'a -> extern_flags list -> unit
|
||||||
*)
|
*)
|
||||||
|
|
||||||
external to_bytes :
|
external to_bytes :
|
||||||
'a -> extern_flags list -> bytes = "caml_output_value_to_string"
|
'a -> extern_flags list -> bytes = "caml_output_value_to_bytes"
|
||||||
(** [Marshal.to_bytes v flags] returns a byte sequence containing
|
(** [Marshal.to_bytes v flags] returns a byte sequence containing
|
||||||
the representation of [v].
|
the representation of [v].
|
||||||
The [flags] argument has the same meaning as for
|
The [flags] argument has the same meaning as for
|
||||||
|
|
Loading…
Reference in New Issue