Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 104
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without librtmp Name: lightspark -Version: 0.7.2.99+git20160311.1829 +Version: 0.7.2.99+git20160410.1631 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
0001-s-PIX_FMT_YUV420P-AV_PIX_FMT_YUV420P-compatibility.patch
Changed
@@ -1,4 +1,4 @@ -From 0071cb20db3166dbef561ef4007158b13c5c68af Mon Sep 17 00:00:00 2001 +From 4b64069813a87df922235582eb71ea82ca6afd9e Mon Sep 17 00:00:00 2001 From: Johannes Obermayr <johannesobermayr@gmx.de> Date: Mon, 21 Mar 2016 22:34:36 +0100 Subject: [PATCH 1/2] s/PIX_FMT_YUV420P/AV_PIX_FMT_YUV420P + compatibility. @@ -41,5 +41,5 @@ if(status==INIT && fillDataAndCheckValidity()) status=VALID; -- -2.7.3 +2.8.1
View file
0002-Fix-build-with-newer-LLVM.patch
Changed
@@ -1,6 +1,6 @@ -From c7e27875f28fc5a716c1fa83cff89860569554be Mon Sep 17 00:00:00 2001 +From 43638ba6183f984c200e207565bd10a5ab15bd53 Mon Sep 17 00:00:00 2001 From: Johannes Obermayr <johannesobermayr@gmx.de> -Date: Tue, 22 Mar 2016 21:37:43 +0100 +Date: Mon, 11 Apr 2016 13:58:43 +0200 Subject: [PATCH 2/2] Fix build with newer LLVM. --- @@ -9,7 +9,7 @@ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0b9790d..06d9a23 100644 +index 0b9790d..93c0829 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -250,6 +250,17 @@ ENDIF(NOT (${LLVM_STRING_VERSION} VERSION_LESS 3.6)) @@ -18,9 +18,9 @@ ENDIF(NOT ${LLVM_STRING_VERSION} VERSION_LESS 3.7) + +INCLUDE(CheckCXXSourceCompiles) -+SET(CMAKE_REQUIRED_FLAGS ${LLVM_COMPILE_FLAGS}) ++SET(CMAKE_REQUIRED_FLAGS "-std=c++11 -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS") +SET(CMAKE_REQUIRED_INCLUDES ${LLVM_INCLUDE_DIR}) -+CHECK_CXX_SOURCE_COMPILES("#include <llvm/ExecutionEngine/ExecutionEngine.h>\nbool main() { return DL.isLittleEndian(); }" EXECUTIONENGINE_OWNING_DATALAYOUT) ++CHECK_CXX_SOURCE_COMPILES("#include <llvm/ExecutionEngine/ExecutionEngine.h>\nint main() { llvm::ExecutionEngine* ex; return ex->getDataLayout().isLittleEndian(); }" EXECUTIONENGINE_OWNING_DATALAYOUT) +IF(EXECUTIONENGINE_OWNING_DATALAYOUT) + ADD_DEFINITIONS(-DEXECUTIONENGINE_OWNING_DATALAYOUT) +ENDIF(EXECUTIONENGINE_OWNING_DATALAYOUT) @@ -31,7 +31,7 @@ INCLUDE(FindFreetype REQUIRED) IF(NOT(ENABLE_GLES2)) diff --git a/src/scripting/abc_codesynt.cpp b/src/scripting/abc_codesynt.cpp -index d07ccd6..0cb6581 100644 +index 42a0f9c..d0c8c13 100644 --- a/src/scripting/abc_codesynt.cpp +++ b/src/scripting/abc_codesynt.cpp @@ -294,11 +294,15 @@ void ABCVm::registerFunctions() @@ -48,19 +48,19 @@ #endif +#endif //Pointer to 8 bit type, needed for pointer arithmetic - voidptr_type=llvm::IntegerType::get(getVm()->llvm_context(),8)->getPointerTo(); + voidptr_type=llvm::IntegerType::get(llvm_context(),8)->getPointerTo(); number_type=llvm::Type::getDoubleTy(llvm_context()); -@@ -1883,9 +1887,8 @@ SyntheticFunction::synt_function method_info::synt_method() +@@ -1883,9 +1887,8 @@ SyntheticFunction::synt_function method_info::synt_method(SystemState* sys) constant = llvm::ConstantInt::get(ptr_type, (uintptr_t)this); llvm::Value* th = llvm::ConstantExpr::getIntToPtr(constant, voidptr_type); - llvm::Function::ArgumentListType::iterator it=llvmf->getArgumentList().begin(); //The first and only argument to this function is the call_context* - llvm::Value* context=it; -+ llvm::Value* context=llvmf->getArgumentList().begin(); ++ llvm::Value* context = (llvm::Value*)llvmf->getArgumentList().begin(); //let's give access to local data storage value=Builder.CreateStructGEP( -- -2.7.3 +2.8.1
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -71,7 +71,7 @@ if (this->proxyMultiName) this->proxyMultiName->ns.clear(); else - this->proxyMultiName = new (getVm()->vmDataMemory) multiname(getVm()->vmDataMemory); + this->proxyMultiName = new (getVm(getSystemState())->vmDataMemory) multiname(getVm(getSystemState())->vmDataMemory); this->proxyMultiName->isAttribute = name.isAttribute; this->proxyMultiName->ns.reserve(name.ns.size()); for(unsigned int i=0;i<name.ns.size();i++) @@ -180,7 +180,7 @@ { assert_and_throw(implEnable); - return _MR(abstract_s(getNameAt(index-1))); + return _MR(abstract_s(getSystemState(),getNameAt(index-1))); } _R<ASObject> ASObject::nextValue(uint32_t index) @@ -192,16 +192,16 @@ 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->setDeclaredMethodByQName("hasOwnProperty",AS3,Class<IFunction>::getFunction(c->getSystemState(),hasOwnProperty),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setPropertyIsEnumerable",AS3,Class<IFunction>::getFunction(c->getSystemState(),setPropertyIsEnumerable),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(_toLocaleString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(valueOf),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("hasOwnProperty","",Class<IFunction>::getFunction(hasOwnProperty),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("isPrototypeOf","",Class<IFunction>::getFunction(isPrototypeOf),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("propertyIsEnumerable","",Class<IFunction>::getFunction(propertyIsEnumerable),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setPropertyIsEnumerable","",Class<IFunction>::getFunction(setPropertyIsEnumerable),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(c->getSystemState(),_toLocaleString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),valueOf),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("hasOwnProperty","",Class<IFunction>::getFunction(c->getSystemState(),hasOwnProperty),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("isPrototypeOf","",Class<IFunction>::getFunction(c->getSystemState(),isPrototypeOf),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("propertyIsEnumerable","",Class<IFunction>::getFunction(c->getSystemState(),propertyIsEnumerable),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("setPropertyIsEnumerable","",Class<IFunction>::getFunction(c->getSystemState(),setPropertyIsEnumerable),DYNAMIC_TRAIT); } @@ -323,9 +323,9 @@ { multiname valueOfName(NULL); valueOfName.name_type=multiname::NAME_STRING; - valueOfName.name_s_id=getSys()->getUniqueStringId("valueOf"); - valueOfName.ns.emplace_back("",NAMESPACE); - valueOfName.ns.emplace_back(AS3,NAMESPACE); + valueOfName.name_s_id=getSystemState()->getUniqueStringId("valueOf"); + valueOfName.ns.emplace_back(getSystemState(),"",NAMESPACE); + valueOfName.ns.emplace_back(getSystemState(),AS3,NAMESPACE); valueOfName.isAttribute = false; return hasPropertyByMultiname(valueOfName, true, true); } @@ -337,15 +337,15 @@ { multiname valueOfName(NULL); valueOfName.name_type=multiname::NAME_STRING; - valueOfName.name_s_id=getSys()->getUniqueStringId("valueOf"); - valueOfName.ns.emplace_back("",NAMESPACE); - valueOfName.ns.emplace_back(AS3,NAMESPACE); + valueOfName.name_s_id=getSystemState()->getUniqueStringId("valueOf"); + valueOfName.ns.emplace_back(getSystemState(),"",NAMESPACE); + valueOfName.ns.emplace_back(getSystemState(),AS3,NAMESPACE); valueOfName.isAttribute = false; assert_and_throw(hasPropertyByMultiname(valueOfName, true, true)); _NR<ASObject> o=getVariableByMultiname(valueOfName,SKIP_IMPL); if (!o->is<IFunction>()) - throwError<TypeError>(kCallOfNonFunctionError, valueOfName.normalizedNameUnresolved()); + throwError<TypeError>(kCallOfNonFunctionError, valueOfName.normalizedNameUnresolved(getSystemState())); IFunction* f=o->as<IFunction>(); incRef(); @@ -357,9 +357,9 @@ { multiname toStringName(NULL); toStringName.name_type=multiname::NAME_STRING; - toStringName.name_s_id=getSys()->getUniqueStringId("toString"); - toStringName.ns.emplace_back("",NAMESPACE); - toStringName.ns.emplace_back(AS3,NAMESPACE); + toStringName.name_s_id=getSystemState()->getUniqueStringId("toString"); + toStringName.ns.emplace_back(getSystemState(),"",NAMESPACE); + toStringName.ns.emplace_back(getSystemState(),AS3,NAMESPACE); toStringName.isAttribute = false; return ASObject::hasPropertyByMultiname(toStringName, true, true); } @@ -371,9 +371,9 @@ { multiname toStringName(NULL); toStringName.name_type=multiname::NAME_STRING; - toStringName.name_s_id=getSys()->getUniqueStringId("toString"); - toStringName.ns.emplace_back("",NAMESPACE); - toStringName.ns.emplace_back(AS3,NAMESPACE); + toStringName.name_s_id=getSystemState()->getUniqueStringId("toString"); + toStringName.ns.emplace_back(getSystemState(),"",NAMESPACE); + toStringName.ns.emplace_back(getSystemState(),AS3,NAMESPACE); toStringName.isAttribute = false; assert(ASObject::hasPropertyByMultiname(toStringName, true, true)); @@ -392,9 +392,9 @@ ok = false; multiname toJSONName(NULL); toJSONName.name_type=multiname::NAME_STRING; - toJSONName.name_s_id=getSys()->getUniqueStringId("toJSON"); - toJSONName.ns.emplace_back("",NAMESPACE); - toJSONName.ns.emplace_back(AS3,NAMESPACE); + toJSONName.name_s_id=getSystemState()->getUniqueStringId("toJSON"); + toJSONName.ns.emplace_back(getSystemState(),"",NAMESPACE); + toJSONName.ns.emplace_back(getSystemState(),AS3,NAMESPACE); toJSONName.isAttribute = false; if (!ASObject::hasPropertyByMultiname(toJSONName, true, true)) return res; @@ -464,20 +464,19 @@ if(considerDynamic) validTraits|=DYNAMIC_TRAIT; - if(Variables.findObjVar(name, NO_CREATE_TRAIT, validTraits)!=NULL) + if(Variables.findObjVar(getSystemState(),name, validTraits)!=NULL) return true; - if(classdef && classdef->borrowedVariables.findObjVar(name, NO_CREATE_TRAIT, DECLARED_TRAIT)!=NULL) + if(classdef && classdef->borrowedVariables.findObjVar(getSystemState(),name, 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,nskind) != NULL) + if(proto->getObj()->findGettable(name) != NULL) return true; proto=proto->prevPrototype.getPtr(); } @@ -489,12 +488,12 @@ void ASObject::setDeclaredMethodByQName(const tiny_string& name, const tiny_string& ns, IFunction* o, METHOD_TYPE type, bool isBorrowed) { - setDeclaredMethodByQName(name, nsNameAndKind(ns, NAMESPACE), o, type, isBorrowed); + setDeclaredMethodByQName(name, nsNameAndKind(getSystemState(),ns, NAMESPACE), o, type, isBorrowed); } void ASObject::setDeclaredMethodByQName(const tiny_string& name, const nsNameAndKind& ns, IFunction* o, METHOD_TYPE type, bool isBorrowed) { - setDeclaredMethodByQName(getSys()->getUniqueStringId(name), ns, o, type, isBorrowed); + setDeclaredMethodByQName(getSystemState()->getUniqueStringId(name), ns, o, type, isBorrowed); } void ASObject::setDeclaredMethodByQName(uint32_t nameId, const nsNameAndKind& ns, IFunction* o, METHOD_TYPE type, bool isBorrowed) @@ -552,7 +551,7 @@ bool ASObject::deleteVariableByMultiname(const multiname& name) { - variable* obj=Variables.findObjVar(name,NO_CREATE_TRAIT,DYNAMIC_TRAIT|DECLARED_TRAIT); + variable* obj=Variables.findObjVar(getSystemState(),name,NO_CREATE_TRAIT,DYNAMIC_TRAIT|DECLARED_TRAIT); if(obj==NULL) { @@ -575,7 +574,7 @@ obj->var->decRef(); //Now kill the variable - Variables.killObjVar(name); + Variables.killObjVar(getSystemState(),name); return true; } @@ -583,12 +582,12 @@ void ASObject::setVariableByMultiname_i(const multiname& name, int32_t value) { check(); - setVariableByMultiname(name,abstract_i(value),CONST_NOT_ALLOWED); + setVariableByMultiname(name,abstract_i(this->getSystemState(),value),CONST_NOT_ALLOWED); } -variable* ASObject::findSettableImpl(variables_map& map, const multiname& name, bool* has_getter) +variable* ASObject::findSettableImpl(SystemState* sys,variables_map& map, const multiname& name, bool* has_getter) { - variable* ret=map.findObjVar(name,NO_CREATE_TRAIT,DECLARED_TRAIT|DYNAMIC_TRAIT); + variable* ret=map.findObjVar(sys,name,NO_CREATE_TRAIT,DECLARED_TRAIT|DYNAMIC_TRAIT); if(ret) { //It seems valid for a class to redefine only the getter, so if we can't find @@ -605,7 +604,7 @@ variable* ASObject::findSettable(const multiname& name, bool* has_getter) { - return findSettableImpl(Variables, name, has_getter); + return findSettableImpl(getSystemState(),Variables, name, has_getter); } @@ -619,7 +618,7 @@
View file
lightspark.tar.xz/src/asobject.h
Changed
@@ -65,23 +65,23 @@ ASObject* c::_getter_##name(ASObject* obj, ASObject* const* args, const unsigned int argslen) \ { \ if(!obj->is<c>()) \ - throw Class<ArgumentError>::getInstanceS("Function applied to wrong object"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Function applied to wrong object"); \ c* th = obj->as<c>(); \ if(argslen != 0) \ - throw Class<ArgumentError>::getInstanceS("Arguments provided in getter"); \ - return ArgumentConversion<decltype(th->name)>::toAbstract(th->name); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Arguments provided in getter"); \ + return ArgumentConversion<decltype(th->name)>::toAbstract(obj->getSystemState(),th->name); \ } #define ASFUNCTIONBODY_GETTER_NOT_IMPLEMENTED(c,name) \ ASObject* c::_getter_##name(ASObject* obj, ASObject* const* args, const unsigned int argslen) \ { \ if(!obj->is<c>()) \ - throw Class<ArgumentError>::getInstanceS("Function applied to wrong object"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Function applied to wrong object"); \ c* th = obj->as<c>(); \ if(argslen != 0) \ - throw Class<ArgumentError>::getInstanceS("Arguments provided in getter"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Arguments provided in getter"); \ LOG(LOG_NOT_IMPLEMENTED,obj->getClassName() <<"."<< #name << " getter is not implemented"); \ - return ArgumentConversion<decltype(th->name)>::toAbstract(th->name); \ + return ArgumentConversion<decltype(th->name)>::toAbstract(obj->getSystemState(),th->name); \ } /* full body for a getter declared by ASPROPERTY_SETTER or ASFUNCTION_SETTER */ @@ -89,10 +89,10 @@ ASObject* c::_setter_##name(ASObject* obj, ASObject* const* args, const unsigned int argslen) \ { \ if(!obj->is<c>()) \ - throw Class<ArgumentError>::getInstanceS("Function applied to wrong object"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Function applied to wrong object"); \ c* th = obj->as<c>(); \ if(argslen != 1) \ - throw Class<ArgumentError>::getInstanceS("Wrong number of arguments in setter"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Wrong number of arguments in setter"); \ th->name = ArgumentConversion<decltype(th->name)>::toConcrete(args[0]); \ return NULL; \ } @@ -101,10 +101,10 @@ ASObject* c::_setter_##name(ASObject* obj, ASObject* const* args, const unsigned int argslen) \ { \ if(!obj->is<c>()) \ - throw Class<ArgumentError>::getInstanceS("Function applied to wrong object"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Function applied to wrong object"); \ c* th = obj->as<c>(); \ if(argslen != 1) \ - throw Class<ArgumentError>::getInstanceS("Wrong number of arguments in setter"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Wrong number of arguments in setter"); \ LOG(LOG_NOT_IMPLEMENTED,obj->getClassName() <<"."<< #name << " setter is not implemented"); \ th->name = ArgumentConversion<decltype(th->name)>::toConcrete(args[0]); \ return NULL; \ @@ -117,10 +117,10 @@ ASObject* c::_setter_##name(ASObject* obj, ASObject* const* args, const unsigned int argslen) \ { \ if(!obj->is<c>()) \ - throw Class<ArgumentError>::getInstanceS("Function applied to wrong object"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Function applied to wrong object"); \ c* th = obj->as<c>(); \ if(argslen != 1) \ - throw Class<ArgumentError>::getInstanceS("Wrong number of arguments in setter"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Wrong number of arguments in setter"); \ decltype(th->name) oldValue = th->name; \ th->name = ArgumentConversion<decltype(th->name)>::toConcrete(args[0]); \ th->callback(oldValue); \ @@ -142,10 +142,10 @@ /* registers getter/setter with Class_base. To be used in ::sinit()-functions */ #define REGISTER_GETTER(c,name) \ - c->setDeclaredMethodByQName(#name,"",Class<IFunction>::getFunction(_getter_##name),GETTER_METHOD,true) + c->setDeclaredMethodByQName(#name,"",Class<IFunction>::getFunction(c->getSystemState(),_getter_##name),GETTER_METHOD,true) #define REGISTER_SETTER(c,name) \ - c->setDeclaredMethodByQName(#name,"",Class<IFunction>::getFunction(_setter_##name),SETTER_METHOD,true) + c->setDeclaredMethodByQName(#name,"",Class<IFunction>::getFunction(c->getSystemState(),_setter_##name),SETTER_METHOD,true) #define REGISTER_GETTER_SETTER(c,name) \ REGISTER_GETTER(c,name); \ @@ -157,18 +157,18 @@ // TODO: Every class should have a constructor #define CLASS_SETUP_NO_CONSTRUCTOR(c, superClass, attributes) \ - c->setSuper(Class<superClass>::getRef()); \ + c->setSuper(Class<superClass>::getRef(c->getSystemState())); \ c->setConstructor(NULL); \ c->isFinal = ((attributes) & CLASS_FINAL) != 0; \ c->isSealed = ((attributes) & CLASS_SEALED) != 0 #define CLASS_SETUP(c, superClass, constructor, attributes) \ CLASS_SETUP_NO_CONSTRUCTOR(c, superClass, attributes); \ - c->setConstructor(Class<IFunction>::getFunction(constructor)); + c->setConstructor(Class<IFunction>::getFunction(c->getSystemState(),constructor)); #define CLASS_SETUP_CONSTRUCTOR_LENGTH(c, superClass, constructor, ctorlength, attributes) \ CLASS_SETUP_NO_CONSTRUCTOR(c, superClass, attributes); \ - c->setConstructor(Class<IFunction>::getFunction((constructor), (ctorlength))); + c->setConstructor(Class<IFunction>::getFunction(c->getSystemState(),(constructor), (ctorlength))); namespace lightspark { @@ -181,7 +181,9 @@ class Loader; class Type; class ABCContext; +class SystemState; +extern SystemState* getSys(); 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 }; @@ -246,14 +248,50 @@ @param traitKinds Bitwise OR of accepted trait kinds */ variable* findObjVar(uint32_t nameId, const nsNameAndKind& ns, TRAIT_KIND createKind, uint32_t traitKinds); - variable* findObjVar(const multiname& mname, TRAIT_KIND createKind, uint32_t traitKinds); + variable* findObjVar(SystemState* sys,const multiname& mname, TRAIT_KIND createKind, uint32_t traitKinds); /** * Const version of findObjVar, useful when looking for getters */ - const variable* findObjVar(const multiname& mname, uint32_t traitKinds, NS_KIND &nskind) const; + inline const variable* findObjVar(SystemState* sys,const multiname& mname, uint32_t traitKinds, uint32_t* nsRealId = NULL) const + { + if (mname.isEmpty()) + return NULL; + uint32_t name=mname.name_type == multiname::NAME_STRING ? mname.name_s_id : mname.normalizedNameId(sys); + assert(!mname.ns.empty()); + + const_var_iterator ret=Variables.lower_bound(varName(name,mname.ns.front())); + auto nsIt=mname.ns.cbegin(); + + //Find the namespace + while(ret!=Variables.cend() && ret->first.nameId==name) + { + //breaks when the namespace is not found + const nsNameAndKind& ns=ret->first.ns; + if(ns==*nsIt) + { + if (nsRealId) + *nsRealId = ns.nsRealId; + if(ret->second.kind & traitKinds) + return &ret->second; + else + return NULL; + } + else if(*nsIt<ns) + { + ++nsIt; + if(nsIt==mname.ns.cend()) + break; + } + else if(ns<*nsIt) + ++ret; + } + + return NULL; + } + //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 killObjVar(const multiname& mname); + void killObjVar(SystemState* sys, const multiname& mname); ASObject* getSlot(unsigned int n) { assert_and_throw(n > 0 && n<=slots_vars.size()); @@ -278,7 +316,7 @@ { return Variables.size(); } - tiny_string getNameAt(unsigned int i) const; + tiny_string getNameAt(SystemState* sys,unsigned int i) const; variable* getValueAt(unsigned int i); int getNextEnumerable(unsigned int i) const; ~variables_map(); @@ -299,28 +337,68 @@ friend class ABCVm; friend class ABCContext; friend class Class_base; //Needed for forced cleanup +friend class Class_inherit; friend void lookupAndLink(Class_base* c, const tiny_string& name, const tiny_string& interfaceNs); friend class IFunction; //Needed for clone private: variables_map Variables; Class_base* classdef; - const variable* findGettable(const multiname& name, NS_KIND &nskind) const DLL_LOCAL; + inline const variable* findGettable(const multiname& name, uint32_t* nsRealId = NULL) const DLL_LOCAL + { + const variable* ret=Variables.findObjVar(getSystemState(),name,DECLARED_TRAIT|DYNAMIC_TRAIT,nsRealId); + if(ret) + { + //It seems valid for a class to redefine only the setter, so if we can't find + //something to get, it's ok + if(!(ret->getter || ret->var)) + ret=NULL; + } + return ret; + }
View file
lightspark.tar.xz/src/backends/extscriptobject.cpp
Changed
@@ -252,16 +252,16 @@ switch(getType()) { case EV_STRING: - asobj = Class<ASString>::getInstanceS(getString().c_str()); + asobj = abstract_s(getSys(),getString().c_str()); break; case EV_INT32: - asobj = abstract_i(getInt()); + asobj = abstract_i(getSys(),getInt()); break; case EV_DOUBLE: - asobj = abstract_d(getDouble()); + asobj = abstract_d(getSys(),getDouble()); break; case EV_BOOLEAN: - asobj = abstract_b(getBoolean()); + asobj = abstract_b(getSys(),getBoolean()); break; case EV_OBJECT: { @@ -279,7 +279,7 @@ // We are converting an array, so lets set indexes if(objValue->getType() == ExtObject::EO_ARRAY) { - asobj = Class<Array>::getInstanceS(); + asobj = Class<Array>::getInstanceS(getSys()); objectsMap[objValue] = asobj; count = objValue->getLength(); @@ -293,7 +293,7 @@ // We are converting an object, so lets set variables else { - asobj = Class<ASObject>::getInstanceS(); + asobj = Class<ASObject>::getInstanceS(getSys()); objectsMap[objValue] = asobj; ExtIdentifier** ids; @@ -373,7 +373,7 @@ func->incRef(); funcEvent = _MR(new (getSys()->unaccountedMemory) ExternalCallEvent(_MR(func), asArgs, argc, &result, &exceptionThrown, &exception)); // Add the callback function event to the VM event queue - funcWasCalled=getVm()->addEvent(NullRef,funcEvent); + funcWasCalled=getVm(getSys())->addEvent(NullRef,funcEvent); if(!funcWasCalled) funcEvent = NullRef; }
View file
lightspark.tar.xz/src/backends/input.cpp
Changed
@@ -175,7 +175,7 @@ return NullRef; } assert(selected); /* atleast we hit the stage */ - assert_and_throw(selected->getClass()->isSubClass(Class<InteractiveObject>::getClass())); + assert_and_throw(selected->getClass()->isSubClass(Class<InteractiveObject>::getClass(m_sys))); return selected; } @@ -188,7 +188,7 @@ number_t localX, localY; selected->globalToLocal(x,y,localX,localY); m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("mouseDown",localX,localY,true,buttonState))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"mouseDown",localX,localY,true,buttonState))); lastMouseDownTarget=selected; } @@ -201,7 +201,7 @@ number_t localX, localY; selected->globalToLocal(x,y,localX,localY); m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("doubleClick",localX,localY,true,buttonState))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"doubleClick",localX,localY,true,buttonState))); } void InputThread::handleMouseUp(uint32_t x, uint32_t y, unsigned int buttonState) @@ -213,12 +213,12 @@ number_t localX, localY; selected->globalToLocal(x,y,localX,localY); m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("mouseUp",localX,localY,true,buttonState))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"mouseUp",localX,localY,true,buttonState))); if(lastMouseDownTarget==selected) { //Also send the click event m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("click",localX,localY,true,buttonState))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"click",localX,localY,true,buttonState))); } lastMouseDownTarget=NullRef; } @@ -256,7 +256,7 @@ selected->globalToLocal(x,y,localX,localY); if(currentMouseOver == selected) m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("mouseMove",localX,localY,true,buttonState))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"mouseMove",localX,localY,true,buttonState))); else { if(!currentMouseOver.isNull()) @@ -264,14 +264,14 @@ number_t clocalX, clocalY; currentMouseOver->globalToLocal(x,y,clocalX,clocalY); m_sys->currentVm->addEvent(currentMouseOver, - _MR(Class<MouseEvent>::getInstanceS("mouseOut",clocalX,clocalY,true,buttonState,selected))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"mouseOut",clocalX,clocalY,true,buttonState,selected))); m_sys->currentVm->addEvent(currentMouseOver, - _MR(Class<MouseEvent>::getInstanceS("rollOut",clocalX,clocalY,true,buttonState,selected))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"rollOut",clocalX,clocalY,true,buttonState,selected))); } m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("mouseOver",localX,localY,true,buttonState,currentMouseOver))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"mouseOver",localX,localY,true,buttonState,currentMouseOver))); m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("rollOver",localX,localY,true,buttonState,currentMouseOver))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"rollOver",localX,localY,true,buttonState,currentMouseOver))); currentMouseOver = selected; } } @@ -295,7 +295,7 @@ number_t localX, localY; selected->globalToLocal(x,y,localX,localY); m_sys->currentVm->addEvent(selected, - _MR(Class<MouseEvent>::getInstanceS("mouseWheel",localX,localY,true,buttonState,NullRef,delta))); + _MR(Class<MouseEvent>::getInstanceS(m_sys,"mouseWheel",localX,localY,true,buttonState,NullRef,delta))); } void InputThread::handleMouseLeave() @@ -306,7 +306,7 @@ _NR<Stage> stage = m_sys->mainClip->getStage(); stage->incRef(); m_sys->currentVm->addEvent(stage, - _MR(Class<Event>::getInstanceS("mouseLeave"))); + _MR(Class<Event>::getInstanceS(m_sys,"mouseLeave"))); } void InputThread::initKeyTable() @@ -418,7 +418,7 @@ target->incRef(); m_sys->currentVm->addEvent(target, - _MR(Class<KeyboardEvent>::getInstanceS(type, charcode, keyevent->hardware_keycode, keyevent->state))); + _MR(Class<KeyboardEvent>::getInstanceS(m_sys,type, charcode, keyevent->hardware_keycode, keyevent->state))); } void InputThread::addListener(InteractiveObject* ob)
View file
lightspark.tar.xz/src/backends/netutils.cpp
Changed
@@ -822,13 +822,13 @@ if(checkPolicyFile) { SecurityManager::EVALUATIONRESULT evaluationResult = \ - getSys()->securityManager->evaluatePoliciesURL(url, true); + dispatcher->getSystemState()->securityManager->evaluatePoliciesURL(url, true); if(threadAborting) return false; if(evaluationResult == SecurityManager::NA_CROSSDOMAIN_POLICY) { dispatcher->incRef(); - getVm()->addEvent(dispatcher,_MR(Class<SecurityErrorEvent>::getInstanceS("SecurityError: " + getVm(dispatcher->getSystemState())->addEvent(dispatcher,_MR(Class<SecurityErrorEvent>::getInstanceS(dispatcher->getSystemState(),"SecurityError: " "connection to domain not allowed by securityManager"))); return false; } @@ -841,11 +841,11 @@ if(postData.empty()) { //This is a GET request - downloader=getSys()->downloadManager->download(url, cache, owner); + downloader=dispatcher->getSystemState()->downloadManager->download(url, cache, owner); } else { - downloader=getSys()->downloadManager->downloadWithData(url, cache, postData, requestHeaders, owner); + downloader=dispatcher->getSystemState()->downloadManager->downloadWithData(url, cache, postData, requestHeaders, owner); } return true;
View file
lightspark.tar.xz/src/backends/rendering.cpp
Changed
@@ -869,7 +869,7 @@ if(!diff.negative()) /* is one seconds elapsed? */ { time_s=time_d; - LOG(LOG_INFO,_("FPS: ") << dec << frameCount<<" "<<getVm()->getEventQueueSize()); + LOG(LOG_INFO,_("FPS: ") << dec << frameCount<<" "<<getVm(getSys())->getEventQueueSize()); frameCount=0; secsCount++; }
View file
lightspark.tar.xz/src/backends/security.cpp
Changed
@@ -483,17 +483,17 @@ allowedSandboxesLocal, restrictLocalDirectory); //Network sandboxes can't access local files (this should be a SecurityErrorEvent) if(evaluationResult == SecurityManager::NA_REMOTE_SANDBOX) - throw Class<SecurityError>::getInstanceS("SecurityError: " + throw Class<SecurityError>::getInstanceS(getSys(),"SecurityError: " "connect to network"); //Local-with-filesystem sandbox can't access network else if(evaluationResult == SecurityManager::NA_LOCAL_SANDBOX) - throw Class<SecurityError>::getInstanceS("SecurityError: " + throw Class<SecurityError>::getInstanceS(getSys(),"SecurityError: " "connect to local file"); else if(evaluationResult == SecurityManager::NA_PORT) - throw Class<SecurityError>::getInstanceS("SecurityError: " + throw Class<SecurityError>::getInstanceS(getSys(),"SecurityError: " "connect to restricted port"); else if(evaluationResult == SecurityManager::NA_RESTRICT_LOCAL_DIRECTORY) - throw Class<SecurityError>::getInstanceS("SecurityError: " + throw Class<SecurityError>::getInstanceS(getSys(),"SecurityError: " "not allowed to navigate up for local files"); }
View file
lightspark.tar.xz/src/parsing/amf3_generator.cpp
Changed
@@ -47,7 +47,7 @@ uint32_t tmp; if(!input->readU29(tmp)) throw ParseException("Not enough data to parse integer"); - return _MR(abstract_i(tmp)); + return _MR(abstract_i(input->getSystemState(),tmp)); } _R<ASObject> Amf3Deserializer::parseDouble() const @@ -65,7 +65,7 @@ throw ParseException("Not enough data to parse double"); } tmp.dummy=GINT64_FROM_BE(tmp.dummy); - return _MR(abstract_d(tmp.val)); + return _MR(abstract_d(input->getSystemState(),tmp.val)); } _R<ASObject> Amf3Deserializer::parseDate() const @@ -83,7 +83,7 @@ throw ParseException("Not enough data to parse date"); } tmp.dummy=GINT64_FROM_BE(tmp.dummy); - Date* dt = Class<Date>::getInstanceS(); + Date* dt = Class<Date>::getInstanceS(input->getSystemState()); dt->MakeDateFromMilliseconds((int64_t)tmp.val); return _MR(dt); } @@ -135,7 +135,7 @@ return _MR(ret); } - _R<lightspark::Array> ret=_MR(Class<lightspark::Array>::getInstanceS()); + _R<lightspark::Array> ret=_MR(Class<lightspark::Array>::getInstanceS(input->getSystemState())); //Add object to the map objMap.push_back(ret.getPtr()); @@ -186,13 +186,13 @@ switch (marker) { case vector_int_marker: - type = Class<Integer>::getClass(); + type = Class<Integer>::getClass(input->getSystemState()); break; case vector_uint_marker: - type = Class<UInteger>::getClass(); + type = Class<UInteger>::getClass(input->getSystemState()); break; case vector_double_marker: - type = Class<Number>::getClass(); + type = Class<Number>::getClass(input->getSystemState()); break; case vector_object_marker: { @@ -200,14 +200,14 @@ vectypename = parseStringVR(stringMap); multiname m(NULL); m.name_type=multiname::NAME_STRING; - m.name_s_id=getSys()->getUniqueStringId(vectypename); - m.ns.push_back(nsNameAndKind("",NAMESPACE)); + m.name_s_id=input->getSystemState()->getUniqueStringId(vectypename); + m.ns.push_back(nsNameAndKind(input->getSystemState(),"",NAMESPACE)); m.isAttribute = false; - type = Type::getTypeFromMultiname(&m,getVm()->currentCallContext->context); + type = Type::getTypeFromMultiname(&m,getVm(input->getSystemState())->currentCallContext->context); if (type == NULL) { LOG(LOG_ERROR,"unknown vector type during deserialization:"<<m); - type = Class<ASObject>::getClass(); + type = Class<ASObject>::getClass(input->getSystemState()); } break; } @@ -216,7 +216,7 @@ throw ParseException("invalid marker in AMF3 vector"); } - _R<lightspark::Vector> ret=_MR(Template<Vector>::getInstanceS(type,ABCVm::getCurrentApplicationDomain(getVm()->currentCallContext))); + _R<lightspark::Vector> ret=_MR(Template<Vector>::getInstanceS(input->getSystemState(),type,ABCVm::getCurrentApplicationDomain(getVm(input->getSystemState())->currentCallContext))); //Add object to the map objMap.push_back(ret.getPtr()); @@ -232,7 +232,7 @@ uint32_t value = 0; if (!input->readUnsignedInt(value)) throw ParseException("Not enough data to parse AMF3 vector"); - ret->append(abstract_i(value)); + ret->append(abstract_i(input->getSystemState(),value)); break; } case vector_uint_marker: @@ -240,7 +240,7 @@ uint32_t value = 0; if (!input->readUnsignedInt(value)) throw ParseException("Not enough data to parse AMF3 vector"); - ret->append(abstract_ui(value)); + ret->append(abstract_ui(input->getSystemState(),value)); break; } case vector_double_marker: @@ -288,7 +288,7 @@ throw ParseException("Not enough data to parse AMF3 vector"); if (weakkeys) LOG(LOG_NOT_IMPLEMENTED,"handling of weak keys in Dictionary"); - _R<Dictionary> ret=_MR(Class<Dictionary>::getInstanceS()); + _R<Dictionary> ret=_MR(Class<Dictionary>::getInstanceS(input->getSystemState())); //Add object to the map objMap.push_back(ret.getPtr()); @@ -302,7 +302,7 @@ multiname name(NULL); name.name_type=multiname::NAME_OBJECT; name.name_o = key.getPtr(); - name.ns.push_back(nsNameAndKind("",NAMESPACE)); + name.ns.push_back(nsNameAndKind(input->getSystemState(),"",NAMESPACE)); key->incRef(); value->incRef(); ret->setVariableByMultiname(name,value.getPtr(),ASObject::CONST_ALLOWED); @@ -328,7 +328,7 @@ return _MR(ret); } - _R<ByteArray> ret=_MR(Class<ByteArray>::getInstanceS()); + _R<ByteArray> ret=_MR(Class<ByteArray>::getInstanceS(input->getSystemState())); //Add object to the map objMap.push_back(ret.getPtr()); @@ -367,8 +367,8 @@ //Custom serialization const tiny_string& className=parseStringVR(stringMap); assert_and_throw(!className.empty()); - const auto it=getSys()->aliasMap.find(className); - assert_and_throw(it!=getSys()->aliasMap.end()); + const auto it=input->getSystemState()->aliasMap.find(className); + assert_and_throw(it!=input->getSystemState()->aliasMap.end()); Class_base* type=it->second.getPtr(); traitsMap.push_back(TraitsRef(type)); @@ -377,8 +377,8 @@ //Invoke readExternal multiname readExternalName(NULL); readExternalName.name_type=multiname::NAME_STRING; - readExternalName.name_s_id=getSys()->getUniqueStringId("readExternal"); - readExternalName.ns.push_back(nsNameAndKind("",NAMESPACE)); + readExternalName.name_s_id=input->getSystemState()->getUniqueStringId("readExternal"); + readExternalName.ns.push_back(nsNameAndKind(input->getSystemState(),"",NAMESPACE)); readExternalName.isAttribute = false; _NR<ASObject> o=ret->getVariableByMultiname(readExternalName,ASObject::SKIP_IMPL); @@ -408,14 +408,14 @@ for(uint32_t i=0;i<traitsCount;i++) traits.traitsNames.emplace_back(parseStringVR(stringMap)); - const auto it=getSys()->aliasMap.find(className); - if(it!=getSys()->aliasMap.end()) + const auto it=input->getSystemState()->aliasMap.find(className); + if(it!=input->getSystemState()->aliasMap.end()) traits.type=it->second.getPtr(); traitsMap.emplace_back(traits); } _R<ASObject> ret=_MR((traits.type)?traits.type->getInstance(true, NULL, 0): - Class<ASObject>::getInstanceS()); + Class<ASObject>::getInstanceS(input->getSystemState())); //Add object to the map objMap.push_back(ret.getPtr()); @@ -426,8 +426,8 @@ multiname name(NULL); name.name_type=multiname::NAME_STRING; - name.name_s_id=getSys()->getUniqueStringId(traits.traitsNames[i]); - name.ns.push_back(nsNameAndKind("",NAMESPACE)); + name.name_s_id=input->getSystemState()->getUniqueStringId(traits.traitsNames[i]); + name.ns.push_back(nsNameAndKind(input->getSystemState(),"",NAMESPACE)); name.isAttribute=false; ret->setVariableByMultiname(name,value.getPtr(),ASObject::CONST_ALLOWED,traits.type); @@ -474,9 +474,9 @@ ASObject *xmlObj; if(legacyXML) - xmlObj=Class<XMLDocument>::getInstanceS(xmlStr); + xmlObj=Class<XMLDocument>::getInstanceS(input->getSystemState(),xmlStr); else - xmlObj=XML::createFromString(xmlStr); + xmlObj=XML::createFromString(input->getSystemState(),xmlStr); objMap.push_back(xmlObj); return _MR(xmlObj); } @@ -495,13 +495,13 @@ switch(marker) { case null_marker: - return _MR(getSys()->getNullRef()); + return _MR(input->getSystemState()->getNullRef()); case undefined_marker: - return _MR(getSys()->getUndefinedRef()); + return _MR(input->getSystemState()->getUndefinedRef()); case false_marker: - return _MR(abstract_b(false));
View file
lightspark.tar.xz/src/parsing/flv.cpp
Changed
@@ -96,7 +96,7 @@ if (dataSize > 0) { - _R<ByteArray> b = _NR<ByteArray>(Class<ByteArray>::getInstanceS()); + _R<ByteArray> b = _NR<ByteArray>(Class<ByteArray>::getInstanceS(getSys())); uint8_t* data =b->getBuffer(dataSize,true); s.read((char*)data,dataSize); b->setObjectEncoding(ObjectEncoding::AMF0);
View file
lightspark.tar.xz/src/parsing/streams.cpp
Changed
@@ -27,6 +27,9 @@ #include <cstring> #include <assert.h> + +extern lightspark::SystemState* getSys(); + #define LZMA_PROP_LENGTH 5 using namespace std; @@ -206,120 +209,7 @@ return sizeof(buffer) - strm.avail_out; } -memorystream::memorystream(const char* const b, unsigned int l) - : code(b), len(l), pos(0), read_past_end(false) -{ -} - -unsigned int memorystream::tellg() const -{ - return pos; -} - -void memorystream::seekg(unsigned int offset) -{ - if (offset > len) - pos = len; - else - pos = offset; -} - -unsigned int memorystream::size() const -{ - return len; -} - -void memorystream::read(char *out, unsigned int nbytes) -{ - if ((nbytes == 1) && (pos+1 > len)) - { - // fastpath for one bytes reads - *out = code[pos]; - pos++; - } - else if (pos+nbytes > len) - { - memcpy(out, code+pos, len-pos); - pos = len; - read_past_end = true; - } - else - { - memcpy(out, code+pos, nbytes); - pos += nbytes; - } -} -uint8_t memorystream::readbyte() -{ - if (pos < len) - { - pos++; - return code[pos-1]; - } - else - { - pos = len; - read_past_end = true; - return 0; - } -} -bool memorystream::eof() const -{ - return read_past_end; -} - -memorystream& lightspark::operator>>(memorystream& in, lightspark::u8& v) -{ - uint8_t t = in.readbyte(); - v.val= t; - return in; -} - -memorystream& lightspark::operator>>(memorystream& in, lightspark::s24& v) -{ - uint32_t ret=0; - in.read((char*)&ret,3); - v.val=LittleEndianToSignedHost24(ret); - return in; -} - -memorystream& lightspark::operator>>(memorystream& in, lightspark::u30& v) -{ - lightspark::u32 vv; - in >> vv; - uint32_t val = vv; - if(val&0xc0000000) - throw lightspark::Class<lightspark::VerifyError>::getInstanceS("Invalid u30"); - v.val = val; - return in; -} - -memorystream& lightspark::operator>>(memorystream& in, lightspark::u32& v) +void memorystream::handleError(const char* msg) { - int i=0; - uint32_t val=0; - uint8_t t; - do - { - t = in.readbyte(); - //No more than 5 bytes should be read - if(i==28) - { - //Only the first 4 bits should be used to reach 32 bits - if((t&0xf0)) - LOG(LOG_ERROR,"Error in u32"); - uint8_t t2=(t&0xf); - val|=(t2<<i); - break; - } - else - { - uint8_t t2=(t&0x7f); - val|=(t2<<i); - i+=7; - } - } - while(t&0x80); - v.val=val; - return in; + throw lightspark::Class<lightspark::VerifyError>::getInstanceS(lightspark::getSys(),msg); }
View file
lightspark.tar.xz/src/parsing/streams.h
Changed
@@ -102,23 +102,121 @@ unsigned int len; unsigned int pos; bool read_past_end; + lightspark::method_body_info_cache* codecache; public: // Create a stream from a buffer b. // // The buffer is not copied, so b must continue to exists for // the life-time of this memorystream instance. - memorystream(const char* const b, unsigned int l); - unsigned int size() const; - unsigned int tellg() const; - void seekg(unsigned int offset); - void read(char *out, unsigned int nbytes); - uint8_t readbyte(); - bool eof() const; + memorystream(const char* const b, unsigned int l,lightspark::method_body_info_cache* cc): code(b), len(l), pos(0), read_past_end(false),codecache(cc) {}; + static void handleError(const char *msg); + inline unsigned int size() const + { + return len; + } + + inline unsigned int tellg() const + { + return pos; + } + + inline void seekg(unsigned int offset) + { + if (offset > len) + pos = len; + else + pos = offset; + } + + inline void read(char *out, unsigned int nbytes) + { + if (pos+nbytes > len) + { + memcpy(out, code+pos, len-pos); + pos = len; + read_past_end = true; + } + else + { + memcpy(out, code+pos, nbytes); + pos += nbytes; + } + } + + inline uint8_t readbyte() + { + if (pos < len) + { + pos++; + return code[pos-1]; + } + else + { + pos = len; + read_past_end = true; + return 0; + } + } + inline uint32_t readu30() + { + unsigned int currpos = pos; + if (codecache[currpos].iscached) + { + pos = codecache[currpos].nextpos; + if (pos >= len) + { + pos = len; + read_past_end = true; + } + return codecache[currpos].value; + } + uint32_t val = readu32(); + if(val&0xc0000000) + memorystream::handleError("Invalid u30"); + return val; + } + inline uint32_t readu32() + { + unsigned int currpos = pos; + + int i=0; + uint32_t val=0; + uint8_t t; + do + { + t = readbyte(); + //No more than 5 bytes should be read + if(i==28) + { + //Only the first 4 bits should be used to reach 32 bits + if((t&0xf0)) + LOG(LOG_ERROR,"Error in u32"); + val|=((t&0xf)<<i); + break; + } + else + { + val|=((t&0x7f)<<i); + i+=7; + } + } + while(t&0x80); + codecache[currpos].iscached = true; + codecache[currpos].value = val; + codecache[currpos].nextpos = pos; + return val; + } + inline int32_t reads24() + { + uint32_t val=0; + read((char*)&val,3); + return LittleEndianToSignedHost24(val); + } + + inline bool eof() const + { + return read_past_end; + } + }; - -memorystream& lightspark::operator>>(memorystream& in, lightspark::u8& v); -memorystream& lightspark::operator>>(memorystream& in, lightspark::s24& v); -memorystream& lightspark::operator>>(memorystream& in, lightspark::u30& v); -memorystream& lightspark::operator>>(memorystream& in, lightspark::u32& v); - #endif /* PARSING_STREAMS_H */
View file
lightspark.tar.xz/src/parsing/tags.cpp
Changed
@@ -347,7 +347,7 @@ ASObject* DefineEditTextTag::instance(Class_base* c) const { if(c==NULL) - c=Class<TextField>::getClass(); + c=Class<TextField>::getClass(loadedFrom->getSystemState()); //TODO: check assert_and_throw(bindedTo==NULL); TextField* ret=new (c->memoryAccount) TextField(c, textData, !NoSelect, ReadOnly); @@ -437,7 +437,7 @@ else if(bindedTo) retClass=bindedTo; else - retClass=Class<MovieClip>::getClass(); + retClass=Class<MovieClip>::getClass(loadedFrom->getSystemState()); return new (retClass->memoryAccount) MovieClip(retClass, *this, true); } @@ -484,7 +484,7 @@ else if(bindedTo) retClass=bindedTo; else - retClass=Class<ASFont>::getClass(); + retClass=Class<ASFont>::getClass(loadedFrom->getSystemState()); ASFont* ret=new (retClass->memoryAccount) ASFont(retClass); LOG(LOG_NOT_IMPLEMENTED,"DefineFontTag::instance doesn't handle all font properties"); @@ -589,7 +589,7 @@ else if(bindedTo) retClass=bindedTo; else - retClass=Class<ASFont>::getClass(); + retClass=Class<ASFont>::getClass(loadedFrom->getSystemState()); ASFont* ret=new (retClass->memoryAccount) ASFont(retClass); LOG(LOG_NOT_IMPLEMENTED,"DefineFont2Tag::instance doesn't handle all font properties"); @@ -721,7 +721,7 @@ else if(bindedTo) retClass=bindedTo; else - retClass=Class<ASFont>::getClass(); + retClass=Class<ASFont>::getClass(loadedFrom->getSystemState()); ASFont* ret=new (retClass->memoryAccount) ASFont(retClass); LOG(LOG_NOT_IMPLEMENTED,"DefineFont3Tag::instance doesn't handle all font properties"); @@ -807,7 +807,7 @@ else if(bindedTo) retClass=bindedTo; else - retClass=Class<ASFont>::getClass(); + retClass=Class<ASFont>::getClass(loadedFrom->getSystemState()); ASFont* ret=new (retClass->memoryAccount) ASFont(retClass); LOG(LOG_NOT_IMPLEMENTED,"DefineFont4Tag::instance doesn't handle all font properties"); @@ -815,7 +815,7 @@ return ret; } -BitmapTag::BitmapTag(RECORDHEADER h,RootMovieClip* root):DictionaryTag(h,root),bitmap(_MR(new BitmapContainer(getSys()->tagsMemory))) +BitmapTag::BitmapTag(RECORDHEADER h,RootMovieClip* root):DictionaryTag(h,root),bitmap(_MR(new BitmapContainer(root->getSystemState()->tagsMemory))) { } @@ -895,19 +895,19 @@ //Also BitmapData is used in the wild though, so support both cases Class_base* realClass=(c)?c:bindedTo; - Class_base* classRet = Class<BitmapData>::getClass(); + Class_base* classRet = Class<BitmapData>::getClass(loadedFrom->getSystemState()); if(!realClass) return new (classRet->memoryAccount) BitmapData(classRet, bitmap); - if(realClass->isSubClass(Class<Bitmap>::getClass())) + if(realClass->isSubClass(Class<Bitmap>::getClass(realClass->getSystemState()))) { BitmapData* ret=new (classRet->memoryAccount) BitmapData(classRet, bitmap); Bitmap* bitmapRet=new (realClass->memoryAccount) Bitmap(realClass,_MR(ret)); return bitmapRet; } - if(realClass->isSubClass(Class<BitmapData>::getClass())) + if(realClass->isSubClass(Class<BitmapData>::getClass(realClass->getSystemState()))) { classRet = realClass; } @@ -916,7 +916,7 @@ } DefineTextTag::DefineTextTag(RECORDHEADER h, istream& in, RootMovieClip* root,int v):DictionaryTag(h,root), - tokens(reporter_allocator<GeomToken>(getSys()->tagsMemory)),version(v) + tokens(reporter_allocator<GeomToken>(loadedFrom->getSystemState()->tagsMemory)),version(v) { in >> CharacterId >> TextBounds >> TextMatrix >> GlyphBits >> AdvanceBits; assert(v==1 || v==2); @@ -944,7 +944,7 @@ computeCached(); if(c==NULL) - c=Class<StaticText>::getClass(); + c=Class<StaticText>::getClass(loadedFrom->getSystemState()); StaticText* ret=new (c->memoryAccount) StaticText(c, tokens); return ret; @@ -1026,12 +1026,12 @@ } DefineShapeTag::DefineShapeTag(RECORDHEADER h,int v,RootMovieClip* root):DictionaryTag(h,root),Shapes(v), - tokens(reporter_allocator<GeomToken>(getSys()->tagsMemory)) + tokens(reporter_allocator<GeomToken>(root->getSystemState()->tagsMemory)) { } DefineShapeTag::DefineShapeTag(RECORDHEADER h, std::istream& in,RootMovieClip* root):DictionaryTag(h,root),Shapes(1), - tokens(reporter_allocator<GeomToken>(getSys()->tagsMemory)) + tokens(reporter_allocator<GeomToken>(root->getSystemState()->tagsMemory)) { LOG(LOG_TRACE,_("DefineShapeTag")); in >> ShapeId >> ShapeBounds >> Shapes; @@ -1085,9 +1085,9 @@ { assert_and_throw(bindedTo==NULL); if(c==NULL) - c=Class<MorphShape>::getClass(); + c=Class<MorphShape>::getClass(loadedFrom->getSystemState()); LOG(LOG_NOT_IMPLEMENTED, _("MorphShape not really supported")); - return Class<MorphShape>::getInstanceS(c); + return Class<MorphShape>::getInstanceS(c->getSystemState(),c); } DefineMorphShape2Tag::DefineMorphShape2Tag(RECORDHEADER h, std::istream& in, RootMovieClip* root):DefineMorphShapeTag(h, root, 2) @@ -1512,7 +1512,7 @@ { if(!isSprite[j]) { - Sprite* spr = Class<Sprite>::getInstanceS(); + Sprite* spr = Class<Sprite>::getInstanceS(loadedFrom->getSystemState()); spr->insertLegacyChildAt(curDepth[j],states[j]); states[j] = spr; //spr->name = "Button_spr"; @@ -1526,7 +1526,7 @@ Class_base* realClass=(c)?c:bindedTo; if(realClass==NULL) - realClass=Class<SimpleButton>::getClass(); + realClass=Class<SimpleButton>::getClass(loadedFrom->getSystemState()); SimpleButton* ret=new (realClass->memoryAccount) SimpleButton(realClass, states[0], states[1], states[2], states[3]); return ret; } @@ -1550,7 +1550,7 @@ else if(bindedTo) classRet=bindedTo; else - classRet=Class<Video>::getClass(); + classRet=Class<Video>::getClass(loadedFrom->getSystemState()); Video* ret=new (classRet->memoryAccount) Video(classRet, Width, Height); return ret; @@ -1578,7 +1578,7 @@ else if(bindedTo) classRet=bindedTo; else - classRet=Class<ByteArray>::getClass(); + classRet=Class<ByteArray>::getClass(loadedFrom->getSystemState()); ByteArray* ret=new (classRet->memoryAccount) ByteArray(classRet, b, len); return ret; @@ -1625,7 +1625,7 @@ else if(bindedTo) retClass=bindedTo; else - retClass=Class<Sound>::getClass(); + retClass=Class<Sound>::getClass(loadedFrom->getSystemState()); return new (retClass->memoryAccount) Sound(retClass, SoundData, AudioFormat(getAudioCodec(), getSampleRate(), getChannels())); @@ -1694,7 +1694,7 @@ void StartSoundTag::play(const DefineSoundTag *soundTag) const { - SoundChannel *schannel = Class<SoundChannel>::getInstanceS( + SoundChannel *schannel = Class<SoundChannel>::getInstanceS(soundTag->loadedFrom->getSystemState(), soundTag->getSoundData(), AudioFormat(soundTag->getAudioCodec(), soundTag->getSampleRate(),
View file
lightspark.tar.xz/src/parsing/tags.h
Changed
@@ -121,7 +121,7 @@ ASObject* instance(Class_base* c=NULL) const { if(c==NULL) - c=Class<Shape>::getClass(); + c=Class<Shape>::getClass(loadedFrom->getSystemState()); Shape* ret=new (c->memoryAccount) Shape(c, tokens, 1.0f/20.0f); return ret; }
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -29,6 +29,7 @@ #include <llvm/PassManager.h> #else #include "llvm/IR/LegacyPassManager.h" +#include "llvm/ExecutionEngine/MCJIT.h" #endif #ifdef HAVE_IR_DATALAYOUT_H # include <llvm/IR/Module.h> @@ -142,7 +143,7 @@ RootMovieClip* root=getParseThread()->getRootMovie(); root->incRef(); - context=new ABCContext(_MR(root), in, getVm()); + context=new ABCContext(_MR(root), in, getVm(root->getSystemState())); int pos=in.tellg(); if(dest!=pos) @@ -152,11 +153,11 @@ } } -void DoABCTag::execute(RootMovieClip*) const +void DoABCTag::execute(RootMovieClip* root) const { LOG(LOG_CALLS,_("ABC Exec")); /* currentVM will free the context*/ - getVm()->addEvent(NullRef,_MR(new (getSys()->unaccountedMemory) ABCContextInitEvent(context,false))); + getVm(root->getSystemState())->addEvent(NullRef,_MR(new (root->getSystemState()->unaccountedMemory) ABCContextInitEvent(context,false))); } DoABCDefineTag::DoABCDefineTag(RECORDHEADER h, std::istream& in):ControlTag(h) @@ -168,7 +169,7 @@ RootMovieClip* root=getParseThread()->getRootMovie(); root->incRef(); - context=new ABCContext(_MR(root), in, getVm()); + context=new ABCContext(_MR(root), in, getVm(root->getSystemState())); int pos=in.tellg(); if(dest!=pos) @@ -178,11 +179,11 @@ } } -void DoABCDefineTag::execute(RootMovieClip*) const +void DoABCDefineTag::execute(RootMovieClip* root) const { LOG(LOG_CALLS,_("ABC Exec ") << Name); /* currentVM will free the context*/ - getVm()->addEvent(NullRef,_MR(new (getSys()->unaccountedMemory) ABCContextInitEvent(context,((int32_t)Flags)&1))); + getVm(root->getSystemState())->addEvent(NullRef,_MR(new (root->getSystemState()->unaccountedMemory) ABCContextInitEvent(context,((int32_t)Flags)&1))); } SymbolClassTag::SymbolClassTag(RECORDHEADER h, istream& in):ControlTag(h) @@ -208,7 +209,7 @@ if(Tags[i]==0) { root->incRef(); - getVm()->addEvent(NullRef, _MR(new (getSys()->unaccountedMemory) BindClassEvent(_MR(root),className))); + getVm(root->getSystemState())->addEvent(NullRef, _MR(new (root->getSystemState()->unaccountedMemory) BindClassEvent(_MR(root),className))); } else @@ -220,377 +221,347 @@ void ScriptLimitsTag::execute(RootMovieClip* root) const { - getVm()->limits.max_recursion = MaxRecursionDepth; - getVm()->limits.script_timeout = ScriptTimeoutSeconds; + getVm(root->getSystemState())->limits.max_recursion = MaxRecursionDepth; + getVm(root->getSystemState())->limits.script_timeout = ScriptTimeoutSeconds; } void ABCVm::registerClasses() { - Global* builtin=Class<Global>::getInstanceS((ABCContext*)NULL, 0); + Global* builtin=Class<Global>::getInstanceS(m_sys,(ABCContext*)NULL, 0); //Register predefined types, ASObject are enough for not implemented classes - builtin->registerBuiltin("Object","",Class<ASObject>::getRef()); - builtin->registerBuiltin("Class","",Class_object::getRef()); - builtin->registerBuiltin("Number","",Class<Number>::getRef()); - builtin->registerBuiltin("Boolean","",Class<Boolean>::getRef()); - builtin->registerBuiltin("NaN","",_MR(abstract_d(numeric_limits<double>::quiet_NaN()))); - builtin->registerBuiltin("Infinity","",_MR(abstract_d(numeric_limits<double>::infinity()))); - builtin->registerBuiltin("String","",Class<ASString>::getRef()); - builtin->registerBuiltin("Array","",Class<Array>::getRef()); - builtin->registerBuiltin("Function","",Class<IFunction>::getRef()); - builtin->registerBuiltin("undefined","",_MR(getSys()->getUndefinedRef())); - builtin->registerBuiltin("Math","",Class<Math>::getRef()); - builtin->registerBuiltin("Namespace","",Class<Namespace>::getRef()); - builtin->registerBuiltin("AS3","",_MR(Class<Namespace>::getInstanceS(AS3))); - builtin->registerBuiltin("Date","",Class<Date>::getRef()); - builtin->registerBuiltin("JSON","",Class<JSON>::getRef()); - builtin->registerBuiltin("RegExp","",Class<RegExp>::getRef()); - builtin->registerBuiltin("QName","",Class<ASQName>::getRef()); - builtin->registerBuiltin("uint","",Class<UInteger>::getRef()); - builtin->registerBuiltin("Vector","__AS3__.vec",_MR(Template<Vector>::getTemplate())); - builtin->registerBuiltin("Error","",Class<ASError>::getRef()); - builtin->registerBuiltin("SecurityError","",Class<SecurityError>::getRef()); - builtin->registerBuiltin("ArgumentError","",Class<ArgumentError>::getRef()); - builtin->registerBuiltin("DefinitionError","",Class<DefinitionError>::getRef()); - builtin->registerBuiltin("EvalError","",Class<EvalError>::getRef()); - builtin->registerBuiltin("RangeError","",Class<RangeError>::getRef()); - builtin->registerBuiltin("ReferenceError","",Class<ReferenceError>::getRef()); - builtin->registerBuiltin("SyntaxError","",Class<SyntaxError>::getRef()); - builtin->registerBuiltin("TypeError","",Class<TypeError>::getRef()); - builtin->registerBuiltin("URIError","",Class<URIError>::getRef()); - builtin->registerBuiltin("UninitializedError","",Class<UninitializedError>::getRef()); - builtin->registerBuiltin("VerifyError","",Class<VerifyError>::getRef()); - builtin->registerBuiltin("XML","",Class<XML>::getRef()); - builtin->registerBuiltin("XMLList","",Class<XMLList>::getRef()); - builtin->registerBuiltin("int","",Class<Integer>::getRef()); - - builtin->registerBuiltin("eval","",_MR(Class<IFunction>::getFunction(eval))); - builtin->registerBuiltin("print","",_MR(Class<IFunction>::getFunction(print))); - builtin->registerBuiltin("trace","",_MR(Class<IFunction>::getFunction(trace))); - builtin->registerBuiltin("parseInt","",_MR(Class<IFunction>::getFunction(parseInt,2))); - builtin->registerBuiltin("parseFloat","",_MR(Class<IFunction>::getFunction(parseFloat,1))); - builtin->registerBuiltin("encodeURI","",_MR(Class<IFunction>::getFunction(encodeURI))); - builtin->registerBuiltin("decodeURI","",_MR(Class<IFunction>::getFunction(decodeURI))); - builtin->registerBuiltin("encodeURIComponent","",_MR(Class<IFunction>::getFunction(encodeURIComponent))); - builtin->registerBuiltin("decodeURIComponent","",_MR(Class<IFunction>::getFunction(decodeURIComponent))); - builtin->registerBuiltin("escape","",_MR(Class<IFunction>::getFunction(escape,1))); - builtin->registerBuiltin("unescape","",_MR(Class<IFunction>::getFunction(unescape,1))); - builtin->registerBuiltin("toString","",_MR(Class<IFunction>::getFunction(ASObject::_toString))); - - builtin->registerBuiltin("AccessibilityProperties","flash.accessibility",Class<AccessibilityProperties>::getRef()); - builtin->registerBuiltin("AccessibilityImplementation","flash.accessibility",Class<AccessibilityImplementation>::getRef()); - builtin->registerBuiltin("Accessibility","flash.accessibility",Class<Accessibility>::getRef()); - - builtin->registerBuiltin("Mutex","flash.concurrent",Class<ASMutex>::getRef()); - builtin->registerBuiltin("Condition","flash.concurrent",Class<ASCondition>::getRef()); - - builtin->registerBuiltin("MovieClip","flash.display",Class<MovieClip>::getRef()); - builtin->registerBuiltin("DisplayObject","flash.display",Class<DisplayObject>::getRef()); - builtin->registerBuiltin("Loader","flash.display",Class<Loader>::getRef()); - builtin->registerBuiltin("LoaderInfo","flash.display",Class<LoaderInfo>::getRef()); - builtin->registerBuiltin("SimpleButton","flash.display",Class<SimpleButton>::getRef()); - builtin->registerBuiltin("InteractiveObject","flash.display",Class<InteractiveObject>::getRef()); - builtin->registerBuiltin("DisplayObjectContainer","flash.display",Class<DisplayObjectContainer>::getRef()); - builtin->registerBuiltin("Sprite","flash.display",Class<Sprite>::getRef()); - builtin->registerBuiltin("Shape","flash.display",Class<Shape>::getRef()); - builtin->registerBuiltin("Stage","flash.display",Class<Stage>::getRef()); - builtin->registerBuiltin("Graphics","flash.display",Class<Graphics>::getRef()); - builtin->registerBuiltin("GraphicsBitmapFill","flash.display",Class<GraphicsBitmapFill>::getRef()); - builtin->registerBuiltin("GraphicsEndFill","flash.display",Class<GraphicsEndFill>::getRef()); - builtin->registerBuiltin("GraphicsGradientFill","flash.display",Class<GraphicsGradientFill>::getRef()); - builtin->registerBuiltin("GraphicsPath","flash.display",Class<GraphicsPath>::getRef()); - builtin->registerBuiltin("GraphicsPathCommand","flash.display",Class<GraphicsPathCommand>::getRef()); - builtin->registerBuiltin("GraphicsPathWinding","flash.display",Class<GraphicsPathWinding>::getRef()); - builtin->registerBuiltin("GraphicsShaderFill","flash.display",Class<GraphicsShaderFill>::getRef()); - builtin->registerBuiltin("GraphicsSolidFill","flash.display",Class<GraphicsSolidFill>::getRef()); - builtin->registerBuiltin("GraphicsStroke","flash.display",Class<GraphicsStroke>::getRef()); - builtin->registerBuiltin("GraphicsTrianglePath","flash.display",Class<GraphicsTrianglePath>::getRef()); - builtin->registerBuiltin("IGraphicsData","flash.display",InterfaceClass<IGraphicsData>::getRef()); - builtin->registerBuiltin("IGraphicsFill","flash.display",InterfaceClass<IGraphicsFill>::getRef()); - builtin->registerBuiltin("IGraphicsPath","flash.display",InterfaceClass<IGraphicsPath>::getRef()); - builtin->registerBuiltin("IGraphicsStroke","flash.display",InterfaceClass<IGraphicsStroke>::getRef()); - builtin->registerBuiltin("GradientType","flash.display",Class<GradientType>::getRef()); - builtin->registerBuiltin("BlendMode","flash.display",Class<BlendMode>::getRef()); - builtin->registerBuiltin("LineScaleMode","flash.display",Class<LineScaleMode>::getRef()); - builtin->registerBuiltin("StageScaleMode","flash.display",Class<StageScaleMode>::getRef()); - builtin->registerBuiltin("StageAlign","flash.display",Class<StageAlign>::getRef()); - builtin->registerBuiltin("StageQuality","flash.display",Class<StageQuality>::getRef()); - builtin->registerBuiltin("StageDisplayState","flash.display",Class<StageDisplayState>::getRef()); - builtin->registerBuiltin("BitmapData","flash.display",Class<BitmapData>::getRef()); - builtin->registerBuiltin("Bitmap","flash.display",Class<Bitmap>::getRef()); - builtin->registerBuiltin("IBitmapDrawable","flash.display",InterfaceClass<IBitmapDrawable>::getRef()); - builtin->registerBuiltin("MorphShape","flash.display",Class<MorphShape>::getRef()); - builtin->registerBuiltin("SpreadMethod","flash.display",Class<SpreadMethod>::getRef()); - builtin->registerBuiltin("InterpolationMethod","flash.display",Class<InterpolationMethod>::getRef()); - builtin->registerBuiltin("FrameLabel","flash.display",Class<FrameLabel>::getRef()); - builtin->registerBuiltin("Scene","flash.display",Class<Scene>::getRef()); - builtin->registerBuiltin("AVM1Movie","flash.display",Class<AVM1Movie>::getRef()); - builtin->registerBuiltin("Shader","flash.display",Class<Shader>::getRef()); - builtin->registerBuiltin("BitmapDataChannel","flash.display",Class<BitmapDataChannel>::getRef()); - builtin->registerBuiltin("PixelSnapping","flash.display",Class<PixelSnapping>::getRef()); - - builtin->registerBuiltin("BitmapFilter","flash.filters",Class<BitmapFilter>::getRef()); - 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<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()); - builtin->registerBuiltin("FontStyle","flash.text",Class<FontStyle>::getRef()); - builtin->registerBuiltin("FontType","flash.text",Class<FontType>::getRef()); - builtin->registerBuiltin("GridFitType","flash.text",Class<GridFitType>::getRef()); - builtin->registerBuiltin("StyleSheet","flash.text",Class<StyleSheet>::getRef()); - builtin->registerBuiltin("TextColorType","flash.text",Class<TextColorType>::getRef()); - builtin->registerBuiltin("TextDisplayMode","flash.text",Class<TextDisplayMode>::getRef()); - builtin->registerBuiltin("TextField","flash.text",Class<TextField>::getRef());
View file
lightspark.tar.xz/src/scripting/abc.h
Changed
@@ -103,7 +103,7 @@ SyntheticFunction::synt_function f; ABCContext* context; method_body_info* body; - SyntheticFunction::synt_function synt_method(); + SyntheticFunction::synt_function synt_method(SystemState* sys); bool needsArgs() { return info.needsArgs(); } bool needsActivation() { return info.needsActivation(); } bool needsRest() { return info.needsRest(); } @@ -204,7 +204,38 @@ void linkTrait(Class_base* obj, const traits_info* t); void getOptionalConstant(const option_detail& opt); - int getMultinameRTData(int n) const; + + /* This function determines how many stack values are needed for + * resolving the multiname at index mi + */ + inline int getMultinameRTData(int mi) const + { + if(mi==0) + return 0; + + const multiname_info* m=&constant_pool.multinames[mi]; + switch(m->kind) + { + case 0x07: //QName + case 0x0d: //QNameA + case 0x09: //Multiname + case 0x0e: //MultinameA + case 0x1d: //Templated name + return 0; + case 0x0f: //RTQName + case 0x10: //RTQNameA + case 0x1b: //MultinameL + case 0x1c: //MultinameLA + return 1; + case 0x11: //RTQNameL + case 0x12: //RTQNameLA + return 2; + default: + LOG(LOG_ERROR,_("getMultinameRTData not yet implemented for this kind ") << m->kind); + throw UnsupportedException("kind not implemented for getMultinameRTData"); + } + } + multiname* getMultiname(unsigned int m, call_context* th); multiname* getMultinameImpl(ASObject* rt1, ASObject* rt2, unsigned int m); void buildInstanceTraits(ASObject* obj, int class_index); @@ -248,7 +279,7 @@ arg1->decRef(); _R<ApplicationDomain> appDomain = getCurrentApplicationDomain(th); T ret=appDomain->readFromDomainMemory<T>(addr); - th->runtime_stack_push(abstract_i(ret)); + th->runtime_stack_push(abstract_i(arg1->getSystemState(),ret)); } template<class T> static void storeIntN(call_context* th) @@ -269,7 +300,7 @@ arg1->decRef(); _R<ApplicationDomain> appDomain = getCurrentApplicationDomain(th); number_t ret=appDomain->readFromDomainMemory<float>(addr); - th->runtime_stack_push(abstract_d(ret)); + th->runtime_stack_push(abstract_d(arg1->getSystemState(),ret)); } static void loadDouble(call_context* th) @@ -279,7 +310,7 @@ arg1->decRef(); _R<ApplicationDomain> appDomain = getCurrentApplicationDomain(th); number_t ret=appDomain->readFromDomainMemory<double>(addr); - th->runtime_stack_push(abstract_d(ret)); + th->runtime_stack_push(abstract_d(arg1->getSystemState(),ret)); } static void storeFloat(call_context* th) { @@ -597,9 +628,9 @@ ASObject* undefinedFunction(ASObject* obj,ASObject* const* args, const unsigned int argslen); -inline ABCVm* getVm() +inline ABCVm* getVm(SystemState* sys) { - return getSys()->currentVm; + return sys->currentVm; } std::istream& operator>>(std::istream& in, method_info& v);
View file
lightspark.tar.xz/src/scripting/abc_codesynt.cpp
Changed
@@ -226,10 +226,10 @@ {"add_od",(void*)&ABCVm::add_od,ARGS_OBJ_NUMBER}, {"nextName",(void*)&ABCVm::nextName,ARGS_OBJ_OBJ}, {"nextValue",(void*)&ABCVm::nextValue,ARGS_OBJ_OBJ}, - {"abstract_d",(void*)&abstract_d,ARGS_NUMBER}, - {"abstract_i",(void*)&abstract_i,ARGS_INT}, - {"abstract_ui",(void*)&abstract_ui,ARGS_INT}, - {"abstract_b",(void*)&abstract_b,ARGS_BOOL}, +// {"abstract_d",(void*)&abstract_d,ARGS_OBJ_NUMBER}, +// {"abstract_i",(void*)&abstract_i,ARGS_OBJ_INT}, +// {"abstract_ui",(void*)&abstract_ui,ARGS_OBJ_INT}, +// {"abstract_b",(void*)&abstract_b,ARGS_BOOL}, {"pushNaN",(void*)&ABCVm::pushNaN,ARGS_NONE}, {"pushNull",(void*)&ABCVm::pushNull,ARGS_NONE}, {"pushUndefined",(void*)&ABCVm::pushUndefined,ARGS_NONE}, @@ -300,13 +300,13 @@ ptr_type=ex->getTargetData()->getIntPtrType(llvm_context()); #endif //Pointer to 8 bit type, needed for pointer arithmetic - voidptr_type=llvm::IntegerType::get(getVm()->llvm_context(),8)->getPointerTo(); + voidptr_type=llvm::IntegerType::get(llvm_context(),8)->getPointerTo(); number_type=llvm::Type::getDoubleTy(llvm_context()); numberptr_type=llvm::Type::getDoublePtrTy(llvm_context()); bool_type=llvm::IntegerType::get(llvm_context(),1); boolptr_type=bool_type->getPointerTo(); void_type=llvm::Type::getVoidTy(llvm_context()); - int_type=llvm::IntegerType::get(getVm()->llvm_context(),32); + int_type=llvm::IntegerType::get(llvm_context(),32); intptr_type=int_type->getPointerTo(); //All the opcodes needs a pointer to the context @@ -575,7 +575,7 @@ { //decrement stack index llvm::Value* index=builder.CreateLoad(dynamic_stack_index); - llvm::Constant* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm()->llvm_context(),32), 1); + llvm::Constant* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm(getSys())->llvm_context(),32), 1); llvm::Value* index2=builder.CreateSub(index,constant); builder.CreateStore(index2,dynamic_stack_index); @@ -586,7 +586,7 @@ static llvm::Value* llvm_stack_peek(llvm::IRBuilder<>& builder,llvm::Value* dynamic_stack,llvm::Value* dynamic_stack_index) { llvm::Value* index=builder.CreateLoad(dynamic_stack_index); - llvm::Constant* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm()->llvm_context(),32), 1); + llvm::Constant* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm(getSys())->llvm_context(),32), 1); llvm::Value* index2=builder.CreateSub(index,constant); llvm::Value* dest=builder.CreateGEP(dynamic_stack,index2); return builder.CreateLoad(dest); @@ -600,7 +600,7 @@ builder.CreateStore(val,dest); //increment stack index - llvm::Constant* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm()->llvm_context(),32), 1); + llvm::Constant* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm(getSys())->llvm_context(),32), 1); llvm::Value* index2=builder.CreateAdd(index,constant); builder.CreateStore(index2,dynamic_stack_index); } @@ -714,7 +714,7 @@ //dest_block does not expect us to transfer locals, //so just write them to call_context->locals, overwriting (and decRef'ing) the old contents of call_context->locals assert(dest_block.locals_start[i] == STACK_NONE); - llvm::Value* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm()->llvm_context(),32), i); + llvm::Value* constant = llvm::ConstantInt::get(llvm::IntegerType::get(getVm(getSys())->llvm_context(),32), i); llvm::Value* t=builder.CreateGEP(locals,constant); llvm::Value* old=builder.CreateLoad(t); if(static_locals[i].second==STACK_OBJECT) @@ -878,7 +878,7 @@ block_info::block_info(const method_info* mi, const char* blockName) { - BB=llvm::BasicBlock::Create(getVm()->llvm_context(), blockName, mi->llvmf); + BB=llvm::BasicBlock::Create(getVm(getSys())->llvm_context(), blockName, mi->llvmf); locals_start.resize(mi->body->local_count,STACK_NONE); locals_reset.resize(mi->body->local_count,false); locals_used.resize(mi->body->local_count,false); @@ -1852,7 +1852,7 @@ } } -SyntheticFunction::synt_function method_info::synt_method() +SyntheticFunction::synt_function method_info::synt_method(SystemState* sys) { if(f) return f; @@ -1864,10 +1864,10 @@ LOG(LOG_CALLS,_("Method ") << method_name << _(" should be intrinsic"));; return NULL; } - llvm::ExecutionEngine* ex=getVm()->ex; - llvm::LLVMContext& llvm_context=getVm()->llvm_context(); + llvm::ExecutionEngine* ex=getVm(sys)->ex; + llvm::LLVMContext& llvm_context=getVm(sys)->llvm_context(); llvm::FunctionType* method_type=synt_method_prototype(ex); - llvmf=llvm::Function::Create(method_type,llvm::Function::ExternalLinkage,method_name,getVm()->module); + llvmf=llvm::Function::Create(method_type,llvm::Function::ExternalLinkage,method_name,getVm(sys)->module); llvm::BasicBlock *BB = llvm::BasicBlock::Create(llvm_context,"entry", llvmf); llvm::IRBuilder<> Builder(llvm_context); @@ -1949,7 +1949,7 @@ for(unsigned i=0;i<paramTypes.size();++i) { - if(paramTypes[i] == Class<Number>::getClass()) + if(paramTypes[i] == Class<Number>::getClass(sys)) { /* yield t = locals[i+1] */ LOAD_LOCALPTR @@ -1961,7 +1961,7 @@ blocks[0].locals_start_obj[i+1] = t; LOG(LOG_TRACE,"found STACK_NUMBER parameter for local " << i+1); } - else if(paramTypes[i] == Class<Integer>::getClass()) + else if(paramTypes[i] == Class<Integer>::getClass(sys)) { /* yield t = locals[i+1] */ LOAD_LOCALPTR @@ -1972,7 +1972,7 @@ //locals_start_obj should hold the pointer to the local's value blocks[0].locals_start_obj[i+1] = t; } - else if(paramTypes[i] == Class<UInteger>::getClass()) + else if(paramTypes[i] == Class<UInteger>::getClass(sys)) { /* yield t = locals[i+1] */ LOAD_LOCALPTR @@ -1983,7 +1983,7 @@ //locals_start_obj should hold the pointer to the local's value blocks[0].locals_start_obj[i+1] = t; } - else if(paramTypes[i] == Class<Boolean>::getClass()) + else if(paramTypes[i] == Class<Boolean>::getClass(sys)) { /* yield t = locals[i+1] */ LOAD_LOCALPTR @@ -4656,7 +4656,7 @@ Builder.CreateCall(ex->FindFunctionNamed("not_impl"), constant); Builder.CreateRetVoid(); - f=(SyntheticFunction::synt_function)getVm()->ex->getPointerToFunction(llvmf); + f=(SyntheticFunction::synt_function)getVm(sys)->ex->getPointerToFunction(llvmf); return f; } } @@ -4672,8 +4672,8 @@ } //llvmf->dump(); //dump before optimization - getVm()->FPM->run(*llvmf); - f=(SyntheticFunction::synt_function)getVm()->ex->getPointerToFunction(llvmf); + getVm(sys)->FPM->run(*llvmf); + f=(SyntheticFunction::synt_function)getVm(sys)->ex->getPointerToFunction(llvmf); //llvmf->dump(); //dump after optimization body->codeStatus = method_body_info::JITTED; return f;
View file
lightspark.tar.xz/src/scripting/abc_fast_interpreter.cpp
Changed
@@ -128,7 +128,7 @@ instructionPointer+=4; assert_and_throw(context->locals[t]); context->locals[t]->decRef(); - context->locals[t]=getSys()->getUndefinedRef(); + context->locals[t]=function->getSystemState()->getUndefinedRef(); break; } case 0x0c: @@ -424,7 +424,7 @@ //pushbyte int8_t t=code[instructionPointer]; instructionPointer++; - context->runtime_stack_push(abstract_i(t)); + context->runtime_stack_push(abstract_i(function->getSystemState(),t)); pushByte(t); break; } @@ -435,20 +435,20 @@ // see https://bugs.adobe.com/jira/browse/ASC-4181 uint32_t t=data->uints[0]; instructionPointer+=4; - context->runtime_stack_push(abstract_i(t)); + context->runtime_stack_push(abstract_i(function->getSystemState(),t)); pushShort(t); break; } case 0x26: { //pushtrue - context->runtime_stack_push(abstract_b(pushTrue())); + context->runtime_stack_push(abstract_b(function->getSystemState(),pushTrue())); break; } case 0x27: { //pushfalse - context->runtime_stack_push(abstract_b(pushFalse())); + context->runtime_stack_push(abstract_b(function->getSystemState(),pushFalse())); break; } case 0x28: @@ -499,7 +499,7 @@ int32_t t=data->ints[0]; instructionPointer+=4; pushInt(context, t); - ASObject* i=abstract_i(t); + ASObject* i=abstract_i(function->getSystemState(),t); context->runtime_stack_push(i); break; } @@ -510,7 +510,7 @@ instructionPointer+=4; pushUInt(context, t); - ASObject* i=abstract_ui(t); + ASObject* i=abstract_ui(function->getSystemState(),t); context->runtime_stack_push(i); break; } @@ -521,7 +521,7 @@ instructionPointer+=8; pushDouble(context, t); - ASObject* d=abstract_d(t); + ASObject* d=abstract_d(function->getSystemState(),t); context->runtime_stack_push(d); break; } @@ -546,7 +546,7 @@ instructionPointer+=8; bool ret=hasNext2(context,t,t2); - context->runtime_stack_push(abstract_b(ret)); + context->runtime_stack_push(abstract_b(function->getSystemState(),ret)); break; } //Alchemy opcodes @@ -761,7 +761,7 @@ ASObject* arg1=context->runtime_stack_pop(); int32_t ret=arg1->toUInt() & 0x1; arg1->decRef(); - context->runtime_stack_push(abstract_i(ret)); + context->runtime_stack_push(abstract_i(function->getSystemState(),ret)); break; } case 0x51: @@ -771,7 +771,7 @@ ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int8_t)arg1->toUInt(); arg1->decRef(); - context->runtime_stack_push(abstract_i(ret)); + context->runtime_stack_push(abstract_i(function->getSystemState(),ret)); break; } case 0x52: @@ -781,7 +781,7 @@ ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int16_t)arg1->toUInt(); arg1->decRef(); - context->runtime_stack_push(abstract_i(ret)); + context->runtime_stack_push(abstract_i(function->getSystemState(),ret)); break; } case 0x53: @@ -859,7 +859,7 @@ instructionPointer+=4; multiname* name=context->context->getMultiname(t,context); LOG(LOG_NOT_IMPLEMENTED,"opcode 0x5f (finddef) not implemented:"<< *name); - context->runtime_stack_push(getSys()->getNullRef()); + context->runtime_stack_push(function->getSystemState()->getNullRef()); name->resetNameIfObject(); break; } @@ -894,7 +894,7 @@ if (!context->locals[i]) { LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined"); - context->runtime_stack_push(getSys()->getUndefinedRef()); + context->runtime_stack_push(function->getSystemState()->getUndefinedRef()); break; } context->locals[i]->incRef(); @@ -968,7 +968,7 @@ ASObject* obj=context->runtime_stack_pop(); bool ret = deleteProperty(obj,name); name->resetNameIfObject(); - context->runtime_stack_push(abstract_b(ret)); + context->runtime_stack_push(abstract_b(function->getSystemState(),ret)); break; } case 0x6c: @@ -1039,7 +1039,7 @@ if (val->is<Integer>()) context->runtime_stack_push(val); else - context->runtime_stack_push(abstract_i(convert_i(val))); + context->runtime_stack_push(abstract_i(function->getSystemState(),convert_i(val))); break; } case 0x74: @@ -1049,7 +1049,7 @@ if (val->is<UInteger>()) context->runtime_stack_push(val); else - context->runtime_stack_push(abstract_ui(convert_u(val))); + context->runtime_stack_push(abstract_ui(function->getSystemState(),convert_u(val))); break; } case 0x75: @@ -1059,7 +1059,7 @@ if (val->is<Number>()) context->runtime_stack_push(val); else - context->runtime_stack_push(abstract_d(convert_d(val))); + context->runtime_stack_push(abstract_d(function->getSystemState(),convert_d(val))); break; } case 0x76: @@ -1069,7 +1069,7 @@ if (val->is<Boolean>()) context->runtime_stack_push(val); else - context->runtime_stack_push(abstract_b(convert_b(val))); + context->runtime_stack_push(abstract_b(function->getSystemState(),convert_b(val))); break; } case 0x77: @@ -1160,7 +1160,7 @@ { //negate ASObject* val=context->runtime_stack_pop(); - ASObject* ret=abstract_d(negate(val)); + ASObject* ret=abstract_d(function->getSystemState(),negate(val)); context->runtime_stack_push(ret); break; } @@ -1168,7 +1168,7 @@ { //increment ASObject* val=context->runtime_stack_pop(); - ASObject* ret=abstract_d(increment(val)); + ASObject* ret=abstract_d(function->getSystemState(),increment(val)); context->runtime_stack_push(ret); break; } @@ -1184,7 +1184,7 @@ { //decrement ASObject* val=context->runtime_stack_pop(); - ASObject* ret=abstract_d(decrement(val)); + ASObject* ret=abstract_d(function->getSystemState(),decrement(val)); context->runtime_stack_push(ret); break; } @@ -1208,7 +1208,7 @@ { //not ASObject* val=context->runtime_stack_pop(); - ASObject* ret=abstract_b(_not(val));
View file
lightspark.tar.xz/src/scripting/abc_interpreter.cpp
Changed
@@ -41,7 +41,7 @@ method_info* mi=function->mi; const int code_len=mi->body->code.size(); - memorystream code(mi->body->code.data(), code_len); + memorystream code(mi->body->code.data(), code_len,mi->body->codecache); //This may be non-zero and point to the position of an exception handler code.seekg(context->exec_pos); @@ -65,7 +65,7 @@ #ifdef PROFILING_SUPPORT uint32_t instructionPointer=code.tellg(); #endif - code >> opcode; + opcode = code.readbyte(); if(code.eof()) throw ParseException("End of code in interpreter"); @@ -93,24 +93,21 @@ case 0x04: { //getsuper - u30 t; - code >> t; + uint32_t t = code.readu30(); getSuper(context,t); break; } case 0x05: { //setsuper - u30 t; - code >> t; + uint32_t t = code.readu30(); setSuper(context,t); break; } case 0x06: { //dxns - u30 t; - code >> t; + uint32_t t = code.readu30(); dxns(context,t); break; } @@ -124,12 +121,11 @@ case 0x08: { //kill - u30 t; - code >> t; + uint32_t t = code.readu30(); LOG(LOG_CALLS, "kill " << t); assert_and_throw(context->locals[t]); context->locals[t]->decRef(); - context->locals[t]=getSys()->getUndefinedRef(); + context->locals[t]=function->getSystemState()->getUndefinedRef(); break; } case 0x09: @@ -140,8 +136,7 @@ case 0x0c: { //ifnlt - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); bool cond=ifNLT(v1, v2); @@ -160,8 +155,7 @@ case 0x0d: { //ifnle - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); bool cond=ifNLE(v1, v2); @@ -180,8 +174,7 @@ case 0x0e: { //ifngt - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); bool cond=ifNGT(v1, v2); @@ -200,8 +193,7 @@ case 0x0f: { //ifnge - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); bool cond=ifNGE(v1, v2); @@ -220,8 +212,7 @@ case 0x10: { //jump - s24 t; - code >> t; + int32_t t = code.reads24(); int here=code.tellg(); int dest=here+t; @@ -235,8 +226,7 @@ case 0x11: { //iftrue - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); bool cond=ifTrue(v1); @@ -255,8 +245,7 @@ case 0x12: { //iffalse - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); bool cond=ifFalse(v1); @@ -275,8 +264,7 @@ case 0x13: { //ifeq - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); @@ -296,8 +284,7 @@ case 0x14: { //ifne - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); @@ -317,8 +304,7 @@ case 0x15: { //iflt - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); @@ -338,8 +324,7 @@ case 0x16: { //ifle - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); @@ -359,8 +344,7 @@ case 0x17: { //ifgt - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); @@ -380,8 +364,7 @@ case 0x18: { //ifge - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop(); ASObject* v2=context->runtime_stack_pop(); @@ -401,8 +384,7 @@ case 0x19: { //ifstricteq - s24 t; - code >> t; + int32_t t = code.reads24(); ASObject* v1=context->runtime_stack_pop();
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -125,7 +125,7 @@ ASObject* ret=o; if(o->getObjectType()!=T_STRING) { - ret=abstract_s(o->toString()); + ret=abstract_s(o->getSystemState(),o->toString()); o->decRef(); } return ret; @@ -168,7 +168,7 @@ ASObject* ABCVm::coerce_s(ASObject* o) { - return Class<ASString>::getClass()->coerce(o); + return Class<ASString>::getClass(o->getSystemState())->coerce(o); } void ABCVm::coerce(call_context* th, int n) @@ -347,8 +347,8 @@ //Check if there is a custom caller defined, skipping implementation to avoid recursive calls multiname callPropertyName(NULL); callPropertyName.name_type=multiname::NAME_STRING; - callPropertyName.name_s_id=getSys()->getUniqueStringId("callProperty"); - callPropertyName.ns.emplace_back(flash_proxy,NAMESPACE); + callPropertyName.name_s_id=obj->getSystemState()->getUniqueStringId("callProperty"); + callPropertyName.ns.emplace_back(th->context->root->getSystemState(),flash_proxy,NAMESPACE); _NR<ASObject> oproxy=obj->getVariableByMultiname(callPropertyName,ASObject::SKIP_IMPL); if(!oproxy.isNull()) @@ -364,7 +364,7 @@ IFunction* f=static_cast<IFunction*>(oproxy.getPtr()); //Create a new array ASObject** proxyArgs=g_newa(ASObject*, m+1); - ASObject* namearg = abstract_s(name->normalizedName()); + ASObject* namearg = abstract_s(f->getSystemState(),name->normalizedName(f->getSystemState())); namearg->setProxyProperty(*name); proxyArgs[0]=namearg; for(int i=0;i<m;i++) @@ -404,30 +404,30 @@ { tiny_string clsname = obj->getClass()->getQualifiedClassName(); obj->decRef(); - throwError<ReferenceError>(kWriteOnlyError, name->normalizedName(), clsname); + throwError<ReferenceError>(kWriteOnlyError, name->normalizedName(th->context->root->getSystemState()), clsname); } if (obj->getClass() && obj->getClass()->isSealed) { tiny_string clsname = obj->getClass()->getQualifiedClassName(); obj->decRef(); - throwError<ReferenceError>(kReadSealedError, name->normalizedName(), clsname); + throwError<ReferenceError>(kReadSealedError, name->normalizedName(th->context->root->getSystemState()), clsname); } if (obj->is<Class_base>()) { tiny_string clsname = obj->as<Class_base>()->class_name.getQualifiedName(); obj->decRef(); - throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), clsname); + throwError<TypeError>(kCallNotFoundError, name->qualifiedString(th->context->root->getSystemState()), clsname); } else { tiny_string clsname = obj->getClassName(); obj->decRef(); - throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), clsname); + throwError<TypeError>(kCallNotFoundError, name->qualifiedString(th->context->root->getSystemState()), clsname); } obj->decRef(); if(keepReturn) - th->runtime_stack_push(getSys()->getUndefinedRef()); + th->runtime_stack_push(th->context->root->getSystemState()->getUndefinedRef()); } LOG(LOG_CALLS,_("End of calling ") << *name); @@ -441,7 +441,7 @@ !obj->is<Function_object>() && !obj->is<Class_base>() && obj->getClass() && - (obj->getClass() != Class_object::getClass())) + (obj->getClass() != Class_object::getClass(obj->getSystemState()))) obj->getClass()->setupDeclaredTraits(obj); } @@ -468,14 +468,14 @@ if(prop.isNull()) { if (obj->getClass() && obj->getClass()->isSealed) - throwError<ReferenceError>(kReadSealedError, name->normalizedNameUnresolved(), obj->getClass()->getQualifiedClassName()); + throwError<ReferenceError>(kReadSealedError, name->normalizedNameUnresolved(obj->getSystemState()), obj->getClass()->getQualifiedClassName()); if (name->isEmpty()) - throwError<ReferenceError>(kReadSealedErrorNs, name->normalizedNameUnresolved(), obj->getClassName()); + throwError<ReferenceError>(kReadSealedErrorNs, name->normalizedNameUnresolved(obj->getSystemState()), obj->getClassName()); if (obj->is<Undefined>()) throwError<TypeError>(kConvertUndefinedToObjectError); if (Log::getLevel() >= LOG_NOT_IMPLEMENTED && (!obj->getClass() || obj->getClass()->isSealed)) - LOG(LOG_NOT_IMPLEMENTED,"getProperty: " << name->normalizedNameUnresolved() << " not found on " << obj->toDebugString() << " "<<obj->getClassName()); - ret = getSys()->getUndefinedRef(); + LOG(LOG_NOT_IMPLEMENTED,"getProperty: " << name->normalizedNameUnresolved(obj->getSystemState()) << " not found on " << obj->toDebugString() << " "<<obj->getClassName()); + ret = obj->getSystemState()->getUndefinedRef(); } else { @@ -649,7 +649,7 @@ LOG(LOG_CALLS, _("incLocal ") << n ); number_t tmp=th->locals[n]->toNumber(); th->locals[n]->decRef(); - th->locals[n]=abstract_d(tmp+1); + th->locals[n]=abstract_d(th->locals[n]->getSystemState(),tmp+1); } void ABCVm::incLocal_i(call_context* th, int n) @@ -657,7 +657,7 @@ LOG(LOG_CALLS, _("incLocal_i ") << n ); int32_t tmp=th->locals[n]->toInt(); th->locals[n]->decRef(); - th->locals[n]=abstract_i(tmp+1); + th->locals[n]=abstract_i(th->locals[n]->getSystemState(),tmp+1); } void ABCVm::decLocal(call_context* th, int n) @@ -665,7 +665,7 @@ LOG(LOG_CALLS, _("decLocal ") << n ); number_t tmp=th->locals[n]->toNumber(); th->locals[n]->decRef(); - th->locals[n]=abstract_d(tmp-1); + th->locals[n]=abstract_d(th->locals[n]->getSystemState(),tmp-1); } void ABCVm::decLocal_i(call_context* th, int n) @@ -673,7 +673,7 @@ LOG(LOG_CALLS, _("decLocal_i ") << n ); int32_t tmp=th->locals[n]->toInt(); th->locals[n]->decRef(); - th->locals[n]=abstract_i(tmp-1); + th->locals[n]=abstract_i(th->locals[n]->getSystemState(),tmp-1); } /* This is called for expressions like @@ -787,7 +787,7 @@ { LOG(LOG_NOT_IMPLEMENTED, "constructGenericType of " << obj->getObjectType()); obj->decRef(); - obj = getSys()->getUndefinedRef(); + obj = obj->getSystemState()->getUndefinedRef(); th->runtime_stack_push(obj); for(int i=0;i<m;i++) args[i]->decRef(); @@ -806,7 +806,7 @@ else if(args[i]->is<Null>()) t[i] = Type::anyType; else - throw Class<TypeError>::getInstanceS("Wrong type in applytype"); + throw Class<TypeError>::getInstanceS(obj->getSystemState(),"Wrong type in applytype"); } Class_base* o_class = o_template->applyType(t,th->context->root->applicationDomain); @@ -818,7 +818,7 @@ if (!global->hasPropertyByMultiname(qname, false, false)) { o_class->incRef(); - global->setVariableByQName(qname.name,nsNameAndKind(qname.ns,NAMESPACE),o_class,DECLARED_TRAIT); + global->setVariableByQName(qname.name,nsNameAndKind(global->getSystemState(),qname.ns,NAMESPACE),o_class,DECLARED_TRAIT); } for(int i=0;i<m;++i) @@ -868,7 +868,7 @@ assert_and_throw(false); } obj->decRef(); - return abstract_s(ret); + return abstract_s(obj->getSystemState(),ret); } void ABCVm::jump(int offset) @@ -992,7 +992,7 @@ LOG(LOG_CALLS,"addN " << num1 << '+' << num2); val1->decRef(); val2->decRef(); - return abstract_d(num1+num2); + return abstract_d(val1->getSystemState(), num1+num2); } else if(val1->is<ASString>() || val2->is<ASString>()) { @@ -1001,14 +1001,14 @@ LOG(LOG_CALLS,"add " << a << '+' << b); val1->decRef(); val2->decRef(); - return abstract_s(a + b); + return abstract_s(val1->getSystemState(),a + b); } else if( (val1->is<XML>() || val1->is<XMLList>()) && (val2->is<XML>() || val2->is<XMLList>()) ) { //Check if the objects are both XML or XMLLists - Class_base* xmlClass=Class<XML>::getClass(); + Class_base* xmlClass=Class<XML>::getClass(val1->getSystemState()); - XMLList* newList=Class<XMLList>::getInstanceS(true); + XMLList* newList=Class<XMLList>::getInstanceS(val1->getSystemState(),true); if(val1->getClass()==xmlClass) newList->append(_MR(static_cast<XML*>(val1)));
View file
lightspark.tar.xz/src/scripting/abc_optimizer.cpp
Changed
@@ -179,8 +179,7 @@ return CANNOT_BIND; } - NS_KIND nskind; - const variable* var=it->object->findVariableByMultiname(*name, ASObject::XML_STRICT, it->object->getClass(),nskind); + const variable* var=it->object->findVariableByMultiname(*name, ASObject::XML_STRICT, it->object->getClass()); if(var) { found=true; @@ -240,7 +239,7 @@ ASObject* target; //Now we should serach in the applicationDomain. The system domain is the first one searched. We can safely //early bind for it, but not for custom domains, since we may change the expected order of evaluation - ASObject* o=getSys()->systemDomain->getVariableAndTargetByMultiname(*name, target); + ASObject* o=f->getSystemState()->systemDomain->getVariableAndTargetByMultiname(*name, target); if(o) { //Output a special opcode @@ -702,7 +701,7 @@ case 0x20: { //pushnull - ASObject* ret=getSys()->getNullRef(); + ASObject* ret=function->getSystemState()->getNullRef(); //We don't really need a reference to it ret->decRef(); curBlock->pushStack(InferenceData(ret)); @@ -731,7 +730,7 @@ code.read((char*)&t,1); out << (uint8_t)opcode; out << t; - curBlock->pushStack(Class<Integer>::getClass()); + curBlock->pushStack(Class<Integer>::getClass(function->getSystemState())); break; } case 0x25: @@ -743,21 +742,21 @@ code >> t; out << (uint8_t)opcode; writeInt32(out, t); - curBlock->pushStack(Class<Integer>::getClass()); + curBlock->pushStack(Class<Integer>::getClass(function->getSystemState())); break; } case 0x26: { //pushtrue out << (uint8_t)opcode; - curBlock->pushStack(Class<Boolean>::getClass()); + curBlock->pushStack(Class<Boolean>::getClass(function->getSystemState())); break; } case 0x27: { //pushfalse out << (uint8_t)opcode; - curBlock->pushStack(Class<Boolean>::getClass()); + curBlock->pushStack(Class<Boolean>::getClass(function->getSystemState())); break; } case 0x28: @@ -812,7 +811,7 @@ s32 val=mi->context->constant_pool.integer[t]; out << (uint8_t)opcode; writeInt32(out, val); - curBlock->pushStack(Class<Integer>::getClass()); + curBlock->pushStack(Class<Integer>::getClass(function->getSystemState())); break; } case 0x2e: @@ -823,7 +822,7 @@ u32 val=mi->context->constant_pool.uinteger[t]; out << (uint8_t)opcode; writeInt32(out, val); - curBlock->pushStack(Class<Integer>::getClass()); + curBlock->pushStack(Class<Integer>::getClass(function->getSystemState())); break; } case 0x2f: @@ -834,7 +833,7 @@ double val=mi->context->constant_pool.doubles[t]; out << (uint8_t)opcode; writeDouble(out, val); - curBlock->pushStack(Class<Number>::getClass()); + curBlock->pushStack(Class<Number>::getClass(function->getSystemState())); break; } case 0x30: @@ -865,7 +864,7 @@ out << (uint8_t)opcode; writeInt32(out,t); writeInt32(out,t2); - curBlock->pushStack(Class<Boolean>::getClass()); + curBlock->pushStack(Class<Boolean>::getClass(function->getSystemState())); break; } //Alchemy opcodes @@ -878,7 +877,7 @@ //li32 out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<Integer>::getClass()); + curBlock->pushStack(Class<Integer>::getClass(function->getSystemState())); break; } case 0x3a: @@ -965,8 +964,7 @@ const Class_base* objType=dynamic_cast<const Class_base*>(baseData.type); if(objType) { - NS_KIND nskind; - const variable* var=objType->findBorrowedGettable(*name,nskind); + const variable* var=objType->findBorrowedGettable(*name); if(var && var->var && var->var->getObjectType()==T_FUNCTION) { SyntheticFunction* calledFunc=dynamic_cast<SyntheticFunction*>(var->var); @@ -1258,7 +1256,7 @@ int numRT=mi->context->getMultinameRTData(t); curBlock->popStack(numRT+1); - curBlock->pushStack(Class<Boolean>::getClass()); + curBlock->pushStack(Class<Boolean>::getClass(function->getSystemState())); break; } case 0x6c: @@ -1322,7 +1320,7 @@ out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<ASString>::getClass()); + curBlock->pushStack(Class<ASString>::getClass(function->getSystemState())); break; } case 0x73: @@ -1331,7 +1329,7 @@ out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<Integer>::getClass()); + curBlock->pushStack(Class<Integer>::getClass(function->getSystemState())); break; } case 0x74: @@ -1340,7 +1338,7 @@ out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<UInteger>::getClass()); + curBlock->pushStack(Class<UInteger>::getClass(function->getSystemState())); break; } case 0x75: @@ -1349,7 +1347,7 @@ out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<Number>::getClass()); + curBlock->pushStack(Class<Number>::getClass(function->getSystemState())); break; } case 0x76: @@ -1358,7 +1356,7 @@ out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<Boolean>::getClass()); + curBlock->pushStack(Class<Boolean>::getClass(function->getSystemState())); break; } case 0x78: @@ -1451,7 +1449,7 @@ //decrement out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<Number>::getClass()); + curBlock->pushStack(Class<Number>::getClass(function->getSystemState())); break; } case 0x92: @@ -1470,7 +1468,7 @@ //not out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<Boolean>::getClass()); + curBlock->pushStack(Class<Boolean>::getClass(function->getSystemState())); break; } case 0x97: @@ -1484,7 +1482,7 @@ //negate_i out << (uint8_t)opcode; curBlock->popStack(1); - curBlock->pushStack(Class<Integer>::getClass()); + curBlock->pushStack(Class<Integer>::getClass(function->getSystemState())); break; } case 0xa0: @@ -1507,7 +1505,7 @@ //modulo
View file
lightspark.tar.xz/src/scripting/abctypes.cpp
Changed
@@ -165,7 +165,8 @@ in >> v.method >> v.max_stack >> v.local_count >> v.init_scope_depth >> v.max_scope_depth >> code_length; v.code.resize(code_length); in.read(&v.code[0],code_length); - + v.codecache = new method_body_info_cache[code_length]; + memset(v.codecache,0,code_length*sizeof(method_body_info_cache)); u30 exception_count; in >> exception_count; v.exceptions.resize(exception_count);
View file
lightspark.tar.xz/src/scripting/abctypes.h
Changed
@@ -245,10 +245,17 @@ std::vector<option_detail> options; std::vector<u30> param_names; }; +struct method_body_info_cache +{ + bool iscached; + uint32_t value; + uint32_t nextpos; +}; struct method_body_info { method_body_info():hit_count(0),codeStatus(ORIGINAL){} + ~method_body_info() { delete[] codecache; } u30 method; u30 max_stack; u30 local_count; @@ -263,6 +270,7 @@ //The code status enum CODE_STATUS { ORIGINAL = 0, USED, OPTIMIZED, JITTED }; CODE_STATUS codeStatus; + method_body_info_cache* codecache; }; std::istream& operator>>(std::istream& in, u8& v);
View file
lightspark.tar.xz/src/scripting/abcutils.h
Changed
@@ -21,6 +21,7 @@ #define SCRIPTING_ABCUTILS_H 1 #include "smartrefs.h" +#include "errorconstants.h" namespace lightspark { @@ -66,10 +67,34 @@ _NR<ASString> defaultNamespaceUri; int initialScopeStack; ~call_context(); - void runtime_stack_clear(); - void runtime_stack_push(ASObject* s); - ASObject* runtime_stack_pop(); - ASObject* runtime_stack_peek(); + static void handleError(int errorcode); + inline void runtime_stack_clear() + { + while(stack_index > 0) + stack[--stack_index]->decRef(); + } + inline void runtime_stack_push(ASObject* s) + { + if(stack_index>=max_stack) + handleError(kStackOverflowError); + stack[stack_index++]=s; + } + inline ASObject* runtime_stack_pop() + { + if(stack_index==0) + handleError(kStackUnderflowError); + ASObject* ret=stack[--stack_index]; + return ret; + } + inline ASObject* runtime_stack_peek() + { + if(stack_index==0) + { + LOG(LOG_ERROR,_("Empty stack")); + return NULL; + } + return stack[stack_index-1]; + } }; }
View file
lightspark.tar.xz/src/scripting/argconv.h
Changed
@@ -54,7 +54,7 @@ { public: static T toConcrete(ASObject* obj); - static ASObject* toAbstract(const T& val); + static ASObject* toAbstract(SystemState* sys,const T& val); }; template<class T> @@ -67,11 +67,11 @@ if(!o) throwError<ArgumentError>(kCheckTypeFailedError, obj->getClassName(), - Class<T>::getClass()->getQualifiedClassName()); + Class<T>::getClass(obj->getSystemState())->getQualifiedClassName()); o->incRef(); return _MR(o); } - static ASObject* toAbstract(const Ref<T>& val) + static ASObject* toAbstract(SystemState* /*sys*/,const Ref<T>& val) { val->incRef(); return val.getPtr(); @@ -95,14 +95,14 @@ if(!o) throwError<ArgumentError>(kCheckTypeFailedError, obj->getClassName(), - Class<T>::getClass()->getQualifiedClassName()); + Class<T>::getClass(obj->getSystemState())->getQualifiedClassName()); o->incRef(); return _MNR(o); } - static ASObject* toAbstract(const NullableRef<T>& val) + static ASObject* toAbstract(SystemState* sys,const NullableRef<T>& val) { if(val.isNull()) - return getSys()->getNullRef(); + return sys->getNullRef(); val->incRef(); return val.getPtr(); } @@ -121,10 +121,10 @@ obj->incRef(); return _MNR(obj); } - static ASObject* toAbstract(const NullableRef<ASObject>& val) + static ASObject* toAbstract(SystemState* sys,const NullableRef<ASObject>& val) { if(val.isNull()) - return getSys()->getNullRef(); + return sys->getNullRef(); val->incRef(); return val.getPtr(); } @@ -174,45 +174,45 @@ } template<> -inline ASObject* lightspark::ArgumentConversion<int32_t>::toAbstract(const int32_t& val) +inline ASObject* lightspark::ArgumentConversion<int32_t>::toAbstract(SystemState* sys,const int32_t& val) { - return abstract_i(val); + return abstract_i(sys,val); } template<> -inline ASObject* lightspark::ArgumentConversion<uint32_t>::toAbstract(const uint32_t& val) +inline ASObject* lightspark::ArgumentConversion<uint32_t>::toAbstract(SystemState* sys,const uint32_t& val) { - return abstract_ui(val); + return abstract_ui(sys,val); } template<> -inline ASObject* lightspark::ArgumentConversion<number_t>::toAbstract(const number_t& val) +inline ASObject* lightspark::ArgumentConversion<number_t>::toAbstract(SystemState* sys,const number_t& val) { - return abstract_d(val); + return abstract_d(sys,val); } template<> -inline ASObject* lightspark::ArgumentConversion<bool>::toAbstract(const bool& val) +inline ASObject* lightspark::ArgumentConversion<bool>::toAbstract(SystemState* sys,const bool& val) { - return abstract_b(val); + return abstract_b(sys,val); } template<> -inline ASObject* lightspark::ArgumentConversion<tiny_string>::toAbstract(const tiny_string& val) +inline ASObject* lightspark::ArgumentConversion<tiny_string>::toAbstract(SystemState* sys,const tiny_string& val) { - return Class<ASString>::getInstanceS(val); + return abstract_s(sys,val); } template<> -inline ASObject* lightspark::ArgumentConversion<std::string>::toAbstract(const std::string& val) +inline ASObject* lightspark::ArgumentConversion<std::string>::toAbstract(SystemState* sys,const std::string& val) { - return Class<ASString>::getInstanceS(val); + return abstract_s(sys,val); } template<> -inline ASObject* lightspark::ArgumentConversion<RGB>::toAbstract(const RGB& val) +inline ASObject* lightspark::ArgumentConversion<RGB>::toAbstract(SystemState* sys,const RGB& val) { - return abstract_ui(val.toUInt()); + return abstract_ui(sys,val.toUInt()); } #define ARG_UNPACK ArgUnpack(args,argslen,false)
View file
lightspark.tar.xz/src/scripting/avmplus/avmplus.cpp
Changed
@@ -32,11 +32,11 @@ void avmplusFile::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED); - c->setDeclaredMethodByQName("exists","",Class<IFunction>::getFunction(exists),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("read","",Class<IFunction>::getFunction(read),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("write","",Class<IFunction>::getFunction(write),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("readByteArray","",Class<IFunction>::getFunction(readByteArray),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("writeByteArray","",Class<IFunction>::getFunction(writeByteArray),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("exists","",Class<IFunction>::getFunction(c->getSystemState(),exists),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("read","",Class<IFunction>::getFunction(c->getSystemState(),read),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("write","",Class<IFunction>::getFunction(c->getSystemState(),write),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("readByteArray","",Class<IFunction>::getFunction(c->getSystemState(),readByteArray),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("writeByteArray","",Class<IFunction>::getFunction(c->getSystemState(),writeByteArray),NORMAL_METHOD,false); } ASFUNCTIONBODY(avmplusFile,exists) @@ -61,7 +61,7 @@ ARG_UNPACK(filename); LOG(LOG_NOT_IMPLEMENTED, _("avmplus.File.readByteArray is unimplemented.")); - return Class<ByteArray>::getInstanceS(); + return Class<ByteArray>::getInstanceS(obj->getSystemState()); } ASFUNCTIONBODY(avmplusFile,writeByteArray) { @@ -77,34 +77,34 @@ void avmplusSystem::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED); - c->setDeclaredMethodByQName("getFeatures","",Class<IFunction>::getFunction(getFeatures),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("queueCollection","",Class<IFunction>::getFunction(queueCollection),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("forceFullCollection","",Class<IFunction>::getFunction(forceFullCollection),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("getAvmplusVersion","",Class<IFunction>::getFunction(getAvmplusVersion),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("pauseForGCIfCollectionImminent","",Class<IFunction>::getFunction(pauseForGCIfCollectionImminent),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("getRunmode","",Class<IFunction>::getFunction(getRunmode),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("isDebugger","",Class<IFunction>::getFunction(isDebugger),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("isGlobal","",Class<IFunction>::getFunction(isGlobal),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("freeMemory","",Class<IFunction>::getFunction(_freeMemory),GETTER_METHOD,false); - c->setDeclaredMethodByQName("totalMemory","",Class<IFunction>::getFunction(_totalMemory),GETTER_METHOD,false); - c->setDeclaredMethodByQName("privateMemory","",Class<IFunction>::getFunction(_privateMemory),GETTER_METHOD,false); - c->setDeclaredMethodByQName("argv","",Class<IFunction>::getFunction(argv),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("exec","",Class<IFunction>::getFunction(exec),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("write","",Class<IFunction>::getFunction(write),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("exit","",Class<IFunction>::getFunction(exit),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("trace","",Class<IFunction>::getFunction(lightspark::trace),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("canonicalizeNumber","",Class<IFunction>::getFunction(canonicalizeNumber),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("getFeatures","",Class<IFunction>::getFunction(c->getSystemState(),getFeatures),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("queueCollection","",Class<IFunction>::getFunction(c->getSystemState(),queueCollection),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("forceFullCollection","",Class<IFunction>::getFunction(c->getSystemState(),forceFullCollection),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("getAvmplusVersion","",Class<IFunction>::getFunction(c->getSystemState(),getAvmplusVersion),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("pauseForGCIfCollectionImminent","",Class<IFunction>::getFunction(c->getSystemState(),pauseForGCIfCollectionImminent),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("getRunmode","",Class<IFunction>::getFunction(c->getSystemState(),getRunmode),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("isDebugger","",Class<IFunction>::getFunction(c->getSystemState(),isDebugger),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("isGlobal","",Class<IFunction>::getFunction(c->getSystemState(),isGlobal),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("freeMemory","",Class<IFunction>::getFunction(c->getSystemState(),_freeMemory),GETTER_METHOD,false); + c->setDeclaredMethodByQName("totalMemory","",Class<IFunction>::getFunction(c->getSystemState(),_totalMemory),GETTER_METHOD,false); + c->setDeclaredMethodByQName("privateMemory","",Class<IFunction>::getFunction(c->getSystemState(),_privateMemory),GETTER_METHOD,false); + c->setDeclaredMethodByQName("argv","",Class<IFunction>::getFunction(c->getSystemState(),argv),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("exec","",Class<IFunction>::getFunction(c->getSystemState(),exec),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("write","",Class<IFunction>::getFunction(c->getSystemState(),write),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("exit","",Class<IFunction>::getFunction(c->getSystemState(),exit),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("trace","",Class<IFunction>::getFunction(c->getSystemState(),lightspark::trace),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("canonicalizeNumber","",Class<IFunction>::getFunction(c->getSystemState(),canonicalizeNumber),NORMAL_METHOD,false); } ASFUNCTIONBODY(avmplusSystem,getFeatures) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.getFeatures is unimplemented.")); - return Class<ASString>::getInstanceS(""); + return abstract_s(getSys(),""); } ASFUNCTIONBODY(avmplusSystem,getRunmode) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.getRunmode is unimplemented.")); - return Class<ASString>::getInstanceS("jit"); + return abstract_s(getSys(),"jit"); } ASFUNCTIONBODY(avmplusSystem,queueCollection) @@ -122,7 +122,7 @@ ASFUNCTIONBODY(avmplusSystem,getAvmplusVersion) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.getAvmplusVersion is unimplemented.")); - return Class<ASString>::getInstanceS("0"); + return abstract_s(getSys(),"0"); } ASFUNCTIONBODY(avmplusSystem,pauseForGCIfCollectionImminent) { @@ -133,32 +133,32 @@ ASFUNCTIONBODY(avmplusSystem,isDebugger) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.isDebugger is unimplemented.")); - return abstract_b(false); + return abstract_b(obj->getSystemState(),false); } ASFUNCTIONBODY(avmplusSystem,isGlobal) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.isDebugger is unimplemented.")); - return abstract_b(false); + return abstract_b(obj->getSystemState(),false); } ASFUNCTIONBODY(avmplusSystem,_freeMemory) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.freeMemory is unimplemented.")); - return abstract_d(1024); + return abstract_d(obj->getSystemState(),1024); } ASFUNCTIONBODY(avmplusSystem,_totalMemory) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.totalMemory is unimplemented.")); - return abstract_d(1024); + return abstract_d(obj->getSystemState(),1024); } ASFUNCTIONBODY(avmplusSystem,_privateMemory) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.privateMemory is unimplemented.")); - return abstract_d(1024); + return abstract_d(obj->getSystemState(),1024); } ASFUNCTIONBODY(avmplusSystem,argv) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.System.argv is unimplemented.")); - return Class<Array>::getInstanceS(); + return Class<Array>::getInstanceS(getSys()); } ASFUNCTIONBODY(avmplusSystem,exec) { @@ -193,11 +193,11 @@ void avmplusDomain::sinit(Class_base* c) { CLASS_SETUP(c, ApplicationDomain,_constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("currentDomain","",Class<IFunction>::getFunction(_getCurrentDomain),GETTER_METHOD,false); - c->setDeclaredMethodByQName("MIN_DOMAIN_MEMORY_LENGTH","",Class<IFunction>::getFunction(_getMinDomainMemoryLength),GETTER_METHOD,false); - c->setDeclaredMethodByQName("load","",Class<IFunction>::getFunction(load),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("loadBytes","",Class<IFunction>::getFunction(load),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getClass","",Class<IFunction>::getFunction(getClass),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("currentDomain","",Class<IFunction>::getFunction(c->getSystemState(),_getCurrentDomain),GETTER_METHOD,false); + c->setDeclaredMethodByQName("MIN_DOMAIN_MEMORY_LENGTH","",Class<IFunction>::getFunction(c->getSystemState(),_getMinDomainMemoryLength),GETTER_METHOD,false); + c->setDeclaredMethodByQName("load","",Class<IFunction>::getFunction(c->getSystemState(),load),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("loadBytes","",Class<IFunction>::getFunction(c->getSystemState(),load),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getClass","",Class<IFunction>::getFunction(c->getSystemState(),getClass),NORMAL_METHOD,true); } ASFUNCTIONBODY(avmplusDomain,_constructor) { @@ -219,5 +219,5 @@ ASFUNCTIONBODY(avmplusDomain,getClass) { LOG(LOG_NOT_IMPLEMENTED, _("avmplus.Domain.getClass is unimplemented.")); - return Class<ASObject>::getRef()->getClass(); + return Class<ASObject>::getRef(obj->getSystemState())->getClass(obj->getSystemState()); }
View file
lightspark.tar.xz/src/scripting/class.cpp
Changed
@@ -24,15 +24,15 @@ using namespace lightspark; -ASObject* lightspark::new_asobject() +ASObject* lightspark::new_asobject(SystemState* sys) { - return Class<ASObject>::getInstanceS(); + return Class<ASObject>::getInstanceS(sys); } -Prototype* lightspark::new_objectPrototype() +Prototype* lightspark::new_objectPrototype(SystemState* sys) { //Create a Prototype object, the class should be ASObject - Class_base* c=Class<ASObject>::getClass(); + Class_base* c=Class<ASObject>::getClass(sys); return new (c->memoryAccount) ObjectPrototype(c); } @@ -44,7 +44,7 @@ Function_object* lightspark::new_functionObject(_NR<ASObject> p) { - Class_base* c=Class<ASObject>::getClass(); + Class_base* c=Class<ASObject>::getClass(p->getSystemState()); return new (c->memoryAccount) Function_object(c, p); } @@ -61,8 +61,9 @@ #ifndef NDEBUG bool ret= #endif - getSys()->customClasses.insert(this).second; + this->getSystemState()->customClasses.insert(this).second; assert(ret); + isReusable = true; } void Class_inherit::finalize() @@ -93,6 +94,14 @@ handleConstruction(ret,args,argslen,true); return ret; } +void Class_inherit::recursiveBuild(ASObject* target) const +{ + if(super && super->is<Class_inherit>()) + super->as<Class_inherit>()->recursiveBuild(target); + + buildInstanceTraits(target); +} + void Class_inherit::buildInstanceTraits(ASObject* o) const { @@ -105,6 +114,28 @@ context->buildInstanceTraits(o,class_index); } +void Class_inherit::setupDeclaredTraits(ASObject *target) const +{ + if (!target->traitsInitialized) + { + #ifndef NDEBUG + assert_and_throw(!target->initialized); + #endif + //HACK: suppress implementation handling of variables just now + bool bak=target->implEnable; + target->implEnable=false; + recursiveBuild(target); + + //And restore it + target->implEnable=bak; + + #ifndef NDEBUG + target->initialized=true; + #endif + target->traitsInitialized = true; + } +} + template<> Global* Class<Global>::getInstance(bool construct, ASObject* const* args, const unsigned int argslen, Class_base* realClass) @@ -120,7 +151,7 @@ //Find the origin while(cur) { - var=cur->borrowedVariables.findObjVar(getSys()->getUniqueStringId(name),nsNameAndKind("",NAMESPACE),NO_CREATE_TRAIT,DECLARED_TRAIT); + var=cur->borrowedVariables.findObjVar(c->getSystemState()->getUniqueStringId(name),nsNameAndKind(c->getSystemState(),"",NAMESPACE),NO_CREATE_TRAIT,DECLARED_TRAIT); if(var) break; cur=cur->super.getPtr(); @@ -151,21 +182,21 @@ ASObject* Class<ASObject>::getInstance(bool construct, ASObject* const* args, const unsigned int argslen, Class_base* realClass) { - if (construct && args && argslen == 1 && this == Class<ASObject>::getClass()) + if (construct && args && argslen == 1 && this == Class<ASObject>::getClass(this->getSystemState())) { // Construction according to ECMA 15.2.2.1 switch(args[0]->getObjectType()) { case T_BOOLEAN: - return abstract_b(Boolean_concrete(args[0])); + return abstract_b(this->getSystemState(),Boolean_concrete(args[0])); case T_NUMBER: - return abstract_d(args[0]->toNumber()); + return abstract_d(this->getSystemState(),args[0]->toNumber()); case T_INTEGER: - return abstract_i(args[0]->toInt()); + return abstract_i(this->getSystemState(),args[0]->toInt()); case T_UINTEGER: - return abstract_ui(args[0]->toUInt()); + return abstract_ui(this->getSystemState(),args[0]->toUInt()); case T_STRING: - return abstract_s(args[0]->toString()); + return abstract_s(this->getSystemState(),args[0]->toString()); case T_FUNCTION: case T_OBJECT: args[0]->incRef(); @@ -181,20 +212,22 @@ handleConstruction(ret,args,argslen,true); return ret; } -Class<ASObject>* Class<ASObject>::getClass() +Class<ASObject>* Class<ASObject>::getClass(SystemState* sys) { uint32_t classId=ClassName<ASObject>::id; Class<ASObject>* ret=NULL; - Class_base** retAddr=&getSys()->builtinClasses[classId]; + SystemState* s = sys == NULL ? getSys() : sys; + Class_base** retAddr=&s->builtinClasses[classId]; if(*retAddr==NULL) { //Create the class QName name(ClassName<ASObject>::name,ClassName<ASObject>::ns); - MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(name.name); - ret=new (getSys()->unaccountedMemory) Class<ASObject>(name, memoryAccount); + MemoryAccount* memoryAccount = s->allocateMemoryAccount(name.name); + ret=new (s->unaccountedMemory) Class<ASObject>(name, memoryAccount); + ret->setSystemState(s); ret->incRef(); *retAddr=ret; - ret->prototype = _MNR(new_objectPrototype()); + ret->prototype = _MNR(new_objectPrototype(sys)); ASObject::sinit(ret); ret->initStandardProps(); }
View file
lightspark.tar.xz/src/scripting/class.h
Changed
@@ -48,10 +48,12 @@ ASObject* getInstance(bool construct, ASObject* const* args, const unsigned int argslen, Class_base* realClass); DictionaryTag const* tag; bool bindedToRoot; + void recursiveBuild(ASObject* target) const; public: Class_inherit(const QName& name, MemoryAccount* m); void finalize(); void buildInstanceTraits(ASObject* o) const; + void setupDeclaredTraits(ASObject *target) const; void bindToTag(DictionaryTag const* t) { tag=t; @@ -69,8 +71,8 @@ }; /* helper function: does Class<ASObject>::getInstances(), but solves forward declaration problem */ -ASObject* new_asobject(); -Prototype* new_objectPrototype(); +ASObject* new_asobject(SystemState *sys); +Prototype* new_objectPrototype(SystemState *sys); Prototype* new_functionPrototype(Class_base* functionClass, _NR<Prototype> p); Function_object* new_functionObject(_NR<ASObject> p); ObjectConstructor* new_objectConstructor(Class_base* cls,uint32_t length); @@ -140,9 +142,11 @@ } */ template<typename... Args> - static T* getInstanceS(Args&&... args) + static T* getInstanceS(SystemState* sys, Args&&... args) { - Class<T>* c=Class<T>::getClass(); + Class<T>* c=static_cast<Class<T>*>(sys->builtinClasses[ClassName<T>::id]); + if (!c) + c = getClass(sys); T* ret=newWithOptionalClass<T, sizeof...(Args)>::doNew(c, std::forward<Args>(args)...); c->setupDeclaredTraits(ret); ret->constructionComplete(); @@ -150,33 +154,36 @@ return ret; } // constructor without arguments - static T* getInstanceSNoArgs() + inline static T* getInstanceSNoArgs(SystemState* sys) { - Class<T>* c=Class<T>::getClass(); + Class<T>* c=static_cast<Class<T>*>(sys->builtinClasses[ClassName<T>::id]); + if (!c) + c = getClass(sys); T* ret = c->getObjectFromFreeList()->as<T>(); if (!ret) { ret=new (c->memoryAccount) T(c); } - c->setupDeclaredTraits(ret); + ret->setIsInitialized(); ret->constructionComplete(); ret->setConstructIndicator(); return ret; } - static Class<T>* getClass() + inline static Class<T>* getClass(SystemState* sys) { uint32_t classId=ClassName<T>::id; Class<T>* ret=NULL; - Class_base** retAddr=&getSys()->builtinClasses[classId]; + Class_base** retAddr= &sys->builtinClasses[classId]; if(*retAddr==NULL) { //Create the class QName name(ClassName<T>::name,ClassName<T>::ns); - MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(name.name); - ret=new (getSys()->unaccountedMemory) Class<T>(name, memoryAccount); + MemoryAccount* memoryAccount = sys->allocateMemoryAccount(name.name); + ret=new (sys->unaccountedMemory) Class<T>(name, memoryAccount); + ret->setSystemState(sys); ret->incRef(); *retAddr=ret; - ret->prototype = _MNR(new_objectPrototype()); + ret->prototype = _MNR(new_objectPrototype(sys)); T::sinit(ret); ret->initStandardProps(); @@ -186,9 +193,9 @@ return ret; } - static _R<Class<T>> getRef() + static _R<Class<T>> getRef(SystemState* sys) { - Class<T>* ret = getClass(); + Class<T>* ret = getClass(sys); ret->incRef(); return _MR(ret); } @@ -225,7 +232,7 @@ { number_t n = o->toNumber(); o->decRef(); - return abstract_d(n); + return abstract_d(o->getSystemState(),n); } template<> @@ -233,7 +240,7 @@ { uint32_t n = o->toUInt(); o->decRef(); - return abstract_ui(n); + return abstract_ui(o->getSystemState(),n); } template<> @@ -241,7 +248,7 @@ { int32_t n = o->toInt(); o->decRef(); - return abstract_i(n); + return abstract_i(o->getSystemState(),n); } template<> @@ -249,7 +256,7 @@ { bool n = Boolean_concrete(o); o->decRef(); - return abstract_b(n); + return abstract_b(o->getSystemState(),n); } template<> @@ -260,9 +267,9 @@ //This function is instantiated always because of inheritance ASObject* getInstance(bool construct, ASObject* const* args, const unsigned int argslen, Class_base* realClass=NULL); public: - static ASObject* getInstanceS() + static ASObject* getInstanceS(SystemState* sys) { - Class<ASObject>* c=Class<ASObject>::getClass(); + Class<ASObject>* c=Class<ASObject>::getClass(sys); ASObject* ret = c->getObjectFromFreeList(); if (!ret) ret=new (c->memoryAccount) ASObject(c); @@ -273,10 +280,10 @@ //return c->getInstance(true,NULL,0); } - static Class<ASObject>* getClass(); - static _R<Class<ASObject>> getRef() + static Class<ASObject>* getClass(SystemState* sys); + static _R<Class<ASObject>> getRef(SystemState* sys) { - Class<ASObject>* ret = getClass(); + Class<ASObject>* ret = getClass(sys); ret->incRef(); return _MR(ret); } @@ -292,7 +299,7 @@ { ASObject *ret; if(argslen==0 || args[0]->is<Null>() || args[0]->is<Undefined>()) - ret=Class<ASObject>::getInstanceS(); + ret=Class<ASObject>::getInstanceS(getSys()); else { args[0]->incRef(); @@ -330,17 +337,17 @@ } InterfaceClass(const QName& name, MemoryAccount* m):Class_base(name, m) { } public: - static InterfaceClass<T>* getClass() + static InterfaceClass<T>* getClass(SystemState* sys) { uint32_t classId=ClassName<T>::id; InterfaceClass<T>* ret=NULL; - Class_base** retAddr=&getSys()->builtinClasses[classId]; + Class_base** retAddr=&sys->builtinClasses[classId]; if(*retAddr==NULL) { //Create the class QName name(ClassName<T>::name,ClassName<T>::ns); - MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(name.name); - ret=new (getSys()->unaccountedMemory) InterfaceClass<T>(name, memoryAccount); + MemoryAccount* memoryAccount = sys->allocateMemoryAccount(name.name); + ret=new (sys->unaccountedMemory) InterfaceClass<T>(name, memoryAccount); ret->isInterface = true; ret->incRef(); *retAddr=ret; @@ -350,9 +357,9 @@ return ret; } - static _R<InterfaceClass<T>> getRef() + static _R<InterfaceClass<T>> getRef(SystemState* sys) { - InterfaceClass<T>* ret = getClass(); + InterfaceClass<T>* ret = getClass(sys); ret->incRef(); return _MR(ret); }
View file
lightspark.tar.xz/src/scripting/flash/accessibility/flashaccessibility.cpp
Changed
@@ -66,7 +66,7 @@ void Accessibility::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_FINAL); - c->setVariableByQName("active","",abstract_b(false),CONSTANT_TRAIT); + c->setVariableByQName("active","",abstract_b(c->getSystemState(),false),CONSTANT_TRAIT); } ASFUNCTIONBODY(Accessibility,updateProperties)
View file
lightspark.tar.xz/src/scripting/flash/concurrent/Condition.cpp
Changed
@@ -30,10 +30,10 @@ void ASCondition::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL); - c->setVariableByQName("isSupported","",abstract_b(false),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("notify","",Class<IFunction>::getFunction(_notify),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("notifyAll","",Class<IFunction>::getFunction(_notifyAll),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("wait","",Class<IFunction>::getFunction(_wait),NORMAL_METHOD,true); + c->setVariableByQName("isSupported","",abstract_b(c->getSystemState(),false),CONSTANT_TRAIT); + c->setDeclaredMethodByQName("notify","",Class<IFunction>::getFunction(c->getSystemState(),_notify),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("notifyAll","",Class<IFunction>::getFunction(c->getSystemState(),_notifyAll),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("wait","",Class<IFunction>::getFunction(c->getSystemState(),_wait),NORMAL_METHOD,true); REGISTER_GETTER(c,mutex); } @@ -76,6 +76,6 @@ ASCondition* th=obj->as<ASCondition>(); if (!th->mutex->getLockCount()) throwError<ASError>(kConditionCannotWait) ; - return abstract_b(true); + return abstract_b(obj->getSystemState(),true); }
View file
lightspark.tar.xz/src/scripting/flash/concurrent/Mutex.cpp
Changed
@@ -29,9 +29,9 @@ void ASMutex::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL); - c->setDeclaredMethodByQName("lock","",Class<IFunction>::getFunction(_lock),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("unlock","",Class<IFunction>::getFunction(_unlock),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("tryLock","",Class<IFunction>::getFunction(_trylock),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lock","",Class<IFunction>::getFunction(c->getSystemState(),_lock),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("unlock","",Class<IFunction>::getFunction(c->getSystemState(),_unlock),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("tryLock","",Class<IFunction>::getFunction(c->getSystemState(),_trylock),NORMAL_METHOD,true); } ASFUNCTIONBODY(ASMutex,_constructor) @@ -55,6 +55,6 @@ ASFUNCTIONBODY(ASMutex,_trylock) { ASMutex* th=obj->as<ASMutex>(); - return abstract_b(th->mutex.trylock()); + return abstract_b(obj->getSystemState(),th->mutex.trylock()); }
View file
lightspark.tar.xz/src/scripting/flash/desktop/flashdesktop.cpp
Changed
@@ -28,8 +28,8 @@ void NativeApplication::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_FINAL | CLASS_SEALED); - c->setDeclaredMethodByQName("nativeApplication", "", Class<IFunction>::getFunction(_getNativeApplication), GETTER_METHOD, false); - c->setDeclaredMethodByQName("addEventListener", "", Class<IFunction>::getFunction(addEventListener), NORMAL_METHOD, true); + c->setDeclaredMethodByQName("nativeApplication", "", Class<IFunction>::getFunction(c->getSystemState(),_getNativeApplication), GETTER_METHOD, false); + c->setDeclaredMethodByQName("addEventListener", "", Class<IFunction>::getFunction(c->getSystemState(),addEventListener), NORMAL_METHOD, true); } void NativeApplication::buildTraits(ASObject* o) @@ -45,7 +45,7 @@ // Should actually be a Singleton ASFUNCTIONBODY(NativeApplication, _getNativeApplication) { - return Class<NativeApplication>::getInstanceS(); + return Class<NativeApplication>::getInstanceS(getSys()); } ASFUNCTIONBODY(NativeApplication, addEventListener) @@ -55,7 +55,7 @@ if (args[0]->toString() == "invoke") { th->incRef(); - getVm()->addEvent(_MR(th), _MR(Class<InvokeEvent>::getInstanceS())); + getVm(obj->getSystemState())->addEvent(_MR(th), _MR(Class<InvokeEvent>::getInstanceS(obj->getSystemState()))); } return NULL;
View file
lightspark.tar.xz/src/scripting/flash/display/BitmapData.cpp
Changed
@@ -58,38 +58,38 @@ void BitmapData::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); - c->addImplementedInterface(InterfaceClass<IBitmapDrawable>::getClass()); - c->setDeclaredMethodByQName("draw","",Class<IFunction>::getFunction(draw),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("dispose","",Class<IFunction>::getFunction(dispose),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getPixel","",Class<IFunction>::getFunction(getPixel),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getPixel32","",Class<IFunction>::getFunction(getPixel32),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setPixel","",Class<IFunction>::getFunction(setPixel),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setPixel32","",Class<IFunction>::getFunction(setPixel32),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("copyPixels","",Class<IFunction>::getFunction(copyPixels),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("fillRect","",Class<IFunction>::getFunction(fillRect),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("generateFilterRect","",Class<IFunction>::getFunction(generateFilterRect),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("hitTest","",Class<IFunction>::getFunction(hitTest),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("scroll","",Class<IFunction>::getFunction(scroll),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(clone),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("copyChannel","",Class<IFunction>::getFunction(copyChannel),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lock","",Class<IFunction>::getFunction(lock),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("unlock","",Class<IFunction>::getFunction(unlock),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("floodFill","",Class<IFunction>::getFunction(floodFill),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("histogram","",Class<IFunction>::getFunction(histogram),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getColorBoundsRect","",Class<IFunction>::getFunction(getColorBoundsRect),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getPixels","",Class<IFunction>::getFunction(getPixels),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getVector","",Class<IFunction>::getFunction(getVector),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setPixels","",Class<IFunction>::getFunction(setPixels),NORMAL_METHOD,true); - 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); - c->setDeclaredMethodByQName("noise","",Class<IFunction>::getFunction(noise),NORMAL_METHOD,true); + c->addImplementedInterface(InterfaceClass<IBitmapDrawable>::getClass(c->getSystemState())); + c->setDeclaredMethodByQName("draw","",Class<IFunction>::getFunction(c->getSystemState(),draw),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("dispose","",Class<IFunction>::getFunction(c->getSystemState(),dispose),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getPixel","",Class<IFunction>::getFunction(c->getSystemState(),getPixel),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getPixel32","",Class<IFunction>::getFunction(c->getSystemState(),getPixel32),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setPixel","",Class<IFunction>::getFunction(c->getSystemState(),setPixel),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setPixel32","",Class<IFunction>::getFunction(c->getSystemState(),setPixel32),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("copyPixels","",Class<IFunction>::getFunction(c->getSystemState(),copyPixels),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("fillRect","",Class<IFunction>::getFunction(c->getSystemState(),fillRect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("generateFilterRect","",Class<IFunction>::getFunction(c->getSystemState(),generateFilterRect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("hitTest","",Class<IFunction>::getFunction(c->getSystemState(),hitTest),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("scroll","",Class<IFunction>::getFunction(c->getSystemState(),scroll),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(c->getSystemState(),clone),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("copyChannel","",Class<IFunction>::getFunction(c->getSystemState(),copyChannel),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lock","",Class<IFunction>::getFunction(c->getSystemState(),lock),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("unlock","",Class<IFunction>::getFunction(c->getSystemState(),unlock),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("floodFill","",Class<IFunction>::getFunction(c->getSystemState(),floodFill),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("histogram","",Class<IFunction>::getFunction(c->getSystemState(),histogram),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getColorBoundsRect","",Class<IFunction>::getFunction(c->getSystemState(),getColorBoundsRect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getPixels","",Class<IFunction>::getFunction(c->getSystemState(),getPixels),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getVector","",Class<IFunction>::getFunction(c->getSystemState(),getVector),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setPixels","",Class<IFunction>::getFunction(c->getSystemState(),setPixels),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setVector","",Class<IFunction>::getFunction(c->getSystemState(),setVector),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("colorTransform","",Class<IFunction>::getFunction(c->getSystemState(),colorTransform),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("compare","",Class<IFunction>::getFunction(c->getSystemState(),compare),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("applyFilter","",Class<IFunction>::getFunction(c->getSystemState(),applyFilter),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("noise","",Class<IFunction>::getFunction(c->getSystemState(),noise),NORMAL_METHOD,true); // properties - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_getHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("rect","",Class<IFunction>::getFunction(getRect),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(_getWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),_getHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("rect","",Class<IFunction>::getFunction(c->getSystemState(),getRect),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),_getWidth),GETTER_METHOD,true); REGISTER_GETTER(c,transparent); IBitmapDrawable::linkTraits(c); @@ -122,7 +122,7 @@ uint32_t fillColor; BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); ARG_UNPACK(width, 0)(height, 0)(transparent, true)(fillColor, 0xFFFFFFFF); ASObject::_constructor(obj,NULL,0); @@ -130,9 +130,9 @@ if(width==0 || height==0 || !th->pixels->isEmpty()) return NULL; if(width<0 || height<0) - throw Class<ArgumentError>::getInstanceS("invalid height or width", kInvalidArgumentError); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"invalid height or width", kInvalidArgumentError); if(width>8191 || height>8191) - throw Class<ArgumentError>::getInstanceS("invalid height or width", kInvalidArgumentError); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"invalid height or width", kInvalidArgumentError); uint32_t *pixelArray=new uint32_t[width*height]; uint32_t c=GUINT32_TO_BE(fillColor); // fromRGB expects big endian data @@ -190,7 +190,7 @@ { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); _NR<ASObject> drawable; _NR<Matrix> matrix; @@ -201,7 +201,7 @@ ARG_UNPACK (drawable) (matrix, NullRef) (ctransform, NullRef) (blendMode, NullRef) (clipRect, NullRef) (smoothing, false); - if(!drawable->getClass() || !drawable->getClass()->isSubClass(InterfaceClass<IBitmapDrawable>::getClass()) ) + if(!drawable->getClass() || !drawable->getClass()->isSubClass(InterfaceClass<IBitmapDrawable>::getClass(obj->getSystemState())) ) throwError<TypeError>(kCheckTypeFailedError, drawable->getClassName(), "IBitmapDrawable"); @@ -242,33 +242,33 @@ { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); int32_t x; int32_t y; ARG_UNPACK(x)(y); uint32_t pix=th->pixels->getPixel(x, y); - return abstract_ui(pix & 0xffffff); + return abstract_ui(obj->getSystemState(),pix & 0xffffff); } ASFUNCTIONBODY(BitmapData,getPixel32) { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); int32_t x; int32_t y; ARG_UNPACK(x)(y); uint32_t pix=th->pixels->getPixel(x, y); - return abstract_ui(pix); + return abstract_ui(obj->getSystemState(),pix); } ASFUNCTIONBODY(BitmapData,setPixel) { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); int32_t x; int32_t y; uint32_t color; @@ -283,7 +283,7 @@ { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); int32_t x; int32_t y; uint32_t color; @@ -298,8 +298,8 @@ { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); - Rectangle *rect=Class<Rectangle>::getInstanceS(); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); + Rectangle *rect=Class<Rectangle>::getInstanceS(obj->getSystemState()); rect->width=th->pixels->getWidth(); rect->height=th->pixels->getHeight(); return rect; @@ -309,16 +309,16 @@ { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); - return abstract_i(th->getHeight()); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); + return abstract_i(obj->getSystemState(),th->getHeight()); } ASFUNCTIONBODY(BitmapData,_getWidth) { BitmapData* th = obj->as<BitmapData>(); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); - return abstract_i(th->getWidth()); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); + return abstract_i(obj->getSystemState(),th->getWidth()); } ASFUNCTIONBODY(BitmapData,fillRect) @@ -329,7 +329,7 @@ ARG_UNPACK(rect)(color); if(th->pixels.isNull()) - throw Class<ArgumentError>::getInstanceS("Disposed BitmapData", 2015); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Disposed BitmapData", 2015); if (rect.isNull()) throwError<TypeError>(kNullPointerError, "rect"); @@ -350,7 +350,7 @@ ARG_UNPACK(source)(sourceRect)(destPoint)(alphaBitmapData, NullRef)(alphaPoint, NullRef)(mergeAlpha,false);
View file
lightspark.tar.xz/src/scripting/flash/display/DisplayObject.cpp
Changed
@@ -98,7 +98,7 @@ DisplayObject::DisplayObject(Class_base* c):EventDispatcher(c),tx(0),ty(0),rotation(0), sx(1),sy(1),alpha(1.0),maskOf(),parent(),constructed(false),useLegacyMatrix(true),onStage(false), - visible(true),mask(),invalidateQueueNext(),loaderInfo(),filters(Class<Array>::getInstanceS()),cacheAsBitmap(false) + visible(true),mask(),invalidateQueueNext(),loaderInfo(),filters(Class<Array>::getInstanceS(c->getSystemState())),cacheAsBitmap(false) { name = tiny_string("instance") + Integer::toString(ATOMIC_INCREMENT(instanceCount)); } @@ -119,56 +119,56 @@ void DisplayObject::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructorNotInstantiatable, CLASS_SEALED); - c->setDeclaredMethodByQName("loaderInfo","",Class<IFunction>::getFunction(_getLoaderInfo),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(_getWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(_setWidth),SETTER_METHOD,true); - c->setDeclaredMethodByQName("scaleX","",Class<IFunction>::getFunction(_getScaleX),GETTER_METHOD,true); - c->setDeclaredMethodByQName("scaleX","",Class<IFunction>::getFunction(_setScaleX),SETTER_METHOD,true); - c->setDeclaredMethodByQName("scaleY","",Class<IFunction>::getFunction(_getScaleY),GETTER_METHOD,true); - c->setDeclaredMethodByQName("scaleY","",Class<IFunction>::getFunction(_setScaleY),SETTER_METHOD,true); - c->setDeclaredMethodByQName("scaleZ","",Class<IFunction>::getFunction(_getScaleZ),GETTER_METHOD,true); - c->setDeclaredMethodByQName("scaleZ","",Class<IFunction>::getFunction(_setScaleZ),SETTER_METHOD,true); - c->setDeclaredMethodByQName("x","",Class<IFunction>::getFunction(_getX),GETTER_METHOD,true); - c->setDeclaredMethodByQName("x","",Class<IFunction>::getFunction(_setX),SETTER_METHOD,true); - c->setDeclaredMethodByQName("y","",Class<IFunction>::getFunction(_getY),GETTER_METHOD,true); - c->setDeclaredMethodByQName("y","",Class<IFunction>::getFunction(_setY),SETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_getHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_setHeight),SETTER_METHOD,true); - c->setDeclaredMethodByQName("visible","",Class<IFunction>::getFunction(_getVisible),GETTER_METHOD,true); - c->setDeclaredMethodByQName("visible","",Class<IFunction>::getFunction(_setVisible),SETTER_METHOD,true); - c->setDeclaredMethodByQName("rotation","",Class<IFunction>::getFunction(_getRotation),GETTER_METHOD,true); - c->setDeclaredMethodByQName("rotation","",Class<IFunction>::getFunction(_setRotation),SETTER_METHOD,true); - c->setDeclaredMethodByQName("name","",Class<IFunction>::getFunction(_getName),GETTER_METHOD,true); - c->setDeclaredMethodByQName("name","",Class<IFunction>::getFunction(_setName),SETTER_METHOD,true); - c->setDeclaredMethodByQName("parent","",Class<IFunction>::getFunction(_getParent),GETTER_METHOD,true); - c->setDeclaredMethodByQName("root","",Class<IFunction>::getFunction(_getRoot),GETTER_METHOD,true); - c->setDeclaredMethodByQName("blendMode","",Class<IFunction>::getFunction(_getBlendMode),GETTER_METHOD,true); - c->setDeclaredMethodByQName("blendMode","",Class<IFunction>::getFunction(_setBlendMode),SETTER_METHOD,true); - c->setDeclaredMethodByQName("scale9Grid","",Class<IFunction>::getFunction(_getScale9Grid),GETTER_METHOD,true); - c->setDeclaredMethodByQName("scale9Grid","",Class<IFunction>::getFunction(undefinedFunction),SETTER_METHOD,true); - c->setDeclaredMethodByQName("stage","",Class<IFunction>::getFunction(_getStage),GETTER_METHOD,true); - c->setDeclaredMethodByQName("mask","",Class<IFunction>::getFunction(_getMask),GETTER_METHOD,true); - c->setDeclaredMethodByQName("mask","",Class<IFunction>::getFunction(_setMask),SETTER_METHOD,true); - c->setDeclaredMethodByQName("alpha","",Class<IFunction>::getFunction(_getAlpha),GETTER_METHOD,true); - c->setDeclaredMethodByQName("alpha","",Class<IFunction>::getFunction(_setAlpha),SETTER_METHOD,true); - c->setDeclaredMethodByQName("opaqueBackground","",Class<IFunction>::getFunction(undefinedFunction),GETTER_METHOD,true); - c->setDeclaredMethodByQName("opaqueBackground","",Class<IFunction>::getFunction(undefinedFunction),SETTER_METHOD,true); - c->setDeclaredMethodByQName("getBounds","",Class<IFunction>::getFunction(_getBounds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getRect","",Class<IFunction>::getFunction(_getBounds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("mouseX","",Class<IFunction>::getFunction(_getMouseX),GETTER_METHOD,true); - c->setDeclaredMethodByQName("mouseY","",Class<IFunction>::getFunction(_getMouseY),GETTER_METHOD,true); - c->setDeclaredMethodByQName("localToGlobal","",Class<IFunction>::getFunction(localToGlobal),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("globalToLocal","",Class<IFunction>::getFunction(globalToLocal),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("hitTestObject","",Class<IFunction>::getFunction(hitTestObject),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("hitTestPoint","",Class<IFunction>::getFunction(hitTestPoint),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("transform","",Class<IFunction>::getFunction(_getTransform),GETTER_METHOD,true); - c->setDeclaredMethodByQName("transform","",Class<IFunction>::getFunction(_setTransform),SETTER_METHOD,true); + c->setDeclaredMethodByQName("loaderInfo","",Class<IFunction>::getFunction(c->getSystemState(),_getLoaderInfo),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),_getWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),_setWidth),SETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleX","",Class<IFunction>::getFunction(c->getSystemState(),_getScaleX),GETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleX","",Class<IFunction>::getFunction(c->getSystemState(),_setScaleX),SETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleY","",Class<IFunction>::getFunction(c->getSystemState(),_getScaleY),GETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleY","",Class<IFunction>::getFunction(c->getSystemState(),_setScaleY),SETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleZ","",Class<IFunction>::getFunction(c->getSystemState(),_getScaleZ),GETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleZ","",Class<IFunction>::getFunction(c->getSystemState(),_setScaleZ),SETTER_METHOD,true); + c->setDeclaredMethodByQName("x","",Class<IFunction>::getFunction(c->getSystemState(),_getX),GETTER_METHOD,true); + c->setDeclaredMethodByQName("x","",Class<IFunction>::getFunction(c->getSystemState(),_setX),SETTER_METHOD,true); + c->setDeclaredMethodByQName("y","",Class<IFunction>::getFunction(c->getSystemState(),_getY),GETTER_METHOD,true); + c->setDeclaredMethodByQName("y","",Class<IFunction>::getFunction(c->getSystemState(),_setY),SETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),_getHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),_setHeight),SETTER_METHOD,true); + c->setDeclaredMethodByQName("visible","",Class<IFunction>::getFunction(c->getSystemState(),_getVisible),GETTER_METHOD,true); + c->setDeclaredMethodByQName("visible","",Class<IFunction>::getFunction(c->getSystemState(),_setVisible),SETTER_METHOD,true); + c->setDeclaredMethodByQName("rotation","",Class<IFunction>::getFunction(c->getSystemState(),_getRotation),GETTER_METHOD,true); + c->setDeclaredMethodByQName("rotation","",Class<IFunction>::getFunction(c->getSystemState(),_setRotation),SETTER_METHOD,true); + c->setDeclaredMethodByQName("name","",Class<IFunction>::getFunction(c->getSystemState(),_getName),GETTER_METHOD,true); + c->setDeclaredMethodByQName("name","",Class<IFunction>::getFunction(c->getSystemState(),_setName),SETTER_METHOD,true); + c->setDeclaredMethodByQName("parent","",Class<IFunction>::getFunction(c->getSystemState(),_getParent),GETTER_METHOD,true); + c->setDeclaredMethodByQName("root","",Class<IFunction>::getFunction(c->getSystemState(),_getRoot),GETTER_METHOD,true); + c->setDeclaredMethodByQName("blendMode","",Class<IFunction>::getFunction(c->getSystemState(),_getBlendMode),GETTER_METHOD,true); + c->setDeclaredMethodByQName("blendMode","",Class<IFunction>::getFunction(c->getSystemState(),_setBlendMode),SETTER_METHOD,true); + c->setDeclaredMethodByQName("scale9Grid","",Class<IFunction>::getFunction(c->getSystemState(),_getScale9Grid),GETTER_METHOD,true); + c->setDeclaredMethodByQName("scale9Grid","",Class<IFunction>::getFunction(c->getSystemState(),undefinedFunction),SETTER_METHOD,true); + c->setDeclaredMethodByQName("stage","",Class<IFunction>::getFunction(c->getSystemState(),_getStage),GETTER_METHOD,true); + c->setDeclaredMethodByQName("mask","",Class<IFunction>::getFunction(c->getSystemState(),_getMask),GETTER_METHOD,true); + c->setDeclaredMethodByQName("mask","",Class<IFunction>::getFunction(c->getSystemState(),_setMask),SETTER_METHOD,true); + c->setDeclaredMethodByQName("alpha","",Class<IFunction>::getFunction(c->getSystemState(),_getAlpha),GETTER_METHOD,true); + c->setDeclaredMethodByQName("alpha","",Class<IFunction>::getFunction(c->getSystemState(),_setAlpha),SETTER_METHOD,true); + c->setDeclaredMethodByQName("opaqueBackground","",Class<IFunction>::getFunction(c->getSystemState(),undefinedFunction),GETTER_METHOD,true); + c->setDeclaredMethodByQName("opaqueBackground","",Class<IFunction>::getFunction(c->getSystemState(),undefinedFunction),SETTER_METHOD,true); + c->setDeclaredMethodByQName("getBounds","",Class<IFunction>::getFunction(c->getSystemState(),_getBounds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getRect","",Class<IFunction>::getFunction(c->getSystemState(),_getBounds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("mouseX","",Class<IFunction>::getFunction(c->getSystemState(),_getMouseX),GETTER_METHOD,true); + c->setDeclaredMethodByQName("mouseY","",Class<IFunction>::getFunction(c->getSystemState(),_getMouseY),GETTER_METHOD,true); + c->setDeclaredMethodByQName("localToGlobal","",Class<IFunction>::getFunction(c->getSystemState(),localToGlobal),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("globalToLocal","",Class<IFunction>::getFunction(c->getSystemState(),globalToLocal),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("hitTestObject","",Class<IFunction>::getFunction(c->getSystemState(),hitTestObject),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("hitTestPoint","",Class<IFunction>::getFunction(c->getSystemState(),hitTestPoint),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("transform","",Class<IFunction>::getFunction(c->getSystemState(),_getTransform),GETTER_METHOD,true); + c->setDeclaredMethodByQName("transform","",Class<IFunction>::getFunction(c->getSystemState(),_setTransform),SETTER_METHOD,true); REGISTER_GETTER_SETTER(c,accessibilityProperties); REGISTER_GETTER_SETTER(c,cacheAsBitmap); REGISTER_GETTER_SETTER(c,filters); REGISTER_GETTER_SETTER(c,scrollRect); - c->addImplementedInterface(InterfaceClass<IBitmapDrawable>::getClass()); + c->addImplementedInterface(InterfaceClass<IBitmapDrawable>::getClass(c->getSystemState())); IBitmapDrawable::linkTraits(c); } @@ -191,7 +191,7 @@ LOG(LOG_NOT_IMPLEMENTED, "DisplayObject::transform is a stub and does not reflect the real display state"); th->incRef(); - return Class<Transform>::getInstanceS(_MR(th)); + return Class<Transform>::getInstanceS(obj->getSystemState(),_MR(th)); } ASFUNCTIONBODY(DisplayObject,_setTransform) @@ -217,7 +217,7 @@ } } if(mustInvalidate && onStage) - requestInvalidation(getSys()); + requestInvalidation(getSystemState()); } void DisplayObject::setLegacyMatrix(const lightspark::MATRIX& m) @@ -250,7 +250,7 @@ } if(mustInvalidate && onStage) - requestInvalidation(getSys()); + requestInvalidation(getSystemState()); } MATRIX DisplayObject::getConcatenatedMatrix() const @@ -392,8 +392,8 @@ //Our stage condition changed, send event onStage=staged; if(staged==true) - requestInvalidation(getSys()); - if(getVm()==NULL) + requestInvalidation(getSystemState()); + if(getVm(getSystemState())==NULL) return; /*NOTE: By tests we can assert that added/addedToStage is dispatched immediately when addChild is called. On the other hand setOnStage may @@ -405,20 +405,20 @@ if(onStage==true) { this->incRef(); - _R<Event> e=_MR(Class<Event>::getInstanceS("addedToStage")); + _R<Event> e=_MR(Class<Event>::getInstanceS(getSystemState(),"addedToStage")); if(isVmThread()) ABCVm::publicHandleEvent(_MR(this),e); else - getVm()->addEvent(_MR(this),e); + getVm(getSystemState())->addEvent(_MR(this),e); } else if(onStage==false) { this->incRef(); - _R<Event> e=_MR(Class<Event>::getInstanceS("removedFromStage")); + _R<Event> e=_MR(Class<Event>::getInstanceS(getSystemState(),"removedFromStage")); if(isVmThread()) ABCVm::publicHandleEvent(_MR(this),e); else - getVm()->addEvent(_MR(this),e); + getVm(getSystemState())->addEvent(_MR(this),e); } } } @@ -432,21 +432,21 @@ * stored value even if it is outside the [0, 1] range. */ th->alpha=val; if(th->onStage) - th->requestInvalidation(getSys()); + th->requestInvalidation(obj->getSystemState()); return NULL; } ASFUNCTIONBODY(DisplayObject,_getAlpha) { DisplayObject* th=static_cast<DisplayObject*>(obj); - return abstract_d(th->alpha); + return abstract_d(obj->getSystemState(),th->alpha); } ASFUNCTIONBODY(DisplayObject,_getMask) { DisplayObject* th=Class<DisplayObject>::cast(obj); if(th->mask.isNull()) - return getSys()->getNullRef(); + return obj->getSystemState()->getNullRef(); th->mask->incRef(); return th->mask.getPtr(); @@ -456,7 +456,7 @@
View file
lightspark.tar.xz/src/scripting/flash/display/Graphics.cpp
Changed
@@ -36,27 +36,27 @@ void Graphics::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); - c->setDeclaredMethodByQName("clear","",Class<IFunction>::getFunction(clear),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("copyFrom","",Class<IFunction>::getFunction(copyFrom),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawRect","",Class<IFunction>::getFunction(drawRect),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawRoundRect","",Class<IFunction>::getFunction(drawRoundRect),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawRoundRectComplex","",Class<IFunction>::getFunction(drawRoundRectComplex),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawCircle","",Class<IFunction>::getFunction(drawCircle),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawEllipse","",Class<IFunction>::getFunction(drawEllipse),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawPath","",Class<IFunction>::getFunction(drawPath),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawTriangles","",Class<IFunction>::getFunction(drawTriangles),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("drawGraphicsData","",Class<IFunction>::getFunction(drawGraphicsData),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("moveTo","",Class<IFunction>::getFunction(moveTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("curveTo","",Class<IFunction>::getFunction(curveTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("cubicCurveTo","",Class<IFunction>::getFunction(cubicCurveTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lineTo","",Class<IFunction>::getFunction(lineTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lineBitmapStyle","",Class<IFunction>::getFunction(lineBitmapStyle),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lineGradientStyle","",Class<IFunction>::getFunction(lineGradientStyle),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lineStyle","",Class<IFunction>::getFunction(lineStyle),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("beginFill","",Class<IFunction>::getFunction(beginFill),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("beginGradientFill","",Class<IFunction>::getFunction(beginGradientFill),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("beginBitmapFill","",Class<IFunction>::getFunction(beginBitmapFill),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("endFill","",Class<IFunction>::getFunction(endFill),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("clear","",Class<IFunction>::getFunction(c->getSystemState(),clear),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("copyFrom","",Class<IFunction>::getFunction(c->getSystemState(),copyFrom),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawRect","",Class<IFunction>::getFunction(c->getSystemState(),drawRect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawRoundRect","",Class<IFunction>::getFunction(c->getSystemState(),drawRoundRect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawRoundRectComplex","",Class<IFunction>::getFunction(c->getSystemState(),drawRoundRectComplex),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawCircle","",Class<IFunction>::getFunction(c->getSystemState(),drawCircle),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawEllipse","",Class<IFunction>::getFunction(c->getSystemState(),drawEllipse),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawPath","",Class<IFunction>::getFunction(c->getSystemState(),drawPath),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawTriangles","",Class<IFunction>::getFunction(c->getSystemState(),drawTriangles),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("drawGraphicsData","",Class<IFunction>::getFunction(c->getSystemState(),drawGraphicsData),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("moveTo","",Class<IFunction>::getFunction(c->getSystemState(),moveTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("curveTo","",Class<IFunction>::getFunction(c->getSystemState(),curveTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("cubicCurveTo","",Class<IFunction>::getFunction(c->getSystemState(),cubicCurveTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lineTo","",Class<IFunction>::getFunction(c->getSystemState(),lineTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lineBitmapStyle","",Class<IFunction>::getFunction(c->getSystemState(),lineBitmapStyle),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lineGradientStyle","",Class<IFunction>::getFunction(c->getSystemState(),lineGradientStyle),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lineStyle","",Class<IFunction>::getFunction(c->getSystemState(),lineStyle),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("beginFill","",Class<IFunction>::getFunction(c->getSystemState(),beginFill),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("beginGradientFill","",Class<IFunction>::getFunction(c->getSystemState(),beginGradientFill),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("beginBitmapFill","",Class<IFunction>::getFunction(c->getSystemState(),beginBitmapFill),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("endFill","",Class<IFunction>::getFunction(c->getSystemState(),endFill),NORMAL_METHOD,true); } void Graphics::buildTraits(ASObject* o) @@ -83,7 +83,7 @@ Graphics* th=static_cast<Graphics*>(obj); th->checkAndSetScaling(); th->owner->tokens.clear(); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -110,7 +110,7 @@ int y=args[1]->toInt(); th->owner->tokens.emplace_back(GeomToken(STRAIGHT, Vector2(x, y))); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -130,7 +130,7 @@ th->owner->tokens.emplace_back(GeomToken(CURVE_QUADRATIC, Vector2(controlX, controlY), Vector2(anchorX, anchorY))); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -154,7 +154,7 @@ Vector2(control1X, control1Y), Vector2(control2X, control2Y), Vector2(anchorX, anchorY))); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -243,7 +243,7 @@ // C -> D th->owner->tokens.emplace_back(GeomToken(STRAIGHT, Vector2(x+width, y+height-ellipseHeight))); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -270,7 +270,7 @@ th->owner->tokens.emplace_back(GeomToken(STRAIGHT, c)); th->owner->tokens.emplace_back(GeomToken(STRAIGHT, d)); th->owner->tokens.emplace_back(GeomToken(STRAIGHT, a)); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -314,7 +314,7 @@ Vector2(x+radius, y-kappa ), Vector2(x+radius, y ))); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -360,7 +360,7 @@ Vector2(left+width, top+height/2-ykappa), Vector2(left+width, top+height/2))); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -386,7 +386,7 @@ th->owner->tokens.emplace_back(GeomToken(STRAIGHT, c)); th->owner->tokens.emplace_back(GeomToken(STRAIGHT, d)); th->owner->tokens.emplace_back(GeomToken(STRAIGHT, a)); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -406,7 +406,7 @@ pathToTokens(commands, data, winding, th->owner->tokens); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -420,8 +420,8 @@ if (winding != "evenOdd") LOG(LOG_NOT_IMPLEMENTED, "Only event-odd winding implemented in Graphics.drawPath"); - _R<Number> zeroRef = _MR(Class<Number>::getInstanceS(0)); - Number *zero = zeroRef.getPtr(); + _R<ASObject> zeroRef = _MR(abstract_d(commands->getSystemState(),0)); + ASObject *zero = zeroRef.getPtr(); int k = 0; for (unsigned int i=0; i<commands->size(); i++) @@ -547,7 +547,7 @@ ARG_UNPACK (vertices) (indices, NullRef) (uvtData, NullRef) (culling, "none"); drawTrianglesToTokens(vertices, indices, uvtData, culling, th->owner->tokens); - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; } @@ -683,7 +683,7 @@ graphElement->appendToTokens(th->owner->tokens); } - th->owner->owner->requestInvalidation(getSys()); + th->owner->owner->requestInvalidation(obj->getSystemState()); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsBitmapFill.cpp
Changed
@@ -39,9 +39,9 @@ REGISTER_GETTER_SETTER(c, repeat); REGISTER_GETTER_SETTER(c, smooth); - c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass(c->getSystemState())); IGraphicsFill::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsEndFill.cpp
Changed
@@ -30,9 +30,9 @@ void GraphicsEndFill::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); - c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass(c->getSystemState())); IGraphicsFill::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsGradientFill.cpp
Changed
@@ -45,9 +45,9 @@ REGISTER_GETTER_SETTER(c, spreadMethod); REGISTER_GETTER_SETTER(c, type); - c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass(c->getSystemState())); IGraphicsFill::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsPath.cpp
Changed
@@ -36,15 +36,15 @@ REGISTER_GETTER_SETTER(c, commands); REGISTER_GETTER_SETTER(c, data); REGISTER_GETTER_SETTER(c, winding); - c->setDeclaredMethodByQName("curveTo","",Class<IFunction>::getFunction(curveTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lineTo","",Class<IFunction>::getFunction(lineTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("moveTo","",Class<IFunction>::getFunction(moveTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("wideLineTo","",Class<IFunction>::getFunction(wideLineTo),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("wideMoveTo","",Class<IFunction>::getFunction(wideMoveTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("curveTo","",Class<IFunction>::getFunction(c->getSystemState(),curveTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lineTo","",Class<IFunction>::getFunction(c->getSystemState(),lineTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("moveTo","",Class<IFunction>::getFunction(c->getSystemState(),moveTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("wideLineTo","",Class<IFunction>::getFunction(c->getSystemState(),wideLineTo),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("wideMoveTo","",Class<IFunction>::getFunction(c->getSystemState(),wideMoveTo),NORMAL_METHOD,true); - c->addImplementedInterface(InterfaceClass<IGraphicsPath>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsPath>::getClass(c->getSystemState())); IGraphicsPath::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); } @@ -79,9 +79,9 @@ void GraphicsPath::ensureValid() { if (commands.isNull()) - commands = _MNR(Template<Vector>::getInstanceS(Class<Integer>::getClass(),NullRef)); + commands = _MNR(Template<Vector>::getInstanceS(getSystemState(),Class<Integer>::getClass(getSystemState()),NullRef)); if (data.isNull()) - data = _MNR(Template<Vector>::getInstanceS(Class<Number>::getClass(),NullRef)); + data = _MNR(Template<Vector>::getInstanceS(getSystemState(),Class<Number>::getClass(getSystemState()),NullRef)); } ASFUNCTIONBODY(GraphicsPath, curveTo) @@ -94,11 +94,11 @@ ARG_UNPACK (cx) (cy) (ax) (ay); th->ensureValid(); - th->commands->append(abstract_i(GraphicsPathCommand::CURVE_TO)); - th->data->append(abstract_d(ax)); - th->data->append(abstract_d(ay)); - th->data->append(abstract_d(cx)); - th->data->append(abstract_d(cy)); + th->commands->append(abstract_i(obj->getSystemState(),GraphicsPathCommand::CURVE_TO)); + th->data->append(abstract_d(obj->getSystemState(),ax)); + th->data->append(abstract_d(obj->getSystemState(),ay)); + th->data->append(abstract_d(obj->getSystemState(),cx)); + th->data->append(abstract_d(obj->getSystemState(),cy)); return NULL; } @@ -111,9 +111,9 @@ ARG_UNPACK (x) (y); th->ensureValid(); - th->commands->append(abstract_i(GraphicsPathCommand::LINE_TO)); - th->data->append(abstract_d(x)); - th->data->append(abstract_d(y)); + th->commands->append(abstract_i(obj->getSystemState(),GraphicsPathCommand::LINE_TO)); + th->data->append(abstract_d(obj->getSystemState(),x)); + th->data->append(abstract_d(obj->getSystemState(),y)); return NULL; } @@ -126,9 +126,9 @@ ARG_UNPACK (x) (y); th->ensureValid(); - th->commands->append(abstract_i(GraphicsPathCommand::MOVE_TO)); - th->data->append(abstract_d(x)); - th->data->append(abstract_d(y)); + th->commands->append(abstract_i(obj->getSystemState(),GraphicsPathCommand::MOVE_TO)); + th->data->append(abstract_d(obj->getSystemState(),x)); + th->data->append(abstract_d(obj->getSystemState(),y)); return NULL; } @@ -141,11 +141,11 @@ ARG_UNPACK (x) (y); th->ensureValid(); - th->commands->append(abstract_i(GraphicsPathCommand::LINE_TO)); - th->data->append(abstract_d(0)); - th->data->append(abstract_d(0)); - th->data->append(abstract_d(x)); - th->data->append(abstract_d(y)); + th->commands->append(abstract_i(obj->getSystemState(),GraphicsPathCommand::LINE_TO)); + th->data->append(abstract_d(obj->getSystemState(),0)); + th->data->append(abstract_d(obj->getSystemState(),0)); + th->data->append(abstract_d(obj->getSystemState(),x)); + th->data->append(abstract_d(obj->getSystemState(),y)); return NULL; } @@ -158,11 +158,11 @@ ARG_UNPACK (x) (y); th->ensureValid(); - th->commands->append(abstract_i(GraphicsPathCommand::MOVE_TO)); - th->data->append(abstract_d(0)); - th->data->append(abstract_d(0)); - th->data->append(abstract_d(x)); - th->data->append(abstract_d(y)); + th->commands->append(abstract_i(obj->getSystemState(),GraphicsPathCommand::MOVE_TO)); + th->data->append(abstract_d(obj->getSystemState(),0)); + th->data->append(abstract_d(obj->getSystemState(),0)); + th->data->append(abstract_d(obj->getSystemState(),x)); + th->data->append(abstract_d(obj->getSystemState(),y)); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsShaderFill.cpp
Changed
@@ -36,9 +36,9 @@ REGISTER_GETTER_SETTER(c, matrix); REGISTER_GETTER_SETTER(c, shader); - c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass(c->getSystemState())); IGraphicsFill::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsSolidFill.cpp
Changed
@@ -35,9 +35,9 @@ REGISTER_GETTER_SETTER(c, alpha); REGISTER_GETTER_SETTER(c, color); - c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsFill>::getClass(c->getSystemState())); IGraphicsFill::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsStroke.cpp
Changed
@@ -44,9 +44,9 @@ REGISTER_GETTER_SETTER(c, scaleMode); REGISTER_GETTER_SETTER(c, thickness); - c->addImplementedInterface(InterfaceClass<IGraphicsStroke>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsStroke>::getClass(c->getSystemState())); IGraphicsStroke::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); }
View file
lightspark.tar.xz/src/scripting/flash/display/GraphicsTrianglePath.cpp
Changed
@@ -38,9 +38,9 @@ REGISTER_GETTER_SETTER(c, uvtData); REGISTER_GETTER_SETTER(c, vertices); - c->addImplementedInterface(InterfaceClass<IGraphicsPath>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsPath>::getClass(c->getSystemState())); IGraphicsPath::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass()); + c->addImplementedInterface(InterfaceClass<IGraphicsData>::getClass(c->getSystemState())); IGraphicsData::linkTraits(c); }
View file
lightspark.tar.xz/src/scripting/flash/display/TokenContainer.cpp
Changed
@@ -25,12 +25,12 @@ using namespace lightspark; using namespace std; -TokenContainer::TokenContainer(DisplayObject* _o) : owner(_o),tokens(reporter_allocator<GeomToken>(getSys()->unaccountedMemory)), scaling(1.0f) +TokenContainer::TokenContainer(DisplayObject* _o) : owner(_o),tokens(reporter_allocator<GeomToken>(_o->getSystemState()->unaccountedMemory)), scaling(1.0f) { } TokenContainer::TokenContainer(DisplayObject* _o, const tokensVector& _tokens, float _scaling) : - owner(_o), tokens(_tokens.begin(),_tokens.end(),reporter_allocator<GeomToken>(getSys()->unaccountedMemory)), scaling(_scaling) + owner(_o), tokens(_tokens.begin(),_tokens.end(),reporter_allocator<GeomToken>(_o->getSystemState()->unaccountedMemory)), scaling(_scaling) { }
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.cpp
Changed
@@ -57,9 +57,9 @@ loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0), childAllowsParent(true),uncaughtErrorEvents(NullRef),parentAllowsChild(true),frameRate(0) { - sharedEvents=_MR(Class<EventDispatcher>::getInstanceS()); - parameters = _MR(Class<ASObject>::getInstanceS()); - uncaughtErrorEvents = _MR(Class<UncaughtErrorEvents>::getInstanceS()); + sharedEvents=_MR(Class<EventDispatcher>::getInstanceS(c->getSystemState())); + parameters = _MR(Class<ASObject>::getInstanceS(c->getSystemState())); + uncaughtErrorEvents = _MR(Class<UncaughtErrorEvents>::getInstanceS(c->getSystemState())); LOG(LOG_NOT_IMPLEMENTED,"LoaderInfo: childAllowsParent and parentAllowsChild always return true"); } @@ -69,9 +69,9 @@ loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0), childAllowsParent(true),uncaughtErrorEvents(NullRef),parentAllowsChild(true),frameRate(0) { - sharedEvents=_MR(Class<EventDispatcher>::getInstanceS()); - parameters = _MR(Class<ASObject>::getInstanceS()); - uncaughtErrorEvents = _MR(Class<UncaughtErrorEvents>::getInstanceS()); + sharedEvents=_MR(Class<EventDispatcher>::getInstanceS(c->getSystemState())); + parameters = _MR(Class<ASObject>::getInstanceS(c->getSystemState())); + uncaughtErrorEvents = _MR(Class<UncaughtErrorEvents>::getInstanceS(c->getSystemState())); LOG(LOG_NOT_IMPLEMENTED,"LoaderInfo: childAllowsParent and parentAllowsChild always return true"); } @@ -79,17 +79,17 @@ { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); c->isReusable = true; - c->setDeclaredMethodByQName("loaderURL","",Class<IFunction>::getFunction(_getLoaderURL),GETTER_METHOD,true); - c->setDeclaredMethodByQName("loader","",Class<IFunction>::getFunction(_getLoader),GETTER_METHOD,true); - c->setDeclaredMethodByQName("content","",Class<IFunction>::getFunction(_getContent),GETTER_METHOD,true); - c->setDeclaredMethodByQName("url","",Class<IFunction>::getFunction(_getURL),GETTER_METHOD,true); - c->setDeclaredMethodByQName("bytesLoaded","",Class<IFunction>::getFunction(_getBytesLoaded),GETTER_METHOD,true); - c->setDeclaredMethodByQName("bytesTotal","",Class<IFunction>::getFunction(_getBytesTotal),GETTER_METHOD,true); - c->setDeclaredMethodByQName("bytes","",Class<IFunction>::getFunction(_getBytes),GETTER_METHOD,true); - c->setDeclaredMethodByQName("applicationDomain","",Class<IFunction>::getFunction(_getApplicationDomain),GETTER_METHOD,true); - c->setDeclaredMethodByQName("sharedEvents","",Class<IFunction>::getFunction(_getSharedEvents),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(_getWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_getHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("loaderURL","",Class<IFunction>::getFunction(c->getSystemState(),_getLoaderURL),GETTER_METHOD,true); + c->setDeclaredMethodByQName("loader","",Class<IFunction>::getFunction(c->getSystemState(),_getLoader),GETTER_METHOD,true); + c->setDeclaredMethodByQName("content","",Class<IFunction>::getFunction(c->getSystemState(),_getContent),GETTER_METHOD,true); + c->setDeclaredMethodByQName("url","",Class<IFunction>::getFunction(c->getSystemState(),_getURL),GETTER_METHOD,true); + c->setDeclaredMethodByQName("bytesLoaded","",Class<IFunction>::getFunction(c->getSystemState(),_getBytesLoaded),GETTER_METHOD,true); + c->setDeclaredMethodByQName("bytesTotal","",Class<IFunction>::getFunction(c->getSystemState(),_getBytesTotal),GETTER_METHOD,true); + c->setDeclaredMethodByQName("bytes","",Class<IFunction>::getFunction(c->getSystemState(),_getBytes),GETTER_METHOD,true); + c->setDeclaredMethodByQName("applicationDomain","",Class<IFunction>::getFunction(c->getSystemState(),_getApplicationDomain),GETTER_METHOD,true); + c->setDeclaredMethodByQName("sharedEvents","",Class<IFunction>::getFunction(c->getSystemState(),_getSharedEvents),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),_getWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),_getHeight),GETTER_METHOD,true); REGISTER_GETTER(c,parameters); REGISTER_GETTER(c,actionScriptVersion); REGISTER_GETTER(c,swfVersion); @@ -152,18 +152,18 @@ { SpinlockLocker l(spinlock); bytesLoaded=b; - if(getVm()) + if(getVm(getSystemState())) { this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<ProgressEvent>::getInstanceS(bytesLoaded,bytesTotal))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<ProgressEvent>::getInstanceS(getSystemState(),bytesLoaded,bytesTotal))); } if(loadStatus==INIT_SENT) { //The clip is also complete now - if(getVm()) + if(getVm(getSystemState())) { this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("complete"))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<Event>::getInstanceS(getSystemState(),"complete"))); } loadStatus=COMPLETE; } @@ -173,14 +173,14 @@ void LoaderInfo::sendInit() { this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("init"))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<Event>::getInstanceS(getSystemState(),"init"))); assert(loadStatus==STARTED); loadStatus=INIT_SENT; if(bytesTotal && bytesLoaded==bytesTotal) { //The clip is also complete now this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("complete"))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<Event>::getInstanceS(getSystemState(),"complete"))); loadStatus=COMPLETE; } } @@ -214,14 +214,14 @@ //uses AS3. See specs. if (setParameters) { - parameters = _MR(Class<ASObject>::getInstanceS()); + parameters = _MR(Class<ASObject>::getInstanceS(getSystemState())); SystemState::parseParametersFromURLIntoObject(url, parameters); } } ASFUNCTIONBODY(LoaderInfo,_constructor) { - LoaderInfo* th=static_cast<LoaderInfo*>(obj); + //LoaderInfo* th=static_cast<LoaderInfo*>(obj); EventDispatcher::_constructor(obj,NULL,0); return NULL; } @@ -229,7 +229,7 @@ ASFUNCTIONBODY(LoaderInfo,_getLoaderURL) { LoaderInfo* th=static_cast<LoaderInfo*>(obj); - return abstract_s(th->loaderURL); + return abstract_s(obj->getSystemState(),th->loaderURL); } ASFUNCTIONBODY(LoaderInfo,_getContent) @@ -237,7 +237,7 @@ //Use Loader::getContent LoaderInfo* th=static_cast<LoaderInfo*>(obj); if(th->loader.isNull()) - return getSys()->getUndefinedRef(); + return obj->getSystemState()->getUndefinedRef(); else return Loader::_getContent(th->loader.getPtr(),NULL,0); } @@ -246,7 +246,7 @@ { LoaderInfo* th=static_cast<LoaderInfo*>(obj); if(th->loader.isNull()) - return getSys()->getUndefinedRef(); + return obj->getSystemState()->getUndefinedRef(); else { th->loader->incRef(); @@ -264,26 +264,26 @@ ASFUNCTIONBODY(LoaderInfo,_getURL) { LoaderInfo* th=static_cast<LoaderInfo*>(obj); - return abstract_s(th->url); + return abstract_s(obj->getSystemState(),th->url); } ASFUNCTIONBODY(LoaderInfo,_getBytesLoaded) { LoaderInfo* th=static_cast<LoaderInfo*>(obj); - return abstract_i(th->bytesLoaded); + return abstract_i(obj->getSystemState(),th->bytesLoaded); } ASFUNCTIONBODY(LoaderInfo,_getBytesTotal) { LoaderInfo* th=static_cast<LoaderInfo*>(obj); - return abstract_i(th->bytesTotal); + return abstract_i(obj->getSystemState(),th->bytesTotal); } ASFUNCTIONBODY(LoaderInfo,_getBytes) { LoaderInfo* th=static_cast<LoaderInfo*>(obj); if (th->bytesData.isNull()) - th->bytesData = _NR<ByteArray>(Class<ByteArray>::getInstanceS()); + th->bytesData = _NR<ByteArray>(Class<ByteArray>::getInstanceS(obj->getSystemState())); if (!th->loader->getContent().isNull()) th->bytesData->writeObject(th->loader->getContent().getPtr()); @@ -294,7 +294,7 @@ { LoaderInfo* th=static_cast<LoaderInfo*>(obj); if(th->applicationDomain.isNull()) - return getSys()->getNullRef(); + return obj->getSystemState()->getNullRef(); th->applicationDomain->incRef(); return th->applicationDomain.getPtr(); @@ -305,12 +305,12 @@ LoaderInfo* th=static_cast<LoaderInfo*>(obj); _NR<Loader> l = th->loader; if(l.isNull()) - return abstract_d(0); + return abstract_d(obj->getSystemState(),0); _NR<DisplayObject> o=l->getContent(); if (o.isNull()) - return abstract_d(0); + return abstract_d(obj->getSystemState(),0); - return abstract_d(o->getNominalWidth()); + return abstract_d(obj->getSystemState(),o->getNominalWidth()); } ASFUNCTIONBODY(LoaderInfo,_getHeight) @@ -318,12 +318,12 @@ LoaderInfo* th=static_cast<LoaderInfo*>(obj); _NR<Loader> l = th->loader; if(l.isNull()) - return abstract_d(0);
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.cpp
Changed
@@ -50,62 +50,62 @@ void Event::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); - c->setVariableByQName("ACTIVATE","",Class<ASString>::getInstanceS("activate"),DECLARED_TRAIT); - c->setVariableByQName("ADDED","",Class<ASString>::getInstanceS("added"),DECLARED_TRAIT); - c->setVariableByQName("ADDED_TO_STAGE","",Class<ASString>::getInstanceS("addedToStage"),DECLARED_TRAIT); - c->setVariableByQName("CANCEL","",Class<ASString>::getInstanceS("cancel"),DECLARED_TRAIT); - c->setVariableByQName("CHANGE","",Class<ASString>::getInstanceS("change"),DECLARED_TRAIT); - c->setVariableByQName("CLEAR","",Class<ASString>::getInstanceS("clear"),DECLARED_TRAIT); - c->setVariableByQName("CLOSE","",Class<ASString>::getInstanceS("close"),DECLARED_TRAIT); - c->setVariableByQName("CLOSING","",Class<ASString>::getInstanceS("closing"),DECLARED_TRAIT); - c->setVariableByQName("COMPLETE","",Class<ASString>::getInstanceS("complete"),DECLARED_TRAIT); - c->setVariableByQName("CONNECT","",Class<ASString>::getInstanceS("connect"),DECLARED_TRAIT); - c->setVariableByQName("CONTEXT3D_CREATE","",Class<ASString>::getInstanceS("context3DCreate"),DECLARED_TRAIT); - c->setVariableByQName("COPY","",Class<ASString>::getInstanceS("copy"),DECLARED_TRAIT); - c->setVariableByQName("CUT","",Class<ASString>::getInstanceS("cut"),DECLARED_TRAIT); - c->setVariableByQName("DEACTIVATE","",Class<ASString>::getInstanceS("deactivate"),DECLARED_TRAIT); - c->setVariableByQName("DISPLAYING","",Class<ASString>::getInstanceS("displaying"),DECLARED_TRAIT); - c->setVariableByQName("ENTER_FRAME","",Class<ASString>::getInstanceS("enterFrame"),DECLARED_TRAIT); - c->setVariableByQName("EXIT_FRAME","",Class<ASString>::getInstanceS("exitFrame"),DECLARED_TRAIT); - c->setVariableByQName("EXITING","",Class<ASString>::getInstanceS("exiting"),DECLARED_TRAIT); - c->setVariableByQName("FRAME_CONSTRUCTED","",Class<ASString>::getInstanceS("frameConstructed"),DECLARED_TRAIT); - c->setVariableByQName("FULLSCREEN","",Class<ASString>::getInstanceS("fullScreen"),DECLARED_TRAIT); - c->setVariableByQName("HTML_BOUNDS_CHANGE","",Class<ASString>::getInstanceS("htmlBoundsChange"),DECLARED_TRAIT); - c->setVariableByQName("HTML_DOM_INITIALIZE","",Class<ASString>::getInstanceS("htmlDOMInitialize"),DECLARED_TRAIT); - c->setVariableByQName("HTML_RENDER","",Class<ASString>::getInstanceS("htmlRender"),DECLARED_TRAIT); - c->setVariableByQName("ID3","",Class<ASString>::getInstanceS("id3"),DECLARED_TRAIT); - c->setVariableByQName("INIT","",Class<ASString>::getInstanceS("init"),DECLARED_TRAIT); - c->setVariableByQName("LOCATION_CHANGE","",Class<ASString>::getInstanceS("locationChange"),DECLARED_TRAIT); - c->setVariableByQName("MOUSE_LEAVE","",Class<ASString>::getInstanceS("mouseLeave"),DECLARED_TRAIT); - c->setVariableByQName("NETWORK_CHANGE","",Class<ASString>::getInstanceS("networkChange"),DECLARED_TRAIT); - c->setVariableByQName("OPEN","",Class<ASString>::getInstanceS("open"),DECLARED_TRAIT); - c->setVariableByQName("PASTE","",Class<ASString>::getInstanceS("paste"),DECLARED_TRAIT); - c->setVariableByQName("REMOVED","",Class<ASString>::getInstanceS("removed"),DECLARED_TRAIT); - c->setVariableByQName("REMOVED_FROM_STAGE","",Class<ASString>::getInstanceS("removedFromStage"),DECLARED_TRAIT); - c->setVariableByQName("RENDER","",Class<ASString>::getInstanceS("render"),DECLARED_TRAIT); - c->setVariableByQName("RESIZE","",Class<ASString>::getInstanceS("resize"),DECLARED_TRAIT); - c->setVariableByQName("SCROLL","",Class<ASString>::getInstanceS("scroll"),DECLARED_TRAIT); - c->setVariableByQName("SELECT","",Class<ASString>::getInstanceS("select"),DECLARED_TRAIT); - c->setVariableByQName("SELECT_ALL","",Class<ASString>::getInstanceS("selectAll"),DECLARED_TRAIT); - c->setVariableByQName("SOUND_COMPLETE","",Class<ASString>::getInstanceS("soundComplete"),DECLARED_TRAIT); - c->setVariableByQName("STANDARD_ERROR_CLOSE","",Class<ASString>::getInstanceS("standardErrorClose"),DECLARED_TRAIT); - c->setVariableByQName("STANDARD_INPUT_CLOSE","",Class<ASString>::getInstanceS("standardInputClose"),DECLARED_TRAIT); - c->setVariableByQName("STANDARD_OUTPUT_CLOSE","",Class<ASString>::getInstanceS("standardOutputClose"),DECLARED_TRAIT); - c->setVariableByQName("TAB_CHILDREN_CHANGE","",Class<ASString>::getInstanceS("tabChildrenChange"),DECLARED_TRAIT); - c->setVariableByQName("TAB_ENABLED_CHANGE","",Class<ASString>::getInstanceS("tabEnabledChange"),DECLARED_TRAIT); - c->setVariableByQName("TAB_INDEX_CHANGE","",Class<ASString>::getInstanceS("tabIndexChange"),DECLARED_TRAIT); - c->setVariableByQName("TEXT_INTERACTION_MODE_CHANGE","",Class<ASString>::getInstanceS("textInteractionModeChange"),DECLARED_TRAIT); - c->setVariableByQName("TEXTURE_READY","",Class<ASString>::getInstanceS("textureReady"),DECLARED_TRAIT); - c->setVariableByQName("UNLOAD","",Class<ASString>::getInstanceS("unload"),DECLARED_TRAIT); - c->setVariableByQName("USER_IDLE","",Class<ASString>::getInstanceS("userIdle"),DECLARED_TRAIT); - c->setVariableByQName("USER_PRESENT","",Class<ASString>::getInstanceS("userPresent"),DECLARED_TRAIT); - - c->setDeclaredMethodByQName("formatToString","",Class<IFunction>::getFunction(formatToString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("isDefaultPrevented","",Class<IFunction>::getFunction(_isDefaultPrevented),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("preventDefault","",Class<IFunction>::getFunction(_preventDefault),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(clone),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("stopPropagation","",Class<IFunction>::getFunction(stopPropagation),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("stopImmediatePropagation","",Class<IFunction>::getFunction(stopImmediatePropagation),NORMAL_METHOD,true); + c->setVariableByQName("ACTIVATE","",abstract_s(c->getSystemState(),"activate"),DECLARED_TRAIT); + c->setVariableByQName("ADDED","",abstract_s(c->getSystemState(),"added"),DECLARED_TRAIT); + c->setVariableByQName("ADDED_TO_STAGE","",abstract_s(c->getSystemState(),"addedToStage"),DECLARED_TRAIT); + c->setVariableByQName("CANCEL","",abstract_s(c->getSystemState(),"cancel"),DECLARED_TRAIT); + c->setVariableByQName("CHANGE","",abstract_s(c->getSystemState(),"change"),DECLARED_TRAIT); + c->setVariableByQName("CLEAR","",abstract_s(c->getSystemState(),"clear"),DECLARED_TRAIT); + c->setVariableByQName("CLOSE","",abstract_s(c->getSystemState(),"close"),DECLARED_TRAIT); + c->setVariableByQName("CLOSING","",abstract_s(c->getSystemState(),"closing"),DECLARED_TRAIT); + c->setVariableByQName("COMPLETE","",abstract_s(c->getSystemState(),"complete"),DECLARED_TRAIT); + c->setVariableByQName("CONNECT","",abstract_s(c->getSystemState(),"connect"),DECLARED_TRAIT); + c->setVariableByQName("CONTEXT3D_CREATE","",abstract_s(c->getSystemState(),"context3DCreate"),DECLARED_TRAIT); + c->setVariableByQName("COPY","",abstract_s(c->getSystemState(),"copy"),DECLARED_TRAIT); + c->setVariableByQName("CUT","",abstract_s(c->getSystemState(),"cut"),DECLARED_TRAIT); + c->setVariableByQName("DEACTIVATE","",abstract_s(c->getSystemState(),"deactivate"),DECLARED_TRAIT); + c->setVariableByQName("DISPLAYING","",abstract_s(c->getSystemState(),"displaying"),DECLARED_TRAIT); + c->setVariableByQName("ENTER_FRAME","",abstract_s(c->getSystemState(),"enterFrame"),DECLARED_TRAIT); + c->setVariableByQName("EXIT_FRAME","",abstract_s(c->getSystemState(),"exitFrame"),DECLARED_TRAIT); + c->setVariableByQName("EXITING","",abstract_s(c->getSystemState(),"exiting"),DECLARED_TRAIT); + c->setVariableByQName("FRAME_CONSTRUCTED","",abstract_s(c->getSystemState(),"frameConstructed"),DECLARED_TRAIT); + c->setVariableByQName("FULLSCREEN","",abstract_s(c->getSystemState(),"fullScreen"),DECLARED_TRAIT); + c->setVariableByQName("HTML_BOUNDS_CHANGE","",abstract_s(c->getSystemState(),"htmlBoundsChange"),DECLARED_TRAIT); + c->setVariableByQName("HTML_DOM_INITIALIZE","",abstract_s(c->getSystemState(),"htmlDOMInitialize"),DECLARED_TRAIT); + c->setVariableByQName("HTML_RENDER","",abstract_s(c->getSystemState(),"htmlRender"),DECLARED_TRAIT); + c->setVariableByQName("ID3","",abstract_s(c->getSystemState(),"id3"),DECLARED_TRAIT); + c->setVariableByQName("INIT","",abstract_s(c->getSystemState(),"init"),DECLARED_TRAIT); + c->setVariableByQName("LOCATION_CHANGE","",abstract_s(c->getSystemState(),"locationChange"),DECLARED_TRAIT); + c->setVariableByQName("MOUSE_LEAVE","",abstract_s(c->getSystemState(),"mouseLeave"),DECLARED_TRAIT); + c->setVariableByQName("NETWORK_CHANGE","",abstract_s(c->getSystemState(),"networkChange"),DECLARED_TRAIT); + c->setVariableByQName("OPEN","",abstract_s(c->getSystemState(),"open"),DECLARED_TRAIT); + c->setVariableByQName("PASTE","",abstract_s(c->getSystemState(),"paste"),DECLARED_TRAIT); + c->setVariableByQName("REMOVED","",abstract_s(c->getSystemState(),"removed"),DECLARED_TRAIT); + c->setVariableByQName("REMOVED_FROM_STAGE","",abstract_s(c->getSystemState(),"removedFromStage"),DECLARED_TRAIT); + c->setVariableByQName("RENDER","",abstract_s(c->getSystemState(),"render"),DECLARED_TRAIT); + c->setVariableByQName("RESIZE","",abstract_s(c->getSystemState(),"resize"),DECLARED_TRAIT); + c->setVariableByQName("SCROLL","",abstract_s(c->getSystemState(),"scroll"),DECLARED_TRAIT); + c->setVariableByQName("SELECT","",abstract_s(c->getSystemState(),"select"),DECLARED_TRAIT); + c->setVariableByQName("SELECT_ALL","",abstract_s(c->getSystemState(),"selectAll"),DECLARED_TRAIT); + c->setVariableByQName("SOUND_COMPLETE","",abstract_s(c->getSystemState(),"soundComplete"),DECLARED_TRAIT); + c->setVariableByQName("STANDARD_ERROR_CLOSE","",abstract_s(c->getSystemState(),"standardErrorClose"),DECLARED_TRAIT); + c->setVariableByQName("STANDARD_INPUT_CLOSE","",abstract_s(c->getSystemState(),"standardInputClose"),DECLARED_TRAIT); + c->setVariableByQName("STANDARD_OUTPUT_CLOSE","",abstract_s(c->getSystemState(),"standardOutputClose"),DECLARED_TRAIT); + c->setVariableByQName("TAB_CHILDREN_CHANGE","",abstract_s(c->getSystemState(),"tabChildrenChange"),DECLARED_TRAIT); + c->setVariableByQName("TAB_ENABLED_CHANGE","",abstract_s(c->getSystemState(),"tabEnabledChange"),DECLARED_TRAIT); + c->setVariableByQName("TAB_INDEX_CHANGE","",abstract_s(c->getSystemState(),"tabIndexChange"),DECLARED_TRAIT); + c->setVariableByQName("TEXT_INTERACTION_MODE_CHANGE","",abstract_s(c->getSystemState(),"textInteractionModeChange"),DECLARED_TRAIT); + c->setVariableByQName("TEXTURE_READY","",abstract_s(c->getSystemState(),"textureReady"),DECLARED_TRAIT); + c->setVariableByQName("UNLOAD","",abstract_s(c->getSystemState(),"unload"),DECLARED_TRAIT); + c->setVariableByQName("USER_IDLE","",abstract_s(c->getSystemState(),"userIdle"),DECLARED_TRAIT); + c->setVariableByQName("USER_PRESENT","",abstract_s(c->getSystemState(),"userPresent"),DECLARED_TRAIT); + + c->setDeclaredMethodByQName("formatToString","",Class<IFunction>::getFunction(c->getSystemState(),formatToString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("isDefaultPrevented","",Class<IFunction>::getFunction(c->getSystemState(),_isDefaultPrevented),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("preventDefault","",Class<IFunction>::getFunction(c->getSystemState(),_preventDefault),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(c->getSystemState(),clone),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("stopPropagation","",Class<IFunction>::getFunction(c->getSystemState(),stopPropagation),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("stopImmediatePropagation","",Class<IFunction>::getFunction(c->getSystemState(),stopImmediatePropagation),NORMAL_METHOD,true); REGISTER_GETTER(c,currentTarget); REGISTER_GETTER(c,target); REGISTER_GETTER(c,type); @@ -139,7 +139,7 @@ ASFUNCTIONBODY(Event,_isDefaultPrevented) { Event* th=static_cast<Event*>(obj); - return abstract_b(th->defaultPrevented); + return abstract_b(obj->getSystemState(),th->defaultPrevented); } ASFUNCTIONBODY(Event,_preventDefault) @@ -165,20 +165,20 @@ multiname propName(NULL); propName.name_type=multiname::NAME_STRING; - propName.name_s_id=getSys()->getUniqueStringId(prop); - propName.ns.push_back(nsNameAndKind("",NAMESPACE)); + propName.name_s_id=obj->getSystemState()->getUniqueStringId(prop); + propName.ns.push_back(nsNameAndKind(obj->getSystemState(),"",NAMESPACE)); _NR<ASObject> value=th->getVariableByMultiname(propName); if (!value.isNull()) msg += value->toString(); } msg += "]"; - return Class<ASString>::getInstanceS(msg); + return abstract_s(obj->getSystemState(),msg); } Event* Event::cloneImpl() const { - return Class<Event>::getInstanceS(type, bubbles, cancelable); + return Class<Event>::getInstanceS(getSystemState(),type, bubbles, cancelable); } ASFUNCTIONBODY(Event,clone) @@ -203,9 +203,9 @@ void EventPhase::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("CAPTURING_PHASE","",abstract_i(CAPTURING_PHASE),DECLARED_TRAIT); - c->setVariableByQName("BUBBLING_PHASE","",abstract_i(BUBBLING_PHASE),DECLARED_TRAIT); - c->setVariableByQName("AT_TARGET","",abstract_i(AT_TARGET),DECLARED_TRAIT); + c->setVariableByQName("CAPTURING_PHASE","",abstract_i(c->getSystemState(),CAPTURING_PHASE),DECLARED_TRAIT); + c->setVariableByQName("BUBBLING_PHASE","",abstract_i(c->getSystemState(),BUBBLING_PHASE),DECLARED_TRAIT); + c->setVariableByQName("AT_TARGET","",abstract_i(c->getSystemState(),AT_TARGET),DECLARED_TRAIT); } FocusEvent::FocusEvent(Class_base* c):Event(c, "focusEvent") @@ -215,10 +215,10 @@ void FocusEvent::sinit(Class_base* c) { CLASS_SETUP(c, Event, _constructor, CLASS_SEALED); - c->setVariableByQName("FOCUS_IN","",Class<ASString>::getInstanceS("focusIn"),DECLARED_TRAIT); - c->setVariableByQName("FOCUS_OUT","",Class<ASString>::getInstanceS("focusOut"),DECLARED_TRAIT); - c->setVariableByQName("MOUSE_FOCUS_CHANGE","",Class<ASString>::getInstanceS("mouseFocusChange"),DECLARED_TRAIT); - c->setVariableByQName("KEY_FOCUS_CHANGE","",Class<ASString>::getInstanceS("keyFocusChange"),DECLARED_TRAIT); + c->setVariableByQName("FOCUS_IN","",abstract_s(c->getSystemState(),"focusIn"),DECLARED_TRAIT); + c->setVariableByQName("FOCUS_OUT","",abstract_s(c->getSystemState(),"focusOut"),DECLARED_TRAIT); + c->setVariableByQName("MOUSE_FOCUS_CHANGE","",abstract_s(c->getSystemState(),"mouseFocusChange"),DECLARED_TRAIT); + c->setVariableByQName("KEY_FOCUS_CHANGE","",abstract_s(c->getSystemState(),"keyFocusChange"),DECLARED_TRAIT); } ASFUNCTIONBODY(FocusEvent,_constructor) @@ -241,7 +241,7 @@ Event* MouseEvent::cloneImpl() const { - return Class<MouseEvent>::getInstanceS(type,localX,localY,bubbles,modifiers,relatedObject,delta); + return Class<MouseEvent>::getInstanceS(getSystemState(),type,localX,localY,bubbles,modifiers,relatedObject,delta); } ProgressEvent::ProgressEvent(Class_base* c):Event(c, "progress",false),bytesLoaded(0),bytesTotal(0) @@ -254,13 +254,13 @@ Event* ProgressEvent::cloneImpl() const { - return Class<ProgressEvent>::getInstanceS(bytesLoaded, bytesTotal); + return Class<ProgressEvent>::getInstanceS(getSystemState(),bytesLoaded, bytesTotal); } void ProgressEvent::sinit(Class_base* c) {
View file
lightspark.tar.xz/src/scripting/flash/external/ExternalInterface.cpp
Changed
@@ -27,39 +27,40 @@ void ExternalInterface::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setDeclaredMethodByQName("available","",Class<IFunction>::getFunction(_getAvailable),GETTER_METHOD,false); - c->setDeclaredMethodByQName("objectID","",Class<IFunction>::getFunction(_getObjectID),GETTER_METHOD,false); - c->setDeclaredMethodByQName("marshallExceptions","",Class<IFunction>::getFunction(_getMarshallExceptions),GETTER_METHOD,false); - c->setDeclaredMethodByQName("marshallExceptions","",Class<IFunction>::getFunction(_setMarshallExceptions),SETTER_METHOD,false); - c->setDeclaredMethodByQName("addCallback","",Class<IFunction>::getFunction(addCallback),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("call","",Class<IFunction>::getFunction(call),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("available","",Class<IFunction>::getFunction(c->getSystemState(),_getAvailable),GETTER_METHOD,false); + c->setDeclaredMethodByQName("objectID","",Class<IFunction>::getFunction(c->getSystemState(),_getObjectID),GETTER_METHOD,false); + c->setDeclaredMethodByQName("marshallExceptions","",Class<IFunction>::getFunction(c->getSystemState(),_getMarshallExceptions),GETTER_METHOD,false); + c->setDeclaredMethodByQName("marshallExceptions","",Class<IFunction>::getFunction(c->getSystemState(),_setMarshallExceptions),SETTER_METHOD,false); + c->setDeclaredMethodByQName("addCallback","",Class<IFunction>::getFunction(c->getSystemState(),addCallback),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("call","",Class<IFunction>::getFunction(c->getSystemState(),call),NORMAL_METHOD,false); } ASFUNCTIONBODY(ExternalInterface,_getAvailable) { - return abstract_b(getSys()->extScriptObject != NULL); + return abstract_b(getSys(),getSys()->extScriptObject != NULL); } ASFUNCTIONBODY(ExternalInterface,_getObjectID) { - if(getSys()->extScriptObject == NULL) - return Class<ASString>::getInstanceS(""); + SystemState* sys = getSys(); + if(sys->extScriptObject == NULL) + return abstract_s(sys,""); - ExtScriptObject* so=getSys()->extScriptObject; + ExtScriptObject* so=sys->extScriptObject; if(so->hasProperty("name")==false) - return Class<ASString>::getInstanceS(""); + return abstract_s(sys,""); const ExtVariant& object = so->getProperty("name"); std::string result = object.getString(); - return Class<ASString>::getInstanceS(result); + return abstract_s(sys,result); } ASFUNCTIONBODY(ExternalInterface, _getMarshallExceptions) { if(getSys()->extScriptObject == NULL) - return abstract_b(false); + return abstract_b(getSys(),false); else - return abstract_b(getSys()->extScriptObject->getMarshallExceptions()); + return abstract_b(getSys(),getSys()->extScriptObject->getMarshallExceptions()); } ASFUNCTIONBODY(ExternalInterface, _setMarshallExceptions) @@ -73,7 +74,7 @@ ASFUNCTIONBODY(ExternalInterface,addCallback) { if(getSys()->extScriptObject == NULL) - return abstract_b(false); + return abstract_b(getSys(),false); // throw Class<ASError>::getInstanceS("Container doesn't support callbacks"); assert_and_throw(argslen == 2); @@ -85,7 +86,7 @@ IFunction* f=static_cast<IFunction*>(args[1]); getSys()->extScriptObject->setMethod(args[0]->toString().raw_buf(), new ExtASCallback(f)); } - return abstract_b(true); + return abstract_b(getSys(),true); } ASFUNCTIONBODY(ExternalInterface,call)
View file
lightspark.tar.xz/src/scripting/flash/filters/flashfilters.cpp
Changed
@@ -27,12 +27,12 @@ void BitmapFilter::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_SEALED); - c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(clone),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(c->getSystemState(),clone),NORMAL_METHOD,true); } BitmapFilter* BitmapFilter::cloneImpl() const { - return Class<BitmapFilter>::getInstanceS(); + return Class<BitmapFilter>::getInstanceS(getSystemState()); } ASFUNCTIONBODY(BitmapFilter,clone) @@ -85,7 +85,7 @@ BitmapFilter* GlowFilter::cloneImpl() const { - GlowFilter *cloned = Class<GlowFilter>::getInstanceS(); + GlowFilter *cloned = Class<GlowFilter>::getInstanceS(getSystemState()); cloned->alpha = alpha; cloned->blurX = blurX; cloned->blurY = blurY; @@ -151,7 +151,7 @@ BitmapFilter* DropShadowFilter::cloneImpl() const { - DropShadowFilter *cloned = Class<DropShadowFilter>::getInstanceS(); + DropShadowFilter *cloned = Class<DropShadowFilter>::getInstanceS(getSystemState()); cloned->alpha = alpha; cloned->angle = angle; cloned->blurX = blurX; @@ -185,7 +185,7 @@ BitmapFilter* GradientGlowFilter::cloneImpl() const { - return Class<GradientGlowFilter>::getInstanceS(); + return Class<GradientGlowFilter>::getInstanceS(getSystemState()); } BevelFilter::BevelFilter(Class_base* c): @@ -207,7 +207,7 @@ BitmapFilter* BevelFilter::cloneImpl() const { - return Class<BevelFilter>::getInstanceS(); + return Class<BevelFilter>::getInstanceS(getSystemState()); } ColorMatrixFilter::ColorMatrixFilter(Class_base* c): BitmapFilter(c),matrix(NULL) @@ -231,7 +231,7 @@ BitmapFilter* ColorMatrixFilter::cloneImpl() const { - ColorMatrixFilter *cloned = Class<ColorMatrixFilter>::getInstanceS(); + ColorMatrixFilter *cloned = Class<ColorMatrixFilter>::getInstanceS(getSystemState()); if (!matrix.isNull()) { matrix->incRef(); @@ -258,7 +258,7 @@ BitmapFilter* BlurFilter::cloneImpl() const { - return Class<BlurFilter>::getInstanceS(); + return Class<BlurFilter>::getInstanceS(getSystemState()); } ConvolutionFilter::ConvolutionFilter(Class_base* c): @@ -280,7 +280,7 @@ BitmapFilter* ConvolutionFilter::cloneImpl() const { - return Class<ConvolutionFilter>::getInstanceS(); + return Class<ConvolutionFilter>::getInstanceS(getSystemState()); } DisplacementMapFilter::DisplacementMapFilter(Class_base* c): @@ -302,7 +302,7 @@ BitmapFilter* DisplacementMapFilter::cloneImpl() const { - return Class<DisplacementMapFilter>::getInstanceS(); + return Class<DisplacementMapFilter>::getInstanceS(getSystemState()); } GradientBevelFilter::GradientBevelFilter(Class_base* c): @@ -324,7 +324,7 @@ BitmapFilter* GradientBevelFilter::cloneImpl() const { - return Class<GradientBevelFilter>::getInstanceS(); + return Class<GradientBevelFilter>::getInstanceS(getSystemState()); } ShaderFilter::ShaderFilter(Class_base* c): @@ -346,13 +346,13 @@ BitmapFilter* ShaderFilter::cloneImpl() const { - return Class<ShaderFilter>::getInstanceS(); + return Class<ShaderFilter>::getInstanceS(getSystemState()); } void BitmapFilterQuality::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("HIGH","",abstract_i(3),DECLARED_TRAIT); - c->setVariableByQName("LOW","",abstract_i(1),DECLARED_TRAIT); - c->setVariableByQName("MEDIUM","",abstract_i(3),DECLARED_TRAIT); + c->setVariableByQName("HIGH","",abstract_i(c->getSystemState(),3),DECLARED_TRAIT); + c->setVariableByQName("LOW","",abstract_i(c->getSystemState(),1),DECLARED_TRAIT); + c->setVariableByQName("MEDIUM","",abstract_i(c->getSystemState(),3),DECLARED_TRAIT); }
View file
lightspark.tar.xz/src/scripting/flash/geom/flashgeom.cpp
Changed
@@ -27,57 +27,57 @@ void Rectangle::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); - IFunction* gleft=Class<IFunction>::getFunction(_getLeft); + IFunction* gleft=Class<IFunction>::getFunction(c->getSystemState(),_getLeft); c->setDeclaredMethodByQName("left","",gleft,GETTER_METHOD,true); gleft->incRef(); c->setDeclaredMethodByQName("x","",gleft,GETTER_METHOD,true); - IFunction* sleft=Class<IFunction>::getFunction(_setLeft); + IFunction* sleft=Class<IFunction>::getFunction(c->getSystemState(),_setLeft); c->setDeclaredMethodByQName("left","",sleft,SETTER_METHOD,true); sleft->incRef(); c->setDeclaredMethodByQName("x","",sleft,SETTER_METHOD,true); - c->setDeclaredMethodByQName("right","",Class<IFunction>::getFunction(_getRight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("right","",Class<IFunction>::getFunction(_setRight),SETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(_getWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(_setWidth),SETTER_METHOD,true); + c->setDeclaredMethodByQName("right","",Class<IFunction>::getFunction(c->getSystemState(),_getRight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("right","",Class<IFunction>::getFunction(c->getSystemState(),_setRight),SETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),_getWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),_setWidth),SETTER_METHOD,true); - IFunction* gtop=Class<IFunction>::getFunction(_getTop); + IFunction* gtop=Class<IFunction>::getFunction(c->getSystemState(),_getTop); c->setDeclaredMethodByQName("top","",gtop,GETTER_METHOD,true); gtop->incRef(); c->setDeclaredMethodByQName("y","",gtop,GETTER_METHOD,true); - IFunction* stop=Class<IFunction>::getFunction(_setTop); + IFunction* stop=Class<IFunction>::getFunction(c->getSystemState(),_setTop); c->setDeclaredMethodByQName("top","",stop,SETTER_METHOD,true); stop->incRef(); c->setDeclaredMethodByQName("y","",stop,SETTER_METHOD,true); - c->setDeclaredMethodByQName("bottom","",Class<IFunction>::getFunction(_getBottom),GETTER_METHOD,true); - c->setDeclaredMethodByQName("bottom","",Class<IFunction>::getFunction(_setBottom),SETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_getHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(_setHeight),SETTER_METHOD,true); - - c->setDeclaredMethodByQName("bottomRight","",Class<IFunction>::getFunction(_getBottomRight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("bottomRight","",Class<IFunction>::getFunction(_setBottomRight),SETTER_METHOD,true); - - c->setDeclaredMethodByQName("size","",Class<IFunction>::getFunction(_getSize),GETTER_METHOD,true); - c->setDeclaredMethodByQName("size","",Class<IFunction>::getFunction(_setSize),SETTER_METHOD,true); - - c->setDeclaredMethodByQName("topLeft","",Class<IFunction>::getFunction(_getTopLeft),GETTER_METHOD,true); - c->setDeclaredMethodByQName("topLeft","",Class<IFunction>::getFunction(_setTopLeft),SETTER_METHOD,true); - - c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(clone),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("contains","",Class<IFunction>::getFunction(contains),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("containsPoint","",Class<IFunction>::getFunction(containsPoint),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("containsRect","",Class<IFunction>::getFunction(containsRect),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("equals","",Class<IFunction>::getFunction(equals),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("inflate","",Class<IFunction>::getFunction(inflate),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("inflatePoint","",Class<IFunction>::getFunction(inflatePoint),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("intersection","",Class<IFunction>::getFunction(intersection),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("intersects","",Class<IFunction>::getFunction(intersects),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("isEmpty","",Class<IFunction>::getFunction(isEmpty),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("offset","",Class<IFunction>::getFunction(offset),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("offsetPoint","",Class<IFunction>::getFunction(offsetPoint),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setEmpty","",Class<IFunction>::getFunction(setEmpty),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("union","",Class<IFunction>::getFunction(_union),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("bottom","",Class<IFunction>::getFunction(c->getSystemState(),_getBottom),GETTER_METHOD,true); + c->setDeclaredMethodByQName("bottom","",Class<IFunction>::getFunction(c->getSystemState(),_setBottom),SETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),_getHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),_setHeight),SETTER_METHOD,true); + + c->setDeclaredMethodByQName("bottomRight","",Class<IFunction>::getFunction(c->getSystemState(),_getBottomRight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("bottomRight","",Class<IFunction>::getFunction(c->getSystemState(),_setBottomRight),SETTER_METHOD,true); + + c->setDeclaredMethodByQName("size","",Class<IFunction>::getFunction(c->getSystemState(),_getSize),GETTER_METHOD,true); + c->setDeclaredMethodByQName("size","",Class<IFunction>::getFunction(c->getSystemState(),_setSize),SETTER_METHOD,true); + + c->setDeclaredMethodByQName("topLeft","",Class<IFunction>::getFunction(c->getSystemState(),_getTopLeft),GETTER_METHOD,true); + c->setDeclaredMethodByQName("topLeft","",Class<IFunction>::getFunction(c->getSystemState(),_setTopLeft),SETTER_METHOD,true); + + c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(c->getSystemState(),clone),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("contains","",Class<IFunction>::getFunction(c->getSystemState(),contains),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("containsPoint","",Class<IFunction>::getFunction(c->getSystemState(),containsPoint),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("containsRect","",Class<IFunction>::getFunction(c->getSystemState(),containsRect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("equals","",Class<IFunction>::getFunction(c->getSystemState(),equals),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("inflate","",Class<IFunction>::getFunction(c->getSystemState(),inflate),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("inflatePoint","",Class<IFunction>::getFunction(c->getSystemState(),inflatePoint),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("intersection","",Class<IFunction>::getFunction(c->getSystemState(),intersection),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("intersects","",Class<IFunction>::getFunction(c->getSystemState(),intersects),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("isEmpty","",Class<IFunction>::getFunction(c->getSystemState(),isEmpty),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("offset","",Class<IFunction>::getFunction(c->getSystemState(),offset),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("offsetPoint","",Class<IFunction>::getFunction(c->getSystemState(),offsetPoint),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setEmpty","",Class<IFunction>::getFunction(c->getSystemState(),setEmpty),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("union","",Class<IFunction>::getFunction(c->getSystemState(),_union),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); } void Rectangle::buildTraits(ASObject* o) @@ -108,7 +108,7 @@ ASFUNCTIONBODY(Rectangle,_getLeft) { Rectangle* th=static_cast<Rectangle*>(obj); - return abstract_d(th->x); + return abstract_d(obj->getSystemState(),th->x); } ASFUNCTIONBODY(Rectangle,_setLeft) @@ -122,7 +122,7 @@ ASFUNCTIONBODY(Rectangle,_getRight) { Rectangle* th=static_cast<Rectangle*>(obj); - return abstract_d(th->x + th->width); + return abstract_d(obj->getSystemState(),th->x + th->width); } ASFUNCTIONBODY(Rectangle,_setRight) @@ -136,7 +136,7 @@ ASFUNCTIONBODY(Rectangle,_getWidth) { Rectangle* th=static_cast<Rectangle*>(obj); - return abstract_d(th->width); + return abstract_d(obj->getSystemState(),th->width); } ASFUNCTIONBODY(Rectangle,_setWidth) @@ -150,7 +150,7 @@ ASFUNCTIONBODY(Rectangle,_getTop) { Rectangle* th=static_cast<Rectangle*>(obj); - return abstract_d(th->y); + return abstract_d(obj->getSystemState(),th->y); } ASFUNCTIONBODY(Rectangle,_setTop) @@ -164,7 +164,7 @@ ASFUNCTIONBODY(Rectangle,_getBottom) { Rectangle* th=static_cast<Rectangle*>(obj); - return abstract_d(th->y + th->height); + return abstract_d(obj->getSystemState(),th->y + th->height); } ASFUNCTIONBODY(Rectangle,_setBottom) @@ -179,7 +179,7 @@ { assert_and_throw(argslen==0); Rectangle* th = static_cast<Rectangle*>(obj); - Point* ret = Class<Point>::getInstanceS(th->x + th->width, th->y + th->height); + Point* ret = Class<Point>::getInstanceS(obj->getSystemState(),th->x + th->width, th->y + th->height); return ret; } @@ -197,7 +197,7 @@ { assert_and_throw(argslen==0); Rectangle* th = static_cast<Rectangle*>(obj); - Point* ret = Class<Point>::getInstanceS(th->x, th->y); + Point* ret = Class<Point>::getInstanceS(obj->getSystemState(),th->x, th->y); return ret; } @@ -215,7 +215,7 @@ { assert_and_throw(argslen==0); Rectangle* th = static_cast<Rectangle*>(obj); - Point* ret = Class<Point>::getInstanceS(th->width, th->height); + Point* ret = Class<Point>::getInstanceS(obj->getSystemState(),th->width, th->height); return ret; } @@ -232,7 +232,7 @@ ASFUNCTIONBODY(Rectangle,_getHeight) { Rectangle* th=static_cast<Rectangle*>(obj); - return abstract_d(th->height); + return abstract_d(obj->getSystemState(),th->height); } ASFUNCTIONBODY(Rectangle,_setHeight) @@ -246,7 +246,7 @@ ASFUNCTIONBODY(Rectangle,clone) { Rectangle* th=static_cast<Rectangle*>(obj); - Rectangle* ret=Class<Rectangle>::getInstanceS(); + Rectangle* ret=Class<Rectangle>::getInstanceS(obj->getSystemState()); ret->x=th->x; ret->y=th->y; ret->width=th->width; @@ -261,7 +261,7 @@ number_t x = args[0]->toNumber(); number_t y = args[1]->toNumber(); - return abstract_b( th->x <= x && x <= th->x + th->width + return abstract_b(obj->getSystemState(), th->x <= x && x <= th->x + th->width && th->y <= y && y <= th->y + th->height ); } @@ -273,7 +273,7 @@ number_t x = br->getX(); number_t y = br->getY(); - return abstract_b( th->x <= x && x <= th->x + th->width + return abstract_b(obj->getSystemState(), th->x <= x && x <= th->x + th->width
View file
lightspark.tar.xz/src/scripting/flash/media/flashmedia.cpp
Changed
@@ -68,14 +68,14 @@ void Video::sinit(Class_base* c) { CLASS_SETUP(c, DisplayObject, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("videoWidth","",Class<IFunction>::getFunction(_getVideoWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("videoHeight","",Class<IFunction>::getFunction(_getVideoHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(Video::_getWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(Video::_setWidth),SETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(Video::_getHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(Video::_setHeight),SETTER_METHOD,true); - c->setDeclaredMethodByQName("attachNetStream","",Class<IFunction>::getFunction(attachNetStream),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("clear","",Class<IFunction>::getFunction(clear),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("videoWidth","",Class<IFunction>::getFunction(c->getSystemState(),_getVideoWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("videoHeight","",Class<IFunction>::getFunction(c->getSystemState(),_getVideoHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),Video::_getWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),Video::_setWidth),SETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),Video::_getHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),Video::_setHeight),SETTER_METHOD,true); + c->setDeclaredMethodByQName("attachNetStream","",Class<IFunction>::getFunction(c->getSystemState(),attachNetStream),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("clear","",Class<IFunction>::getFunction(c->getSystemState(),clear),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c, deblocking); REGISTER_GETTER_SETTER(c, smoothing); } @@ -161,19 +161,19 @@ ASFUNCTIONBODY(Video,_getVideoWidth) { Video* th=Class<Video>::cast(obj); - return abstract_i(th->videoWidth); + return abstract_i(obj->getSystemState(),th->videoWidth); } ASFUNCTIONBODY(Video,_getVideoHeight) { Video* th=Class<Video>::cast(obj); - return abstract_i(th->videoHeight); + return abstract_i(obj->getSystemState(),th->videoHeight); } ASFUNCTIONBODY(Video,_getWidth) { Video* th=Class<Video>::cast(obj); - return abstract_i(th->width); + return abstract_i(obj->getSystemState(),th->width); } ASFUNCTIONBODY(Video,_setWidth) @@ -188,7 +188,7 @@ ASFUNCTIONBODY(Video,_getHeight) { Video* th=Class<Video>::cast(obj); - return abstract_i(th->height); + return abstract_i(obj->getSystemState(),th->height); } ASFUNCTIONBODY(Video,_setHeight) @@ -212,7 +212,7 @@ } //Validate the parameter - if(!args[0]->getClass()->isSubClass(Class<NetStream>::getClass())) + if(!args[0]->getClass()->isSubClass(Class<NetStream>::getClass(obj->getSystemState()))) throw RunTimeException("Type mismatch in Video::attachNetStream"); //Acquire the netStream @@ -260,9 +260,9 @@ void Sound::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("load","",Class<IFunction>::getFunction(load),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("play","",Class<IFunction>::getFunction(play),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(close),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("load","",Class<IFunction>::getFunction(c->getSystemState(),load),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("play","",Class<IFunction>::getFunction(c->getSystemState(),play),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(c->getSystemState(),close),NORMAL_METHOD,true); REGISTER_GETTER(c,bytesLoaded); REGISTER_GETTER(c,bytesTotal); REGISTER_GETTER(c,length); @@ -299,7 +299,7 @@ { //Notify an error during loading th->incRef(); - getVm()->addEvent(_MR(th),_MR(Class<IOErrorEvent>::getInstanceS())); + getVm(obj->getSystemState())->addEvent(_MR(th),_MR(Class<IOErrorEvent>::getInstanceS(obj->getSystemState()))); return NULL; } @@ -322,7 +322,7 @@ if(th->downloader->hasFailed()) { th->incRef(); - getVm()->addEvent(_MR(th),_MR(Class<IOErrorEvent>::getInstanceS())); + getVm(obj->getSystemState())->addEvent(_MR(th),_MR(Class<IOErrorEvent>::getInstanceS(obj->getSystemState()))); } return NULL; } @@ -338,9 +338,9 @@ th->incRef(); if (th->container) - return Class<SoundChannel>::getInstanceS(th->soundData); + return Class<SoundChannel>::getInstanceS(obj->getSystemState(),th->soundData); else - return Class<SoundChannel>::getInstanceS(th->soundData, th->format); + return Class<SoundChannel>::getInstanceS(obj->getSystemState(),th->soundData, th->format); } ASFUNCTIONBODY(Sound,close) @@ -363,11 +363,11 @@ { bytesLoaded=b; this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<ProgressEvent>::getInstanceS(bytesLoaded,bytesTotal))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<ProgressEvent>::getInstanceS(getSystemState(),bytesLoaded,bytesTotal))); if(bytesLoaded==bytesTotal) { this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("complete"))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<Event>::getInstanceS(getSystemState(),"complete"))); } } } @@ -401,7 +401,7 @@ SoundChannel::SoundChannel(Class_base* c, _NR<StreamCache> _stream, AudioFormat _format) : EventDispatcher(c),stream(_stream),stopped(false),audioDecoder(NULL),audioStream(NULL), - format(_format),position(0),soundTransform(_MR(Class<SoundTransform>::getInstanceS())) + format(_format),position(0),soundTransform(_MR(Class<SoundTransform>::getInstanceS(c->getSystemState()))) { if (!stream.isNull()) { @@ -419,7 +419,7 @@ void SoundChannel::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED | CLASS_FINAL); - c->setDeclaredMethodByQName("stop","",Class<IFunction>::getFunction(stop),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("stop","",Class<IFunction>::getFunction(c->getSystemState(),stop),NORMAL_METHOD,true); REGISTER_GETTER(c,position); REGISTER_GETTER_SETTER(c,soundTransform); @@ -544,7 +544,7 @@ if (!ACQUIRE_READ(stopped)) { incRef(); - getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("soundComplete"))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<Event>::getInstanceS(getSystemState(),"soundComplete"))); } } @@ -585,7 +585,7 @@ if (!ACQUIRE_READ(stopped)) { incRef(); - getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("soundComplete"))); + getVm(getSystemState())->addEvent(_MR(this),_MR(Class<Event>::getInstanceS(getSystemState(),"soundComplete"))); } #endif //ENABLE_LIBAVCODEC } @@ -610,9 +610,9 @@ void StageVideo::sinit(Class_base *c) { CLASS_SETUP(c, EventDispatcher, _constructorNotInstantiatable, CLASS_SEALED); - c->setDeclaredMethodByQName("videoWidth","",Class<IFunction>::getFunction(_getVideoWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("videoHeight","",Class<IFunction>::getFunction(_getVideoHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("attachNetStream","",Class<IFunction>::getFunction(attachNetStream),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("videoWidth","",Class<IFunction>::getFunction(c->getSystemState(),_getVideoWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("videoHeight","",Class<IFunction>::getFunction(c->getSystemState(),_getVideoHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("attachNetStream","",Class<IFunction>::getFunction(c->getSystemState(),attachNetStream),NORMAL_METHOD,true); } @@ -624,13 +624,13 @@ ASFUNCTIONBODY(StageVideo,_getVideoWidth) { StageVideo* th=Class<StageVideo>::cast(obj); - return abstract_i(th->videoWidth); + return abstract_i(obj->getSystemState(),th->videoWidth); } ASFUNCTIONBODY(StageVideo,_getVideoHeight) { StageVideo* th=Class<StageVideo>::cast(obj); - return abstract_i(th->videoHeight); + return abstract_i(obj->getSystemState(),th->videoHeight); } ASFUNCTIONBODY(StageVideo,attachNetStream) @@ -645,7 +645,7 @@ } //Validate the parameter - if(!args[0]->getClass()->isSubClass(Class<NetStream>::getClass())) + if(!args[0]->getClass()->isSubClass(Class<NetStream>::getClass(obj->getSystemState()))) throw RunTimeException("Type mismatch in StageVideo::attachNetStream"); //Acquire the netStream @@ -659,14 +659,14 @@ void StageVideoAvailability::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("AVAILABLE","",Class<ASString>::getInstanceS("available"),DECLARED_TRAIT);
View file
lightspark.tar.xz/src/scripting/flash/net/NetStreamPlayTransitions.cpp
Changed
@@ -29,12 +29,12 @@ void NetStreamPlayTransitions::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, NULL, CLASS_FINAL); - c->setVariableByQName("APPEND","",Class<ASString>::getInstanceS("append"),CONSTANT_TRAIT); - c->setVariableByQName("APPEND_AND_WAIT","",Class<ASString>::getInstanceS("appendAndWait"),CONSTANT_TRAIT); - c->setVariableByQName("RESET","",Class<ASString>::getInstanceS("reset"),CONSTANT_TRAIT); - c->setVariableByQName("RESUME","",Class<ASString>::getInstanceS("resume"),CONSTANT_TRAIT); - c->setVariableByQName("STOP","",Class<ASString>::getInstanceS("stop"),CONSTANT_TRAIT); - c->setVariableByQName("SWAP","",Class<ASString>::getInstanceS("swap"),CONSTANT_TRAIT); - c->setVariableByQName("SWITCH","",Class<ASString>::getInstanceS("switch"),CONSTANT_TRAIT); + c->setVariableByQName("APPEND","",abstract_s(c->getSystemState(),"append"),CONSTANT_TRAIT); + c->setVariableByQName("APPEND_AND_WAIT","",abstract_s(c->getSystemState(),"appendAndWait"),CONSTANT_TRAIT); + c->setVariableByQName("RESET","",abstract_s(c->getSystemState(),"reset"),CONSTANT_TRAIT); + c->setVariableByQName("RESUME","",abstract_s(c->getSystemState(),"resume"),CONSTANT_TRAIT); + c->setVariableByQName("STOP","",abstract_s(c->getSystemState(),"stop"),CONSTANT_TRAIT); + c->setVariableByQName("SWAP","",abstract_s(c->getSystemState(),"swap"),CONSTANT_TRAIT); + c->setVariableByQName("SWITCH","",abstract_s(c->getSystemState(),"switch"),CONSTANT_TRAIT); }
View file
lightspark.tar.xz/src/scripting/flash/net/URLStream.cpp
Changed
@@ -52,7 +52,7 @@ { timestamp_last_progress = cur; loader->incRef(); - getVm()->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(b,bytes_total))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(loader->getSystemState(),b,bytes_total))); } } } @@ -73,10 +73,10 @@ if(!downloader->hasFailed()) { loader->incRef(); - getVm()->addEvent(loader,_MR(Class<Event>::getInstanceS("open"))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<Event>::getInstanceS(loader->getSystemState(),"open"))); streambuffer = cache->createReader(); loader->incRef(); - getVm()->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(0,bytes_total))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(loader->getSystemState(),0,bytes_total))); cache->waitForTermination(); if(!downloader->hasFailed() && !threadAborting) { @@ -99,16 +99,16 @@ if(success && !threadAborting) { loader->incRef(); - getVm()->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(downloader->getLength(),downloader->getLength()))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(loader->getSystemState(),downloader->getLength(),downloader->getLength()))); //Send a complete event for this object loader->incRef(); - getVm()->addEvent(loader,_MR(Class<Event>::getInstanceS("complete"))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<Event>::getInstanceS(loader->getSystemState(),"complete"))); } else if(!success && !threadAborting) { //Notify an error during loading loader->incRef(); - getVm()->addEvent(loader,_MR(Class<IOErrorEvent>::getInstanceS())); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<IOErrorEvent>::getInstanceS(loader->getSystemState()))); } { @@ -122,30 +122,30 @@ void URLStream::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("load","",Class<IFunction>::getFunction(load),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(close),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("bytesAvailable","",Class<IFunction>::getFunction(bytesAvailable),GETTER_METHOD,true); - c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(_getEndian),GETTER_METHOD,true); - c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(_setEndian),SETTER_METHOD,true); - c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(_getObjectEncoding),GETTER_METHOD,true); - c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(_setObjectEncoding),SETTER_METHOD,true); - c->setDeclaredMethodByQName("readBoolean","",Class<IFunction>::getFunction(readBoolean),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readByte","",Class<IFunction>::getFunction(readByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readBytes","",Class<IFunction>::getFunction(readBytes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readDouble","",Class<IFunction>::getFunction(readDouble),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readFloat","",Class<IFunction>::getFunction(readFloat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readInt","",Class<IFunction>::getFunction(readInt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readMultiByte","",Class<IFunction>::getFunction(readMultiByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readObject","",Class<IFunction>::getFunction(readObject),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readShort","",Class<IFunction>::getFunction(readShort),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUnsignedByte","",Class<IFunction>::getFunction(readUnsignedByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUnsignedInt","",Class<IFunction>::getFunction(readUnsignedInt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUnsignedShort","",Class<IFunction>::getFunction(readUnsignedShort),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUTF","",Class<IFunction>::getFunction(readUTF),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUTFBytes","",Class<IFunction>::getFunction(readUTFBytes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("load","",Class<IFunction>::getFunction(c->getSystemState(),load),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(c->getSystemState(),close),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("bytesAvailable","",Class<IFunction>::getFunction(c->getSystemState(),bytesAvailable),GETTER_METHOD,true); + c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(c->getSystemState(),_getEndian),GETTER_METHOD,true); + c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(c->getSystemState(),_setEndian),SETTER_METHOD,true); + c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(c->getSystemState(),_getObjectEncoding),GETTER_METHOD,true); + c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(c->getSystemState(),_setObjectEncoding),SETTER_METHOD,true); + c->setDeclaredMethodByQName("readBoolean","",Class<IFunction>::getFunction(c->getSystemState(),readBoolean),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readByte","",Class<IFunction>::getFunction(c->getSystemState(),readByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readBytes","",Class<IFunction>::getFunction(c->getSystemState(),readBytes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readDouble","",Class<IFunction>::getFunction(c->getSystemState(),readDouble),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readFloat","",Class<IFunction>::getFunction(c->getSystemState(),readFloat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readInt","",Class<IFunction>::getFunction(c->getSystemState(),readInt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readMultiByte","",Class<IFunction>::getFunction(c->getSystemState(),readMultiByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readObject","",Class<IFunction>::getFunction(c->getSystemState(),readObject),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readShort","",Class<IFunction>::getFunction(c->getSystemState(),readShort),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUnsignedByte","",Class<IFunction>::getFunction(c->getSystemState(),readUnsignedByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUnsignedInt","",Class<IFunction>::getFunction(c->getSystemState(),readUnsignedInt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUnsignedShort","",Class<IFunction>::getFunction(c->getSystemState(),readUnsignedShort),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUTF","",Class<IFunction>::getFunction(c->getSystemState(),readUTF),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUTFBytes","",Class<IFunction>::getFunction(c->getSystemState(),readUTFBytes),NORMAL_METHOD,true); REGISTER_GETTER(c,connected); - c->addImplementedInterface(InterfaceClass<IDataInput>::getClass()); + c->addImplementedInterface(InterfaceClass<IDataInput>::getClass(c->getSystemState())); IDataInput::linkTraits(c); } @@ -191,7 +191,7 @@ { //Notify an error during loading th->incRef(); - getSys()->currentVm->addEvent(_MR(th),_MR(Class<IOErrorEvent>::getInstanceS())); + getSys()->currentVm->addEvent(_MR(th),_MR(Class<IOErrorEvent>::getInstanceS(obj->getSystemState()))); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/net/URLStream.h
Changed
@@ -79,7 +79,7 @@ ASFUNCTION(readUTFBytes); ASPROPERTY_GETTER(bool,connected); public: - URLStream(Class_base* c):EventDispatcher(c),data(_MNR(Class<ByteArray>::getInstanceS())),job(NULL),connected(false) {} + URLStream(Class_base* c):EventDispatcher(c),data(_MNR(Class<ByteArray>::getInstanceS(c->getSystemState()))),job(NULL),connected(false) {} static void sinit(Class_base*); static void buildTraits(ASObject* o); void threadFinished(IThreadJob *job);
View file
lightspark.tar.xz/src/scripting/flash/net/XMLSocket.cpp
Changed
@@ -172,10 +172,10 @@ void XMLSocket::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(_close),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("connect","",Class<IFunction>::getFunction(_connect),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("send","",Class<IFunction>::getFunction(_send),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("connected","",Class<IFunction>::getFunction(_connected),GETTER_METHOD,true); + c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(c->getSystemState(),_close),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("connect","",Class<IFunction>::getFunction(c->getSystemState(),_connect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("send","",Class<IFunction>::getFunction(c->getSystemState(),_send),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("connected","",Class<IFunction>::getFunction(c->getSystemState(),_connected),GETTER_METHOD,true); REGISTER_GETTER_SETTER(c,timeout); } @@ -238,17 +238,17 @@ void XMLSocket::connect(tiny_string host, int port) { if (port <= 0 || port > 65535) - throw Class<SecurityError>::getInstanceS("Invalid port"); + throw Class<SecurityError>::getInstanceS(getSystemState(),"Invalid port"); if (host.empty()) host = getSys()->mainClip->getOrigin().getHostname(); if (isConnected()) - throw Class<IOError>::getInstanceS("Already connected"); + throw Class<IOError>::getInstanceS(getSystemState(),"Already connected"); // Host shouldn't contain scheme or port if (host.strchr(':') != NULL) - throw Class<SecurityError>::getInstanceS("Invalid hostname"); + throw Class<SecurityError>::getInstanceS(getSystemState(),"Invalid hostname"); // Check sandbox and policy file size_t buflen = host.numBytes() + 22; @@ -256,7 +256,7 @@ snprintf(urlbuf, buflen, "xmlsocket://%s:%d", host.raw_buf(), port); URLInfo url(urlbuf); - getSys()->securityManager->checkURLStaticAndThrow(url, + getSystemState()->securityManager->checkURLStaticAndThrow(url, ~(SecurityManager::LOCAL_WITH_FILE), SecurityManager::LOCAL_WITH_FILE | SecurityManager::LOCAL_TRUSTED, true); @@ -266,7 +266,7 @@ if(evaluationResult != SecurityManager::ALLOWED) { incRef(); - getVm()->addEvent(_MR(this), _MR(Class<SecurityErrorEvent>::getInstanceS("No policy file allows socket connection"))); + getVm(getSystemState())->addEvent(_MR(this), _MR(Class<SecurityErrorEvent>::getInstanceS(getSystemState(),"No policy file allows socket connection"))); return; } @@ -306,7 +306,7 @@ } else { - throw Class<IOError>::getInstanceS("Socket is not connected"); + throw Class<IOError>::getInstanceS(obj->getSystemState(),"Socket is not connected"); } return NULL; @@ -321,7 +321,7 @@ ASFUNCTIONBODY(XMLSocket, _connected) { XMLSocket* th=obj->as<XMLSocket>(); - return abstract_b(th->isConnected()); + return abstract_b(obj->getSystemState(),th->isConnected()); } void XMLSocket::threadFinished() @@ -379,12 +379,12 @@ if (!sock.connect(hostname, port)) { owner->incRef(); - getVm()->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS())); + getVm(owner->getSystemState())->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS(owner->getSystemState()))); return; } owner->incRef(); - getVm()->addEvent(owner, _MR(Class<Event>::getInstanceS("connect"))); + getVm(owner->getSystemState())->addEvent(owner, _MR(Class<Event>::getInstanceS(owner->getSystemState(),"connect"))); struct timeval timeout; int maxfd; @@ -405,7 +405,7 @@ if (status < 0) { owner->incRef(); - getVm()->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS())); + getVm(owner->getSystemState())->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS(owner->getSystemState()))); return; } @@ -417,7 +417,7 @@ if (nbytes < 0) { owner->incRef(); - getVm()->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS())); + getVm(owner->getSystemState())->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS(owner->getSystemState()))); return; } else if (nbytes == 0) @@ -449,20 +449,20 @@ buf[nbytes] = '\0'; tiny_string data(buf, true); owner->incRef(); - getVm()->addEvent(owner, _MR(Class<DataEvent>::getInstanceS(data))); + getVm(owner->getSystemState())->addEvent(owner, _MR(Class<DataEvent>::getInstanceS(owner->getSystemState(),data))); } else if (nbytes == 0) { // The server has closed the socket owner->incRef(); - getVm()->addEvent(owner, _MR(Class<Event>::getInstanceS("close"))); + getVm(owner->getSystemState())->addEvent(owner, _MR(Class<Event>::getInstanceS(owner->getSystemState(),"close"))); threadAborting = true; } else { // Error owner->incRef(); - getVm()->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS())); + getVm(owner->getSystemState())->addEvent(owner, _MR(Class<IOErrorEvent>::getInstanceS(owner->getSystemState()))); threadAborting = true; } }
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.cpp
Changed
@@ -36,21 +36,21 @@ using namespace lightspark; URLRequest::URLRequest(Class_base* c):ASObject(c),method(GET),contentType("application/x-www-form-urlencoded"), - requestHeaders(Class<Array>::getInstanceS()) + requestHeaders(Class<Array>::getInstanceS(c->getSystemState())) { } void URLRequest::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); - c->setDeclaredMethodByQName("url","",Class<IFunction>::getFunction(_setURL),SETTER_METHOD,true); - c->setDeclaredMethodByQName("url","",Class<IFunction>::getFunction(_getURL),GETTER_METHOD,true); - c->setDeclaredMethodByQName("method","",Class<IFunction>::getFunction(_setMethod),SETTER_METHOD,true); - c->setDeclaredMethodByQName("method","",Class<IFunction>::getFunction(_getMethod),GETTER_METHOD,true); - c->setDeclaredMethodByQName("data","",Class<IFunction>::getFunction(_setData),SETTER_METHOD,true); - c->setDeclaredMethodByQName("data","",Class<IFunction>::getFunction(_getData),GETTER_METHOD,true); - c->setDeclaredMethodByQName("digest","",Class<IFunction>::getFunction(_setDigest),SETTER_METHOD,true); - c->setDeclaredMethodByQName("digest","",Class<IFunction>::getFunction(_getDigest),GETTER_METHOD,true); + c->setDeclaredMethodByQName("url","",Class<IFunction>::getFunction(c->getSystemState(),_setURL),SETTER_METHOD,true); + c->setDeclaredMethodByQName("url","",Class<IFunction>::getFunction(c->getSystemState(),_getURL),GETTER_METHOD,true); + c->setDeclaredMethodByQName("method","",Class<IFunction>::getFunction(c->getSystemState(),_setMethod),SETTER_METHOD,true); + c->setDeclaredMethodByQName("method","",Class<IFunction>::getFunction(c->getSystemState(),_getMethod),GETTER_METHOD,true); + c->setDeclaredMethodByQName("data","",Class<IFunction>::getFunction(c->getSystemState(),_setData),SETTER_METHOD,true); + c->setDeclaredMethodByQName("data","",Class<IFunction>::getFunction(c->getSystemState(),_getData),GETTER_METHOD,true); + c->setDeclaredMethodByQName("digest","",Class<IFunction>::getFunction(c->getSystemState(),_setDigest),SETTER_METHOD,true); + c->setDeclaredMethodByQName("digest","",Class<IFunction>::getFunction(c->getSystemState(),_getDigest),GETTER_METHOD,true); REGISTER_GETTER_SETTER(c,contentType); REGISTER_GETTER_SETTER(c,requestHeaders); } @@ -68,7 +68,7 @@ if(data.isNull()) return ret; - if(data->getClass()==Class<ByteArray>::getClass()) + if(data->getClass()==Class<ByteArray>::getClass(data->getSystemState())) ret=ret.getParsedURL(); else { @@ -91,7 +91,7 @@ if(contentType.find("\r")!=contentType.npos || contentType.find("\n")!=contentType.npos) { - throw Class<ArgumentError>::getInstanceS(tiny_string("The HTTP request header ") + contentType + tiny_string(" cannot be set via ActionScript."), 2096); + throw Class<ArgumentError>::getInstanceS(getSystemState(),tiny_string("The HTTP request header ") + contentType + tiny_string(" cannot be set via ActionScript."), 2096); } return contentType; @@ -126,7 +126,7 @@ if ((headerName.strchr('\r') != NULL) || headerName.strchr('\n') != NULL) - throw Class<ArgumentError>::getInstanceS("The HTTP request header cannot be set via ActionScript", 2096); + throw Class<ArgumentError>::getInstanceS(getSystemState(),"The HTTP request header cannot be set via ActionScript", 2096); for (unsigned i=0; i<(sizeof illegalHeaders)/(sizeof illegalHeaders[0]); i++) { @@ -135,7 +135,7 @@ tiny_string msg("The HTTP request header "); msg += headerName; msg += " cannot be set via ActionScript"; - throw Class<ArgumentError>::getInstanceS(msg, 2096); + throw Class<ArgumentError>::getInstanceS(getSystemState(),msg, 2096); } } } @@ -160,13 +160,13 @@ validateHeaderName(headerName); if ((header->value.strchr('\r') != NULL) || header->value.strchr('\n') != NULL) - throw Class<ArgumentError>::getInstanceS("Illegal HTTP header value"); + throw Class<ArgumentError>::getInstanceS(getSystemState(),"Illegal HTTP header value"); // Should this include the separators? headerTotalLen += header->name.numBytes(); headerTotalLen += header->value.numBytes(); if (headerTotalLen >= 8192) - throw Class<ArgumentError>::getInstanceS("Cumulative length of requestHeaders must be less than 8192 characters.", 2145); + throw Class<ArgumentError>::getInstanceS(getSystemState(),"Cumulative length of requestHeaders must be less than 8192 characters.", 2145); // Append header to results headers.push_back(headerName + ": " + header->value); @@ -184,7 +184,7 @@ if(method!=POST) return ""; - if(!data.isNull() && data->getClass()==Class<URLVariables>::getClass()) + if(!data.isNull() && data->getClass()==Class<URLVariables>::getClass(data->getSystemState())) return "Content-type: application/x-www-form-urlencoded"; else return tiny_string("Content-Type: ") + validatedContentType(); @@ -198,7 +198,7 @@ if(data.isNull()) return; - if(data->getClass()==Class<ByteArray>::getClass()) + if(data->getClass()==Class<ByteArray>::getClass(data->getSystemState())) { ByteArray *ba=data->as<ByteArray>(); const uint8_t *buf=ba->getBuffer(ba->getLength(), false); @@ -234,7 +234,7 @@ ASFUNCTIONBODY(URLRequest,_getURL) { URLRequest* th=static_cast<URLRequest*>(obj); - return Class<ASString>::getInstanceS(th->url); + return abstract_s(obj->getSystemState(),th->url); } ASFUNCTIONBODY(URLRequest,_setMethod) @@ -257,9 +257,9 @@ switch(th->method) { case GET: - return Class<ASString>::getInstanceS("GET"); + return abstract_s(obj->getSystemState(),"GET"); case POST: - return Class<ASString>::getInstanceS("POST"); + return abstract_s(obj->getSystemState(),"POST"); } return NULL; } @@ -291,7 +291,7 @@ if (th->digest.empty()) return getSys()->getNullRef(); else - return Class<ASString>::getInstanceS(th->digest); + return abstract_s(obj->getSystemState(),th->digest); } ASFUNCTIONBODY(URLRequest,_setDigest) @@ -318,7 +318,7 @@ } if (!validChars || numHexChars != 64) - throw Class<ArgumentError>::getInstanceS("An invalid digest was supplied", 2034); + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"An invalid digest was supplied", 2034); th->digest = value; return NULL; @@ -330,8 +330,8 @@ void URLRequestMethod::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("GET","",Class<ASString>::getInstanceS("GET"),DECLARED_TRAIT); - c->setVariableByQName("POST","",Class<ASString>::getInstanceS("POST"),DECLARED_TRAIT); + c->setVariableByQName("GET","",abstract_s(c->getSystemState(),"GET"),DECLARED_TRAIT); + c->setVariableByQName("POST","",abstract_s(c->getSystemState(),"POST"),DECLARED_TRAIT); } URLLoaderThread::URLLoaderThread(_R<URLRequest> request, _R<URLLoader> ldr) @@ -354,7 +354,7 @@ if(!downloader->hasFailed()) { loader->incRef(); - getVm()->addEvent(loader,_MR(Class<Event>::getInstanceS("open"))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<Event>::getInstanceS(loader->getSystemState(),"open"))); cache->waitForTermination(); if(!downloader->hasFailed() && !threadAborting) @@ -369,19 +369,19 @@ tiny_string dataFormat=loader->getDataFormat(); if(dataFormat=="binary") { - _R<ByteArray> byteArray=_MR(Class<ByteArray>::getInstanceS()); + _R<ByteArray> byteArray=_MR(Class<ByteArray>::getInstanceS(loader->getSystemState())); byteArray->acquireBuffer(buf,downloader->getLength()); data=byteArray; //The buffers must not be deleted, it's now handled by the ByteArray instance } else if(dataFormat=="text") { - data=_MR(Class<ASString>::getInstanceS((char*)buf,downloader->getLength())); + data=_MR(abstract_s(loader->getSystemState(),(char*)buf,downloader->getLength())); delete[] buf; } else if(dataFormat=="variables") { - data=_MR(Class<URLVariables>::getInstanceS((char*)buf)); + data=_MR(Class<URLVariables>::getInstanceS(loader->getSystemState(),(char*)buf)); delete[] buf; } else @@ -401,16 +401,16 @@ loader->setData(data); loader->incRef(); - getVm()->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(downloader->getLength(),downloader->getLength()))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<ProgressEvent>::getInstanceS(loader->getSystemState(),downloader->getLength(),downloader->getLength()))); //Send a complete event for this object loader->incRef(); - getVm()->addEvent(loader,_MR(Class<Event>::getInstanceS("complete"))); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<Event>::getInstanceS(loader->getSystemState(),"complete"))); } else if(!success && !threadAborting) { //Notify an error during loading loader->incRef(); - getVm()->addEvent(loader,_MR(Class<IOErrorEvent>::getInstanceS())); + getVm(loader->getSystemState())->addEvent(loader,_MR(Class<IOErrorEvent>::getInstanceS(loader->getSystemState())));
View file
lightspark.tar.xz/src/scripting/flash/printing/flashprinting.cpp
Changed
@@ -64,6 +64,6 @@ 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); + c->setVariableByQName("LANDSCAPE","",abstract_s(c->getSystemState(),"landscape"),CONSTANT_TRAIT); + c->setVariableByQName("PORTRAIT","",abstract_s(c->getSystemState(),"portrait"),CONSTANT_TRAIT); }
View file
lightspark.tar.xz/src/scripting/flash/sensors/flashsensors.cpp
Changed
@@ -35,7 +35,7 @@ { CLASS_SETUP_NO_CONSTRUCTOR(c, EventDispatcher, CLASS_SEALED); // properties - c->setDeclaredMethodByQName("isSupported", "", Class<IFunction>::getFunction(_isSupported),GETTER_METHOD,false); + c->setDeclaredMethodByQName("isSupported", "", Class<IFunction>::getFunction(c->getSystemState(),_isSupported),GETTER_METHOD,false); } void Accelerometer::buildTraits(ASObject *o) @@ -44,5 +44,5 @@ ASFUNCTIONBODY(Accelerometer,_isSupported) { - return abstract_b(false); + return abstract_b(getSys(),false); }
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.cpp
Changed
@@ -43,20 +43,20 @@ void Capabilities::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_SEALED | CLASS_FINAL); - c->setDeclaredMethodByQName("language","",Class<IFunction>::getFunction(_getLanguage),GETTER_METHOD,false); - c->setDeclaredMethodByQName("playerType","",Class<IFunction>::getFunction(_getPlayerType),GETTER_METHOD,false); - c->setDeclaredMethodByQName("version","",Class<IFunction>::getFunction(_getVersion),GETTER_METHOD,false); - c->setDeclaredMethodByQName("cpuArchitecture","",Class<IFunction>::getFunction(_getCPUArchitecture),GETTER_METHOD,false); - c->setDeclaredMethodByQName("isDebugger","",Class<IFunction>::getFunction(_getIsDebugger),GETTER_METHOD,false); - c->setDeclaredMethodByQName("isEmbeddedInAcrobat","",Class<IFunction>::getFunction(_getIsEmbeddedInAcrobat),GETTER_METHOD,false); - c->setDeclaredMethodByQName("localFileReadDisable","",Class<IFunction>::getFunction(_getLocalFileReadDisable),GETTER_METHOD,false); - c->setDeclaredMethodByQName("manufacturer","",Class<IFunction>::getFunction(_getManufacturer),GETTER_METHOD,false); - c->setDeclaredMethodByQName("os","",Class<IFunction>::getFunction(_getOS),GETTER_METHOD,false); - c->setDeclaredMethodByQName("serverString","",Class<IFunction>::getFunction(_getServerString),GETTER_METHOD,false); - c->setDeclaredMethodByQName("screenResolutionX","",Class<IFunction>::getFunction(_getScreenResolutionX),GETTER_METHOD,false); - c->setDeclaredMethodByQName("screenResolutionY","",Class<IFunction>::getFunction(_getScreenResolutionY),GETTER_METHOD,false); - c->setDeclaredMethodByQName("hasAccessibility","",Class<IFunction>::getFunction(_getHasAccessibility),GETTER_METHOD,false); - c->setDeclaredMethodByQName("screenDPI","",Class<IFunction>::getFunction(_getScreenDPI),GETTER_METHOD,false); + c->setDeclaredMethodByQName("language","",Class<IFunction>::getFunction(c->getSystemState(),_getLanguage),GETTER_METHOD,false); + c->setDeclaredMethodByQName("playerType","",Class<IFunction>::getFunction(c->getSystemState(),_getPlayerType),GETTER_METHOD,false); + c->setDeclaredMethodByQName("version","",Class<IFunction>::getFunction(c->getSystemState(),_getVersion),GETTER_METHOD,false); + c->setDeclaredMethodByQName("cpuArchitecture","",Class<IFunction>::getFunction(c->getSystemState(),_getCPUArchitecture),GETTER_METHOD,false); + c->setDeclaredMethodByQName("isDebugger","",Class<IFunction>::getFunction(c->getSystemState(),_getIsDebugger),GETTER_METHOD,false); + c->setDeclaredMethodByQName("isEmbeddedInAcrobat","",Class<IFunction>::getFunction(c->getSystemState(),_getIsEmbeddedInAcrobat),GETTER_METHOD,false); + c->setDeclaredMethodByQName("localFileReadDisable","",Class<IFunction>::getFunction(c->getSystemState(),_getLocalFileReadDisable),GETTER_METHOD,false); + c->setDeclaredMethodByQName("manufacturer","",Class<IFunction>::getFunction(c->getSystemState(),_getManufacturer),GETTER_METHOD,false); + c->setDeclaredMethodByQName("os","",Class<IFunction>::getFunction(c->getSystemState(),_getOS),GETTER_METHOD,false); + c->setDeclaredMethodByQName("serverString","",Class<IFunction>::getFunction(c->getSystemState(),_getServerString),GETTER_METHOD,false); + c->setDeclaredMethodByQName("screenResolutionX","",Class<IFunction>::getFunction(c->getSystemState(),_getScreenResolutionX),GETTER_METHOD,false); + c->setDeclaredMethodByQName("screenResolutionY","",Class<IFunction>::getFunction(c->getSystemState(),_getScreenResolutionY),GETTER_METHOD,false); + c->setDeclaredMethodByQName("hasAccessibility","",Class<IFunction>::getFunction(c->getSystemState(),_getHasAccessibility),GETTER_METHOD,false); + c->setDeclaredMethodByQName("screenDPI","",Class<IFunction>::getFunction(c->getSystemState(),_getScreenDPI),GETTER_METHOD,false); } @@ -65,53 +65,53 @@ switch (getSys()->flashMode) { case SystemState::AVMPLUS: - return Class<ASString>::getInstanceS("AVMPlus"); + return abstract_s(getSys(),"AVMPlus"); case SystemState::AIR: - return Class<ASString>::getInstanceS("Desktop"); + return abstract_s(getSys(),"Desktop"); default: - return Class<ASString>::getInstanceS("PlugIn"); + return abstract_s(getSys(),"PlugIn"); } } ASFUNCTIONBODY(Capabilities,_getLanguage) { - return Class<ASString>::getInstanceS("en"); + return abstract_s(getSys(),"en"); } ASFUNCTIONBODY(Capabilities,_getCPUArchitecture) { LOG(LOG_NOT_IMPLEMENTED, "Capabilities.cpuArchitecture is not implemented"); - return Class<ASString>::getInstanceS("x86"); + return abstract_s(getSys(),"x86"); } ASFUNCTIONBODY(Capabilities,_getIsDebugger) { - return abstract_b(false); + return abstract_b(getSys(),false); } ASFUNCTIONBODY(Capabilities,_getIsEmbeddedInAcrobat) { - return abstract_b(false); + return abstract_b(getSys(),false); } ASFUNCTIONBODY(Capabilities,_getLocalFileReadDisable) { - return abstract_b(true); + return abstract_b(getSys(),true); } ASFUNCTIONBODY(Capabilities,_getManufacturer) { - return Class<ASString>::getInstanceS(MANUFACTURER); + return abstract_s(getSys(),MANUFACTURER); } ASFUNCTIONBODY(Capabilities,_getOS) { - return Class<ASString>::getInstanceS("Linux"); + return abstract_s(getSys(),"Linux"); } ASFUNCTIONBODY(Capabilities,_getVersion) { - return Class<ASString>::getInstanceS(EMULATED_VERSION); + return abstract_s(getSys(),EMULATED_VERSION); } ASFUNCTIONBODY(Capabilities,_getServerString) @@ -165,34 +165,34 @@ supports DTS-HD High Resolution Audio DTH supports DTS-HD Master Audio DTM */ - return Class<ASString>::getInstanceS(res); + return abstract_s(getSys(),res); } ASFUNCTIONBODY(Capabilities,_getScreenResolutionX) { GdkScreen* screen = gdk_screen_get_default(); gint width = gdk_screen_get_width (screen); - return abstract_d(width); + return abstract_d(obj->getSystemState(),width); } ASFUNCTIONBODY(Capabilities,_getScreenResolutionY) { GdkScreen* screen = gdk_screen_get_default(); gint height = gdk_screen_get_height (screen); - return abstract_d(height); + return abstract_d(obj->getSystemState(),height); } ASFUNCTIONBODY(Capabilities,_getHasAccessibility) { LOG(LOG_NOT_IMPLEMENTED,"hasAccessibility always returns false"); - return abstract_b(false); + return abstract_b(getSys(),false); } ASFUNCTIONBODY(Capabilities,_getScreenDPI) { GdkScreen* screen = gdk_screen_get_default(); gdouble dpi = gdk_screen_get_resolution (screen); - return abstract_d(dpi); + return abstract_d(obj->getSystemState(),dpi); } #define MIN_DOMAIN_MEMORY_LIMIT 1024 -ApplicationDomain::ApplicationDomain(Class_base* c, _NR<ApplicationDomain> p):ASObject(c),domainMemory(Class<ByteArray>::getInstanceS()),parentDomain(p) +ApplicationDomain::ApplicationDomain(Class_base* c, _NR<ApplicationDomain> p):ASObject(c),domainMemory(Class<ByteArray>::getInstanceS(c->getSystemState())),parentDomain(p) { domainMemory->setLength(MIN_DOMAIN_MEMORY_LIMIT); } @@ -201,11 +201,11 @@ { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); //Static - c->setDeclaredMethodByQName("currentDomain","",Class<IFunction>::getFunction(_getCurrentDomain),GETTER_METHOD,false); - c->setDeclaredMethodByQName("MIN_DOMAIN_MEMORY_LENGTH","",Class<IFunction>::getFunction(_getMinDomainMemoryLength),GETTER_METHOD,false); + c->setDeclaredMethodByQName("currentDomain","",Class<IFunction>::getFunction(c->getSystemState(),_getCurrentDomain),GETTER_METHOD,false); + c->setDeclaredMethodByQName("MIN_DOMAIN_MEMORY_LENGTH","",Class<IFunction>::getFunction(c->getSystemState(),_getMinDomainMemoryLength),GETTER_METHOD,false); //Instance - c->setDeclaredMethodByQName("hasDefinition","",Class<IFunction>::getFunction(hasDefinition),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getDefinition","",Class<IFunction>::getFunction(getDefinition),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("hasDefinition","",Class<IFunction>::getFunction(c->getSystemState(),hasDefinition),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getDefinition","",Class<IFunction>::getFunction(c->getSystemState(),getDefinition),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c,domainMemory); REGISTER_GETTER(c,parentDomain); } @@ -240,7 +240,7 @@ // C++ constructor return NULL; else if(parentDomain.isNull()) - th->parentDomain = getSys()->systemDomain; + th->parentDomain = obj->getSystemState()->systemDomain; else th->parentDomain = parentDomain; return NULL; @@ -248,12 +248,12 @@ ASFUNCTIONBODY(ApplicationDomain,_getMinDomainMemoryLength) { - return abstract_ui(MIN_DOMAIN_MEMORY_LIMIT); + return abstract_ui(obj->getSystemState(),MIN_DOMAIN_MEMORY_LIMIT); } ASFUNCTIONBODY(ApplicationDomain,_getCurrentDomain) { - _NR<ApplicationDomain> ret=ABCVm::getCurrentApplicationDomain(getVm()->currentCallContext); + _NR<ApplicationDomain> ret=ABCVm::getCurrentApplicationDomain(getVm(getSys())->currentCallContext); ret->incRef(); return ret.getPtr(); } @@ -271,20 +271,20 @@ tiny_string tmpName; stringToQName(tmp,tmpName,nsName); name.name_s_id=getSys()->getUniqueStringId(tmpName); - name.ns.push_back(nsNameAndKind(nsName,NAMESPACE)); + name.ns.push_back(nsNameAndKind(obj->getSystemState(),nsName,NAMESPACE)); LOG(LOG_CALLS,_("Looking for definition of ") << name); ASObject* target; ASObject* o=th->getVariableAndTargetByMultiname(name,target); if(o==NULL) - return abstract_b(false); + return abstract_b(obj->getSystemState(),false); else { if(o->getObjectType()!=T_CLASS) - return abstract_b(false); + return abstract_b(obj->getSystemState(),false);
View file
lightspark.tar.xz/src/scripting/flash/text/flashtext.cpp
Changed
@@ -32,15 +32,15 @@ void lightspark::AntiAliasType::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("ADVANCED","",Class<ASString>::getInstanceS("advanced"),DECLARED_TRAIT); - c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),DECLARED_TRAIT); + c->setVariableByQName("ADVANCED","",abstract_s(c->getSystemState(),"advanced"),DECLARED_TRAIT); + c->setVariableByQName("NORMAL","",abstract_s(c->getSystemState(),"normal"),DECLARED_TRAIT); } void ASFont::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED); - c->setDeclaredMethodByQName("enumerateFonts","",Class<IFunction>::getFunction(enumerateFonts),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("registerFont","",Class<IFunction>::getFunction(registerFont),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("enumerateFonts","",Class<IFunction>::getFunction(c->getSystemState(),enumerateFonts),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("registerFont","",Class<IFunction>::getFunction(c->getSystemState(),registerFont),NORMAL_METHOD,false); REGISTER_GETTER(c,fontName); REGISTER_GETTER(c,fontStyle); @@ -74,7 +74,7 @@ if (enumerateDeviceFonts) LOG(LOG_NOT_IMPLEMENTED,"Font::enumerateFonts: flag enumerateDeviceFonts is not handled"); - Array* ret = Class<Array>::getInstanceS(); + Array* ret = Class<Array>::getInstanceS(getSys()); std::vector<ASObject*>* fontlist = getFontList(); for(auto i = fontlist->begin(); i != fontlist->end(); ++i) { @@ -110,48 +110,48 @@ CLASS_SETUP_NO_CONSTRUCTOR(c, InteractiveObject, CLASS_SEALED); // methods - c->setDeclaredMethodByQName("appendText","",Class<IFunction>::getFunction(TextField:: appendText),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getTextFormat","",Class<IFunction>::getFunction(_getTextFormat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setTextFormat","",Class<IFunction>::getFunction(_setTextFormat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getLineIndexAtPoint","",Class<IFunction>::getFunction(_getLineIndexAtPoint),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getLineIndexOfChar","",Class<IFunction>::getFunction(_getLineIndexOfChar),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getLineLength","",Class<IFunction>::getFunction(_getLineLength),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getLineMetrics","",Class<IFunction>::getFunction(_getLineMetrics),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getLineOffset","",Class<IFunction>::getFunction(_getLineOffset),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getLineText","",Class<IFunction>::getFunction(_getLineText),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("replaceSelectedText","",Class<IFunction>::getFunction(_replaceSelectedText),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("replaceText","",Class<IFunction>::getFunction(_replaceText),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setSelection","",Class<IFunction>::getFunction(_setSelection),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("appendText","",Class<IFunction>::getFunction(c->getSystemState(),TextField:: appendText),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getTextFormat","",Class<IFunction>::getFunction(c->getSystemState(),_getTextFormat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setTextFormat","",Class<IFunction>::getFunction(c->getSystemState(),_setTextFormat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getLineIndexAtPoint","",Class<IFunction>::getFunction(c->getSystemState(),_getLineIndexAtPoint),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getLineIndexOfChar","",Class<IFunction>::getFunction(c->getSystemState(),_getLineIndexOfChar),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getLineLength","",Class<IFunction>::getFunction(c->getSystemState(),_getLineLength),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getLineMetrics","",Class<IFunction>::getFunction(c->getSystemState(),_getLineMetrics),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getLineOffset","",Class<IFunction>::getFunction(c->getSystemState(),_getLineOffset),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getLineText","",Class<IFunction>::getFunction(c->getSystemState(),_getLineText),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("replaceSelectedText","",Class<IFunction>::getFunction(c->getSystemState(),_replaceSelectedText),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("replaceText","",Class<IFunction>::getFunction(c->getSystemState(),_replaceText),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setSelection","",Class<IFunction>::getFunction(c->getSystemState(),_setSelection),NORMAL_METHOD,true); // properties - c->setDeclaredMethodByQName("antiAliasType","",Class<IFunction>::getFunction(TextField::_getAntiAliasType),GETTER_METHOD,true); - c->setDeclaredMethodByQName("antiAliasType","",Class<IFunction>::getFunction(TextField::_setAntiAliasType),SETTER_METHOD,true); - c->setDeclaredMethodByQName("autoSize","",Class<IFunction>::getFunction(TextField::_setAutoSize),SETTER_METHOD,true); - c->setDeclaredMethodByQName("autoSize","",Class<IFunction>::getFunction(TextField::_getAutoSize),GETTER_METHOD,true); - c->setDeclaredMethodByQName("defaultTextFormat","",Class<IFunction>::getFunction(TextField::_getDefaultTextFormat),GETTER_METHOD,true); - c->setDeclaredMethodByQName("defaultTextFormat","",Class<IFunction>::getFunction(TextField::_setDefaultTextFormat),SETTER_METHOD,true); - c->setDeclaredMethodByQName("gridFitType","",Class<IFunction>::getFunction(TextField::_getGridFitType),GETTER_METHOD,true); - c->setDeclaredMethodByQName("gridFitType","",Class<IFunction>::getFunction(TextField::_setGridFitType),SETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(TextField::_getHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(TextField::_setHeight),SETTER_METHOD,true); - c->setDeclaredMethodByQName("htmlText","",Class<IFunction>::getFunction(TextField::_getHtmlText),GETTER_METHOD,true); - c->setDeclaredMethodByQName("htmlText","",Class<IFunction>::getFunction(TextField::_setHtmlText),SETTER_METHOD,true); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(TextField::_getLength),GETTER_METHOD,true); - c->setDeclaredMethodByQName("text","",Class<IFunction>::getFunction(TextField::_getText),GETTER_METHOD,true); - c->setDeclaredMethodByQName("text","",Class<IFunction>::getFunction(TextField::_setText),SETTER_METHOD,true); - c->setDeclaredMethodByQName("textHeight","",Class<IFunction>::getFunction(TextField::_getTextHeight),GETTER_METHOD,true); - c->setDeclaredMethodByQName("textWidth","",Class<IFunction>::getFunction(TextField::_getTextWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(TextField::_getWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(TextField::_setWidth),SETTER_METHOD,true); - c->setDeclaredMethodByQName("wordWrap","",Class<IFunction>::getFunction(TextField::_setWordWrap),SETTER_METHOD,true); - c->setDeclaredMethodByQName("wordWrap","",Class<IFunction>::getFunction(TextField::_getWordWrap),GETTER_METHOD,true); - c->setDeclaredMethodByQName("numLines","",Class<IFunction>::getFunction(TextField::_getNumLines),GETTER_METHOD,true); - c->setDeclaredMethodByQName("maxScrollH","",Class<IFunction>::getFunction(TextField::_getMaxScrollH),GETTER_METHOD,true); - c->setDeclaredMethodByQName("maxScrollV","",Class<IFunction>::getFunction(TextField::_getMaxScrollV),GETTER_METHOD,true); - c->setDeclaredMethodByQName("bottomScrollV","",Class<IFunction>::getFunction(TextField::_getBottomScrollV),GETTER_METHOD,true); - c->setDeclaredMethodByQName("restrict","",Class<IFunction>::getFunction(TextField::_getRestrict),GETTER_METHOD,true); - c->setDeclaredMethodByQName("restrict","",Class<IFunction>::getFunction(TextField::_setRestrict),SETTER_METHOD,true); - c->setDeclaredMethodByQName("textInteractionMode","",Class<IFunction>::getFunction(TextField::_getTextInteractionMode),GETTER_METHOD,true); + c->setDeclaredMethodByQName("antiAliasType","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getAntiAliasType),GETTER_METHOD,true); + c->setDeclaredMethodByQName("antiAliasType","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setAntiAliasType),SETTER_METHOD,true); + c->setDeclaredMethodByQName("autoSize","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setAutoSize),SETTER_METHOD,true); + c->setDeclaredMethodByQName("autoSize","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getAutoSize),GETTER_METHOD,true); + c->setDeclaredMethodByQName("defaultTextFormat","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getDefaultTextFormat),GETTER_METHOD,true); + c->setDeclaredMethodByQName("defaultTextFormat","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setDefaultTextFormat),SETTER_METHOD,true); + c->setDeclaredMethodByQName("gridFitType","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getGridFitType),GETTER_METHOD,true); + c->setDeclaredMethodByQName("gridFitType","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setGridFitType),SETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("height","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setHeight),SETTER_METHOD,true); + c->setDeclaredMethodByQName("htmlText","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getHtmlText),GETTER_METHOD,true); + c->setDeclaredMethodByQName("htmlText","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setHtmlText),SETTER_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getLength),GETTER_METHOD,true); + c->setDeclaredMethodByQName("text","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getText),GETTER_METHOD,true); + c->setDeclaredMethodByQName("text","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setText),SETTER_METHOD,true); + c->setDeclaredMethodByQName("textHeight","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getTextHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("textWidth","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getTextWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("width","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setWidth),SETTER_METHOD,true); + c->setDeclaredMethodByQName("wordWrap","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setWordWrap),SETTER_METHOD,true); + c->setDeclaredMethodByQName("wordWrap","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getWordWrap),GETTER_METHOD,true); + c->setDeclaredMethodByQName("numLines","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getNumLines),GETTER_METHOD,true); + c->setDeclaredMethodByQName("maxScrollH","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getMaxScrollH),GETTER_METHOD,true); + c->setDeclaredMethodByQName("maxScrollV","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getMaxScrollV),GETTER_METHOD,true); + c->setDeclaredMethodByQName("bottomScrollV","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getBottomScrollV),GETTER_METHOD,true); + c->setDeclaredMethodByQName("restrict","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getRestrict),GETTER_METHOD,true); + c->setDeclaredMethodByQName("restrict","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_setRestrict),SETTER_METHOD,true); + c->setDeclaredMethodByQName("textInteractionMode","",Class<IFunction>::getFunction(c->getSystemState(),TextField::_getTextInteractionMode),GETTER_METHOD,true); REGISTER_GETTER_SETTER(c, alwaysShowSelection); REGISTER_GETTER_SETTER(c, background); @@ -238,7 +238,7 @@ ASFUNCTIONBODY(TextField,_getWordWrap) { TextField* th=Class<TextField>::cast(obj); - return abstract_b(th->wordWrap); + return abstract_b(obj->getSystemState(),th->wordWrap); } ASFUNCTIONBODY(TextField,_setWordWrap) @@ -257,13 +257,13 @@ switch(th->autoSize) { case AS_NONE: - return Class<ASString>::getInstanceS("none"); + return abstract_s(obj->getSystemState(),"none"); case AS_LEFT: - return Class<ASString>::getInstanceS("left"); + return abstract_s(obj->getSystemState(),"left"); case AS_RIGHT: - return Class<ASString>::getInstanceS("right"); + return abstract_s(obj->getSystemState(),"right"); case AS_CENTER: - return Class<ASString>::getInstanceS("center"); + return abstract_s(obj->getSystemState(),"center"); } return NULL; } @@ -327,7 +327,7 @@ ASFUNCTIONBODY(TextField,_getWidth) { TextField* th=Class<TextField>::cast(obj); - return abstract_i(th->width); + return abstract_i(obj->getSystemState(),th->width); } ASFUNCTIONBODY(TextField,_setWidth) @@ -349,7 +349,7 @@ ASFUNCTIONBODY(TextField,_getHeight) { TextField* th=Class<TextField>::cast(obj); - return abstract_i(th->height); + return abstract_i(obj->getSystemState(),th->height); } ASFUNCTIONBODY(TextField,_setHeight) @@ -371,19 +371,19 @@ ASFUNCTIONBODY(TextField,_getTextWidth) { TextField* th=Class<TextField>::cast(obj); - return abstract_i(th->textWidth); + return abstract_i(obj->getSystemState(),th->textWidth); } ASFUNCTIONBODY(TextField,_getTextHeight) { TextField* th=Class<TextField>::cast(obj); - return abstract_i(th->textHeight); + return abstract_i(obj->getSystemState(),th->textHeight); } ASFUNCTIONBODY(TextField,_getHtmlText) { TextField* th=Class<TextField>::cast(obj); - return Class<ASString>::getInstanceS(th->toHtmlText()); + return abstract_s(obj->getSystemState(),th->toHtmlText()); } ASFUNCTIONBODY(TextField,_setHtmlText) @@ -398,7 +398,7 @@ ASFUNCTIONBODY(TextField,_getText) { TextField* th=Class<TextField>::cast(obj); - return Class<ASString>::getInstanceS(th->text); + return abstract_s(obj->getSystemState(),th->text); } ASFUNCTIONBODY(TextField,_setText) @@ -420,9 +420,9 @@ ASFUNCTIONBODY(TextField,_getTextFormat) { TextField* th=Class<TextField>::cast(obj); - TextFormat *format=Class<TextFormat>::getInstanceS();
View file
lightspark.tar.xz/src/scripting/flash/text/flashtextengine.cpp
Changed
@@ -60,8 +60,8 @@ void ElementFormat::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("GRAPHIC_ELEMENT","",abstract_ui(0xFDEF),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(_clone),NORMAL_METHOD,true); + c->setVariableByQName("GRAPHIC_ELEMENT","",abstract_ui(c->getSystemState(),0xFDEF),CONSTANT_TRAIT); + c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(c->getSystemState(),_clone),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c,alignmentBaseline); REGISTER_GETTER_SETTER(c,alpha); @@ -114,7 +114,7 @@ { ElementFormat* th=static_cast<ElementFormat*>(obj); - ElementFormat* newformat = Class<ElementFormat>::getInstanceS(); + ElementFormat* newformat = Class<ElementFormat>::getInstanceS(obj->getSystemState()); newformat->fontDescription = th->fontDescription; newformat->fontSize = th->fontSize; newformat->color = th->color; @@ -139,14 +139,14 @@ void FontLookup::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("DEVICE","",Class<ASString>::getInstanceS("device"),CONSTANT_TRAIT); - c->setVariableByQName("EMBEDDED_CFF","",Class<ASString>::getInstanceS("embeddedCFF"),CONSTANT_TRAIT); + c->setVariableByQName("DEVICE","",abstract_s(c->getSystemState(),"device"),CONSTANT_TRAIT); + c->setVariableByQName("EMBEDDED_CFF","",abstract_s(c->getSystemState(),"embeddedCFF"),CONSTANT_TRAIT); } void FontDescription::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); - c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(_clone),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(c->getSystemState(),_clone),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c,cffHinting); REGISTER_GETTER_SETTER(c,fontLookup); REGISTER_GETTER_SETTER(c,fontName); @@ -173,7 +173,7 @@ { FontDescription* th=static_cast<FontDescription*>(obj); - FontDescription* newfontdescription = Class<FontDescription>::getInstanceS(); + FontDescription* newfontdescription = Class<FontDescription>::getInstanceS(obj->getSystemState()); newfontdescription->cffHinting = th->cffHinting; newfontdescription->fontLookup = th->fontLookup; newfontdescription->fontName = th->fontName; @@ -187,14 +187,14 @@ void FontPosture::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("ITALIC","",Class<ASString>::getInstanceS("italic"),CONSTANT_TRAIT); - c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),CONSTANT_TRAIT); + c->setVariableByQName("ITALIC","",abstract_s(c->getSystemState(),"italic"),CONSTANT_TRAIT); + c->setVariableByQName("NORMAL","",abstract_s(c->getSystemState(),"normal"),CONSTANT_TRAIT); } void FontWeight::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("BOLD","",Class<ASString>::getInstanceS("bold"),CONSTANT_TRAIT); - c->setVariableByQName("NORMAL","",Class<ASString>::getInstanceS("normal"),CONSTANT_TRAIT); + c->setVariableByQName("BOLD","",abstract_s(c->getSystemState(),"bold"),CONSTANT_TRAIT); + c->setVariableByQName("NORMAL","",abstract_s(c->getSystemState(),"normal"),CONSTANT_TRAIT); } void FontMetrics::sinit(Class_base* c) @@ -211,29 +211,29 @@ void Kerning::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("AUTO","",Class<ASString>::getInstanceS("auto"),CONSTANT_TRAIT); - c->setVariableByQName("OFF","",Class<ASString>::getInstanceS("off"),CONSTANT_TRAIT); - c->setVariableByQName("ON","",Class<ASString>::getInstanceS("on"),CONSTANT_TRAIT); + c->setVariableByQName("AUTO","",abstract_s(c->getSystemState(),"auto"),CONSTANT_TRAIT); + c->setVariableByQName("OFF","",abstract_s(c->getSystemState(),"off"),CONSTANT_TRAIT); + c->setVariableByQName("ON","",abstract_s(c->getSystemState(),"on"),CONSTANT_TRAIT); } void LineJustification::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("ALL_BUT_LAST","",Class<ASString>::getInstanceS("allButLast"),CONSTANT_TRAIT); - c->setVariableByQName("ALL_BUT_MANDATORY_BREAK","",Class<ASString>::getInstanceS("allButMandatoryBreak"),CONSTANT_TRAIT); - c->setVariableByQName("ALL_INCLUDING_LAST","",Class<ASString>::getInstanceS("allIncludingLast"),CONSTANT_TRAIT); - c->setVariableByQName("UNJUSTIFIED","",Class<ASString>::getInstanceS("unjustified"),CONSTANT_TRAIT); + c->setVariableByQName("ALL_BUT_LAST","",abstract_s(c->getSystemState(),"allButLast"),CONSTANT_TRAIT); + c->setVariableByQName("ALL_BUT_MANDATORY_BREAK","",abstract_s(c->getSystemState(),"allButMandatoryBreak"),CONSTANT_TRAIT); + c->setVariableByQName("ALL_INCLUDING_LAST","",abstract_s(c->getSystemState(),"allIncludingLast"),CONSTANT_TRAIT); + c->setVariableByQName("UNJUSTIFIED","",abstract_s(c->getSystemState(),"unjustified"),CONSTANT_TRAIT); } void TextBaseline::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("ASCENT","",Class<ASString>::getInstanceS("ascent"),CONSTANT_TRAIT); - c->setVariableByQName("DESCENT","",Class<ASString>::getInstanceS("descent"),CONSTANT_TRAIT); - c->setVariableByQName("IDEOGRAPHIC_BOTTOM","",Class<ASString>::getInstanceS("ideographicBottom"),CONSTANT_TRAIT); - c->setVariableByQName("IDEOGRAPHIC_CENTER","",Class<ASString>::getInstanceS("ideographicCenter"),CONSTANT_TRAIT); - c->setVariableByQName("IDEOGRAPHIC_TOP","",Class<ASString>::getInstanceS("ideographicTop"),CONSTANT_TRAIT); - c->setVariableByQName("ROMAN","",Class<ASString>::getInstanceS("roman"),CONSTANT_TRAIT); - c->setVariableByQName("USE_DOMINANT_BASELINE","",Class<ASString>::getInstanceS("useDominantBaseline"),CONSTANT_TRAIT); + c->setVariableByQName("ASCENT","",abstract_s(c->getSystemState(),"ascent"),CONSTANT_TRAIT); + c->setVariableByQName("DESCENT","",abstract_s(c->getSystemState(),"descent"),CONSTANT_TRAIT); + c->setVariableByQName("IDEOGRAPHIC_BOTTOM","",abstract_s(c->getSystemState(),"ideographicBottom"),CONSTANT_TRAIT); + c->setVariableByQName("IDEOGRAPHIC_CENTER","",abstract_s(c->getSystemState(),"ideographicCenter"),CONSTANT_TRAIT); + c->setVariableByQName("IDEOGRAPHIC_TOP","",abstract_s(c->getSystemState(),"ideographicTop"),CONSTANT_TRAIT); + c->setVariableByQName("ROMAN","",abstract_s(c->getSystemState(),"roman"),CONSTANT_TRAIT); + c->setVariableByQName("USE_DOMINANT_BASELINE","",abstract_s(c->getSystemState(),"useDominantBaseline"),CONSTANT_TRAIT); } void TextJustifier::sinit(Class_base* c) @@ -273,9 +273,9 @@ void TextBlock::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); - c->setDeclaredMethodByQName("createTextLine","",Class<IFunction>::getFunction(createTextLine),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("recreateTextLine","",Class<IFunction>::getFunction(recreateTextLine),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("releaseLines","",Class<IFunction>::getFunction(releaseLines),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("createTextLine","",Class<IFunction>::getFunction(c->getSystemState(),createTextLine),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("recreateTextLine","",Class<IFunction>::getFunction(c->getSystemState(),recreateTextLine),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("releaseLines","",Class<IFunction>::getFunction(c->getSystemState(),releaseLines),NORMAL_METHOD,true); REGISTER_GETTER(c, firstLine); REGISTER_GETTER(c, lastLine); REGISTER_GETTER_SETTER(c, content); @@ -326,7 +326,7 @@ LOG(LOG_NOT_IMPLEMENTED,"splitting textblock in multiple lines not implemented"); th->content->as<TextElement>()->text = ""; th->incRef(); - _NR<TextLine> textLine = _NR<TextLine>(Class<TextLine>::getInstanceS(linetext, _MNR(th))); + _NR<TextLine> textLine = _NR<TextLine>(Class<TextLine>::getInstanceS(obj->getSystemState(),linetext, _MNR(th))); textLine->width = (uint32_t)width; textLine->previousLine = previousLine; textLine->updateSizes(); @@ -485,11 +485,11 @@ void TextLine::sinit(Class_base* c) { CLASS_SETUP(c, DisplayObjectContainer, _constructor, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("MAX_LINE_WIDTH","",abstract_ui(MAX_LINE_WIDTH),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("descent","",Class<IFunction>::getFunction(getDescent),GETTER_METHOD,true); - c->setDeclaredMethodByQName("ascent","",Class<IFunction>::getFunction(getAscent),GETTER_METHOD,true); - c->setDeclaredMethodByQName("textWidth","",Class<IFunction>::getFunction(getTextWidth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("textHeight","",Class<IFunction>::getFunction(getTextHeight),GETTER_METHOD,true); + c->setVariableByQName("MAX_LINE_WIDTH","",abstract_ui(c->getSystemState(),MAX_LINE_WIDTH),CONSTANT_TRAIT); + c->setDeclaredMethodByQName("descent","",Class<IFunction>::getFunction(c->getSystemState(),getDescent),GETTER_METHOD,true); + c->setDeclaredMethodByQName("ascent","",Class<IFunction>::getFunction(c->getSystemState(),getAscent),GETTER_METHOD,true); + c->setDeclaredMethodByQName("textWidth","",Class<IFunction>::getFunction(c->getSystemState(),getTextWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("textHeight","",Class<IFunction>::getFunction(c->getSystemState(),getTextHeight),GETTER_METHOD,true); REGISTER_GETTER(c, textBlock); REGISTER_GETTER(c, nextLine); REGISTER_GETTER(c, previousLine); @@ -514,26 +514,26 @@ ASFUNCTIONBODY(TextLine, getDescent) { LOG(LOG_NOT_IMPLEMENTED,"TextLine.descent"); - return abstract_d(0); + return abstract_d(obj->getSystemState(),0); } ASFUNCTIONBODY(TextLine, getAscent) { TextLine* th=static_cast<TextLine*>(obj); LOG(LOG_NOT_IMPLEMENTED,"TextLine.ascent"); - return abstract_d(th->textHeight); + return abstract_d(obj->getSystemState(),th->textHeight); } ASFUNCTIONBODY(TextLine, getTextWidth) { TextLine* th=static_cast<TextLine*>(obj); - return abstract_d(th->textWidth); + return abstract_d(obj->getSystemState(),th->textWidth); } ASFUNCTIONBODY(TextLine, getTextHeight) { TextLine* th=static_cast<TextLine*>(obj); - return abstract_d(th->textHeight); + return abstract_d(obj->getSystemState(),th->textHeight); } @@ -617,9 +617,9 @@ void TextLineValidity::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("INVALID","",Class<ASString>::getInstanceS("invalid"),CONSTANT_TRAIT); - c->setVariableByQName("POSSIBLY_INVALID","",Class<ASString>::getInstanceS("possiblyInvalid"),CONSTANT_TRAIT); - c->setVariableByQName("STATIC","",Class<ASString>::getInstanceS("static"),CONSTANT_TRAIT); - c->setVariableByQName("VALID","",Class<ASString>::getInstanceS("valid"),CONSTANT_TRAIT); + c->setVariableByQName("INVALID","",abstract_s(c->getSystemState(),"invalid"),CONSTANT_TRAIT); + c->setVariableByQName("POSSIBLY_INVALID","",abstract_s(c->getSystemState(),"possiblyInvalid"),CONSTANT_TRAIT); + c->setVariableByQName("STATIC","",abstract_s(c->getSystemState(),"static"),CONSTANT_TRAIT); + c->setVariableByQName("VALID","",abstract_s(c->getSystemState(),"valid"),CONSTANT_TRAIT); }
View file
lightspark.tar.xz/src/scripting/flash/ui/ContextMenu.cpp
Changed
@@ -22,15 +22,15 @@ using namespace std; using namespace lightspark; -ContextMenu::ContextMenu(Class_base* c):EventDispatcher(c),customItems(Class<Array>::getInstanceS()),builtInItems(Class<ContextMenuBuiltInItems>::getInstanceS()) +ContextMenu::ContextMenu(Class_base* c):EventDispatcher(c),customItems(Class<Array>::getInstanceS(c->getSystemState())),builtInItems(Class<ContextMenuBuiltInItems>::getInstanceS(c->getSystemState())) { } void ContextMenu::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_FINAL); - c->setVariableByQName("isSupported","",abstract_b(false),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("hideBuiltInItems","",Class<IFunction>::getFunction(hideBuiltInItems),NORMAL_METHOD,true); + c->setVariableByQName("isSupported","",abstract_b(c->getSystemState(),false),CONSTANT_TRAIT); + c->setDeclaredMethodByQName("hideBuiltInItems","",Class<IFunction>::getFunction(c->getSystemState(),hideBuiltInItems),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c,customItems); REGISTER_GETTER_SETTER(c,builtInItems); }
View file
lightspark.tar.xz/src/scripting/flash/ui/Keyboard.cpp
Changed
@@ -28,18 +28,18 @@ void Keyboard::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_FINAL | CLASS_SEALED); - c->setDeclaredMethodByQName("capsLock","",Class<IFunction>::getFunction(capsLock),GETTER_METHOD,true); - c->setDeclaredMethodByQName("hasVirtualKeyboard","",Class<IFunction>::getFunction(hasVirtualKeyboard),GETTER_METHOD,true); - c->setDeclaredMethodByQName("numLock","",Class<IFunction>::getFunction(numLock),GETTER_METHOD,true); - c->setDeclaredMethodByQName("physicalKeyboardType","",Class<IFunction>::getFunction(physicalKeyboardType),GETTER_METHOD,true); - c->setDeclaredMethodByQName("isAccessible","",Class<IFunction>::getFunction(isAccessible),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("capsLock","",Class<IFunction>::getFunction(c->getSystemState(),capsLock),GETTER_METHOD,true); + c->setDeclaredMethodByQName("hasVirtualKeyboard","",Class<IFunction>::getFunction(c->getSystemState(),hasVirtualKeyboard),GETTER_METHOD,true); + c->setDeclaredMethodByQName("numLock","",Class<IFunction>::getFunction(c->getSystemState(),numLock),GETTER_METHOD,true); + c->setDeclaredMethodByQName("physicalKeyboardType","",Class<IFunction>::getFunction(c->getSystemState(),physicalKeyboardType),GETTER_METHOD,true); + c->setDeclaredMethodByQName("isAccessible","",Class<IFunction>::getFunction(c->getSystemState(),isAccessible),NORMAL_METHOD,true); // key code constants const std::vector<KeyNameCodePair>& keys = getSys()->getInputThread()->getKeyNamesAndCodes(); std::vector<KeyNameCodePair>::const_iterator it; for (it=keys.begin(); it!=keys.end(); ++it) { - c->setVariableByQName(it->keyname,"",Class<UInteger>::getInstanceS(it->keycode),DECLARED_TRAIT); + c->setVariableByQName(it->keyname,"",abstract_ui(c->getSystemState(),it->keycode),DECLARED_TRAIT); } } @@ -49,43 +49,43 @@ //return abstract_b(gdk_keymap_get_caps_lock_state(gdk_keymap_get_default())); LOG(LOG_NOT_IMPLEMENTED, "Keyboard::capsLock"); - return abstract_b(false); + return abstract_b(getSys(),false); } ASFUNCTIONBODY(Keyboard, hasVirtualKeyboard) { - return abstract_b(false); + return abstract_b(getSys(),false); } ASFUNCTIONBODY(Keyboard, numLock) { LOG(LOG_NOT_IMPLEMENTED, "Keyboard::numLock"); - return abstract_b(false); + return abstract_b(getSys(),false); } ASFUNCTIONBODY(Keyboard, physicalKeyboardType) { - return Class<ASString>::getInstanceS("alphanumeric"); + return abstract_s(getSys(),"alphanumeric"); } ASFUNCTIONBODY(Keyboard, isAccessible) { - return abstract_b(false); + return abstract_b(getSys(),false); } void KeyboardType::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("ALPHANUMERIC","",Class<ASString>::getInstanceS("alphanumeric"),DECLARED_TRAIT); - c->setVariableByQName("KEYPAD","",Class<ASString>::getInstanceS("keypad"),DECLARED_TRAIT); - c->setVariableByQName("NONE","",Class<ASString>::getInstanceS("none"),DECLARED_TRAIT); + c->setVariableByQName("ALPHANUMERIC","",abstract_s(c->getSystemState(),"alphanumeric"),DECLARED_TRAIT); + c->setVariableByQName("KEYPAD","",abstract_s(c->getSystemState(),"keypad"),DECLARED_TRAIT); + c->setVariableByQName("NONE","",abstract_s(c->getSystemState(),"none"),DECLARED_TRAIT); } void KeyLocation::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_FINAL | CLASS_SEALED); - c->setVariableByQName("LEFT","",Class<UInteger>::getInstanceS(1),DECLARED_TRAIT); - c->setVariableByQName("NUM_PAD","",Class<UInteger>::getInstanceS(3),DECLARED_TRAIT); - c->setVariableByQName("RIGHT","",Class<UInteger>::getInstanceS(2),DECLARED_TRAIT); - c->setVariableByQName("STANDARD","",Class<UInteger>::getInstanceS(0),DECLARED_TRAIT); + c->setVariableByQName("LEFT","",abstract_ui(c->getSystemState(),1),DECLARED_TRAIT); + c->setVariableByQName("NUM_PAD","",abstract_ui(c->getSystemState(),3),DECLARED_TRAIT); + c->setVariableByQName("RIGHT","",abstract_ui(c->getSystemState(),2),DECLARED_TRAIT); + c->setVariableByQName("STANDARD","",abstract_ui(c->getSystemState(),0),DECLARED_TRAIT); }
View file
lightspark.tar.xz/src/scripting/flash/ui/Mouse.cpp
Changed
@@ -30,12 +30,12 @@ void Mouse::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_FINAL | CLASS_SEALED); - c->setDeclaredMethodByQName("hide","",Class<IFunction>::getFunction(hide),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("show","",Class<IFunction>::getFunction(show),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("cursor","",Class<IFunction>::getFunction(getCursor),GETTER_METHOD,false); - c->setDeclaredMethodByQName("cursor","",Class<IFunction>::getFunction(setCursor),SETTER_METHOD,false); - c->setDeclaredMethodByQName("supportsCursor","",Class<IFunction>::getFunction(getSupportsCursor),GETTER_METHOD,false); - c->setDeclaredMethodByQName("supportsNativeCursor","",Class<IFunction>::getFunction(getSupportsNativeCursor),GETTER_METHOD,false); + c->setDeclaredMethodByQName("hide","",Class<IFunction>::getFunction(c->getSystemState(),hide),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("show","",Class<IFunction>::getFunction(c->getSystemState(),show),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("cursor","",Class<IFunction>::getFunction(c->getSystemState(),getCursor),GETTER_METHOD,false); + c->setDeclaredMethodByQName("cursor","",Class<IFunction>::getFunction(c->getSystemState(),setCursor),SETTER_METHOD,false); + c->setDeclaredMethodByQName("supportsCursor","",Class<IFunction>::getFunction(c->getSystemState(),getSupportsCursor),GETTER_METHOD,false); + c->setDeclaredMethodByQName("supportsNativeCursor","",Class<IFunction>::getFunction(c->getSystemState(),getSupportsNativeCursor),GETTER_METHOD,false); } ASFUNCTIONBODY(Mouse, hide) @@ -52,7 +52,7 @@ ASFUNCTIONBODY(Mouse, getCursor) { - return Class<ASString>::getInstanceS("auto"); + return abstract_s(getSys(),"auto"); } ASFUNCTIONBODY(Mouse, setCursor) @@ -66,10 +66,10 @@ ASFUNCTIONBODY(Mouse, getSupportsCursor) { - return abstract_b(true); + return abstract_b(getSys(),true); } ASFUNCTIONBODY(Mouse, getSupportsNativeCursor) { - return abstract_b(false); // until registerCursor() is implemented + return abstract_b(getSys(),false); // until registerCursor() is implemented }
View file
lightspark.tar.xz/src/scripting/flash/ui/Multitouch.cpp
Changed
@@ -31,37 +31,37 @@ void Multitouch::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_FINAL | CLASS_SEALED); - c->setDeclaredMethodByQName("inputMode","",Class<IFunction>::getFunction(getInputMode),GETTER_METHOD,false); - c->setDeclaredMethodByQName("maxTouchPoints","",Class<IFunction>::getFunction(getMaxTouchPoints),GETTER_METHOD,false); - c->setDeclaredMethodByQName("supportedGestures","",Class<IFunction>::getFunction(getSupportedGestures),GETTER_METHOD,false); - c->setDeclaredMethodByQName("supportsGestureEvents","",Class<IFunction>::getFunction(getSupportsGestureEvents),GETTER_METHOD,false); - c->setDeclaredMethodByQName("supportsTouchEvents","",Class<IFunction>::getFunction(getSupportsTouchEvents),GETTER_METHOD,false); + c->setDeclaredMethodByQName("inputMode","",Class<IFunction>::getFunction(c->getSystemState(),getInputMode),GETTER_METHOD,false); + c->setDeclaredMethodByQName("maxTouchPoints","",Class<IFunction>::getFunction(c->getSystemState(),getMaxTouchPoints),GETTER_METHOD,false); + c->setDeclaredMethodByQName("supportedGestures","",Class<IFunction>::getFunction(c->getSystemState(),getSupportedGestures),GETTER_METHOD,false); + c->setDeclaredMethodByQName("supportsGestureEvents","",Class<IFunction>::getFunction(c->getSystemState(),getSupportsGestureEvents),GETTER_METHOD,false); + c->setDeclaredMethodByQName("supportsTouchEvents","",Class<IFunction>::getFunction(c->getSystemState(),getSupportsTouchEvents),GETTER_METHOD,false); } ASFUNCTIONBODY(Multitouch, getInputMode) { LOG(LOG_NOT_IMPLEMENTED,"Multitouch not supported"); - return Class<ASString>::getInstanceS("gesture"); + return abstract_s(getSys(),"gesture"); } ASFUNCTIONBODY(Multitouch, getMaxTouchPoints) { LOG(LOG_NOT_IMPLEMENTED,"Multitouch not supported"); - return abstract_i(1); + return abstract_i(getSys(),1); } ASFUNCTIONBODY(Multitouch, getSupportedGestures) { LOG(LOG_NOT_IMPLEMENTED,"Multitouch not supported"); - return Class<Vector>::getInstanceS(); + return Class<Vector>::getInstanceS(getSys()); } ASFUNCTIONBODY(Multitouch, getSupportsGestureEvents) { LOG(LOG_NOT_IMPLEMENTED,"Multitouch not supported"); - return abstract_b(false); + return abstract_b(getSys(),false); } ASFUNCTIONBODY(Multitouch, getSupportsTouchEvents) { LOG(LOG_NOT_IMPLEMENTED,"Multitouch not supported"); - return abstract_b(false); + return abstract_b(getSys(),false); }
View file
lightspark.tar.xz/src/scripting/flash/utils/ByteArray.cpp
Changed
@@ -57,59 +57,59 @@ void ByteArray::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_getLength),GETTER_METHOD,true); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_setLength),SETTER_METHOD,true); - c->setDeclaredMethodByQName("bytesAvailable","",Class<IFunction>::getFunction(_getBytesAvailable),GETTER_METHOD,true); - c->setDeclaredMethodByQName("position","",Class<IFunction>::getFunction(_getPosition),GETTER_METHOD,true); - c->setDeclaredMethodByQName("position","",Class<IFunction>::getFunction(_setPosition),SETTER_METHOD,true); - c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(_getEndian),GETTER_METHOD,true); - c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(_setEndian),SETTER_METHOD,true); - c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(_getObjectEncoding),GETTER_METHOD,true); - c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(_setObjectEncoding),SETTER_METHOD,true); - c->setDeclaredMethodByQName("defaultObjectEncoding","",Class<IFunction>::getFunction(_getDefaultObjectEncoding),GETTER_METHOD,false); - c->setDeclaredMethodByQName("defaultObjectEncoding","",Class<IFunction>::getFunction(_setDefaultObjectEncoding),SETTER_METHOD,false); - - getSys()->staticByteArrayDefaultObjectEncoding = ObjectEncoding::DEFAULT; - c->setDeclaredMethodByQName("clear","",Class<IFunction>::getFunction(clear),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("compress","",Class<IFunction>::getFunction(_compress),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("uncompress","",Class<IFunction>::getFunction(_uncompress),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("deflate","",Class<IFunction>::getFunction(_deflate),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("inflate","",Class<IFunction>::getFunction(_inflate),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readBoolean","",Class<IFunction>::getFunction(readBoolean),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readBytes","",Class<IFunction>::getFunction(readBytes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readByte","",Class<IFunction>::getFunction(readByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readDouble","",Class<IFunction>::getFunction(readDouble),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readFloat","",Class<IFunction>::getFunction(readFloat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readInt","",Class<IFunction>::getFunction(readInt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readMultiByte","",Class<IFunction>::getFunction(readMultiByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readShort","",Class<IFunction>::getFunction(readShort),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUnsignedByte","",Class<IFunction>::getFunction(readUnsignedByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUnsignedInt","",Class<IFunction>::getFunction(readUnsignedInt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUnsignedShort","",Class<IFunction>::getFunction(readUnsignedShort),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readObject","",Class<IFunction>::getFunction(readObject),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUTF","",Class<IFunction>::getFunction(readUTF),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("readUTFBytes","",Class<IFunction>::getFunction(readUTFBytes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeBoolean","",Class<IFunction>::getFunction(writeBoolean),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeUTF","",Class<IFunction>::getFunction(writeUTF),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeUTFBytes","",Class<IFunction>::getFunction(writeUTFBytes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeBytes","",Class<IFunction>::getFunction(writeBytes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeByte","",Class<IFunction>::getFunction(writeByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeDouble","",Class<IFunction>::getFunction(writeDouble),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeFloat","",Class<IFunction>::getFunction(writeFloat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeInt","",Class<IFunction>::getFunction(writeInt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeMultiByte","",Class<IFunction>::getFunction(writeMultiByte),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeUnsignedInt","",Class<IFunction>::getFunction(writeUnsignedInt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeObject","",Class<IFunction>::getFunction(writeObject),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("writeShort","",Class<IFunction>::getFunction(writeShort),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(ByteArray::_toString),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),_getLength),GETTER_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),_setLength),SETTER_METHOD,true); + c->setDeclaredMethodByQName("bytesAvailable","",Class<IFunction>::getFunction(c->getSystemState(),_getBytesAvailable),GETTER_METHOD,true); + c->setDeclaredMethodByQName("position","",Class<IFunction>::getFunction(c->getSystemState(),_getPosition),GETTER_METHOD,true); + c->setDeclaredMethodByQName("position","",Class<IFunction>::getFunction(c->getSystemState(),_setPosition),SETTER_METHOD,true); + c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(c->getSystemState(),_getEndian),GETTER_METHOD,true); + c->setDeclaredMethodByQName("endian","",Class<IFunction>::getFunction(c->getSystemState(),_setEndian),SETTER_METHOD,true); + c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(c->getSystemState(),_getObjectEncoding),GETTER_METHOD,true); + c->setDeclaredMethodByQName("objectEncoding","",Class<IFunction>::getFunction(c->getSystemState(),_setObjectEncoding),SETTER_METHOD,true); + c->setDeclaredMethodByQName("defaultObjectEncoding","",Class<IFunction>::getFunction(c->getSystemState(),_getDefaultObjectEncoding),GETTER_METHOD,false); + c->setDeclaredMethodByQName("defaultObjectEncoding","",Class<IFunction>::getFunction(c->getSystemState(),_setDefaultObjectEncoding),SETTER_METHOD,false); + + c->getSystemState()->staticByteArrayDefaultObjectEncoding = ObjectEncoding::DEFAULT; + c->setDeclaredMethodByQName("clear","",Class<IFunction>::getFunction(c->getSystemState(),clear),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("compress","",Class<IFunction>::getFunction(c->getSystemState(),_compress),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("uncompress","",Class<IFunction>::getFunction(c->getSystemState(),_uncompress),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("deflate","",Class<IFunction>::getFunction(c->getSystemState(),_deflate),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("inflate","",Class<IFunction>::getFunction(c->getSystemState(),_inflate),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readBoolean","",Class<IFunction>::getFunction(c->getSystemState(),readBoolean),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readBytes","",Class<IFunction>::getFunction(c->getSystemState(),readBytes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readByte","",Class<IFunction>::getFunction(c->getSystemState(),readByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readDouble","",Class<IFunction>::getFunction(c->getSystemState(),readDouble),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readFloat","",Class<IFunction>::getFunction(c->getSystemState(),readFloat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readInt","",Class<IFunction>::getFunction(c->getSystemState(),readInt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readMultiByte","",Class<IFunction>::getFunction(c->getSystemState(),readMultiByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readShort","",Class<IFunction>::getFunction(c->getSystemState(),readShort),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUnsignedByte","",Class<IFunction>::getFunction(c->getSystemState(),readUnsignedByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUnsignedInt","",Class<IFunction>::getFunction(c->getSystemState(),readUnsignedInt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUnsignedShort","",Class<IFunction>::getFunction(c->getSystemState(),readUnsignedShort),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readObject","",Class<IFunction>::getFunction(c->getSystemState(),readObject),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUTF","",Class<IFunction>::getFunction(c->getSystemState(),readUTF),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("readUTFBytes","",Class<IFunction>::getFunction(c->getSystemState(),readUTFBytes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeBoolean","",Class<IFunction>::getFunction(c->getSystemState(),writeBoolean),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeUTF","",Class<IFunction>::getFunction(c->getSystemState(),writeUTF),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeUTFBytes","",Class<IFunction>::getFunction(c->getSystemState(),writeUTFBytes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeBytes","",Class<IFunction>::getFunction(c->getSystemState(),writeBytes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeByte","",Class<IFunction>::getFunction(c->getSystemState(),writeByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeDouble","",Class<IFunction>::getFunction(c->getSystemState(),writeDouble),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeFloat","",Class<IFunction>::getFunction(c->getSystemState(),writeFloat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeInt","",Class<IFunction>::getFunction(c->getSystemState(),writeInt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeMultiByte","",Class<IFunction>::getFunction(c->getSystemState(),writeMultiByte),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeUnsignedInt","",Class<IFunction>::getFunction(c->getSystemState(),writeUnsignedInt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeObject","",Class<IFunction>::getFunction(c->getSystemState(),writeObject),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("writeShort","",Class<IFunction>::getFunction(c->getSystemState(),writeShort),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),ByteArray::_toString),DYNAMIC_TRAIT); REGISTER_GETTER_SETTER(c,shareable); - c->setDeclaredMethodByQName("atomicCompareAndSwapIntAt","",Class<IFunction>::getFunction(atomicCompareAndSwapIntAt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("atomicCompareAndSwapLength","",Class<IFunction>::getFunction(atomicCompareAndSwapLength),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toJSON",AS3,Class<IFunction>::getFunction(_toJSON),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("atomicCompareAndSwapIntAt","",Class<IFunction>::getFunction(c->getSystemState(),atomicCompareAndSwapIntAt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("atomicCompareAndSwapLength","",Class<IFunction>::getFunction(c->getSystemState(),atomicCompareAndSwapLength),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toJSON",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toJSON),DYNAMIC_TRAIT); - c->addImplementedInterface(InterfaceClass<IDataInput>::getClass()); + c->addImplementedInterface(InterfaceClass<IDataInput>::getClass(c->getSystemState())); IDataInput::linkTraits(c); - c->addImplementedInterface(InterfaceClass<IDataOutput>::getClass()); + c->addImplementedInterface(InterfaceClass<IDataOutput>::getClass(c->getSystemState())); IDataOutput::linkTraits(c); } @@ -239,7 +239,7 @@ ASFUNCTIONBODY(ByteArray,_getPosition) { ByteArray* th=static_cast<ByteArray*>(obj); - return abstract_i(th->getPosition()); + return abstract_i(obj->getSystemState(),th->getPosition()); } void ByteArray::setPosition(uint32_t p) @@ -261,9 +261,9 @@ { ByteArray* th=static_cast<ByteArray*>(obj); if(th->littleEndian) - return Class<ASString>::getInstanceS(Endian::littleEndian); + return abstract_s(obj->getSystemState(),Endian::littleEndian); else - return Class<ASString>::getInstanceS(Endian::bigEndian); + return abstract_s(obj->getSystemState(),Endian::bigEndian); } ASFUNCTIONBODY(ByteArray,_setEndian) @@ -281,7 +281,7 @@ ASFUNCTIONBODY(ByteArray,_getObjectEncoding) { ByteArray* th=static_cast<ByteArray*>(obj); - return abstract_ui(th->objectEncoding); + return abstract_ui(obj->getSystemState(),th->objectEncoding); } ASFUNCTIONBODY(ByteArray,_setObjectEncoding) @@ -299,7 +299,7 @@ ASFUNCTIONBODY(ByteArray,_getDefaultObjectEncoding) { - return abstract_i(getSys()->staticNetConnectionDefaultObjectEncoding); + return abstract_i(obj->getSystemState(),obj->getSystemState()->staticNetConnectionDefaultObjectEncoding); } ASFUNCTIONBODY(ByteArray,_setDefaultObjectEncoding) @@ -307,9 +307,9 @@ assert_and_throw(argslen == 1); int32_t value = args[0]->toInt(); if(value == 0) - getSys()->staticByteArrayDefaultObjectEncoding = ObjectEncoding::AMF0; + args[0]->getSystemState()->staticByteArrayDefaultObjectEncoding = ObjectEncoding::AMF0; else if(value == 3) - getSys()->staticByteArrayDefaultObjectEncoding = ObjectEncoding::AMF3; + args[0]->getSystemState()->staticByteArrayDefaultObjectEncoding = ObjectEncoding::AMF3; else throw RunTimeException("Invalid object encoding"); return NULL; @@ -353,13 +353,13 @@ ASFUNCTIONBODY(ByteArray,_getLength) { ByteArray* th=static_cast<ByteArray*>(obj); - return abstract_i(th->len); + return abstract_i(obj->getSystemState(),th->len); } ASFUNCTIONBODY(ByteArray,_getBytesAvailable) { ByteArray* th=static_cast<ByteArray*>(obj); - return abstract_i(th->len-th->position); + return abstract_i(obj->getSystemState(),th->len-th->position); } ASFUNCTIONBODY(ByteArray,readBoolean) @@ -375,7 +375,7 @@ } th->unlock(); - return abstract_b(ret!=0); + return abstract_b(obj->getSystemState(),ret!=0); } ASFUNCTIONBODY(ByteArray,readBytes) @@ -402,7 +402,7 @@ if((uint64_t)length+offset > 0xFFFFFFFF) { th->unlock(); - throw Class<RangeError>::getInstanceS("length+offset"); + throw Class<RangeError>::getInstanceS(obj->getSystemState(),"length+offset"); } uint8_t* buf=out->getBuffer(length+offset,true); @@ -451,7 +451,7 @@ throwError<EOFError>(kEOFError); } th->unlock(); - return Class<ASString>::getInstanceS(res);
View file
lightspark.tar.xz/src/scripting/flash/utils/CompressionAlgorithm.cpp
Changed
@@ -33,7 +33,7 @@ void CompressionAlgorithm::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED|CLASS_FINAL); - c->setVariableByQName("DEFLATE","",Class<ASString>::getInstanceS("deflate"),CONSTANT_TRAIT); - c->setVariableByQName("LZMA","",Class<ASString>::getInstanceS("lzma"),CONSTANT_TRAIT); - c->setVariableByQName("ZLIB","",Class<ASString>::getInstanceS("zlib"),CONSTANT_TRAIT); + c->setVariableByQName("DEFLATE","",abstract_s(c->getSystemState(),"deflate"),CONSTANT_TRAIT); + c->setVariableByQName("LZMA","",abstract_s(c->getSystemState(),"lzma"),CONSTANT_TRAIT); + c->setVariableByQName("ZLIB","",abstract_s(c->getSystemState(),"zlib"),CONSTANT_TRAIT); }
View file
lightspark.tar.xz/src/scripting/flash/utils/Dictionary.cpp
Changed
@@ -43,7 +43,7 @@ void Dictionary::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_DYNAMIC_NOT_FINAL); - c->prototype->setVariableByQName("toJSON",AS3,Class<IFunction>::getFunction(_toJSON),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toJSON",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toJSON),DYNAMIC_TRAIT); } void Dictionary::buildTraits(ASObject* o) @@ -61,7 +61,7 @@ ASFUNCTIONBODY(Dictionary,_toJSON) { - return Class<ASString>::getInstanceS("Dictionary"); + return abstract_s(getSys(),"Dictionary"); } Dictionary::dictType::iterator Dictionary::findKey(ASObject *o) @@ -79,7 +79,7 @@ void Dictionary::setVariableByMultiname_i(const multiname& name, int32_t value) { assert_and_throw(implEnable); - Dictionary::setVariableByMultiname(name,abstract_i(value),CONST_NOT_ALLOWED); + Dictionary::setVariableByMultiname(name,abstract_i(getSystemState(),value),CONST_NOT_ALLOWED); } void Dictionary::setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst) @@ -88,7 +88,7 @@ if(name.name_type==multiname::NAME_OBJECT) { multiname tmpname(NULL); - tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + tmpname.ns.push_back(nsNameAndKind(getSystemState(),"",NAMESPACE)); switch (name.name_o->getObjectType()) { case T_BOOLEAN: @@ -105,7 +105,7 @@ return; case T_STRING: tmpname.name_type=multiname::NAME_STRING; - tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + tmpname.name_s_id = getSystemState()->getUniqueStringId(name.name_o->toString()); ASObject::setVariableByMultiname(tmpname, o, allowConst); return; default: @@ -138,7 +138,7 @@ if(name.name_type==multiname::NAME_OBJECT) { multiname tmpname(NULL); - tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + tmpname.ns.push_back(nsNameAndKind(getSystemState(),"",NAMESPACE)); switch (name.name_o->getObjectType()) { case T_BOOLEAN: @@ -153,7 +153,7 @@ return ASObject::deleteVariableByMultiname(tmpname); case T_STRING: tmpname.name_type=multiname::NAME_STRING; - tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + tmpname.name_s_id = getSystemState()->getUniqueStringId(name.name_o->toString()); return ASObject::deleteVariableByMultiname(tmpname); default: break; @@ -187,7 +187,7 @@ if(name.name_type==multiname::NAME_OBJECT) { multiname tmpname(NULL); - tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + tmpname.ns.push_back(nsNameAndKind(getSystemState(),"",NAMESPACE)); switch (name.name_o->getObjectType()) { case T_BOOLEAN: @@ -202,7 +202,7 @@ return ASObject::getVariableByMultiname(tmpname, opt); case T_STRING: tmpname.name_type=multiname::NAME_STRING; - tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + tmpname.name_s_id = getSystemState()->getUniqueStringId(name.name_o->toString()); return ASObject::getVariableByMultiname(tmpname, opt); default: break; @@ -244,7 +244,7 @@ if(name.name_type==multiname::NAME_OBJECT) { multiname tmpname(NULL); - tmpname.ns.push_back(nsNameAndKind("",NAMESPACE)); + tmpname.ns.push_back(nsNameAndKind(getSystemState(),"",NAMESPACE)); switch (name.name_o->getObjectType()) { case T_BOOLEAN: @@ -259,7 +259,7 @@ return ASObject::hasPropertyByMultiname(tmpname, considerDynamic, considerPrototype); case T_STRING: tmpname.name_type=multiname::NAME_STRING; - tmpname.name_s_id = getSys()->getUniqueStringId(name.name_o->toString()); + tmpname.name_s_id = getSystemState()->getUniqueStringId(name.name_o->toString()); return ASObject::hasPropertyByMultiname(tmpname, considerDynamic, considerPrototype); default: break;
View file
lightspark.tar.xz/src/scripting/flash/utils/IntervalRunner.cpp
Changed
@@ -55,7 +55,7 @@ args[i]->incRef(); } _R<FunctionEvent> event(new (getSys()->unaccountedMemory) FunctionEvent(callback, obj, args, argslen)); - getVm()->addEvent(NullRef,event); + getVm(getSys())->addEvent(NullRef,event); event->done.wait(); if(type == TIMEOUT) {
View file
lightspark.tar.xz/src/scripting/flash/utils/Proxy.cpp
Changed
@@ -39,7 +39,7 @@ { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject,CLASS_DYNAMIC_NOT_FINAL); c->isProxy = true; - c->setDeclaredMethodByQName("isAttribute","",Class<IFunction>::getFunction(_isAttribute),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("isAttribute","",Class<IFunction>::getFunction(c->getSystemState(),_isAttribute),NORMAL_METHOD,true); } void Proxy::buildTraits(ASObject* o) @@ -51,7 +51,7 @@ ARG_UNPACK(name); multiname mname(NULL); name->applyProxyProperty(mname); - return abstract_b(mname.isAttribute); + return abstract_b(obj->getSystemState(),mname.isAttribute); } void Proxy::setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst) @@ -66,8 +66,8 @@ //Check if there is a custom setter defined, skipping implementation to avoid recursive calls multiname setPropertyName(NULL); setPropertyName.name_type=multiname::NAME_STRING; - setPropertyName.name_s_id=getSys()->getUniqueStringId("setProperty"); - setPropertyName.ns.emplace_back(flash_proxy,NAMESPACE); + setPropertyName.name_s_id=getSystemState()->getUniqueStringId("setProperty"); + setPropertyName.ns.emplace_back(getSystemState(),flash_proxy,NAMESPACE); _NR<ASObject> proxySetter=getVariableByMultiname(setPropertyName,ASObject::SKIP_IMPL); if(proxySetter.isNull()) @@ -80,7 +80,7 @@ IFunction* f=static_cast<IFunction*>(proxySetter.getPtr()); - ASObject* namearg = abstract_s(name.normalizedName()); + ASObject* namearg = abstract_s(getSystemState(),name.normalizedName(getSystemState())); namearg->setProxyProperty(name); ASObject* args[2]; args[0]=namearg; @@ -108,8 +108,8 @@ //Check if there is a custom getter defined, skipping implementation to avoid recursive calls multiname getPropertyName(NULL); getPropertyName.name_type=multiname::NAME_STRING; - getPropertyName.name_s_id=getSys()->getUniqueStringId("getProperty"); - getPropertyName.ns.emplace_back(flash_proxy,NAMESPACE); + getPropertyName.name_s_id=getSystemState()->getUniqueStringId("getProperty"); + getPropertyName.ns.emplace_back(getSystemState(),flash_proxy,NAMESPACE); o=getVariableByMultiname(getPropertyName,ASObject::SKIP_IMPL); if(o.isNull()) @@ -119,12 +119,12 @@ IFunction* f=static_cast<IFunction*>(o.getPtr()); - ASObject* namearg = abstract_s(name.normalizedName()); + ASObject* namearg = abstract_s(f->getSystemState(),name.normalizedName(getSystemState())); namearg->setProxyProperty(name); ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,"Proxy::getProperty "<< name.normalizedNameUnresolved() << " " << this->toDebugString()); + LOG(LOG_CALLS,"Proxy::getProperty "<< name.normalizedNameUnresolved(getSystemState()) << " " << this->toDebugString()); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -133,7 +133,7 @@ bool Proxy::hasPropertyByMultiname(const multiname& name, bool considerDynamic, bool considerPrototype) { - if (name.normalizedName() == "isAttribute") + if (name.normalizedName(getSystemState()) == "isAttribute") return true; //If a variable named like this already exist, use that bool asobject_has_property=ASObject::hasPropertyByMultiname(name, considerDynamic, considerPrototype); @@ -144,8 +144,8 @@ //Check if there is a custom hasProperty defined, skipping implementation to avoid recursive calls multiname hasPropertyName(NULL); hasPropertyName.name_type=multiname::NAME_STRING; - hasPropertyName.name_s_id=getSys()->getUniqueStringId("hasProperty"); - hasPropertyName.ns.emplace_back(flash_proxy,NAMESPACE); + hasPropertyName.name_s_id=getSystemState()->getUniqueStringId("hasProperty"); + hasPropertyName.ns.emplace_back(getSystemState(),flash_proxy,NAMESPACE); _NR<ASObject> proxyHasProperty=getVariableByMultiname(hasPropertyName,ASObject::SKIP_IMPL); if(proxyHasProperty.isNull()) @@ -157,7 +157,7 @@ IFunction* f=static_cast<IFunction*>(proxyHasProperty.getPtr()); - ASObject* namearg = abstract_s(name.normalizedName()); + ASObject* namearg = abstract_s(getSystemState(),name.normalizedName(getSystemState())); namearg->setProxyProperty(name); ASObject* arg = namearg; //We now suppress special handling @@ -180,8 +180,8 @@ //Check if there is a custom deleter defined, skipping implementation to avoid recursive calls multiname deletePropertyName(NULL); deletePropertyName.name_type=multiname::NAME_STRING; - deletePropertyName.name_s_id=getSys()->getUniqueStringId("deleteProperty"); - deletePropertyName.ns.emplace_back(flash_proxy,NAMESPACE); + deletePropertyName.name_s_id=getSystemState()->getUniqueStringId("deleteProperty"); + deletePropertyName.ns.emplace_back(getSystemState(),flash_proxy,NAMESPACE); _NR<ASObject> proxyDeleter=getVariableByMultiname(deletePropertyName,ASObject::SKIP_IMPL); if(proxyDeleter.isNull()) @@ -193,7 +193,7 @@ IFunction* f=static_cast<IFunction*>(proxyDeleter.getPtr()); - ASObject* namearg = abstract_s(name.normalizedName()); + ASObject* namearg = abstract_s(getSystemState(),name.normalizedName(getSystemState())); namearg->setProxyProperty(name); ASObject* arg = namearg; //We now suppress special handling @@ -213,12 +213,12 @@ //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextNameIndexName(NULL); nextNameIndexName.name_type=multiname::NAME_STRING; - nextNameIndexName.name_s_id=getSys()->getUniqueStringId("nextNameIndex"); - nextNameIndexName.ns.emplace_back(flash_proxy,NAMESPACE); + nextNameIndexName.name_s_id=getSystemState()->getUniqueStringId("nextNameIndex"); + nextNameIndexName.ns.emplace_back(getSystemState(),flash_proxy,NAMESPACE); _NR<ASObject> o=getVariableByMultiname(nextNameIndexName,ASObject::SKIP_IMPL); assert_and_throw(!o.isNull() && o->getObjectType()==T_FUNCTION); IFunction* f=static_cast<IFunction*>(o.getPtr()); - ASObject* arg=abstract_i(cur_index); + ASObject* arg=abstract_i(getSystemState(),cur_index); this->incRef(); ASObject* ret=f->call(this,&arg,1); uint32_t newIndex=ret->toInt(); @@ -233,12 +233,12 @@ //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextNameName(NULL); nextNameName.name_type=multiname::NAME_STRING; - nextNameName.name_s_id=getSys()->getUniqueStringId("nextName"); - nextNameName.ns.emplace_back(flash_proxy,NAMESPACE); + nextNameName.name_s_id=getSystemState()->getUniqueStringId("nextName"); + nextNameName.ns.emplace_back(getSystemState(),flash_proxy,NAMESPACE); _NR<ASObject> o=getVariableByMultiname(nextNameName,ASObject::SKIP_IMPL); assert_and_throw(!o.isNull() && o->getObjectType()==T_FUNCTION); IFunction* f=static_cast<IFunction*>(o.getPtr()); - ASObject* arg=abstract_i(index); + ASObject* arg=abstract_i(getSystemState(),index); incRef(); return _MR(f->call(this,&arg,1)); } @@ -250,12 +250,12 @@ //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextValueName(NULL); nextValueName.name_type=multiname::NAME_STRING; - nextValueName.name_s_id=getSys()->getUniqueStringId("nextValue"); - nextValueName.ns.emplace_back(flash_proxy,NAMESPACE); + nextValueName.name_s_id=getSystemState()->getUniqueStringId("nextValue"); + nextValueName.ns.emplace_back(getSystemState(),flash_proxy,NAMESPACE); _NR<ASObject> o=getVariableByMultiname(nextValueName,ASObject::SKIP_IMPL); assert_and_throw(!o.isNull() && o->getObjectType()==T_FUNCTION); IFunction* f=static_cast<IFunction*>(o.getPtr()); - ASObject* arg=abstract_i(index); + ASObject* arg=abstract_i(getSystemState(),index); incRef(); return _MR(f->call(this,&arg,1)); }
View file
lightspark.tar.xz/src/scripting/flash/utils/Proxy.h
Changed
@@ -46,7 +46,7 @@ void setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst); void setVariableByMultiname_i(const multiname& name, int32_t value) { - setVariableByMultiname(name,abstract_i(value),CONST_NOT_ALLOWED); + setVariableByMultiname(name,abstract_i(getSystemState(),value),CONST_NOT_ALLOWED); } bool deleteVariableByMultiname(const multiname& name);
View file
lightspark.tar.xz/src/scripting/flash/utils/Timer.cpp
Changed
@@ -34,7 +34,7 @@ //This will be executed once if repeatCount was originally 1 //Otherwise it's executed until stopMe is set to true this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<TimerEvent>::getInstanceS("timer"))); + getVm(getSys())->addEvent(_MR(this),_MR(Class<TimerEvent>::getInstanceS(getSys(),"timer"))); currentCount++; if(repeatCount!=0) @@ -42,7 +42,7 @@ if(currentCount==repeatCount) { this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<TimerEvent>::getInstanceS("timerComplete"))); + getVm(getSys())->addEvent(_MR(this),_MR(Class<TimerEvent>::getInstanceS(getSys(),"timerComplete"))); stopMe=true; running=false; } @@ -58,15 +58,15 @@ void Timer::sinit(Class_base* c) { CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("currentCount","",Class<IFunction>::getFunction(_getCurrentCount),GETTER_METHOD,true); - c->setDeclaredMethodByQName("repeatCount","",Class<IFunction>::getFunction(_getRepeatCount),GETTER_METHOD,true); - c->setDeclaredMethodByQName("repeatCount","",Class<IFunction>::getFunction(_setRepeatCount),SETTER_METHOD,true); - c->setDeclaredMethodByQName("running","",Class<IFunction>::getFunction(_getRunning),GETTER_METHOD,true); - c->setDeclaredMethodByQName("delay","",Class<IFunction>::getFunction(_getDelay),GETTER_METHOD,true); - c->setDeclaredMethodByQName("delay","",Class<IFunction>::getFunction(_setDelay),SETTER_METHOD,true); - c->setDeclaredMethodByQName("start","",Class<IFunction>::getFunction(start),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("reset","",Class<IFunction>::getFunction(reset),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("stop","",Class<IFunction>::getFunction(stop),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("currentCount","",Class<IFunction>::getFunction(c->getSystemState(),_getCurrentCount),GETTER_METHOD,true); + c->setDeclaredMethodByQName("repeatCount","",Class<IFunction>::getFunction(c->getSystemState(),_getRepeatCount),GETTER_METHOD,true); + c->setDeclaredMethodByQName("repeatCount","",Class<IFunction>::getFunction(c->getSystemState(),_setRepeatCount),SETTER_METHOD,true); + c->setDeclaredMethodByQName("running","",Class<IFunction>::getFunction(c->getSystemState(),_getRunning),GETTER_METHOD,true); + c->setDeclaredMethodByQName("delay","",Class<IFunction>::getFunction(c->getSystemState(),_getDelay),GETTER_METHOD,true); + c->setDeclaredMethodByQName("delay","",Class<IFunction>::getFunction(c->getSystemState(),_setDelay),SETTER_METHOD,true); + c->setDeclaredMethodByQName("start","",Class<IFunction>::getFunction(c->getSystemState(),start),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("reset","",Class<IFunction>::getFunction(c->getSystemState(),reset),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("stop","",Class<IFunction>::getFunction(c->getSystemState(),stop),NORMAL_METHOD,true); } ASFUNCTIONBODY(Timer,_constructor) @@ -84,13 +84,13 @@ ASFUNCTIONBODY(Timer,_getCurrentCount) { Timer* th=static_cast<Timer*>(obj); - return abstract_i(th->currentCount); + return abstract_i(obj->getSystemState(),th->currentCount); } ASFUNCTIONBODY(Timer,_getRepeatCount) { Timer* th=static_cast<Timer*>(obj); - return abstract_i(th->repeatCount); + return abstract_i(obj->getSystemState(),th->repeatCount); } ASFUNCTIONBODY(Timer,_setRepeatCount) @@ -111,13 +111,13 @@ ASFUNCTIONBODY(Timer,_getRunning) { Timer* th=static_cast<Timer*>(obj); - return abstract_b(th->running); + return abstract_b(obj->getSystemState(),th->running); } ASFUNCTIONBODY(Timer,_getDelay) { Timer* th=static_cast<Timer*>(obj); - return abstract_i(th->delay); + return abstract_i(obj->getSystemState(),th->delay); } ASFUNCTIONBODY(Timer,_setDelay) @@ -125,7 +125,7 @@ assert_and_throw(argslen==1); int32_t newdelay = args[0]->toInt(); if (newdelay<=0) - throw Class<RangeError>::getInstanceS("delay must be positive", 2066); + throw Class<RangeError>::getInstanceS(obj->getSystemState(),"delay must be positive", 2066); Timer* th=static_cast<Timer*>(obj); th->delay=newdelay;
View file
lightspark.tar.xz/src/scripting/flash/utils/flashutils.cpp
Changed
@@ -40,8 +40,8 @@ void Endian::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); - c->setVariableByQName("LITTLE_ENDIAN","",Class<ASString>::getInstanceS(littleEndian),DECLARED_TRAIT); - c->setVariableByQName("BIG_ENDIAN","",Class<ASString>::getInstanceS(bigEndian),DECLARED_TRAIT); + c->setVariableByQName("LITTLE_ENDIAN","",abstract_s(c->getSystemState(),littleEndian),DECLARED_TRAIT); + c->setVariableByQName("BIG_ENDIAN","",abstract_s(c->getSystemState(),bigEndian),DECLARED_TRAIT); } void IExternalizable::linkTraits(Class_base* c) @@ -98,10 +98,10 @@ Class_base* c; SWFOBJECT_TYPE otype=target->getObjectType(); if(otype==T_NULL) - return Class<ASString>::getInstanceS("null"); + return abstract_s(target->getSystemState(),"null"); else if(otype==T_UNDEFINED) // Testing shows that this really returns "void"! - return Class<ASString>::getInstanceS("void"); + return abstract_s(target->getSystemState(),"void"); else if(otype!=T_CLASS) { assert_and_throw(target->getClass()); @@ -110,7 +110,7 @@ else c=static_cast<Class_base*>(target); - return Class<ASString>::getInstanceS(c->getQualifiedClassName()); + return abstract_s(obj->getSystemState(),c->getQualifiedClassName()); } ASFUNCTIONBODY(lightspark,getQualifiedSuperclassName) @@ -127,9 +127,9 @@ c=static_cast<Class_base*>(target)->super.getPtr(); if (!c) - return getSys()->getNullRef(); + return target->getSystemState()->getNullRef(); - return Class<ASString>::getInstanceS(c->getQualifiedClassName()); + return abstract_s(obj->getSystemState(),c->getQualifiedClassName()); } ASFUNCTIONBODY(lightspark,getDefinitionByName) @@ -142,12 +142,12 @@ tiny_string nsName; tiny_string tmpName; stringToQName(tmp,tmpName,nsName); - name.name_s_id=getSys()->getUniqueStringId(tmpName); - name.ns.push_back(nsNameAndKind(nsName,NAMESPACE)); + name.name_s_id=args[0]->getSystemState()->getUniqueStringId(tmpName); + name.ns.push_back(nsNameAndKind(args[0]->getSystemState(),nsName,NAMESPACE)); LOG(LOG_CALLS,_("Looking for definition of ") << name); ASObject* target; - ASObject* o=ABCVm::getCurrentApplicationDomain(getVm()->currentCallContext)->getVariableAndTargetByMultiname(name,target); + ASObject* o=ABCVm::getCurrentApplicationDomain(getVm(args[0]->getSystemState())->currentCallContext)->getVariableAndTargetByMultiname(name,target); if(o==NULL) { @@ -169,8 +169,8 @@ ASFUNCTIONBODY(lightspark,getTimer) { - uint64_t ret=compat_msectiming() - getSys()->startTime; - return abstract_i(ret); + uint64_t ret=compat_msectiming() - obj->getSystemState()->startTime; + return abstract_i(obj->getSystemState(),ret); } @@ -192,9 +192,9 @@ args[0]->incRef(); IFunction* callback=static_cast<IFunction*>(args[0]); //Add interval through manager - uint32_t id = getSys()->intervalManager->setInterval(_MR(callback), callbackArgs, argslen-2, - _MR(getSys()->getNullRef()), args[1]->toInt()); - return abstract_i(id); + uint32_t id = args[0]->getSystemState()->intervalManager->setInterval(_MR(callback), callbackArgs, argslen-2, + _MR(args[0]->getSystemState()->getNullRef()), args[1]->toInt()); + return abstract_i(args[0]->getSystemState(),id); } ASFUNCTIONBODY(lightspark,setTimeout) @@ -215,22 +215,22 @@ args[0]->incRef(); IFunction* callback=static_cast<IFunction*>(args[0]); //Add timeout through manager - uint32_t id = getSys()->intervalManager->setTimeout(_MR(callback), callbackArgs, argslen-2, - _MR(getSys()->getNullRef()), args[1]->toInt()); - return abstract_i(id); + uint32_t id = args[0]->getSystemState()->intervalManager->setTimeout(_MR(callback), callbackArgs, argslen-2, + _MR(args[0]->getSystemState()->getNullRef()), args[1]->toInt()); + return abstract_i(args[0]->getSystemState(),id); } ASFUNCTIONBODY(lightspark,clearInterval) { assert_and_throw(argslen == 1); - getSys()->intervalManager->clearInterval(args[0]->toInt(), IntervalRunner::INTERVAL, true); + args[0]->getSystemState()->intervalManager->clearInterval(args[0]->toInt(), IntervalRunner::INTERVAL, true); return NULL; } ASFUNCTIONBODY(lightspark,clearTimeout) { assert_and_throw(argslen == 1); - getSys()->intervalManager->clearInterval(args[0]->toInt(), IntervalRunner::TIMEOUT, true); + args[0]->getSystemState()->intervalManager->clearInterval(args[0]->toInt(), IntervalRunner::TIMEOUT, true); return NULL; } @@ -238,11 +238,11 @@ { tiny_string str; ARG_UNPACK (str, "undefined"); - return Class<ASString>::getInstanceS(URLInfo::encode(str, URLInfo::ENCODE_ESCAPE)); + return abstract_s(getSys(),URLInfo::encode(str, URLInfo::ENCODE_ESCAPE)); } ASFUNCTIONBODY(lightspark,unescapeMultiByte) { tiny_string str; ARG_UNPACK (str, "undefined"); - return Class<ASString>::getInstanceS(URLInfo::decode(str, URLInfo::ENCODE_ESCAPE)); + return abstract_s(getSys(),URLInfo::decode(str, URLInfo::ENCODE_ESCAPE)); }
View file
lightspark.tar.xz/src/scripting/flash/xml/flashxml.cpp
Changed
@@ -40,19 +40,19 @@ void XMLNode::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("attributes","",Class<IFunction>::getFunction(attributes),GETTER_METHOD,true); - c->setDeclaredMethodByQName("childNodes","",Class<IFunction>::getFunction(XMLNode::childNodes),GETTER_METHOD,true); - c->setDeclaredMethodByQName("firstChild","",Class<IFunction>::getFunction(XMLNode::firstChild),GETTER_METHOD,true); - c->setDeclaredMethodByQName("lastChild","",Class<IFunction>::getFunction(lastChild),GETTER_METHOD,true); - c->setDeclaredMethodByQName("nextSibling","",Class<IFunction>::getFunction(nextSibling),GETTER_METHOD,true); - c->setDeclaredMethodByQName("nodeType","",Class<IFunction>::getFunction(_getNodeType),GETTER_METHOD,true); - c->setDeclaredMethodByQName("nodeName","",Class<IFunction>::getFunction(_getNodeName),GETTER_METHOD,true); - c->setDeclaredMethodByQName("nodeValue","",Class<IFunction>::getFunction(_getNodeValue),GETTER_METHOD,true); - c->setDeclaredMethodByQName("parentNode","",Class<IFunction>::getFunction(parentNode),GETTER_METHOD,true); - c->setDeclaredMethodByQName("previousSibling","",Class<IFunction>::getFunction(previousSibling),GETTER_METHOD,true); - c->setDeclaredMethodByQName("localName","",Class<IFunction>::getFunction(_getLocalName),GETTER_METHOD,true); - c->setDeclaredMethodByQName("appendChild","",Class<IFunction>::getFunction(appendChild),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("attributes","",Class<IFunction>::getFunction(c->getSystemState(),attributes),GETTER_METHOD,true); + c->setDeclaredMethodByQName("childNodes","",Class<IFunction>::getFunction(c->getSystemState(),XMLNode::childNodes),GETTER_METHOD,true); + c->setDeclaredMethodByQName("firstChild","",Class<IFunction>::getFunction(c->getSystemState(),XMLNode::firstChild),GETTER_METHOD,true); + c->setDeclaredMethodByQName("lastChild","",Class<IFunction>::getFunction(c->getSystemState(),lastChild),GETTER_METHOD,true); + c->setDeclaredMethodByQName("nextSibling","",Class<IFunction>::getFunction(c->getSystemState(),nextSibling),GETTER_METHOD,true); + c->setDeclaredMethodByQName("nodeType","",Class<IFunction>::getFunction(c->getSystemState(),_getNodeType),GETTER_METHOD,true); + c->setDeclaredMethodByQName("nodeName","",Class<IFunction>::getFunction(c->getSystemState(),_getNodeName),GETTER_METHOD,true); + c->setDeclaredMethodByQName("nodeValue","",Class<IFunction>::getFunction(c->getSystemState(),_getNodeValue),GETTER_METHOD,true); + c->setDeclaredMethodByQName("parentNode","",Class<IFunction>::getFunction(c->getSystemState(),parentNode),GETTER_METHOD,true); + c->setDeclaredMethodByQName("previousSibling","",Class<IFunction>::getFunction(c->getSystemState(),previousSibling),GETTER_METHOD,true); + c->setDeclaredMethodByQName("localName","",Class<IFunction>::getFunction(c->getSystemState(),_getLocalName),GETTER_METHOD,true); + c->setDeclaredMethodByQName("appendChild","",Class<IFunction>::getFunction(c->getSystemState(),appendChild),NORMAL_METHOD,true); } void XMLNode::buildTraits(ASObject* o) @@ -68,7 +68,7 @@ tiny_string value; ARG_UNPACK(type)(value); assert_and_throw(type==1); - th->root=_MR(Class<XMLDocument>::getInstanceS()); + th->root=_MR(Class<XMLDocument>::getInstanceS(obj->getSystemState())); if(type==1) { th->root->parseXMLImpl(value); @@ -87,7 +87,7 @@ if(newNode.type() == pugi::node_null) return getSys()->getNullRef(); assert_and_throw(!th->root.isNull()); - return Class<XMLNode>::getInstanceS(th->root,newNode); + return Class<XMLNode>::getInstanceS(obj->getSystemState(),th->root,newNode); } ASFUNCTIONBODY(XMLNode,lastChild) @@ -100,13 +100,13 @@ if(newNode.type() == pugi::node_null) return getSys()->getNullRef(); assert_and_throw(!th->root.isNull()); - return Class<XMLNode>::getInstanceS(th->root,newNode); + return Class<XMLNode>::getInstanceS(obj->getSystemState(),th->root,newNode); } ASFUNCTIONBODY(XMLNode,childNodes) { XMLNode* th=Class<XMLNode>::cast(obj); - Array* ret = Class<Array>::getInstanceS(); + Array* ret = Class<Array>::getInstanceS(obj->getSystemState()); assert_and_throw(argslen==0); if(th->node.type()==pugi::node_null) return ret; @@ -115,7 +115,7 @@ for(;it!=th->node.end();++it) { if(it->type()!=pugi::node_pcdata) { - ret->push(_MR(Class<XMLNode>::getInstanceS(th->root, *it))); + ret->push(_MR(Class<XMLNode>::getInstanceS(obj->getSystemState(),th->root, *it))); } } return ret; @@ -126,14 +126,14 @@ { XMLNode* th=Class<XMLNode>::cast(obj); assert_and_throw(argslen==0); - ASObject* ret=Class<ASObject>::getInstanceS(); + ASObject* ret=Class<ASObject>::getInstanceS(obj->getSystemState()); if(th->node.type()==pugi::node_null) return ret; auto it=th->node.attributes_begin(); for(;it!=th->node.attributes_end();++it) { tiny_string attrName = it->name(); - ASString* attrValue=Class<ASString>::getInstanceS(it->value()); + ASString* attrValue=abstract_s(obj->getSystemState(),it->value()); ret->setVariableByQName(attrName,"",attrValue,DYNAMIC_TRAIT); } return ret; @@ -149,7 +149,7 @@ XMLNode* th=Class<XMLNode>::cast(obj); pugi::xml_node parent = th->getParentNode(); if (parent.type()!=pugi::node_null) - return Class<XMLNode>::getInstanceS(th->root, parent); + return Class<XMLNode>::getInstanceS(obj->getSystemState(),th->root, parent); else return getSys()->getNullRef(); } @@ -162,7 +162,7 @@ pugi::xml_node sibling = th->node.next_sibling(); if (sibling.type()!=pugi::node_null) - return Class<XMLNode>::getInstanceS(th->root, sibling); + return Class<XMLNode>::getInstanceS(obj->getSystemState(),th->root, sibling); else return getSys()->getNullRef(); } @@ -175,7 +175,7 @@ pugi::xml_node sibling = th->node.previous_sibling(); if (sibling.type()!=pugi::node_null) - return Class<XMLNode>::getInstanceS(th->root, sibling); + return Class<XMLNode>::getInstanceS(obj->getSystemState(),th->root, sibling); else return getSys()->getNullRef(); } @@ -205,20 +205,20 @@ LOG(LOG_NOT_IMPLEMENTED,"XMLNode.getNodeType: unhandled type:"<<th->node.type()); break; } - return abstract_i(t); + return abstract_i(obj->getSystemState(),t); } ASFUNCTIONBODY(XMLNode,_getNodeName) { XMLNode* th=Class<XMLNode>::cast(obj); - return Class<ASString>::getInstanceS(th->node.name()); + return abstract_s(obj->getSystemState(),th->node.name()); } ASFUNCTIONBODY(XMLNode,_getNodeValue) { XMLNode* th=Class<XMLNode>::cast(obj); if(th->node.type() == pugi::node_pcdata) - return Class<ASString>::getInstanceS(th->node.value()); + return abstract_s(obj->getSystemState(),th->node.value()); else return getSys()->getNullRef(); } @@ -226,7 +226,7 @@ ASFUNCTIONBODY(XMLNode,_toString) { XMLNode* th=Class<XMLNode>::cast(obj); - return Class<ASString>::getInstanceS(th->toString_priv(th->node)); + return abstract_s(obj->getSystemState(),th->toString_priv(th->node)); } ASFUNCTIONBODY(XMLNode,_getLocalName) @@ -238,7 +238,7 @@ { localname = localname.substr(pos,localname.numChars()-pos); } - return Class<ASString>::getInstanceS(localname); + return abstract_s(obj->getSystemState(),localname); } ASFUNCTIONBODY(XMLNode,appendChild) { @@ -289,10 +289,10 @@ void XMLDocument::sinit(Class_base* c) { CLASS_SETUP(c, XMLNode, _constructor, CLASS_SEALED); - c->setDeclaredMethodByQName("parseXML","",Class<IFunction>::getFunction(parseXML),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("firstChild","",Class<IFunction>::getFunction(XMLDocument::firstChild),GETTER_METHOD,true); - c->setDeclaredMethodByQName("createElement","",Class<IFunction>::getFunction(XMLDocument::createElement),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("parseXML","",Class<IFunction>::getFunction(c->getSystemState(),parseXML),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("firstChild","",Class<IFunction>::getFunction(c->getSystemState(),XMLDocument::firstChild),GETTER_METHOD,true); + c->setDeclaredMethodByQName("createElement","",Class<IFunction>::getFunction(c->getSystemState(),XMLDocument::createElement),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c, ignoreWhite); } @@ -340,7 +340,7 @@ //TODO: should output xmlDecl and docTypeDecl, see the //documentation on XMLNode.tostring() XMLDocument* th=Class<XMLDocument>::cast(obj); - return Class<ASString>::getInstanceS(th->toString_priv(th->rootNode)); + return abstract_s(obj->getSystemState(),th->toString_priv(th->rootNode)); } tiny_string XMLDocument::toString() @@ -364,7 +364,7 @@ assert(th->node==NULL); pugi::xml_node newNode=th->rootNode; th->incRef(); - return Class<XMLNode>::getInstanceS(_MR(th),newNode); + return Class<XMLNode>::getInstanceS(obj->getSystemState(),_MR(th),newNode); } ASFUNCTIONBODY(XMLDocument,createElement) { @@ -375,5 +375,5 @@ pugi::xml_node newNode; newNode.set_name(name.raw_buf()); th->incRef(); - return Class<XMLNode>::getInstanceS(_MR(th),newNode);
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.cpp
Changed
@@ -72,59 +72,59 @@ { // fast path if obj is ASString if (obj->is<ASString>()) - return abstract_i(obj->as<ASString>()->data.numChars()); - return abstract_i(obj->toString().numChars()); + return abstract_i(obj->getSystemState(),obj->as<ASString>()->data.numChars()); + return abstract_i(obj->getSystemState(),obj->toString().numChars()); } void ASString::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL | CLASS_SEALED); c->isReusable = true; - c->setDeclaredMethodByQName("split",AS3,Class<IFunction>::getFunction(split,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("substr",AS3,Class<IFunction>::getFunction(substr,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("substring",AS3,Class<IFunction>::getFunction(substring,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("replace",AS3,Class<IFunction>::getFunction(replace),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("concat",AS3,Class<IFunction>::getFunction(concat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("match",AS3,Class<IFunction>::getFunction(match),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("search",AS3,Class<IFunction>::getFunction(search),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("indexOf",AS3,Class<IFunction>::getFunction(indexOf,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(lastIndexOf,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("charCodeAt",AS3,Class<IFunction>::getFunction(charCodeAt),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("charAt",AS3,Class<IFunction>::getFunction(charAt,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("slice",AS3,Class<IFunction>::getFunction(slice,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toLocaleLowerCase",AS3,Class<IFunction>::getFunction(toLowerCase),NORMAL_METHOD,true); - 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); + c->setDeclaredMethodByQName("split",AS3,Class<IFunction>::getFunction(c->getSystemState(),split,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("substr",AS3,Class<IFunction>::getFunction(c->getSystemState(),substr,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("substring",AS3,Class<IFunction>::getFunction(c->getSystemState(),substring,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("replace",AS3,Class<IFunction>::getFunction(c->getSystemState(),replace),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("concat",AS3,Class<IFunction>::getFunction(c->getSystemState(),concat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("match",AS3,Class<IFunction>::getFunction(c->getSystemState(),match),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("search",AS3,Class<IFunction>::getFunction(c->getSystemState(),search),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("indexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),indexOf,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),lastIndexOf,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("charCodeAt",AS3,Class<IFunction>::getFunction(c->getSystemState(),charCodeAt),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("charAt",AS3,Class<IFunction>::getFunction(c->getSystemState(),charAt,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("slice",AS3,Class<IFunction>::getFunction(c->getSystemState(),slice,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLocaleLowerCase",AS3,Class<IFunction>::getFunction(c->getSystemState(),toLowerCase),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLocaleUpperCase",AS3,Class<IFunction>::getFunction(c->getSystemState(),toUpperCase),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLowerCase",AS3,Class<IFunction>::getFunction(c->getSystemState(),toLowerCase),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toUpperCase",AS3,Class<IFunction>::getFunction(c->getSystemState(),toUpperCase),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("localeCompare",AS3,Class<IFunction>::getFunction(c->getSystemState(),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. - c->setDeclaredMethodByQName("fromCharCode",AS3,Class<IFunction>::getFunction(fromCharCode),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("fromCharCode","",Class<IFunction>::getFunction(fromCharCode),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_getLength),GETTER_METHOD,true); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - - c->prototype->setVariableByQName("split","",Class<IFunction>::getFunction(split,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("substr","",Class<IFunction>::getFunction(substr,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("substring","",Class<IFunction>::getFunction(substring,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("replace","",Class<IFunction>::getFunction(replace),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("concat","",Class<IFunction>::getFunction(concat),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("match","",Class<IFunction>::getFunction(match),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("search","",Class<IFunction>::getFunction(search),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("indexOf","",Class<IFunction>::getFunction(indexOf,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("lastIndexOf","",Class<IFunction>::getFunction(lastIndexOf,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("charCodeAt","",Class<IFunction>::getFunction(charCodeAt),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("charAt","",Class<IFunction>::getFunction(charAt,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("slice","",Class<IFunction>::getFunction(slice,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleLowerCase","",Class<IFunction>::getFunction(toLowerCase),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleUpperCase","",Class<IFunction>::getFunction(toUpperCase),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLowerCase","",Class<IFunction>::getFunction(toLowerCase),DYNAMIC_TRAIT); - 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); + c->setDeclaredMethodByQName("fromCharCode",AS3,Class<IFunction>::getFunction(c->getSystemState(),fromCharCode),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("fromCharCode","",Class<IFunction>::getFunction(c->getSystemState(),fromCharCode),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),_getLength),GETTER_METHOD,true); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + + c->prototype->setVariableByQName("split","",Class<IFunction>::getFunction(c->getSystemState(),split,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("substr","",Class<IFunction>::getFunction(c->getSystemState(),substr,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("substring","",Class<IFunction>::getFunction(c->getSystemState(),substring,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("replace","",Class<IFunction>::getFunction(c->getSystemState(),replace),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("concat","",Class<IFunction>::getFunction(c->getSystemState(),concat),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("match","",Class<IFunction>::getFunction(c->getSystemState(),match),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("search","",Class<IFunction>::getFunction(c->getSystemState(),search),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("indexOf","",Class<IFunction>::getFunction(c->getSystemState(),indexOf,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("lastIndexOf","",Class<IFunction>::getFunction(c->getSystemState(),lastIndexOf,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("charCodeAt","",Class<IFunction>::getFunction(c->getSystemState(),charCodeAt),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("charAt","",Class<IFunction>::getFunction(c->getSystemState(),charAt,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("slice","",Class<IFunction>::getFunction(c->getSystemState(),slice,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLocaleLowerCase","",Class<IFunction>::getFunction(c->getSystemState(),toLowerCase),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLocaleUpperCase","",Class<IFunction>::getFunction(c->getSystemState(),toUpperCase),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLowerCase","",Class<IFunction>::getFunction(c->getSystemState(),toLowerCase),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toUpperCase","",Class<IFunction>::getFunction(c->getSystemState(),toUpperCase),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("localeCompare","",Class<IFunction>::getFunction(c->getSystemState(),localeCompare_prototype),DYNAMIC_TRAIT); } void ASString::buildTraits(ASObject* o) @@ -136,11 +136,11 @@ tiny_string data = obj->toString(); int ret = -1; if(argslen == 0 || args[0]->getObjectType() == T_UNDEFINED) - return abstract_i(-1); + return abstract_i(obj->getSystemState(),-1); int options=PCRE_UTF8|PCRE_NEWLINE_ANY;//|PCRE_JAVASCRIPT_COMPAT; tiny_string restr; - if(args[0]->getClass() && args[0]->getClass()==Class<RegExp>::getClass()) + if(args[0]->getClass() && args[0]->getClass()==Class<RegExp>::getClass(obj->getSystemState())) { RegExp* re=static_cast<RegExp*>(args[0]); restr = re->source; @@ -162,13 +162,13 @@ int errorOffset; pcre* pcreRE=pcre_compile(restr.raw_buf(), options, &error, &errorOffset,NULL); if(error) - return abstract_i(ret); + return abstract_i(obj->getSystemState(),ret); int capturingGroups; int infoOk=pcre_fullinfo(pcreRE, NULL, PCRE_INFO_CAPTURECOUNT, &capturingGroups); if(infoOk!=0) { pcre_free(pcreRE); - return abstract_i(ret); + return abstract_i(obj->getSystemState(),ret); } pcre_extra extra; extra.match_limit_recursion=200; @@ -181,37 +181,37 @@ { //No matches or error pcre_free(pcreRE); - return abstract_i(ret); + return abstract_i(obj->getSystemState(),ret); } ret=ovector[0]; // pcre_exec returns byte position, so we have to convert it to character position tiny_string tmp = data.substr_bytes(0, ret); ret = tmp.numChars(); pcre_free(pcreRE); - return abstract_i(ret); + return abstract_i(obj->getSystemState(),ret); } ASFUNCTIONBODY(ASString,match) { tiny_string data = obj->toString(); if(argslen == 0 || args[0]->getObjectType()==T_NULL || args[0]->getObjectType()==T_UNDEFINED) - return getSys()->getNullRef(); + return obj->getSystemState()->getNullRef(); ASObject* ret=NULL; RegExp* re; - if(args[0]->getClass() && args[0]->getClass()==Class<RegExp>::getClass()) + if(args[0]->getClass() && args[0]->getClass()==Class<RegExp>::getClass(obj->getSystemState())) { re = args[0]->as<RegExp>(); re->incRef(); } else { - re = Class<RegExp>::getInstanceS(args[0]->toString()); + re = Class<RegExp>::getInstanceS(obj->getSystemState(),args[0]->toString()); } if (re->global) { - Array *resarr = Class<Array>::getInstanceS(); + Array *resarr = Class<Array>::getInstanceS(obj->getSystemState()); int prevLastIndex = 0; re->lastIndex = 0; @@ -253,12 +253,12 @@ ASFUNCTIONBODY(ASString,_toString) { - if(Class<ASString>::getClass()->prototype->getObj() == obj) - return abstract_s(); + if(Class<ASString>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_s(obj->getSystemState()); if(!obj->is<ASString>()) { LOG(LOG_ERROR,"String.toString is not generic:"<<obj->toDebugString()); - throw Class<TypeError>::getInstanceS("String.toString is not generic"); + throw Class<TypeError>::getInstanceS(obj->getSystemState(),"String.toString is not generic"); } assert_and_throw(argslen==0); @@ -270,18 +270,18 @@ ASFUNCTIONBODY(ASString,split) { tiny_string data = obj->toString(); - Array* ret=Class<Array>::getInstanceS(); + Array* ret=Class<Array>::getInstanceS(obj->getSystemState());
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.h
Changed
@@ -32,9 +32,9 @@ */ class ASString: public ASObject { - friend ASString* abstract_s(); - friend ASString* abstract_s(const char* s, uint32_t len); - friend ASString* abstract_s(const tiny_string& s); + friend ASString* abstract_s(SystemState* sys); + friend ASString* abstract_s(SystemState* sys, const char* s, uint32_t len); + friend ASString* abstract_s(SystemState* sys, const tiny_string& s); private: tiny_string toString_priv() const; number_t parseStringInfinite(const char *s, char **end) const; @@ -70,7 +70,7 @@ ASFUNCTION(localeCompare_prototype); bool isEqual(ASObject* r); TRISTATE isLess(ASObject* r); - number_t toNumber() const; + number_t toNumber(); int32_t toInt(); uint32_t toUInt(); ASFUNCTION(generator); @@ -81,7 +81,7 @@ std::string toDebugString() { return std::string("\"") + std::string(data) + "\""; } static bool isEcmaSpace(uint32_t c); static bool isEcmaLineTerminator(uint32_t c); - void finalize() { data.clear(); } + inline void finalize() { data.clear(); } }; template<> @@ -95,13 +95,13 @@ if(o->is<Undefined>()) { o->decRef(); - return getSys()->getNullRef(); + return o->getSystemState()->getNullRef(); } if(!o->isConstructed()) return o; tiny_string n = o->toString(); o->decRef(); - return lightspark::abstract_s(n); + return lightspark::abstract_s(o->getSystemState(),n); } }
View file
lightspark.tar.xz/src/scripting/toplevel/Array.cpp
Changed
@@ -38,59 +38,59 @@ void Array::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_DYNAMIC_NOT_FINAL); - c->setVariableByQName("CASEINSENSITIVE","",abstract_d(CASEINSENSITIVE),CONSTANT_TRAIT); - c->setVariableByQName("DESCENDING","",abstract_d(DESCENDING),CONSTANT_TRAIT); - c->setVariableByQName("NUMERIC","",abstract_d(NUMERIC),CONSTANT_TRAIT); - c->setVariableByQName("RETURNINDEXEDARRAY","",abstract_d(RETURNINDEXEDARRAY),CONSTANT_TRAIT); - c->setVariableByQName("UNIQUESORT","",abstract_d(UNIQUESORT),CONSTANT_TRAIT); + c->setVariableByQName("CASEINSENSITIVE","",abstract_d(c->getSystemState(),CASEINSENSITIVE),CONSTANT_TRAIT); + c->setVariableByQName("DESCENDING","",abstract_d(c->getSystemState(),DESCENDING),CONSTANT_TRAIT); + c->setVariableByQName("NUMERIC","",abstract_d(c->getSystemState(),NUMERIC),CONSTANT_TRAIT); + c->setVariableByQName("RETURNINDEXEDARRAY","",abstract_d(c->getSystemState(),RETURNINDEXEDARRAY),CONSTANT_TRAIT); + c->setVariableByQName("UNIQUESORT","",abstract_d(c->getSystemState(),UNIQUESORT),CONSTANT_TRAIT); // properties - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_getLength),GETTER_METHOD,true); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_setLength),SETTER_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),_getLength),GETTER_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),_setLength),SETTER_METHOD,true); // public functions - c->setDeclaredMethodByQName("concat",AS3,Class<IFunction>::getFunction(_concat,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("every",AS3,Class<IFunction>::getFunction(every,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("filter",AS3,Class<IFunction>::getFunction(filter,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("forEach",AS3,Class<IFunction>::getFunction(forEach,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("indexOf",AS3,Class<IFunction>::getFunction(indexOf,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(lastIndexOf,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("join",AS3,Class<IFunction>::getFunction(join,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("map",AS3,Class<IFunction>::getFunction(_map,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("pop",AS3,Class<IFunction>::getFunction(_pop),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("push",AS3,Class<IFunction>::getFunction(_push_as3,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("reverse",AS3,Class<IFunction>::getFunction(_reverse),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("shift",AS3,Class<IFunction>::getFunction(shift),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("slice",AS3,Class<IFunction>::getFunction(slice,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("some",AS3,Class<IFunction>::getFunction(some,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("sort",AS3,Class<IFunction>::getFunction(_sort),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("sortOn",AS3,Class<IFunction>::getFunction(sortOn),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("splice",AS3,Class<IFunction>::getFunction(splice,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toLocaleString",AS3,Class<IFunction>::getFunction(_toLocaleString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("unshift",AS3,Class<IFunction>::getFunction(unshift),NORMAL_METHOD,true); - - c->prototype->setVariableByQName("concat","",Class<IFunction>::getFunction(_concat,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("every","",Class<IFunction>::getFunction(every,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("filter","",Class<IFunction>::getFunction(filter,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("forEach","",Class<IFunction>::getFunction(forEach,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("indexOf","",Class<IFunction>::getFunction(indexOf,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("lastIndexOf","",Class<IFunction>::getFunction(lastIndexOf,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("join","",Class<IFunction>::getFunction(join,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("map","",Class<IFunction>::getFunction(_map,1),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("concat",AS3,Class<IFunction>::getFunction(c->getSystemState(),_concat,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("every",AS3,Class<IFunction>::getFunction(c->getSystemState(),every,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("filter",AS3,Class<IFunction>::getFunction(c->getSystemState(),filter,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("forEach",AS3,Class<IFunction>::getFunction(c->getSystemState(),forEach,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("indexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),indexOf,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),lastIndexOf,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("join",AS3,Class<IFunction>::getFunction(c->getSystemState(),join,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("map",AS3,Class<IFunction>::getFunction(c->getSystemState(),_map,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("pop",AS3,Class<IFunction>::getFunction(c->getSystemState(),_pop),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("push",AS3,Class<IFunction>::getFunction(c->getSystemState(),_push_as3,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("reverse",AS3,Class<IFunction>::getFunction(c->getSystemState(),_reverse),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("shift",AS3,Class<IFunction>::getFunction(c->getSystemState(),shift),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("slice",AS3,Class<IFunction>::getFunction(c->getSystemState(),slice,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("some",AS3,Class<IFunction>::getFunction(c->getSystemState(),some,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("sort",AS3,Class<IFunction>::getFunction(c->getSystemState(),_sort),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("sortOn",AS3,Class<IFunction>::getFunction(c->getSystemState(),sortOn),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("splice",AS3,Class<IFunction>::getFunction(c->getSystemState(),splice,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLocaleString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toLocaleString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("unshift",AS3,Class<IFunction>::getFunction(c->getSystemState(),unshift),NORMAL_METHOD,true); + + c->prototype->setVariableByQName("concat","",Class<IFunction>::getFunction(c->getSystemState(),_concat,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("every","",Class<IFunction>::getFunction(c->getSystemState(),every,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("filter","",Class<IFunction>::getFunction(c->getSystemState(),filter,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("forEach","",Class<IFunction>::getFunction(c->getSystemState(),forEach,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("indexOf","",Class<IFunction>::getFunction(c->getSystemState(),indexOf,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("lastIndexOf","",Class<IFunction>::getFunction(c->getSystemState(),lastIndexOf,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("join","",Class<IFunction>::getFunction(c->getSystemState(),join,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("map","",Class<IFunction>::getFunction(c->getSystemState(),_map,1),DYNAMIC_TRAIT); // workaround, pop was encountered not in the AS3 namespace before, need to investigate it further - c->setDeclaredMethodByQName("pop","",Class<IFunction>::getFunction(_pop),NORMAL_METHOD,true); - c->prototype->setVariableByQName("pop","",Class<IFunction>::getFunction(_pop),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("push","",Class<IFunction>::getFunction(_push,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("reverse","",Class<IFunction>::getFunction(_reverse),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("shift","",Class<IFunction>::getFunction(shift),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("slice","",Class<IFunction>::getFunction(slice,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("some","",Class<IFunction>::getFunction(some,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("sort","",Class<IFunction>::getFunction(_sort),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("sortOn","",Class<IFunction>::getFunction(sortOn),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("splice","",Class<IFunction>::getFunction(splice,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(_toLocaleString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("unshift","",Class<IFunction>::getFunction(unshift),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("pop","",Class<IFunction>::getFunction(c->getSystemState(),_pop),NORMAL_METHOD,true); + c->prototype->setVariableByQName("pop","",Class<IFunction>::getFunction(c->getSystemState(),_pop),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("push","",Class<IFunction>::getFunction(c->getSystemState(),_push,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("reverse","",Class<IFunction>::getFunction(c->getSystemState(),_reverse),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("shift","",Class<IFunction>::getFunction(c->getSystemState(),shift),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("slice","",Class<IFunction>::getFunction(c->getSystemState(),slice,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("some","",Class<IFunction>::getFunction(c->getSystemState(),some,1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("sort","",Class<IFunction>::getFunction(c->getSystemState(),_sort),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("sortOn","",Class<IFunction>::getFunction(c->getSystemState(),sortOn),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("splice","",Class<IFunction>::getFunction(c->getSystemState(),splice,2),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(c->getSystemState(),_toLocaleString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("unshift","",Class<IFunction>::getFunction(c->getSystemState(),unshift),DYNAMIC_TRAIT); } void Array::buildTraits(ASObject* o) @@ -106,7 +106,7 @@ ASFUNCTIONBODY(Array,generator) { - Array* th=Class<Array>::getInstanceS(); + Array* th=Class<Array>::getInstanceS(getSys()); th->constructorImpl(args, argslen); return th; } @@ -136,7 +136,7 @@ ASFUNCTIONBODY(Array,_concat) { Array* th=static_cast<Array*>(obj); - Array* ret=Class<Array>::getInstanceS(); + Array* ret=Class<Array>::getInstanceS(obj->getSystemState()); // copy values into new array ret->resize(th->size()); @@ -179,7 +179,7 @@ ASFUNCTIONBODY(Array,filter) { Array* th=static_cast<Array*>(obj); - Array* ret=Class<Array>::getInstanceS(); + Array* ret=Class<Array>::getInstanceS(obj->getSystemState()); _NR<IFunction> f; ARG_UNPACK(f); if (f.isNull()) @@ -197,8 +197,8 @@ it->second.data->incRef(); } else - params[0] =abstract_d(it->second.data_i); - params[1] = abstract_i(it->first); + params[0] =abstract_d(obj->getSystemState(),it->second.data_i); + params[1] = abstract_i(obj->getSystemState(),it->first); params[2] = th; th->incRef(); @@ -207,7 +207,7 @@ origval->incRef(); if(argslen==1) { - funcRet=f->call(getSys()->getNullRef(), params, 3); + funcRet=f->call(obj->getSystemState()->getNullRef(), params, 3); } else { @@ -232,7 +232,7 @@ _NR<IFunction> f; ARG_UNPACK(f); if (f.isNull()) - return abstract_b(false); + return abstract_b(obj->getSystemState(),false); ASObject* params[3]; ASObject *funcRet; @@ -246,14 +246,14 @@ it->second.data->incRef(); } else - params[0] =abstract_d(it->second.data_i); - params[1] = abstract_i(it->first); + params[0] =abstract_d(obj->getSystemState(),it->second.data_i); + params[1] = abstract_i(obj->getSystemState(),it->first); params[2] = th; th->incRef(); if(argslen==1) { - funcRet=f->call(getSys()->getNullRef(), params, 3); + funcRet=f->call(obj->getSystemState()->getNullRef(), params, 3); } else { @@ -269,7 +269,7 @@ funcRet->decRef(); } } - return abstract_b(false); + return abstract_b(obj->getSystemState(),false); } ASFUNCTIONBODY(Array, every) @@ -278,7 +278,7 @@ _NR<IFunction> f; ARG_UNPACK(f); if (f.isNull()) - return abstract_b(true); + return abstract_b(obj->getSystemState(),true); ASObject* params[3]; ASObject *funcRet;
View file
lightspark.tar.xz/src/scripting/toplevel/Array.h
Changed
@@ -94,7 +94,7 @@ Array(Class_base* c); void finalize(); //These utility methods are also used by ByteArray - static bool isValidMultiname(const multiname& name, uint32_t& index); + static bool isValidMultiname(SystemState* sys,const multiname& name, uint32_t& index); static bool isValidQName(const tiny_string& name, const tiny_string& ns, unsigned int& index); static void sinit(Class_base*);
View file
lightspark.tar.xz/src/scripting/toplevel/Boolean.cpp
Changed
@@ -27,12 +27,12 @@ using namespace lightspark; using namespace std; -Boolean* lightspark::abstract_b(bool v) +Boolean* lightspark::abstract_b(SystemState *sys, bool v) { if(v==true) - return getSys()->getTrueRef(); + return sys->getTrueRef(); else - return getSys()->getFalseRef(); + return sys->getFalseRef(); } /* implements ecma3's ToBoolean() operation, see section 9.2, but returns the value instead of an Boolean object */ @@ -72,18 +72,18 @@ ASFUNCTIONBODY(Boolean,generator) { if(argslen==1) - return abstract_b(Boolean_concrete(args[0])); + return abstract_b(args[0]->getSystemState(),Boolean_concrete(args[0])); else - return abstract_b(false); + return abstract_b(getSys(),false); } void Boolean::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); c->isReusable = true; - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(_valueOf),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),_valueOf),DYNAMIC_TRAIT); } ASFUNCTIONBODY(Boolean,_constructor) @@ -100,27 +100,27 @@ ASFUNCTIONBODY(Boolean,_toString) { - if(Class<Boolean>::getClass()->prototype->getObj() == obj) //See ECMA 15.6.4 - return abstract_s("false"); + if(Class<Boolean>::getClass(obj->getSystemState())->prototype->getObj() == obj) //See ECMA 15.6.4 + return abstract_s(obj->getSystemState(),"false"); if(!obj->is<Boolean>()) - throw Class<TypeError>::getInstanceS(""); + throw Class<TypeError>::getInstanceS(obj->getSystemState(),""); Boolean* th=static_cast<Boolean*>(obj); - return abstract_s(th->toString()); + return abstract_s(obj->getSystemState(),th->toString()); } ASFUNCTIONBODY(Boolean,_valueOf) { - if(Class<Boolean>::getClass()->prototype->getObj() == obj) - return abstract_b(false); + if(Class<Boolean>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_b(obj->getSystemState(),false); if(!obj->is<Boolean>()) - throw Class<TypeError>::getInstanceS(""); + throw Class<TypeError>::getInstanceS(obj->getSystemState(),""); //The ecma3 spec is unspecific, but testing showed that we should return //a new object - return abstract_b(obj->as<Boolean>()->val); + return abstract_b(obj->getSystemState(),obj->as<Boolean>()->val); } void Boolean::serialize(ByteArray* out, std::map<tiny_string, uint32_t>& stringMap,
View file
lightspark.tar.xz/src/scripting/toplevel/Boolean.h
Changed
@@ -27,7 +27,7 @@ /* returns a fully inialized Boolean object with value b * like Class<Boolean>::getInstanceS(b) but without the constructor problems */ -Boolean* abstract_b(bool b); +Boolean* abstract_b(SystemState *sys, bool b); /* implements ecma3's ToBoolean() operation, see section 9.2, but returns the value instead of an Boolean object */ bool Boolean_concrete(const ASObject* obj); @@ -39,7 +39,7 @@ static void sinit(Class_base*); static void buildTraits(ASObject* o){}; bool val; - void finalize() { val=false;} + inline void finalize() { val=false;} int32_t toInt() { return val ? 1 : 0;
View file
lightspark.tar.xz/src/scripting/toplevel/Date.cpp
Changed
@@ -51,125 +51,125 @@ { CLASS_SETUP_CONSTRUCTOR_LENGTH(c, ASObject, _constructor, 7, CLASS_FINAL); c->isReusable = true; - c->setDeclaredMethodByQName("getTimezoneOffset",AS3,Class<IFunction>::getFunction(getTimezoneOffset),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(valueOf),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getTime",AS3,Class<IFunction>::getFunction(getTime),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getFullYear",AS3,Class<IFunction>::getFunction(getFullYear),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getMonth",AS3,Class<IFunction>::getFunction(getMonth),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getDate",AS3,Class<IFunction>::getFunction(getDate),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getDay",AS3,Class<IFunction>::getFunction(getDay),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getHours",AS3,Class<IFunction>::getFunction(getHours),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getMinutes",AS3,Class<IFunction>::getFunction(getMinutes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getSeconds",AS3,Class<IFunction>::getFunction(getSeconds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getMilliseconds",AS3,Class<IFunction>::getFunction(getMilliseconds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setFullYear",AS3,Class<IFunction>::getFunction(setFullYear,3),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setMonth",AS3,Class<IFunction>::getFunction(setMonth,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setDate",AS3,Class<IFunction>::getFunction(setDate),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setHours",AS3,Class<IFunction>::getFunction(setHours,4),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setMinutes",AS3,Class<IFunction>::getFunction(setMinutes,3),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setSeconds",AS3,Class<IFunction>::getFunction(setSeconds,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setMilliseconds",AS3,Class<IFunction>::getFunction(setMilliseconds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCFullYear",AS3,Class<IFunction>::getFunction(getUTCFullYear),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCMonth",AS3,Class<IFunction>::getFunction(getUTCMonth),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCDate",AS3,Class<IFunction>::getFunction(getUTCDate),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCDay",AS3,Class<IFunction>::getFunction(getUTCDay),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCHours",AS3,Class<IFunction>::getFunction(getUTCHours),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCMinutes",AS3,Class<IFunction>::getFunction(getUTCMinutes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCSeconds",AS3,Class<IFunction>::getFunction(getUTCSeconds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("getUTCMilliseconds",AS3,Class<IFunction>::getFunction(getUTCMilliseconds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setUTCFullYear",AS3,Class<IFunction>::getFunction(setUTCFullYear,3),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setUTCMonth",AS3,Class<IFunction>::getFunction(setUTCMonth,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setUTCDate",AS3,Class<IFunction>::getFunction(setUTCDate),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setUTCHours",AS3,Class<IFunction>::getFunction(setUTCHours,4),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setUTCMinutes",AS3,Class<IFunction>::getFunction(setUTCMinutes,3),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setUTCSeconds",AS3,Class<IFunction>::getFunction(setUTCSeconds,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setUTCMilliseconds",AS3,Class<IFunction>::getFunction(setUTCMilliseconds),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setTime",AS3,Class<IFunction>::getFunction(setTime,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("UTC","",Class<IFunction>::getFunction(UTC,7),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toUTCString",AS3,Class<IFunction>::getFunction(toUTCString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toDateString",AS3,Class<IFunction>::getFunction(toDateString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toTimeString",AS3,Class<IFunction>::getFunction(toTimeString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toLocaleString",AS3,Class<IFunction>::getFunction(toLocaleString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toLocaleDateString",AS3,Class<IFunction>::getFunction(toLocaleDateString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("parse","",Class<IFunction>::getFunction(_parse),NORMAL_METHOD,false); - - c->setDeclaredMethodByQName("date","",Class<IFunction>::getFunction(getDate),GETTER_METHOD,true); - c->setDeclaredMethodByQName("date","",Class<IFunction>::getFunction(dateSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("dateUTC","",Class<IFunction>::getFunction(getUTCDate),GETTER_METHOD,true); - c->setDeclaredMethodByQName("dateUTC","",Class<IFunction>::getFunction(UTCDateSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("day","",Class<IFunction>::getFunction(getDay),GETTER_METHOD,true); - c->setDeclaredMethodByQName("dayUTC","",Class<IFunction>::getFunction(getUTCDay),GETTER_METHOD,true); - c->setDeclaredMethodByQName("fullYear","",Class<IFunction>::getFunction(getFullYear),GETTER_METHOD,true); - c->setDeclaredMethodByQName("fullYear","",Class<IFunction>::getFunction(fullYearSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("fullYearUTC","",Class<IFunction>::getFunction(getUTCFullYear),GETTER_METHOD,true); - c->setDeclaredMethodByQName("fullYearUTC","",Class<IFunction>::getFunction(UTCFullYearSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("hours","",Class<IFunction>::getFunction(getHours),GETTER_METHOD,true); - c->setDeclaredMethodByQName("hours","",Class<IFunction>::getFunction(hoursSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("hoursUTC","",Class<IFunction>::getFunction(getUTCHours),GETTER_METHOD,true); - c->setDeclaredMethodByQName("hoursUTC","",Class<IFunction>::getFunction(UTCHoursSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("milliseconds","",Class<IFunction>::getFunction(getMilliseconds),GETTER_METHOD,true); - c->setDeclaredMethodByQName("milliseconds","",Class<IFunction>::getFunction(millisecondsSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("millisecondsUTC","",Class<IFunction>::getFunction(getUTCMilliseconds),GETTER_METHOD,true); - c->setDeclaredMethodByQName("millisecondsUTC","",Class<IFunction>::getFunction(UTCMillisecondsSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("minutes","",Class<IFunction>::getFunction(getMinutes),GETTER_METHOD,true); - c->setDeclaredMethodByQName("minutes","",Class<IFunction>::getFunction(minutesSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("minutesUTC","",Class<IFunction>::getFunction(getUTCMinutes),GETTER_METHOD,true); - c->setDeclaredMethodByQName("minutesUTC","",Class<IFunction>::getFunction(UTCMinutesSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("month","",Class<IFunction>::getFunction(getMonth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("month","",Class<IFunction>::getFunction(monthSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("monthUTC","",Class<IFunction>::getFunction(getUTCMonth),GETTER_METHOD,true); - c->setDeclaredMethodByQName("monthUTC","",Class<IFunction>::getFunction(UTCMonthSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("seconds","",Class<IFunction>::getFunction(getSeconds),GETTER_METHOD,true); - c->setDeclaredMethodByQName("seconds","",Class<IFunction>::getFunction(secondsSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("secondsUTC","",Class<IFunction>::getFunction(getUTCSeconds),GETTER_METHOD,true); - c->setDeclaredMethodByQName("secondsUTC","",Class<IFunction>::getFunction(UTCSecondsSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("time","",Class<IFunction>::getFunction(getTime),GETTER_METHOD,true); - c->setDeclaredMethodByQName("time","",Class<IFunction>::getFunction(timeSetter),SETTER_METHOD,true); - c->setDeclaredMethodByQName("timezoneOffset","",Class<IFunction>::getFunction(getTimezoneOffset),GETTER_METHOD,true); - - c->prototype->setVariableByQName("getTimezoneOffset","",Class<IFunction>::getFunction(getTimezoneOffset),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(valueOf),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getTime","",Class<IFunction>::getFunction(getTime),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getFullYear","",Class<IFunction>::getFunction(getFullYear),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getMonth","",Class<IFunction>::getFunction(getMonth),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getDate","",Class<IFunction>::getFunction(getDate),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getDay","",Class<IFunction>::getFunction(getDay),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getHours","",Class<IFunction>::getFunction(getHours),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getMinutes","",Class<IFunction>::getFunction(getMinutes),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getSeconds","",Class<IFunction>::getFunction(getSeconds),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getMilliseconds","",Class<IFunction>::getFunction(getMilliseconds),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setFullYear","",Class<IFunction>::getFunction(setFullYear,3),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setMonth","",Class<IFunction>::getFunction(setMonth,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setDate","",Class<IFunction>::getFunction(setDate),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setHours","",Class<IFunction>::getFunction(setHours,4),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setMinutes","",Class<IFunction>::getFunction(setMinutes,3),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setSeconds","",Class<IFunction>::getFunction(setSeconds,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setMilliseconds","",Class<IFunction>::getFunction(setMilliseconds),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCFullYear","",Class<IFunction>::getFunction(getUTCFullYear),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCMonth","",Class<IFunction>::getFunction(getUTCMonth),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCDate","",Class<IFunction>::getFunction(getUTCDate),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCDay","",Class<IFunction>::getFunction(getUTCDay),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCHours","",Class<IFunction>::getFunction(getUTCHours),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCMinutes","",Class<IFunction>::getFunction(getUTCMinutes),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCSeconds","",Class<IFunction>::getFunction(getUTCSeconds),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("getUTCMilliseconds","",Class<IFunction>::getFunction(getUTCMilliseconds),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setUTCFullYear","",Class<IFunction>::getFunction(setUTCFullYear,3),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setUTCMonth","",Class<IFunction>::getFunction(setUTCMonth,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setUTCDate","",Class<IFunction>::getFunction(setUTCDate),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setUTCHours","",Class<IFunction>::getFunction(setUTCHours,4),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setUTCMinutes","",Class<IFunction>::getFunction(setUTCMinutes,3),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setUTCSeconds","",Class<IFunction>::getFunction(setUTCSeconds,2),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setUTCMilliseconds","",Class<IFunction>::getFunction(setUTCMilliseconds),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("setTime","",Class<IFunction>::getFunction(setTime,1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toUTCString","",Class<IFunction>::getFunction(toUTCString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toDateString","",Class<IFunction>::getFunction(toDateString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toTimeString","",Class<IFunction>::getFunction(toTimeString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleTimeString","",Class<IFunction>::getFunction(toLocaleTimeString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleDateString","",Class<IFunction>::getFunction(toLocaleDateString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(toLocaleString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toJSON",AS3,Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("getTimezoneOffset",AS3,Class<IFunction>::getFunction(c->getSystemState(),getTimezoneOffset),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),valueOf),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getTime",AS3,Class<IFunction>::getFunction(c->getSystemState(),getTime),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getFullYear",AS3,Class<IFunction>::getFunction(c->getSystemState(),getFullYear),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getMonth",AS3,Class<IFunction>::getFunction(c->getSystemState(),getMonth),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getDate",AS3,Class<IFunction>::getFunction(c->getSystemState(),getDate),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getDay",AS3,Class<IFunction>::getFunction(c->getSystemState(),getDay),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getHours",AS3,Class<IFunction>::getFunction(c->getSystemState(),getHours),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getMinutes",AS3,Class<IFunction>::getFunction(c->getSystemState(),getMinutes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getSeconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),getSeconds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getMilliseconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),getMilliseconds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setFullYear",AS3,Class<IFunction>::getFunction(c->getSystemState(),setFullYear,3),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setMonth",AS3,Class<IFunction>::getFunction(c->getSystemState(),setMonth,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setDate",AS3,Class<IFunction>::getFunction(c->getSystemState(),setDate),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setHours",AS3,Class<IFunction>::getFunction(c->getSystemState(),setHours,4),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setMinutes",AS3,Class<IFunction>::getFunction(c->getSystemState(),setMinutes,3),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setSeconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),setSeconds,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setMilliseconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),setMilliseconds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCFullYear",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCFullYear),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCMonth",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCMonth),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCDate",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCDate),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCDay",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCDay),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCHours",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCHours),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCMinutes",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCMinutes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCSeconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCSeconds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getUTCMilliseconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),getUTCMilliseconds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setUTCFullYear",AS3,Class<IFunction>::getFunction(c->getSystemState(),setUTCFullYear,3),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setUTCMonth",AS3,Class<IFunction>::getFunction(c->getSystemState(),setUTCMonth,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setUTCDate",AS3,Class<IFunction>::getFunction(c->getSystemState(),setUTCDate),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setUTCHours",AS3,Class<IFunction>::getFunction(c->getSystemState(),setUTCHours,4),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setUTCMinutes",AS3,Class<IFunction>::getFunction(c->getSystemState(),setUTCMinutes,3),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setUTCSeconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),setUTCSeconds,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setUTCMilliseconds",AS3,Class<IFunction>::getFunction(c->getSystemState(),setUTCMilliseconds),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setTime",AS3,Class<IFunction>::getFunction(c->getSystemState(),setTime,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("UTC","",Class<IFunction>::getFunction(c->getSystemState(),UTC,7),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toUTCString",AS3,Class<IFunction>::getFunction(c->getSystemState(),toUTCString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toDateString",AS3,Class<IFunction>::getFunction(c->getSystemState(),toDateString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toTimeString",AS3,Class<IFunction>::getFunction(c->getSystemState(),toTimeString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLocaleString",AS3,Class<IFunction>::getFunction(c->getSystemState(),toLocaleString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLocaleDateString",AS3,Class<IFunction>::getFunction(c->getSystemState(),toLocaleDateString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("parse","",Class<IFunction>::getFunction(c->getSystemState(),_parse),NORMAL_METHOD,false); + + c->setDeclaredMethodByQName("date","",Class<IFunction>::getFunction(c->getSystemState(),getDate),GETTER_METHOD,true); + c->setDeclaredMethodByQName("date","",Class<IFunction>::getFunction(c->getSystemState(),dateSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("dateUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCDate),GETTER_METHOD,true); + c->setDeclaredMethodByQName("dateUTC","",Class<IFunction>::getFunction(c->getSystemState(),UTCDateSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("day","",Class<IFunction>::getFunction(c->getSystemState(),getDay),GETTER_METHOD,true); + c->setDeclaredMethodByQName("dayUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCDay),GETTER_METHOD,true); + c->setDeclaredMethodByQName("fullYear","",Class<IFunction>::getFunction(c->getSystemState(),getFullYear),GETTER_METHOD,true); + c->setDeclaredMethodByQName("fullYear","",Class<IFunction>::getFunction(c->getSystemState(),fullYearSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("fullYearUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCFullYear),GETTER_METHOD,true); + c->setDeclaredMethodByQName("fullYearUTC","",Class<IFunction>::getFunction(c->getSystemState(),UTCFullYearSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("hours","",Class<IFunction>::getFunction(c->getSystemState(),getHours),GETTER_METHOD,true); + c->setDeclaredMethodByQName("hours","",Class<IFunction>::getFunction(c->getSystemState(),hoursSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("hoursUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCHours),GETTER_METHOD,true); + c->setDeclaredMethodByQName("hoursUTC","",Class<IFunction>::getFunction(c->getSystemState(),UTCHoursSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("milliseconds","",Class<IFunction>::getFunction(c->getSystemState(),getMilliseconds),GETTER_METHOD,true); + c->setDeclaredMethodByQName("milliseconds","",Class<IFunction>::getFunction(c->getSystemState(),millisecondsSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("millisecondsUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCMilliseconds),GETTER_METHOD,true); + c->setDeclaredMethodByQName("millisecondsUTC","",Class<IFunction>::getFunction(c->getSystemState(),UTCMillisecondsSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("minutes","",Class<IFunction>::getFunction(c->getSystemState(),getMinutes),GETTER_METHOD,true); + c->setDeclaredMethodByQName("minutes","",Class<IFunction>::getFunction(c->getSystemState(),minutesSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("minutesUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCMinutes),GETTER_METHOD,true); + c->setDeclaredMethodByQName("minutesUTC","",Class<IFunction>::getFunction(c->getSystemState(),UTCMinutesSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("month","",Class<IFunction>::getFunction(c->getSystemState(),getMonth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("month","",Class<IFunction>::getFunction(c->getSystemState(),monthSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("monthUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCMonth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("monthUTC","",Class<IFunction>::getFunction(c->getSystemState(),UTCMonthSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("seconds","",Class<IFunction>::getFunction(c->getSystemState(),getSeconds),GETTER_METHOD,true); + c->setDeclaredMethodByQName("seconds","",Class<IFunction>::getFunction(c->getSystemState(),secondsSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("secondsUTC","",Class<IFunction>::getFunction(c->getSystemState(),getUTCSeconds),GETTER_METHOD,true); + c->setDeclaredMethodByQName("secondsUTC","",Class<IFunction>::getFunction(c->getSystemState(),UTCSecondsSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("time","",Class<IFunction>::getFunction(c->getSystemState(),getTime),GETTER_METHOD,true); + c->setDeclaredMethodByQName("time","",Class<IFunction>::getFunction(c->getSystemState(),timeSetter),SETTER_METHOD,true); + c->setDeclaredMethodByQName("timezoneOffset","",Class<IFunction>::getFunction(c->getSystemState(),getTimezoneOffset),GETTER_METHOD,true); +
View file
lightspark.tar.xz/src/scripting/toplevel/Error.cpp
Changed
@@ -72,13 +72,14 @@ } if (Log::getLevel() >= LOG_INFO) { + SystemState* sys = getSys(); tiny_string stacktrace; - for (auto it = getVm()->stacktrace.crbegin(); it != getVm()->stacktrace.crend(); it++) + for (auto it = getVm(sys)->stacktrace.crbegin(); it != getVm(sys)->stacktrace.crend(); it++) { stacktrace += " at "; stacktrace += (*it).second->getClassName(); stacktrace += "/"; - stacktrace += getSys()->getStringFromUniqueId((*it).first); + stacktrace += sys->getStringFromUniqueId((*it).first); stacktrace += "()\n"; } LOG(LOG_INFO,"throwing exception:"<<errorID<<" "<<msg.str()<< "\n" << stacktrace); @@ -90,12 +91,12 @@ ASObject(c),errorID(id),name(error_name),message(error_message) { stacktrace = ""; - for (auto it = getVm()->stacktrace.crbegin(); it != getVm()->stacktrace.crend(); it++) + for (auto it = getVm(c->getSystemState())->stacktrace.crbegin(); it != getVm(c->getSystemState())->stacktrace.crend(); it++) { stacktrace += " at "; stacktrace += (*it).second->getClassName(); stacktrace += "/"; - stacktrace += getSys()->getStringFromUniqueId((*it).first); + stacktrace += c->getSystemState()->getStringFromUniqueId((*it).first); stacktrace += "()\n"; } } @@ -104,7 +105,7 @@ { ASError* th=static_cast<ASError*>(obj); - ASString* ret=Class<ASString>::getInstanceS(th->getStackTraceString()); + ASString* ret=abstract_s(obj->getSystemState(),th->getStackTraceString()); return ret; } tiny_string ASError::getStackTraceString() @@ -129,7 +130,7 @@ ASFUNCTIONBODY(ASError,_toString) { ASError* th=static_cast<ASError*>(obj); - return Class<ASString>::getInstanceS(th->ASError::toString()); + return abstract_s(obj->getSystemState(),th->ASError::toString()); } ASFUNCTIONBODY(ASError,_constructor) @@ -149,7 +150,7 @@ ASFUNCTIONBODY(ASError,generator) { - ASError* th=Class<ASError>::getInstanceS(); + ASError* th=Class<ASError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -170,9 +171,9 @@ void ASError::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_DYNAMIC_NOT_FINAL); - c->setDeclaredMethodByQName("getStackTrace","",Class<IFunction>::getFunction(_getStackTrace),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getStackTrace","",Class<IFunction>::getFunction(c->getSystemState(),_getStackTrace),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); REGISTER_GETTER(c, errorID); REGISTER_GETTER_SETTER(c, message); REGISTER_GETTER_SETTER(c, name); @@ -199,7 +200,7 @@ ASFUNCTIONBODY(SecurityError,generator) { - ASError* th=Class<SecurityError>::getInstanceS(); + ASError* th=Class<SecurityError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -226,7 +227,7 @@ ASFUNCTIONBODY(ArgumentError,generator) { - ASError* th=Class<ArgumentError>::getInstanceS(); + ASError* th=Class<ArgumentError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -253,7 +254,7 @@ ASFUNCTIONBODY(DefinitionError,generator) { - ASError* th=Class<DefinitionError>::getInstanceS(); + ASError* th=Class<DefinitionError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -280,7 +281,7 @@ ASFUNCTIONBODY(EvalError,generator) { - ASError* th=Class<EvalError>::getInstanceS(); + ASError* th=Class<EvalError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -307,7 +308,7 @@ ASFUNCTIONBODY(RangeError,generator) { - ASError* th=Class<RangeError>::getInstanceS(); + ASError* th=Class<RangeError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -334,7 +335,7 @@ ASFUNCTIONBODY(ReferenceError,generator) { - ASError* th=Class<ReferenceError>::getInstanceS(); + ASError* th=Class<ReferenceError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -361,7 +362,7 @@ ASFUNCTIONBODY(SyntaxError,generator) { - ASError* th=Class<SyntaxError>::getInstanceS(); + ASError* th=Class<SyntaxError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -388,7 +389,7 @@ ASFUNCTIONBODY(TypeError,generator) { - ASError* th=Class<TypeError>::getInstanceS(); + ASError* th=Class<TypeError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -415,7 +416,7 @@ ASFUNCTIONBODY(URIError,generator) { - ASError* th=Class<URIError>::getInstanceS(); + ASError* th=Class<URIError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -442,7 +443,7 @@ ASFUNCTIONBODY(VerifyError,generator) { - ASError* th=Class<VerifyError>::getInstanceS(); + ASError* th=Class<VerifyError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; } @@ -469,7 +470,7 @@ ASFUNCTIONBODY(UninitializedError,generator) { - ASError* th=Class<UninitializedError>::getInstanceS(); + ASError* th=Class<UninitializedError>::getInstanceS(getSys()); errorGenerator(th, args, argslen); return th; }
View file
lightspark.tar.xz/src/scripting/toplevel/Error.h
Changed
@@ -36,7 +36,7 @@ void throwError(int errorID, const tiny_string& arg1="", const tiny_string& arg2="", const tiny_string& arg3="") { tiny_string message = createErrorMessage(errorID, arg1, arg2, arg3); - throw Class<T>::getInstanceS(message, errorID); + throw Class<T>::getInstanceS(getSys(),message, errorID); } class ASError: public ASObject
View file
lightspark.tar.xz/src/scripting/toplevel/Integer.cpp
Changed
@@ -28,8 +28,8 @@ ASFUNCTIONBODY(Integer,_toString) { - if(Class<Integer>::getClass()->prototype->getObj() == obj) - return abstract_s("0"); + if(Class<Integer>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_s(obj->getSystemState(),"0"); Integer* th=static_cast<Integer*>(obj); int radix=10; @@ -40,24 +40,24 @@ { char buf[20]; snprintf(buf,20,"%i",th->val); - return abstract_s(buf); + return abstract_s(obj->getSystemState(),buf); } else { tiny_string s=Number::toStringRadix((number_t)th->val, radix); - return abstract_s(s); + return abstract_s(obj->getSystemState(),s); } } ASFUNCTIONBODY(Integer,_valueOf) { - if(Class<Integer>::getClass()->prototype->getObj() == obj) - return abstract_i(0); + if(Class<Integer>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_i(obj->getSystemState(),0); if(!obj->is<Integer>()) - throw Class<TypeError>::getInstanceS(""); + throw Class<TypeError>::getInstanceS(obj->getSystemState(),""); - return abstract_i(obj->as<Integer>()->val); + return abstract_i(obj->getSystemState(),obj->as<Integer>()->val); } ASFUNCTIONBODY(Integer,_constructor) @@ -75,8 +75,8 @@ ASFUNCTIONBODY(Integer,generator) { if (argslen == 0) - return abstract_i(0); - return abstract_i(args[0]->toInt()); + return abstract_i(getSys(),0); + return abstract_i(args[0]->getSystemState(),args[0]->toInt()); } TRISTATE Integer::isLess(ASObject* o) @@ -196,18 +196,18 @@ { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); c->isReusable = true; - c->setVariableByQName("MAX_VALUE","",abstract_i(numeric_limits<int32_t>::max()),CONSTANT_TRAIT); - c->setVariableByQName("MIN_VALUE","",abstract_i(numeric_limits<int32_t>::min()),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(_toFixed,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(_toExponential,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(_toPrecision,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(_valueOf),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(Integer::_toExponential, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(Integer::_toFixed, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(Integer::_toPrecision, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(Integer::_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(_valueOf),DYNAMIC_TRAIT); + c->setVariableByQName("MAX_VALUE","",abstract_i(c->getSystemState(),numeric_limits<int32_t>::max()),CONSTANT_TRAIT); + c->setVariableByQName("MIN_VALUE","",abstract_i(c->getSystemState(),numeric_limits<int32_t>::min()),CONSTANT_TRAIT); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toFixed,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toExponential,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toPrecision,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),_valueOf),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(c->getSystemState(),Integer::_toExponential, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(c->getSystemState(),Integer::_toFixed, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(c->getSystemState(),Integer::_toPrecision, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),Integer::_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),_valueOf),DYNAMIC_TRAIT); } void Integer::serialize(ByteArray* out, std::map<tiny_string, uint32_t>& stringMap, @@ -305,7 +305,7 @@ else fractionDigits = imin(imax((int32_t)ceil(::log10(::fabs(v))), 1), 20); } - return abstract_s(Number::toExponentialString(v, fractionDigits)); + return abstract_s(obj->getSystemState(),Number::toExponentialString(v, fractionDigits)); } ASFUNCTIONBODY(Integer,_toFixed) @@ -313,15 +313,15 @@ Integer *th=obj->as<Integer>(); int fractiondigits; ARG_UNPACK (fractiondigits, 0); - return abstract_s(Number::toFixedString(th->val, fractiondigits)); + return abstract_s(obj->getSystemState(),Number::toFixedString(th->val, fractiondigits)); } ASFUNCTIONBODY(Integer,_toPrecision) { Integer *th=obj->as<Integer>(); if (argslen == 0 || args[0]->is<Undefined>()) - return abstract_s(th->toString()); + return abstract_s(obj->getSystemState(),th->toString()); int precision; ARG_UNPACK (precision); - return abstract_s(Number::toPrecisionString(th->val, precision)); + return abstract_s(obj->getSystemState(),Number::toPrecisionString(th->val, precision)); }
View file
lightspark.tar.xz/src/scripting/toplevel/Integer.h
Changed
@@ -37,7 +37,8 @@ int32_t val; static void buildTraits(ASObject* o){}; static void sinit(Class_base* c); - void finalize() { val=0;} + inline number_t toNumber() { return val; } + inline void finalize() { val=0;} ASFUNCTION(_toString); tiny_string toString(); static tiny_string toString(int32_t val);
View file
lightspark.tar.xz/src/scripting/toplevel/JSON.cpp
Changed
@@ -31,8 +31,8 @@ void JSON::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); - c->setDeclaredMethodByQName("parse","",Class<IFunction>::getFunction(_parse,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("stringify","",Class<IFunction>::getFunction(_stringify,3),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("parse","",Class<IFunction>::getFunction(c->getSystemState(),_parse,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("stringify","",Class<IFunction>::getFunction(c->getSystemState(),_stringify,3),NORMAL_METHOD,false); } void JSON::buildTraits(ASObject* o) { @@ -127,7 +127,7 @@ } tiny_string res = value->toJSON(path,replacer,spaces,filter); - return Class<ASString>::getInstanceS(res); + return abstract_s(obj->getSystemState(),res); } void JSON::parseAll(const tiny_string &jsonstring, ASObject** parent , const multiname& key, IFunction *reviver) { @@ -202,7 +202,7 @@ if (haskey) { - params[0] = Class<ASString>::getInstanceS(key.normalizedName()); + params[0] = abstract_s(getSys(),key.normalizedName(getSys())); if ((*parent)->hasPropertyByMultiname(key,true,false)) { params[1] = (*parent)->getVariableByMultiname(key).getPtr(); @@ -213,7 +213,7 @@ } else { - params[0] = Class<ASString>::getInstanceS(""); + params[0] = abstract_s(getSys(),""); params[1] = *parent; params[1]->incRef(); } @@ -251,9 +251,9 @@ { pos += 4; if (*parent == NULL) - *parent = abstract_b(true); + *parent = abstract_b(getSys(),true); else - (*parent)->setVariableByMultiname(key,abstract_b(true),ASObject::CONST_NOT_ALLOWED); + (*parent)->setVariableByMultiname(key,abstract_b((*parent)->getSystemState(),true),ASObject::CONST_NOT_ALLOWED); } else throwError<SyntaxError>(kJSONInvalidParseInput); @@ -275,9 +275,9 @@ { pos += 5; if (*parent == NULL) - *parent = abstract_b(false); + *parent = abstract_b(getSys(),false); else - (*parent)->setVariableByMultiname(key,abstract_b(false),ASObject::CONST_NOT_ALLOWED); + (*parent)->setVariableByMultiname(key,abstract_b((*parent)->getSystemState(),false),ASObject::CONST_NOT_ALLOWED); } else throwError<SyntaxError>(kJSONInvalidParseInput); @@ -418,9 +418,9 @@ if (parent != NULL) { if (*parent == NULL) - *parent = Class<ASString>::getInstanceS(res); + *parent = abstract_s(getSys(),res); else - (*parent)->setVariableByMultiname(key,Class<ASString>::getInstanceS(res),ASObject::CONST_NOT_ALLOWED); + (*parent)->setVariableByMultiname(key,abstract_s(getSys(),res),ASObject::CONST_NOT_ALLOWED); } if (result) *result =res; @@ -459,17 +459,17 @@ break; } } - ASString* numstr = Class<ASString>::getInstanceS(res); + ASString* numstr = abstract_s(getSys(),res); number_t num = numstr->toNumber(); if (std::isnan(num)) throwError<SyntaxError>(kJSONInvalidParseInput); if (*parent == NULL) - *parent = Class<Number>::getInstanceS(num); + *parent = abstract_d(getSys(),num); else { - (*parent)->setVariableByMultiname(key,Class<Number>::getInstanceS(num),ASObject::CONST_NOT_ALLOWED); + (*parent)->setVariableByMultiname(key,abstract_d(getSys(),num),ASObject::CONST_NOT_ALLOWED); } return pos; } @@ -477,14 +477,14 @@ { int len = jsonstring.numChars(); pos++; // ignore '{' or ',' - ASObject* subobj = Class<ASObject>::getInstanceS(); + ASObject* subobj = Class<ASObject>::getInstanceS(getSys()); if (*parent == NULL) *parent = subobj; else (*parent)->setVariableByMultiname(key,subobj,ASObject::CONST_NOT_ALLOWED); multiname name(NULL); name.name_type=multiname::NAME_STRING; - name.ns.push_back(nsNameAndKind("",NAMESPACE)); + name.ns.push_back(nsNameAndKind(getSys(),"",NAMESPACE)); name.isAttribute = false; bool done = false; bool bfirst = true; @@ -544,7 +544,7 @@ { int len = jsonstring.numChars(); pos++; // ignore '[' - ASObject* subobj = Class<Array>::getInstanceS(); + ASObject* subobj = Class<Array>::getInstanceS(getSys()); if (*parent == NULL) *parent = subobj; else @@ -552,7 +552,7 @@ multiname name(NULL); name.name_type=multiname::NAME_INT; name.name_i = 0; - name.ns.push_back(nsNameAndKind("",NAMESPACE)); + name.ns.push_back(nsNameAndKind(getSys(),"",NAMESPACE)); name.isAttribute = false; bool done = false; bool needdata = false;
View file
lightspark.tar.xz/src/scripting/toplevel/Math.cpp
Changed
@@ -28,34 +28,34 @@ { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); // public constants - c->setVariableByQName("E","",abstract_d(2.71828182845905),CONSTANT_TRAIT); - c->setVariableByQName("LN10","",abstract_d(2.302585092994046),CONSTANT_TRAIT); - c->setVariableByQName("LN2","",abstract_d(0.6931471805599453),CONSTANT_TRAIT); - c->setVariableByQName("LOG10E","",abstract_d(0.4342944819032518),CONSTANT_TRAIT); - c->setVariableByQName("LOG2E","",abstract_d(1.442695040888963387),CONSTANT_TRAIT); - c->setVariableByQName("PI","",abstract_d(3.141592653589793),CONSTANT_TRAIT); - c->setVariableByQName("SQRT1_2","",abstract_d(0.7071067811865476),CONSTANT_TRAIT); - c->setVariableByQName("SQRT2","",abstract_d(1.4142135623730951),CONSTANT_TRAIT); + c->setVariableByQName("E","",abstract_d(c->getSystemState(),2.71828182845905),CONSTANT_TRAIT); + c->setVariableByQName("LN10","",abstract_d(c->getSystemState(),2.302585092994046),CONSTANT_TRAIT); + c->setVariableByQName("LN2","",abstract_d(c->getSystemState(),0.6931471805599453),CONSTANT_TRAIT); + c->setVariableByQName("LOG10E","",abstract_d(c->getSystemState(),0.4342944819032518),CONSTANT_TRAIT); + c->setVariableByQName("LOG2E","",abstract_d(c->getSystemState(),1.442695040888963387),CONSTANT_TRAIT); + c->setVariableByQName("PI","",abstract_d(c->getSystemState(),3.141592653589793),CONSTANT_TRAIT); + c->setVariableByQName("SQRT1_2","",abstract_d(c->getSystemState(),0.7071067811865476),CONSTANT_TRAIT); + c->setVariableByQName("SQRT2","",abstract_d(c->getSystemState(),1.4142135623730951),CONSTANT_TRAIT); // public methods - c->setDeclaredMethodByQName("abs","",Class<IFunction>::getFunction(abs,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("acos","",Class<IFunction>::getFunction(acos,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("asin","",Class<IFunction>::getFunction(asin,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("atan","",Class<IFunction>::getFunction(atan,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("atan2","",Class<IFunction>::getFunction(atan2,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("ceil","",Class<IFunction>::getFunction(ceil,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("cos","",Class<IFunction>::getFunction(cos,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("exp","",Class<IFunction>::getFunction(exp,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("floor","",Class<IFunction>::getFunction(floor,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("log","",Class<IFunction>::getFunction(log,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("max","",Class<IFunction>::getFunction(_max,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("min","",Class<IFunction>::getFunction(_min,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("pow","",Class<IFunction>::getFunction(pow,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("random","",Class<IFunction>::getFunction(random),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("round","",Class<IFunction>::getFunction(round,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("sin","",Class<IFunction>::getFunction(sin,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("sqrt","",Class<IFunction>::getFunction(sqrt,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("tan","",Class<IFunction>::getFunction(tan,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("abs","",Class<IFunction>::getFunction(c->getSystemState(),abs,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("acos","",Class<IFunction>::getFunction(c->getSystemState(),acos,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("asin","",Class<IFunction>::getFunction(c->getSystemState(),asin,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("atan","",Class<IFunction>::getFunction(c->getSystemState(),atan,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("atan2","",Class<IFunction>::getFunction(c->getSystemState(),atan2,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("ceil","",Class<IFunction>::getFunction(c->getSystemState(),ceil,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("cos","",Class<IFunction>::getFunction(c->getSystemState(),cos,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("exp","",Class<IFunction>::getFunction(c->getSystemState(),exp,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("floor","",Class<IFunction>::getFunction(c->getSystemState(),floor,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("log","",Class<IFunction>::getFunction(c->getSystemState(),log,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("max","",Class<IFunction>::getFunction(c->getSystemState(),_max,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("min","",Class<IFunction>::getFunction(c->getSystemState(),_min,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("pow","",Class<IFunction>::getFunction(c->getSystemState(),pow,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("random","",Class<IFunction>::getFunction(c->getSystemState(),random),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("round","",Class<IFunction>::getFunction(c->getSystemState(),round,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("sin","",Class<IFunction>::getFunction(c->getSystemState(),sin,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("sqrt","",Class<IFunction>::getFunction(c->getSystemState(),sqrt,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("tan","",Class<IFunction>::getFunction(c->getSystemState(),tan,1),NORMAL_METHOD,false); } ASFUNCTIONBODY(Math,_constructor) @@ -74,7 +74,7 @@ { number_t n1, n2; ARG_UNPACK (n1) (n2); - return abstract_d(::atan2(n1,n2)); + return abstract_d(obj->getSystemState(),::atan2(n1,n2)); } ASFUNCTIONBODY(Math,_max) @@ -94,7 +94,7 @@ else largest = (arg>largest) ? arg : largest; } - return abstract_d(largest); + return abstract_d(obj->getSystemState(),largest); } ASFUNCTIONBODY(Math,_min) @@ -115,14 +115,14 @@ smallest = (arg<smallest)? arg : smallest; } - return abstract_d(smallest); + return abstract_d(obj->getSystemState(),smallest); } ASFUNCTIONBODY(Math,exp) { number_t n; ARG_UNPACK (n); - return abstract_d(::exp(n)); + return abstract_d(obj->getSystemState(),::exp(n)); } ASFUNCTIONBODY(Math,acos) @@ -130,7 +130,7 @@ //Angle is in radians number_t n; ARG_UNPACK (n); - return abstract_d(::acos(n)); + return abstract_d(obj->getSystemState(),::acos(n)); } ASFUNCTIONBODY(Math,asin) @@ -138,7 +138,7 @@ //Angle is in radians number_t n; ARG_UNPACK (n); - return abstract_d(::asin(n)); + return abstract_d(obj->getSystemState(),::asin(n)); } ASFUNCTIONBODY(Math,atan) @@ -146,7 +146,7 @@ //Angle is in radians number_t n; ARG_UNPACK (n); - return abstract_d(::atan(n)); + return abstract_d(obj->getSystemState(),::atan(n)); } ASFUNCTIONBODY(Math,cos) @@ -154,7 +154,7 @@ //Angle is in radians number_t n; ARG_UNPACK (n); - return abstract_d(::cos(n)); + return abstract_d(obj->getSystemState(),::cos(n)); } ASFUNCTIONBODY(Math,sin) @@ -162,7 +162,7 @@ //Angle is in radians number_t n; ARG_UNPACK (n); - return abstract_d(::sin(n)); + return abstract_d(obj->getSystemState(),::sin(n)); } ASFUNCTIONBODY(Math,tan) @@ -170,35 +170,35 @@ //Angle is in radians number_t n; ARG_UNPACK (n); - return abstract_d(::tan(n)); + return abstract_d(obj->getSystemState(),::tan(n)); } ASFUNCTIONBODY(Math,abs) { number_t n; ARG_UNPACK (n); - return abstract_d(::fabs(n)); + return abstract_d(obj->getSystemState(),::fabs(n)); } ASFUNCTIONBODY(Math,ceil) { number_t n; ARG_UNPACK (n); - return abstract_d(::ceil(n)); + return abstract_d(obj->getSystemState(),::ceil(n)); } ASFUNCTIONBODY(Math,log) { number_t n; ARG_UNPACK (n); - return abstract_d(::log(n)); + return abstract_d(obj->getSystemState(),::log(n)); } ASFUNCTIONBODY(Math,floor) { number_t n; ARG_UNPACK (n); - return abstract_d(::floor(n)); + return abstract_d(obj->getSystemState(),::floor(n)); } ASFUNCTIONBODY(Math,round) @@ -206,15 +206,15 @@ number_t n; ARG_UNPACK (n); if (n < 0 && n >= -0.5) - return abstract_d(0); - return abstract_d(::round(n)); + return abstract_d(obj->getSystemState(),0); + return abstract_d(obj->getSystemState(),::round(n)); } ASFUNCTIONBODY(Math,sqrt) { number_t n; ARG_UNPACK (n); - return abstract_d(::sqrt(n)); + return abstract_d(obj->getSystemState(),::sqrt(n)); }
View file
lightspark.tar.xz/src/scripting/toplevel/Number.cpp
Changed
@@ -166,8 +166,8 @@ ASFUNCTIONBODY(Number,_toString) { - if(Class<Number>::getClass()->prototype->getObj() == obj) - return abstract_s("0"); + if(Class<Number>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_s(obj->getSystemState(),"0"); if(!obj->is<Number>()) throwError<TypeError>(kInvokeOnIncompatibleObjectError, "Number.toString"); Number* th=static_cast<Number*>(obj); @@ -177,20 +177,20 @@ if(radix==10 || std::isnan(th->val) || std::isinf(th->val)) { //see e 15.7.4.2 - return abstract_s(th->toString()); + return abstract_s(obj->getSystemState(),th->toString()); } else { - return abstract_s(Number::toStringRadix(th->val, radix)); + return abstract_s(obj->getSystemState(),Number::toStringRadix(th->val, radix)); } } ASFUNCTIONBODY(Number,generator) { if(argslen==0) - return abstract_d(0.); + return abstract_d(getSys(),0.); else - return abstract_d(args[0]->toNumber()); + return abstract_d(args[0]->getSystemState(),args[0]->toNumber()); } tiny_string Number::toString() @@ -253,53 +253,53 @@ { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); c->isReusable = true; - c->setVariableByQName("NEGATIVE_INFINITY","",abstract_d(-numeric_limits<double>::infinity()),CONSTANT_TRAIT); - c->setVariableByQName("POSITIVE_INFINITY","",abstract_d(numeric_limits<double>::infinity()),CONSTANT_TRAIT); - c->setVariableByQName("MAX_VALUE","",abstract_d(numeric_limits<double>::max()),CONSTANT_TRAIT); - c->setVariableByQName("MIN_VALUE","",abstract_d(numeric_limits<double>::min()),CONSTANT_TRAIT); - c->setVariableByQName("NaN","",abstract_d(numeric_limits<double>::quiet_NaN()),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(toFixed,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(toExponential,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(toPrecision,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(_valueOf),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(Number::_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(Number::_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(Number::toFixed, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(Number::toExponential, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(Number::toPrecision, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(_valueOf),DYNAMIC_TRAIT); + c->setVariableByQName("NEGATIVE_INFINITY","",abstract_d(c->getSystemState(),-numeric_limits<double>::infinity()),CONSTANT_TRAIT); + c->setVariableByQName("POSITIVE_INFINITY","",abstract_d(c->getSystemState(),numeric_limits<double>::infinity()),CONSTANT_TRAIT); + c->setVariableByQName("MAX_VALUE","",abstract_d(c->getSystemState(),numeric_limits<double>::max()),CONSTANT_TRAIT); + c->setVariableByQName("MIN_VALUE","",abstract_d(c->getSystemState(),numeric_limits<double>::min()),CONSTANT_TRAIT); + c->setVariableByQName("NaN","",abstract_d(c->getSystemState(),numeric_limits<double>::quiet_NaN()),CONSTANT_TRAIT); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(c->getSystemState(),toFixed,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(c->getSystemState(),toExponential,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(c->getSystemState(),toPrecision,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),_valueOf),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),Number::_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(c->getSystemState(),Number::_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(c->getSystemState(),Number::toFixed, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(c->getSystemState(),Number::toExponential, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(c->getSystemState(),Number::toPrecision, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),_valueOf),DYNAMIC_TRAIT); // if needed add AVMPLUS definitions - if(getSys()->flashMode==SystemState::AVMPLUS) + if(c->getSystemState()->flashMode==SystemState::AVMPLUS) { - c->setVariableByQName("E","",abstract_d(2.71828182845905),CONSTANT_TRAIT); - c->setVariableByQName("LN10","",abstract_d(2.302585092994046),CONSTANT_TRAIT); - c->setVariableByQName("LN2","",abstract_d(0.6931471805599453),CONSTANT_TRAIT); - c->setVariableByQName("LOG10E","",abstract_d(0.4342944819032518),CONSTANT_TRAIT); - c->setVariableByQName("LOG2E","",abstract_d(1.442695040888963387),CONSTANT_TRAIT); - c->setVariableByQName("PI","",abstract_d(3.141592653589793),CONSTANT_TRAIT); - c->setVariableByQName("SQRT1_2","",abstract_d(0.7071067811865476),CONSTANT_TRAIT); - c->setVariableByQName("SQRT2","",abstract_d(1.4142135623730951),CONSTANT_TRAIT); + c->setVariableByQName("E","",abstract_d(c->getSystemState(),2.71828182845905),CONSTANT_TRAIT); + c->setVariableByQName("LN10","",abstract_d(c->getSystemState(),2.302585092994046),CONSTANT_TRAIT); + c->setVariableByQName("LN2","",abstract_d(c->getSystemState(),0.6931471805599453),CONSTANT_TRAIT); + c->setVariableByQName("LOG10E","",abstract_d(c->getSystemState(),0.4342944819032518),CONSTANT_TRAIT); + c->setVariableByQName("LOG2E","",abstract_d(c->getSystemState(),1.442695040888963387),CONSTANT_TRAIT); + c->setVariableByQName("PI","",abstract_d(c->getSystemState(),3.141592653589793),CONSTANT_TRAIT); + c->setVariableByQName("SQRT1_2","",abstract_d(c->getSystemState(),0.7071067811865476),CONSTANT_TRAIT); + c->setVariableByQName("SQRT2","",abstract_d(c->getSystemState(),1.4142135623730951),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("abs","",Class<IFunction>::getFunction(Math::abs,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("acos","",Class<IFunction>::getFunction(Math::acos,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("asin","",Class<IFunction>::getFunction(Math::asin,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("atan","",Class<IFunction>::getFunction(Math::atan,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("atan2","",Class<IFunction>::getFunction(Math::atan2,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("ceil","",Class<IFunction>::getFunction(Math::ceil,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("cos","",Class<IFunction>::getFunction(Math::cos,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("exp","",Class<IFunction>::getFunction(Math::exp,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("floor","",Class<IFunction>::getFunction(Math::floor,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("log","",Class<IFunction>::getFunction(Math::log,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("max","",Class<IFunction>::getFunction(Math::_max,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("min","",Class<IFunction>::getFunction(Math::_min,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("pow","",Class<IFunction>::getFunction(Math::pow,2),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("random","",Class<IFunction>::getFunction(Math::random),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("round","",Class<IFunction>::getFunction(Math::round,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("sin","",Class<IFunction>::getFunction(Math::sin,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("sqrt","",Class<IFunction>::getFunction(Math::sqrt,1),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("tan","",Class<IFunction>::getFunction(Math::tan,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("abs","",Class<IFunction>::getFunction(c->getSystemState(),Math::abs,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("acos","",Class<IFunction>::getFunction(c->getSystemState(),Math::acos,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("asin","",Class<IFunction>::getFunction(c->getSystemState(),Math::asin,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("atan","",Class<IFunction>::getFunction(c->getSystemState(),Math::atan,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("atan2","",Class<IFunction>::getFunction(c->getSystemState(),Math::atan2,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("ceil","",Class<IFunction>::getFunction(c->getSystemState(),Math::ceil,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("cos","",Class<IFunction>::getFunction(c->getSystemState(),Math::cos,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("exp","",Class<IFunction>::getFunction(c->getSystemState(),Math::exp,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("floor","",Class<IFunction>::getFunction(c->getSystemState(),Math::floor,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("log","",Class<IFunction>::getFunction(c->getSystemState(),Math::log,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("max","",Class<IFunction>::getFunction(c->getSystemState(),Math::_max,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("min","",Class<IFunction>::getFunction(c->getSystemState(),Math::_min,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("pow","",Class<IFunction>::getFunction(c->getSystemState(),Math::pow,2),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("random","",Class<IFunction>::getFunction(c->getSystemState(),Math::random),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("round","",Class<IFunction>::getFunction(c->getSystemState(),Math::round,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("sin","",Class<IFunction>::getFunction(c->getSystemState(),Math::sin,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("sqrt","",Class<IFunction>::getFunction(c->getSystemState(),Math::sqrt,1),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("tan","",Class<IFunction>::getFunction(c->getSystemState(),Math::tan,1),NORMAL_METHOD,false); } } @@ -322,7 +322,7 @@ number_t val = obj->toNumber(); int fractiondigits; ARG_UNPACK (fractiondigits,0); - return abstract_s(toFixedString(val, fractiondigits)); + return abstract_s(obj->getSystemState(),toFixedString(val, fractiondigits)); } tiny_string Number::toFixedString(double v, int32_t fractiondigits) @@ -367,7 +367,7 @@ ARG_UNPACK(fractionDigits, 0); if (argslen == 0 || args[0]->is<Undefined>()) fractionDigits = imin(imax(Number::countSignificantDigits(v)-1, 1), 20); - return abstract_s(toExponentialString(v, fractionDigits)); + return abstract_s(obj->getSystemState(),toExponentialString(v, fractionDigits)); } tiny_string Number::toExponentialString(double v, int32_t fractionDigits) @@ -471,11 +471,11 @@ Number* th=obj->as<Number>(); double v = th->val; if (argslen == 0 || args[0]->is<Undefined>()) - return abstract_s(toString(v)); + return abstract_s(obj->getSystemState(),toString(v)); int32_t precision; ARG_UNPACK(precision); - return abstract_s(toPrecisionString(v, precision)); + return abstract_s(obj->getSystemState(),toPrecisionString(v, precision)); } tiny_string Number::toPrecisionString(double v, int32_t precision) @@ -508,13 +508,13 @@ ASFUNCTIONBODY(Number,_valueOf) { - if(Class<Number>::getClass()->prototype->getObj() == obj) - return abstract_d(0.); + if(Class<Number>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_d(obj->getSystemState(),0.); if(!obj->is<Number>()) throwError<TypeError>(kInvokeOnIncompatibleObjectError); - return abstract_d(obj->as<Number>()->val); + return abstract_d(obj->getSystemState(),obj->as<Number>()->val); } void Number::serialize(ByteArray* out, std::map<tiny_string, uint32_t>& stringMap,
View file
lightspark.tar.xz/src/scripting/toplevel/Number.h
Changed
@@ -40,7 +40,8 @@ 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; - void finalize() { val=std::numeric_limits<double>::quiet_NaN();} + inline number_t toNumber() { return val; } + inline void finalize() { val=std::numeric_limits<double>::quiet_NaN();} ASFUNCTION(_constructor); ASFUNCTION(_toString); ASFUNCTION(toExponential);
View file
lightspark.tar.xz/src/scripting/toplevel/RegExp.cpp
Changed
@@ -36,16 +36,16 @@ void RegExp::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_DYNAMIC_NOT_FINAL); - c->setDeclaredMethodByQName("exec","",Class<IFunction>::getFunction(exec),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("exec",AS3,Class<IFunction>::getFunction(exec),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("test","",Class<IFunction>::getFunction(test),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("test",AS3,Class<IFunction>::getFunction(test),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("exec","",Class<IFunction>::getFunction(exec),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("exec",AS3,Class<IFunction>::getFunction(exec),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("test","",Class<IFunction>::getFunction(test),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("test",AS3,Class<IFunction>::getFunction(test),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("exec","",Class<IFunction>::getFunction(c->getSystemState(),exec),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("exec",AS3,Class<IFunction>::getFunction(c->getSystemState(),exec),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("test","",Class<IFunction>::getFunction(c->getSystemState(),test),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("test",AS3,Class<IFunction>::getFunction(c->getSystemState(),test),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("exec","",Class<IFunction>::getFunction(c->getSystemState(),exec),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("exec",AS3,Class<IFunction>::getFunction(c->getSystemState(),exec),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("test","",Class<IFunction>::getFunction(c->getSystemState(),test),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("test",AS3,Class<IFunction>::getFunction(c->getSystemState(),test),DYNAMIC_TRAIT); REGISTER_GETTER(c,dotall); REGISTER_GETTER(c,global); REGISTER_GETTER(c,ignoreCase); @@ -114,7 +114,7 @@ { if(argslen == 0) { - return Class<RegExp>::getInstanceS(""); + return Class<RegExp>::getInstanceS(getSys(),""); } else if(args[0]->is<RegExp>()) { @@ -125,7 +125,7 @@ { if (argslen > 1) LOG(LOG_NOT_IMPLEMENTED, "RegExp generator: flags argument not implemented"); - return Class<RegExp>::getInstanceS(args[0]->toString()); + return Class<RegExp>::getInstanceS(args[0]->getSystemState(),args[0]->toString()); } } @@ -149,13 +149,13 @@ { pcre* pcreRE = compile(); if (!pcreRE) - return getSys()->getNullRef(); + return getSystemState()->getNullRef(); int capturingGroups; int infoOk=pcre_fullinfo(pcreRE, NULL, PCRE_INFO_CAPTURECOUNT, &capturingGroups); if(infoOk!=0) { pcre_free(pcreRE); - return getSys()->getNullRef(); + return getSystemState()->getNullRef(); } //Get information about named capturing groups int namedGroups; @@ -163,7 +163,7 @@ if(infoOk!=0) { pcre_free(pcreRE); - return getSys()->getNullRef(); + return getSystemState()->getNullRef(); } //Get information about the size of named entries int namedSize; @@ -171,7 +171,7 @@ if(infoOk!=0) { pcre_free(pcreRE); - return getSys()->getNullRef(); + return getSystemState()->getNullRef(); } struct nameEntry { @@ -184,7 +184,7 @@ { pcre_free(pcreRE); lastIndex=0; - return getSys()->getNullRef(); + return getSystemState()->getNullRef(); } pcre_extra extra; extra.match_limit_recursion=200; @@ -196,24 +196,24 @@ { //No matches or error pcre_free(pcreRE); - return getSys()->getNullRef(); + return getSystemState()->getNullRef(); } - Array* a=Class<Array>::getInstanceS(); + Array* a=Class<Array>::getInstanceS(getSystemState()); //Push the whole result and the captured strings for(int i=0;i<capturingGroups+1;i++) { if(ovector[i*2] >= 0) - a->push(_MR(Class<ASString>::getInstanceS( str.substr_bytes(ovector[i*2],ovector[i*2+1]-ovector[i*2]) ))); + a->push(_MR(abstract_s(getSystemState(), str.substr_bytes(ovector[i*2],ovector[i*2+1]-ovector[i*2]) ))); else - a->push(_MR(getSys()->getUndefinedRef())); + a->push(_MR(getSystemState()->getUndefinedRef())); } - a->setVariableByQName("input","",Class<ASString>::getInstanceS(str),DYNAMIC_TRAIT); + a->setVariableByQName("input","",abstract_s(getSystemState(),str),DYNAMIC_TRAIT); // pcre_exec returns byte position, so we have to convert it to character position tiny_string tmp = str.substr_bytes(0, ovector[0]); int index = tmp.numChars(); - a->setVariableByQName("index","",abstract_i(index),DYNAMIC_TRAIT); + a->setVariableByQName("index","",abstract_i(getSystemState(),index),DYNAMIC_TRAIT); for(int i=0;i<namedGroups;i++) { nameEntry* entry=reinterpret_cast<nameEntry*>(entries); @@ -231,20 +231,20 @@ ASFUNCTIONBODY(RegExp,test) { if (!obj->is<RegExp>()) - return abstract_b(true); + return abstract_b(obj->getSystemState(),true); RegExp* th=static_cast<RegExp*>(obj); const tiny_string& arg0 = args[0]->toString(); pcre* pcreRE = th->compile(); if (!pcreRE) - return getSys()->getNullRef(); + return obj->getSystemState()->getNullRef(); int capturingGroups; int infoOk=pcre_fullinfo(pcreRE, NULL, PCRE_INFO_CAPTURECOUNT, &capturingGroups); if(infoOk!=0) { pcre_free(pcreRE); - return getSys()->getNullRef(); + return obj->getSystemState()->getNullRef(); } int ovector[(capturingGroups+1)*3]; @@ -256,15 +256,15 @@ bool ret = (rc >= 0); pcre_free(pcreRE); - return abstract_b(ret); + return abstract_b(obj->getSystemState(),ret); } ASFUNCTIONBODY(RegExp,_toString) { - if(Class<RegExp>::getClass()->prototype->getObj() == obj) - return Class<ASString>::getInstanceS("/(?:)/"); + if(Class<RegExp>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_s(obj->getSystemState(),"/(?:)/"); if(!obj->is<RegExp>()) - throw Class<TypeError>::getInstanceS("RegExp.toString is not generic"); + throw Class<TypeError>::getInstanceS(obj->getSystemState(),"RegExp.toString is not generic"); RegExp* th=static_cast<RegExp*>(obj); tiny_string ret; @@ -279,7 +279,7 @@ ret += "m"; if(th->dotall) ret += "s"; - return Class<ASString>::getInstanceS(ret); + return abstract_s(obj->getSystemState(),ret); } pcre* RegExp::compile()
View file
lightspark.tar.xz/src/scripting/toplevel/UInteger.cpp
Changed
@@ -101,43 +101,43 @@ ASFUNCTIONBODY(UInteger,generator) { if (argslen == 0) - return abstract_ui(0); - return abstract_ui(args[0]->toUInt()); + return abstract_ui(getSys(),0); + return abstract_ui(args[0]->getSystemState(),args[0]->toUInt()); } ASFUNCTIONBODY(UInteger,_valueOf) { - if(Class<UInteger>::getClass()->prototype->getObj() == obj) - return abstract_ui(0); + if(Class<UInteger>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_ui(obj->getSystemState(),0); if(!obj->is<UInteger>()) - throw Class<TypeError>::getInstanceS(""); + throw Class<TypeError>::getInstanceS(obj->getSystemState(),""); - return abstract_ui(obj->as<UInteger>()->val); + return abstract_ui(obj->getSystemState(),obj->as<UInteger>()->val); } void UInteger::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); c->isReusable = true; - c->setVariableByQName("MAX_VALUE","",abstract_ui(0xFFFFFFFF),CONSTANT_TRAIT); - c->setVariableByQName("MIN_VALUE","",abstract_ui(0),CONSTANT_TRAIT); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(_toFixed,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(_toExponential,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(_toPrecision,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(_valueOf),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(_toExponential, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(_toFixed, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(_toPrecision, 1),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(_valueOf),DYNAMIC_TRAIT); + c->setVariableByQName("MAX_VALUE","",abstract_ui(c->getSystemState(),0xFFFFFFFF),CONSTANT_TRAIT); + c->setVariableByQName("MIN_VALUE","",abstract_ui(c->getSystemState(),0),CONSTANT_TRAIT); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toFixed",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toFixed,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toExponential",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toExponential,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toPrecision",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toPrecision,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),_valueOf),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toExponential","",Class<IFunction>::getFunction(c->getSystemState(),_toExponential, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toFixed","",Class<IFunction>::getFunction(c->getSystemState(),_toFixed, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toPrecision","",Class<IFunction>::getFunction(c->getSystemState(),_toPrecision, 1),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),_valueOf),DYNAMIC_TRAIT); } ASFUNCTIONBODY(UInteger,_toString) { - if(Class<UInteger>::getClass()->prototype->getObj() == obj) - return abstract_s("0"); + if(Class<UInteger>::getClass(obj->getSystemState())->prototype->getObj() == obj) + return abstract_s(obj->getSystemState(),"0"); UInteger* th=static_cast<UInteger*>(obj); uint32_t radix; @@ -147,12 +147,12 @@ { char buf[20]; snprintf(buf,20,"%u",th->val); - return abstract_s(buf); + return abstract_s(obj->getSystemState(),buf); } else { tiny_string s=Number::toStringRadix((number_t)th->val, radix); - return abstract_s(s); + return abstract_s(obj->getSystemState(),s); } } @@ -187,7 +187,7 @@ else fractionDigits = imin(imax((int32_t)ceil(::log10(v)), 1), 20); } - return abstract_s(Number::toExponentialString(v, fractionDigits)); + return abstract_s(obj->getSystemState(),Number::toExponentialString(v, fractionDigits)); } ASFUNCTIONBODY(UInteger,_toFixed) @@ -195,17 +195,17 @@ UInteger *th=obj->as<UInteger>(); int fractiondigits; ARG_UNPACK (fractiondigits, 0); - return abstract_s(Number::toFixedString(th->val, fractiondigits)); + return abstract_s(obj->getSystemState(),Number::toFixedString(th->val, fractiondigits)); } ASFUNCTIONBODY(UInteger,_toPrecision) { UInteger *th=obj->as<UInteger>(); if (argslen == 0 || args[0]->is<Undefined>()) - return abstract_s(th->toString()); + return abstract_s(obj->getSystemState(),th->toString()); int precision; ARG_UNPACK (precision); - return abstract_s(Number::toPrecisionString(th->val, precision)); + return abstract_s(obj->getSystemState(),Number::toPrecisionString(th->val, precision)); } void UInteger::serialize(ByteArray* out, std::map<tiny_string, uint32_t>& stringMap,
View file
lightspark.tar.xz/src/scripting/toplevel/UInteger.h
Changed
@@ -35,15 +35,10 @@ static void sinit(Class_base* c); tiny_string toString(); static tiny_string toString(uint32_t val); - void finalize() { val=0;} - int32_t toInt() - { - return val; - } - uint32_t toUInt() - { - return val; - } + inline number_t toNumber() { return val; } + inline void finalize() { val=0; } + inline int32_t toInt() { return val; } + inline uint32_t toUInt() { return val; } TRISTATE isLess(ASObject* r); bool isEqual(ASObject* o); ASFUNCTION(_constructor);
View file
lightspark.tar.xz/src/scripting/toplevel/Vector.cpp
Changed
@@ -29,69 +29,69 @@ void Vector::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(getLength),GETTER_METHOD,true); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(setLength),SETTER_METHOD,true); - c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("fixed","",Class<IFunction>::getFunction(getFixed),GETTER_METHOD,true); - c->setDeclaredMethodByQName("fixed","",Class<IFunction>::getFunction(setFixed),SETTER_METHOD,true); - c->setDeclaredMethodByQName("concat","",Class<IFunction>::getFunction(_concat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("concat",AS3,Class<IFunction>::getFunction(_concat),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("every","",Class<IFunction>::getFunction(every),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("every",AS3,Class<IFunction>::getFunction(every),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("filter","",Class<IFunction>::getFunction(filter),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("filter",AS3,Class<IFunction>::getFunction(filter),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("forEach","",Class<IFunction>::getFunction(forEach),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("forEach",AS3,Class<IFunction>::getFunction(forEach),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("indexOf","",Class<IFunction>::getFunction(indexOf),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("indexOf",AS3,Class<IFunction>::getFunction(indexOf),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lastIndexOf","",Class<IFunction>::getFunction(lastIndexOf),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(lastIndexOf),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("join","",Class<IFunction>::getFunction(join),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("join",AS3,Class<IFunction>::getFunction(join),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("map","",Class<IFunction>::getFunction(_map),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("map",AS3,Class<IFunction>::getFunction(_map),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("pop","",Class<IFunction>::getFunction(_pop),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("pop",AS3,Class<IFunction>::getFunction(_pop),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("push","",Class<IFunction>::getFunction(push),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("push",AS3,Class<IFunction>::getFunction(push),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("reverse","",Class<IFunction>::getFunction(_reverse),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("reverse",AS3,Class<IFunction>::getFunction(_reverse),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("shift","",Class<IFunction>::getFunction(shift),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("shift",AS3,Class<IFunction>::getFunction(shift),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("slice","",Class<IFunction>::getFunction(slice),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("slice",AS3,Class<IFunction>::getFunction(slice),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("some","",Class<IFunction>::getFunction(some),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("some",AS3,Class<IFunction>::getFunction(some),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("sort","",Class<IFunction>::getFunction(_sort),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("sort",AS3,Class<IFunction>::getFunction(_sort),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("splice","",Class<IFunction>::getFunction(splice),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("splice",AS3,Class<IFunction>::getFunction(splice),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toLocaleString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toLocaleString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("unshift","",Class<IFunction>::getFunction(unshift),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("unshift",AS3,Class<IFunction>::getFunction(unshift),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),getLength),GETTER_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),setLength),SETTER_METHOD,true); + c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("fixed","",Class<IFunction>::getFunction(c->getSystemState(),getFixed),GETTER_METHOD,true); + c->setDeclaredMethodByQName("fixed","",Class<IFunction>::getFunction(c->getSystemState(),setFixed),SETTER_METHOD,true); + c->setDeclaredMethodByQName("concat","",Class<IFunction>::getFunction(c->getSystemState(),_concat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("concat",AS3,Class<IFunction>::getFunction(c->getSystemState(),_concat),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("every","",Class<IFunction>::getFunction(c->getSystemState(),every),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("every",AS3,Class<IFunction>::getFunction(c->getSystemState(),every),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("filter","",Class<IFunction>::getFunction(c->getSystemState(),filter),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("filter",AS3,Class<IFunction>::getFunction(c->getSystemState(),filter),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("forEach","",Class<IFunction>::getFunction(c->getSystemState(),forEach),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("forEach",AS3,Class<IFunction>::getFunction(c->getSystemState(),forEach),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("indexOf","",Class<IFunction>::getFunction(c->getSystemState(),indexOf),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("indexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),indexOf),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lastIndexOf","",Class<IFunction>::getFunction(c->getSystemState(),lastIndexOf),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),lastIndexOf),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("join","",Class<IFunction>::getFunction(c->getSystemState(),join),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("join",AS3,Class<IFunction>::getFunction(c->getSystemState(),join),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("map","",Class<IFunction>::getFunction(c->getSystemState(),_map),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("map",AS3,Class<IFunction>::getFunction(c->getSystemState(),_map),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("pop","",Class<IFunction>::getFunction(c->getSystemState(),_pop),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("pop",AS3,Class<IFunction>::getFunction(c->getSystemState(),_pop),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("push","",Class<IFunction>::getFunction(c->getSystemState(),push),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("push",AS3,Class<IFunction>::getFunction(c->getSystemState(),push),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("reverse","",Class<IFunction>::getFunction(c->getSystemState(),_reverse),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("reverse",AS3,Class<IFunction>::getFunction(c->getSystemState(),_reverse),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("shift","",Class<IFunction>::getFunction(c->getSystemState(),shift),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("shift",AS3,Class<IFunction>::getFunction(c->getSystemState(),shift),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("slice","",Class<IFunction>::getFunction(c->getSystemState(),slice),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("slice",AS3,Class<IFunction>::getFunction(c->getSystemState(),slice),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("some","",Class<IFunction>::getFunction(c->getSystemState(),some),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("some",AS3,Class<IFunction>::getFunction(c->getSystemState(),some),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("sort","",Class<IFunction>::getFunction(c->getSystemState(),_sort),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("sort",AS3,Class<IFunction>::getFunction(c->getSystemState(),_sort),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("splice","",Class<IFunction>::getFunction(c->getSystemState(),splice),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("splice",AS3,Class<IFunction>::getFunction(c->getSystemState(),splice),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLocaleString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toLocaleString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("unshift","",Class<IFunction>::getFunction(c->getSystemState(),unshift),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("unshift",AS3,Class<IFunction>::getFunction(c->getSystemState(),unshift),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString",AS3,Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("concat",AS3,Class<IFunction>::getFunction(_concat),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("every",AS3,Class<IFunction>::getFunction(every),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("filter",AS3,Class<IFunction>::getFunction(filter),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("forEach",AS3,Class<IFunction>::getFunction(forEach),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("indexOf",AS3,Class<IFunction>::getFunction(indexOf),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(lastIndexOf),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("join",AS3,Class<IFunction>::getFunction(join),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("map",AS3,Class<IFunction>::getFunction(_map),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("pop",AS3,Class<IFunction>::getFunction(_pop),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("push",AS3,Class<IFunction>::getFunction(push),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("reverse",AS3,Class<IFunction>::getFunction(_reverse),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("shift",AS3,Class<IFunction>::getFunction(shift),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("slice",AS3,Class<IFunction>::getFunction(slice),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("some",AS3,Class<IFunction>::getFunction(some),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("sort",AS3,Class<IFunction>::getFunction(_sort),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("splice",AS3,Class<IFunction>::getFunction(splice),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("toLocaleString",AS3,Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("unshift",AS3,Class<IFunction>::getFunction(unshift),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("concat",AS3,Class<IFunction>::getFunction(c->getSystemState(),_concat),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("every",AS3,Class<IFunction>::getFunction(c->getSystemState(),every),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("filter",AS3,Class<IFunction>::getFunction(c->getSystemState(),filter),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("forEach",AS3,Class<IFunction>::getFunction(c->getSystemState(),forEach),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("indexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),indexOf),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("lastIndexOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),lastIndexOf),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("join",AS3,Class<IFunction>::getFunction(c->getSystemState(),join),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("map",AS3,Class<IFunction>::getFunction(c->getSystemState(),_map),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("pop",AS3,Class<IFunction>::getFunction(c->getSystemState(),_pop),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("push",AS3,Class<IFunction>::getFunction(c->getSystemState(),push),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("reverse",AS3,Class<IFunction>::getFunction(c->getSystemState(),_reverse),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("shift",AS3,Class<IFunction>::getFunction(c->getSystemState(),shift),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("slice",AS3,Class<IFunction>::getFunction(c->getSystemState(),slice),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("some",AS3,Class<IFunction>::getFunction(c->getSystemState(),some),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("sort",AS3,Class<IFunction>::getFunction(c->getSystemState(),_sort),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("splice",AS3,Class<IFunction>::getFunction(c->getSystemState(),splice),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLocaleString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("unshift",AS3,Class<IFunction>::getFunction(c->getSystemState(),unshift),DYNAMIC_TRAIT); } Vector::Vector(Class_base* c, const Type *vtype):ASObject(c),vec_type(vtype),fixed(false),vec(reporter_allocator<ASObject*>(c->memoryAccount)) @@ -134,7 +134,7 @@ const Type* type = o_class->getTypes()[0]; - if(args[0]->getClass() == Class<Array>::getClass()) + if(args[0]->getClass() == Class<Array>::getClass(args[0]->getSystemState())) { //create object without calling _constructor Vector* ret = o_class->getInstance(false,NULL,0); @@ -149,7 +149,7 @@ } return ret; } - else if(args[0]->getClass()->getTemplate() == Template<Vector>::getTemplate()) + else if(args[0]->getClass()->getTemplate() == Template<Vector>::getTemplate(args[0]->getSystemState())) { Vector* arg = static_cast<Vector*>(args[0]); @@ -252,13 +252,13 @@ continue; params[0] = th->vec[i]; th->vec[i]->incRef(); - params[1] = abstract_i(i); + params[1] = abstract_i(obj->getSystemState(),i); params[2] = th; th->incRef(); if(argslen==1) { - funcRet=f->call(getSys()->getNullRef(), params, 3); + funcRet=f->call(obj->getSystemState()->getNullRef(), params, 3); } else { @@ -295,13 +295,13 @@ continue; params[0] = th->vec[i]; th->vec[i]->incRef(); - params[1] = abstract_i(i); + params[1] = abstract_i(obj->getSystemState(),i); params[2] = th; th->incRef(); if(argslen==1) { - funcRet=f->call(getSys()->getNullRef(), params, 3); + funcRet=f->call(obj->getSystemState()->getNullRef(), params, 3); } else { @@ -317,7 +317,7 @@ funcRet->decRef(); } } - return abstract_b(false); + return abstract_b(obj->getSystemState(),false); } ASFUNCTIONBODY(Vector, every) @@ -339,14 +339,14 @@ th->vec[i]->incRef(); } else - params[0] = getSys()->getNullRef(); - params[1] = abstract_i(i); + params[0] = obj->getSystemState()->getNullRef(); + params[1] = abstract_i(obj->getSystemState(),i); params[2] = th; th->incRef();
View file
lightspark.tar.xz/src/scripting/toplevel/Vector.h
Changed
@@ -67,7 +67,7 @@ void setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst); bool hasPropertyByMultiname(const multiname& name, bool considerDynamic, bool considerPrototype); _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt); - static bool isValidMultiname(const multiname& name, uint32_t& index); + static bool isValidMultiname(SystemState* sys,const multiname& name, uint32_t& index); tiny_string toJSON(std::vector<ASObject *> &path, IFunction *replacer, const tiny_string &spaces,const tiny_string& filter);
View file
lightspark.tar.xz/src/scripting/toplevel/XML.cpp
Changed
@@ -87,73 +87,75 @@ setDefaultXMLSettings(); c->isReusable=true; - c->setDeclaredMethodByQName("ignoreComments","",Class<IFunction>::getFunction(_getIgnoreComments),GETTER_METHOD,false); - c->setDeclaredMethodByQName("ignoreComments","",Class<IFunction>::getFunction(_setIgnoreComments),SETTER_METHOD,false); - c->setDeclaredMethodByQName("ignoreProcessingInstructions","",Class<IFunction>::getFunction(_getIgnoreProcessingInstructions),GETTER_METHOD,false); - c->setDeclaredMethodByQName("ignoreProcessingInstructions","",Class<IFunction>::getFunction(_setIgnoreProcessingInstructions),SETTER_METHOD,false); - c->setDeclaredMethodByQName("ignoreWhitespace","",Class<IFunction>::getFunction(_getIgnoreWhitespace),GETTER_METHOD,false); - c->setDeclaredMethodByQName("ignoreWhitespace","",Class<IFunction>::getFunction(_setIgnoreWhitespace),SETTER_METHOD,false); - c->setDeclaredMethodByQName("prettyIndent","",Class<IFunction>::getFunction(_getPrettyIndent),GETTER_METHOD,false); - c->setDeclaredMethodByQName("prettyIndent","",Class<IFunction>::getFunction(_setPrettyIndent),SETTER_METHOD,false); - c->setDeclaredMethodByQName("prettyPrinting","",Class<IFunction>::getFunction(_getPrettyPrinting),GETTER_METHOD,false); - c->setDeclaredMethodByQName("prettyPrinting","",Class<IFunction>::getFunction(_setPrettyPrinting),SETTER_METHOD,false); - c->setDeclaredMethodByQName("settings","",Class<IFunction>::getFunction(_getSettings),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("setSettings","",Class<IFunction>::getFunction(_setSettings),NORMAL_METHOD,false); - c->setDeclaredMethodByQName("defaultSettings","",Class<IFunction>::getFunction(_getDefaultSettings),NORMAL_METHOD,false); - - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - 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->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); - c->setDeclaredMethodByQName("contains",AS3,Class<IFunction>::getFunction(contains),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("attribute",AS3,Class<IFunction>::getFunction(attribute),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("attributes",AS3,Class<IFunction>::getFunction(attributes),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("length",AS3,Class<IFunction>::getFunction(length),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("localName",AS3,Class<IFunction>::getFunction(localName),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("name",AS3,Class<IFunction>::getFunction(name),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("namespace",AS3,Class<IFunction>::getFunction(_namespace),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("normalize",AS3,Class<IFunction>::getFunction(_normalize),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("descendants",AS3,Class<IFunction>::getFunction(descendants),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("appendChild",AS3,Class<IFunction>::getFunction(_appendChild),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("parent",AS3,Class<IFunction>::getFunction(parent),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("inScopeNamespaces",AS3,Class<IFunction>::getFunction(inScopeNamespaces),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("addNamespace",AS3,Class<IFunction>::getFunction(addNamespace),NORMAL_METHOD,true); - c->prototype->setVariableByQName("hasSimpleContent",AS3,Class<IFunction>::getFunction(_hasSimpleContent),DYNAMIC_TRAIT); - c->prototype->setVariableByQName("hasComplexContent",AS3,Class<IFunction>::getFunction(_hasComplexContent),DYNAMIC_TRAIT); - c->setDeclaredMethodByQName("text",AS3,Class<IFunction>::getFunction(text),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("elements",AS3,Class<IFunction>::getFunction(elements),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setLocalName",AS3,Class<IFunction>::getFunction(_setLocalName),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setName",AS3,Class<IFunction>::getFunction(_setName),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("setNamespace",AS3,Class<IFunction>::getFunction(_setNamespace),NORMAL_METHOD,true); - c->prototype->setVariableByQName("copy",AS3,Class<IFunction>::getFunction(_copy),DYNAMIC_TRAIT); - c->setDeclaredMethodByQName("setChildren",AS3,Class<IFunction>::getFunction(_setChildren),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("toJSON",AS3,Class<IFunction>::getFunction(_toJSON),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("insertChildAfter",AS3,Class<IFunction>::getFunction(insertChildAfter),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("insertChildBefore",AS3,Class<IFunction>::getFunction(insertChildBefore),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("namespaceDeclarations",AS3,Class<IFunction>::getFunction(namespaceDeclarations),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("removeNamespace",AS3,Class<IFunction>::getFunction(removeNamespace),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("comments",AS3,Class<IFunction>::getFunction(comments),NORMAL_METHOD,true); - 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); - c->setDeclaredMethodByQName("replace",AS3,Class<IFunction>::getFunction(_replace),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("ignoreComments","",Class<IFunction>::getFunction(c->getSystemState(),_getIgnoreComments),GETTER_METHOD,false); + c->setDeclaredMethodByQName("ignoreComments","",Class<IFunction>::getFunction(c->getSystemState(),_setIgnoreComments),SETTER_METHOD,false); + c->setDeclaredMethodByQName("ignoreProcessingInstructions","",Class<IFunction>::getFunction(c->getSystemState(),_getIgnoreProcessingInstructions),GETTER_METHOD,false); + c->setDeclaredMethodByQName("ignoreProcessingInstructions","",Class<IFunction>::getFunction(c->getSystemState(),_setIgnoreProcessingInstructions),SETTER_METHOD,false); + c->setDeclaredMethodByQName("ignoreWhitespace","",Class<IFunction>::getFunction(c->getSystemState(),_getIgnoreWhitespace),GETTER_METHOD,false); + c->setDeclaredMethodByQName("ignoreWhitespace","",Class<IFunction>::getFunction(c->getSystemState(),_setIgnoreWhitespace),SETTER_METHOD,false); + c->setDeclaredMethodByQName("prettyIndent","",Class<IFunction>::getFunction(c->getSystemState(),_getPrettyIndent),GETTER_METHOD,false); + c->setDeclaredMethodByQName("prettyIndent","",Class<IFunction>::getFunction(c->getSystemState(),_setPrettyIndent),SETTER_METHOD,false); + c->setDeclaredMethodByQName("prettyPrinting","",Class<IFunction>::getFunction(c->getSystemState(),_getPrettyPrinting),GETTER_METHOD,false); + c->setDeclaredMethodByQName("prettyPrinting","",Class<IFunction>::getFunction(c->getSystemState(),_setPrettyPrinting),SETTER_METHOD,false); + c->setDeclaredMethodByQName("settings","",Class<IFunction>::getFunction(c->getSystemState(),_getSettings),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("setSettings","",Class<IFunction>::getFunction(c->getSystemState(),_setSettings),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("defaultSettings","",Class<IFunction>::getFunction(c->getSystemState(),_getDefaultSettings),NORMAL_METHOD,false); + + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),valueOf),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),valueOf),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toXMLString",AS3,Class<IFunction>::getFunction(c->getSystemState(),toXMLString),NORMAL_METHOD,true); + c->prototype->setVariableByQName("nodeKind","",Class<IFunction>::getFunction(c->getSystemState(),nodeKind),DYNAMIC_TRAIT); c->setDeclaredMethodByQName("nodeKind",AS3,Class<IFunction>::getFunction(c->getSystemState(),nodeKind),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("child",AS3,Class<IFunction>::getFunction(c->getSystemState(),child),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("children",AS3,Class<IFunction>::getFunction(c->getSystemState(),children),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("childIndex",AS3,Class<IFunction>::getFunction(c->getSystemState(),childIndex),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("contains",AS3,Class<IFunction>::getFunction(c->getSystemState(),contains),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("attribute",AS3,Class<IFunction>::getFunction(c->getSystemState(),attribute),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("attributes",AS3,Class<IFunction>::getFunction(c->getSystemState(),attributes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("length",AS3,Class<IFunction>::getFunction(c->getSystemState(),length),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("localName",AS3,Class<IFunction>::getFunction(c->getSystemState(),localName),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("name",AS3,Class<IFunction>::getFunction(c->getSystemState(),name),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("namespace",AS3,Class<IFunction>::getFunction(c->getSystemState(),_namespace),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("normalize",AS3,Class<IFunction>::getFunction(c->getSystemState(),_normalize),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("descendants",AS3,Class<IFunction>::getFunction(c->getSystemState(),descendants),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("appendChild",AS3,Class<IFunction>::getFunction(c->getSystemState(),_appendChild),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("parent",AS3,Class<IFunction>::getFunction(c->getSystemState(),parent),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("inScopeNamespaces",AS3,Class<IFunction>::getFunction(c->getSystemState(),inScopeNamespaces),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("addNamespace",AS3,Class<IFunction>::getFunction(c->getSystemState(),addNamespace),NORMAL_METHOD,true); + c->prototype->setVariableByQName("hasSimpleContent",AS3,Class<IFunction>::getFunction(c->getSystemState(),_hasSimpleContent),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("hasComplexContent",AS3,Class<IFunction>::getFunction(c->getSystemState(),_hasComplexContent),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("text",AS3,Class<IFunction>::getFunction(c->getSystemState(),text),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("elements",AS3,Class<IFunction>::getFunction(c->getSystemState(),elements),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setLocalName",AS3,Class<IFunction>::getFunction(c->getSystemState(),_setLocalName),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setName",AS3,Class<IFunction>::getFunction(c->getSystemState(),_setName),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("setNamespace",AS3,Class<IFunction>::getFunction(c->getSystemState(),_setNamespace),NORMAL_METHOD,true); + c->prototype->setVariableByQName("copy",AS3,Class<IFunction>::getFunction(c->getSystemState(),_copy),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("setChildren",AS3,Class<IFunction>::getFunction(c->getSystemState(),_setChildren),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toJSON",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toJSON),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("insertChildAfter",AS3,Class<IFunction>::getFunction(c->getSystemState(),insertChildAfter),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("insertChildBefore",AS3,Class<IFunction>::getFunction(c->getSystemState(),insertChildBefore),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("namespaceDeclarations",AS3,Class<IFunction>::getFunction(c->getSystemState(),namespaceDeclarations),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("removeNamespace",AS3,Class<IFunction>::getFunction(c->getSystemState(),removeNamespace),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("comments",AS3,Class<IFunction>::getFunction(c->getSystemState(),comments),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("processingInstructions",AS3,Class<IFunction>::getFunction(c->getSystemState(),processingInstructions),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("propertyIsEnumerable",AS3,Class<IFunction>::getFunction(c->getSystemState(),_propertyIsEnumerable),NORMAL_METHOD,true); + c->prototype->setVariableByQName("hasOwnProperty",AS3,Class<IFunction>::getFunction(c->getSystemState(),_hasOwnProperty),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("prependChild",AS3,Class<IFunction>::getFunction(c->getSystemState(),_prependChild),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("replace",AS3,Class<IFunction>::getFunction(c->getSystemState(),_replace),NORMAL_METHOD,true); } ASFUNCTIONBODY(XML,generator) { assert(obj==NULL); assert_and_throw(argslen<=1); - if (argslen == 0 || - args[0]->is<Null>() || - args[0]->is<Undefined>()) + if (argslen == 0) + { + return Class<XML>::getInstanceSNoArgs(getSys()); + } + else if (args[0]->is<Null>() || args[0]->is<Undefined>()) { - return Class<XML>::getInstanceSNoArgs(); + return Class<XML>::getInstanceSNoArgs(args[0]->getSystemState()); } else if(args[0]->is<ASString>() || args[0]->is<Number>() || @@ -161,7 +163,7 @@ args[0]->is<UInteger>() || args[0]->is<Boolean>()) { - return createFromString(args[0]->toString()); + return createFromString(args[0]->getSystemState(),args[0]->toString()); } else if(args[0]->is<XML>()) { @@ -180,7 +182,7 @@ } else { - return createFromString(args[0]->toString()); + return createFromString(args[0]->getSystemState(),args[0]->toString()); } } @@ -197,7 +199,7 @@ { th->createTree(th->buildFromString("", getParseMode()),false); } - else if(args[0]->getClass()->isSubClass(Class<ByteArray>::getClass())) + else if(args[0]->getClass()->isSubClass(Class<ByteArray>::getClass(obj->getSystemState()))) { //Official documentation says that generic Objects are not supported. //ByteArray seems to be though (see XML test) so let's support it @@ -205,7 +207,7 @@ uint32_t len=ba->getLength(); const uint8_t* str=ba->getBuffer(len, false); th->createTree(th->buildFromString(std::string((const char*)str,len), getParseMode(), - getVm()->getDefaultXMLNamespace()),false); + getVm(obj->getSystemState())->getDefaultXMLNamespace()),false); } else if(args[0]->is<ASString>() || args[0]->is<Number>() || @@ -216,12 +218,12 @@ //By specs, XML constructor will only convert to string Numbers or Booleans //ints are not explicitly mentioned, but they seem to work th->createTree(th->buildFromString(args[0]->toString(), getParseMode(), - getVm()->getDefaultXMLNamespace()),false); + getVm(obj->getSystemState())->getDefaultXMLNamespace()),false); } else if(args[0]->is<XML>()) { th->createTree(th->buildFromString(args[0]->as<XML>()->toXMLString_internal(), getParseMode(), - getVm()->getDefaultXMLNamespace()),false); + getVm(obj->getSystemState())->getDefaultXMLNamespace()),false); } else if(args[0]->is<XMLList>()) { @@ -232,7 +234,7 @@ else { th->createTree(th->buildFromString(args[0]->toString(), getParseMode(), - getVm()->getDefaultXMLNamespace()),false); + getVm(obj->getSystemState())->getDefaultXMLNamespace()),false); } return NULL; @@ -242,7 +244,7 @@ { XML* th=Class<XML>::cast(obj); assert_and_throw(argslen==0);
View file
lightspark.tar.xz/src/scripting/toplevel/XML.h
Changed
@@ -143,7 +143,7 @@ static bool getPrettyPrinting(); static unsigned int getParseMode(); - static XML* createFromString(const tiny_string& s); + static XML* createFromString(SystemState *sys, const tiny_string& s); static XML* createFromNode(const pugi::xml_node& _n, XML* parent=NULL, bool fromXMLList=false); const tiny_string getName() const { return nodename;} @@ -157,7 +157,7 @@ bool hasPropertyByMultiname(const multiname& name, bool considerDynamic, bool considerPrototype); void setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst); bool deleteVariableByMultiname(const multiname& name); - static bool isValidMultiname(const multiname& name, uint32_t& index); + static bool isValidMultiname(SystemState *sys, const multiname& name, uint32_t& index); void setTextContent(const tiny_string& content); tiny_string toString();
View file
lightspark.tar.xz/src/scripting/toplevel/XMLList.cpp
Changed
@@ -30,17 +30,17 @@ * object, if no method with the same name has been defined for * XMLList. */ #define REGISTER_XML_DELEGATE(name) \ - c->setDeclaredMethodByQName(#name,AS3,Class<IFunction>::getFunction(name),NORMAL_METHOD,true) + c->setDeclaredMethodByQName(#name,AS3,Class<IFunction>::getFunction(c->getSystemState(),name),NORMAL_METHOD,true) #define REGISTER_XML_DELEGATE2(asname,cppname) \ - c->setDeclaredMethodByQName(#asname,AS3,Class<IFunction>::getFunction(cppname),NORMAL_METHOD,true) + c->setDeclaredMethodByQName(#asname,AS3,Class<IFunction>::getFunction(c->getSystemState(),cppname),NORMAL_METHOD,true) #define ASFUNCTIONBODY_XML_DELEGATE(name) \ ASObject* XMLList::name(ASObject* obj, ASObject* const* args, const unsigned int argslen) \ { \ XMLList* th=obj->as<XMLList>(); \ if(!th) \ - throw Class<ArgumentError>::getInstanceS("Function applied to wrong object"); \ + throw Class<ArgumentError>::getInstanceS(obj->getSystemState(),"Function applied to wrong object"); \ if(th->nodes.size()==1) \ return XML::name(th->nodes[0].getPtr(), args, argslen); \ else \ @@ -94,28 +94,28 @@ { CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL); c->isReusable=true; - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_getLength),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("attribute",AS3,Class<IFunction>::getFunction(attribute),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("attributes",AS3,Class<IFunction>::getFunction(attributes),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("contains",AS3,Class<IFunction>::getFunction(contains),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("copy",AS3,Class<IFunction>::getFunction(copy),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("descendants",AS3,Class<IFunction>::getFunction(descendants),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("elements",AS3,Class<IFunction>::getFunction(elements),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("normalize",AS3,Class<IFunction>::getFunction(_normalize),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("parent",AS3,Class<IFunction>::getFunction(parent),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("hasSimpleContent",AS3,Class<IFunction>::getFunction(_hasSimpleContent),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("hasComplexContent",AS3,Class<IFunction>::getFunction(_hasComplexContent),NORMAL_METHOD,true); - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); - c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); - 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("text",AS3,Class<IFunction>::getFunction(text),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("comments",AS3,Class<IFunction>::getFunction(comments),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("processingInstructions",AS3,Class<IFunction>::getFunction(processingInstructions),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("propertyIsEnumerable",AS3,Class<IFunction>::getFunction(_propertyIsEnumerable),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),_getLength),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("attribute",AS3,Class<IFunction>::getFunction(c->getSystemState(),attribute),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("attributes",AS3,Class<IFunction>::getFunction(c->getSystemState(),attributes),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("child",AS3,Class<IFunction>::getFunction(c->getSystemState(),child),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("children",AS3,Class<IFunction>::getFunction(c->getSystemState(),children),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("contains",AS3,Class<IFunction>::getFunction(c->getSystemState(),contains),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("copy",AS3,Class<IFunction>::getFunction(c->getSystemState(),copy),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("descendants",AS3,Class<IFunction>::getFunction(c->getSystemState(),descendants),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("elements",AS3,Class<IFunction>::getFunction(c->getSystemState(),elements),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("normalize",AS3,Class<IFunction>::getFunction(c->getSystemState(),_normalize),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("parent",AS3,Class<IFunction>::getFunction(c->getSystemState(),parent),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("hasSimpleContent",AS3,Class<IFunction>::getFunction(c->getSystemState(),_hasSimpleContent),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("hasComplexContent",AS3,Class<IFunction>::getFunction(c->getSystemState(),_hasComplexContent),NORMAL_METHOD,true); + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),_toString),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(c->getSystemState(),_toString),NORMAL_METHOD,true); + c->prototype->setVariableByQName("valueOf","",Class<IFunction>::getFunction(c->getSystemState(),valueOf),DYNAMIC_TRAIT); + c->setDeclaredMethodByQName("valueOf",AS3,Class<IFunction>::getFunction(c->getSystemState(),valueOf),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("toXMLString",AS3,Class<IFunction>::getFunction(c->getSystemState(),toXMLString),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("text",AS3,Class<IFunction>::getFunction(c->getSystemState(),text),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("comments",AS3,Class<IFunction>::getFunction(c->getSystemState(),comments),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("processingInstructions",AS3,Class<IFunction>::getFunction(c->getSystemState(),processingInstructions),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("propertyIsEnumerable",AS3,Class<IFunction>::getFunction(c->getSystemState(),_propertyIsEnumerable),NORMAL_METHOD,true); REGISTER_XML_DELEGATE(addNamespace); REGISTER_XML_DELEGATE2(appendChild,_appendChild); REGISTER_XML_DELEGATE(childIndex); @@ -292,21 +292,21 @@ { XMLList* th=Class<XMLList>::cast(obj); assert_and_throw(argslen==0); - return abstract_i(th->nodes.size()); + return abstract_i(obj->getSystemState(),th->nodes.size()); } ASFUNCTIONBODY(XMLList,_hasSimpleContent) { XMLList* th=Class<XMLList>::cast(obj); assert_and_throw(argslen==0); - return abstract_b(th->hasSimpleContent()); + return abstract_b(obj->getSystemState(),th->hasSimpleContent()); } ASFUNCTIONBODY(XMLList,_hasComplexContent) { XMLList* th=Class<XMLList>::cast(obj); assert_and_throw(argslen==0); - return abstract_b(th->hasComplexContent()); + return abstract_b(obj->getSystemState(),th->hasComplexContent()); } ASFUNCTIONBODY(XMLList,generator) @@ -314,7 +314,7 @@ assert(obj==NULL); if(argslen==0) { - return Class<XMLList>::getInstanceSNoArgs(); + return Class<XMLList>::getInstanceSNoArgs(getSys()); } else if(args[0]->is<ASString>() || args[0]->is<Number>() || @@ -322,7 +322,7 @@ args[0]->is<UInteger>() || args[0]->is<Boolean>()) { - return Class<XMLList>::getInstanceS(args[0]->toString()); + return Class<XMLList>::getInstanceS(args[0]->getSystemState(),args[0]->toString()); } else if(args[0]->is<XMLList>()) { @@ -334,12 +334,12 @@ XML::XMLVector nodes; args[0]->incRef(); nodes.push_back(_MR(Class<XML>::cast(args[0]))); - return Class<XMLList>::getInstanceS(nodes); + return Class<XMLList>::getInstanceS(args[0]->getSystemState(),nodes); } else if(args[0]->getObjectType()==T_NULL || args[0]->getObjectType()==T_UNDEFINED) { - return Class<XMLList>::getInstanceSNoArgs(); + return Class<XMLList>::getInstanceSNoArgs(args[0]->getSystemState()); } else throw RunTimeException("Type not supported in XMLList()"); @@ -349,12 +349,12 @@ { XMLList* th=Class<XMLList>::cast(obj); _NR<ASObject> name; - ARG_UNPACK(name,_NR<ASObject>(abstract_s("*"))); + ARG_UNPACK(name,_NR<ASObject>(abstract_s(obj->getSystemState(),"*"))); XML::XMLVector ret; multiname mname(NULL); name->applyProxyProperty(mname); th->getDescendantsByQName(name->toString(),"",mname.isAttribute,ret); - return Class<XMLList>::getInstanceS(ret,th->targetobject,multiname(NULL)); + return Class<XMLList>::getInstanceS(obj->getSystemState(),ret,th->targetobject,multiname(NULL)); } ASFUNCTIONBODY(XMLList,elements) @@ -369,7 +369,7 @@ { (*it)->getElementNodes(name, elems); } - return Class<XMLList>::getInstanceS(elems,th->targetobject,multiname(NULL)); + return Class<XMLList>::getInstanceS(obj->getSystemState(),elems,th->targetobject,multiname(NULL)); } ASFUNCTIONBODY(XMLList,parent) @@ -377,7 +377,7 @@ XMLList* th=Class<XMLList>::cast(obj); if(th->nodes.size()==0) - return getSys()->getUndefinedRef(); + return obj->getSystemState()->getUndefinedRef(); auto it=th->nodes.begin(); ASObject *parent=(*it)->getParentNode(); @@ -387,7 +387,7 @@ { ASObject *otherParent=(*it)->getParentNode(); if(!parent->isEqual(otherParent)) - return getSys()->getUndefinedRef(); + return obj->getSystemState()->getUndefinedRef(); } return parent; @@ -424,7 +424,7 @@ (*it)->childrenImpl(ret, arg0); } } - XMLList* retObj=Class<XMLList>::getInstanceS(ret,th->targetobject,multiname(NULL)); + XMLList* retObj=Class<XMLList>::getInstanceS(obj->getSystemState(),ret,th->targetobject,multiname(NULL)); return retObj; } @@ -438,7 +438,7 @@ { (*it)->childrenImpl(ret, "*"); } - XMLList* retObj=Class<XMLList>::getInstanceS(ret,th->targetobject,multiname(NULL)); + XMLList* retObj=Class<XMLList>::getInstanceS(obj->getSystemState(),ret,th->targetobject,multiname(NULL)); return retObj; } @@ -452,7 +452,7 @@ { (*it)->getText(ret); } - return Class<XMLList>::getInstanceS(ret,th->targetobject,multiname(NULL)); + return Class<XMLList>::getInstanceS(obj->getSystemState(),ret,th->targetobject,multiname(NULL)); } ASFUNCTIONBODY(XMLList,contains) @@ -461,22 +461,22 @@
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -134,22 +134,17 @@ type=T_FUNCTION; } -void IFunction::finalize() -{ - ASObject::finalize(); - closure_this.reset(); -} - void IFunction::sinit(Class_base* c) { - c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(IFunction::_toString),DYNAMIC_TRAIT); + c->isReusable=true; + c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),IFunction::_toString),DYNAMIC_TRAIT); - c->setDeclaredMethodByQName("call","",Class<IFunction>::getFunction(IFunction::_call,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("call",AS3,Class<IFunction>::getFunction(IFunction::_call,1),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("apply","",Class<IFunction>::getFunction(IFunction::apply,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("apply",AS3,Class<IFunction>::getFunction(IFunction::apply,2),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(IFunction::_getter_length),GETTER_METHOD,true); - c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(IFunction::_toString),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("call","",Class<IFunction>::getFunction(c->getSystemState(),IFunction::_call,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("call",AS3,Class<IFunction>::getFunction(c->getSystemState(),IFunction::_call,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("apply","",Class<IFunction>::getFunction(c->getSystemState(),IFunction::apply,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("apply",AS3,Class<IFunction>::getFunction(c->getSystemState(),IFunction::apply,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(c->getSystemState(),IFunction::_getter_length),GETTER_METHOD,true); + c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(c->getSystemState(),IFunction::_toString),NORMAL_METHOD,false); } ASFUNCTIONBODY_GETTER_SETTER(IFunction,prototype); @@ -168,7 +163,7 @@ if(argslen==0 || args[0]->is<Null>() || args[0]->is<Undefined>()) { //get the current global object - newObj=getVm()->currentCallContext->scope_stack[0].object->as<Global>(); + newObj=getVm(obj->getSystemState())->currentCallContext->scope_stack[0].object->as<Global>(); newObj->incRef(); } else @@ -203,7 +198,7 @@ if(argslen==0 || args[0]->is<Null>() || args[0]->is<Undefined>()) { //get the current global object - newObj=getVm()->currentCallContext->scope_stack[0].object->as<Global>(); + newObj=getVm(obj->getSystemState())->currentCallContext->scope_stack[0].object->as<Global>(); newObj->incRef(); } else @@ -227,7 +222,7 @@ ASFUNCTIONBODY(IFunction,_toString) { - return abstract_s("function Function() {}"); + return abstract_s(obj->getSystemState(),"function Function() {}"); } ASObject* Class<IFunction>::generator(ASObject* const* args, const unsigned int argslen) @@ -262,16 +257,7 @@ { if(mi) length = mi->numArgs(); -} - -SyntheticFunction::~SyntheticFunction() -{ -} - -void SyntheticFunction::finalize() -{ - IFunction::finalize(); - func_scope.clear(); + reusableListNumber = 1; } /** @@ -284,13 +270,13 @@ const uint32_t opt_hit_threshold=1; const uint32_t jit_hit_threshold=20; if (!mi->body) - return getSys()->getUndefinedRef(); + return getSystemState()->getUndefinedRef(); const uint16_t hit_count = mi->body->hit_count; const method_body_info::CODE_STATUS& codeStatus = mi->body->codeStatus; - uint32_t& cur_recursion = getVm()->cur_recursion; - if(cur_recursion == getVm()->limits.max_recursion) + uint32_t& cur_recursion = getVm(getSystemState())->cur_recursion; + if(cur_recursion == getVm(getSystemState())->limits.max_recursion) { for(uint32_t i=0;i<numArgs;i++) args[i]->decRef(); @@ -329,16 +315,16 @@ } //For sufficiently hot methods, optimize them to the internal bytecode - if(hit_count>=opt_hit_threshold && codeStatus==method_body_info::ORIGINAL && getSys()->useFastInterpreter) + if(hit_count>=opt_hit_threshold && codeStatus==method_body_info::ORIGINAL && getSystemState()->useFastInterpreter) { ABCVm::optimizeFunction(this); } //Temporarily disable JITting - if(mi->body->exceptions.size()==0 && getSys()->useJit && ((hit_count>=jit_hit_threshold && codeStatus==method_body_info::OPTIMIZED) || getSys()->useInterpreter==false)) + if(mi->body->exceptions.size()==0 && getSystemState()->useJit && ((hit_count>=jit_hit_threshold && codeStatus==method_body_info::OPTIMIZED) || getSystemState()->useInterpreter==false)) { //We passed the hot function threshold, synt the function - val=mi->synt_method(); + val=mi->synt_method(getSystemState()); assert(val); } mi->body->hit_count++; @@ -354,7 +340,7 @@ { //The arguments does not contain default values of optional parameters, //i.e. f(a,b=3) called as f(7) gives arguments = { 7 } - argumentsArray=Class<Array>::getInstanceS(); + argumentsArray=Class<Array>::getInstanceS(obj->getSystemState()); argumentsArray->resize(numArgs); for(uint32_t j=0;j<numArgs;j++) { @@ -383,7 +369,7 @@ cc.scope_stack=func_scope; cc.initialScopeStack=func_scope.size(); cc.exec_pos=0; - call_context* saved_cc = getVm()->currentCallContext; + call_context* saved_cc = getVm(getSystemState())->currentCallContext; if (saved_cc) { if (!saved_cc->defaultNamespaceUri.isNull()) @@ -392,7 +378,7 @@ } /* Set the current global object, each script in each DoABCTag has its own */ - getVm()->currentCallContext = &cc; + getVm(getSystemState())->currentCallContext = &cc; if(isBound()) { /* closure_this can never been overriden */ @@ -423,7 +409,7 @@ cc.locals[i+1]=mi->paramTypes[i]->coerce(mi->getOptional(iOptional)); else { assert(mi->paramTypes[i] == Type::anyType); - cc.locals[i+1]=getSys()->getUndefinedRef(); + cc.locals[i+1]=getSystemState()->getUndefinedRef(); } } cc.argarrayposition = -1; @@ -436,7 +422,7 @@ else if(mi->needsRest()|| passedToRest > 0) // it seems that Adobe allows additional parameters without setting "needsRest" { assert_and_throw(argumentsArray==NULL); - Array* rest=Class<Array>::getInstanceS(); + Array* rest=Class<Array>::getInstanceS(getSystemState()); rest->resize(passedToRest); //Give the reference of the other args to an array for(uint32_t j=0;j<passedToRest;j++) @@ -458,14 +444,14 @@ cur_recursion++; //increment current recursion depth Log::calls_indent++; - getVm()->stacktrace.push_back(std::pair<uint32_t,ASObject*>(this->functionname,obj)); + getVm(getSystemState())->stacktrace.push_back(std::pair<uint32_t,ASObject*>(this->functionname,obj)); while (true) { try { - if(mi->body->exceptions.size() || (val==NULL && getSys()->useInterpreter)) + if(mi->body->exceptions.size() || (val==NULL && getSystemState()->useInterpreter)) { - if(codeStatus == method_body_info::OPTIMIZED && getSys()->useFastInterpreter) + if(codeStatus == method_body_info::OPTIMIZED && getSystemState()->useFastInterpreter) { //This is a mildy hot function, execute it using the fast interpreter ret=ABCVm::executeFunctionFast(this,&cc,obj); @@ -512,8 +498,8 @@ { cur_recursion--; //decrement current recursion depth Log::calls_indent--; - getVm()->stacktrace.pop_back(); - getVm()->currentCallContext = saved_cc; + getVm(getSystemState())->stacktrace.pop_back(); + getVm(getSystemState())->currentCallContext = saved_cc; throw; } continue; @@ -521,15 +507,15 @@ break; } cur_recursion--; //decrement current recursion depth - getVm()->stacktrace.pop_back(); + getVm(getSystemState())->stacktrace.pop_back(); Log::calls_indent--; - getVm()->currentCallContext = saved_cc; + getVm(getSystemState())->currentCallContext = saved_cc; this->decRef(); //free local ref obj->decRef();
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -32,7 +32,6 @@ #include "scripting/toplevel/XML.h" #include "memory_support.h" #include <boost/intrusive/list.hpp> -#include <forward_list> namespace lightspark { @@ -149,7 +148,6 @@ mutable std::vector<Class_base*> interfaces_added; nsNameAndKind protected_ns; void initializeProtectedNamespace(const tiny_string& name, const namespace_info& ns); - void recursiveBuild(ASObject* target); IFunction* constructor; void describeTraits(pugi::xml_node &root, std::vector<traits_info>& traits) const; void describeMetadata(pugi::xml_node &node, const traits_info& trait) const; @@ -158,15 +156,48 @@ Mutex referencedObjectsMutex; boost::intrusive::list<ASObject, boost::intrusive::constant_time_size<false> > referencedObjects; void finalizeObjects(); - std::forward_list<ASObject*> freelist; + std::vector<ASObject*> freelist; + std::vector<ASObject*> freelist2; protected: void copyBorrowedTraitsFromSuper(); ASFUNCTION(_toString); void initStandardProps(); void destroy(); public: - ASObject* getObjectFromFreeList(); - void pushObjectToFreeList(ASObject* obj); + inline ASObject* getObjectFromFreeList() + { + SpinlockLocker l(referencedObjectsMutex); + ASObject* ret = NULL; + if (!freelist.empty()) + { + ret=freelist.back(); + freelist.pop_back(); + ret->incRef(); + } + return ret; + } + inline ASObject* getObjectFromFreeList2() + { + SpinlockLocker l(referencedObjectsMutex); + ASObject* ret = NULL; + if (!freelist2.empty()) + { + ret=freelist2.back(); + freelist2.pop_back(); + ret->incRef(); + } + return ret; + } + + inline void pushObjectToFreeList(ASObject *obj) + { + assert(obj->getRefCount() == 0); + SpinlockLocker l(referencedObjectsMutex); + if (obj->reusableListNumber == 0) + freelist.push_back(obj); + else + freelist2.push_back(obj); + } variables_map borrowedVariables; ASPROPERTY_GETTER(_NR<Prototype>,prototype); ASPROPERTY_GETTER(_NR<ObjectConstructor>,constructorprop); @@ -193,7 +224,7 @@ void addConstructorGetter(); void addPrototypeGetter(); void addLengthGetter(); - void setupDeclaredTraits(ASObject *target); + inline virtual void setupDeclaredTraits(ASObject *target) const { target->traitsInitialized = true; } void handleConstruction(ASObject* target, ASObject* const* args, unsigned int argslen, bool buildAndLink); void setConstructor(IFunction* c); bool hasConstructor() { return constructor != NULL; } @@ -232,7 +263,11 @@ virtual ASObject* coerce(ASObject* o) const; void setSuper(_R<Class_base> super_); - const variable* findBorrowedGettable(const multiname& name, NS_KIND &nskind) const DLL_LOCAL; + inline const variable* findBorrowedGettable(const multiname& name, uint32_t* nsRealId = NULL) const DLL_LOCAL + { + return ASObject::findGettableImpl(getSystemState(), borrowedVariables,name,nsRealId); + } + 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; @@ -262,10 +297,23 @@ { // throw RunTimeException("Class_object::buildInstanceTraits"); } - void finalize(); + void finalize() + { + //Remove the cyclic reference to itself + setClass(NULL); + Class_base::finalize(); + } + public: - static Class_object* getClass(); - static _R<Class_object> getRef(); + static Class_object* getClass(SystemState* sys); + + static _R<Class_object> getRef(SystemState* sys) + { + Class_object* ret = getClass(sys); + ret->incRef(); + return _MR(ret); + } + }; class Prototype @@ -294,10 +342,10 @@ { public: ObjectPrototype(Class_base* c); - void finalize(); + inline void finalize() { prevPrototype.reset(); } void incRef() { ASObject::incRef(); } void decRef() { ASObject::decRef(); } - ASObject* getObj() { return this; } + inline ASObject* getObj() { return this; } _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt=NONE); void setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst); bool isEqual(ASObject* r); @@ -327,7 +375,8 @@ public: Function_object(Class_base* c, _R<ASObject> p); _NR<ASObject> functionPrototype; - void finalize(); + void finalize() { functionPrototype.reset(); } + _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt=NONE); }; @@ -355,7 +404,13 @@ bool isMethod() const { return inClass != NULL; } bool isBound() const { return closure_this; } bool isConstructed() const { return constructIndicator; } - void finalize(); + inline void finalize() + { + closure_this.reset(); + inClass=NULL; + functionname=0; + length=0; + } ASFUNCTION(apply); ASFUNCTION(_call); ASFUNCTION(_toString); @@ -417,7 +472,17 @@ Function(Class_base* c, as_function v=NULL):IFunction(c),val(v){} Function* clone() { - return new (getClass()->memoryAccount) Function(*this); + Function* ret = getClass()->getObjectFromFreeList()->as<Function>(); + if (!ret) + ret=new (getClass()->memoryAccount) Function(*this); + else + { + ret->val = val; + ret->length = length; + ret->inClass = inClass; + ret->functionname = functionname; + } + return ret; } method_info* getMethodInfo() const { return NULL; } public: @@ -432,10 +497,15 @@ { public: FunctionPrototype(Class_base* c, _NR<Prototype> p); - void finalize(); + inline void finalize() + { + Function::finalize(); + prevPrototype.reset(); + } + void incRef() { ASObject::incRef(); } void decRef() { ASObject::decRef(); } - ASObject* getObj() { return this; } + inline ASObject* getObj() { return this; } _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt=NONE); }; @@ -454,15 +524,38 @@ /* Pointer to JIT-compiled function or NULL if not yet compiled */ synt_function val; SyntheticFunction(Class_base* c,method_info* m); + SyntheticFunction* clone() { - return new (getClass()->memoryAccount) SyntheticFunction(*this);
View file
lightspark.tar.xz/src/smartrefs.h
Changed
@@ -38,12 +38,12 @@ #ifndef NDEBUG int getRefCount() const { return ref_count; } #endif - void incRef() + inline void incRef() { ATOMIC_INCREMENT(ref_count); assert(ref_count>0); } - void decRef() + inline void decRef() { assert(ref_count>0); uint32_t t=ATOMIC_DECREMENT(ref_count); @@ -52,7 +52,7 @@ destruct(); } } - void fake_decRef() + inline void fake_decRef() { ATOMIC_DECREMENT(ref_count); } @@ -146,11 +146,11 @@ { m->decRef(); } - T* operator->() const + inline T* operator->() const { return m; } - T* getPtr() const + inline T* getPtr() const { return m; }
View file
lightspark.tar.xz/src/swf.cpp
Changed
@@ -143,7 +143,7 @@ RootMovieClip* RootMovieClip::getInstance(_NR<LoaderInfo> li, _R<ApplicationDomain> appDomain, _R<SecurityDomain> secDomain) { - Class_base* movieClipClass = Class<MovieClip>::getClass(); + Class_base* movieClipClass = Class<MovieClip>::getClass(getSys()); RootMovieClip* ret=new (movieClipClass->memoryAccount) RootMovieClip(li, appDomain, secDomain, movieClipClass); ret->constructIndicator = true; ret->constructorCallComplete = true; @@ -216,26 +216,28 @@ stringMemory = allocateMemoryAccount("Tiny_string"); null=_MR(new (unaccountedMemory) Null); + null->setSystemState(this); undefined=_MR(new (unaccountedMemory) Undefined); + undefined->setSystemState(this); builtinClasses = new Class_base*[asClassCount]; memset(builtinClasses,0,asClassCount*sizeof(Class_base*)); //Untangle the messy relationship between class objects and the Class class - Class_object* classObject = Class_object::getClass(); + Class_object* classObject = Class_object::getClass(this); //Getting the Object class object will set the classdef to the Class_object //like any other class. This happens inside Class_base constructor - _R<Class_base> asobjectClass = Class<ASObject>::getRef(); + _R<Class_base> asobjectClass = Class<ASObject>::getRef(this); //The only bit remaining is setting the Object class as the super class for Class classObject->setSuper(asobjectClass); classObject->decRef(); - trueRef=_MR(Class<Boolean>::getInstanceS(true)); - falseRef=_MR(Class<Boolean>::getInstanceS(false)); + trueRef=_MR(Class<Boolean>::getInstanceS(this,true)); + falseRef=_MR(Class<Boolean>::getInstanceS(this,false)); - systemDomain = _MR(Class<ApplicationDomain>::getInstanceS()); - _NR<ApplicationDomain> applicationDomain=_MR(Class<ApplicationDomain>::getInstanceS(systemDomain)); - _NR<SecurityDomain> securityDomain = _MR(Class<SecurityDomain>::getInstanceS()); + systemDomain = _MR(Class<ApplicationDomain>::getInstanceS(this)); + _NR<ApplicationDomain> applicationDomain=_MR(Class<ApplicationDomain>::getInstanceS(this,systemDomain)); + _NR<SecurityDomain> securityDomain = _MR(Class<SecurityDomain>::getInstanceS(this)); threadPool=new ThreadPool(this); timerThread=new TimerThread(this); @@ -245,12 +247,12 @@ intervalManager=new IntervalManager(); securityManager=new SecurityManager(); - _NR<LoaderInfo> loaderInfo=_MR(Class<LoaderInfo>::getInstanceS()); + _NR<LoaderInfo> loaderInfo=_MR(Class<LoaderInfo>::getInstanceS(this)); loaderInfo->applicationDomain = applicationDomain; loaderInfo->setBytesLoaded(0); loaderInfo->setBytesTotal(0); mainClip=RootMovieClip::getInstance(loaderInfo, applicationDomain, securityDomain); - stage=Class<Stage>::getInstanceS(); + stage=Class<Stage>::getInstanceS(this); mainClip->incRef(); stage->_addChildAt(_MR(mainClip),0); //Get starting time @@ -295,7 +297,7 @@ _NR<ASObject> params=getParameters(); if(params.isNull()) - params=_MNR(Class<ASObject>::getInstanceS()); + params=_MNR(Class<ASObject>::getInstanceS(getSys())); //Add arguments to SystemState string vars(v); uint32_t cur=0; @@ -356,7 +358,7 @@ LOG(LOG_ERROR,"Flash parameters has duplicate key '" << varName << "' - ignoring"); else params->setVariableByQName(varName,"", - lightspark::Class<lightspark::ASString>::getInstanceS(varValue),DYNAMIC_TRAIT); + lightspark::Class<lightspark::ASString>::getInstanceS(this,varValue),DYNAMIC_TRAIT); } cur=n2+1; } @@ -371,14 +373,14 @@ LOG(LOG_ERROR,_("Parameters file not found")); return; } - _R<ASObject> ret=_MR(Class<ASObject>::getInstanceS()); + _R<ASObject> ret=_MR(Class<ASObject>::getInstanceS(this)); while(!i.eof()) { string name,value; getline(i,name); getline(i,value); - ret->setVariableByQName(name,"",Class<ASString>::getInstanceS(value),DYNAMIC_TRAIT); + ret->setVariableByQName(name,"",abstract_s(this,value),DYNAMIC_TRAIT); cout << name << ' ' << value << endl; } setParameters(ret); @@ -389,7 +391,7 @@ { _NR<ASObject> params=getParameters(); if(params.isNull()) - params=_MNR(Class<ASObject>::getInstanceS()); + params=_MNR(Class<ASObject>::getInstanceS(this)); parseParametersFromURLIntoObject(url, params); setParameters(params); @@ -405,7 +407,7 @@ LOG(LOG_ERROR,"URL query parameters has duplicate key '" << it->first << "' - ignoring"); else outParams->setVariableByQName(it->first,"", - lightspark::Class<lightspark::ASString>::getInstanceS(it->second),DYNAMIC_TRAIT); + lightspark::Class<lightspark::ASString>::getInstanceS(outParams->getSystemState(),it->second),DYNAMIC_TRAIT); } } @@ -1334,7 +1336,7 @@ { _NR<LoaderInfo> li=loader->getContentLoaderInfo(); li->incRef(); - getVm()->addEvent(li,_MR(Class<SecurityErrorEvent>::getInstanceS( + getVm(loader->getSystemState())->addEvent(li,_MR(Class<SecurityErrorEvent>::getInstanceS(loader->getSystemState(), "Cannot import a SWF file when LoaderContext.allowCodeImport is false."))); // 3226 return; } @@ -1370,7 +1372,7 @@ { LOG(LOG_INFO,"SWF version " << root->version << " is not handled by lightspark, falling back to gnash (if available)"); //Enable flash fallback - getSys()->needsAVM2(false); + root->getSystemState()->needsAVM2(false); return; /* no more parsing necessary, handled by fallback */ } @@ -1523,7 +1525,7 @@ _NR<LoaderInfo> li; li=loader->getContentLoaderInfo(); - _NR<Bitmap> tmp=_MNR(Class<Bitmap>::getInstanceS(li, &f, fileType)); + _NR<Bitmap> tmp=_MNR(Class<Bitmap>::getInstanceS(loader->getSystemState(),li, &f, fileType)); { SpinlockLocker l(objectSpinlock); parsedObject=tmp; @@ -1740,10 +1742,10 @@ Locker l(mutexFrameListeners); if(!frameListeners.empty()) { - _R<Event> e(Class<Event>::getInstanceS("enterFrame")); + _R<Event> e(Class<Event>::getInstanceS(this,"enterFrame")); auto it=frameListeners.begin(); for(;it!=frameListeners.end();it++) - getVm()->addEvent(*it,e); + getVm(this)->addEvent(*it,e); } } @@ -1758,10 +1760,10 @@ Locker l(mutexFrameListeners); if(!frameListeners.empty()) { - _R<Event> e(Class<Event>::getInstanceS("frameConstructed")); + _R<Event> e(Class<Event>::getInstanceS(this,"frameConstructed")); auto it=frameListeners.begin(); for(;it!=frameListeners.end();it++) - getVm()->addEvent(*it,e); + getVm(this)->addEvent(*it,e); } } /* Step 6: dispatch exitFrame event */ @@ -1769,10 +1771,10 @@ Locker l(mutexFrameListeners); if(!frameListeners.empty()) { - _R<Event> e(Class<Event>::getInstanceS("exitFrame")); + _R<Event> e(Class<Event>::getInstanceS(this,"exitFrame")); auto it=frameListeners.begin(); for(;it!=frameListeners.end();it++) - getVm()->addEvent(*it,e); + getVm(this)->addEvent(*it,e); } } /* TODO: Step 7: dispatch render event (Assuming stage.invalidate() has been called) */ @@ -1787,15 +1789,15 @@ { } -void SystemState::resizeCompleted() const +void SystemState::resizeCompleted() { if(currentVm && scaleMode==NO_SCALE) { stage->incRef(); - currentVm->addEvent(_MR(stage),_MR(Class<Event>::getInstanceS("resize",false))); + currentVm->addEvent(_MR(stage),_MR(Class<Event>::getInstanceS(this,"resize",false))); stage->incRef(); - currentVm->addEvent(_MR(stage),_MR(Class<StageVideoAvailabilityEvent>::getInstanceS())); + currentVm->addEvent(_MR(stage),_MR(Class<StageVideoAvailabilityEvent>::getInstanceS(this))); } } @@ -1996,7 +1998,7 @@ if(getFramesLoaded() == 0)
View file
lightspark.tar.xz/src/swf.h
Changed
@@ -402,7 +402,7 @@ void flushInvalidationQueue(); //Resize support - void resizeCompleted() const; + void resizeCompleted(); /* * Support for class aliases in AMF3 serialization
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -37,16 +37,12 @@ using namespace std; using namespace lightspark; -multiname::multiname(MemoryAccount* m):name_o(NULL),ns(reporter_allocator<nsNameAndKind>(m)),name_type(NAME_OBJECT),isAttribute(false) -{ -} - -tiny_string multiname::qualifiedString() const +const tiny_string multiname::qualifiedString(SystemState* sys) const { assert_and_throw(ns.size()>=1); assert_and_throw(name_type==NAME_STRING); - const tiny_string nsName=ns[0].getImpl().name; - const tiny_string& name=getSys()->getStringFromUniqueId(name_s_id); + const tiny_string nsName=ns[0].getImpl(sys).name; + const tiny_string& name=sys->getStringFromUniqueId(name_s_id); if(nsName.empty()) return name; else @@ -58,7 +54,7 @@ } } -tiny_string multiname::normalizedName() const +const tiny_string multiname::normalizedName(SystemState* sys) const { switch(name_type) { @@ -67,7 +63,7 @@ case multiname::NAME_NUMBER: return Number::toString(name_d); case multiname::NAME_STRING: - return getSys()->getStringFromUniqueId(name_s_id); + return sys->getStringFromUniqueId(name_s_id); case multiname::NAME_OBJECT: return name_o ? name_o->toString() : "*"; default: @@ -77,7 +73,7 @@ } } -uint32_t multiname::normalizedNameId() const +uint32_t multiname::normalizedNameId(SystemState* sys) const { switch(name_type) { @@ -86,7 +82,7 @@ case multiname::NAME_INT: case multiname::NAME_NUMBER: case multiname::NAME_OBJECT: - return getSys()->getUniqueStringId(normalizedName()); + return sys->getUniqueStringId(normalizedName(sys)); default: assert("Unexpected name kind" && false); //Should never reach this @@ -94,7 +90,7 @@ } } -tiny_string multiname::normalizedNameUnresolved() const +const tiny_string multiname::normalizedNameUnresolved(SystemState* sys) const { switch(name_type) { @@ -103,7 +99,7 @@ case multiname::NAME_NUMBER: return Number::toString(name_d); case multiname::NAME_STRING: - return getSys()->getStringFromUniqueId(name_s_id); + return sys->getStringFromUniqueId(name_s_id); case multiname::NAME_OBJECT: return name_o ? name_o->getClassName() : "*"; default: @@ -120,38 +116,39 @@ name_o = NULL; } - if(n->is<Integer>()) + switch(n->getObjectType()) { + case T_INTEGER: name_i=n->as<Integer>()->val; name_type = NAME_INT; - } - else if(n->is<UInteger>()) - { + break; + case T_UINTEGER: name_i=n->as<UInteger>()->val; name_type = NAME_INT; - } - else if(n->is<Number>()) - { + break; + case T_NUMBER: name_d=n->as<Number>()->val; name_type = NAME_NUMBER; - } - else if(n->getObjectType()==T_QNAME) - { - ASQName* qname=static_cast<ASQName*>(n); - name_s_id=getSys()->getUniqueStringId(qname->local_name); - name_type = NAME_STRING; - } - else if(n->getObjectType()==T_STRING) - { - ASString* o=static_cast<ASString*>(n); - name_s_id=getSys()->getUniqueStringId(o->data); - name_type = NAME_STRING; - } - else - { + break; + case T_QNAME: + { + ASQName* qname=static_cast<ASQName*>(n); + name_s_id=n->getSystemState()->getUniqueStringId(qname->local_name); + name_type = NAME_STRING; + } + break; + case T_STRING: + { + ASString* o=static_cast<ASString*>(n); + name_s_id=n->getSystemState()->getUniqueStringId(o->data); + name_type = NAME_STRING; + } + break; + default: n->incRef(); name_o=n; name_type = NAME_OBJECT; + break; } } @@ -164,7 +161,7 @@ } } -bool multiname::toUInt(uint32_t& index, bool acceptStringFractions) const +bool multiname::toUInt(SystemState* sys,uint32_t& index, bool acceptStringFractions) const { switch(name_type) { @@ -174,7 +171,7 @@ { tiny_string str; if(name_type==multiname::NAME_STRING) - str=getSys()->getStringFromUniqueId(name_s_id); + str=sys->getStringFromUniqueId(name_s_id); else str=name_o->toString(); @@ -247,7 +244,7 @@ std::ostream& lightspark::operator<<(std::ostream& s, const nsNameAndKind& r) { const char* prefix; - switch(r.getImpl().kind) + switch(r.getImpl(getSys()).kind) { case NAMESPACE: prefix="ns:"; @@ -276,7 +273,7 @@ prefix=""; break; } - s << prefix << r.getImpl().name; + s << prefix << r.getImpl(getSys()).name; return s; } @@ -1343,45 +1340,45 @@ } return s; } -ASString* lightspark::abstract_s() +ASString* lightspark::abstract_s(SystemState *sys) { - return Class<ASString>::getInstanceSNoArgs(); + return Class<ASString>::getInstanceSNoArgs(sys); } -ASString* lightspark::abstract_s(const char* s, uint32_t len) +ASString* lightspark::abstract_s(SystemState *sys, const char* s, uint32_t len) { - ASString* ret= Class<ASString>::getInstanceSNoArgs(); + ASString* ret= Class<ASString>::getInstanceSNoArgs(sys); ret->data = std::string(s,len); return ret; } -ASString* lightspark::abstract_s(const char* s) +ASString* lightspark::abstract_s(SystemState *sys, const char* s) { - ASString* ret= Class<ASString>::getInstanceSNoArgs(); + ASString* ret= Class<ASString>::getInstanceSNoArgs(sys); ret->data = s; return ret; } -ASString* lightspark::abstract_s(const tiny_string& s) +ASString* lightspark::abstract_s(SystemState *sys, const tiny_string& s)
View file
lightspark.tar.xz/src/swftypes.h
Changed
@@ -38,8 +38,6 @@ #include <algorithm> #endif -class memorystream; - namespace lightspark { @@ -81,6 +79,7 @@ typedef double number_t; +class SystemState; class ASObject; class ASString; class ABCContext; @@ -224,11 +223,10 @@ class u32 { friend std::istream& operator>>(std::istream& in, u32& v); -friend memorystream& operator>>(memorystream& in, u32& v); private: uint32_t val; public: - operator uint32_t() const{return val;} + inline operator uint32_t() const{return val;} }; class STRING @@ -315,14 +313,14 @@ uint32_t nsId; uint32_t nsRealId; bool nameIsEmpty; - nsNameAndKind(const tiny_string& _name, NS_KIND _kind); - nsNameAndKind(const char* _name, NS_KIND _kind); + nsNameAndKind(SystemState *sys, const tiny_string& _name, NS_KIND _kind); + nsNameAndKind(SystemState* sys,const char* _name, NS_KIND _kind); nsNameAndKind(ABCContext * c, uint32_t nsContextIndex); /* * Special constructor for protected namespace, which have * different representationId */ - nsNameAndKind(const tiny_string& _name, uint32_t _baseId, NS_KIND _kind); + nsNameAndKind(SystemState* sys,const tiny_string& _name, uint32_t _baseId, NS_KIND _kind); /* * Special version to create the empty bultin namespace */ @@ -342,7 +340,7 @@ { return nsId==r.nsId; } - const nsNameAndKindImpl& getImpl() const; + const nsNameAndKindImpl& getImpl(SystemState *sys) const; bool hasEmptyName() const { return nameIsEmpty; @@ -362,28 +360,31 @@ enum NAME_TYPE {NAME_STRING,NAME_INT,NAME_NUMBER,NAME_OBJECT}; NAME_TYPE name_type; bool isAttribute; - multiname(MemoryAccount* m); + multiname(MemoryAccount* m):name_o(NULL),ns(reporter_allocator<nsNameAndKind>(m)),name_type(NAME_OBJECT),isAttribute(false) + { + } + /* Returns a string name whatever is the name type */ - tiny_string normalizedName() const; + const tiny_string normalizedName(SystemState *sys) const; /* * Return a string id whatever is the name type */ - uint32_t normalizedNameId() const; + uint32_t normalizedNameId(SystemState *sys) const; /* Returns a string name whatever is the name type, but does not resolve NAME_OBJECT names this should be used for exception or debug messages to avoid calling overridden toString property of the object */ - tiny_string normalizedNameUnresolved() const; + const tiny_string normalizedNameUnresolved(SystemState *sys) const; - tiny_string qualifiedString() const; + const tiny_string qualifiedString(SystemState *sys) const; /* sets name_type, name_s/name_d based on the object n */ void setName(ASObject* n); void resetNameIfObject(); bool isQName() const { return ns.size() == 1; } - bool toUInt(uint32_t& out, bool acceptStringFractions=false) const; + bool toUInt(SystemState *sys, uint32_t& out, bool acceptStringFractions=false) const; bool isEmpty() const { return name_type == NAME_OBJECT && name_o == NULL;} }; @@ -1330,13 +1331,13 @@ RunState(); }; -ASObject* abstract_i(int32_t i); -ASObject* abstract_ui(uint32_t i); -ASObject* abstract_d(number_t i); -ASString* abstract_s(); -ASString* abstract_s(const char* s, uint32_t len); -ASString* abstract_s(const char* s); -ASString* abstract_s(const tiny_string& s); +ASObject* abstract_i(SystemState *sys, int32_t i); +ASObject* abstract_ui(SystemState *sys, uint32_t i); +ASObject* abstract_d(SystemState *sys, number_t i); +ASString* abstract_s(SystemState *sys); +ASString* abstract_s(SystemState *sys, const char* s, uint32_t len); +ASString* abstract_s(SystemState *sys, const char* s); +ASString* abstract_s(SystemState *sys, const tiny_string& s); void stringToQName(const tiny_string& tmp, tiny_string& name, tiny_string& ns);
View file
lightspark.tar.xz/src/thread_pool.cpp
Changed
@@ -84,7 +84,7 @@ { setTLSSys(th->m_sys); - ThreadProfile* profile=getSys()->allocateProfiler(RGB(200,200,0)); + ThreadProfile* profile=th->m_sys->allocateProfiler(RGB(200,200,0)); char buf[16]; snprintf(buf,16,"Thread %u",index); profile->setTag(buf); @@ -116,7 +116,7 @@ catch(LightsparkException& e) { LOG(LOG_ERROR,_("Exception in ThreadPool ") << e.what()); - getSys()->setError(e.cause); + th->m_sys->setError(e.cause); } profile->accountTime(chronometer.checkpoint());
View file
lightspark.tar.xz/src/tiny_string.cpp
Changed
@@ -56,24 +56,19 @@ init(); } -tiny_string::tiny_string(const tiny_string& r):_buf_static(),buf(_buf_static),stringSize(r.stringSize),type(STATIC) +tiny_string::tiny_string(const tiny_string& r): + _buf_static(),buf(_buf_static),stringSize(r.stringSize),numchars(r.numchars),type(STATIC),isASCII(r.isASCII),hasNull(r.hasNull) { //Fast path for static read-only strings if(r.type==READONLY) { type=READONLY; buf=r.buf; - this->isASCII = r.isASCII; - this->hasNull = r.hasNull; - this->numchars = r.numchars; return; } if(stringSize > STATIC_SIZE) createBuffer(stringSize); memcpy(buf,r.buf,stringSize); - this->isASCII = r.isASCII; - this->hasNull = r.hasNull; - this->numchars = r.numchars; } tiny_string::tiny_string(const std::string& r):_buf_static(),buf(_buf_static),stringSize(r.size()+1),type(STATIC) @@ -316,14 +311,6 @@ return stringSize == 1; } -void tiny_string::clear() -{ - resetToStatic(); - numchars = 0; - isASCII = true; - hasNull = false; -} - /* returns the length in bytes, not counting the trailing \0 */ uint32_t tiny_string::numBytes() const {
View file
lightspark.tar.xz/src/tiny_string.h
Changed
@@ -151,7 +151,14 @@ bool operator!=(const Glib::ustring&) const; const char* raw_buf() const; bool empty() const; - void clear(); + inline void clear() + { + resetToStatic(); + numchars = 0; + isASCII = true; + hasNull = false; + } + /* returns the length in bytes, not counting the trailing \0 */ uint32_t numBytes() const; /* returns the length in utf-8 characters, not counting the trailing \0 */
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
.