mini-mes: Workarounds for vector.c.
* vector.c (make_vector, vector_set_x, list_to_vector)[!__GNUC__]: Avoid by value assignment from array-of struct entry.
This commit is contained in:
parent
43abef7cf5
commit
6c6df16ca3
|
@ -129,6 +129,7 @@ mescc-check: t-check
|
||||||
build-aux/mes-snarf.scm $<
|
build-aux/mes-snarf.scm $<
|
||||||
|
|
||||||
mini-mes: mini-mes.h mini-mes.i mini-mes.environment.i mini-mes.symbols.i
|
mini-mes: mini-mes.h mini-mes.i mini-mes.environment.i mini-mes.symbols.i
|
||||||
|
mini-mes: vector.c
|
||||||
mini-mes: mlibc.c mstart.c
|
mini-mes: mlibc.c mstart.c
|
||||||
mini-mes: GNUmakefile
|
mini-mes: GNUmakefile
|
||||||
mini-mes: module/mes/read-0-32.mo
|
mini-mes: module/mes/read-0-32.mo
|
||||||
|
@ -140,6 +141,7 @@ mini-mes: scaffold/mini-mes.c
|
||||||
chmod +x $@
|
chmod +x $@
|
||||||
|
|
||||||
guile-mini-mes: mini-mes.h mini-mes.i mini-mes.environment.i mini-mes.symbols.i
|
guile-mini-mes: mini-mes.h mini-mes.i mini-mes.environment.i mini-mes.symbols.i
|
||||||
|
guile-mini-mes: vector.c
|
||||||
guile-mini-mes: module/mes/read-0-32.mo
|
guile-mini-mes: module/mes/read-0-32.mo
|
||||||
guile-mini-mes: scaffold/mini-mes.c
|
guile-mini-mes: scaffold/mini-mes.c
|
||||||
guile/mescc.scm $< > $@ || rm -f $@
|
guile/mescc.scm $< > $@ || rm -f $@
|
||||||
|
|
|
@ -223,9 +223,7 @@ SCM
|
||||||
make_cell_ (SCM type, SCM car, SCM cdr)
|
make_cell_ (SCM type, SCM car, SCM cdr)
|
||||||
{
|
{
|
||||||
SCM x = alloc (1);
|
SCM x = alloc (1);
|
||||||
#if __GNUC__
|
|
||||||
assert (TYPE (type) == TNUMBER);
|
assert (TYPE (type) == TNUMBER);
|
||||||
#endif
|
|
||||||
TYPE (x) = VALUE (type);
|
TYPE (x) = VALUE (type);
|
||||||
if (VALUE (type) == TCHAR || VALUE (type) == TNUMBER) {
|
if (VALUE (type) == TCHAR || VALUE (type) == TNUMBER) {
|
||||||
if (car) CAR (x) = CAR (car);
|
if (car) CAR (x) = CAR (car);
|
||||||
|
@ -271,10 +269,8 @@ SCM
|
||||||
list_of_char_equal_p (SCM a, SCM b) ///((internal))
|
list_of_char_equal_p (SCM a, SCM b) ///((internal))
|
||||||
{
|
{
|
||||||
while (a != cell_nil && b != cell_nil && VALUE (car (a)) == VALUE (car (b))) {
|
while (a != cell_nil && b != cell_nil && VALUE (car (a)) == VALUE (car (b))) {
|
||||||
#if __GNUC__
|
|
||||||
assert (TYPE (car (a)) == TCHAR);
|
assert (TYPE (car (a)) == TCHAR);
|
||||||
assert (TYPE (car (b)) == TCHAR);
|
assert (TYPE (car (b)) == TCHAR);
|
||||||
#endif
|
|
||||||
a = cdr (a);
|
a = cdr (a);
|
||||||
b = cdr (b);
|
b = cdr (b);
|
||||||
}
|
}
|
||||||
|
@ -512,9 +508,7 @@ SCM
|
||||||
append2 (SCM x, SCM y)
|
append2 (SCM x, SCM y)
|
||||||
{
|
{
|
||||||
if (x == cell_nil) return y;
|
if (x == cell_nil) return y;
|
||||||
#if __GNUC__
|
|
||||||
assert (TYPE (x) == TPAIR);
|
assert (TYPE (x) == TPAIR);
|
||||||
#endif
|
|
||||||
return cons (car (x), append2 (cdr (x), y));
|
return cons (car (x), append2 (cdr (x), y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,9 +567,7 @@ assq_ref_env (SCM x, SCM a)
|
||||||
SCM
|
SCM
|
||||||
set_car_x (SCM x, SCM e)
|
set_car_x (SCM x, SCM e)
|
||||||
{
|
{
|
||||||
#if __GNUC__
|
|
||||||
assert (TYPE (x) == TPAIR);
|
assert (TYPE (x) == TPAIR);
|
||||||
#endif
|
|
||||||
CAR (x) = e;
|
CAR (x) = e;
|
||||||
return cell_unspecified;
|
return cell_unspecified;
|
||||||
}
|
}
|
||||||
|
|
43
vector.c
43
vector.c
|
@ -25,7 +25,23 @@ make_vector (SCM n)
|
||||||
VALUE (tmp_num) = TVECTOR;
|
VALUE (tmp_num) = TVECTOR;
|
||||||
SCM v = alloc (k);
|
SCM v = alloc (k);
|
||||||
SCM x = make_cell_ (tmp_num, k, v);
|
SCM x = make_cell_ (tmp_num, k, v);
|
||||||
|
#if 0
|
||||||
|
//__GNUC__
|
||||||
for (int i=0; i<k; i++) g_cells[v+i] = g_cells[vector_entry (cell_unspecified)];
|
for (int i=0; i<k; i++) g_cells[v+i] = g_cells[vector_entry (cell_unspecified)];
|
||||||
|
#else
|
||||||
|
for (int i=0; i<k; i++)
|
||||||
|
{
|
||||||
|
SCM y = v+i;
|
||||||
|
SCM z = vector_entry (cell_unspecified);
|
||||||
|
//g_cells[y] = g_cells[z];
|
||||||
|
SCM zz = TYPE (z);
|
||||||
|
TYPE (y) = zz;
|
||||||
|
zz = CAR (z);
|
||||||
|
CAR (y) = zz;
|
||||||
|
zz = CDR (z);
|
||||||
|
CDR (y) = zz;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +75,20 @@ vector_set_x (SCM x, SCM i, SCM e)
|
||||||
{
|
{
|
||||||
assert (TYPE (x) == TVECTOR);
|
assert (TYPE (x) == TVECTOR);
|
||||||
assert (VALUE (i) < LENGTH (x));
|
assert (VALUE (i) < LENGTH (x));
|
||||||
|
#if 0
|
||||||
|
//__GNUC__
|
||||||
g_cells[VECTOR (x)+VALUE (i)] = g_cells[vector_entry (e)];
|
g_cells[VECTOR (x)+VALUE (i)] = g_cells[vector_entry (e)];
|
||||||
|
#else
|
||||||
|
SCM y = VECTOR (x)+VALUE (i);
|
||||||
|
SCM z = vector_entry (e);
|
||||||
|
//g_cells[y] = g_cells[z];
|
||||||
|
SCM zz = TYPE (z);
|
||||||
|
TYPE (y) = zz;
|
||||||
|
zz = CAR (z);
|
||||||
|
CAR (y) = zz;
|
||||||
|
zz = CDR (z);
|
||||||
|
CDR (y) = zz;
|
||||||
|
#endif
|
||||||
return cell_unspecified;
|
return cell_unspecified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +100,21 @@ list_to_vector (SCM x)
|
||||||
SCM p = VECTOR (v);
|
SCM p = VECTOR (v);
|
||||||
while (x != cell_nil)
|
while (x != cell_nil)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
//__GNUC__
|
||||||
g_cells[p++] = g_cells[vector_entry (car (x))];
|
g_cells[p++] = g_cells[vector_entry (car (x))];
|
||||||
|
#else
|
||||||
|
SCM y = p;
|
||||||
|
SCM z = vector_entry (car (x));
|
||||||
|
//g_cells[p++] = g_cells[y];
|
||||||
|
SCM zz = TYPE (z);
|
||||||
|
TYPE (y) = zz;
|
||||||
|
zz = CAR (z);
|
||||||
|
CAR (y) = zz;
|
||||||
|
zz = CDR (z);
|
||||||
|
CDR (y) = zz;
|
||||||
|
p++;
|
||||||
|
#endif
|
||||||
x = cdr (x);
|
x = cdr (x);
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
|
Loading…
Reference in a new issue