From 22d6cabcdcda8deaa250cb2aa045561b3f68bbde Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 30 Jan 2025 11:16:39 +0000 Subject: [PATCH] Add sdl3_asyncio.odin --- vendor/sdl3/sdl3_asyncio.odin | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 vendor/sdl3/sdl3_asyncio.odin diff --git a/vendor/sdl3/sdl3_asyncio.odin b/vendor/sdl3/sdl3_asyncio.odin new file mode 100644 index 000000000..c62700b9b --- /dev/null +++ b/vendor/sdl3/sdl3_asyncio.odin @@ -0,0 +1,45 @@ +package sdl3 + +import "core:c" + +AsyncIO :: struct {} + +AsyncIOTaskType :: enum c.int { + READ, /**< A read operation. */ + WRITE, /**< A write operation. */ + CLOSE, /**< A close operation. */ +} + +AsyncIOResult :: enum c.int { + COMPLETE, /**< request was completed without error */ + FAILURE, /**< request failed for some reason; check SDL_GetError()! */ + CANCELED, /**< request was canceled before completing. */ +} + +AsyncIOOutcome :: struct { + asyncio: ^AsyncIO, /**< what generated this task. This pointer will be invalid if it was closed! */ + type: AsyncIOTaskType, /**< What sort of task was this? Read, write, etc? */ + result: AsyncIOResult, /**< the result of the work (success, failure, cancellation). */ + buffer: rawptr, /**< buffer where data was read/written. */ + offset: Uint64, /**< offset in the SDL_AsyncIO where data was read/written. */ + bytes_requested: Uint64, /**< number of bytes the task was to read/write. */ + bytes_transferred: Uint64, /**< actual number of bytes that were read/written. */ + userdata: rawptr, /**< pointer provided by the app when starting the task */ +} + +AsyncIOQueue :: struct {} + +@(default_calling_convention="c", link_prefix="SDL_") +foreign lib { + AsyncIOFromFile :: proc(file: cstring, mode: cstring) -> ^AsyncIO --- + GetAsyncIOSize :: proc(asyncio: ^AsyncIO) -> Sint64 --- + ReadAsyncIO :: proc(asyncio: ^AsyncIO, ptr: rawptr, offset, size: Uint64, queue: ^AsyncIOQueue, userdata: rawptr) -> bool --- + WriteAsyncIO :: proc(asyncio: ^AsyncIO, ptr: rawptr, offset, size: Uint64, queue: ^AsyncIOQueue, userdata: rawptr) -> bool --- + CloseAsyncIO :: proc(asyncio: ^AsyncIO, flush: bool, queue: ^AsyncIOQueue, userdata: rawptr) -> bool --- + CreateAsyncIOQueue :: proc() -> ^AsyncIOQueue --- + DestroyAsyncIOQueue :: proc(queue: ^AsyncIOQueue) --- + GetAsyncIOResult :: proc(queue: ^AsyncIOQueue, outcome: ^AsyncIOOutcome) -> bool --- + WaitAsyncIOResult :: proc(queue: ^AsyncIOQueue, outcome: ^AsyncIOOutcome, timeoutMS: Sint32) -> bool --- + SignalAsyncIOQueue :: proc(queue: ^AsyncIOQueue) --- + LoadFileAsync :: proc(file: cstring, queue: ^AsyncIOQueue, userdata: rawptr) -> bool --- +} \ No newline at end of file