/Ruby/include/ruby-2.0.0/ruby/defines.h

https://gitlab.com/orvi2014/rcs-db-ext · C Header · 264 lines · 215 code · 40 blank · 9 comment · 8 complexity · c1a7123c8d9d3f50dfa8a492ba501178 MD5 · raw file

  1. /************************************************
  2. defines.h -
  3. $Author: ngoto $
  4. created at: Wed May 18 00:21:44 JST 1994
  5. ************************************************/
  6. #ifndef RUBY_DEFINES_H
  7. #define RUBY_DEFINES_H 1
  8. #if defined(__cplusplus)
  9. extern "C" {
  10. #if 0
  11. } /* satisfy cc-mode */
  12. #endif
  13. #endif
  14. #include "ruby/config.h"
  15. #ifdef RUBY_EXTCONF_H
  16. #include RUBY_EXTCONF_H
  17. #endif
  18. #define RUBY
  19. # include <stddef.h>
  20. #ifdef HAVE_STDLIB_H
  21. # include <stdlib.h>
  22. #endif
  23. #ifdef __cplusplus
  24. # ifndef HAVE_PROTOTYPES
  25. # define HAVE_PROTOTYPES 1
  26. # endif
  27. # ifndef HAVE_STDARG_PROTOTYPES
  28. # define HAVE_STDARG_PROTOTYPES 1
  29. # endif
  30. #endif
  31. #undef _
  32. #ifdef HAVE_PROTOTYPES
  33. # define _(args) args
  34. #else
  35. # define _(args) ()
  36. #endif
  37. #undef __
  38. #ifdef HAVE_STDARG_PROTOTYPES
  39. # define __(args) args
  40. #else
  41. # define __(args) ()
  42. #endif
  43. #ifdef __cplusplus
  44. #define ANYARGS ...
  45. #else
  46. #define ANYARGS
  47. #endif
  48. #if defined __GNUC__ && __GNUC__ >= 4
  49. #pragma GCC visibility push(default)
  50. #endif
  51. #define xmalloc ruby_xmalloc
  52. #define xmalloc2 ruby_xmalloc2
  53. #define xcalloc ruby_xcalloc
  54. #define xrealloc ruby_xrealloc
  55. #define xrealloc2 ruby_xrealloc2
  56. #define xfree ruby_xfree
  57. void *xmalloc(size_t);
  58. void *xmalloc2(size_t,size_t);
  59. void *xcalloc(size_t,size_t);
  60. void *xrealloc(void*,size_t);
  61. void *xrealloc2(void*,size_t,size_t);
  62. void xfree(void*);
  63. #define STRINGIZE(expr) STRINGIZE0(expr)
  64. #ifndef STRINGIZE0
  65. #define STRINGIZE0(expr) #expr
  66. #endif
  67. #if SIZEOF_LONG_LONG > 0
  68. # define LONG_LONG long long
  69. #elif SIZEOF___INT64 > 0
  70. # define HAVE_LONG_LONG 1
  71. # define LONG_LONG __int64
  72. # undef SIZEOF_LONG_LONG
  73. # define SIZEOF_LONG_LONG SIZEOF___INT64
  74. #endif
  75. #if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
  76. # define BDIGIT unsigned int
  77. # define SIZEOF_BDIGITS SIZEOF_INT
  78. # define BDIGIT_DBL unsigned LONG_LONG
  79. # define BDIGIT_DBL_SIGNED LONG_LONG
  80. # define PRI_BDIGIT_PREFIX ""
  81. # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
  82. #elif SIZEOF_INT*2 <= SIZEOF_LONG
  83. # define BDIGIT unsigned int
  84. # define SIZEOF_BDIGITS SIZEOF_INT
  85. # define BDIGIT_DBL unsigned long
  86. # define BDIGIT_DBL_SIGNED long
  87. # define PRI_BDIGIT_PREFIX ""
  88. # define PRI_BDIGIT_DBL_PREFIX "l"
  89. #elif SIZEOF_SHORT*2 <= SIZEOF_LONG
  90. # define BDIGIT unsigned short
  91. # define SIZEOF_BDIGITS SIZEOF_SHORT
  92. # define BDIGIT_DBL unsigned long
  93. # define BDIGIT_DBL_SIGNED long
  94. # define PRI_BDIGIT_PREFIX "h"
  95. # define PRI_BDIGIT_DBL_PREFIX "l"
  96. #else
  97. # define BDIGIT unsigned short
  98. # define SIZEOF_BDIGITS (SIZEOF_LONG/2)
  99. # define BDIGIT_DBL unsigned long
  100. # define BDIGIT_DBL_SIGNED long
  101. # define PRI_BDIGIT_PREFIX "h"
  102. # define PRI_BDIGIT_DBL_PREFIX "l"
  103. #endif
  104. #define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
  105. #define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
  106. #define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
  107. #define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
  108. #define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
  109. #define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
  110. #define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
  111. #define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
  112. #define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
  113. #define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
  114. #define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
  115. #define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
  116. #ifdef __CYGWIN__
  117. #undef _WIN32
  118. #endif
  119. #if defined(_WIN32) || defined(__EMX__)
  120. #define DOSISH 1
  121. # define DOSISH_DRIVE_LETTER
  122. #endif
  123. #ifdef AC_APPLE_UNIVERSAL_BUILD
  124. #undef WORDS_BIGENDIAN
  125. #ifdef __BIG_ENDIAN__
  126. #define WORDS_BIGENDIAN
  127. #endif
  128. #endif
  129. #ifdef _WIN32
  130. #include "ruby/win32.h"
  131. #endif
  132. #if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
  133. #include <net/socket.h> /* intern.h needs fd_set definition */
  134. #elif defined (__SYMBIAN32__) && defined (HAVE_SYS_SELECT_H)
  135. # include <sys/select.h>
  136. #endif
  137. #ifdef __SYMBIAN32__
  138. # define FALSE 0
  139. # define TRUE 1
  140. #endif
  141. #ifdef RUBY_EXPORT
  142. #undef RUBY_EXTERN
  143. #ifndef FALSE
  144. # define FALSE 0
  145. #elif FALSE
  146. # error FALSE must be false
  147. #endif
  148. #ifndef TRUE
  149. # define TRUE 1
  150. #elif !TRUE
  151. # error TRUE must be true
  152. #endif
  153. #endif
  154. #ifndef RUBY_FUNC_EXPORTED
  155. #define RUBY_FUNC_EXPORTED
  156. #endif
  157. #ifndef RUBY_EXTERN
  158. #define RUBY_EXTERN extern
  159. #endif
  160. #ifndef EXTERN
  161. #define EXTERN RUBY_EXTERN /* deprecated */
  162. #endif
  163. #ifndef RUBY_MBCHAR_MAXSIZE
  164. #define RUBY_MBCHAR_MAXSIZE INT_MAX
  165. /* MB_CUR_MAX will not work well in C locale */
  166. #endif
  167. #if defined(__sparc)
  168. void rb_sparc_flush_register_windows(void);
  169. # define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows()
  170. #elif defined(__ia64)
  171. void *rb_ia64_bsp(void);
  172. void rb_ia64_flushrs(void);
  173. # define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
  174. #else
  175. # define FLUSH_REGISTER_WINDOWS ((void)0)
  176. #endif
  177. #if defined(DOSISH)
  178. #define PATH_SEP ";"
  179. #else
  180. #define PATH_SEP ":"
  181. #endif
  182. #define PATH_SEP_CHAR PATH_SEP[0]
  183. #define PATH_ENV "PATH"
  184. #if defined(DOSISH) && !defined(__EMX__)
  185. #define ENV_IGNORECASE
  186. #endif
  187. #ifndef CASEFOLD_FILESYSTEM
  188. # if defined DOSISH
  189. # define CASEFOLD_FILESYSTEM 1
  190. # else
  191. # define CASEFOLD_FILESYSTEM 0
  192. # endif
  193. #endif
  194. #ifndef DLEXT_MAXLEN
  195. #define DLEXT_MAXLEN 4
  196. #endif
  197. #ifndef RUBY_PLATFORM
  198. #define RUBY_PLATFORM "unknown-unknown"
  199. #endif
  200. #ifndef RUBY_ALIAS_FUNCTION_TYPE
  201. #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
  202. type prot {return name args;}
  203. #endif
  204. #ifndef RUBY_ALIAS_FUNCTION_VOID
  205. #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
  206. void prot {name args;}
  207. #endif
  208. #ifndef RUBY_ALIAS_FUNCTION
  209. #define RUBY_ALIAS_FUNCTION(prot, name, args) \
  210. RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
  211. #endif
  212. #if defined __GNUC__ && __GNUC__ >= 4
  213. #pragma GCC visibility pop
  214. #endif
  215. #if defined(__cplusplus)
  216. #if 0
  217. { /* satisfy cc-mode */
  218. #endif
  219. } /* extern "C" { */
  220. #endif
  221. #endif /* RUBY_DEFINES_H */