guile-commits
[Top][All Lists]
Advanced

[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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]