1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Move symbol snarfers to symbols.h

* libguile/snarf.h:
* libguile/symbols.h (SCM_SYMBOL, SCM_GLOBAL_SYMBOL): Move here.
This commit is contained in:
Andy Wingo 2018-06-20 08:42:33 +02:00
parent cedab6e285
commit c376e99ff9
2 changed files with 34 additions and 31 deletions

View file

@ -152,36 +152,6 @@ scm_c_define_gsubr_with_generic (RANAME, REQ, OPT, VAR, \
(SCM_FUNC_CAST_ARBITRARY_ARGS) CFN, &GF) \ (SCM_FUNC_CAST_ARBITRARY_ARGS) CFN, &GF) \
) )
#ifdef SCM_SUPPORT_STATIC_ALLOCATION
# define SCM_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE( \
SCM_IMMUTABLE_STRING (scm_i_paste (c_name, _string), scheme_name); \
static SCM c_name) \
SCM_SNARF_INIT( \
c_name = scm_string_to_symbol (scm_i_paste (c_name, _string)) \
)
# define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE( \
SCM_IMMUTABLE_STRING (scm_i_paste (c_name, _string), scheme_name); \
SCM c_name) \
SCM_SNARF_INIT( \
c_name = scm_string_to_symbol (scm_i_paste (c_name, _string)) \
)
#else /* !SCM_SUPPORT_STATIC_ALLOCATION */
# define SCM_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE(static SCM c_name) \
SCM_SNARF_INIT(c_name = scm_from_utf8_symbol (scheme_name))
# define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE(SCM c_name) \
SCM_SNARF_INIT(c_name = scm_from_utf8_symbol (scheme_name))
#endif /* !SCM_SUPPORT_STATIC_ALLOCATION */
#define SCM_KEYWORD(c_name, scheme_name) \ #define SCM_KEYWORD(c_name, scheme_name) \
SCM_SNARF_HERE(static SCM c_name) \ SCM_SNARF_HERE(static SCM c_name) \
SCM_SNARF_INIT(c_name = scm_from_locale_keyword (scheme_name)) SCM_SNARF_INIT(c_name = scm_from_locale_keyword (scheme_name))

View file

@ -26,8 +26,8 @@
#include "libguile/__scm.h" #include "libguile/__scm.h"
#include <libguile/error.h> #include <libguile/error.h>
#include <libguile/gc.h> #include <libguile/gc.h>
#include <libguile/snarf.h>
@ -44,6 +44,39 @@
SCM_ASSERT_TYPE (scm_is_symbol (str), str, pos, FUNC_NAME, "symbol"); \ SCM_ASSERT_TYPE (scm_is_symbol (str), str, pos, FUNC_NAME, "symbol"); \
} while (0) } while (0)
#ifdef SCM_SUPPORT_STATIC_ALLOCATION
# define SCM_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE( \
SCM_IMMUTABLE_STRING (scm_i_paste (c_name, _string), scheme_name); \
static SCM c_name) \
SCM_SNARF_INIT( \
c_name = scm_string_to_symbol (scm_i_paste (c_name, _string)) \
)
# define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE( \
SCM_IMMUTABLE_STRING (scm_i_paste (c_name, _string), scheme_name); \
SCM c_name) \
SCM_SNARF_INIT( \
c_name = scm_string_to_symbol (scm_i_paste (c_name, _string)) \
)
#else /* !SCM_SUPPORT_STATIC_ALLOCATION */
# define SCM_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE(static SCM c_name) \
SCM_SNARF_INIT(c_name = scm_from_utf8_symbol (scheme_name))
# define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \
SCM_SNARF_HERE(SCM c_name) \
SCM_SNARF_INIT(c_name = scm_from_utf8_symbol (scheme_name))
#endif /* !SCM_SUPPORT_STATIC_ALLOCATION */
/* Older spellings; don't use in new code. /* Older spellings; don't use in new code.