( Records)

( words for data structures)


0 VARIABLE Total_Bytes

: Field                 ( nth field ...)
    CREATE       
    Total_Bytes @       ( Total so far is the offset)
    ,                   ( store it in the field name)
    Total_Bytes +!      ( bump the total)
   DOES>                ( addr...addr)
    @ +  ;              ( perform address calculation)

: Make_Instance         ( n +++ )
   CREATE
   DUP ,                ( save instance size)
   ALLOT ;              ( allocate fields)

: Defines_Type  ( ...)
   CREATE
    Total_Bytes @      ( Total is instance size)
    ,                  ( store size)
    4 Total_Bytes !    ( allow for size of field)
   DOES>
    @ Make_Instance ;  ( NB 2 CREATEs used)

24 Field .name
40 Field .addr1
40 Field .addr2
16 Field .tel

Defines_Type address.record

address.record fredbloggs





   








































































































































































































































































































