diff --git a/current/algorithms/callingc_zig/src/callingc.zig b/current/algorithms/callingc_zig/src/callingc.zig index 0619cef..14ed5ff 100644 --- a/current/algorithms/callingc_zig/src/callingc.zig +++ b/current/algorithms/callingc_zig/src/callingc.zig @@ -4,6 +4,15 @@ const callingc = @cImport({ @cInclude("callingc.h"); }); +const ErrorType = struct { name: []const u8, line: u32, pos: u32 }; + +pub fn dump_error_type(w: anytype) !void { + for (@typeInfo(ErrorType).@"struct".fields) |field| { + try w.print("Field name \n" ++ field.name); + } + try w.print("Started dumping error\n", .{}); +} + pub fn main() !void { const stdout_file = std.io.getStdOut().writer(); var bw = std.io.bufferedWriter(stdout_file); @@ -12,5 +21,9 @@ pub fn main() !void { const c = callingc.add_numbers(3, 4); try stdout.print("Hello World {d}!!\n", .{c}); + // const ename = "Ala"; + // const err: ErrorType = .{ .name = ename, .line = 123, .pos = 43 }; + // dump_error(stdout, err); + try dump_error_type(stdout); try bw.flush(); }