Skip to content
Snippets Groups Projects
Commit 3c2ad9e3 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[ivette/wp] add menu for generating RTE guards

parent eb59210e
No related branches found
No related tags found
No related merge requests found
...@@ -485,6 +485,16 @@ export const goalsDataDefault: goalsData = ...@@ -485,6 +485,16 @@ export const goalsDataDefault: goalsData =
name: '', smoke: false, passed: false, status: statusDefault, name: '', smoke: false, passed: false, status: statusDefault,
stats: statsDefault, proof: false, script: undefined, saved: false }; stats: statsDefault, proof: false, script: undefined, saved: false };
const generateRTEGuards_internal: Server.ExecRequest<marker,null> = {
kind: Server.RqKind.EXEC,
name: 'plugins.wp.generateRTEGuards',
input: jMarker,
output: Json.jNull,
signals: [],
};
/** Generate RTE guards for the function */
export const generateRTEGuards: Server.ExecRequest<marker,null>= generateRTEGuards_internal;
const startProofs_internal: Server.ExecRequest<marker,null> = { const startProofs_internal: Server.ExecRequest<marker,null> = {
kind: Server.RqKind.EXEC, kind: Server.RqKind.EXEC,
name: 'plugins.wp.startProofs', name: 'plugins.wp.startProofs',
......
...@@ -41,10 +41,10 @@ import * as WP from 'frama-c/plugins/wp/api'; ...@@ -41,10 +41,10 @@ import * as WP from 'frama-c/plugins/wp/api';
import './style.css'; import './style.css';
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* --- Generate Goals --- */ /* --- Context Menus --- */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
function buildMenu( function addStartProofMenus(
menu: Dome.PopupMenuItem[], menu: Dome.PopupMenuItem[],
attr: Ast.markerAttributesData, attr: Ast.markerAttributesData,
): void { ): void {
...@@ -62,7 +62,25 @@ function buildMenu( ...@@ -62,7 +62,25 @@ function buildMenu(
} }
} }
ASTview.registerMarkerMenuExtender(buildMenu); ASTview.registerMarkerMenuExtender(addStartProofMenus);
function addGenerateRTEGuardsMenu(
menu: Dome.PopupMenuItem[],
attr: Ast.markerAttributesData,
): void {
const { marker, kind } = attr;
switch (kind) {
case 'LFUN':
case 'DFUN':
menu.push({
label: `Populate WP RTE guards`,
onClick: () => Server.send(WP.generateRTEGuards, marker)
});
return;
}
}
ASTview.registerMarkerMenuExtender(addGenerateRTEGuardsMenu);
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* --- Goal Component --- */ /* --- Goal Component --- */
......
...@@ -381,6 +381,24 @@ let goals = ...@@ -381,6 +381,24 @@ let goals =
~add_reload_hook ~add_reload_hook
gmodel gmodel
(* -------------------------------------------------------------------------- *)
(* --- Generate RTEs --- *)
(* -------------------------------------------------------------------------- *)
let () =
R.register ~package ~kind:`EXEC ~name:"generateRTEGuards"
~descr:(Md.plain "Generate RTE guards for the function")
~input:(module AST.Marker)
~output:(module D.Junit)
begin function
| PVDecl (Some kf, _, _) ->
let setup = Factory.parse (Wp_parameters.Model.get ()) in
let driver = Driver.load_driver () in
let model = Factory.instance setup driver in
WpRTE.generate model kf
| _ -> ()
end
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
(* --- Generate goals --- *) (* --- Generate goals --- *)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
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