c99defs.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /******************************************************************************
  2. Copyright (c) 2013 by Hugh Bailey <[email protected]>
  3. This software is provided 'as-is', without any express or implied
  4. warranty. In no event will the authors be held liable for any damages
  5. arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it
  8. freely, subject to the following restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not
  10. claim that you wrote the original software. If you use this software
  11. in a product, an acknowledgment in the product documentation would be
  12. appreciated but is not required.
  13. 2. Altered source versions must be plainly marked as such, and must not be
  14. misrepresented as being the original software.
  15. 3. This notice may not be removed or altered from any source
  16. distribution.
  17. ******************************************************************************/
  18. #ifndef C99DEFS_H
  19. #define C99DEFS_H
  20. /*
  21. * Contains hacks for getting some C99 stuff working in VC, things like
  22. * bool, inline, stdint
  23. *
  24. * TODO: Check for VC2013, because it actually supports this C99 stuff.
  25. */
  26. #ifdef _MSC_VER
  27. #define EXPORT extern __declspec(dllexport)
  28. #else
  29. #define EXPORT extern
  30. #endif
  31. #ifdef _MSC_VER
  32. #pragma warning (disable : 4996)
  33. #ifndef __cplusplus
  34. #define inline __inline
  35. #endif
  36. #include "vc/stdint.h"
  37. #include "vc/stdbool.h"
  38. #ifndef __off_t_defined
  39. #define __off_t_defined
  40. #if _FILE_OFFSET_BITS == 64
  41. typedef long long off_t;
  42. #else
  43. typedef long off_t;
  44. #endif
  45. typedef int64_t off64_t;
  46. #endif /* __off_t_defined */
  47. #ifdef _WIN64
  48. typedef long long ssize_t;
  49. #else
  50. typedef long ssize_t;
  51. #endif
  52. #else
  53. #include <stdint.h>
  54. #include <stdbool.h>
  55. #include <sys/types.h>
  56. #endif /* _MSC_VER */
  57. #endif