[OpenBIOS] [PATCHv2 2/3] interpreter.fs: don't clobber stack across evaluate strings split on newlines

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Jul 17 23:31:45 CEST 2016


When an evaluate string is split across a newline, the current string
position is assumed to be the top-most item on the stack. However
in the case of yaboot, items are left on the stack to be used by a
subsequent line within the same evaluate statement and so subsequent
lines are parsed incorrectly.

Fix this by saving the current string position on the r-stack across calls to
(evaluate) so the stack remains correct for subsequent lines.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 forth/bootstrap/interpreter.fs |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/forth/bootstrap/interpreter.fs b/forth/bootstrap/interpreter.fs
index 5187058..b66e95e 100644
--- a/forth/bootstrap/interpreter.fs
+++ b/forth/bootstrap/interpreter.fs
@@ -165,7 +165,9 @@ defer outer-interpreter
   over + over do 
     i c@ 0a = if 
       i over - 
+      rot >r
       (evaluate)
+      r>
       i 1+ 
     then 
   loop 
-- 
1.7.10.4




More information about the OpenBIOS mailing list