~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to graph/graph.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This software may only be used by you under license from AT&T Corp.
 
3
    ("AT&T").  A copy of AT&T's Source Code Agreement is available at
 
4
    AT&T's Internet website having the URL:
 
5
    <http://www.research.att.com/sw/tools/graphviz/license/source.html>
 
6
    If you received this software without first entering into a license
 
7
    with AT&T, you have an infringing copy of this software and cannot use
 
8
    it without violating AT&T's intellectual property rights.
 
9
*/
 
10
 
 
11
#pragma prototyped
 
12
 
 
13
#ifndef _GRAPH_H
 
14
#define _GRAPH_H 1
 
15
 
 
16
#if _PACKAGE_ast
 
17
#include    <ast.h>
 
18
#else
 
19
#include <sys/types.h>
 
20
#include <stdlib.h>
 
21
#endif
 
22
#include <stdio.h>
 
23
#include <cdt.h>
 
24
 
 
25
typedef struct Agraph_t         Agraph_t;
 
26
typedef struct Agnode_t         Agnode_t;
 
27
typedef struct Agedge_t         Agedge_t;
 
28
typedef struct Agdict_t         Agdict_t;
 
29
typedef struct Agsym_t          Agsym_t;
 
30
typedef struct Agdata_t         Agdata_t;
 
31
typedef struct Agproto_t        Agproto_t;
 
32
 
 
33
typedef char * (*gets_f)(char *ubuf, int n, FILE *fp);
 
34
 
 
35
#define AGFLAG_DIRECTED         (1<<0)
 
36
#define AGFLAG_STRICT           (1<<1)
 
37
#define AGFLAG_METAGRAPH        (1<<2)
 
38
 
 
39
#define AGRAPH                          0
 
40
#define AGRAPHSTRICT            (AGRAPH | AGFLAG_STRICT)
 
41
#define AGDIGRAPH                       AGFLAG_DIRECTED
 
42
#define AGDIGRAPHSTRICT         (AGDIGRAPH | AGFLAG_STRICT)
 
43
#define AGMETAGRAPH                     (AGFLAG_DIRECTED | AGFLAG_STRICT | AGFLAG_METAGRAPH)
 
44
 
 
45
#define AG_IS_DIRECTED(g)       ((g)->kind & AGFLAG_DIRECTED)
 
46
#define AG_IS_STRICT(g)         ((g)->kind & AGFLAG_STRICT)
 
47
#define AG_IS_METAGRAPH(g)      ((g)->kind & AGFLAG_METAGRAPH)
 
48
#define aginit()                        aginitlib(sizeof(Agraph_t),sizeof(Agnode_t),sizeof(Agedge_t))
 
49
 
 
50
struct Agraph_t {
 
51
        int                             tag : 4;
 
52
        int                             kind : 4;
 
53
        int                             handle: 24;
 
54
        char                    **attr;
 
55
        char                    *name;
 
56
        Agdata_t                *univ;
 
57
        Dict_t                  *nodes,*inedges,*outedges;
 
58
        Agraph_t                *root;
 
59
        Agnode_t                *meta_node;
 
60
        Agproto_t               *proto;
 
61
        Agraphinfo_t    u;
 
62
};
 
63
 
 
64
struct Agnode_t {
 
65
        int                             tag : 4;
 
66
        int                             pad : 4;
 
67
        int                             handle: 24;
 
68
        char                    **attr;
 
69
        char                    *name;
 
70
        int                             id;
 
71
        Agraph_t                *graph;
 
72
        Agnodeinfo_t    u;
 
73
};
 
74
 
 
75
struct Agedge_t {
 
76
        int                             tag : 4;
 
77
        int                             printkey : 4;
 
78
        int                             handle: 24;
 
79
        char                    **attr;
 
80
        Agnode_t                *head,*tail;
 
81
        int                             id;
 
82
        Agedgeinfo_t    u;
 
83
};
 
84
 
 
85
struct Agdata_t {                               /* for main graph */
 
86
        Dict_t                  *node_dict;
 
87
        Agdict_t                *nodeattr;
 
88
        Agdict_t                *edgeattr;
 
89
        Agdict_t                *globattr;
 
90
        int                             max_node_id, max_edge_id;
 
91
};
 
92
 
 
93
struct Agsym_t {
 
94
        char                    *name,*value;
 
95
        int                             index;
 
96
        unsigned char   printed;
 
97
};
 
98
 
 
99
struct Agdict_t  {
 
100
        char                    *name;
 
101
        Dict_t                  *dict;
 
102
        Agsym_t                 **list;
 
103
};
 
104
 
 
105
struct Agproto_t {
 
106
        Agnode_t                *n;
 
107
        Agedge_t                *e;
 
108
        Agproto_t               *prev;
 
109
};
 
110
 
 
111
#if _PACKAGE_ast
 
112
_BEGIN_EXTERNS_ /* public data */
 
113
#if _BLD_graph && defined(__EXPORT__)
 
114
#define extern  __EXPORT__
 
115
#endif
 
116
#if !_BLD_graph && defined(__IMPORT__)
 
117
#define extern  __IMPORT__
 
118
#endif
 
119
#endif
 
120
 
 
121
extern char             *agstrcanon(char        *,      char    *);
 
122
extern char             *agget(void*,   char    *);
 
123
extern char             *agxget(void*,  int);
 
124
extern void             agset(void*,    char    *,      char    *);
 
125
extern void             agxset(void*,   int,    char    *);
 
126
extern int              agindex(void*,  char    *);
 
127
 
 
128
extern void     aginitlib(int,  int,    int);  
 
129
extern Agraph_t *agopen(char    *,      int);
 
130
extern Agraph_t *agsubg(Agraph_t        *,      char    *);
 
131
extern Agraph_t *agfindsubg(Agraph_t    *,      char    *);
 
132
extern void             agclose(Agraph_t        *);
 
133
extern Agraph_t *agread(FILE    *);
 
134
extern Agraph_t *agread_usergets(FILE   *, gets_f);
 
135
extern Agraph_t *agmemread(char         *);
 
136
extern int              agwrite(Agraph_t        *,      FILE    *);
 
137
extern int              agerrors(void);
 
138
extern Agraph_t *agusergraph(Agnode_t   *);
 
139
extern int              agnnodes(Agraph_t       *);
 
140
extern int              agnedges(Agraph_t       *);
 
141
 
 
142
extern void             aginsert(Agraph_t       *,      void*);
 
143
extern void             agdelete(Agraph_t       *,      void*);
 
144
extern int              agcontains(Agraph_t     *,      void*);
 
145
 
 
146
extern Agnode_t *agnode(Agraph_t        *,      char    *);
 
147
extern Agsym_t  *agnodeattr(Agraph_t    *,      char    *,      char    *);
 
148
extern Agnode_t *agfindnode(Agraph_t    *,      char    *);
 
149
extern Agnode_t *agfstnode(Agraph_t     *);
 
150
extern Agnode_t *agnxtnode(Agraph_t     *,      Agnode_t        *);
 
151
 
 
152
extern Agedge_t *agedge(Agraph_t        *,      Agnode_t        *,      Agnode_t        *);
 
153
extern Agsym_t  *agedgeattr(Agraph_t    *,      char    *,      char    *);
 
154
extern Agedge_t *agfindedge(Agraph_t    *,      Agnode_t        *,      Agnode_t        *);
 
155
extern Agedge_t *agfstedge(Agraph_t     *,      Agnode_t        *);
 
156
extern Agedge_t *agnxtedge(Agraph_t     *,      Agedge_t        *,      Agnode_t        *);
 
157
extern Agedge_t *agfstin(Agraph_t       *,      Agnode_t        *);
 
158
extern Agedge_t *agnxtin(Agraph_t       *,      Agedge_t        *);
 
159
extern Agedge_t *agfstout(Agraph_t      *,      Agnode_t        *);
 
160
extern Agedge_t *agnxtout(Agraph_t      *,      Agedge_t        *);
 
161
 
 
162
extern Agsym_t  *agraphattr(Agraph_t    *,      char    *,      char    *);
 
163
extern Agsym_t  *agnodeattr(Agraph_t    *,      char    *,      char    *);
 
164
extern Agsym_t  *agedgeattr(Agraph_t    *,      char    *,      char    *);
 
165
extern Agsym_t  *agfindattr(void*,      char    *);
 
166
 
 
167
#undef extern
 
168
#if _PACKAGE_ast
 
169
_END_EXTERNS_
 
170
#endif
 
171
 
 
172
#endif  /* _GRAPH_H */