module Project: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 State_builder.Register.
Consult the Plugin Development Guide for additional details.
include Datatype.S_no_copy
module Datatype:Datatype.S_with_collectionswith type t = Project_skeleton.t
typeproject = privateProject_skeleton.t= private {
|
pid : |
|
mutable name : |
|
mutable unique_name : |
val create : string -> tval 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.
exception NoProject
current.val current : unit -> tNoProject if there is no project.val is_current : t -> boolval iter_on_projects : (t -> unit) -> unitval fold_on_projects : ('a -> t -> 'a) -> 'a -> 'aval find_all : string -> t listval clear_all : unit -> unitregister_todo_after_global_clear and Project.register_todo_after_clear.
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 -> stringval get_unique_name : t -> stringname but different of each others
unique_name.val set_name : t -> string -> unitexception Unknown_project
val from_unique_name : string -> tunique_name.Unknown_project if no project has this unique name.val set_current : ?on:bool -> ?selection:State_selection.t -> t -> uniton 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) -> unitregister_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 : ?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 ().only and
except by a single one selection.val set_keep_current : bool -> unitset_keep_current b keeps the current project forever (even after the end
of the current Project.on) iff b is true.val copy : ?selection:State_selection.t -> ?src:t -> t -> unitsrc is current
(). Replace the destination by src.
For each state to copy, the function copy given at state registration
time must be fully implemented.only and
except by a single one selection.val create_by_copy : ?selection:State_selection.t -> ?src:t -> last:bool -> string -> tsrc. 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 Project.load).
If last, then remember that the returned project is the last created
one (see last_created_by_copy).only and
except by a single one selection.last.val create_by_copy_hook : (t -> t -> unit) -> unitProject.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 -> unitcurrent (). All the
internal states of the given project are now empty (wrt the action
registered with register_todo_on_clear).only and
except by a single one selection.val register_todo_before_clear : (t -> unit) -> unitval register_todo_after_clear : (t -> unit) -> unitexception Cannot_remove of string
removeval remove : ?project:t -> unit -> unitcurrent (). 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 register_before_remove_hook : (t -> unit) -> unitregister_before_remove_hook f adds a hook called just before removing
a project.exception IOError of string
val save : ?selection:State_selection.t -> ?project:t -> string -> unitcurrent ().IOError if the project cannot be saved.only and
except by a single one selection.val load : ?selection:State_selection.t -> ?name:string -> string -> tload only except name file:
before_load actions;after_load actions.IOError if the project cannot be loadedonly and
except by a single one selection.val save_all : ?selection:State_selection.t -> string -> unitIOError a project cannot be saved.only and
except by a single one selection.val load_all : ?selection:State_selection.t -> string -> unitProject.load. Furthermore, after loading, all the hooks registered by
register_after_set_current_hook are applied.IOError if a project cannot be loaded.only and
except by a single one selection.val register_before_load_hook : (unit -> unit) -> unitregister_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.
val register_after_load_hook : (unit -> unit) -> unitregister_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.
val register_after_global_load_hook : (unit -> unit) -> unitregister_after_load_hook f adds a hook called just after loading
*all projects**. f must not set the current project.val get_current_selection : unit -> State_selection.tget_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.val compare : t -> t -> int
val equal : t -> t -> bool
val hash : t -> intmodule Undo:sig..end