summary-v0.2.0.md 1.8 KB

m2SDL3 summary — v0.2.0 (2026-09-24)

Follows v0.1.0 (ed80b57): system-info bindings batch (audio/camera/gamepad still open — see "Next").

v0.2.0 — filesystem, power, locale, clipboard

  • src/SDL3Stdinc.def — SDL_malloc/SDL_calloc/SDL_free (size_t = 64 bits, hence LONGCARD); SDL-allocated strings must be released with SDL_free, not libc free
  • src/SDL3Filesystem.def — <SDL_filesystem.h> without callbacks: GetBasePath/GetPrefPath/GetUserFolder/GetCurrentDirectory (SDL-allocated, possibly NIL), CreateDirectory, RemovePath, RenamePath, CopyFile; FolderHome..FolderVideos constants
  • src/SDL3Power.def — GetPowerInfo state id + VAR seconds/percent
  • src/SDL3Locale.def — GetPreferredLocales returns a typed LocaleVecPtr (pointer to array of LocalePtr); single SDL_free releases the list; SDLLocale = language/country ADDRESS pair
  • src/SDL3Clipboard.def — plain-text Set/Get/HasClipboardText plus primary-selection variants (video init needed; dummy works); MIME/callback APIs left out (no C-callback mapping in this style)
  • tests/test_sysinfo.mod — power state, locale decode (fr here), base/cwd paths; tests/test_clipboard.mod — set/has/get round-trip; runner + Makefile extended (7/7 green)

GM2 FFI rules learned (additions)

  1. gm2 has no CAST — return typed pointers (POINTER TO ...) from FOR "C" procedures instead of ADDRESS + cast.
  2. Imported type names clash with local TYPE declarations — declare shared shapes once, in the .def.
  3. SDL_GetPreferredLocales-style out-arrays: bound the Modula-2 array type (256) and range-check count before indexing.

Next

Audio streams (spec records + buffer flow), camera (needs hardware), gamepad/joystick, typed SDL_Event record, infinite-monkeys demo.