Frama_c_kernel.TypeType value. A type value is a value representing a static ML monomorphic type. This API is quite low level. Prefer to use module Datatype instead whenever possible.
Type of type values. For each monomorphic type ty, a value of type ty
t dynamically represents the type ty. Such a value is called a type value and should be unique for each static monomorphic type.
type 'a ty = 'a tPrecedences used for generating the minimal number of parenthesis in combination with function par below.
val par :
precedence ->
precedence ->
Stdlib.Format.formatter ->
(Stdlib.Format.formatter -> unit) ->
unitpar context myself fmt pp puts parenthesis around the verbatim prints by pp according to the precedence myself of the verbatim and to the precedence context of the caller of the pretty printer. fmt is the output formatter.
The typical use is the following: let pretty_print p_caller fmt x =
let pp fmt = Format.fprintf "..." ... x ... in
let myself = Call in
par p_caller myself fmt pp
par_ty_name f ty puts parenthesis around the name of the ty iff f ty is true.
May be raised by register.
val register :
?closure:bool ->
name:string ->
ml_name:string option ->
Structural_descr.t ->
'a list ->
'a tregister ?closure ~name ~ml_name descr reprs registers a new type value. Should not be used directly. Use one of functors of module Datatype instead. closure is true iff the type is a function type. name is the name of the type. Must be a valid OCaml type name (eventually prefixed by a module path). ml_name is the OCaml name of the registered type value.
Apply this functor to access to the abstract type of the given name.
val name : 'a t -> stringval structural_descr : 'a t -> Structural_descr.tval reprs : 'a t -> 'a listNot usable in the "no-obj" mode
val digest : 'a t -> Stdlib.Digest.tval get_embedded_type_names : 'a t -> string listGet the list of names containing in the type represented by the given type value. For instance get_embedded_type_names (Datatype.func Datatype.unit
(Datatype.list Datatype.int)) returns "unit -> int list"; "unit"; "int
list"; "int" .
val ml_name : 'a t -> stringval pp_ml_name : 'a t -> precedence -> Stdlib.Format.formatter -> unitval set_ml_name : 'a t -> string option -> unitval set_name : 'a t -> string -> unitval hash : 'a t -> intFunctors for handling polymorphic type: one type value must be registered for each monomorphic instance of a polymorphic type.
module type Polymorphic_input = sig ... endmodule type Polymorphic = sig ... endFor a polymorphic type value with one type variable, you must use an implementation of this signature.
module Polymorphic
(T : Polymorphic_input) :
Polymorphic with type 'a poly = 'a T.tGeneric implementation of polymorphic type value.
module type Polymorphic2_input = sig ... endSee module Polymorphic_input: very same functions with one additional argument corresponding to the second type variable.
module type Polymorphic2 = sig ... endSame as Polymorphic for polymorphic types with two type variables.
module Polymorphic2
(T : Polymorphic2_input) :
Polymorphic2 with type ('a, 'b) poly = ('a, 'b) T.tGeneric implementation of polymorphic type value with two type variables.
module Function : sig ... endInstance of Polymorphic2 for functions: same signature than Polymorphic2 with possibility to specify a label for the function parameter.
module type Polymorphic3_input = sig ... endSee module Polymorphic_input: very same functions with two additional arguments corresponding to the second and third type variables.
module type Polymorphic3 = sig ... endSame as Polymorphic for polymorphic types with three type variables.
module Polymorphic3
(T : Polymorphic3_input) :
Polymorphic3 with type ('a, 'b, 'c) poly = ('a, 'b, 'c) T.tGeneric implementation of polymorphic type value with three type variables.
module type Polymorphic4_input = sig ... endSee module Polymorphic_input: very same functions with three additional arguments corresponding to the additional type variables.
module type Polymorphic4 = sig ... endSame as Polymorphic for polymorphic types with four type variables.
module Polymorphic4
(T : Polymorphic4_input) :
Polymorphic4 with type ('a, 'b, 'c, 'd) poly = ('a, 'b, 'c, 'd) T.tGeneric implementation of polymorphic type value with four type variables.
These tables are safe to use but nevertheless not for casual users.
module type Heterogeneous_table = sig ... endmodule Make_tbl
(Key : sig ... end)
(Info : sig ... end) :
Heterogeneous_table with type key = Key.t and type 'a info = 'a Info.tBuild an heterogeneous table associating keys to info. Not efficient for types registered without ml name.
module String_tbl
(Info : sig ... end) :
Heterogeneous_table with type key = string and type 'a info = 'a Info.tHeterogeneous tables indexed by string.
Heterogeneous tables indexed by type value. Roughly the same signature that Hashtbl.S.
module Obj_tbl : sig ... endHeterogeneous table for the keys, but polymorphic for the values.