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

angelscript_c.h 44KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  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. // angelscript_c.h
  25. //
  26. // The script engine interface for the C language.
  27. //
  28. // The idea is that the library should be compiled with a C++ compiler with the AS_C_INTERFACE
  29. // preprocessor word defined. The C application will then be able to link with the library and
  30. // use this header file to interact with it.
  31. //
  32. // Note: This header file is not yet complete. I'd appreciate any help with completing it.
  33. //
  34. #ifndef ANGELSCRIPT_C_H
  35. #define ANGELSCRIPT_C_H
  36. #define ANGELSCRIPT_VERSION 23102
  37. #ifdef AS_USE_NAMESPACE
  38. #define BEGIN_AS_NAMESPACE namespace AngelScript {
  39. #define END_AS_NAMESPACE }
  40. #else
  41. #define BEGIN_AS_NAMESPACE
  42. #define END_AS_NAMESPACE
  43. #endif
  44. BEGIN_AS_NAMESPACE
  45. // Data types
  46. typedef struct asIScriptEngine asIScriptEngine;
  47. typedef struct asIScriptModule asIScriptModule;
  48. typedef struct asIScriptContext asIScriptContext;
  49. typedef struct asIScriptGeneric asIScriptGeneric;
  50. typedef struct asIScriptObject asIScriptObject;
  51. typedef struct asITypeInfo asITypeInfo;
  52. typedef struct asIScriptFunction asIScriptFunction;
  53. typedef struct asIBinaryStream asIBinaryStream;
  54. typedef struct asIJITCompiler asIJITCompiler;
  55. typedef struct asIThreadManager asIThreadManager;
  56. typedef struct asILockableSharedBool asILockableSharedBool;
  57. // Enumerations and constants
  58. // Return codes
  59. typedef enum
  60. {
  61. asSUCCESS = 0,
  62. asERROR = -1,
  63. asCONTEXT_ACTIVE = -2,
  64. asCONTEXT_NOT_FINISHED = -3,
  65. asCONTEXT_NOT_PREPARED = -4,
  66. asINVALID_ARG = -5,
  67. asNO_FUNCTION = -6,
  68. asNOT_SUPPORTED = -7,
  69. asINVALID_NAME = -8,
  70. asNAME_TAKEN = -9,
  71. asINVALID_DECLARATION = -10,
  72. asINVALID_OBJECT = -11,
  73. asINVALID_TYPE = -12,
  74. asALREADY_REGISTERED = -13,
  75. asMULTIPLE_FUNCTIONS = -14,
  76. asNO_MODULE = -15,
  77. asNO_GLOBAL_VAR = -16,
  78. asINVALID_CONFIGURATION = -17,
  79. asINVALID_INTERFACE = -18,
  80. asCANT_BIND_ALL_FUNCTIONS = -19,
  81. asLOWER_ARRAY_DIMENSION_NOT_REGISTERED = -20,
  82. asWRONG_CONFIG_GROUP = -21,
  83. asCONFIG_GROUP_IS_IN_USE = -22,
  84. asILLEGAL_BEHAVIOUR_FOR_TYPE = -23,
  85. asWRONG_CALLING_CONV = -24,
  86. asBUILD_IN_PROGRESS = -25,
  87. asINIT_GLOBAL_VARS_FAILED = -26,
  88. asOUT_OF_MEMORY = -27,
  89. asMODULE_IS_IN_USE = -28
  90. } asERetCodes;
  91. // Engine properties
  92. typedef enum
  93. {
  94. asEP_ALLOW_UNSAFE_REFERENCES = 1,
  95. asEP_OPTIMIZE_BYTECODE = 2,
  96. asEP_COPY_SCRIPT_SECTIONS = 3,
  97. asEP_MAX_STACK_SIZE = 4,
  98. asEP_USE_CHARACTER_LITERALS = 5,
  99. asEP_ALLOW_MULTILINE_STRINGS = 6,
  100. asEP_ALLOW_IMPLICIT_HANDLE_TYPES = 7,
  101. asEP_BUILD_WITHOUT_LINE_CUES = 8,
  102. asEP_INIT_GLOBAL_VARS_AFTER_BUILD = 9,
  103. asEP_REQUIRE_ENUM_SCOPE = 10,
  104. asEP_SCRIPT_SCANNER = 11,
  105. asEP_INCLUDE_JIT_INSTRUCTIONS = 12,
  106. asEP_STRING_ENCODING = 13,
  107. asEP_PROPERTY_ACCESSOR_MODE = 14,
  108. asEP_EXPAND_DEF_ARRAY_TO_TMPL = 15,
  109. asEP_AUTO_GARBAGE_COLLECT = 16,
  110. asEP_DISALLOW_GLOBAL_VARS = 17,
  111. asEP_ALWAYS_IMPL_DEFAULT_CONSTRUCT = 18,
  112. asEP_COMPILER_WARNINGS = 19,
  113. asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE = 20,
  114. asEP_ALTER_SYNTAX_NAMED_ARGS = 21,
  115. asEP_DISABLE_INTEGER_DIVISION = 22,
  116. asEP_DISALLOW_EMPTY_LIST_ELEMENTS = 23,
  117. asEP_PRIVATE_PROP_AS_PROTECTED = 24,
  118. asEP_ALLOW_UNICODE_IDENTIFIERS = 25,
  119. asEP_HEREDOC_TRIM_MODE = 26,
  120. asEP_LAST_PROPERTY
  121. } asEEngineProp;
  122. // Calling conventions
  123. typedef enum
  124. {
  125. asCALL_CDECL = 0,
  126. asCALL_STDCALL = 1,
  127. asCALL_THISCALL_ASGLOBAL = 2,
  128. asCALL_THISCALL = 3,
  129. asCALL_CDECL_OBJLAST = 4,
  130. asCALL_CDECL_OBJFIRST = 5,
  131. asCALL_GENERIC = 6,
  132. asCALL_THISCALL_OBJLAST = 7,
  133. asCALL_THISCALL_OBJFIRST = 8
  134. } asECallConvTypes;
  135. // Object type flags
  136. typedef enum
  137. {
  138. asOBJ_REF = (1<<0),
  139. asOBJ_VALUE = (1<<1),
  140. asOBJ_GC = (1<<2),
  141. asOBJ_POD = (1<<3),
  142. asOBJ_NOHANDLE = (1<<4),
  143. asOBJ_SCOPED = (1<<5),
  144. asOBJ_TEMPLATE = (1<<6),
  145. asOBJ_ASHANDLE = (1<<7),
  146. asOBJ_APP_CLASS = (1<<8),
  147. asOBJ_APP_CLASS_CONSTRUCTOR = (1<<9),
  148. asOBJ_APP_CLASS_DESTRUCTOR = (1<<10),
  149. asOBJ_APP_CLASS_ASSIGNMENT = (1<<11),
  150. asOBJ_APP_CLASS_COPY_CONSTRUCTOR = (1<<12),
  151. asOBJ_APP_CLASS_C = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR),
  152. asOBJ_APP_CLASS_CD = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR),
  153. asOBJ_APP_CLASS_CA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT),
  154. asOBJ_APP_CLASS_CK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  155. asOBJ_APP_CLASS_CDA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT),
  156. asOBJ_APP_CLASS_CDK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  157. asOBJ_APP_CLASS_CAK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  158. asOBJ_APP_CLASS_CDAK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  159. asOBJ_APP_CLASS_D = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR),
  160. asOBJ_APP_CLASS_DA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT),
  161. asOBJ_APP_CLASS_DK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  162. asOBJ_APP_CLASS_DAK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  163. asOBJ_APP_CLASS_A = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_ASSIGNMENT),
  164. asOBJ_APP_CLASS_AK = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_ASSIGNMENT + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  165. asOBJ_APP_CLASS_K = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_COPY_CONSTRUCTOR),
  166. asOBJ_APP_PRIMITIVE = (1<<13),
  167. asOBJ_APP_FLOAT = (1<<14),
  168. asOBJ_APP_ARRAY = (1<<15),
  169. asOBJ_APP_CLASS_ALLINTS = (1<<16),
  170. asOBJ_APP_CLASS_ALLFLOATS = (1<<17),
  171. asOBJ_NOCOUNT = (1<<18),
  172. asOBJ_APP_CLASS_ALIGN8 = (1<<19),
  173. asOBJ_IMPLICIT_HANDLE = (1<<20),
  174. asOBJ_MASK_VALID_FLAGS = 0x1FFFFF,
  175. // Internal flags
  176. asOBJ_SCRIPT_OBJECT = (1<<21),
  177. asOBJ_SHARED = (1<<22),
  178. asOBJ_NOINHERIT = (1<<23),
  179. asOBJ_FUNCDEF = (1<<24),
  180. asOBJ_LIST_PATTERN = (1<<25),
  181. asOBJ_ENUM = (1<<26),
  182. asOBJ_TEMPLATE_SUBTYPE = (1<<27),
  183. asOBJ_TYPEDEF = (1<<28),
  184. asOBJ_ABSTRACT = (1<<29),
  185. asOBJ_APP_ALIGN16 = (1<<30)
  186. } asEObjTypeFlags;
  187. // Behaviours
  188. typedef enum
  189. {
  190. // Value object memory management
  191. asBEHAVE_CONSTRUCT,
  192. asBEHAVE_LIST_CONSTRUCT,
  193. asBEHAVE_DESTRUCT,
  194. // Reference object memory management
  195. asBEHAVE_FACTORY,
  196. asBEHAVE_LIST_FACTORY,
  197. asBEHAVE_ADDREF,
  198. asBEHAVE_RELEASE,
  199. asBEHAVE_GET_WEAKREF_FLAG,
  200. // Object operators
  201. asBEHAVE_TEMPLATE_CALLBACK,
  202. // Garbage collection behaviours
  203. asBEHAVE_FIRST_GC,
  204. asBEHAVE_GETREFCOUNT = asBEHAVE_FIRST_GC,
  205. asBEHAVE_SETGCFLAG,
  206. asBEHAVE_GETGCFLAG,
  207. asBEHAVE_ENUMREFS,
  208. asBEHAVE_RELEASEREFS,
  209. asBEHAVE_LAST_GC = asBEHAVE_RELEASEREFS,
  210. asBEHAVE_MAX
  211. } asEBehaviours;
  212. // Context states
  213. typedef enum
  214. {
  215. asEXECUTION_FINISHED = 0,
  216. asEXECUTION_SUSPENDED = 1,
  217. asEXECUTION_ABORTED = 2,
  218. asEXECUTION_EXCEPTION = 3,
  219. asEXECUTION_PREPARED = 4,
  220. asEXECUTION_UNINITIALIZED = 5,
  221. asEXECUTION_ACTIVE = 6,
  222. asEXECUTION_ERROR = 7
  223. } asEContextState;
  224. // Message types
  225. typedef enum
  226. {
  227. asMSGTYPE_ERROR = 0,
  228. asMSGTYPE_WARNING = 1,
  229. asMSGTYPE_INFORMATION = 2
  230. } asEMsgType;
  231. // Garbage collector flags
  232. typedef enum
  233. {
  234. asGC_FULL_CYCLE = 1,
  235. asGC_ONE_STEP = 2,
  236. asGC_DESTROY_GARBAGE = 4,
  237. asGC_DETECT_GARBAGE = 8
  238. } asEGCFlags;
  239. // Token classes
  240. typedef enum
  241. {
  242. asTC_UNKNOWN = 0,
  243. asTC_KEYWORD = 1,
  244. asTC_VALUE = 2,
  245. asTC_IDENTIFIER = 3,
  246. asTC_COMMENT = 4,
  247. asTC_WHITESPACE = 5
  248. } asETokenClass;
  249. // Type id flags
  250. typedef enum
  251. {
  252. asTYPEID_VOID = 0,
  253. asTYPEID_BOOL = 1,
  254. asTYPEID_INT8 = 2,
  255. asTYPEID_INT16 = 3,
  256. asTYPEID_INT32 = 4,
  257. asTYPEID_INT64 = 5,
  258. asTYPEID_UINT8 = 6,
  259. asTYPEID_UINT16 = 7,
  260. asTYPEID_UINT32 = 8,
  261. asTYPEID_UINT64 = 9,
  262. asTYPEID_FLOAT = 10,
  263. asTYPEID_DOUBLE = 11,
  264. asTYPEID_OBJHANDLE = 0x40000000,
  265. asTYPEID_HANDLETOCONST = 0x20000000,
  266. asTYPEID_MASK_OBJECT = 0x1C000000,
  267. asTYPEID_APPOBJECT = 0x04000000,
  268. asTYPEID_SCRIPTOBJECT = 0x08000000,
  269. asTYPEID_TEMPLATE = 0x10000000,
  270. asTYPEID_MASK_SEQNBR = 0x03FFFFFF
  271. } asETypeIdFlags;
  272. // Type modifiers
  273. typedef enum
  274. {
  275. asTM_NONE = 0,
  276. asTM_INREF = 1,
  277. asTM_OUTREF = 2,
  278. asTM_INOUTREF = 3,
  279. asTM_CONST = 4
  280. } asETypeModifiers;
  281. // GetModule flags
  282. typedef enum
  283. {
  284. asGM_ONLY_IF_EXISTS = 0,
  285. asGM_CREATE_IF_NOT_EXISTS = 1,
  286. asGM_ALWAYS_CREATE = 2
  287. } asEGMFlags;
  288. // Compile flags
  289. typedef enum
  290. {
  291. asCOMP_ADD_TO_MODULE = 1
  292. } asECompileFlags;
  293. // Function types
  294. typedef enum
  295. {
  296. asFUNC_DUMMY =-1,
  297. asFUNC_SYSTEM = 0,
  298. asFUNC_SCRIPT = 1,
  299. asFUNC_INTERFACE = 2,
  300. asFUNC_VIRTUAL = 3,
  301. asFUNC_FUNCDEF = 4,
  302. asFUNC_IMPORTED = 5,
  303. asFUNC_DELEGATE = 6
  304. } asEFuncType;
  305. //
  306. // asBYTE = 8 bits
  307. // asWORD = 16 bits
  308. // asDWORD = 32 bits
  309. // asQWORD = 64 bits
  310. // asPWORD = size of pointer
  311. //
  312. typedef unsigned char asBYTE;
  313. typedef unsigned short asWORD;
  314. typedef unsigned int asUINT;
  315. typedef size_t asPWORD;
  316. #ifdef __LP64__
  317. typedef unsigned int asDWORD;
  318. typedef unsigned long asQWORD;
  319. typedef long asINT64;
  320. #else
  321. typedef unsigned long asDWORD;
  322. #if defined(__GNUC__) || defined(__MWERKS__)
  323. typedef unsigned long long asQWORD;
  324. typedef long long asINT64;
  325. #else
  326. typedef unsigned __int64 asQWORD;
  327. typedef __int64 asINT64;
  328. #endif
  329. #endif
  330. typedef enum { asTRUE = 1, asFALSE = 0 } asBOOL;
  331. typedef void (*asBINARYREADFUNC_t)(void *ptr, asUINT size, void *param);
  332. typedef void (*asBINARYWRITEFUNC_t)(const void *ptr, asUINT size, void *param);
  333. typedef void (*asFUNCTION_t)();
  334. typedef void (*asGENFUNC_t)(asIScriptGeneric *);
  335. typedef void *(*asALLOCFUNC_t)(size_t);
  336. typedef void (*asFREEFUNC_t)(void *);
  337. typedef void (*asCLEANENGINEFUNC_t)(asIScriptEngine *);
  338. typedef void (*asCLEANMODULEFUNC_t)(asIScriptModule *);
  339. typedef void (*asCLEANCONTEXTFUNC_t)(asIScriptContext *);
  340. typedef void (*asCLEANFUNCTIONFUNC_t)(asIScriptFunction *);
  341. typedef void (*asCLEANTYPEINFOFUNC_t)(asITypeInfo *);
  342. typedef void (*asCLEANSCRIPTOBJECTFUNC_t)(asIScriptObject *);
  343. typedef asIScriptContext *(*asREQUESTCONTEXTFUNC_t)(asIScriptEngine *, void *);
  344. typedef void (*asRETURNCONTEXTFUNC_t)(asIScriptEngine *, asIScriptContext *, void *);
  345. typedef struct
  346. {
  347. const char *section;
  348. int row;
  349. int col;
  350. asEMsgType type;
  351. const char *message;
  352. } asSMessageInfo;
  353. // API functions
  354. // ANGELSCRIPT_EXPORT is defined when compiling the dll or lib
  355. // ANGELSCRIPT_DLL_LIBRARY_IMPORT is defined when dynamically linking to the
  356. // dll through the link lib automatically generated by MSVC++
  357. // ANGELSCRIPT_DLL_MANUAL_IMPORT is defined when manually loading the dll
  358. // Don't define anything when linking statically to the lib
  359. #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
  360. #if defined(ANGELSCRIPT_EXPORT)
  361. #define AS_API __declspec(dllexport)
  362. #elif defined(ANGELSCRIPT_DLL_LIBRARY_IMPORT)
  363. #define AS_API __declspec(dllimport)
  364. #else // statically linked library
  365. #define AS_API
  366. #endif
  367. #elif defined(__GNUC__)
  368. #if defined(ANGELSCRIPT_EXPORT)
  369. #define AS_API __attribute__((visibility ("default")))
  370. #else
  371. #define AS_API
  372. #endif
  373. #else
  374. #define AS_API
  375. #endif
  376. #ifndef ANGELSCRIPT_DLL_MANUAL_IMPORT
  377. #ifdef __cplusplus
  378. extern "C"
  379. {
  380. #endif
  381. // Engine
  382. AS_API asIScriptEngine *asCreateScriptEngine(asDWORD version);
  383. AS_API const char *asGetLibraryVersion();
  384. AS_API const char *asGetLibraryOptions();
  385. // Context
  386. AS_API asIScriptContext *asGetActiveContext();
  387. // Thread support
  388. AS_API int asPrepareMultithread(asIThreadManager *externalMgr);
  389. AS_API void asUnprepareMultithread();
  390. AS_API asIThreadManager *asGetThreadManager();
  391. AS_API void asAcquireExclusiveLock();
  392. AS_API void asReleaseExclusiveLock();
  393. AS_API void asAcquireSharedLock();
  394. AS_API void asReleaseSharedLock();
  395. AS_API int asAtomicInc(int &value);
  396. AS_API int asAtomicDec(int &value);
  397. AS_API int asThreadCleanup();
  398. // Memory management
  399. AS_API int asSetGlobalMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc);
  400. AS_API int asResetGlobalMemoryFunctions();
  401. AS_API void *asAllocMem(size_t size);
  402. AS_API void asFreeMem(void *mem);
  403. // Auxiliary
  404. AS_API asILockableSharedBool *asCreateLockableSharedBool();
  405. ///////////////////////////////////////////
  406. // asIScriptEngine
  407. // Memory management
  408. AS_API int asEngine_AddRef(asIScriptEngine *e);
  409. AS_API int asEngine_Release(asIScriptEngine *e);
  410. AS_API int asEngine_ShutDownAndRelease(asIScriptEngine *e);
  411. // Engine properties
  412. AS_API int asEngine_SetEngineProperty(asIScriptEngine *e, asEEngineProp property, asPWORD value);
  413. AS_API asPWORD asEngine_GetEngineProperty(asIScriptEngine *e, asEEngineProp property);
  414. // Compiler messages
  415. AS_API int asEngine_SetMessageCallback(asIScriptEngine *e, asFUNCTION_t callback, void *obj, asDWORD callConv);
  416. AS_API int asEngine_ClearMessageCallback(asIScriptEngine *e);
  417. AS_API int asEngine_WriteMessage(asIScriptEngine *e, const char *section, int row, int col, asEMsgType type, const char *message);
  418. // JIT Compiler
  419. AS_API int asEngine_SetJITCompiler(asIScriptEngine *e, asIJITCompiler *compiler);
  420. AS_API asIJITCompiler * asEngine_GetJITCompiler(asIScriptEngine *e);
  421. // Global functions
  422. AS_API int asEngine_RegisterGlobalFunction(asIScriptEngine *e, const char *declaration, asFUNCTION_t funcPointer, asDWORD callConv, void *auxiliary);
  423. AS_API asUINT asEngine_GetGlobalFunctionCount(asIScriptEngine *e);
  424. AS_API asIScriptFunction* asEngine_GetGlobalFunctionByIndex(asIScriptEngine *e, asUINT index);
  425. AS_API asIScriptFunction* asEngine_GetGlobalFunctionByDecl(asIScriptEngine *e, const char *declaration);
  426. // Global properties
  427. AS_API int asEngine_RegisterGlobalProperty(asIScriptEngine *e, const char *declaration, void *pointer);
  428. AS_API asUINT asEngine_GetGlobalPropertyCount(asIScriptEngine *e);
  429. AS_API int asEngine_GetGlobalPropertyByIndex(asIScriptEngine *e, asUINT index, const char **name, const char **nameSpace, int *typeId, asBOOL *isConst, const char **configGroup, void **pointer, asDWORD *accessMask);
  430. AS_API int asEngine_GetGlobalPropertyIndexByName(asIScriptEngine *e, const char *name);
  431. AS_API int asEngine_GetGlobalPropertyIndexByDecl(asIScriptEngine *e, const char *decl);
  432. // Object types
  433. AS_API int asEngine_RegisterObjectType(asIScriptEngine *e, const char *name, int byteSize, asDWORD flags);
  434. AS_API int asEngine_RegisterObjectProperty(asIScriptEngine *e, const char *obj, const char *declaration, int byteOffset);
  435. AS_API int asEngine_RegisterObjectMethod(asIScriptEngine *e, const char *obj, const char *declaration, asFUNCTION_t funcPointer, asDWORD callConv, void *auxiliary);
  436. AS_API int asEngine_RegisterObjectBehaviour(asIScriptEngine *e, const char *datatype, asEBehaviours behaviour, const char *declaration, asFUNCTION_t funcPointer, asDWORD callConv, void *auxiliary);
  437. AS_API int asEngine_RegisterInterface(asIScriptEngine *e, const char *name);
  438. AS_API int asEngine_RegisterInterfaceMethod(asIScriptEngine *e, const char *intf, const char *declaration);
  439. AS_API asUINT asEngine_GetObjectTypeCount(asIScriptEngine *e);
  440. AS_API asITypeInfo * asEngine_GetObjectTypeByIndex(asIScriptEngine *e, asUINT index);
  441. // String factory
  442. AS_API int asEngine_RegisterStringFactory(asIScriptEngine *e, const char *datatype, asSTRINGCONSTGETFUNC_t stringConst, asSTRINGRELEASEFUNC_t release, asSTRINGGETFUNC_t get, void *param);
  443. AS_API int asEngine_GetStringFactoryReturnTypeId(asIScriptEngine *e, asDWORD *flags);
  444. // Default array type
  445. AS_API int asEngine_RegisterDefaultArrayType(asIScriptEngine *e, const char *type);
  446. AS_API int asEngine_GetDefaultArrayTypeId(asIScriptEngine *e);
  447. // Enums
  448. AS_API int asEngine_RegisterEnum(asIScriptEngine *e, const char *type);
  449. AS_API int asEngine_RegisterEnumValue(asIScriptEngine *e, const char *type, const char *name, int value);
  450. AS_API asUINT asEngine_GetEnumCount(asIScriptEngine *e);
  451. AS_API asITypeInfo * asEngine_GetEnumByIndex(asIScriptEngine *e, asUINT index);
  452. // Funcdefs
  453. AS_API int asEngine_RegisterFuncdef(asIScriptEngine *e, const char *decl);
  454. AS_API asUINT asEngine_GetFuncdefCount(asIScriptEngine *e);
  455. AS_API asITypeInfo * asEngine_GetFuncdefByIndex(asIScriptEngine *e, asUINT index);
  456. // Typedefs
  457. AS_API int asEngine_RegisterTypedef(asIScriptEngine *e, const char *type, const char *decl);
  458. AS_API asUINT asEngine_GetTypedefCount(asIScriptEngine *e);
  459. AS_API asITypeInfo * asEngine_GetTypedefByIndex(asIScriptEngine *e, asUINT index);
  460. // Configuration groups
  461. AS_API int asEngine_BeginConfigGroup(asIScriptEngine *e, const char *groupName);
  462. AS_API int asEngine_EndConfigGroup(asIScriptEngine *e);
  463. AS_API int asEngine_RemoveConfigGroup(asIScriptEngine *e, const char *groupName);
  464. AS_API asDWORD asEngine_SetDefaultAccessMask(asIScriptEngine *e, asDWORD defaultMask);
  465. AS_API int asEngine_SetDefaultNamespace(asIScriptEngine *e, const char *nameSpace);
  466. AS_API const char * asEngine_GetDefaultNamespace(asIScriptEngine *e);
  467. // Script modules
  468. AS_API asIScriptModule * asEngine_GetModule(asIScriptEngine *e, const char *module, asEGMFlags flag);
  469. AS_API int asEngine_DiscardModule(asIScriptEngine *e, const char *module);
  470. AS_API asUINT asEngine_GetModuleCount(asIScriptEngine *e);
  471. AS_API asIScriptModule * asEngine_GetModuleByIndex(asIScriptEngine *e, asUINT index);
  472. // Script functions
  473. AS_API asIScriptFunction *asEngine_GetFunctionById(asIScriptEngine *e, int funcId);
  474. // Type identification
  475. AS_API int asEngine_GetTypeIdByDecl(asIScriptEngine *e, const char *decl);
  476. AS_API const char * asEngine_GetTypeDeclaration(asIScriptEngine *e, int typeId, asBOOL includeNamespace);
  477. AS_API int asEngine_GetSizeOfPrimitiveType(asIScriptEngine *e, int typeId);
  478. AS_API asITypeInfo *asEngine_GetTypeInfoById(asIScriptEngine *e, int typeId);
  479. AS_API asITypeInfo *asEngine_GetTypeInfoByName(asIScriptEngine *e, const char *name);
  480. AS_API asITypeInfo *asEngine_GetTypeInfoByDecl(asIScriptEngine *e, const char *decl);
  481. // Script execution
  482. AS_API asIScriptContext * asEngine_CreateContext(asIScriptEngine *e);
  483. AS_API void * asEngine_CreateScriptObject(asIScriptEngine *e, asITypeInfo *type);
  484. AS_API void * asEngine_CreateScriptObjectCopy(asIScriptEngine *e, void *obj, asITypeInfo *type);
  485. AS_API void * asEngine_CreateUninitializedScriptObject(asIScriptEngine *e, asITypeInfo *type);
  486. AS_API asIScriptFunction * asEngine_CreateDelegate(asIScriptEngine *e, asIScriptFunction *func, void *obj);
  487. AS_API int asEngine_AssignScriptObject(asIScriptEngine *e, void *dstObj, void *srcObj, asITypeInfo *type);
  488. AS_API void asEngine_ReleaseScriptObject(asIScriptEngine *e, void *obj, asITypeInfo *type);
  489. AS_API void asEngine_AddRefScriptObject(asIScriptEngine *e, void *obj, asITypeInfo *type);
  490. AS_API int asEngine_RefCastObject(asIScriptEngine *e, void *obj, asITypeInfo *fromType, asITypeInfo *toType, void **newPtr, bool useOnlyImplicitCast);
  491. AS_API asILockableSharedBool *asEngine_GetWeakRefFlagOfScriptObject(asIScriptEngine *e, void *obj, asITypeInfo *type);
  492. // Context pooling
  493. AS_API asIScriptContext *asEngine_RequestContext(asIScriptEngine *e);
  494. AS_API void asEngine_ReturnContext(asIScriptEngine *e, asIScriptContext *ctx);
  495. AS_API int asEngine_SetContextCallbacks(asIScriptEngine *e, asREQUESTCONTEXTFUNC_t requestCtx, asRETURNCONTEXTFUNC_t returnCtx, void *param);
  496. // String interpretation
  497. AS_API asETokenClass asEngine_ParseToken(asIScriptEngine *e, const char *string, size_t stringLength, asUINT *tokenLength);
  498. // Garbage collection
  499. AS_API int asEngine_GarbageCollect(asIScriptEngine *e, asDWORD flags);
  500. AS_API void asEngine_GetGCStatistics(asIScriptEngine *e, asUINT *currentSize, asUINT *totalDestroyed, asUINT *totalDetected, asUINT *newObjects, asUINT *totalNewDestroyed);
  501. AS_API int asEngine_NotifyGarbageCollectorOfNewObject(asIScriptEngine *e, void *obj, asITypeInfo *type);
  502. AS_API int asEngine_GetObjectInGC(asIScriptEngine *e, asUINT idx, asUINT *seqNbr, void **obj, asITypeInfo **type);
  503. AS_API void asEngine_GCEnumCallback(asIScriptEngine *e, void *obj);
  504. // User data
  505. AS_API void * asEngine_SetUserData(asIScriptEngine *e, void *data, asPWORD type);
  506. AS_API void * asEngine_GetUserData(asIScriptEngine *e, asPWORD type);
  507. AS_API void asEngine_SetEngineUserDataCleanupCallback(asIScriptEngine *e, asCLEANENGINEFUNC_t callback, asPWORD type);
  508. AS_API void asEngine_SetModuleUserDataCleanupCallback(asIScriptEngine *e, asCLEANMODULEFUNC_t callback);
  509. AS_API void asEngine_SetContextUserDataCleanupCallback(asIScriptEngine *e, asCLEANCONTEXTFUNC_t callback);
  510. AS_API void asEngine_SetFunctionUserDataCleanupCallback(asIScriptEngine *e, asCLEANFUNCTIONFUNC_t callback);
  511. AS_API void asEngine_SetTypeInfoUserDataCleanupCallback(asIScriptEngine *e, asCLEANTYPEINFOFUNC_t callback, asPWORD type);
  512. AS_API void asEngine_SetScriptObjectUserDataCleanupCallback(asIScriptEngine *e, asCLEANSCRIPTOBJECTFUNC_t callback, asPWORD type);
  513. ///////////////////////////////////////////
  514. // asIScriptModule
  515. AS_API asIScriptEngine *asModule_GetEngine(asIScriptModule *m);
  516. AS_API void asModule_SetName(asIScriptModule *m, const char *name);
  517. AS_API const char *asModule_GetName(asIScriptModule *m);
  518. AS_API void asModule_Discard(asIScriptModule *m);
  519. // Compilation
  520. AS_API int asModule_AddScriptSection(asIScriptModule *m, const char *name, const char *code, size_t codeLength, int lineOffset);
  521. AS_API int asModule_Build(asIScriptModule *m);
  522. AS_API int asModule_CompileFunction(asIScriptModule *m, const char *sectionName, const char *code, int lineOffset, asDWORD compileFlags, asIScriptFunction **outFunc);
  523. AS_API int asModule_CompileGlobalVar(asIScriptModule *m, const char *sectionName, const char *code, int lineOffset);
  524. AS_API asDWORD asModule_SetAccessMask(asIScriptModule *m, asDWORD accessMask);
  525. AS_API int asModule_SetDefaultNamespace(asIScriptModule *m,const char *nameSpace);
  526. AS_API const char *asModule_GetDefaultNamespace(asIScriptModule *m);
  527. // Functions
  528. AS_API asUINT asModule_GetFunctionCount(asIScriptModule *m);
  529. AS_API asIScriptFunction *asModule_GetFunctionByIndex(asIScriptModule *m, asUINT index);
  530. AS_API asIScriptFunction *asModule_GetFunctionByDecl(asIScriptModule *m, const char *decl);
  531. AS_API asIScriptFunction *asModule_GetFunctionByName(asIScriptModule *m, const char *name);
  532. AS_API int asModule_RemoveFunction(asIScriptModule *m, asIScriptFunction *func);
  533. // Global variables
  534. AS_API int asModule_ResetGlobalVars(asIScriptModule *m, asIScriptContext *ctx);
  535. AS_API asUINT asModule_GetGlobalVarCount(asIScriptModule *m);
  536. AS_API int asModule_GetGlobalVarIndexByName(asIScriptModule *m, const char *name);
  537. AS_API int asModule_GetGlobalVarIndexByDecl(asIScriptModule *m, const char *decl);
  538. AS_API const char *asModule_GetGlobalVarDeclaration(asIScriptModule *m, asUINT index, asBOOL includeNamespace);
  539. AS_API int asModule_GetGlobalVar(asIScriptModule *m, asUINT index, const char **name, const char **nameSpace, int *typeId, asBOOL *isConst);
  540. AS_API void *asModule_GetAddressOfGlobalVar(asIScriptModule *m, asUINT index);
  541. AS_API int asModule_RemoveGlobalVar(asIScriptModule *m, asUINT index);
  542. // Type identification
  543. AS_API asUINT asModule_GetObjectTypeCount(asIScriptModule *m);
  544. AS_API asITypeInfo *asModule_GetObjectTypeByIndex(asIScriptModule *m, asUINT index);
  545. AS_API int asModule_GetTypeIdByDecl(asIScriptModule *m, const char *decl);
  546. AS_API asITypeInfo *asModule_GetTypeInfoByName(asIScriptModule *m, const char *name);
  547. AS_API asITypeInfo *asModule_GetTypeInfoByDecl(asIScriptModule *m, const char *decl);
  548. // Enums
  549. AS_API asUINT asModule_GetEnumCount(asIScriptModule *m);
  550. AS_API asITypeInfo * asModule_GetEnumByIndex(asIScriptModule *m, asUINT index);
  551. // Typedefs
  552. AS_API asUINT asModule_GetTypedefCount(asIScriptModule *m);
  553. AS_API asITypeInfo * asModule_GetTypedefByIndex(asIScriptModule *m, asUINT index);
  554. // Dynamic binding between modules
  555. AS_API asUINT asModule_GetImportedFunctionCount(asIScriptModule *m);
  556. AS_API int asModule_GetImportedFunctionIndexByDecl(asIScriptModule *m, const char *decl);
  557. AS_API const char *asModule_GetImportedFunctionDeclaration(asIScriptModule *m, asUINT importIndex);
  558. AS_API const char *asModule_GetImportedFunctionSourceModule(asIScriptModule *m, asUINT importIndex);
  559. AS_API int asModule_BindImportedFunction(asIScriptModule *m, asUINT importIndex, asIScriptFunction *func);
  560. AS_API int asModule_UnbindImportedFunction(asIScriptModule *m, asUINT importIndex);
  561. AS_API int asModule_BindAllImportedFunctions(asIScriptModule *m);
  562. AS_API int asModule_UnbindAllImportedFunctions(asIScriptModule *m);
  563. // Bytecode saving and loading
  564. AS_API int asModule_SaveByteCode(asIScriptModule *m, asIBinaryStream *out, asBOOL stripDebugInfo);
  565. AS_API int asModule_LoadByteCode(asIScriptModule *m, asIBinaryStream *in, asBOOL *wasDebugInfoStripped);
  566. // User data
  567. AS_API void *asModule_SetUserData(asIScriptModule *m, void *data);
  568. AS_API void *asModule_GetUserData(asIScriptModule *m);
  569. ///////////////////////////////////////////
  570. // asIScriptContext
  571. // Memory management
  572. AS_API int asContext_AddRef(asIScriptContext *c);
  573. AS_API int asContext_Release(asIScriptContext *c);
  574. // Miscellaneous
  575. AS_API asIScriptEngine *asContext_GetEngine(asIScriptContext *c);
  576. // Execution
  577. AS_API int asContext_Prepare(asIScriptContext *c, asIScriptFunction *func);
  578. AS_API int asContext_Unprepare(asIScriptContext *c);
  579. AS_API int asContext_Execute(asIScriptContext *c);
  580. AS_API int asContext_Abort(asIScriptContext *c);
  581. AS_API int asContext_Suspend(asIScriptContext *c);
  582. AS_API asEContextState asContext_GetState(asIScriptContext *c);
  583. AS_API int asContext_PushState(asIScriptContext *c);
  584. AS_API int asContext_PopState(asIScriptContext *c);
  585. AS_API asBOOL asContext_IsNested(asIScriptContext *c, asUINT *nestCount);
  586. // Object pointer for calling class methods
  587. AS_API int asContext_SetObject(asIScriptContext *c, void *obj);
  588. // Arguments
  589. AS_API int asContext_SetArgByte(asIScriptContext *c, asUINT arg, asBYTE value);
  590. AS_API int asContext_SetArgWord(asIScriptContext *c, asUINT arg, asWORD value);
  591. AS_API int asContext_SetArgDWord(asIScriptContext *c, asUINT arg, asDWORD value);
  592. AS_API int asContext_SetArgQWord(asIScriptContext *c, asUINT arg, asQWORD value);
  593. AS_API int asContext_SetArgFloat(asIScriptContext *c, asUINT arg, float value);
  594. AS_API int asContext_SetArgDouble(asIScriptContext *c, asUINT arg, double value);
  595. AS_API int asContext_SetArgAddress(asIScriptContext *c, asUINT arg, void *addr);
  596. AS_API int asContext_SetArgObject(asIScriptContext *c, asUINT arg, void *obj);
  597. AS_API int asContext_SetArgVarType(asIScriptContext *c, asUINT arg, void *ptr, int typeId);
  598. AS_API void * asContext_GetAddressOfArg(asIScriptContext *c, asUINT arg);
  599. // Return value
  600. AS_API asBYTE asContext_GetReturnByte(asIScriptContext *c);
  601. AS_API asWORD asContext_GetReturnWord(asIScriptContext *c);
  602. AS_API asDWORD asContext_GetReturnDWord(asIScriptContext *c);
  603. AS_API asQWORD asContext_GetReturnQWord(asIScriptContext *c);
  604. AS_API float asContext_GetReturnFloat(asIScriptContext *c);
  605. AS_API double asContext_GetReturnDouble(asIScriptContext *c);
  606. AS_API void * asContext_GetReturnAddress(asIScriptContext *c);
  607. AS_API void * asContext_GetReturnObject(asIScriptContext *c);
  608. AS_API void * asContext_GetAddressOfReturnValue(asIScriptContext *c);
  609. // Exception handling
  610. AS_API int asContext_SetException(asIScriptContext *c, const char *string);
  611. AS_API int asContext_GetExceptionLineNumber(asIScriptContext *c, int *column, const char **sectionName);
  612. AS_API asIScriptFunction *asContext_GetExceptionFunction(asIScriptContext *c);
  613. AS_API const char * asContext_GetExceptionString(asIScriptContext *c);
  614. AS_API int asContext_SetExceptionCallback(asIScriptContext *c, asFUNCTION_t callback, void *obj, int callConv);
  615. AS_API void asContext_ClearExceptionCallback(asIScriptContext *c);
  616. // Debugging
  617. AS_API int asContext_SetLineCallback(asIScriptContext *c, asFUNCTION_t callback, void *obj, int callConv);
  618. AS_API void asContext_ClearLineCallback(asIScriptContext *c);
  619. AS_API asUINT asContext_GetCallstackSize(asIScriptContext *c);
  620. AS_API asIScriptFunction *asContext_GetFunction(asIScriptContext *c, asUINT stackLevel);
  621. AS_API int asContext_GetLineNumber(asIScriptContext *c, asUINT stackLevel, int *column, const char **sectionName);
  622. AS_API int asContext_GetVarCount(asIScriptContext *c, asUINT stackLevel);
  623. AS_API const char * asContext_GetVarName(asIScriptContext *c, asUINT varIndex, asUINT stackLevel);
  624. AS_API const char * asContext_GetVarDeclaration(asIScriptContext *c, asUINT varIndex, asUINT stackLevel, asBOOL includeNamespace);
  625. AS_API int asContext_GetVarTypeId(asIScriptContext *c, asUINT varIndex, asUINT stackLevel);
  626. AS_API void * asContext_GetAddressOfVar(asIScriptContext *c, asUINT varIndex, asUINT stackLevel);
  627. AS_API asBOOL asContext_IsVarInScope(asIScriptContext *c, asUINT varIndex, asUINT stackLevel);
  628. AS_API int asContext_GetThisTypeId(asIScriptContext *c, asUINT stackLevel);
  629. AS_API void * asContext_GetThisPointer(asIScriptContext *c, asUINT stackLevel);
  630. AS_API asIScriptFunction *asContext_GetSystemFunction(asIScriptContext *c);
  631. // User data
  632. AS_API void * asContext_SetUserData(asIScriptContext *c, void *data);
  633. AS_API void * asContext_GetUserData(asIScriptContext *c);
  634. ///////////////////////////////////////////
  635. // asIScriptGeneric
  636. // Miscellaneous
  637. AS_API asIScriptEngine *asGeneric_GetEngine(asIScriptGeneric *g);
  638. AS_API asIScriptFunction *asGeneric_GetFunction(asIScriptGeneric *g);
  639. AS_API void *asGeneric_GetAuxiliary(asIScriptGeneric *g);
  640. // Object
  641. AS_API void * asGeneric_GetObject(asIScriptGeneric *g);
  642. AS_API int asGeneric_GetObjectTypeId(asIScriptGeneric *g);
  643. // Arguments
  644. AS_API int asGeneric_GetArgCount(asIScriptGeneric *g);
  645. AS_API int asGeneric_GetArgTypeId(asIScriptGeneric *g, asUINT arg, asDWORD *flags);
  646. AS_API asBYTE asGeneric_GetArgByte(asIScriptGeneric *g, asUINT arg);
  647. AS_API asWORD asGeneric_GetArgWord(asIScriptGeneric *g, asUINT arg);
  648. AS_API asDWORD asGeneric_GetArgDWord(asIScriptGeneric *g, asUINT arg);
  649. AS_API asQWORD asGeneric_GetArgQWord(asIScriptGeneric *g, asUINT arg);
  650. AS_API float asGeneric_GetArgFloat(asIScriptGeneric *g, asUINT arg);
  651. AS_API double asGeneric_GetArgDouble(asIScriptGeneric *g, asUINT arg);
  652. AS_API void * asGeneric_GetArgAddress(asIScriptGeneric *g, asUINT arg);
  653. AS_API void * asGeneric_GetArgObject(asIScriptGeneric *g, asUINT arg);
  654. AS_API void * asGeneric_GetAddressOfArg(asIScriptGeneric *g, asUINT arg);
  655. // Return value
  656. AS_API int asGeneric_GetReturnTypeId(asIScriptGeneric *g, asDWORD *flags);
  657. AS_API int asGeneric_SetReturnByte(asIScriptGeneric *g, asBYTE val);
  658. AS_API int asGeneric_SetReturnWord(asIScriptGeneric *g, asWORD val);
  659. AS_API int asGeneric_SetReturnDWord(asIScriptGeneric *g, asDWORD val);
  660. AS_API int asGeneric_SetReturnQWord(asIScriptGeneric *g, asQWORD val);
  661. AS_API int asGeneric_SetReturnFloat(asIScriptGeneric *g, float val);
  662. AS_API int asGeneric_SetReturnDouble(asIScriptGeneric *g, double val);
  663. AS_API int asGeneric_SetReturnAddress(asIScriptGeneric *g, void *addr);
  664. AS_API int asGeneric_SetReturnObject(asIScriptGeneric *g, void *obj);
  665. AS_API void * asGeneric_GetAddressOfReturnLocation(asIScriptGeneric *g);
  666. ///////////////////////////////////////////
  667. // asIScriptObject
  668. // Memory management
  669. AS_API int asObject_AddRef(asIScriptObject *s);
  670. AS_API int asObject_Release(asIScriptObject *s);
  671. AS_API asILockableSharedBool *asObject_GetWeakRefFlag(asIScriptObject *s);
  672. // Type info
  673. AS_API int asObject_GetTypeId(asIScriptObject *s);
  674. AS_API asITypeInfo * asObject_GetObjectType(asIScriptObject *s);
  675. // Class properties
  676. AS_API asUINT asObject_GetPropertyCount(asIScriptObject *s);
  677. AS_API int asObject_GetPropertyTypeId(asIScriptObject *s, asUINT prop);
  678. AS_API const char * asObject_GetPropertyName(asIScriptObject *s, asUINT prop);
  679. AS_API void * asObject_GetAddressOfProperty(asIScriptObject *s, asUINT prop);
  680. // Miscellaneous
  681. AS_API asIScriptEngine *asObject_GetEngine(asIScriptObject *s);
  682. AS_API int asObject_CopyFrom(asIScriptObject *s, asIScriptObject *other);
  683. // User data
  684. AS_API void *asObject_SetUserData(asIScriptObject *s, void *data, asPWORD type);
  685. AS_API void *asObject_GetUserData(asIScriptObject *s, asPWORD type);
  686. ///////////////////////////////////////////
  687. // asITypeInfo
  688. // Miscellaneous
  689. AS_API asIScriptEngine *asTypeInfo_GetEngine(asITypeInfo *o);
  690. AS_API const char *asTypeInfo_GetConfigGroup(asITypeInfo *o);
  691. AS_API asDWORD asTypeInfo_GetAccessMask(asITypeInfo *o);
  692. AS_API asIScriptModule *asTypeInfo_GetModule(asITypeInfo *o);
  693. // Memory management
  694. AS_API int asTypeInfo_AddRef(const asITypeInfo *o);
  695. AS_API int asTypeInfo_Release(const asITypeInfo *o);
  696. // Type info
  697. AS_API const char *asTypeInfo_GetName(const asITypeInfo *o);
  698. AS_API const char *asTypeInfo_GetNamespace(const asITypeInfo *o);
  699. AS_API asITypeInfo *asTypeInfo_GetBaseType(const asITypeInfo *o);
  700. AS_API asBOOL asTypeInfo_DerivesFrom(const asITypeInfo *o, const asITypeInfo *objType);
  701. AS_API asDWORD asTypeInfo_GetFlags(const asITypeInfo *o);
  702. AS_API asUINT asTypeInfo_GetSize(const asITypeInfo *o);
  703. AS_API int asTypeInfo_GetTypeId(const asITypeInfo *o);
  704. AS_API int asTypeInfo_GetSubTypeId(const asITypeInfo *o, asUINT subTypeIndex);
  705. AS_API asITypeInfo *asTypeInfo_GetSubType(const asITypeInfo *o, asUINT subTypeIndex);
  706. AS_API asUINT asTypeInfo_GetSubTypeCount(const asITypeInfo *o);
  707. // Interfaces
  708. AS_API asUINT asTypeInfo_GetInterfaceCount(const asITypeInfo *o);
  709. AS_API asITypeInfo *asTypeInfo_GetInterface(const asITypeInfo *o, asUINT index);
  710. AS_API asBOOL asTypeInfo_Implements(const asITypeInfo *o, const asITypeInfo *objType);
  711. // Factories
  712. AS_API asUINT asTypeInfo_GetFactoryCount(const asITypeInfo *o);
  713. AS_API asIScriptFunction *asTypeInfo_GetFactoryByIndex(const asITypeInfo *o, asUINT index);
  714. AS_API asIScriptFunction *asTypeInfo_GetFactoryByDecl(const asITypeInfo *o, const char *decl);
  715. // Methods
  716. AS_API asUINT asTypeInfo_GetMethodCount(const asITypeInfo *o);
  717. AS_API asIScriptFunction *asTypeInfo_GetMethodByIndex(const asITypeInfo *o, asUINT index, asBOOL getVirtual);
  718. AS_API asIScriptFunction *asTypeInfo_GetMethodByName(const asITypeInfo *o, const char *name, asBOOL getVirtual);
  719. AS_API asIScriptFunction *asTypeInfo_GetMethodByDecl(const asITypeInfo *o, const char *decl, asBOOL getVirtual);
  720. // Properties
  721. AS_API asUINT asTypeInfo_GetPropertyCount(const asITypeInfo *o);
  722. 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);
  723. AS_API const char *asTypeInfo_GetPropertyDeclaration(const asITypeInfo *o, asUINT index);
  724. // Behaviours
  725. AS_API asUINT asTypeInfo_GetBehaviourCount(const asITypeInfo *o);
  726. AS_API asIScriptFunction *asTypeInfo_GetBehaviourByIndex(const asITypeInfo *o, asUINT index, asEBehaviours *outBehaviour);
  727. // Child types
  728. AS_API asUINT asTypeInfo_GetChildFuncdefCount(asITypeInfo *o);
  729. AS_API asITypeInfo *asTypeInfo_GetChildFuncdef(asITypeInfo *o, asUINT index);
  730. AS_API asITypeInfo *asTypeInfo_GetParentType(asITypeInfo *o);
  731. // Enums
  732. AS_API asUINT asTypeInfo_GetEnumValueCount(asITypeInfo *o);
  733. AS_API const char *asTypeInfo_GetEnumValueByIndex(asITypeInfo *o, asUINT index, int *outValue);
  734. // Typedef
  735. AS_API int asTypeInfo_GetTypedefTypeId(asITypeInfo *o);
  736. // Funcdef
  737. AS_API asIScriptFunction *asTypeInfo_GetFuncdefSignature(asITypeInfo *o);
  738. // User data
  739. AS_API void *asTypeInfo_SetUserData(asITypeInfo *o, void *data, asPWORD type);
  740. AS_API void *asTypeInfo_GetUserData(asITypeInfo *o, asPWORD type);
  741. ///////////////////////////////////////////
  742. // asIScriptFunction
  743. AS_API asIScriptEngine *asFunction_GetEngine(const asIScriptFunction *f);
  744. // Memory management
  745. AS_API int asFunction_AddRef(const asIScriptFunction *f);
  746. AS_API int asFunction_Release(const asIScriptFunction *f);
  747. // Miscellaneous
  748. AS_API int asFunction_GetId(const asIScriptFunction *f);
  749. AS_API asEFuncType asFunction_GetFuncType(const asIScriptFunction *f);
  750. AS_API const char *asFunction_GetModuleName(const asIScriptFunction *f);
  751. AS_API asIScriptModule *asFunction_GetModule(const asIScriptFunction *f);
  752. AS_API const char *asFunction_GetScriptSectionName(const asIScriptFunction *f);
  753. AS_API const char *asFunction_GetConfigGroup(const asIScriptFunction *f);
  754. AS_API asDWORD asFunction_GetAccessMask(const asIScriptFunction *f);
  755. AS_API void *asFunction_GetAuxiliary(const asIScriptFunction *f);
  756. // Function signature
  757. AS_API asITypeInfo *asFunction_GetObjectType(const asIScriptFunction *f);
  758. AS_API const char *asFunction_GetObjectName(const asIScriptFunction *f);
  759. AS_API const char *asFunction_GetName(const asIScriptFunction *f);
  760. AS_API const char *asFunction_GetNamespace(const asIScriptFunction *f);
  761. AS_API const char *asFunction_GetDeclaration(const asIScriptFunction *f, asBOOL includeObjectName, asBOOL includeNamespace);
  762. AS_API asBOOL asFunction_IsReadOnly(const asIScriptFunction *f);
  763. AS_API asBOOL asFunction_IsPrivate(const asIScriptFunction *f);
  764. AS_API asBOOL asFunction_IsProtected(const asIScriptFunction *f);
  765. AS_API asBOOL asFunction_IsFinal(const asIScriptFunction *f);
  766. AS_API asBOOL asFunction_IsOverride(const asIScriptFunction *f);
  767. AS_API asBOOL asFunction_IsShared(const asIScriptFunction *f);
  768. AS_API asUINT asFunction_GetParamCount(const asIScriptFunction *f);
  769. AS_API int asFunction_GetParam(const asIScriptFunction *f, asUINT index, int *typeId, asDWORD *flags, const char **name, const char **defaultArg);
  770. AS_API int asFunction_GetReturnTypeId(const asIScriptFunction *f);
  771. // Type id for function pointers
  772. AS_API int asFunction_GetTypeId(const asIScriptFunction *f);
  773. AS_API asBOOL asFunction_IsCompatibleWithTypeId(const asIScriptFunction *f, int typeId);
  774. // Delegates
  775. AS_API void *asFunction_GetDelegateObject(const asIScriptFunction *f);
  776. AS_API asITypeInfo *asFunction_GetDelegateObjectType(const asIScriptFunction *f);
  777. AS_API asIScriptFunction *asFunction_GetDelegateFunction(const asIScriptFunction *f);
  778. // Debug information
  779. AS_API asUINT asFunction_GetVarCount(const asIScriptFunction *f);
  780. AS_API int asFunction_GetVar(const asIScriptFunction *f, asUINT index, const char **name, int *typeId);
  781. AS_API const char * asFunction_GetVarDecl(const asIScriptFunction *f, asUINT index, asBOOL includeNamespace);
  782. AS_API int asFunction_FindNextLineWithCode(const asIScriptFunction *f, int line);
  783. // For JIT compilation
  784. AS_API asDWORD *asFunction_GetByteCode(asIScriptFunction *f, asUINT *length);
  785. // User data
  786. AS_API void *asFunction_SetUserData(asIScriptFunction *f, void *userData);
  787. AS_API void *asFunction_GetUserData(const asIScriptFunction *f);
  788. #ifdef __cplusplus
  789. }
  790. #endif
  791. #endif // ANGELSCRIPT_DLL_MANUAL_IMPORT
  792. END_AS_NAMESPACE
  793. #endif