1 (***********************************************************************)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
7 (* Copyright 2000 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the Q Public License version 1.0. *)
11 (***********************************************************************)
15 (* Handling of sections in bytecode executable files *)
17 (** Recording sections written to a bytecode executable file *)
19 val init_record
: out_channel
-> unit
20 (* Start recording sections from the current position in out_channel *)
22 val record
: out_channel
-> string -> unit
23 (* Record the current position in the out_channel as the end of
24 the section with the given name *)
26 val write_toc_and_trailer
: out_channel
-> unit
27 (* Write the table of contents and the standard trailer for bytecode
30 (** Reading sections from a bytecode executable file *)
32 val read_toc
: in_channel
-> unit
33 (* Read the table of sections from a bytecode executable *)
35 exception Bad_magic_number
36 (* Raised by [read_toc] if magic number doesn't match *)
38 val toc
: unit -> (string * int) list
39 (* Return the current table of contents as a list of
40 (section name, section length) pairs. *)
42 val seek_section
: in_channel
-> string -> int
43 (* Position the input channel at the beginning of the section named "name",
44 and return the length of that section. Raise Not_found if no
45 such section exists. *)
47 val read_section_string
: in_channel
-> string -> string
48 (* Return the contents of a section, as a string *)
50 val read_section_struct
: in_channel
-> string -> 'a
51 (* Return the contents of a section, as marshalled data *)
53 val pos_first_section
: in_channel
-> int
54 (* Return the position of the beginning of the first section *)