/[guile]/guile/guile-core/libguile/ramap.c
ViewVC logotype

Diff of /guile/guile-core/libguile/ramap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.80 by ttn, Thu Mar 14 03:47:42 2002 UTC revision 1.81 by xxhanwen, Sat Jul 20 14:08:34 2002 UTC
# Line 488  scm_array_fill_int (SCM ra, SCM fill, SC Line 488  scm_array_fill_int (SCM ra, SCM fill, SC
488      case scm_tc7_vector:      case scm_tc7_vector:
489      case scm_tc7_wvect:      case scm_tc7_wvect:
490        for (i = base; n--; i += inc)        for (i = base; n--; i += inc)
491          SCM_VELTS (ra)[i] = fill;          SCM_VECTOR_SET (ra, i, fill);
492        break;        break;
493      case scm_tc7_string:      case scm_tc7_string:
494        SCM_ASRTGO (SCM_CHARP (fill), badarg2);        SCM_ASRTGO (SCM_CHARP (fill), badarg2);
# Line 905  scm_ra_eqp (SCM ra0, SCM ras) Line 905  scm_ra_eqp (SCM ra0, SCM ras)
905  /* opt 0 means <, nonzero means >= */  /* opt 0 means <, nonzero means >= */
906    
907  static int  static int
908  ra_compare (SCM ra0,SCM ra1,SCM ra2,int opt)  ra_compare (SCM ra0, SCM ra1, SCM ra2, int opt)
909  {  {
910    long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1;    long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1;
911    unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2);    unsigned long i0 = SCM_ARRAY_BASE (ra0), i1 = SCM_ARRAY_BASE (ra1), i2 = SCM_ARRAY_BASE (ra2);
# Line 1230  scm_array_identity (SCM dst, SCM src) Line 1230  scm_array_identity (SCM dst, SCM src)
1230    
1231    
1232  static int  static int
1233  ramap (SCM ra0,SCM proc,SCM ras)  ramap (SCM ra0, SCM proc, SCM ras)
1234  {  {
1235    long i = SCM_ARRAY_DIMS (ra0)->lbnd;    long i = SCM_ARRAY_DIMS (ra0)->lbnd;
1236    long inc = SCM_ARRAY_DIMS (ra0)->inc;    long inc = SCM_ARRAY_DIMS (ra0)->inc;
# Line 1243  ramap (SCM ra0,SCM proc,SCM ras) Line 1243  ramap (SCM ra0,SCM proc,SCM ras)
1243    else    else
1244      {      {
1245        SCM ra1 = SCM_CAR (ras);        SCM ra1 = SCM_CAR (ras);
1246        SCM args, *ve = &ras;        SCM args;
1247          SCM const *ve = &ras;
1248        unsigned long k, i1 = SCM_ARRAY_BASE (ra1);        unsigned long k, i1 = SCM_ARRAY_BASE (ra1);
1249        long inc1 = SCM_ARRAY_DIMS (ra1)->inc;        long inc1 = SCM_ARRAY_DIMS (ra1)->inc;
1250        ra1 = SCM_ARRAY_V (ra1);        ra1 = SCM_ARRAY_V (ra1);
# Line 1255  ramap (SCM ra0,SCM proc,SCM ras) Line 1256  ramap (SCM ra0,SCM proc,SCM ras)
1256            ras = scm_vector (ras);            ras = scm_vector (ras);
1257            ve = SCM_VELTS (ras);            ve = SCM_VELTS (ras);
1258          }          }
1259          
1260        for (; i <= n; i++, i1 += inc1)        for (; i <= n; i++, i1 += inc1)
1261          {          {
1262            args = SCM_EOL;            args = SCM_EOL;
# Line 1269  ramap (SCM ra0,SCM proc,SCM ras) Line 1271  ramap (SCM ra0,SCM proc,SCM ras)
1271    
1272    
1273  static int  static int
1274  ramap_cxr (SCM ra0,SCM proc,SCM ras)  ramap_cxr (SCM ra0, SCM proc, SCM ras)
1275  {  {
1276    SCM ra1 = SCM_CAR (ras);    SCM ra1 = SCM_CAR (ras);
1277    SCM e1 = SCM_UNDEFINED;    SCM e1 = SCM_UNDEFINED;
# Line 1330  ramap_cxr (SCM ra0,SCM proc,SCM ras) Line 1332  ramap_cxr (SCM ra0,SCM proc,SCM ras)
1332    
1333    
1334  static int  static int
1335  ramap_rp (SCM ra0,SCM proc,SCM ras)  ramap_rp (SCM ra0, SCM proc, SCM ras)
1336  {  {
1337    SCM ra1 = SCM_CAR (ras), ra2 = SCM_CAR (SCM_CDR (ras));    SCM ra1 = SCM_CAR (ras), ra2 = SCM_CAR (SCM_CDR (ras));
1338    SCM e1 = SCM_UNDEFINED, e2 = SCM_UNDEFINED;    SCM e1 = SCM_UNDEFINED, e2 = SCM_UNDEFINED;
# Line 1415  ramap_rp (SCM ra0,SCM proc,SCM ras) Line 1417  ramap_rp (SCM ra0,SCM proc,SCM ras)
1417    
1418    
1419  static int  static int
1420  ramap_1 (SCM ra0,SCM proc,SCM ras)  ramap_1 (SCM ra0, SCM proc, SCM ras)
1421  {  {
1422    SCM ra1 = SCM_CAR (ras);    SCM ra1 = SCM_CAR (ras);
1423    SCM e1 = SCM_UNDEFINED;    SCM e1 = SCM_UNDEFINED;
# Line 1436  ramap_1 (SCM ra0,SCM proc,SCM ras) Line 1438  ramap_1 (SCM ra0,SCM proc,SCM ras)
1438    
1439    
1440  static int  static int
1441  ramap_2o (SCM ra0,SCM proc,SCM ras)  ramap_2o (SCM ra0, SCM proc, SCM ras)
1442  {  {
1443    SCM ra1 = SCM_CAR (ras);    SCM ra1 = SCM_CAR (ras);
1444    SCM e1 = SCM_UNDEFINED;    SCM e1 = SCM_UNDEFINED;
# Line 1483  ramap_2o (SCM ra0,SCM proc,SCM ras) Line 1485  ramap_2o (SCM ra0,SCM proc,SCM ras)
1485    
1486    
1487  static int  static int
1488  ramap_a (SCM ra0,SCM proc,SCM ras)  ramap_a (SCM ra0, SCM proc, SCM ras)
1489  {  {
1490    SCM e0 = SCM_UNDEFINED, e1 = SCM_UNDEFINED;    SCM e0 = SCM_UNDEFINED, e1 = SCM_UNDEFINED;
1491    long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1;    long n = SCM_ARRAY_DIMS (ra0)->ubnd - SCM_ARRAY_DIMS (ra0)->lbnd + 1;
# Line 1521  SCM_DEFINE (scm_array_map_x, "array-map! Line 1523  SCM_DEFINE (scm_array_map_x, "array-map!
1523              "unspecified.  The order of application is unspecified.")              "unspecified.  The order of application is unspecified.")
1524  #define FUNC_NAME s_scm_array_map_x  #define FUNC_NAME s_scm_array_map_x
1525  {  {
1526    SCM_VALIDATE_PROC (2,proc);    SCM_VALIDATE_PROC (2, proc);
1527    SCM_VALIDATE_REST_ARGUMENT (lra);    SCM_VALIDATE_REST_ARGUMENT (lra);
1528    switch (SCM_TYP7 (proc))    switch (SCM_TYP7 (proc))
1529      {      {
# Line 1624  SCM_DEFINE (scm_array_map_x, "array-map! Line 1626  SCM_DEFINE (scm_array_map_x, "array-map!
1626    
1627    
1628  static int  static int
1629  rafe (SCM ra0,SCM proc,SCM ras)  rafe (SCM ra0, SCM proc, SCM ras)
1630  {  {
1631    long i = SCM_ARRAY_DIMS (ra0)->lbnd;    long i = SCM_ARRAY_DIMS (ra0)->lbnd;
1632    unsigned long i0 = SCM_ARRAY_BASE (ra0);    unsigned long i0 = SCM_ARRAY_BASE (ra0);
# Line 1637  rafe (SCM ra0,SCM proc,SCM ras) Line 1639  rafe (SCM ra0,SCM proc,SCM ras)
1639    else    else
1640      {      {
1641        SCM ra1 = SCM_CAR (ras);        SCM ra1 = SCM_CAR (ras);
1642        SCM args, *ve = &ras;        SCM args;
1643          SCM const*ve = &ras;
1644        unsigned long k, i1 = SCM_ARRAY_BASE (ra1);        unsigned long k, i1 = SCM_ARRAY_BASE (ra1);
1645        long inc1 = SCM_ARRAY_DIMS (ra1)->inc;        long inc1 = SCM_ARRAY_DIMS (ra1)->inc;
1646        ra1 = SCM_ARRAY_V (ra1);        ra1 = SCM_ARRAY_V (ra1);
# Line 1668  SCM_DEFINE (scm_array_for_each, "array-f Line 1671  SCM_DEFINE (scm_array_for_each, "array-f
1671              "in row-major order.  The value returned is unspecified.")              "in row-major order.  The value returned is unspecified.")
1672  #define FUNC_NAME s_scm_array_for_each  #define FUNC_NAME s_scm_array_for_each
1673  {  {
1674    SCM_VALIDATE_PROC (1,proc);    SCM_VALIDATE_PROC (1, proc);
1675    SCM_VALIDATE_REST_ARGUMENT (lra);    SCM_VALIDATE_REST_ARGUMENT (lra);
1676    scm_ramapc (rafe, proc, ra0, lra, FUNC_NAME);    scm_ramapc (rafe, proc, ra0, lra, FUNC_NAME);
1677    return SCM_UNSPECIFIED;    return SCM_UNSPECIFIED;
# Line 1697  SCM_DEFINE (scm_array_index_map_x, "arra Line 1700  SCM_DEFINE (scm_array_index_map_x, "arra
1700  #define FUNC_NAME s_scm_array_index_map_x  #define FUNC_NAME s_scm_array_index_map_x
1701  {  {
1702    unsigned long i;    unsigned long i;
1703    SCM_VALIDATE_NIM (1,ra);    SCM_VALIDATE_NIM (1, ra);
1704    SCM_VALIDATE_PROC (2,proc);    SCM_VALIDATE_PROC (2, proc);
1705    switch (SCM_TYP7(ra))    switch (SCM_TYP7(ra))
1706      {      {
1707      default:      default:
# Line 1706  SCM_DEFINE (scm_array_index_map_x, "arra Line 1709  SCM_DEFINE (scm_array_index_map_x, "arra
1709      case scm_tc7_vector:      case scm_tc7_vector:
1710      case scm_tc7_wvect:      case scm_tc7_wvect:
1711        {        {
         SCM *ve = SCM_VELTS (ra);  
1712          for (i = 0; i < SCM_VECTOR_LENGTH (ra); i++)          for (i = 0; i < SCM_VECTOR_LENGTH (ra); i++)
1713            ve[i] = scm_call_1 (proc, SCM_MAKINUM (i));            SCM_VECTOR_SET(ra, i, scm_call_1 (proc, SCM_MAKINUM (i)));
1714          return SCM_UNSPECIFIED;          return SCM_UNSPECIFIED;
1715        }        }
1716      case scm_tc7_string:      case scm_tc7_string:
# Line 1778  SCM_DEFINE (scm_array_index_map_x, "arra Line 1780  SCM_DEFINE (scm_array_index_map_x, "arra
1780    
1781    
1782  static int  static int
1783  raeql_1 (SCM ra0,SCM as_equal,SCM ra1)  raeql_1 (SCM ra0, SCM as_equal, SCM ra1)
1784  {  {
1785    SCM e0 = SCM_UNDEFINED, e1 = SCM_UNDEFINED;    SCM e0 = SCM_UNDEFINED, e1 = SCM_UNDEFINED;
1786    unsigned long i0 = 0, i1 = 0;    unsigned long i0 = 0, i1 = 0;
# Line 1906  raeql_1 (SCM ra0,SCM as_equal,SCM ra1) Line 1908  raeql_1 (SCM ra0,SCM as_equal,SCM ra1)
1908    
1909    
1910  static int  static int
1911  raeql (SCM ra0,SCM as_equal,SCM ra1)  raeql (SCM ra0, SCM as_equal, SCM ra1)
1912  {  {
1913    SCM v0 = ra0, v1 = ra1;    SCM v0 = ra0, v1 = ra1;
1914    scm_t_array_dim dim0, dim1;    scm_t_array_dim dim0, dim1;

Legend:
Removed from v.1.80  
changed lines
  Added in v.1.81

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26