Пример #1
0
void
attachNumberInterface(as_object& o)
{
    VM& vm = getVM(o);
    o.init_member("valueOf", vm.getNative(106, 0));
    o.init_member("toString", vm.getNative(106, 1));
}
Пример #2
0
static void
attachInterface(as_object& obj)
{
    Global_as& gl = getGlobal(obj);
    
    obj.init_member("pass", gl.createFunction(dejagnu_pass));
    obj.init_member("fail", gl.createFunction(dejagnu_fail));
    obj.init_member("totals", gl.createFunction(dejagnu_totals));
}
Пример #3
0
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);
}
Пример #4
0
void
attachLoadableInterface(as_object& o, int flags)
{
    Global_as& gl = getGlobal(o);

	o.init_member("addRequestHeader", gl.createFunction(
	            loadableobject_addRequestHeader), flags);
	o.init_member("getBytesLoaded", gl.createFunction(
	            loadableobject_getBytesLoaded),flags);
	o.init_member("getBytesTotal", gl.createFunction(
                loadableobject_getBytesTotal), flags);
}
Пример #5
0
static void
attachInterface(as_object& obj)
{
    GNASH_REPORT_FUNCTION;
    Global_as& gl = getGlobal(obj);
    obj.init_member("setSocketName", gl.createFunction(dbus_ext_setsockname));
}
Пример #6
0
// extern (used by Global.cpp)
void
initObjectClass(as_object* proto, as_object& where, const ObjectURI& uri)
{

    assert(proto);

    // Object is a native constructor.
    VM& vm = getVM(where);
    as_object* cl = vm.getNative(101, 9);
    cl->init_member(NSV::PROP_PROTOTYPE, proto);
    proto->init_member(NSV::PROP_CONSTRUCTOR, cl);

    attachObjectInterface(*proto);

    // The as_function ctor takes care of initializing these, but they
    // are different for the Object class.
    const int readOnly = PropFlags::readOnly;
    cl->set_member_flags(NSV::PROP_uuPROTOuu, readOnly);
    cl->set_member_flags(NSV::PROP_CONSTRUCTOR, readOnly);
    cl->set_member_flags(NSV::PROP_PROTOTYPE, readOnly);

    const int readOnlyFlags = as_object::DefaultFlags | PropFlags::readOnly;
    cl->init_member("registerClass", vm.getNative(101, 8), readOnlyFlags);
             
    // Register _global.Object (should only be visible in SWF5 up)
    int flags = PropFlags::dontEnum; 
    where.init_member(uri, cl, flags);

}
Пример #7
0
void
registerBitmapClass(as_object& where, Global_as::ASFunction ctor,
        Global_as::Properties p, const ObjectURI& uri)
{
    Global_as& gl = getGlobal(where);

    VM& vm = getVM(where);

    // We should be looking for flash.filters.BitmapFilter, but as this
    // triggers a lookup of the flash.filters package while we are creating
    // it, so entering infinite recursion, we'll cheat and assume that
    // the object 'where' is the filters package.
    as_function* constructor =
        getMember(where, getURI(vm, "BitmapFilter")).to_function();
    
    as_object* proto;
    if (constructor) {
        fn_call::Args args;
        VM& vm = getVM(where);
        proto = constructInstance(*constructor, as_environment(vm), args);
    }
    else proto = 0;

    as_object* cl = gl.createClass(ctor, createObject(gl));
    if (proto) p(*proto);

    // The startup script overwrites the prototype assigned by ASconstructor,
    // so the new prototype doesn't have a constructor property. We do the
    // same here.
    cl->set_member(NSV::PROP_PROTOTYPE, proto);
    where.init_member(uri , cl, as_object::DefaultFlags);

}
Пример #8
0
void
flash_filters_package_init(as_object& where, const ObjectURI& uri)
{
    // TODO: this may not be correct, but it should be enumerable.
    const int flags = 0;
    where.init_destructive_property(uri, get_flash_filters_package, flags);
}
Пример #9
0
void
bitmapfilter_class_init(as_object& where, const ObjectURI& uri)
{
    // TODO: this may not be correct, but it should be enumerable.
    const int flags = 0;
    where.init_destructive_property(uri, getBitmapFilterConstructor, flags);
}
Пример #10
0
void
point_class_init(as_object& where, const ObjectURI& uri)
{
    // TODO: this may not be correct, but it should be enumerable.
    const int flags = 0;
    where.init_destructive_property(uri, get_flash_geom_point_constructor,
            flags);
}
Пример #11
0
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, filereference_creationDate);
    o.init_property("creator", filereference_creator, filereference_creator);
    o.init_property("modificationDate", filereference_modificationDate, filereference_modificationDate);
    o.init_property("name", filereference_name, filereference_name);
    o.init_property("size", filereference_size, filereference_size);
    o.init_property("type", filereference_type, filereference_type);
}
Пример #12
0
void
dbus_class_init(as_object &obj)
{
    Global_as& gl = getGlobal(obj);
    as_object* proto = createObject(gl);
    attachInterface(*proto);
    as_object* cl = gl.createClass(&dbus_ctor, proto);
	
	obj.init_member("Dbus", cl);
}
Пример #13
0
// extern (used by Global.cpp)
void
video_class_init(as_object& global, const ObjectURI& uri)
{
    Global_as& gl = getGlobal(global);
    as_object* proto = createObject(gl);
    as_object* cl = gl.createClass(emptyFunction, proto);
    attachVideoInterface(*proto);

    // Register _global.Video
    global.init_member(uri, cl, as_object::DefaultFlags);
}
Пример #14
0
// extern (used by Global.cpp)
void
video_class_init(as_object& global, const ObjectURI& uri)
{
	// This is going to be the global Video "class"/"function"
    Global_as& gl = getGlobal(global);
    as_object* proto = createObject(gl);
    as_object* cl = gl.createClass(&video_ctor, proto);
    attachVideoInterface(*proto);

	// Register _global.Video
	global.init_member(uri, cl, as_object::DefaultFlags);
}
Пример #15
0
void
attachAsBroadcasterStaticInterface(as_object& o)
{
    const int flags = PropFlags::dontEnum |
                      PropFlags::dontDelete |
                      PropFlags::onlySWF6Up;

    Global_as& gl = getGlobal(o);

    o.init_member("initialize",
            gl.createFunction(asbroadcaster_initialize), flags);
    o.init_member(NSV::PROP_ADD_LISTENER,
            gl.createFunction(asbroadcaster_addListener), flags);
    o.init_member(NSV::PROP_REMOVE_LISTENER,
            gl.createFunction(asbroadcaster_removeListener), flags);

    VM& vm = getVM(o);
    o.init_member(NSV::PROP_BROADCAST_MESSAGE, vm.getNative(101, 12),
            flags);

}
Пример #16
0
// extern (used by Global.cpp)
void
displayobject_class_init(as_object& where, const ObjectURI& uri)
{
    Global_as& gl = getGlobal(where);
    as_object* proto = gl.createObject();
    attachDisplayObjectInterface(*proto);
    as_object* cl = gl.createClass(&displayobject_ctor, proto);
    attachDisplayObjectStaticInterface(*cl);

    // Register _global.DisplayObject
    where.init_member(uri, cl, as_object::DefaultFlags);
}
Пример #17
0
// extern (used by Global.cpp)
void
sound_class_init(as_object& where, const ObjectURI& uri)
{

    Global_as& gl = getGlobal(where);
    as_object* proto = createObject(gl);
    as_object* cl = gl.createClass(&sound_new, proto);
    attachSoundInterface(*proto);
    proto->set_member_flags(NSV::PROP_CONSTRUCTOR, PropFlags::readOnly);
    proto->set_member_flags(NSV::PROP_uuPROTOuu, PropFlags::readOnly, 0);

    where.init_member(uri, cl, as_object::DefaultFlags);
}
Пример #18
0
/// This provides the prototype and static methods for TextField.
//
/// For SWF5 there is initially no prototype, for SWF6+ there is a 
/// limited prototype. This is changed later on instantiation of a
/// TextField.
void
textfield_class_init(as_object& where, const ObjectURI& uri)
{

    Global_as& gl = getGlobal(where);
    as_object* proto = createObject(gl);
    as_object* cl = gl.createClass(&textfield_ctor, proto);

    attachTextFieldInterface(*proto);
    attachTextFieldStaticMembers(*cl);
             
    where.init_member(uri, cl, as_object::DefaultFlags);

    // ASSetPropFlags is called on the TextField class.
    as_object* null = nullptr;
    callMethod(&gl, NSV::PROP_AS_SET_PROP_FLAGS, cl, null, 131);
}
Пример #19
0
// extern (used by Global.cpp)
void
boolean_class_init(as_object& where, const ObjectURI& uri)
{
    VM& vm = getVM(where);
    Global_as& gl = getGlobal(where);

    as_object* proto = gl.createObject();
    as_object* cl = vm.getNative(107, 2);
    cl->init_member(NSV::PROP_PROTOTYPE, proto);
    proto->init_member(NSV::PROP_CONSTRUCTOR, cl);

    attachBooleanInterface(*proto);
    
    // Register _global.Boolean
    where.init_member(uri, cl, as_object::DefaultFlags);

}
Пример #20
0
    void
    launcher_class_init(as_object &obj)
    {
//	GNASH_REPORT_FUNCTION;
	// This is going to be the global "class"/"function"
	static boost::intrusive_ptr<builtin_function> cl;
	if (cl == NULL) {
        Global_as* gl = getGlobal(global);
        as_object* proto = getInterface();
        cl = gl->createClass(&launcher_ctor, proto);
// 	    // replicate all interface to class, to be able to access
// 	    // all methods as static functions
 	    attachInterface(cl.get());
	}
	
	obj.init_member("Launcher", cl.get());
    }
Пример #21
0
/// Extern.
void
moviecliploader_class_init(as_object& where, const ObjectURI& uri)
{
	// This is going to be the where Number "class"/"function"
    Global_as& gl = getGlobal(where);

    as_object* proto = createObject(gl);;

    as_object* cl = gl.createClass(&moviecliploader_new, proto);
    attachMovieClipLoaderInterface(*proto);
  
	AsBroadcaster::initialize(*proto);

    as_object* null = 0;
    callMethod(&gl, NSV::PROP_AS_SET_PROP_FLAGS, proto, null, 1027);

	where.init_member(uri, cl, as_object::DefaultFlags); 
}
Пример #22
0
// extern (used by Global.cpp)
void
accessibility_class_init(as_object& where, const ObjectURI& uri)
{

    Global_as& gl = getGlobal(where);

    const int flags = as_object::DefaultFlags | PropFlags::readOnly;

    // This object has unusual properties.
    as_object* obj = createObject(gl);
    obj->set_member_flags(NSV::PROP_uuPROTOuu, flags);
    obj->init_member(NSV::PROP_CONSTRUCTOR, getMember(gl, NSV::CLASS_OBJECT),
            flags);

    attachAccessibilityStaticInterface(*obj);

    // Register _global.Accessibility
    where.init_member(uri, obj, as_object::DefaultFlags);
}
Пример #23
0
void 
AsBroadcaster::initialize(as_object& o)
{
    Global_as& gl = getGlobal(o);

    // Find _global.AsBroadcaster.
    as_object* asb =
        gl.getMember(NSV::CLASS_AS_BROADCASTER).to_object(gl);

    // If it's not an object, these are left undefined, but they are
    // always attached to the initialized object.
    as_value al, rl;

    const int flags = as_object::DefaultFlags;

    if (asb) {
        al = asb->getMember(NSV::PROP_ADD_LISTENER);
        rl = asb->getMember(NSV::PROP_REMOVE_LISTENER);
    }
    
    o.set_member(NSV::PROP_ADD_LISTENER, al);
    o.set_member(NSV::PROP_REMOVE_LISTENER, rl);
    
    // The function returned by ASnative(101, 12) is attached, even though
    // this may not exist (e.g. if _global.ASnative is altered)
    const as_value& asn = callMethod(&gl, NSV::PROP_AS_NATIVE, 101, 12);
    o.set_member(NSV::PROP_BROADCAST_MESSAGE, asn);

    // This corresponds to  "_listeners = [];", which is different from
    // _listeners = new Array();
    o.set_member(NSV::PROP_uLISTENERS, gl.createArray());
 
    // This function should call ASSetPropFlags on these four properties.
    o.set_member_flags(NSV::PROP_BROADCAST_MESSAGE, flags);
    o.set_member_flags(NSV::PROP_ADD_LISTENER, flags);
    o.set_member_flags(NSV::PROP_REMOVE_LISTENER, flags);
    o.set_member_flags(NSV::PROP_uLISTENERS, flags);

}
Пример #24
0
// extern (used by Global.cpp)
void
string_class_init(as_object& where, const ObjectURI& uri)
{
    // This is going to be the global String "class"/"function"
    
    VM& vm = getVM(where);
    Global_as& gl = getGlobal(where);

    as_object* proto = gl.createObject();
    as_object* cl = vm.getNative(251, 0);
    cl->init_member(NSV::PROP_PROTOTYPE, proto);
    proto->init_member(NSV::PROP_CONSTRUCTOR, cl);

    attachStringInterface(*proto);

    cl->init_member("fromCharCode", vm.getNative(251, 14)); 

    const int flags = PropFlags::dontEnum; 
    where.init_member(uri, cl, flags);
}
Пример #25
0
static void
attachCameraInterface(as_object& o)
{
    
    const int flags = as_object::DefaultFlags | PropFlags::onlySWF6Up;

    VM& vm = getVM(o);
    o.init_member("setMode", vm.getNative(2102, 0), flags);
    o.init_member("setQuality", vm.getNative(2102, 1), flags);
    o.init_member("setKeyFrameInterval", vm.getNative(2102, 2), flags);
    o.init_member("setMotionLevel", vm.getNative(2102, 3), flags);
    o.init_member("setLoopback", vm.getNative(2102, 4), flags);
    o.init_member("setCursor", vm.getNative(2102, 5), flags);

}
Пример #26
0
void
function_class_init(as_object& where, const ObjectURI& uri)
{
    Global_as& gl = getGlobal(where);

    NativeFunction* func = new NativeFunction(gl, function_ctor);
    as_object* proto = createObject(gl);

    func->init_member(NSV::PROP_PROTOTYPE, proto);
    func->init_member(NSV::PROP_CONSTRUCTOR, func);
    proto->init_member(NSV::PROP_CONSTRUCTOR, func); 

	// Register _global.Function, only visible for SWF6 up
	const int swf6flags = as_object::DefaultFlags | PropFlags::onlySWF6Up;
	func->init_member(NSV::PROP_uuPROTOuu, proto, swf6flags);
	where.init_member(uri, func, swf6flags);
    
    VM& vm = getVM(where);

    // Note: these are the first functions created, and they need the
    // Function class to be registered.
    proto->init_member("call", vm.getNative(101, 10), swf6flags);
    proto->init_member("apply", vm.getNative(101, 11), swf6flags);
}
Пример #27
0
void
attachNumberStaticInterface(as_object& o)
{
    // constant flags
    const int cflags = as_object::DefaultFlags | PropFlags::readOnly;

    // Set __proto__ and constructor to constant.
    as_value null; null.set_null();
    o.setPropFlags(null, 0, cflags);

    // Not quite the same as numeric_limits<double>::max()
    o.init_member("MAX_VALUE", 1.79769313486231e+308, cflags);
    // This is generally numeric_limits<double>::denorm_min().
    o.init_member("MIN_VALUE", 4.94065645841247e-324, cflags);
    o.init_member("NaN", as_value(NaN), cflags);
    o.init_member("POSITIVE_INFINITY",
            as_value(std::numeric_limits<double>::infinity()), cflags);
    o.init_member("NEGATIVE_INFINITY",
            as_value(-std::numeric_limits<double>::infinity()), cflags);
}
Пример #28
0
void
attachCameraAS3StaticInterface(as_object& o)
{
    Global_as& gl = getGlobal(o);
    o.init_member("getCamera", gl.createFunction(camera_getCamera));
}
Пример #29
0
void
SharedObject_as::setReachable() 
{
    _owner.setReachable();
    if (_data) _data->setReachable();
}
Пример #30
0
void
Global_as::makeObject(as_object& o) const
{
    o.set_prototype(_objectProto);
}