From: Brendan Hansen Date: Fri, 24 Mar 2023 04:33:46 +0000 (-0500) Subject: bugfix: with new multi-pointer features X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=6de6f5abf497a3696a5a72447a4d4f0d21a86e96;p=onyx.git bugfix: with new multi-pointer features --- diff --git a/core/encoding/ini.onyx b/core/encoding/ini.onyx index bfc66a5d..5c3fbb43 100644 --- a/core/encoding/ini.onyx +++ b/core/encoding/ini.onyx @@ -109,7 +109,7 @@ parse_ini_file_inner :: (r: &io.Reader, output_ptr: any) -> (IniParseResult, Ini error(msg = aprintf("'{}' is not a valid section name.", stripped_section_name)); } - active_item_ptr = cast(&u8) output.data + member.offset; + active_item_ptr = cast([&] u8) output.data + member.offset; active_item_type = member.type; parse_method := info.get_struct_method(active_item_type, "parse_ini"); @@ -137,7 +137,7 @@ parse_ini_file_inner :: (r: &io.Reader, output_ptr: any) -> (IniParseResult, Ini assert(r->read_byte() == #char "=", "expected ="); field := info.get_struct_member(active_item_type, string.strip_whitespace(field_name)); - target := cast(&u8) active_item_ptr + field.offset; + target := cast([&] u8) active_item_ptr + field.offset; value_string := r->read_until(#char "\n", allocator=context.temp_allocator); parsed_successfully := conv.parse_any(target, field.type, value_string); @@ -186,7 +186,7 @@ write_ini_file_inner :: (w: &io.Writer, output: any) -> bool { member_info := cast(&info.Type_Info_Struct) info.get_type_info(it.type); if member_info.kind != .Struct do continue; - member_data := cast(&u8) output.data + it.offset; + member_data := cast([&] u8) output.data + it.offset; if write_method := info.get_struct_method(it.type, "write_ini"); write_method != null { wm := *cast(&(rawptr, &io.Writer) -> bool) write_method.data; diff --git a/core/onyx/cbindgen.onyx b/core/onyx/cbindgen.onyx index bcb11e46..4624d381 100644 --- a/core/onyx/cbindgen.onyx +++ b/core/onyx/cbindgen.onyx @@ -301,6 +301,7 @@ compile_c_file :: ( } case .Pointer do return "i32"; // This will also have to depend on the pointer size... + case .Multi_Pointer do return "i32"; // This will also have to depend on the pointer size... case .Function do assert(false, "Passing functions between wasm and c is not yet supported."); case .Array do return "i32"; case .Slice do assert(false, "ASDFASDF"); @@ -352,6 +353,7 @@ compile_c_file :: ( } case .Pointer do return "WASM_I32"; // This will also have to depend on the pointer size... + case .Multi_Pointer do return "WASM_I32"; // This will also have to depend on the pointer size... case .Function do assert(false, "Passing functions between wasm and c is not yet supported."); case .Array do return "WASM_I32"; case .Slice do return "WASM_I32,WASM_I32"; diff --git a/core/runtime/info/helper.onyx b/core/runtime/info/helper.onyx index ffa6c3fe..13a97ec5 100644 --- a/core/runtime/info/helper.onyx +++ b/core/runtime/info/helper.onyx @@ -134,7 +134,7 @@ write_type_name :: (writer: &io.Writer, t: type_expr) { is_pointer :: (t: type_expr) -> bool { if t == rawptr do return true; info := get_type_info(t); - return info.kind == .Pointer; + return info.kind == .Pointer || info.kind == .Multi_Pointer; } size_of :: (t: type_expr) -> u32 {