[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11444: More new implementation.
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11444: More new implementation. |
Date: |
Thu, 27 Aug 2009 14:36:51 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11444 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-08-27 14:36:51 +0200
message:
More new implementation.
modified:
libcore/asobj/Globals.cpp
testsuite/swfdec/PASSING
=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-08-27 10:47:30 +0000
+++ b/libcore/asobj/Globals.cpp 2009-08-27 12:08:59 +0000
@@ -138,6 +138,7 @@
as_value global_parsefloat(const fn_call& fn);
as_value global_parseint(const fn_call& fn);
as_value global_assetpropflags(const fn_call& fn);
+ as_value global_assetuperror(const fn_call& fn);
as_value global_asnative(const fn_call& fn);
as_value global_asnew(const fn_call& fn);
as_value global_assetnative(const fn_call& fn);
@@ -148,6 +149,9 @@
as_value global_clearTimeout(const fn_call& fn);
as_value global_clearInterval(const fn_call& fn);
as_value global_setInterval(const fn_call& fn);
+
+ // This is a help function for the silly AsSetupError function.
+ as_value local_errorConstructor(const fn_call& fn);
void registerNatives(as_object& global);
template<typename T> as_object* constructObject(Global_as& gl, const T&
arg,
@@ -326,6 +330,7 @@
init_member("ASSetPropFlags", _vm.getNative(1, 0));
init_member("ASSetNative", _vm.getNative(4, 0));
init_member("ASSetNativeAccessor", _vm.getNative(4, 1));
+ init_member("AsSetupError", createFunction(global_assetuperror));
init_member("updateAfterEvent", _vm.getNative(9, 0));
init_member("trace", _vm.getNative(100, 4));
@@ -1149,6 +1154,57 @@
return as_value();
}
+as_value
+local_errorConstructor(const fn_call& fn)
+{
+ as_object* obj = ensureType<as_object>(fn.this_ptr).get();
+ const as_value& arg = fn.nargs ? fn.arg(0) : as_value();
+ string_table& st = getStringTable(fn);
+ obj->set_member(st.find("message"), arg);
+ return as_value();
+}
+
+
+/// Sets a range of Error subclasses.
+as_value
+global_assetuperror(const fn_call& fn)
+{
+ if (!fn.nargs) return as_value();
+
+ // This should actually call String.split, but since our Array is
+ // wrong we may as well do it like this for now.
+ const std::string& errors = fn.arg(0).to_string();
+
+ std::string::const_iterator pos = errors.begin();
+
+ Global_as* gl = getGlobal(fn);
+
+ // pos is always the position after the last located error.
+ for (;;) {
+
+ // If there are no further commas, find the end of the string.
+ std::string::const_iterator comma = std::find(pos, errors.end(), ',');
+
+ const std::string& err = std::string(pos, comma);
+
+ string_table& st = getStringTable(fn);
+
+ as_function* ctor = gl->getMember(NSV::CLASS_ERROR).to_as_function();
+ if (ctor) {
+ fn_call::Args args;
+ as_object* proto = ctor->constructInstance(fn.env(), args).get();
+
+ // Not really sure what the point of this is.
+ gl->createClass(local_errorConstructor, proto);
+ proto->set_member(st.find("name"), err);
+ proto->set_member(st.find("message"), err);
+ }
+
+ if (comma == errors.end()) break;
+ pos = comma + 1;
+ }
+ return as_value();
+}
as_value
global_setInterval(const fn_call& fn)
@@ -1319,8 +1375,9 @@
//
/// TODO: consider whether ActionTypeError is an appropriate exception.
/// TODO: test the other failure cases.
-template<typename T> as_object* constructObject(Global_as& gl, const T& arg,
- string_table::key className)
+template<typename T>
+as_object*
+constructObject(Global_as& gl, const T& arg, string_table::key className)
{
as_value clval;
=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING 2009-08-27 10:25:55 +0000
+++ b/testsuite/swfdec/PASSING 2009-08-27 12:10:16 +0000
@@ -92,6 +92,9 @@
ASSetPropFlags-ignore-8.swf:8f1b524f43727a28f54c08abe865bcac
ASSetPropFlags-ignore-9.swf:a3084f55961a3726126f845bc99670f5
assetuperror-5.swf:81e05c01c883d200052546a7abfb7ad8
+assetuperror-6.swf:c0c05251f2a4ad2e57c5959cb02c2b19
+assetuperror-7.swf:834af9740b9641f81d8de9286121dacd
+assetuperror-8.swf:2459537165925b0b5d91e4ca99506eb5
atan2-5.swf:64be2dd80026448ba20e798dc9b761e0
atan2-5.swf:f116028da4873f6f32c9d7dbe4be53ec
atan2-6.swf:090d94fe78d2fec52ac41786494979aa
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11444: More new implementation.,
Benjamin Wolsey <=