Merge branch 'master' of git://factorcode.org/git/factor
commit
1386297022
extra
|
@ -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*" <c-object> "void*" <c-object>
|
||||
utf8 encode dup length "void*" <c-object> "void*" <c-object>
|
||||
[ 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 -- )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in New Issue