diff --git a/basis/calendar/calendar-docs.factor b/basis/calendar/calendar-docs.factor index 62ff4ad517..c3d84fc783 100644 --- a/basis/calendar/calendar-docs.factor +++ b/basis/calendar/calendar-docs.factor @@ -21,8 +21,8 @@ HELP: { $description "Returns a timestamp object representing the start of the specified day in your current timezone." } { $examples { $example "USING: calendar prettyprint ;" - "2010 12 25 ." - "T{ timestamp\n { year 2010 }\n { month 12 }\n { day 25 }\n { gmt-offset T{ duration { hour -5 } } }\n}" + "2010 12 25 >gmt midnight ." + "T{ timestamp { year 2010 } { month 12 } { day 25 } }" } } ; diff --git a/basis/html/templates/chloe/chloe-tests.factor b/basis/html/templates/chloe/chloe-tests.factor index 9eb4a5709c..3fd0d00712 100644 --- a/basis/html/templates/chloe/chloe-tests.factor +++ b/basis/html/templates/chloe/chloe-tests.factor @@ -4,8 +4,6 @@ namespaces xml html.components html.forms splitting unicode.categories furnace accessors ; IN: html.templates.chloe.tests -reset-templates - : run-template with-string-writer [ "\r\n\t" member? not ] filter "?>" split1 nip ; inline diff --git a/basis/html/templates/chloe/chloe.factor b/basis/html/templates/chloe/chloe.factor index 5fe53fc7a5..cc51bd05d3 100644 --- a/basis/html/templates/chloe/chloe.factor +++ b/basis/html/templates/chloe/chloe.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel sequences combinators kernel fry -namespaces make classes.tuple assocs splitting words arrays -memoize io io.files io.encodings.utf8 io.streams.string -unicode.case mirrors math urls present multiline quotations xml +namespaces make classes.tuple assocs splitting words arrays io +io.files io.encodings.utf8 io.streams.string unicode.case +mirrors math urls present multiline quotations xml logging xml.data html.forms html.elements @@ -89,21 +89,40 @@ CHLOE-TUPLE: choice CHLOE-TUPLE: checkbox CHLOE-TUPLE: code -: read-template ( chloe -- xml ) - path>> ".xml" append utf8 read-xml ; +SYMBOL: template-cache -MEMO: template-quot ( chloe -- quot ) - read-template compile-template ; +H{ } template-cache set-global -MEMO: nested-template-quot ( chloe -- quot ) - read-template compile-nested-template ; +TUPLE: cached-template path last-modified quot ; -: reset-templates ( -- ) - { template-quot nested-template-quot } [ reset-memoized ] each ; +: load-template ( chloe -- cached-template ) + path>> ".xml" append + [ ] + [ file-info modified>> ] + [ utf8 read-xml compile-template ] tri + \ cached-template boa ; + +\ load-template DEBUG add-input-logging + +: cached-template ( chloe -- cached-template/f ) + template-cache get at* [ + [ + [ path>> file-info modified>> ] + [ last-modified>> ] + bi = + ] keep and + ] when ; + +: template-quot ( chloe -- quot ) + dup cached-template [ ] [ + [ load-template dup ] keep + template-cache get set-at + ] ?if quot>> ; + +: reset-cache ( -- ) + template-cache get clear-assoc ; M: chloe call-template* - nested-template? get - [ nested-template-quot ] [ template-quot ] if - assert-depth ; + template-quot assert-depth ; INSTANCE: chloe template diff --git a/basis/html/templates/chloe/compiler/compiler.factor b/basis/html/templates/chloe/compiler/compiler.factor index f32923f620..aa741ebf9f 100644 --- a/basis/html/templates/chloe/compiler/compiler.factor +++ b/basis/html/templates/chloe/compiler/compiler.factor @@ -3,7 +3,7 @@ USING: assocs namespaces make kernel sequences accessors combinators strings splitting io io.streams.string present xml.writer xml.data xml.entities html.forms -html.templates.chloe.syntax ; +html.templates html.templates.chloe.syntax ; IN: html.templates.chloe.compiler : chloe-attrs-only ( assoc -- assoc' ) @@ -98,9 +98,6 @@ DEFER: compile-element reset-buffer ] [ ] make ; inline -: compile-nested-template ( xml -- quot ) - [ compile-element ] with-compiler ; - : compile-chunk ( seq -- ) [ compile-element ] each ; @@ -121,12 +118,25 @@ DEFER: compile-element : compile-with-scope ( quot -- ) compile-quot [ with-scope ] [code] ; inline +: if-not-nested ( quot -- ) + nested-template? get swap unless ; inline + +: compile-prologue ( xml -- ) + [ + [ before>> compile-chunk ] + [ prolog>> [ write-prolog ] [code-with] ] + bi + ] compile-quot + [ if-not-nested ] [code] ; + +: compile-epilogue ( xml -- ) + [ after>> compile-chunk ] compile-quot + [ if-not-nested ] [code] ; + : compile-template ( xml -- quot ) [ - { - [ prolog>> [ write-prolog ] [code-with] ] - [ before>> compile-chunk ] - [ compile-element ] - [ after>> compile-chunk ] - } cleave + [ compile-prologue ] + [ compile-element ] + [ compile-epilogue ] + tri ] with-compiler ; diff --git a/build-support/factor.sh b/build-support/factor.sh index 2d4547a121..5cbc1e96e3 100755 --- a/build-support/factor.sh +++ b/build-support/factor.sh @@ -216,9 +216,8 @@ intel_macosx_word_size() { $ECHO -n "Testing if your Intel Mac supports 64bit binaries..." sysctl machdep.cpu.extfeatures | grep EM64T >/dev/null if [[ $? -eq 0 ]] ; then - WORD=32 + WORD=64 $ECHO "yes!" - $ECHO "Defaulting to 32bit for now though..." else WORD=32 $ECHO "no." diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor index cee2314d07..aad87ca995 100755 --- a/core/math/parser/parser-tests.factor +++ b/core/math/parser/parser-tests.factor @@ -41,8 +41,8 @@ unit-test [ "-1.0e-2" string>number number>string ] unit-test -[ "-1.0e-12" ] -[ "-1.0e-12" string>number number>string ] +[ t ] +[ "-1.0e-12" string>number number>string { "-1.0e-12" "-1.0e-012" } member? ] unit-test [ f ] diff --git a/extra/websites/concatenative/concatenative.factor b/extra/websites/concatenative/concatenative.factor index a35358ae6b..dfb7ff400f 100644 --- a/extra/websites/concatenative/concatenative.factor +++ b/extra/websites/concatenative/concatenative.factor @@ -69,7 +69,6 @@ SYMBOL: key-file SYMBOL: dh-file : common-configuration ( -- ) - reset-templates "concatenative.org" 25 smtp-server set-global "noreply@concatenative.org" lost-password-from set-global "website@concatenative.org" insomniac-sender set-global