From e92980b9ad3262a4f105dc9eb9ff94996cccc5b1 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 14 Jun 2008 00:41:48 -0500 Subject: [PATCH 1/3] fix compiler errors --- extra/html/parser/parser.factor | 2 +- extra/html/parser/utils/utils.factor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/html/parser/parser.factor b/extra/html/parser/parser.factor index 1ae5768f98..c8aa9aa9e6 100644 --- a/extra/html/parser/parser.factor +++ b/extra/html/parser/parser.factor @@ -122,7 +122,7 @@ SYMBOL: tagstack : parse-attributes ( -- hashtable ) [ (parse-attributes) ] { } make >hashtable ; -: (parse-tag) +: (parse-tag) ( string -- string' hashtable ) [ read-token >lower parse-attributes diff --git a/extra/html/parser/utils/utils.factor b/extra/html/parser/utils/utils.factor index 592503e3dd..c3372d750a 100644 --- a/extra/html/parser/utils/utils.factor +++ b/extra/html/parser/utils/utils.factor @@ -4,7 +4,7 @@ namespaces prettyprint quotations sequences splitting state-parser strings sequences.lib ; IN: html.parser.utils -: string-parse-end? +: string-parse-end? ( -- ? ) get-next not ; : take-string* ( match -- string ) From 90624a8764c81b8feb420c12fb16d8fb04e92f79 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 27 Jun 2008 19:40:46 -0500 Subject: [PATCH 2/3] monotonic-split works on empty seqs --- extra/sequences/lib/lib.factor | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extra/sequences/lib/lib.factor b/extra/sequences/lib/lib.factor index 56488818ab..324b8d166d 100755 --- a/extra/sequences/lib/lib.factor +++ b/extra/sequences/lib/lib.factor @@ -106,17 +106,21 @@ MACRO: firstn ( n -- ) : v, ( -- ) V{ } clone , ; : ,v ( -- ) building get dup peek empty? [ dup pop* ] when drop ; -: monotonic-split ( seq quot -- newseq ) +: (monotonic-split) ( seq quot -- newseq ) [ >r dup unclip suffix r> v, [ pick ,, call [ v, ] unless ] curry 2each ,v ] { } make ; +: monotonic-split ( seq quot -- newseq ) + over empty? [ 2drop { } ] [ (monotonic-split) ] if ; + : delete-random ( seq -- value ) [ length random ] keep [ nth ] 2keep delete-nth ; +ERROR: element-not-found ; : split-around ( seq quot -- before elem after ) - dupd find over [ "Element not found" throw ] unless + dupd find over [ element-not-found ] unless >r cut rest r> swap ; inline : (map-until) ( quot pred -- quot ) From 839ebfb3785287a46b4e90a34654dc490b877e1d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 9 Jul 2008 19:11:38 -0500 Subject: [PATCH 3/3] fix encoding bug with text fields in sqlite --- extra/db/sqlite/lib/lib.factor | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra/db/sqlite/lib/lib.factor b/extra/db/sqlite/lib/lib.factor index 4c440acc55..d14e975ae1 100755 --- a/extra/db/sqlite/lib/lib.factor +++ b/extra/db/sqlite/lib/lib.factor @@ -4,7 +4,8 @@ USING: alien.c-types arrays assocs kernel math math.parser namespaces sequences db.sqlite.ffi db combinators continuations db.types calendar.format serialize io.streams.byte-array byte-arrays io.encodings.binary -io.backend db.errors present urls ; +io.backend db.errors present urls io.encodings.utf8 +io.encodings.string ; IN: db.sqlite.lib ERROR: sqlite-error < db-error n string ; @@ -33,7 +34,7 @@ ERROR: sqlite-sql-error < sql-error n string ; sqlite3_close sqlite-check-result ; : sqlite-prepare ( db sql -- handle ) - dup length "void*" "void*" + utf8 encode dup length "void*" "void*" [ sqlite3_prepare_v2 sqlite-check-result ] 2keep drop *void* ; @@ -44,7 +45,7 @@ ERROR: sqlite-sql-error < sql-error n string ; >r dupd sqlite-bind-parameter-index r> ; : sqlite-bind-text ( handle index text -- ) - dup length SQLITE_TRANSIENT + utf8 encode dup length SQLITE_TRANSIENT sqlite3_bind_text sqlite-check-result ; : sqlite-bind-int ( handle i n -- )