mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-12 15:37:35 +02:00
plan9 fixes - can't use #if preprocessor statements inside macros.
also, no log2() by default, defining it in terms of log().
This commit is contained in:
parent
41f54a7f41
commit
821546244a
3 changed files with 13 additions and 6 deletions
12
eval.c
12
eval.c
|
@ -1543,16 +1543,16 @@ sexp sexp_vm (sexp ctx, sexp proc) {
|
||||||
case OP_NULLP:
|
case OP_NULLP:
|
||||||
_ARG1 = sexp_make_boolean(sexp_nullp(_ARG1)); break;
|
_ARG1 = sexp_make_boolean(sexp_nullp(_ARG1)); break;
|
||||||
case OP_INTEGERP:
|
case OP_INTEGERP:
|
||||||
_ARG1 = sexp_make_boolean(sexp_integerp(_ARG1)
|
j = sexp_integerp(_ARG1);
|
||||||
#if USE_BIGNUMS
|
#if USE_BIGNUMS
|
||||||
|| sexp_bignump(_ARG1)
|
if (! j) j = sexp_bignump(_ARG1);
|
||||||
#endif
|
#endif
|
||||||
#if USE_FLONUMS
|
#if USE_FLONUMS
|
||||||
|| (sexp_flonump(_ARG1)
|
if (! j)
|
||||||
&& (sexp_flonum_value(_ARG1)
|
j = (sexp_flonump(_ARG1)
|
||||||
== trunc(sexp_flonum_value(_ARG1))))
|
&& (sexp_flonum_value(_ARG1) == trunc(sexp_flonum_value(_ARG1))));
|
||||||
#endif
|
#endif
|
||||||
);
|
_ARG1 = sexp_make_boolean(j);
|
||||||
break;
|
break;
|
||||||
case OP_SYMBOLP:
|
case OP_SYMBOLP:
|
||||||
_ARG1 = sexp_make_boolean(sexp_symbolp(_ARG1)); break;
|
_ARG1 = sexp_make_boolean(sexp_symbolp(_ARG1)); break;
|
||||||
|
|
3
mkfile
3
mkfile
|
@ -34,3 +34,6 @@ clean:V:
|
||||||
install:V: $BIN/$TARG
|
install:V: $BIN/$TARG
|
||||||
mkdir -p $MODDIR
|
mkdir -p $MODDIR
|
||||||
cp init.scm $MODDIR/
|
cp init.scm $MODDIR/
|
||||||
|
|
||||||
|
test:V:
|
||||||
|
./chibi-scheme tests/r5rs-tests.scm
|
||||||
|
|
|
@ -186,6 +186,10 @@ sexp sexp_read_bignum (sexp ctx, sexp in, sexp_uint_t init,
|
||||||
return sexp_bignum_normalize(res);
|
return sexp_bignum_normalize(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PLAN9
|
||||||
|
#define log2(n) (log(n)/log(2))
|
||||||
|
#endif
|
||||||
|
|
||||||
sexp sexp_write_bignum (sexp ctx, sexp a, sexp out, sexp_uint_t base) {
|
sexp sexp_write_bignum (sexp ctx, sexp a, sexp out, sexp_uint_t base) {
|
||||||
int i, str_len, lg_base = trunc(log2(base));
|
int i, str_len, lg_base = trunc(log2(base));
|
||||||
char *data;
|
char *data;
|
||||||
|
|
Loading…
Add table
Reference in a new issue