[OpenBIOS] [PATCH 5/7] ciface.fs: implement optional (exit) hook when returning control back to the interpreter

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Fri Feb 5 19:09:04 CET 2016


This allows us to optionally intercept and execute code before returning back
to the Forth interactive console.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/forth/system/ciface.fs |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/openbios-devel/forth/system/ciface.fs b/openbios-devel/forth/system/ciface.fs
index fd6c54e..85a6076 100644
--- a/openbios-devel/forth/system/ciface.fs
+++ b/openbios-devel/forth/system/ciface.fs
@@ -326,6 +326,14 @@ external
 
 : exit ( -- )
   ." EXIT"
+  
+  \ Execute (exit) hook if one exists
+  s" (exit)" $find if
+    execute
+  else
+    2drop
+  then
+  
   outer-interpreter
 ;
 
-- 
1.7.10.4




More information about the OpenBIOS mailing list