diff --git a/src/Makefile b/src/Makefile index 538d925..84ddcce 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,27 +1,31 @@ -files = pebblisp.c tokens.c object.c env.c web.c +files = pebblisp.c tokens.c object.c env.c +libs = -lreadline -lmicrohttpd exe = pl +file_libs := $(files) $(libs) + BINPREFIX ?= /usr/bin SCRIPTDIR ?= /usr/local/share/pebblisp mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path)) -GCC_COM ?= gcc -lmicrohttpd -g -O0 -Wall -o $(exe) -D STANDALONE -DSCRIPTDIR=\"$(SCRIPTDIR)\" +GCC_COM ?= gcc -g -O0 -Wall -o $(exe) -D STANDALONE -DSCRIPTDIR=\"$(SCRIPTDIR)\" all: - $(GCC_COM) $(files) && echo && ./tests.sh + $(GCC_COM) $(files) $(libs) && echo && ./tests.sh + echo "$(file_libs)" notest: - $(GCC_COM) $(files) + $(GCC_COM) $(file_libs) local: - gcc -g -O0 -Wall -o $(exe) -D STANDALONE -DSCRIPTDIR=\"$(mkfile_dir)/examples\" $(files) + gcc -g -O0 -Wall -o $(exe) -D STANDALONE -DSCRIPTDIR=\"$(mkfile_dir)/examples\" $(file_libs) val: - $(GCC_COM) $(files) && ./tests.sh -val + $(GCC_COM) $(file_libs) && ./tests.sh -val debug: - $(GCC_COM) -D DEBUG $(files) + $(GCC_COM) -D DEBUG $(file_libs) run: ./$(exe) diff --git a/src/pebblisp.c b/src/pebblisp.c index bc5c132..a22743f 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -6,6 +6,9 @@ #include #include +#include +#include + #include "tokens.h" #ifdef STANDALONE #include "web.h" @@ -1041,9 +1044,15 @@ Object systemCall(Object process, Object _, struct Environment* env) void repl(struct Environment* env) { - if (readFile(SCRIPTDIR "/repl.pbl", env) == 1) { - fprintf(stderr, "Could not read '%s'\n", SCRIPTDIR "/repl.pbl"); - fprintf(stderr, "Consider installing or reinstalling pebblisp.\n"); + char* buf; + while ((buf = readline("pebblisp::> ")) != NULL) { + if (strcmp("q", buf) == 0) { + free(buf); + break; + } + Object o = parseEval(buf, env); + printObj(&o); + free(buf); } }