change the render-metafunction #:contract? argument default to #f

This commit is contained in:
Robby Findler 2014-06-12 23:37:10 -05:00
parent f03a62a6c2
commit bebf41a36e
3 changed files with 51 additions and 22 deletions

View File

@ -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

View File

@ -741,21 +741,41 @@
(loop snd (cdr rst))))])))
;
;
;
; ; ;;; ; ;;
; ;; ;;;; ;; ;;
; ;;;;;;; ;;;; ;;; ;;;;; ;;;;;;; ;;;;; ;;;; ;;;; ;;;; ;;; ;;;;; ;;;;; ;;;; ;;;; ;;;
; ;;;;;;;;;;;;; ;;;;; ;;;;;; ;;;;;;;; ;;;; ;;;; ;;;; ;;;;;;;;; ;;;;;; ;;;;;; ;;;; ;;;;;; ;;;;;;;;;
; ;;;; ;;; ;;;; ;;;; ;; ;;;; ;;;; ;;;;;; ;;;; ;;;; ;;;; ;;;; ;;;;;;; ;;;; ;;;; ;;;;;;;; ;;;; ;;;;
; ;;;; ;;; ;;;; ;;;;;;; ;;;; ;;;;;;; ;;;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;; ;;;; ;;;;
; ;;;; ;;; ;;;; ;;;;; ;;;;; ;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;;;;; ;;;;; ;;;; ;;;;;;;; ;;;; ;;;;
; ;;;; ;;; ;;;; ;;;;;; ;;;;; ;;;;;;;; ;;;; ;;;;;;;;; ;;;; ;;;; ;;;;;; ;;;;; ;;;; ;;;;;; ;;;; ;;;;
; ;;;; ;;; ;;;; ;;;; ;;;; ;; ;;;; ;;;; ;;; ;;;; ;;;; ;;;; ;;;;; ;;;; ;;;; ;;;; ;;;; ;;;;
;
;
;
;
;
;
;
; ;
; ;;;
; ;;; ;; ;;; ;;;; ;;;; ;;;;;
; ;;;;;;;;;;; ;; ;;; ;;;; ;;;;;;;
; ;;; ;;; ;;; ;;; ;;; ;;; ;; ;;;
; ;;; ;;; ;;; ;;;;;;; ;;; ;;;;; ;;;;
; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;;;
; ;;; ;;; ;;; ;;;;;; ;;;; ;;; ;;;
; ;;; ;;; ;;; ;;;; ;;; ;;;;;;
;
;
;
;
;
;
;
;
; ;;;; ; ;;;
; ;;; ;;;
; ;;;; ;;; ;;; ;;; ;; ;;; ;;;; ;;; ;;; ;;; ;;
; ;;;; ;;; ;;; ;;;;;;; ;;;;; ;;;; ;;; ;;;;; ;;;;;;;
; ;;; ;;; ;;; ;;; ;;; ;;; ;; ;;; ;;; ;;; ;;; ;;; ;;;
; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;;
; ;;; ;;; ;;; ;;; ;;; ;;; ;; ;;; ;;; ;;; ;;; ;;; ;;;
; ;;; ;;;;;;; ;;; ;;; ;;;;; ;;;; ;;; ;;;;; ;;; ;;;
; ;;; ;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;; ;;;
;
;
;
;
(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

View File

@ -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