fixing chibi.ast build for plan9 (need to support error-string)

This commit is contained in:
Alex Shinn 2012-04-19 23:36:06 +09:00
parent eac57054ce
commit f05fb986e7

View file

@ -3,7 +3,10 @@
/* BSD-style license: http://synthcode.com/license.txt */ /* BSD-style license: http://synthcode.com/license.txt */
#include <chibi/eval.h> #include <chibi/eval.h>
#ifndef PLAN9
#include <errno.h> #include <errno.h>
#endif
#if ! SEXP_USE_BOEHM #if ! SEXP_USE_BOEHM
extern sexp sexp_gc (sexp ctx, size_t *sum_freed); extern sexp sexp_gc (sexp ctx, size_t *sum_freed);
@ -340,6 +343,9 @@ static sexp sexp_string_contains (sexp ctx, sexp self, sexp_sint_t n, sexp x, se
} }
static sexp sexp_error_string (sexp ctx, sexp self, sexp_sint_t n, sexp x) { static sexp sexp_error_string (sexp ctx, sexp self, sexp_sint_t n, sexp x) {
#ifdef PLAN9
return SEXP_FALSE;
#else
int err; int err;
if (x == SEXP_FALSE) { if (x == SEXP_FALSE) {
err = errno; err = errno;
@ -348,6 +354,7 @@ static sexp sexp_error_string (sexp ctx, sexp self, sexp_sint_t n, sexp x) {
err = sexp_unbox_fixnum(x); err = sexp_unbox_fixnum(x);
} }
return sexp_c_string(ctx, strerror(err), -1); return sexp_c_string(ctx, strerror(err), -1);
#endif
} }
static sexp sexp_update_free_vars (sexp ctx, sexp self, sexp_sint_t n, sexp x) { static sexp sexp_update_free_vars (sexp ctx, sexp self, sexp_sint_t n, sexp x) {