Graphviz  2.41.20171026.1811
tester.c
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #include <assert.h>
15 #include <signal.h>
16 #include <stdio.h>
17 #include "cgraph.h"
18 
19 #define NILgraph NIL(Agraph_t*)
20 #define NILnode NIL(Agnode_t*)
21 #define NILedge NIL(Agedge_t*)
22 #define NILsym NIL(Agsym_t*)
23 #define NILstr NIL(char*)
24 
26 {
27  Agraph_t *g;
28  Agnode_t *n;
29  Agedge_t *e;
30  Agsym_t *sym;
31  char *val;
32 
33  while (g = agread(stdin, NIL(Agdisc_t *))) {
34 #ifdef NOTDEF
35  for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
36  fprintf(stderr, "%s\n", agnameof(n));
37  for (sym = agnxtattr(g, AGNODE, 0); sym;
38  sym = agnxtattr(g, AGNODE, sym)) {
39  val = agxget(n, sym);
40  fprintf(stderr, "\t%s=%s\n", sym->name, val);
41  }
42  }
43 #endif
44  sym = agattr(g, AGRAPH, "nonsense", "junk");
45  fprintf(stderr,"sym = %x, %s\n", sym, sym? sym->defval : "(none)");
46  agwrite(g, stdout);
47  }
48 }
Agsym_t * agattr(Agraph_t *g, int kind, char *name, char *value)
Definition: attr.c:324
char * defval
Definition: cgraph.h:327
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
Definition: attr.c:340
char * name
Definition: cgraph.h:326
CGRAPH_API Agraph_t * agread(void *chan, Agdisc_t *disc)
Definition: grammar.c:2349
CGRAPH_API int agwrite(Agraph_t *g, void *chan)
Definition: write.c:678
CGRAPH_API Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Definition: node.c:45
#define NIL(t)
Definition: dthdr.h:13
CGRAPH_API char * agnameof(void *)
Definition: id.c:143
CGRAPH_API Agnode_t * agfstnode(Agraph_t *g)
Definition: node.c:38
#define AGNODE
Definition: cgraph.h:101
char * agxget(void *obj, Agsym_t *sym)
Definition: attr.c:444
int main(int argc, char **argv)
Definition: dot.c:95
#define AGRAPH
Definition: cgraph.h:100