diff --git a/core/io/crc32/crc32.factor b/core/io/crc32/crc32.factor index 1c0c2e9f5c..82af0cdb23 100644 --- a/core/io/crc32/crc32.factor +++ b/core/io/crc32/crc32.factor @@ -28,3 +28,8 @@ DEFER: crc32-table inline >r HEX: ffffffff dup r> [ (crc32) ] each bitxor ; : file-crc32 ( path -- n ) file-contents crc32 ; + +: lines-crc32 ( seq -- n ) + HEX: ffffffff tuck [ + [ (crc32) ] each CHAR: \n (crc32) + ] reduce bitxor ; diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 235d0e935a..2579542af0 100644 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -382,7 +382,7 @@ SYMBOL: parse-hook dup file set source-file-definitions clone old-definitions set ] [ drop ] if - contents \ contents set ; + lines \ lines set ; : smudged-usage-warning ( usages removed -- ) parser-notes? [ @@ -426,7 +426,7 @@ SYMBOL: parse-hook file get dup [ [ record-form ] keep [ record-modified ] keep - [ \ contents get record-checksum ] keep + [ \ lines get record-checksum ] keep record-definitions forget-smudged ] [ @@ -443,7 +443,7 @@ SYMBOL: parse-hook [ [ start-parsing - \ contents get string-lines parse-fresh + \ lines get parse-fresh dup finish-parsing ] [ ] [ undo-parsing ] cleanup ] no-parse-hook ; diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor index 4df59e5dd9..f8fdc45fe9 100644 --- a/core/source-files/source-files.factor +++ b/core/source-files/source-files.factor @@ -33,8 +33,8 @@ uses definitions ; dup source-file-path ?resource-path file-modified swap set-source-file-modified ; -: record-checksum ( source-file contents -- ) - crc32 swap set-source-file-checksum ; +: record-checksum ( source-file lines -- ) + lines-crc32 swap set-source-file-checksum ; : (xref-source) ( source-file -- pathname uses ) dup source-file-path swap source-file-uses @@ -63,7 +63,7 @@ uses definitions ; : reset-checksums ( -- ) source-files get [ swap ?resource-path dup exists? - [ file-contents record-checksum ] [ 2drop ] if + [ file-lines record-checksum ] [ 2drop ] if ] assoc-each ; M: pathname where pathname-string 1 2array ; diff --git a/extra/benchmark/reverse-complement-test-in.txt b/extra/benchmark/reverse-complement/reverse-complement-test-in.txt similarity index 100% rename from extra/benchmark/reverse-complement-test-in.txt rename to extra/benchmark/reverse-complement/reverse-complement-test-in.txt diff --git a/extra/benchmark/reverse-complement-test-out.txt b/extra/benchmark/reverse-complement/reverse-complement-test-out.txt similarity index 100% rename from extra/benchmark/reverse-complement-test-out.txt rename to extra/benchmark/reverse-complement/reverse-complement-test-out.txt diff --git a/extra/benchmark/reverse-complement/reverse-complement.factor b/extra/benchmark/reverse-complement/reverse-complement.factor index 4da3972e34..332489abed 100644 --- a/extra/benchmark/reverse-complement/reverse-complement.factor +++ b/extra/benchmark/reverse-complement/reverse-complement.factor @@ -37,9 +37,9 @@ HINTS: do-line vector string ; ] with-stream ; : reverse-complement-main ( -- ) - "reverse-complement-in.txt" - "reverse-complement-out.txt" - [ home swap path+ ] 2apply + "extra/benchmark/reverse-complement/reverse-complement-test-in.txt" + "extra/benchmark/reverse-complement/reverse-complement-test-out.txt" + [ resource-path ] 2apply reverse-complement ; MAIN: reverse-complement-main