summaryrefslogtreecommitdiff
path: root/src/root.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan.reiner@fticonsulting.com>2026-08-28 15:56:39 +0200
committerNathan Reiner <nathan.reiner@fticonsulting.com>2026-08-28 15:56:39 +0200
commit371308474ad0c6f01f64ab14166e32492a5f1c97 (patch)
tree5ef44463c6297cacc81387975f545a1ec6830ed0 /src/root.zig
parent28f47b8399c4f3c4a64921fb16e38e44e8ce749e (diff)
implement more interfaces
Diffstat (limited to 'src/root.zig')
-rw-r--r--src/root.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/root.zig b/src/root.zig
index 0e3d9e4..471267f 100644
--- a/src/root.zig
+++ b/src/root.zig
@@ -4,7 +4,29 @@ pub const Object = @import("Object.zig");
pub const Interpreter = @import("Interpreter.zig");
pub const Dict = @import("Dict.zig");
pub const Str = @import("Str.zig");
+pub const Tuple = @import("Tuple.zig");
+pub const Fn = @import("function.zig").Fn;
pub const Error = error {
Exception,
+ IndexError,
+};
+
+pub const conversion = struct {
+ fn PtrFromCPtr(T: type) type {
+ const info = @typeInfo(T);
+ return *info.pointer.child;
+ }
+
+ pub fn Ptr(value: anytype) Error!PtrFromCPtr(@TypeOf(value)) {
+ if (value) |ptr| {
+ return ptr;
+ }
+
+ return error.Exception;
+ }
+
+ pub fn success(value: c_int) Error!void {
+ if (value == -1) return error.Exception;
+ }
};