From c0362a57db5a53f8ce25ee42ec461f094850896d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 16 Jan 2009 19:02:50 -0600 Subject: [PATCH] Working on core-foundation.attributed-strings --- .../attributed-strings-tests.factor | 7 +++++++ .../attributed-strings.factor | 19 +++++++++++++++++++ .../attributed-strings/authors.txt | 1 + 3 files changed, 27 insertions(+) create mode 100644 basis/core-foundation/attributed-strings/attributed-strings-tests.factor create mode 100644 basis/core-foundation/attributed-strings/attributed-strings.factor create mode 100644 basis/core-foundation/attributed-strings/authors.txt diff --git a/basis/core-foundation/attributed-strings/attributed-strings-tests.factor b/basis/core-foundation/attributed-strings/attributed-strings-tests.factor new file mode 100644 index 0000000000..b1b6c5e2c5 --- /dev/null +++ b/basis/core-foundation/attributed-strings/attributed-strings-tests.factor @@ -0,0 +1,7 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: tools.test core-foundation.attributed-strings +core-foundation ; +IN: core-foundation.attributed-strings.tests + +[ ] [ "Hello world" { } CFRelease ] unit-test \ No newline at end of file diff --git a/basis/core-foundation/attributed-strings/attributed-strings.factor b/basis/core-foundation/attributed-strings/attributed-strings.factor new file mode 100644 index 0000000000..16acfdd74e --- /dev/null +++ b/basis/core-foundation/attributed-strings/attributed-strings.factor @@ -0,0 +1,19 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax kernel core-foundation +core-foundation.strings core-foundation.dictionaries ; +IN: core-foundation.attributed-strings + +TYPEDEF: void* CFAttributedStringRef + +FUNCTION: CFAttributedStringRef CFAttributedStringCreate ( + CFAllocatorRef alloc, + CFStringRef str, + CFDictionaryRef attributes +) ; + +: ( string alist -- alien ) + [ ] [ ] bi* + [ [ kCFAllocatorDefault ] 2dip CFAttributedStringCreate ] + [ [ CFRelease ] bi@ ] + 2bi ; \ No newline at end of file diff --git a/basis/core-foundation/attributed-strings/authors.txt b/basis/core-foundation/attributed-strings/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/core-foundation/attributed-strings/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file