Fix more references to Scheme.

This commit is contained in:
Sam Tobin-Hochstadt 2010-06-04 16:22:26 -04:00
parent 43b9917484
commit dfb4916f10
15 changed files with 208 additions and 208 deletions

View File

@ -218,7 +218,7 @@ Returns @scheme[#t] if updating on this administrator's
} }
@methimpl{ @methimpl{
Returns Scheme[#f]. Returns @scheme[#f].
}} }}

View File

@ -8,21 +8,21 @@
@defproc[(add-editor-keymap-functions [keymap (is-a?/c keymap%)]) @defproc[(add-editor-keymap-functions [keymap (is-a?/c keymap%)])
void?]{ void?]{
Given a @scheme[keymap%] object, the keymap is loaded with mappable Given a @racket[keymap%] object, the keymap is loaded with mappable
functions that apply to all @scheme[editor<%>] objects: functions that apply to all @racket[editor<%>] objects:
@itemize[ @itemize[
@item{@scheme["copy-clipboard"]} @item{@racket["copy-clipboard"]}
@item{@scheme["copy-append-clipboard"]} @item{@racket["copy-append-clipboard"]}
@item{@scheme["cut-clipboard"]} @item{@racket["cut-clipboard"]}
@item{@scheme["cut-append-clipboard"]} @item{@racket["cut-append-clipboard"]}
@item{@scheme["paste-clipboard"]} @item{@racket["paste-clipboard"]}
@item{@scheme["paste-x-selection"]} @item{@racket["paste-x-selection"]}
@item{@scheme["delete-selection"]} @item{@racket["delete-selection"]}
@item{@scheme["clear-selection"]} @item{@racket["clear-selection"]}
@item{@scheme["undo"]} @item{@racket["undo"]}
@item{@scheme["redo"]} @item{@racket["redo"]}
@item{@scheme["select-all"]} @item{@racket["select-all"]}
] ]
} }
@ -30,92 +30,92 @@ Given a @scheme[keymap%] object, the keymap is loaded with mappable
@defproc[(add-pasteboard-keymap-functions [keymap (is-a?/c keymap%)]) @defproc[(add-pasteboard-keymap-functions [keymap (is-a?/c keymap%)])
void?]{ void?]{
Given a @scheme[keymap%] object, the table is loaded with mappable Given a @racket[keymap%] object, the table is loaded with mappable
functions that apply to @scheme[pasteboard%] objects. Currently, functions that apply to @racket[pasteboard%] objects. Currently,
there are no such functions. there are no such functions.
See also See also
@scheme[add-editor-keymap-functions]. @racket[add-editor-keymap-functions].
} }
@defproc[(add-text-keymap-functions [keymap (is-a?/c keymap%)]) @defproc[(add-text-keymap-functions [keymap (is-a?/c keymap%)])
void?]{ void?]{
Given a @scheme[keymap%] object, the table is loaded with functions Given a @racket[keymap%] object, the table is loaded with functions
that apply to all @scheme[text%] objects: that apply to all @racket[text%] objects:
@itemize[ @itemize[
@item{@scheme["forward-character"]} @item{@racket["forward-character"]}
@item{@scheme["backward-character"]} @item{@racket["backward-character"]}
@item{@scheme["previous-line"]} @item{@racket["previous-line"]}
@item{@scheme["next-line"]} @item{@racket["next-line"]}
@item{@scheme["previous-page"]} @item{@racket["previous-page"]}
@item{@scheme["next-page"]} @item{@racket["next-page"]}
@item{@scheme["forward-word"]} @item{@racket["forward-word"]}
@item{@scheme["backward-word"]} @item{@racket["backward-word"]}
@item{@scheme["forward-select"]} @item{@racket["forward-select"]}
@item{@scheme["backward-select"]} @item{@racket["backward-select"]}
@item{@scheme["select-down"]} @item{@racket["select-down"]}
@item{@scheme["select-up"]} @item{@racket["select-up"]}
@item{@scheme["select-page-up"]} @item{@racket["select-page-up"]}
@item{@scheme["select-page-down"]} @item{@racket["select-page-down"]}
@item{@scheme["forward-select-word"]} @item{@racket["forward-select-word"]}
@item{@scheme["backward-select-word"]} @item{@racket["backward-select-word"]}
@item{@scheme["beginning-of-file"]} @item{@racket["beginning-of-file"]}
@item{@scheme["end-of-file"]} @item{@racket["end-of-file"]}
@item{@scheme["beginning-of-line"]} @item{@racket["beginning-of-line"]}
@item{@scheme["end-of-line"]} @item{@racket["end-of-line"]}
@item{@scheme["select-to-beginning-of-file"]} @item{@racket["select-to-beginning-of-file"]}
@item{@scheme["select-to-end-of-file"]} @item{@racket["select-to-end-of-file"]}
@item{@scheme["select-to-beginning-of-line"]} @item{@racket["select-to-beginning-of-line"]}
@item{@scheme["select-to-end-of-line"]} @item{@racket["select-to-end-of-line"]}
@item{@scheme["copy-clipboard"]} @item{@racket["copy-clipboard"]}
@item{@scheme["copy-append-clipboard"]} @item{@racket["copy-append-clipboard"]}
@item{@scheme["cut-clipboard"]} @item{@racket["cut-clipboard"]}
@item{@scheme["cut-append-clipboard"]} @item{@racket["cut-append-clipboard"]}
@item{@scheme["paste-clipboard"]} @item{@racket["paste-clipboard"]}
@item{@scheme["paste-x-selection"]} @item{@racket["paste-x-selection"]}
@item{@scheme["delete-selection"]} @item{@racket["delete-selection"]}
@item{@scheme["delete-previous-character"]} @item{@racket["delete-previous-character"]}
@item{@scheme["delete-next-character"]} @item{@racket["delete-next-character"]}
@item{@scheme["clear-selection"]} @item{@racket["clear-selection"]}
@item{@scheme["delete-to-end-of-line"]} @item{@racket["delete-to-end-of-line"]}
@item{@scheme["delete-next-word"]} @item{@racket["delete-next-word"]}
@item{@scheme["delete-previous-word"]} @item{@racket["delete-previous-word"]}
@item{@scheme["delete-line"]} @item{@racket["delete-line"]}
@item{@scheme["undo"]} @item{@racket["undo"]}
@item{@scheme["redo"]} @item{@racket["redo"]}
] ]
See also See also
@scheme[add-editor-keymap-functions]. @racket[add-editor-keymap-functions].
} }
@defproc[(append-editor-font-menu-items [menu (or/c @scheme[menu%] (is-a?/c popup-menu%))]) @defproc[(append-editor-font-menu-items [menu (or/c (is-a?/c menu%) (is-a?/c popup-menu%))])
void?]{ void?]{
Appends menu items to a given menu (not a popup menu) to implement a Appends menu items to a given menu (not a popup menu) to implement a
standard set of font-manipulation operations, such as changing the standard set of font-manipulation operations, such as changing the
font face or style. The callback for each menu item uses font face or style. The callback for each menu item uses
@xmethod[top-level-window<%> get-edit-target-object] (finding the frame by following a chain of parents until a frame is @xmethod[top-level-window<%> get-edit-target-object] (finding the frame by following a chain of parents until a frame is
reached); if the result is an @scheme[editor<%>] object, reached); if the result is an @racket[editor<%>] object,
@xmethod[editor<%> change-style] is called on the editor. @xmethod[editor<%> change-style] is called on the editor.
} }
@defproc[(append-editor-operation-menu-items [menu (or/c @scheme[menu%] (is-a?/c popup-menu%))] @defproc[(append-editor-operation-menu-items [menu (or/c (is-a?/c menu%) (is-a?/c popup-menu%))]
[text-only? any/c #t]) [text-only? any/c #t])
void?]{ void?]{
Appends menu items to a given menu (not a popup menu) to implement the Appends menu items to a given menu (not a popup menu) to implement the
standard editor operations, such as cut and paste. The callback for standard editor operations, such as cut and paste. The callback for
each menu item uses each menu item uses
@xmethod[top-level-window<%> get-edit-target-object] (finding the frame by following a chain of parents until a frame is @xmethod[top-level-window<%> get-edit-target-object] (finding the frame by following a chain of parents until a frame is
reached); if the result is an @scheme[editor<%>] object, reached); if the result is an @racket[editor<%>] object,
@xmethod[editor<%> do-edit-operation] is called on the editor. @xmethod[editor<%> do-edit-operation] is called on the editor.
If @scheme[text-only?] is @scheme[#f], then menu items that insert If @racket[text-only?] is @racket[#f], then menu items that insert
non-text snips (such as @onscreen{Insert Image...}) are appended to non-text snips (such as @onscreen{Insert Image...}) are appended to
the menu. the menu.
@ -127,8 +127,8 @@ If @scheme[text-only?] is @scheme[#f], then menu items that insert
Parameter that specifies a keymap-initialization procedure. This Parameter that specifies a keymap-initialization procedure. This
procedure is called to initialize the keymap of a procedure is called to initialize the keymap of a
@scheme[text-field%] object or a @scheme[text%] object created by @racket[text-field%] object or a @racket[text%] object created by
@scheme[graphical-read-eval-print-loop]. @racket[graphical-read-eval-print-loop].
The initializer takes a keymap object and returns nothing. The default The initializer takes a keymap object and returns nothing. The default
initializer chains the given keymap to an internal keymap that initializer chains the given keymap to an internal keymap that
@ -143,8 +143,8 @@ The initializer takes a keymap object and returns nothing. The default
void?]{ void?]{
Under X Windows, editor selections conform to the X Windows selection Under X Windows, editor selections conform to the X Windows selection
conventions instead of a clipboard-based convention. If @scheme[on] is conventions instead of a clipboard-based convention. If @racket[on] is
@scheme[#f], the behavior is switched to the clipboard-based convention @racket[#f], the behavior is switched to the clipboard-based convention
(where copy must be explicitly requested before a paste). (where copy must be explicitly requested before a paste).
@ -173,7 +173,7 @@ Gets the snip class list instance for the current eventspace.
void?] void?]
[(map-command-as-meta-key) [(map-command-as-meta-key)
boolean?])]{ boolean?])]{
Determines the interpretation of @litchar{m:} for a @scheme[keymap%] Determines the interpretation of @litchar{m:} for a @racket[keymap%]
mapping under Mac OS X. See also mapping under Mac OS X. See also
@xmethod[keymap% map-function]. @xmethod[keymap% map-function].
@ -181,8 +181,8 @@ mapping under Mac OS X. See also
First case: First case:
If @scheme[on?] is @scheme[#t], @litchar{m:} corresponds to the Command key. If If @racket[on?] is @racket[#t], @litchar{m:} corresponds to the Command key. If
@scheme[on?] is @scheme[#f], then @litchar{m:} corresponds to no key under Mac OS @racket[on?] is @racket[#f], then @litchar{m:} corresponds to no key under Mac OS
X. X.
@ -190,20 +190,20 @@ X.
Second case: Second case:
Returns @scheme[#t] if @litchar{m:} corresponds to Command, Returns @racket[#t] if @litchar{m:} corresponds to Command,
@scheme[#f] otherwise. @racket[#f] otherwise.
} }
@defproc[(open-input-graphical-file [filename string?]) @defproc[(open-input-graphical-file [filename string?])
input-port]{ input-port]{
Opens @scheme[filename] (in @scheme['binary] mode) and checks whether it looks Opens @racket[filename] (in @racket['binary] mode) and checks whether it looks
like a ``graphical'' file in editor format. If the file does not like a ``graphical'' file in editor format. If the file does not
appear to be an editor file, the file port is returned with line appear to be an editor file, the file port is returned with line
counting enabled. Otherwise, the file is loaded into an editor, and counting enabled. Otherwise, the file is loaded into an editor, and
the result port is created with the result port is created with
@scheme[open-input-text-editor]. @racket[open-input-text-editor].
} }
@ -212,38 +212,38 @@ Opens @scheme[filename] (in @scheme['binary] mode) and checks whether it looks
[start-position exact-nonnegative-integer? 0] [start-position exact-nonnegative-integer? 0]
[end-position (or/c exact-nonnegative-integer? (one/of 'end)) 'end] [end-position (or/c exact-nonnegative-integer? (one/of 'end)) 'end]
[snip-filter ((is-a?/c snip%) . -> . any/c) (lambda (s) s)] [snip-filter ((is-a?/c snip%) . -> . any/c) (lambda (s) s)]
[port-name any/c @scheme[text-editor]] [port-name any/c text-editor]
[expect-to-read-all? any/c #f]) [expect-to-read-all? any/c #f])
input-port]{ input-port]{
Creates an input port that draws its content from @scheme[text-editor]. Creates an input port that draws its content from @racket[text-editor].
The editor content between positions @scheme[start-position] and The editor content between positions @racket[start-position] and
@scheme[end-position] is the content of the port. If @scheme[end-position] @racket[end-position] is the content of the port. If @racket[end-position]
is @scheme['end], the content runs until the end of the editor. If a is @racket['end], the content runs until the end of the editor. If a
snip that is not a @scheme[string-snip%] object spans snip that is not a @racket[string-snip%] object spans
@scheme[start-position] or @scheme[end-position], the entire snip @racket[start-position] or @racket[end-position], the entire snip
contributes to the port. If a @scheme[string-snip%] instance spans contributes to the port. If a @racket[string-snip%] instance spans
@scheme[start-position], only the part of the snip after @racket[start-position], only the part of the snip after
@scheme[start-position] contributes, and if a @scheme[string-snip%] @racket[start-position] contributes, and if a @racket[string-snip%]
object spans @scheme[end-position], only the part before object spans @racket[end-position], only the part before
@scheme[end-position] contributes. @racket[end-position] contributes.
An instance of @scheme[string-snip%] in @scheme[text-editor] generates An instance of @racket[string-snip%] in @racket[text-editor] generates
a character sequence in the resulting port. All other kinds of snips a character sequence in the resulting port. All other kinds of snips
are passed to @scheme[snip-filter] to obtain a ``special'' value for are passed to @racket[snip-filter] to obtain a ``special'' value for
the port. If a snip is returned as the first result from the port. If a snip is returned as the first result from
@scheme[snip-filter], and if the snip is an instance of @racket[snip-filter], and if the snip is an instance of
@scheme[readable-snip<%>], the snip generates a special value for the @racket[readable-snip<%>], the snip generates a special value for the
port through the @method[readable-snip<%> read-special] method. If port through the @method[readable-snip<%> read-special] method. If
@scheme[snip-filter] returns any other kind of snip, it is copied for @racket[snip-filter] returns any other kind of snip, it is copied for
the special result. Finally, a non-snip first result from the special result. Finally, a non-snip first result from
@scheme[snip-filter] is used directly as the special result. @racket[snip-filter] is used directly as the special result.
The @scheme[port-name] argument is used for the input port's name. The The @racket[port-name] argument is used for the input port's name. The
@scheme[expect-to-read-all?] argument is a performance hint; use @racket[expect-to-read-all?] argument is a performance hint; use
@scheme[#t] if the entire port's stream will be read. @racket[#t] if the entire port's stream will be read.
The result port must not be used if @scheme[text-editor] changes in any The result port must not be used if @racket[text-editor] changes in any
of the following ways: a snip is inserted (see of the following ways: a snip is inserted (see
@method[text% after-insert]), a snip is deleted (see @method[text% after-insert]), a snip is deleted (see
@method[text% after-delete]), a snip is split (see @method[text% after-delete]), a snip is split (see
@ -259,19 +259,19 @@ The result port must not be used if @scheme[text-editor] changes in any
@defproc[(open-output-text-editor [text-editor (is-a?/c text%)] @defproc[(open-output-text-editor [text-editor (is-a?/c text%)]
[start-position (or/c exact-nonnegative-integer? (one/of 'end)) 'end] [start-position (or/c exact-nonnegative-integer? (one/of 'end)) 'end]
[special-filter (any/c . -> . any/c) (lambda (x) x)] [special-filter (any/c . -> . any/c) (lambda (x) x)]
[port-name any/c @scheme[text-editor]]) [port-name any/c text-editor])
output-port]{ output-port]{
Creates an output port that delivers its content to @scheme[text-editor]. Creates an output port that delivers its content to @racket[text-editor].
The content is written to @scheme[text-editor] starting at the position The content is written to @racket[text-editor] starting at the position
@scheme[start-position], where @scheme['end] indicates that output should @racket[start-position], where @racket['end] indicates that output should
start at the text editor's current end position. start at the text editor's current end position.
If @scheme[special-filter] is provided, it is applied to any value If @racket[special-filter] is provided, it is applied to any value
written to the port with @scheme[write-special], and the result is written to the port with @racket[write-special], and the result is
inserted in its place. If a special value is a @scheme[snip%] inserted in its place. If a special value is a @racket[snip%]
object, it is inserted into the editor. Otherwise, the special value object, it is inserted into the editor. Otherwise, the special value
is @scheme[display]ed into the editor. is @racket[display]ed into the editor.
If line counting is enabled for the resulting output port, then the If line counting is enabled for the resulting output port, then the
port will report the line, offset from the line's start, and position port will report the line, offset from the line's start, and position
@ -285,9 +285,9 @@ If line counting is enabled for the resulting output port, then the
boolean?]{ boolean?]{
See See
@scheme[read-editor-global-header]. Call @racket[read-editor-global-header]. Call
@scheme[read-editor-global-footer] even if @racket[read-editor-global-footer] even if
@scheme[read-editor-global-header] returns @scheme[#f]. @racket[read-editor-global-header] returns @racket[#f].
@ -296,8 +296,8 @@ See
@defproc[(read-editor-global-header [in (is-a?/c editor-stream-in%)]) @defproc[(read-editor-global-header [in (is-a?/c editor-stream-in%)])
boolean?]{ boolean?]{
Reads data from @scheme[in] to initialize for reading editors from the Reads data from @racket[in] to initialize for reading editors from the
stream. The return value is @scheme[#t] if the read succeeds, or @scheme[#f] stream. The return value is @racket[#t] if the read succeeds, or @racket[#f]
otherwise. otherwise.
One or more editors can be read from the stream by calling One or more editors can be read from the stream by calling
@ -305,16 +305,16 @@ the editor's
@method[editor<%> read-from-file] method. (The number of editors to be @method[editor<%> read-from-file] method. (The number of editors to be
read must be known by the application beforehand.) When all editors read must be known by the application beforehand.) When all editors
are read, call are read, call
@scheme[read-editor-global-footer]. Calls to @racket[read-editor-global-footer]. Calls to
@scheme[read-editor-global-header] and @racket[read-editor-global-header] and
@scheme[read-editor-global-footer] must bracket any call to @racket[read-editor-global-footer] must bracket any call to
@method[editor<%> read-from-file], and only one stream at a time @method[editor<%> read-from-file], and only one stream at a time
can be read using these methods or written using can be read using these methods or written using
@scheme[write-editor-global-header] and @racket[write-editor-global-header] and
@scheme[write-editor-global-footer]. @racket[write-editor-global-footer].
When reading from streams that span PLT Scheme versions, use When reading from streams that span Racket versions, use
@scheme[read-editor-version] before this procedure. @racket[read-editor-version] before this procedure.
@ -326,18 +326,18 @@ When reading from streams that span PLT Scheme versions, use
[raise-errors? any/c #t]) [raise-errors? any/c #t])
boolean?]{ boolean?]{
Reads version information from @scheme[in-base], where @scheme[in-base] is Reads version information from @racket[in-base], where @racket[in-base] is
the base for @scheme[in]. The version information parsed from the base for @racket[in]. The version information parsed from
@scheme[in-base] is recorded in @scheme[in] for later version-sensitive @racket[in-base] is recorded in @racket[in] for later version-sensitive
parsing. The procedure result is true if the version information was parsing. The procedure result is true if the version information was
read successfully and if the version is supported. read successfully and if the version is supported.
If @scheme[parse-format?] is true, then @scheme[in-base] is checked for an If @racket[parse-format?] is true, then @racket[in-base] is checked for an
initial @scheme["WXME"] format indicator. Use @scheme[#f] when initial @racket["WXME"] format indicator. Use @racket[#f] when
@scheme["WXME"] has been consumed already by format-dispatching code. @racket["WXME"] has been consumed already by format-dispatching code.
If @scheme[raise-errors?] is true, then an error in reading triggers an If @racket[raise-errors?] is true, then an error in reading triggers an
exception, instead of a @scheme[#f] result. exception, instead of a @racket[#f] result.
@ -347,46 +347,46 @@ If @scheme[raise-errors?] is true, then an error in reading triggers an
[expected-module-name (or/c symbol false/c)]) [expected-module-name (or/c symbol false/c)])
any/c]{ any/c]{
This procedure is a load handler for use with @scheme[current-load]. This procedure is a load handler for use with @racket[current-load].
The handler recognizes PLT Scheme editor-format files (see The handler recognizes Racket editor-format files (see
@secref["editorfileformat"]) and decodes them for loading. It is @secref["editorfileformat"]) and decodes them for loading. It is
normally installed as GRacket starts (see @secref[#:doc reference-doc normally installed as GRacket starts (see @secref[#:doc reference-doc
"running-sa"]). "running-sa"]).
The handler recognizes editor files by the first twelve characters of The handler recognizes editor files by the first twelve characters of
the file: @litchar{WXME01}@nonterm{digit}@nonterm{digit}@litchar{ ## }. the file: @litchar{WXME01}@nonterm{digit}@nonterm{digit}@litchar{ ## }.
Such a file is opened for loading by creating a @scheme[text%] Such a file is opened for loading by creating a @racket[text%]
object, loading the file into the object with @method[editor<%> object, loading the file into the object with @method[editor<%>
insert-file], and then converting the editor content into a port with insert-file], and then converting the editor content into a port with
@scheme[open-input-text-editor]. After obtaining a port in this way, @racket[open-input-text-editor]. After obtaining a port in this way,
the content is read in essentially the same way as by the default the content is read in essentially the same way as by the default
Racket load handler. The difference is that the editor may contain Racket load handler. The difference is that the editor may contain
instances of @scheme[readable-snip<%>], which are ``read'' though the instances of @racket[readable-snip<%>], which are ``read'' though the
snips' @method[readable-snip<%> read-special] method; see snips' @method[readable-snip<%> read-special] method; see
@scheme[open-input-text-editor] for details. @racket[open-input-text-editor] for details.
} }
@defthing[the-editor-wordbreak-map (is-a?/c editor-wordbreak-map%)]{ @defthing[the-editor-wordbreak-map (is-a?/c editor-wordbreak-map%)]{
See @scheme[editor-wordbreak-map%]. See @racket[editor-wordbreak-map%].
} }
@defthing[the-style-list (is-a?/c style-list%)]{ @defthing[the-style-list (is-a?/c style-list%)]{
See @scheme[style-list%]. See @racket[style-list%].
} }
@defproc[(write-editor-global-footer [out (is-a?/c editor-stream-out%)]) @defproc[(write-editor-global-footer [out (is-a?/c editor-stream-out%)])
boolean?]{ boolean?]{
See @scheme[write-editor-global-header]. Call See @racket[write-editor-global-header]. Call
@scheme[write-editor-global-footer] even if @racket[write-editor-global-footer] even if
@scheme[write-editor-global-header] returns @scheme[#f]. @racket[write-editor-global-header] returns @racket[#f].
@ -395,22 +395,22 @@ See @scheme[write-editor-global-header]. Call
@defproc[(write-editor-global-header [out (is-a?/c editor-stream-out%)]) @defproc[(write-editor-global-header [out (is-a?/c editor-stream-out%)])
boolean?]{ boolean?]{
Writes data to @scheme[out], initializing it for writing editors to Writes data to @racket[out], initializing it for writing editors to
the stream. The return value is @scheme[#t] if the write succeeds, or the stream. The return value is @racket[#t] if the write succeeds, or
@scheme[#f] otherwise. @racket[#f] otherwise.
One or more editors can be written to the stream by calling the One or more editors can be written to the stream by calling the
editor's @method[editor<%> write-to-file] method. When all editors editor's @method[editor<%> write-to-file] method. When all editors
are written, call @scheme[write-editor-global-footer]. Calls to are written, call @racket[write-editor-global-footer]. Calls to
@scheme[write-editor-global-header] and @racket[write-editor-global-header] and
@scheme[write-editor-global-footer] must bracket any call to @racket[write-editor-global-footer] must bracket any call to
@method[editor<%> write-to-file], and only one stream at a time can @method[editor<%> write-to-file], and only one stream at a time can
be written using these methods or read using be written using these methods or read using
@scheme[read-editor-global-header] and @racket[read-editor-global-header] and
@scheme[read-editor-global-footer]. @racket[read-editor-global-footer].
To support streams that span PLT Scheme versions, use To support streams that span Racket versions, use
@scheme[write-editor-version] before this procedure. @racket[write-editor-version] before this procedure.
See also @secref["editorfileformat"]. See also @secref["editorfileformat"].
@ -420,13 +420,13 @@ See also @secref["editorfileformat"].
[out-base (is-a?/c editor-stream-out-base%)]) [out-base (is-a?/c editor-stream-out-base%)])
boolean?]{ boolean?]{
Writes version information to @scheme[out-base] in preparation for Writes version information to @racket[out-base] in preparation for
writing editor information to the stream @scheme[out]. writing editor information to the stream @racket[out].
The @scheme[out] argument is currently not used, but @scheme[out-base] The @racket[out] argument is currently not used, but @racket[out-base]
should be the base for @scheme[out]. In the future, @scheme[out] may record should be the base for @racket[out]. In the future, @racket[out] may record
information about the version for later version-sensitive output. information about the version for later version-sensitive output.
The result is @scheme[#t] if the write succeeded, @scheme[#f] otherwise. The result is @racket[#t] if the write succeeded, @racket[#f] otherwise.
} }

View File

@ -1724,7 +1724,7 @@ If @scheme[fit-on-page?] is a true value, then during printing for a
The @scheme[output-mode] setting is used for Windows and Mac OS X. It The @scheme[output-mode] setting is used for Windows and Mac OS X. It
determines whether the output is generated directly as a PostScript determines whether the output is generated directly as a PostScript
file (using PLT Scheme's built-in PostScript system) or generated file (using Racket's built-in PostScript system) or generated
using the platform-specific standard printing mechanism. The possible using the platform-specific standard printing mechanism. The possible
values are values are

View File

@ -17,10 +17,10 @@ Only canvas @scheme[dc<%>] and @scheme[bitmap-dc%] objects support
@scheme[gl-context<%>] keeps its identity. Canvas contexts are double @scheme[gl-context<%>] keeps its identity. Canvas contexts are double
buffered, and bitmap contexts are single buffered. buffered, and bitmap contexts are single buffered.
The @schememodname[scheme/gui/base] library provides no OpenGL The @schememodname[racket/gui/base] library provides no OpenGL
routines. Instead, they must be obtained from a separate library, routines. Instead, they must be obtained from a separate library,
such as @schememodname[sgl]. The facilities in such as @schememodname[sgl]. The facilities in
@schememodname[scheme/gui/base] merely manage the current OpenGL @schememodname[racket/gui/base] merely manage the current OpenGL
context, connecting it to windows and bitmaps. context, connecting it to windows and bitmaps.
Only one OpenGL context can be active at a time across all threads and Only one OpenGL context can be active at a time across all threads and
@ -31,7 +31,7 @@ Only one OpenGL context can be active at a time across all threads and
only within a thunk passed to @method[gl-context<%> call-as-current], only within a thunk passed to @method[gl-context<%> call-as-current],
then drawing from the separate threads will not interfere, because then drawing from the separate threads will not interfere, because
@method[gl-context<%> call-as-current] uses a lock to serialize @method[gl-context<%> call-as-current] uses a lock to serialize
context selection across all threads in PLT Scheme. context selection across all threads in Racket.
@defmethod[(call-as-current [thunk (-> any)] @defmethod[(call-as-current [thunk (-> any)]

View File

@ -19,7 +19,7 @@ Returns the depth of the main display (a value of 1 denotes a monochrome display
} }
@defproc[(get-display-left-top-inset [avoid-bars? bool @scheme[#f]]) @defproc[(get-display-left-top-inset [avoid-bars? bool #f])
(values exact-nonnegative-integer? exact-nonnegative-integer?)]{ (values exact-nonnegative-integer? exact-nonnegative-integer?)]{
When the optional argument is @scheme[#f] (the default), this function When the optional argument is @scheme[#f] (the default), this function
@ -35,7 +35,7 @@ When the optional argument is true, this function returns the amount
} }
@defproc[(get-display-size [full-screen? bool @scheme[#f]]) @defproc[(get-display-size [full-screen? bool #f])
(values exact-nonnegative-integer? exact-nonnegative-integer?)]{ (values exact-nonnegative-integer? exact-nonnegative-integer?)]{
@index["screen resolution"]{Gets} the physical size of the display in @index["screen resolution"]{Gets} the physical size of the display in

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
(require rackunit rackunit/text-ui "1.ss" "1b.ss") (require rackunit rackunit/text-ui "1.ss" "1b.ss")
(add (make-basic-customer 'mf "matthias" "brookstone")) (add (make-basic-customer 'mf "matthias" "brookstone"))

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
;; data definitions ;; data definitions
(define id? symbol?) (define id? symbol?)

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
(require "1.ss") ;; the module just above (require "1.ss") ;; the module just above

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
(require rackunit rackunit/text-ui "2.ss") (require rackunit rackunit/text-ui "2.ss")
(define s0 (initialize (flat-contract integer?) =)) (define s0 (initialize (flat-contract integer?) =))

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
;; a contract utility ;; a contract utility
(define (eq/c x) (lambda (y) (eq? x y))) (define (eq/c x) (lambda (y) (eq? x y)))

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
(require rackunit rackunit/text-ui "3.ss") (require rackunit rackunit/text-ui "3.ss")
(define d0 (initialize (flat-contract integer?) =)) (define d0 (initialize (flat-contract integer?) =))

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
;; a shorthand for use below ;; a shorthand for use below
(define-syntax (define-syntax

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
(require rackunit rackunit/text-ui "5.ss") (require rackunit rackunit/text-ui "5.ss")
(define s (put (put (initialize (flat-contract integer?) =) 2) 1)) (define s (put (put (initialize (flat-contract integer?) =) 2) 1))

View File

@ -1,4 +1,4 @@
#lang scheme #lang racket
;; Note: this queue doesn't implement the capacity restriction ;; Note: this queue doesn't implement the capacity restriction
;; of McKim and Mitchell's queue but this is easy to add. ;; of McKim and Mitchell's queue but this is easy to add.

View File

@ -1,26 +1,26 @@
#lang scribble/doc #lang scribble/doc
@(require scribble/manual @(require scribble/manual
"guide-utils.ss" "guide-utils.ss"
(for-label scheme/flonum scheme/future)) (for-label racket/flonum racket/future))
@title[#:tag "effective-futures"]{Parallelism with Futures} @title[#:tag "effective-futures"]{Parallelism with Futures}
The @schememodname[scheme/future] library provides support for The @racketmodname[racket/future] library provides support for
performance improvement through parallelism with the @scheme[future] performance improvement through parallelism with the @racket[future]
and @scheme[touch] functions. The level of parallelism available from and @racket[touch] functions. The level of parallelism available from
those constructs, however, is limited by several factors, and the those constructs, however, is limited by several factors, and the
current implementation is best suited to numerical tasks. current implementation is best suited to numerical tasks.
@margin-note{Other functions, such as @scheme[thread], support the @margin-note{Other functions, such as @racket[thread], support the
creation of reliably concurrent tasks. However, thread never run truly creation of reliably concurrent tasks. However, thread never run truly
in parallel, even if the hardware and operating system support in parallel, even if the hardware and operating system support
parallelism.} parallelism.}
As a starting example, the @scheme[any-double?] function below takes a As a starting example, the @racket[any-double?] function below takes a
list of numbers and determines whether any number in the list has a list of numbers and determines whether any number in the list has a
double that is also in the list: double that is also in the list:
@schemeblock[ @racketblock[
(define (any-double? l) (define (any-double? l)
(for/or ([i (in-list l)]) (for/or ([i (in-list l)])
(for/or ([i2 (in-list l)]) (for/or ([i2 (in-list l)])
@ -28,10 +28,10 @@ double that is also in the list:
] ]
This function runs in quadratic time, so it can take a long time (on This function runs in quadratic time, so it can take a long time (on
the order of a second) on large lists like @scheme[l1] and the order of a second) on large lists like @racket[l1] and
@scheme[l2]: @racket[l2]:
@schemeblock[ @racketblock[
(define l1 (for/list ([i (in-range 5000)]) (define l1 (for/list ([i (in-range 5000)])
(+ (* 2 i) 1))) (+ (* 2 i) 1)))
(define l2 (for/list ([i (in-range 5000)]) (define l2 (for/list ([i (in-range 5000)])
@ -40,30 +40,30 @@ the order of a second) on large lists like @scheme[l1] and
(any-double? l2)) (any-double? l2))
] ]
The best way to speed up @scheme[any-double?] is to use a different The best way to speed up @racket[any-double?] is to use a different
algorithm. However, on a machine that offers at least two processing algorithm. However, on a machine that offers at least two processing
units, the example above can run in about half the time using units, the example above can run in about half the time using
@scheme[future] and @scheme[touch]: @racket[future] and @racket[touch]:
@schemeblock[ @racketblock[
(let ([f (future (lambda () (any-double? l2)))]) (let ([f (future (lambda () (any-double? l2)))])
(or (any-double? l1) (or (any-double? l1)
(touch f))) (touch f)))
] ]
The future @scheme[f] runs @scheme[(any-double? l2)] in parallel to The future @racket[f] runs @racket[(any-double? l2)] in parallel to
@scheme[(any-double? l1)], and the result for @scheme[(any-double? @racket[(any-double? l1)], and the result for @racket[(any-double?
l2)] becomes available about the same time that it is demanded by l2)] becomes available about the same time that it is demanded by
@scheme[(touch f)]. @racket[(touch f)].
Futures run in parallel as long as they can do so safely, but the Futures run in parallel as long as they can do so safely, but the
notion of ``safe'' for parallelism is inherently tied to the system notion of ``safe'' for parallelism is inherently tied to the system
implementation. The distinction between ``safe'' and ``unsafe'' implementation. The distinction between ``safe'' and ``unsafe''
operations may be far from apparent at the level of a Scheme program. operations may be far from apparent at the level of a Racket program.
Consider the following core of a Mandelbrot-set computation: Consider the following core of a Mandelbrot-set computation:
@schemeblock[ @racketblock[
(define (mandelbrot iterations x y n) (define (mandelbrot iterations x y n)
(let ((ci (- (/ (* 2.0 y) n) 1.0)) (let ((ci (- (/ (* 2.0 y) n) 1.0))
(cr (- (/ (* 2.0 x) n) 1.5))) (cr (- (/ (* 2.0 x) n) 1.5)))
@ -79,44 +79,44 @@ Consider the following core of a Mandelbrot-set computation:
(+ (* 2.0 zr zi) ci))))))))) (+ (* 2.0 zr zi) ci)))))))))
] ]
The expressions @scheme[(mandelbrot 10000000 62 500 1000)] and The expressions @racket[(mandelbrot 10000000 62 500 1000)] and
@scheme[(mandelbrot 10000000 62 501 1000)] each take a while to @racket[(mandelbrot 10000000 62 501 1000)] each take a while to
produce an answer. Computing them both, of course, takes twice as produce an answer. Computing them both, of course, takes twice as
long: long:
@schemeblock[ @racketblock[
(list (mandelbrot 10000000 62 500 1000) (list (mandelbrot 10000000 62 500 1000)
(mandelbrot 10000000 62 501 1000)) (mandelbrot 10000000 62 501 1000))
] ]
Unfortunately, attempting to run the two computations in parallel with Unfortunately, attempting to run the two computations in parallel with
@scheme[future] does not improve performance: @racket[future] does not improve performance:
@schemeblock[ @racketblock[
(let ([f (future (lambda () (mandelbrot 10000000 62 501 1000)))]) (let ([f (future (lambda () (mandelbrot 10000000 62 501 1000)))])
(list (mandelbrot 10000000 62 500 1000) (list (mandelbrot 10000000 62 500 1000)
(touch f))) (touch f)))
] ]
One problem is that the @scheme[*] and @scheme[/] operations in the One problem is that the @racket[*] and @racket[/] operations in the
first two lines of @scheme[mandelbrot] involve a mixture of exact and first two lines of @racket[mandelbrot] involve a mixture of exact and
inexact real numbers. Such mixtures typically trigger a slow path in inexact real numbers. Such mixtures typically trigger a slow path in
execution, and the general slow path is not safe for execution, and the general slow path is not safe for
parallelism. Consequently, the future created in this example is parallelism. Consequently, the future created in this example is
almost immediately suspended, and it cannot resume until almost immediately suspended, and it cannot resume until
@scheme[touch] is called. @racket[touch] is called.
Changing the first two lines of @scheme[mandelbrot] addresses that Changing the first two lines of @racket[mandelbrot] addresses that
first the problem: first the problem:
@schemeblock[ @racketblock[
(define (mandelbrot iterations x y n) (define (mandelbrot iterations x y n)
(let ((ci (- (/ (* 2.0 (->fl y)) (->fl n)) 1.0)) (let ((ci (- (/ (* 2.0 (->fl y)) (->fl n)) 1.0))
(cr (- (/ (* 2.0 (->fl x)) (->fl n)) 1.5))) (cr (- (/ (* 2.0 (->fl x)) (->fl n)) 1.5)))
....)) ....))
] ]
With that change, @scheme[mandelbrot] computations can run in With that change, @racket[mandelbrot] computations can run in
parallel. Nevertheless, performance still does not improve. The parallel. Nevertheless, performance still does not improve. The
problem is that most every arithmetic operation in this example problem is that most every arithmetic operation in this example
produces an inexact number whose storage must be allocated. Especially produces an inexact number whose storage must be allocated. Especially
@ -124,10 +124,10 @@ frequent allocation triggers communication between parallel tasks that
defeats any performance improvement. defeats any performance improvement.
By using @tech{flonum}-specific operations (see By using @tech{flonum}-specific operations (see
@secref["fixnums+flonums"]), we can re-write @scheme[mandelbot] to use @secref["fixnums+flonums"]), we can re-write @racket[mandelbot] to use
much less allocation: much less allocation:
@schemeblock[ @racketblock[
(define (mandelbrot iterations x y n) (define (mandelbrot iterations x y n)
(let ((ci (fl- (fl/ (* 2.0 (->fl y)) (->fl n)) 1.0)) (let ((ci (fl- (fl/ (* 2.0 (->fl y)) (->fl n)) 1.0))
(cr (fl- (fl/ (* 2.0 (->fl x)) (->fl n)) 1.5))) (cr (fl- (fl/ (* 2.0 (->fl x)) (->fl n)) 1.5)))
@ -143,9 +143,9 @@ much less allocation:
(fl+ (fl* 2.0 (fl* zr zi)) ci))))))))) (fl+ (fl* 2.0 (fl* zr zi)) ci)))))))))
] ]
This conversion can speed @scheme[mandelbrot] by a factor of 8, even This conversion can speed @racket[mandelbrot] by a factor of 8, even
in sequential mode, but avoiding allocation also allows in sequential mode, but avoiding allocation also allows
@scheme[mandelbrot] to run usefully faster in parallel. @racket[mandelbrot] to run usefully faster in parallel.
As a general guideline, any operation that is inlined by the As a general guideline, any operation that is inlined by the
@tech{JIT} compiler runs safely in parallel, while other operations @tech{JIT} compiler runs safely in parallel, while other operations
@ -156,14 +156,14 @@ annotates operations that can be inlined by the compiler (see
decompiler can be used to help predict parallel performance. decompiler can be used to help predict parallel performance.
To more directly report what is happening in a program that uses To more directly report what is happening in a program that uses
@scheme[future] and @scheme[touch], operations are logged when they @racket[future] and @racket[touch], operations are logged when they
suspend a computation or synchronize with the main computation. For suspend a computation or synchronize with the main computation. For
example, running the original @scheme[mandelbrot] in a future produces example, running the original @racket[mandelbrot] in a future produces
the following output in the @scheme['debug] log level: the following output in the @racket['debug] log level:
@margin-note{To see @scheme['debug] logging output on stderr, set the @margin-note{To see @racket['debug] logging output on stderr, set the
@envvar{PLTSTDERR} environment variable to @tt{debug} or start @envvar{PLTSTDERR} environment variable to @tt{debug} or start
@exec{mzscheme} with @Flag{W} @tt{debug}.} @exec{racket} with @Flag{W} @tt{debug}.}
@verbatim[#:indent 2]|{ @verbatim[#:indent 2]|{
future: 0 waiting for runtime at 1267392979341.989: * future: 0 waiting for runtime at 1267392979341.989: *
@ -171,11 +171,11 @@ the following output in the @scheme['debug] log level:
The message indicates which internal future-running task became The message indicates which internal future-running task became
blocked on an unsafe operation, the time it blocked (in terms of blocked on an unsafe operation, the time it blocked (in terms of
@scheme[current-inexact-miliseconds]), and the operation that caused @racket[current-inexact-miliseconds]), and the operation that caused
the computation it to block. the computation it to block.
The first revision to @scheme[mandelbrot] avoids suspending at The first revision to @racket[mandelbrot] avoids suspending at
@scheme[*], but produces many log entries of the form @racket[*], but produces many log entries of the form
@verbatim[#:indent 2]|{ @verbatim[#:indent 2]|{
future: 0 waiting for runtime at 1267392980465.066: [acquire_gc_page] future: 0 waiting for runtime at 1267392980465.066: [acquire_gc_page]