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