Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2009-02-22 19:52:06 -06:00
commit 0c090699c2
117 changed files with 1774 additions and 1911 deletions

View File

@ -170,8 +170,8 @@ M: character-type (fortran-type>c-type)
: (parse-fortran-type) ( fortran-type-string -- type ) : (parse-fortran-type) ( fortran-type-string -- type )
parse-out swap parse-dims swap parse-size swap parse-out swap parse-dims swap parse-size swap
dup >lower fortran>c-types at* >lower fortran>c-types ?at
[ nip new-fortran-type ] [ drop misc-type boa ] if ; [ new-fortran-type ] [ misc-type boa ] if ;
: parse-fortran-type ( fortran-type-string/f -- type/f ) : parse-fortran-type ( fortran-type-string/f -- type/f )
dup [ (parse-fortran-type) ] when ; dup [ (parse-fortran-type) ] when ;

View File

@ -77,20 +77,20 @@ SYMBOL: objects
! Constants ! Constants
: image-magic HEX: 0f0e0d0c ; inline CONSTANT: image-magic HEX: 0f0e0d0c
: image-version 4 ; inline CONSTANT: image-version 4
: data-base 1024 ; inline CONSTANT: data-base 1024
: userenv-size 70 ; inline CONSTANT: userenv-size 70
: header-size 10 ; inline CONSTANT: header-size 10
: data-heap-size-offset 3 ; inline CONSTANT: data-heap-size-offset 3
: t-offset 6 ; inline CONSTANT: t-offset 6
: 0-offset 7 ; inline CONSTANT: 0-offset 7
: 1-offset 8 ; inline CONSTANT: 1-offset 8
: -1-offset 9 ; inline CONSTANT: -1-offset 9
SYMBOL: sub-primitives SYMBOL: sub-primitives

View File

@ -61,7 +61,7 @@ PRIVATE>
: month-abbreviation ( n -- string ) : month-abbreviation ( n -- string )
check-month 1- month-abbreviations nth ; check-month 1- month-abbreviations nth ;
: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 } ; inline CONSTANT: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 }
: day-names ( -- array ) : day-names ( -- array )
{ {

View File

@ -6,7 +6,7 @@ IN: checksums.adler-32
SINGLETON: adler-32 SINGLETON: adler-32
: adler-32-modulus 65521 ; inline CONSTANT: adler-32-modulus 65521
M: adler-32 checksum-bytes ( bytes checksum -- value ) M: adler-32 checksum-bytes ( bytes checksum -- value )
drop drop

View File

@ -9,14 +9,14 @@ IN: checksums.sha2
SYMBOLS: vars M K H S0 S1 process-M word-size block-size ; SYMBOLS: vars M K H S0 S1 process-M word-size block-size ;
: a 0 ; inline CONSTANT: a 0
: b 1 ; inline CONSTANT: b 1
: c 2 ; inline CONSTANT: c 2
: d 3 ; inline CONSTANT: d 3
: e 4 ; inline CONSTANT: e 4
: f 5 ; inline CONSTANT: f 5
: g 6 ; inline CONSTANT: g 6
: h 7 ; inline CONSTANT: h 7
: initial-H-256 ( -- seq ) : initial-H-256 ( -- seq )
{ {

View File

@ -5,7 +5,7 @@ sequences vectors fry libc destructors
specialized-arrays.direct.alien ; specialized-arrays.direct.alien ;
IN: cocoa.enumeration IN: cocoa.enumeration
: NS-EACH-BUFFER-SIZE 16 ; inline CONSTANT: NS-EACH-BUFFER-SIZE 16
: with-enumeration-buffers ( quot -- ) : with-enumeration-buffers ( quot -- )
[ [

View File

@ -4,15 +4,15 @@ USING: arrays kernel math cocoa cocoa.messages cocoa.classes
sequences math.bitwise ; sequences math.bitwise ;
IN: cocoa.windows IN: cocoa.windows
: NSBorderlessWindowMask 0 ; inline CONSTANT: NSBorderlessWindowMask 0
: NSTitledWindowMask 1 ; inline CONSTANT: NSTitledWindowMask 1
: NSClosableWindowMask 2 ; inline CONSTANT: NSClosableWindowMask 2
: NSMiniaturizableWindowMask 4 ; inline CONSTANT: NSMiniaturizableWindowMask 4
: NSResizableWindowMask 8 ; inline CONSTANT: NSResizableWindowMask 8
: NSBackingStoreRetained 0 ; inline CONSTANT: NSBackingStoreRetained 0
: NSBackingStoreNonretained 1 ; inline CONSTANT: NSBackingStoreNonretained 1
: NSBackingStoreBuffered 2 ; inline CONSTANT: NSBackingStoreBuffered 2
: standard-window-type ( -- n ) : standard-window-type ( -- n )
{ {

View File

@ -18,16 +18,16 @@ M: color red>> ( color -- red ) >rgba red>> ;
M: color green>> ( color -- green ) >rgba green>> ; M: color green>> ( color -- green ) >rgba green>> ;
M: color blue>> ( color -- blue ) >rgba blue>> ; M: color blue>> ( color -- blue ) >rgba blue>> ;
: black T{ rgba f 0.0 0.0 0.0 1.0 } ; inline CONSTANT: black T{ rgba f 0.0 0.0 0.0 1.0 }
: blue T{ rgba f 0.0 0.0 1.0 1.0 } ; inline CONSTANT: blue T{ rgba f 0.0 0.0 1.0 1.0 }
: cyan T{ rgba f 0 0.941 0.941 1 } ; inline CONSTANT: cyan T{ rgba f 0 0.941 0.941 1 }
: gray T{ rgba f 0.6 0.6 0.6 1.0 } ; inline CONSTANT: gray T{ rgba f 0.6 0.6 0.6 1.0 }
: green T{ rgba f 0.0 1.0 0.0 1.0 } ; inline CONSTANT: green T{ rgba f 0.0 1.0 0.0 1.0 }
: light-gray T{ rgba f 0.95 0.95 0.95 0.95 } ; inline CONSTANT: light-gray T{ rgba f 0.95 0.95 0.95 0.95 }
: light-purple T{ rgba f 0.8 0.8 1.0 1.0 } ; inline CONSTANT: light-purple T{ rgba f 0.8 0.8 1.0 1.0 }
: magenta T{ rgba f 0.941 0 0.941 1 } ; inline CONSTANT: magenta T{ rgba f 0.941 0 0.941 1 }
: orange T{ rgba f 0.941 0.627 0 1 } ; inline CONSTANT: orange T{ rgba f 0.941 0.627 0 1 }
: purple T{ rgba f 0.627 0 0.941 1 } ; inline CONSTANT: purple T{ rgba f 0.627 0 0.941 1 }
: red T{ rgba f 1.0 0.0 0.0 1.0 } ; inline CONSTANT: red T{ rgba f 1.0 0.0 0.0 1.0 }
: white T{ rgba f 1.0 1.0 1.0 1.0 } ; inline CONSTANT: white T{ rgba f 1.0 1.0 1.0 1.0 }
: yellow T{ rgba f 1.0 1.0 0.0 1.0 } ; inline CONSTANT: yellow T{ rgba f 1.0 1.0 0.0 1.0 }

View File

@ -4,8 +4,8 @@ USING: math kernel layouts system strings ;
IN: compiler.constants IN: compiler.constants
! These constants must match vm/memory.h ! These constants must match vm/memory.h
: card-bits 8 ; inline CONSTANT: card-bits 8
: deck-bits 18 ; inline CONSTANT: deck-bits 18
: card-mark ( -- n ) HEX: 40 HEX: 80 bitor ; inline : card-mark ( -- n ) HEX: 40 HEX: 80 bitor ; inline
! These constants must match vm/layouts.h ! These constants must match vm/layouts.h
@ -26,25 +26,25 @@ IN: compiler.constants
: compiled-header-size ( -- n ) 4 bootstrap-cells ; inline : compiled-header-size ( -- n ) 4 bootstrap-cells ; inline
! Relocation classes ! Relocation classes
: rc-absolute-cell 0 ; inline CONSTANT: rc-absolute-cell 0
: rc-absolute 1 ; inline CONSTANT: rc-absolute 1
: rc-relative 2 ; inline CONSTANT: rc-relative 2
: rc-absolute-ppc-2/2 3 ; inline CONSTANT: rc-absolute-ppc-2/2 3
: rc-relative-ppc-2 4 ; inline CONSTANT: rc-relative-ppc-2 4
: rc-relative-ppc-3 5 ; inline CONSTANT: rc-relative-ppc-3 5
: rc-relative-arm-3 6 ; inline CONSTANT: rc-relative-arm-3 6
: rc-indirect-arm 7 ; inline CONSTANT: rc-indirect-arm 7
: rc-indirect-arm-pc 8 ; inline CONSTANT: rc-indirect-arm-pc 8
! Relocation types ! Relocation types
: rt-primitive 0 ; inline CONSTANT: rt-primitive 0
: rt-dlsym 1 ; inline CONSTANT: rt-dlsym 1
: rt-dispatch 2 ; inline CONSTANT: rt-dispatch 2
: rt-xt 3 ; inline CONSTANT: rt-xt 3
: rt-here 4 ; inline CONSTANT: rt-here 4
: rt-label 5 ; inline CONSTANT: rt-label 5
: rt-immediate 6 ; inline CONSTANT: rt-immediate 6
: rt-stack-chain 7 ; inline CONSTANT: rt-stack-chain 7
: rc-absolute? ( n -- ? ) : rc-absolute? ( n -- ? )
[ rc-absolute-ppc-2/2 = ] [ rc-absolute-ppc-2/2 = ]

View File

@ -32,9 +32,9 @@ literal?
length length
slots ; slots ;
: null-info T{ value-info f null empty-interval } ; inline CONSTANT: null-info T{ value-info f null empty-interval }
: object-info T{ value-info f object full-interval } ; inline CONSTANT: object-info T{ value-info f object full-interval }
: class-interval ( class -- interval ) : class-interval ( class -- interval )
dup real class<= dup real class<=

View File

@ -69,11 +69,11 @@ ERROR: index-too-big n ;
: omega-k-in-table? ( lzw -- ? ) : omega-k-in-table? ( lzw -- ? )
[ omega-k>> ] [ table>> ] bi key? ; [ omega-k>> ] [ table>> ] bi key? ;
ERROR: not-in-table ; ERROR: not-in-table value ;
: write-output ( lzw -- ) : write-output ( lzw -- )
[ [
[ omega>> ] [ table>> ] bi at* [ not-in-table ] unless [ omega>> ] [ table>> ] bi ?at [ not-in-table ] unless
] [ ] [
[ lzw-bit-width-compress ] [ lzw-bit-width-compress ]
[ output>> write-bits ] bi [ output>> write-bits ] bi

View File

@ -6,7 +6,7 @@ IN: core-foundation
TYPEDEF: void* CFTypeRef TYPEDEF: void* CFTypeRef
TYPEDEF: void* CFAllocatorRef TYPEDEF: void* CFAllocatorRef
: kCFAllocatorDefault f ; inline CONSTANT: kCFAllocatorDefault f
TYPEDEF: bool Boolean TYPEDEF: bool Boolean
TYPEDEF: long CFIndex TYPEDEF: long CFIndex

View File

@ -10,28 +10,28 @@ TYPEDEF: void* CFNumberRef
TYPEDEF: void* CFSetRef TYPEDEF: void* CFSetRef
TYPEDEF: int CFNumberType TYPEDEF: int CFNumberType
: kCFNumberSInt8Type 1 ; inline CONSTANT: kCFNumberSInt8Type 1
: kCFNumberSInt16Type 2 ; inline CONSTANT: kCFNumberSInt16Type 2
: kCFNumberSInt32Type 3 ; inline CONSTANT: kCFNumberSInt32Type 3
: kCFNumberSInt64Type 4 ; inline CONSTANT: kCFNumberSInt64Type 4
: kCFNumberFloat32Type 5 ; inline CONSTANT: kCFNumberFloat32Type 5
: kCFNumberFloat64Type 6 ; inline CONSTANT: kCFNumberFloat64Type 6
: kCFNumberCharType 7 ; inline CONSTANT: kCFNumberCharType 7
: kCFNumberShortType 8 ; inline CONSTANT: kCFNumberShortType 8
: kCFNumberIntType 9 ; inline CONSTANT: kCFNumberIntType 9
: kCFNumberLongType 10 ; inline CONSTANT: kCFNumberLongType 10
: kCFNumberLongLongType 11 ; inline CONSTANT: kCFNumberLongLongType 11
: kCFNumberFloatType 12 ; inline CONSTANT: kCFNumberFloatType 12
: kCFNumberDoubleType 13 ; inline CONSTANT: kCFNumberDoubleType 13
: kCFNumberCFIndexType 14 ; inline CONSTANT: kCFNumberCFIndexType 14
: kCFNumberNSIntegerType 15 ; inline CONSTANT: kCFNumberNSIntegerType 15
: kCFNumberCGFloatType 16 ; inline CONSTANT: kCFNumberCGFloatType 16
: kCFNumberMaxType 16 ; inline CONSTANT: kCFNumberMaxType 16
TYPEDEF: int CFPropertyListMutabilityOptions TYPEDEF: int CFPropertyListMutabilityOptions
: kCFPropertyListImmutable 0 ; inline CONSTANT: kCFPropertyListImmutable 0
: kCFPropertyListMutableContainers 1 ; inline CONSTANT: kCFPropertyListMutableContainers 1
: kCFPropertyListMutableContainersAndLeaves 2 ; inline CONSTANT: kCFPropertyListMutableContainersAndLeaves 2
FUNCTION: CFNumberRef CFNumberCreate ( CFAllocatorRef allocator, CFNumberType theType, void* valuePtr ) ; FUNCTION: CFNumberRef CFNumberCreate ( CFAllocatorRef allocator, CFNumberType theType, void* valuePtr ) ;

View File

@ -15,8 +15,8 @@ FUNCTION: CFFileDescriptorRef CFFileDescriptorCreate (
CFFileDescriptorContext* context CFFileDescriptorContext* context
) ; ) ;
: kCFFileDescriptorReadCallBack 1 ; inline CONSTANT: kCFFileDescriptorReadCallBack 1
: kCFFileDescriptorWriteCallBack 2 ; inline CONSTANT: kCFFileDescriptorWriteCallBack 2
FUNCTION: void CFFileDescriptorEnableCallBacks ( FUNCTION: void CFFileDescriptorEnableCallBacks (
CFFileDescriptorRef f, CFFileDescriptorRef f,

View File

@ -9,17 +9,17 @@ core-foundation core-foundation.run-loop core-foundation.strings
core-foundation.time ; core-foundation.time ;
IN: core-foundation.fsevents IN: core-foundation.fsevents
: kFSEventStreamCreateFlagUseCFTypes 2 ; inline CONSTANT: kFSEventStreamCreateFlagUseCFTypes 2
: kFSEventStreamCreateFlagWatchRoot 4 ; inline CONSTANT: kFSEventStreamCreateFlagWatchRoot 4
: kFSEventStreamEventFlagMustScanSubDirs 1 ; inline CONSTANT: kFSEventStreamEventFlagMustScanSubDirs 1
: kFSEventStreamEventFlagUserDropped 2 ; inline CONSTANT: kFSEventStreamEventFlagUserDropped 2
: kFSEventStreamEventFlagKernelDropped 4 ; inline CONSTANT: kFSEventStreamEventFlagKernelDropped 4
: kFSEventStreamEventFlagEventIdsWrapped 8 ; inline CONSTANT: kFSEventStreamEventFlagEventIdsWrapped 8
: kFSEventStreamEventFlagHistoryDone 16 ; inline CONSTANT: kFSEventStreamEventFlagHistoryDone 16
: kFSEventStreamEventFlagRootChanged 32 ; inline CONSTANT: kFSEventStreamEventFlagRootChanged 32
: kFSEventStreamEventFlagMount 64 ; inline CONSTANT: kFSEventStreamEventFlagMount 64
: kFSEventStreamEventFlagUnmount 128 ; inline CONSTANT: kFSEventStreamEventFlagUnmount 128
TYPEDEF: int FSEventStreamCreateFlags TYPEDEF: int FSEventStreamCreateFlags
TYPEDEF: int FSEventStreamEventFlags TYPEDEF: int FSEventStreamEventFlags
@ -36,7 +36,7 @@ C-STRUCT: FSEventStreamContext
! callback(FSEventStreamRef streamRef, void *clientCallBackInfo, size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]); ! callback(FSEventStreamRef streamRef, void *clientCallBackInfo, size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]);
TYPEDEF: void* FSEventStreamCallback TYPEDEF: void* FSEventStreamCallback
: FSEventStreamEventIdSinceNow HEX: FFFFFFFFFFFFFFFF ; inline CONSTANT: FSEventStreamEventIdSinceNow HEX: FFFFFFFFFFFFFFFF
FUNCTION: FSEventStreamRef FSEventStreamCreate ( FUNCTION: FSEventStreamRef FSEventStreamCreate (
CFAllocatorRef allocator, CFAllocatorRef allocator,

View File

@ -7,10 +7,10 @@ core-foundation.file-descriptors core-foundation.timers
core-foundation.time ; core-foundation.time ;
IN: core-foundation.run-loop IN: core-foundation.run-loop
: kCFRunLoopRunFinished 1 ; inline CONSTANT: kCFRunLoopRunFinished 1
: kCFRunLoopRunStopped 2 ; inline CONSTANT: kCFRunLoopRunStopped 2
: kCFRunLoopRunTimedOut 3 ; inline CONSTANT: kCFRunLoopRunTimedOut 3
: kCFRunLoopRunHandledSource 4 ; inline CONSTANT: kCFRunLoopRunHandledSource 4
TYPEDEF: void* CFRunLoopRef TYPEDEF: void* CFRunLoopRef
TYPEDEF: void* CFRunLoopSourceRef TYPEDEF: void* CFRunLoopSourceRef

View File

@ -4,7 +4,7 @@ USING: alien.syntax kernel core-foundation.strings
core-foundation ; core-foundation ;
IN: core-foundation.urls IN: core-foundation.urls
: kCFURLPOSIXPathStyle 0 ; inline CONSTANT: kCFURLPOSIXPathStyle 0
TYPEDEF: void* CFURLRef TYPEDEF: void* CFURLRef

View File

@ -27,8 +27,8 @@ M: ppc machine-registers
{ double-float-regs T{ range f 0 29 1 } } { double-float-regs T{ range f 0 29 1 } }
} ; } ;
: scratch-reg 28 ; inline CONSTANT: scratch-reg 28
: fp-scratch-reg 30 ; inline CONSTANT: fp-scratch-reg 30
M: ppc two-operand? f ; M: ppc two-operand? f ;
@ -40,8 +40,8 @@ M: ppc %load-reference ( reg obj -- )
M: ppc %alien-global ( register symbol dll -- ) M: ppc %alien-global ( register symbol dll -- )
[ 0 swap LOAD32 ] 2dip rc-absolute-ppc-2/2 rel-dlsym ; [ 0 swap LOAD32 ] 2dip rc-absolute-ppc-2/2 rel-dlsym ;
: ds-reg 29 ; inline CONSTANT: ds-reg 29
: rs-reg 30 ; inline CONSTANT: rs-reg 30
GENERIC: loc-reg ( loc -- reg ) GENERIC: loc-reg ( loc -- reg )

View File

@ -1,18 +1,54 @@
! 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: kernel ; USING: accessors kernel continuations fry words ;
IN: db.errors IN: db.errors
ERROR: db-error ; ERROR: db-error ;
ERROR: sql-error ; ERROR: sql-error location ;
ERROR: table-exists ;
ERROR: bad-schema ; ERROR: bad-schema ;
ERROR: sql-syntax-error error ; ERROR: sql-unknown-error < sql-error message ;
: <sql-unknown-error> ( message -- error )
\ sql-unknown-error new
swap >>message ;
ERROR: sql-table-exists table ; ERROR: sql-table-exists < sql-error table ;
C: <sql-table-exists> sql-table-exists : <sql-table-exists> ( table -- error )
\ sql-table-exists new
swap >>table ;
ERROR: sql-table-missing table ; ERROR: sql-table-missing < sql-error table ;
C: <sql-table-missing> sql-table-missing : <sql-table-missing> ( table -- error )
\ sql-table-missing new
swap >>table ;
ERROR: sql-syntax-error < sql-error message ;
: <sql-syntax-error> ( message -- error )
\ sql-syntax-error new
swap >>message ;
ERROR: sql-function-exists < sql-error message ;
: <sql-function-exists> ( message -- error )
\ sql-function-exists new
swap >>message ;
ERROR: sql-function-missing < sql-error message ;
: <sql-function-missing> ( message -- error )
\ sql-function-missing new
swap >>message ;
: ignore-error ( quot word -- )
'[ dup _ execute [ drop ] [ rethrow ] if ] recover ; inline
: ignore-table-exists ( quot -- )
\ sql-table-exists? ignore-error ; inline
: ignore-table-missing ( quot -- )
\ sql-table-missing? ignore-error ; inline
: ignore-function-exists ( quot -- )
\ sql-function-exists? ignore-error ; inline
: ignore-function-missing ( quot -- )
\ sql-function-missing? ignore-error ; inline

View File

@ -1,4 +1,32 @@
! Copyright (C) 2009 Doug Coleman. ! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test db.errors.postgresql ; USING: accessors combinators.short-circuit db db.errors
db.errors.postgresql db.postgresql io.files.unique kernel namespaces
tools.test db.tester continuations ;
IN: db.errors.postgresql.tests IN: db.errors.postgresql.tests
postgresql-test-db [
[ "drop table foo;" sql-command ] ignore-errors
[ "drop table ship;" sql-command ] ignore-errors
[
"insert into foo (id) values('1');" sql-command
] [
{ [ sql-table-missing? ] [ table>> "foo" = ] } 1&&
] must-fail-with
[
"create table ship(id integer);" sql-command
"create table ship(id integer);" sql-command
] [
{ [ sql-table-exists? ] [ table>> "ship" = ] } 1&&
] must-fail-with
[
"create table foo(id) lol;" sql-command
] [
sql-syntax-error?
] must-fail-with
] with-db

View File

@ -1,4 +1,53 @@
! Copyright (C) 2009 Doug Coleman. ! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: ; USING: kernel db.errors peg.ebnf strings sequences math
combinators.short-circuit accessors math.parser quoting ;
IN: db.errors.postgresql IN: db.errors.postgresql
EBNF: parse-postgresql-sql-error
Error = "ERROR:" [ ]+
TableError =
Error ("relation "|"table ")(!(" already exists").)+:table " already exists"
=> [[ table >string unquote <sql-table-exists> ]]
| Error ("relation "|"table ")(!(" does not exist").)+:table " does not exist"
=> [[ table >string unquote <sql-table-missing> ]]
FunctionError =
Error "function" (!(" already exists").)+:table " already exists"
=> [[ table >string <sql-function-exists> ]]
| Error "function" (!(" does not exist").)+:table " does not exist"
=> [[ table >string <sql-function-missing> ]]
SyntaxError =
Error "syntax error at end of input":error
=> [[ error >string <sql-syntax-error> ]]
| Error "syntax error at or near " .+:syntaxerror
=> [[ syntaxerror >string unquote <sql-syntax-error> ]]
UnknownError = .* => [[ >string <sql-unknown-error> ]]
PostgresqlSqlError = (TableError | FunctionError | SyntaxError | UnknownError)
;EBNF
ERROR: parse-postgresql-location column line text ;
C: <parse-postgresql-location> parse-postgresql-location
EBNF: parse-postgresql-line-error
Line = "LINE " [0-9]+:line ": " .+:sql
=> [[ f line >string string>number sql >string <parse-postgresql-location> ]]
;EBNF
:: set-caret-position ( error caret-line -- error )
caret-line length
error line>> number>string length "LINE : " length +
- [ error ] dip >>column ;
: postgresql-location ( line column -- obj )
[ parse-postgresql-line-error ] dip
set-caret-position ;

View File

@ -1,15 +1,8 @@
USING: kernel db.postgresql alien continuations io classes USING: kernel db.postgresql alien continuations io classes
prettyprint sequences namespaces tools.test db db.private prettyprint sequences namespaces tools.test db db.private
db.tuples db.types unicode.case accessors system ; db.tuples db.types unicode.case accessors system db.tester ;
IN: db.postgresql.tests IN: db.postgresql.tests
: postgresql-test-db ( -- postgresql-db )
<postgresql-db>
"localhost" >>host
"postgres" >>username
"thepasswordistrust" >>password
"factor-test" >>database ;
os windows? cpu x86.64? and [ os windows? cpu x86.64? and [
[ ] [ postgresql-test-db [ ] with-db ] unit-test [ ] [ postgresql-test-db [ ] with-db ] unit-test

View File

@ -6,7 +6,7 @@ sequences debugger db db.postgresql.lib db.postgresql.ffi
db.tuples db.types tools.annotations math.ranges db.tuples db.types tools.annotations math.ranges
combinators classes locals words tools.walker db.private combinators classes locals words tools.walker db.private
nmake accessors random db.queries destructors db.tuples.private nmake accessors random db.queries destructors db.tuples.private
db.postgresql ; db.postgresql db.errors.postgresql splitting ;
IN: db.postgresql IN: db.postgresql
TUPLE: postgresql-db host port pgopts pgtty database username password ; TUPLE: postgresql-db host port pgopts pgtty database username password ;
@ -282,4 +282,12 @@ M: postgresql-db-connection compound ( string object -- string' )
} case ; } case ;
M: postgresql-db-connection parse-db-error M: postgresql-db-connection parse-db-error
; "\n" split dup length {
{ 1 [ first parse-postgresql-sql-error ] }
{ 3 [
first3
[ parse-postgresql-sql-error ] 2dip
postgresql-location >>location
] }
} case ;

View File

@ -11,12 +11,17 @@ IN: db.sqlite.lib
ERROR: sqlite-error < db-error n string ; ERROR: sqlite-error < db-error n string ;
ERROR: sqlite-sql-error < sql-error n string ; ERROR: sqlite-sql-error < sql-error n string ;
: <sqlite-sql-error> ( n string -- error )
\ sqlite-sql-error new
swap >>string
swap >>n ;
: throw-sqlite-error ( n -- * ) : throw-sqlite-error ( n -- * )
dup sqlite-error-messages nth sqlite-error ; dup sqlite-error-messages nth sqlite-error ;
: sqlite-statement-error ( -- * ) : sqlite-statement-error ( -- * )
SQLITE_ERROR SQLITE_ERROR
db-connection get handle>> sqlite3_errmsg sqlite-sql-error ; db-connection get handle>> sqlite3_errmsg <sqlite-sql-error> throw ;
: sqlite-check-result ( n -- ) : sqlite-check-result ( n -- )
{ {

View File

@ -2,9 +2,42 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: concurrency.combinators db.pools db.sqlite db.tuples USING: concurrency.combinators db.pools db.sqlite db.tuples
db.types kernel math random threads tools.test db sequences db.types kernel math random threads tools.test db sequences
io prettyprint ; io prettyprint db.postgresql db.sqlite accessors io.files.temp
namespaces fry system ;
IN: db.tester IN: db.tester
: postgresql-test-db ( -- postgresql-db )
<postgresql-db>
"localhost" >>host
"postgres" >>username
"thepasswordistrust" >>password
"factor-test" >>database ;
: sqlite-test-db ( -- sqlite-db )
"tuples-test.db" temp-file <sqlite-db> ;
! These words leak resources, but are useful for interactivel testing
: set-sqlite-db ( -- )
sqlite-db db-open db-connection set ;
: set-postgresql-db ( -- )
postgresql-db db-open db-connection set ;
: test-sqlite ( quot -- )
'[
[ ] [ sqlite-test-db _ with-db ] unit-test
] call ; inline
: test-postgresql ( quot -- )
'[
os windows? cpu x86.64? and [
[ ] [ postgresql-test-db _ with-db ] unit-test
] unless
] call ; inline
TUPLE: test-1 id a b c ; TUPLE: test-1 id a b c ;
test-1 "TEST1" { test-1 "TEST1" {
@ -23,9 +56,6 @@ test-2 "TEST2" {
{ "z" "Z" { VARCHAR 256 } +not-null+ } { "z" "Z" { VARCHAR 256 } +not-null+ }
} define-persistent } define-persistent
: sqlite-test-db ( -- db ) "test.db" <sqlite-db> ;
: test-db ( -- db ) "test.db" <sqlite-db> ;
: db-tester ( test-db -- ) : db-tester ( test-db -- )
[ [
[ [

View File

@ -4,40 +4,10 @@ USING: io.files io.files.temp kernel tools.test db db.tuples classes
db.types continuations namespaces math math.ranges db.types continuations namespaces math math.ranges
prettyprint calendar sequences db.sqlite math.intervals prettyprint calendar sequences db.sqlite math.intervals
db.postgresql accessors random math.bitwise system db.postgresql accessors random math.bitwise system
math.ranges strings urls fry db.tuples.private db.private ; math.ranges strings urls fry db.tuples.private db.private
db.tester ;
IN: db.tuples.tests IN: db.tuples.tests
: sqlite-db ( -- sqlite-db )
"tuples-test.db" temp-file <sqlite-db> ;
: test-sqlite ( quot -- )
'[
[ ] [
"tuples-test.db" temp-file <sqlite-db> _ with-db
] unit-test
] call ; inline
: postgresql-db ( -- postgresql-db )
<postgresql-db>
"localhost" >>host
"postgres" >>username
"thepasswordistrust" >>password
"factor-test" >>database ;
: test-postgresql ( quot -- )
'[
os windows? cpu x86.64? and [
[ ] [ postgresql-db _ with-db ] unit-test
] unless
] call ; inline
! These words leak resources, but are useful for interactivel testing
: sqlite-test-db ( -- )
sqlite-db db-open db-connection set ;
: postgresql-test-db ( -- )
postgresql-db db-open db-connection set ;
TUPLE: person the-id the-name the-number the-real TUPLE: person the-id the-name the-number the-real
ts date time blob factor-blob url ; ts date time blob factor-blob url ;

View File

@ -4,7 +4,7 @@ USING: arrays assocs classes db kernel namespaces
classes.tuple words sequences slots math accessors classes.tuple words sequences slots math accessors
math.parser io prettyprint db.types continuations math.parser io prettyprint db.types continuations
destructors mirrors sets db.types db.private fry destructors mirrors sets db.types db.private fry
combinators.short-circuit ; combinators.short-circuit db.errors ;
IN: db.tuples IN: db.tuples
HOOK: create-sql-statement db-connection ( class -- object ) HOOK: create-sql-statement db-connection ( class -- object )
@ -118,13 +118,15 @@ ERROR: no-defined-persistent object ;
ensure-defined-persistent ensure-defined-persistent
[ [
'[ '[
_ drop-sql-statement [ execute-statement ] with-disposals [
] ignore-errors _ drop-sql-statement [ execute-statement ] with-disposals
] ignore-table-missing
] ignore-function-missing
] [ create-table ] bi ; ] [ create-table ] bi ;
: ensure-table ( class -- ) : ensure-table ( class -- )
ensure-defined-persistent ensure-defined-persistent
'[ _ create-table ] ignore-errors ; '[ [ _ create-table ] ignore-table-exists ] ignore-function-exists ;
: ensure-tables ( classes -- ) [ ensure-table ] each ; : ensure-tables ( classes -- ) [ ensure-table ] each ;

View File

@ -124,9 +124,6 @@ FACTOR-BLOB NULL URL ;
! PostgreSQL Types: ! PostgreSQL Types:
! http://developer.postgresql.org/pgdocs/postgres/datatype.html ! http://developer.postgresql.org/pgdocs/postgres/datatype.html
: ?at ( obj assoc -- value/obj ? )
dupd at* [ [ nip ] [ drop ] if ] keep ;
ERROR: unknown-modifier modifier ; ERROR: unknown-modifier modifier ;
: lookup-modifier ( obj -- string ) : lookup-modifier ( obj -- string )

View File

@ -54,7 +54,7 @@ M: no-article summary
drop "Help article does not exist" ; drop "Help article does not exist" ;
: article ( name -- article ) : article ( name -- article )
dup articles get at* [ nip ] [ drop no-article ] if ; articles get ?at [ no-article ] unless ;
M: object article-name article article-name ; M: object article-name article article-name ;
M: object article-title article article-title ; M: object article-title article article-title ;

View File

@ -243,9 +243,6 @@ ERROR: bad-tiff-magic bytes ;
ERROR: no-tag class ; ERROR: no-tag class ;
: ?at ( key assoc -- value/key ? )
dupd at* [ nip t ] [ drop f ] if ; inline
: find-tag ( idf class -- tag ) : find-tag ( idf class -- tag )
swap processed-tags>> ?at [ no-tag ] unless ; swap processed-tags>> ?at [ no-tag ] unless ;

View File

@ -114,21 +114,21 @@ M: file-info file-mode? [ permissions>> ] dip mask? ;
PRIVATE> PRIVATE>
: UID OCT: 0004000 ; inline CONSTANT: UID OCT: 0004000
: GID OCT: 0002000 ; inline CONSTANT: GID OCT: 0002000
: STICKY OCT: 0001000 ; inline CONSTANT: STICKY OCT: 0001000
: USER-ALL OCT: 0000700 ; inline CONSTANT: USER-ALL OCT: 0000700
: USER-READ OCT: 0000400 ; inline CONSTANT: USER-READ OCT: 0000400
: USER-WRITE OCT: 0000200 ; inline CONSTANT: USER-WRITE OCT: 0000200
: USER-EXECUTE OCT: 0000100 ; inline CONSTANT: USER-EXECUTE OCT: 0000100
: GROUP-ALL OCT: 0000070 ; inline CONSTANT: GROUP-ALL OCT: 0000070
: GROUP-READ OCT: 0000040 ; inline CONSTANT: GROUP-READ OCT: 0000040
: GROUP-WRITE OCT: 0000020 ; inline CONSTANT: GROUP-WRITE OCT: 0000020
: GROUP-EXECUTE OCT: 0000010 ; inline CONSTANT: GROUP-EXECUTE OCT: 0000010
: OTHER-ALL OCT: 0000007 ; inline CONSTANT: OTHER-ALL OCT: 0000007
: OTHER-READ OCT: 0000004 ; inline CONSTANT: OTHER-READ OCT: 0000004
: OTHER-WRITE OCT: 0000002 ; inline CONSTANT: OTHER-WRITE OCT: 0000002
: OTHER-EXECUTE OCT: 0000001 ; inline CONSTANT: OTHER-EXECUTE OCT: 0000001
: uid? ( obj -- ? ) UID file-mode? ; : uid? ( obj -- ? ) UID file-mode? ;
: gid? ( obj -- ? ) GID file-mode? ; : gid? ( obj -- ? ) GID file-mode? ;

View File

@ -94,7 +94,7 @@ M: unix (datagram)
SYMBOL: receive-buffer SYMBOL: receive-buffer
: packet-size 65536 ; inline CONSTANT: packet-size 65536
[ packet-size malloc receive-buffer set-global ] "io.sockets.unix" add-init-hook [ packet-size malloc receive-buffer set-global ] "io.sockets.unix" add-init-hook

View File

@ -19,8 +19,8 @@ IN: math.bitwise.tests
[ 268 ] [ 1 { 8 { 3 2 } } bitfield ] unit-test [ 268 ] [ 1 { 8 { 3 2 } } bitfield ] unit-test
[ 512 ] [ 1 { { 1+ 8 } } bitfield ] unit-test [ 512 ] [ 1 { { 1+ 8 } } bitfield ] unit-test
: a 1 ; inline CONSTANT: a 1
: b 2 ; inline CONSTANT: b 2
: foo ( -- flags ) { a b } flags ; : foo ( -- flags ) { a b } flags ;

View File

@ -3,7 +3,8 @@
USING: multiline kernel sequences io splitting fry namespaces USING: multiline kernel sequences io splitting fry namespaces
http.parsers hashtables assocs combinators ascii io.files.unique http.parsers hashtables assocs combinators ascii io.files.unique
accessors io.encodings.binary io.files byte-arrays math accessors io.encodings.binary io.files byte-arrays math
io.streams.string combinators.short-circuit strings math.order ; io.streams.string combinators.short-circuit strings math.order
quoting ;
IN: mime.multipart IN: mime.multipart
CONSTANT: buffer-size 65536 CONSTANT: buffer-size 65536
@ -75,18 +76,6 @@ ERROR: end-of-stream multipart ;
: empty-name? ( string -- ? ) : empty-name? ( string -- ? )
{ "''" "\"\"" "" f } member? ; { "''" "\"\"" "" f } member? ;
: quote? ( ch -- ? ) "'\"" member? ;
: quoted? ( str -- ? )
{
[ length 1 > ]
[ first quote? ]
[ [ first ] [ peek ] bi = ]
} 1&& ;
: unquote ( str -- newstr )
dup quoted? [ but-last-slice rest-slice >string ] when ;
: save-uploaded-file ( multipart -- ) : save-uploaded-file ( multipart -- )
dup filename>> empty-name? [ dup filename>> empty-name? [
drop drop

View File

@ -48,14 +48,14 @@ C-STRUCT: bio
{ "void*" "crypto-ex-data-stack" } { "void*" "crypto-ex-data-stack" }
{ "int" "crypto-ex-data-dummy" } ; { "int" "crypto-ex-data-dummy" } ;
: BIO_NOCLOSE HEX: 00 ; inline CONSTANT: BIO_NOCLOSE HEX: 00
: BIO_CLOSE HEX: 01 ; inline CONSTANT: BIO_CLOSE HEX: 01
: RSA_3 HEX: 3 ; inline CONSTANT: RSA_3 HEX: 3
: RSA_F4 HEX: 10001 ; inline CONSTANT: RSA_F4 HEX: 10001
: BIO_C_SET_SSL 109 ; inline CONSTANT: BIO_C_SET_SSL 109
: BIO_C_GET_SSL 110 ; inline CONSTANT: BIO_C_GET_SSL 110
LIBRARY: libcrypto LIBRARY: libcrypto

View File

@ -20,7 +20,7 @@ TUPLE: persistent-vector
M: persistent-vector length count>> ; M: persistent-vector length count>> ;
: node-size 32 ; inline CONSTANT: node-size 32
: node-mask ( m -- n ) node-size mod ; inline : node-mask ( m -- n ) node-size mod ; inline

View File

@ -0,0 +1,32 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax strings ;
IN: quoting
HELP: quote?
{ $values
{ "ch" "a character" }
{ "?" "a boolean" }
}
{ $description "Returns true if the character is a single or double quote." } ;
HELP: quoted?
{ $values
{ "str" string }
{ "?" "a boolean" }
}
{ $description "Returns true if a string is surrounded by matching single or double quotes as the first and last characters." } ;
HELP: unquote
{ $values
{ "str" string }
{ "newstr" string }
}
{ $description "Removes a pair of matching single or double quotes from a string." } ;
ARTICLE: "quoting" "Quotation marks"
"The " { $vocab-link "quoting" } " vocabulary is for removing quotes from a string." $nl
"Removing quotes:"
{ $subsection unquote } ;
ABOUT: "quoting"

View File

@ -0,0 +1,10 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test quoting ;
IN: quoting.tests
[ "abc" ] [ "'abc'" unquote ] unit-test
[ "abc" ] [ "\"abc\"" unquote ] unit-test
[ "'abc" ] [ "'abc" unquote ] unit-test
[ "abc'" ] [ "abc'" unquote ] unit-test

View File

@ -0,0 +1,16 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.short-circuit kernel math sequences strings ;
IN: quoting
: quote? ( ch -- ? ) "'\"" member? ;
: quoted? ( str -- ? )
{
[ length 1 > ]
[ first quote? ]
[ [ first ] [ peek ] bi = ]
} 1&& ;
: unquote ( str -- newstr )
dup quoted? [ but-last-slice rest-slice >string ] when ;

View File

@ -11,9 +11,9 @@ IN: random.mersenne-twister
TUPLE: mersenne-twister { seq uint-array } { i fixnum } ; TUPLE: mersenne-twister { seq uint-array } { i fixnum } ;
: n 624 ; inline CONSTANT: n 624
: m 397 ; inline CONSTANT: m 397
: a uint-array{ 0 HEX: 9908b0df } ; inline CONSTANT: a uint-array{ 0 HEX: 9908b0df }
: y ( n seq -- y ) : y ( n seq -- y )
[ nth-unsafe 31 mask-bit ] [ nth-unsafe 31 mask-bit ]

View File

@ -105,7 +105,7 @@ IN: stack-checker.transforms
] 1 define-transform ] 1 define-transform
! Membership testing ! Membership testing
: bit-member-n 256 ; inline CONSTANT: bit-member-n 256
: bit-member? ( seq -- ? ) : bit-member? ( seq -- ? )
#! Can we use a fast byte array test here? #! Can we use a fast byte array test here?

View File

@ -24,10 +24,10 @@ FUNCTION: void ud_translate_att ( ud* u ) ;
: UD_SYN_INTEL ( -- addr ) &: ud_translate_intel ; inline : UD_SYN_INTEL ( -- addr ) &: ud_translate_intel ; inline
: UD_SYN_ATT ( -- addr ) &: ud_translate_att ; inline : UD_SYN_ATT ( -- addr ) &: ud_translate_att ; inline
: UD_EOI -1 ; inline CONSTANT: UD_EOI -1
: UD_INP_CACHE_SZ 32 ; inline CONSTANT: UD_INP_CACHE_SZ 32
: UD_VENDOR_AMD 0 ; inline CONSTANT: UD_VENDOR_AMD 0
: UD_VENDOR_INTEL 1 ; inline CONSTANT: UD_VENDOR_INTEL 1
FUNCTION: void ud_init ( ud* u ) ; FUNCTION: void ud_init ( ud* u ) ;
FUNCTION: void ud_set_mode ( ud* u, uint8_t mode ) ; FUNCTION: void ud_set_mode ( ud* u, uint8_t mode ) ;

View File

@ -1,6 +1,6 @@
! 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: help.markup help.syntax kernel strings words ; USING: help.markup help.syntax kernel strings words vocabs ;
IN: tools.scaffold IN: tools.scaffold
HELP: developer-name HELP: developer-name
@ -13,7 +13,7 @@ HELP: help.
{ $description "Prints out scaffold help markup for a given word." } ; { $description "Prints out scaffold help markup for a given word." } ;
HELP: scaffold-help HELP: scaffold-help
{ $values { "string" string } } { $values { "vocab" vocab } }
{ $description "Takes an existing vocabulary and creates a help file with scaffolded help for each word. This word only works if no help file yet exists." } ; { $description "Takes an existing vocabulary and creates a help file with scaffolded help for each word. This word only works if no help file yet exists." } ;
HELP: scaffold-undocumented HELP: scaffold-undocumented
@ -28,6 +28,21 @@ HELP: scaffold-vocab
{ "vocab-root" "a vocabulary root string" } { "string" string } } { "vocab-root" "a vocabulary root string" } { "string" string } }
{ $description "Creates a directory in the given root for a new vocabulary and adds a main .factor file, a tests file, and an authors.txt file." } ; { $description "Creates a directory in the given root for a new vocabulary and adds a main .factor file, a tests file, and an authors.txt file." } ;
HELP: scaffold-emacs
{ $description "Touches the .emacs file in your home directory and provides a clickable link to open it in an editor." } ;
HELP: scaffold-factor-boot-rc
{ $description "Touches the .factor-boot-rc file in your home directory and provides a clickable link to open it in an editor." } ;
HELP: scaffold-factor-rc
{ $description "Touches the .factor-rc file in your home directory and provides a clickable link to open it in an editor." } ;
HELP: scaffold-rc
{ $values
{ "path" "a pathname string" }
}
{ $description "Touches the given path in your home directory and provides a clickable link to open it in an editor." } ;
HELP: using HELP: using
{ $description "Stores the vocabularies that are pulled into the documentation file from looking up the stack effect types." } ; { $description "Stores the vocabularies that are pulled into the documentation file from looking up the stack effect types." } ;
@ -40,7 +55,12 @@ ARTICLE: "tools.scaffold" "Scaffold tool"
{ $subsection scaffold-help } { $subsection scaffold-help }
{ $subsection scaffold-undocumented } { $subsection scaffold-undocumented }
{ $subsection help. } { $subsection help. }
"Types that are unrecognized by the scaffold generator will be of type " { $link null } ". The developer should change these to strings that describe the stack effect names instead." "Types that are unrecognized by the scaffold generator will be of type " { $link null } ". The developer should change these to strings that describe the stack effect names instead." $nl
"Scaffolding a configuration file:"
{ $subsection scaffold-rc }
{ $subsection scaffold-factor-boot-rc }
{ $subsection scaffold-factor-rc }
{ $subsection scaffold-emacs }
; ;
ABOUT: "tools.scaffold" ABOUT: "tools.scaffold"

View File

@ -5,7 +5,7 @@ io.encodings.utf8 hashtables kernel namespaces sequences
vocabs.loader io combinators calendar accessors math.parser vocabs.loader io combinators calendar accessors math.parser
io.streams.string ui.tools.operations quotations strings arrays io.streams.string ui.tools.operations quotations strings arrays
prettyprint words vocabs sorting sets classes math alien urls prettyprint words vocabs sorting sets classes math alien urls
splitting ascii ; splitting ascii combinators.short-circuit ;
IN: tools.scaffold IN: tools.scaffold
SYMBOL: developer-name SYMBOL: developer-name
@ -18,37 +18,61 @@ ERROR: no-vocab vocab ;
<PRIVATE <PRIVATE
: root? ( string -- ? ) vocab-roots get member? ; : vocab-root? ( string -- ? ) vocab-roots get member? ;
: contains-dot? ( string -- ? ) ".." swap subseq? ; : contains-dot? ( string -- ? ) ".." swap subseq? ;
: contains-separator? ( string -- ? ) [ path-separator? ] any? ; : contains-separator? ( string -- ? ) [ path-separator? ] any? ;
: check-vocab-name ( string -- string ) : check-vocab-name ( string -- string )
dup contains-dot? [ vocab-name-contains-dot ] when [ ]
dup contains-separator? [ vocab-name-contains-separator ] when ; [ contains-dot? [ vocab-name-contains-dot ] when ]
[ contains-separator? [ vocab-name-contains-separator ] when ] tri ;
: check-root ( string -- string ) : check-root ( string -- string )
dup root? [ not-a-vocab-root ] unless ; dup vocab-root? [ not-a-vocab-root ] unless ;
: check-vocab ( vocab -- vocab )
dup find-vocab-root [ no-vocab ] unless ;
: check-vocab-root/vocab ( vocab-root string -- vocab-root string )
[ check-root ] [ check-vocab-name ] bi* ;
: replace-vocab-separators ( vocab -- path )
path-separator first CHAR: . associate substitute ; inline
: vocab-root/vocab>path ( vocab-root vocab -- path )
check-vocab-root/vocab
[ ] [ replace-vocab-separators ] bi* append-path ;
: vocab>path ( vocab -- path )
check-vocab
[ find-vocab-root ] keep vocab-root/vocab>path ;
: vocab-root/vocab/file>path ( vocab-root vocab file -- path )
[ vocab-root/vocab>path ] dip append-path ;
: vocab-root/vocab/suffix>path ( vocab-root vocab suffix -- path )
[ vocab-root/vocab>path dup file-name append-path ] dip append ;
: vocab/suffix>path ( vocab suffix -- path )
[ vocab>path dup file-name append-path ] dip append ;
: directory-exists ( path -- ) : directory-exists ( path -- )
"Not creating a directory, it already exists: " write print ; "Not creating a directory, it already exists: " write print ;
: scaffold-directory ( path -- ) : scaffold-directory ( vocab-root vocab -- )
vocab-root/vocab>path
dup exists? [ directory-exists ] [ make-directories ] if ; dup exists? [ directory-exists ] [ make-directories ] if ;
: not-scaffolding ( path -- ) : not-scaffolding ( path -- path )
"Not creating scaffolding for " write <pathname> . ; "Not creating scaffolding for " write dup <pathname> . ;
: scaffolding ( path -- ) : scaffolding ( path -- path )
"Creating scaffolding for " write <pathname> . ; "Creating scaffolding for " write dup <pathname> . ;
: (scaffold-path) ( path string -- path ) : scaffolding? ( path -- path ? )
dupd [ file-name ] dip append append-path ; dup exists? [ not-scaffolding f ] [ scaffolding t ] if ;
: scaffold-path ( path string -- path ? )
(scaffold-path)
dup exists? [ dup not-scaffolding f ] [ dup scaffolding t ] if ;
: scaffold-copyright ( -- ) : scaffold-copyright ( -- )
"! Copyright (C) " write now year>> number>string write "! Copyright (C) " write now year>> number>string write
@ -62,37 +86,25 @@ ERROR: no-vocab vocab ;
"IN: " write print "IN: " write print
] with-string-writer ; ] with-string-writer ;
: set-scaffold-main-file ( path vocab -- ) : set-scaffold-main-file ( vocab path -- )
main-file-string swap utf8 set-file-contents ; [ main-file-string ] dip utf8 set-file-contents ;
: scaffold-main ( path vocab -- ) : scaffold-main ( vocab-root vocab -- )
[ ".factor" scaffold-path ] dip tuck ".factor" vocab-root/vocab/suffix>path scaffolding? [
swap [ set-scaffold-main-file ] [ 2drop ] if ; set-scaffold-main-file
: tests-file-string ( vocab -- string )
[
scaffold-copyright
"USING: tools.test " write dup write " ;" print
"IN: " write write ".tests" print
] with-string-writer ;
: set-scaffold-tests-file ( path vocab -- )
tests-file-string swap utf8 set-file-contents ;
: scaffold-tests ( path vocab -- )
[ "-tests.factor" scaffold-path ] dip
swap [ set-scaffold-tests-file ] [ 2drop ] if ;
: scaffold-authors ( path -- )
"authors.txt" append-path dup exists? [
not-scaffolding
] [ ] [
dup scaffolding 2drop
developer-name get swap utf8 set-file-contents ] if ;
: scaffold-authors ( vocab-root vocab -- )
"authors.txt" vocab-root/vocab/file>path scaffolding? [
[ developer-name get ] dip utf8 set-file-contents
] [
drop
] if ; ] if ;
: lookup-type ( string -- object/string ? ) : lookup-type ( string -- object/string ? )
"new" ?head drop [ [ CHAR: ' = ] [ digit? ] bi or ] trim-tail "new" ?head drop [ { [ CHAR: ' = ] [ digit? ] } 1|| ] trim-tail
H{ H{
{ "object" object } { "obj" object } { "object" object } { "obj" object }
{ "quot" quotation } { "quot" quotation }
@ -134,6 +146,9 @@ ERROR: no-vocab vocab ;
" }" write " }" write
] each ; ] each ;
: 4bl ( -- )
" " write ; inline
: $values. ( word -- ) : $values. ( word -- )
"declared-effect" word-prop [ "declared-effect" word-prop [
[ in>> ] [ out>> ] bi [ in>> ] [ out>> ] bi
@ -141,8 +156,8 @@ ERROR: no-vocab vocab ;
2drop 2drop
] [ ] [
"{ $values" print "{ $values" print
[ " " write ($values.) ] [ 4bl ($values.) ]
[ [ nl " " write ($values.) ] unless-empty ] bi* [ [ nl 4bl ($values.) ] unless-empty ] bi*
nl "}" print nl "}" print
] if ] if
] when* ; ] when* ;
@ -151,21 +166,21 @@ ERROR: no-vocab vocab ;
drop drop
"{ $description \"\" } ;" print ; "{ $description \"\" } ;" print ;
: help-header. ( word -- ) : docs-header. ( word -- )
"HELP: " write name>> print ; "HELP: " write name>> print ;
: (help.) ( word -- ) : (help.) ( word -- )
[ help-header. ] [ $values. ] [ $description. ] tri ; [ docs-header. ] [ $values. ] [ $description. ] tri ;
: interesting-words ( vocab -- array ) : interesting-words ( vocab -- array )
words words
[ [ "help" word-prop ] [ predicate? ] bi or not ] filter [ { [ "help" word-prop ] [ predicate? ] } 1|| not ] filter
natural-sort ; natural-sort ;
: interesting-words. ( vocab -- ) : interesting-words. ( vocab -- )
interesting-words [ (help.) nl ] each ; interesting-words [ (help.) nl ] each ;
: help-file-string ( vocab -- str2 ) : docs-file-string ( vocab -- str2 )
[ [
{ {
[ "IN: " write print nl ] [ "IN: " write print nl ]
@ -186,62 +201,68 @@ ERROR: no-vocab vocab ;
[ bl write ] each [ bl write ] each
" ;" print ; " ;" print ;
: set-scaffold-help-file ( path vocab -- ) : set-scaffold-docs-file ( vocab path -- )
swap utf8 <file-writer> [ utf8 <file-writer> [
scaffold-copyright scaffold-copyright
[ help-file-string ] [ write-using ] bi [ docs-file-string ] [ write-using ] bi
write write
] with-output-stream ; ] with-output-stream ;
: check-scaffold ( vocab-root string -- vocab-root string )
[ check-root ] [ check-vocab-name ] bi* ;
: vocab>scaffold-path ( vocab-root string -- path )
path-separator first CHAR: . associate substitute
append-path ;
: prepare-scaffold ( vocab-root string -- string path )
check-scaffold [ vocab>scaffold-path ] keep ;
: with-scaffold ( quot -- ) : with-scaffold ( quot -- )
[ H{ } clone using ] dip with-variable ; inline [ H{ } clone using ] dip with-variable ; inline
: check-vocab ( vocab -- vocab )
dup find-vocab-root [ no-vocab ] unless ;
PRIVATE>
: link-vocab ( vocab -- ) : link-vocab ( vocab -- )
check-vocab check-vocab
"Edit documentation: " write "Edit documentation: " write
[ find-vocab-root ] "-docs.factor" vocab/suffix>path <pathname> . ;
[ vocab>scaffold-path ] bi
"-docs.factor" (scaffold-path) <pathname> . ; PRIVATE>
: help. ( word -- ) : help. ( word -- )
[ (help.) ] [ nl vocabulary>> link-vocab ] bi ; [ (help.) ] [ nl vocabulary>> link-vocab ] bi ;
: scaffold-help ( string -- ) : scaffold-help ( vocab -- )
[ [
[ find-vocab-root ] [ check-vocab ] bi dup "-docs.factor" vocab/suffix>path scaffolding? [
prepare-scaffold set-scaffold-docs-file
[ "-docs.factor" scaffold-path ] dip ] [
swap [ set-scaffold-help-file ] [ 2drop ] if 2drop
] if
] with-scaffold ; ] with-scaffold ;
: scaffold-undocumented ( string -- ) : scaffold-undocumented ( string -- )
[ interesting-words. ] [ link-vocab ] bi ; [ interesting-words. ] [ link-vocab ] bi ;
: scaffold-vocab ( vocab-root string -- ) : scaffold-vocab ( vocab-root string -- )
prepare-scaffold
{ {
[ drop scaffold-directory ] [ scaffold-directory ]
[ scaffold-main ] [ scaffold-main ]
[ scaffold-tests ] [ scaffold-authors ]
[ drop scaffold-authors ]
[ nip require ] [ nip require ]
} 2cleave ; } 2cleave ;
<PRIVATE
: tests-file-string ( vocab -- string )
[
scaffold-copyright
"USING: tools.test " write dup write " ;" print
"IN: " write write ".tests" print
] with-string-writer ;
: set-scaffold-tests-file ( vocab path -- )
[ tests-file-string ] dip utf8 set-file-contents ;
PRIVATE>
: scaffold-tests ( vocab -- )
dup "-tests.factor" vocab/suffix>path
scaffolding? [
set-scaffold-tests-file
] [
2drop
] if ;
SYMBOL: examples-flag SYMBOL: examples-flag
: example ( -- ) : example ( -- )
@ -250,7 +271,7 @@ SYMBOL: examples-flag
" \"\"" " \"\""
" \"\"" " \"\""
"}" "}"
} [ examples-flag get [ " " write ] when print ] each ; } [ examples-flag get [ 4bl ] when print ] each ;
: examples ( n -- ) : examples ( n -- )
t \ examples-flag [ t \ examples-flag [
@ -260,10 +281,11 @@ SYMBOL: examples-flag
] with-variable ; ] with-variable ;
: scaffold-rc ( path -- ) : scaffold-rc ( path -- )
[ home ] dip append-path
[ touch-file ] [ "Click to edit: " write <pathname> . ] bi ; [ touch-file ] [ "Click to edit: " write <pathname> . ] bi ;
: scaffold-factor-boot-rc ( -- ) : scaffold-factor-boot-rc ( -- ) ".factor-boot-rc" scaffold-rc ;
home ".factor-boot-rc" append-path scaffold-rc ;
: scaffold-factor-rc ( -- ) : scaffold-factor-rc ( -- ) ".factor-rc" scaffold-rc ;
home ".factor-rc" append-path scaffold-rc ;
: scaffold-emacs ( -- ) ".emacs" scaffold-rc ;

View File

@ -46,7 +46,7 @@ PRIVATE>
: group-name ( id -- string ) : group-name ( id -- string )
dup group-cache get [ dup group-cache get [
dupd at* [ name>> nip ] [ drop number>string ] if ?at [ name>> ] [ number>string ] if
] [ ] [
group-struct [ group-gr_name ] [ f ] if* group-struct [ group-gr_name ] [ f ] if*
] if* ] if*

View File

@ -6,8 +6,8 @@ cell-bits {
{ 64 [ "unix.stat.netbsd.64" require ] } { 64 [ "unix.stat.netbsd.64" require ] }
} case } case
: _VFS_NAMELEN 32 ; inline CONSTANT: _VFS_NAMELEN 32
: _VFS_MNAMELEN 1024 ; inline CONSTANT: _VFS_MNAMELEN 1024
C-STRUCT: statvfs C-STRUCT: statvfs
{ "ulong" "f_flag" } { "ulong" "f_flag" }

View File

@ -4,7 +4,7 @@ USING: arrays math kernel accessors sequences sequences.private
deques search-deques hashtables ; deques search-deques hashtables ;
IN: unrolled-lists IN: unrolled-lists
: unroll-factor 32 ; inline CONSTANT: unroll-factor 32
<PRIVATE <PRIVATE

View File

@ -1226,7 +1226,7 @@ FUNCTION: BOOL GetExitCodeProcess ( HANDLE hProcess, LPDWORD lpExitCode ) ;
FUNCTION: DWORD GetFileAttributesW ( LPCTSTR lpFileName ) ; FUNCTION: DWORD GetFileAttributesW ( LPCTSTR lpFileName ) ;
! FUNCTION: GetFileAttributesExA ! FUNCTION: GetFileAttributesExA
: GetFileExInfoStandard 0 ; inline CONSTANT: GetFileExInfoStandard 0
FUNCTION: BOOL GetFileAttributesExW ( LPCTSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ) ; FUNCTION: BOOL GetFileAttributesExW ( LPCTSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ) ;

View File

@ -20,61 +20,61 @@ FUNCTION: BOOL IsEqualGUID ( REFGUID rguid1, REFGUID rguid2 ) ;
FUNCTION: int StringFromGUID2 ( REFGUID rguid, LPOLESTR lpsz, int cchMax ) ; FUNCTION: int StringFromGUID2 ( REFGUID rguid, LPOLESTR lpsz, int cchMax ) ;
FUNCTION: HRESULT CLSIDFromString ( LPOLESTR lpsz, REFGUID out_rguid ) ; FUNCTION: HRESULT CLSIDFromString ( LPOLESTR lpsz, REFGUID out_rguid ) ;
: S_OK 0 ; inline CONSTANT: S_OK 0
: S_FALSE 1 ; inline CONSTANT: S_FALSE 1
: E_NOINTERFACE HEX: 80004002 ; inline CONSTANT: E_NOINTERFACE HEX: 80004002
: E_FAIL HEX: 80004005 ; inline CONSTANT: E_FAIL HEX: 80004005
: E_INVALIDARG HEX: 80070057 ; inline CONSTANT: E_INVALIDARG HEX: 80070057
: MK_ALT HEX: 20 ; inline CONSTANT: MK_ALT HEX: 20
: DROPEFFECT_NONE 0 ; inline CONSTANT: DROPEFFECT_NONE 0
: DROPEFFECT_COPY 1 ; inline CONSTANT: DROPEFFECT_COPY 1
: DROPEFFECT_MOVE 2 ; inline CONSTANT: DROPEFFECT_MOVE 2
: DROPEFFECT_LINK 4 ; inline CONSTANT: DROPEFFECT_LINK 4
: DROPEFFECT_SCROLL HEX: 80000000 ; inline CONSTANT: DROPEFFECT_SCROLL HEX: 80000000
: DD_DEFSCROLLINSET 11 ; inline CONSTANT: DD_DEFSCROLLINSET 11
: DD_DEFSCROLLDELAY 50 ; inline CONSTANT: DD_DEFSCROLLDELAY 50
: DD_DEFSCROLLINTERVAL 50 ; inline CONSTANT: DD_DEFSCROLLINTERVAL 50
: DD_DEFDRAGDELAY 200 ; inline CONSTANT: DD_DEFDRAGDELAY 200
: DD_DEFDRAGMINDIST 2 ; inline CONSTANT: DD_DEFDRAGMINDIST 2
: CF_TEXT 1 ; inline CONSTANT: CF_TEXT 1
: CF_BITMAP 2 ; inline CONSTANT: CF_BITMAP 2
: CF_METAFILEPICT 3 ; inline CONSTANT: CF_METAFILEPICT 3
: CF_SYLK 4 ; inline CONSTANT: CF_SYLK 4
: CF_DIF 5 ; inline CONSTANT: CF_DIF 5
: CF_TIFF 6 ; inline CONSTANT: CF_TIFF 6
: CF_OEMTEXT 7 ; inline CONSTANT: CF_OEMTEXT 7
: CF_DIB 8 ; inline CONSTANT: CF_DIB 8
: CF_PALETTE 9 ; inline CONSTANT: CF_PALETTE 9
: CF_PENDATA 10 ; inline CONSTANT: CF_PENDATA 10
: CF_RIFF 11 ; inline CONSTANT: CF_RIFF 11
: CF_WAVE 12 ; inline CONSTANT: CF_WAVE 12
: CF_UNICODETEXT 13 ; inline CONSTANT: CF_UNICODETEXT 13
: CF_ENHMETAFILE 14 ; inline CONSTANT: CF_ENHMETAFILE 14
: CF_HDROP 15 ; inline CONSTANT: CF_HDROP 15
: CF_LOCALE 16 ; inline CONSTANT: CF_LOCALE 16
: CF_MAX 17 ; inline CONSTANT: CF_MAX 17
: CF_OWNERDISPLAY HEX: 0080 ; inline CONSTANT: CF_OWNERDISPLAY HEX: 0080
: CF_DSPTEXT HEX: 0081 ; inline CONSTANT: CF_DSPTEXT HEX: 0081
: CF_DSPBITMAP HEX: 0082 ; inline CONSTANT: CF_DSPBITMAP HEX: 0082
: CF_DSPMETAFILEPICT HEX: 0083 ; inline CONSTANT: CF_DSPMETAFILEPICT HEX: 0083
: CF_DSPENHMETAFILE HEX: 008E ; inline CONSTANT: CF_DSPENHMETAFILE HEX: 008E
: DVASPECT_CONTENT 1 ; inline CONSTANT: DVASPECT_CONTENT 1
: DVASPECT_THUMBNAIL 2 ; inline CONSTANT: DVASPECT_THUMBNAIL 2
: DVASPECT_ICON 4 ; inline CONSTANT: DVASPECT_ICON 4
: DVASPECT_DOCPRINT 8 ; inline CONSTANT: DVASPECT_DOCPRINT 8
: TYMED_HGLOBAL 1 ; inline CONSTANT: TYMED_HGLOBAL 1
: TYMED_FILE 2 ; inline CONSTANT: TYMED_FILE 2
: TYMED_ISTREAM 4 ; inline CONSTANT: TYMED_ISTREAM 4
: TYMED_ISTORAGE 8 ; inline CONSTANT: TYMED_ISTORAGE 8
: TYMED_GDI 16 ; inline CONSTANT: TYMED_GDI 16
: TYMED_MFPICT 32 ; inline CONSTANT: TYMED_MFPICT 32
: TYMED_ENHMF 64 ; inline CONSTANT: TYMED_ENHMF 64
: TYMED_NULL 0 ; inline CONSTANT: TYMED_NULL 0
C-STRUCT: DVTARGETDEVICE C-STRUCT: DVTARGETDEVICE
{ "DWORD" "tdSize" } { "DWORD" "tdSize" }
@ -101,10 +101,10 @@ C-STRUCT: STGMEDIUM
{ "LPUNKNOWN" "punkForRelease" } ; { "LPUNKNOWN" "punkForRelease" } ;
TYPEDEF: STGMEDIUM* LPSTGMEDIUM TYPEDEF: STGMEDIUM* LPSTGMEDIUM
: COINIT_MULTITHREADED 0 ; inline CONSTANT: COINIT_MULTITHREADED 0
: COINIT_APARTMENTTHREADED 2 ; inline CONSTANT: COINIT_APARTMENTTHREADED 2
: COINIT_DISABLE_OLE1DDE 4 ; inline CONSTANT: COINIT_DISABLE_OLE1DDE 4
: COINIT_SPEED_OVER_MEMORY 8 ; inline CONSTANT: COINIT_SPEED_OVER_MEMORY 8
FUNCTION: HRESULT OleInitialize ( void* reserved ) ; FUNCTION: HRESULT OleInitialize ( void* reserved ) ;
FUNCTION: HRESULT CoInitializeEx ( void* reserved, DWORD dwCoInit ) ; FUNCTION: HRESULT CoInitializeEx ( void* reserved, DWORD dwCoInit ) ;

View File

@ -6,70 +6,70 @@ sequences libc ;
IN: windows.opengl32 IN: windows.opengl32
! PIXELFORMATDESCRIPTOR flags ! PIXELFORMATDESCRIPTOR flags
: PFD_DOUBLEBUFFER HEX: 00000001 ; inline CONSTANT: PFD_DOUBLEBUFFER HEX: 00000001
: PFD_STEREO HEX: 00000002 ; inline CONSTANT: PFD_STEREO HEX: 00000002
: PFD_DRAW_TO_WINDOW HEX: 00000004 ; inline CONSTANT: PFD_DRAW_TO_WINDOW HEX: 00000004
: PFD_DRAW_TO_BITMAP HEX: 00000008 ; inline CONSTANT: PFD_DRAW_TO_BITMAP HEX: 00000008
: PFD_SUPPORT_GDI HEX: 00000010 ; inline CONSTANT: PFD_SUPPORT_GDI HEX: 00000010
: PFD_SUPPORT_OPENGL HEX: 00000020 ; inline CONSTANT: PFD_SUPPORT_OPENGL HEX: 00000020
: PFD_GENERIC_FORMAT HEX: 00000040 ; inline CONSTANT: PFD_GENERIC_FORMAT HEX: 00000040
: PFD_NEED_PALETTE HEX: 00000080 ; inline CONSTANT: PFD_NEED_PALETTE HEX: 00000080
: PFD_NEED_SYSTEM_PALETTE HEX: 00000100 ; inline CONSTANT: PFD_NEED_SYSTEM_PALETTE HEX: 00000100
: PFD_SWAP_EXCHANGE HEX: 00000200 ; inline CONSTANT: PFD_SWAP_EXCHANGE HEX: 00000200
: PFD_SWAP_COPY HEX: 00000400 ; inline CONSTANT: PFD_SWAP_COPY HEX: 00000400
: PFD_SWAP_LAYER_BUFFERS HEX: 00000800 ; inline CONSTANT: PFD_SWAP_LAYER_BUFFERS HEX: 00000800
: PFD_GENERIC_ACCELERATED HEX: 00001000 ; inline CONSTANT: PFD_GENERIC_ACCELERATED HEX: 00001000
: PFD_SUPPORT_DIRECTDRAW HEX: 00002000 ; inline CONSTANT: PFD_SUPPORT_DIRECTDRAW HEX: 00002000
! PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only ! PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only
: PFD_DEPTH_DONTCARE HEX: 20000000 ; inline CONSTANT: PFD_DEPTH_DONTCARE HEX: 20000000
: PFD_DOUBLEBUFFER_DONTCARE HEX: 40000000 ; inline CONSTANT: PFD_DOUBLEBUFFER_DONTCARE HEX: 40000000
: PFD_STEREO_DONTCARE HEX: 80000000 ; inline CONSTANT: PFD_STEREO_DONTCARE HEX: 80000000
! pixel types ! pixel types
: PFD_TYPE_RGBA 0 ; inline CONSTANT: PFD_TYPE_RGBA 0
: PFD_TYPE_COLORINDEX 1 ; inline CONSTANT: PFD_TYPE_COLORINDEX 1
! layer types ! layer types
: PFD_MAIN_PLANE 0 ; inline CONSTANT: PFD_MAIN_PLANE 0
: PFD_OVERLAY_PLANE 1 ; inline CONSTANT: PFD_OVERLAY_PLANE 1
: PFD_UNDERLAY_PLANE -1 ; inline CONSTANT: PFD_UNDERLAY_PLANE -1
: LPD_TYPE_RGBA 0 ; inline CONSTANT: LPD_TYPE_RGBA 0
: LPD_TYPE_COLORINDEX 1 ; inline CONSTANT: LPD_TYPE_COLORINDEX 1
! wglSwapLayerBuffers flags ! wglSwapLayerBuffers flags
: WGL_SWAP_MAIN_PLANE HEX: 00000001 ; inline CONSTANT: WGL_SWAP_MAIN_PLANE HEX: 00000001
: WGL_SWAP_OVERLAY1 HEX: 00000002 ; inline CONSTANT: WGL_SWAP_OVERLAY1 HEX: 00000002
: WGL_SWAP_OVERLAY2 HEX: 00000004 ; inline CONSTANT: WGL_SWAP_OVERLAY2 HEX: 00000004
: WGL_SWAP_OVERLAY3 HEX: 00000008 ; inline CONSTANT: WGL_SWAP_OVERLAY3 HEX: 00000008
: WGL_SWAP_OVERLAY4 HEX: 00000010 ; inline CONSTANT: WGL_SWAP_OVERLAY4 HEX: 00000010
: WGL_SWAP_OVERLAY5 HEX: 00000020 ; inline CONSTANT: WGL_SWAP_OVERLAY5 HEX: 00000020
: WGL_SWAP_OVERLAY6 HEX: 00000040 ; inline CONSTANT: WGL_SWAP_OVERLAY6 HEX: 00000040
: WGL_SWAP_OVERLAY7 HEX: 00000080 ; inline CONSTANT: WGL_SWAP_OVERLAY7 HEX: 00000080
: WGL_SWAP_OVERLAY8 HEX: 00000100 ; inline CONSTANT: WGL_SWAP_OVERLAY8 HEX: 00000100
: WGL_SWAP_OVERLAY9 HEX: 00000200 ; inline CONSTANT: WGL_SWAP_OVERLAY9 HEX: 00000200
: WGL_SWAP_OVERLAY10 HEX: 00000400 ; inline CONSTANT: WGL_SWAP_OVERLAY10 HEX: 00000400
: WGL_SWAP_OVERLAY11 HEX: 00000800 ; inline CONSTANT: WGL_SWAP_OVERLAY11 HEX: 00000800
: WGL_SWAP_OVERLAY12 HEX: 00001000 ; inline CONSTANT: WGL_SWAP_OVERLAY12 HEX: 00001000
: WGL_SWAP_OVERLAY13 HEX: 00002000 ; inline CONSTANT: WGL_SWAP_OVERLAY13 HEX: 00002000
: WGL_SWAP_OVERLAY14 HEX: 00004000 ; inline CONSTANT: WGL_SWAP_OVERLAY14 HEX: 00004000
: WGL_SWAP_OVERLAY15 HEX: 00008000 ; inline CONSTANT: WGL_SWAP_OVERLAY15 HEX: 00008000
: WGL_SWAP_UNDERLAY1 HEX: 00010000 ; inline CONSTANT: WGL_SWAP_UNDERLAY1 HEX: 00010000
: WGL_SWAP_UNDERLAY2 HEX: 00020000 ; inline CONSTANT: WGL_SWAP_UNDERLAY2 HEX: 00020000
: WGL_SWAP_UNDERLAY3 HEX: 00040000 ; inline CONSTANT: WGL_SWAP_UNDERLAY3 HEX: 00040000
: WGL_SWAP_UNDERLAY4 HEX: 00080000 ; inline CONSTANT: WGL_SWAP_UNDERLAY4 HEX: 00080000
: WGL_SWAP_UNDERLAY5 HEX: 00100000 ; inline CONSTANT: WGL_SWAP_UNDERLAY5 HEX: 00100000
: WGL_SWAP_UNDERLAY6 HEX: 00200000 ; inline CONSTANT: WGL_SWAP_UNDERLAY6 HEX: 00200000
: WGL_SWAP_UNDERLAY7 HEX: 00400000 ; inline CONSTANT: WGL_SWAP_UNDERLAY7 HEX: 00400000
: WGL_SWAP_UNDERLAY8 HEX: 00800000 ; inline CONSTANT: WGL_SWAP_UNDERLAY8 HEX: 00800000
: WGL_SWAP_UNDERLAY9 HEX: 01000000 ; inline CONSTANT: WGL_SWAP_UNDERLAY9 HEX: 01000000
: WGL_SWAP_UNDERLAY10 HEX: 02000000 ; inline CONSTANT: WGL_SWAP_UNDERLAY10 HEX: 02000000
: WGL_SWAP_UNDERLAY11 HEX: 04000000 ; inline CONSTANT: WGL_SWAP_UNDERLAY11 HEX: 04000000
: WGL_SWAP_UNDERLAY12 HEX: 08000000 ; inline CONSTANT: WGL_SWAP_UNDERLAY12 HEX: 08000000
: WGL_SWAP_UNDERLAY13 HEX: 10000000 ; inline CONSTANT: WGL_SWAP_UNDERLAY13 HEX: 10000000
: WGL_SWAP_UNDERLAY14 HEX: 20000000 ; inline CONSTANT: WGL_SWAP_UNDERLAY14 HEX: 20000000
: WGL_SWAP_UNDERLAY15 HEX: 40000000 ; inline CONSTANT: WGL_SWAP_UNDERLAY15 HEX: 40000000
: windowed-pfd-dwFlags ( -- n ) : windowed-pfd-dwFlags ( -- n )
{ PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL PFD_DOUBLEBUFFER } flags ; { PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL PFD_DOUBLEBUFFER } flags ;

View File

@ -190,9 +190,9 @@ TYPEDEF: ITEMIDLIST ITEMID_CHILD
TYPEDEF: ITEMID_CHILD* PITEMID_CHILD TYPEDEF: ITEMID_CHILD* PITEMID_CHILD
TYPEDEF: ITEMID_CHILD* PCUITEMID_CHILD TYPEDEF: ITEMID_CHILD* PCUITEMID_CHILD
: STRRET_WSTR 0 ; inline CONSTANT: STRRET_WSTR 0
: STRRET_OFFSET 1 ; inline CONSTANT: STRRET_OFFSET 1
: STRRET_CSTR 2 ; inline CONSTANT: STRRET_CSTR 2
C-UNION: STRRET-union "LPWSTR" "LPSTR" "UINT" "char[260]" ; C-UNION: STRRET-union "LPWSTR" "LPSTR" "UINT" "char[260]" ;
C-STRUCT: STRRET C-STRUCT: STRRET

View File

@ -205,10 +205,10 @@ TYPEDEF: size_t socklen_t
TYPEDEF: void* WNDPROC TYPEDEF: void* WNDPROC
: FALSE 0 ; inline CONSTANT: FALSE 0
: TRUE 1 ; inline CONSTANT: TRUE 1
: >BOOLEAN ( ? -- 1/0 ) 1 0 ? ; inline : >BOOLEAN ( ? -- 1/0 ) TRUE FALSE ? ; inline
! typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM); ! typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);

View File

@ -150,377 +150,377 @@ CONSTANT: PM_NOYIELD 2
! !
! Standard Cursor IDs ! Standard Cursor IDs
! !
: IDC_ARROW 32512 ; inline CONSTANT: IDC_ARROW 32512
: IDC_IBEAM 32513 ; inline CONSTANT: IDC_IBEAM 32513
: IDC_WAIT 32514 ; inline CONSTANT: IDC_WAIT 32514
: IDC_CROSS 32515 ; inline CONSTANT: IDC_CROSS 32515
: IDC_UPARROW 32516 ; inline CONSTANT: IDC_UPARROW 32516
: IDC_SIZE 32640 ; inline ! OBSOLETE: use IDC_SIZEALL CONSTANT: IDC_SIZE 32640 ! OBSOLETE: use IDC_SIZEALL
: IDC_ICON 32641 ; inline ! OBSOLETE: use IDC_ARROW CONSTANT: IDC_ICON 32641 ! OBSOLETE: use IDC_ARROW
: IDC_SIZENWSE 32642 ; inline CONSTANT: IDC_SIZENWSE 32642
: IDC_SIZENESW 32643 ; inline CONSTANT: IDC_SIZENESW 32643
: IDC_SIZEWE 32644 ; inline CONSTANT: IDC_SIZEWE 32644
: IDC_SIZENS 32645 ; inline CONSTANT: IDC_SIZENS 32645
: IDC_SIZEALL 32646 ; inline CONSTANT: IDC_SIZEALL 32646
: IDC_NO 32648 ; inline ! not in win3.1 CONSTANT: IDC_NO 32648 ! not in win3.1
: IDC_HAND 32649 ; inline CONSTANT: IDC_HAND 32649
: IDC_APPSTARTING 32650 ; inline ! not in win3.1 CONSTANT: IDC_APPSTARTING 32650 ! not in win3.1
: IDC_HELP 32651 ; inline CONSTANT: IDC_HELP 32651
! Predefined Clipboard Formats ! Predefined Clipboard Formats
: CF_TEXT 1 ; inline CONSTANT: CF_TEXT 1
: CF_BITMAP 2 ; inline CONSTANT: CF_BITMAP 2
: CF_METAFILEPICT 3 ; inline CONSTANT: CF_METAFILEPICT 3
: CF_SYLK 4 ; inline CONSTANT: CF_SYLK 4
: CF_DIF 5 ; inline CONSTANT: CF_DIF 5
: CF_TIFF 6 ; inline CONSTANT: CF_TIFF 6
: CF_OEMTEXT 7 ; inline CONSTANT: CF_OEMTEXT 7
: CF_DIB 8 ; inline CONSTANT: CF_DIB 8
: CF_PALETTE 9 ; inline CONSTANT: CF_PALETTE 9
: CF_PENDATA 10 ; inline CONSTANT: CF_PENDATA 10
: CF_RIFF 11 ; inline CONSTANT: CF_RIFF 11
: CF_WAVE 12 ; inline CONSTANT: CF_WAVE 12
: CF_UNICODETEXT 13 ; inline CONSTANT: CF_UNICODETEXT 13
: CF_ENHMETAFILE 14 ; inline CONSTANT: CF_ENHMETAFILE 14
: CF_HDROP 15 ; inline CONSTANT: CF_HDROP 15
: CF_LOCALE 16 ; inline CONSTANT: CF_LOCALE 16
: CF_DIBV5 17 ; inline CONSTANT: CF_DIBV5 17
: CF_MAX 18 ; inline CONSTANT: CF_MAX 18
: CF_OWNERDISPLAY HEX: 0080 ; inline CONSTANT: CF_OWNERDISPLAY HEX: 0080
: CF_DSPTEXT HEX: 0081 ; inline CONSTANT: CF_DSPTEXT HEX: 0081
: CF_DSPBITMAP HEX: 0082 ; inline CONSTANT: CF_DSPBITMAP HEX: 0082
: CF_DSPMETAFILEPICT HEX: 0083 ; inline CONSTANT: CF_DSPMETAFILEPICT HEX: 0083
: CF_DSPENHMETAFILE HEX: 008E ; inline CONSTANT: CF_DSPENHMETAFILE HEX: 008E
! "Private" formats don't get GlobalFree()'d ! "Private" formats don't get GlobalFree()'d
: CF_PRIVATEFIRST HEX: 200 ; inline CONSTANT: CF_PRIVATEFIRST HEX: 200
: CF_PRIVATELAST HEX: 2FF ; inline CONSTANT: CF_PRIVATELAST HEX: 2FF
! "GDIOBJ" formats do get DeleteObject()'d ! "GDIOBJ" formats do get DeleteObject()'d
: CF_GDIOBJFIRST HEX: 300 ; inline CONSTANT: CF_GDIOBJFIRST HEX: 300
: CF_GDIOBJLAST HEX: 3FF ; inline CONSTANT: CF_GDIOBJLAST HEX: 3FF
! Virtual Keys, Standard Set ! Virtual Keys, Standard Set
: VK_LBUTTON HEX: 01 ; inline CONSTANT: VK_LBUTTON HEX: 01
: VK_RBUTTON HEX: 02 ; inline CONSTANT: VK_RBUTTON HEX: 02
: VK_CANCEL HEX: 03 ; inline CONSTANT: VK_CANCEL HEX: 03
: VK_MBUTTON HEX: 04 ; inline ! NOT contiguous with L & RBUTTON CONSTANT: VK_MBUTTON HEX: 04 ! NOT contiguous with L & RBUTTON
: VK_XBUTTON1 HEX: 05 ; inline ! NOT contiguous with L & RBUTTON CONSTANT: VK_XBUTTON1 HEX: 05 ! NOT contiguous with L & RBUTTON
: VK_XBUTTON2 HEX: 06 ; inline ! NOT contiguous with L & RBUTTON CONSTANT: VK_XBUTTON2 HEX: 06 ! NOT contiguous with L & RBUTTON
! 0x07 : unassigned ! 0x07 : unassigned
: VK_BACK HEX: 08 ; inline CONSTANT: VK_BACK HEX: 08
: VK_TAB HEX: 09 ; inline CONSTANT: VK_TAB HEX: 09
! 0x0A - 0x0B : reserved ! 0x0A - 0x0B : reserved
: VK_CLEAR HEX: 0C ; inline CONSTANT: VK_CLEAR HEX: 0C
: VK_RETURN HEX: 0D ; inline CONSTANT: VK_RETURN HEX: 0D
: VK_SHIFT HEX: 10 ; inline CONSTANT: VK_SHIFT HEX: 10
: VK_CONTROL HEX: 11 ; inline CONSTANT: VK_CONTROL HEX: 11
: VK_MENU HEX: 12 ; inline CONSTANT: VK_MENU HEX: 12
: VK_PAUSE HEX: 13 ; inline CONSTANT: VK_PAUSE HEX: 13
: VK_CAPITAL HEX: 14 ; inline CONSTANT: VK_CAPITAL HEX: 14
: VK_KANA HEX: 15 ; inline CONSTANT: VK_KANA HEX: 15
: VK_HANGEUL HEX: 15 ; inline ! old name - here for compatibility CONSTANT: VK_HANGEUL HEX: 15 ! old name - here for compatibility
: VK_HANGUL HEX: 15 ; inline CONSTANT: VK_HANGUL HEX: 15
: VK_JUNJA HEX: 17 ; inline CONSTANT: VK_JUNJA HEX: 17
: VK_FINAL HEX: 18 ; inline CONSTANT: VK_FINAL HEX: 18
: VK_HANJA HEX: 19 ; inline CONSTANT: VK_HANJA HEX: 19
: VK_KANJI HEX: 19 ; inline CONSTANT: VK_KANJI HEX: 19
: VK_ESCAPE HEX: 1B ; inline CONSTANT: VK_ESCAPE HEX: 1B
: VK_CONVERT HEX: 1C ; inline CONSTANT: VK_CONVERT HEX: 1C
: VK_NONCONVERT HEX: 1D ; inline CONSTANT: VK_NONCONVERT HEX: 1D
: VK_ACCEPT HEX: 1E ; inline CONSTANT: VK_ACCEPT HEX: 1E
: VK_MODECHANGE HEX: 1F ; inline CONSTANT: VK_MODECHANGE HEX: 1F
: VK_SPACE HEX: 20 ; inline CONSTANT: VK_SPACE HEX: 20
: VK_PRIOR HEX: 21 ; inline CONSTANT: VK_PRIOR HEX: 21
: VK_NEXT HEX: 22 ; inline CONSTANT: VK_NEXT HEX: 22
: VK_END HEX: 23 ; inline CONSTANT: VK_END HEX: 23
: VK_HOME HEX: 24 ; inline CONSTANT: VK_HOME HEX: 24
: VK_LEFT HEX: 25 ; inline CONSTANT: VK_LEFT HEX: 25
: VK_UP HEX: 26 ; inline CONSTANT: VK_UP HEX: 26
: VK_RIGHT HEX: 27 ; inline CONSTANT: VK_RIGHT HEX: 27
: VK_DOWN HEX: 28 ; inline CONSTANT: VK_DOWN HEX: 28
: VK_SELECT HEX: 29 ; inline CONSTANT: VK_SELECT HEX: 29
: VK_PRINT HEX: 2A ; inline CONSTANT: VK_PRINT HEX: 2A
: VK_EXECUTE HEX: 2B ; inline CONSTANT: VK_EXECUTE HEX: 2B
: VK_SNAPSHOT HEX: 2C ; inline CONSTANT: VK_SNAPSHOT HEX: 2C
: VK_INSERT HEX: 2D ; inline CONSTANT: VK_INSERT HEX: 2D
: VK_DELETE HEX: 2E ; inline CONSTANT: VK_DELETE HEX: 2E
: VK_HELP HEX: 2F ; inline CONSTANT: VK_HELP HEX: 2F
: VK_0 CHAR: 0 ; inline CONSTANT: VK_0 CHAR: 0
: VK_1 CHAR: 1 ; inline CONSTANT: VK_1 CHAR: 1
: VK_2 CHAR: 2 ; inline CONSTANT: VK_2 CHAR: 2
: VK_3 CHAR: 3 ; inline CONSTANT: VK_3 CHAR: 3
: VK_4 CHAR: 4 ; inline CONSTANT: VK_4 CHAR: 4
: VK_5 CHAR: 5 ; inline CONSTANT: VK_5 CHAR: 5
: VK_6 CHAR: 6 ; inline CONSTANT: VK_6 CHAR: 6
: VK_7 CHAR: 7 ; inline CONSTANT: VK_7 CHAR: 7
: VK_8 CHAR: 8 ; inline CONSTANT: VK_8 CHAR: 8
: VK_9 CHAR: 9 ; inline CONSTANT: VK_9 CHAR: 9
: VK_A CHAR: A ; inline CONSTANT: VK_A CHAR: A
: VK_B CHAR: B ; inline CONSTANT: VK_B CHAR: B
: VK_C CHAR: C ; inline CONSTANT: VK_C CHAR: C
: VK_D CHAR: D ; inline CONSTANT: VK_D CHAR: D
: VK_E CHAR: E ; inline CONSTANT: VK_E CHAR: E
: VK_F CHAR: F ; inline CONSTANT: VK_F CHAR: F
: VK_G CHAR: G ; inline CONSTANT: VK_G CHAR: G
: VK_H CHAR: H ; inline CONSTANT: VK_H CHAR: H
: VK_I CHAR: I ; inline CONSTANT: VK_I CHAR: I
: VK_J CHAR: J ; inline CONSTANT: VK_J CHAR: J
: VK_K CHAR: K ; inline CONSTANT: VK_K CHAR: K
: VK_L CHAR: L ; inline CONSTANT: VK_L CHAR: L
: VK_M CHAR: M ; inline CONSTANT: VK_M CHAR: M
: VK_N CHAR: N ; inline CONSTANT: VK_N CHAR: N
: VK_O CHAR: O ; inline CONSTANT: VK_O CHAR: O
: VK_P CHAR: P ; inline CONSTANT: VK_P CHAR: P
: VK_Q CHAR: Q ; inline CONSTANT: VK_Q CHAR: Q
: VK_R CHAR: R ; inline CONSTANT: VK_R CHAR: R
: VK_S CHAR: S ; inline CONSTANT: VK_S CHAR: S
: VK_T CHAR: T ; inline CONSTANT: VK_T CHAR: T
: VK_U CHAR: U ; inline CONSTANT: VK_U CHAR: U
: VK_V CHAR: V ; inline CONSTANT: VK_V CHAR: V
: VK_W CHAR: W ; inline CONSTANT: VK_W CHAR: W
: VK_X CHAR: X ; inline CONSTANT: VK_X CHAR: X
: VK_Y CHAR: Y ; inline CONSTANT: VK_Y CHAR: Y
: VK_Z CHAR: Z ; inline CONSTANT: VK_Z CHAR: Z
: VK_LWIN HEX: 5B ; inline CONSTANT: VK_LWIN HEX: 5B
: VK_RWIN HEX: 5C ; inline CONSTANT: VK_RWIN HEX: 5C
: VK_APPS HEX: 5D ; inline CONSTANT: VK_APPS HEX: 5D
! 0x5E : reserved ! 0x5E : reserved
: VK_SLEEP HEX: 5F ; inline CONSTANT: VK_SLEEP HEX: 5F
: VK_NUMPAD0 HEX: 60 ; inline CONSTANT: VK_NUMPAD0 HEX: 60
: VK_NUMPAD1 HEX: 61 ; inline CONSTANT: VK_NUMPAD1 HEX: 61
: VK_NUMPAD2 HEX: 62 ; inline CONSTANT: VK_NUMPAD2 HEX: 62
: VK_NUMPAD3 HEX: 63 ; inline CONSTANT: VK_NUMPAD3 HEX: 63
: VK_NUMPAD4 HEX: 64 ; inline CONSTANT: VK_NUMPAD4 HEX: 64
: VK_NUMPAD5 HEX: 65 ; inline CONSTANT: VK_NUMPAD5 HEX: 65
: VK_NUMPAD6 HEX: 66 ; inline CONSTANT: VK_NUMPAD6 HEX: 66
: VK_NUMPAD7 HEX: 67 ; inline CONSTANT: VK_NUMPAD7 HEX: 67
: VK_NUMPAD8 HEX: 68 ; inline CONSTANT: VK_NUMPAD8 HEX: 68
: VK_NUMPAD9 HEX: 69 ; inline CONSTANT: VK_NUMPAD9 HEX: 69
: VK_MULTIPLY HEX: 6A ; inline CONSTANT: VK_MULTIPLY HEX: 6A
: VK_ADD HEX: 6B ; inline CONSTANT: VK_ADD HEX: 6B
: VK_SEPARATOR HEX: 6C ; inline CONSTANT: VK_SEPARATOR HEX: 6C
: VK_SUBTRACT HEX: 6D ; inline CONSTANT: VK_SUBTRACT HEX: 6D
: VK_DECIMAL HEX: 6E ; inline CONSTANT: VK_DECIMAL HEX: 6E
: VK_DIVIDE HEX: 6F ; inline CONSTANT: VK_DIVIDE HEX: 6F
: VK_F1 HEX: 70 ; inline CONSTANT: VK_F1 HEX: 70
: VK_F2 HEX: 71 ; inline CONSTANT: VK_F2 HEX: 71
: VK_F3 HEX: 72 ; inline CONSTANT: VK_F3 HEX: 72
: VK_F4 HEX: 73 ; inline CONSTANT: VK_F4 HEX: 73
: VK_F5 HEX: 74 ; inline CONSTANT: VK_F5 HEX: 74
: VK_F6 HEX: 75 ; inline CONSTANT: VK_F6 HEX: 75
: VK_F7 HEX: 76 ; inline CONSTANT: VK_F7 HEX: 76
: VK_F8 HEX: 77 ; inline CONSTANT: VK_F8 HEX: 77
: VK_F9 HEX: 78 ; inline CONSTANT: VK_F9 HEX: 78
: VK_F10 HEX: 79 ; inline CONSTANT: VK_F10 HEX: 79
: VK_F11 HEX: 7A ; inline CONSTANT: VK_F11 HEX: 7A
: VK_F12 HEX: 7B ; inline CONSTANT: VK_F12 HEX: 7B
: VK_F13 HEX: 7C ; inline CONSTANT: VK_F13 HEX: 7C
: VK_F14 HEX: 7D ; inline CONSTANT: VK_F14 HEX: 7D
: VK_F15 HEX: 7E ; inline CONSTANT: VK_F15 HEX: 7E
: VK_F16 HEX: 7F ; inline CONSTANT: VK_F16 HEX: 7F
: VK_F17 HEX: 80 ; inline CONSTANT: VK_F17 HEX: 80
: VK_F18 HEX: 81 ; inline CONSTANT: VK_F18 HEX: 81
: VK_F19 HEX: 82 ; inline CONSTANT: VK_F19 HEX: 82
: VK_F20 HEX: 83 ; inline CONSTANT: VK_F20 HEX: 83
: VK_F21 HEX: 84 ; inline CONSTANT: VK_F21 HEX: 84
: VK_F22 HEX: 85 ; inline CONSTANT: VK_F22 HEX: 85
: VK_F23 HEX: 86 ; inline CONSTANT: VK_F23 HEX: 86
: VK_F24 HEX: 87 ; inline CONSTANT: VK_F24 HEX: 87
! 0x88 - 0x8F : unassigned ! 0x88 - 0x8F : unassigned
: VK_NUMLOCK HEX: 90 ; inline CONSTANT: VK_NUMLOCK HEX: 90
: VK_SCROLL HEX: 91 ; inline CONSTANT: VK_SCROLL HEX: 91
! NEC PC-9800 kbd definitions ! NEC PC-9800 kbd definitions
: VK_OEM_NEC_EQUAL HEX: 92 ; inline ! '=' key on numpad CONSTANT: VK_OEM_NEC_EQUAL HEX: 92 ! '=' key on numpad
! Fujitsu/OASYS kbd definitions ! Fujitsu/OASYS kbd definitions
: VK_OEM_FJ_JISHO HEX: 92 ; inline ! 'Dictionary' key CONSTANT: VK_OEM_FJ_JISHO HEX: 92 ! 'Dictionary' key
: VK_OEM_FJ_MASSHOU HEX: 93 ; inline ! 'Unregister word' key CONSTANT: VK_OEM_FJ_MASSHOU HEX: 93 ! 'Unregister word' key
: VK_OEM_FJ_TOUROKU HEX: 94 ; inline ! 'Register word' key CONSTANT: VK_OEM_FJ_TOUROKU HEX: 94 ! 'Register word' key
: VK_OEM_FJ_LOYA HEX: 95 ; inline ! 'Left OYAYUBI' key CONSTANT: VK_OEM_FJ_LOYA HEX: 95 ! 'Left OYAYUBI' key
: VK_OEM_FJ_ROYA HEX: 96 ; inline ! 'Right OYAYUBI' key CONSTANT: VK_OEM_FJ_ROYA HEX: 96 ! 'Right OYAYUBI' key
! 0x97 - 0x9F : unassigned ! 0x97 - 0x9F : unassigned
! VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys. ! VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
! Used only as parameters to GetAsyncKeyState() and GetKeyState(). ! Used only as parameters to GetAsyncKeyState() and GetKeyState().
! No other API or message will distinguish left and right keys in this way. ! No other API or message will distinguish left and right keys in this way.
: VK_LSHIFT HEX: A0 ; inline CONSTANT: VK_LSHIFT HEX: A0
: VK_RSHIFT HEX: A1 ; inline CONSTANT: VK_RSHIFT HEX: A1
: VK_LCONTROL HEX: A2 ; inline CONSTANT: VK_LCONTROL HEX: A2
: VK_RCONTROL HEX: A3 ; inline CONSTANT: VK_RCONTROL HEX: A3
: VK_LMENU HEX: A4 ; inline CONSTANT: VK_LMENU HEX: A4
: VK_RMENU HEX: A5 ; inline CONSTANT: VK_RMENU HEX: A5
: VK_BROWSER_BACK HEX: A6 ; inline CONSTANT: VK_BROWSER_BACK HEX: A6
: VK_BROWSER_FORWARD HEX: A7 ; inline CONSTANT: VK_BROWSER_FORWARD HEX: A7
: VK_BROWSER_REFRESH HEX: A8 ; inline CONSTANT: VK_BROWSER_REFRESH HEX: A8
: VK_BROWSER_STOP HEX: A9 ; inline CONSTANT: VK_BROWSER_STOP HEX: A9
: VK_BROWSER_SEARCH HEX: AA ; inline CONSTANT: VK_BROWSER_SEARCH HEX: AA
: VK_BROWSER_FAVORITES HEX: AB ; inline CONSTANT: VK_BROWSER_FAVORITES HEX: AB
: VK_BROWSER_HOME HEX: AC ; inline CONSTANT: VK_BROWSER_HOME HEX: AC
: VK_VOLUME_MUTE HEX: AD ; inline CONSTANT: VK_VOLUME_MUTE HEX: AD
: VK_VOLUME_DOWN HEX: AE ; inline CONSTANT: VK_VOLUME_DOWN HEX: AE
: VK_VOLUME_UP HEX: AF ; inline CONSTANT: VK_VOLUME_UP HEX: AF
: VK_MEDIA_NEXT_TRACK HEX: B0 ; inline CONSTANT: VK_MEDIA_NEXT_TRACK HEX: B0
: VK_MEDIA_PREV_TRACK HEX: B1 ; inline CONSTANT: VK_MEDIA_PREV_TRACK HEX: B1
: VK_MEDIA_STOP HEX: B2 ; inline CONSTANT: VK_MEDIA_STOP HEX: B2
: VK_MEDIA_PLAY_PAUSE HEX: B3 ; inline CONSTANT: VK_MEDIA_PLAY_PAUSE HEX: B3
: VK_LAUNCH_MAIL HEX: B4 ; inline CONSTANT: VK_LAUNCH_MAIL HEX: B4
: VK_LAUNCH_MEDIA_SELECT HEX: B5 ; inline CONSTANT: VK_LAUNCH_MEDIA_SELECT HEX: B5
: VK_LAUNCH_APP1 HEX: B6 ; inline CONSTANT: VK_LAUNCH_APP1 HEX: B6
: VK_LAUNCH_APP2 HEX: B7 ; inline CONSTANT: VK_LAUNCH_APP2 HEX: B7
! 0xB8 - 0xB9 : reserved ! 0xB8 - 0xB9 : reserved
: VK_OEM_1 HEX: BA ; inline ! ';:' for US CONSTANT: VK_OEM_1 HEX: BA ! ';:' for US
: VK_OEM_PLUS HEX: BB ; inline ! '+' any country CONSTANT: VK_OEM_PLUS HEX: BB ! '+' any country
: VK_OEM_COMMA HEX: BC ; inline ! ',' any country CONSTANT: VK_OEM_COMMA HEX: BC ! ',' any country
: VK_OEM_MINUS HEX: BD ; inline ! '-' any country CONSTANT: VK_OEM_MINUS HEX: BD ! '-' any country
: VK_OEM_PERIOD HEX: BE ; inline ! '.' any country CONSTANT: VK_OEM_PERIOD HEX: BE ! '.' any country
: VK_OEM_2 HEX: BF ; inline ! '/?' for US CONSTANT: VK_OEM_2 HEX: BF ! '/?' for US
: VK_OEM_3 HEX: C0 ; inline ! '`~' for US CONSTANT: VK_OEM_3 HEX: C0 ! '`~' for US
! 0xC1 - 0xD7 : reserved ! 0xC1 - 0xD7 : reserved
! 0xD8 - 0xDA : unassigned ! 0xD8 - 0xDA : unassigned
: VK_OEM_4 HEX: DB ; inline ! '[{' for US CONSTANT: VK_OEM_4 HEX: DB ! '[{' for US
: VK_OEM_5 HEX: DC ; inline ! '\|' for US CONSTANT: VK_OEM_5 HEX: DC ! '\|' for US
: VK_OEM_6 HEX: DD ; inline ! ']}' for US CONSTANT: VK_OEM_6 HEX: DD ! ']}' for US
: VK_OEM_7 HEX: DE ; inline ! ''"' for US CONSTANT: VK_OEM_7 HEX: DE ! ''"' for US
: VK_OEM_8 HEX: DF ; inline CONSTANT: VK_OEM_8 HEX: DF
! 0xE0 : reserved ! 0xE0 : reserved
! Various extended or enhanced keyboards ! Various extended or enhanced keyboards
: VK_OEM_AX HEX: E1 ; inline ! 'AX' key on Japanese AX kbd CONSTANT: VK_OEM_AX HEX: E1 ! 'AX' key on Japanese AX kbd
: VK_OEM_102 HEX: E2 ; inline ! "<>" or "\|" on RT 102-key kbd. CONSTANT: VK_OEM_102 HEX: E2 ! "<>" or "\|" on RT 102-key kbd.
: VK_ICO_HELP HEX: E3 ; inline ! Help key on ICO CONSTANT: VK_ICO_HELP HEX: E3 ! Help key on ICO
: VK_ICO_00 HEX: E4 ; inline ! 00 key on ICO CONSTANT: VK_ICO_00 HEX: E4 ! 00 key on ICO
: VK_PROCESSKEY HEX: E5 ; inline CONSTANT: VK_PROCESSKEY HEX: E5
: VK_ICO_CLEAR HEX: E6 ; inline CONSTANT: VK_ICO_CLEAR HEX: E6
: VK_PACKET HEX: E7 ; inline CONSTANT: VK_PACKET HEX: E7
! 0xE8 : unassigned ! 0xE8 : unassigned
! Nokia/Ericsson definitions ! Nokia/Ericsson definitions
: VK_OEM_RESET HEX: E9 ; inline CONSTANT: VK_OEM_RESET HEX: E9
: VK_OEM_JUMP HEX: EA ; inline CONSTANT: VK_OEM_JUMP HEX: EA
: VK_OEM_PA1 HEX: EB ; inline CONSTANT: VK_OEM_PA1 HEX: EB
: VK_OEM_PA2 HEX: EC ; inline CONSTANT: VK_OEM_PA2 HEX: EC
: VK_OEM_PA3 HEX: ED ; inline CONSTANT: VK_OEM_PA3 HEX: ED
: VK_OEM_WSCTRL HEX: EE ; inline CONSTANT: VK_OEM_WSCTRL HEX: EE
: VK_OEM_CUSEL HEX: EF ; inline CONSTANT: VK_OEM_CUSEL HEX: EF
: VK_OEM_ATTN HEX: F0 ; inline CONSTANT: VK_OEM_ATTN HEX: F0
: VK_OEM_FINISH HEX: F1 ; inline CONSTANT: VK_OEM_FINISH HEX: F1
: VK_OEM_COPY HEX: F2 ; inline CONSTANT: VK_OEM_COPY HEX: F2
: VK_OEM_AUTO HEX: F3 ; inline CONSTANT: VK_OEM_AUTO HEX: F3
: VK_OEM_ENLW HEX: F4 ; inline CONSTANT: VK_OEM_ENLW HEX: F4
: VK_OEM_BACKTAB HEX: F5 ; inline CONSTANT: VK_OEM_BACKTAB HEX: F5
: VK_ATTN HEX: F6 ; inline CONSTANT: VK_ATTN HEX: F6
: VK_CRSEL HEX: F7 ; inline CONSTANT: VK_CRSEL HEX: F7
: VK_EXSEL HEX: F8 ; inline CONSTANT: VK_EXSEL HEX: F8
: VK_EREOF HEX: F9 ; inline CONSTANT: VK_EREOF HEX: F9
: VK_PLAY HEX: FA ; inline CONSTANT: VK_PLAY HEX: FA
: VK_ZOOM HEX: FB ; inline CONSTANT: VK_ZOOM HEX: FB
: VK_NONAME HEX: FC ; inline CONSTANT: VK_NONAME HEX: FC
: VK_PA1 HEX: FD ; inline CONSTANT: VK_PA1 HEX: FD
: VK_OEM_CLEAR HEX: FE ; inline CONSTANT: VK_OEM_CLEAR HEX: FE
! 0xFF : reserved ! 0xFF : reserved
! Key State Masks for Mouse Messages ! Key State Masks for Mouse Messages
: MK_LBUTTON HEX: 0001 ; inline CONSTANT: MK_LBUTTON HEX: 0001
: MK_RBUTTON HEX: 0002 ; inline CONSTANT: MK_RBUTTON HEX: 0002
: MK_SHIFT HEX: 0004 ; inline CONSTANT: MK_SHIFT HEX: 0004
: MK_CONTROL HEX: 0008 ; inline CONSTANT: MK_CONTROL HEX: 0008
: MK_MBUTTON HEX: 0010 ; inline CONSTANT: MK_MBUTTON HEX: 0010
: MK_XBUTTON1 HEX: 0020 ; inline CONSTANT: MK_XBUTTON1 HEX: 0020
: MK_XBUTTON2 HEX: 0040 ; inline CONSTANT: MK_XBUTTON2 HEX: 0040
! Some fields are not defined for win64 ! Some fields are not defined for win64
! Window field offsets for GetWindowLong() ! Window field offsets for GetWindowLong()
: GWL_WNDPROC -4 ; inline CONSTANT: GWL_WNDPROC -4
: GWL_HINSTANCE -6 ; inline CONSTANT: GWL_HINSTANCE -6
: GWL_HWNDPARENT -8 ; inline CONSTANT: GWL_HWNDPARENT -8
: GWL_USERDATA -21 ; inline CONSTANT: GWL_USERDATA -21
: GWL_ID -12 ; inline CONSTANT: GWL_ID -12
: GWL_STYLE -16 ; inline CONSTANT: GWL_STYLE -16
: GWL_EXSTYLE -20 ; inline CONSTANT: GWL_EXSTYLE -20
: GWLP_WNDPROC -4 ; inline CONSTANT: GWLP_WNDPROC -4
: GWLP_HINSTANCE -6 ; inline CONSTANT: GWLP_HINSTANCE -6
: GWLP_HWNDPARENT -8 ; inline CONSTANT: GWLP_HWNDPARENT -8
: GWLP_USERDATA -21 ; inline CONSTANT: GWLP_USERDATA -21
: GWLP_ID -12 ; inline CONSTANT: GWLP_ID -12
! Class field offsets for GetClassLong() ! Class field offsets for GetClassLong()
: GCL_MENUNAME -8 ; inline CONSTANT: GCL_MENUNAME -8
: GCL_HBRBACKGROUND -10 ; inline CONSTANT: GCL_HBRBACKGROUND -10
: GCL_HCURSOR -12 ; inline CONSTANT: GCL_HCURSOR -12
: GCL_HICON -14 ; inline CONSTANT: GCL_HICON -14
: GCL_HMODULE -16 ; inline CONSTANT: GCL_HMODULE -16
: GCL_WNDPROC -24 ; inline CONSTANT: GCL_WNDPROC -24
: GCL_HICONSM -34 ; inline CONSTANT: GCL_HICONSM -34
: GCL_CBWNDEXTRA -18 ; inline CONSTANT: GCL_CBWNDEXTRA -18
: GCL_CBCLSEXTRA -20 ; inline CONSTANT: GCL_CBCLSEXTRA -20
: GCL_STYLE -26 ; inline CONSTANT: GCL_STYLE -26
: GCW_ATOM -32 ; inline CONSTANT: GCW_ATOM -32
: GCLP_MENUNAME -8 ; inline CONSTANT: GCLP_MENUNAME -8
: GCLP_HBRBACKGROUND -10 ; inline CONSTANT: GCLP_HBRBACKGROUND -10
: GCLP_HCURSOR -12 ; inline CONSTANT: GCLP_HCURSOR -12
: GCLP_HICON -14 ; inline CONSTANT: GCLP_HICON -14
: GCLP_HMODULE -16 ; inline CONSTANT: GCLP_HMODULE -16
: GCLP_WNDPROC -24 ; inline CONSTANT: GCLP_WNDPROC -24
: GCLP_HICONSM -34 ; inline CONSTANT: GCLP_HICONSM -34
: MB_ICONASTERISK HEX: 00000040 ; inline CONSTANT: MB_ICONASTERISK HEX: 00000040
: MB_ICONEXCLAMATION HEX: 00000030 ; inline CONSTANT: MB_ICONEXCLAMATION HEX: 00000030
: MB_ICONHAND HEX: 00000010 ; inline CONSTANT: MB_ICONHAND HEX: 00000010
: MB_ICONQUESTION HEX: 00000020 ; inline CONSTANT: MB_ICONQUESTION HEX: 00000020
: MB_OK HEX: 00000000 ; inline CONSTANT: MB_OK HEX: 00000000
ALIAS: FVIRTKEY TRUE ALIAS: FVIRTKEY TRUE
: FNOINVERT 2 ; inline CONSTANT: FNOINVERT 2
: FSHIFT 4 ; inline CONSTANT: FSHIFT 4
: FCONTROL 8 ; inline CONSTANT: FCONTROL 8
: FALT 16 ; inline CONSTANT: FALT 16
: MAPVK_VK_TO_VSC 0 ; inline CONSTANT: MAPVK_VK_TO_VSC 0
: MAPVK_VSC_TO_VK 1 ; inline CONSTANT: MAPVK_VSC_TO_VK 1
: MAPVK_VK_TO_CHAR 2 ; inline CONSTANT: MAPVK_VK_TO_CHAR 2
: MAPVK_VSC_TO_VK_EX 3 ; inline CONSTANT: MAPVK_VSC_TO_VK_EX 3
: MAPVK_VK_TO_VSC_EX 3 ; inline CONSTANT: MAPVK_VK_TO_VSC_EX 3
: TME_HOVER 1 ; inline CONSTANT: TME_HOVER 1
: TME_LEAVE 2 ; inline CONSTANT: TME_LEAVE 2
: TME_NONCLIENT 16 ; inline CONSTANT: TME_NONCLIENT 16
: TME_QUERY HEX: 40000000 ; inline CONSTANT: TME_QUERY HEX: 40000000
: TME_CANCEL HEX: 80000000 ; inline CONSTANT: TME_CANCEL HEX: 80000000
: HOVER_DEFAULT HEX: ffffffff ; inline CONSTANT: HOVER_DEFAULT HEX: ffffffff
C-STRUCT: TRACKMOUSEEVENT C-STRUCT: TRACKMOUSEEVENT
{ "DWORD" "cbSize" } { "DWORD" "cbSize" }
{ "DWORD" "dwFlags" } { "DWORD" "dwFlags" }
@ -528,15 +528,15 @@ C-STRUCT: TRACKMOUSEEVENT
{ "DWORD" "dwHoverTime" } ; { "DWORD" "dwHoverTime" } ;
TYPEDEF: TRACKMOUSEEVENT* LPTRACKMOUSEEVENT TYPEDEF: TRACKMOUSEEVENT* LPTRACKMOUSEEVENT
: DBT_DEVICEARRIVAL HEX: 8000 ; inline CONSTANT: DBT_DEVICEARRIVAL HEX: 8000
: DBT_DEVICEREMOVECOMPLETE HEX: 8004 ; inline CONSTANT: DBT_DEVICEREMOVECOMPLETE HEX: 8004
: DBT_DEVTYP_DEVICEINTERFACE 5 ; inline CONSTANT: DBT_DEVTYP_DEVICEINTERFACE 5
: DEVICE_NOTIFY_WINDOW_HANDLE 0 ; inline CONSTANT: DEVICE_NOTIFY_WINDOW_HANDLE 0
: DEVICE_NOTIFY_SERVICE_HANDLE 1 ; inline CONSTANT: DEVICE_NOTIFY_SERVICE_HANDLE 1
: DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 4 ; inline CONSTANT: DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 4
C-STRUCT: DEV_BROADCAST_HDR C-STRUCT: DEV_BROADCAST_HDR
{ "DWORD" "dbch_size" } { "DWORD" "dbch_size" }
@ -672,7 +672,6 @@ ALIAS: CreateWindowEx CreateWindowExW
: CreateWindow ( a b c d e f g h i j k -- hwnd ) 0 12 -nrot CreateWindowEx ; inline : CreateWindow ( a b c d e f g h i j k -- hwnd ) 0 12 -nrot CreateWindowEx ; inline
! FUNCTION: CreateWindowStationA ! FUNCTION: CreateWindowStationA
! FUNCTION: CreateWindowStationW ! FUNCTION: CreateWindowStationW
! FUNCTION: CsrBroadcastSystemMessageExW ! FUNCTION: CsrBroadcastSystemMessageExW

View File

@ -8,7 +8,7 @@ IN: windows
: lo-word ( wparam -- lo ) <short> *short ; inline : lo-word ( wparam -- lo ) <short> *short ; inline
: hi-word ( wparam -- hi ) -16 shift lo-word ; inline : hi-word ( wparam -- hi ) -16 shift lo-word ; inline
: MAX_UNICODE_PATH 32768 ; inline CONSTANT: MAX_UNICODE_PATH 32768
! You must LocalFree the return value! ! You must LocalFree the return value!
FUNCTION: void* error_message ( DWORD id ) ; FUNCTION: void* error_message ( DWORD id ) ;

View File

@ -131,19 +131,19 @@ C-STRUCT: XSetWindowAttributes
{ "Colormap" "colormap" } { "Colormap" "colormap" }
{ "Cursor" "cursor" } ; { "Cursor" "cursor" } ;
: UnmapGravity 0 ; inline CONSTANT: UnmapGravity 0
: ForgetGravity 0 ; inline CONSTANT: ForgetGravity 0
: NorthWestGravity 1 ; inline CONSTANT: NorthWestGravity 1
: NorthGravity 2 ; inline CONSTANT: NorthGravity 2
: NorthEastGravity 3 ; inline CONSTANT: NorthEastGravity 3
: WestGravity 4 ; inline CONSTANT: WestGravity 4
: CenterGravity 5 ; inline CONSTANT: CenterGravity 5
: EastGravity 6 ; inline CONSTANT: EastGravity 6
: SouthWestGravity 7 ; inline CONSTANT: SouthWestGravity 7
: SouthGravity 8 ; inline CONSTANT: SouthGravity 8
: SouthEastGravity 9 ; inline CONSTANT: SouthEastGravity 9
: StaticGravity 10 ; inline CONSTANT: StaticGravity 10
! 3.3 - Creating Windows ! 3.3 - Creating Windows
@ -238,9 +238,9 @@ C-STRUCT: XWindowAttributes
FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ; FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttributes* attr ) ;
: IsUnmapped 0 ; inline CONSTANT: IsUnmapped 0
: IsUnviewable 1 ; inline CONSTANT: IsUnviewable 1
: IsViewable 2 ; inline CONSTANT: IsViewable 2
FUNCTION: Status XGetGeometry ( FUNCTION: Status XGetGeometry (
Display* display, Display* display,
@ -336,22 +336,22 @@ FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual,
: GCDashList ( -- n ) 21 2^ ; inline : GCDashList ( -- n ) 21 2^ ; inline
: GCArcMode ( -- n ) 22 2^ ; inline : GCArcMode ( -- n ) 22 2^ ; inline
: GXclear HEX: 0 ; inline CONSTANT: GXclear HEX: 0
: GXand HEX: 1 ; inline CONSTANT: GXand HEX: 1
: GXandReverse HEX: 2 ; inline CONSTANT: GXandReverse HEX: 2
: GXcopy HEX: 3 ; inline CONSTANT: GXcopy HEX: 3
: GXandInverted HEX: 4 ; inline CONSTANT: GXandInverted HEX: 4
: GXnoop HEX: 5 ; inline CONSTANT: GXnoop HEX: 5
: GXxor HEX: 6 ; inline CONSTANT: GXxor HEX: 6
: GXor HEX: 7 ; inline CONSTANT: GXor HEX: 7
: GXnor HEX: 8 ; inline CONSTANT: GXnor HEX: 8
: GXequiv HEX: 9 ; inline CONSTANT: GXequiv HEX: 9
: GXinvert HEX: a ; inline CONSTANT: GXinvert HEX: a
: GXorReverse HEX: b ; inline CONSTANT: GXorReverse HEX: b
: GXcopyInverted HEX: c ; inline CONSTANT: GXcopyInverted HEX: c
: GXorInverted HEX: d ; inline CONSTANT: GXorInverted HEX: d
: GXnand HEX: e ; inline CONSTANT: GXnand HEX: e
: GXset HEX: f ; inline CONSTANT: GXset HEX: f
C-STRUCT: XGCValues C-STRUCT: XGCValues
{ "int" "function" } { "int" "function" }
@ -447,10 +447,10 @@ FUNCTION: Status XDrawString (
! 8.7 - Transferring Images between Client and Server ! 8.7 - Transferring Images between Client and Server
: XYBitmap 0 ; inline CONSTANT: XYBitmap 0
: XYPixmap 1 ; inline CONSTANT: XYPixmap 1
: ZPixmap 2 ; inline CONSTANT: ZPixmap 2
: AllPlanes -1 ; inline CONSTANT: AllPlanes -1
C-STRUCT: XImage-funcs C-STRUCT: XImage-funcs
{ "void*" "create_image" } { "void*" "create_image" }
@ -532,40 +532,40 @@ FUNCTION: Status XKillClient ( Display* display, XID resource ) ;
: ColormapChangeMask ( -- n ) 23 2^ ; inline : ColormapChangeMask ( -- n ) 23 2^ ; inline
: OwnerGrabButtonMask ( -- n ) 24 2^ ; inline : OwnerGrabButtonMask ( -- n ) 24 2^ ; inline
: KeyPress 2 ; inline CONSTANT: KeyPress 2
: KeyRelease 3 ; inline CONSTANT: KeyRelease 3
: ButtonPress 4 ; inline CONSTANT: ButtonPress 4
: ButtonRelease 5 ; inline CONSTANT: ButtonRelease 5
: MotionNotify 6 ; inline CONSTANT: MotionNotify 6
: EnterNotify 7 ; inline CONSTANT: EnterNotify 7
: LeaveNotify 8 ; inline CONSTANT: LeaveNotify 8
: FocusIn 9 ; inline CONSTANT: FocusIn 9
: FocusOut 10 ; inline CONSTANT: FocusOut 10
: KeymapNotify 11 ; inline CONSTANT: KeymapNotify 11
: Expose 12 ; inline CONSTANT: Expose 12
: GraphicsExpose 13 ; inline CONSTANT: GraphicsExpose 13
: NoExpose 14 ; inline CONSTANT: NoExpose 14
: VisibilityNotify 15 ; inline CONSTANT: VisibilityNotify 15
: CreateNotify 16 ; inline CONSTANT: CreateNotify 16
: DestroyNotify 17 ; inline CONSTANT: DestroyNotify 17
: UnmapNotify 18 ; inline CONSTANT: UnmapNotify 18
: MapNotify 19 ; inline CONSTANT: MapNotify 19
: MapRequest 20 ; inline CONSTANT: MapRequest 20
: ReparentNotify 21 ; inline CONSTANT: ReparentNotify 21
: ConfigureNotify 22 ; inline CONSTANT: ConfigureNotify 22
: ConfigureRequest 23 ; inline CONSTANT: ConfigureRequest 23
: GravityNotify 24 ; inline CONSTANT: GravityNotify 24
: ResizeRequest 25 ; inline CONSTANT: ResizeRequest 25
: CirculateNotify 26 ; inline CONSTANT: CirculateNotify 26
: CirculateRequest 27 ; inline CONSTANT: CirculateRequest 27
: PropertyNotify 28 ; inline CONSTANT: PropertyNotify 28
: SelectionClear 29 ; inline CONSTANT: SelectionClear 29
: SelectionRequest 30 ; inline CONSTANT: SelectionRequest 30
: SelectionNotify 31 ; inline CONSTANT: SelectionNotify 31
: ColormapNotify 32 ; inline CONSTANT: ColormapNotify 32
: ClientMessage 33 ; inline CONSTANT: ClientMessage 33
: MappingNotify 34 ; inline CONSTANT: MappingNotify 34
: LASTEvent 35 ; inline CONSTANT: LASTEvent 35
C-STRUCT: XAnyEvent C-STRUCT: XAnyEvent
{ "int" "type" } { "int" "type" }
@ -578,11 +578,11 @@ C-STRUCT: XAnyEvent
! 10.5 Keyboard and Pointer Events ! 10.5 Keyboard and Pointer Events
: Button1 1 ; inline CONSTANT: Button1 1
: Button2 2 ; inline CONSTANT: Button2 2
: Button3 3 ; inline CONSTANT: Button3 3
: Button4 4 ; inline CONSTANT: Button4 4
: Button5 5 ; inline CONSTANT: Button5 5
: Button1Mask ( -- n ) 1 8 shift ; inline : Button1Mask ( -- n ) 1 8 shift ; inline
: Button2Mask ( -- n ) 1 9 shift ; inline : Button2Mask ( -- n ) 1 9 shift ; inline
@ -1074,9 +1074,9 @@ FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_r
! 11.3 - Event Queue Management ! 11.3 - Event Queue Management
: QueuedAlready 0 ; inline CONSTANT: QueuedAlready 0
: QueuedAfterReading 1 ; inline CONSTANT: QueuedAfterReading 1
: QueuedAfterFlush 2 ; inline CONSTANT: QueuedAfterFlush 2
FUNCTION: int XEventsQueued ( Display* display, int mode ) ; FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
FUNCTION: int XPending ( Display* display ) ; FUNCTION: int XPending ( Display* display ) ;
@ -1093,7 +1093,7 @@ FUNCTION: int XSetErrorHandler ( void* handler ) ;
! 12 - Input Device Functions ! 12 - Input Device Functions
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: None 0 ; inline CONSTANT: None 0
FUNCTION: int XGrabPointer ( FUNCTION: int XGrabPointer (
Display* display, Display* display,
@ -1199,17 +1199,17 @@ FUNCTION: int XLookupString (
! 16.7 Determining the Appropriate Visual Type ! 16.7 Determining the Appropriate Visual Type
: VisualNoMask HEX: 0 ; inline CONSTANT: VisualNoMask HEX: 0
: VisualIDMask HEX: 1 ; inline CONSTANT: VisualIDMask HEX: 1
: VisualScreenMask HEX: 2 ; inline CONSTANT: VisualScreenMask HEX: 2
: VisualDepthMask HEX: 4 ; inline CONSTANT: VisualDepthMask HEX: 4
: VisualClassMask HEX: 8 ; inline CONSTANT: VisualClassMask HEX: 8
: VisualRedMaskMask HEX: 10 ; inline CONSTANT: VisualRedMaskMask HEX: 10
: VisualGreenMaskMask HEX: 20 ; inline CONSTANT: VisualGreenMaskMask HEX: 20
: VisualBlueMaskMask HEX: 40 ; inline CONSTANT: VisualBlueMaskMask HEX: 40
: VisualColormapSizeMask HEX: 80 ; inline CONSTANT: VisualColormapSizeMask HEX: 80
: VisualBitsPerRGBMask HEX: 100 ; inline CONSTANT: VisualBitsPerRGBMask HEX: 100
: VisualAllMask HEX: 1FF ; inline CONSTANT: VisualAllMask HEX: 1FF
C-STRUCT: XVisualInfo C-STRUCT: XVisualInfo
{ "Visual*" "visual" } { "Visual*" "visual" }
@ -1239,76 +1239,76 @@ FUNCTION: Status XSetStandardProperties (
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: XA_PRIMARY 1 ; inline CONSTANT: XA_PRIMARY 1
: XA_SECONDARY 2 ; inline CONSTANT: XA_SECONDARY 2
: XA_ARC 3 ; inline CONSTANT: XA_ARC 3
: XA_ATOM 4 ; inline CONSTANT: XA_ATOM 4
: XA_BITMAP 5 ; inline CONSTANT: XA_BITMAP 5
: XA_CARDINAL 6 ; inline CONSTANT: XA_CARDINAL 6
: XA_COLORMAP 7 ; inline CONSTANT: XA_COLORMAP 7
: XA_CURSOR 8 ; inline CONSTANT: XA_CURSOR 8
: XA_CUT_BUFFER0 9 ; inline CONSTANT: XA_CUT_BUFFER0 9
: XA_CUT_BUFFER1 10 ; inline CONSTANT: XA_CUT_BUFFER1 10
: XA_CUT_BUFFER2 11 ; inline CONSTANT: XA_CUT_BUFFER2 11
: XA_CUT_BUFFER3 12 ; inline CONSTANT: XA_CUT_BUFFER3 12
: XA_CUT_BUFFER4 13 ; inline CONSTANT: XA_CUT_BUFFER4 13
: XA_CUT_BUFFER5 14 ; inline CONSTANT: XA_CUT_BUFFER5 14
: XA_CUT_BUFFER6 15 ; inline CONSTANT: XA_CUT_BUFFER6 15
: XA_CUT_BUFFER7 16 ; inline CONSTANT: XA_CUT_BUFFER7 16
: XA_DRAWABLE 17 ; inline CONSTANT: XA_DRAWABLE 17
: XA_FONT 18 ; inline CONSTANT: XA_FONT 18
: XA_INTEGER 19 ; inline CONSTANT: XA_INTEGER 19
: XA_PIXMAP 20 ; inline CONSTANT: XA_PIXMAP 20
: XA_POINT 21 ; inline CONSTANT: XA_POINT 21
: XA_RECTANGLE 22 ; inline CONSTANT: XA_RECTANGLE 22
: XA_RESOURCE_MANAGER 23 ; inline CONSTANT: XA_RESOURCE_MANAGER 23
: XA_RGB_COLOR_MAP 24 ; inline CONSTANT: XA_RGB_COLOR_MAP 24
: XA_RGB_BEST_MAP 25 ; inline CONSTANT: XA_RGB_BEST_MAP 25
: XA_RGB_BLUE_MAP 26 ; inline CONSTANT: XA_RGB_BLUE_MAP 26
: XA_RGB_DEFAULT_MAP 27 ; inline CONSTANT: XA_RGB_DEFAULT_MAP 27
: XA_RGB_GRAY_MAP 28 ; inline CONSTANT: XA_RGB_GRAY_MAP 28
: XA_RGB_GREEN_MAP 29 ; inline CONSTANT: XA_RGB_GREEN_MAP 29
: XA_RGB_RED_MAP 30 ; inline CONSTANT: XA_RGB_RED_MAP 30
: XA_STRING 31 ; inline CONSTANT: XA_STRING 31
: XA_VISUALID 32 ; inline CONSTANT: XA_VISUALID 32
: XA_WINDOW 33 ; inline CONSTANT: XA_WINDOW 33
: XA_WM_COMMAND 34 ; inline CONSTANT: XA_WM_COMMAND 34
: XA_WM_HINTS 35 ; inline CONSTANT: XA_WM_HINTS 35
: XA_WM_CLIENT_MACHINE 36 ; inline CONSTANT: XA_WM_CLIENT_MACHINE 36
: XA_WM_ICON_NAME 37 ; inline CONSTANT: XA_WM_ICON_NAME 37
: XA_WM_ICON_SIZE 38 ; inline CONSTANT: XA_WM_ICON_SIZE 38
: XA_WM_NAME 39 ; inline CONSTANT: XA_WM_NAME 39
: XA_WM_NORMAL_HINTS 40 ; inline CONSTANT: XA_WM_NORMAL_HINTS 40
: XA_WM_SIZE_HINTS 41 ; inline CONSTANT: XA_WM_SIZE_HINTS 41
: XA_WM_ZOOM_HINTS 42 ; inline CONSTANT: XA_WM_ZOOM_HINTS 42
: XA_MIN_SPACE 43 ; inline CONSTANT: XA_MIN_SPACE 43
: XA_NORM_SPACE 44 ; inline CONSTANT: XA_NORM_SPACE 44
: XA_MAX_SPACE 45 ; inline CONSTANT: XA_MAX_SPACE 45
: XA_END_SPACE 46 ; inline CONSTANT: XA_END_SPACE 46
: XA_SUPERSCRIPT_X 47 ; inline CONSTANT: XA_SUPERSCRIPT_X 47
: XA_SUPERSCRIPT_Y 48 ; inline CONSTANT: XA_SUPERSCRIPT_Y 48
: XA_SUBSCRIPT_X 49 ; inline CONSTANT: XA_SUBSCRIPT_X 49
: XA_SUBSCRIPT_Y 50 ; inline CONSTANT: XA_SUBSCRIPT_Y 50
: XA_UNDERLINE_POSITION 51 ; inline CONSTANT: XA_UNDERLINE_POSITION 51
: XA_UNDERLINE_THICKNESS 52 ; inline CONSTANT: XA_UNDERLINE_THICKNESS 52
: XA_STRIKEOUT_ASCENT 53 ; inline CONSTANT: XA_STRIKEOUT_ASCENT 53
: XA_STRIKEOUT_DESCENT 54 ; inline CONSTANT: XA_STRIKEOUT_DESCENT 54
: XA_ITALIC_ANGLE 55 ; inline CONSTANT: XA_ITALIC_ANGLE 55
: XA_X_HEIGHT 56 ; inline CONSTANT: XA_X_HEIGHT 56
: XA_QUAD_WIDTH 57 ; inline CONSTANT: XA_QUAD_WIDTH 57
: XA_WEIGHT 58 ; inline CONSTANT: XA_WEIGHT 58
: XA_POINT_SIZE 59 ; inline CONSTANT: XA_POINT_SIZE 59
: XA_RESOLUTION 60 ; inline CONSTANT: XA_RESOLUTION 60
: XA_COPYRIGHT 61 ; inline CONSTANT: XA_COPYRIGHT 61
: XA_NOTICE 62 ; inline CONSTANT: XA_NOTICE 62
: XA_FONT_NAME 63 ; inline CONSTANT: XA_FONT_NAME 63
: XA_FAMILY_NAME 64 ; inline CONSTANT: XA_FAMILY_NAME 64
: XA_FULL_NAME 65 ; inline CONSTANT: XA_FULL_NAME 65
: XA_CAP_HEIGHT 66 ; inline CONSTANT: XA_CAP_HEIGHT 66
: XA_WM_CLASS 67 ; inline CONSTANT: XA_WM_CLASS 67
: XA_WM_TRANSIENT_FOR 68 ; inline CONSTANT: XA_WM_TRANSIENT_FOR 68
: XA_LAST_PREDEFINED 68 ; inline CONSTANT: XA_LAST_PREDEFINED 68
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The rest of the stuff is not from the book. ! The rest of the stuff is not from the book.
@ -1321,65 +1321,65 @@ FUNCTION: int XBell ( Display* display, int percent ) ;
! !!! INPUT METHODS ! !!! INPUT METHODS
: XIMPreeditArea HEX: 0001 ; inline CONSTANT: XIMPreeditArea HEX: 0001
: XIMPreeditCallbacks HEX: 0002 ; inline CONSTANT: XIMPreeditCallbacks HEX: 0002
: XIMPreeditPosition HEX: 0004 ; inline CONSTANT: XIMPreeditPosition HEX: 0004
: XIMPreeditNothing HEX: 0008 ; inline CONSTANT: XIMPreeditNothing HEX: 0008
: XIMPreeditNone HEX: 0010 ; inline CONSTANT: XIMPreeditNone HEX: 0010
: XIMStatusArea HEX: 0100 ; inline CONSTANT: XIMStatusArea HEX: 0100
: XIMStatusCallbacks HEX: 0200 ; inline CONSTANT: XIMStatusCallbacks HEX: 0200
: XIMStatusNothing HEX: 0400 ; inline CONSTANT: XIMStatusNothing HEX: 0400
: XIMStatusNone HEX: 0800 ; inline CONSTANT: XIMStatusNone HEX: 0800
: XNVaNestedList "XNVaNestedList" ; CONSTANT: XNVaNestedList "XNVaNestedList"
: XNQueryInputStyle "queryInputStyle" ; CONSTANT: XNQueryInputStyle "queryInputStyle"
: XNClientWindow "clientWindow" ; CONSTANT: XNClientWindow "clientWindow"
: XNInputStyle "inputStyle" ; CONSTANT: XNInputStyle "inputStyle"
: XNFocusWindow "focusWindow" ; CONSTANT: XNFocusWindow "focusWindow"
: XNResourceName "resourceName" ; CONSTANT: XNResourceName "resourceName"
: XNResourceClass "resourceClass" ; CONSTANT: XNResourceClass "resourceClass"
: XNGeometryCallback "geometryCallback" ; CONSTANT: XNGeometryCallback "geometryCallback"
: XNDestroyCallback "destroyCallback" ; CONSTANT: XNDestroyCallback "destroyCallback"
: XNFilterEvents "filterEvents" ; CONSTANT: XNFilterEvents "filterEvents"
: XNPreeditStartCallback "preeditStartCallback" ; CONSTANT: XNPreeditStartCallback "preeditStartCallback"
: XNPreeditDoneCallback "preeditDoneCallback" ; CONSTANT: XNPreeditDoneCallback "preeditDoneCallback"
: XNPreeditDrawCallback "preeditDrawCallback" ; CONSTANT: XNPreeditDrawCallback "preeditDrawCallback"
: XNPreeditCaretCallback "preeditCaretCallback" ; CONSTANT: XNPreeditCaretCallback "preeditCaretCallback"
: XNPreeditStateNotifyCallback "preeditStateNotifyCallback" ; CONSTANT: XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
: XNPreeditAttributes "preeditAttributes" ; CONSTANT: XNPreeditAttributes "preeditAttributes"
: XNStatusStartCallback "statusStartCallback" ; CONSTANT: XNStatusStartCallback "statusStartCallback"
: XNStatusDoneCallback "statusDoneCallback" ; CONSTANT: XNStatusDoneCallback "statusDoneCallback"
: XNStatusDrawCallback "statusDrawCallback" ; CONSTANT: XNStatusDrawCallback "statusDrawCallback"
: XNStatusAttributes "statusAttributes" ; CONSTANT: XNStatusAttributes "statusAttributes"
: XNArea "area" ; CONSTANT: XNArea "area"
: XNAreaNeeded "areaNeeded" ; CONSTANT: XNAreaNeeded "areaNeeded"
: XNSpotLocation "spotLocation" ; CONSTANT: XNSpotLocation "spotLocation"
: XNColormap "colorMap" ; CONSTANT: XNColormap "colorMap"
: XNStdColormap "stdColorMap" ; CONSTANT: XNStdColormap "stdColorMap"
: XNForeground "foreground" ; CONSTANT: XNForeground "foreground"
: XNBackground "background" ; CONSTANT: XNBackground "background"
: XNBackgroundPixmap "backgroundPixmap" ; CONSTANT: XNBackgroundPixmap "backgroundPixmap"
: XNFontSet "fontSet" ; CONSTANT: XNFontSet "fontSet"
: XNLineSpace "lineSpace" ; CONSTANT: XNLineSpace "lineSpace"
: XNCursor "cursor" ; CONSTANT: XNCursor "cursor"
: XNQueryIMValuesList "queryIMValuesList" ; CONSTANT: XNQueryIMValuesList "queryIMValuesList"
: XNQueryICValuesList "queryICValuesList" ; CONSTANT: XNQueryICValuesList "queryICValuesList"
: XNVisiblePosition "visiblePosition" ; CONSTANT: XNVisiblePosition "visiblePosition"
: XNR6PreeditCallback "r6PreeditCallback" ; CONSTANT: XNR6PreeditCallback "r6PreeditCallback"
: XNStringConversionCallback "stringConversionCallback" ; CONSTANT: XNStringConversionCallback "stringConversionCallback"
: XNStringConversion "stringConversion" ; CONSTANT: XNStringConversion "stringConversion"
: XNResetState "resetState" ; CONSTANT: XNResetState "resetState"
: XNHotKey "hotKey" ; CONSTANT: XNHotKey "hotKey"
: XNHotKeyState "hotKeyState" ; CONSTANT: XNHotKeyState "hotKeyState"
: XNPreeditState "preeditState" ; CONSTANT: XNPreeditState "preeditState"
: XNSeparatorofNestedList "separatorofNestedList" ; CONSTANT: XNSeparatorofNestedList "separatorofNestedList"
: XBufferOverflow -1 ; CONSTANT: XBufferOverflow -1
: XLookupNone 1 ; CONSTANT: XLookupNone 1
: XLookupChars 2 ; CONSTANT: XLookupChars 2
: XLookupKeySym 3 ; CONSTANT: XLookupKeySym 3
: XLookupBoth 4 ; CONSTANT: XLookupBoth 4
FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ; FUNCTION: Bool XFilterEvent ( XEvent* event, Window w ) ;
@ -1400,12 +1400,12 @@ FUNCTION: int XwcLookupString ( XIC ic, XKeyPressedEvent* event, ulong* buffer_r
FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ; FUNCTION: int Xutf8LookupString ( XIC ic, XKeyPressedEvent* event, char* buffer_return, int bytes_buffer, KeySym* keysym_return, Status* status_return ) ;
! !!! category of setlocale ! !!! category of setlocale
: LC_ALL 0 ; inline CONSTANT: LC_ALL 0
: LC_COLLATE 1 ; inline CONSTANT: LC_COLLATE 1
: LC_CTYPE 2 ; inline CONSTANT: LC_CTYPE 2
: LC_MONETARY 3 ; inline CONSTANT: LC_MONETARY 3
: LC_NUMERIC 4 ; inline CONSTANT: LC_NUMERIC 4
: LC_TIME 5 ; inline CONSTANT: LC_TIME 5
FUNCTION: char* setlocale ( int category, char* name ) ; FUNCTION: char* setlocale ( int category, char* name ) ;

View File

@ -58,6 +58,7 @@ ARTICLE: "assocs-lookup" "Lookup and querying of assocs"
"Utility operations built up from the " { $link "assocs-protocol" } ":" "Utility operations built up from the " { $link "assocs-protocol" } ":"
{ $subsection key? } { $subsection key? }
{ $subsection at } { $subsection at }
{ $subsection ?at }
{ $subsection assoc-empty? } { $subsection assoc-empty? }
{ $subsection keys } { $subsection keys }
{ $subsection values } { $subsection values }
@ -188,12 +189,16 @@ HELP: key?
{ $values { "key" object } { "assoc" assoc } { "?" "a boolean" } } { $values { "key" object } { "assoc" assoc } { "?" "a boolean" } }
{ $description "Tests if an assoc contains a key." } ; { $description "Tests if an assoc contains a key." } ;
{ at at* key? } related-words { at at* key? ?at } related-words
HELP: at HELP: at
{ $values { "key" "an object" } { "assoc" assoc } { "value/f" "the value associated to the key, or " { $link f } " if the key is not present in the assoc" } } { $values { "key" "an object" } { "assoc" assoc } { "value/f" "the value associated to the key, or " { $link f } " if the key is not present in the assoc" } }
{ $description "Looks up the value associated with a key. This word makes no distinction between a missing value and a value set to " { $link f } "; if the difference is important, use " { $link at* } "." } ; { $description "Looks up the value associated with a key. This word makes no distinction between a missing value and a value set to " { $link f } "; if the difference is important, use " { $link at* } "." } ;
HELP: ?at
{ $values { "key" "an object" } { "assoc" assoc } { "value/key" "the value associated to the key, or the key if the key is not present in the assoc" } { "?" "a boolean" } }
{ $description "Looks up the value associated with a key. If the key was not present, an error can be thrown without extra stack shuffling. This word handles assocs that store " { $link f } "." } ;
HELP: assoc-each HELP: assoc-each
{ $values { "assoc" assoc } { "quot" { $quotation "( key value -- )" } } } { $values { "assoc" assoc } { "quot" { $quotation "( key value -- )" } } }
{ $description "Applies a quotation to each entry in the assoc." } { $description "Applies a quotation to each entry in the assoc." }

View File

@ -138,4 +138,7 @@ unit-test
{ "c" [ 3 ] } { "c" [ 3 ] }
{ "d" [ 4 ] } { "d" [ 4 ] }
} [ nip first even? ] assoc-partition } [ nip first even? ] assoc-partition
] unit-test ] unit-test
[ 1 f ] [ 1 H{ } ?at ] unit-test
[ 2 t ] [ 1 H{ { 1 2 } } ?at ] unit-test

View File

@ -19,6 +19,9 @@ GENERIC: >alist ( assoc -- newassoc )
M: assoc assoc-like drop ; M: assoc assoc-like drop ;
: ?at ( key assoc -- value/key ? )
dupd at* [ [ nip ] [ drop ] if ] keep ; inline
<PRIVATE <PRIVATE
: (assoc-each) ( assoc quot -- seq quot' ) : (assoc-each) ( assoc quot -- seq quot' )
@ -36,7 +39,7 @@ M: assoc assoc-like drop ;
[ first = ] with find swap ; inline [ first = ] with find swap ; inline
: substituter ( assoc -- quot ) : substituter ( assoc -- quot )
[ dupd at* [ nip ] [ drop ] if ] curry ; inline [ ?at drop ] curry ; inline
: with-assoc ( assoc quot: ( value key -- assoc ) -- quot: ( key value -- ) ) : with-assoc ( assoc quot: ( value key -- assoc ) -- quot: ( key value -- ) )
curry [ swap ] prepose ; inline curry [ swap ] prepose ; inline
@ -80,7 +83,7 @@ PRIVATE>
at* drop ; inline at* drop ; inline
: at-default ( key assoc -- value/key ) : at-default ( key assoc -- value/key )
2dup at* [ 2nip ] [ 2drop ] if ; inline ?at drop ; inline
M: assoc assoc-clone-like ( assoc exemplar -- newassoc ) M: assoc assoc-clone-like ( assoc exemplar -- newassoc )
[ dup assoc-size ] dip new-assoc [ dup assoc-size ] dip new-assoc

View File

@ -5,9 +5,9 @@ words io io.binary io.files io.streams.string quotations
definitions checksums ; definitions checksums ;
IN: checksums.crc32 IN: checksums.crc32
: crc32-polynomial HEX: edb88320 ; inline CONSTANT: crc32-polynomial HEX: edb88320
: crc32-table V{ } ; inline CONSTANT: crc32-table V{ }
256 [ 256 [
8 [ 8 [

View File

@ -176,8 +176,8 @@ IN: combinators.tests
[ "an array" ] [ { 1 2 3 } case-test-3 ] unit-test [ "an array" ] [ { 1 2 3 } case-test-3 ] unit-test
: case-const-1 1 ; CONSTANT: case-const-1 1
: case-const-2 2 ; inline CONSTANT: case-const-2 2
! Compiled ! Compiled
: case-test-4 ( obj -- str ) : case-test-4 ( obj -- str )

View File

@ -14,7 +14,7 @@ GENERIC: encode-char ( char stream encoding -- )
GENERIC: <decoder> ( stream encoding -- newstream ) GENERIC: <decoder> ( stream encoding -- newstream )
: replacement-char HEX: fffd ; inline CONSTANT: replacement-char HEX: fffd
TUPLE: decoder stream code cr ; TUPLE: decoder stream code cr ;

View File

@ -134,7 +134,7 @@ compiled-generic-crossref [ H{ } clone ] initialize
SYMBOL: visited SYMBOL: visited
: reset-on-redefine { "inferred-effect" "cannot-infer" } ; inline CONSTANT: reset-on-redefine { "inferred-effect" "cannot-infer" }
: (redefined) ( word -- ) : (redefined) ( word -- )
dup visited get key? [ drop ] [ dup visited get key? [ drop ] [

View File

@ -1,4 +1,4 @@
! Copyright (C) 2008 Your name. ! Copyright (C) 2008 Jeff Bigot.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays help.markup help.syntax kernel sequences ; USING: arrays help.markup help.syntax kernel sequences ;
IN: adsoda.combinators IN: adsoda.combinators

View File

@ -3,9 +3,9 @@
IN: asn1.ldap IN: asn1.ldap
: SearchScope_BaseObject 0 ; inline CONSTANT: SearchScope_BaseObject 0
: SearchScope_SingleLevel 1 ; inline CONSTANT: SearchScope_SingleLevel 1
: SearchScope_WholeSubtree 2 ; inline CONSTANT: SearchScope_WholeSubtree 2
: asn-syntax ( -- hashtable ) : asn-syntax ( -- hashtable )
H{ H{

View File

@ -23,7 +23,7 @@ M: tree-node item-check
M: f item-check drop 0 ; M: f item-check drop 0 ;
: min-depth 4 ; inline CONSTANT: min-depth 4
: stretch-tree ( max-depth -- ) : stretch-tree ( max-depth -- )
1 + 0 over bottom-up-tree item-check 1 + 0 over bottom-up-tree item-check

View File

@ -4,11 +4,11 @@ sequences.private benchmark.reverse-complement hints io.encodings.ascii
byte-arrays specialized-arrays.double ; byte-arrays specialized-arrays.double ;
IN: benchmark.fasta IN: benchmark.fasta
: IM 139968 ; inline CONSTANT: IM 139968
: IA 3877 ; inline CONSTANT: IA 3877
: IC 29573 ; inline CONSTANT: IC 29573
: initial-seed 42 ; inline CONSTANT: initial-seed 42
: line-length 60 ; inline CONSTANT: line-length 60
USE: math.private USE: math.private
@ -17,7 +17,7 @@ USE: math.private
HINTS: random fixnum ; HINTS: random fixnum ;
: ALU "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA" ; inline CONSTANT: ALU "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"
: IUB : IUB
{ {

View File

@ -7,8 +7,8 @@ IN: benchmark.mandel.colors
: scale-rgb ( rgba -- n ) : scale-rgb ( rgba -- n )
[ red>> scale ] [ green>> scale ] [ blue>> scale ] tri 3byte-array ; [ red>> scale ] [ green>> scale ] [ blue>> scale ] tri 3byte-array ;
: sat 0.85 ; inline CONSTANT: sat 0.85
: val 0.85 ; inline CONSTANT: val 0.85
: <color-map> ( nb-cols -- map ) : <color-map> ( nb-cols -- map )
dup [ dup [

View File

@ -1,8 +1,8 @@
IN: benchmark.mandel.params IN: benchmark.mandel.params
: max-color 360 ; inline CONSTANT: max-color 360
: zoom-fact 0.8 ; inline CONSTANT: zoom-fact 0.8
: width 640 ; inline CONSTANT: width 640
: height 480 ; inline CONSTANT: height 480
: max-iterations 40 ; inline CONSTANT: max-iterations 40
: center -0.65 ; inline CONSTANT: center -0.65

View File

@ -6,7 +6,7 @@ sequences hints arrays ;
IN: benchmark.nbody IN: benchmark.nbody
: solar-mass ( -- x ) 4 pi sq * ; inline : solar-mass ( -- x ) 4 pi sq * ; inline
: days-per-year 365.24 ; inline CONSTANT: days-per-year 365.24
TUPLE: body TUPLE: body
{ location double-array } { location double-array }

View File

@ -16,13 +16,13 @@ IN: benchmark.raytracer
0.5345224838248488 0.5345224838248488
} ; inline } ; inline
: oversampling 4 ; inline CONSTANT: oversampling 4
: levels 3 ; inline CONSTANT: levels 3
: size 200 ; inline CONSTANT: size 200
: delta 1.4901161193847656E-8 ; inline CONSTANT: delta 1.4901161193847656E-8
TUPLE: ray { orig double-array read-only } { dir double-array read-only } ; TUPLE: ray { orig double-array read-only } { dir double-array read-only } ;
@ -88,7 +88,7 @@ TUPLE: group < sphere { objs array read-only } ;
M: group intersect-scene ( hit ray group -- hit ) M: group intersect-scene ( hit ray group -- hit )
[ drop objs>> [ intersect-scene ] with each ] if-ray-sphere ; [ drop objs>> [ intersect-scene ] with each ] if-ray-sphere ;
: initial-hit T{ hit f double-array{ 0.0 0.0 0.0 } 1/0. } ; inline CONSTANT: initial-hit T{ hit f double-array{ 0.0 0.0 0.0 } 1/0. }
: initial-intersect ( ray scene -- hit ) : initial-intersect ( ray scene -- hit )
[ initial-hit ] 2dip intersect-scene ; inline [ initial-hit ] 2dip intersect-scene ; inline

View File

@ -4,7 +4,7 @@ USING: arrays kernel math memoize sequences math.bitwise
locals ; locals ;
IN: crypto.aes IN: crypto.aes
: AES_BLOCK_SIZE 16 ; inline CONSTANT: AES_BLOCK_SIZE 16
: sbox ( -- array ) : sbox ( -- array )
{ {

View File

@ -18,7 +18,7 @@ C: <rsa> rsa
<PRIVATE <PRIVATE
: public-key 65537 ; inline CONSTANT: public-key 65537
: rsa-primes ( numbits -- p q ) : rsa-primes ( numbits -- p q )
2/ 2 unique-primes first2 ; 2/ 2 unique-primes first2 ;

View File

@ -10,9 +10,9 @@ IN: curses
SYMBOL: curses-windows SYMBOL: curses-windows
SYMBOL: current-window SYMBOL: current-window
: ERR -1 ; inline CONSTANT: ERR -1
: FALSE 0 ; inline CONSTANT: FALSE 0
: TRUE 1 ; inline CONSTANT: TRUE 1
: >BOOLEAN ( n -- TRUE/FALSE ) >boolean TRUE FALSE ? ; inline : >BOOLEAN ( n -- TRUE/FALSE ) >boolean TRUE FALSE ? ; inline
ERROR: duplicate-window window ; ERROR: duplicate-window window ;

View File

@ -18,7 +18,7 @@ TYPEDEF: chtype attr_t
TYPEDEF: short NCURSES_SIZE_T TYPEDEF: short NCURSES_SIZE_T
TYPEDEF: ushort wchar_t TYPEDEF: ushort wchar_t
: CCHARW_MAX 5 ; inline CONSTANT: CCHARW_MAX 5
C-STRUCT: cchar_t C-STRUCT: cchar_t
{ "attr_t" "attr" } { "attr_t" "attr" }

View File

@ -1,4 +0,0 @@
! Copyright (C) 2008 Your name.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test fuel ;
IN: fuel.tests

View File

@ -21,33 +21,33 @@ iokit-game-input-backend game-input-backend set-global
[ &CFRelease NSFastEnumeration>vector ] [ f ] if* [ &CFRelease NSFastEnumeration>vector ] [ f ] if*
] with-destructors ; ] with-destructors ;
: game-devices-matching-seq CONSTANT: game-devices-matching-seq
{ {
H{ { "DeviceUsage" 4 } { "DeviceUsagePage" 1 } } ! joysticks H{ { "DeviceUsage" 4 } { "DeviceUsagePage" 1 } } ! joysticks
H{ { "DeviceUsage" 5 } { "DeviceUsagePage" 1 } } ! gamepads H{ { "DeviceUsage" 5 } { "DeviceUsagePage" 1 } } ! gamepads
H{ { "DeviceUsage" 6 } { "DeviceUsagePage" 1 } } ! keyboards H{ { "DeviceUsage" 6 } { "DeviceUsagePage" 1 } } ! keyboards
} ; inline }
: buttons-matching-hash CONSTANT: buttons-matching-hash
H{ { "UsagePage" 9 } { "Type" 2 } } ; inline H{ { "UsagePage" 9 } { "Type" 2 } }
: keys-matching-hash CONSTANT: keys-matching-hash
H{ { "UsagePage" 7 } { "Type" 2 } } ; inline H{ { "UsagePage" 7 } { "Type" 2 } }
: x-axis-matching-hash CONSTANT: x-axis-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 30 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 30 } { "Type" 1 } }
: y-axis-matching-hash CONSTANT: y-axis-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 31 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 31 } { "Type" 1 } }
: z-axis-matching-hash CONSTANT: z-axis-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 32 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 32 } { "Type" 1 } }
: rx-axis-matching-hash CONSTANT: rx-axis-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 33 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 33 } { "Type" 1 } }
: ry-axis-matching-hash CONSTANT: ry-axis-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 34 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 34 } { "Type" 1 } }
: rz-axis-matching-hash CONSTANT: rz-axis-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 35 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 35 } { "Type" 1 } }
: slider-matching-hash CONSTANT: slider-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 36 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 36 } { "Type" 1 } }
: hat-switch-matching-hash CONSTANT: hat-switch-matching-hash
H{ { "UsagePage" 1 } { "Usage" HEX: 39 } { "Type" 1 } } ; inline H{ { "UsagePage" 1 } { "Usage" HEX: 39 } { "Type" 1 } }
: device-elements-matching ( device matching-hash -- vector ) : device-elements-matching ( device matching-hash -- vector )
[ [

View File

@ -1,175 +1,175 @@
IN: game-input.scancodes IN: game-input.scancodes
: key-undefined HEX: 0000 ; inline CONSTANT: key-undefined HEX: 0000
: key-error-roll-over HEX: 0001 ; inline CONSTANT: key-error-roll-over HEX: 0001
: key-error-post-fail HEX: 0002 ; inline CONSTANT: key-error-post-fail HEX: 0002
: key-error-undefined HEX: 0003 ; inline CONSTANT: key-error-undefined HEX: 0003
: key-a HEX: 0004 ; inline CONSTANT: key-a HEX: 0004
: key-b HEX: 0005 ; inline CONSTANT: key-b HEX: 0005
: key-c HEX: 0006 ; inline CONSTANT: key-c HEX: 0006
: key-d HEX: 0007 ; inline CONSTANT: key-d HEX: 0007
: key-e HEX: 0008 ; inline CONSTANT: key-e HEX: 0008
: key-f HEX: 0009 ; inline CONSTANT: key-f HEX: 0009
: key-g HEX: 000a ; inline CONSTANT: key-g HEX: 000a
: key-h HEX: 000b ; inline CONSTANT: key-h HEX: 000b
: key-i HEX: 000c ; inline CONSTANT: key-i HEX: 000c
: key-j HEX: 000d ; inline CONSTANT: key-j HEX: 000d
: key-k HEX: 000e ; inline CONSTANT: key-k HEX: 000e
: key-l HEX: 000f ; inline CONSTANT: key-l HEX: 000f
: key-m HEX: 0010 ; inline CONSTANT: key-m HEX: 0010
: key-n HEX: 0011 ; inline CONSTANT: key-n HEX: 0011
: key-o HEX: 0012 ; inline CONSTANT: key-o HEX: 0012
: key-p HEX: 0013 ; inline CONSTANT: key-p HEX: 0013
: key-q HEX: 0014 ; inline CONSTANT: key-q HEX: 0014
: key-r HEX: 0015 ; inline CONSTANT: key-r HEX: 0015
: key-s HEX: 0016 ; inline CONSTANT: key-s HEX: 0016
: key-t HEX: 0017 ; inline CONSTANT: key-t HEX: 0017
: key-u HEX: 0018 ; inline CONSTANT: key-u HEX: 0018
: key-v HEX: 0019 ; inline CONSTANT: key-v HEX: 0019
: key-w HEX: 001a ; inline CONSTANT: key-w HEX: 001a
: key-x HEX: 001b ; inline CONSTANT: key-x HEX: 001b
: key-y HEX: 001c ; inline CONSTANT: key-y HEX: 001c
: key-z HEX: 001d ; inline CONSTANT: key-z HEX: 001d
: key-1 HEX: 001e ; inline CONSTANT: key-1 HEX: 001e
: key-2 HEX: 001f ; inline CONSTANT: key-2 HEX: 001f
: key-3 HEX: 0020 ; inline CONSTANT: key-3 HEX: 0020
: key-4 HEX: 0021 ; inline CONSTANT: key-4 HEX: 0021
: key-5 HEX: 0022 ; inline CONSTANT: key-5 HEX: 0022
: key-6 HEX: 0023 ; inline CONSTANT: key-6 HEX: 0023
: key-7 HEX: 0024 ; inline CONSTANT: key-7 HEX: 0024
: key-8 HEX: 0025 ; inline CONSTANT: key-8 HEX: 0025
: key-9 HEX: 0026 ; inline CONSTANT: key-9 HEX: 0026
: key-0 HEX: 0027 ; inline CONSTANT: key-0 HEX: 0027
: key-return HEX: 0028 ; inline CONSTANT: key-return HEX: 0028
: key-escape HEX: 0029 ; inline CONSTANT: key-escape HEX: 0029
: key-backspace HEX: 002a ; inline CONSTANT: key-backspace HEX: 002a
: key-tab HEX: 002b ; inline CONSTANT: key-tab HEX: 002b
: key-space HEX: 002c ; inline CONSTANT: key-space HEX: 002c
: key-- HEX: 002d ; inline CONSTANT: key-- HEX: 002d
: key-= HEX: 002e ; inline CONSTANT: key-= HEX: 002e
: key-[ HEX: 002f ; inline CONSTANT: key-[ HEX: 002f
: key-] HEX: 0030 ; inline CONSTANT: key-] HEX: 0030
: key-\ HEX: 0031 ; inline CONSTANT: key-\ HEX: 0031
: key-#-non-us HEX: 0032 ; inline CONSTANT: key-#-non-us HEX: 0032
: key-; HEX: 0033 ; inline CONSTANT: key-; HEX: 0033
: key-' HEX: 0034 ; inline CONSTANT: key-' HEX: 0034
: key-` HEX: 0035 ; inline CONSTANT: key-` HEX: 0035
: key-, HEX: 0036 ; inline CONSTANT: key-, HEX: 0036
: key-. HEX: 0037 ; inline CONSTANT: key-. HEX: 0037
: key-/ HEX: 0038 ; inline CONSTANT: key-/ HEX: 0038
: key-caps-lock HEX: 0039 ; inline CONSTANT: key-caps-lock HEX: 0039
: key-f1 HEX: 003a ; inline CONSTANT: key-f1 HEX: 003a
: key-f2 HEX: 003b ; inline CONSTANT: key-f2 HEX: 003b
: key-f3 HEX: 003c ; inline CONSTANT: key-f3 HEX: 003c
: key-f4 HEX: 003d ; inline CONSTANT: key-f4 HEX: 003d
: key-f5 HEX: 003e ; inline CONSTANT: key-f5 HEX: 003e
: key-f6 HEX: 003f ; inline CONSTANT: key-f6 HEX: 003f
: key-f7 HEX: 0040 ; inline CONSTANT: key-f7 HEX: 0040
: key-f8 HEX: 0041 ; inline CONSTANT: key-f8 HEX: 0041
: key-f9 HEX: 0042 ; inline CONSTANT: key-f9 HEX: 0042
: key-f10 HEX: 0043 ; inline CONSTANT: key-f10 HEX: 0043
: key-f11 HEX: 0044 ; inline CONSTANT: key-f11 HEX: 0044
: key-f12 HEX: 0045 ; inline CONSTANT: key-f12 HEX: 0045
: key-print-screen HEX: 0046 ; inline CONSTANT: key-print-screen HEX: 0046
: key-scroll-lock HEX: 0047 ; inline CONSTANT: key-scroll-lock HEX: 0047
: key-pause HEX: 0048 ; inline CONSTANT: key-pause HEX: 0048
: key-insert HEX: 0049 ; inline CONSTANT: key-insert HEX: 0049
: key-home HEX: 004a ; inline CONSTANT: key-home HEX: 004a
: key-page-up HEX: 004b ; inline CONSTANT: key-page-up HEX: 004b
: key-delete HEX: 004c ; inline CONSTANT: key-delete HEX: 004c
: key-end HEX: 004d ; inline CONSTANT: key-end HEX: 004d
: key-page-down HEX: 004e ; inline CONSTANT: key-page-down HEX: 004e
: key-right-arrow HEX: 004f ; inline CONSTANT: key-right-arrow HEX: 004f
: key-left-arrow HEX: 0050 ; inline CONSTANT: key-left-arrow HEX: 0050
: key-down-arrow HEX: 0051 ; inline CONSTANT: key-down-arrow HEX: 0051
: key-up-arrow HEX: 0052 ; inline CONSTANT: key-up-arrow HEX: 0052
: key-keypad-numlock HEX: 0053 ; inline CONSTANT: key-keypad-numlock HEX: 0053
: key-keypad-/ HEX: 0054 ; inline CONSTANT: key-keypad-/ HEX: 0054
: key-keypad-* HEX: 0055 ; inline CONSTANT: key-keypad-* HEX: 0055
: key-keypad-- HEX: 0056 ; inline CONSTANT: key-keypad-- HEX: 0056
: key-keypad-+ HEX: 0057 ; inline CONSTANT: key-keypad-+ HEX: 0057
: key-keypad-enter HEX: 0058 ; inline CONSTANT: key-keypad-enter HEX: 0058
: key-keypad-1 HEX: 0059 ; inline CONSTANT: key-keypad-1 HEX: 0059
: key-keypad-2 HEX: 005a ; inline CONSTANT: key-keypad-2 HEX: 005a
: key-keypad-3 HEX: 005b ; inline CONSTANT: key-keypad-3 HEX: 005b
: key-keypad-4 HEX: 005c ; inline CONSTANT: key-keypad-4 HEX: 005c
: key-keypad-5 HEX: 005d ; inline CONSTANT: key-keypad-5 HEX: 005d
: key-keypad-6 HEX: 005e ; inline CONSTANT: key-keypad-6 HEX: 005e
: key-keypad-7 HEX: 005f ; inline CONSTANT: key-keypad-7 HEX: 005f
: key-keypad-8 HEX: 0060 ; inline CONSTANT: key-keypad-8 HEX: 0060
: key-keypad-9 HEX: 0061 ; inline CONSTANT: key-keypad-9 HEX: 0061
: key-keypad-0 HEX: 0062 ; inline CONSTANT: key-keypad-0 HEX: 0062
: key-keypad-. HEX: 0063 ; inline CONSTANT: key-keypad-. HEX: 0063
: key-\-non-us HEX: 0064 ; inline CONSTANT: key-\-non-us HEX: 0064
: key-application HEX: 0065 ; inline CONSTANT: key-application HEX: 0065
: key-power HEX: 0066 ; inline CONSTANT: key-power HEX: 0066
: key-keypad-= HEX: 0067 ; inline CONSTANT: key-keypad-= HEX: 0067
: key-f13 HEX: 0068 ; inline CONSTANT: key-f13 HEX: 0068
: key-f14 HEX: 0069 ; inline CONSTANT: key-f14 HEX: 0069
: key-f15 HEX: 006a ; inline CONSTANT: key-f15 HEX: 006a
: key-f16 HEX: 006b ; inline CONSTANT: key-f16 HEX: 006b
: key-f17 HEX: 006c ; inline CONSTANT: key-f17 HEX: 006c
: key-f18 HEX: 006d ; inline CONSTANT: key-f18 HEX: 006d
: key-f19 HEX: 006e ; inline CONSTANT: key-f19 HEX: 006e
: key-f20 HEX: 006f ; inline CONSTANT: key-f20 HEX: 006f
: key-f21 HEX: 0070 ; inline CONSTANT: key-f21 HEX: 0070
: key-f22 HEX: 0071 ; inline CONSTANT: key-f22 HEX: 0071
: key-f23 HEX: 0072 ; inline CONSTANT: key-f23 HEX: 0072
: key-f24 HEX: 0073 ; inline CONSTANT: key-f24 HEX: 0073
: key-execute HEX: 0074 ; inline CONSTANT: key-execute HEX: 0074
: key-help HEX: 0075 ; inline CONSTANT: key-help HEX: 0075
: key-menu HEX: 0076 ; inline CONSTANT: key-menu HEX: 0076
: key-select HEX: 0077 ; inline CONSTANT: key-select HEX: 0077
: key-stop HEX: 0078 ; inline CONSTANT: key-stop HEX: 0078
: key-again HEX: 0079 ; inline CONSTANT: key-again HEX: 0079
: key-undo HEX: 007a ; inline CONSTANT: key-undo HEX: 007a
: key-cut HEX: 007b ; inline CONSTANT: key-cut HEX: 007b
: key-copy HEX: 007c ; inline CONSTANT: key-copy HEX: 007c
: key-paste HEX: 007d ; inline CONSTANT: key-paste HEX: 007d
: key-find HEX: 007e ; inline CONSTANT: key-find HEX: 007e
: key-mute HEX: 007f ; inline CONSTANT: key-mute HEX: 007f
: key-volume-up HEX: 0080 ; inline CONSTANT: key-volume-up HEX: 0080
: key-volume-down HEX: 0081 ; inline CONSTANT: key-volume-down HEX: 0081
: key-locking-caps-lock HEX: 0082 ; inline CONSTANT: key-locking-caps-lock HEX: 0082
: key-locking-num-lock HEX: 0083 ; inline CONSTANT: key-locking-num-lock HEX: 0083
: key-locking-scroll-lock HEX: 0084 ; inline CONSTANT: key-locking-scroll-lock HEX: 0084
: key-keypad-, HEX: 0085 ; inline CONSTANT: key-keypad-, HEX: 0085
: key-keypad-=-as-400 HEX: 0086 ; inline CONSTANT: key-keypad-=-as-400 HEX: 0086
: key-international-1 HEX: 0087 ; inline CONSTANT: key-international-1 HEX: 0087
: key-international-2 HEX: 0088 ; inline CONSTANT: key-international-2 HEX: 0088
: key-international-3 HEX: 0089 ; inline CONSTANT: key-international-3 HEX: 0089
: key-international-4 HEX: 008a ; inline CONSTANT: key-international-4 HEX: 008a
: key-international-5 HEX: 008b ; inline CONSTANT: key-international-5 HEX: 008b
: key-international-6 HEX: 008c ; inline CONSTANT: key-international-6 HEX: 008c
: key-international-7 HEX: 008d ; inline CONSTANT: key-international-7 HEX: 008d
: key-international-8 HEX: 008e ; inline CONSTANT: key-international-8 HEX: 008e
: key-international-9 HEX: 008f ; inline CONSTANT: key-international-9 HEX: 008f
: key-lang-1 HEX: 0090 ; inline CONSTANT: key-lang-1 HEX: 0090
: key-lang-2 HEX: 0091 ; inline CONSTANT: key-lang-2 HEX: 0091
: key-lang-3 HEX: 0092 ; inline CONSTANT: key-lang-3 HEX: 0092
: key-lang-4 HEX: 0093 ; inline CONSTANT: key-lang-4 HEX: 0093
: key-lang-5 HEX: 0094 ; inline CONSTANT: key-lang-5 HEX: 0094
: key-lang-6 HEX: 0095 ; inline CONSTANT: key-lang-6 HEX: 0095
: key-lang-7 HEX: 0096 ; inline CONSTANT: key-lang-7 HEX: 0096
: key-lang-8 HEX: 0097 ; inline CONSTANT: key-lang-8 HEX: 0097
: key-lang-9 HEX: 0098 ; inline CONSTANT: key-lang-9 HEX: 0098
: key-alternate-erase HEX: 0099 ; inline CONSTANT: key-alternate-erase HEX: 0099
: key-sysreq HEX: 009a ; inline CONSTANT: key-sysreq HEX: 009a
: key-cancel HEX: 009b ; inline CONSTANT: key-cancel HEX: 009b
: key-clear HEX: 009c ; inline CONSTANT: key-clear HEX: 009c
: key-prior HEX: 009d ; inline CONSTANT: key-prior HEX: 009d
: key-enter HEX: 009e ; inline CONSTANT: key-enter HEX: 009e
: key-separator HEX: 009f ; inline CONSTANT: key-separator HEX: 009f
: key-out HEX: 00a0 ; inline CONSTANT: key-out HEX: 00a0
: key-oper HEX: 00a1 ; inline CONSTANT: key-oper HEX: 00a1
: key-clear-again HEX: 00a2 ; inline CONSTANT: key-clear-again HEX: 00a2
: key-crsel-props HEX: 00a3 ; inline CONSTANT: key-crsel-props HEX: 00a3
: key-exsel HEX: 00a4 ; inline CONSTANT: key-exsel HEX: 00a4
: key-left-control HEX: 00e0 ; inline CONSTANT: key-left-control HEX: 00e0
: key-left-shift HEX: 00e1 ; inline CONSTANT: key-left-shift HEX: 00e1
: key-left-alt HEX: 00e2 ; inline CONSTANT: key-left-alt HEX: 00e2
: key-left-gui HEX: 00e3 ; inline CONSTANT: key-left-gui HEX: 00e3
: key-right-control HEX: 00e4 ; inline CONSTANT: key-right-control HEX: 00e4
: key-right-shift HEX: 00e5 ; inline CONSTANT: key-right-shift HEX: 00e5
: key-right-alt HEX: 00e6 ; inline CONSTANT: key-right-alt HEX: 00e6
: key-right-gui HEX: 00e7 ; inline CONSTANT: key-right-gui HEX: 00e7

View File

@ -14,11 +14,8 @@ ERROR: local-not-defined name ;
M: local-not-defined summary M: local-not-defined summary
drop "local is not defined" ; drop "local is not defined" ;
: at? ( key assoc -- value/key ? )
dupd at* [ nip t ] [ drop f ] if ;
: >local-word ( string -- word ) : >local-word ( string -- word )
locals get at? [ local-not-defined ] unless ; locals get ?at [ local-not-defined ] unless ;
: select-op ( string -- word ) : select-op ( string -- word )
{ {

View File

@ -14,8 +14,10 @@ M: invalid-baud summary ( invalid-baud -- string )
"Baud rate " " not supported" surround ; "Baud rate " " not supported" surround ;
HOOK: lookup-baud os ( m -- n ) HOOK: lookup-baud os ( m -- n )
HOOK: open-serial os ( serial -- stream ) HOOK: open-serial os ( serial -- serial' )
M: serial dispose ( serial -- ) stream>> dispose ;
{ {
{ [ os unix? ] [ "io.serial.unix" ] } { [ os unix? ] [ "io.serial.unix" ] }
{ [ os windows? ] [ "io.serial.windows" ] }
} cond require } cond require

View File

@ -10,77 +10,77 @@ M: bsd lookup-baud ( m -- n )
230400 460800 921600 230400 460800 921600
} member? [ invalid-baud ] unless ; } member? [ invalid-baud ] unless ;
: TCSANOW 0 ; inline CONSTANT: TCSANOW 0
: TCSADRAIN 1 ; inline CONSTANT: TCSADRAIN 1
: TCSAFLUSH 2 ; inline CONSTANT: TCSAFLUSH 2
: TCSASOFT HEX: 10 ; inline CONSTANT: TCSASOFT HEX: 10
: TCIFLUSH 1 ; inline CONSTANT: TCIFLUSH 1
: TCOFLUSH 2 ; inline CONSTANT: TCOFLUSH 2
: TCIOFLUSH 3 ; inline CONSTANT: TCIOFLUSH 3
: TCOOFF 1 ; inline CONSTANT: TCOOFF 1
: TCOON 2 ; inline CONSTANT: TCOON 2
: TCIOFF 3 ; inline CONSTANT: TCIOFF 3
: TCION 4 ; inline CONSTANT: TCION 4
! iflags ! iflags
: IGNBRK HEX: 00000001 ; inline CONSTANT: IGNBRK HEX: 00000001
: BRKINT HEX: 00000002 ; inline CONSTANT: BRKINT HEX: 00000002
: IGNPAR HEX: 00000004 ; inline CONSTANT: IGNPAR HEX: 00000004
: PARMRK HEX: 00000008 ; inline CONSTANT: PARMRK HEX: 00000008
: INPCK HEX: 00000010 ; inline CONSTANT: INPCK HEX: 00000010
: ISTRIP HEX: 00000020 ; inline CONSTANT: ISTRIP HEX: 00000020
: INLCR HEX: 00000040 ; inline CONSTANT: INLCR HEX: 00000040
: IGNCR HEX: 00000080 ; inline CONSTANT: IGNCR HEX: 00000080
: ICRNL HEX: 00000100 ; inline CONSTANT: ICRNL HEX: 00000100
: IXON HEX: 00000200 ; inline CONSTANT: IXON HEX: 00000200
: IXOFF HEX: 00000400 ; inline CONSTANT: IXOFF HEX: 00000400
: IXANY HEX: 00000800 ; inline CONSTANT: IXANY HEX: 00000800
: IMAXBEL HEX: 00002000 ; inline CONSTANT: IMAXBEL HEX: 00002000
: IUTF8 HEX: 00004000 ; inline CONSTANT: IUTF8 HEX: 00004000
! oflags ! oflags
: OPOST HEX: 00000001 ; inline CONSTANT: OPOST HEX: 00000001
: ONLCR HEX: 00000002 ; inline CONSTANT: ONLCR HEX: 00000002
: OXTABS HEX: 00000004 ; inline CONSTANT: OXTABS HEX: 00000004
: ONOEOT HEX: 00000008 ; inline CONSTANT: ONOEOT HEX: 00000008
! cflags ! cflags
: CIGNORE HEX: 00000001 ; inline CONSTANT: CIGNORE HEX: 00000001
: CSIZE HEX: 00000300 ; inline CONSTANT: CSIZE HEX: 00000300
: CS5 HEX: 00000000 ; inline CONSTANT: CS5 HEX: 00000000
: CS6 HEX: 00000100 ; inline CONSTANT: CS6 HEX: 00000100
: CS7 HEX: 00000200 ; inline CONSTANT: CS7 HEX: 00000200
: CS8 HEX: 00000300 ; inline CONSTANT: CS8 HEX: 00000300
: CSTOPB HEX: 00000400 ; inline CONSTANT: CSTOPB HEX: 00000400
: CREAD HEX: 00000800 ; inline CONSTANT: CREAD HEX: 00000800
: PARENB HEX: 00001000 ; inline CONSTANT: PARENB HEX: 00001000
: PARODD HEX: 00002000 ; inline CONSTANT: PARODD HEX: 00002000
: HUPCL HEX: 00004000 ; inline CONSTANT: HUPCL HEX: 00004000
: CLOCAL HEX: 00008000 ; inline CONSTANT: CLOCAL HEX: 00008000
: CCTS_OFLOW HEX: 00010000 ; inline CONSTANT: CCTS_OFLOW HEX: 00010000
: CRTS_IFLOW HEX: 00020000 ; inline CONSTANT: CRTS_IFLOW HEX: 00020000
: CRTSCTS { CCTS_OFLOW CRTS_IFLOW } flags ; inline : CRTSCTS ( -- n ) { CCTS_OFLOW CRTS_IFLOW } flags ; inline
: CDTR_IFLOW HEX: 00040000 ; inline CONSTANT: CDTR_IFLOW HEX: 00040000
: CDSR_OFLOW HEX: 00080000 ; inline CONSTANT: CDSR_OFLOW HEX: 00080000
: CCAR_OFLOW HEX: 00100000 ; inline CONSTANT: CCAR_OFLOW HEX: 00100000
: MDMBUF HEX: 00100000 ; inline CONSTANT: MDMBUF HEX: 00100000
! lflags ! lflags
: ECHOKE HEX: 00000001 ; inline CONSTANT: ECHOKE HEX: 00000001
: ECHOE HEX: 00000002 ; inline CONSTANT: ECHOE HEX: 00000002
: ECHOK HEX: 00000004 ; inline CONSTANT: ECHOK HEX: 00000004
: ECHO HEX: 00000008 ; inline CONSTANT: ECHO HEX: 00000008
: ECHONL HEX: 00000010 ; inline CONSTANT: ECHONL HEX: 00000010
: ECHOPRT HEX: 00000020 ; inline CONSTANT: ECHOPRT HEX: 00000020
: ECHOCTL HEX: 00000040 ; inline CONSTANT: ECHOCTL HEX: 00000040
: ISIG HEX: 00000080 ; inline CONSTANT: ISIG HEX: 00000080
: ICANON HEX: 00000100 ; inline CONSTANT: ICANON HEX: 00000100
: ALTWERASE HEX: 00000200 ; inline CONSTANT: ALTWERASE HEX: 00000200
: IEXTEN HEX: 00000400 ; inline CONSTANT: IEXTEN HEX: 00000400
: EXTPROC HEX: 00000800 ; inline CONSTANT: EXTPROC HEX: 00000800
: TOSTOP HEX: 00400000 ; inline CONSTANT: TOSTOP HEX: 00400000
: FLUSHO HEX: 00800000 ; inline CONSTANT: FLUSHO HEX: 00800000
: NOKERNINFO HEX: 02000000 ; inline CONSTANT: NOKERNINFO HEX: 02000000
: PENDIN HEX: 20000000 ; inline CONSTANT: PENDIN HEX: 20000000
: NOFLSH HEX: 80000000 ; inline CONSTANT: NOFLSH HEX: 80000000

View File

@ -3,96 +3,96 @@
USING: assocs alien.syntax kernel io.serial system unix ; USING: assocs alien.syntax kernel io.serial system unix ;
IN: io.serial.unix IN: io.serial.unix
: TCSANOW 0 ; inline CONSTANT: TCSANOW 0
: TCSADRAIN 1 ; inline CONSTANT: TCSADRAIN 1
: TCSAFLUSH 2 ; inline CONSTANT: TCSAFLUSH 2
: TCIFLUSH 0 ; inline CONSTANT: TCIFLUSH 0
: TCOFLUSH 1 ; inline CONSTANT: TCOFLUSH 1
: TCIOFLUSH 2 ; inline CONSTANT: TCIOFLUSH 2
: TCOOFF 0 ; inline CONSTANT: TCOOFF 0
: TCOON 1 ; inline CONSTANT: TCOON 1
: TCIOFF 2 ; inline CONSTANT: TCIOFF 2
: TCION 3 ; inline CONSTANT: TCION 3
! iflag ! iflag
: IGNBRK OCT: 0000001 ; inline CONSTANT: IGNBRK OCT: 0000001
: BRKINT OCT: 0000002 ; inline CONSTANT: BRKINT OCT: 0000002
: IGNPAR OCT: 0000004 ; inline CONSTANT: IGNPAR OCT: 0000004
: PARMRK OCT: 0000010 ; inline CONSTANT: PARMRK OCT: 0000010
: INPCK OCT: 0000020 ; inline CONSTANT: INPCK OCT: 0000020
: ISTRIP OCT: 0000040 ; inline CONSTANT: ISTRIP OCT: 0000040
: INLCR OCT: 0000100 ; inline CONSTANT: INLCR OCT: 0000100
: IGNCR OCT: 0000200 ; inline CONSTANT: IGNCR OCT: 0000200
: ICRNL OCT: 0000400 ; inline CONSTANT: ICRNL OCT: 0000400
: IUCLC OCT: 0001000 ; inline CONSTANT: IUCLC OCT: 0001000
: IXON OCT: 0002000 ; inline CONSTANT: IXON OCT: 0002000
: IXANY OCT: 0004000 ; inline CONSTANT: IXANY OCT: 0004000
: IXOFF OCT: 0010000 ; inline CONSTANT: IXOFF OCT: 0010000
: IMAXBEL OCT: 0020000 ; inline CONSTANT: IMAXBEL OCT: 0020000
: IUTF8 OCT: 0040000 ; inline CONSTANT: IUTF8 OCT: 0040000
! oflag ! oflag
: OPOST OCT: 0000001 ; inline CONSTANT: OPOST OCT: 0000001
: OLCUC OCT: 0000002 ; inline CONSTANT: OLCUC OCT: 0000002
: ONLCR OCT: 0000004 ; inline CONSTANT: ONLCR OCT: 0000004
: OCRNL OCT: 0000010 ; inline CONSTANT: OCRNL OCT: 0000010
: ONOCR OCT: 0000020 ; inline CONSTANT: ONOCR OCT: 0000020
: ONLRET OCT: 0000040 ; inline CONSTANT: ONLRET OCT: 0000040
: OFILL OCT: 0000100 ; inline CONSTANT: OFILL OCT: 0000100
: OFDEL OCT: 0000200 ; inline CONSTANT: OFDEL OCT: 0000200
: NLDLY OCT: 0000400 ; inline CONSTANT: NLDLY OCT: 0000400
: NL0 OCT: 0000000 ; inline CONSTANT: NL0 OCT: 0000000
: NL1 OCT: 0000400 ; inline CONSTANT: NL1 OCT: 0000400
: CRDLY OCT: 0003000 ; inline CONSTANT: CRDLY OCT: 0003000
: CR0 OCT: 0000000 ; inline CONSTANT: CR0 OCT: 0000000
: CR1 OCT: 0001000 ; inline CONSTANT: CR1 OCT: 0001000
: CR2 OCT: 0002000 ; inline CONSTANT: CR2 OCT: 0002000
: CR3 OCT: 0003000 ; inline CONSTANT: CR3 OCT: 0003000
: TABDLY OCT: 0014000 ; inline CONSTANT: TABDLY OCT: 0014000
: TAB0 OCT: 0000000 ; inline CONSTANT: TAB0 OCT: 0000000
: TAB1 OCT: 0004000 ; inline CONSTANT: TAB1 OCT: 0004000
: TAB2 OCT: 0010000 ; inline CONSTANT: TAB2 OCT: 0010000
: TAB3 OCT: 0014000 ; inline CONSTANT: TAB3 OCT: 0014000
: BSDLY OCT: 0020000 ; inline CONSTANT: BSDLY OCT: 0020000
: BS0 OCT: 0000000 ; inline CONSTANT: BS0 OCT: 0000000
: BS1 OCT: 0020000 ; inline CONSTANT: BS1 OCT: 0020000
: FFDLY OCT: 0100000 ; inline CONSTANT: FFDLY OCT: 0100000
: FF0 OCT: 0000000 ; inline CONSTANT: FF0 OCT: 0000000
: FF1 OCT: 0100000 ; inline CONSTANT: FF1 OCT: 0100000
! cflags ! cflags
: CSIZE OCT: 0000060 ; inline CONSTANT: CSIZE OCT: 0000060
: CS5 OCT: 0000000 ; inline CONSTANT: CS5 OCT: 0000000
: CS6 OCT: 0000020 ; inline CONSTANT: CS6 OCT: 0000020
: CS7 OCT: 0000040 ; inline CONSTANT: CS7 OCT: 0000040
: CS8 OCT: 0000060 ; inline CONSTANT: CS8 OCT: 0000060
: CSTOPB OCT: 0000100 ; inline CONSTANT: CSTOPB OCT: 0000100
: CREAD OCT: 0000200 ; inline CONSTANT: CREAD OCT: 0000200
: PARENB OCT: 0000400 ; inline CONSTANT: PARENB OCT: 0000400
: PARODD OCT: 0001000 ; inline CONSTANT: PARODD OCT: 0001000
: HUPCL OCT: 0002000 ; inline CONSTANT: HUPCL OCT: 0002000
: CLOCAL OCT: 0004000 ; inline CONSTANT: CLOCAL OCT: 0004000
: CIBAUD OCT: 002003600000 ; inline CONSTANT: CIBAUD OCT: 002003600000
: CRTSCTS OCT: 020000000000 ; inline CONSTANT: CRTSCTS OCT: 020000000000
! lflags ! lflags
: ISIG OCT: 0000001 ; inline CONSTANT: ISIG OCT: 0000001
: ICANON OCT: 0000002 ; inline CONSTANT: ICANON OCT: 0000002
: XCASE OCT: 0000004 ; inline CONSTANT: XCASE OCT: 0000004
: ECHO OCT: 0000010 ; inline CONSTANT: ECHO OCT: 0000010
: ECHOE OCT: 0000020 ; inline CONSTANT: ECHOE OCT: 0000020
: ECHOK OCT: 0000040 ; inline CONSTANT: ECHOK OCT: 0000040
: ECHONL OCT: 0000100 ; inline CONSTANT: ECHONL OCT: 0000100
: NOFLSH OCT: 0000200 ; inline CONSTANT: NOFLSH OCT: 0000200
: TOSTOP OCT: 0000400 ; inline CONSTANT: TOSTOP OCT: 0000400
: ECHOCTL OCT: 0001000 ; inline CONSTANT: ECHOCTL OCT: 0001000
: ECHOPRT OCT: 0002000 ; inline CONSTANT: ECHOPRT OCT: 0002000
: ECHOKE OCT: 0004000 ; inline CONSTANT: ECHOKE OCT: 0004000
: FLUSHO OCT: 0010000 ; inline CONSTANT: FLUSHO OCT: 0010000
: PENDIN OCT: 0040000 ; inline CONSTANT: PENDIN OCT: 0040000
: IEXTEN OCT: 0100000 ; inline CONSTANT: IEXTEN OCT: 0100000
M: linux lookup-baud ( n -- n ) M: linux lookup-baud ( n -- n )
dup H{ dup H{
@ -127,4 +127,4 @@ M: linux lookup-baud ( n -- n )
{ 3000000 OCT: 0010015 } { 3000000 OCT: 0010015 }
{ 3500000 OCT: 0010016 } { 3500000 OCT: 0010016 }
{ 4000000 OCT: 0010017 } { 4000000 OCT: 0010017 }
} at* [ nip ] [ drop invalid-baud ] if ; } ?at [ invalid-baud ] unless ;

View File

@ -3,7 +3,7 @@
USING: alien.syntax kernel sequences system ; USING: alien.syntax kernel sequences system ;
IN: io.serial.unix.termios IN: io.serial.unix.termios
: NCCS 20 ; inline CONSTANT: NCCS 20
TYPEDEF: uint tcflag_t TYPEDEF: uint tcflag_t
TYPEDEF: uchar cc_t TYPEDEF: uchar cc_t

View File

@ -3,7 +3,7 @@
USING: alien.syntax kernel system unix ; USING: alien.syntax kernel system unix ;
IN: io.serial.unix.termios IN: io.serial.unix.termios
: NCCS 32 ; inline CONSTANT: NCCS 32
TYPEDEF: uchar cc_t TYPEDEF: uchar cc_t
TYPEDEF: uint speed_t TYPEDEF: uint speed_t

View File

@ -1,6 +1,6 @@
! 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: accessors kernel math.bitwise serial serial.unix ; USING: accessors kernel math.bitwise io.serial io.serial.unix ;
IN: io.serial.unix IN: io.serial.unix
: serial-obj ( -- obj ) : serial-obj ( -- obj )

View File

@ -1,8 +1,8 @@
! 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: accessors alien.c-types alien.syntax combinators io.ports USING: accessors alien.c-types alien.syntax combinators io.ports
io.streams.duplex io.unix.backend system kernel math math.bitwise io.streams.duplex system kernel math math.bitwise
vocabs.loader unix io.serial io.serial.unix.termios ; vocabs.loader unix io.serial io.serial.unix.termios io.backend.unix ;
IN: io.serial.unix IN: io.serial.unix
<< { << {
@ -31,8 +31,9 @@ FUNCTION: int cfsetspeed ( termios* t, speed_t s ) ;
: <file-rw> ( path -- stream ) open-rw fd>duplex-stream ; : <file-rw> ( path -- stream ) open-rw fd>duplex-stream ;
M: unix open-serial ( serial -- serial' ) M: unix open-serial ( serial -- serial' )
dup
path>> { O_RDWR O_NOCTTY O_NDELAY } flags file-mode open-file path>> { O_RDWR O_NOCTTY O_NDELAY } flags file-mode open-file
fd>duplex-stream ; fd>duplex-stream >>stream ;
: serial-fd ( serial -- fd ) : serial-fd ( serial -- fd )
stream>> in>> handle>> fd>> ; stream>> in>> handle>> fd>> ;

View File

@ -3,7 +3,7 @@
USING: io.files.windows io.streams.duplex kernel math USING: io.files.windows io.streams.duplex kernel math
math.bitwise windows.kernel32 accessors alien.c-types math.bitwise windows.kernel32 accessors alien.c-types
windows io.files.windows fry locals continuations ; windows io.files.windows fry locals continuations ;
IN: serial.windows IN: io.serial.windows
: <serial-stream> ( path encoding -- duplex ) : <serial-stream> ( path encoding -- duplex )
[ open-r/w dup ] dip <encoder-duplex> ; [ open-r/w dup ] dip <encoder-duplex> ;

View File

@ -2,117 +2,117 @@ USING: iokit alien alien.syntax alien.c-types kernel
system core-foundation ; system core-foundation ;
IN: iokit.hid IN: iokit.hid
: kIOHIDDeviceKey "IOHIDDevice" ; inline CONSTANT: kIOHIDDeviceKey "IOHIDDevice"
: kIOHIDTransportKey "Transport" ; inline CONSTANT: kIOHIDTransportKey "Transport"
: kIOHIDVendorIDKey "VendorID" ; inline CONSTANT: kIOHIDVendorIDKey "VendorID"
: kIOHIDVendorIDSourceKey "VendorIDSource" ; inline CONSTANT: kIOHIDVendorIDSourceKey "VendorIDSource"
: kIOHIDProductIDKey "ProductID" ; inline CONSTANT: kIOHIDProductIDKey "ProductID"
: kIOHIDVersionNumberKey "VersionNumber" ; inline CONSTANT: kIOHIDVersionNumberKey "VersionNumber"
: kIOHIDManufacturerKey "Manufacturer" ; inline CONSTANT: kIOHIDManufacturerKey "Manufacturer"
: kIOHIDProductKey "Product" ; inline CONSTANT: kIOHIDProductKey "Product"
: kIOHIDSerialNumberKey "SerialNumber" ; inline CONSTANT: kIOHIDSerialNumberKey "SerialNumber"
: kIOHIDCountryCodeKey "CountryCode" ; inline CONSTANT: kIOHIDCountryCodeKey "CountryCode"
: kIOHIDLocationIDKey "LocationID" ; inline CONSTANT: kIOHIDLocationIDKey "LocationID"
: kIOHIDDeviceUsageKey "DeviceUsage" ; inline CONSTANT: kIOHIDDeviceUsageKey "DeviceUsage"
: kIOHIDDeviceUsagePageKey "DeviceUsagePage" ; inline CONSTANT: kIOHIDDeviceUsagePageKey "DeviceUsagePage"
: kIOHIDDeviceUsagePairsKey "DeviceUsagePairs" ; inline CONSTANT: kIOHIDDeviceUsagePairsKey "DeviceUsagePairs"
: kIOHIDPrimaryUsageKey "PrimaryUsage" ; inline CONSTANT: kIOHIDPrimaryUsageKey "PrimaryUsage"
: kIOHIDPrimaryUsagePageKey "PrimaryUsagePage" ; inline CONSTANT: kIOHIDPrimaryUsagePageKey "PrimaryUsagePage"
: kIOHIDMaxInputReportSizeKey "MaxInputReportSize" ; inline CONSTANT: kIOHIDMaxInputReportSizeKey "MaxInputReportSize"
: kIOHIDMaxOutputReportSizeKey "MaxOutputReportSize" ; inline CONSTANT: kIOHIDMaxOutputReportSizeKey "MaxOutputReportSize"
: kIOHIDMaxFeatureReportSizeKey "MaxFeatureReportSize" ; inline CONSTANT: kIOHIDMaxFeatureReportSizeKey "MaxFeatureReportSize"
: kIOHIDReportIntervalKey "ReportInterval" ; inline CONSTANT: kIOHIDReportIntervalKey "ReportInterval"
: kIOHIDElementKey "Elements" ; inline CONSTANT: kIOHIDElementKey "Elements"
: kIOHIDElementCookieKey "ElementCookie" ; inline CONSTANT: kIOHIDElementCookieKey "ElementCookie"
: kIOHIDElementTypeKey "Type" ; inline CONSTANT: kIOHIDElementTypeKey "Type"
: kIOHIDElementCollectionTypeKey "CollectionType" ; inline CONSTANT: kIOHIDElementCollectionTypeKey "CollectionType"
: kIOHIDElementUsageKey "Usage" ; inline CONSTANT: kIOHIDElementUsageKey "Usage"
: kIOHIDElementUsagePageKey "UsagePage" ; inline CONSTANT: kIOHIDElementUsagePageKey "UsagePage"
: kIOHIDElementMinKey "Min" ; inline CONSTANT: kIOHIDElementMinKey "Min"
: kIOHIDElementMaxKey "Max" ; inline CONSTANT: kIOHIDElementMaxKey "Max"
: kIOHIDElementScaledMinKey "ScaledMin" ; inline CONSTANT: kIOHIDElementScaledMinKey "ScaledMin"
: kIOHIDElementScaledMaxKey "ScaledMax" ; inline CONSTANT: kIOHIDElementScaledMaxKey "ScaledMax"
: kIOHIDElementSizeKey "Size" ; inline CONSTANT: kIOHIDElementSizeKey "Size"
: kIOHIDElementReportSizeKey "ReportSize" ; inline CONSTANT: kIOHIDElementReportSizeKey "ReportSize"
: kIOHIDElementReportCountKey "ReportCount" ; inline CONSTANT: kIOHIDElementReportCountKey "ReportCount"
: kIOHIDElementReportIDKey "ReportID" ; inline CONSTANT: kIOHIDElementReportIDKey "ReportID"
: kIOHIDElementIsArrayKey "IsArray" ; inline CONSTANT: kIOHIDElementIsArrayKey "IsArray"
: kIOHIDElementIsRelativeKey "IsRelative" ; inline CONSTANT: kIOHIDElementIsRelativeKey "IsRelative"
: kIOHIDElementIsWrappingKey "IsWrapping" ; inline CONSTANT: kIOHIDElementIsWrappingKey "IsWrapping"
: kIOHIDElementIsNonLinearKey "IsNonLinear" ; inline CONSTANT: kIOHIDElementIsNonLinearKey "IsNonLinear"
: kIOHIDElementHasPreferredStateKey "HasPreferredState" ; inline CONSTANT: kIOHIDElementHasPreferredStateKey "HasPreferredState"
: kIOHIDElementHasNullStateKey "HasNullState" ; inline CONSTANT: kIOHIDElementHasNullStateKey "HasNullState"
: kIOHIDElementFlagsKey "Flags" ; inline CONSTANT: kIOHIDElementFlagsKey "Flags"
: kIOHIDElementUnitKey "Unit" ; inline CONSTANT: kIOHIDElementUnitKey "Unit"
: kIOHIDElementUnitExponentKey "UnitExponent" ; inline CONSTANT: kIOHIDElementUnitExponentKey "UnitExponent"
: kIOHIDElementNameKey "Name" ; inline CONSTANT: kIOHIDElementNameKey "Name"
: kIOHIDElementValueLocationKey "ValueLocation" ; inline CONSTANT: kIOHIDElementValueLocationKey "ValueLocation"
: kIOHIDElementDuplicateIndexKey "DuplicateIndex" ; inline CONSTANT: kIOHIDElementDuplicateIndexKey "DuplicateIndex"
: kIOHIDElementParentCollectionKey "ParentCollection" ; inline CONSTANT: kIOHIDElementParentCollectionKey "ParentCollection"
: kIOHIDElementVendorSpecificKey ( -- str ) : kIOHIDElementVendorSpecificKey ( -- str )
cpu ppc? "VendorSpecifc" "VendorSpecific" ? ; inline cpu ppc? "VendorSpecifc" "VendorSpecific" ? ; inline
: kIOHIDElementCookieMinKey "ElementCookieMin" ; inline CONSTANT: kIOHIDElementCookieMinKey "ElementCookieMin"
: kIOHIDElementCookieMaxKey "ElementCookieMax" ; inline CONSTANT: kIOHIDElementCookieMaxKey "ElementCookieMax"
: kIOHIDElementUsageMinKey "UsageMin" ; inline CONSTANT: kIOHIDElementUsageMinKey "UsageMin"
: kIOHIDElementUsageMaxKey "UsageMax" ; inline CONSTANT: kIOHIDElementUsageMaxKey "UsageMax"
: kIOHIDElementCalibrationMinKey "CalibrationMin" ; inline CONSTANT: kIOHIDElementCalibrationMinKey "CalibrationMin"
: kIOHIDElementCalibrationMaxKey "CalibrationMax" ; inline CONSTANT: kIOHIDElementCalibrationMaxKey "CalibrationMax"
: kIOHIDElementCalibrationSaturationMinKey "CalibrationSaturationMin" ; inline CONSTANT: kIOHIDElementCalibrationSaturationMinKey "CalibrationSaturationMin"
: kIOHIDElementCalibrationSaturationMaxKey "CalibrationSaturationMax" ; inline CONSTANT: kIOHIDElementCalibrationSaturationMaxKey "CalibrationSaturationMax"
: kIOHIDElementCalibrationDeadZoneMinKey "CalibrationDeadZoneMin" ; inline CONSTANT: kIOHIDElementCalibrationDeadZoneMinKey "CalibrationDeadZoneMin"
: kIOHIDElementCalibrationDeadZoneMaxKey "CalibrationDeadZoneMax" ; inline CONSTANT: kIOHIDElementCalibrationDeadZoneMaxKey "CalibrationDeadZoneMax"
: kIOHIDElementCalibrationGranularityKey "CalibrationGranularity" ; inline CONSTANT: kIOHIDElementCalibrationGranularityKey "CalibrationGranularity"
: kIOHIDElementTypeInput_Misc 1 ; inline CONSTANT: kIOHIDElementTypeInput_Misc 1
: kIOHIDElementTypeInput_Button 2 ; inline CONSTANT: kIOHIDElementTypeInput_Button 2
: kIOHIDElementTypeInput_Axis 3 ; inline CONSTANT: kIOHIDElementTypeInput_Axis 3
: kIOHIDElementTypeInput_ScanCodes 4 ; inline CONSTANT: kIOHIDElementTypeInput_ScanCodes 4
: kIOHIDElementTypeOutput 129 ; inline CONSTANT: kIOHIDElementTypeOutput 129
: kIOHIDElementTypeFeature 257 ; inline CONSTANT: kIOHIDElementTypeFeature 257
: kIOHIDElementTypeCollection 513 ; inline CONSTANT: kIOHIDElementTypeCollection 513
: kIOHIDElementCollectionTypePhysical HEX: 00 ; inline CONSTANT: kIOHIDElementCollectionTypePhysical HEX: 00
: kIOHIDElementCollectionTypeApplication HEX: 01 ; inline CONSTANT: kIOHIDElementCollectionTypeApplication HEX: 01
: kIOHIDElementCollectionTypeLogical HEX: 02 ; inline CONSTANT: kIOHIDElementCollectionTypeLogical HEX: 02
: kIOHIDElementCollectionTypeReport HEX: 03 ; inline CONSTANT: kIOHIDElementCollectionTypeReport HEX: 03
: kIOHIDElementCollectionTypeNamedArray HEX: 04 ; inline CONSTANT: kIOHIDElementCollectionTypeNamedArray HEX: 04
: kIOHIDElementCollectionTypeUsageSwitch HEX: 05 ; inline CONSTANT: kIOHIDElementCollectionTypeUsageSwitch HEX: 05
: kIOHIDElementCollectionTypeUsageModifier HEX: 06 ; inline CONSTANT: kIOHIDElementCollectionTypeUsageModifier HEX: 06
: kIOHIDReportTypeInput 0 ; inline CONSTANT: kIOHIDReportTypeInput 0
: kIOHIDReportTypeOutput 1 ; inline CONSTANT: kIOHIDReportTypeOutput 1
: kIOHIDReportTypeFeature 2 ; inline CONSTANT: kIOHIDReportTypeFeature 2
: kIOHIDReportTypeCount 3 ; inline CONSTANT: kIOHIDReportTypeCount 3
: kIOHIDOptionsTypeNone HEX: 00 ; inline CONSTANT: kIOHIDOptionsTypeNone HEX: 00
: kIOHIDOptionsTypeSeizeDevice HEX: 01 ; inline CONSTANT: kIOHIDOptionsTypeSeizeDevice HEX: 01
: kIOHIDQueueOptionsTypeNone HEX: 00 ; inline CONSTANT: kIOHIDQueueOptionsTypeNone HEX: 00
: kIOHIDQueueOptionsTypeEnqueueAll HEX: 01 ; inline CONSTANT: kIOHIDQueueOptionsTypeEnqueueAll HEX: 01
: kIOHIDElementFlagsConstantMask HEX: 0001 ; inline CONSTANT: kIOHIDElementFlagsConstantMask HEX: 0001
: kIOHIDElementFlagsVariableMask HEX: 0002 ; inline CONSTANT: kIOHIDElementFlagsVariableMask HEX: 0002
: kIOHIDElementFlagsRelativeMask HEX: 0004 ; inline CONSTANT: kIOHIDElementFlagsRelativeMask HEX: 0004
: kIOHIDElementFlagsWrapMask HEX: 0008 ; inline CONSTANT: kIOHIDElementFlagsWrapMask HEX: 0008
: kIOHIDElementFlagsNonLinearMask HEX: 0010 ; inline CONSTANT: kIOHIDElementFlagsNonLinearMask HEX: 0010
: kIOHIDElementFlagsNoPreferredMask HEX: 0020 ; inline CONSTANT: kIOHIDElementFlagsNoPreferredMask HEX: 0020
: kIOHIDElementFlagsNullStateMask HEX: 0040 ; inline CONSTANT: kIOHIDElementFlagsNullStateMask HEX: 0040
: kIOHIDElementFlagsVolativeMask HEX: 0080 ; inline CONSTANT: kIOHIDElementFlagsVolativeMask HEX: 0080
: kIOHIDElementFlagsBufferedByteMask HEX: 0100 ; inline CONSTANT: kIOHIDElementFlagsBufferedByteMask HEX: 0100
: kIOHIDValueScaleTypeCalibrated 0 ; inline CONSTANT: kIOHIDValueScaleTypeCalibrated 0
: kIOHIDValueScaleTypePhysical 1 ; inline CONSTANT: kIOHIDValueScaleTypePhysical 1
: kIOHIDTransactionDirectionTypeInput 0 ; inline CONSTANT: kIOHIDTransactionDirectionTypeInput 0
: kIOHIDTransactionDirectionTypeOutput 1 ; inline CONSTANT: kIOHIDTransactionDirectionTypeOutput 1
: kIOHIDTransactionOptionDefaultOutputValue 1 ; inline CONSTANT: kIOHIDTransactionOptionDefaultOutputValue 1
TYPEDEF: ptrdiff_t IOHIDElementCookie TYPEDEF: ptrdiff_t IOHIDElementCookie
TYPEDEF: int IOHIDElementType TYPEDEF: int IOHIDElementType

View File

@ -9,95 +9,95 @@ IN: iokit
when when
>> >>
: kIOKitBuildVersionKey "IOKitBuildVersion" ; inline CONSTANT: kIOKitBuildVersionKey "IOKitBuildVersion"
: kIOKitDiagnosticsKey "IOKitDiagnostics" ; inline CONSTANT: kIOKitDiagnosticsKey "IOKitDiagnostics"
: kIORegistryPlanesKey "IORegistryPlanes" ; inline CONSTANT: kIORegistryPlanesKey "IORegistryPlanes"
: kIOCatalogueKey "IOCatalogue" ; inline CONSTANT: kIOCatalogueKey "IOCatalogue"
: kIOServicePlane "IOService" ; inline CONSTANT: kIOServicePlane "IOService"
: kIOPowerPlane "IOPower" ; inline CONSTANT: kIOPowerPlane "IOPower"
: kIODeviceTreePlane "IODeviceTree" ; inline CONSTANT: kIODeviceTreePlane "IODeviceTree"
: kIOAudioPlane "IOAudio" ; inline CONSTANT: kIOAudioPlane "IOAudio"
: kIOFireWirePlane "IOFireWire" ; inline CONSTANT: kIOFireWirePlane "IOFireWire"
: kIOUSBPlane "IOUSB" ; inline CONSTANT: kIOUSBPlane "IOUSB"
: kIOServiceClass "IOService" ; inline CONSTANT: kIOServiceClass "IOService"
: kIOResourcesClass "IOResources" ; inline CONSTANT: kIOResourcesClass "IOResources"
: kIOClassKey "IOClass" ; inline CONSTANT: kIOClassKey "IOClass"
: kIOProbeScoreKey "IOProbeScore" ; inline CONSTANT: kIOProbeScoreKey "IOProbeScore"
: kIOKitDebugKey "IOKitDebug" ; inline CONSTANT: kIOKitDebugKey "IOKitDebug"
: kIOProviderClassKey "IOProviderClass" ; inline CONSTANT: kIOProviderClassKey "IOProviderClass"
: kIONameMatchKey "IONameMatch" ; inline CONSTANT: kIONameMatchKey "IONameMatch"
: kIOPropertyMatchKey "IOPropertyMatch" ; inline CONSTANT: kIOPropertyMatchKey "IOPropertyMatch"
: kIOPathMatchKey "IOPathMatch" ; inline CONSTANT: kIOPathMatchKey "IOPathMatch"
: kIOLocationMatchKey "IOLocationMatch" ; inline CONSTANT: kIOLocationMatchKey "IOLocationMatch"
: kIOParentMatchKey "IOParentMatch" ; inline CONSTANT: kIOParentMatchKey "IOParentMatch"
: kIOResourceMatchKey "IOResourceMatch" ; inline CONSTANT: kIOResourceMatchKey "IOResourceMatch"
: kIOMatchedServiceCountKey "IOMatchedServiceCountMatch" ; inline CONSTANT: kIOMatchedServiceCountKey "IOMatchedServiceCountMatch"
: kIONameMatchedKey "IONameMatched" ; inline CONSTANT: kIONameMatchedKey "IONameMatched"
: kIOMatchCategoryKey "IOMatchCategory" ; inline CONSTANT: kIOMatchCategoryKey "IOMatchCategory"
: kIODefaultMatchCategoryKey "IODefaultMatchCategory" ; inline CONSTANT: kIODefaultMatchCategoryKey "IODefaultMatchCategory"
: kIOUserClientClassKey "IOUserClientClass" ; inline CONSTANT: kIOUserClientClassKey "IOUserClientClass"
: kIOUserClientCrossEndianKey "IOUserClientCrossEndian" ; inline CONSTANT: kIOUserClientCrossEndianKey "IOUserClientCrossEndian"
: kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible" ; inline CONSTANT: kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible"
: kIOUserClientSharedInstanceKey "IOUserClientSharedInstance" ; inline CONSTANT: kIOUserClientSharedInstanceKey "IOUserClientSharedInstance"
: kIOPublishNotification "IOServicePublish" ; inline CONSTANT: kIOPublishNotification "IOServicePublish"
: kIOFirstPublishNotification "IOServiceFirstPublish" ; inline CONSTANT: kIOFirstPublishNotification "IOServiceFirstPublish"
: kIOMatchedNotification "IOServiceMatched" ; inline CONSTANT: kIOMatchedNotification "IOServiceMatched"
: kIOFirstMatchNotification "IOServiceFirstMatch" ; inline CONSTANT: kIOFirstMatchNotification "IOServiceFirstMatch"
: kIOTerminatedNotification "IOServiceTerminate" ; inline CONSTANT: kIOTerminatedNotification "IOServiceTerminate"
: kIOGeneralInterest "IOGeneralInterest" ; inline CONSTANT: kIOGeneralInterest "IOGeneralInterest"
: kIOBusyInterest "IOBusyInterest" ; inline CONSTANT: kIOBusyInterest "IOBusyInterest"
: kIOAppPowerStateInterest "IOAppPowerStateInterest" ; inline CONSTANT: kIOAppPowerStateInterest "IOAppPowerStateInterest"
: kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest" ; inline CONSTANT: kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest"
: kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage" ; inline CONSTANT: kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage"
: kIOCFPlugInTypesKey "IOCFPlugInTypes" ; inline CONSTANT: kIOCFPlugInTypesKey "IOCFPlugInTypes"
: kIOCommandPoolSizeKey "IOCommandPoolSize" ; inline CONSTANT: kIOCommandPoolSizeKey "IOCommandPoolSize"
: kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead" ; inline CONSTANT: kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead"
: kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite" ; inline CONSTANT: kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite"
: kIOMaximumByteCountReadKey "IOMaximumByteCountRead" ; inline CONSTANT: kIOMaximumByteCountReadKey "IOMaximumByteCountRead"
: kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite" ; inline CONSTANT: kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite"
: kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead" ; inline CONSTANT: kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead"
: kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite" ; inline CONSTANT: kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite"
: kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead" ; inline CONSTANT: kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead"
: kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite" ; inline CONSTANT: kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite"
: kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount" ; inline CONSTANT: kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount"
: kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount" ; inline CONSTANT: kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount"
: kIOIconKey "IOIcon" ; inline CONSTANT: kIOIconKey "IOIcon"
: kIOBundleResourceFileKey "IOBundleResourceFile" ; inline CONSTANT: kIOBundleResourceFileKey "IOBundleResourceFile"
: kIOBusBadgeKey "IOBusBadge" ; inline CONSTANT: kIOBusBadgeKey "IOBusBadge"
: kIODeviceIconKey "IODeviceIcon" ; inline CONSTANT: kIODeviceIconKey "IODeviceIcon"
: kIOPlatformSerialNumberKey "IOPlatformSerialNumber" ; inline CONSTANT: kIOPlatformSerialNumberKey "IOPlatformSerialNumber"
: kIOPlatformUUIDKey "IOPlatformUUID" ; inline CONSTANT: kIOPlatformUUIDKey "IOPlatformUUID"
: kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY" ; inline CONSTANT: kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY"
: kIODTNVRAMPanicInfoKey "aapl,panic-info" ; inline CONSTANT: kIODTNVRAMPanicInfoKey "aapl,panic-info"
: kIOBootDeviceKey "IOBootDevice" ; inline CONSTANT: kIOBootDeviceKey "IOBootDevice"
: kIOBootDevicePathKey "IOBootDevicePath" ; inline CONSTANT: kIOBootDevicePathKey "IOBootDevicePath"
: kIOBootDeviceSizeKey "IOBootDeviceSize" ; inline CONSTANT: kIOBootDeviceSizeKey "IOBootDeviceSize"
: kOSBuildVersionKey "OS Build Version" ; inline CONSTANT: kOSBuildVersionKey "OS Build Version"
: kNilOptions 0 ; inline CONSTANT: kNilOptions 0
TYPEDEF: uint mach_port_t TYPEDEF: uint mach_port_t
TYPEDEF: int kern_return_t TYPEDEF: int kern_return_t
@ -112,8 +112,8 @@ TYPEDEF: kern_return_t IOReturn
TYPEDEF: uint IOOptionBits TYPEDEF: uint IOOptionBits
: MACH_PORT_NULL 0 ; inline CONSTANT: MACH_PORT_NULL 0
: KERN_SUCCESS 0 ; inline CONSTANT: KERN_SUCCESS 0
FUNCTION: IOReturn IOMasterPort ( mach_port_t bootstrap, mach_port_t* master ) ; FUNCTION: IOReturn IOMasterPort ( mach_port_t bootstrap, mach_port_t* master ) ;

View File

@ -9,7 +9,7 @@ IN: math.analysis
! http://www.rskey.org/gamma.htm "Lanczos Approximation" ! http://www.rskey.org/gamma.htm "Lanczos Approximation"
! n=6: error ~ 3 x 10^-11 ! n=6: error ~ 3 x 10^-11
: gamma-g6 5.15 ; inline CONSTANT: gamma-g6 5.15
: gamma-p6 : gamma-p6
{ {

View File

@ -4,8 +4,8 @@ ui.render accessors combinators ;
IN: opengl.demo-support IN: opengl.demo-support
: FOV ( -- x ) 2.0 sqrt 1+ ; inline : FOV ( -- x ) 2.0 sqrt 1+ ; inline
: MOUSE-MOTION-SCALE 0.5 ; inline CONSTANT: MOUSE-MOTION-SCALE 0.5
: KEY-ROTATE-STEP 10.0 ; inline CONSTANT: KEY-ROTATE-STEP 10.0
SYMBOL: last-drag-loc SYMBOL: last-drag-loc

View File

@ -1,24 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types assocs combinators destructors
kernel math math.bitwise math.parser sequences summary system
vocabs.loader ;
IN: serial
TUPLE: serial stream path baud
termios iflag oflag cflag lflag ;
ERROR: invalid-baud baud ;
M: invalid-baud summary ( invalid-baud -- string )
"Baud rate "
swap baud>> number>string
" not supported" 3append ;
HOOK: lookup-baud os ( m -- n )
HOOK: open-serial os ( serial -- serial' )
M: serial dispose ( serial -- ) stream>> dispose ;
{
{ [ os unix? ] [ "serial.unix" ] }
{ [ os windows? ] [ "serial.windows" ] }
} cond require

View File

@ -1 +0,0 @@
Serial port library

View File

@ -1,86 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel math.bitwise sequences system serial ;
IN: serial.unix
M: bsd lookup-baud ( m -- n )
dup {
0 50 75 110 134 150 200 300 600 1200 1800 2400 4800
7200 9600 14400 19200 28800 38400 57600 76800 115200
230400 460800 921600
} member? [ invalid-baud ] unless ;
: TCSANOW 0 ; inline
: TCSADRAIN 1 ; inline
: TCSAFLUSH 2 ; inline
: TCSASOFT HEX: 10 ; inline
: TCIFLUSH 1 ; inline
: TCOFLUSH 2 ; inline
: TCIOFLUSH 3 ; inline
: TCOOFF 1 ; inline
: TCOON 2 ; inline
: TCIOFF 3 ; inline
: TCION 4 ; inline
! iflags
: IGNBRK HEX: 00000001 ; inline
: BRKINT HEX: 00000002 ; inline
: IGNPAR HEX: 00000004 ; inline
: PARMRK HEX: 00000008 ; inline
: INPCK HEX: 00000010 ; inline
: ISTRIP HEX: 00000020 ; inline
: INLCR HEX: 00000040 ; inline
: IGNCR HEX: 00000080 ; inline
: ICRNL HEX: 00000100 ; inline
: IXON HEX: 00000200 ; inline
: IXOFF HEX: 00000400 ; inline
: IXANY HEX: 00000800 ; inline
: IMAXBEL HEX: 00002000 ; inline
: IUTF8 HEX: 00004000 ; inline
! oflags
: OPOST HEX: 00000001 ; inline
: ONLCR HEX: 00000002 ; inline
: OXTABS HEX: 00000004 ; inline
: ONOEOT HEX: 00000008 ; inline
! cflags
: CIGNORE HEX: 00000001 ; inline
: CSIZE HEX: 00000300 ; inline
: CS5 HEX: 00000000 ; inline
: CS6 HEX: 00000100 ; inline
: CS7 HEX: 00000200 ; inline
: CS8 HEX: 00000300 ; inline
: CSTOPB HEX: 00000400 ; inline
: CREAD HEX: 00000800 ; inline
: PARENB HEX: 00001000 ; inline
: PARODD HEX: 00002000 ; inline
: HUPCL HEX: 00004000 ; inline
: CLOCAL HEX: 00008000 ; inline
: CCTS_OFLOW HEX: 00010000 ; inline
: CRTS_IFLOW HEX: 00020000 ; inline
: CRTSCTS { CCTS_OFLOW CRTS_IFLOW } flags ; inline
: CDTR_IFLOW HEX: 00040000 ; inline
: CDSR_OFLOW HEX: 00080000 ; inline
: CCAR_OFLOW HEX: 00100000 ; inline
: MDMBUF HEX: 00100000 ; inline
! lflags
: ECHOKE HEX: 00000001 ; inline
: ECHOE HEX: 00000002 ; inline
: ECHOK HEX: 00000004 ; inline
: ECHO HEX: 00000008 ; inline
: ECHONL HEX: 00000010 ; inline
: ECHOPRT HEX: 00000020 ; inline
: ECHOCTL HEX: 00000040 ; inline
: ISIG HEX: 00000080 ; inline
: ICANON HEX: 00000100 ; inline
: ALTWERASE HEX: 00000200 ; inline
: IEXTEN HEX: 00000400 ; inline
: EXTPROC HEX: 00000800 ; inline
: TOSTOP HEX: 00400000 ; inline
: FLUSHO HEX: 00800000 ; inline
: NOKERNINFO HEX: 02000000 ; inline
: PENDIN HEX: 20000000 ; inline
: NOFLSH HEX: 80000000 ; inline

View File

@ -1 +0,0 @@
unportable

View File

@ -1,130 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs alien.syntax kernel serial system unix ;
IN: serial.unix
: TCSANOW 0 ; inline
: TCSADRAIN 1 ; inline
: TCSAFLUSH 2 ; inline
: TCIFLUSH 0 ; inline
: TCOFLUSH 1 ; inline
: TCIOFLUSH 2 ; inline
: TCOOFF 0 ; inline
: TCOON 1 ; inline
: TCIOFF 2 ; inline
: TCION 3 ; inline
! iflag
: IGNBRK OCT: 0000001 ; inline
: BRKINT OCT: 0000002 ; inline
: IGNPAR OCT: 0000004 ; inline
: PARMRK OCT: 0000010 ; inline
: INPCK OCT: 0000020 ; inline
: ISTRIP OCT: 0000040 ; inline
: INLCR OCT: 0000100 ; inline
: IGNCR OCT: 0000200 ; inline
: ICRNL OCT: 0000400 ; inline
: IUCLC OCT: 0001000 ; inline
: IXON OCT: 0002000 ; inline
: IXANY OCT: 0004000 ; inline
: IXOFF OCT: 0010000 ; inline
: IMAXBEL OCT: 0020000 ; inline
: IUTF8 OCT: 0040000 ; inline
! oflag
: OPOST OCT: 0000001 ; inline
: OLCUC OCT: 0000002 ; inline
: ONLCR OCT: 0000004 ; inline
: OCRNL OCT: 0000010 ; inline
: ONOCR OCT: 0000020 ; inline
: ONLRET OCT: 0000040 ; inline
: OFILL OCT: 0000100 ; inline
: OFDEL OCT: 0000200 ; inline
: NLDLY OCT: 0000400 ; inline
: NL0 OCT: 0000000 ; inline
: NL1 OCT: 0000400 ; inline
: CRDLY OCT: 0003000 ; inline
: CR0 OCT: 0000000 ; inline
: CR1 OCT: 0001000 ; inline
: CR2 OCT: 0002000 ; inline
: CR3 OCT: 0003000 ; inline
: TABDLY OCT: 0014000 ; inline
: TAB0 OCT: 0000000 ; inline
: TAB1 OCT: 0004000 ; inline
: TAB2 OCT: 0010000 ; inline
: TAB3 OCT: 0014000 ; inline
: BSDLY OCT: 0020000 ; inline
: BS0 OCT: 0000000 ; inline
: BS1 OCT: 0020000 ; inline
: FFDLY OCT: 0100000 ; inline
: FF0 OCT: 0000000 ; inline
: FF1 OCT: 0100000 ; inline
! cflags
: CSIZE OCT: 0000060 ; inline
: CS5 OCT: 0000000 ; inline
: CS6 OCT: 0000020 ; inline
: CS7 OCT: 0000040 ; inline
: CS8 OCT: 0000060 ; inline
: CSTOPB OCT: 0000100 ; inline
: CREAD OCT: 0000200 ; inline
: PARENB OCT: 0000400 ; inline
: PARODD OCT: 0001000 ; inline
: HUPCL OCT: 0002000 ; inline
: CLOCAL OCT: 0004000 ; inline
: CIBAUD OCT: 002003600000 ; inline
: CRTSCTS OCT: 020000000000 ; inline
! lflags
: ISIG OCT: 0000001 ; inline
: ICANON OCT: 0000002 ; inline
: XCASE OCT: 0000004 ; inline
: ECHO OCT: 0000010 ; inline
: ECHOE OCT: 0000020 ; inline
: ECHOK OCT: 0000040 ; inline
: ECHONL OCT: 0000100 ; inline
: NOFLSH OCT: 0000200 ; inline
: TOSTOP OCT: 0000400 ; inline
: ECHOCTL OCT: 0001000 ; inline
: ECHOPRT OCT: 0002000 ; inline
: ECHOKE OCT: 0004000 ; inline
: FLUSHO OCT: 0010000 ; inline
: PENDIN OCT: 0040000 ; inline
: IEXTEN OCT: 0100000 ; inline
M: linux lookup-baud ( n -- n )
dup H{
{ 0 OCT: 0000000 }
{ 50 OCT: 0000001 }
{ 75 OCT: 0000002 }
{ 110 OCT: 0000003 }
{ 134 OCT: 0000004 }
{ 150 OCT: 0000005 }
{ 200 OCT: 0000006 }
{ 300 OCT: 0000007 }
{ 600 OCT: 0000010 }
{ 1200 OCT: 0000011 }
{ 1800 OCT: 0000012 }
{ 2400 OCT: 0000013 }
{ 4800 OCT: 0000014 }
{ 9600 OCT: 0000015 }
{ 19200 OCT: 0000016 }
{ 38400 OCT: 0000017 }
{ 57600 OCT: 0010001 }
{ 115200 OCT: 0010002 }
{ 230400 OCT: 0010003 }
{ 460800 OCT: 0010004 }
{ 500000 OCT: 0010005 }
{ 576000 OCT: 0010006 }
{ 921600 OCT: 0010007 }
{ 1000000 OCT: 0010010 }
{ 1152000 OCT: 0010011 }
{ 1500000 OCT: 0010012 }
{ 2000000 OCT: 0010013 }
{ 2500000 OCT: 0010014 }
{ 3000000 OCT: 0010015 }
{ 3500000 OCT: 0010016 }
{ 4000000 OCT: 0010017 }
} at* [ nip ] [ drop invalid-baud ] if ;

View File

@ -1 +0,0 @@
unportable

View File

@ -1 +0,0 @@
unportable

Some files were not shown because too many files have changed in this diff Show More