trying not to leak memory
This commit is contained in:
@@ -128,3 +128,24 @@
|
||||
#define in_caller_env fluid_let( \
|
||||
Globals::Current_Execution::envi_stack.next_index, \
|
||||
Globals::Current_Execution::envi_stack.next_index-1)
|
||||
|
||||
|
||||
/*
|
||||
* iterate over lisp vectors
|
||||
*/
|
||||
#define for_lisp_vector(v) \
|
||||
if (!v); else \
|
||||
if (int it_index = 0); else \
|
||||
for (auto it = v->value.vector.data; \
|
||||
it_index < v->value.vector.length; \
|
||||
it=v->value.vector.data+(++it_index))
|
||||
|
||||
/*
|
||||
* iterate over lisp lists
|
||||
*/
|
||||
#define for_lisp_list(l) \
|
||||
if (!l); else \
|
||||
if (int it_index = 0); else \
|
||||
for (Lisp_Object* head = l, *it; \
|
||||
Memory::get_type(head) == Lisp_Object_Type::Pair && (it = head->value.pair.first); \
|
||||
head = head->value.pair.rest, ++it_index)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include "ftb/arraylist.hpp"
|
||||
#include "ftb/hashmap.hpp"
|
||||
@@ -182,11 +184,13 @@ namespace Slime {
|
||||
|
||||
void visualize_lisp_machine();
|
||||
void generate_docs(String* path);
|
||||
void log_error();
|
||||
|
||||
namespace Memory {
|
||||
extern Lisp_Object* nil;
|
||||
extern Lisp_Object* t;
|
||||
|
||||
Environment* create_child_environment(Environment* parent);
|
||||
Environment* create_built_ins_environment();
|
||||
Lisp_Object* create_lisp_object_cfunction(bool is_special);
|
||||
Lisp_Object* get_or_create_lisp_object_keyword(const char* identifier);
|
||||
@@ -196,6 +200,7 @@ namespace Slime {
|
||||
void free_everything();
|
||||
String* create_string(const char*);
|
||||
Lisp_Object* create_lisp_object_number(double);
|
||||
Lisp_Object* create_lisp_object_pointer(void*);
|
||||
Lisp_Object* get_or_create_lisp_object_symbol(String* identifier);
|
||||
Lisp_Object* get_or_create_lisp_object_symbol(const char*);
|
||||
Lisp_Object* get_or_create_lisp_object_keyword(String* identifier);
|
||||
|
||||
Reference in New Issue
Block a user