Merge branch 'master' of git://factorcode.org/git/factor
commit
6537c789fe
|
@ -0,0 +1 @@
|
|||
unportable
|
|
@ -8,7 +8,7 @@ sequences ftp io.launcher.unix.parser unicode.case splitting
|
|||
assocs classes io.servers.connection destructors calendar
|
||||
io.timeouts io.streams.duplex threads continuations math
|
||||
concurrency.promises byte-arrays io.backend tools.hexdump
|
||||
tools.files io.streams.string ;
|
||||
tools.files io.streams.string math.bitwise ;
|
||||
IN: ftp.server
|
||||
|
||||
TUPLE: ftp-client url mode state command-promise user password ;
|
||||
|
@ -49,7 +49,7 @@ C: <ftp-list> ftp-list
|
|||
[ >>raw ] [ tokenize-command >>tokenized ] bi ;
|
||||
|
||||
: (send-response) ( n string separator -- )
|
||||
rot number>string write write ftp-send ;
|
||||
[ number>string write ] 2dip write ftp-send ;
|
||||
|
||||
: send-response ( ftp-response -- )
|
||||
[ n>> ] [ strings>> ] bi
|
||||
|
@ -102,7 +102,7 @@ ERROR: type-error type ;
|
|||
: handle-TYPE ( obj -- )
|
||||
[
|
||||
tokenized>> second parse-type
|
||||
200 "Switching to " rot " mode" 3append server-response
|
||||
[ 200 ] dip "Switching to " " mode" surround server-response
|
||||
] [
|
||||
2drop "TYPE is binary only" ftp-error
|
||||
] recover ;
|
||||
|
@ -111,11 +111,11 @@ ERROR: type-error type ;
|
|||
remote-address get class new 0 >>port binary <server> ;
|
||||
|
||||
: port>bytes ( port -- hi lo )
|
||||
[ -8 shift ] keep [ HEX: ff bitand ] bi@ ;
|
||||
[ -8 shift ] keep [ 8 bits ] bi@ ;
|
||||
|
||||
: handle-PWD ( obj -- )
|
||||
drop
|
||||
257 current-directory get "\"" "\"" surround server-response ;
|
||||
257 current-directory get "\"" dup surround server-response ;
|
||||
|
||||
: handle-SYST ( obj -- )
|
||||
drop
|
||||
|
@ -155,15 +155,19 @@ M: ftp-list service-command ( stream obj -- )
|
|||
finish-directory ;
|
||||
|
||||
: transfer-outgoing-file ( path -- )
|
||||
150 "Opening BINARY mode data connection for "
|
||||
rot
|
||||
[ file-name ] [
|
||||
" " swap file-info size>> number>string
|
||||
"(" " bytes)." surround append
|
||||
] bi 3append server-response ;
|
||||
[
|
||||
150
|
||||
"Opening BINARY mode data connection for "
|
||||
] dip
|
||||
[
|
||||
file-name
|
||||
] [
|
||||
file-info size>> number>string
|
||||
"(" " bytes)." surround
|
||||
] bi " " glue append server-response ;
|
||||
|
||||
: transfer-incoming-file ( path -- )
|
||||
150 "Opening BINARY mode data connection for " rot append
|
||||
[ 150 ] dip "Opening BINARY mode data connection for " prepend
|
||||
server-response ;
|
||||
|
||||
: finish-file-transfer ( -- )
|
||||
|
@ -209,8 +213,9 @@ M: ftp-put service-command ( stream obj -- )
|
|||
|
||||
: handle-SIZE ( obj -- )
|
||||
[
|
||||
[ 213 ] dip
|
||||
tokenized>> second file-info size>>
|
||||
213 swap number>string server-response
|
||||
number>string server-response
|
||||
] [
|
||||
2drop
|
||||
550 "Could not get file size" server-response
|
||||
|
@ -228,21 +233,20 @@ M: ftp-put service-command ( stream obj -- )
|
|||
|
||||
: handle-PASV ( obj -- )
|
||||
drop client get passive >>mode drop
|
||||
expect-connection
|
||||
[
|
||||
"Entering Passive Mode (127,0,0,1," %
|
||||
port>bytes [ number>string ] bi@ "," glue %
|
||||
")" %
|
||||
] "" make 227 swap server-response ;
|
||||
221
|
||||
expect-connection port>bytes [ number>string ] bi@ "," glue
|
||||
"Entering Passive Mode (127,0,0,1," ")" surround
|
||||
server-response ;
|
||||
|
||||
: handle-EPSV ( obj -- )
|
||||
drop
|
||||
client get command-promise>> [
|
||||
"You already have a passive stream" ftp-error
|
||||
] [
|
||||
229 "Entering Extended Passive Mode (|||"
|
||||
229
|
||||
expect-connection number>string
|
||||
"|)" 3append server-response
|
||||
"Entering Extended Passive Mode (|||" "|)" surround
|
||||
server-response
|
||||
] if ;
|
||||
|
||||
! LPRT 6,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,242,186
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
USING: eval multiline system combinators ;
|
||||
IN: game-input.backend
|
||||
|
||||
STRING: set-backend-for-macosx
|
||||
USING: namespaces parser game-input.backend.iokit ;
|
||||
<< "game-input" (use+) >>
|
||||
iokit-game-input-backend game-input-backend set-global
|
||||
;
|
||||
|
||||
STRING: set-backend-for-windows
|
||||
USING: namespaces parser game-input.backend.dinput ;
|
||||
<< "game-input" (use+) >>
|
||||
dinput-game-input-backend game-input-backend set-global
|
||||
;
|
||||
|
||||
{
|
||||
{ [ os macosx? ] [ set-backend-for-macosx eval ] }
|
||||
{ [ os windows? ] [ set-backend-for-windows eval ] }
|
||||
{ [ t ] [ ] }
|
||||
} cond
|
||||
|
|
@ -1 +0,0 @@
|
|||
Joe Groff
|
|
@ -1 +0,0 @@
|
|||
Platform-specific backends for game-input
|
|
@ -1 +0,0 @@
|
|||
games
|
0
extra/game-input/backend/authors.txt → extra/game-input/dinput/authors.txt
Normal file → Executable file
0
extra/game-input/backend/authors.txt → extra/game-input/dinput/authors.txt
Normal file → Executable file
|
@ -1,16 +1,16 @@
|
|||
USING: windows.dinput windows.dinput.constants parser symbols
|
||||
alien.c-types windows.ole32 namespaces assocs kernel arrays
|
||||
vectors windows.kernel32 windows.com windows.dinput shuffle
|
||||
windows.user32 windows.messages sequences combinators
|
||||
windows.user32 windows.messages sequences combinators locals
|
||||
math.geometry.rect ui.windows accessors math windows alien
|
||||
alien.strings io.encodings.utf16 io.encodings.utf16n
|
||||
continuations byte-arrays locals
|
||||
game-input.backend.dinput.keys-array ;
|
||||
<< "game-input" (use+) >>
|
||||
IN: game-input.backend.dinput
|
||||
continuations byte-arrays game-input.dinput.keys-array ;
|
||||
IN: game-input.dinput
|
||||
|
||||
SINGLETON: dinput-game-input-backend
|
||||
|
||||
dinput-game-input-backend game-input-backend set-global
|
||||
|
||||
SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
|
||||
+controller-devices+ +controller-guids+
|
||||
+device-change-window+ +device-change-handle+ ;
|
|
@ -1,6 +1,6 @@
|
|||
USING: sequences sequences.private math alien.c-types
|
||||
accessors ;
|
||||
IN: game-input.backend.dinput.keys-array
|
||||
IN: game-input.dinput.keys-array
|
||||
|
||||
TUPLE: keys-array underlying ;
|
||||
C: <keys-array> keys-array
|
|
@ -1,5 +1,6 @@
|
|||
USING: arrays accessors continuations kernel symbols
|
||||
combinators.lib sequences namespaces init vocabs ;
|
||||
USING: arrays accessors continuations kernel symbols system
|
||||
combinators.lib sequences namespaces init vocabs vocabs.loader
|
||||
combinators ;
|
||||
IN: game-input
|
||||
|
||||
SYMBOLS: game-input-backend game-input-opened ;
|
||||
|
@ -19,10 +20,6 @@ M: f (reset-game-input) ;
|
|||
game-input-opened off
|
||||
(reset-game-input) ;
|
||||
|
||||
: load-game-input-backend ( -- )
|
||||
game-input-backend get
|
||||
[ "game-input.backend" load-vocab drop ] unless ;
|
||||
|
||||
[ reset-game-input ] "game-input" add-init-hook
|
||||
|
||||
PRIVATE>
|
||||
|
@ -76,5 +73,8 @@ M: keyboard-state clone
|
|||
|
||||
HOOK: read-keyboard game-input-backend ( -- keyboard-state )
|
||||
|
||||
load-game-input-backend
|
||||
|
||||
{
|
||||
{ [ os windows? ] [ "game-input.dinput" require ] }
|
||||
{ [ os macosx? ] [ "game-input.iokit" require ] }
|
||||
{ [ t ] [ ] }
|
||||
} cond
|
||||
|
|
0
extra/game-input/backend/dinput/authors.txt → extra/game-input/iokit/authors.txt
Executable file → Normal file
0
extra/game-input/backend/dinput/authors.txt → extra/game-input/iokit/authors.txt
Executable file → Normal file
|
@ -3,12 +3,13 @@ kernel cocoa.enumeration destructors math.parser cocoa.application
|
|||
sequences locals combinators.short-circuit threads
|
||||
symbols namespaces assocs vectors arrays combinators
|
||||
core-foundation.run-loop accessors sequences.private
|
||||
alien.c-types math parser ;
|
||||
<< "game-input" (use+) >>
|
||||
IN: game-input.backend.iokit
|
||||
alien.c-types math parser game-input ;
|
||||
IN: game-input.iokit
|
||||
|
||||
SINGLETON: iokit-game-input-backend
|
||||
|
||||
iokit-game-input-backend game-input-backend set-global
|
||||
|
||||
: hid-manager-matching ( matching-seq -- alien )
|
||||
f 0 IOHIDManagerCreate
|
||||
[ swap >plist IOHIDManagerSetDeviceMatchingMultiple ]
|
|
@ -10,9 +10,8 @@ TUPLE: serial stream path baud
|
|||
|
||||
ERROR: invalid-baud baud ;
|
||||
M: invalid-baud summary ( invalid-baud -- string )
|
||||
"Baud rate "
|
||||
swap baud>> number>string
|
||||
" not supported" 3append ;
|
||||
baud>> number>string
|
||||
"Baud rate " " not supported" surround ;
|
||||
|
||||
HOOK: lookup-baud os ( m -- n )
|
||||
HOOK: open-serial os ( serial -- stream )
|
||||
|
|
Loading…
Reference in New Issue