]> gitweb.factorcode.org Git - factor.git/commitdiff
terminfo: separate string-offset word.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 26 Apr 2013 18:36:25 +0000 (11:36 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 26 Apr 2013 18:36:25 +0000 (11:36 -0700)
extra/terminfo/terminfo.factor

index 88734b2fd2a7011afab5aee8fd7ba1914807c39a..3372a07e8277541bca715ba555d67347be4ece36 100644 (file)
@@ -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 ;