Skip to content

Commit

Permalink
terminfo: separate string-offset word.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Apr 26, 2013
1 parent a6ab66d commit e69f007
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions extra/terminfo/terminfo.factor
Expand Up @@ -45,10 +45,12 @@ C: <terminfo-header> terminfo-header
: read-numbers ( header -- numbers )
[ align-even-bytes ] [ #numbers>> read-shorts ] bi ;

: string-offset ( from seq -- str )
0 2over index-from swap subseq >string ;

: read-strings ( header -- strings )
[ #strings>> read-shorts ] [ string-bytes>> read ] bi '[
[ _ 0 2over index-from swap subseq >string ] [ f ] if*
] map ;
[ #strings>> read-shorts ] [ string-bytes>> read ] bi
'[ [ _ string-offset ] [ f ] if* ] map ;

TUPLE: terminfo names booleans numbers strings ;

Expand Down

0 comments on commit e69f007

Please sign in to comment.