guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 49/86: Move string-related snarfers to strings.h


From: Andy Wingo
Subject: [Guile-commits] 49/86: Move string-related snarfers to strings.h
Date: Wed, 20 Jun 2018 14:09:37 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit 93dcc557610eeb1deb79da6939d2c77779d7f948
Author: Andy Wingo <address@hidden>
Date:   Wed Jun 20 09:22:18 2018 +0200

    Move string-related snarfers to strings.h
    
    * libguile/snarf.h:
    * libguile/strings.h (SCM_IMMUTABLE_STRINGBUF, SCM_IMMUTABLE_STRING):
      Move here.
---
 libguile/snarf.h   | 26 +-------------------------
 libguile/strings.h | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/libguile/snarf.h b/libguile/snarf.h
index 8bafcf5..1dacfd7 100644
--- a/libguile/snarf.h
+++ b/libguile/snarf.h
@@ -195,33 +195,9 @@ SCM_SNARF_INIT(scm_set_smob_apply((tag), (c_name), (req), 
(opt), (rest));)
       { SCM_PACK (ccr), SCM_PACK (cdr) }                               \
     };                                                                 \
   static SCM_UNUSED const SCM c_name = SCM_PACK (& c_name ## _raw_cell)
-
-#define SCM_IMMUTABLE_STRINGBUF(c_name, contents)      \
-  static SCM_UNUSED const                              \
-  struct                                               \
-  {                                                    \
-    scm_t_bits word_0;                                 \
-    scm_t_bits word_1;                                 \
-    const char buffer[sizeof (contents)];              \
-  }                                                    \
-  c_name =                                             \
-    {                                                  \
-      scm_tc7_stringbuf,                                \
-      sizeof (contents) - 1,                           \
-      contents                                         \
-    }
-
-#define SCM_IMMUTABLE_STRING(c_name, contents)                         \
-  SCM_IMMUTABLE_STRINGBUF (scm_i_paste (c_name, _stringbuf), contents);        
\
-  SCM_IMMUTABLE_DOUBLE_CELL (c_name,                                   \
-                            scm_tc7_ro_string,                         \
-                            (scm_t_bits) &scm_i_paste (c_name,         \
-                                                       _stringbuf),    \
-                            (scm_t_bits) 0,                            \
-                             (scm_t_bits) (sizeof (contents) - 1))
-
 #endif /* SCM_SUPPORT_STATIC_ALLOCATION */
 
+
 
 /* Documentation.  */
 
diff --git a/libguile/strings.h b/libguile/strings.h
index 8e97eb5..1a8fbb6 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -26,6 +26,7 @@
 
 #include "libguile/__scm.h"
 #include <libguile/error.h>
+#include <libguile/snarf.h>
 
 
 
@@ -177,6 +178,39 @@ SCM_API SCM scm_string_normalize_nfkc (SCM str);
 SCM_API SCM scm_makfromstrs (int argc, char **argv);
 
 
+
+
+/* Snarfing support.  See snarf.h.  */
+
+#ifdef SCM_SUPPORT_STATIC_ALLOCATION
+#define SCM_IMMUTABLE_STRINGBUF(c_name, contents)      \
+  static SCM_UNUSED const                              \
+  struct                                               \
+  {                                                    \
+    scm_t_bits word_0;                                 \
+    scm_t_bits word_1;                                 \
+    const char buffer[sizeof (contents)];              \
+  }                                                    \
+  c_name =                                             \
+    {                                                  \
+      scm_tc7_stringbuf,                                \
+      sizeof (contents) - 1,                           \
+      contents                                         \
+    }
+
+#define SCM_IMMUTABLE_STRING(c_name, contents)                         \
+  SCM_IMMUTABLE_STRINGBUF (scm_i_paste (c_name, _stringbuf), contents);        
\
+  SCM_IMMUTABLE_DOUBLE_CELL (c_name,                                   \
+                            scm_tc7_ro_string,                         \
+                            (scm_t_bits) &scm_i_paste (c_name,         \
+                                                       _stringbuf),    \
+                            (scm_t_bits) 0,                            \
+                             (scm_t_bits) (sizeof (contents) - 1))
+
+#endif /* SCM_SUPPORT_STATIC_ALLOCATION */
+
+
+
 /* internal constants */
 
 /* Type tag for read-only strings.  */



reply via email to

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