From 1f3541bfd39d6e7669c8b9401e40bc79cc8724c3 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 25 Oct 2017 12:06:01 +0000 Subject: [PATCH] fix some bugs in autopsy FossilOrigin-Name: b550719db948ea92469f021fe813a2b1aacbdf46d4ba146220b75028948118bf --- example/Autopsy.forth | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/example/Autopsy.forth b/example/Autopsy.forth index 53dd5f8..6b794e3 100644 --- a/example/Autopsy.forth +++ b/example/Autopsy.forth @@ -1,20 +1,7 @@ -# example|Autopsy +# Autopsy Autopsy is a debugging tool for Retro. -Declare module constant (prevents reloading with multiple `import` statements) - -```` -:example|Autopsy ; -```` - -Import dependencies: - -```` -'FormattedStringOutput import:module -'Strings import:module -```` - ---- This module provides words to aid in debugging your code. @@ -24,13 +11,13 @@ This module provides words to aid in debugging your code. here #128 allot 'NEEDLE const ---reveal--- :words (s-) - dup '\n%s_contains:\n putsf + dup '\n%s_contains:\n s:with-format puts NEEDLE over s:length n:inc copy &Dictionary repeat fetch 0; dup d:name #0 NEEDLE s:length s:substr - NEEDLE s:eq? [ dup d:name NEEDLE s:length + '__%s\n putsf ] if + NEEDLE s:eq? [ dup d:name NEEDLE s:length + '__%s\n s:with-format puts ] if again ; }} ```` @@ -43,7 +30,7 @@ A simple binary dump is pretty easy: ```` :dump (an-) - [ fetch-next over '%n_%n\n putsf ] times drop ; + [ fetch-next over '%n_%n\n s:with-format puts ] times drop ; ```` This can be useful, but the output doesn't help a lot. Consider an example: @@ -130,3 +117,8 @@ And tying together: putn nl (opcode) ] times drop ; ```` + +~~~ +:test #2 #2 + ; +&test here over - disassemble +~~~