Author: wmb Date: 2007-08-24 01:31:44 +0200 (Fri, 24 Aug 2007) New Revision: 576
Modified: forth/kernel/kernel.fth Log: Fixed a longstanding bug that caused misleading error messages when interpreting from files. The problem is that the line buffer memory has been freed and possibly overwritten before the undefined word name is displayed. The solution is to copy the word name to a dedicated buffer.
Modified: forth/kernel/kernel.fth =================================================================== --- forth/kernel/kernel.fth 2007-08-23 23:28:07 UTC (rev 575) +++ forth/kernel/kernel.fth 2007-08-23 23:31:44 UTC (rev 576) @@ -995,9 +995,11 @@ then ; headers +0 value 'error-word : .not-found ( adr len -- ) where type ." ?" cr ; \ Abort after an undefined word in interpret state : $interpret-do-undefined ( adr len -- ) + d# 32 min 'error-word pack count set-abort-message d# -13 throw ; \ Compile a surrogate for an undefined word in compile state @@ -1532,6 +1534,7 @@ init d# 20 alloc-mem is fake-name-buf d# 32 alloc-mem is canonical-word + d# 34 alloc-mem is 'error-word ; headers