1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
/*
* rea.h --
*
* Common header-file for dump-cm.c and dump-svg.c.
*
* Copyright (c) 2000 A. Mueller, Technical University of Braunschweig.
* Copyright (c) 2005 K. Sperner, Technical University of Braunschweig.
*
* See the file "COPYING" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* @(#) $Id: rea.h 7382 2007-10-19 23:40:24Z schoenw $
*/
#ifndef _REA_H
#define _REA_H
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_WIN_H
#include "win.h"
#endif
#include "smi.h"
#include "smidump.h"
#define ABS(a) ((float)((a > 0.0) ? (a) : (-(a))))
typedef enum GraphCardinality {
GRAPH_CARD_UNKNOWN = 0,
GRAPH_CARD_ONE_TO_ONE = 1,
GRAPH_CARD_ONE_TO_MANY = 2,
GRAPH_CARD_ZERO_TO_ONE = 3,
GRAPH_CARD_ZERO_TO_MANY = 4,
GRAPH_CARD_ONE_TO_ZERO_OR_ONE = 5
} GraphCardinality;
typedef enum GraphConnection {
GRAPH_CON_UNKNOWN = 0,
GRAPH_CON_AGGREGATION = 1,
GRAPH_CON_DEPENDENCY = 2,
GRAPH_CON_ASSOCIATION = 3
} GraphConnection;
typedef enum GraphEnhIndex {
GRAPH_ENHINDEX_UNKNOWN = 0,
GRAPH_ENHINDEX_NOTIFICATION = 1,
GRAPH_ENHINDEX_TYPES = 2,
GRAPH_ENHINDEX_NAMES = 3,
GRAPH_ENHINDEX_INDEX = 4,
GRAPH_ENHINDEX_REROUTE = 5,
GRAPH_ENHINDEX_POINTER = 6
} GraphEnhIndex;
/*
* Definition used by the dia output driver.
*/
#define DIA_PRINT_FLAG 0x01
typedef struct DiaNode {
int flags; /* flags for the dia xml output driver */
float x,y; /* coordinates (left upper corner) */
float xDisp,yDisp; /* displacement vector for springembedder */
float w,h; /* width and height of the dia node */
int relatedScalars; /* has related scalars -> print them */
int indexObjects; /* has index objects -> print them */
} DiaNode;
typedef struct DiaEdge {
int flags; /* flags for the dia xml output driver */
float startX, startY; /* Intersection of edge and startNode */
float endX, endY; /* Intersection of edge and endNode */
} DiaEdge;
/*
* Generic structure for moduleInformation string-lists.
*/
typedef struct StringListElem {
struct StringListElem *nextPtr;
SmiStatus status;
char *miElem;
} StringListElem;
/*
* Generic structures for the internal graph representation.
*/
typedef struct GraphComponent {
struct GraphComponent *nextPtr;
struct GraphNode *firstComponentNode;
float xMin;
float xMax;
float yMin;
float yMax;
float xOffset;
float yOffset;
} GraphComponent;
typedef struct GraphNode {
struct GraphNode *nextPtr;
SmiNode *smiNode;
SmiModule *smiModule;
int group; /* group number of this graph node */
int use; /* use node in the layout-algorithm */
int degree; /* quantity of adjacent nodes */
GraphComponent *component; /* component the node belongs to */
struct GraphNode *nextComponentNode;
DiaNode dia;
} GraphNode;
typedef struct GraphEdge {
struct GraphEdge *nextPtr;
GraphNode *startNode;
GraphNode *endNode;
SmiIndexkind indexkind;
GraphConnection connection;
GraphCardinality cardinality;
GraphEnhIndex enhancedindex;
int use; /* use edge in the layout-algorithm */
DiaEdge dia;
} GraphEdge;
typedef struct Graph {
GraphNode *nodes;
GraphEdge *edges;
GraphComponent *components;
} Graph;
/*
* driver output control
*/
extern int CANVASHEIGHT;
extern int CANVASWIDTH;
extern int SHOW_DEPRECATED;
extern int SHOW_DEPR_OBSOLETE;
extern int STATIC_OUTPUT;
extern int XPLAIN;
extern int XPLAIN_DEBUG;
extern int SUPPRESS_DEPRECATED;
extern int PRINT_DETAILED_ATTR;
extern int IGNORE_IMPORTED_NODES;
/*
* global variables
*/
extern Graph *graph;
/*
* help functions
*/
#ifndef max
#define max(a, b) ((a < b) ? b : a)
#endif
#ifndef min
#define min(a, b) ((a < b) ? a : b)
#endif
/* ------ Misc. ----------------- */
extern int cmpSmiNodes(SmiNode *node1, SmiNode *node2);
/* ------ Graph primitives ------ */
extern GraphNode *graphInsertNode(Graph *graph, SmiNode *smiNode);
extern GraphComponent *graphInsertComponent(Graph *graph);
extern void graphExit(Graph *graph);
extern GraphEdge *graphGetFirstEdgeByNode(Graph *graph, GraphNode *node);
extern GraphEdge *graphGetNextEdgeByNode(Graph *graph,
GraphEdge *edge,
GraphNode *node);
extern void graphShowNodes(Graph *graph);
/* ------ algorithm primitives ------ */
extern int algGetNumberOfGroups();
extern char *algGetTypeDescription(SmiNode *smiNode);
extern char *algGetTypeName(SmiNode *smiNode);
extern SmiModule *algGetTypeModule(SmiNode *smiNode);
extern int isBaseType(SmiNode *node);
extern int algIsIndexElement(SmiNode *table, SmiNode *node);
/* -------------- main functions ------------------------------------------- */
extern void algLinkTables();
extern void algCheckLinksByName();
extern void algConnectLonelyNodes();
extern void algCheckForDependency();
extern void algCheckForPointerRels();
#endif
|