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 COMPILE_H
19 #define COMPILE_H
20 
21 #include <sfio.h>
22 #include <parse.h>
23 #include <gprstate.h>
24 #include <expr.h>
25 
26     typedef struct {
27 	Exnode_t *guard;
28 	Exnode_t *action;
29     } case_stmt;
30 
31 #define UDATA "userval"
32 
33     typedef struct {
34 	Agrec_t h;
35 	/* Extype_t xu; */
36 	Extype_t iu;
37 	Agedge_t* ine;
38     } nval_t;
39 
40     typedef struct {
41 	Agrec_t h;
42 	/* Extype_t xu; */
43 	/* Extype_t iu; */
44 	char lock;
45     } gval_t;
46 
47     typedef struct {
48 	Agrec_t h;
49 	/* Extype_t xu; */
50     } uval_t;
51 
52 #define OBJ(p) ((Agobj_t*)p)
53 
54     typedef nval_t ndata;
55     typedef uval_t edata;
56     typedef gval_t gdata;
57 
58 #define nData(n)    ((ndata*)(aggetrec(n,UDATA,0)))
59 #define gData(g)    ((gdata*)(aggetrec(g,UDATA,0)))
60 
61 #define SRCOUT    0x1
62 #define INDUCE    0x2
63 #define CLONE     0x4
64 
65 #define WALKSG    0x1
66 #define BEGG      0x2
67 #define ENDG      0x4
68 
69     typedef struct {
70 	Exnode_t *begg_stmt;
71 	int walks;
72 	int n_nstmts;
73 	int n_estmts;
74 	case_stmt *node_stmts;
75 	case_stmt *edge_stmts;
76     } comp_block;
77 
78     typedef struct {
79 	int flags;
80 	Expr_t *prog;
81 	Exnode_t *begin_stmt;
82 	int n_blocks;
83 	comp_block  *blocks;
84 	Exnode_t *endg_stmt;
85 	Exnode_t *end_stmt;
86     } comp_prog;
87 
88     extern comp_prog *compileProg(parse_prog *, Gpr_t *, int);
89     extern void freeCompileProg (comp_prog *p);
90     extern int usesGraph(comp_prog *);
91     extern int walksGraph(comp_block *);
92     extern Agraph_t *readG(Sfio_t * fp);
93     extern Agraph_t *openG(char *name, Agdesc_t);
94     extern Agraph_t *openSubg(Agraph_t * g, char *name);
95     extern Agnode_t *openNode(Agraph_t * g, char *name);
96     extern Agedge_t *openEdge(Agraph_t* g, Agnode_t * t, Agnode_t * h, char *key);
97 
98 #endif
99 
100 #ifdef __cplusplus
101 }
102 #endif
103