package frama-c
Install
dune-project
Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
NNicolas Bellec
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
VVincent Botbol
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
SSylvain Chiron
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
MMaxime Jacquemin
-
BBenjamin Jorge
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
RRemi Lazarini
-
TTristan Le Gall
-
KKilyan Le Gallic
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
YYannick Moy
-
PPierre Nigron
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
JJan Rochel
-
MMuriel Roger
-
CCécile Ruet-Cros
-
JJulien Signoles
-
NNicolas Stouls
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=a94384f00d53791cbb4b4d83ab41607bc71962d42461f02d71116c4ff6dca567
doc/frama-c.kernel/Frama_c_kernel/Project/index.html
Module Frama_c_kernel.Project
Projects management.
A project groups together all the internal states of Frama-C. An internal state is roughly the result of a computation which depends of an AST. It is possible to have many projects at the same time. For registering a new state in the Frama-C projects, apply the functor State_builder.Register.
Types for project
include Datatype.S_no_copy with type t = Project_skeleton.t
val packed_descr : Structural_descr.packPacked version of the descriptor.
val reprs : t listList of representants of the descriptor.
val pretty : Format.formatter -> t -> unitPretty print each value in an user-friendly way.
val mem_project : (Project_skeleton.t -> bool) -> t -> boolmem_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 Datatype : Datatype.S_with_collections with type t = Project_skeleton.tType of a project.
Operations on all projects
val create : string -> tCreate a new project with the given name and attach it after the existing projects (so the current project, if existing, is unchanged). The given name may be already used by another project. If there is no other project, then the new one is the current one.
val register_create_hook : (t -> unit) -> unitregister_create_hook f adds a hook on function create: each time a new project p is created, f p is applied.
The order in which hooks are applied is the same than the order in which hooks are registered.
val current : unit -> tThe current project.
val is_current : t -> boolCheck whether the given project is the current one or not.
val iter_on_projects : (t -> unit) -> unititeration on project starting with the current one.
val fold_on_projects : ('a -> t -> 'a) -> 'a -> 'afolding on project starting with the current one.
val find_all : string -> t listFind all projects with the given name.
Clear all the projects: all the internal states of all the projects are now empty (wrt the action registered with register_todo_after_global_clear and register_todo_after_clear.
Operations on one project
Most operations have one additional selection as argument. If it is specified, the operation is only applied on the states of the given selection on the given project. Beware that the project may become inconsistent if your selection is incorrect.
val get_name : t -> stringProject name. Two projects may have the same name.
val get_unique_name : t -> stringval set_name : t -> string -> unitSet the name of the given project.
val from_unique_name : string -> tReturn a project based on unique_name.
val set_current : ?on:bool -> ?selection:State_selection.t -> t -> unitSet the current project with the given one. The flag on is not for casual users.
val register_after_set_current_hook : user_only:bool -> (t -> unit) -> unitregister_after_set_current_hook f adds a hook on function set_current. The project given as argument to f is the old current project.
- If
user_onlyistrue, then each timeset_currentis directly called by an user of this library,f ()is applied. - If
user_onlyisfalse, then each timeset_currentis applied (even indirectly throughProject.on),f ()is applied. The order in which each hook is applied is unspecified.
val on : ?selection:State_selection.t -> t -> ('a -> 'b) -> 'a -> 'bon p f x sets the current project to p, computes f x then restores the current project. You should use this function if you use a project different of current ().
set_keep_current b keeps the current project forever (even after the end of the current on) iff b is true.
val copy : ?selection:State_selection.t -> ?src:t -> t -> unitCopy a project into another one. Default project for src is current (). Replace the destination by src. For each state to copy, the function copy given at state registration time must be fully implemented.
val create_by_copy :
?selection:State_selection.t ->
?src:t ->
last:bool ->
string ->
tReturn a new project with the given name by copying some states from the project src. All the other states are initialized with their default values. Use the save/load mechanism for copying. Thus it does not require that the copy function of the copied state is implemented. All the hooks applied when loading a project are applied (see load). If last, then remember that the returned project is the last created one.
Register a hook to call at the end of create_by_copy. The first argument of the registered function is the copy source while the second one is the created project.
val clear : ?selection:State_selection.t -> ?project:t -> unit -> unitClear the given project. Default project is current (). All the internal states of the given project are now empty (wrt the action registered with register_todo_before_clear).
val register_todo_before_clear : (t -> unit) -> unitRegister an action performed just before clearing a project.
val register_todo_after_clear : (t -> unit) -> unitRegister an action performed just after clearing a project.
val remove : ?project:t -> unit -> unitDefault project is current (). If the current project is removed, then the new current project is the previous current project if it still exists (and so on).
val register_before_remove_hook : (t -> unit) -> unitregister_before_remove_hook f adds a hook called just before removing a project.
Inputs/Outputs
val save :
?compress:bool ->
?selection:State_selection.t ->
?project:t ->
Filepath.t ->
unitSave a given project in a file. Default project is current ().
val load : ?selection:State_selection.t -> ?name:string -> Filepath.t -> tLoad a file into a new project given by its name. More precisely, load only except name file:
- creates a new project;
- performs all the registered
before_loadactions; - loads the (specified) states of the project according to its description; and
- performs all the registered
after_loadactions.
val save_all :
?compress:bool ->
?selection:State_selection.t ->
Filepath.t ->
unitSave all the projects in a file.
val load_all : ?selection:State_selection.t -> Filepath.t -> unitFirst remove all the existing project, then load all the projects from a file. For each project to load, the specification is the same than Project.load. Furthermore, after loading, all the hooks registered by register_after_set_current_hook are applied.
register_before_load_hook f adds a hook called just before loading **each project** (more precisely, the project exists and but is empty while the hook is applied): if n projects are on disk, the same hook will be called n times (one call by project).
Besides, for each project, the order in which the hooks are applied is the same than the order in which hooks are registered.
register_after_load_hook f adds a hook called just after loading **each project**: if n projects are on disk, the same hook will be called n times (one call by project).
Besides, for each project, the order in which the hooks are applied is the same than the order in which hooks are registered.
register_after_load_hook f adds a hook called just after loading **all projects**. f must not set the current project.
Handling the selection
val get_current_selection : unit -> State_selection.tIf an operation on a project is ongoing, then get_current_selection () returns the selection which is applied on. The behaviour is unspecified if this function is called when no operation depending on a selection is ongoing.
Projects are comparable values
val hash : t -> intUndoing
module Undo : sig ... end