#include <string.h>
#include <sys/stat.h>
+extern bool is_repl;
+
int main(int argc, char** argv) {
int i;
bool loaded = false;
}
#ifdef HAS_REPL_SUPPORT
if(!loaded) {
+ is_repl = true;
printf("Welcome to Serenade LISP %s\n", SERENADE_VERSION);
printf("Support: %s\n", SUPPORT);
printf("Parser stack size: %d\n", PARSER_STACK_SIZE);
#include "run.h"
+#include "serenade.h"
#include "util.h"
#include <stdbool.h>
free(r);
return NULL;
} else {
+ if(strcmp(op->name, "serenade-version") == 0) {
+ r->type = SN_TYPE_STRING;
+ r->string = sn_strdup(SERENADE_VERSION);
+ r->string_length = strlen(r->string);
+ return r;
+ }
bool called = false;
int j;
for(j = 0; gen->tree->args[j]; j++)
return NULL;
}
+bool is_repl = false;
+
int sn_run(struct sn_interpreter* sn, struct sn_generic* gen) {
struct sn_generic* rgen = _sn_run(sn, gen);
if(rgen == NULL) return 1;
+ if(is_repl) {
+ sn_print_to(stdout, rgen);
+ printf("\n");
+ }
return 0;
}