summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-10-17 20:17:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-10-17 20:17:22 -0700
commit9b18f519decaf0cd7f52571c3c44012e3fc23a3a (patch)
tree5848a0bfd530e51183dbbf1e201a56ccf437fbd1 /eval.c
parent9f158a44b7e88c1dcfb8d56f4f85d642fc423b59 (diff)
downloadtxr-9b18f519decaf0cd7f52571c3c44012e3fc23a3a.tar.gz
txr-9b18f519decaf0cd7f52571c3c44012e3fc23a3a.tar.bz2
txr-9b18f519decaf0cd7f52571c3c44012e3fc23a3a.zip
Converting cast expressions to macros that are retargetted
to C++ style casts when compiling as C++. * lib.h (strip_qual, convert, coerce): New casting macros. (TAG_MASK, tag, type, wli_noex, auto_str, static_str, litptr, num_fast, chr, lit_noex, nil, nao): Use cast macros. * arith.c (mul, isqrt_fixnum, bit): Use cast macros. * configure (INT_PTR_MAX): Define using cast macro. * debug.c (debug_init): Use cast macro. * eval.c (do_eval, expand_macro, reg_op, reg_mac, eval_init): Use cast macros. * filter.c (filter_init): Use cast macro. * gc.c (more, mark_obj, in_heap, mark, sweep_one, unmark): Use cast macros. * hash.c (hash_double, equal_hash, eql_hash, hash_equal_op, hash_hash_op, hash_print_op, hash_mark, make_hash, make_similar_hash, copy_hash, gethash_c, gethash, gethash_f, gethash_n, remhash, hash_count, get_hash_userdata, set_hash_userdata, hash_iter_destroy, hash_iter_mark, hash_begin, hash_uni, hash_diff, hash_isec): Use cast macros. * lib.c (code2type, chk_malloc, chk_malloc_gc_more, chk_calloc, chk_realloc, chk_strdup, num, c_num, string, mkstring, mkustring, upcase_str, downcase_str, string_extend, sub_str, cat_str, trim_str, c_chr, vector, vec_set_length, copy_vec, sub_vec, cat_vec, cobj_print_op, obj_init): Likewise. * match.c (do_match_line, hv_trampoline, match_files, dir_tables_init): Likewise. * parser.l (grammar): Likewise. * parser.y (parse): Likewise. * rand.c (make_state, make_random_state, random_fixnum, random): Likewise. * regex.c (CHAR_SET_L2_LO, CHAR_SET_L2_HI, CHAR_SET_L1_LO, CHAR_SET_L1_HI, CHAR_SET_L0_LO, CHAR_SET_L0_HI, L0_full, L0_fill_range, L1_full, L1_fill_range, L1_contains, L1_free, L2_full, L2_fill_range, L2_contains, L2_free, L3_fill_range, L3_contains, L3_free, char_set_create, char_set_cobj_destroy, nfa_state_accept, nfa_state_empty, nfa_state_single, nfa_state_wild, nfa_state_set,
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/eval.c b/eval.c
index 5a5e7baf..c4b5cb78 100644
--- a/eval.c
+++ b/eval.c
@@ -934,7 +934,7 @@ static val do_eval(val form, val env, val ctx_form,
val entry = gethash(op_table, oper);
if (entry) {
- opfun_t fp = (opfun_t) cptr_get(entry);
+ opfun_t fp = coerce(opfun_t, cptr_get(entry));
last_form_evaled = form;
debug_return (fp(form, env));
} else {
@@ -1331,7 +1331,7 @@ static val op_defmacro(val form, val env)
static val expand_macro(val form, val expander, val menv)
{
if (cobjp(expander)) {
- mefun_t fp = (mefun_t) cptr_get(expander);
+ mefun_t fp = coerce(mefun_t, cptr_get(expander));
return fp(form, menv);
} else {
debug_enter;
@@ -3217,7 +3217,7 @@ static val force(val promise)
static void reg_op(val sym, opfun_t fun)
{
assert (sym != 0);
- sethash(op_table, sym, cptr((mem_t *) fun));
+ sethash(op_table, sym, cptr(coerce(mem_t *, fun)));
}
void reg_fun(val sym, val fun)
@@ -3229,7 +3229,7 @@ void reg_fun(val sym, val fun)
static void reg_mac(val sym, mefun_t fun)
{
assert (sym != 0);
- sethash(top_mb, sym, cptr((mem_t *) fun));
+ sethash(top_mb, sym, cptr(coerce(mem_t *, fun)));
}
void reg_var(val sym, val val)
@@ -3340,7 +3340,7 @@ static val merge_wrap(val list1, val list2, val lessfun, val keyfun)
void eval_init(void)
{
protect(&top_vb, &top_fb, &top_mb, &top_smb, &special, &dyn_env,
- &op_table, &last_form_evaled, (val *) 0);
+ &op_table, &last_form_evaled, convert(val *, 0));
top_fb = make_hash(t, nil, nil);
top_vb = make_hash(t, nil, nil);
top_mb = make_hash(t, nil, nil);