gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9525: Drop compatibility_include.h.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9525: Drop compatibility_include.h. Improve string implementation,
Date: Wed, 23 Jul 2008 12:39:24 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9525
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-07-23 12:39:24 +0200
message:
  Drop compatibility_include.h. Improve string implementation,
  many new passes in testsuite.
removed:
  compatibility_include.h
modified:
  Makefile.am
  libcore/asobj/String_as.cpp
  packaging/debian/rules
  testsuite/actionscript.all/ASnative.as
  testsuite/actionscript.all/String.as
  testsuite/swfdec/PASSING
    ------------------------------------------------------------
    revno: 9516.1.12
    committer: Benjamin Wolsey <address@hidden>
    branch nick: workingcopy
    timestamp: Wed 2008-07-23 10:23:32 +0200
    message:
      Indentation.
    modified:
      server/asobj/String_as.cpp
    ------------------------------------------------------------
    revno: 9516.1.13
    committer: Benjamin Wolsey <address@hidden>
    branch nick: workingcopy
    timestamp: Wed 2008-07-23 12:35:04 +0200
    message:
      Merging in from trunk, so no idea how useful this log message will be.
      
      Allow String methods to be called on any object using as_value::to_string.
      Doesn't apply to String.concat.
      
      Passes in actionscript.all (String.as and ASnative.as) and as a bonus the
      swfdec string-split-empty passes again.
    removed:
      compatibility_include.h
      libgeometry/
      libgeometry/.cvsignore
      libgeometry/Makefile.am
      libgeometry/Point2d.h
      libgeometry/Range2d.h
      libgeometry/snappingrange.h
      testsuite/libgeometry/
      testsuite/libgeometry/.cvsignore
      testsuite/libgeometry/Makefile.am
      testsuite/libgeometry/Point2dTest.cpp
      testsuite/libgeometry/Range2dTest.cpp
      testsuite/libgeometry/snappingrangetest.cpp
    added:
      libbase/Point2d.h
      libbase/Range2d.h
      libbase/snappingrange.h
      testsuite/libbase/Point2dTest.cpp
      testsuite/libbase/Range2dTest.cpp
      testsuite/libbase/snappingrangetest.cpp
    renamed:
      server => libcore
      testsuite/server => testsuite/libcore.all
    modified:
      .bzrignore
      Makefile.am
      backend/Makefile.am
      configure.ac
      cygnal/Makefile.am
      cygnal/testsuite/cygnal.all/Makefile.am
      extensions/dbus/Makefile.am
      extensions/dejagnu/Makefile.am
      extensions/fileio/Makefile.am
      extensions/gtk2/Makefile.am
      extensions/launcher/Makefile.am
      extensions/lirc/Makefile.am
      extensions/metome/Makefile.am
      extensions/mysql/Makefile.am
      gui/Makefile.am
      libamf/Makefile.am
      libbase/Makefile.am
      libcore/Makefile.am
      libcore/asobj/Makefile.am
      libcore/asobj/String_as.cpp
      libcore/edit_text_character.cpp
      libcore/font.cpp
      libcore/font.h
      libcore/fontlib.cpp
      libcore/parser/Makefile.am
      libcore/parser/SWFMovieDefinition.cpp
      libcore/parser/SWFMovieDefinition.h
      libcore/parser/movie_definition.h
      libcore/stream.cpp
      libcore/vm/Makefile.am
      libmedia/Makefile.am
      libnet/Makefile.am
      packaging/debian/rules
      plugin/Makefile.am
      plugin/win32/Makefile.am
      po/Makefile.am
      pythonmodule/Makefile.am
      testsuite/Makefile.am
      testsuite/actionscript.all/ASnative.as
      testsuite/actionscript.all/Makefile.am
      testsuite/actionscript.all/String.as
      testsuite/libamf.all/Makefile.am
      testsuite/libbase/Makefile.am
      testsuite/libcore.all/Makefile.am
      testsuite/libnet.all/Makefile.am
      testsuite/misc-ming.all/Makefile.am
      testsuite/misc-swfc.all/Makefile.am
      testsuite/misc-swfmill.all/Makefile.am
      testsuite/movies.all/Makefile.am
      testsuite/samples/Makefile.am
      testsuite/swfdec/PASSING
      utilities/Makefile.am
=== modified file 'Makefile.am'
--- a/Makefile.am       2008-07-22 21:24:49 +0000
+++ b/Makefile.am       2008-07-23 10:35:04 +0000
@@ -84,8 +84,6 @@
        packaging/bsd.am \
        packaging/rpm.am
 
-noinst_HEADERS = compatibility_include.h
-
 # dist-hook:
 #      @test -d "$(distdir)/packaging" || $(mkinstalldirs) 
"$(distdir)/packaging"
 #      cp -p $(srcdir)/*.am $(top_distdir)/packaging/

=== removed file 'compatibility_include.h'
--- a/compatibility_include.h   2008-06-27 03:50:30 +0000
+++ b/compatibility_include.h   1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
-// Dummy header; should get included first into tu-testbed headers.
-// This is for manual project-specific configuration.
-
-//
-// Some optional general configuration.
-//
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-// Choose STL containers, or tu-testbed's simplified work-alikes.
-// #define _TU_USE_STL 1
-
-// Memory allocation functions.
-// #define tu_malloc(size) ...
-// #define tu_realloc(old_ptr, new_size, old_size) ...
-// #define tu_free(old_ptr, old_size) ...
-
-// @@ TODO operator new stub
-
-// Fatal error handler.
-// #define tu_error_exit(error_code, error_message) ...
-
-
-//
-// Some optional gameswf configuration.
-//
-
-// For enabling XML/XMLSocket functionality in gameswf, using GNOME
-// libxml2
-// #define HAVE_LIBXML 1
-
-// #define TU_CONFIG_LINK_TO_LIBPNG 0

=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp       2008-07-23 07:51:35 +0000
+++ b/libcore/asobj/String_as.cpp       2008-07-23 10:35:04 +0000
@@ -186,7 +186,8 @@
     std::string _string;
 };
 
-// all the arguments will be converted to string and concatenated
+// all the arguments will be converted to string and concatenated.
+// This can only be applied to String objects, unlike other methods.
 static as_value
 string_concat(const fn_call& fn)
 {
@@ -220,12 +221,14 @@
 static as_value
 string_slice(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     int version = obj->getVM().getSWFVersion();
 
-    // Make a copy.
-    std::wstring wstr = utf8::decodeCanonicalString(obj->str(), version);
+    std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
     ENSURE_FN_ARGS(1, 2, as_value());
 
@@ -274,12 +277,13 @@
 static as_value
 string_split(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj =  
ensureType<string_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     const int version = obj->getVM().getSWFVersion();
     
-    const std::string& str = obj->str();
-
     std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
     boost::intrusive_ptr<as_array_object> array(new as_array_object());
@@ -370,10 +374,10 @@
         array->push(utf8::encodeCanonicalString(
                                wstr.substr(prevpos, pos - prevpos),
                                version));
-            if (pos == std::wstring::npos) break;
-            num++;
-            prevpos = pos + delimiterSize;
-            pos++;
+        if (pos == std::wstring::npos) break;
+        num++;
+        prevpos = pos + delimiterSize;
+        pos++;
     }
 
     return as_value(array.get());
@@ -382,9 +386,10 @@
 static as_value
 string_last_index_of(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
-
-    const std::string& str = obj->str();
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     ENSURE_FN_ARGS(1, 2, -1);
 
@@ -417,13 +422,16 @@
 static as_value
 string_sub_str(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     int version = obj->getVM().getSWFVersion();
 
-    std::wstring wstr = utf8::decodeCanonicalString(obj->str(), version);
+    std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
-    ENSURE_FN_ARGS(1, 2, obj->str());
+    ENSURE_FN_ARGS(1, 2, str);
 
     int start = validIndex(wstr, fn.arg(0).to_int());
 
@@ -454,13 +462,16 @@
 static as_value
 string_sub_string(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     int version = obj->getVM().getSWFVersion();
 
-    const std::wstring& wstr = utf8::decodeCanonicalString(obj->str(), 
version);
+    const std::wstring& wstr = utf8::decodeCanonicalString(str, version);
 
-    ENSURE_FN_ARGS(1, 2, obj->str());
+    ENSURE_FN_ARGS(1, 2, str);
 
     int start = fn.arg(0).to_int();
     int end = wstr.size();
@@ -503,11 +514,14 @@
 static as_value
 string_index_of(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     int version = obj->getVM().getSWFVersion();
 
-    const std::wstring& wstr = utf8::decodeCanonicalString(obj->str(), 
version);
+    const std::wstring& wstr = utf8::decodeCanonicalString(str, version);
 
     ENSURE_FN_ARGS(1, 2, -1);
 
@@ -590,11 +604,14 @@
 static as_value
 string_char_code_at(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     int version = obj->getVM().getSWFVersion();
 
-    const std::wstring& wstr = utf8::decodeCanonicalString(obj->str(), 
version);
+    const std::wstring& wstr = utf8::decodeCanonicalString(str, version);
 
     if (fn.nargs == 0) {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -625,11 +642,14 @@
 static as_value
 string_char_at(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    const std::string& str = val.to_string();
 
     const int version = obj->getVM().getSWFVersion();
 
-    const std::wstring& wstr = utf8::decodeCanonicalString(obj->str(), 
version);
+    const std::wstring& wstr = utf8::decodeCanonicalString(str, version);
 
     ENSURE_FN_ARGS(1, 1, "");
 
@@ -649,27 +669,33 @@
 static as_value
 string_to_upper_case(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
-    std::string subject = obj->str();
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    // Copy the string
+    std::string str = val.to_string();
 
     VM& vm = obj->getVM();
 
-    boost::to_upper(subject, vm.getLocale());
+    boost::to_upper(str, vm.getLocale());
 
-    return as_value(subject);
+    return as_value(str);
 }
 
 static as_value
 string_to_lower_case(const fn_call& fn)
 {
-    boost::intrusive_ptr<string_as_object> obj = 
ensureType<string_as_object>(fn.this_ptr);
-    std::string subject = obj->str();
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
+    as_value val(fn.this_ptr);
+    
+    // Copy the string.
+    std::string str = val.to_string();
 
     VM& vm = obj->getVM();
 
-    boost::to_lower(subject, vm.getLocale());
+    boost::to_lower(str, vm.getLocale());
 
-    return as_value(subject);
+    return as_value(str);
 }
 
 static as_value

=== modified file 'packaging/debian/rules'
--- a/packaging/debian/rules    2008-03-03 16:02:39 +0000
+++ b/packaging/debian/rules    2008-07-23 10:35:04 +0000
@@ -144,8 +144,6 @@
        install -d $(CURDIR)/debian/tmp/usr/share/lintian/overrides/
        cp debian/overrides/* $(CURDIR)/debian/tmp/usr/share/lintian/overrides/
 
-       install -d $(CURDIR)/debian/tmp/usr/include/gnash/
-       cp compatibility_include.h $(CURDIR)/debian/tmp/usr/include/gnash/
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libbase/
        cp libbase/*.h $(CURDIR)/debian/tmp/usr/include/gnash/libbase/
        install -d $(CURDIR)/debian/tmp/usr/include/gnash/libgeometry/

=== modified file 'testsuite/actionscript.all/ASnative.as'
--- a/testsuite/actionscript.all/ASnative.as    2008-04-29 09:23:48 +0000
+++ b/testsuite/actionscript.all/ASnative.as    2008-07-23 10:35:04 +0000
@@ -188,7 +188,7 @@
 // String functions (call toString)
 
 a = ASnative(251, 3); // String.toUpperCase
-xcheck_equals(a("Hello World"), "_LEVEL0");
+check_equals(a("Hello World"), "_LEVEL0");
 a = ASnative(102, 0); // SWF5 to upper
 xcheck_equals(a("Hello World"), "_LEVEL0");
 
@@ -196,12 +196,17 @@
 // SWF5 has problems with UTF-8, tested in String.as.
 // No need to test here as well.
 
+check_equals (countTS, 0); // calls to toString.
+
 #if OUTPUT_VERSION > 5
 func.a = ASnative(251, 3); // String.toUpperCase
 xcheck_equals(func.a(), "GNASH MUST WORK! ÖÜÄÄ€€");
 
 func.a = ASnative(251, 4); // String.toLowerCase
 xcheck_equals(func.a(), "gnash must work! öüä䀀");
+
+// Check calls to toString.
+xcheck_equals (countTS, 2);
 #endif
 
 func.a = ASnative(102, 0); // SWF5 to upper
@@ -210,6 +215,13 @@
 func.a = ASnative(102, 1); // SWF5 to lower
 xcheck_equals(func.a(), "gnash must work! öÜäÄ€€");
 
+// Check calls to toString.
+#if OUTPUT_VERSION > 5
+check_equals (countTS, 4);
+#else
+xcheck_equals (countTS, 2);
+#endif
+
 // Stage
 st = ASnative(666, 2);
 st("exactFit");
@@ -239,7 +251,7 @@
 st = ASnative(666, 9);
 
 #if OUTPUT_VERSION > 5
-xcheck_equals (countTS, 4);
+check_equals (countTS, 4);
 #else
 xcheck_equals (countTS, 2);
 #endif
@@ -247,7 +259,7 @@
 xcheck_equals (countVO, 25);
 
 #if OUTPUT_VERSION > 5
+check_totals(79);
+#else
 check_totals(76);
-#else
-check_totals(74);
 #endif

=== modified file 'testsuite/actionscript.all/String.as'
--- a/testsuite/actionscript.all/String.as      2008-07-23 07:51:35 +0000
+++ b/testsuite/actionscript.all/String.as      2008-07-23 10:35:04 +0000
@@ -113,9 +113,9 @@
 o.charCodeAt = String.prototype.charCodeAt;
 o.charAt = String.prototype.charAt;
 c = o.charAt(4);
-xcheck_equals(c, "e");
+check_equals(c, "e");
 c = o.charCodeAt(4);
-xcheck_equals(c, "101");
+check_equals(c, "101");
 //----------------------------------------
 // Check String.indexOf
 // TODO: test with ASnative(251,8)
@@ -149,7 +149,7 @@
 o = new Object;
 o.indexOf = String.prototype.indexOf;
 p = o.indexOf("b");
-xcheck_equals(p, 2);
+check_equals(p, 2);
 //----------------------------------------
 // Check String.split
 // See ASNative.as for more tests.
@@ -328,13 +328,13 @@
 o = new Object;
 o.split = String.prototype.split;
 ar = o.split("b");
-xcheck_equals(ar.length, 3);
-xcheck_equals(ar.toString(), "[o,ject O,ject]");
+check_equals(ar.length, 3);
+check_equals(ar.toString(), "[o,ject O,ject]");
 
 o = new Date(0);
 o.split = String.prototype.split;
 ar = o.split(":");
-xcheck_equals(ar.length, 3);
+check_equals(ar.length, 3);
 
 
 #else
@@ -489,13 +489,13 @@
 o = new Object;
 o.split = String.prototype.split;
 ar = o.split("b");
-xcheck_equals(ar.length, 3);
-xcheck_equals(ar.toString(), "[o,ject O,ject]");
+check_equals(ar.length, 3);
+check_equals(ar.toString(), "[o,ject O,ject]");
 
 o = new Date(0);
 o.split = String.prototype.split;
 ar = o.split(":");
-xcheck_equals(ar.length, 3);
+check_equals(ar.length, 3);
 // It will be different according to the timezone...
 
 #endif
@@ -623,7 +623,7 @@
 
 o = new Object;
 o.substr = String.prototype.substr;
-xcheck_equals(o.substr(0,2), "[o");
+check_equals(o.substr(0,2), "[o");
 
 //-------------------------------------------
 // Check slice 
@@ -654,7 +654,7 @@
 
 o = new Object;
 o.slice = String.prototype.slice;
-xcheck_equals(o.slice(0,1), "[");
+check_equals(o.slice(0,1), "[");
 
 //-------------------------------------------
 // Check substring
@@ -674,7 +674,7 @@
 
 o = new Object;
 o.substring = String.prototype.substring;
-xcheck_equals(o.substring(3,4), "j");
+check_equals(o.substring(3,4), "j");
 
 //-------------------------------------------
 // Concat
@@ -1165,6 +1165,7 @@
 };
 
 g = "teststring";
+check_equals(g+' ', "teststring ");
 check_equals (g.substr(0,4), "test");
 g = new String("teststring");
 check_equals (g.substr(0,4), "test");
@@ -1172,7 +1173,7 @@
 o = new Object;
 check_equals(o.substr(0,4), undefined);
 o.substr = String.prototype.substr;
-xcheck_equals(o.substr(0,4), "fake");
+check_equals(o.substr(0,4), "fake");
 
 Object.prototype.toString = ObjectProtoToStringBackup;
 String.prototype.toString = StringProtoToStringBackup;
@@ -1268,7 +1269,7 @@
 #endif
 
 #if OUTPUT_VERSION < 6
- check_totals(323);
+ check_totals(324);
 #else
- check_totals(339);
+ check_totals(340);
 #endif

=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING  2008-07-15 17:01:35 +0000
+++ b/testsuite/swfdec/PASSING  2008-07-23 10:35:04 +0000
@@ -952,8 +952,11 @@
 string-slice-7.swf:eaed0b05db4e5a01579a94f283f8a068
 string-split-empty-5.swf:0cdbe0cfc78b49bdf37c1e71bfc5743f
 string-split-empty-5.swf:5e9ed1cad7e80dddeed72f6674a034a3
+string-split-empty-6.swf:3a676ec5e92c371427ca38d629943c90
 string-split-empty-6.swf:94aacd4a972c8eae6fa7ebe945074414
+string-split-empty-7.swf:26ed7482148cffa6a9bedf657f44db77
 string-split-empty-7.swf:3be198e0f9277bf4749bddddf85dce33
+string-split-empty-8.swf:0fa43138d18306e83d7cccadd1e8c9e9
 string-trace-5.swf:14759c53a46b39e873a3f928a3e992f5
 string-trace-6.swf:286e55256f525f4220a324a7417e4051
 string-trace-7.swf:f6eac71a2fc50323a5bd4a74eec99dca
@@ -1006,6 +1009,7 @@
 text-field-init-5.swf:f9c095838e41c5b00de362cef6c20167
 text-field-init-native-5.swf:881f1f6314617bd2d789fa99f9765e60
 text-field-replace-text-5.swf:571ec2f1d311c65f98e5e7f76392cb9e
+text-field-replace-text-5.swf:e89d3694aef9f668e714916e8db3195f
 text-field-set-text-format-5.swf:f576da900f9e9b8d911f6791d4114983
 text-field-tag-variable-change.swf:4c03970cb4293453219d053f3c07d024
 text-field-tag-variable.swf:a9e93d3ab26a08dafb196ffd7450e4f7


reply via email to

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