core: Prepare for M2-Planet: vector.c.

* src/vector.c: Rewrite C constructs not supported by M2-Planet.
This commit is contained in:
Jan Nieuwenhuizen 2019-10-20 13:40:25 +02:00
parent 1984322f01
commit 1765da6764
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 6 additions and 3 deletions

View File

@ -28,7 +28,8 @@ make_vector__ (long k)
{
SCM v = alloc (k);
SCM x = make_cell__ (TVECTOR, k, v);
for (long i = 0; i < k; i++)
long i;
for (i = 0; i < k; i = i + 1)
g_cells[v + i] = g_cells[vector_entry (cell_unspecified)];
return x;
}
@ -98,7 +99,8 @@ list_to_vector (SCM x)
SCM p = VECTOR (v);
while (x != cell_nil)
{
g_cells[p++] = g_cells[vector_entry (car (x))];
g_cells[p] = g_cells[vector_entry (car (x))];
p = p + 1;
x = cdr (x);
}
return v;
@ -108,7 +110,8 @@ SCM
vector_to_list (SCM v)
{
SCM x = cell_nil;
for (long i = LENGTH (v); i; i--)
long i;
for (i = LENGTH (v); i; i = i - 1)
{
SCM e = VECTOR (v) + i - 1;
if (TYPE (e) == TREF)