Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
gmlparse.y File Reference
#include <stdlib.h>
#include <string.h>
#include <arith.h>
#include <gml2gv.h>
#include <agxbuf.h>
#include <assert.h>
#include <cgraph/alloc.h>
#include <cgraph/exit.h>
#include <cgraph/stack.h>

Go to the source code of this file.

Functions

static void free_attr (void *attr)
 
static void deparseList (Dt_t *alist, agxbuf *xb)
 
static void deparseAttr (gmlattr *ap, agxbuf *xb)
 
static void unknown (Agobj_t *obj, gmlattr *ap, agxbuf *xb)
 
static void addNodeLabelGraphics (Agnode_t *np, Dt_t *alist, agxbuf *unk)
 
static void addEdgeLabelGraphics (Agedge_t *ep, Dt_t *alist, agxbuf *xb, agxbuf *unk)
 
static void addNodeGraphics (Agnode_t *np, Dt_t *alist, agxbuf *xb, agxbuf *unk)
 
static void addEdgePoint (Agedge_t *ep, Dt_t *alist, agxbuf *xb)
 
static void addEdgePos (Agedge_t *ep, Dt_t *alist, agxbuf *xb)
 
static void addEdgeGraphics (Agedge_t *ep, Dt_t *alist, agxbuf *xb, agxbuf *unk)
 
static void addAttrs (Agobj_t *obj, Dt_t *alist, agxbuf *xb, agxbuf *unk)
 
static Agraph_tmkGraph (gmlgraph *graph, Agraph_t *parent, char *name, agxbuf *xb, agxbuf *unk)
 
Agraph_tgml_to_gv (char *name, FILE *fp, int cnt, int *errors)
 
static char * sortToStr (unsigned short sort)
 

Variables

require define api prefix
 
hdr __pad0__
 
body __pad1__
 
optglist __pad2__
 
glist __pad3__
 
glistitem __pad4__
 
glistitem $1
 
 edge { dtinsert (G->edgelist, $1)
 
hdr body DIRECTED INTEGER
 
node __pad5__
 
 N = NULL
 
nlist __pad6__
 
nlistitem __pad7__
 
 alistitem { dtinsert (N->attrlist, $1)
 
edge __pad8__
 
 E = NULL
 
elist __pad9__
 
elistitem __pad10__
 
attrlist __pad11__
 
 optalist { $$ = popAlist()
 
optalist __pad12__
 
alist __pad13__
 
alist $2
 
alistitem __pad14__
 
alistitem NAME REAL { $$ = mkAttr ($1, 0, REAL, $2, 0)
 
NAME STRING { $$ = mkAttr ($1, 0, STRING, $2, 0)
 
NAME attrlist { $$ = mkAttr ($1, 0, LIST, 0, $2)
 

Function Documentation

◆ addAttrs()

static void addAttrs ( Agobj_t obj,
Dt_t alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 651 of file gmlparse.y.

References addEdgeGraphics(), addEdgeLabelGraphics(), addNodeGraphics(), addNodeLabelGraphics(), AGEDGE, AGNODE, AGRAPH, agsafeset(), AGTYPE, dtfirst, dtnext, GRAPHICS, LABEL, LABELGRAPHICS, gmlattr::lp, gmlattr::sort, gmlattr::u, unknown, and gmlattr::value.

Referenced by mkGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEdgeGraphics()

static void addEdgeGraphics ( Agedge_t ep,
Dt_t alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 613 of file gmlparse.y.

References addEdgePos(), agsafeset(), agxbclear(), agxbput(), agxbputc(), agxbuse(), cnt(), deparseAttr(), dtfirst, dtnext, FILL, LINE, gmlattr::lp, gmlattr::sort, STYLE, gmlattr::u, gmlattr::value, and WIDTH.

Referenced by addAttrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEdgeLabelGraphics()

static void addEdgeLabelGraphics ( Agedge_t ep,
Dt_t alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 455 of file gmlparse.y.

References agsafeset(), agxbclear(), agxbprint(), agxbput(), agxbputc(), agxbuse(), cnt(), COLOR, deparseAttr(), dtfirst, dtnext, FONTNAME, FONTSIZE, gmlattr::sort, TEXT, gmlattr::u, gmlattr::value, XVAL, and YVAL.

Referenced by addAttrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEdgePoint()

static void addEdgePoint ( Agedge_t ep,
Dt_t alist,
agxbuf xb 
)
static

Definition at line 571 of file gmlparse.y.

References agxblen(), agxbprint(), agxbputc(), dtfirst, dtnext, gmlattr::sort, gmlattr::u, unknown, gmlattr::value, XVAL, and YVAL.

Referenced by addEdgePos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEdgePos()

static void addEdgePos ( Agedge_t ep,
Dt_t alist,
agxbuf xb 
)
static

Definition at line 595 of file gmlparse.y.

References addEdgePoint(), agsafeset(), agxbuse(), dtfirst, dtnext, gmlattr::lp, POINT, gmlattr::sort, gmlattr::u, and unknown.

Referenced by addEdgeGraphics().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addNodeGraphics()

static void addNodeGraphics ( Agnode_t np,
Dt_t alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 507 of file gmlparse.y.

References agsafeset(), agxbclear(), agxbprint(), agxbput(), agxbputc(), agxbuse(), cnt(), deparseAttr(), dtfirst, dtnext, FILL, HVAL, OUTLINE, OUTLINESTYLE, OUTLINEWIDTH, gmlattr::sort, STYLE, TYPE, gmlattr::u, gmlattr::value, WIDTH, WVAL, XVAL, and YVAL.

Referenced by addAttrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addNodeLabelGraphics()

static void addNodeLabelGraphics ( Agnode_t np,
Dt_t alist,
agxbuf unk 
)
static

Definition at line 415 of file gmlparse.y.

References agsafeset(), agxbclear(), agxbput(), agxbputc(), agxbuse(), cnt(), COLOR, deparseAttr(), dtfirst, dtnext, FONTNAME, FONTSIZE, gmlattr::sort, TEXT, gmlattr::u, and gmlattr::value.

Referenced by addAttrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deparseAttr()

static void deparseAttr ( gmlattr ap,
agxbuf xb 
)
static

Definition at line 372 of file gmlparse.y.

References agxbprint(), deparseList(), gmlattr::kind, LIST, gmlattr::lp, gmlattr::name, STRING, gmlattr::u, and gmlattr::value.

Referenced by addEdgeGraphics(), addEdgeLabelGraphics(), addNodeGraphics(), addNodeLabelGraphics(), and deparseList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deparseList()

static void deparseList ( Dt_t alist,
agxbuf xb 
)
static

Definition at line 387 of file gmlparse.y.

References agxbput(), agxbputc(), deparseAttr(), dtfirst, and dtnext.

Referenced by deparseAttr(), and unknown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_attr()

static void free_attr ( void *  attr)
static

Definition at line 358 of file gmlparse.y.

References dtclose(), free(), gmlattr::kind, LIST, gmlattr::lp, gmlattr::name, gmlattr::u, and gmlattr::value.

Here is the call graph for this function:

◆ gml_to_gv()

Agraph_t * gml_to_gv ( char *  name,
FILE *  fp,
int  cnt,
int *  errors 
)

Definition at line 734 of file gmlparse.y.

References agxbfree(), cleanup(), cnt(), error(), errors, G, G, gmlerrors(), gmlparse(), initgmlscan(), L, mkGraph(), mkGraph(), NULL, and pushAlist().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkGraph()

static Agraph_t * mkGraph ( gmlgraph graph,
Agraph_t parent,
char *  name,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 680 of file gmlparse.y.

References addAttrs(), Agdirected, agedge(), agnode(), agopen(), agsubg(), Agundirected, gmlnode::attrlist, gmledge::attrlist, dtfirst, dtnext, graph(), graphviz_exit(), gmlnode::id, L, mkGraph(), NULL, parent, gmledge::source, and gmledge::target.

Referenced by gml_to_gv(), and mkGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortToStr()

static char * sortToStr ( unsigned short  sort)
static

◆ unknown()

static void unknown ( Agobj_t obj,
gmlattr ap,
agxbuf xb 
)
static

Definition at line 401 of file gmlparse.y.

References agsafeset(), agxbuse(), deparseList(), gmlattr::kind, LIST, gmlattr::lp, gmlattr::name, str, gmlattr::u, and gmlattr::value.

Here is the call graph for this function:

Variable Documentation

◆ $1

glistitem $1

Definition at line 278 of file gmlparse.y.

Referenced by if().

◆ $2

Definition at line 323 of file gmlparse.y.

Referenced by if().

◆ __pad0__

hdr __pad0__

Definition at line 264 of file gmlparse.y.

◆ __pad10__

elistitem __pad10__

Definition at line 310 of file gmlparse.y.

◆ __pad11__

attrlist __pad11__

Definition at line 316 of file gmlparse.y.

◆ __pad12__

optalist __pad12__

Definition at line 319 of file gmlparse.y.

◆ __pad13__

alist __pad13__

Definition at line 323 of file gmlparse.y.

◆ __pad14__

alistitem __pad14__

Definition at line 327 of file gmlparse.y.

◆ __pad1__

body __pad1__

Definition at line 267 of file gmlparse.y.

◆ __pad2__

optglist __pad2__

Definition at line 270 of file gmlparse.y.

◆ __pad3__

glist __pad3__

Definition at line 274 of file gmlparse.y.

◆ __pad4__

glistitem __pad4__

Definition at line 278 of file gmlparse.y.

◆ __pad5__

node __pad5__

Definition at line 292 of file gmlparse.y.

◆ __pad6__

nlist __pad6__

Definition at line 295 of file gmlparse.y.

◆ __pad7__

nlistitem __pad7__

Definition at line 299 of file gmlparse.y.

◆ __pad8__

edge __pad8__

Definition at line 303 of file gmlparse.y.

◆ __pad9__

elist __pad9__

Definition at line 306 of file gmlparse.y.

◆ alistitem

alistitem { dtinsert (N->attrlist, $1)

Definition at line 300 of file gmlparse.y.

◆ attrlist

POINT attrlist { $$ = mkAttr ($1, 0, LIST, 0, $2)

Definition at line 330 of file gmlparse.y.

◆ E

E = NULL

Definition at line 303 of file gmlparse.y.

◆ edge

◆ INTEGER

FONTSIZE INTEGER
Initial value:
{
if (setDir($2)) {
yyerror("mixed directed and undirected graphs");
cleanup ();
}
}
| ID INTEGER { dtinsert (G->attrlist, mkAttr(gv_strdup("id"), 0, INTEGER, $2, 0)); }
| alistitem { dtinsert (G->attrlist, $1); }
static char * gv_strdup(const char *original)
Definition alloc.h:101
#define dtinsert(d, o)
Definition cdt.h:193
#define G
Definition gdefs.h:7
#define YYABORT
Definition gmlparse.c:1012
static void cleanup(void)
Definition gmlparse.c:155
static int setDir(char *d)
Definition gmlparse.c:271
#define ID
Definition gmlparse.c:415
static gmlattr * mkAttr(char *name, unsigned short sort, unsigned short kind, char *str, Dt_t *list)
Definition gmlparse.c:247
#define yyerror
Definition gmlparse.c:70
alist $2
Definition gmlparse.y:323
glistitem $1
Definition gmlparse.y:278
hdr body DIRECTED INTEGER
Definition gmlparse.y:281
alistitem
Definition gmlparse.y:300

Definition at line 281 of file gmlparse.y.

Referenced by sortToStr().

◆ N

N = NULL

Definition at line 292 of file gmlparse.y.

◆ optalist

optalist { $$ = popAlist()

Definition at line 316 of file gmlparse.y.

◆ prefix

◆ REAL

WIDTH REAL { $$ = mkAttr ($1, 0, REAL, $2, 0)

Definition at line 328 of file gmlparse.y.

Referenced by sortToStr().

◆ STRING

COLOR STRING { $$ = mkAttr ($1, 0, STRING, $2, 0)

Definition at line 329 of file gmlparse.y.

Referenced by deparseAttr(), and sortToStr().