sqmodule.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // SqModule: API used to communicate with and register squirrel modules
  3. //
  4. //
  5. // Copyright (c) 2009 Brandon Jones
  6. //
  7. // This software is provided 'as-is', without any express or implied
  8. // warranty. In no event will the authors be held liable for any damages
  9. // arising from the use of this software.
  10. //
  11. // Permission is granted to anyone to use this software for any purpose,
  12. // including commercial applications, and to alter it and redistribute it
  13. // freely, subject to the following restrictions:
  14. //
  15. // 1. The origin of this software must not be misrepresented; you must not
  16. // claim that you wrote the original software. If you use this software
  17. // in a product, an acknowledgment in the product documentation would be
  18. // appreciated but is not required.
  19. //
  20. // 2. Altered source versions must be plainly marked as such, and must not be
  21. // misrepresented as being the original software.
  22. //
  23. // 3. This notice may not be removed or altered from any source
  24. // distribution.
  25. //
  26. #if !defined(_SQ_MODULE_H_)
  27. #define _SQ_MODULE_H_
  28. #include "squirrel.h"
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* HSQAPI */
  33. /*
  34. Allows modules to interface with squirrel's C api without linking to the squirrel library
  35. If new functions are added to the Squirrel API, they should be added here too
  36. */
  37. typedef struct {
  38. #define SQUIRREL_API_FUNC(fret, fname, fargs) fret (*sq_##fname) fargs;
  39. #include "sqapi.h"
  40. #undef SQUIRREL_API_FUNC
  41. } sq_api;
  42. typedef sq_api* HSQAPI;
  43. #ifdef __cplusplus
  44. } /*extern "C"*/
  45. #endif
  46. #endif /*_SQ_MODULE_H_*/