1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Objective Caml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-07-02 09:41:48 -07:00
|
|
|
(* Compilation environments for compilation units *)
|
|
|
|
|
|
|
|
open Clambda
|
|
|
|
|
2000-03-09 01:12:28 -08:00
|
|
|
(* Each .o file has a matching .cmx file that provides the following infos
|
|
|
|
on the compilation unit:
|
|
|
|
- list of other units imported, with CRCs of their .cmx files
|
|
|
|
- approximation of the structure implemented
|
|
|
|
(includes descriptions of known functions: arity and direct entry
|
|
|
|
points)
|
|
|
|
- list of currying functions and application functions needed
|
|
|
|
The .cmx file contains these infos (as an externed record) plus a CRC
|
|
|
|
of these infos *)
|
|
|
|
|
1995-07-02 09:41:48 -07:00
|
|
|
type unit_infos =
|
|
|
|
{ mutable ui_name: string; (* Name of unit implemented *)
|
1995-10-09 06:37:11 -07:00
|
|
|
mutable ui_imports_cmi: (string * Digest.t) list; (* Interfaces imported *)
|
|
|
|
mutable ui_imports_cmx: (string * Digest.t) list; (* Infos imported *)
|
1995-07-02 09:41:48 -07:00
|
|
|
mutable ui_approx: value_approximation; (* Approx of the structure *)
|
|
|
|
mutable ui_curry_fun: int list; (* Currying functions needed *)
|
1996-04-18 09:26:54 -07:00
|
|
|
mutable ui_apply_fun: int list; (* Apply functions needed *)
|
|
|
|
mutable ui_force_link: bool } (* Always linked *)
|
1995-07-02 09:41:48 -07:00
|
|
|
|
2000-03-09 01:12:28 -08:00
|
|
|
(* Each .a library has a matching .cmxa file that provides the following
|
|
|
|
infos on the library: *)
|
|
|
|
|
|
|
|
type library_infos =
|
|
|
|
{ lib_units: (unit_infos * Digest.t) list; (* List of unit infos w/ CRCs *)
|
|
|
|
lib_ccobjs: string list; (* C object files needed *)
|
|
|
|
lib_ccopts: string list } (* Extra opts to C compiler *)
|
|
|
|
|
1997-05-15 06:22:08 -07:00
|
|
|
val reset: string -> unit
|
1995-07-02 09:41:48 -07:00
|
|
|
(* Reset the environment and record the name of the unit being
|
1997-05-15 06:22:08 -07:00
|
|
|
compiled (arg). *)
|
1995-07-02 09:41:48 -07:00
|
|
|
|
|
|
|
val current_unit_name: unit -> string
|
|
|
|
(* Return the name of the unit being compiled *)
|
|
|
|
|
|
|
|
val global_approx: Ident.t -> Clambda.value_approximation
|
|
|
|
(* Return the approximation for the given global identifier *)
|
|
|
|
val set_global_approx: Clambda.value_approximation -> unit
|
|
|
|
(* Record the approximation of the unit being compiled *)
|
|
|
|
|
|
|
|
val need_curry_fun: int -> unit
|
|
|
|
val need_apply_fun: int -> unit
|
|
|
|
(* Record the need of a currying (resp. application) function
|
|
|
|
with the given arity *)
|
|
|
|
|
1995-10-09 06:37:11 -07:00
|
|
|
val read_unit_info: string -> unit_infos * Digest.t
|
1995-07-11 11:03:29 -07:00
|
|
|
(* Read infos and CRC from a [.cmx] file. *)
|
1995-07-02 09:41:48 -07:00
|
|
|
val save_unit_info: string -> unit
|
|
|
|
(* Save the infos for the current unit in the given file *)
|
|
|
|
|
1995-11-09 05:21:49 -08:00
|
|
|
val cmx_not_found_crc: Digest.t
|
|
|
|
(* Special digest used in the [ui_imports_cmx] list to signal
|
|
|
|
that no [.cmx] file was found and used for the imported unit *)
|
|
|
|
|
1995-07-02 09:41:48 -07:00
|
|
|
type error =
|
|
|
|
Not_a_unit_info of string
|
|
|
|
| Corrupted_unit_info of string
|
|
|
|
| Illegal_renaming of string * string
|
|
|
|
|
|
|
|
exception Error of error
|
|
|
|
|
2000-04-21 01:13:22 -07:00
|
|
|
val report_error: Format.formatter -> error -> unit
|