[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11432: Cleanups, reduce code duplic
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11432: Cleanups, reduce code duplication. |
Date: |
Thu, 20 Aug 2009 13:52:39 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11432 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-08-20 13:52:39 +0200
message:
Cleanups, reduce code duplication.
modified:
extensions/gtk2/gtkext.cpp
libcore/Property.cpp
libcore/Timers.cpp
libcore/as_function.cpp
libcore/as_function.h
libcore/as_object.cpp
libcore/as_value.cpp
libcore/asobj/Array_as.cpp
libcore/asobj/AsBroadcaster.cpp
libcore/asobj/Boolean_as.cpp
libcore/asobj/Color_as.cpp
libcore/asobj/Date_as.cpp
libcore/asobj/Error_as.cpp
libcore/asobj/Global_as.h
libcore/asobj/Globals.cpp
libcore/asobj/LoadVars_as.cpp
libcore/asobj/Number_as.cpp
libcore/asobj/Object.cpp
libcore/asobj/Selection_as.cpp
libcore/asobj/String_as.cpp
libcore/asobj/flash/display/AVM1Movie_as.cpp
libcore/asobj/flash/display/ActionScriptVersion_as.cpp
libcore/asobj/flash/display/BitmapData_as.cpp
libcore/asobj/flash/display/Bitmap_as.cpp
libcore/asobj/flash/display/BlendMode_as.cpp
libcore/asobj/flash/display/FrameLabel_as.cpp
libcore/asobj/flash/display/IBitmapDrawable_as.cpp
libcore/asobj/flash/display/InteractiveObject_as.cpp
libcore/asobj/flash/display/LineScaleMode_as.cpp
libcore/asobj/flash/display/Loader_as.cpp
libcore/asobj/flash/display/MorphShape_as.cpp
libcore/asobj/flash/display/MovieClip_as.cpp
libcore/asobj/flash/display/Scene_as.cpp
libcore/asobj/flash/display/Shape_as.cpp
libcore/asobj/flash/display/SimpleButton_as.cpp
libcore/asobj/flash/display/Sprite_as.cpp
libcore/asobj/flash/display/Stage_as.cpp
libcore/asobj/flash/errors/EOFError_as.cpp
libcore/asobj/flash/errors/IOError_as.cpp
libcore/asobj/flash/errors/IllegalOperationError_as.cpp
libcore/asobj/flash/errors/InvalidSWFError_as.cpp
libcore/asobj/flash/errors/MemoryError_as.cpp
libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp
libcore/asobj/flash/errors/StackOverflowError_as.cpp
libcore/asobj/flash/events/ActivityEvent_as.cpp
libcore/asobj/flash/events/AsyncErrorEvent_as.cpp
libcore/asobj/flash/events/ContextMenuEvent_as.cpp
libcore/asobj/flash/events/DataEvent_as.cpp
libcore/asobj/flash/events/ErrorEvent_as.cpp
libcore/asobj/flash/events/EventDispatcher_as.cpp
libcore/asobj/flash/events/EventPhase_as.cpp
libcore/asobj/flash/events/Event_as.cpp
libcore/asobj/flash/events/FocusEvent_as.cpp
libcore/asobj/flash/events/FullScreenEvent_as.cpp
libcore/asobj/flash/events/HTTPStatusEvent_as.cpp
libcore/asobj/flash/events/IEventDispatcher_as.cpp
libcore/asobj/flash/events/IMEEvent_as.cpp
libcore/asobj/flash/events/IOErrorEvent_as.cpp
libcore/asobj/flash/events/KeyboardEvent_as.cpp
libcore/asobj/flash/events/MouseEvent_as.cpp
libcore/asobj/flash/events/NetStatusEvent_as.cpp
libcore/asobj/flash/events/ProgressEvent_as.cpp
libcore/asobj/flash/events/SecurityErrorEvent_as.cpp
libcore/asobj/flash/events/StatusEvent_as.cpp
libcore/asobj/flash/events/SyncEvent_as.cpp
libcore/asobj/flash/events/TextEvent_as.cpp
libcore/asobj/flash/events/TimerEvent_as.cpp
libcore/asobj/flash/external/external_pkg.cpp
libcore/asobj/flash/filters/BitmapFilterType_as.cpp
libcore/asobj/flash/geom/Matrix_as.cpp
libcore/asobj/flash/geom/Rectangle_as.cpp
libcore/asobj/flash/geom/Transform_as.cpp
libcore/asobj/flash/media/ID3Info_as.cpp
libcore/asobj/flash/media/SoundChannel_as.cpp
libcore/asobj/flash/media/SoundLoaderContext_as.cpp
libcore/asobj/flash/media/SoundMixer_as.cpp
libcore/asobj/flash/media/SoundTransform_as.cpp
libcore/asobj/flash/media/Video_as.cpp
libcore/asobj/flash/media/media_as.cpp
libcore/asobj/flash/net/FileFilter_as.cpp
libcore/asobj/flash/net/FileReferenceList_as.cpp
libcore/asobj/flash/net/FileReference_as.cpp
libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp
libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp
libcore/asobj/flash/net/NetStream_as.cpp
libcore/asobj/flash/net/ObjectEncoding_as.cpp
libcore/asobj/flash/net/Responder_as.cpp
libcore/asobj/flash/net/SharedObjectFlushStatus_as.cpp
libcore/asobj/flash/net/URLLoaderDataFormat_as.cpp
libcore/asobj/flash/net/URLRequestHeader_as.cpp
libcore/asobj/flash/net/URLRequestMethod_as.cpp
libcore/asobj/flash/net/URLRequest_as.cpp
libcore/asobj/flash/net/URLStream_as.cpp
libcore/asobj/flash/net/URLVariables_as.cpp
libcore/asobj/flash/net/XMLSocket_as.cpp
libcore/asobj/flash/printing/PrintJobOptions_as.cpp
libcore/asobj/flash/printing/PrintJob_as.cpp
libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp
libcore/asobj/flash/sampler/NewObjectSample_as.cpp
libcore/asobj/flash/sampler/Sample_as.cpp
libcore/asobj/flash/sampler/StackFrame_as.cpp
libcore/asobj/flash/system/ApplicationDomain_as.cpp
libcore/asobj/flash/system/Capabilities_as.cpp
libcore/asobj/flash/system/IMEConversionMode_as.cpp
libcore/asobj/flash/system/IME_as.cpp
libcore/asobj/flash/system/LoaderContext_as.cpp
libcore/asobj/flash/system/SecurityDomain_as.cpp
libcore/asobj/flash/system/SecurityPanel_as.cpp
libcore/asobj/flash/text/AntiAliasType_as.cpp
libcore/asobj/flash/text/CSMSettings_as.cpp
libcore/asobj/flash/text/FontStyle_as.cpp
libcore/asobj/flash/text/FontType_as.cpp
libcore/asobj/flash/text/Font_as.cpp
libcore/asobj/flash/text/GridFitType_as.cpp
libcore/asobj/flash/text/TextColorType_as.cpp
libcore/asobj/flash/text/TextDisplayMode_as.cpp
libcore/asobj/flash/text/TextFieldType_as.cpp
libcore/asobj/flash/text/TextField_as.cpp
libcore/asobj/flash/text/TextFormatAlign_as.cpp
libcore/asobj/flash/text/TextFormat_as.cpp
libcore/asobj/flash/text/TextLineMetrics_as.cpp
libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp
libcore/asobj/flash/ui/ContextMenuItem_as.cpp
libcore/asobj/flash/ui/ContextMenu_as.cpp
libcore/asobj/flash/ui/KeyLocation_as.cpp
libcore/asobj/flash/ui/Keyboard_as.cpp
libcore/asobj/flash/utils/ByteArray_as.cpp
libcore/asobj/flash/utils/Dictionary_as.cpp
libcore/asobj/flash/utils/Endian_as.cpp
libcore/asobj/flash/utils/IDataInput_as.cpp
libcore/asobj/flash/utils/IDataOutput_as.cpp
libcore/asobj/flash/utils/IExternalizable_as.cpp
libcore/asobj/flash/utils/Proxy_as.cpp
libcore/asobj/flash/utils/Timer_as.cpp
libcore/asobj/flash/xml/XMLDocument_as.cpp
libcore/asobj/flash/xml/XMLNodeType_as.cpp
libcore/swf_function.cpp
libcore/vm/ASHandlers.cpp
libcore/vm/Machine.cpp
libcore/vm/Machine.h
libcore/vm/action.cpp
libcore/vm/action.h
libcore/vm/fn_call.h
=== modified file 'extensions/gtk2/gtkext.cpp'
--- a/extensions/gtk2/gtkext.cpp 2009-07-29 06:12:26 +0000
+++ b/extensions/gtk2/gtkext.cpp 2009-08-20 06:55:15 +0000
@@ -107,10 +107,8 @@
as_value val;
as_environment env(VM::get());
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> );
- args->push_back(handler);
- args->push_back(event);
- args->push_back(handler);
+ fn_call::Args args;
+ args += handler, event, handler;
as_object obj = val.to_object(*getGlobal(fn));
=== modified file 'libcore/Property.cpp'
--- a/libcore/Property.cpp 2009-07-14 06:01:56 +0000
+++ b/libcore/Property.cpp 2009-08-20 06:55:15 +0000
@@ -52,8 +52,8 @@
as_environment env(getVM(this_ptr));
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
- args->push_back(value);
+ fn_call::Args args;
+ args += value;
fn_call fn(&this_ptr, env, args);
=== modified file 'libcore/Timers.cpp'
--- a/libcore/Timers.cpp 2009-07-14 06:01:56 +0000
+++ b/libcore/Timers.cpp 2009-08-20 06:55:15 +0000
@@ -153,8 +153,9 @@
as_environment env(vm);
// Copy args
- std::auto_ptr<std::vector<as_value> > args(
- new std::vector<as_value>(_args));
+ fn_call::Args::container_type argsCopy(_args);
+ fn_call::Args args;
+ args.swap(argsCopy);
call_method(timer_method, env, _object.get(), args, super);
=== modified file 'libcore/as_function.cpp'
--- a/libcore/as_function.cpp 2009-08-18 08:36:49 +0000
+++ b/libcore/as_function.cpp 2009-08-20 06:55:15 +0000
@@ -139,8 +139,7 @@
}
boost::intrusive_ptr<as_object>
-as_function::constructInstance(const as_environment& env,
- std::auto_ptr<std::vector<as_value> > args)
+as_function::constructInstance(const as_environment& env, fn_call::Args& args)
{
#ifndef GNASH_USE_GC
@@ -380,8 +379,7 @@
else {
// Get the object to use as 'this' reference
as_value this_val = fn.arg(0);
- boost::intrusive_ptr<as_object> this_ptr =
- this_val.to_object(*getGlobal(fn));
+ as_object* this_ptr = this_val.to_object(*getGlobal(fn)).get();
if (!this_ptr) {
// If the first argument is not an object, we should
=== modified file 'libcore/as_function.h'
--- a/libcore/as_function.h 2009-08-19 08:48:14 +0000
+++ b/libcore/as_function.h 2009-08-20 06:55:15 +0000
@@ -20,10 +20,10 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "as_object.h" // for inheritance
+#include "fn_call.h"
// Forward declarations
namespace gnash {
- class fn_call;
class NativeFunction;
class Global_as;
}
@@ -87,7 +87,7 @@
/// Arguments for the constructor invocation
///
boost::intrusive_ptr<as_object> constructInstance(const as_environment&
env,
- std::auto_ptr<std::vector<as_value> > args);
+ fn_call::Args& args);
/// Get this function's "prototype" member (exported interface).
///
=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp 2009-08-19 13:35:42 +0000
+++ b/libcore/as_object.cpp 2009-08-20 06:55:15 +0000
@@ -103,9 +103,14 @@
/// Dispatch.
virtual as_value operator()(const fn_call& fn)
{
- std::auto_ptr<std::vector<as_value> > args(
- new std::vector<as_value>(fn.getArgs()));
- fn_call fn2(fn.this_ptr.get(), fn.env(), args, fn.super, true);
+
+ // TODO: this is a hack to make sure objects are constructed, not
+ // converted (fn.isInstantiation() must be true).
+ fn_call::Args::container_type argsIn(fn.getArgs());
+ fn_call::Args args;
+ args.swap(argsIn);
+
+ fn_call fn2(fn.this_ptr, fn.env(), args, fn.super, true);
assert(fn2.isInstantiation());
as_function* ctor = constructor();
if (ctor) return ctor->call(fn2);
@@ -1152,8 +1157,8 @@
as_environment env(_vm);
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
- args->push_back(arg0);
+ fn_call::Args args;
+ args += arg0;
return call_method(method, env, this, args);
}
@@ -1171,9 +1176,8 @@
as_environment env(_vm);
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
- args->push_back(arg0);
- args->push_back(arg1);
+ fn_call::Args args;
+ args += arg0, arg1;
return call_method(method, env, this, args);
}
@@ -1192,10 +1196,8 @@
as_environment env(_vm);
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
- args->push_back(arg0);
- args->push_back(arg1);
- args->push_back(arg2);
+ fn_call::Args args;
+ args += arg0, arg1, arg2;
ret = call_method(method, env, this, args);
@@ -1215,11 +1217,8 @@
as_environment env(_vm);
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
- args->push_back(arg0);
- args->push_back(arg1);
- args->push_back(arg2);
- args->push_back(arg3);
+ fn_call::Args args;
+ args += arg0, arg1, arg2, arg3;
return call_method(method, env, this, args);
@@ -1349,11 +1348,8 @@
try {
as_environment env(VM::get()); // TODO: get VM in some other
way
- std::auto_ptr<std::vector<as_value> > args (new
std::vector<as_value>);
- args->push_back(_propname);
- args->push_back(oldval);
- args->push_back(newval);
- args->push_back(_customArg);
+ fn_call::Args args;
+ args += _propname, oldval, newval, _customArg;
fn_call fn(&this_obj, env, args);
=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp 2009-08-19 12:14:57 +0000
+++ b/libcore/as_value.cpp 2009-08-20 06:55:15 +0000
@@ -2354,9 +2354,8 @@
Global_as* gl = vm.getGlobal();
as_function* ctor =
gl->getMember(NSV::CLASS_DATE).to_as_function();
if (ctor) {
- std::auto_ptr<std::vector<as_value> > args(
- new std::vector<as_value>());
- args->push_back(dub);
+ fn_call::Args args;
+ args += dub;
ret.set_as_object(ctor->constructInstance(as_environment(vm),
args));
}
=== modified file 'libcore/asobj/Array_as.cpp'
--- a/libcore/asobj/Array_as.cpp 2009-08-18 06:49:40 +0000
+++ b/libcore/asobj/Array_as.cpp 2009-08-20 06:55:15 +0000
@@ -354,23 +354,21 @@
const as_environment& _env;
as_value_custom(as_function& comparator, bool (*zc)(const int),
- boost::intrusive_ptr<as_object> this_ptr, const as_environment& env)
+ as_object* this_ptr, const as_environment& env)
:
_comp(comparator),
_zeroCmp(zc),
_env(env)
{
- _object = this_ptr.get();
+ _object = this_ptr;
}
bool operator() (const as_value& a, const as_value& b)
{
as_value cmp_method(&_comp);
as_value ret(0.0);
-
- std::auto_ptr<std::vector<as_value> > args (new
std::vector<as_value>);
- args->push_back(b);
- args->push_back(a);
+ fn_call::Args args;
+ args += b, a;
ret = call_method(cmp_method, _env, _object, args);
return (*_zeroCmp)(ret.to_int());
@@ -1290,7 +1288,7 @@
(
log_action(_("array_to_string called, nargs = %d, "
"this_ptr = %p"),
- fn.nargs, (void*)fn.this_ptr.get());
+ fn.nargs, (void*)fn.this_ptr);
log_action(_("to_string result is: %s"), ret);
);
=== modified file 'libcore/asobj/AsBroadcaster.cpp'
--- a/libcore/asobj/AsBroadcaster.cpp 2009-08-18 06:49:40 +0000
+++ b/libcore/asobj/AsBroadcaster.cpp 2009-08-20 09:36:50 +0000
@@ -175,18 +175,12 @@
void
-AsBroadcaster::init(as_object& global, const ObjectURI& uri)
+AsBroadcaster::init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(global);
-
- as_object* proto = gl->createObject(getObjectInterface());
- as_object* cl = gl->createClass(asbroadcaster_ctor, proto);
-
- attachAsBroadcasterStaticInterface(*cl);
-
// AsBroadcaster is a class, even though it doesn't look much like one.
- global.init_member(getName(uri), cl, as_object::DefaultFlags,
- getNamespace(uri));
+ // Its prototype has no properties.
+ registerBuiltinClass(where, asbroadcaster_ctor, 0,
+ attachAsBroadcasterStaticInterface, uri);
}
@@ -248,9 +242,8 @@
if ( ! obj->get_member(NSV::PROP_uLISTENERS, &listenersValue) )
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("%p.addListener(%s): this object has no _listeners
member"),
- (void*)fn.this_ptr.get(),
- fn.dump_args());
+ log_aserror(_("%p.addListener(%s): this object has no _listeners "
+ "member"), (void*)fn.this_ptr, fn.dump_args());
);
return as_value(true); // odd, but seems the case..
}
@@ -260,9 +253,8 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object's _listener isn't "
- "an object: %s"),
- (void*)fn.this_ptr.get(),
- fn.dump_args(), listenersValue);
+ "an object: %s"), (void*)fn.this_ptr, fn.dump_args(),
+ listenersValue);
);
return as_value(false); // TODO: check this
}
@@ -275,9 +267,10 @@
if ( ! listeners )
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("%p.addListener(%s): this object's _listener isn't an
array: %s -- will call 'push' on it anyway"),
- (void*)fn.this_ptr.get(),
- fn.dump_args(), listenersValue);
+ log_aserror(_("%p.addListener(%s): this object's _listener isn't "
+ "an array: %s -- will call 'push' on it anyway"),
+ (void*)fn.this_ptr,
+ fn.dump_args(), listenersValue);
);
listenersObj->callMethod(NSV::PROP_PUSH, newListener);
@@ -308,7 +301,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object has no _listeners "
- "member"), (void*)fn.this_ptr.get(), fn.dump_args());
+ "member"), (void*)fn.this_ptr, fn.dump_args());
);
return as_value(false); // TODO: check this
}
@@ -318,7 +311,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object's _listener isn't "
- "an object: %s"), (void*)fn.this_ptr.get(), fn.dump_args(),
+ "an object: %s"), (void*)fn.this_ptr, fn.dump_args(),
listenersValue);
);
return as_value(false); // TODO: check this
@@ -337,7 +330,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object's _listener isn't an "
- "array: %s"), (void*)fn.this_ptr.get(), fn.dump_args(),
+ "array: %s"), (void*)fn.this_ptr, fn.dump_args(),
listenersValue);
);
@@ -390,7 +383,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object has no "
- "_listeners member"), (void*)fn.this_ptr.get(),
+ "_listeners member"), (void*)fn.this_ptr,
fn.dump_args());
);
return as_value(); // TODO: check this
@@ -401,7 +394,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object's _listener "
- "isn't an object: %s"), (void*)fn.this_ptr.get(),
+ "isn't an object: %s"), (void*)fn.this_ptr,
fn.dump_args(), listenersValue);
);
return as_value(); // TODO: check this
@@ -415,7 +408,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%p.addListener(%s): this object's _listener "
- "isn't an array: %s"), (void*)fn.this_ptr.get(),
+ "isn't an array: %s"), (void*)fn.this_ptr,
fn.dump_args(), listenersValue);
);
return as_value(); // TODO: check this
@@ -425,7 +418,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("%p.broadcastMessage() needs an argument",
- (void*)fn.this_ptr.get());
+ (void*)fn.this_ptr);
);
return as_value();
}
=== modified file 'libcore/asobj/Boolean_as.cpp'
--- a/libcore/asobj/Boolean_as.cpp 2009-08-19 14:08:49 +0000
+++ b/libcore/asobj/Boolean_as.cpp 2009-08-20 06:55:15 +0000
@@ -114,7 +114,7 @@
as_value
boolean_tostring(const fn_call& fn)
{
- Boolean_as* obj = checkType<Boolean_as>(fn.this_ptr.get());
+ Boolean_as* obj = checkType<Boolean_as>(fn.this_ptr);
if (obj->value()) return as_value("true");
return as_value("false");
}
@@ -123,7 +123,7 @@
as_value
boolean_valueof(const fn_call& fn)
{
- Boolean_as* obj = checkType<Boolean_as>(fn.this_ptr.get());
+ Boolean_as* obj = checkType<Boolean_as>(fn.this_ptr);
return as_value(obj->value());
}
@@ -138,7 +138,7 @@
const bool val = fn.nargs ? fn.arg(0).to_bool() : false;
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
obj->setProxy(new Boolean_as(val));
return as_value();
=== modified file 'libcore/asobj/Color_as.cpp'
--- a/libcore/asobj/Color_as.cpp 2009-08-18 06:49:40 +0000
+++ b/libcore/asobj/Color_as.cpp 2009-08-20 09:36:50 +0000
@@ -66,24 +66,20 @@
// extern (used by Global.cpp)
void
-color_class_init(as_object& global, const ObjectURI& uri)
+color_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(global);
- as_object* proto = gl->createObject(getObjectInterface());
- as_object* cl = gl->createClass(&color_ctor, proto);
-
- attachColorInterface(*proto);
-
- // This has to be done after createClass is called, as that modifies
- // proto.
+ as_object* cl = registerBuiltinClass(where, color_ctor,
+ attachColorInterface, 0, uri);
+
+ as_object* proto =
+ cl->getMember(NSV::PROP_PROTOTYPE).to_object(*getGlobal(where)).get();
+
+ if (!proto) return;
+
const int protect = as_object::DefaultFlags | PropFlags::readOnly;
proto->set_member_flags(NSV::PROP_uuPROTOuu, protect);
proto->set_member_flags(NSV::PROP_CONSTRUCTOR, protect);
- // Register _global.Color
- global.init_member(getName(uri), cl, as_object::DefaultFlags,
- getNamespace(uri));
-
}
@@ -243,7 +239,7 @@
color_ctor(const fn_call& fn)
{
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
as_value target;
if (fn.nargs) target = fn.arg(0);
=== modified file 'libcore/asobj/Date_as.cpp'
--- a/libcore/asobj/Date_as.cpp 2009-08-19 10:01:05 +0000
+++ b/libcore/asobj/Date_as.cpp 2009-08-20 08:09:04 +0000
@@ -111,7 +111,6 @@
// Forward declarations
- as_object* getDateInterface();
void attachDateInterface(as_object& o);
void attachDateStaticInterface(as_object& o);
@@ -211,8 +210,9 @@
{
Global_as* gl = getGlobal(global);
- as_object* proto = getDateInterface();
+ as_object* proto = gl->createObject(getObjectInterface());
as_object* cl = gl->createClass(&date_new, proto);
+ attachDateInterface(*proto);
const int flags = PropFlags::readOnly;
cl->set_member_flags(NSV::PROP_uuPROTOuu, flags);
@@ -393,20 +393,6 @@
o.init_member("UTC", vm.getNative(103, 257), flags);
}
-as_object*
-getDateInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( !o )
- {
- o = new as_object(getObjectInterface());
- VM::get().addStatic(o.get());
- attachDateInterface(*o);
- }
- return o.get();
-}
-
-
/// \brief Date constructor
//
/// The constructor has three forms: 0 args, 1 arg and 2-7 args.
@@ -425,12 +411,16 @@
date_new(const fn_call& fn)
{
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
+
+ // The Date ctor called as a conversion function constructs a new
+ // date.
if (!fn.isInstantiation()) {
- obj = new as_object();
- obj->set_prototype(getDateInterface());
- obj->setProxy(new Date_as);
- return obj;
+ Global_as* gl = getGlobal(fn);
+ as_function* ctor = gl->getMember(NSV::CLASS_DATE).to_as_function();
+ if (!ctor) return as_value();
+ fn_call::Args args;
+ return ctor->constructInstance(fn.env(), args);
}
// Reject all date specifications containing Infinities and NaNs.
@@ -548,7 +538,7 @@
as_value
date_getYear(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(localTime, &GnashTime::year, date->getTimeValue());
}
@@ -557,7 +547,7 @@
as_value
date_getFullYear(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(
localTime, &GnashTime::year, date->getTimeValue(), 1900);
}
@@ -567,7 +557,7 @@
as_value
date_getMonth(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(localTime, &GnashTime::month, date->getTimeValue());
}
@@ -576,7 +566,7 @@
as_value
date_getDate(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(localTime, &GnashTime::monthday, date->getTimeValue());
}
@@ -586,7 +576,7 @@
as_value
date_getDay(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(localTime, &GnashTime::weekday, date->getTimeValue());
}
@@ -596,7 +586,7 @@
as_value
date_getHours(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(localTime, &GnashTime::hour, date->getTimeValue());
}
@@ -607,7 +597,7 @@
as_value
date_getMinutes(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(localTime, &GnashTime::minute, date->getTimeValue());
}
@@ -617,7 +607,7 @@
as_value
date_getSeconds(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(localTime, &GnashTime::second, date->getTimeValue());
}
@@ -629,7 +619,7 @@
as_value
date_getMilliseconds(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(
localTime, &GnashTime::millisecond, date->getTimeValue());
}
@@ -640,7 +630,7 @@
as_value
date_getUTCFullYear(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(universalTime, &GnashTime::year,
date->getTimeValue(), 1900);
}
@@ -648,21 +638,21 @@
as_value
date_getUTCYear(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(universalTime, &GnashTime::year, date->getTimeValue());
}
as_value
date_getUTCMonth(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(universalTime, &GnashTime::month, date->getTimeValue());
}
as_value
date_getutcdate(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(
universalTime, &GnashTime::monthday, date->getTimeValue());
}
@@ -671,7 +661,7 @@
as_value
date_getUTCDay(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(
universalTime, &GnashTime::weekday, date->getTimeValue());
}
@@ -679,7 +669,7 @@
as_value
date_getUTCHours(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(
universalTime, &GnashTime::hour, date->getTimeValue());
}
@@ -687,7 +677,7 @@
as_value
date_getUTCMinutes(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return timeElement(universalTime, &GnashTime::minute,
date->getTimeValue());
}
@@ -710,7 +700,7 @@
as_value
date_getTimezoneOffset(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return as_value(-localTimeZoneOffset(date->getTimeValue()));
}
@@ -732,7 +722,7 @@
as_value
date_setTime(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
if (fn.nargs < 1 || fn.arg(0).is_undefined()) {
IF_VERBOSE_ASCODING_ERRORS(
@@ -844,7 +834,7 @@
as_value
date_setfullyear(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
if (fn.nargs < 1) {
IF_VERBOSE_ASCODING_ERRORS(
@@ -895,7 +885,7 @@
as_value
date_setYear(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
// assert(fn.nargs == 1);
if (fn.nargs < 1) {
@@ -949,7 +939,7 @@
as_value
date_setmonth(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 2);
if (fn.nargs < 1) {
@@ -1005,7 +995,7 @@
as_value
date_setDate(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
if (fn.nargs < 1) {
IF_VERBOSE_ASCODING_ERRORS(
@@ -1045,7 +1035,7 @@
as_value
date_setHours(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 4);
if (fn.nargs < 1) {
@@ -1090,7 +1080,7 @@
as_value
date_setMinutes(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
//assert(fn.nargs >= 1 && fn.nargs <= 3);
if (fn.nargs < 1) {
@@ -1131,7 +1121,7 @@
as_value
date_setSeconds(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 2);
if (fn.nargs < 1) {
@@ -1170,7 +1160,7 @@
as_value
date_setMilliseconds(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
if (fn.nargs < 1) {
IF_VERBOSE_ASCODING_ERRORS(
@@ -1212,7 +1202,7 @@
as_value
date_tostring(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return as_value(date->toString());
}
@@ -1355,7 +1345,7 @@
/// number of milliseconds.
as_value date_getTime(const fn_call& fn)
{
- Date_as* date = checkType<Date_as>(fn.this_ptr.get());
+ Date_as* date = checkType<Date_as>(fn.this_ptr);
return as_value(date->getTimeValue());
}
=== modified file 'libcore/asobj/Error_as.cpp'
--- a/libcore/asobj/Error_as.cpp 2009-08-17 11:10:20 +0000
+++ b/libcore/asobj/Error_as.cpp 2009-08-20 09:36:50 +0000
@@ -48,18 +48,7 @@
void
Error_class_init(as_object& where, const ObjectURI& uri)
{
-
- Global_as* gl = getGlobal(where);
-
- as_object* proto = gl->createObject(getObjectInterface());
- boost::intrusive_ptr<as_object> cl = gl->createClass(&error_ctor, proto);
-
- // Attach properties to the class prototype.
- attachErrorInterface(*proto);
-
- // Register _global.Error
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, error_ctor, attachErrorInterface, 0, uri);
}
@@ -95,7 +84,7 @@
if (!fn.isInstantiation()) return as_value();
- as_object* err = fn.this_ptr.get();
+ as_object* err = fn.this_ptr;
string_table& st = getStringTable(fn);
=== modified file 'libcore/asobj/Global_as.h'
--- a/libcore/asobj/Global_as.h 2009-08-18 10:55:56 +0000
+++ b/libcore/asobj/Global_as.h 2009-08-20 09:18:07 +0000
@@ -82,7 +82,20 @@
/// Register a built-in object
//
-/// @return the built-in object with properties attached.
+/// This is used for simple objects that are part of the player API.
+//
+/// In the reference player these objects are always constructed in
+/// ActionScript, though their functions may be native.
+//
+/// They include (AS2) Mouse, Selection and Stage, and (AS3) all constant
+/// enumeration objects.
+//
+/// @param p a pointer to a function that will attach properties to the
+/// object
+/// @param where the object to which the created object will be attached
+/// @param uri an ObjectURI describing the name and namespace of the
+/// created object.
+/// @return the built-in object with properties attached.
inline as_object*
registerBuiltinObject(as_object& where, Properties p, const ObjectURI& uri)
{
@@ -91,7 +104,7 @@
Global_as* gl = getGlobal(where);
as_object* proto = getObjectInterface();
as_object* obj = gl->createObject(proto);
- p(*obj);
+ if (p) p(*obj);
where.init_member(getName(uri), obj, as_object::DefaultFlags,
getNamespace(uri));
@@ -99,6 +112,43 @@
return obj;
}
+/// Register a built-in class
+//
+/// This is used for classes that are part of the player API.
+//
+/// In the reference player these classes are always constructed in
+/// ActionScript, though their functions may be native, and the constructor
+/// may also call native functions.
+//
+/// @param c a pointer to a function that will attach properties to the
+/// class itself. These are known as static properties.
+/// @param p a pointer to a function that will attach properties to the
+/// class prototype. These are instance properties.
+/// @param ctor the constructor function for the new class.
+/// @param where the object to which the created object will be attached
+/// @param uri an ObjectURI describing the name and namespace of the
+/// created object.
+/// @return the built-in class with prototype and properties attached.
+inline as_object*
+registerBuiltinClass(as_object& where, Global_as::ASFunction ctor,
+ Properties p, Properties c, const ObjectURI& uri)
+{
+ Global_as* gl = getGlobal(where);
+ as_object* proto = gl->createObject(getObjectInterface());
+ as_object* cl = gl->createClass(ctor, proto);
+
+ // Attach class properties to class
+ if (c) c(*cl);
+
+ // Attach prototype properties to prototype
+ if (p) p(*proto);
+
+ // Register class with specified object.
+ where.init_member(getName(uri), cl, as_object::DefaultFlags,
+ getNamespace(uri));
+ return cl;
+}
+
} // namespace gnash
#endif
=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-08-19 14:17:42 +0000
+++ b/libcore/asobj/Globals.cpp 2009-08-20 06:55:15 +0000
@@ -1286,8 +1286,9 @@
// This is also not properly tested.
if (!ctor) throw ActionTypeError();
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(arg);
+ fn_call::Args args;
+ args += arg;
+
as_environment env(getVM(gl));
as_object* ret = ctor->constructInstance(env, args).get();
=== modified file 'libcore/asobj/LoadVars_as.cpp'
--- a/libcore/asobj/LoadVars_as.cpp 2009-08-18 10:32:14 +0000
+++ b/libcore/asobj/LoadVars_as.cpp 2009-08-20 06:55:15 +0000
@@ -194,7 +194,7 @@
loadvars_onData(const fn_call& fn)
{
- as_object* thisPtr = fn.this_ptr.get();
+ as_object* thisPtr = fn.this_ptr;
if (!thisPtr) return as_value();
// See
http://gitweb.freedesktop.org/?p=swfdec/swfdec.git;a=blob;f=libswfdec/swfdec_initialize.as
=== modified file 'libcore/asobj/Number_as.cpp'
--- a/libcore/asobj/Number_as.cpp 2009-08-19 14:08:49 +0000
+++ b/libcore/asobj/Number_as.cpp 2009-08-20 06:55:15 +0000
@@ -64,7 +64,7 @@
{
// Number.toString must only work for number object, not generic ones.
// This is so trace(Number.prototype) doesn't return 0 ...
- Number_as* obj = checkType<Number_as>(fn.this_ptr.get());
+ Number_as* obj = checkType<Number_as>(fn.this_ptr);
double val = obj->value();
unsigned radix = 10;
@@ -91,7 +91,7 @@
{
// Number.valueOf must only work for number object, not generic ones.
// This is so trace(Number.prototype == Object) return true in swf5 ?
- Number_as* obj = checkType<Number_as>(fn.this_ptr.get());
+ Number_as* obj = checkType<Number_as>(fn.this_ptr);
return obj->value();
}
=== modified file 'libcore/asobj/Object.cpp'
--- a/libcore/asobj/Object.cpp 2009-08-19 08:37:19 +0000
+++ b/libcore/asobj/Object.cpp 2009-08-20 06:55:15 +0000
@@ -200,7 +200,7 @@
as_value
object_toString(const fn_call& fn)
{
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
if (obj && obj->to_function() && !obj->isSuper()) {
return as_value("[type Function]");
@@ -473,7 +473,7 @@
as_value
object_watch(const fn_call& fn)
{
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
if ( fn.nargs < 2 )
{
@@ -510,7 +510,7 @@
as_value
object_unwatch(const fn_call& fn)
{
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
if ( fn.nargs < 1 )
{
=== modified file 'libcore/asobj/Selection_as.cpp'
--- a/libcore/asobj/Selection_as.cpp 2009-08-18 10:55:56 +0000
+++ b/libcore/asobj/Selection_as.cpp 2009-08-20 10:16:35 +0000
@@ -56,7 +56,11 @@
selection_class_init(as_object& where, const ObjectURI& uri)
{
// Selection is NOT a class, but a simple object, see Selection.as
- registerBuiltinObject(where, attachSelectionInterface, uri);
+ as_object* proto = registerBuiltinObject(where, attachSelectionInterface,
+ uri);
+
+ /// Handles addListener, removeListener, and _listeners.
+ AsBroadcaster::initialize(*proto);
}
void
@@ -89,9 +93,6 @@
o.init_member("getFocus", vm.getNative(600, 3), flags);
o.init_member("setFocus", vm.getNative(600, 4), flags);
o.init_member("setSelection", vm.getNative(600, 5), flags);
-
- /// Handles addListener, removeListener, and _listeners.
- AsBroadcaster::initialize(o);
}
=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp 2009-08-19 10:01:05 +0000
+++ b/libcore/asobj/String_as.cpp 2009-08-20 07:43:09 +0000
@@ -70,7 +70,6 @@
size_t validIndex(const std::wstring& subject, int index);
void attachStringInterface(as_object& o);
- as_object* getStringInterface();
inline bool checkArgs(const fn_call& fn, size_t min, size_t max,
const std::string& function);
@@ -112,12 +111,15 @@
// This is going to be the global String "class"/"function"
VM& vm = getVM(where);
+ Global_as* gl = getGlobal(where);
- as_object* proto = getStringInterface();
+ as_object* proto = gl->createObject(getObjectInterface());
as_object* cl = vm.getNative(251, 0);
cl->init_member(NSV::PROP_PROTOTYPE, proto);
proto->init_member(NSV::PROP_CONSTRUCTOR, cl);
+ attachStringInterface(*proto);
+
cl->init_member("fromCharCode", vm.getNative(251, 14));
const int flags = PropFlags::dontEnum;
@@ -148,36 +150,6 @@
o.init_member("substr", vm.getNative(251, 13));
}
-as_object*
-getStringInterface()
-{
-
- if (isAS3(VM::get())) {
- static boost::intrusive_ptr<as_object> o;
-
- if ( o == NULL )
- {
- o = new as_object(getObjectInterface());
- VM::get().addStatic(o.get());
-
- attachStringInterface(*o);
- }
- return o.get();
- }
-
- static boost::intrusive_ptr<as_object> o;
-
- if ( o == NULL )
- {
- o = new as_object(getObjectInterface());
- VM::get().addStatic(o.get());
-
- attachStringInterface(*o);
- }
- return o.get();
-
-}
-
// all the arguments will be converted to string and concatenated.
as_value
string_concat(const fn_call& fn)
@@ -797,7 +769,7 @@
as_value
string_toString(const fn_call& fn)
{
- String_as* str = checkType<String_as>(fn.this_ptr.get());
+ String_as* str = checkType<String_as>(fn.this_ptr);
return as_value(str->value());
}
@@ -816,7 +788,7 @@
return as_value(str);
}
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
obj->setProxy(new String_as(str));
std::wstring wstr = utf8::decodeCanonicalString(str, getSWFVersion(fn));
=== modified file 'libcore/asobj/flash/display/AVM1Movie_as.cpp'
--- a/libcore/asobj/flash/display/AVM1Movie_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/display/AVM1Movie_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void avm1movie_class_init(as_object& where, const ObjectURI& uri)
+void
+avm1movie_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 = getAVM1MovieInterface();
- cl = gl->createClass(&avm1movie_ctor, proto);
- attachAVM1MovieStaticInterface(*cl);
- }
-
- // Register _global.AVM1Movie
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, avm1movie_ctor, attachAVM1MovieInterface,
+ attachAVM1MovieStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/ActionScriptVersion_as.cpp'
--- a/libcore/asobj/flash/display/ActionScriptVersion_as.cpp 2009-07-31
07:38:05 +0000
+++ b/libcore/asobj/flash/display/ActionScriptVersion_as.cpp 2009-08-20
08:57:16 +0000
@@ -43,12 +43,8 @@
void
actionscriptversion_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachActionScriptVersionStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachActionScriptVersionStaticInterface,
+ uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/BitmapData_as.cpp'
--- a/libcore/asobj/flash/display/BitmapData_as.cpp 2009-08-18 09:41:50
+0000
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp 2009-08-20 06:55:15
+0000
@@ -603,13 +603,8 @@
return -1;
}
- // Construct a Rectangle from the data.
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
-
- args->push_back(0.0);
- args->push_back(0.0);
- args->push_back(ptr->getWidth());
- args->push_back(ptr->getHeight());
+ fn_call::Args args;
+ args += 0.0, 0.0, ptr->getWidth(), ptr->getHeight();
boost::intrusive_ptr<as_object> newRect =
rectCtor->constructInstance(fn.env(), args);
=== modified file 'libcore/asobj/flash/display/Bitmap_as.cpp'
--- a/libcore/asobj/flash/display/Bitmap_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/display/Bitmap_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void bitmap_class_init(as_object& where, const ObjectURI& uri)
+void
+bitmap_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 = getBitmapInterface();
- cl = gl->createClass(&bitmap_ctor, proto);
- attachBitmapStaticInterface(*cl);
- }
-
- // Register _global.Bitmap
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, bitmap_ctor, attachBitmapInterface,
+ attachBitmapStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/BlendMode_as.cpp'
--- a/libcore/asobj/flash/display/BlendMode_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/display/BlendMode_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void blendmode_class_init(as_object& where, const ObjectURI& uri)
+void
+blendmode_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 = getBlendModeInterface();
- cl = gl->createClass(&blendmode_ctor, proto);
- attachBlendModeStaticInterface(*cl);
- }
-
- // Register _global.BlendMode
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, blendmode_ctor, attachBlendModeInterface,
+ attachBlendModeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/FrameLabel_as.cpp'
--- a/libcore/asobj/flash/display/FrameLabel_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/display/FrameLabel_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void framelabel_class_init(as_object& where, const ObjectURI& uri)
+void
+framelabel_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 = getFrameLabelInterface();
- cl = gl->createClass(&framelabel_ctor, proto);
- attachFrameLabelStaticInterface(*cl);
- }
-
- // Register _global.FrameLabel
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, framelabel_ctor, attachFrameLabelInterface,
+ attachFrameLabelStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/IBitmapDrawable_as.cpp'
--- a/libcore/asobj/flash/display/IBitmapDrawable_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/display/IBitmapDrawable_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void ibitmapdrawable_class_init(as_object& where, const ObjectURI& uri)
+void
+ibitmapdrawable_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 = getIBitmapDrawableInterface();
- cl = gl->createClass(&ibitmapdrawable_ctor, proto);
- attachIBitmapDrawableStaticInterface(*cl);
- }
-
- // Register _global.IBitmapDrawable
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, ibitmapdrawable_ctor,
attachIBitmapDrawableInterface,
+ attachIBitmapDrawableStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/InteractiveObject_as.cpp'
--- a/libcore/asobj/flash/display/InteractiveObject_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/display/InteractiveObject_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void interactiveobject_class_init(as_object& where, const ObjectURI& uri)
+void
+interactiveobject_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 = getInteractiveObjectInterface();
- cl = gl->createClass(&interactiveobject_ctor, proto);
- attachInteractiveObjectStaticInterface(*cl);
- }
-
- // Register _global.InteractiveObject
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, interactiveobject_ctor,
attachInteractiveObjectInterface,
+ attachInteractiveObjectStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/LineScaleMode_as.cpp'
--- a/libcore/asobj/flash/display/LineScaleMode_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/display/LineScaleMode_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,12 +43,7 @@
void
linescalemode_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachLineScaleModeStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachLineScaleModeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/Loader_as.cpp'
--- a/libcore/asobj/flash/display/Loader_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/display/Loader_as.cpp 2009-08-20 08:57:16 +0000
@@ -55,20 +55,11 @@
};
// extern (used by Global.cpp)
-void loader_class_init(as_object& where, const ObjectURI& uri)
+void
+loader_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 = getLoaderInterface();
- cl = gl->createClass(&loader_ctor, proto);
- attachLoaderStaticInterface(*cl);
- }
-
- // Register _global.Loader
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, loader_ctor, attachLoaderInterface,
+ attachLoaderStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/MorphShape_as.cpp'
--- a/libcore/asobj/flash/display/MorphShape_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/display/MorphShape_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void morphshape_class_init(as_object& where, const ObjectURI& uri)
+void
+morphshape_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 = getMorphShapeInterface();
- cl = gl->createClass(&morphshape_ctor, proto);
- attachMorphShapeStaticInterface(*cl);
- }
-
- // Register _global.MorphShape
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, morphshape_ctor, attachMorphShapeInterface,
+ attachMorphShapeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/MovieClip_as.cpp'
--- a/libcore/asobj/flash/display/MovieClip_as.cpp 2009-08-18 06:49:40
+0000
+++ b/libcore/asobj/flash/display/MovieClip_as.cpp 2009-08-20 06:55:15
+0000
@@ -1429,8 +1429,8 @@
}
// Construct a flash.geom.Transform object with "this" as argument.
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(obj.get());
+ fn_call::Args args;
+ args += obj.get();
boost::intrusive_ptr<as_object> ts =
tsCtor->constructInstance(fn.env(), args);
@@ -2625,8 +2625,8 @@
}
// Construct a flash.geom.Transform object with "this" as argument.
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(ptr.get());
+ fn_call::Args args;
+ args += ptr.get();
boost::intrusive_ptr<as_object> newTrans =
transCtor->constructInstance(fn.env(), args);
=== modified file 'libcore/asobj/flash/display/Scene_as.cpp'
--- a/libcore/asobj/flash/display/Scene_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/display/Scene_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void scene_class_init(as_object& where, const ObjectURI& uri)
+void
+scene_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 = getSceneInterface();
- cl = gl->createClass(&scene_ctor, proto);
- attachSceneStaticInterface(*cl);
- }
-
- // Register _global.Scene
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, scene_ctor, attachSceneInterface,
+ attachSceneStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/Shape_as.cpp'
--- a/libcore/asobj/flash/display/Shape_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/display/Shape_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void shape_class_init(as_object& where, const ObjectURI& uri)
+void
+shape_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 = getShapeInterface();
- cl = gl->createClass(&shape_ctor, proto);
- attachShapeStaticInterface(*cl);
- }
-
- // Register _global.Shape
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, shape_ctor, attachShapeInterface,
+ attachShapeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/SimpleButton_as.cpp'
--- a/libcore/asobj/flash/display/SimpleButton_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/display/SimpleButton_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void simplebutton_class_init(as_object& where, const ObjectURI& uri)
+void
+simplebutton_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 = getSimpleButtonInterface();
- cl = gl->createClass(&simplebutton_ctor, proto);
- attachSimpleButtonStaticInterface(*cl);
- }
-
- // Register _global.SimpleButton
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, simplebutton_ctor,
attachSimpleButtonInterface,
+ attachSimpleButtonStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/Sprite_as.cpp'
--- a/libcore/asobj/flash/display/Sprite_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/display/Sprite_as.cpp 2009-08-20 08:57:16 +0000
@@ -53,20 +53,11 @@
};
// extern (used by Global.cpp)
-void sprite_class_init(as_object& where, const ObjectURI& uri)
+void
+sprite_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 = getSpriteInterface();
- cl = gl->createClass(&sprite_ctor, proto);
- attachSpriteStaticInterface(*cl);
- }
-
- // Register _global.Sprite
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, sprite_ctor, attachSpriteInterface,
+ attachSpriteStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/display/Stage_as.cpp'
--- a/libcore/asobj/flash/display/Stage_as.cpp 2009-08-18 10:55:56 +0000
+++ b/libcore/asobj/flash/display/Stage_as.cpp 2009-08-20 10:16:35 +0000
@@ -40,16 +40,28 @@
namespace gnash {
-static as_value stage_scalemode(const fn_call& fn);
-static as_value stage_align(const fn_call& fn);
-static as_value stage_showMenu(const fn_call& fn);
-static as_value stage_width(const fn_call& fn);
-static as_value stage_height(const fn_call& fn);
-static as_value stage_displaystate(const fn_call& fn);
-static const char* getScaleModeString(movie_root::ScaleMode sm);
-static const char* getDisplayStateString(movie_root::DisplayState ds);
-
-void registerStageNative(as_object& o)
+namespace {
+ as_value stage_scalemode(const fn_call& fn);
+ as_value stage_align(const fn_call& fn);
+ as_value stage_showMenu(const fn_call& fn);
+ as_value stage_width(const fn_call& fn);
+ as_value stage_height(const fn_call& fn);
+ as_value stage_displaystate(const fn_call& fn);
+ const char* getScaleModeString(movie_root::ScaleMode sm);
+ const char* getDisplayStateString(movie_root::DisplayState ds);
+ void attachStageInterface(as_object& o);
+}
+
+// extern (used by Global.cpp)
+void
+stage_class_init(as_object& where, const ObjectURI& uri)
+{
+ as_object* obj = registerBuiltinObject(where, attachStageInterface, uri);
+ AsBroadcaster::initialize(*obj);
+}
+
+void
+registerStageNative(as_object& o)
{
VM& vm = getVM(o);
@@ -65,7 +77,9 @@
vm.registerNative(stage_showMenu, 666, 10);
}
-static void
+namespace {
+
+void
attachStageInterface(as_object& o)
{
o.init_property("scaleMode", &stage_scalemode, &stage_scalemode);
@@ -260,12 +274,6 @@
return as_value();
}
-// extern (used by Global.cpp)
-void
-stage_class_init(as_object& where, const ObjectURI& uri)
-{
- as_object* obj = registerBuiltinObject(where, attachStageInterface, uri);
- AsBroadcaster::initialize(*obj);
-}
+} // anonymous namespace
} // end of gnash namespace
=== modified file 'libcore/asobj/flash/errors/EOFError_as.cpp'
--- a/libcore/asobj/flash/errors/EOFError_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/errors/EOFError_as.cpp 2009-08-20 08:17:09
+0000
@@ -36,36 +36,14 @@
as_value eoferror_ctor(const fn_call& fn);
void attachEOFErrorInterface(as_object& o);
void attachEOFErrorStaticInterface(as_object& o);
- as_object* getEOFErrorInterface();
-
}
-class EOFError_as : public as_object
-{
-
-public:
-
- EOFError_as()
- :
- as_object(getEOFErrorInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void eoferror_class_init(as_object& where, const ObjectURI& uri)
+void
+eoferror_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 = getEOFErrorInterface();
- cl = gl->createClass(&eoferror_ctor, proto);
- attachEOFErrorStaticInterface(*cl);
- }
-
- // Register _global.EOFError
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, eoferror_ctor, attachEOFErrorInterface,
+ attachEOFErrorStaticInterface, uri);
}
namespace {
@@ -81,23 +59,10 @@
}
-as_object*
-getEOFErrorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachEOFErrorInterface(*o);
- }
- return o.get();
-}
-
as_value
eoferror_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new EOFError_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/errors/IOError_as.cpp'
--- a/libcore/asobj/flash/errors/IOError_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/errors/IOError_as.cpp 2009-08-20 08:17:09 +0000
@@ -36,36 +36,14 @@
as_value ioerror_ctor(const fn_call& fn);
void attachIOErrorInterface(as_object& o);
void attachIOErrorStaticInterface(as_object& o);
- as_object* getIOErrorInterface();
-
}
-class IOError_as : public as_object
-{
-
-public:
-
- IOError_as()
- :
- as_object(getIOErrorInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void ioerror_class_init(as_object& where, const ObjectURI& uri)
+void
+ioerror_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 = getIOErrorInterface();
- cl = gl->createClass(&ioerror_ctor, proto);
- attachIOErrorStaticInterface(*cl);
- }
-
- // Register _global.IOError
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, ioerror_ctor, attachIOErrorInterface,
+ attachIOErrorStaticInterface, uri);
}
namespace {
@@ -81,23 +59,10 @@
}
-as_object*
-getIOErrorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIOErrorInterface(*o);
- }
- return o.get();
-}
-
as_value
ioerror_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IOError_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/errors/IllegalOperationError_as.cpp'
--- a/libcore/asobj/flash/errors/IllegalOperationError_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/errors/IllegalOperationError_as.cpp 2009-08-20
08:17:09 +0000
@@ -36,36 +36,15 @@
as_value illegaloperationerror_ctor(const fn_call& fn);
void attachIllegalOperationErrorInterface(as_object& o);
void attachIllegalOperationErrorStaticInterface(as_object& o);
- as_object* getIllegalOperationErrorInterface();
-
}
-class IllegalOperationError_as : public as_object
-{
-
-public:
-
- IllegalOperationError_as()
- :
- as_object(getIllegalOperationErrorInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void illegaloperationerror_class_init(as_object& where, const ObjectURI& uri)
+void
+illegaloperationerror_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 = getIllegalOperationErrorInterface();
- cl = gl->createClass(&illegaloperationerror_ctor, proto);
- attachIllegalOperationErrorStaticInterface(*cl);
- }
-
- // Register _global.IllegalOperationError
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, illegaloperationerror_ctor,
+ attachIllegalOperationErrorInterface,
+ attachIllegalOperationErrorStaticInterface, uri);
}
namespace {
@@ -81,23 +60,10 @@
}
-as_object*
-getIllegalOperationErrorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIllegalOperationErrorInterface(*o);
- }
- return o.get();
-}
-
as_value
illegaloperationerror_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IllegalOperationError_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/errors/InvalidSWFError_as.cpp'
--- a/libcore/asobj/flash/errors/InvalidSWFError_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/errors/InvalidSWFError_as.cpp 2009-08-20 08:30:43
+0000
@@ -36,36 +36,15 @@
as_value invalidswferror_ctor(const fn_call& fn);
void attachInvalidSWFErrorInterface(as_object& o);
void attachInvalidSWFErrorStaticInterface(as_object& o);
- as_object* getInvalidSWFErrorInterface();
-
}
-class InvalidSWFError_as : public as_object
-{
-
-public:
-
- InvalidSWFError_as()
- :
- as_object(getInvalidSWFErrorInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void invalidswferror_class_init(as_object& where, const ObjectURI& uri)
+void
+invalidswferror_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 = getInvalidSWFErrorInterface();
- cl = gl->createClass(&invalidswferror_ctor, proto);
- attachInvalidSWFErrorStaticInterface(*cl);
- }
-
- // Register _global.InvalidSWFError
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, invalidswferror_ctor,
+ attachInvalidSWFErrorInterface,
+ attachInvalidSWFErrorStaticInterface, uri);
}
namespace {
@@ -81,23 +60,10 @@
}
-as_object*
-getInvalidSWFErrorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachInvalidSWFErrorInterface(*o);
- }
- return o.get();
-}
-
as_value
invalidswferror_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new InvalidSWFError_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/errors/MemoryError_as.cpp'
--- a/libcore/asobj/flash/errors/MemoryError_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/errors/MemoryError_as.cpp 2009-08-20 08:17:09
+0000
@@ -36,36 +36,14 @@
as_value memoryerror_ctor(const fn_call& fn);
void attachMemoryErrorInterface(as_object& o);
void attachMemoryErrorStaticInterface(as_object& o);
- as_object* getMemoryErrorInterface();
-
}
-class MemoryError_as : public as_object
-{
-
-public:
-
- MemoryError_as()
- :
- as_object(getMemoryErrorInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void memoryerror_class_init(as_object& where, const ObjectURI& uri)
+void
+memoryerror_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 = getMemoryErrorInterface();
- cl = gl->createClass(&memoryerror_ctor, proto);
- attachMemoryErrorStaticInterface(*cl);
- }
-
- // Register _global.MemoryError
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, memoryerror_ctor, attachMemoryErrorInterface,
+ attachMemoryErrorStaticInterface, uri);
}
namespace {
@@ -81,23 +59,10 @@
}
-as_object*
-getMemoryErrorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachMemoryErrorInterface(*o);
- }
- return o.get();
-}
-
as_value
memoryerror_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new MemoryError_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp'
--- a/libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp 2009-08-20
08:17:09 +0000
@@ -36,36 +36,15 @@
as_value scripttimeouterror_ctor(const fn_call& fn);
void attachScriptTimeoutErrorInterface(as_object& o);
void attachScriptTimeoutErrorStaticInterface(as_object& o);
- as_object* getScriptTimeoutErrorInterface();
-
}
-class ScriptTimeoutError_as : public as_object
-{
-
-public:
-
- ScriptTimeoutError_as()
- :
- as_object(getScriptTimeoutErrorInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void scripttimeouterror_class_init(as_object& where, const ObjectURI& uri)
+void
+scripttimeouterror_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 = getScriptTimeoutErrorInterface();
- cl = gl->createClass(&scripttimeouterror_ctor, proto);
- attachScriptTimeoutErrorStaticInterface(*cl);
- }
-
- // Register _global.ScriptTimeoutError
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, scripttimeouterror_ctor,
+ attachScriptTimeoutErrorInterface,
+ attachScriptTimeoutErrorStaticInterface, uri);
}
namespace {
@@ -81,23 +60,10 @@
}
-as_object*
-getScriptTimeoutErrorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachScriptTimeoutErrorInterface(*o);
- }
- return o.get();
-}
-
as_value
scripttimeouterror_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new ScriptTimeoutError_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/errors/StackOverflowError_as.cpp'
--- a/libcore/asobj/flash/errors/StackOverflowError_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/errors/StackOverflowError_as.cpp 2009-08-20
08:17:09 +0000
@@ -36,36 +36,15 @@
as_value stackoverflowerror_ctor(const fn_call& fn);
void attachStackOverflowErrorInterface(as_object& o);
void attachStackOverflowErrorStaticInterface(as_object& o);
- as_object* getStackOverflowErrorInterface();
-
}
-class StackOverflowError_as : public as_object
-{
-
-public:
-
- StackOverflowError_as()
- :
- as_object(getStackOverflowErrorInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void stackoverflowerror_class_init(as_object& where, const ObjectURI& uri)
+void
+stackoverflowerror_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 = getStackOverflowErrorInterface();
- cl = gl->createClass(&stackoverflowerror_ctor, proto);
- attachStackOverflowErrorStaticInterface(*cl);
- }
-
- // Register _global.StackOverflowError
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, stackoverflowerror_ctor,
+ attachStackOverflowErrorInterface,
+ attachStackOverflowErrorStaticInterface, uri);
}
namespace {
@@ -81,23 +60,10 @@
}
-as_object*
-getStackOverflowErrorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachStackOverflowErrorInterface(*o);
- }
- return o.get();
-}
-
as_value
stackoverflowerror_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new StackOverflowError_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/ActivityEvent_as.cpp'
--- a/libcore/asobj/flash/events/ActivityEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/ActivityEvent_as.cpp 2009-08-20 09:45:49
+0000
@@ -42,32 +42,12 @@
}
-class ActivityEvent_as : public as_object
-{
-
-public:
-
- ActivityEvent_as()
- :
- as_object(getActivityEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void activityevent_class_init(as_object& where, const ObjectURI& uri)
+void
+activityevent_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 = getActivityEventInterface();
- cl = gl->createClass(&activityevent_ctor, proto);
- attachActivityEventStaticInterface(*cl);
- }
-
- // Register _global.ActivityEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, activityevent_ctor,
attachActivityEventInterface,
+ attachActivityEventStaticInterface, uri);
}
namespace {
@@ -85,33 +65,16 @@
{
}
-as_object*
-getActivityEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachActivityEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-activityevent_toString(const fn_call& fn)
+activityevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<ActivityEvent_as> ptr =
- ensureType<ActivityEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-activityevent_ACTIVITY(const fn_call& fn)
+activityevent_ACTIVITY(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<ActivityEvent_as> ptr =
- ensureType<ActivityEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +82,7 @@
as_value
activityevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new ActivityEvent_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/AsyncErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/AsyncErrorEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/AsyncErrorEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -38,36 +38,14 @@
as_value asyncerrorevent_ctor(const fn_call& fn);
void attachAsyncErrorEventInterface(as_object& o);
void attachAsyncErrorEventStaticInterface(as_object& o);
- as_object* getAsyncErrorEventInterface();
-
}
-class AsyncErrorEvent_as : public as_object
-{
-
-public:
-
- AsyncErrorEvent_as()
- :
- as_object(getAsyncErrorEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void asyncerrorevent_class_init(as_object& where, const ObjectURI& uri)
+void
+asyncerrorevent_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 = getAsyncErrorEventInterface();
- cl = gl->createClass(&asyncerrorevent_ctor, proto);
- attachAsyncErrorEventStaticInterface(*cl);
- }
-
- // Register _global.AsyncErrorEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, asyncerrorevent_ctor,
attachAsyncErrorEventInterface,
+ attachAsyncErrorEventStaticInterface, uri);
}
namespace {
@@ -85,33 +63,16 @@
{
}
-as_object*
-getAsyncErrorEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachAsyncErrorEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-asyncerrorevent_toString(const fn_call& fn)
+asyncerrorevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<AsyncErrorEvent_as> ptr =
- ensureType<AsyncErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-asyncerrorevent_ASYNC_ERROR(const fn_call& fn)
+asyncerrorevent_ASYNC_ERROR(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<AsyncErrorEvent_as> ptr =
- ensureType<AsyncErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +80,8 @@
as_value
asyncerrorevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new AsyncErrorEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/ContextMenuEvent_as.cpp'
--- a/libcore/asobj/flash/events/ContextMenuEvent_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/events/ContextMenuEvent_as.cpp 2009-08-20
10:02:42 +0000
@@ -43,32 +43,12 @@
}
-class ContextMenuEvent_as : public as_object
-{
-
-public:
-
- ContextMenuEvent_as()
- :
- as_object(getContextMenuEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void contextmenuevent_class_init(as_object& where, const ObjectURI& uri)
+void
+contextmenuevent_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 = getContextMenuEventInterface();
- cl = gl->createClass(&contextmenuevent_ctor, proto);
- attachContextMenuEventStaticInterface(*cl);
- }
-
- // Register _global.ContextMenuEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, contextmenuevent_ctor,
attachContextMenuEventInterface,
+ attachContextMenuEventStaticInterface, uri);
}
namespace {
@@ -88,43 +68,23 @@
}
-as_object*
-getContextMenuEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachContextMenuEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-contextmenuevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<ContextMenuEvent_as> ptr =
- ensureType<ContextMenuEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-contextmenuevent_MENU_ITEM_SELECT(const fn_call& fn)
-{
- boost::intrusive_ptr<ContextMenuEvent_as> ptr =
- ensureType<ContextMenuEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-contextmenuevent_MENU_SELECT(const fn_call& fn)
-{
- boost::intrusive_ptr<ContextMenuEvent_as> ptr =
- ensureType<ContextMenuEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+contextmenuevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+contextmenuevent_MENU_ITEM_SELECT(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+contextmenuevent_MENU_SELECT(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -132,9 +92,8 @@
as_value
contextmenuevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new ContextMenuEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/DataEvent_as.cpp'
--- a/libcore/asobj/flash/events/DataEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/DataEvent_as.cpp 2009-08-20 09:45:49
+0000
@@ -43,32 +43,12 @@
}
-class DataEvent_as : public as_object
-{
-
-public:
-
- DataEvent_as()
- :
- as_object(getDataEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void dataevent_class_init(as_object& where, const ObjectURI& uri)
+void
+dataevent_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 = getDataEventInterface();
- cl = gl->createClass(&dataevent_ctor, proto);
- attachDataEventStaticInterface(*cl);
- }
-
- // Register _global.DataEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, dataevent_ctor, attachDataEventInterface,
+ attachDataEventStaticInterface, uri);
}
namespace {
@@ -88,43 +68,23 @@
}
-as_object*
-getDataEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachDataEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-dataevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<DataEvent_as> ptr =
- ensureType<DataEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-dataevent_DATA(const fn_call& fn)
-{
- boost::intrusive_ptr<DataEvent_as> ptr =
- ensureType<DataEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-dataevent_UPLOAD_COMPLETE_DATA(const fn_call& fn)
-{
- boost::intrusive_ptr<DataEvent_as> ptr =
- ensureType<DataEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+dataevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+dataevent_DATA(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+dataevent_UPLOAD_COMPLETE_DATA(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -132,9 +92,8 @@
as_value
dataevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new DataEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/ErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/ErrorEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/ErrorEvent_as.cpp 2009-08-20 09:45:49
+0000
@@ -42,32 +42,12 @@
}
-class ErrorEvent_as : public as_object
-{
-
-public:
-
- ErrorEvent_as()
- :
- as_object(getErrorEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void errorevent_class_init(as_object& where, const ObjectURI& uri)
+void
+errorevent_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 = getErrorEventInterface();
- cl = gl->createClass(&errorevent_ctor, proto);
- attachErrorEventStaticInterface(*cl);
- }
-
- // Register _global.ErrorEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, errorevent_ctor, attachErrorEventInterface,
+ attachErrorEventStaticInterface, uri);
}
namespace {
@@ -85,33 +65,16 @@
{
}
-as_object*
-getErrorEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachErrorEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-errorevent_toString(const fn_call& fn)
+errorevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<ErrorEvent_as> ptr =
- ensureType<ErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-errorevent_ERROR(const fn_call& fn)
+errorevent_ERROR(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<ErrorEvent_as> ptr =
- ensureType<ErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +82,7 @@
as_value
errorevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new ErrorEvent_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/EventDispatcher_as.cpp'
--- a/libcore/asobj/flash/events/EventDispatcher_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/EventDispatcher_as.cpp 2009-08-20 10:02:42
+0000
@@ -42,36 +42,16 @@
as_value eventdispatcher_ctor(const fn_call& fn);
void attachEventDispatcherInterface(as_object& o);
void attachEventDispatcherStaticInterface(as_object& o);
- as_object* getEventDispatcherInterface();
}
-class EventDispatcher_as : public as_object
-{
-
-public:
-
- EventDispatcher_as()
- :
- as_object(getEventDispatcherInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void eventdispatcher_class_init(as_object& where, const ObjectURI& uri)
+void
+eventdispatcher_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 = getEventDispatcherInterface();
- cl = gl->createClass(&eventdispatcher_ctor, proto);
- attachEventDispatcherStaticInterface(*cl);
- }
-
- // Register _global.EventDispatcher
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, eventdispatcher_ctor,
+ attachEventDispatcherInterface,
+ attachEventDispatcherStaticInterface, uri);
}
namespace {
@@ -94,73 +74,44 @@
}
-as_object*
-getEventDispatcherInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachEventDispatcherInterface(*o);
- }
- return o.get();
-}
-
-as_value
-eventdispatcher_dispatchEvent(const fn_call& fn)
-{
- boost::intrusive_ptr<EventDispatcher_as> ptr =
- ensureType<EventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-eventdispatcher_hasEventListener(const fn_call& fn)
-{
- boost::intrusive_ptr<EventDispatcher_as> ptr =
- ensureType<EventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-eventdispatcher_removeEventListener(const fn_call& fn)
-{
- boost::intrusive_ptr<EventDispatcher_as> ptr =
- ensureType<EventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-eventdispatcher_willTrigger(const fn_call& fn)
-{
- boost::intrusive_ptr<EventDispatcher_as> ptr =
- ensureType<EventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-eventdispatcher_activate(const fn_call& fn)
-{
- boost::intrusive_ptr<EventDispatcher_as> ptr =
- ensureType<EventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-eventdispatcher_deactivate(const fn_call& fn)
-{
- boost::intrusive_ptr<EventDispatcher_as> ptr =
- ensureType<EventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+eventdispatcher_dispatchEvent(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+eventdispatcher_hasEventListener(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+eventdispatcher_removeEventListener(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+eventdispatcher_willTrigger(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+eventdispatcher_activate(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+eventdispatcher_deactivate(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -168,9 +119,7 @@
as_value
eventdispatcher_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new EventDispatcher_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/EventPhase_as.cpp'
--- a/libcore/asobj/flash/events/EventPhase_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/EventPhase_as.cpp 2009-08-20 10:09:15
+0000
@@ -36,36 +36,14 @@
as_value eventphase_ctor(const fn_call& fn);
void attachEventPhaseInterface(as_object& o);
void attachEventPhaseStaticInterface(as_object& o);
- as_object* getEventPhaseInterface();
-
}
-class EventPhase_as : public as_object
-{
-
-public:
-
- EventPhase_as()
- :
- as_object(getEventPhaseInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void eventphase_class_init(as_object& where, const ObjectURI& uri)
+void
+eventphase_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 = getEventPhaseInterface();
- cl = gl->createClass(&eventphase_ctor, proto);
- attachEventPhaseStaticInterface(*cl);
- }
-
- // Register _global.EventPhase
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, eventphase_ctor, attachEventPhaseInterface,
+ attachEventPhaseStaticInterface, uri);
}
namespace {
@@ -81,23 +59,11 @@
}
-as_object*
-getEventPhaseInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachEventPhaseInterface(*o);
- }
- return o.get();
-}
-
as_value
eventphase_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new EventPhase_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/Event_as.cpp'
--- a/libcore/asobj/flash/events/Event_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/events/Event_as.cpp 2009-08-20 10:02:42 +0000
@@ -69,36 +69,14 @@
as_value event_ctor(const fn_call& fn);
void attachEventInterface(as_object& o);
void attachEventStaticInterface(as_object& o);
- as_object* getEventInterface();
-
}
-class Event_as : public as_object
-{
-
-public:
-
- Event_as()
- :
- as_object(getEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void event_class_init(as_object& where, const ObjectURI& uri)
+void
+event_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 = getEventInterface();
- cl = gl->createClass(&event_ctor, proto);
- attachEventStaticInterface(*cl);
- }
-
- // Register _global.Event
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, event_ctor, attachEventInterface,
+ attachEventStaticInterface, uri);
}
namespace {
@@ -148,343 +126,233 @@
}
-as_object*
-getEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-event_formatToString(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_isDefaultPrevented(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_preventDefault(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_stopImmediatePropagation(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_stopPropagation(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_ACTIVATE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_ADDED(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_ADDED_TO_STAGE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_CANCEL(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_CHANGE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_CLOSE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_COMPLETE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_CONNECT(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_DEACTIVATE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_DISPLAYING(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_ENTER_FRAME(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_FULLSCREEN(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_ID3(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_INIT(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_MOUSE_LEAVE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_OPEN(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_REMOVED(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_REMOVED_FROM_STAGE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_RENDER(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_RESIZE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_SCROLL(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_SELECT(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_SOUND_COMPLETE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_TAB_CHILDREN_CHANGE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_TAB_ENABLED_CHANGE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_TAB_INDEX_CHANGE(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-event_UNLOAD(const fn_call& fn)
-{
- boost::intrusive_ptr<Event_as> ptr =
- ensureType<Event_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+event_formatToString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_isDefaultPrevented(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_preventDefault(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_stopImmediatePropagation(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_stopPropagation(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_ACTIVATE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_ADDED(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_ADDED_TO_STAGE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_CANCEL(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_CHANGE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_CLOSE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_COMPLETE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_CONNECT(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_DEACTIVATE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_DISPLAYING(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_ENTER_FRAME(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_FULLSCREEN(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_ID3(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_INIT(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_MOUSE_LEAVE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_OPEN(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_REMOVED(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_REMOVED_FROM_STAGE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_RENDER(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_RESIZE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_SCROLL(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_SELECT(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_SOUND_COMPLETE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_TAB_CHILDREN_CHANGE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_TAB_ENABLED_CHANGE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_TAB_INDEX_CHANGE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+event_UNLOAD(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -492,9 +360,7 @@
as_value
event_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new Event_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/FocusEvent_as.cpp'
--- a/libcore/asobj/flash/events/FocusEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/FocusEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -41,36 +41,14 @@
as_value focusevent_ctor(const fn_call& fn);
void attachFocusEventInterface(as_object& o);
void attachFocusEventStaticInterface(as_object& o);
- as_object* getFocusEventInterface();
-
}
-class FocusEvent_as : public as_object
-{
-
-public:
-
- FocusEvent_as()
- :
- as_object(getFocusEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void focusevent_class_init(as_object& where, const ObjectURI& uri)
+void
+focusevent_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 = getFocusEventInterface();
- cl = gl->createClass(&focusevent_ctor, proto);
- attachFocusEventStaticInterface(*cl);
- }
-
- // Register _global.FocusEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, focusevent_ctor, attachFocusEventInterface,
+ attachFocusEventStaticInterface, uri);
}
namespace {
@@ -91,63 +69,37 @@
{
}
-as_object*
-getFocusEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachFocusEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-focusevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<FocusEvent_as> ptr =
- ensureType<FocusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-focusevent_FOCUS_IN(const fn_call& fn)
-{
- boost::intrusive_ptr<FocusEvent_as> ptr =
- ensureType<FocusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-focusevent_FOCUS_OUT(const fn_call& fn)
-{
- boost::intrusive_ptr<FocusEvent_as> ptr =
- ensureType<FocusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-focusevent_KEY_FOCUS_CHANGE(const fn_call& fn)
-{
- boost::intrusive_ptr<FocusEvent_as> ptr =
- ensureType<FocusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-focusevent_MOUSE_FOCUS_CHANGE(const fn_call& fn)
-{
- boost::intrusive_ptr<FocusEvent_as> ptr =
- ensureType<FocusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+focusevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+focusevent_FOCUS_IN(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+focusevent_FOCUS_OUT(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+focusevent_KEY_FOCUS_CHANGE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+focusevent_MOUSE_FOCUS_CHANGE(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -155,9 +107,7 @@
as_value
focusevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new FocusEvent_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/FullScreenEvent_as.cpp'
--- a/libcore/asobj/flash/events/FullScreenEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/FullScreenEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -38,36 +38,15 @@
as_value fullscreenevent_ctor(const fn_call& fn);
void attachFullScreenEventInterface(as_object& o);
void attachFullScreenEventStaticInterface(as_object& o);
- as_object* getFullScreenEventInterface();
}
-class FullScreenEvent_as : public as_object
-{
-
-public:
-
- FullScreenEvent_as()
- :
- as_object(getFullScreenEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void fullscreenevent_class_init(as_object& where, const ObjectURI& uri)
+void
+fullscreenevent_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 = getFullScreenEventInterface();
- cl = gl->createClass(&fullscreenevent_ctor, proto);
- attachFullScreenEventStaticInterface(*cl);
- }
-
- // Register _global.FullScreenEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, fullscreenevent_ctor,
attachFullScreenEventInterface,
+ attachFullScreenEventStaticInterface, uri);
}
namespace {
@@ -85,33 +64,16 @@
{
}
-as_object*
-getFullScreenEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachFullScreenEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-fullscreenevent_toString(const fn_call& fn)
+fullscreenevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<FullScreenEvent_as> ptr =
- ensureType<FullScreenEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-fullscreenevent_FULL_SCREEN(const fn_call& fn)
+fullscreenevent_FULL_SCREEN(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<FullScreenEvent_as> ptr =
- ensureType<FullScreenEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +81,8 @@
as_value
fullscreenevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new FullScreenEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/HTTPStatusEvent_as.cpp'
--- a/libcore/asobj/flash/events/HTTPStatusEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/HTTPStatusEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -38,36 +38,14 @@
as_value httpstatusevent_ctor(const fn_call& fn);
void attachHTTPStatusEventInterface(as_object& o);
void attachHTTPStatusEventStaticInterface(as_object& o);
- as_object* getHTTPStatusEventInterface();
-
}
-class HTTPStatusEvent_as : public as_object
-{
-
-public:
-
- HTTPStatusEvent_as()
- :
- as_object(getHTTPStatusEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void httpstatusevent_class_init(as_object& where, const ObjectURI& uri)
+void
+httpstatusevent_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 = getHTTPStatusEventInterface();
- cl = gl->createClass(&httpstatusevent_ctor, proto);
- attachHTTPStatusEventStaticInterface(*cl);
- }
-
- // Register _global.HTTPStatusEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, httpstatusevent_ctor,
attachHTTPStatusEventInterface,
+ attachHTTPStatusEventStaticInterface, uri);
}
namespace {
@@ -85,33 +63,16 @@
{
}
-as_object*
-getHTTPStatusEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachHTTPStatusEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-httpstatusevent_toString(const fn_call& fn)
+httpstatusevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<HTTPStatusEvent_as> ptr =
- ensureType<HTTPStatusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-httpstatusevent_HTTP_STATUS(const fn_call& fn)
+httpstatusevent_HTTP_STATUS(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<HTTPStatusEvent_as> ptr =
- ensureType<HTTPStatusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +80,8 @@
as_value
httpstatusevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new HTTPStatusEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/IEventDispatcher_as.cpp'
--- a/libcore/asobj/flash/events/IEventDispatcher_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/events/IEventDispatcher_as.cpp 2009-08-20
10:02:42 +0000
@@ -40,36 +40,15 @@
as_value ieventdispatcher_ctor(const fn_call& fn);
void attachIEventDispatcherInterface(as_object& o);
void attachIEventDispatcherStaticInterface(as_object& o);
- as_object* getIEventDispatcherInterface();
-
}
-class IEventDispatcher_as : public as_object
-{
-
-public:
-
- IEventDispatcher_as()
- :
- as_object(getIEventDispatcherInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void ieventdispatcher_class_init(as_object& where, const ObjectURI& uri)
+void
+ieventdispatcher_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 = getIEventDispatcherInterface();
- cl = gl->createClass(&ieventdispatcher_ctor, proto);
- attachIEventDispatcherStaticInterface(*cl);
- }
-
- // Register _global.IEventDispatcher
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, ieventdispatcher_ctor,
+ attachIEventDispatcherInterface,
+ attachIEventDispatcherStaticInterface, uri);
}
namespace {
@@ -89,53 +68,30 @@
{
}
-as_object*
-getIEventDispatcherInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIEventDispatcherInterface(*o);
- }
- return o.get();
-}
-
-as_value
-ieventdispatcher_dispatchEvent(const fn_call& fn)
-{
- boost::intrusive_ptr<IEventDispatcher_as> ptr =
- ensureType<IEventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-ieventdispatcher_hasEventListener(const fn_call& fn)
-{
- boost::intrusive_ptr<IEventDispatcher_as> ptr =
- ensureType<IEventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-ieventdispatcher_removeEventListener(const fn_call& fn)
-{
- boost::intrusive_ptr<IEventDispatcher_as> ptr =
- ensureType<IEventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-ieventdispatcher_willTrigger(const fn_call& fn)
-{
- boost::intrusive_ptr<IEventDispatcher_as> ptr =
- ensureType<IEventDispatcher_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+ieventdispatcher_dispatchEvent(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+ieventdispatcher_hasEventListener(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+ieventdispatcher_removeEventListener(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+ieventdispatcher_willTrigger(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -143,9 +99,7 @@
as_value
ieventdispatcher_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IEventDispatcher_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/IMEEvent_as.cpp'
--- a/libcore/asobj/flash/events/IMEEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/IMEEvent_as.cpp 2009-08-20 09:45:49
+0000
@@ -38,36 +38,14 @@
as_value imeevent_ctor(const fn_call& fn);
void attachIMEEventInterface(as_object& o);
void attachIMEEventStaticInterface(as_object& o);
- as_object* getIMEEventInterface();
-
}
-class IMEEvent_as : public as_object
-{
-
-public:
-
- IMEEvent_as()
- :
- as_object(getIMEEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void imeevent_class_init(as_object& where, const ObjectURI& uri)
+void
+imeevent_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 = getIMEEventInterface();
- cl = gl->createClass(&imeevent_ctor, proto);
- attachIMEEventStaticInterface(*cl);
- }
-
- // Register _global.IMEEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, imeevent_ctor, attachIMEEventInterface,
+ attachIMEEventStaticInterface, uri);
}
namespace {
@@ -86,33 +64,16 @@
}
-as_object*
-getIMEEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIMEEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-imeevent_toString(const fn_call& fn)
+imeevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<IMEEvent_as> ptr =
- ensureType<IMEEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-imeevent_IME_COMPOSITION(const fn_call& fn)
+imeevent_IME_COMPOSITION(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<IMEEvent_as> ptr =
- ensureType<IMEEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -120,9 +81,8 @@
as_value
imeevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IMEEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/IOErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/IOErrorEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/IOErrorEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -38,36 +38,14 @@
as_value ioerrorevent_ctor(const fn_call& fn);
void attachIOErrorEventInterface(as_object& o);
void attachIOErrorEventStaticInterface(as_object& o);
- as_object* getIOErrorEventInterface();
-
}
-class IOErrorEvent_as : public as_object
-{
-
-public:
-
- IOErrorEvent_as()
- :
- as_object(getIOErrorEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void ioerrorevent_class_init(as_object& where, const ObjectURI& uri)
+void
+ioerrorevent_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 = getIOErrorEventInterface();
- cl = gl->createClass(&ioerrorevent_ctor, proto);
- attachIOErrorEventStaticInterface(*cl);
- }
-
- // Register _global.IOErrorEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, ioerrorevent_ctor,
attachIOErrorEventInterface,
+ attachIOErrorEventStaticInterface, uri);
}
namespace {
@@ -85,33 +63,16 @@
{
}
-as_object*
-getIOErrorEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIOErrorEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-ioerrorevent_toString(const fn_call& fn)
+ioerrorevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<IOErrorEvent_as> ptr =
- ensureType<IOErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-ioerrorevent_IO_ERROR(const fn_call& fn)
+ioerrorevent_IO_ERROR(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<IOErrorEvent_as> ptr =
- ensureType<IOErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +80,8 @@
as_value
ioerrorevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IOErrorEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/KeyboardEvent_as.cpp'
--- a/libcore/asobj/flash/events/KeyboardEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/KeyboardEvent_as.cpp 2009-08-20 10:02:42
+0000
@@ -40,36 +40,15 @@
as_value keyboardevent_ctor(const fn_call& fn);
void attachKeyboardEventInterface(as_object& o);
void attachKeyboardEventStaticInterface(as_object& o);
- as_object* getKeyboardEventInterface();
-
}
-class KeyboardEvent_as : public as_object
-{
-
-public:
-
- KeyboardEvent_as()
- :
- as_object(getKeyboardEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void keyboardevent_class_init(as_object& where, const ObjectURI& uri)
+void
+keyboardevent_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 = getKeyboardEventInterface();
- cl = gl->createClass(&keyboardevent_ctor, proto);
- attachKeyboardEventStaticInterface(*cl);
- }
-
- // Register _global.KeyboardEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, keyboardevent_ctor,
+ attachKeyboardEventInterface,
+ attachKeyboardEventStaticInterface, uri);
}
namespace {
@@ -89,53 +68,30 @@
{
}
-as_object*
-getKeyboardEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachKeyboardEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-keyboardevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<KeyboardEvent_as> ptr =
- ensureType<KeyboardEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-keyboardevent_updateAfterEvent(const fn_call& fn)
-{
- boost::intrusive_ptr<KeyboardEvent_as> ptr =
- ensureType<KeyboardEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-keyboardevent_KEY_DOWN(const fn_call& fn)
-{
- boost::intrusive_ptr<KeyboardEvent_as> ptr =
- ensureType<KeyboardEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-keyboardevent_KEY_UP(const fn_call& fn)
-{
- boost::intrusive_ptr<KeyboardEvent_as> ptr =
- ensureType<KeyboardEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+keyboardevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+keyboardevent_updateAfterEvent(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+keyboardevent_KEY_DOWN(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+keyboardevent_KEY_UP(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -143,9 +99,7 @@
as_value
keyboardevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new KeyboardEvent_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/MouseEvent_as.cpp'
--- a/libcore/asobj/flash/events/MouseEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/MouseEvent_as.cpp 2009-08-20 10:02:42
+0000
@@ -48,36 +48,15 @@
as_value mouseevent_ctor(const fn_call& fn);
void attachMouseEventInterface(as_object& o);
void attachMouseEventStaticInterface(as_object& o);
- as_object* getMouseEventInterface();
-
}
-class MouseEvent_as : public as_object
-{
-
-public:
-
- MouseEvent_as()
- :
- as_object(getMouseEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void mouseevent_class_init(as_object& where, const ObjectURI& uri)
+void
+mouseevent_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 = getMouseEventInterface();
- cl = gl->createClass(&mouseevent_ctor, proto);
- attachMouseEventStaticInterface(*cl);
- }
-
- // Register _global.MouseEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, mouseevent_ctor,
+ attachMouseEventInterface,
+ attachMouseEventStaticInterface, uri);
}
namespace {
@@ -106,133 +85,86 @@
}
-as_object*
-getMouseEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachMouseEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-mouseevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_updateAfterEvent(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_CLICK(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_DOUBLE_CLICK(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_MOUSE_DOWN(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_MOUSE_MOVE(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_MOUSE_OUT(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_MOUSE_OVER(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_MOUSE_UP(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_MOUSE_WHEEL(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_ROLL_OUT(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-mouseevent_ROLL_OVER(const fn_call& fn)
-{
- boost::intrusive_ptr<MouseEvent_as> ptr =
- ensureType<MouseEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+mouseevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_updateAfterEvent(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_CLICK(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_DOUBLE_CLICK(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_MOUSE_DOWN(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_MOUSE_MOVE(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_MOUSE_OUT(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_MOUSE_OVER(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_MOUSE_UP(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_MOUSE_WHEEL(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_ROLL_OUT(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+mouseevent_ROLL_OVER(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -240,9 +172,7 @@
as_value
mouseevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new MouseEvent_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/NetStatusEvent_as.cpp'
--- a/libcore/asobj/flash/events/NetStatusEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/NetStatusEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -38,36 +38,14 @@
as_value netstatusevent_ctor(const fn_call& fn);
void attachNetStatusEventInterface(as_object& o);
void attachNetStatusEventStaticInterface(as_object& o);
- as_object* getNetStatusEventInterface();
-
}
-class NetStatusEvent_as : public as_object
-{
-
-public:
-
- NetStatusEvent_as()
- :
- as_object(getNetStatusEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void netstatusevent_class_init(as_object& where, const ObjectURI& uri)
+void
+netstatusevent_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 = getNetStatusEventInterface();
- cl = gl->createClass(&netstatusevent_ctor, proto);
- attachNetStatusEventStaticInterface(*cl);
- }
-
- // Register _global.NetStatusEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, netstatusevent_ctor,
attachNetStatusEventInterface,
+ attachNetStatusEventStaticInterface, uri);
}
namespace {
@@ -85,33 +63,16 @@
{
}
-as_object*
-getNetStatusEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachNetStatusEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-netstatusevent_toString(const fn_call& fn)
+netstatusevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<NetStatusEvent_as> ptr =
- ensureType<NetStatusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-netstatusevent_NET_STATUS(const fn_call& fn)
+netstatusevent_NET_STATUS(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<NetStatusEvent_as> ptr =
- ensureType<NetStatusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +80,8 @@
as_value
netstatusevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new NetStatusEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/ProgressEvent_as.cpp'
--- a/libcore/asobj/flash/events/ProgressEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/ProgressEvent_as.cpp 2009-08-20 10:02:42
+0000
@@ -39,36 +39,15 @@
as_value progressevent_ctor(const fn_call& fn);
void attachProgressEventInterface(as_object& o);
void attachProgressEventStaticInterface(as_object& o);
- as_object* getProgressEventInterface();
-
}
-class ProgressEvent_as : public as_object
-{
-
-public:
-
- ProgressEvent_as()
- :
- as_object(getProgressEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void progressevent_class_init(as_object& where, const ObjectURI& uri)
+void
+progressevent_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 = getProgressEventInterface();
- cl = gl->createClass(&progressevent_ctor, proto);
- attachProgressEventStaticInterface(*cl);
- }
-
- // Register _global.ProgressEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, progressevent_ctor,
+ attachProgressEventInterface,
+ attachProgressEventStaticInterface, uri);
}
namespace {
@@ -88,43 +67,23 @@
}
-as_object*
-getProgressEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachProgressEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-progressevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<ProgressEvent_as> ptr =
- ensureType<ProgressEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-progressevent_PROGRESS(const fn_call& fn)
-{
- boost::intrusive_ptr<ProgressEvent_as> ptr =
- ensureType<ProgressEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-progressevent_SOCKET_DATA(const fn_call& fn)
-{
- boost::intrusive_ptr<ProgressEvent_as> ptr =
- ensureType<ProgressEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+progressevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+progressevent_PROGRESS(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+progressevent_SOCKET_DATA(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -132,9 +91,7 @@
as_value
progressevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new ProgressEvent_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/SecurityErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/SecurityErrorEvent_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/events/SecurityErrorEvent_as.cpp 2009-08-20
10:09:15 +0000
@@ -38,36 +38,14 @@
as_value securityerrorevent_ctor(const fn_call& fn);
void attachSecurityErrorEventInterface(as_object& o);
void attachSecurityErrorEventStaticInterface(as_object& o);
- as_object* getSecurityErrorEventInterface();
-
}
-class SecurityErrorEvent_as : public as_object
-{
-
-public:
-
- SecurityErrorEvent_as()
- :
- as_object(getSecurityErrorEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void securityerrorevent_class_init(as_object& where, const ObjectURI& uri)
+void
+securityerrorevent_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 = getSecurityErrorEventInterface();
- cl = gl->createClass(&securityerrorevent_ctor, proto);
- attachSecurityErrorEventStaticInterface(*cl);
- }
-
- // Register _global.SecurityErrorEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, securityerrorevent_ctor,
attachSecurityErrorEventInterface,
+ attachSecurityErrorEventStaticInterface, uri);
}
namespace {
@@ -85,33 +63,16 @@
{
}
-as_object*
-getSecurityErrorEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachSecurityErrorEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-securityerrorevent_toString(const fn_call& fn)
+securityerrorevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<SecurityErrorEvent_as> ptr =
- ensureType<SecurityErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-securityerrorevent_SECURITY_ERROR(const fn_call& fn)
+securityerrorevent_SECURITY_ERROR(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<SecurityErrorEvent_as> ptr =
- ensureType<SecurityErrorEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +80,8 @@
as_value
securityerrorevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new SecurityErrorEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/StatusEvent_as.cpp'
--- a/libcore/asobj/flash/events/StatusEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/StatusEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -38,36 +38,14 @@
as_value statusevent_ctor(const fn_call& fn);
void attachStatusEventInterface(as_object& o);
void attachStatusEventStaticInterface(as_object& o);
- as_object* getStatusEventInterface();
-
}
-class StatusEvent_as : public as_object
-{
-
-public:
-
- StatusEvent_as()
- :
- as_object(getStatusEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void statusevent_class_init(as_object& where, const ObjectURI& uri)
+void
+statusevent_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 = getStatusEventInterface();
- cl = gl->createClass(&statusevent_ctor, proto);
- attachStatusEventStaticInterface(*cl);
- }
-
- // Register _global.StatusEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, statusevent_ctor, attachStatusEventInterface,
+ attachStatusEventStaticInterface, uri);
}
namespace {
@@ -85,33 +63,16 @@
{
}
-as_object*
-getStatusEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachStatusEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-statusevent_toString(const fn_call& fn)
+statusevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<StatusEvent_as> ptr =
- ensureType<StatusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-statusevent_STATUS(const fn_call& fn)
+statusevent_STATUS(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<StatusEvent_as> ptr =
- ensureType<StatusEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +80,8 @@
as_value
statusevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new StatusEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/SyncEvent_as.cpp'
--- a/libcore/asobj/flash/events/SyncEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/SyncEvent_as.cpp 2009-08-20 10:09:15
+0000
@@ -38,36 +38,14 @@
as_value syncevent_ctor(const fn_call& fn);
void attachSyncEventInterface(as_object& o);
void attachSyncEventStaticInterface(as_object& o);
- as_object* getSyncEventInterface();
-
}
-class SyncEvent_as : public as_object
-{
-
-public:
-
- SyncEvent_as()
- :
- as_object(getSyncEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void syncevent_class_init(as_object& where, const ObjectURI& uri)
+void
+syncevent_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 = getSyncEventInterface();
- cl = gl->createClass(&syncevent_ctor, proto);
- attachSyncEventStaticInterface(*cl);
- }
-
- // Register _global.SyncEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, syncevent_ctor, attachSyncEventInterface,
+ attachSyncEventStaticInterface, uri);
}
namespace {
@@ -85,33 +63,16 @@
{
}
-as_object*
-getSyncEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachSyncEventInterface(*o);
- }
- return o.get();
-}
-
as_value
-syncevent_toString(const fn_call& fn)
+syncevent_toString(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<SyncEvent_as> ptr =
- ensureType<SyncEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
as_value
-syncevent_SYNC(const fn_call& fn)
+syncevent_SYNC(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<SyncEvent_as> ptr =
- ensureType<SyncEvent_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -119,9 +80,8 @@
as_value
syncevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new SyncEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/TextEvent_as.cpp'
--- a/libcore/asobj/flash/events/TextEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/TextEvent_as.cpp 2009-08-20 10:02:42
+0000
@@ -39,36 +39,14 @@
as_value textevent_ctor(const fn_call& fn);
void attachTextEventInterface(as_object& o);
void attachTextEventStaticInterface(as_object& o);
- as_object* getTextEventInterface();
-
}
-class TextEvent_as : public as_object
-{
-
-public:
-
- TextEvent_as()
- :
- as_object(getTextEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void textevent_class_init(as_object& where, const ObjectURI& uri)
+void
+textevent_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 = getTextEventInterface();
- cl = gl->createClass(&textevent_ctor, proto);
- attachTextEventStaticInterface(*cl);
- }
-
- // Register _global.TextEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, textevent_ctor, attachTextEventInterface,
+ attachTextEventStaticInterface, uri);
}
namespace {
@@ -88,43 +66,23 @@
}
-as_object*
-getTextEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachTextEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-textevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<TextEvent_as> ptr =
- ensureType<TextEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-textevent_LINK(const fn_call& fn)
-{
- boost::intrusive_ptr<TextEvent_as> ptr =
- ensureType<TextEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-textevent_TEXT_INPUT(const fn_call& fn)
-{
- boost::intrusive_ptr<TextEvent_as> ptr =
- ensureType<TextEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+textevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+textevent_LINK(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+textevent_TEXT_INPUT(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -132,9 +90,7 @@
as_value
textevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new TextEvent_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/events/TimerEvent_as.cpp'
--- a/libcore/asobj/flash/events/TimerEvent_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/events/TimerEvent_as.cpp 2009-08-20 10:02:42
+0000
@@ -40,36 +40,14 @@
as_value timerevent_ctor(const fn_call& fn);
void attachTimerEventInterface(as_object& o);
void attachTimerEventStaticInterface(as_object& o);
- as_object* getTimerEventInterface();
-
}
-class TimerEvent_as : public as_object
-{
-
-public:
-
- TimerEvent_as()
- :
- as_object(getTimerEventInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void timerevent_class_init(as_object& where, const ObjectURI& uri)
+void
+timerevent_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 = getTimerEventInterface();
- cl = gl->createClass(&timerevent_ctor, proto);
- attachTimerEventStaticInterface(*cl);
- }
-
- // Register _global.TimerEvent
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, timerevent_ctor, attachTimerEventInterface,
+ attachTimerEventStaticInterface, uri);
}
namespace {
@@ -89,53 +67,30 @@
{
}
-as_object*
-getTimerEventInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachTimerEventInterface(*o);
- }
- return o.get();
-}
-
-as_value
-timerevent_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<TimerEvent_as> ptr =
- ensureType<TimerEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-timerevent_updateAfterEvent(const fn_call& fn)
-{
- boost::intrusive_ptr<TimerEvent_as> ptr =
- ensureType<TimerEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-timerevent_TIMER(const fn_call& fn)
-{
- boost::intrusive_ptr<TimerEvent_as> ptr =
- ensureType<TimerEvent_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-timerevent_TIMER_COMPLETE(const fn_call& fn)
-{
- boost::intrusive_ptr<TimerEvent_as> ptr =
- ensureType<TimerEvent_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+timerevent_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+timerevent_updateAfterEvent(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+timerevent_TIMER(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+timerevent_TIMER_COMPLETE(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -143,9 +98,8 @@
as_value
timerevent_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new TimerEvent_as;
- return as_value(obj.get()); // will keep alive
+ return as_value(); // will keep alive
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/external/external_pkg.cpp'
--- a/libcore/asobj/flash/external/external_pkg.cpp 2009-07-16 09:44:26
+0000
+++ b/libcore/asobj/flash/external/external_pkg.cpp 2009-08-20 10:11:01
+0000
@@ -28,7 +28,9 @@
namespace gnash {
-static as_value
+namespace {
+
+as_value
get_flash_external_package(const fn_call& fn)
{
@@ -39,12 +41,14 @@
string_table& st = getStringTable(fn);
const string_table::key global = 0;
- externalinterface_class_init(*pkg,
+ externalinterface_class_init(*pkg,
ObjectURI(st.find("ExternalInterface"), global));
return pkg;
}
+}
+
void
flash_external_package_init(as_object& where, const ObjectURI& uri)
{
=== modified file 'libcore/asobj/flash/filters/BitmapFilterType_as.cpp'
--- a/libcore/asobj/flash/filters/BitmapFilterType_as.cpp 2009-07-28
11:58:27 +0000
+++ b/libcore/asobj/flash/filters/BitmapFilterType_as.cpp 2009-08-20
08:57:16 +0000
@@ -41,10 +41,7 @@
void
bitmapfiltertype_class_init(as_object& where, const ObjectURI& uri)
{
- boost::intrusive_ptr<as_object> cl = new as_object(getObjectInterface());
- attachBitmapFilterTypeStaticInterface(*cl);
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachBitmapFilterTypeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/geom/Matrix_as.cpp'
--- a/libcore/asobj/flash/geom/Matrix_as.cpp 2009-07-29 06:12:04 +0000
+++ b/libcore/asobj/flash/geom/Matrix_as.cpp 2009-08-20 06:55:15 +0000
@@ -419,9 +419,8 @@
return as_value();
}
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(point(0));
- args->push_back(point(1));
+ fn_call::Args args;
+ args += point(0), point(1);
as_value ret = pointCtor->constructInstance(fn.env(), args);
@@ -734,9 +733,8 @@
return as_value();
}
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(point(0) + tx.to_number());
- args->push_back(point(1) + ty.to_number());
+ fn_call::Args args;
+ args += point(0) + tx.to_number(), point(1) + ty.to_number();
as_value ret = pointCtor->constructInstance(fn.env(), args);
=== modified file 'libcore/asobj/flash/geom/Rectangle_as.cpp'
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp 2009-08-18 15:30:47 +0000
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp 2009-08-20 06:55:15 +0000
@@ -434,9 +434,8 @@
return as_value();
}
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(right);
- args->push_back(bottom);
+ fn_call::Args args;
+ args += right, bottom;
as_value ret = pointCtor->constructInstance(fn.env(), args);
return ret;
@@ -528,9 +527,8 @@
return as_value();
}
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(w);
- args->push_back(h);
+ fn_call::Args args;
+ args += w, h;
ret = pointCtor->constructInstance(fn.env(), args);
}
@@ -595,9 +593,8 @@
return as_value();
}
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->push_back(x);
- args->push_back(y);
+ fn_call::Args args;
+ args += x, y;
ret = pointCtor->constructInstance(fn.env(), args);
=== modified file 'libcore/asobj/flash/geom/Transform_as.cpp'
--- a/libcore/asobj/flash/geom/Transform_as.cpp 2009-07-16 09:37:37 +0000
+++ b/libcore/asobj/flash/geom/Transform_as.cpp 2009-08-20 06:55:15 +0000
@@ -136,17 +136,11 @@
}
// Construct a ColorTransform from the sprite cxform.
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
const cxform& c = ptr->getColorTransform();
- args->push_back(c.ra / factor);
- args->push_back(c.ga / factor);
- args->push_back(c.ba / factor);
- args->push_back(c.aa / factor);
- args->push_back(c.rb);
- args->push_back(c.gb);
- args->push_back(c.bb);
- args->push_back(c.ab);
+ fn_call::Args args;
+ args += c.ra / factor, c.ga / factor, c.ba / factor, c.aa / factor,
+ c.rb, c.gb, c.bb, c.ab;
boost::intrusive_ptr<as_object> colorTransformObj =
colorTransformCtor->constructInstance(fn.env(), args);
@@ -255,15 +249,15 @@
return as_value();
}
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
const SWFMatrix& m = ptr->getMatrix();
- args->push_back(m.sx / factor);
- args->push_back(m.shx / factor);
- args->push_back(m.shy / factor);
- args->push_back(m.sy / factor);
- args->push_back(twipsToPixels(m.tx));
- args->push_back(twipsToPixels(m.ty));
+ fn_call::Args args;
+ args += m.sx / factor,
+ m.shx / factor,
+ m.shy / factor,
+ m.sy / factor,
+ twipsToPixels(m.tx),
+ twipsToPixels(m.ty);
boost::intrusive_ptr<as_object> matrixObj =
matrixCtor->constructInstance(fn.env(), args);
=== modified file 'libcore/asobj/flash/media/ID3Info_as.cpp'
--- a/libcore/asobj/flash/media/ID3Info_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/media/ID3Info_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void id3info_class_init(as_object& where, const ObjectURI& uri)
+void
+id3info_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 = getID3InfoInterface();
- cl = gl->createClass(&id3info_ctor, proto);
- attachID3InfoStaticInterface(*cl);
- }
-
- // Register _global.ID3Info
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, id3info_ctor, attachID3InfoInterface,
+ attachID3InfoStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/media/SoundChannel_as.cpp'
--- a/libcore/asobj/flash/media/SoundChannel_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/media/SoundChannel_as.cpp 2009-08-20 08:57:16
+0000
@@ -53,20 +53,11 @@
};
// extern (used by Global.cpp)
-void soundchannel_class_init(as_object& where, const ObjectURI& uri)
+void
+soundchannel_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 = getSoundChannelInterface();
- cl = gl->createClass(&soundchannel_ctor, proto);
- attachSoundChannelStaticInterface(*cl);
- }
-
- // Register _global.SoundChannel
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, soundchannel_ctor,
attachSoundChannelInterface,
+ attachSoundChannelStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/media/SoundLoaderContext_as.cpp'
--- a/libcore/asobj/flash/media/SoundLoaderContext_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/media/SoundLoaderContext_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void soundloadercontext_class_init(as_object& where, const ObjectURI& uri)
+void
+soundloadercontext_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 = getSoundLoaderContextInterface();
- cl = gl->createClass(&soundloadercontext_ctor, proto);
- attachSoundLoaderContextStaticInterface(*cl);
- }
-
- // Register _global.SoundLoaderContext
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, soundloadercontext_ctor,
attachSoundLoaderContextInterface,
+ attachSoundLoaderContextStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/media/SoundMixer_as.cpp'
--- a/libcore/asobj/flash/media/SoundMixer_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/media/SoundMixer_as.cpp 2009-08-20 08:57:16
+0000
@@ -54,20 +54,11 @@
};
// extern (used by Global.cpp)
-void soundmixer_class_init(as_object& where, const ObjectURI& uri)
+void
+soundmixer_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 = getSoundMixerInterface();
- cl = gl->createClass(&soundmixer_ctor, proto);
- attachSoundMixerStaticInterface(*cl);
- }
-
- // Register _global.SoundMixer
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, soundmixer_ctor, attachSoundMixerInterface,
+ attachSoundMixerStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/media/SoundTransform_as.cpp'
--- a/libcore/asobj/flash/media/SoundTransform_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/media/SoundTransform_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void soundtransform_class_init(as_object& where, const ObjectURI& uri)
+void
+soundtransform_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 = getSoundTransformInterface();
- cl = gl->createClass(&soundtransform_ctor, proto);
- attachSoundTransformStaticInterface(*cl);
- }
-
- // Register _global.SoundTransform
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, soundtransform_ctor,
attachSoundTransformInterface,
+ attachSoundTransformStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/media/Video_as.cpp'
--- a/libcore/asobj/flash/media/Video_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/media/Video_as.cpp 2009-08-20 08:57:16 +0000
@@ -54,20 +54,11 @@
};
// extern (used by Global.cpp)
-void video_class_init(as_object& where, const ObjectURI& uri)
+void
+video_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 = getVideoInterface();
- cl = gl->createClass(&video_ctor, proto);
- attachVideoStaticInterface(*cl);
- }
-
- // Register _global.Video
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, video_ctor, attachVideoInterface,
+ attachVideoStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/media/media_as.cpp'
--- a/libcore/asobj/flash/media/media_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/media/media_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void media_class_init(as_object& where, const ObjectURI& uri)
+void
+media_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 = getmediaInterface();
- cl = gl->createClass(&media_ctor, proto);
- attachmediaStaticInterface(*cl);
- }
-
- // Register _global.media
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, media_ctor, attachmediaInterface,
+ attachmediaStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/FileFilter_as.cpp'
--- a/libcore/asobj/flash/net/FileFilter_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/net/FileFilter_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void filefilter_class_init(as_object& where, const ObjectURI& uri)
+void
+filefilter_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 = getFileFilterInterface();
- cl = gl->createClass(&filefilter_ctor, proto);
- attachFileFilterStaticInterface(*cl);
- }
-
- // Register _global.FileFilter
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, filefilter_ctor, attachFileFilterInterface,
+ attachFileFilterStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/FileReferenceList_as.cpp'
--- a/libcore/asobj/flash/net/FileReferenceList_as.cpp 2009-08-18 15:30:47
+0000
+++ b/libcore/asobj/flash/net/FileReferenceList_as.cpp 2009-08-20 08:57:16
+0000
@@ -1,4 +1,4 @@
-// FileReferenceList_as.cpp: ActionScript "FileReferenceList" class, for
Gnash.
+// filereferencelist_as.cpp: ActionScript "FileReferenceList" class, for
Gnash.
//
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
//
@@ -36,22 +36,26 @@
namespace gnash {
-static as_value FileReferenceList_addListener(const fn_call& fn);
-static as_value FileReferenceList_browse(const fn_call& fn);
-static as_value FileReferenceList_removeListener(const fn_call& fn);
-static as_value FileReferenceList_fileList_getset(const fn_call& fn);
-
-
-as_value FileReferenceList_ctor(const fn_call& fn);
+static as_value filereferencelist_addListener(const fn_call& fn);
+static as_value filereferencelist_browse(const fn_call& fn);
+static as_value filereferencelist_removeListener(const fn_call& fn);
+static as_value filereferencelist_fileList_getset(const fn_call& fn);
+as_value filereferencelist_ctor(const fn_call& fn);
+
+static void
+attachFileReferenceListStaticInterface(as_object& /*o*/)
+{
+
+}
static void
attachFileReferenceListInterface(as_object& o)
{
Global_as* gl = getGlobal(o);
- o.init_member("addListener",
gl->createFunction(FileReferenceList_addListener));
- o.init_member("browse", gl->createFunction(FileReferenceList_browse));
- o.init_member("removeListener",
gl->createFunction(FileReferenceList_removeListener));
- o.init_property("fileList", FileReferenceList_fileList_getset,
FileReferenceList_fileList_getset);
+ o.init_member("addListener",
gl->createFunction(filereferencelist_addListener));
+ o.init_member("browse", gl->createFunction(filereferencelist_browse));
+ o.init_member("removeListener",
gl->createFunction(filereferencelist_removeListener));
+ o.init_property("fileList", filereferencelist_fileList_getset,
filereferencelist_fileList_getset);
}
static void
@@ -60,104 +64,54 @@
}
-static as_object*
-getFileReferenceListInterface()
-{
- 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());
-
- attachFileReferenceListInterface(*o);
-
- }
-
- return o.get();
-}
-
-class FileReferenceList_as: public as_object
-{
-
-public:
-
- FileReferenceList_as()
- :
- as_object(getFileReferenceListInterface())
- {}
-};
-
-
-static as_value
-FileReferenceList_addListener(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReferenceList_as> ptr =
ensureType<FileReferenceList_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReferenceList_browse(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReferenceList_as> ptr =
ensureType<FileReferenceList_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReferenceList_removeListener(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReferenceList_as> ptr =
ensureType<FileReferenceList_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReferenceList_fileList_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReferenceList_as> ptr =
ensureType<FileReferenceList_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+static as_value
+filereferencelist_addListener(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereferencelist_browse(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereferencelist_removeListener(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereferencelist_fileList_getset(const fn_call& /*fn*/)
+{
return as_value();
}
as_value
-FileReferenceList_ctor(const fn_call& fn)
+filereferencelist_ctor(const fn_call& fn)
{
- boost::intrusive_ptr<as_object> obj = new FileReferenceList_as;
-
- if ( fn.nargs )
- {
+ if (fn.nargs) {
std::stringstream ss;
fn.dump_args(ss);
- LOG_ONCE( log_unimpl("FileReferenceList(%s): %s", ss.str(),
_("arguments discarded")) );
+ LOG_ONCE(
+ log_unimpl("FileReferenceList(%s): %s", ss.str(),
+ _("arguments discarded"))
+ );
}
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
// extern
-void filereferencelist_class_init(as_object& where, const ObjectURI& uri)
+void
+filereferencelist_class_init(as_object& where, const ObjectURI& uri)
{
- // This is going to be the FileReferenceList "class"/"function"
- // in the 'where' package
- boost::intrusive_ptr<as_object> cl;
- Global_as* gl = getGlobal(where);
- as_object* proto = getFileReferenceListInterface();
- cl = gl->createClass(&FileReferenceList_ctor, proto);
- attachFileReferenceListStaticProperties(*cl);
-
- // Register _global.FileReferenceList
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, filereferencelist_ctor,
+ attachFileReferenceListInterface,
+ attachFileReferenceListStaticInterface, uri);
}
} // end of gnash namespace
=== modified file 'libcore/asobj/flash/net/FileReference_as.cpp'
--- a/libcore/asobj/flash/net/FileReference_as.cpp 2009-08-18 15:30:47
+0000
+++ b/libcore/asobj/flash/net/FileReference_as.cpp 2009-08-20 08:57:16
+0000
@@ -1,4 +1,4 @@
-// FileReference_as.cpp: ActionScript "FileReference" class, for Gnash.
+// filereference_as.cpp: ActionScript "FileReference" class, for Gnash.
//
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
//
@@ -36,38 +36,41 @@
namespace gnash {
-static as_value FileReference_addListener(const fn_call& fn);
-static as_value FileReference_browse(const fn_call& fn);
-static as_value FileReference_cancel(const fn_call& fn);
-static as_value FileReference_download(const fn_call& fn);
-static as_value FileReference_removeListener(const fn_call& fn);
-static as_value FileReference_upload(const fn_call& fn);
-static as_value FileReference_creationDate_getset(const fn_call& fn);
-static as_value FileReference_creator_getset(const fn_call& fn);
-static as_value FileReference_modificationDate_getset(const fn_call& fn);
-static as_value FileReference_name_getset(const fn_call& fn);
-static as_value FileReference_size_getset(const fn_call& fn);
-static as_value FileReference_type_getset(const fn_call& fn);
-
-
-as_value FileReference_ctor(const fn_call& fn);
+static as_value filereference_addListener(const fn_call& fn);
+static as_value filereference_browse(const fn_call& fn);
+static as_value filereference_cancel(const fn_call& fn);
+static as_value filereference_download(const fn_call& fn);
+static as_value filereference_removeListener(const fn_call& fn);
+static as_value filereference_upload(const fn_call& fn);
+static as_value filereference_creationDate_getset(const fn_call& fn);
+static as_value filereference_creator_getset(const fn_call& fn);
+static as_value filereference_modificationDate_getset(const fn_call& fn);
+static as_value filereference_name_getset(const fn_call& fn);
+static as_value filereference_size_getset(const fn_call& fn);
+static as_value filereference_type_getset(const fn_call& fn);
+as_value filereference_ctor(const fn_call& fn);
+
+void attachFileReferenceStaticInterface(as_object& /*o*/)
+{
+
+}
static void
attachFileReferenceInterface(as_object& o)
{
Global_as* gl = getGlobal(o);
- o.init_member("addListener",
gl->createFunction(FileReference_addListener));
- o.init_member("browse", gl->createFunction(FileReference_browse));
- o.init_member("cancel", gl->createFunction(FileReference_cancel));
- o.init_member("download", gl->createFunction(FileReference_download));
- o.init_member("removeListener",
gl->createFunction(FileReference_removeListener));
- o.init_member("upload", gl->createFunction(FileReference_upload));
- o.init_property("creationDate", FileReference_creationDate_getset,
FileReference_creationDate_getset);
- o.init_property("creator", FileReference_creator_getset,
FileReference_creator_getset);
- o.init_property("modificationDate", FileReference_modificationDate_getset,
FileReference_modificationDate_getset);
- o.init_property("name", FileReference_name_getset,
FileReference_name_getset);
- o.init_property("size", FileReference_size_getset,
FileReference_size_getset);
- o.init_property("type", FileReference_type_getset,
FileReference_type_getset);
+ o.init_member("addListener",
gl->createFunction(filereference_addListener));
+ o.init_member("browse", gl->createFunction(filereference_browse));
+ o.init_member("cancel", gl->createFunction(filereference_cancel));
+ o.init_member("download", gl->createFunction(filereference_download));
+ o.init_member("removeListener",
gl->createFunction(filereference_removeListener));
+ o.init_member("upload", gl->createFunction(filereference_upload));
+ o.init_property("creationDate", filereference_creationDate_getset,
filereference_creationDate_getset);
+ o.init_property("creator", filereference_creator_getset,
filereference_creator_getset);
+ o.init_property("modificationDate", filereference_modificationDate_getset,
filereference_modificationDate_getset);
+ o.init_property("name", filereference_name_getset,
filereference_name_getset);
+ o.init_property("size", filereference_size_getset,
filereference_size_getset);
+ o.init_property("type", filereference_type_getset,
filereference_type_getset);
}
static void
@@ -76,177 +79,102 @@
}
-static as_object*
-getFileReferenceInterface()
-{
- 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());
-
- attachFileReferenceInterface(*o);
-
- }
-
- return o.get();
-}
-
-class FileReference_as: public as_object
-{
-
-public:
-
- FileReference_as()
- :
- as_object(getFileReferenceInterface())
- {}
-
-};
-
-
-static as_value
-FileReference_addListener(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_browse(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_cancel(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_download(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_removeListener(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_upload(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_creationDate_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_creator_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_modificationDate_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_name_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_size_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
-}
-
-static as_value
-FileReference_type_getset(const fn_call& fn)
-{
- boost::intrusive_ptr<FileReference_as> ptr =
ensureType<FileReference_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+static as_value
+filereference_addListener(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_browse(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_cancel(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_download(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_removeListener(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_upload(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_creationDate_getset(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_creator_getset(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_modificationDate_getset(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_name_getset(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_size_getset(const fn_call& /*fn*/)
+{
+ return as_value();
+}
+
+static as_value
+filereference_type_getset(const fn_call& /*fn*/)
+{
return as_value();
}
as_value
-FileReference_ctor(const fn_call& fn)
+filereference_ctor(const fn_call& fn)
{
- boost::intrusive_ptr<as_object> obj = new FileReference_as;
-
- if ( fn.nargs )
- {
+ if (fn.nargs) {
std::stringstream ss;
fn.dump_args(ss);
- LOG_ONCE( log_unimpl("FileReference(%s): %s", ss.str(), _("arguments
discarded")) );
+ LOG_ONCE(
+ log_unimpl("FileReference(%s): %s", ss.str(),
+ _("arguments discarded"))
+ );
}
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
// extern
-void filereference_class_init(as_object& where, const ObjectURI& uri)
+void
+filereference_class_init(as_object& where, const ObjectURI& uri)
{
- // This is going to be the FileReference "class"/"function"
- // in the 'where' package
- boost::intrusive_ptr<as_object> cl;
- Global_as* gl = getGlobal(where);
- as_object* proto = getFileReferenceInterface();
- cl = gl->createClass(&FileReference_ctor, proto);
- attachFileReferenceStaticProperties(*cl);
-
- // Register _global.FileReference
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, filereference_ctor,
+ attachFileReferenceInterface,
+ attachFileReferenceStaticInterface, uri);
}
} // end of gnash namespace
=== modified file 'libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp'
--- a/libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void idynamicpropertyoutput_class_init(as_object& where, const ObjectURI& uri)
+void
+idynamicpropertyoutput_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 = getIDynamicPropertyOutputInterface();
- cl = gl->createClass(&idynamicpropertyoutput_ctor, proto);
- attachIDynamicPropertyOutputStaticInterface(*cl);
- }
-
- // Register _global.IDynamicPropertyOutput
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, idynamicpropertyoutput_ctor,
attachIDynamicPropertyOutputInterface,
+ attachIDynamicPropertyOutputStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp'
--- a/libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void idynamicpropertywriter_class_init(as_object& where, const ObjectURI& uri)
+void
+idynamicpropertywriter_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 = getIDynamicPropertyWriterInterface();
- cl = gl->createClass(&idynamicpropertywriter_ctor, proto);
- attachIDynamicPropertyWriterStaticInterface(*cl);
- }
-
- // Register _global.IDynamicPropertyWriter
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, idynamicpropertywriter_ctor,
attachIDynamicPropertyWriterInterface,
+ attachIDynamicPropertyWriterStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/NetStream_as.cpp'
--- a/libcore/asobj/flash/net/NetStream_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/net/NetStream_as.cpp 2009-08-20 08:57:16 +0000
@@ -72,20 +72,11 @@
};
// extern (used by Global.cpp)
-void netstream_class_init(as_object& where, const ObjectURI& uri)
+void
+netstream_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 = getNetStreamInterface();
- cl = gl->createClass(&netstream_ctor, proto);
- attachNetStreamStaticInterface(*cl);
- }
-
- // Register _global.NetStream
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, netstream_ctor, attachNetStreamInterface,
+ attachNetStreamStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/ObjectEncoding_as.cpp'
--- a/libcore/asobj/flash/net/ObjectEncoding_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/net/ObjectEncoding_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void objectencoding_class_init(as_object& where, const ObjectURI& uri)
+void
+objectencoding_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 = getObjectEncodingInterface();
- cl = gl->createClass(&objectencoding_ctor, proto);
- attachObjectEncodingStaticInterface(*cl);
- }
-
- // Register _global.ObjectEncoding
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, objectencoding_ctor,
attachObjectEncodingInterface,
+ attachObjectEncodingStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/Responder_as.cpp'
--- a/libcore/asobj/flash/net/Responder_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/net/Responder_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void responder_class_init(as_object& where, const ObjectURI& uri)
+void
+responder_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 = getResponderInterface();
- cl = gl->createClass(&responder_ctor, proto);
- attachResponderStaticInterface(*cl);
- }
-
- // Register _global.Responder
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, responder_ctor, attachResponderInterface,
+ attachResponderStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/SharedObjectFlushStatus_as.cpp'
--- a/libcore/asobj/flash/net/SharedObjectFlushStatus_as.cpp 2009-07-31
07:38:05 +0000
+++ b/libcore/asobj/flash/net/SharedObjectFlushStatus_as.cpp 2009-08-20
08:57:16 +0000
@@ -43,12 +43,8 @@
void
sharedobjectflushstatus_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachSharedObjectFlushStatusStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachSharedObjectFlushStatusStaticInterface,
+ uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/URLLoaderDataFormat_as.cpp'
--- a/libcore/asobj/flash/net/URLLoaderDataFormat_as.cpp 2009-07-31
07:38:05 +0000
+++ b/libcore/asobj/flash/net/URLLoaderDataFormat_as.cpp 2009-08-20
08:57:16 +0000
@@ -36,19 +36,21 @@
// Forward declarations
namespace {
- void attachURLLoaderDataFormatStaticInterface(as_object& o);
+ void
+attachURLLoaderDataFormatStaticInterface(as_object& o);
}
// extern (used by Global.cpp)
void
urlloaderdataformat_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachURLLoaderDataFormatStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where,
attachURLLoaderDataFormatStaticInterface(as_object& o);
+}
+
+// extern (used by Global.cpp)
+void
+urlloaderdataformat_ctor, attachObjectInterface,
+ attachObjectStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/URLRequestHeader_as.cpp'
--- a/libcore/asobj/flash/net/URLRequestHeader_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/net/URLRequestHeader_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void urlrequestheader_class_init(as_object& where, const ObjectURI& uri)
+void
+urlrequestheader_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 = getURLRequestHeaderInterface();
- cl = gl->createClass(&urlrequestheader_ctor, proto);
- attachURLRequestHeaderStaticInterface(*cl);
- }
-
- // Register _global.URLRequestHeader
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, urlrequestheader_ctor,
attachURLRequestHeaderInterface,
+ attachURLRequestHeaderStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/URLRequestMethod_as.cpp'
--- a/libcore/asobj/flash/net/URLRequestMethod_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/net/URLRequestMethod_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,6 +43,7 @@
void
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);
=== modified file 'libcore/asobj/flash/net/URLRequest_as.cpp'
--- a/libcore/asobj/flash/net/URLRequest_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/net/URLRequest_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void urlrequest_class_init(as_object& where, const ObjectURI& uri)
+void
+urlrequest_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 = getURLRequestInterface();
- cl = gl->createClass(&urlrequest_ctor, proto);
- attachURLRequestStaticInterface(*cl);
- }
-
- // Register _global.URLRequest
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, urlrequest_ctor, attachURLRequestInterface,
+ attachURLRequestStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/URLStream_as.cpp'
--- a/libcore/asobj/flash/net/URLStream_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/net/URLStream_as.cpp 2009-08-20 08:57:16 +0000
@@ -73,20 +73,11 @@
};
// extern (used by Global.cpp)
-void urlstream_class_init(as_object& where, const ObjectURI& uri)
+void
+urlstream_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 = getURLStreamInterface();
- cl = gl->createClass(&urlstream_ctor, proto);
- attachURLStreamStaticInterface(*cl);
- }
-
- // Register _global.URLStream
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, urlstream_ctor, attachURLStreamInterface,
+ attachURLStreamStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/URLVariables_as.cpp'
--- a/libcore/asobj/flash/net/URLVariables_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/net/URLVariables_as.cpp 2009-08-20 08:57:16
+0000
@@ -53,20 +53,11 @@
};
// extern (used by Global.cpp)
-void urlvariables_class_init(as_object& where, const ObjectURI& uri)
+void
+urlvariables_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 = getURLVariablesInterface();
- cl = gl->createClass(&urlvariables_ctor, proto);
- attachURLVariablesStaticInterface(*cl);
- }
-
- // Register _global.URLVariables
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, urlvariables_ctor,
attachURLVariablesInterface,
+ attachURLVariablesStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/net/XMLSocket_as.cpp'
--- a/libcore/asobj/flash/net/XMLSocket_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/net/XMLSocket_as.cpp 2009-08-20 06:55:15 +0000
@@ -389,10 +389,8 @@
const std::string& s = *it;
- std::auto_ptr<std::vector<as_value> > args(
- new std::vector<as_value>);
-
- args->push_back(s);
+ fn_call::Args args;
+ args += s;
fn_call call(this, env, args);
=== modified file 'libcore/asobj/flash/printing/PrintJobOptions_as.cpp'
--- a/libcore/asobj/flash/printing/PrintJobOptions_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/printing/PrintJobOptions_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void printjoboptions_class_init(as_object& where, const ObjectURI& uri)
+void
+printjoboptions_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 = getPrintJobOptionsInterface();
- cl = gl->createClass(&printjoboptions_ctor, proto);
- attachPrintJobOptionsStaticInterface(*cl);
- }
-
- // Register _global.PrintJobOptions
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, printjoboptions_ctor,
attachPrintJobOptionsInterface,
+ attachPrintJobOptionsStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/printing/PrintJob_as.cpp'
--- a/libcore/asobj/flash/printing/PrintJob_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/printing/PrintJob_as.cpp 2009-08-20 08:57:16
+0000
@@ -54,20 +54,11 @@
};
// extern (used by Global.cpp)
-void printjob_class_init(as_object& where, const ObjectURI& uri)
+void
+printjob_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 = getPrintJobInterface();
- cl = gl->createClass(&printjob_ctor, proto);
- attachPrintJobStaticInterface(*cl);
- }
-
- // Register _global.PrintJob
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, printjob_ctor, attachPrintJobInterface,
+ attachPrintJobStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp'
--- a/libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void deleteobjectsample_class_init(as_object& where, const ObjectURI& uri)
+void
+deleteobjectsample_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 = getDeleteObjectSampleInterface();
- cl = gl->createClass(&deleteobjectsample_ctor, proto);
- attachDeleteObjectSampleStaticInterface(*cl);
- }
-
- // Register _global.DeleteObjectSample
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, deleteobjectsample_ctor,
attachDeleteObjectSampleInterface,
+ attachDeleteObjectSampleStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/sampler/NewObjectSample_as.cpp'
--- a/libcore/asobj/flash/sampler/NewObjectSample_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/sampler/NewObjectSample_as.cpp 2009-08-20
08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void newobjectsample_class_init(as_object& where, const ObjectURI& uri)
+void
+newobjectsample_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 = getNewObjectSampleInterface();
- cl = gl->createClass(&newobjectsample_ctor, proto);
- attachNewObjectSampleStaticInterface(*cl);
- }
-
- // Register _global.NewObjectSample
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, newobjectsample_ctor,
attachNewObjectSampleInterface,
+ attachNewObjectSampleStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/sampler/Sample_as.cpp'
--- a/libcore/asobj/flash/sampler/Sample_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/sampler/Sample_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void sample_class_init(as_object& where, const ObjectURI& uri)
+void
+sample_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 = getSampleInterface();
- cl = gl->createClass(&sample_ctor, proto);
- attachSampleStaticInterface(*cl);
- }
-
- // Register _global.Sample
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, sample_ctor, attachSampleInterface,
+ attachSampleStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/sampler/StackFrame_as.cpp'
--- a/libcore/asobj/flash/sampler/StackFrame_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/sampler/StackFrame_as.cpp 2009-08-20 08:57:16
+0000
@@ -55,20 +55,11 @@
};
// extern (used by Global.cpp)
-void stackframe_class_init(as_object& where, const ObjectURI& uri)
+void
+stackframe_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 = getStackFrameInterface();
- cl = gl->createClass(&stackframe_ctor, proto);
- attachStackFrameStaticInterface(*cl);
- }
-
- // Register _global.StackFrame
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, stackframe_ctor, attachStackFrameInterface,
+ attachStackFrameStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/system/ApplicationDomain_as.cpp'
--- a/libcore/asobj/flash/system/ApplicationDomain_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/system/ApplicationDomain_as.cpp 2009-08-20
08:57:16 +0000
@@ -53,20 +53,11 @@
};
// extern (used by Global.cpp)
-void applicationdomain_class_init(as_object& where, const ObjectURI& uri)
+void
+applicationdomain_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 = getApplicationDomainInterface();
- cl = gl->createClass(&applicationdomain_ctor, proto);
- attachApplicationDomainStaticInterface(*cl);
- }
-
- // Register _global.ApplicationDomain
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, applicationdomain_ctor,
attachApplicationDomainInterface,
+ attachApplicationDomainStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/system/Capabilities_as.cpp'
--- a/libcore/asobj/flash/system/Capabilities_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/system/Capabilities_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void capabilities_class_init(as_object& where, const ObjectURI& uri)
+void
+capabilities_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 = getCapabilitiesInterface();
- cl = gl->createClass(&capabilities_ctor, proto);
- attachCapabilitiesStaticInterface(*cl);
- }
-
- // Register _global.Capabilities
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, capabilities_ctor,
attachCapabilitiesInterface,
+ attachCapabilitiesStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/system/IMEConversionMode_as.cpp'
--- a/libcore/asobj/flash/system/IMEConversionMode_as.cpp 2009-07-31
07:38:05 +0000
+++ b/libcore/asobj/flash/system/IMEConversionMode_as.cpp 2009-08-20
08:57:16 +0000
@@ -43,12 +43,7 @@
void
imeconversionmode_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachIMEConversionModeStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachIMEConversionModeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/system/IME_as.cpp'
--- a/libcore/asobj/flash/system/IME_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/system/IME_as.cpp 2009-08-20 08:57:16 +0000
@@ -54,20 +54,11 @@
};
// extern (used by Global.cpp)
-void ime_class_init(as_object& where, const ObjectURI& uri)
+void
+ime_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 = getIMEInterface();
- cl = gl->createClass(&ime_ctor, proto);
- attachIMEStaticInterface(*cl);
- }
-
- // Register _global.IME
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, ime_ctor, attachIMEInterface,
+ attachIMEStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/system/LoaderContext_as.cpp'
--- a/libcore/asobj/flash/system/LoaderContext_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/system/LoaderContext_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void loadercontext_class_init(as_object& where, const ObjectURI& uri)
+void
+loadercontext_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 = getLoaderContextInterface();
- cl = gl->createClass(&loadercontext_ctor, proto);
- attachLoaderContextStaticInterface(*cl);
- }
-
- // Register _global.LoaderContext
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, loadercontext_ctor,
attachLoaderContextInterface,
+ attachLoaderContextStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/system/SecurityDomain_as.cpp'
--- a/libcore/asobj/flash/system/SecurityDomain_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/system/SecurityDomain_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void securitydomain_class_init(as_object& where, const ObjectURI& uri)
+void
+securitydomain_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 = getSecurityDomainInterface();
- cl = gl->createClass(&securitydomain_ctor, proto);
- attachSecurityDomainStaticInterface(*cl);
- }
-
- // Register _global.SecurityDomain
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, securitydomain_ctor,
attachSecurityDomainInterface,
+ attachSecurityDomainStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/system/SecurityPanel_as.cpp'
--- a/libcore/asobj/flash/system/SecurityPanel_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/system/SecurityPanel_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void securitypanel_class_init(as_object& where, const ObjectURI& uri)
+void
+securitypanel_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 = getSecurityPanelInterface();
- cl = gl->createClass(&securitypanel_ctor, proto);
- attachSecurityPanelStaticInterface(*cl);
- }
-
- // Register _global.SecurityPanel
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, securitypanel_ctor,
attachSecurityPanelInterface,
+ attachSecurityPanelStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/AntiAliasType_as.cpp'
--- a/libcore/asobj/flash/text/AntiAliasType_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/text/AntiAliasType_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,12 +43,7 @@
void
antialiastype_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachAntiAliasTypeStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachAntiAliasTypeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/CSMSettings_as.cpp'
--- a/libcore/asobj/flash/text/CSMSettings_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/text/CSMSettings_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void csmsettings_class_init(as_object& where, const ObjectURI& uri)
+void
+csmsettings_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 = getCSMSettingsInterface();
- cl = gl->createClass(&csmsettings_ctor, proto);
- attachCSMSettingsStaticInterface(*cl);
- }
-
- // Register _global.CSMSettings
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, csmsettings_ctor, attachCSMSettingsInterface,
+ attachCSMSettingsStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/FontStyle_as.cpp'
--- a/libcore/asobj/flash/text/FontStyle_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/text/FontStyle_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void fontstyle_class_init(as_object& where, const ObjectURI& uri)
+void
+fontstyle_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 = getFontStyleInterface();
- cl = gl->createClass(&fontstyle_ctor, proto);
- attachFontStyleStaticInterface(*cl);
- }
-
- // Register _global.FontStyle
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, fontstyle_ctor, attachFontStyleInterface,
+ attachFontStyleStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/FontType_as.cpp'
--- a/libcore/asobj/flash/text/FontType_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/text/FontType_as.cpp 2009-08-20 08:57:16 +0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void fonttype_class_init(as_object& where, const ObjectURI& uri)
+void
+fonttype_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 = getFontTypeInterface();
- cl = gl->createClass(&fonttype_ctor, proto);
- attachFontTypeStaticInterface(*cl);
- }
-
- // Register _global.FontType
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, fonttype_ctor, attachFontTypeInterface,
+ attachFontTypeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/Font_as.cpp'
--- a/libcore/asobj/flash/text/Font_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/text/Font_as.cpp 2009-08-20 08:57:16 +0000
@@ -54,20 +54,11 @@
};
// extern (used by Global.cpp)
-void font_class_init(as_object& where, const ObjectURI& uri)
+void
+font_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 = getFontInterface();
- cl = gl->createClass(&font_ctor, proto);
- attachFontStaticInterface(*cl);
- }
-
- // Register _global.Font
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, font_ctor, attachFontInterface,
+ attachFontStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/GridFitType_as.cpp'
--- a/libcore/asobj/flash/text/GridFitType_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/text/GridFitType_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,12 +43,7 @@
void
gridfittype_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachGridFitTypeStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachGridFitTypeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/TextColorType_as.cpp'
--- a/libcore/asobj/flash/text/TextColorType_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/text/TextColorType_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,12 +43,7 @@
void
textcolortype_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachTextColorTypeStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachTextColorTypeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/TextDisplayMode_as.cpp'
--- a/libcore/asobj/flash/text/TextDisplayMode_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/text/TextDisplayMode_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,12 +43,7 @@
void
textdisplaymode_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachTextDisplayModeStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachTextDisplayModeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/TextFieldType_as.cpp'
--- a/libcore/asobj/flash/text/TextFieldType_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/text/TextFieldType_as.cpp 2009-08-20 08:57:16
+0000
@@ -42,13 +42,7 @@
void
textfieldtype_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);
-
- attachTextFieldTypeStaticInterface(*obj);
- where.init_member(getName(uri), obj.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachTextFieldTypeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/TextField_as.cpp'
--- a/libcore/asobj/flash/text/TextField_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/text/TextField_as.cpp 2009-08-20 08:57:16 +0000
@@ -72,20 +72,11 @@
};
// extern (used by Global.cpp)
-void textfield_class_init(as_object& where, const ObjectURI& uri)
+void
+textfield_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 = getTextFieldInterface();
- cl = gl->createClass(&textfield_ctor, proto);
- attachTextFieldStaticInterface(*cl);
- }
-
- // Register _global.TextField
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, textfield_ctor, attachTextFieldInterface,
+ attachTextFieldStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/TextFormatAlign_as.cpp'
--- a/libcore/asobj/flash/text/TextFormatAlign_as.cpp 2009-07-29 05:31:28
+0000
+++ b/libcore/asobj/flash/text/TextFormatAlign_as.cpp 2009-08-20 08:57:16
+0000
@@ -41,16 +41,7 @@
// extern (used by Global.cpp)
void textformatalign_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- static boost::intrusive_ptr<as_object> obj =
- gl->createObject(proto);
-
- attachTextFormatAlignStaticInterface(*obj);
-
- // Register _global.TextFormatAlign
- where.init_member(getName(uri), obj.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachTextFormatAlignStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/TextFormat_as.cpp'
--- a/libcore/asobj/flash/text/TextFormat_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/text/TextFormat_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void textformat_class_init(as_object& where, const ObjectURI& uri)
+void
+textformat_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 = getTextFormatInterface();
- cl = gl->createClass(&textformat_ctor, proto);
- attachTextFormatStaticInterface(*cl);
- }
-
- // Register _global.TextFormat
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, textformat_ctor, attachTextFormatInterface,
+ attachTextFormatStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/text/TextLineMetrics_as.cpp'
--- a/libcore/asobj/flash/text/TextLineMetrics_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/text/TextLineMetrics_as.cpp 2009-08-20 08:57:16
+0000
@@ -52,20 +52,11 @@
};
// extern (used by Global.cpp)
-void textlinemetrics_class_init(as_object& where, const ObjectURI& uri)
+void
+textlinemetrics_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 = getTextLineMetricsInterface();
- cl = gl->createClass(&textlinemetrics_ctor, proto);
- attachTextLineMetricsStaticInterface(*cl);
- }
-
- // Register _global.TextLineMetrics
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, textlinemetrics_ctor,
attachTextLineMetricsInterface,
+ attachTextLineMetricsStaticInterface, uri);
}
namespace {
=== modified file 'libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp'
--- a/libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp 2009-07-29
05:40:20 +0000
+++ b/libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp 2009-08-20
08:09:04 +0000
@@ -36,36 +36,16 @@
as_value contextmenubuiltinitems_ctor(const fn_call& fn);
void attachContextMenuBuiltInItemsInterface(as_object& o);
void attachContextMenuBuiltInItemsStaticInterface(as_object& o);
- as_object* getContextMenuBuiltInItemsInterface();
}
-class ContextMenuBuiltInItems_as : public as_object
-{
-
-public:
-
- ContextMenuBuiltInItems_as()
- :
- as_object(getContextMenuBuiltInItemsInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void contextmenubuiltinitems_class_init(as_object& where, const ObjectURI& uri)
+void
+contextmenubuiltinitems_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 = getContextMenuBuiltInItemsInterface();
- cl = gl->createClass(&contextmenubuiltinitems_ctor, proto);
- attachContextMenuBuiltInItemsStaticInterface(*cl);
- }
-
- // Register _global.ContextMenuBuiltInItems
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, contextmenubuiltinitems_ctor,
+ attachContextMenuBuiltInItemsInterface,
+ attachContextMenuBuiltInItemsStaticInterface, uri);
}
namespace {
@@ -81,23 +61,10 @@
}
-as_object*
-getContextMenuBuiltInItemsInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachContextMenuBuiltInItemsInterface(*o);
- }
- return o.get();
-}
-
as_value
contextmenubuiltinitems_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new ContextMenuBuiltInItems_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/ui/ContextMenuItem_as.cpp'
--- a/libcore/asobj/flash/ui/ContextMenuItem_as.cpp 2009-08-18 10:32:14
+0000
+++ b/libcore/asobj/flash/ui/ContextMenuItem_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,13 +43,8 @@
void
contextmenuitem_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = gl->createObject(getObjectInterface());
- as_object* cl = gl->createClass(&contextmenuitem_ctor, proto);
- attachContextMenuItemInterface(*proto);
- // Register _global.ContextMenuItem
- where.init_member(getName(uri), cl, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, contextmenuitem_ctor,
+ attachContextMenuItemInterface, 0, uri);
}
namespace {
@@ -78,12 +73,12 @@
if (!ctor) return as_value();
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>());
- args->push_back(ptr->getMember(st.find("caption")));
- args->push_back(ptr->getMember(NSV::PROP_ON_SELECT));
- args->push_back(ptr->getMember(st.find("separatorBefore")));
- args->push_back(ptr->getMember(NSV::PROP_ENABLED));
- args->push_back(ptr->getMember(st.find("visible")));
+ fn_call::Args args;
+ args += ptr->getMember(st.find("caption")),
+ ptr->getMember(NSV::PROP_ON_SELECT),
+ ptr->getMember(st.find("separatorBefore")),
+ ptr->getMember(NSV::PROP_ENABLED),
+ ptr->getMember(st.find("visible"));
return ctor->constructInstance(fn.env(), args);
}
@@ -92,7 +87,7 @@
as_value
contextmenuitem_ctor(const fn_call& fn)
{
- as_object* obj = fn.this_ptr.get();
+ as_object* obj = fn.this_ptr;
string_table& st = getStringTable(fn);
=== modified file 'libcore/asobj/flash/ui/ContextMenu_as.cpp'
--- a/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-08-18 10:32:14 +0000
+++ b/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-08-20 09:11:27 +0000
@@ -42,8 +42,6 @@
as_value contextmenu_ctor(const fn_call& fn);
void attachContextMenuInterface(as_object& o);
- void attachContextMenuStaticInterface(as_object& o);
- as_object* getContextMenuInterface();
as_object* setBuiltInItems();
}
@@ -52,13 +50,8 @@
void
contextmenu_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getContextMenuInterface();
- as_object* cl = gl->createClass(contextmenu_ctor, proto);
-
- // Register _global.ContextMenu
- where.init_member(getName(uri), cl, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, contextmenu_ctor, attachContextMenuInterface,
+ 0, uri);
}
@@ -93,18 +86,6 @@
o.init_member("copy", gl->createFunction(contextmenu_copy), flags);
}
-as_object*
-getContextMenuInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object(getObjectInterface());
- attachContextMenuInterface(*o);
- VM::get().addStatic(o.get());
- }
- return o.get();
-}
-
as_value
contextmenu_hideBuiltInItems(const fn_call& fn)
{
@@ -120,7 +101,18 @@
contextmenu_copy(const fn_call& fn)
{
boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
- as_object* o = new as_object(getContextMenuInterface());
+
+ Global_as* gl = getGlobal(fn);
+
+ as_function* ctor = gl->getMember(NSV::CLASS_CONTEXTMENU).to_as_function();
+ if (!ctor) {
+ return as_value();
+ }
+
+ fn_call::Args args;
+ as_object* o = ctor->constructInstance(fn.env(), args).get();
+
+ if (!o) return as_value();
string_table& st = getStringTable(fn);
as_value onSelect, builtInItems;
@@ -140,7 +132,8 @@
as_object* nc = new Array_as;
as_object* customs;
- if (customItems.is_object() && (customs =
customItems.to_object(*getGlobal(fn)).get())) {
+ if (customItems.is_object() &&
+ (customs = customItems.to_object(*getGlobal(fn)).get())) {
// TODO: only copy properties that are ContextMenuItems.
nc->copyProperties(*customs);
customItems = nc;
@@ -154,8 +147,8 @@
as_value
contextmenu_ctor(const fn_call& fn)
{
- boost::intrusive_ptr<as_object> obj =
- new as_object(getContextMenuInterface());
+
+ as_object* obj = fn.this_ptr;
// There is always an onSelect member, but it may be undefined.
const as_value& callback = fn.nargs ? fn.arg(0) : as_value();
@@ -170,7 +163,7 @@
Array_as* customItems = new Array_as();
obj->set_member(st.find("customItems"), customItems);
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/ui/KeyLocation_as.cpp'
--- a/libcore/asobj/flash/ui/KeyLocation_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/ui/KeyLocation_as.cpp 2009-08-20 08:09:04 +0000
@@ -36,36 +36,15 @@
as_value keylocation_ctor(const fn_call& fn);
void attachKeyLocationInterface(as_object& o);
void attachKeyLocationStaticInterface(as_object& o);
- as_object* getKeyLocationInterface();
}
-class KeyLocation_as : public as_object
-{
-
-public:
-
- KeyLocation_as()
- :
- as_object(getKeyLocationInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void keylocation_class_init(as_object& where, const ObjectURI& uri)
+void
+keylocation_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 = getKeyLocationInterface();
- cl = gl->createClass(&keylocation_ctor, proto);
- attachKeyLocationStaticInterface(*cl);
- }
-
- // Register _global.KeyLocation
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, keylocation_ctor, attachKeyLocationInterface,
+ attachKeyLocationStaticInterface, uri);
}
namespace {
@@ -81,23 +60,10 @@
}
-as_object*
-getKeyLocationInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachKeyLocationInterface(*o);
- }
- return o.get();
-}
-
as_value
keylocation_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new KeyLocation_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/ui/Keyboard_as.cpp'
--- a/libcore/asobj/flash/ui/Keyboard_as.cpp 2009-08-18 06:49:40 +0000
+++ b/libcore/asobj/flash/ui/Keyboard_as.cpp 2009-08-20 10:19:21 +0000
@@ -131,7 +131,7 @@
return _lastKeyEvent;
}
-static as_value
+as_value
key_is_accessible(const fn_call& fn)
{
@@ -144,7 +144,7 @@
/// Return the ascii number of the last key pressed.
-static as_value
+as_value
key_get_ascii(const fn_call& fn)
{
boost::intrusive_ptr<Keyboard_as> ko =
@@ -156,7 +156,7 @@
}
/// Returns the keycode of the last key pressed.
-static as_value
+as_value
key_get_code(const fn_call& fn)
{
boost::intrusive_ptr<Keyboard_as> ko =
@@ -168,7 +168,7 @@
}
/// Return true if the specified (first arg keycode) key is pressed.
-static as_value
+as_value
key_is_down(const fn_call& fn)
{
boost::intrusive_ptr<Keyboard_as> ko =
@@ -199,7 +199,7 @@
/// Given the keycode of NUM_LOCK or CAPSLOCK, returns true if
/// the associated state is on.
///
-static as_value
+as_value
key_is_toggled(const fn_call& /* fn */)
{
log_unimpl("Key.isToggled");
=== modified file 'libcore/asobj/flash/utils/ByteArray_as.cpp'
--- a/libcore/asobj/flash/utils/ByteArray_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/utils/ByteArray_as.cpp 2009-08-20 08:09:04
+0000
@@ -68,32 +68,12 @@
}
-class ByteArray_as : public as_object
-{
-
-public:
-
- ByteArray_as()
- :
- as_object(getByteArrayInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void bytearray_class_init(as_object& where, const ObjectURI& uri)
+void
+bytearray_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 = getByteArrayInterface();
- cl = gl->createClass(&bytearray_ctor, proto);
- attachByteArrayStaticInterface(*cl);
- }
-
- // Register _global.ByteArray
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, bytearray_ctor, attachByteArrayInterface,
+ attachByteArrayStaticInterface, uri);
}
namespace {
@@ -137,293 +117,198 @@
{
}
-as_object*
-getByteArrayInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachByteArrayInterface(*o);
- }
- return o.get();
-}
-
-as_value
-bytearray_readBoolean(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readByte(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readDouble(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readFloat(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readInt(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readMultiByte(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readObject(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readShort(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readUnsignedByte(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readUnsignedInt(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readUnsignedShort(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readUTF(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_readUTFBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_toString(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_uncompress(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeBoolean(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeByte(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeDouble(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeFloat(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeInt(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeMultiByte(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeObject(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeShort(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeUnsignedInt(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeUTF(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-bytearray_writeUTFBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<ByteArray_as> ptr =
- ensureType<ByteArray_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+bytearray_readBoolean(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readBytes(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readDouble(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readFloat(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readMultiByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readObject(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readShort(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readUnsignedByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readUnsignedInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readUnsignedShort(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readUTF(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_readUTFBytes(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_toString(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_uncompress(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeBoolean(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeBytes(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeDouble(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeFloat(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeMultiByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeObject(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeShort(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeUnsignedInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeUTF(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+bytearray_writeUTFBytes(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -431,9 +316,7 @@
as_value
bytearray_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new ByteArray_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/utils/Dictionary_as.cpp'
--- a/libcore/asobj/flash/utils/Dictionary_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/utils/Dictionary_as.cpp 2009-08-20 08:12:22
+0000
@@ -36,36 +36,14 @@
as_value dictionary_ctor(const fn_call& fn);
void attachDictionaryInterface(as_object& o);
void attachDictionaryStaticInterface(as_object& o);
- as_object* getDictionaryInterface();
-
}
-class Dictionary_as : public as_object
-{
-
-public:
-
- Dictionary_as()
- :
- as_object(getDictionaryInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void dictionary_class_init(as_object& where, const ObjectURI& uri)
+void
+dictionary_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 = getDictionaryInterface();
- cl = gl->createClass(&dictionary_ctor, proto);
- attachDictionaryStaticInterface(*cl);
- }
-
- // Register _global.Dictionary
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, dictionary_ctor, attachDictionaryInterface,
+ attachDictionaryStaticInterface, uri);
}
namespace {
@@ -81,23 +59,10 @@
}
-as_object*
-getDictionaryInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachDictionaryInterface(*o);
- }
- return o.get();
-}
-
as_value
dictionary_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new Dictionary_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/utils/Endian_as.cpp'
--- a/libcore/asobj/flash/utils/Endian_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/utils/Endian_as.cpp 2009-08-20 07:54:03 +0000
@@ -40,32 +40,12 @@
}
-class Endian_as : public as_object
-{
-
-public:
-
- Endian_as()
- :
- as_object(getEndianInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void endian_class_init(as_object& where, const ObjectURI& uri)
+void
+endian_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 = getEndianInterface();
- cl = gl->createClass(&endian_ctor, proto);
- attachEndianStaticInterface(*cl);
- }
-
- // Register _global.Endian
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, &endian_ctor, attachEndianStaticInterface,
+ attachEndianInterface, uri);
}
namespace {
@@ -81,23 +61,10 @@
}
-as_object*
-getEndianInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachEndianInterface(*o);
- }
- return o.get();
-}
-
as_value
endian_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new Endian_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/utils/IDataInput_as.cpp'
--- a/libcore/asobj/flash/utils/IDataInput_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/utils/IDataInput_as.cpp 2009-08-20 08:09:04
+0000
@@ -49,36 +49,15 @@
as_value idatainput_ctor(const fn_call& fn);
void attachIDataInputInterface(as_object& o);
void attachIDataInputStaticInterface(as_object& o);
- as_object* getIDataInputInterface();
}
-class IDataInput_as : public as_object
-{
-
-public:
-
- IDataInput_as()
- :
- as_object(getIDataInputInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void idatainput_class_init(as_object& where, const ObjectURI& uri)
+void
+idatainput_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 = getIDataInputInterface();
- cl = gl->createClass(&idatainput_ctor, proto);
- attachIDataInputStaticInterface(*cl);
- }
-
- // Register _global.IDataInput
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, idatainput_ctor, attachIDataInputInterface,
+ attachIDataInputStaticInterface, uri);
}
namespace {
@@ -107,143 +86,93 @@
{
}
-as_object*
-getIDataInputInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIDataInputInterface(*o);
- }
- return o.get();
-}
-
-as_value
-idatainput_readByte(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readDouble(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readFloat(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readInt(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readMultiByte(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readObject(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readShort(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readUnsignedByte(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readUnsignedInt(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readUnsignedShort(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readUTF(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idatainput_readUTFBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataInput_as> ptr =
- ensureType<IDataInput_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+idatainput_readByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readBytes(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readDouble(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readFloat(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readMultiByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readObject(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readShort(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readUnsignedByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readUnsignedInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readUnsignedShort(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readUTF(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idatainput_readUTFBytes(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -251,9 +180,7 @@
as_value
idatainput_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IDataInput_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/utils/IDataOutput_as.cpp'
--- a/libcore/asobj/flash/utils/IDataOutput_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/utils/IDataOutput_as.cpp 2009-08-20 08:09:04
+0000
@@ -47,36 +47,14 @@
as_value idataoutput_ctor(const fn_call& fn);
void attachIDataOutputInterface(as_object& o);
void attachIDataOutputStaticInterface(as_object& o);
- as_object* getIDataOutputInterface();
-
}
-class IDataOutput_as : public as_object
-{
-
-public:
-
- IDataOutput_as()
- :
- as_object(getIDataOutputInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void idataoutput_class_init(as_object& where, const ObjectURI& uri)
+void
+idataoutput_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 = getIDataOutputInterface();
- cl = gl->createClass(&idataoutput_ctor, proto);
- attachIDataOutputStaticInterface(*cl);
- }
-
- // Register _global.IDataOutput
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, idataoutput_ctor, attachIDataOutputInterface,
+ attachIDataOutputStaticInterface, uri);
}
namespace {
@@ -103,123 +81,79 @@
{
}
-as_object*
-getIDataOutputInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIDataOutputInterface(*o);
- }
- return o.get();
-}
-
-as_value
-idataoutput_writeByte(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeDouble(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeFloat(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeInt(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeMultiByte(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeObject(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeShort(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeUnsignedInt(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeUTF(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-idataoutput_writeUTFBytes(const fn_call& fn)
-{
- boost::intrusive_ptr<IDataOutput_as> ptr =
- ensureType<IDataOutput_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+idataoutput_writeByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeBytes(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeDouble(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeFloat(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeMultiByte(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeObject(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeShort(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeUnsignedInt(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeUTF(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+idataoutput_writeUTFBytes(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -227,9 +161,7 @@
as_value
idataoutput_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IDataOutput_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/utils/IExternalizable_as.cpp'
--- a/libcore/asobj/flash/utils/IExternalizable_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/utils/IExternalizable_as.cpp 2009-08-20 08:12:22
+0000
@@ -37,36 +37,15 @@
as_value iexternalizable_ctor(const fn_call& fn);
void attachIExternalizableInterface(as_object& o);
void attachIExternalizableStaticInterface(as_object& o);
- as_object* getIExternalizableInterface();
-
}
-class IExternalizable_as : public as_object
-{
-
-public:
-
- IExternalizable_as()
- :
- as_object(getIExternalizableInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void iexternalizable_class_init(as_object& where, const ObjectURI& uri)
+void
+iexternalizable_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 = getIExternalizableInterface();
- cl = gl->createClass(&iexternalizable_ctor, proto);
- attachIExternalizableStaticInterface(*cl);
- }
-
- // Register _global.IExternalizable
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, iexternalizable_ctor,
+ attachIExternalizableInterface,
+ attachIExternalizableStaticInterface, uri);
}
namespace {
@@ -83,23 +62,9 @@
{
}
-as_object*
-getIExternalizableInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachIExternalizableInterface(*o);
- }
- return o.get();
-}
-
as_value
-iexternalizable_writeExternal(const fn_call& fn)
+iexternalizable_writeExternal(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<IExternalizable_as> ptr =
- ensureType<IExternalizable_as>(fn.this_ptr);
- UNUSED(ptr);
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -107,9 +72,7 @@
as_value
iexternalizable_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new IExternalizable_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/utils/Proxy_as.cpp'
--- a/libcore/asobj/flash/utils/Proxy_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/utils/Proxy_as.cpp 2009-08-20 08:12:22 +0000
@@ -45,36 +45,14 @@
as_value proxy_ctor(const fn_call& fn);
void attachProxyInterface(as_object& o);
void attachProxyStaticInterface(as_object& o);
- as_object* getProxyInterface();
-
}
-class Proxy_as : public as_object
-{
-
-public:
-
- Proxy_as()
- :
- as_object(getProxyInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void proxy_class_init(as_object& where, const ObjectURI& uri)
+void
+proxy_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 = getProxyInterface();
- cl = gl->createClass(&proxy_ctor, proto);
- attachProxyStaticInterface(*cl);
- }
-
- // Register _global.Proxy
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, proxy_ctor, attachProxyInterface,
+ attachProxyStaticInterface, uri);
}
namespace {
@@ -100,103 +78,65 @@
}
-as_object*
-getProxyInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachProxyInterface(*o);
- }
- return o.get();
-}
-
-as_value
-proxy_deleteProperty(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_getDescendants(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_getProperty(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_hasProperty(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_isAttribute(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_nextName(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_nextNameIndex(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_nextValue(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-proxy_setProperty(const fn_call& fn)
-{
- boost::intrusive_ptr<Proxy_as> ptr =
- ensureType<Proxy_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+proxy_deleteProperty(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_getDescendants(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_getProperty(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_hasProperty(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_isAttribute(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_nextName(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_nextNameIndex(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_nextValue(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+proxy_setProperty(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -204,9 +144,7 @@
as_value
proxy_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new Proxy_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/utils/Timer_as.cpp'
--- a/libcore/asobj/flash/utils/Timer_as.cpp 2009-07-29 05:40:20 +0000
+++ b/libcore/asobj/flash/utils/Timer_as.cpp 2009-08-20 08:12:22 +0000
@@ -44,32 +44,12 @@
}
-class Timer_as : public as_object
-{
-
-public:
-
- Timer_as()
- :
- as_object(getTimerInterface())
- {}
-};
-
// extern (used by Global.cpp)
-void timer_class_init(as_object& where, const ObjectURI& uri)
+void
+timer_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 = getTimerInterface();
- cl = gl->createClass(&timer_ctor, proto);
- attachTimerStaticInterface(*cl);
- }
-
- // Register _global.Timer
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinClass(where, timer_ctor, attachTimerInterface,
+ attachTimerStaticInterface, uri);
}
namespace {
@@ -89,53 +69,30 @@
{
}
-as_object*
-getTimerInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o ) {
- o = new as_object();
- attachTimerInterface(*o);
- }
- return o.get();
-}
-
-as_value
-timer_start(const fn_call& fn)
-{
- boost::intrusive_ptr<Timer_as> ptr =
- ensureType<Timer_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-timer_stop(const fn_call& fn)
-{
- boost::intrusive_ptr<Timer_as> ptr =
- ensureType<Timer_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-timer_timer(const fn_call& fn)
-{
- boost::intrusive_ptr<Timer_as> ptr =
- ensureType<Timer_as>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl (__FUNCTION__);
- return as_value();
-}
-
-as_value
-timer_timerComplete(const fn_call& fn)
-{
- boost::intrusive_ptr<Timer_as> ptr =
- ensureType<Timer_as>(fn.this_ptr);
- UNUSED(ptr);
+as_value
+timer_start(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+timer_stop(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+timer_timer(const fn_call& /*fn*/)
+{
+ log_unimpl (__FUNCTION__);
+ return as_value();
+}
+
+as_value
+timer_timerComplete(const fn_call& /*fn*/)
+{
log_unimpl (__FUNCTION__);
return as_value();
}
@@ -143,9 +100,7 @@
as_value
timer_ctor(const fn_call& /*fn*/)
{
- boost::intrusive_ptr<as_object> obj = new Timer_as;
-
- return as_value(obj.get()); // will keep alive
+ return as_value();
}
} // anonymous namespace
=== modified file 'libcore/asobj/flash/xml/XMLDocument_as.cpp'
--- a/libcore/asobj/flash/xml/XMLDocument_as.cpp 2009-08-18 10:32:14
+0000
+++ b/libcore/asobj/flash/xml/XMLDocument_as.cpp 2009-08-20 06:55:15
+0000
@@ -868,7 +868,7 @@
xml_ondata(const fn_call& fn)
{
- as_object* thisPtr = fn.this_ptr.get();
+ as_object* thisPtr = fn.this_ptr;
assert(thisPtr);
// See http://gitweb.freedesktop.org/?p=swfdec/swfdec.git;
=== modified file 'libcore/asobj/flash/xml/XMLNodeType_as.cpp'
--- a/libcore/asobj/flash/xml/XMLNodeType_as.cpp 2009-07-31 07:38:05
+0000
+++ b/libcore/asobj/flash/xml/XMLNodeType_as.cpp 2009-08-20 08:57:16
+0000
@@ -43,12 +43,7 @@
void
xmlnodetype_class_init(as_object& where, const ObjectURI& uri)
{
- Global_as* gl = getGlobal(where);
- as_object* proto = getObjectInterface();
- as_object* o = gl->createObject(proto);
- attachXMLNodeTypeStaticInterface(*o);
- where.init_member(getName(uri), o, as_object::DefaultFlags,
- getNamespace(uri));
+ registerBuiltinObject(where, attachXMLNodeTypeStaticInterface, uri);
}
namespace {
=== modified file 'libcore/swf_function.cpp'
--- a/libcore/swf_function.cpp 2009-08-18 08:00:20 +0000
+++ b/libcore/swf_function.cpp 2009-08-20 06:55:15 +0000
@@ -352,7 +352,7 @@
// in case of problems (most interesting action limits)
try
{
- ActionExec exec(*this, m_env, &result, fn.this_ptr.get());
+ ActionExec exec(*this, m_env, &result, fn.this_ptr);
exec();
}
catch (ActionLimitException& ale) // expected and sane
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-08-19 07:12:11 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-08-20 06:55:15 +0000
@@ -2769,9 +2769,10 @@
debugger.matchBreakPoint(function_name, true);
#endif
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> );
- args->reserve(nargs);
- for (size_t i=0; i<nargs; ++i) args->push_back(env.pop());
+ fn_call::Args args;
+ for (size_t i = 0; i < nargs; ++i) {
+ args += env.pop();
+ }
as_value result = call_method(function, env, this_ptr,
args, super, &(thread.code.getMovieDefinition()));
@@ -3451,9 +3452,10 @@
}
#endif
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> );
- args->reserve(nargs);
- for (size_t i=0; i<nargs; ++i) args->push_back(env.pop());
+ fn_call::Args args;
+ for (size_t i = 0; i < nargs; ++i) {
+ args += env.pop();
+ }
as_value result = call_method(method_val, env, this_ptr,
args, super, &(thread.code.getMovieDefinition()));
@@ -4170,9 +4172,10 @@
unsigned int nargs)
{
assert(ctor_as_func);
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
- args->reserve(nargs);
- for (size_t i=0; i<nargs; ++i) args->push_back(env.pop());
+ fn_call::Args args;
+ for (size_t i = 0; i < nargs; ++i) {
+ args += env.pop();
+ }
return ctor_as_func->constructInstance(env, args).get();
}
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2009-08-07 08:43:01 +0000
+++ b/libcore/vm/Machine.cpp 2009-08-20 06:55:15 +0000
@@ -1391,8 +1391,9 @@
as_value result;
asName a = pool_name(mStream->read_V32(), mPoolObject);
boost::uint32_t argc = mStream->read_V32();
- std::auto_ptr< std::vector<as_value> > args =
- get_args(argc);
+
+ fn_call::Args args;
+ get_args(argc, args);
if (a.isRuntime()) {
_stack.drop(completeName(a));
@@ -1508,7 +1509,8 @@
case SWF::ABC_ACTION_CONSTRUCTSUPER:
{
boost::uint32_t argc = mStream->read_V32();
- get_args(argc);
+ fn_call::Args args;
+ get_args(argc, args);
as_object* obj =
_stack.top(argc).to_object(*_global).get();
@@ -1546,7 +1548,8 @@
asName a = pool_name(mStream->read_V32(), mPoolObject);
boost::uint32_t argc = mStream->read_V32();
- std::auto_ptr<std::vector<as_value> > args =
get_args(argc);
+ fn_call::Args args;
+ get_args(argc, args);
log_abc("CONSTRUCT_PROP: will try to construct property "
"%s on object %s", mST.value(a.getGlobalName()),
@@ -1718,8 +1721,10 @@
as_environment env = as_environment(_vm);
as_value property = new_class->getMember(
NSV::PROP_uuCONSTRUCTORuu, 0);
+
+ fn_call::Args args;
as_value value = call_method(property, env, new_class,
- get_args(0));
+ args);
log_abc("NEWCLASS(%2%) finished. Return: %1%", value,
mST.value(c->getName()));
@@ -3004,10 +3009,10 @@
assert(func);
// TODO: Set up the fn to use the stack
- std::auto_ptr<std::vector<as_value> > args(new std::vector<as_value>);
+ fn_call::Args args;
size_t st = 0;
while (st < stack_in) {
- args->push_back(_stack.top(st));
+ args += _stack.top(st);
++st;
}
@@ -3307,16 +3312,14 @@
log_abc("%s", ss.str());
}
-std::auto_ptr<std::vector<as_value> >
-Machine::get_args(unsigned int argc)
+void
+Machine::get_args(size_t argc, fn_call::Args& args)
{
- std::auto_ptr<std::vector<as_value> > args =
- std::auto_ptr<std::vector<as_value> >(new std::vector<as_value>);
- args->resize(argc);
- for (unsigned int i = argc; i > 0; --i) {
- args->at(i-1) = pop_stack();
+ std::vector<as_value> v(argc);
+ for (size_t i = argc; i > 0; --i) {
+ v.at(i-1) = pop_stack();
}
- return args;
+ args.swap(v);
}
void
=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h 2009-08-07 08:43:01 +0000
+++ b/libcore/vm/Machine.h 2009-08-20 06:55:15 +0000
@@ -27,6 +27,7 @@
#include "SWF.h"
#include "as_environment.h"
#include "VM.h"
+#include "fn_call.h"
namespace gnash {
class Global_as;
@@ -287,7 +288,7 @@
void print_scope_stack();
- std::auto_ptr< std::vector<as_value> > get_args(unsigned int argc);
+ void get_args(size_t argc, fn_call::Args& args);
void load_function(CodeStream* stream, boost::uint32_t maxRegisters);
=== modified file 'libcore/vm/action.cpp'
--- a/libcore/vm/action.cpp 2009-06-15 11:32:49 +0000
+++ b/libcore/vm/action.cpp 2009-08-20 06:55:15 +0000
@@ -49,8 +49,8 @@
/// @param this_ptr this is ourself.
as_value
-call_method(const as_value& method, const as_environment& env, as_object*
this_ptr,
- std::auto_ptr< std::vector<as_value> > args, as_object* super,
+call_method(const as_value& method, const as_environment& env,
+ as_object* this_ptr, fn_call::Args& args, as_object* super,
const movie_definition* callerDef)
{
as_value val;
@@ -88,8 +88,7 @@
call_method0(const as_value& method, const as_environment& env,
as_object* this_ptr)
{
- // TODO: avoid allocating a vector here
- std::auto_ptr< std::vector<as_value> > args(new std::vector<as_value>);
+ fn_call::Args args;
return call_method(method, env, this_ptr, args);
}
=== modified file 'libcore/vm/action.h'
--- a/libcore/vm/action.h 2009-04-01 07:00:32 +0000
+++ b/libcore/vm/action.h 2009-08-20 06:55:15 +0000
@@ -25,6 +25,7 @@
#include "as_object.h"
#include "smart_ptr.h"
+#include "fn_call.h"
#include <vector>
#include <memory>
@@ -52,7 +53,7 @@
const as_environment& env,
// this is ourself
as_object* this_ptr,
- std::auto_ptr<std::vector<as_value> > args,
+ fn_call::Args& args,
// the super object
as_object* super=0,
// the movie_definition containing caller code
=== modified file 'libcore/vm/fn_call.h'
--- a/libcore/vm/fn_call.h 2009-08-17 08:42:00 +0000
+++ b/libcore/vm/fn_call.h 2009-08-20 06:55:15 +0000
@@ -42,6 +42,51 @@
namespace gnash {
+/// A class to contain transferable arguments for a fn_call.
+//
+/// The operators += and , are implemented for intuitive syntax:
+//
+/// FunctionArgs<as_value> args; args += 0.0, "string", NaN.
+//
+/// This may have unexpected side effects if it is used in unexpected ways,
+/// so stick to using such lists, or use operator += repeatedly.
+//
+/// The arguments can be moved to another container, and this happens when
+/// the FunctionArgs object is passed to fn_call. It will still be valid
+/// afterwards, but will contain no arguments.
+template<typename T>
+class FunctionArgs
+{
+public:
+
+ typedef typename std::vector<T>::size_type size_type;
+ typedef std::vector<T> container_type;
+ typedef T value_type;
+
+ FunctionArgs() {}
+
+ FunctionArgs& operator+=(const T& t) {
+ _v.push_back(t);
+ return *this;
+ }
+
+ FunctionArgs& operator,(const T& t) {
+ _v.push_back(t);
+ return *this;
+ }
+
+ void swap(std::vector<T>& to) {
+ std::swap(_v, to);
+ }
+
+ size_type size() const {
+ return _v.size();
+ }
+
+private:
+ std::vector<T> _v;
+};
+
/// \brief
/// Parameters/environment for builtin or user-defined functions
@@ -49,15 +94,17 @@
class fn_call
{
public:
+ typedef FunctionArgs<as_value> Args;
+
/// The as_object (or a pointer derived thereof) on which this call
/// is taking place.
- boost::intrusive_ptr<as_object> this_ptr;
+ as_object* this_ptr;
/// The "super" object in this function call context
as_object* super;
/// Number of arguments to this ActionScript function call.
- unsigned int nargs;
+ Args::size_type nargs;
/// Definition containing caller code. 0 if spontaneous (system event).
const movie_definition* callerDef;
@@ -70,7 +117,7 @@
callerDef(fn.callerDef),
_new(false),
_env(fn._env),
- _args(fn._args.get() ? new std::vector<as_value>(*fn._args) : 0)
+ _args(fn._args)
{
}
@@ -82,7 +129,7 @@
callerDef(fn.callerDef),
_new(false),
_env(fn._env),
- _args(fn._args.get() ? new std::vector<as_value>(*fn._args) : 0)
+ _args(fn._args)
{
}
@@ -101,17 +148,16 @@
}
fn_call(as_object* this_in, const as_environment& env_in,
- std::auto_ptr<std::vector<as_value> > args, as_object*
sup = 0,
- bool isNew = false)
+ Args& args, as_object* sup = 0, bool isNew = false)
:
this_ptr(this_in),
super(sup),
- nargs(args->size()),
+ nargs(args.size()),
callerDef(0),
_new(isNew),
- _env(env_in),
- _args(args)
+ _env(env_in)
{
+ args.swap(_args);
}
fn_call(as_object* this_in, const as_environment& env_in)
@@ -144,20 +190,20 @@
}
/// Access a particular argument.
- const as_value& arg(unsigned int n) const
+ const Args::value_type& arg(unsigned int n) const
{
assert(n < nargs);
- return (*_args)[n];
+ return _args[n];
}
- const std::vector<as_value>& getArgs() const {
- return *_args;
+ const Args::container_type& getArgs() const {
+ return _args;
}
void drop_bottom()
{
- assert(_args.get() && !_args->empty());
- _args->erase(_args->begin());
+ assert(!_args.empty());
+ _args.erase(_args.begin());
--nargs;
}
@@ -169,7 +215,7 @@
/// Dump arguments to given output stream
void dump_args(std::ostream& os) const
{
- for (unsigned int i=0; i<nargs; ++i)
+ for (size_t i = 0; i < nargs; ++i)
{
if ( i ) os << ", ";
os << arg(i).toDebugString();
@@ -186,14 +232,14 @@
void resetArgs()
{
- nargs=0;
- _args->clear();
+ nargs = 0;
+ _args.clear();
}
- void pushArg(const as_value& arg)
+ void pushArg(const Args::value_type& arg)
{
++nargs;
- _args->push_back(arg);
+ _args.push_back(arg);
}
private:
@@ -205,13 +251,14 @@
const as_environment& _env;
/// The actual arguments
- std::auto_ptr< std::vector<as_value> > _args;
+ Args::container_type _args;
- void readArgs(const as_environment& env, int first_in, int nargs)
+ void readArgs(const as_environment& env, int first_in, size_t nargs)
{
- _args.reset(new std::vector<as_value>);
- for (int i=0; i<nargs; ++i)
- _args->push_back(env.bottom(first_in - i));
+ _args.clear();
+ for (size_t i = 0; i < nargs; ++i) {
+ _args.push_back(env.bottom(first_in - i));
+ }
}
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11432: Cleanups, reduce code duplication.,
Benjamin Wolsey <=