Fix bug in structures that don't use TYPER sizes.
Thanks Frank!
This commit is contained in:
@ -28,7 +28,8 @@ long-size long-size typer long
|
||||
|
||||
variable last-struct
|
||||
|
||||
: struct ( "name" ) 1 0 typer latestxt >body 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 ;
|
||||
: struct-align ( n -- )
|
||||
dup last-struct @ cell+ @ max last-struct @ cell+ !
|
||||
|
||||
@ -46,3 +46,17 @@ e: test-nested-structure
|
||||
1000 ->bar ->right 1012 =assert
|
||||
1000 ->bar ->bottom 1016 =assert
|
||||
;e
|
||||
|
||||
e: test-forth-structure
|
||||
also structures
|
||||
0 last-align !
|
||||
struct foo
|
||||
1 field t1
|
||||
4 field t2
|
||||
9 field t3
|
||||
12 field t4
|
||||
0 t1 0 =assert
|
||||
0 t2 1 =assert
|
||||
0 t3 5 =assert
|
||||
0 t4 14 =assert
|
||||
;e
|
||||
|
||||
@ -115,7 +115,7 @@ struct MSG
|
||||
i16 field ->wParam
|
||||
i32 field ->lParam
|
||||
i32 field ->time
|
||||
POINT field ->pt
|
||||
POINT field ->pt
|
||||
i32 field ->lPrivate
|
||||
0 constant PM_NOREMOVE
|
||||
1 constant PM_REMOVE
|
||||
|
||||
Reference in New Issue
Block a user