gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/Makefile.am server/Prope...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/Makefile.am server/Prope...
Date: Fri, 03 Nov 2006 08:39:25 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/03 08:39:25

Modified files:
        .              : ChangeLog 
        server         : Makefile.am PropertyList.h as_environment.cpp 
                         as_environment.h 
Added files:
        server         : StringPredicates.h 

Log message:
                * server/: Makefile.am, PropertyList.h, StringPredicates.h:
                  Move std::string comparator in a separate file.
                * server/as_environment.{h,cpp}: use a std::map for variables
                  rather then a stringi_hash; made _variables private.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1484&r2=1.1485
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/StringPredicates.h?cvsroot=gnash&rev=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1484
retrieving revision 1.1485
diff -u -b -r1.1484 -r1.1485
--- ChangeLog   3 Nov 2006 08:10:30 -0000       1.1484
+++ ChangeLog   3 Nov 2006 08:39:25 -0000       1.1485
@@ -1,5 +1,12 @@
 2006-11-03 Sandro Santilli <address@hidden>
 
+       * server/: Makefile.am, PropertyList.h, StringPredicates.h:
+         Move std::string comparator in a separate file.
+       * server/as_environment.{h,cpp}: use a std::map for variables
+         rather then a stringi_hash; made _variables private.
+
+2006-11-03 Sandro Santilli <address@hidden>
+
        * server/as_function.{h,cpp}: properly update refcount
          of function prototype object; improved documentation.
 

Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- server/Makefile.am  29 Oct 2006 18:34:11 -0000      1.82
+++ server/Makefile.am  3 Nov 2006 08:39:25 -0000       1.83
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.82 2006/10/29 18:34:11 rsavoye Exp $
+# $Id: Makefile.am,v 1.83 2006/11/03 08:39:25 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -138,6 +138,7 @@
        sound.h \
        Sprite.h \
        sprite_instance.h \
+       StringPredicates.h \
        movie_instance.h \
        stream.h \
        StreamProvider.h        \

Index: server/PropertyList.h
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/PropertyList.h       30 Oct 2006 08:16:19 -0000      1.5
+++ server/PropertyList.h       3 Nov 2006 08:39:25 -0000       1.6
@@ -25,7 +25,9 @@
 #endif
 
 #include <map> 
-#include <string> // for use within map and for StringNoCaseLessThen
+#include <string> // for use within map 
+
+#include "StringPredicates.h" // for case-insensitive comparison
 
 #include <cassert> // for inlines
 #include <cctype> // for toupper
@@ -41,35 +43,6 @@
 
 namespace gnash {
 
-/// A case-insensitive string comparator (probably not very performant)
-struct StringNoCaseLessThen {
-       bool operator() (const std::string& a, const std::string& b) const
-       {
-               size_t a_len = a.length();
-               size_t b_len = b.length();
-
-               size_t cmplen = a_len < b_len ? a_len : b_len;
-
-               for (size_t i=0; i<cmplen; ++i)
-               {
-                       char cha = toupper(a[i]);
-                       char chb = toupper(b[i]);
-
-                       if (cha < chb) return true;
-                       else if (cha > chb) return false;
-                       assert(cha==chb);
-               }
-
-               // strings are equal for whole lenght of a,
-               // a is LessThen b only if 'b' contains more
-               // characters then 'a' (if same number of
-               // chars 'a' is NOT less then 'b')
-
-               if ( a_len < b_len ) return true;
-               return false; // equal or greater
-
-       }
-};
 
 /// Set of properties associated to an ActionScript object.
 //

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/as_environment.cpp   31 Oct 2006 12:55:24 -0000      1.26
+++ server/as_environment.cpp   3 Nov 2006 08:39:25 -0000       1.27
@@ -16,7 +16,7 @@
 
 //
 
-/* $Id: as_environment.cpp,v 1.26 2006/10/31 12:55:24 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.27 2006/11/03 08:39:25 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -253,14 +253,18 @@
 bool
 as_environment::get_member(const tu_stringi& varname, as_value* val) const
 {
-    return m_variables.get(varname, val);
+    Variables::const_iterator it = _variables.find(varname.c_str());
+    if ( it == _variables.end() ) return false;
+    
+    *val = it->second;
+    return true;
 }
 
 
 void
 as_environment::set_member(const tu_stringi& varname, const as_value& val)
 {
-    m_variables[varname] = val;
+    _variables[varname.c_str()] = val;
 }
 
 as_value&

Index: server/as_environment.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/as_environment.h     29 Oct 2006 18:34:11 -0000      1.26
+++ server/as_environment.h     3 Nov 2006 08:39:25 -0000       1.27
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: as_environment.h,v 1.26 2006/10/29 18:34:11 rsavoye Exp $ */
+/* $Id: as_environment.h,v 1.27 2006/11/03 08:39:25 strk Exp $ */
 
 #ifndef GNASH_AS_ENVIRONMENT_H
 #define GNASH_AS_ENVIRONMENT_H
@@ -27,9 +27,10 @@
 #include "config.h"
 #endif
 
-#include "container.h" // for composition (stringi_hash, tu_string)
 #include "as_value.h" // for composition (vector + frame_slot)
+#include "StringPredicates.h" // for Variables 
 
+#include <map> // for composition (Variables)
 #include <vector>
 #include <iostream> // for dump_stack inline
 
@@ -46,9 +47,6 @@
        /// Stack of as_values in this environment
        std::vector<as_value>   m_stack;
 
-       /// Variables available in this environment
-       stringi_hash<as_value>  m_variables;
-
        /// For local vars.  Use empty names to separate frames.
        class frame_slot
        {
@@ -185,7 +183,14 @@
        /// If no member is found under the given name
        /// 'val' is untouched and 'false' is returned.
        /// 
+       /// TODO: rename to get_variable, take a std::string
+       ///
        bool    get_member(const tu_stringi& varname, as_value* val) const;
+
+       /// Set the named variable 
+       //
+       /// TODO: rename to set_variable, take a std::string
+       ///
        void    set_member(const tu_stringi& varname, const as_value& val);
 
        // Parameter/local stack frame management.
@@ -301,8 +306,14 @@
                tu_string& var);
 
 
+       /// The variables container (case-insensitive)
+       typedef std::map<std::string, as_value, StringNoCaseLessThen> Variables;
+
 private:
 
+       /// Variables available in this environment
+       Variables _variables;
+
        as_value m_global_register[4];
 
        /// function2 uses this (could move to swf_function2 class)

Index: server/StringPredicates.h
===================================================================
RCS file: server/StringPredicates.h
diff -N server/StringPredicates.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/StringPredicates.h   3 Nov 2006 08:39:25 -0000       1.2
@@ -0,0 +1,66 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 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; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+
+#ifndef GNASH_STRINGPREDICATES_H
+#define GNASH_STRINGPREDICATES_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string> 
+
+#include <cassert> // for inlines
+
+namespace gnash {
+
+/// A case-insensitive string comparator (probably not very performant)
+struct StringNoCaseLessThen {
+       bool operator() (const std::string& a, const std::string& b) const
+       {
+               size_t a_len = a.length();
+               size_t b_len = b.length();
+
+               size_t cmplen = a_len < b_len ? a_len : b_len;
+
+               for (size_t i=0; i<cmplen; ++i)
+               {
+                       char cha = toupper(a[i]);
+                       char chb = toupper(b[i]);
+
+                       if (cha < chb) return true;
+                       else if (cha > chb) return false;
+                       assert(cha==chb);
+               }
+
+               // strings are equal for whole lenght of a,
+               // a is LessThen b only if 'b' contains more
+               // characters then 'a' (if same number of
+               // chars 'a' is NOT less then 'b')
+
+               if ( a_len < b_len ) return true;
+               return false; // equal or greater
+
+       }
+};
+
+
+} // namespace gnash
+
+#endif // GNASH_STRINGPREDICATES_H




reply via email to

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