svn: r6832
This commit is contained in:
Matthew Flatt 2007-07-07 08:31:19 +00:00
parent c58aca5111
commit 9764065c6a
29 changed files with 3223 additions and 3040 deletions

View File

@ -133,15 +133,6 @@
;; The sort in "list.ss" should be moved into it's own library,
;; so we can use it here without requiring lots of other stuff.)
;; Also, keyword<? should be made built in. (We need it in two phases.)
(define (keyword<? a b)
(string<? (keyword->string a)
(keyword->string b)))
(define-for-syntax (keyword<? a b)
(string<? (keyword->string a)
(keyword->string b)))
(define-for-syntax (sort l <?)
(cond
[(null? l) null]
@ -650,7 +641,8 @@
(check-kw-args p kws)
(values #f (car kws)))])
(let ([args-str
(if (null? args)
(if (and (null? args)
(null? kws))
"no arguments supplied"
;; Hack to format arguments:
(with-handlers ([exn:fail?

View File

@ -1994,8 +1994,8 @@ improve method arity mismatch contract violation error messages?
[(parameter? val)
(make-derived-parameter
val
#;partial-pos-contract
partial-neg-contract)]
partial-neg-contract
partial-pos-contract)]
[else
(raise-contract-error val src-info pos-blame orig-str
"expected a parameter")])))))))

View File

@ -88,9 +88,8 @@ a break exception is raised, the semaphore will not have been
decremented.
To allow similar implementation patterns over blocking port
operations, MzScheme provides @scheme[read-bytes-avail!/enable-break]
(see @secref["mz:read"]), @scheme[write-bytes-avail/enable-break] (see
@secref["mz:write"]), and other procedures.
operations, MzScheme provides @scheme[read-bytes-avail!/enable-break],
@scheme[write-bytes-avail/enable-break], and other procedures.
@;------------------------------------------------------------------------

View File

@ -132,7 +132,7 @@ The stack-trace list is the result of
@scheme[continuation-mark-set->list] with @scheme[mark-set] and
Scheme's private key for procedure-call marks. A stack trace is
extracted from an exception and displayed by the default error display
handler (see @secref["mz:exnsandflow"]) for exceptions other than
handler (see @scheme[current-error-display-handler]) for exceptions other than
@scheme[exn:fail:user] (see @scheme[raise-user-error] in
@secref["mz:errorproc"]).}

View File

@ -59,7 +59,7 @@ default) or @scheme[make-continuation-prompt-tag]. The result of
@scheme[call-with-continuation-prompt] call.
The @scheme[handler] argument specifies a handler procedure to be
called in tail position with repsect to the
called in tail position with respect to the
@scheme[call-with-continuation-prompt] call when the installed prompt
is the target of a @scheme[abort-current-continuation] call with
@scheme[prompt-tag]; the remaining arguments of
@ -294,11 +294,11 @@ to disable breaks.
In both cases, the target for a jump is recomputed after each
@scheme[pre-thunk] or @scheme[post-thunk] completes. When a
prompt-delimited continuation (see @secref["mz:prompts"]) is captured
in a @scheme[post-thunk], it might be delimited and instantiated in
such a way that the target of a jump turns out to be different when
the continuation is applied than when the continuation was
captured. There may even be no appropriate target, if a relevant
prompt-delimited continuation (see @secref["mz:prompt-model"]) is
captured in a @scheme[post-thunk], it might be delimited and
instantiated in such a way that the target of a jump turns out to be
different when the continuation is applied than when the continuation
was captured. There may even be no appropriate target, if a relevant
prompt or escape continuation is not in the continuation after the
restore; in that case, the first step in a @scheme[pre-thunk] or
@scheme[post-thunk]'s continuation can raise an exception.

View File

@ -32,34 +32,33 @@ event's state.
The following act as events in stand-alone MzScheme. An extension or
embedding application can extend the set of primitive events --- in
particular, an eventspace in MrEd is an event --- and new structure
types can generate events (see @secref["mz:evt-structs"]).
types can generate events (see @scheme[prop:evt]).
@itemize{
@item{@scheme[semaphore] --- a semaphore is ready when
@scheme[semaphore-wait] (see @secref["mz:semaphore"]) would not
block. @ResultItself{semaphore}.}
@scheme[semaphore-wait] would not block. @ResultItself{semaphore}.}
@item{@scheme[semaphore-peek] --- a semaphore-peek event returned by
@scheme[semaphore-peek-evt] applied to @scheme[semaphore] (see
@secref["mz:semaphore"]) is ready exactly when @scheme[semaphore] is
@scheme[semaphore-peek-evt] applied to @scheme[semaphore] is ready
exactly when @scheme[semaphore] is
ready. @ResultItself{semaphore-peek}.}
@item{@scheme[channel] --- a channel returned by @scheme[make-channel]
is ready when @scheme[channel-get] would not block (see
@secref["mz:channel"]). The channel's result as an event is the same as
the @scheme[channel-get] result.}
@item{@scheme[channel] --- a channel returned by
@scheme[make-channel] is ready when @scheme[channel-get] would not
block. The channel's result as an event is the same as the
@scheme[channel-get] result.}
@item{@scheme[channel-put] --- an event returned by
@scheme[channel-put-evt] applied to @scheme[channel] is ready when
@scheme[channel-put] would not block on @scheme[channel] (see
@secref["mz:channel"]). @ResultItself{channel-put}.}
@scheme[channel-put] would not block on
@scheme[channel]. @ResultItself{channel-put}.}
@item{@scheme[input-port] --- an input port is ready as an event when
@scheme[read-byte] would not block. @ResultItself{input-port}.}
@item{@scheme[output-port] --- an output port is ready when
@scheme[write-bytes-avail] would not block (see @secref["mz:write"]) or
@scheme[write-bytes-avail] would not block or
when the port contains buffered characters and
@scheme[write-bytes-avail*] can flush part of the buffer (although
@scheme[write-bytes-avail] might block). @ResultItself{output-port}.}
@ -69,49 +68,45 @@ types can generate events (see @secref["mz:evt-structs"]).
any subsequent read from @scheme[input-port]. @ResultItself{progress}.}
@item{@scheme[tcp-listener] --- a TCP listener is ready when
@scheme[tcp-accept] (see @secref["mz:tcp"]) would not block.
@ResultItself{listener}.}
@scheme[tcp-accept] would not block. @ResultItself{listener}.}
@item{@scheme[thd] --- a thread is ready when @scheme[thread-wait]
(see @secref["mz:threadsync"]) would not block. @ResultItself{thread}.}
would not block. @ResultItself{thread}.}
@item{@scheme[thread-dead] --- an event returned by
@scheme[thread-dead-evt] (see @secref["mz:threadsync"]) applied to
@scheme[thd] is ready when @scheme[thd] has terminated.
@ResultItself{thread-dead}.}
@scheme[thread-dead-evt] applied to @scheme[thd] is ready when
@scheme[thd] has terminated. @ResultItself{thread-dead}.}
@item{@scheme[thread-resume] --- an event returned by
@scheme[thread-resume-evt] (see @secref["mz:threadsync"]) applied to
@scheme[thd] is ready when @scheme[thd] subsequently resumes
execution (if it was not already running). The event's result is
@scheme[thd].}
@scheme[thread-resume-evt] applied to @scheme[thd] is ready when
@scheme[thd] subsequently resumes execution (if it was not already
running). The event's result is @scheme[thd].}
@item{@scheme[thread-suspend] --- an event returned by
@scheme[thread-suspend-evt] (see @secref["mz:threadsync"]) applied to
@scheme[thd] is ready when @scheme[thd] subsequently suspends
execution (if it was not already suspended). The event's result is
@scheme[thd].}
@scheme[thread-suspend-evt] applied to @scheme[thd] is ready when
@scheme[thd] subsequently suspends execution (if it was not already
suspended). The event's result is @scheme[thd].}
@item{@scheme[alarm] --- an event returned by @scheme[alarm-evt] is
ready after a particular date and time. @ResultItself{alarm}.}
@item{@scheme[subprocess] --- a subprocess is ready when
@scheme[subprocess-wait] (see @secref["mz:subprocess"]) would not block.
@scheme[subprocess-wait] would not block.
@ResultItself{subprocess}.}
@item{@scheme[will-executor] --- a will executor is ready when
@scheme[will-execute] (see @secref["mz:willexecutor"]) would not block.
@scheme[will-execute] would not block.
@ResultItself{will-executor}.}
@item{@scheme[udp] --- an event returned by @scheme[udp-send-evt] or
@scheme[udp-receive!-evt] (see @secref["mz:udp"]) is ready when a send or
receive on the original socket would block, respectively. @ResultItself{udp}.}
@scheme[udp-receive!-evt] is ready when a send or receive on the
original socket would block, respectively. @ResultItself{udp}.}
@item{@scheme[choice] --- an event returned by @scheme[choice-evt] (see
below) is ready when one or more of the @scheme[evt]s supplied to
@item{@scheme[choice] --- an event returned by @scheme[choice-evt] is
ready when one or more of the @scheme[evt]s supplied to
@scheme[chocie-evt] are ready. If the choice event is chosen, one of
its ready @scheme[evt]s is chosen pseudo-randomly, and the result is the
chosen @scheme[evt]'s result.}
its ready @scheme[evt]s is chosen pseudo-randomly, and the result is
the chosen @scheme[evt]'s result.}
@item{@scheme[wrap] --- an event returned by @scheme[wrap-evt]
applied to @scheme[evt] and @scheme[proc] is ready when @scheme[evt] is
@ -164,8 +159,8 @@ types can generate events (see @secref["mz:evt-structs"]).
result.}
@item{@scheme[struct] --- a structure whose type has the
@scheme[prop:evt] property identifies/generates an event through
the property; see @secref["mz:evt-structs"] for further information.}
@scheme[prop:evt] property identifies/generates an event through the
property.}
@item{@scheme[always-evt] --- a constant event that is always
ready. @ResultItself{@scheme[always-evt]}.}
@ -342,9 +337,9 @@ A @tech{structure type property} that identifies structure types whose
}
Instances of a structure type with the @scheme[prop:input-port] or
@scheme[prop:output-port] property (see @secref["mz:portstructs"]) are
also synchronizable by virtue of being a port. If the structure type
has more than one of @scheme[prop:evt], @scheme[prop:input-port], and
@scheme[prop:output-port] property are also synchronizable by virtue
of being a port. If the structure type has more than one of
@scheme[prop:evt], @scheme[prop:input-port], and
@scheme[prop:output-port], then the @scheme[prop:evt] value (if any)
takes precedence for determing the instance's behavior as an event,
and the @scheme[prop:input-port] property takes precedence over

View File

@ -190,7 +190,7 @@ exception is raised during the evaluation of @scheme[thunk] (in an
extension of the current continuation that does not have its own
exception handler), then @scheme[f] is applied to the @scheme[raise]d
value in the continuation of the @scheme[raise] call (but extended
with a continuation barrier; see @secref["mz:continuations"]).
with a @tech{continuation barrier}; see @secref["mz:prompt-model"]).
Any procedure that takes one argument can be an exception handler. If
the exception handler returns a value when invoked by @scheme[raise],
@ -276,6 +276,104 @@ Like @scheme[with-handlers], but if a @scheme[handler-expr] procedure
is called, breaks are not explicitly disabled, and the call is in tail
position with respect to the @scheme[with-handlers*] form.}
@;------------------------------------------------------------------------
@section{Configuring Default Handling}
@defparam[error-escape-handler proc (-> any)]{
A parameter for the @deftech{error escape handler}, which takes no
arguments and escapes from the dynamic context of an exception. The
default error escape handler escapes using
@scheme[(abort-current-continuation (default-continuation-prompt-tag)
void)].
The error escape handler is normally called directly by an exception
handler, in a @tech{parameterization} that sets the @tech{error
display handler} and @tech{error escape handler} to the default
handlers, and it is normally @scheme[parameterize-break]ed to disable
breaks. To escape from a run-time error in a different context, use
@scheme[raise] or @scheme[error].
Due to a @tech{continuation barrier} around exception-handling calls,
an error escape handler cannot invoke a full continuation that was
created prior to the exception, but it can abort to a prompt (see
@scheme[call-with-continuation-prompt]) or invoke an escape
continuation (see @scheme[call-with-escape-continuation]).}
@defparam[error-display-handler proc (string? any/c . -> . any)]{
A parameter for the @deftech{error display handler}, which is called
by the default exception handler with an error message and the
exception value. More generally, the handler's first argument is a
string to print as an error message, and the second is a value
representing a raised exception.
The default error display handler @scheme[display]s its first argument
to the current error port (determined by the
@scheme[current-error-port] parameter) and extracts a stack trace (see
@scheme[continuation-mark-set->context]) to display from the second
argument if it is an @scheme[exn] value but not an
@scheme[exn:fail:user] value.
@margin-note{The default error display handler in DrScheme also uses
the second argument to highlight source locations.}
To report a run-time error, use @scheme[raise] or procedures like
@scheme[error], instead of calling the error display procedure
directly.}
@defparam[error-print-width width (and exact-integer? (>=/c 3))]{
A parameter whose value is used as the maximum number of characters
used to print a Scheme value that is embedded in a primitive error
message.}
@defparam[error-print-context-length cnt nonnegative-exact-integer?]{
A parameter whose value is used by the default error display handler
as the maximum number of lines of context (or ``stack trace'') to
print; a single ``...'' line is printed if more lines are available
after the first @scheme[cnt] lines. A @scheme[0] value for
@scheme[cnt] disables context printing entirely.}
@defparam[error-value->string-handler proc (any/c nonnegative-exact-integer?
. -> .
string?)]{
A parameter that determines the @deftech{error value conversion
handler}, which is used to print a Scheme value that is embedded in a
primitive error message.
The integer argument to the handler specifies the maximum number of
characters that should be used to represent the value in the resulting
string. The default error value conversion handler @scheme[print]s
the value into a string (using the current @tech{global port print
handler}; see @scheme[global-port-print-handler]). If the printed form
is too long, the printed form is truncated and the last three
characters of the return string are set to ``...''.
If the string returned by an error value conversion handler is longer
than requested, the string is destructively ``truncated'' by setting
the first extra position in the string to the null character. If a
non-string is returned, then the string @scheme["..."] is used. If a
primitive error string needs to be generated before the handler has
returned, the default error value conversion handler is used.
Call to an error value conversion handler are @scheme[parameterized]
to re-install the default error value conversion handler, and to
enable printing of unreadable values (see @scheme[print-unreadable]).}
@defboolparam[error-print-source-location include?]{
A parameter that controls whether read and syntax error messages
include source information, such as the source line and column or the
expression. This parameter also controls the error message when a
module-defined variable is accessed before its definition is executed;
the parameter determines whether the message includes a module
name. Only the message field of an @scheme[exn:fail:read],
@scheme[exn:fail:syntax], or @scheme[exn:fail:contract:variable]
structure is affected by the parameter. The default is @scheme[#t].}
@;------------------------------------------------------------------------
@section{Built-in Exception Types}

View File

@ -1,7 +1,7 @@
#reader(lib "docreader.ss" "scribble")
@require["mz.ss"]
@title{File Ports}
@title[#:tag "mz:file-ports"]{File Ports}
A port created by @scheme[open-input-file], @scheme[open-output-file],
@scheme[subprocess], and related functions is a @deftech{file-stream

View File

@ -5,9 +5,9 @@
See @secref["mz:parameter-model"] for basic information on the
parameter model. Parameters correspond to @defterm{preserved thread
fluids} in \first{Scsh} @cite[#:key "cite:thread-fluids" #:title
"Processes vs. User-Level Threads in Scsh" #:author "Martin Gasbichler
and Michael Sperber" #:date 2002 #:location "Scheme Workshop"].
fluids} in Scsh @cite[#:key "cite:thread-fluids" #:title "Processes
vs. User-Level Threads in Scsh" #:author "Martin Gasbichler and
Michael Sperber" #:date 2002 #:location "Scheme Workshop"].
To parameterize code in a thread- and continuation-friendly manner,
use @scheme[parameterize]. The @scheme[parameterize] form introduces a
@ -123,12 +123,21 @@ forms.}
@defproc[(make-derived-parameter [v any/c]
[guard (any/c . -> . any)])
[guard (any/c . -> . any)]
[wrap (any/c . -> . any)])
parameter?]{
Returns a parameter procedure that sets or retrieves the same value as
@scheme[parameter], but with the additional guard @scheme[guard]
applied (before any guard associated with @scheme[parameter]).}
@scheme[parameter], but with:
@itemize{
@item{@scheme[guard] applied when setting the parameter (before any
guard associated with @scheme[parameter]), and}
@item{@scheme[wrap] applied when obtaining the parameter's value.}
}}
@defproc[(parameter? [v any/c]) boolean?]{

View File

@ -154,7 +154,7 @@ is written using @litchar{\a}, @litchar{\b}, @litchar{\t},
@litchar{\e} if possible, otherwise using @litchar{\} followed by one
to three octal digits (only as many as necessary).
@section{Printing Vectors}
@section[#:tag "mz:print-vectors"]{Printing Vectors}
In @scheme[display] mode, the printed form of a vector is @litchar{#}
followed by the printed form of @scheme[vector->list] applied to the
@ -162,7 +162,7 @@ vector. In @scheme[write] mode, the printed form is the same, except
that a decimal integer is printed after the @litchar{#} when the
@scheme[print-vector-length] parameter is @scheme[#t].
@section{Printing Hash Tables}
@section[#:tag "mz:print-hashtable"]{Printing Hash Tables}
When the @scheme[print-hash-table] parameter is set to @scheme[#t], a
hash table prints starting with @litchar{#hash(} or @litchar{#hasheq(}
@ -177,7 +177,7 @@ After all key-value pairs, the printed form completes with
When the @scheme[print-hash-table] parameter is set to @scheme[#f], a
hash table prints (un@scheme[read]ably) as @litchar{#<hash-table>}.
@section{Printing Boxes}
@section[#:tag "mz:print-box"]{Printing Boxes}
When the @scheme[print-box] parameter is set to @scheme[#t],
a box prints as @litchar{#&} followed by the printed form of its content.

View File

@ -36,7 +36,7 @@ Similar to calling @scheme[read], but normally used during the dynamic
extent of @scheme[read] within a reader-extension procedure (see
@secref["mz:reader-procs"]). The main effect of using
@scheme[read/recursive] instead of @scheme[read] is that
graph-structure annotations (see @secref["mz:sexpressions"]) in the
graph-structure annotations (see @secref["mz:parse-graph"]) in the
nested read are considered part of the overall read, at least when the
@scheme[graph?] argument is true; since the result is wrapped in a
placeholder, however, it is not directly inspectable.

View File

@ -317,7 +317,7 @@ match succeeds, @scheme[#f] otherwise.}
Like @scheme[regexp-match] on input ports, but only peeks bytes from
@scheme[input-port] instead of reading them. Furthermore, instead of
an output port, the last optional argument is a progress event for
@scheme[input-port] (see @secref["mz:read"]). If @scheme[progress]
@scheme[input-port] (see @scheme[port-progress-evt]). If @scheme[progress]
becomes ready, then the match stops peeking from @scheme[input-port]
and returns @scheme[#f]. The @scheme[progress] argument can be
@scheme[#f], in which case the peek may continue with inconsistent

View File

@ -69,8 +69,8 @@ the event does not decrement @scheme[sema]'s internal count.}
Waits on @scheme[sema] using @scheme[semaphore-wait], calls
@scheme[proc] with all @scheme[arg]s, and then posts to
@scheme[sema]. A continuation barrier blocks full continuation jumps
into or out of @scheme[proc] (see @secref["mz:continuations"]), but
@scheme[sema]. A @tech{continuation barrier} blocks full continuation jumps
into or out of @scheme[proc] (see @secref["mz:prompt-model"]), but
escape jumps are allowed, and @scheme[sema] is posted on escape. If
@scheme[try-fail-thunk] is provided and is not @scheme[#f], then
@scheme[semaphore-try-wait?] is called on @scheme[sema] instead of

View File

@ -33,7 +33,7 @@ built-in datatypes, the sequence datatype includes the following:
@item{byte strings (see @secref["mz:bytestrings"])}
@item{input ports (see @secref["mz:input-ports"])}
@item{input ports (see @secref["mz:ports"])}
}

View File

@ -103,7 +103,7 @@ information about the structure type and its instances; see
@secref["mz:inspectors"] for more information.
If @scheme[proc-spec] is an integer or procedure, instances of the
structure type act as procedures. See @secref["mz:procstructs"] for
structure type act as procedures. See @scheme[prop:procedure] for
further information. Providing a non-@scheme[#f] value for
@scheme[proc-spec] is the same as pairing the value with
@scheme[prop:procedure] in @scheme[props], plus including

View File

@ -8,11 +8,10 @@
@title[#:tag "mz:windowspaths"]{Windows Path Conventions}
In general, a Windows pathname consists of an optional drive specifier
and a drive-specific path. As noted in @secref["mz:filesystem"], a
Windows path can be @defterm{absolute} but still relative to the
current drive; such paths start with a @litchar{/} or @litchar["\\"]
separator and are not UNC paths or paths that start with
@litchar["\\\\?\\"].
and a drive-specific path. A Windows path can be @defterm{absolute}
but still relative to the current drive; such paths start with a
@litchar{/} or @litchar["\\"] separator and are not UNC paths or paths
that start with @litchar["\\\\?\\"].
A path that starts with a drive specification is @defterm{complete}.
Roughly, a drive specification is either a Roman letter followed by a

View File

@ -143,7 +143,7 @@ structures that have a custom-write procedure (see
@defboolparam[print-graph on?]{
A parameter that controls printing data with sharing; defaults to
@scheme[#f]. See @secref["mz:sexpressions"] for more information.}
@scheme[#f]. See @secref["mz:printing"] for more information.}
@defboolparam[print-struct on?]{
@ -156,17 +156,17 @@ structures that have a custom-write procedure (see
@defboolparam[print-box on?]{
A parameter that controls printing box values; defaults to
@scheme[#t]. See @secref["mz:printing"] for more information.}
@scheme[#t]. See @secref["mz:print-box"] for more information.}
@defboolparam[print-vector-length on?]{
A parameter that controls printing vectors; defaults to
@scheme[#t]. See @secref["mz:printing"] for more information.}
@scheme[#t]. See @secref["mz:print-vector"] for more information.}
@defboolparam[print-hash-table on?]{
A parameter that controls printing hash tables; defaults to
@scheme[#f]. See @secref["mz:printing"] for more information.}
@scheme[#f]. See @secref["mz:print-hashtable"] for more information.}
@defboolparam[print-honu on?]{
@ -204,7 +204,7 @@ global port print handler is the same as the default write handler.}
@defparam[global-port-print-handler proc (any/c output-port? . -> . any)]{
A parameter that determines @idefterm{global port print handler},
A parameter that determines @deftech{global port print handler},
which is called by the default port print handler (see
@scheme[port-print-handler]) to @scheme[print] values into a port.
The default value uses the built-in printer (see

View File

@ -400,6 +400,25 @@
(arity-test symbol? 1 1)
(test #t keyword? '#:a)
(test #f keyword? 'a)
(test '#:apple string->keyword "apple")
(test "apple" keyword->string '#:apple)
(test #t keyword<? '#:a '#:b)
(test #f keyword<? '#:b '#:b)
(test #t keyword<? '#:b '#:bb)
(test #f keyword<? '#:b '#:)
(test #t keyword<? (string->keyword "a") (string->keyword "\uA0"))
(test #t keyword<? (string->keyword "a") (string->keyword "\uFF"))
(test #f keyword<? (string->keyword "\uA0") (string->keyword "a"))
(test #f keyword<? (string->keyword "\uFF") (string->keyword "a"))
(test #t keyword<? (string->keyword "\uA0") (string->keyword "\uFF"))
(test #f keyword<? (string->keyword "\uFF") (string->keyword "\uA0"))
(test #f keyword<? (string->keyword "\uA0") (string->keyword "\uA0"))
(arity-test keyword? 1 1)
(arity-test keyword<? 2 -1)
(define (char-tests)
(test #t eqv? '#\ #\Space)
(test #t eqv? #\space '#\Space)

View File

@ -67,7 +67,7 @@
x
(add1 'x)))))
(define test-param3 (make-parameter 'three list))
(define test-param4 (make-derived-parameter test-param3 box))
(define test-param4 (make-derived-parameter test-param3 box list))
(test 'one test-param1)
(test 'two test-param2)
@ -92,37 +92,37 @@
(test-param3 'other-three)
(test '(other-three) test-param3)
(test '(other-three) test-param4)
(test '((other-three)) test-param4)
(test-param3 'three)
(test '(three) test-param3)
(test '(three) test-param4)
(test '((three)) test-param4)
(parameterize ([test-param3 'yet-another-three])
(test '(yet-another-three) test-param3)
(test '(yet-another-three) test-param4)
(test '((yet-another-three)) test-param4)
(parameterize ([test-param3 'yet-another-three!!])
(test '(yet-another-three!!) test-param3)
(test '(yet-another-three!!) test-param4))
(test '((yet-another-three!!)) test-param4))
(test-param3 'more-three?)
(test '(more-three?) test-param3)
(test '(more-three?) test-param4)
(test '((more-three?)) test-param4)
(parameterize ([test-param3 'yet-another-three!!!])
(test '(yet-another-three!!!) test-param3)
(test '(yet-another-three!!!) test-param4)
(test '((yet-another-three!!!)) test-param4)
(test-param3 'more-three??)
(test '(more-three??) test-param3)
(test '(more-three??) test-param4))
(test '((more-three??)) test-param4))
(test '(more-three?) test-param3)
(test '(more-three?) test-param4))
(test '((more-three?)) test-param4))
(test '(three) test-param3)
(test '(three) test-param4)
(test '((three)) test-param4)
(test-param4 'other-three)
(test '(#&other-three) test-param3)
(test '(#&other-three) test-param4)
(test '((#&other-three)) test-param4)
(parameterize ([test-param4 'yet-another-three])
(test '(#&yet-another-three) test-param3)
(test '(#&yet-another-three) test-param4))
(test '((#&yet-another-three)) test-param4))
(let ([cd (make-derived-parameter current-directory values)])
(let ([cd (make-derived-parameter current-directory values values)])
(test (current-directory) cd)
(let* ([v (current-directory)]
[sub (path->directory-path (build-path v "sub"))])
@ -144,7 +144,8 @@
(let ([cd (make-derived-parameter current-directory
(lambda (x)
(set! l (cons x l))
"sub"))]
"sub")
values)]
[v (current-directory)])
(let ([sub (path->directory-path (build-path v "sub"))])
(parameterize ([cd "foo"])

View File

@ -2,7 +2,7 @@
@require["../web-server.ss"]
@title[#:tag "web-server-ref"]{Web Server Reference Manual}
@author{Jay McCarthy (jay\@plt-scheme.org)}
@author{Jay McCarthy (jay@"@"plt-scheme.org)}
The @web-server collection provides libraries that can be used to
develop Web applications in Scheme.

View File

@ -1,3 +1,7 @@
Version 370.5
Added keyword<?
Changed make-derived-parameter to accept a wrap procedure
Version 370.4
Added read-accept-infix-dot
Added make-derived-parameter

File diff suppressed because it is too large Load Diff

View File

@ -3812,6 +3812,7 @@ static int mark_param_data_MARK(void *p) {
gcMARK(d->key);
gcMARK(d->guard);
gcMARK(d->extract_guard);
gcMARK(d->defcell);
return
@ -3823,6 +3824,7 @@ static int mark_param_data_FIXUP(void *p) {
gcFIXUP(d->key);
gcFIXUP(d->guard);
gcFIXUP(d->extract_guard);
gcFIXUP(d->defcell);
return

View File

@ -1546,6 +1546,7 @@ mark_param_data {
gcMARK(d->key);
gcMARK(d->guard);
gcMARK(d->extract_guard);
gcMARK(d->defcell);
size:

View File

@ -13,7 +13,7 @@
#define USE_COMPILED_STARTUP 1
#define EXPECTED_PRIM_COUNT 904
#define EXPECTED_PRIM_COUNT 905
#ifdef MZSCHEME_SOMETHING_OMITTED
# undef USE_COMPILED_STARTUP

View File

@ -9,6 +9,6 @@
#define MZSCHEME_VERSION_MAJOR 370
#define MZSCHEME_VERSION_MINOR 4
#define MZSCHEME_VERSION_MINOR 5
#define MZSCHEME_VERSION "370.4" _MZ_SPECIAL_TAG
#define MZSCHEME_VERSION "370.5" _MZ_SPECIAL_TAG

View File

@ -64,6 +64,7 @@ static Scheme_Object *string_to_symbol_prim (int argc, Scheme_Object *argv[]);
static Scheme_Object *string_to_uninterned_symbol_prim (int argc, Scheme_Object *argv[]);
static Scheme_Object *symbol_to_string_prim (int argc, Scheme_Object *argv[]);
static Scheme_Object *keyword_p_prim (int argc, Scheme_Object *argv[]);
static Scheme_Object *keyword_lt (int argc, Scheme_Object *argv[]);
static Scheme_Object *string_to_keyword_prim (int argc, Scheme_Object *argv[]);
static Scheme_Object *keyword_to_string_prim (int argc, Scheme_Object *argv[]);
static Scheme_Object *gensym(int argc, Scheme_Object *argv[]);
@ -320,6 +321,11 @@ scheme_init_symbol (Scheme_Env *env)
"keyword?",
1, 1, 1),
env);
scheme_add_global_constant("keyword<?",
scheme_make_folding_prim(keyword_lt,
"keyword<?",
2, -1, 1),
env);
scheme_add_global_constant("string->keyword",
scheme_make_noncm_prim(string_to_keyword_prim,
"string->keyword",
@ -683,6 +689,55 @@ keyword_p_prim (int argc, Scheme_Object *argv[])
return SCHEME_KEYWORDP(argv[0]) ? scheme_true : scheme_false;
}
static Scheme_Object *keyword_lt (int argc, Scheme_Object *argv[])
{
Scheme_Object *prev = argv[0], *kw;
GC_CAN_IGNORE unsigned char *a, *b;
int i, al, bl, t;
if (!SCHEME_KEYWORDP(prev))
scheme_wrong_type("keyword<?", "keyword", 0, argc, argv);
for (i = 1; i < argc; i++) {
kw = argv[i];
if (!SCHEME_KEYWORDP(kw))
scheme_wrong_type("keyword<?", "keyword", i, argc, argv);
a = (unsigned char *)SCHEME_SYM_VAL(prev);
al = SCHEME_SYM_LEN(prev);
b = (unsigned char *)SCHEME_SYM_VAL(kw);
bl = SCHEME_SYM_LEN(kw);
t = ((al < bl) ? al : bl);
while (t--) {
if (*a < *b) {
al = 0;
bl = 1;
break;
} else if (*a > *b) {
al = bl = 0;
break;
} else {
a++;
b++;
}
}
a = b = NULL;
if (al >= bl) {
/* Check remaining types */
for (i++; i < argc; i++) {
if (!SCHEME_KEYWORDP(argv[i]))
scheme_wrong_type("keyword<?", "keyword", i, argc, argv);
}
return scheme_false;
}
prev = kw;
}
return scheme_true;
}
static Scheme_Object *
string_to_keyword_prim (int argc, Scheme_Object *argv[])
{

View File

@ -389,6 +389,7 @@ typedef struct {
short is_derived;
Scheme_Object *key;
Scheme_Object *guard;
Scheme_Object *extract_guard;
Scheme_Object *defcell;
} ParamData;
@ -649,7 +650,7 @@ void scheme_init_thread(Scheme_Env *env)
scheme_add_global_constant("make-derived-parameter",
scheme_make_prim_w_arity(make_derived_parameter,
"make-derived-parameter",
2, 2),
3, 3),
env);
scheme_add_global_constant("parameter-procedure=?",
scheme_make_prim_w_arity(parameter_procedure_eq,
@ -6113,7 +6114,14 @@ static Scheme_Object *do_param(void *_data, int argc, Scheme_Object *argv[])
argv2 = argv;
if (data->is_derived) {
return _scheme_tail_apply(data->key, argc, argv2);
if (!argc) {
Scheme_Object *v;
v = _scheme_apply(data->key, argc, argv2);
pos[0] = v;
return _scheme_tail_apply(data->extract_guard, 1, pos);
} else {
return _scheme_tail_apply(data->key, argc, argv2);
}
}
pos[0] = data->key;
@ -6161,6 +6169,7 @@ static Scheme_Object *make_derived_parameter(int argc, Scheme_Object **argv)
scheme_wrong_type("make-derived-parameter", "parameter", 0, argc, argv);
scheme_check_proc_arity("make-derived-parameter", 1, 1, argc, argv);
scheme_check_proc_arity("make-derived-parameter", 1, 2, argc, argv);
data = MALLOC_ONE_RT(ParamData);
#ifdef MZTAG_REQUIRED
@ -6169,6 +6178,7 @@ static Scheme_Object *make_derived_parameter(int argc, Scheme_Object **argv)
data->is_derived = 1;
data->key = argv[0];
data->guard = argv[1];
data->extract_guard = argv[2];
p = scheme_make_closed_prim_w_arity(do_param, (void *)data,
"parameter-procedure", 0, 1);

View File

@ -134,7 +134,7 @@ wxFrame::wxFrame // Constructor (for frame window)
windowClass = kToolbarWindowClass;
windowAttributes = kWindowNoAttributes;
} else {
windowClass = kUtilityWindowClass;
windowClass = kUtilityWindowClass; /* or kFloatingWindowClass? */
windowAttributes = kWindowCloseBoxAttribute;
if (!(cStyle & wxNO_RESIZE_BORDER)) {
windowAttributes |= kWindowFullZoomAttribute | kWindowResizableAttribute;
@ -1230,6 +1230,8 @@ wxFrame *wxFrame::GetSheetParent()
return NULL; /* No nested sheets */
else if (cStyle & wxNO_CAPTION)
return NULL; /* Sheets need a title bar */
else if (cStyle & wxFLOAT_FRAME)
return NULL; /* Don't use sheets on floating windows */
else
#endif
return this;