|
|
|
@@ -67,16 +67,6 @@ namespace Slime { |
|
|
|
int column; |
|
|
|
}; |
|
|
|
|
|
|
|
struct Symbol { |
|
|
|
String* identifier; |
|
|
|
u64 hash; |
|
|
|
}; |
|
|
|
|
|
|
|
struct Keyword { |
|
|
|
String* identifier; |
|
|
|
u64 hash; |
|
|
|
}; |
|
|
|
|
|
|
|
struct Pair { |
|
|
|
Lisp_Object* first; |
|
|
|
Lisp_Object* rest; |
|
|
|
@@ -110,6 +100,11 @@ namespace Slime { |
|
|
|
struct Environment { |
|
|
|
Array_List<Environment*> parents; |
|
|
|
Hash_Map<void*, Lisp_Object*> hm; |
|
|
|
|
|
|
|
~Environment() { |
|
|
|
parents.~Array_List(); |
|
|
|
hm.~Hash_Map(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
struct Function { |
|
|
|
@@ -120,7 +115,7 @@ namespace Slime { |
|
|
|
}; |
|
|
|
|
|
|
|
struct cFunction { |
|
|
|
std::function<Lisp_Object* ()> body; |
|
|
|
Lisp_Object* (*body)(); |
|
|
|
Arguments args; |
|
|
|
bool is_special_form; |
|
|
|
}; |
|
|
|
@@ -130,18 +125,20 @@ namespace Slime { |
|
|
|
u64 flags; |
|
|
|
Lisp_Object* userType; // keyword |
|
|
|
String* docstring; |
|
|
|
union { |
|
|
|
Symbol symbol; // used for symbols and keywords |
|
|
|
union value { |
|
|
|
String* symbol; // used for symbols and keywords |
|
|
|
double number; |
|
|
|
String* string; |
|
|
|
Pair pair; |
|
|
|
Vector vector; |
|
|
|
Function function; |
|
|
|
Function* function; |
|
|
|
cFunction* cFunction; |
|
|
|
void* pointer; |
|
|
|
Continuation continuation; |
|
|
|
Hash_Map<Lisp_Object*, Lisp_Object*> hashMap; |
|
|
|
Continuation* continuation; |
|
|
|
Hash_Map<Lisp_Object*, Lisp_Object*>* hashMap; |
|
|
|
~value() {} |
|
|
|
} value; |
|
|
|
~Lisp_Object(); |
|
|
|
}; |
|
|
|
|
|
|
|
struct Error { |
|
|
|
@@ -151,6 +148,7 @@ namespace Slime { |
|
|
|
String* message; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const wchar_t* char_to_wchar(const char* c); |
|
|
|
char* read_entire_file(char* filename); |
|
|
|
void add_to_load_path(const char*); |
|
|
|
@@ -165,7 +163,7 @@ namespace Slime { |
|
|
|
Lisp_Object* eval_expr(Lisp_Object*); |
|
|
|
bool is_truthy (Lisp_Object*); |
|
|
|
int list_length(Lisp_Object*); |
|
|
|
void load_built_ins_into_environment(); |
|
|
|
void* load_built_ins_into_environment(); |
|
|
|
void create_arguments_from_lambda_list_and_inject(Lisp_Object* formal_arguments, Lisp_Object* function); |
|
|
|
|
|
|
|
Lisp_Object* lookup_symbol(Lisp_Object* symbol, Environment*); |
|
|
|
|