From a2e6c372136f35a1d62a8add94293efbd8b52649 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Thu, 7 Feb 2008 18:30:20 -0600 Subject: [PATCH 1/7] simplify builder.test --- extra/builder/builder.factor | 9 +++++-- extra/builder/test/test.factor | 48 ++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index 5e992ccc81..caa381ba5d 100755 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -1,8 +1,8 @@ -USING: kernel io io.files io.launcher hashtables tools.deploy.backend +USING: kernel io io.files io.launcher hashtables system continuations namespaces sequences splitting math.parser prettyprint tools.time calendar bake vars http.client - combinators ; + combinators bootstrap.image ; IN: builder @@ -82,6 +82,11 @@ VAR: stamp ] if + { + "git" "pull" "--no-summary" + "http://dharmatech.onigirihouse.com/factor.git" "master" + } run-process process-status + "/builds/" stamp> append make-directory "/builds/" stamp> append cd diff --git a/extra/builder/test/test.factor b/extra/builder/test/test.factor index fb9c62e2aa..2a867b1fbc 100644 --- a/extra/builder/test/test.factor +++ b/extra/builder/test/test.factor @@ -7,28 +7,42 @@ USING: kernel sequences assocs builder continuations vocabs vocabs.loader IN: builder.test +! : do-load ( -- ) +! [ +! [ load-everything ] +! [ require-all-error-vocabs "../load-everything-log" log-object ] +! recover +! ] +! "../load-everything-time" log-runtime ; + : do-load ( -- ) - [ - [ load-everything ] - [ require-all-error-vocabs "../load-everything-log" log-object ] - recover - ] - "../load-everything-time" log-runtime ; + [ try-everything ] "../load-everything-time" log-runtime + dup empty? + [ drop ] + [ "../load-everything-log" log-object ] + if ; + +! : do-tests ( -- ) +! "" child-vocabs +! [ vocab-source-loaded? ] subset +! [ vocab-tests-path ] map +! [ dup [ ?resource-path exists? ] when ] subset +! [ dup run-test ] { } map>assoc +! [ second empty? not ] subset +! dup empty? +! [ drop ] +! [ +! "../failing-tests" +! [ [ nl failures. ] assoc-each ] +! with-stream +! ] +! if ; : do-tests ( -- ) - "" child-vocabs - [ vocab-source-loaded? ] subset - [ vocab-tests-path ] map - [ dup [ ?resource-path exists? ] when ] subset - [ dup run-test ] { } map>assoc - [ second empty? not ] subset + run-all-tests keys dup empty? [ drop ] - [ - "../failing-tests" - [ [ nl failures. ] assoc-each ] - with-stream - ] + [ "../failing-tests" log-object ] if ; : do-all ( -- ) do-load do-tests ; From 1c3efa89d214ad2b4f9f6b468de2519c6bdbae2c Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Thu, 7 Feb 2008 19:50:26 -0600 Subject: [PATCH 2/7] builder improvements (download-image, simpler do-all) --- extra/builder/builder.factor | 12 ++++++------ extra/builder/test/test.factor | 24 ------------------------ 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index caa381ba5d..9af79efb29 100755 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -2,7 +2,7 @@ USING: kernel io io.files io.launcher hashtables system continuations namespaces sequences splitting math.parser prettyprint tools.time calendar bake vars http.client - combinators bootstrap.image ; + combinators bootstrap.image bootstrap.image.download ; IN: builder @@ -70,7 +70,6 @@ VAR: stamp "pull" "--no-summary" "git://factorcode.org/git/factor.git" - ! "http://dharmatech.onigirihouse.com/factor.git" "master" } run-process process-status @@ -85,7 +84,7 @@ VAR: stamp { "git" "pull" "--no-summary" "http://dharmatech.onigirihouse.com/factor.git" "master" - } run-process process-status + } run-process drop "/builds/" stamp> append make-directory "/builds/" stamp> append cd @@ -112,14 +111,15 @@ VAR: stamp "builder: vm compile" throw ] if - [ "http://factorcode.org/images/latest/" boot-image-name append download ] + [ my-arch download-image ] + [ ] [ "builder: image download" email-string ] - recover + cleanup `{ { +arguments+ { ,[ factor-binary ] - ,[ "-i=" boot-image-name append ] + ,[ "-i=" my-boot-image-name append ] "-no-user-init" } } { +stdout+ "../boot-log" } diff --git a/extra/builder/test/test.factor b/extra/builder/test/test.factor index 2a867b1fbc..c887c668e6 100644 --- a/extra/builder/test/test.factor +++ b/extra/builder/test/test.factor @@ -7,14 +7,6 @@ USING: kernel sequences assocs builder continuations vocabs vocabs.loader IN: builder.test -! : do-load ( -- ) -! [ -! [ load-everything ] -! [ require-all-error-vocabs "../load-everything-log" log-object ] -! recover -! ] -! "../load-everything-time" log-runtime ; - : do-load ( -- ) [ try-everything ] "../load-everything-time" log-runtime dup empty? @@ -22,22 +14,6 @@ IN: builder.test [ "../load-everything-log" log-object ] if ; -! : do-tests ( -- ) -! "" child-vocabs -! [ vocab-source-loaded? ] subset -! [ vocab-tests-path ] map -! [ dup [ ?resource-path exists? ] when ] subset -! [ dup run-test ] { } map>assoc -! [ second empty? not ] subset -! dup empty? -! [ drop ] -! [ -! "../failing-tests" -! [ [ nl failures. ] assoc-each ] -! with-stream -! ] -! if ; - : do-tests ( -- ) run-all-tests keys dup empty? From 7adb07bcc4354c8f32befc3cfce5242c6b11687e Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 8 Feb 2008 03:11:47 -0600 Subject: [PATCH 3/7] concurrency docs fix --- extra/concurrency/concurrency-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/concurrency/concurrency-docs.factor b/extra/concurrency/concurrency-docs.factor index f04811b72a..538ed847f0 100644 --- a/extra/concurrency/concurrency-docs.factor +++ b/extra/concurrency/concurrency-docs.factor @@ -138,7 +138,7 @@ ARTICLE: { "concurrency" "servers" } "Servers" ARTICLE: { "concurrency" "synchronous-sends" } "Synchronous Sends" { $link send } " sends a message asynchronously, and the sending process continues immediately. The 'pong server' example shown previously all sent messages to the server and waited for a reply back from the server. This pattern of synchronous sending is made easier with " { $link send-synchronous } ".\n\nThis word will send a message to the given process and immediately block until a reply is received for this particular message send. It leaves the reply on the stack. Note that it doesn't wait for just any reply, it waits for a reply specifically to this send.\n\nTo do this it wraps the requested message inside a tagged message format using " { $link tag-message } ":" { $code "\"My Message\" tag-message .\n => { ...from... ...tag... \"My Message\" }" } -"The message is wrapped in array where the first item is the sending process object, the second is a unique tag, and the third is the original message. Server processes can use the 'from' to reply to the process that originally sent the message. The tag can is used in the receiving server to include the value in the reply. After the send-synchronous call the current process will block waiting for a reply that has the exact same tag. In this way you can be sure that the reply you got was for the specific message sent. Here is the pong-server recoded to use 'send-synchronous':" +"The message is wrapped in array where the first item is the sending process object, the second is a unique tag, and the third is the original message. Server processes can use the 'from' to reply to the process that originally sent the message. The tag can used in the receiving server to include the value in the reply. After the send-synchronous call the current process will block waiting for a reply that has the exact same tag. In this way you can be sure that the reply you got was for the specific message sent. Here is the pong-server recoded to use 'send-synchronous':" { $code ": pong-server ( -- )\n receive {\n { { ?from ?tag \"ping\" } [ ?tag \"pong\" 2array ?from send pong-server ] }\n { { ?from _ } [ ?tag \"server shutdown\" 2array ?from send ] }\n } match-cond ;\n\n[ pong-server ] spawn \"ping\" swap send-synchronous .\n => \"pong\"" } "Notice that the code to send the reply back to the original caller wraps the reply in an array where the first item is the tag originally sent. 'send-synchronous' only returns if it receives a reply containing that specific tag." ; From 3f38bf18ec98e02af5a42422d167bc8122053b89 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 8 Feb 2008 03:14:08 -0600 Subject: [PATCH 4/7] concurrency docs fix --- extra/concurrency/concurrency-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/concurrency/concurrency-docs.factor b/extra/concurrency/concurrency-docs.factor index 538ed847f0..16a2e65a90 100644 --- a/extra/concurrency/concurrency-docs.factor +++ b/extra/concurrency/concurrency-docs.factor @@ -138,7 +138,7 @@ ARTICLE: { "concurrency" "servers" } "Servers" ARTICLE: { "concurrency" "synchronous-sends" } "Synchronous Sends" { $link send } " sends a message asynchronously, and the sending process continues immediately. The 'pong server' example shown previously all sent messages to the server and waited for a reply back from the server. This pattern of synchronous sending is made easier with " { $link send-synchronous } ".\n\nThis word will send a message to the given process and immediately block until a reply is received for this particular message send. It leaves the reply on the stack. Note that it doesn't wait for just any reply, it waits for a reply specifically to this send.\n\nTo do this it wraps the requested message inside a tagged message format using " { $link tag-message } ":" { $code "\"My Message\" tag-message .\n => { ...from... ...tag... \"My Message\" }" } -"The message is wrapped in array where the first item is the sending process object, the second is a unique tag, and the third is the original message. Server processes can use the 'from' to reply to the process that originally sent the message. The tag can used in the receiving server to include the value in the reply. After the send-synchronous call the current process will block waiting for a reply that has the exact same tag. In this way you can be sure that the reply you got was for the specific message sent. Here is the pong-server recoded to use 'send-synchronous':" +"The message is wrapped in array where the first item is the sending process object, the second is a unique tag, and the third is the original message. Server processes can use the 'from' to reply to the process that originally sent the message. The tag is used in the receiving server to include the value in the reply. After the send-synchronous call the current process will block waiting for a reply that has the exact same tag. In this way you can be sure that the reply you got was for the specific message sent. Here is the pong-server recoded to use 'send-synchronous':" { $code ": pong-server ( -- )\n receive {\n { { ?from ?tag \"ping\" } [ ?tag \"pong\" 2array ?from send pong-server ] }\n { { ?from _ } [ ?tag \"server shutdown\" 2array ?from send ] }\n } match-cond ;\n\n[ pong-server ] spawn \"ping\" swap send-synchronous .\n => \"pong\"" } "Notice that the code to send the reply back to the original caller wraps the reply in an array where the first item is the tag originally sent. 'send-synchronous' only returns if it receives a reply containing that specific tag." ; From 5570f367a631dddd2e0f42078baa15641ed12567 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 8 Feb 2008 20:09:59 -0600 Subject: [PATCH 5/7] builder: build-status variable --- extra/builder/builder.factor | 12 ++++++++++++ 1 file changed, 12 insertions(+) mode change 100755 => 100644 extra/builder/builder.factor diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor old mode 100755 new mode 100644 index 9af79efb29..1c5f5ff3fd --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -59,8 +59,12 @@ VAR: stamp ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +SYMBOL: build-status + : build ( -- ) + "running" build-status set-global + datestamp >stamp "/builds/factor" cd @@ -98,6 +102,8 @@ VAR: stamp { "make" "clean" } run-process drop + ! "vm" build-status set-global + `{ { +arguments+ { "make" ,[ target ] } } { +stdout+ "../compile-log" } @@ -116,6 +122,8 @@ VAR: stamp [ "builder: image download" email-string ] cleanup + ! "bootstrap" build-status set-global + `{ { +arguments+ { ,[ factor-binary ] @@ -133,6 +141,8 @@ VAR: stamp "builder: bootstrap" throw ] if + ! "test" build-status set-global + `{ ,[ factor-binary ] "-run=builder.test" } run-process drop "../load-everything-log" exists? @@ -143,6 +153,8 @@ VAR: stamp [ "builder: failing tests" "../failing-tests" email-file ] when + ! "ready" build-status set-global + ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! From 7b07ababba5a9f95d17fa9c67fbfe006d97916cd Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 8 Feb 2008 20:16:12 -0600 Subject: [PATCH 6/7] add builder.server --- extra/builder/server/server.factor | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 extra/builder/server/server.factor diff --git a/extra/builder/server/server.factor b/extra/builder/server/server.factor new file mode 100644 index 0000000000..672de1e47d --- /dev/null +++ b/extra/builder/server/server.factor @@ -0,0 +1,68 @@ + +USING: kernel continuations namespaces threads match bake concurrency builder ; + +IN: builder.server + +! : build-server ( -- ) +! receive +! { +! { +! "start" +! [ [ build ] in-thread ] +! } + +! { +! { ?from ?tag "status" } +! [ `{ ?tag ,[ build-status get ] } ?from send ] +! } +! } +! match-cond +! build-server ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +! : build-server ( -- ) +! receive +! { +! { +! "start" +! [ +! [ [ build ] [ drop ] recover "idle" build-status set-global ] in-thread +! ] +! } + +! { +! { ?from ?tag "status" } +! [ `{ ?tag ,[ build-status get ] } ?from send ] +! } +! } +! match-cond +! build-server ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: build-server ( -- ) + receive + { + { + "start" + [ + build-status get "idle" = + build-status get f = + or + [ + [ [ build ] [ drop ] recover "idle" build-status set-global ] + in-thread + ] + when + ] + } + + { + { ?from ?tag "status" } + [ `{ ?tag ,[ build-status get ] } ?from send ] + } + } + match-cond + build-server ; + From f45f6879ab04d4d115ee91b21493471592971fb9 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 8 Feb 2008 23:28:06 -0600 Subject: [PATCH 7/7] Makefile: winnt target downloads dlls --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 05a185f643..9776027a59 100755 --- a/Makefile +++ b/Makefile @@ -123,7 +123,15 @@ solaris-x86-32: solaris-x86-64: $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86.64 -winnt-x86-32: +freetype6.dll: + wget http://factorcode.org/dlls/freetype6.dll + chmod 755 freetype6.dll + +zlib1.dll: + wget http://factorcode.org/dlls/zlib1.dll + chmod 755 zlib1.dll + +winnt-x86-32: freetype6.dll zlib1.dll $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32 winnt-x86-64: