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 / seed / omc / sites / found-ca_st-1.om

143 lines · 2652 bytes Raw Blame History
1note sites: found by a one-token change of a tracked program (121 to 300 lines); reaches the omc error site in ca_st (code 19)
2note SC1-Q API and status contract frozen in README.md. Raw structs are trusted not sealed.
3struct bqty val ulong cap ulong end
4struct qobj ident ulong ver ulong extent ulong end
5struct qslic ident ulong ver ulong off ulong count ulong end
6
7fn qword out edit bqty raw ulong cap ulong to int
8if gt raw cap
9ret int 3
10end
11put out val raw
12put out cap cap
13ret int 0
14end
15
16fn qsigned out edit bqty raw long cap ulong to int
17if lt raw long 0
18ret int 2
19end
20ret qword out ulong raw cap
21end
22
23fn qvalid a view bqty to int
24if gt get a val get a cap
25ret int 1
26end
27ret int 0
28end
29
30fn qpair a view bqty b view bqty to int
31if ne qvalid a int 0
32ret int 1
33end
34if ne qvalid b int 0
35ret int 1
36end
37if ne get a cap get b cap
38ret int 2
39end
40ret int 0
41end
42
43fn qadd out edit bqty a view bqty b view bqty to int
44rc = qpair a a
45if ne rc int 0
46ret rc
47end
48note Q1_ADD_GUARD mutation removes this check only.
49if gt get b val sub get a cap get a val
50ret int 3
51end
52put out val add get a val get b val
53put out cap get a cap
54ret int 0
55end
56
57fn qsub out edit bqty a view bqty b view bqty to int
58rc = qpair a b
59if ne rc int 0
60ret rc
61end
62if gt get b val get a val
63ret int 3
64end
65put out val sub get a val get b val
66put out cap get a cap
67ret int 0
68end
69
70fn qmul out edit bqty a view bqty b view bqty to int
71rc = qpair a b
72if ne rc int 0
73ret rc
74end
75note Q4_MUL_GUARD mutation removes this check only.
76if ne get a val ulong 0
77if gt get b val div get a cap get a val
78ret int 3
79end
80end
81put out val mul get a val get b val
82put out cap get a cap
83ret int 0
84end
85
86fn qnarrow out edit bqty a view bqty cap ulong to int
87rc = qvalid a
88if ne rc int 0
89ret rc
90end
91if gt cap get a cap
92ret int 2
93end
94if gt get a val cap
95ret int 3
96end
97put out val get a val
98put out cap cap
99ret int 0
100end
101
102fn qnext out edit bqty a view bqty to int
103rc = qvalid a
104if ne rc int 0
105ret rc
106end
107if eq get a val get a cap
108ret int 3
109end
110put out val add get a val ulong 1
111put out cap get a cap
112ret int 0
113end
114
115fn qtyslice out edit qslic off view bqty count view bqty expect view qobj current view qobj to int
116if ne get expect ident get current ident
117ret int 4
118end
119if ne get expect ver get current ver
120ret int 4
121end
122if ne get expect extent get current extent
123ret int 4
124end
125rc = qpair off count
126if ne rc int 0
127ret rc
128end
129if ne get off cap get current extent
130ret int 2
131end
132if gt get off val get current extent
133ret int 3
134end
135if gt get count val sub get current extent get off val
136ret int 3
137end
138put out ident get current ident
139put out ver get current ver
140put out off get off val
141put out count get count val
142ret int 0
143end