File:  [gforth] / gforth / fixpath.fs
Revision 1.6: download - view: text, annotated - select for diffs
Sat Aug 30 19:55:13 2003 UTC (17 years, 8 months ago) by pazsan
Branches: MAIN
CVS tags: HEAD
Fixes for Windows port

    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: $CCE0 Constant gforth.exe
   24: $C4F0 Constant gforth-fast.exe
   25: $89F0 Constant gforth-ditc.exe
   26: $6BF0 Constant gforth-itc.exe
   27: $6880 Constant gforth-prof.exe
   28: 
   29: include string.fs
   30: 
   31: Variable path$  2 arg path$ $!
   32: Variable pathes$  2 arg pathes$ $!
   33: Variable exe$
   34: 
   35: \ pathes$ 1 1 $del s" /cygdrive/" pathes$ 0 $ins
   36: \ : fixpathes ( addr u -- )
   37: \   bounds ?DO  I c@ '\ = IF  '/ I c!  THEN  LOOP ;
   38: \ pathes$ $@ fixpathes
   39: s" .;" pathes$ 0 $ins
   40: 
   41: : fix-exe ( offset addr u -- )
   42:   path$ $@ exe$ $! s" \" exe$ $+! exe$ $+!
   43:   exe$ $@ r/w bin open-file throw >r
   44:   0 r@ reposition-file throw
   45:   pathes$ $@ 2dup + 0 swap c! 1+ r@ write-file throw
   46:   r> close-file throw ;
   47: 
   48: 3 arg evaluate 3 arg fix-exe
   49: 
   50: bye

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