mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-01 15:20:34 +02:00
* libguile/keywords-internal.h: New file. * libguile/Makefile.am (noinst_HEADERS): Add new file. * libguile/hash.c: * libguile/init.c: * libguile/keywords.c: Include new file. (scm_symbol_to_keyword): Allocate via scm_allocate_tagged.
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
#ifndef SCM_KEYWORDS_INTERNAL_H
|
||
#define SCM_KEYWORDS_INTERNAL_H
|
||
|
||
/* Copyright 1995-1996,1999-2001,2006,2008,2015,2018-2019,2025
|
||
Free Software Foundation, Inc.
|
||
|
||
This file is part of Guile.
|
||
|
||
Guile is free software: you can redistribute it and/or modify it
|
||
under the terms of the GNU Lesser General Public License as published
|
||
by the Free Software Foundation, either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
Guile is distributed in the hope that it will be useful, but WITHOUT
|
||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||
License for more details.
|
||
|
||
You should have received a copy of the GNU Lesser General Public
|
||
License along with Guile. If not, see
|
||
<https://www.gnu.org/licenses/>. */
|
||
|
||
|
||
|
||
#include <libguile/keywords.h>
|
||
#include <libguile/scm.h>
|
||
|
||
|
||
|
||
struct scm_keyword
|
||
{
|
||
scm_t_bits tag;
|
||
SCM symbol;
|
||
};
|
||
|
||
static inline struct scm_keyword *
|
||
scm_to_keyword (SCM x)
|
||
{
|
||
return (struct scm_keyword *) SCM_UNPACK_POINTER (x);
|
||
}
|
||
|
||
static inline SCM
|
||
scm_from_keyword (struct scm_keyword *keyword)
|
||
{
|
||
return SCM_PACK_POINTER (keyword);
|
||
}
|
||
|
||
#define SCM_KEYWORDP(x) (scm_is_keyword (x))
|
||
#define SCM_VALIDATE_KEYWORD(pos, v) \
|
||
SCM_MAKE_VALIDATE_MSG (pos, v, KEYWORDP, "keyword")
|
||
|
||
#define SCM_I_KEYWORD_HASH(x) scm_i_symbol_hash (scm_to_keyword (x)->symbol)
|
||
|
||
SCM_INTERNAL void scm_init_keywords (void);
|
||
|
||
#endif /* SCM_KEYWORDS_INTERNAL_H */
|