From 16e730f540acfe6a0015464c81831cdfacaf107b Mon Sep 17 00:00:00 2001 From: Alexey Yerin Date: Sun, 28 May 2023 14:10:05 +0300 Subject: Initial commit --- bindings/glib/types.ha | 8 ++++++++ bindings/gobject/types.ha | 13 +++++++++++++ bindings/types/libc/types.ha | 27 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 bindings/glib/types.ha create mode 100644 bindings/gobject/types.ha create mode 100644 bindings/types/libc/types.ha (limited to 'bindings') diff --git a/bindings/glib/types.ha b/bindings/glib/types.ha new file mode 100644 index 0000000..c973570 --- /dev/null +++ b/bindings/glib/types.ha @@ -0,0 +1,8 @@ +// Boolean type used by GLib and related libraries, equivalent to gboolean in C. +export type boolean = uint; + +// True value of [[boolean]]. +export def TRUE: boolean = 1; + +// False value of [[boolean]]. +export def FALSE: boolean = 0; diff --git a/bindings/gobject/types.ha b/bindings/gobject/types.ha new file mode 100644 index 0000000..193bffd --- /dev/null +++ b/bindings/gobject/types.ha @@ -0,0 +1,13 @@ +use types::c; + +export type ValueUnion = union { + v_int: int, + v_uint: uint, + v_long: c::long, + v_ulong: c::ulong, + v_int64: i64, + v_uint64: u64, + v_float: f32, + v_double: f64, + v_pointer: *void, +}; diff --git a/bindings/types/libc/types.ha b/bindings/types/libc/types.ha new file mode 100644 index 0000000..bfb0dc0 --- /dev/null +++ b/bindings/types/libc/types.ha @@ -0,0 +1,27 @@ +use types::c; + +export type time_t = i64; + +export type tm = struct { + tm_sec: int, + tm_min: int, + tm_hour: int, + tm_mday: int, + tm_mon: int, + tm_year: int, + tm_wday: int, + tm_yday: int, + tm_isdst: int, +}; + +export type FILE = void; + +export type passwd = struct { + pw_name: *c::char, + pw_passwd: *c::char, + pw_uid: uint, + pw_gid: uint, + pw_gecos: *c::char, + pw_dir: *c::char, + pw_shell: *c::char, +}; -- cgit 1.3.0-6-gf8a5