[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 15/86: Move number validators to numbers.h.
From: |
Andy Wingo |
Subject: |
[Guile-commits] 15/86: Move number validators to numbers.h. |
Date: |
Wed, 20 Jun 2018 14:09:29 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit d10c3aa3cd2cbe71a9132530613f0ae42121b9db
Author: Andy Wingo <address@hidden>
Date: Sun Jun 17 22:28:13 2018 +0200
Move number validators to numbers.h.
* libguile/validate.h:
* libguile/numbers.h (SCM_NUM2SIZE, SCM_NUM2SIZE_DEF, SCM_NUM2PTRDIFF)
SCM_NUM2PTRDIFF_DEF, SCM_NUM2SHORT, SCM_NUM2SHORT_DEF, SCM_NUM2USHORT)
SCM_NUM2USHORT_DEF, SCM_NUM2INT, SCM_NUM2INT_DEF, SCM_NUM2UINT)
SCM_NUM2UINT_DEF, SCM_NUM2ULONG, SCM_NUM2ULONG_DEF, SCM_NUM2LONG)
SCM_NUM2LONG_DEF, SCM_NUM2LONG_LONG, SCM_NUM2LONG_LONG_DEF)
SCM_NUM2ULONG_LONG, SCM_NUM2ULONG_LONG_DEF, SCM_NUM2FLOAT)
SCM_NUM2DOUBLE): Move these here, from validate.h.
---
libguile/numbers.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
libguile/validate.h | 56 -----------------------------------------------
2 files changed, 62 insertions(+), 56 deletions(-)
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 744ef7f..8a2b386 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -27,6 +27,7 @@
#include <gmp.h>
#include "libguile/__scm.h"
+#include "libguile/error.h"
#include "libguile/print.h"
#ifndef SCM_T_WCHAR_DEFINED
@@ -596,6 +597,67 @@ SCM_API int scm_install_gmp_memory_functions;
SCM_INTERNAL void scm_init_numbers (void);
+
+
+#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
+
+#define SCM_NUM2SIZE_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_size_t (arg))
+
+#define SCM_NUM2PTRDIFF(pos, arg) (scm_to_ssize_t (arg))
+
+#define SCM_NUM2PTRDIFF_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_ssize_t (arg))
+
+#define SCM_NUM2SHORT(pos, arg) (scm_to_short (arg))
+
+#define SCM_NUM2SHORT_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_short (arg))
+
+#define SCM_NUM2USHORT(pos, arg) (scm_to_ushort (arg))
+
+#define SCM_NUM2USHORT_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_ushort (arg))
+
+#define SCM_NUM2INT(pos, arg) (scm_to_int (arg))
+
+#define SCM_NUM2INT_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_int (arg))
+
+#define SCM_NUM2UINT(pos, arg) (scm_to_uint (arg))
+
+#define SCM_NUM2UINT_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_uint (arg))
+
+#define SCM_NUM2ULONG(pos, arg) (scm_to_ulong (arg))
+
+#define SCM_NUM2ULONG_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_ulong (arg))
+
+#define SCM_NUM2LONG(pos, arg) (scm_to_long (arg))
+
+#define SCM_NUM2LONG_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_long (arg))
+
+#define SCM_NUM2LONG_LONG(pos, arg) (scm_to_long_long (arg))
+
+#define SCM_NUM2LONG_LONG_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_long_long (arg))
+
+#define SCM_NUM2ULONG_LONG(pos, arg) (scm_to_ulong_long (arg))
+
+#define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \
+ (SCM_UNBNDP (arg) ? def : scm_to_ulong_long (arg))
+
+#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
+
+#define SCM_NUM2FLOAT(pos, arg) ((float) scm_to_double (arg))
+
+#define SCM_NUM2DOUBLE(pos, arg) (scm_to_double (arg))
+
+
+
+
#endif /* SCM_NUMBERS_H */
/*
diff --git a/libguile/validate.h b/libguile/validate.h
index 964d2f6..dbf10ca 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -31,62 +31,6 @@
-#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
-
-#define SCM_NUM2SIZE_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_size_t (arg))
-
-#define SCM_NUM2PTRDIFF(pos, arg) (scm_to_ssize_t (arg))
-
-#define SCM_NUM2PTRDIFF_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_ssize_t (arg))
-
-#define SCM_NUM2SHORT(pos, arg) (scm_to_short (arg))
-
-#define SCM_NUM2SHORT_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_short (arg))
-
-#define SCM_NUM2USHORT(pos, arg) (scm_to_ushort (arg))
-
-#define SCM_NUM2USHORT_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_ushort (arg))
-
-#define SCM_NUM2INT(pos, arg) (scm_to_int (arg))
-
-#define SCM_NUM2INT_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_int (arg))
-
-#define SCM_NUM2UINT(pos, arg) (scm_to_uint (arg))
-
-#define SCM_NUM2UINT_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_uint (arg))
-
-#define SCM_NUM2ULONG(pos, arg) (scm_to_ulong (arg))
-
-#define SCM_NUM2ULONG_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_ulong (arg))
-
-#define SCM_NUM2LONG(pos, arg) (scm_to_long (arg))
-
-#define SCM_NUM2LONG_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_long (arg))
-
-#define SCM_NUM2LONG_LONG(pos, arg) (scm_to_long_long (arg))
-
-#define SCM_NUM2LONG_LONG_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_long_long (arg))
-
-#define SCM_NUM2ULONG_LONG(pos, arg) (scm_to_ulong_long (arg))
-
-#define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \
- (SCM_UNBNDP (arg) ? def : scm_to_ulong_long (arg))
-
-#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
-
-#define SCM_NUM2FLOAT(pos, arg) ((float) scm_to_double (arg))
-
-#define SCM_NUM2DOUBLE(pos, arg) (scm_to_double (arg))
-
#define SCM_OUT_OF_RANGE(pos, arg) \
do { scm_out_of_range_pos (FUNC_NAME, arg, scm_from_int (pos)); } while (0)
- [Guile-commits] 04/86: Refactor regarding internal detection of ia64, (continued)
- [Guile-commits] 04/86: Refactor regarding internal detection of ia64, Andy Wingo, 2018/06/20
- [Guile-commits] 08/86: Remove _scm.h verify.h inclusion, Andy Wingo, 2018/06/20
- [Guile-commits] 07/86: Remove errno.h include from _scm.h., Andy Wingo, 2018/06/20
- [Guile-commits] 11/86: Require C99 to build Guile, Andy Wingo, 2018/06/20
- [Guile-commits] 01/86: Move syscall-related private defines to their own header, Andy Wingo, 2018/06/20
- [Guile-commits] 19/86: Remove public SCM_VALIDATE_NIM, Andy Wingo, 2018/06/20
- [Guile-commits] 17/86: Remove unused macros, Andy Wingo, 2018/06/20
- [Guile-commits] 10/86: Assume that if we have GCC, we have GCC >= 3.0., Andy Wingo, 2018/06/20
- [Guile-commits] 05/86: Inline definition of SIZEOF_SCM_T_BITS, Andy Wingo, 2018/06/20
- [Guile-commits] 13/86: Remove _scm.h print.h include, Andy Wingo, 2018/06/20
- [Guile-commits] 15/86: Move number validators to numbers.h.,
Andy Wingo <=
- [Guile-commits] 16/86: Move more number validators to numbers.h., Andy Wingo, 2018/06/20
- [Guile-commits] 24/86: Deprecate libguile/validate.h, Andy Wingo, 2018/06/20
- [Guile-commits] 14/86: Move core validate macros to error.h, Andy Wingo, 2018/06/20
- [Guile-commits] 18/86: Move list validators to list.h, Andy Wingo, 2018/06/20
- [Guile-commits] 31/86: Remove gc.h from inline.h, Andy Wingo, 2018/06/20
- [Guile-commits] 32/86: Remove threads.h from inline.h, Andy Wingo, 2018/06/20
- [Guile-commits] 12/86: Remove error.h include from _scm.h., Andy Wingo, 2018/06/20
- [Guile-commits] 20/86: Move pair, null, nil, and boolean validators out of validate.h, Andy Wingo, 2018/06/20
- [Guile-commits] 29/86: Move gsubr.h include to snarf.h, Andy Wingo, 2018/06/20
- [Guile-commits] 33/86: Move array-handle.h include out from inline.h, Andy Wingo, 2018/06/20