Revision d79255aea6ed65a6ccee20633a7fe71619d7e34c authored by No author on 17 November 1997, 17:43:45 UTC, committed by No author on 17 November 1997, 17:43:45 UTC
git-svn-id: http://caml.inria.fr/svn/ocaml/release/1.06@1781 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1 parent b8e86dc
Raw File
obj.ml
(***********************************************************************)
(*                                                                     *)
(*                           Objective Caml                            *)
(*                                                                     *)
(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
(*                                                                     *)
(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
(*  Automatique.  Distributed only by permission.                      *)
(*                                                                     *)
(***********************************************************************)

(* $Id$ *)

(* Operations on internal representations of values *)

type t

external repr : 'a -> t = "%identity"
external obj : t -> 'a = "%identity"
external magic : 'a -> 'b = "%identity"
external is_block : t -> bool = "obj_is_block"
external tag : t -> int = "obj_tag"
external size : t -> int = "%obj_size"
external field : t -> int -> t = "%obj_field"
external set_field : t -> int -> t -> unit = "%obj_set_field"
external new_block : int -> int -> t = "obj_block"

let marshal (obj: t) =
  Marshal.to_string obj []
let unmarshal str pos =
  (Marshal.from_string str pos, Marshal.total_size str pos)
back to top