factor: more char:
parent
7730fc5c64
commit
a1ad3385b9
|
@ -217,7 +217,7 @@ TUPLE: registry-enum-key ;
|
||||||
string-type? [
|
string-type? [
|
||||||
type DWORD deref REG_MULTI_SZ = [
|
type DWORD deref REG_MULTI_SZ = [
|
||||||
"\0" join 2
|
"\0" join 2
|
||||||
] [ 1 ] if [ CHAR: \0 suffix ] times utf16n encode
|
] [ 1 ] if [ char: \0 suffix ] times utf16n encode
|
||||||
] when
|
] when
|
||||||
[ hkey value-name type DWORD deref ] dip dup length
|
[ hkey value-name type DWORD deref ] dip dup length
|
||||||
set-reg-key
|
set-reg-key
|
||||||
|
|
|
@ -48,11 +48,11 @@ USING: kernel sequences tools.test gap-buffer strings math ;
|
||||||
|
|
||||||
! test changing buffer contents
|
! test changing buffer contents
|
||||||
{ "factory" }
|
{ "factory" }
|
||||||
[ "factor" <gb> CHAR: y 6 pick insert* >string ] unit-test
|
[ "factor" <gb> char: y 6 pick insert* >string ] unit-test
|
||||||
|
|
||||||
! test inserting multiple elements in different places. buffer should grow
|
! test inserting multiple elements in different places. buffer should grow
|
||||||
{ "refractory" }
|
{ "refractory" }
|
||||||
[ "factor" <gb> CHAR: y 6 pick insert* "re" 0 pick insert* CHAR: r 3 pick insert* >string ] unit-test
|
[ "factor" <gb> char: y 6 pick insert* "re" 0 pick insert* char: r 3 pick insert* >string ] unit-test
|
||||||
|
|
||||||
! test deleting elements. buffer should shrink
|
! test deleting elements. buffer should shrink
|
||||||
{ "for" }
|
{ "for" }
|
||||||
|
@ -60,19 +60,19 @@ USING: kernel sequences tools.test gap-buffer strings math ;
|
||||||
|
|
||||||
! more testing of nth and set-nth
|
! more testing of nth and set-nth
|
||||||
{ "raptor" }
|
{ "raptor" }
|
||||||
[ "factor" <gb> CHAR: p 2 pick set-nth 5 over nth 0 pick set-nth >string ] unit-test
|
[ "factor" <gb> char: p 2 pick set-nth 5 over nth 0 pick set-nth >string ] unit-test
|
||||||
|
|
||||||
! test stack/queue operations
|
! test stack/queue operations
|
||||||
{ "slaughter" }
|
{ "slaughter" }
|
||||||
[ "laughter" <gb> CHAR: s over push-start >string ] unit-test
|
[ "laughter" <gb> char: s over push-start >string ] unit-test
|
||||||
|
|
||||||
{ "pantonio" }
|
{ "pantonio" }
|
||||||
[ "pant" <gb> "onio" over push-end >string ] unit-test
|
[ "pant" <gb> "onio" over push-end >string ] unit-test
|
||||||
|
|
||||||
{ CHAR: f "actor" }
|
{ char: f "actor" }
|
||||||
[ "factor" <gb> dup pop-start swap >string ] unit-test
|
[ "factor" <gb> dup pop-start swap >string ] unit-test
|
||||||
|
|
||||||
{ CHAR: s "pant" }
|
{ char: s "pant" }
|
||||||
[ "pants" <gb> dup pop-end swap >string ] unit-test
|
[ "pants" <gb> dup pop-end swap >string ] unit-test
|
||||||
|
|
||||||
{ "end this is the " }
|
{ "end this is the " }
|
||||||
|
|
|
@ -42,8 +42,8 @@ general parsers work and the 'list of sucesses' that are returned as a
|
||||||
result.</p>
|
result.</p>
|
||||||
<pre class="code">
|
<pre class="code">
|
||||||
(1) : char-a ( inp -- result )
|
(1) : char-a ( inp -- result )
|
||||||
0 over string-nth CHAR: a = [
|
0 over string-nth char: a = [
|
||||||
1 swap string-tail CHAR: a cons unit delay lunit
|
1 swap string-tail char: a cons unit delay lunit
|
||||||
] [
|
] [
|
||||||
drop lnil
|
drop lnil
|
||||||
] ifte ;
|
] ifte ;
|
||||||
|
|
|
@ -58,14 +58,14 @@ BT
|
||||||
( )'
|
( )'
|
||||||
(: pdf-string \( str -- str' \))'
|
(: pdf-string \( str -- str' \))'
|
||||||
( H{)'
|
( H{)'
|
||||||
( { HEX: 08 "\\\\b" })'
|
( { hex: 08 "\\\\b" })'
|
||||||
( { HEX: 0c "\\\\f" })'
|
( { hex: 0c "\\\\f" })'
|
||||||
( { CHAR: \\n "\\\\n" })'
|
( { char: \\n "\\\\n" })'
|
||||||
( { CHAR: \\r "\\\\r" })'
|
( { char: \\r "\\\\r" })'
|
||||||
( { CHAR: \\t "\\\\t" })'
|
( { char: \\t "\\\\t" })'
|
||||||
( { CHAR: \\\\ "\\\\\\\\" })'
|
( { char: \\\\ "\\\\\\\\" })'
|
||||||
( { CHAR: \( "\\\\\(" })'
|
( { char: \( "\\\\\(" })'
|
||||||
( { CHAR: \) "\\\\\)" })'
|
( { char: \) "\\\\\)" })'
|
||||||
( } escape-string-by "\(" "\)" surround ;)'
|
( } escape-string-by "\(" "\)" surround ;)'
|
||||||
( )'
|
( )'
|
||||||
(: pdf-object \( str n -- str' \))'
|
(: pdf-object \( str n -- str' \))'
|
||||||
|
@ -251,4 +251,4 @@ trailer
|
||||||
>>
|
>>
|
||||||
startxref
|
startxref
|
||||||
4845
|
4845
|
||||||
%%EOF
|
%%EOF
|
||||||
|
|
Loading…
Reference in New Issue