guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 21/86: More validate.h devolution


From: Andy Wingo
Subject: [Guile-commits] 21/86: More validate.h devolution
Date: Wed, 20 Jun 2018 14:09:32 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit 8a6f46ee96e0946e539e3a33c95c3228b63e9fb3
Author: Andy Wingo <address@hidden>
Date:   Mon Jun 18 09:44:35 2018 +0200

    More validate.h devolution
    
    * libguile/validate.h:
    * libguile/alist.h (SCM_VALIDATE_ALISTCELL, SCM_VALIDATE_ALISTCELL_COPYSCM)
    * libguile/bytevectors.h (SCM_VALIDATE_BYTEVECTOR)
    * libguile/chars.h (SCM_VALIDATE_CHAR, SCM_VALIDATE_CHAR_COPY):
    * libguile/print.h (SCM_VALIDATE_OPORT_VALUE, SCM_VALIDATE_PRINTSTATE):
    * libguile/procs.h (SCM_VALIDATE_THUNK)
    * libguile/smob.h (SCM_VALIDATE_SMOB)
    * libguile/strings.h (SCM_VALIDATE_STRING): Devolve these macros from
      validate.h.
---
 libguile/alist.h       | 22 +++++++++++++++++++++-
 libguile/bytevectors.h |  5 +++++
 libguile/chars.h       | 12 +++++++++++-
 libguile/print.h       | 14 ++++++++++++--
 libguile/procs.h       |  8 +++++++-
 libguile/smob.h        | 11 +++++++++--
 libguile/strings.h     | 14 ++++++++++++--
 libguile/validate.h    | 48 ------------------------------------------------
 8 files changed, 77 insertions(+), 57 deletions(-)

diff --git a/libguile/alist.h b/libguile/alist.h
index 77c5656..2462452 100644
--- a/libguile/alist.h
+++ b/libguile/alist.h
@@ -3,7 +3,8 @@
 #ifndef SCM_ALIST_H
 #define SCM_ALIST_H
 
-/* Copyright (C) 1995,1996,2000, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1996,2000,2006,2008,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
@@ -24,6 +25,25 @@
 
 
 #include "libguile/__scm.h"
+#include <libguile/error.h>
+#include "libguile/pairs.h"
+
+
+
+
+#define SCM_VALIDATE_ALISTCELL(pos, alist) \
+  do { \
+    SCM_ASSERT (scm_is_pair (alist) && scm_is_pair (SCM_CAR (alist)), \
+                alist, pos, FUNC_NAME); \
+  } while (0)
+
+#define SCM_VALIDATE_ALISTCELL_COPYSCM(pos, alist, cvar) \
+  do { \
+    SCM_ASSERT (scm_is_pair (alist), alist, pos, FUNC_NAME); \
+    cvar = SCM_CAR (alist); \
+    SCM_ASSERT (scm_is_pair (cvar), alist, pos, FUNC_NAME); \
+  } while (0)
+
 
 
 
diff --git a/libguile/bytevectors.h b/libguile/bytevectors.h
index c3d6c69..33e46e2 100644
--- a/libguile/bytevectors.h
+++ b/libguile/bytevectors.h
@@ -22,6 +22,7 @@
 
 
 #include "libguile/__scm.h"
+#include <libguile/error.h>
 #include "libguile/uniform.h"
 
 
@@ -146,6 +147,10 @@ SCM_API SCM scm_utf32_to_string (SCM, SCM);
 /* Hint that is passed to `scm_gc_malloc ()' and friends.  */
 #define SCM_GC_BYTEVECTOR "bytevector"
 
+#define SCM_VALIDATE_BYTEVECTOR(_pos, _obj)                    \
+  SCM_ASSERT_TYPE (SCM_BYTEVECTOR_P (_obj), (_obj), (_pos),    \
+                  FUNC_NAME, "bytevector")
+
 SCM_INTERNAL SCM scm_i_make_typed_bytevector (size_t, 
scm_t_array_element_type);
 SCM_INTERNAL SCM scm_c_take_typed_bytevector (signed char *, size_t,
                                               scm_t_array_element_type, SCM);
diff --git a/libguile/chars.h b/libguile/chars.h
index 488dd25..26ba7ac 100644
--- a/libguile/chars.h
+++ b/libguile/chars.h
@@ -3,7 +3,8 @@
 #ifndef SCM_CHARS_H
 #define SCM_CHARS_H
 
-/* Copyright (C) 1995,1996,2000,2001,2004, 2006, 2008, 2009 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995-1996,2000-2001,2004,2006,2008-2009,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
@@ -24,6 +25,7 @@
 
 
 #include "libguile/__scm.h"
+#include <libguile/error.h>
 
 #ifndef SCM_T_WCHAR_DEFINED
 typedef scm_t_int32 scm_t_wchar;
@@ -57,6 +59,14 @@ typedef scm_t_int32 scm_t_wchar;
    || ((scm_t_wchar) (c) > SCM_CODEPOINT_SURROGATE_END                  \
        && (scm_t_wchar) (c) <= SCM_CODEPOINT_MAX))
 
+#define SCM_VALIDATE_CHAR(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, CHARP, 
"character")
+
+#define SCM_VALIDATE_CHAR_COPY(pos, scm, cvar) \
+  do { \
+    SCM_ASSERT (SCM_CHARP (scm), scm, pos, FUNC_NAME); \
+    cvar = SCM_CHAR (scm); \
+  } while (0)
+
 
 
 SCM_API SCM scm_char_p (SCM x);
diff --git a/libguile/print.h b/libguile/print.h
index 2cfc392..9271c92 100644
--- a/libguile/print.h
+++ b/libguile/print.h
@@ -3,8 +3,8 @@
 #ifndef SCM_PRINT_H
 #define SCM_PRINT_H
 
-/* Copyright (C) 1995, 1996, 1998, 2000, 2001, 2003, 2004, 2006, 2008,
- *   2010, 2012, 2017 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1996,1998,2000-2001,2003-2004,2006,2008,
+ *   2010,2012,2017-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
@@ -27,7 +27,9 @@
 #include "libguile/__scm.h"
 
 #include "libguile/chars.h" 
+#include <libguile/error.h>
 #include "libguile/options.h"
+
 
 
 /* State information passed around during printing.
@@ -53,6 +55,14 @@ do { \
 #define SCM_COERCE_OUTPORT(p) \
   (SCM_PORT_WITH_PS_P (p) ? SCM_PORT_WITH_PS_PORT (p) : p)
 
+#define SCM_VALIDATE_OPORT_VALUE(pos, port) \
+  do { \
+    SCM_ASSERT (scm_valid_oport_value_p (port), port, pos, FUNC_NAME); \
+  } while (0)
+
+#define SCM_VALIDATE_PRINTSTATE(pos, a) \
+  SCM_MAKE_VALIDATE_MSG(pos, a, PRINT_STATE_P, "print-state")
+
 #define SCM_PRINT_STATE_LAYOUT "pwuwuwuwuwuwpwuwuwuwpwpw"
 typedef struct scm_print_state {
   SCM handle;                  /* Struct handle */
diff --git a/libguile/procs.h b/libguile/procs.h
index c4c78f2..51ae441 100644
--- a/libguile/procs.h
+++ b/libguile/procs.h
@@ -4,7 +4,7 @@
 #define SCM_PROCS_H
 
 /* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2006, 2008, 2009,
- *   2012, 2013 Free Software Foundation, Inc.
+ *   2012, 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
@@ -25,9 +25,15 @@
 
 
 #include "libguile/__scm.h"
+#include <libguile/error.h>
 
 
 
+#define SCM_VALIDATE_THUNK(pos, thunk) \
+  do { \
+    SCM_ASSERT (scm_is_true (scm_thunk_p (thunk)), thunk, pos, FUNC_NAME); \
+  } while (0)
+
 SCM_API SCM scm_procedure_p (SCM obj);
 SCM_API SCM scm_thunk_p (SCM obj);
 SCM_API SCM scm_procedure_with_setter_p (SCM obj);
diff --git a/libguile/smob.h b/libguile/smob.h
index 561a6d1..e10db4f 100644
--- a/libguile/smob.h
+++ b/libguile/smob.h
@@ -3,8 +3,8 @@
 #ifndef SCM_SMOB_H
 #define SCM_SMOB_H
 
-/* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2006, 2009,
- *   2010, 2011, 2012, 2015 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1996,1998-2001,2004,2006,2009-2012,2015,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
@@ -25,6 +25,7 @@
 
 
 #include "libguile/__scm.h"
+#include <libguile/error.h>
 #include "libguile/print.h"
 
 
@@ -54,6 +55,12 @@ typedef struct scm_smob_descriptor
 #define SCM_SMOB_DESCRIPTOR(x)         (scm_smobs[SCM_SMOBNUM (x)])
 #define SCM_SMOB_APPLICABLE_P(x)       (SCM_SMOB_DESCRIPTOR (x).apply)
 
+#define SCM_VALIDATE_SMOB(pos, obj, type) \
+  do { \
+    SCM_ASSERT (SCM_SMOB_PREDICATE (scm_tc16_ ## type, obj), \
+                obj, pos, FUNC_NAME); \
+  } while (0)
+
 /* Maximum number of SMOB types.  */
 #define SCM_I_MAX_SMOB_TYPE_COUNT  256
 
diff --git a/libguile/strings.h b/libguile/strings.h
index 5b3e780..8e97eb5 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -3,8 +3,8 @@
 #ifndef SCM_STRINGS_H
 #define SCM_STRINGS_H
 
-/* Copyright (C) 1995-1998, 2000, 2001, 2004-2006, 2008-2011, 2013,
- *   2015-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2000-2001,2004-2006,2008-2011,2013,
+ *   2015-2016,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
@@ -25,6 +25,7 @@
 
 
 #include "libguile/__scm.h"
+#include <libguile/error.h>
 
 
 
@@ -247,6 +248,15 @@ SCM_API SCM scm_sys_stringbuf_hist (void);
 #endif
 
 
+
+
+#define SCM_VALIDATE_STRING(pos, str) \
+  do { \
+    SCM_ASSERT_TYPE (scm_is_string (str), str, pos, FUNC_NAME, "string"); \
+  } while (0)
+
+
+
 
 SCM_INTERNAL void scm_init_strings (void);
 
diff --git a/libguile/validate.h b/libguile/validate.h
index dcbd1ab..66aa38b 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -31,54 +31,6 @@
 
 
 
-#define SCM_VALIDATE_BYTEVECTOR(_pos, _obj)                    \
-  SCM_ASSERT_TYPE (SCM_BYTEVECTOR_P (_obj), (_obj), (_pos),    \
-                  FUNC_NAME, "bytevector")
-
-#define SCM_VALIDATE_CHAR(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, CHARP, 
"character")
-
-#define SCM_VALIDATE_CHAR_COPY(pos, scm, cvar) \
-  do { \
-    SCM_ASSERT (SCM_CHARP (scm), scm, pos, FUNC_NAME); \
-    cvar = SCM_CHAR (scm); \
-  } while (0)
-
-#define SCM_VALIDATE_STRING(pos, str) \
-  do { \
-    SCM_ASSERT_TYPE (scm_is_string (str), str, pos, FUNC_NAME, "string"); \
-  } while (0)
-
-#define SCM_VALIDATE_ALISTCELL(pos, alist) \
-  do { \
-    SCM_ASSERT (scm_is_pair (alist) && scm_is_pair (SCM_CAR (alist)), \
-                alist, pos, FUNC_NAME); \
-  } while (0)
-
-#define SCM_VALIDATE_ALISTCELL_COPYSCM(pos, alist, cvar) \
-  do { \
-    SCM_ASSERT (scm_is_pair (alist), alist, pos, FUNC_NAME); \
-    cvar = SCM_CAR (alist); \
-    SCM_ASSERT (scm_is_pair (cvar), alist, pos, FUNC_NAME); \
-  } while (0)
-
-#define SCM_VALIDATE_OPORT_VALUE(pos, port) \
-  do { \
-    SCM_ASSERT (scm_valid_oport_value_p (port), port, pos, FUNC_NAME); \
-  } while (0)
-
-#define SCM_VALIDATE_PRINTSTATE(pos, a) SCM_MAKE_VALIDATE_MSG(pos, a, 
PRINT_STATE_P, "print-state")
-
-#define SCM_VALIDATE_SMOB(pos, obj, type) \
-  do { \
-    SCM_ASSERT (SCM_SMOB_PREDICATE (scm_tc16_ ## type, obj), \
-                obj, pos, FUNC_NAME); \
-  } while (0)
-
-#define SCM_VALIDATE_THUNK(pos, thunk) \
-  do { \
-    SCM_ASSERT (scm_is_true (scm_thunk_p (thunk)), thunk, pos, FUNC_NAME); \
-  } while (0)
-
 #define SCM_VALIDATE_SYMBOL(pos, str) \
   do { \
     SCM_ASSERT_TYPE (scm_is_symbol (str), str, pos, FUNC_NAME, "symbol"); \



reply via email to

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