From 46a1089fd8584a55050b325967d8b8b82648ddb6 Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Fri, 12 Dec 2008 00:33:05 -0600 Subject: [PATCH 1/5] Split up core-foundation vocabulary since it was getting out of hand --- .../core-foundation/arrays/arrays-docs.factor | 11 + basis/core-foundation/arrays/arrays.factor | 22 ++ basis/core-foundation/arrays/tags.txt | 2 + .../bundles/bundles-docs.factor | 11 + basis/core-foundation/bundles/bundles.factor | 23 ++ basis/core-foundation/bundles/tags.txt | 2 + .../core-foundation-docs.factor | 57 ----- basis/core-foundation/core-foundation.factor | 209 +----------------- basis/core-foundation/data/data.factor | 58 +++++ basis/core-foundation/data/tags.txt | 2 + .../file-descriptors/file-descriptors.factor | 32 +++ .../core-foundation/file-descriptors/tags.txt | 2 + .../core-foundation/fsevents/fsevents.factor | 5 +- .../core-foundation/run-loop/run-loop.factor | 4 +- .../strings/strings-docs.factor | 14 ++ .../strings/strings-tests.factor | 9 + basis/core-foundation/strings/strings.factor | 66 ++++++ basis/core-foundation/strings/tags.txt | 2 + basis/core-foundation/urls/tags.txt | 2 + basis/core-foundation/urls/urls-docs.factor | 10 + basis/core-foundation/urls/urls.factor | 24 ++ .../multiplexers/run-loop/run-loop.factor | 5 +- 22 files changed, 306 insertions(+), 266 deletions(-) create mode 100644 basis/core-foundation/arrays/arrays-docs.factor create mode 100644 basis/core-foundation/arrays/arrays.factor create mode 100644 basis/core-foundation/arrays/tags.txt create mode 100644 basis/core-foundation/bundles/bundles-docs.factor create mode 100644 basis/core-foundation/bundles/bundles.factor create mode 100644 basis/core-foundation/bundles/tags.txt create mode 100644 basis/core-foundation/data/data.factor create mode 100644 basis/core-foundation/data/tags.txt create mode 100644 basis/core-foundation/file-descriptors/file-descriptors.factor create mode 100644 basis/core-foundation/file-descriptors/tags.txt create mode 100644 basis/core-foundation/strings/strings-docs.factor create mode 100644 basis/core-foundation/strings/strings-tests.factor create mode 100644 basis/core-foundation/strings/strings.factor create mode 100644 basis/core-foundation/strings/tags.txt create mode 100644 basis/core-foundation/urls/tags.txt create mode 100644 basis/core-foundation/urls/urls-docs.factor create mode 100644 basis/core-foundation/urls/urls.factor diff --git a/basis/core-foundation/arrays/arrays-docs.factor b/basis/core-foundation/arrays/arrays-docs.factor new file mode 100644 index 0000000000..36d14a8660 --- /dev/null +++ b/basis/core-foundation/arrays/arrays-docs.factor @@ -0,0 +1,11 @@ +USING: help.syntax help.markup arrays alien ; +IN: core-foundation.arrays + +HELP: CF>array +{ $values { "alien" "a " { $snippet "CFArray" } } { "array" "an array of " { $link alien } " instances" } } +{ $description "Creates a Factor array from a Core Foundation array." } ; + +HELP: <CFArray> +{ $values { "seq" "a sequence of " { $link alien } " instances" } { "alien" "a " { $snippet "CFArray" } } } +{ $description "Creates a Core Foundation array from a Factor array." } ; + diff --git a/basis/core-foundation/arrays/arrays.factor b/basis/core-foundation/arrays/arrays.factor new file mode 100644 index 0000000000..3708059f2b --- /dev/null +++ b/basis/core-foundation/arrays/arrays.factor @@ -0,0 +1,22 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax kernel sequences ; +IN: core-foundation.arrays + +TYPEDEF: void* CFArrayRef + +FUNCTION: CFArrayRef CFArrayCreateMutable ( CFAllocatorRef allocator, CFIndex capacity, void* callbacks ) ; + +FUNCTION: void* CFArrayGetValueAtIndex ( CFArrayRef array, CFIndex idx ) ; + +FUNCTION: void CFArraySetValueAtIndex ( CFArrayRef array, CFIndex index, void* value ) ; + +FUNCTION: CFIndex CFArrayGetCount ( CFArrayRef array ) ; + +: CF>array ( alien -- array ) + dup CFArrayGetCount [ CFArrayGetValueAtIndex ] with map ; + +: <CFArray> ( seq -- alien ) + [ f swap length f CFArrayCreateMutable ] keep + [ length ] keep + [ [ dupd ] dip CFArraySetValueAtIndex ] 2each ; diff --git a/basis/core-foundation/arrays/tags.txt b/basis/core-foundation/arrays/tags.txt new file mode 100644 index 0000000000..2320bdd648 --- /dev/null +++ b/basis/core-foundation/arrays/tags.txt @@ -0,0 +1,2 @@ +unportable +bindings diff --git a/basis/core-foundation/bundles/bundles-docs.factor b/basis/core-foundation/bundles/bundles-docs.factor new file mode 100644 index 0000000000..baa1b4d5df --- /dev/null +++ b/basis/core-foundation/bundles/bundles-docs.factor @@ -0,0 +1,11 @@ +USING: help.syntax help.markup ; +IN: core-foundation.bundles + +HELP: <CFBundle> +{ $values { "string" "a pathname string" } { "bundle" "a " { $snippet "CFBundle" } } } +{ $description "Creates a new " { $snippet "CFBundle" } "." } ; + +HELP: load-framework +{ $values { "name" "a pathname string" } } +{ $description "Loads a Core Foundation framework." } ; + diff --git a/basis/core-foundation/bundles/bundles.factor b/basis/core-foundation/bundles/bundles.factor new file mode 100644 index 0000000000..790f1766c3 --- /dev/null +++ b/basis/core-foundation/bundles/bundles.factor @@ -0,0 +1,23 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax kernel sequences core-foundation +core-foundation.urls ; +IN: core-foundation.bundles + +TYPEDEF: void* CFBundleRef + +FUNCTION: CFBundleRef CFBundleCreate ( CFAllocatorRef allocator, CFURLRef bundleURL ) ; + +FUNCTION: Boolean CFBundleLoadExecutable ( CFBundleRef bundle ) ; + +: <CFBundle> ( string -- bundle ) + t <CFFileSystemURL> [ + f swap CFBundleCreate + ] keep CFRelease ; + +: load-framework ( name -- ) + dup <CFBundle> [ + CFBundleLoadExecutable drop + ] [ + "Cannot load bundle named " prepend throw + ] ?if ; diff --git a/basis/core-foundation/bundles/tags.txt b/basis/core-foundation/bundles/tags.txt new file mode 100644 index 0000000000..2320bdd648 --- /dev/null +++ b/basis/core-foundation/bundles/tags.txt @@ -0,0 +1,2 @@ +unportable +bindings diff --git a/basis/core-foundation/core-foundation-docs.factor b/basis/core-foundation/core-foundation-docs.factor index d577c523cf..c1783cb92b 100644 --- a/basis/core-foundation/core-foundation-docs.factor +++ b/basis/core-foundation/core-foundation-docs.factor @@ -1,42 +1,6 @@ USING: alien strings arrays help.markup help.syntax destructors ; IN: core-foundation -HELP: CF>array -{ $values { "alien" "a " { $snippet "CFArray" } } { "array" "an array of " { $link alien } " instances" } } -{ $description "Creates a Factor array from a Core Foundation array." } ; - -HELP: <CFArray> -{ $values { "seq" "a sequence of " { $link alien } " instances" } { "alien" "a " { $snippet "CFArray" } } } -{ $description "Creates a Core Foundation array from a Factor array." } ; - -HELP: <CFString> -{ $values { "string" string } { "alien" "a " { $snippet "CFString" } } } -{ $description "Creates a Core Foundation string from a Factor string." } ; - -HELP: CF>string -{ $values { "alien" "a " { $snippet "CFString" } } { "string" string } } -{ $description "Creates a Factor string from a Core Foundation string." } ; - -HELP: CF>string-array -{ $values { "alien" "a " { $snippet "CFArray" } " of " { $snippet "CFString" } " instances" } { "seq" string } } -{ $description "Creates an array of Factor strings from a " { $snippet "CFArray" } " of " { $snippet "CFString" } "s." } ; - -HELP: <CFFileSystemURL> -{ $values { "string" "a pathname string" } { "dir?" "a boolean indicating if the pathname is a directory" } { "url" "a " { $snippet "CFURL" } } } -{ $description "Creates a new " { $snippet "CFURL" } " pointing to the given local pathname." } ; - -HELP: <CFURL> -{ $values { "string" "a URL string" } { "url" "a " { $snippet "CFURL" } } } -{ $description "Creates a new " { $snippet "CFURL" } "." } ; - -HELP: <CFBundle> -{ $values { "string" "a pathname string" } { "bundle" "a " { $snippet "CFBundle" } } } -{ $description "Creates a new " { $snippet "CFBundle" } "." } ; - -HELP: load-framework -{ $values { "name" "a pathname string" } } -{ $description "Loads a Core Foundation framework." } ; - HELP: &CFRelease { $values { "alien" "Pointer to a Core Foundation object" } } { $description "Marks the given Core Foundation object for unconditional release via " { $link CFRelease } " at the end of the enclosing " { $link with-destructors } " scope." } ; @@ -46,24 +10,3 @@ HELP: |CFRelease { $description "Marks the given Core Foundation object for release via " { $link CFRelease } " in the event of an error at the end of the enclosing " { $link with-destructors } " scope." } ; { CFRelease |CFRelease &CFRelease } related-words - -ARTICLE: "core-foundation" "Core foundation utilities" -"The " { $vocab-link "core-foundation" } " vocabulary defines bindings for some frequently-used Core Foundation functions. It also provides some utility words." -$nl -"Strings:" -{ $subsection <CFString> } -{ $subsection CF>string } -"Arrays:" -{ $subsection <CFArray> } -{ $subsection CF>array } -{ $subsection CF>string-array } -"URLs:" -{ $subsection <CFFileSystemURL> } -{ $subsection <CFURL> } -"Frameworks:" -{ $subsection load-framework } -"Memory management:" -{ $subsection &CFRelease } -{ $subsection |CFRelease } ; - -ABOUT: "core-foundation" diff --git a/basis/core-foundation/core-foundation.factor b/basis/core-foundation/core-foundation.factor index 40dd4710a1..0f64c0666f 100644 --- a/basis/core-foundation/core-foundation.factor +++ b/basis/core-foundation/core-foundation.factor @@ -1,23 +1,13 @@ ! Copyright (C) 2006, 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.c-types alien.strings alien.syntax kernel -math math.bitwise sequences io.encodings.utf8 destructors -accessors combinators byte-arrays ; +USING: alien.syntax destructors accessors kernel ; IN: core-foundation -TYPEDEF: void* CFAllocatorRef -TYPEDEF: void* CFArrayRef -TYPEDEF: void* CFDataRef -TYPEDEF: void* CFDictionaryRef -TYPEDEF: void* CFMutableDictionaryRef -TYPEDEF: void* CFNumberRef -TYPEDEF: void* CFBundleRef -TYPEDEF: void* CFSetRef -TYPEDEF: void* CFStringRef -TYPEDEF: void* CFURLRef -TYPEDEF: void* CFUUIDRef TYPEDEF: void* CFTypeRef -TYPEDEF: void* CFFileDescriptorRef + +TYPEDEF: void* CFAllocatorRef +: kCFAllocatorDefault f ; inline + TYPEDEF: bool Boolean TYPEDEF: long CFIndex TYPEDEF: int SInt32 @@ -26,198 +16,11 @@ TYPEDEF: ulong CFTypeID TYPEDEF: UInt32 CFOptionFlags TYPEDEF: double CFTimeInterval TYPEDEF: double CFAbsoluteTime -TYPEDEF: int CFFileDescriptorNativeDescriptor -TYPEDEF: void* CFFileDescriptorCallBack - -TYPEDEF: int CFNumberType -: kCFNumberSInt8Type 1 ; inline -: kCFNumberSInt16Type 2 ; inline -: kCFNumberSInt32Type 3 ; inline -: kCFNumberSInt64Type 4 ; inline -: kCFNumberFloat32Type 5 ; inline -: kCFNumberFloat64Type 6 ; inline -: kCFNumberCharType 7 ; inline -: kCFNumberShortType 8 ; inline -: kCFNumberIntType 9 ; inline -: kCFNumberLongType 10 ; inline -: kCFNumberLongLongType 11 ; inline -: kCFNumberFloatType 12 ; inline -: kCFNumberDoubleType 13 ; inline -: kCFNumberCFIndexType 14 ; inline -: kCFNumberNSIntegerType 15 ; inline -: kCFNumberCGFloatType 16 ; inline -: kCFNumberMaxType 16 ; inline - -TYPEDEF: int CFPropertyListMutabilityOptions -: kCFPropertyListImmutable 0 ; inline -: kCFPropertyListMutableContainers 1 ; inline -: kCFPropertyListMutableContainersAndLeaves 2 ; inline - -FUNCTION: CFArrayRef CFArrayCreateMutable ( CFAllocatorRef allocator, CFIndex capacity, void* callbacks ) ; - -FUNCTION: void* CFArrayGetValueAtIndex ( CFArrayRef array, CFIndex idx ) ; - -FUNCTION: void CFArraySetValueAtIndex ( CFArrayRef array, CFIndex index, void* value ) ; - -FUNCTION: CFIndex CFArrayGetCount ( CFArrayRef array ) ; - -: kCFURLPOSIXPathStyle 0 ; inline -: kCFAllocatorDefault f ; inline - -FUNCTION: CFURLRef CFURLCreateWithFileSystemPath ( CFAllocatorRef allocator, CFStringRef filePath, int pathStyle, Boolean isDirectory ) ; - -FUNCTION: CFURLRef CFURLCreateWithString ( CFAllocatorRef allocator, CFStringRef string, CFURLRef base ) ; - -FUNCTION: CFURLRef CFURLCopyFileSystemPath ( CFURLRef url, int pathStyle ) ; - -TYPEDEF: int CFStringEncoding -: kCFStringEncodingMacRoman HEX: 0 ; -: kCFStringEncodingWindowsLatin1 HEX: 0500 ; -: kCFStringEncodingISOLatin1 HEX: 0201 ; -: kCFStringEncodingNextStepLatin HEX: 0B01 ; -: kCFStringEncodingASCII HEX: 0600 ; -: kCFStringEncodingUnicode HEX: 0100 ; -: kCFStringEncodingUTF8 HEX: 08000100 ; -: kCFStringEncodingNonLossyASCII HEX: 0BFF ; -: kCFStringEncodingUTF16 HEX: 0100 ; -: kCFStringEncodingUTF16BE HEX: 10000100 ; -: kCFStringEncodingUTF16LE HEX: 14000100 ; -: kCFStringEncodingUTF32 HEX: 0c000100 ; -: kCFStringEncodingUTF32BE HEX: 18000100 ; -: kCFStringEncodingUTF32LE HEX: 1c000100 ; - -FUNCTION: CFStringRef CFStringCreateFromExternalRepresentation ( - CFAllocatorRef alloc, - CFDataRef data, - CFStringEncoding encoding -) ; - -FUNCTION: CFStringRef CFStringCreateWithBytes ( - CFAllocatorRef alloc, - UInt8* bytes, - CFIndex numBytes, - CFStringEncoding encoding, - Boolean isExternalRepresentation -) ; - -FUNCTION: CFIndex CFStringGetLength ( CFStringRef theString ) ; - -FUNCTION: void CFStringGetCharacters ( void* theString, CFIndex start, CFIndex length, void* buffer ) ; - -FUNCTION: Boolean CFStringGetCString ( - CFStringRef theString, - char* buffer, - CFIndex bufferSize, - CFStringEncoding encoding -) ; - -FUNCTION: CFStringRef CFStringCreateWithCString ( - CFAllocatorRef alloc, - char* cStr, - CFStringEncoding encoding -) ; - -FUNCTION: CFNumberRef CFNumberCreate ( CFAllocatorRef allocator, CFNumberType theType, void* valuePtr ) ; - -FUNCTION: CFDataRef CFDataCreate ( CFAllocatorRef allocator, uchar* bytes, CFIndex length ) ; - -FUNCTION: CFBundleRef CFBundleCreate ( CFAllocatorRef allocator, CFURLRef bundleURL ) ; - -FUNCTION: Boolean CFBundleLoadExecutable ( CFBundleRef bundle ) ; FUNCTION: CFTypeRef CFRetain ( CFTypeRef cf ) ; + FUNCTION: void CFRelease ( CFTypeRef cf ) ; -FUNCTION: CFTypeID CFGetTypeID ( CFTypeRef cf ) ; - -: CF>array ( alien -- array ) - dup CFArrayGetCount [ CFArrayGetValueAtIndex ] with map ; - -: <CFArray> ( seq -- alien ) - [ f swap length f CFArrayCreateMutable ] keep - [ length ] keep - [ [ dupd ] dip CFArraySetValueAtIndex ] 2each ; - -: <CFString> ( string -- alien ) - f swap utf8 string>alien kCFStringEncodingUTF8 CFStringCreateWithCString - [ "CFStringCreateWithCString failed" throw ] unless* ; - -: CF>string ( alien -- string ) - dup CFStringGetLength 4 * 1 + <byte-array> [ - dup length - kCFStringEncodingUTF8 - CFStringGetCString - [ "CFStringGetCString failed" throw ] unless - ] keep utf8 alien>string ; - -: CF>string-array ( alien -- seq ) - CF>array [ CF>string ] map ; - -: <CFStringArray> ( seq -- alien ) - [ <CFString> ] map [ <CFArray> ] [ [ CFRelease ] each ] bi ; - -: <CFFileSystemURL> ( string dir? -- url ) - [ <CFString> f over kCFURLPOSIXPathStyle ] dip - CFURLCreateWithFileSystemPath swap CFRelease ; - -: <CFURL> ( string -- url ) - <CFString> - [ f swap f CFURLCreateWithString ] keep - CFRelease ; - -: <CFBundle> ( string -- bundle ) - t <CFFileSystemURL> [ - f swap CFBundleCreate - ] keep CFRelease ; - -GENERIC: <CFNumber> ( number -- alien ) - -M: integer <CFNumber> - [ f kCFNumberLongLongType ] dip <longlong> CFNumberCreate ; - -M: float <CFNumber> - [ f kCFNumberDoubleType ] dip <double> CFNumberCreate ; - -M: t <CFNumber> - drop f kCFNumberIntType 1 <int> CFNumberCreate ; - -M: f <CFNumber> - drop f kCFNumberIntType 0 <int> CFNumberCreate ; - -: <CFData> ( byte-array -- alien ) - [ f ] dip dup length CFDataCreate ; - -FUNCTION: CFFileDescriptorRef CFFileDescriptorCreate ( - CFAllocatorRef allocator, - CFFileDescriptorNativeDescriptor fd, - Boolean closeOnInvalidate, - CFFileDescriptorCallBack callout, - CFFileDescriptorContext* context -) ; - -: kCFFileDescriptorReadCallBack 1 ; inline -: kCFFileDescriptorWriteCallBack 2 ; inline - -FUNCTION: void CFFileDescriptorEnableCallBacks ( - CFFileDescriptorRef f, - CFOptionFlags callBackTypes -) ; - -: enable-all-callbacks ( fd -- ) - { kCFFileDescriptorReadCallBack kCFFileDescriptorWriteCallBack } flags - CFFileDescriptorEnableCallBacks ; - -: <CFFileDescriptor> ( fd callback -- handle ) - [ f swap ] [ t swap ] bi* f CFFileDescriptorCreate - [ "CFFileDescriptorCreate failed" throw ] unless* ; - -: load-framework ( name -- ) - dup <CFBundle> [ - CFBundleLoadExecutable drop - ] [ - "Cannot load bundle named " prepend throw - ] ?if ; - TUPLE: CFRelease-destructor alien disposed ; M: CFRelease-destructor dispose* alien>> CFRelease ; diff --git a/basis/core-foundation/data/data.factor b/basis/core-foundation/data/data.factor new file mode 100644 index 0000000000..043fb905ad --- /dev/null +++ b/basis/core-foundation/data/data.factor @@ -0,0 +1,58 @@ +! Copyright (C) 2008 Joe Groff. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax alien.c-types sequences kernel math ; +IN: core-foundation.data + +TYPEDEF: void* CFDataRef +TYPEDEF: void* CFDictionaryRef +TYPEDEF: void* CFMutableDictionaryRef +TYPEDEF: void* CFNumberRef +TYPEDEF: void* CFSetRef +TYPEDEF: void* CFUUIDRef + +TYPEDEF: int CFNumberType +: kCFNumberSInt8Type 1 ; inline +: kCFNumberSInt16Type 2 ; inline +: kCFNumberSInt32Type 3 ; inline +: kCFNumberSInt64Type 4 ; inline +: kCFNumberFloat32Type 5 ; inline +: kCFNumberFloat64Type 6 ; inline +: kCFNumberCharType 7 ; inline +: kCFNumberShortType 8 ; inline +: kCFNumberIntType 9 ; inline +: kCFNumberLongType 10 ; inline +: kCFNumberLongLongType 11 ; inline +: kCFNumberFloatType 12 ; inline +: kCFNumberDoubleType 13 ; inline +: kCFNumberCFIndexType 14 ; inline +: kCFNumberNSIntegerType 15 ; inline +: kCFNumberCGFloatType 16 ; inline +: kCFNumberMaxType 16 ; inline + +TYPEDEF: int CFPropertyListMutabilityOptions +: kCFPropertyListImmutable 0 ; inline +: kCFPropertyListMutableContainers 1 ; inline +: kCFPropertyListMutableContainersAndLeaves 2 ; inline + +FUNCTION: CFNumberRef CFNumberCreate ( CFAllocatorRef allocator, CFNumberType theType, void* valuePtr ) ; + +FUNCTION: CFDataRef CFDataCreate ( CFAllocatorRef allocator, uchar* bytes, CFIndex length ) ; + +FUNCTION: CFTypeID CFGetTypeID ( CFTypeRef cf ) ; + +GENERIC: <CFNumber> ( number -- alien ) + +M: integer <CFNumber> + [ f kCFNumberLongLongType ] dip <longlong> CFNumberCreate ; + +M: float <CFNumber> + [ f kCFNumberDoubleType ] dip <double> CFNumberCreate ; + +M: t <CFNumber> + drop f kCFNumberIntType 1 <int> CFNumberCreate ; + +M: f <CFNumber> + drop f kCFNumberIntType 0 <int> CFNumberCreate ; + +: <CFData> ( byte-array -- alien ) + [ f ] dip dup length CFDataCreate ; diff --git a/basis/core-foundation/data/tags.txt b/basis/core-foundation/data/tags.txt new file mode 100644 index 0000000000..2320bdd648 --- /dev/null +++ b/basis/core-foundation/data/tags.txt @@ -0,0 +1,2 @@ +unportable +bindings diff --git a/basis/core-foundation/file-descriptors/file-descriptors.factor b/basis/core-foundation/file-descriptors/file-descriptors.factor new file mode 100644 index 0000000000..29c4219678 --- /dev/null +++ b/basis/core-foundation/file-descriptors/file-descriptors.factor @@ -0,0 +1,32 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax kernel math.bitwise core-foundation ; +IN: core-foundation.file-descriptors + +TYPEDEF: void* CFFileDescriptorRef +TYPEDEF: int CFFileDescriptorNativeDescriptor +TYPEDEF: void* CFFileDescriptorCallBack + +FUNCTION: CFFileDescriptorRef CFFileDescriptorCreate ( + CFAllocatorRef allocator, + CFFileDescriptorNativeDescriptor fd, + Boolean closeOnInvalidate, + CFFileDescriptorCallBack callout, + CFFileDescriptorContext* context +) ; + +: kCFFileDescriptorReadCallBack 1 ; inline +: kCFFileDescriptorWriteCallBack 2 ; inline + +FUNCTION: void CFFileDescriptorEnableCallBacks ( + CFFileDescriptorRef f, + CFOptionFlags callBackTypes +) ; + +: enable-all-callbacks ( fd -- ) + { kCFFileDescriptorReadCallBack kCFFileDescriptorWriteCallBack } flags + CFFileDescriptorEnableCallBacks ; + +: <CFFileDescriptor> ( fd callback -- handle ) + [ f swap ] [ t swap ] bi* f CFFileDescriptorCreate + [ "CFFileDescriptorCreate failed" throw ] unless* ; diff --git a/basis/core-foundation/file-descriptors/tags.txt b/basis/core-foundation/file-descriptors/tags.txt new file mode 100644 index 0000000000..2320bdd648 --- /dev/null +++ b/basis/core-foundation/file-descriptors/tags.txt @@ -0,0 +1,2 @@ +unportable +bindings diff --git a/basis/core-foundation/fsevents/fsevents.factor b/basis/core-foundation/fsevents/fsevents.factor index 67c2dcfa35..7ed040b455 100644 --- a/basis/core-foundation/fsevents/fsevents.factor +++ b/basis/core-foundation/fsevents/fsevents.factor @@ -2,11 +2,10 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.strings alien.syntax kernel math sequences namespaces make assocs init accessors -continuations combinators core-foundation -core-foundation.run-loop io.encodings.utf8 destructors locals +continuations combinators io.encodings.utf8 destructors locals arrays specialized-arrays.direct.alien specialized-arrays.direct.int specialized-arrays.direct.longlong -; +core-foundation core-foundation.run-loop core-foundation.strings ; IN: core-foundation.fsevents : kFSEventStreamCreateFlagUseCFTypes 2 ; inline diff --git a/basis/core-foundation/run-loop/run-loop.factor b/basis/core-foundation/run-loop/run-loop.factor index d254bf3adc..b7e565e70f 100644 --- a/basis/core-foundation/run-loop/run-loop.factor +++ b/basis/core-foundation/run-loop/run-loop.factor @@ -1,6 +1,8 @@ ! Copyright (C) 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.syntax core-foundation kernel namespaces ; +USING: alien alien.syntax kernel namespaces +core-foundation core-foundation.strings +core-foundation.file-descriptors ; IN: core-foundation.run-loop : kCFRunLoopRunFinished 1 ; inline diff --git a/basis/core-foundation/strings/strings-docs.factor b/basis/core-foundation/strings/strings-docs.factor new file mode 100644 index 0000000000..4c12fb5d52 --- /dev/null +++ b/basis/core-foundation/strings/strings-docs.factor @@ -0,0 +1,14 @@ +USING: help.syntax help.markup strings ; +IN: core-foundation.strings + +HELP: <CFString> +{ $values { "string" string } { "alien" "a " { $snippet "CFString" } } } +{ $description "Creates a Core Foundation string from a Factor string." } ; + +HELP: CF>string +{ $values { "alien" "a " { $snippet "CFString" } } { "string" string } } +{ $description "Creates a Factor string from a Core Foundation string." } ; + +HELP: CF>string-array +{ $values { "alien" "a " { $snippet "CFArray" } " of " { $snippet "CFString" } " instances" } { "seq" string } } +{ $description "Creates an array of Factor strings from a " { $snippet "CFArray" } " of " { $snippet "CFString" } "s." } ; diff --git a/basis/core-foundation/strings/strings-tests.factor b/basis/core-foundation/strings/strings-tests.factor new file mode 100644 index 0000000000..39d5ee6ac0 --- /dev/null +++ b/basis/core-foundation/strings/strings-tests.factor @@ -0,0 +1,9 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: core-foundation.strings core-foundation tools.test kernel ; +IN: core-foundation + +[ ] [ "Hello" <CFString> CFRelease ] unit-test +[ "Hello" ] [ "Hello" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test +[ "Hello\u003456" ] [ "Hello\u003456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test +[ "Hello\u013456" ] [ "Hello\u013456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test diff --git a/basis/core-foundation/strings/strings.factor b/basis/core-foundation/strings/strings.factor new file mode 100644 index 0000000000..2e6180c897 --- /dev/null +++ b/basis/core-foundation/strings/strings.factor @@ -0,0 +1,66 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax alien.strings kernel sequences byte-arrays +io.encodings.utf8 math core-foundation core-foundation.arrays ; +IN: core-foundation.strings + +TYPEDEF: void* CFStringRef + +TYPEDEF: int CFStringEncoding +: kCFStringEncodingMacRoman HEX: 0 ; +: kCFStringEncodingWindowsLatin1 HEX: 0500 ; +: kCFStringEncodingISOLatin1 HEX: 0201 ; +: kCFStringEncodingNextStepLatin HEX: 0B01 ; +: kCFStringEncodingASCII HEX: 0600 ; +: kCFStringEncodingUnicode HEX: 0100 ; +: kCFStringEncodingUTF8 HEX: 08000100 ; +: kCFStringEncodingNonLossyASCII HEX: 0BFF ; +: kCFStringEncodingUTF16 HEX: 0100 ; +: kCFStringEncodingUTF16BE HEX: 10000100 ; +: kCFStringEncodingUTF16LE HEX: 14000100 ; +: kCFStringEncodingUTF32 HEX: 0c000100 ; +: kCFStringEncodingUTF32BE HEX: 18000100 ; +: kCFStringEncodingUTF32LE HEX: 1c000100 ; + +FUNCTION: CFStringRef CFStringCreateWithBytes ( + CFAllocatorRef alloc, + UInt8* bytes, + CFIndex numBytes, + CFStringEncoding encoding, + Boolean isExternalRepresentation +) ; + +FUNCTION: CFIndex CFStringGetLength ( CFStringRef theString ) ; + +FUNCTION: void CFStringGetCharacters ( void* theString, CFIndex start, CFIndex length, void* buffer ) ; + +FUNCTION: Boolean CFStringGetCString ( + CFStringRef theString, + char* buffer, + CFIndex bufferSize, + CFStringEncoding encoding +) ; + +FUNCTION: CFStringRef CFStringCreateWithCString ( + CFAllocatorRef alloc, + char* cStr, + CFStringEncoding encoding +) ; + +: <CFString> ( string -- alien ) + f swap utf8 string>alien kCFStringEncodingUTF8 CFStringCreateWithCString + [ "CFStringCreateWithCString failed" throw ] unless* ; + +: CF>string ( alien -- string ) + dup CFStringGetLength 4 * 1 + <byte-array> [ + dup length + kCFStringEncodingUTF8 + CFStringGetCString + [ "CFStringGetCString failed" throw ] unless + ] keep utf8 alien>string ; + +: CF>string-array ( alien -- seq ) + CF>array [ CF>string ] map ; + +: <CFStringArray> ( seq -- alien ) + [ <CFString> ] map [ <CFArray> ] [ [ CFRelease ] each ] bi ; diff --git a/basis/core-foundation/strings/tags.txt b/basis/core-foundation/strings/tags.txt new file mode 100644 index 0000000000..2320bdd648 --- /dev/null +++ b/basis/core-foundation/strings/tags.txt @@ -0,0 +1,2 @@ +unportable +bindings diff --git a/basis/core-foundation/urls/tags.txt b/basis/core-foundation/urls/tags.txt new file mode 100644 index 0000000000..2320bdd648 --- /dev/null +++ b/basis/core-foundation/urls/tags.txt @@ -0,0 +1,2 @@ +unportable +bindings diff --git a/basis/core-foundation/urls/urls-docs.factor b/basis/core-foundation/urls/urls-docs.factor new file mode 100644 index 0000000000..d017e70fa6 --- /dev/null +++ b/basis/core-foundation/urls/urls-docs.factor @@ -0,0 +1,10 @@ +USING: help.syntax help.markup ; +IN: core-foundation.urls + +HELP: <CFFileSystemURL> +{ $values { "string" "a pathname string" } { "dir?" "a boolean indicating if the pathname is a directory" } { "url" "a " { $snippet "CFURL" } } } +{ $description "Creates a new " { $snippet "CFURL" } " pointing to the given local pathname." } ; + +HELP: <CFURL> +{ $values { "string" "a URL string" } { "url" "a " { $snippet "CFURL" } } } +{ $description "Creates a new " { $snippet "CFURL" } "." } ; diff --git a/basis/core-foundation/urls/urls.factor b/basis/core-foundation/urls/urls.factor new file mode 100644 index 0000000000..9f9d3a67cb --- /dev/null +++ b/basis/core-foundation/urls/urls.factor @@ -0,0 +1,24 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax kernel core-foundation.strings +core-foundation ; +IN: core-foundation.urls + +: kCFURLPOSIXPathStyle 0 ; inline + +TYPEDEF: void* CFURLRef + +FUNCTION: CFURLRef CFURLCreateWithFileSystemPath ( CFAllocatorRef allocator, CFStringRef filePath, int pathStyle, Boolean isDirectory ) ; + +FUNCTION: CFURLRef CFURLCreateWithString ( CFAllocatorRef allocator, CFStringRef string, CFURLRef base ) ; + +FUNCTION: CFURLRef CFURLCopyFileSystemPath ( CFURLRef url, int pathStyle ) ; + +: <CFFileSystemURL> ( string dir? -- url ) + [ <CFString> f over kCFURLPOSIXPathStyle ] dip + CFURLCreateWithFileSystemPath swap CFRelease ; + +: <CFURL> ( string -- url ) + <CFString> + [ f swap f CFURLCreateWithString ] keep + CFRelease ; diff --git a/basis/io/unix/multiplexers/run-loop/run-loop.factor b/basis/io/unix/multiplexers/run-loop/run-loop.factor index baaf910f37..593fe93ac4 100644 --- a/basis/io/unix/multiplexers/run-loop/run-loop.factor +++ b/basis/io/unix/multiplexers/run-loop/run-loop.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel namespaces math accessors threads alien locals -destructors combinators core-foundation core-foundation.run-loop -io.unix.multiplexers io.unix.multiplexers.kqueue ; +destructors combinators io.unix.multiplexers +io.unix.multiplexers.kqueue core-foundation +core-foundation.run-loop core-foundation.file-descriptors ; IN: io.unix.multiplexers.run-loop TUPLE: run-loop-mx kqueue-mx fd source ; From 38046364ac55438bf7a192e51c3c6b8da747dfba Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Fri, 12 Dec 2008 01:00:32 -0600 Subject: [PATCH 2/5] Fix memory test on OpenBSD --- core/memory/memory-tests.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/memory/memory-tests.factor b/core/memory/memory-tests.factor index 6794825897..11a6a9d8a9 100644 --- a/core/memory/memory-tests.factor +++ b/core/memory/memory-tests.factor @@ -6,9 +6,10 @@ IN: memory.tests ! LOL [ ] [ vm + "-i=" image append "-generations=2" "-e=USING: memory io prettyprint system ; input-stream gc . 0 exit" - 3array try-process + 4array try-process ] unit-test [ [ ] instances ] must-infer From 36c36a7f83f546009e3a19f12b1694ba320b97b1 Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Fri, 12 Dec 2008 01:11:37 -0600 Subject: [PATCH 3/5] Update code for core-foundation split, add core-foundation.timers --- .../cocoa/application/application-docs.factor | 2 +- basis/cocoa/application/application.factor | 7 ++--- basis/cocoa/cocoa.factor | 4 +-- basis/cocoa/dialogs/dialogs.factor | 3 ++- basis/cocoa/nibs/nibs.factor | 7 +++-- basis/cocoa/pasteboard/pasteboard.factor | 4 +-- basis/cocoa/plists/plists.factor | 2 +- .../core-foundation/run-loop/run-loop.factor | 18 ++++++++++--- basis/core-foundation/timers/timers.factor | 27 +++++++++++++++++++ basis/ui/cocoa/tools/tools.factor | 8 +++--- basis/ui/cocoa/views/views.factor | 2 +- 11 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 basis/core-foundation/timers/timers.factor diff --git a/basis/cocoa/application/application-docs.factor b/basis/cocoa/application/application-docs.factor index 791613e876..e12b6eb276 100644 --- a/basis/cocoa/application/application-docs.factor +++ b/basis/cocoa/application/application-docs.factor @@ -1,5 +1,5 @@ USING: debugger quotations help.markup help.syntax strings alien -core-foundation ; +core-foundation core-foundation.strings core-foundation.arrays ; IN: cocoa.application HELP: <NSString> diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor index e2c853ea77..a52aaedce2 100644 --- a/basis/cocoa/application/application.factor +++ b/basis/cocoa/application/application.factor @@ -1,9 +1,10 @@ ! Copyright (C) 2006, 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.syntax io kernel namespaces core-foundation -core-foundation.run-loop cocoa.messages cocoa cocoa.classes -cocoa.runtime sequences threads init summary kernel.private -assocs ; +core-foundation.run-loop core-foundation.arrays +core-foundation.data core-foundation.strings cocoa.messages +cocoa cocoa.classes cocoa.runtime sequences threads init summary +kernel.private assocs ; IN: cocoa.application : <NSString> ( str -- alien ) <CFString> -> autorelease ; diff --git a/basis/cocoa/cocoa.factor b/basis/cocoa/cocoa.factor index ab86796236..44252a3b19 100644 --- a/basis/cocoa/cocoa.factor +++ b/basis/cocoa/cocoa.factor @@ -2,8 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: compiler io kernel cocoa.runtime cocoa.subclassing cocoa.messages cocoa.types sequences words vocabs parser -core-foundation namespaces assocs hashtables compiler.units -lexer init ; +core-foundation.bundles namespaces assocs hashtables +compiler.units lexer init ; IN: cocoa : (remember-send) ( selector variable -- ) diff --git a/basis/cocoa/dialogs/dialogs.factor b/basis/cocoa/dialogs/dialogs.factor index 2b01c5d751..13f6f0b7d6 100644 --- a/basis/cocoa/dialogs/dialogs.factor +++ b/basis/cocoa/dialogs/dialogs.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2006, 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: kernel cocoa cocoa.messages cocoa.classes -cocoa.application sequences splitting core-foundation ; +cocoa.application sequences splitting core-foundation +core-foundation.strings ; IN: cocoa.dialogs : <NSOpenPanel> ( -- panel ) diff --git a/basis/cocoa/nibs/nibs.factor b/basis/cocoa/nibs/nibs.factor index 31dac2531b..a39cc794d0 100644 --- a/basis/cocoa/nibs/nibs.factor +++ b/basis/cocoa/nibs/nibs.factor @@ -1,5 +1,8 @@ -USING: cocoa.application cocoa.messages cocoa.classes cocoa.runtime -kernel cocoa core-foundation alien.c-types ; +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: cocoa.application cocoa.messages cocoa.classes +cocoa.runtime kernel cocoa alien.c-types core-foundation +core-foundation.arrays ; IN: cocoa.nibs : load-nib ( name -- ) diff --git a/basis/cocoa/pasteboard/pasteboard.factor b/basis/cocoa/pasteboard/pasteboard.factor index b530ccbc37..888f5452e2 100644 --- a/basis/cocoa/pasteboard/pasteboard.factor +++ b/basis/cocoa/pasteboard/pasteboard.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien.accessors arrays kernel cocoa.messages -cocoa.classes cocoa.application cocoa core-foundation sequences -; +cocoa.classes cocoa.application sequences cocoa core-foundation +core-foundation.strings core-foundation.arrays ; IN: cocoa.pasteboard : NSStringPboardType "NSStringPboardType" ; diff --git a/basis/cocoa/plists/plists.factor b/basis/cocoa/plists/plists.factor index bb73b8fac3..cf68f9864a 100644 --- a/basis/cocoa/plists/plists.factor +++ b/basis/cocoa/plists/plists.factor @@ -3,7 +3,7 @@ USING: strings arrays hashtables assocs sequences cocoa.messages cocoa.classes cocoa.application cocoa kernel namespaces io.backend math cocoa.enumeration byte-arrays -combinators alien.c-types core-foundation ; +combinators alien.c-types core-foundation core-foundation.data ; IN: cocoa.plists GENERIC: >plist ( value -- plist ) diff --git a/basis/core-foundation/run-loop/run-loop.factor b/basis/core-foundation/run-loop/run-loop.factor index b7e565e70f..475991a246 100644 --- a/basis/core-foundation/run-loop/run-loop.factor +++ b/basis/core-foundation/run-loop/run-loop.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.syntax kernel namespaces -core-foundation core-foundation.strings -core-foundation.file-descriptors ; +USING: alien alien.syntax kernel namespaces core-foundation +core-foundation.strings core-foundation.file-descriptors +core-foundation.timers ; IN: core-foundation.run-loop : kCFRunLoopRunFinished 1 ; inline @@ -40,6 +40,18 @@ FUNCTION: void CFRunLoopRemoveSource ( CFStringRef mode ) ; +FUNCTION: void CFRunLoopAddTimer ( + CFRunLoopRef rl, + CFRunLoopTimerRef timer, + CFStringRef mode +) ; + +FUNCTION: void CFRunLoopRemoveTimer ( + CFRunLoopRef rl, + CFRunLoopTimerRef timer, + CFStringRef mode +) ; + : CFRunLoopDefaultMode ( -- alien ) #! Ugly, but we don't have static NSStrings \ CFRunLoopDefaultMode get-global dup expired? [ diff --git a/basis/core-foundation/timers/timers.factor b/basis/core-foundation/timers/timers.factor new file mode 100644 index 0000000000..eddeb87d1d --- /dev/null +++ b/basis/core-foundation/timers/timers.factor @@ -0,0 +1,27 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax ; +IN: core-foundation.timers + +TYPEDEF: void* CFRunLoopTimerRef +TYPEDEF: void* CFRunLoopTimerCallBack +TYPEDEF: void* CFRunLoopTimerContext + +FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate ( + CFAllocatorRef allocator, + CFAbsoluteTime fireDate, + CFTimeInterval interval, + CFOptionFlags flags, + CFIndex order, + CFRunLoopTimerCallBack callout, + CFRunLoopTimerContext* context +) ; + +FUNCTION: void CFRunLoopTimerInvalidate ( + CFRunLoopTimerRef timer +); + +FUNCTION: void CFRunLoopTimerSetNextFireDate ( + CFRunLoopTimerRef timer, + CFAbsoluteTime fireDate +) ; diff --git a/basis/ui/cocoa/tools/tools.factor b/basis/ui/cocoa/tools/tools.factor index ccaae0c1ab..a0755e9ec8 100644 --- a/basis/ui/cocoa/tools/tools.factor +++ b/basis/ui/cocoa/tools/tools.factor @@ -1,10 +1,10 @@ -! Copyright (C) 2006, 2007 Slava Pestov. +! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien.syntax cocoa cocoa.nibs cocoa.application cocoa.classes cocoa.dialogs cocoa.pasteboard cocoa.subclassing -core-foundation help.topics kernel memory namespaces parser -system ui ui.tools.browser ui.tools.listener ui.tools.workspace -ui.cocoa eval locals ; +core-foundation core-foundation.strings help.topics kernel +memory namespaces parser system ui ui.tools.browser +ui.tools.listener ui.tools.workspace ui.cocoa eval locals ; IN: ui.cocoa.tools : finder-run-files ( alien -- ) diff --git a/basis/ui/cocoa/views/views.factor b/basis/ui/cocoa/views/views.factor index 7bb9679132..3201779cc5 100644 --- a/basis/ui/cocoa/views/views.factor +++ b/basis/ui/cocoa/views/views.factor @@ -4,7 +4,7 @@ USING: accessors alien alien.c-types arrays assocs cocoa kernel math cocoa.messages cocoa.subclassing cocoa.classes cocoa.views cocoa.application cocoa.pasteboard cocoa.types cocoa.windows sequences ui ui.gadgets ui.gadgets.worlds ui.gestures -core-foundation threads combinators math.geometry.rect ; +core-foundation.strings threads combinators math.geometry.rect ; IN: ui.cocoa.views : send-mouse-moved ( view event -- ) From 0ba2c964af790e9713e7836a7c4eac2c6c7100ae Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Fri, 12 Dec 2008 02:18:50 -0600 Subject: [PATCH 4/5] Remove obsolete file, add unit tests for core-foundation.run-loop, add <CFTimer> word --- basis/core-foundation/core-foundation-tests.factor | 9 --------- basis/core-foundation/timers/timers.factor | 7 +++++-- .../io/unix/multiplexers/run-loop/run-loop-tests.factor | 5 +++++ 3 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 basis/core-foundation/core-foundation-tests.factor create mode 100644 basis/io/unix/multiplexers/run-loop/run-loop-tests.factor diff --git a/basis/core-foundation/core-foundation-tests.factor b/basis/core-foundation/core-foundation-tests.factor deleted file mode 100644 index c1d6788d50..0000000000 --- a/basis/core-foundation/core-foundation-tests.factor +++ /dev/null @@ -1,9 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: core-foundation tools.test kernel ; -IN: core-foundation - -[ ] [ "Hello" <CFString> CFRelease ] unit-test -[ "Hello" ] [ "Hello" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test -[ "Hello\u003456" ] [ "Hello\u003456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test -[ "Hello\u013456" ] [ "Hello\u013456" <CFString> [ CF>string ] [ CFRelease ] bi ] unit-test diff --git a/basis/core-foundation/timers/timers.factor b/basis/core-foundation/timers/timers.factor index eddeb87d1d..1d17d99a4d 100644 --- a/basis/core-foundation/timers/timers.factor +++ b/basis/core-foundation/timers/timers.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax ; +USING: alien.syntax system math kernel ; IN: core-foundation.timers TYPEDEF: void* CFRunLoopTimerRef @@ -17,9 +17,12 @@ FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate ( CFRunLoopTimerContext* context ) ; +: <CFTimer> ( callback -- timer ) + [ f millis 1000 /f 60 0 0 ] dip f CFRunLoopTimerCreate ; + FUNCTION: void CFRunLoopTimerInvalidate ( CFRunLoopTimerRef timer -); +) ; FUNCTION: void CFRunLoopTimerSetNextFireDate ( CFRunLoopTimerRef timer, diff --git a/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor b/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor new file mode 100644 index 0000000000..5f249c6881 --- /dev/null +++ b/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor @@ -0,0 +1,5 @@ +USING: io.unix.multiplexers.run-loop tools.test +destructors ; +IN: io.unix.multiplexers.run-loop.tests + +[ ] [ <run-loop-mx> dispose ] unit-test From 210c661d4da7a37621800c7d09ba0b78f8a19cbf Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Fri, 12 Dec 2008 02:41:10 -0600 Subject: [PATCH 5/5] Add unportable tag to core-foundation.timers --- basis/core-foundation/timers/tags.txt | 2 ++ basis/core-foundation/timers/timers.factor | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 basis/core-foundation/timers/tags.txt diff --git a/basis/core-foundation/timers/tags.txt b/basis/core-foundation/timers/tags.txt new file mode 100644 index 0000000000..2320bdd648 --- /dev/null +++ b/basis/core-foundation/timers/tags.txt @@ -0,0 +1,2 @@ +unportable +bindings diff --git a/basis/core-foundation/timers/timers.factor b/basis/core-foundation/timers/timers.factor index 1d17d99a4d..049e80b20f 100644 --- a/basis/core-foundation/timers/timers.factor +++ b/basis/core-foundation/timers/timers.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax system math kernel ; +USING: alien.syntax system math kernel core-foundation ; IN: core-foundation.timers TYPEDEF: void* CFRunLoopTimerRef