1///|
2#external
3pub type Pointer[_]
4
5///|
6pub fn[T, U] type Pointer[_]
Pointer::cast(self : type Pointer[_]
Pointer[type parameter T
T]) -> type Pointer[_]
Pointer[type parameter U
U] = "%identity"
7
8///|
9extern "c" fn type Pointer[_]
Pointer::_is_null(ptr : type Pointer[_]
Pointer[Unit
Unit]) -> Bool
Bool = "moonbit_c_is_null"
10
11///|
12pub fn[T] (self : Pointer[T]) -> Bool
is_null(Pointer[T]
self : type Pointer[_]
Pointer[type parameter T
T]) -> Bool
Bool {
13 Pointer[T]
self.(self : Pointer[T]) -> Pointer[Unit]
cast().(ptr : Pointer[Unit]) -> Bool
_is_null()
14}
15
16///|
17extern "c" fn type Pointer[_]
Pointer::_null() -> type Pointer[_]
Pointer[Unit
Unit] = "moonbit_c_null"
18
19///|
20pub fn[T] type Pointer[_]
Pointer::() -> Pointer[T]
null() -> type Pointer[_]
Pointer[type parameter T
T] {
21 type Pointer[_]
Pointer::() -> Pointer[Unit]
_null().(self : Pointer[Unit]) -> Pointer[T]
cast()
22}
23
24///|
25pub fn[T] () -> Pointer[T]
null() -> type Pointer[_]
Pointer[type parameter T
T] {
26 type Pointer[_]
Pointer::() -> Pointer[Unit]
_null().(self : Pointer[Unit]) -> Pointer[T]
cast()
27}
28
29///|
30pub extern "c" fn type Pointer[_]
Pointer::op_equal(
31 self : type Pointer[_]
Pointer[Unit
Unit],
32 other : type Pointer[_]
Pointer[Unit
Unit]
33) -> Bool
Bool = "moonbit_c_pointer_equal"
34
35///|
36pub impl[T] trait Eq {
op_equal(Self, Self) -> Bool
}
Trait for types whose elements can test for equality
Eq for type Pointer[_]
Pointer[type parameter T
T] with (self : Pointer[T], other : Pointer[T]) -> Bool
op_equal(
37 Pointer[T]
self : type Pointer[_]
Pointer[type parameter T
T],
38 Pointer[T]
other : type Pointer[_]
Pointer[type parameter T
T]
39) -> Bool
Bool {
40 Pointer[T]
self.(self : Pointer[T]) -> Pointer[Unit]
cast().(self : Pointer[Unit], other : Pointer[Unit]) -> Bool
op_equal(Pointer[T]
other.(self : Pointer[T]) -> Pointer[Unit]
cast())
41}
42
43///|
44pub fn[T : trait Load {
load(Pointer[Self], Int) -> Self
}
Load] type Pointer[_]
Pointer::(self : Pointer[T], index : Int) -> T
op_get(Pointer[T]
self : type Pointer[_]
Pointer[type parameter T
T], Int
index : Int
Int) -> type parameter T
T {
45 type parameter
T::(Pointer[T], Int) -> T
load(Pointer[T]
self, Int
index)
46}
47
48///|
49pub fn[T : trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store] type Pointer[_]
Pointer::(self : Pointer[T], index : Int, value : T) -> Unit
op_set(
50 Pointer[T]
self : type Pointer[_]
Pointer[type parameter T
T],
51 Int
index : Int
Int,
52 T
value : type parameter T
T
53) -> Unit
Unit {
54 type parameter
T::(Pointer[T], Int, T) -> Unit
store(Pointer[T]
self, Int
index, T
value)
55}
56
57///|
58pub fn[T : trait Load {
load(Pointer[Self], Int) -> Self
}
Load] type Pointer[_]
Pointer::(self : Pointer[T], offset~ : Int = ..) -> T
load(Pointer[T]
self : type Pointer[_]
Pointer[type parameter T
T], Int
offset~ : Int
Int = 0) -> type parameter T
T {
59 type parameter
T::(Pointer[T], Int) -> T
load(Pointer[T]
self, Int
offset)
60}
61
62///|
63pub fn[T : trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store] type Pointer[_]
Pointer::(self : Pointer[T], offset~ : Int = .., value : T) -> Unit
store(
64 Pointer[T]
self : type Pointer[_]
Pointer[type parameter T
T],
65 Int
offset~ : Int
Int = 0,
66 T
value : type parameter T
T
67) -> Unit
Unit {
68 type parameter
T::(Pointer[T], Int, T) -> Unit
store(Pointer[T]
self, Int
offset, T
value)
69}
70
71///|
72pub(open) trait trait Load {
load(Pointer[Self], Int) -> Self
}
Load {
73 (Pointer[Self], Int) -> Self
load(type Pointer[_]
Pointer[type parameter Self
Self], Int
Int) -> type parameter Self
Self
74}
75
76///|
77extern "c" fn moonbit_c_load_byte(
78 pointer : type Pointer[_]
Pointer[Byte
Byte],
79 offset : Int
Int
80) -> Byte
Byte = "moonbit_c_load_byte"
81
82///|
83extern "c" fn moonbit_c_load_int16(
84 pointer : type Pointer[_]
Pointer[Int16
Int16],
85 offset : Int
Int
86) -> Int16
Int16 = "moonbit_c_load_int16"
87
88///|
89extern "c" fn moonbit_c_load_uint16(
90 pointer : type Pointer[_]
Pointer[UInt16
UInt16],
91 offset : Int
Int
92) -> UInt16
UInt16 = "moonbit_c_load_uint16"
93
94///|
95extern "c" fn moonbit_c_load_int(pointer : type Pointer[_]
Pointer[Int
Int], offset : Int
Int) -> Int
Int = "moonbit_c_load_int"
96
97///|
98extern "c" fn moonbit_c_load_uint(
99 pointer : type Pointer[_]
Pointer[UInt
UInt],
100 offset : Int
Int
101) -> UInt
UInt = "moonbit_c_load_uint"
102
103///|
104extern "c" fn moonbit_c_load_int64(
105 pointer : type Pointer[_]
Pointer[Int64
Int64],
106 offset : Int
Int
107) -> Int64
Int64 = "moonbit_c_load_int64"
108
109///|
110extern "c" fn moonbit_c_load_uint64(
111 pointer : type Pointer[_]
Pointer[UInt64
UInt64],
112 offset : Int
Int
113) -> UInt64
UInt64 = "moonbit_c_load_uint64"
114
115///|
116extern "c" fn moonbit_c_load_float(
117 pointer : type Pointer[_]
Pointer[Float
Float],
118 offset : Int
Int
119) -> Float
Float = "moonbit_c_load_float"
120
121///|
122extern "c" fn moonbit_c_load_double(
123 pointer : type Pointer[_]
Pointer[Double
Double],
124 offset : Int
Int
125) -> Double
Double = "moonbit_c_load_double"
126
127///|
128pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for Byte
Byte with (pointer : Pointer[Byte], offset : Int) -> Byte
load(Pointer[Byte]
pointer : type Pointer[_]
Pointer[Byte
Byte], Int
offset : Int
Int) -> Byte
Byte {
129 (pointer : Pointer[Byte], offset : Int) -> Byte
moonbit_c_load_byte(Pointer[Byte]
pointer, Int
offset)
130}
131
132///|
133pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for Int16
Int16 with (pointer : Pointer[Int16], offset : Int) -> Int16
load(Pointer[Int16]
pointer : type Pointer[_]
Pointer[Int16
Int16], Int
offset : Int
Int) -> Int16
Int16 {
134 (pointer : Pointer[Int16], offset : Int) -> Int16
moonbit_c_load_int16(Pointer[Int16]
pointer, Int
offset)
135}
136
137///|
138pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for UInt16
UInt16 with (pointer : Pointer[UInt16], offset : Int) -> UInt16
load(Pointer[UInt16]
pointer : type Pointer[_]
Pointer[UInt16
UInt16], Int
offset : Int
Int) -> UInt16
UInt16 {
139 (pointer : Pointer[UInt16], offset : Int) -> UInt16
moonbit_c_load_uint16(Pointer[UInt16]
pointer, Int
offset)
140}
141
142///|
143pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for Int
Int with (pointer : Pointer[Int], offset : Int) -> Int
load(Pointer[Int]
pointer : type Pointer[_]
Pointer[Int
Int], Int
offset : Int
Int) -> Int
Int {
144 (pointer : Pointer[Int], offset : Int) -> Int
moonbit_c_load_int(Pointer[Int]
pointer, Int
offset)
145}
146
147///|
148pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for UInt
UInt with (pointer : Pointer[UInt], offset : Int) -> UInt
load(Pointer[UInt]
pointer : type Pointer[_]
Pointer[UInt
UInt], Int
offset : Int
Int) -> UInt
UInt {
149 (pointer : Pointer[UInt], offset : Int) -> UInt
moonbit_c_load_uint(Pointer[UInt]
pointer, Int
offset)
150}
151
152///|
153pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for Int64
Int64 with (pointer : Pointer[Int64], offset : Int) -> Int64
load(Pointer[Int64]
pointer : type Pointer[_]
Pointer[Int64
Int64], Int
offset : Int
Int) -> Int64
Int64 {
154 (pointer : Pointer[Int64], offset : Int) -> Int64
moonbit_c_load_int64(Pointer[Int64]
pointer, Int
offset)
155}
156
157///|
158pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for UInt64
UInt64 with (pointer : Pointer[UInt64], offset : Int) -> UInt64
load(Pointer[UInt64]
pointer : type Pointer[_]
Pointer[UInt64
UInt64], Int
offset : Int
Int) -> UInt64
UInt64 {
159 (pointer : Pointer[UInt64], offset : Int) -> UInt64
moonbit_c_load_uint64(Pointer[UInt64]
pointer, Int
offset)
160}
161
162///|
163pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for Float
Float with (pointer : Pointer[Float], offset : Int) -> Float
load(Pointer[Float]
pointer : type Pointer[_]
Pointer[Float
Float], Int
offset : Int
Int) -> Float
Float {
164 (pointer : Pointer[Float], offset : Int) -> Float
moonbit_c_load_float(Pointer[Float]
pointer, Int
offset)
165}
166
167///|
168pub impl trait Load {
load(Pointer[Self], Int) -> Self
}
Load for Double
Double with (pointer : Pointer[Double], offset : Int) -> Double
load(Pointer[Double]
pointer : type Pointer[_]
Pointer[Double
Double], Int
offset : Int
Int) -> Double
Double {
169 (pointer : Pointer[Double], offset : Int) -> Double
moonbit_c_load_double(Pointer[Double]
pointer, Int
offset)
170}
171
172///|
173extern "c" fn moonbit_c_store_byte(
174 pointer : type Pointer[_]
Pointer[Byte
Byte],
175 offset : Int
Int,
176 value : Byte
Byte
177) -> Unit
Unit = "moonbit_c_store_byte"
178
179///|
180extern "c" fn moonbit_c_store_int16(
181 pointer : type Pointer[_]
Pointer[Int16
Int16],
182 offset : Int
Int,
183 value : Int16
Int16
184) -> Unit
Unit = "moonbit_c_store_int16"
185
186///|
187extern "c" fn moonbit_c_store_uint16(
188 pointer : type Pointer[_]
Pointer[UInt16
UInt16],
189 offset : Int
Int,
190 value : UInt16
UInt16
191) -> Unit
Unit = "moonbit_c_store_uint16"
192
193///|
194extern "c" fn moonbit_c_store_int(
195 pointer : type Pointer[_]
Pointer[Int
Int],
196 offset : Int
Int,
197 value : Int
Int
198) -> Unit
Unit = "moonbit_c_store_int"
199
200///|
201extern "c" fn moonbit_c_store_uint(
202 pointer : type Pointer[_]
Pointer[UInt
UInt],
203 offset : Int
Int,
204 value : UInt
UInt
205) -> Unit
Unit = "moonbit_c_store_uint"
206
207///|
208extern "c" fn moonbit_c_store_int64(
209 pointer : type Pointer[_]
Pointer[Int64
Int64],
210 offset : Int
Int,
211 value : Int64
Int64
212) -> Unit
Unit = "moonbit_c_store_int64"
213
214///|
215extern "c" fn moonbit_c_store_uint64(
216 pointer : type Pointer[_]
Pointer[UInt64
UInt64],
217 offset : Int
Int,
218 value : UInt64
UInt64
219) -> Unit
Unit = "moonbit_c_store_uint64"
220
221///|
222extern "c" fn moonbit_c_store_float(
223 pointer : type Pointer[_]
Pointer[Float
Float],
224 offset : Int
Int,
225 value : Float
Float
226) -> Unit
Unit = "moonbit_c_store_float"
227
228///|
229extern "c" fn moonbit_c_store_double(
230 pointer : type Pointer[_]
Pointer[Double
Double],
231 offset : Int
Int,
232 value : Double
Double
233) -> Unit
Unit = "moonbit_c_store_double"
234
235///|
236trait trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store {
237 (Pointer[Self], Int, Self) -> Unit
store(type Pointer[_]
Pointer[type parameter Self
Self], Int
Int, type parameter Self
Self) -> Unit
Unit
238}
239
240///|
241pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for Byte
Byte with (pointer : Pointer[Byte], offset : Int, value : Byte) -> Unit
store(
242 Pointer[Byte]
pointer : type Pointer[_]
Pointer[Byte
Byte],
243 Int
offset : Int
Int,
244 Byte
value : Byte
Byte
245) -> Unit
Unit {
246 (pointer : Pointer[Byte], offset : Int, value : Byte) -> Unit
moonbit_c_store_byte(Pointer[Byte]
pointer, Int
offset, Byte
value)
247}
248
249///|
250pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for Int16
Int16 with (pointer : Pointer[Int16], offset : Int, value : Int16) -> Unit
store(
251 Pointer[Int16]
pointer : type Pointer[_]
Pointer[Int16
Int16],
252 Int
offset : Int
Int,
253 Int16
value : Int16
Int16
254) -> Unit
Unit {
255 (pointer : Pointer[Int16], offset : Int, value : Int16) -> Unit
moonbit_c_store_int16(Pointer[Int16]
pointer, Int
offset, Int16
value)
256}
257
258///|
259pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for UInt16
UInt16 with (pointer : Pointer[UInt16], offset : Int, value : UInt16) -> Unit
store(
260 Pointer[UInt16]
pointer : type Pointer[_]
Pointer[UInt16
UInt16],
261 Int
offset : Int
Int,
262 UInt16
value : UInt16
UInt16
263) -> Unit
Unit {
264 (pointer : Pointer[UInt16], offset : Int, value : UInt16) -> Unit
moonbit_c_store_uint16(Pointer[UInt16]
pointer, Int
offset, UInt16
value)
265}
266
267///|
268pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for Int
Int with (pointer : Pointer[Int], offset : Int, value : Int) -> Unit
store(
269 Pointer[Int]
pointer : type Pointer[_]
Pointer[Int
Int],
270 Int
offset : Int
Int,
271 Int
value : Int
Int
272) -> Unit
Unit {
273 (pointer : Pointer[Int], offset : Int, value : Int) -> Unit
moonbit_c_store_int(Pointer[Int]
pointer, Int
offset, Int
value)
274}
275
276///|
277pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for UInt
UInt with (pointer : Pointer[UInt], offset : Int, value : UInt) -> Unit
store(
278 Pointer[UInt]
pointer : type Pointer[_]
Pointer[UInt
UInt],
279 Int
offset : Int
Int,
280 UInt
value : UInt
UInt
281) -> Unit
Unit {
282 (pointer : Pointer[UInt], offset : Int, value : UInt) -> Unit
moonbit_c_store_uint(Pointer[UInt]
pointer, Int
offset, UInt
value)
283}
284
285///|
286pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for Int64
Int64 with (pointer : Pointer[Int64], offset : Int, value : Int64) -> Unit
store(
287 Pointer[Int64]
pointer : type Pointer[_]
Pointer[Int64
Int64],
288 Int
offset : Int
Int,
289 Int64
value : Int64
Int64
290) -> Unit
Unit {
291 (pointer : Pointer[Int64], offset : Int, value : Int64) -> Unit
moonbit_c_store_int64(Pointer[Int64]
pointer, Int
offset, Int64
value)
292}
293
294///|
295pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for UInt64
UInt64 with (pointer : Pointer[UInt64], offset : Int, value : UInt64) -> Unit
store(
296 Pointer[UInt64]
pointer : type Pointer[_]
Pointer[UInt64
UInt64],
297 Int
offset : Int
Int,
298 UInt64
value : UInt64
UInt64
299) -> Unit
Unit {
300 (pointer : Pointer[UInt64], offset : Int, value : UInt64) -> Unit
moonbit_c_store_uint64(Pointer[UInt64]
pointer, Int
offset, UInt64
value)
301}
302
303///|
304pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for Float
Float with (pointer : Pointer[Float], offset : Int, value : Float) -> Unit
store(
305 Pointer[Float]
pointer : type Pointer[_]
Pointer[Float
Float],
306 Int
offset : Int
Int,
307 Float
value : Float
Float
308) -> Unit
Unit {
309 (pointer : Pointer[Float], offset : Int, value : Float) -> Unit
moonbit_c_store_float(Pointer[Float]
pointer, Int
offset, Float
value)
310}
311
312///|
313pub impl trait Store {
store(Pointer[Self], Int, Self) -> Unit
}
Store for Double
Double with (pointer : Pointer[Double], offset : Int, value : Double) -> Unit
store(
314 Pointer[Double]
pointer : type Pointer[_]
Pointer[Double
Double],
315 Int
offset : Int
Int,
316 Double
value : Double
Double
317) -> Unit
Unit {
318 (pointer : Pointer[Double], offset : Int, value : Double) -> Unit
moonbit_c_store_double(Pointer[Double]
pointer, Int
offset, Double
value)
319}
320