Skip to content

Commit 1e826c5

Browse files
committed
fix some problems in the rhombus-not-present case
1 parent 84d8fa2 commit 1e826c5

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

‎redex-pict-lib/redex/private/arrow.rkt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@
126126
(send dc set-pen old-pen)
127127
(send dc set-brush old-brush)))
128128
w h (- h d) d)
129-
2 0))))
129+
2 2 0 0))))

‎redex-pict-lib/redex/private/pict-interface.rkt‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ pict library.
1313
(prefix-in p: pict)
1414
pict/convert)
1515

16+
(define rhombus-present?
17+
(let ([rhombus-present? 'unknown])
18+
(λ ()
19+
(when (symbol? rhombus-present?)
20+
(set! rhombus-present?
21+
(with-handlers ([exn:fail? (λ (x) #f)])
22+
(dynamic-require '(lib "pict/main.rhm") #f)
23+
#t)))
24+
rhombus-present?)))
25+
1626
(define-syntax (define-rhombus stx)
1727
(syntax-parse stx
1828
[(_ mod x:id)
@@ -21,7 +31,7 @@ pict library.
2131
(format-id #'x #:source #'x "r:~a" (syntax-e #'x)))
2232
#`(begin
2333
;; just check that the function actually exists
24-
(when (module-declared? 'mod #t)
34+
(when (rhombus-present?)
2535
(void (dynamic-require 'mod 'x)))
2636
(define-syntax (#,(syntax-property
2737
r:
@@ -120,8 +130,7 @@ pict library.
120130
[(_ racket-pict:expr rhombus-pict:expr)
121131
#'(choose/proc (λ () racket-pict)
122132
(λ () rhombus-pict))]))
123-
(define (rhombus-present?)
124-
(module-declared? '(lib "pict/main.rhm") #t))
133+
125134
(define (choose/proc racket-pict rhombus-pict)
126135
(cond
127136
[(rhombus-present?)
@@ -159,12 +168,12 @@ pict library.
159168
(provide inset)
160169
(define inset
161170
(case-lambda
162-
[(p amt) (choose (p:inset amt) ((r:dynamic-dot-ref p 'pad) amt))]
171+
[(p amt) (choose (p:inset p amt) ((r:dynamic-dot-ref p 'pad) amt))]
163172
[(p horiz vert)
164-
(choose (p:inset horiz vert)
173+
(choose (p:inset p horiz vert)
165174
((r:dynamic-dot-ref p 'pad) #:horiz horiz #:vert vert))]
166175
[(p l t r b)
167-
(choose (p:inset l t r b)
176+
(choose (p:inset p l t r b)
168177
((r:dynamic-dot-ref p 'pad) #:left l #:top t #:right r #:bottom b))]))
169178

170179
(define-syntax (define-append stx)

0 commit comments

Comments
 (0)