[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
guile/guile-core/libguile ChangeLog ramap.c
From: |
Dirk Herrmann |
Subject: |
guile/guile-core/libguile ChangeLog ramap.c |
Date: |
Wed, 11 Oct 2000 05:50:54 -0700 |
CVSROOT: /cvs
Module name: guile
Changes by: Dirk Herrmann <address@hidden> 00/10/11 05:50:53
Modified files:
guile-core/libguile: ChangeLog ramap.c
Log message:
* Replace some SCM_LENGTH macros.
CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1141&r2=1.1142
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ramap.c.diff?r1=1.57&r2=1.58
Patches:
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1141
guile/guile-core/libguile/ChangeLog:1.1142
--- guile/guile-core/libguile/ChangeLog:1.1141 Wed Oct 11 05:24:42 2000
+++ guile/guile-core/libguile/ChangeLog Wed Oct 11 05:50:53 2000
@@ -1,5 +1,14 @@
2000-10-11 Dirk Herrmann <address@hidden>
+ * ramap.c (scm_array_fill_int, scm_array_index_map_x): Replace
+ SCM_LENGTH with the appropriate SCM_<type>_LENGTH macro.
+
+ (scm_ra_matchp, scm_ramapc, ramap, rafe, scm_array_index_map_x,
+ raeql_1, raeql): Use scm_uniform_vector_length to determine the
+ length of a vector object generically.
+
+2000-10-11 Dirk Herrmann <address@hidden>
+
* unif.c (scm_make_uve, scm_uniform_vector_length, scm_array_p,
scm_transpose_array, scm_array_contents, scm_ra2contig,
scm_uniform_array_read_x, scm_uniform_array_write, scm_bit_count,
Index: guile/guile-core/libguile/ramap.c
diff -u guile/guile-core/libguile/ramap.c:1.57
guile/guile-core/libguile/ramap.c:1.58
--- guile/guile-core/libguile/ramap.c:1.57 Tue Sep 26 14:53:49 2000
+++ guile/guile-core/libguile/ramap.c Wed Oct 11 05:50:53 2000
@@ -221,7 +221,7 @@
case scm_tc7_cvect:
s0->lbnd = 0;
s0->inc = 1;
- s0->ubnd = (long) SCM_LENGTH (ra0) - 1;
+ s0->ubnd = SCM_INUM (scm_uniform_vector_length (ra0)) - 1;
break;
case scm_tc7_smob:
if (!SCM_ARRAYP (ra0))
@@ -255,25 +255,32 @@
case scm_tc7_fvect:
case scm_tc7_dvect:
case scm_tc7_cvect:
- if (1 != ndim)
- return 0;
- switch (exact)
- {
- case 4:
- if (0 != bas0)
- exact = 3;
- case 3:
- if (1 != s0->inc)
- exact = 2;
- case 2:
- if ((0 == s0->lbnd) && (s0->ubnd == SCM_LENGTH (ra1) - 1))
- break;
- exact = 1;
- case 1:
- if (s0->lbnd < 0 || s0->ubnd >= SCM_LENGTH (ra1))
- return 0;
- }
- break;
+ {
+ unsigned long int length;
+
+ if (1 != ndim)
+ return 0;
+
+ length = SCM_INUM (scm_uniform_vector_length (ra1));
+
+ switch (exact)
+ {
+ case 4:
+ if (0 != bas0)
+ exact = 3;
+ case 3:
+ if (1 != s0->inc)
+ exact = 2;
+ case 2:
+ if ((0 == s0->lbnd) && (s0->ubnd == length - 1))
+ break;
+ exact = 1;
+ case 1:
+ if (s0->lbnd < 0 || s0->ubnd >= length)
+ return 0;
+ }
+ break;
+ }
case scm_tc7_smob:
if (!SCM_ARRAYP (ra1) || ndim != SCM_ARRAY_NDIM (ra1))
return 0;
@@ -333,10 +340,11 @@
if (SCM_IMP (vra0)) goto gencase;
if (!SCM_ARRAYP (vra0))
{
+ unsigned long int length = SCM_INUM (scm_uniform_vector_length
(vra0));
vra1 = scm_make_ra (1);
SCM_ARRAY_BASE (vra1) = 0;
SCM_ARRAY_DIMS (vra1)->lbnd = 0;
- SCM_ARRAY_DIMS (vra1)->ubnd = SCM_LENGTH (vra0) - 1;
+ SCM_ARRAY_DIMS (vra1)->ubnd = length - 1;
SCM_ARRAY_DIMS (vra1)->inc = 1;
SCM_ARRAY_V (vra1) = vra0;
vra0 = vra1;
@@ -390,9 +398,10 @@
}
else
{
+ unsigned long int length = SCM_INUM (scm_uniform_vector_length (ra0));
kmax = 0;
SCM_ARRAY_DIMS (vra0)->lbnd = 0;
- SCM_ARRAY_DIMS (vra0)->ubnd = SCM_LENGTH (ra0) - 1;
+ SCM_ARRAY_DIMS (vra0)->ubnd = length - 1;
SCM_ARRAY_DIMS (vra0)->inc = 1;
SCM_ARRAY_BASE (vra0) = 0;
SCM_ARRAY_V (vra0) = ra0;
@@ -504,7 +513,7 @@
case scm_tc7_bvect:
{ /* scope */
long *ve = (long *) SCM_VELTS (ra);
- if (1 == inc && (n >= SCM_LONG_BIT || n == SCM_LENGTH (ra)))
+ if (1 == inc && (n >= SCM_LONG_BIT || n == SCM_BITVECTOR_LENGTH (ra)))
{
i = base / SCM_LONG_BIT;
if (SCM_FALSEP (fill))
@@ -1247,7 +1256,7 @@
for (; i <= n; i++, i1 += inc1)
{
args = SCM_EOL;
- for (k = SCM_LENGTH (ras); k--;)
+ for (k = SCM_INUM (scm_uniform_vector_length (ras)); k--;)
args = scm_cons (scm_uniform_vector_ref (ve[k], SCM_MAKINUM (i)),
args);
args = scm_cons (scm_cvref (ra1, i1, SCM_UNDEFINED), args);
scm_array_set_x (ra0, scm_apply (proc, args, SCM_EOL), SCM_MAKINUM (i
* inc + base));
@@ -1641,7 +1650,7 @@
for (; i <= n; i++, i0 += inc0, i1 += inc1)
{
args = SCM_EOL;
- for (k = SCM_LENGTH (ras); k--;)
+ for (k = SCM_INUM (scm_uniform_vector_length (ras)); k--;)
args = scm_cons (scm_uniform_vector_ref (ve[k], SCM_MAKINUM (i)),
args);
args = scm_cons2 (scm_cvref (ra0, i0, SCM_UNDEFINED), scm_cvref (ra1,
i1, SCM_UNDEFINED), args);
scm_apply (proc, args, SCM_EOL);
@@ -1696,7 +1705,7 @@
case scm_tc7_wvect:
{
SCM *ve = SCM_VELTS (ra);
- for (i = 0; i < SCM_LENGTH (ra); i++)
+ for (i = 0; i < SCM_VECTOR_LENGTH (ra); i++)
ve[i] = scm_apply (proc, SCM_MAKINUM (i), scm_listofnull);
return SCM_UNSPECIFIED;
}
@@ -1712,10 +1721,13 @@
case scm_tc7_fvect:
case scm_tc7_dvect:
case scm_tc7_cvect:
- for (i = 0; i < SCM_LENGTH (ra); i++)
- scm_array_set_x (ra, scm_apply (proc, SCM_MAKINUM (i), scm_listofnull),
- SCM_MAKINUM (i));
- return SCM_UNSPECIFIED;
+ {
+ unsigned long int length = SCM_INUM (scm_uniform_vector_length (ra));
+ for (i = 0; i < length; i++)
+ scm_array_set_x (ra, scm_apply (proc, SCM_MAKINUM (i),
scm_listofnull),
+ SCM_MAKINUM (i));
+ return SCM_UNSPECIFIED;
+ }
case scm_tc7_smob:
SCM_ASRTGO (SCM_ARRAYP (ra), badarg);
{
@@ -1770,7 +1782,7 @@
SCM e0 = SCM_UNDEFINED, e1 = SCM_UNDEFINED;
scm_sizet i0 = 0, i1 = 0;
long inc0 = 1, inc1 = 1;
- scm_sizet n = SCM_LENGTH (ra0);
+ scm_sizet n = SCM_INUM (scm_uniform_vector_length (ra0));
ra1 = SCM_CAR (ra1);
if (SCM_ARRAYP(ra0))
{
@@ -1909,7 +1921,7 @@
{
s0->inc = 1;
s0->lbnd = 0;
- s0->ubnd = SCM_LENGTH (v0) - 1;
+ s0->ubnd = SCM_INUM (scm_uniform_vector_length (v0)) - 1;
unroll = 0;
}
if (SCM_ARRAYP (ra1))
@@ -1929,7 +1941,7 @@
return 0;
s1->inc = 1;
s1->lbnd = 0;
- s1->ubnd = SCM_LENGTH (v1) - 1;
+ s1->ubnd = SCM_INUM (scm_uniform_vector_length (v1)) - 1;
unroll = 0;
}
if (SCM_TYP7 (v0) != SCM_TYP7 (v1))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- guile/guile-core/libguile ChangeLog ramap.c,
Dirk Herrmann <=