as_generic.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. AngelCode Scripting Library
  3. Copyright (c) 2003-2015 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_generic.h
  25. //
  26. // This class handles the call to a function registered with asCALL_GENERIC
  27. //
  28. #ifndef AS_GENERIC_H
  29. #define AS_GENERIC_H
  30. #include "as_config.h"
  31. BEGIN_AS_NAMESPACE
  32. class asCScriptEngine;
  33. class asCScriptFunction;
  34. class asCGeneric : public asIScriptGeneric
  35. {
  36. public:
  37. //------------------------------
  38. // asIScriptGeneric
  39. //------------------------------
  40. // Miscellaneous
  41. asIScriptEngine *GetEngine() const;
  42. asIScriptFunction *GetFunction() const;
  43. void *GetAuxiliary() const;
  44. // Object
  45. void *GetObject();
  46. int GetObjectTypeId() const;
  47. // Arguments
  48. int GetArgCount() const;
  49. int GetArgTypeId(asUINT arg, asDWORD *flags = 0) const;
  50. asBYTE GetArgByte(asUINT arg);
  51. asWORD GetArgWord(asUINT arg);
  52. asDWORD GetArgDWord(asUINT arg);
  53. asQWORD GetArgQWord(asUINT arg);
  54. float GetArgFloat(asUINT arg);
  55. double GetArgDouble(asUINT arg);
  56. void *GetArgAddress(asUINT arg);
  57. void *GetArgObject(asUINT arg);
  58. void *GetAddressOfArg(asUINT arg);
  59. // Return value
  60. int GetReturnTypeId(asDWORD *flags = 0) const;
  61. int SetReturnByte(asBYTE val);
  62. int SetReturnWord(asWORD val);
  63. int SetReturnDWord(asDWORD val);
  64. int SetReturnQWord(asQWORD val);
  65. int SetReturnFloat(float val);
  66. int SetReturnDouble(double val);
  67. int SetReturnAddress(void *addr);
  68. int SetReturnObject(void *obj);
  69. void *GetAddressOfReturnLocation();
  70. //------------------------
  71. // internal
  72. //-------------------------
  73. asCGeneric(asCScriptEngine *engine, asCScriptFunction *sysFunction, void *currentObject, asDWORD *stackPointer);
  74. virtual ~asCGeneric();
  75. void *GetReturnPointer();
  76. asCScriptEngine *engine;
  77. asCScriptFunction *sysFunction;
  78. void *currentObject;
  79. asDWORD *stackPointer;
  80. void *objectRegister;
  81. asQWORD returnVal;
  82. };
  83. END_AS_NAMESPACE
  84. #endif