~tim/lydia

0b83b4d68bee253f42ac8972e3055cdfedbc5fd3 — Tim Morgan 8 years ago 31ab7ff
Some debugging for the stack.
2 files changed, 4 insertions(+), 1 deletions(-)

M src/closure.c
M src/lidija.h
M src/closure.c => src/closure.c +3 -0
@@ 2,6 2,7 @@

// creates and initializes an empty closure
LClosure *l_closure_new(LNode *node) {
  l_debug(L_DEBUG_STACK) printf("+++ creating new closure\n");
  LClosure *closure = GC_MALLOC(sizeof(LClosure));
  closure->vars = create_hashmap();
  closure->locals = create_hashmap();


@@ 13,6 14,7 @@ LClosure *l_closure_new(LNode *node) {

// creates a new closure from the given parent closure
LClosure *l_closure_clone(LClosure *parent, LNode *node) {
  l_debug(L_DEBUG_STACK) printf("+++ cloning closure\n");
  if(!parent->cloneable) return parent;
  LClosure *closure = GC_MALLOC(sizeof(LClosure));
  closure->vars = create_hashmap();


@@ 36,6 38,7 @@ void l_clone_vars(hashmap_p from, hashmap_p to) {
}

void l_closure_free(LClosure *closure) {
  l_debug(L_DEBUG_STACK) printf("--- freeing closure\n");
  if(closure->parent == NULL) return;
}


M src/lidija.h => src/lidija.h +1 -1
@@ 35,8 35,8 @@
#define L_ERR_MISSING_FUNC  "Must supply a function."
#define L_ERR_MISSING_STR   "Must supply a string."

#define L_DEBUG_HEAP 0
#define L_DEBUG_CALL 0
#define L_DEBUG_STACK 0

#define L_SKIP_LIB 0