diff --git a/core/io/files/files-docs.factor b/core/io/files/files-docs.factor index 1dd96a13fc..e3f86c079d 100755 --- a/core/io/files/files-docs.factor +++ b/core/io/files/files-docs.factor @@ -7,14 +7,15 @@ ARTICLE: "file-streams" "Reading and writing files" { $subsection } { $subsection } { $subsection } +"Reading and writing the entire contents of a file; this is only recommended for smaller files:" +{ $subsection file-contents } +{ $subsection set-file-contents } +{ $subsection file-lines } +{ $subsection set-file-lines } "Utility combinators:" { $subsection with-file-reader } { $subsection with-file-writer } -{ $subsection with-file-appender } -{ $subsection set-file-contents } -{ $subsection file-contents } -{ $subsection set-file-lines } -{ $subsection file-lines } ; +{ $subsection with-file-appender } ; ARTICLE: "pathnames" "Pathname manipulation" "Pathname manipulation:" diff --git a/extra/multi-methods/multi-methods.factor b/extra/multi-methods/multi-methods.factor index 5ea19bc957..115432b14d 100755 --- a/extra/multi-methods/multi-methods.factor +++ b/extra/multi-methods/multi-methods.factor @@ -70,6 +70,9 @@ PREDICATE: method-body < word M: method-body stack-effect "multi-method" word-prop method-generic stack-effect ; +M: method-body crossref? + drop t ; + : method-word-name ( classes generic -- string ) [ word-name % diff --git a/extra/peg/parsers/parsers-docs.factor b/extra/peg/parsers/parsers-docs.factor index d49f1158dd..d71fdaea3b 100755 --- a/extra/peg/parsers/parsers-docs.factor +++ b/extra/peg/parsers/parsers-docs.factor @@ -173,7 +173,7 @@ HELP: range-pattern "of characters separated with a dash (-) represents the " "range of characters from the first to the second, inclusive." { $examples - { $example "USING: peg peg.parsers prettyprint ;" "\"a\" \"_a-zA-Z\" range-pattern parse parse-result-ast 1string ." "\"a\"" } - { $example "USING: peg peg.parsers prettyprint ;" "\"0\" \"^0-9\" range-pattern parse ." "f" } + { $example "USING: peg peg.parsers prettyprint strings ;" "\"a\" \"_a-zA-Z\" range-pattern parse parse-result-ast 1string ." "\"a\"" } + { $example "USING: peg peg.parsers prettyprint ;\n\"0\" \"^0-9\" range-pattern parse ." "f" } } } ; diff --git a/extra/peg/parsers/parsers.factor b/extra/peg/parsers/parsers.factor index 49035ea43c..3bbb61b846 100755 --- a/extra/peg/parsers/parsers.factor +++ b/extra/peg/parsers/parsers.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Chris Double, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences strings namespaces math assocs shuffle - vectors arrays combinators.lib math.parser match + vectors arrays combinators.lib math.parser unicode.categories sequences.deep peg peg.private peg.search math.ranges words memoize ; IN: peg.parsers diff --git a/extra/peg/peg-docs.factor b/extra/peg/peg-docs.factor index 5f200be78e..10e05a2512 100644 --- a/extra/peg/peg-docs.factor +++ b/extra/peg/peg-docs.factor @@ -104,8 +104,8 @@ HELP: semantic "Returns a parser that succeeds if the 'p1' parser succeeds and the quotation called with " "the AST produced by 'p1' on the stack returns true." } { $examples - { $example "\"A\" [ drop t ] satisfy [ 66 > ] semantic parse" "f" } - { $example "\"C\" [ drop t ] satisfy [ 66 > ] semantic parse parse-result-ast " "67" } + { $example "USING: kernel math peg prettyprint ;" "\"A\" [ drop t ] satisfy [ 66 > ] semantic parse ." "f" } + { $example "USING: kernel math peg prettyprint ;" "\"C\" [ drop t ] satisfy [ 66 > ] semantic parse parse-result-ast ." "67" } } ; HELP: ensure diff --git a/extra/peg/peg.factor b/extra/peg/peg.factor index 8d5d1c1560..ee9037ff25 100755 --- a/extra/peg/peg.factor +++ b/extra/peg/peg.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Chris Double. ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences strings fry namespaces math assocs shuffle - vectors arrays combinators.lib math.parser match + vectors arrays combinators.lib math.parser unicode.categories sequences.lib compiler.units parser words quotations effects memoize accessors locals effects splitting ; IN: peg @@ -241,7 +241,7 @@ GENERIC: (compile) ( parser -- quot ) : compiled-parse ( state word -- result ) swap [ execute ] with-packrat ; inline -: parse ( state parser -- result ) +: parse ( input parser -- result ) dup word? [ compile ] unless compiled-parse ; r ?head-slice [ @@ -388,9 +386,6 @@ M: optional-parser (compile) ( parser -- quot ) p1>> compiled-parser 1quotation '[ @ check-optional ] ; TUPLE: semantic-parser p1 quot ; -MATCH-VARS: ?quot ; - -MATCH-VARS: ?parser ; : check-semantic ( result quot -- result ) over [ @@ -421,8 +416,6 @@ M: ensure-not-parser (compile) ( parser -- quot ) TUPLE: action-parser p1 quot ; -MATCH-VARS: ?action ; - : check-action ( result quot -- result ) over [ over ast>> swap call >>ast diff --git a/extra/bubble-chamber/bubble-chamber.factor b/extra/processing/gallery/bubble-chamber/bubble-chamber.factor similarity index 99% rename from extra/bubble-chamber/bubble-chamber.factor rename to extra/processing/gallery/bubble-chamber/bubble-chamber.factor index ea8d309bdb..c6e000e74f 100644 --- a/extra/bubble-chamber/bubble-chamber.factor +++ b/extra/processing/gallery/bubble-chamber/bubble-chamber.factor @@ -21,7 +21,7 @@ USING: kernel namespaces sequences combinators arrays threads processing.gadget processing.color ; -IN: bubble-chamber +IN: processing.gallery.bubble-chamber ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -472,6 +472,6 @@ METHOD: move { axion } ; -: go ( -- ) [ bubble-chamber 500 sleep run ] with-ui ; +: go ( -- ) [ bubble-chamber run ] with-ui ; MAIN: go \ No newline at end of file diff --git a/extra/processing/gallery/trails/trails.factor b/extra/processing/gallery/trails/trails.factor new file mode 100644 index 0000000000..f0a8889fbf --- /dev/null +++ b/extra/processing/gallery/trails/trails.factor @@ -0,0 +1,62 @@ + +USING: kernel arrays sequences math qualified circular processing ui ; + +IN: processing.gallery.trails + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +! Example 33-15 from the Processing book + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +QUALIFIED: circular + +: push-circular ( seq elt -- seq ) over circular:push-circular ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: each-percent ( seq quot -- ) + >r + dup length + dup [ / ] curry + [ 1+ ] swap compose + r> compose + 2each ; inline + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: point-list ( n -- seq ) [ drop 0 0 2array ] map ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: dot ( pos percent -- ) 1 swap - 25 * 5 max circle ; + +: step ( seq -- ) + + no-stroke + { 1 0.4 } fill + + 0 background + + mouse push-circular + [ dot ] + each-percent ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: go* ( -- ) + + 500 500 size* + + [ + 100 point-list + [ step ] + curry + draw + ] setup + + run ; + +: go ( -- ) [ go* ] with-ui ; + +MAIN: go \ No newline at end of file diff --git a/extra/tools/disassembler/disassembler.factor b/extra/tools/disassembler/disassembler.factor index 5b835cd52f..39ee85b07a 100755 --- a/extra/tools/disassembler/disassembler.factor +++ b/extra/tools/disassembler/disassembler.factor @@ -26,8 +26,7 @@ M: pair make-disassemble-cmd M: method-spec make-disassemble-cmd first2 method make-disassemble-cmd ; -: gdb-binary ( -- string ) - os freebsd? "gdb66" "gdb" ? ; +: gdb-binary ( -- string ) "gdb" ; : run-gdb ( -- lines )