예제 #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
파일: Object.cpp 프로젝트: jlopez/gnash
// 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
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);
}
예제 #9
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);
}
예제 #10
0
파일: Video_as.cpp 프로젝트: jlopez/gnash
// 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);
}
예제 #11
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);
}
예제 #12
0
파일: Video_as.cpp 프로젝트: sunarto/gnash
// 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);
}
예제 #13
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);

}
예제 #14
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);
}
예제 #15
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);
}
예제 #16
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());
    }
예제 #17
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);

}
예제 #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.
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); 
}
예제 #20
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);
}
예제 #21
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);
}
예제 #22
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);

}
예제 #23
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);
}
예제 #24
0
void
attachCameraAS3StaticInterface(as_object& o)
{
    Global_as& gl = getGlobal(o);
    o.init_member("getCamera", gl.createFunction(camera_getCamera));
}