mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Convert more funcs to macros
This commit is contained in:
parent
1d0654a9d7
commit
596276f1ff
2 changed files with 121 additions and 108 deletions
|
@ -447,22 +447,35 @@ object Cyc_is_number(object o);
|
|||
object Cyc_is_complex(object o);
|
||||
object Cyc_is_real(object o);
|
||||
object Cyc_is_integer(object o);
|
||||
object Cyc_is_fixnum(object o);
|
||||
object Cyc_is_bignum(object o);
|
||||
#define Cyc_is_fixnum(o) (make_boolean(obj_is_int(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);
|
||||
#define Cyc_is_vector(o) (make_boolean(is_object_type(o) && ((list) o)->tag == vector_tag))
|
||||
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);
|
||||
object Cyc_is_char(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_bytevector(o) (make_boolean(is_object_type(o) && ((list) o)->tag == bytevector_tag))
|
||||
#define Cyc_is_port(o) (make_boolean(is_object_type(o) && ((list) o)->tag == port_tag))
|
||||
#define Cyc_is_mutex(o) (make_boolean(is_object_type(o) && ((list) o)->tag == mutex_tag))
|
||||
#define Cyc_is_cond_var(o) (make_boolean(is_object_type(o) && ((list) o)->tag == cond_var_tag))
|
||||
#define Cyc_is_symbol(o) (make_boolean(is_object_type(o) && ((list) o)->tag == symbol_tag))
|
||||
#define Cyc_is_string(o) (make_boolean(is_object_type(o) && ((list) o)->tag == string_tag))
|
||||
//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_macro(object o);
|
||||
object Cyc_is_eof_object(object o);
|
||||
object Cyc_is_cvar(object o);
|
||||
object Cyc_is_opaque(object o);
|
||||
//object Cyc_is_macro(object o);
|
||||
//object Cyc_is_eof_object(object o);
|
||||
//object Cyc_is_cvar(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
188
runtime.c
|
@ -1588,12 +1588,12 @@ object Cyc_is_complex(object o)
|
|||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_fixnum(object o)
|
||||
{
|
||||
if (obj_is_int(o))
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
//object Cyc_is_fixnum(object o)
|
||||
//{
|
||||
// if (obj_is_int(o))
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
|
||||
object Cyc_is_integer(object o)
|
||||
{
|
||||
|
@ -1604,68 +1604,68 @@ object Cyc_is_integer(object o)
|
|||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_bignum(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bignum_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_symbol(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == symbol_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
//object Cyc_is_bignum(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bignum_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_symbol(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == symbol_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_vector(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == vector_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
|
||||
object Cyc_is_bytevector(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bytevector_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_port(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == port_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_mutex(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == mutex_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_cond_var(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == cond_var_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_string(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == string_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_char(object o)
|
||||
{
|
||||
if (obj_is_char(o))
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
//
|
||||
//object Cyc_is_bytevector(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == bytevector_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_port(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == port_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_mutex(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == mutex_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_cond_var(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == cond_var_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_string(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == string_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_char(object o)
|
||||
//{
|
||||
// if (obj_is_char(o))
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
|
||||
object Cyc_is_procedure(void *data, object o)
|
||||
{
|
||||
|
@ -1688,38 +1688,38 @@ object Cyc_is_procedure(void *data, object o)
|
|||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_macro(object o)
|
||||
{
|
||||
int tag;
|
||||
if ((o != NULL) && !is_value_type(o)) {
|
||||
tag = type_of(o);
|
||||
if (tag == macro_tag) {
|
||||
return boolean_t;
|
||||
}
|
||||
}
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_eof_object(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && type_of(o) == eof_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_cvar(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && type_of(o) == cvar_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
|
||||
object Cyc_is_opaque(object o)
|
||||
{
|
||||
if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == c_opaque_tag)
|
||||
return boolean_t;
|
||||
return boolean_f;
|
||||
}
|
||||
//object Cyc_is_macro(object o)
|
||||
//{
|
||||
// int tag;
|
||||
// if ((o != NULL) && !is_value_type(o)) {
|
||||
// tag = type_of(o);
|
||||
// if (tag == macro_tag) {
|
||||
// return boolean_t;
|
||||
// }
|
||||
// }
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_eof_object(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && type_of(o) == eof_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_cvar(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && type_of(o) == cvar_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
//
|
||||
//object Cyc_is_opaque(object o)
|
||||
//{
|
||||
// if ((o != NULL) && !is_value_type(o) && ((list) o)->tag == c_opaque_tag)
|
||||
// return boolean_t;
|
||||
// return boolean_f;
|
||||
//}
|
||||
|
||||
object Cyc_eq(object x, object y)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue