Annotation of gforth/struct0x.fs, revision 1.3

1.1       anton       1: \ implementation of Forth 200x structures
                      2: 
                      3: \ Copyright (C) 2007 Free Software Foundation, Inc.
                      4: 
                      5: \ This file is part of Gforth.
                      6: 
                      7: \ Gforth is free software; you can redistribute it and/or
                      8: \ modify it under the terms of the GNU General Public License
1.2       anton       9: \ as published by the Free Software Foundation, either version 3
1.1       anton      10: \ of the License, or (at your option) any later version.
                     11: 
                     12: \ This program is distributed in the hope that it will be useful,
                     13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15: \ GNU General Public License for more details.
                     16: 
                     17: \ You should have received a copy of the GNU General Public License
1.2       anton      18: \ along with this program. If not, see http://www.gnu.org/licenses/.
1.1       anton      19: 
                     20: : +field ( n1 n2 "name" -- n3 ) \ X:structures plus-field
                     21:     over if
                     22:         (field) over ,
                     23:     else
                     24:         create dozerofield
                     25:     then
                     26:     + ;
                     27: 
1.3     ! pazsan     28: : extend-structure ( n "name" -- struct-sys n ) \ Gforth
        !            29:     \g extend an existing structure
        !            30:     >r 0 value lastxt >body r> ;
        !            31: 
1.1       anton      32: : begin-structure ( "name" -- struct-sys 0 ) \ X:structures
1.3     ! pazsan     33:     0 extend-structure ;
1.1       anton      34: 
                     35: : end-structure ( struct-sys +n -- ) \ X:structures
                     36:     swap ! ;
                     37: 
                     38: : cfield: ( u1 "name" -- u2 ) \ X:structures
                     39:     1 +field ;
                     40: 
                     41: : field: ( u1 "name" -- u2 ) \ X:structures
                     42:     aligned cell +field ;
                     43: 
                     44: : 2field: ( u1 "name" -- u2 ) \ gforth
                     45:     aligned 2 cells +field ;
                     46: 
                     47: : ffield: ( u1 "name" -- u2 ) \ X:structures
                     48:     faligned 1 floats +field ;
                     49: 
                     50: : sffield: ( u1 "name" -- u2 ) \ X:structures
                     51:     sfaligned 1 sfloats +field ;
                     52: 
                     53: : dffield: ( u1 "name" -- u2 ) \ X:structures
                     54:     dfaligned 1 dfloats +field ;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>