Login
7 branches 0 tags
Ben (X13/Arch) Reader can now read dotted pairs c82ef6e 4 years ago 114 Commits
nujel / lib / collection / closure.h
#pragma once
#include "../nujel.h"

#define CLO_MAX (1<<16)
extern lClosure lClosureList[CLO_MAX];
extern uint     lClosureMax;
extern uint     lClosureActive;
extern lClosure *lClosureFFree;

void      lInitClosure      ();
lClosure *lClosureAlloc     ();
lClosure *lClosureNew       (lClosure *parent);
void      lClosureFree      (lClosure *c);
int       lClosureID        (const lClosure *n);

lVal     *lSearchClosureSym (lClosure *c, lVal *ret, const char *str, uint len);
lVal     *lResolve          (lClosure *c, lVal *v);
lVal     *lResolveSym       (lClosure *c, lVal *v);
lVal     *lDefineAliased    (lClosure *c, lVal *lNF, const char *sym);

lVal     *lSearchClosureSym (lClosure *c, lVal *v, const char *str, uint len);
lVal     *lGetClosureSym    (lClosure *c, const lSymbol *s);
void      lDefineClosureSym (lClosure *c, const lSymbol *s, lVal *v);
void      lSetClosureSym    (lClosure *c, const lSymbol *s, lVal *v);
void      lDefineVal        (lClosure *c, const char *str,  lVal *v);