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
|
exe = pl
|
||||||
|
|
||||||
|
file_libs := $(files) $(libs)
|
||||||
|
|
||||||
BINPREFIX ?= /usr/bin
|
BINPREFIX ?= /usr/bin
|
||||||
SCRIPTDIR ?= /usr/local/share/pebblisp
|
SCRIPTDIR ?= /usr/local/share/pebblisp
|
||||||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
mkfile_dir := $(dir $(mkfile_path))
|
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:
|
all:
|
||||||
$(GCC_COM) $(files) && echo && ./tests.sh
|
$(GCC_COM) $(files) $(libs) && echo && ./tests.sh
|
||||||
|
echo "$(file_libs)"
|
||||||
|
|
||||||
notest:
|
notest:
|
||||||
$(GCC_COM) $(files)
|
$(GCC_COM) $(file_libs)
|
||||||
|
|
||||||
local:
|
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:
|
val:
|
||||||
$(GCC_COM) $(files) && ./tests.sh -val
|
$(GCC_COM) $(file_libs) && ./tests.sh -val
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(GCC_COM) -D DEBUG $(files)
|
$(GCC_COM) -D DEBUG $(file_libs)
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./$(exe)
|
./$(exe)
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <readline/readline.h>
|
||||||
|
#include <readline/history.h>
|
||||||
|
|
||||||
#include "tokens.h"
|
#include "tokens.h"
|
||||||
#ifdef STANDALONE
|
#ifdef STANDALONE
|
||||||
#include "web.h"
|
#include "web.h"
|
||||||
|
@ -1041,9 +1044,15 @@ Object systemCall(Object process, Object _, struct Environment* env)
|
||||||
|
|
||||||
void repl(struct Environment* env)
|
void repl(struct Environment* env)
|
||||||
{
|
{
|
||||||
if (readFile(SCRIPTDIR "/repl.pbl", env) == 1) {
|
char* buf;
|
||||||
fprintf(stderr, "Could not read '%s'\n", SCRIPTDIR "/repl.pbl");
|
while ((buf = readline("pebblisp::> ")) != NULL) {
|
||||||
fprintf(stderr, "Consider installing or reinstalling pebblisp.\n");
|
if (strcmp("q", buf) == 0) {
|
||||||
|
free(buf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Object o = parseEval(buf, env);
|
||||||
|
printObj(&o);
|
||||||
|
free(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue