diff --git a/basis/alien/remote-control/remote-control-tests.factor b/basis/alien/remote-control/remote-control-tests.factor new file mode 100644 index 0000000000..a2993e79de --- /dev/null +++ b/basis/alien/remote-control/remote-control-tests.factor @@ -0,0 +1,44 @@ +USING: interpolate multiline +io io.directories io.encodings.ascii io.files +io.files.temp io.launcher io.streams.string kernel locals system +tools.test sequences ; +IN: alien.remote-control.tests + +: compile-file ( contents -- ) + "test.c" ascii set-file-contents + { "gcc" "-I../" "-L.." "-lfactor" "test.c" } + os macosx? cpu x86.64? and [ "-m64" suffix ] when + try-process ; + +: run-test ( -- line ) + os windows? "temp/a.exe" "temp/a.out" ? + ascii [ readln ] with-process-reader ; + +:: test-embedding ( code -- line ) + image :> image + + [ + I[ +#include +#include +#include + +int main(int argc, char **argv) +{ + F_PARAMETERS p; + default_parameters(&p); + p.image_path = STRING_LITERAL("${image}"); + init_factor(&p); + start_embedded_factor(&p); + ${code} + printf("Done.\n"); + return 0; +} + ]I + ] with-string-writer + "resource:temp" [ compile-file ] with-directory + "resource:" [ run-test ] with-directory ; + +[ "Done." ] [ "" test-embedding ] unit-test + +[ "Done." ] [ "factor_yield();" test-embedding ] unit-test \ No newline at end of file diff --git a/basis/base64/base64-docs.factor b/basis/base64/base64-docs.factor index ed92a19577..530caab8bd 100644 --- a/basis/base64/base64-docs.factor +++ b/basis/base64/base64-docs.factor @@ -7,7 +7,13 @@ HELP: >base64 { $examples { $example "USING: prettyprint base64 strings ;" "\"The monorail is a free service.\" >base64 >string ." "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\"" } } -{ $see-also base64> } ; +{ $see-also base64> >base64-lines } ; + +HELP: >base64-lines +{ $values { "seq" sequence } { "base64" "a string of base64 characters" } } +{ $description "Converts a sequence to its base64 representation by taking six bits at a time as an index into a lookup table containing alphanumerics, '+', and '/'. The result is padded with '=' if the input was not a multiple of six bits. A crlf is inserted for every 76 characters of output." } +{ $see-also base64> >base64-lines } ; + HELP: base64> { $values { "base64" "a string of base64 characters" } { "seq" sequence } } @@ -16,13 +22,26 @@ HELP: base64> { $example "USING: prettyprint base64 strings ;" "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\" base64> >string ." "\"The monorail is a free service.\"" } } { $notes "This word will throw if the input string contains characters other than those allowed in base64 encodings." } -{ $see-also >base64 } ; +{ $see-also >base64 >base64-lines } ; + +HELP: encode-base64 +{ $description "Reads the standard input and writes it to standard output encoded in base64." } ; + +HELP: decode-base64 +{ $description "Reads the standard input and decodes it, writing to standard output." } ; + +HELP: encode-base64-lines +{ $description "Reads the standard input and writes it to standard output encoded in base64 with a crlf every 76 characters." } ; ARTICLE: "base64" "Base 64 conversions" "The " { $vocab-link "base64" } " vocabulary implements conversions of sequences to printable characters in base 64. These plain-text representations of binary data may be passed around and converted back to binary data later." $nl -"Converting to base 64:" +"Converting to and from base64 as strings:" { $subsection >base64 } -"Converting back to binary:" -{ $subsection base64> } ; +{ $subsection >base64-lines } +{ $subsection base64> } +"Using base64 from streams:" +{ $subsection encode-base64 } +{ $subsection encode-base64-lines } +{ $subsection decode-base64 } ; ABOUT: "base64" diff --git a/basis/base64/base64.factor b/basis/base64/base64.factor index ce35419cbf..e5972991e5 100644 --- a/basis/base64/base64.factor +++ b/basis/base64/base64.factor @@ -74,11 +74,11 @@ PRIVATE> [ malformed-base64 ] } case ; -: >base64 ( str -- base64 ) +: >base64 ( seq -- base64 ) binary [ [ encode-base64 ] with-string-reader ] with-byte-writer ; -: base64> ( base64 -- str ) +: base64> ( base64 -- seq ) [ binary [ decode-base64 ] with-byte-reader ] with-string-writer ; -: >base64-lines ( str -- base64 ) - binary [ [ encode-base64-lines ] with-string-reader ] with-byte-writer ; \ No newline at end of file +: >base64-lines ( seq -- base64 ) + binary [ [ encode-base64-lines ] with-string-reader ] with-byte-writer ; diff --git a/basis/bootstrap/math/math.factor b/basis/bootstrap/math/math.factor index 347969af0d..27b2f6b181 100644 --- a/basis/bootstrap/math/math.factor +++ b/basis/bootstrap/math/math.factor @@ -2,6 +2,4 @@ USING: vocabs vocabs.loader kernel ; "math.ratios" require "math.floats" require -"math.complex" require - -"prettyprint" vocab [ "math.complex.prettyprint" require ] when +"math.complex" require \ No newline at end of file diff --git a/basis/editors/gvim/gvim.factor b/basis/editors/gvim/gvim.factor index 8fb4d6b23d..15fd52f5ee 100644 --- a/basis/editors/gvim/gvim.factor +++ b/basis/editors/gvim/gvim.factor @@ -3,6 +3,9 @@ namespaces sequences system combinators editors.vim vocabs.loader make ; IN: editors.gvim +! This code builds on the code in editors.vim; see there for +! more information. + SINGLETON: gvim HOOK: gvim-path io-backend ( -- path ) diff --git a/basis/editors/vim/generate-syntax/generate-syntax.factor b/basis/editors/vim/generate-syntax/generate-syntax.factor index 74b04c346f..061e938dcf 100644 --- a/basis/editors/vim/generate-syntax/generate-syntax.factor +++ b/basis/editors/vim/generate-syntax/generate-syntax.factor @@ -4,7 +4,7 @@ IN: editors.vim.generate-syntax : generate-vim-syntax ( -- ) "misc/factor.vim.fgen" resource-path - "misc/factor.vim" resource-path + "misc/vim/syntax/factor.vim" resource-path template-convert ; MAIN: generate-vim-syntax diff --git a/basis/editors/vim/vim-docs.factor b/basis/editors/vim/vim-docs.factor index 3387dc5971..7f527bf18f 100644 --- a/basis/editors/vim/vim-docs.factor +++ b/basis/editors/vim/vim-docs.factor @@ -12,5 +12,6 @@ $nl "USE: vim" "\"c:\\\\program files\\\\vim\\\\vim70\\\\gvim\" vim-path set-global" } -"On Unix, you may omit the last line if " { $snippet "\"vim\"" } " is in your " { $snippet "$PATH" } "." ; - +"On Unix, you may omit the last line if " { $snippet "\"vim\"" } " is in your " { $snippet "$PATH" } "." +$nl +"You may also wish to install Vim support files to enable syntax hilighting and other features. These are in the " { $link resource-path } " in " { $snippet "misc/vim" } "." ; diff --git a/basis/io/files/windows/windows.factor b/basis/io/files/windows/windows.factor index 842f1ec84c..444ba98c7d 100755 --- a/basis/io/files/windows/windows.factor +++ b/basis/io/files/windows/windows.factor @@ -15,7 +15,7 @@ IN: io.files.windows CreateFile-flags f CreateFile opened-file ] with-destructors ; -: open-pipe-r/w ( path -- win32-file ) +: open-r/w ( path -- win32-file ) { GENERIC_READ GENERIC_WRITE } flags OPEN_EXISTING 0 open-file ; diff --git a/basis/io/streams/duplex/duplex-docs.factor b/basis/io/streams/duplex/duplex-docs.factor index 48afafeec7..5bf33e9002 100644 --- a/basis/io/streams/duplex/duplex-docs.factor +++ b/basis/io/streams/duplex/duplex-docs.factor @@ -20,11 +20,11 @@ HELP: HELP: with-stream { $values { "stream" duplex-stream } { "quot" quotation } } -{ $description "Calls the quotation in a new dynamic scope, with both " { $link input-stream } " and " { $link output-stream } " rebound to " { $snippet "stream" } ". The stream is closed if the quotation returns or throws an error." } ; +{ $description "Calls the quotation in a new dynamic scope, with both " { $link input-stream } " and " { $link output-stream } " rebound to " { $snippet "stream" } ", which must be a duplex stream. The stream is closed if the quotation returns or throws an error." } ; HELP: with-stream* { $values { "stream" duplex-stream } { "quot" quotation } } -{ $description "Calls the quotation in a new dynamic scope, with both " { $link input-stream } " and " { $link output-stream } " rebound to " { $snippet "stream" } "." } +{ $description "Calls the quotation in a new dynamic scope, with both " { $link input-stream } " and " { $link output-stream } " rebound to " { $snippet "stream" } ", which must be a duplex stream." } { $notes "This word does not close the stream. Compare with " { $link with-stream } "." } ; HELP: diff --git a/basis/math/complex/complex.factor b/basis/math/complex/complex.factor index 90713cd40f..620a6c3bab 100644 --- a/basis/math/complex/complex.factor +++ b/basis/math/complex/complex.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2006, 2008 Slava Pestov. +! Copyright (C) 2006, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel kernel.private math math.private math.libm math.functions arrays math.functions.private sequences @@ -47,3 +47,9 @@ M: complex sqrt >polar [ fsqrt ] [ 2.0 / ] bi* polar> ; IN: syntax : C{ \ } [ first2 rect> ] parse-literal ; parsing + +USE: prettyprint.custom + +M: complex pprint* pprint-object ; +M: complex pprint-delims drop \ C{ \ } ; +M: complex >pprint-sequence >rect 2array ; \ No newline at end of file diff --git a/basis/math/complex/prettyprint/prettyprint.factor b/basis/math/complex/prettyprint/prettyprint.factor deleted file mode 100644 index 09eeb8045c..0000000000 --- a/basis/math/complex/prettyprint/prettyprint.factor +++ /dev/null @@ -1,8 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: math math.functions arrays prettyprint.custom kernel ; -IN: math.complex.prettyprint - -M: complex pprint* pprint-object ; -M: complex pprint-delims drop \ C{ \ } ; -M: complex >pprint-sequence >rect 2array ; diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index e15ba9b90e..8b36947f43 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -3,17 +3,8 @@ USING: tools.test system io.pathnames io.files io.files.info io.files.temp kernel tools.deploy.config tools.deploy.config.editor tools.deploy.backend math sequences io.launcher arrays namespaces continuations layouts accessors -io.encodings.ascii urls math.parser io.directories ; - -: shake-and-bake ( vocab -- ) - [ "test.image" temp-file delete-file ] ignore-errors - "resource:" [ - [ vm "test.image" temp-file ] dip - dup deploy-config make-deploy-image - ] with-directory ; - -: small-enough? ( n -- ? ) - [ "test.image" temp-file file-info size>> ] [ cell 4 / * ] bi* <= ; +io.encodings.ascii urls math.parser io.directories +tools.deploy.test ; [ t ] [ "hello-world" shake-and-bake 500000 small-enough? ] unit-test @@ -36,11 +27,6 @@ os macosx? [ [ t ] [ "webkit-demo" shake-and-bake 500000 small-enough? ] unit-test ] when -: run-temp-image ( -- ) - vm - "-i=" "test.image" temp-file append - 2array try-process ; - { "tools.deploy.test.1" "tools.deploy.test.2" @@ -113,3 +99,8 @@ M: quit-responder call-responder* "tools.deploy.test.9" shake-and-bake run-temp-image ] unit-test + +[ ] [ + "tools.deploy.test.10" shake-and-bake + run-temp-image +] unit-test diff --git a/basis/tools/deploy/test/10/10-tests.factor b/basis/tools/deploy/test/10/10-tests.factor new file mode 100644 index 0000000000..ba6f354aa5 --- /dev/null +++ b/basis/tools/deploy/test/10/10-tests.factor @@ -0,0 +1,4 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: tools.test tools.deploy.test.10 ; +IN: tools.deploy.test.10.tests diff --git a/basis/tools/deploy/test/10/10.factor b/basis/tools/deploy/test/10/10.factor new file mode 100644 index 0000000000..95329ff7f2 --- /dev/null +++ b/basis/tools/deploy/test/10/10.factor @@ -0,0 +1,8 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: prettyprint ; +IN: tools.deploy.test.10 + +: main ( -- ) C{ 0 1 } pprint ; + +MAIN: main \ No newline at end of file diff --git a/basis/tools/deploy/test/10/authors.txt b/basis/tools/deploy/test/10/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/tools/deploy/test/10/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/tools/deploy/test/10/deploy.factor b/basis/tools/deploy/test/10/deploy.factor new file mode 100644 index 0000000000..3f5940651d --- /dev/null +++ b/basis/tools/deploy/test/10/deploy.factor @@ -0,0 +1,15 @@ +USING: tools.deploy.config ; +H{ + { deploy-reflection 3 } + { deploy-unicode? f } + { deploy-io 2 } + { deploy-word-props? f } + { deploy-compiler? f } + { deploy-threads? f } + { deploy-word-defs? f } + { "stop-after-last-window?" t } + { deploy-ui? f } + { deploy-math? t } + { deploy-c-types? f } + { deploy-name "tools.deploy.test.10" } +} diff --git a/basis/tools/deploy/test/test.factor b/basis/tools/deploy/test/test.factor new file mode 100644 index 0000000000..eb780e40cc --- /dev/null +++ b/basis/tools/deploy/test/test.factor @@ -0,0 +1,19 @@ +USING: accessors arrays continuations io.directories io.files.info +io.files.temp io.launcher kernel layouts math sequences system +tools.deploy.backend tools.deploy.config.editor ; +IN: tools.deploy.test + +: shake-and-bake ( vocab -- ) + [ "test.image" temp-file delete-file ] ignore-errors + "resource:" [ + [ vm "test.image" temp-file ] dip + dup deploy-config make-deploy-image + ] with-directory ; + +: small-enough? ( n -- ? ) + [ "test.image" temp-file file-info size>> ] [ cell 4 / * ] bi* <= ; + +: run-temp-image ( -- ) + vm + "-i=" "test.image" temp-file append + 2array try-process ; \ No newline at end of file diff --git a/basis/ui/gadgets/scrollers/scrollers-tests.factor b/basis/ui/gadgets/scrollers/scrollers-tests.factor index d6792abd49..25977cd906 100644 --- a/basis/ui/gadgets/scrollers/scrollers-tests.factor +++ b/basis/ui/gadgets/scrollers/scrollers-tests.factor @@ -28,7 +28,7 @@ IN: ui.gadgets.scrollers.tests "v" get [ [ { 10 20 } ] [ "v" get model>> range-value ] unit-test - [ { 10 20 } ] [ "g" get rect-loc vneg { 3 3 } v+ ] unit-test + [ { 10 20 } ] [ "g" get rect-loc vneg viewport-gap v+ scroller-border v+ ] unit-test ] with-grafted-gadget [ ] [ @@ -43,13 +43,13 @@ IN: ui.gadgets.scrollers.tests "s" get [ [ { 34 34 } ] [ "s" get viewport>> rect-dim ] unit-test - [ { 106 106 } ] [ "s" get viewport>> viewport-dim ] unit-test + [ { 107 107 } ] [ "s" get viewport>> viewport-dim ] unit-test [ ] [ { 0 0 } "s" get scroll ] unit-test [ { 0 0 } ] [ "s" get model>> range-min-value ] unit-test - [ { 106 106 } ] [ "s" get model>> range-max-value ] unit-test + [ { 107 107 } ] [ "s" get model>> range-max-value ] unit-test [ ] [ { 10 20 } "s" get scroll ] unit-test @@ -57,7 +57,7 @@ IN: ui.gadgets.scrollers.tests [ { 10 20 } ] [ "s" get viewport>> model>> range-value ] unit-test - [ { 10 20 } ] [ "g" get rect-loc vneg { 3 3 } v+ ] unit-test + [ { 10 20 } ] [ "g" get rect-loc vneg viewport-gap v+ scroller-border v+ ] unit-test ] with-grafted-gadget { 600 400 } >>dim "g1" set @@ -102,7 +102,7 @@ dup layout swap dup quot>> call dup layout model>> dependencies>> [ range-max value>> ] map - viewport-gap 2 v*n = + viewport-padding = ] unit-test \ must-infer diff --git a/basis/validators/validators-docs.factor b/basis/validators/validators-docs.factor index 67c9f4fceb..8f5a587569 100644 --- a/basis/validators/validators-docs.factor +++ b/basis/validators/validators-docs.factor @@ -3,7 +3,7 @@ strings math regexp regexp.backend ; IN: validators HELP: v-checkbox -{ $values { "str" string } } +{ $values { "str" string } { "?" "a boolean" } } { $description "Converts the string value of a checkbox component (either \"on\" or \"off\") to a boolean value." } ; HELP: v-captcha diff --git a/basis/validators/validators.factor b/basis/validators/validators.factor index 04c85cd6db..e49f608e94 100644 --- a/basis/validators/validators.factor +++ b/basis/validators/validators.factor @@ -2,11 +2,11 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel continuations sequences math namespaces make sets math.parser math.ranges assocs regexp unicode.categories arrays -hashtables words classes quotations xmode.catalog ; +hashtables words classes quotations xmode.catalog unicode.case ; IN: validators : v-checkbox ( str -- ? ) - "on" = ; + >lower "on" = ; : v-default ( str def -- str/def ) over empty? spin ? ; diff --git a/basis/windows/kernel32/kernel32.factor b/basis/windows/kernel32/kernel32.factor index c38b5f94ca..731efa9b25 100755 --- a/basis/windows/kernel32/kernel32.factor +++ b/basis/windows/kernel32/kernel32.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2006 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.syntax kernel windows.types ; +USING: alien alien.syntax kernel windows.types multiline ; IN: windows.kernel32 CONSTANT: MAX_PATH 260 @@ -197,6 +197,19 @@ CONSTANT: THREAD_PRIORITY_LOWEST -2 CONSTANT: THREAD_PRIORITY_NORMAL 0 CONSTANT: THREAD_PRIORITY_TIME_CRITICAL 15 +C-ENUM: + ComputerNameNetBIOS + ComputerNameDnsHostname + ComputerNameDnsDomain + ComputerNameDnsFullyQualified + ComputerNamePhysicalNetBIOS + ComputerNamePhysicalDnsHostname + ComputerNamePhysicalDnsDomain + ComputerNamePhysicalDnsFullyQualified + ComputerNameMax ; + +TYPEDEF: uint COMPUTER_NAME_FORMAT + C-STRUCT: OVERLAPPED { "UINT_PTR" "internal" } { "UINT_PTR" "internal-high" } @@ -319,6 +332,249 @@ C-STRUCT: GUID { "WORD" "Data3" } { { "UCHAR" 8 } "Data4" } ; +/* + fBinary :1; + fParity :1; + fOutxCtsFlow :1; + fOutxDsrFlow :1; + fDtrControl :2; + fDsrSensitivity :1; + fTXContinueOnXoff :1; + fOutX :1; + fInX :1; + fErrorChar :1; + fNull :1; + fRtsControl :2; + fAbortOnError :1; + fDummy2 :17; +*/ + +CONSTANT: SP_SERIALCOMM HEX: 1 +CONSTANT: BAUD_075 HEX: 1 +CONSTANT: BAUD_110 HEX: 2 +CONSTANT: BAUD_134_5 HEX: 4 +CONSTANT: BAUD_150 HEX: 8 +CONSTANT: BAUD_300 HEX: 10 +CONSTANT: BAUD_600 HEX: 20 +CONSTANT: BAUD_1200 HEX: 40 +CONSTANT: BAUD_1800 HEX: 80 +CONSTANT: BAUD_2400 HEX: 100 +CONSTANT: BAUD_4800 HEX: 200 +CONSTANT: BAUD_7200 HEX: 400 +CONSTANT: BAUD_9600 HEX: 800 +CONSTANT: BAUD_14400 HEX: 1000 +CONSTANT: BAUD_19200 HEX: 2000 +CONSTANT: BAUD_38400 HEX: 4000 +CONSTANT: BAUD_56K HEX: 8000 +CONSTANT: BAUD_57600 HEX: 40000 +CONSTANT: BAUD_115200 HEX: 20000 +CONSTANT: BAUD_128K HEX: 10000 +CONSTANT: BAUD_USER HEX: 10000000 +CONSTANT: PST_FAX HEX: 21 +CONSTANT: PST_LAT HEX: 101 +CONSTANT: PST_MODEM HEX: 6 +CONSTANT: PST_NETWORK_BRIDGE HEX: 100 +CONSTANT: PST_PARALLELPORT HEX: 2 +CONSTANT: PST_RS232 HEX: 1 +CONSTANT: PST_RS422 HEX: 3 +CONSTANT: PST_RS423 HEX: 4 +CONSTANT: PST_RS449 HEX: 5 +CONSTANT: PST_SCANNER HEX: 22 +CONSTANT: PST_TCPIP_TELNET HEX: 102 +CONSTANT: PST_UNSPECIFIED 0 +CONSTANT: PST_X25 HEX: 103 +CONSTANT: PCF_16BITMODE HEX: 200 +CONSTANT: PCF_DTRDSR HEX: 1 +CONSTANT: PCF_INTTIMEOUTS HEX: 80 +CONSTANT: PCF_PARITY_CHECK HEX: 8 +CONSTANT: PCF_RLSD HEX: 4 +CONSTANT: PCF_RTSCTS HEX: 2 +CONSTANT: PCF_SETXCHAR HEX: 20 +CONSTANT: PCF_SPECIALCHARS HEX: 100 +CONSTANT: PCF_TOTALTIMEOUTS HEX: 40 +CONSTANT: PCF_XONXOFF HEX: 10 +CONSTANT: SP_BAUD HEX: 2 +CONSTANT: SP_DATABITS HEX: 4 +CONSTANT: SP_HANDSHAKING HEX: 10 +CONSTANT: SP_PARITY HEX: 1 +CONSTANT: SP_PARITY_CHECK HEX: 20 +CONSTANT: SP_RLSD HEX: 40 +CONSTANT: SP_STOPBITS HEX: 8 +CONSTANT: DATABITS_5 1 +CONSTANT: DATABITS_6 2 +CONSTANT: DATABITS_7 4 +CONSTANT: DATABITS_8 8 +CONSTANT: DATABITS_16 16 +CONSTANT: DATABITS_16X 32 +CONSTANT: STOPBITS_10 1 +CONSTANT: STOPBITS_15 2 +CONSTANT: STOPBITS_20 4 +CONSTANT: PARITY_NONE 256 +CONSTANT: PARITY_ODD 512 +CONSTANT: PARITY_EVEN 1024 +CONSTANT: PARITY_MARK 2048 +CONSTANT: PARITY_SPACE 4096 +CONSTANT: COMMPROP_INITIALIZED HEX: e73cf52e + +CONSTANT: CBR_110 110 +CONSTANT: CBR_300 300 +CONSTANT: CBR_600 600 +CONSTANT: CBR_1200 1200 +CONSTANT: CBR_2400 2400 +CONSTANT: CBR_4800 4800 +CONSTANT: CBR_9600 9600 +CONSTANT: CBR_14400 14400 +CONSTANT: CBR_19200 19200 +CONSTANT: CBR_38400 38400 +CONSTANT: CBR_56000 56000 +CONSTANT: CBR_57600 57600 +CONSTANT: CBR_115200 115200 +CONSTANT: CBR_128000 128000 +CONSTANT: CBR_256000 256000 +CONSTANT: DTR_CONTROL_DISABLE 0 +CONSTANT: DTR_CONTROL_ENABLE 1 +CONSTANT: DTR_CONTROL_HANDSHAKE 2 +CONSTANT: RTS_CONTROL_DISABLE 0 +CONSTANT: RTS_CONTROL_ENABLE 1 +CONSTANT: RTS_CONTROL_HANDSHAKE 2 +CONSTANT: RTS_CONTROL_TOGGLE 3 +CONSTANT: EVENPARITY 2 +CONSTANT: MARKPARITY 3 +CONSTANT: NOPARITY 0 +CONSTANT: ODDPARITY 1 +CONSTANT: SPACEPARITY 4 +CONSTANT: ONESTOPBIT 0 +CONSTANT: ONE5STOPBITS 1 +CONSTANT: TWOSTOPBITS 2 + +! Flowcontrol bit mask in DCB +CONSTANT: FM_fBinary HEX: 1 +CONSTANT: FM_fParity HEX: 2 +CONSTANT: FM_fOutxCtsFlow HEX: 4 +CONSTANT: FM_fOutxDsrFlow HEX: 8 +CONSTANT: FM_fDtrControl HEX: 30 +CONSTANT: FM_fDsrSensitivity HEX: 40 +CONSTANT: FM_fTXContinueOnXoff HEX: 80 +CONSTANT: FM_fOutX HEX: 100 +CONSTANT: FM_fInX HEX: 200 +CONSTANT: FM_fErrorChar HEX: 400 +CONSTANT: FM_fNull HEX: 800 +CONSTANT: FM_fRtsControl HEX: 3000 +CONSTANT: FM_fAbortOnError HEX: 4000 +CONSTANT: FM_fDummy2 HEX: ffff8000 + +CONSTANT: BM_fCtsHold HEX: 1 +CONSTANT: BM_fDsrHold HEX: 2 +CONSTANT: BM_fRlsdHold HEX: 4 +CONSTANT: BM_fXoffHold HEX: 8 +CONSTANT: BM_fXoffSent HEX: 10 +CONSTANT: BM_fEof HEX: 20 +CONSTANT: BM_fTxim HEX: 40 +CONSTANT: BM_AllBits HEX: 7f + +! PurgeComm bit mask +CONSTANT: PURGE_TXABORT HEX: 1 +CONSTANT: PURGE_RXABORT HEX: 2 +CONSTANT: PURGE_TXCLEAR HEX: 4 +CONSTANT: PURGE_RXCLEAR HEX: 8 + +! GetCommModemStatus bit mask +CONSTANT: MS_CTS_ON HEX: 10 +CONSTANT: MS_DSR_ON HEX: 20 +CONSTANT: MS_RING_ON HEX: 40 +CONSTANT: MS_RLSD_ON HEX: 80 + +! EscapeCommFunction operations +CONSTANT: SETXOFF HEX: 1 +CONSTANT: SETXON HEX: 2 +CONSTANT: SETRTS HEX: 3 +CONSTANT: CLRRTS HEX: 4 +CONSTANT: SETDTR HEX: 5 +CONSTANT: CLRDTR HEX: 6 +CONSTANT: SETBREAK HEX: 8 +CONSTANT: CLRBREAK HEX: 9 + +! ClearCommError bit mask +CONSTANT: CE_RXOVER HEX: 1 +CONSTANT: CE_OVERRUN HEX: 2 +CONSTANT: CE_RXPARITY HEX: 4 +CONSTANT: CE_FRAME HEX: 8 +CONSTANT: CE_BREAK HEX: 10 +CONSTANT: CE_TXFULL HEX: 100 +! LPT only +CONSTANT: CE_PTO HEX: 200 +CONSTANT: CE_IOE HEX: 400 +CONSTANT: CE_DNS HEX: 800 +CONSTANT: CE_OOP HEX: 1000 +! LPT only +CONSTANT: CE_MODE HEX: 8000 + +! GetCommMask bits +CONSTANT: EV_RXCHAR HEX: 1 +CONSTANT: EV_RXFLAG HEX: 2 +CONSTANT: EV_TXEMPTY HEX: 4 +CONSTANT: EV_CTS HEX: 8 +CONSTANT: EV_DSR HEX: 10 +CONSTANT: EV_RLSD HEX: 20 +CONSTANT: EV_BREAK HEX: 40 +CONSTANT: EV_ERR HEX: 80 +CONSTANT: EV_RING HEX: 100 +CONSTANT: EV_PERR HEX: 200 +CONSTANT: EV_RX80FULL HEX: 400 +CONSTANT: EV_EVENT1 HEX: 800 +CONSTANT: EV_EVENT2 HEX: 1000 + +C-STRUCT: DCB + { "DWORD" "DCBlength" } + { "DWORD" "BaudRate" } + { "DWORD" "flags" } + { "WORD" "wReserved" } + { "WORD" "XonLim" } + { "WORD" "XoffLim" } + { "BYTE" "ByteSize" } + { "BYTE" "Parity" } + { "BYTE" "StopBits" } + { "char" "XonChar" } + { "char" "XoffChar" } + { "char" "ErrorChar" } + { "char" "EofChar" } + { "char" "EvtChar" } + { "WORD" "wReserved1" } ; +TYPEDEF: DCB* PDCB +TYPEDEF: DCB* LPDCB + +C-STRUCT: COMM_CONFIG + { "DWORD" "dwSize" } + { "WORD" "wVersion" } + { "WORD" "wReserved" } + { "DCB" "dcb" } + { "DWORD" "dwProviderSubType" } + { "DWORD" "dwProviderOffset" } + { "DWORD" "dwProviderSize" } + { { "WCHAR" 1 } "wcProviderData" } ; +TYPEDEF: COMMCONFIG* LPCOMMCONFIG + +C-STRUCT: COMMPROP + { "WORD" "wPacketLength" } + { "WORD" "wPacketVersion" } + { "DWORD" "dwServiceMask" } + { "DWORD" "dwReserved1" } + { "DWORD" "dwMaxTxQueue" } + { "DWORD" "dwMaxRxQueue" } + { "DWORD" "dwMaxBaud" } + { "DWORD" "dwProvSubType" } + { "DWORD" "dwProvCapabilities" } + { "DWORD" "dwSettableParams" } + { "DWORD" "dwSettableBaud" } + { "WORD" "wSettableData" } + { "WORD" "wSettableStopParity" } + { "DWORD" "dwCurrentTxQueue" } + { "DWORD" "dwCurrentRxQueue" } + { "DWORD" "dwProvSpec1" } + { "DWORD" "dwProvSpec2" } + { { "WCHAR" 1 } "wcProvChar" } ; +TYPEDEF: COMMPROP* LPCOMMPROP + CONSTANT: SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege" CONSTANT: SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege" @@ -875,19 +1131,19 @@ ALIAS: FreeEnvironmentStrings FreeEnvironmentStringsW ! FUNCTION: GetCalendarInfoW ! FUNCTION: GetCommandLineA ! FUNCTION: GetCommandLineW -! FUNCTION: GetCommConfig -! FUNCTION: GetCommMask -! FUNCTION: GetCommModemStatus -! FUNCTION: GetCommProperties -! FUNCTION: GetCommState +FUNCTION: BOOL GetCommConfig ( HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) ; +FUNCTION: BOOL GetCommMask ( HANDLE hFile, LPDWORD lpEvtMask ) ; +FUNCTION: BOOL GetCommModemStatus ( HANDLE hFile, LPDWORD lpModemStat ) ; +FUNCTION: BOOL GetCommProperties ( HANDLE hFile, LPCOMMPROP lpCommProp ) ; +FUNCTION: BOOL GetCommState ( HANDLE hFile, LPDCB lpDCB ) ; ! FUNCTION: GetCommTimeouts ! FUNCTION: GetComPlusPackageInstallStatus ! FUNCTION: GetCompressedFileSizeA ! FUNCTION: GetCompressedFileSizeW FUNCTION: BOOL GetComputerNameW ( LPTSTR lpBuffer, LPDWORD lpnSize ) ; -! FUNCTION: GetComputerNameExW -! FUNCTION: GetComputerNameW ALIAS: GetComputerName GetComputerNameW +FUNCTION: BOOL GetComputerNameExW ( COMPUTER_NAME_FORMAT NameType, LPTSTR lpBuffer, LPDWORD lpnSize ) ; +ALIAS: GetComputerNameEx GetComputerNameExW ! FUNCTION: GetConsoleAliasA ! FUNCTION: GetConsoleAliasesA ! FUNCTION: GetConsoleAliasesLengthA @@ -942,7 +1198,8 @@ FUNCTION: HANDLE GetCurrentThread ( ) ; ! FUNCTION: GetDateFormatA ! FUNCTION: GetDateFormatW ! FUNCTION: GetDefaultCommConfigA -! FUNCTION: GetDefaultCommConfigW +FUNCTION: BOOL GetDefaultCommConfigW ( LPCTSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) ; +ALIAS: GetDefaultCommConfig GetDefaultCommConfigW ! FUNCTION: GetDefaultSortkeySize ! FUNCTION: GetDevicePowerState ! FUNCTION: GetDiskFreeSpaceA @@ -1400,10 +1657,10 @@ ALIAS: RemoveDirectory RemoveDirectoryW ! FUNCTION: SetCalendarInfoA ! FUNCTION: SetCalendarInfoW ! FUNCTION: SetClientTimeZoneInformation -! FUNCTION: SetCommBreak -! FUNCTION: SetCommConfig -! FUNCTION: SetCommMask -! FUNCTION: SetCommState +FUNCTION: BOOL SetCommBreak ( HANDLE hFile ) ; +FUNCTION: BOOL SetCommConfig ( HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize ) ; +FUNCTION: BOOL SetCommMask ( HANDLE hFile, DWORD dwEvtMask ) ; +FUNCTION: BOOL SetCommState ( HANDLE hFile, LPDCB lpDCB ) ; ! FUNCTION: SetCommTimeouts ! FUNCTION: SetComPlusPackageInstallStatus ! FUNCTION: SetComputerNameA @@ -1446,7 +1703,8 @@ ALIAS: SetConsoleTitle SetConsoleTitleW FUNCTION: BOOL SetCurrentDirectoryW ( LPCWSTR lpDirectory ) ; ALIAS: SetCurrentDirectory SetCurrentDirectoryW ! FUNCTION: SetDefaultCommConfigA -! FUNCTION: SetDefaultCommConfigW +FUNCTION: BOOL SetDefaultCommConfigW ( LPCTSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) ; +ALIAS: SetDefaultCommConfig SetDefaultCommConfigW ! FUNCTION: SetDllDirectoryA ! FUNCTION: SetDllDirectoryW FUNCTION: BOOL SetEndOfFile ( HANDLE hFile ) ; diff --git a/extra/git-tool/git-tool.factor b/extra/git-tool/git-tool.factor index 1b079ed0ac..ff45d32c65 100644 --- a/extra/git-tool/git-tool.factor +++ b/extra/git-tool/git-tool.factor @@ -1,13 +1,13 @@ USING: accessors combinators.cleave combinators.short-circuit concurrency.combinators destructors fry io io.directories -io.encodings io.encodings.utf8 io.launcher io.pathnames -io.pipes io.ports kernel locals math namespaces sequences -splitting strings ui ui.gadgets ui.gadgets.buttons -ui.gadgets.editors ui.gadgets.labels ui.gadgets.packs -ui.gadgets.tracks ; +io.encodings io.encodings.utf8 io.launcher io.monitors +io.pathnames io.pipes io.ports kernel locals math namespaces +sequences splitting strings threads ui ui.gadgets +ui.gadgets.buttons ui.gadgets.editors ui.gadgets.labels +ui.gadgets.packs ui.gadgets.tracks ; -IN: git-status +IN: git-tool ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -116,11 +116,11 @@ TUPLE: ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -:: refresh-git-status ( GIT-STATUS -- GIT-STATUS ) +:: refresh-git-status ( STATUS -- STATUS ) - [let | LINES [ GIT-STATUS repository>> "git-status" git-process stdout>> ] | + [let | LINES [ STATUS repository>> { "git" "status" } git-process stdout>> ] | - GIT-STATUS + STATUS LINES "# Changes to be committed:" git-status-section [ "new file:" head? ] filter @@ -269,7 +269,7 @@ TUPLE: "Diff" [ drop - STATUS repository>> { "git-diff" PATH } git-process + STATUS repository>> { "git" "diff" PATH } git-process popup-process-window ] add-gadget @@ -320,7 +320,7 @@ TUPLE: ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :: git-remote-branches ( REPO NAME -- seq ) - REPO { "git-remote" "show" NAME } git-process stdout>> + REPO { "git" "remote" "show" NAME } git-process stdout>> " Tracked remote branches" over index 1 + tail first " " split [ empty? not ] filter ; @@ -334,7 +334,7 @@ TUPLE: "Remotes"