fix rename-in bug, and try to provide a better error message for attempting to use a run-time definition in a transformer expression
svn: r9819
This commit is contained in:
parent
b44c20d3c3
commit
a932a75708
|
@ -32,8 +32,8 @@
|
|||
((beginner-* *) (num num num ... -> num)
|
||||
"to compute the product of all of the input numbers")
|
||||
((beginner-/ /) (num num num ... -> num)
|
||||
"to divide the first by the second (and all following) number(s)"
|
||||
"None but the first number can be zero.")
|
||||
"to divide the first by the second (and all following) number(s);"
|
||||
" only the first number can be zero.")
|
||||
(max (real real ... -> real)
|
||||
"to determine the largest number")
|
||||
(min (real real ... -> real)
|
||||
|
@ -52,7 +52,7 @@
|
|||
"to compute the power of the first to the second number")
|
||||
(abs (real -> real)
|
||||
"to compute the absolute value of a real number")
|
||||
(sgn (real -> (union 1 |#i1.0| 0 |#i0.0| -1 |#i-1.0|))
|
||||
(sgn (real -> (union 1 #i1.0 0 #i0.0 -1 #i-1.0))
|
||||
"to compute the sign of a real number")
|
||||
|
||||
;; fancy numeric
|
||||
|
@ -80,21 +80,21 @@
|
|||
(cosh (num -> num)
|
||||
"to compute the hyperbolic cosine of a number")
|
||||
|
||||
(exact? (num -> bool)
|
||||
(exact? (num -> boolean)
|
||||
"to determine whether some number is exact")
|
||||
|
||||
(integer? (any -> bool)
|
||||
(integer? (any -> boolean)
|
||||
"to determine whether some value is an integer (exact or inexact)")
|
||||
|
||||
(zero? (number -> bool)
|
||||
(zero? (number -> boolean)
|
||||
"to determine if some value is zero or not")
|
||||
(positive? (number -> bool)
|
||||
(positive? (number -> boolean)
|
||||
"to determine if some value is strictly larger than zero")
|
||||
(negative? (number -> bool)
|
||||
(negative? (number -> boolean)
|
||||
"to determine if some value is strictly smaller than zero")
|
||||
(odd? (integer -> bool)
|
||||
(odd? (integer -> boolean)
|
||||
"to determine if some value is odd or not")
|
||||
(even? (integer -> bool)
|
||||
(even? (integer -> boolean)
|
||||
"to determine if some value is even or not")
|
||||
|
||||
(add1 (number -> number)
|
||||
|
@ -108,8 +108,8 @@
|
|||
(gcd (int int ... -> int)
|
||||
"to compute the greatest common divisior")
|
||||
|
||||
(rational? (any -> bool)
|
||||
"to determine whether some value is rational number")
|
||||
(rational? (any -> boolean)
|
||||
"to determine whether some value is a rational number")
|
||||
|
||||
(numerator (rat -> int)
|
||||
"to compute the numerator of a rational")
|
||||
|
@ -117,10 +117,10 @@
|
|||
(denominator (rat -> int)
|
||||
"to compute the denominator of a rational")
|
||||
|
||||
(inexact? (num -> bool)
|
||||
(inexact? (num -> boolean)
|
||||
"to determine whether some number is inexact")
|
||||
|
||||
(real? (any -> bool)
|
||||
(real? (any -> boolean)
|
||||
"to determine whether some value is a real number")
|
||||
|
||||
(floor (real -> int)
|
||||
|
@ -132,7 +132,7 @@
|
|||
(round (real -> int)
|
||||
"to round a real number to an integer (rounds to even to break ties)")
|
||||
|
||||
(complex? (any -> bool)
|
||||
(complex? (any -> boolean)
|
||||
"to determine whether some value is complex")
|
||||
|
||||
(make-polar (real real -> num)
|
||||
|
@ -300,7 +300,7 @@
|
|||
|
||||
("Characters"
|
||||
(char? (any -> boolean)
|
||||
" ")
|
||||
"to determine whether a value is a character")
|
||||
(char=? (char char ... -> boolean)
|
||||
"to determine whether two characters are equal")
|
||||
(char<? (char char ... -> boolean)
|
||||
|
@ -405,7 +405,7 @@
|
|||
" in a case-insensitive manner")
|
||||
|
||||
(string->symbol (string -> symbol)
|
||||
"to convert a string into symbol")
|
||||
"to convert a string into a symbol")
|
||||
(string->number (string -> (union number false))
|
||||
"to convert a string into a number,"
|
||||
" produce false if impossible")
|
||||
|
|
|
@ -496,19 +496,21 @@
|
|||
stx
|
||||
dup-id)))
|
||||
(let ([new+olds
|
||||
(apply
|
||||
append
|
||||
(map (lambda (orig-id bind-id)
|
||||
(let ([import (ormap (lambda (import)
|
||||
(and (free-identifier=? orig-id
|
||||
(import-local-id import))
|
||||
import))
|
||||
(let ([rename-imports (filter (lambda (import)
|
||||
(free-identifier=? orig-id
|
||||
(import-local-id import)))
|
||||
imports)])
|
||||
(unless import
|
||||
(unless (pair? rename-imports)
|
||||
(raise-syntax-error
|
||||
#f
|
||||
(format "identifier `~a' not included in nested require spec"
|
||||
(syntax-e orig-id))
|
||||
stx
|
||||
#'in))
|
||||
(map (lambda (import)
|
||||
(cons (make-import bind-id
|
||||
(import-src-sym import)
|
||||
(import-src-mod-path import)
|
||||
|
@ -516,8 +518,9 @@
|
|||
(import-req-mode import)
|
||||
(import-orig-mode import)
|
||||
bind-id)
|
||||
import)))
|
||||
orig-ids bind-ids)])
|
||||
import))
|
||||
rename-imports)))
|
||||
orig-ids bind-ids))])
|
||||
(let ([leftover-imports
|
||||
(let ([ht (make-immutable-hash
|
||||
(map (lambda (v) (cons (cdr v) #f))
|
||||
|
|
|
@ -95,7 +95,8 @@ some platforms:
|
|||
shares the focus with an active non-floating frame; when this style
|
||||
is combined with @scheme['no-caption], then showing the frame does
|
||||
not cause the keyboard focus to shift to the window, and under X,
|
||||
clicking the frame does not move the focus}
|
||||
clicking the frame does not move the focus; under Windows, a floating
|
||||
frame has no taskbar button}
|
||||
|
||||
@item{@scheme['metal] --- draws the frame with a brushed-metal
|
||||
background (Mac OS X); this style is ignored when
|
||||
|
|
|
@ -36,6 +36,11 @@ All @scheme[window<%>] classes accept the following named instantiation
|
|||
@index["global coordinates"]{Converts} local window coordinates to
|
||||
screen coordinates.
|
||||
|
||||
Under Mac OS X, the screen coordinates start with @math{(0, 0)} at the
|
||||
upper left of the menu bar. In contrast, @xmethod[top-level-window<%>
|
||||
move] considers @math{(0, 0)} to be below the menu bar. See also
|
||||
@scheme[get-display-left-top-inset].
|
||||
|
||||
}
|
||||
|
||||
@defmethod[(enable [enable? any/c])
|
||||
|
@ -456,7 +461,8 @@ Enqueues an event to repaint the window.
|
|||
(integer-in -10000 10000))]{
|
||||
|
||||
@index["global coordinates"]{Converts} global coordinates to window
|
||||
local coordinates.
|
||||
local coordinates. See also @scheme[client->screen] for information
|
||||
on screen coordinates.
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ evaluated. If it evaluates to @scheme[true], the result of the
|
|||
@scheme[expr] (often called the ``then'' @scheme[expr]). If the text
|
||||
@scheme[expr] evaluates to @scheme[false], the result of the
|
||||
@scheme[if] expression is the result of evaluating the third
|
||||
@scheme[expr]expression (known as the ``else'' @scheme[expr]). If the
|
||||
@scheme[expr] (known as the ``else'' @scheme[expr]). If the
|
||||
result of evaluating the test @scheme[expr] is neither @scheme[true]
|
||||
nor @scheme[false], it is an error.}
|
||||
|
||||
|
|
|
@ -127,17 +127,17 @@ steps:
|
|||
|
||||
Alternately, if the extension defines a module (i.e.,
|
||||
@cpp{scheme_module_name} returns a symbol), then place the shared
|
||||
object in a special directory so that it is detected by the module
|
||||
loader when @scheme[require] is used. The special directory is a
|
||||
platform-specific path that can be obtained by evaluating
|
||||
@scheme[(build-path "compiled" "native" (system-library-subpath))];
|
||||
see @scheme[load/use-compiled] for more information. For example, if
|
||||
the shared object's name is @filepath{example.dll}, then
|
||||
@scheme[(require "example.ss")] will be redirected to
|
||||
@filepath{example.dll} if the latter is placed in the sub-directory
|
||||
@scheme[(build-path "compiled" "native" (system-library-subpath))]
|
||||
and if @filepath{example.ss} does not exist or has an earlier
|
||||
timestamp.
|
||||
object in a special directory with a special name, so that it is
|
||||
detected by the module loader when @scheme[require] is used. The
|
||||
special directory is a platform-specific path that can be obtained by
|
||||
evaluating @scheme[(build-path "compiled" "native"
|
||||
(system-library-subpath))]; see @scheme[load/use-compiled] for more
|
||||
information. For example, if the shared object's name is
|
||||
@filepath{example_ss.dll}, then @scheme[(require "example.ss")] will
|
||||
be redirected to @filepath{example_ss.dll} if the latter is placed in
|
||||
the sub-directory @scheme[(build-path "compiled" "native"
|
||||
(system-library-subpath))] and if @filepath{example.ss} does not
|
||||
exist or has an earlier timestamp.
|
||||
|
||||
Note that @scheme[(load-extension _path)] within a @scheme[module]
|
||||
does @italic{not} introduce the extension's definitions into the
|
||||
|
|
|
@ -76,7 +76,7 @@ referenced, where a @tech{phase level} normally corresponds to an
|
|||
integer (but the special @deftech{label phase level} does not
|
||||
correspond to an integer). @tech{Phase level} 0 corresponds to the
|
||||
run time of the enclosing module (or the run time of top-level
|
||||
expression). Bindings in @tech{phase level} 0 constitute the
|
||||
expressions). Bindings in @tech{phase level} 0 constitute the
|
||||
@deftech{base environment}. @tech{Phase level} 1 corresponds to the
|
||||
time during which the enclosing module (or top-level expression) is
|
||||
expanded; bindings in @tech{phase level} 1 constitute the
|
||||
|
|
|
@ -5831,10 +5831,21 @@ static Scheme_Object *check_top(const char *when, Scheme_Object *form, Scheme_Co
|
|||
|
||||
if (env->genv->disallow_unbound) {
|
||||
if (bad || !scheme_lookup_in_table(env->genv->toplevel, (const char *)SCHEME_STX_SYM(c))) {
|
||||
scheme_wrong_syntax(when, NULL, c,
|
||||
(env->genv->phase
|
||||
? "unbound variable in module (transformer environment)"
|
||||
: "unbound variable in module"));
|
||||
GC_CAN_IGNORE const char *reason;
|
||||
if (env->genv->phase == 1) {
|
||||
reason = "unbound variable in module (transformer environment)";
|
||||
/* Check in the run-time environment */
|
||||
if (scheme_lookup_in_table(env->genv->template_env->toplevel, (const char *)SCHEME_STX_SYM(c))) {
|
||||
reason = ("unbound variable in module (in the transformer environment, which does"
|
||||
" not include the run-time definition)");
|
||||
} else if (env->genv->template_env->syntax
|
||||
&& scheme_lookup_in_table(env->genv->template_env->syntax, (const char *)SCHEME_STX_SYM(c))) {
|
||||
reason = ("unbound variable in module (in the transformer environment, which does"
|
||||
" not include the macro definition that is visible to run-time expressions)");
|
||||
}
|
||||
} else
|
||||
reason = "unbound variable in module";
|
||||
scheme_wrong_syntax(when, NULL, c, reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user