summaryrefslogtreecommitdiff
path: root/apl9.h
diff options
context:
space:
mode:
authorglenda <glenda@cirno>2022-09-12 15:38:48 +0000
committerglenda <glenda@cirno>2022-09-12 15:38:48 +0000
commit18c383ac2da9b56a84374645eac3868de0c9331e (patch)
tree2673338b6522b1b410b6f25660b94b04a84f9814 /apl9.h
parent9f463939c96f8528819c66678c1be0c6333cdd11 (diff)
Try to throw errors on C stack overflows
Diffstat (limited to 'apl9.h')
-rw-r--r--apl9.h8
1 files changed, 8 insertions, 0 deletions
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 *);