#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include "graph.h"
Include dependency graph for libgraph.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | Agraphinfo_t |
struct | Agnodeinfo_t |
struct | Agedgeinfo_t |
struct | AG_s |
struct | objport_t |
struct | objlist_t |
struct | objstack_t |
Defines | |
#define | _LIBGRAPH_H 1 |
#define | EXTERN extern |
#define | NIL(t) ((t)0) |
#define | _BLD_graph 1 |
#define | offsetof(typ, fld) ((int)(&(((typ*)0)->fld))) |
#define | NOT(v) (!(v)) |
#define | FALSE 0 |
#define | TRUE NOT(FALSE) |
#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 |
Functions | |
void | ag_yyerror (char *) |
int | ag_yylex (void) |
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 *) |
char * | agstrdup_html (char *s) |
int | agtoken (char *) |
int | aglinenumber (void) |
void | agwredge (Agraph_t *, FILE *, Agedge_t *, int) |
void | agwrnode (Agraph_t *, FILE *, Agnode_t *, int, int) |
Variables | |
EXTERN struct AG_s | AG |
Dtdisc_t | agNamedisc |
Dtdisc_t | agNodedisc |
Dtdisc_t | agOutdisc |
Dtdisc_t | agIndisc |
Dtdisc_t | agEdgedisc |
#define _BLD_graph 1 |
Definition at line 59 of file libgraph.h.
#define _LIBGRAPH_H 1 |
Definition at line 23 of file libgraph.h.
#define AGFLAG_METAGRAPH (1<<2) |
Definition at line 116 of file libgraph.h.
#define AGFLAG_STRICT (1<<1) |
Definition at line 115 of file libgraph.h.
#define ALLOC | ( | size, | |||
ptr, | |||||
type | ) | (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type))) |
Definition at line 95 of file libgraph.h.
#define EXTERN extern |
Definition at line 38 of file libgraph.h.
#define FALSE 0 |
Definition at line 88 of file libgraph.h.
#define HEADX 2 |
Definition at line 122 of file libgraph.h.
#define ISALNUM | ( | c | ) | ((isalnum(c)) || ((c) == '_') || (!isascii(c))) |
Definition at line 100 of file libgraph.h.
#define ISEMPTYSTR | ( | s | ) | (((s) == NULL) || (*(s) == '\0')) |
Definition at line 106 of file libgraph.h.
#define KEY_ID "key" |
Definition at line 119 of file libgraph.h.
#define KEYX 0 |
#define MAX | ( | a, | |||
b | ) | ((a)>(b)?(a):(b)) |
Definition at line 97 of file libgraph.h.
#define METAGRAPH (AGFLAG_DIRECTED | AGFLAG_STRICT | AGFLAG_METAGRAPH) |
Definition at line 117 of file libgraph.h.
#define MIN | ( | a, | |||
b | ) | ((a)<(b)?(a):(b)) |
Definition at line 96 of file libgraph.h.
#define MULTIPLE 1 |
#define MUSTPRINT 2 |
#define N_NEW | ( | n, | |||
t | ) | (t*)calloc((n),sizeof(t)) |
Definition at line 94 of file libgraph.h.
#define NEW | ( | t | ) | (t*)calloc(1,sizeof(t)) |
Definition at line 93 of file libgraph.h.
#define NIL | ( | t | ) | ((t)0) |
Definition at line 42 of file libgraph.h.
#define NOPRINT 0 |
#define NOT | ( | v | ) | (!(v)) |
Definition at line 85 of file libgraph.h.
#define NULL_FN | ( | t | ) | (t(*)())0 |
Definition at line 107 of file libgraph.h.
#define offsetof | ( | typ, | |||
fld | ) | ((int)(&(((typ*)0)->fld))) |
Definition at line 81 of file libgraph.h.
#define SMALLBUF 128 |
Definition at line 98 of file libgraph.h.
#define TAG_EDGE 2 |
Definition at line 111 of file libgraph.h.
Referenced by agcontains(), agcopyattr(), agdelete(), agdictof(), aginsert(), agNEWedge(), agparse(), and agsafeset().
#define TAG_GRAPH 3 |
Definition at line 112 of file libgraph.h.
Referenced by agclose(), agcontains(), agdelete(), agdictof(), aginsert(), agparse(), and agsafeset().
#define TAG_NODE 1 |
Definition at line 110 of file libgraph.h.
Referenced by agcontains(), agdelete(), agdictof(), aginsert(), agNEWnode(), agparse(), and agsafeset().
#define TAG_OF | ( | p | ) | (((Agraph_t*)(p))->tag) |
Definition at line 113 of file libgraph.h.
Referenced by agclose(), agcontains(), agcopyattr(), agdelete(), agdictof(), agFREEedge(), agFREEnode(), aginsert(), and agsafeset().
#define TAILX 1 |
Definition at line 121 of file libgraph.h.
#define TRUE NOT(FALSE) |
Definition at line 91 of file libgraph.h.
#define ZFREE | ( | p | ) | if (p) free(p); |
Definition at line 108 of file libgraph.h.
void ag_yyerror | ( | char * | ) |
int ag_yylex | ( | void | ) |
Definition at line 107 of file graph.c.
References Agedge_t::head, Agnode_t::id, and Agedge_t::tail.
Definition at line 123 of file graph.c.
References Agedge_t::head, Agnode_t::id, and Agedge_t::tail.
Definition at line 264 of file attribs.c.
References agNEWsym(), Agdict_t::dict, dtsize(), Agsym_t::fixed, Agdict_t::list, Agsym_t::name, Agsym_t::printed, and Agsym_t::value.
Definition at line 281 of file edge.c.
References AG_IS_METAGRAPH, agDELedge(), AGERR, agerr(), agFREEedge(), agfstout(), agnxtout(), agusergraph(), dtdelete, dtsearch, dtwalk(), FALSE, Agnode_t::graph, Agedge_t::head, Agraph_t::inedges, Agraph_t::meta_node, NIL, NULL, Agraph_t::outedges, and Agraph_t::root.
Referenced by agDELedge(), agdelete(), and agDELnode().
Definition at line 68 of file node.c.
References AG_IS_METAGRAPH, agDELedge(), agDELnode(), agFREEnode(), agfstedge(), agfstout(), agnxtedge(), agnxtout(), agusergraph(), dtdelete, dtsearch, FALSE, Agnode_t::graph, Agedge_t::head, Agraph_t::meta_node, Agraph_t::nodes, and Agraph_t::root.
Referenced by agclose(), agdelete(), and agDELnode().
Agdict_t* agdictof | ( | void * | ) |
Definition at line 26 of file attribs.c.
References NULL, TAG_EDGE, TAG_GRAPH, TAG_NODE, and TAG_OF.
Referenced by agcopyattr(), agfindattr(), agFREEedge(), and agFREEnode().
void agerror | ( | char * | ) |
Definition at line 473 of file lexer.c.
References AG, AGERR, agerr(), InfileName, Line_number, and AG_s::syntax_errors.
Referenced by agparse().
Definition at line 226 of file attribs.c.
References Agdict_t::dict, dtclose(), free(), and Agdict_t::list.
void agFREEedge | ( | Agedge_t * | ) |
Definition at line 266 of file edge.c.
References agdictof(), agstrfree(), Agedge_t::attr, Agdict_t::dict, Agedge_t::didset, dtsize(), Agdata_t::edgeattr, free(), Agnode_t::graph, TAG_OF, Agedge_t::tail, and Agraph_t::univ.
Referenced by agDELedge(), and agpopproto().
void agFREEnode | ( | Agnode_t * | ) |
Definition at line 136 of file node.c.
References AG_IS_METAGRAPH, agdictof(), agstrfree(), Agnode_t::attr, Agdict_t::dict, Agnode_t::didset, dtdelete, dtsize(), FALSE, free(), Agnode_t::graph, Agnode_t::name, Agdata_t::node_dict, Agdata_t::nodeattr, TAG_OF, and Agraph_t::univ.
Referenced by agDELnode(), and agpopproto().
Definition at line 35 of file node.c.
References dtmatch, and Agraph_t::nodes.
Referenced by agcontains(), and agINSnode().
void aginitlib | ( | int | , | |
int | , | |||
int | ||||
) |
Definition at line 292 of file attribs.c.
References AG, agerr(), AGWARN, AG_s::edge_nbytes, AG_s::graph_nbytes, AG_s::init_called, AG_s::node_nbytes, NULL, AG_s::proto_g, and TRUE.
Definition at line 92 of file edge.c.
References MULTIPLE, MUSTPRINT, and Agedge_t::printkey.
Referenced by agedge(), and aginsert().
Definition at line 334 of file graph.c.
References agedge(), FALSE, Agnode_t::graph, and Agraph_t::meta_node.
Referenced by aginsert(), and agsubg().
Definition at line 53 of file node.c.
References AG_IS_METAGRAPH, agfstin(), agidnode(), agINSnode(), agnxtin(), agusergraph(), dtinsert, FALSE, Agnode_t::graph, Agnode_t::id, Agraph_t::meta_node, Agraph_t::nodes, and Agedge_t::tail.
Referenced by aginsert(), agINSnode(), and agnode().
int aglex | ( | void | ) |
Definition at line 370 of file lexer.c.
References AG_s::accepting_state, AG, agerr(), aglval, agstrdup(), agstrdup_html(), agtoken(), AGWARN, agxbfree(), agxbinit(), agxbuse, AG_s::edge_op, FALSE, Line_number, NULL, YYSTYPE::str, T_edgeop, T_qsymbol, and T_symbol.
Referenced by myaglex().
void aglexinit | ( | FILE * | , | |
gets_f | mygets | |||
) |
Definition at line 76 of file lexer.c.
References AG, AG_s::linebuf, N_NEW, and NULL.
Referenced by agmemread(), agread(), and agread_usergets().
int aglinenumber | ( | void | ) |
Agdict_t* agNEWdict | ( | char * | ) |
Definition at line 242 of file attribs.c.
References Agdict_t::dict, dtopen(), Dttree, Agdict_t::list, Agdict_t::name, NEW, NULL, and offsetof.
Definition at line 198 of file edge.c.
References AG, agstrdup(), Agedge_t::attr, Agdict_t::dict, Agedge_t::didset, dtsize(), AG_s::edge_nbytes, Agdata_t::edgeattr, head, Agedge_t::head, Agedge_t::id, Agdata_t::max_edge_id, N_NEW, NULL, Agedge_t::tag, TAG_EDGE, Agedge_t::tail, and Agraph_t::univ.
Referenced by agedge().
Definition at line 111 of file node.c.
References AG, agstrdup(), Agnode_t::attr, Agdict_t::dict, Agnode_t::didset, dtsize(), Agnode_t::graph, Agnode_t::id, Agdict_t::list, Agdata_t::max_node_id, N_NEW, Agnode_t::name, AG_s::node_nbytes, Agdata_t::nodeattr, NULL, Agraph_t::root, objstack_t::subg, Agnode_t::tag, TAG_NODE, Agraph_t::univ, and Agsym_t::value.
Referenced by agnode().
Definition at line 44 of file attribs.c.
References agstrdup(), ALLOC, Agdict_t::dict, dtinsert, dtsize(), Agsym_t::index, Agdict_t::list, Agsym_t::name, NEW, NULL, Agsym_t::printed, TRUE, and Agsym_t::value.
Referenced by agcopydict().
int agparse | ( | void | ) |
Definition at line 1449 of file parser.c.
References AG_s::accepting_state, AG, agclose(), AGDIGRAPH, AGDIGRAPHSTRICT, agerror(), agfindsubg(), aginsert(), aglval, AGRAPH, AGRAPHSTRICT, agstrfree(), agsubg(), agtoken(), agalloc::agvs, Agproto_t::e, AG_s::edge_op, FALSE, YYSTYPE::n, Agproto_t::n, NULL, YYSTYPE::obj, objport_t::obj, AG_s::parsed_g, objport_t::port, Agraph_t::proto, YYSTYPE::str, str, objstack_t::subg, TAG_EDGE, TAG_GRAPH, TAG_NODE, TRUE, YY_, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, YYDPRINTF, YYEMPTY, YYEOF, YYFINAL, YYID, YYINITDEPTH, YYLAST, YYLEX, YYMAXDEPTH, YYNTOKENS, YYPACT_NINF, YYPOPSTACK, YYSIZE_T, YYSTACK_ALLOC, YYSTACK_ALLOC_MAXIMUM, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, YYTABLE_NINF, YYTERROR, and YYTRANSLATE.
Referenced by agmemread(), agread(), and agread_usergets().
void agpopproto | ( | Agraph_t * | ) |
Definition at line 186 of file graph.c.
References agFREEedge(), agFREEnode(), Agproto_t::e, free(), Agedge_t::head, Agproto_t::n, NULL, Agproto_t::prev, Agraph_t::proto, and Agedge_t::tail.
Referenced by agclose().
void agpushproto | ( | Agraph_t * | ) |
int agtoken | ( | char * | ) |
Definition at line 324 of file graphio.c.
References AGFLAG_DIRECTED, agget(), Agedge_t::attr, Agdict_t::dict, dtsize(), Agproto_t::e, Agdata_t::edgeattr, FALSE, Agnode_t::graph, Agedge_t::head, HEADX, KEYX, Agraph_t::kind, Agdict_t::list, MUSTPRINT, Agsym_t::name, Agnode_t::name, Agsym_t::printed, Agedge_t::printkey, Agraph_t::proto, Agraph_t::root, Agedge_t::tail, TAILX, Agraph_t::univ, and Agsym_t::value.
Definition at line 259 of file graphio.c.
References agcanonical(), agfstin(), agfstout(), agget(), Agdict_t::dict, dtsize(), FALSE, Agnode_t::graph, Agdict_t::list, Agproto_t::n, Agnode_t::name, Agsym_t::name, Agdata_t::nodeattr, NULL, Agsym_t::printed, Agraph_t::proto, TRUE, Agraph_t::univ, and Agsym_t::value.
Referenced by agedgeattr(), agerror(), agerrors(), aginitlib(), aglex(), aglexinit(), agmemread(), agNEWedge(), agNEWnode(), agnodeattr(), agparse(), agprotograph(), agraphattr(), agread(), and agread_usergets().