AngelScript
|
The engine interface. More...
Public Member Functions | |
Memory management | |
virtual int | AddRef () const =0 |
Increase reference counter. More... | |
virtual int | Release () const =0 |
Decrease reference counter. More... | |
Engine properties | |
virtual int | SetEngineProperty (asEEngineProp property, asPWORD value)=0 |
Dynamically change some engine properties. More... | |
virtual asPWORD | GetEngineProperty (asEEngineProp property) const =0 |
Retrieve current engine property settings. More... | |
Compiler messages | |
virtual int | SetMessageCallback (const asSFuncPtr &callback, void *obj, asDWORD callConv)=0 |
Sets a message callback that will receive compiler messages. More... | |
virtual int | ClearMessageCallback ()=0 |
Clears the registered message callback routine. More... | |
virtual int | WriteMessage (const char *section, int row, int col, asEMsgType type, const char *message)=0 |
Writes a message to the message callback. More... | |
JIT compiler | |
virtual int | SetJITCompiler (asIJITCompiler *compiler)=0 |
Sets the JIT compiler. | |
virtual asIJITCompiler * | GetJITCompiler () const =0 |
Returns the JIT compiler. | |
Global functions | |
virtual int | RegisterGlobalFunction (const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *objForThiscall=0)=0 |
Registers a global function. More... | |
virtual asUINT | GetGlobalFunctionCount () const =0 |
Returns the number of registered functions. More... | |
virtual asIScriptFunction * | GetGlobalFunctionByIndex (asUINT index) const =0 |
Returns the registered function. More... | |
virtual asIScriptFunction * | GetGlobalFunctionByDecl (const char *declaration) const =0 |
Returns the registered function. More... | |
Global properties | |
virtual int | RegisterGlobalProperty (const char *declaration, void *pointer)=0 |
Registers a global property. More... | |
virtual asUINT | GetGlobalPropertyCount () const =0 |
Returns the number of registered global properties. More... | |
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 =0 |
Returns the detail on the registered global property. More... | |
virtual int | GetGlobalPropertyIndexByName (const char *name) const =0 |
Returns the index of the property. More... | |
virtual int | GetGlobalPropertyIndexByDecl (const char *decl) const =0 |
Returns the index of the property. More... | |
Object types | |
virtual int | RegisterObjectType (const char *obj, int byteSize, asDWORD flags)=0 |
Registers a new object type. More... | |
virtual int | RegisterObjectProperty (const char *obj, const char *declaration, int byteOffset)=0 |
Registers a property for the object type. More... | |
virtual int | RegisterObjectMethod (const char *obj, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv)=0 |
Registers a method for the object type. More... | |
virtual int | RegisterObjectBehaviour (const char *obj, asEBehaviours behaviour, const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *objForThiscall=0)=0 |
Registers a behaviour for the object type. More... | |
virtual int | RegisterInterface (const char *name)=0 |
Registers an interface. More... | |
virtual int | RegisterInterfaceMethod (const char *intf, const char *declaration)=0 |
Registers an interface method. More... | |
virtual asUINT | GetObjectTypeCount () const =0 |
Returns the number of registered object types. More... | |
virtual asIObjectType * | GetObjectTypeByIndex (asUINT index) const =0 |
Returns the object type interface by index. More... | |
virtual asIObjectType * | GetObjectTypeByName (const char *name) const =0 |
Returns a matching object type by name. More... | |
String factory | |
virtual int | RegisterStringFactory (const char *datatype, const asSFuncPtr &factoryFunc, asDWORD callConv, void *objForThiscall=0)=0 |
Registers the string factory. More... | |
virtual int | GetStringFactoryReturnTypeId () const =0 |
Returns the type id of the type that the string factory returns. More... | |
Default array type | |
virtual int | RegisterDefaultArrayType (const char *type)=0 |
Registers the type that should be used as the default array. More... | |
virtual int | GetDefaultArrayTypeId () const =0 |
Returns the type id of the registered type. More... | |
Enums | |
virtual int | RegisterEnum (const char *type)=0 |
Registers an enum type. More... | |
virtual int | RegisterEnumValue (const char *type, const char *name, int value)=0 |
Registers an enum value. More... | |
virtual asUINT | GetEnumCount () const =0 |
Returns the number of registered enum types. More... | |
virtual const char * | GetEnumByIndex (asUINT index, int *enumTypeId, const char **nameSpace=0, const char **configGroup=0, asDWORD *accessMask=0) const =0 |
Returns the registered enum type. More... | |
virtual int | GetEnumValueCount (int enumTypeId) const =0 |
Returns the number of enum values for the enum type. More... | |
virtual const char * | GetEnumValueByIndex (int enumTypeId, asUINT index, int *outValue) const =0 |
Returns the name and value of the enum value for the enum type. More... | |
Funcdefs | |
virtual int | RegisterFuncdef (const char *decl)=0 |
Registers a function definition. More... | |
virtual asUINT | GetFuncdefCount () const =0 |
Returns the number of registered function definitions. More... | |
virtual asIScriptFunction * | GetFuncdefByIndex (asUINT index) const =0 |
Returns a registered function definition. More... | |
Typedefs | |
virtual int | RegisterTypedef (const char *type, const char *decl)=0 |
Registers a typedef. More... | |
virtual asUINT | GetTypedefCount () const =0 |
Returns the number of registered typedefs. More... | |
virtual const char * | GetTypedefByIndex (asUINT index, int *typeId, const char **nameSpace=0, const char **configGroup=0, asDWORD *accessMask=0) const =0 |
Returns a registered typedef. More... | |
Configuration groups | |
virtual int | BeginConfigGroup (const char *groupName)=0 |
Starts a new dynamic configuration group. More... | |
virtual int | EndConfigGroup ()=0 |
Ends the configuration group. More... | |
virtual int | RemoveConfigGroup (const char *groupName)=0 |
Removes a previously registered configuration group. More... | |
virtual asDWORD | SetDefaultAccessMask (asDWORD defaultMask)=0 |
Sets the access mask that should be used for subsequent registered entities. More... | |
virtual int | SetDefaultNamespace (const char *nameSpace)=0 |
Sets the current default namespace for registrations and searches. More... | |
virtual const char * | GetDefaultNamespace () const =0 |
Returns the current default namespace. More... | |
Script modules | |
virtual asIScriptModule * | GetModule (const char *module, asEGMFlags flag=asGM_ONLY_IF_EXISTS)=0 |
Return an interface pointer to the module. More... | |
virtual int | DiscardModule (const char *module)=0 |
Discard a module. More... | |
virtual asUINT | GetModuleCount () const =0 |
Get the number of modules. More... | |
virtual asIScriptModule * | GetModuleByIndex (asUINT index) const =0 |
Get a module by index. More... | |
Script functions | |
virtual asIScriptFunction * | GetFunctionById (int funcId) const =0 |
Returns the function by its id. More... | |
virtual asIScriptFunction * | GetFuncDefFromTypeId (int typeId) const =0 |
Returns the function description for the funcdef. More... | |
Type identification | |
virtual asIObjectType * | GetObjectTypeById (int typeId) const =0 |
Returns the object type interface for type. More... | |
virtual int | GetTypeIdByDecl (const char *decl) const =0 |
Returns a type id by declaration. More... | |
virtual const char * | GetTypeDeclaration (int typeId, bool includeNamespace=false) const =0 |
Returns a type declaration. More... | |
virtual int | GetSizeOfPrimitiveType (int typeId) const =0 |
Returns the size of a primitive type. More... | |
Script execution | |
virtual asIScriptContext * | CreateContext ()=0 |
Creates a new script context. More... | |
virtual void * | CreateScriptObject (int typeId)=0 |
virtual void * | CreateScriptObjectCopy (void *obj, int typeId)=0 |
virtual void * | CreateUninitializedScriptObject (int typeId)=0 |
virtual void | AssignScriptObject (void *dstObj, void *srcObj, int typeId)=0 |
virtual void | ReleaseScriptObject (void *obj, int typeId)=0 |
virtual void | AddRefScriptObject (void *obj, int typeId)=0 |
virtual void * | CreateScriptObject (const asIObjectType *type)=0 |
Creates a script object defined by its type id. More... | |
virtual void * | CreateScriptObjectCopy (void *obj, const asIObjectType *type)=0 |
Creates a copy of a script object. More... | |
virtual void * | CreateUninitializedScriptObject (const asIObjectType *type)=0 |
Creates an uninitialized script object defined by its type id. More... | |
virtual asIScriptFunction * | CreateDelegate (asIScriptFunction *func, void *obj)=0 |
Create a delegate for an object and method. More... | |
virtual void | AssignScriptObject (void *dstObj, void *srcObj, const asIObjectType *type)=0 |
Copy one script object to another. More... | |
virtual void | ReleaseScriptObject (void *obj, const asIObjectType *type)=0 |
Release the script object pointer. More... | |
virtual void | AddRefScriptObject (void *obj, const asIObjectType *type)=0 |
Increase the reference counter for the script object. More... | |
virtual bool | IsHandleCompatibleWithObject (void *obj, int objTypeId, int handleTypeId) const =0 |
Returns true if the object referenced by a handle compatible with the specified type. More... | |
virtual asILockableSharedBool * | GetWeakRefFlagOfScriptObject (void *obj, const asIObjectType *type) const =0 |
Returns the weak ref flag from the object. More... | |
String interpretation | |
virtual asETokenClass | ParseToken (const char *string, size_t stringLength=0, int *tokenLength=0) const =0 |
Returns the class and length of the first token in the string. More... | |
Garbage collection | |
virtual int | GarbageCollect (asDWORD flags=asGC_FULL_CYCLE)=0 |
Perform garbage collection. More... | |
virtual void | GetGCStatistics (asUINT *currentSize, asUINT *totalDestroyed=0, asUINT *totalDetected=0, asUINT *newObjects=0, asUINT *totalNewDestroyed=0) const =0 |
Obtain statistics from the garbage collector. More... | |
virtual int | NotifyGarbageCollectorOfNewObject (void *obj, asIObjectType *type)=0 |
Notify the garbage collector of a new object that needs to be managed. More... | |
virtual int | GetObjectInGC (asUINT idx, asUINT *seqNbr=0, void **obj=0, asIObjectType **type=0)=0 |
Gets an object in the garbage collector. More... | |
virtual void | GCEnumCallback (void *reference)=0 |
Used by the garbage collector to enumerate all references held by an object. More... | |
User data | |
virtual void * | SetUserData (void *data, asPWORD type=0)=0 |
Register the memory address of some user data. More... | |
virtual void * | GetUserData (asPWORD type=0) const =0 |
Returns the address of the previously registered user data. More... | |
virtual void | SetEngineUserDataCleanupCallback (asCLEANENGINEFUNC_t callback, asPWORD type=0)=0 |
Set the function that should be called when the engine is destroyed. More... | |
virtual void | SetModuleUserDataCleanupCallback (asCLEANMODULEFUNC_t callback)=0 |
Set the function that should be called when the module is destroyed. More... | |
virtual void | SetContextUserDataCleanupCallback (asCLEANCONTEXTFUNC_t callback)=0 |
Set the function that should be called when a context is destroyed. More... | |
virtual void | SetFunctionUserDataCleanupCallback (asCLEANFUNCTIONFUNC_t callback)=0 |
Set the function that should be called when a function is destroyed. More... | |
virtual void | SetObjectTypeUserDataCleanupCallback (asCLEANOBJECTTYPEFUNC_t callback, asPWORD type=0)=0 |
Set the function that should be called when an object type is destroyed. More... | |
It is allowed to have multiple instances of script engines, but there is rarely a need for it. Even if the application needs to expose different interfaces to different types of scripts this can usually be accomplished through the use of configuration groups and access profiles.
|
pure virtual |
Call this method when storing an additional reference to the object. Remember that the first reference that is received from asCreateScriptEngine is already accounted for.
|
pure virtual |
|
pure virtual |
[in] | obj | A pointer to the object. |
[in] | type | The type of the object. |
This calls the add ref method of the object to increase the reference count.
|
pure virtual |
|
pure virtual |
[in] | dstObj | A pointer to the destination object. |
[in] | srcObj | A pointer to the source object. |
[in] | type | The type of the objects. |
This calls the assignment operator to copy the object from one to the other.
This only works for objects.
|
pure virtual |
[in] | groupName | The name of the configuration group |
asNAME_TAKEN | Another group with the same name already exists. |
asNOT_SUPPORTED | Nesting configuration groups is not supported. |
Starts a new dynamic configuration group. This group can be setup so that it is only visible to specific modules, and it can also be removed when it is no longer used.
|
pure virtual |
Call this method to remove the message callback.
|
pure virtual |
This method creates a context that will be used to execute the script functions. The context interface created will have its reference counter already increased.
|
pure virtual |
[in] | func | The object method |
[in] | obj | The object pointer |
|
pure virtual |
|
pure virtual |
[in] | type | The type of the object to create. |
This method is used to create a script object based on it's type id. The method will call the object type's default factory. If the object type doesn't have a default factory the call will fail and no object will be created.
Created objects will have their reference counter set to 1 so the application needs to release the pointer when it will no longer use it.
This only works for objects, for primitive types and object handles the method doesn't do anything and returns a null pointer.
|
pure virtual |
|
pure virtual |
[in] | obj | A pointer to the source object. |
[in] | type | The type of the object. |
This method is used to create a copy of an existing object.
This only works for objects, for primitive types and object handles the method doesn't do anything and returns a null pointer.
|
pure virtual |
|
pure virtual |
[in] | type | The type of the object to create. |
This method can only be used to create instances of script classes.
The returned object will only be initialized so far that there are no invalid pointers or references. The constructor of the script class will not be invoked.
If the script class has any registered types as members, the default constructor for those members will be executed.
This method is meant for objects that will be initialized manually by the application, e.g. when restoring a serialized object.
|
pure virtual |
[in] | module | The name of the module |
asNO_MODULE | The module was not found. |
Discards a module and frees its memory. Any pointers that the application holds to this module will be invalid after this call.
|
pure virtual |
asERROR | Can't end a group that hasn't been begun. |
Ends the current configuration group. Once finished a config group cannot be changed, but it can be removed when it is no longer used.
|
pure virtual |
[in] | flags | Set to a combination of the asEGCFlags. |
This method will free script objects that can no longer be reached. When the engine is released the garbage collector will automatically do a full cycle to release all objects still alive. If the engine is long living it is important to call this method every once in a while to free up memory allocated by the scripts. If a script does a lot of allocations before returning it may be necessary to implement a line callback function that calls the garbage collector during execution of the script.
It is not necessary to do a full cycle with every call. This makes it possible to spread out the garbage collection time over a large period, thus not impacting the responsiveness of the application.
|
pure virtual |
[in] | reference | A pointer to the referenced object. |
When processing the EnumReferences call the called object should call GCEnumCallback for each of the references it holds to other objects.
|
pure virtual |
asINVALID_TYPE | The default array type hasn't been registered. |
|
pure virtual |
|
pure virtual |
[in] | property | One of the asEEngineProp values. |
Calling this method lets you determine the current value of the engine properties.
|
pure virtual |
[in] | index | The index of the enum type. |
[out] | enumTypeId | Receives the type if of the enum type. |
[out] | nameSpace | Receives the namespace of the enum. |
[out] | configGroup | Receives the config group in which the enum was registered. |
[out] | accessMask | Receives the access mask of the enum. |
|
pure virtual |
|
pure virtual |
[in] | enumTypeId | The type id of the enum type. |
[in] | index | The index of the enum value. |
[out] | outValue | Receives the value of the enum value. |
|
pure virtual |
[in] | enumTypeId | The type id of the enum type. |
|
pure virtual |
[in] | index | The index of the funcdef. |
This function does not increase the reference count of the return function definition.
|
pure virtual |
|
pure virtual |
[in] | typeId | The type id for the funcdef. |
This does not increment the reference count of the returned function interface.
|
pure virtual |
[in] | funcId | The id of the function or method. |
This does not increment the reference count of the returned function interface.
|
pure virtual |
[out] | currentSize | The current number of objects known to the garbage collector. |
[out] | totalDestroyed | The total number of objects destroyed by the garbage collector. |
[out] | totalDetected | The total number of objects detected as garbage with circular references. |
[out] | newObjects | The current number of objects in the new generation. |
[out] | totalNewDestroyed | The total number of objects destroyed while still in the new generation. |
This method can be used to query the number of objects that the garbage collector is keeping track of. If the number is very large then it is probably time to call the GarbageCollect method so that some of the objects ca be freed.
|
pure virtual |
[in] | declaration | The signature of the function. |
|
pure virtual |
[in] | index | The index of the registered global function. |
|
pure virtual |
|
pure virtual |
[in] | index | The index of the global variable. |
[out] | name | Receives the name of the property. |
[out] | nameSpace | Receives the namespace of the property. |
[out] | typeId | Receives the typeId of the property. |
[out] | isConst | Receives the constness indicator of the property. |
[out] | configGroup | Receives the config group in which the property was registered. |
[out] | pointer | Receives the pointer of the property. |
[out] | accessMask | Receives the access mask of the property. |
asINVALID_ARG | index is too large. |
|
pure virtual |
|
pure virtual |
[in] | decl | The declaration of the property to search for. |
asNO_GLOBAL_VAR | No matching property was found. |
asINVALID_DECLARATION | The given declaration is invalid. |
|
pure virtual |
[in] | name | The name of the property. |
asNO_GLOBAL_VAR | No matching property was found. |
|
pure virtual |
[in] | module | The name of the module |
[in] | flag | One of the asEGMFlags flags |
Use this method to get access to the module interface, which will let you build new scripts, and enumerate functions and types in existing modules.
If asGM_ALWAYS_CREATE is informed as the flag the previous module with the same name will be discarded, thus any pointers that the engine holds to it will be invalid after the call.
|
pure virtual |
[in] | index | The index of the module. |
|
pure virtual |
|
pure virtual |
[in] | idx | The index of the desired object |
[out] | seqNbr | The sequence number of the obtained object |
[out] | obj | The object pointer |
[out] | type | The type of the obtained object |
asINVALID_ARG | The index is not valid |
|
pure virtual |
[in] | typeId | The type id of the type. |
This does not increment the reference count of the returned object type.
|
pure virtual |
[in] | index | The index of the type. |
|
pure virtual |
[in] | name | The name of the type. |
|
pure virtual |
|
pure virtual |
[in] | typeId | The type id of the type. |
This method can be used to return the size of any built-in primitive type, and also for script declared or application registered enums.
|
pure virtual |
asNO_FUNCTION | The string factory has not been registered. |
|
pure virtual |
[in] | typeId | The type id of the type. |
[in] | includeNamespace | Set to true if the namespace should be included in the formatted declaration. |
|
pure virtual |
[in] | index | The index of the typedef. |
[out] | typeId | The type that the typedef aliases. |
[out] | nameSpace | The namespace in which the typedef was registered. |
[out] | configGroup | Receives the config group in which the type def was registered. |
[out] | accessMask | The access mask for the typedef. |
|
pure virtual |
|
pure virtual |
[in] | decl | The declaration of the type. |
asINVALID_TYPE | decl is not a valid type. |
Translates a type declaration into a type id. The returned type id is valid for as long as the type is valid, so you can safely store it for later use to avoid potential overhead by calling this function each time. Just remember to update the type id, any time the type is changed within the engine, e.g. when recompiling script declared classes, or changing the engine configuration.
The type id is based on a sequence number and depends on the order in which the type ids are queried, thus is not guaranteed to always be the same for each execution of the application. The asETypeIdFlags can be used to obtain some information about the type directly from the id.
A base type yields the same type id whether the declaration is const or not, however if the const is for the subtype then the type id is different, e.g. string@ isn't the same as const string@ but string is the same as const string.
This method is only able to return the type id that are not specific for a script module, i.e. built-in types and application registered types. Type ids for script declared types should be obtained through the script module's GetTypeIdByDecl.
|
pure virtual |
[in] | type | An identifier specifying the user data to get. |
|
pure virtual |
[in] | obj | The object |
[in] | type | The object type |
The method doesn't increase the reference to the returned shared boolean.
|
pure virtual |
[in] | obj | A pointer to the object. |
[in] | objTypeId | The type id of the object. |
[in] | handleTypeId | The type id of the handle. |
This method can be used to determine if a handle of a certain type is compatible with an object of another type. This is useful if you have a pointer to a object, but only knows that it implements a certain interface and now you want to determine if it implements another interface.
|
pure virtual |
[in] | obj | A pointer to the newly created object. |
[in] | type | The type of the object. |
asINVALID_ARG | Either the object or the type is null |
This method should be called when a new garbage collected object is created. The GC will then store a reference to the object so that it can automatically detect whether the object is involved in any circular references that should be released.
|
pure virtual |
[in] | string | The string to parse. |
[in] | stringLength | The length of the string. Can be 0 if the string is null terminated. |
[out] | tokenLength | Gives the length of the identified token. |
This function is useful for those applications that want to tokenize strings into tokens that the script language uses, e.g. IDEs providing syntax highlighting, or intellisense. It can also be used to parse the meta data strings that may be declared for script entities.
|
pure virtual |
[in] | type | The name of the template type, e.g. array<T> |
asINVALID_TYPE | The type is not a template type |
|
pure virtual |
[in] | type | The name of the enum type. |
asINVALID_NAME | type is null. |
asALREADY_REGISTERED | Another type with this name already exists. |
asERROR | The type couldn't be parsed. |
asINVALID_NAME | The type is not an identifier, or it is a reserved keyword. |
asNAME_TAKEN | The type name is already taken. |
This method registers an enum type in the engine. The enum values should then be registered with RegisterEnumValue.
|
pure virtual |
[in] | type | The name of the enum type. |
[in] | name | The name of the enum value. |
[in] | value | The integer value of the enum value. |
asWRONG_CONFIG_GROUP | The enum type was registered in a different configuration group. |
asINVALID_TYPE | The type is invalid. |
asALREADY_REGISTERED | The name is already registered for this enum. |
This method registers an enum value for a previously registered enum type.
|
pure virtual |
[in] | decl | The declaration of the function definition. |
asINVALID_ARG | The decl parameter is not given. |
asINVALID_DECLARATION | decl is not a valid function definition. |
asNAME_TAKEN | The name of the funcdef conflicts with another name. |
Funcdefs are used to define the signature of function pointers. If the application is going to receive function pointers from scripts, it is necessary to first register the funcdef before registering the function or property that will be used to receive it.
|
pure virtual |
[in] | declaration | The declaration of the global function in script syntax. |
[in] | funcPointer | The function pointer. |
[in] | callConv | The calling convention for the function. |
[in] | objForThiscall | An object pointer for use with asCALL_THISCALL_ASGLOBAL. |
asNOT_SUPPORTED | The calling convention is not supported. |
asWRONG_CALLING_CONV | The function's calling convention doesn't match callConv. |
asINVALID_DECLARATION | The function declaration is invalid. |
asNAME_TAKEN | The function name is already used elsewhere. |
asALREADY_REGISTERED | The function has already been registered with the same parameter list. |
This method registers system functions that the scripts may use to communicate with the host application.
|
pure virtual |
[in] | declaration | The declaration of the global property in script syntax. |
[in] | pointer | The address of the property that will be used to access the property value. |
asINVALID_DECLARATION | The declaration has invalid syntax. |
asINVALID_TYPE | The declaration is a reference. |
asINVALID_ARG | The pointer is null. |
asNAME_TAKEN | The name is already taken. |
Use this method to register a global property that the scripts will be able to access as global variables. The property may optionally be registered as const, if the scripts shouldn't be allowed to modify it.
When registering the property, the application must pass the address to the actual value. The application must also make sure that this address remains valid throughout the life time of this registration, i.e. until the engine is released or the dynamic configuration group is removed.
|
pure virtual |
[in] | name | The name of the interface. |
asINVALID_NAME | The name is null, or a reserved keyword. |
asALREADY_REGISTERED | An object type with this name already exists. |
asERROR | The name is not a proper identifier. |
asNAME_TAKEN | The name is already used elsewhere. |
This registers an interface that script classes can implement. By doing this the application can register functions and methods that receives an asIScriptObject and still be sure that the class implements certain methods needed by the application.
|
pure virtual |
[in] | intf | The name of the interface. |
[in] | declaration | The method declaration. |
asWRONG_CONFIG_GROUP | The interface was registered in another configuration group. |
asINVALID_TYPE | intf is not an interface type. |
asINVALID_DECLARATION | The declaration is invalid. |
asNAME_TAKEN | The method name is already taken. |
This registers a method that the class that implements the interface must have.
|
pure virtual |
[in] | obj | The name of the type. |
[in] | behaviour | One of the object behaviours from asEBehaviours. |
[in] | declaration | The declaration of the method in script syntax. |
[in] | funcPointer | The method or function pointer. |
[in] | callConv | The calling convention for the method or function. |
[in] | objForThiscall | The object pointer used for asCALL_THISCALL_ASGLOBAL. |
asWRONG_CONFIG_GROUP | The object type was registered in a different configuration group. |
asINVALID_ARG | obj is not set, or a global behaviour is given in behaviour. |
asWRONG_CALLING_CONV | The function's calling convention isn't compatible with callConv. |
asNOT_SUPPORTED | The calling convention or the behaviour signature is not supported. |
asINVALID_TYPE | The obj parameter is not a valid object name. |
asINVALID_DECLARATION | The declaration is invalid. |
asILLEGAL_BEHAVIOUR_FOR_TYPE | The behaviour is not allowed for this type. |
asALREADY_REGISTERED | The behaviour is already registered with the same signature. |
Use this method to register behaviour functions that will be called by the virtual machine to perform certain operations, such as memory management, math operations, comparisons, etc.
The declaration must form a valid function signature, but the give function name will not be used or stored in the application so there is no need to provide a meaningful function name.
|
pure virtual |
[in] | obj | The name of the type. |
[in] | declaration | The declaration of the method in script syntax. |
[in] | funcPointer | The method or function pointer. |
[in] | callConv | The calling convention for the method or function. |
asWRONG_CONFIG_GROUP | The object type was registered in a different configuration group. |
asNOT_SUPPORTED | The calling convention is not supported. |
asINVALID_TYPE | The obj parameter is not a valid object name. |
asINVALID_DECLARATION | The declaration is invalid. |
asNAME_TAKEN | The name conflicts with other members. |
asWRONG_CALLING_CONV | The function's calling convention isn't compatible with callConv. |
asALREADY_REGISTERED | The method has already been registered with the same parameter list. |
Use this method to register a member method for the type. The method that is registered may be an actual class method, or a global function that takes the object pointer as either the first or last parameter. Or it may be a global function implemented with the generic calling convention.
|
pure virtual |
[in] | obj | The name of the type. |
[in] | declaration | The property declaration in script syntax. |
[in] | byteOffset | The offset into the memory block where this property is found. |
asWRONG_CONFIG_GROUP | The object type was registered in a different configuration group. |
asINVALID_OBJECT | The obj does not specify an object type. |
asINVALID_TYPE | The obj parameter has invalid syntax. |
asINVALID_DECLARATION | The declaration is invalid. |
asNAME_TAKEN | The name conflicts with other members. |
Use this method to register a member property of a class. The property must be local to the object, i.e. not a global variable or a static member. The easiest way to get the offset of the property is to use the asOFFSET macro.
|
pure virtual |
[in] | obj | The name of the type. |
[in] | byteSize | The size of the type in bytes. Only necessary for value types. |
[in] | flags | One or more of the asEObjTypeFlags. |
asINVALID_ARG | The flags are invalid. |
asINVALID_NAME | The name is invalid. |
asALREADY_REGISTERED | Another type of the same name already exists. |
asNAME_TAKEN | The name conflicts with other symbol names. |
asLOWER_ARRAY_DIMENSION_NOT_REGISTERED | When registering an array type the array element must be a primitive or a registered type. |
asINVALID_TYPE | The array type was not properly formed. |
asNOT_SUPPORTED | The array type is not supported, or already in use preventing it from being overloaded. |
Use this method to register new types that should be available to the scripts. Reference types, which have their memory managed by the application, should be registered with asOBJ_REF. Value types, which have their memory managed by the engine, should be registered with asOBJ_VALUE.
|
pure virtual |
[in] | datatype | The datatype that the string factory returns |
[in] | factoryFunc | The pointer to the factory function |
[in] | callConv | The calling convention of the factory function |
[in] | objForThiscall | The object pointer used for asCALL_THISCALL_ASGLOBAL. |
asNOT_SUPPORTED | The calling convention is not supported. |
asWRONG_CALLING_CONV | The function's calling convention doesn't match callConv. |
asINVALID_TYPE | The datatype is not a valid type. |
Use this function to register a string factory that will be called when the virtual machine finds a string constant in an expression. The string factory function will receive two parameters, the length of the string constant in bytes and a pointer to the character data. The factory should return a value to a previously registered type that will represent the string. Example:
The example assumes that the std::string type has been registered as the string type, with RegisterObjectType.
|
pure virtual |
[in] | type | The name of the new typedef |
[in] | decl | The datatype that the typedef represents |
asINVALID_NAME | The type is null. |
asALREADY_REGISTERED | A type with the same name already exists. |
asINVALID_TYPE | The decl is not a primitive type. |
asINVALID_NAME | The type is not an identifier, or it is a reserved keyword. |
asNAME_TAKEN | The name is already used elsewhere. |
This method registers an alias for a data type.
Currently typedefs can only be registered for built-in primitive types.
|
pure virtual |
Call this method when you will no longer use the references that you own.
The application is responsible for releasing references to all other script objects before releasing its last reference to the engine. If this is not done, it is possible that memory leaks occur as the engine cannot free objects kept alive by the application.
|
pure virtual |
|
pure virtual |
[in] | obj | A pointer to the object. |
[in] | type | The type of the object. |
This calls the release method of the object to release the reference.
|
pure virtual |
[in] | groupName | The name of the configuration group |
asCONFIG_GROUP_IS_IN_USE | The group is in use and cannot be removed. |
Remove the configuration group. If something in the configuration group is currently in use, the function will return with an error code. Examples of uses are compiled modules that have function calls to functions in the group and global variables of types registered in the group.
|
pure virtual |
[in] | callback | A pointer to the function |
The function given with this call will be invoked when a context is destroyed if any user data has been registered with the context.
The function is called from within the context destructor, so the callback should not be used for anything but cleaning up the user data itself.
[in] | defaultMask | The default access bit mask. |
|
pure virtual |
[in] | nameSpace | The namespace that should be used. |
asINVALID_ARG | The namespace is invalid |
Call this method to set the default namespace for which the following calls should assume. This applies to registration of the application interface and also to the functions that searches for registered entities.
Nested namespaces can be informed by separating them with the scope token, i.e. ::
|
pure virtual |
[in] | property | One of the asEEngineProp values. |
[in] | value | The new value of the property. |
asINVALID_ARG | Invalid property. |
With this method you can change the way the script engine works in some regards.
|
pure virtual |
[in] | callback | A pointer to the function |
[in] | type | An identifier specifying which user data the callback is to be used with. |
The function given with this call will be invoked when the engine is destroyed if any user data has been registered with the engine.
The function is called from within the engine destructor, so the callback should not be used for anything but cleaning up the user data itself.
|
pure virtual |
[in] | callback | A pointer to the function |
The function given with this call will be invoked when a function is destroyed if any user data has been registered with the function.
The function is called from within the function destructor, so the callback should not be used for anything but cleaning up the user data itself.
|
pure virtual |
[in] | callback | A function or class method pointer. |
[in] | obj | The object for methods, or an optional parameter for functions. |
[in] | callConv | The calling convention. |
asINVALID_ARG | One of the arguments is incorrect, e.g. obj is null for a class method. |
asNOT_SUPPORTED | The arguments are not supported, e.g. asCALL_GENERIC. |
This method sets the callback routine that will receive compiler messages. The callback routine can be either a class method, e.g:
or a global function, e.g:
It is recommended to register the message callback routine right after creating the engine, as some of the registration functions can provide useful information to better explain errors.
|
pure virtual |
[in] | callback | A pointer to the function |
The function given with this call will be invoked when the module is destroyed if any user data has been registered with the module.
The function is called from within the module destructor, so the callback should not be used for anything but cleaning up the user data itself.
|
pure virtual |
[in] | callback | A pointer to the function |
[in] | type | An identifier specifying which user data the callback is to be used with. |
The function given with this call will be invoked when an object type is destroyed if any user data has been registered with the type.
The function is called from within the object type destructor, so the callback should not be used for anything but cleaning up the user data itself.
|
pure virtual |
[in] | data | A pointer to the user data. |
[in] | type | An identifier specifying the user data to set. |
This method allows the application to associate a value, e.g. a pointer, with the engine instance.
The type values 1000 through 1999 are reserved for use by the official add-ons.
Optionally, a callback function can be registered to clean up the user data when the engine is destroyed.
|
pure virtual |
[in] | section | The name of the script section. |
[in] | row | The row number. |
[in] | col | The column number. |
[in] | type | The message type. |
[in] | message | The message text. |
asINVALID_ARG | The section or message is null. |
This method can be used by the application to write messages to the same message callback that the script compiler uses. This is useful for example if a preprocessor is used.