1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-02 15:40:38 +02:00

Deprecate srfi-14 in default environment

* libguile/srfi-14.c:
* module/srfi/srfi-14.scm: Arrange to define bindings here instead of in
the default environment.
* libguile/init.c:
* libguile/srfi-14.h: Fix so that srfi-14 can register an extension to
be loaded later.
* libguile/unidata_to_charset.awk: Rename private cs_letter_plus_digit
to cs_letter_and_digit.
* module/ice-9/deprecated.scm: Add deprecation trampolines for srfi-14.
* module/ice-9/sandbox.scm:
* module/language/elisp/lexer.scm:
* module/language/scheme/decompile-tree-il.scm:
* module/rnrs/unicode.scm:
* module/sxml/simple.scm:
* module/system/base/syntax.scm:
* module/system/repl/server.scm:
* module/texinfo/serialize.scm:
* module/texinfo/string-utils.scm:
* module/web/http.scm:
* module/web/uri.scm:
* test-suite/tests/strings.test:
* test-suite/tests/tree-il.test: Adapt for srfi-14 being in a module.
This commit is contained in:
Andy Wingo 2025-06-13 09:03:20 +02:00
parent 7d899fa7c7
commit 4516119dd1
19 changed files with 330 additions and 148 deletions

View file

@ -29,6 +29,7 @@
#include "bytevectors-internal.h"
#include "chars.h"
#include "eval.h"
#include "extensions.h"
#include "gsubr.h"
#include "list.h"
#include "modules.h"
@ -40,6 +41,7 @@
#include "strings.h"
#include "symbols.h"
#include "values.h"
#include "version.h"
#include "srfi-14.h"
@ -1971,35 +1973,11 @@ SCM_DEFINE (scm_char_set_diff_plus_intersection_x,
/* Standard character sets. */
SCM scm_char_set_lower_case;
SCM scm_char_set_upper_case;
SCM scm_char_set_title_case;
SCM scm_char_set_letter;
SCM scm_char_set_digit;
SCM scm_char_set_letter_and_digit;
SCM scm_char_set_graphic;
SCM scm_char_set_printing;
SCM scm_char_set_whitespace;
SCM scm_char_set_iso_control;
SCM scm_char_set_punctuation;
SCM scm_char_set_symbol;
SCM scm_char_set_hex_digit;
SCM scm_char_set_blank;
SCM scm_char_set_ascii;
SCM scm_char_set_empty;
SCM scm_char_set_designated;
SCM scm_char_set_full;
/* Create an empty character set and return it after binding it to NAME. */
static inline SCM
define_charset (const char *name, size_t len, const scm_t_char_range *ranges)
define_charset (size_t len, const scm_t_char_range *ranges)
{
SCM cs = scm_from_charset (make_static_charset (len, ranges));
scm_c_define (name, cs);
return cs;
return scm_from_charset (make_static_charset (len, ranges));
}
SCM_DEFINE (scm_sys_char_set_dump, "%char-set-dump", 1, 0, 0, (SCM charset),
@ -2058,11 +2036,45 @@ SCM_DEFINE (scm_sys_char_set_dump, "%char-set-dump", 1, 0, 0, (SCM charset),
#define DEFINE_CHARSET(name, stem) \
define_charset ("char-set:" name, cs_##stem##_len, cs_##stem##_ranges)
#define DECLARE_C_CHARSET(name, stem) \
SCM scm_char_set_##stem;
#define DEFINE_C_CHARSET(name, stem) \
scm_char_set_##stem = define_charset (cs_##stem##_len, cs_##stem##_ranges);
#define DEFINE_SCM_CHARSET(name, stem) \
scm_c_define ("char-set:" name, scm_char_set_##stem);
#define FOR_EACH_STANDARD_CHARSET(M) \
M ("upper-case", upper_case) \
M ("lower-case", lower_case) \
M ("title-case", title_case) \
M ("letter", letter) \
M ("digit", digit) \
M ("letter+digit", letter_and_digit) \
M ("graphic", graphic) \
M ("printing", printing) \
M ("whitespace", whitespace) \
M ("iso-control", iso_control) \
M ("punctuation", punctuation) \
M ("symbol", symbol) \
M ("hex-digit", hex_digit) \
M ("blank", blank) \
M ("ascii", ascii) \
M ("empty", empty) \
M ("designated", designated) \
M ("full", full)
FOR_EACH_STANDARD_CHARSET(DECLARE_C_CHARSET)
static void
scm_init_srfi_14 (void)
{
FOR_EACH_STANDARD_CHARSET (DEFINE_SCM_CHARSET);
#include "srfi-14.x"
}
void
scm_init_srfi_14 (void)
scm_boot_srfi_14 (void)
{
empty_charset_ranges =
scm_i_make_typed_bytevector (0, SCM_ARRAY_ELEMENT_TYPE_U32);
@ -2070,27 +2082,12 @@ scm_init_srfi_14 (void)
scm_tc16_charset_cursor = scm_make_smob_type ("char-set-cursor", 0);
scm_set_smob_print (scm_tc16_charset_cursor, charset_cursor_print);
scm_char_set_upper_case = DEFINE_CHARSET ("upper-case", upper_case);
scm_char_set_lower_case = DEFINE_CHARSET ("lower-case", lower_case);
scm_char_set_title_case = DEFINE_CHARSET ("title-case", title_case);
scm_char_set_letter = DEFINE_CHARSET ("letter", letter);
scm_char_set_digit = DEFINE_CHARSET ("digit", digit);
scm_char_set_letter_and_digit = DEFINE_CHARSET ("letter+digit",
letter_plus_digit);
scm_char_set_graphic = DEFINE_CHARSET ("graphic", graphic);
scm_char_set_printing = DEFINE_CHARSET ("printing", printing);
scm_char_set_whitespace = DEFINE_CHARSET ("whitespace", whitespace);
scm_char_set_iso_control = DEFINE_CHARSET ("iso-control", iso_control);
scm_char_set_punctuation = DEFINE_CHARSET ("punctuation", punctuation);
scm_char_set_symbol = DEFINE_CHARSET ("symbol", symbol);
scm_char_set_hex_digit = DEFINE_CHARSET ("hex-digit", hex_digit);
scm_char_set_blank = DEFINE_CHARSET ("blank", blank);
scm_char_set_ascii = DEFINE_CHARSET ("ascii", ascii);
scm_char_set_empty = DEFINE_CHARSET ("empty", empty);
scm_char_set_designated = DEFINE_CHARSET ("designated", designated);
scm_char_set_full = DEFINE_CHARSET ("full", full);
FOR_EACH_STANDARD_CHARSET (DEFINE_C_CHARSET);
#include "srfi-14.x"
scm_c_register_extension ("libguile-" SCM_EFFECTIVE_VERSION,
"scm_init_srfi_14",
(scm_t_extension_init_func) scm_init_srfi_14,
NULL);
}
/* End of srfi-14.c. */