Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
offby1 committed Dec 21, 2008
1 parent 8bc1ef2 commit 658555e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions maze/draw.ss
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,17 @@

rv))

;; TODO -- find an elegant way to avoid multiply evaluating dc.
;; Simply replacing this syntax with a procedure oughta do it.
(define-syntax with-pen
(syntax-rules ()
((_ p dc body ...)
(let ((original-pen (send dc get-pen)))
(dynamic-wind
(lambda () (send dc set-pen p))
(lambda () body ...)
(lambda () (send dc set-pen original-pen)))))))
;; Bind a new variable to "dc"; hopefully this will prevent
;; evaluating it more than once
(let ((dc dc))
(let ((original-pen (send dc get-pen)))
(dynamic-wind
(lambda () (send dc set-pen p))
(lambda () body ...)
(lambda () (send dc set-pen original-pen))))))))

(define (draw-line grid origin-x origin-y orientation length thick? color)
(define cwp (grid-cell-width-in-pixels grid))
Expand Down

0 comments on commit 658555e

Please sign in to comment.