Convert more funcs to macros

This commit is contained in:
Justin Ethier 2018-06-08 16:51:08 -04:00
parent 1d0654a9d7
commit 596276f1ff
2 changed files with 121 additions and 108 deletions

View file

@ -447,22 +447,35 @@ object Cyc_is_number(object o);
object Cyc_is_complex(object o); object Cyc_is_complex(object o);
object Cyc_is_real(object o); object Cyc_is_real(object o);
object Cyc_is_integer(object o); object Cyc_is_integer(object o);
object Cyc_is_fixnum(object o); #define Cyc_is_fixnum(o) (make_boolean(obj_is_int(o)))
object Cyc_is_bignum(object o); //object Cyc_is_fixnum(object o);
#define Cyc_is_bignum(o) (make_boolean(is_object_type(o) && ((list) o)->tag == bignum_tag))
//object Cyc_is_bignum(object o);
//object Cyc_is_vector(object o); //object Cyc_is_vector(object o);
//object Cyc_is_bytevector(object o);
//object Cyc_is_port(object o);
//object Cyc_is_mutex(object o);
//object Cyc_is_cond_var(object o);
//object Cyc_is_symbol(object o);
//object Cyc_is_string(object o);
#define Cyc_is_vector(o) (make_boolean(is_object_type(o) && ((list) o)->tag == vector_tag)) #define Cyc_is_vector(o) (make_boolean(is_object_type(o) && ((list) o)->tag == vector_tag))
object Cyc_is_bytevector(object o); #define Cyc_is_bytevector(o) (make_boolean(is_object_type(o) && ((list) o)->tag == bytevector_tag))
object Cyc_is_port(object o); #define Cyc_is_port(o) (make_boolean(is_object_type(o) && ((list) o)->tag == port_tag))
object Cyc_is_mutex(object o); #define Cyc_is_mutex(o) (make_boolean(is_object_type(o) && ((list) o)->tag == mutex_tag))
object Cyc_is_cond_var(object o); #define Cyc_is_cond_var(o) (make_boolean(is_object_type(o) && ((list) o)->tag == cond_var_tag))
object Cyc_is_symbol(object o); #define Cyc_is_symbol(o) (make_boolean(is_object_type(o) && ((list) o)->tag == symbol_tag))
object Cyc_is_string(object o); #define Cyc_is_string(o) (make_boolean(is_object_type(o) && ((list) o)->tag == string_tag))
object Cyc_is_char(object o); //object Cyc_is_char(object o);
#define Cyc_is_char(o) (make_boolean(obj_is_char(o)))
object Cyc_is_procedure(void *data, object o); object Cyc_is_procedure(void *data, object o);
object Cyc_is_macro(object o); //object Cyc_is_macro(object o);
object Cyc_is_eof_object(object o); //object Cyc_is_eof_object(object o);
object Cyc_is_cvar(object o); //object Cyc_is_cvar(object o);
object Cyc_is_opaque(object o); //object Cyc_is_opaque(object o);
#define Cyc_is_macro(o) (make_boolean(is_object_type(o) && ((list) o)->tag == macro_tag))
#define Cyc_is_eof_object(o) (make_boolean(is_object_type(o) && ((list) o)->tag == eof_tag))
#define Cyc_is_cvar(o) (make_boolean(is_object_type(o) && ((list) o)->tag == cvar_tag))
#define Cyc_is_opaque(o) (make_boolean(is_object_type(o) && ((list) o)->tag == c_opaque_tag))
/**@}*/ /**@}*/
/** /**

188
runtime.c
View file

@ -1588,12 +1588,12 @@ object Cyc_is_complex(object o)
return boolean_f; return boolean_f;
} }
object Cyc_is_fixnum(object o) //object Cyc_is_fixnum(object o)
{ //{
if (obj_is_int(o)) // if (obj_is_int(o))
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
object Cyc_is_integer(object o) object Cyc_is_integer(object o)
{ {
@ -1604,68 +1604,68 @@ object Cyc_is_integer(object o)
return boolean_f; return boolean_f;
} }
object Cyc_is_bignum(object o) //object Cyc_is_bignum(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bignum_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bignum_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_symbol(object o) //object Cyc_is_symbol(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == symbol_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == symbol_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
//object Cyc_is_vector(object o) //object Cyc_is_vector(object o)
//{ //{
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == vector_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == vector_tag)
// return boolean_t; // return boolean_t;
// return boolean_f; // return boolean_f;
//} //}
//
object Cyc_is_bytevector(object o) //object Cyc_is_bytevector(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bytevector_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bytevector_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_port(object o) //object Cyc_is_port(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == port_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == port_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_mutex(object o) //object Cyc_is_mutex(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == mutex_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == mutex_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_cond_var(object o) //object Cyc_is_cond_var(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == cond_var_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == cond_var_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_string(object o) //object Cyc_is_string(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == string_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == string_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_char(object o) //object Cyc_is_char(object o)
{ //{
if (obj_is_char(o)) // if (obj_is_char(o))
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
object Cyc_is_procedure(void *data, object o) object Cyc_is_procedure(void *data, object o)
{ {
@ -1688,38 +1688,38 @@ object Cyc_is_procedure(void *data, object o)
return boolean_f; return boolean_f;
} }
object Cyc_is_macro(object o) //object Cyc_is_macro(object o)
{ //{
int tag; // int tag;
if ((o != NULL) && !is_value_type(o)) { // if ((o != NULL) && !is_value_type(o)) {
tag = type_of(o); // tag = type_of(o);
if (tag == macro_tag) { // if (tag == macro_tag) {
return boolean_t; // return boolean_t;
} // }
} // }
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_eof_object(object o) //object Cyc_is_eof_object(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && type_of(o) == eof_tag) // if ((o != NULL) && !is_value_type(o) && type_of(o) == eof_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_cvar(object o) //object Cyc_is_cvar(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && type_of(o) == cvar_tag) // if ((o != NULL) && !is_value_type(o) && type_of(o) == cvar_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
//
object Cyc_is_opaque(object o) //object Cyc_is_opaque(object o)
{ //{
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == c_opaque_tag) // if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == c_opaque_tag)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
object Cyc_eq(object x, object y) object Cyc_eq(object x, object y)
{ {