[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. */
- [Guile-commits] 46/86: Move symbol snarfers to symbols.h, (continued)
- [Guile-commits] 46/86: Move symbol snarfers to symbols.h, Andy Wingo, 2018/06/20
- [Guile-commits] 41/86: Remove ports.h from inline.h, Andy Wingo, 2018/06/20
- [Guile-commits] 21/86: More validate.h devolution, Andy Wingo, 2018/06/20
- [Guile-commits] 40/86: Remove <unistd.h> from ports.h, Andy Wingo, 2018/06/20
- [Guile-commits] 37/86: Devolve vectors.h include from ports.h, Andy Wingo, 2018/06/20
- [Guile-commits] 38/86: Remove <string.h> include from ports.h., Andy Wingo, 2018/06/20
- [Guile-commits] 42/86: Remove numbers.h from inline.h, Andy Wingo, 2018/06/20
- [Guile-commits] 48/86: Deprecate SCM_STATIC_DOUBLE_CELL snarf macro, Andy Wingo, 2018/06/20
- [Guile-commits] 51/86: Devolve variable snarfers, Andy Wingo, 2018/06/20
- [Guile-commits] 50/86: Devolve keyword-snarfing macros, Andy Wingo, 2018/06/20
- [Guile-commits] 49/86: Move string-related snarfers to strings.h,
Andy Wingo <=
- [Guile-commits] 25/86: Remove list.h from _scm.h, Andy Wingo, 2018/06/20
- [Guile-commits] 26/86: Devolve boolean.h include., Andy Wingo, 2018/06/20
- [Guile-commits] 39/86: Remove <stdio.h> from ports.h, Andy Wingo, 2018/06/20
- [Guile-commits] 55/86: Remove snarf.h from _scm.h, Andy Wingo, 2018/06/20
- [Guile-commits] 52/86: Remove mutex snarfers, Andy Wingo, 2018/06/20
- [Guile-commits] 58/86: Define scm_t_wchar in one place, Andy Wingo, 2018/06/20
- [Guile-commits] 54/86: Simplify SCM_IMMUTABLE_CELL macros, Andy Wingo, 2018/06/20
- [Guile-commits] 27/86: Devolve pairs.h, Andy Wingo, 2018/06/20
- [Guile-commits] 53/86: Devolve smob snarfers, Andy Wingo, 2018/06/20
- [Guile-commits] 57/86: Shuffle around inline C function implementation, Andy Wingo, 2018/06/20