diff --git a/src/builtins/arith.c b/src/builtins/arith.c index 57dfdf23..dfc20f2d 100644 --- a/src/builtins/arith.c +++ b/src/builtins/arith.c @@ -177,7 +177,7 @@ B ne_c2(B t, B w, B x) { return r; } -B rt_merge; +extern B rt_merge; B gt_c1(B t, B x) { if (isAtm(x)) return x; return bqn_merge(x); @@ -198,7 +198,7 @@ B lt_c1(B t, B x) { return m_unit(x); } B eq_c1(B t, B x) { B r = m_i32(isArr(x)? rnk(x) : 0); decR(x); return r; } B ne_c1(B t, B x) { B r = m_f64(isArr(x)&&rnk(x)? *a(x)->sh : 1); decR(x); return r; } -B rt_sortDsc; +extern B rt_sortDsc; B or_c1(B t, B x) { return c1(rt_sortDsc, x); } B and_c1(B t, B x); // defined in sort.c diff --git a/src/builtins/fns.c b/src/builtins/fns.c index 7268f7c0..c8813268 100644 --- a/src/builtins/fns.c +++ b/src/builtins/fns.c @@ -71,7 +71,7 @@ B ud_c1(B t, B x) { return r; } -B rt_ud; +extern B rt_ud; B ud_c2(B t, B w, B x) { return c2(rt_ud, w, x); } @@ -137,7 +137,7 @@ B fne_c2(B t, B w, B x) { } -B rt_indexOf; +extern B rt_indexOf; B indexOf_c1(B t, B x) { if (isAtm(x)) thrM("⊐: 𝕩 cannot have rank 0"); usz xia = a(x)->ia; @@ -220,7 +220,7 @@ B indexOf_c2(B t, B w, B x) { return r; } -B rt_memberOf; +extern B rt_memberOf; B memberOf_c1(B t, B x) { return c1(rt_memberOf, x); } @@ -240,7 +240,7 @@ B memberOf_c2(B t, B w, B x) { return r; } -B rt_find; +extern B rt_find; B find_c1(B t, B x) { if (isAtm(x) || rnk(x)==0) thrM("⍷: Argument cannot have rank 0"); usz xia = a(x)->ia; @@ -261,7 +261,7 @@ B find_c2(B t, B w, B x) { return c2(rt_find, w, x); } -B rt_count; +extern B rt_count; B count_c1(B t, B x) { if (isAtm(x) || rnk(x)==0) thrM("⊒: Argument cannot have rank 0"); if (rnk(x)>1) x = toCells(x); diff --git a/src/builtins/md1.c b/src/builtins/md1.c index 5390fe0d..0ddbb123 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -325,7 +325,7 @@ B fchars_c2(B d, B w, B x) { B f = c(Md1D,d)->f; return x; } -B rt_cell; +extern B rt_cell; B cell_c1(B d, B x) { B f = c(Md1D,d)->f; if (isAtm(x) || rnk(x)==0) { B r = c1(f, x); @@ -367,7 +367,6 @@ B cell_c2(B d, B w, B x) { B f = c(Md1D,d)->f; static void print_md1BI(B x) { printf("%s", format_pm1(c(Md1,x)->extra)); } -B bi_tbl, bi_each, bi_fold, bi_scan, bi_const, bi_swap, bi_cell, bi_timed, bi_fchars, bi_fbytes, bi_flines, bi_import; void md1_init() { ba(tbl) ba(each) ba(fold) ba(scan) ba(const) ba(swap) ba(cell) ba(timed) ba(fchars) bm(fbytes) bm(flines) ba(import) ti[t_md1BI].print = print_md1BI; } diff --git a/src/builtins/md2.c b/src/builtins/md2.c index 72b24304..ae0de2d7 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -44,7 +44,7 @@ B catch_c1 (B d, B x) { return c1(c(Md2D,d)->f, x); } B catch_c2 (B d, B w, B x) { return c2(c(Md2D,d)->f, w,x); } #endif -B rt_undo; +extern B rt_undo; void repeat_bounds(i64* bound, B g) { // doesn't consume if (isArr(g)) { BS2B xgetU = TI(g).getU; @@ -127,7 +127,7 @@ B cond_c2(B d, B w, B x) { B g=c(Md2D,d)->g; return c2(TI(g).getU(g, fr), w, x); } -B rt_under, bi_before; +extern B rt_under, bi_before; B under_c1(B d, B x) { B f=c(Md2D,d)->f; B g=c(Md2D,d)->g; if (!isVal(g)) { // ugh idk B fn = m2_d(inc(rt_under), inc(f), inc(g)); @@ -160,7 +160,6 @@ B before_uc1(B t, B o, B f, B g, B x) { #define bd(N) { B t=bi_##N=mm_alloc(sizeof(BMd2), t_md2BI, ftag(MD2_TAG)); BMd2*m=c(BMd2,t); m->c2 = N##_c2 ; m->c1 = c1_invalid; m->extra=pm2_##N; m->uc1=def_m2_uc1; m->ucw=def_m2_ucw; gc_add(t); } #define bm(N) { B t=bi_##N=mm_alloc(sizeof(BMd2), t_md2BI, ftag(MD2_TAG)); BMd2*m=c(BMd2,t); m->c2 = c2_invalid; m->c1 = N##_c1; m->extra=pm2_##N; m->uc1=def_m2_uc1; m->ucw=def_m2_ucw; gc_add(t); } -B bi_val, bi_repeat, bi_atop, bi_over, bi_before, bi_after, bi_cond, bi_fillBy, bi_under, bi_catch; void md2_init() { ba(val) ba(repeat) ba(atop) ba(over) ba(before) ba(after) ba(cond) ba(fillBy) ba(under) ba(catch) ti[t_md2BI].print = print_md2BI; ti[t_md2BI].m2_uc1 = md2BI_uc1; diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index ef6775e0..c446b79a 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -32,7 +32,7 @@ B shape_c2(B t, B w, B x) { return r; } -B rt_pick; +extern B pick; B pick_c1(B t, B x) { if (isAtm(x)) return x; if (a(x)->ia==0) { @@ -57,7 +57,7 @@ B pick_c2(B t, B w, B x) { return c2(rt_pick, w, x); } -B rt_select; +extern B select; B select_c1(B t, B x) { if (isAtm(x)) thrM("⊏: Argument cannot be an atom"); ur xr = rnk(x); @@ -177,7 +177,7 @@ static NOINLINE B slash_c1R(B x, u64 s) { dec(x); return r; } -B rt_slash; +extern B slash; B slash_c1(B t, B x) { if (RARE(isAtm(x)) || RARE(rnk(x)!=1)) thrF("/: Argument must have rank 1 (%H ≡ ≢𝕩)", x); i64 s = isum(x); @@ -260,7 +260,7 @@ B slicev(B x, usz s, usz ia) { arr_shVec(r, ia); return r; } -B rt_take, rt_drop; +extern B take, rt_drop; B take_c1(B t, B x) { return c1(rt_take, x); } B drop_c1(B t, B x) { return c1(rt_drop, x); } B take_c2(B t, B w, B x) { @@ -292,7 +292,7 @@ B drop_c2(B t, B w, B x) { return c2(rt_drop, w, x); } -B rt_join; +extern B join; B join_c1(B t, B x) { if (isAtm(x)) thrM("∾: Argument must be an array"); if (rnk(x)==1) { @@ -504,7 +504,7 @@ B shifta_c2(B t, B w, B x) { return qWithFill(mut_fcd(r, x), f); } -B rt_group; +extern B group; B group_c1(B t, B x) { return c1(rt_group, x); } @@ -609,7 +609,7 @@ B group_c2(B t, B w, B x) { return c2(rt_group, w, x); } -B rt_reverse; +extern B reverse; B reverse_c1(B t, B x) { if (isAtm(x) || rnk(x)==0) thrM("⌽: Argument cannot be a unit"); B xf = getFillQ(x); diff --git a/src/core/stuff.h b/src/core/stuff.h index 6d8784b6..d2af384b 100644 --- a/src/core/stuff.h +++ b/src/core/stuff.h @@ -136,7 +136,7 @@ B bqn_squeeze(B x); // consumes static void noop_visit(Value* x) { } static B def_getU(B x, usz n) { return x; } -B rt_under, bi_before; +extern B rt_under, bi_before; static B rtUnder_c1(B f, B g, B x) { // consumes x B fn = m2_d(inc(rt_under), inc(f), inc(g)); B r = c1(fn, x);