Annotation of gforth/smartdots.fs, revision 1.1
1.1 ! pazsan 1: \ smart .s
! 2:
! 3: : addr? ( addr -- flag )
! 4: TRY @ IFERROR 2drop false ELSE drop true THEN ENDTRY ;
! 5:
! 6: : string? ( addr u -- flag )
! 7: TRY bounds ?DO I c@ bl < IF -1 throw THEN LOOP
! 8: IFERROR 2drop drop false ELSE true THEN ENDTRY ;
! 9:
! 10: : .string. ( addr u -- )
! 11: '"' emit type '"' emit space ;
! 12: : .addr. ( addr -- ) hex. ;
! 13:
! 14: : .s ( -- ) \ tools dot-s
! 15: \G Display the number of items on the data stack, followed by a list
! 16: \G of the items (but not more than specified by @code{maxdepth-.s};
! 17: \G TOS is the right-most item.
! 18: ." <" depth 0 .r ." > "
! 19: depth 0 max maxdepth-.s @ min
! 20: dup 0
! 21: ?do
! 22: dup i - pick over i - pick 2dup string? IF .string. 2
! 23: ELSE drop dup addr? IF .addr. 1
! 24: ELSE .s. 1 THEN
! 25: THEN
! 26: +loop
! 27: drop ;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>