diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:31 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:31 -0800 |
commit | ae2b295c7deaf2d7c18ad1ed9b6050970e56bae7 (patch) | |
tree | eee15e02ae016333546d3841712be591b2bcb06f /ramap.c | |
parent | 302e3218b7d487539ec305bf23881a6ee7d5be99 (diff) | |
download | scm-ae2b295c7deaf2d7c18ad1ed9b6050970e56bae7.tar.gz scm-ae2b295c7deaf2d7c18ad1ed9b6050970e56bae7.zip |
Import Upstream version 5e2upstream/5e2
Diffstat (limited to 'ramap.c')
-rw-r--r-- | ramap.c | 78 |
1 files changed, 39 insertions, 39 deletions
@@ -97,7 +97,7 @@ int ra_matchp(ra0, ras) sizet bas0 = 0; int i, ndim = 1; int exact = 2 /* 4 */; /* Don't care about values >2 (yet?) */ - if IMP(ra0) return 0; + if (IMP(ra0)) return 0; switch TYP7(ra0) { default: return 0; case tc7_vector: @@ -163,7 +163,7 @@ static char s_ra_mismatch[] = "array shape mismatch"; int ramapc(cproc, data, ra0, lra, what) int (*cproc)(); SCM data, ra0, lra; - char *what; + const char *what; { SCM z, vra0, ra1, vra1; SCM lvra, *plvra; @@ -174,7 +174,7 @@ int ramapc(cproc, data, ra0, lra, what) case 2: case 3: case 4: /* Try unrolling arrays */ if (kmax < 0) goto gencase; vra0 = (0==kmax ? ra0 : array_contents(ra0, UNDEFINED)); - if IMP(vra0) goto gencase; + if (IMP(vra0)) goto gencase; if (!ARRAYP(vra0)) { vra1 = make_ra(1); ARRAY_BASE(vra1) = 0; @@ -188,7 +188,7 @@ int ramapc(cproc, data, ra0, lra, what) plvra = &lvra; for (z = lra; NIMP(z); z = CDR(z)) { vra1 = ra1 = (0==kmax ? CAR(z) : array_contents(CAR(z), UNDEFINED)); - if FALSEP(ra1) goto gencase; + if (FALSEP(ra1)) goto gencase; if (!ARRAYP(ra1)) { vra1 = make_ra(1); ARRAY_DIMS(vra1)->lbnd = ARRAY_DIMS(vra0)->lbnd; @@ -212,7 +212,7 @@ int ramapc(cproc, data, ra0, lra, what) indv = (long *)VELTS(hp_indv); } vra0 = make_ra(1); - if ARRAYP(ra0) { + if (ARRAYP(ra0)) { if (kmax < 0) { ARRAY_DIMS(vra0)->lbnd = 0; ARRAY_DIMS(vra0)->ubnd = 0; @@ -241,7 +241,7 @@ int ramapc(cproc, data, ra0, lra, what) vra1 = make_ra(1); ARRAY_DIMS(vra1)->lbnd = ARRAY_DIMS(vra0)->lbnd; ARRAY_DIMS(vra1)->ubnd = ARRAY_DIMS(vra0)->ubnd; - if ARRAYP(ra1) { + if (ARRAYP(ra1)) { if (kmax >= 0) ARRAY_DIMS(vra1)->inc = ARRAY_DIMS(ra1)[kmax].inc; ARRAY_V(vra1) = ARRAY_V(ra1); @@ -514,7 +514,7 @@ SCM sc2array(s, ra, prot) { SCM res; ASRTER(NIMP(ra), ra, ARG2, s_sc2array); - if ARRAYP(ra) { + if (ARRAYP(ra)) { int k = ARRAY_NDIM(ra); res = make_ra(k); while (k--) { @@ -545,7 +545,7 @@ SCM sc2array(s, ra, prot) if (BOOL_T==s || BOOL_F==s) break; goto mismatch; case tc7_string: - if ICHRP(s) break; + if (ICHRP(s)) break; goto mismatch; case tc7_uvect: if (INUMP(s) && INUM(s)>=0) break; @@ -554,7 +554,7 @@ SCM sc2array(s, ra, prot) #endif goto mismatch; case tc7_ivect: - if INUMP(s) break; + if (INUMP(s)) break; #ifdef BIGDIG if (NIMP(s) && BIGP(s) && NUMDIGS(s)<=DIGSPERLONG) break; #endif @@ -565,7 +565,7 @@ SCM sc2array(s, ra, prot) if (NUMBERP(s) && !(NIMP(s) && CPLXP(s))) break; goto mismatch; case tc7_cvect: - if NUMBERP(s) break; + if (NUMBERP(s)) break; goto mismatch; #endif mismatch: ARRAY_V(res) = make_vector(MAKINUM(1), s); @@ -592,33 +592,33 @@ int ra_eqp(ra0, ras) default: { SCM e1 = UNDEFINED, e2 = UNDEFINED; for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) - if FALSEP(eqp(RVREF(ra1, i1, e1), RVREF(ra2, i2, e2))) + if (BVE_REF(ra0, i0)) + if (FALSEP(eqp(RVREF(ra1, i1, e1), RVREF(ra2, i2, e2)))) BVE_CLR(ra0, i0); break; } case tc7_uvect: case tc7_ivect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (VELTS(ra1)[i1] != VELTS(ra2)[i2]) BVE_CLR(ra0, i0); break; # ifdef FLOATS case tc7_fvect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (((float *)VELTS(ra1))[i1] != ((float *)VELTS(ra2))[i2]) BVE_CLR(ra0, i0); break; case tc7_dvect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (((double *)VELTS(ra1))[i1] != ((double *)VELTS(ra2))[i2]) BVE_CLR(ra0, i0); break; case tc7_cvect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (((double *)VELTS(ra1))[2*i1] != ((double *)VELTS(ra2))[2*i2] || ((double *)VELTS(ra1))[2*i1+1] != ((double *)VELTS(ra2))[2*i2+1]) BVE_CLR(ra0, i0); @@ -644,7 +644,7 @@ static int ra_compare(ra0, ra1, ra2, opt) default: { SCM e1 = UNDEFINED, e2 = UNDEFINED; for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (opt ? NFALSEP(lessp(RVREF(ra1, i1, e1), RVREF(ra2, i2, e2))) : FALSEP(lessp(RVREF(ra1, i1, e1), RVREF(ra2, i2, e2))) ) @@ -653,7 +653,7 @@ static int ra_compare(ra0, ra1, ra2, opt) } case tc7_uvect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) { - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (opt ? ((unsigned long*)VELTS(ra1))[i1] < ((unsigned long*)VELTS(ra2))[i2] : ((unsigned long*)VELTS(ra1))[i1] >= ((unsigned long*)VELTS(ra2))[i2]) @@ -662,7 +662,7 @@ static int ra_compare(ra0, ra1, ra2, opt) break; case tc7_ivect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) { - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (opt ? VELTS(ra1)[i1] < VELTS(ra2)[i2] : VELTS(ra1)[i1] >= VELTS(ra2)[i2]) @@ -672,7 +672,7 @@ static int ra_compare(ra0, ra1, ra2, opt) # ifdef FLOATS case tc7_fvect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (opt ? ((float *)VELTS(ra1))[i1] < ((float *)VELTS(ra2))[i2] : ((float *)VELTS(ra1))[i1] >= ((float *)VELTS(ra2))[i2]) @@ -680,7 +680,7 @@ static int ra_compare(ra0, ra1, ra2, opt) break; case tc7_dvect: for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) + if (BVE_REF(ra0, i0)) if (opt ? ((double *)VELTS(ra1))[i1] < ((double *)VELTS(ra2))[i2] : ((double *)VELTS(ra1))[i1] >= ((double *)VELTS(ra2))[i2]) @@ -718,7 +718,7 @@ int ra_sum(ra0, ras) sizet i0 = ARRAY_BASE(ra0); long inc0 = ARRAY_DIMS(ra0)->inc; ra0 = ARRAY_V(ra0); - if NNULLP(ras) { + if (NNULLP(ras)) { SCM ra1 = CAR(ras); sizet i1 = ARRAY_BASE(ra1); long inc1 = ARRAY_DIMS(ra1)->inc; @@ -794,7 +794,7 @@ int ra_difference(ra0, ras) sizet i0 = ARRAY_BASE(ra0); long inc0 = ARRAY_DIMS(ra0)->inc; ra0 = ARRAY_V(ra0); - if NULLP(ras) { + if (NULLP(ras)) { switch TYP7(ra0) { default: { SCM e0 = UNDEFINED; @@ -907,7 +907,7 @@ int ra_product(ra0, ras) sizet i0 = ARRAY_BASE(ra0); long inc0 = ARRAY_DIMS(ra0)->inc; ra0 = ARRAY_V(ra0); - if NNULLP(ras) { + if (NNULLP(ras)) { SCM ra1 = CAR(ras); sizet i1 = ARRAY_BASE(ra1); long inc1 = ARRAY_DIMS(ra1)->inc; @@ -984,7 +984,7 @@ int ra_divide(ra0, ras) sizet i0 = ARRAY_BASE(ra0); long inc0 = ARRAY_DIMS(ra0)->inc; ra0 = ARRAY_V(ra0); - if NULLP(ras) { + if (NULLP(ras)) { switch TYP7(ra0) { default: { SCM e0 = UNDEFINED; @@ -1168,8 +1168,8 @@ static int ramap_rp(ra0, proc, ras) ra1 = ARRAY_V(ra1); ra2 = ARRAY_V(ra2); for (; n-- > 0; i0 += inc0, i1 += inc1, i2 += inc2) - if BVE_REF(ra0, i0) - if FALSEP(SUBRF(proc)(RVREF(ra1, i1, e1), RVREF(ra2, i2, e2))) + if (BVE_REF(ra0, i0)) + if (FALSEP(SUBRF(proc)(RVREF(ra1, i1, e1), RVREF(ra2, i2, e2)))) BVE_CLR(ra0, i0); return 1; } @@ -1202,7 +1202,7 @@ static int ramap_2o(ra0, proc, ras) ra0 = ARRAY_V(ra0); ra1 = ARRAY_V(ra1); ras = CDR(ras); - if NULLP(ras) { + if (NULLP(ras)) { if (tc7_vector==TYP7(ra0)) for (; n-- > 0; i0 += inc0, i1 += inc1) VELTS(ra0)[i0] = SUBRF(proc)(cvref(ra1, i1, UNDEFINED), UNDEFINED); @@ -1237,7 +1237,7 @@ static int ramap_a(ra0, proc, ras) sizet i0 = ARRAY_BASE(ra0); long inc0 = ARRAY_DIMS(ra0)->inc; ra0 = ARRAY_V(ra0); - if NULLP(ras) + if (NULLP(ras)) for (; n-- > 0; i0 += inc0) aset(ra0, SUBRF(proc)(RVREF(ra0, i0, e0), UNDEFINED), MAKINUM(i0)); else { @@ -1314,9 +1314,9 @@ SCM array_map(ra0, proc, lra) return UNSPECIFIED; } case tc7_asubr: - if NULLP(lra) { + if (NULLP(lra)) { SCM prot, fill = SUBRF(proc)(UNDEFINED, UNDEFINED); - if INUMP(fill) { + if (INUMP(fill)) { prot = array_prot(ra0); # ifdef FLOATS if (NIMP(prot) && INEXP(prot)) @@ -1353,7 +1353,7 @@ SCM array_map(ra0, proc, lra) } ramapc(ramap_2o, proc, ra0, lra, s_array_map); lra = CDR(lra); - if NIMP(lra) + if (NIMP(lra)) for (lra = CDR(lra); NIMP(lra); lra = CDR(lra)) ramapc(ramap_a, proc, ra0, lra, s_array_map); } @@ -1506,13 +1506,13 @@ static int raeql_1(ra0, as_equal, ra1) long inc0 = 1, inc1 = 1; sizet n = LENGTH(ra0); ra1 = CAR(ra1); - if ARRAYP(ra0) { + if (ARRAYP(ra0)) { n = ARRAY_DIMS(ra0)->ubnd - ARRAY_DIMS(ra0)->lbnd + 1; i0 = ARRAY_BASE(ra0); inc0 = ARRAY_DIMS(ra0)->inc; ra0 = ARRAY_V(ra0); } - if ARRAYP(ra1) { + if (ARRAYP(ra1)) { i1 = ARRAY_BASE(ra1); inc1 = ARRAY_DIMS(ra1)->inc; ra1 = ARRAY_V(ra1); @@ -1520,12 +1520,12 @@ static int raeql_1(ra0, as_equal, ra1) switch TYP7(ra0) { case tc7_vector: default: for (; n--; i0+=inc0, i1+=inc1) { - if FALSEP(as_equal) { - if FALSEP(array_equal(RVREF(ra0, i0, e0), RVREF(ra1, i1, e1))) + if (FALSEP(as_equal)) { + if (FALSEP(array_equal(RVREF(ra0, i0, e0), RVREF(ra1, i1, e1)))) return 0; } else - if FALSEP(equal(RVREF(ra0, i0, e0), RVREF(ra1, i1, e1))) + if (FALSEP(equal(RVREF(ra0, i0, e0), RVREF(ra1, i1, e1)))) return 0; } return 1; @@ -1582,7 +1582,7 @@ static int raeql(ra0, as_equal, ra1) array_dim *s0 = &dim0, *s1 = &dim1; sizet bas0 = 0, bas1 = 0; int k, unroll = 1, ndim = 1; - if ARRAYP(ra0) { + if (ARRAYP(ra0)) { ndim = ARRAY_NDIM(ra0); s0 = ARRAY_DIMS(ra0); bas0 = ARRAY_BASE(ra0); @@ -1591,7 +1591,7 @@ static int raeql(ra0, as_equal, ra1) else { s0->inc = 1; s0->lbnd = 0; s0->ubnd = LENGTH(v0) - 1; } - if ARRAYP(ra1) { + if (ARRAYP(ra1)) { if (ndim != ARRAY_NDIM(ra1)) return 0; s1 = ARRAY_DIMS(ra1); bas1 = ARRAY_BASE(ra1); |