From b6f689ac5fdc52f40b2c3a19b94877a64fb1536b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr> Date: Thu, 6 Jun 2024 19:24:39 +0200 Subject: [PATCH] [region] dummy memory view --- ivette/src/frama-c/plugins/region/index.tsx | 4 +- ivette/src/frama-c/plugins/region/memory.tsx | 43 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 ivette/src/frama-c/plugins/region/memory.tsx diff --git a/ivette/src/frama-c/plugins/region/index.tsx b/ivette/src/frama-c/plugins/region/index.tsx index 7985093d248..5cebfb451ff 100644 --- a/ivette/src/frama-c/plugins/region/index.tsx +++ b/ivette/src/frama-c/plugins/region/index.tsx @@ -25,14 +25,14 @@ // -------------------------------------------------------------------------- import React from 'react'; -import { Label } from 'dome/controls/labels'; import * as Ivette from 'ivette'; +import { MemoryView } from './memory'; Ivette.registerComponent({ id: 'fc.region.main', label: 'Region Analysis', preferredPosition: 'B', - children: <Label label='Hello Regions'/>, + children: <MemoryView />, }); // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/plugins/region/memory.tsx b/ivette/src/frama-c/plugins/region/memory.tsx new file mode 100644 index 00000000000..2a7b1f3fa98 --- /dev/null +++ b/ivette/src/frama-c/plugins/region/memory.tsx @@ -0,0 +1,43 @@ +/* ************************************************************************ */ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2024 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/* ************************************************************************ */ + +// -------------------------------------------------------------------------- +// --- Regions +// -------------------------------------------------------------------------- + +import React from 'react'; +import * as Dot from 'dome/graph/diagram'; +import * as States from 'frama-c/states'; +import * as Region from './api'; + +function makeDiagram(_regions: Region.region[]) : Dot.DiagramProps { + const nodes: Dot.Node[] = []; + const edges: Dot.Edge[] = []; + return { nodes, edges }; +} + +export function MemoryView(): JSX.Element { + const scope = States.useCurrentScope(); + const regions = States.useRequest(Region.regions, scope) ?? []; + const diagram = React.useMemo(() => makeDiagram(regions), [regions]); + return <Dot.Diagram display={regions.length > 0} {...diagram} />; +} -- GitLab