File:  [gforth] / gforth / fixpath.fs
Revision 1.3: download - view: text, annotated - select for diffs
Sun Mar 9 15:16:49 2003 UTC (21 years, 1 month ago) by anton
Branches: MAIN
CVS tags: v0-6-1, v0-6-0, HEAD
updated copyright years

    1: \ fix path in gforth*.exe
    2: 
    3: \ Copyright (C) 2000,2003 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
    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
   19: \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
   20: 
   21: ." Fixing " 3 arg type ."  with " 2 arg type cr
   22: 
   23: $7410 Constant gforth.exe
   24: $68D0 Constant gforth-fast.exe
   25: $81E0 Constant gforth-ditc.exe
   26: 
   27: include string.fs
   28: 
   29: Variable path$  2 arg path$ $!
   30: Variable pathes$  2 arg pathes$ $!
   31: Variable exe$
   32: 
   33: pathes$ 1 1 $del
   34: s" //" pathes$ 0 $ins
   35: : fixpathes ( addr u -- )
   36:   bounds ?DO  I c@ '\ = IF  '/ I c!  THEN  LOOP ;
   37: pathes$ $@ fixpathes
   38: s" .:" pathes$ 0 $ins
   39: 
   40: : fix-exe ( offset addr u -- )
   41:   path$ $@ exe$ $! s" \" exe$ $+! exe$ $+!
   42:   exe$ $@ r/w bin open-file throw >r
   43:   0 r@ reposition-file throw
   44:   pathes$ $@ 2dup + 0 swap c! 1+ r@ write-file throw
   45:   r> close-file throw ;
   46: 
   47: 3 arg evaluate 3 arg fix-exe
   48: 
   49: bye

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