uCBQN/src/ns.h
2021-05-11 16:10:49 +03:00

21 lines
703 B
C

#pragma once
#include "h.h"
#include "vm.h"
typedef struct NSDesc {
struct Value;
B nameList;
i32 varAm; // number of items in expIDs (currently equal to sc->varAm/body->varAm)
i32 expIDs[]; // each item is an index in nameList (or -1), and its position is the corresponding position in sc->vars
} NSDesc;
typedef struct NS {
struct Value;
B nameList; // copy of desc->nameList for quick checking; isn't owned
NSDesc* desc;
Scope* sc;
} NS;
void m_nsDesc(Body* body, bool imm, u8 ty, B nameList, B varIDs, B exported); // consumes nameList
B m_ns(Scope* sc, NSDesc* desc); // consumes both
B ns_getU(B ns, B nameList, i32 nameID); // doesn't consume anything, doesn't increment result