File: libgraph.h

package info (click to toggle)
graphviz 2.26.3-5%2Bsqueeze2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 63,032 kB
  • ctags: 25,930
  • sloc: ansic: 212,134; sh: 20,316; cpp: 7,239; makefile: 4,211; yacc: 3,335; xml: 2,450; tcl: 1,900; cs: 1,890; objc: 1,149; perl: 829; lex: 363; awk: 171; python: 41; ruby: 35; php: 26
file content (191 lines) | stat: -rw-r--r-- 4,921 bytes parent folder | download | duplicates (3)
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
/* $Id: libgraph.h,v 1.15 2009/06/03 01:10:53 ellson Exp $ $Revision: 1.15 $ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifdef __cplusplus
extern "C" {
#endif


#ifndef _LIBGRAPH_H
#define _LIBGRAPH_H 1

#if _PACKAGE_ast
#include    <ast.h>
#else
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#if !defined(MSWIN32) && !defined(WIN32)
#include <unistd.h>
#endif
#endif
#include <ctype.h>


#ifndef EXTERN
#define EXTERN extern
#endif

#ifndef NIL
#define NIL(t)	((t)0)
#endif

    void ag_yyerror(char *);
    int ag_yylex(void);

    typedef struct Agraphinfo_t {
	char notused;
    } Agraphinfo_t;
    typedef struct Agnodeinfo_t {
	char notused;
    } Agnodeinfo_t;
    typedef struct Agedgeinfo_t {
	char notused;
    } Agedgeinfo_t;

#ifndef _BLD_graph
#define _BLD_graph 1
#endif

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "graph.h"

#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif

#ifdef offsetof
#undef offsetof
#endif
#ifdef HAVE_INTPTR_T
#define offsetof(typ,fld)  ((intptr_t)(&(((typ*)0)->fld)))
#else
#define offsetof(typ,fld)  ((int)(&(((typ*)0)->fld)))
#endif

#ifndef NOT
#define NOT(v)		(!(v))
#endif
#ifndef FALSE
#define	FALSE		0
#endif
#ifndef TRUE
#define TRUE		NOT(FALSE)
#endif
#define NEW(t)		 (t*)calloc(1,sizeof(t))
#define N_NEW(n,t)	 (t*)calloc((n),sizeof(t))
#define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type)))
#define MIN(a,b)	((a)<(b)?(a):(b))
#define MAX(a,b)	((a)>(b)?(a):(b))
#define SMALLBUF	128

#define ISALNUM(c) ((isalnum(c)) || ((c) == '_') || (!isascii(c)))

#define	NOPRINT		0
#define MULTIPLE    1
#define MUSTPRINT	2

#define ISEMPTYSTR(s) 	(((s) == NULL) || (*(s) == '\0'))
#define NULL_FN(t) 		(t(*)())0
#define ZFREE(p)		if (p) free(p);

#define	TAG_NODE			1
#define	TAG_EDGE			2
#define	TAG_GRAPH			3
#define TAG_OF(p)			(((Agraph_t*)(p))->tag)

#define AGFLAG_STRICT		(1<<1)
#define AGFLAG_METAGRAPH	(1<<2)
#define METAGRAPH			(AGFLAG_DIRECTED | AGFLAG_STRICT | AGFLAG_METAGRAPH)

#define KEY_ID				"key"
#define	KEYX				0
#define	TAILX				1
#define HEADX				2

    EXTERN struct AG_s {
	int graph_nbytes, node_nbytes, edge_nbytes;
	Agraph_t *proto_g, *parsed_g;
	char *edge_op;
	char *linebuf;
	short syntax_errors;
	unsigned char accepting_state, init_called;
	char * (*fgets) (char *s, int size, FILE *stream);
	size_t (*fwrite) (const void *ptr, size_t size, size_t nmemb, FILE *stream);
	int (*ferror) (FILE *stream);
    } AG;

/* follow structs used in graph parser */
    typedef struct objport_t {
	void *obj;
	char *port;
    } objport_t;

    typedef struct objlist_t {
	objport_t data;
	struct objlist_t *link;
    } objlist_t;

    typedef struct objstack_t {
	Agraph_t *subg;
	objlist_t *list, *last;
	int in_edge_stmt;
	struct objstack_t *link;
    } objstack_t;

    Agdict_t *agdictof(void *);
    Agnode_t *agidnode(Agraph_t *, int);
    Agdict_t *agNEWdict(char *);
    Agedge_t *agNEWedge(Agraph_t *, Agnode_t *, Agnode_t *, Agedge_t *);
    Agnode_t *agNEWnode(Agraph_t *, char *, Agnode_t *);
    Agsym_t *agNEWsym(Agdict_t *, char *, char *);
    int agcmpid(Dt_t *, int *, int *, Dtdisc_t *);
    int agcmpin(Dt_t *, Agedge_t *, Agedge_t *, Dtdisc_t *);
    int agcmpout(Dt_t *, Agedge_t *, Agedge_t *, Dtdisc_t *);
    void agcopydict(Agdict_t *, Agdict_t *);
    void agDELedge(Agraph_t *, Agedge_t *);
    void agDELnode(Agraph_t *, Agnode_t *);
    void agerror(char *);
    void agFREEdict(Agraph_t *, Agdict_t *);
    void agFREEedge(Agedge_t *);
    void agFREEnode(Agnode_t *);
    void aginitlib(int, int, int);
    void agINSedge(Agraph_t *, Agedge_t *);
    void agINSgraph(Agraph_t *, Agraph_t *);
    void agINSnode(Agraph_t *, Agnode_t *);
    int aglex(void);
    void aglexinit(FILE *, gets_f mygets);
    int agparse(void);
    void agpopproto(Agraph_t *);
    void agpushproto(Agraph_t *);
    int agtoken(char *);
    int aglinenumber(void);
    void agwredge(Agraph_t *, FILE *, Agedge_t *, int);
    void agwrnode(Agraph_t *, FILE *, Agnode_t *, int, int);
    extern Dtdisc_t agNamedisc, agNodedisc, agOutdisc, agIndisc,
	agEdgedisc;

#endif

#ifdef __cplusplus
}
#endif