summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-02-27 03:19:31 +1100
committerkitty <nepeta@canaglie.net>2026-02-27 03:19:31 +1100
commit246f0e1948c2dbc97965820bc2367d2cef704ed5 (patch)
tree5e1140f05b193b3624ce49d73c707e786179ea06
parent68c945a5fa5dc53b0f7cb225c18a7c6029e44e3c (diff)
.errno
i should go to bed
-rw-r--r--jefs.fs8
-rw-r--r--readme.md2
2 files changed, 8 insertions, 2 deletions
diff --git a/jefs.fs b/jefs.fs
index 52f9cc4..778cc8a 100644
--- a/jefs.fs
+++ b/jefs.fs
@@ -194,7 +194,6 @@ variable hld
\ FUCK is BYE but it takes an error code. its called that because you call it when shit is fucked.
: fuck ( code -- ) 60 syscall1 ;
-\ TODO broken as shit
: (handler) >s0 error @ dup case
1 of ." stack underflow" endof
2 of ." word not found" endof
@@ -217,6 +216,13 @@ variable hld
2 constant enoent
9 constant ebadf
13 constant eacces
+
+: .errno ( err -- ) ?dup 0<> if case
+ enoent of ." no such file or directory" endof
+ ebadf of ." bad file descriptor" endof
+ eacces of ." permission denied" endof
+ ." mystery error (spooky)"
+ endcase cr then ;
\ }}}
\ FILE I/O {{{
diff --git a/readme.md b/readme.md
index c72a595..9a34d61 100644
--- a/readme.md
+++ b/readme.md
@@ -73,7 +73,7 @@ note that this forth doesn't have double numbers
(i don't think it's necessary, since cells are 64 bit)
so PNO works on single cell values.
-### error codes
+## error codes
in order to have Good Error Handling anywhere, the error handler's xt
is stored in the `handler` variable and is then called by loading its value
and `execute`ing it. the actual description of the error comes from the