From e26393394d89f7d29784f36defea18a4282f3654 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 16:21:54 +1300 Subject: [PATCH 01/10] tools.crossref: fix method cross-referencing --- basis/tools/crossref/crossref.factor | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/basis/tools/crossref/crossref.factor b/basis/tools/crossref/crossref.factor index 50034822b2..30ec4b2b65 100644 --- a/basis/tools/crossref/crossref.factor +++ b/basis/tools/crossref/crossref.factor @@ -61,18 +61,17 @@ M: pathname uses string>> source-file top-level-form>> [ uses ] [ { } ] if* ; ! To make UI browser happy M: vocab uses drop f ; -GENERIC: crossref-def ( defspec -- ) - -M: object crossref-def +: crossref-def ( defspec -- ) dup uses crossref get add-vertex ; -M: word crossref-def - [ call-next-method ] [ subwords [ crossref-def ] each ] bi ; - : defs-to-crossref ( -- seq ) [ - all-words [ generic? not ] filter + all-words + [ [ generic? not ] filter ] + [ [ subwords ] map concat ] bi + all-articles [ >link ] map + source-files get keys [ ] map ] append-outputs ; From f78e5c74308a84d77e994c9b5c9c918b8a78ab1e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 16:47:55 +1300 Subject: [PATCH 02/10] ui.text.pango: add a platforms.txt --- basis/ui/text/pango/platforms.txt | 4 ++++ basis/ui/text/pango/tags.txt | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 basis/ui/text/pango/platforms.txt delete mode 100644 basis/ui/text/pango/tags.txt diff --git a/basis/ui/text/pango/platforms.txt b/basis/ui/text/pango/platforms.txt new file mode 100644 index 0000000000..b60912bb4a --- /dev/null +++ b/basis/ui/text/pango/platforms.txt @@ -0,0 +1,4 @@ +linux +freebsd +netbsd +openbsd diff --git a/basis/ui/text/pango/tags.txt b/basis/ui/text/pango/tags.txt deleted file mode 100644 index 5d77766703..0000000000 --- a/basis/ui/text/pango/tags.txt +++ /dev/null @@ -1 +0,0 @@ -untested From eab105590be0f1c7b59ae260198eec88e8219796 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 17:00:48 +1300 Subject: [PATCH 03/10] Rename io.launcher.unix.parser to simple-tokenizer since ftp.server uses it --- basis/ftp/server/server.factor | 21 ++++++------ .../launcher/unix/parser/parser-tests.factor | 33 ------------------- basis/io/launcher/unix/parser/platforms.txt | 1 - basis/io/launcher/unix/unix.factor | 11 +++---- basis/simple-tokenizer/authors.txt | 1 + .../simple-tokenizer-docs.factor | 13 ++++++++ .../simple-tokenizer-tests.factor | 33 +++++++++++++++++++ .../simple-tokenizer.factor} | 10 ++---- basis/simple-tokenizer/tags.txt | 1 + 9 files changed, 66 insertions(+), 58 deletions(-) delete mode 100644 basis/io/launcher/unix/parser/parser-tests.factor delete mode 100644 basis/io/launcher/unix/parser/platforms.txt create mode 100644 basis/simple-tokenizer/authors.txt create mode 100644 basis/simple-tokenizer/simple-tokenizer-docs.factor create mode 100644 basis/simple-tokenizer/simple-tokenizer-tests.factor rename basis/{io/launcher/unix/parser/parser.factor => simple-tokenizer/simple-tokenizer.factor} (62%) create mode 100644 basis/simple-tokenizer/tags.txt diff --git a/basis/ftp/server/server.factor b/basis/ftp/server/server.factor index 1077aebf07..f1bc8adef9 100644 --- a/basis/ftp/server/server.factor +++ b/basis/ftp/server/server.factor @@ -1,15 +1,14 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs byte-arrays calendar classes -combinators combinators.short-circuit concurrency.promises -continuations destructors ftp io io.backend io.directories -io.encodings io.encodings.binary -tools.files io.encodings.utf8 io.files io.files.info -io.pathnames io.launcher.unix.parser io.servers.connection -io.sockets io.streams.duplex io.streams.string io.timeouts -kernel make math math.bitwise math.parser namespaces sequences -splitting threads unicode.case logging calendar.format -strings io.files.links io.files.types io.encodings.8-bit.latin1 ; +USING: accessors assocs byte-arrays calendar classes combinators +combinators.short-circuit concurrency.promises continuations +destructors ftp io io.backend io.directories io.encodings +io.encodings.binary tools.files io.encodings.utf8 io.files +io.files.info io.pathnames io.servers.connection io.sockets +io.streams.duplex io.streams.string io.timeouts kernel make math +math.bitwise math.parser namespaces sequences splitting threads +unicode.case logging calendar.format strings io.files.links +io.files.types io.encodings.8-bit.latin1 simple-tokenizer ; IN: ftp.server SYMBOL: server @@ -24,7 +23,7 @@ TUPLE: ftp-command raw tokenized ; dup \ DEBUG log-message ftp-command new over >>raw - swap tokenize-command >>tokenized ; + swap tokenize >>tokenized ; TUPLE: ftp-get path ; : ( path -- obj ) diff --git a/basis/io/launcher/unix/parser/parser-tests.factor b/basis/io/launcher/unix/parser/parser-tests.factor deleted file mode 100644 index 90504ccac2..0000000000 --- a/basis/io/launcher/unix/parser/parser-tests.factor +++ /dev/null @@ -1,33 +0,0 @@ -IN: io.launcher.unix.parser.tests -USING: io.launcher.unix.parser tools.test ; - -[ "" tokenize-command ] must-fail -[ " " tokenize-command ] must-fail -[ V{ "a" } ] [ "a" tokenize-command ] unit-test -[ V{ "abc" } ] [ "abc" tokenize-command ] unit-test -[ V{ "abc" } ] [ "abc " tokenize-command ] unit-test -[ V{ "abc" } ] [ " abc" tokenize-command ] unit-test -[ V{ "abc" "def" } ] [ "abc def" tokenize-command ] unit-test -[ V{ "abc def" } ] [ "abc\\ def" tokenize-command ] unit-test -[ V{ "abc\\" "def" } ] [ "abc\\\\ def" tokenize-command ] unit-test -[ V{ "abc\\ def" } ] [ "\"abc\\\\ def\"" tokenize-command ] unit-test -[ V{ "abc\\ def" } ] [ " \"abc\\\\ def\"" tokenize-command ] unit-test -[ V{ "abc\\ def" "hey" } ] [ "\"abc\\\\ def\" hey" tokenize-command ] unit-test -[ V{ "abc def" "hey" } ] [ "\"abc def\" \"hey\"" tokenize-command ] unit-test -[ "\"abc def\" \"hey" tokenize-command ] must-fail -[ "\"abc def" tokenize-command ] must-fail -[ V{ "abc def" "h\"ey" } ] [ "\"abc def\" \"h\\\"ey\" " tokenize-command ] unit-test - -[ - V{ - "Hello world.app/Contents/MacOS/hello-ui" - "-i=boot.macosx-ppc.image" - "-include= math compiler ui" - "-deploy-vocab=hello-ui" - "-output-image=Hello world.app/Contents/Resources/hello-ui.image" - "-no-stack-traces" - "-no-user-init" - } -] [ - "\"Hello world.app/Contents/MacOS/hello-ui\" -i=boot.macosx-ppc.image \"-include= math compiler ui\" -deploy-vocab=hello-ui \"-output-image=Hello world.app/Contents/Resources/hello-ui.image\" -no-stack-traces -no-user-init" tokenize-command -] unit-test diff --git a/basis/io/launcher/unix/parser/platforms.txt b/basis/io/launcher/unix/parser/platforms.txt deleted file mode 100644 index 509143d863..0000000000 --- a/basis/io/launcher/unix/parser/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -unix diff --git a/basis/io/launcher/unix/unix.factor b/basis/io/launcher/unix/unix.factor index d8b55d3d17..aaaccd4719 100644 --- a/basis/io/launcher/unix/unix.factor +++ b/basis/io/launcher/unix/unix.factor @@ -1,15 +1,14 @@ -! Copyright (C) 2007, 2008 Slava Pestov. +! Copyright (C) 2007, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien.c-types arrays assocs combinators continuations environment io io.backend io.backend.unix -io.files io.files.private io.files.unix io.launcher -io.launcher.unix.parser io.pathnames io.ports kernel math -namespaces sequences strings system threads unix -unix.process unix.ffi ; +io.files io.files.private io.files.unix io.launcher io.pathnames +io.ports kernel math namespaces sequences strings system threads +unix unix.process unix.ffi simple-tokenizer ; IN: io.launcher.unix : get-arguments ( process -- seq ) - command>> dup string? [ tokenize-command ] when ; + command>> dup string? [ tokenize ] when ; : assoc>env ( assoc -- env ) [ "=" glue ] { } assoc>map ; diff --git a/basis/simple-tokenizer/authors.txt b/basis/simple-tokenizer/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/basis/simple-tokenizer/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/basis/simple-tokenizer/simple-tokenizer-docs.factor b/basis/simple-tokenizer/simple-tokenizer-docs.factor new file mode 100644 index 0000000000..57e14f09ba --- /dev/null +++ b/basis/simple-tokenizer/simple-tokenizer-docs.factor @@ -0,0 +1,13 @@ +USING: help.markup help.syntax strings ; +IN: simple-tokenizer + +HELP: tokenize +{ $values { "input" string } { "ast" "a sequence of strings" } } +{ $description + "Tokenize a string. Supported syntax:" + { $list + { { $snippet "foo bar baz" } " - simple tokens" } + { { $snippet "foo\\ bar" } " - token with an escaped space"} + { { $snippet "\"foo bar\"" } " - quoted token" } + } +} ; diff --git a/basis/simple-tokenizer/simple-tokenizer-tests.factor b/basis/simple-tokenizer/simple-tokenizer-tests.factor new file mode 100644 index 0000000000..3b44f03650 --- /dev/null +++ b/basis/simple-tokenizer/simple-tokenizer-tests.factor @@ -0,0 +1,33 @@ +IN: simple-tokenizer.tests +USING: simple-tokenizer tools.test ; + +[ "" tokenize ] must-fail +[ " " tokenize ] must-fail +[ V{ "a" } ] [ "a" tokenize ] unit-test +[ V{ "abc" } ] [ "abc" tokenize ] unit-test +[ V{ "abc" } ] [ "abc " tokenize ] unit-test +[ V{ "abc" } ] [ " abc" tokenize ] unit-test +[ V{ "abc" "def" } ] [ "abc def" tokenize ] unit-test +[ V{ "abc def" } ] [ "abc\\ def" tokenize ] unit-test +[ V{ "abc\\" "def" } ] [ "abc\\\\ def" tokenize ] unit-test +[ V{ "abc\\ def" } ] [ "\"abc\\\\ def\"" tokenize ] unit-test +[ V{ "abc\\ def" } ] [ " \"abc\\\\ def\"" tokenize ] unit-test +[ V{ "abc\\ def" "hey" } ] [ "\"abc\\\\ def\" hey" tokenize ] unit-test +[ V{ "abc def" "hey" } ] [ "\"abc def\" \"hey\"" tokenize ] unit-test +[ "\"abc def\" \"hey" tokenize ] must-fail +[ "\"abc def" tokenize ] must-fail +[ V{ "abc def" "h\"ey" } ] [ "\"abc def\" \"h\\\"ey\" " tokenize ] unit-test + +[ + V{ + "Hello world.app/Contents/MacOS/hello-ui" + "-i=boot.macosx-ppc.image" + "-include= math compiler ui" + "-deploy-vocab=hello-ui" + "-output-image=Hello world.app/Contents/Resources/hello-ui.image" + "-no-stack-traces" + "-no-user-init" + } +] [ + "\"Hello world.app/Contents/MacOS/hello-ui\" -i=boot.macosx-ppc.image \"-include= math compiler ui\" -deploy-vocab=hello-ui \"-output-image=Hello world.app/Contents/Resources/hello-ui.image\" -no-stack-traces -no-user-init" tokenize +] unit-test diff --git a/basis/io/launcher/unix/parser/parser.factor b/basis/simple-tokenizer/simple-tokenizer.factor similarity index 62% rename from basis/io/launcher/unix/parser/parser.factor rename to basis/simple-tokenizer/simple-tokenizer.factor index bcc5f965e9..f6698a65f0 100644 --- a/basis/io/launcher/unix/parser/parser.factor +++ b/basis/simple-tokenizer/simple-tokenizer.factor @@ -1,13 +1,9 @@ -! Copyright (C) 2008 Slava Pestov +! Copyright (C) 2008, 2010 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: peg peg.ebnf arrays sequences strings kernel ; -IN: io.launcher.unix.parser +IN: simple-tokenizer -! Our command line parser. Supported syntax: -! foo bar baz -- simple tokens -! foo\ bar -- escaping the space -! "foo bar" -- quotation -EBNF: tokenize-command +EBNF: tokenize space = " " escaped-char = "\" .:ch => [[ ch ]] quoted = '"' (escaped-char | [^"])*:a '"' => [[ a ]] diff --git a/basis/simple-tokenizer/tags.txt b/basis/simple-tokenizer/tags.txt new file mode 100644 index 0000000000..8e27be7d61 --- /dev/null +++ b/basis/simple-tokenizer/tags.txt @@ -0,0 +1 @@ +text From 5700d94e2bb649c2027cac16bdd40e959d64716e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 17:40:05 +1300 Subject: [PATCH 04/10] unix.utilities: remove platforms.txt since its portable --- basis/unix/utilities/platforms.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 basis/unix/utilities/platforms.txt diff --git a/basis/unix/utilities/platforms.txt b/basis/unix/utilities/platforms.txt deleted file mode 100644 index 509143d863..0000000000 --- a/basis/unix/utilities/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -unix From 6367c8ec85e1ad2417fa60530371ea3c7557bc45 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 17:40:19 +1300 Subject: [PATCH 05/10] native-thread-test: clean up --- core/alien/strings/strings.factor | 17 ++++++----- .../native-thread-test.factor | 28 +++++++++---------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/core/alien/strings/strings.factor b/core/alien/strings/strings.factor index 15e0370ba0..0ad4f6c85a 100644 --- a/core/alien/strings/strings.factor +++ b/core/alien/strings/strings.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008, 2009 Slava Pestov. +! Copyright (C) 2008, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays sequences kernel kernel.private accessors math alien.accessors byte-arrays io io.encodings io.encodings.utf8 @@ -37,17 +37,16 @@ M: string string>alien M: tuple string>alien drop underlying>> ; -HOOK: alien>native-string os ( alien -- string ) +HOOK: native-string-encoding os ( -- encoding ) foldable -M: windows alien>native-string utf16n alien>string ; +M: unix native-string-encoding utf8 ; +M: windows native-string-encoding utf16n ; -M: unix alien>native-string utf8 alien>string ; +: alien>native-string ( alien -- string ) + native-string-encoding alien>string ; inline -HOOK: native-string>alien os ( string -- alien ) - -M: windows native-string>alien utf16n string>alien ; - -M: unix native-string>alien utf8 string>alien ; +: native-string>alien ( string -- alien ) + native-string-encoding string>alien ; inline : dll-path ( dll -- string ) path>> alien>native-string ; diff --git a/extra/native-thread-test/native-thread-test.factor b/extra/native-thread-test/native-thread-test.factor index 508e590d01..4d0df1f454 100644 --- a/extra/native-thread-test/native-thread-test.factor +++ b/extra/native-thread-test/native-thread-test.factor @@ -1,26 +1,24 @@ -USING: alien.c-types alien.syntax io io.encodings.utf16n -io.encodings.utf8 io.files kernel namespaces sequences system threads +! Copyright (C) 2009 Phil Dawes. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.c-types alien.strings alien.syntax io +io.encodings.utf8 io.files kernel sequences system threads unix.utilities ; IN: native-thread-test FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ; -HOOK: native-string-encoding os ( -- encoding ) -M: windows native-string-encoding utf16n ; -M: unix native-string-encoding utf8 ; - : start-vm-in-os-thread ( args -- threadhandle ) - \ vm get-global prefix + vm prefix [ length ] [ native-string-encoding strings>alien ] bi - start_standalone_factor_in_new_thread ; + start_standalone_factor_in_new_thread ; : start-tetris-in-os-thread ( -- ) - { "-run=tetris" } start-vm-in-os-thread drop ; + { "-run=tetris" } start-vm-in-os-thread drop ; -: start-testthread-in-os-thread ( -- ) - { "-run=native-thread-test" } start-vm-in-os-thread drop ; - -: testthread ( -- ) - "/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ; +: start-test-thread-in-os-thread ( -- ) + { "-run=native-thread-test" } start-vm-in-os-thread drop ; -MAIN: testthread +: test-thread ( -- ) + "/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ; + +MAIN: test-thread From 0161f4e8d2ba2968bc02cfec560bdfff04a029c8 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 17:42:40 +1300 Subject: [PATCH 06/10] io.serial.windows: fix load error --- extra/io/serial/windows/windows.factor | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extra/io/serial/windows/windows.factor b/extra/io/serial/windows/windows.factor index 645e4939de..4ea3d5e9e4 100644 --- a/extra/io/serial/windows/windows.factor +++ b/extra/io/serial/windows/windows.factor @@ -1,9 +1,8 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: io.files.windows io.streams.duplex kernel math -math.bitwise windows.kernel32 accessors alien.c-types -windows io.files.windows fry locals continuations -classes.struct ; +math.bitwise windows windows.kernel32 windows.errors accessors +alien.c-types fry locals continuations classes.struct ; IN: io.serial.windows : ( path encoding -- duplex ) From 0e8f3670a3f64d07f5c0e7371ddd978341639797 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 17:46:25 +1300 Subject: [PATCH 07/10] Move windows.dragdrop-listener to unmaintained --- .../dragdrop-listener/dragdrop-listener.factor | 0 {basis/windows => unmaintained}/dragdrop-listener/platforms.txt | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {basis/windows => unmaintained}/dragdrop-listener/dragdrop-listener.factor (100%) rename {basis/windows => unmaintained}/dragdrop-listener/platforms.txt (100%) diff --git a/basis/windows/dragdrop-listener/dragdrop-listener.factor b/unmaintained/dragdrop-listener/dragdrop-listener.factor similarity index 100% rename from basis/windows/dragdrop-listener/dragdrop-listener.factor rename to unmaintained/dragdrop-listener/dragdrop-listener.factor diff --git a/basis/windows/dragdrop-listener/platforms.txt b/unmaintained/dragdrop-listener/platforms.txt similarity index 100% rename from basis/windows/dragdrop-listener/platforms.txt rename to unmaintained/dragdrop-listener/platforms.txt From 570a2d0b37099ee7c207a8e85176a9781584d481 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 20:19:11 +1300 Subject: [PATCH 08/10] unix.utmpx: fix load errors --- basis/unix/utmpx/netbsd/netbsd.factor | 30 +++++++++++++-------------- basis/unix/utmpx/platforms.txt | 3 ++- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/basis/unix/utmpx/netbsd/netbsd.factor b/basis/unix/utmpx/netbsd/netbsd.factor index 40fce746b1..93092a7cbf 100644 --- a/basis/unix/utmpx/netbsd/netbsd.factor +++ b/basis/unix/utmpx/netbsd/netbsd.factor @@ -1,22 +1,20 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax unix.utmpx unix.bsd.netbsd accessors -unix.utmpx system kernel unix combinators ; +USING: alien.syntax unix unix.utmpx unix.ffi.bsd.netbsd accessors +system kernel combinators ; IN: unix.utmpx.netbsd -TUPLE: netbsd-utmpx-record < utmpx-record termination exit -sockaddr ; - +TUPLE: netbsd-utmpx-record < utmpx-record +termination exit sockaddr ; + M: netbsd new-utmpx-record ( -- utmpx-record ) - netbsd-utmpx-record new ; - + netbsd-utmpx-record new ; + M: netbsd utmpx>utmpx-record ( utmpx -- record ) - [ new-utmpx-record ] keep - { - [ - utmpx-ut_exit - [ exit_struct-e_termination >>termination ] - [ exit_struct-e_exit >>exit ] bi - ] - [ utmpx-ut_ss >>sockaddr ] - } cleave ; + [ new-utmpx-record ] dip + [ + ut_exit>> + [ e_termination>> >>termination ] + [ e_exit>> >>exit ] bi + ] + [ ut_ss>> >>sockaddr ] bi ; diff --git a/basis/unix/utmpx/platforms.txt b/basis/unix/utmpx/platforms.txt index 509143d863..abe56c1458 100644 --- a/basis/unix/utmpx/platforms.txt +++ b/basis/unix/utmpx/platforms.txt @@ -1 +1,2 @@ -unix +macosx +netbsd From 2f70ebd4d02dab0c06835f071b0045b39d624cc2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 20:38:09 +1300 Subject: [PATCH 09/10] vocabs: document platforms.txt --- basis/tools/deploy/deploy-docs.factor | 2 +- basis/vocabs/metadata/metadata-docs.factor | 31 +++++++++++++++++++--- core/vocabs/loader/loader-docs.factor | 20 +++++--------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/basis/tools/deploy/deploy-docs.factor b/basis/tools/deploy/deploy-docs.factor index a552bd04fb..976fc25357 100755 --- a/basis/tools/deploy/deploy-docs.factor +++ b/basis/tools/deploy/deploy-docs.factor @@ -13,7 +13,7 @@ ARTICLE: "prepare-deploy" "Preparing to deploy an application" ARTICLE: "deploy-resources" "Deployed resource files" "To include additional files in your deployed application, specify their names in a vocabulary's " { $snippet "resources.txt" } " file. The " { $snippet "resources.txt" } " file contains one glob pattern per line. These patterns are expanded relative to the vocabulary directory; files outside of the vocabulary directory cannot be referenced. If a file inside the vocabulary directory matches any of these patterns, it will be included in deployed applications that reference the vocabulary. If a subdirectory matches, its contents will be included recursively." $nl -"If the deployed vocabulary includes an icon file for the current platform (" { $snippet "icon.ico" } " on Windows, or " { $snippet "icon.icns" } " on MacOS X), it will be embedded in the deployed application as its GUI icon." ; +"If the deployed vocabulary includes an icon file for the current platform, it will be embedded in the deployed application as its GUI icon. See " { $link "vocabs.icons" } "." ; ARTICLE: "tools.deploy.usage" "Deploy tool usage" "Once the necessary deployment flags have been set, the application can be deployed:" diff --git a/basis/vocabs/metadata/metadata-docs.factor b/basis/vocabs/metadata/metadata-docs.factor index 95c8083e0f..c3dce45c09 100644 --- a/basis/vocabs/metadata/metadata-docs.factor +++ b/basis/vocabs/metadata/metadata-docs.factor @@ -2,23 +2,36 @@ USING: help.markup help.syntax strings ; IN: vocabs.metadata ARTICLE: "vocabs.metadata" "Vocabulary metadata" -"Vocabulary summaries:" +"Vocabulary directories can contain text files with metadata:" +{ $list + { { $snippet "authors.txt" } " - a series of lines, with one author name per line. These are listed under " { $link "vocab-authors" } "." } + { { $snippet "platforms.txt" } " - a series of lines, with one operating system name per line." } + { { $snippet "resources.txt" } " - a series of lines, with one file glob pattern per line. Files inside the vocabulary directory whose names match any of these glob patterns will be included with the compiled application as " { $link "deploy-resources" } "." } + { { $snippet "summary.txt" } " - a one-line description." } + { { $snippet "tags.txt" } " - a series of lines, with one tag per line. Tags help classify the vocabulary. Consult " { $link "vocab-tags" } " for a list of existing tags you can reuse." } +} +"Words for reading and writing " { $snippet "summary.txt" } ":" { $subsections vocab-summary set-vocab-summary } -"Vocabulary authors:" +"Words for reading and writing " { $snippet "authors.txt" } ":" { $subsections vocab-authors set-vocab-authors } -"Vocabulary tags:" +"Words for reading and writing " { $snippet "tags.txt" } ":" { $subsections vocab-tags set-vocab-tags add-vocab-tags } -"Vocabulary resources:" +"Words for reading and writing " { $snippet "platforms.txt" } ":" +{ $subsections + vocab-platforms + set-vocab-platforms +} +"Words for reading and writing " { $snippet "resources.txt" } ":" { $subsections vocab-resources set-vocab-resources @@ -55,6 +68,16 @@ HELP: set-vocab-tags { $values { "tags" "a sequence of strings" } { "vocab" "a vocabulary specifier" } } { $description "Stores a list of short tags classifying the vocabulary to the " { $snippet "tags.txt" } " file in the vocabulary's directory." } ; +HELP: vocab-platforms +{ $values { "vocab" "a vocabulary specifier" } { "platforms" "a sequence of operating system symbols" } } +{ $description "Outputs a list of operating systems supported by " { $snippet "vocab" } ", as specified by the " { $snippet "platforms.txt" } " file in the vocabulary's directory. Outputs an empty array if the file doesn't exist." } +{ $notes "Operating system symbols are defined in the " { $vocab-link "system" } " vocabulary." } ; + +HELP: set-vocab-platforms +{ $values { "platforms" "a sequence of operating system symbols" } { "vocab" "a vocabulary specifier" } } +{ $description "Stores a list of operating systems supported by " { $snippet "vocab" } " to the " { $snippet "platforms.txt" } " file in the vocabulary's directory." } +{ $notes "Operating system symbols are defined in the " { $vocab-link "system" } " vocabulary." } ; + HELP: vocab-resources { $values { "vocab" "a vocabulary specifier" } { "patterns" "a sequence of glob patterns" } } { $description "Outputs a list of glob patterns matching files that will be deployed with an application that includes " { $snippet "vocab" } ", as specified by the " { $snippet "resources.txt" } " file in the vocabulary's directory. Outputs an empty array if the file doesn't exist." } diff --git a/core/vocabs/loader/loader-docs.factor b/core/vocabs/loader/loader-docs.factor index ce4a319a42..08ab729b6d 100755 --- a/core/vocabs/loader/loader-docs.factor +++ b/core/vocabs/loader/loader-docs.factor @@ -27,10 +27,11 @@ ARTICLE: "vocabs.roots" "Vocabulary roots" "You can store your own vocabularies in the " { $snippet "work" } " directory." { $subsections "add-vocab-roots" } ; +ARTICLE: "vocabs.icons" "Vocabulary icons" +"An icon file representing the vocabulary can be provided for use by " { $link "tools.deploy" } ". A file named " { $snippet "icon.ico" } " will be used as the application icon when the application is deployed on Windows. A file named " { $snippet "icon.icns" } " will be used when the application is deployed on MacOS X." ; + ARTICLE: "vocabs.loader" "Vocabulary loader" -"The vocabulary loader combines the vocabulary system with " { $link "parser" } " in order to implement automatic loading of vocabulary source files. The vocabulary loader is implemented in the " { $vocab-link "vocabs.loader" } " vocabulary." -$nl -"When an attempt is made to use a vocabulary that has not been loaded into the image, the vocabulary loader is asked to locate the vocabulary's source files, and load them." +"The " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " words load vocabularies using the vocabulary loader. The vocabulary loader is implemented in the " { $vocab-link "vocabs.loader" } " vocabulary." $nl "The vocabulary loader searches for vocabularies in a set of directories known as vocabulary roots." { $subsections "vocabs.roots" } @@ -45,17 +46,8 @@ $nl { { $snippet "foo/bar/bar-docs.factor" } " - documentation, see " { $link "writing-help" } } { { $snippet "foo/bar/bar-tests.factor" } " - unit tests, see " { $link "tools.test" } } } -"Finally, four optional text files may contain metadata:" -{ $list - { { $snippet "foo/bar/authors.txt" } " - a series of lines, with one author name per line. These are listed under " { $link "vocab-authors" } "." } - { { $snippet "foo/bar/resources.txt" } " - a series of lines with one file glob pattern per line. Files inside the vocabulary directory whose names match any of these glob patterns will be included with the compiled application as " { $link "deploy-resources" } "." } - { { $snippet "foo/bar/summary.txt" } " - a one-line description." } - { { $snippet "foo/bar/tags.txt" } " - a whitespace-separated list of tags which classify the vocabulary. Consult " { $link "vocab-tags" } " for a list of existing tags you can reuse." } -} -"An icon file representing the vocabulary can also be provided. A file named " { $snippet "icon.ico" } " will be used as the application icon when the application is deployed on Windows. A file named " { $snippet "icon.icns" } " will be used when the application is deployed on MacOS X." -$nl -"The " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " words load vocabularies which have not been loaded yet, as needed." -$nl +"Optional text files may contain metadata." +{ $subsections "vocabs.metadata" "vocabs.icons" } "Vocabularies can also be loaded at run time, without altering the vocabulary search path. This is done by calling a word which loads a vocabulary if it is not in the image, doing nothing if it is:" { $subsections require } "The above word will only ever load a vocabulary once in a given session. There is another word which unconditionally loads vocabulary from disk, regardless of whether or not is has already been loaded:" From 0da6f780888e85ab01b706ade6b98dc9e8093735 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 21 Feb 2010 22:27:32 +1300 Subject: [PATCH 10/10] cocoa.messages: if a class cannot be found, IMPORT: no longer fails at parse time. Instead, there will be a runtime error when the class word is executed --- basis/cocoa/messages/messages.factor | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/basis/cocoa/messages/messages.factor b/basis/cocoa/messages/messages.factor index 02e6335c54..eab301add7 100644 --- a/basis/cocoa/messages/messages.factor +++ b/basis/cocoa/messages/messages.factor @@ -76,13 +76,13 @@ MACRO: (send) ( selector super? -- quot ) : super-send ( receiver args... selector -- return... ) t (send) ; inline ! Runtime introspection -SYMBOL: class-startup-hooks +SYMBOL: class-init-hooks -class-startup-hooks [ H{ } clone ] initialize +class-init-hooks [ H{ } clone ] initialize : (objc-class) ( name word -- class ) 2dup execute dup [ 2nip ] [ - drop over class-startup-hooks get at [ call( -- ) ] when* + drop over class-init-hooks get at [ call( -- ) ] when* 2dup execute dup [ 2nip ] [ 2drop "No such class: " prepend throw ] if @@ -229,7 +229,7 @@ ERROR: no-objc-type name ; : class-exists? ( string -- class ) objc_getClass >boolean ; : define-objc-class-word ( quot name -- ) - [ class-startup-hooks get set-at ] + [ class-init-hooks get set-at ] [ [ "cocoa.classes" create ] [ '[ _ objc-class ] ] bi (( -- class )) define-declared @@ -237,8 +237,10 @@ ERROR: no-objc-type name ; : import-objc-class ( name quot -- ) over define-objc-class-word - [ objc-class register-objc-methods ] - [ objc-meta-class register-objc-methods ] bi ; + dup objc_getClass [ + [ objc-class register-objc-methods ] + [ objc-meta-class register-objc-methods ] bi + ] [ drop ] if ; : root-class ( class -- root ) dup class_getSuperclass [ root-class ] [ ] ?if ;