1#ifndef ROSE_BinaryAnalysis_Unparser_EdgeArrows_H
2#define ROSE_BinaryAnalysis_Unparser_EdgeArrows_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
7#include <Sawyer/Graph.h>
8#include <Sawyer/Interval.h>
9#include <Sawyer/IntervalMap.h>
10#include <Sawyer/Map.h>
11#include <Rose/StringUtility.h>
12#include <ROSE_DEPRECATED.h>
18namespace BinaryAnalysis {
123 OutputLocation location;
131 Arrow(
const OutputLocation &location,
const bool isForward,
const ArrowId arrowId)
132 : location(location), isForward(isForward), arrowId(arrowId) {}
134 bool operator==(
const Arrow &other) {
135 return location == other.location && isForward == other.isForward && arrowId == other.arrowId;
143 using Columns = std::vector<Column>;
146 OutputLocation outputHull_;
147 EndpointLocations endpointLocations_;
149 ArrowStyle arrowStyle_;
150 size_t minRenderColumns_ = 0;
227 static EndpointId edgeToSourceEndpoint(
size_t edgeId) ROSE_DEPRECATED(
"use toSourceEndpoint");
228 static EndpointId edgeToTargetEndpoint(
size_t edgeId) ROSE_DEPRECATED(
"use toTargetEndpoint");
229 static size_t edgeFromEndpoint(
EndpointId) ROSE_DEPRECATED(
"use fromEndpoint");
325 void debugLines(std::ostream&,
const std::vector<EndpointId>&)
const;
333 static bool ascendingLength(
const Arrow &a,
const Arrow &b);
Renders textual margin arrows.
static bool isSourceEndpoint(EndpointId)
Arrow endpoint IDs related to edge or vertex IDs.
Sawyer::Optional< Arrow > findArrow(ArrowId) const
Finds the arrow information for the specified edge.
static bool isTargetEndpoint(EndpointId)
Arrow endpoint IDs related to edge or vertex IDs.
ArrowSide
Specifies on which side of the output the arrows appear.
@ RIGHT
Arrows appear right of the main output and point to the left.
@ LEFT
Arrows appear left of the main output and point to the right.
static ArrowStyle asciiL4()
Arrow rendering styles.
void computeCfgEdgeLayout(const Partitioner2::PartitionerConstPtr &, const Partitioner2::FunctionPtr &)
Compute arrow layout for a control flow graph for a function.
static size_t fromEndpoint(EndpointId)
Arrow endpoint IDs related to edge or vertex IDs.
static EndpointId toTargetEndpoint(size_t cfgEdgeOrVertexId)
Arrow endpoint IDs related to edge or vertex IDs.
std::pair< size_t, size_t > minMaxRenderColumns() const
Property: Minimum and maximum number of columns to render.
void computeLayout(const Graph &, const std::vector< EndpointId > &order)
Analyze connectivity in order to assign arrow locations.
static EndpointId toSourceEndpoint(size_t cfgEdgeOrVertexId)
Arrow endpoint IDs related to edge or vertex IDs.
size_t nTargets(EndpointId) const
Number of arrows that point to the given endpoint.
const ArrowStyle & arrowStyle() const
Property: Information about how to render an arrow.
static ArrowStyle asciiR3()
Arrow rendering styles.
size_t nRenderColumns() const
Number of columns to render.
void arrowStyle(ArrowStylePreset, ArrowSide)
Set the arrow style to a preset value.
static EndpointId otherEndpoint(EndpointId)
Arrow endpoint IDs related to edge or vertex IDs.
size_t EndpointId
Endpoint identification number.
static ArrowStyle unicodeL2()
Arrow rendering styles.
bool columnIsRendered(size_t columnIdx) const
Predicate: Whether the specified arrow column is rendered.
static ArrowStyle unicodeL1()
Arrow rendering styles.
void debugGraph(std::ostream &, const Graph &) const
Print implementation-defined debugging information.
void debugLines(std::ostream &, const std::vector< EndpointId > &) const
Print implementation-defined debugging information.
bool exists(EndpointId) const
Tests whether endpoint ID is known.
ArrowStylePreset
Arrow style presets.
@ ASCII_1
Single-character ASCII-art arrows.
@ ASCII_3
Threee-character ASCII-art arrows.
@ UNICODE_1
Single-character Unicode arrows.
@ ASCII_2
Two-character ASCII-art arrows.
@ UNICODE_2
Two-character Unicode arrows.
static ArrowStyle asciiR4()
Arrow rendering styles.
OutputPart
Parts of the output.
@ MIDDLE_LINE
Non-arrow lines between target and source lines for a pointee.
@ FIRST_LINE
An arrow target line.
@ LAST_LINE
An arrow source line.
@ INTER_LINE
Lines between sources of this pointee and targets of next pointee.
void debug(std::ostream &) const
Print implementation-defined debugging information.
static ArrowStyle unicodeR1()
Arrow rendering styles.
void computeCfgBlockLayout(const Partitioner2::PartitionerConstPtr &, const Partitioner2::FunctionPtr &)
Compute arrow layout for a control flow graph for a function.
static ArrowStyle asciiL3()
Arrow rendering styles.
size_t nSources(EndpointId) const
Number of arrows that emanate from the given endpoint.
void arrowStyle(const ArrowStyle &t)
Property: Information about how to render an arrow.
void reset()
Reset the analysis.
static ArrowStyle asciiR1()
Arrow rendering styles.
static ArrowStyle asciiR2()
Arrow rendering styles.
size_t nArrowColumns() const
Number of arrow columns.
static ArrowStyle unicodeR2()
Arrow rendering styles.
void minMaxRenderColumns(size_t minColumns, size_t maxColumns)
Property: Minimum and maximum number of columns to render.
static ArrowStyle asciiL2()
Arrow rendering styles.
size_t ArrowId
Arrow identification number.
std::string renderBlank() const
Render a field of blank characters for all the columns.
std::string render(EndpointId, OutputPart) const
Render arrow columns for an endpoint.
static ArrowStyle asciiL1()
Arrow rendering styles.
An associative container whose keys are non-overlapping intervals.
Range of values delimited by endpoints.
Container associating values with keys.
Holds a value or nothing.
const size_t INVALID_INDEX
Invalid array index.
const size_t UNLIMITED
Effectively unlimited size.
std::string sourceHorizontal
Text for the horizontal source of an arrow.
std::string upToTarget
Text for an arrow comming from below into a vertex.
std::string targetHorizontal
Text for the horizontal target of an arrow.
std::string sourceThenDown
Text for an arrow leaving a vertex and turning downward.
size_t charactersPerColumn
Number of characters per arrow column.
std::string downToTarget
Text for an arrow comming from above into a vertex.
std::string verticalLine
Text for the vertical line part of an arrow.
std::string blank
Text when there's lack of any arrow.
std::string sourceThenUp
Text for an arrow leaving a vertex and turning upward.
bool pointsRight
Arrows point right? Otherwise left.