Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
gmlparse.y File Reference
#include <stdlib.h>
#include <string.h>
#include <arith.h>
#include <gml2gv.h>
#include <assert.h>
#include <cgraph/list.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/exit.h>

Go to the source code of this file.

Functions

void free_attr (gmlattr *p)
 
static void deparseList (attrs_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, attrs_t *alist, agxbuf *unk)
 
static void addEdgeLabelGraphics (Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
 
static void addNodeGraphics (Agnode_t *np, attrs_t *alist, agxbuf *xb, agxbuf *unk)
 
static void addEdgePoint (Agedge_t *ep, attrs_t *alist, agxbuf *xb)
 
static void addEdgePos (Agedge_t *ep, attrs_t *alist, agxbuf *xb)
 
static void addEdgeGraphics (Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
 
static void addAttrs (Agobj_t *obj, attrs_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 { edges_append(&G->edgelist, $1)
 
hdr body DIRECTED INTEGER
 
node __pad5__
 
 N = NULL
 
nlist __pad6__
 
nlistitem __pad7__
 
 alistitem { attrs_append(&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,
attrs_t *  alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 599 of file gmlparse.y.

References addEdgeGraphics(), addEdgeLabelGraphics(), addNodeGraphics(), addNodeLabelGraphics(), AGEDGE, AGNODE, AGTYPE, GRAPHICS, LABELGRAPHICS, gmlattr::lp, gmlattr::sort, gmlattr::u, and unknown.

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,
attrs_t *  alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 562 of file gmlparse.y.

References addEdgePos(), agsafeset(), agxbclear(), agxbput(), agxbputc(), agxbuse(), cnt(), deparseAttr(), FILL, LINE, gmlattr::lp, NULL, 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,
attrs_t *  alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 411 of file gmlparse.y.

References agsafeset(), agxbclear(), agxbprint(), agxbput(), agxbputc(), agxbuse(), cnt(), COLOR, deparseAttr(), 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,
attrs_t *  alist,
agxbuf xb 
)
static

Definition at line 525 of file gmlparse.y.

References agxblen(), agxbprint(), agxbputc(), NULL, 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,
attrs_t *  alist,
agxbuf xb 
)
static

Definition at line 547 of file gmlparse.y.

References addEdgePoint(), agsafeset(), agxbuse(), 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,
attrs_t *  alist,
agxbuf xb,
agxbuf unk 
)
static

Definition at line 462 of file gmlparse.y.

References agsafeset(), agxbclear(), agxbprint(), agxbput(), agxbputc(), agxbuse(), cnt(), deparseAttr(), FILL, HVAL, NULL, 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,
attrs_t *  alist,
agxbuf unk 
)
static

Definition at line 372 of file gmlparse.y.

References agsafeset(), agxbclear(), agxbput(), agxbputc(), agxbuse(), cnt(), COLOR, deparseAttr(), 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 332 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 ( attrs_t *  alist,
agxbuf xb 
)
static

Definition at line 346 of file gmlparse.y.

References agxbput(), agxbputc(), deparseAttr(), and NULL.

Referenced by deparseAttr(), and unknown().

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

◆ free_attr()

void free_attr ( gmlattr p)

Definition at line 319 of file gmlparse.y.

References free(), free_attrs(), 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 677 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 623 of file gmlparse.y.

References addAttrs(), Agdirected, agedge(), agnode(), agopen(), agsubg(), Agundirected, gmlnode::attrlist, gmledge::attrlist, 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 358 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

cell $1

Definition at line 239 of file gmlparse.y.

Referenced by if().

◆ $2

Definition at line 284 of file gmlparse.y.

Referenced by if().

◆ __pad0__

hdr __pad0__

Definition at line 225 of file gmlparse.y.

◆ __pad10__

elistitem __pad10__

Definition at line 271 of file gmlparse.y.

◆ __pad11__

attrlist __pad11__

Definition at line 277 of file gmlparse.y.

◆ __pad12__

optalist __pad12__

Definition at line 280 of file gmlparse.y.

◆ __pad13__

alist __pad13__

Definition at line 284 of file gmlparse.y.

◆ __pad14__

alistitem __pad14__

Definition at line 288 of file gmlparse.y.

◆ __pad1__

body __pad1__

Definition at line 228 of file gmlparse.y.

◆ __pad2__

optglist __pad2__

Definition at line 231 of file gmlparse.y.

◆ __pad3__

glist __pad3__

Definition at line 235 of file gmlparse.y.

◆ __pad4__

glistitem __pad4__

Definition at line 239 of file gmlparse.y.

◆ __pad5__

node __pad5__

Definition at line 253 of file gmlparse.y.

◆ __pad6__

nlist __pad6__

Definition at line 256 of file gmlparse.y.

◆ __pad7__

nlistitem __pad7__

Definition at line 260 of file gmlparse.y.

◆ __pad8__

edge __pad8__

Definition at line 264 of file gmlparse.y.

◆ __pad9__

elist __pad9__

Definition at line 267 of file gmlparse.y.

◆ alistitem

alistitem { attrs_append(&N->attrlist, $1)

Definition at line 261 of file gmlparse.y.

◆ attrlist

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

Definition at line 291 of file gmlparse.y.

◆ E

E = NULL

Definition at line 264 of file gmlparse.y.

◆ edge

◆ INTEGER

FONTSIZE INTEGER
Initial value:
{
if (setDir($2)) {
yyerror("mixed directed and undirected graphs");
cleanup ();
}
}
| ID INTEGER { attrs_append(&G->attrlist, mkAttr(gv_strdup("id"), 0, INTEGER, $2, 0)); }
| alistitem { attrs_append(&G->attrlist, $1); }
static char * gv_strdup(const char *original)
Definition alloc.h:101
#define G
Definition gdefs.h:7
#define YYABORT
Definition gmlparse.c:973
static void cleanup(void)
Definition gmlparse.c:128
static int setDir(char *d)
Definition gmlparse.c:232
#define ID
Definition gmlparse.c:376
static gmlattr * mkAttr(char *name, unsigned short sort, unsigned short kind, char *str, attrs_t *list)
Definition gmlparse.c:209
#define yyerror
Definition gmlparse.c:70
alist $2
Definition gmlparse.y:284
glistitem $1
Definition gmlparse.y:239
hdr body DIRECTED INTEGER
Definition gmlparse.y:242
alistitem
Definition gmlparse.y:261

Definition at line 242 of file gmlparse.y.

Referenced by sortToStr().

◆ N

N = NULL

Definition at line 253 of file gmlparse.y.

◆ optalist

optalist { $$ = popAlist()

Definition at line 277 of file gmlparse.y.

◆ prefix

◆ REAL

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

Definition at line 289 of file gmlparse.y.

Referenced by sortToStr().

◆ STRING

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

Definition at line 290 of file gmlparse.y.

Referenced by deparseAttr(), and sortToStr().