module Project:Projects management.sig
..end
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 Project.Computation.Register
.
Consult the Plugin Development Guide for additional details.
type
t
typeproject =
t
val ty : t Type.t
t
.val dummy : t
There are two kinds of kinds in Frama-C: datatypes and computations. They are merely used for theirs dependencies:
module type KIND =sig
..end
val identity : 'a -> 'a
val is_identity : ('a -> 'a) -> bool
Project.identity
.module Datatype:sig
..end
module Computation:sig
..end
module Selection:Kind.SELECTION
with type kind = Computation.t and type t = Computation.selection
val create : string -> t
val register_create_hook : (t -> unit) -> unit
register_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.
exception NoProject
current
.val current : unit -> t
NoProject
if there is no project.val is_current : t -> bool
val iter_on_projects : (t -> unit) -> unit
val find_all : string -> t list
val clear_all : unit -> unit
Project.register_todo_on_clear
).exception IOError of string
val save : ?only:Selection.t ->
?except:Selection.t -> ?project:t -> string -> unit
current ()
.IOError
if the project cannot be saved.val load : ?only:Selection.t ->
?except:Selection.t -> name:string -> string -> t
load only except name file
:
before_load
actions, following the
datatype dependencies;after_load
actions.IOError
if the project cannot be loadedval save_all : string -> unit
IOError
a project cannot be saved.val load_all : string -> unit
Project.load
.IOError
if a project cannot be loaded.val register_before_load_hook : (unit -> unit) -> unit
register_before_load_hook f
adds a hook called just before loading
*each project** (more precisely, the project exists 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.
val register_after_load_hook : (unit -> unit) -> unit
register_before_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.
Most operations have two optional arguments, called only
and except
of
type selection
.
only
is specified, only the selected state kinds are copied.except
is specified, those selected state kinds are not copied (even
if they are also selected by only
).
Use it carefuly because Frama-C may become lost and inconsistent if these
specifications are incorrects.val name : t -> string
val unique_name : t -> string
val from_unique_name : string -> t
val set_current : ?on:bool ->
?only:Selection.t -> ?except:Selection.t -> t -> unit
on
is not for casual users.Invalid_argument
if the given project does not exist anymore.val register_after_set_current_hook : user_only:bool -> (t -> unit) -> unit
register_after_set_current_hook f
adds a hook on function
Project.set_current
. The project given as argument to f
is the old current
project.user_only
is true
, then each time Project.set_current
is directly
called by an user of this library, f ()
is applied.user_only
is false
, then each time Project.set_current
is applied
(even indirectly through Project.on
), f ()
is applied.
The order in which each hook is applied is unspecified.val on : ?only:Selection.t ->
?except:Selection.t -> t -> ('a -> 'b) -> 'a -> 'b
on 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 ()
.val copy : ?only:Selection.t ->
?except:Selection.t -> ?src:t -> t -> unit
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 : ?only:Selection.t ->
?except:Selection.t -> ?src:t -> string -> t
src
. All the others states are initialized with their default
values.
Does not require that the copy function of the copied state is
implemented.val create_by_copy_hook : (t -> t -> unit) -> unit
Project.create_by_copy
. The first
argument of the registered function is the copy source while the
second one is the created project.val clear : ?only:Selection.t ->
?except:Selection.t -> ?project:t -> unit -> unit
current ()
. All the
internal states of the given project are now empty (wrt the action
registered with Project.register_todo_on_clear
).val register_todo_on_clear : (unit -> unit) -> unit
exception Cannot_remove of string
remove
val remove : ?project:t -> unit -> unit
current ()
. If the current project is removed, then
the new current project is the previous current project if it still
exists (and so on).Cannot_remove
if there is only one project.val compare : t -> t -> int
val equal : t -> t -> bool
val hash : t -> int
val rehash : t -> t
module Undo:sig
..end