Alex McDonald wrote:
[Ballots]
Thanks.
> Notes:
>
> Parts of Win32Forth use an alternative "based" structure.
>
>
> : FLD ( basevar offset len -<name>- -- basevar offset+len ) \
> definer for fields
> create
> 3dup + 2>R \ n1 n2 n3 r: n1 n2+n3
> drop \ n1 n2 r: n1 n2+n3
> , , 2R> \ build n2 n1
> DOES> ( -- baseaddr )
> dup @ \ fetch n2
> swap cell+ @ @ + ; \ fetch n1 value, add
>
> : FLDBASE ( -<name>- ) \ set field base name (starts field)
> CREATE here 0 , 0 ; \ base of record
>
> Example:
>
> FLDBASE BASE-IID
> 4 FLD IID-RVA-ILT \ import lookup table
> 4 FLD IID-TIMEDATE \ time date of binding
> 4 FLD IID-FORWARDER \ forwarder index
> 4 FLD IID-RVA-NAME \ RVA to name
> 4 FLD IID-RVA-IAT \ import address table
> CONSTANT LEN-IID DROP
>
> Usage:
>
> <value> BASE-IID ! \ set base of IID
> <value> IID-RVA-NAME ! \ i.e. BASE-IID+12
That's a little long. I have included it, but I think it would be
better to mention such things at the RfD stage, and let the proponent
condense this into the comments or existing practice section.
- anton