Add hard-coded readline REPL.
...the library issue was not Ubuntu's fault.
This commit is contained in:
parent
a59ce1646f
commit
2cc97288bf
18
src/Makefile
18
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)
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue