Merge branch 'master' into new_codegen
commit
998637109a
|
@ -102,7 +102,7 @@ M: capture-group-off flag-action ( dfa-traverser flag -- )
|
||||||
[ [ first2 1+ 2array ] map ] change-capture-counters
|
[ [ first2 1+ 2array ] map ] change-capture-counters
|
||||||
! dup current-state>> .
|
! dup current-state>> .
|
||||||
dup [ current-state>> ] [ traversal-flags>> ] bi
|
dup [ current-state>> ] [ traversal-flags>> ] bi
|
||||||
at [ dup . flag-action ] with each ;
|
at [ flag-action ] with each ;
|
||||||
|
|
||||||
: increment-state ( dfa-traverser state -- dfa-traverser )
|
: increment-state ( dfa-traverser state -- dfa-traverser )
|
||||||
[
|
[
|
||||||
|
|
|
@ -18,13 +18,13 @@ TUPLE: redefine-error def ;
|
||||||
2dup key? [ over redefine-error ] when conjoin ;
|
2dup key? [ over redefine-error ] when conjoin ;
|
||||||
|
|
||||||
: (remember-definition) ( definition loc assoc -- )
|
: (remember-definition) ( definition loc assoc -- )
|
||||||
>r over set-where r> add-once ;
|
[ over set-where ] dip add-once ;
|
||||||
|
|
||||||
: remember-definition ( definition loc -- )
|
: remember-definition ( definition loc -- )
|
||||||
new-definitions get first (remember-definition) ;
|
new-definitions get first (remember-definition) ;
|
||||||
|
|
||||||
: remember-class ( class loc -- )
|
: remember-class ( class loc -- )
|
||||||
over new-definitions get first key? [ dup redefine-error ] when
|
[ dup new-definitions get first key? [ dup redefine-error ] when ] dip
|
||||||
new-definitions get second (remember-definition) ;
|
new-definitions get second (remember-definition) ;
|
||||||
|
|
||||||
: forward-reference? ( word -- ? )
|
: forward-reference? ( word -- ? )
|
||||||
|
|
|
@ -490,3 +490,9 @@ must-fail-with
|
||||||
] [
|
] [
|
||||||
error>> staging-violation?
|
error>> staging-violation?
|
||||||
] must-fail-with
|
] must-fail-with
|
||||||
|
|
||||||
|
! Bogus error message
|
||||||
|
DEFER: blah
|
||||||
|
|
||||||
|
[ "IN: parser.tests USE: kernel TUPLE: blah < tuple ; : blah ; TUPLE: blah < tuple ; : blah ;" eval ]
|
||||||
|
[ error>> error>> def>> \ blah eq? ] must-fail-with
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman, Joe Groff.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays byte-arrays kernel math namespaces
|
USING: accessors arrays byte-arrays kernel math namespaces
|
||||||
opengl.gl sequences math.vectors ui graphics.bitmap graphics.viewer
|
opengl.gl sequences math.vectors ui graphics.bitmap graphics.viewer
|
||||||
models opengl.framebuffers ui.gadgets.worlds ui.gadgets fry ;
|
models opengl.framebuffers ui.gadgets.worlds ui.gadgets fry alien.syntax ;
|
||||||
IN: cap
|
IN: cap
|
||||||
|
|
||||||
: screenshot-array ( world -- byte-array )
|
: screenshot-array ( world -- byte-array )
|
||||||
|
@ -9,7 +11,7 @@ IN: cap
|
||||||
: gl-screenshot ( gadget -- byte-array )
|
: gl-screenshot ( gadget -- byte-array )
|
||||||
[
|
[
|
||||||
GL_BACK glReadBuffer
|
GL_BACK glReadBuffer
|
||||||
GL_PACK_ALIGNMENT 1 glPixelStorei
|
GL_PACK_ALIGNMENT 4 glPixelStorei
|
||||||
0 0
|
0 0
|
||||||
] dip
|
] dip
|
||||||
[ dim>> first2 GL_BGR GL_UNSIGNED_BYTE ]
|
[ dim>> first2 GL_BGR GL_UNSIGNED_BYTE ]
|
||||||
|
@ -26,6 +28,3 @@ IN: cap
|
||||||
|
|
||||||
: screenshot. ( window -- )
|
: screenshot. ( window -- )
|
||||||
[ screenshot <graphics-gadget> ] [ title>> ] bi open-window ;
|
[ screenshot <graphics-gadget> ] [ title>> ] bi open-window ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays io io.streams.string kernel math math.parser
|
USING: arrays io io.streams.string kernel math math.parser
|
||||||
namespaces prettyprint sequences splitting grouping strings
|
namespaces sequences splitting grouping strings ascii ;
|
||||||
ascii ;
|
|
||||||
IN: hexdump
|
IN: hexdump
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: write-header ( len -- )
|
: write-header ( len -- )
|
||||||
"Length: " write
|
"Length: " write
|
||||||
[ unparse write ", " write ]
|
[ number>string write ", " write ]
|
||||||
[ >hex write "h" write nl ] bi ;
|
[ >hex write "h" write nl ] bi ;
|
||||||
|
|
||||||
: write-offset ( lineno -- )
|
: write-offset ( lineno -- )
|
||||||
16 * >hex 8 CHAR: 0 pad-left write "h: " write ;
|
16 * >hex 8 CHAR: 0 pad-left write "h: " write ;
|
||||||
|
|
||||||
: write-hex-digit ( digit -- )
|
: >hex-digit ( digit -- str )
|
||||||
>hex 2 CHAR: 0 pad-left write ;
|
>hex 2 CHAR: 0 pad-left " " append ;
|
||||||
|
|
||||||
: write-hex-line ( str n -- )
|
: >hex-digits ( bytes -- str )
|
||||||
write-offset
|
[ >hex-digit ] { } map-as concat 48 CHAR: \s pad-right ;
|
||||||
dup [ write-hex-digit bl ] each
|
|
||||||
16 over length - 3 * CHAR: \s <string> write
|
: >ascii ( bytes -- str )
|
||||||
[ dup printable? [ drop CHAR: . ] unless write1 ] each
|
[ [ printable? ] keep CHAR: . ? ] map ;
|
||||||
nl ;
|
|
||||||
|
: write-hex-line ( str lineno -- )
|
||||||
|
write-offset [ >hex-digits write ] [ >ascii write ] bi nl ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: hexdump ( seq -- str )
|
: hexdump. ( seq -- )
|
||||||
[
|
|
||||||
[ length write-header ]
|
[ length write-header ]
|
||||||
[ 16 <sliced-groups> [ write-hex-line ] each-index ] bi
|
[ 16 <sliced-groups> [ write-hex-line ] each-index ] bi ;
|
||||||
] with-string-writer ;
|
|
||||||
|
|
||||||
: hexdump. ( seq -- ) hexdump write ;
|
: hexdump ( seq -- str )
|
||||||
|
[ hexdump. ] with-string-writer ;
|
||||||
|
|
Loading…
Reference in New Issue