#ifndef SCM_SRFI_14_INTERNAL_H #define SCM_SRFI_14_INTERNAL_H /* srfi-14.c --- SRFI-14 procedures for Guile Copyright 2001,2004,2006,2008,2011,2018,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 . */ #include "libguile/srfi-14.h" typedef struct scm_char_range { scm_t_wchar lo; scm_t_wchar hi; } scm_t_char_range; /* We call this "charset" instead of "char_set" to avoid confusion with "set" as a verb. */ struct scm_charset { scm_t_bits tag_and_flags; struct scm_bytevector *ranges; }; static inline struct scm_charset* scm_to_charset (SCM scm) { if (!scm_is_char_set (scm)) abort(); return (struct scm_charset *) SCM_UNPACK_POINTER (scm); } static inline SCM scm_from_charset (struct scm_charset *s) { return SCM_PACK_POINTER (s); } static const scm_t_bits SCM_CHARSET_F_IMMUTABLE = 1 << 16; static inline int scm_charset_is_immutable (SCM charset) { return scm_to_charset (charset)->tag_and_flags & SCM_CHARSET_F_IMMUTABLE; } #define SCM_VALIDATE_CHARSET(pos, x) \ do { \ SCM_ASSERT_TYPE (SCM_CHARSETP (x), x, pos, FUNC_NAME, "charset"); \ } while (0) #define SCM_VALIDATE_MUTABLE_CHARSET(pos, x) \ do { \ SCM_ASSERT_TYPE (SCM_CHARSETP (x) && !scm_charset_is_immutable (x), \ x, pos, FUNC_NAME, "mutable charset"); \ } while (0) SCM_INTERNAL int scm_i_char_sets_equal (SCM a, SCM b); SCM_INTERNAL int scm_i_print_char_set (SCM charset, SCM port, scm_print_state *pstate); SCM_INTERNAL void scm_boot_srfi_14 (void); #endif /* SCM_SRFI_14_INTERNAL_H */