/misc/src/release/graphviz-2.18-1/src/graphviz-2.18/lib/graph/libgraph.h

Go to the documentation of this file.
00001 /* $Id: libgraph.h,v 1.7 2008/03/08 18:26:30 ellson Exp $ $Revision: 1.7 $ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /**********************************************************
00005 *      This software is part of the graphviz package      *
00006 *                http://www.graphviz.org/                 *
00007 *                                                         *
00008 *            Copyright (c) 1994-2004 AT&T Corp.           *
00009 *                and is licensed under the                *
00010 *            Common Public License, Version 1.0           *
00011 *                      by AT&T Corp.                      *
00012 *                                                         *
00013 *        Information and Software Systems Research        *
00014 *              AT&T Research, Florham Park NJ             *
00015 **********************************************************/
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 
00022 #ifndef _LIBGRAPH_H
00023 #define _LIBGRAPH_H 1
00024 
00025 #if _PACKAGE_ast
00026 #include    <ast.h>
00027 #else
00028 #include <string.h>
00029 #include <stdlib.h>
00030 #ifndef MSWIN32
00031 #include <unistd.h>
00032 #endif
00033 #endif
00034 #include <ctype.h>
00035 
00036 
00037 #ifndef EXTERN
00038 #define EXTERN extern
00039 #endif
00040 
00041 #ifndef NIL
00042 #define NIL(t)  ((t)0)
00043 #endif
00044 
00045     void ag_yyerror(char *);
00046     int ag_yylex(void);
00047 
00048     typedef struct Agraphinfo_t {
00049         char notused;
00050     } Agraphinfo_t;
00051     typedef struct Agnodeinfo_t {
00052         char notused;
00053     } Agnodeinfo_t;
00054     typedef struct Agedgeinfo_t {
00055         char notused;
00056     } Agedgeinfo_t;
00057 
00058 #ifndef _BLD_graph
00059 #define _BLD_graph 1
00060 #endif
00061 
00062 #ifdef HAVE_CONFIG_H
00063 #include "config.h"
00064 #endif
00065 
00066 #include "graph.h"
00067 
00068 #ifdef HAVE_STDINT_H
00069 #include <stdint.h>
00070 #endif
00071 #ifdef HAVE_INTTYPES_H
00072 #include <inttypes.h>
00073 #endif
00074 
00075 #ifdef offsetof
00076 #undef offsetof
00077 #endif
00078 #ifdef HAVE_INTPTR_T
00079 #define offsetof(typ,fld)  ((intptr_t)(&(((typ*)0)->fld)))
00080 #else
00081 #define offsetof(typ,fld)  ((int)(&(((typ*)0)->fld)))
00082 #endif
00083 
00084 #ifndef NOT
00085 #define NOT(v)          (!(v))
00086 #endif
00087 #ifndef FALSE
00088 #define FALSE           0
00089 #endif
00090 #ifndef TRUE
00091 #define TRUE            NOT(FALSE)
00092 #endif
00093 #define NEW(t)           (t*)calloc(1,sizeof(t))
00094 #define N_NEW(n,t)       (t*)calloc((n),sizeof(t))
00095 #define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type)))
00096 #define MIN(a,b)        ((a)<(b)?(a):(b))
00097 #define MAX(a,b)        ((a)>(b)?(a):(b))
00098 #define SMALLBUF        128
00099 
00100 #define ISALNUM(c) ((isalnum(c)) || ((c) == '_') || (!isascii(c)))
00101 
00102 #define NOPRINT         0
00103 #define MULTIPLE    1
00104 #define MUSTPRINT       2
00105 
00106 #define ISEMPTYSTR(s)   (((s) == NULL) || (*(s) == '\0'))
00107 #define NULL_FN(t)              (t(*)())0
00108 #define ZFREE(p)                if (p) free(p);
00109 
00110 #define TAG_NODE                        1
00111 #define TAG_EDGE                        2
00112 #define TAG_GRAPH                       3
00113 #define TAG_OF(p)                       (((Agraph_t*)(p))->tag)
00114 
00115 #define AGFLAG_STRICT           (1<<1)
00116 #define AGFLAG_METAGRAPH        (1<<2)
00117 #define METAGRAPH                       (AGFLAG_DIRECTED | AGFLAG_STRICT | AGFLAG_METAGRAPH)
00118 
00119 #define KEY_ID                          "key"
00120 #define KEYX                            0
00121 #define TAILX                           1
00122 #define HEADX                           2
00123 
00124     EXTERN struct AG_s {
00125         int graph_nbytes, node_nbytes, edge_nbytes;
00126         Agraph_t *proto_g, *parsed_g;
00127         char *edge_op;
00128         char *linebuf;
00129         short syntax_errors;
00130         unsigned char accepting_state, init_called;
00131     } AG;
00132 
00133 /* follow structs used in graph parser */
00134     typedef struct objport_t {
00135         void *obj;
00136         char *port;
00137     } objport_t;
00138 
00139     typedef struct objlist_t {
00140         objport_t data;
00141         struct objlist_t *link;
00142     } objlist_t;
00143 
00144     typedef struct objstack_t {
00145         Agraph_t *subg;
00146         objlist_t *list, *last;
00147         int in_edge_stmt;
00148         struct objstack_t *link;
00149     } objstack_t;
00150 
00151     Agdict_t *agdictof(void *);
00152     Agnode_t *agidnode(Agraph_t *, int);
00153     Agdict_t *agNEWdict(char *);
00154     Agedge_t *agNEWedge(Agraph_t *, Agnode_t *, Agnode_t *, Agedge_t *);
00155     Agnode_t *agNEWnode(Agraph_t *, char *, Agnode_t *);
00156     Agsym_t *agNEWsym(Agdict_t *, char *, char *);
00157     int agcmpid(Dt_t *, int *, int *, Dtdisc_t *);
00158     int agcmpin(Dt_t *, Agedge_t *, Agedge_t *, Dtdisc_t *);
00159     int agcmpout(Dt_t *, Agedge_t *, Agedge_t *, Dtdisc_t *);
00160     void agcopydict(Agdict_t *, Agdict_t *);
00161     void agDELedge(Agraph_t *, Agedge_t *);
00162     void agDELnode(Agraph_t *, Agnode_t *);
00163     void agerror(char *);
00164     void agFREEdict(Agraph_t *, Agdict_t *);
00165     void agFREEedge(Agedge_t *);
00166     void agFREEnode(Agnode_t *);
00167     void aginitlib(int, int, int);
00168     void agINSedge(Agraph_t *, Agedge_t *);
00169     void agINSgraph(Agraph_t *, Agraph_t *);
00170     void agINSnode(Agraph_t *, Agnode_t *);
00171     int aglex(void);
00172     void aglexinit(FILE *, gets_f mygets);
00173     int agparse(void);
00174     void agpopproto(Agraph_t *);
00175     void agpushproto(Agraph_t *);
00176     char *agstrdup_html(char *s);
00177     int agtoken(char *);
00178     int aglinenumber(void);
00179     void agwredge(Agraph_t *, FILE *, Agedge_t *, int);
00180     void agwrnode(Agraph_t *, FILE *, Agnode_t *, int, int);
00181     extern Dtdisc_t agNamedisc, agNodedisc, agOutdisc, agIndisc,
00182         agEdgedisc;
00183 
00184 #endif
00185 
00186 #ifdef __cplusplus
00187 }
00188 #endif

Generated on Mon Mar 31 19:03:26 2008 for Graphviz by  doxygen 1.5.1