diff --git a/include/chibi/sexp.h b/include/chibi/sexp.h index 6737e2a8..fb8e33b1 100644 --- a/include/chibi/sexp.h +++ b/include/chibi/sexp.h @@ -134,7 +134,6 @@ typedef struct sexp_struct *sexp; #endif /* procedure types */ -typedef sexp (*sexp_proc0) (void); typedef sexp (*sexp_proc1) (sexp sexp_api_params(self, n)); typedef sexp (*sexp_proc2) (sexp sexp_api_params(self, n), sexp); typedef sexp (*sexp_proc3) (sexp sexp_api_params(self, n), sexp, sexp); @@ -921,6 +920,7 @@ SEXP_API sexp sexp_finalize_c_type (sexp ctx sexp_api_params(self, n), sexp obj) #define sexp_get_output_string(ctx, out) sexp_get_output_string_op(ctx sexp_api_pass(NULL, 1), out) #define sexp_expt(ctx, a, b) sexp_expt_op(ctx sexp_api_pass(NULL, 2), a, b) #define sexp_register_simple_type(ctx, a, b) sexp_register_simple_type_op(ctx sexp_api_pass(NULL, 2), a, b) +#define sexp_register_type(ctx, a, b, c, d, e, f, g, h, i, j) sexp_register_type_op(ctx sexp_api_pass(NULL, 10), a, b, c, d, e, f, g, h, i, j) #define sexp_make_type_predicate(ctx, a, b) sexp_make_type_predicate_op(ctx sexp_api_pass(NULL, 2), a, b) #define sexp_make_constructor(ctx, a, b) sexp_make_constructor_op(ctx sexp_api_pass(NULL, 2), a, b) #define sexp_make_getter(ctx, a, b, c) sexp_make_getter_op(ctx sexp_api_pass(NULL, 3), a, b, c) diff --git a/lib/srfi/27/rand.c b/lib/srfi/27/rand.c index 25aff799..210b9e42 100644 --- a/lib/srfi/27/rand.c +++ b/lib/srfi/27/rand.c @@ -37,17 +37,17 @@ typedef struct random_data sexp_random_t; static sexp_uint_t rs_type_id; static sexp default_random_source; -static sexp sexp_rs_random_integer (sexp ctx, sexp rs, sexp bound) { +static sexp sexp_rs_random_integer (sexp ctx sexp_api_params(self, n), sexp rs, sexp bound) { sexp res; - int32_t n; + int32_t m; #if SEXP_USE_BIGNUMS int32_t hi, mod, len, i, *data; #endif if (! sexp_random_source_p(rs)) res = sexp_type_exception(ctx, "not a random-source", rs); if (sexp_fixnump(bound)) { - sexp_call_random(rs, n); - res = sexp_make_fixnum(n % sexp_unbox_fixnum(bound)); + sexp_call_random(rs, m); + res = sexp_make_fixnum(m % sexp_unbox_fixnum(bound)); #if SEXP_USE_BIGNUMS } else if (sexp_bignump(bound)) { hi = sexp_bignum_hi(bound); @@ -55,13 +55,13 @@ static sexp sexp_rs_random_integer (sexp ctx, sexp rs, sexp bound) { res = sexp_make_bignum(ctx, hi); data = (int32_t*) sexp_bignum_data(res); for (i=0; i> (sizeof(i) - 1) * CHAR_BIT); } -static sexp sexp_bit_count (sexp ctx, sexp x) { +static sexp sexp_bit_count (sexp ctx sexp_api_params(self, n), sexp x) { sexp res; sexp_sint_t i; #if SEXP_USE_BIGNUMS @@ -250,7 +250,7 @@ static sexp_uint_t integer_log2 (sexp_uint_t x) { return (t = x >> 8) ? 8 + log_table_256[t] : log_table_256[x]; } -static sexp sexp_integer_length (sexp ctx, sexp x) { +static sexp sexp_integer_length (sexp ctx sexp_api_params(self, n), sexp x) { sexp_sint_t tmp; #if SEXP_USE_BIGNUMS sexp_sint_t hi; @@ -269,7 +269,7 @@ static sexp sexp_integer_length (sexp ctx, sexp x) { } } -static sexp sexp_bit_set_p (sexp ctx, sexp i, sexp x) { +static sexp sexp_bit_set_p (sexp ctx sexp_api_params(self, n), sexp i, sexp x) { #if SEXP_USE_BIGNUMS sexp_uint_t pos; #endif diff --git a/lib/srfi/69/hash.c b/lib/srfi/69/hash.c index da28f079..ec0b1d30 100644 --- a/lib/srfi/69/hash.c +++ b/lib/srfi/69/hash.c @@ -23,7 +23,7 @@ static sexp_uint_t string_hash (char *str, sexp_uint_t bound) { return acc % bound; } -static sexp sexp_string_hash (sexp ctx, sexp str, sexp bound) { +static sexp sexp_string_hash (sexp ctx sexp_api_params(self, n), sexp str, sexp bound) { if (! sexp_stringp(str)) return sexp_type_exception(ctx, "string-hash: not a string", str); else if (! sexp_integerp(bound)) @@ -38,7 +38,7 @@ static sexp_uint_t string_ci_hash (char *str, sexp_uint_t bound) { return acc % bound; } -static sexp sexp_string_ci_hash (sexp ctx, sexp str, sexp bound) { +static sexp sexp_string_ci_hash (sexp ctx sexp_api_params(self, n), sexp str, sexp bound) { if (! sexp_stringp(str)) return sexp_type_exception(ctx, "string-ci-hash: not a string", str); else if (! sexp_integerp(bound)) @@ -89,13 +89,13 @@ static sexp_uint_t hash_one (sexp ctx, sexp obj, sexp_uint_t bound, sexp_sint_t return (bound ? acc % bound : acc); } -static sexp sexp_hash (sexp ctx, sexp obj, sexp bound) { +static sexp sexp_hash (sexp ctx sexp_api_params(self, n), sexp obj, sexp bound) { if (! sexp_exact_integerp(bound)) return sexp_type_exception(ctx, "hash: not an integer", bound); return sexp_make_fixnum(hash_one(ctx, obj, sexp_unbox_fixnum(bound), HASH_DEPTH)); } -static sexp sexp_hash_by_identity (sexp ctx, sexp obj, sexp bound) { +static sexp sexp_hash_by_identity (sexp ctx sexp_api_params(self, n), sexp obj, sexp bound) { if (! sexp_exact_integerp(bound)) return sexp_type_exception(ctx, "hash-by-identity: not an integer", bound); return sexp_make_fixnum((sexp_uint_t)obj % sexp_unbox_fixnum(bound)); @@ -106,9 +106,9 @@ static sexp sexp_get_bucket (sexp ctx, sexp buckets, sexp hash_fn, sexp obj) { sexp res; sexp_uint_t len = sexp_vector_length(buckets); if (hash_fn == sexp_make_fixnum(1)) - res = sexp_hash_by_identity(ctx, obj, sexp_make_fixnum(len)); + res = sexp_hash_by_identity(ctx sexp_api_pass(NULL, 2), obj, sexp_make_fixnum(len)); else if (hash_fn == sexp_make_fixnum(2)) - res = sexp_hash(ctx, obj, sexp_make_fixnum(len)); + res = sexp_hash(ctx sexp_api_pass(NULL, 2), obj, sexp_make_fixnum(len)); else { sexp_gc_preserve1(ctx, args); args = sexp_list2(ctx, obj, sexp_make_fixnum(len)); @@ -180,7 +180,7 @@ static void sexp_regrow_hash_table (sexp ctx, sexp ht, sexp oldbuckets, sexp has sexp_gc_release1(ctx); } -static sexp sexp_hash_table_cell (sexp ctx, sexp ht, sexp obj, sexp createp) { +static sexp sexp_hash_table_cell (sexp ctx sexp_api_params(self, n), sexp ht, sexp obj, sexp createp) { sexp buckets, eq_fn, hash_fn, i; sexp_uint_t size; sexp_gc_var1(res); @@ -209,7 +209,7 @@ static sexp sexp_hash_table_cell (sexp ctx, sexp ht, sexp obj, sexp createp) { return res; } -static sexp sexp_hash_table_delete (sexp ctx, sexp ht, sexp obj) { +static sexp sexp_hash_table_delete (sexp ctx sexp_api_params(self, n), sexp ht, sexp obj) { sexp buckets=sexp_hash_table_buckets(ht), eq_fn=sexp_hash_table_eq_fn(ht), hash_fn=sexp_hash_table_hash_fn(ht), i, p, res; i = sexp_get_bucket(ctx, buckets, hash_fn, obj); diff --git a/lib/srfi/95/qsort.c b/lib/srfi/95/qsort.c index 1cfdbe24..970f36b4 100644 --- a/lib/srfi/95/qsort.c +++ b/lib/srfi/95/qsort.c @@ -134,7 +134,8 @@ static sexp sexp_qsort_less (sexp ctx, sexp *vec, return res; } -static sexp sexp_sort_x (sexp ctx, sexp seq, sexp less, sexp key) { +static sexp sexp_sort_x (sexp ctx sexp_api_params(self, n), sexp seq, + sexp less, sexp key) { sexp_sint_t len; sexp res, *data; sexp_gc_var1(vec); diff --git a/sexp.c b/sexp.c index f4f3d46c..1f7c3468 100644 --- a/sexp.c +++ b/sexp.c @@ -122,9 +122,9 @@ static sexp_uint_t sexp_type_array_size = SEXP_NUM_CORE_TYPES; #define SEXP_INIT_NUM_TYPES (SEXP_NUM_CORE_TYPES*2) #endif -sexp sexp_register_type (sexp ctx, sexp name, sexp fb, sexp felb, sexp flb, - sexp flo, sexp fls, sexp sb, sexp so, sexp sc, - sexp_proc2 f) { +sexp sexp_register_type_op (sexp ctx sexp_api_params(self, n), sexp name, + sexp fb, sexp felb, sexp flb, sexp flo, sexp fls, + sexp sb, sexp so, sexp sc, sexp_proc2 f) { #if SEXP_USE_GLOBAL_TYPES struct sexp_struct *new, *tmp; #else