interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / src / visor / visor_world.om

174 lines · 4749 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note Pure seeded OM-2 Visor lane 6: read-only World view
3note (replaces src/visor/visor_world.c and src/visor/rx/visor_world_rx.c).
4note Depends on visor.om.
5
6text vwld_t_unatt "world: unattached (V1 omega binary does not link the runtime; holds no authority)\n"
7text vwld_t_att "world: attached (read-only snapshot; holds no authority)\n"
8text vwld_t_gen " generation: (not observable)\n"
9text vwld_t_st " staged_effects: (not visible)\n"
10text vwld_t_objs " resident_objects: "
11text vwld_t_rxn "\n reactions: "
12text vwld_t_pub "\n publication_tail: "
13text vwld_t_dig "\n digest: sha256:"
14text vwld_t_gap "\n gap_note: "
15text vwld_t_obj_pfx " rx:"
16text vwld_t_at "@"
17text vwld_t_sp " "
18text vwld_k_res "RESIDENT"
19text vwld_k_eph "EPHEMERAL"
20text vwld_k_dur "DURABLE"
21text vwld_s_live "live"
22text vwld_s_placed "live,placed"
23text vwld_g_unatt "V1 omega binary does not link the runtime; holds no authority"
24text vwld_g_null "NULL world: fail closed"
25text vwld_g_att "generation not observable; published results not observable; staged effects not visible; coherent only when quiescent"
26text vwld_g_trunc "; object list truncated at 32"
27text vwld_j_unatt "{\"attached\":false,\"authority\":false,\"staged_effects_visible\":false,\"generation_observable\":false,\"resident_object_count\":0,\"object_count\":0,\"gap_note\":\"V1 omega binary does not link the runtime; holds no authority\"}"
28text vwld_j_a1 "{\"attached\":true,\"authority\":false,\"staged_effects_visible\":false,\"generation_observable\":false,\"resident_object_count\":"
29text vwld_j_a2 ",\"object_count\":"
30text vwld_j_a3 ",\"reaction_count\":"
31text vwld_j_a4 ",\"publication_tail\":"
32text vwld_j_a5 ",\"digest\":\"sha256:"
33text vwld_j_a6 "\"}"
34
35global vwld_attached ulong 1
36global vwld_res_cnt ulong 1
37global vwld_obj_cnt ulong 1
38global vwld_rxn_cnt ulong 1
39global vwld_act_cnt ulong 1
40global vwld_pub_tail ulong 1
41global vwld_digest uchar 32
42global vwld_oid ulong 32
43global vwld_ogen ulong 32
44global vwld_opers ulong 32
45global vwld_oplaced ulong 32
46global vwld_gap uchar 256
47global vwld_glen ulong 1
48
49fn vwld_set_gap s view uchar * to void
50 n = len s
51 if gt n 255
52 n = 255
53 end
54 for i ulong n bound 256
55 put vwld_gap i get s i
56 end
57 put vwld_glen 0 n
58end
59
60fn vwld_append_gap s view uchar * to void
61 cur = get vwld_glen 0
62 n = len s
63 for i ulong n bound 256
64 if lt add cur i 255
65 put vwld_gap add cur i get s i
66 end
67 end
68 nn = add cur n
69 if gt nn 255
70 nn = 255
71 end
72 put vwld_glen 0 nn
73end
74
75fn vwld_unattached to void
76 put vwld_attached 0 0
77 put vwld_res_cnt 0 0
78 put vwld_obj_cnt 0 0
79 put vwld_rxn_cnt 0 0
80 put vwld_act_cnt 0 0
81 put vwld_pub_tail 0 0
82 vwld_set_gap vwld_g_unatt
83end
84
85fn vwld_fail_closed to void
86 put vwld_attached 0 0
87 put vwld_res_cnt 0 0
88 put vwld_obj_cnt 0 0
89 put vwld_rxn_cnt 0 0
90 put vwld_act_cnt 0 0
91 put vwld_pub_tail 0 0
92 vwld_set_gap vwld_g_null
93end
94
95fn vwld_format_text cap ulong to long
96 ob_reset cap
97 if eq get vwld_attached 0 0
98 ob_puts vwld_t_unatt
99 else
100 ob_puts vwld_t_att
101 ob_puts vwld_t_gen
102 ob_puts vwld_t_st
103 ob_puts vwld_t_objs
104 ob_put_u64 get vwld_res_cnt 0
105 ob_puts vwld_t_rxn
106 ob_put_u64 get vwld_rxn_cnt 0
107 ob_puts vwld_t_pub
108 ob_put_u64 get vwld_pub_tail 0
109 ob_puts vwld_t_dig
110 for i ulong 32
111 ob_put_hex_byte ulong get vwld_digest i
112 end
113 ob_puts vwld_t_gap
114 gl = get vwld_glen 0
115 for i ulong gl bound 256
116 ob_putc get vwld_gap i
117 end
118 ob_putc uchar 10
119 oc = get vwld_obj_cnt 0
120 for i ulong oc bound 32
121 ob_puts vwld_t_obj_pfx
122 ob_put_u64 get vwld_oid i
123 ob_puts vwld_t_at
124 ob_put_u64 get vwld_ogen i
125 ob_puts vwld_t_sp
126 ps = get vwld_opers i
127 if eq ps 0
128 ob_puts vwld_k_res
129 else
130 if eq ps 1
131 ob_puts vwld_k_eph
132 else
133 ob_puts vwld_k_dur
134 end
135 end
136 ob_puts vwld_t_sp
137 if ne get vwld_oplaced i 0
138 ob_puts vwld_s_placed
139 else
140 ob_puts vwld_s_live
141 end
142 ob_putc uchar 10
143 end
144 end
145 if ne get v_ob_ovf 0 0
146 ret -1
147 end
148 ret long get v_ob_len 0
149end
150
151fn vwld_format_json cap ulong to long
152 ob_reset cap
153 if eq get vwld_attached 0 0
154 ob_puts vwld_j_unatt
155 else
156 ob_puts vwld_j_a1
157 ob_put_u64 get vwld_res_cnt 0
158 ob_puts vwld_j_a2
159 ob_put_u64 get vwld_obj_cnt 0
160 ob_puts vwld_j_a3
161 ob_put_u64 get vwld_rxn_cnt 0
162 ob_puts vwld_j_a4
163 ob_put_u64 get vwld_pub_tail 0
164 ob_puts vwld_j_a5
165 for i ulong 32
166 ob_put_hex_byte ulong get vwld_digest i
167 end
168 ob_puts vwld_j_a6
169 end
170 if ne get v_ob_ovf 0 0
171 ret -1
172 end
173 ret long get v_ob_len 0
174end