| AngelScript

Classes | Macros | Typedefs | Enumerations | Functions | Variables
angelscript.h File Reference

The API definition for AngelScript. More...

## Classes
struct | asSFuncPtr
| Represents a function or method pointer. More...
struct | asSMessageInfo
| Represents a compiler message. More...
class | asIScriptEngine
| The engine interface. More...
class | asIThreadManager
| The interface for the thread manager. More...
class | asIScriptModule
| The interface to the script modules. More...
class | asIScriptContext
| The interface to the virtual machine. More...
class | asIScriptGeneric
| The interface for the generic calling convention. More...
class | asIScriptObject
| The interface for an instance of a script object. More...
class | asIObjectType
| The interface for an object type. More...
class | asIScriptFunction
| The interface for a script function description. More...
class | asIBinaryStream
| A binary stream interface. More...
class | asILockableSharedBool
| A lockable shared boolean. More...
struct | asSVMRegisters
| A struct with registers from the VM sent to a JIT compiled function. More...
class | asIJITCompiler
| The interface that AS use to interact with the JIT compiler. More...
struct | asSBCInfo
| Information on a bytecode instruction. More...

## Macros
#define | ANGELSCRIPT_VERSION 22901
| Version 2.29.1.
#define | AS_CAN_USE_CPP11 1
| This macro is defined if the compiler supports the C++11 feature set.
#define | asOFFSET(s, m) ((size_t)(&reinterpret_cast<s*>(100000)->m)-100000)
| Returns the offset of an attribute in a struct.
#define | asFUNCTION(f) asFunctionPtr(f)
| Returns an asSFuncPtr representing the function specified by the name.
#define | asFUNCTIONPR(f, p, r) asFunctionPtr((void (*)())(static_cast<r (*)p>(f)))
| Returns an asSFuncPtr representing the function specified by the name, parameter list, and return type.
#define | asMETHOD(c, m) asSMethodPtr<sizeof(void (c::*)())>::Convert((void (c::*)())(&c::m))
| Returns an asSFuncPtr representing the class method specified by class and method name.
#define | asMETHODPR(c, m, p, r) asSMethodPtr<sizeof(void (c::*)())>::Convert(AS_METHOD_AMBIGUITY_CAST(r (c::*)p)(&c::m))
| Returns an asSFuncPtr representing the class method specified by class, method name, parameter list, return type.
#define | AS_API
| A define that specifies how the function should be imported.
#define | asBC_DWORDARG(x) (*(((asDWORD*)x)+1))
| Macro to access the first DWORD argument in the bytecode instruction.
#define | asBC_INTARG(x) (*(int*)(((asDWORD*)x)+1))
| Macro to access the first 32bit integer argument in the bytecode instruction.
#define | asBC_QWORDARG(x) (*(asQWORD*)(((asDWORD*)x)+1))
| Macro to access the first QWORD argument in the bytecode instruction.
#define | asBC_FLOATARG(x) (*(float*)(((asDWORD*)x)+1))
| Macro to access the first float argument in the bytecode instruction.
#define | asBC_PTRARG(x) (*(asPWORD*)(((asDWORD*)x)+1))
| Macro to access the first pointer argument in the bytecode instruction.
#define | asBC_WORDARG0(x) (*(((asWORD*)x)+1))
| Macro to access the first WORD argument in the bytecode instruction.
#define | asBC_WORDARG1(x) (*(((asWORD*)x)+2))
| Macro to access the second WORD argument in the bytecode instruction.
#define | asBC_SWORDARG0(x) (*(((short*)x)+1))
| Macro to access the first signed WORD argument in the bytecode instruction.
#define | asBC_SWORDARG1(x) (*(((short*)x)+2))
| Macro to access the second signed WORD argument in the bytecode instruction.
#define | asBC_SWORDARG2(x) (*(((short*)x)+3))
| Macro to access the third signed WORD argument in the bytecode instruction.

## Typedefs
typedef unsigned char | asBYTE
| 8 bit unsigned integer
typedef unsigned short | asWORD
| 16 bit unsigned integer
typedef unsigned int | asUINT
| 32 bit unsigned integer
typedef uintptr_t | asPWORD
| Unsigned integer with the size of a pointer.
typedef unsigned long | asDWORD
| 32 bit unsigned integer
typedef unsigned __int64 | asQWORD
| 64 bit unsigned integer
typedef __int64 | asINT64
| 64 bit integer
typedef void *(* | asALLOCFUNC_t )(size_t)
| The function signature for the custom memory allocation function.
typedef void(* | asFREEFUNC_t )(void *)
| The function signature for the custom memory deallocation function.
typedef void(* | asCLEANENGINEFUNC_t )(asIScriptEngine *)
| The function signature for the engine cleanup callback function.
typedef void(* | asCLEANMODULEFUNC_t )(asIScriptModule *)
| The function signature for the module cleanup callback function.
typedef void(* | asCLEANCONTEXTFUNC_t )(asIScriptContext *)
| The function signature for the context cleanup callback function.
typedef void(* | asCLEANFUNCTIONFUNC_t )(asIScriptFunction *)
| The function signature for the function cleanup callback function.
typedef void(* | asCLEANOBJECTTYPEFUNC_t )(asIObjectType *)
| The function signature for the object type cleanup callback function.
typedef asIScriptContext *(* | asREQUESTCONTEXTFUNC_t )(asIScriptEngine *, void *)
| The function signature for the request context callback.
typedef void(* | asRETURNCONTEXTFUNC_t )(asIScriptEngine *, asIScriptContext *, void *)
| The function signature for the return context callback.
typedef void(* | asJITFunction )(asSVMRegisters *registers, asPWORD jitArg)
| The function signature of a JIT compiled function. More...

## Enumerations
enum | asERetCodes { asSUCCESS = 0, asERROR = -1, asCONTEXT_ACTIVE = -2, asCONTEXT_NOT_FINISHED = -3, asCONTEXT_NOT_PREPARED = -4, asINVALID_ARG = -5, asNO_FUNCTION = -6, asNOT_SUPPORTED = -7, asINVALID_NAME = -8, asNAME_TAKEN = -9, asINVALID_DECLARATION = -10, asINVALID_OBJECT = -11, asINVALID_TYPE = -12, asALREADY_REGISTERED = -13, asMULTIPLE_FUNCTIONS = -14, asNO_MODULE = -15, asNO_GLOBAL_VAR = -16, asINVALID_CONFIGURATION = -17, asINVALID_INTERFACE = -18, asCANT_BIND_ALL_FUNCTIONS = -19, asLOWER_ARRAY_DIMENSION_NOT_REGISTERED = -20, asWRONG_CONFIG_GROUP = -21, asCONFIG_GROUP_IS_IN_USE = -22, asILLEGAL_BEHAVIOUR_FOR_TYPE = -23, asWRONG_CALLING_CONV = -24, asBUILD_IN_PROGRESS = -25, asINIT_GLOBAL_VARS_FAILED = -26, asOUT_OF_MEMORY = -27 }
| Return codes. More...
enum | asEEngineProp { asEP_ALLOW_UNSAFE_REFERENCES = 1, asEP_OPTIMIZE_BYTECODE = 2, asEP_COPY_SCRIPT_SECTIONS = 3, asEP_MAX_STACK_SIZE = 4, asEP_USE_CHARACTER_LITERALS = 5, asEP_ALLOW_MULTILINE_STRINGS = 6, asEP_ALLOW_IMPLICIT_HANDLE_TYPES = 7, asEP_BUILD_WITHOUT_LINE_CUES = 8, asEP_INIT_GLOBAL_VARS_AFTER_BUILD = 9, asEP_REQUIRE_ENUM_SCOPE = 10, asEP_SCRIPT_SCANNER = 11, asEP_INCLUDE_JIT_INSTRUCTIONS = 12, asEP_STRING_ENCODING = 13, asEP_PROPERTY_ACCESSOR_MODE = 14, asEP_EXPAND_DEF_ARRAY_TO_TMPL = 15, asEP_AUTO_GARBAGE_COLLECT = 16, asEP_DISALLOW_GLOBAL_VARS = 17, asEP_ALWAYS_IMPL_DEFAULT_CONSTRUCT = 18, asEP_COMPILER_WARNINGS = 19, asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE = 20, asEP_ALTER_SYNTAX_NAMED_ARGS = 21, asEP_DISABLE_INTEGER_DIVISION = 22 }
| Engine properties. More...
enum | asECallConvTypes { asCALL_CDECL = 0, asCALL_STDCALL = 1, asCALL_THISCALL_ASGLOBAL = 2, asCALL_THISCALL = 3, asCALL_CDECL_OBJLAST = 4, asCALL_CDECL_OBJFIRST = 5, asCALL_GENERIC = 6, asCALL_THISCALL_OBJLAST = 7, asCALL_THISCALL_OBJFIRST = 8 }
| Calling conventions. More...
enum | asEObjTypeFlags { asOBJ_REF = (1<<0), asOBJ_VALUE = (1<<1), asOBJ_GC = (1<<2), asOBJ_POD = (1<<3), asOBJ_NOHANDLE = (1<<4), asOBJ_SCOPED = (1<<5), asOBJ_TEMPLATE = (1<<6), asOBJ_ASHANDLE = (1<<7), asOBJ_APP_CLASS = (1<<8), asOBJ_APP_CLASS_CONSTRUCTOR = (1<<9), asOBJ_APP_CLASS_DESTRUCTOR = (1<<10), asOBJ_APP_CLASS_ASSIGNMENT = (1<<11), asOBJ_APP_CLASS_COPY_CONSTRUCTOR = (1<<12), asOBJ_APP_CLASS_C = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR), asOBJ_APP_CLASS_CD = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR), asOBJ_APP_CLASS_CA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_CLASS_CK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_CLASS_CDA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_CLASS_CDK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_CLASS_CAK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_CLASS_CDAK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_CLASS_D = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR), asOBJ_APP_CLASS_DA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_CLASS_DK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_CLASS_DAK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_CLASS_A = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_CLASS_AK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_CLASS_K = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_COPY_CONSTRUCTOR), asOBJ_APP_PRIMITIVE = (1<<13), asOBJ_APP_FLOAT = (1<<14), asOBJ_APP_ARRAY = (1<<15), asOBJ_APP_CLASS_ALLINTS = (1<<16), asOBJ_APP_CLASS_ALLFLOATS = (1<<17), asOBJ_NOCOUNT = (1<<18), asOBJ_APP_CLASS_ALIGN8 = (1<<19) , asOBJ_SCRIPT_OBJECT = (1<<20), asOBJ_SHARED = (1<<21), asOBJ_NOINHERIT = (1<<22), asOBJ_SCRIPT_FUNCTION = (1<<23), asOBJ_IMPLICIT_HANDLE = (1<<24) }
| Object type flags. More...
enum | asEBehaviours { asBEHAVE_CONSTRUCT, asBEHAVE_LIST_CONSTRUCT, asBEHAVE_DESTRUCT, asBEHAVE_FACTORY, asBEHAVE_LIST_FACTORY, asBEHAVE_ADDREF, asBEHAVE_RELEASE, asBEHAVE_GET_WEAKREF_FLAG, asBEHAVE_VALUE_CAST, asBEHAVE_IMPLICIT_VALUE_CAST, asBEHAVE_REF_CAST, asBEHAVE_IMPLICIT_REF_CAST, asBEHAVE_TEMPLATE_CALLBACK , asBEHAVE_GETREFCOUNT = asBEHAVE_FIRST_GC, asBEHAVE_SETGCFLAG, asBEHAVE_GETGCFLAG, asBEHAVE_ENUMREFS, asBEHAVE_RELEASEREFS }
| Behaviours. More...
enum | asEContextState { asEXECUTION_FINISHED = 0, asEXECUTION_SUSPENDED = 1, asEXECUTION_ABORTED = 2, asEXECUTION_EXCEPTION = 3, asEXECUTION_PREPARED = 4, asEXECUTION_UNINITIALIZED = 5, asEXECUTION_ACTIVE = 6, asEXECUTION_ERROR = 7 }
| Context states. More...
enum | asEMsgType { asMSGTYPE_ERROR = 0, asMSGTYPE_WARNING = 1, asMSGTYPE_INFORMATION = 2 }
| Compiler message types. More...
enum | asEGCFlags { asGC_FULL_CYCLE = 1, asGC_ONE_STEP = 2, asGC_DESTROY_GARBAGE = 4, asGC_DETECT_GARBAGE = 8 }
| Garbage collector flags. More...
enum | asETokenClass { asTC_UNKNOWN = 0, asTC_KEYWORD = 1, asTC_VALUE = 2, asTC_IDENTIFIER = 3, asTC_COMMENT = 4, asTC_WHITESPACE = 5 }
| Token classes. More...
enum | asETypeIdFlags { asTYPEID_VOID = 0, asTYPEID_BOOL = 1, asTYPEID_INT8 = 2, asTYPEID_INT16 = 3, asTYPEID_INT32 = 4, asTYPEID_INT64 = 5, asTYPEID_UINT8 = 6, asTYPEID_UINT16 = 7, asTYPEID_UINT32 = 8, asTYPEID_UINT64 = 9, asTYPEID_FLOAT = 10, asTYPEID_DOUBLE = 11, asTYPEID_OBJHANDLE = 0x40000000, asTYPEID_HANDLETOCONST = 0x20000000, asTYPEID_MASK_OBJECT = 0x1C000000, asTYPEID_APPOBJECT = 0x04000000, asTYPEID_SCRIPTOBJECT = 0x08000000, asTYPEID_TEMPLATE = 0x10000000, asTYPEID_MASK_SEQNBR = 0x03FFFFFF }
| Type id flags. More...
enum | asETypeModifiers { asTM_NONE = 0, asTM_INREF = 1, asTM_OUTREF = 2, asTM_INOUTREF = 3, asTM_CONST = 4 }
| Type modifiers. More...
enum | asEGMFlags { asGM_ONLY_IF_EXISTS = 0, asGM_CREATE_IF_NOT_EXISTS = 1, asGM_ALWAYS_CREATE = 2 }
| Flags for GetModule. More...
enum | asECompileFlags { asCOMP_ADD_TO_MODULE = 1 }
| Flags for compilation. More...
enum | asEFuncType { , asFUNC_SYSTEM = 0, asFUNC_SCRIPT = 1, asFUNC_INTERFACE = 2, asFUNC_VIRTUAL = 3, asFUNC_FUNCDEF = 4, asFUNC_IMPORTED = 5, asFUNC_DELEGATE = 6 }
| Function types. More...
enum | asEBCInstr { asBC_PopPtr = 0, asBC_PshGPtr = 1, asBC_PshC4 = 2, asBC_PshV4 = 3, asBC_PSF = 4, asBC_SwapPtr = 5, asBC_NOT = 6, asBC_PshG4 = 7, asBC_LdGRdR4 = 8, asBC_CALL = 9, asBC_RET = 10, asBC_JMP = 11, asBC_JZ = 12, asBC_JNZ = 13, asBC_JS = 14, asBC_JNS = 15, asBC_JP = 16, asBC_JNP = 17, asBC_TZ = 18, asBC_TNZ = 19, asBC_TS = 20, asBC_TNS = 21, asBC_TP = 22, asBC_TNP = 23, asBC_NEGi = 24, asBC_NEGf = 25, asBC_NEGd = 26, asBC_INCi16 = 27, asBC_INCi8 = 28, asBC_DECi16 = 29, asBC_DECi8 = 30, asBC_INCi = 31, asBC_DECi = 32, asBC_INCf = 33, asBC_DECf = 34, asBC_INCd = 35, asBC_DECd = 36, asBC_IncVi = 37, asBC_DecVi = 38, asBC_BNOT = 39, asBC_BAND = 40, asBC_BOR = 41, asBC_BXOR = 42, asBC_BSLL = 43, asBC_BSRL = 44, asBC_BSRA = 45, asBC_COPY = 46, asBC_PshC8 = 47, asBC_PshVPtr = 48, asBC_RDSPtr = 49, asBC_CMPd = 50, asBC_CMPu = 51, asBC_CMPf = 52, asBC_CMPi = 53, asBC_CMPIi = 54, asBC_CMPIf = 55, asBC_CMPIu = 56, asBC_JMPP = 57, asBC_PopRPtr = 58, asBC_PshRPtr = 59, asBC_STR = 60, asBC_CALLSYS = 61, asBC_CALLBND = 62, asBC_SUSPEND = 63, asBC_ALLOC = 64, asBC_FREE = 65, asBC_LOADOBJ = 66, asBC_STOREOBJ = 67, asBC_GETOBJ = 68, asBC_REFCPY = 69, asBC_CHKREF = 70, asBC_GETOBJREF = 71, asBC_GETREF = 72, asBC_PshNull = 73, asBC_ClrVPtr = 74, asBC_OBJTYPE = 75, asBC_TYPEID = 76, asBC_SetV4 = 77, asBC_SetV8 = 78, asBC_ADDSi = 79, asBC_CpyVtoV4 = 80, asBC_CpyVtoV8 = 81, asBC_CpyVtoR4 = 82, asBC_CpyVtoR8 = 83, asBC_CpyVtoG4 = 84, asBC_CpyRtoV4 = 85, asBC_CpyRtoV8 = 86, asBC_CpyGtoV4 = 87, asBC_WRTV1 = 88, asBC_WRTV2 = 89, asBC_WRTV4 = 90, asBC_WRTV8 = 91, asBC_RDR1 = 92, asBC_RDR2 = 93, asBC_RDR4 = 94, asBC_RDR8 = 95, asBC_LDG = 96, asBC_LDV = 97, asBC_PGA = 98, asBC_CmpPtr = 99, asBC_VAR = 100, asBC_iTOf = 101, asBC_fTOi = 102, asBC_uTOf = 103, asBC_fTOu = 104, asBC_sbTOi = 105, asBC_swTOi = 106, asBC_ubTOi = 107, asBC_uwTOi = 108, asBC_dTOi = 109, asBC_dTOu = 110, asBC_dTOf = 111, asBC_iTOd = 112, asBC_uTOd = 113, asBC_fTOd = 114, asBC_ADDi = 115, asBC_SUBi = 116, asBC_MULi = 117, asBC_DIVi = 118, asBC_MODi = 119, asBC_ADDf = 120, asBC_SUBf = 121, asBC_MULf = 122, asBC_DIVf = 123, asBC_MODf = 124, asBC_ADDd = 125, asBC_SUBd = 126, asBC_MULd = 127, asBC_DIVd = 128, asBC_MODd = 129, asBC_ADDIi = 130, asBC_SUBIi = 131, asBC_MULIi = 132, asBC_ADDIf = 133, asBC_SUBIf = 134, asBC_MULIf = 135, asBC_SetG4 = 136, asBC_ChkRefS = 137, asBC_ChkNullV = 138, asBC_CALLINTF = 139, asBC_iTOb = 140, asBC_iTOw = 141, asBC_SetV1 = 142, asBC_SetV2 = 143, asBC_Cast = 144, asBC_i64TOi = 145, asBC_uTOi64 = 146, asBC_iTOi64 = 147, asBC_fTOi64 = 148, asBC_dTOi64 = 149, asBC_fTOu64 = 150, asBC_dTOu64 = 151, asBC_i64TOf = 152, asBC_u64TOf = 153, asBC_i64TOd = 154, asBC_u64TOd = 155, asBC_NEGi64 = 156, asBC_INCi64 = 157, asBC_DECi64 = 158, asBC_BNOT64 = 159, asBC_ADDi64 = 160, asBC_SUBi64 = 161, asBC_MULi64 = 162, asBC_DIVi64 = 163, asBC_MODi64 = 164, asBC_BAND64 = 165, asBC_BOR64 = 166, asBC_BXOR64 = 167, asBC_BSLL64 = 168, asBC_BSRL64 = 169, asBC_BSRA64 = 170, asBC_CMPi64 = 171, asBC_CMPu64 = 172, asBC_ChkNullS = 173, asBC_ClrHi = 174, asBC_JitEntry = 175, asBC_CallPtr = 176, asBC_FuncPtr = 177, asBC_LoadThisR = 178, asBC_PshV8 = 179, asBC_DIVu = 180, asBC_MODu = 181, asBC_DIVu64 = 182, asBC_MODu64 = 183, asBC_LoadRObjR = 184, asBC_LoadVObjR = 185, asBC_RefCpyV = 186, asBC_JLowZ = 187, asBC_JLowNZ = 188, asBC_AllocMem = 189, asBC_SetListSize = 190, asBC_PshListElmnt = 191, asBC_SetListType = 192, asBC_POWi = 193, asBC_POWu = 194, asBC_POWf = 195, asBC_POWd = 196, asBC_POWdi = 197, asBC_POWi64 = 198, asBC_POWu64 = 199 }
| The bytecode instructions used by the VM. More...
enum | asEBCType { , asBCTYPE_NO_ARG = 1, asBCTYPE_W_ARG = 2, asBCTYPE_wW_ARG = 3, asBCTYPE_DW_ARG = 4, asBCTYPE_rW_DW_ARG = 5, asBCTYPE_QW_ARG = 6, asBCTYPE_DW_DW_ARG = 7, asBCTYPE_wW_rW_rW_ARG = 8, asBCTYPE_wW_QW_ARG = 9, asBCTYPE_wW_rW_ARG = 10, asBCTYPE_rW_ARG = 11, asBCTYPE_wW_DW_ARG = 12, asBCTYPE_wW_rW_DW_ARG = 13, asBCTYPE_rW_rW_ARG = 14, asBCTYPE_wW_W_ARG = 15, asBCTYPE_QW_DW_ARG = 16, asBCTYPE_rW_QW_ARG = 17, asBCTYPE_W_DW_ARG = 18, asBCTYPE_rW_W_DW_ARG = 19, asBCTYPE_rW_DW_DW_ARG = 20 }
| Describes the structure of a bytecode instruction. More...

## Functions
AS_API asIScriptEngine * | asCreateScriptEngine (asDWORD version)
| Creates the script engine. More...
AS_API const char * | asGetLibraryVersion ()
| Returns the version of the compiled library. More...
AS_API const char * | asGetLibraryOptions ()
| Returns the options used to compile the library. More...
AS_API asIScriptContext * | asGetActiveContext ()
| Returns the currently active context. More...
AS_API int | asPrepareMultithread (asIThreadManager *externalMgr=0)
| Sets up the internally shared resources for multithreading. More...
AS_API void | asUnprepareMultithread ()
| Frees resources prepared for multithreading. More...
AS_API asIThreadManager * | asGetThreadManager ()
| Get the thread manager used by the application. More...
AS_API void | asAcquireExclusiveLock ()
| Acquire an exclusive lock. More...
AS_API void | asReleaseExclusiveLock ()
| Release an exclusive lock. More...
AS_API void | asAcquireSharedLock ()
| Acquire a shared lock. More...
AS_API void | asReleaseSharedLock ()
| Release a shared lock. More...
AS_API int | asAtomicInc (int &value)
| Increments the value by one and returns the result as a single atomic instruction. More...
AS_API int | asAtomicDec (int &value)
| Decrements the value by one and returns the result as a single atomic instruction. More...
AS_API int | asThreadCleanup ()
| Cleans up memory allocated for the current thread. More...
AS_API int | asSetGlobalMemoryFunctions (asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc)
| Set the memory management functions that AngelScript should use. More...
AS_API int | asResetGlobalMemoryFunctions ()
| Remove previously registered memory management functions. More...
AS_API void * | asAllocMem (size_t size)
| Allocate memory using the memory function registered with AngelScript. More...
AS_API void | asFreeMem (void *mem)
| Deallocates memory using the memory function registered with AngelScript. More...
AS_API asILockableSharedBool * | asCreateLockableSharedBool ()
| Create a lockable shared boolean. More...
template<typename T >
asUINT | asGetTypeTraits ()
| Returns the appropriate flags for use with RegisterObjectType. More...

## Variables
const int | asBCTypeSize [21]
| Lookup table for determining the size of each type of bytecode instruction.
const asSBCInfo | asBCInfo [256]
| Information on each bytecode instruction.

## Detailed Description

This header file describes the complete application programming interface for AngelScript.

## Typedef Documentation

typedef void(* asJITFunction)(asSVMRegisters *registers, asPWORD jitArg)

Parameters

  [in] | registers | A pointer to the virtual machine's registers.
  [in] | jitArg | The value defined by the JIT compiler for the current entry point in the JIT function.

A JIT function receives a pointer to the virtual machine's registers when called and an argument telling it where in the script function to continue the execution. The JIT function must make sure to update the VM's registers according to the actions performed before returning control to the VM.

See Also
  How to build a JIT compiler

## Enumeration Type Documentation

enum asEBCInstr

See Also
  Byte code instructions

Enumerator
asBC_PopPtr | Removes a pointer from the stack.
asBC_PshGPtr | Pushes a pointer from a global variable onto the stack.
asBC_PshC4 | Push the 32bit value in the argument onto the stack.
asBC_PshV4 | Push the 32bit value from a variable onto the stack.
asBC_PSF | Push the address of the stack frame onto the stack.
asBC_SwapPtr | Swap the top two pointers on the stack.
asBC_NOT | Perform a boolean not on the value in a variable.
asBC_PshG4 | Push the 32bit value from a global variable onto the stack.
asBC_LdGRdR4 | Perform the actions of asBC_LDG followed by asBC_RDR4.
asBC_CALL | Jump to a script function, indexed by the argument.
asBC_RET | Return to the instruction after the last executed call.
asBC_JMP | Unconditional jump to a relative position in this function.
asBC_JZ | If the value register is 0 jump to a relative position in this function.
asBC_JNZ | If the value register is not 0 jump to a relative position in this function.
asBC_JS | If the value register is less than 0 jump to a relative position in this function.
asBC_JNS | If the value register is greater than or equal to 0 jump to a relative position in this function.
asBC_JP | If the value register is greater than 0 jump to a relative position in this function.
asBC_JNP | If the value register is less than or equal to 0 jump to a relative position in this function.
asBC_TZ | If the value register is 0 set it to 1.
asBC_TNZ | If the value register is not 0 set it to 1.
asBC_TS | If the value register is less than 0 set it to 1.
asBC_TNS | If the value register is greater than or equal to 0 set it to 1.
asBC_TP | If the value register is greater than 0 set it to 1.
asBC_TNP | If the value register is less than or equal to 0 set it to 1.
asBC_NEGi | Negate the 32bit integer value in the variable.
asBC_NEGf | Negate the float value in the variable.
asBC_NEGd | Negate the double value in the variable.
asBC_INCi16 | Increment the 16bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_INCi8 | Increment the 8bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_DECi16 | Decrement the 16bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_DECi8 | Increment the 8bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_INCi | Increment the 32bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_DECi | Decrement the 32bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_INCf | Increment the float value that is stored at the address pointed to by the reference in the value register.
asBC_DECf | Decrement the float value that is stored at the address pointed to by the reference in the value register.
asBC_INCd | Increment the double value that is stored at the address pointed to by the reference in the value register.
asBC_DECd | Decrement the double value that is stored at the address pointed to by the reference in the value register.
asBC_IncVi | Increment the 32bit integer value in the variable.
asBC_DecVi | Decrement the 32bit integer value in the variable.
asBC_BNOT | Perform a bitwise complement on the 32bit value in the variable.
asBC_BAND | Perform a bitwise and of two 32bit values and store the result in a third variable.
asBC_BOR | Perform a bitwise or of two 32bit values and store the result in a third variable.
asBC_BXOR | Perform a bitwise exclusive or of two 32bit values and store the result in a third variable.
asBC_BSLL | Perform a logical left shift of a 32bit value and store the result in a third variable.
asBC_BSRL | Perform a logical right shift of a 32bit value and store the result in a third variable.
asBC_BSRA | Perform a arithmetical right shift of a 32bit value and store the result in a third variable.
asBC_COPY | Pop the destination and source addresses from the stack. Perform a bitwise copy of the referred object. Push the destination address on the stack.
asBC_PshC8 | Push a 64bit value on the stack.
asBC_PshVPtr | Push a pointer from the variable on the stack.
asBC_RDSPtr | Pop top address, read a pointer from it, and push the pointer onto the stack.
asBC_CMPd | Compare two double variables and store the result in the value register.
asBC_CMPu | Compare two unsigned 32bit integer variables and store the result in the value register.
asBC_CMPf | Compare two float variables and store the result in the value register.
asBC_CMPi | Compare two 32bit integer variables and store the result in the value register.
asBC_CMPIi | Compare 32bit integer variable with constant and store the result in value register.
asBC_CMPIf | Compare float variable with constant and store the result in value register.
asBC_CMPIu | Compare unsigned 32bit integer variable with constant and store the result in value register.
asBC_JMPP | Jump to relative position in the function where the offset is stored in a variable.
asBC_PopRPtr | Pop a pointer from the stack and store it in the value register.
asBC_PshRPtr | Push a pointer from the value register onto the stack.
asBC_STR | Push string address and length on the stack.
asBC_CALLSYS | Call registered function. Suspend further execution if requested.
asBC_CALLBND | Jump to an imported script function, indexed by the argument.
asBC_SUSPEND | Call line callback function if set. Suspend execution if requested.
asBC_ALLOC | Allocate the memory for the object. If the type is a script object then jump to the constructor, else call the registered constructor behaviour. Suspend further execution if requested.
asBC_FREE | Pop the address of the object variable from the stack. If ref type, call the release method, else call the destructor then free the memory. Clear the pointer in the variable.
asBC_LOADOBJ | Copy the object pointer from a variable to the object register. Clear the variable.
asBC_STOREOBJ | Copy the object pointer from the object register to the variable. Clear the object register.
asBC_GETOBJ | Move object pointer from variable onto stack location.
asBC_REFCPY | Pop destination handle reference. Perform a handle assignment, while updating the reference count for both previous and new objects.
asBC_CHKREF | Throw an exception if the pointer on the top of the stack is null.
asBC_GETOBJREF | Replace a variable index on the stack with the object handle stored in that variable.
asBC_GETREF | Replace a variable index on the stack with the address of the variable.
asBC_PshNull | Push a null pointer on the stack.
asBC_ClrVPtr | Clear pointer in a variable.
asBC_OBJTYPE | Push the pointer argument onto the stack. The pointer is a pointer to an object type structure.
asBC_TYPEID | Push the type id onto the stack. Equivalent to PshC4.
asBC_SetV4 | Initialize the variable with a DWORD.
asBC_SetV8 | Initialize the variable with a QWORD.
asBC_ADDSi | Add a value to the top pointer on the stack, thus updating the address itself.
asBC_CpyVtoV4 | Copy a DWORD from one variable to another.
asBC_CpyVtoV8 | Copy a QWORD from one variable to another.
asBC_CpyVtoR4 | Copy a DWORD from a variable into the value register.
asBC_CpyVtoR8 | Copy a QWORD from a variable into the value register.
asBC_CpyVtoG4 | Copy a DWORD from a local variable to a global variable.
asBC_CpyRtoV4 | Copy a DWORD from the value register into a variable.
asBC_CpyRtoV8 | Copy a QWORD from the value register into a variable.
asBC_CpyGtoV4 | Copy a DWORD from a global variable to a local variable.
asBC_WRTV1 | Copy a BYTE from a variable to the address held in the value register.
asBC_WRTV2 | Copy a WORD from a variable to the address held in the value register.
asBC_WRTV4 | Copy a DWORD from a variable to the address held in the value register.
asBC_WRTV8 | Copy a QWORD from a variable to the address held in the value register.
asBC_RDR1 | Copy a BYTE from address held in the value register to a variable. Clear the top bytes in the variable.
asBC_RDR2 | Copy a WORD from address held in the value register to a variable. Clear the top word in the variable.
asBC_RDR4 | Copy a DWORD from address held in the value register to a variable.
asBC_RDR8 | Copy a QWORD from address held in the value register to a variable.
asBC_LDG | Load the address of a global variable into the value register.
asBC_LDV | Load the address of a local variable into the value register.
asBC_PGA | Push the address of a global variable on the stack.
asBC_CmpPtr | Compare two pointers.
asBC_VAR | Push the index of the variable on the stack, with the size of a pointer.
asBC_iTOf | Convert the 32bit integer value to a float in the variable.
asBC_fTOi | Convert the float value to a 32bit integer in the variable.
asBC_uTOf | Convert the unsigned 32bit integer value to a float in the variable.
asBC_fTOu | Convert the float value to an unsigned 32bit integer in the variable.
asBC_sbTOi | Expand the low byte as a signed value to a full 32bit integer in the variable.
asBC_swTOi | Expand the low word as a signed value to a full 32bit integer in the variable.
asBC_ubTOi | Expand the low byte as an unsigned value to a full 32bit integer in the variable.
asBC_uwTOi | Expand the low word as an unsigned value to a full 32bit integer in the variable.
asBC_dTOi | Convert the double value in one variable to a 32bit integer in another variable.
asBC_dTOu | Convert the double value in one variable to a 32bit unsigned integer in another variable.
asBC_dTOf | Convert the double value in one variable to a float in another variable.
asBC_iTOd | Convert the 32bit integer value in one variable to a double in another variable.
asBC_uTOd | Convert the 32bit unsigned integer value in one variable to a double in another variable.
asBC_fTOd | Convert the float value in one variable to a double in another variable.
asBC_ADDi | Add the values of two 32bit integer variables and store in a third variable.
asBC_SUBi | Subtract the values of two 32bit integer variables and store in a third variable.
asBC_MULi | Multiply the values of two 32bit integer variables and store in a third variable.
asBC_DIVi | Divide the values of two 32bit integer variables and store in a third variable.
asBC_MODi | Calculate the modulo of values of two 32bit integer variables and store in a third variable.
asBC_ADDf | Add the values of two float variables and store in a third variable.
asBC_SUBf | Subtract the values of two float variables and store in a third variable.
asBC_MULf | Multiply the values of two float variables and store in a third variable.
asBC_DIVf | Divide the values of two float variables and store in a third variable.
asBC_MODf | Calculate the modulo of values of two float variables and store in a third variable.
asBC_ADDd | Add the values of two double variables and store in a third variable.
asBC_SUBd | Subtract the values of two double variables and store in a third variable.
asBC_MULd | Multiply the values of two double variables and store in a third variable.
asBC_DIVd | Divide the values of two double variables and store in a third variable.
asBC_MODd | Calculate the modulo of values of two double variables and store in a third variable.
asBC_ADDIi | Add a 32bit integer variable with a constant value and store the result in another variable.
asBC_SUBIi | Subtract a 32bit integer variable with a constant value and store the result in another variable.
asBC_MULIi | Multiply a 32bit integer variable with a constant value and store the result in another variable.
asBC_ADDIf | Add a float variable with a constant value and store the result in another variable.
asBC_SUBIf | Subtract a float variable with a constant value and store the result in another variable.
asBC_MULIf | Multiply a float variable with a constant value and store the result in another variable.
asBC_SetG4 | Set the value of global variable to a 32bit word.
asBC_ChkRefS | Throw an exception if the address stored on the stack points to a null pointer.
asBC_ChkNullV | Throw an exception if the variable is null.
asBC_CALLINTF | Jump to an interface method, indexed by the argument.
asBC_iTOb | Convert a 32bit integer in a variable to a byte, clearing the top bytes.
asBC_iTOw | Convert a 32bit integer in a variable to a word, clearing the top word.
asBC_SetV1 | Same as SetV4.
asBC_SetV2 | Same as SetV4.
asBC_Cast | Pop an object handle to a script class from the stack. Perform a dynamic cast on it and store the result in the object register.
asBC_i64TOi | Convert the 64bit integer value in one variable to a 32bit integer in another variable.
asBC_uTOi64 | Convert the 32bit unsigned integer value in one variable to a 64bit integer in another variable.
asBC_iTOi64 | Convert the 32bit integer value in one variable to a 64bit integer in another variable.
asBC_fTOi64 | Convert the float value in one variable to a 64bit integer in another variable.
asBC_dTOi64 | Convert the double value in the variable to a 64bit integer.
asBC_fTOu64 | Convert the float value in one variable to a 64bit unsigned integer in another variable.
asBC_dTOu64 | Convert the double value in the variable to a 64bit unsigned integer.
asBC_i64TOf | Convert the 64bit integer value in one variable to a float in another variable.
asBC_u64TOf | Convert the 64bit unsigned integer value in one variable to a float in another variable.
asBC_i64TOd | Convert the 32bit integer value in the variable to a double.
asBC_u64TOd | Convert the 32bit unsigned integer value in the variable to a double.
asBC_NEGi64 | Negate the 64bit integer value in the variable.
asBC_INCi64 | Increment the 64bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_DECi64 | Decrement the 64bit integer value that is stored at the address pointed to by the reference in the value register.
asBC_BNOT64 | Perform a bitwise complement on the 64bit value in the variable.
asBC_ADDi64 | Perform an addition with two 64bit integer variables and store the result in a third variable.
asBC_SUBi64 | Perform a subtraction with two 64bit integer variables and store the result in a third variable.
asBC_MULi64 | Perform a multiplication with two 64bit integer variables and store the result in a third variable.
asBC_DIVi64 | Perform a division with two 64bit integer variables and store the result in a third variable.
asBC_MODi64 | Perform the modulo operation with two 64bit integer variables and store the result in a third variable.
asBC_BAND64 | Perform a bitwise and of two 64bit values and store the result in a third variable.
asBC_BOR64 | Perform a bitwise or of two 64bit values and store the result in a third variable.
asBC_BXOR64 | Perform a bitwise exclusive or of two 64bit values and store the result in a third variable.
asBC_BSLL64 | Perform a logical left shift of a 64bit value and store the result in a third variable.
asBC_BSRL64 | Perform a logical right shift of a 64bit value and store the result in a third variable.
asBC_BSRA64 | Perform a arithmetical right shift of a 64bit value and store the result in a third variable.
asBC_CMPi64 | Compare two 64bit integer variables and store the result in the value register.
asBC_CMPu64 | Compare two unsigned 64bit integer variables and store the result in the value register.
asBC_ChkNullS | Check if a pointer on the stack is null, and if it is throw an exception. The argument is relative to the top of the stack.
asBC_ClrHi | Clear the upper bytes of the value register so that only the value in the lowest byte is kept.
asBC_JitEntry | If a JIT function is available and the argument is not 0 then call the JIT function.
asBC_CallPtr | Call a function stored in a local function pointer.
asBC_FuncPtr | Push a function pointer on the stack.
asBC_LoadThisR | Load the address to a property of the local object into the stack. PshV4 0, ADDSi x, PopRPtr.
asBC_PshV8 | Push the 64bit value from a variable onto the stack.
asBC_DIVu | Divide the values of two 32bit unsigned integer variables and store in a third variable.
asBC_MODu | Calculate the modulo of values of two 32bit unsigned integer variables and store in a third variable.
asBC_DIVu64 | Divide the values of two 64bit unsigned integer variables and store in a third variable.
asBC_MODu64 | Calculate the modulo of values of two 64bit unsigned integer variables and store in a third variable.
asBC_LoadRObjR | Load address of member of reference object into register.
asBC_LoadVObjR | Load address of member of value object into register.
asBC_RefCpyV | Copies a handle to a variable.
asBC_JLowZ | Jump if low byte of value register is 0.
asBC_JLowNZ | Jump if low byte of value register is not 0.
asBC_AllocMem | Allocates memory for an initialization list buffer.
asBC_SetListSize | Sets a repeat count in the list buffer.
asBC_PshListElmnt | Pushes the address of an element in the list buffer on the stack.
asBC_SetListType | Sets the type of the next element in the list buffer.
asBC_POWi | Computes the power of for two int values.
asBC_POWu | Computes the power of for two uint values.
asBC_POWf | Computes the power of for two float values.
asBC_POWd | Computes the power of for two double values.
asBC_POWdi | Computes the power of where base is a double and exponent is an int value.
asBC_POWi64 | Computes the power of for two int64 values.
asBC_POWu64 | Computes the power of for two uint64 values.

enum asEBCType

Enumerator
asBCTYPE_NO_ARG | Instruction + no args.
asBCTYPE_W_ARG | Instruction + WORD arg.
asBCTYPE_wW_ARG | Instruction + WORD arg (dest var)
asBCTYPE_DW_ARG | Instruction + DWORD arg.
asBCTYPE_rW_DW_ARG | Instruction + WORD arg (source var) + DWORD arg.
asBCTYPE_QW_ARG | Instruction + QWORD arg.
asBCTYPE_DW_DW_ARG | Instruction + DWORD arg + DWORD arg.
asBCTYPE_wW_rW_rW_ARG | Instruction + WORD arg (dest var) + WORD arg (source var) + WORD arg (source var)
asBCTYPE_wW_QW_ARG | Instruction + WORD arg (dest var) + QWORD arg.
asBCTYPE_wW_rW_ARG | Instruction + WORD arg (dest var) + WORD arg (source var)
asBCTYPE_rW_ARG | Instruction + WORD arg (source var)
asBCTYPE_wW_DW_ARG | Instruction + WORD arg (dest var) + DWORD arg.
asBCTYPE_wW_rW_DW_ARG | Instruction + WORD arg (dest var) + WORD arg (source var) + DWORD arg.
asBCTYPE_rW_rW_ARG | Instruction + WORD arg (source var) + WORD arg (source var)
asBCTYPE_wW_W_ARG | Instruction + WORD arg (dest var) + WORD arg.
asBCTYPE_QW_DW_ARG | Instruction + QWORD arg + DWORD arg.
asBCTYPE_rW_QW_ARG | Instruction + WORD arg (source var) + QWORD arg.
asBCTYPE_W_DW_ARG | Instruction + WORD arg + DWORD arg.
asBCTYPE_rW_W_DW_ARG | Instruction + WORD arg(source var) + WORD arg + DWORD arg.
asBCTYPE_rW_DW_DW_ARG | Instruction + WORD arg(source var) + DWORD arg + DWORD arg.

enum asEBehaviours

Enumerator
asBEHAVE_CONSTRUCT | Constructor.
asBEHAVE_LIST_CONSTRUCT | Constructor used exclusively for initialization lists.
asBEHAVE_DESTRUCT | Destructor.
asBEHAVE_FACTORY | Factory.
asBEHAVE_LIST_FACTORY | Factory used exclusively for initialization lists.
asBEHAVE_ADDREF | AddRef.
asBEHAVE_RELEASE | Release.
asBEHAVE_GET_WEAKREF_FLAG | Obtain weak ref flag.
asBEHAVE_VALUE_CAST | Explicit value cast operator.
asBEHAVE_IMPLICIT_VALUE_CAST | Implicit value cast operator.
asBEHAVE_REF_CAST | Explicit reference cast operator.
asBEHAVE_IMPLICIT_REF_CAST | Implicit reference cast operator.
asBEHAVE_TEMPLATE_CALLBACK | Callback for validating template instances.
asBEHAVE_GETREFCOUNT | (GC) Get reference count
asBEHAVE_SETGCFLAG | (GC) Set GC flag
asBEHAVE_GETGCFLAG | (GC) Get GC flag
asBEHAVE_ENUMREFS | (GC) Enumerate held references
asBEHAVE_RELEASEREFS | (GC) Release all references

enum asECallConvTypes

Enumerator
asCALL_CDECL | A cdecl function.
asCALL_STDCALL | A stdcall function.
asCALL_THISCALL_ASGLOBAL | A thiscall class method registered as a global function.
asCALL_THISCALL | A thiscall class method.
asCALL_CDECL_OBJLAST | A cdecl function that takes the object pointer as the last parameter.
asCALL_CDECL_OBJFIRST | A cdecl function that takes the object pointer as the first parameter.
asCALL_GENERIC | A function using the generic calling convention.
asCALL_THISCALL_OBJLAST | A thiscall class method registered as a functor object.
asCALL_THISCALL_OBJFIRST | A thiscall class method registered as a functor object.

enum asECompileFlags

Enumerator
asCOMP_ADD_TO_MODULE | The compiled function should be added to the scope of the module.

enum asEContextState

Enumerator
asEXECUTION_FINISHED | The context has successfully completed the execution.
asEXECUTION_SUSPENDED | The execution is suspended and can be resumed.
asEXECUTION_ABORTED | The execution was aborted by the application.
asEXECUTION_EXCEPTION | The execution was terminated by an unhandled script exception.
asEXECUTION_PREPARED | The context has been prepared for a new execution.
asEXECUTION_UNINITIALIZED | The context is not initialized.
asEXECUTION_ACTIVE | The context is currently executing a function call.
asEXECUTION_ERROR | The context has encountered an error and must be reinitialized.

enum asEEngineProp

Enumerator
asEP_ALLOW_UNSAFE_REFERENCES | Allow unsafe references. Default: false.
asEP_OPTIMIZE_BYTECODE | Optimize byte code. Default: true.
asEP_COPY_SCRIPT_SECTIONS | Copy script section memory. Default: true.
asEP_MAX_STACK_SIZE | Maximum stack size in bytes for script contexts. Default: 0 (no limit).
asEP_USE_CHARACTER_LITERALS | Interpret single quoted strings as character literals. Default: false.
asEP_ALLOW_MULTILINE_STRINGS | Allow linebreaks in string constants. Default: false.
asEP_ALLOW_IMPLICIT_HANDLE_TYPES | Allow script to declare implicit handle types. Default: false.
asEP_BUILD_WITHOUT_LINE_CUES | Remove SUSPEND instructions between each statement. Default: false.
asEP_INIT_GLOBAL_VARS_AFTER_BUILD | Initialize global variables after a build. Default: true.
asEP_REQUIRE_ENUM_SCOPE | When set the enum values must be prefixed with the enum type. Default: false.
asEP_SCRIPT_SCANNER | Select scanning method: 0 - ASCII, 1 - UTF8. Default: 1 (UTF8).
asEP_INCLUDE_JIT_INSTRUCTIONS | When set extra bytecode instructions needed for JIT compiled funcions will be included. Default: false.
asEP_STRING_ENCODING | Select string encoding for literals: 0 - UTF8/ASCII, 1 - UTF16. Default: 0 (UTF8)
asEP_PROPERTY_ACCESSOR_MODE | Enable or disable property accessors: 0 - no accessors, 1 - app registered accessors, 2 - app and script created accessors.
asEP_EXPAND_DEF_ARRAY_TO_TMPL | Format default array in template form in messages and declarations. Default: false.
asEP_AUTO_GARBAGE_COLLECT | Enable or disable automatic garbage collection. Default: true.
asEP_DISALLOW_GLOBAL_VARS | Disallow the use of global variables in the script. Default: false.
asEP_ALWAYS_IMPL_DEFAULT_CONSTRUCT | When true, the compiler will always provide a default constructor for script classes. Default: false.
asEP_COMPILER_WARNINGS | Set how warnings should be treated: 0 - dismiss, 1 - emit, 2 - treat as error.
asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE | Disallow value assignment for reference types to avoid ambiguity. Default: false.
asEP_ALTER_SYNTAX_NAMED_ARGS | Change the script syntax for named arguments: 0 - no change, 1 - accept = but warn, 2 - accept = without warning. Default: 0.
asEP_DISABLE_INTEGER_DIVISION | When true, the / and /= operators will perform floating-point division (i.e. 1/2 = 0.5 instead of 0). Default: false.

enum asEFuncType

Enumerator
asFUNC_SYSTEM | An application registered function.
asFUNC_SCRIPT | A script implemented function.
asFUNC_INTERFACE | An interface method.
asFUNC_VIRTUAL | A virtual method for script classes.
asFUNC_FUNCDEF | A function definition.
asFUNC_IMPORTED | An imported function.
asFUNC_DELEGATE | A function delegate.

enum asEGCFlags

Enumerator
asGC_FULL_CYCLE | Execute a full cycle.
asGC_ONE_STEP | Execute only one step.
asGC_DESTROY_GARBAGE | Destroy known garbage.
asGC_DETECT_GARBAGE | Detect garbage with circular references.

enum asEGMFlags

Enumerator
asGM_ONLY_IF_EXISTS | Don't return any module if it is not found.
asGM_CREATE_IF_NOT_EXISTS | Create the module if it doesn't exist.
asGM_ALWAYS_CREATE | Always create a new module, discarding the existing one.

enum asEMsgType

Enumerator
asMSGTYPE_ERROR | The message is an error.
asMSGTYPE_WARNING | The message is a warning.
asMSGTYPE_INFORMATION | The message is informational only.

enum asEObjTypeFlags

Enumerator
asOBJ_REF | A reference type.
asOBJ_VALUE | A value type.
asOBJ_GC | A garbage collected type. Only valid for reference types.
asOBJ_POD | A plain-old-data type. Only valid for value types.
asOBJ_NOHANDLE | This reference type doesn't allow handles to be held. Only valid for reference types.
asOBJ_SCOPED | The life time of objects of this type are controlled by the scope of the variable. Only valid for reference types.
asOBJ_TEMPLATE | A template type.
asOBJ_ASHANDLE | The value type should be treated as a handle.
asOBJ_APP_CLASS | The C++ type is a class type. Only valid for value types.
asOBJ_APP_CLASS_CONSTRUCTOR | The C++ class has an explicit constructor. Only valid for value types.
asOBJ_APP_CLASS_DESTRUCTOR | The C++ class has an explicit destructor. Only valid for value types.
asOBJ_APP_CLASS_ASSIGNMENT | The C++ class has an explicit assignment operator. Only valid for value types.
asOBJ_APP_CLASS_COPY_CONSTRUCTOR | The C++ class has an explicit copy constructor. Only valid for value types.
asOBJ_APP_CLASS_C | The C++ type is a class with a constructor.
asOBJ_APP_CLASS_CD | The C++ type is a class with a constructor and destructor.
asOBJ_APP_CLASS_CA | The C++ type is a class with a constructor and assignment operator.
asOBJ_APP_CLASS_CK | The C++ type is a class with a constructor and copy constructor.
asOBJ_APP_CLASS_CDA | The C++ type is a class with a constructor, destructor, and assignment operator.
asOBJ_APP_CLASS_CDK | The C++ type is a class with a constructor, destructor, and copy constructor.
asOBJ_APP_CLASS_CAK | The C++ type is a class with a constructor, assignment operator, and copy constructor.
asOBJ_APP_CLASS_CDAK | The C++ type is a class with a constructor, destructor, assignment operator, and copy constructor.
asOBJ_APP_CLASS_D | The C++ type is a class with a destructor.
asOBJ_APP_CLASS_DA | The C++ type is a class with a destructor and assignment operator.
asOBJ_APP_CLASS_DK | The C++ type is a class with a destructor and copy constructor.
asOBJ_APP_CLASS_DAK | The C++ type is a class with a destructor, assignment operator, and copy constructor.
asOBJ_APP_CLASS_A | The C++ type is a class with an assignment operator.
asOBJ_APP_CLASS_AK | The C++ type is a class with an assignment operator and copy constructor.
asOBJ_APP_CLASS_K | The C++ type is a class with a copy constructor.
asOBJ_APP_PRIMITIVE | The C++ type is a primitive type. Only valid for value types.
asOBJ_APP_FLOAT | The C++ type is a float or double. Only valid for value types.
asOBJ_APP_ARRAY | The C++ type is a static array. Only valid for value types.
asOBJ_APP_CLASS_ALLINTS | The C++ class can be treated as if all its members are integers.
asOBJ_APP_CLASS_ALLFLOATS | The C++ class can be treated as if all its members are floats or doubles.
asOBJ_NOCOUNT | The type doesn't use reference counting. Only valid for reference types.
asOBJ_APP_CLASS_ALIGN8 | The C++ class contains types that may require 8byte alignment. Only valid for value types.
asOBJ_SCRIPT_OBJECT | The object is a script class or an interface.
asOBJ_SHARED | Type object type is shared between modules.
asOBJ_NOINHERIT | The object type is marked as final and cannot be inherited.
asOBJ_SCRIPT_FUNCTION | The object type is a script function.
asOBJ_IMPLICIT_HANDLE | The object is declared for implicit handle.

enum asERetCodes

Enumerator
asSUCCESS | Success.
asERROR | Failure.
asCONTEXT_ACTIVE | The context is active.
asCONTEXT_NOT_FINISHED | The context is not finished.
asCONTEXT_NOT_PREPARED | The context is not prepared.
asINVALID_ARG | Invalid argument.
asNO_FUNCTION | The function was not found.
asNOT_SUPPORTED | Not supported.
asINVALID_NAME | Invalid name.
asNAME_TAKEN | The name is already taken.
asINVALID_DECLARATION | Invalid declaration.
asINVALID_OBJECT | Invalid object.
asINVALID_TYPE | Invalid type.
asALREADY_REGISTERED | Already registered.
asMULTIPLE_FUNCTIONS | Multiple matching functions.
asNO_MODULE | The module was not found.
asNO_GLOBAL_VAR | The global variable was not found.
asINVALID_CONFIGURATION | Invalid configuration.
asINVALID_INTERFACE | Invalid interface.
asCANT_BIND_ALL_FUNCTIONS | All imported functions couldn't be bound.
asLOWER_ARRAY_DIMENSION_NOT_REGISTERED | The array sub type has not been registered yet.
asWRONG_CONFIG_GROUP | Wrong configuration group.
asCONFIG_GROUP_IS_IN_USE | The configuration group is in use.
asILLEGAL_BEHAVIOUR_FOR_TYPE | Illegal behaviour for the type.
asWRONG_CALLING_CONV | The specified calling convention doesn't match the function/method pointer.
asBUILD_IN_PROGRESS | A build is currently in progress.
asINIT_GLOBAL_VARS_FAILED | The initialization of global variables failed.
asOUT_OF_MEMORY | It wasn't possible to allocate the needed memory.

enum asETokenClass

Enumerator
asTC_UNKNOWN | Unknown token.
asTC_KEYWORD | Keyword token.
asTC_VALUE | Literal value token.
asTC_IDENTIFIER | Identifier token.
asTC_COMMENT | Comment token.
asTC_WHITESPACE | White space token.

enum asETypeIdFlags

Enumerator
asTYPEID_VOID | The type id for void.
asTYPEID_BOOL | The type id for bool.
asTYPEID_INT8 | The type id for int8.
asTYPEID_INT16 | The type id for int16.
asTYPEID_INT32 | The type id for int.
asTYPEID_INT64 | The type id for int64.
asTYPEID_UINT8 | The type id for uint8.
asTYPEID_UINT16 | The type id for uint16.
asTYPEID_UINT32 | The type id for uint.
asTYPEID_UINT64 | The type id for uint64.
asTYPEID_FLOAT | The type id for float.
asTYPEID_DOUBLE | The type id for double.
asTYPEID_OBJHANDLE | The bit that shows if the type is a handle.
asTYPEID_HANDLETOCONST | The bit that shows if the type is a handle to a const.
asTYPEID_MASK_OBJECT | If any of these bits are set, then the type is an object.
asTYPEID_APPOBJECT | The bit that shows if the type is an application registered type.
asTYPEID_SCRIPTOBJECT | The bit that shows if the type is a script class.
asTYPEID_TEMPLATE | The bit that shows if the type is a template type.
asTYPEID_MASK_SEQNBR | The mask for the type id sequence number.

enum asETypeModifiers

Enumerator
asTM_NONE | No modification.
asTM_INREF | Input reference.
asTM_OUTREF | Output reference.
asTM_INOUTREF | In/out reference.
asTM_CONST | Read only.

## Function Documentation

AS_API void asAcquireExclusiveLock | ( |  | ) |

This function will block the calling thread until there are no other threads that hold shared or exclusive locks.

AS_API void asAcquireSharedLock | ( |  | ) |

This function will block the calling thread until there are no other threads that hold exclusive locks. Other threads may hold shared locks.

AS_API void* asAllocMem | ( | size_t | size | ) |

Parameters

  [in] | size | The size of the buffer to allocate

Returns
  A pointer to the allocated buffer, or null on error.

AS_API int asAtomicDec | ( | int & | value | ) |

Parameters

  [in] | value | A reference to the value that should be decremented

Returns
  The decremented value

This function is especially useful for implementing thread safe reference counters.

AS_API int asAtomicInc | ( | int & | value | ) |

Parameters

  [in] | value | A reference to the value that should be incremented

Returns
  The incremented value

This function is especially useful for implementing thread safe reference counters.

AS_API asILockableSharedBool* asCreateLockableSharedBool | ( |  | ) |

Returns
  A new lockable shared boolean.

The lockable shared boolean will be created with an initial reference count of 1, and the boolean value false.

The object can be used for weak reference flags.

AS_API asIScriptEngine* asCreateScriptEngine | ( | asDWORD | version | ) |

Parameters

  [in] | version | The library version. Should always be ANGELSCRIPT_VERSION.

Returns
  A pointer to the script engine interface.

Call this function to create a new script engine. When you're done with the script engine, i.e. after you've executed all your scripts, you should call Release on the pointer to free the engine object.

AS_API void asFreeMem | ( | void * | mem | ) |

Parameters

  [in] | mem | A pointer to the buffer to deallocate

AS_API asIScriptContext* asGetActiveContext | ( |  | ) |

Returns
  A pointer to the currently executing context, or null if no context is executing.

This function is most useful for registered functions, as it will allow them to obtain a pointer to the context that is calling the function, and through that get the engine, or custom user data.

If the script library is compiled with multithread support, this function will return the context that is currently active in the thread that is being executed. It will thus work even if there are multiple threads executing scripts at the same time.

This function does not increase the reference count of the context.

AS_API const char* asGetLibraryOptions | ( |  | ) |

Returns
  A null terminated string with indicators that identify the options used to compile the script library.

This can be used to identify at run-time different ways to configure the engine. For example, if the returned string contain the identifier AS_MAX_PORTABILITY then functions and methods must be registered with the asCALL_GENERIC calling convention.

AS_API const char* asGetLibraryVersion | ( |  | ) |

Returns
  A null terminated string with the library version.

The returned string can be used for presenting the library version in a log file, or in the GUI.

AS_API asIThreadManager* asGetThreadManager | ( |  | ) |

Returns
  The thread manager prepared with asPrepareMultithread()

template<typename T >

asUINT asGetTypeTraits | ( |  | ) |

Template Parameters

  T | The type for which the flags should be determined

Returns
  The flags necessary to register this type as a value type

Note
  This function is only availabe if the compiler supports C++11 feature set. Check existance with #if AS_CAN_USE_CPP11.

This template function uses C++11 STL template functions to determine the appropriate flags to use when registering the desired type as a value type with asIScriptEngine::RegisterObjectType.

It is capable to determine all the asOBJ_APP_xxx flags, except for asOBJ_APP_CLASS_ALLINTS, asOBJ_APP_CLASS_ALLFLOATS, and asOBJ_APP_CLASS_ALIGN8. These flags must still be informed manually when needed.

See Also
  Value types and native calling conventions

AS_API int asPrepareMultithread | ( | asIThreadManager * | externalMgr = `0` | ) |

Parameters

  [in] | externalMgr | Pre-existent thread manager (optional)

Returns
  A negative value on error

Return values

  asINVALID_ARG | externalMgr informed even though local manager already exists

Call this function from the main thread to set up shared resources for multithreading if engines are to be created in multiple threads.

If multiple modules (dlls) are used it may be necessary to call this with the thread manager retrieved from asGetThreadManager() in the main module in order for all modules to share the same thread manager.

See Also
  Multithreading

AS_API void asReleaseExclusiveLock | ( |  | ) |

Releases the previously acquired exclusive lock.

AS_API void asReleaseSharedLock | ( |  | ) |

Releases the previously acquired shared lock.

AS_API int asResetGlobalMemoryFunctions | ( |  | ) |

Returns
  A negative value on error.

Call this method to restore the default memory management functions.

AS_API int asSetGlobalMemoryFunctions | ( | asALLOCFUNC_t | allocFunc,
|  | asFREEFUNC_t | freeFunc
| ) |  |

Parameters

  [in] | allocFunc | The function that will be used to allocate memory.
  [in] | freeFunc | The function that will be used to free the memory.

Returns
  A negative value on error.

Call this method to register the global memory allocation and deallocation functions that AngelScript should use for memory management. This function Should be called before asCreateScriptEngine.

If not called, AngelScript will use the malloc and free functions from the standard C library.

AS_API int asThreadCleanup | ( |  | ) |

Returns
  A negative value on error.

Return values

  asCONTEXT_ACTIVE | A context is still active.

Call this function before terminating a thread that has accessed the engine to clean up memory allocated for that thread.

It's not necessary to call this if only a single thread accesses the engine.

AS_API void asUnprepareMultithread | ( |  | ) |

If asPrepareMultithread() has been called, then this function should be called after the last engine has been released to free the resources prepared for multithreading.