summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-16 02:41:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-16 02:41:26 +0000
commit5b6a192755359617da7ba8ca286bd41d3a67ad32 (patch)
tree5b04f32335e7880b37d9ffdd6202c40172aa5815 /include
parent3e7c34140c4eb7dabd7a0c6176222df795029920 (diff)
* configure.in (RUBY_REPLACE_TYPE): does not define rb_ prefixed
name if no default type is given. * configure.in (RUBY_DEFINT): checks size. * include/ruby/ruby.h (VALUE): use uintptr_t if available. * include/ruby/ruby.h (PRI_PTRDIFF_PREFIX, PRI_SIZE_PREFIX): assumes usable if PRIdPTR is defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/ruby.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index bcbcacbcba..fc5326ff1c 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -60,6 +60,9 @@ extern "C" {
# include <intrinsics.h>
#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
@@ -77,7 +80,13 @@ extern "C" {
# endif
#endif
-#if SIZEOF_LONG == SIZEOF_VOIDP
+#if defined HAVE_UINTPTR_T
+typedef uintptr_t VALUE;
+typedef uintptr_t ID;
+# define SIGNED_VALUE intptr_t
+# define SIZEOF_VALUE SIZEOF_UINTPTR_T
+# undef PRI_VALUE_PREFIX
+#elif SIZEOF_LONG == SIZEOF_VOIDP
typedef unsigned long VALUE;
typedef unsigned long ID;
# define SIGNED_VALUE long
@@ -93,14 +102,26 @@ typedef unsigned LONG_LONG ID;
#else
# error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
#endif
+
+#ifdef PRIdPTR
+#define PRIdVALUE PRIdPTR
+#define PRIiVALUE PRIiPTR
+#define PRIoVALUE PRIoPTR
+#define PRIuVALUE PRIuPTR
+#define PRIxVALUE PRIxPTR
+#define PRIXVALUE PRIXPTR
+#else
#define PRIdVALUE PRI_VALUE_PREFIX"d"
#define PRIiVALUE PRI_VALUE_PREFIX"i"
#define PRIoVALUE PRI_VALUE_PREFIX"o"
#define PRIuVALUE PRI_VALUE_PREFIX"u"
#define PRIxVALUE PRI_VALUE_PREFIX"x"
#define PRIXVALUE PRI_VALUE_PREFIX"X"
+#endif
-#if SIZEOF_PTRDIFF_T == SIZEOF_INT
+#if defined PRIdPTR
+# define PRI_PTRDIFF_PREFIX "t"
+#elif SIZEOF_PTRDIFF_T == SIZEOF_INT
# define PRI_PTRDIFF_PREFIX
#elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
# define PRI_PTRDIFF_PREFIX "l"
@@ -114,7 +135,9 @@ typedef unsigned LONG_LONG ID;
#define PRIxPTRDIFF PRI_PTRDIFF_PREFIX"x"
#define PRIXPTRDIFF PRI_PTRDIFF_PREFIX"X"
-#if SIZEOF_SIZE_T == SIZEOF_INT
+#if defined PRIdPTR
+# define PRI_SIZE_PREFIX "z"
+#elif SIZEOF_SIZE_T == SIZEOF_INT
# define PRI_SIZE_PREFIX
#elif SIZEOF_SIZE_T == SIZEOF_LONG
# define PRI_SIZE_PREFIX "l"