change defstruct rendering

This commit is contained in:
Matthew Flatt 2010-04-24 08:29:45 -06:00
parent ee24953dde
commit f60c178964
2 changed files with 22 additions and 14 deletions

View File

@ -1,4 +1,4 @@
#lang scheme/base #lang racket/base
(require "../decode.ss" (require "../decode.ss"
"../struct.ss" "../struct.ss"
"../scheme.ss" "../scheme.ss"
@ -16,9 +16,9 @@
"on-demand.ss" "on-demand.ss"
scheme/string scheme/string
scheme/list scheme/list
(for-syntax scheme/base) (for-syntax racket/base)
(for-label scheme/base (for-label racket/base
scheme/class)) racket/class))
(provide defproc defproc* defstruct (provide defproc defproc* defstruct
defparam defparam* defboolparam defparam defparam* defboolparam
@ -560,11 +560,15 @@
#f)) #f))
fields)))))]) fields)))))])
(if (pair? name) (if (pair? name)
(to-element (list just-name (make-element
(make-just-context #f
(cadr name) (list just-name
(cadr (syntax-e stx-id))))) (hspace 1)
just-name))] (to-element
(make-just-context
(cadr name)
(cadr (syntax-e stx-id))))))
just-name))]
[short-width [short-width
(apply + (length fields) 8 (apply + (length fields) 8
(append (append
@ -584,14 +588,17 @@
(make-omitable-paragraph (make-omitable-paragraph
(list (list
(to-element (to-element
`(,(schemeparenfont "struct") `(,(scheme struct)
,the-name ,the-name
,(map field-view fields))))) ,(map field-view fields)))))
(make-table (make-table
#f #f
(append (append
(list (list
(list (to-flow (schemeparenfont "(struct")) (list (to-flow (make-element #f
(list
(schemeparenfont "(")
(scheme struct))))
flow-spacer flow-spacer
(to-flow the-name) (to-flow the-name)
(if (or (null? fields) (if (or (null? fields)

View File

@ -215,8 +215,9 @@ structure type property's guard, if any).
@defexamples[ @defexamples[
#:eval class-eval #:eval class-eval
(define i (interface* () ([prop:custom-write (lambda (obj port write?) (void))]) (define i (interface* () ([prop:custom-write
method1 method2 method3)) (lambda (obj port write?) (void))])
method1 method2 method3))
]} ]}
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------
@ -1284,7 +1285,7 @@ renamed, and multiple traits can be merged to form a new trait.
@defform/subs[#:literals (public pubment public-final override override-final overment augment augride @defform/subs[#:literals (public pubment public-final override override-final overment augment augride
augment-final private inherit inherit/super inherit/inner rename-super augment-final private inherit inherit/super inherit/inner rename-super
inherit-field) field inherit-field)
(trait trait-clause ...) (trait trait-clause ...)
([trait-clause (public maybe-renamed ...) ([trait-clause (public maybe-renamed ...)