diff --git a/src/pebblisp.c b/src/pebblisp.c index 9016107..29ea9dd 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -599,8 +599,9 @@ int _readFile(FILE* input, struct Environment* env) void repl(struct Environment* env) { char* buf; - using_history(); Object prompt; + using_history(); + while ((buf = readline((prompt = fetchFromEnvironment("prompt", env)).string)) != NULL) { cleanObject(&prompt); if (strcmp("q", buf) == 0) { @@ -617,14 +618,14 @@ void repl(struct Environment* env) free(oldBuf); } Object o = parseEval(buf, env); + free(buf); + size_t length; char *output = stringObj(&o, &length); - printColored(output); - printf("\n"); - cleanObject(&o); + printColored(output); free(output); - free(buf); + printf("\n"); } cleanObject(&prompt); } diff --git a/src/plfunc.h b/src/plfunc.h index f745567..e200530 100644 --- a/src/plfunc.h +++ b/src/plfunc.h @@ -30,7 +30,7 @@ BASIC_OP(or); tfn(catObjects, ({ NULL, isStringy }), - "Concatenate string versions of the given objects.", + "Concatenate string representations of the given objects.", "(cat \"Stuff: \" (1 2 3))", "Stuff: ( 1 2 3 )", ); @@ -55,7 +55,7 @@ tfn(prepend, tfn(len, ({ isListy, isNumber }), - "Returns the length of the given list, or a NOT_A_LIST error if the expression is not a list.", + "Returns the length of the given list, or an error if the expression is not a list.", "(len (2 3))", "2", "(len ())", "0", "(len \"string\")", "BAD_PARAMS_ON: len", diff --git a/src/web.h b/src/web.h index 6bd243f..18bd8b9 100644 --- a/src/web.h +++ b/src/web.h @@ -2,10 +2,9 @@ fn(startServer, "(serve) => 0\n" - "Starts a simple web server with routes that have been added with (get) and (post).\n" + "Starts a simple web server with routes that have been added using (get) and (post).\n" "Returns 0 if the server was successfully started, otherwise 1.\n" - "Note: This is a non-blocking call. It is recommended to wait for some input before exiting.\n" - " A simple way would be to use (inp) immediately after the (serve) call." + "Note: Not a blocking call! Calling (inp) is a simple way to keep the server open.\n" ); fn(addGetRoute,