summaryrefslogtreecommitdiff
path: root/libguile/boolean.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-06-17 22:49:59 +0200
committerAndy Wingo <wingo@pobox.com>2018-06-17 22:49:59 +0200
commitbe18b507735ccb6006dcd9a58cba7119b43b7d7c (patch)
treee0cb9baae5d60a5d4ead44d1b57c2a66826c1835 /libguile/boolean.h
parenteb5e1b8d5f9cbe2313a04959643b4ee1b0464be8 (diff)
downloadguile-be18b507735ccb6006dcd9a58cba7119b43b7d7c.tar.gz
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.
Diffstat (limited to 'libguile/boolean.h')
-rw-r--r--libguile/boolean.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/libguile/boolean.h b/libguile/boolean.h
index df72728ef..dca9a56bd 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 */