(hacky fork) up-to-date implementation of the angelscript C wrapper. Originally by Andreas Jönsson.

as_c.cpp 59KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. /*
  2. AngelCode Scripting Library
  3. Copyright (c) 2003-2017 Andreas Jonsson
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any
  6. damages arising from the use of this software.
  7. Permission is granted to anyone to use this software for any
  8. purpose, including commercial applications, and to alter it and
  9. redistribute it freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you
  11. must not claim that you wrote the original software. If you use
  12. this software in a product, an acknowledgment in the product
  13. documentation would be appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and
  15. must not be misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source
  17. distribution.
  18. The original version of this library can be located at:
  19. http://www.angelcode.com/angelscript/
  20. Andreas Jonsson
  21. andreas@angelcode.com
  22. */
  23. //
  24. // as_c.cpp
  25. //
  26. // A C interface to the library
  27. //
  28. // Include the C++ interface header so we can call the proper methods
  29. #include <angelscript.h>
  30. BEGIN_AS_NAMESPACE
  31. typedef int (*asBINARYREADFUNC_t)(void *ptr, asUINT size, void *param);
  32. typedef int (*asBINARYWRITEFUNC_t)(const void *ptr, asUINT size, void *param);
  33. typedef const void* (*asSTRINGCONSTGETFUNC_t)(const char *data, asUINT length, void *param);
  34. typedef int (*asSTRINGRELEASEFUNC_t)(const void *ptr, void *param);
  35. typedef int (*asSTRINGGETFUNC_t)(const void *str, const char *data, asUINT *length, void *param);
  36. typedef enum { asTRUE = 1, asFALSE = 0 } asBOOL;
  37. class asCBinaryStreamC : public asIBinaryStream
  38. {
  39. public:
  40. asCBinaryStreamC(asBINARYWRITEFUNC_t write, asBINARYREADFUNC_t read, void *param) {this->write = write; this->read = read; this->param = param;}
  41. int Write(const void *ptr, asUINT size) { return write(ptr, size, param); }
  42. int Read(void *ptr, asUINT size) { return read(ptr, size, param); }
  43. asBINARYREADFUNC_t read;
  44. asBINARYWRITEFUNC_t write;
  45. void *param;
  46. };
  47. class asCStringFactory : public asIStringFactory
  48. {
  49. public:
  50. asCStringFactory(asSTRINGCONSTGETFUNC_t stringConst, asSTRINGRELEASEFUNC_t release, asSTRINGGETFUNC_t get, void *param) {
  51. this->stringConst = stringConst;
  52. this->release = release;
  53. this->get = get;
  54. this->param = param;
  55. }
  56. const void* GetStringConstant(const char *data, asUINT length) { return stringConst(data, length, param); }
  57. int ReleaseStringConstant(const void *ptr) { return release(ptr, param); }
  58. int GetRawStringData(const void *str, char *data, asUINT *length) const { return get(str, data, length, param); }
  59. asSTRINGCONSTGETFUNC_t stringConst;
  60. asSTRINGRELEASEFUNC_t release;
  61. asSTRINGGETFUNC_t get;
  62. void *param;
  63. };
  64. extern "C"
  65. {
  66. // Implement a global wrapper function for each of the library's interface methods
  67. // Note that half the implementations are waaaay off to the right ---->
  68. ///////////////////////////////////////////
  69. // asIScriptEngine
  70. // Memory management
  71. AS_API int asEngine_AddRef(asIScriptEngine *e) { return e->AddRef(); }
  72. AS_API int asEngine_Release(asIScriptEngine *e) { return e->Release(); }
  73. AS_API int asEngine_ShutDownAndRelease(asIScriptEngine *e) { return e->ShutDownAndRelease(); }
  74. // Engine properties
  75. AS_API int asEngine_SetEngineProperty(asIScriptEngine *e, asEEngineProp property, asPWORD value) { return e->SetEngineProperty(property, value); }
  76. AS_API asPWORD asEngine_GetEngineProperty(asIScriptEngine *e, asEEngineProp property) { return e->GetEngineProperty(property); }
  77. // Compiler messages
  78. AS_API int asEngine_SetMessageCallback(asIScriptEngine *e, asFUNCTION_t callback, void *obj, asDWORD callConv) { return e->SetMessageCallback(asFUNCTION(callback), obj, callConv); }
  79. AS_API int asEngine_ClearMessageCallback(asIScriptEngine *e) { return e->ClearMessageCallback(); }
  80. AS_API int asEngine_WriteMessage(asIScriptEngine *e, const char *section, int row, int col, asEMsgType type, const char *message) { return e->WriteMessage(section, row, col, type, message); }
  81. // JIT Compiler
  82. AS_API int asEngine_SetJITCompiler(asIScriptEngine *e, asIJITCompiler *compiler) { return e->SetJITCompiler(compiler); }
  83. AS_API asIJITCompiler * asEngine_GetJITCompiler(asIScriptEngine *e) { return e->GetJITCompiler(); }
  84. // Global functions
  85. AS_API int asEngine_RegisterGlobalFunction(asIScriptEngine *e, const char *declaration, asFUNCTION_t funcPointer, asDWORD callConv, void *auxiliary) { return e->RegisterGlobalFunction(declaration, asFUNCTION(funcPointer), callConv, auxiliary); }
  86. AS_API asUINT asEngine_GetGlobalFunctionCount(asIScriptEngine *e) { return e->GetGlobalFunctionCount(); }
  87. AS_API asIScriptFunction* asEngine_GetGlobalFunctionByIndex(asIScriptEngine *e, asUINT index) { return e->GetGlobalFunctionByIndex(index); }
  88. AS_API asIScriptFunction* asEngine_GetGlobalFunctionByDecl(asIScriptEngine *e, const char *declaration) { return e->GetGlobalFunctionByDecl(declaration); }
  89. // Global properties
  90. AS_API int asEngine_RegisterGlobalProperty(asIScriptEngine *e, const char *declaration, void *pointer) { return e->RegisterGlobalProperty(declaration, pointer); }
  91. AS_API asUINT asEngine_GetGlobalPropertyCount(asIScriptEngine *e) { return e->GetGlobalPropertyCount(); }
  92. AS_API int asEngine_GetGlobalPropertyByIndex(asIScriptEngine *e, asUINT index, const char **name, const char **nameSpace = 0, int *typeId = 0, asBOOL *isConst = 0, const char **configGroup = 0, void **pointer = 0, asDWORD *accessMask = 0) { bool _isConst; int r = e->GetGlobalPropertyByIndex(index, name, nameSpace, typeId, &_isConst, configGroup, pointer, accessMask); if( isConst ) *isConst = _isConst ? asTRUE : asFALSE; return r; }
  93. AS_API int asEngine_GetGlobalPropertyIndexByName(asIScriptEngine *e, const char *name) { return e->GetGlobalPropertyIndexByName(name); }
  94. AS_API int asEngine_GetGlobalPropertyIndexByDecl(asIScriptEngine *e, const char *decl) { return e->GetGlobalPropertyIndexByDecl(decl); }
  95. // Object types
  96. AS_API int asEngine_RegisterObjectType(asIScriptEngine *e, const char *name, int byteSize, asDWORD flags) { return e->RegisterObjectType(name, byteSize, flags); }
  97. AS_API int asEngine_RegisterObjectProperty(asIScriptEngine *e, const char *obj, const char *declaration, int byteOffset) { return e->RegisterObjectProperty(obj, declaration, byteOffset); }
  98. AS_API int asEngine_RegisterObjectMethod(asIScriptEngine *e, const char *obj, const char *declaration, asFUNCTION_t funcPointer, asDWORD callConv, void *auxiliary) { return e->RegisterObjectMethod(obj, declaration, asFUNCTION(funcPointer), callConv, auxiliary); }
  99. AS_API int asEngine_RegisterObjectBehaviour(asIScriptEngine *e, const char *datatype, asEBehaviours behaviour, const char *declaration, asFUNCTION_t funcPointer, asDWORD callConv, void *auxiliary) { return e->RegisterObjectBehaviour(datatype, behaviour, declaration, asFUNCTION(funcPointer), callConv, auxiliary); }
  100. AS_API int asEngine_RegisterInterface(asIScriptEngine *e, const char *name) { return e->RegisterInterface(name); }
  101. AS_API int asEngine_RegisterInterfaceMethod(asIScriptEngine *e, const char *intf, const char *declaration) { return e->RegisterInterfaceMethod(intf, declaration); }
  102. AS_API asUINT asEngine_GetObjectTypeCount(asIScriptEngine *e) { return e->GetObjectTypeCount(); }
  103. AS_API asITypeInfo * asEngine_GetObjectTypeByIndex(asIScriptEngine *e, asUINT index) { return e->GetObjectTypeByIndex(index); }
  104. // String factory
  105. AS_API int asEngine_RegisterStringFactory(asIScriptEngine *e, const char *datatype, asSTRINGCONSTGETFUNC_t stringConst, asSTRINGRELEASEFUNC_t release, asSTRINGGETFUNC_t get, void *param) { return e->RegisterStringFactory(datatype, new asCStringFactory(stringConst, release, get, param)); }
  106. AS_API int asEngine_GetStringFactoryReturnTypeId(asIScriptEngine *e, asDWORD *flags) { return e->GetStringFactoryReturnTypeId(flags); }
  107. // Default array type
  108. AS_API int asEngine_RegisterDefaultArrayType(asIScriptEngine *e, const char *type) { return e->RegisterDefaultArrayType(type); }
  109. AS_API int asEngine_GetDefaultArrayTypeId(asIScriptEngine *e) { return e->GetDefaultArrayTypeId(); }
  110. // Enums
  111. AS_API int asEngine_RegisterEnum(asIScriptEngine *e, const char *type) { return e->RegisterEnum(type); }
  112. AS_API int asEngine_RegisterEnumValue(asIScriptEngine *e, const char *type, const char *name, int value) { return e->RegisterEnumValue(type,name,value); }
  113. AS_API asUINT asEngine_GetEnumCount(asIScriptEngine *e) { return e->GetEnumCount(); }
  114. AS_API asITypeInfo * asEngine_GetEnumByIndex(asIScriptEngine *e, asUINT index) { return e->GetEnumByIndex(index); }
  115. // Funcdefs
  116. AS_API int asEngine_RegisterFuncdef(asIScriptEngine *e, const char *decl) { return e->RegisterFuncdef(decl); }
  117. AS_API asUINT asEngine_GetFuncdefCount(asIScriptEngine *e) { return e->GetFuncdefCount(); }
  118. AS_API asITypeInfo * asEngine_GetFuncdefByIndex(asIScriptEngine *e, asUINT index) { return e->GetFuncdefByIndex(index); }
  119. // Typedefs
  120. AS_API int asEngine_RegisterTypedef(asIScriptEngine *e, const char *type, const char *decl) { return e->RegisterTypedef(type,decl); }
  121. AS_API asUINT asEngine_GetTypedefCount(asIScriptEngine *e) { return e->GetTypedefCount(); }
  122. AS_API asITypeInfo * asEngine_GetTypedefByIndex(asIScriptEngine *e, asUINT index) { return e->GetTypedefByIndex(index); }
  123. // Configuration groups
  124. AS_API int asEngine_BeginConfigGroup(asIScriptEngine *e, const char *groupName) { return e->BeginConfigGroup(groupName); }
  125. AS_API int asEngine_EndConfigGroup(asIScriptEngine *e) { return e->EndConfigGroup(); }
  126. AS_API int asEngine_RemoveConfigGroup(asIScriptEngine *e, const char *groupName) { return e->RemoveConfigGroup(groupName); }
  127. AS_API asDWORD asEngine_SetDefaultAccessMask(asIScriptEngine *e, asDWORD defaultMask) { return e->SetDefaultAccessMask(defaultMask); }
  128. AS_API int asEngine_SetDefaultNamespace(asIScriptEngine *e, const char *nameSpace) { return e->SetDefaultNamespace(nameSpace); }
  129. AS_API const char * asEngine_GetDefaultNamespace(asIScriptEngine *e) { return e->GetDefaultNamespace(); }
  130. // Script modules
  131. AS_API asIScriptModule * asEngine_GetModule(asIScriptEngine *e, const char *module, asEGMFlags flag) { return e->GetModule(module, flag); }
  132. AS_API int asEngine_DiscardModule(asIScriptEngine *e, const char *module) { return e->DiscardModule(module); }
  133. AS_API asUINT asEngine_GetModuleCount(asIScriptEngine *e) { return e->GetModuleCount(); }
  134. AS_API asIScriptModule * asEngine_GetModuleByIndex(asIScriptEngine *e, asUINT index) { return e->GetModuleByIndex(index); }
  135. // Script functions
  136. AS_API asIScriptFunction *asEngine_GetFunctionById(asIScriptEngine *e, int funcId) { return e->GetFunctionById(funcId); }
  137. // Type identification
  138. AS_API int asEngine_GetTypeIdByDecl(asIScriptEngine *e, const char *decl) { return e->GetTypeIdByDecl(decl); }
  139. AS_API const char * asEngine_GetTypeDeclaration(asIScriptEngine *e, int typeId, asBOOL includeNamespace) { return e->GetTypeDeclaration(typeId, includeNamespace ? true : false); }
  140. AS_API int asEngine_GetSizeOfPrimitiveType(asIScriptEngine *e, int typeId) { return e->GetSizeOfPrimitiveType(typeId); }
  141. AS_API asITypeInfo *asEngine_GetTypeInfoById(asIScriptEngine *e, int typeId) { return e->GetTypeInfoById(typeId); }
  142. AS_API asITypeInfo *asEngine_GetTypeInfoByName(asIScriptEngine *e, const char *name) { return e->GetTypeInfoByName(name); }
  143. AS_API asITypeInfo *asEngine_GetTypeInfoByDecl(asIScriptEngine *e, const char *decl) { return e->GetTypeInfoByDecl(decl); }
  144. // Script execution
  145. AS_API asIScriptContext * asEngine_CreateContext(asIScriptEngine *e) { return e->CreateContext(); }
  146. AS_API void * asEngine_CreateScriptObject(asIScriptEngine *e, asITypeInfo *type) { return e->CreateScriptObject(type); }
  147. AS_API void * asEngine_CreateScriptObjectCopy(asIScriptEngine *e, void *obj, asITypeInfo *type) { return e->CreateScriptObjectCopy(obj, type); }
  148. AS_API void * asEngine_CreateUninitializedScriptObject(asIScriptEngine *e, asITypeInfo *type) { return e->CreateUninitializedScriptObject(type); }
  149. AS_API asIScriptFunction * asEngine_CreateDelegate(asIScriptEngine *e, asIScriptFunction *func, void *obj) { return e->CreateDelegate(func, obj); }
  150. AS_API int asEngine_AssignScriptObject(asIScriptEngine *e, void *dstObj, void *srcObj, asITypeInfo *type) { return e->AssignScriptObject(dstObj, srcObj, type); }
  151. AS_API void asEngine_ReleaseScriptObject(asIScriptEngine *e, void *obj, asITypeInfo *type) { e->ReleaseScriptObject(obj, type); }
  152. AS_API void asEngine_AddRefScriptObject(asIScriptEngine *e, void *obj, asITypeInfo *type) { e->AddRefScriptObject(obj, type); }
  153. AS_API int asEngine_RefCastObject(asIScriptEngine *e, void *obj, asITypeInfo *fromType, asITypeInfo *toType, void **newPtr, bool useOnlyImplicitCast) { return e->RefCastObject(obj, fromType, toType, newPtr, useOnlyImplicitCast); }
  154. AS_API asILockableSharedBool *asEngine_GetWeakRefFlagOfScriptObject(asIScriptEngine *e, void *obj, asITypeInfo *type) { return e->GetWeakRefFlagOfScriptObject(obj, type); }
  155. // Context pooling
  156. AS_API asIScriptContext *asEngine_RequestContext(asIScriptEngine *e) { return e->RequestContext(); }
  157. AS_API void asEngine_ReturnContext(asIScriptEngine *e, asIScriptContext *ctx) { e->ReturnContext(ctx); }
  158. AS_API int asEngine_SetContextCallbacks(asIScriptEngine *e, asREQUESTCONTEXTFUNC_t requestCtx, asRETURNCONTEXTFUNC_t returnCtx, void *param) { return e->SetContextCallbacks(requestCtx, returnCtx, param); }
  159. // String interpretation
  160. AS_API asETokenClass asEngine_ParseToken(asIScriptEngine *e, const char *string, size_t stringLength, asUINT *tokenLength) { return e->ParseToken(string, stringLength, tokenLength); }
  161. // Garbage collection
  162. AS_API int asEngine_GarbageCollect(asIScriptEngine *e, asDWORD flags) { return e->GarbageCollect(flags); }
  163. AS_API void asEngine_GetGCStatistics(asIScriptEngine *e, asUINT *currentSize, asUINT *totalDestroyed, asUINT *totalDetected, asUINT *newObjects, asUINT *totalNewDestroyed) { e->GetGCStatistics(currentSize, totalDestroyed, totalDetected, newObjects, totalNewDestroyed); }
  164. AS_API int asEngine_NotifyGarbageCollectorOfNewObject(asIScriptEngine *e, void *obj, asITypeInfo *type) { return e->NotifyGarbageCollectorOfNewObject(obj, type); }
  165. AS_API int asEngine_GetObjectInGC(asIScriptEngine *e, asUINT idx, asUINT *seqNbr, void **obj, asITypeInfo **type) { return e->GetObjectInGC(idx, seqNbr, obj, type); }
  166. AS_API void asEngine_GCEnumCallback(asIScriptEngine *e, void *obj) { e->GCEnumCallback(obj); }
  167. // User data
  168. AS_API void * asEngine_SetUserData(asIScriptEngine *e, void *data, asPWORD type) { return e->SetUserData(data, type); }
  169. AS_API void * asEngine_GetUserData(asIScriptEngine *e, asPWORD type) { return e->GetUserData(type); }
  170. AS_API void asEngine_SetEngineUserDataCleanupCallback(asIScriptEngine *e, asCLEANENGINEFUNC_t callback, asPWORD type) { e->SetEngineUserDataCleanupCallback(callback, type); }
  171. AS_API void asEngine_SetModuleUserDataCleanupCallback(asIScriptEngine *e, asCLEANMODULEFUNC_t callback) { e->SetModuleUserDataCleanupCallback(callback); }
  172. AS_API void asEngine_SetContextUserDataCleanupCallback(asIScriptEngine *e, asCLEANCONTEXTFUNC_t callback) { e->SetContextUserDataCleanupCallback(callback); }
  173. AS_API void asEngine_SetFunctionUserDataCleanupCallback(asIScriptEngine *e, asCLEANFUNCTIONFUNC_t callback) { e->SetFunctionUserDataCleanupCallback(callback); }
  174. AS_API void asEngine_SetTypeInfoUserDataCleanupCallback(asIScriptEngine *e, asCLEANTYPEINFOFUNC_t callback, asPWORD type) { e->SetTypeInfoUserDataCleanupCallback(callback); }
  175. AS_API void asEngine_SetScriptObjectUserDataCleanupCallback(asIScriptEngine *e, asCLEANSCRIPTOBJECTFUNC_t callback, asPWORD type) { e->SetScriptObjectUserDataCleanupCallback(callback, type); }
  176. ///////////////////////////////////////////
  177. // asIScriptModule
  178. AS_API asIScriptEngine *asModule_GetEngine(asIScriptModule *m) { return m->GetEngine(); }
  179. AS_API void asModule_SetName(asIScriptModule *m, const char *name) { m->SetName(name); }
  180. AS_API const char *asModule_GetName(asIScriptModule *m) { return m->GetName(); }
  181. AS_API void asModule_Discard(asIScriptModule *m) { m->Discard(); }
  182. // Compilation
  183. AS_API int asModule_AddScriptSection(asIScriptModule *m, const char *name, const char *code, size_t codeLength, int lineOffset) { return m->AddScriptSection(name, code, codeLength, lineOffset); }
  184. AS_API int asModule_Build(asIScriptModule *m) { return m->Build(); }
  185. AS_API int asModule_CompileFunction(asIScriptModule *m, const char *sectionName, const char *code, int lineOffset, asDWORD compileFlags, asIScriptFunction **outFunc) { return m->CompileFunction(sectionName, code, lineOffset, compileFlags, outFunc); }
  186. AS_API int asModule_CompileGlobalVar(asIScriptModule *m, const char *sectionName, const char *code, int lineOffset) { return m->CompileGlobalVar(sectionName, code, lineOffset); }
  187. AS_API asDWORD asModule_SetAccessMask(asIScriptModule *m, asDWORD accessMask) { return m->SetAccessMask(accessMask); }
  188. AS_API int asModule_SetDefaultNamespace(asIScriptModule *m,const char *nameSpace) { return m->SetDefaultNamespace(nameSpace); };
  189. AS_API const char *asModule_GetDefaultNamespace(asIScriptModule *m) { return m->GetDefaultNamespace(); }
  190. // Functions
  191. AS_API asUINT asModule_GetFunctionCount(asIScriptModule *m) { return m->GetFunctionCount(); }
  192. AS_API asIScriptFunction *asModule_GetFunctionByIndex(asIScriptModule *m, asUINT index) { return m->GetFunctionByIndex(index); }
  193. AS_API asIScriptFunction *asModule_GetFunctionByDecl(asIScriptModule *m, const char *decl) { return m->GetFunctionByDecl(decl); }
  194. AS_API asIScriptFunction *asModule_GetFunctionByName(asIScriptModule *m, const char *name) { return m->GetFunctionByName(name); }
  195. AS_API int asModule_RemoveFunction(asIScriptModule *m, asIScriptFunction *func) { return m->RemoveFunction(func); }
  196. // Global variables
  197. AS_API int asModule_ResetGlobalVars(asIScriptModule *m, asIScriptContext *ctx) { return m->ResetGlobalVars(ctx); }
  198. AS_API asUINT asModule_GetGlobalVarCount(asIScriptModule *m) { return m->GetGlobalVarCount(); }
  199. AS_API int asModule_GetGlobalVarIndexByName(asIScriptModule *m, const char *name) { return m->GetGlobalVarIndexByName(name); }
  200. AS_API int asModule_GetGlobalVarIndexByDecl(asIScriptModule *m, const char *decl) { return m->GetGlobalVarIndexByDecl(decl); }
  201. AS_API const char *asModule_GetGlobalVarDeclaration(asIScriptModule *m, asUINT index, asBOOL includeNamespace) { return m->GetGlobalVarDeclaration(index, includeNamespace ? true : false); }
  202. AS_API int asModule_GetGlobalVar(asIScriptModule *m, asUINT index, const char **name, const char **nameSpace, int *typeId, asBOOL *isConst) { bool _isConst; int r = m->GetGlobalVar(index, name, nameSpace, typeId, &_isConst); if( isConst ) *isConst = _isConst ? asTRUE : asFALSE; return r; }
  203. AS_API void *asModule_GetAddressOfGlobalVar(asIScriptModule *m, asUINT index) { return m->GetAddressOfGlobalVar(index); }
  204. AS_API int asModule_RemoveGlobalVar(asIScriptModule *m, asUINT index) { return m->RemoveGlobalVar(index); }
  205. // Type identification
  206. AS_API asUINT asModule_GetObjectTypeCount(asIScriptModule *m) { return m->GetObjectTypeCount(); }
  207. AS_API asITypeInfo *asModule_GetObjectTypeByIndex(asIScriptModule *m, asUINT index) { return m->GetObjectTypeByIndex(index); }
  208. AS_API int asModule_GetTypeIdByDecl(asIScriptModule *m, const char *decl) { return m->GetTypeIdByDecl(decl); }
  209. AS_API asITypeInfo *asModule_GetTypeInfoByName(asIScriptModule *m, const char *name) { return m->GetTypeInfoByName(name); }
  210. AS_API asITypeInfo *asModule_GetTypeInfoByDecl(asIScriptModule *m, const char *decl) { return m->GetTypeInfoByDecl(decl); }
  211. // Enums
  212. AS_API asUINT asModule_GetEnumCount(asIScriptModule *m) { return m->GetEnumCount(); }
  213. AS_API asITypeInfo * asModule_GetEnumByIndex(asIScriptModule *m, asUINT index) { return m->GetEnumByIndex(index); }
  214. // Typedefs
  215. AS_API asUINT asModule_GetTypedefCount(asIScriptModule *m) { return m->GetTypedefCount(); }
  216. AS_API asITypeInfo * asModule_GetTypedefByIndex(asIScriptModule *m, asUINT index) { return m->GetTypedefByIndex(index); }
  217. // Dynamic binding between modules
  218. AS_API asUINT asModule_GetImportedFunctionCount(asIScriptModule *m) { return m->GetImportedFunctionCount(); }
  219. AS_API int asModule_GetImportedFunctionIndexByDecl(asIScriptModule *m, const char *decl) { return m->GetImportedFunctionIndexByDecl(decl); }
  220. AS_API const char *asModule_GetImportedFunctionDeclaration(asIScriptModule *m, asUINT importIndex) { return m->GetImportedFunctionDeclaration(importIndex); }
  221. AS_API const char *asModule_GetImportedFunctionSourceModule(asIScriptModule *m, asUINT importIndex) { return m->GetImportedFunctionSourceModule(importIndex); }
  222. AS_API int asModule_BindImportedFunction(asIScriptModule *m, asUINT importIndex, asIScriptFunction *func) { return m->BindImportedFunction(importIndex, func); }
  223. AS_API int asModule_UnbindImportedFunction(asIScriptModule *m, asUINT importIndex) { return m->UnbindImportedFunction(importIndex); }
  224. AS_API int asModule_BindAllImportedFunctions(asIScriptModule *m) { return m->BindAllImportedFunctions(); }
  225. AS_API int asModule_UnbindAllImportedFunctions(asIScriptModule *m) { return m->UnbindAllImportedFunctions(); }
  226. // Bytecode saving and loading
  227. AS_API int asModule_SaveByteCode(asIScriptModule *m, asIBinaryStream *out, asBOOL stripDebugInfo) { return m->SaveByteCode(out, stripDebugInfo ? true : false); }
  228. AS_API int asModule_LoadByteCode(asIScriptModule *m, asIBinaryStream *in, asBOOL *wasDebugInfoStripped) { bool _wasDebugInfoStripped; int r = m->LoadByteCode(in, &_wasDebugInfoStripped); if( wasDebugInfoStripped ) *wasDebugInfoStripped = _wasDebugInfoStripped ? asTRUE : asFALSE; return r; }
  229. // User data
  230. AS_API void *asModule_SetUserData(asIScriptModule *m, void *data) { return m->SetUserData(data); }
  231. AS_API void *asModule_GetUserData(asIScriptModule *m) { return m->GetUserData(); }
  232. ///////////////////////////////////////////
  233. // asIScriptContext
  234. // Memory management
  235. AS_API int asContext_AddRef(asIScriptContext *c) { return c->AddRef(); }
  236. AS_API int asContext_Release(asIScriptContext *c) { return c->Release(); }
  237. // Miscellaneous
  238. AS_API asIScriptEngine *asContext_GetEngine(asIScriptContext *c) { return c->GetEngine(); }
  239. // Execution
  240. AS_API int asContext_Prepare(asIScriptContext *c, asIScriptFunction *func) { return c->Prepare(func); }
  241. AS_API int asContext_Unprepare(asIScriptContext *c) { return c->Unprepare(); }
  242. AS_API int asContext_Execute(asIScriptContext *c) { return c->Execute(); }
  243. AS_API int asContext_Abort(asIScriptContext *c) { return c->Abort(); }
  244. AS_API int asContext_Suspend(asIScriptContext *c) { return c->Suspend(); }
  245. AS_API asEContextState asContext_GetState(asIScriptContext *c) { return c->GetState(); }
  246. AS_API int asContext_PushState(asIScriptContext *c) { return c->PushState(); }
  247. AS_API int asContext_PopState(asIScriptContext *c) { return c->PopState(); }
  248. AS_API asBOOL asContext_IsNested(asIScriptContext *c, asUINT *nestCount) { return c->IsNested(nestCount) ? asTRUE : asFALSE; }
  249. // Object pointer for calling class methods
  250. AS_API int asContext_SetObject(asIScriptContext *c, void *obj) { return c->SetObject(obj); }
  251. // Arguments
  252. AS_API int asContext_SetArgByte(asIScriptContext *c, asUINT arg, asBYTE value) { return c->SetArgByte(arg, value); }
  253. AS_API int asContext_SetArgWord(asIScriptContext *c, asUINT arg, asWORD value) { return c->SetArgWord(arg, value); }
  254. AS_API int asContext_SetArgDWord(asIScriptContext *c, asUINT arg, asDWORD value) { return c->SetArgDWord(arg, value); }
  255. AS_API int asContext_SetArgQWord(asIScriptContext *c, asUINT arg, asQWORD value) { return c->SetArgQWord(arg, value); }
  256. AS_API int asContext_SetArgFloat(asIScriptContext *c, asUINT arg, float value) { return c->SetArgFloat(arg, value); }
  257. AS_API int asContext_SetArgDouble(asIScriptContext *c, asUINT arg, double value) { return c->SetArgDouble(arg, value); }
  258. AS_API int asContext_SetArgAddress(asIScriptContext *c, asUINT arg, void *addr) { return c->SetArgAddress(arg, addr); }
  259. AS_API int asContext_SetArgObject(asIScriptContext *c, asUINT arg, void *obj) { return c->SetArgObject(arg, obj); }
  260. AS_API int asContext_SetArgVarType(asIScriptContext *c, asUINT arg, void *ptr, int typeId) { return c->SetArgVarType(arg, ptr, typeId); }
  261. AS_API void * asContext_GetAddressOfArg(asIScriptContext *c, asUINT arg) { return c->GetAddressOfArg(arg); }
  262. // Return value
  263. AS_API asBYTE asContext_GetReturnByte(asIScriptContext *c) { return c->GetReturnByte(); }
  264. AS_API asWORD asContext_GetReturnWord(asIScriptContext *c) { return c->GetReturnWord(); }
  265. AS_API asDWORD asContext_GetReturnDWord(asIScriptContext *c) { return c->GetReturnDWord(); }
  266. AS_API asQWORD asContext_GetReturnQWord(asIScriptContext *c) { return c->GetReturnQWord(); }
  267. AS_API float asContext_GetReturnFloat(asIScriptContext *c) { return c->GetReturnFloat(); }
  268. AS_API double asContext_GetReturnDouble(asIScriptContext *c) { return c->GetReturnDouble(); }
  269. AS_API void * asContext_GetReturnAddress(asIScriptContext *c) { return c->GetReturnAddress(); }
  270. AS_API void * asContext_GetReturnObject(asIScriptContext *c) { return c->GetReturnObject(); }
  271. AS_API void * asContext_GetAddressOfReturnValue(asIScriptContext *c) { return c->GetAddressOfReturnValue(); }
  272. // Exception handling
  273. AS_API int asContext_SetException(asIScriptContext *c, const char *string) { return c->SetException(string); }
  274. AS_API int asContext_GetExceptionLineNumber(asIScriptContext *c, int *column, const char **sectionName) { return c->GetExceptionLineNumber(column, sectionName); }
  275. AS_API asIScriptFunction *asContext_GetExceptionFunction(asIScriptContext *c) { return c->GetExceptionFunction(); }
  276. AS_API const char * asContext_GetExceptionString(asIScriptContext *c) { return c->GetExceptionString(); }
  277. AS_API int asContext_SetExceptionCallback(asIScriptContext *c, asFUNCTION_t callback, void *obj, int callConv) { return c->SetExceptionCallback(asFUNCTION(callback), obj, callConv); }
  278. AS_API void asContext_ClearExceptionCallback(asIScriptContext *c) { c->ClearExceptionCallback(); }
  279. // Debugging
  280. AS_API int asContext_SetLineCallback(asIScriptContext *c, asFUNCTION_t callback, void *obj, int callConv) { return c->SetLineCallback(asFUNCTION(callback), obj, callConv); }
  281. AS_API void asContext_ClearLineCallback(asIScriptContext *c) { c->ClearLineCallback(); }
  282. AS_API asUINT asContext_GetCallstackSize(asIScriptContext *c) { return c->GetCallstackSize(); }
  283. AS_API asIScriptFunction *asContext_GetFunction(asIScriptContext *c, asUINT stackLevel) { return c->GetFunction(stackLevel); }
  284. AS_API int asContext_GetLineNumber(asIScriptContext *c, asUINT stackLevel, int *column, const char **sectionName) { return c->GetLineNumber(stackLevel, column, sectionName); }
  285. AS_API int asContext_GetVarCount(asIScriptContext *c, asUINT stackLevel) { return c->GetVarCount(stackLevel); }
  286. AS_API const char * asContext_GetVarName(asIScriptContext *c, asUINT varIndex, asUINT stackLevel) { return c->GetVarName(varIndex, stackLevel); }
  287. AS_API const char * asContext_GetVarDeclaration(asIScriptContext *c, asUINT varIndex, asUINT stackLevel, asBOOL includeNamespace) { return c->GetVarDeclaration(varIndex, stackLevel, includeNamespace ? true : false); }
  288. AS_API int asContext_GetVarTypeId(asIScriptContext *c, asUINT varIndex, asUINT stackLevel) { return c->GetVarTypeId(varIndex, stackLevel); }
  289. AS_API void * asContext_GetAddressOfVar(asIScriptContext *c, asUINT varIndex, asUINT stackLevel) { return c->GetAddressOfVar(varIndex, stackLevel); }
  290. AS_API asBOOL asContext_IsVarInScope(asIScriptContext *c, asUINT varIndex, asUINT stackLevel) { return c->IsVarInScope(varIndex, stackLevel) ? asTRUE : asFALSE; }
  291. AS_API int asContext_GetThisTypeId(asIScriptContext *c, asUINT stackLevel) { return c->GetThisTypeId(stackLevel); }
  292. AS_API void * asContext_GetThisPointer(asIScriptContext *c, asUINT stackLevel) { return c->GetThisPointer(stackLevel); }
  293. AS_API asIScriptFunction *asContext_GetSystemFunction(asIScriptContext *c) { return c->GetSystemFunction(); }
  294. // User data
  295. AS_API void * asContext_SetUserData(asIScriptContext *c, void *data) { return c->SetUserData(data); }
  296. AS_API void * asContext_GetUserData(asIScriptContext *c) { return c->GetUserData(); }
  297. ///////////////////////////////////////////
  298. // asIScriptGeneric
  299. // Miscellaneous
  300. AS_API asIScriptEngine *asGeneric_GetEngine(asIScriptGeneric *g) { return g->GetEngine(); }
  301. AS_API asIScriptFunction *asGeneric_GetFunction(asIScriptGeneric *g) { return g->GetFunction(); }
  302. AS_API void *asGeneric_GetAuxiliary(asIScriptGeneric *g) { return g->GetAuxiliary(); }
  303. // Object
  304. AS_API void * asGeneric_GetObject(asIScriptGeneric *g) { return g->GetObject(); }
  305. AS_API int asGeneric_GetObjectTypeId(asIScriptGeneric *g) { return g->GetObjectTypeId(); }
  306. // Arguments
  307. AS_API int asGeneric_GetArgCount(asIScriptGeneric *g) { return g->GetArgCount(); }
  308. AS_API int asGeneric_GetArgTypeId(asIScriptGeneric *g, asUINT arg, asDWORD *flags) { return g->GetArgTypeId(arg, flags); }
  309. AS_API asBYTE asGeneric_GetArgByte(asIScriptGeneric *g, asUINT arg) { return g->GetArgByte(arg); }
  310. AS_API asWORD asGeneric_GetArgWord(asIScriptGeneric *g, asUINT arg) { return g->GetArgWord(arg); }
  311. AS_API asDWORD asGeneric_GetArgDWord(asIScriptGeneric *g, asUINT arg) { return g->GetArgDWord(arg); }
  312. AS_API asQWORD asGeneric_GetArgQWord(asIScriptGeneric *g, asUINT arg) { return g->GetArgQWord(arg); }
  313. AS_API float asGeneric_GetArgFloat(asIScriptGeneric *g, asUINT arg) { return g->GetArgFloat(arg); }
  314. AS_API double asGeneric_GetArgDouble(asIScriptGeneric *g, asUINT arg) { return g->GetArgDouble(arg); }
  315. AS_API void * asGeneric_GetArgAddress(asIScriptGeneric *g, asUINT arg) { return g->GetArgAddress(arg); }
  316. AS_API void * asGeneric_GetArgObject(asIScriptGeneric *g, asUINT arg) { return g->GetArgObject(arg); }
  317. AS_API void * asGeneric_GetAddressOfArg(asIScriptGeneric *g, asUINT arg) { return g->GetAddressOfArg(arg); }
  318. // Return value
  319. AS_API int asGeneric_GetReturnTypeId(asIScriptGeneric *g, asDWORD *flags) { return g->GetReturnTypeId(flags); }
  320. AS_API int asGeneric_SetReturnByte(asIScriptGeneric *g, asBYTE val) { return g->SetReturnByte(val); }
  321. AS_API int asGeneric_SetReturnWord(asIScriptGeneric *g, asWORD val) { return g->SetReturnWord(val); }
  322. AS_API int asGeneric_SetReturnDWord(asIScriptGeneric *g, asDWORD val) { return g->SetReturnDWord(val); }
  323. AS_API int asGeneric_SetReturnQWord(asIScriptGeneric *g, asQWORD val) { return g->SetReturnQWord(val); }
  324. AS_API int asGeneric_SetReturnFloat(asIScriptGeneric *g, float val) { return g->SetReturnFloat(val); }
  325. AS_API int asGeneric_SetReturnDouble(asIScriptGeneric *g, double val) { return g->SetReturnDouble(val); }
  326. AS_API int asGeneric_SetReturnAddress(asIScriptGeneric *g, void *addr) { return g->SetReturnAddress(addr); }
  327. AS_API int asGeneric_SetReturnObject(asIScriptGeneric *g, void *obj) { return g->SetReturnObject(obj); }
  328. AS_API void * asGeneric_GetAddressOfReturnLocation(asIScriptGeneric *g) { return g->GetAddressOfReturnLocation(); }
  329. ///////////////////////////////////////////
  330. // asIScriptObject
  331. // Memory management
  332. AS_API int asObject_AddRef(asIScriptObject *s) { return s->AddRef(); }
  333. AS_API int asObject_Release(asIScriptObject *s) { return s->Release(); }
  334. AS_API asILockableSharedBool *asObject_GetWeakRefFlag(asIScriptObject *s) { return s->GetWeakRefFlag(); }
  335. // Type info
  336. AS_API int asObject_GetTypeId(asIScriptObject *s) { return s->GetTypeId(); }
  337. AS_API asITypeInfo * asObject_GetObjectType(asIScriptObject *s) { return s->GetObjectType(); }
  338. // Class properties
  339. AS_API asUINT asObject_GetPropertyCount(asIScriptObject *s) { return s->GetPropertyCount(); }
  340. AS_API int asObject_GetPropertyTypeId(asIScriptObject *s, asUINT prop) { return s->GetPropertyTypeId(prop); }
  341. AS_API const char * asObject_GetPropertyName(asIScriptObject *s, asUINT prop) { return s->GetPropertyName(prop); }
  342. AS_API void * asObject_GetAddressOfProperty(asIScriptObject *s, asUINT prop){ return s->GetAddressOfProperty(prop); }
  343. // Miscellaneous
  344. AS_API asIScriptEngine *asObject_GetEngine(asIScriptObject *s) { return s->GetEngine(); }
  345. AS_API int asObject_CopyFrom(asIScriptObject *s, asIScriptObject *other) { return s->CopyFrom(other); }
  346. // User data
  347. AS_API void *asObject_SetUserData(asIScriptObject *s, void *data, asPWORD type) { return s->SetUserData(data, type); }
  348. AS_API void *asObject_GetUserData(asIScriptObject *s, asPWORD type) { return s->GetUserData(type); }
  349. ///////////////////////////////////////////
  350. // asITypeInfo
  351. // Miscellaneous
  352. AS_API asIScriptEngine *asTypeInfo_GetEngine(const asITypeInfo *o) { return o->GetEngine(); }
  353. AS_API const char * asTypeInfo_GetConfigGroup(const asITypeInfo *o) { return o->GetConfigGroup(); }
  354. AS_API asDWORD asTypeInfo_GetAccessMask(const asITypeInfo *o) { return o->GetAccessMask(); }
  355. AS_API asIScriptModule *asTypeInfo_GetModule(asITypeInfo *o) { return o->GetModule(); }
  356. // Memory management
  357. AS_API int asTypeInfo_AddRef(const asITypeInfo *o) { return o->AddRef(); }
  358. AS_API int asTypeInfo_Release(const asITypeInfo *o) { return o->Release(); }
  359. // Type info
  360. AS_API const char * asTypeInfo_GetName(const asITypeInfo *o) { return o->GetName(); }
  361. AS_API const char * asTypeInfo_GetNamespace(const asITypeInfo *o) { return o->GetNamespace(); }
  362. AS_API asITypeInfo * asTypeInfo_GetBaseType(const asITypeInfo *o) { return o->GetBaseType(); }
  363. AS_API asBOOL asTypeInfo_DerivesFrom(const asITypeInfo *o, const asITypeInfo *objType) { return o->DerivesFrom(objType) ? asTRUE : asFALSE; }
  364. AS_API asDWORD asTypeInfo_GetFlags(const asITypeInfo *o) { return o->GetFlags(); }
  365. AS_API asUINT asTypeInfo_GetSize(const asITypeInfo *o) { return o->GetSize(); }
  366. AS_API int asTypeInfo_GetTypeId(const asITypeInfo *o) { return o->GetTypeId(); }
  367. AS_API int asTypeInfo_GetSubTypeId(const asITypeInfo *o, asUINT subTypeIndex) { return o->GetSubTypeId(subTypeIndex); }
  368. AS_API asITypeInfo * asTypeInfo_GetSubType(const asITypeInfo *o, asUINT subTypeIndex) { return o->GetSubType(subTypeIndex); }
  369. AS_API asUINT asTypeInfo_GetSubTypeCount(const asITypeInfo *o) { return o->GetSubTypeCount(); }
  370. // Interfaces
  371. AS_API asUINT asTypeInfo_GetInterfaceCount(const asITypeInfo *o) { return o->GetInterfaceCount(); }
  372. AS_API asITypeInfo * asTypeInfo_GetInterface(const asITypeInfo *o, asUINT index) { return o->GetInterface(index); }
  373. AS_API asBOOL asTypeInfo_Implements(const asITypeInfo *o, const asITypeInfo *objType) { return o->Implements(objType) ? asTRUE : asFALSE; }
  374. // Factories
  375. AS_API asUINT asTypeInfo_GetFactoryCount(const asITypeInfo *o) { return o->GetFactoryCount(); }
  376. AS_API asIScriptFunction *asTypeInfo_GetFactoryByIndex(const asITypeInfo *o, asUINT index) { return o->GetFactoryByIndex(index); }
  377. AS_API asIScriptFunction *asTypeInfo_GetFactoryByDecl(const asITypeInfo *o, const char *decl) { return o->GetFactoryByDecl(decl); }
  378. // Methods
  379. AS_API asUINT asTypeInfo_GetMethodCount(const asITypeInfo *o) { return o->GetMethodCount(); }
  380. AS_API asIScriptFunction *asTypeInfo_GetMethodByIndex(const asITypeInfo *o, asUINT index, asBOOL getVirtual) { return o->GetMethodByIndex(index, getVirtual ? true : false); }
  381. AS_API asIScriptFunction *asTypeInfo_GetMethodByName(const asITypeInfo *o, const char *name, asBOOL getVirtual) { return o->GetMethodByName(name, getVirtual ? true : false); }
  382. AS_API asIScriptFunction *asTypeInfo_GetMethodByDecl(const asITypeInfo *o, const char *decl, asBOOL getVirtual) { return o->GetMethodByDecl(decl, getVirtual ? true : false); }
  383. // Properties
  384. AS_API asUINT asTypeInfo_GetPropertyCount(const asITypeInfo *o) { return o->GetPropertyCount(); }
  385. AS_API int asTypeInfo_GetProperty(const asITypeInfo *o, asUINT index, const char **name, int *typeId, asBOOL *isPrivate, asBOOL *isProtected, int *offset, asBOOL *isReference, asDWORD *accessMask) { bool _isPrivate, _isProtected, _isReference; int r = o->GetProperty(index, name, typeId, &_isPrivate, &_isProtected, offset, &_isReference, accessMask); if (isPrivate) *isPrivate = _isPrivate ? asTRUE : asFALSE; if (isProtected) *isProtected = _isProtected ? asTRUE : asFALSE; if (isReference) *isReference = _isReference ? asTRUE : asFALSE; return r; }
  386. AS_API const char *asTypeInfo_GetPropertyDeclaration(const asITypeInfo *o, asUINT index) { return o->GetPropertyDeclaration(index); }
  387. // Behaviours
  388. AS_API asUINT asTypeInfo_GetBehaviourCount(const asITypeInfo *o) { return o->GetBehaviourCount(); }
  389. AS_API asIScriptFunction *asTypeInfo_GetBehaviourByIndex(const asITypeInfo *o, asUINT index, asEBehaviours *outBehaviour) { return o->GetBehaviourByIndex(index, outBehaviour); }
  390. // Child types
  391. AS_API asUINT asTypeInfo_GetChildFuncdefCount(asITypeInfo *o) { return o->GetChildFuncdefCount(); }
  392. AS_API asITypeInfo *asTypeInfo_GetChildFuncdef(asITypeInfo *o, asUINT index) { return o->GetChildFuncdef(index); }
  393. AS_API asITypeInfo *asTypeInfo_GetParentType(asITypeInfo *o) { return o->GetParentType(); }
  394. // Enums
  395. AS_API asUINT asTypeInfo_GetEnumValueCount(asITypeInfo *o) { return o->GetEnumValueCount(); }
  396. AS_API const char *asTypeInfo_GetEnumValueByIndex(asITypeInfo *o, asUINT index, int *outValue) { return o->GetEnumValueByIndex(index, outValue); }
  397. // Typedef
  398. AS_API int asTypeInfo_GetTypedefTypeId(asITypeInfo *o) { return o->GetTypedefTypeId(); }
  399. // Funcdef
  400. AS_API asIScriptFunction *asTypeInfo_GetFuncdefSignature(asITypeInfo *o) { return o->GetFuncdefSignature(); }
  401. // User data
  402. AS_API void *asTypeInfo_SetUserData(asITypeInfo *o, void *data, asPWORD type) { return o->SetUserData(data, type); }
  403. AS_API void *asTypeInfo_GetUserData(asITypeInfo *o, asPWORD type) { return o->GetUserData(type); }
  404. ///////////////////////////////////////////
  405. // asIScriptFunction
  406. AS_API asIScriptEngine *asFunction_GetEngine(const asIScriptFunction *f) { return f->GetEngine(); }
  407. // Memory management
  408. AS_API int asFunction_AddRef(const asIScriptFunction *f) { return f->AddRef(); }
  409. AS_API int asFunction_Release(const asIScriptFunction *f) { return f->Release(); }
  410. // Miscellaneous
  411. AS_API int asFunction_GetId(const asIScriptFunction *f) { return f->GetId(); }
  412. AS_API asEFuncType asFunction_GetFuncType(const asIScriptFunction *f) { return f->GetFuncType(); }
  413. AS_API const char *asFunction_GetModuleName(const asIScriptFunction *f) { return f->GetModuleName(); }
  414. AS_API asIScriptModule *asFunction_GetModule(const asIScriptFunction *f) { return f->GetModule(); }
  415. AS_API const char *asFunction_GetScriptSectionName(const asIScriptFunction *f) { return f->GetScriptSectionName(); }
  416. AS_API const char *asFunction_GetConfigGroup(const asIScriptFunction *f) { return f->GetConfigGroup(); }
  417. AS_API asDWORD asFunction_GetAccessMask(const asIScriptFunction *f) { return f->GetAccessMask(); }
  418. AS_API void *asFunction_GetAuxiliary(const asIScriptFunction *f) { return f->GetAuxiliary(); }
  419. // Function signature
  420. AS_API asITypeInfo *asFunction_GetObjectType(const asIScriptFunction *f) { return f->GetObjectType(); }
  421. AS_API const char *asFunction_GetObjectName(const asIScriptFunction *f) { return f->GetObjectName(); }
  422. AS_API const char *asFunction_GetName(const asIScriptFunction *f) { return f->GetName(); }
  423. AS_API const char *asFunction_GetNamespace(const asIScriptFunction *f) { return f->GetNamespace(); }
  424. AS_API const char *asFunction_GetDeclaration(const asIScriptFunction *f, asBOOL includeObjectName, asBOOL includeNamespace) { return f->GetDeclaration(includeObjectName ? true : false, includeNamespace ? true : false); }
  425. AS_API asBOOL asFunction_IsReadOnly(const asIScriptFunction *f) { return f->IsReadOnly() ? asTRUE : asFALSE; }
  426. AS_API asBOOL asFunction_IsPrivate(const asIScriptFunction *f) { return f->IsPrivate() ? asTRUE : asFALSE; }
  427. AS_API asBOOL asFunction_IsProtected(const asIScriptFunction *f) { return f->IsProtected() ? asTRUE : asFALSE; }
  428. AS_API asBOOL asFunction_IsFinal(const asIScriptFunction *f) { return f->IsFinal() ? asTRUE : asFALSE; }
  429. AS_API asBOOL asFunction_IsOverride(const asIScriptFunction *f) { return f->IsOverride() ? asTRUE : asFALSE; }
  430. AS_API asBOOL asFunction_IsShared(const asIScriptFunction *f) { return f->IsShared() ? asTRUE : asFALSE; }
  431. AS_API asUINT asFunction_GetParamCount(const asIScriptFunction *f) { return f->GetParamCount(); }
  432. AS_API int asFunction_GetParam(const asIScriptFunction *f, asUINT index, int *typeId, asDWORD *flags, const char **name, const char **defaultArg) { return f->GetParam(index, typeId, flags, name, defaultArg); }
  433. AS_API int asFunction_GetReturnTypeId(const asIScriptFunction *f) { return f->GetReturnTypeId(); }
  434. // Type id for function pointers
  435. AS_API int asFunction_GetTypeId(const asIScriptFunction *f) { return f->GetTypeId(); }
  436. AS_API asBOOL asFunction_IsCompatibleWithTypeId(const asIScriptFunction *f, int typeId) { return f->IsCompatibleWithTypeId(typeId) ? asTRUE : asFALSE; }
  437. // Delegates
  438. AS_API void *asFunction_GetDelegateObject(const asIScriptFunction *f) { return f->GetDelegateObject(); }
  439. AS_API asITypeInfo *asFunction_GetDelegateObjectType(const asIScriptFunction *f) { return f->GetDelegateObjectType(); }
  440. AS_API asIScriptFunction *asFunction_GetDelegateFunction(const asIScriptFunction *f) { return f->GetDelegateFunction(); }
  441. // Debug information
  442. AS_API asUINT asFunction_GetVarCount(const asIScriptFunction *f) { return f->GetVarCount(); }
  443. AS_API int asFunction_GetVar(const asIScriptFunction *f, asUINT index, const char **name, int *typeId) { return f->GetVar(index, name, typeId); }
  444. AS_API const char * asFunction_GetVarDecl(const asIScriptFunction *f, asUINT index, asBOOL includeNamespace) { return f->GetVarDecl(index, includeNamespace ? true : false); }
  445. AS_API int asFunction_FindNextLineWithCode(const asIScriptFunction *f, int line) { return f->FindNextLineWithCode(line); }
  446. // For JIT compilation
  447. AS_API asDWORD *asFunction_GetByteCode(asIScriptFunction *f, asUINT *length) { return f->GetByteCode(length); }
  448. // User data
  449. AS_API void *asFunction_SetUserData(asIScriptFunction *f, void *userData) { return f->SetUserData(userData); }
  450. AS_API void *asFunction_GetUserData(const asIScriptFunction *f) { return f->GetUserData(); }
  451. }
  452. END_AS_NAMESPACE