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