bugfix: with new multi-pointer features
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 24 Mar 2023 04:33:46 +0000 (23:33 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 24 Mar 2023 04:33:46 +0000 (23:33 -0500)
core/encoding/ini.onyx
core/onyx/cbindgen.onyx
core/runtime/info/helper.onyx

index bfc66a5d46f9ac18042fbdb89ac55db4b3e09572..5c3fbb43d0178e06253f935c70ef24a39ac18834 100644 (file)
@@ -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;
index bcb11e468933d7c25ab042fd9bf89d0c7de2113e..4624d3815286bad31bbe36515dd18d6127b45abb 100644 (file)
@@ -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";
index ffa6c3fe140669485d2144a50379b7121f7e0381..13a97ec500a60b2940769b1da98477a03a5ebd4a 100644 (file)
@@ -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 {