From 8b855b244507e6b7b0d56700b26403963f3ec963 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 22 Aug 2008 23:00:35 -0500 Subject: [PATCH] Help lint fixes --- basis/binary-search/binary-search-docs.factor | 6 +++--- basis/bit-arrays/bit-arrays-docs.factor | 4 ++-- basis/bit-arrays/bit-arrays.factor | 5 ++--- basis/compiler/generator/generator-docs.factor | 10 +++++----- basis/compiler/tests/optimizer.factor | 9 ++++++++- .../propagation/known-words/known-words.factor | 2 +- basis/core-foundation/core-foundation-docs.factor | 2 +- basis/help/lint/lint.factor | 2 +- basis/inspector/inspector-docs.factor | 13 +++---------- basis/ui/cocoa/tools/tools.factor | 10 +++++----- basis/ui/gadgets/buttons/buttons-docs.factor | 2 +- basis/ui/gadgets/gadgets-docs.factor | 4 ++-- basis/ui/gadgets/grids/grids-docs.factor | 2 +- .../ui/gadgets/incremental/incremental-docs.factor | 4 ++-- core/classes/classes-docs.factor | 7 ++++--- core/combinators/combinators-docs.factor | 2 +- core/effects/effects-docs.factor | 4 ++-- core/generic/generic-docs.factor | 6 +----- core/lexer/lexer-docs.factor | 2 +- core/slots/slots-docs.factor | 14 +++++++------- core/sorting/sorting.factor | 2 +- core/words/words-docs.factor | 2 +- extra/peg/peg.factor | 10 +++++----- 23 files changed, 60 insertions(+), 64 deletions(-) diff --git a/basis/binary-search/binary-search-docs.factor b/basis/binary-search/binary-search-docs.factor index db442a9ac8..8b85e078ce 100644 --- a/basis/binary-search/binary-search-docs.factor +++ b/basis/binary-search/binary-search-docs.factor @@ -24,20 +24,20 @@ $nl { find find-from find-last find-last find-last-from search } related-words HELP: sorted-index -{ $values { "elt" object } { "seq" "a sorted sequence" } { "i" "an index, or " { $link f } } { "elt" "an element, or " { $link f } } } +{ $values { "obj" object } { "seq" "a sorted sequence" } { "i" "an index, or " { $link f } } } { $description "Outputs the index and value of the element closest to " { $snippet "elt" } " in the sequence. See " { $link search } " for details." } { $notes "If the sequence has at least one element, this word always outputs a valid index, because it finds the closest match, not necessarily an exact one. In this respect its behavior differs from " { $link index } "." } ; { index index-from last-index last-index-from sorted-index } related-words HELP: sorted-member? -{ $values { "elt" object } { "seq" "a sorted sequence" } { "?" "a boolean" } } +{ $values { "obj" object } { "seq" "a sorted sequence" } { "?" "a boolean" } } { $description "Tests if the sorted sequence contains " { $snippet "elt" } ". Equality is tested with " { $link = } "." } ; { member? sorted-member? } related-words HELP: sorted-memq? -{ $values { "elt" object } { "seq" "a sorted sequence" } { "?" "a boolean" } } +{ $values { "obj" object } { "seq" "a sorted sequence" } { "?" "a boolean" } } { $description "Tests if the sorted sequence contains " { $snippet "elt" } ". Equality is tested with " { $link eq? } "." } ; { memq? sorted-memq? } related-words diff --git a/basis/bit-arrays/bit-arrays-docs.factor b/basis/bit-arrays/bit-arrays-docs.factor index 46033c61a8..fab2a62062 100644 --- a/basis/bit-arrays/bit-arrays-docs.factor +++ b/basis/bit-arrays/bit-arrays-docs.factor @@ -60,11 +60,11 @@ HELP: set-bits { $side-effects "bit-array" } ; HELP: integer>bit-array -{ $values { "integer" integer } { "bit-array" bit-array } } +{ $values { "n" integer } { "bit-array" bit-array } } { $description "Outputs a freshly-allocated bit array whose elements correspond to the bits in the binary representation of the given unsigned integer value." } { $notes "The bits of the integer are stored in the resulting bit array in order of ascending significance, least significant bit first. This word will fail if passed a negative integer. If you want the two's-complement binary representation of a negative number, use " { $link bitnot } " to get the complement of the number first. This word works with fixnums or bignums of any size; it is not limited by fixnum size or machine word size." } ; HELP: bit-array>integer -{ $values { "bit-array" bit-array } { "integer" integer } } +{ $values { "bit-array" bit-array } { "n" integer } } { $description "Outputs the unsigned integer whose binary representation corresponds to the contents of the given bit array." } { $notes "The bits of the integer are taken from the bit array in order of ascending significance, least significant bit first. This word is able to return fixnums or bignums of any size; it is not limited by fixnum size or machine word size." } ; diff --git a/basis/bit-arrays/bit-arrays.factor b/basis/bit-arrays/bit-arrays.factor index 4e6f7428b0..d6064ba852 100755 --- a/basis/bit-arrays/bit-arrays.factor +++ b/basis/bit-arrays/bit-arrays.factor @@ -69,8 +69,7 @@ M: bit-array resize M: bit-array byte-length length 7 + -3 shift ; -: ?{ ( parsed -- parsed ) - \ } [ >bit-array ] parse-literal ; parsing +: ?{ \ } [ >bit-array ] parse-literal ; parsing :: integer>bit-array ( n -- bit-array ) n zero? [ 0 ] [ @@ -84,7 +83,7 @@ M: bit-array byte-length length 7 + -3 shift ; ] ] if ; -: bit-array>integer ( bit-array -- int ) +: bit-array>integer ( bit-array -- n ) 0 swap underlying>> [ length ] keep [ uchar-nth swap 8 shift bitor ] curry each ; diff --git a/basis/compiler/generator/generator-docs.factor b/basis/compiler/generator/generator-docs.factor index 53bc031ad0..45238ab00a 100755 --- a/basis/compiler/generator/generator-docs.factor +++ b/basis/compiler/generator/generator-docs.factor @@ -36,8 +36,8 @@ HELP: begin-compiling { $description "Prepares to generate machine code for a word." } ; HELP: with-generator -{ $values { "node" "a dataflow node" } { "word" word } { "label" word } { "quot" "a quotation with stack effect " { $snippet "( node -- )" } } } -{ $description "Generates machine code for " { $snippet "label" } " by applying the quotation to the dataflow node." } ; +{ $values { "nodes" "a sequence of nodes" } { "word" word } { "label" word } { "quot" "a quotation with stack effect " { $snippet "( node -- )" } } } +{ $description "Generates machine code for " { $snippet "label" } " by applying the quotation to the sequence of nodes." } ; HELP: generate-node { $values { "node" "a dataflow node" } { "next" "a dataflow node" } } @@ -45,13 +45,13 @@ HELP: generate-node { $notes "This word can only be called from inside the quotation passed to " { $link with-generator } "." } ; HELP: generate-nodes -{ $values { "node" "a dataflow node" } } +{ $values { "nodes" "a sequence of nodes" } } { $description "Recursively generate machine code for a dataflow graph." } { $notes "This word can only be called from inside the quotation passed to " { $link with-generator } "." } ; HELP: generate -{ $values { "word" word } { "label" word } { "node" "a dataflow node" } } -{ $description "Generates machine code for " { $snippet "label" } " from " { $snippet "node" } ". The value of " { $snippet "word" } " is retained for debugging purposes; it is the word which will appear in a call stack trace if this compiled code block throws an error when run." } ; +{ $values { "word" word } { "label" word } { "nodes" "a sequence of nodes" } } +{ $description "Generates machine code for " { $snippet "label" } " from " { $snippet "nodes" } ". The value of " { $snippet "word" } " is retained for debugging purposes; it is the word which will appear in a call stack trace if this compiled code block throws an error when run." } ; HELP: define-intrinsics { $values { "word" word } { "intrinsics" "a sequence of " { $snippet "{ quot assoc }" } " pairs" } } diff --git a/basis/compiler/tests/optimizer.factor b/basis/compiler/tests/optimizer.factor index 4d257fedd6..875c6f9100 100755 --- a/basis/compiler/tests/optimizer.factor +++ b/basis/compiler/tests/optimizer.factor @@ -2,7 +2,7 @@ USING: accessors arrays compiler.units generic hashtables stack-checker kernel kernel.private math prettyprint sequences sbufs strings tools.test vectors words sequences.private quotations classes classes.algebra classes.tuple.private -continuations growable namespaces hints +continuations growable namespaces hints alien.accessors compiler.tree.builder compiler.tree.optimizer ; IN: optimizer.tests @@ -356,3 +356,10 @@ TUPLE: some-tuple x ; [ ] curry some-tuple boa ; [ T{ some-tuple f [ 3 ] } ] [ 3 allot-regression ] unit-test + +[ 1 ] [ B{ 0 0 0 0 } [ 0 alien-signed-4 1+ ] compile-call ] unit-test +[ 1 ] [ B{ 0 0 0 0 } [ 0 alien-unsigned-4 1+ ] compile-call ] unit-test +[ 1 ] [ B{ 0 0 0 0 0 0 0 0 } [ 0 alien-signed-8 1+ ] compile-call ] unit-test +[ 1 ] [ B{ 0 0 0 0 0 0 0 0 } [ 0 alien-unsigned-8 1+ ] compile-call ] unit-test +[ 1 ] [ B{ 0 0 0 0 0 0 0 0 } [ 0 alien-signed-cell 1+ ] compile-call ] unit-test +[ 1 ] [ B{ 0 0 0 0 0 0 0 0 } [ 0 alien-unsigned-cell 1+ ] compile-call ] unit-test diff --git a/basis/compiler/tree/propagation/known-words/known-words.factor b/basis/compiler/tree/propagation/known-words/known-words.factor index bc6f00dfa8..d9fc18acb0 100644 --- a/basis/compiler/tree/propagation/known-words/known-words.factor +++ b/basis/compiler/tree/propagation/known-words/known-words.factor @@ -247,7 +247,7 @@ generic-comparison-ops [ [ string>number 8 * 2^ 1- 0 swap [a,b] ] } } cond - [ fixnum fits? fixnum bignum ? ] keep + [ fixnum fits? fixnum integer ? ] keep [ 2nip ] curry +outputs+ set-word-prop ] each diff --git a/basis/core-foundation/core-foundation-docs.factor b/basis/core-foundation/core-foundation-docs.factor index 3cd9b838d4..d577c523cf 100644 --- a/basis/core-foundation/core-foundation-docs.factor +++ b/basis/core-foundation/core-foundation-docs.factor @@ -42,7 +42,7 @@ HELP: &CFRelease { $description "Marks the given Core Foundation object for unconditional release via " { $link CFRelease } " at the end of the enclosing " { $link with-destructors } " scope." } ; HELP: |CFRelease -{ $values { "interface" "Pointer to a Core Foundation object" } } +{ $values { "alien" "Pointer to a Core Foundation object" } } { $description "Marks the given Core Foundation object for release via " { $link CFRelease } " in the event of an error at the end of the enclosing " { $link with-destructors } " scope." } ; { CFRelease |CFRelease &CFRelease } related-words diff --git a/basis/help/lint/lint.factor b/basis/help/lint/lint.factor index 0f2ea38480..61d9827a48 100755 --- a/basis/help/lint/lint.factor +++ b/basis/help/lint/lint.factor @@ -110,7 +110,7 @@ M: help-error error. H{ } clone [ [ [ dup >link where dup ] 2dip - [ first r> at r> push-at ] 2curry + [ >r >r first r> at r> push-at ] 2curry [ 2drop ] if ] 2curry each diff --git a/basis/inspector/inspector-docs.factor b/basis/inspector/inspector-docs.factor index 27401f3e34..82e1e104d1 100644 --- a/basis/inspector/inspector-docs.factor +++ b/basis/inspector/inspector-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax kernel classes io io.styles ; +USING: help.markup help.syntax kernel classes io io.styles mirrors ; IN: inspector ARTICLE: "inspector" "The inspector" @@ -41,15 +41,8 @@ $nl { $examples { $code "global describe" } } ; HELP: describe* -{ $values { "obj" object } { "flags" "an assoc" } } -{ $description "Print a tabular overview of the object." -$nl -"The assoc can contain any of the following keys:" -{ $list - { { $link +number-rows+ } " - if set to a true value, every row of output will begin with a row number." } - { { $link +editable+ } " - if set to a true value, keys and values will be editable in place, if the output stream supports it." } - { { $link +sequence+ } " - if set to a true value, keys will not be printed, only values." } -} } +{ $values { "obj" object } { "mirror" mirror } { "keys" "a sequence of objects" } } +{ $description "Print a tabular overview of the object." } { $notes "This word is a factor of " { $link describe } " and " { $link inspect } "." } ; HELP: inspector-stack diff --git a/basis/ui/cocoa/tools/tools.factor b/basis/ui/cocoa/tools/tools.factor index 2b0792902b..876e9e5df1 100755 --- a/basis/ui/cocoa/tools/tools.factor +++ b/basis/ui/cocoa/tools/tools.factor @@ -4,7 +4,7 @@ USING: alien.syntax cocoa cocoa.nibs cocoa.application cocoa.classes cocoa.dialogs cocoa.pasteboard cocoa.subclassing core-foundation help.topics kernel memory namespaces parser system ui ui.tools.browser ui.tools.listener ui.tools.workspace -ui.cocoa eval ; +ui.cocoa eval locals ; IN: ui.cocoa.tools : finder-run-files ( alien -- ) @@ -52,10 +52,10 @@ CLASS: { NSApp FactorApplicationDelegate install-delegate ; ! Service support; evaluate Factor code from other apps -: do-service ( pboard error quot -- ) - pick >r >r - ?pasteboard-string dup [ r> call ] [ r> 2drop f ] if - dup [ r> set-pasteboard-string ] [ r> 2drop ] if ; +:: do-service ( pboard error quot -- ) + pboard error ?pasteboard-string + dup [ quot call ] when + [ pboard set-pasteboard-string ] when* ; CLASS: { { +superclass+ "NSObject" } diff --git a/basis/ui/gadgets/buttons/buttons-docs.factor b/basis/ui/gadgets/buttons/buttons-docs.factor index 64cc7bd1c8..59270ead79 100755 --- a/basis/ui/gadgets/buttons/buttons-docs.factor +++ b/basis/ui/gadgets/buttons/buttons-docs.factor @@ -10,7 +10,7 @@ $nl "A button can be selected, which is distinct from being pressed. This state is held in the " { $link button-selected? } " slot, and is used by the " { $link } " word to construct a row of buttons for choosing among several alternatives." } ; HELP: