From c2d3b5ae1f64805c6d90c23156adf06b68379a9c Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Mon, 9 Mar 2009 15:25:25 -0500
Subject: [PATCH 1/7] Add unportable tag to core-text.fonts

---
 basis/core-text/fonts/tags.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 basis/core-text/fonts/tags.txt

diff --git a/basis/core-text/fonts/tags.txt b/basis/core-text/fonts/tags.txt
new file mode 100644
index 0000000000..2320bdd648
--- /dev/null
+++ b/basis/core-text/fonts/tags.txt
@@ -0,0 +1,2 @@
+unportable
+bindings

From 234b7ac8b8d04b0b949dc5e6cd329d0f6963225f Mon Sep 17 00:00:00 2001
From: Daniel Ehrenberg <littledan@Macintosh-122.local>
Date: Mon, 9 Mar 2009 15:38:05 -0500
Subject: [PATCH 2/7] Fixing validators so it loads

---
 basis/validators/validators-docs.factor | 2 +-
 basis/validators/validators.factor      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/basis/validators/validators-docs.factor b/basis/validators/validators-docs.factor
index 8f5a587569..45444889de 100644
--- a/basis/validators/validators-docs.factor
+++ b/basis/validators/validators-docs.factor
@@ -1,5 +1,5 @@
 USING: help.markup help.syntax io.streams.string quotations 
-strings math regexp regexp.backend ;
+strings math regexp ;
 IN: validators
 
 HELP: v-checkbox
diff --git a/basis/validators/validators.factor b/basis/validators/validators.factor
index f0ee13dd38..740cf7db13 100644
--- a/basis/validators/validators.factor
+++ b/basis/validators/validators.factor
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006, 2008 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel continuations sequences math namespaces make sets
-math.parser math.ranges assocs regexp unicode.categories arrays
+math.parser math.ranges assocs regexp regexp.matchers unicode.categories arrays
 hashtables words classes quotations xmode.catalog unicode.case ;
 IN: validators
 

From 07cb959df41fe52d7dd78d16ff3bde419fccc51b Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Mon, 9 Mar 2009 17:47:50 -0500
Subject: [PATCH 3/7] Clean up ?at

---
 core/assocs/assocs.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/assocs/assocs.factor b/core/assocs/assocs.factor
index 0c0667e730..ec56cffff7 100755
--- a/core/assocs/assocs.factor
+++ b/core/assocs/assocs.factor
@@ -20,7 +20,7 @@ GENERIC: >alist ( assoc -- newassoc )
 M: assoc assoc-like drop ;
 
 : ?at ( key assoc -- value/key ? )
-    dupd at* [ [ nip ] [ drop ] if ] keep ; inline
+    2dup at* [ 2nip t ] [ 2drop f ] if ; inline
 
 <PRIVATE
 

From 3494bb11adbd432ccf5669a3e673f60d60621d09 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Mon, 9 Mar 2009 17:48:04 -0500
Subject: [PATCH 4/7] DEFER: now resets word definition, so take out a bogus
 DEFER: in irc.client

---
 extra/irc/client/client.factor | 2 --
 1 file changed, 2 deletions(-)

diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor
index 2770471093..c82f2e292c 100755
--- a/extra/irc/client/client.factor
+++ b/extra/irc/client/client.factor
@@ -152,8 +152,6 @@ M: irc-chat to-chat in-messages>> mailbox-put ;
         [ (>>nick) ] [ (>>parameter) ] [ +mode+ >>action ] tri ] dip to-chat ]
     3bi ; ! FIXME
 
-DEFER: me?
-
 ! ======================================
 ! IRC client messages
 ! ======================================

From a3c23c53ca70a792aae8dd508f1fe5ffb9b37665 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Mon, 9 Mar 2009 18:35:12 -0500
Subject: [PATCH 5/7] Half-fix pane selection

---
 basis/ui/gadgets/panes/panes.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/basis/ui/gadgets/panes/panes.factor b/basis/ui/gadgets/panes/panes.factor
index d322cb995b..c52c361b86 100644
--- a/basis/ui/gadgets/panes/panes.factor
+++ b/basis/ui/gadgets/panes/panes.factor
@@ -104,7 +104,7 @@ M: pane draw-gadget*
     dup gadget-selection? [
         [ selection-color>> gl-color ]
         [
-            [ [ origin get ] dip loc>> v- ] keep selected-children
+            [ loc>> vneg ] keep selected-children
             [ draw-selection ] with each
         ] bi
     ] [ drop ] if ;

From 58582ab4d97b1ab50680c4ec7648a62ab82d498d Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Mon, 9 Mar 2009 20:22:56 -0500
Subject: [PATCH 6/7] Fix memory management for CFArrays

---
 basis/cocoa/plists/plists-tests.factor     | 30 ++++++++++++++++++++++
 basis/core-foundation/arrays/arrays.factor |  9 +++----
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/basis/cocoa/plists/plists-tests.factor b/basis/cocoa/plists/plists-tests.factor
index beb766561f..4f74cd850a 100644
--- a/basis/cocoa/plists/plists-tests.factor
+++ b/basis/cocoa/plists/plists-tests.factor
@@ -7,4 +7,34 @@ assocs cocoa.enumeration ;
     [ V{ } ] [ H{ } >cf &CFRelease [ ] NSFastEnumeration-map ] unit-test
     [ V{ "A" } ] [ { "A" } >cf &CFRelease plist> ] unit-test
     [ H{ { "A" "B" } } ] [ "B" "A" associate >cf &CFRelease plist> ] unit-test
+    [ H{ { "A" "B" } } ] [ "B" "A" associate >cf &CFRelease plist> ] unit-test
+
+    [ t ] [
+        {
+            H{ { "DeviceUsagePage" 1 } { "DeviceUsage" 4 } }
+            H{ { "DeviceUsagePage" 1 } { "DeviceUsage" 5 } }
+            H{ { "DeviceUsagePage" 1 } { "DeviceUsage" 6 } }
+        } [ >cf &CFRelease ] [ >cf &CFRelease ] bi
+        [ plist> ] bi@ =
+    ] unit-test
+
+    [ t ] [
+        { "DeviceUsagePage" 1 }
+        [ >cf &CFRelease ] [ >cf &CFRelease ] bi
+        [ plist> ] bi@ =
+    ] unit-test
+
+    [ V{ "DeviceUsagePage" "Yes" } ] [
+        { "DeviceUsagePage" "Yes" }
+        >cf &CFRelease plist>
+    ] unit-test
+
+    [ V{ 2.0 1.0 } ] [
+        { 2.0 1.0 }
+        >cf &CFRelease plist>
+    ] unit-test
+
+    [ 3.5 ] [
+        3.5 >cf &CFRelease plist>
+    ] unit-test
 ] with-destructors
\ No newline at end of file
diff --git a/basis/core-foundation/arrays/arrays.factor b/basis/core-foundation/arrays/arrays.factor
index 3708059f2b..1205352fcb 100644
--- a/basis/core-foundation/arrays/arrays.factor
+++ b/basis/core-foundation/arrays/arrays.factor
@@ -1,6 +1,6 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax kernel sequences ;
+USING: alien.syntax kernel sequences fry ;
 IN: core-foundation.arrays
 
 TYPEDEF: void* CFArrayRef
@@ -17,6 +17,5 @@ FUNCTION: CFIndex CFArrayGetCount ( CFArrayRef array ) ;
     dup CFArrayGetCount [ CFArrayGetValueAtIndex ] with map ;
 
 : <CFArray> ( seq -- alien )
-    [ f swap length f CFArrayCreateMutable ] keep
-    [ length ] keep
-    [ [ dupd ] dip CFArraySetValueAtIndex ] 2each ;
+    f over length &: kCFTypeArrayCallBacks CFArrayCreateMutable
+    [ '[ [ _ ] 2dip swap CFArraySetValueAtIndex ] each-index ] keep ;

From 073333f245e2a5026ec97fdcb43eadab3f2717d0 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Mon, 9 Mar 2009 20:23:34 -0500
Subject: [PATCH 7/7] Re-implement <polygon-gadget> since joystick-demo still
 uses it

---
 basis/ui/pens/polygon/polygon.factor | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/basis/ui/pens/polygon/polygon.factor b/basis/ui/pens/polygon/polygon.factor
index 4d7793dd65..d244cc71d2 100644
--- a/basis/ui/pens/polygon/polygon.factor
+++ b/basis/ui/pens/polygon/polygon.factor
@@ -1,7 +1,8 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors colors help.markup help.syntax kernel opengl
-opengl.gl sequences specialized-arrays.float ui.pens ;
+opengl.gl sequences specialized-arrays.float math.vectors
+ui.gadgets ui.pens ;
 IN: ui.pens.polygon
 
 ! Polygon pen
@@ -30,4 +31,8 @@ M: polygon draw-interior
     [ color>> gl-color ]
     [ interior-vertices>> gl-vertex-pointer ]
     [ [ GL_POLYGON 0 ] dip interior-count>> glDrawArrays ]
-    tri ;
\ No newline at end of file
+    tri ;
+
+: <polygon-gadget> ( color points -- gadget )
+    [ <polygon> ] [ { 0 0 } [ vmax ] reduce ] bi
+    [ <gadget> ] 2dip [ >>interior ] [ >>dim ] bi* ;
\ No newline at end of file