change the parser to use file-lines

add lines-crc32
update source-files for the contents -> lines change
db4
Doug Coleman 2008-01-04 20:02:54 -06:00
parent 03b18daa5e
commit 12f990bd1a
3 changed files with 9 additions and 6 deletions

View File

@ -28,3 +28,6 @@ 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 ] reduce bitxor ;

View File

@ -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 ;

View File

@ -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 <pathname> 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 ;