gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9733: Switch default AMF decode/enc


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9733: Switch default AMF decode/encode implementation used for SharedObject to buffer-based, stub missing SharedObject methods
Date: Sat, 13 Sep 2008 09:08:00 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9733
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Sat 2008-09-13 09:08:00 +0200
message:
  Switch default AMF decode/encode implementation used for SharedObject to 
buffer-based, stub missing SharedObject methods
modified:
  libcore/asobj/SharedObject.cpp
  testsuite/actionscript.all/SharedObject.as
  testsuite/misc-ming.all/SharedObjectTest.as
    ------------------------------------------------------------
    revno: 9727.1.6
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Fri 2008-09-12 19:59:13 +0200
    message:
      Stub unimplemented SharedObject methods
    modified:
      libcore/asobj/SharedObject.cpp
      testsuite/actionscript.all/SharedObject.as
    ------------------------------------------------------------
    revno: 9727.1.7
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Sat 2008-09-13 08:33:19 +0200
    message:
      Use buffer-based AMF encoding/decoding by default. Expect less failures.
    modified:
      libcore/asobj/SharedObject.cpp
      testsuite/misc-ming.all/SharedObjectTest.as
=== modified file 'libcore/asobj/SharedObject.cpp'
--- a/libcore/asobj/SharedObject.cpp    2008-09-12 11:43:16 +0000
+++ b/libcore/asobj/SharedObject.cpp    2008-09-13 06:33:19 +0000
@@ -48,15 +48,9 @@
 #include "URL.h"
 #include "rc.h" // for use of rcfile
 
-// Define this to use the buffer-based AMF0 decoder/encoder
-// rather then libamf. Fixes misc-ming.all/SharedObjectTestRunner
-// both behavioural and for memory errors.
-// The only failing case in that test is comparison of input
-// and output .sol file. This is because ::writeAMF0 encodes
-// arrays as STRICT_ARRAY rather then ECMA_ARRAY. Should be
-// checked if this is a common need or only SOL-specific.
-//
-//#define BUFFERED_AMF_SOL
+// Undefine this to use the Element-based AMF0 decoder/encoder.
+// May be useful to test libamf.
+#define BUFFERED_AMF_SOL
 
 namespace {
 //gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
@@ -71,11 +65,16 @@
 #define MAXHOSTNAMELEN 64
 #endif
 
-as_value sharedobject_clear(const fn_call& fn);
-as_value sharedobject_flush(const fn_call& fn);
-as_value sharedobject_getlocal(const fn_call& fn);
-as_value sharedobject_getsize(const fn_call& fn);
-as_value sharedobject_ctor(const fn_call& fn);
+static as_value sharedobject_connect(const fn_call& fn);
+static as_value sharedobject_send(const fn_call& fn);
+static as_value sharedobject_flush(const fn_call& fn);
+static as_value sharedobject_close(const fn_call& fn);
+static as_value sharedobject_getsize(const fn_call& fn);
+static as_value sharedobject_setFps(const fn_call& fn);
+static as_value sharedobject_clear(const fn_call& fn);
+
+static as_value sharedobject_getlocal(const fn_call& fn);
+static as_value sharedobject_ctor(const fn_call& fn);
 
 void sharedobject_iter(SOL &sol, string_table::key key, const as_value 
&reference);
 
@@ -204,14 +203,28 @@
 //    GNASH_REPORT_FUNCTION;
 
     VM& vm = o.getVM();
+
+    // ASnative table registration
+       vm.registerNative(sharedobject_connect, 2106, 0);
+       vm.registerNative(sharedobject_send, 2106, 1);
+       vm.registerNative(sharedobject_flush, 2106, 2);
+       vm.registerNative(sharedobject_close, 2106, 3);
+       vm.registerNative(sharedobject_getsize, 2106, 4);
+       vm.registerNative(sharedobject_setFps, 2106, 5);
+       vm.registerNative(sharedobject_clear, 2106, 6);
+
     const int swfVersion = vm.getSWFVersion();
 
     // clear, flush and getSize not in SWF<6 , it seems
     if ( swfVersion < 6 ) return; 
 
-    o.init_member("clear", new builtin_function(sharedobject_clear));
-    o.init_member("flush", new builtin_function(sharedobject_flush));
-    o.init_member("getSize", new builtin_function(sharedobject_getsize));
+    o.init_member("connect", new builtin_function(sharedobject_connect)); // 
asnative 2106,0
+    o.init_member("send", new builtin_function(sharedobject_send)); // 
asnative 2106,1
+    o.init_member("flush", new builtin_function(sharedobject_flush)); // 
asnative 2106,2
+    o.init_member("close", new builtin_function(sharedobject_close)); // 
asnative 2106,3
+    o.init_member("getSize", new builtin_function(sharedobject_getsize)); // 
asnative 2106,4
+    o.init_member("setFps", new builtin_function(sharedobject_setFps)); // 
asnative 2106,5
+    o.init_member("clear", new builtin_function(sharedobject_clear)); // 
asnative 2106,6
 }
 
 static void
@@ -720,6 +733,46 @@
 }
 
 as_value
+sharedobject_connect(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject> obj = 
ensureType<SharedObject>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.connect"));
+    return as_value();
+}
+
+as_value
+sharedobject_close(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject> obj = 
ensureType<SharedObject>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.close"));
+    return as_value();
+}
+
+as_value
+sharedobject_setFps(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject> obj = 
ensureType<SharedObject>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.setFps"));
+    return as_value();
+}
+
+as_value
+sharedobject_send(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject> obj = 
ensureType<SharedObject>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.send"));
+    return as_value();
+}
+
+as_value
 sharedobject_flush(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;

=== modified file 'testsuite/actionscript.all/SharedObject.as'
--- a/testsuite/actionscript.all/SharedObject.as        2008-09-13 02:00:52 
+0000
+++ b/testsuite/actionscript.all/SharedObject.as        2008-09-13 07:08:00 
+0000
@@ -42,18 +42,31 @@
 // test the SharedObject constuctor
 check_equals (typeof(sharedobjectObj), 'object');
 
-// test the SharedObject::clear method
-check_equals (typeof(sharedobjectObj.clear), 'function');
-// test the SharedObject::flush method
+
+// test the SharedObject.getlocal method
+check_equals (typeof(sharedobjectObj.getLocal), 'undefined');
+check_equals (typeof(SharedObject.getLocal), 'function');
+
+// test the SharedObject.connect method (asnative 2106,0)
+check_equals (typeof(sharedobjectObj.connect), 'function');
+
+// test the SharedObject.send method (asnative 2106,1)
+check_equals (typeof(sharedobjectObj.send), 'function');
+
+// test the SharedObject.flush method (asnative 2106,2)
 check_equals (typeof(sharedobjectObj.flush), 'function');
 
-// test the SharedObject::getlocal method
-check_equals (typeof(sharedobjectObj.getLocal), 'undefined');
-check_equals (typeof(SharedObject.getLocal), 'function');
+// test the SharedObject.close method (asnative 2106,3)
+check_equals (typeof(sharedobjectObj.close), 'function');
 
-// test the SharedObject::getsize method
+// test the SharedObject.getsize method (asnative 2106,4)
 check_equals (typeof(sharedobjectObj.getSize), 'function');
 
+// test the SharedObject.setFps method (asnative 2106,5)
+check_equals (typeof(sharedobjectObj.setFps), 'function');
+
+// test the SharedObject.clear method (asnative 2106,6)
+check_equals (typeof(sharedobjectObj.clear), 'function');
 
 // FIXME: Test code that will soon be a formal test case.
 so = SharedObject.getLocal("level1/level2/settings", "/");
@@ -203,6 +216,6 @@
 // END OF TESTS
 //------------------------------------------
 
-check_totals(51);
+check_totals(55);
 
 #endif // OUTPUT_VERSION >= 6

=== modified file 'testsuite/misc-ming.all/SharedObjectTest.as'
--- a/testsuite/misc-ming.all/SharedObjectTest.as       2008-09-12 12:37:08 
+0000
+++ b/testsuite/misc-ming.all/SharedObjectTest.as       2008-09-13 06:33:19 
+0000
@@ -40,24 +40,24 @@
 check_equals(so1.data.fbool, false);
 
 // Test reading mixed types in ECMA_ARRAY 
-xcheck_equals(typeof(so1.data.ary), 'object');
-xcheck_equals(so1.data.ary.toString(), '1,true,string,null,');
-xcheck_equals(typeof(so1.data.ary[0]), 'number');
-xcheck_equals(typeof(so1.data.ary[1]), 'boolean');
-xcheck_equals(typeof(so1.data.ary[2]), 'string');
-xcheck_equals(typeof(so1.data.ary[3]), 'null');
+check_equals(typeof(so1.data.ary), 'object');
+check_equals(so1.data.ary.toString(), '1,true,string,null,');
+check_equals(typeof(so1.data.ary[0]), 'number');
+check_equals(typeof(so1.data.ary[1]), 'boolean');
+check_equals(typeof(so1.data.ary[2]), 'string');
+check_equals(typeof(so1.data.ary[3]), 'null');
 check_equals(typeof(so1.data.ary[4]), 'undefined');
-xcheck_equals(so1.data.ary.length, 5);
+check_equals(so1.data.ary.length, 5);
 // test composition
 a=[]; for (i in so1.data.ary) a.push(i);
 a.sort();
 check_equals(a.toString(), '0,1,2,3,4'); // note: no 'length'
 
 // Test reading ECMA_ARRAY
-xcheck_equals(typeof(so1.data.aryns), 'object');
-xcheck_equals(so1.data.aryns.toString(), '4,5,6,,,,,');
-xcheck_equals(so1.data.aryns.length, 8);
-xcheck_equals(so1.data.aryns.custom, 7);
+check_equals(typeof(so1.data.aryns), 'object');
+check_equals(so1.data.aryns.toString(), '4,5,6,,,,,');
+check_equals(so1.data.aryns.length, 8);
+check_equals(so1.data.aryns.custom, 7);
 // test composition
 a=[]; for (i in so1.data.aryns) a.push(i);
 a.sort();
@@ -65,24 +65,24 @@
 
 // Test reading OBJECT
 check(so1.data.obj instanceOf Object);
-xcheck_equals(typeof(so1.data.obj), 'object');
-xcheck_equals(typeof(so1.data.obj.a), 'number');
+check_equals(typeof(so1.data.obj), 'object');
+check_equals(typeof(so1.data.obj.a), 'number');
 check(so1.data.obj.hasOwnProperty('a'));
 check(!so1.data.obj.hasOwnProperty('hidden'));
 
 // Test reading NUMBER
-xcheck_equals(so1.data.obj.a, 10);
+check_equals(so1.data.obj.a, 10);
 
 // Test reading STRING
-xcheck_equals(typeof(so1.data.obj.b), 'string');
-xcheck_equals(so1.data.obj.b, '20');
+check_equals(typeof(so1.data.obj.b), 'string');
+check_equals(so1.data.obj.b, '20');
 
 // Test reading BOOLEAN
-xcheck_equals(typeof(so1.data.obj.c), 'boolean');
-xcheck_equals(so1.data.obj.c, true);
+check_equals(typeof(so1.data.obj.c), 'boolean');
+check_equals(so1.data.obj.c, true);
 
 // Test reading REFERENCE
-xcheck_equals(typeof(so1.data.ref), 'object');
+check_equals(typeof(so1.data.ref), 'object');
 check_equals(so1.data.ref, so1.data.obj); 
 
 // force writing the sol or the adobe player won't save it


reply via email to

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