New callstack display

release
Slava Pestov 2007-10-05 01:08:34 -04:00
parent c8042a0e72
commit 5771e256b3
4 changed files with 48 additions and 29 deletions

View File

@ -22,11 +22,13 @@ GENERIC: pprint* ( obj -- )
! Atoms
: word-style ( word -- style )
[
dup presented set
dup parsing? over delimiter? rot t eq? or or
[ bold font-style set ] when
] H{ } make-assoc ;
dup "word-style" word-prop >hashtable [
[
dup presented set
dup parsing? over delimiter? rot t eq? or or
[ bold font-style set ] when
] bind
] keep ;
: word-name* ( word -- str )
word-name "( no name )" or ;
@ -129,15 +131,9 @@ M: pathname pprint* dup pathname-string "P\" " pprint-string ;
dup zero? [ 2drop f ] [ >r head r> ] if
] when ;
: pprint-hilite ( n object -- )
pprint* hilite-index get = [ hilite ] when ;
: pprint-elements ( seq -- )
do-length-limit >r dup hilite-quotation get eq? [
[ length ] keep [ pprint-hilite ] 2each
] [
[ pprint* ] each
] if
do-length-limit >r
[ pprint* ] each
r> [ "~" swap number>string " more~" 3append text ] when* ;
GENERIC: pprint-delims ( obj -- start end )

View File

@ -6,7 +6,8 @@ math namespaces sequences strings io.styles io.streams.string
vectors words prettyprint.backend prettyprint.sections
prettyprint.config sorting splitting math.parser vocabs
definitions effects tuples io.files classes continuations
hashtables classes.mixin classes.union classes.predicate ;
hashtables classes.mixin classes.union classes.predicate
combinators quotations ;
: make-pprint ( obj quot -- block in use )
[
@ -85,20 +86,48 @@ hashtables classes.mixin classes.union classes.predicate ;
: .s ( -- ) datastack stack. ;
: .r ( -- ) retainstack stack. ;
: callframe. ( seq pos -- )
SYMBOL: ->
\ ->
{ { foreground { 1 1 1 1 } } { background { 0 0 0 1 } } }
"word-style" set-word-prop
<PRIVATE
! This code is ugly and could probably be simplified
: remove-step-into
building get dup empty? [
drop \ (step-into) ,
] [
pop dup wrapper? [ wrapped ] when ,
] if ;
: (remove-breakpoints) ( quot -- newquot )
[
[
hilite-index set
dup hilite-quotation set
2 nesting-limit set
.
] with-scope
{
{ break [ ] }
{ (step-into) [ remove-step-into ] }
[ , ]
} case
] each
] [ ] make ;
: remove-breakpoints ( quot pos -- quot' )
over quotation? [
1+ swap cut [ (remove-breakpoints) ] 2apply
[ -> ] swap 3append
] [
.
] if* ;
drop
] if ;
PRIVATE>
: callstack. ( callstack -- )
callstack>array 2 <groups> [ callframe. ] assoc-each ;
callstack>array 2 <groups> [
remove-breakpoints
2 nesting-limit [ . ] with-variable
] assoc-each ;
: .c ( -- ) callstack callstack. ;

View File

@ -74,7 +74,6 @@ HELP: section
{ $link block }
{ $link inset }
{ $link flow }
{ $link hilite }
{ $link colon }
}
"Instances of this class have the following slots:"

View File

@ -157,11 +157,6 @@ TUPLE: block sections ;
{ highlight t }
} ;
: hilite ( -- )
last-section
dup section-style hilite-style union
swap set-section-style ;
: start-group ( -- )
t last-section set-section-start-group? ;