From eb3008bfaa05ec50e390aa995704d045ce53fb5d Mon Sep 17 00:00:00 2001 From: erg Date: Thu, 10 Aug 2006 04:27:54 +0000 Subject: [PATCH] hexdump -- blah. instead of .blah --- contrib/hexdump/hexdump.factor | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/hexdump/hexdump.factor b/contrib/hexdump/hexdump.factor index a616b6623a..15fe9418c3 100644 --- a/contrib/hexdump/hexdump.factor +++ b/contrib/hexdump/hexdump.factor @@ -1,13 +1,13 @@ USING: io kernel math namespaces prettyprint sequences strings ; IN: hexdump-internals -: .header ( len -- ) +: header. ( len -- ) "Length: " write dup unparse write ", " write >hex write "h" write terpri ; -: .offset ( lineno -- ) 16 * >hex 8 CHAR: 0 pad-left write "h: " write ; -: .h-pad ( digit -- ) >hex 2 CHAR: 0 pad-left write ; -: .line ( str n -- ) - .offset [ [ .h-pad " " write ] each ] keep +: offset. ( lineno -- ) 16 * >hex 8 CHAR: 0 pad-left write "h: " write ; +: h-pad. ( digit -- ) >hex 2 CHAR: 0 pad-left write ; +: line. ( str n -- ) + offset. [ [ h-pad. " " write ] each ] keep 16 over length - [ " " write ] times [ dup printable? [ drop CHAR: . ] unless ch>string write ] each terpri ; @@ -16,11 +16,11 @@ IN: hexdump : hexdump ( str -- str ) #! Write hexdump to a string [ - dup length .header - 16 group dup length [ .line ] 2each + dup length header. + 16 group dup length [ line. ] 2each ] string-out ; -: .hexdump ( str -- ) +: hexdump. ( str -- ) #! Print hexdump hexdump write ;