Various structure related cleanups.

This commit is contained in:
Brad Nelson
2024-11-29 16:07:00 -08:00
parent 4425ffadea
commit 2ca333a0fa
3 changed files with 11 additions and 10 deletions

View File

@ -31,8 +31,9 @@ variable last-struct
: struct ( "name" ) 1 0 typer latestxt >body last-struct ! : struct ( "name" ) 1 0 typer latestxt >body last-struct !
1 last-align ! ; 1 last-align ! ;
: align-by ( a n -- a ) 1- dup >r + r> invert and ; : align-by ( a n -- a ) 1- dup >r + r> invert and ;
: max! ( n a -- ) swap over @ max swap ! ;
: struct-align ( n -- ) : struct-align ( n -- )
dup last-struct @ cell+ @ max last-struct @ cell+ ! dup last-struct @ cell+ max!
last-struct @ @ swap align-by last-struct @ ! ; last-struct @ @ swap align-by last-struct @ ! ;
: field ( n "name" ) : field ( n "name" )
last-align @ struct-align last-align @ struct-align

View File

@ -55,9 +55,9 @@ z" XFillRectangle" 7 xlib XFillRectangle ( a n n n n n n -- void )
32 cells constant xevent-size 32 cells constant xevent-size
: win ( n "name" ) long ; : win long ;
: time ( n "name" ) long ; : time long ;
: bool ( n "name" ) i32 ; : bool i32 ;
vocabulary xany also xany definitions vocabulary xany also xany definitions
struct XAnyEvent struct XAnyEvent

View File

@ -129,12 +129,12 @@ z" GetDC" 1 User32 GetDC
z" BeginPaint" 2 User32 BeginPaint z" BeginPaint" 2 User32 BeginPaint
z" EndPaint" 2 User32 EndPaint z" EndPaint" 2 User32 EndPaint
struct PAINTSTRUCT struct PAINTSTRUCT
HANDLE field ->hdc HANDLE field ->hdc
i32 field ->fErase i32 field ->fErase
RECT field ->rcPaint RECT field ->rcPaint
i32 field ->fRestore i32 field ->fRestore
i32 field ->fIncUpdate i32 field ->fIncUpdate
32 field ->rgbReserved ( 32 bytes ) 32 i8 * field ->rgbReserved
z" FillRect" 3 User32 FillRect z" FillRect" 3 User32 FillRect
z" PostQuitMessage" 1 User32 PostQuitMessage z" PostQuitMessage" 1 User32 PostQuitMessage