From 72c898e2b52d6e523acd16495f41f8c3983afe92 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg <littledan@Macintosh-103.local> Date: Tue, 10 Feb 2009 19:05:08 -0600 Subject: [PATCH 1/6] Code for letting you test the todo list --- extra/webapps/todo/todo.factor | 52 +++++++++++++++++++++++++++++++++- extra/webapps/todo/todo.xml | 11 +++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/extra/webapps/todo/todo.factor b/extra/webapps/todo/todo.factor index e1f6c8735a..6ef60c198f 100755 --- a/extra/webapps/todo/todo.factor +++ b/extra/webapps/todo/todo.factor @@ -106,7 +106,8 @@ todo "TODO" : <todo-list> ( -- responder ) todo-list new-dispatcher - <list-action> "" add-responder + <list-action> "list" add-responder + URL" /list" <redirect-responder> "" add-responder <view-action> "view" add-responder <new-action> "new" add-responder <edit-action> "edit" add-responder @@ -115,3 +116,52 @@ todo "TODO" { todo-list "todo" } >>template <protected> "view your todo list" >>description ; + +USING: furnace.auth.features.registration +furnace.auth.features.edit-profile +furnace.auth.features.deactivate-user +db.sqlite +furnace.alloy +io.servers.connection +io.sockets.secure ; + +: <login-config> ( responder -- responder' ) + "Todo list" <login-realm> + "Todo list" >>name + allow-registration + allow-edit-profile + allow-deactivation ; + +: todo-db ( -- db ) "resource:todo.db" <sqlite-db> ; + +: init-todo-db ( -- ) + todo-db [ + init-furnace-tables + todo ensure-table + ] with-db ; + +: <todo-secure-config> ( -- config ) + ! This is only suitable for testing! + <secure-config> + "resource:basis/openssl/test/dh1024.pem" >>dh-file + "resource:basis/openssl/test/server.pem" >>key-file + "password" >>password ; + +: <todo-app> ( -- responder ) + init-todo-db + <todo-list> + <login-config> + todo-db <alloy> ; + +: <todo-website-server> ( -- threaded-server ) + <http-server> + <todo-secure-config> >>secure-config + 8080 >>insecure + 8431 >>secure ; + +: run-todo ( -- ) + <todo-app> main-responder set-global + todo-db start-expiring + <todo-website-server> start-server ; + +MAIN: run-todo diff --git a/extra/webapps/todo/todo.xml b/extra/webapps/todo/todo.xml index f7500cdad2..00ed63560c 100644 --- a/extra/webapps/todo/todo.xml +++ b/extra/webapps/todo/todo.xml @@ -2,7 +2,14 @@ <t:chloe xmlns:t="http://factorcode.org/chloe/1.0"> +<html> + <t:style t:include="resource:extra/webapps/todo/todo.css" /> + <t:style t:include="resource:extra/websites/concatenative/page.css" /> + + <head><t:write-title/><t:write-style/></head> + + <body> <div class="navbar"> <t:a t:href="$todo-list/list">List Items</t:a> @@ -19,4 +26,8 @@ <t:call-next-template /> + </body> + +</html> + </t:chloe> From 610c43a3c3c6abf312ca15aa7aef30f187bf0549 Mon Sep 17 00:00:00 2001 From: Doug Coleman <doug.coleman@gmail.com> Date: Tue, 10 Feb 2009 20:49:10 -0600 Subject: [PATCH 2/6] remove circular using --- extra/images/backend/backend.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/images/backend/backend.factor b/extra/images/backend/backend.factor index 6d73a253ae..756b98efee 100644 --- a/extra/images/backend/backend.factor +++ b/extra/images/backend/backend.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel grouping fry sequences combinators -images.bitmap math ; +math ; IN: images.backend SINGLETONS: BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR ; From 76761c4c618ca6d48f17b9eda3379214641e2f59 Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Wed, 11 Feb 2009 04:59:29 -0600 Subject: [PATCH 3/6] Document html:simple-page --- basis/html/html-docs.factor | 6 ++++++ basis/html/html.factor | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 basis/html/html-docs.factor diff --git a/basis/html/html-docs.factor b/basis/html/html-docs.factor new file mode 100644 index 0000000000..8c4b2934d0 --- /dev/null +++ b/basis/html/html-docs.factor @@ -0,0 +1,6 @@ +IN: html +USING: help.markup help.syntax strings ; + +HELP: simple-page +{ $values { "title" string } { "head" "XML data" } { "body" "XML data" } } +{ $description "Constructs a simple XHTML page with a " { $snippet "head" } " and " { $snippet "body" } " tag. The given XML data is spliced into the two child tags, and a title is also added to the head tag." } ; \ No newline at end of file diff --git a/basis/html/html.factor b/basis/html/html.factor index e86b4917d7..e446c66d8c 100644 --- a/basis/html/html.factor +++ b/basis/html/html.factor @@ -15,7 +15,7 @@ IN: html </head> <body><-></body> </html> - XML> ; inline + XML> ; : render-error ( message -- xml ) [XML <span class="error"><-></span> XML] ; From 049753f0cc416fd85196fb2bd2cca9889ed6fff3 Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Wed, 11 Feb 2009 04:59:36 -0600 Subject: [PATCH 4/6] Tweak quotations docs --- core/quotations/quotations-docs.factor | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/quotations/quotations-docs.factor b/core/quotations/quotations-docs.factor index f2629a36c4..2a03b7c74f 100644 --- a/core/quotations/quotations-docs.factor +++ b/core/quotations/quotations-docs.factor @@ -7,6 +7,9 @@ ARTICLE: "quotations" "Quotations" $nl "Concretely, a quotation is an immutable sequence of objects, some of which may be words, together with a block of machine code which may be executed to achieve the effect of evaluating the quotation. The machine code is generated by a fast non-optimizing quotation compiler which is always running and is transparent to the developer." $nl +"Quotations form a class of objects, however in most cases, methods should dispatch on " { $link callable } " instead, so that " { $link curry } " and " { $link compose } " values can participate." +{ $subsection quotation } +{ $subsection quotation? } "Quotations evaluate sequentially from beginning to end. Literals are pushed on the stack and words are executed. Details can be found in " { $link "evaluator" } "." $nl "Quotation literal syntax is documented in " { $link "syntax-quots" } "." From ab6ec008dd42a9d86abdc71c680565ed12201efc Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Wed, 11 Feb 2009 04:59:47 -0600 Subject: [PATCH 5/6] Remove sorting.slots from images.tiff USING: list --- extra/images/tiff/tiff.factor | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extra/images/tiff/tiff.factor b/extra/images/tiff/tiff.factor index dc40f648cc..dac071b4b4 100755 --- a/extra/images/tiff/tiff.factor +++ b/extra/images/tiff/tiff.factor @@ -1,10 +1,9 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors combinators io io.encodings.binary io.files -kernel pack endian constructors sequences arrays -sorting.slots math.order math.parser prettyprint classes -io.binary assocs math math.bitwise byte-arrays grouping -images.backend ; +USING: accessors combinators io io.encodings.binary io.files kernel +pack endian constructors sequences arrays math.order math.parser +prettyprint classes io.binary assocs math math.bitwise byte-arrays +grouping images.backend ; IN: images.tiff TUPLE: tiff-image < image ; From 6ae2694f510302c46bf4d8cc2a9f3a7e6598730b Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Wed, 11 Feb 2009 05:01:04 -0600 Subject: [PATCH 6/6] Move images vocab, and constructors (which it depends on) to basis --- {extra => basis}/constructors/authors.txt | 0 {extra => basis}/constructors/constructors-tests.factor | 0 {extra => basis}/constructors/constructors.factor | 0 {extra => basis}/images/authors.txt | 0 {extra => basis}/images/backend/authors.txt | 0 {extra => basis}/images/backend/backend.factor | 0 {extra => basis}/images/bitmap/authors.txt | 0 {extra => basis}/images/bitmap/bitmap-tests.factor | 0 {extra => basis}/images/bitmap/bitmap.factor | 0 {extra => basis}/images/images.factor | 0 {extra => basis}/images/tags.txt | 0 {extra => basis}/images/tiff/authors.txt | 0 {extra => basis}/images/tiff/tiff-tests.factor | 0 {extra => basis}/images/tiff/tiff.factor | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename {extra => basis}/constructors/authors.txt (100%) rename {extra => basis}/constructors/constructors-tests.factor (100%) rename {extra => basis}/constructors/constructors.factor (100%) rename {extra => basis}/images/authors.txt (100%) rename {extra => basis}/images/backend/authors.txt (100%) rename {extra => basis}/images/backend/backend.factor (100%) rename {extra => basis}/images/bitmap/authors.txt (100%) rename {extra => basis}/images/bitmap/bitmap-tests.factor (100%) rename {extra => basis}/images/bitmap/bitmap.factor (100%) rename {extra => basis}/images/images.factor (100%) rename {extra => basis}/images/tags.txt (100%) rename {extra => basis}/images/tiff/authors.txt (100%) rename {extra => basis}/images/tiff/tiff-tests.factor (100%) rename {extra => basis}/images/tiff/tiff.factor (100%) diff --git a/extra/constructors/authors.txt b/basis/constructors/authors.txt similarity index 100% rename from extra/constructors/authors.txt rename to basis/constructors/authors.txt diff --git a/extra/constructors/constructors-tests.factor b/basis/constructors/constructors-tests.factor similarity index 100% rename from extra/constructors/constructors-tests.factor rename to basis/constructors/constructors-tests.factor diff --git a/extra/constructors/constructors.factor b/basis/constructors/constructors.factor similarity index 100% rename from extra/constructors/constructors.factor rename to basis/constructors/constructors.factor diff --git a/extra/images/authors.txt b/basis/images/authors.txt similarity index 100% rename from extra/images/authors.txt rename to basis/images/authors.txt diff --git a/extra/images/backend/authors.txt b/basis/images/backend/authors.txt similarity index 100% rename from extra/images/backend/authors.txt rename to basis/images/backend/authors.txt diff --git a/extra/images/backend/backend.factor b/basis/images/backend/backend.factor similarity index 100% rename from extra/images/backend/backend.factor rename to basis/images/backend/backend.factor diff --git a/extra/images/bitmap/authors.txt b/basis/images/bitmap/authors.txt similarity index 100% rename from extra/images/bitmap/authors.txt rename to basis/images/bitmap/authors.txt diff --git a/extra/images/bitmap/bitmap-tests.factor b/basis/images/bitmap/bitmap-tests.factor similarity index 100% rename from extra/images/bitmap/bitmap-tests.factor rename to basis/images/bitmap/bitmap-tests.factor diff --git a/extra/images/bitmap/bitmap.factor b/basis/images/bitmap/bitmap.factor similarity index 100% rename from extra/images/bitmap/bitmap.factor rename to basis/images/bitmap/bitmap.factor diff --git a/extra/images/images.factor b/basis/images/images.factor similarity index 100% rename from extra/images/images.factor rename to basis/images/images.factor diff --git a/extra/images/tags.txt b/basis/images/tags.txt similarity index 100% rename from extra/images/tags.txt rename to basis/images/tags.txt diff --git a/extra/images/tiff/authors.txt b/basis/images/tiff/authors.txt similarity index 100% rename from extra/images/tiff/authors.txt rename to basis/images/tiff/authors.txt diff --git a/extra/images/tiff/tiff-tests.factor b/basis/images/tiff/tiff-tests.factor similarity index 100% rename from extra/images/tiff/tiff-tests.factor rename to basis/images/tiff/tiff-tests.factor diff --git a/extra/images/tiff/tiff.factor b/basis/images/tiff/tiff.factor similarity index 100% rename from extra/images/tiff/tiff.factor rename to basis/images/tiff/tiff.factor