From 1682a5512ac7027f49c18ec9d536eeeba03101d4 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 12 Feb 2009 22:26:44 -0600 Subject: [PATCH 01/12] Minor docs fix and cleanup in http.server.static --- basis/http/server/static/static-docs.factor | 2 +- basis/http/server/static/static.factor | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/basis/http/server/static/static-docs.factor b/basis/http/server/static/static-docs.factor index fbe20b5fcd..bbad56a6f1 100644 --- a/basis/http/server/static/static-docs.factor +++ b/basis/http/server/static/static-docs.factor @@ -38,7 +38,7 @@ $nl "If all you want to do is serve files from a directory, the following phrase does the trick:" { $code "USING: namespaces http.server http.server.static ;" - "/var/www/mysite.com/ main-responder set" + "\"/var/www/mysite.com/\" main-responder set" "8080 httpd" } { $subsection "http.server.static.extend" } ; diff --git a/basis/http/server/static/static.factor b/basis/http/server/static/static.factor index 53d3d4f917..5d5ad7d2b8 100644 --- a/basis/http/server/static/static.factor +++ b/basis/http/server/static/static.factor @@ -45,9 +45,8 @@ TUPLE: file-responder root hook special allow-listings ; [ file-responder get hook>> call ] [ 2drop <304> ] if ; : serving-path ( filename -- filename ) - file-responder get root>> trim-tail-separators - "/" - rot "" or trim-head-separators 3append ; + [ file-responder get root>> trim-tail-separators "/" ] dip + "" or trim-head-separators 3append ; : serve-file ( filename -- response ) dup mime-type From c6680eee60a3bbd432750ab4733f039c98ab9d73 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Fri, 13 Feb 2009 15:10:34 -0600 Subject: [PATCH 02/12] Making xml-undo words private; adding bytes>xml word --- basis/xml/syntax/syntax.factor | 4 ++++ basis/xml/tests/test.factor | 12 +++++++++--- basis/xml/xml-docs.factor | 9 +++++++-- basis/xml/xml.factor | 5 ++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/basis/xml/syntax/syntax.factor b/basis/xml/syntax/syntax.factor index 8e6bebfe6b..067bb9ec11 100644 --- a/basis/xml/syntax/syntax.factor +++ b/basis/xml/syntax/syntax.factor @@ -174,6 +174,8 @@ PRIVATE> : [XML "XML]" [ string>chunk ] parse-def ; parsing +enum ] ; \ interpolate-xml 1 [ undo-xml ] define-pop-inverse + +PRIVATE> diff --git a/basis/xml/tests/test.factor b/basis/xml/tests/test.factor index b1f6cf002f..0372132736 100644 --- a/basis/xml/tests/test.factor +++ b/basis/xml/tests/test.factor @@ -3,7 +3,7 @@ IN: xml.tests USING: kernel xml tools.test io namespaces make sequences xml.errors xml.entities.html parser strings xml.data io.files -xml.traversal continuations assocs +xml.traversal continuations assocs io.encodings.binary sequences.deep accessors io.streams.string ; ! This is insufficient @@ -12,8 +12,14 @@ sequences.deep accessors io.streams.string ; \ string>xml must-infer SYMBOL: xml-file -[ ] [ "resource:basis/xml/tests/test.xml" - [ file>xml ] with-html-entities xml-file set ] unit-test +[ ] [ + "resource:basis/xml/tests/test.xml" + [ file>xml ] with-html-entities xml-file set +] unit-test +[ t ] [ + "resource:basis/xml/tests/test.xml" binary file-contents + [ bytes>xml ] with-html-entities xml-file get = +] unit-test [ "1.0" ] [ xml-file get prolog>> version>> ] unit-test [ f ] [ xml-file get prolog>> standalone>> ] unit-test [ "a" ] [ xml-file get space>> ] unit-test diff --git a/basis/xml/xml-docs.factor b/basis/xml/xml-docs.factor index 024b086ef9..77969c55cd 100644 --- a/basis/xml/xml-docs.factor +++ b/basis/xml/xml-docs.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2009 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax xml.data io strings ; +USING: help.markup help.syntax xml.data io strings byte-arrays ; IN: xml HELP: string>xml @@ -16,7 +16,11 @@ HELP: file>xml { $values { "filename" string } { "xml" xml } } { $description "Opens the given file, reads it in as XML, closes the file and returns the corresponding XML tree. The encoding is automatically detected." } ; -{ string>xml read-xml file>xml } related-words +HELP: bytes>xml +{ $values { "byte-array" byte-array } { "xml" xml } } +{ $description "Parses a byte array as an XML document. The encoding is automatically detected." } ; + +{ string>xml read-xml file>xml bytes>xml } related-words HELP: read-xml-chunk { $values { "stream" "an input stream" } { "seq" "a sequence of elements" } } @@ -68,6 +72,7 @@ ARTICLE: { "xml" "reading" } "Reading XML" { $subsection read-xml-chunk } { $subsection string>xml-chunk } { $subsection file>xml } + { $subsection bytes>xml } "To read a DTD:" { $subsection read-dtd } { $subsection file>dtd } diff --git a/basis/xml/xml.factor b/basis/xml/xml.factor index 57c1b6dbd3..073f46cbae 100755 --- a/basis/xml/xml.factor +++ b/basis/xml/xml.factor @@ -4,7 +4,7 @@ USING: accessors arrays io io.encodings.binary io.files io.streams.string kernel namespaces sequences strings io.encodings.utf8 xml.data xml.errors xml.elements ascii xml.entities xml.writer xml.state xml.autoencoding assocs xml.tokenize -combinators.short-circuit xml.name splitting ; +combinators.short-circuit xml.name splitting io.streams.byte-array ; IN: xml : file>xml ( filename -- xml ) binary read-xml ; +: bytes>xml ( byte-array -- xml ) + binary read-xml ; + : read-dtd ( stream -- dtd ) [ H{ } clone extra-entities set From 0ce47f84c607b594da2c4854cfc3db3c9a1457f5 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 13 Feb 2009 15:14:09 -0600 Subject: [PATCH 03/12] use decode instead of >string in images.tiff --- basis/images/tiff/tiff.factor | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/basis/images/tiff/tiff.factor b/basis/images/tiff/tiff.factor index 674188992a..f57f15ae20 100755 --- a/basis/images/tiff/tiff.factor +++ b/basis/images/tiff/tiff.factor @@ -1,9 +1,11 @@ ! 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 math.order math.parser -prettyprint classes io.binary assocs math math.bitwise byte-arrays -grouping images compression.lzw fry strings ; +USING: accessors arrays assocs byte-arrays classes combinators +compression.lzw constructors endian fry grouping images io +io.binary io.encodings.ascii io.encodings.binary +io.encodings.string io.encodings.utf8 io.files kernel math +math.bitwise math.order math.parser pack prettyprint sequences +strings ; IN: images.tiff TUPLE: tiff-image < image ; @@ -249,13 +251,13 @@ ERROR: bad-small-ifd-type n ; { 283 [ first y-resolution ] } { 284 [ planar-configuration ] } { 296 [ lookup-resolution-unit resolution-unit ] } - { 305 [ >string software ] } - { 306 [ >string date-time ] } + { 305 [ ascii decode software ] } + { 306 [ ascii decode date-time ] } { 317 [ lookup-predictor predictor ] } { 330 [ sub-ifd ] } { 338 [ lookup-extra-samples extra-samples ] } { 339 [ lookup-sample-format sample-format ] } - { 700 [ >string xmp ] } + { 700 [ utf8 decode xmp ] } { 34377 [ photoshop ] } { 34665 [ exif-ifd ] } { 33723 [ iptc ] } From 813b0cb803e79eab45b58cb41c89510257290432 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 13 Feb 2009 15:46:36 -0600 Subject: [PATCH 04/12] get the byte ordering correct for tiffs --- basis/images/bitmap/bitmap.factor | 4 ++-- basis/images/images.factor | 2 +- basis/images/tiff/tiff.factor | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/basis/images/bitmap/bitmap.factor b/basis/images/bitmap/bitmap.factor index c9bb15192b..6713a729b5 100755 --- a/basis/images/bitmap/bitmap.factor +++ b/basis/images/bitmap/bitmap.factor @@ -3,7 +3,7 @@ USING: accessors alien alien.c-types arrays byte-arrays columns combinators fry grouping io io.binary io.encodings.binary io.files kernel macros math math.bitwise math.functions namespaces sequences -strings images endian summary ; +strings images endian summary annotations ; IN: images.bitmap TUPLE: bitmap-image < image ; @@ -105,7 +105,7 @@ ERROR: unknown-component-order bitmap ; { [ [ width>> ] [ height>> ] bi 2array ] [ bitmap>component-order ] - [ drop little-endian ] ! XXX + [ drop little-endian ] !XXX [ buffer>> ] } cleave bitmap-image boa ; diff --git a/basis/images/images.factor b/basis/images/images.factor index e366dd2700..11452aa7d2 100644 --- a/basis/images/images.factor +++ b/basis/images/images.factor @@ -7,7 +7,7 @@ IN: images SINGLETONS: BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR R16G16B16 R32G32B32 ; -TUPLE: image dim component-order byte-order bitmap ; +TUPLE: image dim component-order bitmap ; : ( -- image ) image new ; inline diff --git a/basis/images/tiff/tiff.factor b/basis/images/tiff/tiff.factor index 674188992a..8e981a8163 100755 --- a/basis/images/tiff/tiff.factor +++ b/basis/images/tiff/tiff.factor @@ -286,6 +286,18 @@ ERROR: unhandled-compression compression ; ERROR: unknown-component-order ifd ; +: fix-bitmap-endianness ( ifd -- ifd ) + dup [ bitmap>> ] [ bits-per-sample find-tag ] bi + { + { { 32 32 32 32 } [ 4 seq>native-endianness ] } + { { 32 32 32 } [ 4 seq>native-endianness ] } + { { 16 16 16 16 } [ 2 seq>native-endianness ] } + { { 16 16 16 } [ 2 seq>native-endianness ] } + { { 8 8 8 8 } [ ] } + { { 8 8 8 } [ ] } + [ unknown-component-order ] + } case >>bitmap ; + : ifd-component-order ( ifd -- byte-order ) bits-per-sample find-tag { { { 32 32 32 } [ R32G32B32 ] } @@ -299,7 +311,6 @@ ERROR: unknown-component-order ifd ; { [ [ image-width find-tag ] [ image-length find-tag ] bi 2array ] [ ifd-component-order ] - [ drop big-endian ] ! XXX [ bitmap>> ] } cleave tiff-image boa ; @@ -314,7 +325,9 @@ ERROR: unknown-component-order ifd ; dup ifds>> [ process-ifd read-strips uncompress-strips - strips>bitmap drop + strips>bitmap + fix-bitmap-endianness + drop ] each ] with-endianness ] with-file-reader ; From d7e10c3072c2795614656364b62abfb219b8ef8d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 13 Feb 2009 15:47:07 -0600 Subject: [PATCH 05/12] remove XXX from bitmaps --- basis/images/bitmap/bitmap.factor | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/basis/images/bitmap/bitmap.factor b/basis/images/bitmap/bitmap.factor index 6713a729b5..9005776e40 100755 --- a/basis/images/bitmap/bitmap.factor +++ b/basis/images/bitmap/bitmap.factor @@ -3,7 +3,7 @@ USING: accessors alien alien.c-types arrays byte-arrays columns combinators fry grouping io io.binary io.encodings.binary io.files kernel macros math math.bitwise math.functions namespaces sequences -strings images endian summary annotations ; +strings images endian summary ; IN: images.bitmap TUPLE: bitmap-image < image ; @@ -105,7 +105,6 @@ ERROR: unknown-component-order bitmap ; { [ [ width>> ] [ height>> ] bi 2array ] [ bitmap>component-order ] - [ drop little-endian ] !XXX [ buffer>> ] } cleave bitmap-image boa ; From 03839aa3ccceb69355885eb59583f5afa4a16f64 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 13 Feb 2009 15:47:48 -0600 Subject: [PATCH 06/12] str -> bytes, utility word in endian --- basis/endian/endian.factor | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/basis/endian/endian.factor b/basis/endian/endian.factor index a832d6c0a2..a453a71704 100755 --- a/basis/endian/endian.factor +++ b/basis/endian/endian.factor @@ -1,39 +1,39 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: alien.c-types namespaces io.binary fry -kernel math ; +kernel math grouping sequences ; IN: endian SINGLETONS: big-endian little-endian ; -: native-endianness ( -- class ) +: compute-native-endianness ( -- class ) 1 *char 0 = big-endian little-endian ? ; : >signed ( x n -- y ) 2dup neg 1+ shift 1 = [ 2^ - ] [ drop ] if ; -native-endianness \ native-endianness set-global +SYMBOL: native-endianness +native-endianness [ compute-native-endianness ] initialize SYMBOL: endianness +endianness [ native-endianness get-global ] initialize -\ native-endianness get-global endianness set-global - -HOOK: >native-endian native-endianness ( obj n -- str ) +HOOK: >native-endian native-endianness ( obj n -- bytes ) M: big-endian >native-endian >be ; M: little-endian >native-endian >le ; -HOOK: unsigned-native-endian> native-endianness ( obj -- str ) +HOOK: unsigned-native-endian> native-endianness ( obj -- bytes ) M: big-endian unsigned-native-endian> be> ; M: little-endian unsigned-native-endian> le> ; -: signed-native-endian> ( obj n -- str ) +: signed-native-endian> ( obj n -- n' ) [ unsigned-native-endian> ] dip >signed ; -HOOK: >endian endianness ( obj n -- str ) +HOOK: >endian endianness ( obj n -- bytes ) M: big-endian >endian >be ; @@ -45,13 +45,13 @@ M: big-endian endian> be> ; M: little-endian endian> le> ; -HOOK: unsigned-endian> endianness ( obj -- str ) +HOOK: unsigned-endian> endianness ( obj -- bytes ) M: big-endian unsigned-endian> be> ; M: little-endian unsigned-endian> le> ; -: signed-endian> ( obj n -- str ) +: signed-endian> ( obj n -- bytes ) [ unsigned-endian> ] dip >signed ; : with-endianness ( endian quot -- ) @@ -65,3 +65,15 @@ M: little-endian unsigned-endian> le> ; : with-native-endian ( quot -- ) \ native-endianness get-global swap with-endianness ; inline + +: seq>native-endianness ( seq n -- seq' ) + native-endianness get-global dup endianness get = [ + 2drop + ] [ + [ [ ] keep ] dip + little-endian = [ + '[ be> _ >le ] map + ] [ + '[ le> _ >be ] map + ] if concat + ] if ; inline From 8223f4277514255eaf0a5f5d71ed8bfbce9904ed Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 13 Feb 2009 15:52:17 -0600 Subject: [PATCH 07/12] decode uname strings as utf8 --- extra/system-info/linux/linux.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/system-info/linux/linux.factor b/extra/system-info/linux/linux.factor index 00a49fb2a2..b77e1fe649 100644 --- a/extra/system-info/linux/linux.factor +++ b/extra/system-info/linux/linux.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: unix alien alien.c-types kernel math sequences strings -io.backend.unix splitting ; +io.backend.unix splitting io.encodings.utf8 io.encodings.string ; IN: system-info.linux : (uname) ( buf -- int ) @@ -9,7 +9,7 @@ IN: system-info.linux : uname ( -- seq ) 65536 "char" [ (uname) io-error ] keep - "\0" split harvest [ >string ] map + "\0" split harvest [ utf8 decode ] map 6 "" pad-tail ; : sysname ( -- string ) uname first ; From 3cf4c6fee20e5a36088a16a155e2f648e6d092ff Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 13 Feb 2009 15:56:22 -0600 Subject: [PATCH 08/12] support 48bpp tiffs --- basis/images/images.factor | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/basis/images/images.factor b/basis/images/images.factor index 11452aa7d2..32fbc54978 100644 --- a/basis/images/images.factor +++ b/basis/images/images.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: kernel accessors grouping sequences combinators -math specialized-arrays.direct.uint byte-arrays ; +math specialized-arrays.direct.uint byte-arrays +specialized-arrays.direct.ushort ; IN: images SINGLETONS: BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR @@ -28,6 +29,13 @@ GENERIC: load-image* ( path tuple -- image ) >byte-array add-dummy-alpha ] change-bitmap ] } + { R16G16B16 [ + [ + dup length 2 / + [ -8 shift ] map + >byte-array add-dummy-alpha + ] change-bitmap + ] } { BGRA [ [ 4 dup [ [ 0 3 ] dip reverse-here ] each From 8253bf4662a141ea0b54af9dab66f667c032369c Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Fri, 13 Feb 2009 16:05:18 -0600 Subject: [PATCH 09/12] Another failing test in db.sqlite --- basis/db/sqlite/sqlite-tests.factor | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/basis/db/sqlite/sqlite-tests.factor b/basis/db/sqlite/sqlite-tests.factor index e05d992014..529de9774b 100644 --- a/basis/db/sqlite/sqlite-tests.factor +++ b/basis/db/sqlite/sqlite-tests.factor @@ -127,3 +127,39 @@ hi "HELLO" { hi drop-table ] with-db ] unit-test + +TUPLE: show id ; +TUPLE: user username data ; +TUPLE: watch show user ; + +user "USER" { + { "username" "USERNAME" TEXT +not-null+ +user-assigned-id+ } + { "data" "DATA" TEXT } +} define-persistent + +show "SHOW" { + { "id" "ID" +db-assigned-id+ } +} define-persistent + +watch "WATCH" { + { "user" "USER" TEXT +not-null+ + { +foreign-id+ user "USERNAME" } +user-assigned-id+ } + { "show" "SHOW" BIG-INTEGER +not-null+ + { +foreign-id+ show "ID" } +user-assigned-id+ } +} define-persistent + +[ T{ user { username "littledan" } { data "foo" } } ] [ + test.db [ + user create-table + show create-table + watch create-table + "littledan" "foo" user boa insert-tuple + "mark" "bar" user boa insert-tuple + show new insert-tuple + show new select-tuple + "littledan" f user boa select-tuple + watch boa insert-tuple + watch new select-tuple + user>> f user boa select-tuple + ] with-db +] unit-test From f3db8fdc4a4a88502c2d2527da9d491eb2670e07 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Fri, 13 Feb 2009 16:07:17 -0600 Subject: [PATCH 10/12] Another failing unit test for db.sqlite --- basis/db/sqlite/sqlite-tests.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basis/db/sqlite/sqlite-tests.factor b/basis/db/sqlite/sqlite-tests.factor index 529de9774b..5ad4b0c889 100644 --- a/basis/db/sqlite/sqlite-tests.factor +++ b/basis/db/sqlite/sqlite-tests.factor @@ -163,3 +163,5 @@ watch "WATCH" { user>> f user boa select-tuple ] with-db ] unit-test + +[ \ swap ensure-table ] must-fail From 3c00e7270604518fe27f4b998061b521c6edfe37 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 13 Feb 2009 18:06:55 -0600 Subject: [PATCH 11/12] Clean up extra/twitter a little bit --- extra/twitter/twitter.factor | 73 +++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/extra/twitter/twitter.factor b/extra/twitter/twitter.factor index 2172d7cf81..d70828b310 100644 --- a/extra/twitter/twitter.factor +++ b/extra/twitter/twitter.factor @@ -1,12 +1,41 @@ +! Copyright (C) 2009 Joe Groff. +! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs combinators hashtables http http.client json.reader kernel macros namespaces sequences -urls.secure urls.encoding ; +urls.secure fry ; IN: twitter +! Configuration SYMBOLS: twitter-username twitter-password twitter-source ; twitter-source [ "factor" ] initialize +: set-twitter-credentials ( username password -- ) + [ twitter-username set ] [ twitter-password set ] bi* ; + + + +! Data types + TUPLE: twitter-status created-at id @@ -28,8 +57,7 @@ TUPLE: twitter-user protected? followers-count ; -MACRO: keys-boa ( keys class -- ) - [ [ \ swap \ at [ ] 3sequence ] map \ cleave ] dip \ boa [ ] 4sequence ; + ( assoc -- user ) { @@ -64,37 +92,40 @@ MACRO: keys-boa ( keys class -- ) : json>twitter-status ( json-object -- tweet ) json> ; -: set-twitter-credentials ( username password -- ) - [ twitter-username set ] [ twitter-password set ] bi* ; +PRIVATE> -: set-request-twitter-auth ( request -- request ) - twitter-username twitter-password [ get ] bi@ set-basic-auth ; +! Updates + - set-request-twitter-auth - http-request nip ; + update-post-data "update" [ ] twitter-request ; + +PRIVATE> : tweet* ( string -- tweet ) (tweet) json>twitter-status ; : tweet ( string -- ) (tweet) drop ; +! Timelines + ] twitter-request json>twitter-statuses ; + +PRIVATE> + : public-timeline ( -- tweets ) - "https://twitter.com/statuses/public_timeline.json" - set-request-twitter-auth - http-request nip json>twitter-statuses ; + "public_timeline" timeline ; : friends-timeline ( -- tweets ) - "https://twitter.com/statuses/friends_timeline.json" - set-request-twitter-auth - http-request nip json>twitter-statuses ; + "friends_timeline" timeline ; : user-timeline ( username -- tweets ) - "https://twitter.com/statuses/user_timeline/" ".json" surround - set-request-twitter-auth - http-request nip json>twitter-statuses ; + "user_timeline/" prepend timeline ; From 83834f802ae3fcf277c53746d2b4c487cd7dc21f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 13 Feb 2009 20:20:22 -0600 Subject: [PATCH 12/12] Fixing twitter --- extra/twitter/twitter.factor | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/extra/twitter/twitter.factor b/extra/twitter/twitter.factor index d70828b310..48388de382 100644 --- a/extra/twitter/twitter.factor +++ b/extra/twitter/twitter.factor @@ -27,8 +27,7 @@ MACRO: keys-boa ( keys class -- ) : set-request-twitter-auth ( request -- request ) twitter-username get twitter-password get set-basic-auth ; -: twitter-request ( string quot -- data ) - [ twitter-url ] dip call +: twitter-request ( request -- data ) set-request-twitter-auth http-request nip ; inline @@ -101,10 +100,11 @@ PRIVATE> [ "status" set twitter-source get "source" set - ] make-assoc ; + ] H{ } make-assoc ; : (tweet) ( string -- json ) - update-post-data "update" [ ] twitter-request ; + update-post-data "update" twitter-url + twitter-request ; PRIVATE> @@ -117,7 +117,8 @@ PRIVATE> ] twitter-request json>twitter-statuses ; + twitter-url + twitter-request json>twitter-statuses ; PRIVATE>