From 0b2af471b6d5dfc4eaf53639102c1b854bbb324b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 12 Oct 2026 09:43:19 +0200 Subject: first version of zilch --- src/zilch/Env/js.zig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/zilch/Env/js.zig (limited to 'src/zilch/Env/js.zig') diff --git a/src/zilch/Env/js.zig b/src/zilch/Env/js.zig new file mode 100644 index 0000000..c1ff85d --- /dev/null +++ b/src/zilch/Env/js.zig @@ -0,0 +1,22 @@ +const std = @import("std"); +const Env = @import("root.zig"); + +pub extern "object_store" fn process( + [*]const Env.Call, + [*]const Env.Value, + [*]*Env.Value, + length: usize, +) void; + +export fn valueAllocString(value: *Env.Value, len: usize) [*]u8 { + const ptr: [*]u8 = @ptrCast(std.heap.wasm_allocator.alloc(u8, len) catch @panic("unable to allocate string")); + value.kind = .string; + value.value = .{ + .string = .{ + .ptr = ptr, + .len = len, + }, + }; + + return @constCast(value.value.string.ptr); +} -- cgit v1.2.3-70-g09d2