Get returns working
This commit is contained in:
+8
-38
@@ -3,22 +3,8 @@
|
||||
|
||||
static int exit_status = 0;
|
||||
|
||||
LispVal *Ftoplevel_exit_handler(LispVal *except);
|
||||
static LispFunction _Ftoplevel_exit_handler_function = {
|
||||
.type = TYPE_FUNCTION,
|
||||
.is_builtin = true,
|
||||
.is_macro = false,
|
||||
.builtin = (lisp_function_ptr_t) &Ftoplevel_exit_handler,
|
||||
.args = Qnil,
|
||||
.kwargs = Qnil,
|
||||
.rargs = Qnil,
|
||||
.oargs = Qnil,
|
||||
.rest_arg = Qnil,
|
||||
.lexenv = Qnil,
|
||||
};
|
||||
#define Ftoplevel_exit_handler_function \
|
||||
LISPVAL(&_Ftoplevel_exit_handler_function)
|
||||
LispVal *Ftoplevel_exit_handler(LispVal *except) {
|
||||
STATIC_DEFUN(toplevel_exit_handler, "toplevel-exit-handler",
|
||||
(LispVal * except)) {
|
||||
LispVal *detail = TAIL(HEAD(except));
|
||||
if (NILP(detail) || NILP(HEAD(detail))) {
|
||||
exit_status = 0;
|
||||
@@ -30,22 +16,8 @@ LispVal *Ftoplevel_exit_handler(LispVal *except) {
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
LispVal *Ftoplevel_error_handler(LispVal *except);
|
||||
static LispFunction _Ftoplevel_error_handler_function = {
|
||||
.type = TYPE_FUNCTION,
|
||||
.is_builtin = true,
|
||||
.is_macro = false,
|
||||
.builtin = (lisp_function_ptr_t) &Ftoplevel_error_handler,
|
||||
.args = Qnil,
|
||||
.kwargs = Qnil,
|
||||
.lexenv = Qnil,
|
||||
.rargs = Qnil,
|
||||
.oargs = Qnil,
|
||||
.rest_arg = Qnil,
|
||||
};
|
||||
#define Ftoplevel_error_handler_function \
|
||||
LISPVAL(&_Ftoplevel_error_handler_function)
|
||||
LispVal *Ftoplevel_error_handler(LispVal *except) {
|
||||
STATIC_DEFUN(toplevel_error_handler, "toplevel-error-handler",
|
||||
(LispVal * except)) {
|
||||
LispVal *type = HEAD(HEAD(except));
|
||||
LispVal *detail = TAIL(HEAD(except));
|
||||
LispVal *backtrace = HEAD(TAIL(except));
|
||||
@@ -84,19 +56,17 @@ int main(int argc, const char **argv) {
|
||||
fclose(in);
|
||||
lisp_init();
|
||||
REGISTER_SYMBOL(toplevel_read);
|
||||
REGISTER_STATIC_FUNCTION(Ftoplevel_error_handler_function, "(e)", "");
|
||||
REGISTER_STATIC_FUNCTION(Ftoplevel_exit_handler_function, "(e)", "");
|
||||
REGISTER_STATIC_FUNCTION(toplevel_error_handler, "(e)", "");
|
||||
REGISTER_STATIC_FUNCTION(toplevel_exit_handler, "(e)", "");
|
||||
size_t pos = 0;
|
||||
WITH_PUSH_FRAME(Qtoplevel, Qnil, false, {
|
||||
LispVal *err_var = INTERN_STATIC("err-var");
|
||||
puthash(the_stack->handlers, Qt,
|
||||
// simply call the above function
|
||||
const_list(true, 3, err_var, Ftoplevel_error_handler_function,
|
||||
err_var));
|
||||
const_list(true, 3, err_var, Qtoplevel_error_handler, err_var));
|
||||
puthash(the_stack->handlers, Qshutdown_signal,
|
||||
// simply call the above function
|
||||
const_list(true, 3, err_var, Ftoplevel_exit_handler_function,
|
||||
err_var));
|
||||
const_list(true, 3, err_var, Qtoplevel_exit_handler, err_var));
|
||||
LispVal *nil_nil = Fpair(Qnil, Qnil);
|
||||
puthash(the_stack->handlers, Qeof_error,
|
||||
// ignore
|
||||
|
||||
Reference in New Issue
Block a user