Refactoring

This commit is contained in:
Justin Ethier 2016-04-20 03:39:58 -04:00
parent 884f26c72d
commit 3553d0773c
3 changed files with 8 additions and 8 deletions

View file

@ -20,7 +20,7 @@
}
#define Cyc_check_type(data, fnc_test, tag, obj) { \
if (eq(boolean_f, fnc_test(obj))) Cyc_invalid_type_error(data, tag, obj); }
if ((boolean_f == fnc_test(obj))) Cyc_invalid_type_error(data, tag, obj); }
#define Cyc_check_cons_or_null(d,obj) { if (obj != NULL) { Cyc_check_cons(d,obj); }}
#define Cyc_check_cons(d,obj) Cyc_check_type(d,Cyc_is_cons, cons_tag, obj);

View file

@ -491,7 +491,7 @@ object Cyc_has_cycle(object lst) {
if (is_object_type(car(slow_lst)) &&
boolean_f == Cyc_is_boolean(car(slow_lst)) && // Avoid expected dupes
//boolean_f == Cyc_is_symbol(car(slow_lst)) && //
eq(car(slow_lst), car(fast_lst))) return boolean_t;
(car(slow_lst) == car(fast_lst))) return boolean_t;
slow_lst = cdr(slow_lst);
fast_lst = cddr(fast_lst);
@ -742,7 +742,7 @@ object memberp(void *data, object x, list l)
object memqp(void *data, object x, list l)
{Cyc_check_cons_or_null(data, l);
for (; l != NULL; l = cdr(l)) if (eq(x,car(l))) return boolean_t;
for (; l != NULL; l = cdr(l)) if ((x == car(l))) return boolean_t;
return boolean_f;}
object equalp(object x, object y)
@ -762,7 +762,7 @@ list assq(void *data, object x, list l)
for (; (l != NULL); l = cdr(l)) {
list la = car(l);
Cyc_check_cons(data, la);
if (eq(x,car(la))) return la;
if ((x == car(la))) return la;
}
return boolean_f;
}
@ -857,7 +857,7 @@ object Cyc_is_boolean(object o){
if ((o != NULL) &&
!is_value_type(o) &&
((list)o)->tag == boolean_tag &&
(eq(boolean_f, o) || eq(boolean_t, o)))
((boolean_f == o) || (boolean_t == o)))
return boolean_t;
return boolean_f;}
@ -970,7 +970,7 @@ object Cyc_is_cvar(object o) {
return boolean_f;}
object Cyc_eq(object x, object y) {
if (eq(x, y))
if (x == y)
return boolean_t;
return boolean_f;
}
@ -1306,7 +1306,7 @@ object Cyc_string_set(void *data, object str, object k, object chr) {
Cyc_check_str(data, str);
Cyc_check_num(data, k);
if (!eq(boolean_t, Cyc_is_char(chr))) {
if (boolean_t != Cyc_is_char(chr)) {
Cyc_rt_raise2(data, "Expected char but received", chr);
}

View file

@ -1044,7 +1044,7 @@
(els (compile (if->else exp))))
(c-code (string-append
(c:allocs->str (c:allocs test) " ")
"if( !eq(boolean_f, "
"if( (boolean_f != "
(c:body test)
") ){ \n"
(c:serialize then " ")