| 1 : |
anton
|
1.1
|
\ image dump 15nov94py |
| 2 : |
|
|
|
| 3 : |
anton
|
1.16
|
\ Copyright (C) 1995,1997,2003,2006,2007,2010,2011 Free Software Foundation, Inc. |
| 4 : |
anton
|
1.1
|
|
| 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 : |
anton
|
1.11
|
\ as published by the Free Software Foundation, either version 3 |
| 10 : |
anton
|
1.1
|
\ 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 : |
anton
|
1.11
|
\ along with this program. If not, see http://www.gnu.org/licenses/. |
| 19 : |
anton
|
1.1
|
|
| 20 : |
anton
|
1.9
|
: delete-prefix ( c-addr1 u1 c-addr2 u2 -- c-addr3 u3 ) |
| 21 : |
|
|
\ if c-addr2 u2 is a prefix of c-addr1 u1, delete it |
| 22 : |
|
|
2over 2over string-prefix? if |
| 23 : |
|
|
nip /string |
| 24 : |
|
|
else |
| 25 : |
|
|
2drop |
| 26 : |
|
|
endif ; |
| 27 : |
|
|
|
| 28 : |
anton
|
1.1
|
: update-image-included-files ( -- ) |
| 29 : |
|
|
included-files 2@ { addr cnt } |
| 30 : |
|
|
image-included-files 2@ { old-addr old-cnt } |
| 31 : |
|
|
align here { new-addr } |
| 32 : |
|
|
cnt 2* cells allot |
| 33 : |
|
|
new-addr cnt image-included-files 2! |
| 34 : |
|
|
old-addr new-addr old-cnt 2* cells move |
| 35 : |
|
|
cnt old-cnt |
| 36 : |
|
|
U+DO |
| 37 : |
anton
|
1.9
|
addr i 2* cells + 2@ |
| 38 : |
|
|
s" GFORTHDESTDIR" getenv delete-prefix save-mem-dict |
| 39 : |
anton
|
1.1
|
new-addr i 2* cells + 2! |
| 40 : |
|
|
LOOP |
| 41 : |
|
|
maxalign ; |
| 42 : |
|
|
|
| 43 : |
|
|
: dump-fi ( addr u -- ) |
| 44 : |
|
|
w/o bin create-file throw >r |
| 45 : |
|
|
update-image-included-files |
| 46 : |
anton
|
1.5
|
update-image-order |
| 47 : |
anton
|
1.1
|
here forthstart - forthstart 2 cells + ! |
| 48 : |
|
|
forthstart |
| 49 : |
|
|
begin \ search for start of file ("#! " at a multiple of 8) |
| 50 : |
|
|
8 - |
| 51 : |
anton
|
1.4
|
dup 3 s" #! " str= |
| 52 : |
anton
|
1.1
|
until ( imagestart ) |
| 53 : |
|
|
here over - r@ write-file throw |
| 54 : |
|
|
r> close-file throw ; |
| 55 : |
|
|
|
| 56 : |
|
|
: savesystem ( "name" -- ) \ gforth |
| 57 : |
|
|
name dump-fi ; |