diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 987aaf329b..8002133597 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -26,6 +26,7 @@ - doc sweep - tool help - keyboard help: hide commands whose gestures are shadowed +- how do we refer to command shortcuts in the docs? + ui: diff --git a/doc/handbook/ui/tools.facts b/doc/handbook/ui/tools.facts index 8659acf8ec..5342e4e421 100644 --- a/doc/handbook/ui/tools.facts +++ b/doc/handbook/ui/tools.facts @@ -22,11 +22,21 @@ ARTICLE: "ui-help" "UI documentation browser" ; ARTICLE: "ui-walker" "UI walker" +"The walker single-steps through quotations. To use the walker, enter a piece of code in the listener's input area and press " { $snippet "C+A+w" } "." +$terpri +"The walker can travel backwards through time, and restore stacks. This does not undo side effects and therefore can only be used reliably on referentially transparent code." +$terpri "Walkers are instances of " { $link walker-gadget } "." { $commands walker-gadget } ; ARTICLE: "ui-dataflow" "UI dataflow tool" +"The dataflow viewer displays the stack effect of a quotation in a graphical way. To use it, enter a piece of code in the listener's input area and press " { $snippet "C+A+d" } ", or click the " { $strong "Dataflow" } " button in a definition tile shown by the UI browser." +$terpri +"Only quotations and words for which a stack effect can be inferred can be viewed. See " { $link "inference" } "." +$terpri +"The dataflow viewer displays the dataflow intermediate representation output by the compiler's optimizer. Therefore inlining and various other optimizations will have already been performed, and the visual representation may not resemble your original code in many ways. An upside of this arrangement is that the dataflow viewer can be used to predict how fast the code will run, because you will see which layers of generic dispatch have been optimized out at compile time." +$terpri "Dataflow viewers are instances of " { $link dataflow-gadget } "." { $commands dataflow-gadget } ; diff --git a/examples/print-dataflow.factor b/examples/print-dataflow.factor index 556f4ef859..9879d22802 100644 --- a/examples/print-dataflow.factor +++ b/examples/print-dataflow.factor @@ -1,6 +1,7 @@ -IN: optimizer +IN: print-dataflow USING: generic hashtables inference io kernel kernel-internals -math namespaces prettyprint sequences styles vectors words ; +math namespaces prettyprint sequences styles vectors words +test optimizer ; ! A simple tool for turning dataflow IR into quotations, for ! debugging purposes. @@ -82,3 +83,11 @@ M: object node>quot dup class word-name comment, ; #! Print dataflow IR for a quotation. Flag indicates if #! annotations should be printed or not. >r dataflow optimize r> dataflow>quot . ; + +[ ] [ [ 2 ] t dataflow. ] unit-test +[ ] [ [ 3 + ] t dataflow. ] unit-test +[ ] [ [ drop ] t dataflow. ] unit-test +[ ] [ [ [ sq ] [ abs ] if ] t dataflow. ] unit-test +[ ] [ [ { [ sq ] [ abs ] } dispatch ] t dataflow. ] unit-test +[ ] [ \ unify-values word-def t dataflow. ] unit-test +[ ] [ [ 0 0 / ] t dataflow. ] unit-test diff --git a/library/compiler/test/print-dataflow.factor b/library/compiler/test/print-dataflow.factor deleted file mode 100644 index 23fcd04bde..0000000000 --- a/library/compiler/test/print-dataflow.factor +++ /dev/null @@ -1,9 +0,0 @@ -USING: inference kernel kernel-internals math test words ; - -[ ] [ [ 2 ] t dataflow. ] unit-test -[ ] [ [ 3 + ] t dataflow. ] unit-test -[ ] [ [ drop ] t dataflow. ] unit-test -[ ] [ [ [ sq ] [ abs ] if ] t dataflow. ] unit-test -[ ] [ [ { [ sq ] [ abs ] } dispatch ] t dataflow. ] unit-test -[ ] [ \ unify-values word-def t dataflow. ] unit-test -[ ] [ [ 0 0 / ] t dataflow. ] unit-test diff --git a/library/help/markup.factor b/library/help/markup.factor index 92cfb6996d..69ded476db 100644 --- a/library/help/markup.factor +++ b/library/help/markup.factor @@ -70,6 +70,8 @@ M: f print-element drop ; : $emphasis [ emphasis-style print-element* ] ($span) ; +: $strong [ strong-style print-element* ] ($span) ; + : $url [ url-style print-element* ] ($span) ; : $terpri terpri terpri drop ; diff --git a/library/help/stylesheet.factor b/library/help/stylesheet.factor index ad6a100206..605248b15f 100644 --- a/library/help/stylesheet.factor +++ b/library/help/stylesheet.factor @@ -20,6 +20,9 @@ USING: styles ; : emphasis-style H{ { font-style italic } } ; +: strong-style + H{ { font-style bold } } ; + : title-style H{ { font "sans-serif" } diff --git a/library/ui/tools/help.factor b/library/ui/tools/help.factor index 8a25f9c1c5..f92a556db1 100644 --- a/library/ui/tools/help.factor +++ b/library/ui/tools/help.factor @@ -29,3 +29,6 @@ C: help-gadget ( -- gadget ) M: help-gadget focusable-child* help-gadget-search ; M: help-gadget call-tool* show-help ; + +: help-action ( help-gadget -- link ) + help-gadget-history model-value ; diff --git a/library/ui/tools/operations.factor b/library/ui/tools/operations.factor index cbb131ad34..6976cce990 100644 --- a/library/ui/tools/operations.factor +++ b/library/ui/tools/operations.factor @@ -114,6 +114,11 @@ M: operation invoke-command ( target operation -- ) { +quot+ [ edit ] } } define-operation +[ link? ] H{ + { +name+ "Reload" } + { +quot+ [ reload ] } +} define-operation + [ word-link? ] H{ { +button+ 3 } { +name+ "Definition" } @@ -178,7 +183,7 @@ M: operation invoke-command ( target operation -- ) ! Dataflow nodes [ word? ] H{ { +group+ "Word commands" } - { +name+ "Word dataflow" } + { +name+ "Dataflow" } { +gesture+ T{ key-down f { A+ } "d" } } { +quot+ [ word-def show-dataflow ] } } define-operation @@ -235,8 +240,8 @@ help-gadget [ { "Back" T{ key-down f { C+ } "b" } [ help-gadget-history go-back ] } { "Forward" T{ key-down f { C+ } "f" } [ help-gadget-history go-forward ] } { "Home" T{ key-down f { C+ } "h" } [ go-home ] } - } + } % - [ help-gadget-history model-value ] link class-operations modify-listener-operations + [ help-action ] link class-operations modify-listener-operations [ command-name "Follow" = not ] subset % ] { } make define-commands*