mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 14:19:18 +02:00
fixing SEXP_USE_GLOBAL_TYPES (may remove this soon though)
This commit is contained in:
parent
a66dd88158
commit
47add027d6
3 changed files with 7 additions and 5 deletions
|
@ -293,7 +293,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SEXP_USE_WEAK_REFERENCES
|
#ifndef SEXP_USE_WEAK_REFERENCES
|
||||||
#define SEXP_USE_WEAK_REFERENCES 1
|
#define SEXP_USE_WEAK_REFERENCES ! SEXP_USE_NO_FEATURES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SEXP_USE_MALLOC
|
#ifndef SEXP_USE_MALLOC
|
||||||
|
|
|
@ -865,7 +865,7 @@ SEXP_API sexp_heap sexp_global_heap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SEXP_USE_GLOBAL_TYPES
|
#if SEXP_USE_GLOBAL_TYPES
|
||||||
SEXP_API struct sexp_struct *sexp_type_specs;
|
SEXP_API struct sexp_type_struct *sexp_type_specs;
|
||||||
#define sexp_context_types(ctx) sexp_type_specs
|
#define sexp_context_types(ctx) sexp_type_specs
|
||||||
#define sexp_type_by_index(ctx,i) (&(sexp_context_types(ctx)[i]))
|
#define sexp_type_by_index(ctx,i) (&(sexp_context_types(ctx)[i]))
|
||||||
#define sexp_context_num_types(ctx) sexp_num_types
|
#define sexp_context_num_types(ctx) sexp_num_types
|
||||||
|
|
8
sexp.c
8
sexp.c
|
@ -161,9 +161,11 @@ sexp sexp_register_type_op (sexp ctx sexp_api_params(self, n), sexp name,
|
||||||
len = type_array_size*2;
|
len = type_array_size*2;
|
||||||
if (len > SEXP_MAXIMUM_TYPES) len = SEXP_MAXIMUM_TYPES;
|
if (len > SEXP_MAXIMUM_TYPES) len = SEXP_MAXIMUM_TYPES;
|
||||||
#if SEXP_USE_GLOBAL_TYPES
|
#if SEXP_USE_GLOBAL_TYPES
|
||||||
new = malloc(len * sizeof(_sexp_type_specs[0]));
|
new = malloc(len * sizeof(sexp_struct));
|
||||||
for (i=0; i<num_types; i++)
|
for (i=0; i<num_types; i++) {
|
||||||
memcpy(&(new[i]), &(sexp_type_specs[i]), sizeof(_sexp_type_specs[0]));
|
new[i].tag = SEXP_TYPE;
|
||||||
|
memcpy(&(new[i].value), &(sexp_type_specs[i]), sizeof(_sexp_type_specs[0]));
|
||||||
|
}
|
||||||
tmp = sexp_type_specs;
|
tmp = sexp_type_specs;
|
||||||
sexp_type_specs = new;
|
sexp_type_specs = new;
|
||||||
if (type_array_size > num_types) free(tmp);
|
if (type_array_size > num_types) free(tmp);
|
||||||
|
|
Loading…
Add table
Reference in a new issue