[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 20/86: Move pair, null, nil, and boolean validators out
From: |
Andy Wingo |
Subject: |
[Guile-commits] 20/86: Move pair, null, nil, and boolean validators out of validate.h |
Date: |
Wed, 20 Jun 2018 14:09:30 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit be18b507735ccb6006dcd9a58cba7119b43b7d7c
Author: Andy Wingo <address@hidden>
Date: Sun Jun 17 22:49:59 2018 +0200
Move pair, null, nil, and boolean validators out of validate.h
* libguile/validate.h:
* libguile/boolean.h (SCM_VALIDATE_BOOL, SCM_VALIDATE_BOOL_COPY):
* libguile/pairs.h (SCM_VALIDATE_NULL, SCM_VALIDATE_NULL_OR_NIL):
(SCM_VALIDATE_CONS, SCM_VALIDATE_MUTABLE_PAIR)
(SCM_VALIDATE_NULLORCONS): Move these macros.
---
libguile/boolean.h | 21 ++++++++++++++++++++-
libguile/pairs.h | 38 +++++++++++++++++++++++++++++++-------
libguile/validate.h | 30 ------------------------------
3 files changed, 51 insertions(+), 38 deletions(-)
diff --git a/libguile/boolean.h b/libguile/boolean.h
index df72728..dca9a56 100644
--- a/libguile/boolean.h
+++ b/libguile/boolean.h
@@ -3,7 +3,8 @@
#ifndef SCM_BOOLEAN_H
#define SCM_BOOLEAN_H
-/* Copyright (C) 1995,1996,2000, 2006, 2008, 2009, 2010, 2013 Free Software
Foundation, Inc.
+/* Copyright (C) 1995-1996,2000,2006,2008-2010,2013,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
@@ -122,12 +123,30 @@ SCM_API int scm_to_bool (SCM x);
#define scm_is_lisp_false(x) \
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_BOOL_F, SCM_EOL))
+
SCM_API SCM scm_not (SCM x);
SCM_API SCM scm_boolean_p (SCM obj);
SCM_API SCM scm_nil_p (SCM obj);
+
+
+
+#define SCM_VALIDATE_BOOL(pos, flag) \
+ do { \
+ SCM_ASSERT_TYPE (scm_is_bool (flag), flag, pos, FUNC_NAME, "boolean"); \
+ } while (0)
+
+#define SCM_VALIDATE_BOOL_COPY(pos, flag, cvar) \
+ do { \
+ SCM_ASSERT (scm_is_bool (flag), flag, pos, FUNC_NAME); \
+ cvar = scm_to_bool (flag); \
+ } while (0)
+
+
+
+
SCM_INTERNAL void scm_init_boolean (void);
#endif /* SCM_BOOLEAN_H */
diff --git a/libguile/pairs.h b/libguile/pairs.h
index cc042ea..148f9ad 100644
--- a/libguile/pairs.h
+++ b/libguile/pairs.h
@@ -29,14 +29,8 @@
#include "libguile/error.h"
#include "libguile/gc.h"
-
-#if (SCM_DEBUG_PAIR_ACCESSES == 1)
-# define SCM_VALIDATE_PAIR(cell, expr) \
- ((!scm_is_pair (cell) ? scm_error_pair_access (cell), 0 : 0), (expr))
-#else
-# define SCM_VALIDATE_PAIR(cell, expr) (expr)
-#endif
+
/*
* Use scm_is_null_and_not_nil if it's important (for correctness)
@@ -113,6 +107,36 @@
#define SCM_CADDDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CDR
(OBJ))))
#define SCM_CDDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CDR
(OBJ))))
+
+
+
+#define SCM_VALIDATE_NULL(pos, scm) \
+ SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_null, "empty list")
+
+#define SCM_VALIDATE_NULL_OR_NIL(pos, scm) \
+ SCM_MAKE_VALIDATE_MSG (pos, scm, NULL_OR_NIL_P, "empty list")
+
+#define SCM_VALIDATE_CONS(pos, scm) \
+ SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_pair, "pair")
+
+#if (SCM_DEBUG_PAIR_ACCESSES == 1)
+# define SCM_VALIDATE_PAIR(cell, expr) \
+ ((!scm_is_pair (cell) ? scm_error_pair_access (cell), 0 : 0), (expr))
+#else
+# define SCM_VALIDATE_PAIR(cell, expr) (expr)
+#endif
+
+#ifdef BUILDING_LIBGUILE
+#define SCM_VALIDATE_MUTABLE_PAIR(pos, scm) \
+ SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_mutable_pair, "mutable pair")
+#endif /* BUILDING_LIBGUILE */
+
+#define SCM_VALIDATE_NULLORCONS(pos, env) \
+ do { \
+ SCM_ASSERT (scm_is_null (env) || scm_is_pair (env), env, pos, FUNC_NAME); \
+ } while (0)
+
+
#if (SCM_DEBUG_PAIR_ACCESSES == 1)
diff --git a/libguile/validate.h b/libguile/validate.h
index 386a219..dcbd1ab 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -31,17 +31,6 @@
-#define SCM_VALIDATE_BOOL(pos, flag) \
- do { \
- SCM_ASSERT_TYPE (scm_is_bool (flag), flag, pos, FUNC_NAME, "boolean"); \
- } while (0)
-
-#define SCM_VALIDATE_BOOL_COPY(pos, flag, cvar) \
- do { \
- SCM_ASSERT (scm_is_bool (flag), flag, pos, FUNC_NAME); \
- cvar = scm_to_bool (flag); \
- } while (0)
-
#define SCM_VALIDATE_BYTEVECTOR(_pos, _obj) \
SCM_ASSERT_TYPE (SCM_BYTEVECTOR_P (_obj), (_obj), (_pos), \
FUNC_NAME, "bytevector")
@@ -59,20 +48,6 @@
SCM_ASSERT_TYPE (scm_is_string (str), str, pos, FUNC_NAME, "string"); \
} while (0)
-#define SCM_VALIDATE_NULL(pos, scm) \
- SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_null, "empty list")
-
-#define SCM_VALIDATE_NULL_OR_NIL(pos, scm) \
- SCM_MAKE_VALIDATE_MSG (pos, scm, NULL_OR_NIL_P, "empty list")
-
-#define SCM_VALIDATE_CONS(pos, scm) \
- SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_pair, "pair")
-
-#ifdef BUILDING_LIBGUILE
-#define SCM_VALIDATE_MUTABLE_PAIR(pos, scm) \
- SCM_I_MAKE_VALIDATE_MSG2 (pos, scm, scm_is_mutable_pair, "mutable pair")
-#endif /* BUILDING_LIBGUILE */
-
#define SCM_VALIDATE_ALISTCELL(pos, alist) \
do { \
SCM_ASSERT (scm_is_pair (alist) && scm_is_pair (SCM_CAR (alist)), \
@@ -122,11 +97,6 @@
SCM_ASSERT (scm_is_true (scm_procedure_p (proc)), proc, pos, FUNC_NAME); \
} while (0)
-#define SCM_VALIDATE_NULLORCONS(pos, env) \
- do { \
- SCM_ASSERT (scm_is_null (env) || scm_is_pair (env), env, pos, FUNC_NAME); \
- } while (0)
-
#define SCM_VALIDATE_HOOK(pos, a) SCM_MAKE_VALIDATE_MSG (pos, a, HOOKP, "hook")
#define SCM_VALIDATE_RGXP(pos, a) SCM_MAKE_VALIDATE_MSG (pos, a, RGXP,
"regexp")
- [Guile-commits] 05/86: Inline definition of SIZEOF_SCM_T_BITS, (continued)
- [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, 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 <=
- [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
- [Guile-commits] 36/86: Remove threads.h include from ports.h, Andy Wingo, 2018/06/20
- [Guile-commits] 28/86: Devolve gc.h, Andy Wingo, 2018/06/20
- [Guile-commits] 35/86: Move struct.h include out of ports.h, Andy Wingo, 2018/06/20
- [Guile-commits] 34/86: Remove bytevectors.h include form ports.h, Andy Wingo, 2018/06/20
- [Guile-commits] 43/86: Remove error.h from inline.h, Andy Wingo, 2018/06/20
- [Guile-commits] 45/86: Move scm_tc7_pointer snarfer out to foreign.h, Andy Wingo, 2018/06/20
- [Guile-commits] 46/86: Move symbol snarfers to symbols.h, Andy Wingo, 2018/06/20