pebblisp/src/env.h

57 lines
1.2 KiB
C
Raw Normal View History

#ifndef ENVIRONMENT_H
#define ENVIRONMENT_H
#include "object.h"
struct Environment;
struct Environment {
char** strings;
Object* objects;
struct Environment* outer;
int capacity;
int refs;
};
struct Dictionary {
int structCount;
int structCapacity;
struct StructDef* structDefs;
};
struct Environment* global();
2022-03-19 22:25:20 -04:00
void setGlobal(struct Environment* env);
Object fetchFromEnvironment(const char* name, struct Environment* env);
struct Environment envForLambda(const Object* params, const Object* arg_forms, int paramCount,
struct Environment* outer);
2022-03-19 22:25:20 -04:00
void addToEnv(struct Environment* env, const char* name, Object obj);
void printEnv(struct Environment* env);
void addFunc(const char* name,
Object (* func)(Object*, int, struct Environment*),
2022-03-27 00:03:34 -04:00
struct Environment* env,
int i);
void deleteEnv(struct Environment* e);
void shredDictionary();
struct Environment defaultEnv();
int getStructIndex(const char* name);
struct StructDef* getStructAt(int i);
void addStructDef(struct StructDef def);
void printColored(const char* code);
int runTests(int detailed);
#endif