diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 0ff2b29872..aa55b53f10 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -51,6 +51,7 @@ - variable width word wrap - fix top level window positioning - changing window titles +- remove distinction between a word and a link to a word + compiler/ffi: diff --git a/doc/handbook/alien.facts b/doc/handbook/alien.facts index 928cc1535e..d49b737d33 100644 --- a/doc/handbook/alien.facts +++ b/doc/handbook/alien.facts @@ -35,13 +35,11 @@ ARTICLE: "alien-invoke" "Calling C from Factor" $terpri "The above parsing words create word definitions which call a lower-level word; you can use it directly, too:" { $subsection alien-invoke } -$terpri "There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-types" } "." ; ARTICLE: "alien-callback" "Calling Factor from C" "Callbacks can be defined and passed to C code as function pointers; the C code can then invoke the callback and run Factor code:" { $subsection alien-callback } -$terpri "There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-types" } "." ; ARTICLE: "c-types" "C types" @@ -262,6 +260,7 @@ $terpri { $subsection malloc } { $subsection calloc } { $subsection realloc } +{ $subsection check-ptr } "You must always free pointers returned by any of the above words:" { $subsection free } ; diff --git a/library/alien/c-types.facts b/library/alien/c-types.facts index 8c844ddda8..07860596c4 100644 --- a/library/alien/c-types.facts +++ b/library/alien/c-types.facts @@ -56,21 +56,21 @@ HELP: alien>string "( c-ptr -- string )" HELP: "( n type -- alien )" { $values { "n" "a non-negative integer" } { "type" "a string" } { "alien" "an alien address" } } { $description "Allocates an unmanaged memory block large enough to hold " { $snippet "n" } " values of a C type." } -{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } +{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } { $errors "Throws an error if the type does not exist, if the requested size is negative, or if memory allocation fails." } { $see-also } ; HELP: "( type -- alien )" { $values { "type" "a string" } { "alien" "an alien address" } } { $description "Allocates an unmanaged memory block large enough to hold a value of a C type." } -{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } +{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } { $errors "Throws an error if the type does not exist or if memory allocation fails." } { $see-also } ; HELP: "( string -- alien )" { $values { "string" "a string" } { "alien" "an alien address" } } { $description "Copies a string to an unmanaged memory block large enough to hold a copy of the string in 8-bit ASCII encoding, with a trailing null byte." } -{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } +{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } { $errors "Throws an error if memory allocation fails." } { $see-also string>alien } ; diff --git a/library/alien/malloc.facts b/library/alien/malloc.facts index b27fae40a3..d7738f93e3 100644 --- a/library/alien/malloc.facts +++ b/library/alien/malloc.facts @@ -6,21 +6,21 @@ HELP: malloc "( size -- alien )" { $description "Allocates a block of " { $snippet "size" } " bytes from the operating system. The contents of the block are undefined." $terpri "Outputs " { $link f } " if memory allocation failed, so calls to this word should be followed by a call to " { $link check-ptr } "." } -{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ; +{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ; HELP: calloc "( count size -- alien )" { $values { "count" "a non-negative integer" } { "size" "a non-negative integer" } { "alien" "an alien address" } } { $description "Allocates a block of " { $snippet "count * size" } " bytes from the operating system. The contents of the block are initially zero." $terpri "Outputs " { $link f } " if memory allocation failed, so calls to this word should be followed by a call to " { $link check-ptr } "." } -{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ; +{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ; HELP: realloc "( alien size -- newalien )" { $values { "alien" "an alien address" } { "size" "a non-negative integer" } { "newalien" "an alien address" } } { $description "Allocates a new block of " { $snippet "size" } " bytes from the operating system. The contents of " { $snippet "alien" } ", which itself must be a block previously returned by " { $link malloc } " or " { $link realloc } ", are copied into the new block, and the old block is freed." $terpri "Outputs " { $link f } " if memory allocation failed, so calls to this word should be followed by a call to " { $link check-ptr } "." } -{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ; +{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } ; HELP: memcpy "( dst src size -- newalien )" { $values { "dst" "an alien address" } { "src" "an alien address" } { "size" "a non-negative integer" } } diff --git a/library/help/database.factor b/library/help/database.factor index d24715b8b2..569c28cea5 100644 --- a/library/help/database.factor +++ b/library/help/database.factor @@ -7,8 +7,6 @@ strings styles words ; ! Markup GENERIC: print-element -GENERIC: article-name - ! Help articles SYMBOL: articles @@ -21,15 +19,10 @@ TUPLE: article title content ; M: string article-title article article-title ; -M: string article-name article article-name ; - M: string article-content article article-content ; -M: article article-name article-title ; - ! Special case: f help M: f article-title drop \ f article-title ; -M: f article-name drop \ f article-name ; M: f article-content drop \ f article-content ; ! Glossary of terms @@ -39,8 +32,6 @@ TUPLE: term entry ; M: term article-title term-entry ; -M: term article-name term-entry ; - M: term article-content term-entry terms get hash [ "No such glossary entry" ] unless* ; diff --git a/library/help/markup.factor b/library/help/markup.factor index 5824332754..ffa1367924 100644 --- a/library/help/markup.factor +++ b/library/help/markup.factor @@ -116,8 +116,6 @@ TUPLE: link name ; M: link article-title link-name article-title ; -M: link article-name link-name article-name ; - M: link article-content link-name article-content ; DEFER: help @@ -136,7 +134,7 @@ DEFER: help pprint ] [ link-style [ - dup article-name swap simple-object + dup article-title swap simple-object ] with-style ] if ; diff --git a/library/help/word-help.factor b/library/help/word-help.factor index 556b2be483..0412592d79 100644 --- a/library/help/word-help.factor +++ b/library/help/word-help.factor @@ -1,15 +1,9 @@ ! Copyright (C) 2005, 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: help -USING: arrays generic kernel namespaces prettyprint sequences -words ; +USING: arrays kernel namespaces prettyprint sequences words ; -M: word article-title - [ - "The " % dup word-name % class? " class" " word" ? % - ] "" make ; - -M: word article-name word-name ; +M: word article-title word-name ; : word-article ( word -- article ) "help" word-prop ; diff --git a/library/test/compiler/linearizer.factor b/library/test/compiler/linearizer.factor index 4b3b0d41e6..3155134d4c 100644 --- a/library/test/compiler/linearizer.factor +++ b/library/test/compiler/linearizer.factor @@ -5,11 +5,12 @@ USE: compiler USE: compiler-frontend USE: inference USE: words +USE: sequences : fie [ ] [ ] if ; [ ] [ \ fie dup word-def dataflow linearize drop ] unit-test -: foo [ drop ] each-word ; +: foo all-words [ drop ] each ; [ ] [ \ foo dup word-def dataflow linearize drop ] unit-test diff --git a/library/vocabularies.factor b/library/vocabularies.factor index 69dd607ade..8747d91459 100644 --- a/library/vocabularies.factor +++ b/library/vocabularies.factor @@ -22,8 +22,6 @@ SYMBOL: vocabularies : all-words ( -- list ) vocabs [ words ] map concat ; -: each-word ( quot -- ) all-words swap each ; inline - : word-subset ( pred -- list ) all-words swap subset ; inline @@ -31,7 +29,7 @@ SYMBOL: vocabularies all-words swap subset-with ; inline : recrossref ( -- ) - crossref get clear-hash [ add-crossref ] each-word ; + crossref get clear-hash all-words [ add-crossref ] each ; : lookup ( name vocab -- word ) vocab ?hash ;