From 40af1deff9db7b86532db6957ebdbc0aaff38db1 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Tue, 22 Feb 2022 21:25:36 +0000 Subject: Make errors more like dyalog: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use the same error numbers * Rename ⎕THROW to ⎕SIGNAL * Implement ⎕EN to inspect the last error code * Implement ⎕EM to get a message from an error code --- apl9.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'apl9.h') diff --git a/apl9.h b/apl9.h index 88135c6..51cebfb 100644 --- a/apl9.h +++ b/apl9.h @@ -45,16 +45,14 @@ typedef enum typedef enum { - ESyntax = 1, - EParse, - EValue, - EDomain, - ERank, - EType, - ELength, - EIndex, - EShape, - ENotImplemented, + /* The numbers are the same as in dyalog */ + ESyntax = 2, + EIndex = 3, + ERank = 4, + ELength = 5, + EValue = 6, + EDomain = 11, + ENotImplemented = 100, /* not in dyalog */ } errorCodes; /* Data types */ @@ -330,6 +328,7 @@ Datum *quadnamedatum(QuadnameDef); /* error.c */ ErrorGuard *newerrorguard(Array *, Statement *); void throwerror(Rune *, int); +Rune *errorstr(int); /* inverse.c */ Function inverse(Function); @@ -479,6 +478,5 @@ extern int arrayalloccounts; /* memory.c */ extern int datumalloccounts; /* memory.c */ extern QuadnameDef quadnames[]; /* quadnames.c */ extern int printprecision; /* print.c */ -extern Rune *errorstrs[]; /* error.c */ extern int needsnewline; /* quadnames.c */ extern int mainstacksize; /* concurrency.c */ \ No newline at end of file -- cgit v1.2.3