From 99a3b3c9f61a13ad3b514b883836a5f8b53063d2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 12 Apr 2010 18:17:21 -0700 Subject: [PATCH 1/2] furnace: documentation improvements --- basis/furnace/actions/actions-docs.factor | 2 +- basis/html/components/components-docs.factor | 2 +- basis/html/components/components.factor | 9 ++++++++- basis/html/templates/chloe/chloe-docs.factor | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/basis/furnace/actions/actions-docs.factor b/basis/furnace/actions/actions-docs.factor index a49d6d54b3..862bdead72 100644 --- a/basis/furnace/actions/actions-docs.factor +++ b/basis/furnace/actions/actions-docs.factor @@ -31,7 +31,7 @@ HELP: new-action { $description "Constructs a subclass of " { $link action } "." } ; HELP: page-action -{ $class-description "The class of Chloe page actions. These are actions whose " { $slot "display" } " slot is pre-set to serve the Chloe template stored in the " { $slot "page" } " slot." } ; +{ $class-description "The class of Chloe page actions. These are actions whose " { $slot "display" } " slot is pre-set to serve the Chloe template stored in the " { $slot "template" } " slot. The " { $slot "template" } " slot contains a pair with shape " { $snippet "{ responder name }" } "." } ; HELP: validate-integer-id { $description "A utility word which validates an integer parameter named " { $snippet "id" } "." } diff --git a/basis/html/components/components-docs.factor b/basis/html/components/components-docs.factor index c35237b403..3b4f1d6ae3 100644 --- a/basis/html/components/components-docs.factor +++ b/basis/html/components/components-docs.factor @@ -29,7 +29,7 @@ HELP: textarea { $class-description "Text area components display a multi-line editor for a string value. The " { $slot "rows" } " and " { $slot "cols" } " properties determine the size of the text area." } ; HELP: link -{ $description "Link components render a link to an object stored at a value, with the link title and URL determined by the " { $link link-title } " and " { $link link-href } " generic words. The optional " { $slot "target" } " slot is a target frame to open the link in." } ; +{ $description "Link components render a value responding to the " { $link link-title } " and " { $link link-href } " generic words. The optional " { $slot "target" } " slot is a target frame to open the link in." } ; HELP: link-title { $values { "obj" object } { "string" string } } diff --git a/basis/html/components/components.factor b/basis/html/components/components.factor index 9dddb85619..5a2a55bfd0 100644 --- a/basis/html/components/components.factor +++ b/basis/html/components/components.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008, 2009 Slava Pestov, Daniel Ehrenberg +! Copyright (C) 2008, 2010 Slava Pestov, Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel namespaces io math.parser assocs classes classes.tuple words arrays sequences splitting mirrors @@ -117,6 +117,13 @@ M: string link-href ; M: url link-title ; M: url link-href ; +TUPLE: simple-link title href ; + +C: simple-link + +M: simple-link link-title title>> ; +M: simple-link link-href href>> ; + TUPLE: link target ; M: link render* diff --git a/basis/html/templates/chloe/chloe-docs.factor b/basis/html/templates/chloe/chloe-docs.factor index 41653cb85a..a3032aba96 100644 --- a/basis/html/templates/chloe/chloe-docs.factor +++ b/basis/html/templates/chloe/chloe-docs.factor @@ -60,7 +60,7 @@ HELP: compile-with-scope { $description "Calls the quotation and wraps any output it compiles in a " { $link with-scope } " form." } ; ARTICLE: "html.templates.chloe.tags.component" "Component Chloe tags" -"The following Chloe tags correspond exactly to " { $link "html.components" } ". Singleton component tags do not allow any attributes. Attributes of tuple component tags are mapped to tuple slot values of the component instance." +"The following Chloe tags correspond exactly to " { $link "html.components" } ". The " { $snippet "name" } " attribute should be the name of a form value (see " { $link "html.forms.values" } "). Singleton component tags do not allow any other attributes. Tuple component tags map all other attributes to tuple slot values of the component instance." { $table { "Tag" "Component class" } { { $snippet "t:checkbox" } { $link checkbox } } From 3c11991843ef547fb2044bd38fa5b4950277db1b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 12 Apr 2010 18:29:47 -0700 Subject: [PATCH 2/2] classes.struct, specialized-arrays: fix unit tests to work when forget-tests? is on --- basis/classes/struct/struct-tests.factor | 12 +++++-- .../specialized-arrays-tests.factor | 34 ++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/basis/classes/struct/struct-tests.factor b/basis/classes/struct/struct-tests.factor index dafd31efde..13088e1469 100644 --- a/basis/classes/struct/struct-tests.factor +++ b/basis/classes/struct/struct-tests.factor @@ -4,9 +4,11 @@ assocs byte-arrays classes.struct classes.tuple.parser classes.tuple.private classes.tuple combinators compiler.tree.debugger compiler.units destructors io.encodings.utf8 io.pathnames io.streams.string kernel libc literals math mirrors namespaces -prettyprint prettyprint.config see sequences specialized-arrays system -tools.test parser lexer eval layouts generic.single classes ; +prettyprint prettyprint.config see sequences specialized-arrays +system tools.test parser lexer eval layouts generic.single classes +vocabs ; FROM: math => float ; +FROM: specialized-arrays.private => specialized-array-vocab ; QUALIFIED-WITH: alien.c-types c SPECIALIZED-ARRAY: char SPECIALIZED-ARRAY: int @@ -303,6 +305,12 @@ SPECIALIZED-ARRAY: struct-test-optimization { x>> } inlined? ] unit-test +[ ] [ + [ + struct-test-optimization specialized-array-vocab forget-vocab + ] with-compilation-unit +] unit-test + ! Test cloning structs STRUCT: clone-test-struct { x int } { y char[3] } ; diff --git a/basis/specialized-arrays/specialized-arrays-tests.factor b/basis/specialized-arrays/specialized-arrays-tests.factor index 645606edc5..2dee88df88 100644 --- a/basis/specialized-arrays/specialized-arrays-tests.factor +++ b/basis/specialized-arrays/specialized-arrays-tests.factor @@ -1,13 +1,13 @@ -IN: specialized-arrays.tests -USING: tools.test alien.syntax specialized-arrays -specialized-arrays.private sequences alien accessors -kernel arrays combinators compiler compiler.units classes.struct -combinators.smart compiler.tree.debugger math libc destructors -sequences.private multiline eval words vocabs namespaces -assocs prettyprint alien.data math.vectors definitions -compiler.test ; +USING: tools.test alien.syntax specialized-arrays sequences +alien accessors kernel arrays combinators compiler +compiler.units classes.struct combinators.smart +compiler.tree.debugger math libc destructors sequences.private +multiline eval words vocabs namespaces assocs prettyprint +alien.data math.vectors definitions compiler.test ; +FROM: specialized-arrays.private => specialized-array-vocab ; FROM: alien.c-types => int float bool char float ulonglong ushort uint heap-size little-endian? ; +IN: specialized-arrays.tests SPECIALIZED-ARRAY: int SPECIALIZED-ARRAYS: bool ushort char uint float ulonglong ; @@ -101,6 +101,12 @@ SPECIALIZED-ARRAY: test-struct } second ] unit-test +[ ] [ + [ + test-struct specialized-array-vocab forget-vocab + ] with-compilation-unit +] unit-test + ! Regression STRUCT: fixed-string { text char[64] } ; @@ -115,6 +121,12 @@ SPECIALIZED-ARRAY: fixed-string ALIEN: 123 100 byte-length ] unit-test +[ ] [ + [ + fixed-string specialized-array-vocab forget-vocab + ] with-compilation-unit +] unit-test + ! Test prettyprinting [ "int-array{ 1 2 3 }" ] [ int-array{ 1 2 3 } unparse ] unit-test [ "int-array@ f 100" ] [ f 100 unparse ] unit-test @@ -172,3 +184,9 @@ SPECIALIZED-ARRAY: struct-resize-test [ 80 ] [ 10 byte-length ] unit-test [ { 10 20 30 } ] [ { 10 20 30 } struct-resize-test-usage ] unit-test + +[ ] [ + [ + struct-resize-test specialized-array-vocab forget-vocab + ] with-compilation-unit +] unit-test