1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

* __scm.h (SCM_I_UTYPE_MAX, SCM_I_TYPE_MAX, SCM_I_TYPE_MIN,

SCM_I_SIZE_MAX, SCM_I_SSIZE_MIN, SCM_I_SSIZE_MAX): New.

* __scm.h, gen-scmconfig.c (SCM_I_LLONG_MAX, SCM_I_LLONG_MIN,
SCM_I_ULLONG_MAX, SCM_T_INT8_MIN, SCM_T_INT8_MAX, SCM_T_UINT8_MAX,
SCM_T_INT16_MIN, SCM_T_INT16_MAX, SCM_T_UINT16_MAX,
SCM_T_INT32_MIN, SCM_T_INT32_MAX, SCM_T_UINT32_MAX,
SCM_T_INT64_MIN, SCM_T_INT64_MAX, SCM_T_UINT64_MAX,
SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX, SCM_T_UINTMAX_MAX): Moved
definition into __scm.h, using new SCM_I_TYPE_MIN, etc.
This commit is contained in:
Marius Vollmer 2004-07-29 14:03:40 +00:00
parent d0fefc7de5
commit e88d45aa73
2 changed files with 36 additions and 30 deletions

View file

@ -353,6 +353,42 @@
# define SCM_CHAR_CODE_LIMIT 256L
#endif
#define SCM_I_UTYPE_MAX(type) ((type)-1)
#define SCM_I_TYPE_MAX(type,umax) ((type)((umax)/2))
#define SCM_I_TYPE_MIN(type,umax) (-((type)((umax)/2))-1)
#define SCM_T_UINT8_MAX SCM_I_UTYPE_MAX(scm_t_uint8)
#define SCM_T_INT8_MIN SCM_I_TYPE_MIN(scm_t_int8,SCM_T_UINT8_MAX)
#define SCM_T_INT8_MAX SCM_I_TYPE_MAX(scm_t_int8,SCM_T_UINT8_MAX)
#define SCM_T_UINT16_MAX SCM_I_UTYPE_MAX(scm_t_uint16)
#define SCM_T_INT16_MIN SCM_I_TYPE_MIN(scm_t_int16,SCM_T_UINT16_MAX)
#define SCM_T_INT16_MAX SCM_I_TYPE_MAX(scm_t_int16,SCM_T_UINT16_MAX)
#define SCM_T_UINT32_MAX SCM_I_UTYPE_MAX(scm_t_uint32)
#define SCM_T_INT32_MIN SCM_I_TYPE_MIN(scm_t_int32,SCM_T_UINT32_MAX)
#define SCM_T_INT32_MAX SCM_I_TYPE_MAX(scm_t_int32,SCM_T_UINT32_MAX)
#if SCM_HAVE_T_INT64
#define SCM_T_UINT64_MAX SCM_I_UTYPE_MAX(scm_t_uint64)
#define SCM_T_INT64_MIN SCM_I_TYPE_MIN(scm_t_int64,SCM_T_UINT64_MAX)
#define SCM_T_INT64_MAX SCM_I_TYPE_MAX(scm_t_int64,SCM_T_UINT64_MAX)
#endif
#if SCM_SIZEOF_LONG_LONG
#define SCM_I_ULLONG_MAX SCM_I_UTYPE_MAX(unsigned long long)
#define SCM_I_LLONG_MIN SCM_I_TYPE_MIN(long long,SCM_I_ULLONG_MAX)
#define SCM_I_LLONG_MAX SCM_I_TYPE_MAX(long long,SCM_I_ULLONG_MAX)
#endif
#define SCM_T_UINTMAX_MAX SCM_I_UTYPE_MAX(scm_t_uintmax)
#define SCM_T_INTMAX_MIN SCM_I_TYPE_MIN(scm_t_intmax,SCM_T_UINTMAX_MAX)
#define SCM_T_INTMAX_MAX SCM_I_TYPE_MAX(scm_t_intmax,SCM_T_UINTMAX_MAX)
#define SCM_I_SIZE_MAX SCM_I_UTYPE_MAX(size_t)
#define SCM_I_SSIZE_MIN SCM_I_TYPE_MIN(ssize_t,SCM_I_SIZE_MAX)
#define SCM_I_SSIZE_MAX SCM_I_TYPE_MAX(ssize_t,SCM_I_SIZE_MAX)
#include "libguile/tags.h"

View file

@ -277,19 +277,6 @@ main (int argc, char *argv[])
pf ("#define SCM_SIZEOF_LONG_LONG %d\n", SIZEOF_LONG_LONG);
pf ("#define SCM_SIZEOF_UNSIGNED_LONG_LONG %d\n", SIZEOF_UNSIGNED_LONG_LONG);
if (SIZEOF_LONG_LONG != 0)
{
pf ("\n");
pf ("/* The limits of long long are not readily available without\n");
pf (" defining _GNU_SOURCE (which we can't do in a header) or\n");
pf (" being on a C99 system (which we can't rely on yet). Thus,\n");
pf (" we define the limits on our own, assuming twos-complement.\n");
pf ("*/\n");
pf ("#define SCM_I_LLONG_MAX ((long long) (SCM_I_ULLONG_MAX >> 1))\n");
pf ("#define SCM_I_LLONG_MIN (~SCM_I_LLONG_MAX)\n");
pf ("#define SCM_I_ULLONG_MAX ((unsigned long long) (-1))\n");
}
pf("\n");
pf("/* handling for the deprecated long_long and ulong_long types */\n");
pf("/* If anything suitable is available, it'll be defined here. */\n");
@ -316,16 +303,6 @@ main (int argc, char *argv[])
pf ("typedef %s scm_t_intmax;\n", SCM_I_GSC_T_INTMAX);
pf ("typedef %s scm_t_uintmax;\n", SCM_I_GSC_T_UINTMAX);
pf ("#define SCM_T_INT8_MIN %s_MIN\n", SCM_I_GSC_T_INT8_LIMITS);
pf ("#define SCM_T_INT8_MAX %s_MAX\n", SCM_I_GSC_T_INT8_LIMITS);
pf ("#define SCM_T_UINT8_MAX %s_MAX\n", SCM_I_GSC_T_UINT8_LIMITS);
pf ("#define SCM_T_INT16_MIN %s_MIN\n", SCM_I_GSC_T_INT16_LIMITS);
pf ("#define SCM_T_INT16_MAX %s_MAX\n", SCM_I_GSC_T_INT16_LIMITS);
pf ("#define SCM_T_UINT16_MAX %s_MAX\n", SCM_I_GSC_T_UINT16_LIMITS);
pf ("#define SCM_T_INT32_MIN %s_MIN\n", SCM_I_GSC_T_INT32_LIMITS);
pf ("#define SCM_T_INT32_MAX %s_MAX\n", SCM_I_GSC_T_INT32_LIMITS);
pf ("#define SCM_T_UINT32_MAX %s_MAX\n", SCM_I_GSC_T_UINT32_LIMITS);
pf ("\n");
pf ("/* 64-bit integer -- if available SCM_HAVE_T_INT64 will be 1 and\n"
" scm_t_int64 will be a suitable type, otherwise SCM_HAVE_T_INT64\n"
@ -334,8 +311,6 @@ main (int argc, char *argv[])
{
pf ("#define SCM_HAVE_T_INT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_int64;\n", SCM_I_GSC_T_INT64);
pf ("#define SCM_T_INT64_MIN %s_MIN\n", SCM_I_GSC_T_INT64_LIMITS);
pf ("#define SCM_T_INT64_MAX %s_MAX\n", SCM_I_GSC_T_INT64_LIMITS);
}
else
pf ("#define SCM_HAVE_T_INT64 0 /* 0 or 1 */\n");
@ -348,15 +323,10 @@ main (int argc, char *argv[])
{
pf ("#define SCM_HAVE_T_UINT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_uint64;\n", SCM_I_GSC_T_UINT64);
pf ("#define SCM_T_UINT64_MAX %s_MAX\n", SCM_I_GSC_T_UINT64_LIMITS);
}
else
pf ("#define SCM_HAVE_T_UINT64 0 /* 0 or 1 */\n");
pf ("#define SCM_T_INTMAX_MIN %s_MIN\n", SCM_I_GSC_T_INTMAX_LIMITS);
pf ("#define SCM_T_INTMAX_MAX %s_MAX\n", SCM_I_GSC_T_INTMAX_LIMITS);
pf ("#define SCM_T_UINTMAX_MAX %s_MAX\n", SCM_I_GSC_T_UINTMAX_LIMITS);
pf ("\n");
pf ("/* scm_t_ptrdiff_t and size, always defined -- defined to long if\n"
" platform doesn't have ptrdiff_t. */\n");