guile-commits
[Top][All Lists]
Advanced

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



reply via email to

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