parent
d76e3f5341
commit
f2742e8411
|
@ -9,11 +9,15 @@ 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 -g -O0 -Wall -o $(exe) -D WEBSERVER -D STANDALONE -DSCRIPTDIR=\"$(SCRIPTDIR)\"
|
GCC_ARGS ?= -g -Wall -o $(exe) -D WEBSERVER -D STANDALONE -DSCRIPTDIR=\"$(SCRIPTDIR)\"
|
||||||
|
GCC_COM ?= gcc -O0 $(GCC_ARGS)
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(GCC_COM) $(file_libs) && echo && ./tests.sh
|
$(GCC_COM) $(file_libs) && echo && ./tests.sh
|
||||||
|
|
||||||
|
release:
|
||||||
|
gcc -O3 $(GCC_ARGS) $(file_libs) && strip ./$(exe) && echo && ./tests.sh
|
||||||
|
|
||||||
notest:
|
notest:
|
||||||
$(GCC_COM) $(file_libs)
|
$(GCC_COM) $(file_libs)
|
||||||
|
|
||||||
|
|
|
@ -440,6 +440,7 @@ struct Environment defaultEnv()
|
||||||
pf(loadFile),
|
pf(loadFile),
|
||||||
pf(takeInput),
|
pf(takeInput),
|
||||||
pf(readFileToObject),
|
pf(readFileToObject),
|
||||||
|
pf(getEnvVar),
|
||||||
pf(help)
|
pf(help)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -391,7 +391,8 @@ Result readSeq(struct Slice* tokens)
|
||||||
nf_addToList(&res, cloneObject(r.obj));
|
nf_addToList(&res, cloneObject(r.obj));
|
||||||
tokens = r.slices;
|
tokens = r.slices;
|
||||||
cleanObject(&r.obj);
|
cleanObject(&r.obj);
|
||||||
forceString = next->text[0] == '?' || (strncmp(next->text, "def", 3) == 0);
|
forceString = next->text[0] == '?'
|
||||||
|
|| (strncmp(next->text, "def", 3) == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,8 +701,9 @@ int main(int argc, const char* argv[])
|
||||||
Object o = parseEval("(def prompt \"pebblisp::> \")", &env);
|
Object o = parseEval("(def prompt \"pebblisp::> \")", &env);
|
||||||
cleanObject(&o);
|
cleanObject(&o);
|
||||||
|
|
||||||
char config[strlen(getenv("HOME")) + 15];
|
const char * const home = getenv("HOME");
|
||||||
sprintf(config, "%s/.pebblisp.pbl", getenv("HOME"));
|
char config[strlen(home) + 15];
|
||||||
|
sprintf(config, "%s/.pebblisp.pbl", home);
|
||||||
readFile(config, &env);
|
readFile(config, &env);
|
||||||
|
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
|
|
|
@ -486,6 +486,12 @@ Object readFileToObject(Object* params, int length, struct Environment* env)
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object getEnvVar(Object* params, int length, struct Environment* env)
|
||||||
|
{
|
||||||
|
checkTypes(getEnvVar)
|
||||||
|
return nullTerminated(getenv(params[0].string));
|
||||||
|
}
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
int timeStructDefinition = -1;
|
int timeStructDefinition = -1;
|
||||||
|
|
|
@ -240,6 +240,12 @@ tfn(readFileToObject, "rf",
|
||||||
"Read a file into a string object."
|
"Read a file into a string object."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
tfn(getEnvVar, "env",
|
||||||
|
({ isStringy, isStringy }),
|
||||||
|
"Get a variable from the current environment\n"
|
||||||
|
"(env HOME) => /home/sagevaillancourt"
|
||||||
|
);
|
||||||
|
|
||||||
fn(getTime, "time",
|
fn(getTime, "time",
|
||||||
"Get a struct of the current time with fields (minute hour sec)."
|
"Get a struct of the current time with fields (minute hour sec)."
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue