mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-02 15:40:38 +02:00
Change charsets to use bytevector to store char ranges
This doesn't fundamentally change how charsets are represented, but it will eventually allow us to migrate more functionality to scheme, as the charsets have a Scheme-legible representation. Also, and this is really the point, give charsets their own type code, so that they can be traced precisely. * libguile/eq.c: * libguile/evalext.c: * libguile/goops.c: * libguile/print.c: * module/oop/goops.scm: Adjust to new tc16. * libguile/srfi-14.h: Make private things private. * libguile/srfi-14.c: Change to use bytevectors for the ranges. No functional change.
This commit is contained in:
parent
ec92d6a96e
commit
c794c086d5
8 changed files with 577 additions and 550 deletions
|
@ -24,34 +24,12 @@
|
|||
|
||||
#include "libguile/chars.h"
|
||||
|
||||
typedef struct
|
||||
static inline int
|
||||
scm_is_char_set (SCM x)
|
||||
{
|
||||
scm_t_wchar lo;
|
||||
scm_t_wchar hi;
|
||||
} scm_t_char_range;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t len;
|
||||
scm_t_char_range *ranges;
|
||||
} scm_t_char_set;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t range;
|
||||
scm_t_wchar n;
|
||||
} scm_t_char_set_cursor;
|
||||
|
||||
#define SCM_CHARSET_GET(cs,idx) \
|
||||
scm_i_charset_get((scm_t_char_set *)SCM_SMOB_DATA(cs),idx)
|
||||
|
||||
#define SCM_CHARSETP(x) (SCM_HAS_TYP16 (x, scm_tc16_charset))
|
||||
|
||||
/* Smob type code for character sets. */
|
||||
SCM_API int scm_tc16_charset;
|
||||
SCM_INTERNAL int scm_i_charset_get (scm_t_char_set *cs, scm_t_wchar n);
|
||||
SCM_INTERNAL void scm_i_charset_set (scm_t_char_set *cs, scm_t_wchar n);
|
||||
SCM_INTERNAL void scm_i_charset_unset (scm_t_char_set *cs, scm_t_wchar n);
|
||||
return SCM_HAS_TYP16 (x, scm_tc16_charset);
|
||||
}
|
||||
#define SCM_CHARSETP(x) (scm_is_char_set (x))
|
||||
|
||||
SCM_API SCM scm_char_set_p (SCM obj);
|
||||
SCM_API SCM scm_char_set_eq (SCM char_sets);
|
||||
|
@ -120,6 +98,9 @@ SCM_API SCM scm_char_set_ascii;
|
|||
SCM_API SCM scm_char_set_empty;
|
||||
SCM_API SCM scm_char_set_full;
|
||||
|
||||
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_init_srfi_14 (void);
|
||||
|
||||
#endif /* SCM_SRFI_14_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue