[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 16/86: Move more number validators to numbers.h.
From: |
Andy Wingo |
Subject: |
[Guile-commits] 16/86: Move more 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 bdd66fdd2487342f30b82025948746035f2d3653
Author: Andy Wingo <address@hidden>
Date: Sun Jun 17 22:32:08 2018 +0200
Move more number validators to numbers.h.
* libguile/validate.h:
* libguile/numbers.h (SCM_OUT_OF_RANGE, SCM_ASSERT_RANGE)
SCM_VALIDATE_REAL, SCM_VALIDATE_NUMBER, SCM_VALIDATE_USHORT_COPY)
SCM_VALIDATE_SHORT_COPY, SCM_VALIDATE_UINT_COPY)
SCM_VALIDATE_INT_COPY, SCM_VALIDATE_ULONG_COPY)
SCM_VALIDATE_LONG_COPY, SCM_VALIDATE_SIZE_COPY)
SCM_VALIDATE_FLOAT_COPY, SCM_VALIDATE_DOUBLE_COPY)
SCM_VALIDATE_DOUBLE_DEF_COPY): Move here, from validate.h.
---
libguile/numbers.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
libguile/validate.h | 74 ++---------------------------------------------------
2 files changed, 72 insertions(+), 72 deletions(-)
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 8a2b386..b4b77f8 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -655,6 +655,76 @@ SCM_INTERNAL void scm_init_numbers (void);
#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)
+
+#define SCM_ASSERT_RANGE(pos, arg, f) \
+ do { if (SCM_UNLIKELY (!(f))) \
+ scm_out_of_range_pos (FUNC_NAME, arg, scm_from_int (pos)); } \
+ while (0)
+
+#define SCM_VALIDATE_REAL(pos, z) SCM_MAKE_VALIDATE_MSG (pos, z, REALP, "real")
+
+#define SCM_VALIDATE_NUMBER(pos, z) SCM_MAKE_VALIDATE_MSG (pos, z, NUMBERP,
"number")
+
+#define SCM_VALIDATE_USHORT_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2USHORT (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_SHORT_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2SHORT (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_UINT_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2UINT (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_INT_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2INT (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_ULONG_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2ULONG (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_LONG_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2LONG (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_SIZE_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2SIZE (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_FLOAT_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2FLOAT (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_DOUBLE_COPY(pos, k, cvar) \
+ do { \
+ cvar = SCM_NUM2DOUBLE (pos, k); \
+ } while (0)
+
+#define SCM_VALIDATE_DOUBLE_DEF_COPY(pos, k, default, cvar) \
+ do { \
+ if (SCM_UNBNDP (k)) \
+ { \
+ k = scm_make_real (default); \
+ cvar = default; \
+ } \
+ else \
+ { \
+ cvar = SCM_NUM2DOUBLE (pos, k); \
+ } \
+ } while (0)
+
diff --git a/libguile/validate.h b/libguile/validate.h
index dbf10ca..e8416ad 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -3,8 +3,8 @@
#ifndef SCM_VALIDATE_H
#define SCM_VALIDATE_H
-/* Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006, 2007, 2009,
- * 2011, 2012, 2013, 2014, 2018 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2002,2004,2006-2007,2009,2011-2014,2018
+ * Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -31,14 +31,6 @@
-#define SCM_OUT_OF_RANGE(pos, arg) \
- do { scm_out_of_range_pos (FUNC_NAME, arg, scm_from_int (pos)); } while (0)
-
-#define SCM_ASSERT_RANGE(pos, arg, f) \
- do { if (SCM_UNLIKELY (!(f))) \
- scm_out_of_range_pos (FUNC_NAME, arg, scm_from_int (pos)); } \
- while (0)
-
#define SCM_MUST_MALLOC_TYPE(type) \
((type *) scm_must_malloc (sizeof (type), FUNC_NAME))
@@ -89,68 +81,6 @@
SCM_ASSERT_TYPE (scm_is_string (str), str, pos, FUNC_NAME, "string"); \
} while (0)
-#define SCM_VALIDATE_REAL(pos, z) SCM_MAKE_VALIDATE_MSG (pos, z, REALP, "real")
-
-#define SCM_VALIDATE_NUMBER(pos, z) SCM_MAKE_VALIDATE_MSG (pos, z, NUMBERP,
"number")
-
-#define SCM_VALIDATE_USHORT_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2USHORT (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_SHORT_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2SHORT (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_UINT_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2UINT (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_INT_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2INT (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_ULONG_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2ULONG (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_LONG_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2LONG (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_SIZE_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2SIZE (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_FLOAT_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2FLOAT (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_DOUBLE_COPY(pos, k, cvar) \
- do { \
- cvar = SCM_NUM2DOUBLE (pos, k); \
- } while (0)
-
-#define SCM_VALIDATE_DOUBLE_DEF_COPY(pos, k, default, cvar) \
- do { \
- if (SCM_UNBNDP (k)) \
- { \
- k = scm_make_real (default); \
- cvar = default; \
- } \
- else \
- { \
- cvar = SCM_NUM2DOUBLE (pos, k); \
- } \
- } while (0)
-
#define SCM_VALIDATE_NULL(pos, scm) \
SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_null, "empty list")
- [Guile-commits] 08/86: Remove _scm.h verify.h inclusion, (continued)
- [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, 2018/06/20
- [Guile-commits] 16/86: Move more number validators to numbers.h.,
Andy Wingo <=
- [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
- [Guile-commits] 30/86: Devolve procs.h include from _scm.h., Andy Wingo, 2018/06/20