Value.Tag
Variants of values.
type 'a t = 'a tag
register ~name ~uuid (module T)
creates a new variant constructor that accepts values of type T.t
. Module T
should implement Binable.S
and Sexpable.S
interfaces, provide compare
and pretty-printing pp
functions. This functions will be used to print, compare and serialize values.
The returned value of type T.t tag
is a special key that can be used with create
and get
functions to pack and unpack values of type T.t
into value
.
Registration of a value tag, automatically adds a property slot to the Theory.program
class. Then property name is package:name
where package
defaults to uuid
.
No matter of the package
name the uuid
parameter is used as a typeid
and to serialize and de-serialize values.
Note, this function delegates most of it work to register_slot
.
val register :
?public:bool ->
?desc:string ->
?package:string ->
name:string ->
uuid:string ->
(module S with type t = 'a) ->
'a tag
register ~name ~uuid (module T)
creates a new variant constructor that accepts values of type T.t
. Module T
should implement Binable.S
and Sexpable.S
interfaces, provide compare
and pretty-printing pp
functions. This functions will be used to print, compare and serialize values.
The returned value of type T.t tag
is a special key that can be used with create
and get
functions to pack and unpack values of type T.t
into value
.
Registration of a value tag, automatically adds a property slot to the Theory.program
class. Then property name is package:name
where package
defaults to uuid
.
No matter of the package
name the uuid
parameter is used as a typeid
and to serialize and de-serialize values.
Note, this function delegates most of it work to register_slot
.
val register_slot :
?uuid:string ->
(Bap_core_theory.Theory.program, 'a option) Bap_core_theory.KB.slot ->
(module S with type t = 'a) ->
'a tag
register_slot s f
registers a KB property as a value.
An existing property of the Theory.program
class can be also represented as BAP value and attached directly to program attributes, memory locations, or stored in the project dictionary.
val slot :
'a t ->
(Bap_core_theory.Theory.program, 'a option) Bap_core_theory.KB.slot
slot tag
returns a slot associated with the tag.
val name : 'a t -> string
name cons
returns a name of a constructor.
same_witness x y
returns a value witnessing that value tags x
and y
has the same type.
same_witness_exn x y
is the same as same_witness
but raises exception if not (same x y)
.