From dbc9036f7515454df7e2622e8a3949ad158f6e5b Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Dec 2021 14:12:32 -0600 Subject: [PATCH] core: Change lines -> read-lines, contents -> read-contents, string-lines -> lines Add unlines word. Related to #2140 --- basis/bootstrap/compiler/compiler.factor | 2 +- .../bootstrap/image/download/download.factor | 2 +- basis/calendar/format/format.factor | 2 +- basis/documents/documents.factor | 2 +- basis/escape-strings/escape-strings.factor | 2 +- basis/eval/eval.factor | 2 +- basis/farkup/farkup.factor | 4 +- basis/ftp/server/server.factor | 2 +- basis/help/syntax/syntax.factor | 2 +- basis/html/components/components.factor | 6 +-- basis/html/templates/fhtml/fhtml.factor | 2 +- basis/http/http-tests.factor | 4 +- basis/io/launcher/launcher-docs.factor | 2 +- .../io/launcher/windows/windows-tests.factor | 8 +-- basis/io/streams/limited/limited-tests.factor | 8 +-- basis/io/streams/string/string-tests.factor | 6 +-- basis/logging/logging.factor | 2 +- basis/mime/multipart/multipart.factor | 2 +- basis/peg/ebnf/ebnf.factor | 2 +- .../quoted-printable-tests.factor | 6 +-- basis/resolv-conf/resolv-conf.factor | 2 +- basis/strings/tables/tables.factor | 2 +- .../tools/deploy/config/editor/editor.factor | 2 +- basis/ui/gadgets/labels/labels.factor | 2 +- basis/ui/gadgets/tables/tables.factor | 2 +- .../unicode/collation/collation-tests.factor | 2 +- basis/vocabs/platforms/platforms.factor | 2 +- basis/wrap/strings/strings.factor | 2 +- basis/xmode/code2html/code2html-tests.factor | 2 +- basis/xmode/highlight/highlight.factor | 2 +- core/classes/tuple/tuple-tests.factor | 6 +-- core/io/io-docs.factor | 8 +-- core/io/io.factor | 7 ++- .../byte-array/byte-array-tests.factor | 2 +- core/splitting/splitting-docs.factor | 6 +-- core/splitting/splitting-tests.factor | 50 +++++++++---------- core/splitting/splitting.factor | 13 +++-- extra/backticks/backticks.factor | 2 +- extra/compiler/cfg/graphviz/graphviz.factor | 2 +- extra/gemini/cli/cli.factor | 2 +- extra/gemini/gemini.factor | 2 +- extra/git/git-tests.factor | 2 +- extra/git/git.factor | 2 +- extra/gopher/gopher.factor | 2 +- .../io/streams/counting/counting-tests.factor | 2 +- extra/literate/literate.factor | 2 +- .../data-sets/data-sets.factor | 2 +- extra/metar/metar.factor | 2 +- extra/pdf/layout/layout.factor | 4 +- extra/pdf/pdf.factor | 2 +- extra/pdf/streams/streams.factor | 2 +- extra/robots/robots.factor | 2 +- extra/shell/shell.factor | 2 +- .../subrip-subtitles/subrip-subtitles.factor | 2 +- extra/text-to-pdf/text-to-pdf.factor | 2 +- extra/text-to-pdf/text-to-pdf.pdf | 2 +- extra/txon/txon.factor | 2 +- extra/webapps/wiki/wiki.factor | 2 +- extra/wikipedia/wikipedia.factor | 2 +- extra/wolfram-alpha/wolfram-alpha.factor | 2 +- misc/vim/syntax/factor/generated.vim | 2 +- 61 files changed, 119 insertions(+), 111 deletions(-) diff --git a/basis/bootstrap/compiler/compiler.factor b/basis/bootstrap/compiler/compiler.factor index 268e32470e..80ed054bcf 100644 --- a/basis/bootstrap/compiler/compiler.factor +++ b/basis/bootstrap/compiler/compiler.factor @@ -97,7 +97,7 @@ gc "." write flush { - lines prefix suffix unclip new-assoc assoc-union! + read-lines prefix suffix unclip new-assoc assoc-union! word-prop set-word-prop 1array 2array 3array ?nth } compile-unoptimized diff --git a/basis/bootstrap/image/download/download.factor b/basis/bootstrap/image/download/download.factor index fa11caa0cf..e554e2aade 100644 --- a/basis/bootstrap/image/download/download.factor +++ b/basis/bootstrap/image/download/download.factor @@ -8,7 +8,7 @@ CONSTANT: url URL" http://downloads.factorcode.org/images/master/" : download-checksums ( -- alist ) url "checksums.txt" >url derive-url http-get nip - string-lines [ " " split1 ] { } map>assoc ; + lines [ " " split1 ] { } map>assoc ; : file-checksum ( image -- checksum ) md5 checksum-file bytes>hex-string ; diff --git a/basis/calendar/format/format.factor b/basis/calendar/format/format.factor index f7705f09b4..016f49963f 100644 --- a/basis/calendar/format/format.factor +++ b/basis/calendar/format/format.factor @@ -94,7 +94,7 @@ M: integer year. [ [ month-name 20 center. ] [ days-header. days. nl nl ] bi - ] with-string-writer string-lines + ] with-string-writer lines ] with map 3 [ first3 [ "%-20s %-20s %-20s\n" printf ] 3each ] each ; diff --git a/basis/documents/documents.factor b/basis/documents/documents.factor index 8beed6324b..b435a23375 100644 --- a/basis/documents/documents.factor +++ b/basis/documents/documents.factor @@ -109,7 +109,7 @@ CONSTANT: doc-start { 0 0 } [ t >>inside-undo? ] dip keep f >>inside-undo? drop ; inline : split-lines ( str -- seq ) - [ string-lines ] keep ?last + [ lines ] keep ?last [ "\r\n" member? ] [ t ] if* [ "" suffix ] when ; diff --git a/basis/escape-strings/escape-strings.factor b/basis/escape-strings/escape-strings.factor index 3ec35209ec..136e4992b2 100644 --- a/basis/escape-strings/escape-strings.factor +++ b/basis/escape-strings/escape-strings.factor @@ -91,4 +91,4 @@ M: sequence sha1-escape-strings ( seq -- strs ) [ sha1-escape-string ] { } map-as ; M: string sha1-escape-strings ( str -- strs ) - string-lines sha1-escape-strings ; \ No newline at end of file + lines sha1-escape-strings ; \ No newline at end of file diff --git a/basis/eval/eval.factor b/basis/eval/eval.factor index a2166cfa4c..eb8a23e70e 100644 --- a/basis/eval/eval.factor +++ b/basis/eval/eval.factor @@ -6,7 +6,7 @@ parser.notes splitting ; IN: eval : parse-string ( str -- quot ) - [ string-lines parse-lines ] with-compilation-unit ; + [ lines parse-lines ] with-compilation-unit ; : (eval) ( str effect -- ) [ parse-string ] dip call-effect ; inline diff --git a/basis/farkup/farkup.factor b/basis/farkup/farkup.factor index 4107bb7d16..3d4587b762 100644 --- a/basis/farkup/farkup.factor +++ b/basis/farkup/farkup.factor @@ -203,7 +203,7 @@ DEFER: (parse-paragraph) } case ; : parse-farkup ( string -- farkup ) - string-lines [ dup empty? not ] [ parse-item ] produce nip sift ; + lines [ dup empty? not ] [ parse-item ] produce nip sift ; CONSTANT: invalid-url "javascript:alert('Invalid URL in farkup');" @@ -217,7 +217,7 @@ CONSTANT: invalid-url "javascript:alert('Invalid URL in farkup');" } cond ; : render-code ( string mode -- xml ) - [ string-lines ] dip htmlize-lines + [ lines ] dip htmlize-lines [XML
<->
XML] ; GENERIC: (write-farkup) ( farkup -- xml ) diff --git a/basis/ftp/server/server.factor b/basis/ftp/server/server.factor index 0459518853..72f1ad5420 100644 --- a/basis/ftp/server/server.factor +++ b/basis/ftp/server/server.factor @@ -180,7 +180,7 @@ M: ftp-list handle-passive-command start-directory [ utf8 encode-output [ "." directory. - ] with-string-writer string-lines + ] with-string-writer lines harvest [ ftp-send ] each ] with-output-stream finish-directory ; diff --git a/basis/help/syntax/syntax.factor b/basis/help/syntax/syntax.factor index 3f3c986b4a..494d2c1294 100644 --- a/basis/help/syntax/syntax.factor +++ b/basis/help/syntax/syntax.factor @@ -79,7 +79,7 @@ IN: help.syntax ] produce nip ; : code-lines ( str -- seq ) - string-lines [ [ blank? ] trim ] map harvest ; + lines [ [ blank? ] trim ] map harvest ; : make-example ( str -- seq ) code-lines dup { [ array? ] [ length 1 > ] } 1&& [ diff --git a/basis/html/components/components.factor b/basis/html/components/components.factor index 46872111d0..1ccbba89e4 100644 --- a/basis/html/components/components.factor +++ b/basis/html/components/components.factor @@ -150,11 +150,11 @@ TUPLE: code mode ; : ( -- code ) code new ; -: ?string-lines ( str/f -- seq ) - [ { } ] [ string-lines ] if-empty ; +: ?lines ( str/f -- seq ) + [ { } ] [ lines ] if-empty ; M: code render* - [ ?string-lines ] [ drop ] [ mode>> value ] tri* htmlize-lines ; + [ ?lines ] [ drop ] [ mode>> value ] tri* htmlize-lines ; ! Farkup component TUPLE: farkup no-follow disable-images parsed ; diff --git a/basis/html/templates/fhtml/fhtml.factor b/basis/html/templates/fhtml/fhtml.factor index 768bc41ea4..6713facbad 100644 --- a/basis/html/templates/fhtml/fhtml.factor +++ b/basis/html/templates/fhtml/fhtml.factor @@ -58,7 +58,7 @@ SYNTAX: %> lexer get parse-%> ; [ parser-quiet? on "html.templates.fhtml" use-vocab - string-lines parse-template-lines + lines parse-template-lines ] with-file-vocabs ] with-compilation-unit ; diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index 0d136bc63c..11a9ae186e 100644 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -66,7 +66,7 @@ ${ read-request-test-1' } [ [ read-request ] with-string-reader [ write-request ] with-string-writer ! normalize crlf - string-lines "\n" join + lines "\n" join ] unit-test STRING: read-request-test-2 @@ -165,7 +165,7 @@ ${ read-response-test-1' } [ [ read-response ] with-string-reader [ write-response ] with-string-writer ! normalize crlf - string-lines "\n" join + lines "\n" join ] unit-test { t } [ diff --git a/basis/io/launcher/launcher-docs.factor b/basis/io/launcher/launcher-docs.factor index 65bf509e41..60628b71bc 100644 --- a/basis/io/launcher/launcher-docs.factor +++ b/basis/io/launcher/launcher-docs.factor @@ -237,7 +237,7 @@ HELP: with-process-reader { $examples { $unchecked-example "USING: io.launcher prettyprint io.encodings.utf8 ;" - "\"ls -dl /etc\" utf8 [ contents ] with-process-reader ." + "\"ls -dl /etc\" utf8 [ read-contents ] with-process-reader ." "\"drwxr-xr-x 213 root root 12288 mar 11 18:52 /etc\\n\"" } } ; diff --git a/basis/io/launcher/windows/windows-tests.factor b/basis/io/launcher/windows/windows-tests.factor index 13576e9fb3..08d3bb6e2c 100644 --- a/basis/io/launcher/windows/windows-tests.factor +++ b/basis/io/launcher/windows/windows-tests.factor @@ -158,7 +158,7 @@ SYMBOLS: out-path err-path ; launcher-test-path [ console-vm-path "-script" "env.factor" 3array >>command - utf8 [ contents ] with-process-reader + utf8 [ read-contents ] with-process-reader ] with-directory eval( -- alist ) os-envs = @@ -170,7 +170,7 @@ SYMBOLS: out-path err-path ; console-vm-path "-script" "env.factor" 3array >>command +replace-environment+ >>environment-mode os-envs >>environment - utf8 [ contents ] with-process-reader + utf8 [ read-contents ] with-process-reader ] with-directory eval( -- alist ) os-envs = @@ -181,7 +181,7 @@ SYMBOLS: out-path err-path ; console-vm-path "-script" "env.factor" 3array >>command { { "A" "B" } } >>environment - utf8 [ contents ] with-process-reader + utf8 [ read-contents ] with-process-reader ] with-directory eval( -- alist ) "A" of @@ -193,7 +193,7 @@ SYMBOLS: out-path err-path ; console-vm-path "-script" "env.factor" 3array >>command { { "USERPROFILE" "XXX" } } >>environment +prepend-environment+ >>environment-mode - utf8 [ contents ] with-process-reader + utf8 [ read-contents ] with-process-reader ] with-directory eval( -- alist ) "USERPROFILE" of "XXX" = diff --git a/basis/io/streams/limited/limited-tests.factor b/basis/io/streams/limited/limited-tests.factor index 6437761079..ccd4da8a53 100644 --- a/basis/io/streams/limited/limited-tests.factor +++ b/basis/io/streams/limited/limited-tests.factor @@ -104,22 +104,22 @@ namespaces strings tools.test ; { "asdf" } [ "asdf" 2 [ - unlimited-input contents + unlimited-input read-contents ] with-input-stream ] unit-test { "asdf" } [ "asdf" 2 [ - [ contents ] with-unlimited-input + [ read-contents ] with-unlimited-input ] with-input-stream ] unit-test { "gh" } [ "asdfgh" 4 [ 2 [ - [ contents drop ] with-unlimited-input + [ read-contents drop ] with-unlimited-input ] with-limited-input - [ contents ] with-unlimited-input + [ read-contents ] with-unlimited-input ] with-input-stream ] unit-test diff --git a/basis/io/streams/string/string-tests.factor b/basis/io/streams/string/string-tests.factor index 82bf549f53..0632a76b94 100644 --- a/basis/io/streams/string/string-tests.factor +++ b/basis/io/streams/string/string-tests.factor @@ -1,7 +1,7 @@ USING: io.streams.string io kernel arrays namespaces make tools.test ; -{ "" } [ "" [ contents ] with-string-reader ] unit-test +{ "" } [ "" [ read-contents ] with-string-reader ] unit-test { "line 1" CHAR: l } [ @@ -10,11 +10,11 @@ tools.test ; unit-test { { "line 1" "line 2" "line 3" } } [ - "line 1\nline 2\nline 3" [ lines ] with-string-reader + "line 1\nline 2\nline 3" [ read-lines ] with-string-reader ] unit-test { { "" "foo" "bar" "baz" } } [ - "\rfoo\r\nbar\rbaz\n" [ lines ] with-string-reader + "\rfoo\r\nbar\rbaz\n" [ read-lines ] with-string-reader ] unit-test { f } [ "" [ readln ] with-string-reader ] unit-test diff --git a/basis/logging/logging.factor b/basis/logging/logging.factor index 62cd2f82b3..a6633f84d0 100644 --- a/basis/logging/logging.factor +++ b/basis/logging/logging.factor @@ -46,7 +46,7 @@ ERROR: bad-log-message-parameters msg word level ; check-log-message log-service get 2dup [ log? ] [ ] bi* and [ - [ [ string-lines ] [ name>> ] [ name>> ] tri* ] dip + [ [ lines ] [ name>> ] [ name>> ] tri* ] dip 4array "log-message" send-to-log-server ] [ 4drop diff --git a/basis/mime/multipart/multipart.factor b/basis/mime/multipart/multipart.factor index 6ffcd2afc6..f808cbdde0 100644 --- a/basis/mime/multipart/multipart.factor +++ b/basis/mime/multipart/multipart.factor @@ -33,7 +33,7 @@ C: mime-variable >byte-array write ; : parse-headers ( string -- hashtable ) - string-lines harvest [ parse-header-line ] map >hashtable ; + lines harvest [ parse-header-line ] map >hashtable ; : fill-bytes ( multipart -- multipart ) buffer-size read diff --git a/basis/peg/ebnf/ebnf.factor b/basis/peg/ebnf/ebnf.factor index 1b1208b991..5ba1de3373 100644 --- a/basis/peg/ebnf/ebnf.factor +++ b/basis/peg/ebnf/ebnf.factor @@ -488,7 +488,7 @@ ERROR: bad-effect quot effect ; H{ { "dup" dup } { "nip" nip } { "over" over } ! kernel { "nth" nth } ! sequences - } [ string-lines parse-lines ] with-words ; + } [ lines parse-lines ] with-words ; M: ebnf-action (transform) ebnf-transform check-action-effect action ; diff --git a/basis/quoted-printable/quoted-printable-tests.factor b/basis/quoted-printable/quoted-printable-tests.factor index 2e51891fbb..54ca5fea88 100644 --- a/basis/quoted-printable/quoted-printable-tests.factor +++ b/basis/quoted-printable/quoted-printable-tests.factor @@ -24,7 +24,7 @@ and we didn't know hów tö do thât" latin2 encode >quoted ] unit-test 55 [ "hello" ] replicate concat ; { f } [ message >quoted "=\r\n" swap subseq? ] unit-test -{ 1 } [ message >quoted string-lines length ] unit-test +{ 1 } [ message >quoted lines length ] unit-test { t } [ message >quoted-lines "=\r\n" swap subseq? ] unit-test -{ 4 } [ message >quoted-lines string-lines length ] unit-test -{ "===o" } [ message >quoted-lines string-lines [ last ] "" map-as ] unit-test +{ 4 } [ message >quoted-lines lines length ] unit-test +{ "===o" } [ message >quoted-lines lines [ last ] "" map-as ] unit-test diff --git a/basis/resolv-conf/resolv-conf.factor b/basis/resolv-conf/resolv-conf.factor index 8a271e42ea..01d0c49e9b 100644 --- a/basis/resolv-conf/resolv-conf.factor +++ b/basis/resolv-conf/resolv-conf.factor @@ -94,7 +94,7 @@ PRIVATE> [ parse-resolv.conf-line ] each ; : string>resolv.conf ( string -- resolv.conf ) - string-lines lines>resolv.conf ; + lines lines>resolv.conf ; : path>resolv.conf ( path -- resolv.conf ) utf8 file-lines lines>resolv.conf ; diff --git a/basis/strings/tables/tables.factor b/basis/strings/tables/tables.factor index 8fe5710102..c3e5aca1cb 100644 --- a/basis/strings/tables/tables.factor +++ b/basis/strings/tables/tables.factor @@ -14,7 +14,7 @@ IN: strings.tables PRIVATE> : format-table ( table -- seq ) - [ [ string-lines ] map format-row flip ] map concat flip + [ [ lines ] map format-row flip ] map concat flip [ { } ] [ [ but-last-slice [ format-column ] map! drop ] keep flip [ " " join ] map! diff --git a/basis/tools/deploy/config/editor/editor.factor b/basis/tools/deploy/config/editor/editor.factor index c9ecac3b0a..908e479cbc 100644 --- a/basis/tools/deploy/config/editor/editor.factor +++ b/basis/tools/deploy/config/editor/editor.factor @@ -14,7 +14,7 @@ IN: tools.deploy.config.editor parse-fresh [ first assoc-union ] unless-empty ; : set-deploy-config ( assoc vocab -- ) - [ [ unparse-use ] without-limits string-lines ] dip + [ [ unparse-use ] without-limits lines ] dip "deploy.factor" set-vocab-file-lines ; : set-deploy-flag ( value key vocab -- ) diff --git a/basis/ui/gadgets/labels/labels.factor b/basis/ui/gadgets/labels/labels.factor index d4a0cd03e4..7ba544392f 100644 --- a/basis/ui/gadgets/labels/labels.factor +++ b/basis/ui/gadgets/labels/labels.factor @@ -22,7 +22,7 @@ PREDICATE: string-array < array [ string? ] all? ; PRIVATE> : ?string-lines ( string -- string/array ) - CHAR: \n over member-eq? [ string-lines ] when ; + CHAR: \n over member-eq? [ lines ] when ; M: label string<< [ diff --git a/basis/ui/gadgets/tables/tables.factor b/basis/ui/gadgets/tables/tables.factor index db685b64e4..fd9550e949 100644 --- a/basis/ui/gadgets/tables/tables.factor +++ b/basis/ui/gadgets/tables/tables.factor @@ -71,7 +71,7 @@ M: f cell-dim 2drop 0 0 0 ; M: f draw-cell 2drop ; : single-line ( str -- str' ) - dup [ "\r\n" member? ] any? [ string-lines " " join ] when ; + dup [ "\r\n" member? ] any? [ lines " " join ] when ; M: string cell-dim single-line text-dim first2 ceiling 0 ; M: string draw-cell single-line draw-text ; diff --git a/basis/unicode/collation/collation-tests.factor b/basis/unicode/collation/collation-tests.factor index b2fa139c8e..c5d2a5e7ec 100644 --- a/basis/unicode/collation/collation-tests.factor +++ b/basis/unicode/collation/collation-tests.factor @@ -19,7 +19,7 @@ IN: unicode.collation.tests : collation-test-lines ( -- lines ) "vocab:unicode/UCA/CollationTest_SHIFTED.txt.zip" - binary file-contents uncompress utf8 decode string-lines + binary file-contents uncompress utf8 decode lines [ "#" head? ] reject harvest ; : parse-collation-test-shifted ( -- lines ) diff --git a/basis/vocabs/platforms/platforms.factor b/basis/vocabs/platforms/platforms.factor index 4cab775310..6b5dc5b498 100644 --- a/basis/vocabs/platforms/platforms.factor +++ b/basis/vocabs/platforms/platforms.factor @@ -15,7 +15,7 @@ IN: vocabs.platforms : parse-platform-section ( string suffix -- ) [ - [ [ string-lines parse-lines ] curry with-nested-compilation-unit ] + [ [ lines parse-lines ] curry with-nested-compilation-unit ] curry ] dip with-vocabulary drop ; inline diff --git a/basis/wrap/strings/strings.factor b/basis/wrap/strings/strings.factor index bcc49ac894..46e8b792b7 100644 --- a/basis/wrap/strings/strings.factor +++ b/basis/wrap/strings/strings.factor @@ -12,7 +12,7 @@ IN: wrap.strings swap [ 0 over length prefix ] when* ; : split-lines ( string -- elements-lines ) - string-lines [ split-line ] map! ; + lines [ split-line ] map! ; : join-elements ( wrapped-lines -- lines ) [ " " join ] map! ; diff --git a/basis/xmode/code2html/code2html-tests.factor b/basis/xmode/code2html/code2html-tests.factor index e98b8af10a..3faffc0078 100644 --- a/basis/xmode/code2html/code2html-tests.factor +++ b/basis/xmode/code2html/code2html-tests.factor @@ -6,7 +6,7 @@ splitting memoize kernel io.streams.string xml.writer ; { } [ "