lisp_print: print verbose logs for lisp types on VERBOSE_LOGS=2
This commit is contained in:
6
Makefile
6
Makefile
@@ -6,16 +6,16 @@ TEST=$(DIST)/test.out
|
|||||||
|
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
GFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c23 -I./include/
|
GFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c23 -I./include/
|
||||||
DFLAGS=-ggdb -fsanitize=address -fsanitize=undefined -DVERBOSE_LOGS=1
|
DFLAGS=-ggdb -fsanitize=address -fsanitize=undefined
|
||||||
RFLAGS=-O3
|
RFLAGS=-O3
|
||||||
|
|
||||||
MODE=release
|
MODE=release
|
||||||
ifeq ($(MODE), release)
|
ifeq ($(MODE), release)
|
||||||
CFLAGS=$(GFLAGS) $(RFLAGS)
|
CFLAGS=$(GFLAGS) $(RFLAGS)
|
||||||
else ifeq ($(MODE), debug)
|
else ifeq ($(MODE), debug)
|
||||||
CFLAGS=$(GFLAGS) $(DFLAGS)
|
CFLAGS=$(GFLAGS) $(DFLAGS) -DVERBOSE_LOGS=1
|
||||||
else ifeq ($(MODE), full)
|
else ifeq ($(MODE), full)
|
||||||
CFLAGS=$(GFLAGS) $(DFLAGS) -DTEST_VERBOSE=1
|
CFLAGS=$(GFLAGS) $(DFLAGS) -DVERBOSE_LOGS=2 -DTEST_VERBOSE=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Units to compile
|
# Units to compile
|
||||||
|
|||||||
16
src/lisp.c
16
src/lisp.c
@@ -98,26 +98,26 @@ void lisp_print(FILE *fp, lisp_t *lisp)
|
|||||||
fprintf(fp, "NIL");
|
fprintf(fp, "NIL");
|
||||||
break;
|
break;
|
||||||
case TAG_INT:
|
case TAG_INT:
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "INT[");
|
fprintf(fp, "INT[");
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, "%ld", as_int(lisp));
|
fprintf(fp, "%ld", as_int(lisp));
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "]");
|
fprintf(fp, "]");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case TAG_SYM:
|
case TAG_SYM:
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "SYM[");
|
fprintf(fp, "SYM[");
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, "%s", as_sym(lisp));
|
fprintf(fp, "%s", as_sym(lisp));
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "]");
|
fprintf(fp, "]");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case TAG_CONS:
|
case TAG_CONS:
|
||||||
{
|
{
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "LIST[");
|
fprintf(fp, "LIST[");
|
||||||
#else
|
#else
|
||||||
fprintf(fp, "(");
|
fprintf(fp, "(");
|
||||||
@@ -145,7 +145,7 @@ void lisp_print(FILE *fp, lisp_t *lisp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "]");
|
fprintf(fp, "]");
|
||||||
#else
|
#else
|
||||||
fprintf(fp, ")");
|
fprintf(fp, ")");
|
||||||
@@ -154,7 +154,7 @@ void lisp_print(FILE *fp, lisp_t *lisp)
|
|||||||
}
|
}
|
||||||
case TAG_VEC:
|
case TAG_VEC:
|
||||||
{
|
{
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "VEC[");
|
fprintf(fp, "VEC[");
|
||||||
#else
|
#else
|
||||||
fprintf(fp, "[");
|
fprintf(fp, "[");
|
||||||
@@ -171,7 +171,7 @@ void lisp_print(FILE *fp, lisp_t *lisp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VERBOSE_LOGS
|
#if VERBOSE_LOGS == 2
|
||||||
fprintf(fp, "]");
|
fprintf(fp, "]");
|
||||||
#else
|
#else
|
||||||
fprintf(fp, "]");
|
fprintf(fp, "]");
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ lisp_t *sys_alloc(sys_t *sys, tag_t type)
|
|||||||
case TAG_CONS:
|
case TAG_CONS:
|
||||||
case TAG_VEC:
|
case TAG_VEC:
|
||||||
return alloc_make(&sys->memory, type);
|
return alloc_make(&sys->memory, type);
|
||||||
// Shouldn't be registered
|
// Shouldn't be allocated
|
||||||
case TAG_NIL:
|
case TAG_NIL:
|
||||||
case TAG_INT:
|
case TAG_INT:
|
||||||
case TAG_SYM:
|
case TAG_SYM:
|
||||||
|
|||||||
Reference in New Issue
Block a user