Paste: HEX{ }

Author: Maxim Savchenko
Mode: factor
Date: Fri, 20 Mar 2009 17:11:01
Plain Text |
ERROR: bad-hex-bytes ;

: hex-bytes ( accum end -- accum )
    scan
    {
        { [ 2dup = ] [ 2drop ] }
        {
            [ dup length even? ]
            [
                swapd 2 <groups>
                [ hex> [ parsed ] [ bad-hex-bytes ] if* ] each
                swap hex-bytes
            ]
        }
        [ bad-hex-bytes ]
    } cond
    ;

: HEX{ byte-vector new "}" hex-bytes >byte-array parsed ; parsing

New Annotation

Summary:
Author:
Mode:
Body: