mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
Hacky C++ fixes.
This commit is contained in:
parent
214a1aaf78
commit
9b3529b0e6
2 changed files with 27 additions and 0 deletions
|
@ -9,7 +9,26 @@
|
||||||
#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);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
sexp_uint_t sexp_allocated_bytes (sexp ctx, sexp x) {
|
||||||
|
sexp_uint_t res;
|
||||||
|
sexp t;
|
||||||
|
if (!sexp_pointerp(x) || (sexp_pointer_tag(x) >= sexp_context_num_types(ctx)))
|
||||||
|
return sexp_heap_align(1);
|
||||||
|
t = sexp_object_type(ctx, x);
|
||||||
|
res = sexp_type_size_of_object(t, x) + SEXP_GC_PAD;
|
||||||
|
#if SEXP_USE_DEBUG_GC
|
||||||
|
if (res == 0) {
|
||||||
|
fprintf(stderr, SEXP_BANNER("%p zero-size object: %p"), ctx, x);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#else
|
||||||
extern sexp_uint_t sexp_allocated_bytes (sexp ctx, sexp x);
|
extern sexp_uint_t sexp_allocated_bytes (sexp ctx, sexp x);
|
||||||
|
#endif
|
||||||
|
|
||||||
static void sexp_print_simple (sexp ctx, sexp x, sexp out, int depth) {
|
static void sexp_print_simple (sexp ctx, sexp x, sexp out, int depth) {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
#include "chibi/eval.h"
|
#include "chibi/eval.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
namespace {
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SEXP_USE_HUFF_SYMS
|
#if SEXP_USE_HUFF_SYMS
|
||||||
#if SEXP_USE_STATIC_LIBS
|
#if SEXP_USE_STATIC_LIBS
|
||||||
#include "chibi/sexp-hufftabdefs.h"
|
#include "chibi/sexp-hufftabdefs.h"
|
||||||
|
@ -12,6 +16,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define swap(tmp_var, a, b) (tmp_var=a, a=b, b=tmp_var)
|
#define swap(tmp_var, a, b) (tmp_var=a, a=b, b=tmp_var)
|
||||||
|
|
||||||
static sexp sexp_vector_copy_to_list (sexp ctx, sexp vec, sexp seq) {
|
static sexp sexp_vector_copy_to_list (sexp ctx, sexp vec, sexp seq) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue