Frama-C API - State
A state is a project-compliant mutable value.
Type declarations
include Datatype.S_with_collections
include Datatype.S
include Datatype.S_no_copy
val packed_descr : Structural_descr.pack
Packed version of the descriptor.
val reprs : t list
List of representants of the descriptor.
val hash : t -> int
Hash function: same spec than Hashtbl.hash
.
val pretty : Stdlib.Format.formatter -> t -> unit
Pretty print each value in an user-friendly way.
val mem_project : (Project_skeleton.t -> bool) -> t -> bool
mem_project f x
must return true
iff there is a value p
of type Project.t
in x
such that f p
returns true
.
module Set : Datatype.Set with type elt = t
module Map : Datatype.Map with type key = t
module Hashtbl : Datatype.Hashtbl with type key = t
module type Local = sig ... end
Operations on the local state required for registering a new state via State_builder.Register
. The local state is the mutable value which you would like to be project-compliant.
Getters and setters
val get_name : t -> string
Name of a state.
val set_name : t -> string -> unit
Set the name of the given state.
val get_unique_name : t -> string
Unique name of a state.
val dummy : t
A dummy state.
val is_dummy : t -> bool
val get : string -> t
val get_descr : t -> Structural_descr.pack
val add_hook_on_update : t -> (unit -> unit) -> unit
Add an hook which is applied each time the project library changes the local value of the state.
Internals
All this stuff should not be used outside of the Project library.
type state_on_disk = {
on_disk_value : Stdlib.Obj.t;
on_disk_computed : bool;
on_disk_saved : bool;
on_disk_digest : Stdlib.Digest.t;
}
type private_ops = private {
descr : Structural_descr.pack;
create : Project_skeleton.project -> unit;
remove : Project_skeleton.project -> unit;
clear : Project_skeleton.project -> unit;
clear_some_projects : (Project_skeleton.project -> bool) -> Project_skeleton.project -> bool;
copy : Project_skeleton.project -> Project_skeleton.project -> unit;
commit : Project_skeleton.project -> unit;
update : Project_skeleton.project -> unit;
on_update : (unit -> unit) -> unit;
clean : unit -> unit;
serialize : Project_skeleton.project -> state_on_disk;
unserialize : Project_skeleton.project -> state_on_disk -> unit;
(**)
}
val dummy_state_on_disk : state_on_disk
val private_ops : t -> private_ops
State generators
val create : descr:Structural_descr.pack -> create:(Project_skeleton.project -> unit) -> remove:(Project_skeleton.project -> unit) -> clear:(Project_skeleton.project -> unit) -> clear_some_projects: ((Project_skeleton.project -> bool) -> Project_skeleton.project -> bool) -> copy:(Project_skeleton.project -> Project_skeleton.project -> unit) -> commit:(Project_skeleton.project -> unit) -> update:(Project_skeleton.project -> unit) -> on_update:((unit -> unit) -> unit) -> clean:(unit -> unit) -> serialize:(Project_skeleton.project -> state_on_disk) -> unserialize:(Project_skeleton.project -> state_on_disk -> unit) -> unique_name:string -> name:string -> t
val delete : t -> unit