! Copyright (C) 2017 Björn Lindqvist.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.strings assocs byte-arrays
-classes.struct fry io io.encodings.binary io.encodings.string io.files
-kernel math math.bitwise sequences system ;
+classes.struct continuations fry io io.encodings.binary
+io.encodings.string io.files kernel math math.bitwise sequences
+system ;
IN: ldcache
! General util
: parse ( -- entries )
! Read the old header and jump past it.
HeaderOld read-struct
- [ HEADER_MAGIC_OLD check-ldcache-magic ]
- [ nlibs>> EntryOld struct-size * seek-relative seek-input ] bi
+ [
+ [ HEADER_MAGIC_OLD check-ldcache-magic ]
+ [ nlibs>> EntryOld struct-size * seek-relative seek-input ] bi
+ ] [ 2drop HeaderOld struct-size neg seek-relative seek-input ] recover
HeaderNew read-struct
[ HEADER_MAGIC_NEW check-ldcache-magic ] keep
[ parse-new-entries ]