[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_value.h server/as_val...
From: |
Martin Guy |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_value.h server/as_val... |
Date: |
Thu, 19 Apr 2007 14:25:42 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Martin Guy <martinwguy> 07/04/19 14:25:41
Modified files:
. : ChangeLog
server : as_value.h as_value.cpp edit_text_character.cpp
server/vm : ASHandlers.cpp
Log message:
Revert string-version changes until testsuite works
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2929&r2=1.2930
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.98&r2=1.99
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2929
retrieving revision 1.2930
diff -u -b -r1.2929 -r1.2930
--- ChangeLog 19 Apr 2007 12:33:46 -0000 1.2929
+++ ChangeLog 19 Apr 2007 14:25:40 -0000 1.2930
@@ -1,9 +1,5 @@
2007-04-19 Martin Guy <address@hidden>
- * server/{as_value.{h,cpp},edit_text_character.cpp,{vm/ASHandlers.cpp}:
- Always do version-dependent conversion to string, and move version
- detection for this to a single point in the lowest level.
- This also eliminates all *_versioned() string methods.
* testsuite/actionscript.all/Date.as: Change case-[in]dependent
method existence detection strategy to see if it fixes v5 testrun.
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- server/as_value.h 19 Apr 2007 12:06:56 -0000 1.48
+++ server/as_value.h 19 Apr 2007 14:25:40 -0000 1.49
@@ -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.48 2007/04/19 12:06:56 martinwguy Exp $ */
+/* $Id: as_value.h,v 1.49 2007/04/19 14:25:40 martinwguy Exp $ */
#ifndef GNASH_AS_VALUE_H
#define GNASH_AS_VALUE_H
@@ -289,6 +289,30 @@
std::string to_debug_string() const;
+ /// Get a version-dependent std::string representation for this value.
+ //
+ /// @param version
+ /// The SWF version to be compatible with.
+ ///
+ /// @param env
+ /// The environment to use for running the toString() method
+ /// for object values. If NULL, toString() won't be run.
+ ///
+ std::string to_std_string_versioned(int version, as_environment*
env=NULL) const;
+
+ /// Get a string representation for this value.
+ //
+ /// This differs from to_string() in that returned
+ /// representation will depend on version of the SWF
+ /// source.
+ /// @@ shouldn't this be the default ?
+ ///
+ /// @param env
+ /// The environment to use for running the toString() method
+ /// for object values. If NULL, toString() won't be run.
+ ///
+ const std::string& to_string_versioned(int version,
as_environment* env=NULL) const;
+
/// Conversion to number
//
/// @param env
@@ -382,7 +406,19 @@
void convert_to_number(as_environment* env);
/// Force type to string.
- void convert_to_string(as_environment* env);
+ void convert_to_string();
+
+ /// Force type to string.
+ //
+ /// uses swf-version-aware converter
+ ///
+ /// @param env
+ /// The environment to use for running the toString() method
+ /// for object values. If NULL, toString() won't be run.
+ ///
+ /// @see to_string_versionioned
+ ///
+ void convert_to_string_versioned(int version, as_environment*
env=NULL);
// These set_*()'s are more type-safe; should be used
// in preference to generic overloaded set(). You are
Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/as_value.cpp 19 Apr 2007 12:06:56 -0000 1.41
+++ server/as_value.cpp 19 Apr 2007 14:25:40 -0000 1.42
@@ -67,6 +67,14 @@
}
}
+#if 0
+std::string
+as_value::to_std_string(as_environment* env) const
+{
+ return to_string(env);
+}
+#endif
+
// Conversion to const std::string&.
const std::string&
as_value::to_string(as_environment* env) const
@@ -112,15 +120,16 @@
break;
case UNDEFINED:
- // Behavior depends on file version.
- // In version 7+, it's "undefined",
- // in versions 6-, it's "".
- if (VM::get().getSWFVersion() <= 6) {
- m_string_value = "";
- } else {
+ // Behavior depends on file version. In
+ // version 7+, it's "undefined", in versions
+ // 6-, it's "".
+ //
+ // We'll go with the v7 behavior by default,
+ // and conditionalize via _versioned()
+ // functions.
m_string_value = "undefined";
- }
+
break;
case NULLTYPE:
@@ -193,6 +202,30 @@
return m_string_value;
}
+// Conversion to const std::string&.
+const std::string&
+as_value::to_string_versioned(int version, as_environment* env) const
+{
+ if (m_type == UNDEFINED) {
+ // Version-dependent behavior.
+ if (version <= 6) {
+ m_string_value = "";
+ } else {
+ m_string_value = "undefined";
+ }
+ return m_string_value;
+ }
+
+ return to_string(env);
+}
+
+// Version-based Conversion to std::string
+std::string
+as_value::to_std_string_versioned(int version, as_environment* env) const
+{
+ return to_string_versioned(version, env);
+}
+
// Conversion to primitive value.
as_value
as_value::to_primitive() const
@@ -511,6 +544,7 @@
as_value::to_as_function() const
{
if (m_type == AS_FUNCTION) {
+ // OK.
return m_object_value->to_function();
} else {
return NULL;
@@ -526,12 +560,22 @@
// Force type to string.
void
-as_value::convert_to_string(as_environment* env)
+as_value::convert_to_string()
+{
+ to_string(); // init our string data.
+ m_type = STRING; // force type.
+}
+
+
+void
+as_value::convert_to_string_versioned(int version, as_environment* env)
+ // Force type to string.
{
- to_string(env); // init our string data.
+ to_string_versioned(version, env); // init our string data.
m_type = STRING; // force type.
}
+
void
as_value::set_as_object(as_object* obj)
{
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- server/edit_text_character.cpp 19 Apr 2007 12:06:56 -0000 1.59
+++ server/edit_text_character.cpp 19 Apr 2007 14:25:40 -0000 1.60
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: edit_text_character.cpp,v 1.59 2007/04/19 12:06:56 martinwguy Exp $ */
+/* $Id: edit_text_character.cpp,v 1.60 2007/04/19 14:25:40 martinwguy Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -680,7 +680,8 @@
case M_TEXT:
//if (name == "text")
{
- set_text_value(val.to_string().c_str());
+ int version =
get_parent()->get_movie_definition()->get_version();
+ set_text_value(val.to_string_versioned(version).c_str());
return;
}
case M_X:
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -b -r1.98 -r1.99
--- server/vm/ASHandlers.cpp 19 Apr 2007 12:06:56 -0000 1.98
+++ server/vm/ASHandlers.cpp 19 Apr 2007 14:25:41 -0000 1.99
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: ASHandlers.cpp,v 1.98 2007/04/19 12:06:56 martinwguy Exp $ */
+/* $Id: ASHandlers.cpp,v 1.99 2007/04/19 14:25:41 martinwguy Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -840,7 +840,8 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(1);
- env.top(0).set_int(env.top(0).to_string().size());
+ int version = env.get_version();
+ env.top(0).set_int(env.top(0).to_string_versioned(version).size());
}
void
@@ -867,7 +868,8 @@
int size = unsigned(size_val.to_number(&env));
int base = int(base_val.to_number(&env));
- const std::string& str = string_val.to_string();
+ int version = env.get_version();
+ const std::string& str = string_val.to_string_versioned(version);
if ( size < 0 )
{
@@ -1038,8 +1040,9 @@
thread.ensureStack(2); // two strings
- env.top(1).convert_to_string(&env);
- env.top(1).string_concat(env.top(0).to_string());
+ int version = env.get_version();
+ env.top(1).convert_to_string_versioned(version);
+ env.top(1).string_concat(env.top(0).to_string_versioned(version));
env.drop(1);
}
@@ -1215,6 +1218,7 @@
thread.ensureStack(1);
+ //std::string val =
env.pop().to_string_versioned(VM::get().getSWFVersion(), &env);
std::string val = env.pop().to_string(&env);
log_trace(val.c_str());
}
@@ -2532,11 +2536,13 @@
//log_msg(_("ActionNewAdd(%s, %s) called"), v1.to_debug_string().c_str(),
v2.to_debug_string().c_str());
+
if (v1.is_string() || v2.is_string() )
{
+ int version = env.get_version();
// modify env.top(1)
- v2.convert_to_string(&env);
- v2.string_concat(v1.to_string());
+ v2.convert_to_string_versioned(version, &env);
+ v2.string_concat(v1.to_string_versioned(version, &env));
}
else
{
@@ -2614,7 +2620,8 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(1);
- env.top(0).convert_to_string(&env);
+ int version = env.get_version();
+ env.top(0).convert_to_string_versioned(version);
}
void
@@ -2645,6 +2652,9 @@
thread.ensureStack(2); // member name, target
+ // Some corner case behaviors depend on the SWF file version.
+ int version = env.get_version();
+
as_value member_name = env.top(0);
as_value target = env.top(1);
@@ -2665,8 +2675,8 @@
// Special case: String has a member "length"
// @@ FIXME: we shouldn't have all this "special" cases --strk;
- if (target.is_string() && member_name.to_string() == "length") {
- int len = target.to_string().size();
+ if (target.is_string() && member_name.to_string_versioned(version) ==
"length") {
+ int len = target.to_string_versioned(version).size();
env.top(1).set_int(len);
} else {
if ( ! thread.getObjectMember(*obj, member_name.to_string(&env),
env.top(1)) )
@@ -2753,6 +2763,9 @@
thread.ensureStack(3); // method_name, obj, nargs
+ // Some corner case behaviors depend on the SWF file version.
+ //int version = env.get_version();
+
// Get name function of the method
as_value& method_name = env.top(0);
- [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., Martin Guy, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., Martin Guy, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., Martin Guy, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., zou lunkai, 2007/04/19
- [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val...,
Martin Guy <=