CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/27 22:20:08
Modified files: . : ChangeLog server : as_object.h as_value.cpp server/asobj : string.cpp testsuite/actionscript.all: toString_valueOf.as testsuite/misc-ming.all: get_frame_number_test.c testsuite/swfdec: PASSING Log message: * server/as_object.h: add useCustomToString method to handle corner cases for which an ActionScript class doesn't want to use toString methods, when available, for converting to a string. * server/as_value.cpp (to_string): check with useCustomToString if for an object value we should or not call the ActionScript toString method. * server/asobj/string.cpp: override useCustomToString to return false and act as dumb and complex as the proprietary player (urgh) * testsuite/actionscript.all/toString_valueOf.as: two tests fixed. * testsuite/misc-ming.all/get_frame_number_test.c: one test fixed. * testsuite/swfdec/PASSING: three tests fixed. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4451&r2=1.4452 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.72&r2=1.73 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.77&r2=1.78 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/string.cpp?cvsroot=gnash&r1=1.36&r2=1.37 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/toString_valueOf.as?cvsroot=gnash&r1=1.17&r2=1.18 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/get_frame_number_test.c?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/swfdec/PASSING?cvsroot=gnash&r1=1.32&r2=1.33 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4451 retrieving revision 1.4452 diff -u -b -r1.4451 -r1.4452 --- ChangeLog 27 Sep 2007 20:01:15 -0000 1.4451 +++ ChangeLog 27 Sep 2007 22:20:06 -0000 1.4452 @@ -1,3 +1,17 @@ +2007-09-28 Sandro Santilli <[EMAIL PROTECTED]> + + * server/as_object.h: add useCustomToString method to handle corner + cases for which an ActionScript class doesn't want to use toString + methods, when available, for converting to a string. + * server/as_value.cpp (to_string): check with useCustomToString if + for an object value we should or not call the ActionScript toString + method. + * server/asobj/string.cpp: override useCustomToString to return false + and act as dumb and complex as the proprietary player (urgh) + * testsuite/actionscript.all/toString_valueOf.as: two tests fixed. + * testsuite/misc-ming.all/get_frame_number_test.c: one test fixed. + * testsuite/swfdec/PASSING: three tests fixed. + 2007-09-27 Sandro Santilli <[EMAIL PROTECTED]> * testsuite/actionscript.all/Global.as: test that parseInt() would Index: server/as_object.h =================================================================== RCS file: /sources/gnash/gnash/server/as_object.h,v retrieving revision 1.72 retrieving revision 1.73 diff -u -b -r1.72 -r1.73 --- server/as_object.h 26 Sep 2007 12:09:07 -0000 1.72 +++ server/as_object.h 27 Sep 2007 22:20:06 -0000 1.73 @@ -141,6 +141,11 @@ /// Return a text representation for this object virtual std::string get_text_value() const { return "[object Object]"; } + /// Return true if instances of this ActionScript class should use + /// a custom toString method, when available, for converting the object + /// to a string. + virtual bool useCustomToString() const { return true; } + /// Return the numeric value of this object // /// The default implementation converts the text value Index: server/as_value.cpp =================================================================== RCS file: /sources/gnash/gnash/server/as_value.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -u -b -r1.77 -r1.78 --- server/as_value.cpp 26 Sep 2007 14:44:16 -0000 1.77 +++ server/as_value.cpp 27 Sep 2007 22:20:07 -0000 1.78 @@ -133,6 +133,12 @@ // instead. // as_object* obj = m_object_value; + if ( ! obj->useCustomToString() ) + { + m_string_value = obj->get_text_value(); + return m_string_value; + } + bool gotValidToStringResult = false; if ( env ) { Index: server/asobj/string.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/string.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -b -r1.36 -r1.37 --- server/asobj/string.cpp 31 Aug 2007 21:53:32 -0000 1.36 +++ server/asobj/string.cpp 27 Sep 2007 22:20:07 -0000 1.37 @@ -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: string.cpp,v 1.36 2007/08/31 21:53:32 strk Exp $ */ +/* $Id: string.cpp,v 1.37 2007/09/27 22:20:07 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -120,6 +120,8 @@ as_object(getStringInterface()) {} + bool useCustomToString() const { return false; } + std::string get_text_value() const { return _string; Index: testsuite/actionscript.all/toString_valueOf.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/toString_valueOf.as,v retrieving revision 1.17 retrieving revision 1.18 diff -u -b -r1.17 -r1.18 --- testsuite/actionscript.all/toString_valueOf.as 27 Sep 2007 15:42:11 -0000 1.17 +++ testsuite/actionscript.all/toString_valueOf.as 27 Sep 2007 22:20:08 -0000 1.18 @@ -186,8 +186,8 @@ String.prototype.toString = function () {return "TO_STRING";}; String.prototype.valueOf = function () {return "TO_VALUE";}; -xcheck_equals(parseInt(str1), 10); -xcheck_equals(parseInt(str2), 2); +check_equals(parseInt(str1), 10); +check_equals(parseInt(str2), 2); str3 = str1 + str2; check(typeof(str3) == "string"); //valueOf called Index: testsuite/misc-ming.all/get_frame_number_test.c =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/get_frame_number_test.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- testsuite/misc-ming.all/get_frame_number_test.c 1 Jul 2007 10:54:53 -0000 1.5 +++ testsuite/misc-ming.all/get_frame_number_test.c 27 Sep 2007 22:20:08 -0000 1.6 @@ -159,7 +159,7 @@ check_equals(mo, "_root.x6.toString()", "4"); add_actions(mo, " gotoAndStop(x6); "); // ActionGotoExpression /* toString() not invoked for String Object ??? */ - xcheck_equals(mo, "_currentframe", "3"); + check_equals(mo, "_currentframe", "3"); /* This ensure the movie stop at the last frame, * and the actions in last frame will not be pushed again Index: testsuite/swfdec/PASSING =================================================================== RCS file: /sources/gnash/gnash/testsuite/swfdec/PASSING,v retrieving revision 1.32 retrieving revision 1.33 diff -u -b -r1.32 -r1.33 --- testsuite/swfdec/PASSING 22 Sep 2007 17:32:33 -0000 1.32 +++ testsuite/swfdec/PASSING 27 Sep 2007 22:20:08 -0000 1.33 @@ -251,3 +251,6 @@ place-object-remove-button-name-5.swf place-object-remove-button-name-6.swf place-object-remove-button-name-7.swf +string-trace-5.swf +string-trace-6.swf +string-trace-7.swf _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit