Syncing some feature names with R7RS draft.

This commit is contained in:
Alex Shinn 2011-12-17 15:26:26 +09:00
parent 9f25895e8c
commit 348b176172
3 changed files with 45 additions and 31 deletions

72
eval.c
View file

@ -1943,43 +1943,57 @@ sexp sexp_load_standard_ports (sexp ctx, sexp env, FILE* in, FILE* out,
return SEXP_VOID; return SEXP_VOID;
} }
static const char* sexp_initial_features[] = {
sexp_platform,
#if SEXP_BSD
"bsd",
#endif
#if defined(_WIN32) || defined(__MINGW32__)
"windows",
#endif
#if SEXP_USE_DL
"dynamic-loading",
#endif
#if SEXP_USE_MODULES
"modules",
#endif
#if SEXP_USE_BOEHM
"boehm-gc",
#endif
#if SEXP_USE_UTF8_STRINGS
"full-unicode",
#endif
#if SEXP_USE_GREEN_THREADS
"threads",
#endif
#if SEXP_USE_AUTO_FORCE
"auto-force",
#endif
#if SEXP_USE_COMPLEX
"complex",
#endif
#if SEXP_USE_RATIOS
"ratios",
#endif
"r7rs",
"chibi",
NULL,
};
sexp sexp_load_standard_env (sexp ctx, sexp e, sexp version) { sexp sexp_load_standard_env (sexp ctx, sexp e, sexp version) {
int len; int len;
char init_file[128]; char init_file[128];
const char** features;
int endianess_check = 1;
sexp_gc_var3(op, tmp, sym); sexp_gc_var3(op, tmp, sym);
sexp_gc_preserve3(ctx, op, tmp, sym); sexp_gc_preserve3(ctx, op, tmp, sym);
if (!e) e = sexp_context_env(ctx); if (!e) e = sexp_context_env(ctx);
sexp_env_define(ctx, e, sym=sexp_intern(ctx, "*shared-object-extension*", -1), sexp_env_define(ctx, e, sym=sexp_intern(ctx, "*shared-object-extension*", -1),
tmp=sexp_c_string(ctx, sexp_so_extension, -1)); tmp=sexp_c_string(ctx, sexp_so_extension, -1));
tmp = sexp_list1(ctx, sym=sexp_intern(ctx, sexp_platform, -1)); tmp = SEXP_NULL;
#if SEXP_BSD sexp_push(ctx, tmp, sym=sexp_intern(ctx, (*(unsigned char*) &endianess_check) ? "little-endian" : "big-endian", -1));
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "bsd", -1)); for (features=sexp_initial_features; *features; features++)
#endif sexp_push(ctx, tmp, sym=sexp_intern(ctx, *features, -1));
#if SEXP_USE_DL
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "dynamic-loading", -1));
#endif
#if SEXP_USE_MODULES
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "modules", -1));
#endif
#if SEXP_USE_BOEHM
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "boehm-gc", -1));
#endif
#if SEXP_USE_UTF8_STRINGS
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "utf-8", -1));
#endif
#if SEXP_USE_GREEN_THREADS
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "threads", -1));
#endif
#if SEXP_USE_AUTO_FORCE
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "auto-force", -1));
#endif
#if SEXP_USE_COMPLEX
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "complex", -1));
#endif
#if SEXP_USE_RATIOS
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "ratios", -1));
#endif
sexp_push(ctx, tmp, sym=sexp_intern(ctx, "chibi", -1));
sexp_env_define(ctx, e, sym=sexp_intern(ctx, "*features*", -1), tmp); sexp_env_define(ctx, e, sym=sexp_intern(ctx, "*features*", -1), tmp);
sexp_global(ctx, SEXP_G_OPTIMIZATIONS) = SEXP_NULL; sexp_global(ctx, SEXP_G_OPTIMIZATIONS) = SEXP_NULL;
#if SEXP_USE_SIMPLIFY #if SEXP_USE_SIMPLIFY

View file

@ -1043,7 +1043,7 @@
(define (string-cursor-start s) 0) (define (string-cursor-start s) 0)
(cond-expand (cond-expand
(utf-8 (full-unicode
(define (string-copy s) (substring-cursor s 0 (string-size s))) (define (string-copy s) (substring-cursor s 0 (string-size s)))
(define string-cursor-end string-size)) (define string-cursor-end string-size))
(else (else

View file

@ -10,7 +10,7 @@
(load "tests/loop-tests.scm") (load "tests/loop-tests.scm")
(load "tests/match-tests.scm") (load "tests/match-tests.scm")
(load "tests/scribble-tests.scm") (load "tests/scribble-tests.scm")
(cond-expand (utf-8 (load "tests/unicode-tests.scm")) (else #f)) (cond-expand (full-unicode (load "tests/unicode-tests.scm")) (else #f))
(cond-expand (cond-expand
(modules (modules