[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_value.h server/vm/ASH...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_value.h server/vm/ASH... |
Date: |
Thu, 22 Mar 2007 00:30:46 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/03/22 00:30:46
Modified files:
. : ChangeLog
server : as_value.h
server/vm : ASHandlers.cpp
testsuite/actionscript.all: Number.as
testsuite/swfdec: PASSING
Log message:
* testsuite/swfdec/PASSING: comparisons-7.swf now passes.
* testsuite/actionscript.all/Number.as: add tests for
comparison operators (unfortunately Ming never outputs
ActionGreater, but swfdec testsuite contains it).
* server/vm/ASHandlers.cpp (ActionNewLessThen, ActionGreater):
return undefined if numeric conversion returns NaN.
* server/as_value.h: drop 'operator<', is not appropriate as
it insists in returning a bool, while we might eventually
get an undefined value.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2667&r2=1.2668
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Number.as?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/swfdec/PASSING?cvsroot=gnash&r1=1.10&r2=1.11
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2667
retrieving revision 1.2668
diff -u -b -r1.2667 -r1.2668
--- ChangeLog 21 Mar 2007 18:48:24 -0000 1.2667
+++ ChangeLog 22 Mar 2007 00:30:45 -0000 1.2668
@@ -1,3 +1,15 @@
+2007-03-22 Sandro Santilli <address@hidden>
+
+ * testsuite/swfdec/PASSING: comparisons-7.swf now passes.
+ * testsuite/actionscript.all/Number.as: add tests for
+ comparison operators (unfortunately Ming never outputs
+ ActionGreater, but swfdec testsuite contains it).
+ * server/vm/ASHandlers.cpp (ActionNewLessThen, ActionGreater):
+ return undefined if numeric conversion returns NaN.
+ * server/as_value.h: drop 'operator<', is not appropriate as
+ it insists in returning a bool, while we might eventually
+ get an undefined value.
+
2007-03-21 Sandro Santilli <address@hidden>
* testsuite/actionscript.all/check.as: define
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- server/as_value.h 20 Mar 2007 15:01:20 -0000 1.36
+++ server/as_value.h 22 Mar 2007 00:30:45 -0000 1.37
@@ -14,7 +14,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: as_value.h,v 1.36 2007/03/20 15:01:20 strk Exp $ */
+/* $Id: as_value.h,v 1.37 2007/03/22 00:30:45 strk Exp $ */
#ifndef GNASH_AS_VALUE_H
#define GNASH_AS_VALUE_H
@@ -542,7 +542,7 @@
bool operator==(const as_value& v) const;
bool operator!=(const as_value& v) const;
- bool operator<(const as_value& v) const { return to_number() <
v.to_number(); }
+ //bool operator<(const as_value& v) const { return to_number() <
v.to_number(); }
/// @deprecated, use v.set_double(v.to_number(env) + v.to_number(env))
instead !
void operator+=(const as_value& v) { set_double(to_number() +
v.to_number()); }
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- server/vm/ASHandlers.cpp 21 Mar 2007 17:59:17 -0000 1.72
+++ server/vm/ASHandlers.cpp 22 Mar 2007 00:30:45 -0000 1.73
@@ -14,7 +14,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: ASHandlers.cpp,v 1.72 2007/03/21 17:59:17 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.73 2007/03/22 00:30:45 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -767,7 +767,7 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(2);
- env.top(1).set_bool(env.top(1) < env.top(0));
+ env.top(1).set_bool(env.top(1).to_number() < env.top(0).to_number());
env.drop(1);
}
@@ -2409,15 +2409,32 @@
void
SWFHandlers::ActionNewLessThan(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+ //GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
- if ( env.top(1).is_string() ) {
- env.top(1).set_bool(env.top(1).to_tu_string() <
env.top(0).to_tu_string());
- } else {
- env.top(1).set_bool(env.top(1) < env.top(0));
+ as_value& operand1 = env.top(1);
+ as_value& operand2 = env.top(0);
+
+ if ( operand1.is_string() && operand2.is_string() )
+ {
+ env.top(1).set_bool(operand1.to_std_string() <
operand2.to_std_string());
+ }
+ else
+ {
+ double op1 = operand1.to_number();
+ double op2 = operand2.to_number();
+
+ if ( isnan(op1) || isnan(op2) )
+ {
+ env.top(1).set_undefined();
+ }
+ else
+ {
+ env.top(1).set_bool(op1<op2);
+ }
}
env.drop(1);
}
@@ -2958,13 +2975,32 @@
void
SWFHandlers::ActionGreater(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+ //GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
+
thread.ensureStack(2);
- if (env.top(1).is_string()) {
- env.top(1).set_bool(env.top(1).to_tu_string() >
env.top(0).to_tu_string());
- } else {
- env.top(1).set_bool(env.top(1).to_number() > env.top(0).to_number());
+
+ as_value& operand1 = env.top(1);
+ as_value& operand2 = env.top(0);
+
+ if ( operand1.is_string() && operand2.is_string() )
+ {
+ env.top(1).set_bool(operand1.to_std_string() >
operand2.to_std_string());
+ }
+ else
+ {
+ double op1 = operand1.to_number();
+ double op2 = operand2.to_number();
+
+ if ( isnan(op1) || isnan(op2) )
+ {
+ env.top(1).set_undefined();
+ }
+ else
+ {
+ env.top(1).set_bool(op1 > op2);
+ }
}
env.drop(1);
}
Index: testsuite/actionscript.all/Number.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Number.as,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- testsuite/actionscript.all/Number.as 16 Mar 2007 10:52:26 -0000
1.14
+++ testsuite/actionscript.all/Number.as 22 Mar 2007 00:30:45 -0000
1.15
@@ -26,7 +26,7 @@
// TODO: test with SWF target != 6 (the only one tested so far)
//
-rcsid="$Id: Number.as,v 1.14 2007/03/16 10:52:26 strk Exp $";
+rcsid="$Id: Number.as,v 1.15 2007/03/22 00:30:45 strk Exp $";
#include "check.as"
@@ -190,17 +190,49 @@
check(!isFinite(Infinity));
check(!isFinite(2/undefined));
+check_equals(typeof(("string"<7)), 'undefined');
+check_equals(typeof((7<"string")), 'undefined');
+check_equals(typeof(("18"<7)), 'boolean');
+check_equals(typeof((7<"18")), 'boolean');
+check_equals(("18"<"7"), true); // string comparison
+check_equals(("18"<7), false); // numeric comparison
+check_equals((7<"18"), true); // numeric comparison
+check_equals(typeof(_root<"18"), 'undefined'); // _root is ensured to be NAN
for SWF6 too
+
+#if OUTPUT_VERSION > 6
+check_equals(typeof(undefined<7), 'undefined');
+check_equals(typeof(undefined>7), 'undefined');
+check_equals(typeof(undefined<-7), 'undefined');
+check_equals(typeof(undefined>-7), 'undefined');
+check_equals(typeof(7<undefined), 'undefined');
+check_equals(typeof(7>undefined), 'undefined');
+check_equals(typeof(-7<undefined), 'undefined');
+check_equals(typeof(-7>undefined), 'undefined');
+check_equals(typeof(null<7), 'undefined');
+check_equals(typeof(null>7), 'undefined');
+check_equals(typeof(null<-7), 'undefined');
+check_equals(typeof(null>-7), 'undefined');
+check_equals(typeof(7<null), 'undefined');
+check_equals(typeof(7>null), 'undefined');
+check_equals(typeof(-7<null), 'undefined');
+check_equals(typeof(-7>null), 'undefined');
+#else
+check_equals(typeof(undefined<7), 'boolean');
+check_equals(typeof(undefined>7), 'boolean');
+check_equals(typeof(undefined<-7), 'boolean');
+check_equals(typeof(undefined>-7), 'boolean');
+check_equals(typeof(7<undefined), 'boolean');
+check_equals(typeof(7>undefined), 'boolean');
+check_equals(typeof(-7<undefined), 'boolean');
+check_equals(typeof(-7>undefined), 'boolean');
+
+check_equals((undefined<7), true);
+check_equals((undefined>7), false);
+check_equals((undefined<-7), false);
+check_equals((undefined>-7), true);
+check_equals((7<undefined), false);
+check_equals((7>undefined), true);
+check_equals((-7<undefined), true);
+check_equals((-7>undefined), false);
+#endif
-note(undef);
-note(undef+undef);
-note(undef+'text');
-note('text'+undef);
-note(undef+2);
-note(2+undef);
-note(undef*2);
-note(2*undef);
-note(undef-2);
-note(2-undef);
-note(undef/2);
-note(2/undef);
-note(2/undefined);
Index: testsuite/swfdec/PASSING
===================================================================
RCS file: /sources/gnash/gnash/testsuite/swfdec/PASSING,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- testsuite/swfdec/PASSING 21 Mar 2007 11:54:02 -0000 1.10
+++ testsuite/swfdec/PASSING 22 Mar 2007 00:30:46 -0000 1.11
@@ -45,3 +45,4 @@
setinterval-clear.swf
onload-childparent.swf
registerclass-previous.swf
+comparisons-7.swf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/as_value.h server/vm/ASH...,
Sandro Santilli <=