Skip to content
Snippets Groups Projects
Commit ed1a2930 authored by David Bühler's avatar David Bühler Committed by Andre Maroneze
Browse files

[kernel] Emitter: reorders some functions.

parent 801c7e2c
No related branches found
No related tags found
No related merge requests found
...@@ -23,10 +23,6 @@ ...@@ -23,10 +23,6 @@
(* Modules [Hashtbl] and [Kernel] are not usable here. Thus use above modules (* Modules [Hashtbl] and [Kernel] are not usable here. Thus use above modules
instead. *) instead. *)
(**************************************************************************)
(** {2 Datatype} *)
(**************************************************************************)
type kind = Property_status | Alarm | Code_annot | Funspec | Global_annot type kind = Property_status | Alarm | Code_annot | Funspec | Global_annot
type emitter = type emitter =
...@@ -35,6 +31,59 @@ type emitter = ...@@ -35,6 +31,59 @@ type emitter =
tuning_parameters: Typed_parameter.t list; tuning_parameters: Typed_parameter.t list;
correctness_parameters: Typed_parameter.t list } correctness_parameters: Typed_parameter.t list }
(**************************************************************************)
(** {2 Implementation for Plug-in Developers} *)
(**************************************************************************)
let names: unit Datatype.String.Hashtbl.t = Datatype.String.Hashtbl.create 7
let create name kinds ~correctness ~tuning =
if Datatype.String.Hashtbl.mem names name then
Kernel.fatal "emitter %s already exists with the same parameters" name;
let e =
{ name = name;
kinds = kinds;
correctness_parameters = correctness;
tuning_parameters = tuning }
in
Datatype.String.Hashtbl.add names name ();
e
let dummy = create "dummy" [] ~correctness:[] ~tuning:[]
let get_name e = e.name
let correctness_parameters e =
List.map (fun p -> p.Typed_parameter.name) e.correctness_parameters
let tuning_parameters e =
List.map (fun p -> p.Typed_parameter.name) e.tuning_parameters
let end_user =
create
"End-User"
[ Property_status; Code_annot; Funspec; Global_annot ]
~correctness:[]
~tuning:[]
let kernel =
create
"Frama-C kernel"
[ Property_status; Funspec ]
~correctness:[]
~tuning:[]
let orphan =
create
"Orphan"
[ Code_annot; Funspec; Global_annot ]
~correctness:[]
~tuning:[]
(**************************************************************************)
(** {2 Datatype} *)
(**************************************************************************)
module D = module D =
Datatype.Make_with_collections Datatype.Make_with_collections
(struct (struct
...@@ -134,55 +183,6 @@ module Usable_emitter = struct ...@@ -134,55 +183,6 @@ module Usable_emitter = struct
end end
(**************************************************************************)
(** {2 Implementation for Plug-in Developers} *)
(**************************************************************************)
let names: unit Datatype.String.Hashtbl.t = Datatype.String.Hashtbl.create 7
let create name kinds ~correctness ~tuning =
if Datatype.String.Hashtbl.mem names name then
Kernel.fatal "emitter %s already exists with the same parameters" name;
let e =
{ name = name;
kinds = kinds;
correctness_parameters = correctness;
tuning_parameters = tuning }
in
Datatype.String.Hashtbl.add names name ();
e
let dummy = create "dummy" [] ~correctness:[] ~tuning:[]
let get_name e = e.name
let correctness_parameters e =
List.map (fun p -> p.Typed_parameter.name) e.correctness_parameters
let tuning_parameters e =
List.map (fun p -> p.Typed_parameter.name) e.tuning_parameters
let end_user =
create
"End-User"
[ Property_status; Code_annot; Funspec; Global_annot ]
~correctness:[]
~tuning:[]
let kernel =
create
"Frama-C kernel"
[ Property_status; Funspec ]
~correctness:[]
~tuning:[]
let orphan =
create
"Orphan"
[ Code_annot; Funspec; Global_annot ]
~correctness:[]
~tuning:[]
(**************************************************************************) (**************************************************************************)
(** {2 State of all known emitters} *) (** {2 State of all known emitters} *)
(**************************************************************************) (**************************************************************************)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment