diff options
| author | kitty <nepeta@canaglie.net> | 2026-04-08 17:30:24 +1000 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-04-08 17:30:24 +1000 |
| commit | 9ac53463c56dd57a84036a6944e6b4e5d3829e9c (patch) | |
| tree | 00303e73411d376b2afd78bc1e75f75d65b86960 /sanctuary.fs | |
| parent | 6b4b8ad13b174da2ed172d3eca2f6bd3553f7b71 (diff) | |
some erroring stuff
Diffstat (limited to 'sanctuary.fs')
| -rw-r--r-- | sanctuary.fs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/sanctuary.fs b/sanctuary.fs index b7e5469..1acb5ee 100644 --- a/sanctuary.fs +++ b/sanctuary.fs @@ -174,14 +174,17 @@ false value nonaming 1 constant stdout 2 constant stderr -: sys-write 0 syscall3 ; -: sys-read 1 syscall3 ; +: sys-read 0 syscall3 ; +: sys-write 1 syscall3 ; : sys-open 2 syscall3 ; : sys-close 3 syscall1 ; -: type swap stdout sys-read drop ; +: type swap stdout sys-write drop ; +: etype swap stderr sys-write drop ; : emit sp 1 type drop ; +: cr 10 emit ; + 0 constant r/o 1 constant w/o 2 constant r/w @@ -198,7 +201,29 @@ false value nonaming -1 constant string-source init-source value source-id -: ." ; \ todo doc +\ syntax highlighting cannot handle this. oops,, +: ." postpone s" postpone type ; immediate compile-only \ " + +: e." postpone s" postpone etype ; immediate compile-only \ " +: (abort") ( ? a u -- ) rot 0<> if etype abort else 2drop then ; +: abort" postpone s" postpone (abort") ; immediate compile-only + +\ stk under/overflow ones need to clear the stack first +\ feels wrong but i think its correct +:noname e." word not found" cr abort ; is ?notfound? +:noname sp-reset e." stack overflow" cr abort ; is ?overflow? +:noname sp-reset e." stack underflow" cr abort ; is ?underflow? + +\ if you need more than 16 layers of included files: go away™ +\ todo doc +16 constant #buffers +0 value include-depth +8192 constant /buffer +2048 constant /line-buffer + +\ this bit is so large that i may increase the default brk +create buffers /buffer #buffers * allot +create line-buffers /line-buffer #buffers * allot \ OLD VERSION I GAVE UP ON BECAUSE IT'S TOO COMPLICATED AND SUCKS SHIT {{{ \ 8192 constant /buffer |
