Merge git://factorcode.org/git/factor

release
Slava Pestov 2007-10-28 01:23:00 -04:00
commit b23c3bdce7
6 changed files with 19 additions and 19 deletions

2
extra/match/match-tests.factor Normal file → Executable file
View File

@ -5,6 +5,8 @@ IN: temporary
MATCH-VARS: ?a ?b ; MATCH-VARS: ?a ?b ;
[ f ] [ { ?a ?a } { 1 2 } match ] unit-test
[ H{ { ?a 1 } { ?b 2 } } ] [ [ H{ { ?a 1 } { ?b 2 } } ] [
{ ?a ?b } { 1 2 } match { ?a ?b } { 1 2 } match
] unit-test ] unit-test

13
extra/match/match.factor Normal file → Executable file
View File

@ -3,7 +3,7 @@
! !
! Based on pattern matching code from Paul Graham's book 'On Lisp'. ! Based on pattern matching code from Paul Graham's book 'On Lisp'.
USING: parser kernel words namespaces sequences tuples USING: parser kernel words namespaces sequences tuples
combinators macros ; combinators macros assocs ;
IN: match IN: match
SYMBOL: _ SYMBOL: _
@ -22,10 +22,13 @@ SYMBOL: _
: match-var? ( symbol -- bool ) : match-var? ( symbol -- bool )
dup word? [ "match-var" word-prop ] [ drop f ] if ; dup word? [ "match-var" word-prop ] [ drop f ] if ;
: set-match-var ( value var -- ? )
dup namespace key? [ get = ] [ set t ] if ;
: (match) ( value1 value2 -- matched? ) : (match) ( value1 value2 -- matched? )
{ {
{ [ dup match-var? ] [ set t ] } { [ dup match-var? ] [ set-match-var ] }
{ [ over match-var? ] [ swap set t ] } { [ over match-var? ] [ swap set-match-var ] }
{ [ 2dup = ] [ 2drop t ] } { [ 2dup = ] [ 2drop t ] }
{ [ 2dup [ _ eq? ] either? ] [ 2drop t ] } { [ 2dup [ _ eq? ] either? ] [ 2drop t ] }
{ [ 2dup [ sequence? ] both? ] [ { [ 2dup [ sequence? ] both? ] [
@ -58,4 +61,6 @@ MACRO: match-cond ( assoc -- )
} cond ; } cond ;
: match-replace ( object pattern1 pattern2 -- result ) : match-replace ( object pattern1 pattern2 -- result )
-rot match [ replace-patterns ] bind ; -rot
match [ "Pattern does not match" throw ] unless*
[ replace-patterns ] bind ;

2
extra/ui/tools/walker/walker.factor Normal file → Executable file
View File

@ -39,7 +39,7 @@ TUPLE: walker model interpreter history ;
: com-back ( walker -- ) : com-back ( walker -- )
dup walker-history dup walker-history
dup empty? [ drop ] [ pop swap call-tool* ] if ; dup empty? [ 2drop ] [ pop swap call-tool* ] if ;
: reset-walker ( walker -- ) : reset-walker ( walker -- )
<interpreter> over set-walker-interpreter <interpreter> over set-walker-interpreter

View File

@ -14,21 +14,18 @@ TUPLE: windows-ui-backend ;
: crlf>lf CHAR: \r swap remove ; : crlf>lf CHAR: \r swap remove ;
: lf>crlf [ [ dup CHAR: \n = [ CHAR: \r , ] when , ] each ] "" make ; : lf>crlf [ [ dup CHAR: \n = [ CHAR: \r , ] when , ] each ] "" make ;
: (enum-clipboard) ( n -- n )
EnumClipboardFormats win32-error dup 0 > [ dup , (enum-clipboard) ] when ;
: enum-clipboard ( -- seq ) : enum-clipboard ( -- seq )
[ 0 (enum-clipboard) ] { } make nip ; 0 [ EnumClipboardFormats win32-error dup dup 0 > ] [ ]
{ } unfold nip ;
: with-clipboard ( quot -- ) : with-clipboard ( quot -- )
f OpenClipboard win32-error=0/f f OpenClipboard win32-error=0/f
call call
CloseClipboard win32-error=0/f ; inline CloseClipboard win32-error=0/f ; inline
: paste ( -- str ) : paste ( -- str )
[ [
CF_UNICODETEXT IsClipboardFormatAvailable 0 = [ CF_UNICODETEXT IsClipboardFormatAvailable zero? [
! nothing to paste ! nothing to paste
"" ""
] [ ] [
@ -132,7 +129,7 @@ SYMBOL: mouse-captured
} ; } ;
: key-state-down? : key-state-down?
GetKeyState 1 16 shift bitand 0 > ; GetKeyState 16 bit? ;
: left-shift? ( -- ? ) VK_LSHIFT key-state-down? ; : left-shift? ( -- ? ) VK_LSHIFT key-state-down? ;
: left-ctrl? ( -- ? ) VK_LCONTROL key-state-down? ; : left-ctrl? ( -- ? ) VK_LCONTROL key-state-down? ;
@ -309,8 +306,6 @@ SYMBOL: hWnd
"uint" { "void*" "uint" "long" "long" } "stdcall" [ "uint" { "void*" "uint" "long" "long" } "stdcall" [
[ [
pick pick
! "Message: " write dup get-windows-message-name write
! " " write dup unparse print flush
{ {
{ [ dup WM_CLOSE = ] [ drop handle-wm-close 0 ] } { [ dup WM_CLOSE = ] [ drop handle-wm-close 0 ] }
{ [ dup WM_PAINT = ] { [ dup WM_PAINT = ]
@ -343,7 +338,6 @@ SYMBOL: hWnd
{ [ t ] [ drop DefWindowProc ] } { [ t ] [ drop DefWindowProc ] }
} cond } cond
] ui-try ] ui-try
! "finished handling message" print .s flush
] alien-callback ; ] alien-callback ;
: do-events ( -- ) : do-events ( -- )

1
vm/Config.windows.ce.arm Normal file → Executable file
View File

@ -1,5 +1,4 @@
CC = arm-wince-mingw32ce-gcc CC = arm-wince-mingw32ce-gcc
DLL_SUFFIX=-ce DLL_SUFFIX=-ce
EXE_SUFFIX=-ce EXE_SUFFIX=-ce
PLAF_DLL_OBJS += vm/os-windows-ce-arm.o
include vm/Config.windows.ce vm/Config.arm include vm/Config.windows.ce vm/Config.arm

View File

@ -37,7 +37,7 @@ char *getenv(char *name)
return 0; /* unreachable */ return 0; /* unreachable */
} }
long exception_handler(PEXCEPTION_RECORD rec, void *frame, void *ctx, void *dispatch) void c_to_factor_toplevel(CELL quot)
{ {
return 0; c_to_factor(quot);
} }