Module Types.Ctypes

type value =
  1. | Const of Z.t
  2. | Sym of string
val pp_value : Stdlib.Format.formatter -> value -> unit
module Pred : sig ... end
type basic = int * string
type enum = {
  1. en_name : string option;
  2. en_byte_size : int;
  3. en_values : (string * int) list;
}
type index_value = {
  1. idx : string;
    (*

    Symbol to the abstraction of index in array

    *)
  2. fe : string;
    (*

    Symbol to the abstraction of reverse index from the end, i.e. - size + idx.

    *)
  3. ofs : int;
    (*

    Offset in the pointed object

    *)
}
type index =
  1. | ValidUnknown
  2. | PastEnd
  3. | Zero
  4. | Idx of index_value
val pp_index : Stdlib.Format.formatter -> index -> unit
val join_indices : index -> index -> index
type structure = {
  1. st_byte_size : int option;
  2. st_members : (int * string * typ) list;
}
and union = {
  1. un_byte_size : int option;
  2. un_types : (string * typ) list;
}
and pointer = {
  1. pointed : typ;
  2. index : index;
}
and descr =
  1. | Void
  2. | Base of basic
  3. | Structure of structure
  4. | Ptr of pointer
  5. | Enum of enum
  6. | Array of typ * value option
    (*

    Arguments: element type, and the number of elements, if statically known.

    *)
  7. | Function of typ * typ list
  8. | Name of string
  9. | Application of constr * Pred.expr list
  10. | Existential of typ * string * typ
  11. | Union of union
  12. | Weak of typ
and constr =
  1. | ConstrName of string
    (*

    Type and its parameters

    *)
  2. | Constructor of typ * string list
and typ = {
  1. mutable descr : descr;
  2. pred : Pred.t;
}
val pp_descr : Stdlib.Format.formatter -> descr -> unit
val pp : Stdlib.Format.formatter -> typ -> unit
val pp_constr : Stdlib.Format.formatter -> constr -> unit
val compare : only_descr:bool -> typ -> typ -> int
val equal : only_descr:bool -> typ -> typ -> bool
val equiv_descr : only_descr:bool -> descr -> descr -> bool

equiv a b returns true if it can show that a is a subtype of b and b is a subtype a.

val equiv : only_descr:bool -> typ -> typ -> bool
val is_pointer_type : typ -> bool
val contains : typ -> typ -> bool

contains t u determines whether t contains u. (Definition: t contains u iff t = u or a component of t (e.g. a structure member) contains u.

exception Unsizeable_type
val sizeof : typ -> int

Returns the size of the type (in bytes), if possible

These functions allow to update or query the binding from type names to types.

val add_type_name_definition : string -> typ -> unit

Maps a name to a type.

exception Undefined_type of string
val type_of_name : string -> typ

Retrieve the type associated to a name. raise Undefined_type if not found.

val pp_ctype : Stdlib.out_channel -> typ -> unit
val pp_ctype_list : Stdlib.out_channel -> typ list -> unit
val pp_function_type : Stdlib.out_channel -> string -> unit
val get_type_definitions : unit -> string list
val print_type_map : unit -> unit

Dump the type map, for debug purposes.

val inlined : typ -> typ

Unroll the definitions of a type (i.e. replace a name with the corresponding type)

val add_constr_name_definition : string -> constr -> unit

Maps a name to a type constructor.

val constr_of_name : string -> constr

Retrieve the type constructor associated to a name. raise Undefined_type if not found.

val print_constr_map : unit -> unit

Dump the constructor map, for debug purposes.

val inlined_constr : constr -> typ * string list

Unroll the definitions of a constructor (i.e. replace a name with the corresponding constructor)

val apply : constr -> Pred.expr list -> typ

Applies a constructor by substituting parameters in a constructor by some arguments. raise Application_error if too many or not enough arguments

val substitute_symbol : typ -> string -> string -> typ
val add_function_name_definition : string -> typ -> unit
val function_of_name : string -> typ

Retrieve the type associated to a function name. raise Undefined_type if not found.

val print_function_map : unit -> unit

Dump the function map, for debug purposes.

val char : typ

Common base types.

val short : typ
val int : typ
val long : typ
val long_long : typ
val word : byte_size:int -> typ
val tuple : typ list -> typ
val concat : size1:int -> typ -> size2:int -> typ -> typ

Additionnal functions used for type domains

val extract : size:int -> index:int -> oldsize:int -> typ -> typ option
module type Type_settings = sig ... end