Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 66
View file
lightspark.spec
Changed
@@ -24,7 +24,7 @@ %endif Name: lightspark -Version: 0.7.2.99+git20150419.1419 +Version: 0.7.2.99+git20150510.1846 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/CMakeLists.txt
Changed
@@ -87,6 +87,7 @@ scripting/flash/events/flashevents.cpp scripting/flash/external/ExternalInterface.cpp scripting/flash/filters/flashfilters.cpp + scripting/flash/filesystem/flashfilesystem.cpp scripting/flash/geom/flashgeom.cpp scripting/flash/media/flashmedia.cpp scripting/flash/net/flashnet.cpp @@ -95,6 +96,7 @@ scripting/flash/net/XMLSocket.cpp scripting/flash/net/NetStreamPlayOptions.cpp scripting/flash/net/NetStreamPlayTransitions.cpp + scripting/flash/printing/flashprinting.cpp scripting/flash/errors/flasherrors.cpp scripting/flash/sensors/flashsensors.cpp scripting/flash/system/flashsystem.cpp
View file
lightspark.tar.xz/src/allclasses.cpp
Changed
@@ -45,6 +45,7 @@ #include "scripting/flash/display/IGraphicsPath.h" #include "scripting/flash/display/IGraphicsStroke.h" #include "scripting/flash/events/flashevents.h" +#include "scripting/flash/filesystem/flashfilesystem.h" #include "scripting/flash/filters/flashfilters.h" #include "scripting/flash/net/flashnet.h" #include "scripting/flash/net/URLRequestHeader.h" @@ -52,6 +53,7 @@ #include "scripting/flash/net/XMLSocket.h" #include "scripting/flash/net/NetStreamPlayOptions.h" #include "scripting/flash/net/NetStreamPlayTransitions.h" +#include "scripting/flash/printing/flashprinting.h" #include "scripting/flash/system/flashsystem.h" #include "scripting/flash/sensors/flashsensors.h" #include "scripting/flash/utils/flashutils.h"
View file
lightspark.tar.xz/src/allclasses.h
Changed
@@ -53,6 +53,7 @@ REGISTER_CLASS_NAME(Vector,"__AS3__.vec") //Accessibility +REGISTER_CLASS_NAME(Accessibility,"flash.accessibility") REGISTER_CLASS_NAME(AccessibilityProperties,"flash.accessibility") REGISTER_CLASS_NAME(AccessibilityImplementation,"flash.accessibility") @@ -139,15 +140,29 @@ REGISTER_CLASS_NAME(TouchEvent,"flash.events") REGISTER_CLASS_NAME(TransformGestureEvent,"flash.events") REGISTER_CLASS_NAME(UncaughtErrorEvent,"flash.events") +REGISTER_CLASS_NAME(UncaughtErrorEvents,"flash.events") +REGISTER_CLASS_NAME(VideoEvent,"flash.events") //External interface (browser interaction) REGISTER_CLASS_NAME(ExternalInterface,"flash.external") +//filesystem +REGISTER_CLASS_NAME(FileStream,"flash.filesystem") + //Filters REGISTER_CLASS_NAME(BitmapFilter,"flash.filters") REGISTER_CLASS_NAME(BitmapFilterQuality,"flash.filters") REGISTER_CLASS_NAME(DropShadowFilter,"flash.filters") REGISTER_CLASS_NAME(GlowFilter,"flash.filters") +REGISTER_CLASS_NAME(GradientGlowFilter,"flash.filters") +REGISTER_CLASS_NAME(BevelFilter,"flash.filters") +REGISTER_CLASS_NAME(ColorMatrixFilter,"flash.filters") +REGISTER_CLASS_NAME(BlurFilter,"flash.filters") +REGISTER_CLASS_NAME(ConvolutionFilter,"flash.filters") +REGISTER_CLASS_NAME(DisplacementMapFilter,"flash.filters") +REGISTER_CLASS_NAME(GradientBevelFilter,"flash.filters") +REGISTER_CLASS_NAME(ShaderFilter,"flash.filters") + //Geom REGISTER_CLASS_NAME(ColorTransform,"flash.geom") @@ -156,6 +171,8 @@ REGISTER_CLASS_NAME2(Rectangle,"Rectangle","flash.geom") REGISTER_CLASS_NAME(Transform,"flash.geom") REGISTER_CLASS_NAME(Vector3D,"flash.geom") +REGISTER_CLASS_NAME(Matrix3D,"flash.geom") +REGISTER_CLASS_NAME(PerspectiveProjection,"flash.geom") //Media REGISTER_CLASS_NAME(Sound,"flash.media") @@ -168,7 +185,9 @@ REGISTER_CLASS_NAME(VideoStatus,"flash.media") //Net +REGISTER_CLASS_NAME(LocalConnection,"flash.net") REGISTER_CLASS_NAME(NetConnection,"flash.net") +REGISTER_CLASS_NAME(NetGroup,"flash.net") REGISTER_CLASS_NAME(NetStream,"flash.net") REGISTER_CLASS_NAME(NetStreamAppendBytesAction,"flash.net") REGISTER_CLASS_NAME(NetStreamPlayTransitions,"flash.net") @@ -177,6 +196,7 @@ REGISTER_CLASS_NAME(Responder,"flash.net") REGISTER_CLASS_NAME(SharedObject,"flash.net") REGISTER_CLASS_NAME(SharedObjectFlushStatus,"flash.net") +REGISTER_CLASS_NAME(ASSocket,"flash.net") REGISTER_CLASS_NAME(URLLoader,"flash.net") REGISTER_CLASS_NAME(URLLoaderDataFormat,"flash.net") REGISTER_CLASS_NAME(URLRequest,"flash.net") @@ -186,6 +206,13 @@ REGISTER_CLASS_NAME(URLVariables,"flash.net") REGISTER_CLASS_NAME(XMLSocket,"flash.net") +REGISTER_CLASS_NAME(DRMManager,"flash.net.drm") + +//Printing +REGISTER_CLASS_NAME(PrintJob,"flash.printing") +REGISTER_CLASS_NAME(PrintJobOptions,"flash.printing") +REGISTER_CLASS_NAME(PrintJobOrientation,"flash.printing") + //Errors REGISTER_CLASS_NAME(EOFError,"flash.errors") REGISTER_CLASS_NAME(IOError,"flash.errors") @@ -205,6 +232,7 @@ REGISTER_CLASS_NAME(Security,"flash.system") REGISTER_CLASS_NAME(SecurityDomain,"flash.system") REGISTER_CLASS_NAME(System,"flash.system") +REGISTER_CLASS_NAME(ASWorker,"flash.system") //Text REGISTER_CLASS_NAME2(ASFont,"Font","flash.text")
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -24,6 +24,7 @@ #include <limits> #include "compat.h" #include "parsing/amf3_generator.h" +#include "scripting/argconv.h" #include "scripting/toplevel/ASString.h" #include "scripting/toplevel/Date.h" #include "scripting/toplevel/XML.h" @@ -144,7 +145,7 @@ ++it; } - while(it->second.kind!=DYNAMIC_TRAIT) + while(it->second.kind!=DYNAMIC_TRAIT || !it->second.isenumerable) { ++i; ++it; @@ -180,6 +181,7 @@ void ASObject::sinit(Class_base* c) { c->setDeclaredMethodByQName("hasOwnProperty",AS3,Class<IFunction>::getFunction(hasOwnProperty),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setPropertyIsEnumerable",AS3,Class<IFunction>::getFunction(setPropertyIsEnumerable),NORMAL_METHOD,true); c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(_toLocaleString),DYNAMIC_TRAIT); @@ -462,13 +464,14 @@ if(classdef && classdef->borrowedVariables.findObjVar(name, NO_CREATE_TRAIT, DECLARED_TRAIT)!=NULL) return true; + NS_KIND nskind; //Check prototype inheritance chain if(getClass() && considerPrototype) { Prototype* proto = getClass()->prototype.getPtr(); while(proto) { - if(proto->getObj()->findGettable(name) != NULL) + if(proto->getObj()->findGettable(name,nskind) != NULL) return true; proto=proto->prevPrototype.getPtr(); } @@ -556,7 +559,7 @@ return true; } //Only dynamic traits are deletable - if (obj->kind != DYNAMIC_TRAIT) + if (obj->kind != DYNAMIC_TRAIT && obj->kind != INSTANCE_TRAIT) return false; assert(obj->getter==NULL && obj->setter==NULL && obj->var!=NULL); @@ -694,25 +697,26 @@ } void ASObject::initializeVariableByMultiname(const multiname& name, ASObject* o, multiname* typemname, - ABCContext* context, TRAIT_KIND traitKind) + ABCContext* context, TRAIT_KIND traitKind, bool bOverwrite) { check(); - - variable* obj=findSettable(name); - if(obj) + if (!bOverwrite) { - //Initializing an already existing variable - LOG(LOG_NOT_IMPLEMENTED,"Variable " << name << "already initialized"); - if (o != NULL) - o->decRef(); - return; + variable* obj=findSettable(name); + if(obj) + { + //Initializing an already existing variable + LOG(LOG_NOT_IMPLEMENTED,"Variable " << name << " already initialized"); + if (o != NULL) + o->decRef(); + return; + } } - Variables.initializeVar(name, o, typemname, context, traitKind,this); } variable::variable(TRAIT_KIND _k, ASObject* _v, multiname* _t, const Type* _type) - : var(_v),typeUnion(NULL),setter(NULL),getter(NULL),kind(_k),traitState(NO_STATE) + : var(_v),typeUnion(NULL),setter(NULL),getter(NULL),kind(_k),traitState(NO_STATE),isenumerable(true) { if(_type) { @@ -831,7 +835,7 @@ return &inserted->second; } -const variable* variables_map::findObjVar(const multiname& mname, uint32_t traitKinds) const +const variable* variables_map::findObjVar(const multiname& mname, uint32_t traitKinds, NS_KIND &nskind) const { uint32_t name=mname.normalizedNameId(); assert(!mname.ns.empty()); @@ -846,6 +850,7 @@ const nsNameAndKind& ns=ret->first.ns; if(ns==*nsIt) { + nskind = ns.getImpl().kind; if(ret->second.kind & traitKinds) return &ret->second; else @@ -870,11 +875,6 @@ /* If typename is a builtin type, we coerce obj. * It it's not it must be a user defined class, * so we try to find the class it is derived from and create an apropriate uninitialized instance */ - if (typemname->ns.size() >= 1 && typemname->ns[0].getImpl().name == "__AS3__.vec") - { - QName qname(getSys()->getStringFromUniqueId(typemname->name_s_id),typemname->ns[0].getImpl().name); - type = Template<Vector>::getTemplateInstance(qname,context).getPtr(); - } if (type == NULL) type = Type::getBuiltinType(typemname); if (type == NULL) @@ -904,14 +904,14 @@ if (type == Type::anyType) { // type could not be found, so it's stored as an uninitialized variable + LOG(LOG_CALLS,"add uninitialized var:"<<mname); uninitializedVar v; mainObj->incRef(); v.mainObj = mainObj; - v.mname = mname; + v.mname = &mname; v.traitKind = traitKind; - v.typemname = *typemname; - context->uninitializedVars.push_back(v); - + v.typemname = typemname; + context->addUninitializedVar(v); obj = getSys()->getUndefinedRef(); obj = type->coerce(obj); } @@ -922,10 +922,24 @@ obj = getSys()->getNullRef(); } else if (type != Class_object::getClass() && - dynamic_cast<const Class_base*>(type) - && ((Class_base*)type)->super) + dynamic_cast<const Class_base*>(type)) { - obj = ((Class_base*)type)->getInstance(false,NULL,0); + if (!((Class_base*)type)->super) + { + // super type could not be found, so the class is stored as an uninitialized variable + LOG(LOG_CALLS,"add uninitialized class var:"<<mname); + uninitializedVar v; + mainObj->incRef(); + v.mainObj = mainObj; + v.mname = &mname; + v.traitKind = traitKind; + v.typemname = typemname; + context->addUninitializedVar(v); + obj = getSys()->getUndefinedRef(); + obj = type->coerce(obj); + } + else + obj = ((Class_base*)type)->getInstance(false,NULL,0); } else { @@ -934,7 +948,7 @@ } } } - assert(traitKind==DECLARED_TRAIT || traitKind==CONSTANT_TRAIT); + assert(traitKind==DECLARED_TRAIT || traitKind==CONSTANT_TRAIT || traitKind == INSTANCE_TRAIT); uint32_t name=mname.normalizedNameId(); Variables.insert(make_pair(varName(name, mname.ns[0]), variable(traitKind, obj, typemname, type))); @@ -1045,6 +1059,21 @@ return abstract_b(true); return abstract_b(false); } +ASFUNCTIONBODY(ASObject,setPropertyIsEnumerable) +{ + tiny_string propname; + bool isEnum; + ARG_UNPACK(propname) (isEnum, true); + multiname name(NULL); + name.name_type=multiname::NAME_STRING; + name.name_s_id=getSys()->getUniqueStringId(args[0]->toString()); + name.ns.push_back(nsNameAndKind("",NAMESPACE)); + name.isAttribute=false; + variable* v =obj->Variables.findObjVar(name, NO_CREATE_TRAIT,DYNAMIC_TRAIT); + if (v) + v->isenumerable = isEnum; + return NULL; +} ASFUNCTIONBODY(ASObject,_constructor) { @@ -1075,9 +1104,9 @@ return ret->toInt(); } -const variable* ASObject::findGettableImpl(const variables_map& map, const multiname& name) +const variable* ASObject::findGettableImpl(const variables_map& map, const multiname& name, NS_KIND &nskind) { - const variable* ret=map.findObjVar(name,DECLARED_TRAIT|DYNAMIC_TRAIT); + const variable* ret=map.findObjVar(name,DECLARED_TRAIT|DYNAMIC_TRAIT,nskind); if(ret) { //It seems valid for a class to redefine only the setter, so if we can't find @@ -1088,20 +1117,20 @@ return ret; } -const variable* ASObject::findGettable(const multiname& name) const +const variable* ASObject::findGettable(const multiname& name, NS_KIND &nskind) const { - return findGettableImpl(Variables,name); + return findGettableImpl(Variables,name,nskind); } -const variable* ASObject::findVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt, Class_base* cls) +const variable* ASObject::findVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt, Class_base* cls, NS_KIND &nskind) { //Get from the current object without considering borrowed properties - const variable* var=findGettable(name); + const variable* var=findGettable(name,nskind); if(!var && cls) { //Look for borrowed traits before - var=cls->findBorrowedGettable(name); + var=cls->findBorrowedGettable(name,nskind); } if(!var && cls) @@ -1110,7 +1139,7 @@ Prototype* proto = cls->prototype.getPtr(); while(proto) { - var = proto->getObj()->findGettable(name); + var = proto->getObj()->findGettable(name,nskind); if(var) break; proto = proto->prevPrototype.getPtr(); @@ -1123,10 +1152,24 @@ { check(); assert(!cls || classdef->isSubClass(cls)); - const variable* obj=findVariableByMultiname(name, opt, cls); + NS_KIND nskind; + const variable* obj=findVariableByMultiname(name, opt, cls,nskind); if(!obj) return NullRef; + if (this->is<Class_base>() && + (!obj->var || + (obj->var->getObjectType() != T_UNDEFINED && + obj->var->getObjectType() != T_NULL && + obj->var->getObjectType() != T_FUNCTION ))) + { + LOG(LOG_CALLS,"accessing class:"<<name<<" "<< this->as<Class_base>()->getQualifiedClassName()<<" "<<nskind); + if (obj->kind == INSTANCE_TRAIT && + nskind != NAMESPACE && + nskind != PACKAGE_INTERNAL_NAMESPACE && + nskind != STATIC_PROTECTED_NAMESPACE) + throwError<TypeError>(kCallOfNonFunctionError,name.normalizedName()); + } if(obj->getter) { @@ -1249,6 +1292,9 @@ case CONSTANT_TRAIT: kind="Declared: "; break; + case INSTANCE_TRAIT: + kind="Declared (instance)"; + break; case DYNAMIC_TRAIT: kind="Dynamic: "; break; @@ -1692,7 +1738,12 @@ for(variables_map::const_var_iterator varIt=beginIt; varIt != endIt; ++varIt) { // check for cylic reference - if (std::find(path.begin(),path.end(), varIt->second.var) != path.end()) + if (varIt->second.var->getObjectType() != T_UNDEFINED && + varIt->second.var->getObjectType() != T_NULL && + varIt->second.var->getObjectType() != T_BOOLEAN && + (varIt->second.var == this || + std::find(path.begin(),path.end(), varIt->second.var) != path.end() || + std::find(path.begin(),path.end(), this) != path.end() )) throwError<TypeError>(kJSONCyclicStructure); if (replacer != NULL) @@ -1733,7 +1784,10 @@ res += varIt->second.var->toJSON(path,replacer,spaces+spaces,filter); bfirst = false; } - path.push_back(varIt->second.var); + if (varIt->second.var->getObjectType() != T_UNDEFINED && + varIt->second.var->getObjectType() != T_NULL && + varIt->second.var->getObjectType() != T_BOOLEAN) + path.push_back(varIt->second.var); } if (!bfirst) res += newline+spaces.substr_bytes(0,spaces.numBytes()/2);
View file
lightspark.tar.xz/src/asobject.h
Changed
@@ -153,7 +153,7 @@ class Type; class ABCContext; -enum TRAIT_KIND { NO_CREATE_TRAIT=0, DECLARED_TRAIT=1, DYNAMIC_TRAIT=2, CONSTANT_TRAIT=9 /* constants are also declared traits */ }; +enum TRAIT_KIND { NO_CREATE_TRAIT=0, DECLARED_TRAIT=1, DYNAMIC_TRAIT=2, INSTANCE_TRAIT=5, CONSTANT_TRAIT=9 /* constants are also declared traits */ }; enum TRAIT_STATE { NO_STATE=0, HAS_GETTER_SETTER=1, TYPE_RESOLVED=2 }; struct variable @@ -169,8 +169,9 @@ IFunction* getter; TRAIT_KIND kind; TRAIT_STATE traitState; + bool isenumerable:1; variable(TRAIT_KIND _k) - : var(NULL),typeUnion(NULL),setter(NULL),getter(NULL),kind(_k),traitState(NO_STATE) {} + : var(NULL),typeUnion(NULL),setter(NULL),getter(NULL),kind(_k),traitState(NO_STATE),isenumerable(true) {} variable(TRAIT_KIND _k, ASObject* _v, multiname* _t, const Type* type); void setVar(ASObject* v); /* @@ -220,9 +221,9 @@ /** * Const version of findObjVar, useful when looking for getters */ - const variable* findObjVar(const multiname& mname, uint32_t traitKinds) const; + const variable* findObjVar(const multiname& mname, uint32_t traitKinds, NS_KIND &nskind) const; //Initialize a new variable specifying the type (TODO: add support for const) - void initializeVar(const multiname& mname, ASObject* obj, multiname* typemname, ABCContext* context, TRAIT_KIND traitKind,ASObject* mainObj); + void initializeVar(const multiname& mname, ASObject* obj, multiname *typemname, ABCContext* context, TRAIT_KIND traitKind, ASObject* mainObj); void killObjVar(const multiname& mname); ASObject* getSlot(unsigned int n) { @@ -274,7 +275,7 @@ private: variables_map Variables; Class_base* classdef; - const variable* findGettable(const multiname& name) const DLL_LOCAL; + const variable* findGettable(const multiname& name, NS_KIND &nskind) const DLL_LOCAL; variable* findSettable(const multiname& name, bool* has_getter=NULL) DLL_LOCAL; multiname* proxyMultiName; protected: @@ -289,7 +290,7 @@ std::map<const Class_base*, uint32_t> traitsMap) const; void setClass(Class_base* c); static variable* findSettableImpl(variables_map& map, const multiname& name, bool* has_getter); - static const variable* findGettableImpl(const variables_map& map, const multiname& name); + static const variable* findGettableImpl(const variables_map& map, const multiname& name, NS_KIND &nskind); public: ASObject(Class_base* c); #ifndef NDEBUG @@ -308,6 +309,7 @@ ASFUNCTION(valueOf); ASFUNCTION(isPrototypeOf); ASFUNCTION(propertyIsEnumerable); + ASFUNCTION(setPropertyIsEnumerable); void check() const; static void s_incRef(ASObject* o) { @@ -342,7 +344,7 @@ * Helper method using the get the raw variable struct instead of calling the getter. * It is used by getVariableByMultiname and by early binding code */ - const variable* findVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt, Class_base* cls); + const variable* findVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt, Class_base* cls, NS_KIND &nskind); /* * Gets a variable of this object. It looks through all classes (beginning at cls), * then the prototype chain, and then instance variables. @@ -377,7 +379,7 @@ * Called by ABCVm::buildTraits to create DECLARED_TRAIT or CONSTANT_TRAIT and set their type */ void initializeVariableByMultiname(const multiname& name, ASObject* o, multiname* typemname, - ABCContext* context, TRAIT_KIND traitKind); + ABCContext* context, TRAIT_KIND traitKind,bool bOverwrite); /* * Called by ABCVm::initProperty (implementation of ABC instruction), it is allowed to set CONSTANT_TRAIT */
View file
lightspark.tar.xz/src/backends/urlutils.cpp
Changed
@@ -74,11 +74,15 @@ if(colonPos == std::string::npos) invalidReason = MISSING_PROTOCOL; - std::string protocolStr = str.substr(0, colonPos); - std::transform(protocolStr.begin(), protocolStr.end(), protocolStr.begin(), ::tolower); + std::string protocolStr; + if (colonPos != std::string::npos) + { + protocolStr = str.substr(0, colonPos); + std::transform(protocolStr.begin(), protocolStr.end(), protocolStr.begin(), ::tolower); + } protocol = protocolStr; - size_t hostnamePos = colonPos+3; + size_t hostnamePos = colonPos != std::string::npos ? colonPos+3 : std::string::npos; size_t portPos = std::string::npos; size_t pathPos = std::string::npos; size_t queryPos = std::string::npos; @@ -117,8 +121,12 @@ } //Parse the host string - std::string hostnameStr = str.substr(hostnamePos, std::min(std::min(pathPos, portPos), queryPos)-hostnamePos); - std::transform(hostnameStr.begin(), hostnameStr.end(), hostnameStr.begin(), ::tolower); + std::string hostnameStr; + if (hostnamePos != std::string::npos) + { + hostnameStr= str.substr(hostnamePos, std::min(std::min(pathPos, portPos), queryPos)-hostnamePos); + std::transform(hostnameStr.begin(), hostnameStr.end(), hostnameStr.begin(), ::tolower); + } hostname = hostnameStr; port = 0;
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -88,6 +88,7 @@ #include "scripting/flash/display/IGraphicsPath.h" #include "scripting/flash/display/IGraphicsStroke.h" #include "scripting/flash/events/flashevents.h" +#include "scripting/flash/filesystem/flashfilesystem.h" #include "scripting/flash/filters/flashfilters.h" #include "scripting/flash/net/flashnet.h" #include "scripting/flash/net/URLRequestHeader.h" @@ -95,6 +96,7 @@ #include "scripting/flash/net/XMLSocket.h" #include "scripting/flash/net/NetStreamPlayOptions.h" #include "scripting/flash/net/NetStreamPlayTransitions.h" +#include "scripting/flash/printing/flashprinting.h" #include "scripting/flash/system/flashsystem.h" #include "scripting/flash/sensors/flashsensors.h" #include "scripting/flash/utils/flashutils.h" @@ -270,7 +272,7 @@ builtin->registerBuiltin("AccessibilityProperties","flash.accessibility",Class<AccessibilityProperties>::getRef()); builtin->registerBuiltin("AccessibilityImplementation","flash.accessibility",Class<AccessibilityImplementation>::getRef()); - builtin->registerBuiltin("Accessibility","flash.accessibility",Class<ASObject>::getStubClass(QName("Accessibility","flash.accessibility"))); + builtin->registerBuiltin("Accessibility","flash.accessibility",Class<Accessibility>::getRef()); builtin->registerBuiltin("Mutex","flash.concurrent",Class<ASMutex>::getRef()); builtin->registerBuiltin("Condition","flash.concurrent",Class<ASCondition>::getRef()); @@ -323,22 +325,14 @@ builtin->registerBuiltin("BitmapFilterQuality","flash.filters",Class<BitmapFilterQuality>::getRef()); builtin->registerBuiltin("DropShadowFilter","flash.filters",Class<DropShadowFilter>::getRef()); builtin->registerBuiltin("GlowFilter","flash.filters",Class<GlowFilter>::getRef()); - builtin->registerBuiltin("GradientGlowFilter","flash.filters", - Class<ASObject>::getStubClass(QName("GradientGlowFilter","flash.filters"), Class<BitmapFilter>::getRef())); - builtin->registerBuiltin("BevelFilter","flash.filters", - Class<ASObject>::getStubClass(QName("BevelFilter","flash.filters"), Class<BitmapFilter>::getRef())); - builtin->registerBuiltin("ColorMatrixFilter","flash.filters", - Class<ASObject>::getStubClass(QName("ColorMatrixFilter","flash.filters"), Class<BitmapFilter>::getRef())); - builtin->registerBuiltin("BlurFilter","flash.filters", - Class<ASObject>::getStubClass(QName("BlurFilter","flash.filters"), Class<BitmapFilter>::getRef())); - builtin->registerBuiltin("ConvolutionFilter","flash.filters", - Class<ASObject>::getStubClass(QName("ConvolutionFilter","flash.filters"), Class<BitmapFilter>::getRef())); - builtin->registerBuiltin("DisplacementMapFilter","flash.filters", - Class<ASObject>::getStubClass(QName("DisplacementMapFilter","flash.filters"), Class<BitmapFilter>::getRef())); - builtin->registerBuiltin("GradientBevelFilter","flash.filters", - Class<ASObject>::getStubClass(QName("GradientBevelFilter","flash.filters"), Class<BitmapFilter>::getRef())); - builtin->registerBuiltin("ShaderFilter","flash.filters", - Class<ASObject>::getStubClass(QName("ShaderFilter","flash.filters"), Class<BitmapFilter>::getRef())); + builtin->registerBuiltin("GradientGlowFilter","flash.filters",Class<GradientGlowFilter>::getRef()); + builtin->registerBuiltin("BevelFilter","flash.filters",Class<BevelFilter>::getRef()); + builtin->registerBuiltin("ColorMatrixFilter","flash.filters",Class<ColorMatrixFilter>::getRef()); + builtin->registerBuiltin("BlurFilter","flash.filters",Class<BlurFilter>::getRef()); + builtin->registerBuiltin("ConvolutionFilter","flash.filters",Class<ConvolutionFilter>::getRef()); + builtin->registerBuiltin("DisplacementMapFilter","flash.filters",Class<DisplacementMapFilter>::getRef()); + builtin->registerBuiltin("GradientBevelFilter","flash.filters",Class<GradientBevelFilter>::getRef()); + builtin->registerBuiltin("ShaderFilter","flash.filters",Class<ShaderFilter>::getRef()); builtin->registerBuiltin("AntiAliasType","flash.text",Class<AntiAliasType>::getRef()); builtin->registerBuiltin("Font","flash.text",Class<ASFont>::getRef()); @@ -384,10 +378,8 @@ builtin->registerBuiltin("Dictionary","flash.utils",Class<Dictionary>::getRef()); builtin->registerBuiltin("Proxy","flash.utils",Class<Proxy>::getRef()); builtin->registerBuiltin("Timer","flash.utils",Class<Timer>::getRef()); - builtin->registerBuiltin("getQualifiedClassName","flash.utils", - _MR(Class<IFunction>::getFunction(getQualifiedClassName))); - builtin->registerBuiltin("getQualifiedSuperclassName","flash.utils", - _MR(Class<IFunction>::getFunction(getQualifiedSuperclassName))); + builtin->registerBuiltin("getQualifiedClassName","flash.utils",_MR(Class<IFunction>::getFunction(getQualifiedClassName))); + builtin->registerBuiltin("getQualifiedSuperclassName","flash.utils",_MR(Class<IFunction>::getFunction(getQualifiedSuperclassName))); builtin->registerBuiltin("getDefinitionByName","flash.utils",_MR(Class<IFunction>::getFunction(getDefinitionByName))); builtin->registerBuiltin("getTimer","flash.utils",_MR(Class<IFunction>::getFunction(getTimer))); builtin->registerBuiltin("setInterval","flash.utils",_MR(Class<IFunction>::getFunction(setInterval))); @@ -407,7 +399,8 @@ builtin->registerBuiltin("Transform","flash.geom",Class<Transform>::getRef()); builtin->registerBuiltin("Point","flash.geom",Class<Point>::getRef()); builtin->registerBuiltin("Vector3D","flash.geom",Class<Vector3D>::getRef()); - builtin->registerBuiltin("Matrix3D","flash.geom",Class<ASObject>::getStubClass(QName("Matrix3D", "flash.geom"))); + builtin->registerBuiltin("Matrix3D","flash.geom",Class<Matrix3D>::getRef()); + builtin->registerBuiltin("PerspectiveProjection","flash.geom",Class<PerspectiveProjection>::getRef()); builtin->registerBuiltin("EventDispatcher","flash.events",Class<EventDispatcher>::getRef()); builtin->registerBuiltin("Event","flash.events",Class<Event>::getRef()); @@ -438,11 +431,14 @@ builtin->registerBuiltin("TransformGestureEvent","flash.events",Class<TransformGestureEvent>::getRef()); builtin->registerBuiltin("ContextMenuEvent","flash.events",Class<ContextMenuEvent>::getRef()); builtin->registerBuiltin("UncaughtErrorEvent","flash.events",Class<UncaughtErrorEvent>::getRef()); + builtin->registerBuiltin("UncaughtErrorEvents","flash.events",Class<UncaughtErrorEvents>::getRef()); + builtin->registerBuiltin("VideoEvent","flash.events",Class<VideoEvent>::getRef()); builtin->registerBuiltin("navigateToURL","flash.net",_MR(Class<IFunction>::getFunction(navigateToURL))); builtin->registerBuiltin("sendToURL","flash.net",_MR(Class<IFunction>::getFunction(sendToURL))); - builtin->registerBuiltin("LocalConnection","flash.net",Class<ASObject>::getStubClass(QName("LocalConnection","flash.net"))); + builtin->registerBuiltin("LocalConnection","flash.net",Class<LocalConnection>::getRef()); builtin->registerBuiltin("NetConnection","flash.net",Class<NetConnection>::getRef()); + builtin->registerBuiltin("NetGroup","flash.net",Class<NetGroup>::getRef()); builtin->registerBuiltin("NetStream","flash.net",Class<NetStream>::getRef()); builtin->registerBuiltin("NetStreamAppendBytesAction","flash.net",Class<NetStreamAppendBytesAction>::getRef()); builtin->registerBuiltin("NetStreamPlayOptions","flash.net",Class<NetStreamPlayOptions>::getRef()); @@ -457,12 +453,15 @@ builtin->registerBuiltin("SharedObject","flash.net",Class<SharedObject>::getRef()); builtin->registerBuiltin("SharedObjectFlushStatus","flash.net",Class<SharedObjectFlushStatus>::getRef()); builtin->registerBuiltin("ObjectEncoding","flash.net",Class<ObjectEncoding>::getRef()); - builtin->registerBuiltin("Socket","flash.net",Class<ASObject>::getStubClass(QName("Socket","flash.net"))); + builtin->registerBuiltin("Socket","flash.net",Class<ASSocket>::getRef()); builtin->registerBuiltin("Responder","flash.net",Class<Responder>::getRef()); builtin->registerBuiltin("XMLSocket","flash.net",Class<XMLSocket>::getRef()); builtin->registerBuiltin("registerClassAlias","flash.net",_MR(Class<IFunction>::getFunction(registerClassAlias))); builtin->registerBuiltin("getClassByAlias","flash.net",_MR(Class<IFunction>::getFunction(getClassByAlias))); + builtin->registerBuiltin("DRMManager","flash.net.drm",Class<DRMManager>::getRef()); + + builtin->registerBuiltin("fscommand","flash.system",_MR(Class<IFunction>::getFunction(fscommand))); builtin->registerBuiltin("Capabilities","flash.system",Class<Capabilities>::getRef()); builtin->registerBuiltin("Security","flash.system",Class<Security>::getRef()); @@ -470,6 +469,7 @@ builtin->registerBuiltin("SecurityDomain","flash.system",Class<SecurityDomain>::getRef()); builtin->registerBuiltin("LoaderContext","flash.system",Class<LoaderContext>::getRef()); builtin->registerBuiltin("System","flash.system",Class<System>::getRef()); + builtin->registerBuiltin("Worker","flash.system",Class<ASWorker>::getRef()); builtin->registerBuiltin("SoundTransform","flash.media",Class<SoundTransform>::getRef()); builtin->registerBuiltin("Video","flash.media",Class<Video>::getRef()); @@ -498,18 +498,14 @@ builtin->registerBuiltin("ScriptTimeoutError","flash.errors",Class<ScriptTimeoutError>::getRef()); builtin->registerBuiltin("StackOverflowError","flash.errors",Class<StackOverflowError>::getRef()); - builtin->registerBuiltin("PrintJob","flash.printing", - Class<ASObject>::getStubClass(QName("PrintJob","flash.printing"), Class<EventDispatcher>::getRef())); - builtin->registerBuiltin("PrintJobOptions","flash.printing",Class<ASObject>::getStubClass(QName("PrintJobOptions","flash.printing"))); - builtin->registerBuiltin("PrintJobOrientation","flash.printing",Class<ASObject>::getStubClass(QName("PrintJobOrientation","flash.printing"))); + builtin->registerBuiltin("PrintJob","flash.printing",Class<PrintJob>::getRef()); + builtin->registerBuiltin("PrintJobOptions","flash.printing",Class<PrintJobOptions>::getRef()); + builtin->registerBuiltin("PrintJobOrientation","flash.printing",Class<PrintJobOrientation>::getRef()); builtin->registerBuiltin("isNaN","",_MR(Class<IFunction>::getFunction(isNaN))); builtin->registerBuiltin("isFinite","",_MR(Class<IFunction>::getFunction(isFinite))); builtin->registerBuiltin("isXMLName","",_MR(Class<IFunction>::getFunction(_isXMLName))); - // TODO stub classes, not yet implemented, but needed in tests - builtin->registerBuiltin("Worker","flash.system",Class<ASObject>::getStubClass(QName("Worker","flash.system"))); - builtin->registerBuiltin("PerspectiveProjection","flash.geom",Class<ASObject>::getStubClass(QName("PerspectiveProjection","flash.geom"))); //If needed add AIR definitions if(getSys()->flashMode==SystemState::AIR) @@ -518,8 +514,7 @@ builtin->registerBuiltin("InvokeEvent","flash.events",Class<InvokeEvent>::getRef()); - builtin->registerBuiltin("FileStream","flash.filesystem", - Class<ASObject>::getStubClass(QName("FileStream","flash.filestream"))); + builtin->registerBuiltin("FileStream","flash.filesystem",Class<FileStream>::getRef()); } Class_object::getRef()->getClass()->prototype = _MNR(new_objectPrototype()); @@ -853,9 +848,8 @@ assert(n && !n2); assert_and_throw(n->classdef==Class<Namespace>::getClass()); Namespace* tmpns=static_cast<Namespace*>(n); - //TODO: What is the right kind? ret->ns.clear(); - ret->ns.push_back(nsNameAndKind(tmpns->uri,NAMESPACE)); + ret->ns.push_back(nsNameAndKind(tmpns->uri,tmpns->nskind)); n->decRef(); break; } @@ -866,7 +860,7 @@ assert_and_throw(n2->classdef==Class<Namespace>::getClass()); Namespace* tmpns=static_cast<Namespace*>(n2); ret->ns.clear(); - ret->ns.push_back(nsNameAndKind(tmpns->uri,NAMESPACE)); + ret->ns.push_back(nsNameAndKind(tmpns->uri,tmpns->nskind)); ret->setName(n); n->decRef(); n2->decRef(); @@ -1552,14 +1546,16 @@ // initialize vars where type was not known during script init // this may happen for variables of private classes defined in this script - for (auto it = uninitializedVars.begin(); it != uninitializedVars.end(); it++) + LOG(LOG_CALLS,"initialize uninitialized vars"); + auto it = uninitializedVars.begin(); + while (it != uninitializedVars.end()) { uninitializedVar v = *it; - LOG(LOG_CALLS,"initialize uninitialized var:"<< v.mainObj->toDebugString()<<" "<< v.mname << " " <<v.typemname); - v.mainObj->initializeVariableByMultiname(v.mname,NULL,&v.typemname,this,v.traitKind); + v.mainObj->initializeVariableByMultiname(*v.mname,NULL,v.typemname,this,v.traitKind,true); v.mainObj->decRef(); + uninitializedVars.pop_front(); + it = uninitializedVars.begin(); } - uninitializedVars.clear(); LOG(LOG_CALLS, "Finished script init for script " << i ); } @@ -1970,8 +1966,13 @@ case 0x06: //Double return abstract_d(constant_pool.doubles[index]); case 0x08: //Namespace + { assert_and_throw(constant_pool.namespaces[index].name); - return Class<Namespace>::getInstanceS(getString(constant_pool.namespaces[index].name)); + Namespace* ret = Class<Namespace>::getInstanceS(getString(constant_pool.namespaces[index].name)); + if (constant_pool.namespaces[index].kind != 0) + ret->nskind =(NS_KIND)(int)(constant_pool.namespaces[index].kind); + return ret; + } case 0x0a: //False return abstract_b(false); case 0x0b: //True @@ -1986,6 +1987,23 @@ } } +void ABCContext::addUninitializedVar(uninitializedVar &v) +{ + auto it = uninitializedVars.begin(); + bool bfound = false; + while (it != uninitializedVars.end()) + { + if (it->mainObj == v.mainObj && it->mname == v.mname) + { + bfound = true; + break; + } + it++; + } + if (!bfound) + uninitializedVars.push_back(v); +} + void ABCContext::buildTrait(ASObject* obj, const traits_info* t, bool isBorrowed, int scriptid) { multiname* mname=getMultiname(t->name,NULL); @@ -2016,10 +2034,10 @@ return; ASObject* ret; + QName className(getSys()->getStringFromUniqueId(mname->name_s_id),mname->ns[0].getImpl().name); //check if this class has the 'interface' flag, i.e. it is an interface if((instances[t->classi].flags)&0x04) { - QName className(getSys()->getStringFromUniqueId(mname->name_s_id),mname->ns[0].getImpl().name); MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(className.name); Class_inherit* ci=new (getSys()->unaccountedMemory) Class_inherit(className, memoryAccount); @@ -2074,7 +2092,13 @@ ret = ci; } else - ret=getSys()->getUndefinedRef(); + { + MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(className.name); + Class_inherit* c=new (getSys()->unaccountedMemory) Class_inherit(className, memoryAccount); + root->applicationDomain->classesBeingDefined.insert(make_pair(mname, c)); + ret=c; + } + obj->setVariableByQName(mname->name_s_id,mname->ns[0],ret,DECLARED_TRAIT); @@ -2150,12 +2174,12 @@ LOG(LOG_CALLS,_("Const ") << *mname <<_(" type ")<< *tname<< " = " << ret->toDebugString()); - obj->initializeVariableByMultiname(*mname, ret, tname, this, CONSTANT_TRAIT); + obj->initializeVariableByMultiname(*mname, ret, tname, this, CONSTANT_TRAIT,false); if(t->slot_id) obj->initSlot(t->slot_id, *mname); - else // slot_id 0 seems to mean appending new slot - obj->appendSlot(*mname); + //else // slot_id 0 seems to mean appending new slot + // obj->appendSlot(*mname); break; } case traits_info::Slot: @@ -2170,20 +2194,20 @@ if(t->vindex) { ret=getConstant(t->vkind,t->vindex); - LOG(LOG_CALLS,_("Slot ") << t->slot_id << ' ' << *mname <<_(" type ")<<*tname<< " = " << ret->toDebugString() ); + LOG(LOG_CALLS,_("Slot ") << t->slot_id << ' ' << *mname <<_(" type ")<<*tname<< " = " << ret->toDebugString() <<" "<<isBorrowed); } else { - LOG(LOG_CALLS,_("Slot ")<< t->slot_id<< _(" vindex 0 ") << *mname <<_(" type ")<<*tname); + LOG(LOG_CALLS,_("Slot ")<< t->slot_id<< _(" vindex 0 ") << *mname <<_(" type ")<<*tname<<" "<<isBorrowed); ret = NULL; } - obj->initializeVariableByMultiname(*mname, ret, tname, this, DECLARED_TRAIT); + obj->initializeVariableByMultiname(*mname, ret, tname, this, isBorrowed ? INSTANCE_TRAIT : DECLARED_TRAIT,false); if(t->slot_id) obj->initSlot(t->slot_id, *mname); - else // slot_id 0 seems to mean appending new slot - obj->appendSlot(*mname); + //else // slot_id 0 seems to mean appending new slot + // obj->appendSlot(*mname); break; }
View file
lightspark.tar.xz/src/scripting/abc.h
Changed
@@ -145,9 +145,9 @@ struct uninitializedVar { uninitializedVar():mname(NULL),mainObj(NULL),typemname(NULL),traitKind(NO_CREATE_TRAIT) {} - multiname mname; + const multiname* mname; ASObject* mainObj; - multiname typemname; + multiname* typemname; TRAIT_KIND traitKind; }; @@ -184,8 +184,8 @@ std::vector<bool> hasRunScriptInit; // list of vars that have to be initialized after script init is done - std::vector<uninitializedVar> uninitializedVars; - + std::list<uninitializedVar> uninitializedVars; + void addUninitializedVar(uninitializedVar& v); /** Construct and insert in the a object a given trait @param obj the tarhget object @@ -207,8 +207,6 @@ bool isinstance(ASObject* obj, multiname* name); - std::map<const multiname*, Class_base*> classesBeingDefined; - #ifdef PROFILING_SUPPORT void dumpProfilingData(std::ostream& f) const; #endif
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -365,14 +365,15 @@ return; } } + obj->decRef(); + for(int i=0;i<m;i++) + args[i]->decRef(); + //LOG(LOG_NOT_IMPLEMENTED,"callProperty: " << name->qualifiedString() << " not found on " << obj->toDebugString()); + throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), obj->getClassName()); - LOG(LOG_NOT_IMPLEMENTED,"callProperty: " << name->qualifiedString() << " not found on " << obj->toDebugString()); if(keepReturn) th->runtime_stack_push(getSys()->getUndefinedRef()); - obj->decRef(); - for(int i=0;i<m;i++) - args[i]->decRef(); } LOG(LOG_CALLS,_("End of calling ") << *name); } @@ -383,8 +384,9 @@ !obj->is<Undefined>() && !obj->is<IFunction>() && !obj->is<Function_object>() && + !obj->is<Class_base>() && obj->getClass() && - (obj->is<Class_inherit>() || (obj->getClass() != Class_object::getClass()))) + (obj->getClass() != Class_object::getClass())) obj->getClass()->setupDeclaredTraits(obj); } @@ -410,7 +412,10 @@ if(prop.isNull()) { - LOG(LOG_NOT_IMPLEMENTED,"getProperty: " << name->normalizedName() << " not found on " << obj->toDebugString()); + if (obj->getClass() && obj->getClass()->isSealed) + throwError<ReferenceError>(kReadSealedError, name->normalizedName(), obj->getClass()->getQualifiedClassName()); + if (Log::getLevel() >= LOG_NOT_IMPLEMENTED && obj->getClassName() != "Object") + LOG(LOG_NOT_IMPLEMENTED,"getProperty: " << name->normalizedName() << " not found on " << obj->toDebugString()); ret = getSys()->getUndefinedRef(); } else @@ -651,7 +656,7 @@ f->decRef(); //ECMA: "return ret2 if it is an object, else ret" - if(ret2 && !ret2->is<Undefined>()) + if(ret2 && !ret2->isPrimitive()) { ret->decRef(); ret = ret2; @@ -1338,6 +1343,7 @@ if(!it->considerDynamic) opt=(ASObject::GET_VARIABLE_OPTION)(opt | ASObject::SKIP_IMPL); + checkDeclaredTraits(it->object.getPtr()); _NR<ASObject> prop=it->object->getVariableByMultiname(*name, opt); if(!prop.isNull()) { @@ -1511,12 +1517,16 @@ LOG(LOG_CALLS,(keepReturn ? "callSuper " : "callSuperVoid ") << *name << ' ' << m); ASObject* obj=th->runtime_stack_pop(); + if(obj->is<Null>()) + throwError<TypeError>(kConvertNullToObjectError); + if (obj->is<Undefined>()) + throwError<TypeError>(kConvertUndefinedToObjectError); assert_and_throw(th->inClass); assert_and_throw(th->inClass->super); assert_and_throw(obj->getClass()); assert_and_throw(obj->getClass()->isSubClass(th->inClass)); - _NR<ASObject> f = obj->getVariableByMultiname(*name,ASObject::NONE,th->inClass->super.getPtr()); + _NR<ASObject> f = obj->getVariableByMultiname(*name, ASObject::SKIP_IMPL,th->inClass->super.getPtr()); name->resetNameIfObject(); if(!f.isNull()) { @@ -1525,7 +1535,11 @@ } else { - LOG(LOG_ERROR,_("Calling an undefined function ") << getSys()->getStringFromUniqueId(name->name_s_id)); + obj->decRef(); + for(int i=0;i<m;i++) + args[i]->decRef(); + //LOG(LOG_ERROR,_("Calling an undefined function ") << getSys()->getStringFromUniqueId(name->name_s_id)); + throwError<ReferenceError>(kCallNotFoundError, name->qualifiedString(), obj->getClassName()); if(keepReturn) th->runtime_stack_push(getSys()->getUndefinedRef()); } @@ -1752,6 +1766,7 @@ ASObject* obj=th->runtime_stack_pop(); + checkDeclaredTraits(obj); _NR<ASObject> o=obj->getVariableByMultiname(*name); if(o.isNull()) @@ -2015,28 +2030,46 @@ assert_and_throw(mname->ns.size()==1); QName className(getSys()->getStringFromUniqueId(mname->name_s_id),mname->ns[0].getImpl().name); - //Check if this class has been already defined - _NR<ApplicationDomain> domain = getCurrentApplicationDomain(th); - ASObject* target; - ASObject* oldDefinition=domain->getVariableAndTargetByMultiname(*mname, target); - if(oldDefinition && oldDefinition->getObjectType()==T_CLASS) - { - LOG(LOG_CALLS,_("Class ") << className << _(" already defined. Pushing previous definition")); - baseClass->decRef(); - oldDefinition->incRef(); - th->runtime_stack_push(oldDefinition); - // ensure that this interface is linked to all previously defined classes implementing this interface - if (th->context->instances[n].isInterface()) - ABCVm::SetAllClassLinks(); - return; - } - MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(className.name); - Class_inherit* ret=new (getSys()->unaccountedMemory) Class_inherit(className, memoryAccount); + Class_inherit* ret = NULL; + auto i = th->context->root->applicationDomain->classesBeingDefined.cbegin(); + while (i != th->context->root->applicationDomain->classesBeingDefined.cend()) + { + if(i->first->qualifiedString() == mname->qualifiedString()) + { + ret = (Class_inherit*)i->second; + ret->incRef(); + break; + } + i++; + } - //Add the class to the ones being currently defined in this context - th->context->classesBeingDefined.insert(make_pair(mname, ret)); + if (ret == NULL) + { + //Check if this class has been already defined + _NR<ApplicationDomain> domain = getCurrentApplicationDomain(th); + ASObject* target; + ASObject* oldDefinition=domain->getVariableAndTargetByMultiname(*mname, target); + if(oldDefinition && oldDefinition->getObjectType()==T_CLASS) + { + LOG(LOG_CALLS,_("Class ") << className << _(" already defined. Pushing previous definition")); + baseClass->decRef(); + oldDefinition->incRef(); + th->runtime_stack_push(oldDefinition); + // ensure that this interface is linked to all previously defined classes implementing this interface + if (th->context->instances[n].isInterface()) + ABCVm::SetAllClassLinks(); + return; + } + + MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(className.name); + ret=new (getSys()->unaccountedMemory) Class_inherit(className, memoryAccount); + LOG(LOG_CALLS,"add classes defined:"<<*mname<<" "<<th->context); + //Add the class to the ones being currently defined in this context + th->context->root->applicationDomain->classesBeingDefined.insert(make_pair(mname, ret)); + } + ret->isFinal = th->context->instances[n].isFinal(); ret->isSealed = th->context->instances[n].isSealed(); @@ -2044,8 +2077,7 @@ ret->context=th->context; //Null is a "valid" base class - // Undefined is used in private Classes that will be defined later - if(baseClass->getObjectType()!=T_NULL && baseClass->getObjectType()!=T_UNDEFINED) + if(baseClass->getObjectType()!=T_NULL) { assert_and_throw(baseClass->is<Class_base>()); Class_base* base = baseClass->as<Class_base>(); @@ -2076,7 +2108,7 @@ for(unsigned int i=0;i<cur->trait_count;i++) { int kind=cur->traits[i].kind&0xf; - if(kind==traits_info::Method || kind==traits_info::Setter || kind==traits_info::Getter || kind==traits_info::Slot) + if(kind==traits_info::Method || kind==traits_info::Setter || kind==traits_info::Getter) th->context->buildTrait(ret,&cur->traits[i],true); } @@ -2108,7 +2140,11 @@ if(ret->super) ret->prototype->prevPrototype=ret->super->prototype; ret->addPrototypeGetter(); - ret->constructorprop = _NR<ObjectConstructor>(new_objectConstructor(ret)); + if (constructor->body) + ret->constructorprop = _NR<ObjectConstructor>(new_objectConstructor(ret,ret->constructor->length)); + else + ret->constructorprop = _NR<ObjectConstructor>(new_objectConstructor(ret,0)); + ret->constructorprop->incRef(); ret->addConstructorGetter(); @@ -2161,7 +2197,7 @@ cinit->decRef(); //Remove the class to the ones being currently defined in this context - th->context->classesBeingDefined.erase(mname); + th->context->root->applicationDomain->classesBeingDefined.erase(mname); throw; } assert_and_throw(ret2->is<Undefined>()); @@ -2171,7 +2207,7 @@ cinit->decRef(); //Remove the class to the ones being currently defined in this context - th->context->classesBeingDefined.erase(mname); + th->context->root->applicationDomain->classesBeingDefined.erase(mname); } void ABCVm::swap()
View file
lightspark.tar.xz/src/scripting/abc_optimizer.cpp
Changed
@@ -179,7 +179,8 @@ return CANNOT_BIND; } - const variable* var=it->object->findVariableByMultiname(*name, ASObject::XML_STRICT, it->object->getClass()); + NS_KIND nskind; + const variable* var=it->object->findVariableByMultiname(*name, ASObject::XML_STRICT, it->object->getClass(),nskind); if(var) { found=true; @@ -964,7 +965,8 @@ const Class_base* objType=dynamic_cast<const Class_base*>(baseData.type); if(objType) { - const variable* var=objType->findBorrowedGettable(*name); + NS_KIND nskind; + const variable* var=objType->findBorrowedGettable(*name,nskind); if(var && var->var && var->var->getObjectType()==T_FUNCTION) { SyntheticFunction* calledFunc=dynamic_cast<SyntheticFunction*>(var->var);
View file
lightspark.tar.xz/src/scripting/argconv.h
Changed
@@ -215,15 +215,17 @@ return abstract_ui(val.toUInt()); } -#define ARG_UNPACK ArgUnpack(args,argslen) +#define ARG_UNPACK ArgUnpack(args,argslen,false) +#define ARG_UNPACK_MORE_ALLOWED ArgUnpack(args,argslen,true) class ArgUnpack { private: ASObject* const * args; int argslen; + bool moreAllowed; public: - ArgUnpack(ASObject* const * _args, int _argslen) : args(_args), argslen(_argslen) {} + ArgUnpack(ASObject* const * _args, int _argslen, bool _moreAllowed) : args(_args), argslen(_argslen), moreAllowed(_moreAllowed) {} template<class T> ArgUnpack& operator()(T& v) { @@ -251,7 +253,7 @@ } ~ArgUnpack() { - if(argslen > 0) + if(argslen > 0 && !moreAllowed) LOG(LOG_NOT_IMPLEMENTED,"Not all arguments were unpacked"); } };
View file
lightspark.tar.xz/src/scripting/class.cpp
Changed
@@ -48,9 +48,9 @@ return new (c->memoryAccount) Function_object(c, p); } -ObjectConstructor* lightspark::new_objectConstructor(Class_base* cls) +ObjectConstructor* lightspark::new_objectConstructor(Class_base* cls,uint32_t length) { - return new (cls->memoryAccount) ObjectConstructor(cls); + return new (cls->memoryAccount) ObjectConstructor(cls, length); } @@ -178,18 +178,6 @@ handleConstruction(ret,args,argslen,true); return ret; } -_R<Class<ASObject>> Class<ASObject>::getStubClass(const QName& name, _R<Class_base> superClass) -{ - MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(name.name); - Class<ASObject>* ret = new (getSys()->unaccountedMemory) Class<ASObject>(name, memoryAccount); - - ret->setSuper(superClass); - ret->prototype = _MNR(new_objectPrototype()); - ret->initStandardProps(); - getSys()->customClasses.insert(ret); - ret->incRef(); - return _MR(ret); -} Class<ASObject>* Class<ASObject>::getClass() { uint32_t classId=ClassName<ASObject>::id;
View file
lightspark.tar.xz/src/scripting/class.h
Changed
@@ -72,7 +72,7 @@ Prototype* new_objectPrototype(); Prototype* new_functionPrototype(Class_base* functionClass, _NR<Prototype> p); Function_object* new_functionObject(_NR<ASObject> p); -ObjectConstructor* new_objectConstructor(Class_base* cls); +ObjectConstructor* new_objectConstructor(Class_base* cls,uint32_t length); template<class T,std::size_t N> struct newWithOptionalClass @@ -236,10 +236,6 @@ Class<ASObject>* c=Class<ASObject>::getClass(); return c->getInstance(true,NULL,0); } - /* This creates a stub class, i.e. a class with given name but without - * any implementation. - */ - static _R<Class<ASObject>> getStubClass(const QName& name, _R<Class_base> superClass=Class<ASObject>::getRef()); static Class<ASObject>* getClass(); static _R<Class<ASObject>> getRef() {
View file
lightspark.tar.xz/src/scripting/flash/accessibility/flashaccessibility.cpp
Changed
@@ -61,3 +61,19 @@ LOG(LOG_NOT_IMPLEMENTED, _("AccessibilityImplementation class is unimplemented.")); return NULL; } + + +void Accessibility::sinit(Class_base* c) +{ + CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_FINAL); + c->setVariableByQName("active","",abstract_b(false),CONSTANT_TRAIT); +} + +ASFUNCTIONBODY(Accessibility,updateProperties) +{ + Accessibility* th=obj->as<Accessibility>(); + LOG(LOG_NOT_IMPLEMENTED, "Accessibility is not supported."); + ARG_UNPACK (th->properties); + + return NULL; +}
View file
lightspark.tar.xz/src/scripting/flash/accessibility/flashaccessibility.h
Changed
@@ -48,5 +48,15 @@ ASFUNCTION(_constructor); }; +class Accessibility : public ASObject +{ +private: + _NR<AccessibilityProperties> properties; +public: + Accessibility(Class_base* c):ASObject(c),properties(NULL){} + static void sinit(Class_base*); + ASFUNCTION(updateProperties); +}; + } #endif /* SCRIPTING_FLASH_ACCESSIBILITY_FLASHACCESSIBILITY_H */
View file
lightspark.tar.xz/src/scripting/flash/desktop/flashdesktop.cpp
Changed
@@ -38,6 +38,7 @@ ASFUNCTIONBODY(NativeApplication,_constructor) { + EventDispatcher::_constructor(obj, NULL, 0); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/display/BitmapData.cpp
Changed
@@ -25,6 +25,7 @@ #include "scripting/toplevel/Vector.h" #include "scripting/flash/errors/flasherrors.h" #include "scripting/flash/utils/ByteArray.h" +#include "scripting/flash/filters/flashfilters.h" #include "backends/rendering_context.h" using namespace lightspark; @@ -82,6 +83,7 @@ c->setDeclaredMethodByQName("setVector","",Class<IFunction>::getFunction(setVector),NORMAL_METHOD,true); c->setDeclaredMethodByQName("colorTransform","",Class<IFunction>::getFunction(colorTransform),NORMAL_METHOD,true); c->setDeclaredMethodByQName("compare","",Class<IFunction>::getFunction(compare),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("applyFilter","",Class<IFunction>::getFunction(applyFilter),NORMAL_METHOD,true); // properties c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_getHeight),GETTER_METHOD,true); @@ -836,3 +838,16 @@ return abstract_d(0); return res; } + +ASFUNCTIONBODY(BitmapData,applyFilter) +{ + BitmapData* th = obj->as<BitmapData>(); + + _NR<BitmapData> sourceBitmapData; + _NR<Rectangle> sourceRect; + _NR<Point> destPoint; + _NR<BitmapFilter> filter; + ARG_UNPACK (sourceBitmapData)(sourceRect)(destPoint)(filter); + LOG(LOG_NOT_IMPLEMENTED,"BitmapData.applyFilter not implemented"); + return NULL; +}
View file
lightspark.tar.xz/src/scripting/flash/display/BitmapData.h
Changed
@@ -83,6 +83,7 @@ ASFUNCTION(setVector); ASFUNCTION(colorTransform); ASFUNCTION(compare); + ASFUNCTION(applyFilter); }; };
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.cpp
Changed
@@ -54,14 +54,14 @@ LoaderInfo::LoaderInfo(Class_base* c):EventDispatcher(c),applicationDomain(NullRef),securityDomain(NullRef), contentType("application/x-shockwave-flash"), bytesLoaded(0),bytesTotal(0),sharedEvents(NullRef), - loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true) + loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true),uncaughtErrorEvents(NullRef) { } LoaderInfo::LoaderInfo(Class_base* c, _R<Loader> l):EventDispatcher(c),applicationDomain(NullRef),securityDomain(NullRef), contentType("application/x-shockwave-flash"), bytesLoaded(0),bytesTotal(0),sharedEvents(NullRef), - loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true) + loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true),uncaughtErrorEvents(NullRef) { } @@ -84,6 +84,7 @@ REGISTER_GETTER(c,swfVersion); REGISTER_GETTER(c,childAllowsParent); REGISTER_GETTER(c,contentType); + REGISTER_GETTER(c,uncaughtErrorEvents); } ASFUNCTIONBODY_GETTER(LoaderInfo,parameters); @@ -91,6 +92,7 @@ ASFUNCTIONBODY_GETTER(LoaderInfo,childAllowsParent); ASFUNCTIONBODY_GETTER(LoaderInfo,contentType); ASFUNCTIONBODY_GETTER(LoaderInfo,swfVersion); +ASFUNCTIONBODY_GETTER(LoaderInfo,uncaughtErrorEvents); void LoaderInfo::buildTraits(ASObject* o) { @@ -193,6 +195,7 @@ EventDispatcher::_constructor(obj,NULL,0); th->sharedEvents=_MR(Class<EventDispatcher>::getInstanceS()); th->parameters = _MR(Class<ASObject>::getInstanceS()); + th->uncaughtErrorEvents = _MR(Class<UncaughtErrorEvents>::getInstanceS()); return NULL; } @@ -328,6 +331,7 @@ { LOG(LOG_ERROR, "Loader::execute(): Download of URL failed: " << url); getVm()->addEvent(loaderInfo,_MR(Class<IOErrorEvent>::getInstanceS())); + getVm()->addEvent(loader,_MR(Class<IOErrorEvent>::getInstanceS())); delete sbuf; // downloader will be deleted in jobFence return; @@ -376,6 +380,7 @@ Loader* th=static_cast<Loader*>(obj); DisplayObjectContainer::_constructor(obj,NULL,0); th->contentLoaderInfo->setLoaderURL(getSys()->mainClip->getOrigin().getParsedURL()); + th->uncaughtErrorEvents = _MR(Class<UncaughtErrorEvents>::getInstanceS()); return NULL; } @@ -539,6 +544,22 @@ th->unload(); return NULL; } +ASFUNCTIONBODY(Loader,_unloadAndStop) +{ + Loader* th=static_cast<Loader*>(obj); + th->unload(); + LOG(LOG_NOT_IMPLEMENTED,"unloadAndStop does not execute any stopping actions"); + /* TODO: (taken from specs) + Sounds are stopped. + Stage event listeners are removed. + Event listeners for enterFrame, frameConstructed, exitFrame, activate and deactivate are removed. + Timers are stopped. + Camera and Microphone instances are detached + Movie clips are stopped. + */ + + return NULL; +} void Loader::unload() { @@ -573,7 +594,7 @@ contentLoaderInfo.reset(); } -Loader::Loader(Class_base* c):DisplayObjectContainer(c),content(NullRef),contentLoaderInfo(NullRef),loaded(false), allowCodeImport(true) +Loader::Loader(Class_base* c):DisplayObjectContainer(c),content(NullRef),contentLoaderInfo(NullRef),loaded(false), allowCodeImport(true),uncaughtErrorEvents(NullRef) { incRef(); contentLoaderInfo=_MR(Class<LoaderInfo>::getInstanceS(_MR(this))); @@ -592,8 +613,12 @@ c->setDeclaredMethodByQName("loadBytes","",Class<IFunction>::getFunction(loadBytes),NORMAL_METHOD,true); c->setDeclaredMethodByQName("load","",Class<IFunction>::getFunction(load),NORMAL_METHOD,true); c->setDeclaredMethodByQName("unload","",Class<IFunction>::getFunction(_unload),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("unloadAndStop","",Class<IFunction>::getFunction(_unloadAndStop),NORMAL_METHOD,true); + REGISTER_GETTER(c,uncaughtErrorEvents); } +ASFUNCTIONBODY_GETTER(Loader,uncaughtErrorEvents); + void Loader::threadFinished(IThreadJob* finishedJob) { SpinlockLocker l(spinlock); @@ -1729,12 +1754,11 @@ DisplayObjectContainer* th=static_cast<DisplayObjectContainer*>(obj); assert_and_throw(argslen==1); if(args[0]->getObjectType() == T_CLASS) - { return abstract_b(false); - } - //Validate object type - assert_and_throw(args[0] && args[0]->getClass() && - args[0]->getClass()->isSubClass(Class<DisplayObject>::getClass())); + if (!args[0]->getClass()) + return abstract_b(false); + if (!args[0]->getClass()->isSubClass(Class<DisplayObject>::getClass())) + return abstract_b(false); //Cast to object DisplayObject* d=static_cast<DisplayObject*>(args[0]); @@ -2304,7 +2328,7 @@ Stage* th=obj->as<Stage>(); _NR<RootMovieClip> root = th->getRoot(); if (root.isNull()) - return abstract_d(0.); + return abstract_d(getSys()->mainClip->getFrameRate()); else return abstract_d(root->getFrameRate()); } @@ -2353,40 +2377,40 @@ void StageScaleMode::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("EXACT_FIT","",Class<ASString>::getInstanceS("exactFit"),DECLARED_TRAIT); - c->setVariableByQName("NO_BORDER","",Class<ASString>::getInstanceS("noBorder"),DECLARED_TRAIT); - c->setVariableByQName("NO_SCALE","",Class<ASString>::getInstanceS("noScale"),DECLARED_TRAIT); - c->setVariableByQName("SHOW_ALL","",Class<ASString>::getInstanceS("showAll"),DECLARED_TRAIT); + c->setVariableByQName("EXACT_FIT","",Class<ASString>::getInstanceS("exactFit"),CONSTANT_TRAIT); + c->setVariableByQName("NO_BORDER","",Class<ASString>::getInstanceS("noBorder"),CONSTANT_TRAIT); + c->setVariableByQName("NO_SCALE","",Class<ASString>::getInstanceS("noScale"),CONSTANT_TRAIT); + c->setVariableByQName("SHOW_ALL","",Class<ASString>::getInstanceS("showAll"),CONSTANT_TRAIT); } void StageAlign::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("BOTTOM","",Class<ASString>::getInstanceS("B"),DECLARED_TRAIT); - c->setVariableByQName("BOTTOM_LEFT","",Class<ASString>::getInstanceS("BL"),DECLARED_TRAIT); - c->setVariableByQName("BOTTOM_RIGHT","",Class<ASString>::getInstanceS("BR"),DECLARED_TRAIT); - c->setVariableByQName("LEFT","",Class<ASString>::getInstanceS("L"),DECLARED_TRAIT); - c->setVariableByQName("RIGHT","",Class<ASString>::getInstanceS("R"),DECLARED_TRAIT); - c->setVariableByQName("TOP","",Class<ASString>::getInstanceS("T"),DECLARED_TRAIT); - c->setVariableByQName("TOP_LEFT","",Class<ASString>::getInstanceS("TL"),DECLARED_TRAIT); - c->setVariableByQName("TOP_RIGHT","",Class<ASString>::getInstanceS("TR"),DECLARED_TRAIT); + c->setVariableByQName("BOTTOM","",Class<ASString>::getInstanceS("B"),CONSTANT_TRAIT); + c->setVariableByQName("BOTTOM_LEFT","",Class<ASString>::getInstanceS("BL"),CONSTANT_TRAIT); + c->setVariableByQName("BOTTOM_RIGHT","",Class<ASString>::getInstanceS("BR"),CONSTANT_TRAIT); + c->setVariableByQName("LEFT","",Class<ASString>::getInstanceS("L"),CONSTANT_TRAIT); + c->setVariableByQName("RIGHT","",Class<ASString>::getInstanceS("R"),CONSTANT_TRAIT); + c->setVariableByQName("TOP","",Class<ASString>::getInstanceS("T"),CONSTANT_TRAIT); + c->setVariableByQName("TOP_LEFT","",Class<ASString>::getInstanceS("TL"),CONSTANT_TRAIT); + c->setVariableByQName("TOP_RIGHT","",Class<ASString>::getInstanceS("TR"),CONSTANT_TRAIT); } void StageQuality::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("BEST","",Class<ASString>::getInstanceS("best"),DECLARED_TRAIT); - c->setVariableByQName("HIGH","",Class<ASString>::getInstanceS("high"),DECLARED_TRAIT); - c->setVariableByQName("LOW","",Class<ASString>::getInstanceS("low"),DECLARED_TRAIT); - c->setVariableByQName("MEDIUM","",Class<ASString>::getInstanceS("medium"),DECLARED_TRAIT); + c->setVariableByQName("BEST","",Class<ASString>::getInstanceS("best"),CONSTANT_TRAIT); + c->setVariableByQName("HIGH","",Class<ASString>::getInstanceS("high"),CONSTANT_TRAIT); + c->setVariableByQName("LOW","",Class<ASString>::getInstanceS("low"),CONSTANT_TRAIT); + c->setVariableByQName("MEDIUM","",Class<ASString>::getInstanceS("medium"),CONSTANT_TRAIT); } void StageDisplayState::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("FULL_SCREEN","",Class<ASString>::getInstanceS("fullScreen"),DECLARED_TRAIT); - c->setVariableByQName("FULL_SCREEN_INTERACTIVE","",Class<ASString>::getInstanceS("fullScreenInteractive"),DECLARED_TRAIT); - c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),DECLARED_TRAIT); + c->setVariableByQName("FULL_SCREEN","",Class<ASString>::getInstanceS("fullScreen"),CONSTANT_TRAIT); + c->setVariableByQName("FULL_SCREEN_INTERACTIVE","",Class<ASString>::getInstanceS("fullScreenInteractive"),CONSTANT_TRAIT); + c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),CONSTANT_TRAIT); } Bitmap::Bitmap(Class_base* c, _NR<LoaderInfo> li, std::istream *s, FILE_TYPE type): @@ -2795,61 +2819,61 @@ void GradientType::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("LINEAR","",Class<ASString>::getInstanceS("linear"),DECLARED_TRAIT); - c->setVariableByQName("RADIAL","",Class<ASString>::getInstanceS("radial"),DECLARED_TRAIT); + c->setVariableByQName("LINEAR","",Class<ASString>::getInstanceS("linear"),CONSTANT_TRAIT); + c->setVariableByQName("RADIAL","",Class<ASString>::getInstanceS("radial"),CONSTANT_TRAIT); } void BlendMode::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("ADD","",Class<ASString>::getInstanceS("add"),DECLARED_TRAIT); - c->setVariableByQName("ALPHA","",Class<ASString>::getInstanceS("alpha"),DECLARED_TRAIT); - c->setVariableByQName("DARKEN","",Class<ASString>::getInstanceS("darken"),DECLARED_TRAIT); - c->setVariableByQName("DIFFERENCE","",Class<ASString>::getInstanceS("difference"),DECLARED_TRAIT); - c->setVariableByQName("ERASE","",Class<ASString>::getInstanceS("erase"),DECLARED_TRAIT); - c->setVariableByQName("HARDLIGHT","",Class<ASString>::getInstanceS("hardlight"),DECLARED_TRAIT); - c->setVariableByQName("INVERT","",Class<ASString>::getInstanceS("invert"),DECLARED_TRAIT); - c->setVariableByQName("LAYER","",Class<ASString>::getInstanceS("layer"),DECLARED_TRAIT); - c->setVariableByQName("LIGHTEN","",Class<ASString>::getInstanceS("lighten"),DECLARED_TRAIT); - c->setVariableByQName("MULTIPLY","",Class<ASString>::getInstanceS("multiply"),DECLARED_TRAIT); - c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),DECLARED_TRAIT); - c->setVariableByQName("OVERLAY","",Class<ASString>::getInstanceS("overlay"),DECLARED_TRAIT); - c->setVariableByQName("SCREEN","",Class<ASString>::getInstanceS("screen"),DECLARED_TRAIT); - c->setVariableByQName("SUBTRACT","",Class<ASString>::getInstanceS("subtract"),DECLARED_TRAIT); + c->setVariableByQName("ADD","",Class<ASString>::getInstanceS("add"),CONSTANT_TRAIT); + c->setVariableByQName("ALPHA","",Class<ASString>::getInstanceS("alpha"),CONSTANT_TRAIT); + c->setVariableByQName("DARKEN","",Class<ASString>::getInstanceS("darken"),CONSTANT_TRAIT); + c->setVariableByQName("DIFFERENCE","",Class<ASString>::getInstanceS("difference"),CONSTANT_TRAIT); + c->setVariableByQName("ERASE","",Class<ASString>::getInstanceS("erase"),CONSTANT_TRAIT); + c->setVariableByQName("HARDLIGHT","",Class<ASString>::getInstanceS("hardlight"),CONSTANT_TRAIT); + c->setVariableByQName("INVERT","",Class<ASString>::getInstanceS("invert"),CONSTANT_TRAIT); + c->setVariableByQName("LAYER","",Class<ASString>::getInstanceS("layer"),CONSTANT_TRAIT); + c->setVariableByQName("LIGHTEN","",Class<ASString>::getInstanceS("lighten"),CONSTANT_TRAIT); + c->setVariableByQName("MULTIPLY","",Class<ASString>::getInstanceS("multiply"),CONSTANT_TRAIT); + c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),CONSTANT_TRAIT); + c->setVariableByQName("OVERLAY","",Class<ASString>::getInstanceS("overlay"),CONSTANT_TRAIT); + c->setVariableByQName("SCREEN","",Class<ASString>::getInstanceS("screen"),CONSTANT_TRAIT); + c->setVariableByQName("SUBTRACT","",Class<ASString>::getInstanceS("subtract"),CONSTANT_TRAIT); } void SpreadMethod::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("PAD","",Class<ASString>::getInstanceS("pad"),DECLARED_TRAIT); - c->setVariableByQName("REFLECT","",Class<ASString>::getInstanceS("reflect"),DECLARED_TRAIT); - c->setVariableByQName("REPEAT","",Class<ASString>::getInstanceS("repeat"),DECLARED_TRAIT); + c->setVariableByQName("PAD","",Class<ASString>::getInstanceS("pad"),CONSTANT_TRAIT); + c->setVariableByQName("REFLECT","",Class<ASString>::getInstanceS("reflect"),CONSTANT_TRAIT); + c->setVariableByQName("REPEAT","",Class<ASString>::getInstanceS("repeat"),CONSTANT_TRAIT); } void InterpolationMethod::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("RGB","",Class<ASString>::getInstanceS("rgb"),DECLARED_TRAIT); - c->setVariableByQName("LINEAR_RGB","",Class<ASString>::getInstanceS("linearRGB"),DECLARED_TRAIT); + c->setVariableByQName("RGB","",Class<ASString>::getInstanceS("rgb"),CONSTANT_TRAIT); + c->setVariableByQName("LINEAR_RGB","",Class<ASString>::getInstanceS("linearRGB"),CONSTANT_TRAIT); } void GraphicsPathCommand::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("CUBIC_CURVE_TO","",abstract_i(6),DECLARED_TRAIT); - c->setVariableByQName("CURVE_TO","",abstract_i(3),DECLARED_TRAIT); - c->setVariableByQName("LINE_TO","",abstract_i(2),DECLARED_TRAIT); - c->setVariableByQName("MOVE_TO","",abstract_i(1),DECLARED_TRAIT); - c->setVariableByQName("NO_OP","",abstract_i(0),DECLARED_TRAIT); - c->setVariableByQName("WIDE_LINE_TO","",abstract_i(5),DECLARED_TRAIT); - c->setVariableByQName("WIDE_MOVE_TO","",abstract_i(4),DECLARED_TRAIT); + c->setVariableByQName("CUBIC_CURVE_TO","",abstract_i(6),CONSTANT_TRAIT); + c->setVariableByQName("CURVE_TO","",abstract_i(3),CONSTANT_TRAIT); + c->setVariableByQName("LINE_TO","",abstract_i(2),CONSTANT_TRAIT); + c->setVariableByQName("MOVE_TO","",abstract_i(1),CONSTANT_TRAIT); + c->setVariableByQName("NO_OP","",abstract_i(0),CONSTANT_TRAIT); + c->setVariableByQName("WIDE_LINE_TO","",abstract_i(5),CONSTANT_TRAIT); + c->setVariableByQName("WIDE_MOVE_TO","",abstract_i(4),CONSTANT_TRAIT); } void GraphicsPathWinding::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("EVEN_ODD","",Class<ASString>::getInstanceS("evenOdd"),DECLARED_TRAIT); - c->setVariableByQName("NON_ZERO","",Class<ASString>::getInstanceS("nonZero"),DECLARED_TRAIT); + c->setVariableByQName("EVEN_ODD","",Class<ASString>::getInstanceS("evenOdd"),CONSTANT_TRAIT); + c->setVariableByQName("NON_ZERO","",Class<ASString>::getInstanceS("nonZero"),CONSTANT_TRAIT); } /* Go through the hierarchy and add all @@ -3024,10 +3048,10 @@ void BitmapDataChannel::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("ALPHA","",abstract_ui(8),DECLARED_TRAIT); - c->setVariableByQName("BLUE","",abstract_ui(4),DECLARED_TRAIT); - c->setVariableByQName("GREEN","",abstract_ui(2),DECLARED_TRAIT); - c->setVariableByQName("RED","",abstract_ui(1),DECLARED_TRAIT); + c->setVariableByQName("ALPHA","",abstract_ui(8),CONSTANT_TRAIT); + c->setVariableByQName("BLUE","",abstract_ui(4),CONSTANT_TRAIT); + c->setVariableByQName("GREEN","",abstract_ui(2),CONSTANT_TRAIT); + c->setVariableByQName("RED","",abstract_ui(1),CONSTANT_TRAIT); } unsigned int BitmapDataChannel::channelShift(uint32_t channelConstant) @@ -3056,8 +3080,8 @@ void LineScaleMode::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("HORIZONTAL","",Class<ASString>::getInstanceS("horizontal"),DECLARED_TRAIT); - c->setVariableByQName("NONE","",Class<ASString>::getInstanceS("none"),DECLARED_TRAIT); - c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),DECLARED_TRAIT); - c->setVariableByQName("VERTICAL","",Class<ASString>::getInstanceS("vertical"),DECLARED_TRAIT); + c->setVariableByQName("HORIZONTAL","",Class<ASString>::getInstanceS("horizontal"),CONSTANT_TRAIT); + c->setVariableByQName("NONE","",Class<ASString>::getInstanceS("none"),CONSTANT_TRAIT); + c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),CONSTANT_TRAIT); + c->setVariableByQName("VERTICAL","",Class<ASString>::getInstanceS("vertical"),CONSTANT_TRAIT); }
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.h
Changed
@@ -249,6 +249,7 @@ ASPROPERTY_GETTER(uint32_t,actionScriptVersion); ASPROPERTY_GETTER(uint32_t,swfVersion); ASPROPERTY_GETTER(bool, childAllowsParent); + ASPROPERTY_GETTER(_NR<UncaughtErrorEvents>,uncaughtErrorEvents); LoaderInfo(Class_base* c); LoaderInfo(Class_base* c, _R<Loader> l); void finalize(); @@ -321,8 +322,10 @@ ASFUNCTION(load); ASFUNCTION(loadBytes); ASFUNCTION(_unload); + ASFUNCTION(_unloadAndStop); ASFUNCTION(_getContentLoaderInfo); ASFUNCTION(_getContent); + ASPROPERTY_GETTER(_NR<UncaughtErrorEvents>,uncaughtErrorEvents); int getDepth() const { return 0;
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.cpp
Changed
@@ -291,6 +291,7 @@ c->setVariableByQName("RIGHT_CLICK","",Class<ASString>::getInstanceS("rightClick"),DECLARED_TRAIT); c->setVariableByQName("ROLL_OVER","",Class<ASString>::getInstanceS("rollOver"),DECLARED_TRAIT); c->setVariableByQName("ROLL_OUT","",Class<ASString>::getInstanceS("rollOut"),DECLARED_TRAIT); + c->setDeclaredMethodByQName("updateAfterEvent","",Class<IFunction>::getFunction(updateAfterEvent),NORMAL_METHOD,true); REGISTER_GETTER(c,relatedObject); REGISTER_GETTER(c,stageX); @@ -443,6 +444,11 @@ th->modifiers |= GDK_SHIFT_MASK; return NULL; } +ASFUNCTIONBODY(MouseEvent,updateAfterEvent) +{ + LOG(LOG_NOT_IMPLEMENTED,"MouseEvent::updateAfterEvent not implemented"); + return NULL; +} void MouseEvent::buildTraits(ASObject* o) { @@ -556,7 +562,6 @@ list<listener>::iterator insertionPoint=upper_bound(listeners.begin(),listeners.end(),newListener); listeners.insert(insertionPoint,newListener); } - return NULL; } @@ -623,7 +628,6 @@ args[0]->incRef(); _R<Event> e=_MR(Class<Event>::cast(args[0])); - assert_and_throw(e->type!=""); // Must call the AS getter, because the getter may have been // overridden @@ -1192,15 +1196,59 @@ return NULL; } +VideoEvent::VideoEvent(Class_base* c) + : Event(c, "renderState"),status("unavailable") +{ +} + +void VideoEvent::sinit(Class_base* c) +{ + CLASS_SETUP(c, Event, _constructor, CLASS_SEALED); + c->setVariableByQName("RENDER_STATE","",Class<ASString>::getInstanceS("renderState"),CONSTANT_TRAIT); + c->setVariableByQName("RENDER_STATUS_ACCELERATED","",Class<ASString>::getInstanceS("accelerated"),CONSTANT_TRAIT); + c->setVariableByQName("RENDER_STATUS_SOFTWARE","",Class<ASString>::getInstanceS("software"),CONSTANT_TRAIT); + c->setVariableByQName("RENDER_STATUS_UNAVAILABLE","",Class<ASString>::getInstanceS("unavailable"),CONSTANT_TRAIT); + REGISTER_GETTER(c,status); +} + +ASFUNCTIONBODY(VideoEvent,_constructor) +{ + uint32_t baseClassArgs=imin(argslen,3); + Event::_constructor(obj,args,baseClassArgs); + + VideoEvent* th=static_cast<VideoEvent*>(obj); + if(argslen>=4) + { + th->status=args[3]->toString(); + } + + return NULL; +} + +Event* VideoEvent::cloneImpl() const +{ + VideoEvent *clone; + clone = Class<VideoEvent>::getInstanceS(); + clone->status = status; + // Event + clone->type = type; + clone->bubbles = bubbles; + clone->cancelable = cancelable; + return clone; +} + +ASFUNCTIONBODY_GETTER(VideoEvent,status); + + StageVideoEvent::StageVideoEvent(Class_base* c) - : Event(c, "renderState") + : Event(c, "renderState"),status("unavailable") { } void StageVideoEvent::sinit(Class_base* c) { CLASS_SETUP(c, Event, _constructor, CLASS_SEALED); - c->setVariableByQName("RENDER_STATE","",Class<ASString>::getInstanceS("renderState"),DECLARED_TRAIT); + c->setVariableByQName("RENDER_STATE","",Class<ASString>::getInstanceS("renderState"),CONSTANT_TRAIT); REGISTER_GETTER(c,colorSpace); REGISTER_GETTER(c,status); } @@ -1320,3 +1368,21 @@ c->setVariableByQName("GESTURE_SWIPE","",Class<ASString>::getInstanceS("gestureSwipe"),DECLARED_TRAIT); c->setVariableByQName("GESTURE_ZOOM","",Class<ASString>::getInstanceS("gestureZoom"),DECLARED_TRAIT); } + +UncaughtErrorEvents::UncaughtErrorEvents(Class_base* c): + EventDispatcher(c) +{ +} + +void UncaughtErrorEvents::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); +} + +ASFUNCTIONBODY(UncaughtErrorEvents, _constructor) +{ + EventDispatcher::_constructor(obj, NULL, 0); + UncaughtErrorEvents* th=Class<UncaughtErrorEvents>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"UncaughtErrorEvents is not implemented"); + return NULL; +}
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.h
Changed
@@ -284,7 +284,8 @@ ASFUNCTION_GETTER_SETTER(shiftKey); ASPROPERTY_GETTER(number_t,stageX); ASPROPERTY_GETTER(number_t,stageY); - ASPROPERTY_GETTER(_NR<InteractiveObject>,relatedObject); + ASPROPERTY_GETTER(_NR<InteractiveObject>,relatedObject); + ASFUNCTION(updateAfterEvent); }; class InvokeEvent: public Event @@ -505,6 +506,17 @@ ASFUNCTION(_constructor); }; +class VideoEvent: public Event +{ +private: + Event* cloneImpl() const; +public: + VideoEvent(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); + ASPROPERTY_GETTER(tiny_string,status); +}; + class StageVideoEvent: public Event { private: @@ -567,6 +579,13 @@ static void buildTraits(ASObject* o) {} }; +class UncaughtErrorEvents: public EventDispatcher +{ +public: + UncaughtErrorEvents(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); +}; } #endif /* SCRIPTING_FLASH_EVENTS_FLASHEVENTS_H */
View file
lightspark.tar.xz/src/scripting/flash/external/ExternalInterface.cpp
Changed
@@ -73,7 +73,8 @@ ASFUNCTIONBODY(ExternalInterface,addCallback) { if(getSys()->extScriptObject == NULL) - throw Class<ASError>::getInstanceS("Container doesn't support callbacks"); + return abstract_b(false); +// throw Class<ASError>::getInstanceS("Container doesn't support callbacks"); assert_and_throw(argslen == 2); @@ -90,7 +91,8 @@ ASFUNCTIONBODY(ExternalInterface,call) { if(getSys()->extScriptObject == NULL) - throw Class<ASError>::getInstanceS("Container doesn't support callbacks"); + return getSys()->getNullRef(); +// throw Class<ASError>::getInstanceS("Container doesn't support callbacks"); assert_and_throw(argslen >= 1); const tiny_string& arg0=args[0]->toString();
View file
lightspark.tar.xz/src/scripting/flash/filesystem
Added
+(directory)
View file
lightspark.tar.xz/src/scripting/flash/filesystem/flashfilesystem.cpp
Added
@@ -0,0 +1,42 @@ +/************************************************************************** + Lightspark, a free flash player implementation + + Copyright (C) 2009-2013 Alessandro Pignotti (a.pignotti@sssup.it) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +**************************************************************************/ + +#include "scripting/flash/filesystem/flashfilesystem.h" +#include "scripting/abc.h" +#include "scripting/argconv.h" +#include "compat.h" + +using namespace lightspark; + +FileStream::FileStream(Class_base* c): + EventDispatcher(c) +{ +} + +void FileStream::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); +} +ASFUNCTIONBODY(FileStream, _constructor) +{ + EventDispatcher::_constructor(obj, NULL, 0); + FileStream* th=Class<FileStream>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"FileStream is not implemented"); + return NULL; +}
View file
lightspark.tar.xz/src/scripting/flash/filesystem/flashfilesystem.h
Added
@@ -0,0 +1,41 @@ +/************************************************************************** + Lightspark, a free flash player implementation + + Copyright (C) 2009-2013 Alessandro Pignotti (a.pignotti@sssup.it) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +**************************************************************************/ + +#ifndef SCRIPTING_FLASH_FILESYSTEM_FLASHFILESYSTEM_H +#define SCRIPTING_FLASH_PRINTING_FLASHFILESYSTEM_H 1 + +#include "compat.h" +#include "asobject.h" +#include "scripting/flash/events/flashevents.h" + +namespace lightspark +{ + +class FileStream: public EventDispatcher +{ +public: + FileStream(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); + ASPROPERTY_GETTER(bool,isSupported); +}; + + +} +#endif /* SCRIPTING_FLASH_FILESYSTEM_FLASHFILESYSTEM_H */
View file
lightspark.tar.xz/src/scripting/flash/filters/flashfilters.cpp
Changed
@@ -166,6 +166,196 @@ return cloned; } +GradientGlowFilter::GradientGlowFilter(Class_base* c): + BitmapFilter(c) +{ +} + +void GradientGlowFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); +} + +ASFUNCTIONBODY(GradientGlowFilter, _constructor) +{ + GradientGlowFilter *th = obj->as<GradientGlowFilter>(); + LOG(LOG_NOT_IMPLEMENTED,"GradientGlowFilter is not implemented"); + return NULL; +} + +BitmapFilter* GradientGlowFilter::cloneImpl() const +{ + GradientGlowFilter *cloned = Class<GradientGlowFilter>::getInstanceS(); + return cloned; +} + +BevelFilter::BevelFilter(Class_base* c): + BitmapFilter(c) +{ +} + +void BevelFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); +} + +ASFUNCTIONBODY(BevelFilter, _constructor) +{ + BevelFilter *th = obj->as<BevelFilter>(); + LOG(LOG_NOT_IMPLEMENTED,"GradientGlowFilter is not implemented"); + return NULL; +} + +BitmapFilter* BevelFilter::cloneImpl() const +{ + BevelFilter *cloned = Class<BevelFilter>::getInstanceS(); + return cloned; +} +ColorMatrixFilter::ColorMatrixFilter(Class_base* c): + BitmapFilter(c),matrix(NULL) +{ +} + +void ColorMatrixFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); + REGISTER_GETTER_SETTER(c, matrix); +} + +ASFUNCTIONBODY_GETTER_SETTER(ColorMatrixFilter, matrix); + +ASFUNCTIONBODY(ColorMatrixFilter, _constructor) +{ + ColorMatrixFilter *th = obj->as<ColorMatrixFilter>(); + ARG_UNPACK(th->matrix,NullRef); + return NULL; +} + +BitmapFilter* ColorMatrixFilter::cloneImpl() const +{ + ColorMatrixFilter *cloned = Class<ColorMatrixFilter>::getInstanceS(); + if (!matrix.isNull()) + { + matrix->incRef(); + cloned->matrix = matrix; + } + return cloned; +} +BlurFilter::BlurFilter(Class_base* c): + BitmapFilter(c) +{ +} + +void BlurFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); +} + +ASFUNCTIONBODY(BlurFilter, _constructor) +{ + BlurFilter *th = obj->as<BlurFilter>(); + LOG(LOG_NOT_IMPLEMENTED,"BlurFilter is not implemented"); + return NULL; +} + +BitmapFilter* BlurFilter::cloneImpl() const +{ + BlurFilter *cloned = Class<BlurFilter>::getInstanceS(); + return cloned; +} + +ConvolutionFilter::ConvolutionFilter(Class_base* c): + BitmapFilter(c) +{ +} + +void ConvolutionFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); +} + +ASFUNCTIONBODY(ConvolutionFilter, _constructor) +{ + ConvolutionFilter *th = obj->as<ConvolutionFilter>(); + LOG(LOG_NOT_IMPLEMENTED,"ConvolutionFilter is not implemented"); + return NULL; +} + +BitmapFilter* ConvolutionFilter::cloneImpl() const +{ + ConvolutionFilter *cloned = Class<ConvolutionFilter>::getInstanceS(); + return cloned; +} + +DisplacementMapFilter::DisplacementMapFilter(Class_base* c): + BitmapFilter(c) +{ +} + +void DisplacementMapFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); +} + +ASFUNCTIONBODY(DisplacementMapFilter, _constructor) +{ + DisplacementMapFilter *th = obj->as<DisplacementMapFilter>(); + LOG(LOG_NOT_IMPLEMENTED,"DisplacementMapFilter is not implemented"); + return NULL; +} + +BitmapFilter* DisplacementMapFilter::cloneImpl() const +{ + DisplacementMapFilter *cloned = Class<DisplacementMapFilter>::getInstanceS(); + return cloned; +} + +GradientBevelFilter::GradientBevelFilter(Class_base* c): + BitmapFilter(c) +{ +} + +void GradientBevelFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); +} + +ASFUNCTIONBODY(GradientBevelFilter, _constructor) +{ + GradientBevelFilter *th = obj->as<GradientBevelFilter>(); + LOG(LOG_NOT_IMPLEMENTED,"GradientBevelFilter is not implemented"); + return NULL; +} + +BitmapFilter* GradientBevelFilter::cloneImpl() const +{ + GradientBevelFilter *cloned = Class<GradientBevelFilter>::getInstanceS(); + return cloned; +} + +ShaderFilter::ShaderFilter(Class_base* c): + BitmapFilter(c) +{ +} + +void ShaderFilter::sinit(Class_base* c) +{ + CLASS_SETUP(c, BitmapFilter, _constructor, CLASS_SEALED | CLASS_FINAL); +} + +ASFUNCTIONBODY(ShaderFilter, _constructor) +{ + ShaderFilter *th = obj->as<ShaderFilter>(); + LOG(LOG_NOT_IMPLEMENTED,"ShaderFilter is not implemented"); + return NULL; +} + +BitmapFilter* ShaderFilter::cloneImpl() const +{ + ShaderFilter *cloned = Class<ShaderFilter>::getInstanceS(); + return cloned; +} + void BitmapFilterQuality::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_SEALED | CLASS_FINAL);
View file
lightspark.tar.xz/src/scripting/flash/filters/flashfilters.h
Changed
@@ -78,6 +78,81 @@ ASFUNCTION(_constructor); }; +class GradientGlowFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + GradientGlowFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; + +class BevelFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + BevelFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; +class ColorMatrixFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + ColorMatrixFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); + ASPROPERTY_GETTER_SETTER(_NR<Array>, matrix); +}; +class BlurFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + BlurFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; +class ConvolutionFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + ConvolutionFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; +class DisplacementMapFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + DisplacementMapFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; +class GradientBevelFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + GradientBevelFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; +class ShaderFilter: public BitmapFilter +{ +private: + virtual BitmapFilter* cloneImpl() const; +public: + ShaderFilter(Class_base* c); + static void sinit(Class_base* c); + ASFUNCTION(_constructor); +}; + class BitmapFilterQuality: public ASObject { public:
View file
lightspark.tar.xz/src/scripting/flash/geom/flashgeom.cpp
Changed
@@ -935,6 +935,7 @@ c->setDeclaredMethodByQName("matrix","",Class<IFunction>::getFunction(_setMatrix),SETTER_METHOD,true); c->setDeclaredMethodByQName("matrix","",Class<IFunction>::getFunction(_getMatrix),GETTER_METHOD,true); c->setDeclaredMethodByQName("matrix","",Class<IFunction>::getFunction(_setMatrix),SETTER_METHOD,true); + c->setDeclaredMethodByQName("concatenatedMatrix","",Class<IFunction>::getFunction(_getConcatenatedMatrix),GETTER_METHOD,true); } ASFUNCTIONBODY(Transform,_constructor) @@ -984,6 +985,13 @@ return NULL; } +ASFUNCTIONBODY(Transform,_getConcatenatedMatrix) +{ + Transform* th=Class<Transform>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"contcatenatedMAtrix not implemented"); + return Class<Matrix>::getInstanceS(); +} + void Transform::buildTraits(ASObject* o) { } @@ -1704,3 +1712,28 @@ return ret; } + + +void Matrix3D::sinit(Class_base* c) +{ + CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); +} + +ASFUNCTIONBODY(Matrix3D,_constructor) +{ + Matrix3D * th=static_cast<Matrix3D*>(obj); + LOG(LOG_NOT_IMPLEMENTED,"Matrix3D is not implemented"); + return NULL; +} + +void PerspectiveProjection::sinit(Class_base* c) +{ + CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); +} + +ASFUNCTIONBODY(PerspectiveProjection,_constructor) +{ + PerspectiveProjection * th=static_cast<PerspectiveProjection*>(obj); + LOG(LOG_NOT_IMPLEMENTED,"PerspectiveProjection is not implemented"); + return NULL; +}
View file
lightspark.tar.xz/src/scripting/flash/geom/flashgeom.h
Changed
@@ -201,6 +201,8 @@ ASFUNCTION(_setColorTransform); ASFUNCTION(_getMatrix); ASFUNCTION(_setMatrix); + ASFUNCTION(_getConcatenatedMatrix); + }; class Vector3D: public ASObject @@ -245,5 +247,22 @@ ASFUNCTION(_toString); }; +class Matrix3D: public ASObject +{ +public: + Matrix3D(Class_base* c):ASObject(c){} + static void sinit(Class_base* c); + + ASFUNCTION(_constructor); }; +class PerspectiveProjection: public ASObject +{ +public: + PerspectiveProjection(Class_base* c):ASObject(c){} + static void sinit(Class_base* c); + + ASFUNCTION(_constructor); +}; + +} #endif /* SCRIPTING_FLASH_FLASHGEOM_H */
View file
lightspark.tar.xz/src/scripting/flash/net/NetStreamPlayOptions.cpp
Changed
@@ -46,6 +46,7 @@ ASFUNCTIONBODY(NetStreamPlayOptions,_constructor) { + EventDispatcher::_constructor(obj, NULL, 0); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.cpp
Changed
@@ -647,6 +647,7 @@ c->setDeclaredMethodByQName("proxyType","",Class<IFunction>::getFunction(_getProxyType),GETTER_METHOD,true); c->setDeclaredMethodByQName("proxyType","",Class<IFunction>::getFunction(_setProxyType),SETTER_METHOD,true); c->setDeclaredMethodByQName("uri","",Class<IFunction>::getFunction(_getURI),GETTER_METHOD,true); + c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(close),GETTER_METHOD,true); REGISTER_GETTER_SETTER(c,client); } @@ -663,6 +664,7 @@ ASFUNCTIONBODY(NetConnection, _constructor) { + EventDispatcher::_constructor(obj, NULL, 0); NetConnection* th=Class<NetConnection>::cast(obj); th->objectEncoding = getSys()->staticNetConnectionDefaultObjectEncoding; return NULL; @@ -802,7 +804,9 @@ //bool isRPC = false; //Null argument means local file or web server, the spec only mentions NULL, but youtube uses UNDEFINED, so supporting that too. - if(args[0]->getObjectType()==T_NULL || args[0]->getObjectType()==T_UNDEFINED) + if(args[0]->getObjectType()==T_NULL || + args[0]->getObjectType()==T_UNDEFINED || + !args[0]->isConstructed()) { th->_connected = false; isNull = true; @@ -979,8 +983,28 @@ } } +ASFUNCTIONBODY(NetConnection,close) +{ + NetConnection* th=Class<NetConnection>::cast(obj); + if(th->_connected) + { + th->threadAbort(); + th->_connected = false; + } + return NULL; +} + ASFUNCTIONBODY_GETTER_SETTER(NetConnection, client); +void NetStreamAppendBytesAction::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL); + c->setVariableByQName("END_SEQUENCE","",Class<ASString>::getInstanceS("endSequence"),CONSTANT_TRAIT); + c->setVariableByQName("RESET_BEGIN","",Class<ASString>::getInstanceS("resetBegin"),CONSTANT_TRAIT); + c->setVariableByQName("RESET_SEEK","",Class<ASString>::getInstanceS("resetSeek"),CONSTANT_TRAIT); +} + + NetStream::NetStream(Class_base* c):EventDispatcher(c),tickStarted(false),paused(false),closed(true), streamTime(0),frameRate(0),connection(),downloader(NULL),videoDecoder(NULL), audioDecoder(NULL),audioStream(NULL), @@ -991,14 +1015,6 @@ soundTransform = _MNR(Class<SoundTransform>::getInstanceS()); } -void NetStreamAppendBytesAction::sinit(Class_base* c) -{ - CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL); - c->setVariableByQName("END_SEQUENCE","",Class<ASString>::getInstanceS("endSequence"),DECLARED_TRAIT); - c->setVariableByQName("RESET_BEGIN","",Class<ASString>::getInstanceS("resetBegin"),DECLARED_TRAIT); - c->setVariableByQName("RESET_SEEK","",Class<ASString>::getInstanceS("resetSeek"),DECLARED_TRAIT); -} - void NetStream::finalize() { EventDispatcher::finalize(); @@ -1099,6 +1115,7 @@ ASFUNCTIONBODY(NetStream,_constructor) { + EventDispatcher::_constructor(obj, NULL, 0); NetStream* th=obj->as<NetStream>(); LOG(LOG_CALLS,_("NetStream constructor")); @@ -1458,6 +1475,7 @@ } catch(JobTerminationException& e) { + LOG(LOG_ERROR, "JobTerminationException in NetStream "); waitForFlush=false; } catch(exception& e) @@ -1965,6 +1983,90 @@ return NULL; } +LocalConnection::LocalConnection(Class_base* c): + EventDispatcher(c),isSupported(false) +{ +} + +void LocalConnection::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); + c->setDeclaredMethodByQName("allowDomain","",Class<IFunction>::getFunction(allowDomain),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("allowInsecureDomain","",Class<IFunction>::getFunction(allowInsecureDomain),NORMAL_METHOD,true); + REGISTER_GETTER(c,isSupported); +} +ASFUNCTIONBODY_GETTER(LocalConnection, isSupported); + +ASFUNCTIONBODY(LocalConnection, _constructor) +{ + EventDispatcher::_constructor(obj, NULL, 0); + LocalConnection* th=Class<LocalConnection>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"LocalConnection is not implemented"); + return NULL; +} +ASFUNCTIONBODY(LocalConnection, allowDomain) +{ + LocalConnection* th=Class<LocalConnection>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"LocalConnection::allowDomain is not implemented"); + return NULL; +} +ASFUNCTIONBODY(LocalConnection, allowInsecureDomain) +{ + EventDispatcher::_constructor(obj, NULL, 0); + LocalConnection* th=Class<LocalConnection>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"LocalConnection::allowInsecureDomain is not implemented"); + return NULL; +} + +NetGroup::NetGroup(Class_base* c): + EventDispatcher(c) +{ +} + +void NetGroup::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); +} + +ASFUNCTIONBODY(NetGroup, _constructor) +{ + EventDispatcher::_constructor(obj, NULL, 0); + NetGroup* th=Class<NetGroup>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"NetGroup is not implemented"); + return NULL; +} + + +ASSocket::ASSocket(Class_base* c): + EventDispatcher(c) +{ +} + +void ASSocket::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); +} + +ASFUNCTIONBODY(ASSocket, _constructor) +{ + EventDispatcher::_constructor(obj, NULL, 0); + ASSocket* th=Class<ASSocket>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"ASSocket is not implemented"); + return NULL; +} + +DRMManager::DRMManager(Class_base* c): + EventDispatcher(c),isSupported(false) +{ +} + +void DRMManager::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructorNotInstantiatable, CLASS_SEALED); + REGISTER_GETTER(c,isSupported); +} +ASFUNCTIONBODY_GETTER(DRMManager, isSupported); + ASFUNCTIONBODY(lightspark,registerClassAlias) { assert_and_throw(argslen==2 && args[0]->getObjectType()==T_STRING && args[1]->getObjectType()==T_CLASS);
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.h
Changed
@@ -213,6 +213,7 @@ ASFUNCTION(_getProxyType); ASFUNCTION(_setProxyType); ASFUNCTION(_getURI); + ASFUNCTION(close); ASPROPERTY_GETTER_SETTER(NullableRef<ASObject>,client); }; @@ -361,11 +362,46 @@ void unlock(); }; +class LocalConnection: public EventDispatcher +{ +public: + LocalConnection(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); + ASPROPERTY_GETTER(bool,isSupported); + ASFUNCTION(allowDomain); + ASFUNCTION(allowInsecureDomain); +}; + +class NetGroup: public EventDispatcher +{ +public: + NetGroup(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); +}; + +class ASSocket: public EventDispatcher, IDataInput, IDataOutput +{ +public: + ASSocket(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); +}; + +class DRMManager: public EventDispatcher +{ +public: + DRMManager(Class_base* c); + static void sinit(Class_base*); + ASPROPERTY_GETTER(bool,isSupported); +}; + ASObject* navigateToURL(ASObject* obj,ASObject* const* args, const unsigned int argslen); ASObject* sendToURL(ASObject* obj,ASObject* const* args, const unsigned int argslen); ASObject* registerClassAlias(ASObject* obj,ASObject* const* args, const unsigned int argslen); ASObject* getClassByAlias(ASObject* obj,ASObject* const* args, const unsigned int argslen); -}; +} #endif /* SCRIPTING_FLASH_NET_FLASHNET_H */
View file
lightspark.tar.xz/src/scripting/flash/printing
Added
+(directory)
View file
lightspark.tar.xz/src/scripting/flash/printing/flashprinting.cpp
Added
@@ -0,0 +1,69 @@ +/************************************************************************** + Lightspark, a free flash player implementation + + Copyright (C) 2009-2013 Alessandro Pignotti (a.pignotti@sssup.it) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +**************************************************************************/ + +#include "scripting/flash/printing/flashprinting.h" +#include "scripting/abc.h" +#include "scripting/argconv.h" +#include "compat.h" + +using namespace lightspark; + +PrintJob::PrintJob(Class_base* c): + EventDispatcher(c),isSupported(false) +{ +} + +void PrintJob::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); + REGISTER_GETTER(c,isSupported); +} +ASFUNCTIONBODY_GETTER(PrintJob, isSupported); + +ASFUNCTIONBODY(PrintJob, _constructor) +{ + EventDispatcher::_constructor(obj, NULL, 0); + PrintJob* th=Class<PrintJob>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"PrintJob is not implemented"); + return NULL; +} + +PrintJobOptions::PrintJobOptions(Class_base* c): + ASObject(c) +{ +} + +void PrintJobOptions::sinit(Class_base* c) +{ + CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); +} + +ASFUNCTIONBODY(PrintJobOptions, _constructor) +{ + PrintJobOptions* th=Class<PrintJobOptions>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"PrintJobOptions is not implemented"); + return NULL; +} + +void PrintJobOrientation::sinit(Class_base* c) +{ + CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED| CLASS_FINAL); + c->setVariableByQName("LANDSCAPE","",Class<ASString>::getInstanceS("landscape"),CONSTANT_TRAIT); + c->setVariableByQName("PORTRAIT","",Class<ASString>::getInstanceS("portrait"),CONSTANT_TRAIT); +}
View file
lightspark.tar.xz/src/scripting/flash/printing/flashprinting.h
Added
@@ -0,0 +1,56 @@ +/************************************************************************** + Lightspark, a free flash player implementation + + Copyright (C) 2009-2013 Alessandro Pignotti (a.pignotti@sssup.it) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +**************************************************************************/ + +#ifndef SCRIPTING_FLASH_PRINTING_FLASHPRINTING_H +#define SCRIPTING_FLASH_PRINTING_FLASHPRINTING_H 1 + +#include "compat.h" +#include "asobject.h" +#include "scripting/flash/events/flashevents.h" + +namespace lightspark +{ + +class PrintJob: public EventDispatcher +{ +public: + PrintJob(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); + ASPROPERTY_GETTER(bool,isSupported); +}; + +class PrintJobOptions: public ASObject +{ +public: + PrintJobOptions(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_constructor); +}; + +class PrintJobOrientation: public ASObject +{ +public: + PrintJobOrientation(Class_base* c) : ASObject(c) {} + static void sinit(Class_base*); +}; + + +} +#endif /* SCRIPTING_FLASH_PRINTING_FLASHPRINTING_H */
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.cpp
Changed
@@ -571,3 +571,22 @@ LOG(LOG_NOT_IMPLEMENTED, "System.totalMemory not implemented"); return abstract_d(1024); } + +ASWorker::ASWorker(Class_base* c): + EventDispatcher(c) +{ + LOG(LOG_NOT_IMPLEMENTED, "Worker not implemented"); +} + +void ASWorker::sinit(Class_base* c) +{ + CLASS_SETUP(c, EventDispatcher, _constructorNotInstantiatable, CLASS_SEALED | CLASS_FINAL); + c->setDeclaredMethodByQName("current","",Class<IFunction>::getFunction(_getCurrent),GETTER_METHOD,false); +} +ASFUNCTIONBODY(ASWorker,_getCurrent) +{ + LOG(LOG_NOT_IMPLEMENTED, "Worker not implemented"); + return getSys()->getUndefinedRef(); +} + +
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.h
Changed
@@ -24,6 +24,7 @@ #include "asobject.h" #include "scripting/flash/utils/ByteArray.h" #include "scripting/toplevel/toplevel.h" +#include "scripting/flash/events/flashevents.h" namespace lightspark { @@ -59,6 +60,8 @@ public: ApplicationDomain(Class_base* c, _NR<ApplicationDomain> p=NullRef); void finalize(); + std::map<const multiname*, Class_base*> classesBeingDefined; + static void sinit(Class_base* c); static void buildTraits(ASObject* o); void registerGlobalScope(Global* scope); @@ -151,6 +154,13 @@ static void sinit(Class_base* c); ASFUNCTION(totalMemory); }; - +class ASWorker: public EventDispatcher +{ +public: + ASWorker(Class_base* c); + static void sinit(Class_base*); + ASFUNCTION(_getCurrent); }; + +} #endif /* SCRIPTING_FLASH_SYSTEM_FLASHSYSTEM_H */
View file
lightspark.tar.xz/src/scripting/flash/text/flashtextengine.cpp
Changed
@@ -325,6 +325,7 @@ } if (!previousLine.isNull()) previousLine->nextLine == textLine; + textLine->incRef(); return textLine.getPtr(); }
View file
lightspark.tar.xz/src/scripting/flash/ui/ContextMenu.cpp
Changed
@@ -40,6 +40,7 @@ ASFUNCTIONBODY(ContextMenu,_constructor) { + EventDispatcher::_constructor(obj, NULL, 0); LOG(LOG_NOT_IMPLEMENTED,"ContextMenu constructor is a stub"); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/ui/ContextMenuItem.cpp
Changed
@@ -30,6 +30,7 @@ ASFUNCTIONBODY(ContextMenuItem,_constructor) { + EventDispatcher::_constructor(obj, NULL, 0); LOG(LOG_NOT_IMPLEMENTED,"ContextMenuItem constructor is a stub"); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/utils/Proxy.cpp
Changed
@@ -89,7 +89,8 @@ //It seems that various kind of implementation works only with the empty namespace assert_and_throw(name.ns.size()>0); _NR<ASObject> o; - if(!name.ns[0].hasEmptyName() || ASObject::hasPropertyByMultiname(name, true, true) || !implEnable || (opt & ASObject::SKIP_IMPL)!=0) + LOG(LOG_CALLS,"Proxy::getVar "<< name << " " << this->toDebugString()); + if(ASObject::hasPropertyByMultiname(name, true, true) || !implEnable || (opt & ASObject::SKIP_IMPL)!=0) o = ASObject::getVariableByMultiname(name,opt); if (!o.isNull() || !implEnable || (opt & ASObject::SKIP_IMPL)!=0) return o;
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.cpp
Changed
@@ -92,6 +92,7 @@ c->setDeclaredMethodByQName("toLocaleUpperCase",AS3,Class<IFunction>::getFunction(toUpperCase),NORMAL_METHOD,true); c->setDeclaredMethodByQName("toLowerCase",AS3,Class<IFunction>::getFunction(toLowerCase),NORMAL_METHOD,true); c->setDeclaredMethodByQName("toUpperCase",AS3,Class<IFunction>::getFunction(toUpperCase),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("localeCompare",AS3,Class<IFunction>::getFunction(localeCompare),NORMAL_METHOD,true); // According to specs fromCharCode belongs to AS3 namespace, // but also empty namespace is seen in the wild and should be // supported. @@ -119,6 +120,7 @@ c->prototype->setVariableByQName("toUpperCase","",Class<IFunction>::getFunction(toUpperCase),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("localeCompare","",Class<IFunction>::getFunction(localeCompare_prototype),DYNAMIC_TRAIT); } void ASString::buildTraits(ASObject* o) @@ -692,6 +694,27 @@ tiny_string data = obj->toString(); return Class<ASString>::getInstanceS(data.uppercase()); } +ASFUNCTIONBODY(ASString,localeCompare) +{ + tiny_string data = obj->toString(); + tiny_string other; + ARG_UNPACK_MORE_ALLOWED(other); + if (argslen > 1) + LOG(LOG_NOT_IMPLEMENTED,"localeCompare with more than one parameter not implemented"); + int ret = data.compare(other); + return abstract_i(ret); +} +ASFUNCTIONBODY(ASString,localeCompare_prototype) +{ + tiny_string data = obj->toString(); + tiny_string other; + ARG_UNPACK_MORE_ALLOWED(other); + if (argslen > 1) + throwError<ArgumentError>(kWrongArgumentCountError, "localeCompare", "1",Integer::toString(argslen)); + + int ret = data.compare(other); + return abstract_i(ret); +} ASFUNCTIONBODY(ASString,fromCharCode) {
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.h
Changed
@@ -63,6 +63,8 @@ ASFUNCTION(toUpperCase); ASFUNCTION(_toString); ASFUNCTION(_getLength); + ASFUNCTION(localeCompare); + ASFUNCTION(localeCompare_prototype); bool isEqual(ASObject* r); TRISTATE isLess(ASObject* r); number_t toNumber() const;
View file
lightspark.tar.xz/src/scripting/toplevel/Array.cpp
Changed
@@ -191,16 +191,20 @@ std::map<uint32_t, data_slot>::iterator it=th->data.begin(); for(;it != th->data.end();++it) { - assert_and_throw(it->second.type==DATA_OBJECT); - params[0] = it->second.data; - it->second.data->incRef(); + if (it->second.type==DATA_OBJECT) + { + params[0] = it->second.data; + it->second.data->incRef(); + } + else + params[0] =abstract_d(it->second.data_i); params[1] = abstract_i(it->first); params[2] = th; th->incRef(); // ensure that return values are the original values - ASObject *origval = it->second.data; - it->second.data->incRef(); + ASObject *origval = params[0]; + origval->incRef(); if(argslen==1) { funcRet=f->call(getSys()->getNullRef(), params, 3); @@ -236,9 +240,13 @@ std::map<uint32_t, data_slot>::iterator it=th->data.begin(); for(;it != th->data.end();++it) { - assert_and_throw(it->second.type==DATA_OBJECT); - params[0] = it->second.data; - it->second.data->incRef(); + if (it->second.type==DATA_OBJECT) + { + params[0] = it->second.data; + it->second.data->incRef(); + } + else + params[0] =abstract_d(it->second.data_i); params[1] = abstract_i(it->first); params[2] = th; th->incRef(); @@ -278,9 +286,13 @@ std::map<uint32_t, data_slot>::iterator it=th->data.begin(); for(;it != th->data.end();++it) { - assert_and_throw(it->second.type==DATA_OBJECT); - params[0] = it->second.data; - it->second.data->incRef(); + if (it->second.type==DATA_OBJECT) + { + params[0] = it->second.data; + it->second.data->incRef(); + } + else + params[0] =abstract_d(it->second.data_i); params[1] = abstract_i(it->first); params[2] = th; th->incRef(); @@ -336,9 +348,13 @@ std::map<uint32_t, data_slot>::iterator it=th->data.begin(); for(;it != th->data.end();++it) { - assert_and_throw(it->second.type==DATA_OBJECT); - params[0] = it->second.data; - it->second.data->incRef(); + if (it->second.type==DATA_OBJECT) + { + params[0] = it->second.data; + it->second.data->incRef(); + } + else + params[0] =abstract_d(it->second.data_i); params[1] = abstract_i(it->first); params[2] = th; th->incRef(); @@ -529,7 +545,7 @@ int deleteCount; //By default, delete all the element up to the end //DeleteCount defaults to the array len, it will be capped below - ARG_UNPACK(startIndex) (deleteCount, th->size()); + ARG_UNPACK_MORE_ALLOWED(startIndex) (deleteCount, th->size()); int totalSize=th->size(); Array* ret=Class<Array>::getInstanceS(); @@ -613,7 +629,6 @@ ARG_UNPACK(arg0) (index, 0); if (index < 0) index = abs(index); - DATA_TYPE dtype; std::map<uint32_t,data_slot>::iterator it; for ( it=th->data.begin() ; it != th->data.end(); ++it ) @@ -624,7 +639,7 @@ dtype = sl.type; assert_and_throw(dtype==DATA_OBJECT || dtype==DATA_INT); if((dtype == DATA_OBJECT && sl.data->isEqualStrict(arg0.getPtr())) || - (dtype == DATA_INT && arg0->toInt() == sl.data_i)) + (dtype == DATA_INT && abstract_d(sl.data_i)->isEqualStrict(arg0.getPtr()))) { ret=it->first; break; @@ -1217,7 +1232,7 @@ ret->incRef(); break; case DATA_INT: - ret=abstract_i(sl.data_i); + ret=abstract_d(sl.data_i); break; } } @@ -1426,7 +1441,7 @@ } } else if(sl.type==DATA_INT) - return _MR(abstract_i(sl.data_i)); + return _MR(abstract_d(sl.data_i)); else throw UnsupportedException("Unexpected data type"); } @@ -1478,7 +1493,7 @@ _R<ASObject> Array::at(unsigned int index) const { if(size()<=index) - outofbounds(); + outofbounds(index); if (!data.count(index)) return _MR(getSys()->getUndefinedRef()); @@ -1494,16 +1509,16 @@ } } case DATA_INT: - return _MR(abstract_i(sl.data_i)); + return _MR(abstract_d(sl.data_i)); } //We should be here only if data is an object and is NULL return _MR(getSys()->getUndefinedRef()); } -void Array::outofbounds() const +void Array::outofbounds(unsigned int index) const { - throw ParseException("Array access out of bounds"); + throwError<RangeError>(kInvalidArrayLengthError, Number::toString(index)); } void Array::resize(uint64_t n) @@ -1638,4 +1653,26 @@ data.clear(); } +void Array::set(unsigned int index, _R<ASObject> o) +{ + if(index<currentsize) + { + if(!data.count(index)) + data[index]=data_slot(); + if(o->getObjectType()==T_INTEGER) + { + Integer* i=o->as<Integer>(); + data[index].data_i=i->val; + data[index].type=DATA_INT; + } + else + { + o->incRef(); + data[index].data=o.getPtr(); + data[index].type=DATA_OBJECT; + } + } + else + outofbounds(index); +}
View file
lightspark.tar.xz/src/scripting/toplevel/Array.h
Changed
@@ -48,16 +48,15 @@ sorton_field(const multiname& sortfieldname):isNumeric(false),isCaseInsensitive(false),isDescending(false),fieldname(sortfieldname){} }; - class Array: public ASObject { friend class ABCVm; protected: - uint32_t currentsize; + uint64_t currentsize; typedef std::map<uint32_t,data_slot,std::less<uint32_t>, reporter_allocator<std::pair<const uint32_t, data_slot>>> arrayType; arrayType data; - void outofbounds() const; + void outofbounds(unsigned int index) const; ~Array(); private: class sortComparatorDefault @@ -128,28 +127,15 @@ ASFUNCTION(some); _R<ASObject> at(unsigned int index) const; - void set(unsigned int index, _R<ASObject> o) - { - if(index<currentsize) - { - if(!data.count(index)) - data[index]=data_slot(); - o->incRef(); - data[index].data=o.getPtr(); - data[index].type=DATA_OBJECT; - } - else - outofbounds(); - } + void set(unsigned int index, _R<ASObject> o); uint64_t size() const { return currentsize; } void push(_R<ASObject> o) { - o->incRef(); - data[currentsize] = data_slot(o.getPtr()); currentsize++; + set(currentsize-1,o); } void resize(uint64_t n); _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt);
View file
lightspark.tar.xz/src/scripting/toplevel/Number.cpp
Changed
@@ -283,7 +283,9 @@ Number* th=static_cast<Number*>(obj); if(argslen==0) { - //The number is already initialized to NaN + // not constructed Numbers are set to NaN, so we have to set it to the default value during dynamic construction + if (std::isnan(th->val)) + th->val = 0.; return NULL; } th->val=args[0]->toNumber();
View file
lightspark.tar.xz/src/scripting/toplevel/Number.h
Changed
@@ -37,7 +37,7 @@ static tiny_string purgeExponentLeadingZeros(const tiny_string& exponentialForm); static int32_t countSignificantDigits(double v); public: - Number(Class_base* c, double v=0.):ASObject(c),val(v){type=T_NUMBER;} + Number(Class_base* c, double v=(std::numeric_limits<double>::quiet_NaN())):ASObject(c),val(v){type=T_NUMBER;} static const number_t NaN; double val; ASFUNCTION(_constructor);
View file
lightspark.tar.xz/src/scripting/toplevel/XML.cpp
Changed
@@ -91,7 +91,7 @@ c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(valueOf),DYNAMIC_TRAIT); c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(valueOf),NORMAL_METHOD,true); c->setDeclaredMethodByQName("toXMLString",AS3,Class<IFunction>::getFunction(toXMLString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("nodeKind",AS3,Class<IFunction>::getFunction(nodeKind),NORMAL_METHOD,true); + c->prototype->setVariableByQName("nodeKind","",Class<IFunction>::getFunction(nodeKind),DYNAMIC_TRAIT); c->setDeclaredMethodByQName("nodeKind",AS3,Class<IFunction>::getFunction(nodeKind),NORMAL_METHOD,true); c->setDeclaredMethodByQName("child",AS3,Class<IFunction>::getFunction(child),NORMAL_METHOD,true); c->setDeclaredMethodByQName("children",AS3,Class<IFunction>::getFunction(children),NORMAL_METHOD,true); c->setDeclaredMethodByQName("childIndex",AS3,Class<IFunction>::getFunction(childIndex),NORMAL_METHOD,true); @@ -126,6 +126,7 @@ c->setDeclaredMethodByQName("processingInstructions",AS3,Class<IFunction>::getFunction(processingInstructions),NORMAL_METHOD,true); c->setDeclaredMethodByQName("propertyIsEnumerable",AS3,Class<IFunction>::getFunction(_propertyIsEnumerable),NORMAL_METHOD,true); c->prototype->setVariableByQName("hasOwnProperty",AS3,Class<IFunction>::getFunction(_hasOwnProperty),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("prependChild",AS3,Class<IFunction>::getFunction(_prependChild),NORMAL_METHOD,true); } ASFUNCTIONBODY(XML,generator) @@ -1323,7 +1324,7 @@ return _MNR(this); } else - return NullRef; + return _MNR(getSys()->getUndefinedRef()); } else { @@ -2426,3 +2427,43 @@ constructed=true; } +ASFUNCTIONBODY(XML,_prependChild) +{ + XML* th=Class<XML>::cast(obj); + assert_and_throw(argslen==1); + _NR<XML> arg; + if(args[0]->getClass()==Class<XML>::getClass()) + { + args[0]->incRef(); + arg=_MR(Class<XML>::cast(args[0])); + } + else if(args[0]->getClass()==Class<XMLList>::getClass()) + { + XMLList* list=Class<XMLList>::cast(args[0]); + list->appendNodesTo(th); + th->incRef(); + return th; + } + else + { + //The appendChild specs says that any other type is converted to string + //NOTE: this is explicitly different from XML constructor, that will only convert to + //string Numbers and Booleans + arg=_MR(Class<XML>::getInstanceS(args[0]->toString())); + } + + th->appendChild(arg); + th->incRef(); + return th; +} +void XML::prependChild(_R<XML> newChild) +{ + if (newChild->constructed) + { + this->incRef(); + newChild->parentNode = _NR<XML>(this); + childrenlist->append(newChild); + } + else + newChild->decRef(); +}
View file
lightspark.tar.xz/src/scripting/toplevel/XML.h
Changed
@@ -66,6 +66,7 @@ // Append node or attribute to this. Concatenates adjacent // text nodes. void appendChild(_R<XML> child); + void prependChild(_R<XML> child); static void normalizeRecursive(XML *node); void addTextContent(const tiny_string& str); bool hasParentNode; @@ -132,6 +133,7 @@ ASFUNCTION(processingInstructions); ASFUNCTION(_propertyIsEnumerable); ASFUNCTION(_hasOwnProperty); + ASFUNCTION(_prependChild); static void buildTraits(ASObject* o){} static void sinit(Class_base* c);
View file
lightspark.tar.xz/src/scripting/toplevel/XMLList.cpp
Changed
@@ -127,7 +127,7 @@ REGISTER_XML_DELEGATE2(namespace,_namespace); REGISTER_XML_DELEGATE(namespaceDeclarations); REGISTER_XML_DELEGATE(nodeKind); - //REGISTER_XML_DELEGATE(prependChild); + REGISTER_XML_DELEGATE2(prependChild,_appendChild); REGISTER_XML_DELEGATE(removeNamespace); //REGISTER_XML_DELEGATE(replace); REGISTER_XML_DELEGATE2(setChildren,_setChildren); @@ -147,7 +147,7 @@ ASFUNCTIONBODY_XML_DELEGATE(_namespace); ASFUNCTIONBODY_XML_DELEGATE(namespaceDeclarations); ASFUNCTIONBODY_XML_DELEGATE(nodeKind); -//ASFUNCTIONBODY_XML_DELEGATE(prependChild); +ASFUNCTIONBODY_XML_DELEGATE(_prependChild); ASFUNCTIONBODY_XML_DELEGATE(removeNamespace); //ASFUNCTIONBODY_XML_DELEGATE(replace); ASFUNCTIONBODY_XML_DELEGATE(_setChildren); @@ -688,7 +688,7 @@ if(index<nodes.size()) return nodes[index]; else - return NullRef; + return _MNR(getSys()->getUndefinedRef()); } else { @@ -924,6 +924,16 @@ nodes.insert(nodes.end(),x->nodes.begin(),x->nodes.end()); } +void XMLList::prepend(_R<XML> x) +{ + nodes.insert(nodes.begin(),x); +} + +void XMLList::prepend(_R<XMLList> x) +{ + nodes.insert(nodes.begin(),x->nodes.begin(),x->nodes.end()); +} + void XMLList::replace(unsigned int idx, ASObject *o, const XML::XMLVector &retnodes,CONST_ALLOWED_FLAG allowConst) { if (idx >= nodes.size())
View file
lightspark.tar.xz/src/scripting/toplevel/XMLList.h
Changed
@@ -93,6 +93,7 @@ ASFUNCTION(comments); ASFUNCTION(processingInstructions); ASFUNCTION(_propertyIsEnumerable); + ASFUNCTION(_prependChild); _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt); void setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst); bool hasPropertyByMultiname(const multiname& name, bool considerDynamic, bool considerPrototype); @@ -103,6 +104,8 @@ bool hasComplexContent() const; void append(_R<XML> x); void append(_R<XMLList> x); + void prepend(_R<XML> x); + void prepend(_R<XMLList> x); tiny_string toString(); tiny_string toXMLString_internal(bool pretty=true); int32_t toInt();
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -116,8 +116,7 @@ void Undefined::setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst) { - LOG(LOG_NOT_IMPLEMENTED, "Ignoring set on Undefined " << name); - o->decRef(); + throwError<TypeError>(kConvertUndefinedToObjectError); } IFunction::IFunction(Class_base* c):ASObject(c),length(0),inClass(NULL) @@ -695,7 +694,7 @@ * by running ABCContext::exec() for all ABCContexts. * Therefore, all classes are at least declared. */ -const Type* Type::getTypeFromMultiname(const multiname* mn, const ABCContext* context) +const Type* Type::getTypeFromMultiname(const multiname* mn, ABCContext* context) { if(mn == 0) //multiname idx zero indicates any type return Type::anyType; @@ -708,17 +707,17 @@ && mn->ns.size() == 1 && mn->ns[0].hasEmptyName()) return Type::voidType; - ASObject* typeObject; + ASObject* typeObject = NULL; /* - * During the newClass opcode, the class is added to context->classesBeingDefined. + * During the newClass opcode, the class is added to context->root->applicationDomain->classesBeingDefined. * The class variable in the global scope is only set a bit later. * When the class has to be resolved in between (for example, the * class has traits of the class's type), then we'll find it in * classesBeingDefined, but context->root->getVariableAndTargetByMultiname() * would still return "Undefined". */ - auto i = context->classesBeingDefined.find(mn); - if(i != context->classesBeingDefined.end()) + auto i = context->root->applicationDomain->classesBeingDefined.find(mn); + if(i != context->root->applicationDomain->classesBeingDefined.end()) typeObject = i->second; else { @@ -728,17 +727,11 @@ if(!typeObject) { - //HACK: until we have implemented all flash classes, we need this hack - LOG(LOG_NOT_IMPLEMENTED,"getTypeFromMultiname: could not find " << *mn << ", using AnyType"); - return Type::anyType; - } - - if(!typeObject->is<Type>()) - { - //It actually happens in the wild that the class for a member might be a private class - //that is defined later in the same script. We have no way to solve the dependency, so return any - LOG(LOG_NOT_IMPLEMENTED,"Not resolvable type " << *mn << ", using AnyType"); - return Type::anyType; + if (mn->ns.size() >= 1 && mn->ns[0].getImpl().name == "__AS3__.vec") + { + QName qname(getSys()->getStringFromUniqueId(mn->name_s_id),mn->ns[0].getImpl().name); + typeObject = Template<Vector>::getTemplateInstance(qname,context).getPtr(); + } } return typeObject->as<Type>(); } @@ -793,7 +786,7 @@ void Class_base::initStandardProps() { incRef(); - constructorprop = _NR<ObjectConstructor>(new_objectConstructor(this)); + constructorprop = _NR<ObjectConstructor>(new_objectConstructor(this,0)); constructorprop->incRef(); addConstructorGetter(); @@ -1377,9 +1370,9 @@ protected_ns=nsNameAndKind(name,baseNs->nsId,(NS_KIND)(int)ns.kind); } -const variable* Class_base::findBorrowedGettable(const multiname& name) const +const variable* Class_base::findBorrowedGettable(const multiname& name,NS_KIND& nskind) const { - return ASObject::findGettableImpl(borrowedVariables,name); + return ASObject::findGettableImpl(borrowedVariables,name,nskind); } variable* Class_base::findBorrowedSettable(const multiname& name, bool* has_getter) @@ -1404,7 +1397,8 @@ EARLY_BIND_STATUS Class_base::resolveMultinameStatically(const multiname& name) const { - if(findBorrowedGettable(name)!=NULL) + NS_KIND nskind; + if(findBorrowedGettable(name,nskind)!=NULL) return BINDED; else return NOT_BINDED; @@ -1632,14 +1626,14 @@ return s + local_name; } -Namespace::Namespace(Class_base* c):ASObject(c) +Namespace::Namespace(Class_base* c):ASObject(c),nskind(NAMESPACE) { type=T_NAMESPACE; prefix_is_undefined=false; } Namespace::Namespace(Class_base* c, const tiny_string& _uri, const tiny_string& _prefix) - : ASObject(c),uri(_uri),prefix(_prefix) + : ASObject(c),nskind(NAMESPACE),uri(_uri),prefix(_prefix) { type=T_NAMESPACE; prefix_is_undefined=false; @@ -1957,7 +1951,7 @@ //Thus we make sure that everything is in order when getFunction() below is called ret->addPrototypeGetter(); IFunction::sinit(ret); - ret->constructorprop = _NR<ObjectConstructor>(new_objectConstructor(ret)); + ret->constructorprop = _NR<ObjectConstructor>(new_objectConstructor(ret,ret->length)); ret->constructorprop->incRef(); ret->addConstructorGetter(); @@ -2385,7 +2379,7 @@ } -ObjectConstructor::ObjectConstructor(Class_base* c) : ASObject(c) +ObjectConstructor::ObjectConstructor(Class_base* c,uint32_t length) : ASObject(c),_length(length) { Class<ASObject>::getRef()->prototype->incRef(); this->prototype = Class<ASObject>::getRef()->prototype.getPtr(); @@ -2398,6 +2392,10 @@ prototype->getObj()->incRef(); return _NR<ASObject>(prototype->getObj()); } + if (name.normalizedName() == "length") + { + return _NR<ASObject>(abstract_d(_length)); + } return getClass()->getVariableByMultiname(name, opt); } bool ObjectConstructor::isEqual(ASObject* r)
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -74,7 +74,7 @@ * then an exception is thrown. * The caller does not own the object returned. */ - static const Type* getTypeFromMultiname(const multiname* mn, const ABCContext* context); + static const Type* getTypeFromMultiname(const multiname* mn, ABCContext* context); /* * Checks if the type is already in sys->classes */ @@ -225,7 +225,7 @@ super = super_; copyBorrowedTraitsFromSuper(); } - const variable* findBorrowedGettable(const multiname& name) const DLL_LOCAL; + const variable* findBorrowedGettable(const multiname& name, NS_KIND &nskind) const DLL_LOCAL; variable* findBorrowedSettable(const multiname& name, bool* has_getter=NULL) DLL_LOCAL; variable* findSettableInPrototype(const multiname& name) DLL_LOCAL; EARLY_BIND_STATUS resolveMultinameStatically(const multiname& name) const; @@ -299,8 +299,9 @@ class ObjectConstructor: public ASObject { Prototype* prototype; + uint32_t _length; public: - ObjectConstructor(Class_base* c); + ObjectConstructor(Class_base* c,uint32_t length); void incRef() { getClass()->incRef(); } void decRef() { getClass()->decRef(); } _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt=NONE); @@ -578,6 +579,7 @@ friend class ASQName; friend class ABCContext; private: + NS_KIND nskind; bool prefix_is_undefined; tiny_string uri; tiny_string prefix;
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -1327,7 +1327,9 @@ ASObject* lightspark::abstract_d(number_t i) { - Number* ret=Class<Number>::getInstanceS(i); + Number* ret=Class<Number>::getInstanceS(); + // we have to set the value seperately, because for i = NaN, getInstanceS will overwrite the value + ret->val = i; return ret; }
View file
lightspark.tar.xz/src/tiny_string.cpp
Changed
@@ -505,7 +505,6 @@ uint32_t allocated = 2*numBytes()+7; ret.createBuffer(allocated); char *p = ret.buf; - char *pend = ret.buf + allocated; uint32_t len = 0; for (CharIterator it=begin(); it!=end(); it++) { @@ -528,7 +527,6 @@ uint32_t allocated = 2*numBytes()+7; ret.createBuffer(allocated); char *p = ret.buf; - char *pend = ret.buf + allocated; uint32_t len = 0; for (CharIterator it=begin(); it!=end(); it++) { @@ -585,6 +583,23 @@ return CharIterator(buf+numBytes()); } +int tiny_string::compare(const tiny_string& r) const +{ + int l = std::min(stringSize,r.stringSize); + int res = 0; + for(int i=0;i < l-1;i++) + { + res = (int)buf[i] - (int)r.buf[i]; + if (res != 0) + return res; + } + if (stringSize > r.stringSize) + res = 1; + else if (stringSize < r.stringSize) + res = -1; + return res; +} + #ifdef MEMORY_USAGE_PROFILING void tiny_string::reportMemoryChange(int32_t change) const {
View file
lightspark.tar.xz/src/tiny_string.h
Changed
@@ -185,6 +185,7 @@ CharIterator begin() const; CharIterator end(); CharIterator end() const; + int compare(const tiny_string& r) const; }; };
View file
lightspark.tar.xz/tools/langref_parser
Changed
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 #This greps the source for SET_NAMESPACE, REGISTER_CLASS_NAME2, #sinit definition and the following ->set{Getter,Setter,Method}ByQName calls @@ -21,7 +21,7 @@ print("Call by langref_parser langref-directory") print("If you do not have a langref directory,") print("please download http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/standalone.zip") - print("and unpack it.") + print("and unpack it.") exit(1) langref = sys.argv[1] @@ -71,10 +71,11 @@ if m: if dirpath==langref: curClass = m.group(1) + isConst = False else: curClass = dirpath.replace("langref/","").replace("/",".") +"."+ m.group(1) - dclasses.add(curClass) - isConst = False + dclasses.add(curClass) + isConst = False break m = regconst.search(line) if m: @@ -84,7 +85,7 @@ #there may be another match on this line m = regproperty.search(line) if m: - name = m.group(1) + name = m.group(1).replace("#","").replace("(","").replace(")","") isOverride = m.group(2) != None isStatic = m.group(3) != None isReadOnly = m.group(4) != None @@ -94,7 +95,7 @@ continue m = regmethod.search(line) if m: - name = m.group(1) + name = m.group(1).replace("#","").replace("(","").replace(")","") dmethods.add((curClass,name)) line = line[m.end():] continue
View file
lightspark.tar.xz/tools/pygil
Changed
@@ -13,9 +13,10 @@ #These regexp are used for finding important pieces in the source sinit = re.compile('.*void\s*(\w*)::sinit\(.*') -rconstructor = re.compile('[^/]*->setConstructor\(NULL|Class<IFunction>::getFunction\([^)]*\)\).*') +rconstructor = re.compile('[^/]*ASFUNCTIONBODY\([^,]*, *\_constructor\)') #looks like builtin->registerBuiltin("Capabilities","flash.system",Class<Capabilities>::getRef()); rclass = re.compile('.*builtin->registerBuiltin\( *"([^"]*)", *"([^"]*)", *Class<([^>]*)>::getRef\(\)\)') +rtemplateclass = re.compile('.*builtin->registerBuiltin\( *"([^"]*)", *"([^"]*)", *_MR\(Template<([^>]*)>::getTemplate\(\)\)\)') rinterfaceclass = re.compile('.*builtin->registerBuiltin\( *"([^"]*)", *"([^"]*)", *InterfaceClass<([^>]*)>::getRef\(\)\)') #looks like builtin->registerBuiltin("Socket","flash.net",Class<ASObject>::getStubClass(QName("Socket","flash.net"))); rstupclass = re.compile('.*builtin->registerBuiltin\( *"([^"]*)", *"([^"]*)", *Class<ASObject>::getStubClass\(QName.*') @@ -55,10 +56,15 @@ f = open('../src/scripting/abc.cpp','r') for line in f.read().replace("\n","").replace("\t"," ").split(";"): m = rclass.match(line) - if m: + if m: fullname = getFullname(m.group(2),m.group(1)) internalToExternal[m.group(3)] = fullname classes.add(fullname) + m = rtemplateclass.match(line) + if m: + fullname = getFullname("",m.group(1)) + internalToExternal[m.group(3)] = fullname + classes.add(fullname) m = rinterfaceclass.match(line) if m: fullname = getFullname(m.group(2),m.group(1))
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.