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:
Alex Shinn 2009-07-12 18:36:37 +09:00
parent 41f54a7f41
commit 821546244a
3 changed files with 13 additions and 6 deletions

12
eval.c
View file

@ -1543,16 +1543,16 @@ sexp sexp_vm (sexp ctx, sexp proc) {
case OP_NULLP:
_ARG1 = sexp_make_boolean(sexp_nullp(_ARG1)); break;
case OP_INTEGERP:
_ARG1 = sexp_make_boolean(sexp_integerp(_ARG1)
j = sexp_integerp(_ARG1);
#if USE_BIGNUMS
|| sexp_bignump(_ARG1)
if (! j) j = sexp_bignump(_ARG1);
#endif
#if USE_FLONUMS
|| (sexp_flonump(_ARG1)
&& (sexp_flonum_value(_ARG1)
== trunc(sexp_flonum_value(_ARG1))))
if (! j)
j = (sexp_flonump(_ARG1)
&& (sexp_flonum_value(_ARG1) == trunc(sexp_flonum_value(_ARG1))));
#endif
);
_ARG1 = sexp_make_boolean(j);
break;
case OP_SYMBOLP:
_ARG1 = sexp_make_boolean(sexp_symbolp(_ARG1)); break;

3
mkfile
View file

@ -34,3 +34,6 @@ clean:V:
install:V: $BIN/$TARG
mkdir -p $MODDIR
cp init.scm $MODDIR/
test:V:
./chibi-scheme tests/r5rs-tests.scm

View file

@ -186,6 +186,10 @@ sexp sexp_read_bignum (sexp ctx, sexp in, sexp_uint_t init,
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) {
int i, str_len, lg_base = trunc(log2(base));
char *data;