mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-02 15:40:55 -08:00
More errors factored into separate functions
This commit is contained in:
parent
ad6f1f7f10
commit
2fc586f3ec
4 changed files with 28 additions and 16 deletions
|
|
@ -58,7 +58,7 @@ cl_object
|
|||
si_instance_class(cl_object x)
|
||||
{
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
@(return CLASS_OF(x))
|
||||
}
|
||||
|
||||
|
|
@ -66,9 +66,9 @@ cl_object
|
|||
si_instance_class_set(cl_object x, cl_object y)
|
||||
{
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
if (!ECL_INSTANCEP(y))
|
||||
FEwrong_type_argument(@'ext::instance', y);
|
||||
FEtype_error_instance(y);
|
||||
CLASS_OF(x) = y;
|
||||
@(return x)
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ cl_object
|
|||
ecl_instance_ref(cl_object x, cl_fixnum i)
|
||||
{
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
if (i < 0 || i >= (cl_fixnum)x->instance.length)
|
||||
FEtype_error_index(x, MAKE_FIXNUM(i));
|
||||
return(x->instance.slots[i]);
|
||||
|
|
@ -89,7 +89,7 @@ si_instance_ref(cl_object x, cl_object index)
|
|||
cl_fixnum i;
|
||||
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
if (!FIXNUMP(index) ||
|
||||
(i = fix(index)) < 0 || i >= (cl_fixnum)x->instance.length)
|
||||
FEtype_error_index(x, index);
|
||||
|
|
@ -102,7 +102,7 @@ si_instance_ref_safe(cl_object x, cl_object index)
|
|||
cl_fixnum i;
|
||||
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
if (!FIXNUMP(index) ||
|
||||
(i = fix(index)) < 0 || i >= x->instance.length)
|
||||
FEtype_error_index(x, index);
|
||||
|
|
@ -116,7 +116,7 @@ cl_object
|
|||
ecl_instance_set(cl_object x, cl_fixnum i, cl_object v)
|
||||
{
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
if (i >= x->instance.length || i < 0)
|
||||
FEtype_error_index(x, MAKE_FIXNUM(i));
|
||||
x->instance.slots[i] = v;
|
||||
|
|
@ -129,7 +129,7 @@ si_instance_set(cl_object x, cl_object index, cl_object value)
|
|||
cl_fixnum i;
|
||||
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
if (!FIXNUMP(index) ||
|
||||
(i = fix(index)) >= (cl_fixnum)x->instance.length || i < 0)
|
||||
FEtype_error_index(x, index);
|
||||
|
|
@ -163,7 +163,7 @@ si_sl_makunbound(cl_object x, cl_object index)
|
|||
cl_fixnum i;
|
||||
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
if (!FIXNUMP(index) ||
|
||||
(i = fix(index)) >= x->instance.length || i < 0)
|
||||
FEtype_error_index(x, index);
|
||||
|
|
@ -177,7 +177,7 @@ si_copy_instance(cl_object x)
|
|||
cl_object y;
|
||||
|
||||
if (!ECL_INSTANCEP(x))
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
FEtype_error_instance(x);
|
||||
y = ecl_allocate_instance(x->instance.clas, x->instance.length);
|
||||
y->instance.sig = x->instance.sig;
|
||||
memcpy(y->instance.slots, x->instance.slots,
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ ecl_elt(cl_object seq, cl_fixnum index)
|
|||
return(CODE_CHAR(seq->base_string.self[index]));
|
||||
|
||||
default:
|
||||
FEwrong_type_argument(@'sequence', seq);
|
||||
FEtype_error_sequence(seq);
|
||||
}
|
||||
E:
|
||||
FEtype_error_index(seq, MAKE_FIXNUM(index));
|
||||
|
|
@ -145,7 +145,7 @@ ecl_elt_set(cl_object seq, cl_fixnum index, cl_object val)
|
|||
return(val);
|
||||
|
||||
default:
|
||||
FEwrong_type_argument(@'sequence', seq);
|
||||
FEtype_error_sequence(seq);
|
||||
}
|
||||
E:
|
||||
FEtype_error_index(seq, MAKE_FIXNUM(index));
|
||||
|
|
@ -206,7 +206,7 @@ E:
|
|||
@(return x)
|
||||
|
||||
default:
|
||||
FEwrong_type_argument(@'sequence', sequence);
|
||||
FEtype_error_sequence(sequence);
|
||||
}
|
||||
|
||||
ILLEGAL_START_END:
|
||||
|
|
@ -249,7 +249,7 @@ ecl_length(cl_object x)
|
|||
return(x->vector.fillp);
|
||||
|
||||
default:
|
||||
FEwrong_type_argument(@'sequence', x);
|
||||
FEtype_error_sequence(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ cl_reverse(cl_object seq)
|
|||
break;
|
||||
|
||||
default:
|
||||
FEwrong_type_argument(@'sequence', seq);
|
||||
FEtype_error_sequence(seq);
|
||||
}
|
||||
@(return output)
|
||||
}
|
||||
|
|
@ -308,7 +308,7 @@ cl_nreverse(cl_object seq)
|
|||
ecl_reverse_subarray(seq, 0, seq->vector.fillp);
|
||||
break;
|
||||
default:
|
||||
FEwrong_type_argument(@'sequence', seq);
|
||||
FEtype_error_sequence(seq);
|
||||
}
|
||||
@(return seq)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,16 @@ FEtype_error_stream(cl_object strm)
|
|||
FEwrong_type_argument(@'stream', strm);
|
||||
}
|
||||
|
||||
void
|
||||
FEtype_error_sequence(cl_object x) {
|
||||
FEwrong_type_argument(@'sequence', x);
|
||||
}
|
||||
|
||||
void
|
||||
FEtype_error_instance(cl_object x) {
|
||||
FEwrong_type_argument(@'ext::instance', x);
|
||||
}
|
||||
|
||||
cl_object
|
||||
ecl_type_error(cl_object function, const char *place, cl_object o,
|
||||
cl_object type)
|
||||
|
|
|
|||
|
|
@ -1482,6 +1482,8 @@ extern ECL_API void FEtype_error_list(cl_object x) /*__attribute__((noreturn))*/
|
|||
extern ECL_API void FEtype_error_proper_list(cl_object x) /*__attribute__((noreturn))*/;
|
||||
extern ECL_API void FEtype_error_alist(cl_object x) /*__attribute__((noreturn))*/;
|
||||
extern ECL_API void FEtype_error_stream(cl_object x) /*__attribute__((noreturn))*/;
|
||||
extern ECL_API void FEtype_error_sequence(cl_object x) /*__attribute__((noreturn))*/;
|
||||
extern ECL_API void FEtype_error_instance(cl_object x) /*__attribute__((noreturn))*/;
|
||||
extern ECL_API void FEcircular_list(cl_object x) /*__attribute__((noreturn))*/;
|
||||
extern ECL_API void FEtype_error_index(cl_object seq, cl_object ndx) /*__attribute__((noreturn))*/;
|
||||
extern ECL_API void FEtype_error_string(cl_object x) /*__attribute__((noreturn))*/;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue