annotate toolboxes/graph_visualisation/include/graphviz/graph.h @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 /* $Id: graph.h,v 1.20 2009/06/03 01:10:53 ellson Exp $ $Revision: 1.20 $ */
Daniel@0 2 /* vim:set shiftwidth=4 ts=8: */
Daniel@0 3
Daniel@0 4 /**********************************************************
Daniel@0 5 * This software is part of the graphviz package *
Daniel@0 6 * http://www.graphviz.org/ *
Daniel@0 7 * *
Daniel@0 8 * Copyright (c) 1994-2004 AT&T Corp. *
Daniel@0 9 * and is licensed under the *
Daniel@0 10 * Common Public License, Version 1.0 *
Daniel@0 11 * by AT&T Corp. *
Daniel@0 12 * *
Daniel@0 13 * Information and Software Systems Research *
Daniel@0 14 * AT&T Research, Florham Park NJ *
Daniel@0 15 **********************************************************/
Daniel@0 16
Daniel@0 17
Daniel@0 18
Daniel@0 19 #ifndef _GRAPH_H
Daniel@0 20 #define _GRAPH_H 1
Daniel@0 21
Daniel@0 22 #if _PACKAGE_ast
Daniel@0 23 #include <ast.h>
Daniel@0 24 #else
Daniel@0 25 #include <sys/types.h>
Daniel@0 26 #include <stdlib.h>
Daniel@0 27 #endif
Daniel@0 28 #include <stdio.h>
Daniel@0 29 #include "cdt.h"
Daniel@0 30
Daniel@0 31 #ifdef __cplusplus
Daniel@0 32 extern "C" {
Daniel@0 33 #endif
Daniel@0 34
Daniel@0 35 #define TAIL_ID "tailport"
Daniel@0 36 #define HEAD_ID "headport"
Daniel@0 37
Daniel@0 38 typedef struct Agraph_t Agraph_t;
Daniel@0 39 typedef struct Agnode_t Agnode_t;
Daniel@0 40 typedef struct Agedge_t Agedge_t;
Daniel@0 41 typedef struct Agdict_t Agdict_t;
Daniel@0 42 typedef struct Agsym_t Agsym_t;
Daniel@0 43 typedef struct Agdata_t Agdata_t;
Daniel@0 44 typedef struct Agproto_t Agproto_t;
Daniel@0 45
Daniel@0 46 typedef char *(*gets_f) (char *ubuf, int n, FILE * fp);
Daniel@0 47
Daniel@0 48 #define AGFLAG_DIRECTED (1<<0)
Daniel@0 49 #define AGFLAG_STRICT (1<<1)
Daniel@0 50 #define AGFLAG_METAGRAPH (1<<2)
Daniel@0 51
Daniel@0 52 #define AGRAPH 0
Daniel@0 53 #define AGRAPHSTRICT (AGRAPH | AGFLAG_STRICT)
Daniel@0 54 #define AGDIGRAPH AGFLAG_DIRECTED
Daniel@0 55 #define AGDIGRAPHSTRICT (AGDIGRAPH | AGFLAG_STRICT)
Daniel@0 56 #define AGMETAGRAPH (AGFLAG_DIRECTED | AGFLAG_STRICT | AGFLAG_METAGRAPH)
Daniel@0 57
Daniel@0 58 #define AG_IS_DIRECTED(g) ((g)->kind & AGFLAG_DIRECTED)
Daniel@0 59 #define AG_IS_STRICT(g) ((g)->kind & AGFLAG_STRICT)
Daniel@0 60 #define AG_IS_METAGRAPH(g) ((g)->kind & AGFLAG_METAGRAPH)
Daniel@0 61 #define aginit() aginitlib(sizeof(Agraph_t),sizeof(Agnode_t),sizeof(Agedge_t))
Daniel@0 62
Daniel@0 63 struct Agraph_t {
Daniel@0 64 int tag:4;
Daniel@0 65 int kind:4;
Daniel@0 66 int handle:24;
Daniel@0 67 char **attr;
Daniel@0 68 char *didset;
Daniel@0 69 char *name;
Daniel@0 70 Agdata_t *univ;
Daniel@0 71 Dict_t *nodes, *inedges, *outedges;
Daniel@0 72 Agraph_t *root;
Daniel@0 73 Agnode_t *meta_node;
Daniel@0 74 Agproto_t *proto;
Daniel@0 75 Agraphinfo_t u;
Daniel@0 76 };
Daniel@0 77
Daniel@0 78 struct Agnode_t {
Daniel@0 79 int tag:4;
Daniel@0 80 int pad:4;
Daniel@0 81 int handle:24;
Daniel@0 82 char **attr;
Daniel@0 83 char *didset;
Daniel@0 84 char *name;
Daniel@0 85 int id;
Daniel@0 86 Agraph_t *graph;
Daniel@0 87 Agnodeinfo_t u;
Daniel@0 88 };
Daniel@0 89
Daniel@0 90 struct Agedge_t {
Daniel@0 91 int tag:4;
Daniel@0 92 int printkey:4;
Daniel@0 93 int handle:24;
Daniel@0 94 char **attr;
Daniel@0 95 char *didset;
Daniel@0 96 Agnode_t *head, *tail;
Daniel@0 97 int id;
Daniel@0 98 Agedgeinfo_t u;
Daniel@0 99 };
Daniel@0 100
Daniel@0 101 struct Agdata_t { /* for main graph */
Daniel@0 102 Dict_t *node_dict;
Daniel@0 103 Agdict_t *nodeattr;
Daniel@0 104 Agdict_t *edgeattr;
Daniel@0 105 Agdict_t *globattr;
Daniel@0 106 int max_node_id, max_edge_id;
Daniel@0 107 };
Daniel@0 108
Daniel@0 109 struct Agsym_t {
Daniel@0 110 char *name, *value;
Daniel@0 111 int index;
Daniel@0 112 unsigned char printed;
Daniel@0 113 unsigned char fixed;
Daniel@0 114 };
Daniel@0 115
Daniel@0 116 struct Agdict_t {
Daniel@0 117 char *name;
Daniel@0 118 Dict_t *dict;
Daniel@0 119 Agsym_t **list;
Daniel@0 120 };
Daniel@0 121
Daniel@0 122 struct Agproto_t {
Daniel@0 123 Agnode_t *n;
Daniel@0 124 Agedge_t *e;
Daniel@0 125 Agproto_t *prev;
Daniel@0 126 };
Daniel@0 127
Daniel@0 128 #if _PACKAGE_ast
Daniel@0 129 _BEGIN_EXTERNS_ /* public data */
Daniel@0 130 #if _BLD_graph && defined(__EXPORT__)
Daniel@0 131 #define extern __EXPORT__
Daniel@0 132 #endif
Daniel@0 133 #if !_BLD_graph && defined(__IMPORT__) && 0
Daniel@0 134 #define extern __IMPORT__
Daniel@0 135 #endif
Daniel@0 136 #endif
Daniel@0 137
Daniel@0 138 /*visual studio*/
Daniel@0 139 #ifdef WIN32_DLL
Daniel@0 140 #ifndef GRAPH_EXPORTS
Daniel@0 141 #define extern __declspec(dllimport)
Daniel@0 142 #endif
Daniel@0 143 #endif
Daniel@0 144 /*end visual studio*/
Daniel@0 145 extern char *agstrcanon(char *, char *);
Daniel@0 146 extern char *agcanonical(char *);
Daniel@0 147 extern char *agcanon(char *);
Daniel@0 148 extern int aghtmlstr(char *s);
Daniel@0 149 extern char *agget(void *, char *);
Daniel@0 150 extern char *agxget(void *, int);
Daniel@0 151 extern int agset(void *, char *, char *);
Daniel@0 152 extern int agsafeset(void *, char *, char *, char*);
Daniel@0 153 extern int agxset(void *, int, char *);
Daniel@0 154 extern int agindex(void *, char *);
Daniel@0 155
Daniel@0 156 extern void aginitlib(int, int, int);
Daniel@0 157 extern Agraph_t *agopen(char *, int);
Daniel@0 158 extern Agraph_t *agsubg(Agraph_t *, char *);
Daniel@0 159 extern Agraph_t *agfindsubg(Agraph_t *, char *);
Daniel@0 160 extern void agclose(Agraph_t *);
Daniel@0 161 extern Agraph_t *agread(FILE *);
Daniel@0 162 extern Agraph_t *agread_usergets(FILE *, gets_f);
Daniel@0 163 extern void agreadline(int);
Daniel@0 164 extern void agsetfile(char *);
Daniel@0 165 extern Agraph_t *agmemread(char *);
Daniel@0 166 extern void agsetiodisc(
Daniel@0 167 char * (*myfgets) (char *s, int size, FILE *stream),
Daniel@0 168 size_t (*myfwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream),
Daniel@0 169 int (*myferror) (FILE *stream) );
Daniel@0 170 extern int agputs(const char *s, FILE *fp);
Daniel@0 171 extern int agputc(int c, FILE *fp);
Daniel@0 172 extern int agwrite(Agraph_t *, FILE *);
Daniel@0 173 extern int agerrors(void);
Daniel@0 174 extern Agraph_t *agprotograph(void);
Daniel@0 175 extern Agnode_t *agprotonode(Agraph_t *);
Daniel@0 176 extern Agedge_t *agprotoedge(Agraph_t *);
Daniel@0 177 extern Agraph_t *agusergraph(Agnode_t *);
Daniel@0 178 extern int agnnodes(Agraph_t *);
Daniel@0 179 extern int agnedges(Agraph_t *);
Daniel@0 180
Daniel@0 181 extern void aginsert(Agraph_t *, void *);
Daniel@0 182 extern void agdelete(Agraph_t *, void *);
Daniel@0 183 extern int agcontains(Agraph_t *, void *);
Daniel@0 184
Daniel@0 185 extern Agnode_t *agnode(Agraph_t *, char *);
Daniel@0 186 extern Agnode_t *agfindnode(Agraph_t *, char *);
Daniel@0 187 extern Agnode_t *agfstnode(Agraph_t *);
Daniel@0 188 extern Agnode_t *agnxtnode(Agraph_t *, Agnode_t *);
Daniel@0 189 extern Agnode_t *aglstnode(Agraph_t *);
Daniel@0 190 extern Agnode_t *agprvnode(Agraph_t *, Agnode_t *);
Daniel@0 191
Daniel@0 192 extern Agedge_t *agedge(Agraph_t *, Agnode_t *, Agnode_t *);
Daniel@0 193 extern Agedge_t *agfindedge(Agraph_t *, Agnode_t *, Agnode_t *);
Daniel@0 194 extern Agedge_t *agfstedge(Agraph_t *, Agnode_t *);
Daniel@0 195 extern Agedge_t *agnxtedge(Agraph_t *, Agedge_t *, Agnode_t *);
Daniel@0 196 extern Agedge_t *agfstin(Agraph_t *, Agnode_t *);
Daniel@0 197 extern Agedge_t *agnxtin(Agraph_t *, Agedge_t *);
Daniel@0 198 extern Agedge_t *agfstout(Agraph_t *, Agnode_t *);
Daniel@0 199 extern Agedge_t *agnxtout(Agraph_t *, Agedge_t *);
Daniel@0 200
Daniel@0 201 extern Agsym_t *agattr(void *, char *, char *);
Daniel@0 202 extern Agsym_t *agraphattr(Agraph_t *, char *, char *);
Daniel@0 203 extern Agsym_t *agnodeattr(Agraph_t *, char *, char *);
Daniel@0 204 extern Agsym_t *agedgeattr(Agraph_t *, char *, char *);
Daniel@0 205 extern Agsym_t *agfindattr(void *, char *);
Daniel@0 206 extern Agsym_t *agfstattr(void *);
Daniel@0 207 extern Agsym_t *agnxtattr(void *, Agsym_t *);
Daniel@0 208 extern Agsym_t *aglstattr(void *);
Daniel@0 209 extern Agsym_t *agprvattr(void *, Agsym_t *);
Daniel@0 210 extern int agcopyattr(void *, void *);
Daniel@0 211
Daniel@0 212 typedef enum { AGWARN, AGERR, AGMAX, AGPREV } agerrlevel_t;
Daniel@0 213 extern agerrlevel_t agerrno;
Daniel@0 214 extern void agseterr(agerrlevel_t);
Daniel@0 215 extern char *aglasterr(void);
Daniel@0 216 extern int agerr(agerrlevel_t level, char *fmt, ...);
Daniel@0 217 extern void agerrorf(const char *fmt, ...);
Daniel@0 218 extern void agwarningf(char *fmt, ...);
Daniel@0 219
Daniel@0 220 extern char *agstrdup(char *);
Daniel@0 221 extern char *agstrdup_html(char *s);
Daniel@0 222 extern void agstrfree(char *);
Daniel@0 223
Daniel@0 224 typedef enum { AGNODE = 1, AGEDGE, AGGRAPH } agobjkind_t;
Daniel@0 225 #define agobjkind(p) ((agobjkind_t)(((Agraph_t*)(p))->tag))
Daniel@0 226
Daniel@0 227 #define agmetanode(g) ((g)->meta_node)
Daniel@0 228
Daniel@0 229 #undef extern
Daniel@0 230 #if _PACKAGE_ast
Daniel@0 231 _END_EXTERNS_
Daniel@0 232 #endif
Daniel@0 233 #ifdef __cplusplus
Daniel@0 234 }
Daniel@0 235 #endif
Daniel@0 236 #endif /* _GRAPH_H */