From 6f1c44b46d15dd910e367f3693f8dd643d7342f1 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sat, 15 Oct 2011 19:19:44 -0700 Subject: [PATCH] Cleanup some lint warnings. --- basis/calendar/format/format.factor | 2 +- basis/classes/struct/struct-tests.factor | 2 +- basis/http/server/server.factor | 2 +- basis/json/reader/reader.factor | 18 +++++++++--------- basis/math/bitwise/bitwise.factor | 4 ++-- basis/math/combinatorics/combinatorics.factor | 2 +- basis/math/polynomials/polynomials.factor | 4 ++-- .../rectangles/positioning/positioning.factor | 4 ++-- basis/math/statistics/statistics.factor | 2 +- basis/opengl/gl/extensions/extensions.factor | 2 +- basis/openssl/openssl.factor | 2 +- basis/peg/search/search.factor | 4 ++-- .../persistent/hashtables/config/config.factor | 6 +++--- basis/regexp/nfa/nfa.factor | 4 ++-- basis/syndication/syndication.factor | 3 +-- basis/tools/deploy/shaker/shaker.factor | 2 +- basis/tools/deploy/windows/ico/ico.factor | 4 ++-- basis/tools/scaffold/scaffold.factor | 2 +- basis/tools/trace/trace.factor | 4 ++-- basis/ui/gadgets/buttons/buttons.factor | 2 +- basis/ui/gadgets/sliders/sliders.factor | 5 ++--- basis/ui/tools/listener/listener.factor | 2 +- basis/xmode/marker/marker.factor | 2 +- core/math/floats/floats.factor | 2 +- core/math/parser/parser.factor | 2 +- extra/math/compare/compare.factor | 4 ++-- extra/project-euler/044/044.factor | 2 +- extra/robots/robots.factor | 2 +- extra/webapps/user-admin/user-admin.factor | 2 +- 29 files changed, 48 insertions(+), 50 deletions(-) diff --git a/basis/calendar/format/format.factor b/basis/calendar/format/format.factor index ac2e902c86..48c0ce6ed9 100644 --- a/basis/calendar/format/format.factor +++ b/basis/calendar/format/format.factor @@ -264,7 +264,7 @@ ERROR: invalid-timestamp-format ; [ (hms>timestamp) ] with-string-reader ; : (ymd>timestamp) ( -- timestamp ) - read-ymd 0 0 0 instant ; + read-ymd ; : ymd>timestamp ( str -- timestamp ) [ (ymd>timestamp) ] with-string-reader ; diff --git a/basis/classes/struct/struct-tests.factor b/basis/classes/struct/struct-tests.factor index 524875ecd0..4d4d553be8 100644 --- a/basis/classes/struct/struct-tests.factor +++ b/basis/classes/struct/struct-tests.factor @@ -297,7 +297,7 @@ SPECIALIZED-ARRAY: struct-test-optimization [ t ] [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test [ t ] [ - [ 3 third y>> ] + [ 3 struct-test-optimization third y>> ] { memory>struct y>> } inlined? ] unit-test diff --git a/basis/http/server/server.factor b/basis/http/server/server.factor index 3f67ad3d83..961d3d34b4 100644 --- a/basis/http/server/server.factor +++ b/basis/http/server/server.factor @@ -128,7 +128,7 @@ GENERIC: write-full-response ( request response -- ) over unparse-content-type "content-type" pick set-at over cookies>> [ ensure-domain unparse-set-cookie - "set-cookie" swap 2array over push + "set-cookie" swap 2array suffix! ] each write-header ; diff --git a/basis/json/reader/reader.factor b/basis/json/reader/reader.factor index 95b851d5f7..fd6e808957 100644 --- a/basis/json/reader/reader.factor +++ b/basis/json/reader/reader.factor @@ -52,29 +52,29 @@ ERROR: json-error ; dup last V{ } = not [ v-over-push ] when ; : (close-array) ( accum -- accum' ) - (close) dup pop >array over push ; + (close) dup pop >array suffix! ; : (close-hash) ( accum -- accum' ) - (close) dup dup [ pop ] bi@ swap zip >hashtable over push ; + (close) dup dup [ pop ] bi@ swap zip >hashtable suffix! ; : scan ( accum char -- accum ) ! 2dup 1string swap . . ! Great for debug... { - { CHAR: \" [ j-string over push ] } - { CHAR: [ [ V{ } clone over push ] } + { CHAR: \" [ j-string suffix! ] } + { CHAR: [ [ V{ } clone suffix! ] } { CHAR: , [ v-over-push ] } { CHAR: ] [ (close-array) ] } - { CHAR: { [ 2 [ V{ } clone over push ] times ] } + { CHAR: { [ 2 [ V{ } clone suffix! ] times ] } { CHAR: : [ v-pick-push ] } { CHAR: } [ (close-hash) ] } { CHAR: \s [ ] } { CHAR: \t [ ] } { CHAR: \r [ ] } { CHAR: \n [ ] } - { CHAR: t [ 3 read drop t over push ] } - { CHAR: f [ 4 read drop f over push ] } - { CHAR: n [ 3 read drop json-null over push ] } - [ value [ over push ] dip [ scan ] when* ] + { CHAR: t [ 3 read drop t suffix! ] } + { CHAR: f [ 4 read drop f suffix! ] } + { CHAR: n [ 3 read drop json-null suffix! ] } + [ value [ suffix! ] dip [ scan ] when* ] } case ; PRIVATE> diff --git a/basis/math/bitwise/bitwise.factor b/basis/math/bitwise/bitwise.factor index 32f683bbc6..509d1d3ca0 100644 --- a/basis/math/bitwise/bitwise.factor +++ b/basis/math/bitwise/bitwise.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays assocs combinators combinators.smart fry kernel macros math math.bits sequences sequences.private words -byte-arrays alien alien.c-types specialized-arrays ; +byte-arrays alien alien.c-types alien.data specialized-arrays ; SPECIALIZED-ARRAY: uchar IN: math.bitwise @@ -117,7 +117,7 @@ M: byte-array bit-count byte-array-bit-count ; M: object bit-count - binary-object byte-array-bit-count ; + binary-object uchar byte-array-bit-count ; : even-parity? ( obj -- ? ) bit-count even? ; diff --git a/basis/math/combinatorics/combinatorics.factor b/basis/math/combinatorics/combinatorics.factor index 1cc7d1462a..17739cdac5 100644 --- a/basis/math/combinatorics/combinatorics.factor +++ b/basis/math/combinatorics/combinatorics.factor @@ -124,7 +124,7 @@ PRIVATE> apply-combination ; : all-combinations ( seq k -- seq' ) - [ ] combinations-quot map ; + [ ] map-combinations ; : reduce-combinations ( seq k identity quot -- result ) [ -rot ] dip each-combination ; inline diff --git a/basis/math/polynomials/polynomials.factor b/basis/math/polynomials/polynomials.factor index 966adb3db4..e85d71e7a6 100644 --- a/basis/math/polynomials/polynomials.factor +++ b/basis/math/polynomials/polynomials.factor @@ -8,8 +8,8 @@ IN: math.polynomials : 2pad-head ( p q n -- p q ) [ 0 pad-head ] curry bi@ ; : 2pad-tail ( p q n -- p q ) [ 0 pad-tail ] curry bi@ ; -: pextend ( p q -- p q ) 2dup [ length ] bi@ max 2pad-tail ; -: pextend-left ( p q -- p q ) 2dup [ length ] bi@ max 2pad-head ; +: pextend ( p q -- p q ) 2dup max-length 2pad-tail ; +: pextend-left ( p q -- p q ) 2dup max-length 2pad-head ; : unempty ( seq -- seq ) [ { 0 } ] when-empty ; : 2unempty ( seq seq -- seq seq ) [ unempty ] bi@ ; diff --git a/basis/math/rectangles/positioning/positioning.factor b/basis/math/rectangles/positioning/positioning.factor index 6b1348ca88..05febe4ba8 100644 --- a/basis/math/rectangles/positioning/positioning.factor +++ b/basis/math/rectangles/positioning/positioning.factor @@ -17,7 +17,7 @@ IN: math.rectangles.positioning [ loc>> first ] 2dip swap [ first ] bi@ - min 0 max ; : preferred-y ( visible-rect -- y ) - [ loc>> ] [ dim>> ] bi [ second ] bi@ + ; + rect-bounds [ second ] bi@ + ; : alternate-y ( visible-rect popup-dim -- y ) [ loc>> ] dip [ second ] bi@ - ; @@ -42,4 +42,4 @@ PRIVATE> : popup-rect ( visible-rect popup-dim screen-dim -- rect ) [ adjust-visible-rect ] 2keep - [ popup-loc dup ] 2keep popup-dim ; \ No newline at end of file + [ popup-loc dup ] 2keep popup-dim ; diff --git a/basis/math/statistics/statistics.factor b/basis/math/statistics/statistics.factor index 455332dfb8..46b24bc98b 100644 --- a/basis/math/statistics/statistics.factor +++ b/basis/math/statistics/statistics.factor @@ -92,7 +92,7 @@ PRIVATE> : mode ( seq -- x ) histogram >alist - [ ] [ [ [ second ] bi@ > ] 2keep ? ] map-reduce first ; + [ ] [ [ [ second ] bi@ > ] most ] map-reduce first ; ERROR: empty-sequence ; diff --git a/basis/opengl/gl/extensions/extensions.factor b/basis/opengl/gl/extensions/extensions.factor index 2232f32891..f4165d7e20 100644 --- a/basis/opengl/gl/extensions/extensions.factor +++ b/basis/opengl/gl/extensions/extensions.factor @@ -42,7 +42,7 @@ reset-gl-function-number-counter '[ @ _ _ _ alien-indirect ] ; :: define-indirect ( abi return function-name function-ptr-quot types names -- ) - function-name create-in dup reset-generic + function-name create-function function-ptr-quot return types abi indirect-quot names return function-effect define-declared ; diff --git a/basis/openssl/openssl.factor b/basis/openssl/openssl.factor index 76806f9523..9315e43a39 100644 --- a/basis/openssl/openssl.factor +++ b/basis/openssl/openssl.factor @@ -12,7 +12,7 @@ SINGLETON: openssl ERR_clear_error f ERR_error_string ; : ssl-error-string ( -- string ) - ERR_get_error ERR_clear_error f ERR_error_string ; + ERR_get_error (ssl-error-string) ; : (ssl-error) ( -- * ) ssl-error-string throw ; diff --git a/basis/peg/search/search.factor b/basis/peg/search/search.factor index 04e4affe39..3b12ef80a2 100644 --- a/basis/peg/search/search.factor +++ b/basis/peg/search/search.factor @@ -16,12 +16,12 @@ MEMO: any-char-parser ( -- parser ) [ drop t ] satisfy ; : search ( string parser -- seq ) - any-char-parser [ drop f ] action 2array choice repeat0 + any-char-parser [ drop f ] action 2choice repeat0 [ parse sift ] [ 3drop { } ] recover ; : (replace) ( string parser -- seq ) - any-char-parser 2array choice repeat0 parse sift ; + any-char-parser 2choice repeat0 parse sift ; : replace ( string parser -- result ) [ (replace) [ tree-write ] each ] with-string-writer ; diff --git a/basis/persistent/hashtables/config/config.factor b/basis/persistent/hashtables/config/config.factor index 190db9e9ab..1aeb4e0f41 100644 --- a/basis/persistent/hashtables/config/config.factor +++ b/basis/persistent/hashtables/config/config.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: layouts kernel parser math sequences ; +USING: layouts kernel parser math math.bitwise sequences ; IN: persistent.hashtables.config : radix-bits ( -- n ) << cell 4 = 4 5 ? suffix! >> ; foldable -: radix-mask ( -- n ) radix-bits 2^ 1 - ; foldable -: full-bitmap-mask ( -- n ) radix-bits 2^ 2^ 1 - ; inline +: radix-mask ( -- n ) radix-bits on-bits ; foldable +: full-bitmap-mask ( -- n ) radix-bits 2^ on-bits ; inline diff --git a/basis/regexp/nfa/nfa.factor b/basis/regexp/nfa/nfa.factor index fb210c5ef2..a28921f4a0 100644 --- a/basis/regexp/nfa/nfa.factor +++ b/basis/regexp/nfa/nfa.factor @@ -137,8 +137,8 @@ M: LETTER-class modify-class modify-letter-class ; : cased-range? ( range -- ? ) [ from>> ] [ to>> ] bi { - [ [ letter? ] bi@ and ] - [ [ LETTER? ] bi@ and ] + [ [ letter? ] both? ] + [ [ LETTER? ] both? ] } 2|| ; M: range-class modify-class diff --git a/basis/syndication/syndication.factor b/basis/syndication/syndication.factor index 88fae781ea..0cc124c088 100644 --- a/basis/syndication/syndication.factor +++ b/basis/syndication/syndication.factor @@ -88,8 +88,7 @@ TUPLE: entry title url description date ; } cleave ; : atom1.0 ( xml -- feed ) - feed new - swap + swap [ "title" tag-named children>string >>title ] [ "link" tag-named "href" attr >url >>url ] [ "entry" tags-named [ atom1.0-entry ] map set-entries ] diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index 2ca9438963..7fa68b41ff 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -415,7 +415,7 @@ IN: tools.deploy.shaker ! On Windows, even if deploy-io is 3, C streams are still used ! for the console, so don't strip it there. strip-io? - deploy-io get 3 = os windows? not and + native-io? os windows? not and or [ "Stripping C I/O" show "vocab:tools/deploy/shaker/strip-c-io.factor" run-file diff --git a/basis/tools/deploy/windows/ico/ico.factor b/basis/tools/deploy/windows/ico/ico.factor index 46610c487d..6f4b1d5b34 100755 --- a/basis/tools/deploy/windows/ico/ico.factor +++ b/basis/tools/deploy/windows/ico/ico.factor @@ -43,8 +43,8 @@ STRUCT: group-directory-entry :: ico-group-and-icons ( bytes -- group-bytes icon-bytes ) bytes ico-header memory>struct :> header - ico-header heap-size bytes - header ImageCount>> :> directory + ico-header heap-size bytes + header ImageCount>> ioc-directory-entry :> directory directory dup length iota [ ico>group-directory-entry ] { } 2map-as :> group-directory diff --git a/basis/tools/scaffold/scaffold.factor b/basis/tools/scaffold/scaffold.factor index 6b97361864..99a4e720d5 100644 --- a/basis/tools/scaffold/scaffold.factor +++ b/basis/tools/scaffold/scaffold.factor @@ -167,7 +167,7 @@ ERROR: vocab-name-contains-dot path ; : $values. ( word -- ) "declared-effect" word-prop [ [ in>> ] [ out>> ] bi - 2dup [ empty? ] bi@ and [ + 2dup [ empty? ] both? [ 2drop ] [ [ members ] dip over diff diff --git a/basis/tools/trace/trace.factor b/basis/tools/trace/trace.factor index f7f0ae4a69..fcc76071dc 100644 --- a/basis/tools/trace/trace.factor +++ b/basis/tools/trace/trace.factor @@ -15,7 +15,7 @@ exclude-vocabs { "math" "accessors" } swap set-global array length 2/ ; + callstack>array midpoint@ ; SYMBOL: end @@ -87,4 +87,4 @@ PRIVATE> [ break ] [ end drop ] surround with-variable ; -<< \ trace t "no-compile" set-word-prop >> \ No newline at end of file +<< \ trace t "no-compile" set-word-prop >> diff --git a/basis/ui/gadgets/buttons/buttons.factor b/basis/ui/gadgets/buttons/buttons.factor index 4a68b47f15..44ce92ed8d 100644 --- a/basis/ui/gadgets/buttons/buttons.factor +++ b/basis/ui/gadgets/buttons/buttons.factor @@ -137,7 +137,7 @@ CONSTANT: button-clicked-background COLOR: FactorDarkSlateBlue dup label? [ [ clone t >>bold? ] change-font ] when drop ; : border-button-theme ( gadget -- gadget ) - dup children>> first border-button-label-theme + dup gadget-child border-button-label-theme horizontal >>orientation >>interior dup dup interior>> pen-pref-dim >>min-dim diff --git a/basis/ui/gadgets/sliders/sliders.factor b/basis/ui/gadgets/sliders/sliders.factor index 867a53eb68..c47bafba2a 100644 --- a/basis/ui/gadgets/sliders/sliders.factor +++ b/basis/ui/gadgets/sliders/sliders.factor @@ -142,12 +142,11 @@ elevator H{ [ slider>screen elevator-padding + ] tri ; : layout-thumb-loc ( thumb slider -- ) - [ thumb-loc ] [ orientation>> ] bi n*v - [ floor ] map >>loc drop ; + [ thumb-loc ] [ orientation>> ] bi n*v vfloor >>loc drop ; : layout-thumb-dim ( thumb slider -- ) [ dim>> ] [ thumb-dim ] [ orientation>> ] tri [ n*v ] keep set-axis - [ ceiling ] map >>dim drop ; + vceiling >>dim drop ; : slider-enabled? ( slider -- ? ) visible-portion 1 = not ; diff --git a/basis/ui/tools/listener/listener.factor b/basis/ui/tools/listener/listener.factor index bd877e66e4..0a24a00c25 100644 --- a/basis/ui/tools/listener/listener.factor +++ b/basis/ui/tools/listener/listener.factor @@ -318,7 +318,7 @@ M: object accept-completion-hook 2drop ; : quot-action ( interactor -- lines ) [ history>> history-add drop ] [ control-value ] [ select-all ] tri - [ parse-lines ] with-compilation-unit ; + parse-lines-interactive ; : ( error continuation -- popup ) over compute-restarts [ hide-glass ] "Error" ; diff --git a/basis/xmode/marker/marker.factor b/basis/xmode/marker/marker.factor index 73519e105c..4daa059911 100644 --- a/basis/xmode/marker/marker.factor +++ b/basis/xmode/marker/marker.factor @@ -250,7 +250,7 @@ M: mark-previous-rule handle-rule-start : rule-set-empty? ( ruleset -- ? ) [ rules>> ] [ keywords>> ] bi - [ assoc-empty? ] bi@ and ; + [ assoc-empty? ] both? ; : check-word-break ( -- ? ) current-char dup blank? [ diff --git a/core/math/floats/floats.factor b/core/math/floats/floats.factor index 49e5ec30cc..9c8efbfbb1 100644 --- a/core/math/floats/floats.factor +++ b/core/math/floats/floats.factor @@ -3,7 +3,7 @@ USING: kernel math math.private math.order ; IN: math.floats.private -: float-unordered? ( x y -- ? ) [ fp-nan? ] bi@ or ; +: float-unordered? ( x y -- ? ) [ fp-nan? ] either? ; : float-min ( x y -- z ) [ float< ] most ; foldable : float-max ( x y -- z ) [ float> ] most ; foldable diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor index 31ab2e7da9..2d8f00dac5 100644 --- a/core/math/parser/parser.factor +++ b/core/math/parser/parser.factor @@ -351,7 +351,7 @@ M: ratio >base : float>hex-value ( mantissa -- str ) >hex 13 CHAR: 0 pad-head [ CHAR: 0 = ] trim-tail - [ "0" ] [ ] if-empty "1." prepend ; + [ "0" ] when-empty "1." prepend ; : float>hex-expt ( mantissa -- str ) 10 >base "p" prepend ; diff --git a/extra/math/compare/compare.factor b/extra/math/compare/compare.factor index b48641d723..f7f66da37c 100644 --- a/extra/math/compare/compare.factor +++ b/extra/math/compare/compare.factor @@ -4,10 +4,10 @@ USING: math math.order kernel ; IN: math.compare : absmin ( a b -- x ) - [ [ abs ] bi@ < ] 2keep ? ; + [ [ abs ] bi@ < ] most ; : absmax ( a b -- x ) - [ [ abs ] bi@ > ] 2keep ? ; + [ [ abs ] bi@ > ] most ; : posmax ( a b -- x ) 0 max max ; diff --git a/extra/project-euler/044/044.factor b/extra/project-euler/044/044.factor index 6460fcf970..e2fce05881 100644 --- a/extra/project-euler/044/044.factor +++ b/extra/project-euler/044/044.factor @@ -32,7 +32,7 @@ IN: project-euler.044 dup 3 * 1 - * 2 /i ; inline : sum-and-diff? ( m n -- ? ) - [ + ] [ - ] 2bi [ pentagonal? ] bi@ and ; inline + [ + ] [ - ] 2bi [ pentagonal? ] both? ; inline : euler044-step ( min m n -- min' ) [ nth-pentagonal ] bi@ diff --git a/extra/robots/robots.factor b/extra/robots/robots.factor index af039ef8c4..1afdb3f027 100644 --- a/extra/robots/robots.factor +++ b/extra/robots/robots.factor @@ -40,7 +40,7 @@ visit-time request-rate crawl-delay unknowns ; [ first "sitemap" = ] partition [ values ] dip [ { - [ [ first "user-agent" = ] bi@ and ] + [ [ first "user-agent" = ] both? ] [ nip first "user-agent" = not ] } 2|| ] monotonic-split ; diff --git a/extra/webapps/user-admin/user-admin.factor b/extra/webapps/user-admin/user-admin.factor index 700cf56e20..2cc97fb627 100644 --- a/extra/webapps/user-admin/user-admin.factor +++ b/extra/webapps/user-admin/user-admin.factor @@ -32,7 +32,7 @@ TUPLE: user-admin < dispatcher ; [ [ param empty? not ] keep set-value ] each ; : selected-capabilities ( -- seq ) - "capabilities" value [ value ] filter [ string>word ] map ; + "capabilities" value [ value ] filter strings>words ; : validate-user ( -- ) { -- 2.34.1