anth64 f331970ae2 refactor: optimize file watching and fix cross-platform reliability issues
Refactor memory allocation patterns:
- Replace realloc-in-loop with count-then-allocate pattern across all platforms
- Eliminate arbitrary buffer sizes (e.g., malloc(8 * ...)) in favor of exact counts
- Reduce allocation overhead by pre-counting items before malloc

Fix Windows file watching:
- Replace unreliable FindFirstChangeNotification with directory handle approach
- Add is_file_ready() to prevent events while compiler is still writing files
- Preserve timestamps when file is locked to retry on next poll
- Fix do-while loop in platform_directory_init_scan (was skipping first file)

Fix Linux inotify event handling:
- Consolidate DELETE+CREATE pairs into single RELOAD event
- Prevents duplicate events when compiler uses temp-file-and-rename pattern

Fix BSD/macOS kqueue implementation:
- Remove realloc loops from update_watches() and watch initialization
- Pre-count files before allocating file descriptor arrays

All platforms now correctly handle:
- Compiler overwrites (temp file operations)
- Manual copy/move operations
- Explicit file deletions

Tested on Linux, Windows 10, and FreeBSD.
2026-01-23 23:39:24 +01:00
2025-12-20 08:22:41 -05:00
2025-10-08 19:01:44 +02:00
2025-09-28 14:21:06 +00:00

stk (Stalwart Toolkit)

stk is a lightweight, modular toolkit for building games and game engines. It provides a portable foundation for dynamically loading modules, native or WASM, without enforcing any architecture or design choices.

It is designed to run on modern systems running POSIX and Windows.


Key Features

  • Dynamic module loading (native .so / .dll)
  • Hot-swapping of modules at runtime
  • Optional WASM support for multi-language modules
  • Developer tools: lightweight metadata, logging/tracing, and dependency management
  • Minimal, portable API

stk is non-opinionated: developers control architecture, engine design, and game logic while relying on a predictable, lean foundation.

S
Description
A lightweight, portable, modular toolkit for building games and game engines.
Readme MPL-2.0 244 KiB
Languages
C 88.3%
Makefile 10.8%
Shell 0.9%