]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of factorcode.org:/git/factor into native-image-loader
authorJoe Groff <arcata@gmail.com>
Wed, 7 Jul 2010 21:38:34 +0000 (14:38 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 7 Jul 2010 21:38:34 +0000 (14:38 -0700)
basis/compiler/tests/optimizer.factor
basis/compiler/tree/propagation/known-words/known-words.factor
basis/io/ports/ports.factor
core/io/files/files-tests.factor

index 606d1a0edfbb6dba92ff1d20e77e2f0a3527012a..0d08c592a961235ea9ca1ddd712f1ef8b9ea003b 100644 (file)
@@ -5,7 +5,7 @@ quotations classes classes.algebra classes.tuple.private
 continuations growable namespaces hints alien.accessors
 compiler.tree.builder compiler.tree.optimizer sequences.deep
 compiler.test definitions generic.single shuffle math.order
-compiler.cfg.debugger ;
+compiler.cfg.debugger classes.struct alien.syntax alien.data ;
 IN: compiler.tests.optimizer
 
 GENERIC: xyz ( obj -- obj )
@@ -447,3 +447,14 @@ TUPLE: grid-mesh-tuple { length read-only } { step read-only } ;
 GENERIC: bad-push-test-case ( a -- b )
 M: object bad-push-test-case "foo" throw ; inline
 [ { 1 } "bar" ] [ { 1 } [ [ [ [ bad-push-test-case ] [ "bar" throw ] recover ] attempt-all f ] [ ] recover ] compile-call ] unit-test
+
+STRUCT: BitmapData { Scan0 void* } ;
+
+[ ALIEN: 123 ] [
+    [
+        { BitmapData }
+        [ BitmapData memory>struct ALIEN: 123 >>Scan0 drop ]
+        [ clone ]
+        with-out-parameters Scan0>>
+    ] compile-call
+] unit-test
index 6d2dec1c0d3d89d0c1e0a5dec03c136d44a46f26..09750d9d3f129389d88fa9042c6d72b9d0a21ed7 100644 (file)
@@ -288,14 +288,12 @@ generic-comparison-ops [
     literal>> dup tuple-class? [ drop tuple ] unless <class-info>
 ] "outputs" set-word-prop
 
-! the output of clone has the same type as the input
+! the output of (clone) has the same type as the input
 : cloned-value-info ( value-info -- value-info' )
     clone f >>literal f >>literal?
     [ [ dup [ cloned-value-info ] when ] map ] change-slots ;
 
-{ clone (clone) } [
-    [ cloned-value-info ] "outputs" set-word-prop
-] each
+\ (clone) [ cloned-value-info ] "outputs" set-word-prop
 
 \ slot [
     dup literal?>>
index 3864b37e48a09b9193cfe1222296611c5113590e..8517910b0f117127ff4208eb2e348ea9b5f56250 100644 (file)
@@ -4,7 +4,8 @@ USING: math kernel io sequences io.buffers io.timeouts generic
 byte-vectors system io.encodings math.order io.backend
 continuations classes byte-arrays namespaces splitting grouping
 dlists alien alien.c-types assocs io.encodings.binary summary
-accessors destructors combinators fry specialized-arrays ;
+accessors destructors combinators fry specialized-arrays
+locals ;
 SPECIALIZED-ARRAY: uchar
 IN: io.ports
 
@@ -148,12 +149,21 @@ M: output-port stream-tell ( stream -- n )
     [ check-disposed ]
     [ [ handle>> tell-handle ] [ buffer>> buffer-length ] bi + ] bi ;
 
+:: do-seek-relative ( n seek-type stream -- n seek-type stream )
+    ! seek-relative needs special handling here, because of the
+    ! buffer.
+    seek-type seek-relative eq?
+    [ n stream stream-tell + seek-absolute ] [ n seek-type ] if
+    stream ;
+
 M: input-port stream-seek ( n seek-type stream -- )
+    do-seek-relative
     [ check-disposed ]
     [ buffer>> 0 swap buffer-reset ]
     [ handle>> seek-handle ] tri ;
 
 M: output-port stream-seek ( n seek-type stream -- )
+    do-seek-relative
     [ check-disposed ]
     [ stream-flush ]
     [ handle>> seek-handle ] tri ;
index 4986fedd791cf9542cadef176dd00d2550d5db13..8b578750bc6e2f6bbdfa4fceba7800e845df4697 100644 (file)
@@ -245,6 +245,15 @@ CONSTANT: pt-array-1
     ] with-file-reader
 ] must-fail
 
+[ ] [
+    "resource:misc/icons/Factor_48x48.png" binary [
+        44 read drop
+        tell-input 44 assert=
+        -44 seek-relative seek-input
+        tell-input 0 assert=
+    ] with-file-reader
+] unit-test
+
 [
     "non-string-error" unique-file ascii [
         { } write