[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 14/86: Move core validate macros to error.h
From: |
Andy Wingo |
Subject: |
[Guile-commits] 14/86: Move core validate macros to error.h |
Date: |
Wed, 20 Jun 2018 14:09:29 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 87896eb3e69fc976bc9820bc216a766643a6db3d
Author: Andy Wingo <address@hidden>
Date: Sun Jun 17 22:24:12 2018 +0200
Move core validate macros to error.h
* libguile/error.h (SCM_MAKE_VALIDATE, (SCM_I_MAKE_VALIDATE_MSG2)
(SCM_MAKE_VALIDATE_MSG, SCM_SYSERROR, SCM_MEMORY_ERROR)
(SCM_SYSERROR_MSG, SCM_MISC_ERROR, SCM_WRONG_NUM_ARGS)
(SCM_WRONG_TYPE_ARG): Move here, from validate.h.
* libguile/validate.h: Include error.h.
---
libguile/error.h | 35 ++++++++++++++++++++++++++++++++++-
libguile/validate.h | 30 +++---------------------------
2 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/libguile/error.h b/libguile/error.h
index 6985dbc..81b7a58 100644
--- a/libguile/error.h
+++ b/libguile/error.h
@@ -3,7 +3,8 @@
#ifndef SCM_ERROR_H
#define SCM_ERROR_H
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2006, 2008, 2011, 2014
Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2000-2002,2006,2008,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
@@ -70,6 +71,38 @@ SCM_API void scm_misc_error (const char *subr, const char
*message,
SCM args) SCM_NORETURN;
SCM_INTERNAL void scm_init_error (void);
+
+
+#define SCM_MAKE_VALIDATE(pos, var, pred) \
+ do { \
+ SCM_ASSERT_TYPE (SCM_ ## pred (var), var, pos, FUNC_NAME, #pred); \
+ } while (0)
+
+#define SCM_I_MAKE_VALIDATE_MSG2(pos, var, pred, msg) \
+ do { \
+ SCM_ASSERT_TYPE (pred (var), var, pos, FUNC_NAME, msg); \
+ } while (0)
+
+#define SCM_MAKE_VALIDATE_MSG(pos, var, pred, msg) \
+ SCM_I_MAKE_VALIDATE_MSG2 (pos, var, SCM_ ## pred, msg)
+
+#define SCM_SYSERROR do { scm_syserror (FUNC_NAME); } while (0)
+
+#define SCM_MEMORY_ERROR do { scm_memory_error (FUNC_NAME); } while (0)
+
+#define SCM_SYSERROR_MSG(str, args, val) \
+ do { scm_syserror_msg (FUNC_NAME, (str), (args), (val)); } while (0)
+
+#define SCM_MISC_ERROR(str, args) \
+ do { scm_misc_error (FUNC_NAME, str, args); } while (0)
+
+#define SCM_WRONG_NUM_ARGS() \
+ do { scm_error_num_args_subr (FUNC_NAME); } while (0)
+
+#define SCM_WRONG_TYPE_ARG(pos, obj) \
+ do { scm_wrong_type_arg (FUNC_NAME, pos, obj); } while (0)
+
+
#endif /* SCM_ERROR_H */
/*
diff --git a/libguile/validate.h b/libguile/validate.h
index a1b1b55..964d2f6 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -4,7 +4,7 @@
#define SCM_VALIDATE_H
/* Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006, 2007, 2009,
- * 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+ * 2011, 2012, 2013, 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
@@ -26,21 +26,10 @@
-#define SCM_SYSERROR do { scm_syserror (FUNC_NAME); } while (0)
+#include <libguile/error.h>
-#define SCM_MEMORY_ERROR do { scm_memory_error (FUNC_NAME); } while (0)
-#define SCM_SYSERROR_MSG(str, args, val) \
- do { scm_syserror_msg (FUNC_NAME, (str), (args), (val)); } while (0)
-
-#define SCM_MISC_ERROR(str, args) \
- do { scm_misc_error (FUNC_NAME, str, args); } while (0)
-
-#define SCM_WRONG_NUM_ARGS() \
- do { scm_error_num_args_subr (FUNC_NAME); } while (0)
-
-#define SCM_WRONG_TYPE_ARG(pos, obj) \
- do { scm_wrong_type_arg (FUNC_NAME, pos, obj); } while (0)
+
#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
@@ -114,19 +103,6 @@
#define SCM_MUST_MALLOC(size) (scm_must_malloc ((size), FUNC_NAME))
-#define SCM_MAKE_VALIDATE(pos, var, pred) \
- do { \
- SCM_ASSERT_TYPE (SCM_ ## pred (var), var, pos, FUNC_NAME, #pred); \
- } while (0)
-
-#define SCM_I_MAKE_VALIDATE_MSG2(pos, var, pred, msg) \
- do { \
- SCM_ASSERT_TYPE (pred (var), var, pos, FUNC_NAME, msg); \
- } while (0)
-
-#define SCM_MAKE_VALIDATE_MSG(pos, var, pred, msg) \
- SCM_I_MAKE_VALIDATE_MSG2 (pos, var, SCM_ ## pred, msg)
-
- [Guile-commits] 11/86: Require C99 to build Guile, (continued)
- [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, 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 <=
- [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
- [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