core: Prepare for M2-Planet: vector.c.
* src/vector.c: Rewrite C constructs not supported by M2-Planet.
This commit is contained in:
parent
2440143579
commit
60929bf40e
11
src/vector.c
11
src/vector.c
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue