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>
16namespace BinaryAnalysis {
121 OutputLocation location;
129 Arrow(
const OutputLocation &location,
const bool isForward,
const ArrowId arrowId)
130 : location(location), isForward(isForward), arrowId(arrowId) {}
132 bool operator==(
const Arrow &other) {
133 return location == other.location && isForward == other.isForward && arrowId == other.arrowId;
141 using Columns = std::vector<Column>;
144 OutputLocation outputHull_;
145 EndpointLocations endpointLocations_;
147 ArrowStyle arrowStyle_;
148 size_t minRenderColumns_ = 0;
321 static bool ascendingLength(
const Arrow &a,
const Arrow &b);
Renders textual margin arrows.
static bool isSourceEndpoint(EndpointId)
Endpoint IDs related to edge IDs.
Sawyer::Optional< Arrow > findArrow(ArrowId) const
Finds the arrow information for the specified edge.
static bool isTargetEndpoint(EndpointId)
Endpoint IDs related to edge 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.
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 edgeToSourceEndpoint(size_t edgeId)
Endpoint IDs related to edge 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)
Endpoint IDs related to edge 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.
static size_t edgeFromEndpoint(EndpointId)
Endpoint IDs related to edge IDs.
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 EndpointId edgeToTargetEndpoint(size_t edgeId)
Endpoint IDs related to edge IDs.
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.
Graph containing user-defined vertices and edges.
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.