<code>contrib/math/</code>.</li>
<li>The <code>mod</code> word is now supported for ratios and floating point numbers.</li>
<li>The <code>truncate</code>, <code>floor</code> and <code>ceiling</code> words are now supported for floating point numbers.</li>
+<li>The NaN, positive infinity and negative infinity floating point numbers now parse and unparse as <code>0.0/0.0</code>, <code>1.0/0.0</code>, and <code>-1.0/0.0</code> respectively.</li>
+<li>The NaN value is now equal to itself under <code>=</code>.</li>
+<li>Negative and postive zero are no longer equal under <code>=</code>. However, the new <code>zero?</code> word tests if the top of the stack is a zero, and it tests for both positive and negative zero.</li>
</ul>
</li>
USING: html http io kernel namespaces styles test xml ;
[
- "/responder/foo/?z=%20"
+ "/responder/foo?z=%20"
] [
"/responder/foo" H{ { "z" " " } } build-url
] unit-test
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
+! Copyright (C) 2004, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
IN: alien
USING: assembler compiler compiler-backend compiler-frontend
errors generic hashtables inference inspector io kernel
c-type [ "boxer" get "reg-class" get ] bind %box ,
] if ;
+: linearize-cleanup ( node -- )
+ node-param cdr library-abi "stdcall" =
+ [ dup parameters stack-space %cleanup , ] unless ;
+
M: alien-node linearize* ( node -- )
dup parameters linearize-parameters
- dup node-param dup uncons %alien-invoke ,
- cdr library-abi "stdcall" =
- [ dup parameters stack-space %cleanup , ] unless
- dup linearize-return linearize-next ;
+ dup node-param uncons %alien-invoke ,
+ dup linearize-cleanup
+ dup linearize-return
+ linearize-next ;
: parse-arglist ( lst -- types stack effect )
unpair [
M: float-regs load-insn
[ fastcall-regs nth swap stack@ ] keep MOVSS/LPD ;
-M: stack-params load-insn 3drop ;
+M: stack-params load-insn
+ drop >r R11 swap stack@ MOV r> stack@ R11 MOV ;
M: %unbox generate-node ( vop -- )
drop
-! Copyright (C) 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
USING: alien arrays errors hashtables io kernel
-kernel-internals lists math namespaces opengl prettyprint
+kernel-internals math namespaces opengl prettyprint
sequences styles ;
IN: freetype
init-freetype [ close-freetype ] cleanup ; inline
: ttf-name ( font style -- name )
- cons H{
- { [[ "monospace" plain ]] "VeraMono" }
- { [[ "monospace" bold ]] "VeraMoBd" }
- { [[ "monospace" bold-italic ]] "VeraMoBI" }
- { [[ "monospace" italic ]] "VeraMoIt" }
- { [[ "sans-serif" plain ]] "Vera" }
- { [[ "sans-serif" bold ]] "VeraBd" }
- { [[ "sans-serif" bold-italic ]] "VeraBI" }
- { [[ "sans-serif" italic ]] "VeraIt" }
- { [[ "serif" plain ]] "VeraSe" }
- { [[ "serif" bold ]] "VeraSeBd" }
- { [[ "serif" bold-italic ]] "VeraBI" }
- { [[ "serif" italic ]] "VeraIt" }
+ 2array H{
+ { { "monospace" plain } "VeraMono" }
+ { { "monospace" bold } "VeraMoBd" }
+ { { "monospace" bold-italic } "VeraMoBI" }
+ { { "monospace" italic } "VeraMoIt" }
+ { { "sans-serif" plain } "Vera" }
+ { { "sans-serif" bold } "VeraBd" }
+ { { "sans-serif" bold-italic } "VeraBI" }
+ { { "sans-serif" italic } "VeraIt" }
+ { { "serif" plain } "VeraSe" }
+ { { "serif" bold } "VeraSeBd" }
+ { { "serif" bold-italic } "VeraBI" }
+ { { "serif" italic } "VeraIt" }
} hash ;
: ttf-path ( name -- string )
font-ascent swap glyph-hori-bearing-y - ft-floor 0 3array ;
: glyph-texture-size ( glyph -- dim )
- dup glyph-bitmap-width next-power-of-2
- swap glyph-bitmap-rows next-power-of-2 0 3array ;
+ dup glyph-bitmap-width
+ swap glyph-bitmap-rows 0 3array ;
: <char-sprite> ( font char -- sprite )
#! Create a new display list of a rendered glyph. This
: ^theta ( w abs arg -- theta )
>r >r >rect r> flog * swap r> * + ; inline
-: 0^0 "0^0 is not defined" throw ;
-
: 0^ ( z w -- )
dup zero? [
2drop 0.0/0.0
-! Copyright (C) 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
IN: opengl
USING: alien errors kernel math namespaces opengl sdl sequences ;
swap [ glMatrixMode glPushMatrix call ] keep
glMatrixMode glPopMatrix ; inline
-: gl-vertex first3 glVertex3d ; inline
+: top-left drop 0 0 glTexCoord2d 0 0 0 glVertex3d ; inline
-: top-left drop 0 0 glTexCoord2d { 0 0 0 } gl-vertex ; inline
+: top-right 1 0 glTexCoord2d first 0 0 glVertex3d ; inline
-: top-right 1 0 glTexCoord2d { 1 0 0 } v* gl-vertex ; inline
+: bottom-left 0 1 glTexCoord2d second 0 swap 0 glVertex3d ; inline
-: bottom-left 0 1 glTexCoord2d { 0 1 0 } v* gl-vertex ; inline
+: gl-vertex first3 glVertex3d ; inline
: bottom-right 1 1 glTexCoord2d gl-vertex ; inline
FUNCTION: double ffi_test_8 double x float y double z float t int w ; compiled
[ 19.0 ] [ 3.0 2.0 1.0 6.0 7 ffi_test_8 ] unit-test
+FUNCTION: int ffi_test_9 int a int b int c int d int e int f int g ; compiled
+[ 28 ] [ 1 2 3 4 5 6 7 ffi_test_9 ] unit-test
+
+FUNCTION: int ffi_test_10 int a int b double c int d float e int f int g int h ; compiled
+[ -34 ] [ 1 2 3 4 5 6 7 8 ffi_test_10 ] unit-test
+
[ 134217728 dup + dup + dup + dup + dup + dup + unparse ]
unit-test
-[ 0 0 ^ ] unit-test-fails
+[ 0.0/0.0 ] [ 0 0 ^ ] unit-test
[ 1 ] [ 10 0 ^ ] unit-test
[ 1/8 ] [ 1/2 3 ^ ] unit-test
[ 1/8 ] [ 2 -3 ^ ] unit-test
"compiler/generic" "compiler/bail-out"
"compiler/linearizer" "compiler/intrinsics"
"compiler/identities" "compiler/optimizer"
+ "compiler/alien"
} run-tests ;
printf("ffi_test_8(%f,%f,%f,%f,%d)\n",x,y,z,t,w);
return x * y + z * t + w;
}
+
+int ffi_test_9(int a, int b, int c, int d, int e, int f, int g)
+{
+ printf("ffi_test_9(%d,%d,%d,%d,%d,%d,%d)\n",a,b,c,d,e,f,g);
+ return a + b + c + d + e + f + g;
+}
+
+int ffi_test_10(int a, int b, double c, int d, float e, int f, int g, int h)
+{
+ printf("ffi_test_10(%d,%d,%f,%d,%f,%d,%d,%d)\n",a,b,c,d,e,f,g,h);
+ return a - b - c - d - e - f - g - h;
+}