Skip to content

Commit a32c705

Browse files
committed
Replace simple jt-macro calls with function calls
1 parent 7ad5f02 commit a32c705

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1024
-1024
lines changed

jsrc/adverbs/a.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jtbdot2(J jt, A a, A w, A self) {
6565

6666
static A
6767
jtbdot1(J jt, A w, A self) {
68-
return bdot2(num(0), w, self);
68+
return jtbdot2(jt, num(0), w, self);
6969
}
7070

7171
static A
@@ -258,7 +258,7 @@ jtmemo1(J jt, A w, A self) {
258258
x = IMIN;
259259
y = jtint0(jt, w);
260260
if (y == IMIN) return CALL1(f1, w, fs);
261-
return (z = memoget(x, y, self)) ? z : memoput(x, y, self, CALL1(f1, w, fs));
261+
return (z = jtmemoget(jt, x, y, self)) ? z : jtmemoput(jt, x, y, self, CALL1(f1, w, fs));
262262
}
263263

264264
static A
@@ -269,9 +269,9 @@ jtmemo2(J jt, A a, A w, A self) {
269269
x = jtint0(jt, a);
270270
y = jtint0(jt, w);
271271
if (MIN(x, y) == IMIN) return CALL2(f2, a, w, fs); // IMIN is unmemoable, run fn
272-
return (z = memoget(x, y, self))
272+
return (z = jtmemoget(jt, x, y, self))
273273
? z
274-
: memoput(x,
274+
: jtmemoput(jt, x,
275275
y,
276276
self,
277277
CALL2(f2, a, w, fs)); // if memo lookup returns empty, run the function and remember the result

jsrc/adverbs/af.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jtfixa(J jt, A a, A w) {
147147
}
148148
f = REFIXA(0, f);
149149
h = REFIXA(0, h);
150-
return xop2(f, h, g);
150+
return jtxop2(jt, f, h, g);
151151
} else {
152152
f = REFIXA(1, f);
153153
g = REFIXA(2, g);
@@ -165,11 +165,11 @@ jtfixa(J jt, A a, A w) {
165165
f = REFIXA(na, f);
166166
g = REFIXA(ID(f) == CCAP ? 1 : 2, g);
167167
h = REFIXA(na, h);
168-
return folk(f, g, h); // f first in case it's [:
168+
return jtfolk(jt, f, g, h); // f first in case it's [:
169169
case CATDOT:
170170
case CGRCO:
171171
IAV0(aa)[0] = (aif | na);
172-
RZ(f = jtevery(jt, every2(aa, h, (A)&arofixaself), (A)&arofixaself)); // full A block required for call
172+
RZ(f = jtevery(jt, jtevery2(jt, aa, h, (A)&arofixaself), (A)&arofixaself)); // full A block required for call
173173
RZ(g = REFIXA(na, g));
174174
return df2(z, f, g, wf);
175175
case CIBEAM:

jsrc/adverbs/ai.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jtfong(J jt, A a, A w) {
3535
c = v->id;
3636
f = v->fgh[0];
3737
return c == CRIGHT ? w
38-
: c == CFORK && (NOUN & AT(f) || CCAP == ID(f)) ? folk(f, v->fgh[1], jtfong(jt, v->fgh[2], w))
39-
: folk(ds(CCAP), a, w);
38+
: c == CFORK && (NOUN & AT(f) || CCAP == ID(f)) ? jtfolk(jt, f, v->fgh[1], jtfong(jt, v->fgh[2], w))
39+
: jtfolk(jt, ds(CCAP), a, w);
4040
} // [: f g with simplifications: [: ] w -> w; [: (N/[: x y) w -> N/[: x [: y w and y omittrd if ]
4141

4242
static A
@@ -58,9 +58,9 @@ jtinvfork(J jt, A w) {
5858
if (CAMP == ID(gi)) {
5959
v = FAV(gi);
6060
if (NOUN & AT(v->fgh[0]))
61-
RZ(gi = folk(v->fgh[0], v->fgh[1], ds(CRIGHT)))
61+
RZ(gi = jtfolk(jt, v->fgh[0], v->fgh[1], ds(CRIGHT)))
6262
else if (NOUN & AT(v->fgh[1]))
63-
RZ(gi = folk(v->fgh[1], jtswap(jt, v->fgh[0]), ds(CRIGHT)));
63+
RZ(gi = jtfolk(jt, v->fgh[1], jtswap(jt, v->fgh[0]), ds(CRIGHT)));
6464
}
6565
return jtfong(jt, fi, gi);
6666
}
@@ -280,7 +280,7 @@ jtinvamp(J jt, A w) {
280280
case CBASE:
281281
if (!nf) break;
282282
return AR(x) ? jtamp(jt, x, ds(CABASE))
283-
: jtobverse(jt, evc(x, mag(x), "$&u@>:@(v&(<.@^.))@(1&>.)@(>./)@:|@, #: ]"), w);
283+
: jtobverse(jt, jtevc(jt, x, mag(x), "$&u@>:@(v&(<.@^.))@(1&>.)@(>./)@:|@, #: ]"), w);
284284
case CATOMIC:
285285
if (ng) {
286286
ASSERT(jtequ(jt, x, jtnub(jt, x)), EVDOMAIN);
@@ -440,7 +440,7 @@ jtinv(J jt, A w, I recur) {
440440
case CPOWOP:
441441
if (vf && ng) {
442442
RE(p = jti0(jt, g));
443-
return -1 == p ? f : 1 == p ? invrecur(f) : powop(0 > p ? f : invrecur(f), jtsc(jt, ABS(p)), 0);
443+
return -1 == p ? f : 1 == p ? invrecur(f) : jtpowop(jt, 0 > p ? f : invrecur(f), jtsc(jt, ABS(p)), 0);
444444
}
445445
if (VGERL & v->flag) return *(1 + AAV(v->fgh[2]));
446446
break;
@@ -604,7 +604,7 @@ jtiden(J jt, A w) {
604604
break;
605605
}
606606
ASSERT(x != 0, EVDOMAIN);
607-
return folk(x, jtswap(jt, ds(CDOLLAR)), jtatop(jt, ds(CBEHEAD), ds(CDOLLAR)));
607+
return jtfolk(jt, x, jtswap(jt, ds(CDOLLAR)), jtatop(jt, ds(CBEHEAD), ds(CDOLLAR)));
608608
}
609609

610610
A
@@ -628,5 +628,5 @@ jtidensb(J jt, A w) {
628628
break;
629629
}
630630
ASSERT(x != 0, EVDOMAIN);
631-
return folk(x, jtswap(jt, ds(CDOLLAR)), jtatop(jt, ds(CBEHEAD), ds(CDOLLAR)));
631+
return jtfolk(jt, x, jtswap(jt, ds(CDOLLAR)), jtatop(jt, ds(CBEHEAD), ds(CDOLLAR)));
632632
}

jsrc/adverbs/am.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jtcasev(J jt, A w) {
167167
// have to make sure abc is locally defined
168168
if (p = q && 0 <= c && ACUC1 >= AC(u[c])) { // passes quick check
169169
p = (AN(jt->locsyms) == 1) || CAV(AAV(v[m + 2])[1])[0] != CASGN ||
170-
probe(
170+
jtprobe(jt,
171171
NAV(AAV(v[m + 2])[0])->m,
172172
NAV(AAV(v[m + 2])[0])->s,
173173
NAV(AAV(v[m + 2])[0])->hash,
@@ -436,7 +436,7 @@ jtjstd(J jt, A w, A ind, I *cellframelen) {
436436
return x;
437437
} // if w is an atom, the best you can get is indexes of 0. No axes are used
438438
if ((b & -AR(ind)) < 0) { // array of boxed indexes
439-
RE(aindex(ind, w, 0L, &j)); // see if the boxes are homogeneous
439+
RE(jtaindex(jt, ind, w, 0L, &j)); // see if the boxes are homogeneous
440440
if (!j) { // if not...
441441
RZ(x = MODIFIABLE(jtfrom(jt, ind, jtincrem(jt, jtiota(jt, shape(jt, w))))));
442442
u = AV(x); // go back to the original indexes, select from table of all possible incremented indexes; since
@@ -507,7 +507,7 @@ jtamendn2(J jt, A a, A w, A self) {
507507
AD *RESTRICT ind = VAV(self)->fgh[0];
508508
if (!((AT(w) | AT(ind)) & SPARSE)) {
509509
I cellframelen;
510-
ind = jstd(w, ind, &cellframelen); // convert indexes to cell indexes; remember how many were converted
510+
ind = jtjstd(jt, w, ind, &cellframelen); // convert indexes to cell indexes; remember how many were converted
511511
z = jtmerge2(
512512
jtinplace, AT(a) & SPARSE ? jtdenseit(jt, a) : a, w, ind, cellframelen); // dense a if needed; dense amend
513513
// We modified w which is now not pristine.
@@ -552,7 +552,7 @@ jtamendn2(J jt, A a, A w, A self) {
552552
: AT(a) & SPARSE ? jtam1sp
553553
: jtam1a)(jt, a, z, AT(ind) & NUMERIC ? jtbox(jt, ind) : jtope(jt, ind), ip);
554554
else {
555-
RE(aindex(ind, z, 0L, (A *)&ind));
555+
RE(jtaindex(jt, ind, z, 0L, (A *)&ind));
556556
ASSERT(ind != 0, EVNONCE);
557557
z = (b ? jtamne : AT(a) & SPARSE ? jtamnsp : jtamna)(jt, a, z, ind, ip);
558558
} // A* for the #$&^% type-checking

jsrc/adverbs/am1.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jtipart(J jt, A z, A ind, A *i1, A *i2) {
119119
n = AN(ind);
120120
iv = AAV(ind);
121121
zp = PAV(z);
122-
RZ(b = bfi(AR(z), SPA(zp, a), 1));
122+
RZ(b = jtbfi(jt, AR(z), SPA(zp, a), 1));
123123
c = 0;
124124
DO(n, if (b[i])++ c;);
125125
d = n - c;
@@ -190,7 +190,7 @@ jtscubb(J jt, A z, A i1) {
190190
A a, q, x, y;
191191
I c, d, h, j, *s, *v, *xv;
192192
P *zp;
193-
RZ(q = scuba(z, i1, 1));
193+
RZ(q = jtscuba(jt, z, i1, 1));
194194
if (!*AS(q)) return mtm;
195195
s = AS(z);
196196
zp = PAV(z);
@@ -206,7 +206,7 @@ jtscubb(J jt, A z, A i1) {
206206
xv = AV(x);
207207
j = c;
208208
DO(h, xv[i] = s[v[j++]];);
209-
RZ(x = odom(2L, h, xv));
209+
RZ(x = jtodom(jt, 2L, h, xv));
210210
c = *AS(q);
211211
d = *AS(x);
212212
return jtstitch(jt, jtrepeat(jt, jtsc(jt, d), q), jtreitem(jt, jtsc(jt, c * d), x));
@@ -247,7 +247,7 @@ jtscubc(J jt, A z, A i1, A p) {
247247
RZ(y1 = jtrepeat(jt, q, y1));
248248
c = *AS(y1);
249249
if (!c) return mtm;
250-
return jtless(jt, jtstitch(jt, jtrepeat(jt, jtsc(jt, d), y1), jtreitem(jt, jtsc(jt, c * d), odom(2L, h, sv))), y);
250+
return jtless(jt, jtstitch(jt, jtrepeat(jt, jtsc(jt, d), y1), jtreitem(jt, jtsc(jt, c * d), jtodom(jt, 2L, h, sv))), y);
251251
} /* new rows for the index matrix of z for existing cells */
252252

253253
static A
@@ -257,7 +257,7 @@ jtscube(J jt, A z, A i1, A p) {
257257
zp = PAV(z);
258258
a = SPA(zp, a);
259259
y = SPA(zp, i);
260-
return !AN(a) && !*AS(y) ? jttake(jt, num(1), mtm) : jtover(jt, jtscubb(jt, z, i1), scubc(z, i1, p));
260+
return !AN(a) && !*AS(y) ? jttake(jt, num(1), mtm) : jtover(jt, jtscubb(jt, z, i1), jtscubc(jt, z, i1, p));
261261
} /* new rows for the index matrix of z */
262262

263263
static A
@@ -268,10 +268,10 @@ jtiindx(J jt, A z, A i1) {
268268
c = AN(i1);
269269
zp = PAV(z);
270270
y = SPA(zp, i);
271-
if (c == *(1 + AS(y))) return jtindexof(jt, y, scuba(z, i1, 0));
271+
if (c == *(1 + AS(y))) return jtindexof(jt, y, jtscuba(jt, z, i1, 0));
272272
/* when y has excess columns, do progressive indexing */
273273
RZ(y = jttaker(jt, c, y));
274-
RZ(j = jtindexof(jt, y, scuba(z, i1, 0))); /* j: group indices */
274+
RZ(j = jtindexof(jt, y, jtscuba(jt, z, i1, 0))); /* j: group indices */
275275
n = AN(j);
276276
jv = AV(j);
277277
m = *AS(y);
@@ -347,7 +347,7 @@ jtam1e(J jt, A a, A z, A ind, B ip) {
347347
e = SPA(zp, e);
348348
RZ(p = jtssel(jt, z, ind));
349349
pv = BAV(p);
350-
RZ(ipart(z, ind, &i1, &i2));
350+
RZ(jtipart(jt, z, ind, &i1, &i2));
351351
m = AN(p);
352352
n = AN(i2);
353353
u = CAV(e);
@@ -375,10 +375,10 @@ jtam1a(J jt, A a, A z, A ind, B ip) {
375375
I ar, c, *iv, *jv, k, m, n, r, *s, uk, vk, xk;
376376
P *zp;
377377
RZ(a && (ind = jtistd1(jt, z, ind)));
378-
RZ(a = astd1(a, z, ind));
378+
RZ(a = jtastd1(jt, a, z, ind));
379379
if (mtind(ind)) return z;
380-
RZ(ipart(z, ind, &i1, &i2));
381-
RZ(z = zpad1(z, scube(z, i1, jtssel(jt, z, ind)), ip));
380+
RZ(jtipart(jt, z, ind, &i1, &i2));
381+
RZ(z = jtzpad1(jt, z, jtscube(jt, z, i1, jtssel(jt, z, ind)), ip));
382382
zp = PAV(z);
383383
x = SPA(zp, x);
384384
y = SPA(zp, i);
@@ -398,7 +398,7 @@ jtam1a(J jt, A a, A z, A ind, B ip) {
398398
m = AN(t);
399399
if (!n && !m) {
400400
a1 = SPA(zp, a);
401-
return ar ? sparseit(a0, a1, e) : sparseit(jtreshape(jt, shape(jt, z), a), a1, a);
401+
return ar ? jtsparseit(jt, a0, a1, e) : jtsparseit(jt, jtreshape(jt, shape(jt, z), a), a1, a);
402402
}
403403
if (n) {
404404
RZ(t = jtdcube(jt, z, i2));
@@ -417,6 +417,6 @@ jtam1a(J jt, A a, A z, A ind, B ip) {
417417

418418
A
419419
jtam1sp(J jt, A a, A z, A ind, B ip) {
420-
return amnsp(a, z, jtope(jt, jtcatalog(jt, jtistd1(jt, z, ind))), ip);
420+
return jtamnsp(jt, a, z, jtope(jt, jtcatalog(jt, jtistd1(jt, z, ind))), ip);
421421
}
422422
/* a (<ind)}z; sparse z; ind is index list; arbitrary sparse array a replacement */

jsrc/adverbs/amn.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jtcsize(J jt, A z, A ind) {
1717
r = AR(z);
1818
s = AS(z);
1919
zp = PAV(z);
20-
RZ(b = bfi(r, SPA(zp, a), 0));
20+
RZ(b = jtbfi(jt, r, SPA(zp, a), 0));
2121
m = 1;
2222
j = h = *(AR(ind) + AS(ind) - 1);
2323
DQ(r - h, if (b[j]) m *= s[j]; ++j;);
@@ -48,7 +48,7 @@ jtiaddr(J jt, A z, A ind, A* i1, A* i2) {
4848
e = 0;
4949
d = 1;
5050
DO(n, if (h > u[i]) v[e++] = s[i]; else d *= s[i];);
51-
RZ(*i2 = jj = tymes(jtsc(jt, d), jtbase2(jt, vec(INT, e, v), jtrepeatr(jt, jteps(jt, ai, as), ind))));
51+
RZ(*i2 = jj = tymes(jtsc(jt, d), jtbase2(jt, jtvec(jt, INT, e, v), jtrepeatr(jt, jteps(jt, ai, as), ind))));
5252
c = *(1 + AS(y));
5353
if (!c) {
5454
n = AN(jj);
@@ -106,7 +106,7 @@ jtzpadn(J jt, A z, A ind, B ip) {
106106
RZ(p = jtnub(jt, jtless(jt, i1, y1)));
107107
if (c = AN(a) - d) {
108108
RZ(t = jtfrom(jt, jtless(jt, a, ai), shape(jt, z)));
109-
RZ(p1 = odom(2L, c, AV(t)));
109+
RZ(p1 = jtodom(jt, 2L, c, AV(t)));
110110
n = *AS(p1);
111111
if (m = *AS(p)) RZ(p = jtstitch(jt, jtrepeat(jt, jtsc(jt, n), p), jtreshape(jt, jtv2(jt, n * m, c), p1)));
112112
RZ(t = jtnub(jt, jtrepeat(jt, jteps(jt, y1, i1), y1)));
@@ -171,7 +171,7 @@ jtastdn(J jt, A a, A z, A ind) {
171171
v = AV(r);
172172
*v++ = ar - (zr - n);
173173
DQ(zr - n, *v++ = 1;);
174-
RZ(q = jtdgrade1(jt, jtrepeat(jt, r, vec(B01, zr - n1, b + n1))));
174+
RZ(q = jtdgrade1(jt, jtrepeat(jt, r, jtvec(jt, B01, zr - n1, b + n1))));
175175
return jtequ(jt, q, IX(ar)) ? a : jtcant2(jt, q, a);
176176
} /* convert replacement array a into standard form relative to index array ind */
177177

@@ -182,7 +182,7 @@ jtamne(J jt, A a, A z, A ind, B ip) {
182182
I *iv, *jv, k, m, n, vk, xk;
183183
P* zp;
184184
RZ(a && z && ind);
185-
RZ(iaddr(z, ind, &i1, &i2));
185+
RZ(jtiaddr(jt, z, ind, &i1, &i2));
186186
zp = PAV(z);
187187
x = SPA(zp, x);
188188
y = SPA(zp, i);
@@ -206,9 +206,9 @@ jtamna(J jt, A a, A z, A ind, B ip) {
206206
I *iv, *jv, k, n, vk, xk;
207207
P* zp;
208208
RZ(a && z && ind);
209-
RZ(z = zpadn(z, ind, ip));
210-
RZ(a = astdn(a, z, ind));
211-
RZ(iaddr(z, ind, &i1, &i2));
209+
RZ(z = jtzpadn(jt, z, ind, ip));
210+
RZ(a = jtastdn(jt, a, z, ind));
211+
RZ(jtiaddr(jt, z, ind, &i1, &i2));
212212
zp = PAV(z);
213213
x = SPA(zp, x);
214214
n = AN(i1);
@@ -237,11 +237,11 @@ jtamnsp(J jt, A a, A z, A ind, B ip) {
237237
ap = PAV(a);
238238
t = SPA(ap, a);
239239
if (r > AN(t)) RZ(a = jtreaxis(jt, IX(r), a));
240-
RZ(a = astdn(a, z, ind));
240+
RZ(a = jtastdn(jt, a, z, ind));
241241
ap = PAV(a);
242-
RZ(z = zpadn(z, ind, ip));
242+
RZ(z = jtzpadn(jt, z, ind, ip));
243243
zp = PAV(z);
244-
RZ(iaddr(z, ind, &i1, &i2));
244+
RZ(jtiaddr(jt, z, ind, &i1, &i2));
245245
s = AS(a);
246246
n = AN(i1);
247247
c = jtcsize(jt, z, ind);

0 commit comments

Comments
 (0)