Skip to content

Commit 62b7add

Browse files
committed
fixed: cbindgen
1 parent 0f553c4 commit 62b7add

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

core/onyx/cbindgen.onyx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ compile_c_file :: (
158158
}
159159

160160
if flags != "" {
161-
for string.split(flags, ' ') do args << it
161+
for str.split(flags, ' ') do args << it
162162
}
163163

164164
args << "-o"
@@ -233,14 +233,14 @@ compile_c_file :: (
233233
io.write(writer, type_encoding(method_info.return_type))
234234
io.write(writer, ")) {\n")
235235

236-
method_name := slice.find_opt(ff.tags, [it](it.type == customize))
236+
method_name := Slice.find_opt(ff.tags, [it](it.type == customize))
237237
->transform(x => misc.any_as(x, customize).symbol_name) ?? ff.name
238238

239239
if name_map != null_proc {
240240
method_name = name_map(method_name)
241241
}
242242

243-
switch slice.find_opt(ff.tags, [it](it.type == func_body))
243+
switch Slice.find_opt(ff.tags, [it](it.type == func_body))
244244
->transform(x => misc.any_as(x, func_body).body)
245245
{
246246
case .Some as body {
@@ -251,7 +251,7 @@ compile_c_file :: (
251251
case .None {
252252
print_body(
253253
writer, method_name, method_info, cast_map,
254-
slice.some(ff.tags, [it](
254+
Slice.some(ff.tags, [it](
255255
misc.any_as(*it, type_expr)
256256
|> Optional.from_ptr()
257257
|> Optional.transform(x => x == last_arg_is_return_value)
@@ -305,7 +305,7 @@ compile_c_file :: (
305305
map_to_dyncall(p, &call_signature)
306306
}
307307

308-
string.append(&call_signature, ")")
308+
dyn_str.append(&call_signature, ")")
309309
map_to_dyncall(func_info.return_type, &call_signature)
310310

311311
io.write_format(&callw, "(void *) runtime->wasm_func_from_idx(runtime->wasm_func_table, P({}, i32), \"{}\")", param_num, cast(str) call_signature)
@@ -319,21 +319,21 @@ compile_c_file :: (
319319
}
320320

321321
switch p {
322-
case void do string.append(call_signature, "v")
323-
case bool do string.append(call_signature, "B")
324-
case i8 do string.append(call_signature, "c")
325-
case u8 do string.append(call_signature, "C")
326-
case i16 do string.append(call_signature, "s")
327-
case u16 do string.append(call_signature, "S")
328-
case i32 do string.append(call_signature, "i")
329-
case u32 do string.append(call_signature, "I")
330-
case i64 do string.append(call_signature, "l")
331-
case u64 do string.append(call_signature, "L")
332-
case f32 do string.append(call_signature, "f")
333-
case f64 do string.append(call_signature, "d")
322+
case void do dyn_str.append(call_signature, "v")
323+
case bool do dyn_str.append(call_signature, "B")
324+
case i8 do dyn_str.append(call_signature, "c")
325+
case u8 do dyn_str.append(call_signature, "C")
326+
case i16 do dyn_str.append(call_signature, "s")
327+
case u16 do dyn_str.append(call_signature, "S")
328+
case i32 do dyn_str.append(call_signature, "i")
329+
case u32 do dyn_str.append(call_signature, "I")
330+
case i64 do dyn_str.append(call_signature, "l")
331+
case u64 do dyn_str.append(call_signature, "L")
332+
case f32 do dyn_str.append(call_signature, "f")
333+
case f64 do dyn_str.append(call_signature, "d")
334334
case _ {
335335
if is_pointer(p) {
336-
string.append(call_signature, "p")
336+
dyn_str.append(call_signature, "p")
337337
} else {
338338
panic(tprintf("Unsupported type in function pointer: {}", p))
339339
}
@@ -343,7 +343,7 @@ compile_c_file :: (
343343

344344
} elseif it_info.kind == .Struct && it_info->as_struct().constructed_from != cptr {
345345
param_type := it
346-
name := slice.find_opt(cast_map, [x](x.type == param_type))
346+
name := Slice.find_opt(cast_map, [x](x.type == param_type))
347347
->transform(x => x.name)
348348
->expect(tprintf("Structures used as parameter arguments MUST have a definition in the 'cast_map' in '{}'.", method_name))
349349

@@ -371,13 +371,13 @@ compile_c_file :: (
371371
call_str := io.buffer_stream_to_str(call)
372372
call_str = call_str[0 .. call_str.count - 2]
373373
if last_arg_is_return_value {
374-
return_type := slice.get(method_info.parameter_types, -1)
374+
return_type := Slice.get(method_info.parameter_types, -1)
375375
if return_type->info().kind != .Pointer {
376376
panic(tprintf("last_arg_is_return_value requires last parameter to be a pointer. ({} in {})", method_info.parameter_types, method_name))
377377
}
378378

379379
return_type = return_type->info()->as_pointer().to
380-
type_name := slice.find_opt(cast_map, [x](x.type == return_type))
380+
type_name := Slice.find_opt(cast_map, [x](x.type == return_type))
381381
->transform(x => x.name)
382382
->expect(tprintf("Types used as last argument return values MUST have a definition in the 'cast_map' in '{}'.", method_name))
383383

0 commit comments

Comments
 (0)