diff --git a/src/README.md b/src/README.md index 209e4540..1791ccc6 100644 --- a/src/README.md +++ b/src/README.md @@ -23,23 +23,23 @@ src/ md2.c 2-modifiers sysfn.c •-definitions internal.c •internal - opt/ files which aren't needed for every build configuration - gen/ generated files - jit/ simple JIT compiler for x86-64 - utils/ utilities included as needed - builtins.h definitions of all built-in functions (excluding things defined by means of nfns.c) + utils/ utilities included as needed file.h file system operations hash.h hashing things mut.h copying multiple arrays into a single array talloc.h temporary allocations (described more below) utf.h UTF-8 things - core/ things included everywhere - core.h file imported everywhere that defines the base BQN model - nfns.c native functions for things that need to keep some state (e.g. •FLines needs to also hold the path its relative to) - load.c loads the self-hosted compiler, runtime and formatter, initializes CBQN globals - main.c main function & commandline stuff - ns.c namespaces - vm.c virtual machine interpreter + opt/ files which aren't needed for every build configuration + gen/ generated files + jit/ simple JIT compiler for x86-64 + core/ things included everywhere + builtins.h definitions of all built-in functions (excluding things defined by means of nfns.c) + core.h file imported everywhere that defines the base BQN model + nfns.c native functions for things that need to keep some state (e.g. •FLines needs to also hold the path its relative to) + load.c loads the self-hosted compiler, runtime and formatter, initializes CBQN globals + main.c main function & commandline stuff + ns.c namespaces + vm.c virtual machine interpreter ) ``` @@ -125,13 +125,13 @@ All virtual method accesses require that the argument is heap-allocated. You can get a virtual function of a `B` instance with `TI(x, something)`. There's also `TIv(x, something)` for a pointer `x` instead. See `#define FOR_TI` in `src/h.h` for available functions. -Call a BQN function with `c1(f, x)` or `c2(f, w, x)`. A specific builtin can be called by looking up the appropriate name in `src/utils/builtins.h` (and adding the `bi_` prefix). +Call a BQN function with `c1(f, x)` or `c2(f, w, x)`. A specific builtin can be called by looking up the appropriate name in `src/builtins.h` (and adding the `bi_` prefix). Calling a modifier involves deriving it with `m1_d`/`m2_d`, using a regular `c1`/`c2`, and managing the refcounts of everything while at that. ## Builtin implementations -The list of builtin functions is specified in the initial macros of `src/utils/builtins.h`, where `A`/`M`/`D` are used for ambivalent/monadic/dyadic. Once added, `bi_yourName` will be available, and the required of the following functions must be defined somewhere in the source: +The list of builtin functions is specified in the initial macros of `src/builtins.h`, where `A`/`M`/`D` are used for ambivalent/monadic/dyadic. Once added, `bi_yourName` will be available, and the required of the following functions must be defined somewhere in the source: ```C // functions: diff --git a/src/utils/builtins.h b/src/builtins.h similarity index 100% rename from src/utils/builtins.h rename to src/builtins.h diff --git a/src/builtins/arithm.c b/src/builtins/arithm.c index 025b0cd1..dd54d456 100644 --- a/src/builtins/arithm.c +++ b/src/builtins/arithm.c @@ -1,6 +1,6 @@ #include "../core.h" #include "../utils/each.h" -#include "../utils/builtins.h" +#include "../builtins.h" #include "../nfns.h" #include diff --git a/src/builtins/internal.c b/src/builtins/internal.c index daaac3c7..33f0a691 100644 --- a/src/builtins/internal.c +++ b/src/builtins/internal.c @@ -1,6 +1,6 @@ #include "../core.h" #include "../utils/mut.h" -#include "../utils/builtins.h" +#include "../builtins.h" B itype_c1(B t, B x) { B r; diff --git a/src/builtins/md1.c b/src/builtins/md1.c index 8f13e4cb..2ff3162d 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -1,7 +1,7 @@ #include "../core.h" #include "../utils/each.h" #include "../utils/file.h" -#include "../utils/builtins.h" +#include "../builtins.h" diff --git a/src/builtins/md2.c b/src/builtins/md2.c index 0a77b6ea..cb169eab 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -1,6 +1,6 @@ #include "../core.h" -#include "../utils/builtins.h" #include "../utils/talloc.h" +#include "../builtins.h" B md2BI_uc1(B t, B o, B f, B g, B x) { return c(BMd2,t)->uc1(t, o, f, g, x); } B md2BI_ucw(B t, B o, B f, B g, B w, B x) { return c(BMd2,t)->ucw(t, o, f, g, w, x); } diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index ade3387a..1bfa337c 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -1,8 +1,8 @@ #include "../core.h" #include "../utils/each.h" #include "../utils/mut.h" -#include "../utils/builtins.h" #include "../utils/talloc.h" +#include "../builtins.h" static Arr* take_impl(usz ria, B x) { // consumes x; returns v↑⥊𝕩 without set shape; v is non-negative usz xia = a(x)->ia; diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index f45e4522..8cf94926 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -7,8 +7,8 @@ #include "../utils/hash.h" #include "../utils/file.h" #include "../utils/wyhash.h" -#include "../utils/builtins.h" #include "../utils/mut.h" +#include "../builtins.h" #include "../ns.h" #include "../nfns.h" diff --git a/src/core/stuff.c b/src/core/stuff.c index 665fe9c3..298d2e54 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -2,7 +2,7 @@ #include "../utils/mut.h" #include "../utils/utf.h" #include "../utils/talloc.h" -#include "../utils/builtins.h" +#include "../builtins.h" NORETURN NOINLINE void err(char* s) { diff --git a/src/load.c b/src/load.c index 39bcc857..2b344d84 100644 --- a/src/load.c +++ b/src/load.c @@ -1,9 +1,9 @@ #include "core.h" -#include "vm.h" -#include "ns.h" #include "utils/mut.h" #include "utils/file.h" -#include "utils/builtins.h" +#include "vm.h" +#include "ns.h" +#include "builtins.h" #define FOR_INIT(F) F(base) F(harr) F(mutF) F(fillarr) F(tyarr) F(hash) F(sfns) F(fns) F(arith) F(md1) F(md2) F(derv) F(comp) F(rtWrap) F(ns) F(nfn) F(sysfn) F(load) F(sysfnPost) #define F(X) void X##_init(void); diff --git a/src/rtwrap.c b/src/rtwrap.c index 3a7626a0..34c72092 100644 --- a/src/rtwrap.c +++ b/src/rtwrap.c @@ -1,7 +1,7 @@ #include "core.h" #include "vm.h" #ifdef RT_PERF -#include "utils/builtins.h" +#include "builtins.h" #endif #ifdef RT_WRAP