1 /* 2 AngelCode Scripting Library 3 Copyright (c) 2003-2015 Andreas Jonsson 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any 7 damages arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any 10 purpose, including commercial applications, and to alter it and 11 redistribute it freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you 14 must not claim that you wrote the original software. If you use 15 this software in a product, an acknowledgment in the product 16 documentation would be appreciated but is not required. 17 18 2. Altered source versions must be plainly marked as such, and 19 must not be misrepresented as being the original software. 20 21 3. This notice may not be removed or altered from any source 22 distribution. 23 24 The original version of this library can be located at: 25 http://www.angelcode.com/angelscript/ 26 27 Andreas Jonsson 28 andreas@angelcode.com 29 */ 30 31 32 // 33 // as_generic.h 34 // 35 // This class handles the call to a function registered with asCALL_GENERIC 36 // 37 38 39 #ifndef AS_GENERIC_H 40 #define AS_GENERIC_H 41 42 #include "as_config.h" 43 44 BEGIN_AS_NAMESPACE 45 46 class asCScriptEngine; 47 class asCScriptFunction; 48 49 class asCGeneric : public asIScriptGeneric 50 { 51 public: 52 //------------------------------ 53 // asIScriptGeneric 54 //------------------------------ 55 // Miscellaneous 56 asIScriptEngine *GetEngine() const; 57 asIScriptFunction *GetFunction() const; 58 void *GetAuxiliary() const; 59 60 // Object 61 void *GetObject(); 62 int GetObjectTypeId() const; 63 64 // Arguments 65 int GetArgCount() const; 66 int GetArgTypeId(asUINT arg, asDWORD *flags = 0) const; 67 asBYTE GetArgByte(asUINT arg); 68 asWORD GetArgWord(asUINT arg); 69 asDWORD GetArgDWord(asUINT arg); 70 asQWORD GetArgQWord(asUINT arg); 71 float GetArgFloat(asUINT arg); 72 double GetArgDouble(asUINT arg); 73 void *GetArgAddress(asUINT arg); 74 void *GetArgObject(asUINT arg); 75 void *GetAddressOfArg(asUINT arg); 76 77 // Return value 78 int GetReturnTypeId(asDWORD *flags = 0) const; 79 int SetReturnByte(asBYTE val); 80 int SetReturnWord(asWORD val); 81 int SetReturnDWord(asDWORD val); 82 int SetReturnQWord(asQWORD val); 83 int SetReturnFloat(float val); 84 int SetReturnDouble(double val); 85 int SetReturnAddress(void *addr); 86 int SetReturnObject(void *obj); 87 void *GetAddressOfReturnLocation(); 88 89 //------------------------ 90 // internal 91 //------------------------- 92 asCGeneric(asCScriptEngine *engine, asCScriptFunction *sysFunction, void *currentObject, asDWORD *stackPointer); 93 virtual ~asCGeneric(); 94 95 void *GetReturnPointer(); 96 97 asCScriptEngine *engine; 98 asCScriptFunction *sysFunction; 99 void *currentObject; 100 asDWORD *stackPointer; 101 void *objectRegister; 102 103 asQWORD returnVal; 104 }; 105 106 END_AS_NAMESPACE 107 108 #endif 109