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 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #ifndef GPRSTATE_H
19 #define GPRSTATE_H
20 
21 #include "sfio.h"
22 #include "cgraph.h"
23 #include "ast.h"
24 #include "vmalloc.h"
25 #include "expr.h"
26 #include "gvpr.h"
27 
28     typedef enum { TV_flat, TV_ne, TV_en,
29                    TV_bfs,
30                    TV_dfs, TV_fwd, TV_rev,
31                    TV_postdfs, TV_postfwd, TV_postrev,
32                    TV_prepostdfs, TV_prepostfwd, TV_prepostrev,
33     } trav_type;
34 
35 /* Bits for flags variable.
36  */
37   /* If set, gvpr calls exit() on errors */
38 #define GV_USE_EXIT 1
39   /* If set, gvpr stores output graphs in gvpropts */
40 #define GV_USE_OUTGRAPH 2
41 #define GV_USE_JUMP 4
42 
43     typedef struct {
44 	Agraph_t *curgraph;
45 	Agraph_t *nextgraph;
46 	Agraph_t *target;
47 	Agraph_t *outgraph;
48 	Agobj_t *curobj;
49 	Sfio_t *tmp;
50 	Exdisc_t *dp;
51 	Exerror_f errf;
52 	Exexit_f exitf;
53 	char *tgtname;
54 	char *infname;
55 	Sfio_t *outFile;
56 	Agiodisc_t* dfltIO;
57 	trav_type tvt;
58 	Agnode_t *tvroot;
59 	Agnode_t *tvnext;
60 	Agedge_t *tvedge;
61 	int name_used;
62 	int argc;
63 	char **argv;
64 	int flags;
65 	gvprbinding* bindings;
66 	int n_bindings;
67     } Gpr_t;
68 
69     typedef struct {
70 	Sfio_t *outFile;
71 	int argc;
72 	char **argv;
73 	Exerror_f errf;
74 	Exexit_f exitf;
75 	int flags;
76     } gpr_info;
77 
78     extern Gpr_t *openGPRState(gpr_info*);
79     extern void addBindings(Gpr_t* state, gvprbinding*);
80     extern gvprbinding* findBinding(Gpr_t* state, char*);
81     extern void closeGPRState(Gpr_t* state);
82     extern void initGPRState(Gpr_t *, Vmalloc_t *);
83     extern int validTVT(int);
84 
85 #ifdef _WIN32
86     extern int pathisrelative (char* path);
87 #endif
88 
89 #endif
90 
91 #ifdef __cplusplus
92 }
93 #endif
94