Compare commits
2 Commits
4a9d20f1ee
...
1a55433a2f
Author | SHA1 | Date |
---|---|---|
|
1a55433a2f | |
|
b2d341d340 |
|
@ -1,5 +1,8 @@
|
|||
output-vagrant
|
||||
*~
|
||||
*.old
|
||||
*.old.*
|
||||
*.bak
|
||||
.git
|
||||
.vagrant
|
||||
.secret
|
||||
|
@ -7,4 +10,4 @@ output-vagrant
|
|||
.idea
|
||||
# test
|
||||
.gradle
|
||||
build
|
||||
build
|
||||
|
|
|
@ -26,10 +26,10 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
for i := 0; i < len(dirs); i++ {
|
||||
for _, dir := range dirs {
|
||||
m := make(map[string]string)
|
||||
m["name"] = dirs[i].Name()
|
||||
if dirs[i].IsDir() {
|
||||
m["name"] = dir.Name()
|
||||
if dir.IsDir() {
|
||||
m["dir"] = "yes"
|
||||
} else {
|
||||
m["dir"] = "no"
|
||||
|
|
|
@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
|
|||
const exe = b.addExecutable(.{
|
||||
.name = "callingc",
|
||||
.root_source_file = b.path("src/callingc.zig"),
|
||||
.target = b.host,
|
||||
.target = b.graph.host,
|
||||
.optimize = b.standardOptimizeOption(.{}),
|
||||
});
|
||||
exe.addIncludePath(b.path("c-src"));
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
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();
|
||||
}
|
Loading…
Reference in New Issue