From 9014dde6d62d7d37e3ccb050608db15ed9930b49 Mon Sep 17 00:00:00 2001 From: kitty Date: Sun, 8 Mar 2026 15:42:53 +1100 Subject: new error: includes too recursed --- jefs.fs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'jefs.fs') diff --git a/jefs.fs b/jefs.fs index 6b631a2..f9eba09 100644 --- a/jefs.fs +++ b/jefs.fs @@ -47,7 +47,6 @@ hex : ret, c3 c, ; decimal : constant create [compile] lit ret, ; : variable 1 cells allot@ create [compile] lit ret, ; \ maybe i made bad design decisions, this is CREATE but it pushes a pointer to just after its definition. for arrays and the like -\ does not use LIT because we want to fill it in After : make create here @ 18 + [compile] lit ret, ; 0 constant false @@ -130,7 +129,7 @@ variable disp : modrm, modrm @ c, disp @ ?dup 0<> if c, then ; : mod0 modrm @ 3f and modrm ! ; -: d) dup disp ! mod0 0<> if modrm @ 40 or modrm ! then ; \ disp8 or 0 only for now. bug TODO: doesn't put correct .mod bytes +: d) dup disp ! mod0 0<> if modrm @ 40 or modrm ! then ; \ disp8 or 0 only for now. : disp, disp @ ?dup 0<> if c, then ; : mov, rex, 8b c, modrm @ c, disp, asm$ ; @@ -239,7 +238,7 @@ decimal : .free bytes-free u. ." of " bytes-allocated u. ." bytes free (used " bytes-used (.) say ." )" cr ; \ }}} -5 constant #error-msgs +6 constant #error-msgs make error-msgs #error-msgs cells allot : set-error ( xt -- ) cells error-msgs + ! ; : write-error cells error-msgs + @ execute ; @@ -248,6 +247,7 @@ make error-msgs #error-msgs cells allot :> ." word not found" ; 2 set-error :> ." compile mode only" ; 3 set-error :> ." interpret mode only" ; 4 set-error +:> ." includes too recursed" ; 5 set-error \ awful description : #bye ( code -- ) 60 syscall1 ; \ maybe this would be more elegant as a table? @@ -341,12 +341,19 @@ make line-buffer line-buffer-length allot \ todo?: reset retstack : quit 0 to source-id [compile] [ begin refill while interpret ." ok" cr repeat ; :> >s0 error @ write-error cr quit ; to handler -\ }}} : (evaluate) ( c-addr u -- ) 0 >in ! ( u ) #tib ! ( c-addr ) tib ! source-id >r string-source to source-id interpret r> to source-id ; : evaluate ( c-addr u -- ) tib @ >r #tib @ >r >in @ >r (evaluate) r> >in ! r> #tib ! r> tib ! ; +: ?inc-depth include-depth max-include-depth > if 0 to include-depth 5 fuck then ; +: include-file tib @ >r #tib @ >r >in @ >r source-id >r 1 +to include-depth + ?inc-depth + 1 -to include-depth >r >in ! >r #tib ! >r tib ! r> to source-id ; +: included ; +: include ; +\ }}} + \ TERMINAL CONTROL {{{ 60 constant termios# make termios termios# allot -- cgit v1.2.3