[gforth] / gforth / filedump.fs  

gforth: gforth/filedump.fs


1 : pazsan 1.5 #! /usr/local/lib/gforth/0.2.0/kernel.fi
2 : anton 1.1 \ file hex dump
3 :    
4 : anton 1.14 \ Copyright (C) 1997,2002,2003,2004,2007 Free Software Foundation, Inc.
5 : anton 1.6
6 :     \ This file is part of Gforth.
7 :    
8 :     \ Gforth is free software; you can redistribute it and/or
9 :     \ modify it under the terms of the GNU General Public License
10 : anton 1.13 \ as published by the Free Software Foundation, either version 3
11 : anton 1.6 \ of the License, or (at your option) any later version.
12 :    
13 :     \ This program is distributed in the hope that it will be useful,
14 :     \ but WITHOUT ANY WARRANTY; without even the implied warranty of
15 :     \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 :     \ GNU General Public License for more details.
17 :    
18 :     \ You should have received a copy of the GNU General Public License
19 : anton 1.13 \ along with this program. If not, see http://www.gnu.org/licenses/.
20 : anton 1.6
21 : pazsan 1.8 Create buf $10 allot
22 : anton 1.1
23 :     : dumpline ( addr handle -- flag )
24 : pazsan 1.8 buf $10 rot read-file throw
25 :     dup /dump ! $10 <> swap 6 u.r ." : " buf .line cr ;
26 : anton 1.1
27 :     : init cr $10 base ! ;
28 :    
29 :     : filedump ( addr count -- ) init r/o bin open-file throw >r
30 :     0 BEGIN $10 bounds r@ dumpline UNTIL drop
31 :     r> close-file throw ;
32 :    
33 :     script? [IF]
34 : pazsan 1.11 : alldump argc @ 1 ?DO I arg 2dup type ." :" filedump LOOP ;
35 : anton 1.1 alldump bye
36 :     [THEN]

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help