From 18c383ac2da9b56a84374645eac3868de0c9331e Mon Sep 17 00:00:00 2001 From: glenda Date: Mon, 12 Sep 2022 15:38:48 +0000 Subject: Try to throw errors on C stack overflows --- apl9.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'apl9.h') diff --git a/apl9.h b/apl9.h index 0fafe80..19c21aa 100644 --- a/apl9.h +++ b/apl9.h @@ -2,6 +2,9 @@ #define MAX_LINE_LENGTH 1024 #define MAX_LINE_TOKENS 1024 +#define STACKSIZE (1024*1024) /* 1 MB */ +#define REQUIREDSTACK (16*1024) /* 16 KB */ + typedef enum { ArrayTag, @@ -53,6 +56,7 @@ typedef enum EValue = 6, EDomain = 11, ETimeout = 12, /* not in dyalog */ + EStack = 13, /* C stack overflow */ ENotImplemented = 100, /* not in dyalog */ } errorCodes; @@ -233,6 +237,7 @@ struct DfnFrame struct ThreadData { int id; + int requiredstack; DfnFrame *currentdfn; Mail *mail; Mail *lastmail; @@ -350,6 +355,9 @@ void messagesend(Array *, int); Array *messagerecv(Function, int); Array *runningtasks(void); Array *taskproperty(vlong, vlong); +int stackused(void); +int hasstack(int); +void checkstack(void); /* Monadic functions from function.c */ Array *fnNegate(Array *); -- cgit v1.2.3