aboutsummaryrefslogtreecommitdiff
path: root/src/zilch/Env/js.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-12 09:43:19 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-12 09:43:19 +0200
commit0b2af471b6d5dfc4eaf53639102c1b854bbb324b (patch)
treeaba3943b8c54d26d8552d0685d4178bc995d91c3 /src/zilch/Env/js.zig
parent812f547d84b5ce1a2924ae16f6257e4fd19efcc0 (diff)
first version of zilch
Diffstat (limited to 'src/zilch/Env/js.zig')
-rw-r--r--src/zilch/Env/js.zig22
1 files changed, 22 insertions, 0 deletions
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);
+}