projects
/
pforth
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test the compile time behavior of a VALUE
[pforth]
/
fth
/
member.fth
diff --git
a/fth/member.fth
b/fth/member.fth
index
3ff53d7
..
ceccc55
100644
(file)
--- a/
fth/member.fth
+++ b/
fth/member.fth
@@
-41,12
+41,18
@@
decimal
;
\ Variables shared with object oriented code.
;
\ Variables shared with object oriented code.
-
VARIABLE OB-STATE ( Compilation state. )
-
VARIABLE OB-CURRENT-CLASS ( ABS_CLASS_BASE of current class )
-
1 constant OB_DEF_CLASS ( defining a class )
-
2 constant OB_DEF_STRUCT ( defining a structure )
+VARIABLE OB-STATE ( Compilation state. )
+VARIABLE OB-CURRENT-CLASS ( ABS_CLASS_BASE of current class )
+1 constant OB_DEF_CLASS ( defining a class )
+2 constant OB_DEF_STRUCT ( defining a structure )
-4 constant OB_OFFSET_SIZE
+\ A member contains:
+\ cell size of data in bytes (1, 2, cell)
+\ cell offset within structure
+
+cell 1- constant CELL_MASK
+cell negate constant -CELL
+cell constant OB_OFFSET_SIZE
: OB.OFFSET@ ( member_def -- offset ) @ ;
: OB.OFFSET, ( value -- ) , ;
: OB.OFFSET@ ( member_def -- offset ) @ ;
: OB.OFFSET, ( value -- ) , ;
@@
-60,7
+66,7
@@
decimal
ABS ( -- |+-b| )
ob-current-class @ ( -- b addr-space)
tuck @ ( as #b c , current space needed )
ABS ( -- |+-b| )
ob-current-class @ ( -- b addr-space)
tuck @ ( as #b c , current space needed )
- over
3 and 0= ( multiple of four
? )
+ over
CELL_MASK and 0= ( multiple of cell
? )
IF
aligned
ELSE
IF
aligned
ELSE
@@
-147,7
+153,7
@@
decimal
\ Aliases
: APTR ( <name> -- ) long ;
\ Aliases
: APTR ( <name> -- ) long ;
-: RPTR ( <name> -- ) -
4
bytes ; \ relative relocatable pointer 00001
+: RPTR ( <name> -- ) -
cell
bytes ; \ relative relocatable pointer 00001
: ULONG ( <name> -- ) long ;
: STRUCT ( <struct> <new_ivar> -- , define a structure as an ivar )
: ULONG ( <name> -- ) long ;
: STRUCT ( <struct> <new_ivar> -- , define a structure as an ivar )