40 #ifndef AS_SCRIPTENGINE_H 41 #define AS_SCRIPTENGINE_H 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" 54 #include "as_tokenizer.h" 70 virtual int AddRef()
const;
71 virtual int Release()
const;
72 virtual int ShutDownAndRelease();
75 virtual int SetEngineProperty(asEEngineProp property, asPWORD value);
76 virtual asPWORD GetEngineProperty(asEEngineProp property)
const;
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);
88 virtual int RegisterGlobalFunction(
const char *declaration,
const asSFuncPtr &funcPointer, asDWORD callConv,
void *auxiliary = 0);
89 virtual asUINT GetGlobalFunctionCount()
const;
91 virtual asIScriptFunction *GetGlobalFunctionByDecl(
const char *declaration)
const;
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;
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;
111 virtual int RegisterStringFactory(
const char *datatype,
asIStringFactory *factory);
112 virtual int GetStringFactoryReturnTypeId(asDWORD *flags)
const;
115 virtual int RegisterDefaultArrayType(
const char *type);
116 virtual int GetDefaultArrayTypeId()
const;
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;
125 virtual int RegisterFuncdef(
const char *decl);
126 virtual asUINT GetFuncdefCount()
const;
127 virtual asITypeInfo *GetFuncdefByIndex(asUINT index)
const;
131 virtual int RegisterTypedef(
const char *type,
const char *decl);
132 virtual asUINT GetTypedefCount()
const;
133 virtual asITypeInfo *GetTypedefByIndex(asUINT index)
const;
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;
144 virtual asIScriptModule *GetModule(
const char *module, asEGMFlags flag);
145 virtual int DiscardModule(
const char *module);
146 virtual asUINT GetModuleCount()
const;
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;
162 virtual void *CreateScriptObject(
const asITypeInfo *type);
163 virtual void *CreateScriptObjectCopy(
void *obj,
const asITypeInfo *type);
164 virtual void *CreateUninitializedScriptObject(
const asITypeInfo *type);
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);
175 virtual int SetContextCallbacks(asREQUESTCONTEXTFUNC_t requestCtx, asRETURNCONTEXTFUNC_t returnCtx,
void *param = 0);
178 virtual asETokenClass ParseToken(
const char *
string,
size_t stringLength = 0, asUINT *tokenLength = 0)
const;
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);
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);
201 virtual int SetTranslateAppExceptionCallback(
asSFuncPtr callback,
void *param,
int callConv);
216 friend class asCRestore;
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);
226 void CallFree(
void *obj)
const;
228 void *CallGlobalFunctionRetPtr(
int func)
const;
229 void *CallGlobalFunctionRetPtr(
int func,
void *param1)
const;
232 void CallObjectMethod(
void *obj,
int func)
const;
233 void CallObjectMethod(
void *obj,
void *param,
int func)
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;
242 int CallScriptObjectMethod(
void *obj,
int func);
244 void ConstructScriptObjectCopy(
void *mem,
void *obj,
asCObjectType *type);
246 void DeleteDiscardedModules();
256 void BuildCompleted();
258 void PrepareEngine();
266 void DestroyList(asBYTE *buffer,
const asCObjectType *listPatternType);
271 asCString GetFunctionDeclaration(
int funcId);
275 asCModule *GetModule(
const char *name,
bool create);
276 asCModule *GetModuleFromFuncId(
int funcId);
279 int GetFactoryIdByDecl(
const asCObjectType *ot,
const char *decl);
281 int GetNextScriptFunctionId();
286 int ConfigError(
int err,
const char *funcName,
const char *arg1,
const char *arg2);
288 int GetTypeIdFromDataType(
const asCDataType &dt)
const;
289 asCDataType GetDataTypeFromTypeId(
int typeId)
const;
293 bool IsTemplateType(
const char *name)
const;
313 int GetScriptSectionNameIndex(
const char *name);
393 bool deferValidationOfTemplateTypes;
411 mutable int typeIdSeqNbr;
421 asDWORD defaultAccessMask;
427 void *msgCallbackObj;
448 asREQUESTCONTEXTFUNC_t requestCtxFunc;
449 asRETURNCONTEXTFUNC_t returnCtxFunc;
450 void *ctxCallbackParam;
457 asCLEANENGINEFUNC_t cleanFunc;
462 asCLEANMODULEFUNC_t cleanFunc;
467 asCLEANCONTEXTFUNC_t cleanFunc;
472 asCLEANFUNCTIONFUNC_t cleanFunc;
477 asCLEANTYPEINFOFUNC_t cleanFunc;
482 asCLEANSCRIPTOBJECTFUNC_t cleanFunc;
487 DECLAREREADWRITELOCK(
mutable engineRWLock)
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;
503 bool includeJitInstructions;
505 int propertyAccessorMode;
506 bool expandDefaultArrayToTemplate;
507 bool autoGarbageCollect;
508 bool disallowGlobalVars;
509 bool alwaysImplDefaultConstruct;
510 int compilerWarnings;
511 bool disallowValueAssignForRefType;
513 int alterSyntaxNamedArgs;
514 bool disableIntegerDivision;
515 bool disallowEmptyListElements;
517 bool privatePropAsProtected;
518 bool allowUnicodeIdentifiers;
520 asUINT maxNestedCalls;
521 asUINT genericCallMode;
522 asUINT initCallStackSize;
523 asUINT maxCallStackSize;
527 #ifndef AS_NO_EXCEPTIONS 528 bool translateExceptionCallback;
530 void *translateExceptionCallbackObj;
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: 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: 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