DGraph.xcc
Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechin@st.com)
Copyright 2007 STMicroelectronics. Copyright 1995 - 1998 Commissariat a l'Energie Atomique.
This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.
DGraphArc— Pseudo type for DGraph arcs.
typedef void DGraphArc_, *DGraphArc; typedef const void *const_DGraphArc;
DGraphNode— Pseudo type for DGraph nodes.
typedef void DGraphNode_, *DGraphNode; typedef const void *const_DGraphNode;
DGraphArc_CELL— Access to the DGraphArcCell under this
arc.
DGraphArc_TAILNODE— Tail DGraphNode of this
DGraphArc.
DGraphArc_HEADNODE— Head DGraphNode of this
DGraphArc.
DGraphArc_LEAVEARC— Next DGraphArc in the list of leaving arcs.
DGraphArc_ENTERARC— Next DGraphArc in the list of entering arcs.
#define DGraphArc_CELL(this) ((DGraphArcCell)(this) - 1) #define DGraphArc_TAILNODE(this) DGraphArcCell_TAILNODE(DGraphArc_CELL(this)) #define DGraphArc_HEADNODE(this) DGraphArcCell_HEADNODE(DGraphArc_CELL(this)) #define DGraphArc_LEAVEARC(this) DGraphArcCell_LEAVEARC(DGraphArc_CELL(this)) #define DGraphArc_ENTERARC(this) DGraphArcCell_ENTERARC(DGraphArc_CELL(this))
DGraphArc__LEAVEARC— Mutator for the next DGraphArc in the list of leaving arcs.
DGraphArc__ENTERARC— Mutator for the next DGraphArc in the list of entering arcs.
#define DGraphArc__LEAVEARC(this) DGraphArcCell__LEAVEARC(DGraphArc_CELL(this)) #define DGraphArc__ENTERARC(this) DGraphArcCell__ENTERARC(DGraphArc_CELL(this))
DGraphArc_tailIndex— Index of the tail DGraphNode of this
DGraphArc.
DGraphArc_headIndex— Index of the head DGraphNode of this
DGraphArc.
DGraphArc_tailNumber— Number of the tail DGraphNode of this
DGraphArc.
DGraphArc_headNumber— Number of the head DGraphNode of this
DGraphArc.
#define DGraphArc_tailIndex(this) DGraphNode_INDEX(DGraphArc_TAILNODE(this)) #define DGraphArc_headIndex(this) DGraphNode_INDEX(DGraphArc_HEADNODE(this)) #define DGraphArc_tailNumber(this) DGraphNode_NUMBER(DGraphArc_TAILNODE(this)) #define DGraphArc_headNumber(this) DGraphNode_NUMBER(DGraphArc_HEADNODE(this))
DGraphArc_attachTailNode— Attach this DGraphArc to a tail DGraphNode.
void DGraphArc_attachTailNode(DGraphArc this, DGraphNode tailNode);
DGraphArc_attachHeadNode— Attach this DGraphArc to a head DGraphNode.
void DGraphArc_attachHeadNode(DGraphArc this, DGraphNode headNode);
DGraphArc_detachTailNode— Detach this DGraphArc from its tail DGraphNode.
void DGraphArc_detachTailNode(DGraphArc this);
DGraphArc_detachHeadNode— Detach this DGraphArc from its head DGraphNode.
void DGraphArc_detachHeadNode(DGraphArc this);
DGraphNode_CELL— Access to the DGraphNodeCell under this
node.
DGraphNode_INDEX— Index of the node in the DGraph, starts at 0.
DGraphNode_NUMBER— Number of the node in the DGraph, starts at 1.
DGraphNode_SCANNODE— Accessor for the next node in scanning order.
DGraphNode__SCANNODE— Mutator for the next node in scanning order.
DGraphNode_LEAVEARC— First arc to leave this DGraphNode.
DGraphNode_ENTERARC— First arc to enter this DGraphNode.
#define DGraphNode_CELL(this) ((DGraphNodeCell)(this) - 1) #define DGraphNode_INDEX(this) DGraphNodeCell_INDEX(DGraphNode_CELL(this)) #define DGraphNode_NUMBER(this) (DGraphNode_INDEX(this) + 1) #define DGraphNode_SCANNODE(this) DGraphNodeCell_SCANNODE(DGraphNode_CELL(this)) #define DGraphNode__SCANNODE(this) DGraphNodeCell__SCANNODE(DGraphNode_CELL(this)) #define DGraphNode_LEAVEARC(this) DGraphNodeCell_LEAVEARC(DGraphNode_CELL(this)) #define DGraphNode_ENTERARC(this) DGraphNodeCell_ENTERARC(DGraphNode_CELL(this))
DGraphNode__LEAVEARC— Mutator for the first arc to leave this DGraphNode.
DGraphNode__ENTERARC— Mutator for the first arc to enter this DGraphNode.
#define DGraphNode__LEAVEARC(this) DGraphNodeCell__LEAVEARC(DGraphNode_CELL(this)) #define DGraphNode__ENTERARC(this) DGraphNodeCell__ENTERARC(DGraphNode_CELL(this))
DGraphNode_FORLEAVE— Iterate over the leaving arc of this node.
#define DGraphNode_FORLEAVE(this, Type, arc) { \ Type *DGraphNode_LEAVEARC = DGraphNode_LEAVEARC(this); \ while (DGraphNode_LEAVEARC != NULL) { \ Type *(arc) = DGraphNode_LEAVEARC; \ DGraphNode_LEAVEARC = DGraphArc_LEAVEARC(DGraphNode_LEAVEARC); #define DGraphNode_ENDLEAVE \ } \ } \
DGraphNode_FORENTER— Iterate over the entering arc of this node.
#define DGraphNode_FORENTER(this, Type, arc) { \ Type *DGraphNode_ENTERARC = DGraphNode_ENTERARC(this); \ while (DGraphNode_ENTERARC != NULL) { \ Type *(arc) = DGraphNode_ENTERARC; \ DGraphNode_ENTERARC = DGraphArc_ENTERARC(DGraphNode_ENTERARC); #define DGraphNode_ENDENTER \ } \ } \
DGraphNode_detachEnterArcs— Detach this DGraphNode enter arc list.
void DGraphNode_detachEnterArcs(DGraphNode this);
DGraphNode_detachLeaveArcs— Detach this DGraphNode leave arc list.
void DGraphNode_detachLeaveArcs(DGraphNode this);
DGraphNode_sortLeaveArcs— Sort this DGraphNode leave arc list.
void DGraphNode_sortLeaveArcs(DGraphNode this, int (*cmp)(const_DGraphArc, const_DGraphArc));
DGraph_empty— Empty this DGraph.
void DGraph_empty(DGraph this, void (*release_node)(DGraphNode), void (*release_arc)(DGraphArc));
DGraph_FOREACH— Iterate over this DGraph nodes.
#define DGraph_FOREACH(this, Type, node) { \ DGraphNode *DGraph_NODES = DGraph_nodes(this); \ int32_t DGraph_COUNT = DGraph_count(this), DGraph_I; \ for (DGraph_I = 0; DGraph_I < DGraph_COUNT; DGraph_I++) { \ Type *(node) = DGraph_NODES[DGraph_I]; #define DGraph_ENDEACH \ } \ }
DGraph_FORSCAN— Scan this DGraph nodes.
#define DGraph_FORSCAN(this, Type, node) { \ Type *(node) = (Type *)DGraph_rootNode(this); \ for (; node != NULL; node = (Type *)DGraphNode_SCANNODE(node)) { #define DGraph_ENDSCAN \ } \ }
DGraph_memory— Access this DGraph memory.
static inline Memory DGraph_memory(DGraph this) { return DGraph_MEMORY(this); }
DGraph_rootNode— Access the DGraph root node.
static inline DGraphNode DGraph_rootNode(DGraph this) { return DGraph_ROOTNODE(this); }
DGraph_rootNode— Mutate the DGraph root node.
static inline DGraphNode * DGraph__rootNode(DGraph this) { return DGraph__ROOTNODE(this); }
DGraph_scanNode— For use by DGraph_FORSCAN.
static inline DGraphNode DGraph_scanNode(DGraph this) { return DGraph_SCANNODE(this); }
DGraph__scanNode— Mutate the DGraph scan node.
static inline DGraphNode * DGraph__scanNode(DGraph this) { return DGraph__SCANNODE(this); }
DGraph_nodeCount— This DGraph count of DGraphNodes.
static inline int32_t DGraph_nodeCount(DGraph this) { return DGraph_NODECOUNT(this); }
DGraph_arcCount— This DGraph count of DGraphArcs.
static inline int32_t DGraph_arcCount(DGraph this) { return DGraph_ARCCOUNT(this); }
DGraph_count— For use by DGraph_FOREACH.
static inline int32_t DGraph_count(DGraph this) { PtrSeq nodeStack = DGraph_NODESTACK(this); return PtrSeq_count(nodeStack); }
DGraph_nodeOf— Array of DGraphNode(s) indexed by DGraphNode_NUMBER.
static inline DGraphNode * DGraph_nodeOf(DGraph this) { return (DGraphNode *)DGraph_NODES(this) - 1; }
DGraph_nodes— For use by DGraph_FOREACH.
static inline DGraphNode * DGraph_nodes(DGraph this) { return DGraph_NODES(this); }
DGraph_makeNode— Make a new DGraph node.
DGraphNode DGraph_makeNode(DGraph this, size_t nodeSize);
DGraph_access— Access a DGraph node from its index.
static inline DGraphNode DGraph_access(DGraph this, int32_t nodeIndex) { Except_REQUIRE(nodeIndex >= 0 && nodeIndex < DGraph_count(this)); return DGraph_nodes(this)[nodeIndex]; }
DGraph_attachArc— Attach an already constructed DGraph arc in this DGraph.
static inline DGraphArc DGraph_attachArc(DGraph this, DGraphArc arc, DGraphNode tail_node, DGraphNode head_node) { if (tail_node != NULL) DGraphArc_attachTailNode(arc, tail_node); if (head_node != NULL) DGraphArc_attachHeadNode(arc, head_node); ++*DGraph__ARCCOUNT(this); return arc; }
DGraph_makeArc— Make and attach a new DGraph arc in this DGraph.
DGraphArc DGraph_makeArc(DGraph this, DGraphNode tail_node, DGraphNode head_node, size_t arcSize);
DGraph_getArc— Get an arc between two designated nodes.
DGraphArc DGraph_getArc(DGraph this, DGraphNode tail_node, DGraphNode head_node, int position);
DGraph_detachArc— Detach a DGraphArc.
static inline void DGraph_detachArc(DGraph this, DGraphArc arc) { if (DGraphArc_TAILNODE(arc) != NULL) { DGraphArc_detachTailNode(arc); } if (DGraphArc_HEADNODE(arc) != NULL) { DGraphArc_detachHeadNode(arc); } }
DGraph_removeArc— Remove a DGraphArc from this DGraph.
void DGraph_removeArc(DGraph this, DGraphArc arc);