forked from urbit/vere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvortex.h
146 lines (119 loc) · 3.54 KB
/
vortex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/// @file
#ifndef U3_VORTEX_H
#define U3_VORTEX_H
#include "allocate.h"
#include "c3.h"
#include "imprison.h"
#include "version.h"
/** Data structures.
**/
/* u3v_arvo: modern arvo structure.
** NB: packed to perserve word alignment given [eve_d]
*/
typedef struct __attribute__((__packed__)) _u3v_arvo {
c3_d eve_d; // event number
u3_noun yot; // cached gates
u3_noun now; // current time
u3_noun roc; // kernel core
} u3v_arvo;
/* u3v_home: all internal (within image) state.
** NB: version must be last for discriminability in north road
*/
typedef struct _u3v_home {
u3a_road rod_u; // storage state
u3v_arvo arv_u; // arvo state
u3v_version ver_w; // version number
} u3v_home;
/** Globals.
**/
/// Arvo internal state.
extern u3v_home* u3v_Home;
# define u3H u3v_Home
# define u3A (&(u3v_Home->arv_u))
/** Functions.
**/
/* u3v_life(): execute initial lifecycle, producing Arvo core.
*/
u3_noun
u3v_life(u3_noun eve);
/* u3v_boot(): evaluate boot sequence, making a kernel
*/
c3_o
u3v_boot(u3_noun eve);
/* u3v_boot_lite(): light bootstrap sequence, just making a kernel.
*/
c3_o
u3v_boot_lite(u3_noun lit);
/* u3v_wish_n(): text expression with cache.
*/
u3_noun
u3v_wish_n(const u3_noun txt);
/* u3v_do(): use a kernel function.
*/
u3_noun
u3v_do(const c3_c* txt_c, u3_noun arg);
# define u3do(txt_c, a) u3v_do(txt_c, a)
# define u3dc(txt_c, a, b) u3v_do(txt_c, u3nc(a, b))
# define u3dt(txt_c, a, b, c) u3v_do(txt_c, u3nt(a, b, c))
# define u3dq(txt_c, a, b, c, d) u3v_do(txt_c, u3nq(a, b, c, d))
/* u3v_wish(): text expression with cache.
*/
u3_noun
u3v_wish(const c3_c* str_c);
/* u3v_time(): set the reck time.
*/
void
u3v_time(u3_noun now);
/* u3v_lily(): parse little atom.
*/
c3_o
u3v_lily(u3_noun fot, u3_noun txt, c3_l* tid_l);
/* u3v_peek(): query the reck namespace.
*/
u3_noun
u3v_peek(u3_noun hap);
/* u3v_soft_peek(): softly query the reck namespace.
*/
u3_noun
u3v_soft_peek(c3_w mil_w, u3_noun sam);
/* u3v_poke(): insert and apply an input ovum (protected).
*/
u3_noun
u3v_poke(u3_noun ovo);
/* u3v_poke_raw(): u3v_poke w/out u3A->now XX replace
*/
u3_noun
u3v_poke_raw(u3_noun sam);
/* u3v_poke_sure(): inject an event, saving new state if successful.
*/
c3_o
u3v_poke_sure(c3_w mil_w, u3_noun eve, u3_noun* pro);
/* u3v_tank(): dump single tank.
*/
void
u3v_tank(u3_noun blu, c3_l tab_l, u3_noun tac);
/* u3v_punt(): dump tank list.
*/
void
u3v_punt(u3_noun blu, c3_l tab_l, u3_noun tac);
/* u3v_sway(): print trace.
*/
void
u3v_sway(u3_noun blu, c3_l tab_l, u3_noun tax);
/* u3v_plan(): queue ovum (external).
*/
void
u3v_plan(u3_noun pax, u3_noun fav);
/* u3v_mark(): mark arvo kernel.
*/
c3_w
u3v_mark(FILE* fil_u);
/* u3v_reclaim(): clear ad-hoc persistent caches to reclaim memory.
*/
void
u3v_reclaim(void);
/* u3v_rewrite_compact(): rewrite arvo kernel for compaction.
*/
void
u3v_rewrite_compact();
#endif /* ifndef U3_VORTEX_H */