Skip to content

Commit

Permalink
Conditional Blocks (#173)
Browse files Browse the repository at this point in the history
* Parse correctly conditional region

* Relayout cond region separately and draw cond region

* Show cond bodies correctly

* Place cond bodies

* Show collapsed branch in the right place

* Resize correctly non-collapsed branch

* Fix cond region offset when it's inside another control flow region

* Bugfixes

* Various fixes

* Refactor layout code out of renderer and fix conditional regions

* Fixes

* Refactor and adapt overlays to conditional blocks

* Fix circular dep

* Update version

* Fix

* fix

---------

Co-authored-by: Luca Patrignani <luca.patrignani3@studio.unibo.it>
  • Loading branch information
phschaad and luca-patrignani authored Oct 3, 2024
1 parent cfcb958 commit 657081c
Show file tree
Hide file tree
Showing 28 changed files with 4,330 additions and 4,335 deletions.
4,324 changes: 2,198 additions & 2,126 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spcl/sdfv",
"version": "1.2.11",
"version": "1.3.0",
"description": "A standalone viewer for SDFGs",
"homepage": "https://github.com/spcl/dace-webclient",
"main": "out/index.js",
Expand Down
12 changes: 9 additions & 3 deletions scss/sdfv.scss
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,17 @@ body.sdfv {
--break-block-background-color: #ffc79a;
--return-block-background-color: #ff7d7d;
--loop-background-color: #ffffff;
--loop-background-simple-color: #e0e0e0;
--loop-foreground-color: #000000;;
--loop-background-simple-color: #eeeeee;
--loop-foreground-color: #000000;
--loop-border-color: #3d3d3d;
--conditional-background-color: #ffffff;
--conditional-background-simple-color: #bec080;
--conditional-foreground-color: #000000;
--conditional-border-color: #3d3d3d;
--control-flow-region-background-color: #ffffff;
--control-flow-region-background-simple-color: #e0e0e0;
--control-flow-region-background-simple-color: #eeeeee;
--control-flow-region-foreground-color: #000000;
--control-flow-region-border-color: #3d3d3d;
--interstate-edge-color: #86add9;
--connector-scoped-color: #c1dfe690;
--connector-unscoped-color: #f0fdff;
Expand Down
17 changes: 12 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { SDFGElement } from './renderer/renderer_elements';

export * from './overlays/generic_sdfg_overlay';
export * from './overlays/memory_volume_overlay';
export * from './overlays/runtime_micro_seconds_overlay';
export * from './overlays/memory_location_overlay';
Expand All @@ -17,7 +16,6 @@ export * from './renderer/renderer_elements';
export * from './renderer/renderer';
export * from './utils/sdfg/display';
export * from './utils/sdfg/json_serializer';
export * from './utils/sdfg/sdfg_parser';
export * from './utils/sdfg/sdfg_utils';
export * from './utils/sdfg/traversal';
export * from './utils/sdfv_settings';
Expand Down Expand Up @@ -75,6 +73,15 @@ export interface JsonSDFGBlock extends JsonSDFGElement {
label: string,
}

type CodeBlock = {
string_data: string,
language: string,
};

export interface JsonSDFGConditionalBlock extends JsonSDFGBlock {
branches: ([CodeBlock | null, JsonSDFGControlFlowRegion])[];
}

export interface JsonSDFGControlFlowRegion extends JsonSDFGBlock {
nodes: JsonSDFGBlock[],
edges: JsonSDFGEdge[],
Expand Down Expand Up @@ -106,9 +113,9 @@ export type Point2D = {
y: number,
};

export type SimpleRect = {
x: number,
y: number,
export type Size2D = {
w: number,
h: number,
};

export type SimpleRect = Point2D & Size2D;
Loading

0 comments on commit 657081c

Please sign in to comment.