Skip to content

Commit b525595

Browse files
authored
Merge pull request #186 from juntuu/removal
Macro removal
2 parents 7ad5f02 + 0db982e commit b525595

Some content is hidden

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

104 files changed

+1126
-1401
lines changed

jsrc/adverbs/a.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jtswap(J jt, A w) {
4040
I flag = FAV(w)->flag & (VIRS2 | VJTFLGOK2);
4141
flag = (FAV(w)->flag & VASGSAFE) + flag +
4242
(flag >> 1); // set ASGSAFE, both inplace/irs bits from dyad; ISATOMIC immaterial, since always dyad
43-
return fdef(0, CTILDE, VERB, (AF)(swap1), (AF)(swap2), w, 0L, 0L, flag, (I)(RMAX), (I)(rr(w)), (I)(lr(w)));
43+
return jtfdef(jt, 0, CTILDE, VERB, (AF)(swap1), (AF)(swap2), w, 0L, 0L, flag, (I)(RMAX), (I)(rr(w)), (I)(lr(w)));
4444
} else {
4545
// evoke. Ii must be LIT and convertible to ASCII.
4646
if ((C2T + C4T) & AT(w)) RZ(w = jtcvt(jt, LIT, w)) else ASSERT(LIT & AT(w), EVDOMAIN);
@@ -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
@@ -116,15 +116,15 @@ jtbdot(J jt, A w) {
116116
memcpy(AV(b), booltab, 64L);
117117
RZ(h = jtrifvs(jt, jtcant2(jt, IX(AR(w)), jtfrom(jt, w, b)))); // h is an array representing b. One cell for
118118
// each atom of b; cell is 4 values
119-
return fdef(0, CBDOT, VERB, jtbdot1, jtbdot2, 0L, w, h, VFLAGNONE, RMAX, 0L, 0L);
119+
return jtfdef(jt, 0, CBDOT, VERB, jtbdot1, jtbdot2, 0L, w, h, VFLAGNONE, RMAX, 0L, 0L);
120120
} else
121121
switch (j) {
122122
case 32:
123-
return fdef(0, CBDOT, VERB, jtbitwise1, jtbitwiserotate, 0L, w, 0L, VASGSAFE | VJTFLGOK2, 0L, 0L, 0L);
123+
return jtfdef(jt, 0, CBDOT, VERB, jtbitwise1, jtbitwiserotate, 0L, w, 0L, VASGSAFE | VJTFLGOK2, 0L, 0L, 0L);
124124
case 33:
125-
return fdef(0, CBDOT, VERB, jtbitwise1, jtbitwiseshift, 0L, w, 0L, VASGSAFE | VJTFLGOK2, 0L, 0L, 0L);
125+
return jtfdef(jt, 0, CBDOT, VERB, jtbitwise1, jtbitwiseshift, 0L, w, 0L, VASGSAFE | VJTFLGOK2, 0L, 0L, 0L);
126126
case 34:
127-
return fdef(0, CBDOT, VERB, jtbitwise1, jtbitwiseshifta, 0L, w, 0L, VASGSAFE | VJTFLGOK2, 0L, 0L, 0L);
127+
return jtfdef(jt, 0, CBDOT, VERB, jtbitwise1, jtbitwiseshifta, 0L, w, 0L, VASGSAFE | VJTFLGOK2, 0L, 0L, 0L);
128128
// The code uses a VERB with id CBDOT to stand for the derived verb of m b. . This is used for spellout and
129129
// for inverses, so we retain it. We copy the other information from the verb that executes the function.
130130
// This contains pointers to the routines, and to the function table
@@ -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
@@ -300,7 +300,7 @@ jtmemo(J jt, A w) {
300300
RZ(hv[1] = jtmkwris(jt, q));
301301
GATV0(q, BOX, m, 1);
302302
hv[2] = q;
303-
EPILOG(fdef(0, CMCAP, VERB, jtmemo1, jtmemo2, w, 0L, h, 0L, v->mr, lrv(v), rrv(v)));
303+
EPILOG(jtfdef(jt, 0, CMCAP, VERB, jtmemo1, jtmemo2, w, 0L, h, 0L, v->mr, lrv(v), rrv(v)));
304304
// Now we have converted the verb result to recursive usecount, and gotten rid of the pending tpops for the
305305
// components of h
306306
}

jsrc/adverbs/a.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@
9898
}
9999

100100
#define ADERIV(id, f1, f2, flag, m, l, r) \
101-
fdef(0, id, VERB, (AF)(f1), (AF)(f2), w, 0L, 0L, (flag), (I)(m), (I)(l), (I)(r))
101+
jtfdef(jt, 0, id, VERB, (AF)(f1), (AF)(f2), w, 0L, 0L, (flag), (I)(m), (I)(l), (I)(r))
102102
#define CDERIV(id, f1, f2, flag, m, l, r) \
103-
fdef(0, id, VERB, (AF)(f1), (AF)(f2), a, w, 0L, (flag), (I)(m), (I)(l), (I)(r))
103+
jtfdef(jt, 0, id, VERB, (AF)(f1), (AF)(f2), a, w, 0L, (flag), (I)(m), (I)(l), (I)(r))
104104

105105
#define ASSERTVV(a, w) ASSERT(VERB& AT(a) & AT(w), EVDOMAIN)
106106
#define ASSERTVVn(a, w) ASSERT(VERB& AT(a), EVDOMAIN)

jsrc/adverbs/af.c

+3-3
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

+13-13
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
}
@@ -262,11 +262,11 @@ jtinvamp(J jt, A w) {
262262
case CFIT:
263263
ASSERT(nf && (CPOUND == ID(FAV(g)->fgh[0])), EVDOMAIN);
264264
ASSERT(1 == AR(x), EVRANK);
265-
return fdef(0, CPOWOP, VERB, jtexpandg, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, 0L, 0L);
265+
return jtfdef(jt, 0, CPOWOP, VERB, jtexpandg, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, 0L, 0L);
266266
case CPOUND:
267267
ASSERT(nf != 0, EVDOMAIN);
268268
ASSERT(1 == AR(x), EVRANK);
269-
return fdef(0, CPOWOP, VERB, jtexpandf, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, 0L, 0L);
269+
return jtfdef(jt, 0, CPOWOP, VERB, jtexpandf, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, 0L, 0L);
270270
break;
271271
case CPOWOP:
272272
if (VGERL & u->flag) {
@@ -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);
@@ -409,8 +409,8 @@ jtinv(J jt, A w, I recur) {
409409
case CBANG:
410410
return jteval(jt, "3 : '(-(y -~ !)%0.001&* (0.001%~[:-/[:! 0.001 0 +/ ]) ])^:_<.&170^:(-:+)^.y' :. !");
411411
case CXCO: return jtamp(jt, num(-1), w);
412-
case CSPARSE: return fdef(0, CPOWOP, VERB, jtdenseit, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, RMAX, RMAX);
413-
case CPCO: return fdef(0, CPOWOP, VERB, jtplt, 0L, w, num(-1), 0L, 0L, 0L, 0L, 0L);
412+
case CSPARSE: return jtfdef(jt, 0, CPOWOP, VERB, jtdenseit, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, RMAX, RMAX);
413+
case CPCO: return jtfdef(jt, 0, CPOWOP, VERB, jtplt, 0L, w, num(-1), 0L, 0L, 0L, 0L, 0L);
414414
case CQCO: return jteval(jt, "*/");
415415
case CUCO: return jtamp(jt, num(3), w);
416416
case CUNDER: return jtunder(jt, invrecur(f), g);
@@ -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;
@@ -472,7 +472,7 @@ jtinv(J jt, A w, I recur) {
472472
break;
473473
case CCUT:
474474
if (CBOX == ID(f) && ng && (p = jti0(jt, g), 1 == p || 2 == p))
475-
return fdef(0, CPOWOP, VERB, jtbminv, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, RMAX, RMAX);
475+
return jtfdef(jt, 0, CPOWOP, VERB, jtbminv, 0L, w, num(-1), 0L, VFLAGNONE, RMAX, RMAX, RMAX);
476476
break;
477477
case CIBEAM:
478478
p = jti0(jt, f);
@@ -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

+4-4
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

+13-13
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 */

0 commit comments

Comments
 (0)