Skip to content

MoonLive

Source: MoonLive.h

SeededMember

struct SeededMember
src/core/moonlive/MoonLive.h:341

Public Attributes

uint8_t offset = 0

CtrlType type = CtrlType::Int

uint8_t count = 1

char name = {}

MoonLive

class MoonLive
src/core/moonlive/MoonLive.h:23

Public Methods

MoonLive() = default : Defaulted constructor.

MoonLive(const MoonLive &) = delete : Deleted constructor.

bool compile(uint8_t r, uint8_t g, uint8_t b)

bool compile(const char * source, const BuiltinTable & table, const SysVarTable & sysvars)

bool compileAnimated()

inline bool ok() const

inline CtrlFn entry(const char * name) const : The compiled function named name, or nullptr when the script did not define one.

inline RetType retTypeOf(const char * name) const : What a named entry point declared it returns, or Void when the script has no such function.

inline const uint8_t * entryCode(const char * name) const : The ADDRESS of a named entry point, with no signature attached.

inline const char * entryName(uint8_t i) const : Names of the functions the script defined, for a binding that wants to report them and for the dispatch question "which entry points does this script have".

inline uint8_t entryCount() const

inline const char * error() const

inline uint16_t errorPos() const : WHERE the last compile failed: a character offset into the source, 0 when it did not.

inline bool hasErrorPos() const : Whether errorPos() means anything.

inline void run(uint8_t * buf, uint32_t nLights, uint8_t cpl, uint32_t t, const char * name = nullptr) const : Run the script's ENTRY POINT called name, or the whole program when name is null.

inline uintptr_t runValue(const char * name, RetType want, uintptr_t fallback = 0, uint8_t * buf = nullptr, uint32_t nLights = 0, uint8_t cpl = 0, uint32_t t = 0) const : Run the entry point called name and return its answer, or fallback when the script did not define it.

inline int32_t readSlot(uint8_t offset) const : A member's 4-byte slot, little-endian, which is the layout every backend's 32-bit load and store already uses.

inline void writeSlot(uint8_t offset, int32_t v)

inline void addDeclaredControl(const char * name, uint8_t offset, int32_t lo, int32_t hi, CtrlType type = CtrlType::Int) : Append a control the running defineControls() declared.

inline void clearDeclaredControls() : Forget the controls a previous defineControls() declared, so re-running it rebuilds rather than appends.

inline bool hasEntry(const char * name) const : Does the script define this entry point? A binding asks before reporting "no tick() to run".

void free()

void freeCode()

inline size_t codeLen() const : How many bytes of machine code the current program IS, as opposed to what its allocation cost.

inline size_t codeCap() const

inline size_t heapBytes() const : Every HEAP byte this engine holds: the exec block plus the control arena.

inline void describe(char * out, size_t cap) const : Write "1700 B - controls 2/8" into out: how big the compiled program is, and the ONE budget it is closest to exhausting.

inline const DeclaredControl * declaredControls(uint8_t & count) const

inline uint8_t * controlSlot(uint8_t offset) : The live byte at an arena offset: a script-declared member (offset < kCtrlBytes) or a host system variable (above it).