From 934a2b5ae3f8a79d3e936e4b4776b2c33e32a2ce Mon Sep 17 00:00:00 2001 From: dzaima Date: Mon, 5 Jun 2023 22:54:51 +0300 Subject: [PATCH] rearrange things --- build/src/build.bqn | 8 ++++---- src/builtins/md1.c | 9 ++++----- src/builtins/md2.c | 11 +++++------ src/core/derv.c | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/build/src/build.bqn b/build/src/build.bqn index 4bf415ee..61e68ce8 100755 --- a/build/src/build.bqn +++ b/build/src/build.bqn @@ -21,8 +21,8 @@ opts ← ⟨ ⟨0, "j", @, "Number of parallel jobs"⟩ ⟨1, "verbose", 0, "Log more things"⟩ ⟨1, "rebuild", 0, "Forcibly rebuild everything"⟩ - ⟨1, "quiet", 0, "Don't output final status line (or any, combined with notui)"⟩ - ⟨1, "notui", @, "disable live-updating status display"∾@+10⟩ + ⟨1, "notui", @, "disable live-updating status display"⟩ + ⟨1, "quiet", 0, "Don't output final status line (or any, combined with notui)"∾@+10⟩ ⟨1, "rebuild-singeli", 0, @⟩ ⟨0, "CC", @, "The used C compiler"⟩ @@ -49,8 +49,8 @@ opts ← ⟨ ⟨1, "emcc", 0, "Build with emscripten; outputs two files - BQN.wasm and BQN.js"⟩ ⟨1, "clangd", 0, "Don't build, instead generate a compile_commands.json for clangd"∾@+10⟩ - ⟨1, "FFI", @, "Enable FFI through libffi; On by default, except for WASM builds"⟩ - ⟨1, "pkgconfig", 1, "Attempt to use pkg-config to find libffi flags"⟩ + ⟨1, "FFI", @, "Enable FFI through libffi; On by default for linux, BSD, macos"⟩ + ⟨1, "pkgconfig", 1, "Whether to attempt to use pkg-config to find libffi flags"⟩ ⟨1, "singeli", 0, "Enable compilation with Singeli"⟩ ⟨1, "replxx", 0, "Enable REPLXX"∾@+10⟩ diff --git a/src/builtins/md1.c b/src/builtins/md1.c index 5d36f20c..8b73ac2f 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -172,17 +172,16 @@ static void print_md1BI(FILE* f, B x) { fprintf(f, "%s", pm1_repr(c(Md1,x)->extr static B md1BI_im(Md1D* d, B x) { return ((BMd1*)d->m1)->im(d, x); } static B md1BI_iw(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->iw(d, w, x); } static B md1BI_ix(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->ix(d, w, x); } - -B swap_im(Md1D* d, B x) { return isFun(d->f)? TI(d->f,fn_is)(d->f, x): def_fn_is(d->f, x); } -B swap_iw(Md1D* d, B w, B x) { return isFun(d->f)? TI(d->f,fn_ix)(d->f, w, x): def_fn_ix(d->f, w, x); } -B swap_ix(Md1D* d, B w, B x) { return isFun(d->f)? TI(d->f,fn_iw)(d->f, w, x): def_fn_iw(d->f, w, x); } +static B swap_im(Md1D* d, B x) { return isFun(d->f)? TI(d->f,fn_is)(d->f, x) : def_fn_is(d->f, x); } +static B swap_iw(Md1D* d, B w, B x) { return isFun(d->f)? TI(d->f,fn_ix)(d->f, w, x) : def_fn_ix(d->f, w, x); } +static B swap_ix(Md1D* d, B w, B x) { return isFun(d->f)? TI(d->f,fn_iw)(d->f, w, x) : def_fn_iw(d->f, w, x); } void md1_init(void) { TIi(t_md1BI,print) = print_md1BI; TIi(t_md1BI,m1_im) = md1BI_im; TIi(t_md1BI,m1_iw) = md1BI_iw; TIi(t_md1BI,m1_ix) = md1BI_ix; + c(BMd1,bi_swap)->im = swap_im; c(BMd1,bi_swap)->iw = swap_iw; c(BMd1,bi_swap)->ix = swap_ix; - c(BMd1,bi_swap)->im = swap_im; } diff --git a/src/builtins/md2.c b/src/builtins/md2.c index a11093de..6426bc9e 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -6,10 +6,6 @@ #include "../builtins.h" #include -B md2BI_uc1(Md2* t, B o, B f, B g, B x) { return ((BMd2*)t)->uc1(t, o, f, g, x); } -B md2BI_ucw(Md2* t, B o, B f, B g, B w, B x) { return ((BMd2*)t)->ucw(t, o, f, g, w, x); } - - B val_c1(Md2D* d, B x) { return c1(d->f, x); } B val_c2(Md2D* d, B w, B x) { return c2(d->g, w,x); } @@ -247,13 +243,16 @@ static void print_md2BI(FILE* f, B x) { fprintf(f, "%s", pm2_repr(c(Md1,x)->extr static B md2BI_im(Md2D* d, B x) { return ((BMd2*)d->m2)->im(d, x); } static B md2BI_iw(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->iw(d, w, x); } static B md2BI_ix(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->ix(d, w, x); } +static B md2BI_uc1(Md2* t, B o, B f, B g, B x) { return ((BMd2*)t)->uc1(t, o, f, g, x); } +static B md2BI_ucw(Md2* t, B o, B f, B g, B w, B x) { return ((BMd2*)t)->ucw(t, o, f, g, w, x); } + void md2_init(void) { TIi(t_md2BI,print) = print_md2BI; - TIi(t_md2BI,m2_uc1) = md2BI_uc1; - TIi(t_md2BI,m2_ucw) = md2BI_ucw; TIi(t_md2BI,m2_im) = md2BI_im; TIi(t_md2BI,m2_iw) = md2BI_iw; TIi(t_md2BI,m2_ix) = md2BI_ix; + TIi(t_md2BI,m2_uc1) = md2BI_uc1; + TIi(t_md2BI,m2_ucw) = md2BI_ucw; c(BMd2,bi_before)->uc1 = before_uc1; c(BMd2,bi_after)->im = after_im; c(BMd2,bi_before)->im = before_im; diff --git a/src/core/derv.c b/src/core/derv.c index 8afe4c65..23da0a26 100644 --- a/src/core/derv.c +++ b/src/core/derv.c @@ -120,7 +120,7 @@ static B fork_uc1(B t, B o, B x) { B args[] = {g, o, f}; B tmp = m_nfn(ucwWrapDesc, tag(args, RAW_TAG)); B r = TI(h,fn_uc1)(h,tmp,x); - // f is consumed by the eventual ucwWrap call. this hopes that everything is nice and calls o only once, and within the under call, so any under interface must make sure they can't + // f is consumed by the eventual ucwWrap call. this hopes that everything is nice and calls o only once, and within the under call, so any user-facing Under interface must assert that that'll stay the case decG(tmp); return r; }