/* weak.c -- weak pointers and ephemerons */ /* Copyright (c) 2010-2013 Alex Shinn. All rights reserved. */ /* BSD-style license: http://synthcode.com/license.txt */ #include sexp sexp_ephemeron_brokenp_op (sexp ctx, sexp self, sexp_sint_t n, sexp eph) { if (! (sexp_pointerp(eph) && (sexp_pointer_tag(eph) == sexp_unbox_fixnum(sexp_opcode_arg1_type(self))))) return sexp_type_exception(ctx, self, sexp_unbox_fixnum(sexp_opcode_arg1_type(self)), eph); return sexp_make_boolean(sexp_brokenp(eph)); } #if 0 #define sexp_weak_vector_p(x) sexp_check_tag(x, sexp_weak_vector_id) sexp sexp_make_weak_vector (sexp ctx, sexp self, sexp_sint_t n, sexp len) { sexp vec, *x; int i, clen = sexp_unbox_fixnum(len); sexp_assert_type(ctx, sexp_fixnump, SEXP_FIXNUM, len); vec = sexp_alloc_tagged(ctx, sexp_sizeof(vector) + clen*sizeof(sexp), sexp_unbox_fixnum(sexp_opcode_return_type(self))); if (sexp_exceptionp(vec)) return vec; x = sexp_vector_data(vec); for (i=0; i