diff options
Diffstat (limited to 'src/root.zig')
| -rw-r--r-- | src/root.zig | 22 |
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; + } }; |