]> gitweb.factorcode.org Git - factor.git/commitdiff
Working on core-foundation.attributed-strings
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 17 Jan 2009 01:02:50 +0000 (19:02 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 17 Jan 2009 01:02:50 +0000 (19:02 -0600)
basis/core-foundation/attributed-strings/attributed-strings-tests.factor [new file with mode: 0644]
basis/core-foundation/attributed-strings/attributed-strings.factor [new file with mode: 0644]
basis/core-foundation/attributed-strings/authors.txt [new file with mode: 0644]

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 (file)
index 0000000..b1b6c5e
--- /dev/null
@@ -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" { } <CFAttributedString> 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 (file)
index 0000000..16acfdd
--- /dev/null
@@ -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
+) ;
+
+: <CFAttributedString> ( string alist -- alien )
+    [ <CFString> ] [ <CFDictionary> ] 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 (file)
index 0000000..d4f5d6b
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
\ No newline at end of file