]> gitweb.factorcode.org Git - factor.git/commitdiff
tweak specialized-arrays to box values returned by nth
authorJoe Groff <arcata@gmail.com>
Mon, 9 Feb 2009 21:38:07 +0000 (15:38 -0600)
committerJoe Groff <arcata@gmail.com>
Mon, 9 Feb 2009 21:38:07 +0000 (15:38 -0600)
basis/alien/c-types/c-types.factor
basis/alien/structs/fields/fields.factor
basis/specialized-arrays/direct/functor/functor.factor
basis/specialized-arrays/functor/functor.factor

index 89b3572daf56258fb88b3e2b9fcfa4120df48313..a4bc3d3f521c5c3df1b167bd28d6b9f31d80561c 100644 (file)
@@ -185,6 +185,9 @@ M: f byte-length drop 0 ;
         [ "Cannot read struct fields with this type" throw ]
     ] unless* ;
 
+: c-type-getter-boxer ( name -- quot )
+    [ c-getter ] [ c-type-boxer-quot ] bi append ;
+
 : c-setter ( name -- quot )
     c-type-setter [
         [ "Cannot write struct fields with this type" throw ]
index f5537fa23994d2320f98af4f5859d00845191231..047768344279796f1c98ca005f9f4b78f6a11b6a 100644 (file)
@@ -58,10 +58,7 @@ PREDICATE: slot-writer < word "writing" word-prop >boolean ;
 : define-getter ( type spec -- )
     [ set-reader-props ] keep
     [ reader>> ]
-    [
-        type>>
-        [ c-getter ] [ c-type-boxer-quot ] bi append
-    ]
+    [ type>> c-type-getter-boxer ]
     [ ] tri
     (( c-ptr -- value )) define-struct-slot-word ;
 
index 0c3999db44fe69cdc9cf7693b3a6144a10c094e3..e7e891feded042d1fb371aa9a0ac9f936281d1d1 100755 (executable)
@@ -14,7 +14,7 @@ A'      IS ${T}-array
 A       DEFINES-CLASS direct-${T}-array
 <A>     DEFINES <${A}>
 
-NTH     [ T dup c-getter array-accessor ]
+NTH     [ T dup c-type-getter-boxer array-accessor ]
 SET-NTH [ T dup c-setter array-accessor ]
 
 WHERE
index 3c2c53db31a63c100d0c2baed13e5edb6ad84362..09433a3b51c7181ba62475a501acb441c2e50223 100644 (file)
@@ -22,7 +22,7 @@ A            DEFINES-CLASS ${T}-array
 byte-array>A DEFINES byte-array>${A}
 A{           DEFINES ${A}{
 
-NTH          [ T dup c-getter array-accessor ]
+NTH          [ T dup c-type-getter-boxer array-accessor ]
 SET-NTH      [ T dup c-setter array-accessor ]
 
 WHERE