simple-flat-file: rename flat-file>biassoc to load-codetable-file.
parent
efbc417728
commit
f342fd04d9
|
@ -49,7 +49,7 @@ M: 8-bit-encoding <decoder>
|
||||||
: load-encoding ( name iana-name file-name -- )
|
: load-encoding ( name iana-name file-name -- )
|
||||||
[ create-encoding dup ]
|
[ create-encoding dup ]
|
||||||
[ register-encoding ]
|
[ register-encoding ]
|
||||||
[ encoding-file flat-file>biassoc 8-bit boa ] tri*
|
[ encoding-file load-codetable-file 8-bit boa ] tri*
|
||||||
swap 8-bit-encodings get-global set-at ;
|
swap 8-bit-encodings get-global set-at ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
|
@ -44,7 +44,7 @@ SYMBOL: euc-table
|
||||||
|
|
||||||
: setup-euc ( word file-name -- singleton-class biassoc )
|
: setup-euc ( word file-name -- singleton-class biassoc )
|
||||||
[ dup define-singleton-class ]
|
[ dup define-singleton-class ]
|
||||||
[ flat-file>biassoc ] bi* ;
|
[ load-codetable-file ] bi* ;
|
||||||
|
|
||||||
:: define-recursive-methods ( class data words -- )
|
:: define-recursive-methods ( class data words -- )
|
||||||
words [| word |
|
words [| word |
|
||||||
|
|
|
@ -13,9 +13,9 @@ SYMBOL: jis201
|
||||||
SYMBOL: jis208
|
SYMBOL: jis208
|
||||||
SYMBOL: jis212
|
SYMBOL: jis212
|
||||||
|
|
||||||
"vocab:io/encodings/iso2022/201.txt" flat-file>biassoc jis201 set-global
|
"vocab:io/encodings/iso2022/201.txt" load-codetable-file jis201 set-global
|
||||||
"vocab:io/encodings/iso2022/208.txt" flat-file>biassoc jis208 set-global
|
"vocab:io/encodings/iso2022/208.txt" load-codetable-file jis208 set-global
|
||||||
"vocab:io/encodings/iso2022/212.txt" flat-file>biassoc jis212 set-global
|
"vocab:io/encodings/iso2022/212.txt" load-codetable-file jis212 set-global
|
||||||
|
|
||||||
SYMBOL: ascii
|
SYMBOL: ascii
|
||||||
128 iota dup zip >biassoc ascii set-global
|
128 iota dup zip >biassoc ascii set-global
|
||||||
|
|
|
@ -33,7 +33,7 @@ TUPLE: jis assoc ;
|
||||||
: jis>ch ( jis tuple -- string ) assoc>> at replacement-char or ;
|
: jis>ch ( jis tuple -- string ) assoc>> at replacement-char or ;
|
||||||
|
|
||||||
: make-jis ( filename -- jis )
|
: make-jis ( filename -- jis )
|
||||||
flat-file>biassoc sift-values jis boa ;
|
load-codetable-file sift-values jis boa ;
|
||||||
|
|
||||||
"vocab:io/encodings/shift-jis/CP932.txt"
|
"vocab:io/encodings/shift-jis/CP932.txt"
|
||||||
make-jis windows-31j-table set-global
|
make-jis windows-31j-table set-global
|
||||||
|
|
|
@ -9,7 +9,7 @@ ABOUT: "simple-flat-file"
|
||||||
ARTICLE: "simple-flat-file" "Parsing simple flat files"
|
ARTICLE: "simple-flat-file" "Parsing simple flat files"
|
||||||
"The " { $vocab-link "simple-flat-file" } " vocabulary provides words for loading and parsing simple flat files in a particular format which is common for encoding and Unicode tasks."
|
"The " { $vocab-link "simple-flat-file" } " vocabulary provides words for loading and parsing simple flat files in a particular format which is common for encoding and Unicode tasks."
|
||||||
{ $subsections
|
{ $subsections
|
||||||
flat-file>biassoc
|
load-codetable-file
|
||||||
load-interval-file
|
load-interval-file
|
||||||
load-data-file
|
load-data-file
|
||||||
} ;
|
} ;
|
||||||
|
@ -22,6 +22,6 @@ HELP: load-data-file
|
||||||
{ $values { "filename" string } { "data" array } }
|
{ $values { "filename" string } { "data" array } }
|
||||||
{ $description "This loads a file that's delineated by semicolons and lines, returning an array of lines, where each line is an array split by the semicolons, with whitespace trimmed off." } ;
|
{ $description "This loads a file that's delineated by semicolons and lines, returning an array of lines, where each line is an array split by the semicolons, with whitespace trimmed off." } ;
|
||||||
|
|
||||||
HELP: flat-file>biassoc
|
HELP: load-codetable-file
|
||||||
{ $values { "filename" string } { "biassoc" biassoc } }
|
{ $values { "filename" string } { "biassoc" biassoc } }
|
||||||
{ $description "This loads a flat file, in the form that many encoding resource files are in, with two columns of numeric data in hex, and returns a biassoc associating them." } ;
|
{ $description "This loads a flat file, in the form that many encoding resource files are in, with two columns of numeric data in hex, and returns a biassoc associating them." } ;
|
||||||
|
|
|
@ -5,7 +5,7 @@ IN: simple-flat-file.tests
|
||||||
|
|
||||||
|
|
||||||
MEMO: <test1> ( -- code-table )
|
MEMO: <test1> ( -- code-table )
|
||||||
"vocab:simple-flat-file/test1.txt" flat-file>biassoc ;
|
"vocab:simple-flat-file/test1.txt" load-codetable-file ;
|
||||||
|
|
||||||
{ 0 } [ 0 <test1> at ] unit-test
|
{ 0 } [ 0 <test1> at ] unit-test
|
||||||
{ 0 } [ 0 <test1> value-at ] unit-test
|
{ 0 } [ 0 <test1> value-at ] unit-test
|
||||||
|
|
|
@ -26,7 +26,7 @@ IN: simple-flat-file
|
||||||
: process-codetable-lines ( lines -- assoc )
|
: process-codetable-lines ( lines -- assoc )
|
||||||
drop-comments [ parse-line ] map! ;
|
drop-comments [ parse-line ] map! ;
|
||||||
|
|
||||||
: flat-file>biassoc ( filename -- biassoc )
|
: load-codetable-file ( filename -- biassoc )
|
||||||
utf8 file-lines process-codetable-lines >biassoc ;
|
utf8 file-lines process-codetable-lines >biassoc ;
|
||||||
|
|
||||||
: split-; ( line -- array )
|
: split-; ( line -- array )
|
||||||
|
|
Loading…
Reference in New Issue