From 5d7429c25e868b53eba26ba13dbdc8c6c97ac972 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 20 Jan 2009 15:31:02 +0000 Subject: [PATCH] added yet one more hook to traces/ps svn: r13236 --- collects/redex/gui.ss | 3 ++- collects/redex/private/traces.ss | 4 +++- collects/redex/redex.scrbl | 9 +++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/collects/redex/gui.ss b/collects/redex/gui.ss index f6dfe309d5..c97233b178 100644 --- a/collects/redex/gui.ss +++ b/collects/redex/gui.ss @@ -55,7 +55,8 @@ #:edge-label-font (or/c #f (is-a?/c font%)) #:edge-labels? boolean? #:filter (-> any/c (or/c #f string?) any/c) - #:graph-pasteboard-mixin (make-mixin-contract graph-pasteboard<%>)) + #:graph-pasteboard-mixin (make-mixin-contract graph-pasteboard<%>) + #:post-process (-> (is-a?/c graph-pasteboard<%>) any/c)) any)] [term-node? (-> any/c boolean?)] diff --git a/collects/redex/private/traces.ss b/collects/redex/private/traces.ss index 2e35f26b87..7aeb8c0500 100644 --- a/collects/redex/private/traces.ss +++ b/collects/redex/private/traces.ss @@ -135,7 +135,8 @@ #:edge-label-font [edge-label-font #f] #:edge-labels? [edge-labels? #t] #:graph-pasteboard-mixin [extra-graph-pasteboard-mixin values] - #:filter [term-filter (lambda (x y) #t)]) + #:filter [term-filter (lambda (x y) #t)] + #:post-process [post-process void]) (let-values ([(graph-pb canvas) (traces reductions pre-exprs #:no-show-frame? #t @@ -149,6 +150,7 @@ #:edge-labels? edge-labels? #:graph-pasteboard-mixin extra-graph-pasteboard-mixin #:filter term-filter)]) + (post-process graph-pb) (print-to-ps graph-pb canvas filename))) (define (print-to-ps graph-pb canvas filename) diff --git a/collects/redex/redex.scrbl b/collects/redex/redex.scrbl index bf1a710ae1..8f93b17c3c 100644 --- a/collects/redex/redex.scrbl +++ b/collects/redex/redex.scrbl @@ -1267,12 +1267,17 @@ inserted into the editor by this library have a [#:layout layout (-> (listof term-node?) void) void] [#:edge-labels? edge-label-font boolean? #t] [#:edge-label-font edge-label-font (or/c #f (is-a?/c font%)) #f] - [#:graph-pasteboard-mixin graph-pasteboard-mixin (make-mixin-contract graph-pasteboard<%>) values]) + [#:graph-pasteboard-mixin graph-pasteboard-mixin (make-mixin-contract graph-pasteboard<%>) values] + [#:post-process post-process (-> (is-a?/c graph-pasteboard<%>) any/c)]) void?]{ -The arguments behave just like the function @scheme[traces], but +This function behaves just like the function @scheme[traces], but instead of opening a window to show the reduction graph, it just saves the reduction graph to the specified @scheme[file]. + +All of the arguments behave like the arguments to @scheme[traces], +with the exception of the @scheme[post-process] argument. It is called +just before the PostScript is created with the graph pasteboard. } @defproc[(stepper [reductions reduction-relation?]