Annotation of gforth/savesys.fs, revision 1.7
1.1 anton 1: \ image dump 15nov94py
2:
1.6 anton 3: \ Copyright (C) 1995,1997,2003 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.3 anton 19: \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
1.1 anton 20:
1.7 ! anton 21: : save-mem-dict { addr1 u -- addr2 u }
1.1 anton 22: here { addr2 }
23: u allot
24: addr1 addr2 u move
25: addr2 u ;
26:
27: : update-image-included-files ( -- )
28: included-files 2@ { addr cnt }
29: image-included-files 2@ { old-addr old-cnt }
30: align here { new-addr }
31: cnt 2* cells allot
32: new-addr cnt image-included-files 2!
33: old-addr new-addr old-cnt 2* cells move
34: cnt old-cnt
35: U+DO
1.7 ! anton 36: addr i 2* cells + 2@ save-mem-dict
1.1 anton 37: new-addr i 2* cells + 2!
38: LOOP
39: maxalign ;
40:
41: : dump-fi ( addr u -- )
42: w/o bin create-file throw >r
43: update-image-included-files
1.5 anton 44: update-image-order
1.1 anton 45: here forthstart - forthstart 2 cells + !
46: forthstart
47: begin \ search for start of file ("#! " at a multiple of 8)
48: 8 -
1.4 anton 49: dup 3 s" #! " str=
1.1 anton 50: until ( imagestart )
51: here over - r@ write-file throw
52: r> close-file throw ;
53:
54: : savesystem ( "name" -- ) \ gforth
55: name dump-fi ;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>