diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 8e1927c043..cc84084258 100755 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -240,11 +240,14 @@ PREDICATE: unexpected unexpected-eof : CREATE ( -- word ) scan create-in ; -: CREATE-CLASS ( -- word ) - scan in get create +: create-class ( word vocab -- word ) + create dup save-class-location dup predicate-word dup set-word save-location ; +: CREATE-CLASS ( -- word ) + scan in get create-class ; + : word-restarts ( possibilities -- restarts ) natural-sort [ [ "Use the word " swap summary append ] keep diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index 747f0cd1e5..68f525ec6c 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -132,6 +132,7 @@ SYMBOL: build-status "Did not pass load-everything: " print "load-everything-vocabs" cat "Did not pass test-all: " print "test-all-vocabs" cat + "help-lint results:" print "help-lint" cat "Benchmarks: " print "benchmarks" eval-file benchmarks. diff --git a/extra/builder/test/test.factor b/extra/builder/test/test.factor index d03be0781a..dd3c640a84 100644 --- a/extra/builder/test/test.factor +++ b/extra/builder/test/test.factor @@ -7,6 +7,8 @@ USING: kernel namespaces sequences assocs builder continuations tools.browser tools.test io.encodings.utf8 + combinators.cleave + help.lint bootstrap.stage2 benchmark builder.util ; IN: builder.test @@ -14,8 +16,21 @@ IN: builder.test : do-load ( -- ) try-everything keys "../load-everything-vocabs" utf8 [ . ] with-file-writer ; +! : do-tests ( -- ) +! run-all-tests keys "../test-all-vocabs" utf8 [ . ] with-file-writer ; + : do-tests ( -- ) - run-all-tests keys "../test-all-vocabs" utf8 [ . ] with-file-writer ; + run-all-tests + "../test-all-vocabs" utf8 + [ + [ keys . ] + [ test-failures. ] + bi + ] + with-file-writer ; + +: do-help-lint ( -- ) + "" run-help-lint "../help-lint" utf8 [ typos. ] with-file-writer ; : do-benchmarks ( -- ) run-benchmarks "../benchmarks" utf8 [ . ] with-file-writer ; @@ -24,6 +39,7 @@ IN: builder.test bootstrap-time get "../boot-time" utf8 [ . ] with-file-writer [ do-load ] runtime "../load-time" utf8 [ . ] with-file-writer [ do-tests ] runtime "../test-time" utf8 [ . ] with-file-writer + do-help-lint do-benchmarks ; MAIN: do-all \ No newline at end of file diff --git a/extra/db/sql/sql.factor b/extra/db/sql/sql.factor index 062eab8bc8..1de4bdfb5a 100755 --- a/extra/db/sql/sql.factor +++ b/extra/db/sql/sql.factor @@ -1,7 +1,6 @@ USING: kernel parser quotations tuples words -namespaces.lib namespaces sequences bake arrays combinators -prettyprint strings math.parser new-slots accessors -sequences.lib math symbols ; +namespaces.lib namespaces sequences arrays combinators +prettyprint strings math.parser sequences.lib math symbols ; USE: tools.walker IN: db.sql diff --git a/extra/db/tuples/tuples.factor b/extra/db/tuples/tuples.factor index bc7fcba034..32055ccedc 100755 --- a/extra/db/tuples/tuples.factor +++ b/extra/db/tuples/tuples.factor @@ -84,7 +84,6 @@ HOOK: insert-tuple* db ( tuple statement -- ) [ bind-tuple ] keep execute-statement ; : insert-tuple ( tuple -- ) - ! break dup class db-columns find-primary-key assigned-id? [ insert-assigned ] [ diff --git a/extra/logging/logging-docs.factor b/extra/logging/logging-docs.factor index 715b1551b9..a7750fe388 100755 --- a/extra/logging/logging-docs.factor +++ b/extra/logging/logging-docs.factor @@ -100,7 +100,7 @@ ARTICLE: "logging.rotation" "Log rotation" "The " { $vocab-link "logging.insomniac" } " vocabulary automates log rotation." ; ARTICLE: "logging.server" "Log implementation" -"The " { $vocab-link "logging.server" } " vocabulary implements a concurrent log server using " { $vocab-link "concurrency" } ". User code never interacts with the server directly, instead ot uses the words in the " { $link "logging" } " vocabulary. The server is used to synchronize access to log files and ensure that log rotation can proceed in an orderly fashion." +"The " { $vocab-link "logging.server" } " vocabulary implements a concurrent log server using " { $vocab-link "concurrency" } ". User code never interacts with the server directly, instead it uses the words in the " { $link "logging" } " vocabulary. The server is used to synchronize access to log files and ensure that log rotation can proceed in an orderly fashion." $nl "The " { $link log-message } " word sends a message to the server which results in the server executing an internal word:" { $subsection (log-message) } diff --git a/extra/singleton/singleton-docs.factor b/extra/singleton/singleton-docs.factor index 4ebbc9b71d..358d1a5bf6 100644 --- a/extra/singleton/singleton-docs.factor +++ b/extra/singleton/singleton-docs.factor @@ -12,3 +12,15 @@ HELP: SINGLETON: } { $see-also POSTPONE: PREDICATE: } ; + +HELP: SINGLETONS: +{ $syntax "SINGLETONS: classes... ;" +} { $values + { "classes" "new singletons to define" } +} { $description + "Defines a new singleton for each class in the list." +} { $examples + { $example "SINGLETONS: foo bar baz ;" "" } +} { $see-also + POSTPONE: SINGLETON: +} ; diff --git a/extra/singleton/singleton.factor b/extra/singleton/singleton.factor index f859cec5c0..1451283f23 100644 --- a/extra/singleton/singleton.factor +++ b/extra/singleton/singleton.factor @@ -1,10 +1,15 @@ -! Copyright (C) 2007 Doug Coleman. +! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: classes.predicate kernel parser quotations words ; +USING: classes.predicate kernel namespaces parser quotations +sequences words ; IN: singleton +: define-singleton ( token -- ) + \ word swap in get create-class + dup [ eq? ] curry define-predicate-class ; : SINGLETON: - \ word - CREATE-CLASS - dup [ eq? ] curry define-predicate-class ; parsing + scan define-singleton ; parsing + +: SINGLETONS: + ";" parse-tokens [ define-singleton ] each ; parsing diff --git a/misc/factor.sh b/misc/factor.sh index 3a6d2d64f9..0ad44430c8 100755 --- a/misc/factor.sh +++ b/misc/factor.sh @@ -68,11 +68,11 @@ check_gcc_version() { } set_downloader() { - test_program_installed wget + test_program_installed wget curl if [[ $? -ne 0 ]] ; then - DOWNLOAD=wget + DOWNLOADER=wget else - DOWNLOAD="curl -O" + DOWNLOADER="curl -O" fi } @@ -95,7 +95,6 @@ check_installed_programs() { ensure_program_installed md5sum md5 ensure_program_installed cut case $OS in - macosx) ensure_program_installed port;; netbsd) ensure_program_installed gmake;; esac check_gcc_version @@ -203,6 +202,7 @@ echo_build_info() { echo MAKE_IMAGE_TARGET=$MAKE_IMAGE_TARGET echo GIT_PROTOCOL=$GIT_PROTOCOL echo GIT_URL=$GIT_URL + echo DOWNLOADER=$DOWNLOADER } set_build_info() { @@ -235,6 +235,7 @@ find_build_info() { find_word_size set_factor_binary set_build_info + set_downloader echo_build_info } @@ -304,12 +305,12 @@ get_boot_image() { } get_url() { - if [[ $DOWNLOAD -eq "" ]] ; then + if [[ $DOWNLOADER -eq "" ]] ; then set_downloader; fi - echo $DOWNLOAD $1 ; - $DOWNLOAD $1 - check_ret $DOWNLOAD + echo $DOWNLOADER $1 ; + $DOWNLOADER $1 + check_ret $DOWNLOADER } maybe_download_dlls() { @@ -372,14 +373,23 @@ make_boot_image() { } -install_libraries_apt() { +install_build_system_apt() { + ensure_program_installed yes yes | sudo apt-get install sudo libc6-dev libfreetype6-dev libx11-dev xorg-dev glutg3-dev wget git-core git-doc rlwrap gcc make check_ret sudo } -install_libraries_port() { - ensure_program_installed port - yes | sudo port install git-core +install_build_system_port() { + test_program_installed git + if [[ $? -ne 1 ]] ; then + ensure_program_installed yes + echo "git not found." + echo "This script requires either git-core or port." + echo "If it fails, install git-core or port and try again." + ensure_program_installed port + echo "Installing git-core with port...this will take awhile." + yes | sudo port install git-core + fi } usage() { @@ -390,8 +400,8 @@ usage() { case "$1" in install) install ;; - install-x11) install_libraries_apt; install ;; - install-macosx) install_libraries_port; install ;; + install-x11) install_build_system_apt; install ;; + install-macosx) install_build_system_port; install ;; self-update) update; make_boot_image; bootstrap;; quick-update) update; refresh_image ;; update) update; update_bootstrap ;;