/* SCM_API is a macro prepended to all function and data definitions
which should be exported from libguile. */
-#if BUILDING_LIBGUILE && HAVE_VISIBILITY
+#if defined BUILDING_LIBGUILE && defined HAVE_VISIBILITY
# define SCM_API extern __attribute__((__visibility__("default")))
-#elif BUILDING_LIBGUILE && defined _MSC_VER
+#elif defined BUILDING_LIBGUILE && defined _MSC_VER
# define SCM_API __declspec(dllexport) extern
#elif defined _MSC_VER
# define SCM_API __declspec(dllimport) extern
return n;
#else
-#if TYPE_MIN == 0
- if (n <= TYPE_MAX)
- return n;
-#else /* TYPE_MIN != 0 */
if (n >= TYPE_MIN && n <= TYPE_MAX)
return n;
-#endif /* TYPE_MIN != 0 */
else
goto out_of_range;
mpz_export (&n, &count, 1, sizeof (TYPE), 0, 0, SCM_I_BIG_MPZ (val));
-#if TYPE_MIN == 0
- if (n <= TYPE_MAX)
- return n;
-#else /* TYPE_MIN != 0 */
if (n >= TYPE_MIN && n <= TYPE_MAX)
return n;
-#endif /* TYPE_MIN != 0 */
else
goto out_of_range;
gnulib ftruncate.c has code using fcntl F_CHSIZE and F_FREESP, which
might be possibilities if we've got other systems without ftruncate. */
-#if HAVE_CHSIZE && ! HAVE_FTRUNCATE
+#if defined HAVE_CHSIZE && ! defined HAVE_FTRUNCATE
# define ftruncate(fd, size) chsize (fd, size)
-#undef HAVE_FTRUNCATE
-#define HAVE_FTRUNCATE 1
+# undef HAVE_FTRUNCATE
+# define HAVE_FTRUNCATE 1
#endif
#if SIZEOF_OFF_T == SIZEOF_INT
#ifdef STDC_HEADERS
pf ("#define SCM_HAVE_STDC_HEADERS 1 /* 0 or 1 */\n");
pf ("#include <stdlib.h>\n");
-# if HAVE_SYS_TYPES_H
+# ifdef HAVE_SYS_TYPES_H
pf ("#include <sys/types.h>\n");
# endif
-# if HAVE_SYS_STDTYPES_H
+# ifdef HAVE_SYS_STDTYPES_H
pf ("#include <sys/stdtypes.h>\n");
# endif
pf ("#include <stddef.h>\n");
else
pf ("/* #undef SCM_HAVE_THREAD_STORAGE_CLASS */\n");
-#if USE_DLL_IMPORT
+#ifdef USE_DLL_IMPORT
pf ("\n");
pf ("/* Define some additional CPP macros on Win32 platforms. */\n");
pf ("# define __REGEX_IMPORT__ 1\n");
before trying to use it. (But in practice we believe this is not a
problem on any system guile is likely to target.) */
guile_Inf = INFINITY;
-#elif HAVE_DINFINITY
+#elif defined HAVE_DINFINITY
/* OSF */
extern unsigned int DINFINITY[2];
guile_Inf = (*((double *) (DINFINITY)));
#ifdef NAN
/* C99 NAN, when available */
guile_NaN = NAN;
-#elif HAVE_DQNAN
+#elif defined HAVE_DQNAN
{
/* OSF */
extern unsigned int DQNAN[2];
gnulib ftruncate.c has code using fcntl F_CHSIZE and F_FREESP, which
might be possibilities if we've got other systems without ftruncate. */
-#if HAVE_CHSIZE && ! HAVE_FTRUNCATE
+#if defined HAVE_CHSIZE && ! defined HAVE_FTRUNCATE
#define ftruncate(fd, size) chsize (fd, size)
#undef HAVE_FTRUNCATE
#define HAVE_FTRUNCATE 1
struct linger opt_linger;
#endif
-#if HAVE_STRUCT_IP_MREQ
+#ifdef HAVE_STRUCT_IP_MREQ
struct ip_mreq opt_mreq;
#endif
}
}
-#if HAVE_STRUCT_IP_MREQ
+#ifdef HAVE_STRUCT_IP_MREQ
if (ilevel == IPPROTO_IP &&
(ioptname == IP_ADD_MEMBERSHIP || ioptname == IP_DROP_MEMBERSHIP))
{
*args = SCM_CDR (*args);
soka = (struct sockaddr_in *) scm_malloc (sizeof (struct sockaddr_in));
-#if HAVE_STRUCT_SOCKADDR_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_SIN_LEN
soka->sin_len = sizeof (struct sockaddr_in);
#endif
soka->sin_family = AF_INET;
}
soka = (struct sockaddr_in6 *) scm_malloc (sizeof (struct sockaddr_in6));
-#if HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
soka->sin6_len = sizeof (struct sockaddr_in6);
#endif
soka->sin6_family = AF_INET6;
} \
while (0)
-#if SCM_STRING_LENGTH_HISTOGRAM
+#ifdef SCM_STRING_LENGTH_HISTOGRAM
static size_t lenhist[1001];
#endif
SCM buf;
-#if SCM_STRING_LENGTH_HISTOGRAM
+#ifdef SCM_STRING_LENGTH_HISTOGRAM
if (len < 1000)
lenhist[len]++;
else
SCM buf;
size_t raw_len;
-#if SCM_STRING_LENGTH_HISTOGRAM
+#ifdef SCM_STRING_LENGTH_HISTOGRAM
if (len < 1000)
lenhist[len]++;
else
}
#undef FUNC_NAME
-#if SCM_STRING_LENGTH_HISTOGRAM
+#ifdef SCM_STRING_LENGTH_HISTOGRAM
SCM_DEFINE (scm_sys_stringbuf_hist, "%stringbuf-hist", 0, 0, 0, (void), "")
#define FUNC_NAME s_scm_sys_stringbuf_hist
if (wide == 0)
{
+ char *buf;
+
result = scm_i_make_string (len, NULL);
result = scm_i_string_start_writing (result);
- char *buf = scm_i_string_writable_chars (result);
+ buf = scm_i_string_writable_chars (result);
while (len > 0 && scm_is_pair (rest))
{
SCM elt = SCM_CAR (rest);
}
else
{
+ scm_t_wchar *buf;
+
result = scm_i_make_wide_string (len, NULL);
result = scm_i_string_start_writing (result);
- scm_t_wchar *buf = scm_i_string_writable_wide_chars (result);
+ buf = scm_i_string_writable_wide_chars (result);
while (len > 0 && scm_is_pair (rest))
{
SCM elt = SCM_CAR (rest);
SCM_API SCM scm_sys_string_dump (SCM);
SCM_API SCM scm_sys_symbol_dump (SCM);
-#if SCM_STRING_LENGTH_HISTOGRAM
+#ifdef SCM_STRING_LENGTH_HISTOGRAM
SCM_API SCM scm_sys_stringbuf_hist (void);
#endif
/* picks up scmconfig.h too */
#include "libguile/__scm.h"
-#if HAVE_INTTYPES_H
+/* FIXME: We shouldn't rely on `HAVE_*' macros here since it's a public
+ header. */
+
+#ifdef HAVE_INTTYPES_H
# include <inttypes.h> /* for INTPTR_MAX and friends */
#else
-# if HAVE_STDINT_H
+# ifdef HAVE_STDINT_H
# include <stdint.h> /* for INTPTR_MAX and friends */
# endif
#endif
}
}
-#elif HAVE_PTHREAD_GET_STACKADDR_NP
+#elif defined HAVE_PTHREAD_GET_STACKADDR_NP
/* This method for MacOS X.
It'd be nice if there was some documentation on pthread_get_stackaddr_np,
but as of 2006 there's nothing obvious at apple.com. */
err_msg = scm_from_locale_string ("VM: Bad wide string length: ~S");
goto vm_error;
-#if VM_CHECK_IP
+#ifdef VM_CHECK_IP
vm_error_invalid_address:
err_msg = scm_from_locale_string ("VM: Invalid program address");
finish_args = SCM_EOL;
before trying to use it. (But in practice we believe this is not a
problem on any system guile is likely to target.) */
guile_Inf = INFINITY;
-#elif HAVE_DINFINITY
+#elif defined HAVE_DINFINITY
/* OSF */
extern unsigned int DINFINITY[2];
guile_Inf = (*((double *) (DINFINITY)));
#ifdef NAN
/* C99 NAN, when available */
guile_NaN = NAN;
-#elif HAVE_DQNAN
+#elif defined HAVE_DQNAN
{
/* OSF */
extern unsigned int DQNAN[2];