2004-07-16 02:26:21 -04:00
|
|
|
#include "factor.h"
|
|
|
|
|
2004-12-10 21:46:42 -05:00
|
|
|
F_VECTOR* vector(F_FIXNUM capacity)
|
2004-07-16 02:26:21 -04:00
|
|
|
{
|
2004-12-25 02:55:03 -05:00
|
|
|
F_VECTOR* vector;
|
|
|
|
if(capacity < 0)
|
|
|
|
general_error(ERROR_NEGATIVE_ARRAY_SIZE,tag_fixnum(capacity));
|
|
|
|
vector = allot_object(VECTOR_TYPE,sizeof(F_VECTOR));
|
2005-01-27 20:06:10 -05:00
|
|
|
vector->top = tag_fixnum(0);
|
2005-01-29 16:39:30 -05:00
|
|
|
vector->array = tag_object(array(ARRAY_TYPE,capacity,F));
|
2004-07-16 02:26:21 -04:00
|
|
|
return vector;
|
|
|
|
}
|
|
|
|
|
|
|
|
void primitive_vector(void)
|
|
|
|
{
|
2004-10-12 23:49:43 -04:00
|
|
|
maybe_garbage_collection();
|
2004-08-12 17:36:36 -04:00
|
|
|
drepl(tag_object(vector(to_fixnum(dpeek()))));
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
2004-12-24 02:52:02 -05:00
|
|
|
void primitive_to_vector(void)
|
2004-07-16 02:26:21 -04:00
|
|
|
{
|
2004-12-24 02:52:02 -05:00
|
|
|
type_check(VECTOR_TYPE,dpeek());
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
2004-12-10 21:46:42 -05:00
|
|
|
void fixup_vector(F_VECTOR* vector)
|
2004-07-16 02:26:21 -04:00
|
|
|
{
|
2004-12-25 02:55:03 -05:00
|
|
|
data_fixup(&vector->array);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
2004-12-10 21:46:42 -05:00
|
|
|
void collect_vector(F_VECTOR* vector)
|
2004-07-16 02:26:21 -04:00
|
|
|
{
|
2004-11-27 22:26:05 -05:00
|
|
|
copy_object(&vector->array);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|