git.haldean.org expel / 22e2f2d
use include/ubik Haldean Brown 6 years ago
51 changed file(s) with 372 addition(s) and 372 deletion(s). Raw diff Collapse all Expand all
2121 #include <stdlib.h>
2222 #include <string.h>
2323
24 #include "expel/compile.h"
25 #include "expel/env.h"
26 #include "expel/expel.h"
27 #include "expel/parse.h"
28 #include "expel/schedule.h"
29 #include "expel/value.h"
24 #include "ubik/compile.h"
25 #include "ubik/env.h"
26 #include "ubik/ubik.h"
27 #include "ubik/parse.h"
28 #include "ubik/schedule.h"
29 #include "ubik/value.h"
3030
3131 #define c(x) \
3232 do { \
2121 #include <stdlib.h>
2222 #include <string.h>
2323
24 #include "expel/ast.h"
25 #include "expel/compile.h"
26 #include "expel/env.h"
27 #include "expel/expel.h"
28 #include "expel/parse.h"
29 #include "expel/resolve.h"
30 #include "expel/schedule.h"
31 #include "expel/value.h"
24 #include "ubik/ast.h"
25 #include "ubik/compile.h"
26 #include "ubik/env.h"
27 #include "ubik/ubik.h"
28 #include "ubik/parse.h"
29 #include "ubik/resolve.h"
30 #include "ubik/schedule.h"
31 #include "ubik/value.h"
3232
3333 #define c(x) \
3434 do { \
1717 */
1818
1919 #pragma once
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121 #include "ubik/vector.h"
2222
2323 #include <stdbool.h>
1818
1919 #pragma once
2020 #include "ubik/dagc.h"
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222
2323 struct xl_graph_builder
2424 {
1818
1919 #pragma once
2020 #include "ubik/ast.h"
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/resolve.h"
2323
2424 /* Takes an AST and transforms closures into partially-applied functions. This
1717 */
1818
1919 #pragma once
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121 #include "ubik/ast.h"
2222
2323
1919 #ifndef EXPEL_DAGC_H
2020 #define EXPEL_DAGC_H
2121
22 #include "ubik/expel.h"
22 #include "ubik/ubik.h"
2323
2424 /* node is fully evaluated */
2525 #define XL_DAGC_FLAG_COMPLETE 0x01
1818
1919 #pragma once
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/uri.h"
2323
2424 #include <stdbool.h>
+0
-303
include/ubik/expel.h less more
0 /*
1 * expel.h: minimal public API
2 * Copyright (C) 2015, Haldean Brown
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef EXPEL_EXPEL_H
20 #define EXPEL_EXPEL_H
21
22 #include <stddef.h>
23 #include <stdint.h>
24
25 #include "ubik/const.h"
26
27 typedef uint16_t xl_tag;
28 typedef uint64_t xl_word;
29
30 #if __SIZEOF_DOUBLE__ == 8
31 typedef double xl_float;
32 #elif __SIZEOF_FLOAT__ == 8
33 typedef float xl_float;
34 #elif __SIZEOF_LONG_DOUBLE__ == 8
35 typedef long double xl_float;
36 #else
37 #error "word size and float size do not match"
38 #endif
39
40 #define TAG_TYPE_MASK 0xF000
41 #define TAG_VALUE 0x1000
42 #define TAG_GRAPH 0x2000
43 #define TAG_URI 0x3000
44
45 /* Tree tags */
46 #define TAG_LEFT_NODE 0x0010
47 #define TAG_LEFT_WORD 0x0020
48 #define TAG_LEFT_GRAPH 0x0040
49 #define TAG_RIGHT_NODE 0x0001
50 #define TAG_RIGHT_WORD 0x0002
51 #define TAG_RIGHT_GRAPH 0x0004
52
53 /* Graph tags */
54 #define TAG_GRAPH_NATIVE 0x0001
55 /* an unresolved graph is one that contains URIs that have not been resolved to
56 * a specific resource yet. */
57 #define TAG_GRAPH_UNRESOLVED 0x0002
58 /* a modinit graph represents a graph that should be run when bytecode is
59 * loaded. */
60 #define TAG_GRAPH_MODINIT 0x0004
61
62 /* The maximum Expel bytecode version that this library supports. */
63 #define CURRENT_ENCODING_VERSION 1
64
65 /* Private data structures referenced by public data structures. */
66 struct xl_alloc_page;
67 struct xl_env;
68 struct xl_stream;
69 struct xl_user;
70 struct xl_uri;
71 struct xl_dagc_adjacency;
72
73 struct xl_dagc;
74
75 /* Used to communicate errors through the stack. */
76 struct xl_error
77 {
78 xl_word error_code;
79 const char *tag;
80 const char *file;
81 const char *function;
82 uint32_t lineno;
83 };
84 typedef struct xl_error * xl_error;
85 #define OK ((xl_error) NULL)
86
87 #define no_ignore __attribute__((__warn_unused_result__))
88
89 union xl_atom
90 {
91 struct xl_value *t;
92 struct xl_dagc *g;
93 void *any;
94 xl_word w;
95 xl_float f;
96 };
97
98 /* The base type of all data in Expel; it's a cons cell. */
99 struct xl_value
100 {
101 /* A bitset of the TAG_ constants. One each of the
102 * TAG_LEFT_ and TAG_RIGHT_ bits must be set, along with
103 * the TAG_VALUE bit. */
104 xl_tag tag;
105
106 union xl_atom left;
107 union xl_atom right;
108
109 /* The page in which the value was allocated, used by the
110 * garbage collector. */
111 struct xl_alloc_page *alloc_page;
112 /* The number of references to the value, used by the
113 * garbage collector. Special hell awaits those who modify
114 * this value. */
115 uint64_t refcount;
116 };
117
118 struct xl_dagc;
119
120 union xl_value_or_graph
121 {
122 struct xl_value *tree;
123 struct xl_dagc *graph;
124 void *any;
125 xl_tag *tag;
126 };
127
128 struct xl_dagc_node
129 {
130 /* One of the DAGC_NODE constants */
131 xl_word node_type;
132 /* The unique identifier of this node */
133 xl_word id;
134 /* The evaluated type of the node, populated after the
135 * node is evaluated by xl_dagc_eval. */
136 struct xl_value *known_type;
137 /* The evaluated computation graph of the node, populated
138 * after the node is evaluated by xl_dagc_eval. The
139 * tag field tells you which member of the union to
140 * access. */
141 union xl_value_or_graph known;
142 /* Nonzero if we want the value of this node at the end of
143 * evaluation */
144 uint8_t is_terminal;
145 /* A bitsest of the XL_DAGC_FLAG constants */
146 uint8_t flags;
147 };
148
149 struct xl_dagc
150 {
151 /* Used to determine if a void* is a graph or a value.
152 * This is set by xl_dagc_init; users of the DAGC API
153 * should not touch it. */
154 xl_tag tag;
155
156 /* The identity of the graph, in URI form. */
157 struct xl_uri *identity;
158
159 /* The nodes participating in the graph. */
160 struct xl_dagc_node **nodes;
161 /* The number of nodes in the graph. */
162 size_t n;
163
164 /* Below this is only members that are populated by
165 * calling xl_dagc_init; callers should initialize nodes
166 * and n above and then call init to take care of
167 * everything else. */
168
169 /* Number of references held to this graph. */
170 uint64_t refcount;
171
172 /* A list of structs which encode backlinks from child to
173 * parent. */
174 struct xl_dagc_adjacency *adjacency;
175
176 /* The input nodes in the graph. */
177 struct xl_dagc_node **inputs;
178 size_t in_arity;
179
180 /* The terminal nodes in the graph. */
181 struct xl_dagc_node **terminals;
182 size_t out_arity;
183
184 /* The result node in the graph. */
185 struct xl_dagc_node *result;
186 };
187
188 /* Starts the expel runtime.
189 *
190 * Returns OK on success. */
191 no_ignore xl_error
192 xl_start();
193
194 /* Stops the expel runtime.
195 *
196 * Returns OK on success. */
197 no_ignore xl_error
198 xl_teardown();
199
200 /* Creates a new value.
201 *
202 * The returned value has a refcount of one; callers to xl_new do
203 * not need to take the result. This may result in an allocation
204 * but is not guaranteed to; xl_values are allocated in pages. */
205 no_ignore xl_error
206 xl_value_new(struct xl_value **v);
207
208 /* Takes a reference to the given tree or graph.
209 *
210 * Returns OK on success, or a nonzero error code on failure. */
211 no_ignore xl_error
212 xl_take(void *v);
213
214 /* Releases a reference to the given tree or graph.
215 *
216 * Returns OK on success, or a nonzero error code on failure. If
217 * passed a value, this may result in a free but is not guaranteed
218 * to; xl_values are garbage-collected periodically. If passed a
219 * graph and the releaser was the last owner of the graph, this
220 * will free the graph. */
221 no_ignore xl_error
222 xl_release(void *v);
223
224 /* Loads an expel bytecode blob from a stream.
225 *
226 * Returns OK on success, or a nonzero error word. */
227 no_ignore xl_error
228 xl_load(struct xl_dagc ***out, size_t *n_graphs, struct xl_stream *sp);
229
230 /* Saves a list of graphs and all accessible subgraphs to a stream.
231 *
232 * Returns OK on success, or a nonzero error word. */
233 no_ignore xl_error
234 xl_save(struct xl_stream *sp, struct xl_dagc **graphs, size_t n);
235
236 /* Loads a tree from a stream.
237 *
238 * Note that any contained graph references are initialized to the index
239 * of the graph in some other structure; if you're loading values with
240 * graph references you probably want to load the whole thing in one go
241 * with xl_load.
242 *
243 * The returned tree is not taken; it is up to the caller to take the
244 * tree. Returns OK on success, or a nonzero error word. */
245 no_ignore xl_error
246 xl_value_load(struct xl_value *out, struct xl_stream *sp);
247
248 /* Saves a tree to a stream.
249 *
250 * Note that this cannot save any values that contain any graph
251 * references; for that you'll need to serialize the entire structure
252 * with xl_save.
253 *
254 * Returns OK on success, or a nonzero error word. */
255 no_ignore xl_error
256 xl_value_save(struct xl_stream *sp, struct xl_value *in);
257
258 /* Allocates a graph object.
259 *
260 * All graph objects must be allocated on the heap; call into this
261 * method to allocate a graph of a given size. */
262 no_ignore xl_error
263 xl_dagc_new(struct xl_dagc **g, size_t n);
264
265 /* Initializes derived quantities on graphs.
266 *
267 * Callers should create a dagc struct, populate the nodes and the
268 * n fields, and then call this method to compute all derived
269 * quantities.
270 *
271 * This resets the refcount of the given graph to 1; initializers
272 * of graph structs do not need to take a reference to the graph
273 * after initialization. */
274 no_ignore xl_error
275 xl_dagc_init(struct xl_dagc *graph);
276
277 /* Creates a string representation of a node.
278 *
279 * Useful for debugging, but not much else. */
280 char *
281 xl_node_explain(struct xl_dagc_node *n);
282
283 /* Create an error object. */
284 xl_error
285 xl_error_new(
286 const xl_word code,
287 const char *tag,
288 const char *file,
289 const uint32_t lineno,
290 const char *function);
291
292 /* Creates a string representation of an error object. */
293 char *
294 xl_error_explain(xl_error err);
295
296 /* Raise an error with the current file and line populated. */
297 #define xl_raise(code, tag) \
298 xl_error_new((code), (tag), __FILE__, __LINE__, __FUNCTION__)
299
300 #define local(type) __attribute__((cleanup(xl_ ## type ## _free)))
301
302 #endif
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020
2121 struct xl_gc_info
2222 {
1717 */
1818
1919 #pragma once
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121 #include "ubik/ast.h"
2222 #include "ubik/uri.h"
2323
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020
2121 no_ignore xl_error
2222 xl_natives_register(struct xl_env *env);
1818
1919 #pragma once
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/ast.h"
2323 #include "ubik/stream.h"
2424 #include "ubik/vector.h"
2020 #include <stdbool.h>
2121 #include <stdint.h>
2222
23 #include "ubik/expel.h"
23 #include "ubik/ubik.h"
2424 #include "ubik/vector.h"
2525
2626 /* Pointer sets represent sets of objects where the identity of an object is the
1717 */
1818
1919 #pragma once
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121 #include "ubik/ast.h"
2222 #include "ubik/vector.h"
2323
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020
2121 struct xl_scheduler;
2222 struct xl_exec_unit;
2121
2222 #include <stdio.h>
2323
24 #include "ubik/expel.h"
24 #include "ubik/ubik.h"
2525
2626 struct _xl_buf {
2727 uint8_t *start;
1717 */
1818
1919 #include <strings.h>
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121
2222 /* Splits a NULL-terminated string into multiple smaller NULL-terminated
2323 * strings, each separated by the delim character. */
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020
2121 struct xl_timer;
2222
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020 #include "ubik/stream.h"
2121
2222 struct xl_token
1818
1919 #include <stdbool.h>
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222
2323 bool
2424 xl_type_satisfied(
0 /*
1 * expel.h: minimal public API
2 * Copyright (C) 2015, Haldean Brown
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef EXPEL_EXPEL_H
20 #define EXPEL_EXPEL_H
21
22 #include <stddef.h>
23 #include <stdint.h>
24
25 #include "ubik/const.h"
26
27 typedef uint16_t xl_tag;
28 typedef uint64_t xl_word;
29
30 #if __SIZEOF_DOUBLE__ == 8
31 typedef double xl_float;
32 #elif __SIZEOF_FLOAT__ == 8
33 typedef float xl_float;
34 #elif __SIZEOF_LONG_DOUBLE__ == 8
35 typedef long double xl_float;
36 #else
37 #error "word size and float size do not match"
38 #endif
39
40 #define TAG_TYPE_MASK 0xF000
41 #define TAG_VALUE 0x1000
42 #define TAG_GRAPH 0x2000
43 #define TAG_URI 0x3000
44
45 /* Tree tags */
46 #define TAG_LEFT_NODE 0x0010
47 #define TAG_LEFT_WORD 0x0020
48 #define TAG_LEFT_GRAPH 0x0040
49 #define TAG_RIGHT_NODE 0x0001
50 #define TAG_RIGHT_WORD 0x0002
51 #define TAG_RIGHT_GRAPH 0x0004
52
53 /* Graph tags */
54 #define TAG_GRAPH_NATIVE 0x0001
55 /* an unresolved graph is one that contains URIs that have not been resolved to
56 * a specific resource yet. */
57 #define TAG_GRAPH_UNRESOLVED 0x0002
58 /* a modinit graph represents a graph that should be run when bytecode is
59 * loaded. */
60 #define TAG_GRAPH_MODINIT 0x0004
61
62 /* The maximum Expel bytecode version that this library supports. */
63 #define CURRENT_ENCODING_VERSION 1
64
65 /* Private data structures referenced by public data structures. */
66 struct xl_alloc_page;
67 struct xl_env;
68 struct xl_stream;
69 struct xl_user;
70 struct xl_uri;
71 struct xl_dagc_adjacency;
72
73 struct xl_dagc;
74
75 /* Used to communicate errors through the stack. */
76 struct xl_error
77 {
78 xl_word error_code;
79 const char *tag;
80 const char *file;
81 const char *function;
82 uint32_t lineno;
83 };
84 typedef struct xl_error * xl_error;
85 #define OK ((xl_error) NULL)
86
87 #define no_ignore __attribute__((__warn_unused_result__))
88
89 union xl_atom
90 {
91 struct xl_value *t;
92 struct xl_dagc *g;
93 void *any;
94 xl_word w;
95 xl_float f;
96 };
97
98 /* The base type of all data in Expel; it's a cons cell. */
99 struct xl_value
100 {
101 /* A bitset of the TAG_ constants. One each of the
102 * TAG_LEFT_ and TAG_RIGHT_ bits must be set, along with
103 * the TAG_VALUE bit. */
104 xl_tag tag;
105
106 union xl_atom left;
107 union xl_atom right;
108
109 /* The page in which the value was allocated, used by the
110 * garbage collector. */
111 struct xl_alloc_page *alloc_page;
112 /* The number of references to the value, used by the
113 * garbage collector. Special hell awaits those who modify
114 * this value. */
115 uint64_t refcount;
116 };
117
118 struct xl_dagc;
119
120 union xl_value_or_graph
121 {
122 struct xl_value *tree;
123 struct xl_dagc *graph;
124 void *any;
125 xl_tag *tag;
126 };
127
128 struct xl_dagc_node
129 {
130 /* One of the DAGC_NODE constants */
131 xl_word node_type;
132 /* The unique identifier of this node */
133 xl_word id;
134 /* The evaluated type of the node, populated after the
135 * node is evaluated by xl_dagc_eval. */
136 struct xl_value *known_type;
137 /* The evaluated computation graph of the node, populated
138 * after the node is evaluated by xl_dagc_eval. The
139 * tag field tells you which member of the union to
140 * access. */
141 union xl_value_or_graph known;
142 /* Nonzero if we want the value of this node at the end of
143 * evaluation */
144 uint8_t is_terminal;
145 /* A bitsest of the XL_DAGC_FLAG constants */
146 uint8_t flags;
147 };
148
149 struct xl_dagc
150 {
151 /* Used to determine if a void* is a graph or a value.
152 * This is set by xl_dagc_init; users of the DAGC API
153 * should not touch it. */
154 xl_tag tag;
155
156 /* The identity of the graph, in URI form. */
157 struct xl_uri *identity;
158
159 /* The nodes participating in the graph. */
160 struct xl_dagc_node **nodes;
161 /* The number of nodes in the graph. */
162 size_t n;
163
164 /* Below this is only members that are populated by
165 * calling xl_dagc_init; callers should initialize nodes
166 * and n above and then call init to take care of
167 * everything else. */
168
169 /* Number of references held to this graph. */
170 uint64_t refcount;
171
172 /* A list of structs which encode backlinks from child to
173 * parent. */
174 struct xl_dagc_adjacency *adjacency;
175
176 /* The input nodes in the graph. */
177 struct xl_dagc_node **inputs;
178 size_t in_arity;
179
180 /* The terminal nodes in the graph. */
181 struct xl_dagc_node **terminals;
182 size_t out_arity;
183
184 /* The result node in the graph. */
185 struct xl_dagc_node *result;
186 };
187
188 /* Starts the expel runtime.
189 *
190 * Returns OK on success. */
191 no_ignore xl_error
192 xl_start();
193
194 /* Stops the expel runtime.
195 *
196 * Returns OK on success. */
197 no_ignore xl_error
198 xl_teardown();
199
200 /* Creates a new value.
201 *
202 * The returned value has a refcount of one; callers to xl_new do
203 * not need to take the result. This may result in an allocation
204 * but is not guaranteed to; xl_values are allocated in pages. */
205 no_ignore xl_error
206 xl_value_new(struct xl_value **v);
207
208 /* Takes a reference to the given tree or graph.
209 *
210 * Returns OK on success, or a nonzero error code on failure. */
211 no_ignore xl_error
212 xl_take(void *v);
213
214 /* Releases a reference to the given tree or graph.
215 *
216 * Returns OK on success, or a nonzero error code on failure. If
217 * passed a value, this may result in a free but is not guaranteed
218 * to; xl_values are garbage-collected periodically. If passed a
219 * graph and the releaser was the last owner of the graph, this
220 * will free the graph. */
221 no_ignore xl_error
222 xl_release(void *v);
223
224 /* Loads an expel bytecode blob from a stream.
225 *
226 * Returns OK on success, or a nonzero error word. */
227 no_ignore xl_error
228 xl_load(struct xl_dagc ***out, size_t *n_graphs, struct xl_stream *sp);
229
230 /* Saves a list of graphs and all accessible subgraphs to a stream.
231 *
232 * Returns OK on success, or a nonzero error word. */
233 no_ignore xl_error
234 xl_save(struct xl_stream *sp, struct xl_dagc **graphs, size_t n);
235
236 /* Loads a tree from a stream.
237 *
238 * Note that any contained graph references are initialized to the index
239 * of the graph in some other structure; if you're loading values with
240 * graph references you probably want to load the whole thing in one go
241 * with xl_load.
242 *
243 * The returned tree is not taken; it is up to the caller to take the
244 * tree. Returns OK on success, or a nonzero error word. */
245 no_ignore xl_error
246 xl_value_load(struct xl_value *out, struct xl_stream *sp);
247
248 /* Saves a tree to a stream.
249 *
250 * Note that this cannot save any values that contain any graph
251 * references; for that you'll need to serialize the entire structure
252 * with xl_save.
253 *
254 * Returns OK on success, or a nonzero error word. */
255 no_ignore xl_error
256 xl_value_save(struct xl_stream *sp, struct xl_value *in);
257
258 /* Allocates a graph object.
259 *
260 * All graph objects must be allocated on the heap; call into this
261 * method to allocate a graph of a given size. */
262 no_ignore xl_error
263 xl_dagc_new(struct xl_dagc **g, size_t n);
264
265 /* Initializes derived quantities on graphs.
266 *
267 * Callers should create a dagc struct, populate the nodes and the
268 * n fields, and then call this method to compute all derived
269 * quantities.
270 *
271 * This resets the refcount of the given graph to 1; initializers
272 * of graph structs do not need to take a reference to the graph
273 * after initialization. */
274 no_ignore xl_error
275 xl_dagc_init(struct xl_dagc *graph);
276
277 /* Creates a string representation of a node.
278 *
279 * Useful for debugging, but not much else. */
280 char *
281 xl_node_explain(struct xl_dagc_node *n);
282
283 /* Create an error object. */
284 xl_error
285 xl_error_new(
286 const xl_word code,
287 const char *tag,
288 const char *file,
289 const uint32_t lineno,
290 const char *function);
291
292 /* Creates a string representation of an error object. */
293 char *
294 xl_error_explain(xl_error err);
295
296 /* Raise an error with the current file and line populated. */
297 #define xl_raise(code, tag) \
298 xl_error_new((code), (tag), __FILE__, __LINE__, __FUNCTION__)
299
300 #define local(type) __attribute__((cleanup(xl_ ## type ## _free)))
301
302 #endif
2020 #include <stdbool.h>
2121 #include <stdint.h>
2222
23 #include "ubik/expel.h"
23 #include "ubik/ubik.h"
2424
2525 /* Identifies values in the expel substrate */
2626 struct xl_uri {
2323 #define likely(x) __builtin_expect((x), 1)
2424 #define unlikely(x) __builtin_expect((x), 0)
2525
26 #include "ubik/expel.h"
26 #include "ubik/ubik.h"
2727
2828 size_t
2929 size_max(size_t a, size_t b);
1818
1919 #include <stdbool.h>
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222
2323 bool
2424 xl_value_eq(struct xl_value *v1, struct xl_value *v2);
1818
1919 #pragma once
2020 #include <stdint.h>
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222
2323 struct xl_vector
2424 {
2222
2323 #include "ubik/assert.h"
2424 #include "ubik/dagc.h"
25 #include "ubik/expel.h"
25 #include "ubik/ubik.h"
2626 #include "ubik/util.h"
2727
2828 no_ignore xl_error
2020 #include <string.h>
2121
2222 #include "ubik/assert.h"
23 #include "ubik/expel.h"
23 #include "ubik/ubik.h"
2424 #include "ubik/env.h"
2525 #include "ubik/util.h"
2626
1919 #include <stdio.h>
2020 #include <stdlib.h>
2121
22 #include "ubik/expel.h"
22 #include "ubik/ubik.h"
2323 #include "ubik/util.h"
2424
2525 xl_error
1919 #include "ubik/assert.h"
2020 #include "ubik/dagc.h"
2121 #include "ubik/env.h"
22 #include "ubik/expel.h"
22 #include "ubik/ubik.h"
2323 #include "ubik/types.h"
2424 #include "ubik/util.h"
2525 #include "ubik/value.h"
2121 #include <stdlib.h>
2222
2323 #include "ubik/dagc.h"
24 #include "ubik/expel.h"
24 #include "ubik/ubik.h"
2525 #include "ubik/uri.h"
2626 #include "ubik/util.h"
2727
2929
3030 #include "ubik/assert.h"
3131 #include "ubik/dagc.h"
32 #include "ubik/expel.h"
32 #include "ubik/ubik.h"
3333 #include "ubik/gc.h"
3434 #include "ubik/pointerset.h"
3535 #include "ubik/stream.h"
2020 #include "ubik/bdagc.h"
2121 #include "ubik/dagc.h"
2222 #include "ubik/env.h"
23 #include "ubik/expel.h"
23 #include "ubik/ubik.h"
2424 #include "ubik/gen.h"
2525 #include "ubik/types.h"
2626 #include "ubik/uri.h"
1818
1919 %{
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/ast.h"
2323 #include "ubik/parse.h"
2424 #include "ubik/util.h"
1919 #include "ubik/assert.h"
2020 #include "ubik/dagc.h"
2121 #include "ubik/env.h"
22 #include "ubik/expel.h"
22 #include "ubik/ubik.h"
2323 #include "ubik/stream.h"
2424 #include "ubik/util.h"
2525
1919 #include "ubik/assert.h"
2020 #include "ubik/dagc.h"
2121 #include "ubik/env.h"
22 #include "ubik/expel.h"
22 #include "ubik/ubik.h"
2323 #include "ubik/natives.h"
2424 #include "ubik/types.h"
2525 #include "ubik/util.h"
1717 */
1818
1919 #include "ubik/env.h"
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121 #include "ubik/gc.h"
2222 #include "ubik/natives.h"
2323
1818
1919 #include "ubik/assert.h"
2020 #include "ubik/dagc.h"
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/pointerset.h"
2323 #include "ubik/stream.h"
2424 #include "ubik/uri.h"
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020
2121 #include <stdlib.h>
2222 #include <time.h>
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020 #include "ubik/types.h"
2121 #include "ubik/value.h"
2222
2020 #include <string.h>
2121
2222 #include "ubik/assert.h"
23 #include "ubik/expel.h"
23 #include "ubik/ubik.h"
2424 #include "ubik/uri.h"
2525 #include "ubik/value.h"
2626
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020 #include "ubik/util.h"
2121
2222 #include <arpa/inet.h>
2222 #include <stdlib.h>
2323 #include <string.h>
2424
25 #include "ubik/expel.h"
25 #include "ubik/ubik.h"
2626 #include "ubik/stream.h"
2727 #include "ubik/util.h"
2828 #include "ubik/value.h"
2121 #include <stdlib.h>
2222 #include <string.h>
2323
24 #include "expel/assert.h"
25 #include "expel/dagc.h"
26 #include "expel/env.h"
27 #include "expel/expel.h"
28 #include "expel/schedule.h"
29 #include "expel/stream.h"
30 #include "expel/timer.h"
31 #include "expel/util.h"
32 #include "expel/value.h"
24 #include "ubik/assert.h"
25 #include "ubik/dagc.h"
26 #include "ubik/env.h"
27 #include "ubik/ubik.h"
28 #include "ubik/schedule.h"
29 #include "ubik/stream.h"
30 #include "ubik/timer.h"
31 #include "ubik/util.h"
32 #include "ubik/value.h"
3333
3434 #define CHECK_ERR(msg) \
3535 do { if (err != OK) \
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020 #include "ubik/stream.h"
2121 #include "unit.h"
2222
1717 */
1818
1919 #include "ubik/env.h"
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121 #include "unit.h"
2222
2323
1616 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717 */
1818
19 #include "ubik/expel.h"
19 #include "ubik/ubik.h"
2020 #include "ubik/gc.h"
2121 #include "unit.h"
2222
1717 */
1818
1919
20 #include "ubik/expel.h"
20 #include "ubik/ubik.h"
2121 #include "ubik/util.h"
2222 #include "unit.h"
2323
1818
1919 #include <stdlib.h>
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/stream.h"
2323 #include "unit.h"
2424
1818
1919 #include <stdlib.h>
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/pointerset.h"
2323 #include "ubik/vector.h"
2424 #include "unit.h"
1818
1919 #include <stdlib.h>
2020
21 #include "ubik/expel.h"
21 #include "ubik/ubik.h"
2222 #include "ubik/uri.h"
2323 #include "unit.h"
2424