1 /* 2 AngelCode Scripting Library 3 Copyright (c) 2003-2018 Andreas Jonsson 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any 7 damages arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any 10 purpose, including commercial applications, and to alter it and 11 redistribute it freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you 14 must not claim that you wrote the original software. If you use 15 this software in a product, an acknowledgment in the product 16 documentation would be appreciated but is not required. 17 18 2. Altered source versions must be plainly marked as such, and 19 must not be misrepresented as being the original software. 20 21 3. This notice may not be removed or altered from any source 22 distribution. 23 24 The original version of this library can be located at: 25 http://www.angelcode.com/angelscript/ 26 27 Andreas Jonsson 28 andreas@angelcode.com 29 */ 30 31 32 // 33 // as_scriptengine.h 34 // 35 // The implementation of the script engine interface 36 // 37 38 39 40 #ifndef AS_SCRIPTENGINE_H 41 #define AS_SCRIPTENGINE_H 42 43 #include "as_config.h" 44 #include "as_atomic.h" 45 #include "as_scriptfunction.h" 46 #include "as_array.h" 47 #include "as_datatype.h" 48 #include "as_objecttype.h" 49 #include "as_module.h" 50 #include "as_callfunc.h" 51 #include "as_configgroup.h" 52 #include "as_memory.h" 53 #include "as_gc.h" 54 #include "as_tokenizer.h" 55 56 BEGIN_AS_NAMESPACE 57 58 class asCBuilder; 59 class asCContext; 60 61 // TODO: import: Remove this when import is removed 62 struct sBindInfo; 63 64 class asCScriptEngine : public asIScriptEngine 65 { 66 //============================================================= 67 // From asIScriptEngine 68 //============================================================= 69 public: 70 // Memory management 71 virtual int AddRef() const; 72 virtual int Release() const; 73 virtual int ShutDownAndRelease(); 74 75 // Engine properties 76 virtual int SetEngineProperty(asEEngineProp property, asPWORD value); 77 virtual asPWORD GetEngineProperty(asEEngineProp property) const; 78 79 // Compiler messages 80 virtual int SetMessageCallback(const asSFuncPtr &callback, void *obj, asDWORD callConv); 81 virtual int ClearMessageCallback(); 82 virtual int WriteMessage(const char *section, int row, int col, asEMsgType type, const char *message); 83 84 // JIT Compiler 85 virtual int SetJITCompiler(asIJITCompiler *compiler); 86 virtual asIJITCompiler *GetJITCompiler() const; 87 88 // Global functions 89 virtual int RegisterGlobalFunction(const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0); 90 virtual asUINT GetGlobalFunctionCount() const; 91 virtual asIScriptFunction *GetGlobalFunctionByIndex(asUINT index) const; 92 virtual asIScriptFunction *GetGlobalFunctionByDecl(const char *declaration) const; 93 94 // Global properties 95 virtual int RegisterGlobalProperty(const char *declaration, void *pointer); 96 virtual asUINT GetGlobalPropertyCount() const; 97 virtual int GetGlobalPropertyByIndex(asUINT index, const char **name, const char **nameSpace = 0, int *typeId = 0, bool *isConst = 0, const char **configGroup = 0, void **pointer = 0, asDWORD *accessMask = 0) const; 98 virtual int GetGlobalPropertyIndexByName(const char *name) const; 99 virtual int GetGlobalPropertyIndexByDecl(const char *decl) const; 100 101 // Type registration 102 virtual int RegisterObjectType(const char *obj, int byteSize, asDWORD flags); 103 virtual int RegisterObjectProperty(const char *obj, const char *declaration, int byteOffset, int compositeOffset = 0, bool isCompositeIndirect = false); 104 virtual int RegisterObjectMethod(const char *obj, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0, int compositeOffset = 0, bool isCompositeIndirect = false); 105 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); 106 virtual int RegisterInterface(const char *name); 107 virtual int RegisterInterfaceMethod(const char *intf, const char *declaration); 108 virtual asUINT GetObjectTypeCount() const; 109 virtual asITypeInfo *GetObjectTypeByIndex(asUINT index) const; 110 111 // String factory 112 virtual int RegisterStringFactory(const char *datatype, asIStringFactory *factory); 113 virtual int GetStringFactoryReturnTypeId(asDWORD *flags) const; 114 115 // Default array type 116 virtual int RegisterDefaultArrayType(const char *type); 117 virtual int GetDefaultArrayTypeId() const; 118 119 // Enums 120 virtual int RegisterEnum(const char *type); 121 virtual int RegisterEnumValue(const char *type, const char *name, int value); 122 virtual asUINT GetEnumCount() const; 123 virtual asITypeInfo *GetEnumByIndex(asUINT index) const; 124 125 // Funcdefs 126 virtual int RegisterFuncdef(const char *decl); 127 virtual asUINT GetFuncdefCount() const; 128 virtual asITypeInfo *GetFuncdefByIndex(asUINT index) const; 129 130 // Typedefs 131 // TODO: interface: Should perhaps rename this to Alias, since it doesn't really create a new type 132 virtual int RegisterTypedef(const char *type, const char *decl); 133 virtual asUINT GetTypedefCount() const; 134 virtual asITypeInfo *GetTypedefByIndex(asUINT index) const; 135 136 // Configuration groups 137 virtual int BeginConfigGroup(const char *groupName); 138 virtual int EndConfigGroup(); 139 virtual int RemoveConfigGroup(const char *groupName); 140 virtual asDWORD SetDefaultAccessMask(asDWORD defaultMask); 141 virtual int SetDefaultNamespace(const char *nameSpace); 142 virtual const char *GetDefaultNamespace() const; 143 144 // Script modules 145 virtual asIScriptModule *GetModule(const char *module, asEGMFlags flag); 146 virtual int DiscardModule(const char *module); 147 virtual asUINT GetModuleCount() const; 148 virtual asIScriptModule *GetModuleByIndex(asUINT index) const; 149 150 // Script functions 151 virtual asIScriptFunction *GetFunctionById(int funcId) const; 152 153 // Type identification 154 virtual int GetTypeIdByDecl(const char *decl) const; 155 virtual const char *GetTypeDeclaration(int typeId, bool includeNamespace = false) const; 156 virtual int GetSizeOfPrimitiveType(int typeId) const; 157 virtual asITypeInfo *GetTypeInfoById(int typeId) const; 158 virtual asITypeInfo *GetTypeInfoByName(const char *name) const; 159 virtual asITypeInfo *GetTypeInfoByDecl(const char *decl) const; 160 161 // Script execution 162 virtual asIScriptContext *CreateContext(); 163 virtual void *CreateScriptObject(const asITypeInfo *type); 164 virtual void *CreateScriptObjectCopy(void *obj, const asITypeInfo *type); 165 virtual void *CreateUninitializedScriptObject(const asITypeInfo *type); 166 virtual asIScriptFunction *CreateDelegate(asIScriptFunction *func, void *obj); 167 virtual int AssignScriptObject(void *dstObj, void *srcObj, const asITypeInfo *type); 168 virtual void ReleaseScriptObject(void *obj, const asITypeInfo *type); 169 virtual void AddRefScriptObject(void *obj, const asITypeInfo *type); 170 virtual int RefCastObject(void *obj, asITypeInfo *fromType, asITypeInfo *toType, void **newPtr, bool useOnlyImplicitCast = false); 171 virtual asILockableSharedBool *GetWeakRefFlagOfScriptObject(void *obj, const asITypeInfo *type) const; 172 173 // Context pooling 174 virtual asIScriptContext *RequestContext(); 175 virtual void ReturnContext(asIScriptContext *ctx); 176 virtual int SetContextCallbacks(asREQUESTCONTEXTFUNC_t requestCtx, asRETURNCONTEXTFUNC_t returnCtx, void *param = 0); 177 178 // String interpretation 179 virtual asETokenClass ParseToken(const char *string, size_t stringLength = 0, asUINT *tokenLength = 0) const; 180 181 // Garbage collection 182 virtual int GarbageCollect(asDWORD flags = asGC_FULL_CYCLE, asUINT numIterations = 1); 183 virtual void GetGCStatistics(asUINT *currentSize, asUINT *totalDestroyed, asUINT *totalDetected, asUINT *newObjects, asUINT *totalNewDestroyed) const; 184 virtual int NotifyGarbageCollectorOfNewObject(void *obj, asITypeInfo *type); 185 virtual int GetObjectInGC(asUINT idx, asUINT *seqNbr, void **obj = 0, asITypeInfo **type = 0); 186 virtual void GCEnumCallback(void *reference); 187 virtual void ForwardGCEnumReferences(void *ref, asITypeInfo *type); 188 virtual void ForwardGCReleaseReferences(void *ref, asITypeInfo *type); 189 virtual void SetCircularRefDetectedCallback(asCIRCULARREFFUNC_t callback, void *param = 0); 190 191 // User data 192 virtual void *SetUserData(void *data, asPWORD type); 193 virtual void *GetUserData(asPWORD type) const; 194 virtual void SetEngineUserDataCleanupCallback(asCLEANENGINEFUNC_t callback, asPWORD type); 195 virtual void SetModuleUserDataCleanupCallback(asCLEANMODULEFUNC_t callback, asPWORD type); 196 virtual void SetContextUserDataCleanupCallback(asCLEANCONTEXTFUNC_t callback, asPWORD type); 197 virtual void SetFunctionUserDataCleanupCallback(asCLEANFUNCTIONFUNC_t callback, asPWORD type); 198 virtual void SetTypeInfoUserDataCleanupCallback(asCLEANTYPEINFOFUNC_t callback, asPWORD type); 199 virtual void SetScriptObjectUserDataCleanupCallback(asCLEANSCRIPTOBJECTFUNC_t callback, asPWORD type); 200 201 // Exception handling 202 virtual int SetTranslateAppExceptionCallback(asSFuncPtr callback, void *param, int callConv); 203 204 //=========================================================== 205 // internal methods 206 //=========================================================== 207 public: 208 asCScriptEngine(); 209 virtual ~asCScriptEngine(); 210 211 //protected: 212 friend class asCBuilder; 213 friend class asCCompiler; 214 friend class asCContext; 215 friend class asCDataType; 216 friend class asCModule; 217 friend class asCRestore; 218 friend class asCByteCode; 219 friend int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine *engine); 220 221 int RegisterMethodToObjectType(asCObjectType *objectType, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0, int compositeOffset = 0, bool isCompositeIndirect = false); 222 int RegisterBehaviourToObjectType(asCObjectType *objectType, asEBehaviours behaviour, const char *decl, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary = 0, int compositeOffset = 0, bool isCompositeIndirect = false); 223 224 int VerifyVarTypeNotInFunction(asCScriptFunction *func); 225 226 void *CallAlloc(const asCObjectType *objType) const; 227 void CallFree(void *obj) const; 228 229 void *CallGlobalFunctionRetPtr(int func) const; 230 void *CallGlobalFunctionRetPtr(int func, void *param1) const; 231 void *CallGlobalFunctionRetPtr(asSSystemFunctionInterface *func, asCScriptFunction *desc) const; 232 void *CallGlobalFunctionRetPtr(asSSystemFunctionInterface *i, asCScriptFunction *s, void *param1) const; 233 void CallObjectMethod(void *obj, int func) const; 234 void CallObjectMethod(void *obj, void *param, int func) const; 235 void CallObjectMethod(void *obj, asSSystemFunctionInterface *func, asCScriptFunction *desc) const; 236 void CallObjectMethod(void *obj, void *param, asSSystemFunctionInterface *func, asCScriptFunction *desc) const; 237 bool CallObjectMethodRetBool(void *obj, int func) const; 238 int CallObjectMethodRetInt(void *obj, int func) const; 239 void *CallObjectMethodRetPtr(void *obj, int func) const; 240 void *CallObjectMethodRetPtr(void *obj, int param1, asCScriptFunction *func) const; 241 void CallGlobalFunction(void *param1, void *param2, asSSystemFunctionInterface *func, asCScriptFunction *desc) const; 242 bool CallGlobalFunctionRetBool(void *param1, void *param2, asSSystemFunctionInterface *func, asCScriptFunction *desc) const; 243 int CallScriptObjectMethod(void *obj, int func); 244 245 void ConstructScriptObjectCopy(void *mem, void *obj, asCObjectType *type); 246 247 void DeleteDiscardedModules(); 248 249 void RemoveTemplateInstanceType(asCObjectType *t); 250 251 asCConfigGroup *FindConfigGroupForFunction(int funcId) const; 252 asCConfigGroup *FindConfigGroupForGlobalVar(int gvarId) const; 253 asCConfigGroup *FindConfigGroupForTypeInfo(const asCTypeInfo *type) const; 254 asCConfigGroup *FindConfigGroupForFuncDef(const asCFuncdefType *funcDef) const; 255 256 int RequestBuild(); 257 void BuildCompleted(); 258 259 void PrepareEngine(); 260 bool isPrepared; 261 262 int CreateContext(asIScriptContext **context, bool isInternal); 263 264 asCTypeInfo *GetRegisteredType(const asCString &name, asSNameSpace *ns) const; 265 266 asCObjectType *GetListPatternType(int listPatternFuncId); 267 void DestroyList(asBYTE *buffer, const asCObjectType *listPatternType); 268 void DestroySubList(asBYTE *&buffer, asSListPatternNode *&patternNode); 269 270 int AddBehaviourFunction(asCScriptFunction &func, asSSystemFunctionInterface &internal); 271 272 asCString GetFunctionDeclaration(int funcId); 273 274 asCScriptFunction *GetScriptFunction(int funcId) const; 275 276 asCModule *GetModule(const char *name, bool create); 277 asCModule *GetModuleFromFuncId(int funcId); 278 279 int GetMethodIdByDecl(const asCObjectType *ot, const char *decl, asCModule *mod); 280 int GetFactoryIdByDecl(const asCObjectType *ot, const char *decl); 281 282 int GetNextScriptFunctionId(); 283 void AddScriptFunction(asCScriptFunction *func); 284 void RemoveScriptFunction(asCScriptFunction *func); 285 void RemoveFuncdef(asCFuncdefType *func); 286 287 int ConfigError(int err, const char *funcName, const char *arg1, const char *arg2); 288 289 int GetTypeIdFromDataType(const asCDataType &dt) const; 290 asCDataType GetDataTypeFromTypeId(int typeId) const; 291 asCObjectType *GetObjectTypeFromTypeId(int typeId) const; 292 void RemoveFromTypeIdMap(asCTypeInfo *type); 293 294 bool IsTemplateType(const char *name) const; 295 int SetTemplateRestrictions(asCObjectType *templateType, asCScriptFunction *func, const char *caller, const char *decl); 296 asCObjectType *GetTemplateInstanceType(asCObjectType *templateType, asCArray<asCDataType> &subTypes, asCModule *requestingModule); 297 asCScriptFunction *GenerateTemplateFactoryStub(asCObjectType *templateType, asCObjectType *templateInstanceType, int origFactoryId); 298 bool GenerateNewTemplateFunction(asCObjectType *templateType, asCObjectType *templateInstanceType, asCScriptFunction *templateFunc, asCScriptFunction **newFunc); 299 asCFuncdefType *GenerateNewTemplateFuncdef(asCObjectType *templateType, asCObjectType *templateInstanceType, asCFuncdefType *templateFuncdef); 300 asCDataType DetermineTypeForTemplate(const asCDataType &orig, asCObjectType *tmpl, asCObjectType *ot); 301 bool RequireTypeReplacement(asCDataType &type, asCObjectType *templateType); 302 303 asCModule *FindNewOwnerForSharedType(asCTypeInfo *type, asCModule *mod); 304 asCModule *FindNewOwnerForSharedFunc(asCScriptFunction *func, asCModule *mod); 305 306 asCFuncdefType *FindMatchingFuncdef(asCScriptFunction *func, asCModule *mod); 307 308 // Global property management 309 asCGlobalProperty *AllocateGlobalProperty(); 310 void RemoveGlobalProperty(asCGlobalProperty *prop); 311 312 int GetScriptSectionNameIndex(const char *name); 313 314 // Namespace management 315 asSNameSpace *AddNameSpace(const char *name); 316 asSNameSpace *FindNameSpace(const char *name) const; 317 asSNameSpace *GetParentNameSpace(asSNameSpace *ns) const; 318 319 //=========================================================== 320 // internal properties 321 //=========================================================== 322 asCMemoryMgr memoryMgr; 323 324 asCObjectType *defaultArrayObjectType; 325 asCObjectType scriptTypeBehaviours; 326 asCObjectType functionBehaviours; 327 328 // Registered interface 329 asCArray<asCObjectType *> registeredObjTypes; // doesn't increase ref count 330 asCArray<asCTypedefType *> registeredTypeDefs; // doesn't increase ref count 331 asCArray<asCEnumType *> registeredEnums; // doesn't increase ref count 332 // TODO: memory savings: Since there can be only one property with the same name a simpler symbol table should be used for global props 333 asCSymbolTable<asCGlobalProperty> registeredGlobalProps; // increases ref count 334 asCSymbolTable<asCScriptFunction> registeredGlobalFuncs; 335 asCArray<asCFuncdefType *> registeredFuncDefs; // doesn't increase ref count 336 asCArray<asCObjectType *> registeredTemplateTypes; // doesn't increase ref count 337 asIStringFactory *stringFactory; 338 asCDataType stringType; 339 bool configFailed; 340 341 // Stores all registered types 342 asCMap<asSNameSpaceNamePair, asCTypeInfo*> allRegisteredTypes; // increases ref count 343 344 // Dummy types used to name the subtypes in the template objects 345 asCArray<asCTypeInfo *> templateSubTypes; 346 347 // Store information about template types 348 // This list will contain all instances of templates, both registered specialized 349 // types and those automacially instantiated from scripts 350 asCArray<asCObjectType *> templateInstanceTypes; // increases ref count 351 352 // Store information about list patterns 353 asCArray<asCObjectType *> listPatternTypes; // increases ref count 354 355 // Stores all global properties, both those registered by application, and those declared by scripts. 356 // The id of a global property is the index in this array. 357 asCArray<asCGlobalProperty *> globalProperties; // increases ref count 358 asCArray<int> freeGlobalPropertyIds; 359 360 // This map is used to quickly find a property by its memory address 361 // It is used principally during building, cleanup, and garbage detection for script functions 362 asCMap<void*, asCGlobalProperty*> varAddressMap; // doesn't increase ref count 363 364 // Stores all functions, i.e. registered functions, script functions, class methods, behaviours, etc. 365 asCArray<asCScriptFunction *> scriptFunctions; // doesn't increase ref count 366 asCArray<int> freeScriptFunctionIds; 367 asCArray<asCScriptFunction *> signatureIds; 368 369 // An array with all module imported functions 370 asCArray<sBindInfo *> importedFunctions; // doesn't increase ref count 371 asCArray<int> freeImportedFunctionIdxs; 372 373 // Synchronized 374 mutable asCAtomic refCount; 375 // Synchronized with engineRWLock 376 // This array holds all live script modules 377 asCArray<asCModule *> scriptModules; 378 // Synchronized with engineRWLock 379 // This is a pointer to the last module that was requested. It is used for performance 380 // improvement, since it is common that the same module is accessed many times in a row 381 asCModule *lastModule; 382 // Synchronized with engineRWLock 383 // This flag is true if a script is currently being compiled. It is used to prevent multiple 384 // threads from requesting builds at the same time (without blocking) 385 bool isBuilding; 386 // Synchronized with engineRWLock 387 // This array holds modules that have been discard (thus are no longer visible to the application) 388 // but cannot yet be deleted due to having external references to some of the entities in them 389 asCArray<asCModule *> discardedModules; 390 // This flag is set to true during compilations of scripts (or loading pre-compiled scripts) 391 // to delay the validation of template types until the subtypes have been fully declared 392 bool deferValidationOfTemplateTypes; 393 394 // Tokenizer is instantiated once to share resources 395 asCTokenizer tok; 396 397 // Stores shared script declared types (classes, interfaces, enums) 398 asCArray<asCTypeInfo *> sharedScriptTypes; // increases ref count 399 // This array stores the template instances types that have been automatically generated from template types 400 asCArray<asCObjectType *> generatedTemplateTypes; 401 // Stores the funcdefs 402 // TODO: redesign: Only shared funcdefs should be stored here 403 // a funcdef becomes shared if all arguments and the return type are shared (or application registered) 404 asCArray<asCFuncdefType *> funcDefs; // doesn't increases ref count 405 406 // Stores the names of the script sections for debugging purposes 407 asCArray<asCString *> scriptSectionNames; 408 409 // Type identifiers 410 mutable int typeIdSeqNbr; 411 mutable asCMap<int, asCTypeInfo*> mapTypeIdToTypeInfo; 412 413 // Garbage collector 414 asCGarbageCollector gc; 415 416 // Dynamic groups 417 asCConfigGroup defaultGroup; 418 asCArray<asCConfigGroup*> configGroups; 419 asCConfigGroup *currentGroup; 420 asDWORD defaultAccessMask; 421 asSNameSpace *defaultNamespace; 422 423 // Message callback 424 bool msgCallback; 425 asSSystemFunctionInterface msgCallbackFunc; 426 void *msgCallbackObj; 427 struct preMessage_t 428 { preMessage_tpreMessage_t429 preMessage_t() { isSet = false; } 430 bool isSet; 431 asCString message; 432 asCString scriptname; 433 int r; 434 int c; 435 } preMessage; 436 437 // JIt compilation 438 asIJITCompiler *jitCompiler; 439 440 // Namespaces 441 // These are shared between all entities and are 442 // only deleted once the engine is destroyed 443 asCArray<asSNameSpace*> nameSpaces; 444 445 // Callbacks for context pooling 446 asREQUESTCONTEXTFUNC_t requestCtxFunc; 447 asRETURNCONTEXTFUNC_t returnCtxFunc; 448 void *ctxCallbackParam; 449 450 // User data 451 asCArray<asPWORD> userData; 452 453 struct SEngineClean { asPWORD type; asCLEANENGINEFUNC_t cleanFunc; }; 454 asCArray<SEngineClean> cleanEngineFuncs; 455 struct SModuleClean { asPWORD type; asCLEANMODULEFUNC_t cleanFunc; }; 456 asCArray<SModuleClean> cleanModuleFuncs; 457 struct SContextClean { asPWORD type; asCLEANCONTEXTFUNC_t cleanFunc; }; 458 asCArray<SContextClean> cleanContextFuncs; 459 struct SFunctionClean { asPWORD type; asCLEANFUNCTIONFUNC_t cleanFunc; }; 460 asCArray<SFunctionClean> cleanFunctionFuncs; 461 struct STypeInfoClean { asPWORD type; asCLEANTYPEINFOFUNC_t cleanFunc; }; 462 asCArray<STypeInfoClean> cleanTypeInfoFuncs; 463 struct SScriptObjClean { asPWORD type; asCLEANSCRIPTOBJECTFUNC_t cleanFunc; }; 464 asCArray<SScriptObjClean> cleanScriptObjectFuncs; 465 466 // Synchronization for threads 467 DECLAREREADWRITELOCK(mutable engineRWLock) 468 469 // Engine properties 470 struct 471 { 472 bool allowUnsafeReferences; 473 bool optimizeByteCode; 474 bool copyScriptSections; 475 asUINT maximumContextStackSize; 476 asUINT initContextStackSize; 477 bool useCharacterLiterals; 478 bool allowMultilineStrings; 479 bool allowImplicitHandleTypes; 480 bool buildWithoutLineCues; 481 bool initGlobalVarsAfterBuild; 482 bool requireEnumScope; 483 int scanner; 484 bool includeJitInstructions; 485 int stringEncoding; 486 int propertyAccessorMode; 487 bool expandDefaultArrayToTemplate; 488 bool autoGarbageCollect; 489 bool disallowGlobalVars; 490 bool alwaysImplDefaultConstruct; 491 int compilerWarnings; 492 bool disallowValueAssignForRefType; 493 // TODO: 3.0.0: Remove the alterSyntaxNamedArgs 494 int alterSyntaxNamedArgs; 495 bool disableIntegerDivision; 496 bool disallowEmptyListElements; 497 // TODO: 3.0.0: Remove the privatePropAsProtected 498 bool privatePropAsProtected; 499 bool allowUnicodeIdentifiers; 500 int heredocTrimMode; 501 asUINT maxNestedCalls; 502 asUINT genericCallMode; 503 asUINT initCallStackSize; 504 asUINT maxCallStackSize; 505 } ep; 506 507 // Callbacks 508 #ifndef AS_NO_EXCEPTIONS 509 bool translateExceptionCallback; 510 asSSystemFunctionInterface translateExceptionCallbackFunc; 511 void * translateExceptionCallbackObj; 512 #endif 513 514 // This flag is to allow a quicker shutdown when releasing the engine 515 bool shuttingDown; 516 517 // This flag is set when the engine's destructor is called, this is to 518 // avoid recursive calls if an object happens to increment/decrement 519 // the ref counter during shutdown 520 bool inDestructor; 521 }; 522 523 END_AS_NAMESPACE 524 525 #endif 526