parent
70ea45ab84
commit
05a44aa547
|
@ -64,6 +64,7 @@ USE: vectors
|
|||
"Overflow"
|
||||
"Incomparable types: "
|
||||
"Float format: "
|
||||
"Signal "
|
||||
] ?nth ;
|
||||
|
||||
: ?kernel-error ( cons -- error# param )
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define ERROR_OVERFLOW (6<<3)
|
||||
#define ERROR_INCOMPARABLE (7<<3)
|
||||
#define ERROR_FLOAT_FORMAT (8<<3)
|
||||
#define ERROR_SIGNAL (9<<3)
|
||||
|
||||
void fatal_error(char* msg, CELL tagged);
|
||||
void critical_error(char* msg, CELL tagged);
|
||||
|
|
|
@ -15,6 +15,7 @@ int main(int argc, char** argv)
|
|||
init_stacks();
|
||||
init_iomux();
|
||||
init_io();
|
||||
init_signals();
|
||||
|
||||
run();
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
16
native/run.c
16
native/run.c
|
@ -1,5 +1,21 @@
|
|||
#include "factor.h"
|
||||
|
||||
void signal_handler(int signal, siginfo_t* siginfo, void* uap)
|
||||
{
|
||||
general_error(ERROR_SIGNAL,tag_fixnum(signal));
|
||||
}
|
||||
|
||||
void init_signals(void)
|
||||
{
|
||||
struct sigaction custom_sigaction;
|
||||
custom_sigaction.sa_sigaction = signal_handler;
|
||||
custom_sigaction.sa_flags = SA_SIGINFO;
|
||||
sigaction(SIGABRT,&custom_sigaction,NULL);
|
||||
sigaction(SIGFPE,&custom_sigaction,NULL);
|
||||
sigaction(SIGBUS,&custom_sigaction,NULL);
|
||||
sigaction(SIGSEGV,&custom_sigaction,NULL);
|
||||
}
|
||||
|
||||
void clear_environment(void)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -33,6 +33,8 @@ typedef struct {
|
|||
|
||||
ENV env;
|
||||
|
||||
void init_signals(void);
|
||||
|
||||
void clear_environment(void);
|
||||
|
||||
INLINE CELL dpop(void)
|
||||
|
|
Loading…
Reference in New Issue