greenfork / jzignet Goto Github PK
View Code? Open in Web Editor NEWZig library to connect Janet and Zig together
Home Page: https://git.sr.ht/~greenfork/jzignet
License: MIT License
Zig library to connect Janet and Zig together
Home Page: https://git.sr.ht/~greenfork/jzignet
License: MIT License
While it is not a tutorial on how to use Janet with Zig, it does come with a working repository.
https://www.1a-insec.net/blog/16-buy-janet-get-gc-free/
https://git.envs.net/iacore/janet-zig-test
Maybe you can put this in the project readme?
I don't understand why this is happening.
here's the program. res
is Janet nil
.
const std = @import("std");
const janet = @import("janet");
pub fn main() !void {
try janet.init();
const env = janet.Environment.coreEnv(null);
// var env_ = janet.Table.initDynamic(0);
// env_.proto = core_env.toTable();
// const env = env_.toEnvironment();
// janet.gcRoot(env_.wrap()); // this doesn't fix the problem either
_ = try env.doString("(import spork/sh)", "embed");
_ = try env.doString(
\\(pp (sh/exec-slurp "uname"))
, "embed");
const res = try env.doString(
\\(sh/exec-slurp "uname")
, "embed");
_ = res;
@breakpoint();
}
To reproduce this problem:
First clone the repo
git clone https://github.com/iacore/janet-graphical-repl -b f3ceb4e
here's what I see
user@x17 ~/c/g/janet-graphical-repl (debug)
❯ zig build
user@x17 ~/c/g/janet-graphical-repl (debug)
❯ lldb zig-out/bin/janet-dvui
(lldb) target create "zig-out/bin/janet-dvui"
Current executable set to '/home/user/computing/gui/janet-graphical-repl/zig-out/bin/janet-dvui' (x86_64).
(lldb) r
Process 26114 launched: '/home/user/computing/gui/janet-graphical-repl/zig-out/bin/janet-dvui' (x86_64)
Process 26114 stopped and restarted: thread 1 received signal: SIGCHLD
"Linux"
Process 26114 stopped and restarted: thread 1 received signal: SIGCHLD
Process 26114 stopped
* thread #1, name = 'janet-dvui', stop reason = signal SIGTRAP
frame #0: 0x000000000027d70e janet-dvui`main.main at main.zig:20:5
17 \\(sh/exec-slurp "uname")
18 , "embed");
19 _ = res;
-> 20 @breakpoint();
21 }
(lldb) p res
(janet.Janet__union_5967) $0 = (u64 = 18444633011384221697, i64 = -2111062325329919, number = NaN, pointer = 0xfff8800000000001)
(lldb)
0xfff8800000000001 is nil
If you don't believe me you can replace the line \\(sh/exec-slurp "uname")
with \\nil
.
To import a file outside of package path, create a symlink first, and import that symlink.
Example:
ln -s ../lib/foo lib_foo
_ = @import("lib_foo/build/zig");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.