]> gitweb.factorcode.org Git - factor.git/commitdiff
opengl: fix stack effect error in (all-enabled) combinator and add a unit test
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 9 Nov 2009 06:54:31 +0000 (00:54 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 9 Nov 2009 06:54:39 +0000 (00:54 -0600)
basis/opengl/opengl-tests.factor [new file with mode: 0644]
basis/opengl/opengl.factor

diff --git a/basis/opengl/opengl-tests.factor b/basis/opengl/opengl-tests.factor
new file mode 100644 (file)
index 0000000..818d0db
--- /dev/null
@@ -0,0 +1,6 @@
+USING: tools.test math opengl opengl.gl ;
+IN: opengl.tests
+
+{ 2 1 } [ { GL_TEXTURE_2D } [ + ] all-enabled ] must-infer-as
+
+{ 2 1 } [ { GL_TEXTURE_2D } [ + ] all-enabled-client-state ] must-infer-as
index 513ed912e46e6dc13bbe21a06866412295996a64..1f6205e64fda4575661a31fa8b12096593611d24 100755 (executable)
@@ -56,7 +56,9 @@ TUPLE: gl-error function code string ;
     [ ?execute ] map ;
 
 : (all-enabled) ( seq quot -- )
-    over [ glEnable ] each dip [ glDisable ] each ; inline
+    [ dup [ glEnable ] each ] dip
+    dip
+    [ glDisable ] each ; inline
 
 : (all-enabled-client-state) ( seq quot -- )
     [ dup [ glEnableClientState ] each ] dip