specialized-arrays.direct.alien ;
IN: cocoa.enumeration
- : NS-EACH-BUFFER-SIZE 16 ; inline
+ CONSTANT: NS-EACH-BUFFER-SIZE 16
: with-enumeration-buffers ( quot -- )
- [
- [
- "NSFastEnumerationState" malloc-object &free
- NS-EACH-BUFFER-SIZE "id" heap-size * malloc-object &free
- NS-EACH-BUFFER-SIZE
- ] dip call
+ '[
+ "NSFastEnumerationState" malloc-object &free
+ NS-EACH-BUFFER-SIZE "id" malloc-array &free
+ NS-EACH-BUFFER-SIZE
+ @
] with-destructors ; inline
:: (NSFastEnumeration-each) ( object quot: ( elt -- ) state stackbuf count -- )
-! Copyright (C) 2003, 2008 Slava Pestov.
+! Copyright (C) 2003, 2009 Slava Pestov.
! Copyright (C) 2008 Eduardo Cavazos.
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors ;
+USING: kernel accessors combinators math ;
IN: colors
TUPLE: color ;
- TUPLE: rgba < color { red read-only } { green read-only } { blue read-only } { alpha read-only } ;
-TUPLE: rgba < color red green blue alpha ;
++TUPLE: rgba < color
++{ red read-only }
++{ green read-only }
++{ blue read-only }
++{ alpha read-only } ;
C: <rgba> rgba
-GENERIC: >rgba ( object -- rgba )
+GENERIC: >rgba ( color -- rgba )
M: rgba >rgba ( rgba -- rgba ) ;
-M: color red>> ( color -- red ) >rgba red>> ;
+M: color red>> ( color -- red ) >rgba red>> ;
M: color green>> ( color -- green ) >rgba green>> ;
-M: color blue>> ( color -- blue ) >rgba blue>> ;
-
-CONSTANT: black T{ rgba f 0.0 0.0 0.0 1.0 }
-CONSTANT: blue T{ rgba f 0.0 0.0 1.0 1.0 }
-CONSTANT: cyan T{ rgba f 0 0.941 0.941 1 }
-CONSTANT: gray T{ rgba f 0.6 0.6 0.6 1.0 }
-CONSTANT: green T{ rgba f 0.0 1.0 0.0 1.0 }
-CONSTANT: light-gray T{ rgba f 0.95 0.95 0.95 0.95 }
-CONSTANT: light-purple T{ rgba f 0.8 0.8 1.0 1.0 }
-CONSTANT: magenta T{ rgba f 0.941 0 0.941 1 }
-CONSTANT: orange T{ rgba f 0.941 0.627 0 1 }
-CONSTANT: purple T{ rgba f 0.627 0 0.941 1 }
-CONSTANT: red T{ rgba f 1.0 0.0 0.0 1.0 }
-CONSTANT: white T{ rgba f 1.0 1.0 1.0 1.0 }
-CONSTANT: yellow T{ rgba f 1.0 1.0 0.0 1.0 }
+M: color blue>> ( color -- blue ) >rgba blue>> ;
+
+: >rgba-components ( object -- r g b a )
+ >rgba { [ red>> ] [ green>> ] [ blue>> ] [ alpha>> ] } cleave ; inline
+
+: opaque? ( color -- ? ) alpha>> 1 number= ;
+
+CONSTANT: transparent T{ rgba f 0.0 0.0 0.0 0.0 }
core-foundation.time ;
IN: core-foundation.run-loop
- : kCFRunLoopRunFinished 1 ; inline
- : kCFRunLoopRunStopped 2 ; inline
- : kCFRunLoopRunTimedOut 3 ; inline
- : kCFRunLoopRunHandledSource 4 ; inline
+ CONSTANT: kCFRunLoopRunFinished 1
+ CONSTANT: kCFRunLoopRunStopped 2
+ CONSTANT: kCFRunLoopRunTimedOut 3
+ CONSTANT: kCFRunLoopRunHandledSource 4
TYPEDEF: void* CFRunLoopRef
TYPEDEF: void* CFRunLoopSourceRef
: CFRunLoopDefaultMode ( -- alien )
#! Ugly, but we don't have static NSStrings
- \ CFRunLoopDefaultMode get-global dup expired? [
- drop
+ \ CFRunLoopDefaultMode [
"kCFRunLoopDefaultMode" <CFString>
- dup \ CFRunLoopDefaultMode set-global
- ] when ;
+ ] initialize-alien ;
TUPLE: run-loop fds sources timers ;
: <run-loop> ( -- run-loop )
V{ } clone V{ } clone V{ } clone \ run-loop boa ;
-SYMBOL: expiry-check
-
: run-loop ( -- run-loop )
- \ run-loop get-global not expiry-check get expired? or
- [
- 31337 <alien> expiry-check set-global
- <run-loop> dup \ run-loop set-global
- ] [ \ run-loop get-global ] if ;
+ \ run-loop [ <run-loop> ] initialize-alien ;
: add-source-to-run-loop ( source -- )
[ run-loop sources>> push ]
-! Copyright (C) 2005, 2007 Slava Pestov.
+! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.x
USING: accessors arrays definitions generic assocs
io kernel namespaces make prettyprint prettyprint.sections
M: link >link ;
M: vocab-spec >link ;
M: object >link link boa ;
+M: f >link drop \ f >link ;
PREDICATE: word-link < link name>> word? ;
M: link summary
[
"Link: " %
- name>> dup word? [ summary ] [ unparse ] if %
+ name>> dup word? [ summary ] [ unparse-short ] if %
] "" make ;
! Help articles
drop "Help article does not exist" ;
: 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-title article article-title ;
M: f article-title drop \ f article-title ;
M: f article-content drop \ f article-content ;
M: f article-parent drop \ f article-parent ;
-M: f set-article-parent drop \ f set-article-parent ;
+M: f set-article-parent drop \ f set-article-parent ;
! Copyright (C) 2004, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
- USING: math kernel math.constants math.private
+ USING: math kernel math.constants math.private math.bits
math.libm combinators math.order sequences ;
IN: math.functions
M: real sqrt
>float dup 0.0 < [ neg fsqrt 0.0 swap rect> ] [ fsqrt ] if ;
- : each-bit ( n quot: ( ? -- ) -- )
- over [ 0 = ] [ -1 = ] bi or [
- 2drop
- ] [
- 2dup { [ odd? ] [ call ] [ 2/ ] [ each-bit ] } spread
- ] if ; inline recursive
-
- : map-bits ( n quot: ( ? -- obj ) -- seq )
- accumulator [ each-bit ] dip ; inline
-
: factor-2s ( n -- r s )
#! factor an integer into 2^r * s
dup 0 = [ 1 ] [
GENERIC# ^n 1 ( z w -- z^w )
: (^n) ( z w -- z^w )
- 1 swap [ [ dupd * ] when [ sq ] dip ] each-bit nip ; inline
+ make-bits 1 [ [ dupd * ] when [ sq ] dip ] reduce nip ; inline
M: integer ^n
[ factor-2s ] dip [ (^n) ] keep rot * shift ;
M: ratio ^n
- [ >fraction ] dip tuck [ ^n ] 2bi@ / ;
+ [ >fraction ] dip [ ^n ] curry bi@ / ;
M: float ^n
(^n) ;
dup zero? [ drop 0./0. ] [ 0 < 1./0. 0 ? ] if ; inline
: (^mod) ( n x y -- z )
- 1 swap [
+ make-bits 1 [
[ dupd * pick mod ] when [ sq over mod ] dip
- ] each-bit 2nip ; inline
+ ] reduce 2nip ; inline
: (gcd) ( b a x y -- a d )
over zero? [
namespaces make quotations assocs combinators classes.tuple
classes.tuple.private effects summary hashtables classes generic
sets definitions generic.standard slots.private continuations locals
-stack-checker.backend stack-checker.state stack-checker.visitor
-stack-checker.errors stack-checker.values
+generalizations stack-checker.backend stack-checker.state
+stack-checker.visitor stack-checker.errors stack-checker.values
stack-checker.recursive-state ;
IN: stack-checker.transforms
] 1 define-transform
! Membership testing
- : bit-member-n 256 ; inline
+ CONSTANT: bit-member-n 256
: bit-member? ( seq -- ? )
#! Can we use a fast byte array test here?
\ memq? [
dup sequence? [ memq-quot ] [ drop f ] if
] 1 define-transform
+
+! Shuffling
+: nths-quot ( indices -- quot )
+ [ [ '[ _ swap nth ] ] map ] [ length ] bi
+ '[ _ cleave _ narray ] ;
+
+\ shuffle [
+ shuffle-mapping nths-quot
+] 1 define-transform
M: assoc assoc-like drop ;
+ : ?at ( key assoc -- value/key ? )
+ dupd at* [ [ nip ] [ drop ] if ] keep ; inline
+
<PRIVATE
: (assoc-each) ( assoc quot -- seq quot' )
[ first = ] with find swap ; inline
: substituter ( assoc -- quot )
- [ dupd at* [ nip ] [ drop ] if ] curry ; inline
+ [ ?at drop ] curry ; inline
: with-assoc ( assoc quot: ( value key -- assoc ) -- quot: ( key value -- ) )
curry [ swap ] prepose ; inline
: assoc-partition ( assoc quot -- true-assoc false-assoc )
[ (assoc-each) partition ] [ drop ] 2bi
- tuck [ assoc-like ] 2bi@ ; inline
+ [ assoc-like ] curry bi@ ; inline
: assoc-any? ( assoc quot -- ? )
assoc-find 2nip ; inline
at* drop ; inline
: at-default ( key assoc -- value/key )
- 2dup at* [ 2nip ] [ 2drop ] if ; inline
+ ?at drop ; inline
M: assoc assoc-clone-like ( assoc exemplar -- newassoc )
[ dup assoc-size ] dip new-assoc
! Copyright (C) 2006 Doug Coleman
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math sequences sequences.private namespaces
-words io io.binary io.files io.streams.string quotations
+words io io.binary io.files quotations
definitions checksums ;
IN: checksums.crc32
- : crc32-polynomial HEX: edb88320 ; inline
+ CONSTANT: crc32-polynomial HEX: edb88320
- : crc32-table V{ } ; inline
+ CONSTANT: crc32-table V{ }
256 [
8 [
GENERIC: <decoder> ( stream encoding -- newstream )
- : replacement-char HEX: fffd ; inline
+ CONSTANT: replacement-char HEX: fffd
TUPLE: decoder stream code cr ;
: (read) ( n quot -- n string )
over 0 <string> [
[
- slip over
- [ swapd set-nth-unsafe f ] [ 3drop t ] if
- ] 2curry find-integer
+ over [ swapd set-nth-unsafe f ] [ 3drop t ] if
+ ] curry compose find-integer
] keep ; inline
: finish-read ( n string -- string/f )
} cond ; inline
M: decoder stream-read
- tuck >decoder< [ decode-char ] 2curry (read) finish-read fix-read ;
+ [ nip ] [ >decoder< [ decode-char ] 2curry (read) finish-read ] 2bi
+ fix-read ;
M: decoder stream-read-partial stream-read ;
: compiled-xref ( word dependencies generic-dependencies -- )
[ [ drop crossref? ] { } assoc-filter-as f like ] bi@
- [ over ] dip
[ "compiled-uses" compiled-crossref (compiled-xref) ]
[ "compiled-generic-uses" compiled-generic-crossref (compiled-xref) ]
- 2bi* ;
+ bi-curry* bi ;
: (compiled-unxref) ( word word-prop variable -- )
[ [ [ dupd word-prop ] dip get remove-vertex* ] 2curry ]
SYMBOL: visited
- : reset-on-redefine { "inferred-effect" "cannot-infer" } ; inline
+ CONSTANT: reset-on-redefine { "inferred-effect" "cannot-infer" }
: (redefined) ( word -- )
dup visited get key? [ drop ] [
USING: iokit alien alien.syntax alien.c-types kernel
-system core-foundation ;
+system core-foundation core-foundation.data
+core-foundation.dictionaries ;
IN: iokit.hid
- : kIOHIDDeviceKey "IOHIDDevice" ; inline
-
- : kIOHIDTransportKey "Transport" ; inline
- : kIOHIDVendorIDKey "VendorID" ; inline
- : kIOHIDVendorIDSourceKey "VendorIDSource" ; inline
- : kIOHIDProductIDKey "ProductID" ; inline
- : kIOHIDVersionNumberKey "VersionNumber" ; inline
- : kIOHIDManufacturerKey "Manufacturer" ; inline
- : kIOHIDProductKey "Product" ; inline
- : kIOHIDSerialNumberKey "SerialNumber" ; inline
- : kIOHIDCountryCodeKey "CountryCode" ; inline
- : kIOHIDLocationIDKey "LocationID" ; inline
- : kIOHIDDeviceUsageKey "DeviceUsage" ; inline
- : kIOHIDDeviceUsagePageKey "DeviceUsagePage" ; inline
- : kIOHIDDeviceUsagePairsKey "DeviceUsagePairs" ; inline
- : kIOHIDPrimaryUsageKey "PrimaryUsage" ; inline
- : kIOHIDPrimaryUsagePageKey "PrimaryUsagePage" ; inline
- : kIOHIDMaxInputReportSizeKey "MaxInputReportSize" ; inline
- : kIOHIDMaxOutputReportSizeKey "MaxOutputReportSize" ; inline
- : kIOHIDMaxFeatureReportSizeKey "MaxFeatureReportSize" ; inline
- : kIOHIDReportIntervalKey "ReportInterval" ; inline
-
- : kIOHIDElementKey "Elements" ; inline
-
- : kIOHIDElementCookieKey "ElementCookie" ; inline
- : kIOHIDElementTypeKey "Type" ; inline
- : kIOHIDElementCollectionTypeKey "CollectionType" ; inline
- : kIOHIDElementUsageKey "Usage" ; inline
- : kIOHIDElementUsagePageKey "UsagePage" ; inline
- : kIOHIDElementMinKey "Min" ; inline
- : kIOHIDElementMaxKey "Max" ; inline
- : kIOHIDElementScaledMinKey "ScaledMin" ; inline
- : kIOHIDElementScaledMaxKey "ScaledMax" ; inline
- : kIOHIDElementSizeKey "Size" ; inline
- : kIOHIDElementReportSizeKey "ReportSize" ; inline
- : kIOHIDElementReportCountKey "ReportCount" ; inline
- : kIOHIDElementReportIDKey "ReportID" ; inline
- : kIOHIDElementIsArrayKey "IsArray" ; inline
- : kIOHIDElementIsRelativeKey "IsRelative" ; inline
- : kIOHIDElementIsWrappingKey "IsWrapping" ; inline
- : kIOHIDElementIsNonLinearKey "IsNonLinear" ; inline
- : kIOHIDElementHasPreferredStateKey "HasPreferredState" ; inline
- : kIOHIDElementHasNullStateKey "HasNullState" ; inline
- : kIOHIDElementFlagsKey "Flags" ; inline
- : kIOHIDElementUnitKey "Unit" ; inline
- : kIOHIDElementUnitExponentKey "UnitExponent" ; inline
- : kIOHIDElementNameKey "Name" ; inline
- : kIOHIDElementValueLocationKey "ValueLocation" ; inline
- : kIOHIDElementDuplicateIndexKey "DuplicateIndex" ; inline
- : kIOHIDElementParentCollectionKey "ParentCollection" ; inline
+ CONSTANT: kIOHIDDeviceKey "IOHIDDevice"
+
+ CONSTANT: kIOHIDTransportKey "Transport"
+ CONSTANT: kIOHIDVendorIDKey "VendorID"
+ CONSTANT: kIOHIDVendorIDSourceKey "VendorIDSource"
+ CONSTANT: kIOHIDProductIDKey "ProductID"
+ CONSTANT: kIOHIDVersionNumberKey "VersionNumber"
+ CONSTANT: kIOHIDManufacturerKey "Manufacturer"
+ CONSTANT: kIOHIDProductKey "Product"
+ CONSTANT: kIOHIDSerialNumberKey "SerialNumber"
+ CONSTANT: kIOHIDCountryCodeKey "CountryCode"
+ CONSTANT: kIOHIDLocationIDKey "LocationID"
+ CONSTANT: kIOHIDDeviceUsageKey "DeviceUsage"
+ CONSTANT: kIOHIDDeviceUsagePageKey "DeviceUsagePage"
+ CONSTANT: kIOHIDDeviceUsagePairsKey "DeviceUsagePairs"
+ CONSTANT: kIOHIDPrimaryUsageKey "PrimaryUsage"
+ CONSTANT: kIOHIDPrimaryUsagePageKey "PrimaryUsagePage"
+ CONSTANT: kIOHIDMaxInputReportSizeKey "MaxInputReportSize"
+ CONSTANT: kIOHIDMaxOutputReportSizeKey "MaxOutputReportSize"
+ CONSTANT: kIOHIDMaxFeatureReportSizeKey "MaxFeatureReportSize"
+ CONSTANT: kIOHIDReportIntervalKey "ReportInterval"
+
+ CONSTANT: kIOHIDElementKey "Elements"
+
+ CONSTANT: kIOHIDElementCookieKey "ElementCookie"
+ CONSTANT: kIOHIDElementTypeKey "Type"
+ CONSTANT: kIOHIDElementCollectionTypeKey "CollectionType"
+ CONSTANT: kIOHIDElementUsageKey "Usage"
+ CONSTANT: kIOHIDElementUsagePageKey "UsagePage"
+ CONSTANT: kIOHIDElementMinKey "Min"
+ CONSTANT: kIOHIDElementMaxKey "Max"
+ CONSTANT: kIOHIDElementScaledMinKey "ScaledMin"
+ CONSTANT: kIOHIDElementScaledMaxKey "ScaledMax"
+ CONSTANT: kIOHIDElementSizeKey "Size"
+ CONSTANT: kIOHIDElementReportSizeKey "ReportSize"
+ CONSTANT: kIOHIDElementReportCountKey "ReportCount"
+ CONSTANT: kIOHIDElementReportIDKey "ReportID"
+ CONSTANT: kIOHIDElementIsArrayKey "IsArray"
+ CONSTANT: kIOHIDElementIsRelativeKey "IsRelative"
+ CONSTANT: kIOHIDElementIsWrappingKey "IsWrapping"
+ CONSTANT: kIOHIDElementIsNonLinearKey "IsNonLinear"
+ CONSTANT: kIOHIDElementHasPreferredStateKey "HasPreferredState"
+ CONSTANT: kIOHIDElementHasNullStateKey "HasNullState"
+ CONSTANT: kIOHIDElementFlagsKey "Flags"
+ CONSTANT: kIOHIDElementUnitKey "Unit"
+ CONSTANT: kIOHIDElementUnitExponentKey "UnitExponent"
+ CONSTANT: kIOHIDElementNameKey "Name"
+ CONSTANT: kIOHIDElementValueLocationKey "ValueLocation"
+ CONSTANT: kIOHIDElementDuplicateIndexKey "DuplicateIndex"
+ CONSTANT: kIOHIDElementParentCollectionKey "ParentCollection"
: kIOHIDElementVendorSpecificKey ( -- str )
cpu ppc? "VendorSpecifc" "VendorSpecific" ? ; inline
- : kIOHIDElementCookieMinKey "ElementCookieMin" ; inline
- : kIOHIDElementCookieMaxKey "ElementCookieMax" ; inline
- : kIOHIDElementUsageMinKey "UsageMin" ; inline
- : kIOHIDElementUsageMaxKey "UsageMax" ; inline
-
- : kIOHIDElementCalibrationMinKey "CalibrationMin" ; inline
- : kIOHIDElementCalibrationMaxKey "CalibrationMax" ; inline
- : kIOHIDElementCalibrationSaturationMinKey "CalibrationSaturationMin" ; inline
- : kIOHIDElementCalibrationSaturationMaxKey "CalibrationSaturationMax" ; inline
- : kIOHIDElementCalibrationDeadZoneMinKey "CalibrationDeadZoneMin" ; inline
- : kIOHIDElementCalibrationDeadZoneMaxKey "CalibrationDeadZoneMax" ; inline
- : kIOHIDElementCalibrationGranularityKey "CalibrationGranularity" ; inline
-
- : kIOHIDElementTypeInput_Misc 1 ; inline
- : kIOHIDElementTypeInput_Button 2 ; inline
- : kIOHIDElementTypeInput_Axis 3 ; inline
- : kIOHIDElementTypeInput_ScanCodes 4 ; inline
- : kIOHIDElementTypeOutput 129 ; inline
- : kIOHIDElementTypeFeature 257 ; inline
- : kIOHIDElementTypeCollection 513 ; inline
-
- : kIOHIDElementCollectionTypePhysical HEX: 00 ; inline
- : kIOHIDElementCollectionTypeApplication HEX: 01 ; inline
- : kIOHIDElementCollectionTypeLogical HEX: 02 ; inline
- : kIOHIDElementCollectionTypeReport HEX: 03 ; inline
- : kIOHIDElementCollectionTypeNamedArray HEX: 04 ; inline
- : kIOHIDElementCollectionTypeUsageSwitch HEX: 05 ; inline
- : kIOHIDElementCollectionTypeUsageModifier HEX: 06 ; inline
-
- : kIOHIDReportTypeInput 0 ; inline
- : kIOHIDReportTypeOutput 1 ; inline
- : kIOHIDReportTypeFeature 2 ; inline
- : kIOHIDReportTypeCount 3 ; inline
-
- : kIOHIDOptionsTypeNone HEX: 00 ; inline
- : kIOHIDOptionsTypeSeizeDevice HEX: 01 ; inline
-
- : kIOHIDQueueOptionsTypeNone HEX: 00 ; inline
- : kIOHIDQueueOptionsTypeEnqueueAll HEX: 01 ; inline
-
- : kIOHIDElementFlagsConstantMask HEX: 0001 ; inline
- : kIOHIDElementFlagsVariableMask HEX: 0002 ; inline
- : kIOHIDElementFlagsRelativeMask HEX: 0004 ; inline
- : kIOHIDElementFlagsWrapMask HEX: 0008 ; inline
- : kIOHIDElementFlagsNonLinearMask HEX: 0010 ; inline
- : kIOHIDElementFlagsNoPreferredMask HEX: 0020 ; inline
- : kIOHIDElementFlagsNullStateMask HEX: 0040 ; inline
- : kIOHIDElementFlagsVolativeMask HEX: 0080 ; inline
- : kIOHIDElementFlagsBufferedByteMask HEX: 0100 ; inline
-
- : kIOHIDValueScaleTypeCalibrated 0 ; inline
- : kIOHIDValueScaleTypePhysical 1 ; inline
-
- : kIOHIDTransactionDirectionTypeInput 0 ; inline
- : kIOHIDTransactionDirectionTypeOutput 1 ; inline
-
- : kIOHIDTransactionOptionDefaultOutputValue 1 ; inline
+ CONSTANT: kIOHIDElementCookieMinKey "ElementCookieMin"
+ CONSTANT: kIOHIDElementCookieMaxKey "ElementCookieMax"
+ CONSTANT: kIOHIDElementUsageMinKey "UsageMin"
+ CONSTANT: kIOHIDElementUsageMaxKey "UsageMax"
+
+ CONSTANT: kIOHIDElementCalibrationMinKey "CalibrationMin"
+ CONSTANT: kIOHIDElementCalibrationMaxKey "CalibrationMax"
+ CONSTANT: kIOHIDElementCalibrationSaturationMinKey "CalibrationSaturationMin"
+ CONSTANT: kIOHIDElementCalibrationSaturationMaxKey "CalibrationSaturationMax"
+ CONSTANT: kIOHIDElementCalibrationDeadZoneMinKey "CalibrationDeadZoneMin"
+ CONSTANT: kIOHIDElementCalibrationDeadZoneMaxKey "CalibrationDeadZoneMax"
+ CONSTANT: kIOHIDElementCalibrationGranularityKey "CalibrationGranularity"
+
+ CONSTANT: kIOHIDElementTypeInput_Misc 1
+ CONSTANT: kIOHIDElementTypeInput_Button 2
+ CONSTANT: kIOHIDElementTypeInput_Axis 3
+ CONSTANT: kIOHIDElementTypeInput_ScanCodes 4
+ CONSTANT: kIOHIDElementTypeOutput 129
+ CONSTANT: kIOHIDElementTypeFeature 257
+ CONSTANT: kIOHIDElementTypeCollection 513
+
+ CONSTANT: kIOHIDElementCollectionTypePhysical HEX: 00
+ CONSTANT: kIOHIDElementCollectionTypeApplication HEX: 01
+ CONSTANT: kIOHIDElementCollectionTypeLogical HEX: 02
+ CONSTANT: kIOHIDElementCollectionTypeReport HEX: 03
+ CONSTANT: kIOHIDElementCollectionTypeNamedArray HEX: 04
+ CONSTANT: kIOHIDElementCollectionTypeUsageSwitch HEX: 05
+ CONSTANT: kIOHIDElementCollectionTypeUsageModifier HEX: 06
+
+ CONSTANT: kIOHIDReportTypeInput 0
+ CONSTANT: kIOHIDReportTypeOutput 1
+ CONSTANT: kIOHIDReportTypeFeature 2
+ CONSTANT: kIOHIDReportTypeCount 3
+
+ CONSTANT: kIOHIDOptionsTypeNone HEX: 00
+ CONSTANT: kIOHIDOptionsTypeSeizeDevice HEX: 01
+
+ CONSTANT: kIOHIDQueueOptionsTypeNone HEX: 00
+ CONSTANT: kIOHIDQueueOptionsTypeEnqueueAll HEX: 01
+
+ CONSTANT: kIOHIDElementFlagsConstantMask HEX: 0001
+ CONSTANT: kIOHIDElementFlagsVariableMask HEX: 0002
+ CONSTANT: kIOHIDElementFlagsRelativeMask HEX: 0004
+ CONSTANT: kIOHIDElementFlagsWrapMask HEX: 0008
+ CONSTANT: kIOHIDElementFlagsNonLinearMask HEX: 0010
+ CONSTANT: kIOHIDElementFlagsNoPreferredMask HEX: 0020
+ CONSTANT: kIOHIDElementFlagsNullStateMask HEX: 0040
+ CONSTANT: kIOHIDElementFlagsVolativeMask HEX: 0080
+ CONSTANT: kIOHIDElementFlagsBufferedByteMask HEX: 0100
+
+ CONSTANT: kIOHIDValueScaleTypeCalibrated 0
+ CONSTANT: kIOHIDValueScaleTypePhysical 1
+
+ CONSTANT: kIOHIDTransactionDirectionTypeInput 0
+ CONSTANT: kIOHIDTransactionDirectionTypeOutput 1
+
+ CONSTANT: kIOHIDTransactionOptionDefaultOutputValue 1
TYPEDEF: ptrdiff_t IOHIDElementCookie
TYPEDEF: int IOHIDElementType
USING: alien.syntax alien.c-types core-foundation
-core-foundation.bundles system combinators kernel sequences
-debugger io accessors ;
+core-foundation.bundles core-foundation.dictionaries system
+combinators kernel sequences debugger io accessors ;
IN: iokit
<<
when
>>
- : kIOKitBuildVersionKey "IOKitBuildVersion" ; inline
- : kIOKitDiagnosticsKey "IOKitDiagnostics" ; inline
+ CONSTANT: kIOKitBuildVersionKey "IOKitBuildVersion"
+ CONSTANT: kIOKitDiagnosticsKey "IOKitDiagnostics"
- : kIORegistryPlanesKey "IORegistryPlanes" ; inline
- : kIOCatalogueKey "IOCatalogue" ; inline
+ CONSTANT: kIORegistryPlanesKey "IORegistryPlanes"
+ CONSTANT: kIOCatalogueKey "IOCatalogue"
- : kIOServicePlane "IOService" ; inline
- : kIOPowerPlane "IOPower" ; inline
- : kIODeviceTreePlane "IODeviceTree" ; inline
- : kIOAudioPlane "IOAudio" ; inline
- : kIOFireWirePlane "IOFireWire" ; inline
- : kIOUSBPlane "IOUSB" ; inline
+ CONSTANT: kIOServicePlane "IOService"
+ CONSTANT: kIOPowerPlane "IOPower"
+ CONSTANT: kIODeviceTreePlane "IODeviceTree"
+ CONSTANT: kIOAudioPlane "IOAudio"
+ CONSTANT: kIOFireWirePlane "IOFireWire"
+ CONSTANT: kIOUSBPlane "IOUSB"
- : kIOServiceClass "IOService" ; inline
+ CONSTANT: kIOServiceClass "IOService"
- : kIOResourcesClass "IOResources" ; inline
+ CONSTANT: kIOResourcesClass "IOResources"
- : kIOClassKey "IOClass" ; inline
- : kIOProbeScoreKey "IOProbeScore" ; inline
- : kIOKitDebugKey "IOKitDebug" ; inline
+ CONSTANT: kIOClassKey "IOClass"
+ CONSTANT: kIOProbeScoreKey "IOProbeScore"
+ CONSTANT: kIOKitDebugKey "IOKitDebug"
- : kIOProviderClassKey "IOProviderClass" ; inline
- : kIONameMatchKey "IONameMatch" ; inline
- : kIOPropertyMatchKey "IOPropertyMatch" ; inline
- : kIOPathMatchKey "IOPathMatch" ; inline
- : kIOLocationMatchKey "IOLocationMatch" ; inline
- : kIOParentMatchKey "IOParentMatch" ; inline
- : kIOResourceMatchKey "IOResourceMatch" ; inline
- : kIOMatchedServiceCountKey "IOMatchedServiceCountMatch" ; inline
+ CONSTANT: kIOProviderClassKey "IOProviderClass"
+ CONSTANT: kIONameMatchKey "IONameMatch"
+ CONSTANT: kIOPropertyMatchKey "IOPropertyMatch"
+ CONSTANT: kIOPathMatchKey "IOPathMatch"
+ CONSTANT: kIOLocationMatchKey "IOLocationMatch"
+ CONSTANT: kIOParentMatchKey "IOParentMatch"
+ CONSTANT: kIOResourceMatchKey "IOResourceMatch"
+ CONSTANT: kIOMatchedServiceCountKey "IOMatchedServiceCountMatch"
- : kIONameMatchedKey "IONameMatched" ; inline
+ CONSTANT: kIONameMatchedKey "IONameMatched"
- : kIOMatchCategoryKey "IOMatchCategory" ; inline
- : kIODefaultMatchCategoryKey "IODefaultMatchCategory" ; inline
+ CONSTANT: kIOMatchCategoryKey "IOMatchCategory"
+ CONSTANT: kIODefaultMatchCategoryKey "IODefaultMatchCategory"
- : kIOUserClientClassKey "IOUserClientClass" ; inline
+ CONSTANT: kIOUserClientClassKey "IOUserClientClass"
- : kIOUserClientCrossEndianKey "IOUserClientCrossEndian" ; inline
- : kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible" ; inline
- : kIOUserClientSharedInstanceKey "IOUserClientSharedInstance" ; inline
+ CONSTANT: kIOUserClientCrossEndianKey "IOUserClientCrossEndian"
+ CONSTANT: kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible"
+ CONSTANT: kIOUserClientSharedInstanceKey "IOUserClientSharedInstance"
- : kIOPublishNotification "IOServicePublish" ; inline
- : kIOFirstPublishNotification "IOServiceFirstPublish" ; inline
- : kIOMatchedNotification "IOServiceMatched" ; inline
- : kIOFirstMatchNotification "IOServiceFirstMatch" ; inline
- : kIOTerminatedNotification "IOServiceTerminate" ; inline
+ CONSTANT: kIOPublishNotification "IOServicePublish"
+ CONSTANT: kIOFirstPublishNotification "IOServiceFirstPublish"
+ CONSTANT: kIOMatchedNotification "IOServiceMatched"
+ CONSTANT: kIOFirstMatchNotification "IOServiceFirstMatch"
+ CONSTANT: kIOTerminatedNotification "IOServiceTerminate"
- : kIOGeneralInterest "IOGeneralInterest" ; inline
- : kIOBusyInterest "IOBusyInterest" ; inline
- : kIOAppPowerStateInterest "IOAppPowerStateInterest" ; inline
- : kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest" ; inline
+ CONSTANT: kIOGeneralInterest "IOGeneralInterest"
+ CONSTANT: kIOBusyInterest "IOBusyInterest"
+ CONSTANT: kIOAppPowerStateInterest "IOAppPowerStateInterest"
+ CONSTANT: kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest"
- : kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage" ; inline
+ CONSTANT: kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage"
- : kIOCFPlugInTypesKey "IOCFPlugInTypes" ; inline
+ CONSTANT: kIOCFPlugInTypesKey "IOCFPlugInTypes"
- : kIOCommandPoolSizeKey "IOCommandPoolSize" ; inline
+ CONSTANT: kIOCommandPoolSizeKey "IOCommandPoolSize"
- : kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead" ; inline
- : kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite" ; inline
- : kIOMaximumByteCountReadKey "IOMaximumByteCountRead" ; inline
- : kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite" ; inline
- : kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead" ; inline
- : kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite" ; inline
- : kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead" ; inline
- : kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite" ; inline
- : kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount" ; inline
- : kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount" ; inline
+ CONSTANT: kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead"
+ CONSTANT: kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite"
+ CONSTANT: kIOMaximumByteCountReadKey "IOMaximumByteCountRead"
+ CONSTANT: kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite"
+ CONSTANT: kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead"
+ CONSTANT: kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite"
+ CONSTANT: kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead"
+ CONSTANT: kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite"
+ CONSTANT: kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount"
+ CONSTANT: kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount"
- : kIOIconKey "IOIcon" ; inline
- : kIOBundleResourceFileKey "IOBundleResourceFile" ; inline
+ CONSTANT: kIOIconKey "IOIcon"
+ CONSTANT: kIOBundleResourceFileKey "IOBundleResourceFile"
- : kIOBusBadgeKey "IOBusBadge" ; inline
- : kIODeviceIconKey "IODeviceIcon" ; inline
+ CONSTANT: kIOBusBadgeKey "IOBusBadge"
+ CONSTANT: kIODeviceIconKey "IODeviceIcon"
- : kIOPlatformSerialNumberKey "IOPlatformSerialNumber" ; inline
+ CONSTANT: kIOPlatformSerialNumberKey "IOPlatformSerialNumber"
- : kIOPlatformUUIDKey "IOPlatformUUID" ; inline
+ CONSTANT: kIOPlatformUUIDKey "IOPlatformUUID"
- : kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY" ; inline
- : kIODTNVRAMPanicInfoKey "aapl,panic-info" ; inline
+ CONSTANT: kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY"
+ CONSTANT: kIODTNVRAMPanicInfoKey "aapl,panic-info"
- : kIOBootDeviceKey "IOBootDevice" ; inline
- : kIOBootDevicePathKey "IOBootDevicePath" ; inline
- : kIOBootDeviceSizeKey "IOBootDeviceSize" ; inline
+ CONSTANT: kIOBootDeviceKey "IOBootDevice"
+ CONSTANT: kIOBootDevicePathKey "IOBootDevicePath"
+ 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: int kern_return_t
TYPEDEF: uint IOOptionBits
- : MACH_PORT_NULL 0 ; inline
- : KERN_SUCCESS 0 ; inline
+ CONSTANT: MACH_PORT_NULL 0
+ CONSTANT: KERN_SUCCESS 0
FUNCTION: IOReturn IOMasterPort ( mach_port_t bootstrap, mach_port_t* master ) ;
IN: opengl.demo-support
: FOV ( -- x ) 2.0 sqrt 1+ ; inline
- : MOUSE-MOTION-SCALE 0.5 ; inline
- : KEY-ROTATE-STEP 10.0 ; inline
+ CONSTANT: MOUSE-MOTION-SCALE 0.5
+ CONSTANT: KEY-ROTATE-STEP 10.0
SYMBOL: last-drag-loc
TUPLE: demo-gadget < gadget yaw pitch distance ;
: new-demo-gadget ( yaw pitch distance class -- gadget )
- new-gadget
+ new
swap >>distance
swap >>pitch
swap >>yaw ;