update src/README.md

This commit is contained in:
dzaima 2022-11-12 20:30:47 +02:00
parent e2193a18bf
commit a64f0ada5f

View File

@ -52,12 +52,14 @@ src/
* `c1`, `c2` in `h.h` - correspondingly monadically or dyadically invoke a function
* `evalBC` in `vm.c` - VM bytecode interpreter
* `slash_c2` in `builtins/sfns.c` - implementation of `𝕨/𝕩`
* `GC2i` & `GC2f` invocations in `builtins/arithd.c` - dyadic pervasive builtins
* `slash_c2` in `builtins/slash.c` - implementation of `𝕨/𝕩`
* See `load.c` `fruntime` items for more builtins (remove leading `bi_` & append `_c1`/`_c2` to get the implementation function)
* `load_init` in `load.c` - loads the BQN runtime & compiler
* `bqn_comp` in `load.c` - execute BQN code from a string
* `BN(allocL)` in `opt/mm_buddyTemplate.h` - fast path of buddy memory allocator; invoked from `opt/mm_buddy.h`
* `builtins/arithd.c` - dyadic pervasive builtins
* non-Singeli `÷√⋆|`: `GC2f`; `×∧∨⌊⌈+-` array F array: `AR_I_AA`, atom F array: `AR_I_SA`
* Singeli: implementations in `src/singeli/src/dyarith.singeli`, requirements/tables generated by `src/singeli/src/genArithTables.bqn`
## Base
@ -104,7 +106,7 @@ Functions for converting/using basic types:
q_fusz(x) q_usz(x)
q_N(x) // query if x is · (≡ bi_N)
noFill(x) // if x represents undefined fill (returned by getFill*; ≡ bi_noFill)
noFill(x) // query if x represents undefined fill (which returned by getFill*; aka test if equal to bi_noFill)
tag(x,*_TAG) // pointer → B
See src/h.h for more basics
@ -249,13 +251,13 @@ B r = m_c32vec_0(U"⟨1⋄2⋄3⟩"); // ..or with implicit length
B r = m_c8vec("hello", 5); // a constant ASCII string
B r = m_c8vec_0("hello"); // ..or with implicit length
B r = utf8Decode("⟨1⋄2⋄3⟩", 17) // decode UTF-8 from a char*
B r = utf8Decode_0("⟨1⋄2⋄3⟩") // ..or with implicit length
B r = utf8Decode0("⟨1⋄2⋄3⟩") // ..or with implicit length
#include "utils/utf.h"
u64 sz = utf8lenB(x); TALLOC(char, buf, sz+1); toUTF8(x, buf); buf[sz]=0; /*use buf as a C-string*/ TFREE(buf);
// src/utils/mut.h provides a way to build an array by copying parts of other arrays
// some functions for specific cases:
// some functions for making specific arrays:
B r = m_unit(x); // equivalent to <𝕩
B r = m_hunit(x); // like the above, except no fill is set
B r = m_atomUnit(x); // if x is likely to be an atom, this is a better alternative to m_unit
@ -267,7 +269,6 @@ B r = emptyHVec(); // an empty vector with no fill
B r = emptyIVec(); // an empty integer vector
B r = emptyCVec(); // an empty character vector
B r = emptySVec(); // an empty string vector
// rank can be manually set for an exsiting object with sprnk or srnk, but be careful to keep the shape object in sync!
```