libs: update angelscript to 2.32.0

Fixes: https://github.com/supertuxkart/stk-code/issues/2528
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko
2017-11-20 14:02:33 +01:00
committed by Deve
parent c4b42c1852
commit aec7ca0ce9
69 changed files with 9307 additions and 6203 deletions

View File

@@ -1,24 +1,24 @@
/*
AngelCode Scripting Library
Copyright (c) 2003-2015 Andreas Jonsson
Copyright (c) 2003-2017 Andreas Jonsson
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
3. This notice may not be removed or altered from any source
distribution.
The original version of this library can be located at:
@@ -86,7 +86,7 @@ public:
virtual asIJITCompiler *GetJITCompiler() const;
// Global functions
virtual int RegisterGlobalFunction(const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *objForThiscall = 0);
virtual int RegisterGlobalFunction(const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0);
virtual asUINT GetGlobalFunctionCount() const;
virtual asIScriptFunction *GetGlobalFunctionByIndex(asUINT index) const;
virtual asIScriptFunction *GetGlobalFunctionByDecl(const char *declaration) const;
@@ -100,18 +100,16 @@ public:
// Type registration
virtual int RegisterObjectType(const char *obj, int byteSize, asDWORD flags);
virtual int RegisterObjectProperty(const char *obj, const char *declaration, int byteOffset);
virtual int RegisterObjectMethod(const char *obj, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *objForThiscall = 0);
virtual int RegisterObjectBehaviour(const char *obj, asEBehaviours behaviour, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *objForThiscall = 0);
virtual int RegisterObjectProperty(const char *obj, const char *declaration, int byteOffset, int compositeOffset = 0, bool isCompositeIndirect = false);
virtual int RegisterObjectMethod(const char *obj, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0, int compositeOffset = 0, bool isCompositeIndirect = false);
virtual int RegisterObjectBehaviour(const char *obj, asEBehaviours behaviour, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0, int compositeOffset = 0, bool isCompositeIndirect = false);
virtual int RegisterInterface(const char *name);
virtual int RegisterInterfaceMethod(const char *intf, const char *declaration);
virtual asUINT GetObjectTypeCount() const;
virtual asIObjectType *GetObjectTypeByIndex(asUINT index) const;
virtual asIObjectType *GetObjectTypeByName(const char *name) const;
virtual asIObjectType *GetObjectTypeByDecl(const char *decl) const;
virtual asITypeInfo *GetObjectTypeByIndex(asUINT index) const;
// String factory
virtual int RegisterStringFactory(const char *datatype, const asSFuncPtr &factoryFunc, asDWORD callConv, void *objForThiscall = 0);
virtual int RegisterStringFactory(const char *datatype, asIStringFactory *factory);
virtual int GetStringFactoryReturnTypeId(asDWORD *flags) const;
// Default array type
@@ -119,23 +117,21 @@ public:
virtual int GetDefaultArrayTypeId() const;
// Enums
virtual int RegisterEnum(const char *type);
virtual int RegisterEnumValue(const char *type, const char *name, int value);
virtual asUINT GetEnumCount() const;
virtual const char *GetEnumByIndex(asUINT index, int *enumTypeId, const char **nameSpace, const char **configGroup = 0, asDWORD *accessMask = 0) const;
virtual int GetEnumValueCount(int enumTypeId) const;
virtual const char *GetEnumValueByIndex(int enumTypeId, asUINT index, int *outValue) const;
virtual int RegisterEnum(const char *type);
virtual int RegisterEnumValue(const char *type, const char *name, int value);
virtual asUINT GetEnumCount() const;
virtual asITypeInfo *GetEnumByIndex(asUINT index) const;
// Funcdefs
virtual int RegisterFuncdef(const char *decl);
virtual asUINT GetFuncdefCount() const;
virtual asIScriptFunction *GetFuncdefByIndex(asUINT index) const;
virtual int RegisterFuncdef(const char *decl);
virtual asUINT GetFuncdefCount() const;
virtual asITypeInfo *GetFuncdefByIndex(asUINT index) const;
// Typedefs
// TODO: interface: Should perhaps rename this to Alias, since it doesn't really create a new type
virtual int RegisterTypedef(const char *type, const char *decl);
virtual asUINT GetTypedefCount() const;
virtual const char *GetTypedefByIndex(asUINT index, int *typeId, const char **nameSpace, const char **configGroup = 0, asDWORD *accessMask = 0) const;
virtual int RegisterTypedef(const char *type, const char *decl);
virtual asUINT GetTypedefCount() const;
virtual asITypeInfo *GetTypedefByIndex(asUINT index) const;
// Configuration groups
virtual int BeginConfigGroup(const char *groupName);
@@ -153,29 +149,26 @@ public:
// Script functions
virtual asIScriptFunction *GetFunctionById(int funcId) const;
virtual asIScriptFunction *GetFuncDefFromTypeId(int typeId) const;
// Type identification
virtual asIObjectType *GetObjectTypeById(int typeId) const;
virtual int GetTypeIdByDecl(const char *decl) const;
virtual const char *GetTypeDeclaration(int typeId, bool includeNamespace = false) const;
virtual int GetSizeOfPrimitiveType(int typeId) const;
virtual asITypeInfo *GetTypeInfoById(int typeId) const;
virtual asITypeInfo *GetTypeInfoByName(const char *name) const;
virtual asITypeInfo *GetTypeInfoByDecl(const char *decl) const;
// Script execution
virtual asIScriptContext *CreateContext();
virtual void *CreateScriptObject(const asIObjectType *type);
virtual void *CreateScriptObjectCopy(void *obj, const asIObjectType *type);
virtual void *CreateUninitializedScriptObject(const asIObjectType *type);
virtual void *CreateScriptObject(const asITypeInfo *type);
virtual void *CreateScriptObjectCopy(void *obj, const asITypeInfo *type);
virtual void *CreateUninitializedScriptObject(const asITypeInfo *type);
virtual asIScriptFunction *CreateDelegate(asIScriptFunction *func, void *obj);
virtual int AssignScriptObject(void *dstObj, void *srcObj, const asIObjectType *type);
virtual void ReleaseScriptObject(void *obj, const asIObjectType *type);
virtual void AddRefScriptObject(void *obj, const asIObjectType *type);
virtual int RefCastObject(void *obj, asIObjectType *fromType, asIObjectType *toType, void **newPtr, bool useOnlyImplicitCast = false);
#ifdef AS_DEPRECATED
// Deprecated since 2.30.0, 2014-11-04
virtual bool IsHandleCompatibleWithObject(void *obj, int objTypeId, int handleTypeId) const;
#endif
virtual asILockableSharedBool *GetWeakRefFlagOfScriptObject(void *obj, const asIObjectType *type) const;
virtual int AssignScriptObject(void *dstObj, void *srcObj, const asITypeInfo *type);
virtual void ReleaseScriptObject(void *obj, const asITypeInfo *type);
virtual void AddRefScriptObject(void *obj, const asITypeInfo *type);
virtual int RefCastObject(void *obj, asITypeInfo *fromType, asITypeInfo *toType, void **newPtr, bool useOnlyImplicitCast = false);
virtual asILockableSharedBool *GetWeakRefFlagOfScriptObject(void *obj, const asITypeInfo *type) const;
// Context pooling
virtual asIScriptContext *RequestContext();
@@ -188,8 +181,8 @@ public:
// Garbage collection
virtual int GarbageCollect(asDWORD flags = asGC_FULL_CYCLE, asUINT numIterations = 1);
virtual void GetGCStatistics(asUINT *currentSize, asUINT *totalDestroyed, asUINT *totalDetected, asUINT *newObjects, asUINT *totalNewDestroyed) const;
virtual int NotifyGarbageCollectorOfNewObject(void *obj, asIObjectType *type);
virtual int GetObjectInGC(asUINT idx, asUINT *seqNbr, void **obj = 0, asIObjectType **type = 0);
virtual int NotifyGarbageCollectorOfNewObject(void *obj, asITypeInfo *type);
virtual int GetObjectInGC(asUINT idx, asUINT *seqNbr, void **obj = 0, asITypeInfo **type = 0);
virtual void GCEnumCallback(void *reference);
// User data
@@ -199,7 +192,7 @@ public:
virtual void SetModuleUserDataCleanupCallback(asCLEANMODULEFUNC_t callback, asPWORD type);
virtual void SetContextUserDataCleanupCallback(asCLEANCONTEXTFUNC_t callback, asPWORD type);
virtual void SetFunctionUserDataCleanupCallback(asCLEANFUNCTIONFUNC_t callback, asPWORD type);
virtual void SetObjectTypeUserDataCleanupCallback(asCLEANOBJECTTYPEFUNC_t callback, asPWORD type);
virtual void SetTypeInfoUserDataCleanupCallback(asCLEANTYPEINFOFUNC_t callback, asPWORD type);
virtual void SetScriptObjectUserDataCleanupCallback(asCLEANSCRIPTOBJECTFUNC_t callback, asPWORD type);
//===========================================================
@@ -219,8 +212,8 @@ public:
friend class asCByteCode;
friend int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine *engine);
int RegisterMethodToObjectType(asCObjectType *objectType, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *objForThiscall = 0);
int RegisterBehaviourToObjectType(asCObjectType *objectType, asEBehaviours behaviour, const char *decl, const asSFuncPtr &funcPointer, asDWORD callConv, void *objForThiscall);
int RegisterMethodToObjectType(asCObjectType *objectType, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0, int compositeOffset = 0, bool isCompositeIndirect = false);
int RegisterBehaviourToObjectType(asCObjectType *objectType, asEBehaviours behaviour, const char *decl, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0, int compositeOffset = 0, bool isCompositeIndirect = false);
int VerifyVarTypeNotInFunction(asCScriptFunction *func);
@@ -241,18 +234,18 @@ public:
void *CallObjectMethodRetPtr(void *obj, int param1, asCScriptFunction *func) const;
void CallGlobalFunction(void *param1, void *param2, asSSystemFunctionInterface *func, asCScriptFunction *desc) const;
bool CallGlobalFunctionRetBool(void *param1, void *param2, asSSystemFunctionInterface *func, asCScriptFunction *desc) const;
int CallScriptObjectMethod(void *obj, int func);
void ConstructScriptObjectCopy(void *mem, void *obj, asCObjectType *type);
void DeleteDiscardedModules();
void RemoveTemplateInstanceType(asCObjectType *t);
void RemoveTypeAndRelatedFromList(asCMap<asCObjectType*,char> &types, asCObjectType *ot);
asCConfigGroup *FindConfigGroupForFunction(int funcId) const;
asCConfigGroup *FindConfigGroupForGlobalVar(int gvarId) const;
asCConfigGroup *FindConfigGroupForObjectType(const asCObjectType *type) const;
asCConfigGroup *FindConfigGroupForFuncDef(const asCScriptFunction *funcDef) const;
asCConfigGroup *FindConfigGroupForTypeInfo(const asCTypeInfo *type) const;
asCConfigGroup *FindConfigGroupForFuncDef(const asCFuncdefType *funcDef) const;
int RequestBuild();
void BuildCompleted();
@@ -262,7 +255,7 @@ public:
int CreateContext(asIScriptContext **context, bool isInternal);
asCObjectType *GetRegisteredObjectType(const asCString &name, asSNameSpace *ns) const;
asCTypeInfo *GetRegisteredType(const asCString &name, asSNameSpace *ns) const;
asCObjectType *GetListPatternType(int listPatternFuncId);
void DestroyList(asBYTE *buffer, const asCObjectType *listPatternType);
@@ -283,29 +276,28 @@ public:
int GetNextScriptFunctionId();
void AddScriptFunction(asCScriptFunction *func);
void RemoveScriptFunction(asCScriptFunction *func);
void RemoveFuncdef(asCScriptFunction *func);
void RemoveFuncdef(asCFuncdefType *func);
int ConfigError(int err, const char *funcName, const char *arg1, const char *arg2);
int GetTypeIdFromDataType(const asCDataType &dt) const;
asCDataType GetDataTypeFromTypeId(int typeId) const;
asCObjectType *GetObjectTypeFromTypeId(int typeId) const;
void RemoveFromTypeIdMap(asCObjectType *type);
void RemoveFromTypeIdMap(asCTypeInfo *type);
bool IsTemplateType(const char *name) const;
int SetTemplateRestrictions(asCObjectType *templateType, asCScriptFunction *func, const char *caller, const char *decl);
asCObjectType *GetTemplateInstanceType(asCObjectType *templateType, asCArray<asCDataType> &subTypes, asCModule *requestingModule);
asCScriptFunction *GenerateTemplateFactoryStub(asCObjectType *templateType, asCObjectType *templateInstanceType, int origFactoryId);
bool GenerateNewTemplateFunction(asCObjectType *templateType, asCObjectType *templateInstanceType, asCScriptFunction *templateFunc, asCScriptFunction **newFunc);
asCFuncdefType *GenerateNewTemplateFuncdef(asCObjectType *templateType, asCObjectType *templateInstanceType, asCFuncdefType *templateFuncdef);
asCDataType DetermineTypeForTemplate(const asCDataType &orig, asCObjectType *tmpl, asCObjectType *ot);
bool RequireTypeReplacement(asCDataType &type, asCObjectType *templateType);
asCModule *FindNewOwnerForSharedType(asCObjectType *type, asCModule *mod);
asCModule *FindNewOwnerForSharedType(asCTypeInfo *type, asCModule *mod);
asCModule *FindNewOwnerForSharedFunc(asCScriptFunction *func, asCModule *mod);
// String constants
// TODO: Must free unused string constants, thus the ref count for each must be tracked
int AddConstantString(const char *str, size_t length);
const asCString &GetConstantString(int id);
asCFuncdefType *FindMatchingFuncdef(asCScriptFunction *func, asCModule *mod);
// Global property management
asCGlobalProperty *AllocateGlobalProperty();
@@ -330,24 +322,26 @@ public:
asCObjectType functionBehaviours;
// Registered interface
asCArray<asCObjectType *> registeredObjTypes;
asCArray<asCObjectType *> registeredTypeDefs;
asCArray<asCObjectType *> registeredEnums;
asCSymbolTable<asCGlobalProperty> registeredGlobalProps; // increases ref count // TODO: memory savings: Since there can be only one property with the same name a simpler symbol table should be used
asCArray<asCObjectType *> registeredObjTypes; // doesn't increase ref count
asCArray<asCTypedefType *> registeredTypeDefs; // doesn't increase ref count
asCArray<asCEnumType *> registeredEnums; // doesn't increase ref count
// TODO: memory savings: Since there can be only one property with the same name a simpler symbol table should be used for global props
asCSymbolTable<asCGlobalProperty> registeredGlobalProps; // increases ref count
asCSymbolTable<asCScriptFunction> registeredGlobalFuncs;
asCArray<asCScriptFunction *> registeredFuncDefs;
asCArray<asCObjectType *> registeredTemplateTypes;
asCScriptFunction *stringFactory;
asCArray<asCFuncdefType *> registeredFuncDefs; // doesn't increase ref count
asCArray<asCObjectType *> registeredTemplateTypes; // doesn't increase ref count
asIStringFactory *stringFactory;
asCDataType stringType;
bool configFailed;
// Stores all registered types except funcdefs
asCMap<asSNameSpaceNamePair, asCObjectType*> allRegisteredTypes; // increases ref count
// Stores all registered types
asCMap<asSNameSpaceNamePair, asCTypeInfo*> allRegisteredTypes; // increases ref count
// Dummy types used to name the subtypes in the template objects
asCArray<asCObjectType *> templateSubTypes;
// Dummy types used to name the subtypes in the template objects
asCArray<asCTypeInfo *> templateSubTypes;
// Store information about template types
// This list will contain all instances of templates, both registered specialized
// This list will contain all instances of templates, both registered specialized
// types and those automacially instantiated from scripts
asCArray<asCObjectType *> templateInstanceTypes; // increases ref count
@@ -378,7 +372,7 @@ public:
// This array holds all live script modules
asCArray<asCModule *> scriptModules;
// Synchronized with engineRWLock
// This is a pointer to the last module that was requested. It is used for performance
// This is a pointer to the last module that was requested. It is used for performance
// improvement, since it is common that the same module is accessed many times in a row
asCModule *lastModule;
// Synchronized with engineRWLock
@@ -389,29 +383,28 @@ public:
// This array holds modules that have been discard (thus are no longer visible to the application)
// but cannot yet be deleted due to having external references to some of the entities in them
asCArray<asCModule *> discardedModules;
// This flag is set to true during compilations of scripts (or loading pre-compiled scripts)
// to delay the validation of template types until the subtypes have been fully declared
// This flag is set to true during compilations of scripts (or loading pre-compiled scripts)
// to delay the validation of template types until the subtypes have been fully declared
bool deferValidationOfTemplateTypes;
// Tokenizer is instantiated once to share resources
asCTokenizer tok;
// Stores shared script declared types (classes, interfaces, enums)
asCArray<asCObjectType *> sharedScriptTypes; // increases ref count
asCArray<asCTypeInfo *> sharedScriptTypes; // increases ref count
// This array stores the template instances types that have been automatically generated from template types
asCArray<asCObjectType *> generatedTemplateTypes;
// Stores the funcdefs
// TODO: redesign: Only shared funcdefs should be stored here
// a funcdef becomes shared if all arguments and the return type are shared (or application registered)
asCArray<asCScriptFunction *> funcDefs; // doesn't increase ref count
asCArray<asCFuncdefType *> funcDefs; // doesn't increases ref count
// Stores the names of the script sections for debugging purposes
asCArray<asCString *> scriptSectionNames;
// Type identifiers
mutable int typeIdSeqNbr;
mutable asCMap<int, asCObjectType*> mapTypeIdToObjectType;
mutable asCMap<int, asCScriptFunction*> mapTypeIdToFunction;
mutable asCMap<int, asCTypeInfo*> mapTypeIdToTypeInfo;
// Garbage collector
asCGarbageCollector gc;
@@ -441,16 +434,10 @@ public:
asIJITCompiler *jitCompiler;
// Namespaces
// These are shared between all entities and are
// These are shared between all entities and are
// only deleted once the engine is destroyed
asCArray<asSNameSpace*> nameSpaces;
// String constants
// These are shared between all scripts and are
// only deleted once the engine is destroyed
asCArray<asCString*> stringConstants;
asCMap<asCStringPointer, int> stringToIdMap;
// Callbacks for context pooling
asREQUESTCONTEXTFUNC_t requestCtxFunc;
asRETURNCONTEXTFUNC_t returnCtxFunc;
@@ -459,16 +446,16 @@ public:
// User data
asCArray<asPWORD> userData;
struct SEngineClean { asPWORD type; asCLEANENGINEFUNC_t cleanFunc; };
struct SEngineClean { asPWORD type; asCLEANENGINEFUNC_t cleanFunc; };
asCArray<SEngineClean> cleanEngineFuncs;
struct SModuleClean { asPWORD type; asCLEANMODULEFUNC_t cleanFunc; };
struct SModuleClean { asPWORD type; asCLEANMODULEFUNC_t cleanFunc; };
asCArray<SModuleClean> cleanModuleFuncs;
struct SContextClean { asPWORD type; asCLEANCONTEXTFUNC_t cleanFunc; };
struct SContextClean { asPWORD type; asCLEANCONTEXTFUNC_t cleanFunc; };
asCArray<SContextClean> cleanContextFuncs;
struct SFunctionClean { asPWORD type; asCLEANFUNCTIONFUNC_t cleanFunc; };
struct SFunctionClean { asPWORD type; asCLEANFUNCTIONFUNC_t cleanFunc; };
asCArray<SFunctionClean> cleanFunctionFuncs;
struct SObjTypeClean { asPWORD type; asCLEANOBJECTTYPEFUNC_t cleanFunc; };
asCArray<SObjTypeClean> cleanObjectTypeFuncs;
struct STypeInfoClean { asPWORD type; asCLEANTYPEINFOFUNC_t cleanFunc; };
asCArray<STypeInfoClean> cleanTypeInfoFuncs;
struct SScriptObjClean { asPWORD type; asCLEANSCRIPTOBJECTFUNC_t cleanFunc; };
asCArray<SScriptObjClean> cleanScriptObjectFuncs;
@@ -504,12 +491,15 @@ public:
bool disallowEmptyListElements;
// TODO: 3.0.0: Remove the privatePropAsProtected
bool privatePropAsProtected;
bool allowUnicodeIdentifiers;
int heredocTrimMode;
asUINT maxNestedCalls;
} ep;
// This flag is to allow a quicker shutdown when releasing the engine
bool shuttingDown;
// This flag is set when the engine's destructor is called, this is to
// This flag is set when the engine's destructor is called, this is to
// avoid recursive calls if an object happens to increment/decrement
// the ref counter during shutdown
bool inDestructor;