From bebf41a36e5e1916b224e4bd8a8b99932a2b9f40 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 12 Jun 2014 23:37:10 -0500 Subject: [PATCH] change the render-metafunction #:contract? argument default to #f --- .../redex-doc/redex/scribblings/ref.scrbl | 2 +- .../redex-pict-lib/redex/private/pict.rkt | 69 +++++++++++++------ .../redex-test/redex/tests/bitmap-test.rkt | 2 +- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl b/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl index 93ba3a2c5b..a3e93dd3f5 100644 --- a/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl +++ b/pkgs/redex-pkgs/redex-doc/redex/scribblings/ref.scrbl @@ -2965,7 +2965,7 @@ metafunctions and renders them together, lining up all of the clauses together. If the metafunctions have contracts, they are typeset as the first -lines of the output, unless the expression following @racket[#:contract?] +lines of the output when the expression following @racket[#:contract?] evaluates to @racket[#f]. This function sets @racket[dc-for-text-size]. See also diff --git a/pkgs/redex-pkgs/redex-pict-lib/redex/private/pict.rkt b/pkgs/redex-pkgs/redex-pict-lib/redex/private/pict.rkt index f078e3bc95..c446516e71 100644 --- a/pkgs/redex-pkgs/redex-pict-lib/redex/private/pict.rkt +++ b/pkgs/redex-pkgs/redex-pict-lib/redex/private/pict.rkt @@ -741,21 +741,41 @@ (loop snd (cdr rst))))]))) -; -; -; -; ; ;;; ; ;; -; ;; ;;;; ;; ;; -; ;;;;;;; ;;;; ;;; ;;;;; ;;;;;;; ;;;;; ;;;; ;;;; ;;;; ;;; ;;;;; ;;;;; ;;;; ;;;; ;;; -; ;;;;;;;;;;;;; ;;;;; ;;;;;; ;;;;;;;; ;;;; ;;;; ;;;; ;;;;;;;;; ;;;;;; ;;;;;; ;;;; ;;;;;; ;;;;;;;;; -; ;;;; ;;; ;;;; ;;;; ;; ;;;; ;;;; ;;;;;; ;;;; ;;;; ;;;; ;;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; ;;; ;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; +; +; +; +; + (define (make-=) (basic-text " = " (default-style))) @@ -767,7 +787,8 @@ (define-syntax (metafunctions->pict stx) (syntax-parse stx - [(_ name1:id name2:id ... (~optional (~seq #:contract? contract-e:expr) #:defaults ([contract-e #'#t]))) + [(_ name1:id name2:id ... + (~optional (~seq #:contract? contract-e:expr) #:defaults ([contract-e #'#f]))) #'(metafunctions->pict/proc (list (metafunction name1) (metafunction name2) ...) contract-e 'metafunctions->pict)])) @@ -782,7 +803,7 @@ (syntax-parse stx [(_ name1:id name2:id ... (~seq k:keyword e:expr) ...) (define filename #'#f) - (define contract? #'#t) + (define contract? #'#f) (for ([kwd (in-list (syntax->list #'(k ...)))] [e (in-list (syntax->list #'(e ...)))]) (cond @@ -941,9 +962,15 @@ (define linebreak-list (or current-linebreaks (map (lambda (x) #f) eqns))) (define mode (case style - [(left-right left-right/vertical-side-conditions left-right/compact-side-conditions left-right/beside-side-conditions) + [(left-right + left-right/vertical-side-conditions + left-right/compact-side-conditions + left-right/beside-side-conditions) 'horizontal] - [(up-down up-down/vertical-side-conditions up-down/compact-side-conditions) 'vertical] + [(up-down + up-down/vertical-side-conditions + up-down/compact-side-conditions) + 'vertical] [else (error 'metafunctions->pict "unknown mode")])) (define =-pict (make-=)) (define vertical-side-conditions? @@ -973,7 +1000,9 @@ (+ (pict-width rhs) sep (pict-width =-pict)))] [else (max biggest - (+ (pict-width lhs/contract) (pict-width rhs) (pict-width =-pict) + (+ (pict-width lhs/contract) + (pict-width rhs) + (pict-width =-pict) (* 2 sep)))])))) (define scs (for/list ([eqn (in-list eqns)]) (cond diff --git a/pkgs/redex-pkgs/redex-test/redex/tests/bitmap-test.rkt b/pkgs/redex-pkgs/redex-test/redex/tests/bitmap-test.rkt index 471579655e..8d403816bc 100644 --- a/pkgs/redex-pkgs/redex-test/redex/tests/bitmap-test.rkt +++ b/pkgs/redex-pkgs/redex-test/redex/tests/bitmap-test.rkt @@ -256,7 +256,7 @@ ;; make sure two metafunctions simultaneously rewritten line up properly -(btest (render-metafunctions S T TL) "metafunctions-multiple.png") +(btest (render-metafunctions S T TL #:contract? #t) "metafunctions-multiple.png") ;; make sure that the ellipses don't have commas before them. (define-metafunction lang