Debian Codegraph @

lib/gvpr/compile.h

raw
1 /*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11 #pragma once
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #include <sfio/sfio.h>
18 #include <parse.h>
19 #include <gprstate.h>
20 #include <expr/expr.h>
21 #include <stdbool.h>
22 #include <stddef.h>
23 #include <stdio.h>
24
25 typedef struct {
26 Exnode_t *guard;
27 Exnode_t *action;
28 } case_stmt;
29
30 #define UDATA "userval"
31
32 typedef struct {
33 Agrec_t h;
34 Extype_t iu;
35 Agedge_t* ine;
36 } nval_t;
37
38 typedef struct {
39 bool locked: 1; ///< is the lock currently taken?
40 bool zombie: 1; ///< was a deletion request recorded while locked?
41 } gvlock_t;
42
43 typedef struct {
44 Agrec_t h;
45 gvlock_t lock;
46 } gval_t;
47
48 typedef struct {
49 Agrec_t h;
50 } edata;
51
52 #define OBJ(p) ((Agobj_t*)p)
53
54 typedef nval_t ndata;
55 typedef gval_t gdata;
56
57 #define nData(n) ((ndata*)(aggetrec(n,UDATA,0)))
58 #define gData(g) ((gdata*)(aggetrec(g,UDATA,0)))
59
60 typedef struct {
61 bool srcout: 1;
62 bool induce: 1;
63 bool clone: 1;
64 } compflags_t;
65
66 typedef struct {
67 Exnode_t *begg_stmt;
68 bool does_walk_graph; ///< does this block have a node or edge statement?
69 size_t n_nstmts;
70 size_t n_estmts;
71 case_stmt *node_stmts;
72 case_stmt *edge_stmts;
73 } comp_block;
74
75 typedef struct {
76 bool uses_graph; ///< does this program use the input graph?
77 Expr_t *prog;
78 Exnode_t *begin_stmt;
79 size_t n_blocks;
80 comp_block *blocks;
81 Exnode_t *endg_stmt;
82 Exnode_t *end_stmt;
83 } comp_prog;
84
85 comp_prog *compileProg(parse_prog *, Gpr_t *, compflags_t);
86 extern void freeCompileProg (comp_prog *p);
87 extern Agraph_t *readG(FILE *fp);
88 extern Agraph_t *openG(char *name, Agdesc_t);
89 extern Agraph_t *openSubg(Agraph_t * g, char *name);
90 extern Agnode_t *openNode(Agraph_t * g, char *name);
91 extern Agedge_t *openEdge(Agraph_t* g, Agnode_t * t, Agnode_t * h, char *key);
92
93 #ifdef __cplusplus
94 }
95 #endif