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 -- ) 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 ) diff --git a/extra/sequences/lib/lib.factor b/extra/sequences/lib/lib.factor index 3b54abfeab..90bca7cef9 100755 --- a/extra/sequences/lib/lib.factor +++ b/extra/sequences/lib/lib.factor @@ -84,17 +84,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 )