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

* src/vector.c: Rewrite C constructs not supported by M2-Planet.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2019-10-20 13:40:25 +02:00
parent 4897b584ad
commit 7bb9e5aed0
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -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)