diff options
| author | dam <dam@gudinoff> | 2025-02-13 23:15:35 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2025-02-15 23:43:27 +0000 |
| commit | 4ef4a502b09ce8a62bec205b1712736d5b2a46ee (patch) | |
| tree | e9dcf44a5fd6b8bd1f515cc55f37ca1e2875af50 | |
| parent | 70b329f96d85db5bbe28c5a85c5d515660437a6c (diff) | |
| download | task-time-tracker-4ef4a502b09ce8a62bec205b1712736d5b2a46ee.tar.zst task-time-tracker-4ef4a502b09ce8a62bec205b1712736d5b2a46ee.zip | |
Release for macOS.
| -rw-r--r-- | modules/TUI/unix.jai | 48 | ||||
| -rw-r--r-- | ttt.jai | 12 |
2 files changed, 32 insertions, 28 deletions
diff --git a/modules/TUI/unix.jai b/modules/TUI/unix.jai index 9208e4b..7cd457e 100644 --- a/modules/TUI/unix.jai +++ b/modules/TUI/unix.jai @@ -4,9 +4,21 @@ #import "System"; #import "POSIX"; + // More info about the structs and enums at: + // LINUX : https://sourceware.org/git/glibc.git + // MACOS : https://github.com/apple/darwin-xnu + + #if OS == { + case .LINUX; + TCFLAG_T :: u32; + SPEED_T :: u32; + + case .MACOS; + TCFLAG_T :: u64; + SPEED_T :: u64; + } + // Queue selector used in tcflush(...). - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-struct.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html Queue_Selector :: enum s32 { #if OS == { case .LINUX; @@ -22,17 +34,13 @@ } // Optional actions used in tcsetattr(...). - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-tcflow.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html Optional_Actions :: enum s32 { TCSANOW :: 0; // Change immediately. TCSADRAIN :: 1; // Change when pending output is written. TCSAFLUSH :: 2; // Flush pending input before changing. } - + // Terminal control (struct termios). - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-struct.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html Terminal_IO_Mode :: struct { #if OS == { @@ -47,16 +55,16 @@ c_oflag : Output_Modes; // Output mode flags. c_cflag : Control_Modes; // Control modes flags. c_lflag : Local_Modes; // Local modes flags. - c_line : u8; // Line discipline. + #if OS == .LINUX { + c_line : u8; // Line discipline. + } c_cc : [NCCS]Control_Chars; // Control characters. - c_ispeed : u32; // Input speed (baud rates). - c_ospeed : u32; // Output speed (baud rates). + c_ispeed : SPEED_T; // Input speed (baud rates). + c_ospeed : SPEED_T; // Output speed (baud rates). } // Input modes. - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-c_iflag.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html - Input_Modes :: enum_flags u32 { + Input_Modes :: enum_flags TCFLAG_T { IGNBRK :: 0x00000001; // Ignore break condition. BRKINT :: 0x00000002; // Signal interrupt on break. IGNPAR :: 0x00000004; // Ignore characters with parity errors. @@ -82,9 +90,7 @@ } // Output modes. - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-c_oflag.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html - Output_Modes :: enum_flags u32 { + Output_Modes :: enum_flags TCFLAG_T { #if OS == { case .LINUX; @@ -106,9 +112,7 @@ } // Control modes. - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-c_cflag.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html - Control_Modes :: enum u32 { + Control_Modes :: enum TCFLAG_T { #if OS == { case .LINUX; @@ -140,9 +144,7 @@ } // Local modes. - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-c_lflag.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html - Local_Modes :: enum_flags u32 { + Local_Modes :: enum_flags TCFLAG_T { #if OS == { case .LINUX; @@ -170,8 +172,6 @@ } // Control Characters - // LINUX : https://sourceware.org/git/glibc.git -> ./sysdeps/unix/sysv/linux/bits/termios-c_cc.h - // MACOS : https://opensource.apple.com/source/xnu/xnu-792/bsd/sys/termios.h.auto.html Control_Chars :: enum u8 { // Unused consts: // VINTR, VQUIT, VERASE, VKILL, VEOF, VSWTC, VSTART, VSTOP, VSUSP, VEOL, VREPRINT, VDISCARD, VWERASE, VLNEXT, VEOL2 @@ -1,4 +1,4 @@ -// Copyright 2024 Daniel Almeida Martins +// Copyright 2025 Daniel Almeida Martins // License GPL-3.0-or-later DEBUG :: false; @@ -14,8 +14,8 @@ DEBUG :: false; #import "UTF8"; TUI :: #import "TUI"(COLOR_MODE_BITS=4); -VERSION :: "3.2"; // Use only 3 chars (to fit layouts). -YEAR :: "2024"; +VERSION :: "3.3"; // Use only 3 chars (to fit layouts). +YEAR :: "2025"; NUM_WEEK_DAYS :: 7; APP_FOLDER_NAME :: "task_time_tracker"; @@ -1244,7 +1244,11 @@ main :: () { case .LINUX; PATH_DELIMITER :: "/"; base_path = join(home_path, "/.local/share",, allocator = temporary_allocator); - + + case .MACOS; + PATH_DELIMITER :: "/"; + base_path = join(home_path, "/Library",, allocator = temporary_allocator); + case .WINDOWS; PATH_DELIMITER :: "\\"; base_path = join(home_path, "\\Appdata\\Roaming",, allocator = temporary_allocator); |
