From 882b0be82789e0cab9eed009c044d14253ccea25 Mon Sep 17 00:00:00 2001 From: portersky Date: Sat, 29 Aug 2026 14:31:50 +0200 Subject: [PATCH] style: use east const in the C API header Convert the remaining west-const declarations in xone_api.h to east const so the whole file matches the controller functions added later. Update the AGENTS.md C bridge section: east const applies to the C header too; only trailing returns are exempt. Co-Authored-By: qwen3.8-27b@q3_k_xl: converted C API header to east const --- AGENTS.md | 4 ++-- CMakeLists.txt | 2 +- include/app/xone_api.h | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d2abdef..f01901e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -133,8 +133,8 @@ the custom scripts instead of system-installed packages. - Pure C only: no C++ syntax. The header is imported into Swift via `-import-objc-header`, so it must compile as C. -- Standard C declaration style; trailing returns and east const do not - apply here. +- Standard C declaration style with east const (e.g. `char const*`); + trailing returns do not apply here. - Use `stdbool.h` types so Swift sees `Bool`. ## Shell Scripts diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b96123..3ef95a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ if(NOT CMAKE_GENERATOR MATCHES "^(Ninja|Xcode)$") endif() cmake_minimum_required(VERSION 3.21) -project(xone_macos VERSION 0.1.18 LANGUAGES CXX Swift) +project(xone_macos VERSION 0.1.19 LANGUAGES CXX Swift) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/include/app/xone_api.h b/include/app/xone_api.h index 6b34a68..ace592d 100644 --- a/include/app/xone_api.h +++ b/include/app/xone_api.h @@ -15,7 +15,7 @@ extern "C" { #endif // Human-readable version string of the protocol stack. -const char *xone_version(void); +char const *xone_version(void); // TRUE if an Xbox Wireless Dongle is connected, FALSE otherwise. bool xone_dongle_present(void); @@ -41,29 +41,29 @@ xone_dongle *xone_open(void); // returns 0 once started, -1 if the session is busy or already ready. If // firmware_path is NULL, the common upstream image // (firmware/xow_dongle.bin) is used. -int xone_start(xone_dongle *d, const char *firmware_path); +int xone_start(xone_dongle *d, char const *firmware_path); // Close the session and release the dongle. Waits for any in-progress start. void xone_close(xone_dongle *d); // Current session state (XONE_STATE_*). -int xone_state(const xone_dongle *d); +int xone_state(xone_dongle const *d); // Human-readable error from the last failed operation. Empty string if none. -const char *xone_error(const xone_dongle *d); +char const *xone_error(xone_dongle const *d); // Product ID of the connected dongle (e.g. 0x02E6). -uint16_t xone_pid(const xone_dongle *d); +uint16_t xone_pid(xone_dongle const *d); // Chip ID from EFUSE (e.g. 0x7612 for MT7612). 0 if unknown. -uint16_t xone_chip_id(const xone_dongle *d); +uint16_t xone_chip_id(xone_dongle const *d); // MAC address from EFUSE as "xx:xx:xx:xx:xx:xx". Valid until xone_close(). -const char *xone_mac_address(const xone_dongle *d); +char const *xone_mac_address(xone_dongle const *d); // Build string of the loaded firmware image (e.g. "201703281033____"). // Empty string if the firmware was not loaded. Valid until xone_close(). -const char *xone_firmware_build(const xone_dongle *d); +char const *xone_firmware_build(xone_dongle const *d); // Number of connected controllers. int xone_controller_count(xone_dongle const *d);