From 2ca333a0fa2eba3976372689606b2ed6da3a41db Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Fri, 29 Nov 2024 16:07:00 -0800 Subject: [PATCH] Various structure related cleanups. --- common/structures.fs | 3 ++- posix/x11.fs | 6 +++--- windows/windows_user.fs | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/common/structures.fs b/common/structures.fs index 9acee57..7fe2bd7 100644 --- a/common/structures.fs +++ b/common/structures.fs @@ -31,8 +31,9 @@ variable last-struct : struct ( "name" ) 1 0 typer latestxt >body last-struct ! 1 last-align ! ; : align-by ( a n -- a ) 1- dup >r + r> invert and ; +: max! ( n a -- ) swap over @ max swap ! ; : struct-align ( n -- ) - dup last-struct @ cell+ @ max last-struct @ cell+ ! + dup last-struct @ cell+ max! last-struct @ @ swap align-by last-struct @ ! ; : field ( n "name" ) last-align @ struct-align diff --git a/posix/x11.fs b/posix/x11.fs index b04b915..ab648be 100644 --- a/posix/x11.fs +++ b/posix/x11.fs @@ -55,9 +55,9 @@ z" XFillRectangle" 7 xlib XFillRectangle ( a n n n n n n -- void ) 32 cells constant xevent-size -: win ( n "name" ) long ; -: time ( n "name" ) long ; -: bool ( n "name" ) i32 ; +: win long ; +: time long ; +: bool i32 ; vocabulary xany also xany definitions struct XAnyEvent diff --git a/windows/windows_user.fs b/windows/windows_user.fs index f0ad3c8..be97305 100644 --- a/windows/windows_user.fs +++ b/windows/windows_user.fs @@ -129,12 +129,12 @@ z" GetDC" 1 User32 GetDC z" BeginPaint" 2 User32 BeginPaint z" EndPaint" 2 User32 EndPaint struct PAINTSTRUCT - HANDLE field ->hdc - i32 field ->fErase - RECT field ->rcPaint - i32 field ->fRestore - i32 field ->fIncUpdate - 32 field ->rgbReserved ( 32 bytes ) + HANDLE field ->hdc + i32 field ->fErase + RECT field ->rcPaint + i32 field ->fRestore + i32 field ->fIncUpdate + 32 i8 * field ->rgbReserved z" FillRect" 3 User32 FillRect z" PostQuitMessage" 1 User32 PostQuitMessage