Annotation of gforth/kernel/main.fs, revision 1.22

1.22    ! crook       1: \ MAIN.FS      Kernel main load file                   20may93jaw
1.1       anton       2: 
1.20      anton       3: \ Copyright (C) 1995,1996,1997,1998,2000 Free Software Foundation, Inc.
1.1       anton       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
                      9: \ as published by the Free Software Foundation; either version 2
                     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
                     18: \ along with this program; if not, write to the Free Software
1.21      anton      19: \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
1.1       anton      20: 
                     21: \ : include bl word count included ;
                     22: \ we want write include...
                     23: 
                     24: \ : : ( -- colon-sys )  Header [ ' : @ ] ALiteral cfa, 0 ] ;
                     25: \ : ; ( colon-sys -- )  ?struc postpone exit reveal postpone [ ; immediate
                     26: \ : :noname ( -- xt colon-sys )  here [ ' : @ ] ALiteral cfa, 0 ] ;
                     27: 
                     28: Create mach-file here over 1+ allot place
                     29: 
1.18      jwilke     30: 0 [IF]
                     31: \ debugging: produce a relocation and a symbol table
                     32: s" rel-table" r/w create-file throw
                     33: Constant fd-relocation-table
                     34: 
                     35: \ debuggging: produce a symbol table
                     36: s" sym-table" r/w create-file throw
                     37: Constant fd-symbol-table
                     38: [THEN]
                     39: 
                     40: 
                     41: bl word vocabulary find nip 0= [IF]
1.22    ! crook      42:     \ if search order stuff is missing assume we are compiling on a gforth
        !            43:     \ system and include it.
        !            44:     \ We want the files taken from our current gforth installation
        !            45:     \ so we don't include relatively to this file
        !            46:     require search.fs
        !            47:     require environ.fs
        !            48:     require envos.fs
        !            49:     require errors.fs
        !            50:     require extend.fs              \ core-extended
        !            51:     require hash.fs
1.18      jwilke     52: [THEN]
1.1       anton      53: 
                     54: \ include etags.fs
                     55: 
1.22    ! crook      56: include ./../cross.fs              \ cross-compiler
1.1       anton      57: 
                     58: decimal
                     59: 
1.11      pazsan     60: has? kernel-size makekernel ( size )
1.1       anton      61: \ create image-header
1.4       jwilke     62: has? header [IF]
1.22    ! crook      63:     0 A,                \ base address
        !            64:     0 ,                 \ checksum
        !            65:     0 ,                 \ image size (without tags)
        !            66:     >address ,          \ dict size
        !            67:     has? stack-size ,   \ data stack size
        !            68:     has? fstack-size ,  \ FP stack size
        !            69:     has? rstack-size ,  \ return stack size
        !            70:     has? lstack-size ,  \ locals stack size
        !            71:     0 A,                \ code entry point
        !            72:     0 A,                \ throw entry point
        !            73:     has? stack-size ,   \ unused (possibly tib stack size)
        !            74:     0 ,                 \ unused
        !            75:     0 ,                 \ data stack base
        !            76:     0 ,                 \ fp stack base
        !            77:     0 ,                 \ return stack base
        !            78:     0 ,                 \ locals stack base
1.1       anton      79: [THEN]
                     80: 
1.22    ! crook      81: UNLOCK ghost - drop \ need a ghost otherwise "-" would be treated as a number
1.1       anton      82: LOCK
                     83: 
                     84: doc-off
1.4       jwilke     85: has? prims [IF]
1.22    ! crook      86:     include ./aliases.fs             \ primitive aliases
1.1       anton      87: [ELSE]
                     88:     prims-include
                     89:     undef-words
1.17      pazsan     90:     include prim.fs
1.1       anton      91:     all-words  UNLOCK LOCK
                     92: [THEN]
                     93: doc-on
                     94: 
                     95: 0 AConstant forthstart
                     96: 
1.22    ! crook      97: \ include ./vars.fs                  \ variables and other stuff
        !            98: \ include kernel/version.fs          \ is in $(build)/kernel
        !            99: include ./kernel.fs                  \ kernel
1.14      jwilke    100: \ include ./errore.fs
1.13      jwilke    101: include ./doers.fs
1.4       jwilke    102: has? file [IF]
1.22    ! crook     103:     include ./args.fs
        !           104:     include ./files.fs               \ file words
        !           105:     include ./paths.fs
        !           106:     include ./require.fs
1.1       anton     107: [THEN]
1.6       pazsan    108: 
                    109: has? compiler [IF]
1.22    ! crook     110:     has? glocals [IF]
        !           111:         include ./cond.fs            \ IF and co.
        !           112:     [ELSE]
        !           113:         include ./cond-old.fs        \ IF and co. withoutlocals
        !           114:     [THEN]
        !           115:     \ these two games can be added to provide complex examples for the 4stack
        !           116:     \ and misc simulators (see arch/4stack/README and arch/misc/README).
        !           117:     \ include arch/misc/tt.fs
        !           118:     \ include arch/misc/sokoban.fs
1.6       pazsan    119: [THEN]
1.15      jwilke    120: include ./quotes.fs
1.13      jwilke    121: include ./toolsext.fs
                    122: include ./tools.fs               \ load tools ( .s dump )
                    123: include ./getdoers.fs
1.1       anton     124: 
                    125: \ Setup                                                13feb93py
                    126: 
1.4       jwilke    127: has? header [IF]
1.22    ! crook     128:     \    UNLOCK
        !           129:     here >address 2 cells  !         \ image size
        !           130:     ' boot >body  8 cells A!         \ image entry point
        !           131:     \    LOCK
1.1       anton     132: [ELSE]
1.22    ! crook     133:     >boot
1.1       anton     134: [THEN]
                    135: 
1.22    ! crook     136: include ./pass.fs                    \ pass pointers from cross to target
1.16      jwilke    137: 
1.22    ! crook     138: .unresolved                          \ how did we do?

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