package frama-c

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A state is a project-compliant mutable value.

  • since Carbon-20101201

Type declarations

include Datatype.S_with_collections
include Datatype.S
include Datatype.S_no_copy
val name : string

Unique name of the datatype.

val descr : t Descr.t

Datatype descriptor.

val packed_descr : Structural_descr.pack

Packed version of the descriptor.

val reprs : t list

List of representants of the descriptor.

val equal : t -> t -> bool

Equality: same spec than Stdlib.(=).

val compare : t -> t -> int

Comparison: same spec than Stdlib.compare.

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.

val copy : t -> t

Deep copy: no possible sharing between x and copy x.

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.

  • since Carbon-20101201
val set_name : t -> string -> unit

Set the name of the given state.

  • since Carbon-20101201
val get_unique_name : t -> string

Unique name of a state.

  • since Carbon-20101201
val unique_name_from_name : string -> string
  • returns

    a fresh unique state name from the given name.

  • since Nitrogen-20111001
val dummy : t

A dummy state.

  • since Carbon-20101201
val dummy_unique_name : string
val is_dummy : t -> bool
  • returns

    true if the given state is dummy.

  • since Carbon-20101201
exception Unknown
val get : string -> t
  • returns

    the state corresponding to the given unique name.

  • raises Unknown

    if there is no such state.

  • since Carbon-20101201
val get_descr : t -> Structural_descr.pack
  • since Carbon-20101201
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.

  • since Nitrogen-20111001

Internals

All this stuff should not be used outside of the Project library.

type state_on_disk = {
  1. on_disk_value : Stdlib.Obj.t;
  2. on_disk_computed : bool;
  3. on_disk_saved : bool;
  4. on_disk_digest : Stdlib.Digest.t;
}
  • since Carbon-20101201
type private_ops = private {
  1. descr : Structural_descr.pack;
  2. create : Project_skeleton.project -> unit;
  3. remove : Project_skeleton.project -> unit;
  4. clear : Project_skeleton.project -> unit;
  5. clear_some_projects : (Project_skeleton.project -> bool) -> Project_skeleton.project -> bool;
  6. copy : Project_skeleton.project -> Project_skeleton.project -> unit;
  7. commit : Project_skeleton.project -> unit;
  8. update : Project_skeleton.project -> unit;
  9. on_update : (unit -> unit) -> unit;
  10. clean : unit -> unit;
  11. serialize : Project_skeleton.project -> state_on_disk;
  12. unserialize : Project_skeleton.project -> state_on_disk -> unit;
    (*
    • raises Incompatible_datatype

      if state_on_disk is not compatible with the datatype expected by Frama-C's state

    *)
}
  • since Carbon-20101201
exception Incompatible_datatype of string
val dummy_state_on_disk : state_on_disk
val private_ops : t -> private_ops
  • since Carbon-20101201

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
  • since Carbon-20101201
val delete : t -> unit
  • since Carbon-20101201