1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-04 16:50:25 +02:00

Move struct scm_regexp definition to internal header

* libguile/regex-posix.c:
* libguile/regex-posix.h (scm_is_regexp):
(scm_to_regexp):
(scm_from_regexp):
(SCM_REGEXP_P):
(SCM_VALIDATE_REGEXP): Move definitions to header.
This commit is contained in:
Andy Wingo 2025-06-30 15:37:22 +02:00
parent cce7a04e55
commit c66668a87a
2 changed files with 32 additions and 30 deletions

View file

@ -61,36 +61,6 @@
#define REG_BASIC 0 #define REG_BASIC 0
#endif #endif
struct scm_regexp
{
scm_t_bits tag;
regex_t regex;
};
static inline int
scm_is_regexp (SCM x)
{
return SCM_HAS_TYP16 (x, scm_tc16_regexp);
}
static inline struct scm_regexp*
scm_to_regexp (SCM x)
{
if (!scm_is_regexp (x))
abort ();
return (struct scm_regexp *) SCM_UNPACK_POINTER (x);
}
static inline SCM
scm_from_regexp (struct scm_regexp *x)
{
return SCM_PACK_POINTER (x);
}
#define SCM_REGEXP_P(x) (scm_is_regexp (x))
#define SCM_VALIDATE_REGEXP(pos, a) \
SCM_MAKE_VALIDATE_MSG (pos, a, REGEXP_P, "regexp")
void void
scm_i_finalize_regexp (struct scm_thread *thread, SCM obj) scm_i_finalize_regexp (struct scm_thread *thread, SCM obj)
{ {

View file

@ -22,8 +22,40 @@
#include <regex.h>
#include <libguile/scm.h> #include <libguile/scm.h>
struct scm_regexp
{
scm_t_bits tag;
regex_t regex;
};
static inline int
scm_is_regexp (SCM x)
{
return SCM_HAS_TYP16 (x, scm_tc16_regexp);
}
static inline struct scm_regexp*
scm_to_regexp (SCM x)
{
if (!scm_is_regexp (x))
abort ();
return (struct scm_regexp *) SCM_UNPACK_POINTER (x);
}
static inline SCM
scm_from_regexp (struct scm_regexp *x)
{
return SCM_PACK_POINTER (x);
}
#define SCM_REGEXP_P(x) (scm_is_regexp (x))
#define SCM_VALIDATE_REGEXP(pos, a) \
SCM_MAKE_VALIDATE_MSG (pos, a, REGEXP_P, "regexp")
SCM_INTERNAL void scm_i_finalize_regexp (struct scm_thread*, SCM); SCM_INTERNAL void scm_i_finalize_regexp (struct scm_thread*, SCM);
SCM_INTERNAL void scm_init_regex_posix (void); SCM_INTERNAL void scm_init_regex_posix (void);