A ton of @scheme*' -> @racket*' and related updates.

Also, updates some of the mzlib files to point at `racket/*' libraries
rather than to `scheme/*' ones.
This commit is contained in:
Eli Barzilay 2011-06-24 15:08:24 -04:00
parent f6be5447dd
commit ac26fe7554
551 changed files with 17249 additions and 17546 deletions

View File

@ -13,14 +13,14 @@ by Peter Naur.
@section{Including Algol 60 Programs} @section{Including Algol 60 Programs}
Although Algol 60 is mainly provided as a DrRacket language, Although Algol 60 is mainly provided as a DrRacket language,
@scheme[include-algol] supports limited use of Algol 60 programs in @racket[include-algol] supports limited use of Algol 60 programs in
larger programs. larger programs.
@defmodule[algol60/algol60] @defmodule[algol60/algol60]
@defform[(include-algol path-string)]{ @defform[(include-algol path-string)]{
Includes the Algol 60 program indicated by @scheme[path-string] as an Includes the Algol 60 program indicated by @racket[path-string] as an
expression in a Racket program. The included Algol 60 program is expression in a Racket program. The included Algol 60 program is
closed (i.e., it doesn't see any bindings in the included context), closed (i.e., it doesn't see any bindings in the included context),
and the result is always @|void-const|.} and the result is always @|void-const|.}
@ -28,7 +28,7 @@ and the result is always @|void-const|.}
@section{Language} @section{Language}
The DrRacket and @scheme[include-algol] implementation departs from The DrRacket and @racket[include-algol] implementation departs from
the Algol 60 specification in the following minor ways: the Algol 60 specification in the following minor ways:
@(itemize (item "Strings are not permitted to contain nested quotes.") @(itemize (item "Strings are not permitted to contain nested quotes.")

View File

@ -77,7 +77,7 @@ return values are ignored.
If the html file is being accessed as a @litchar{file:} url, the If the html file is being accessed as a @litchar{file:} url, the
@racket[current-load-relative-directory] parameter is set to the @racket[current-load-relative-directory] parameter is set to the
directory during the evaluation of the mzracket code (in both directory during the evaluation of the mzscheme code (in both
examples). The Racket code is executed through @racket[eval]. examples). The Racket code is executed through @racket[eval].
The @litchar{MZSCHEME} forms are disabled unless the web page is a The @litchar{MZSCHEME} forms are disabled unless the web page is a

View File

@ -36,12 +36,11 @@
@(define goesto 'rarr) @(define goesto 'rarr)
@title{@racket[c-lambda]: C FFI via @exec{raco ctool}}
@title{@scheme[c-lambda]: C FFI via @exec{raco ctool}}
@defmodule[compiler/cffi]{ @defmodule[compiler/cffi]{
The @schememodname[compiler/cffi] module relies on a C compiler to The @racketmodname[compiler/cffi] module relies on a C compiler to
statically construct an interface to C code through directives statically construct an interface to C code through directives
embedded in a Racket program. The library implements a subset of embedded in a Racket program. The library implements a subset of
@as-index{Gambit-C}'s foreign-function interface @cite["Feeley98"].} @as-index{Gambit-C}'s foreign-function interface @cite["Feeley98"].}

View File

@ -10,89 +10,89 @@
@defmodule[config]{ @defmodule[config]{
The @schememodname[config] library specifies the location of The @racketmodname[config] library specifies the location of
directories (such as the main documentation directory) and also directories (such as the main documentation directory) and also
directory search paths (such as a list of directories to search for directory search paths (such as a list of directories to search for
documentation).} documentation).}
@bold{Note:} Instead of @scheme[require]ing @bold{Note:} Instead of @racket[require]ing
@schememodname[config] directly, use the @racketmodname[config] directly, use the
@schememodname[setup/dirs] library, which combines information from @racketmodname[setup/dirs] library, which combines information from
@schememodname[config] and other sources. @racketmodname[config] and other sources.
The @schememodname[config] module must export the following The @racketmodname[config] module must export the following
values. In all cases where a @scheme[delay]ed value is expected for an values. In all cases where a @racket[delay]ed value is expected for an
exported identifier, the value can be a @scheme[delay]ed @scheme[#f] exported identifier, the value can be a @racket[delay]ed @racket[#f]
to indicate the default. to indicate the default.
@defthing[doc-dir (promise/c (or/c path? string? bytes? false/c))]{ @defthing[doc-dir (promise/c (or/c path? string? bytes? false/c))]{
A @scheme[delay]ed path, string, or byte string for the main A @racket[delay]ed path, string, or byte string for the main
documentation directory. It defaults to a @filepath{doc} sibling documentation directory. It defaults to a @filepath{doc} sibling
directory of the main collection directory.} directory of the main collection directory.}
@defthing[lib-dir (promise/c (or/c path? string? bytes? false/c))]{ @defthing[lib-dir (promise/c (or/c path? string? bytes? false/c))]{
A @scheme[delay]ed path, string, or byte string for the main directory A @racket[delay]ed path, string, or byte string for the main directory
containing C libraries and build information; it defaults to a containing C libraries and build information; it defaults to a
@filepath{lib} sibling directory of the main collection directory.} @filepath{lib} sibling directory of the main collection directory.}
@defthing[dll-dir (promise/c (or/c path? string? bytes? false/c))]{ @defthing[dll-dir (promise/c (or/c path? string? bytes? false/c))]{
A @scheme[delay]ed path, string, or byte string for a directory A @racket[delay]ed path, string, or byte string for a directory
containing Unix shared libraries for the main executable; it defaults containing Unix shared libraries for the main executable; it defaults
to the main C-library directory} to the main C-library directory}
@defthing[include-dir (promise/c (or/c path? string? bytes? false/c))]{ @defthing[include-dir (promise/c (or/c path? string? bytes? false/c))]{
A @scheme[delay]ed path, string, or byte string for the main directory A @racket[delay]ed path, string, or byte string for the main directory
containing C header files; it defaults to an @filepath{include} containing C header files; it defaults to an @filepath{include}
sibling directory of the main collection directory.} sibling directory of the main collection directory.}
@defthing[bin-dir (promise/c (or/c path? string? bytes? false/c))]{ @defthing[bin-dir (promise/c (or/c path? string? bytes? false/c))]{
A @scheme[delay]ed path, string, or byte string for the main directory A @racket[delay]ed path, string, or byte string for the main directory
containing executables; it defaults to a @filepath{bin} sibling containing executables; it defaults to a @filepath{bin} sibling
directory of the main collection directory.} directory of the main collection directory.}
@defthing[doc-search-dirs (promise/c (or/c path? string? bytes? false/c))]{ @defthing[doc-search-dirs (promise/c (or/c path? string? bytes? false/c))]{
A @scheme[delay]ed path, string, byte string, or @scheme[#f] A @racket[delay]ed path, string, byte string, or @racket[#f]
representing the search path for documentation; each @scheme[#f] in representing the search path for documentation; each @racket[#f] in
the list, if any, is replaced with the default search path, which is the list, if any, is replaced with the default search path, which is
the user- and version-specific @filepath{doc} directory followed by the user- and version-specific @filepath{doc} directory followed by
the main documentation directory.} the main documentation directory.}
@defthing[lib-search-dirs (promise/c (or/c path? string? bytes? false/c))]{ @defthing[lib-search-dirs (promise/c (or/c path? string? bytes? false/c))]{
Like @scheme[doc-search-dirs], but for directories containing C Like @racket[doc-search-dirs], but for directories containing C
libraries and other build information} libraries and other build information}
@defthing[include-search-dirs(promise/c (or/c path? string? bytes? false/c))]{ @defthing[include-search-dirs(promise/c (or/c path? string? bytes? false/c))]{
Like @scheme[doc-search-dirs], but for directories containing C header Like @racket[doc-search-dirs], but for directories containing C header
files} files}
@defthing[absolute-installation? boolean?]{ @defthing[absolute-installation? boolean?]{
A (simple, non-@scheme[delay]ed) boolean that is @scheme[#t] if the A (simple, non-@racket[delay]ed) boolean that is @racket[#t] if the
installation uses absolute path names, @scheme[#f] otherwise.} installation uses absolute path names, @racket[#f] otherwise.}
@defthing[cgc-suffix (promise/c (or/c string? false/c))]{ @defthing[cgc-suffix (promise/c (or/c string? false/c))]{
A @scheme[delay]ed string used as the suffix (before the actual A @racket[delay]ed string used as the suffix (before the actual
suffix, such as @filepath{.exe}) for a @filepath{CGC} executable. Use suffix, such as @filepath{.exe}) for a @filepath{CGC} executable. Use
Windows-style casing, and the string will be downcased as appropriate Windows-style casing, and the string will be downcased as appropriate
(e.g., for a Unix binary name). A @scheme[#f] value means that if the (e.g., for a Unix binary name). A @racket[#f] value means that if the
@exec{mzscheme} binary identifies itself as CGC, then the suffix is @exec{mzscheme} binary identifies itself as CGC, then the suffix is
@scheme[""], otherwise it is @scheme["CGC"].} @racket[""], otherwise it is @racket["CGC"].}
@defthing[3m-suffix (promise/c (or/c string? false/c))]{ @defthing[3m-suffix (promise/c (or/c string? false/c))]{
Analogous to @scheme[cgc-suffix], but for 3m. A @scheme[#f] value Analogous to @racket[cgc-suffix], but for 3m. A @racket[#f] value
means that if the @filepath{mzscheme} binary identifies itself as CGC, means that if the @filepath{mzscheme} binary identifies itself as CGC,
then the suffix is @scheme["3m"], otherwise it is @scheme[""].} then the suffix is @racket["3m"], otherwise it is @racket[""].}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -108,17 +108,17 @@ normally takes precedence over the main collection directory).
@defmodule[setup/configtab]{ @defmodule[setup/configtab]{
The @schememodname[setup/configtab] library defines a language module The @racketmodname[setup/configtab] library defines a language module
that can be used to implement @schememodname[config].} that can be used to implement @racketmodname[config].}
When @schememodname[setup/configtab] is used as a language module, the When @racketmodname[setup/configtab] is used as a language module, the
module body must consist of a sequence of module body must consist of a sequence of
@schemeblock[(define _id _val)] @racketblock[(define _id _val)]
declarations, where each @scheme[_id] is one of the names that the declarations, where each @racket[_id] is one of the names that the
@schememodname[config] library must export, and @scheme[_val] is @racketmodname[config] library must export, and @racket[_val] is
an expression for the value (which will be automatically wrapped with an expression for the value (which will be automatically wrapped with
@scheme[delay] when needed). If a required export has no corresponding @racket[delay] when needed). If a required export has no corresponding
@scheme[define], a definition with @scheme[#f] is inserted @racket[define], a definition with @racket[#f] is inserted
automatically. automatically.

View File

@ -10,7 +10,7 @@ Abstraktion - fortgeschritten} that goes with the German textbook
@declare-exporting[deinprogramm/DMdA-advanced] @declare-exporting[deinprogramm/DMdA-advanced]
@schemegrammar*-DMdA[ @racketgrammar*-DMdA[
#:literals (define-record-procedures-2 set!) #:literals (define-record-procedures-2 set!)
( (
(define-record-procedures-2 id id id (field-spec ...)) (define-record-procedures-2 id id id (field-spec ...))
@ -23,11 +23,11 @@ Abstraktion - fortgeschritten} that goes with the German textbook
string string
character character
(quoted ...) (quoted ...)
@#,elem{@schemevalfont{'}@scheme[quoted]}] @#,elem{@racketvalfont{'}@racket[quoted]}]
) )
( (
(set! id expr) (set! id expr)
(code:line @#,elem{@schemevalfont{'}@scheme[quoted]} (code:comment @#,seclink["advanced-quote"]{Quote-Literal})) (code:line @#,elem{@racketvalfont{'}@racket[quoted]} (code:comment @#,seclink["advanced-quote"]{Quote-Literal}))
) )
] ]
@ -38,10 +38,10 @@ Abstraktion - fortgeschritten} that goes with the German textbook
@section[#:tag "advanced-quote"]{Quote-Literal} @section[#:tag "advanced-quote"]{Quote-Literal}
@deftogether[( @deftogether[(
@defform/none[(unsyntax @elem{@schemevalfont{'}@scheme[quoted]})] @defform/none[(unsyntax @elem{@racketvalfont{'}@racket[quoted]})]
@defform[(quote quoted)] @defform[(quote quoted)]
)]{ )]{
Der Wert eines Quote-Literals hat die gleiche externe Repräsentation wie @scheme[quoted]. Der Wert eines Quote-Literals hat die gleiche externe Repräsentation wie @racket[quoted].
} }
@section[#:tag "advanced-signatures"]{Signaturen} @section[#:tag "advanced-signatures"]{Signaturen}

View File

@ -12,7 +12,7 @@ Abstraktion mit Zuweisungen} to go with the German textbook
@declare-exporting[deinprogramm/DMdA-assignments] @declare-exporting[deinprogramm/DMdA-assignments]
@schemegrammar*-DMdA[ @racketgrammar*-DMdA[
#:literals (define-record-procedures-2 define-record-procedures-parametric-2 set!) #:literals (define-record-procedures-2 define-record-procedures-parametric-2 set!)
( (
(define-record-procedures-2 id id id (field-spec ...)) (define-record-procedures-2 id id id (field-spec ...))
@ -30,48 +30,48 @@ Abstraktion mit Zuweisungen} to go with the German textbook
@prim-ops['(lib "DMdA-assignments.rkt" "deinprogramm") #'here] @prim-ops['(lib "DMdA-assignments.rkt" "deinprogramm") #'here]
@section{@scheme[define-record-procedures-2]} @section{@racket[define-record-procedures-2]}
@declare-exporting[deinprogramm/DMdA] @declare-exporting[deinprogramm/DMdA]
@defform[(define-record-procedures-2 t c p (field-spec ...))]{ @defform[(define-record-procedures-2 t c p (field-spec ...))]{
Die @scheme[define-record-procedures-2]-Form ist eine Definition für Die @racket[define-record-procedures-2]-Form ist eine Definition für
einen neuen Record-Typ. Dabei ist @scheme[t] der Name der Record-Signatur, einen neuen Record-Typ. Dabei ist @racket[t] der Name der Record-Signatur,
@scheme[c] der Name des Konstruktors, @scheme[p] der Name des @racket[c] der Name des Konstruktors, @racket[p] der Name des
Prädikats. Jedes @scheme[field-spec] kann entweder der Name eines Selektors Prädikats. Jedes @racket[field-spec] kann entweder der Name eines Selektors
oder ein Paar @scheme[(id id)] aus dem Namen eines Selektors und dem Namen eines oder ein Paar @racket[(id id)] aus dem Namen eines Selektors und dem Namen eines
Mutators sein. Mutators sein.
} }
@section{@scheme[define-record-procedures-parametric-2]} @section{@racket[define-record-procedures-parametric-2]}
@declare-exporting[deinprogramm/DMdA] @declare-exporting[deinprogramm/DMdA]
@defform[(define-record-procedures-parametric-2 t cc c p (field-spec1 ...))]{ @defform[(define-record-procedures-parametric-2 t cc c p (field-spec1 ...))]{
Diese Form ist wie @scheme[define-record-procedures-2], nur parametrisch Diese Form ist wie @racket[define-record-procedures-2], nur parametrisch
wie @scheme[define-record-procedures-parametric]. Außerdem wie @racket[define-record-procedures-parametric]. Außerdem
werden die Signaturen für die Feldinhalte, anders als bei werden die Signaturen für die Feldinhalte, anders als bei
@scheme[define-record-procedures-parametric], sofort bei der @racket[define-record-procedures-parametric], sofort bei der
Konstruktion überprüft und nicht erst beim Aufruf eines Selektors. Konstruktion überprüft und nicht erst beim Aufruf eines Selektors.
} }
@section{@scheme[begin]} @section{@racket[begin]}
@declare-exporting[deinprogramm/DMdA] @declare-exporting[deinprogramm/DMdA]
@defform[(begin expr expr ...)]{ @defform[(begin expr expr ...)]{
Bei der Auswertung eines @scheme[begin]-Ausdrucks werden nacheinander Bei der Auswertung eines @racket[begin]-Ausdrucks werden nacheinander
die Operanden ausgewertet. Der Wert des letzten Ausdrucks wird der die Operanden ausgewertet. Der Wert des letzten Ausdrucks wird der
Wert des @scheme[begin]-Ausdrucks. Wert des @racket[begin]-Ausdrucks.
} }
@section{@scheme[set!]} @section{@racket[set!]}
@declare-exporting[deinprogramm/DMdA] @declare-exporting[deinprogramm/DMdA]
@defform[(set! id expr)]{ @defform[(set! id expr)]{
Ein @scheme[set!]-Ausdruck ist eine Zuweisung, und ändert den Inhalt Ein @racket[set!]-Ausdruck ist eine Zuweisung, und ändert den Inhalt
der Zelle, die an @scheme[id] gebunden ist, auf den Wert von @scheme[expr]. der Zelle, die an @racket[id] gebunden ist, auf den Wert von @racket[expr].
} }
@section[#:tag "assignments-signatures"]{Signaturen} @section[#:tag "assignments-signatures"]{Signaturen}
@ -80,21 +80,21 @@ der Zelle, die an @scheme[id] gebunden ist, auf den Wert von @scheme[expr].
@defidform[unspecific]{ @defidform[unspecific]{
Signatur für unspezifische Werte, die unwichtig sind - typischerweise für die Signatur für unspezifische Werte, die unwichtig sind - typischerweise für die
Rückgabewerte von Operationen, die nur Seiteneffekte haben wie @scheme[set!] Rückgabewerte von Operationen, die nur Seiteneffekte haben wie @racket[set!]
oder @scheme[write-string]. oder @racket[write-string].
} }
@section[#:tag "advanced-definitions"]{Definitionen} @section[#:tag "advanced-definitions"]{Definitionen}
@declare-exporting[deinprogramm/DMdA-deflam] @declare-exporting[deinprogramm/DMdA-deflam]
@defform[(define id expr)]{Diese Form ist wie in den unteren @defform[(define id expr)]{Diese Form ist wie in den unteren
Sprachebenen, mit dem Unterschied, dass an @scheme[id] mit Sprachebenen, mit dem Unterschied, dass an @racket[id] mit
@scheme[set!] zugewiesen werden kann.} @racket[set!] zugewiesen werden kann.}
@section[#:tag "advanced-lambda"]{@scheme[lambda]} @section[#:tag "advanced-lambda"]{@racket[lambda]}
@declare-exporting[deinprogramm/DMdA-deflam] @declare-exporting[deinprogramm/DMdA-deflam]
@defform[(lambda (id id ... . id) expr)]{Bei @scheme[lambda] ist in @defform[(lambda (id id ... . id) expr)]{Bei @racket[lambda] ist in
dieser Sprachebene in einer Form zulässig, die es erlaubt, eine dieser Sprachebene in einer Form zulässig, die es erlaubt, eine
Prozedur mit einer variablen Anzahl von Paramern zu erzeugen: Alle Prozedur mit einer variablen Anzahl von Paramern zu erzeugen: Alle
Parameter vor dem Punkt funktionieren wie gewohnt und werden jeweils Parameter vor dem Punkt funktionieren wie gewohnt und werden jeweils

View File

@ -11,7 +11,7 @@ Macht der Abstraktion}.
@declare-exporting[deinprogramm/DMdA-beginner #:use-sources (deinprogramm/DMdA deinprogramm/define-record-procedures)] @declare-exporting[deinprogramm/DMdA-beginner #:use-sources (deinprogramm/DMdA deinprogramm/define-record-procedures)]
@schemegrammar*-DMdA[ @racketgrammar*-DMdA[
#:literals () #:literals ()
() () () () () ()
] ]
@ -25,27 +25,27 @@ Macht der Abstraktion}.
@section{Definitionen} @section{Definitionen}
@defform[(define id expr)]{ @defform[(define id expr)]{
Diese Form ist eine Definition, und bindet @scheme[id] als Diese Form ist eine Definition, und bindet @racket[id] als
globalen Namen an den Wert von @scheme[exp].} globalen Namen an den Wert von @racket[exp].}
@section{Record-Typ-Definitionen} @section{Record-Typ-Definitionen}
@defform[(define-record-procedures t c p (s1 ...))]{ @defform[(define-record-procedures t c p (s1 ...))]{
Die @scheme[define-record-procedures]-Form ist eine Definition Die @racket[define-record-procedures]-Form ist eine Definition
für einen neuen Record-Typ. Dabei ist @scheme[t] der Name der Record-Signatur, für einen neuen Record-Typ. Dabei ist @racket[t] der Name der Record-Signatur,
@scheme[c] der Name des Konstruktors, @scheme[p] @racket[c] der Name des Konstruktors, @racket[p]
der Name des Prädikats, und die @scheme[si] sind die der Name des Prädikats, und die @racket[si] sind die
Namen der Selektoren.} Namen der Selektoren.}
@section[#:tag "application"]{Prozedurapplikation} @section[#:tag "application"]{Prozedurapplikation}
@defform/none[(expr expr ...)]{ @defform/none[(expr expr ...)]{
Dies ist eine Prozeduranwendung oder Applikation. Dies ist eine Prozeduranwendung oder Applikation.
Alle @scheme[expr]s werden ausgewertet: Alle @racket[expr]s werden ausgewertet:
Der Operator (also der erste Ausdruck) muß eine Der Operator (also der erste Ausdruck) muß eine
Prozedur ergeben, die genauso viele Argumente Prozedur ergeben, die genauso viele Argumente
akzeptieren kann, wie es Operanden, also weitere @scheme[expr]s gibt. akzeptieren kann, wie es Operanden, also weitere @racket[expr]s gibt.
Die Anwendung wird dann ausgewertet, indem der Rumpf Die Anwendung wird dann ausgewertet, indem der Rumpf
der Applikation ausgewertet wird, nachdem die Parameter der Applikation ausgewertet wird, nachdem die Parameter
der Prozedur durch die Argumente, also die Werte der der Prozedur durch die Argumente, also die Werte der
@ -53,15 +53,15 @@ Operanden ersetzt wurden.}
@; @defform[(#%app id expr expr ...)]{ @; @defform[(#%app id expr expr ...)]{
@; @;
@; Eine Prozedurapplikation kann auch mit @scheme[#%app] geschrieben @; Eine Prozedurapplikation kann auch mit @racket[#%app] geschrieben
@; werden, aber das macht eigentlich niemand.} @; werden, aber das macht eigentlich niemand.}
@section{@scheme[#t] and @scheme[#f]} @section{@racket[#t] and @racket[#f]}
@as-index{@litchar{#t}} ist das Literal für den booleschen Wert "wahr", @as-index{@litchar{#t}} ist das Literal für den booleschen Wert "wahr",
@as-index{@litchar{#f}} das Literal für den booleschen Wert "falsch". @as-index{@litchar{#f}} das Literal für den booleschen Wert "falsch".
@section{@scheme[lambda]} @section{@racket[lambda]}
@defform[(lambda (id ...) expr)]{ @defform[(lambda (id ...) expr)]{
Ein Lambda-Ausdruck ergibt bei der Auswertung eine neue Prozedur.} Ein Lambda-Ausdruck ergibt bei der Auswertung eine neue Prozedur.}
@ -70,69 +70,69 @@ Ein Lambda-Ausdruck ergibt bei der Auswertung eine neue Prozedur.}
@defform/none[id]{ @defform/none[id]{
Eine Variable bezieht sich auf die, von innen nach Eine Variable bezieht sich auf die, von innen nach
außen suchend, nächstgelegene Bindung durch @scheme[lambda], @scheme[let], @scheme[letrec], oder außen suchend, nächstgelegene Bindung durch @racket[lambda], @racket[let], @racket[letrec], oder
@scheme[let*]. Falls es keine solche lokale Bindung gibt, muß es eine @racket[let*]. Falls es keine solche lokale Bindung gibt, muß es eine
Definition oder eine eingebaute Bindung mit dem entsprechenden Namen Definition oder eine eingebaute Bindung mit dem entsprechenden Namen
geben. Die Auswertung des Namens ergibt dann den entsprechenden geben. Die Auswertung des Namens ergibt dann den entsprechenden
Wert. } Wert. }
@section{@scheme[cond]} @section{@racket[cond]}
@defform[(cond (expr expr) ... (expr expr))]{ @defform[(cond (expr expr) ... (expr expr))]{
Ein @scheme[cond]-Ausdruck bildet eine Verzweigung, die aus mehreren Ein @racket[cond]-Ausdruck bildet eine Verzweigung, die aus mehreren
Zweigen besteht. Jeder Zweig besteht Zweigen besteht. Jeder Zweig besteht
aus einem Test und einem Ausdruck. Bei der Auswertung werden die aus einem Test und einem Ausdruck. Bei der Auswertung werden die
Zweige nacheinander abgearbeitet. Dabei wird jeweils zunächst der Test Zweige nacheinander abgearbeitet. Dabei wird jeweils zunächst der Test
ausgewertet, der jeweils einen booleschen Wert ergeben müssen. Beim ausgewertet, der jeweils einen booleschen Wert ergeben müssen. Beim
ersten Test, der @scheme[#t] ergibt, wird der Wert des Ausdrucks des Zweigs zum ersten Test, der @racket[#t] ergibt, wird der Wert des Ausdrucks des Zweigs zum
Wert der gesamten Verzweigung. Wenn kein Test @scheme[#t] ergibt, wird das Wert der gesamten Verzweigung. Wenn kein Test @racket[#t] ergibt, wird das
Programm mit einer Fehlermeldung abgebrochen. Programm mit einer Fehlermeldung abgebrochen.
} }
@defform/none[#:literals (cond else) @defform/none[#:literals (cond else)
(cond (expr expr) ... (else expr))]{ (cond (expr expr) ... (else expr))]{
Die Form des cond-Ausdrucks ist ähnlich zur vorigen, mit der Die Form des cond-Ausdrucks ist ähnlich zur vorigen, mit der
Ausnahme, daß in dem Fall, in dem kein Test @scheme[#t] ergibt, der Wert des Ausnahme, daß in dem Fall, in dem kein Test @racket[#t] ergibt, der Wert des
letzten Ausdruck zum Wert der @scheme[cond]-Form wird. letzten Ausdruck zum Wert der @racket[cond]-Form wird.
} }
@defidform[else]{ @defidform[else]{
Das Schlüsselwort @scheme[else] kann nur in @scheme[cond] benutzt werden.} Das Schlüsselwort @racket[else] kann nur in @racket[cond] benutzt werden.}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section{@scheme[if]} @section{@racket[if]}
@defform[(if expr expr expr)]{ @defform[(if expr expr expr)]{
Eine @scheme[if]-Form ist eine binäre Verzweigung. Bei der Auswertung wird Eine @racket[if]-Form ist eine binäre Verzweigung. Bei der Auswertung wird
zunächst der erste Operand ausgewertet (der Test), der einen zunächst der erste Operand ausgewertet (der Test), der einen
booleschen Wert ergeben muß. Ergibt er @scheme[#t], wird der Wert des zweiten booleschen Wert ergeben muß. Ergibt er @racket[#t], wird der Wert des zweiten
Operanden (die Konsequente) zum Wert der @scheme[if]-Form, bei @scheme[#f] der Wert des Operanden (die Konsequente) zum Wert der @racket[if]-Form, bei @racket[#f] der Wert des
dritten Operanden (die Alternative). dritten Operanden (die Alternative).
} }
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section{@scheme[and]} @section{@racket[and]}
@defform[(and expr ...)]{ @defform[(and expr ...)]{
Bei der Auswertung eines @scheme[and]-Ausdrucks werden nacheinander die Bei der Auswertung eines @racket[and]-Ausdrucks werden nacheinander die
Operanden (die boolesche Werte ergeben müssen) ausgewertet. Ergibt Operanden (die boolesche Werte ergeben müssen) ausgewertet. Ergibt
einer @scheme[#f], ergibt auch der and-Ausdruck @scheme[#f]; wenn alle einer @racket[#f], ergibt auch der and-Ausdruck @racket[#f]; wenn alle
Operanden @scheme[#t] ergeben, ergibt auch der @scheme[and]-Ausdruck Operanden @racket[#t] ergeben, ergibt auch der @racket[and]-Ausdruck
@scheme[#t]. @racket[#t].
} }
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section{@scheme[or]} @section{@racket[or]}
@defform[(or expr ...)]{ @defform[(or expr ...)]{
Bei der Auswertung eines @scheme[or]-Ausdrucks werden nacheinander die Bei der Auswertung eines @racket[or]-Ausdrucks werden nacheinander die
Operanden (die boolesche Werte ergeben müssen) ausgewertet. Ergibt Operanden (die boolesche Werte ergeben müssen) ausgewertet. Ergibt
einer @scheme[#t], ergibt auch der or-Ausdruck @scheme[#t]; wenn alle Operanden @scheme[#f] einer @racket[#t], ergibt auch der or-Ausdruck @racket[#t]; wenn alle Operanden @racket[#f]
ergeben, ergibt auch der @scheme[or]-Ausdruck @scheme[#f]. ergeben, ergibt auch der @racket[or]-Ausdruck @racket[#f].
} }
@section{Signaturen} @section{Signaturen}
@ -141,14 +141,14 @@ Signaturen können statt der Verträge aus dem Buch geschrieben werden:
Während Verträge reine Kommentare sind, überprüft DrRacket Signaturen Während Verträge reine Kommentare sind, überprüft DrRacket Signaturen
und meldet etwaige Verletzungen. und meldet etwaige Verletzungen.
@subsection{@scheme[signature]} @subsection{@racket[signature]}
@defform[(signature sig)]{ @defform[(signature sig)]{
Diese Form liefert die Signatur mit der Notation @scheme[sig]. Diese Form liefert die Signatur mit der Notation @racket[sig].
} }
@subsection{Signaturdeklaration} @subsection{Signaturdeklaration}
@defform[(: id sig)]{ @defform[(: id sig)]{
Diese Form erklärt @scheme[sig] zur gültigen Signatur für @scheme[id]. Diese Form erklärt @racket[sig] zur gültigen Signatur für @racket[id].
} }
@subsection{Eingebaute Signaturen} @subsection{Eingebaute Signaturen}
@ -202,33 +202,33 @@ Signatur für Signaturen.}
@defidform[property]{ @defidform[property]{
Signatur für Eigenschaften.} Signatur für Eigenschaften.}
@subsection{@scheme[predicate]} @subsection{@racket[predicate]}
@defform[(predicate expr)]{ @defform[(predicate expr)]{
Bei dieser Signatur muß @scheme[expr] als Wert ein Prädikat haben, also Bei dieser Signatur muß @racket[expr] als Wert ein Prädikat haben, also
eine Prozedur, die einen beliebigen Wert akzeptiert und entweder @scheme[#t] eine Prozedur, die einen beliebigen Wert akzeptiert und entweder @racket[#t]
oder @scheme[#f] zurückgibt. oder @racket[#f] zurückgibt.
Die Signatur ist dann für einen Wert gültig, wenn das Prädikat, darauf angewendet, Die Signatur ist dann für einen Wert gültig, wenn das Prädikat, darauf angewendet,
@scheme[#t] ergibt. @racket[#t] ergibt.
} }
@subsection{@scheme[one-of]} @subsection{@racket[one-of]}
@defform[(one-of expr ...)]{ @defform[(one-of expr ...)]{
Diese Signatur ist für einen Wert gültig, wenn er gleich dem Wert eines Diese Signatur ist für einen Wert gültig, wenn er gleich dem Wert eines
der @scheme[expr] ist. der @racket[expr] ist.
} }
@subsection{@scheme[mixed]} @subsection{@racket[mixed]}
@defform[(mixed sig ...)]{ @defform[(mixed sig ...)]{
Diese Signatur ist für einen Wert gültig, wenn er für eine der Signaturen Diese Signatur ist für einen Wert gültig, wenn er für eine der Signaturen
@scheme[sig] gültig ist. @racket[sig] gültig ist.
} }
@subsection[#:tag "proc-signature"]{Prozedur-Signatur} @subsection[#:tag "proc-signature"]{Prozedur-Signatur}
@defidform[->]{ @defidform[->]{
@defform/none[(sig ... -> sig)]{ @defform/none[(sig ... -> sig)]{
Diese Signatur ist dann für einen Wert gültig, wenn dieser eine Diese Signatur ist dann für einen Wert gültig, wenn dieser eine
Prozedur ist. Er erklärt außerdem, daß die Signaturen vor dem @scheme[->] Prozedur ist. Er erklärt außerdem, daß die Signaturen vor dem @racket[->]
für die Argumente der Prozedur gelten und die Signatur nach dem @scheme[->] für die Argumente der Prozedur gelten und die Signatur nach dem @racket[->]
für den Rückgabewert. für den Rückgabewert.
}} }}
} }
@ -241,80 +241,80 @@ für den Rückgabewert.
Dies ist eine Signaturvariable: sie steht für eine Signatur, die für jeden Wert gültig ist. Dies ist eine Signaturvariable: sie steht für eine Signatur, die für jeden Wert gültig ist.
} }
@subsection{@scheme[combined]} @subsection{@racket[combined]}
@defform[(combined sig ...)]{ @defform[(combined sig ...)]{
Diese Signatur ist für einen Wert gültig, wenn sie für alle der Signaturen Diese Signatur ist für einen Wert gültig, wenn sie für alle der Signaturen
@scheme[sig] gültig ist. @racket[sig] gültig ist.
} }
@section{Testfälle} @section{Testfälle}
@defform[(check-expect expr expr)]{ @defform[(check-expect expr expr)]{
Dieser Testfall überprüft, ob der erste @scheme[expr] den gleichen Dieser Testfall überprüft, ob der erste @racket[expr] den gleichen
Wert hat wie der zweite @scheme[expr], wobei das zweite @scheme[expr] Wert hat wie der zweite @racket[expr], wobei das zweite @racket[expr]
meist ein Literal ist.} meist ein Literal ist.}
@defform[(check-within expr expr expr)]{ @defform[(check-within expr expr expr)]{
Wie @scheme[check-expect], aber mit einem weiteren Ausdruck, Wie @racket[check-expect], aber mit einem weiteren Ausdruck,
der als Wert eine Zahl @scheme[_delta] hat. Der Testfall überprüft, daß jede Zahl im Resultat der als Wert eine Zahl @racket[_delta] hat. Der Testfall überprüft, daß jede Zahl im Resultat
des ersten @scheme[expr] maximal um @scheme[_delta] des ersten @racket[expr] maximal um @racket[_delta]
von der entsprechenden Zahl im zweiten @scheme[expr] abweicht.} von der entsprechenden Zahl im zweiten @racket[expr] abweicht.}
@defform[(check-member-of expr expr ...)]{ @defform[(check-member-of expr expr ...)]{
Ähnlich wie @scheme[check-expect]: Der Testfall überprüft, daß das Resultat Ähnlich wie @racket[check-expect]: Der Testfall überprüft, daß das Resultat
des ersten Operanden gleich dem Wert eines der folgenden Operanden ist.} des ersten Operanden gleich dem Wert eines der folgenden Operanden ist.}
@defform[(check-range expr expr expr)]{ @defform[(check-range expr expr expr)]{
Ähnlich wie @scheme[check-expect]: Alle drei Operanden müssen Ähnlich wie @racket[check-expect]: Alle drei Operanden müssen
Zahlen sein. Der Testfall überprüft, ob die erste Zahl zwischen der Zahlen sein. Der Testfall überprüft, ob die erste Zahl zwischen der
zweiten und der dritten liegt (inklusive).} zweiten und der dritten liegt (inklusive).}
@defform[(check-error expr expr)]{ @defform[(check-error expr expr)]{
Dieser Testfall überprüft, ob der erste @scheme[expr] einen Fehler produziert, Dieser Testfall überprüft, ob der erste @racket[expr] einen Fehler produziert,
wobei die Fehlermeldung der Zeichenkette entspricht, die der Wert des zweiten wobei die Fehlermeldung der Zeichenkette entspricht, die der Wert des zweiten
@scheme[expr] ist.} @racket[expr] ist.}
@defform[(check-property expr)]{ @defform[(check-property expr)]{
Dieser Testfall überprüft experimentell, ob die @tech{Eigenschaft} Dieser Testfall überprüft experimentell, ob die @tech{Eigenschaft}
@scheme[expr] erfüllt ist. Dazu werden zufällige Werte für die mit @racket[expr] erfüllt ist. Dazu werden zufällige Werte für die mit
@scheme[for-all] quantifizierten Variablen eingesetzt: Damit wird @racket[for-all] quantifizierten Variablen eingesetzt: Damit wird
überprüft, ob die Bedingung gilt. überprüft, ob die Bedingung gilt.
@emph{Wichtig:} @scheme[check-property] funktioniert nur für @emph{Wichtig:} @racket[check-property] funktioniert nur für
Eigenschaften, bei denen aus den Signaturen sinnvoll Werte generiert Eigenschaften, bei denen aus den Signaturen sinnvoll Werte generiert
werden können. Dies ist für die meisten eingebauten Signaturen der werden können. Dies ist für die meisten eingebauten Signaturen der
Fall, aber nicht für Signaturvariablen und Signaturen, die mit @scheme[predicate] Fall, aber nicht für Signaturvariablen und Signaturen, die mit @racket[predicate]
erzeugt wurden. In diesen Fällen erzeugt @scheme[check-property] eine Fehlermeldung. erzeugt wurden. In diesen Fällen erzeugt @racket[check-property] eine Fehlermeldung.
} }
@section{Parametrische Record-Typ-Definitionen} @section{Parametrische Record-Typ-Definitionen}
@defform[(define-record-procedures-parametric t cc c p (s1 ...))]{ @defform[(define-record-procedures-parametric t cc c p (s1 ...))]{
Die @scheme[define-record-procedures-parametric] ist wie Die @racket[define-record-procedures-parametric] ist wie
@scheme[define-record-procedures]. Zusäzlich wird der Bezeichner @racket[define-record-procedures]. Zusäzlich wird der Bezeichner
@scheme[cc] an einen Signaturkonstruktor gebunden: Dieser akzeptiert @racket[cc] an einen Signaturkonstruktor gebunden: Dieser akzeptiert
für jedes Feld eine Feld-Signatur und liefert eine Signatur, die nur für jedes Feld eine Feld-Signatur und liefert eine Signatur, die nur
Records des Record-Typs @scheme[t] erfüllen, bei dem die Feldinhalte Records des Record-Typs @racket[t] erfüllen, bei dem die Feldinhalte
die Feld-Signaturen erfüllen. die Feld-Signaturen erfüllen.
Beispiel: Beispiel:
@schemeblock[ @racketblock[
(define-record-procedures-parametric pare pare-of (define-record-procedures-parametric pare pare-of
make-pare pare? make-pare pare?
(pare-one pare-two)) (pare-one pare-two))
] ]
Dann ist @scheme[(pare-of integer string)] die Signatur für Dann ist @racket[(pare-of integer string)] die Signatur für
@scheme[pare]-Records, bei dem die Feldinhalte die Signaturen @racket[pare]-Records, bei dem die Feldinhalte die Signaturen
@scheme[integer] bzw. @scheme[string] erfüllen müssen. @racket[integer] bzw. @racket[string] erfüllen müssen.
Die Signaturen für die Feldinhalte werden erst überprüft, wenn ein Die Signaturen für die Feldinhalte werden erst überprüft, wenn ein
Selektor aufgerufen wird. Selektor aufgerufen wird.
@ -322,15 +322,15 @@ Selektor aufgerufen wird.
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@; @section{@scheme[require]} @; @section{@racket[require]}
@; @;
@; @defform[(require string)]{ @; @defform[(require string)]{
@; @;
@; Diese Form macht die Definitionen des durch @scheme[string] spezifizierten Moduls @; Diese Form macht die Definitionen des durch @racket[string] spezifizierten Moduls
@; verfügbar. Dabei bezieht sich @scheme[string] auf eine Datei relativ zu der Datei, @; verfügbar. Dabei bezieht sich @racket[string] auf eine Datei relativ zu der Datei,
@; in der die @scheme[require]-Form steht. @; in der die @racket[require]-Form steht.
@; @;
@; Dabei ist @scheme[string] leicht eingeschränkt, um Portabilitätsprobleme zu vermeiden: @; Dabei ist @racket[string] leicht eingeschränkt, um Portabilitätsprobleme zu vermeiden:
@; @litchar{/} ist der Separator für Unterverzeichnisse,, @litchar{.} bedeutet das aktuelle @; @litchar{/} ist der Separator für Unterverzeichnisse,, @litchar{.} bedeutet das aktuelle
@; Verzeichnis, @litchar{..} meint das übergeordnete Verzeichnis, Pfadelemente @; Verzeichnis, @litchar{..} meint das übergeordnete Verzeichnis, Pfadelemente
@; können nur @litchar{a} bis @litchar{z} (groß oder klein), @; können nur @litchar{a} bis @litchar{z} (groß oder klein),
@ -342,7 +342,7 @@ Selektor aufgerufen wird.
@; @defform/none[#:literals (require) @; @defform/none[#:literals (require)
@; (require module-id)]{ @; (require module-id)]{
@; @;
@; Diese Form macht eine eingebaute Library mit dem Namen @scheme[module-id] verfügbar.} @; Diese Form macht eine eingebaute Library mit dem Namen @racket[module-id] verfügbar.}
@; @;
@; @defform/none[#:literals (require lib) @; @defform/none[#:literals (require lib)
@; (require (lib string string ...))]{ @; (require (lib string string ...))]{
@ -350,10 +350,10 @@ Selektor aufgerufen wird.
@; Diese Form macht die Definitionen eines Moduls in einer installierten Bibliothek @; Diese Form macht die Definitionen eines Moduls in einer installierten Bibliothek
@; verfügbar. @; verfügbar.
@; Der erste @; Der erste
@; @scheme[string] ist der Name der Datei des Moduls, und die restlichen @; @racket[string] ist der Name der Datei des Moduls, und die restlichen
@; @scheme[string]s bezeichnen die Collection (und Sub-Collection undsoweiter), @; @racket[string]s bezeichnen die Collection (und Sub-Collection undsoweiter),
@; in der die Datei installiert ist. Jede @scheme[string] ist ebenso eingeschränkt @; in der die Datei installiert ist. Jede @racket[string] ist ebenso eingeschränkt
@; wie bei @scheme[(require string)].} @; wie bei @racket[(require string)].}
@; @;
@; @;
@; @defform/none[#:literals (require planet) @; @defform/none[#:literals (require planet)
@ -371,7 +371,7 @@ Scheme-Ausdruck, die experimentell überprüft werden kann. Der
einfachste Fall einer Eigenschaft ist ein boolescher Ausdruck. Die einfachste Fall einer Eigenschaft ist ein boolescher Ausdruck. Die
folgende Eigenschaft gilt immer: folgende Eigenschaft gilt immer:
@schemeblock[ @racketblock[
(= 1 1) (= 1 1)
] ]
@ -379,17 +379,17 @@ Es ist auch möglich, in einer Eigenschaft Variablen zu verwenden, für
die verschiedene Werte eingesetzt werden. Dafür müssen die Variablen die verschiedene Werte eingesetzt werden. Dafür müssen die Variablen
gebunden und @deftech{quantifiziert} werden, d.h. es muß festgelegt gebunden und @deftech{quantifiziert} werden, d.h. es muß festgelegt
werden, welche Signatur die Werte der Variable erfüllen sollen. werden, welche Signatur die Werte der Variable erfüllen sollen.
Eigenschaften mit Variablen werden mit der @scheme[for-all]-Form erzeugt: Eigenschaften mit Variablen werden mit der @racket[for-all]-Form erzeugt:
@defform[(for-all ((id sig) ...) expr)]{ @defform[(for-all ((id sig) ...) expr)]{
Dies bindet die Variablen @scheme[id] in der Eigenschaft Dies bindet die Variablen @racket[id] in der Eigenschaft
@scheme[expr]. Zu jeder Variable gehört eine Signatur @racket[expr]. Zu jeder Variable gehört eine Signatur
@scheme[sig], der von den Werten der Variable erfüllt werden @racket[sig], der von den Werten der Variable erfüllt werden
muß. muß.
Beispiel: Beispiel:
@schemeblock[ @racketblock[
(for-all ((x integer)) (for-all ((x integer))
(= x (/ (* x 2) 2))) (= x (/ (* x 2) 2)))
] ]
@ -397,40 +397,40 @@ Beispiel:
@defform[(expect expr expr)]{ @defform[(expect expr expr)]{
Ein @scheme[expect]-Ausdruck ergibt eine Eigenschaft, die dann gilt, Ein @racket[expect]-Ausdruck ergibt eine Eigenschaft, die dann gilt,
wenn die Werte von @scheme[expr] und @scheme[expr] gleich sind, im wenn die Werte von @racket[expr] und @racket[expr] gleich sind, im
gleichen Sinne wie bei @scheme[check-expect].} gleichen Sinne wie bei @racket[check-expect].}
@defform[(expect-within expr expr expr)]{ @defform[(expect-within expr expr expr)]{
Wie @scheme[expect], aber entsprechend @scheme[check-within] mit einem Wie @racket[expect], aber entsprechend @racket[check-within] mit einem
weiteren Ausdruck, der als Wert eine Zahl @scheme[_delta] hat. Die weiteren Ausdruck, der als Wert eine Zahl @racket[_delta] hat. Die
resultierende Eigenschaft gilt, wenn jede Zahl im Resultat des ersten resultierende Eigenschaft gilt, wenn jede Zahl im Resultat des ersten
@scheme[expr] maximal um @scheme[_delta] von der entsprechenden Zahl @racket[expr] maximal um @racket[_delta] von der entsprechenden Zahl
im zweiten @scheme[expr] abweicht.} im zweiten @racket[expr] abweicht.}
@defform[(expect-member-of expr expr ...)]{ @defform[(expect-member-of expr expr ...)]{
Wie @scheme[expect], aber entsprechend @scheme[check-member-of] mit Wie @racket[expect], aber entsprechend @racket[check-member-of] mit
weiteren Ausdrücken, die mit dem ersten verglichen werden. Die weiteren Ausdrücken, die mit dem ersten verglichen werden. Die
resultierende Eigenschaft gilt, wenn das erste Argument gleich resultierende Eigenschaft gilt, wenn das erste Argument gleich
einem der anderen Argumente ist.} einem der anderen Argumente ist.}
@defform[(expect-range expr expr expr)]{ @defform[(expect-range expr expr expr)]{
Wie @scheme[expect], aber entsprechend @scheme[check-range]: Die Wie @racket[expect], aber entsprechend @racket[check-range]: Die
Argumente müssen Zahlen sein. Die Eigenschaft gilt, wenn die erste Zahl Argumente müssen Zahlen sein. Die Eigenschaft gilt, wenn die erste Zahl
zwischen der zweiten und dritten Zahl liegt (inklusive).} zwischen der zweiten und dritten Zahl liegt (inklusive).}
@defform[(==> expr expr)]{ @defform[(==> expr expr)]{
Der erste Operand ist ein boolescher Ausdruck, der zweite Operand eine Der erste Operand ist ein boolescher Ausdruck, der zweite Operand eine
Eigenschaft: @scheme[(==> c p)] legt fest, daß die Eigenschaft Eigenschaft: @racket[(==> c p)] legt fest, daß die Eigenschaft
@scheme[p] nur erfüllt sein muß, wenn @scheme[c] (die @racket[p] nur erfüllt sein muß, wenn @racket[c] (die
@emph{Bedingung}) @scheme[#t] ergibt, also erfüllt ist.} @emph{Bedingung}) @racket[#t] ergibt, also erfüllt ist.}
@schemeblock[ @racketblock[
(for-all ((x integer)) (for-all ((x integer))
(==> (even? x) (==> (even? x)
(= x (* 2 (/ x 2))))) (= x (* 2 (/ x 2)))))

View File

@ -23,7 +23,7 @@ Macht der Abstraktion}}.
@defmodule[deinprogramm/DMdA-beginner] @defmodule[deinprogramm/DMdA-beginner]
Das Modul @schememodname[deinprogramm/DMdA-beginner] implementiert die Das Modul @racketmodname[deinprogramm/DMdA-beginner] implementiert die
Anfängersprache für @|DMdA|; siehe @DMdA-ref["DMdA-beginner"]. Anfängersprache für @|DMdA|; siehe @DMdA-ref["DMdA-beginner"].
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@ -31,7 +31,7 @@ Anfängersprache für @|DMdA|; siehe @DMdA-ref["DMdA-beginner"].
@defmodule[deinprogramm/DMdA-vanilla] @defmodule[deinprogramm/DMdA-vanilla]
Das Modul @schememodname[deinprogramm/DMdA-vanilla] implementiert die Das Modul @racketmodname[deinprogramm/DMdA-vanilla] implementiert die
Standardsprache für @|DMdA|; siehe @DMdA-ref["DMdA-vanilla"]. Standardsprache für @|DMdA|; siehe @DMdA-ref["DMdA-vanilla"].
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@ -39,7 +39,7 @@ Standardsprache für @|DMdA|; siehe @DMdA-ref["DMdA-vanilla"].
@defmodule[deinprogramm/DMdA-assignments] @defmodule[deinprogramm/DMdA-assignments]
Das Modul @schememodname[deinprogramm/DMdA-assignments] implementiert Das Modul @racketmodname[deinprogramm/DMdA-assignments] implementiert
die Sprachebene für @|DMdA| mit Zuweisungen und Mutationen; siehe die Sprachebene für @|DMdA| mit Zuweisungen und Mutationen; siehe
@DMdA-ref["DMdA-assignments"]. @DMdA-ref["DMdA-assignments"].
@ -48,6 +48,6 @@ die Sprachebene für @|DMdA| mit Zuweisungen und Mutationen; siehe
@defmodule[deinprogramm/DMdA-advanced] @defmodule[deinprogramm/DMdA-advanced]
Das Modul @schememodname[deinprogramm/DMdA-advanced] implementiert Das Modul @racketmodname[deinprogramm/DMdA-advanced] implementiert
die fortgeschrittene Sprachebene für @|DMdA|; siehe die fortgeschrittene Sprachebene für @|DMdA|; siehe
@DMdA-ref["DMdA-advanced"]. @DMdA-ref["DMdA-advanced"].

View File

@ -11,7 +11,7 @@ Abstraktion}.
@declare-exporting[deinprogramm/DMdA-vanilla #:use-sources (deinprogramm/DMdA)] @declare-exporting[deinprogramm/DMdA-vanilla #:use-sources (deinprogramm/DMdA)]
@schemegrammar*-DMdA[ @racketgrammar*-DMdA[
#:literals () #:literals ()
() () () () () ()
] ]
@ -22,55 +22,55 @@ Abstraktion}.
@section[#:tag "signatures-vanilla"]{Signaturen} @section[#:tag "signatures-vanilla"]{Signaturen}
@subsection{@scheme[list-of]} @subsection{@racket[list-of]}
@defform[(list-of sig)]{ @defform[(list-of sig)]{
Diese Signatur ist dann für einen Wert gültig, wenn dieser eine Liste ist, Diese Signatur ist dann für einen Wert gültig, wenn dieser eine Liste ist,
für dessen Elemente @scheme[sig] gültig ist. für dessen Elemente @racket[sig] gültig ist.
} }
@section{@scheme[let], @scheme[letrec] und @scheme[let*]} @section{@racket[let], @racket[letrec] und @racket[let*]}
@defform[(let ((id expr) ...) expr)]{ @defform[(let ((id expr) ...) expr)]{
Bei einem @scheme[let]-Ausdruck werden zunächst die @scheme[expr]s aus Bei einem @racket[let]-Ausdruck werden zunächst die @racket[expr]s aus
den @scheme[(id expr)]-Paaren ausgewertet. Ihre Werte werden dann im den @racket[(id expr)]-Paaren ausgewertet. Ihre Werte werden dann im
Rumpf-@scheme[expr] für die Namen @scheme[id] eingesetzt. Dabei können Rumpf-@racket[expr] für die Namen @racket[id] eingesetzt. Dabei können
sich die Ausdrücke nicht auf die Namen beziehen. sich die Ausdrücke nicht auf die Namen beziehen.
@schemeblock[ @racketblock[
(define a 3) (define a 3)
(let ((a 16) (let ((a 16)
(b a)) (b a))
(+ b a)) (+ b a))
=> 19] => 19]
Das Vorkommen von @scheme[a] in der Bindung von @scheme[b] bezieht Das Vorkommen von @racket[a] in der Bindung von @racket[b] bezieht
sich also auf das @scheme[a] aus der Definition, nicht das @scheme[a] sich also auf das @racket[a] aus der Definition, nicht das @racket[a]
aus dem @scheme[let]-Ausdruck. aus dem @racket[let]-Ausdruck.
} }
@defform[(letrec ((id expr) ...) expr)]{ @defform[(letrec ((id expr) ...) expr)]{
Ein @scheme[letrec]-Ausdruck ist Ein @racket[letrec]-Ausdruck ist
ähnlich zum entsprechenden @scheme[let]-Ausdruck, mit dem Unterschied, daß sich ähnlich zum entsprechenden @racket[let]-Ausdruck, mit dem Unterschied, daß sich
die @scheme[expr]s aus den Bindungen auf die gebundenen Namen beziehen die @racket[expr]s aus den Bindungen auf die gebundenen Namen beziehen
dürfen.} dürfen.}
@defform[(let* ((id expr) ...) expr)]{ @defform[(let* ((id expr) ...) expr)]{
Ein @scheme[let*]-Ausdruck ist ähnlich zum entsprechenden Ein @racket[let*]-Ausdruck ist ähnlich zum entsprechenden
@scheme[let]-Ausdruck, mit dem Unterschied, daß sich die @scheme[expr]s @racket[let]-Ausdruck, mit dem Unterschied, daß sich die @racket[expr]s
aus den Bindungen auf die Namen beziehen dürfen, die jeweils vor dem aus den Bindungen auf die Namen beziehen dürfen, die jeweils vor dem
@scheme[expr] gebunden wurden. Beispiel: @racket[expr] gebunden wurden. Beispiel:
@schemeblock[ @racketblock[
(define a 3) (define a 3)
(let* ((a 16) (let* ((a 16)
(b a)) (b a))
(+ b a)) (+ b a))
=> 32] => 32]
Das Vorkommen von @scheme[a] in der Bindung von @scheme[b] bezieht Das Vorkommen von @racket[a] in der Bindung von @racket[b] bezieht
sich also auf das @scheme[a] aus dem @scheme[let*]-Ausdruck, nicht das sich also auf das @racket[a] aus dem @racket[let*]-Ausdruck, nicht das
@scheme[a] aus der globalen Definition. @racket[a] aus der globalen Definition.
} }
@section[#:tag "vanilla-prim-op"]{Primitive Operationen} @section[#:tag "vanilla-prim-op"]{Primitive Operationen}

View File

@ -20,37 +20,37 @@ Zusätzliche Prozeduren erlauben die Komposition von Bildern.
@section{Bilder} @section{Bilder}
@defthing[image signature]{ @defthing[image signature]{
Ein @deftech{Bild} (Name: @scheme[image]) ist die Repräsentation eines Bildes. Ein @deftech{Bild} (Name: @racket[image]) ist die Repräsentation eines Bildes.
} }
@defthing[empty-image image]{ @defthing[empty-image image]{
Ein leeres Bild mit Breite und Höhe 0. Ein leeres Bild mit Breite und Höhe 0.
} }
@defthing[image? (any -> boolean?)]{Der Aufruf @scheme[(image? x)] stellt fest, ob @scheme[x] ein Bild ist.} @defthing[image? (any -> boolean?)]{Der Aufruf @racket[(image? x)] stellt fest, ob @racket[x] ein Bild ist.}
@;----------------------------------------------------------------------------- @;-----------------------------------------------------------------------------
@section[#:tag "modes-colors"]{Modi und Farben} @section[#:tag "modes-colors"]{Modi und Farben}
@defthing[mode signature]{ @defthing[mode signature]{
@scheme[(one-of "solid" "outline")] @racket[(one-of "solid" "outline")]
Ein Modus (Name: @scheme[mode]) legt fest, ob die Darstellung einer Form diese füllt Ein Modus (Name: @racket[mode]) legt fest, ob die Darstellung einer Form diese füllt
oder nur einen Umriss zeichnet.} oder nur einen Umriss zeichnet.}
@defthing[octet signature]{ @defthing[octet signature]{
@scheme[(combined natural (predicate (lambda (n) (<= n 255))))] @racket[(combined natural (predicate (lambda (n) (<= n 255))))]
Ein Oktet (Name: @scheme[octet]) ist eine natürliche Zahl zwischen 0 und 255.} Ein Oktet (Name: @racket[octet]) ist eine natürliche Zahl zwischen 0 und 255.}
@defthing[rgb-color signature]{ @defthing[rgb-color signature]{
Eine @deftech{RGB-Farbe} ist eine Farbe (Name: @scheme[color], die vom Eine @deftech{RGB-Farbe} ist eine Farbe (Name: @racket[color], die vom
Record-Konstruktor @scheme[make-color] zurückgegeben wird: Record-Konstruktor @racket[make-color] zurückgegeben wird:
} }
@defthing[make-color (octet octet octet -> rgb-color)]{ @defthing[make-color (octet octet octet -> rgb-color)]{
Eine @tech{RGB-Farbe} beschreibt eine Farbe mit den roten, blauen und grünen Anteilen, Eine @tech{RGB-Farbe} beschreibt eine Farbe mit den roten, blauen und grünen Anteilen,
also z.B. @scheme[(make-color 100 200 30)].} also z.B. @racket[(make-color 100 200 30)].}
@defthing[color-red (color -> octet)]{ @defthing[color-red (color -> octet)]{
liefert den Rot-Anteil einer RGB-Farbe.} liefert den Rot-Anteil einer RGB-Farbe.}
@ -63,22 +63,22 @@ also z.B. @scheme[(make-color 100 200 30)].}
stellt fest, ob ein Objekt eine @tech{RGB-Farbe} ist.} stellt fest, ob ein Objekt eine @tech{RGB-Farbe} ist.}
@defthing[image-color signature]{ @defthing[image-color signature]{
@scheme[(mixed string rgb-color)] @racket[(mixed string rgb-color)]
Eine @deftech{Farbe} (Name: @scheme[image-color]) ist eine Zeichenkette aus einer Farbbezeichnung Eine @deftech{Farbe} (Name: @racket[image-color]) ist eine Zeichenkette aus einer Farbbezeichnung
(z.B. @scheme["blue"]) oder eine @tech{RGB-Farbe}.} (z.B. @racket["blue"]) oder eine @tech{RGB-Farbe}.}
@defthing[image-color? (any -> boolean?)]{ stellt fest, ob ein Objekt @defthing[image-color? (any -> boolean?)]{ stellt fest, ob ein Objekt
eine @tech{Farbe} ist.} eine @tech{Farbe} ist.}
@defthing[alpha-rgb-color signature]{ @defthing[alpha-rgb-color signature]{
Eine @deftech{Alpha/RGB-Farbe} ist eine Farbe (Name: @scheme[color], die vom Eine @deftech{Alpha/RGB-Farbe} ist eine Farbe (Name: @racket[color], die vom
Record-Konstruktor @scheme[make-alpha-color] zurückgegeben wird: Record-Konstruktor @racket[make-alpha-color] zurückgegeben wird:
} }
@defthing[make-alpha-color (octet octet octet octet -> alpha-color)]{ @defthing[make-alpha-color (octet octet octet octet -> alpha-color)]{
Eine @tech{Alpha/RGB-Farbe} beschreibt eine Farbe mit den Alpha-, roten, Eine @tech{Alpha/RGB-Farbe} beschreibt eine Farbe mit den Alpha-, roten,
blaue und grünen Anteilen, also z.B. @scheme[(make-color 50 100 200 blaue und grünen Anteilen, also z.B. @racket[(make-color 50 100 200
30)]. Der Alpha-Anteil beschreibt, wie durchsichtig die Farbe ist.} 30)]. Der Alpha-Anteil beschreibt, wie durchsichtig die Farbe ist.}
@defthing[alpha-color-red (color -> octet)]{ @defthing[alpha-color-red (color -> octet)]{
@ -101,37 +101,37 @@ stellt fest, ob ein Objekt eine @tech{Alpha/RGB-Farbe} ist.}
Die folgenden Prozeduren erzeugen Bilder mit einfachen geometrischen Formen: Die folgenden Prozeduren erzeugen Bilder mit einfachen geometrischen Formen:
@defthing[rectangle (natural natural mode image-color -> image)]{ @defthing[rectangle (natural natural mode image-color -> image)]{
Der Aufruf @scheme[(rectangle w h m c)] Der Aufruf @racket[(rectangle w h m c)]
erzeugt ein Rechteck mit Breite @scheme[w] und Höhe @scheme[h], gefüllt mit Modus erzeugt ein Rechteck mit Breite @racket[w] und Höhe @racket[h], gefüllt mit Modus
@scheme[m] und in Farbe @scheme[c].} @racket[m] und in Farbe @racket[c].}
@defthing[circle (natural mode image-color -> image)]{ @defthing[circle (natural mode image-color -> image)]{
Der Aufruf @scheme[(circle r m c)] Der Aufruf @racket[(circle r m c)]
erzeugt einen Kreis oder eine Scheibe mit Radius @scheme[r], gefüllt mit Modus erzeugt einen Kreis oder eine Scheibe mit Radius @racket[r], gefüllt mit Modus
@scheme[m] und in Farbe @scheme[c].} @racket[m] und in Farbe @racket[c].}
@defthing[ellipse (natural natural mode image-color -> image)]{ @defthing[ellipse (natural natural mode image-color -> image)]{
Der Aufruf @scheme[(ellipse w h m c)] Der Aufruf @racket[(ellipse w h m c)]
erzeugt eine Ellipse mit Breite @scheme[w] und Höhe @scheme[h], gefüllt mit Modus erzeugt eine Ellipse mit Breite @racket[w] und Höhe @racket[h], gefüllt mit Modus
@scheme[m] und in Farbe @scheme[c].} @racket[m] und in Farbe @racket[c].}
@defthing[triangle (integer mode image-color -> image)]{ @defthing[triangle (integer mode image-color -> image)]{
Der Aufruf @scheme[(triangle s m c)] Der Aufruf @racket[(triangle s m c)]
erzeugt ein nach oben zeigendes gleichseitiges Dreieck, wobei erzeugt ein nach oben zeigendes gleichseitiges Dreieck, wobei
@scheme[s] die Seitenlänge angibt, gefüllt mit Modus @racket[s] die Seitenlänge angibt, gefüllt mit Modus
@scheme[m] und in Farbe @scheme[c].} @racket[m] und in Farbe @racket[c].}
@defthing[line (natural natural number number number number image-color -> image)]{ @defthing[line (natural natural number number number number image-color -> image)]{
Der Aufruf @scheme[(line w h sx sy ex ey c)] Der Aufruf @racket[(line w h sx sy ex ey c)]
erzeugt ein Bild mit einer farbigen Strecke, wobei @scheme[w] die Breite und @scheme[h] die Höhe des Bilds, erzeugt ein Bild mit einer farbigen Strecke, wobei @racket[w] die Breite und @racket[h] die Höhe des Bilds,
sowie @scheme[sx] die X- und @scheme[sx] die Y-Koordinate des Anfangspunkts und sowie @racket[sx] die X- und @racket[sx] die Y-Koordinate des Anfangspunkts und
@scheme[ex] die X- und @scheme[ey] die Y-Koordinate des Endpunkts angeben, gefüllt mit Modus @racket[ex] die X- und @racket[ey] die Y-Koordinate des Endpunkts angeben, gefüllt mit Modus
@scheme[m] und in Farbe @scheme[c].} @racket[m] und in Farbe @racket[c].}
@defthing[text (string natural image-color -> image)]{ @defthing[text (string natural image-color -> image)]{
Der Aufruf @scheme[(text s f c)] Der Aufruf @racket[(text s f c)]
erzeugt ein Bild mit Text @scheme[s], erzeugt ein Bild mit Text @racket[s],
wobei die Buchstaben die Größe @scheme[f] haben, in Farbe @scheme[c]} wobei die Buchstaben die Größe @racket[f] haben, in Farbe @racket[c]}
Außerdem können beliebige Bitmap-Bilder in ein Scheme-Programm Außerdem können beliebige Bitmap-Bilder in ein Scheme-Programm
eingeklebt werden. eingeklebt werden.
@ -143,18 +143,18 @@ Zwei Eigenschaften von Bildern sind für ihre Manipulation nützlich,
nämlich Breite und Höhe: nämlich Breite und Höhe:
@defthing[image-width (image -> natural)]{ @defthing[image-width (image -> natural)]{
liefert die Breite von @scheme[i] in Pixeln.} liefert die Breite von @racket[i] in Pixeln.}
@defthing[image-height (image -> natural)]{ @defthing[image-height (image -> natural)]{
liefert die Höhe von @scheme[i] in Pixeln.} liefert die Höhe von @racket[i] in Pixeln.}
@defthing[image-inside? (image image -> boolean)]{ @defthing[image-inside? (image image -> boolean)]{
Der Aufruf @scheme[(image-inside? i1 i2)] stellt fest, ob das Bild Der Aufruf @racket[(image-inside? i1 i2)] stellt fest, ob das Bild
@scheme[i2] im Bild @scheme[i1] enthalten ist.} @racket[i2] im Bild @racket[i1] enthalten ist.}
@defthing[find-image (image image -> posn)]{ @defthing[find-image (image image -> posn)]{
Der Aufruf @scheme[(find-image i1 i2)] findet die Position von @scheme[i2] Der Aufruf @racket[(find-image i1 i2)] findet die Position von @racket[i2]
im Bild @scheme[i1] (in dem es vorkommen muss).} im Bild @racket[i1] (in dem es vorkommen muss).}
@;----------------------------------------------------------------------------- @;-----------------------------------------------------------------------------
@section[#:tag "composition"]{Bilder zusammensetzen} @section[#:tag "composition"]{Bilder zusammensetzen}
@ -162,87 +162,87 @@ im Bild @scheme[i1] (in dem es vorkommen muss).}
The nächste Gruppe von Prozeduren baut aus Bildern neue Bilder: The nächste Gruppe von Prozeduren baut aus Bildern neue Bilder:
@defthing[h-place signature]{ @defthing[h-place signature]{
@scheme[(mixed integer (one-of "left" "right" "center"))] @racket[(mixed integer (one-of "left" "right" "center"))]
Eine @deftech{horizontale Positionsangabe} (Name: @scheme[h-place]) Eine @deftech{horizontale Positionsangabe} (Name: @racket[h-place])
gibt an, wie zwei Bilder horizontal zueinander positioniert werden gibt an, wie zwei Bilder horizontal zueinander positioniert werden
Im ersten Fall, wenn es sich um eine Zahl @scheme[x] handelt, wird das Im ersten Fall, wenn es sich um eine Zahl @racket[x] handelt, wird das
zweite Bild @scheme[x] Pixel vom linken Rand auf das erste gelegt. zweite Bild @racket[x] Pixel vom linken Rand auf das erste gelegt.
Die drei Fälle mit Zeichenketten sagen, daß die Bilder am linken Rand Die drei Fälle mit Zeichenketten sagen, daß die Bilder am linken Rand
bzw. am rechten Rand bündig plaziert werden, bzw. das zweite Bild bzw. am rechten Rand bündig plaziert werden, bzw. das zweite Bild
horizontal in die Mitte des ersten gesetzt wird.} horizontal in die Mitte des ersten gesetzt wird.}
@defthing[v-place signature]{ @defthing[v-place signature]{
@scheme[(mixed integer (one-of "top" "bottom" "center"))] @racket[(mixed integer (one-of "top" "bottom" "center"))]
Eine @deftech{vertikale Positionsangabe} (Name: @scheme[v-place]) Eine @deftech{vertikale Positionsangabe} (Name: @racket[v-place])
gibt an, wie zwei Bilder vertikal zueinander positioniert werden gibt an, wie zwei Bilder vertikal zueinander positioniert werden
Im ersten Fall, wenn es sich um eine Zahl @scheme[y] handelt, wird das Im ersten Fall, wenn es sich um eine Zahl @racket[y] handelt, wird das
zweite Bild @scheme[y] Pixel vom oberen Rand auf das erste gelegt. zweite Bild @racket[y] Pixel vom oberen Rand auf das erste gelegt.
Die drei Fälle mit Zeichenketten sagen, daß die Bilder am oberen Rand Die drei Fälle mit Zeichenketten sagen, daß die Bilder am oberen Rand
bzw. am unteren Rand bündig plaziert werden, bzw. das zweite Bild bzw. am unteren Rand bündig plaziert werden, bzw. das zweite Bild
vertikal in die Mitte des ersten gesetzt wird. vertikal in die Mitte des ersten gesetzt wird.
} }
@defthing[h-mode signature]{ @defthing[h-mode signature]{
@scheme[(one-of "left" "right" "center")] @racket[(one-of "left" "right" "center")]
Eine @deftech{horizontale Justierungsangabe} (Name: @scheme[h-mode]) Eine @deftech{horizontale Justierungsangabe} (Name: @racket[h-mode])
gibt an, ob zwei Bilder, die übereinander angeordnet werden, entlang der linken gibt an, ob zwei Bilder, die übereinander angeordnet werden, entlang der linken
Kante, der rechten Kante oder der Mitte angeordnet werden. Kante, der rechten Kante oder der Mitte angeordnet werden.
} }
@defthing[v-mode signature]{ @defthing[v-mode signature]{
@scheme[(one-of "top" "bottom" "center")] @racket[(one-of "top" "bottom" "center")]
Eine @deftech{vertikale Justierungsangabe} (Name: @scheme[V-mode]) Eine @deftech{vertikale Justierungsangabe} (Name: @racket[V-mode])
gibt an, ob zwei Bilder, die nebenander angeordnet werden, entlang der gibt an, ob zwei Bilder, die nebenander angeordnet werden, entlang der
oberen Kante, der untern Kante oder der Mitte angeordnet werden.} oberen Kante, der untern Kante oder der Mitte angeordnet werden.}
@defthing[overlay (image image h-place v-place -> image)]{ @defthing[overlay (image image h-place v-place -> image)]{
Der Aufruf @scheme[(overlay img other h v)] Der Aufruf @racket[(overlay img other h v)]
legt zweite Bild @scheme[other] auf das erste @scheme[img]. Die beiden anderen Argumente geben an, wie legt zweite Bild @racket[other] auf das erste @racket[img]. Die beiden anderen Argumente geben an, wie
die beiden Bilder zueinander positioniert werden.} die beiden Bilder zueinander positioniert werden.}
@defthing[beside (image image v-mode -> image)]{ @defthing[beside (image image v-mode -> image)]{
Der Aufruf @scheme[(beside img other v)] Der Aufruf @racket[(beside img other v)]
ordnet die beiden Bilder entsprechend des @scheme[v]-Arguments ordnet die beiden Bilder entsprechend des @racket[v]-Arguments
nebeneinander an.} nebeneinander an.}
@defthing[above (image image h-mode -> image)]{ @defthing[above (image image h-mode -> image)]{
Der Aufruf @scheme[(img other h -> image)] Der Aufruf @racket[(img other h -> image)]
ordnet die beiden Bilder entsprechend des @scheme[h]-Arguments ordnet die beiden Bilder entsprechend des @racket[h]-Arguments
übereinander an.} übereinander an.}
@defthing[clip (image natural natural natural natural -> image)]{ @defthing[clip (image natural natural natural natural -> image)]{
Der Aufruf @scheme[(clip img x y w h)] Der Aufruf @racket[(clip img x y w h)]
liefert das Teilrechteck des Bildes @scheme[img] liefert das Teilrechteck des Bildes @racket[img]
bei (@scheme[x], @scheme[y]), Breite @scheme[w] und Höhe @scheme[h].} bei (@racket[x], @racket[y]), Breite @racket[w] und Höhe @racket[h].}
@defthing[pad (image natural natural natural natural -> image)]{ @defthing[pad (image natural natural natural natural -> image)]{
Der Aufruf @scheme[(pad img l r t b)] Der Aufruf @racket[(pad img l r t b)]
fügt an den Seiten von @scheme[img] noch transparenten Leerraum an: fügt an den Seiten von @racket[img] noch transparenten Leerraum an:
@scheme[l] Pixel links, @scheme[r] Pixel rechts, @scheme[t] Pixel oben und @racket[l] Pixel links, @racket[r] Pixel rechts, @racket[t] Pixel oben und
@scheme[b] Pixel unten.} @racket[b] Pixel unten.}
@;----------------------------------------------------------------------------- @;-----------------------------------------------------------------------------
@section[#:tag "from-pixels"]{Bilder aus Pixeln konstruieren} @section[#:tag "from-pixels"]{Bilder aus Pixeln konstruieren}
@defthing[color-list->image ((list-of color) natural natural -> image)]{ @defthing[color-list->image ((list-of color) natural natural -> image)]{
Der Aufruf @scheme[(color-list->image lis w h)] stellt ein Bild mit Der Aufruf @racket[(color-list->image lis w h)] stellt ein Bild mit
Breite @scheme[w] und Höhe @scheme[h] her, in dem die Pixel die Breite @racket[w] und Höhe @racket[h] her, in dem die Pixel die
Farben aus der Liste @scheme[lis] (welche die Länge @scheme[(* w h)] Farben aus der Liste @racket[lis] (welche die Länge @racket[(* w h)]
haben muß) haben.} haben muß) haben.}
@defthing[image->color-list (image -> (list-of rgb-color))]{ @defthing[image->color-list (image -> (list-of rgb-color))]{
Diese Prozedur liefert eine Liste der RGB-Farben der Pixel eines Bildes.} Diese Prozedur liefert eine Liste der RGB-Farben der Pixel eines Bildes.}
@defthing[alpha-color-list->image ((list-of alpha-rgb-color) natural natural -> image)]{ @defthing[alpha-color-list->image ((list-of alpha-rgb-color) natural natural -> image)]{
Der Aufruf @scheme[(color-list->image lis w h)] stellt ein Bild mit Der Aufruf @racket[(color-list->image lis w h)] stellt ein Bild mit
Breite @scheme[w] und Höhe @scheme[h] her, in dem die Pixel die Breite @racket[w] und Höhe @racket[h] her, in dem die Pixel die
Farben aus der Liste @scheme[lis] (welche die Länge @scheme[(* w h)] Farben aus der Liste @racket[lis] (welche die Länge @racket[(* w h)]
haben muß) haben.} haben muß) haben.}
@defthing[image->alpha-color-list (image -> (list-of rgb-color))]{ @defthing[image->alpha-color-list (image -> (list-of rgb-color))]{

View File

@ -37,10 +37,10 @@ die möglichen Werte also in feste Kategorien sortiert werden können,
steht im Rumpf eine Verzweigung. Die Anzahl der Zweige entspricht steht im Rumpf eine Verzweigung. Die Anzahl der Zweige entspricht
der Anzahl der Kategorien. der Anzahl der Kategorien.
Die Schablone für eine Prozedur @scheme[proc], deren Argument zu einer Sorte gehört, Die Schablone für eine Prozedur @racket[proc], deren Argument zu einer Sorte gehört,
die @italic{n} Kategorien hat, sieht folgendermaßen aus: die @italic{n} Kategorien hat, sieht folgendermaßen aus:
@schemeblock[ @racketblock[
(: proc (sig -> ...)) (: proc (sig -> ...))
(define proc (define proc
(lambda (a) (lambda (a)
@ -49,16 +49,16 @@ die @italic{n} Kategorien hat, sieht folgendermaßen aus:
... ...
(#,(elem (scheme test) (subscript "n")) ...)))) (#,(elem (scheme test) (subscript "n")) ...))))
] ]
Dabei ist @scheme[sig] die Signatur, den die Elemente der Sorte erfüllen müssen. Dabei ist @racket[sig] die Signatur, den die Elemente der Sorte erfüllen müssen.
Die @elem[(scheme test) (subscript "i")] müssen Tests sein, welche die einzelnen Kategorien Die @elem[(scheme test) (subscript "i")] müssen Tests sein, welche die einzelnen Kategorien
erkennen. Sie sollten alle Kategorien abdecken. erkennen. Sie sollten alle Kategorien abdecken.
Der letzte Zweig kann auch ein @scheme[else]-Zweig sein, falls Der letzte Zweig kann auch ein @racket[else]-Zweig sein, falls
klar ist, daß @scheme[a] zum letzten Fall gehört, wenn alle vorherigen klar ist, daß @racket[a] zum letzten Fall gehört, wenn alle vorherigen
@elem[(scheme test) (subscript "i")] @scheme[#f] ergeben haben. @elem[(scheme test) (subscript "i")] @racket[#f] ergeben haben.
Anschließend werden die Zweige vervollständigt. Anschließend werden die Zweige vervollständigt.
Bei Fallunterscheidungen mit zwei Kategorien kann auch @scheme[if] Bei Fallunterscheidungen mit zwei Kategorien kann auch @racket[if]
statt @scheme[cond] verwendet werden. statt @racket[cond] verwendet werden.
@section{zusammengesetzte Daten} @section{zusammengesetzte Daten}
Wenn bei der Datenanalyse zusammengesetzte Daten vorkommen, stellen Wenn bei der Datenanalyse zusammengesetzte Daten vorkommen, stellen
@ -66,23 +66,23 @@ Sie zunächst fest, welche Komponenten zu welchen Sorten gehören.
Schreiben Sie dann eine Datendefinition, die mit folgenden Worten Schreiben Sie dann eine Datendefinition, die mit folgenden Worten
anfängt: anfängt:
@schemeblock[ @racketblock[
(code:comment @#,t{Ein @scheme[x] besteht aus / hat:}) (code:comment @#,t{Ein @racket[x] besteht aus / hat:})
(code:comment @#,t{- @scheme[#,(elem (scheme Feld) (subscript "1"))] @scheme[(#,(elem (scheme sig) (subscript "1")))]}) (code:comment @#,t{- @racket[#,(elem (scheme Feld) (subscript "1"))] @racket[(#,(elem (scheme sig) (subscript "1")))]})
(code:comment @#,t{...}) (code:comment @#,t{...})
(code:comment @#,t{- @scheme[#,(elem (scheme Feld) (subscript "n"))] @scheme[(#,(elem (scheme sig) (subscript "n")))]}) (code:comment @#,t{- @racket[#,(elem (scheme Feld) (subscript "n"))] @racket[(#,(elem (scheme sig) (subscript "n")))]})
] ]
Dabei ist @scheme[x] ein umgangssprachlicher Name für die Sorte Dabei ist @racket[x] ein umgangssprachlicher Name für die Sorte
(``Schokokeks''), die @elem[(scheme Feld) (subscript "i")] sind (``Schokokeks''), die @elem[(scheme Feld) (subscript "i")] sind
umgangssprachliche Namen und kurze Beschreibungen der Komponenten umgangssprachliche Namen und kurze Beschreibungen der Komponenten
und die @elem[(scheme sig) (subscript "i")] die dazugehörigen Signaturen. und die @elem[(scheme sig) (subscript "i")] die dazugehörigen Signaturen.
Übersetzen Sie die Datendefinition in eine Record-Definition, indem Sie Übersetzen Sie die Datendefinition in eine Record-Definition, indem Sie
auch Namen für die Record-Signatur @scheme[sig], Konstruktor @scheme[constr], auch Namen für die Record-Signatur @racket[sig], Konstruktor @racket[constr],
Prädikat @scheme[pred?] und die Selektoren @elem[(scheme select) (subscript "i")] Prädikat @racket[pred?] und die Selektoren @elem[(scheme select) (subscript "i")]
wählen: wählen:
@schemeblock[ @racketblock[
(define-record-procedures sig (define-record-procedures sig
constr pred? constr pred?
(#,(elem (scheme select) (subscript "1")) ... #,(elem (scheme select) (subscript "n")))) (#,(elem (scheme select) (subscript "1")) ... #,(elem (scheme select) (subscript "n"))))
@ -91,13 +91,13 @@ wählen:
Schreiben Sie außerdem eine Signatur für den Konstruktor der Schreiben Sie außerdem eine Signatur für den Konstruktor der
Form: Form:
@schemeblock[ @racketblock[
(: constr (#,(elem (scheme sig) (subscript "1")) ... #,(elem (scheme sig) (subscript "n")) -> sig)) (: constr (#,(elem (scheme sig) (subscript "1")) ... #,(elem (scheme sig) (subscript "n")) -> sig))
] ]
Ggf. schreiben Sie außerdem Signaturen für das Prädikat und die Selektoren: Ggf. schreiben Sie außerdem Signaturen für das Prädikat und die Selektoren:
@schemeblock[ @racketblock[
(: pred? (any -> boolean)) (: pred? (any -> boolean))
(: #,(elem (scheme select) (subscript "1")) (sig -> #,(elem (scheme sig) (subscript "1")))) (: #,(elem (scheme select) (subscript "1")) (sig -> #,(elem (scheme sig) (subscript "1"))))
... ...
@ -109,8 +109,8 @@ Wenn ein Argument einer Prozedur zusammengesetzt ist, stellen Sie
zunächst fest, von welchen Komponenten des Records das Ergebnis der zunächst fest, von welchen Komponenten des Records das Ergebnis der
Prozeduren abhängt. Prozeduren abhängt.
Schreiben Sie dann für jede Komponente @scheme[(select a)] in die Schreiben Sie dann für jede Komponente @racket[(select a)] in die
Schablone, wobei @scheme[select] der Selektor der Komponente und @scheme[a] der Name Schablone, wobei @racket[select] der Selektor der Komponente und @racket[a] der Name
des Parameters der Prozedur ist. des Parameters der Prozedur ist.
Vervollständigen Sie die Schablone, indem Sie einen Ausdruck Vervollständigen Sie die Schablone, indem Sie einen Ausdruck
@ -124,23 +124,23 @@ enthält einen Aufruf des Konstruktors des zugehörigen Record-Typs.
Wenn bei der Datenanalyse gemischte Daten auftauchen, schreiben Sie Wenn bei der Datenanalyse gemischte Daten auftauchen, schreiben Sie
eine Datendefinition der Form: eine Datendefinition der Form:
@schemeblock[ @racketblock[
(code:comment @#,t{Ein @scheme[x] ist eins der Folgenden:}) (code:comment @#,t{Ein @racket[x] ist eins der Folgenden:})
(code:comment @#,t{- @elem[(scheme Sorte) (subscript "1")] (@elem[(scheme sig) (subscript "1")])}) (code:comment @#,t{- @elem[(scheme Sorte) (subscript "1")] (@elem[(scheme sig) (subscript "1")])})
(code:comment @#,t{...}) (code:comment @#,t{...})
(code:comment @#,t{- @elem[(scheme Sorte) (subscript "n")] (@elem[(scheme sig) (subscript "n")])}) (code:comment @#,t{- @elem[(scheme Sorte) (subscript "n")] (@elem[(scheme sig) (subscript "n")])})
(code:comment @#,t{Name: @scheme[sig]}) (code:comment @#,t{Name: @racket[sig]})
] ]
Dabei sind die @elem[(scheme Sorte) (subscript "i")] umgangssprachliche Namen Dabei sind die @elem[(scheme Sorte) (subscript "i")] umgangssprachliche Namen
für die möglichen Sorten, die ein Wert aus diesen gemischten Daten für die möglichen Sorten, die ein Wert aus diesen gemischten Daten
annehmen kann. Die @elem[(scheme sig) (subscript "i")] sind die zu den Sorten annehmen kann. Die @elem[(scheme sig) (subscript "i")] sind die zu den Sorten
gehörenden Signaturen. Der Name @scheme[sig] ist für die Verwendung als gehörenden Signaturen. Der Name @racket[sig] ist für die Verwendung als
Signatur. Signatur.
Aus der Datendefinition entsteht eine Signaturdefinition folgender Form: Aus der Datendefinition entsteht eine Signaturdefinition folgender Form:
@schemeblock[ @racketblock[
(define sig (define sig
(signature (signature
(mixed #,(elem (scheme sig) (subscript "1")) (mixed #,(elem (scheme sig) (subscript "1"))
@ -153,7 +153,7 @@ Wenn die Prädikate für die einzelnen Sorten @elem[(scheme pred?)
Schablone für eine Prozedur, die gemischte Daten konsumiert, die Schablone für eine Prozedur, die gemischte Daten konsumiert, die
folgende Form: folgende Form:
@schemeblock[ @racketblock[
(: proc (sig -> ...)) (: proc (sig -> ...))
(define proc (define proc
@ -172,7 +172,7 @@ Konstruktionsanleitungen der einzelnen Sorten ausgefüllt.
Eine Prozedur, die eine Liste konsumiert, hat die folgende Eine Prozedur, die eine Liste konsumiert, hat die folgende
Schablone: Schablone:
@schemeblock[ @racketblock[
(: proc ((list-of elem) -> ...)) (: proc ((list-of elem) -> ...))
(define proc (define proc
@ -184,18 +184,18 @@ Schablone:
... (proc (rest lis)) ...)))) ... (proc (rest lis)) ...))))
] ]
Dabei ist @scheme[elem] die Signatur für die Elemente der Liste. Dies Dabei ist @racket[elem] die Signatur für die Elemente der Liste. Dies
kann eine Signaturvariable (@scheme[%a], @scheme[%b], ...) sein, falls kann eine Signaturvariable (@racket[%a], @racket[%b], ...) sein, falls
die Prozedur unabhängig von der Signatur der Listenelemente ist. die Prozedur unabhängig von der Signatur der Listenelemente ist.
Füllen Sie in der Schablone zuerst den @scheme[empty?]-Zweig aus. Füllen Sie in der Schablone zuerst den @racket[empty?]-Zweig aus.
Vervollständigen Sie dann den anderen Zweig unter der Annahme, daß Vervollständigen Sie dann den anderen Zweig unter der Annahme, daß
der rekursive Aufruf @scheme[(proc (rest lis))] das gewünschte der rekursive Aufruf @racket[(proc (rest lis))] das gewünschte
Ergebnis für den Rest der Liste liefert. Ergebnis für den Rest der Liste liefert.
Beispiel: Beispiel:
@schemeblock[ @racketblock[
(: list-sum ((list-of number) -> number)) (: list-sum ((list-of number) -> number))
(define list-sum (define list-sum
@ -212,7 +212,7 @@ Beispiel:
Eine Prozedur, die natürliche Zahlen konsumiert, hat die folgende Eine Prozedur, die natürliche Zahlen konsumiert, hat die folgende
Schablone: Schablone:
@schemeblock[ @racketblock[
(: proc (natural -> ...)) (: proc (natural -> ...))
(define proc (define proc
@ -224,12 +224,12 @@ Schablone:
Füllen Sie in der Schablone zuerst den 0-Zweig aus. Vervollständigen Füllen Sie in der Schablone zuerst den 0-Zweig aus. Vervollständigen
Sie dann den anderen Zweig unter der Annahme, daß der rekursive Aufruf Sie dann den anderen Zweig unter der Annahme, daß der rekursive Aufruf
@scheme[(proc (- n 1))] das gewünschte Ergebnis für @scheme[n]-1 @racket[(proc (- n 1))] das gewünschte Ergebnis für @racket[n]-1
liefert. liefert.
Beispiel: Beispiel:
@schemeblock[ @racketblock[
(: factorial (natural -> natural)) (: factorial (natural -> natural))
(define factorial (define factorial
@ -244,7 +244,7 @@ Beispiel:
Eine Prozedur mit Akkumulator, die Listen konsumiert, hat die Eine Prozedur mit Akkumulator, die Listen konsumiert, hat die
folgende Schablone: folgende Schablone:
@schemeblock[ @racketblock[
(: proc ((list-of elem) -> ...)) (: proc ((list-of elem) -> ...))
(define proc (define proc
@ -262,17 +262,17 @@ folgende Schablone:
(... (first lis) ... acc ...)))))) (... (first lis) ... acc ...))))))
] ]
Hier ist @scheme[proc] der Name der zu definierenden Prozedur und Hier ist @racket[proc] der Name der zu definierenden Prozedur und
@scheme[proc-helper] der Name der Hilfsprozedur mit Akkumulator. Der @racket[proc-helper] der Name der Hilfsprozedur mit Akkumulator. Der
Anfangswert für den Akkumulator ist der Wert von @scheme[z]. Die Signatur @scheme[sig] Anfangswert für den Akkumulator ist der Wert von @racket[z]. Die Signatur @racket[sig]
ist die Signatur für den Akkumulator. Der ist die Signatur für den Akkumulator. Der
Ausdruck @scheme[(... (first lis) ... acc ...)] Ausdruck @racket[(... (first lis) ... acc ...)]
macht aus dem alten Zwischenergebnis @scheme[acc] das neue macht aus dem alten Zwischenergebnis @racket[acc] das neue
Zwischenergebnis. Zwischenergebnis.
Beispiel: Beispiel:
@schemeblock[ @racketblock[
(: invert ((list-of %a) -> (list-of %a))) (: invert ((list-of %a) -> (list-of %a)))
(define invert (define invert
@ -293,7 +293,7 @@ Beispiel:
Eine Prozedur mit Akkumulator, die natürliche Zahlen konsumiert, hat die Eine Prozedur mit Akkumulator, die natürliche Zahlen konsumiert, hat die
folgende Schablone: folgende Schablone:
@schemeblock[ @racketblock[
(: proc (natural -> ...)) (: proc (natural -> ...))
(define proc (define proc
@ -307,13 +307,13 @@ folgende Schablone:
(proc-helper (- n 1) (... acc ...))))) (proc-helper (- n 1) (... acc ...)))))
] ]
Dabei ist @scheme[z] das gewünschte Ergebnis für @scheme[n] = 0. Der Dabei ist @racket[z] das gewünschte Ergebnis für @racket[n] = 0. Der
Ausdruck @scheme[(... acc ...)] muß den neuen Wert für den Ausdruck @racket[(... acc ...)] muß den neuen Wert für den
Akkumulator berechnen. Akkumulator berechnen.
Beispiel: Beispiel:
@schemeblock[ @racketblock[
(: ! (natural -> natural)) (: ! (natural -> natural))
(define ! (define !
@ -332,24 +332,24 @@ Falls ein Wert Zustand enthalten soll, schreiben Sie eine
Datendefinition wie bei zusammengesetzten Daten. Datendefinition wie bei zusammengesetzten Daten.
Schreiben Sie dann eine Record-Definition mit Schreiben Sie dann eine Record-Definition mit
@scheme[define-record-procedures-2] und legen Sie dabei fest, welche @racket[define-record-procedures-2] und legen Sie dabei fest, welche
Bestandteile veränderbar sein sollen. Geben Sie Mutatoren für die Bestandteile veränderbar sein sollen. Geben Sie Mutatoren für die
betroffenen Felder an. Wenn der Selektor für das Feld @scheme[select] betroffenen Felder an. Wenn der Selektor für das Feld @racket[select]
heißt, sollte der Mutator i.d.R. @scheme[set-select!] heißen. Die Form heißt, sollte der Mutator i.d.R. @racket[set-select!] heißen. Die Form
sieht folgendermaßen aus, wobei an der Stelle @scheme[k] ein sieht folgendermaßen aus, wobei an der Stelle @racket[k] ein
veränderbares Feld steht: veränderbares Feld steht:
@schemeblock[ @racketblock[
(define-record-procedures-2 sig (define-record-procedures-2 sig
constr pred? constr pred?
(#,(elem (scheme select) (subscript "1")) ... (#,(elem (scheme s) (subscript "k")) #,(elem (scheme mutate) (subscript "k"))) ... #,(elem (scheme s) (subscript "n")))) (#,(elem (scheme select) (subscript "1")) ... (#,(elem (scheme s) (subscript "k")) #,(elem (scheme mutate) (subscript "k"))) ... #,(elem (scheme s) (subscript "n"))))
] ]
In der Schablone für Prozeduren, die den Zustand eines In der Schablone für Prozeduren, die den Zustand eines
Record-Arguments @scheme[r] ändern, benutzen Sie den dazugehörigen Mutator Record-Arguments @racket[r] ändern, benutzen Sie den dazugehörigen Mutator
@elem[(scheme mutate) (subscript "k")] Wenn @scheme[a] der Ausdruck für den neuen Wert der Komponente ist, @elem[(scheme mutate) (subscript "k")] Wenn @racket[a] der Ausdruck für den neuen Wert der Komponente ist,
sieht der Aufruf folgendermaßen aus: @scheme[(#,(elem (scheme mutate) (subscript "k")) r a)]. sieht der Aufruf folgendermaßen aus: @racket[(#,(elem (scheme mutate) (subscript "k")) r a)].
Um mehrere Komponenten in einer Prozedur zu verändern, oder um einen Um mehrere Komponenten in einer Prozedur zu verändern, oder um einen
sinnvollen Rückgabewert nach einer Mutation zu liefern, benutzen Sie sinnvollen Rückgabewert nach einer Mutation zu liefern, benutzen Sie
@scheme[begin]. @racket[begin].

View File

@ -22,21 +22,21 @@ Dieses teachpack definiert Prozeduren für lineare Algebra und 3D-Rendering:
@declare-exporting[teachpack/deinprogramm/line3d] @declare-exporting[teachpack/deinprogramm/line3d]
@defthing[render-scene (natural natural (list-of line3d) matrix4x4 -> image)]{ @defthing[render-scene (natural natural (list-of line3d) matrix4x4 -> image)]{
Der Aufruf @scheme[(render-scene width height scene camera-matrix)]erzeugt die Szene Der Aufruf @racket[(render-scene width height scene camera-matrix)]erzeugt die Szene
in ein Bild mit Breite @scheme[width] und Höhe @scheme[height]. Position, in ein Bild mit Breite @racket[width] und Höhe @racket[height]. Position,
Orientierung und Projektion werden durch die @scheme[camera-matrix] festgelegt. Orientierung und Projektion werden durch die @racket[camera-matrix] festgelegt.
} }
@defthing[create-camera-matrix (vec3 vec3 number natural natural -> matrix4x4)]{ @defthing[create-camera-matrix (vec3 vec3 number natural natural -> matrix4x4)]{
Der Aufruf @scheme[(create-camera-matrix position lookat vertical-fov width height)] Der Aufruf @racket[(create-camera-matrix position lookat vertical-fov width height)]
erzeugt eine 4x4 Matrix. Diese kodiert eine Kamera an der Position @scheme[position], die erzeugt eine 4x4 Matrix. Diese kodiert eine Kamera an der Position @racket[position], die
auf die Position @scheme[lookat] schaut. auf die Position @racket[lookat] schaut.
@scheme[vertical-fov] bezeichnet das @deftech{vertikale Feld} der Szene. @racket[vertical-fov] bezeichnet das @deftech{vertikale Feld} der Szene.
} }
Zum Beispiel: Zum Beispiel:
@schemeblock[ @racketblock[
(code:comment @#,t{scene-data (simple box example)}) (code:comment @#,t{scene-data (simple box example)})
(define box (define box
(create-box 1.0 1.0 1.0 "brown")) (create-box 1.0 1.0 1.0 "brown"))
@ -56,156 +56,156 @@ Zum Beispiel:
@section[#:tag "3Dvectors"]{3D-Vektoren} @section[#:tag "3Dvectors"]{3D-Vektoren}
@defthing[vec3 signature]{ @defthing[vec3 signature]{
Ein @deftech{3D-Vektor} (Name: @scheme[vec3]) ist ein Record, der durch den Aufruf @scheme[make-vec3] erstellt wird. Ein @deftech{3D-Vektor} (Name: @racket[vec3]) ist ein Record, der durch den Aufruf @racket[make-vec3] erstellt wird.
} }
@defthing[make-vec3 (number number number -> vec3)]{ @defthing[make-vec3 (number number number -> vec3)]{
@scheme[(make-vec3 x y z)] erstellt einen Vektor (x,y,z). @racket[(make-vec3 x y z)] erstellt einen Vektor (x,y,z).
} }
@defthing[add-vec3 (vec3 vec3 -> vec3)]{ @defthing[add-vec3 (vec3 vec3 -> vec3)]{
@scheme[(add-vec3 a b)] gibt die Summe von @scheme[a] und @scheme[b] zurück. @racket[(add-vec3 a b)] gibt die Summe von @racket[a] und @racket[b] zurück.
} }
@defthing[sub-vec3 (vec3 vec3 -> vec3)]{ @defthing[sub-vec3 (vec3 vec3 -> vec3)]{
@scheme[(sub-vec3 a b)] gibt die Differenz zwischen @scheme[a] und @scheme[b] zurück. @racket[(sub-vec3 a b)] gibt die Differenz zwischen @racket[a] und @racket[b] zurück.
} }
@defthing[mult-vec3 (vec3 number -> vec3)]{ @defthing[mult-vec3 (vec3 number -> vec3)]{
@scheme[(mult-vec3 a s)] gibt den das Produkt von @scheme[a] und @scheme[s] zurück. @racket[(mult-vec3 a s)] gibt den das Produkt von @racket[a] und @racket[s] zurück.
} }
@defthing[div-vec3 (vec3 number -> vec3)]{ @defthing[div-vec3 (vec3 number -> vec3)]{
@scheme[(div-vec3 a s)] gibt den das Produkt von @scheme[a] und dem Kehrwert von @scheme[s] zurück. @racket[(div-vec3 a s)] gibt den das Produkt von @racket[a] und dem Kehrwert von @racket[s] zurück.
} }
@defthing[dotproduct-vec3 (vec3 vec3 -> number)]{ @defthing[dotproduct-vec3 (vec3 vec3 -> number)]{
@scheme[(dotproduct-vec3 a b)] gibt das Produkt von @scheme[a] und @scheme[b] zurück. @racket[(dotproduct-vec3 a b)] gibt das Produkt von @racket[a] und @racket[b] zurück.
} }
@defthing[normQuad-vec3 (vec3 -> number)]{ @defthing[normQuad-vec3 (vec3 -> number)]{
@scheme[(normQuad-vec3 a)] gibt die quadrierte Norm/Länge |@scheme[a]|² eines Vektors @scheme[a] zurück (Quadrat der Euklidischen Norm.) @racket[(normQuad-vec3 a)] gibt die quadrierte Norm/Länge |@racket[a]|² eines Vektors @racket[a] zurück (Quadrat der Euklidischen Norm.)
} }
@defthing[norm-vec3 (vec3 -> number)]{ @defthing[norm-vec3 (vec3 -> number)]{
@scheme[(norm-vec3 a)] gibt die Norm/Länge |@scheme[a]| eines Vektors a zurück (Euklidische Norm.) @racket[(norm-vec3 a)] gibt die Norm/Länge |@racket[a]| eines Vektors a zurück (Euklidische Norm.)
} }
@defthing[normalize-vec3 (vec3 -> vec3)]{ @defthing[normalize-vec3 (vec3 -> vec3)]{
@scheme[(normalize-vec3 a)] normalisiert @scheme[a]. @racket[(normalize-vec3 a)] normalisiert @racket[a].
} }
@defthing[crossproduct-vec3 (vec3 vec3-> vec3)]{ @defthing[crossproduct-vec3 (vec3 vec3-> vec3)]{
@scheme[(crossproduct-vec3 a b)] gibt das Kreuzprodukt von @scheme[a] @racket[(crossproduct-vec3 a b)] gibt das Kreuzprodukt von @racket[a]
und @scheme[b] zurück (einen Vektor der senkrecht auf @scheme[a] und @scheme[b] steht). und @racket[b] zurück (einen Vektor der senkrecht auf @racket[a] und @racket[b] steht).
} }
@;------------------------------------------------------------------------------------- @;-------------------------------------------------------------------------------------
@section[#:tag "4Dvectors"]{4D-Vektoren} @section[#:tag "4Dvectors"]{4D-Vektoren}
@defthing[vec4 signature]{ @defthing[vec4 signature]{
Ein @deftech{4D-Vektor} @scheme[vec4] ist ein 4D-Vektor. Folgende Prozeduren werden bereitgestellt: Ein @deftech{4D-Vektor} @racket[vec4] ist ein 4D-Vektor. Folgende Prozeduren werden bereitgestellt:
} }
@defthing[make-vec4 (number number number number -> vec4)]{ @defthing[make-vec4 (number number number number -> vec4)]{
@scheme[(make-vec4 a b c d)] erzeugt einen Vektor aus @scheme[a], @scheme[b], @scheme[c] und @scheme[d]. @racket[(make-vec4 a b c d)] erzeugt einen Vektor aus @racket[a], @racket[b], @racket[c] und @racket[d].
} }
@defthing[add-vec4 (vec4 vec4 -> vec4)]{ @defthing[add-vec4 (vec4 vec4 -> vec4)]{
@scheme[(add-vec4 a b)] gibt die Summe von @scheme[a] und @scheme[b] zurück. @racket[(add-vec4 a b)] gibt die Summe von @racket[a] und @racket[b] zurück.
} }
@defthing[sub-vec4 (vec4 vec4 -> vec4)]{ @defthing[sub-vec4 (vec4 vec4 -> vec4)]{
@scheme[(sub-vec4 a b)] gibt die Differenz zwischen @scheme[a] und @scheme[b] zurück. @racket[(sub-vec4 a b)] gibt die Differenz zwischen @racket[a] und @racket[b] zurück.
} }
@defthing[mult-vec4 (vec4 number -> vec4)]{ @defthing[mult-vec4 (vec4 number -> vec4)]{
@scheme[(mult-vec4 a s)] gibt den das Produkt von @scheme[a] und @scheme[s] zurück. @racket[(mult-vec4 a s)] gibt den das Produkt von @racket[a] und @racket[s] zurück.
} }
@defthing[div-vec4 (vec4 number -> vec4)]{ @defthing[div-vec4 (vec4 number -> vec4)]{
@scheme[(div-vec4 a s)] gibt den das Produkt von @scheme[a] und dem Kehrwert von @scheme[s] zurück. @racket[(div-vec4 a s)] gibt den das Produkt von @racket[a] und dem Kehrwert von @racket[s] zurück.
} }
@defthing[dotproduct-vec4 (vec3 vec4 -> number)]{ @defthing[dotproduct-vec4 (vec3 vec4 -> number)]{
@scheme[(dotproduct-vec4 a b)] gibt die quadrierte Norm/Länge |@scheme[a]|² eines Vektors @scheme[a] zurück (Quadrat der Euklidischen Norm.) @racket[(dotproduct-vec4 a b)] gibt die quadrierte Norm/Länge |@racket[a]|² eines Vektors @racket[a] zurück (Quadrat der Euklidischen Norm.)
} }
@defthing[normQuad-vec4 (vec4 -> number)]{ @defthing[normQuad-vec4 (vec4 -> number)]{
@scheme[(normQuad-vec4 a)] gibt die quadrierte Norm/Länge |@scheme[a]|² eines Vektors @scheme[a] zurück (Quadrat der Euklidischen Norm.) @racket[(normQuad-vec4 a)] gibt die quadrierte Norm/Länge |@racket[a]|² eines Vektors @racket[a] zurück (Quadrat der Euklidischen Norm.)
} }
@defthing[norm-vec4 (vec4 -> number)]{ @defthing[norm-vec4 (vec4 -> number)]{
@scheme[(norm-vec4 a)] gibt die Norm/Länge |a| eines Vektors a zurück (Euklidische Norm) @racket[(norm-vec4 a)] gibt die Norm/Länge |a| eines Vektors a zurück (Euklidische Norm)
} }
@defthing[normalize-vec4 (vec4 -> vec4)]{ @defthing[normalize-vec4 (vec4 -> vec4)]{
@scheme[(normalize-vec4 a)] normalisiert @scheme[a]. @racket[(normalize-vec4 a)] normalisiert @racket[a].
} }
@defthing[expand-vec3 (vec3 number -> vec4)]{ @defthing[expand-vec3 (vec3 number -> vec4)]{
@scheme[(expand-vec3 a s)] gibt den 4D-Vektor mit @scheme[s] als letze Komponente zurück (erweitert @scheme[a] mit @scheme[s]). @racket[(expand-vec3 a s)] gibt den 4D-Vektor mit @racket[s] als letze Komponente zurück (erweitert @racket[a] mit @racket[s]).
} }
@;------------------------------------------------------------------------------------- @;-------------------------------------------------------------------------------------
@section[#:tag "4x4matrix"]{4x4 Matrizen} @section[#:tag "4x4matrix"]{4x4 Matrizen}
@defthing[matrix4x4 signature]{ @defthing[matrix4x4 signature]{
Eine @deftech{Matrix} @scheme[matrix4x4] ist ein Record, der durch den Aufruf @scheme[make-matrix4x4] erstellt wird. Eine @deftech{Matrix} @racket[matrix4x4] ist ein Record, der durch den Aufruf @racket[make-matrix4x4] erstellt wird.
} }
@defthing[make-matrix4x4 (vec4 vec4 vec4 vec4 -> matrix4x4)]{ @defthing[make-matrix4x4 (vec4 vec4 vec4 vec4 -> matrix4x4)]{
@scheme[(make-matrix4x4 a b c d)] erstellt eine Matrix aus @scheme[a], @scheme[b], @scheme[c] und @scheme[d]. @racket[(make-matrix4x4 a b c d)] erstellt eine Matrix aus @racket[a], @racket[b], @racket[c] und @racket[d].
} }
@defthing[create-matrix4x4 (vec3 vec3 vec3 vec3 -> matrix4x4)]{ @defthing[create-matrix4x4 (vec3 vec3 vec3 vec3 -> matrix4x4)]{
@scheme[(create-matrix4x4 a b c d)] erweitert jeden Vektor in einen 4D-Vektor und kombiniert diese zu @racket[(create-matrix4x4 a b c d)] erweitert jeden Vektor in einen 4D-Vektor und kombiniert diese zu
einer Matrix @scheme[a], @scheme[b], @scheme[c] und @scheme[d], wobei einer Matrix @racket[a], @racket[b], @racket[c] und @racket[d], wobei
@scheme[a], @scheme[b], @scheme[c] mit 0 und @scheme[d] mit 1 erweitert wird, um eine homogene Matrix zu erzeugen. @racket[a], @racket[b], @racket[c] mit 0 und @racket[d] mit 1 erweitert wird, um eine homogene Matrix zu erzeugen.
} }
@defthing[transpose-matrix4x4 (matrix4x4 -> matrix4x)]{ @defthing[transpose-matrix4x4 (matrix4x4 -> matrix4x)]{
@scheme[(transpose-matrix4x4 m)] erstellt die transponierte Matrix @scheme[m]^@scheme[T]. @racket[(transpose-matrix4x4 m)] erstellt die transponierte Matrix @racket[m]^@racket[T].
} }
@defthing[multiply-matrix-vec4 (matrix vec4 -> vec4)]{ @defthing[multiply-matrix-vec4 (matrix vec4 -> vec4)]{
@scheme[(multiply-matrix-vec4 m v)] gibt die Matrix @scheme[m]@scheme[v] zurück. Die @scheme[w]-Komponente ist nicht normalisiert. @racket[(multiply-matrix-vec4 m v)] gibt die Matrix @racket[m]@racket[v] zurück. Die @racket[w]-Komponente ist nicht normalisiert.
} }
@defthing[transform-vec3 (matrix4x4 vec3 -> vec3)]{ @defthing[transform-vec3 (matrix4x4 vec3 -> vec3)]{
@scheme[(transform-vec3 m v)] erweitert @scheme[v] mit 1, multipliziert @scheme[m] mit @scheme[v] und dividiert das Ergebnis mit @scheme[w]. @racket[(transform-vec3 m v)] erweitert @racket[v] mit 1, multipliziert @racket[m] mit @racket[v] und dividiert das Ergebnis mit @racket[w].
} }
@defthing[multiply-matrix (matrix4x4 matrix4x4 -> matrix4x4)]{ @defthing[multiply-matrix (matrix4x4 matrix4x4 -> matrix4x4)]{
@scheme[(multiply-matrix a b)] gibt die Matrix @scheme[a]*@scheme[b] zurück. @racket[(multiply-matrix a b)] gibt die Matrix @racket[a]*@racket[b] zurück.
} }
@defthing[create-translation-matrix (vec3 -> matrix4x4)]{ @defthing[create-translation-matrix (vec3 -> matrix4x4)]{
@scheme[(create-translation-matrix v)] gibt die Translations-Matrix zurück. @racket[(create-translation-matrix v)] gibt die Translations-Matrix zurück.
} }
@defthing[create-rotation-x-matrix (number -> matrix4x4)]{ @defthing[create-rotation-x-matrix (number -> matrix4x4)]{
@scheme[(create-rotation-x-matrix a)] gibt eine Rotations-Matrix zurück die um die X-Achse mit dem Winkel @scheme[a] rotiert. @racket[(create-rotation-x-matrix a)] gibt eine Rotations-Matrix zurück die um die X-Achse mit dem Winkel @racket[a] rotiert.
} }
@defthing[create-rotation-y-matrix (number -> matrix4x4)]{ @defthing[create-rotation-y-matrix (number -> matrix4x4)]{
@scheme[(create-rotation-y-matrix a)] gibt eine Rotations-Matrix zurück die um die Y-Achse mit dem Winkel @scheme[a] rotiert. @racket[(create-rotation-y-matrix a)] gibt eine Rotations-Matrix zurück die um die Y-Achse mit dem Winkel @racket[a] rotiert.
} }
@defthing[create-rotation-z-matrix (number -> matrix4x4)]{ @defthing[create-rotation-z-matrix (number -> matrix4x4)]{
@scheme[(create-rotation-z-matrix a)] gibt eine Rotations-Matrix zurück die um die Z-Achse mit dem Winkel @scheme[a] rotiert. @racket[(create-rotation-z-matrix a)] gibt eine Rotations-Matrix zurück die um die Z-Achse mit dem Winkel @racket[a] rotiert.
} }
@defthing[create-lookat-matrix (vec3 vec3 vec3 -> matrix4x4)]{ @defthing[create-lookat-matrix (vec3 vec3 vec3 -> matrix4x4)]{
@scheme[(create-lookat-matrix pos lookat up)] gibt eine Kameramatrix. Ursprungspunkt ist @scheme[pos], die Z-Achse zeigt auf @scheme[lookat]. @racket[(create-lookat-matrix pos lookat up)] gibt eine Kameramatrix. Ursprungspunkt ist @racket[pos], die Z-Achse zeigt auf @racket[lookat].
} }
@defthing[create-projection-matrix (number -> matrix4x4)]{ @defthing[create-projection-matrix (number -> matrix4x4)]{
@scheme[(create-projection-matrix vertical-fov/2)] erzeugt eine Projektions-Matrix. @scheme[vertical-fov]/2 gibt den vertikalen Winkel der Ansicht dividiert durch 2 an. @racket[(create-projection-matrix vertical-fov/2)] erzeugt eine Projektions-Matrix. @racket[vertical-fov]/2 gibt den vertikalen Winkel der Ansicht dividiert durch 2 an.
} }
@defthing[create-viewport-matrix (natural natural -> matrix4x4)]{ @defthing[create-viewport-matrix (natural natural -> matrix4x4)]{
@scheme[(create-viewport-matrix width height)] gibt einen Ausschnitt an. @racket[(create-viewport-matrix width height)] gibt einen Ausschnitt an.
} }
@;------------------------------------------------------------------------------------- @;-------------------------------------------------------------------------------------
@ -213,12 +213,12 @@ und @scheme[b] zurück (einen Vektor der senkrecht auf @scheme[a] und @scheme[b]
@defthing[line3d signature]{ @defthing[line3d signature]{
Eine @deftech{3d-Linie} @scheme[line3d] ist ein Record, der durch den Aufruf @scheme[make-line3d] erstellt wird und eine farbige Linie zwischen zwei Punkten Eine @deftech{3d-Linie} @racket[line3d] ist ein Record, der durch den Aufruf @racket[make-line3d] erstellt wird und eine farbige Linie zwischen zwei Punkten
im 3-dimensionalen Raum darstellt. im 3-dimensionalen Raum darstellt.
} }
@defthing[make-line3d (vec3 vec3 color -> line3d)]{ @defthing[make-line3d (vec3 vec3 color -> line3d)]{
@scheme[(make-line3d a b col)] erstellt eine 3D-Linie zwischen Punkt @scheme[a] und Punkt @scheme[b] mit der Farbe @scheme[col]. @racket[(make-line3d a b col)] erstellt eine 3D-Linie zwischen Punkt @racket[a] und Punkt @racket[b] mit der Farbe @racket[col].
} }
@defthing[line3d-a (line3d -> vec3)]{ @defthing[line3d-a (line3d -> vec3)]{
@ -231,10 +231,10 @@ und @scheme[b] zurück (einen Vektor der senkrecht auf @scheme[a] und @scheme[b]
extrahiert die Farbe einer 3D-Linie.} extrahiert die Farbe einer 3D-Linie.}
@defthing[create-box (number number number color -> (list-of line3d))]{ @defthing[create-box (number number number color -> (list-of line3d))]{
@scheme[(create-box width height depth color)] erstellt eine Box am Punkt (0,0,0) in den angebenen Ausmaßen. @racket[(create-box width height depth color)] erstellt eine Box am Punkt (0,0,0) in den angebenen Ausmaßen.
} }
@defthing[transform-primitive-list ((list-of line3d) matrix4x4 -> (list-of line3d))]{ @defthing[transform-primitive-list ((list-of line3d) matrix4x4 -> (list-of line3d))]{
@scheme[(transform-primitive-list scene transformationr)] wendet @scheme[transformation] auf alle Punkte der Linien in @scheme[scene] an und gibt @racket[(transform-primitive-list scene transformationr)] wendet @racket[transformation] auf alle Punkte der Linien in @racket[scene] an und gibt
diese zurück. diese zurück.
} }

View File

@ -19,12 +19,12 @@ Rechner.
@defthing[play-sound-file (string -> unspecific)]{ @defthing[play-sound-file (string -> unspecific)]{
Der Aufruf Der Aufruf
@scheme[(play-sound-file f)] spielt die Audio-Datei mit dem Namen @racket[(play-sound-file f)] spielt die Audio-Datei mit dem Namen
@scheme[f] ab.} @racket[f] ab.}
@defthing[background-play-sound-file (string -> unspecific)]{ @defthing[background-play-sound-file (string -> unspecific)]{
Der Aufruf Der Aufruf
@scheme[(background-play-sound-file f)] spielt die Audio-Datei mit dem Namen @racket[(background-play-sound-file f)] spielt die Audio-Datei mit dem Namen
@scheme[f] im Hintergrund ab, also ohne dass das Scheme-Programm anhält.} @racket[f] im Hintergrund ab, also ohne dass das Scheme-Programm anhält.}

View File

@ -5,16 +5,16 @@
(for-label deinprogramm/DMdA-beginner)) (for-label deinprogramm/DMdA-beginner))
(provide prim-nonterms (provide prim-nonterms
schemegrammar*-DMdA) racketgrammar*-DMdA)
(define ex-str "Dies ist eine Zeichenkette, die \" enthält.") (define ex-str "Dies ist eine Zeichenkette, die \" enthält.")
(define-syntax-rule (schemegrammar*-DMdA (define-syntax-rule (racketgrammar*-DMdA
#:literals (lit ...) #:literals (lit ...)
(def-rule ...) (def-rule ...)
(prod ...) (prod ...)
(expr-rule ...)) (expr-rule ...))
(schemegrammar* (racketgrammar*
#:literals (define define-record-procedures lambda cond if and or let letrec let* begin #:literals (define define-record-procedures lambda cond if and or let letrec let* begin
#;require lib planet #;require lib planet
check-expect check-within check-error check-expect check-within check-error
@ -80,7 +80,7 @@
(make-splice (make-splice
(list (list
@t{Ein @scheme[_id] ist eine Folge von Zeichen, die weder Leerzeichen @t{Ein @racket[_id] ist eine Folge von Zeichen, die weder Leerzeichen
noch eins der folgenden Zeichen enthält:} noch eins der folgenden Zeichen enthält:}
@t{@hspace[2] @litchar{"} @litchar{,} @litchar{'} @litchar{`} @t{@hspace[2] @litchar{"} @litchar{,} @litchar{'} @litchar{`}
@ -88,10 +88,10 @@ noch eins der folgenden Zeichen enthält:}
@litchar["{"] @litchar["}"] @litchar{|} @litchar{;} @litchar["{"] @litchar["}"] @litchar{|} @litchar{;}
@litchar{#}} @litchar{#}}
@t{Ein @scheme[_number] ist eine Zahl wie z.B. @scheme[123], @scheme[3/2] oder @t{Ein @racket[_number] ist eine Zahl wie z.B. @racket[123], @racket[3/2] oder
@scheme[5.5].} @racket[5.5].}
@t{Ein @scheme[_string] ist eine Zeichenkette, und durch ein Paar von @litchar{"} umschlossen. @t{Ein @racket[_string] ist eine Zeichenkette, und durch ein Paar von @litchar{"} umschlossen.
So sind z.B. @scheme["abcdef"], So sind z.B. @racket["abcdef"],
@scheme["This is a string"] und @scheme[#,ex-str] Zeichenketten.} @racket["This is a string"] und @racket[#,ex-str] Zeichenketten.}
))) )))

View File

@ -20,9 +20,9 @@ Zeichnen wird dabei durch das Bewegen einer virtuellen Schildkröte
Befehle bewegt werden: Befehle bewegt werden:
@itemize[ @itemize[
@item{@scheme[(move n)] Bewegt die Schildkröte um @scheme[n] Pixel ohne zu zeichnen.} @item{@racket[(move n)] Bewegt die Schildkröte um @racket[n] Pixel ohne zu zeichnen.}
@item{@scheme[(draw n)] Bewegt die Schildkröte um @scheme[n] Pixel und zeichnet dabei.} @item{@racket[(draw n)] Bewegt die Schildkröte um @racket[n] Pixel und zeichnet dabei.}
@item{@scheme[(turn n)] Dreht die Schildkröte um n Grad im Uhrzeigersinn.} @item{@racket[(turn n)] Dreht die Schildkröte um n Grad im Uhrzeigersinn.}
] ]
Wir stellen jetzt ein Teachpack für DrRacket vor, mit dessen Hilfe Wir stellen jetzt ein Teachpack für DrRacket vor, mit dessen Hilfe
@ -32,9 +32,9 @@ solche Turtle-Grafiken erstellt werden können.
Unser Ziel ist es, in diesem Tutorial ein Quadrat mithilfe der Unser Ziel ist es, in diesem Tutorial ein Quadrat mithilfe der
Prozeduren des Teachpacks zu zeichnen. Aus diesem Grund müssen wir Prozeduren des Teachpacks zu zeichnen. Aus diesem Grund müssen wir
zunächst mit der Prozedur @scheme[draw] eine Linie nach rechts malen. Die zunächst mit der Prozedur @racket[draw] eine Linie nach rechts malen. Die
initiale Ausgansposition der Turtle ist in der Bildmitte mit Blick initiale Ausgansposition der Turtle ist in der Bildmitte mit Blick
nach rechts. Mit @scheme[(draw 20)] bewegen wir die Turtle dann 20 Pixel nach nach rechts. Mit @racket[(draw 20)] bewegen wir die Turtle dann 20 Pixel nach
rechts und zeichnen dabei. Um das resultierende Bild zu sehen ist, rechts und zeichnen dabei. Um das resultierende Bild zu sehen ist,
müssen wir die Turtle mittels der Prozedur run laufen lassen. Die müssen wir die Turtle mittels der Prozedur run laufen lassen. Die
restlichen Parameter für run sind die Höhe und die Breite des Bildes restlichen Parameter für run sind die Höhe und die Breite des Bildes
@ -42,7 +42,7 @@ sowie die Farbe, in der gezeichnet werden soll. Geben Sie also
folgenden Befehl in die REPL ein, um Ihre erste Turtle-Grafik zu folgenden Befehl in die REPL ein, um Ihre erste Turtle-Grafik zu
erstellen: erstellen:
@schemeblock[ @racketblock[
(run (draw 20) 100 100 "red") (run (draw 20) 100 100 "red")
] ]
@ -53,14 +53,14 @@ Sie erhalten dann eine Ausgabe wie die folgende:
Nun vervollständigen wir die Linie zu einem rechten Winkel: wir drehen Nun vervollständigen wir die Linie zu einem rechten Winkel: wir drehen
die Turtle um 90° nach rechts und zeichnen dann eine Line der Länge 20 die Turtle um 90° nach rechts und zeichnen dann eine Line der Länge 20
Pixel nach unten. Zum Drehen einer Turtle verwenden wir die Prozedur Pixel nach unten. Zum Drehen einer Turtle verwenden wir die Prozedur
@scheme[turn]. @racket[turn].
Da wir ein Quadrat aus zwei rechten Winkeln zusammensetzen können, Da wir ein Quadrat aus zwei rechten Winkeln zusammensetzen können,
abstrahieren wir über das Zeichnen des rechten Winkels. Dazu schreiben abstrahieren wir über das Zeichnen des rechten Winkels. Dazu schreiben
wir eine Prozedur @scheme[right-angle] die als Parameter eine Turtle wir eine Prozedur @racket[right-angle] die als Parameter eine Turtle
erhält: erhält:
@schemeblock[ @racketblock[
(: right-angle (turtle -> turtle)) (: right-angle (turtle -> turtle))
(define right-angle (define right-angle
(lambda (t1) (lambda (t1)
@ -78,7 +78,7 @@ Um das Quadrat komplett zu zeichnen, sollen nun zwei rechte Winkel
verwendet werden. Wir zeichnen also einen rechten Winkel, drehen uns verwendet werden. Wir zeichnen also einen rechten Winkel, drehen uns
um 90° nach rechts, und zeichnen einen zweiten rechten Winkel. um 90° nach rechts, und zeichnen einen zweiten rechten Winkel.
@schemeblock[ @racketblock[
(: square (turtle -> turtle)) (: square (turtle -> turtle))
(define square (define square
(lambda (t1) (lambda (t1)
@ -95,27 +95,27 @@ So sieht das Ergebnis aus:
@subsection{Verbesserungen} @subsection{Verbesserungen}
An dem Beispiel ist leicht zu sehen, dass es zum Zeichnen mit Hilfe An dem Beispiel ist leicht zu sehen, dass es zum Zeichnen mit Hilfe
von Turtle-Grafik oft erforderlich ist, Zwischenwerte wie @scheme[t1], von Turtle-Grafik oft erforderlich ist, Zwischenwerte wie @racket[t1],
@scheme[t2] etc., an die nächste Prozedur weiterzureichen, die Werte @racket[t2] etc., an die nächste Prozedur weiterzureichen, die Werte
ansonsten aber nicht weiterverwendet werden. Beispielsweise werden in ansonsten aber nicht weiterverwendet werden. Beispielsweise werden in
der obigen Definition von square die Variablen @scheme[t1], ..., der obigen Definition von square die Variablen @racket[t1], ...,
@scheme[t4] nur gebraucht, um die Prozeduren @scheme[right-angle], @racket[t4] nur gebraucht, um die Prozeduren @racket[right-angle],
@scheme[(turn -90)] und @scheme[right-angle] hintereinander @racket[(turn -90)] und @racket[right-angle] hintereinander
auszuführen. auszuführen.
Um solche Fälle einfach programmieren zu können, enthält das Um solche Fälle einfach programmieren zu können, enthält das
Turtle-Teachpack die Prozedur @scheme[sequence]. Damit können wir eine Turtle-Teachpack die Prozedur @racket[sequence]. Damit können wir eine
zu @scheme[right-angle] äquivalente Version wesentlicher einfacher zu @racket[right-angle] äquivalente Version wesentlicher einfacher
aufschreiben: aufschreiben:
@schemeblock[ @racketblock[
(define right-angle2 (define right-angle2
(sequence (draw 20) (turn -90) (draw 20))) (sequence (draw 20) (turn -90) (draw 20)))
] ]
Ebenso wie @scheme[right-angle] können wir square leichter schreiben als: Ebenso wie @racket[right-angle] können wir square leichter schreiben als:
@schemeblock[ @racketblock[
(define square2 (define square2
(sequence right-angle (turn -90) right-angle)) (sequence right-angle (turn -90) right-angle))
] ]
@ -135,7 +135,7 @@ so ändert dies die Farbe mit der gezeichnet wird.
Folgender Code Folgender Code
@schemeblock[ @racketblock[
(define square3 (define square3
(sequence right-angle (turn -90) (set-color "blue") right-angle)) (sequence right-angle (turn -90) (set-color "blue") right-angle))
] ]
@ -173,6 +173,6 @@ der gezeichnet wird.
@defthing[sequence ((turtle -> turtle) ... -> (turtle -> turtle))]{ @defthing[sequence ((turtle -> turtle) ... -> (turtle -> turtle))]{
Diese Prozedur nimmt eine beliebige Anzahl von Turtle-Veränderungen Diese Prozedur nimmt eine beliebige Anzahl von Turtle-Veränderungen
(d.h. Prozeduren mit Signatur @scheme[turtle -> turtle]) und erstellt (d.h. Prozeduren mit Signatur @racket[turtle -> turtle]) und erstellt
eine neue Prozedur, die die Veränderungen der Reihe nach von links eine neue Prozedur, die die Veränderungen der Reihe nach von links
nach rechts abarbeitet.} nach rechts abarbeitet.}

View File

@ -19,60 +19,60 @@ Es enthält alle Prozeduren aus dem
@declare-exporting[teachpack/deinprogramm/world #:use-sources (deinprogramm/world)] @declare-exporting[teachpack/deinprogramm/world #:use-sources (deinprogramm/world)]
@defthing[world signature]{ @defthing[world signature]{
Eine @deftech{Welt} (Name: @scheme[world]) ist die Repräsentation des Zustands, Eine @deftech{Welt} (Name: @racket[world]) ist die Repräsentation des Zustands,
der durch die Animation abgebildet wird. der durch die Animation abgebildet wird.
} }
@defthing[mouse-event-kind signature]{ @defthing[mouse-event-kind signature]{
@scheme[(one-of "enter" "leave" "motion" "left-down" "left-up" "middle-down" "middle-up" "right-down" "right-up")] @racket[(one-of "enter" "leave" "motion" "left-down" "left-up" "middle-down" "middle-up" "right-down" "right-up")]
Eine @deftech{Mausereignis-Art} (Name: @scheme[mouse-event-kind]) Eine @deftech{Mausereignis-Art} (Name: @racket[mouse-event-kind])
bezeichnet die Art eines Maus-Ereignisses: bezeichnet die Art eines Maus-Ereignisses:
@scheme["enter"] bedeutet, daß der Mauszeiger gerade @racket["enter"] bedeutet, daß der Mauszeiger gerade
in das Fenster hinein bewegt wurde. @scheme["leave"] bedeutet, daß der in das Fenster hinein bewegt wurde. @racket["leave"] bedeutet, daß der
Mauszeiger gerade aus dem Fenster heraus bewegt wurde. Mauszeiger gerade aus dem Fenster heraus bewegt wurde.
@scheme["motion"] bedeutet, daß der Mauszeiger innerhalb des @racket["motion"] bedeutet, daß der Mauszeiger innerhalb des
Fensters bewegt wurde. Die anderen Zeichenketten bedeuten, daß der Fensters bewegt wurde. Die anderen Zeichenketten bedeuten, daß der
entsprechende Mausknopf gedrückt oder losgelassen wurde.} entsprechende Mausknopf gedrückt oder losgelassen wurde.}
@defthing[big-bang (natural natural number world -> (one-of #t))]{ @defthing[big-bang (natural natural number world -> (one-of #t))]{
Der Aufruf @scheme[(big-bang w h n w)] Der Aufruf @racket[(big-bang w h n w)]
erzeugt eine Leinwand mit Breite @scheme[w] und Höhe erzeugt eine Leinwand mit Breite @racket[w] und Höhe
@scheme[h], startet die Uhr, die alle @scheme[n] Sekunden @racket[h], startet die Uhr, die alle @racket[n] Sekunden
tickt, und macht @scheme[w] zur ersten Welt.} tickt, und macht @racket[w] zur ersten Welt.}
@defthing[on-tick-event ((world -> world) -> (one-of #t))]{ @defthing[on-tick-event ((world -> world) -> (one-of #t))]{
Der Aufruf @scheme[(on-tick-event tock)] Der Aufruf @racket[(on-tick-event tock)]
meldet @scheme[tock] meldet @racket[tock]
als Prozedur an, die bei jedem Uhren-Tick aufgerufen wird, um aus als Prozedur an, die bei jedem Uhren-Tick aufgerufen wird, um aus
der alten Welt eine neue zu machen.} der alten Welt eine neue zu machen.}
@defthing[on-key-event ((world string -> world) -> (one-of #t))]{ @defthing[on-key-event ((world string -> world) -> (one-of #t))]{
Der Aufruf @scheme[(on-key-event change)] Der Aufruf @racket[(on-key-event change)]
meldet @scheme[change] meldet @racket[change]
als Prozedur an, die bei jedem Tastendruck aufgerufen wird, um aus als Prozedur an, die bei jedem Tastendruck aufgerufen wird, um aus
der alten Welt eine neue zu machen. Dabei wird als Argument eine der alten Welt eine neue zu machen. Dabei wird als Argument eine
Zeichenkette übergeben, welche die Taste darstellt, also Zeichenkette übergeben, welche die Taste darstellt, also
@scheme["a"] für die A-Taste etc., sowie @scheme["up"], @racket["a"] für die A-Taste etc., sowie @racket["up"],
@scheme["down"], @scheme["left"], und @scheme["right"] @racket["down"], @racket["left"], und @racket["right"]
für die entsprechenden Pfeiltasten und @scheme["wheel-up"] für die für die entsprechenden Pfeiltasten und @racket["wheel-up"] für die
Bewegung des Mausrads nach oben und @scheme["wheel-down"] für die Bewegung des Mausrads nach oben und @racket["wheel-down"] für die
Bewegung des Mausrads nach unten.} Bewegung des Mausrads nach unten.}
@defthing[on-mouse-event ((world natural natural mouse-event-kind -> world) -> (one-of #t))]{ @defthing[on-mouse-event ((world natural natural mouse-event-kind -> world) -> (one-of #t))]{
Der Aufruf @scheme[(on-mouse-event change)] Der Aufruf @racket[(on-mouse-event change)]
meldet @scheme[change] meldet @racket[change]
als Prozedur an, die bei jedem Mausereignis aufgerufen wird, um aus als Prozedur an, die bei jedem Mausereignis aufgerufen wird, um aus
der alten Welt eine neue zu machen. Die @scheme[change]-Prozedur der alten Welt eine neue zu machen. Die @racket[change]-Prozedur
wird als @scheme[(change w x y k)] aufgerufen. Dabei ist @scheme[w] wird als @racket[(change w x y k)] aufgerufen. Dabei ist @racket[w]
die alte Welt, @scheme[x] und @scheme[y] die Koordinaten des die alte Welt, @racket[x] und @racket[y] die Koordinaten des
Mauszeigers, und @scheme[k] die Art des Mausereignisses.} Mauszeigers, und @racket[k] die Art des Mausereignisses.}
@defthing[on-redraw ((world -> image) -> (one-of #t))]{ @defthing[on-redraw ((world -> image) -> (one-of #t))]{
Der Aufruf @scheme[(world->image world->image)] Der Aufruf @racket[(world->image world->image)]
meldet die meldet die
Prozedur @scheme[world->image] an, die aus einer Welt Prozedur @racket[world->image] an, die aus einer Welt
ein Bild macht, das auf der Leinwand dargestellt wird.} ein Bild macht, das auf der Leinwand dargestellt wird.}
@defthing[end-of-time (string -> world)]{ @defthing[end-of-time (string -> world)]{

View File

@ -88,5 +88,5 @@
#`(provide/doc #`(provide/doc
(thing-doc id (thing-doc id
contract? contract?
((reconstitute (schemeblock #,ctc) provide?))))) ((reconstitute (racketblock #,ctc) provide?)))))
'()))))])) '()))))]))

View File

@ -96,7 +96,7 @@ all of the names in the tools library, for use defining keybindings
See @racket[read-language] for more details on how language's specify how to opt out. See @racket[read-language] for more details on how language's specify how to opt out.
DrRacket will invoke the @tt{get-info} proc from @racket[read-language] with DrRacket will invoke the @tt{get-info} proc from @racket[read-language] with
@indexed-scheme['drscheme:opt-out-toolbar-buttons]. If the result is a list of symbols, the @indexed-racket['drscheme:opt-out-toolbar-buttons]. If the result is a list of symbols, the
listed symbols are opted out. If the result is @racket[#f], all buttons are opted listed symbols are opted out. If the result is @racket[#f], all buttons are opted
out. The default is the empty list, meaning that all opt-out buttons appear. out. The default is the empty list, meaning that all opt-out buttons appear.
}) })
@ -425,7 +425,7 @@ all of the names in the tools library, for use defining keybindings
It looks for both stack trace information in the continuation It looks for both stack trace information in the continuation
marks both via the marks both via the
@schememodname[errortrace/errortrace-key] @racketmodname[errortrace/errortrace-key]
module and via module and via
@racket[continuation-mark-set->context]. @racket[continuation-mark-set->context].
@ -1139,9 +1139,8 @@ all of the names in the tools library, for use defining keybindings
is initialized to. is initialized to.
If unsure of a default, the currently set language If unsure of a default, the currently set language
in the user's preferences can be obtained via: in the user's preferences can be obtained via:
@schemeblock[ @racketblock[
(preferences:get (drracket:language-configuration:get-settings-preferences-symbol)) (preferences:get (drracket:language-configuration:get-settings-preferences-symbol))]
]
The @racket[parent] argument is used as the parent The @racket[parent] argument is used as the parent
to the dialog. to the dialog.

View File

@ -32,9 +32,9 @@ platform-specific C compiler and linker.
any/c]{ any/c]{
Compiles the given input file (C source) to the given output file (a Compiles the given input file (C source) to the given output file (a
compiled-object file). The @scheme[quiet?] argument indicates whether compiled-object file). The @racket[quiet?] argument indicates whether
command should be echoed to the current output port. The command should be echoed to the current output port. The
@scheme[include-dirs] argument is a list of directories to search for @racket[include-dirs] argument is a list of directories to search for
include files; the Racket installation's @filepath{include} include files; the Racket installation's @filepath{include}
directories are added automatically.} directories are added automatically.}
@ -53,7 +53,7 @@ The default is set by searching for an executable using the
defined (and the latter takes precedence). On Windows, the search defined (and the latter takes precedence). On Windows, the search
looks for @filepath{cl.exe}, then @filepath{gcc.exe}, then looks for @filepath{cl.exe}, then @filepath{gcc.exe}, then
@filepath{bcc32.exe} (Borland). On Unix, it looks for @filepath{bcc32.exe} (Borland). On Unix, it looks for
@filepath{gcc}, then @filepath{cc}. A @scheme[#f] value indicates that @filepath{gcc}, then @filepath{cc}. A @racket[#f] value indicates that
no compiler could be found.} no compiler could be found.}
@defparam[current-extension-compiler-flags @defparam[current-extension-compiler-flags
@ -62,14 +62,14 @@ no compiler could be found.}
(-> (or/c null? (listof string?)))))]{ (-> (or/c null? (listof string?)))))]{
A parameter that determines strings passed to the compiler as flags. A parameter that determines strings passed to the compiler as flags.
See also @scheme[expand-for-compile-variant]. See also @racket[expand-for-compile-variant].
On Windows, the default is @scheme[(list "/c" "/O2" "/MT" On Windows, the default is @racket[(list "/c" "/O2" "/MT"
_3m-flag-thunk)] for @filepath{cl.exe}, or @scheme[(list "-c" "-O2" _3m-flag-thunk)] for @filepath{cl.exe}, or @racket[(list "-c" "-O2"
"-fPIC" _3m-flag-thunk)] for @filepath{gcc.exe} and "-fPIC" _3m-flag-thunk)] for @filepath{gcc.exe} and
@filepath{bcc32.exe}, where @scheme[_3m-flag-thunk] returns @filepath{bcc32.exe}, where @racket[_3m-flag-thunk] returns
@scheme[(list "-DMZ_PRECISE_GC")] for the 3m variant and null for the @racket[(list "-DMZ_PRECISE_GC")] for the 3m variant and null for the
CGC variant. On Unix, the default is usually @scheme[(list "-c" CGC variant. On Unix, the default is usually @racket[(list "-c"
"-O2" "-fPIC" _3m-flag-thunk)]. If the @envvar{CFLAGS} or "-O2" "-fPIC" _3m-flag-thunk)]. If the @envvar{CFLAGS} or
@envvar{MZSCHEME_DYNEXT_COMPILER_FLAGS} environment variable is @envvar{MZSCHEME_DYNEXT_COMPILER_FLAGS} environment variable is
defined (the latter takes precedence), then its value is parsed as a defined (the latter takes precedence), then its value is parsed as a
@ -84,10 +84,10 @@ A parameter the processes include-path inputs to the compiler; the
parameter values takes an include directory path and returns a list of parameter values takes an include directory path and returns a list of
strings for the command line. strings for the command line.
On Windows, the default converts @scheme["dir"] to @scheme[(list On Windows, the default converts @racket["dir"] to @racket[(list
"/Idir")] for @filepath{cl.exe}, @scheme[(list "-Idir")] for "/Idir")] for @filepath{cl.exe}, @racket[(list "-Idir")] for
@filepath{gcc.exe} and @filepath{bcc32.exe}. On Unix, the default @filepath{gcc.exe} and @filepath{bcc32.exe}. On Unix, the default
converts @scheme["dir"] to @scheme[(list "-Idir")]. If the converts @racket["dir"] to @racket[(list "-Idir")]. If the
@envvar{CFLAGS} environment variable is defined, then its value is @envvar{CFLAGS} environment variable is defined, then its value is
parsed as a list of flags that is appended before the defaults.} parsed as a list of flags that is appended before the defaults.}
@ -98,7 +98,7 @@ parsed as a list of flags that is appended before the defaults.}
A parameter that processes inputs to the compiler; the parameter's A parameter that processes inputs to the compiler; the parameter's
values takes an input file path and returns a list of strings for the values takes an input file path and returns a list of strings for the
command line. The default is @scheme[list].} command line. The default is @racket[list].}
@defparam[current-make-compile-output-strings @defparam[current-make-compile-output-strings
@ -109,10 +109,10 @@ A parameter that processes outputs specified for the compiler; the
parameter's value takes an output file path and returns a list of parameter's value takes an output file path and returns a list of
strings for the command line. strings for the command line.
On Windows, the default converts @scheme["file"] to @scheme[(list On Windows, the default converts @racket["file"] to @racket[(list
"/Fofile")] for @filepath{cl.exe}, or to @scheme[(list "-o" "file")] "/Fofile")] for @filepath{cl.exe}, or to @racket[(list "-o" "file")]
for @filepath{gcc.exe} and @filepath{bcc32.exe}. On Unix, the for @filepath{gcc.exe} and @filepath{bcc32.exe}. On Unix, the
default converts @scheme["file"] to @scheme[(list "-o" "file")].} default converts @racket["file"] to @racket[(list "-o" "file")].}
@defparam[current-extension-preprocess-flags @defparam[current-extension-preprocess-flags
@ -121,11 +121,11 @@ default converts @scheme["file"] to @scheme[(list "-o" "file")].}
A parameters that specifies flags to the compiler preprocessor, A parameters that specifies flags to the compiler preprocessor,
instead of to the compiler proper; use these flags for preprocessing instead of to the compiler proper; use these flags for preprocessing
instead of @scheme[current-extension-compiler-flags]. instead of @racket[current-extension-compiler-flags].
The defaults are similar to @scheme[current-extension-compiler-flags], The defaults are similar to @racket[current-extension-compiler-flags],
but with @scheme["/E"] (Windows @filepath{cl.exe}) or @scheme["-E"] but with @racket["/E"] (Windows @filepath{cl.exe}) or @racket["-E"]
and without non-@scheme["-D"] flags.} and without non-@racket["-D"] flags.}
@defparam[compile-variant @defparam[compile-variant
@ -133,7 +133,7 @@ and without non-@scheme["-D"] flags.}
(one-of/c 'normal 'cgc '3m)]{ (one-of/c 'normal 'cgc '3m)]{
A parameter that indicates the target for compilation, where A parameter that indicates the target for compilation, where
@scheme['normal] is an alias for the result of @scheme[(system-type @racket['normal] is an alias for the result of @racket[(system-type
'gc)]} 'gc)]}
@ -146,16 +146,16 @@ particular known compiler. The acceptable names are
platforms-specific: platforms-specific:
@itemize[ @itemize[
@item{Unix: @scheme['cc] or @scheme['gcc]} @item{Unix: @racket['cc] or @racket['gcc]}
@item{Windows: @scheme['gcc], @scheme['msvc], or @scheme['borland]} @item{Windows: @racket['gcc], @racket['msvc], or @racket['borland]}
@item{MacOS: @scheme['cw]} @item{MacOS: @racket['cw]}
]} ]}
@defproc[(get-standard-compilers) (listof symbol?)]{ @defproc[(get-standard-compilers) (listof symbol?)]{
Returns a list of standard compiler names for the current platform. See Returns a list of standard compiler names for the current platform. See
@scheme[use-standard-compiler].} @racket[use-standard-compiler].}
@defproc[(expand-for-compile-variant (l (listof (or/c path-string? (-> (listof string?)))))) any]{ @defproc[(expand-for-compile-variant (l (listof (or/c path-string? (-> (listof string?)))))) any]{
@ -172,7 +172,7 @@ depending on the current compile variant.}
@defsignature[dynext:compile^ ()] @defsignature[dynext:compile^ ()]
Includes everything exported by the @schememodname[dynext/compile] module. Includes everything exported by the @racketmodname[dynext/compile] module.
@subsection[#:tag "compile-unit"]{Unit} @subsection[#:tag "compile-unit"]{Unit}
@ -180,7 +180,7 @@ Includes everything exported by the @schememodname[dynext/compile] module.
@defthing[dynext:compile@ unit?]{ @defthing[dynext:compile@ unit?]{
Imports nothing, exports @scheme[dynext:compile^].} Imports nothing, exports @racket[dynext:compile^].}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -191,11 +191,11 @@ Imports nothing, exports @scheme[dynext:compile^].}
@defproc[(link-extension (quiet? any/c) (input-files (listof path-string?)) (output-file path-string?)) any]{ @defproc[(link-extension (quiet? any/c) (input-files (listof path-string?)) (output-file path-string?)) any]{
Links object files to create an extension (normally of a form that can Links object files to create an extension (normally of a form that can
be loaded with @scheme[load-extension]). be loaded with @racket[load-extension]).
The @scheme[quiet?] argument indicates whether command should be The @racket[quiet?] argument indicates whether command should be
echoed to the current output port. The @scheme[input-files] argument echoed to the current output port. The @racket[input-files] argument
is list of compiled object filenames, and @scheme[output-file] is the is list of compiled object filenames, and @racket[output-file] is the
destination extension filename.} destination extension filename.}
@ -214,7 +214,7 @@ The default is set by searching for an executable using the
@filepath{cl.exe}, then @filepath{ld.exe} (gcc), then @filepath{cl.exe}, then @filepath{ld.exe} (gcc), then
@filepath{ilink32.exe} (Borland). On Cygwin, Solaris, FreeBSD 2.x, @filepath{ilink32.exe} (Borland). On Cygwin, Solaris, FreeBSD 2.x,
or HP/UX, it looks for @filepath{ld}. On other Unix variants, it or HP/UX, it looks for @filepath{ld}. On other Unix variants, it
looks for @filepath{cc}. @scheme[#f] indicates that no linker could be looks for @filepath{cc}. @racket[#f] indicates that no linker could be
found.} found.}
@defparam[current-extension-linker-flags @defparam[current-extension-linker-flags
@ -222,10 +222,10 @@ found.}
(listof (or/c path-string? (-> (listof string?))))]{ (listof (or/c path-string? (-> (listof string?))))]{
A parameter that determines flags provided to the linker. See also A parameter that determines flags provided to the linker. See also
@scheme[expand-for-link-variant]. @racket[expand-for-link-variant].
On Windows, default is @scheme[(list "/LD")] for @filepath{cl.exe}, On Windows, default is @racket[(list "/LD")] for @filepath{cl.exe},
@scheme[(list "--dll")] for @filepath{ld.exe}, and @scheme[(list @racket[(list "--dll")] for @filepath{ld.exe}, and @racket[(list
"/Tpd" "/c")] for @filepath{ilink32.exe}. On Unix, the default "/Tpd" "/c")] for @filepath{ilink32.exe}. On Unix, the default
varies greatly among platforms. If the @envvar{LDFLAGS} or varies greatly among platforms. If the @envvar{LDFLAGS} or
@envvar{MZSCHEME_DYNEXT_LINKER_FLAGS} (the latter takes precedence) @envvar{MZSCHEME_DYNEXT_LINKER_FLAGS} (the latter takes precedence)
@ -238,7 +238,7 @@ strings that is appended before the defaults.}
A parameter that processes linker input arguments; the parameter value A parameter that processes linker input arguments; the parameter value
takes an input file path and returns a list of strings for the command takes an input file path and returns a list of strings for the command
line. The default is @scheme[list].} line. The default is @racket[list].}
@defparam[current-make-link-output-strings @defparam[current-make-link-output-strings
proc proc
@ -248,28 +248,28 @@ A parameter that processes linker output arguments; the parameter
value takes an output file path and returns a list of strings for the value takes an output file path and returns a list of strings for the
command line. command line.
On Windows, the default converts @scheme["file"] to @scheme[(list On Windows, the default converts @racket["file"] to @racket[(list
"/Fefile")] for @filepath{cl.exe}, something like @scheme[(list "-e" "/Fefile")] for @filepath{cl.exe}, something like @racket[(list "-e"
"_dll_entry@12" "-o" "file")] for @filepath{ld.exe}, and something "_dll_entry@12" "-o" "file")] for @filepath{ld.exe}, and something
complex for @filepath{ilink32.exe}. On Unix, the default converts complex for @filepath{ilink32.exe}. On Unix, the default converts
@scheme["file"] to @scheme[(list "-o" "file")].} @racket["file"] to @racket[(list "-o" "file")].}
@defparam[current-standard-link-libraries @defparam[current-standard-link-libraries
libs libs
(listof (or/c path-string? (-> (listof string?))))]{ (listof (or/c path-string? (-> (listof string?))))]{
A parameter that determines libraries supplied to the linker, in A parameter that determines libraries supplied to the linker, in
addition to other inputs. See also @scheme[expand-for-link-variant]. addition to other inputs. See also @racket[expand-for-link-variant].
For most platforms, the default is For most platforms, the default is
@schemeblock[(list (build-path (collection-path "mzscheme" "lib") @racketblock[(list (build-path (collection-path "mzscheme" "lib")
(system-library-subpath) (system-library-subpath)
(_mzdyn-thunk)))] (_mzdyn-thunk)))]
where @scheme[_mzdyn-thunk] produces @scheme[(list "mzdyn.o")] for the where @racket[_mzdyn-thunk] produces @racket[(list "mzdyn.o")] for the
@scheme['cgc] variant and @scheme[(list "mzdyn3m.o")] for the @racket['cgc] variant and @racket[(list "mzdyn3m.o")] for the
@scheme['3m] variant. See also @scheme[current-use-mzdyn]).} @racket['3m] variant. See also @racket[current-use-mzdyn]).}
@defparam[current-use-mzdyn @defparam[current-use-mzdyn
use-mzdyn? use-mzdyn?
@ -277,15 +277,15 @@ where @scheme[_mzdyn-thunk] produces @scheme[(list "mzdyn.o")] for the
A parameter that determines whether the default standard link A parameter that determines whether the default standard link
libraries include the @filepath{mzdyn} library which allows the libraries include the @filepath{mzdyn} library which allows the
resulting file to be loaded via @scheme[load-extension]. Defaults to resulting file to be loaded via @racket[load-extension]. Defaults to
@scheme[#t].} @racket[#t].}
@defparam[link-variant @defparam[link-variant
variant-symbol variant-symbol
(one-of/c 'normal 'cgc '3m)]{ (one-of/c 'normal 'cgc '3m)]{
A parameter that indicates the target for linking, where A parameter that indicates the target for linking, where
@scheme['normal] is an alias for the result of @scheme[(system-type @racket['normal] is an alias for the result of @racket[(system-type
'gc)].} 'gc)].}
@ -303,7 +303,7 @@ particular known linker.}
(-> (listof string?)))))) (-> (listof string?))))))
any]{ any]{
The same as @scheme[expand-for-compile-variant].} The same as @racket[expand-for-compile-variant].}
@subsection[#:tag "link-sig"]{Signature} @subsection[#:tag "link-sig"]{Signature}
@ -312,7 +312,7 @@ The same as @scheme[expand-for-compile-variant].}
@defsignature[dynext:link^ ()] @defsignature[dynext:link^ ()]
Includes everything exported by the @schememodname[dynext/link] module. Includes everything exported by the @racketmodname[dynext/link] module.
@subsection[#:tag "link-unit"]{Unit} @subsection[#:tag "link-unit"]{Unit}
@ -320,7 +320,7 @@ Includes everything exported by the @schememodname[dynext/link] module.
@defthing[dynext:link@ unit?]{ @defthing[dynext:link@ unit?]{
Imports nothing, exports @scheme[dynext:link^].} Imports nothing, exports @racket[dynext:link^].}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -330,63 +330,63 @@ Imports nothing, exports @scheme[dynext:link^].}
@defproc[(append-zo-suffix (s (or/c string? path?))) path?]{ @defproc[(append-zo-suffix (s (or/c string? path?))) path?]{
Appends the @filepath{.zo} file suffix to @scheme[s], returning a Appends the @filepath{.zo} file suffix to @racket[s], returning a
path. The existing suffix, if any, is preserved and converted as with path. The existing suffix, if any, is preserved and converted as with
@scheme[path-add-suffix].} @racket[path-add-suffix].}
@defproc[(append-object-suffix (s path-string?)) path?]{ @defproc[(append-object-suffix (s path-string?)) path?]{
Appends the platform-standard compiled object file suffix to Appends the platform-standard compiled object file suffix to
@scheme[s], returning a path.} @racket[s], returning a path.}
@defproc[(append-c-suffix (s path-string?)) path?]{ @defproc[(append-c-suffix (s path-string?)) path?]{
Appends the platform-standard C source-file suffix to @scheme[s], Appends the platform-standard C source-file suffix to @racket[s],
returning a path.} returning a path.}
@defproc[(append-constant-pool-suffix (s (or/c string? path?))) path?]{ @defproc[(append-constant-pool-suffix (s (or/c string? path?))) path?]{
Appends the constant-pool file suffix @filepath{.kp} to @scheme[s], Appends the constant-pool file suffix @filepath{.kp} to @racket[s],
returning a path.} returning a path.}
@defproc[(append-extension-suffix (s (or/c string? path?))) path?]{ @defproc[(append-extension-suffix (s (or/c string? path?))) path?]{
Appends the platform-standard dynamic-extension file suffix to Appends the platform-standard dynamic-extension file suffix to
@scheme[s], returning a path.} @racket[s], returning a path.}
@defproc[(extract-base-filename/ss (s path-string?) @defproc[(extract-base-filename/ss (s path-string?)
(program any/c #f)) (program any/c #f))
(or/c path? false/c)]{ (or/c path? false/c)]{
Strips the Racket file suffix from @scheme[s] and returns a stripped Strips the Racket file suffix from @racket[s] and returns a stripped
path. Unlike the other functions below, when @scheme[program] is not path. Unlike the other functions below, when @racket[program] is not
@scheme[#f], then any suffix (including no suffix) is allowed. If @racket[#f], then any suffix (including no suffix) is allowed. If
@scheme[s] is not a Racket file and @scheme[program] is @scheme[#f], @racket[s] is not a Racket file and @racket[program] is @racket[#f],
@scheme[#f] is returned.} @racket[#f] is returned.}
@defproc[(extract-base-filename/c (s path-string?) @defproc[(extract-base-filename/c (s path-string?)
(program any/c #f)) (program any/c #f))
(or/c path? false/c)]{ (or/c path? false/c)]{
Strips the Racket file suffix from @scheme[s] and Strips the Racket file suffix from @racket[s] and
returns a stripped path. If @scheme[s] is not a Racket file name and returns a stripped path. If @racket[s] is not a Racket file name and
@scheme[program] is a symbol, and error is signaled. If @scheme[s] is @racket[program] is a symbol, and error is signaled. If @racket[s] is
not a Racket file and @scheme[program] is @scheme[#f], @scheme[#f] is not a Racket file and @racket[program] is @racket[#f], @racket[#f] is
returned.} returned.}
@defproc[(extract-base-filename/kp (s path-string?) (program any/c #f)) (or/c path? false/c)]{ @defproc[(extract-base-filename/kp (s path-string?) (program any/c #f)) (or/c path? false/c)]{
Same as @scheme[extract-base-filename/c], but for constant-pool Same as @racket[extract-base-filename/c], but for constant-pool
files.} files.}
@defproc[(extract-base-filename/o (s path-string?) (program any/c #f)) (or/c path? false/c)]{ @defproc[(extract-base-filename/o (s path-string?) (program any/c #f)) (or/c path? false/c)]{
Same as @scheme[extract-base-filename/c], but for compiled-object Same as @racket[extract-base-filename/c], but for compiled-object
files.} files.}
@defproc[(extract-base-filename/ext (s path-string?) (program any/c #f)) (or/c path? false/c)]{ @defproc[(extract-base-filename/ext (s path-string?) (program any/c #f)) (or/c path? false/c)]{
Same as @scheme[extract-base-filename/c], but for extension files.} Same as @racket[extract-base-filename/c], but for extension files.}
@subsection[#:tag "file-sig"]{Signature} @subsection[#:tag "file-sig"]{Signature}
@ -395,7 +395,7 @@ Same as @scheme[extract-base-filename/c], but for extension files.}
@defsignature[dynext:file^ ()] @defsignature[dynext:file^ ()]
Includes everything exported by the @schememodname[dynext/file] module. Includes everything exported by the @racketmodname[dynext/file] module.
@subsection[#:tag "file-unit"]{Unit} @subsection[#:tag "file-unit"]{Unit}
@ -403,5 +403,5 @@ Includes everything exported by the @schememodname[dynext/file] module.
@defthing[dynext:file@ unit?]{ @defthing[dynext:file@ unit?]{
Imports nothing, exports @scheme[dynext:file^].} Imports nothing, exports @racket[dynext:file^].}

View File

@ -3,4 +3,4 @@
@defclass/title[aligned-pasteboard% pasteboard% (alignment-parent<%>)]{ @defclass/title[aligned-pasteboard% pasteboard% (alignment-parent<%>)]{
Acts as the top of an @scheme[alignment<%>] tree.} Acts as the top of an @racket[alignment<%>] tree.}

View File

@ -16,7 +16,7 @@ Tells the alignment that its sizes should be calculated.}
[width (and/c real? (not/c negative?))] [width (and/c real? (not/c negative?))]
[height (and/c real? (not/c negative?))]) void?]{ [height (and/c real? (not/c negative?))]) void?]{
Tells itself to align its children on the pasteboard Tells itself to align its children on the pasteboard
in the given rectangle defined by @scheme[width], @scheme[height] and a top in the given rectangle defined by @racket[width], @racket[height] and a top
left corner point given as offsets into the pasteboards top left corner point given as offsets into the pasteboards top
left corner.} left corner.}

View File

@ -8,11 +8,11 @@ A clickable button with a bitmap label.
@defconstructor[([images (cons/c path-string? path-string?)] @defconstructor[([images (cons/c path-string? path-string?)]
[callback ((is-a?/c button-snip%) (is-a?/c event%) . -> . void?)])]{ [callback ((is-a?/c button-snip%) (is-a?/c event%) . -> . void?)])]{
The @scheme[images] argument is a pair filenames to be load as the The @racket[images] argument is a pair filenames to be load as the
button-label image, where the first is the image for when the button button-label image, where the first is the image for when the button
is at rest, and the second is the image for the button while its is at rest, and the second is the image for the button while its
pressed. pressed.
The @scheme[callback] is called when the button is clicked.} The @racket[callback] is called when the button is clicked.}
} }

View File

@ -17,12 +17,12 @@ Gets/sets the previous item in the list.}
@defmethod[(for-each [f ((is-a?/c dllist<%>) . -> . void?)]) void?]{ @defmethod[(for-each [f ((is-a?/c dllist<%>) . -> . void?)]) void?]{
Applies @scheme[f] to every element of the dllist.} Applies @racket[f] to every element of the dllist.}
@defmethod[(map-to-list [f ((is-a?/c dllist<%>) . -> . any/c)]) @defmethod[(map-to-list [f ((is-a?/c dllist<%>) . -> . any/c)])
(listof any/c)]{ (listof any/c)]{
Creates a Scheme list by applying @scheme[f] to every element Creates a Scheme list by applying @racket[f] to every element
of @this-obj[].} of @this-obj[].}
} }

View File

@ -8,11 +8,11 @@ A clickable button with a bitmap label.
@defconstructor[([images (cons/c path-string? path-string?)] @defconstructor[([images (cons/c path-string? path-string?)]
[callback ((is-a?/c button-snip%) (is-a?/c event%) . -> . void?)])]{ [callback ((is-a?/c button-snip%) (is-a?/c event%) . -> . void?)])]{
The @scheme[images] argument is a pair filenames to be load as the The @racket[images] argument is a pair filenames to be load as the
button-label image, where the first is the image for when the button button-label image, where the first is the image for when the button
is at rest, and the second is the image for the button while its is at rest, and the second is the image for the button while its
pressed. pressed.
The @scheme[callback] is called when the button is clicked.} The @racket[callback] is called when the button is clicked.}
} }

View File

@ -1,16 +1,16 @@
#lang scribble/doc #lang scribble/doc
@(require "common.rkt" (for-label framework)) @(require "common.rkt" (for-label framework))
@title{@bold{Embedded GUI}: Widgets within @scheme[editor<%>]} @title{@bold{Embedded GUI}: Widgets within @racket[editor<%>]}
@author["Mike T. McHenry"] @author["Mike T. McHenry"]
@defmodule[embedded-gui] @defmodule[embedded-gui]
The @schememodname[embedded-gui] library provides a class hierarchy The @racketmodname[embedded-gui] library provides a class hierarchy
for creating graphical boxes within @scheme[editor<%>] objects with for creating graphical boxes within @racket[editor<%>] objects with
geometry management that mirrors that of @scheme[vertical-panel%] and geometry management that mirrors that of @racket[vertical-panel%] and
@scheme[horizontal-panel%]. @racket[horizontal-panel%].
@table-of-contents[] @table-of-contents[]
@ -24,10 +24,10 @@ geometry management that mirrors that of @scheme[vertical-panel%] and
@defmixin[stretchable-editor-snip-mixin (editor-snip%) (stretchable-snip<%>)]{ @defmixin[stretchable-editor-snip-mixin (editor-snip%) (stretchable-snip<%>)]{
Extends an editor snip the @scheme[stretchable-snip<%>] interface, Extends an editor snip the @racket[stretchable-snip<%>] interface,
which allows it to be stretched to fit an which allows it to be stretched to fit an
@scheme[alignment-parent<%>]'s allotted width. Stretchable snips are @racket[alignment-parent<%>]'s allotted width. Stretchable snips are
useful as the snip of a @scheme[snip-wrapper%] } useful as the snip of a @racket[snip-wrapper%] }
@defclass[stretchable-editor-snip% editor-snip% (stretchable-editor-snip-mixin editor-snip%)]{ @defclass[stretchable-editor-snip% editor-snip% (stretchable-editor-snip-mixin editor-snip%)]{
@ -41,11 +41,11 @@ geometry management that mirrors that of @scheme[vertical-panel%] and
@defproc[(fixed-width-label-snip [possible-labels (listof string?)]) @defproc[(fixed-width-label-snip [possible-labels (listof string?)])
(subclass?/c snip%)]{ (subclass?/c snip%)]{
Returns a subclass of @scheme[snip%] that takes a single Returns a subclass of @racket[snip%] that takes a single
initialization argument. The argument provided when instantiating the initialization argument. The argument provided when instantiating the
class must be a member of @scheme[possible-labels]; the given label class must be a member of @racket[possible-labels]; the given label
is displayed by the snip, but the snip is sized to match the longest is displayed by the snip, but the snip is sized to match the longest
of the labels in @scheme[possible-labels]. of the labels in @racket[possible-labels].
In other words, the resulting class helps align multiple GUI elements In other words, the resulting class helps align multiple GUI elements
t hat are labeled from a particular set of strings.} t hat are labeled from a particular set of strings.}
@ -53,11 +53,11 @@ t hat are labeled from a particular set of strings.}
@definterface[tabbable-text<%> ()]{ @definterface[tabbable-text<%> ()]{
An interface for tabbing between embedded @scheme[text%]s. An interface for tabbing between embedded @racket[text%]s.
@defmethod[(set-caret-owner) void?]{ @defmethod[(set-caret-owner) void?]{
Moves the caret into the @scheme[tabbable-text<%>].} Moves the caret into the @racket[tabbable-text<%>].}
@defmethod[(set-ahead) void?]{ @defmethod[(set-ahead) void?]{
@ -70,15 +70,15 @@ t hat are labeled from a particular set of strings.}
@defmixin[tabbable-text-mixin (editor:keymap<%>) (tabbable-text<%>)]{ @defmixin[tabbable-text-mixin (editor:keymap<%>) (tabbable-text<%>)]{
Adds the @scheme[tabbable-text<%>] interface to an Adds the @racket[tabbable-text<%>] interface to an
@scheme[editor:text%] class, where instantiation installs key @racket[editor:text%] class, where instantiation installs key
bindings to tab ahead and backward} bindings to tab ahead and backward}
@defproc[(set-tabbing [a-text (is-a?/c tabbable-text<%>)] ...) @defproc[(set-tabbing [a-text (is-a?/c tabbable-text<%>)] ...)
void?]{ void?]{
Sets the tabbing order of @scheme[tabbable-text<%>]s by setting each Sets the tabbing order of @racket[tabbable-text<%>]s by setting each
text's @method[tabbable-text<%> set-ahead] and text's @method[tabbable-text<%> set-ahead] and
@method[tabbable-text<%> set-back] thunks to point to its neighbor in @method[tabbable-text<%> set-back] thunks to point to its neighbor in
the argument list.} the argument list.}
@ -86,13 +86,13 @@ the argument list.}
@defmixin[grey-editor-snip-mixin (editor-snip%) ()]{ @defmixin[grey-editor-snip-mixin (editor-snip%) ()]{
Gives an @scheme[editor-snip%] a colored background indicating that Gives an @racket[editor-snip%] a colored background indicating that
is disabled. The editor is not disabled by the mixin however, and is disabled. The editor is not disabled by the mixin however, and
must be locked separately.} must be locked separately.}
@defmixin[grey-editor-mixin (editor<%>) ()]{ @defmixin[grey-editor-mixin (editor<%>) ()]{
Gives an @scheme[editor<%>] a colored background indicating that is Gives an @racket[editor<%>] a colored background indicating that is
disabled. The editor is not disabled by the mixin however, and must be disabled. The editor is not disabled by the mixin however, and must be
locked separately.} locked separately.}
@ -105,8 +105,8 @@ the argument list.}
@defmixin[cue-text-mixin (text%) ()]{ @defmixin[cue-text-mixin (text%) ()]{
Gives a @scheme[text%] an instantiation argument of a string that is Gives a @racket[text%] an instantiation argument of a string that is
displayed in the @scheme[text%] initially in grey; the text displayed in the @racket[text%] initially in grey; the text
disappears when the text gets focus. This technique is useful for disappears when the text gets focus. This technique is useful for
labeling texts without needing to take up space.} labeling texts without needing to take up space.}

View File

@ -8,4 +8,4 @@ A static text label.
@defconstructor[([parent (is-a?/c alignment-parent<%>)] @defconstructor[([parent (is-a?/c alignment-parent<%>)]
[label string?])]{ [label string?])]{
Creates a static control that displays @scheme[label].}} Creates a static control that displays @racket[label].}}

View File

@ -8,6 +8,6 @@ A button with a text label.
@defconstructor[([label string?] @defconstructor[([label string?]
[callback ((is-a?/c text-button-snip%) (is-a?/c event%) . -> . void?)])]{ [callback ((is-a?/c text-button-snip%) (is-a?/c event%) . -> . void?)])]{
The @scheme[callback] is called when the button is clicked.} The @racket[callback] is called when the button is clicked.}
} }

View File

@ -3,7 +3,7 @@
@defclass/title[embedded-toggle-button% snip-wrapper% (alignment<%>)]{ @defclass/title[embedded-toggle-button% snip-wrapper% (alignment<%>)]{
A @scheme[check-box%]-like control that a user can toggle between A @racket[check-box%]-like control that a user can toggle between
checked and unchecked states. checked and unchecked states.
@defconstructor[([images-off (cons/c path-string? path-string?)] @defconstructor[([images-off (cons/c path-string? path-string?)]
@ -12,17 +12,17 @@ checked and unchecked states.
[turn-off ((is-a?/c toggle-button-snip%) (is-a?/c event%) . -> . void?)] [turn-off ((is-a?/c toggle-button-snip%) (is-a?/c event%) . -> . void?)]
[state (symbols 'on 'off) 'on])]{ [state (symbols 'on 'off) 'on])]{
The @scheme[images-off] argument is a pair filenames to be load as the The @racket[images-off] argument is a pair filenames to be load as the
button-label image, where the first is the image for when the button button-label image, where the first is the image for when the button
is at rest, and the second is the image for the button while its is at rest, and the second is the image for the button while its
pressed---in both cases when the button is not checked by the pressed---in both cases when the button is not checked by the
user. The @scheme[images-on] argument similarly determines the images user. The @racket[images-on] argument similarly determines the images
for then the button is checked. for then the button is checked.
The @scheme[turn-on] and @scheme[turn-off] callbacks are invoked when The @racket[turn-on] and @racket[turn-off] callbacks are invoked when
the button changes to checked or unchecked, respectively. the button changes to checked or unchecked, respectively.
The @scheme[state] argument determines whether the button is initially The @racket[state] argument determines whether the button is initially
checked.} checked.}
} }

View File

@ -8,5 +8,5 @@
[after (or/c (is-a?/c alignment<%>) false/c) #f])]{ [after (or/c (is-a?/c alignment<%>) false/c) #f])]{
Inserts a new horizontal-alignment container into Inserts a new horizontal-alignment container into
@scheme[parent]---optionally after a given container also in @racket[parent]---optionally after a given container also in
@scheme[parent]. The new container can be initially shown or hidden.}} @racket[parent]. The new container can be initially shown or hidden.}}

View File

@ -28,8 +28,8 @@ The pasteboard that contains the snip.}
[snip (is-a?/c snip%)]) [snip (is-a?/c snip%)])
any/c]{ any/c]{
Applies @scheme[f] to all snips in the parent of @scheme[snip], Applies @racket[f] to all snips in the parent of @racket[snip],
starting with @scheme[snip].} starting with @racket[snip].}
@defproc[(for-each-snip [f ((is-a?/c snip%) . -> . any/c)] @defproc[(for-each-snip [f ((is-a?/c snip%) . -> . any/c)]
[first-snip (is-a?/c snip%)] [first-snip (is-a?/c snip%)]
@ -37,9 +37,9 @@ starting with @scheme[snip].}
void?]{ void?]{
Applies the function to each snip in the parent of Applies the function to each snip in the parent of
@scheme[first-snip], starting with @scheme[first-snip]. If @racket[first-snip], starting with @racket[first-snip]. If
@scheme[more] lists are supplied, they are used for extra arguments to @racket[more] lists are supplied, they are used for extra arguments to
@scheme[f], just like extra lists provided to @scheme[for-each].} @racket[f], just like extra lists provided to @racket[for-each].}
@defproc[(map-snip [f ((is-a?/c snip%) . -> . any/c)] @defproc[(map-snip [f ((is-a?/c snip%) . -> . any/c)]
[first-snip (is-a?/c snip%)] [first-snip (is-a?/c snip%)]
@ -47,10 +47,10 @@ Applies the function to each snip in the parent of
void?]{ void?]{
Applies the function to each snip in the parent of Applies the function to each snip in the parent of
@scheme[first-snip], starting with @scheme[first-snip], and @racket[first-snip], starting with @racket[first-snip], and
accumulates the results into a list. If @scheme[more] lists are accumulates the results into a list. If @racket[more] lists are
supplied, they are used for extra arguments to @scheme[f], just like supplied, they are used for extra arguments to @racket[f], just like
extra lists provided to @scheme[map].} extra lists provided to @racket[map].}
@defproc[(stretchable-width? [snip (is-a?/c snip%)]) boolean?]{ @defproc[(stretchable-width? [snip (is-a?/c snip%)]) boolean?]{

View File

@ -3,10 +3,10 @@
@defclass/title[snip-wrapper% dllist<%> (alignment<%>)]{ @defclass/title[snip-wrapper% dllist<%> (alignment<%>)]{
Adapts an arbitrary @scheme[snip<%>] to work in an alignment Adapts an arbitrary @racket[snip<%>] to work in an alignment
container. container.
@defconstructor[([parent (is-a?/c alignment-parent<%>)] @defconstructor[([parent (is-a?/c alignment-parent<%>)]
[snip (is-a?/c snip%)])]{ [snip (is-a?/c snip%)])]{
Adds @scheme[snip] to @scheme[parent].}} Adds @racket[snip] to @racket[parent].}}

View File

@ -4,8 +4,8 @@
@definterface/title[stretchable-snip<%> ()]{ @definterface/title[stretchable-snip<%> ()]{
Must be implemented by any snip class whose objects will be Must be implemented by any snip class whose objects will be
stretchable when inserted into an @scheme[aligned-pasteboard<%>] stretchable when inserted into an @racket[aligned-pasteboard<%>]
within a @scheme[snip-wrapper%]. within a @racket[snip-wrapper%].
@defmethod[(get-aligned-min-width) (and/c real? (not/c negative?))]{ @defmethod[(get-aligned-min-width) (and/c real? (not/c negative?))]{

View File

@ -8,6 +8,6 @@ A button with a text label.
@defconstructor[([label string?] @defconstructor[([label string?]
[callback ((is-a?/c text-button-snip%) (is-a?/c event%) . -> . void)])]{ [callback ((is-a?/c text-button-snip%) (is-a?/c event%) . -> . void)])]{
The @scheme[callback] is called when the button is clicked.} The @racket[callback] is called when the button is clicked.}
} }

View File

@ -3,7 +3,7 @@
@defclass/title[toggle-button-snip% snip% ()]{ @defclass/title[toggle-button-snip% snip% ()]{
A @scheme[check-box%]-like control that a user can toggle between A @racket[check-box%]-like control that a user can toggle between
checked and unchecked states. checked and unchecked states.
@defconstructor[([images-off (cons/c path-string? path-string?)] @defconstructor[([images-off (cons/c path-string? path-string?)]
@ -12,17 +12,17 @@ checked and unchecked states.
[turn-off ((is-a?/c toggle-button-snip%) (is-a?/c event%) . -> . void?)] [turn-off ((is-a?/c toggle-button-snip%) (is-a?/c event%) . -> . void?)]
[state (symbols 'on 'off) 'on])]{ [state (symbols 'on 'off) 'on])]{
The @scheme[images-off] argument is a pair filenames to be load as the The @racket[images-off] argument is a pair filenames to be load as the
button-label image, where the first is the image for when the button button-label image, where the first is the image for when the button
is at rest, and the second is the image for the button while its is at rest, and the second is the image for the button while its
pressed---in both cases when the button is not checked by the pressed---in both cases when the button is not checked by the
user. The @scheme[images-on] argument similarly determines the images user. The @racket[images-on] argument similarly determines the images
for then the button is checked. for then the button is checked.
The @scheme[turn-on] and @scheme[turn-off] callbacks are invoked when The @racket[turn-on] and @racket[turn-off] callbacks are invoked when
the button changes to checked or unchecked, respectively. the button changes to checked or unchecked, respectively.
The @scheme[state] argument determines whether the button is initially The @racket[state] argument determines whether the button is initially
checked.} checked.}
} }

View File

@ -8,5 +8,5 @@
[after (or/c (is-a?/c alignment<%>) false/c) #f])]{ [after (or/c (is-a?/c alignment<%>) false/c) #f])]{
Inserts a new vertical-alignment container into Inserts a new vertical-alignment container into
@scheme[parent]---optionally after a given container also in @racket[parent]---optionally after a given container also in
@scheme[parent]. The new container can be initially shown or hidden.}} @racket[parent]. The new container can be initially shown or hidden.}}

View File

@ -37,14 +37,14 @@
The @italic{Essentials of Programming Languages} language in DrRacket The @italic{Essentials of Programming Languages} language in DrRacket
provides a subset of functions and syntactic forms of provides a subset of functions and syntactic forms of
@schememodname[mzscheme]---mostly the ones that correspond to @racketmodname[mzscheme]---mostly the ones that correspond to
@scheme[r5rs] forms. See below for a complete list. The @racket[r5rs] forms. See below for a complete list. The
language is intended for use with the textbook @cite["EoPL"]. language is intended for use with the textbook @cite["EoPL"].
@defmodulelang[eopl #:use-sources (eopl/eopl)] @defmodulelang[eopl #:use-sources (eopl/eopl)]
The following bindings are re-@scheme[provide]d from The following bindings are re-@racket[provide]d from
@schememodname[mzscheme]: @racketmodname[mzscheme]:
@reprovide[ @reprovide[
make-parameter make-parameter
@ -111,22 +111,22 @@ The following bindings are re-@scheme[provide]d from
(variant-id (field-id predicate-expr) ...) (variant-id (field-id predicate-expr) ...)
...)]{ ...)]{
Defines the datatype @scheme[id] and a function Defines the datatype @racket[id] and a function
@scheme[predicate-id] that returns @scheme[#t] for instances of the @racket[predicate-id] that returns @racket[#t] for instances of the
datatype, and @scheme[#f] for any other value. datatype, and @racket[#f] for any other value.
Each @scheme[variant-id] is defined as a constructor function that Each @racket[variant-id] is defined as a constructor function that
creates an instance of the datatype; the constructor takes as many creates an instance of the datatype; the constructor takes as many
arguments as the variant's @scheme[field-id]s, and each argument is arguments as the variant's @racket[field-id]s, and each argument is
checked by applying the function produced by the variant's checked by applying the function produced by the variant's
@scheme[predicate-expr]. @racket[predicate-expr].
In DrScheme v209 and older, when constructor-based printing was In DrScheme v209 and older, when constructor-based printing was
used, variant instances were printed with a @scheme[make-] prefix used, variant instances were printed with a @racket[make-] prefix
before the variant name. Thus, for compatibility, in addition to before the variant name. Thus, for compatibility, in addition to
@scheme[variant-id], @scheme[make-variant-id] is also defined for @racket[variant-id], @racket[make-variant-id] is also defined for
each @scheme[variant-id] (to the same constructor as each @racket[variant-id] (to the same constructor as
@scheme[variant-id]).} @racket[variant-id]).}
@defform*[#:literals (else) @defform*[#:literals (else)
[(cases datatype-id expr [(cases datatype-id expr
@ -137,9 +137,9 @@ The following bindings are re-@scheme[provide]d from
... ...
(else result-expr ...))]]{ (else result-expr ...))]]{
Branches on the datatype instance produced by @scheme[expr], which Branches on the datatype instance produced by @racket[expr], which
must be an instance of the specified @scheme[datatype-id] that is must be an instance of the specified @racket[datatype-id] that is
defined with @scheme[define-datatype].} defined with @racket[define-datatype].}
@deftogether[( @deftogether[(
@defidform[sllgen:make-string-scanner] @defidform[sllgen:make-string-scanner]
@ -167,7 +167,7 @@ The following bindings are re-@scheme[provide]d from
@defproc[(eopl:printf (form string?) (v any/c) ...) void?] @defproc[(eopl:printf (form string?) (v any/c) ...) void?]
@defproc[(eopl:pretty-print (v any/c) (port output-port? (current-output-port))) void?])]{ @defproc[(eopl:pretty-print (v any/c) (port output-port? (current-output-port))) void?])]{
Same as @schememodname[scheme/base]'s @scheme[printf] and @scheme[pretty-print].} Same as @racketmodname[scheme/base]'s @racket[printf] and @racket[pretty-print].}
@deftogether[( @deftogether[(
@defproc[((list-of (pred (any/c . -> . any)) ...+) (x any/c)) boolean?] @defproc[((list-of (pred (any/c . -> . any)) ...+) (x any/c)) boolean?]
@ -182,7 +182,7 @@ The following bindings are re-@scheme[provide]d from
@defform[(time expr)]{ @defform[(time expr)]{
Evaluates @scheme[expr], and prints timing information before returning the Evaluates @racket[expr], and prints timing information before returning the
result.} result.}
@defproc[(collect-garbage) void?]{ @defproc[(collect-garbage) void?]{
@ -193,19 +193,19 @@ The following bindings are re-@scheme[provide]d from
@defform[(trace id ...)] @defform[(trace id ...)]
@defform[(untrace id ...)])]{ @defform[(untrace id ...)])]{
For debugging: @scheme[trace] redefines each @scheme[id] at the top For debugging: @racket[trace] redefines each @racket[id] at the top
level (bound to a procedure) so that it prints arguments on entry level (bound to a procedure) so that it prints arguments on entry
and results on exit. The @scheme[untrace] form reverses the action and results on exit. The @racket[untrace] form reverses the action
of @scheme[trace] for the given @scheme[id]s. of @racket[trace] for the given @racket[id]s.
Tracing a function causes tail-calls in the original function to Tracing a function causes tail-calls in the original function to
become non-tail calls.} become non-tail calls.}
@defform[(provide provide-spec ...)]{ @defform[(provide provide-spec ...)]{
Useful only with a module that uses @schememodname[eopl] as a Useful only with a module that uses @racketmodname[eopl] as a
language: exports identifiers from the module. See @mzscheme-provide language: exports identifiers from the module. See @mzscheme-provide
from @schememodname[mzscheme] for more information.} from @racketmodname[mzscheme] for more information.}
@defthing[eopl:error-stop (-> any/c)]{ @defthing[eopl:error-stop (-> any/c)]{
@ -213,15 +213,15 @@ The following bindings are re-@scheme[provide]d from
mutate this variable to install an exception-handling mutate this variable to install an exception-handling
thunk. Typically, the handler thunk escapes through a continuation. thunk. Typically, the handler thunk escapes through a continuation.
The @schememodname[eopl] library sets this variable to The @racketmodname[eopl] library sets this variable to
@scheme[#f] in the current namespace when it executes.} @racket[#f] in the current namespace when it executes.}
@defproc[(install-eopl-exception-handler) void?]{ @defproc[(install-eopl-exception-handler) void?]{
Sets an exception handler to one that checks Sets an exception handler to one that checks
@scheme[eopl:error-stop]. @racket[eopl:error-stop].
The @schememodname[eopl] library calls this function when it The @racketmodname[eopl] library calls this function when it
executes.} executes.}
@(bibliography @(bibliography

View File

@ -33,7 +33,7 @@ Then,
@item{If you program is a non-module top-level sequence of @item{If you program is a non-module top-level sequence of
definitions and expressions, you can instead add definitions and expressions, you can instead add
@schemeblock[(require errortrace)] @racketblock[(require errortrace)]
to the beginning of the program or start Racket with the @Flag{l} option before the to the beginning of the program or start Racket with the @Flag{l} option before the
arguments to load your program: arguments to load your program:
@commandline{racket -l errortrace ...}} @commandline{racket -l errortrace ...}}
@ -44,17 +44,17 @@ Then,
@commandline{racket -i -l errortrace}} @commandline{racket -i -l errortrace}}
] ]
After starting @schememodname[errortrace] in one of these ways, when an After starting @racketmodname[errortrace] in one of these ways, when an
exception occurs, the exception handler something like a stack trace exception occurs, the exception handler something like a stack trace
with most recent contexts first. with most recent contexts first.
The @schememodname[errortrace] module is strange: Don't import it The @racketmodname[errortrace] module is strange: Don't import it
into another module. Instead, the @schememodname[errortrace] into another module. Instead, the @racketmodname[errortrace]
module is meant to be invoked from the top-level, so that it can install module is meant to be invoked from the top-level, so that it can install
an evaluation handler, exception handler, etc. an evaluation handler, exception handler, etc.
To reuse parts of the code of @schememodname[errortrace], import To reuse parts of the code of @racketmodname[errortrace], import
@schememodname[errortrace/errortrace-lib]. That library contains all @racketmodname[errortrace/errortrace-lib]. That library contains all
of the bindings described here, but does not set the compilation of the bindings described here, but does not set the compilation
handler or the error display handler. handler or the error display handler.
@ -63,21 +63,21 @@ handler or the error display handler.
@section[#:tag "installing-errortrace"]{Installing Errortrace} @section[#:tag "installing-errortrace"]{Installing Errortrace}
Invoking the Invoking the
@schememodname[errortrace] module sets the compilation @racketmodname[errortrace] module sets the compilation
handler to instrument Racket source code. It also sets the error handler to instrument Racket source code. It also sets the error
display handler to report source information for an exception, and it display handler to report source information for an exception, and it
sets the @scheme[use-compiled-file-paths] parameter to trigger the use sets the @racket[use-compiled-file-paths] parameter to trigger the use
of Errortrace-specific @filepath{.zo} files. of Errortrace-specific @filepath{.zo} files.
NOTE: @schememodname[errortrace] has no effect on code NOTE: @racketmodname[errortrace] has no effect on code
loaded as compiled byte code (i.e., from a @filepath{.zo} file) or loaded as compiled byte code (i.e., from a @filepath{.zo} file) or
native code (i.e., from a @filepath{.dll}, @filepath{.so} or native code (i.e., from a @filepath{.dll}, @filepath{.so} or
@filepath{.dylib} file). You can use the @DFlag{mode errortrace} flag @filepath{.dylib} file). You can use the @DFlag{mode errortrace} flag
to @exec{setup-plt} to create @filepath{.zo} files with to @exec{setup-plt} to create @filepath{.zo} files with
Errortrace information. Errortrace information.
Explicitly requiring @schememodname[errortrace] within a module is Explicitly requiring @racketmodname[errortrace] within a module is
generally a bad idea, since @schememodname[errortrace] sets various generally a bad idea, since @racketmodname[errortrace] sets various
parameters. parameters.
@; --------------------------------------------- @; ---------------------------------------------
@ -86,24 +86,24 @@ parameters.
@defmodule[errortrace #:use-sources (errortrace/errortrace-lib)] @defmodule[errortrace #:use-sources (errortrace/errortrace-lib)]
See @secref["quick-instructions"] for information on starting with See @secref["quick-instructions"] for information on starting with
@schememodname[errortrace]. This chapter provides information on the @racketmodname[errortrace]. This chapter provides information on the
configuration of @schememodname[errortrace] after it is loaded and configuration of @racketmodname[errortrace] after it is loaded and
installed. installed.
Don't import @schememodname[errortrace] into another module and expect Don't import @racketmodname[errortrace] into another module and expect
it to work on that module. Instead, the @schememodname[errortrace] it to work on that module. Instead, the @racketmodname[errortrace]
module is meant to be invoked from the top-level (as described in module is meant to be invoked from the top-level (as described in
@secref["quick-instructions"]) so it can install handlers. The @secref["quick-instructions"]) so it can install handlers. The
functions documented in this chapter then can be used at the functions documented in this chapter then can be used at the
top-level. The functions also can be accessed by importing top-level. The functions also can be accessed by importing
@schememodname[errortrace/errortrace-lib], which does not install any @racketmodname[errortrace/errortrace-lib], which does not install any
handlers. handlers.
As a language name, @schememodname[errortrace] chains to another As a language name, @racketmodname[errortrace] chains to another
language that is specified immediately after @schememodname[at-exp], language that is specified immediately after @racketmodname[at-exp],
but instruments the module for debugging in the same way as if but instruments the module for debugging in the same way as if
@schememodname[errortrace] is required before loading the module from @racketmodname[errortrace] is required before loading the module from
source. Using the @schememodname[errortrace] meta-language is one way source. Using the @racketmodname[errortrace] meta-language is one way
to ensure that debugging instrumentation is present when the module is to ensure that debugging instrumentation is present when the module is
compiled.} compiled.}
@ -111,32 +111,32 @@ compiled.}
@subsection[#:tag "instrumentation-and-profiling"]{Instrumentation and Profiling} @subsection[#:tag "instrumentation-and-profiling"]{Instrumentation and Profiling}
By default, @schememodname[errortrace] only instruments for By default, @racketmodname[errortrace] only instruments for
stack-trace-on-exception. Profiling and coverage need to be enabled stack-trace-on-exception. Profiling and coverage need to be enabled
separately. separately.
@defboolparam[instrumenting-enabled on?]{ @defboolparam[instrumenting-enabled on?]{
A parameter that determines whether tracing instrumentation is A parameter that determines whether tracing instrumentation is
enabled, @scheme[#t] by default. Affects only the way that source code is enabled, @racket[#t] by default. Affects only the way that source code is
compiled, not the way that exception information is reported. The compiled, not the way that exception information is reported. The
instrumentation for storing exception information slows most programs instrumentation for storing exception information slows most programs
by a factor of 2 or 3.} by a factor of 2 or 3.}
@defboolparam[profiling-enabled on?]{ @defboolparam[profiling-enabled on?]{
Errortrace's profiling instrumentation is @scheme[#f] by default. To use it, Errortrace's profiling instrumentation is @racket[#f] by default. To use it,
you also need to ensure that @scheme[instrumenting-enabled] is on. you also need to ensure that @racket[instrumenting-enabled] is on.
Also, profiling only records information about the time taken on the thread Also, profiling only records information about the time taken on the thread
that compiled the code (more precisely, the thread that instruments the code via that compiled the code (more precisely, the thread that instruments the code via
the @scheme[errortrace-compile-handler]). the @racket[errortrace-compile-handler]).
} }
@defboolparam[profiling-record-enabled on?]{ @defboolparam[profiling-record-enabled on?]{
Enables/disables the recording of profiling info for the instrumented code. Enables/disables the recording of profiling info for the instrumented code.
The default is @scheme[#t]. The default is @racket[#t].
Profiling information is accumulated in a hash table. If a procedure Profiling information is accumulated in a hash table. If a procedure
is redefined, new profiling information is accumulated for the new is redefined, new profiling information is accumulated for the new
@ -149,14 +149,14 @@ exception-information instrumentation.
@defproc[(output-profile-results [paths? any/c] [sort-time? any/c]) void?]{ @defproc[(output-profile-results [paths? any/c] [sort-time? any/c]) void?]{
Gets the current profile results using @scheme[get-profile-results] and Gets the current profile results using @racket[get-profile-results] and
displays them. It optionally shows paths information (if it is recorded), displays them. It optionally shows paths information (if it is recorded),
and sorts by either time or call counts.} and sorts by either time or call counts.}
@defproc[(get-profile-results [thd thread? (current-thread)]) list?]{ @defproc[(get-profile-results [thd thread? (current-thread)]) list?]{
Returns a list of lists that contain all profiling information accumulated Returns a list of lists that contain all profiling information accumulated
so far (for the thread @scheme[thd]): so far (for the thread @racket[thd]):
@itemize[ @itemize[
@item{the number of times a procedure was called.} @item{the number of times a procedure was called.}
@ -166,13 +166,13 @@ so far (for the thread @scheme[thd]):
within the procedure, but not including time consumed by a within the procedure, but not including time consumed by a
tail-call from the procedure).} tail-call from the procedure).}
@item{an inferred name (or @scheme[#f]) for the procedure.} @item{an inferred name (or @racket[#f]) for the procedure.}
@item{the procedure's source in the form of a syntax object (which might, @item{the procedure's source in the form of a syntax object (which might,
in turn, provide a source location file and position).} in turn, provide a source location file and position).}
@item{optionally, a list of unique call paths (i.e. stack traces) @item{optionally, a list of unique call paths (i.e. stack traces)
recorded if @scheme[profile-paths-enabled] is set to @scheme[#t]. recorded if @racket[profile-paths-enabled] is set to @racket[#t].
Each call path is a pair of Each call path is a pair of
@itemize[ @itemize[
@item{a count (the number of times the path occurred), and} @item{a count (the number of times the path occurred), and}
@ -182,7 +182,7 @@ so far (for the thread @scheme[thd]):
@itemize[ @itemize[
@item{the calling procedure's name or source expression, @item{the calling procedure's name or source expression,
and} and}
@item{the calling procedure's source file or @scheme[#f].}] @item{the calling procedure's source file or @racket[#f].}]
} }
] ]
Collecting this information is relatively expensive.} Collecting this information is relatively expensive.}
@ -191,7 +191,7 @@ so far (for the thread @scheme[thd]):
@defboolparam[profile-paths-enabled on?]{ @defboolparam[profile-paths-enabled on?]{
Enables/disables collecting path information for profiling. The default is Enables/disables collecting path information for profiling. The default is
@scheme[#f], but setting the parameter to @scheme[#t] immediately affects @racket[#f], but setting the parameter to @racket[#t] immediately affects
all procedures instrumented for profiling information.} all procedures instrumented for profiling information.}
@defproc[(clear-profile-results) void?]{ @defproc[(clear-profile-results) void?]{
@ -211,13 +211,13 @@ annotations that the profiler uses, so only function bodies are
counted. To see the difference between the two approaches, try this counted. To see the difference between the two approaches, try this
program: program:
@schemeblock[(define (foo x) (if x 1 2)) @racketblock[(define (foo x) (if x 1 2))
(equal? (foo #t) 1)] (equal? (foo #t) 1)]
The first approach will produce exact results, but it is more The first approach will produce exact results, but it is more
expensive; use it when you want to know how covered your code is (when expensive; use it when you want to know how covered your code is (when
the expected counts are small). The second approach produces coarser the expected counts are small). The second approach produces coarser
results (which, in the above case, will miss the @scheme[2] expression), results (which, in the above case, will miss the @racket[2] expression),
but is less expensive; use it when you want to use the counts for but is less expensive; use it when you want to use the counts for
profiling (when the expected counts are large). profiling (when the expected counts are large).
@ -227,19 +227,19 @@ profiling (when the expected counts are large).
Parameters that determine if the first (exact coverage) or second Parameters that determine if the first (exact coverage) or second
(profiler-based coverage) are enabled. Remember that setting (profiler-based coverage) are enabled. Remember that setting
@scheme[instrumenting-enabled] to @scheme[#f] also disables both.} @racket[instrumenting-enabled] to @racket[#f] also disables both.}
@defproc[(get-coverage) (listof (cons/c syntax? boolean?))]{ @defproc[(get-coverage) (listof (cons/c syntax? boolean?))]{
Returns a list of pairs, one for each instrumented expression. The Returns a list of pairs, one for each instrumented expression. The
first element of the pair is a @scheme[syntax?] object (usually containing first element of the pair is a @racket[syntax?] object (usually containing
source location information) for the original expression, and the source location information) for the original expression, and the
second element of the pair indicates if the code has been executed. second element of the pair indicates if the code has been executed.
This list is snapshot of the current state of the computation.} This list is snapshot of the current state of the computation.}
@defproc[(get-execute-counts) (list (cons/c syntax? number?))])]{ @defproc[(get-execute-counts) (list (cons/c syntax? number?))])]{
Returns a list of pairs, one for each instrumented expression. The Returns a list of pairs, one for each instrumented expression. The
first element of the pair is a @scheme[syntax?] object (usually containing first element of the pair is a @racket[syntax?] object (usually containing
source location information) for the original expression, and the source location information) for the original expression, and the
second element of the pair is the number of times that the second element of the pair is the number of times that the
expression has been evaluated. expression has been evaluated.
@ -255,16 +255,16 @@ This list is snapshot of the current state of the computation.}
[display-string (or/c string? #t #f) "^.,"]) [display-string (or/c string? #t #f) "^.,"])
void?])]{ void?])]{
Writes the named file to the @scheme[current-output-port], inserting an Writes the named file to the @racket[current-output-port], inserting an
additional line between each source line to reflect execution counts additional line between each source line to reflect execution counts
(as reported by @scheme[get-coverage-counts] or @scheme[get-execute-counts]). (as reported by @racket[get-coverage-counts] or @racket[get-execute-counts]).
The optional @scheme[display-string] is used for the annotation: the first The optional @racket[display-string] is used for the annotation: the first
character is used for expressions that were visited 0 times, the character is used for expressions that were visited 0 times, the
second character for 1 time, ..., and the last character for second character for 1 time, ..., and the last character for
expressions that were visited more times. It can also be expressions that were visited more times. It can also be
@scheme[#f] for a minimal display, @scheme["#."], or, in @racket[#f] for a minimal display, @racket["#."], or, in
the case of @scheme[annotate-executed-file], the case of @racket[annotate-executed-file],
@scheme[#t] for a maximal display, @scheme["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"]. @racket[#t] for a maximal display, @racket["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"].
} }
@defparam[test-coverage-info ht hasheq?]{ @defparam[test-coverage-info ht hasheq?]{
@ -275,17 +275,17 @@ the case of @scheme[annotate-executed-file],
@subsection[#:tag "other-errortrace-bindings"]{Other Errortrace Bindings} @subsection[#:tag "other-errortrace-bindings"]{Other Errortrace Bindings}
The @schememodname[errortrace] module also exports: The @racketmodname[errortrace] module also exports:
@defproc[(print-error-trace [output-port output-port?] [exn exn?]) void?]{ @defproc[(print-error-trace [output-port output-port?] [exn exn?]) void?]{
The @scheme[print-error-trace] procedure takes a port and exception and The @racket[print-error-trace] procedure takes a port and exception and
prints the Errortrace-collected debugging information contained in the prints the Errortrace-collected debugging information contained in the
exception. It is used by the exception handler installed by exception. It is used by the exception handler installed by
Errortrace.} Errortrace.}
@defparam[error-context-display-depth d integer?]{The @defparam[error-context-display-depth d integer?]{The
@scheme[error-context-display-depth] parameter controls how much context @racket[error-context-display-depth] parameter controls how much context
Errortrace's exception handler displays. The default value is 10,000.} Errortrace's exception handler displays. The default value is 10,000.}
@ -295,8 +295,8 @@ Errortrace's exception handler displays. The default value is 10,000.}
@defmodule[errortrace/errortrace-lib]{ @defmodule[errortrace/errortrace-lib]{
The @schememodname[errortrace/errortrace-lib] module exports all of the The @racketmodname[errortrace/errortrace-lib] module exports all of the
exports of @schememodname[errortrace], plus a few more. It does exports of @racketmodname[errortrace], plus a few more. It does
not install any handlers.} not install any handlers.}
The additional exports are as follows: The additional exports are as follows:
@ -304,29 +304,29 @@ The additional exports are as follows:
@defproc[(errortrace-compile-handler (stx any/c) (immediate-eval? any/c)) @defproc[(errortrace-compile-handler (stx any/c) (immediate-eval? any/c))
compiled-expression?]{ compiled-expression?]{
Compiles @scheme[stx] using the compilation handler that was active Compiles @racket[stx] using the compilation handler that was active
when the @schememodname[errortrace/errortrace-lib] module was when the @racketmodname[errortrace/errortrace-lib] module was
executed, but first instruments the code for Errortrace information. executed, but first instruments the code for Errortrace information.
The code is instrumented only if The code is instrumented only if
@schemeblock[(namespace-module-registry (current-namespace))] @racketblock[(namespace-module-registry (current-namespace))]
is the same as when the is the same as when the
@schememodname[errortrace/errortrace-lib] module was executed. This @racketmodname[errortrace/errortrace-lib] module was executed. This
procedure is suitable for use as a compilation handler via procedure is suitable for use as a compilation handler via
@scheme[current-compile].} @racket[current-compile].}
@defproc[(make-errortrace-compile-handler) @defproc[(make-errortrace-compile-handler)
(-> any/c any/c compiled-expression)]{ (-> any/c any/c compiled-expression)]{
Produces a compile handler that is like Produces a compile handler that is like
@scheme[errortrace-compile-handler], except that the code that @racket[errortrace-compile-handler], except that the code that
it produces is instrumented if the value of it produces is instrumented if the value of
@schemeblock[(namespace-module-registry (current-namespace))] @racketblock[(namespace-module-registry (current-namespace))]
is the same as when the original thunk is invoked. is the same as when the original thunk is invoked.
In addition, when the thunk is invoked, it uses In addition, when the thunk is invoked, it uses
@scheme[namespace-attach-module] to attach the @racket[namespace-attach-module] to attach the
@schememodname[errortrace/errortrace-key] module and the @racketmodname[errortrace/errortrace-key] module and the
@schememodname['#%kernel] module to the @scheme[current-namespace]. @racketmodname['#%kernel] module to the @racket[current-namespace].
} }
@defproc[(errortrace-error-display-handler (string string?) (exn exn?)) void?]{ @defproc[(errortrace-error-display-handler (string string?) (exn exn?)) void?]{
@ -337,18 +337,18 @@ for use as an error display handler.}
@defproc[(errortrace-annotate (stx any/c)) any/c]{ @defproc[(errortrace-annotate (stx any/c)) any/c]{
Macro-expands and instruments the given top-level form. If the form is Macro-expands and instruments the given top-level form. If the form is
a module named @schemeidfont{errortrace-key}, no instrumentation is a module named @racketidfont{errortrace-key}, no instrumentation is
applied. This annotation function is used by applied. This annotation function is used by
@scheme[errortrace-compile-handler].} @racket[errortrace-compile-handler].}
@defproc[(annotate-top [stx any/c][phase-level exact-integer?]) any/c]{ @defproc[(annotate-top [stx any/c][phase-level exact-integer?]) any/c]{
Like @scheme[errortrace-annotate], but given an explicit phase level Like @racket[errortrace-annotate], but given an explicit phase level
for @scheme[stx]; @scheme[(namespace-base-phase)] is typically the for @racket[stx]; @racket[(namespace-base-phase)] is typically the
right value for the @scheme[phase-level] argument. right value for the @racket[phase-level] argument.
Unlike @scheme[errortrace-annotate], there no special case for Unlike @racket[errortrace-annotate], there no special case for
a module named @scheme[errortrace-key]. Also, if @scheme[stx] is a module a module named @racket[errortrace-key]. Also, if @racket[stx] is a module
declaration, it is not enriched with imports to explicitly load declaration, it is not enriched with imports to explicitly load
Errortrace run-time support.} Errortrace run-time support.}
@ -356,19 +356,19 @@ Errortrace run-time support.}
@section[#:tag "stacktrace"]{Re-using Errortrace Stack Tracing} @section[#:tag "stacktrace"]{Re-using Errortrace Stack Tracing}
@(define-syntax-rule (schemein id) (sigelem stacktrace-imports^ id)) @(define-syntax-rule (racketin id) (sigelem stacktrace-imports^ id))
@(define-syntax-rule (schemeout id) (sigelem stacktrace^ id)) @(define-syntax-rule (racketout id) (sigelem stacktrace^ id))
@defmodule[errortrace/stacktrace]{ @defmodule[errortrace/stacktrace]{
The errortrace collection also includes a The errortrace collection also includes a
@schememodname[errortrace/stacktrace] library. It exports @racketmodname[errortrace/stacktrace] library. It exports
the @scheme[stacktrace@] unit, its import signature the @racket[stacktrace@] unit, its import signature
@scheme[stacktrace-imports^], and its export signature @racket[stacktrace-imports^], and its export signature
@scheme[stacktrace^].} @racket[stacktrace^].}
@defthing[stacktrace@ unit?]{ @defthing[stacktrace@ unit?]{
Imports @scheme[stacktrace-imports^] and exports @scheme[stacktrace^].} Imports @racket[stacktrace-imports^] and exports @racket[stacktrace^].}
@defsignature[stacktrace^ ()]{ @defsignature[stacktrace^ ()]{
@ -378,11 +378,11 @@ Imports @scheme[stacktrace-imports^] and exports @scheme[stacktrace^].}
@defproc[(annotate-top (stx syntax?) (phase-level exact-integer?)) syntax?])]{ @defproc[(annotate-top (stx syntax?) (phase-level exact-integer?)) syntax?])]{
Annotate expressions with errortrace information. The Annotate expressions with errortrace information. The
@schemeout[annotate-top] function should be called with a top-level @racketout[annotate-top] function should be called with a top-level
expression, and @schemeout[annotate] should be called with a nested expression, and @racketout[annotate] should be called with a nested
expression (e.g., by @schemein[initialize-profile-point]). The expression (e.g., by @racketin[initialize-profile-point]). The
@scheme[phase-level] argument indicates the phase level of the @racket[phase-level] argument indicates the phase level of the
expression, typically @scheme[(namespace-base-phase)] for a top-level expression, typically @racket[(namespace-base-phase)] for a top-level
expression.} expression.}
@deftogether[( @deftogether[(
@ -390,17 +390,17 @@ expression.}
@defproc[(st-mark-source (st-mark st-mark?)) syntax?] @defproc[(st-mark-source (st-mark st-mark?)) syntax?]
@defproc[(st-mark-bindings (st-mark st-mark?)) list?])]{ @defproc[(st-mark-bindings (st-mark st-mark?)) list?])]{
The @schemeout[st-mark-source] and @schemeout[st-mark-bindings] The @racketout[st-mark-source] and @racketout[st-mark-bindings]
functions extract information from a particular kind of value. functions extract information from a particular kind of value.
The value must be created by @schemeout[make-st-mark] The value must be created by @racketout[make-st-mark]
(the shape of the value is guaranteed to be writable and not to be @scheme[#f], but otherwise unspecified). (the shape of the value is guaranteed to be writable and not to be @racket[#f], but otherwise unspecified).
The @scheme[make-st-mark] function returns @scheme[#f] when there is The @racket[make-st-mark] function returns @racket[#f] when there is
no source location information in the syntax object. no source location information in the syntax object.
The @schemeout[st-mark-source] extracts the value originally provided to The @racketout[st-mark-source] extracts the value originally provided to
the expression-maker, and @schemeout[st-mark-bindings] returns local the expression-maker, and @racketout[st-mark-bindings] returns local
binding information (if available) as a list of two element (syntax? binding information (if available) as a list of two element (syntax?
any/c) lists. The @schemeout[st-mark-bindings] function is currently any/c) lists. The @racketout[st-mark-bindings] function is currently
hardwired to return @scheme[null]. } hardwired to return @racket[null]. }
} }
@ -408,8 +408,8 @@ hardwired to return @scheme[null]. }
@defproc[(with-mark (source-stx any/c) (dest-stx any/c)) any/c]{ @defproc[(with-mark (source-stx any/c) (dest-stx any/c)) any/c]{
Called by @schemeout[annotate] and @schemeout[annotate-top] to wrap Called by @racketout[annotate] and @racketout[annotate-top] to wrap
expressions with @scheme[with-continuation-mark]. The first argument expressions with @racket[with-continuation-mark]. The first argument
is the source expression and the second argument is the expression to is the source expression and the second argument is the expression to
be wrapped.} be wrapped.}
@ -418,24 +418,24 @@ be wrapped.}
Determines if the test coverage annotation is inserted into the code. Determines if the test coverage annotation is inserted into the code.
This parameter controls how compilation happens---it does not affect the This parameter controls how compilation happens---it does not affect the
dynamic behavior of the already compiled code. If the parameter is set, dynamic behavior of the already compiled code. If the parameter is set,
code generated by @schemein[test-covered] are inserted into the code (and code generated by @racketin[test-covered] are inserted into the code (and
@schemein[initialize-test-coverage-point] is called during compilation). @racketin[initialize-test-coverage-point] is called during compilation).
If not, no calls to @scheme[test-covered] code are inserted.} If not, no calls to @racket[test-covered] code are inserted.}
@defproc[(test-covered (stx any/c)) (or/c syntax? (-> void?) #f)]{ @defproc[(test-covered (stx any/c)) (or/c syntax? (-> void?) #f)]{
This is called during compilation of the program with an expression for This is called during compilation of the program with an expression for
each point in the program that was passed to each point in the program that was passed to
@schemein[initialize-test-coverage-point]. @racketin[initialize-test-coverage-point].
If the result is @scheme[#f], this program point is not instrumented. If If the result is @racket[#f], this program point is not instrumented. If
the result is syntax, it is inserted into the code, and if it is a the result is syntax, it is inserted into the code, and if it is a
thunk, the thunk is inserted into the code in an application (using the thunk, the thunk is inserted into the code in an application (using the
thunk directly, as a 3D value). In either case, the syntax or the thunk thunk directly, as a 3D value). In either case, the syntax or the thunk
should register that the relevant point was covered. should register that the relevant point was covered.
Note: using a thunk tends to be slow. Current uses in the Racket code Note: using a thunk tends to be slow. Current uses in the Racket code
will create a mutable pair in @scheme[initialize-test-coverage-point], will create a mutable pair in @racket[initialize-test-coverage-point],
and @scheme[test-covered] returns syntax that will set its mcar. (This and @racket[test-covered] returns syntax that will set its mcar. (This
makes the resulting overhead about 3 times smaller.)} makes the resulting overhead about 3 times smaller.)}
@defproc[(initialize-test-coverage-point (stx any/c)) void?]{ @defproc[(initialize-test-coverage-point (stx any/c)) void?]{
@ -452,7 +452,7 @@ Only used for profiling paths.}
Determines if profiling information is currently collected (affects Determines if profiling information is currently collected (affects
the behavior of compiling the code---does not affect running code). the behavior of compiling the code---does not affect running code).
If this always returns @scheme[#f], the other profiling functions are If this always returns @racket[#f], the other profiling functions are
never called.} never called.}
@defproc[(initialize-profile-point (key any/c) @defproc[(initialize-profile-point (key any/c)
@ -470,8 +470,8 @@ this expression.}
Called when some profiled code is about to be executed. If the Called when some profiled code is about to be executed. If the
result is a number, it is expected to be the current number of result is a number, it is expected to be the current number of
milliseconds. @scheme[key] is unique to this fragment of code---it is milliseconds. @racket[key] is unique to this fragment of code---it is
the same key passed to @schemein[initialize-profile-point] for this code the same key passed to @racketin[initialize-profile-point] for this code
fragment.} fragment.}
@defproc[(register-profile-done (key any/c) @defproc[(register-profile-done (key any/c)
@ -480,19 +480,19 @@ fragment.}
This function is called when some profiled code is finished executing. This function is called when some profiled code is finished executing.
Note that @schemein[register-profile-start] and Note that @racketin[register-profile-start] and
@schemein[register-profile-done] can be called in a nested manner; in @racketin[register-profile-done] can be called in a nested manner; in
this case, the result of @schemein[register-profile-start] should be this case, the result of @racketin[register-profile-start] should be
@scheme[#f].} @racket[#f].}
} }
@section{Errortrace Key} @section{Errortrace Key}
@defmodule[errortrace/errortrace-key] @defmodule[errortrace/errortrace-key]
This module depends only on @schememodname['#%kernel]. This module depends only on @racketmodname['#%kernel].
@defthing[errortrace-key symbol?]{ @defthing[errortrace-key symbol?]{
A key used by errortrace via @scheme[with-continuation-mark] to A key used by errortrace via @racket[with-continuation-mark] to
record stack information. record stack information.
} }

View File

@ -6,7 +6,7 @@
@defmodule[file/convertible] @defmodule[file/convertible]
The @schememodname[file/convertible] library provides a protocol to The @racketmodname[file/convertible] library provides a protocol to
mediate between providers of data in different possible formats and mediate between providers of data in different possible formats and
consumers of the formats. For example, a datatype that implements consumers of the formats. For example, a datatype that implements
@racket[prop:convertible] might be able to convert itself to a GIF or @racket[prop:convertible] might be able to convert itself to a GIF or
@ -19,13 +19,13 @@ should be considered standard:
@itemlist[ @itemlist[
#:style 'compact #:style 'compact
@item{@scheme['text] --- a string for human-readable text} @item{@racket['text] --- a string for human-readable text}
@item{@scheme['gif-bytes] --- a byte string containing a GIF image encoding} @item{@racket['gif-bytes] --- a byte string containing a GIF image encoding}
@item{@scheme['png-bytes] --- a byte string containing a PNG image encoding} @item{@racket['png-bytes] --- a byte string containing a PNG image encoding}
@item{@scheme['ps-bytes] --- a byte string containing a PostScript document} @item{@racket['ps-bytes] --- a byte string containing a PostScript document}
@item{@scheme['eps-bytes] --- a byte string containing an Encapsulated PostScript document} @item{@racket['eps-bytes] --- a byte string containing an Encapsulated PostScript document}
@item{@scheme['pdf-bytes] --- a byte string containing a PDF document} @item{@racket['pdf-bytes] --- a byte string containing a PDF document}
@item{@scheme['pdf-bytes+bounds] --- a list containing a byte string and four numbers; @item{@racket['pdf-bytes+bounds] --- a list containing a byte string and four numbers;
the byte string contains a PDF document and the four numbers are sizing information for the PDF document, the byte string contains a PDF document and the four numbers are sizing information for the PDF document,
namely the width, height, ascent and descent in that order} namely the width, height, ascent and descent in that order}
] ]

View File

@ -7,29 +7,29 @@
@defmodule[file/gif] @defmodule[file/gif]
The @schememodname[file/gif] library provides functions for The @racketmodname[file/gif] library provides functions for
writing GIF files to a stream, including GIF files with multiple writing GIF files to a stream, including GIF files with multiple
images and controls (such as animated GIFs). images and controls (such as animated GIFs).
A GIF stream is created by @scheme[gif-start], and then individual A GIF stream is created by @racket[gif-start], and then individual
images are written with @scheme[gif-add-image]. Optionally, images are written with @racket[gif-add-image]. Optionally,
@scheme[gif-add-control] inserts instructions for rendering the @racket[gif-add-control] inserts instructions for rendering the
images. The @scheme[gif-end] function ends the GIF stream. images. The @racket[gif-end] function ends the GIF stream.
A GIF stream can be in any one of the following states: A GIF stream can be in any one of the following states:
@itemize[ @itemize[
@item{@scheme['init] : no images or controls have been added to the @item{@racket['init] : no images or controls have been added to the
stream} stream}
@item{@scheme['image-or-control] : another image or control can be @item{@racket['image-or-control] : another image or control can be
written} written}
@item{@scheme['image] : another image can be written (but not a @item{@racket['image] : another image can be written (but not a
control, since a control was written)} control, since a control was written)}
@item{@scheme['done] : nothing more can be added} @item{@racket['done] : nothing more can be added}
] ]

View File

@ -3,7 +3,7 @@
@title[#:tag "gunzip"]{@exec{gzip} Decompression} @title[#:tag "gunzip"]{@exec{gzip} Decompression}
@defmodule[file/gunzip]{The @schememodname[file/gunzip] library provides @defmodule[file/gunzip]{The @racketmodname[file/gunzip] library provides
utilities to decompress archive files in @exec{gzip} format, or simply utilities to decompress archive files in @exec{gzip} format, or simply
to deccompress data using the @exec{pkzip} ``inflate'' method.} to deccompress data using the @exec{pkzip} ``inflate'' method.}
@ -14,36 +14,36 @@ to deccompress data using the @exec{pkzip} ``inflate'' method.}
void?]{ void?]{
Extracts data that was compressed using the @exec{gzip} utility (or Extracts data that was compressed using the @exec{gzip} utility (or
@scheme[gzip] function), writing the uncompressed data directly to a @racket[gzip] function), writing the uncompressed data directly to a
file. The @scheme[file] argument is the name of the file containing file. The @racket[file] argument is the name of the file containing
compressed data. The default output file name is the original name of compressed data. The default output file name is the original name of
the compressed file as stored in @scheme[file]. If a file by this name the compressed file as stored in @racket[file]. If a file by this name
exists, it will be overwritten. If no original name is stored in the exists, it will be overwritten. If no original name is stored in the
source file, @scheme["unzipped"] is used as the default output file source file, @racket["unzipped"] is used as the default output file
name. name.
The @scheme[output-name-filter] procedure is applied to two The @racket[output-name-filter] procedure is applied to two
arguments---the default destination file name and a boolean that is arguments---the default destination file name and a boolean that is
@scheme[#t] if this name was read from @scheme[file]---before the @racket[#t] if this name was read from @racket[file]---before the
destination file is created. The return value of the file is used as destination file is created. The return value of the file is used as
the actual destination file name (to be opened with the the actual destination file name (to be opened with the
@scheme['truncate] flag of @scheme[open-output-file]). @racket['truncate] flag of @racket[open-output-file]).
If the compressed data turns out to be corrupted, the If the compressed data turns out to be corrupted, the
@scheme[exn:fail] exception is raised.} @racket[exn:fail] exception is raised.}
@defproc[(gunzip-through-ports [in input-port?] @defproc[(gunzip-through-ports [in input-port?]
[out output-port?]) [out output-port?])
void?]{ void?]{
Reads the port @scheme[in] for compressed data that was created using Reads the port @racket[in] for compressed data that was created using
the @exec{gzip} utility, writing the uncompressed data to the port the @exec{gzip} utility, writing the uncompressed data to the port
@scheme[out]. @racket[out].
If the compressed data turns out to be corrupted, the If the compressed data turns out to be corrupted, the
@scheme[exn:fail] exception is raised. The unzipping process may peek @racket[exn:fail] exception is raised. The unzipping process may peek
further into @scheme[in] than needed to decompress the data, but it further into @racket[in] than needed to decompress the data, but it
will not consume the unneeded bytes.} will not consume the unneeded bytes.}
@ -51,12 +51,12 @@ will not consume the unneeded bytes.}
[out output-port?]) [out output-port?])
void?]{ void?]{
Reads @exec{pkzip}-format ``deflated'' data from the port @scheme[in] Reads @exec{pkzip}-format ``deflated'' data from the port @racket[in]
and writes the uncompressed (``inflated'') data to the port and writes the uncompressed (``inflated'') data to the port
@scheme[out]. The data in a file created by @exec{gzip} uses this @racket[out]. The data in a file created by @exec{gzip} uses this
format (preceded with some header information). format (preceded with some header information).
If the compressed data turns out to be corrupted, the If the compressed data turns out to be corrupted, the
@scheme[exn:fail] exception is raised. The inflate process may peek @racket[exn:fail] exception is raised. The inflate process may peek
further into @scheme[in] than needed to decompress the data, but it further into @racket[in] than needed to decompress the data, but it
will not consume the unneeded bytes.} will not consume the unneeded bytes.}

View File

@ -3,7 +3,7 @@
@title[#:tag "gzip"]{@exec{gzip} Compression and File Creation} @title[#:tag "gzip"]{@exec{gzip} Compression and File Creation}
@defmodule[file/gzip]{The @schememodname[file/gzip] library provides @defmodule[file/gzip]{The @racketmodname[file/gzip] library provides
utilities to create archive files in @exec{gzip} format, or simply to utilities to create archive files in @exec{gzip} format, or simply to
compress data using the @exec{pkzip} ``deflate'' method.} compress data using the @exec{pkzip} ``deflate'' method.}
@ -12,9 +12,9 @@ compress data using the @exec{pkzip} ``deflate'' method.}
void?]{ void?]{
Compresses data to the same format as the @exec{gzip} utility, writing Compresses data to the same format as the @exec{gzip} utility, writing
the compressed data directly to a file. The @scheme[in-file] argument the compressed data directly to a file. The @racket[in-file] argument
is the name of the file to compress. If the file named by is the name of the file to compress. If the file named by
@scheme[out-file] exists, it will be overwritten.} @racket[out-file] exists, it will be overwritten.}
@defproc[(gzip-through-ports [in input-port?] @defproc[(gzip-through-ports [in input-port?]
@ -23,13 +23,13 @@ is the name of the file to compress. If the file named by
[timestamp exact-integer?]) [timestamp exact-integer?])
void?]{ void?]{
Reads the port @scheme[in] for data and compresses it to @scheme[out], Reads the port @racket[in] for data and compresses it to @racket[out],
outputting the same format as the @exec{gzip} utility. The outputting the same format as the @exec{gzip} utility. The
@scheme[orig-filename] string is embedded in this output; @racket[orig-filename] string is embedded in this output;
@scheme[orig-filename] can be @scheme[#f] to omit the filename from @racket[orig-filename] can be @racket[#f] to omit the filename from
the compressed stream. The @scheme[timestamp] number is also embedded the compressed stream. The @racket[timestamp] number is also embedded
in the output stream, as the modification date of the original file in the output stream, as the modification date of the original file
(in Unix seconds, as @scheme[file-or-directory-modify-seconds] would (in Unix seconds, as @racket[file-or-directory-modify-seconds] would
report on Unix).} report on Unix).}
@ -39,11 +39,11 @@ report on Unix).}
exact-nonnegative-integer? exact-nonnegative-integer?
exact-nonnegative-integer?)]{ exact-nonnegative-integer?)]{
Writes @exec{pkzip}-format ``deflated'' data to the port @scheme[out], Writes @exec{pkzip}-format ``deflated'' data to the port @racket[out],
compressing data from the port @scheme[in]. The data in a file compressing data from the port @racket[in]. The data in a file
created by @exec{gzip} uses this format (preceded with header created by @exec{gzip} uses this format (preceded with header
information). information).
The result is three values: the number of bytes read from @scheme[in], The result is three values: the number of bytes read from @racket[in],
the number of bytes written to @scheme[out], and a cyclic redundancy the number of bytes written to @racket[out], and a cyclic redundancy
check (CRC) value for the input.} check (CRC) value for the input.}

View File

@ -13,10 +13,10 @@ See @racketmodname[openssl/sha1] for a faster implementation.
@defproc[(sha1 [in input-port]) string?]{ @defproc[(sha1 [in input-port]) string?]{
Returns a 40-character string that represents the SHA-1 hash (in Returns a 40-character string that represents the SHA-1 hash (in
hexadecimal notation) of the content from @scheme[in], consuming all hexadecimal notation) of the content from @racket[in], consuming all
of the input from @scheme[in] until an end-of-file. of the input from @racket[in] until an end-of-file.
The @scheme[sha1] function composes @scheme[bytes->hex-string] with The @racket[sha1] function composes @racket[bytes->hex-string] with
@racket[sha1-bytes]. @racket[sha1-bytes].
@examples[ @examples[
@ -27,7 +27,7 @@ The @scheme[sha1] function composes @scheme[bytes->hex-string] with
@defproc[(sha1-bytes [in input-port]) bytes?]{ @defproc[(sha1-bytes [in input-port]) bytes?]{
Returns a 20-byte byte string that represents the SHA-1 hash of the Returns a 20-byte byte string that represents the SHA-1 hash of the
content from @scheme[in], consuming all of the input from @scheme[in] content from @racket[in], consuming all of the input from @racket[in]
until an end-of-file. until an end-of-file.
@examples[ @examples[
@ -38,5 +38,5 @@ until an end-of-file.
@defproc[(bytes->hex-string [bstr bytes?]) string?]{ @defproc[(bytes->hex-string [bstr bytes?]) string?]{
Converts the given byte string to a string representation, where each Converts the given byte string to a string representation, where each
byte in @scheme[bstr] is converted to its two-digit hexadecimal byte in @racket[bstr] is converted to its two-digit hexadecimal
representation in the resulting string.} representation in the resulting string.}

View File

@ -3,7 +3,7 @@
@title[#:tag "tar"]{@exec{tar} File Creation} @title[#:tag "tar"]{@exec{tar} File Creation}
@defmodule[file/tar]{The @schememodname[file/tar] library provides @defmodule[file/tar]{The @racketmodname[file/tar] library provides
utilities to create archive files in USTAR format, like the archive utilities to create archive files in USTAR format, like the archive
that the Unix utility @exec{pax} generates. The USTAR format imposes that the Unix utility @exec{pax} generates. The USTAR format imposes
limits on path lengths. The resulting archives contain only limits on path lengths. The resulting archives contain only
@ -14,26 +14,26 @@ is always ``root.''}
@defproc[(tar [tar-file path-string?][path path-string?] ...) @defproc[(tar [tar-file path-string?][path path-string?] ...)
exact-nonnegative-integer?]{ exact-nonnegative-integer?]{
Creates @scheme[tar-file], which holds the complete content of all Creates @racket[tar-file], which holds the complete content of all
@scheme[path]s. The given @scheme[path]s are all expected to be @racket[path]s. The given @racket[path]s are all expected to be
relative path names of existing directories and files (i.e., relative relative path names of existing directories and files (i.e., relative
to the current directory). If a nested path is provided as a to the current directory). If a nested path is provided as a
@scheme[path], its ancestor directories are also added to the @racket[path], its ancestor directories are also added to the
resulting tar file, up to the current directory (using resulting tar file, up to the current directory (using
@scheme[pathlist-closure]).} @racket[pathlist-closure]).}
@defproc[(tar->output [paths (listof path?)] @defproc[(tar->output [paths (listof path?)]
[out output-port? (current-output-port)]) [out output-port? (current-output-port)])
exact-nonnegative-integer?]{ exact-nonnegative-integer?]{
Packages each of the given @scheme[paths] in a @exec{tar} format Packages each of the given @racket[paths] in a @exec{tar} format
archive that is written directly to the @scheme[out]. The specified archive that is written directly to the @racket[out]. The specified
@scheme[paths] are included as-is; if a directory is specified, its @racket[paths] are included as-is; if a directory is specified, its
content is not automatically added, and nested directories are added content is not automatically added, and nested directories are added
without parent directories.} without parent directories.}
@defproc[(tar-gzip [tar-file path-string?] [paths path-string?] ...) @defproc[(tar-gzip [tar-file path-string?] [paths path-string?] ...)
void?]{ void?]{
Like @scheme[tar], but compresses the resulting file with @scheme[gzip]. Like @racket[tar], but compresses the resulting file with @racket[gzip].
} }

View File

@ -3,24 +3,24 @@
@title[#:tag "zip"]{@exec{zip} File Creation} @title[#:tag "zip"]{@exec{zip} File Creation}
@defmodule[file/zip]{The @schememodname[file/zip] library provides @defmodule[file/zip]{The @racketmodname[file/zip] library provides
utilities to create @exec{zip} archive files, which are compatible utilities to create @exec{zip} archive files, which are compatible
with both Windows and Unix (including Mac OS X) unpacking. The actual with both Windows and Unix (including Mac OS X) unpacking. The actual
compression is implemented by @scheme[deflate].} compression is implemented by @racket[deflate].}
@defproc[(zip [zip-file path-string?][path path-string?] ...) @defproc[(zip [zip-file path-string?][path path-string?] ...)
void?]{ void?]{
Creates @scheme[zip-file], which holds the complete content of all Creates @racket[zip-file], which holds the complete content of all
@scheme[path]s. The given @scheme[path]s are all expected to be @racket[path]s. The given @racket[path]s are all expected to be
relative path names of existing directories and files (i.e., relative relative path names of existing directories and files (i.e., relative
to the current directory). If a nested path is provided as a to the current directory). If a nested path is provided as a
@scheme[path], its ancestor directories are also added to the @racket[path], its ancestor directories are also added to the
resulting zip file, up to the current directory (using resulting zip file, up to the current directory (using
@scheme[pathlist-closure]). Files are packaged as usual for @racket[pathlist-closure]). Files are packaged as usual for
@exec{zip} files, including permission bits for both Windows and Unix @exec{zip} files, including permission bits for both Windows and Unix
(including Mac OS X). The permission bits are determined by (including Mac OS X). The permission bits are determined by
@scheme[file-or-directory-permissions], which does not preserve the @racket[file-or-directory-permissions], which does not preserve the
distinction between owner/group/other permissions. Also, symbolic distinction between owner/group/other permissions. Also, symbolic
links are always followed.} links are always followed.}
@ -29,16 +29,16 @@ links are always followed.}
[out output-port? (current-output-port)]) [out output-port? (current-output-port)])
void?]{ void?]{
Zips each of the given @scheme[paths], and packages it as a zip Zips each of the given @racket[paths], and packages it as a zip
``file'' that is written directly to @scheme[out]. Unlike ``file'' that is written directly to @racket[out]. Unlike
@scheme[zip], the specified @scheme[paths] are included as-is; if a @racket[zip], the specified @racket[paths] are included as-is; if a
directory is specified, its content is not automatically added, and directory is specified, its content is not automatically added, and
nested directories are added without parent directories.} nested directories are added without parent directories.}
@defboolparam[zip-verbose on?]{ @defboolparam[zip-verbose on?]{
A parameter that controls output during a @scheme[zip] A parameter that controls output during a @racket[zip]
operation. Setting this parameter to a true value causes @scheme[zip] operation. Setting this parameter to a true value causes @racket[zip]
to display to @scheme[(current-error-port)] the filename that is to display to @racket[(current-error-port)] the filename that is
currently being compressed.} currently being compressed.}

View File

@ -41,8 +41,6 @@
(trim-string (regexp-replace* #rx"(&)" a-str "\\1\\1") (trim-string (regexp-replace* #rx"(&)" a-str "\\1\\1")
maximum-string-label-length)) maximum-string-label-length))
;; selected-text-color : color ;; selected-text-color : color
(define selected-text-color (send the-color-database find-color "black")) (define selected-text-color (send the-color-database find-color "black"))
@ -302,7 +300,7 @@
(λ (str) (λ (str)
((string-length str) . <= . size)))]) ((string-length str) . <= . size)))])
@{Constructs a string whose size is less @{Constructs a string whose size is less
than @scheme[size] by trimming the @scheme[str] than @racket[size] by trimming the @racket[str]
and inserting an ellispses into it.}) and inserting an ellispses into it.})
(proc-doc (proc-doc
@ -334,12 +332,12 @@
gui-utils:cancel-on-right? gui-utils:cancel-on-right?
(-> boolean?) (-> boolean?)
() ()
@{Returns @scheme[#t] if cancel should be on the right-hand side (or below) @{Returns @racket[#t] if cancel should be on the right-hand side (or below)
in a dialog and @scheme[#f] otherwise. in a dialog and @racket[#f] otherwise.
Just returns what @scheme[system-position-ok-before-cancel?] does. Just returns what @racket[system-position-ok-before-cancel?] does.
See also @scheme[gui-utils:ok/cancel-buttons].}) See also @racket[gui-utils:ok/cancel-buttons].})
(proc-doc/names (proc-doc/names
gui-utils:ok/cancel-buttons gui-utils:ok/cancel-buttons
(->* ((is-a?/c area-container<%>) (->* ((is-a?/c area-container<%>)
@ -365,12 +363,12 @@
The first result is be the OK button and the second is The first result is be the OK button and the second is
the cancel button. the cancel button.
By default, the confirmation action button has the @scheme['(border)] style, By default, the confirmation action button has the @racket['(border)] style,
meaning that hitting return in the dialog will trigger the confirmation action. meaning that hitting return in the dialog will trigger the confirmation action.
The @racket[confirm-style] argument can override this behavior, tho. The @racket[confirm-style] argument can override this behavior, tho.
See @racket[button%] for the precise list of allowed styles. See @racket[button%] for the precise list of allowed styles.
See also @scheme[gui-utils:cancel-on-right?].}) See also @racket[gui-utils:cancel-on-right?].})
(proc-doc/names (proc-doc/names
gui-utils:next-untitled-name gui-utils:next-untitled-name
@ -390,13 +388,13 @@
The first case in the case lambda The first case in the case lambda
returns the current delay in seconds before a watch cursor is shown, returns the current delay in seconds before a watch cursor is shown,
when either @scheme[gui-utils:local-busy-cursor] or when either @racket[gui-utils:local-busy-cursor] or
@scheme[gui-utils:show-busy-cursor] is called. @racket[gui-utils:show-busy-cursor] is called.
The second case in the case lambda The second case in the case lambda
Sets the delay, in seconds, before a watch cursor is shown, when Sets the delay, in seconds, before a watch cursor is shown, when
either @scheme[gui-utils:local-busy-cursor] or either @racket[gui-utils:local-busy-cursor] or
@scheme[gui-utils:show-busy-cursor] is called.}) @racket[gui-utils:show-busy-cursor] is called.})
(proc-doc/names (proc-doc/names
gui-utils:show-busy-cursor gui-utils:show-busy-cursor
(->* ((-> any/c)) (->* ((-> any/c))
@ -404,12 +402,12 @@
any/c) any/c)
((thunk) ((thunk)
((delay (gui-utils:cursor-delay)))) ((delay (gui-utils:cursor-delay))))
@{Evaluates @scheme[(thunk)] with a watch cursor. The argument @{Evaluates @racket[(thunk)] with a watch cursor. The argument
@scheme[delay] specifies the amount of time before the watch cursor is @racket[delay] specifies the amount of time before the watch cursor is
opened. Use @scheme[gui-utils:cursor-delay] to set this value opened. Use @racket[gui-utils:cursor-delay] to set this value
to all calls. to all calls.
This function returns the result of @scheme[thunk].}) This function returns the result of @racket[thunk].})
(proc-doc/names (proc-doc/names
gui-utils:delay-action gui-utils:delay-action
(real? (real?
@ -424,7 +422,7 @@
to appear after 2 seconds and the action may or may not take more than to appear after 2 seconds and the action may or may not take more than
two seconds, use this pattern: two seconds, use this pattern:
@schemeblock[(let ([close-down @racketblock[(let ([close-down
(gui-utils:delay-action (gui-utils:delay-action
2 2
(λ () .. init watch cursor ...) (λ () .. init watch cursor ...)
@ -432,11 +430,11 @@
;; .. do action ... ;; .. do action ...
(close-down))] (close-down))]
Creates a thread that waits @scheme[delay-time]. After @scheme[delay-time] Creates a thread that waits @racket[delay-time]. After @racket[delay-time]
has elapsed, if the result thunk has @italic{not} been called, call has elapsed, if the result thunk has @italic{not} been called, call
@scheme[open]. Then, when the result thunk is called, call @racket[open]. Then, when the result thunk is called, call
@scheme[close]. The function @scheme[close] will only be called if @racket[close]. The function @racket[close] will only be called if
@scheme[open] has been called.}) @racket[open] has been called.})
(proc-doc/names (proc-doc/names
gui-utils:local-busy-cursor gui-utils:local-busy-cursor
@ -447,13 +445,13 @@
any/c) any/c)
((window thunk) ((window thunk)
((delay (gui-utils:cursor-delay)))) ((delay (gui-utils:cursor-delay))))
@{Evaluates @scheme[(thunk)] with a watch cursor in @scheme[window]. If @{Evaluates @racket[(thunk)] with a watch cursor in @racket[window]. If
@scheme[window] is @scheme[#f], the watch cursor is turned on globally. @racket[window] is @racket[#f], the watch cursor is turned on globally.
The argument @scheme[delay] specifies the amount of time before the watch The argument @racket[delay] specifies the amount of time before the watch
cursor is opened. Use @scheme[gui-utils:cursor-delay] cursor is opened. Use @racket[gui-utils:cursor-delay]
to set this value for all uses of this function. to set this value for all uses of this function.
The result of this function is the result of @scheme[thunk].}) The result of this function is the result of @racket[thunk].})
(proc-doc/names (proc-doc/names
gui-utils:unsaved-warning gui-utils:unsaved-warning
@ -473,17 +471,17 @@
@{This displays a dialog that warns the user of a unsaved file. @{This displays a dialog that warns the user of a unsaved file.
The string, @scheme[action], indicates what action is about to The string, @racket[action], indicates what action is about to
take place, without saving. For example, if the application take place, without saving. For example, if the application
is about to close a file, a good action is @scheme["Close" "Anyway"]. is about to close a file, a good action is @racket["Close" "Anyway"].
The result symbol indicates the user's choice. If The result symbol indicates the user's choice. If
@scheme[can-save-now?] is @scheme[#f], this function does not @racket[can-save-now?] is @racket[#f], this function does not
give the user the ``Save'' option and thus will not return give the user the ``Save'' option and thus will not return
@scheme['save]. @racket['save].
If @scheme[cancel?] is @scheme[#t] there is a cancel button If @racket[cancel?] is @racket[#t] there is a cancel button
in the dialog and the result may be @scheme['cancel]. If it in the dialog and the result may be @racket['cancel]. If it
is @scheme[#f], then there is no cancel button, and @scheme['cancel] is @racket[#f], then there is no cancel button, and @racket['cancel]
will not be the result of the function. will not be the result of the function.
}) })
@ -514,30 +512,30 @@
dialog opens a message box asking the user to actually choose one of the dialog opens a message box asking the user to actually choose one of the
two options. two options.
The dialog will contain the string @scheme[message] and two buttons, The dialog will contain the string @racket[message] and two buttons,
labeled with the @scheme[true-choice] and the @scheme[false-choice]. If the labeled with the @racket[true-choice] and the @racket[false-choice]. If the
user clicks on @scheme[true-choice] @scheme[#t] is returned. If the user user clicks on @racket[true-choice] @racket[#t] is returned. If the user
clicks on @scheme[false-choice], @scheme[#f] is returned. clicks on @racket[false-choice], @racket[#f] is returned.
The argument @scheme[default-result] determines how closing the window is The argument @racket[default-result] determines how closing the window is
treated. If the argument is @scheme['disallow-close], closing the window treated. If the argument is @racket['disallow-close], closing the window
is not allowed. If it is anything else, that value is returned when is not allowed. If it is anything else, that value is returned when
the user closes the window. the user closes the window.
If @scheme[gui-utils:cancel-on-right?] If @racket[gui-utils:cancel-on-right?]
returns @scheme[#t], the false choice is on the right. returns @racket[#t], the false choice is on the right.
Otherwise, the true choice is on the right. Otherwise, the true choice is on the right.
The @scheme[style] parameter is (eventually) passed to The @racket[style] parameter is (eventually) passed to
@scheme[message] @racket[message]
as an icon in the dialog. as an icon in the dialog.
If @scheme[checkbox-proc] is given, it should be a procedure that behaves If @racket[checkbox-proc] is given, it should be a procedure that behaves
like a parameter for getting/setting a boolean value. The intention for like a parameter for getting/setting a boolean value. The intention for
this value is that it can be used to disable the dialog. When it is this value is that it can be used to disable the dialog. When it is
given, a checkbox will appear with a @scheme[checkbox-label] label given, a checkbox will appear with a @racket[checkbox-label] label
(defaults to the @scheme[dont-ask-again] string constant), and that (defaults to the @racket[dont-ask-again] string constant), and that
checkbox value will be sent to the @scheme[checkbox-proc] when the dialog checkbox value will be sent to the @racket[checkbox-proc] when the dialog
is closed. Note that the dialog will always pop-up --- it is the is closed. Note that the dialog will always pop-up --- it is the
caller's responsibility to avoid the dialog if not needed.}) caller's responsibility to avoid the dialog if not needed.})
@ -550,13 +548,13 @@
((white-on-black? #f))) ((white-on-black? #f)))
@{This delta is designed for use with @{This delta is designed for use with
@method[text set-clickback]. @method[text set-clickback].
Use it as one of the @scheme[style-delta%] argument to Use it as one of the @racket[style-delta%] argument to
@method[text% set-clickback]. @method[text% set-clickback].
If @scheme[white-on-black?] is true, the function returns If @racket[white-on-black?] is true, the function returns
a delta suitable for use on a black background. a delta suitable for use on a black background.
See also @scheme[gui-utils:get-clickback-delta].}) See also @racket[gui-utils:get-clickback-delta].})
(proc-doc/names (proc-doc/names
gui-utils:get-clickback-delta gui-utils:get-clickback-delta
@ -569,8 +567,8 @@
Use the result of this function as the style Use the result of this function as the style
for the region text where the clickback is set. for the region text where the clickback is set.
If @scheme[white-on-black?] is true, the function returns If @racket[white-on-black?] is true, the function returns
a delta suitable for use on a black background. a delta suitable for use on a black background.
See also See also
@scheme[gui-utils:get-clicked-clickback-delta].})) @racket[gui-utils:get-clicked-clickback-delta].}))

File diff suppressed because it is too large Load Diff

View File

@ -155,7 +155,7 @@
[(an-item? x) [(an-item? x)
(pop-out (pop-out
`@defmethod[(,(an-item->get-item-name x)) (or/c false/c (is-a?/c menu-item%))]{ `@defmethod[(,(an-item->get-item-name x)) (or/c false/c (is-a?/c menu-item%))]{
This method returns the @scheme[menu-item%] object corresponding This method returns the @racket[menu-item%] object corresponding
to this menu item, if it has been created (as controlled by to this menu item, if it has been created (as controlled by
@method[frame:standard-menus<%> ,(an-item->create-menu-item-name x)]).}) @method[frame:standard-menus<%> ,(an-item->create-menu-item-name x)]).})
@ -164,7 +164,7 @@
The result of this method determines if the corresponding The result of this method determines if the corresponding
menu item is created. Override it to control the creation of the menu item. menu item is created. Override it to control the creation of the menu item.
Defaults to @scheme[,(an-item-create x)].}) Defaults to @racket[,(an-item-create x)].})
(match (an-item-proc x) (match (an-item-proc x)
[`(λ (,item-name ,evt-name) ,bodies ...) [`(λ (,item-name ,evt-name) ,bodies ...)
@ -173,7 +173,7 @@
[,item-name (is-a?/c menu-item%)] [,item-name (is-a?/c menu-item%)]
[,evt-name (is-a?/c control-event%)]) [,evt-name (is-a?/c control-event%)])
void?]{ void?]{
Defaults to @schemeblock[,(if (= 1 (length bodies)) Defaults to @racketblock[,(if (= 1 (length bodies))
(car bodies) (car bodies)
`(begin ,@bodies))] })]) `(begin ,@bodies))] })])
@ -183,20 +183,20 @@
`@defmethod[(,(an-item->on-demand-name x) [,item-name (is-a?/c menu-item%)]) void?]{ `@defmethod[(,(an-item->on-demand-name x) [,item-name (is-a?/c menu-item%)]) void?]{
The menu item's on-demand proc calls this method. The menu item's on-demand proc calls this method.
Defaults to @schemeblock[,body]})]) Defaults to @racketblock[,body]})])
(pop-out (pop-out
`@defmethod[(,(an-item->string-name x)) string?]{ `@defmethod[(,(an-item->string-name x)) string?]{
The result of this method is used as the name of the @scheme[menu-item%]. The result of this method is used as the name of the @racket[menu-item%].
Defaults to @scheme[,(an-item-menu-string x)].}) Defaults to @racket[,(an-item-menu-string x)].})
(pop-out (pop-out
`@defmethod[(,(an-item->help-string-name x)) string?]{ `@defmethod[(,(an-item->help-string-name x)) string?]{
The result of this method is used as the help string The result of this method is used as the help string
when the @scheme[menu-item%] object is created. when the @racket[menu-item%] object is created.
Defaults to @scheme[,(an-item-help-string x)].})])) Defaults to @racket[,(an-item-help-string x)].})]))
items) items)
(display docs-footer-text port)) (display docs-footer-text port))
@ -283,5 +283,6 @@
@definterface[frame:standard-menus<%> (frame:basic<%>)]{ @definterface[frame:standard-menus<%> (frame:basic<%>)]{
-- --
) )

View File

@ -155,7 +155,7 @@
The result of this method is used as the class for creating The result of this method is used as the class for creating
the menu items in this frame. the menu items in this frame.
Defaultly returns @scheme[menu:can-restore-menu-item].})) Defaultly returns @racket[menu:can-restore-menu-item].}))
(make-generic-method (make-generic-method
'get-checkable-menu-item% '(λ () menu:can-restore-checkable-menu-item%) 'get-checkable-menu-item% '(λ () menu:can-restore-checkable-menu-item%)
(list (list
@ -163,7 +163,7 @@
The result of this method is used as the class for creating The result of this method is used as the class for creating
checkable menu items in this class. checkable menu items in this class.
Defaultly returns @scheme[menu:can-restore-checkable-menu-item].})) Defaultly returns @racket[menu:can-restore-checkable-menu-item].}))
(make-generic-method (make-generic-method
'get-file-menu 'get-file-menu

View File

@ -854,7 +854,7 @@
(λ (c) (eq? c btn)))))) (λ (c) (eq? c btn))))))
void?) void?)
(button) (button)
@{Simulates pushing @scheme[button]. If a string is supplied, the @{Simulates pushing @racket[button]. If a string is supplied, the
primitive searches for a button labelled with that string in the primitive searches for a button labelled with that string in the
active frame. Otherwise, it pushes the button argument.}) active frame. Otherwise, it pushes the button argument.})
@ -862,52 +862,52 @@
test:set-radio-box! test:set-radio-box!
(-> (or/c string? regexp? (is-a?/c radio-box%)) (or/c string? number?) void?) (-> (or/c string? regexp? (is-a?/c radio-box%)) (or/c string? number?) void?)
(radio-box state) (radio-box state)
@{Sets the radio-box to the label matching @scheme[state]. If @scheme[state] is a @{Sets the radio-box to the label matching @racket[state]. If @racket[state] is a
string, this function finds the choice with that label. string, this function finds the choice with that label.
If it is a regexp, this function finds the first choice whose label matches the regexp. If it is a regexp, this function finds the first choice whose label matches the regexp.
If it is a number, it uses the number as an index into the If it is a number, it uses the number as an index into the
state. If the number is out of range or if the label isn't state. If the number is out of range or if the label isn't
in the radio box, an exception is raised. in the radio box, an exception is raised.
If @scheme[radio-box] is a string, this function searches for a If @racket[radio-box] is a string, this function searches for a
@scheme[radio-box%] object with a label matching that string, @racket[radio-box%] object with a label matching that string,
otherwise it uses @scheme[radio-box] itself.}) otherwise it uses @racket[radio-box] itself.})
(proc-doc/names (proc-doc/names
test:set-radio-box-item! test:set-radio-box-item!
(-> (or/c string? regexp?) void?) (-> (or/c string? regexp?) void?)
(entry) (entry)
@{Finds a @scheme[radio-box%] that has a label matching @scheme[entry] @{Finds a @racket[radio-box%] that has a label matching @racket[entry]
and sets the radio-box to @scheme[entry].}) and sets the radio-box to @racket[entry].})
(proc-doc/names (proc-doc/names
test:set-check-box! test:set-check-box!
(-> (or/c string? (is-a?/c check-box%)) boolean? void?) (-> (or/c string? (is-a?/c check-box%)) boolean? void?)
(check-box state) (check-box state)
@{Clears the @scheme[check-box%] item if @scheme[state] is @scheme[#f], and sets it @{Clears the @racket[check-box%] item if @racket[state] is @racket[#f], and sets it
otherwise. otherwise.
If @scheme[check-box] is a string, If @racket[check-box] is a string,
this function searches for a @scheme[check-box%] with a label matching that string, this function searches for a @racket[check-box%] with a label matching that string,
otherwise it uses @scheme[check-box] itself.}) otherwise it uses @racket[check-box] itself.})
(proc-doc/names (proc-doc/names
test:set-choice! test:set-choice!
(-> (or/c string? (is-a?/c choice%)) (or/c string? (and/c number? exact? integer? positive?)) (-> (or/c string? (is-a?/c choice%)) (or/c string? (and/c number? exact? integer? positive?))
void?) void?)
(choice str) (choice str)
@{Selects @scheme[choice]'s item @scheme[str]. If @scheme[choice] is a string, @{Selects @racket[choice]'s item @racket[str]. If @racket[choice] is a string,
this function searches for a @scheme[choice%] with a label matching this function searches for a @racket[choice%] with a label matching
that string, otherwise it uses @scheme[choice] itself.}) that string, otherwise it uses @racket[choice] itself.})
(proc-doc/names (proc-doc/names
test:set-list-box! test:set-list-box!
(-> (or/c string? (is-a?/c list-box%)) (or/c string? (and/c number? exact? integer? positive?)) (-> (or/c string? (is-a?/c list-box%)) (or/c string? (and/c number? exact? integer? positive?))
void?) void?)
(choice str) (choice str)
@{Selects @scheme[list-box]'s item @scheme[str]. If @scheme[list-box] is a string, @{Selects @racket[list-box]'s item @racket[str]. If @racket[list-box] is a string,
this function searches for a @scheme[list-box%] with a label matching this function searches for a @racket[list-box%] with a label matching
that string, otherwise it uses @scheme[list-box] itself.}) that string, otherwise it uses @racket[list-box] itself.})
(proc-doc/names (proc-doc/names
test:keystroke test:keystroke
@ -916,19 +916,19 @@
void?) void?)
((key) ((key)
((modifier-list null))) ((modifier-list null)))
@{This function simulates a user pressing a key. The argument, @scheme[key], @{This function simulates a user pressing a key. The argument, @racket[key],
is just like the argument to the is just like the argument to the
@method[key-event% get-key-code] @method[key-event% get-key-code]
method of the @scheme[key-event%] class. method of the @racket[key-event%] class.
@italic{Note:} @italic{Note:}
To send the ``Enter'' key, use @scheme[#\return], To send the ``Enter'' key, use @racket[#\return],
not @scheme[#\newline]. not @racket[#\newline].
The @scheme['shift] or @scheme['noshift] modifier is implicitly set from @scheme[key], The @racket['shift] or @racket['noshift] modifier is implicitly set from @racket[key],
but is overridden by the argument list. The @scheme['shift] modifier is but is overridden by the argument list. The @racket['shift] modifier is
set for any capitol alpha-numeric letters and any of the following characters: set for any capitol alpha-numeric letters and any of the following characters:
@schemeblock[ @racketblock[
#\? #\: #\~ #\\ #\| #\? #\: #\~ #\\ #\|
#\< #\> #\{ #\} #\[ #\] #\( #\) #\< #\> #\{ #\} #\[ #\] #\( #\)
#\! #\@ #\# #\$ #\% #\^ #\& #\* #\_ #\+ #\! #\@ #\# #\$ #\% #\^ #\& #\* #\_ #\+
@ -940,7 +940,7 @@
test:menu-select test:menu-select
(string? string? . -> . void?) (string? string? . -> . void?)
(menu item) (menu item)
@{Selects the menu-item named @scheme[item] in the menu named @scheme[menu]. @{Selects the menu-item named @racket[item] in the menu named @racket[menu].
@italic{Note:} @italic{Note:}
The string for the menu item does not include its keyboard equivalent. The string for the menu item does not include its keyboard equivalent.
@ -958,17 +958,17 @@
((button x y) ((button x y)
((modifiers null))) ((modifiers null)))
@{Simulates a mouse click at the coordinate (x,y) in the currently @{Simulates a mouse click at the coordinate (x,y) in the currently
focused @scheme[window], assuming that it supports the focused @racket[window], assuming that it supports the
@method[canvas<%> on-event] method. @method[canvas<%> on-event] method.
Use @scheme[test:button-push] to click on a button. Use @racket[test:button-push] to click on a button.
On the Macintosh, @scheme['right] corresponds to holding down the command On the Macintosh, @racket['right] corresponds to holding down the command
modifier key while clicking and @scheme['middle] cannot be generated. modifier key while clicking and @racket['middle] cannot be generated.
Under Windows, @scheme['middle] can only be generated if the user has a Under Windows, @racket['middle] can only be generated if the user has a
three button mouse. three button mouse.
The modifiers later in the list @scheme[modifiers] take precedence over The modifiers later in the list @racket[modifiers] take precedence over
ones that appear earlier.}) ones that appear earlier.})
(proc-doc/names (proc-doc/names
@ -979,7 +979,7 @@
((msec) ()) ((msec) ())
@{See also @secref{test:actions-completeness}. @{See also @secref{test:actions-completeness}.
The first case in the case-lambda sets The first case in the case-lambda sets
the run interval to @scheme[msec] milliseconds and the second the run interval to @racket[msec] milliseconds and the second
returns the current setting.}) returns the current setting.})
(parameter-doc (parameter-doc
@ -991,7 +991,7 @@
(see also @secref[#:doc '(lib "scribblings/gui/gui.scrbl") "eventspaceinfo"]) (see also @secref[#:doc '(lib "scribblings/gui/gui.scrbl") "eventspaceinfo"])
are considered when finding the frontmost frame. are considered when finding the frontmost frame.
The first case The first case
sets the parameter to @scheme[func]. The procedure @scheme[func] will be sets the parameter to @racket[func]. The procedure @racket[func] will be
invoked with no arguments to determine the eventspaces to consider invoked with no arguments to determine the eventspaces to consider
when finding the frontmost frame for simulated user events. when finding the frontmost frame for simulated user events.
The second case The second case
@ -1011,8 +1011,8 @@
(-> (is-a?/c top-level-window<%>) void?) (-> (is-a?/c top-level-window<%>) void?)
(tlw) (tlw)
@{Use this function to simulate clicking on the close box of a frame. @{Use this function to simulate clicking on the close box of a frame.
Closes @scheme[tlw] with this expression: Closes @racket[tlw] with this expression:
@schemeblock[ @racketblock[
(when (send tlw can-close?) (when (send tlw can-close?)
(send tlw on-close) (send tlw on-close)
(send tlw show #f))]}) (send tlw show #f))]})
@ -1021,10 +1021,10 @@
test:top-level-focus-window-has? test:top-level-focus-window-has?
(-> (-> (is-a?/c area<%>) boolean?) boolean?) (-> (-> (is-a?/c area<%>) boolean?) boolean?)
(test) (test)
@{Calls @scheme[test] for each child of the top-level-focus-frame @{Calls @racket[test] for each child of the top-level-focus-frame
and returns @scheme[#t] if @scheme[test] ever does, otherwise and returns @racket[#t] if @racket[test] ever does, otherwise
returns @scheme[#f]. If there returns @racket[#f]. If there
is no top-level-focus-window, returns @scheme[#f].}) is no top-level-focus-window, returns @racket[#f].})
(proc-doc (proc-doc
@ -1041,6 +1041,4 @@
test:run-one test:run-one
(-> (-> void?) void?) (-> (-> void?) void?)
(f) (f)
@{Runs the function @scheme[f] as if it was a simulated event.})) @{Runs the function @racket[f] as if it was a simulated event.}))

View File

@ -16,12 +16,12 @@
@author["Greg Cooper"] @author["Greg Cooper"]
The @schememodname[frtime] language supports declarative construction of The @racketmodname[frtime] language supports declarative construction of
reactive systems in a syntax very similar to that of Racket. To reactive systems in a syntax very similar to that of Racket. To
interact with FrTime, select @onscreen{FrTime} from the @onscreen{Choose Language} menu. interact with FrTime, select @onscreen{FrTime} from the @onscreen{Choose Language} menu.
You can also make FrTime the language for a module: You can also make FrTime the language for a module:
@schemeblock[ @racketblock[
(module <module-name> frtime (module <module-name> frtime
<module-body>)] <module-body>)]
@ -31,45 +31,45 @@ You can also make FrTime the language for a module:
@defthing[undefined any/c]{stands for an undefined value.} @defthing[undefined any/c]{stands for an undefined value.}
@defproc[(undefined? [val any/c]) boolean?]{return @scheme[#t] iff @defproc[(undefined? [val any/c]) boolean?]{return @racket[#t] iff
@scheme[val] is @scheme[undefined].} @racket[val] is @racket[undefined].}
@defproc[(behavior? [val any/c]) boolean?]{returns @scheme[#t] iff @defproc[(behavior? [val any/c]) boolean?]{returns @racket[#t] iff
@scheme[val] is a behavior (a time-varying value whose current value can be @racket[val] is a behavior (a time-varying value whose current value can be
projected at any time).} projected at any time).}
@defproc[(event? [val any/c]) boolean?]{returns @scheme[#t] iff @defproc[(event? [val any/c]) boolean?]{returns @racket[#t] iff
@scheme[val] is an event (a time-varying stream of values that can occur @racket[val] is an event (a time-varying stream of values that can occur
at arbitrary times).} at arbitrary times).}
@defproc[(signal? [val any/c]) boolean?]{returns @scheme[#t] iff val @defproc[(signal? [val any/c]) boolean?]{returns @racket[#t] iff val
is a signal. @scheme[(signal? v)] is equivalent to @scheme[(or is a signal. @racket[(signal? v)] is equivalent to @racket[(or
(behavior? v) (event? v))].} (behavior? v) (event? v))].}
@defthing[seconds behavior?]{updates approximately once per second @defthing[seconds behavior?]{updates approximately once per second
with the value of @scheme[(current-seconds)].} with the value of @racket[(current-seconds)].}
@defthing[milliseconds behavior?]{updates frequently with the value of @defthing[milliseconds behavior?]{updates frequently with the value of
@scheme[(current-inexact-milliseconds)].} @racket[(current-inexact-milliseconds)].}
@defthing[never-e event?]{is an event that never occurs.} @defthing[never-e event?]{is an event that never occurs.}
@section{Defining Custom Input Signals} @section{Defining Custom Input Signals}
@defproc[(new-cell [init-expr signal? undefined]) signal? ]{returns a @defproc[(new-cell [init-expr signal? undefined]) signal? ]{returns a
signal whose values initially track that of @scheme[init-expr], but signal whose values initially track that of @racket[init-expr], but
that may be rewired to a different signal by @scheme[set-cell!].} that may be rewired to a different signal by @racket[set-cell!].}
@defproc[(set-cell! [cell signal?] [val signal?]) void?]{rewires @defproc[(set-cell! [cell signal?] [val signal?]) void?]{rewires
@scheme[cell] (which must have been created by @scheme[new-cell]) to @racket[cell] (which must have been created by @racket[new-cell]) to
take on the value(s) of @scheme[val].} take on the value(s) of @racket[val].}
@defproc[(event-receiver) event?]{returns an event stream that can be @defproc[(event-receiver) event?]{returns an event stream that can be
triggered imperatively by @scheme[send-event].} triggered imperatively by @racket[send-event].}
@defproc[(send-event [rcvr event?] [val any/c]) void?]{emits @defproc[(send-event [rcvr event?] [val any/c]) void?]{emits
@scheme[val] on @scheme[rcvr] (which must have been created by @racket[val] on @racket[rcvr] (which must have been created by
@scheme[event-receiver]).} @racket[event-receiver]).}
@section{Signal-Processing Procedures} @section{Signal-Processing Procedures}
@ -77,32 +77,32 @@ triggered imperatively by @scheme[send-event].}
a behavior or constant.} a behavior or constant.}
@defproc[(delay-by [val behavior?] [duration number?]) @defproc[(delay-by [val behavior?] [duration number?])
behavior?]{delays @scheme[val] by @scheme[duration] milliseconds.} behavior?]{delays @racket[val] by @racket[duration] milliseconds.}
@defproc[(integral [val (or/c number? behavior?)]) behavior?]{computes @defproc[(integral [val (or/c number? behavior?)]) behavior?]{computes
a numeric approximation of the integral of @scheme[val] with respect a numeric approximation of the integral of @racket[val] with respect
to time (measured in milliseconds).} to time (measured in milliseconds).}
@defproc[(derivative [val behavior?]) behavior?]{computes a numeric @defproc[(derivative [val behavior?]) behavior?]{computes a numeric
approximation of the derivative of @scheme[val] with respect to time.} approximation of the derivative of @racket[val] with respect to time.}
@deftogether[( @deftogether[(
@defproc[(map-e [proc (-> any/c any)] [ev event?]) event?] @defproc[(map-e [proc (-> any/c any)] [ev event?]) event?]
@defproc[([ev event?] . ==> . [proc (-> any/c any)]) event?] @defproc[([ev event?] . ==> . [proc (-> any/c any)]) event?]
)]{returns an event stream that fires whenever @scheme[ev] fires, whose )]{returns an event stream that fires whenever @racket[ev] fires, whose
values are transformed by application of @scheme[proc].} values are transformed by application of @racket[proc].}
@deftogether[( @deftogether[(
@defproc[(filter-e [pred (-> any/c boolean?)] [ev event?]) event?] @defproc[(filter-e [pred (-> any/c boolean?)] [ev event?]) event?]
@defproc[([ev event?] . =#> . [pred (-> any/c boolean?)]) event?])]{ @defproc[([ev event?] . =#> . [pred (-> any/c boolean?)]) event?])]{
returns an event stream that passes through only the values from returns an event stream that passes through only the values from
@scheme[ev] for which @scheme[pred] returns @scheme[#t].} @racket[ev] for which @racket[pred] returns @racket[#t].}
@defproc[(merge-e [ev event?] ...) event?]{merges all of the input @defproc[(merge-e [ev event?] ...) event?]{merges all of the input
event sources into a single event source.} event sources into a single event source.}
@defproc[(once-e [ev event?]) event?]{returns an event source that @defproc[(once-e [ev event?]) event?]{returns an event source that
carries only the first occurrence of @scheme[ev]. (The rest are carries only the first occurrence of @racket[ev]. (The rest are
filtered out.)} filtered out.)}
@defproc[(changes [val behavior?]) event?]{returns an event source @defproc[(changes [val behavior?]) event?]{returns an event source
@ -110,12 +110,12 @@ that occurs each time the argument behavior changes. The value of the
occurrence is the behavior's new value.} occurrence is the behavior's new value.}
@defproc[(hold [ev event?] [init any/c undefined]) behavior?]{ @defproc[(hold [ev event?] [init any/c undefined]) behavior?]{
constructs a behavior that starts out as @scheme[init] and then constructs a behavior that starts out as @racket[init] and then
takes on the last value produced by @scheme[ev]} takes on the last value produced by @racket[ev]}
@defproc[(switch [ev event?] [init behavior? undefined]) @defproc[(switch [ev event?] [init behavior? undefined])
behavior?]{returns a behavior that starts as @scheme[init]. Each time behavior?]{returns a behavior that starts as @racket[init]. Each time
@scheme[ev] yields a (potentially time-varying) value, the behavior @racket[ev] yields a (potentially time-varying) value, the behavior
switches to that value.} switches to that value.}
@defproc[(accum-e [ev event?] [init any/c]) event?]{constructs an event source @defproc[(accum-e [ev event?] [init any/c]) event?]{constructs an event source
@ -123,34 +123,34 @@ by accumulating changes (carried by the given event source) over an
initial value.} initial value.}
@defproc[(accum-b [ev event?] [init any/c]) behavior?]{combines functionality @defproc[(accum-b [ev event?] [init any/c]) behavior?]{combines functionality
from @scheme[accum-e] and @scheme[hold] to construct a behavior. from @racket[accum-e] and @racket[hold] to construct a behavior.
@scheme[(accum-b ev init)] is equivalent to @scheme[(hold init @racket[(accum-b ev init)] is equivalent to @racket[(hold init
(accum-e ev init))].} (accum-e ev init))].}
@defproc[(collect-e [ev event?] [init any/c] [proc (-> any/c any/c @defproc[(collect-e [ev event?] [init any/c] [proc (-> any/c any/c
any)]) event?]{is similar to @scheme[accum-e], except the transformer any)]) event?]{is similar to @racket[accum-e], except the transformer
function is fixed and is applied to the event occurrence and the function is fixed and is applied to the event occurrence and the
current accumulator (in that order).} current accumulator (in that order).}
@defproc[(collect-b [ev event?] [init any/c] [proc (-> any/c any/c any)]) behavior?]{is similar to @defproc[(collect-b [ev event?] [init any/c] [proc (-> any/c any/c any)]) behavior?]{is similar to
@scheme[collect-e] in the same way as @scheme[accum-b] is similar to @racket[collect-e] in the same way as @racket[accum-b] is similar to
@scheme[accum-e].} @racket[accum-e].}
@defproc[(when-e [val behavior?]) event?]{returns an event stream that @defproc[(when-e [val behavior?]) event?]{returns an event stream that
carries an occurrence each time @scheme[val] changes from @scheme[#f] to carries an occurrence each time @racket[val] changes from @racket[#f] to
anything else.} anything else.}
@defproc[(lift-strict [proc (-> [arg any/c] ... any)] [val any/c] ...) @defproc[(lift-strict [proc (-> [arg any/c] ... any)] [val any/c] ...)
any]{provides a mechanism for applying ordinary Scheme primitives to any]{provides a mechanism for applying ordinary Scheme primitives to
behaviors. If any of the @scheme[val]s are behaviors, returns a behaviors. If any of the @racket[val]s are behaviors, returns a
behavior whose current value is always equal to @scheme[(proc behavior whose current value is always equal to @racket[(proc
(value-now arg) ...)]. In FrTime, many Racket primitives are (value-now arg) ...)]. In FrTime, many Racket primitives are
implicitly lifted.} implicitly lifted.}
The following forms allow importation of lifted procedures that aren't The following forms allow importation of lifted procedures that aren't
included in the basic FrTime language. included in the basic FrTime language.
@schemeblock[ @racketblock[
(require (lifted module-spec proc-name ...) ...) (require (lifted module-spec proc-name ...) ...)
(require (lifted:nonstrict module-spec proc-name ...) ...) (require (lifted:nonstrict module-spec proc-name ...) ...)
] ]
@ -182,9 +182,9 @@ included in the basic FrTime language.
[stretchable-width any/c #t] [stretchable-width any/c #t]
[stretchable-height any/c #t] [stretchable-height any/c #t]
[shown any/c #f])]{ [shown any/c #f])]{
The constructor arguments are as in @scheme[frame%], except that @scheme[shown] The constructor arguments are as in @racket[frame%], except that @racket[shown]
@scheme[label], @scheme[enabled], @scheme[stretchable-width], and @racket[label], @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying.} @racket[stretchable-height] may be time-varying.}
} }
@defclass[ft-message% message% (control<%>)]{ @defclass[ft-message% message% (control<%>)]{
@ -194,7 +194,7 @@ The constructor arguments are as in @scheme[frame%], except that @scheme[shown]
[parent (or/c (is-a?/c frame%) (is-a?/c dialog%) [parent (or/c (is-a?/c frame%) (is-a?/c dialog%)
(is-a?/c panel%) (is-a?/c pane%))] (is-a?/c panel%) (is-a?/c pane%))]
[style (listof (one-of/c 'deleted)) null] [style (listof (one-of/c 'deleted)) null]
[font (is-a?/c font%) @scheme[normal-control-font]] [font (is-a?/c font%) @racket[normal-control-font]]
[enabled (or/c any/c behavior?) #t] [enabled (or/c any/c behavior?) #t]
[vert-margin (integer-in 0 1000) 2] [vert-margin (integer-in 0 1000) 2]
[horiz-margin (integer-in 0 1000) 2] [horiz-margin (integer-in 0 1000) 2]
@ -202,9 +202,9 @@ The constructor arguments are as in @scheme[frame%], except that @scheme[shown]
[min-height (integer-in 0 10000) _graphical-minimum-height] [min-height (integer-in 0 10000) _graphical-minimum-height]
[stretchable-width any/c #f] [stretchable-width any/c #f]
[stretchable-height any/c #f])]{The constructor [stretchable-height any/c #f])]{The constructor
arguments are the same as in @scheme[message%], except that arguments are the same as in @racket[message%], except that
@scheme[label], @scheme[enabled], @scheme[stretchable-width], and @racket[label], @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying.}} @racket[stretchable-height] may be time-varying.}}
@defclass[ft-button% button% (control<%>)]{ @defclass[ft-button% button% (control<%>)]{
@ -212,7 +212,7 @@ arguments are the same as in @scheme[message%], except that
[parent (or/c (is-a?/c frame%) (is-a?/c dialog%) [parent (or/c (is-a?/c frame%) (is-a?/c dialog%)
(is-a?/c panel%) (is-a?/c pane%))] (is-a?/c panel%) (is-a?/c pane%))]
[style (one-of/c 'border 'deleted) null] [style (one-of/c 'border 'deleted) null]
[font (is-a?/c font%) @scheme[normal-control-font]] [font (is-a?/c font%) @racket[normal-control-font]]
[enabled any/c #t] [enabled any/c #t]
[vert-margin (integer-in 0 1000) 2] [vert-margin (integer-in 0 1000) 2]
[horiz-margin (integer-in 0 1000) 2] [horiz-margin (integer-in 0 1000) 2]
@ -220,9 +220,9 @@ arguments are the same as in @scheme[message%], except that
[min-height (integer-in 0 10000) _graphical-minimum-height] [min-height (integer-in 0 10000) _graphical-minimum-height]
[stretchable-width any/c #f] [stretchable-width any/c #f]
[stretchable-height any/c #f])]{The constructor [stretchable-height any/c #f])]{The constructor
arguments are the same as in @scheme[message%], except that arguments are the same as in @racket[message%], except that
@scheme[label], @scheme[enabled], @scheme[stretchable-width], and @racket[label], @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying.} @racket[stretchable-height] may be time-varying.}
@defmethod[(get-value-e) event?]{returns an event stream that yields a @defmethod[(get-value-e) event?]{returns an event stream that yields a
value whenever the user clicks the button.} value whenever the user clicks the button.}
@ -235,7 +235,7 @@ value whenever the user clicks the button.}
(is-a?/c panel%) (is-a?/c pane%))] (is-a?/c panel%) (is-a?/c pane%))]
[style (listof (one-of/c 'deleted)) null] [style (listof (one-of/c 'deleted)) null]
[value any/c #f] [value any/c #f]
[font (is-a?/c font%) @scheme[normal-control-font]] [font (is-a?/c font%) @racket[normal-control-font]]
[enabled any/c #t] [enabled any/c #t]
[vert-margin (integer-in 0 1000) 2] [vert-margin (integer-in 0 1000) 2]
[horiz-margin (integer-in 0 1000) 2] [horiz-margin (integer-in 0 1000) 2]
@ -244,10 +244,10 @@ value whenever the user clicks the button.}
[stretchable-width any/c #f] [stretchable-width any/c #f]
[stretchable-height any/c #f] [stretchable-height any/c #f]
[value-set event? never-e])]{The constructor arguments [value-set event? never-e])]{The constructor arguments
are the same as in @scheme[check-box%], except that @scheme[label], are the same as in @racket[check-box%], except that @racket[label],
@scheme[enabled], @scheme[stretchable-width], and @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying. Also, any occurrence @racket[stretchable-height] may be time-varying. Also, any occurrence
on @scheme[value-set] sets the check box's state to that of the event value.} on @racket[value-set] sets the check box's state to that of the event value.}
@defmethod[(get-value-b) behavior?]{returns a value that always reflects @defmethod[(get-value-b) behavior?]{returns a value that always reflects
the current state of the check box.} the current state of the check box.}
@ -274,10 +274,10 @@ the current state of the check box.}
[stretchable-width any/c (memq 'horizontal style)] [stretchable-width any/c (memq 'horizontal style)]
[stretchable-height any/c (memq 'vertical style)] [stretchable-height any/c (memq 'vertical style)]
[value-set event? never-e])]{The constructor arguments [value-set event? never-e])]{The constructor arguments
are the same as in @scheme[check-box%], except that @scheme[label], are the same as in @racket[check-box%], except that @racket[label],
@scheme[enabled], @scheme[stretchable-width], and @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying. Also, any occurrence @racket[stretchable-height] may be time-varying. Also, any occurrence
on @scheme[value-set] sets the slider's state to that of the event value.} on @racket[value-set] sets the slider's state to that of the event value.}
@defmethod[(get-value-b) behavior?]{returns a value that always reflects @defmethod[(get-value-b) behavior?]{returns a value that always reflects
the current state of the slider.} the current state of the slider.}
@ -293,7 +293,7 @@ the current state of the slider.}
'vertical-label 'horizontal-label 'vertical-label 'horizontal-label
'deleted)) 'deleted))
'(single)] '(single)]
[font (is-a?/c font%) @scheme[normal-control-font]] [font (is-a?/c font%) @racket[normal-control-font]]
[enabled any/c #t] [enabled any/c #t]
[vert-margin (integer-in 0 1000) 2] [vert-margin (integer-in 0 1000) 2]
[horiz-margin (integer-in 0 1000) 2] [horiz-margin (integer-in 0 1000) 2]
@ -302,10 +302,10 @@ the current state of the slider.}
[stretchable-width any/c #t] [stretchable-width any/c #t]
[stretchable-height any/c (memq 'multiple style)] [stretchable-height any/c (memq 'multiple style)]
[value-set event? never-e])]{The [value-set event? never-e])]{The
constructor arguments are the same as in @scheme[check-box%], except constructor arguments are the same as in @racket[check-box%], except
that @scheme[label], @scheme[enabled], @scheme[stretchable-width], and that @racket[label], @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying. Also, any occurrence @racket[stretchable-height] may be time-varying. Also, any occurrence
on @scheme[value-set] sets the text field's state to that of the event on @racket[value-set] sets the text field's state to that of the event
value.} value.}
@defmethod[(get-value-b) behavior?]{returns a value that always reflects @defmethod[(get-value-b) behavior?]{returns a value that always reflects
@ -332,10 +332,10 @@ the current state of the text field.}
[stretchable-width any/c #f] [stretchable-width any/c #f]
[stretchable-height any/c #f] [stretchable-height any/c #f]
[value-set event? never-e])]{The [value-set event? never-e])]{The
constructor arguments are the same as in @scheme[check-box%], except constructor arguments are the same as in @racket[check-box%], except
that @scheme[label], @scheme[enabled], @scheme[stretchable-width], and that @racket[label], @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying. Also, any occurrence @racket[stretchable-height] may be time-varying. Also, any occurrence
on @scheme[value-set] sets the text field's state to that of the event on @racket[value-set] sets the text field's state to that of the event
value.} value.}
@defmethod[(get-selection-b) behavior?]{returns a value that always reflects @defmethod[(get-selection-b) behavior?]{returns a value that always reflects
the currently selected element in the radio box.} the currently selected element in the radio box.}
@ -350,7 +350,7 @@ the currently selected element in the radio box.}
'deleted)) 'deleted))
null] null]
[selection exact-nonnegative-integer? 0] [selection exact-nonnegative-integer? 0]
[font (is-a?/c font%) @scheme[normal-control-font]] [font (is-a?/c font%) @racket[normal-control-font]]
[enabled any/c #t] [enabled any/c #t]
[vert-margin (integer-in 0 1000) 2] [vert-margin (integer-in 0 1000) 2]
[horiz-margin (integer-in 0 1000) 2] [horiz-margin (integer-in 0 1000) 2]
@ -359,10 +359,10 @@ the currently selected element in the radio box.}
[stretchable-width any/c #f] [stretchable-width any/c #f]
[stretchable-height any/c #f] [stretchable-height any/c #f]
[value-set event? never-e])]{The [value-set event? never-e])]{The
constructor arguments are the same as in @scheme[check-box%], except constructor arguments are the same as in @racket[check-box%], except
that @scheme[label], @scheme[enabled], @scheme[stretchable-width], and that @racket[label], @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying. Also, any occurrence @racket[stretchable-height] may be time-varying. Also, any occurrence
on @scheme[value-set] sets the text field's state to that of the event on @racket[value-set] sets the text field's state to that of the event
value.} value.}
@defmethod[(get-selection-b) behavior?]{returns a value that always reflects @defmethod[(get-selection-b) behavior?]{returns a value that always reflects
the currently selected element in the choice control.} the currently selected element in the choice control.}
@ -378,8 +378,8 @@ the currently selected element in the choice control.}
'deleted)) 'deleted))
'(single)] '(single)]
[selection (or/c exact-nonnegative-integer? false/c) #f] [selection (or/c exact-nonnegative-integer? false/c) #f]
[font (is-a?/c font%) @scheme[view-control-font]] [font (is-a?/c font%) @racket[view-control-font]]
[label-font (is-a?/c font%) @scheme[normal-control-font]] [label-font (is-a?/c font%) @racket[normal-control-font]]
[enabled any/c #t] [enabled any/c #t]
[vert-margin (integer-in 0 1000) 2] [vert-margin (integer-in 0 1000) 2]
[horiz-margin (integer-in 0 1000) 2] [horiz-margin (integer-in 0 1000) 2]
@ -388,10 +388,10 @@ the currently selected element in the choice control.}
[stretchable-width any/c #t] [stretchable-width any/c #t]
[stretchable-height any/c #t] [stretchable-height any/c #t]
[value-set event? never-e])]{The [value-set event? never-e])]{The
constructor arguments are the same as in @scheme[check-box%], except constructor arguments are the same as in @racket[check-box%], except
that @scheme[label], @scheme[enabled], @scheme[stretchable-width], and that @racket[label], @racket[enabled], @racket[stretchable-width], and
@scheme[stretchable-height] may be time-varying. Also, any occurrence @racket[stretchable-height] may be time-varying. Also, any occurrence
on @scheme[value-set] sets the text field's state to that of the event on @racket[value-set] sets the text field's state to that of the event
value.} value.}
@defmethod[(get-selection-b) behavior?]{returns a value that always reflects @defmethod[(get-selection-b) behavior?]{returns a value that always reflects
the primary selection in the list box.} the primary selection in the list box.}
@ -407,34 +407,34 @@ To run the following animation/GUI demos, simply set the language
level to FrTime, open the corresponding file, and Execute. See the level to FrTime, open the corresponding file, and Execute. See the
demo source code for more information. demo source code for more information.
@scheme[orbit-mouse.rkt] : A collection of balls that move in circles @filepath{orbit-mouse.rkt} : A collection of balls that move in circles
around the mouse pointer. around the mouse pointer.
@scheme[piston.rkt] : Simulation of a piston/cylinder. @filepath{piston.rkt} : Simulation of a piston/cylinder.
@scheme[rotation.rkt] : Balls moving in circles. @filepath{rotation.rkt} : Balls moving in circles.
@scheme[delay-mouse.rkt] : A trail of balls following the mouse. @filepath{delay-mouse.rkt} : A trail of balls following the mouse.
@scheme[ball-on-string.rkt] : A ball chasing the mouse. @filepath{ball-on-string.rkt} : A ball chasing the mouse.
@scheme[pong.rkt] : A simple pong/air-hockey game. The left paddle moves with @filepath{pong.rkt} : A simple pong/air-hockey game. The left paddle moves with
numeric keypad; the right paddle moves with the mouse. The 'r' key numeric keypad; the right paddle moves with the mouse. The 'r' key
resets the score. resets the score.
@scheme[pizza.rkt] : A simple "pizza ordering" user interface based on an HtDP @filepath{pizza.rkt} : A simple "pizza ordering" user interface based on an HtDP
exercise. exercise.
@scheme[calculator.rkt] : A simple calculator interface, also based on an HtDP @filepath{calculator.rkt} : A simple calculator interface, also based on an HtDP
exercise except that the result updates continuously as the arguments exercise except that the result updates continuously as the arguments
and operator change. and operator change.
The next three animation examples are courtesy of Robb Cutler: The next three animation examples are courtesy of Robb Cutler:
@scheme[analog-clock.rkt] : An animated real-time clock. A slider adjusts the @filepath{analog-clock.rkt} : An animated real-time clock. A slider adjusts the
radius of the face. Click and drag to move the face around. radius of the face. Click and drag to move the face around.
@scheme[growing-points.rkt] : A field of points that grow as the mouse @filepath{growing-points.rkt} : A field of points that grow as the mouse
approaches. approaches.
@scheme[needles.rkt] : A field of needles that point at the mouse. @filepath{needles.rkt} : A field of needles that point at the mouse.

View File

@ -5,7 +5,7 @@
@title{@bold{Cards}: Virtual Playing Cards Library} @title{@bold{Cards}: Virtual Playing Cards Library}
@defmodule[games/cards]{The @schememodname[games/cards] @defmodule[games/cards]{The @racketmodname[games/cards]
module provides a toolbox for creating cards games.} module provides a toolbox for creating cards games.}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -16,10 +16,10 @@ module provides a toolbox for creating cards games.}
[h exact-nonnegative-integer? 3]) [h exact-nonnegative-integer? 3])
table<%>]{ table<%>]{
Returns a table. The table is named by @scheme[title], and it is Returns a table. The table is named by @racket[title], and it is
@scheme[w] cards wide and @scheme[h] cards high (assuming a standard @racket[w] cards wide and @racket[h] cards high (assuming a standard
card of 71 by 96 pixels). The table is not initially shown; card of 71 by 96 pixels). The table is not initially shown;
@scheme[(send table show #t)] shows it.} @racket[(send table show #t)] shows it.}
@defproc[(make-deck) @defproc[(make-deck)
(listof card<%>)]{ (listof card<%>)]{
@ -43,12 +43,12 @@ the same size.}
@defproc[(shuffle-list [lst list?] [n exact-nonnegative-integer?]) @defproc[(shuffle-list [lst list?] [n exact-nonnegative-integer?])
list?]{ list?]{
Shuffles the given @scheme[lst] @scheme[n] times, returning the new Shuffles the given @racket[lst] @racket[n] times, returning the new
list. Shuffling simulates an actual shuffle: the list is split into list. Shuffling simulates an actual shuffle: the list is split into
halves which are merged back together by repeatedly pulling the top halves which are merged back together by repeatedly pulling the top
card off one of the halves, randomly selecting one half or the card off one of the halves, randomly selecting one half or the
other. According to some mathematical theorem, 7 is a large enough other. According to some mathematical theorem, 7 is a large enough
@scheme[n] to get a perfect shuffle.} @racket[n] to get a perfect shuffle.}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section{Regions and Buttons} @section{Regions and Buttons}
@ -61,22 +61,22 @@ other. According to some mathematical theorem, 7 is a large enough
[(callback #:mutable) (or/c ((listof (is-a?/c card<%>)) . -> . any) [(callback #:mutable) (or/c ((listof (is-a?/c card<%>)) . -> . any)
false/c)])]{ false/c)])]{
The @scheme[x], @scheme[y], @scheme[w], and @scheme[h] fields The @racket[x], @racket[y], @racket[w], and @racket[h] fields
determine the region's location on the table. determine the region's location on the table.
When @scheme[label] is a string, it is drawn in the region in 12-pixel When @racket[label] is a string, it is drawn in the region in 12-pixel
text, centered horizontally and 5 pixels down from the region's top text, centered horizontally and 5 pixels down from the region's top
outline. If label is @scheme[#f], no label or box is drawn for the outline. If label is @racket[#f], no label or box is drawn for the
region. region.
The @scheme[callback] procedure takes a list of cards that were The @racket[callback] procedure takes a list of cards that were
dragged to the region; if callback is @scheme[#f], the region is not dragged to the region; if callback is @racket[#f], the region is not
active (i.e., dragging cards to the region doesn't highlight the active (i.e., dragging cards to the region doesn't highlight the
region box). The region remains hilited until the callback returns. region box). The region remains hilited until the callback returns.
The only available mutator on the structure is The only available mutator on the structure is
@scheme[set-region-callback!]. The structure created by @racket[set-region-callback!]. The structure created by
@scheme[make-region] actually has extra hidden fields.} @racket[make-region] actually has extra hidden fields.}
@defproc[(make-button-region [x real?] @defproc[(make-button-region [x real?]
[y real?] [y real?]
@ -87,7 +87,7 @@ The only available mutator on the structure is
false/c)]) false/c)])
region?]{ region?]{
Returns a region like one made by @scheme[make-region], but the is Returns a region like one made by @racket[make-region], but the is
drawn slightly differently and it reacts differently to cards and the drawn slightly differently and it reacts differently to cards and the
mouse. The label is drawn in the middle of the box instead of at the mouse. The label is drawn in the middle of the box instead of at the
top, and the callback is called with no arguments when the user top, and the callback is called with no arguments when the user
@ -102,13 +102,13 @@ Returns a region like one made by @scheme[make-region], but the is
region?]{ region?]{
Returns a region that does not respond to mouse clicks, but which has Returns a region that does not respond to mouse clicks, but which has
a general paint callback. The @scheme[paint-callback] function is a general paint callback. The @racket[paint-callback] function is
called with a drawing context, x and y offsets, and the width and called with a drawing context, x and y offsets, and the width and
height (which are always @scheme[w] and @scheme[h]). The x and y height (which are always @racket[w] and @racket[h]). The x and y
offsets can be different than the supplied @scheme[x] and @scheme[y] offsets can be different than the supplied @racket[x] and @racket[y]
when part of the table is drawn offscreen. Regions are painted in the when part of the table is drawn offscreen. Regions are painted in the
order that they are added to a table, and all regions are painted order that they are added to a table, and all regions are painted
before any card. The @scheme[paint-callback] procedure should not before any card. The @racket[paint-callback] procedure should not
assume a particular state for the drawing context (i.e.,current brush assume a particular state for the drawing context (i.e.,current brush
or pen), and it should restore any modified drawing context state or pen), and it should restore any modified drawing context state
before returning.} before returning.}
@ -123,7 +123,7 @@ Returns a region like one made by @scheme[make-region], but the is
(un)hilited as the user drags a set of cards to the region. The (un)hilited as the user drags a set of cards to the region. The
callback is provided two arguments: a boolean indicating whether the callback is provided two arguments: a boolean indicating whether the
region is hilited, and the list of cards being dragged. Like region is hilited, and the list of cards being dragged. Like
region-callback, the default is @scheme[#f], which indicates that the region-callback, the default is @racket[#f], which indicates that the
region has no interactive callback (but does not affect whether the region has no interactive callback (but does not affect whether the
region is hilited as cards are dragged). The final unhilite (when region is hilited as cards are dragged). The final unhilite (when
cards are potentially delivered) does not trigger this callback.} cards are potentially delivered) does not trigger this callback.}
@ -133,22 +133,22 @@ Returns a region like one made by @scheme[make-region], but the is
(boolean? (listof (is-a?/c card<%>)) . -> . any)]{ (boolean? (listof (is-a?/c card<%>)) . -> . any)]{
Gets the current callback that is installed via Gets the current callback that is installed via
@scheme[set-region-interaction-callback!].} @racket[set-region-interaction-callback!].}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section{Table Methods} @section{Table Methods}
@definterface[table<%> (frame%)]{ @definterface[table<%> (frame%)]{
Create an instance with @scheme[make-table]. Create an instance with @racket[make-table].
@defmethod[(add-card [card (is-a?/c card<%>)] @defmethod[(add-card [card (is-a?/c card<%>)]
[x real?] [x real?]
[y real?]) [y real?])
void?]{ void?]{
Adds @scheme[card] to the table with its top-left corner at Adds @racket[card] to the table with its top-left corner at
(@scheme[x], @scheme[y]) in table pixels.} (@racket[x], @racket[y]) in table pixels.}
@defmethod[(add-cards [cards (listof (is-a?/c card<%>))] @defmethod[(add-cards [cards (listof (is-a?/c card<%>))]
[x real?] [x real?]
@ -158,39 +158,39 @@ Create an instance with @scheme[make-table].
(lambda (i) (values 0 0))]) (lambda (i) (values 0 0))])
void?]{ void?]{
Adds a list of cards at (@scheme[x], @scheme[y]). The optional Adds a list of cards at (@racket[x], @racket[y]). The optional
@scheme[offset-proc] procedure is called with an index @scheme[_i] @racket[offset-proc] procedure is called with an index @racket[_i]
(counting from 0) and should return two values: @scheme[_dx] and (counting from 0) and should return two values: @racket[_dx] and
@scheme[_dy]; the @scheme[_i]th card is the placed at @scheme[(+ x @racket[_dy]; the @racket[_i]th card is the placed at @racket[(+ x
+dx)] and @scheme[(+ y _dy)]. The cards are added in order on top of +dx)] and @racket[(+ y _dy)]. The cards are added in order on top of
cards already one the table such that the first card in cards already one the table such that the first card in
@scheme[cards] is topmost.} @racket[cards] is topmost.}
@defmethod[(add-cards-to-region [cards (listof (is-a?/c card<%>))] @defmethod[(add-cards-to-region [cards (listof (is-a?/c card<%>))]
[region? r]) [region? r])
void?]{ void?]{
Adds @scheme[cards] to fill the region @scheme[r], fanning them out Adds @racket[cards] to fill the region @racket[r], fanning them out
bottom-right to top-left, assuming that all cards in @scheme[cards] bottom-right to top-left, assuming that all cards in @racket[cards]
have the same width and height. The region @scheme[r] does not have have the same width and height. The region @racket[r] does not have
to be added to the table.} to be added to the table.}
@defmethod[(remove-card [card (is-a?/c card<%>)]) @defmethod[(remove-card [card (is-a?/c card<%>)])
void?]{ void?]{
Removes @scheme[card] from the table.} Removes @racket[card] from the table.}
@defmethod[(remove-cards [cards (listof (is-a?/c card<%>))]) @defmethod[(remove-cards [cards (listof (is-a?/c card<%>))])
void?]{ void?]{
Removes @scheme[cards] from the table.} Removes @racket[cards] from the table.}
@defmethod[(move-card [card (is-a?/c card<%>)] @defmethod[(move-card [card (is-a?/c card<%>)]
[x real?] [x real?]
[y real?]) [y real?])
void?]{ void?]{
Moves @scheme[card], which must be on the same already. The movement Moves @racket[card], which must be on the same already. The movement
of the cards is animated. If the cards are in snap-back-after-move of the cards is animated. If the cards are in snap-back-after-move
mode and a drag is active, snapping back will use the new location.} mode and a drag is active, snapping back will use the new location.}
@ -211,14 +211,14 @@ Removes @scheme[card] from the table.}
void?]{ void?]{
Like @method[table<%> add-cards-to-region], but moves cards that are Like @method[table<%> add-cards-to-region], but moves cards that are
already on the table like @scheme[move-card]. All of the cards are already on the table like @racket[move-card]. All of the cards are
moved at once.} moved at once.}
@defmethod*[([(flip-card [card (is-a?/c card<%>)]) void?] @defmethod*[([(flip-card [card (is-a?/c card<%>)]) void?]
[(flip-cards [cards (listof (is-a?/c card<%>))]) void?])]{ [(flip-cards [cards (listof (is-a?/c card<%>))]) void?])]{
Flips @scheme[card] or all @scheme[cards] over (at once) with Flips @racket[card] or all @racket[cards] over (at once) with
animation.} animation.}
@defmethod*[([(card-face-up [card (is-a?/c card<%>)]) void?] @defmethod*[([(card-face-up [card (is-a?/c card<%>)]) void?]
@ -226,8 +226,8 @@ Removes @scheme[card] from the table.}
[(card-face-down [card (is-a?/c card<%>)]) void?] [(card-face-down [card (is-a?/c card<%>)]) void?]
[(cards-face-down [cards (listof (is-a?/c card<%>))]) void?])]{ [(cards-face-down [cards (listof (is-a?/c card<%>))]) void?])]{
Like @method[table<%> flip-cards], but only for @scheme[card] or Like @method[table<%> flip-cards], but only for @racket[card] or
elements of @scheme[cards] that are currently face down/up.} elements of @racket[cards] that are currently face down/up.}
@defmethod*[([(rotate-card [card (is-a?/c card<%>)] @defmethod*[([(rotate-card [card (is-a?/c card<%>)]
[mode (or/c 'cw 'ccw 0 90 -90 180 -180 270 -270 360)]) [mode (or/c 'cw 'ccw 0 90 -90 180 -180 270 -270 360)])
@ -236,23 +236,23 @@ Removes @scheme[card] from the table.}
[mode (or/c 'cw 'ccw 0 90 -90 180 -180 270 -270 360)]) [mode (or/c 'cw 'ccw 0 90 -90 180 -180 270 -270 360)])
void?])]{ void?])]{
Rotates @scheme[card] or all @scheme[cards] (at once, currently Rotates @racket[card] or all @racket[cards] (at once, currently
without animation, but animation may be added in the future). without animation, but animation may be added in the future).
The center of each card is kept in place, except that the card is The center of each card is kept in place, except that the card is
moved as necessary to keep it on the table. See @xmethod[card<%> moved as necessary to keep it on the table. See @xmethod[card<%>
rotate] for information on @scheme[mode].} rotate] for information on @racket[mode].}
@defmethod*[([(card-to-front [card (is-a?/c card<%>)]) void?] @defmethod*[([(card-to-front [card (is-a?/c card<%>)]) void?]
[(card-to-back [card (is-a?/c card<%>)]) void?])]{ [(card-to-back [card (is-a?/c card<%>)]) void?])]{
Moves @scheme[card] before/behind of all other cards.} Moves @racket[card] before/behind of all other cards.}
@defmethod[(stack-cards [cards (listof (is-a?/c card<%>))]) void?]{ @defmethod[(stack-cards [cards (listof (is-a?/c card<%>))]) void?]{
The first card in @scheme[cards] is not moved; the second card is The first card in @racket[cards] is not moved; the second card is
moved to follow immediately behind the first one, then moved to follow immediately behind the first one, then
@method[table<%> stack-cards] is called on @scheme[(cdr cards)]. If @method[table<%> stack-cards] is called on @racket[(cdr cards)]. If
@scheme[cards] is empty or contains only one card, no action is @racket[cards] is empty or contains only one card, no action is
taken.} taken.}
@defmethod[(card-location [card (is-a?/c card<%>)]) @defmethod[(card-location [card (is-a?/c card<%>)])
@ -276,17 +276,17 @@ Removes @scheme[card] from the table.}
Starts/ends a sequence of card or region changes that won't be Starts/ends a sequence of card or region changes that won't be
animated or updated until the end of the sequence. Sequences can be animated or updated until the end of the sequence. Sequences can be
nested via matching @schemeidfont{begin-}/@schemeidfont{end-} pairs.} nested via matching @racketidfont{begin-}/@racketidfont{end-} pairs.}
@defmethod[(add-region [r region?]) void]{ @defmethod[(add-region [r region?]) void]{
Adds the region @scheme[r] to the table; regions are drawn in the Adds the region @racket[r] to the table; regions are drawn in the
order that they are added to the table, and when a region added later order that they are added to the table, and when a region added later
is hilighted, it can obscure regions added earlier.} is hilighted, it can obscure regions added earlier.}
@defmethod[(remove-region [r region?]) void]{ @defmethod[(remove-region [r region?]) void]{
Removes the region @scheme[r] from the table.} Removes the region @racket[r] from the table.}
@defmethod*[([(hilite-region [r region?]) void?] @defmethod*[([(hilite-region [r region?]) void?]
[(unhilite-region [r region?]) void?])]{ [(unhilite-region [r region?]) void?])]{
@ -298,36 +298,36 @@ Removes @scheme[card] from the table.}
void?]{ void?]{
Sets the way that a mouse click is handled for a particular button Sets the way that a mouse click is handled for a particular button
indicated by @scheme[which]. The @scheme[action] argument must be one indicated by @racket[which]. The @racket[action] argument must be one
of the following: of the following:
@itemize[ @itemize[
@item{@scheme['drag/one] --- drag only the clicked-on card.} @item{@racket['drag/one] --- drag only the clicked-on card.}
@item{@scheme['drag-raise/one] --- like drag/one, but raise the @item{@racket['drag-raise/one] --- like drag/one, but raise the
card to the top on a click.} card to the top on a click.}
@item{@scheme['drag/above] --- drag the card along with any card @item{@racket['drag/above] --- drag the card along with any card
on top of the card (i.e., more towards the front and on top of the card (i.e., more towards the front and
overlapping with the card). The on-top-of relation overlapping with the card). The on-top-of relation
is closed transitively.} is closed transitively.}
@item{@scheme['drag-raise/above] --- like @scheme['drag/above], @item{@racket['drag-raise/above] --- like @racket['drag/above],
but raises.} but raises.}
@item{@scheme['drag-below] --- drag the card along with any card @item{@racket['drag-below] --- drag the card along with any card
underneath the card (i.e., more towards the back and underneath the card (i.e., more towards the back and
overlapping with the card). The underneath relation overlapping with the card). The underneath relation
is closed transitively.} is closed transitively.}
@item{@scheme['drag-raise/below] --- like @scheme['drag/below], @item{@racket['drag-raise/below] --- like @racket['drag/below],
but raises.} but raises.}
] ]
The initial settings are: @scheme['drag-raise/above] for The initial settings are: @racket['drag-raise/above] for
@scheme['left], @scheme['drag/one] for @scheme['middle], and @racket['left], @racket['drag/one] for @racket['middle], and
@scheme['drag/below] for @scheme['right].} @racket['drag/below] for @racket['right].}
@defmethod[(set-double-click-action @defmethod[(set-double-click-action
[proc ((is-a?/c card<%>) . -> . any)]) [proc ((is-a?/c card<%>) . -> . any)])
@ -374,10 +374,10 @@ Removes @scheme[card] from the table.}
Adds a @onscreen{Help} button to the given pane, where clicking the Adds a @onscreen{Help} button to the given pane, where clicking the
button opens a new window to display @filepath{doc.txt} from the given button opens a new window to display @filepath{doc.txt} from the given
collection. The @scheme[str] argument is used for the help window collection. The @racket[str] argument is used for the help window
title. If @scheme[tt?] is true, then @filepath{doc.txt} is displayed title. If @racket[tt?] is true, then @filepath{doc.txt} is displayed
verbatim, otherwise it is formatted as for @scheme[show-help] from verbatim, otherwise it is formatted as for @racket[show-help] from
@schememodname[games/show-help].} @racketmodname[games/show-help].}
@defmethod[(add-scribble-button [pane (is-a?/c area-container<%>)] @defmethod[(add-scribble-button [pane (is-a?/c area-container<%>)]
[mod-path module-path?] [mod-path module-path?]
@ -386,7 +386,7 @@ Removes @scheme[card] from the table.}
Adds a @onscreen{Help} button to the given pane, where clicking the Adds a @onscreen{Help} button to the given pane, where clicking the
button opens Scribble-based documentation, as with button opens Scribble-based documentation, as with
@scheme[show-scribbling] from @schememodname[games/show-scribbling].} @racket[show-scribbling] from @racketmodname[games/show-scribbling].}
} }
@ -395,7 +395,7 @@ Removes @scheme[card] from the table.}
@definterface[card<%> ()]{ @definterface[card<%> ()]{
Create instances with @scheme[make-deck] or @scheme[make-card]. Create instances with @racket[make-deck] or @racket[make-card].
@defmethod[(card-width) exact-nonnegative-integer?]{ @defmethod[(card-width) exact-nonnegative-integer?]{
@ -422,62 +422,62 @@ Create instances with @scheme[make-deck] or @scheme[make-card].
@defmethod[(face-down?) boolean?]{ @defmethod[(face-down?) boolean?]{
Returns @scheme[#t] if the card is currently face down.} Returns @racket[#t] if the card is currently face down.}
@defmethod[(rotate [mode (or/c 'cw 'ccw 0 90 -90 180 -180 270 -270 360)]) void?]{ @defmethod[(rotate [mode (or/c 'cw 'ccw 0 90 -90 180 -180 270 -270 360)]) void?]{
Rotates the card. Unlike using the @xmethod[table<%> rotate-card] method, Rotates the card. Unlike using the @xmethod[table<%> rotate-card] method,
the card's top-left position is kept in place. the card's top-left position is kept in place.
If @scheme[mode] is @scheme['cw], the card is If @racket[mode] is @racket['cw], the card is
rotated clockwise; if @scheme[mode] is @scheme['ccw], the card is rotated clockwise; if @racket[mode] is @racket['ccw], the card is
rotated counter-clockwise; if @scheme[mode] is one of the allowed rotated counter-clockwise; if @racket[mode] is one of the allowed
numbers, the card is rotated the corresponding amount in degrees numbers, the card is rotated the corresponding amount in degrees
counter-clockwise.} counter-clockwise.}
@defmethod[(orientation) (or/c 0 90 180 270)]{ @defmethod[(orientation) (or/c 0 90 180 270)]{
Returns the orientation of the card, where @scheme[0] corresponds to Returns the orientation of the card, where @racket[0] corresponds to
its initial state, @scheme[90] is rotated 90 degrees counter-clockwise, and so on.} its initial state, @racket[90] is rotated 90 degrees counter-clockwise, and so on.}
@defmethod[(get-suit-id) any/c]{ @defmethod[(get-suit-id) any/c]{
Normally returns @scheme[1], @scheme[2], @scheme[3], or @scheme[4] Normally returns @racket[1], @racket[2], @racket[3], or @racket[4]
(see @method[card<%> get-suit] for corresponding suit names), but the (see @method[card<%> get-suit] for corresponding suit names), but the
result can be anything for a card created by @scheme[make-card].} result can be anything for a card created by @racket[make-card].}
@defmethod[(get-suit) symbol?]{ @defmethod[(get-suit) symbol?]{
Returns @scheme['clubs], @scheme['diamonds], @scheme['hearts], Returns @racket['clubs], @racket['diamonds], @racket['hearts],
@scheme['spades], or @scheme['unknown], depending on whether @racket['spades], or @racket['unknown], depending on whether
@method[card<%> get-suit-id] returns @scheme[1], @scheme[2], @method[card<%> get-suit-id] returns @racket[1], @racket[2],
@scheme[3], @scheme[4], or something else.} @racket[3], @racket[4], or something else.}
@defmethod[(get-value) any/c]{ @defmethod[(get-value) any/c]{
Normally returns @scheme[1] (Ace), @scheme[2], ... @scheme[10], Normally returns @racket[1] (Ace), @racket[2], ... @racket[10],
@scheme[11] (Jack), @scheme[12] (Queen), or @scheme[13] (King), but @racket[11] (Jack), @racket[12] (Queen), or @racket[13] (King), but
the result can be anything for a card created by @scheme[make-card].} the result can be anything for a card created by @racket[make-card].}
@defmethod*[([(user-can-flip) boolean?] @defmethod*[([(user-can-flip) boolean?]
[(user-can-flip [can? any/c]) void?])]{ [(user-can-flip [can? any/c]) void?])]{
Gets/sets whether the user can flip the card interactively, usually Gets/sets whether the user can flip the card interactively, usually
by double-clicking it. Initially @scheme[#t].} by double-clicking it. Initially @racket[#t].}
@defmethod*[([(user-can-move) boolean?] @defmethod*[([(user-can-move) boolean?]
[(user-can-move [can? any/c]) void?])]{ [(user-can-move [can? any/c]) void?])]{
Gets/sets whether the user can move the card interactively, usually Gets/sets whether the user can move the card interactively, usually
by dragging it. Disabling moves has the side-effect of disabling by dragging it. Disabling moves has the side-effect of disabling
raises and double-clicks. Initially @scheme[#t].} raises and double-clicks. Initially @racket[#t].}
@defmethod*[([(snap-back-after-move) boolean?] @defmethod*[([(snap-back-after-move) boolean?]
[(snap-back-after-move [on? any/c]) void?])]{ [(snap-back-after-move [on? any/c]) void?])]{
Assuming user can move the card interactively, gets/sets whether the Assuming user can move the card interactively, gets/sets whether the
card stays where the user dragged it or snaps back to its original card stays where the user dragged it or snaps back to its original
place. Initially @scheme[#f]. place. Initially @racket[#f].
A region's @italic{interactive} callback can disable snap-back for a A region's @italic{interactive} callback can disable snap-back for a
card so that the card can be delivered to the region. (A region's card so that the card can be delivered to the region. (A region's
@ -487,18 +487,18 @@ Create instances with @scheme[make-deck] or @scheme[make-card].
[(stay-in-region [r (or/c region? false/c)]) void?])]{ [(stay-in-region [r (or/c region? false/c)]) void?])]{
Gets/sets a constraining region @scheme[r]. If @scheme[r] is not Gets/sets a constraining region @racket[r]. If @racket[r] is not
@scheme[#f], the user cannot move the card out of @scheme[r]. @racket[#f], the user cannot move the card out of @racket[r].
Initially @scheme[#f].} Initially @racket[#f].}
@defmethod*[([(home-region) (or/c region? false/c)] @defmethod*[([(home-region) (or/c region? false/c)]
[(home-region [r (or/c region? false/c)]) void?])]{ [(home-region [r (or/c region? false/c)]) void?])]{
Gets/sets a home region @scheme[r]. If @scheme[r] is not @scheme[#f], Gets/sets a home region @racket[r]. If @racket[r] is not @racket[#f],
then the user can move the card freely within the region, but it then the user can move the card freely within the region, but it
snaps back if moved completely out of the region. If moved partly out snaps back if moved completely out of the region. If moved partly out
of the region, the card is moved enough to get completely back of the region, the card is moved enough to get completely back
in. Initially @scheme[#f]. in. Initially @racket[#f].
A region's @italic{interactive} callback can disable snap-back for a A region's @italic{interactive} callback can disable snap-back for a
card so that the card can be delivered to the region. (A region's card so that the card can be delivered to the region. (A region's

View File

@ -42,7 +42,7 @@ the Chat Noir game in a
@section{Overview} @section{Overview}
Chat Noir is implemented using @link["http://www.htdp.org/"]{HtDP}'s universe Chat Noir is implemented using @link["http://www.htdp.org/"]{HtDP}'s universe
library: @schememodname[2htdp/universe] library: @racketmodname[2htdp/universe]
(although it only uses the ``world'' portions of that library). (although it only uses the ``world'' portions of that library).
The program is divided up into The program is divided up into
six parts: the world data definition, an implementation of breadth-first search, six parts: the world data definition, an implementation of breadth-first search,
@ -65,7 +65,7 @@ and some code that builds an initial world and starts the game.
<go>] <go>]
Each section also comes with a series of test cases that are collected into the Each section also comes with a series of test cases that are collected into the
@scheme[<tests>] @racket[<tests>]
chunk at the end of the program. chunk at the end of the program.
@chunk[<tests> @chunk[<tests>
@ -77,8 +77,8 @@ chunk at the end of the program.
<drawing-tests> <drawing-tests>
<input-tests>] <input-tests>]
Each test case uses either @scheme[test], a simple form that accepts two Each test case uses either @racket[test], a simple form that accepts two
arguments and compares them with @scheme[equal?], or @scheme[test/set] arguments and compares them with @racket[equal?], or @racket[test/set]
which accepts two lists and compares them as if they were sets. which accepts two lists and compares them as if they were sets.
In general, most of the test cases are left to the end of the document, organized In general, most of the test cases are left to the end of the document, organized
@ -98,7 +98,7 @@ construct empty worlds and test cases for them.
@chunk[<world-tests> @chunk[<world-tests>
<empty-world-test> <empty-board-test> <blocked-cells-tests>] <empty-world-test> <empty-board-test> <blocked-cells-tests>]
The main structure definition is the @scheme[world] struct. The main structure definition is the @racket[world] struct.
@chunk[<world-struct> @chunk[<world-struct>
(define-struct/contract world ([board (listof cell?)] (define-struct/contract world ([board (listof cell?)]
@ -121,29 +121,29 @@ It consists of a structure with six fields:
@tt{cell}s, one for each circle on the game. @tt{cell}s, one for each circle on the game.
} }
@item{@tt{cat}: a @scheme[posn] indicating the position of the cat @item{@tt{cat}: a @racket[posn] indicating the position of the cat
(interpreting the @scheme[posn] in the way that they are interpreted (interpreting the @racket[posn] in the way that they are interpreted
for the @tt{board} field),} for the @tt{board} field),}
@item{@tt{state}: the state of the game, which can be one of @item{@tt{state}: the state of the game, which can be one of
@itemize[ @itemize[
@item{@scheme['playing], indicating that the game is still going; this is the @item{@racket['playing], indicating that the game is still going; this is the
initial state.} initial state.}
@item{@scheme['cat-won], indicating that the game is over and the @item{@racket['cat-won], indicating that the game is over and the
cat won, or} cat won, or}
@item{@scheme['cat-lost], indicating that the game is over and the @item{@racket['cat-lost], indicating that the game is over and the
cat lost.}]} cat lost.}]}
@item{@tt{size}: an odd natural number indicating the size of the board} @item{@tt{size}: an odd natural number indicating the size of the board}
@item{@tt{mouse-posn}: a @scheme[posn] for the location of the @item{@tt{mouse-posn}: a @racket[posn] for the location of the
mouse (or @scheme[#f] if the mouse is not in the window), and} mouse (or @racket[#f] if the mouse is not in the window), and}
@item{@tt{h-down?}: a boolean indicating if the @tt{h} key is being @item{@tt{h-down?}: a boolean indicating if the @tt{h} key is being
pushed down.} pushed down.}
] ]
A @scheme[cell] is a structure with two fields: A @racket[cell] is a structure with two fields:
@chunk[<cell-struct> @chunk[<cell-struct>
(define-struct/contract cell ([p posn?] (define-struct/contract cell ([p posn?]
@ -151,20 +151,20 @@ A @scheme[cell] is a structure with two fields:
#:transparent)] #:transparent)]
The coordinates of The coordinates of
the @scheme[posn] in the first field the @racket[posn] in the first field
indicate a position on the hexagonal grid. indicate a position on the hexagonal grid.
This program reprsents the hexagon grid as a series of rows that This program reprsents the hexagon grid as a series of rows that
are offset from each other by 1/2 the size of the each cell. are offset from each other by 1/2 the size of the each cell.
The @tt{y} field The @tt{y} field
of the @scheme[posn] refers to the row of the cell, and the @tt{x} of the @racket[posn] refers to the row of the cell, and the @tt{x}
coordinate the position in the row. This means that, for example, coordinate the position in the row. This means that, for example,
@scheme[(make-posn 1 0)] is centered above @scheme[(make-posn 1 0)] @racket[(make-posn 1 0)] is centered above @racket[(make-posn 1 0)]
and @scheme[(make-posn 1 1)]. and @racket[(make-posn 1 1)].
The boolean in the @tt{blocked?} field indicates if the cell has been The boolean in the @tt{blocked?} field indicates if the cell has been
clicked on, thus blocking the cat from stepping there. clicked on, thus blocking the cat from stepping there.
The @scheme[empty-board] function builds a list of @scheme[cell]s The @racket[empty-board] function builds a list of @racket[cell]s
that correspond to an empty board. For example, here's what an empty that correspond to an empty board. For example, here's what an empty
7x7 board looks like, as a list of cells. 7x7 board looks like, as a list of cells.
@ -200,13 +200,13 @@ And here is how that board looks as a list of cells.
(make-cell (make-posn 2 1) #f) (make-cell (make-posn 2 1) #f)
(make-cell (make-posn 2 2) #f)))] (make-cell (make-posn 2 2) #f)))]
The @scheme[empty-board] function consists The @racket[empty-board] function consists
of two (nested) calls to @scheme[build-list] of two (nested) calls to @racket[build-list]
that build a list of lists of cells, one for that build a list of lists of cells, one for
each pair of coordinates between @scheme[0] each pair of coordinates between @racket[0]
and @scheme[board-size]. Then, @scheme[append] and @racket[board-size]. Then, @racket[append]
flattens the nested lists and the flattens the nested lists and the
@scheme[filter] expression removes the corners. @racket[filter] expression removes the corners.
@chunk[<empty-board> @chunk[<empty-board>
(define/contract (empty-board board-size) (define/contract (empty-board board-size)
@ -237,13 +237,13 @@ flattens the nested lists and the
Building an empty world is simply Building an empty world is simply
a matter of building an empty board, finding a matter of building an empty board, finding
the initial position of the cat and filling the initial position of the cat and filling
in all of the fields of the @scheme[world] struct. in all of the fields of the @racket[world] struct.
For example, this is the empty world of size @scheme[3]. For example, this is the empty world of size @racket[3].
It puts the cat at @scheme[(make-posn 1 1)], It puts the cat at @racket[(make-posn 1 1)],
sets the state to @scheme['playing], records the sets the state to @racket['playing], records the
size @scheme[3], and sets the current mouse position size @racket[3], and sets the current mouse position
to @scheme[#f] and the state of the ``h'' key to to @racket[#f] and the state of the ``h'' key to
@scheme[#f]. @racket[#f].
@chunk[<empty-world-test> @chunk[<empty-world-test>
@ -256,7 +256,7 @@ to @scheme[#f] and the state of the ``h'' key to
#f))] #f))]
The @scheme[empty-world] function The @racket[empty-world] function
generalizes the example by computing the generalizes the example by computing the
cats initial position as the center spot on the board. cats initial position as the center spot on the board.
@ -273,16 +273,16 @@ cats initial position as the center spot on the board.
#f #f
#f))] #f))]
The @scheme[add-n-random-blocked-cells] function accepts a list of cells The @racket[add-n-random-blocked-cells] function accepts a list of cells
and returns a new list of cells where @scheme[n] of the unblocked cells and returns a new list of cells where @racket[n] of the unblocked cells
in @scheme[all-cells] are now blocked. in @racket[all-cells] are now blocked.
If @scheme[n] is zero, of course, no more cells should be blocked, If @racket[n] is zero, of course, no more cells should be blocked,
so the result is just @scheme[all-cells]. Otherwise, so the result is just @racket[all-cells]. Otherwise,
the function computes @scheme[unblocked-cells], a list of all the function computes @racket[unblocked-cells], a list of all
of the unblocked cells (except the cat's initial location), of the unblocked cells (except the cat's initial location),
and then randomly picks a cell from it, and then randomly picks a cell from it,
calling @scheme[block-cell] to actually block that cell. calling @racket[block-cell] to actually block that cell.
@chunk[<blocked-cells> @chunk[<blocked-cells>
(define/contract (add-n-random-blocked-cells n all-cells board-size) (define/contract (add-n-random-blocked-cells n all-cells board-size)
@ -309,9 +309,9 @@ calling @scheme[block-cell] to actually block that cell.
board-size))]))] board-size))]))]
The @scheme[block-cell] function accepts a @scheme[posn] The @racket[block-cell] function accepts a @racket[posn]
and a list of @scheme[cell] structs and updates the and a list of @racket[cell] structs and updates the
relevant cell, setting its @tt{blocked?} field to @scheme[#t]. relevant cell, setting its @tt{blocked?} field to @racket[#t].
@chunk[<block-cell> @chunk[<block-cell>
(define/contract (block-cell to-block board) (define/contract (block-cell to-block board)
@ -325,7 +325,7 @@ relevant cell, setting its @tt{blocked?} field to @scheme[#t].
The cat's move decision is based on a breadth-first search of a graph. The cat's move decision is based on a breadth-first search of a graph.
The graph's nodes are the cells on the board plus a special The graph's nodes are the cells on the board plus a special
node called @scheme['boundary] that is adjacent to every cell node called @racket['boundary] that is adjacent to every cell
on the boundary of the graph. In addition to the boundary edges, on the boundary of the graph. In addition to the boundary edges,
there are edges there are edges
between each pair of adjacent cells, unless one of the cells is between each pair of adjacent cells, unless one of the cells is
@ -343,21 +343,21 @@ details of how the graph connectivity is computed from the board to the next sec
<lookup-in-table-tests> <lookup-in-table-tests>
<build-bfs-table-tests>] <build-bfs-table-tests>]
The breadth-first function constructs a @scheme[distance-map], The breadth-first function constructs a @racket[distance-map],
which is a list of @scheme[dist-cell] structs: which is a list of @racket[dist-cell] structs:
@chunk[<dist-cell-data-definition> @chunk[<dist-cell-data-definition>
(define-struct/contract dist-cell ([p (or/c 'boundary posn?)] (define-struct/contract dist-cell ([p (or/c 'boundary posn?)]
[n natural-number/c]) [n natural-number/c])
#:transparent)] #:transparent)]
Each @tt{p} field in the @scheme[dist-cell] is a position on the board Each @tt{p} field in the @racket[dist-cell] is a position on the board
and the @tt{n} field is a natural number, indicating and the @tt{n} field is a natural number, indicating
the distance of the shortest path from the node to some fixed point on the distance of the shortest path from the node to some fixed point on
the board. the board.
The function @scheme[lookup-in-table] returns the distance from the fixed The function @racket[lookup-in-table] returns the distance from the fixed
point to the given posn, returning @scheme['] if the posn is not in the point to the given posn, returning @racket['] if the posn is not in the
table. table.
@chunk[<lookup-in-table> @chunk[<lookup-in-table>
@ -372,7 +372,7 @@ table.
[else [else
(lookup-in-table (rest t) p)])]))] (lookup-in-table (rest t) p)])]))]
The @scheme[build-bfs-table] accepts a world and a cell The @racket[build-bfs-table] accepts a world and a cell
(indicating the fixed point) (indicating the fixed point)
and returns a distance map encoding the distance to that cell. and returns a distance map encoding the distance to that cell.
For example, here is the distance map for the distance to the boundary. For example, here is the distance map for the distance to the boundary.
@ -397,15 +397,15 @@ The boundary is zero steps away; each of the cells that are on the boundary
are one step away and the center is two steps away. are one step away and the center is two steps away.
The core of the breadth-first search is this function, The core of the breadth-first search is this function,
@scheme[bst]. It accepts a queue of the pending nodes to visit @racket[bst]. It accepts a queue of the pending nodes to visit
and a @scheme[dist-table] that records the same information as a and a @racket[dist-table] that records the same information as a
@scheme[distance-map], but in an immutable hash-table. The @racket[distance-map], but in an immutable hash-table. The
@scheme[dist-map] is an accumulator, recording the distances @racket[dist-map] is an accumulator, recording the distances
to all of the nodes that have already been visited in the graph, to all of the nodes that have already been visited in the graph,
and is used here to speed up the compuation. The queue is and is used here to speed up the compuation. The queue is
represented as a list of vectors of length two. Each element represented as a list of vectors of length two. Each element
in the queue contains a @scheme[posn], or the symbol @scheme['boundary] in the queue contains a @racket[posn], or the symbol @racket['boundary]
and that @scheme[posn]'s distance. and that @racket[posn]'s distance.
@chunk[<bfs> @chunk[<bfs>
@ -430,23 +430,23 @@ and that @scheme[posn]'s distance.
(neighbors/w p))) (neighbors/w p)))
(hash-set dist-table p dist))]))]))] (hash-set dist-table p dist))]))]))]
If the @scheme[queue] is empty, then the accumulator contains If the @racket[queue] is empty, then the accumulator contains
bindings for all of the (reachable) nodes in the graph, so bindings for all of the (reachable) nodes in the graph, so
we just return it. If it isn't empty, then we extract we just return it. If it isn't empty, then we extract
the first element from the queue and name its consituents the first element from the queue and name its consituents
@scheme[p] and @scheme[dist]. @racket[p] and @racket[dist].
Next we check to see if the node at the head of the queue Next we check to see if the node at the head of the queue
is in @scheme[dist-table]. If it is, we just move on to the is in @racket[dist-table]. If it is, we just move on to the
next element in the queue. If that node is not in the @scheme[dist-table], next element in the queue. If that node is not in the @racket[dist-table],
then we add all of the neighbors to the queue, in the @scheme[append] then we add all of the neighbors to the queue, in the @racket[append]
expression, and update the @scheme[dist-table] with the distance to expression, and update the @racket[dist-table] with the distance to
this node. Because we always add the new children to the end of the queue this node. Because we always add the new children to the end of the queue
and always look at the front of the queue, we are guaranteed that and always look at the front of the queue, we are guaranteed that
the first time we see a node, it will be with the shortest distance. the first time we see a node, it will be with the shortest distance.
The @scheme[build-bfs-table] function packages up @scheme[bfs] The @racket[build-bfs-table] function packages up @racket[bfs]
function. It accepts a @scheme[world] and an initial position function. It accepts a @racket[world] and an initial position
and returns a @scheme[distance-table]. and returns a @racket[distance-table].
@chunk[<build-bfs-table> @chunk[<build-bfs-table>
@ -461,16 +461,16 @@ and returns a @scheme[distance-table].
(make-immutable-hash '())) (make-immutable-hash '()))
make-dist-cell))] make-dist-cell))]
As you can see, the first thing it does is bind the free variable in @scheme[bfs] As you can see, the first thing it does is bind the free variable in @racket[bfs]
to the result of calling the @scheme[neighbors] function (defined in the chunk to the result of calling the @racket[neighbors] function (defined in the chunk
@scheme[<neighbors>]) and then it has the @scheme[<bfs>] chunk. In the body @racket[<neighbors>]) and then it has the @racket[<bfs>] chunk. In the body
it calls the @scheme[bfs] function it calls the @racket[bfs] function
and then transforms the result, using and then transforms the result, using
@scheme[hash-map], into a list of @scheme[cell]s. @racket[hash-map], into a list of @racket[cell]s.
@section{Board to Graph} @section{Board to Graph}
As far as the @scheme[build-bfs-table] function goes, As far as the @racket[build-bfs-table] function goes,
all of the information specific to Chat Noir is all of the information specific to Chat Noir is
encoded in the neighbors function. encoded in the neighbors function.
It accepts a world and returns a function It accepts a world and returns a function
@ -491,11 +491,11 @@ it is implemented.
<adjacent-tests> <adjacent-tests>
<neighbors-tests>] <neighbors-tests>]
The neighbors functions accepts a @scheme[world] and then The neighbors functions accepts a @racket[world] and then
returns a function that computes the neighbors of a @scheme[posn] returns a function that computes the neighbors of a @racket[posn]
and of the @scheme['boundary]. and of the @racket['boundary].
For example, @scheme[(make-posn 1 0)] has four For example, @racket[(make-posn 1 0)] has four
neighbors: neighbors:
@chunk[<neighbors-tests> @chunk[<neighbors-tests>
@ -505,7 +505,7 @@ neighbors:
(make-posn 0 1) (make-posn 0 1)
(make-posn 1 1)))] (make-posn 1 1)))]
and @scheme[(make-posn 0 1)] has four neighbors: and @racket[(make-posn 0 1)] has four neighbors:
@chunk[<neighbors-tests> @chunk[<neighbors-tests>
(test ((neighbors (empty-world 7)) (make-posn 0 1)) (test ((neighbors (empty-world 7)) (make-posn 0 1))
@ -527,7 +527,7 @@ Also, there are 6 neighbors of the boundary in the 3x3 board:
(make-posn 2 1) (make-posn 2 1)
(make-posn 2 2)))] (make-posn 2 2)))]
This is the neighbors function. After it accepts the @scheme[world], This is the neighbors function. After it accepts the @racket[world],
it builds a list of the blocked cells in the world and a it builds a list of the blocked cells in the world and a
list of the cells that are on the boundary (and not blocked). Then it list of the cells that are on the boundary (and not blocked). Then it
returns a function that is specialized to those values. returns a function that is specialized to those values.
@ -554,17 +554,17 @@ returns a function that is specialized to those values.
(world-size w) (world-size w)
p)))] p)))]
The @scheme[neighbors-blocked/boundary] function is given next. The @racket[neighbors-blocked/boundary] function is given next.
If @scheme[p] is blocked, it returns the empty list. If it is If @racket[p] is blocked, it returns the empty list. If it is
on the boundary, the function simply returns @scheme[boundary-cells]. on the boundary, the function simply returns @racket[boundary-cells].
Otherwise, @scheme[neighbors-blocked/boundary] calls Otherwise, @racket[neighbors-blocked/boundary] calls
@scheme[adjacent] to compute the posns that are adjacent to @scheme[p], @racket[adjacent] to compute the posns that are adjacent to @racket[p],
filtering out the blocked @scheme[posn]s and binds that to @scheme[adjacent-posns]. filtering out the blocked @racket[posn]s and binds that to @racket[adjacent-posns].
It then filters out the @scheme[posn]s that would be outside of the board. It then filters out the @racket[posn]s that would be outside of the board.
If those two lists are the same, then @scheme[p] is not on the boundary, If those two lists are the same, then @racket[p] is not on the boundary,
so we just return @scheme[in-bounds]. If the lists are different, then so we just return @racket[in-bounds]. If the lists are different, then
we know that @scheme[p] must have been on the boundary, so we add we know that @racket[p] must have been on the boundary, so we add
@scheme['boundary] to the result list. @racket['boundary] to the result list.
@chunk[<neighbors-blocked/boundary> @chunk[<neighbors-blocked/boundary>
(define/contract (neighbors-blocked/boundary blocked (define/contract (neighbors-blocked/boundary blocked
@ -598,17 +598,17 @@ we know that @scheme[p] must have been on the boundary, so we add
There are the three functions that build the basic graph structure There are the three functions that build the basic graph structure
from a board as used by @scheme[neighbors]. from a board as used by @racket[neighbors].
The first function is @scheme[adjacent]. It consumes a The first function is @racket[adjacent]. It consumes a
@scheme[posn] and returns six @scheme[posn]s that @racket[posn] and returns six @racket[posn]s that
indicate what the neighbors are, without consideration indicate what the neighbors are, without consideration
of the size of the board (or the missing corner pieces). of the size of the board (or the missing corner pieces).
For example, these are the @scheme[posn]s that are adjacent For example, these are the @racket[posn]s that are adjacent
to @scheme[(make-posn 0 1)]; note that the first and the third to @racket[(make-posn 0 1)]; note that the first and the third
are not on the board and do not show up in are not on the board and do not show up in
@scheme[neighbors] function example above. @racket[neighbors] function example above.
@chunk[<adjacent-tests> @chunk[<adjacent-tests>
(test (adjacent (make-posn 0 1)) (test (adjacent (make-posn 0 1))
@ -620,7 +620,7 @@ are not on the board and do not show up in
(make-posn 1 2)))] (make-posn 1 2)))]
The adjacent function has two main cases; first when the The adjacent function has two main cases; first when the
@scheme[y] coordinate of the @scheme[posn] is even and @racket[y] coordinate of the @racket[posn] is even and
second when it is odd. In each case, it is just a matter second when it is odd. In each case, it is just a matter
of looking at the board and calculating coordinate offsets. of looking at the board and calculating coordinate offsets.
@ -647,10 +647,10 @@ of looking at the board and calculating coordinate offsets.
(make-posn x (+ y 1)) (make-posn x (+ y 1))
(make-posn (+ x 1) (+ y 1)))])))] (make-posn (+ x 1) (+ y 1)))])))]
The @scheme[on-boundary?] function returns @scheme[#t] when The @racket[on-boundary?] function returns @racket[#t] when
the posn would be on the boundary of a board of size the posn would be on the boundary of a board of size
@scheme[board-size]. Note that this function does not @racket[board-size]. Note that this function does not
have to special case the missing @scheme[posn]s from the corners. have to special case the missing @racket[posn]s from the corners.
@chunk[<on-boundary?> @chunk[<on-boundary?>
(define/contract (on-boundary? p board-size) (define/contract (on-boundary? p board-size)
@ -661,10 +661,10 @@ have to special case the missing @scheme[posn]s from the corners.
(= (posn-x p) (- board-size 1)) (= (posn-x p) (- board-size 1))
(= (posn-y p) (- board-size 1))))] (= (posn-y p) (- board-size 1))))]
The @scheme[in-bounds?] function returns @scheme[#t] The @racket[in-bounds?] function returns @racket[#t]
when the @scheme[posn] is actually on the board, meaning when the @racket[posn] is actually on the board, meaning
that the coordinates of the @scheme[posn] are within the that the coordinates of the @racket[posn] are within the
board's size, and that the @scheme[posn] is not one board's size, and that the @racket[posn] is not one
of the two corners that have been removed. of the two corners that have been removed.
@chunk[<in-bounds?> @chunk[<in-bounds?>
@ -689,12 +689,12 @@ determines where the shortest paths from the cat's current position to the bound
<on-cats-path?-tests> <on-cats-path?-tests>
<+/f-tests>] <+/f-tests>]
The function @scheme[on-cats-path?] accepts a world and returns a predicate The function @racket[on-cats-path?] accepts a world and returns a predicate
on the @scheme[posn]s in the world. The predicate indicates if the given on the @racket[posn]s in the world. The predicate indicates if the given
@scheme[posn] is on the shortest path. @racket[posn] is on the shortest path.
For example, in a world of size @scheme[7] with the cat at For example, in a world of size @racket[7] with the cat at
@scheme[(make-posn 2 2)], the circles with white centers @racket[(make-posn 2 2)], the circles with white centers
are on the shortest path to the boundary: are on the shortest path to the boundary:
@image["chat-noir/cat-distance-example.png"] @image["chat-noir/cat-distance-example.png"]
@ -723,7 +723,7 @@ the cat to the boundary.
The code is essentially that, plus two other special cases. Specifically if the The code is essentially that, plus two other special cases. Specifically if the
``h'' key is not pressed down, then we just consider no cells to be on that shortest ``h'' key is not pressed down, then we just consider no cells to be on that shortest
path. And if the distance to the cat is @scheme['], then again no nodes are on the path. And if the distance to the cat is @racket['], then again no nodes are on the
path. The second situation happens when the cat is completely boxed in and has path. The second situation happens when the cat is completely boxed in and has
lost the game. lost the game.
@ -748,8 +748,8 @@ lost the game.
[else [else
(lambda (p) #f)]))] (lambda (p) #f)]))]
Finally, the helper function @scheme[+/f] is just like @scheme[+], except that Finally, the helper function @racket[+/f] is just like @racket[+], except that
it returns @scheme['] if either argument is @scheme[']. it returns @racket['] if either argument is @racket['].
@chunk[<+/f> @chunk[<+/f>
(define (+/f x y) (define (+/f x y)
@ -762,15 +762,15 @@ it returns @scheme['∞] if either argument is @scheme['∞].
@section{Drawing the Cat} @section{Drawing the Cat}
This code is three large, similar constants, This code is three large, similar constants,
bundled up into the @scheme[cat] function. bundled up into the @racket[cat] function.
The @scheme[thinking-cat] is the one that The @racket[thinking-cat] is the one that
is visible when the game is being played. It is visible when the game is being played. It
differs from the others in that it does not differs from the others in that it does not
have a mouth. The @scheme[mad-cat] is the one have a mouth. The @racket[mad-cat] is the one
that you see when the cat loses. It differs that you see when the cat loses. It differs
from the others in that its pinks turn pink. from the others in that its pinks turn pink.
Finally, the @scheme[happy-cat] shows up when Finally, the @racket[happy-cat] shows up when
the cat wins and it is just like the @scheme[thinking-cat] the cat wins and it is just like the @racket[thinking-cat]
except it has a smile. except it has a smile.
@chunk[<drawing-the-cat> @chunk[<drawing-the-cat>
@ -880,9 +880,9 @@ of the circles that are drawn on the board,
plus the radius of an invisible circle plus the radius of an invisible circle
that, if they were drawn on top of that, if they were drawn on top of
the circles, would touch the circles, would touch
each other. Accordingly, @scheme[circle-spacing] each other. Accordingly, @racket[circle-spacing]
is used when computing the positions of the circles, is used when computing the positions of the circles,
but the circles are drawn using @scheme[circle-radius]. but the circles are drawn using @racket[circle-radius].
@chunk[<constants> @chunk[<constants>
(define circle-radius 20) (define circle-radius 20)
@ -896,7 +896,7 @@ The other four constants specify the colors of the circles.
(define blocked-color 'black) (define blocked-color 'black)
(define under-mouse-color 'black)] (define under-mouse-color 'black)]
The main function for drawing a world is @scheme[render-world]. The main function for drawing a world is @racket[render-world].
It is a fairly straightforward composition of helper functions. It is a fairly straightforward composition of helper functions.
First, it builds the image of a board, and then puts the cat on it. First, it builds the image of a board, and then puts the cat on it.
Lastly, since the whiskers of the cat might now hang off of the edge Lastly, since the whiskers of the cat might now hang off of the edge
@ -921,7 +921,7 @@ and that the pinhole is always in the upper-left corner of the window.
Trimming the cat's whiskers amounts to removing any extra Trimming the cat's whiskers amounts to removing any extra
space in the image that appears to the left or above the pinhole. space in the image that appears to the left or above the pinhole.
For example, the @scheme[rectangle] function returns For example, the @racket[rectangle] function returns
an image with a pinhole in the middle. So trimming 5x5 an image with a pinhole in the middle. So trimming 5x5
rectangle results in a 3x3 rectangle with the pinhole rectangle results in a 3x3 rectangle with the pinhole
at (0,0). at (0,0).
@ -930,7 +930,7 @@ at (0,0).
(test (chop-whiskers (rectangle 5 5 'solid 'black)) (test (chop-whiskers (rectangle 5 5 'solid 'black))
(put-pinhole (rectangle 3 3 'solid 'black) 0 0))] (put-pinhole (rectangle 3 3 'solid 'black) 0 0))]
The function uses @scheme[shrink] to remove all of the material above The function uses @racket[shrink] to remove all of the material above
and to the left of the pinhole. and to the left of the pinhole.
@chunk[<chop-whiskers> @chunk[<chop-whiskers>
@ -942,9 +942,9 @@ and to the left of the pinhole.
(- (image-width img) (pinhole-x img) 1) (- (image-width img) (pinhole-x img) 1)
(- (image-height img) (pinhole-y img) 1)))] (- (image-height img) (pinhole-y img) 1)))]
The @scheme[render-board] function uses @scheme[for/fold] to iterate The @racket[render-board] function uses @racket[for/fold] to iterate
over all of the @scheme[cell]s in @scheme[cs]. It starts with over all of the @racket[cell]s in @racket[cs]. It starts with
an empty rectangle and, one by one, puts the cells on @scheme[image]. an empty rectangle and, one by one, puts the cells on @racket[image].
@chunk[<render-board> @chunk[<render-board>
;; render-board : board number (posn -> boolean) posn-or-#f -> image ;; render-board : board number (posn -> boolean) posn-or-#f -> image
@ -965,7 +965,7 @@ an empty rectangle and, one by one, puts the cells on @scheme[image].
(and (posn? mouse) (and (posn? mouse)
(equal? mouse (cell-p c)))))))] (equal? mouse (cell-p c)))))))]
The @scheme[render-cell] function accepts a @scheme[cell], The @racket[render-cell] function accepts a @racket[cell],
a boolean indicating if the cell is on the shortest path between a boolean indicating if the cell is on the shortest path between
the cat and the boundary, and a second boolean indicating the cat and the boundary, and a second boolean indicating
if the cell is underneath the mouse. It returns an image if the cell is underneath the mouse. It returns an image
@ -998,7 +998,7 @@ results in the cell being placed in the right place.
(- x) (- x)
(- y))))] (- y))))]
The @scheme[world-width] function computes the width of the rendered world, The @racket[world-width] function computes the width of the rendered world,
given the world's size by finding the center of the rightmost posn, given the world's size by finding the center of the rightmost posn,
and then adding an additional radius. and then adding an additional radius.
@ -1009,7 +1009,7 @@ and then adding an additional radius.
(make-posn (- board-size 1) (- board-size 2))]) (make-posn (- board-size 1) (- board-size 2))])
(+ (cell-center-x rightmost-posn) circle-radius)))] (+ (cell-center-x rightmost-posn) circle-radius)))]
Similarly, the @scheme[world-height] function computest the Similarly, the @racket[world-height] function computest the
height of the rendered world, given the world's size. height of the rendered world, given the world's size.
@chunk[<world-height> @chunk[<world-height>
@ -1020,12 +1020,12 @@ height of the rendered world, given the world's size.
(ceiling (+ (cell-center-y bottommost-posn) (ceiling (+ (cell-center-y bottommost-posn)
circle-radius))))] circle-radius))))]
The @scheme[cell-center-x] function returns the The @racket[cell-center-x] function returns the
@tt{x} coordinate of the center of the cell specified @tt{x} coordinate of the center of the cell specified
by @scheme[p]. by @racket[p].
For example, the first cell in For example, the first cell in
the third row (counting from @scheme[0]) is the third row (counting from @racket[0]) is
flush with the edge of the screen, so its flush with the edge of the screen, so its
center is just the radius of the circle that center is just the radius of the circle that
is drawn. is drawn.
@ -1037,20 +1037,20 @@ is drawn.
The first cell in the second row, in contrast The first cell in the second row, in contrast
is offset from the third row by is offset from the third row by
@scheme[circle-spacing]. @racket[circle-spacing].
@chunk[<cell-center-x-tests> @chunk[<cell-center-x-tests>
(test (cell-center-x (make-posn 0 1)) (test (cell-center-x (make-posn 0 1))
(+ circle-spacing circle-radius))] (+ circle-spacing circle-radius))]
The definition of @scheme[cell-center-x] The definition of @racket[cell-center-x]
multiplies the @scheme[x] coordinate of multiplies the @racket[x] coordinate of
@scheme[p] by twice @scheme[circle-spacing] @racket[p] by twice @racket[circle-spacing]
and then adds @scheme[circle-radius] to move and then adds @racket[circle-radius] to move
over for the first circle. In addition over for the first circle. In addition
if the @scheme[y] coordinate is odd, then if the @racket[y] coordinate is odd, then
it adds @scheme[circle-spacing], shifting it adds @racket[circle-spacing], shifting
the entire line over. the entire line over.
@chunk[<cell-center-x> @chunk[<cell-center-x>
@ -1064,9 +1064,9 @@ the entire line over.
circle-spacing circle-spacing
0))))] 0))))]
The @scheme[cell-center-y] function computes the The @racket[cell-center-y] function computes the
@scheme[y] coordinate of a cell's location on @racket[y] coordinate of a cell's location on
the screen. For example, the @scheme[y] the screen. For example, the @racket[y]
coordinate of the first row is coordinate of the first row is
the radius of a circle, ensuring that the radius of a circle, ensuring that
the first row is flush against the top of the first row is flush against the top of
@ -1076,10 +1076,10 @@ the screen.
(test (cell-center-y (make-posn 1 0)) (test (cell-center-y (make-posn 1 0))
circle-radius)] circle-radius)]
Because the grid is hexagonal, the @scheme[y] coordinates Because the grid is hexagonal, the @racket[y] coordinates
of the rows do not have the same spacing as the @scheme[x] of the rows do not have the same spacing as the @racket[x]
coordinates. In particular, they are off by coordinates. In particular, they are off by
@tt{sin(pi/3)}. We approximate that by @scheme[866/1000] @tt{sin(pi/3)}. We approximate that by @racket[866/1000]
in order to keep the computations and test cases simple in order to keep the computations and test cases simple
and using exact numbers. and using exact numbers.
A more precise approximation would be A more precise approximation would be
@ -1123,7 +1123,7 @@ plus various helper functions.
<update-world-posn-tests> <update-world-posn-tests>
<clack-tests>] <clack-tests>]
The @scheme[change] function handles keyboard input. If the input is @litchar{n} and the The @racket[change] function handles keyboard input. If the input is @litchar{n} and the
game is over, then restart the game. If the input is @litchar{h} then turn on the help game is over, then restart the game. If the input is @litchar{h} then turn on the help
and otherwise do nothing. and otherwise do nothing.
@ -1144,7 +1144,7 @@ and otherwise do nothing.
#t)] #t)]
[else w]))] [else w]))]
The @scheme[release] function adjusts the world for a key release event. The @racket[release] function adjusts the world for a key release event.
@chunk[<release> @chunk[<release>
;; release : world key-event -> world ;; release : world key-event -> world
@ -1159,15 +1159,15 @@ The @scheme[release] function adjusts the world for a key release event.
(world-h-down? w))))] (world-h-down? w))))]
The @scheme[clack] function handles mouse input. It has three tasks and each corresponds The @racket[clack] function handles mouse input. It has three tasks and each corresponds
to a helper function: to a helper function:
@itemize[ @itemize[
@item{block the clicked cell (@scheme[block-cell/world]),} @item{block the clicked cell (@racket[block-cell/world]),}
@item{move the cat (@scheme[move-cat]), and} @item{move the cat (@racket[move-cat]), and}
@item{update the black dot as the mouse moves around (@scheme[update-world-posn]).}] @item{update the black dot as the mouse moves around (@racket[update-world-posn]).}]
The helper functions are combined in the body of @scheme[clack], The helper functions are combined in the body of @racket[clack],
first checking to see if the mouse event corresponds to a first checking to see if the mouse event corresponds to a
player's move (via the @scheme[player-moved?] function. player's move (via the @racket[player-moved?] function.
@chunk[<clack> @chunk[<clack>
(define/contract (clack world x y evt) (define/contract (clack world x y evt)
@ -1187,12 +1187,12 @@ player's move (via the @scheme[player-moved?] function.
(not (equal? evt "leave")) (not (equal? evt "leave"))
(make-posn x y)))))] (make-posn x y)))))]
The @scheme[player-moved?] predicate returns The @racket[player-moved?] predicate returns
a @scheme[posn] indicating where the player chose a @racket[posn] indicating where the player chose
to move when the mouse event corresponds to a player move, to move when the mouse event corresponds to a player move,
and returns @scheme[#f]. It first checks to see if the and returns @racket[#f]. It first checks to see if the
mouse event is a button up event and that the game mouse event is a button up event and that the game
is not over, and then it just calls @scheme[circle-at-point]. is not over, and then it just calls @racket[circle-at-point].
@chunk[<player-moved?> @chunk[<player-moved?>
(define/contract (player-moved? world x y evt) (define/contract (player-moved? world x y evt)
@ -1202,11 +1202,11 @@ is not over, and then it just calls @scheme[circle-at-point].
(equal? 'playing (world-state world)) (equal? 'playing (world-state world))
(circle-at-point (world-board world) x y)))] (circle-at-point (world-board world) x y)))]
The @scheme[circle-at-point] function returns a @scheme[posn] when The @racket[circle-at-point] function returns a @racket[posn] when
the coordinate (@scheme[x],@scheme[y]) is inside an unblocked circle the coordinate (@racket[x],@racket[y]) is inside an unblocked circle
on the given board. Instead of computing the nearest on the given board. Instead of computing the nearest
circle to the coordinates, it simply iterates over the cells on the circle to the coordinates, it simply iterates over the cells on the
board and returns the @scheme[posn] of the matching cell. board and returns the @racket[posn] of the matching cell.
@chunk[<circle-at-point> @chunk[<circle-at-point>
(define/contract (circle-at-point board x y) (define/contract (circle-at-point board x y)
@ -1219,9 +1219,9 @@ board and returns the @scheme[posn] of the matching cell.
board))] board))]
The @scheme[point-in-this-circle?] function returns @scheme[#t] The @racket[point-in-this-circle?] function returns @racket[#t]
when the point (@scheme[x],@scheme[y]) on the screen when the point (@racket[x],@racket[y]) on the screen
falls within the circle located at the @scheme[posn] @scheme[p]. falls within the circle located at the @racket[posn] @racket[p].
This is precise about checking the circles. For example, This is precise about checking the circles. For example,
a point that is (14,14) away from the center of a circle a point that is (14,14) away from the center of a circle
@ -1245,15 +1245,15 @@ since it crosses the boundary away from a circle of radius
(+ (cell-center-y (make-posn 1 0)) 15)) (+ (cell-center-y (make-posn 1 0)) 15))
#f)] #f)]
The implementation of @scheme[point-in-this-circle?] uses The implementation of @racket[point-in-this-circle?] uses
complex numbers to represent both points on the screen complex numbers to represent both points on the screen
and directional vectors. In particular, the and directional vectors. In particular, the
variable @scheme[center] is a complex number whose variable @racket[center] is a complex number whose
real part is the @tt{x} coordinate of the center of real part is the @tt{x} coordinate of the center of
the cell at @scheme[p], and its imaginary part is the cell at @racket[p], and its imaginary part is
@tt{y} coordinate. Similarly, @scheme[mp] is bound @tt{y} coordinate. Similarly, @racket[mp] is bound
to a complex number corresponding to the position of to a complex number corresponding to the position of
the mouse, at (@scheme[x], @scheme[y]). Then, the the mouse, at (@racket[x], @racket[y]). Then, the
function computes the vector between the two points function computes the vector between the two points
by subtracting the complex numbers from each by subtracting the complex numbers from each
other and extracting the magnitude from that vector. other and extracting the magnitude from that vector.
@ -1268,9 +1268,9 @@ other and extracting the magnitude from that vector.
(<= (magnitude (- center mp)) (<= (magnitude (- center mp))
circle-radius)))] circle-radius)))]
In the event that @scheme[player-moved?] returns a @scheme[posn], In the event that @racket[player-moved?] returns a @racket[posn],
the @scheme[clack] function blocks the clicked on cell using the @racket[clack] function blocks the clicked on cell using
@scheme[block-cell/world], which simply calls @scheme[block-cell]. @racket[block-cell/world], which simply calls @racket[block-cell].
@chunk[<block-cell/world> @chunk[<block-cell/world>
(define/contract (block-cell/world to-block w) (define/contract (block-cell/world to-block w)
@ -1282,12 +1282,12 @@ the @scheme[clack] function blocks the clicked on cell using
(world-mouse-posn w) (world-mouse-posn w)
(world-h-down? w)))] (world-h-down? w)))]
The @scheme[move-cat] function uses calls @scheme[build-bfs-table] The @racket[move-cat] function uses calls @racket[build-bfs-table]
to find the shortest distance from all of the cells to the boundary, to find the shortest distance from all of the cells to the boundary,
and then uses @scheme[find-best-positions] to compute the and then uses @racket[find-best-positions] to compute the
list of neighbors of the cat that have the shortest distance list of neighbors of the cat that have the shortest distance
to the boundary. If that list is empty, then @scheme[next-cat-position] to the boundary. If that list is empty, then @racket[next-cat-position]
is @scheme[#f], and otherwise, it is a random element from that list. is @racket[#f], and otherwise, it is a random element from that list.
@chunk[<move-cat> @chunk[<move-cat>
(define/contract (move-cat world) (define/contract (move-cat world)
@ -1308,7 +1308,7 @@ is @scheme[#f], and otherwise, it is a random element from that list.
<moved-cat-world>))] <moved-cat-world>))]
Once @scheme[next-cat-position] has been computed, it is used to update Once @racket[next-cat-position] has been computed, it is used to update
the @tt{cat} and @tt{state} fields of the world, recording the cat's new the @tt{cat} and @tt{state} fields of the world, recording the cat's new
position and whether or not the cat won. position and whether or not the cat won.
@ -1329,13 +1329,13 @@ position and whether or not the cat won.
(world-h-down? world))] (world-h-down? world))]
The @scheme[find-best-positions] function accepts The @racket[find-best-positions] function accepts
two parallel lists, one of @scheme[posn]s, and one two parallel lists, one of @racket[posn]s, and one
of scores for those @scheme[posn]s, and it of scores for those @racket[posn]s, and it
returns either a non-empty list of @scheme[posn]s returns either a non-empty list of @racket[posn]s
that have tied for the best score, or it that have tied for the best score, or it
returns @scheme[#f], if the best score is returns @racket[#f], if the best score is
@scheme[']. @racket['].
@chunk[<find-best-positions> @chunk[<find-best-positions>
(define/contract (find-best-positions posns scores) (define/contract (find-best-positions posns scores)
@ -1358,8 +1358,8 @@ returns @scheme[#f], if the best score is
(map list scores posns)))])))] (map list scores posns)))])))]
This is a helper function that behaves like This is a helper function that behaves like
@scheme[<=], but is extended to deal properly with @racket[<=], but is extended to deal properly with
@scheme[']. @racket['].
@chunk[<lt/f> @chunk[<lt/f>
(define/contract (<=/f a b) (define/contract (<=/f a b)
@ -1372,13 +1372,13 @@ This is a helper function that behaves like
[else (<= a b)]))] [else (<= a b)]))]
Finally, to complete the mouse event handling, the @scheme[update-world-posn] Finally, to complete the mouse event handling, the @racket[update-world-posn]
function is called from @scheme[clack]. It updates the @tt{mouse-down} function is called from @racket[clack]. It updates the @tt{mouse-down}
field of the @scheme[world]. If the @scheme[p] argument is a @scheme[posn], field of the @racket[world]. If the @racket[p] argument is a @racket[posn],
it corresponds to the location of the mouse, in graphical coordinates. it corresponds to the location of the mouse, in graphical coordinates.
So, the function converts it to a cell position on the board and uses that. So, the function converts it to a cell position on the board and uses that.
Otherwise, when @scheme[p] is @scheme[#f], the @tt{mouse-down} field Otherwise, when @racket[p] is @racket[#f], the @tt{mouse-down} field
is just updated to @scheme[#f]. is just updated to @racket[#f].
@chunk[<update-world-posn> @chunk[<update-world-posn>
(define/contract (update-world-posn w p) (define/contract (update-world-posn w p)
@ -1415,11 +1415,11 @@ This section consists of some infrastructure for
maintaining tests, plus a pile of additional tests maintaining tests, plus a pile of additional tests
for the other functions in this document. for the other functions in this document.
The @scheme[test] and @scheme[test/set] macros The @racket[test] and @racket[test/set] macros
package up their arguments into thunks and then package up their arguments into thunks and then
simply call @scheme[test/proc], supplying simply call @racket[test/proc], supplying
information about the source location of the test information about the source location of the test
case. The @scheme[test/proc] function runs the tests case. The @racket[test/proc] function runs the tests
and reports the results. and reports the results.
@chunk[<test-infrastructure> @chunk[<test-infrastructure>
@ -2391,7 +2391,7 @@ First, here is a function to compute state of the world at the start of a game.
#f))] #f))]
Finally, we can define and provide a function to start the game Finally, we can define and provide a function to start the game
by calling @scheme[big-bang] with the appropriate arguments. by calling @racket[big-bang] with the appropriate arguments.
@chunk[<go> @chunk[<go>
(provide main) (provide main)

View File

@ -21,81 +21,81 @@
[move (any/c gl-vector? . -> . any) void] [move (any/c gl-vector? . -> . any) void]
[who string? "this game"])]{ [who string? "this game"])]{
The @scheme[min-x], @scheme[max-x], @scheme[min-y], and @scheme[max-y] The @racket[min-x], @racket[max-x], @racket[min-y], and @racket[max-y]
arguments specify the dimensions of the board plane to be visible in arguments specify the dimensions of the board plane to be visible in
the window by default. the window by default.
The @scheme[lift] argument specifies how many units a piece moves The @racket[lift] argument specifies how many units a piece moves
vertically when the user clicks on it. vertically when the user clicks on it.
The @scheme[move] function is called when a piece is moved to a space The @racket[move] function is called when a piece is moved to a space
(possibly it's current space), when a space is clicked on, and when a (possibly it's current space), when a space is clicked on, and when a
space is dragged to another space. The @scheme[move] function is space is dragged to another space. The @racket[move] function is
given the information of the piece or space selected and the given the information of the piece or space selected and the
coordinates to which it is moved. coordinates to which it is moved.
The @scheme[who] argument is used for reporting an error to the user The @racket[who] argument is used for reporting an error to the user
when GL is unavailable at run time.} when GL is unavailable at run time.}
@defmethod[(add-space [draw (-> any)] [info any/c]) void?]{ @defmethod[(add-space [draw (-> any)] [info any/c]) void?]{
Adds a space to the board. The @scheme[draw] thunk should draw the Adds a space to the board. The @racket[draw] thunk should draw the
space (using GL commands) when called. The @scheme[info] value is space (using GL commands) when called. The @racket[info] value is
given to the @scheme[_move] function (supplied to the constructor) given to the @racket[_move] function (supplied to the constructor)
when the space is selected.} when the space is selected.}
@defmethod[(add-piece [x real?][y real?][z real?] @defmethod[(add-piece [x real?][y real?][z real?]
[draw ([shadow? boolean?] . -> . any)] [info any/c]) void?]{ [draw ([shadow? boolean?] . -> . any)] [info any/c]) void?]{
Adds a piece to the board. The @scheme[draw] thunk should draw the Adds a piece to the board. The @racket[draw] thunk should draw the
piece (using GL commands) when called. The @scheme[info] argument is piece (using GL commands) when called. The @racket[info] argument is
given to the @scheme[_move] function (supplied to the constructor) given to the @racket[_move] function (supplied to the constructor)
when the piece is moved. The piece is translated by @scheme[x], when the piece is moved. The piece is translated by @racket[x],
@scheme[y], and @scheme[z] before drawing.} @racket[y], and @racket[z] before drawing.}
@defmethod[(remove-piece [info any/c]) void?]{ @defmethod[(remove-piece [info any/c]) void?]{
Removes all pieces previously added with representative @scheme[info].} Removes all pieces previously added with representative @racket[info].}
@defmethod[(add-heads-up [w real?] [h real?] [draw (-> any)] [info any/c]) void?]{ @defmethod[(add-heads-up [w real?] [h real?] [draw (-> any)] [info any/c]) void?]{
Add a ``heads-up'' display element whose size is @scheme[w] by Add a ``heads-up'' display element whose size is @racket[w] by
@scheme[h] units with the given @scheme[draw] thunk and @scheme[info] @racket[h] units with the given @racket[draw] thunk and @racket[info]
reprsentative.} reprsentative.}
@defmethod[(remove-heads-up [info any/c]) void?]{ @defmethod[(remove-heads-up [info any/c]) void?]{
Removes all ``heads-up'' displays elements previous added with Removes all ``heads-up'' displays elements previous added with
representative @scheme[info].} representative @racket[info].}
@defmethod[(set-space-draw [info any/c] [draw (-> any)]) void?]{ @defmethod[(set-space-draw [info any/c] [draw (-> any)]) void?]{
Sets the drawing function of all spaces added with Sets the drawing function of all spaces added with
representative @scheme[info].} representative @racket[info].}
@defmethod[(set-piece-draw [info any/c] @defmethod[(set-piece-draw [info any/c]
[draw ([shadow? boolean?] . -> . any)]) void?]{ [draw ([shadow? boolean?] . -> . any)]) void?]{
Sets the drawing function of all pieces added with Sets the drawing function of all pieces added with
representative @scheme[info].} representative @racket[info].}
@defmethod[(enable-piece [info any/c][can-move? any/c]) void?]{ @defmethod[(enable-piece [info any/c][can-move? any/c]) void?]{
Enables or disables moving of all pieces added with Enables or disables moving of all pieces added with
representative @scheme[info].} representative @racket[info].}
@defmethod[(enabled? [info any/c]) boolean?]{ @defmethod[(enabled? [info any/c]) boolean?]{
reports whether the first piece with representative @scheme[info] is enabled.} reports whether the first piece with representative @racket[info] is enabled.}
@ -105,7 +105,7 @@ reports whether the first piece with representative @scheme[info] is enabled.}
[(get-heads-up) list?])]{ [(get-heads-up) list?])]{
Returns values for various kinds of content currently on the Returns values for various kinds of content currently on the
board. The result corresponds to @scheme[_info] values given to board. The result corresponds to @racket[_info] values given to
@scheme[add-piece], etc.} @racket[add-piece], etc.}
} }

View File

@ -4,4 +4,4 @@
@gametitle["Checkers" "checkers" "Board Game"] @gametitle["Checkers" "checkers" "Board Game"]
This simple checkers game (with no AI player) is intended as a This simple checkers game (with no AI player) is intended as a
demonstration use of the @schememodname[games/gl-board-game] library. demonstration use of the @racketmodname[games/gl-board-game] library.

View File

@ -22,33 +22,33 @@ installed as sub-collections of the @filepath{games} collection (see
The game-starting console inspects the sub-collections of the The game-starting console inspects the sub-collections of the
@filepath{games} collection. If a sub-collection has an @filepath{games} collection. If a sub-collection has an
@filepath{info.rkt} module (see @schememodname[setup/infotab]), the @filepath{info.rkt} module (see @racketmodname[setup/infotab]), the
following fields of the collection's @filepath{info.rkt} file are used: following fields of the collection's @filepath{info.rkt} file are used:
@itemize[ @itemize[
@item{@schemeidfont{game} [required] : used as a module name in the @item{@racketidfont{game} [required] : used as a module name in the
sub-collection to load for the game; the module must provide a sub-collection to load for the game; the module must provide a
@schemeidfont["game@"] unit (see @schememodname[scheme/unit]) with @racketidfont["game@"] unit (see @racketmodname[scheme/unit]) with
no particular exports; the unit is invoked with no imports to no particular exports; the unit is invoked with no imports to
start the game.} start the game.}
@item{@schemeidfont{name} [defaults to the collection name] : used to @item{@racketidfont{name} [defaults to the collection name] : used to
label the game-starting button in the game console.} label the game-starting button in the game console.}
@item{@schemeidfont{game-icon} [defaults to collection name with @item{@racketidfont{game-icon} [defaults to collection name with
@filepath{.png}] : used as a path to a bitmap file that is used for @filepath{.png}] : used as a path to a bitmap file that is used for
the game button's label; this image should be 32 by 32 pixels and the game button's label; this image should be 32 by 32 pixels and
have a mask.} have a mask.}
@item{@schemeidfont{game-set} [defaults to @scheme["Other Games"]] : @item{@racketidfont{game-set} [defaults to @racket["Other Games"]] :
a label used to group games that declare themselves to be in the a label used to group games that declare themselves to be in the
same set.} same set.}
] ]
To implement card games, see @schememodname[games/cards]. Card games To implement card games, see @racketmodname[games/cards]. Card games
typically belong in the @scheme["Cards"] game set. typically belong in the @racket["Cards"] game set.
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -62,8 +62,8 @@ typically belong in the @scheme["Cards"] game set.
(-> void?)]{ (-> void?)]{
Returns a thunk for opening a Scribbled section in the user's HTML Returns a thunk for opening a Scribbled section in the user's HTML
browser. The @scheme[mod-path] is the document's main source module, browser. The @racket[mod-path] is the document's main source module,
and @scheme[section-tag] specifies the section in the document.} and @racket[section-tag] specifies the section in the document.}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -81,11 +81,11 @@ text. Multiple invocations of the thunk bring the same window to the
foreground (until the user closes the window). foreground (until the user closes the window).
The help window displays @filepath{doc.txt} from the collection The help window displays @filepath{doc.txt} from the collection
specified by @scheme[coll-path]. specified by @racket[coll-path].
The @scheme[frame-title] argument is used for the help window title. The @racket[frame-title] argument is used for the help window title.
If @scheme[verbatim?] is true, then @filepath{doc.txt} is displayed If @racket[verbatim?] is true, then @filepath{doc.txt} is displayed
verbatim, otherwise it is formatted as follows: verbatim, otherwise it is formatted as follows:
@itemize[ @itemize[

View File

@ -62,14 +62,14 @@ provides several functions:
The library re-exports the following identifiers from test-engine/scheme-tests: The library re-exports the following identifiers from test-engine/scheme-tests:
@scheme[build-test-engine] @racket[build-test-engine]
@scheme[builder] @racket[builder]
@scheme[display-results] @racket[display-results]
@scheme[error-handler] @racket[error-handler]
@scheme[exn:fail:wish] @racket[exn:fail:wish]
@scheme[generate-report] @racket[generate-report]
@scheme[get-test-engine] @racket[get-test-engine]
@scheme[reset-tests] @racket[reset-tests]
@scheme[run-tests] @racket[run-tests]
@scheme[scheme-test-data] @racket[scheme-test-data]
@scheme[signature-test-info%] @racket[signature-test-info%]

View File

@ -19,7 +19,7 @@
@defmodule[lang/htdp-beginner] @defmodule[lang/htdp-beginner]
The @schememodname[lang/htdp-beginner] module provides the Beginning The @racketmodname[lang/htdp-beginner] module provides the Beginning
Student language for @|htdp|; see @htdp-ref["beginner"]. Student language for @|htdp|; see @htdp-ref["beginner"].
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@ -27,7 +27,7 @@ Student language for @|htdp|; see @htdp-ref["beginner"].
@defmodule[lang/htdp-beginner-abbr] @defmodule[lang/htdp-beginner-abbr]
The @schememodname[lang/htdp-beginner-abbr] module provides the The @racketmodname[lang/htdp-beginner-abbr] module provides the
Beginning Student with Abbreviations language for @|htdp|; see Beginning Student with Abbreviations language for @|htdp|; see
@htdp-ref["beginner-abbr"]. @htdp-ref["beginner-abbr"].
@ -36,7 +36,7 @@ Beginning Student with Abbreviations language for @|htdp|; see
@defmodule[lang/htdp-intermediate] @defmodule[lang/htdp-intermediate]
The @schememodname[lang/htdp-intermediate] module provides the The @racketmodname[lang/htdp-intermediate] module provides the
Intermediate Student language for @|htdp|; see Intermediate Student language for @|htdp|; see
@htdp-ref["intermediate"]. @htdp-ref["intermediate"].
@ -45,7 +45,7 @@ Intermediate Student language for @|htdp|; see
@defmodule[lang/htdp-intermediate-lambda] @defmodule[lang/htdp-intermediate-lambda]
The @schememodname[lang/htdp-intermediate-lambda] module provides the The @racketmodname[lang/htdp-intermediate-lambda] module provides the
Intermediate Student with Lambda language for @|htdp|; see Intermediate Student with Lambda language for @|htdp|; see
@htdp-ref["intermediate-lam"]. @htdp-ref["intermediate-lam"].
@ -54,7 +54,7 @@ Intermediate Student with Lambda language for @|htdp|; see
@defmodule[lang/htdp-advanced] @defmodule[lang/htdp-advanced]
The @schememodname[lang/htdp-advanced] module provides the Advanced The @racketmodname[lang/htdp-advanced] module provides the Advanced
Student language for @|htdp|; see @htdp-ref["advanced"]. Student language for @|htdp|; see @htdp-ref["advanced"].
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@ -62,17 +62,17 @@ Student language for @|htdp|; see @htdp-ref["advanced"].
@defmodule[lang/plt-pretty-big-text] @defmodule[lang/plt-pretty-big-text]
The @schememodname[lang/plt-pretty-big-text] module is similar to the The @racketmodname[lang/plt-pretty-big-text] module is similar to the
@italic{HtDP} Advanced Student language, but with more of Racket's @italic{HtDP} Advanced Student language, but with more of Racket's
libraries in legacy form. It provides the bindings of libraries in legacy form. It provides the bindings of
@schememodname[mzscheme], @racketmodname[mzscheme],
@schememodname[mzlib/etc], @schememodname[mzlib/file], @racketmodname[mzlib/etc], @racketmodname[mzlib/file],
@schememodname[mzlib/list], @schememodname[mzlib/class], @racketmodname[mzlib/list], @racketmodname[mzlib/class],
@schememodname[mzlib/unit], @schememodname[mzlib/include], @racketmodname[mzlib/unit], @racketmodname[mzlib/include],
@schememodname[mzlib/defmacro], @schememodname[mzlib/pretty], @racketmodname[mzlib/defmacro], @racketmodname[mzlib/pretty],
@schememodname[mzlib/string], @schememodname[mzlib/thread], @racketmodname[mzlib/string], @racketmodname[mzlib/thread],
@schememodname[mzlib/math], @schememodname[mzlib/match], @racketmodname[mzlib/math], @racketmodname[mzlib/match],
@schememodname[mzlib/shared], and @schememodname[lang/posn]. @racketmodname[mzlib/shared], and @racketmodname[lang/posn].
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@ -80,21 +80,21 @@ libraries in legacy form. It provides the bindings of
@defmodule[lang/plt-pretty-big] @defmodule[lang/plt-pretty-big]
The @schememodname[lang/plt-pretty-big] module extends The @racketmodname[lang/plt-pretty-big] module extends
@scheme[lang/plt-pretty-big-text] with @schememodname[scheme/gui/base] @racket[lang/plt-pretty-big-text] with @racketmodname[scheme/gui/base]
and @schememodname[lang/imageeq]. This language corresponds to the and @racketmodname[lang/imageeq]. This language corresponds to the
@onscreen{Pretty Big} legacy language in DrRacket. @onscreen{Pretty Big} legacy language in DrRacket.
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section{@scheme[posn]s in @italic{HtDP} Languages} @section{@racket[posn]s in @italic{HtDP} Languages}
@defmodule[lang/posn] @defmodule[lang/posn]
@defstruct[posn ([x any/c] [y any/c])]{ @defstruct[posn ([x any/c] [y any/c])]{
The @scheme[posn] structure type that is also provided by The @racket[posn] structure type that is also provided by
@scheme[lang/htdp-beginner].} @racket[lang/htdp-beginner].}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -108,7 +108,7 @@ The @scheme[posn] structure type that is also provided by
boolean?]{ boolean?]{
The image-comparison operator that is also provided by The image-comparison operator that is also provided by
@scheme[lang/htdp-beginner].} @racket[lang/htdp-beginner].}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -116,7 +116,7 @@ The image-comparison operator that is also provided by
@defmodule[lang/prim] @defmodule[lang/prim]
The @schememodname[lang/prim] module several syntactic forms for The @racketmodname[lang/prim] module several syntactic forms for
use by the implementors of teachpacks, when the teachpack is to be use by the implementors of teachpacks, when the teachpack is to be
used with the @|htdp| Beginner Student used with the @|htdp| Beginner Student
languages. In Beginner Student, primitive names (for built-in languages. In Beginner Student, primitive names (for built-in
@ -125,49 +125,49 @@ they can be syntactically restricted to application positions.
@defform[(define-primitive id proc-id)]{ @defform[(define-primitive id proc-id)]{
Defines @scheme[id] to be a primitive operator whose implementation Defines @racket[id] to be a primitive operator whose implementation
is @scheme[proc-id], and that takes no procedures as is @racket[proc-id], and that takes no procedures as
arguments. Normally, @scheme[id] is exported from the teachpack and arguments. Normally, @racket[id] is exported from the teachpack and
@scheme[proc-id] is not.} @racket[proc-id] is not.}
@defform[(provide-primitive id)]{ @defform[(provide-primitive id)]{
Like @scheme[define-primitive], but the existing function @scheme[id] is Like @racket[define-primitive], but the existing function @racket[id] is
exported as the primitive operator named @scheme[id]. An alternative exported as the primitive operator named @racket[id]. An alternative
to @scheme[define-primitive].} to @racket[define-primitive].}
@defform[(provide-primitives id ...)]{ @defform[(provide-primitives id ...)]{
Multiple-identifier version of @scheme[provide-primitive].} Multiple-identifier version of @racket[provide-primitive].}
@defform[(define-higher-order-primitive id proc-id (arg ...))]{ @defform[(define-higher-order-primitive id proc-id (arg ...))]{
Defines @scheme[id] to be a primitive operator whose implementation is Defines @racket[id] to be a primitive operator whose implementation is
@scheme[proc-id]. Normally, @scheme[id] is exported from the teachpack and @racket[proc-id]. Normally, @racket[id] is exported from the teachpack and
@scheme[proc-id] is not. @racket[proc-id] is not.
For each non-procedure argument, the corresponding @scheme[arg] should be For each non-procedure argument, the corresponding @racket[arg] should be
an underscore. For each procedure argument, the corresponding @scheme[arg] an underscore. For each procedure argument, the corresponding @racket[arg]
should be the usual name of the procedure. should be the usual name of the procedure.
@as-examples[ @as-examples[
@schemeblock[ @racketblock[
(define-higher-order-primitive convert-gui convert-gui/proc (f2c)) (define-higher-order-primitive convert-gui convert-gui/proc (f2c))
]] ]]
} }
@defform[(provide-higher-order-primitive id (arg ...))]{ @defform[(provide-higher-order-primitive id (arg ...))]{
Like @scheme[define-higher-order-primitive], but the existing function Like @racket[define-higher-order-primitive], but the existing function
@scheme[id] is exported as the primitive operator named @racket[id] is exported as the primitive operator named
@scheme[id]. An alternative to @scheme[define-higher-order-primitive].} @racket[id]. An alternative to @racket[define-higher-order-primitive].}
@defform[(first-order->higher-order expr)]{ @defform[(first-order->higher-order expr)]{
If @scheme[expr] is an identifier for a first-order function (either a If @racket[expr] is an identifier for a first-order function (either a
primitive or a function defined within Beginner Student), produces the primitive or a function defined within Beginner Student), produces the
function as a value; otherwise, the form is equivalent to function as a value; otherwise, the form is equivalent to
@scheme[expr]. @racket[expr].
This form is mainly useful for implementing syntactic forms that, like This form is mainly useful for implementing syntactic forms that, like
the application of a higher-order primitive, allow first-order bindings the application of a higher-order primitive, allow first-order bindings

View File

@ -42,22 +42,22 @@
Lazy Racket is available as both a language level and a module that Lazy Racket is available as both a language level and a module that
can be used to write lazy code. To write lazy code, simply use can be used to write lazy code. To write lazy code, simply use
@schememodname[lazy] as your module's language: @racketmodname[lazy] as your module's language:
@schememod[ @racketmod[
lazy lazy
... @#,elem{lazy code here}...] ... @#,elem{lazy code here}...]
Function applications are delayed, and promises are automatically Function applications are delayed, and promises are automatically
forced. The language provides bindings that are equivalent to most of forced. The language provides bindings that are equivalent to most of
the @schememodname[mzscheme] and @schememodname[scheme/list] the @racketmodname[mzscheme] and @racketmodname[scheme/list]
libraries. Primitives are strict in the expected places; struct libraries. Primitives are strict in the expected places; struct
constructors are lazy; @scheme[if], @scheme[and], @scheme[or] @|etc| constructors are lazy; @racket[if], @racket[and], @racket[or] @|etc|
are plain (lazy) functions. Strict functionality is provided as-is: are plain (lazy) functions. Strict functionality is provided as-is:
@scheme[begin], I/O, mutation, parameterization, etc. To have your @racket[begin], I/O, mutation, parameterization, etc. To have your
code make sense, you should chain side effects in @scheme[begin]s, code make sense, you should chain side effects in @racket[begin]s,
which will sequence things properly. (Note: This is similar to which will sequence things properly. (Note: This is similar to
threading monads through your code---only use @scheme[begin] where threading monads through your code---only use @racket[begin] where
order matters.) order matters.)
Mixing lazy and strict code is simple: you just write the lazy code in Mixing lazy and strict code is simple: you just write the lazy code in
@ -67,11 +67,11 @@ as strict, and on the strict side you only need to force (possibly
recursively) through promises. recursively) through promises.
A few side-effect bindings are provided as-is. For example, A few side-effect bindings are provided as-is. For example,
@scheme[read] and @scheme[printf] do the obvious thing---but note that @racket[read] and @racket[printf] do the obvious thing---but note that
the language is a call-by-need, and you need to be aware when promises the language is a call-by-need, and you need to be aware when promises
are forced. There are also bindings for @scheme[begin] (delays a are forced. There are also bindings for @racket[begin] (delays a
computation that forces all sub-expressions), @scheme[when], computation that forces all sub-expressions), @racket[when],
@scheme[unless], etc. There are, however, less reliable and might @racket[unless], etc. There are, however, less reliable and might
change (or be dropped) in the future. change (or be dropped) in the future.
There are a few additional bindings, the important ones are special There are a few additional bindings, the important ones are special
@ -133,30 +133,30 @@ input arguments in order.}
@defmodule[lazy/force] @defmodule[lazy/force]
The bindings of @schememodname[lazy/force] are re-provided by The bindings of @racketmodname[lazy/force] are re-provided by
@schememodname[lazy]. @racketmodname[lazy].
@defproc[(! [expr any/c]) any/c]{ @defproc[(! [expr any/c]) any/c]{
Evaluates @scheme[expr] strictly. The result is always forced, over Evaluates @racket[expr] strictly. The result is always forced, over
and over until it gets a non-promise value.} and over until it gets a non-promise value.}
@defproc[(!![expr any/c]) any/c]{ @defproc[(!! [expr any/c]) any/c]{
Similar to @scheme[!], but recursively forces a structure (e.g: Similar to @racket[!], but recursively forces a structure (e.g:
lists).} lists).}
@defproc[(!list [expr (or/c promise? list?)]) list?]{ @defproc[(!list [expr (or/c promise? list?)]) list?]{
Forces the @scheme[expr] which is expected to be a list, and forces Forces the @racket[expr] which is expected to be a list, and forces
the @scheme[cdr]s recursively to expose a proper list structure.} the @racket[cdr]s recursively to expose a proper list structure.}
@defproc[(!!list [expr (or/c promise? list?)]) list?]{ @defproc[(!!list [expr (or/c promise? list?)]) list?]{
Similar to @scheme[!list] but also forces (using @scheme[!]) the Similar to @racket[!list] but also forces (using @racket[!]) the
elements of the list.} elements of the list.}
@ -166,7 +166,7 @@ elements of the list.}
To avoid dealing with multiple values, they are treated as a single To avoid dealing with multiple values, they are treated as a single
tuple in the lazy language. This is implemented as a tuple in the lazy language. This is implemented as a
@scheme[multiple-values] struct, with a @scheme[values] slot. @racket[multiple-values] struct, with a @racket[values] slot.
@defproc[(split-values [x multiple-values?]) any]{ @defproc[(split-values [x multiple-values?]) any]{
@ -176,12 +176,12 @@ in the future.)}
@defproc[(!values [expr (or/c promise? multiple-values?)]) any]{ @defproc[(!values [expr (or/c promise? multiple-values?)]) any]{
Forces @scheme[expr] and uses @scheme[split-values] on the result.} Forces @racket[expr] and uses @racket[split-values] on the result.}
@defproc[(!!values [expr (or/c promise? multiple-values?)]) any]{ @defproc[(!!values [expr (or/c promise? multiple-values?)]) any]{
Similar to @scheme[!values], but forces each of the values Similar to @racket[!values], but forces each of the values
recursively.} recursively.}
;} ;}

View File

@ -52,7 +52,7 @@ stepping through the expansion.
@defmodule[macro-debugger/expand] @defmodule[macro-debugger/expand]
This module provides @scheme[expand]-like procedures that allow the This module provides @racket[expand]-like procedures that allow the
user to specify macros whose expansions should be hidden. user to specify macros whose expansions should be hidden.
Warning: because of limitations in the way macro expansion is Warning: because of limitations in the way macro expansion is
@ -62,8 +62,8 @@ result as the original syntax.
@defproc[(expand-only [stx any/c] [transparent-macros (listof identifier?)]) @defproc[(expand-only [stx any/c] [transparent-macros (listof identifier?)])
syntax?]{ syntax?]{
Expands the given syntax @scheme[stx], but only shows the expansion Expands the given syntax @racket[stx], but only shows the expansion
of macros whose names occur in @scheme[transparent-macros]. of macros whose names occur in @racket[transparent-macros].
@(examples #:eval the-eval @(examples #:eval the-eval
(syntax->datum (syntax->datum
@ -75,7 +75,7 @@ result as the original syntax.
@defproc[(expand/hide [stx any/c] [hidden-macros (listof identifier?)]) @defproc[(expand/hide [stx any/c] [hidden-macros (listof identifier?)])
syntax?]{ syntax?]{
Expands the given syntax @scheme[stx], but hides the expansion of macros in the Expands the given syntax @racket[stx], but hides the expansion of macros in the
given identifier list (conceptually, the complement of expand-only). given identifier list (conceptually, the complement of expand-only).
@(examples #:eval the-eval @(examples #:eval the-eval
@ -87,8 +87,8 @@ result as the original syntax.
@defproc[(expand/show-predicate [stx any/c] [show? (-> identifier? boolean?)]) @defproc[(expand/show-predicate [stx any/c] [show? (-> identifier? boolean?)])
syntax?]{ syntax?]{
Expands the given syntax @scheme[stx], but only shows the expansion of macros Expands the given syntax @racket[stx], but only shows the expansion of macros
whose names satisfy the predicate @scheme[show?]. whose names satisfy the predicate @racket[show?].
@(examples #:eval the-eval @(examples #:eval the-eval
(syntax->datum (syntax->datum
@ -116,12 +116,12 @@ the macro's context. The remark is only displayed if the macro that
emits it is considered transparent by the hiding policy. emits it is considered transparent by the hiding policy.
By default, syntax objects in remarks have the transformer's mark By default, syntax objects in remarks have the transformer's mark
applied (using @scheme[syntax-local-introduce]) so that their applied (using @racket[syntax-local-introduce]) so that their
appearance in the macro stepper matches their appearance after the appearance in the macro stepper matches their appearance after the
transformer returns. Unmarking is suppressed if @scheme[unmark?] is transformer returns. Unmarking is suppressed if @racket[unmark?] is
@scheme[#f]. @racket[#f].
@schemeblock[ @racketblock[
(define-syntax (mymac stx) (define-syntax (mymac stx)
(syntax-case stx () (syntax-case stx ()
[(_ x y) [(_ x y)
@ -141,9 +141,9 @@ transformer returns. Unmarking is suppressed if @scheme[unmark?] is
void?]{ void?]{
Emits an event that simulates a local expansion step from Emits an event that simulates a local expansion step from
@scheme[before] to @scheme[after]. @racket[before] to @racket[after].
The @scheme[id] argument acts as the step's ``macro'' for the purposes The @racket[id] argument acts as the step's ``macro'' for the purposes
of macro hiding. of macro hiding.
} }
@ -178,8 +178,8 @@ of macro hiding.
(symbol? -> void?)]{ (symbol? -> void?)]{
Returns a procedure that can be called on the symbol Returns a procedure that can be called on the symbol
@scheme['next] to print the next step or on the symbol @racket['next] to print the next step or on the symbol
@scheme['all] to print out all remaining steps. @racket['all] to print out all remaining steps.
} }
@ -197,7 +197,7 @@ of macro hiding.
@defproc[(browse-syntaxes [stxs (listof syntax?)]) @defproc[(browse-syntaxes [stxs (listof syntax?)])
void?]{ void?]{
Like @scheme[browse-syntax], but shows multiple syntax objects in Like @racket[browse-syntax], but shows multiple syntax objects in
the same frame. The coloring partitions are shared between the two, the same frame. The coloring partitions are shared between the two,
showing the relationships between subterms in different syntax showing the relationships between subterms in different syntax
objects. objects.
@ -270,7 +270,7 @@ syntax may be original, or it may be produced by the expansion of a
nonhygienic macro. nonhygienic macro.
Note: even terms that have the same marks might not be Note: even terms that have the same marks might not be
@scheme[bound-identifier=?] to each other, because they might occur in @racket[bound-identifier=?] to each other, because they might occur in
different environments. different environments.
@;@example[(bound-identifier=? (let ([x 1]) #'x) #'x)] @;@example[(bound-identifier=? (let ([x 1]) #'x) #'x)]
@ -284,8 +284,8 @@ selected term are highlighted in yellow.
The available secondary partitionings are: The available secondary partitionings are:
@itemize[ @itemize[
@item{@scheme[bound-identifier=?]} @item{@racket[bound-identifier=?]}
@item{@scheme[free-identifier=?]} @item{@racket[free-identifier=?]}
] ]
@subsection{Properties} @subsection{Properties}
@ -298,12 +298,12 @@ selected syntax object. The properties pane has two tabbed pages:
If the selection is an identifier, shows the binding information If the selection is an identifier, shows the binding information
associated with the syntax object. For more information, see associated with the syntax object. For more information, see
@scheme[identifier-binding], etc. @racket[identifier-binding], etc.
} }
@item{@bold{Syntax Object}: @item{@bold{Syntax Object}:
Displays source location information and other properties (see Displays source location information and other properties (see
@scheme[syntax-property]) carried by the syntax object. @racket[syntax-property]) carried by the syntax object.
} }
] ]

View File

@ -9,7 +9,7 @@
@title{@bold{Make}: Dependency Manager} @title{@bold{Make}: Dependency Manager}
The @schememodname[make] library provides a Racket version of the The @racketmodname[make] library provides a Racket version of the
popular @exec{make} utility. Its syntax is intended to imitate the popular @exec{make} utility. Its syntax is intended to imitate the
syntax of @exec{make}, only in Racket. syntax of @exec{make}, only in Racket.
@ -24,7 +24,7 @@ dependency tracking, just use @exec{raco make} as described in
@|raco-manual|.} @|raco-manual|.}
If you are already familiar with @exec{make}, skip to the precise If you are already familiar with @exec{make}, skip to the precise
details of the @schememodname[make] library in @secref["make"]. This details of the @racketmodname[make] library in @secref["make"]. This
section contains a brief overview of @exec{make} for everyone section contains a brief overview of @exec{make} for everyone
else. else.
@ -69,13 +69,13 @@ files to determine when a certain step is necessary. The @exec{make}
utility uses existing programs to build your project --- each rule has utility uses existing programs to build your project --- each rule has
a shell command line. a shell command line.
The @schememodname[make] library provides similar functionality, The @racketmodname[make] library provides similar functionality,
except that the description is in Racket, and the steps that are except that the description is in Racket, and the steps that are
needed to build target files are implemented as Racket functions. needed to build target files are implemented as Racket functions.
Here's a Racket program that is equivalent to the above: Here's a Racket program that is equivalent to the above:
@schemeblock[ @racketblock[
(require make) (require make)
(define (make-output in out) (define (make-output in out)
@ -93,14 +93,14 @@ Here's a Racket program that is equivalent to the above:
] ]
If you were to fill in the ellipses above with calls to If you were to fill in the ellipses above with calls to
@scheme[system], you'd have the exact same functionality as the @racket[system], you'd have the exact same functionality as the
original @filepath{Makefile}. In addition, you can use original @filepath{Makefile}. In addition, you can use
@scheme[make/proc] to abstract over the various lines. For example, @racket[make/proc] to abstract over the various lines. For example,
the @filepath{a.output}, @filepath{b.output}, and @filepath{c.output} the @filepath{a.output}, @filepath{b.output}, and @filepath{c.output}
lines are very similar so you can write the code that generates those lines are very similar so you can write the code that generates those
lines: lines:
@schemeblock[ @racketblock[
(require make) (require make)
(define (make-output in out) (define (make-output in out)
@ -138,7 +138,7 @@ lines:
Expands to Expands to
@schemeblock[ @racketblock[
(make/proc (make/proc
(list (list target-expr (list depend-expr ...) (list (list target-expr (list depend-expr ...)
(lambda () command-expr ...)) (lambda () command-expr ...))
@ -154,17 +154,17 @@ Expands to
[argv (or/c string? (vectorof string?) (listof string?))]) [argv (or/c string? (vectorof string?) (listof string?))])
void?] void?]
Performs a make according to @scheme[spec] and using @scheme[argv] as Performs a make according to @racket[spec] and using @racket[argv] as
command-line arguments selecting one or more targets. command-line arguments selecting one or more targets.
Each element of the @scheme[spec] list is a target. A target element Each element of the @racket[spec] list is a target. A target element
that starts with a list of strings is the same as multiple elements, that starts with a list of strings is the same as multiple elements,
one for each string. The second element of each target is a list of one for each string. The second element of each target is a list of
dependencies, and the third element (if any) of a target is the dependencies, and the third element (if any) of a target is the
optional command thunk. optional command thunk.
To make a target, @scheme[make/proc] is first called recursively on To make a target, @racket[make/proc] is first called recursively on
each of the target's dependencies. If a target is not in @scheme[spec] each of the target's dependencies. If a target is not in @racket[spec]
and it exists as a file, then the target is considered made. If a and it exists as a file, then the target is considered made. If a
target's modification date is older than any of its dependencies' target's modification date is older than any of its dependencies'
modification dates, the corresponding command thunk is called. If the modification dates, the corresponding command thunk is called. If the
@ -172,36 +172,36 @@ dependency has no command thunk then no action is taken; such a target
is useful for triggering the make of other targets (i.e., the is useful for triggering the make of other targets (i.e., the
dependencies). dependencies).
While running a command thunk, @scheme[make/proc] catches exceptions While running a command thunk, @racket[make/proc] catches exceptions
and wraps them in an @scheme[exn:fail:make] structure, the raises the and wraps them in an @racket[exn:fail:make] structure, the raises the
resulting structure.} resulting structure.}
@defstruct[(exn:fail:make exn:fail) @defstruct[(exn:fail:make exn:fail)
([targets (listof path-string?)] ([targets (listof path-string?)]
[orig-exn any/c])]{ [orig-exn any/c])]{
The @scheme[targets] field is a list of strings naming the The @racket[targets] field is a list of strings naming the
target(s), and the @scheme[orig-exn] field is the original raised target(s), and the @racket[orig-exn] field is the original raised
value.} value.}
@defboolparam[make-print-checking on?]{ @defboolparam[make-print-checking on?]{
A parameter that controls whether @scheme[make/proc] prints a message A parameter that controls whether @racket[make/proc] prints a message
when making a target. The default is @scheme[#t].} when making a target. The default is @racket[#t].}
@defboolparam[make-print-dep-no-line on?]{ @defboolparam[make-print-dep-no-line on?]{
A parameter that controls whether @scheme[make/proc] prints A parameter that controls whether @racket[make/proc] prints
``checking...'' lines for dependencies that have no target in the ``checking...'' lines for dependencies that have no target in the
given k@scheme[_spec]. The default is @scheme[#f].} given k@racket[_spec]. The default is @racket[#f].}
@defboolparam[make-print-reasons on?]{ @defboolparam[make-print-reasons on?]{
A parameter that controls whether @scheme[make/proc] prints the reason A parameter that controls whether @racket[make/proc] prints the reason
that a command thunk is called. The default is @scheme[#t].} that a command thunk is called. The default is @racket[#t].}
@; ---------------------------------------- @; ----------------------------------------
@ -211,7 +211,7 @@ that a command thunk is called. The default is @scheme[#t].}
@defsignature[make^ ()]{ @defsignature[make^ ()]{
Includes all of the names provided by @schememodname[make].} Includes all of the names provided by @racketmodname[make].}
@; ---------------------------------------- @; ----------------------------------------
@ -221,7 +221,7 @@ Includes all of the names provided by @schememodname[make].}
@defthing[make@ unit?]{ @defthing[make@ unit?]{
A unit that imports nothing and exports @scheme[make^].} A unit that imports nothing and exports @racket[make^].}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -229,19 +229,19 @@ A unit that imports nothing and exports @scheme[make^].}
@defmodule[make/setup-extension] @defmodule[make/setup-extension]
The @schememodname[make/setup-extension] library helps compile C code The @racketmodname[make/setup-extension] library helps compile C code
via Setup PLT's ``pre-install'' phase (triggered by a via Setup PLT's ``pre-install'' phase (triggered by a
@schemeidfont{pre-install-collection} item in @filepath{info.rkt}; see @racketidfont{pre-install-collection} item in @filepath{info.rkt}; see
also @secref[#:doc '(lib "scribblings/raco/raco.scrbl") also @secref[#:doc '(lib "scribblings/raco/raco.scrbl")
"setup-info"]). "setup-info"]).
The @scheme[pre-install] function takes a number of arguments that The @racket[pre-install] function takes a number of arguments that
describe how the C code is compiled---mainly the libraries that it describe how the C code is compiled---mainly the libraries that it
depends on. It then drives a C compiler via the depends on. It then drives a C compiler via the
@schememodname[dynext/compile] and @schememodname[dynext/link] @racketmodname[dynext/compile] and @racketmodname[dynext/link]
functions. functions.
Many issues can complicate C compilation, and the @scheme[pre-install] Many issues can complicate C compilation, and the @racket[pre-install]
function helps with a few: function helps with a few:
@itemize[ @itemize[
@ -263,9 +263,9 @@ issues manually, however. For example, an old @filepath{readline}
installer used to pick whether to link to @filepath{libcurses} or installer used to pick whether to link to @filepath{libcurses} or
@filepath{libncurses} heuristically by inspecting @filepath{libncurses} heuristically by inspecting
@filepath{/usr/lib}. More generally, the ``last chance'' argument to @filepath{/usr/lib}. More generally, the ``last chance'' argument to
@scheme[pre-install] allows an installer to patch compiler and linker @racket[pre-install] allows an installer to patch compiler and linker
options (see @schememodname[dynext/compile] and options (see @racketmodname[dynext/compile] and
@schememodname[dynext/link]) before the C code is compiled or linked. @racketmodname[dynext/link]) before the C code is compiled or linked.
@defproc[(pre-install @defproc[(pre-install
[plthome-dir path-string?] [plthome-dir path-string?]
@ -286,75 +286,75 @@ The arguments are as follows:
@itemize[ @itemize[
@item{@scheme[plthome-dir] --- the directory provided to a `pre-installer' @item{@racket[plthome-dir] --- the directory provided to a `pre-installer'
function.} function.}
@item{@scheme[collection-dir] --- a directory to use as the current directory @item{@racket[collection-dir] --- a directory to use as the current directory
while building.} while building.}
@item{@scheme[c-file] --- the name of the source file (relative to @item{@racket[c-file] --- the name of the source file (relative to
@scheme[collection-dir]). The output file will be the same, except @racket[collection-dir]). The output file will be the same, except
with a @filepath{.c} suffix replaced with @scheme[(system-type with a @filepath{.c} suffix replaced with @racket[(system-type
'so-suffix)], and the path changed to @scheme[(build-path 'so-suffix)], and the path changed to @racket[(build-path
"compiled" "native" (system-library-subpath))]. "compiled" "native" (system-library-subpath))].
If @scheme[(build-path "precompiled" "native" If @racket[(build-path "precompiled" "native"
(system-library-subpath) (path-replace-suffix c-file (system-type (system-library-subpath) (path-replace-suffix c-file (system-type
'so-suffix)))] exists, then @scheme[c-file] is not used at all, 'so-suffix)))] exists, then @racket[c-file] is not used at all,
and the file in the @filepath{precompiled} directory is simply and the file in the @filepath{precompiled} directory is simply
copied.} copied.}
@item{@scheme[default-lib-dir] --- a default directory for finding @item{@racket[default-lib-dir] --- a default directory for finding
supporting libraries, often a subdirectory of supporting libraries, often a subdirectory of
@filepath{collection-dir}. The user can supplement this path by @filepath{collection-dir}. The user can supplement this path by
setting the @indexed-envvar{PLT_EXTENSION_LIB_PATHS} environment setting the @indexed-envvar{PLT_EXTENSION_LIB_PATHS} environment
variable, which applies to all extensions manged by variable, which applies to all extensions manged by
@scheme[pre-install].} @racket[pre-install].}
@item{@scheme[include-subdirs] --- a list of relative paths in which @item{@racket[include-subdirs] --- a list of relative paths in which
@tt{#include} files will be found; the path will be determined @tt{#include} files will be found; the path will be determined
through a search, in case it's not in a standard place like through a search, in case it's not in a standard place like
@filepath{/usr/include}. @filepath{/usr/include}.
For example, the list used to be @scheme['("openssl")] for the For example, the list used to be @racket['("openssl")] for the
@filepath{openssl} collection, because the source uses @filepath{openssl} collection, because the source uses
@tt{#include <openssl/ssl.h>} and @tt{#include <openssl/err.h>}.} @tt{#include <openssl/ssl.h>} and @tt{#include <openssl/err.h>}.}
@item{@scheme[find-unix-libs] --- like @scheme[include-subdirs], but @item{@racket[find-unix-libs] --- like @racket[include-subdirs], but
a list of library bases. Leave off the @filepath{lib} prefix and a list of library bases. Leave off the @filepath{lib} prefix and
any suffix (such as @filepath{.a} or @filepath{.so}). For any suffix (such as @filepath{.a} or @filepath{.so}). For
@filepath{openssl}, the list used to be @scheme['("ssl" @filepath{openssl}, the list used to be @racket['("ssl"
"crypto")]. Each name will essentially get a @tt{-l} prefix for "crypto")]. Each name will essentially get a @tt{-l} prefix for
the linker command line.} the linker command line.}
@item{@scheme[find-windows-libs] --- like @scheme[find-unix-libs], @item{@racket[find-windows-libs] --- like @racket[find-unix-libs],
but for Windows. The library name will be suffixed with but for Windows. The library name will be suffixed with
@filepath{.lib} and supplied directly to the linker.} @filepath{.lib} and supplied directly to the linker.}
@item{@scheme[unix-libs] --- like @scheme[find-unix-libs], except @item{@racket[unix-libs] --- like @racket[find-unix-libs], except
that the installer makes no attempt to find the libraries in a that the installer makes no attempt to find the libraries in a
non-standard place. For example, the @filepath{readline} installer non-standard place. For example, the @filepath{readline} installer
used to supply @scheme['("curses")].} used to supply @racket['("curses")].}
@item{@scheme[windows-libs] --- like @scheme[unix-libs], but for @item{@racket[windows-libs] --- like @racket[unix-libs], but for
Windows. For example, the @filepath{openssl} installer used to Windows. For example, the @filepath{openssl} installer used to
supply @scheme['("wsock32")].} supply @racket['("wsock32")].}
@item{@scheme[extra-depends] --- a list of relative paths to treat as @item{@racket[extra-depends] --- a list of relative paths to treat as
dependencies for compiling @filepath{file.c}. Often this list will dependencies for compiling @filepath{file.c}. Often this list will
include @filepath{file.c} with the @filepath{.c} suffix replaced by include @filepath{file.c} with the @filepath{.c} suffix replaced by
@filepath{.rkt}. For example, the "openssl" installer supplies @filepath{.rkt}. For example, the "openssl" installer supplies
@scheme['("mzssl.rkt")] to ensure that the stub module @racket['("mzssl.rkt")] to ensure that the stub module
@filepath{mzssl.rkt} is never used when the true extension can be @filepath{mzssl.rkt} is never used when the true extension can be
built.} built.}
@item{@scheme[last-chance-k] --- a procedure of one argument, which @item{@racket[last-chance-k] --- a procedure of one argument, which
is a thunk. This procedure should invoke the thunk to make the is a thunk. This procedure should invoke the thunk to make the
file, but it may add parameterizations before the final build. For file, but it may add parameterizations before the final build. For
example, the @filepath{readline} installer used to add an example, the @filepath{readline} installer used to add an
AIX-specific compile flag in this step when compiling on AIX.} AIX-specific compile flag in this step when compiling on AIX.}
@item{@scheme[3m-too?]--- a boolean. If true, when the 3m variant is @item{@racket[3m-too?]--- a boolean. If true, when the 3m variant is
installed, use the equivalent to @exec{raco ctool --xform} to transform installed, use the equivalent to @exec{raco ctool --xform} to transform
the source file and then compile and link for 3m. Otherwise, the the source file and then compile and link for 3m. Otherwise, the
extension is built only for CGC when the CGC variant is installed.} extension is built only for CGC when the CGC variant is installed.}
@ -372,10 +372,10 @@ The arguments are as follows:
[argv (or/c string? (vectorof string?))]) [argv (or/c string? (vectorof string?))])
void?]{ void?]{
Builds bytecode files for each file in @scheme[collection-files], Builds bytecode files for each file in @racket[collection-files],
writing each to a @filepath{compiled} subdirectory and automatically writing each to a @filepath{compiled} subdirectory and automatically
managing dependencies. Supply @scheme['#("zo")] as @scheme[argv] to managing dependencies. Supply @racket['#("zo")] as @racket[argv] to
compile all files. The @scheme[collection-name] argument is used only compile all files. The @racket[collection-name] argument is used only
for printing status information. for printing status information.
Compilation is performed as with @exec{raco make} (see Compilation is performed as with @exec{raco make} (see
@ -387,7 +387,7 @@ Compilation is performed as with @exec{raco make} (see
@defsignature[make:collection^ ()]{ @defsignature[make:collection^ ()]{
Provides @schemeidfont{make-collection}.} Provides @racketidfont{make-collection}.}
@subsection{Unit} @subsection{Unit}
@ -395,5 +395,5 @@ Provides @schemeidfont{make-collection}.}
@defthing[make:collection@ unit?]{ @defthing[make:collection@ unit?]{
Imports @scheme[make^], @scheme[dynext:file^], and @scheme[compiler^], Imports @racket[make^], @racket[dynext:file^], and @racket[compiler^],
and exports @scheme[make:collection^].} and exports @racket[make:collection^].}

View File

@ -25,8 +25,8 @@ fit the widths of all of its children.
[(realign) [(realign)
void?])]{ void?])]{
Realigns the children inside the @scheme[aligned-pasteboard<%>] to Realigns the children inside the @racket[aligned-pasteboard<%>] to
either a given @scheme[width] and @scheme[height] or the previously either a given @racket[width] and @racket[height] or the previously
alloted width and height.} alloted width and height.}
@defmethod[(set-aligned-min-sizes) @defmethod[(set-aligned-min-sizes)

View File

@ -4,7 +4,7 @@
@definterface/title[aligned-pasteboard-parent<%> ()]{ @definterface/title[aligned-pasteboard-parent<%> ()]{
This interface must be implemented by any class who's editor This interface must be implemented by any class who's editor
is an @scheme[aligned-pasteboard<%>]. is an @racket[aligned-pasteboard<%>].
@defmethod[(set-aligned-min-sizes) @defmethod[(set-aligned-min-sizes)
void?]{} void?]{}

View File

@ -4,8 +4,8 @@
@title[#:style 'toc]{Aligned Pasteboard} @title[#:style 'toc]{Aligned Pasteboard}
The aligned-pasteboard library provides classes derived from The aligned-pasteboard library provides classes derived from
@scheme[pasteboard%] with geometry management that mirrors that of @racket[pasteboard%] with geometry management that mirrors that of
@scheme[vertical-panel%] and @scheme[horizontal-panel%]. @racket[vertical-panel%] and @racket[horizontal-panel%].
@defmodule[mrlib/aligned-pasteboard] @defmodule[mrlib/aligned-pasteboard]

View File

@ -4,7 +4,7 @@
@defclass/title[horizontal-pasteboard% pasteboard% (aligned-pasteboard<%>)]{ @defclass/title[horizontal-pasteboard% pasteboard% (aligned-pasteboard<%>)]{
@defconstructor/auto-super[()]{ @defconstructor/auto-super[()]{
Passes all arguments to @scheme[super-init]. Passes all arguments to @racket[super-init].
} }
@defmethod[#:mode override @defmethod[#:mode override

View File

@ -5,7 +5,7 @@
This interface must be implemented by any snip class who's This interface must be implemented by any snip class who's
objects will be stretchable when inserted into an objects will be stretchable when inserted into an
@scheme[aligned-pasteboard<%>]. @racket[aligned-pasteboard<%>].

View File

@ -4,7 +4,7 @@
@defclass/title[vertical-pasteboard% pasteboard% (aligned-pasteboard<%>)]{ @defclass/title[vertical-pasteboard% pasteboard% (aligned-pasteboard<%>)]{
@defconstructor/auto-super[()]{ @defconstructor/auto-super[()]{
Passes all arguments to @scheme[super-init]. Passes all arguments to @racket[super-init].
} }
@defmethod[#:mode override @defmethod[#:mode override

View File

@ -11,7 +11,7 @@
(is-a?/c bitmap%)]{ (is-a?/c bitmap%)]{
Constructs a bitmap label suitable for use a button that contains the Constructs a bitmap label suitable for use a button that contains the
image specified by @scheme[img] followed by the text in @scheme[str].} image specified by @racket[img] followed by the text in @racket[str].}
@defproc[((bitmap-label-maker [str string?] @defproc[((bitmap-label-maker [str string?]
@ -19,5 +19,5 @@ image specified by @scheme[img] followed by the text in @scheme[str].}
[future-parent (is-a?/c area-container<%>)]) [future-parent (is-a?/c area-container<%>)])
(is-a?/c bitmap%)]{ (is-a?/c bitmap%)]{
And older variant of @scheme[make-bitmap-label] that obtains a And older variant of @racket[make-bitmap-label] that obtains a
font to use from a container @scheme[future-parent].} font to use from a container @racket[future-parent].}

View File

@ -5,21 +5,21 @@
@defmodule[mrlib/cache-image-snip]{ @defmodule[mrlib/cache-image-snip]{
The @schememodname[mrlib/cache-image-snip] library provides the core The @racketmodname[mrlib/cache-image-snip] library provides the core
data structure for DrRacket's @filepath{image.rkt} teachpack. Images in data structure for DrRacket's @filepath{image.rkt} teachpack. Images in
the @filepath{image.rkt} teachpack are instances of the the @filepath{image.rkt} teachpack are instances of the
@scheme[cache-image-snip%] class.} @racket[cache-image-snip%] class.}
The library also defines a new type, @scheme[argb], that represents a The library also defines a new type, @racket[argb], that represents a
bitmap, but with alpha values. It has a maker, two selectors, and a bitmap, but with alpha values. It has a maker, two selectors, and a
predicate. predicate.
@defclass[cache-image-snip% image-snip% ()]{ @defclass[cache-image-snip% image-snip% ()]{
The @scheme[cache-image-snip%] class is a subclass of The @racket[cache-image-snip%] class is a subclass of
@scheme[image-snip%] simply so that its instances can be compared with @racket[image-snip%] simply so that its instances can be compared with
@scheme[image-snip%] using @scheme[equal?]. All @scheme[image-snip%] @racket[image-snip%] using @racket[equal?]. All @racket[image-snip%]
functionality is overridden or ignored. functionality is overridden or ignored.
@defmethod[#:mode overrride @defmethod[#:mode overrride
@ -28,7 +28,7 @@ functionality is overridden or ignored.
boolean?]{ boolean?]{
Calls the @method[cache-image-snip% other-equal-to?] method of Calls the @method[cache-image-snip% other-equal-to?] method of
@scheme[snip] if it is also a @scheme[cache-image-snip%] instance, @racket[snip] if it is also a @racket[cache-image-snip%] instance,
otherwise calls the @method[cache-image-snip% other-equal-to?] of otherwise calls the @method[cache-image-snip% other-equal-to?] of
@this-obj[].} @this-obj[].}
@ -52,7 +52,7 @@ otherwise calls the @method[cache-image-snip% other-equal-to?] of
@defmethod[(get-argb/no-compute) @defmethod[(get-argb/no-compute)
(or/c false/c argb?)]{ (or/c false/c argb?)]{
Returns a pixel array for this image or @scheme[#f] if it has not Returns a pixel array for this image or @racket[#f] if it has not
been computed yet. been computed yet.
@ -64,8 +64,8 @@ otherwise calls the @method[cache-image-snip% other-equal-to?] of
Builds (if not yet built) a bitmap corresponding to Builds (if not yet built) a bitmap corresponding to
this snip and returns it. this snip and returns it.
If the width or the height of the snip is @scheme[0], If the width or the height of the snip is @racket[0],
this method return @scheme[#f]. this method return @racket[#f].
} }
@defmethod[(get-dc-proc) @defmethod[(get-dc-proc)
@ -119,20 +119,20 @@ This snipclass is used for saved cache image snips.}
@defproc[(argb-vector [argb argb?]) (vectorof (integer-in 0 255))]{ @defproc[(argb-vector [argb argb?]) (vectorof (integer-in 0 255))]{
Extracts the vector from @scheme[argb].} Extracts the vector from @racket[argb].}
@defproc[(argb-width [argb argb?]) exact-nonnegative-integer?]{ @defproc[(argb-width [argb argb?]) exact-nonnegative-integer?]{
Extracts the width from @scheme[argb].} Extracts the width from @racket[argb].}
@defproc[(argb-height [argb argb?]) exact-nonnegative-integer?]{ @defproc[(argb-height [argb argb?]) exact-nonnegative-integer?]{
Extracts the height from @scheme[argb].} Extracts the height from @racket[argb].}
@defproc[(argb? [v any/c]) boolean?]{ @defproc[(argb? [v any/c]) boolean?]{
Returns @scheme[#t] if @scheme[v] is an argb, @scheme[#f] otherwise.} Returns @racket[#t] if @racket[v] is an argb, @racket[#f] otherwise.}
@defproc[(overlay-bitmap [dest argb?] @defproc[(overlay-bitmap [dest argb?]
@ -142,8 +142,8 @@ Returns @scheme[#t] if @scheme[v] is an argb, @scheme[#f] otherwise.}
[mask (is-a?/c bitmap%)]) [mask (is-a?/c bitmap%)])
void?]{ void?]{
Changes @scheme[argb], overlaying @scheme[img] with masking based on Changes @racket[argb], overlaying @racket[img] with masking based on
@scheme[mask] at @math{(@scheme[dx], @scheme[dy])} from the top-left.} @racket[mask] at @math{(@racket[dx], @racket[dy])} from the top-left.}
@defproc[(build-bitmap [draw ((is-a?/c dc<%>) . -> . any)] @defproc[(build-bitmap [draw ((is-a?/c dc<%>) . -> . any)]
@ -151,14 +151,14 @@ Changes @scheme[argb], overlaying @scheme[img] with masking based on
[height (integer-in 1 10000)]) [height (integer-in 1 10000)])
(is-a?/c bitmap%)]{ (is-a?/c bitmap%)]{
Builds a bitmap of size @scheme[width] by @scheme[height], using the Builds a bitmap of size @racket[width] by @racket[height], using the
procedure @scheme[draw] to render the bitmap content into the given procedure @racket[draw] to render the bitmap content into the given
@scheme[dc<%>].} @racket[dc<%>].}
@defproc[(flatten-bitmap [bitmap (is-a?/c bitmap%)]) (is-a?/c bitmap%)]{ @defproc[(flatten-bitmap [bitmap (is-a?/c bitmap%)]) (is-a?/c bitmap%)]{
Builds a new bitmap that flattens the original @scheme[bitmap] Builds a new bitmap that flattens the original @racket[bitmap]
with its mask (as determined by @xmethod[bitmap% with its mask (as determined by @xmethod[bitmap%
get-loaded-mask]), producing a bitmap that has no mask, and looks get-loaded-mask]), producing a bitmap that has no mask, and looks
the way that bitmap would draw (when drawn with the mask) onto a the way that bitmap would draw (when drawn with the mask) onto a
@ -168,17 +168,17 @@ procedure @scheme[draw] to render the bitmap content into the given
@defproc[(argb->cache-image-snip [argb argb?][dx real?][dy real?]) @defproc[(argb->cache-image-snip [argb argb?][dx real?][dy real?])
(is-a?/c cache-image-snip%)]{ (is-a?/c cache-image-snip%)]{
Builds a new @scheme[cache-image-snip%] based on the contents of Builds a new @racket[cache-image-snip%] based on the contents of
@scheme[argb], using @scheme[dx] and @scheme[dy] as the pinhole.} @racket[argb], using @racket[dx] and @racket[dy] as the pinhole.}
@defproc[(argb->bitmap [argb argb?]) (or/c false/c (is-a?/c bitmap%))]{ @defproc[(argb->bitmap [argb argb?]) (or/c false/c (is-a?/c bitmap%))]{
Builds a bitmap that draws the same way as @scheme[argb]; the alpha Builds a bitmap that draws the same way as @racket[argb]; the alpha
pixels are put into the bitmap's @method[bitmap% get-loaded-mask] pixels are put into the bitmap's @method[bitmap% get-loaded-mask]
bitmap. bitmap.
If the width or height of @scheme[argb] is @scheme[0], If the width or height of @racket[argb] is @racket[0],
this returns @scheme[#f]. this returns @racket[#f].
} }

View File

@ -5,7 +5,7 @@
@title{Close Icon} @title{Close Icon}
@defmodule[mrlib/close-icon]{The @scheme[close-icon%] class @defmodule[mrlib/close-icon]{The @racket[close-icon%] class
provides a clickable close button icon.} provides a clickable close button icon.}
@defclass[close-icon% canvas% ()]{ @defclass[close-icon% canvas% ()]{
@ -14,8 +14,8 @@ provides a clickable close button icon.}
[bg-color (or/c #f string (is-a?/c color%))] [bg-color (or/c #f string (is-a?/c color%))]
[horizontal-pad positive-integer? 4] [horizontal-pad positive-integer? 4]
[vertical-pad positive-integer? 4])]{ [vertical-pad positive-integer? 4])]{
The @scheme[callback] is called when the close icon is clicked. The @racket[callback] is called when the close icon is clicked.
If @scheme[bg-color] is specified, it is used as the background color of the icon. If @racket[bg-color] is specified, it is used as the background color of the icon.
} }
} }

View File

@ -11,11 +11,11 @@
[filename path-string]) [filename path-string])
void?]{ void?]{
Writes the given @scheme[bitmap] to @scheme[filename] as a GIF image, Writes the given @racket[bitmap] to @racket[filename] as a GIF image,
where @scheme[bitmap] is either an instance of @scheme[bitmap%] or a where @racket[bitmap] is either an instance of @racket[bitmap%] or a
thunk (to be called just once) that generates such an object. If the thunk (to be called just once) that generates such an object. If the
bitmap uses more than 256 colors, it is automatically quantized using bitmap uses more than 256 colors, it is automatically quantized using
a simple algorithm; see @scheme[quantize]. If the bitmap has a mask a simple algorithm; see @racket[quantize]. If the bitmap has a mask
bitmap via @method[bitmap% get-loaded-mask], it is used to determine bitmap via @method[bitmap% get-loaded-mask], it is used to determine
transparent pixels in the generated GIF image.} transparent pixels in the generated GIF image.}
@ -30,28 +30,28 @@ transparent pixels in the generated GIF image.}
[#:last-frame-delay last-frame-delay (or/c (integer-in 0 #xFFFFFFFF) false/c) #f]) [#:last-frame-delay last-frame-delay (or/c (integer-in 0 #xFFFFFFFF) false/c) #f])
void?]{ void?]{
Writes the bitmaps in @scheme[bitmaps] to @scheme[filename] as an Writes the bitmaps in @racket[bitmaps] to @racket[filename] as an
animated GIF. The @scheme[bitmaps] list can contain a mixture of animated GIF. The @racket[bitmaps] list can contain a mixture of
@scheme[bitmap%] objects and thunks (each called just once) that @racket[bitmap%] objects and thunks (each called just once) that
produce @scheme[bitmap%] objects. The @scheme[delay-csec] argument is produce @racket[bitmap%] objects. The @racket[delay-csec] argument is
the amount of time in 1/100s of a second to wait between transitions. the amount of time in 1/100s of a second to wait between transitions.
If @scheme[loop?] is a true value, then the GIF is marked as a looping If @racket[loop?] is a true value, then the GIF is marked as a looping
animation. animation.
If @scheme[one-at-a-time?] is @scheme[#f], then the content of all If @racket[one-at-a-time?] is @racket[#f], then the content of all
images is collected and quantized at once, to produce a single images is collected and quantized at once, to produce a single
colortable; a drawback to this approach is that it uses more memory, colortable; a drawback to this approach is that it uses more memory,
and it allows less color variation among animation frames. Even when and it allows less color variation among animation frames. Even when
@scheme[one-at-a-time?] is @scheme[#f], the result of each thunk in @racket[one-at-a-time?] is @racket[#f], the result of each thunk in
@scheme[bitmaps] is converted to a byte-string one at a time. @racket[bitmaps] is converted to a byte-string one at a time.
If @scheme[one-at-a-time?] is true, then the bitmaps are quantized and If @racket[one-at-a-time?] is true, then the bitmaps are quantized and
written to the file one at a time; that is, for each thunk in written to the file one at a time; that is, for each thunk in
@scheme[bitmaps], its result is written and discarded before another @racket[bitmaps], its result is written and discarded before another
thunk is called. A drawback to this approach is that a separate thunk is called. A drawback to this approach is that a separate
colortable is written for each frame in the animation, which can make colortable is written for each frame in the animation, which can make
the resulting file large. the resulting file large.
If @scheme[last-frame-delay] is not false, a delay of If @racket[last-frame-delay] is not false, a delay of
@scheme[last-frame-delay] (in 1/100s of a second) is added to the last @racket[last-frame-delay] (in 1/100s of a second) is added to the last
frame. This extra delay is useful when @scheme[loop?] is true.} frame. This extra delay is useful when @racket[loop?] is true.}

View File

@ -70,8 +70,8 @@ different nodes.
graph pasteboard, and is expected to draw the edges between the graph pasteboard, and is expected to draw the edges between the
snips. The argments are a subset of those passed to snips. The argments are a subset of those passed to
@method[editor<%> on-paint] and it is only called when the @method[editor<%> on-paint] and it is only called when the
@scheme[before?] argument to @method[editor<%> on-paint] @racket[before?] argument to @method[editor<%> on-paint]
is @scheme[#t]. is @racket[#t].
} }
@defmethod[(draw-single-edge [dc (is-a?/c dc<%>)] @defmethod[(draw-single-edge [dc (is-a?/c dc<%>)]
@ -88,25 +88,25 @@ different nodes.
This method is called to draw each edge in the graph, except This method is called to draw each edge in the graph, except
for the edges that connect a node to itself. for the edges that connect a node to itself.
The @scheme[dc], @scheme[dx], and @scheme[dy] arguments are The @racket[dc], @racket[dx], and @racket[dy] arguments are
the same as in @method[editor<%> on-paint]. the same as in @method[editor<%> on-paint].
The The
@scheme[from-x], @scheme[from-y], @scheme[to-x], and @racket[from-x], @racket[from-y], @racket[to-x], and
@scheme[to-y] arguments specify points on the source and @racket[to-y] arguments specify points on the source and
destination snip's bounding box where a straight line destination snip's bounding box where a straight line
between the centers of the snip would intersect. between the centers of the snip would intersect.
The @scheme[arrow-point-ok?] function returns @scheme[#t] The @racket[arrow-point-ok?] function returns @racket[#t]
when the point specified by its arguments is inside the when the point specified by its arguments is inside the
smallest rectangle that covers both the source and smallest rectangle that covers both the source and
destination snips, but is outside of both of the rectangles destination snips, but is outside of both of the rectangles
that surround the source and destination snips themselves. that surround the source and destination snips themselves.
This default implementation uses @scheme[update-polygon] to compute This default implementation uses @racket[update-polygon] to compute
the arrowheads and otherwise draws a straight line between the two the arrowheads and otherwise draws a straight line between the two
points and then the arrowheads, unless the arrowhead points points and then the arrowheads, unless the arrowhead points
are not ok according to @scheme[arrow-point-ok?], in which case are not ok according to @racket[arrow-point-ok?], in which case
it just draws the line. it just draws the line.
} }
@ -116,8 +116,8 @@ it just draws the line.
[point3 (is-a?/c point%)] [point3 (is-a?/c point%)]
[point4 (is-a?/c point%)]) void?]{ [point4 (is-a?/c point%)]) void?]{
Updates the arguments @scheme[point1], @scheme[point2], @scheme[point3], @scheme[point4] with the coordinates Updates the arguments @racket[point1], @racket[point2], @racket[point3], @racket[point4] with the coordinates
of an arrowhead for a line that connects (@scheme[from-x],@scheme[from-y]) to (@scheme[to-x],@scheme[to-y]). of an arrowhead for a line that connects (@racket[from-x],@racket[from-y]) to (@racket[to-x],@racket[to-y]).
} }
} }

View File

@ -7,12 +7,12 @@
[edge-label-font (or/c #f (is-a?/c font%)) #f] [edge-label-font (or/c #f (is-a?/c font%)) #f]
[cache-arrow-drawing? any])]{ [cache-arrow-drawing? any])]{
If @scheme[edge-labels?] is @scheme[#f], no edge labels are If @racket[edge-labels?] is @racket[#f], no edge labels are
drawn. Otherwise, they are. drawn. Otherwise, they are.
If @scheme[edge-label-font] is supplied, it is used when drawing the If @racket[edge-label-font] is supplied, it is used when drawing the
labels on the edges. Otherwise, the font is not set before drawing labels on the edges. Otherwise, the font is not set before drawing
the labels, defaulting to the @scheme[dc<%>] object's font. the labels, defaulting to the @racket[dc<%>] object's font.
If @racket[cache-arrow-drawing?] is @racket[#f], then the arrows in the snip If @racket[cache-arrow-drawing?] is @racket[#f], then the arrows in the snip
are not cached in a bitmap (to speed up drawing when the mouse moves around). are not cached in a bitmap (to speed up drawing when the mouse moves around).
@ -21,4 +21,4 @@ Otherwise, they are.
} }
This mixin overrides many methods to draw lines between This mixin overrides many methods to draw lines between
@scheme[graph-snip<%>] that it contains.} @racket[graph-snip<%>] that it contains.}

View File

@ -9,7 +9,7 @@
void?]{ void?]{
Adds a child of this snip. Instead of calling this method, Adds a child of this snip. Instead of calling this method,
consider using the @scheme[add-links] function. consider using the @racket[add-links] function.
} }
@ -23,7 +23,7 @@
void?])]{ void?])]{
Adds a parent of this snip. Instead of calling this Adds a parent of this snip. Instead of calling this
method, consider using the @scheme[add-links] function. method, consider using the @racket[add-links] function.
} }
@ -31,7 +31,7 @@
(listof snip%)]{ (listof snip%)]{
returns a list of snips that implement returns a list of snips that implement
@scheme[graph-snip<%>]. Each of these snips will have a line @racket[graph-snip<%>]. Each of these snips will have a line
drawn from it, pointing at this snip. drawn from it, pointing at this snip.
} }
@ -40,7 +40,7 @@ drawn from it, pointing at this snip.
@defmethod[(get-parents) @defmethod[(get-parents)
(listof graph-snip<%>)]{ (listof graph-snip<%>)]{
Returns a list of snips that implement @scheme[graph-snip<%>]. Each Returns a list of snips that implement @racket[graph-snip<%>]. Each
of these snips will have a line drawn to it, starting from of these snips will have a line drawn to it, starting from
this snip. this snip.
} }
@ -52,7 +52,7 @@ this snip.
Removes a child snip from this snip. Be sure to remove Removes a child snip from this snip. Be sure to remove
this snip as a parent from the argument, too. this snip as a parent from the argument, too.
Instead of calling this method, consider using the Instead of calling this method, consider using the
@scheme[remove-links] function. @racket[remove-links] function.
} }
@ -62,7 +62,7 @@ this snip.
Removes a parent snip from this snip. Be sure to remove this Removes a parent snip from this snip. Be sure to remove this
snip as a child from the argument, too. snip as a child from the argument, too.
Instead of calling this method, consider using the Instead of calling this method, consider using the
@scheme[remove-links] function. @racket[remove-links] function.
} }
@ -70,8 +70,8 @@ this snip.
[label (or/c false/c string/)]) [label (or/c false/c string/)])
void?]{ void?]{
Changes the label on the edge going to the @scheme[parent] to be Changes the label on the edge going to the @racket[parent] to be
@scheme[label]. Ignored if no such egde exists. @racket[label]. Ignored if no such egde exists.
} }
} }

View File

@ -3,8 +3,8 @@
@title[#:style 'toc]{Graphs} @title[#:style 'toc]{Graphs}
@defmodule[mrlib/graph]{The @schememodname[mrlib/graph] library @defmodule[mrlib/graph]{The @racketmodname[mrlib/graph] library
provides a graph drawing toolkit built out of @scheme[pasteboard%]s.} provides a graph drawing toolkit built out of @racket[pasteboard%]s.}
@local-table-of-contents[] @local-table-of-contents[]
@ -42,20 +42,20 @@ provides a graph drawing toolkit built out of @scheme[pasteboard%]s.}
Connects a parent snip to a child snip within a pasteboard. Connects a parent snip to a child snip within a pasteboard.
The default @scheme[dark-pen]/@scheme[dark-brush] and The default @racket[dark-pen]/@racket[dark-brush] and
@scheme[light-pen]/@scheme[light-brush] are blue and purple, @racket[light-pen]/@racket[light-brush] are blue and purple,
respectively. The @scheme[dark-pen] and @scheme[dark-brush] are used respectively. The @racket[dark-pen] and @racket[dark-brush] are used
when the mouse cursor is over the snip (or a child or parent), and the when the mouse cursor is over the snip (or a child or parent), and the
@scheme[light-pen] and @scheme[light-brush] are used when the mouse @racket[light-pen] and @racket[light-brush] are used when the mouse
cursor is not over the snip. The brush is used to draw inside the cursor is not over the snip. The brush is used to draw inside the
arrow head and the pen is used to draw the border of the arrowhead and arrow head and the pen is used to draw the border of the arrowhead and
the line connecting the two snips. the line connecting the two snips.
if @scheme[label] is provided and not @scheme[#f], it is used as a if @racket[label] is provided and not @racket[#f], it is used as a
label on the edge. label on the edge.
When @scheme[dx] and @scheme[dy] are provided, the are offsets for the When @racket[dx] and @racket[dy] are provided, the are offsets for the
head and the tail of the arrow. Otherwise, @scheme[0] offsets are head and the tail of the arrow. Otherwise, @racket[0] offsets are
used.} used.}
@defproc[(add-links/text-colors [parent (is-a?/c graph-snip<%>)] @defproc[(add-links/text-colors [parent (is-a?/c graph-snip<%>)]
@ -71,8 +71,8 @@ used.}
[label (or/c string? false/c)]) [label (or/c string? false/c)])
void?]{ void?]{
Like @scheme[add-links], but with extra @scheme[dark-text] and Like @racket[add-links], but with extra @racket[dark-text] and
@scheme[light-text] arguments to set the colors of the label.} @racket[light-text] arguments to set the colors of the label.}
@defproc[(remove-links [parent (is-a?/c graph-snip<%>)] @defproc[(remove-links [parent (is-a?/c graph-snip<%>)]
[child (is-a?/c graph-snip<%>)]) [child (is-a?/c graph-snip<%>)])
@ -85,6 +85,6 @@ Disconnects a parent snip from a child snip within a pasteboard.}
[label (or/c string? false/c)]) [label (or/c string? false/c)])
void?]{ void?]{
Changes the label on the edge going from @scheme[child] to Changes the label on the edge going from @racket[child] to
@scheme[parent] to be @scheme[label]. If there is no existing edge @racket[parent] to be @racket[label]. If there is no existing edge
between the two nodes, then nothing happens.} between the two nodes, then nothing happens.}

View File

@ -32,7 +32,7 @@ Like @xmethod[hierarchical-list% new-list].}
@defmethod[(delete-item [i (is-a?/c hierarchical-list-item<%>)]) void?]{ @defmethod[(delete-item [i (is-a?/c hierarchical-list-item<%>)]) void?]{
Deletes immediate item or sub-list @scheme[i] from the sub-list.} Deletes immediate item or sub-list @racket[i] from the sub-list.}
@defmethod[(get-items) (listof (is-a?/c hierarchical-list-item<%>))]{ @defmethod[(get-items) (listof (is-a?/c hierarchical-list-item<%>))]{

View File

@ -5,7 +5,7 @@
@defmodule[mrlib/hierlist] @defmodule[mrlib/hierlist]
A @scheme[hierarchical-list%] control is a list of items, some of A @racket[hierarchical-list%] control is a list of items, some of
which can themselves be hierarchical lists. Each such sub-list has an 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. arrow that the user can click to hide or show the sub-list's items.

View File

@ -21,7 +21,7 @@ Reports whether the item is selected.}
[(click-select [on? any/c]) void?])]{ [(click-select [on? any/c]) void?])]{
Calls @method[hierarchical-list% select] or @method[hierarchical-list% Calls @method[hierarchical-list% select] or @method[hierarchical-list%
click-select]. The @scheme[on?] argument can be @scheme[#f] only if click-select]. The @racket[on?] argument can be @racket[#f] only if
@xmethod[hierarchical-list% allow-deselect] allows it.} @xmethod[hierarchical-list% allow-deselect] allows it.}

View File

@ -17,9 +17,9 @@ Creates a hierarchical-list control.
Creates the control. Creates the control.
If the style @scheme['transparent] is passed, then the If the style @racket['transparent] is passed, then the
@method[editor-snip% use-style-background] method will be @method[editor-snip% use-style-background] method will be
called with @scheme[#t] when editor snips are created as part of called with @racket[#t] when editor snips are created as part of
the hierarchical list, ensuring that the entire control is the hierarchical list, ensuring that the entire control is
transparent. transparent.
@ -39,11 +39,11 @@ Returns the currently selected item, if any.}
(is-a?/c hierarchical-list-item<%>)]{ (is-a?/c hierarchical-list-item<%>)]{
Creates and returns a new (empty) item in the list. See Creates and returns a new (empty) item in the list. See
@scheme[hierarchical-list-item<%>] for methods to fill in the item's @racket[hierarchical-list-item<%>] for methods to fill in the item's
label. label.
The @scheme[mixin] argument is applied to a class implementing The @racket[mixin] argument is applied to a class implementing
@scheme[hierarchical-list-item<%>], and the resulting class is @racket[hierarchical-list-item<%>], and the resulting class is
instantiated as the list item.} instantiated as the list item.}
@ -62,17 +62,17 @@ list is empty.}
(is-a?/c hierarchical-list-compound-item<%>)]{ (is-a?/c hierarchical-list-compound-item<%>)]{
Creates and returns a new (empty) sub-list in the list. See Creates and returns a new (empty) sub-list in the list. See
@scheme[hierarchical-list-compound-item<%>] for methods to fill in the @racket[hierarchical-list-compound-item<%>] for methods to fill in the
item's label and content. item's label and content.
The @scheme[mixin] argument is applied to a class implementing The @racket[mixin] argument is applied to a class implementing
@scheme[hierarchical-list-compound-item<%>], and the resulting class @racket[hierarchical-list-compound-item<%>], and the resulting class
is instantiated as the sub-list.} is instantiated as the sub-list.}
@defmethod[(delete-item [i (is-a?/c hierarchical-list-item<%>)]) void?]{ @defmethod[(delete-item [i (is-a?/c hierarchical-list-item<%>)]) void?]{
Deletes immediate item or sub-list @scheme[i] from the list.} Deletes immediate item or sub-list @racket[i] from the list.}
@defmethod[(get-items) (listof (is-a?/c hierarchical-list-item<%>))]{ @defmethod[(get-items) (listof (is-a?/c hierarchical-list-item<%>))]{
@ -89,7 +89,7 @@ selection.}
@defmethod[(on-select [i (or/c (is-a?/c hierarchical-list-item<%>) false/c)]) any]{ @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] Called for new select of @racket[i], where @racket[i] is @racket[#f]
if no item is now selected.} if no item is now selected.}
@ -103,17 +103,17 @@ set-allow-selection].}
@defmethod[(on-double-select [i (is-a?/c hierarchical-list-item<%>)]) any]{ @defmethod[(on-double-select [i (is-a?/c hierarchical-list-item<%>)]) any]{
Called for a double-click on @scheme[i].} Called for a double-click on @racket[i].}
@defmethod[(on-item-opened [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{ @defmethod[(on-item-opened [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{
Called when the arrow for @scheme[i] is turned down.} Called when the arrow for @racket[i] is turned down.}
@defmethod[(on-item-closed [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{ @defmethod[(on-item-closed [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{
Called when the arrow for @scheme[i] is turned up.} Called when the arrow for @racket[i] is turned up.}
@defmethod[(sort [less-than-proc ((is-a?/c hierarchical-list-item<%>) @defmethod[(sort [less-than-proc ((is-a?/c hierarchical-list-item<%>)
@ -122,8 +122,8 @@ Called when the arrow for @scheme[i] is turned up.}
[recur? any/c #t]) [recur? any/c #t])
void?]{ void?]{
Sorts items in the list by calling @scheme[less-than-proc] on pairs of Sorts items in the list by calling @racket[less-than-proc] on pairs of
items. If @scheme[recur?] is true, items in sub-lists are sorted items. If @racket[recur?] is true, items in sub-lists are sorted
recursively.} recursively.}
@ -131,7 +131,7 @@ recursively.}
boolean?]{ boolean?]{
Like @xmethod[editor<%> can-do-edit-operation?]. The default Like @xmethod[editor<%> can-do-edit-operation?]. The default
implementation always returns @scheme[#f].} implementation always returns @racket[#f].}
@defmethod[(do-edit-operation [op symbol?] [recursive? any/c #t]) @defmethod[(do-edit-operation [op symbol?] [recursive? any/c #t])
@ -161,7 +161,7 @@ Moves the selection, scrolls as necessary to show it, and calls
@method[hierarchical-list% on-select-always]. @method[hierarchical-list% on-select-always].
The @method[hierarchical-list% allow-deselect] method controls whether The @method[hierarchical-list% allow-deselect] method controls whether
@scheme[i] is allowed to be @scheme[#f] to deselect the currently @racket[i] is allowed to be @racket[#f] to deselect the currently
selected item.} selected item.}
@ -199,7 +199,7 @@ This is initially disabled, by default.}
Gets/sets whether the @method[hierarchical-list% on-select] can be Gets/sets whether the @method[hierarchical-list% on-select] can be
called with a @scheme[#f] argument to deselect the current item called with a @racket[#f] argument to deselect the current item
(leaving none selected). (leaving none selected).
The initial mode does not allow deselection.} The initial mode does not allow deselection.}

View File

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

View File

@ -4,28 +4,28 @@
@title{Include Bitmap} @title{Include Bitmap}
@defmodule[mrlib/include-bitmap]{The @scheme[include-bitmap] form @defmodule[mrlib/include-bitmap]{The @racket[include-bitmap] form
takes a filename containing a bitmap and ``inlines'' the bitmap into takes a filename containing a bitmap and ``inlines'' the bitmap into
the program.} the program.}
Historically, the advantage of inlining the bitmap is that a Historically, the advantage of inlining the bitmap is that a
stand-alone executable can be created that contains the bitmap and stand-alone executable can be created that contains the bitmap and
does not refer to the original image file. The does not refer to the original image file. The
@scheme[define-runtime-path] form, however, now provides a better @racket[define-runtime-path] form, however, now provides a better
alternative. alternative.
@defform*[[(include-bitmap path-spec) @defform*[[(include-bitmap path-spec)
(include-bitmap path-spec type-expr)]]{ (include-bitmap path-spec type-expr)]]{
The @scheme[path-spec] is the same as for @scheme[include] form. The The @racket[path-spec] is the same as for @racket[include] form. The
@scheme[type-expr] should produce @scheme['unknown], @racket[type-expr] should produce @racket['unknown],
@scheme['unknown/mask], etc., as for @scheme[bitmap%], and the default @racket['unknown/mask], etc., as for @racket[bitmap%], and the default
is @scheme['unknown/mask].} is @racket['unknown/mask].}
@defform*[[(include-bitmap/relative-to source path-spec) @defform*[[(include-bitmap/relative-to source path-spec)
(include-bitmap/relative-to source path-spec [type-expr])]]{ (include-bitmap/relative-to source path-spec [type-expr])]]{
Analogous to @scheme[include-at/relative-to], though only a source is Analogous to @racket[include-at/relative-to], though only a source is
needed (no context).} needed (no context).}

View File

@ -8,8 +8,8 @@
@defproc[(set-interactive-display-handler [port output-port?]) void?]{ @defproc[(set-interactive-display-handler [port output-port?]) void?]{
Sets @scheme[port]'s display handler (via Sets @racket[port]'s display handler (via
@scheme[port-display-handler]) so that when it encounters these @racket[port-display-handler]) so that when it encounters these
values: values:
@itemize[ @itemize[
@ -20,21 +20,21 @@ values:
] ]
it uses @scheme[write-special] to send snips to the port, it uses @racket[write-special] to send snips to the port,
instead of those values. Otherwise, it behaves like the instead of those values. Otherwise, it behaves like the
default handler. default handler.
To show values embedded in lists and other compound object, it uses To show values embedded in lists and other compound object, it uses
@scheme[pretty-print].} @racket[pretty-print].}
@defproc[(set-interactive-write-handler [port output-port?]) void?]{ @defproc[(set-interactive-write-handler [port output-port?]) void?]{
Like @scheme[set-interactive-display-handler], but sets the Like @racket[set-interactive-display-handler], but sets the
@scheme[port-write-handler].} @racket[port-write-handler].}
@defproc[(set-interactive-print-handler [port output-port?]) void?]{ @defproc[(set-interactive-print-handler [port output-port?]) void?]{
Like @scheme[set-interactive-display-handler], but sets the Like @racket[set-interactive-display-handler], but sets the
@scheme[port-print-handler].} @racket[port-print-handler].}

View File

@ -8,11 +8,11 @@
@defclass[path-dialog% dialog% ()]{ @defclass[path-dialog% dialog% ()]{
The @scheme[path-dialog%] class implements a platform-independent The @racket[path-dialog%] class implements a platform-independent
file/directory dialog. The dialog is similar in functionality to the file/directory dialog. The dialog is similar in functionality to the
@scheme[get-file], @scheme[put-file], @scheme[get-directory], and @racket[get-file], @racket[put-file], @racket[get-directory], and
@scheme[get-file-list] procedures, but considerable extra functionality @racket[get-file-list] procedures, but considerable extra functionality
is available through the @scheme[path-dialog%] class. is available through the @racket[path-dialog%] class.
@defconstructor[([label (or/c label-string? false/c) #f] @defconstructor[([label (or/c label-string? false/c) #f]
@ -34,79 +34,79 @@ is available through the @scheme[path-dialog%] class.
[ok? (or/c (path? . -> . any) false/c) #f] [ok? (or/c (path? . -> . any) false/c) #f]
[guard (or/c (path? . -> . any) false/c) #f])]{ [guard (or/c (path? . -> . any) false/c) #f])]{
The @scheme[label] argument is the dialog's title string. If The @racket[label] argument is the dialog's title string. If
@scheme[label] is @scheme[#f], the default is based on other field @racket[label] is @racket[#f], the default is based on other field
values. values.
The @scheme[message] argument is a prompt message to show at the top The @racket[message] argument is a prompt message to show at the top
of the dialog. If it is @scheme[#f], no prompt line. of the dialog. If it is @racket[#f], no prompt line.
The @scheme[parent] argument is the parent frame or dialog, if any, The @racket[parent] argument is the parent frame or dialog, if any,
for this dialog. for this dialog.
The @scheme[directory] argument specifies the dialog's initial The @racket[directory] argument specifies the dialog's initial
directory. If it is @scheme[#f], the initial directory is the last directory. If it is @racket[#f], the initial directory is the last
directory that was used by the user (or the current directory on first directory that was used by the user (or the current directory on first
use). use).
The @scheme[filename] argument provides an initial filename text, if The @racket[filename] argument provides an initial filename text, if
any. any.
If @scheme[put?] is true, the dialog operates in choose-file-to-write If @racket[put?] is true, the dialog operates in choose-file-to-write
mode (and warn the user if choosing an existing name). mode (and warn the user if choosing an existing name).
If @scheme[dir?] is true, the dialog operates in directory-choice If @racket[dir?] is true, the dialog operates in directory-choice
mode. mode.
If @scheme[existing?] is true, the use must choose an existing file. If @racket[existing?] is true, the use must choose an existing file.
If @scheme[new?] is true, the user must choose a non-existant If @racket[new?] is true, the user must choose a non-existant
path. Providing both @scheme[new?] and @scheme[existing?] as true path. Providing both @racket[new?] and @racket[existing?] as true
triggers an exception. triggers an exception.
If @scheme[multi?] is true, the dialog allows selection of multiple If @racket[multi?] is true, the dialog allows selection of multiple
paths. paths.
If @scheme[can-mkdir?] is true, the dialog includes a button for the If @racket[can-mkdir?] is true, the dialog includes a button for the
user to create a new directory. user to create a new directory.
The @scheme[filters] argument is one of: The @racket[filters] argument is one of:
@itemize[ @itemize[
@item{@scheme[(list (list _filter-name _filter-glob) ...)] --- a @item{@racket[(list (list _filter-name _filter-glob) ...)] --- a
list of pattern names (e.g., @scheme["Scheme Files"]) and glob list of pattern names (e.g., @racket["Scheme Files"]) and glob
patterns (e.g., @scheme["*.rkt;*.scrbl"]). Any list, including an patterns (e.g., @racket["*.rkt;*.scrbl"]). Any list, including an
empty list, enables a filter box for the user to enter glob empty list, enables a filter box for the user to enter glob
patterns, and the given list of choices is available in a patterns, and the given list of choices is available in a
combo-box drop-down menu. Glob patterns are the usual Unix ones combo-box drop-down menu. Glob patterns are the usual Unix ones
(see @scheme[glob->regexp]), and a semicolon can be used to allow (see @racket[glob->regexp]), and a semicolon can be used to allow
multiple patterns.} multiple patterns.}
@item{@scheme[#f] --- no patterns and no filter input box.} @item{@racket[#f] --- no patterns and no filter input box.}
@item{@scheme[#t] --- use a generic @scheme["All"] filter, which is @item{@racket[#t] --- use a generic @racket["All"] filter, which is
@scheme["*.*"] on Windows and @scheme["*"] on other @racket["*.*"] on Windows and @racket["*"] on other
platforms.} platforms.}
] ]
The @scheme[show-file?] predicate is used to filter file paths that The @racket[show-file?] predicate is used to filter file paths that
are shown in the dialog. The predicate is applied to the file name as are shown in the dialog. The predicate is applied to the file name as
a string while the current-directory parameter is set. This predicate a string while the current-directory parameter is set. This predicate
is intended to be a lightweight filter for choosing which names to is intended to be a lightweight filter for choosing which names to
display. display.
The @scheme[show-dir?] predicate is similar, but for directories The @racket[show-dir?] predicate is similar, but for directories
instead of files. instead of files.
The @scheme[ok?] predicate is used in a similar fashion to the The @racket[ok?] predicate is used in a similar fashion to the
@scheme[show-file?] and @scheme[show-dir?] predicate, but it is used @racket[show-file?] and @racket[show-dir?] predicate, but it is used
to determine whether the @onscreen{OK} button should be enabled when a to determine whether the @onscreen{OK} button should be enabled when a
file or directory is selected (so it need not be as lightweight as the file or directory is selected (so it need not be as lightweight as the
other predicates). other predicates).
The @scheme[guard] procedure is a generic verifier for the dialog's The @racket[guard] procedure is a generic verifier for the dialog's
final result, as produced by the @method[path-dialog% run] method. It final result, as produced by the @method[path-dialog% run] method. It
receives the result that is about to be returned (which can be a list receives the result that is about to be returned (which can be a list
in a multi-selection dialog), and can return a different value (any in a multi-selection dialog), and can return a different value (any
@ -119,9 +119,9 @@ message.}
@defmethod[(run) any/c]{ @defmethod[(run) any/c]{
Shows the dialog and returns the selected result. If a @scheme[guard] Shows the dialog and returns the selected result. If a @racket[guard]
procedure is not supplied when the dialog is created, then the result procedure is not supplied when the dialog is created, then the result
is either a path or a list of paths (and the latter only when is either a path or a list of paths (and the latter only when
@scheme[_multi?] is true when the dialog is created). If a @racket[_multi?] is true when the dialog is created). If a
@scheme[_guard] procedure is supplied, its result determines the result @racket[_guard] procedure is supplied, its result determines the result
of this method.}} of this method.}}

View File

@ -3,7 +3,7 @@
@title{Plot} @title{Plot}
@defmodule[mrlib/plot]{The @schememodname[mrlib/plot] library provides @defmodule[mrlib/plot]{The @racketmodname[mrlib/plot] library provides
a simple tool for plotting data values to a device context.} a simple tool for plotting data values to a device context.}
@defstruct[data-set ([points (listof (is-a?/c point%))] @defstruct[data-set ([points (listof (is-a?/c point%))]
@ -14,9 +14,9 @@ a simple tool for plotting data values to a device context.}
[min-y real?] [min-y real?]
[max-y real?])]{ [max-y real?])]{
The @scheme[points] field contains the data values to plot, and The @racket[points] field contains the data values to plot, and
@scheme[connected?] indicates whether the points are connected by a @racket[connected?] indicates whether the points are connected by a
line. The @scheme[pen] field provides a pen for plotting line. The @racket[pen] field provides a pen for plotting
points/lines. The remaining fields determine the plotting area within points/lines. The remaining fields determine the plotting area within
a drawing context.} a drawing context.}
@ -30,9 +30,9 @@ a drawing context.}
[x-axis-label string?] [x-axis-label string?]
[y-axis-label string?])]{ [y-axis-label string?])]{
Configures a plot. The @scheme[grid?] field determines whether to draw Configures a plot. The @racket[grid?] field determines whether to draw
a grid at axis markings, and the @scheme[x-axis-marking] and a grid at axis markings, and the @racket[x-axis-marking] and
@scheme[y-axis-marking] lists supply locations for marks on each @racket[y-axis-marking] lists supply locations for marks on each
axis. The other fields are self-explanatory.} axis. The other fields are self-explanatory.}
@defproc[(plot [dc (is-a?/c dc<%>)] @defproc[(plot [dc (is-a?/c dc<%>)]
@ -40,6 +40,6 @@ axis. The other fields are self-explanatory.}
[setup plot-setup?]) [setup plot-setup?])
void?]{ void?]{
Draws the @scheme[data-set]s in @scheme[data] into the given Draws the @racket[data-set]s in @racket[data] into the given
@scheme[dc]. Uses drawing-context coordinates in @scheme[data-set]s @racket[dc]. Uses drawing-context coordinates in @racket[data-set]s
that will accommodate all of the data sets.} that will accommodate all of the data sets.}

View File

@ -7,7 +7,7 @@
@defclass[switchable-button% canvas% ()]{ @defclass[switchable-button% canvas% ()]{
A @scheme[switchable-button%] control displays A @racket[switchable-button%] control displays
and icon and a string label. It toggles between and icon and a string label. It toggles between
display of just the icon and a display with the display of just the icon and a display with the
label and the icon side-by-side. label and the icon side-by-side.
@ -17,15 +17,15 @@
[bitmap (is-a?/c bitmap%)] [bitmap (is-a?/c bitmap%)]
[alternate-bitmap (is-a?/c bitmap%) bitmap] [alternate-bitmap (is-a?/c bitmap%) bitmap]
[vertical-tight? boolean? #f])]{ [vertical-tight? boolean? #f])]{
The @scheme[callback] is called when the button The @racket[callback] is called when the button
is pressed. The @scheme[string] and @scheme[bitmap] are is pressed. The @racket[string] and @racket[bitmap] are
used as discussed above. used as discussed above.
If @scheme[alternate-bitmap] is supplied, then it is used If @racket[alternate-bitmap] is supplied, then it is used
when the button is switched to the view that just shows the bitmap. when the button is switched to the view that just shows the bitmap.
If it is not supplied, both modes show the same bitmap. If it is not supplied, both modes show the same bitmap.
If the @scheme[vertical-tight?] argument is @scheme[#t], then the button takes up If the @racket[vertical-tight?] argument is @racket[#t], then the button takes up
as little as possible vertical space. as little as possible vertical space.
} }

View File

@ -17,7 +17,7 @@
DrRacket uses with its @tt{control-\} (or @tt{command-\}) strings to DrRacket uses with its @tt{control-\} (or @tt{command-\}) strings to
their corresponding unicode characters. For example, it contains their corresponding unicode characters. For example, it contains
this mapping: this mapping:
@schemeblock[ @racketblock[
("alpha" "α") ("alpha" "α")
] ]
as well as many more. as well as many more.

View File

@ -4,7 +4,7 @@
@title[#:tag "activex" #:style 'toc]{ActiveX and DHTML} @title[#:tag "activex" #:style 'toc]{ActiveX and DHTML}
A MysterX application consists of one or more browsers, which are A MysterX application consists of one or more browsers, which are
instances of the class @scheme[mx-browser%]. instances of the class @racket[mx-browser%].
@local-table-of-contents[] @local-table-of-contents[]

View File

@ -14,12 +14,12 @@
(listof (any-of/c 'iconize 'maximize 'no-system-menu (listof (any-of/c 'iconize 'maximize 'no-system-menu
'no-thick-border 'scrollbars))])]{ 'no-thick-border 'scrollbars))])]{
Creates an instance of a MysterX browser. The @scheme[label] Creates an instance of a MysterX browser. The @racket[label]
argument is a string for the document caption, with default . The argument is a string for the document caption, with default . The
@scheme[width], @scheme[height], @scheme[x], and @scheme[y] give the @racket[width], @racket[height], @racket[x], and @racket[y] give the
size and placement of the browser window on the desktop, with size and placement of the browser window on the desktop, with
defaults provided by Windows. When @scheme[style-options] includes defaults provided by Windows. When @racket[style-options] includes
@scheme['scrollbars], the vertical scrollbar is disabled if @racket['scrollbars], the vertical scrollbar is disabled if
scrolling is unnecessary, and the horizontal scrollbar disappears if scrolling is unnecessary, and the horizontal scrollbar disappears if
scrolling is unnecessary. scrolling is unnecessary.
@ -39,12 +39,12 @@
@defmethod[(show [show? any/c]) void?]{ @defmethod[(show [show? any/c]) void?]{
If @scheme[show?] is @scheme[#f], the browser window is hidden. If @racket[show?] is @racket[#f], the browser window is hidden.
Otherwise, the window is shown.} Otherwise, the window is shown.}
@defmethod[(navigate [url string?]) string?]{ @defmethod[(navigate [url string?]) string?]{
Navigates the browser to the URL given by @scheme[url]. Navigates the browser to the URL given by @racket[url].
Any DHTML changes to the page associated with the URL Any DHTML changes to the page associated with the URL
are not shown. Returns a string that is the actual URL are not shown. Returns a string that is the actual URL
navigated to.} navigated to.}
@ -52,13 +52,13 @@
@defmethod[(navigate/status [url string?]) @defmethod[(navigate/status [url string?])
(list/c string? (or/c false/c integer? (one-of/c 'no-status)))]{ (list/c string? (or/c false/c integer? (one-of/c 'no-status)))]{
Navigates the browser to the URL given by @scheme[url]. Navigates the browser to the URL given by @racket[url].
Any DHTML changes to the page associated with the URL Any DHTML changes to the page associated with the URL
are not shown. Returns a list, whose first element string that are not shown. Returns a list, whose first element string that
is the actual URL navigated to, and whose second element is is the actual URL navigated to, and whose second element is
a status code, one of: @scheme[#f], indicating no status could be a status code, one of: @racket[#f], indicating no status could be
obtained; a number, such as @scheme[200] or @scheme[404], indicating the obtained; a number, such as @racket[200] or @racket[404], indicating the
http status; or @scheme['no-status], indicating that @scheme[url] does not http status; or @racket['no-status], indicating that @racket[url] does not
denote a URL with the ``http'' scheme.} denote a URL with the ``http'' scheme.}
@defmethod[(go-back) string?]{ @defmethod[(go-back) string?]{
@ -77,8 +77,8 @@
@defmethod[(refresh) boolean?]{ @defmethod[(refresh) boolean?]{
Refreshes the document in the browser. Returns @scheme[#t] Refreshes the document in the browser. Returns @racket[#t]
if the refresh is successful, @scheme[#f] otherwise.} if the refresh is successful, @racket[#f] otherwise.}
@defmethod[(iconize) void?]{ @defmethod[(iconize) void?]{
@ -96,8 +96,8 @@
[f ((is-a?/c mx-event<%>) . -> . any)]) [f ((is-a?/c mx-event<%>) . -> . any)])
void?]{ void?]{
Registers an event handler for the HTML element @scheme[elem]. Registers an event handler for the HTML element @racket[elem].
The result of @scheme[f] is discarded.} The result of @racket[f] is discarded.}
@defmethod[(unregister-event-handler [elem (is-a?/c mx-element%)]) void?]{ @defmethod[(unregister-event-handler [elem (is-a?/c mx-element%)]) void?]{
@ -121,7 +121,7 @@
@defproc[(block-while-browsers) void?]{ @defproc[(block-while-browsers) void?]{
Blocks until all browser windows have been closed or hidden, using Blocks until all browser windows have been closed or hidden, using
the show method of @scheme[mx-browser%]. This is useful when a the show method of @racket[mx-browser%]. This is useful when a
MysterX program file is run as a script, to prevent @exec{mzscheme} MysterX program file is run as a script, to prevent @exec{mzscheme}
or @exec{mred} from closing prematurely.} or @exec{mred} from closing prematurely.}

View File

@ -14,12 +14,12 @@
(listof string?)]{ (listof string?)]{
Returns a list of strings naming the events supported by Returns a list of strings naming the events supported by
@scheme[obj/type]. @racket[obj/type].
If calling this procedure results in an error indicating that the If calling this procedure results in an error indicating that the
COM object's coclass is ambiguous, try using either COM object's coclass is ambiguous, try using either
@scheme[set-coclass!] or @scheme[set-coclass-from-progid!], then @racket[set-coclass!] or @racket[set-coclass-from-progid!], then
retry @scheme[com-events].} retry @racket[com-events].}
@defproc[(com-event-type [obj/type (or/c com-object? com-type?)] @defproc[(com-event-type [obj/type (or/c com-object? com-type?)]
@ -27,11 +27,11 @@
(listof string?)]{ (listof string?)]{
Returns the type of an event handler for the Returns the type of an event handler for the
event @scheme[ev] generated by the particular event @racket[ev] generated by the particular
COM object/type @scheme[obj/type]. The return type of COM object/type @racket[obj/type]. The return type of
all COM event handlers is void. all COM event handlers is void.
See also @scheme[com-events] for dealing with a COM See also @racket[com-events] for dealing with a COM
object that has an ambiguous class.} object that has an ambiguous class.}
@defproc[(com-register-event-handler @defproc[(com-register-event-handler
@ -40,17 +40,17 @@
[f (any/c . -> . any)]) [f (any/c . -> . any)])
void?]{ void?]{
Registers @scheme[f] as event handler for the event @scheme[ev] when Registers @racket[f] as event handler for the event @racket[ev] when
generated by @scheme[obj]. The type of argument supplied to generated by @racket[obj]. The type of argument supplied to
@scheme[f] depends on the event; the result of @scheme[f] is always @racket[f] depends on the event; the result of @racket[f] is always
discarded. discarded.
See also @scheme[com-events] for dealing with a COM See also @racket[com-events] for dealing with a COM
object that has an ambiguous class.} object that has an ambiguous class.}
@defproc[(com-unregister-event-handler [obj com-object?] @defproc[(com-unregister-event-handler [obj com-object?]
[ev string?]) [ev string?])
void?]{ void?]{
Unregisters any event handler for the event @scheme[ev] that is Unregisters any event handler for the event @racket[ev] that is
generated by the COM object @scheme[obj].} generated by the COM object @racket[obj].}

View File

@ -3,12 +3,12 @@
@title[#:tag "com-types"]{COM Types} @title[#:tag "com-types"]{COM Types}
In the result of a function like @scheme[com-method-type], a type In the result of a function like @racket[com-method-type], a type
@indexed-scheme['mx-any] standards for a character, real number, @indexed-racket['mx-any] standards for a character, real number,
string, boolean, COM currency (as in @scheme[com-currency?]), COM date string, boolean, COM currency (as in @racket[com-currency?]), COM date
(as in @scheme[com-date?]), COM scode value (as in (as in @racket[com-date?]), COM scode value (as in
@scheme[com-scode?]), COM IUnknown value (as in @racket[com-scode?]), COM IUnknown value (as in
@scheme[com-iunknown?], or COM object (as in @scheme[com-object?]).} @racket[com-iunknown?], or COM object (as in @racket[com-object?]).}
@defproc[(com-object-type [obj com-object?]) com-type?]{ @defproc[(com-object-type [obj com-object?]) com-type?]{
@ -16,43 +16,43 @@ string, boolean, COM currency (as in @scheme[com-currency?]), COM date
@defproc[(com-is-a? [obj com-object?] [type com-type?]) boolean?]{ @defproc[(com-is-a? [obj com-object?] [type com-type?]) boolean?]{
Return @scheme[#t] if @scheme[obj] is of the Return @racket[#t] if @racket[obj] is of the
type @scheme[type].} type @racket[type].}
@defproc[(com-currency? [v any/c]) boolean?]{ @defproc[(com-currency? [v any/c]) boolean?]{
Returns @scheme[#t] if @scheme[v] is a COM currency value, Returns @racket[#t] if @racket[v] is a COM currency value,
@scheme[#f] otherwise.} @racket[#f] otherwise.}
@defproc[(com-currency->number [curr com-currency?]) real?]{ @defproc[(com-currency->number [curr com-currency?]) real?]{
Returns a number for @scheme[curr].} Returns a number for @racket[curr].}
@defproc[(number->com-currency [n real?]) com-currency?]{ @defproc[(number->com-currency [n real?]) com-currency?]{
Converts a number to a COM currency value. A currency value is Converts a number to a COM currency value. A currency value is
repsented with a 64-bit two's-complement integer, though @scheme[n] repsented with a 64-bit two's-complement integer, though @racket[n]
may contain decimal digits. If @scheme[n] is too large, an may contain decimal digits. If @racket[n] is too large, an
exception is raised.} exception is raised.}
@defproc[(com-date? [v any/c]) boolean?]{ @defproc[(com-date? [v any/c]) boolean?]{
Returns @scheme[#t] if @scheme[v] is a COM date value, @scheme[#f] Returns @racket[#t] if @racket[v] is a COM date value, @racket[#f]
otherwise.} otherwise.}
@defproc[(com-date->date [d com-date?]) date?]{ @defproc[(com-date->date [d com-date?]) date?]{
Converts a COM date to an instance of the @scheme[date] structure Converts a COM date to an instance of the @racket[date] structure
type. In the result, the @scheme[dst?] field is always @scheme[#f], type. In the result, the @racket[dst?] field is always @racket[#f],
and the @scheme[time-zone-offset] field is @scheme[0].} and the @racket[time-zone-offset] field is @racket[0].}
@defproc[(date->com-date [d date?]) com-date?]{ @defproc[(date->com-date [d date?]) com-date?]{
Converts a @scheme[date] instance to a COM date value.} Converts a @racket[date] instance to a COM date value.}
@defproc[(com-scode? [v any/c]) boolean?]{ @defproc[(com-scode? [v any/c]) boolean?]{
Returns @scheme[#t] if @scheme[v] is a COM scode value, @scheme[#f] Returns @racket[#t] if @racket[v] is a COM scode value, @racket[#f]
otherwise.} otherwise.}
@defproc[(com-scode->number [sc com-scode?]) integer?]{ @defproc[(com-scode->number [sc com-scode?]) integer?]{
@ -67,10 +67,10 @@ string, boolean, COM currency (as in @scheme[com-currency?]), COM date
@defproc[(com-iunknown? [v any/c]) boolean?]{ @defproc[(com-iunknown? [v any/c]) boolean?]{
Returns @scheme[#t] if @scheme[v] is a COM IUnknown value, Returns @racket[#t] if @racket[v] is a COM IUnknown value,
@scheme[#f] otherwise.} @racket[#f] otherwise.}
@defthing[com-omit any/c]{ @defthing[com-omit any/c]{
Used with @scheme[com-invoke] to represent an argument that is not Used with @racket[com-invoke] to represent an argument that is not
provided.} provided.}

View File

@ -3,9 +3,9 @@
@title[#:tag "remote"]{Remote COM servers (DCOM)} @title[#:tag "remote"]{Remote COM servers (DCOM)}
For the MysterX procedures @scheme[cocreate-instance-from-coclass] and For the MysterX procedures @racket[cocreate-instance-from-coclass] and
@scheme[cocreate-instance-from-progid], the optional @scheme[_where] @racket[cocreate-instance-from-progid], the optional @racket[_where]
argument can be @scheme['remote]. In that case, the server instance argument can be @racket['remote]. In that case, the server instance
is run at the location given by the Registry key is run at the location given by the Registry key
@centerline{@tt{HKEY_CLASSES_ROOT\AppID\@nonterm{CLSID}\RemoteServerName}} @centerline{@tt{HKEY_CLASSES_ROOT\AppID\@nonterm{CLSID}\RemoteServerName}}

View File

@ -37,9 +37,9 @@
[size (one-of/c 'pixels 'percent) 'pixels]) [size (one-of/c 'pixels 'percent) 'pixels])
com-object?]{ com-object?]{
Inserts a COM object with class @scheme[coclass] at the beginning of Inserts a COM object with class @racket[coclass] at the beginning of
the document. The optional @scheme[size] argument gives an the document. The optional @racket[size] argument gives an
interpretation for the width and height, where @scheme['percent] interpretation for the width and height, where @racket['percent]
indicates that the width and height are a fixed percentage of the indicates that the width and height are a fixed percentage of the
document window size.} document window size.}
@ -83,13 +83,13 @@
(is-a?/c mx-element%)]{ (is-a?/c mx-element%)]{
Returns an object that encapsulates an HTML element, where Returns an object that encapsulates an HTML element, where
@scheme[tag] names an HTML tag, and @scheme[id] names the @scheme["id"] @racket[tag] names an HTML tag, and @racket[id] names the @racket["id"]
attribute of the HTML element. The @scheme[index] is a nonnegative attribute of the HTML element. The @racket[index] is a nonnegative
integer indicating the zero-based index of the element among all integer indicating the zero-based index of the element among all
elements with the same @scheme[tag] and @scheme[id]. The ordering elements with the same @racket[tag] and @racket[id]. The ordering
of elements is defined by Internet Explorer. The requested element of elements is defined by Internet Explorer. The requested element
must be within the document's @scheme["body"] tags or the must be within the document's @racket["body"] tags or the
@scheme["body"] element itself.} @racket["body"] element itself.}
@defmethod[(find-element-by-id-or-name @defmethod[(find-element-by-id-or-name
[id string?] [id string?]
@ -97,19 +97,19 @@
(is-a?/c mx-element%)]{ (is-a?/c mx-element%)]{
Returns an object that encapsulates an HTML element, where Returns an object that encapsulates an HTML element, where
@scheme[id] names either the @scheme["id"] or @scheme["name"] @racket[id] names either the @racket["id"] or @racket["name"]
attribute of the HTML element. The @scheme[index] is a nonnegative attribute of the HTML element. The @racket[index] is a nonnegative
integer indicating the zero-based index of the element among all integer indicating the zero-based index of the element among all
elements with the same @scheme["id"] or @scheme["name"]. The ordering elements with the same @racket["id"] or @racket["name"]. The ordering
of elements is defined by Internet Explorer. The requested element of elements is defined by Internet Explorer. The requested element
must be within the document's @scheme["body"] tags or the must be within the document's @racket["body"] tags or the
@scheme["body"] element itself.} @racket["body"] element itself.}
@defmethod[(elements-with-tag [tag string?]) @defmethod[(elements-with-tag [tag string?])
(listof (is-a?/c mx-element%))]{ (listof (is-a?/c mx-element%))]{
Returns a list of elements with the HTML tag given by @scheme[tag]. Returns a list of elements with the HTML tag given by @racket[tag].
The requested elements must be within the document's @scheme["body"] The requested elements must be within the document's @racket["body"]
tags or the @scheme["body"] element itself.} tags or the @racket["body"] element itself.}
} }

View File

@ -22,13 +22,13 @@
(to-flow spacer) (to-flow spacer)
(to-flow (scheme 'option0)) (to-flow (scheme 'option0))
(to-flow spacer) (to-flow spacer)
(make-flow (list (schemeblock0 contract0)))) (make-flow (list (racketblock0 contract0))))
(list (to-flow spacer) (list (to-flow spacer)
(to-flow spacer) (to-flow spacer)
(to-flow spacer) (to-flow spacer)
(to-flow (scheme 'option)) (to-flow (scheme 'option))
(to-flow spacer) (to-flow spacer)
(make-flow (list (schemeblock0 contract)))) (make-flow (list (racketblock0 contract))))
...) ...)
...)))) ...))))
@ -107,30 +107,30 @@
@defmethod[(insert-html [html string?]) @defmethod[(insert-html [html string?])
void?]{ void?]{
Places the HTML given by the string @scheme[html] before the element.} Places the HTML given by the string @racket[html] before the element.}
@defmethod[(append-html [html string?]) @defmethod[(append-html [html string?])
void?]{ void?]{
Places the HTML given by the string @scheme[html] after the element.} Places the HTML given by the string @racket[html] after the element.}
@defmethod[(replace-html [html string?]) @defmethod[(replace-html [html string?])
void?]{ void?]{
Replaces the HTML in the element with the string @scheme[html]. You Replaces the HTML in the element with the string @racket[html]. You
must use the @method[mx-document<%> find-element] or must use the @method[mx-document<%> find-element] or
@method[mx-document<%> find-element-by-id-or-name] methods of @method[mx-document<%> find-element-by-id-or-name] methods of
@scheme[mx-document<%>] to retrieve the updated element.} @racket[mx-document<%>] to retrieve the updated element.}
@defmethod[(insert-text [txt string?]) @defmethod[(insert-text [txt string?])
void?]{ void?]{
Places the text given by the string @scheme[txt] before the HTML element.} Places the text given by the string @racket[txt] before the HTML element.}
@defmethod[(append-text [txt string?]) @defmethod[(append-text [txt string?])
void?]{ void?]{
Places the text given by the string @scheme[txt] after the HTML element.} Places the text given by the string @racket[txt] after the HTML element.}
@defmethod[(insert-object-from-coclass [coclass string?] @defmethod[(insert-object-from-coclass [coclass string?]
[width exact-integer?] [width exact-integer?]
@ -138,7 +138,7 @@
[size (one-of/c 'pixels 'percent) 'pixels]) [size (one-of/c 'pixels 'percent) 'pixels])
void?]{ void?]{
Composes @scheme[coclass->html] with @method[mx-element% insert-html].} Composes @racket[coclass->html] with @method[mx-element% insert-html].}
@defmethod[(insert-object-from-progid [coclass string?] @defmethod[(insert-object-from-progid [coclass string?]
[width exact-integer?] [width exact-integer?]
@ -146,7 +146,7 @@
[size (one-of/c 'pixels 'percent) 'pixels]) [size (one-of/c 'pixels 'percent) 'pixels])
void?]{ void?]{
Composes @scheme[progid->html] with @method[mx-element% insert-html].} Composes @racket[progid->html] with @method[mx-element% insert-html].}
@defmethod[(append-object-from-coclass [coclass string?] @defmethod[(append-object-from-coclass [coclass string?]
[width exact-integer?] [width exact-integer?]
@ -154,7 +154,7 @@
[size (one-of/c 'pixels 'percent) 'pixels]) [size (one-of/c 'pixels 'percent) 'pixels])
void?]{ void?]{
Composes @scheme[coclass->html] with @method[mx-element% append-html].} Composes @racket[coclass->html] with @method[mx-element% append-html].}
@defmethod[(append-object-from-progid [coclass string?] @defmethod[(append-object-from-progid [coclass string?]
[width exact-integer?] [width exact-integer?]
@ -162,7 +162,7 @@
[size (one-of/c 'pixels 'percent) 'pixels]) [size (one-of/c 'pixels 'percent) 'pixels])
void?]{ void?]{
Composes @scheme[progid->html] with @method[mx-element% append-html].} Composes @racket[progid->html] with @method[mx-element% append-html].}
@defmethod[(focus) @defmethod[(focus)
void?]{ void?]{
@ -173,7 +173,7 @@
@defmethod[(selection) @defmethod[(selection)
string?]{ string?]{
If the element has the @scheme["select"] tag, returns a string If the element has the @racket["select"] tag, returns a string
indicating the value of the current selection. Otherwise, an indicating the value of the current selection. Otherwise, an
exception s raised. The value of the selection may be different exception s raised. The value of the selection may be different
from the string visible in the dropdown list.} from the string visible in the dropdown list.}
@ -181,23 +181,23 @@
@defmethod[(set-selection! [val string?]) @defmethod[(set-selection! [val string?])
void?]{ void?]{
If the element has the @scheme["select"] tag, sets the selection to If the element has the @racket["select"] tag, sets the selection to
the entry with the value @scheme[val], a string. Otherwise, an the entry with the value @racket[val], a string. Otherwise, an
exception is raised. The value of the selection may be different exception is raised. The value of the selection may be different
from the string visible in the dropdown list.} from the string visible in the dropdown list.}
@defmethod[(attribute [attr string?]) @defmethod[(attribute [attr string?])
(or/c string? real? boolean?)]{ (or/c string? real? boolean?)]{
Retrieves the attribute named by the string @scheme[attr]. The return Retrieves the attribute named by the string @racket[attr]. The return
value has a type that depends on the attribute.} value has a type that depends on the attribute.}
@defmethod[(set-attribute! [attr string?] @defmethod[(set-attribute! [attr string?]
[val (or/c string? real? boolean?)]) [val (or/c string? real? boolean?)])
void?]{ void?]{
Sets the attribute named by the string @scheme[attr]. The new Sets the attribute named by the string @racket[attr]. The new
value @scheme[val] has a type that depends on the attribute.} value @racket[val] has a type that depends on the attribute.}
@defmethod[(click) @defmethod[(click)
void?]{ void?]{
@ -246,7 +246,7 @@
Gets or sets the element's CSS @tt{background-color}, @tt{background-image}, Gets or sets the element's CSS @tt{background-color}, @tt{background-image},
@tt{background-repeat}, @tt{background-attachment}, and @tt{background-position} @tt{background-repeat}, @tt{background-attachment}, and @tt{background-position}
using the string @scheme[b].} using the string @racket[b].}
@defmethods[background-image @defmethods[background-image

View File

@ -22,32 +22,32 @@
[(dblclick?) boolean?] [(dblclick?) boolean?]
[(error?) boolean?])]{ [(error?) boolean?])]{
Exactly one of these methods returns @scheme[#t] to indicate the type Exactly one of these methods returns @racket[#t] to indicate the type
of a given event, and the others return @scheme[#f] for the event.} of a given event, and the others return @racket[#f] for the event.}
@defmethod[(alt-key) boolean?]{ @defmethod[(alt-key) boolean?]{
Returns @scheme[#t] if the Alt key was pressed when the Returns @racket[#t] if the Alt key was pressed when the
event was generated, @scheme[#f] otherwise.} event was generated, @racket[#f] otherwise.}
@defmethod[(ctrl-key) boolean?]{ @defmethod[(ctrl-key) boolean?]{
Returns @scheme[#t] if the Ctrl key was pressed when the Returns @racket[#t] if the Ctrl key was pressed when the
event was generated, @scheme[#f] otherwise. } event was generated, @racket[#f] otherwise. }
@defmethod[(from-tag) string?]{ @defmethod[(from-tag) string?]{
Returns a string indicating the tag of the HTML element where the Returns a string indicating the tag of the HTML element where the
mouse is being moved from. The return value is valid only for mouse is being moved from. The return value is valid only for
events for which @method[mx-event<%> mouseover?] or @method[mx-event<%> events for which @method[mx-event<%> mouseover?] or @method[mx-event<%>
mouseout?] produces @scheme[#t].} mouseout?] produces @racket[#t].}
@defmethod[(from-id) string?]{ @defmethod[(from-id) string?]{
Returns a string indicating the identifier of the HTML element where Returns a string indicating the identifier of the HTML element where
the mouse is being moved from. Return value is valid only for the mouse is being moved from. Return value is valid only for
events for which @method[mx-event<%> mouseover?] or @method[mx-event<%> events for which @method[mx-event<%> mouseover?] or @method[mx-event<%>
mouseout?] produces @scheme[#t].} mouseout?] produces @racket[#t].}
@defmethod[(id) string?]{ @defmethod[(id) string?]{
@ -59,12 +59,12 @@
Returns a number indicating the keycode for the key that generated Returns a number indicating the keycode for the key that generated
the event. Return value is valid only for events for which the event. Return value is valid only for events for which
@method[mx-event<%> keypress?], @method[mx-event<%> keydown?], or @method[mx-event<%> keypress?], @method[mx-event<%> keydown?], or
@method[mx-event<%> keyup?] produces @scheme[#t].} @method[mx-event<%> keyup?] produces @racket[#t].}
@defmethod[(shift-key) boolean?]{ @defmethod[(shift-key) boolean?]{
Returns @scheme[#t] if the Shift key was pressed when the Returns @racket[#t] if the Shift key was pressed when the
event was generated, @scheme[#f] otherwise.} event was generated, @racket[#f] otherwise.}
@defmethod[(tag) string?]{ @defmethod[(tag) string?]{
@ -76,14 +76,14 @@
Returns a string indicating the tag of the target HTML element where Returns a string indicating the tag of the target HTML element where
the mouse is being moved to. Return value is valid only for events the mouse is being moved to. Return value is valid only for events
for which @method[mx-event<%> mouseover?] or @method[mx-event<%> for which @method[mx-event<%> mouseover?] or @method[mx-event<%>
mouseout?] produces @scheme[#t].} mouseout?] produces @racket[#t].}
@defmethod[(to-id) boolean?]{ @defmethod[(to-id) boolean?]{
Returns a string indicating the identifier of the target HTML Returns a string indicating the identifier of the target HTML
element where the mouse is being moved from. Return value is valid element where the mouse is being moved from. Return value is valid
only for events for which @method[mx-event<%> mouseover?] or only for events for which @method[mx-event<%> mouseover?] or
@method[mx-event<%> mouseout?] produces @scheme[#t].} @method[mx-event<%> mouseout?] produces @racket[#t].}
@defmethod[(x) exact-integer?]{ @defmethod[(x) exact-integer?]{

View File

@ -5,15 +5,15 @@
@title[#:tag "html" #:style 'toc]{HTML and Dynamic HTML} @title[#:tag "html" #:style 'toc]{HTML and Dynamic HTML}
The @scheme[mx-element%] class encapsulates HTML elements. By The @racket[mx-element%] class encapsulates HTML elements. By
calling the methods of the class, you can change the appearance of calling the methods of the class, you can change the appearance of
elements, and place new HTML before or after the element. While the elements, and place new HTML before or after the element. While the
methods are described here, a good DHTML reference, such as methods are described here, a good DHTML reference, such as
Goodman's @italic{Dynamic HTML} will have more complete information. Goodman's @italic{Dynamic HTML} will have more complete information.
Many of the @scheme[mx-element%] methods have two variants, a Many of the @racket[mx-element%] methods have two variants, a
version that takes or returns Racket data, and another version that takes or returns Racket data, and another
@schemeidfont{-native} version that takes or returns a string. For @racketidfont{-native} version that takes or returns a string. For
methods that return values of element properties, we assume two methods that return values of element properties, we assume two
characteristics, which we do not mention in the methods' characteristics, which we do not mention in the methods'
documentation: 1) Native methods return the empty string for documentation: 1) Native methods return the empty string for
@ -43,18 +43,18 @@
Returns a string containing HTML which when inserted into a document Returns a string containing HTML which when inserted into a document
loads the COM object with the COM class or ProgID given by loads the COM object with the COM class or ProgID given by
@scheme[name]. This procedure is suitable for placing ActiveX @racket[name]. This procedure is suitable for placing ActiveX
controls within complex HTML. The optional @scheme[size] argument controls within complex HTML. The optional @racket[size] argument
gives an interpretation for the @scheme[width] and @scheme[height] gives an interpretation for the @racket[width] and @racket[height]
arguments; by default, @scheme[size] is @scheme['pixels], but may arguments; by default, @racket[size] is @racket['pixels], but may
also be @scheme['percent], indicating that the width and height are also be @racket['percent], indicating that the width and height are
a fixed percentage of the document window size.} a fixed percentage of the document window size.}
@; ---------------------------------------- @; ----------------------------------------
@section{CSS} @section{CSS}
In the @scheme[mx-element%] method descriptions, ``CSS'' refers to In the @racket[mx-element%] method descriptions, ``CSS'' refers to
the Cascading Style Sheets specification. A CSS length is string the Cascading Style Sheets specification. A CSS length is string
consisting of a decimal integer number followed by one of the units consisting of a decimal integer number followed by one of the units
@litchar{px} (pixels), @litchar{em} (font height), @litchar{ex} @litchar{px} (pixels), @litchar{em} (font height), @litchar{ex}
@ -62,9 +62,9 @@
(centimeters), @litchar{mm} (millimeters), @litchar{pc} (picas), or (centimeters), @litchar{mm} (millimeters), @litchar{pc} (picas), or
@litchar{pt} (points). A CSS percentage is a string consisting of a @litchar{pt} (points). A CSS percentage is a string consisting of a
decimal real number followed by @litchar{%}. When using decimal real number followed by @litchar{%}. When using
@schemeidfont{-native} methods, CSS lengths and percentages are @racketidfont{-native} methods, CSS lengths and percentages are
given as strings. For use by non-native methods, the given as strings. For use by non-native methods, the
@scheme[css-percentage] and @scheme[css-length] structures have been @racket[css-percentage] and @racket[css-length] structures have been
defined. defined.
@deftogether[( @deftogether[(
@ -82,11 +82,11 @@
(@litchar{0}-@litchar{9} and @litchar{a}-@litchar{f} or (@litchar{0}-@litchar{9} and @litchar{a}-@litchar{f} or
@litchar{A}-@litchar{F}); the first two digits are for the red @litchar{A}-@litchar{F}); the first two digits are for the red
component of the color, the middle two for the green component, and component of the color, the middle two for the green component, and
the last two for the blue component. For example, @scheme["#FFFFFF"] the last two for the blue component. For example, @racket["#FFFFFF"]
is white, @scheme["#000000"] is black, and @scheme["#00FF00"] is is white, @racket["#000000"] is black, and @racket["#00FF00"] is
green. green.
There are also predefined color names. The @schemeidfont{-native} There are also predefined color names. The @racketidfont{-native}
methods use these names in strings, while their nonnative counterpart methods use these names in strings, while their nonnative counterpart
methods use the names as symbols. methods use the names as symbols.

View File

@ -16,7 +16,7 @@
@defproc[(com-all-controls) (listof string?)]{ @defproc[(com-all-controls) (listof string?)]{
Returns a list of strings for all COM classes Returns a list of strings for all COM classes
registered on a system that have the @scheme["Control"] registered on a system that have the @racket["Control"]
subkey.} subkey.}
@deftogether[( @deftogether[(
@ -28,12 +28,12 @@
com-object?] com-object?]
)]{ )]{
Returns an instance of @scheme[coclass]. This is useful for COM Returns an instance of @racket[coclass]. This is useful for COM
classes without a visual representation, or when a visual classes without a visual representation, or when a visual
representation is not needed. representation is not needed.
The optional argument @scheme[where] indicates a for running the The optional argument @racket[where] indicates a for running the
instance, and may be @scheme['local], @scheme['remote], or a string instance, and may be @racket['local], @racket['remote], or a string
indicating a machine name. See @secref["remote"] for more indicating a machine name. See @secref["remote"] for more
information.} information.}
@ -46,7 +46,7 @@
com-object?] com-object?]
)]{ )]{
Like @scheme[cocreate-instance-from-coclass], but using a ProgID.} Like @racket[cocreate-instance-from-coclass], but using a ProgID.}
@deftogether[( @deftogether[(
@ -56,49 +56,49 @@ Like @scheme[cocreate-instance-from-coclass], but using a ProgID.}
com-object?] com-object?]
)]{ )]{
Like @scheme[cocreate-instance-from-coclass], but gets an existing Like @racket[cocreate-instance-from-coclass], but gets an existing
active object (always local) instead of creating a new one.} active object (always local) instead of creating a new one.}
@defproc[(coclass [obj com-object?]) string?]{ @defproc[(coclass [obj com-object?]) string?]{
Returns a string that is the name of the COM class instantiated by Returns a string that is the name of the COM class instantiated by
@scheme[obj], or raises an error if the COM class is not known.} @racket[obj], or raises an error if the COM class is not known.}
@defproc[(progid [obj com-object?]) string?]{ @defproc[(progid [obj com-object?]) string?]{
Returns a string that is the name of the ProgID instantiated by Returns a string that is the name of the ProgID instantiated by
@scheme[obj], or raises an error if the COM class is not known.} @racket[obj], or raises an error if the COM class is not known.}
@defproc[(set-coclass! [obj com-object?] [coclass string?]) void?]{ @defproc[(set-coclass! [obj com-object?] [coclass string?]) void?]{
Sets the COM class for @scheme[obj] to @scheme[coclass]. This is Sets the COM class for @racket[obj] to @racket[coclass]. This is
useful when MysterX COM event-handling procedures can obtain only useful when MysterX COM event-handling procedures can obtain only
ambiguous information about the object's COM class.} ambiguous information about the object's COM class.}
@defproc[(set-coclass-from-progid! [obj com-object?] [progid string?]) void?]{ @defproc[(set-coclass-from-progid! [obj com-object?] [progid string?]) void?]{
Like @scheme[set-coclass!], but using a ProgID.} Like @racket[set-coclass!], but using a ProgID.}
@defproc[(com-methods [obj/type (or/c com-object? com-type?)]) @defproc[(com-methods [obj/type (or/c com-object? com-type?)])
(listof string?)]{ (listof string?)]{
Returns a list of strings indicating the names of methods on Returns a list of strings indicating the names of methods on
@scheme[obj/type].} @racket[obj/type].}
@defproc[(com-method-type [obj/type (or/c com-object? com-type?)] @defproc[(com-method-type [obj/type (or/c com-object? com-type?)]
[method-name string?]) [method-name string?])
(listof symbol?)]{ (listof symbol?)]{
Returns a list of symbols indicating the type of the specified Returns a list of symbols indicating the type of the specified
method in @scheme[obj/type]. See @secref["com-types"] for method in @racket[obj/type]. See @secref["com-types"] for
information on the symbols.} information on the symbols.}
@defproc[(com-invoke [obj com-object?] [method-name string?] [v any/c]) @defproc[(com-invoke [obj com-object?] [method-name string?] [v any/c])
any/c]{ any/c]{
Invokes @scheme[method-name] on @scheme[obj] with @scheme[v]s as the Invokes @racket[method-name] on @racket[obj] with @racket[v]s as the
arguments. The special value @scheme[com-omit] may be used for arguments. The special value @racket[com-omit] may be used for
optional arguments, which useful when values are supplied for optional arguments, which useful when values are supplied for
arguments after the omitted argument(s).} arguments after the omitted argument(s).}
@ -106,35 +106,35 @@ Like @scheme[cocreate-instance-from-coclass], but using a ProgID.}
(listof string?)]{ (listof string?)]{
Returns a list of strings indicating the names of readable Returns a list of strings indicating the names of readable
properties in @scheme[obj/type].} properties in @racket[obj/type].}
@defproc[(com-get-property-type [obj/type (or/c com-object? com-type?)] @defproc[(com-get-property-type [obj/type (or/c com-object? com-type?)]
[property-name string?]) [property-name string?])
(listof symbol?)]{ (listof symbol?)]{
Returns a list of symbols indicating the type of the specified Returns a list of symbols indicating the type of the specified
property in @scheme[obj/type]. See @secref["com-types"] for property in @racket[obj/type]. See @secref["com-types"] for
information on the symbols.} information on the symbols.}
@defproc[(com-get-property [obj com-object?] [property string?] ...+) @defproc[(com-get-property [obj com-object?] [property string?] ...+)
any/c]{ any/c]{
Returns the value of the final property by following the indicated Returns the value of the final property by following the indicated
path of @scheme[property]s, where each intermediate property is a path of @racket[property]s, where each intermediate property is a
COM object.} COM object.}
@defproc[(com-set-properties [obj/type (or/c com-object? com-type?)]) @defproc[(com-set-properties [obj/type (or/c com-object? com-type?)])
(listof string?)]{ (listof string?)]{
Returns a list of strings indicating the names of writeable Returns a list of strings indicating the names of writeable
properties in @scheme[obj/type].} properties in @racket[obj/type].}
@defproc[(com-set-property-type [obj/type (or/c com-object? com-type?)] @defproc[(com-set-property-type [obj/type (or/c com-object? com-type?)]
[property-name strig?]) [property-name strig?])
(listof symbol?)]{ (listof symbol?)]{
Returns a list of symbols indicating the type of the specified Returns a list of symbols indicating the type of the specified
property in @scheme[obj/type]. See @secref["com-types"] for property in @racket[obj/type]. See @secref["com-types"] for
information on the symbols.} information on the symbols.}
@defproc[(com-set-property! [obj com-object?] @defproc[(com-set-property! [obj com-object?]
@ -142,8 +142,8 @@ Like @scheme[cocreate-instance-from-coclass], but using a ProgID.}
[v any/c]) [v any/c])
void?]{ void?]{
Sets the value of the final property in @scheme[obj] to @scheme[v] Sets the value of the final property in @racket[obj] to @racket[v]
by following the @scheme[property]s, where the value of each by following the @racket[property]s, where the value of each
intermediate property is a COM object.} intermediate property is a COM object.}
@defproc[(com-help [obj/type (or/c com-object? com-type?)] @defproc[(com-help [obj/type (or/c com-object? com-type?)]
@ -151,23 +151,23 @@ Like @scheme[cocreate-instance-from-coclass], but using a ProgID.}
void?]{ void?]{
Starts the Window Help system with help about the COM object or COM Starts the Window Help system with help about the COM object or COM
type. The optional @scheme[topic] is typically a method or property type. The optional @racket[topic] is typically a method or property
name.} name.}
@defproc[(com-object-eq? [obj1 com-object?] [obj2 com-object?]) @defproc[(com-object-eq? [obj1 com-object?] [obj2 com-object?])
boolean?]{ boolean?]{
Returns @scheme[#t] if the two COM objects are the same, Returns @racket[#t] if the two COM objects are the same,
@scheme[#f] otherwise.} @racket[#f] otherwise.}
@defproc[(com-object? [obj com-object?]) boolean?]{ @defproc[(com-object? [obj com-object?]) boolean?]{
Returns @scheme[#t] if the argument is a COM object, @scheme[#f] Returns @racket[#t] if the argument is a COM object, @racket[#f]
otherwise.} otherwise.}
@defproc[(com-add-ref [obj com-object?]) void?]{ @defproc[(com-add-ref [obj com-object?]) void?]{
Increments the reference count for @scheme[obj]. Increments the reference count for @racket[obj].
This procedure should only be called when system-level This procedure should only be called when system-level
errors occur due to a mismanaged COM object. Ordinarily, errors occur due to a mismanaged COM object. Ordinarily,
MysterX handles all COM reference-counting automatically.} MysterX handles all COM reference-counting automatically.}

View File

@ -29,7 +29,7 @@ with your distribution, and the DLLs will need to be registered on the
end user's machine. One way to do that is to include the following end user's machine. One way to do that is to include the following
little setup program (as an executable) in your distribution: little setup program (as an executable) in your distribution:
@schemeblock[ @racketblock[
(module setup scheme/base (module setup scheme/base
(require mzlib/runtime-path (require mzlib/runtime-path
mzlib/process) mzlib/process)
@ -51,7 +51,7 @@ little setup program (as an executable) in your distribution:
Try Try
@schemeblock[ @racketblock[
(require mysterx/mxdemo) (require mysterx/mxdemo)
] ]
@ -65,19 +65,19 @@ downloaded from elsewhere; look for @filepath{mscal.ocx}.
Load the MysterX module with Load the MysterX module with
@schemeblock[ @racketblock[
(require mysterx) (require mysterx)
] ]
Because some MysterX code relies on the @schememodname[scheme/class] Because some MysterX code relies on the @racketmodname[scheme/class]
class system, you may also need class system, you may also need
@schemeblock[ @racketblock[
(require mzlib/class) (require mzlib/class)
] ]
Several MysterX procedures take HTML strings as input. The Several MysterX procedures take HTML strings as input. The
@schememodname[xml] library provides procedures that convert Racket @racketmodname[xml] library provides procedures that convert Racket
syntax into XML strings. You may find using these procedures useful syntax into XML strings. You may find using these procedures useful
in creating HTML strings for use by MysterX. in creating HTML strings for use by MysterX.

View File

@ -65,16 +65,16 @@ building from the Racket source distribution. The above C/C++ code
is for illustration; your actual code should check return values, of is for illustration; your actual code should check return values, of
course. course.
Using @schememodname[mysterx] to manipulate COM objects within Racket, Using @racketmodname[mysterx] to manipulate COM objects within Racket,
you can load MzCOM with either you can load MzCOM with either
@schemeblock[ @racketblock[
(cci/coclass "MzObj Class") (cci/coclass "MzObj Class")
] ]
or or
@schemeblock[ @racketblock[
(cci/progid "MzCOM.MzObj.<version>") (cci/progid "MzCOM.MzObj.<version>")
] ]
@ -158,7 +158,7 @@ means to obtain COM error information.
The Racket evaluator runs in a Win32 thread created when MzCOM is The Racket evaluator runs in a Win32 thread created when MzCOM is
loaded. If an expression kills the primary Racket thread, as in loaded. If an expression kills the primary Racket thread, as in
@schemeblock[ @racketblock[
(kill-thread (current-thread)) (kill-thread (current-thread))
] ]

View File

@ -36,12 +36,12 @@
[id-or-false id [id-or-false id
#f])]{ #f])]{
The @scheme[awk] macro from Scsh @cite["Shivers06"]. In addition to The @racket[awk] macro from Scsh @cite["Shivers06"]. In addition to
@scheme[awk], the Scsh-compatible procedures @scheme[match:start], @racket[awk], the Scsh-compatible procedures @racket[match:start],
@scheme[match:end], @scheme[match:substring], and @scheme[regexp-exec] @racket[match:end], @racket[match:substring], and @racket[regexp-exec]
are defined. These @schemeidfont{match:} procedures must be used to are defined. These @racketidfont{match:} procedures must be used to
extract match information in a regular expression clause when using extract match information in a regular expression clause when using
the @scheme[=>] form. } the @racket[=>] form. }
@deftogether[( @deftogether[(
@defproc[(match:start [rec ....] @defproc[(match:start [rec ....]
@ -58,12 +58,12 @@ the @scheme[=>] form. }
Extracts a start position, end position, or substring corresponding to Extracts a start position, end position, or substring corresponding to
a match. The first argument is the value supplied to the procedure a match. The first argument is the value supplied to the procedure
after @scheme[=>] in a @scheme[awk] clause or the result of after @racket[=>] in a @racket[awk] clause or the result of
@scheme[regexp-exec].} @racket[regexp-exec].}
@defproc[(regexp-exec [re (or/c string? regexp?)] [s string?]) @defproc[(regexp-exec [re (or/c string? regexp?)] [s string?])
(or/c .... false/c)]{ (or/c .... false/c)]{
Matches a regexp to a string, returning a record compatible with Matches a regexp to a string, returning a record compatible with
@scheme[match:start], etc.} @racket[match:start], etc.}

View File

@ -6,19 +6,19 @@
@mzlib[#:mode title class100] @mzlib[#:mode title class100]
The @scheme[class100] and @scheme[class100*] forms provide a syntax The @racket[class100] and @racket[class100*] forms provide a syntax
close to that of @scheme[class] and @scheme[class*] in Racket close to that of @racket[class] and @racket[class*] in Racket
versions 100 through 103, but with the semantics of the current versions 100 through 103, but with the semantics of the current
@schememodname[scheme/class]-based class system. For a class defined @racketmodname[scheme/class]-based class system. For a class defined
with @scheme[class100], keyword-based initialization arguments can be with @racket[class100], keyword-based initialization arguments can be
propagated to the superclass, but by-position arguments are not (i.e., propagated to the superclass, but by-position arguments are not (i.e.,
the expansion of @scheme[class100] to @scheme[class] always includes the expansion of @racket[class100] to @racket[class] always includes
an @scheme[init-rest] clause). an @racket[init-rest] clause).
The @scheme[class100] form uses keywords (e.g., @scheme[public]) that The @racket[class100] form uses keywords (e.g., @racket[public]) that
are defined by the @schememodname[mzlib/class] library, so typically are defined by the @racketmodname[mzlib/class] library, so typically
@schememodname[scheme/class] must be imported into any context that @racketmodname[scheme/class] must be imported into any context that
imports @schememodname[mzlib/class100]. imports @racketmodname[mzlib/class100].
@defform/subs[ @defform/subs[
@ -60,24 +60,24 @@ imports @schememodname[mzlib/class100].
...) ...)
]{ ]{
Like @scheme[class100*], but without @scheme[interface-expr]s.} Like @racket[class100*], but without @racket[interface-expr]s.}
@defform[(class100-asi superclass instance-id-clause ...)]{ @defform[(class100-asi superclass instance-id-clause ...)]{
Like @scheme[class100], but all initialization arguments are Like @racket[class100], but all initialization arguments are
automatically passed on to the superclass initialization procedure by automatically passed on to the superclass initialization procedure by
position.} position.}
@defform[(class100*-asi superclass interfaces instance-id-clause ...)]{ @defform[(class100*-asi superclass interfaces instance-id-clause ...)]{
Like @scheme[class100*], but all initialization arguments are Like @racket[class100*], but all initialization arguments are
automatically passed on to the superclass initialization procedure by automatically passed on to the superclass initialization procedure by
position.} position.}
@defform[(super-init init-arg-expr ...)]{ @defform[(super-init init-arg-expr ...)]{
An alias for @scheme[super-make-object].} An alias for @racket[super-make-object].}

View File

@ -4,16 +4,16 @@
@(define-syntax-rule (intro id) @(define-syntax-rule (intro id)
(begin (begin
(require (for-label scheme/cmdline)) (require (for-label racket/cmdline))
(define id (scheme command-line)))) (define id (racket command-line))))
@(intro scheme-command-line) @(intro racket-command-line)
@mzlib[#:mode title cmdline] @mzlib[#:mode title cmdline]
Provides a @scheme[command-line] from that is similar to the one in Provides a @racket[command-line] from that is similar to the one in
@schememodname[scheme/cmdline], but without using keywords. The @racketmodname[racket/cmdline], but without using keywords. The
@scheme[parse-command-line] procedure from @racket[parse-command-line] procedure from
@schememodname[scheme/cmdline] is re-exported directly. @racketmodname[racket/cmdline] is re-exported directly.
@defform/subs[ @defform/subs[
#:literals (multi once-each once-any final help-labels args =>) #:literals (multi once-each once-any final help-labels args =>)
@ -34,5 +34,5 @@ Provides a @scheme[command-line] from that is similar to the one in
(id ...) (id ...)
(id ...+ . id)])]{ (id ...+ . id)])]{
Like @scheme-command-line from @scheme[scheme/cmdline], but without Like @racket-command-line from @racket[racket/cmdline], but without
keywords in the syntax.} keywords in the syntax.}

Some files were not shown because too many files have changed in this diff Show More