From 90d8b67ff0eb6d5f2ba48326cc5399b78d13f7d5 Mon Sep 17 00:00:00 2001 From: erg Date: Thu, 5 Oct 2006 17:39:13 +0000 Subject: [PATCH] fix stack effects/formatting in contrib files --- contrib/embedded.factor | 12 ++++++------ contrib/httpd/callback-responder.factor | 2 +- contrib/httpd/html-tags.factor | 2 +- contrib/httpd/responder.factor | 5 +---- contrib/vim/vim.factor | 4 ++-- contrib/xml.factor | 6 ++++-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/contrib/embedded.factor b/contrib/embedded.factor index 0ecb0e1ff1..364aed89bd 100644 --- a/contrib/embedded.factor +++ b/contrib/embedded.factor @@ -25,25 +25,25 @@ USING: sequences kernel parser math namespaces io ; : get-text ( string -- remainder chunk ) "<%" over start dup -1 = [ - drop "" swap + drop "" swap ] [ - 2dup head >r tail r> + 2dup head >r tail r> ] if ; -: get-embedded ( "<%code%>blah" -- "blah" "code" ) +: get-embedded ( string -- string code-string ) ! regexps where art thou? "%>" over 2 start* 2dup swap 2 -rot subseq >r 2 + tail r> ; : get-first-chunk ( string -- string ) dup "<%" head? [ - get-embedded parse % + get-embedded parse % ] [ - get-text , \ write , + get-text , \ write , ] if ; : embedded>factor ( string -- ) dup length 0 > [ - get-first-chunk embedded>factor + get-first-chunk embedded>factor ] [ drop ] if ; : parse-embedded ( string -- quot ) diff --git a/contrib/httpd/callback-responder.factor b/contrib/httpd/callback-responder.factor index 550384c2b8..09995dc39b 100644 --- a/contrib/httpd/callback-responder.factor +++ b/contrib/httpd/callback-responder.factor @@ -71,7 +71,7 @@ reset-callback-table #! Tuple for holding data related to a callback. TUPLE: item quot expire? request id time-added ; -C: item ( quot data data-quot expire? id -- item ) +C: item ( quot expire? request id -- item ) millis over set-item-time-added [ set-item-id ] keep [ set-item-request ] keep diff --git a/contrib/httpd/html-tags.factor b/contrib/httpd/html-tags.factor index 3b1bb6cb36..12add53fae 100644 --- a/contrib/httpd/html-tags.factor +++ b/contrib/httpd/html-tags.factor @@ -55,7 +55,7 @@ SYMBOL: html : write-html H{ { html t } } format ; -: html-word ( name def -- ) +: html-word ( name def -- word ) #! Define 'word creating' word to allow #! dynamically creating words. >r "html" create dup r> define-compound ; diff --git a/contrib/httpd/responder.factor b/contrib/httpd/responder.factor index 5405acb6fc..6756b5739c 100644 --- a/contrib/httpd/responder.factor +++ b/contrib/httpd/responder.factor @@ -104,20 +104,17 @@ SYMBOL: responders ] make-hash add-responder ; : make-responder ( quot -- responder ) + #! quot has stack effect ( url -- ) [ - ( url -- ) [ drop "GET method not implemented" httpd-error ] "get" set - ( url -- ) [ drop "POST method not implemented" httpd-error ] "post" set - ( url -- ) [ drop "HEAD method not implemented" httpd-error ] "head" set - ( url -- ) [ drop bad-request ] "bad" set diff --git a/contrib/vim/vim.factor b/contrib/vim/vim.factor index e0cfcf6a3f..ccf1ea0a55 100644 --- a/contrib/vim/vim.factor +++ b/contrib/vim/vim.factor @@ -1,6 +1,6 @@ IN: vim -USING: definitions embedded io kernel parser prettyprint process -sequences namespaces ; +USING: definitions embedded io kernel namespaces parser prettyprint process +sequences ; : vim-location ( file line -- ) >r [ file-modified ] keep r> diff --git a/contrib/xml.factor b/contrib/xml.factor index a30dcb79a8..bf62c4f899 100644 --- a/contrib/xml.factor +++ b/contrib/xml.factor @@ -67,7 +67,8 @@ M: xml-string-error error. char "\n\r" member? [ 0 column set line ] [ column ] if inc ; -: skip-until ( quot -- | quot: char -- ? ) +: skip-until ( quot -- ) + #! quot: ( char -- ? ) more? [ char swap [ call ] keep swap [ drop ] [ incr-spot skip-until @@ -152,7 +153,8 @@ M: xml-string-error error. ! -- Parsing tags -: in-range-seq? ( number { { min max } ... } -- ? ) +: in-range-seq? ( number seq -- ? ) + #! seq: { { min max } { min max }* } [ first2 between? ] contains-with? ; : name-start-char? ( ch -- ? )