1 \ Structures and fields.
3 \ The code is based on the implementation from the ANS standard.
5 \ Permission to use, copy, modify, and/or distribute this
6 \ software for any purpose with or without fee is hereby granted.
8 \ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
9 \ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
10 \ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11 \ THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
12 \ CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13 \ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
14 \ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 \ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 anew task-structure.fth
19 : BEGIN-STRUCTURE ( "<spaces>name" -- struct-sys 0 , start the definition of a structure )
21 HERE 0 0 , \ mark stack, lay dummy
22 DOES> @ \ -- structure-size
25 : END-STRUCTURE ( addr n -- , terminate a structure definition )
29 : +FIELD ( n <"name"> -- ; Exec: addr -- 'addr )
34 : FIELD: ( n1 "name" -- n2 ; addr1 -- addr2 )
35 ALIGNED 1 CELLS +FIELD
38 : CFIELD: ( n1 "name" -- n2 ; addr1 -- addr2 )