@@ -183,12 +183,12 @@ declare sub SDL_SetMainReady()
183183# endif
184184
185185const SDL_ASSERT_LEVEL = 2
186- #define SDL_TriggerBreakpoint() '' TODO: __asm__ __volatile__ ( " int $3\n\t" )
187- #define SDL_FUNCTION __func__
186+ #define SDL_TriggerBreakpoint() asm int 3
187+ #define SDL_FUNCTION __FUNCTION__
188188#define SDL_FILE __FILE__
189189#define SDL_LINE __LINE__
190190const SDL_NULL_WHILE_LOOP_CONDITION = 0
191- #define SDL_disabled_assert(condition) '' TODO: do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
191+ #define SDL_disabled_assert(condition) scope : end scope
192192
193193type SDL_assert_state as long
194194enum
@@ -210,7 +210,21 @@ type SDL_assert_data
210210end type
211211
212212declare function SDL_ReportAssertion( byval as SDL_assert_data ptr, byval as const zstring ptr, byval as const zstring ptr, byval as long ) as SDL_assert_state
213- #define SDL_enabled_assert(condition) '' TODO: do { while ( !(condition) ) { static struct SDL_assert_data assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; const SDL_assert_state state = SDL_ReportAssertion(&assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); if (state == SDL_ASSERTION_RETRY) { continue; } else if (state == SDL_ASSERTION_BREAK) { SDL_TriggerBreakpoint(); } break; } } while (SDL_NULL_WHILE_LOOP_CONDITION)
213+ #macro SDL_enabled_assert(condition)
214+ scope
215+ while (condition) = 0
216+ static as SDL_assert_data assert_data = ( 0 , 0 , @#condition, 0 , 0 , 0 , 0 )
217+ dim as const SDL_assert_state state = SDL_ReportAssertion( @assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE)
218+ select case state
219+ case SDL_ASSERTION_RETRY
220+ continue while
221+ case SDL_ASSERTION_BREAK
222+ SDL_TriggerBreakpoint()
223+ end select
224+ exit while
225+ wend
226+ end scope
227+ #endmacro
214228#define SDL_assert(condition) SDL_enabled_assert(condition)
215229#define SDL_assert_release(condition) SDL_enabled_assert(condition)
216230#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
@@ -227,8 +241,7 @@ type SDL_SpinLock as long
227241declare function SDL_AtomicTryLock( byval lock as SDL_SpinLock ptr) as SDL_bool
228242declare sub SDL_AtomicLock( byval lock as SDL_SpinLock ptr)
229243declare sub SDL_AtomicUnlock( byval lock as SDL_SpinLock ptr)
230-
231- #define SDL_CompilerBarrier() '' TODO: __asm__ __volatile__ ("" : : : "memory")
244+ #define SDL_CompilerBarrier() asm nop
232245#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
233246#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
234247
0 commit comments