[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11443: Implement more classes with
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11443: Implement more classes with Relay objects, correct properties. |
Date: |
Thu, 27 Aug 2009 13:29:16 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11443 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-08-27 13:29:16 +0200
message:
Implement more classes with Relay objects, correct properties.
Handle more creation functions centrally.
removed:
libcore/asobj/flash/net/NetConnection_as.cpp
libcore/asobj/flash/net/NetConnection_as.h.stub
libcore/asobj/flash/net/NetStream_as.cpp
libcore/asobj/flash/net/NetStream_as.h
renamed:
libcore/asobj/NetConnection_as.cpp =>
libcore/asobj/flash/net/NetConnection_as.cpp
libcore/asobj/NetConnection_as.h => libcore/asobj/flash/net/NetConnection_as.h
libcore/asobj/NetStream_as.cpp => libcore/asobj/flash/net/NetStream_as.cpp
libcore/asobj/NetStream_as.h => libcore/asobj/flash/net/NetStream_as.h
modified:
libcore/Button.cpp
libcore/Button.h
libcore/MovieClip.cpp
libcore/TextField.cpp
libcore/TextField.h
libcore/Video.cpp
libcore/asobj/Boolean_as.cpp
libcore/asobj/Color_as.cpp
libcore/asobj/Date_as.cpp
libcore/asobj/Global_as.h
libcore/asobj/Globals.cpp
libcore/asobj/Globals.h
libcore/asobj/Number_as.cpp
libcore/asobj/Object.cpp
libcore/asobj/String_as.cpp
libcore/asobj/TextFormat_as.cpp
libcore/asobj/TextFormat_as.h
libcore/asobj/flash.am
libcore/asobj/flash/accessibility/Accessibility_as.cpp
libcore/asobj/flash/display/MovieClip_as.cpp
libcore/asobj/flash/external/ExternalInterface_as.cpp
libcore/asobj/flash/geom/ColorTransform_as.cpp
libcore/asobj/flash/geom/ColorTransform_as.h
libcore/asobj/flash/geom/Transform_as.cpp
libcore/asobj/flash/geom/geom_pkg.cpp
libcore/asobj/flash/net/URLRequestMethod_as.cpp
libcore/asobj/flash/net/net.am
libcore/asobj/flash/system/System_as.cpp
libcore/asobj/flash/text/TextFieldAutoSize_as.cpp
libcore/asobj/flash/ui/ContextMenu_as.cpp
libcore/asobj/flash/xml/XMLDocument_as.cpp
libcore/asobj/flash/xml/XMLNode_as.cpp
libcore/asobj/flash/xml/XMLNode_as.h
libcore/swf/SetTabIndexTag.cpp
libcore/swf_function.cpp
libcore/vm/ASHandlers.cpp
libcore/vm/CallStack.cpp
libcore/vm/Machine.cpp
testsuite/swfdec/PASSING
libcore/asobj/flash/net/NetConnection_as.cpp
libcore/asobj/flash/net/NetStream_as.cpp
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp 2009-08-18 10:05:43 +0000
+++ b/libcore/Button.cpp 2009-08-27 05:46:44 +0000
@@ -31,6 +31,7 @@
#include "movie_root.h"
#include "VM.h"
#include "builtin_function.h"
+#include "NativeFunction.h"
#include "fn_call.h"
#include "ExecutableCode.h"
#include "namedStrings.h"
@@ -307,6 +308,7 @@
const int unprotected = 0;
o.init_member(NSV::PROP_ENABLED, true, unprotected);
+ o.init_member("useHandCursor", true, unprotected);
}
@@ -1118,7 +1120,7 @@
}
void
-Button::init(as_object& global, const ObjectURI& uri)
+button_class_init(as_object& global, const ObjectURI& uri)
{
// This is going to be the global Button "class"/"function"
Global_as* gl = getGlobal(global);
@@ -1130,6 +1132,12 @@
getNamespace(uri));
}
+void
+registerButtonNative(as_object& /*global*/)
+{
+ // TODO: button.getDepth
+}
+
#ifdef USE_SWFTREE
DisplayObject::InfoTree::iterator
Button::getMovieInfo(InfoTree& tr, InfoTree::iterator it)
=== modified file 'libcore/Button.h'
--- a/libcore/Button.h 2009-07-16 08:30:06 +0000
+++ b/libcore/Button.h 2009-08-27 05:46:44 +0000
@@ -77,9 +77,6 @@
static const char* mouseStateName(MouseState s);
- /// Initialize the global Button class
- static void init(as_object& global, const ObjectURI& uri);
-
// See dox in as_object.h
bool get_member(string_table::key name, as_value* val,
string_table::key nsname = 0);
@@ -219,6 +216,12 @@
};
+
+/// Initialize the global Button class
+void button_class_init(as_object& global, const ObjectURI& uri);
+
+void registerButtonNative(as_object& global);
+
} // end namespace gnash
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2009-07-16 08:53:33 +0000
+++ b/libcore/MovieClip.cpp 2009-08-27 10:47:30 +0000
@@ -55,7 +55,6 @@
#include "namedStrings.h"
#include "styles.h" // for cap_style_e and join_style_e enums
#include "PlaceObject2Tag.h"
-#include "NetStream_as.h"
#include "flash/display/BitmapData_as.h"
#include "flash/geom/Matrix_as.h"
#include "ExportableResource.h"
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp 2009-08-21 21:19:40 +0000
+++ b/libcore/TextField.cpp 2009-08-27 10:18:44 +0000
@@ -42,15 +42,16 @@
#include "as_environment.h" // for parse_path
#include "action.h" // for as_standard_member enum
#include "VM.h"
-#include "builtin_function.h" // for getter/setter properties
-#include "Font.h" // for using the _font member
-#include "fontlib.h" // for searching or adding fonts the _font member
+#include "builtin_function.h"
+#include "NativeFunction.h"
+#include "Font.h"
+#include "fontlib.h"
#include "Object.h" // for getObjectInterface
#include "namedStrings.h"
#include "Array_as.h" // for _listeners construction
#include "AsBroadcaster.h" // for initializing self as a broadcaster
#include "StringPredicates.h"
-#include "TextFormat_as.h" // for getTextFormat/setTextFormat
+#include "TextFormat_as.h"
#include "GnashKey.h" // key::code
#include "TextRecord.h"
#include "Global_as.h"
@@ -2568,6 +2569,20 @@
getNamespace(uri));
}
+void
+registerTextFieldNative(as_object& global)
+{
+ VM& vm = getVM(global);
+ vm.registerNative(textfield_replaceSel, 104, 100);
+ vm.registerNative(textfield_getTextFormat, 104, 101);
+ vm.registerNative(textfield_setTextFormat, 104, 102);
+ vm.registerNative(textfield_removeTextField, 104, 103);
+ vm.registerNative(textfield_getNewTextFormat, 104, 104);
+ vm.registerNative(textfield_setNewTextFormat, 104, 105);
+ vm.registerNative(textfield_getDepth, 104, 106);
+ vm.registerNative(textfield_replaceText, 104, 107);
+}
+
bool
TextField::pointInShape(boost::int32_t x, boost::int32_t y) const
{
@@ -3388,12 +3403,30 @@
return as_value();
}
+
+// This is a bit of a messy compromise. We call the TextFormat ctor (this
+// is necessary because prototype properties are not attached until that is
+// done). Then we access the relay object directly. This is because there
+// aren't enough known parameters to the TextFormat constructor to handle
+// all the values, and it isn't tested properly.
as_value
textfield_getTextFormat(const fn_call& fn)
{
boost::intrusive_ptr<TextField> text = ensureType<TextField>(fn.this_ptr);
- boost::intrusive_ptr<TextFormat_as> tf = new TextFormat_as;
+ Global_as* gl = getGlobal(fn);
+ as_function* ctor = gl->getMember(NSV::CLASS_TEXT_FORMAT).to_as_function();
+
+ if (!ctor) return as_value();
+
+ fn_call::Args args;
+ as_object* textformat = ctor->constructInstance(fn.env(), args).get();
+ TextFormat_as* tf;
+
+ if (!isNativeType(textformat, tf)) {
+ return as_value();
+ }
+
tf->alignSet(text->getTextAlignment());
tf->sizeSet(text->getFontHeight());
tf->indentSet(text->getIndent());
@@ -3419,7 +3452,7 @@
"tabStops, bullet and display")
);
- return as_value(tf.get());
+ return as_value(textformat);
}
as_value
@@ -3444,28 +3477,17 @@
"unhandled by Gnash", ss.str());
}
- as_object* obj = fn.arg(0).to_object(*getGlobal(fn)).get();
- if ( ! obj )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- std::stringstream ss; fn.dump_args(ss);
- log_aserror("TextField.setTextFormat(%s) : %s", ss.str(),
- _("first argument is not an object"))
- );
- return as_value();
- }
-
- TextFormat_as* tf = dynamic_cast<TextFormat_as*>(obj);
- if ( ! tf )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- std::stringstream ss; fn.dump_args(ss);
- log_aserror("TextField.setTextFormat(%s) : %s", ss.str(),
- _("first argument is not a TextFormat"))
- );
- return as_value();
- }
-
+ TextFormat_as* tf;
+ if (!isNativeType(fn.arg(0).to_object(*getGlobal(fn)).get(), tf)) {
+
+ IF_VERBOSE_ASCODING_ERRORS(
+ std::stringstream ss; fn.dump_args(ss);
+ log_aserror("TextField.setTextFormat(%s) : %s", ss.str(),
+ _("first argument is not a TextFormat"))
+ );
+ return as_value();
+ }
+
if (isAS3(fn)) {
// TODO: current font finding assumes we have a parent, which isn't
// necessarily the case in AS3. It seems the AS2 implementation is
@@ -3811,8 +3833,6 @@
void
attachTextFieldInterface(as_object& o)
{
- Global_as* gl = getGlobal(o);
-
// TextField is an AsBroadcaster
AsBroadcaster::initialize(o);
@@ -3846,35 +3866,22 @@
o.init_property(NSV::PROP_uYSCALE,
DisplayObject::yscale_getset, DisplayObject::yscale_getset);
- // Standard flags.
- const int flags = PropFlags::dontDelete
- |PropFlags::dontEnum;
-
// SWF6 or higher
- const int swf6Flags = flags | PropFlags::onlySWF6Up;
+ const int swf6Flags = as_object::DefaultFlags | PropFlags::onlySWF6Up;
- o.init_member("setTextFormat",
- gl->createFunction(textfield_setTextFormat), swf6Flags);
- o.init_member("getTextFormat",
- gl->createFunction(textfield_getTextFormat), swf6Flags);
- o.init_member("setNewTextFormat",
- gl->createFunction(textfield_setNewTextFormat), swf6Flags);
- o.init_member("getNewTextFormat",
- gl->createFunction(textfield_getNewTextFormat), swf6Flags);
- o.init_member("getNewTextFormat",
- gl->createFunction(textfield_getNewTextFormat), swf6Flags);
- o.init_member("getDepth",
- gl->createFunction(textfield_getDepth), swf6Flags);
- o.init_member("removeTextField",
- gl->createFunction(textfield_removeTextField), swf6Flags);
- o.init_member("replaceSel",
- gl->createFunction(textfield_replaceSel), swf6Flags);
+ VM& vm = getVM(o);
+ o.init_member("replaceSel", vm.getNative(104, 100), swf6Flags);
+ o.init_member("getTextFormat", vm.getNative(104, 101), swf6Flags);
+ o.init_member("setTextFormat", vm.getNative(104, 102), swf6Flags);
+ o.init_member("removeTextField", vm.getNative(104, 103), swf6Flags);
+ o.init_member("getNewTextFormat", vm.getNative(104, 104), swf6Flags);
+ o.init_member("setNewTextFormat",vm.getNative(104, 105), swf6Flags);
+ o.init_member("getDepth", vm.getNative(104, 106), swf6Flags);
// SWF7 or higher
- const int swf7Flags = flags | PropFlags::onlySWF7Up;
+ const int swf7Flags = as_object::DefaultFlags | PropFlags::onlySWF7Up;
- o.init_member("replaceText",
- gl->createFunction(textfield_replaceText), swf7Flags);
+ o.init_member("replaceText",vm.getNative(104, 107), swf7Flags);
}
=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h 2009-08-21 21:19:40 +0000
+++ b/libcore/TextField.h 2009-08-27 05:46:44 +0000
@@ -873,6 +873,8 @@
/// Initialize the global TextField class
void textfield_class_init(as_object& global, const ObjectURI& uri);
+void registerTextFieldNative(as_object& global);
+
} // namespace gnash
#endif
=== modified file 'libcore/Video.cpp'
--- a/libcore/Video.cpp 2009-08-26 12:15:53 +0000
+++ b/libcore/Video.cpp 2009-08-27 10:47:30 +0000
@@ -23,7 +23,7 @@
#include "DefineVideoStreamTag.h"
#include "fn_call.h"
#include "as_value.h"
-#include "NetStream_as.h"
+#include "flash/net/NetStream_as.h"
#include "Range2d.h"
#include "builtin_function.h" // for getter/setter properties
#include "NativeFunction.h"
=== modified file 'libcore/asobj/Boolean_as.cpp'
--- a/libcore/asobj/Boolean_as.cpp 2009-08-21 07:28:09 +0000
+++ b/libcore/asobj/Boolean_as.cpp 2009-08-27 06:30:46 +0000
@@ -68,7 +68,7 @@
VM& vm = getVM(where);
Global_as* gl = getGlobal(where);
- as_object* proto = gl->createObject(getObjectInterface());
+ as_object* proto = gl->createObject();
as_object* cl = vm.getNative(107, 2);
cl->init_member(NSV::PROP_PROTOTYPE, proto);
proto->init_member(NSV::PROP_CONSTRUCTOR, cl);
=== modified file 'libcore/asobj/Color_as.cpp'
--- a/libcore/asobj/Color_as.cpp 2009-08-20 09:36:50 +0000
+++ b/libcore/asobj/Color_as.cpp 2009-08-27 06:40:41 +0000
@@ -133,8 +133,7 @@
// Convert to as_object
Global_as* gl = getGlobal(fn);
- as_object* proto = getObjectInterface();
- as_object* ret = gl->createObject(proto);
+ as_object* ret = gl->createObject();
ret->init_member("ra", double(cx.ra / 2.56));
ret->init_member("ga", double(cx.ga / 2.56));
=== modified file 'libcore/asobj/Date_as.cpp'
--- a/libcore/asobj/Date_as.cpp 2009-08-21 07:07:11 +0000
+++ b/libcore/asobj/Date_as.cpp 2009-08-27 06:30:46 +0000
@@ -210,7 +210,7 @@
{
Global_as* gl = getGlobal(global);
- as_object* proto = gl->createObject(getObjectInterface());
+ as_object* proto = gl->createObject();
as_object* cl = gl->createClass(&date_new, proto);
attachDateInterface(*proto);
=== modified file 'libcore/asobj/Global_as.h'
--- a/libcore/asobj/Global_as.h 2009-08-20 09:18:07 +0000
+++ b/libcore/asobj/Global_as.h 2009-08-27 06:30:05 +0000
@@ -61,15 +61,38 @@
/// an object (the prototype) with a constructor.
virtual as_object* createClass(ASFunction ctor, as_object* prototype) = 0;
+ /// Create a String object
+ //
+ /// This calls the String constructor. If that has been changed, this
+ /// function may not produce a String object. This is generally
+ /// expected behaviour.
virtual as_object* createString(const std::string& s) = 0;
+ /// Create a Number object
+ //
+ /// This calls the Number constructor. If that has been changed, this
+ /// function may not produce a Number object. This is generally
+ /// expected behaviour.
virtual as_object* createNumber(double d) = 0;
+ /// Create a Boolean object
+ //
+ /// This calls the Boolean constructor. If that has been changed, this
+ /// function may not produce a Boolean object. This is generally
+ /// expected behaviour.
virtual as_object* createBoolean(bool b) = 0;
+ /// Create an Object
+ //
+ /// This function returns an Object with Object.prototype as its
+ /// __proto__ member. It should probably call the Object constructor,
+ /// but Gnash creates some of its classes on demand. If the Object class
+ /// has changed before this happens, Gnash's behaviour would differ from
+ /// the reference player's.
+ //
+ /// TODO: think whether it's better to return the original Object class,
+ /// a possibly altered one, or allow both.
virtual as_object* createObject() = 0;
-
- virtual as_object* createObject(as_object* prototype) = 0;
virtual Global_as& global() {
return *this;
@@ -102,8 +125,7 @@
// This is going to be the global Mouse "class"/"function"
Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* obj = gl->createObject(proto);
+ as_object* obj = gl->createObject();
if (p) p(*obj);
where.init_member(getName(uri), obj, as_object::DefaultFlags,
@@ -134,7 +156,7 @@
Properties p, Properties c, const ObjectURI& uri)
{
Global_as* gl = getGlobal(where);
- as_object* proto = gl->createObject(getObjectInterface());
+ as_object* proto = gl->createObject();
as_object* cl = gl->createClass(ctor, proto);
// Attach class properties to class
=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-08-26 14:29:24 +0000
+++ b/libcore/asobj/Globals.cpp 2009-08-27 10:47:30 +0000
@@ -57,9 +57,12 @@
#include "flash/events/Event_as.h"
#include "flash/events/EventDispatcher_as.h"
#include "flash/filters/BitmapFilter_as.h"
+#include "flash/geom/ColorTransform_as.h"
#include "flash/net/LocalConnection_as.h"
#include "flash/net/XMLSocket_as.h"
#include "flash/net/SharedObject_as.h"
+#include "flash/net/NetConnection_as.h"
+#include "flash/net/NetStream_as.h"
#include "flash/system/System_as.h"
#include "flash/text/TextSnapshot_as.h"
#include "flash/text/TextFieldAutoSize_as.h"
@@ -80,8 +83,6 @@
#include "flash/xml/XMLNode_as.h"
#include "MovieClipLoader.h"
#include "movie_definition.h"
-#include "NetConnection_as.h"
-#include "NetStream_as.h"
#include "TextFormat_as.h"
#include "Video.h"
#include "extension.h"
@@ -189,19 +190,13 @@
as_object*
AVM1Global::createObject()
{
- return new as_object;
+ return new as_object(getObjectInterface());
}
-as_object*
-AVM1Global::createObject(as_object* prototype)
-{
- return new as_object(prototype);
-}
-
builtin_function*
AVM1Global::createFunction(Global_as::ASFunction function)
{
- as_object* proto = createObject(getObjectInterface());
+ as_object* proto = createObject();
builtin_function* f = new builtin_function(*this, function, proto);
f->init_member(NSV::PROP_CONSTRUCTOR,
as_function::getFunctionConstructor());
@@ -245,13 +240,7 @@
as_object*
AVM2Global::createObject()
{
- return new as_object;
-}
-
-as_object*
-AVM2Global::createObject(as_object* prototype)
-{
- return new as_object(prototype);
+ return new as_object(getObjectInterface());
}
builtin_function*
@@ -444,7 +433,7 @@
(N(math_class_init, NSV::CLASS_MATH, 0, NS_GLOBAL, 4))
(N(boolean_class_init, NSV::CLASS_BOOLEAN, NSV::CLASS_OBJECT,
NS_GLOBAL, 5))
- (N(Button::init, NSV::CLASS_BUTTON, NSV::CLASS_OBJECT,
+ (N(button_class_init, NSV::CLASS_BUTTON, NSV::CLASS_OBJECT,
NS_GLOBAL, 5))
(N(color_class_init, NSV::CLASS_COLOR, NSV::CLASS_OBJECT,
NS_GLOBAL, 5))
@@ -462,7 +451,7 @@
(N(mouse_class_init, NSV::CLASS_MOUSE, NSV::CLASS_OBJECT, NS_GLOBAL,
5))
(N(number_class_init, NSV::CLASS_NUMBER, NSV::CLASS_OBJECT,
NS_GLOBAL, 5))
- (N(TextFormat_as::init, NSV::CLASS_TEXT_FORMAT, NSV::CLASS_OBJECT,
+ (N(textformat_class_init, NSV::CLASS_TEXT_FORMAT, NSV::CLASS_OBJECT,
NS_GLOBAL, 5))
(N(Keyboard_as::init, NSV::CLASS_KEY, NSV::CLASS_OBJECT, NS_GLOBAL, 5))
(N(AsBroadcaster::init, NSV::CLASS_AS_BROADCASTER, NSV::CLASS_OBJECT,
@@ -545,13 +534,13 @@
NSV::NS_FLASH_DISPLAY, 3))
(N(stage_class_init, NSV::CLASS_STAGE, NSV::CLASS_MOVIE_CLIP,
NSV::NS_FLASH_DISPLAY, 1))
- (N(Button::init, st.find("SimpleButton"), NSV::CLASS_INTERACTIVEOBJECT,
- NSV::NS_FLASH_DISPLAY, 5))
+ (N(button_class_init, st.find("SimpleButton"),
+ NSV::CLASS_INTERACTIVEOBJECT, NSV::NS_FLASH_DISPLAY, 5))
// Text classes
(N(textfield_class_init, NSV::CLASS_TEXT_FIELD,
NSV::CLASS_INTERACTIVEOBJECT, NSV::NS_FLASH_TEXT, 3))
- (N(TextFormat_as::init, NSV::CLASS_TEXT_FORMAT, NSV::CLASS_OBJECT,
+ (N(textformat_class_init, NSV::CLASS_TEXT_FORMAT, NSV::CLASS_OBJECT,
NSV::NS_FLASH_TEXT, 5))
(N(TextSnapshot_as::init, NSV::CLASS_TEXT_SNAPSHOT, NSV::CLASS_OBJECT,
NSV::NS_FLASH_TEXT, 5))
@@ -945,8 +934,7 @@
}
Global_as* gl = getGlobal(fn);
- as_object* proto = getObjectInterface();
- fun->init_member(NSV::PROP_PROTOTYPE, gl->createObject(proto));
+ fun->init_member(NSV::PROP_PROTOTYPE, gl->createObject());
return as_value(fun);
@@ -1027,7 +1015,8 @@
if (major < 0) return as_value();
const std::string& props = fn.arg(2).to_string();
- const int minor = fn.nargs > 3 ? std::max(fn.arg(3).to_int(),
(boost::int32_t)0) : 0;
+ const int minor =
+ fn.nargs > 3 ? std::max<boost::int32_t>(fn.arg(3).to_int(), 0) : 0;
std::string::const_iterator pos = props.begin();
@@ -1078,11 +1067,75 @@
return as_value();
}
-// ASSetNativeAccessor function
-// TODO: find dox
+// This is like ASSetNative, but attaches getter/setters.
as_value
-global_assetnativeaccessor(const fn_call& /*fn*/)
+global_assetnativeaccessor(const fn_call& fn)
{
+ if (fn.nargs < 3) {
+ return as_value();
+ }
+
+ Global_as* gl = getGlobal(fn);
+
+ as_object* targetObject = fn.arg(0).to_object(*gl).get();
+ if (!targetObject) {
+ return as_value();
+ }
+
+ const int major = fn.arg(1).to_int();
+ if (major < 0) return as_value();
+
+ const std::string& props = fn.arg(2).to_string();
+ const int minor =
+ fn.nargs > 3 ? std::max<boost::int32_t>(fn.arg(3).to_int(), 0) : 0;
+
+ std::string::const_iterator pos = props.begin();
+
+ VM& vm = getVM(fn);
+
+ size_t i = 0;
+
+ // pos is always the position after the last located property.
+ while (pos != props.end()) {
+
+ // If there are no further commas, find the end of the string.
+ std::string::const_iterator comma = std::find(pos, props.end(), ',');
+
+ const char num = *pos;
+
+ int flag;
+
+ switch (num) {
+ case '6':
+ flag = PropFlags::onlySWF6Up;
+ ++pos;
+ break;
+ case '7':
+ flag = PropFlags::onlySWF7Up;
+ ++pos;
+ break;
+ case '8':
+ flag = PropFlags::onlySWF8Up;
+ ++pos;
+ break;
+ case '9':
+ flag = PropFlags::onlySWF9Up;
+ ++pos;
+ break;
+ default:
+ flag = 0;
+
+ }
+ const std::string& property = std::string(pos, comma);
+ if (!property.empty()) {
+ NativeFunction* getset = vm.getNative(major, minor + i);
+ targetObject->init_property(property, *getset, *getset, flag);
+ }
+ if (comma == props.end()) break;
+ pos = comma + 1;
+ ++i;
+ }
+ return as_value();
LOG_ONCE(log_unimpl("ASSetNativeAccessor"));
return as_value();
}
@@ -1334,6 +1387,8 @@
registerSystemNative(global);
registerAccessibilityNative(global);
registerStageNative(global);
+ registerTextFieldNative(global);
+ registerButtonNative(global);
registerVideoNative(global);
registerXMLSocketNative(global);
registerSharedObjectNative(global);
@@ -1345,9 +1400,10 @@
registerSoundNative(global);
registerLocalConnectionNative(global);
registerBitmapFilterNative(global);
+ registerColorTransformNative(global);
AsBroadcaster::registerNative(global);
- TextFormat_as::registerNative(global);
+ registerTextFormatNative(global);
registerDateNative(global);
Mouse_as::registerNative(global);
=== modified file 'libcore/asobj/Globals.h'
--- a/libcore/asobj/Globals.h 2009-08-07 08:43:01 +0000
+++ b/libcore/asobj/Globals.h 2009-08-27 06:30:29 +0000
@@ -74,8 +74,6 @@
virtual as_object* createObject();
- virtual as_object* createObject(as_object* prototype);
-
virtual const ClassHierarchy& classHierarchy() const {
return _classes;
}
@@ -141,8 +139,6 @@
virtual as_object* createBoolean(bool b);
virtual as_object* createObject();
-
- virtual as_object* createObject(as_object* prototype);
virtual const ClassHierarchy& classHierarchy() const {
return _classes;
=== modified file 'libcore/asobj/Number_as.cpp'
--- a/libcore/asobj/Number_as.cpp 2009-08-21 07:28:09 +0000
+++ b/libcore/asobj/Number_as.cpp 2009-08-27 06:30:46 +0000
@@ -154,7 +154,7 @@
VM& vm = getVM(where);
Global_as* gl = getGlobal(where);
- as_object* proto = gl->createObject(getObjectInterface());
+ as_object* proto = gl->createObject();
as_object* cl = vm.getNative(106, 2);
cl->init_member(NSV::PROP_PROTOTYPE, proto);
proto->init_member(NSV::PROP_CONSTRUCTOR, cl);
=== modified file 'libcore/asobj/Object.cpp'
--- a/libcore/asobj/Object.cpp 2009-08-26 14:29:24 +0000
+++ b/libcore/asobj/Object.cpp 2009-08-27 06:41:27 +0000
@@ -167,7 +167,6 @@
object_ctor(const fn_call& fn)
{
Global_as* gl = getGlobal(fn);
- as_object* proto = getObjectInterface();
if (fn.nargs == 1) {
as_object* obj = fn.arg(0).to_object(*gl).get();
@@ -181,10 +180,10 @@
}
if (!fn.isInstantiation()) {
- return gl->createObject();
+ return new as_object();
}
- return gl->createObject(proto);
+ return gl->createObject();
}
/// Object.toString returns one of two values: [type Function] if it is a
=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp 2009-08-21 07:07:11 +0000
+++ b/libcore/asobj/String_as.cpp 2009-08-27 06:30:46 +0000
@@ -113,7 +113,7 @@
VM& vm = getVM(where);
Global_as* gl = getGlobal(where);
- as_object* proto = gl->createObject(getObjectInterface());
+ as_object* proto = gl->createObject();
as_object* cl = vm.getNative(251, 0);
cl->init_member(NSV::PROP_PROTOTYPE, proto);
proto->init_member(NSV::PROP_CONSTRUCTOR, cl);
=== modified file 'libcore/asobj/TextFormat_as.cpp'
--- a/libcore/asobj/TextFormat_as.cpp 2009-08-14 13:01:46 +0000
+++ b/libcore/asobj/TextFormat_as.cpp 2009-08-27 10:18:44 +0000
@@ -23,6 +23,7 @@
#include "fn_call.h"
#include "Global_as.h"
#include "builtin_function.h" // for getter/setter properties
+#include "NativeFunction.h" // for getter/setter properties
#include "namedStrings.h"
#include "VM.h"
#include "RGBA.h" // for rgba type
@@ -80,11 +81,14 @@
}
void
-TextFormat_as::registerNative(as_object& o)
+registerTextFormatNative(as_object& o)
{
VM& vm = getVM(o);
- //vm.registerNative(110, 0) // [_global] TextFormat
+ // TODO: find out native accessors for kerning, letterSpacing.
+ // TODO: these functions are probably split into getters and setters
+ // instead of one function for both. Needs testing.
+ vm.registerNative(textformat_new, 110, 0);
vm.registerNative(textformat_font, 110, 1);
vm.registerNative(textformat_font, 110, 2);
vm.registerNative(textformat_size, 110, 3);
@@ -118,12 +122,10 @@
vm.registerNative(textformat_bullet, 110, 31);
vm.registerNative(textformat_bullet, 110, 32);
vm.registerNative(textformat_getTextExtent, 110, 33);
-
}
TextFormat_as::TextFormat_as()
:
- as_object(getTextFormatInterface()),
_flags(0),
_underline(false),
_bold(false),
@@ -142,19 +144,17 @@
_target(),
_url()
{
- Global_as* gl = getGlobal(*this);
- init_member("getTextExtent",
gl->createFunction(textformat_getTextExtent));
}
// extern (used by Global.cpp)
void
-TextFormat_as::init(as_object& global, const ObjectURI& uri)
+textformat_class_init(as_object& global, const ObjectURI& uri)
{
Global_as* gl = getGlobal(global);
- as_object* proto = getTextFormatInterface();
+ as_object* proto = gl->createObject();;
as_object* cl = gl->createClass(&textformat_new, proto);
global.init_member(getName(uri), cl, as_object::DefaultFlags,
@@ -166,13 +166,21 @@
namespace {
/// new TextFormat([font, [size, [color, [bold, [italic, [underline, [url,
[target, [align,[leftMargin, [rightMargin, [indent, [leading]]]]]]]]]]]]])
+//
+/// This is a native function responsible for:
+/// 1. attaching properties to TextFormat.prototype
+/// 2. adding a getTextExtent member to the constructed object
+/// 3. attaching the TextFormat_as relay object.
+/// 4. setting the appropriate native properties of TextFormat_as
as_value
textformat_new(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> tf = new TextFormat_as;
-
- const unsigned int args = fn.nargs;
+ as_object* obj = ensureType<as_object>(fn.this_ptr).get();
+
+ std::auto_ptr<TextFormat_as> tf(new TextFormat_as);
+
+ const size_t args = fn.nargs;
switch (args)
{
@@ -214,27 +222,38 @@
break;
}
- return as_value(tf.get());
+ obj->setRelay(tf.release());
+ as_object* proto = obj->get_prototype().get();
+ if (proto) attachTextFormatInterface(*proto);
+
+ const int flags = 0;
+
+ // This is a weird function with no children.
+ VM& vm = getVM(fn);
+ NativeFunction* gte = vm.getNative(110, 33);
+ gte->clearProperties();
+ obj->init_member("getTextExtent", gte, flags);
+
+ return as_value();
}
as_value
textformat_display(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->displayDefined() ) {
- ret.set_string(getDisplayString(ptr->display()));
+ if ( relay->displayDefined() ) {
+ ret.set_string(getDisplayString(relay->display()));
}
else ret.set_null();
}
else // setter
{
- ptr->displaySet(fn.arg(0).to_string());
+ relay->displaySet(fn.arg(0).to_string());
}
return ret;
@@ -243,19 +262,19 @@
as_value
textformat_bullet(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->bulletDefined() ) ret.set_bool(ptr->bullet());
+ if ( relay->bulletDefined() ) ret.set_bool(relay->bullet());
else ret.set_null();
}
else // setter
{
// Boolean
- ptr->bulletSet(fn.arg(0).to_bool());
+ relay->bulletSet(fn.arg(0).to_bool());
}
return ret;
@@ -264,7 +283,7 @@
as_value
textformat_tabStops(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
@@ -274,8 +293,10 @@
return ret;
}
- boost::intrusive_ptr<Array_as> tStops =
- ensureType<Array_as>(fn.arg(0).to_object(*getGlobal(fn)));
+ as_object* arg = fn.arg(0).to_object(*getGlobal(fn)).get();
+ Array_as* tStops = dynamic_cast<Array_as*>(arg);
+
+ if (!tStops) return as_value();
std::vector<int> tabStops(tStops->size());
@@ -290,7 +311,7 @@
}
else // setter
{
- ptr->tabStopsSet(tabStops);
+ relay->tabStopsSet(tabStops);
}
return ret;
@@ -299,18 +320,20 @@
as_value
textformat_blockIndent(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->blockIndentDefined() )
ret.set_double(twipsToPixels(ptr->blockIndent()));
+ if (relay->blockIndentDefined()) {
+ ret.set_double(twipsToPixels(relay->blockIndent()));
+ }
else ret.set_null();
}
else // setter
{
- ptr->blockIndentSet(pixelsToTwips(fn.arg(0).to_int()));
+ relay->blockIndentSet(pixelsToTwips(fn.arg(0).to_int()));
}
return ret;
@@ -319,18 +342,18 @@
as_value
textformat_leading(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->leadingDefined() )
ret.set_double(twipsToPixels(ptr->leading()));
+ if ( relay->leadingDefined() )
ret.set_double(twipsToPixels(relay->leading()));
else ret.set_null();
}
else // setter
{
- ptr->leadingSet(pixelsToTwips(fn.arg(0).to_int()));
+ relay->leadingSet(pixelsToTwips(fn.arg(0).to_int()));
}
return ret;
@@ -339,18 +362,18 @@
as_value
textformat_indent(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->indentDefined() )
ret.set_double(twipsToPixels(ptr->indent()));
+ if ( relay->indentDefined() )
ret.set_double(twipsToPixels(relay->indent()));
else ret.set_null();
}
else // setter
{
- ptr->indentSet(pixelsToTwips(fn.arg(0).to_int()));
+ relay->indentSet(pixelsToTwips(fn.arg(0).to_int()));
}
return ret;
@@ -359,18 +382,18 @@
as_value
textformat_rightMargin(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->rightMarginDefined() )
ret.set_double(twipsToPixels(ptr->rightMargin()));
+ if ( relay->rightMarginDefined() )
ret.set_double(twipsToPixels(relay->rightMargin()));
else ret.set_null();
}
else // setter
{
- ptr->rightMarginSet(pixelsToTwips(fn.arg(0).to_int()));
+ relay->rightMarginSet(pixelsToTwips(fn.arg(0).to_int()));
}
return ret;
@@ -379,21 +402,20 @@
as_value
textformat_leftMargin(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if (ptr->leftMarginDefined()) {
- ret.set_double(twipsToPixels(ptr->leftMargin()));
+ if (relay->leftMarginDefined()) {
+ ret.set_double(twipsToPixels(relay->leftMargin()));
}
else ret.set_null();
}
else // setter
{
- ptr->leftMarginSet(pixelsToTwips(fn.arg(0).to_int()));
+ relay->leftMarginSet(pixelsToTwips(fn.arg(0).to_int()));
}
return ret;
@@ -402,21 +424,20 @@
as_value
textformat_align(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->alignDefined() ) {
- ret.set_string(getAlignString(ptr->align()));
+ if ( relay->alignDefined() ) {
+ ret.set_string(getAlignString(relay->align()));
}
else ret.set_null();
}
else // setter
{
- ptr->alignSet(fn.arg(0).to_string());
+ relay->alignSet(fn.arg(0).to_string());
}
return ret;
@@ -425,19 +446,18 @@
as_value
textformat_underline(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->underlinedDefined() ) ret.set_bool(ptr->underlined());
+ if ( relay->underlinedDefined() )
ret.set_bool(relay->underlined());
else ret.set_null();
}
else // setter
{
- ptr->underlinedSet(fn.arg(0).to_bool());
+ relay->underlinedSet(fn.arg(0).to_bool());
}
return ret;
@@ -446,19 +466,18 @@
as_value
textformat_italic(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->italicedDefined() ) ret.set_bool(ptr->italiced());
+ if ( relay->italicedDefined() ) ret.set_bool(relay->italiced());
else ret.set_null();
}
else // setter
{
- ptr->italicedSet(fn.arg(0).to_bool());
+ relay->italicedSet(fn.arg(0).to_bool());
}
return ret;
@@ -467,19 +486,18 @@
as_value
textformat_bold(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->boldDefined() ) ret.set_bool(ptr->bold());
+ if ( relay->boldDefined() ) ret.set_bool(relay->bold());
else ret.set_null();
}
else // setter
{
- ptr->boldSet(fn.arg(0).to_bool());
+ relay->boldSet(fn.arg(0).to_bool());
}
return ret;
@@ -488,19 +506,18 @@
as_value
textformat_target(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->targetDefined() ) ret.set_string(ptr->target());
+ if ( relay->targetDefined() ) ret.set_string(relay->target());
else ret.set_null();
}
else // setter
{
- ptr->targetSet(fn.arg(0).to_string());
+ relay->targetSet(fn.arg(0).to_string());
}
return ret;
@@ -509,19 +526,18 @@
as_value
textformat_url(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->urlDefined() ) ret.set_string(ptr->url());
+ if ( relay->urlDefined() ) ret.set_string(relay->url());
else ret.set_null();
}
else // setter
{
- ptr->urlSet(fn.arg(0).to_string());
+ relay->urlSet(fn.arg(0).to_string());
}
return ret;
@@ -530,21 +546,20 @@
as_value
textformat_color(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->colorDefined() )
ret.set_double(ptr->color().toRGB());
+ if ( relay->colorDefined() )
ret.set_double(relay->color().toRGB());
else ret.set_null();
}
else // setter
{
rgba newcolor;
newcolor.parseRGB(fn.arg(0).to_int());
- ptr->colorSet(newcolor);
+ relay->colorSet(newcolor);
}
return ret;
@@ -553,19 +568,18 @@
as_value
textformat_size(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->sizeDefined() )
ret.set_double(twipsToPixels(ptr->size()));
+ if ( relay->sizeDefined() )
ret.set_double(twipsToPixels(relay->size()));
else ret.set_null();
}
else // setter
{
- ptr->sizeSet(pixelsToTwips(fn.arg(0).to_int()));
+ relay->sizeSet(pixelsToTwips(fn.arg(0).to_int()));
}
return ret;
@@ -574,19 +588,18 @@
as_value
textformat_font(const fn_call& fn)
{
- boost::intrusive_ptr<TextFormat_as> ptr =
- ensureType<TextFormat_as>(fn.this_ptr);
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
as_value ret;
if ( fn.nargs == 0 ) // getter
{
- if ( ptr->fontDefined() ) ret.set_string(ptr->font());
+ if (relay->fontDefined()) ret.set_string(relay->font());
else ret.set_null();
}
else // setter
{
- ptr->fontSet(fn.arg(0).to_string());
+ relay->fontSet(fn.arg(0).to_string());
}
return ret;
@@ -594,8 +607,10 @@
as_value
-textformat_getTextExtent(const fn_call& /*fn*/)
+textformat_getTextExtent(const fn_call& fn)
{
+ TextFormat_as* relay = ensureNativeType<TextFormat_as>(fn.this_ptr);
+ UNUSED(relay);
LOG_ONCE( log_unimpl("TextFormat.getTextExtent") );
return as_value();
}
@@ -604,42 +619,63 @@
void
attachTextFormatInterface(as_object& o)
{
- int flags = 0; // for sure we want to enum, dunno about deleting yet
-
- o.init_property("display", textformat_display, textformat_display,
flags);
- o.init_property("bullet", textformat_bullet, textformat_bullet, flags);
- o.init_property("tabStops", textformat_tabStops,
- textformat_tabStops, flags);
- o.init_property("blockIndent", textformat_blockIndent,
- textformat_blockIndent, flags);
- o.init_property("leading", textformat_leading, textformat_leading,
flags);
- o.init_property("indent", textformat_indent, textformat_indent, flags);
- o.init_property("rightMargin", textformat_rightMargin,
- textformat_rightMargin, flags);
- o.init_property("leftMargin", textformat_leftMargin,
- textformat_leftMargin, flags);
- o.init_property("align", textformat_align, textformat_align, flags);
- o.init_property("underline", textformat_underline,
- textformat_underline, flags);
- o.init_property("italic", textformat_italic, textformat_italic, flags);
- o.init_property("bold", textformat_bold, textformat_bold, flags);
- o.init_property("target", textformat_target, textformat_target, flags);
- o.init_property("url", textformat_url, textformat_url, flags);
- o.init_property("color", textformat_color, textformat_color, flags);
- o.init_property("size", textformat_size, textformat_size, flags);
- o.init_property("font", textformat_font, textformat_font, flags);
-}
-
-as_object*
-getTextFormatInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if (!o) {
- o = new as_object(getObjectInterface());
- VM::get().addStatic(o.get());
- attachTextFormatInterface(*o);
- }
- return o.get();
+ int flags = 0;
+
+ NativeFunction* get;
+ NativeFunction* set;
+
+ VM& vm = getVM(o);
+
+ get = vm.getNative(110, 1);
+ set = vm.getNative(110, 2);
+ o.init_property("font", *get, *set, flags);
+ get = vm.getNative(110, 3);
+ set = vm.getNative(110, 4);
+ o.init_property("size", *get, *set, flags);
+ get = vm.getNative(110, 5);
+ set = vm.getNative(110, 6);
+ o.init_property("color", *get, *set, flags);
+ get = vm.getNative(110, 7);
+ set = vm.getNative(110, 8);
+ o.init_property("url", *get, *set, flags);
+ get = vm.getNative(110, 9);
+ set = vm.getNative(110, 10);
+ o.init_property("target", *get, *set, flags);
+ get = vm.getNative(110, 11);
+ set = vm.getNative(110, 12);
+ o.init_property("bold", *get, *set, flags);
+ get = vm.getNative(110, 13);
+ set = vm.getNative(110, 14);
+ o.init_property("italic", *get, *set, flags);
+ get = vm.getNative(110, 15);
+ set = vm.getNative(110, 16);
+ o.init_property("underline", *get, *set, flags);
+ get = vm.getNative(110, 17);
+ set = vm.getNative(110, 18);
+ o.init_property("align", *get, *set, flags);
+ get = vm.getNative(110, 19);
+ set = vm.getNative(110, 20);
+ o.init_property("leftMargin", *get, *set, flags);
+ get = vm.getNative(110, 21);
+ set = vm.getNative(110, 22);
+ o.init_property("rightMargin", *get, *set, flags);
+ get = vm.getNative(110, 23);
+ set = vm.getNative(110, 24);
+ o.init_property("indent", *get, *set, flags);
+ get = vm.getNative(110, 25);
+ set = vm.getNative(110, 26);
+ o.init_property("leading", *get, *set, flags);
+ get = vm.getNative(110, 27);
+ set = vm.getNative(110, 28);
+ o.init_property("blockIndent", *get, *set, flags);
+ get = vm.getNative(110, 29);
+ set = vm.getNative(110, 30);
+ o.init_property("tabStops", *get, *set, flags);
+ get = vm.getNative(110, 31);
+ set = vm.getNative(110, 32);
+ o.init_property("bullet", *get, *set, flags);
+
+ o.init_property("display", textformat_display, textformat_display, flags);
}
=== modified file 'libcore/asobj/TextFormat_as.h'
--- a/libcore/asobj/TextFormat_as.h 2009-07-28 08:20:12 +0000
+++ b/libcore/asobj/TextFormat_as.h 2009-08-27 10:18:44 +0000
@@ -21,26 +21,23 @@
#ifndef GNASH_TEXTFORMAT_H
#define GNASH_TEXTFORMAT_H
-#include "as_object.h" // for inheritance of TextFormat
-#include "TextField.h" // for TextAlignment enum
-#include "RGBA.h" // for rgba
-#include <boost/cstdint.hpp> // for boost::uint32_t
+#include "as_object.h"
+#include "TextField.h"
+#include "RGBA.h"
+
+#include <boost/cstdint.hpp>
#include <string>
namespace gnash {
-class TextFormat_as : public as_object
+/// TODO: SWF8 has two additional members: kerning and letterSpacing.
+class TextFormat_as : public Relay
{
public:
TextFormat_as();
~TextFormat_as() {}
- static void registerNative(as_object& global);
-
- /// Initialize the global Color class
- static void init(as_object& global, const ObjectURI& uri);
-
/// Return a Boolean value that indicates whether the text is
underlined.
bool underlined() const { return _underline; }
bool underlinedDefined() const { return _flags&DEFunderline; }
@@ -259,7 +256,11 @@
/// If url is an empty string, the text does not have a hyperlink
std::string _url;
};
-
+
+void textformat_class_init(as_object& global, const ObjectURI& uri);
+
+void registerTextFormatNative(as_object& global);
+
} // end of gnash namespace
#endif
=== modified file 'libcore/asobj/flash.am'
--- a/libcore/asobj/flash.am 2009-07-16 11:04:13 +0000
+++ b/libcore/asobj/flash.am 2009-08-27 10:35:23 +0000
@@ -37,8 +37,6 @@
asobj/int_as.cpp \
asobj/LoadVars_as.cpp \
asobj/Math_as.cpp \
- asobj/NetConnection_as.cpp \
- asobj/NetStream_as.cpp \
asobj/Number_as.cpp \
asobj/PlayHead.cpp \
asobj/Selection_as.cpp \
@@ -63,8 +61,6 @@
asobj/int_as.h \
asobj/LoadVars_as.h \
asobj/MovieClipLoader.h \
- asobj/NetConnection_as.h \
- asobj/NetStream_as.h \
asobj/Number_as.h \
asobj/PlayHead.h \
asobj/Selection_as.h \
=== modified file 'libcore/asobj/flash/accessibility/Accessibility_as.cpp'
--- a/libcore/asobj/flash/accessibility/Accessibility_as.cpp 2009-08-26
11:45:37 +0000
+++ b/libcore/asobj/flash/accessibility/Accessibility_as.cpp 2009-08-27
06:41:40 +0000
@@ -52,12 +52,11 @@
{
Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
const int flags = as_object::DefaultFlags | PropFlags::readOnly;
// This object has unusual properties.
- as_object* obj = gl->createObject(proto);
+ as_object* obj = gl->createObject();
obj->set_member_flags(NSV::PROP_uuPROTOuu, flags);
obj->init_member(NSV::PROP_CONSTRUCTOR, gl->getMember(NSV::CLASS_OBJECT),
flags);
=== modified file 'libcore/asobj/flash/display/MovieClip_as.cpp'
--- a/libcore/asobj/flash/display/MovieClip_as.cpp 2009-08-20 06:55:15
+0000
+++ b/libcore/asobj/flash/display/MovieClip_as.cpp 2009-08-27 10:47:30
+0000
@@ -26,7 +26,7 @@
#include "display/MovieClip_as.h"
#include "display/DisplayObjectContainer_as.h"
#include "display/BitmapData_as.h"
-#include "NetStream_as.h"
+#include "net/NetStream_as.h"
#include "movie_root.h"
#include "GnashNumeric.h"
#include "as_value.h"
@@ -640,18 +640,8 @@
return as_value();
}
- as_object* obj = fn.arg(0).to_object(*getGlobal(fn)).get();
- if ( ! obj )
- {
- std::stringstream ss; fn.dump_args(ss);
- // TODO: find out what to do here
- log_error("MovieClip.attachAudio(%s): first arg doesn't cast to "
- "an object", ss.str());
- return as_value();
- }
-
- NetStream_as* ns = dynamic_cast<NetStream_as*>(obj);
- if ( ! ns )
+ NetStream_as* ns;
+ if (!isNativeType(fn.arg(0).to_object(*getGlobal(fn)).get(), ns))
{
std::stringstream ss; fn.dump_args(ss);
// TODO: find out what to do here
=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.cpp'
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp 2009-08-18
10:05:43 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp 2009-08-27
06:30:46 +0000
@@ -323,7 +323,7 @@
{
log_debug("Loading flash.external.ExternalInterface class");
Global_as* gl = getGlobal(fn);
- as_object* proto = gl->createObject(getObjectInterface());
+ as_object* proto = gl->createObject();
as_object* cl = gl->createClass(&externalinterface_ctor, proto);
attachExternalInterfaceInterface(*proto);
=== modified file 'libcore/asobj/flash/geom/ColorTransform_as.cpp'
--- a/libcore/asobj/flash/geom/ColorTransform_as.cpp 2009-07-29 05:59:24
+0000
+++ b/libcore/asobj/flash/geom/ColorTransform_as.cpp 2009-08-27 08:15:33
+0000
@@ -27,8 +27,8 @@
#include "fn_call.h"
#include "Global_as.h"
#include "smart_ptr.h" // for boost intrusive_ptr
-#include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
+#include "builtin_function.h"
+#include "NativeFunction.h"
#include "Object.h" // for AS inheritance
#include "VM.h" // for addStatics
@@ -36,237 +36,250 @@
namespace gnash {
-static as_value ColorTransform_concat(const fn_call& fn);
-static as_value ColorTransform_toString(const fn_call& fn);
-static as_value ColorTransform_alphaMultiplier_getset(const fn_call& fn);
-static as_value ColorTransform_alphaOffset_getset(const fn_call& fn);
-static as_value ColorTransform_blueMultiplier_getset(const fn_call& fn);
-static as_value ColorTransform_blueOffset_getset(const fn_call& fn);
-static as_value ColorTransform_greenMultiplier_getset(const fn_call& fn);
-static as_value ColorTransform_greenOffset_getset(const fn_call& fn);
-static as_value ColorTransform_redMultiplier_getset(const fn_call& fn);
-static as_value ColorTransform_redOffset_getset(const fn_call& fn);
-static as_value ColorTransform_rgb_getset(const fn_call& fn);
-
-as_value ColorTransform_ctor(const fn_call& fn);
-
-
-static void
+namespace {
+
+ as_value colortransform_concat(const fn_call& fn);
+ as_value colortransform_toString(const fn_call& fn);
+ as_value colortransform_alphaMultiplier(const fn_call& fn);
+ as_value colortransform_alphaOffset(const fn_call& fn);
+ as_value colortransform_blueMultiplier(const fn_call& fn);
+ as_value colortransform_blueOffset(const fn_call& fn);
+ as_value colortransform_greenMultiplier(const fn_call& fn);
+ as_value colortransform_greenOffset(const fn_call& fn);
+ as_value colortransform_redMultiplier(const fn_call& fn);
+ as_value colortransform_redOffset(const fn_call& fn);
+ as_value colortransform_rgb(const fn_call& fn);
+ as_value colortransform_ctor(const fn_call& fn);
+
+ void attachColorTransformInterface(as_object& o);
+ as_value get_flash_geom_color_transform_constructor(const fn_call& fn);
+
+}
+
+
+
+ColorTransform_as::ColorTransform_as(double rm, double gm,
+ double bm, double am,
+ double ro, double go,
+ double bo, double ao)
+ :
+ _alphaMultiplier(am),
+ _alphaOffset(ao),
+ _blueMultiplier(bm),
+ _blueOffset(bo),
+ _greenMultiplier(gm),
+ _greenOffset(go),
+ _redMultiplier(rm),
+ _redOffset(ro)
+{
+}
+
+// extern
+void
+colortransform_class_init(as_object& where, const ObjectURI& uri)
+{
+ // TODO: this may not be correct, but it should be enumerable.
+ const int flags = 0;
+ where.init_destructive_property(getName(uri),
+ get_flash_geom_color_transform_constructor, flags,
+ getNamespace(uri));
+}
+
+void
+registerColorTransformNative(as_object& global)
+{
+ VM& vm = getVM(global);
+ vm.registerNative(colortransform_ctor, 1105, 0);
+ vm.registerNative(colortransform_concat, 1105, 1);
+ vm.registerNative(colortransform_alphaMultiplier, 1105, 101);
+ vm.registerNative(colortransform_redMultiplier, 1105, 102);
+ vm.registerNative(colortransform_greenMultiplier, 1105, 103);
+ vm.registerNative(colortransform_blueMultiplier, 1105, 104);
+ vm.registerNative(colortransform_alphaOffset, 1105, 105);
+ vm.registerNative(colortransform_redOffset, 1105, 106);
+ vm.registerNative(colortransform_greenOffset, 1105, 107);
+ vm.registerNative(colortransform_blueOffset, 1105, 108);
+ vm.registerNative(colortransform_rgb, 1105, 109);
+}
+
+namespace {
+
+void
attachColorTransformInterface(as_object& o)
{
- int flags = 0;
- /// This has no flags:
+ const int flags = 0;
+
+ /// These have no flags:
+ VM& vm = getVM(o);
+ o.init_member("concat", vm.getNative(1105, 1), flags);
Global_as* gl = getGlobal(o);
-
- o.init_member("concat", gl->createFunction(ColorTransform_concat), flags);
-
- flags = PropFlags::isProtected;
-
- /// These are all protected:
- o.init_member("toString", gl->createFunction(ColorTransform_toString),
+ o.init_member("toString", gl->createFunction(colortransform_toString),
flags);
- o.init_property("alphaMultiplier", ColorTransform_alphaMultiplier_getset,
- ColorTransform_alphaMultiplier_getset, flags);
- o.init_property("alphaOffset", ColorTransform_alphaOffset_getset,
- ColorTransform_alphaOffset_getset, flags);
- o.init_property("blueMultiplier", ColorTransform_blueMultiplier_getset,
- ColorTransform_blueMultiplier_getset, flags);
- o.init_property("blueOffset", ColorTransform_blueOffset_getset,
- ColorTransform_blueOffset_getset, flags);
- o.init_property("greenMultiplier", ColorTransform_greenMultiplier_getset,
- ColorTransform_greenMultiplier_getset, flags);
- o.init_property("greenOffset", ColorTransform_greenOffset_getset,
- ColorTransform_greenOffset_getset, flags);
- o.init_property("redMultiplier", ColorTransform_redMultiplier_getset,
- ColorTransform_redMultiplier_getset, flags);
- o.init_property("redOffset", ColorTransform_redOffset_getset,
- ColorTransform_redOffset_getset, flags);
- o.init_property("rgb", ColorTransform_rgb_getset,
- ColorTransform_rgb_getset, flags);
-}
-
-
-static as_object*
-getColorTransformInterface()
-{
- static boost::intrusive_ptr<as_object> o;
-
- if ( ! o )
- {
- // TODO: check if this class should inherit from Object
- // or from a different class
- o = new as_object(getObjectInterface());
- VM::get().addStatic(o.get());
-
- attachColorTransformInterface(*o);
-
- }
-
- return o.get();
-}
-
-
-static as_value
-ColorTransform_alphaMultiplier_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
-
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getAlphaMultiplier());
- }
-
- // Setter
- ptr->setAlphaMultiplier(fn.arg(0).to_number());
- return as_value();
-}
-
-static as_value
-ColorTransform_alphaOffset_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getAlphaOffset());
- }
-
- // Setter
- ptr->setAlphaOffset(fn.arg(0).to_number());
- return as_value();
-}
-
-static as_value
-ColorTransform_blueMultiplier_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getBlueMultiplier());
- }
-
- // Setter
- ptr->setBlueMultiplier(fn.arg(0).to_number());
- return as_value();
-}
-
-static as_value
-ColorTransform_blueOffset_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getBlueOffset());
- }
-
- // Setter
- ptr->setBlueOffset(fn.arg(0).to_number());
- return as_value();
-}
-
-static as_value
-ColorTransform_greenMultiplier_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getGreenMultiplier());
- }
-
- // Setter
- ptr->setGreenMultiplier(fn.arg(0).to_number());
- return as_value();
-}
-
-static as_value
-ColorTransform_greenOffset_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getGreenOffset());
- }
-
- // Setter
- ptr->setGreenOffset(fn.arg(0).to_number());
- return as_value();
-}
-
-static as_value
-ColorTransform_redMultiplier_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getRedMultiplier());
- }
-
- // Setter
- ptr->setRedMultiplier(fn.arg(0).to_number());
- return as_value();
-}
-
-static as_value
-ColorTransform_redOffset_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- if (!fn.nargs)
- {
- // Getter
- return as_value(ptr->getRedOffset());
- }
-
- // Setter
- ptr->setRedOffset(fn.arg(0).to_number());
- return as_value();
-}
-
-
-static as_value
-ColorTransform_concat(const fn_call& fn)
-{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
- UNUSED(ptr);
+ /// These all have SWF8 visibility
+ const int swf8 = PropFlags::onlySWF8Up;
+ NativeFunction* getset = vm.getNative(1105, 101);
+ o.init_property("alphaMultiplier", *getset, *getset, swf8);
+ getset = vm.getNative(1105, 102);
+ o.init_property("redMultiplier", *getset, *getset, swf8);
+ getset = vm.getNative(1105, 103);
+ o.init_property("greenMultiplier",*getset, *getset, swf8);
+ getset = vm.getNative(1105, 104);
+ o.init_property("blueMultiplier", *getset, *getset, swf8);
+ getset = vm.getNative(1105, 105);
+ o.init_property("alphaOffset", *getset, *getset, swf8);
+ getset = vm.getNative(1105, 106);
+ o.init_property("redOffset", *getset, *getset, swf8);
+ getset = vm.getNative(1105, 107);
+ o.init_property("greenOffset", *getset, *getset, swf8);
+ getset = vm.getNative(1105, 108);
+ o.init_property("blueOffset", *getset, *getset, swf8);
+ getset = vm.getNative(1105, 109);
+ o.init_property("rgb", *getset, *getset, swf8);
+}
+
+
+as_value
+colortransform_alphaMultiplier(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+
+ if (!fn.nargs) {
+ return as_value(relay->getAlphaMultiplier());
+ }
+
+ relay->setAlphaMultiplier(fn.arg(0).to_number());
+ return as_value();
+}
+
+as_value
+colortransform_alphaOffset(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+ if (!fn.nargs) {
+ return as_value(relay->getAlphaOffset());
+ }
+
+ relay->setAlphaOffset(fn.arg(0).to_number());
+ return as_value();
+}
+
+as_value
+colortransform_blueMultiplier(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+ if (!fn.nargs) {
+ return as_value(relay->getBlueMultiplier());
+ }
+
+ relay->setBlueMultiplier(fn.arg(0).to_number());
+ return as_value();
+}
+
+as_value
+colortransform_blueOffset(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+ if (!fn.nargs) {
+ return as_value(relay->getBlueOffset());
+ }
+
+ relay->setBlueOffset(fn.arg(0).to_number());
+ return as_value();
+}
+
+as_value
+colortransform_greenMultiplier(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+ if (!fn.nargs) {
+ return as_value(relay->getGreenMultiplier());
+ }
+
+ relay->setGreenMultiplier(fn.arg(0).to_number());
+ return as_value();
+}
+
+as_value
+colortransform_greenOffset(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+
+ if (!fn.nargs) {
+ return as_value(relay->getGreenOffset());
+ }
+
+ relay->setGreenOffset(fn.arg(0).to_number());
+ return as_value();
+}
+
+as_value
+colortransform_redMultiplier(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+
+ if (!fn.nargs) {
+ return as_value(relay->getRedMultiplier());
+ }
+
+ relay->setRedMultiplier(fn.arg(0).to_number());
+ return as_value();
+}
+
+as_value
+colortransform_redOffset(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+ if (!fn.nargs)
+ {
+ // Getter
+ return as_value(relay->getRedOffset());
+ }
+
+ // Setter
+ relay->setRedOffset(fn.arg(0).to_number());
+ return as_value();
+}
+
+
+as_value
+colortransform_concat(const fn_call& fn)
+{
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
+ UNUSED(relay);
LOG_ONCE( log_unimpl (__FUNCTION__) );
return as_value();
}
-static as_value
-ColorTransform_toString(const fn_call& fn)
+as_value
+colortransform_toString(const fn_call& fn)
{
- // Must be a ColorTransform
- boost::intrusive_ptr<ColorTransform_as> ptr =
- ensureType<ColorTransform_as>(fn.this_ptr);
-
- // We need the as_value to_string method, but using ptr->get_member
- // is unnecessary when we can read directly from the object.
- as_value alphaMultiplier(ptr->getAlphaMultiplier());
- as_value alphaOffset(ptr->getAlphaOffset());
- as_value blueMultiplier(ptr->getBlueMultiplier());
- as_value blueOffset(ptr->getBlueOffset());
- as_value greenMultiplier(ptr->getGreenMultiplier());
- as_value greenOffset(ptr->getGreenOffset());
- as_value redMultiplier(ptr->getRedMultiplier());
- as_value redOffset(ptr->getRedOffset());
+ as_object* ptr = ensureType<as_object>(fn.this_ptr).get();
+
+ string_table& st = getStringTable(fn);
+
+ const as_value& am = ptr->getMember(st.find("alphaMultiplier"));
+ const as_value& ao = ptr->getMember(st.find("alphaOffset"));
+ const as_value& bm = ptr->getMember(st.find("blueMultiplier"));
+ const as_value& bo = ptr->getMember(st.find("blueOffset"));
+ const as_value& gm = ptr->getMember(st.find("greenMultiplier"));
+ const as_value& go = ptr->getMember(st.find("greenOffset"));
+ const as_value& rm = ptr->getMember(st.find("redMultiplier"));
+ const as_value& ro = ptr->getMember(st.find("redOffset"));
std::ostringstream ss;
- ss << "(redMultiplier=" << redMultiplier.to_string() << ", "
- << "greenMultiplier=" << greenMultiplier.to_string() << ", "
- << "blueMultiplier=" << blueMultiplier.to_string() << ", "
- << "alphaMultiplier=" << alphaMultiplier.to_string() << ", "
- << "redOffset=" << redOffset.to_string() << ", "
- << "greenOffset=" << greenOffset.to_string() << ", "
- << "blueOffset=" << blueOffset.to_string() << ", "
- << "alphaOffset=" << alphaOffset.to_string() << ")";
+ const int version = getSWFVersion(fn);
+
+ ss << "(redMultiplier=" << rm.to_string_versioned(version) << ", "
+ << "greenMultiplier=" << gm.to_string_versioned(version) << ", "
+ << "blueMultiplier=" << bm.to_string_versioned(version) << ", "
+ << "alphaMultiplier=" << am.to_string_versioned(version) << ", "
+ << "redOffset=" << ro.to_string_versioned(version) << ", "
+ << "greenOffset=" << go.to_string_versioned(version) << ", "
+ << "blueOffset=" << bo.to_string_versioned(version) << ", "
+ << "alphaOffset=" << ao.to_string_versioned(version) << ")";
return as_value(ss.str());
@@ -277,17 +290,20 @@
// The getter merely bit-shifts the values without checking for
// validity. We fmod the double values to avoid undefined behaviour
// on overflow.
-static as_value
-ColorTransform_rgb_getset(const fn_call& fn)
+as_value
+colortransform_rgb(const fn_call& fn)
{
- boost::intrusive_ptr<ColorTransform_as> ptr =
ensureType<ColorTransform_as>(fn.this_ptr);
+ ColorTransform_as* relay =
ensureNativeType<ColorTransform_as>(fn.this_ptr);
if (!fn.nargs)
{
// Getter
- boost::uint32_t r =
static_cast<boost::uint32_t>(std::fmod(ptr->getRedOffset(), 4294967296.0));
- boost::uint32_t g =
static_cast<boost::uint32_t>(std::fmod(ptr->getGreenOffset(), 4294967296.0));
- boost::uint32_t b =
static_cast<boost::uint32_t>(std::fmod(ptr->getBlueOffset(), 4294967296.0));
+ boost::uint32_t r = static_cast<boost::uint32_t>(
+ std::fmod(relay->getRedOffset(), 4294967296.0));
+ boost::uint32_t g = static_cast<boost::uint32_t>(
+ std::fmod(relay->getGreenOffset(), 4294967296.0));
+ boost::uint32_t b = static_cast<boost::uint32_t>(
+ std::fmod(relay->getBlueOffset(), 4294967296.0));
boost::uint32_t rgb = (r << 16) + (g << 8) + b;
return as_value(rgb);
@@ -296,12 +312,12 @@
// Setter
boost::uint32_t rgb = fn.arg(0).to_int();
- ptr->setRedOffset((rgb & 0xFF0000) >> 16);
- ptr->setGreenOffset((rgb & 0x00FF00) >> 8);
- ptr->setBlueOffset(rgb & 0x0000FF);
- ptr->setRedMultiplier(0);
- ptr->setGreenMultiplier(0);
- ptr->setBlueMultiplier(0);
+ relay->setRedOffset((rgb & 0xFF0000) >> 16);
+ relay->setGreenOffset((rgb & 0x00FF00) >> 8);
+ relay->setBlueOffset(rgb & 0x0000FF);
+ relay->setRedMultiplier(0);
+ relay->setGreenMultiplier(0);
+ relay->setBlueMultiplier(0);
return as_value();
}
@@ -311,9 +327,11 @@
// There must be a minimum of 8 arguments, or the default values are
// used. Extra arguments are discarded.
as_value
-ColorTransform_ctor(const fn_call& fn)
+colortransform_ctor(const fn_call& fn)
{
+ as_object* obj = ensureType<as_object>(fn.this_ptr).get();
+
// Default arguments.
if (fn.nargs < 8)
{
@@ -324,10 +342,9 @@
"Constructing with default values", ss.str());
);
- boost::intrusive_ptr<as_object> obj =
- new ColorTransform_as(1, 1, 1, 1, 0, 0, 0, 0);
+ obj->setRelay(new ColorTransform_as(1, 1, 1, 1, 0, 0, 0, 0));
- return as_value(obj.get());
+ return as_value();
}
@@ -336,59 +353,35 @@
IF_VERBOSE_ASCODING_ERRORS(
std::ostringstream ss;
fn.dump_args(ss);
- log_aserror("ColorTransform(%s): discarding extra arguments",
ss.str());
+ log_aserror("ColorTransform(%s): discarding extra arguments",
+ ss.str());
);
}
- boost::intrusive_ptr<as_object> obj = new ColorTransform_as(
- fn.arg(0).to_number(),
- fn.arg(1).to_number(),
- fn.arg(2).to_number(),
- fn.arg(3).to_number(),
- fn.arg(4).to_number(),
- fn.arg(5).to_number(),
- fn.arg(6).to_number(),
- fn.arg(7).to_number());
+ obj->setRelay(new ColorTransform_as(fn.arg(0).to_number(),
+ fn.arg(1).to_number(),
+ fn.arg(2).to_number(),
+ fn.arg(3).to_number(),
+ fn.arg(4).to_number(),
+ fn.arg(5).to_number(),
+ fn.arg(6).to_number(),
+ fn.arg(7).to_number()));
- return as_value(obj.get());
+ return as_value();
}
-static as_value
+as_value
get_flash_geom_color_transform_constructor(const fn_call& fn)
{
log_debug("Loading flash.geom.ColorTransform class");
- as_object* proto = getColorTransformInterface();
Global_as* gl = getGlobal(fn);
- return gl->createClass(&ColorTransform_ctor, proto);
-}
-
-
-ColorTransform_as::ColorTransform_as(double rm, double gm,
- double bm, double am,
- double ro, double go,
- double bo, double ao)
- :
- as_object(getColorTransformInterface()),
- _alphaMultiplier(am),
- _alphaOffset(ao),
- _blueMultiplier(bm),
- _blueOffset(bo),
- _greenMultiplier(gm),
- _greenOffset(go),
- _redMultiplier(rm),
- _redOffset(ro)
-{
-}
-
-// extern
-void colortransform_class_init(as_object& where, const ObjectURI& uri)
-{
- // TODO: this may not be correct, but it should be enumerable.
- const int flags = 0;
- where.init_destructive_property(getName(uri),
- get_flash_geom_color_transform_constructor, flags,
- getNamespace(uri));
-}
+ as_object* proto = gl->createObject();
+ as_object* cl = gl->createClass(&colortransform_ctor, proto);
+ attachColorTransformInterface(*proto);
+ return cl;
+}
+
+} // anonymous namespace
} // end of gnash namespace
=== modified file 'libcore/asobj/flash/geom/ColorTransform_as.h'
--- a/libcore/asobj/flash/geom/ColorTransform_as.h 2009-07-28 11:58:27
+0000
+++ b/libcore/asobj/flash/geom/ColorTransform_as.h 2009-08-27 07:55:02
+0000
@@ -30,7 +30,7 @@
// This is used directly by flash.geom.Transform, as it is
// much more efficient than a pseudo-ActionScript implementation.
-class ColorTransform_as: public as_object
+class ColorTransform_as : public Relay
{
public:
@@ -38,7 +38,7 @@
ColorTransform_as(double rm, double gm, double bm, double am,
double ro, double go, double bo, double ao);
- // TODO: is all this really necessary? Tests show that the ColorTransform
+ // Tests show that the ColorTransform
// object has its own properties on initialization, so they have
// getter-setters and are *not* simple properties. Storing and
// manipulating as doubles (they cannot be anything else - see ctor) is
@@ -77,10 +77,11 @@
};
-
/// Initialize the global ColorTransform class
void colortransform_class_init(as_object& where, const ObjectURI& uri);
+void registerColorTransformNative(as_object& global);
+
} // end of gnash namespace
#endif
=== modified file 'libcore/asobj/flash/geom/Transform_as.cpp'
--- a/libcore/asobj/flash/geom/Transform_as.cpp 2009-08-20 06:55:15 +0000
+++ b/libcore/asobj/flash/geom/Transform_as.cpp 2009-08-27 07:55:02 +0000
@@ -174,10 +174,10 @@
// TODO: check whether this is necessary (probable),
// or whether it can be any object.
- boost::intrusive_ptr<ColorTransform_as> transform =
- dynamic_cast<ColorTransform_as*>(obj.get());
- if (!transform)
- {
+ ColorTransform_as* transform;
+
+ if (!isNativeType(obj.get(), transform)) {
+
IF_VERBOSE_ASCODING_ERRORS(
std::ostringstream ss;
fn.dump_args(ss);
=== modified file 'libcore/asobj/flash/geom/geom_pkg.cpp'
--- a/libcore/asobj/flash/geom/geom_pkg.cpp 2009-07-16 09:44:26 +0000
+++ b/libcore/asobj/flash/geom/geom_pkg.cpp 2009-08-27 07:04:35 +0000
@@ -17,7 +17,8 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#include "Object.h" // for getObjectInterface
+#include "Object.h"
+#include "Global_as.h"
#include "as_object.h"
#include "string_table.h"
#include "VM.h"
@@ -36,7 +37,9 @@
get_flash_geom_package(const fn_call& fn)
{
log_debug("Loading flash.geom package");
- as_object *pkg = new as_object(getObjectInterface());
+ Global_as* gl = getGlobal(fn);
+
+ as_object *pkg = gl->createObject();
string_table& st = getStringTable(fn);
const string_table::key global = 0;
=== renamed file 'libcore/asobj/NetConnection_as.cpp' =>
'libcore/asobj/flash/net/NetConnection_as.cpp'
--- a/libcore/asobj/NetConnection_as.cpp 2009-08-21 08:51:23 +0000
+++ b/libcore/asobj/flash/net/NetConnection_as.cpp 2009-08-27 10:35:23
+0000
@@ -736,7 +736,7 @@
getStatusCodeInfo(code, info);
/// This is a new normal object each time (see NetConnection.as)
- as_object* o = new as_object(getObjectInterface());
+ as_object* o = getGlobal(owner())->createObject();
const int flags = 0;
=== removed file 'libcore/asobj/flash/net/NetConnection_as.cpp'
--- a/libcore/asobj/flash/net/NetConnection_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/net/NetConnection_as.cpp 1970-01-01 00:00:00
+0000
@@ -1,194 +0,0 @@
-// NetConnection_as.cpp: ActionScript "NetConnection" class, for Gnash.
-//
-// Copyright (C) 2009 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 3 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
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include "net/NetConnection_as.h"
-#include "log.h"
-#include "fn_call.h"
-#include "Global_as.h"
-#include "smart_ptr.h" // for boost intrusive_ptr
-#include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
-
-namespace gnash {
-
-// Forward declarations
-namespace {
- as_value netconnection_call(const fn_call& fn);
- as_value netconnection_close(const fn_call& fn);
- as_value netconnection_connect(const fn_call& fn);
- as_value netconnection_asyncError(const fn_call& fn);
- as_value netconnection_ioError(const fn_call& fn);
- as_value netconnection_netStatus(const fn_call& fn);
- as_value netconnection_securityError(const fn_call& fn);
- as_value netconnection_ctor(const fn_call& fn);
- void attachNetConnectionInterface(as_object& o);
- void attachNetConnectionStaticInterface(as_object& o);
- as_object* getNetConnectionInterface();
-
-}
-
-class NetConnection_as : public as_object
-{
-
-public:
-
- NetConnection_as()
- :
- as_object(getNetConnectionInterface())
- {}
-};
-
-// extern (used by Global.cpp)
-void netconnection_class_init(as_object& where, const ObjectURI& uri)
-{
- static boost::intrusive_ptr<as_object> cl;
-
- if (!cl) {
- Global_as* gl = getGlobal(where);
- as_object* proto = getNetConnectionInterface();
- cl = gl->createClass(&netconnection_ctor, proto);
- attachNetConnectionStaticInterface(*cl);
- }
-
- // Register _global.NetConnection
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
-}
-
-namespace {
-
-void
-attachNetConnectionInterface(as_object& o)
-{
- Global_as* gl = getGlobal(o);
- o.init_member("call", gl->createFunction(netconnection_call));
- o.init_member("close", gl->createFunction(netconnection_close));
- o.init_member("connect", gl->createFunction(netconnection_connect));
- o.init_member("asyncError", gl->createFunction(netconnection_asyncError));
- o.init_member("ioError", gl->createFunction(netconnection_ioError));
- o.init_member("netStatus", gl->createFunction(netconnection_netStatus));
- o.init_member("securityError",
gl->createFunction(netconnection_securityError));
-}
-
-void
-attachNetConnectionStaticInterface(as_object& /*o*/)
-{
-}
-
-as_object*
-getNetConnectionInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachNetConnectionInterface(*o);
- }
- return o.get();
-}
-
-as_value
-netconnection_call(const fn_call& fn)
-{
- boost::intrusive_ptr<NetConnection_as> ptr =
- ensureType<NetConnection_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netconnection_close(const fn_call& fn)
-{
- boost::intrusive_ptr<NetConnection_as> ptr =
- ensureType<NetConnection_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netconnection_connect(const fn_call& fn)
-{
- boost::intrusive_ptr<NetConnection_as> ptr =
- ensureType<NetConnection_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netconnection_asyncError(const fn_call& fn)
-{
- boost::intrusive_ptr<NetConnection_as> ptr =
- ensureType<NetConnection_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netconnection_ioError(const fn_call& fn)
-{
- boost::intrusive_ptr<NetConnection_as> ptr =
- ensureType<NetConnection_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netconnection_netStatus(const fn_call& fn)
-{
- boost::intrusive_ptr<NetConnection_as> ptr =
- ensureType<NetConnection_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netconnection_securityError(const fn_call& fn)
-{
- boost::intrusive_ptr<NetConnection_as> ptr =
- ensureType<NetConnection_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netconnection_ctor(const fn_call& /*fn*/)
-{
- boost::intrusive_ptr<as_object> obj = new NetConnection_as;
-
- return as_value(obj.get()); // will keep alive
-}
-
-} // anonymous namespace
-} // gnash namespace
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-
=== renamed file 'libcore/asobj/NetConnection_as.h' =>
'libcore/asobj/flash/net/NetConnection_as.h'
=== removed file 'libcore/asobj/flash/net/NetConnection_as.h.stub'
--- a/libcore/asobj/flash/net/NetConnection_as.h.stub 2009-08-04 17:39:22
+0000
+++ b/libcore/asobj/flash/net/NetConnection_as.h.stub 1970-01-01 00:00:00
+0000
@@ -1,46 +0,0 @@
-// NetConnection_as.h: ActionScript 3 "NetConnection" class, for Gnash.
-//
-// Copyright (C) 2009 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 3 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_ASOBJ3_NETCONNECTION_H
-#define GNASH_ASOBJ3_NETCONNECTION_H
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-
-namespace gnash {
-
-// Forward declarations
-class as_object;
-class ObjectURI;
-
-/// Initialize the global NetConnection class
-void netconnection_class_init(as_object& where, const ObjectURI& uri);
-
-} // gnash namespace
-
-// GNASH_ASOBJ3_NETCONNECTION_H
-#endif
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-
=== renamed file 'libcore/asobj/NetStream_as.cpp' =>
'libcore/asobj/flash/net/NetStream_as.cpp'
--- a/libcore/asobj/NetStream_as.cpp 2009-08-21 07:09:32 +0000
+++ b/libcore/asobj/flash/net/NetStream_as.cpp 2009-08-27 10:35:23 +0000
@@ -272,7 +272,7 @@
// Enumerable and deletable.
const int flags = 0;
- as_object* o = new as_object(getObjectInterface());
+ as_object* o = getGlobal(owner())->createObject();
o->init_member("code", info.first, flags);
o->init_member("level", info.second, flags);
@@ -648,18 +648,6 @@
return video;
}
-#if 0 // TODO: check if the video is a cue point, if so, call
processNotify(onCuePoint, object..)
- // NOTE: should only be done for SWF>=8 ?
- if ( 1 ) // frame->isKeyFrame() )
- {
- as_object* infoObj = new as_object();
- string_table& st = getVM().getStringTable();
- infoObj->set_member(st.find("time"),
as_value(double(frame->timestamp())));
- infoObj->set_member(st.find("type"), as_value("navigation"));
- processNotify("onCuePoint", infoObj);
- }
-#endif
-
assert( _videoDecoder.get() );
// everything we push, we'll pop too..
=== removed file 'libcore/asobj/flash/net/NetStream_as.cpp'
--- a/libcore/asobj/flash/net/NetStream_as.cpp 2009-08-20 08:57:16 +0000
+++ b/libcore/asobj/flash/net/NetStream_as.cpp 1970-01-01 00:00:00 +0000
@@ -1,342 +0,0 @@
-// NetStream_as.cpp: ActionScript "NetStream" class, for Gnash.
-//
-// Copyright (C) 2009 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 3 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
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include "net/NetStream_as.h"
-#include "log.h"
-#include "fn_call.h"
-#include "Global_as.h"
-#include "smart_ptr.h" // for boost intrusive_ptr
-#include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
-
-namespace gnash {
-
-// Forward declarations
-namespace {
- as_value netstream_attachCamera(const fn_call& fn);
- as_value netstream_close(const fn_call& fn);
- as_value netstream_pause(const fn_call& fn);
- as_value netstream_play(const fn_call& fn);
- as_value netstream_publish(const fn_call& fn);
- as_value netstream_receiveAudio(const fn_call& fn);
- as_value netstream_receiveVideo(const fn_call& fn);
- as_value netstream_receiveVideoFPS(const fn_call& fn);
- as_value netstream_resume(const fn_call& fn);
- as_value netstream_seek(const fn_call& fn);
- as_value netstream_send(const fn_call& fn);
- as_value netstream_togglePause(const fn_call& fn);
- as_value netstream_asyncError(const fn_call& fn);
- as_value netstream_ioError(const fn_call& fn);
- as_value netstream_netStatus(const fn_call& fn);
- as_value netstream_onCuePoint(const fn_call& fn);
- as_value netstream_onImageData(const fn_call& fn);
- as_value netstream_onMetaData(const fn_call& fn);
- as_value netstream_onPlayStatus(const fn_call& fn);
- as_value netstream_onTextData(const fn_call& fn);
- as_value netstream_ctor(const fn_call& fn);
- void attachNetStreamInterface(as_object& o);
- void attachNetStreamStaticInterface(as_object& o);
- as_object* getNetStreamInterface();
-
-}
-
-class NetStream_as : public as_object
-{
-
-public:
-
- NetStream_as()
- :
- as_object(getNetStreamInterface())
- {}
-};
-
-// extern (used by Global.cpp)
-void
-netstream_class_init(as_object& where, const ObjectURI& uri)
-{
- registerBuiltinClass(where, netstream_ctor, attachNetStreamInterface,
- attachNetStreamStaticInterface, uri);
-}
-
-namespace {
-
-void
-attachNetStreamInterface(as_object& o)
-{
- o.init_member("attachCamera", gl->createFunction(netstream_attachCamera));
- o.init_member("close", gl->createFunction(netstream_close));
- o.init_member("pause", gl->createFunction(netstream_pause));
- o.init_member("play", gl->createFunction(netstream_play));
- o.init_member("publish", gl->createFunction(netstream_publish));
- o.init_member("receiveAudio", gl->createFunction(netstream_receiveAudio));
- o.init_member("receiveVideo", gl->createFunction(netstream_receiveVideo));
- o.init_member("receiveVideoFPS",
gl->createFunction(netstream_receiveVideoFPS));
- o.init_member("resume", gl->createFunction(netstream_resume));
- o.init_member("seek", gl->createFunction(netstream_seek));
- o.init_member("send", gl->createFunction(netstream_send));
- o.init_member("togglePause", gl->createFunction(netstream_togglePause));
- o.init_member("asyncError", gl->createFunction(netstream_asyncError));
- o.init_member("ioError", gl->createFunction(netstream_ioError));
- o.init_member("netStatus", gl->createFunction(netstream_netStatus));
- o.init_member("onCuePoint", gl->createFunction(netstream_onCuePoint));
- o.init_member("onImageData", gl->createFunction(netstream_onImageData));
- o.init_member("onMetaData", gl->createFunction(netstream_onMetaData));
- o.init_member("onPlayStatus", gl->createFunction(netstream_onPlayStatus));
- o.init_member("onTextData", gl->createFunction(netstream_onTextData));
-}
-
-void
-attachNetStreamStaticInterface(as_object& o)
-{
- Global_as* gl = getGlobal(o);
-
-}
-
-as_object*
-getNetStreamInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachNetStreamInterface(*o);
- }
- return o.get();
-}
-
-as_value
-netstream_attachCamera(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_close(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_pause(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_play(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_publish(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_receiveAudio(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_receiveVideo(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_receiveVideoFPS(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_resume(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_seek(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_send(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_togglePause(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_asyncError(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_ioError(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_netStatus(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_onCuePoint(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_onImageData(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_onMetaData(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_onPlayStatus(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_onTextData(const fn_call& fn)
-{
- boost::intrusive_ptr<NetStream_as> ptr =
- ensureType<NetStream_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-netstream_ctor(const fn_call& /*fn*/)
-{
- boost::intrusive_ptr<as_object> obj = new NetStream_as;
-
- return as_value(obj.get()); // will keep alive
-}
-
-} // anonymous namespace
-} // gnash namespace
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-
=== renamed file 'libcore/asobj/NetStream_as.h' =>
'libcore/asobj/flash/net/NetStream_as.h'
=== removed file 'libcore/asobj/flash/net/NetStream_as.h'
--- a/libcore/asobj/flash/net/NetStream_as.h 2009-07-28 11:58:27 +0000
+++ b/libcore/asobj/flash/net/NetStream_as.h 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-// NetStream_as.h: ActionScript 3 "NetStream" class, for Gnash.
-//
-// Copyright (C) 2009 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 3 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_ASOBJ3_NETSTREAM_H
-#define GNASH_ASOBJ3_NETSTREAM_H
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-
-namespace gnash {
-
-// Forward declarations
-class as_object;
-class ObjectURI;
-
-/// Initialize the global NetStream class
-void netstream_class_init(as_object& where, const ObjectURI& uri);
-
-} // gnash namespace
-
-// GNASH_ASOBJ3_NETSTREAM_H
-#endif
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-
=== modified file 'libcore/asobj/flash/net/URLRequestMethod_as.cpp'
--- a/libcore/asobj/flash/net/URLRequestMethod_as.cpp 2009-08-20 08:57:16
+0000
+++ b/libcore/asobj/flash/net/URLRequestMethod_as.cpp 2009-08-27 06:13:42
+0000
@@ -44,12 +44,6 @@
urlrequestmethod_class_init(as_object& where, const ObjectURI& uri)
{
registerBuiltinObject(where, attachURLRequestMethodStaticInterface, uri);
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachURLRequestMethodStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
}
namespace {
=== modified file 'libcore/asobj/flash/net/net.am'
--- a/libcore/asobj/flash/net/net.am 2009-08-04 03:05:56 +0000
+++ b/libcore/asobj/flash/net/net.am 2009-08-27 10:35:23 +0000
@@ -54,12 +54,12 @@
endif
if BUILD_NETCONNECTION_AS3
-# NET_SOURCES += asobj/flash/net/NetConnection_as.cpp
-#NET_HEADERS += asobj/flash/net/NetConnection_as.h
+NET_SOURCES += asobj/flash/net/NetConnection_as.cpp
+NET_HEADERS += asobj/flash/net/NetConnection_as.h
endif
if BUILD_NETSTREAM_AS3
-# NET_SOURCES += asobj/flash/net/NetStream_as.cpp
+NET_SOURCES += asobj/flash/net/NetStream_as.cpp
NET_HEADERS += asobj/flash/net/NetStream_as.h
endif
=== modified file 'libcore/asobj/flash/system/System_as.cpp'
--- a/libcore/asobj/flash/system/System_as.cpp 2009-08-18 06:49:40 +0000
+++ b/libcore/asobj/flash/system/System_as.cpp 2009-08-27 06:50:57 +0000
@@ -50,8 +50,8 @@
as_value system_showsettings(const fn_call& fn);
as_value system_exactsettings(const fn_call& fn);
as_value system_usecodepage(const fn_call& fn);
- as_object* getSystemSecurityInterface(as_object& o);
- as_object* getSystemCapabilitiesInterface(as_object& o);
+ void attachSystemSecurityInterface(as_object& o);
+ void attachSystemCapabilitiesInterface(as_object& o);
void attachSystemInterface(as_object& proto);
// AS3 functions.
@@ -67,14 +67,7 @@
void
system_class_init(as_object& where, const ObjectURI& uri)
{
- // _global.System is NOT a class, but a simple object, see System.as
-
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- boost::intrusive_ptr<as_object> obj = gl->createObject(proto);
- attachSystemInterface(*obj);
- where.init_member(getName(uri), obj.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachSystemInterface, uri);
}
@@ -127,30 +120,22 @@
namespace {
-as_object*
-getSystemSecurityInterface(as_object& o)
+void
+attachSystemSecurityInterface(as_object& o)
{
VM& vm = getVM(o);
-
- static boost::intrusive_ptr<as_object> proto;
- if ( proto == NULL )
- {
- proto = new as_object(getObjectInterface());
- proto->init_member("allowDomain", vm.getNative(12, 0));
-
- Global_as* gl = getGlobal(o);
- // TODO: only available when SWF >= 7
- proto->init_member("allowInsecureDomain",
- gl->createFunction(system_security_allowinsecuredomain));
-
- proto->init_member("loadPolicyFile",
- gl->createFunction(system_security_loadpolicyfile));
- }
- return proto.get();
+ o.init_member("allowDomain", vm.getNative(12, 0));
+
+ Global_as* gl = getGlobal(o);
+ // TODO: only available when SWF >= 7
+ o.init_member("allowInsecureDomain",
+ gl->createFunction(system_security_allowinsecuredomain));
+ o.init_member("loadPolicyFile",
+ gl->createFunction(system_security_loadpolicyfile));
}
-as_object*
-getSystemCapabilitiesInterface(as_object& o)
+void
+attachSystemCapabilitiesInterface(as_object& o)
{
RcInitFile& rcfile = RcInitFile::getDefaultInstance();
@@ -288,45 +273,38 @@
<< "&WD=" << trueFalse(windowlessDisable)
<< "&TLS=" << trueFalse(hasTLS);
- static boost::intrusive_ptr<as_object> proto;
- if ( proto == NULL )
- {
- const int flags = PropFlags::dontDelete
- | PropFlags::dontEnum
- | PropFlags::readOnly;
-
- proto = new as_object(getObjectInterface());
-
- proto->init_member("version", version, flags);
- proto->init_member("playerType", playerType, flags);
- proto->init_member("os", os, flags);
- proto->init_member("manufacturer", manufacturer, flags);
- proto->init_member("language", language, flags);
- proto->init_member("hasAudio", hasAudio, flags);
- proto->init_member("screenResolutionX", screenResolutionX,
flags);
- proto->init_member("screenResolutionY", screenResolutionY,
flags);
- proto->init_member("screenColor", screenColor, flags);
- proto->init_member("screenDPI", screenDPI, flags);
- proto->init_member("pixelAspectRatio", pixelAspectRatio, flags);
- proto->init_member("serverString", serverString.str(), flags);
- proto->init_member("avHardwareDisable", avHardwareDisable,
flags);
- proto->init_member("hasAudioEncoder", hasAudioEncoder, flags);
- proto->init_member("hasEmbeddedVideo", hasEmbeddedVideo, flags);
- proto->init_member("hasIME", hasIME, flags);
- proto->init_member("hasMP3", hasMP3, flags);
- proto->init_member("hasPrinting", hasPrinting, flags);
- proto->init_member("hasScreenBroadcast", hasScreenBroadcast,
flags);
- proto->init_member("hasScreenPlayback", hasScreenPlayback,
flags);
- proto->init_member("hasStreamingAudio", hasStreamingAudio,
flags);
- proto->init_member("hasStreamingVideo", hasStreamingVideo,
flags);
- proto->init_member("hasVideoEncoder", hasVideoEncoder, flags);
- proto->init_member("hasAccessibility", hasAccessibility, flags);
- proto->init_member("isDebugger", isDebugger, flags);
- proto->init_member("localFileReadDisable",
localFileReadDisable, flags);
- proto->init_member("hasTLS", hasTLS, flags);
- proto->init_member("windowlessDisable", windowlessDisable,
flags);
- }
- return proto.get();
+ const int flags = PropFlags::dontDelete
+ | PropFlags::dontEnum
+ | PropFlags::readOnly;
+
+ o.init_member("version", version, flags);
+ o.init_member("playerType", playerType, flags);
+ o.init_member("os", os, flags);
+ o.init_member("manufacturer", manufacturer, flags);
+ o.init_member("language", language, flags);
+ o.init_member("hasAudio", hasAudio, flags);
+ o.init_member("screenResolutionX", screenResolutionX, flags);
+ o.init_member("screenResolutionY", screenResolutionY, flags);
+ o.init_member("screenColor", screenColor, flags);
+ o.init_member("screenDPI", screenDPI, flags);
+ o.init_member("pixelAspectRatio", pixelAspectRatio, flags);
+ o.init_member("serverString", serverString.str(), flags);
+ o.init_member("avHardwareDisable", avHardwareDisable, flags);
+ o.init_member("hasAudioEncoder", hasAudioEncoder, flags);
+ o.init_member("hasEmbeddedVideo", hasEmbeddedVideo, flags);
+ o.init_member("hasIME", hasIME, flags);
+ o.init_member("hasMP3", hasMP3, flags);
+ o.init_member("hasPrinting", hasPrinting, flags);
+ o.init_member("hasScreenBroadcast", hasScreenBroadcast, flags);
+ o.init_member("hasScreenPlayback", hasScreenPlayback, flags);
+ o.init_member("hasStreamingAudio", hasStreamingAudio, flags);
+ o.init_member("hasStreamingVideo", hasStreamingVideo, flags);
+ o.init_member("hasVideoEncoder", hasVideoEncoder, flags);
+ o.init_member("hasAccessibility", hasAccessibility, flags);
+ o.init_member("isDebugger", isDebugger, flags);
+ o.init_member("localFileReadDisable", localFileReadDisable, flags);
+ o.init_member("hasTLS", hasTLS, flags);
+ o.init_member("windowlessDisable", windowlessDisable, flags);
}
/// Convert a string to the type passed in, making sure the target variable
@@ -335,23 +313,26 @@
inline void
convertValue(const std::string& in, T& val)
{
- val = T();
std::istringstream is(in);
- is >> val;
+ if (!(is >> val)) val = T();
}
void
attachSystemInterface(as_object& proto)
{
Global_as* gl = getGlobal(proto);
- VM& vm = getVM(proto);
-
- proto.init_member("security", getSystemSecurityInterface(proto));
- proto.init_member("capabilities",
getSystemCapabilitiesInterface(proto));
+
+ string_table& st = getStringTable(proto);
+ registerBuiltinObject(proto, attachSystemSecurityInterface,
+ ObjectURI(st.find("security"), 0));
+ registerBuiltinObject(proto, attachSystemCapabilitiesInterface,
+ ObjectURI(st.find("capabilities"), 0));
+
proto.init_member("setClipboard",
gl->createFunction(system_setClipboard));
+
+ VM& vm = getVM(proto);
proto.init_member("showSettings", vm.getNative(2107, 0));
-
proto.init_property("useCodepage", &system_usecodepage,
&system_usecodepage);
@@ -448,8 +429,7 @@
as_value
system_exactsettings(const fn_call& fn)
{
- static boost::intrusive_ptr<as_object> obj =
- ensureType<as_object>(fn.this_ptr);
+ boost::intrusive_ptr<as_object> obj =
ensureType<as_object>(fn.this_ptr);
// Getter
if (fn.nargs == 0)
=== modified file 'libcore/asobj/flash/text/TextFieldAutoSize_as.cpp'
--- a/libcore/asobj/flash/text/TextFieldAutoSize_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/text/TextFieldAutoSize_as.cpp 2009-08-27 06:13:42
+0000
@@ -38,13 +38,7 @@
void
textfieldautosize_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- boost::intrusive_ptr<as_object> obj = gl->createObject(proto);
-
- attachTextFieldAutoSizeInterface(*obj);
- where.init_member(getName(uri), obj.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachTextFieldAutoSizeInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/ui/ContextMenu_as.cpp'
--- a/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-08-20 09:11:27 +0000
+++ b/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-08-27 11:29:16 +0000
@@ -42,7 +42,7 @@
as_value contextmenu_ctor(const fn_call& fn);
void attachContextMenuInterface(as_object& o);
- as_object* setBuiltInItems();
+ void setBuiltInItems(as_object& o, bool setting);
}
@@ -91,7 +91,9 @@
{
boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
string_table& st = getStringTable(fn);
- as_object* builtIns = new as_object;
+
+ Global_as* gl = getGlobal(fn);
+ as_object* builtIns = gl->createObject();
setBuiltInItems(*builtIns, false);
ptr->set_member(st.find("builtInItems"), builtIns);
return as_value();
@@ -155,7 +157,8 @@
obj->set_member(NSV::PROP_ON_SELECT, callback);
string_table& st = getStringTable(fn);
- as_object* builtInItems = new as_object;
+ Global_as* gl = getGlobal(fn);
+ as_object* builtInItems = gl->createObject();
setBuiltInItems(*builtInItems, true);
obj->set_member(st.find("builtInItems"), builtInItems);
=== modified file 'libcore/asobj/flash/xml/XMLDocument_as.cpp'
--- a/libcore/asobj/flash/xml/XMLDocument_as.cpp 2009-08-26 07:58:52
+0000
+++ b/libcore/asobj/flash/xml/XMLDocument_as.cpp 2009-08-26 15:09:48
+0000
@@ -551,8 +551,9 @@
return val.to_bool();
}
-
-// extern (used by Global.cpp)
+// TODO: XML.prototype is assigned after the class has been constructed, so it
+// replaces the original prototype and does not have a 'constructor'
+// property.
void
XMLDocument_as::init(as_object& where, const ObjectURI& uri)
{
@@ -571,9 +572,9 @@
{
VM& vm = getVM(where);
vm.registerNative(xml_escape, 100, 5);
- vm.registerNative(xml_createElement, 253, 8);
- vm.registerNative(xml_createTextNode, 253, 9);
- vm.registerNative(xml_parseXML, 253, 10);
+ vm.registerNative(xml_createElement, 253, 10);
+ vm.registerNative(xml_createTextNode, 253, 11);
+ vm.registerNative(xml_parseXML, 253, 12);
}
namespace {
@@ -604,14 +605,14 @@
// No flags:
o.init_member("addRequestHeader", gl->createFunction(
LoadableObject::loadableobject_addRequestHeader), flags);
- o.init_member("createElement", vm.getNative(253, 8), flags);
- o.init_member("createTextNode", vm.getNative(253, 9), flags);
+ o.init_member("createElement", vm.getNative(253, 10), flags);
+ o.init_member("createTextNode", vm.getNative(253, 11), flags);
o.init_member("getBytesLoaded", gl->createFunction(
LoadableObject::loadableobject_getBytesLoaded), flags);
o.init_member("getBytesTotal", gl->createFunction(
LoadableObject::loadableobject_getBytesTotal), flags);
o.init_member("load", vm.getNative(301, 0), flags);
- o.init_member("parseXML", vm.getNative(253, 10), flags);
+ o.init_member("parseXML", vm.getNative(253, 12), flags);
o.init_member("send", vm.getNative(301, 1), flags);
o.init_member("sendAndLoad", vm.getNative(301, 2), flags);
o.init_member("onData", gl->createFunction(xml_onData), flags);
=== modified file 'libcore/asobj/flash/xml/XMLNode_as.cpp'
--- a/libcore/asobj/flash/xml/XMLNode_as.cpp 2009-08-21 08:41:59 +0000
+++ b/libcore/asobj/flash/xml/XMLNode_as.cpp 2009-08-27 06:01:23 +0000
@@ -430,10 +430,26 @@
vm.registerNative(xmlnode_appendChild, 253, 4);
vm.registerNative(xmlnode_hasChildNodes, 253, 5);
vm.registerNative(xmlnode_toString, 253, 6);
-}
+ vm.registerNative(xmlnode_getNamespaceForPrefix, 253, 7);
+ vm.registerNative(xmlnode_getPrefixForNamespace, 253, 8);
+}
+
+void
+XMLNode_as::init(as_object& where, const ObjectURI& uri)
+{
+ Global_as* gl = getGlobal(where);
+ as_object* proto = getXMLNodeInterface();
+ as_object* cl = gl->createClass(&xmlnode_new, proto);
+
+ where.init_member(getName(uri), cl, as_object::DefaultFlags,
+ getNamespace(uri));
+
+}
+
+namespace {
as_object*
-XMLNode_as::getXMLNodeInterface()
+getXMLNodeInterface()
{
static boost::intrusive_ptr<as_object> o;
if ( o == NULL ) {
@@ -443,25 +459,10 @@
return o.get();
}
-void
-XMLNode_as::init(as_object& where, const ObjectURI& uri)
-{
- Global_as* gl = getGlobal(where);
- as_object* proto = getXMLNodeInterface();
- as_object* cl = gl->createClass(&xmlnode_new, proto);
-
- where.init_member(getName(uri), cl, as_object::DefaultFlags,
- getNamespace(uri));
-
-}
-
-namespace {
void
attachXMLNodeInterface(as_object& o)
{
- Global_as* gl = getGlobal(o);
- // These need to be full-featured AS functions (builtin_function)
VM& vm = getVM(o);
@@ -474,11 +475,8 @@
o.init_member("appendChild", vm.getNative(253, 4), noFlags);
o.init_member("hasChildNodes", vm.getNative(253, 5), noFlags);
o.init_member("toString", vm.getNative(253, 6), noFlags);
- o.init_member("getPrefixForNamespace", gl->createFunction(
- xmlnode_getPrefixForNamespace), noFlags);
- o.init_member("getNamespaceForPrefix", gl->createFunction(
- xmlnode_getNamespaceForPrefix), noFlags);
-
+ o.init_member("getNamespaceForPrefix", vm.getNative(253, 7), noFlags);
+ o.init_member("getPrefixForNamespace", vm.getNative(253, 8), noFlags);
const int protectedFlags = PropFlags::isProtected;
=== modified file 'libcore/asobj/flash/xml/XMLNode_as.h'
--- a/libcore/asobj/flash/xml/XMLNode_as.h 2009-07-28 11:58:27 +0000
+++ b/libcore/asobj/flash/xml/XMLNode_as.h 2009-08-27 06:01:23 +0000
@@ -34,7 +34,7 @@
#include <sstream>
namespace gnash {
-class XMLNode_as : public virtual as_object, boost::noncopyable
+class XMLNode_as : public virtual as_object
{
public:
@@ -60,9 +60,6 @@
// Initialize the global XMLNode class
static void init(as_object& where, const ObjectURI& uri);
- // Used by XML_as
- static as_object* getXMLNodeInterface();
-
/// Register ASnative methods
static void registerNative(as_object& where);
=== modified file 'libcore/swf/SetTabIndexTag.cpp'
--- a/libcore/swf/SetTabIndexTag.cpp 2009-07-27 20:30:40 +0000
+++ b/libcore/swf/SetTabIndexTag.cpp 2009-08-27 10:48:31 +0000
@@ -28,8 +28,8 @@
namespace SWF {
void
-SetTabIndexTag::loader(SWFStream& in, TagType tag, movie_definition& md,
- const RunResources& r)
+SetTabIndexTag::loader(SWFStream& in, TagType /*tag*/, movie_definition&
/*md*/,
+ const RunResources& /*r*/)
{
in.ensureBytes(2);
boost::uint16_t depth = in.read_u16();
@@ -40,6 +40,7 @@
in.ensureBytes(2);
boost::uint16_t tab_index = in.read_u16();
+ UNUSED(tab_index);
log_unimpl("SetTabIndexTag");
=== modified file 'libcore/swf_function.cpp'
--- a/libcore/swf_function.cpp 2009-08-20 06:55:15 +0000
+++ b/libcore/swf_function.cpp 2009-08-27 06:58:37 +0000
@@ -44,7 +44,7 @@
swf_function::swf_function(const action_buffer& ab, as_environment& env,
size_t start, const ScopeStack& scopeStack)
:
- as_function(*getGlobal(env), new as_object(getObjectInterface())),
+ as_function(*getGlobal(env), getGlobal(env)->createObject()),
m_action_buffer(ab),
m_env(env),
_scopeStack(scopeStack),
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-08-20 06:55:15 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-08-27 06:40:53 +0000
@@ -2935,8 +2935,7 @@
// TODO: see if this could call the ASnative function(101, 9).
Global_as* gl = getGlobal(env);
- as_object* proto = getObjectInterface();
- as_object* obj = gl->createObject(proto);
+ as_object* obj = gl->createObject();
obj->init_member(NSV::PROP_CONSTRUCTOR, gl->getMember(NSV::CLASS_OBJECT));
=== modified file 'libcore/vm/CallStack.cpp'
--- a/libcore/vm/CallStack.cpp 2009-07-16 12:56:51 +0000
+++ b/libcore/vm/CallStack.cpp 2009-08-27 06:21:01 +0000
@@ -24,7 +24,7 @@
CallFrame::CallFrame(as_function* funcPtr)
:
- locals(getGlobal(*funcPtr)->createObject()),
+ locals(new as_object),
func(funcPtr)
{
}
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2009-08-26 08:56:22 +0000
+++ b/libcore/vm/Machine.cpp 2009-08-27 06:30:46 +0000
@@ -1622,7 +1622,7 @@
/// NB: This builds an object from its properties, it's not a
constructor.
case SWF::ABC_ACTION_NEWOBJECT:
{
- as_object *obj =
_global->createObject(getObjectInterface());
+ as_object *obj = _global->createObject();
boost::uint32_t argc = mStream->read_V32();
int i = argc;
while (i--)
=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING 2009-08-26 14:32:57 +0000
+++ b/testsuite/swfdec/PASSING 2009-08-27 10:25:55 +0000
@@ -184,10 +184,19 @@
color-setTransform-full.swf:7a8e59cef9592c4546f07fb9f391c61a
color-setTransform-negative.swf:0bc0510c35fc5c82de31b0db887fe535
color-transform-concat-5.swf:92f467ed0cee02fbc9618a17c382ef3b
+color-transform-concat-6.swf:10677612a1795de193f9a8a7b99eaaa5
+color-transform-concat-7.swf:df14e747698a6513f73990f6726944b0
+color-transform-construct-6.swf:ce54eb919f4069cd3ab70f84bfd31670
+color-transform-construct-7.swf:7c50d7d221a731c2296789f434b718e4
color-transform-construct-8.swf:d68ee06d60eb6612648365ab75f6b794
+color-transform-multipliers-offsets-6.swf:39d6b281f35c71a689670546925bfd81
+color-transform-multipliers-offsets-7.swf:f8d2e159086669b8b3cfb212c183f64d
color-transform-multipliers-offsets-8.swf:6e4558a870ddbf941365171accb8cf18
color-transform-properties-5.swf:74bd1e74d40fd8741000366645b7c776
color-transform-properties-5.swf:7e620e53cb1e19d5793e3198e9f08993
+color-transform-properties-6.swf:3946bb0de3a610f1a690b43b1fe48f70
+color-transform-properties-7.swf:f1e3056a0a679136529e317550797e63
+color-transform-properties-8.swf:23fff32f746e8267cf86d464e52727df
comparisons-4.swf:e0bb89e492f3f35e51b1beb190935a14
comparisons-5.swf:d4dfeb4ec80ec1f5a7390eb699e269ee
comparisons-6.swf:5a7bf1ffb3a4dd23828d6e180f1871b0
@@ -1250,6 +1259,7 @@
text-field-type-of-8.swf:bac748e2b13ba9331c27f5ee45109ac4
textformat-init-5.swf:52dec30885359d5bdda450588076eb10
textformat-init-5.swf:d45b857148b96635af7d18855cb067ae
+textformat-properties-7.swf:390495b699f387f9647c8cf47afa2175
text-snapshot-properties-5.swf:caf502463913e8aa1959715f629b92aa
text-snapshot-properties-6.swf:b17d4634477fa1e2a5a095fba489d3ed
text-snapshot-properties-7.swf:48ce09024d43af945101025c62b9848a
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11443: Implement more classes with Relay objects, correct properties.,
Benjamin Wolsey <=