gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/PropertyList.cpp server/...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/PropertyList.cpp server/...
Date: Wed, 26 Sep 2007 12:09:08 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/09/26 12:09:07

Modified files:
        .              : ChangeLog 
        server         : PropertyList.cpp PropertyList.h 
                         as_environment.cpp as_object.cpp as_object.h 

Log message:
                * server/PropertyList.{cpp,h}: add dump to map.
                * server/as_object.{cpp,h}: add dump_members to map.
                * server/as_environment.cpp: implement dumper for local
                  variables.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4422&r2=1.4423
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.89&r2=1.90
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.71&r2=1.72

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4422
retrieving revision 1.4423
diff -u -b -r1.4422 -r1.4423
--- ChangeLog   26 Sep 2007 11:30:42 -0000      1.4422
+++ ChangeLog   26 Sep 2007 12:09:05 -0000      1.4423
@@ -1,5 +1,12 @@
 2007-09-26 Sandro Santilli <address@hidden>
 
+       * server/PropertyList.{cpp,h}: add dump to map.
+       * server/as_object.{cpp,h}: add dump_members to map.
+       * server/as_environment.cpp: implement dumper for local
+         variables.
+
+2007-09-26 Sandro Santilli <address@hidden>
+
        * server/vm/ActionExec.cpp (call operator): initialize maxBranchCount
          once at start of function; include PC of last jump in maxBranchCount
          exception.

Index: server/PropertyList.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/PropertyList.cpp     23 Sep 2007 08:48:17 -0000      1.20
+++ server/PropertyList.cpp     26 Sep 2007 12:09:07 -0000      1.21
@@ -215,6 +215,17 @@
 }
 
 void
+PropertyList::dump(as_object& this_ptr, std::map<std::string, as_value>& to) 
+{
+       string_table& st = VM::get().getStringTable();
+       for ( const_iterator i=begin(), ie=end(); i != ie; ++i)
+       {
+               const Property* prop = i->second;
+               to.insert(make_pair(st.value(i->first), 
prop->getValue(this_ptr)));
+       }
+}
+
+void
 PropertyList::dump(as_object& this_ptr)
 {
        string_table& st = VM::get().getStringTable();

Index: server/PropertyList.h
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/PropertyList.h       23 Sep 2007 08:48:17 -0000      1.18
+++ server/PropertyList.h       26 Sep 2007 12:09:07 -0000      1.19
@@ -372,6 +372,22 @@
        ///
        void dump(as_object& this_ptr);
 
+       /// Dump all members into the given map
+       //
+       /// @param this_ptr
+       ///     The as_object used to set the 'this' pointer
+       ///     for calling getter/setter function (GetterSetterProperty);
+       ///     it will be unused when getting or setting SimpleProperty
+       ///     properties.
+       ///     This parameter is non-const as nothing prevents an
+       ///     eventual "Getter" function from actually modifying it,
+       ///     so we can't promise constness.
+       ///     Note that the PropertyList itself might be changed
+       ///     from this call, accessed trough the 'this' pointer,
+       ///     so this method too is non-const.
+       ///
+       void dump(as_object& this_ptr, std::map<std::string, as_value>& to);
+
        /// Mark all simple properties, getters and setters
        /// as being reachable (for the GC)
        void setReachable() const;

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- server/as_environment.cpp   19 Sep 2007 14:20:48 -0000      1.89
+++ server/as_environment.cpp   26 Sep 2007 12:09:07 -0000      1.90
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: as_environment.cpp,v 1.89 2007/09/19 14:20:48 cmusick Exp $ */
+/* $Id: as_environment.cpp,v 1.90 2007/09/26 12:09:07 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -910,19 +910,21 @@
 }
 
 static void
-dump(const as_environment::LocalVars& /*locals*/, std::ostream&/* out*/)
+dump(const as_environment::LocalVars& locals, std::ostream& out)
 {
-       log_msg("FIXME: implement dumper for local variables now that they are 
simple objects");
-#if 0
-       for (size_t i=0; i<locals.size(); ++i)
+       typedef std::map<std::string, as_value> PropMap;
+       PropMap props;
+       const_cast<as_object*>(locals.get())->dump_members(props);
+       
+       //log_msg("FIXME: implement dumper for local variables now that they 
are simple objects");
+       int count = 0;
+       for (PropMap::iterator i=props.begin(), e=props.end(); i!=e; ++i)
        {
-               const as_environment::frame_slot& slot = locals[i];
-               if (i) out << ", ";
+               if (count++) out << ", ";
                // TODO: define output operator for as_value !
-               out << slot.m_name << "==" << slot.m_value;
+               out << i->first << "==" << i->second.to_debug_string();
        }
        out << std::endl;
-#endif
 }
 
 void

Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- server/as_object.cpp        23 Sep 2007 08:48:17 -0000      1.64
+++ server/as_object.cpp        26 Sep 2007 12:09:07 -0000      1.65
@@ -403,6 +403,12 @@
 }
 
 void
+as_object::dump_members(std::map<std::string, as_value>& to)
+{
+       _members.dump(*this, to);
+}
+
+void
 as_object::setPropFlags(as_value& props_val, int set_false, int set_true)
 {
        if (props_val.is_string())

Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- server/as_object.h  23 Sep 2007 08:48:17 -0000      1.71
+++ server/as_object.h  26 Sep 2007 12:09:07 -0000      1.72
@@ -112,6 +112,15 @@
        ///
        void dump_members();
 
+       /// Dump all properties into the given map
+       //
+       /// Note that this method is non-const
+       /// as some properties might be getter/setter
+       /// ones, thus simple read of them might execute
+       /// user code actually changing the object itsef.
+       ///
+       void dump_members(std::map<std::string, as_value>& to);
+
        /// Construct an ActionScript object with no prototype associated.
        as_object();
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]