Blame tools/rea.h

Packit 022b05
/*
Packit 022b05
 * rea.h --
Packit 022b05
 *
Packit 022b05
 *      Common header-file for dump-cm.c and dump-svg.c.
Packit 022b05
 *
Packit 022b05
 * Copyright (c) 2000 A. Mueller, Technical University of Braunschweig.
Packit 022b05
 * Copyright (c) 2005 K. Sperner, Technical University of Braunschweig.
Packit 022b05
 *
Packit 022b05
 * See the file "COPYING" for information on usage and redistribution
Packit 022b05
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Packit 022b05
 *
Packit 022b05
 * @(#) $Id: rea.h 7382 2007-10-19 23:40:24Z schoenw $
Packit 022b05
 */
Packit 022b05
Packit 022b05
#ifndef _REA_H
Packit 022b05
#define _REA_H
Packit 022b05
Packit 022b05
#include <config.h>
Packit 022b05
Packit 022b05
#include <stdio.h>
Packit 022b05
#include <stdlib.h>
Packit 022b05
#include <string.h>
Packit 022b05
#include <ctype.h>
Packit 022b05
#ifdef HAVE_WIN_H
Packit 022b05
#include "win.h"
Packit 022b05
#endif
Packit 022b05
Packit 022b05
#include "smi.h"
Packit 022b05
#include "smidump.h"
Packit 022b05
Packit 022b05
Packit 022b05
Packit 022b05
#define ABS(a) ((float)((a > 0.0) ? (a) : (-(a))))
Packit 022b05
Packit 022b05
Packit 022b05
Packit 022b05
typedef enum GraphCardinality {
Packit 022b05
    GRAPH_CARD_UNKNOWN            = 0,
Packit 022b05
    GRAPH_CARD_ONE_TO_ONE         = 1,
Packit 022b05
    GRAPH_CARD_ONE_TO_MANY        = 2,
Packit 022b05
    GRAPH_CARD_ZERO_TO_ONE        = 3,
Packit 022b05
    GRAPH_CARD_ZERO_TO_MANY       = 4,
Packit 022b05
    GRAPH_CARD_ONE_TO_ZERO_OR_ONE = 5
Packit 022b05
} GraphCardinality;
Packit 022b05
Packit 022b05
typedef enum GraphConnection {
Packit 022b05
    GRAPH_CON_UNKNOWN       = 0,
Packit 022b05
    GRAPH_CON_AGGREGATION   = 1,
Packit 022b05
    GRAPH_CON_DEPENDENCY    = 2,
Packit 022b05
    GRAPH_CON_ASSOCIATION   = 3
Packit 022b05
} GraphConnection;
Packit 022b05
Packit 022b05
typedef enum GraphEnhIndex {
Packit 022b05
    GRAPH_ENHINDEX_UNKNOWN      = 0,
Packit 022b05
    GRAPH_ENHINDEX_NOTIFICATION = 1,
Packit 022b05
    GRAPH_ENHINDEX_TYPES        = 2,
Packit 022b05
    GRAPH_ENHINDEX_NAMES        = 3,
Packit 022b05
    GRAPH_ENHINDEX_INDEX        = 4,
Packit 022b05
    GRAPH_ENHINDEX_REROUTE      = 5,
Packit 022b05
    GRAPH_ENHINDEX_POINTER      = 6
Packit 022b05
} GraphEnhIndex;
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * Definition used by the dia output driver.
Packit 022b05
 */
Packit 022b05
Packit 022b05
#define DIA_PRINT_FLAG	0x01
Packit 022b05
Packit 022b05
typedef struct DiaNode {
Packit 022b05
    int   flags;		/* flags for the dia xml output driver */
Packit 022b05
    float x,y;			/* coordinates (left upper corner) */
Packit 022b05
    float xDisp,yDisp;		/* displacement vector for springembedder */
Packit 022b05
    float w,h;			/* width and height of the dia node */
Packit 022b05
    int relatedScalars;		/* has related scalars -> print them */
Packit 022b05
    int indexObjects;		/* has index objects -> print them */
Packit 022b05
} DiaNode;
Packit 022b05
Packit 022b05
typedef struct DiaEdge {
Packit 022b05
    int   flags;		/* flags for the dia xml output driver */
Packit 022b05
    float startX, startY;	/* Intersection of edge and startNode */
Packit 022b05
    float endX, endY;		/* Intersection of edge and endNode */
Packit 022b05
} DiaEdge;
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * Generic structure for moduleInformation string-lists.
Packit 022b05
 */
Packit 022b05
Packit 022b05
typedef struct StringListElem {
Packit 022b05
    struct StringListElem *nextPtr;
Packit 022b05
    SmiStatus             status;
Packit 022b05
    char                  *miElem;
Packit 022b05
} StringListElem;
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * Generic structures for the internal graph representation.
Packit 022b05
 */
Packit 022b05
Packit 022b05
typedef struct GraphComponent {
Packit 022b05
    struct GraphComponent *nextPtr;
Packit 022b05
    struct GraphNode      *firstComponentNode;
Packit 022b05
    float                 xMin;
Packit 022b05
    float                 xMax;
Packit 022b05
    float                 yMin;
Packit 022b05
    float                 yMax;
Packit 022b05
    float                 xOffset;
Packit 022b05
    float                 yOffset;
Packit 022b05
} GraphComponent;
Packit 022b05
Packit 022b05
typedef struct GraphNode {
Packit 022b05
    struct GraphNode *nextPtr;
Packit 022b05
    SmiNode          *smiNode;
Packit 022b05
    SmiModule        *smiModule;
Packit 022b05
    int              group;		/* group number of this graph node */
Packit 022b05
    int              use;		/* use node in the layout-algorithm */
Packit 022b05
    int              degree;		/* quantity of adjacent nodes */
Packit 022b05
    GraphComponent   *component;	/* component the node belongs to */
Packit 022b05
    struct GraphNode *nextComponentNode;
Packit 022b05
    DiaNode          dia;
Packit 022b05
} GraphNode;
Packit 022b05
Packit 022b05
typedef struct GraphEdge {
Packit 022b05
    struct GraphEdge *nextPtr;         
Packit 022b05
    GraphNode        *startNode;
Packit 022b05
    GraphNode        *endNode;
Packit 022b05
    SmiIndexkind     indexkind;
Packit 022b05
    GraphConnection  connection;
Packit 022b05
    GraphCardinality cardinality;
Packit 022b05
    GraphEnhIndex    enhancedindex;
Packit 022b05
    int              use;		/* use edge in the layout-algorithm */
Packit 022b05
    DiaEdge	     dia;
Packit 022b05
} GraphEdge;
Packit 022b05
Packit 022b05
typedef struct Graph {
Packit 022b05
    GraphNode      *nodes;
Packit 022b05
    GraphEdge      *edges;
Packit 022b05
    GraphComponent *components;
Packit 022b05
} Graph;
Packit 022b05
Packit 022b05
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * driver output control
Packit 022b05
 */
Packit 022b05
extern int CANVASHEIGHT;
Packit 022b05
extern int CANVASWIDTH;
Packit 022b05
extern int SHOW_DEPRECATED;
Packit 022b05
extern int SHOW_DEPR_OBSOLETE;
Packit 022b05
extern int STATIC_OUTPUT;
Packit 022b05
extern int XPLAIN;
Packit 022b05
extern int XPLAIN_DEBUG;
Packit 022b05
extern int SUPPRESS_DEPRECATED;
Packit 022b05
extern int PRINT_DETAILED_ATTR;
Packit 022b05
extern int IGNORE_IMPORTED_NODES;
Packit 022b05
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * global variables
Packit 022b05
 */
Packit 022b05
extern Graph *graph;
Packit 022b05
Packit 022b05
/*
Packit 022b05
 * help functions
Packit 022b05
 */
Packit 022b05
#ifndef max
Packit 022b05
#define max(a, b) ((a < b) ? b : a)
Packit 022b05
#endif
Packit 022b05
#ifndef min
Packit 022b05
#define min(a, b) ((a < b) ? a : b)
Packit 022b05
#endif
Packit 022b05
Packit 022b05
Packit 022b05
Packit 022b05
/* ------ Misc. -----------------                                            */
Packit 022b05
Packit 022b05
extern int cmpSmiNodes(SmiNode *node1, SmiNode *node2);
Packit 022b05
Packit 022b05
Packit 022b05
Packit 022b05
/* ------ Graph primitives ------                                            */
Packit 022b05
Packit 022b05
extern GraphNode *graphInsertNode(Graph *graph, SmiNode *smiNode);
Packit 022b05
Packit 022b05
extern GraphComponent *graphInsertComponent(Graph *graph);
Packit 022b05
Packit 022b05
extern void graphExit(Graph *graph);
Packit 022b05
Packit 022b05
extern GraphEdge *graphGetFirstEdgeByNode(Graph *graph, GraphNode *node);
Packit 022b05
Packit 022b05
extern GraphEdge *graphGetNextEdgeByNode(Graph *graph, 
Packit 022b05
					 GraphEdge *edge,
Packit 022b05
					 GraphNode *node);
Packit 022b05
Packit 022b05
extern void graphShowNodes(Graph *graph);
Packit 022b05
Packit 022b05
Packit 022b05
Packit 022b05
/* ------ algorithm primitives ------                                        */
Packit 022b05
Packit 022b05
extern int algGetNumberOfGroups();
Packit 022b05
Packit 022b05
extern char *algGetTypeDescription(SmiNode *smiNode);
Packit 022b05
Packit 022b05
extern char *algGetTypeName(SmiNode *smiNode);
Packit 022b05
Packit 022b05
extern SmiModule *algGetTypeModule(SmiNode *smiNode);
Packit 022b05
Packit 022b05
extern int isBaseType(SmiNode *node);
Packit 022b05
Packit 022b05
extern int algIsIndexElement(SmiNode *table, SmiNode *node);
Packit 022b05
Packit 022b05
Packit 022b05
Packit 022b05
/* -------------- main functions ------------------------------------------- */
Packit 022b05
Packit 022b05
extern void algLinkTables();
Packit 022b05
Packit 022b05
extern void algCheckLinksByName();
Packit 022b05
Packit 022b05
extern void algConnectLonelyNodes();
Packit 022b05
Packit 022b05
extern void algCheckForDependency();
Packit 022b05
Packit 022b05
extern void algCheckForPointerRels();
Packit 022b05
Packit 022b05
#endif
Packit 022b05