CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/07/31 15:30:30
Modified files: . : ChangeLog server/vm : ASHandlers.cpp testsuite/actionscript.all: Makefile.am Added files: testsuite/actionscript.all: ops.as Log message: * server/vm/ASHandlers.cpp (ActionBitwiseAnd): take nan operands as zero. * testsuite/actionscript.all/: Makefile.am, ops.as: new testcase for primitive operations (to complete) CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3881&r2=1.3882 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.113&r2=1.114 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Makefile.am?cvsroot=gnash&r1=1.75&r2=1.76 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/ops.as?cvsroot=gnash&rev=1.1 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3881 retrieving revision 1.3882 diff -u -b -r1.3881 -r1.3882 --- ChangeLog 31 Jul 2007 04:25:59 -0000 1.3881 +++ ChangeLog 31 Jul 2007 15:30:29 -0000 1.3882 @@ -1,5 +1,12 @@ 2007-07-31 Sandro Santilli <[EMAIL PROTECTED]> + * server/vm/ASHandlers.cpp (ActionBitwiseAnd): + take nan operands as zero. + * testsuite/actionscript.all/: Makefile.am, ops.as: + new testcase for primitive operations (to complete) + +2007-07-31 Sandro Santilli <[EMAIL PROTECTED]> + * server/vm/ASHandlers.cpp (ActionBitwiseXor, ActionBitwiseOr): take nan operands as zero. * testsuite/actionscript.all/array.as: expect less failures. Index: server/vm/ASHandlers.cpp =================================================================== RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -u -b -r1.113 -r1.114 --- server/vm/ASHandlers.cpp 31 Jul 2007 04:25:59 -0000 1.113 +++ server/vm/ASHandlers.cpp 31 Jul 2007 15:30:29 -0000 1.114 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: ASHandlers.cpp,v 1.113 2007/07/31 04:25:59 strk Exp $ */ +/* $Id: ASHandlers.cpp,v 1.114 2007/07/31 15:30:29 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -3075,7 +3075,10 @@ double operand1 = env.top(1).to_number(&env); double operand2 = env.top(0).to_number(&env); - env.top(1) = int(operand1)&int(operand2); + if ( isnan(operand1) ) operand1 = 0; + if ( isnan(operand2) ) operand2 = 0; + + env.top(1) = int(operand1) & int(operand2); env.drop(1); } Index: testsuite/actionscript.all/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Makefile.am,v retrieving revision 1.75 retrieving revision 1.76 diff -u -b -r1.75 -r1.76 --- testsuite/actionscript.all/Makefile.am 24 Jul 2007 14:19:32 -0000 1.75 +++ testsuite/actionscript.all/Makefile.am 31 Jul 2007 15:30:29 -0000 1.76 @@ -16,7 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# $Id: Makefile.am,v 1.75 2007/07/24 14:19:32 strk Exp $ +# $Id: Makefile.am,v 1.76 2007/07/31 15:30:29 strk Exp $ AUTOMAKE_OPTIONS = dejagnu @@ -110,6 +110,7 @@ LocalConnection.as \ enumerate.as \ case.as \ + ops.as \ $(NULL) ASTESTS_OUT = $(ASTESTS:.as=.swf) Index: testsuite/actionscript.all/ops.as =================================================================== RCS file: testsuite/actionscript.all/ops.as diff -N testsuite/actionscript.all/ops.as --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/actionscript.all/ops.as 31 Jul 2007 15:30:29 -0000 1.1 @@ -0,0 +1,154 @@ +// +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// This program is free software; you can redistribute it and/or modchecky +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; check not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fcheckth Floor, Boston, MA 02110-1301 USA +// + +/* + * Test binary predicates (equal, less_then, greater_then, logical and bitwise ops) + */ + +rcsid="$Id: ops.as,v 1.1 2007/07/31 15:30:29 strk Exp $"; + +#include "check.as" + +//-------------------------------------------- +// Equality operator (ACTION_NEWEQUALS : 0x49) +//-------------------------------------------- + +check(1 == 1); // doh +check(1 == "1"); +check("1" == 1); +check(0 == -0); +check(0 == "-0"); +check("0" == -0); +check(null == null); +check(undefined == undefined); +check(null==undefined); +check(undefined==null); + +// for Arrays +ary1 = [1,2,3]; +ary2 = [1,2,3]; +check( ! (ary1 == ary2) ); // two different objects +check( ! (ary1 == "1,2,3") ); // the array doesn't get converted to a string +xcheck( ! ("1,2,3" == ary1) ); // the array doesn't get converted to a string + +// for String +str1 = new String("hello"); +str2 = new String("hello"); +str3 = new String("3"); +check( ! (str1 == str3) ); +check_equals(str1, "hello"); // str1 is automatically converted to a string +check_equals("hello", str1); // str1 is automatically converted to a string + +check_equals( str3, 3.0 ); // str3 (object) is automatically converted to a number +check_equals( str3.toString(), 3.0 ); // str3 (primitive string) is automatically converted to a number + +check( ! (str1 == 0) ); // str1 (object) is NOT converted to a number (due to NaN?) +xcheck( ! (str1 == NaN) ); // str1 (object) is NOT converted to a number (due to NaN?) + +#if OUTPUT_VERSION > 5 + check( ! (str1 == str2) ); // they are not the same object +#else // OUTPUT_VERSION <= 5 + xcheck( str1 == str2 ); // SWF5 automatically converts to a string for comparison ! +#endif // OUTPUT_VERSION <= 5 + + +//--------------------------------------------- +// Less then operator (ACTION_LESSTHAN : 0x0F) +//--------------------------------------------- + +// TODO ... + +//------------------------------------------------ +// Logical AND operator (ACTION_LOGICALAND : 0x10) +//------------------------------------------------ + +// TODO ... + +//------------------------------------------------ +// Logical OR operator (ACTION_LOGICALOR : 0x11) +//------------------------------------------------ + +// TODO ... + +//------------------------------------------------ +// Logical OR operator (ACTION_LOGICALOR : 0x11) +//------------------------------------------------ + +// TODO ... + +//------------------------------------------------ +// Bitwise AND operator (ACTION_BITWISEAND : 0x60) +//------------------------------------------------ + +check_equals( (undefined&1), 0 ); +check_equals( (1&undefined), 0 ); +check_equals( (1&null), 0 ); +check_equals( (null&1), 0 ); +check_equals( (null&null), 0 ); +check_equals( (3&2), 2 ); +// TODO ... + +//------------------------------------------------ +// Bitwise OR operator (ACTION_BITWISEOR : 0x61) +//------------------------------------------------ + +check_equals( (undefined|1), 1 ); +check_equals( (1|undefined), 1 ); +check_equals( (undefined|undefined), 0 ); +check_equals( (null|1), 1 ); +check_equals( (1|null), 1 ); +check_equals( (null|null), 0 ); +check_equals( (8|4), 12 ); +// TODO ... + +//------------------------------------------------ +// Bitwise XOR operator (ACTION_BITWISEOR : 0x62) +//------------------------------------------------ + +check_equals( (undefined^1), 1 ); +check_equals( (1^undefined), 1 ); +check_equals( (undefined^undefined), 0 ); +check_equals( (null^1), 1 ); +check_equals( (1^null), 1 ); +check_equals( (null^null), 0 ); +check_equals( (8^12), 4 ); +// TODO ... + +//------------------------------------------------ +// Shift left operator (ACTION_SHIFTLEFT : 0x63) +//------------------------------------------------ + +// TODO ... + +//------------------------------------------------ +// Shift right operator (ACTION_SHIFTRIGHT : 0x64) +//------------------------------------------------ + +// TODO ... + +//------------------------------------------------- +// Shift right2 operator (ACTION_SHIFTRIGHT2 : 0x65) +//------------------------------------------------- + +// TODO ... + +//------------------------------------------------- +// Strict equality operator (ACTION_STRICTEQ : 0x66) +//------------------------------------------------- + +// TODO ... _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit