-/* Copyright (C) 1995,1996,1999,2000,2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1999,2000,2001, 2003, 2004 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
return scm_class_char;
else if (scm_is_bool (x))
return scm_class_boolean;
- else if (SCM_NULLP (x))
+ else if (scm_is_null (x))
return scm_class_null;
else
return scm_class_unknown;
{
SCM name = SCM_STRUCT_TABLE_NAME (SCM_CDR (handle));
SCM class = scm_make_extended_class (scm_is_true (name)
- ? SCM_SYMBOL_CHARS (name)
+ ? scm_i_symbol_chars (name)
: 0,
SCM_I_OPERATORP (x));
SCM_SET_STRUCT_TABLE_CLASS (SCM_CDR (handle), class);
}
}
default:
- if (SCM_CONSP (x))
+ if (scm_is_pair (x))
return scm_class_pair;
else
return scm_class_unknown;
SCM
scm_mcache_lookup_cmethod (SCM cache, SCM args)
{
- long i, n, end, mask;
+ unsigned long i, mask, n, end;
SCM ls, methods, z = SCM_CDDR (cache);
- n = SCM_INUM (SCM_CAR (z)); /* maximum number of specializers */
+ n = scm_to_ulong (SCM_CAR (z)); /* maximum number of specializers */
methods = SCM_CADR (z);
- if (SCM_INUMP (methods))
+ if (SCM_VECTORP (methods))
+ {
+ /* cache format #1: prepare for linear search */
+ mask = -1;
+ i = 0;
+ end = SCM_VECTOR_LENGTH (methods);
+ }
+ else
{
/* cache format #2: compute a hash value */
- long hashset = SCM_INUM (methods);
+ unsigned long hashset = scm_to_ulong (methods);
long j = n;
z = SCM_CDDR (z);
- mask = SCM_INUM (SCM_CAR (z));
+ mask = scm_to_ulong (SCM_CAR (z));
methods = SCM_CADR (z);
i = 0;
ls = args;
- if (!SCM_NULLP (ls))
+ if (!scm_is_null (ls))
do
{
i += SCM_STRUCT_DATA (scm_class_of (SCM_CAR (ls)))
[scm_si_hashsets + hashset];
ls = SCM_CDR (ls);
}
- while (j-- && !SCM_NULLP (ls));
+ while (j-- && !scm_is_null (ls));
i &= mask;
end = i;
}
- else /* SCM_VECTORP (methods) */
- {
- /* cache format #1: prepare for linear search */
- mask = -1;
- i = 0;
- end = SCM_VECTOR_LENGTH (methods);
- }
/* Search for match */
do
long j = n;
z = SCM_VELTS (methods)[i];
ls = args; /* list of arguments */
- if (!SCM_NULLP (ls))
+ if (!scm_is_null (ls))
do
{
/* More arguments than specifiers => CLASS != ENV */
- if (! SCM_EQ_P (scm_class_of (SCM_CAR (ls)), SCM_CAR (z)))
+ if (! scm_is_eq (scm_class_of (SCM_CAR (ls)), SCM_CAR (z)))
goto next_method;
ls = SCM_CDR (ls);
z = SCM_CDR (z);
}
- while (j-- && !SCM_NULLP (ls));
+ while (j-- && !scm_is_null (ls));
/* Fewer arguments than specifiers => CAR != ENV */
- if (SCM_NULLP (SCM_CAR (z)) || SCM_CONSP (SCM_CAR (z)))
+ if (scm_is_null (SCM_CAR (z)) || scm_is_pair (SCM_CAR (z)))
return z;
next_method:
i = (i + 1) & mask;
unsigned long flags = 0;
SCM_VALIDATE_STRUCT (1, metaclass);
SCM_VALIDATE_STRING (2, layout);
- if (SCM_EQ_P (metaclass, scm_metaclass_operator))
+ if (scm_is_eq (metaclass, scm_metaclass_operator))
flags = SCM_CLASSF_OPERATOR;
return scm_i_make_class_object (metaclass, layout, flags);
}
SCM_VALIDATE_STRUCT (1, class);
SCM_VALIDATE_STRING (2, layout);
pl = SCM_PACK (SCM_STRUCT_DATA (class) [scm_vtable_index_layout]);
- /* Convert symbol->string */
- pl = scm_mem2string (SCM_SYMBOL_CHARS (pl), SCM_SYMBOL_LENGTH (pl));
+ pl = scm_symbol_to_string (pl);
return scm_i_make_class_object (SCM_STRUCT_VTABLE (class),
scm_string_append (scm_list_2 (pl, layout)),
SCM_CLASS_FLAGS (class));
void
scm_init_objects ()
{
- SCM ms = scm_makfrom0str (SCM_METACLASS_STANDARD_LAYOUT);
+ SCM ms = scm_from_locale_string (SCM_METACLASS_STANDARD_LAYOUT);
SCM mt = scm_make_vtable_vtable (ms, SCM_INUM0,
scm_list_3 (SCM_BOOL_F, SCM_EOL, SCM_EOL));
- SCM os = scm_makfrom0str (SCM_METACLASS_OPERATOR_LAYOUT);
+ SCM os = scm_from_locale_string (SCM_METACLASS_OPERATOR_LAYOUT);
SCM ot = scm_make_vtable_vtable (os, SCM_INUM0,
scm_list_3 (SCM_BOOL_F, SCM_EOL, SCM_EOL));
- SCM es = scm_makfrom0str (SCM_ENTITY_LAYOUT);
+ SCM es = scm_from_locale_string (SCM_ENTITY_LAYOUT);
SCM el = scm_make_struct_layout (es);
SCM et = scm_make_struct (mt, SCM_INUM0,
scm_list_4 (el, SCM_BOOL_F, SCM_EOL, SCM_EOL));