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 <stdio.h>
15 #include <graphviz/cgraph.h>
16
my_ins(Agraph_t * g,Agobj_t * obj,void * context)17 static void my_ins(Agraph_t * g, Agobj_t * obj, void *context)
18 {
19 Agnode_t *n;
20
21 if (AGTYPE(obj) == AGNODE) {
22 n = (Agnode_t *) obj;
23 fprintf(stderr, "%s initialized with label %s\n", agnameof(n),
24 agget(n, "label"));
25 }
26 }
27
28 static Agcbdisc_t mydisc = { {0, 0, 0}, {my_ins, 0, 0}, {0, 0, 0} };
29
main(int argc,char ** argv)30 main(int argc, char **argv)
31 {
32 Agraph_t *g, *prev;
33 int dostat;
34
35 if (argc > 1)
36 dostat = atoi(argv[1]);
37 else
38 dostat = 0;
39
40 prev = agopen("some_name", Agdirected, NIL(Agdisc_t *));
41 agcallbacks(prev, FALSE);
42 agpushdisc(prev, &mydisc, NIL(void *));
43 /*agwrite(prev,stdout); */
44 fprintf(stderr, "ready to go, computer fans\n");
45 agcallbacks(prev, TRUE);
46 agclose(prev);
47 return 1;
48 }
49