hierlist docs; fix latex/pdf output when a paragraph starts with n hspace

svn: r9276
This commit is contained in:
Matthew Flatt 2008-04-12 14:42:02 +00:00
parent 9b4856a616
commit 02fbaca2b7
14 changed files with 478 additions and 327 deletions

View File

@ -1,7 +1,7 @@
#lang scribble/doc #lang scribble/doc
@(require scribble/manual) @(require scribble/manual)
@title{Turtle Graphics} @title{@bold{Turtle Graphics}}
Turtle graphics are available in two forms: traditional imperative Turtle graphics are available in two forms: traditional imperative
turtle operations that draw into a fixed window, and functional turtle turtle operations that draw into a fixed window, and functional turtle

View File

@ -1,229 +0,0 @@
_Hierarchical List Control_
hierlist.ss provides the classes and interfaces described below.
hierlist-sig.ss provides hierlist^, which includes the same classes and interfaces.
hierlist-unit.ss provide a unit that imports mred^ and exports hierlist^.
--------------------------------------------------
> hierarchical-list%, derived from editor-canvas%
It accepts two initialization arguments. The first
specifies the GUI parent for the control and is
required. The second is the `style' parameter
passed to the super class (editor-canvas%)
and defaults to: '(no-hscroll).
New methods:
> get-selected :: (send a-list get-selected) - returns #f or an
instance of hierarchical-list-item<%>
> new-item :: (send a-list new-item) - creates and returns a new
(empty) hierarchical-list-item<%>
> new-item :: (send a-list new-item mixin) - creates and returns
a new (empty) hierarchical-list-item<%>, but first, applies
`mixin' to a class implementing hierarchical-list-item<%> and uses
the result as the class for the new hierarchical-list-item<%>
object.
> set-no-sublists :: (send a-list set-no-sublists no-sublists?) -
avoids space to the left of the list that would normally align
non-list items with list items; this method can be called only
when the list is empty
> new-list :: (send a-list new-list) - creates and returns a new
(empty) hierarchical-list-compound-item<%>
> new-list :: (send a-list new-list mixin) - creates and returns
a new (empty) hierarchical-list-compound-item<%>, but first,
applies `mixin' to a class implementing
hierarchical-list-compound-item<%> and uses the result as the
class for the new hierarchical-list-compound-item<%> object.
> delete-item :: (send a-list delete-item i) - delete
hierarchical-list-item<%> i from the list
> get-items :: (send a-list get-items) - returns a list of the items
in the list
> selectable :: (send a-list selectable) - returns #t if items are
selectable, #f otherwise; default is #t
> selectable :: (send a-list selectable on?) - sets whether items
are selectable
> on-select :: (send a-list on-select i) - called for new select of
`i', hierarchical-list-item<%> or #f, where #f means that no item
is selected
> on-click :: (send a-list on-click i) - called when an item is
clicked on, but selection for that item is not allowed.
`i' is a hierarchical-list-item<%>.
selection can be disallowed by the `set-allow-selection' method
or by the `selectable' method.
> on-double-select :: (send a-list on-double-select i) - called for
double-click on hierarchical-list-item<%> `i'
> on-item-opened :: (send a-list on-item-opened i) - called when the
arrow for `i' is turned down
> on-item-closed :: (send a-list on-item-closed i) - called when the
arrow for `i' is turned up
> sort :: (send a-list sort less-than-proc [recur?]) - sorts items in
the list by calling `less-than-proc' on pairs of items; if
`recur?' is #t (the default), sub-items are sorted recursively
> can-do-edit-operation? :: (send a-list can-do-edit-operation? sym bool)
- like the method on editor<%>s; returns #f always
> do-edit-operation :: (send a-list do-edit-operation sym bool)
- like the method on editor<%>s; does nothing
> select-prev :: (send a-list select-prev)
> select-next :: (send a-list select-next)
> select-first :: (send a-list select-first)
> select-last :: (send a-list select-last)
> select-in :: (send a-list select-in)
> select-out :: (send a-list select-out)
> click-select :: (send a-list select i)
> page-up :: (send a-list page-up)
> page-down :: (send a-list page-down)
- Move the selection, scroll, and call on-select
> select :: (send a-list select i)
- Like `click-select', but does not call `on-select'
unless `on-select' is always called (see `on-select-always')
> on-select-always :: (send on-select-always)
> on-select-always :: (send on-select-always on?)
- Gets/sets whether the `on-select' method is called in
response to `select' (as opposed to `click-select');
the default is #t
> allow-deselect :: (send allow-deselect)
> allow-deselect :: (send allow-deselect on?)
- Gets/sets whether the `select' can be used with a #f
argument to deselect the current item (leaving none
selected); the default is #f
--------------------------------------------------
> hierarchical-list-item<%>, instantiate via new-item
Methods:
> get-editor :: (send an-item get-editor) - returns text% editor
containing the display representation of the item
> is-selected? :: (send an-item is-selected?) - returns #t or #f
> click-select :: (send an-item select on?) - selects or deselects
the item; hierarchical-list%'s `on-select' is called; see also
`allow-deselect'
> select :: (send an-item select on?) - like `click-select',
but `on-select' might not be called; see `on-select-always'
> user-data :: (send an-item user-data) - returns user data;
initialized to #f
> user-data :: (send an-item user-data v) - sets user data to v
> get-clickable-snip :: (send an-item get-clickable-snip) -
returns the snip that (when clicked) selects this element in
the list. This is intended for use with the automatic test
suite.
> get-allow-selection? :: (send an-item get-allow-selection?) -
returns #t or #f -- dictating if this item is allowed
to be selected.
> set-allow-selection :: (send an-item set-allow-selection boolean) -
determines if this item is allowed to be selected
--------------------------------------------------
> hierarchical-list-compound-item<%>, instantiate via new-list
extends hierarchical-list-item<%>
New methods:
> new-item :: (send a-list-item new-item) - creates and returns a new
(empty) hierarchical-list-item<%>
> new-item :: (send a-list-item new-item mixin) - creates and returns
a new (empty) hierarchical-list-item<%>, but first, applies
`mixin' to a class implementing hierarchical-list-item<%> and uses
the result as the class for the new hierarchical-list-item<%>
object.
> set-no-sublists :: (send a-list set-no-sublists no-sublists?) -
avoids space to the left of the list that would normally align
non-list items with list items; this method can be called only
when the list is empty
> new-list :: (send a-list-item new-list) - creates and returns a new
(empty) hierarchical-list-compound-item<%>
> new-list :: (send a-list-item new-list mixin) - creates and returns
a new (empty) hierarchical-list-compound-item<%>, but first,
applies `mixin' to a class implementing
hierarchical-list-compound-item<%> and uses the result as the
class for the new hierarchical-list-compound-item<%> object.
> delete-item :: (send a-list delete-item i) - delete
hierarchical-list-item<%> `i' from the compound item
> get-items :: (send a-list-item get-items) - returns a list of the
items in the compound item
> open :: (send a-list-item open) - displays the children of this list.
> close :: (send a-list-item close) - hides the children of this list.
> toggle-open/closed :: (send a-list-item toggle-open/closed) -
toggles the visible status of the children of this list
> is-open? :: (send a-list-item is-open?) -
returns a boolean indicating if the children of this list are visible.
> get-arrow-snip :: (send a-list-item get-arrow-snip) -
returns the arrow snip. intended for test suites to facilitate simulated clicks
--------------------------------------------------
If you use the `find-position' and `find-snip' methods of a
hierarchical-list%, you will get back
hierarchical-item-snip% and hierarchical-list-snip%
objects. They support these methods:
> hierarchical-item-snip% derived from editor-snip%
> get-item :: (send a-hl-item-snip get-item) - returns the
hierarchical-list-item<%> corresponding to this snip
> hierarchical-list-snip% derived from editor-snip%
> get-item :: (send a-hl-list-snip get-item) - returns the
hierarchical-list-item<%> corresponding to this snip
> get-content-buffer :: (send a-hl-list-snip get-content-buffer) -
returns the text% that contains the sub-items.
--------------------------------------------------
_Hierlist keystrokes_
Hierlists support these keystrokes:
- down: move to the next entry at the current level (skipping lower levels)
- up: move to the previous entry at the current level (skipping lower levels)
- left: move to the enclosing level (only valid at embedded levels)
- right: move down in one level (only valid for lists)
- return: open / close the current selected level (only valid for lists)

View File

@ -1,72 +1,4 @@
#lang scheme/base
(module hierlist mzscheme (require mrlib/hierlist)
(require mzlib/unit (provide (all-from-out mrlib/hierlist))
(lib "mred-sig.ss" "mred")
(lib "mred-unit.ss" "mred"))
(require "hierlist-sig.ss"
"hierlist-unit.ss")
(define-compound-unit/infer hl
(import)
(export hierlist^)
(link standard-mred@ hierlist@))
(define-values/invoke-unit/infer hl)
(provide-signature-elements hierlist^))
#|
;; Testing
(define f (make-object frame% "test"))
(define p (make-object horizontal-panel% f))
(define c (make-object (class hierarchical-list% args
(override
[on-item-opened
(lambda (i)
(let ([f (send i user-data)])
(when f (f i))))]
[on-select
(lambda (i)
(printf "Selected: ~a~n"
(if i
(send (send i get-editor) get-flattened-text)
i)))]
[on-double-select
(lambda (s)
(printf "Double-click: ~a~n"
(send (send s get-editor) get-flattened-text)))])
(sequence (apply super-init args)))
p))
(define a (send c new-list))
(send (send a get-editor) insert "First Item: List")
(send (send (send a new-item) get-editor) insert "Sub1")
(send (send (send a new-item) get-editor) insert "Sub2")
(define a.1 (send a new-list))
(send (send a.1 get-editor) insert "Deeper List")
(send (send (send a.1 new-item) get-editor) insert "Way Down")
(define b (send c new-item))
(send (send b get-editor) insert "Second Item")
(define d (send c new-list))
(send (send d get-editor) insert "dynamic")
(send d user-data (lambda (d)
(time (let loop ([i 30])
(unless (zero? i)
(send (send (send d new-item) get-editor) insert (number->string i))
(loop (sub1 i)))))))
(define x (send c new-list))
(send (send x get-editor) insert "x")
(define y (send c new-item))
(send (send y get-editor) insert "y")
(send f show #t)
(yield (make-semaphore))
|#

View File

@ -0,0 +1,65 @@
#lang scheme/base
(require mzlib/unit
scheme/gui/base
hierlist/hierlist-sig
hierlist/hierlist-unit)
(define-values/invoke-unit/infer hierlist@)
(provide-signature-elements hierlist^)
#|
;; Testing
(define f (make-object frame% "test"))
(define p (make-object horizontal-panel% f))
(define c (make-object (class hierarchical-list% args
(override
[on-item-opened
(lambda (i)
(let ([f (send i user-data)])
(when f (f i))))]
[on-select
(lambda (i)
(printf "Selected: ~a~n"
(if i
(send (send i get-editor) get-flattened-text)
i)))]
[on-double-select
(lambda (s)
(printf "Double-click: ~a~n"
(send (send s get-editor) get-flattened-text)))])
(sequence (apply super-init args)))
p))
(define a (send c new-list))
(send (send a get-editor) insert "First Item: List")
(send (send (send a new-item) get-editor) insert "Sub1")
(send (send (send a new-item) get-editor) insert "Sub2")
(define a.1 (send a new-list))
(send (send a.1 get-editor) insert "Deeper List")
(send (send (send a.1 new-item) get-editor) insert "Way Down")
(define b (send c new-item))
(send (send b get-editor) insert "Second Item")
(define d (send c new-list))
(send (send d get-editor) insert "dynamic")
(send d user-data (lambda (d)
(time (let loop ([i 30])
(unless (zero? i)
(send (send (send d new-item) get-editor) insert (number->string i))
(loop (sub1 i)))))))
(define x (send c new-list))
(send (send x get-editor) insert "x")
(define y (send c new-item))
(send (send y get-editor) insert "y")
(send f show #t)
(yield (make-semaphore))
|#

View File

@ -0,0 +1,61 @@
#lang scribble/doc
@(require "../common.ss"
(for-label mrlib/hierlist))
@definterface/title[hierarchical-list-compound-item<%>
(hierarchical-list-item<%>)]{
Instantiate this interface via @method[hierarchical-list% new-list].
@defmethod[(new-item [mixin ((implementation?/c hierarchical-list-item<%>)
. -> .
(implementation?/c hierarchical-list-item<%>))
(lambda (%) %)])
(is-a?/c hierarchical-list-item<%>)]{
Like @xmethod[hierarchical-list% new-item].}
@defmethod[(set-no-sublists [no-sublists? any/c]) void?]{
Like @xmethod[hierarchical-list% set-no-sublists].}
@defmethod[(new-list [mixin ((implementation?/c hierarchical-list-compound-item<%>)
. -> .
(implementation?/c hierarchical-list-compound-item<%>))
(lambda (%) %)])
(is-a?/c hierarchical-list-compound-item<%>)]{
Like @xmethod[hierarchical-list% new-list].}
@defmethod[(delete-item [i (is-a?/c hierarchical-list-item<%>)]) void?]{
Deletes immediate item or sub-list @scheme[i] from the sub-list.}
@defmethod[(get-items) (listof (is-a?/c hierarchical-list-item<%>))]{
Returns a list of all immediate items in the sub-list.}
@defmethod*[([(open) void?]
[(close) void?]
[(toggle-open/closed) void?])]{
Shows or hides the items of this sub-list.}
@defmethod[(is-open) boolean?]{
Reports whether the items of this sub-list are visible.}
@defmethod[(get-arrow-snip) (is-a?/c snip%)]{
Returns a snip that corresponds to the arrow to hide/show items of the
sub-list. The result is intended for use by automatic test suites.}
}

View File

@ -0,0 +1,36 @@
#lang scribble/doc
@(require "../common.ss"
(for-label mrlib/hierlist))
@title[#:style 'toc]{Hierarchical List Control}
@defmodule[mrlib/hierlist]
A @scheme[hierarchical-list%] control is a list of items, some of
which can themselves be hierarchical lists. Each such sub-list has an
arrow that the user can click to hide or show the sub-list's items.
The list control supports the following default keystrokes:
@itemize{
@item{Down: move to the next entry at the current level (skipping lower levels).}
@item{Up: move to the previous entry at the current level (skipping lower levels).}
@item{Left: move to the enclosing level (only valid at embedded levels).}
@item{Right: move down in one level (only valid for lists).}
@item{Return: open/close the current selected level (only valid for lists).}
}
@local-table-of-contents[]
@include-section["list.scrbl"]
@include-section["item.scrbl"]
@include-section["compound-item.scrbl"]
@include-section["snips.scrbl"]

View File

@ -0,0 +1,46 @@
#lang scribble/doc
@(require "../common.ss"
(for-label mrlib/hierlist))
@definterface/title[hierarchical-list-item<%> ()]{
Instantiate this interface via @method[hierarchical-list% new-item].
@defmethod[(get-editor) (is-a?/c text%)]{
Returns a text-editor buffer whose content is the display
representation of the item. In other words, fill in this text editor
to set the item's label.}
@defmethod[(is-selected?) boolean?]{
Reports whether the item is selected.}
@defmethod*[([(select [on? any/c]) void?]
[(click-select [on? any/c]) void?])]{
Calls @method[hierarchical-list% select] or @method[hierarchical-list%
click-select]. The @scheme[on?] argument can be @scheme[#f] only if
@xmethod[hierarchical-list% allow-deselect] allows it.}
@defmethod*[([(user-data) any/c]
[(user-data [data any/c]) void?])]{
Gets/sets arbitrary data associated with the item.}
@defmethod[(get-clickable-snip) (is-a?/c snip%)]{
Returns the snip that (when clicked) selects this element the
list. This method is intended for use with an automatic test suite.}
@defmethod*[([(get-allow-selection?) boolean?]
[(set-allow-selection [allow? any/c]) void?])]{
Gets/sets whether this item is allowed to be selected.}
}

View File

@ -0,0 +1,188 @@
#lang scribble/doc
@(require "../common.ss"
(for-label mrlib/hierlist))
@defclass/title[hierarchical-list% editor-canvas% ()]{
Creates a hierarchical-list control.
@defconstructor[([parent (or/c (is-a?/c frame%) (is-a?/c dialog%)
(is-a?/c panel%) (is-a?/c pane%))]
[style (listof (one-of/c 'no-border 'control-border 'combo
'no-hscroll 'no-vscroll
'hide-hscroll 'hide-vscroll
'auto-vscroll 'auto-hscroll
'resize-corner 'deleted 'transparent))
'(no-hscroll)])]{
Creates the control.}
@defmethod[(selected) (or/c (is-a?/c hierarchical-list-item<%>)
false/c)]{
Returns the currently selected item, if any.}
@defmethod[(new-item [mixin ((implementation?/c hierarchical-list-item<%>)
. -> .
(implementation?/c hierarchical-list-item<%>))
(lambda (%) %)])
(is-a?/c hierarchical-list-item<%>)]{
Creates and returns a new (empty) item in the list. See
@scheme[hierarchical-list-item<%>] for methods to fill in the item's
label.
The @scheme[mixin] argument is applied to a class implementing
@scheme[hierarchical-list-item<%>], and the resulting class is
instantiated as the list item.}
@defmethod[(set-no-sublists [no-sublists? any/c]) void?]{
Enables/disables sublist mode. When sublists are disabled, space to
the left of the list items (that would normally align non-list items
with list items) is omitted. This method can be called only when the
list is empty.}
@defmethod[(new-list [mixin ((implementation?/c hierarchical-list-compound-item<%>)
. -> .
(implementation?/c hierarchical-list-compound-item<%>))
(lambda (%) %)])
(is-a?/c hierarchical-list-compound-item<%>)]{
Creates and returns a new (empty) sub-list in the list. See
@scheme[hierarchical-list-compound-item<%>] for methods to fill in the
item's label and content.
The @scheme[mixin] argument is applied to a class implementing
@scheme[hierarchical-list-compound-item<%>], and the resulting class
is instantiated as the sub-list.}
@defmethod[(delete-item [i (is-a?/c hierarchical-list-item<%>)]) void?]{
Deletes immediate item or sub-list @scheme[i] from the list.}
@defmethod[(get-items) (listof (is-a?/c hierarchical-list-item<%>))]{
Returns a list of all immediate items in the list control.}
@defmethod*[([(selectable) boolean?]
[(selectable [on? any/c]) void?])]{
Reports whether items are selectable, or enables/disables item
selection.}
@defmethod[(on-select [i (or/c (is-a?/c hierarchical-list-item<%>) false/c)]) any]{
Called for new select of @scheme[i], where @scheme[i] is @scheme[#f]
if no item is now selected.}
@defmethod[(on-click [i (is-a?/c hierarchical-list-item<%>)]) any]{
Called when an item is clicked on, but selection for that item is not
allowed. Selection can be disallowed by @method[hierarchical-list%
selectable] or @xmethod[hierarchical-list-item<%>
set-allow-selection].}
@defmethod[(on-double-select [i (is-a?/c hierarchical-list-item<%>)]) any]{
Called for a double-click on @scheme[i].}
@defmethod[(on-item-opened [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{
Called when the arrow for @scheme[i] is turned down.}
@defmethod[(on-item-closed [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{
Called when the arrow for @scheme[i] is turned up.}
@defmethod[(sort [less-than-proc ((is-a?/c hierarchical-list-item<%>)
(is-a?/c hierarchical-list-item<%>)
. -> . any/c)]
[recur? any/c #t])
void?]{
Sorts items in the list by calling @scheme[less-than-proc] on pairs of
items. If @scheme[recur?] is true, items in sub-lists are sorted
recursively.}
@defmethod[(can-do-edit-operation? [op symbol?] [recursive? any/c #t])
boolean?]{
Like @xmethod[editor<%> can-do-edit-operation?]. The default
implementation always returns @scheme[#f].}
@defmethod[(do-edit-operation [op symbol?] [recursive? any/c #t])
void?]{
Like @xmethod[editor<%> do-edit-operation]. The default implementation
does nothing.}
@defmethod*[([(select-prev) void?]
[(select-next) void?]
[(select-first) void?]
[(select-last) void?]
[(select-in) void?]
[(select-out) void?]
[(page-up) void?]
[(page-down) void?])]{
Move the selection, scroll, and call @method[hierarchical-list
on-select].}
@defmethod[(select [i (or/c (is-a?/c hierarchical-list-item<%>) false/c)]) void?]{
Moves the selection, scrolls as necessary to show it, and calls
@method[hierarchical-list% on-select] unless disabled via
@method[hierarchical-list% on-select-always].
The @method[hierarchical-list% allow-deselect] method controls whether
@scheme[i] is allowed to be @scheme[#f] to deselect the currently
selected item.}
@defmethod[(click-select [i (or/c (is-a?/c hierarchical-list-item<%>) false/c)]) void?]{
Like @method[hierarchical-list% select], but always calls
@method[hierarchical-list% on-select].}
@defmethod*[([(on-select-always) boolean?]
[(on-select-always [always? any/c]) void?])]{
Gets/sets whether the @method[hierarchical-list% on-select] method is
called in response to @method[hierarchical-list% select] (as opposed
to @method[hierarchical-list% click-select]).
The initial mode enables @method[hierarchical-list% on-select] calls
always.}
@defmethod*[([(allow-deselect) boolean?]
[(allow-deselect [allow? any/c]) void?])]{
Gets/sets whether the @method[hierarchical-list% on-select] can be
called with a @scheme[#f] argument to deselect the current item
(leaving none selected).
The initial mode does not allow deselection.}
}

View File

@ -0,0 +1,32 @@
#lang scribble/doc
@(require "../common.ss"
(for-label mrlib/hierlist))
@title{Snips in a @scheme[hierarchical-list%] Instance}
The @xmethod[text% find-snip] method of the editor in a
@scheme[hierarchical-list%] return instances of
@scheme[hierarchical-item-snip%] and @scheme[hierarchical-list-snip%].
@defclass[hierarchical-item-snip% editor-snip% ()]{
@defmethod[(get-item) (is-a?/c hierarchical-list-item<%>)]{
Returns the @scheme[hierarchical-list-item<%>] corresponding to the
snip.}
}
@defclass[hierarchical-list-snip% editor-snip% ()]{
@defmethod[(get-item) (is-a?/c hierarchical-list-compound-item<%>)]{
Returns the @scheme[hierarchical-list-compound-item<%>] corresponding to the
snip.}
@defmethod[(get-content-buffer) (is-a?/c text%)]{
Returns the text% that contains the sub-item snips.}
}

View File

@ -8,10 +8,11 @@
@include-section["aligned-pasteboard/aligned-pasteboard.scrbl"] @include-section["aligned-pasteboard/aligned-pasteboard.scrbl"]
@include-section["bitmap-label.scrbl"] @include-section["bitmap-label.scrbl"]
@include-section["cache-image-snip.scrbl"] @include-section["cache-image-snip.scrbl"]
@include-section["interactive-value-port.scrbl"]
@include-section["gif.scrbl"] @include-section["gif.scrbl"]
@include-section["graph/graph.scrbl"] @include-section["graph/graph.scrbl"]
@include-section["hierlist/hierlist.scrbl"]
@include-section["include-bitmap.scrbl"] @include-section["include-bitmap.scrbl"]
@include-section["interactive-value-port.scrbl"]
@include-section["name-message.scrbl"] @include-section["name-message.scrbl"]
@include-section["path-dialog.scrbl"] @include-section["path-dialog.scrbl"]
@include-section["plot.scrbl"] @include-section["plot.scrbl"]

View File

@ -146,8 +146,8 @@
(case (string-length s) (case (string-length s)
[(0) (void)] [(0) (void)]
[else [else
(printf "{~a}" (printf "\\mbox{\\hphantom{\\mytexttt{~a}}}"
(regexp-replace* #rx"." s "\\\\hphantom{\\\\mytexttt{x}}"))]))] (regexp-replace* #rx"." s "x"))]))]
[(newline) (printf "\\\\")] [(newline) (printf "\\\\")]
[else (error 'latex-render "unrecognzied style symbol: ~s" style)])] [else (error 'latex-render "unrecognzied style symbol: ~s" style)])]
[(string? style) [(string? style)
@ -371,6 +371,7 @@
[(#\u03BB) (display "$\\lambda$")] [(#\u03BB) (display "$\\lambda$")]
[(#\u039B) (display "$\\Lambda$")] [(#\u039B) (display "$\\Lambda$")]
[(#\u03BC) (display "$\\mu$")] [(#\u03BC) (display "$\\mu$")]
[(#\u03C0) (display "$\\pi$")]
[else (display c)])) [else (display c)]))
(loop (add1 i)))))) (loop (add1 i))))))

View File

@ -1929,7 +1929,7 @@
(list (make-element 'superscript (list (make-element 'superscript
(loop (caddr m)))) (loop (caddr m))))
(loop (cadddr m))))] (loop (cadddr m))))]
[(regexp-match #px"^(.*)([()0-9{}\\[\\]])(.*)$" i) [(regexp-match #px"^(.*)([()0-9{}\\[\\]\u03C0])(.*)$" i)
=> (lambda (m) => (lambda (m)
(append (loop (cadr m)) (append (loop (cadr m))
(list (caddr m)) (list (caddr m))
@ -2056,7 +2056,7 @@
(define-struct decl (name super app-mixins intfs ranges mk-head body)) (define-struct decl (name super app-mixins intfs ranges mk-head body))
(define-struct constructor (def)) (define-struct constructor (def))
(define-struct meth (name mode desc def)) (define-struct meth (names mode desc def))
(define-struct spec (def)) (define-struct spec (def))
(define-struct impl (def)) (define-struct impl (def))
@ -2106,8 +2106,10 @@
(cons super accum)))]))))] (cons super accum)))]))))]
[ht (let ([ht (make-hasheq)]) [ht (let ([ht (make-hasheq)])
(for-each (lambda (i) (for-each (lambda (i)
(when (meth? i) (cond
(hash-set! ht (meth-name i) #t))) [(meth? i)
(for-each (lambda (name) (hash-set! ht name #t))
(meth-names i))]))
(decl-body decl)) (decl-body decl))
ht)] ht)]
[inh (apply [inh (apply
@ -2164,10 +2166,16 @@
(decl-super decl))) (decl-super decl)))
(id-info (decl-super decl))) (id-info (decl-super decl)))
(map id-info (decl-intfs decl)) (map id-info (decl-intfs decl))
(map (lambda (m) (apply
(meth-name m)) append
(filter meth? (decl-body decl))))))))))) (map (lambda (m)
(let loop ([l (meth-names m)])
(cond
[(null? l) null]
[(memq (car l) (cdr l)) (loop (cdr l))]
[else (cons (car l) (loop (cdr l)))])))
(filter meth? (decl-body decl))))))))))))
(define (build-body decl body) (define (build-body decl body)
(append (append
(map (lambda (i) (map (lambda (i)
@ -2445,7 +2453,7 @@
(*xmethod/super (quote-syntax/loc cname) 'name1) "."))] (*xmethod/super (quote-syntax/loc cname) 'name1) "."))]
[else [else
null])]) null])])
#'(make-meth 'name1 #'(make-meth '(name ...)
'mode 'mode
(lambda () (make-splice (apply (lambda () (make-splice (apply
append append

View File

@ -10,13 +10,10 @@
In the descriptive body of @scheme[defform], @scheme[defproc], etc., In the descriptive body of @scheme[defform], @scheme[defproc], etc.,
do not start with ``This ...'' Instead, start with a sentence whose do not start with ``This ...'' Instead, start with a sentence whose
implicit subject is the form or value being described. Capitalize the first implicit subject is the form or value being described. Capitalize the
word. Thus, the first word. Thus, the description will often start with ``Returns'' or
description will often start with ``Produces.'' Refer to arguments and ``Produces.'' Refer to arguments and sub-forms by name.
sub-forms by name.
@; [Eli] It's probably a good idea to say here that it's better to
@; refer to "functions" instead of "procedures".
Do not use the word ``argument'' to describe a sub-form in a syntactic Do not use the word ``argument'' to describe a sub-form in a syntactic
form; use the term ``sub-form'' instead, reserving ``argument'' for form; use the term ``sub-form'' instead, reserving ``argument'' for
values or expressions in a function call. Refer to libraries and values or expressions in a function call. Refer to libraries and
@ -25,6 +22,7 @@ typeset a library or language name is called @scheme[schememodname]).
Do not call an identifier (i.e., a syntactic element) a ``variable'' Do not call an identifier (i.e., a syntactic element) a ``variable''
or a ``symbol.'' Do not use the word ``expression'' for a form that is or a ``symbol.'' Do not use the word ``expression'' for a form that is
a definition or might be a definition; use the word ``form,'' instead. a definition or might be a definition; use the word ``form,'' instead.
Prefer ``function'' to ``procedure.''
Avoid cut-and-paste for descriptive text. If two functions are Avoid cut-and-paste for descriptive text. If two functions are
similar, consider documenting them together with similar, consider documenting them together with
@ -117,3 +115,15 @@ noun; use it as an annotation.
Do not start a sentence with a Scheme variable name, since it is Do not start a sentence with a Scheme variable name, since it is
normally lowercase. For example, use ``The @scheme[_thing] argument normally lowercase. For example, use ``The @scheme[_thing] argument
is...'' instead of ``@scheme[_thing] is...'' is...'' instead of ``@scheme[_thing] is...''
@section{Section Titles}
Capitalize all words except articles (``the,'' ``a,'' etc.),
prepositions, and conjunctions that are not at the start of the title.
A manual title should normally start with a suitable keyword or key
phrase (such as ``Scribble'' for this manual) that is in boldface. If
the key word is primarily an executable name, use @scheme[exec]
instead of @scheme[bold]. Optionally add further descriptive text in
the title after a colon, where the text starting with the colon is not
in boldface.

View File

@ -327,13 +327,13 @@
(doc-src-file doc)) (doc-src-file doc))
(if up-to-date? (if up-to-date?
;; Load previously calculated info: ;; Load previously calculated info:
(with-handlers ([exn? (lambda (exn) (with-handlers ([exn:fail? (lambda (exn)
(fprintf (current-error-port) "~a\n" (exn-message exn)) (fprintf (current-error-port) "~a\n" (exn-message exn))
(delete-file info-out-file) (delete-file info-out-file)
(delete-file info-in-file) (delete-file info-in-file)
((get-doc-info only-dirs latex-dest auto-main? ((get-doc-info only-dirs latex-dest auto-main?
auto-user? with-record-error) auto-user? with-record-error)
doc))]) doc))])
(let* ([v-in (with-input-from-file info-in-file read)] (let* ([v-in (with-input-from-file info-in-file read)]
[v-out (with-input-from-file info-out-file read-out-sxref)]) [v-out (with-input-from-file info-out-file read-out-sxref)])
(unless (and (equal? (car v-in) (list vers (doc-flags doc))) (unless (and (equal? (car v-in) (list vers (doc-flags doc)))
@ -378,7 +378,7 @@
[ci (send renderer collect (list v) (list dest-dir))] [ci (send renderer collect (list v) (list dest-dir))]
[ri (send renderer resolve (list v) (list dest-dir) ci)] [ri (send renderer resolve (list v) (list dest-dir) ci)]
[out-v (and info-out-time [out-v (and info-out-time
(with-handlers ([exn? (lambda (exn) #f)]) (with-handlers ([exn:fail? (lambda (exn) #f)])
(let ([v (with-input-from-file info-out-file read-out-sxref)]) (let ([v (with-input-from-file info-out-file read-out-sxref)])
(unless (equal? (car v) (list vers (doc-flags doc))) (unless (equal? (car v) (list vers (doc-flags doc)))
(error "old info has wrong version or flags")) (error "old info has wrong version or flags"))