Compare commits

..

1243 Commits

Author SHA1 Message Date
Gustavo Massaccesi
4bcb657f08 fix copy of rator in finish_optimize_application3 2016-04-06 16:42:33 -03:00
Gustavo Massaccesi
a0a44d8d5f fix test 2016-04-06 16:42:25 -03:00
Michael McConville
596c571ab1 sizeof(char) is always 1
POSIX and ANSI specify that char is always 1 byte, and I'm almost
certain that no systems violate this. Regardless, the SIZEOF_CHAR macro
is never used.
2016-04-06 12:52:08 -06:00
Matthew Flatt
50ddbee87f change CRLF to LF in a Windows source file 2016-04-06 12:51:14 -06:00
Matthew Flatt
6a5cecee0a make (system-type 'machine) not depend on the secutiry guard
Allow `system-type` on non-Windows platforms to run `uname` to get
machine information, even in a sandbox or other contexts with a
limiting secutiry guard.
2016-04-06 12:51:14 -06:00
Jay McCarthy
782f5798a2 Fix issue 1286 2016-04-06 10:18:03 -04:00
Jay McCarthy
e4c0b75cae Indent 2016-04-06 10:09:16 -04:00
Jay McCarthy
cf70c4a241 Minimal optimizer safe-to-unsafe commit 2016-04-05 15:43:47 -04:00
ben
ee623160a4 add @tech links in input-port? and output-port? 2016-04-04 19:03:16 -04:00
Matthew Flatt
ffbdc4b61c fix related to continuations
Check that it works to apply a continuation that shares with
an enclosing continuation, where a runstack overflow happens
between the continuations.

Closes PR 15281
2016-04-04 11:19:53 -06:00
Gustavo Massaccesi
09313a0942 optimizer: clone K in (if (if x y #f) z K) reduction
in case K is a once used variable
2016-04-03 12:17:51 -03:00
Matthew Flatt
193178028d fix 'origin info in submodule expansion
While expanding a module, the root of module-relative references is a
fresh notion of "this module".

After expansion, "this module" is shifted to "an expanded module",
which is a global constant (for top-level modules). When an expanded
module is re-expanded, "an expanded module" is shifted to a fresh
"this module" during re-expansion, and so on.

One problem with this approach is that the shift from "this module" to
"an expanded module" isn't applied to syntax properties --- but
there's some extra trickery to make it work out by mutating "this
module" to make it look like "an expanded module".

Submodule expansion introduces an intermediate "parent of this module"
that wasn't currently covered by the extra trickery, so fix that.
2016-04-03 06:39:07 -06:00
Matthew Flatt
794061ba1d syntax/modcollapse: repair for submodule referenced from submodule
While cross-submodule references within a top-level module worked
right, submodule references across top-level modules did not work
right.
2016-04-01 15:25:50 -06:00
Matthew Flatt
161a9edb57 Windows: another PE update fix
Corrects problems with a4d569ae31 to unbreak MinGW-based builds.
2016-03-31 14:40:39 -06:00
Eric Dobson
236b17f625 Make compile-file always return a path as documented. 2016-03-31 09:28:10 -06:00
Matthew Flatt
ce15a558c7 Improve docs for raco ctool --c-mods 2016-03-30 21:02:30 -06:00
Matthew Flatt
4e57e160fb Inside: fix embedding example to use functions
In some embedding contexts, functions must be used instead of globals
for things like `scheme_current_thread` and `scheme_false`.
2016-03-30 21:02:30 -06:00
Vincent St-Amour
5c10eb13eb Revert "Attempt at adding ->im; will be reverted."
This reverts commit 3d987bf1fda9039fee9efafe21f9f78a0ef4feca.
2016-03-30 19:31:24 -05:00
Vincent St-Amour
7c458d10d7 Attempt at adding ->im; will be reverted.
`->i` already supports method contracts (for use wihin `object-contract`,
whose `->i` support is tested, but undocumented), which would make `->im`
possible.

Unfortunately, that support is very incomplete, missing support for using
`this` in contracts, making this `->im` (or the undocumented `->i` +
`object-contract` combo) basically useless.

Once/if that is added, then this commit would enable `->im`. Until then,
it's mostly useful for future reference (hence will be reverted).

In the meantime, it's possible to use `->i` within class/object contracts
with an explicit `this` argument, so nothing critical is lost, just a tiny
shortcut.
2016-03-30 19:31:23 -05:00
Leandro Facchinetti
05292b7e69 Improve Guide example on `flat-named-contract'
Previously, on the example, the function was not anonymous, so no
`tempN' would appear on the error message.

The fixed example makes use of `flat-named-contract' on an anonymous
function, which resembles the snippet above it and demonstrates the
purpose of `flat-named-contract' better.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
209f2db611 Don't use syntax parameters for method contracts.
Can be done with plain old functions.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
0aec872710 Don't export internal helpers.
Not used anywhere, including in pkgs, not documents, and should never have been exported.

And they're going away.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
077e6da2cb ->2 -> -> 2016-03-30 19:31:23 -05:00
Vincent St-Amour
62aa2b75bf Remove old implementation of ->. 2016-03-30 19:31:22 -05:00
Vincent St-Amour
427fe9340c Remove unused file. 2016-03-30 19:31:22 -05:00
Vincent St-Amour
585ca37c5b Add support for method contracts to ->2.
Should allow removal of old -> implementation.

Temporarily (almost) duplicates code, which will be fixed by removing the old ->.
2016-03-30 19:31:22 -05:00
Vincent St-Amour
3c074249a0 Make contract obligation tests more mobust. 2016-03-30 19:31:22 -05:00
Matthew Flatt
a4d569ae31 Windows: fix PE update for ".rsrc" not at end
Support creating executables when the base executable has
sections after ".rsrc", as long as there's room to add
a section to the section table. The new resource data is
written to the end of the file and vitrual space, but the
old space needs to be recorded as a section to keep them
contiguous.

MSVC 2015 puts a ".reloc" section after ".rsrc".
2016-03-30 16:27:58 -07:00
Matthew Flatt
153e19edc5 work around modulo failure on 64-bit Windows with MSVC 2008
Something about loading the MinGW-built "londdouble.dll" interferes
with fmod() in some cases --- but only on the first call?
2016-03-30 09:14:55 -06:00
Matthew Flatt
91eaf40b1f fix modulo and remainder related to most negative fixnum
Robby noticed the bug while looking for undefined behavior.
2016-03-30 09:14:54 -06:00
Robby Findler
bfd2404328 move late-neg projection warnings to the info level in the logger
because right now they are too noisy to be useful to anyone other
than contract system maintainers. Once the problems inside the contract
library itself is fixed, consider moving these back to warning
2016-03-30 09:29:50 -05:00
Ryan Culpepper
bcacb34110 syntax/parse: update tests for error reporting changes 2016-03-28 15:36:52 -04:00
Ryan Culpepper
fafa83a8a0 syntax/parse: reorder and compress error messages
Collect common types of frame (eg message, literal, etc) and
report together. For literals, symbols, and other atoms, compress
multiple entries to list. For example:
  before: "expected the identifier `X' or expected the identifier `Y'"
  now:    "expected one of these identifiers: `X' or `Y'"
2016-03-28 15:36:52 -04:00
Ryan Culpepper
a86931d5f9 syntax/parse: improve error reporting
Previously, syntax-parse would only report errors for one maximal
progress equivalence class (and generate a useless "and other errors
occurred" message). But approach to linearizing the tree of failures
behaved badly if there was too much branching even for a single progress
equiv class. So now it dumps all of the maximal failures into one pile
and tries to find shared "sync points" (frames and terms) to linearize
the failure tree.

In particular, this eliminates the "and other errors" message.

Also updated and improved comments.
2016-03-28 15:36:52 -04:00
Ryan Culpepper
25b2ec2e03 syntax/parse: fix bug that disabled opt, improve debugging 2016-03-28 15:36:52 -04:00
Robby Findler
cf595678f6 clean up logging of compiler/cm a little
use trace-printf for all of the printing (which logs to info@compiler/cm
already) and make all of the indentation printing use the nicer:

   |  |  |  |  |

style, and avoid creating the indentation strings unless they are actually used
2016-03-27 17:29:19 -05:00
Gustavo Massaccesi
ab546d662e Fix SCHEME_LISTP 2016-03-27 10:52:33 -03:00
Robby Findler
20e2e839cb add current-path->mode 2016-03-26 18:39:17 -05:00
Matthew Flatt
9a3e16edff fix problem with lifted bindings and the top level
Repair a mismatch between `syntax-local-lift-expression` and the
way that `compile` tries to avoid creating bindings while
compiling a top-level `define` form.

Closes #1284 and #1282
2016-03-26 16:00:51 -06:00
Matthew Flatt
f7182e7a5c GC on Linux: adjust handler to not abort on SI_KERNEL signals
The meaning of SI_KERNEL signals is not clear, but ignoring
them seems to let the process continue ok. (These signals show
up when running `typed-racket-test/main --int`.)
2016-03-26 13:58:34 -06:00
Matthew Flatt
92f4f8ad10 hints and updates on Git package sources in "Getting Started" docs 2016-03-26 13:58:33 -06:00
Sam Tobin-Hochstadt
b1ba506b52 Remove unused variable. 2016-03-26 14:33:43 -04:00
Gustavo Massaccesi
b9b71b20cc optimizer: add hidden list-pair? primitive
This is useful in the optimizer to track simultaneously the list? and pair?
types of an expression.
2016-03-25 19:17:10 -03:00
Gustavo Massaccesi
cff10bc5a8 extract types for branch when the tests is (not <expr>)
In some cases, complex variants of (if (not <expr>) tb fb) are not reduced.
Extract the type information of the tests in <expr> to use it in tb and fb.
2016-03-25 19:15:51 -03:00
Robby Findler
df157cdfd0 make cm compile all depdencies, not just the first one that needs it
This wouldn't matter if the dependencies recorded in the dep file were
exactly the same as the files that are actually loaded when a file is
required. But in the case of lazy-require (or, more accurately, when
the cm-accomplice library is used), the dependencies in the dep files
can include things that are, in some cases, not actually
required. This is no problem for raco setup, since it looks at all of
the files anyway, but it can cause a particularly bad interaction with
DrRacket's online compilation facility.

For example say there is some file, e.g., mzscheme/main that is
required lazily. So when you edit a file in DrRacket, it will traverse
the requires and lets say it sees that the of mzscheme/main's
dependencies need to be compiled.  So it will compile that dependency,
and then the ormap in this commit will be shortcircuited, which will
cause CM to stop looking at dependencies and decide to compile
mzscheme/main. So DrRacket will compile mzscheme/main, and then
whatever other pending compiles were going on and DrRacket's online
check syntax will complete, but because the lazy require doesn't
triggered, mzscheme/main isn't actually loaded during compilation.

Now you make another edit to the buffer and the same thing happens
except this time it gets past that first dependency of mzscheme/main
because there is now a .zo file for it from the last go 'round. But
say there isn't one for the second dependency. So it compiles that
file and compiles mzscheme/main now for a second time, but still
doesn't look at the third and fourth (etc) dependencies of
mzscheme/main.

Overall, this means that the second time you edit you file in
DrRacket, it should have been quick for the expansion portion to
finish because, after all, everything has been compiled and should
have been cached in .zo files. But because of the short circuiting, it
the .zo files weren't actually created and so your second edit is also
slow to come back.

After this commit, because of the ormap, the second edit will be
faster.

One worry with this commit is that it might change something that
could cause raco setup to go slower. To test that, I applied only this
change to a fresh checkout and did a full build. I then deleted all zo
files in racket/share/pkgs and timed 'raco setup -D' twice (four times
total). Here are the timings I get. The version of the code that uses
ormap:

  % ... delete .zo files ...
  % time raco setup -D
  real    9m2.354s
  user    37m5.176s
  sys     4m14.963s
  % ... delete .zo files ...
  % time raco setup -D
  real    9m2.421s
  user    37m43.793s
  sys     4m23.111s

The version of the code that uses the change in this commit:

  % ... delete .zo files ...
  % time raco setup -D
  real    8m58.852s
  user    36m51.369s
  sys     4m13.633s
  % ... delete .zo files ...
  % time raco setup -D
  real    8m53.980s
  user    37m40.262s
  sys     4m23.692s
2016-03-23 15:41:01 -05:00
Robby Findler
668e2ffbe2 fix error message 2016-03-23 15:41:01 -05:00
Robby Findler
790096529c report a reason when entering bootstrapping mode 2016-03-23 15:41:01 -05:00
Robby Findler
04b86b1d2f fix docs 2016-03-20 22:16:00 -05:00
Matthew Flatt
8b3ea4c842 avoid runstack issue with early GC 2016-03-19 08:33:06 -06:00
Matthew Flatt
0b7c8e0b2e fix GC registration of the initial parameterization 2016-03-19 08:33:06 -06:00
Vincent St-Amour
894873c2ff Fix arity checking for ->*.
Some functions were passing when they shouldn't have, only to fail when
the function is called.

Technically not backwards compatible, but should only affect functions
that were never called.
2016-03-18 12:36:05 -05:00
Matthew Flatt
b94e77a062 raco pkg migrate: fix cross-version locking 2016-03-17 17:01:57 -06:00
Matthew Flatt
b1ff73155f raco pkg update: avoid too-early normalization of clone URL
For example,

  raco pkg update --lookup gui-doc

should suggest uncloning "gui-lib", too, assuming they were
cloned in the usual way. Due to too-early normalization of
GitHub URLs, though, shared-clone detection was broken.
2016-03-17 17:01:57 -06:00
Matthew Flatt
e412a2d5a9 raco pkg {install,update,...}: add --dry-run 2016-03-17 17:01:57 -06:00
Robby Findler
040078ab01 fix some @racket[] references 2016-03-16 16:53:31 -05:00
Matthew Flatt
d27bf66f1a revise hash function for flonums and extflonums
As suggested by Tony.

Closes #1280
2016-03-15 05:28:04 -06:00
Matthew Flatt
182d648af6 improve some comments and an assertion 2016-03-14 18:17:10 -06:00
Matthew Flatt
2556733359 update certificates for openssl testing 2016-03-11 16:15:08 -07:00
Robby Findler
8bcb035693 add suggest/c 2016-03-11 11:42:14 -06:00
Matthew Flatt
33acbaeaf1 fix tests to avoid writing to the current or installation directory 2016-03-11 07:35:05 -07:00
Matthew Flatt
cbba4e75f9 fix inconsistency in cross-module inlined variable reference
The variable's position in its module was wrong, and
possibly the shape info. The demodularizer test exposed
the inconsistency.
2016-03-11 07:35:05 -07:00
Ian Harris
de0fbf2648 scalinger -> scaliger
This fixes racket/racket#757. Tests are included for both versions,
and documentation now only references the new, correctly named,
procedures.
2016-03-10 15:08:48 -06:00
Matthew Flatt
d22df41001 add support for preserved syntax properties
A syntax property is added as preserved or not. For backward
compatibility, the default for a 'paren-shape key is preserved, and
any other key's default is non-preserved.
2016-03-09 20:19:55 -07:00
Matthew Flatt
2213b61536 Windows (MinGW 64-bit): fix logging for place activity
Like 4d358d9914, but for 64-bit builds using MinGW.
2016-03-09 15:37:43 -07:00
Robby Findler
041cebc9c0 fix error message in ->i
in the case where the dependened on contract is a first-order contract, there
is a shortcircuit that incorrectly formulated the error message
2016-03-09 15:37:52 -06:00
Robby Findler
11927aea37 respond to Matthias's comments 2016-03-09 14:36:25 -06:00
Robby Findler
6a250fb089 remove obsolete git commands 2016-03-09 14:36:25 -06:00
Matthew Flatt
4d358d9914 Windows: fix logging for place activity
Logging tends to use "%Id" for `intptr_t` formatting,
at least with MSVC, but the log-string formatting function
didn't recognize the "%Id" pattern.
2016-03-09 13:14:38 -07:00
Robby Findler
1e72b96f9a added a section on unsafe operations 2016-03-09 12:22:48 -06:00
Robby Findler
0f73870a1b fix keyword argument order bug in ->i
the bug required all mandatory arguments to manifest

closes PR 15267
2016-03-08 21:50:15 -06:00
Matthew Flatt
26d28a28fe fix mismatch between optimizer snd run-time on "constant" detection
Cross-module inlining that pulls a variable reference across a
module boundary imposes a more struct requirement that run-time
"constant" detection is consistent with the optimizer's view of
"constant" within a module. So, make sure they're the same.
2016-03-08 16:37:28 -07:00
Vincent St-Amour
747185184b Don't store result arity of reduced-arity functions in a field.
Instead compute it on the fly.
2016-03-08 17:00:53 -06:00
Vincent St-Amour
9fdffc446a Further cleanup and robustness. 2016-03-08 16:56:06 -06:00
Vincent St-Amour
b5503151ac Split impersonator property into two.
To avoid future confusion.
2016-03-08 16:31:20 -06:00
Vincent St-Amour
d80a8244a2 Fix the fix in 686bc68.
Original fix did not break correctness, but did introduce too much wrapping.
2016-03-08 16:21:58 -06:00
Vincent St-Amour
686bc68b0a Fix object/c multiple-wrapping optimization.
A shortcut in the optimization made it drop all but the most recent contract.
2016-03-08 15:51:51 -06:00
Gustavo Massaccesi
509da64135 reduce (let ([x <expr>]) #f) => (begin <expr> #f)
Sometimes the optimizer removes all the references to a variable but it
doesn't detect that the variable is unused, so it keeps the definition.

Later, the sfs detects the unused variable so it marks it, but it doesn't
remove the let form.
2016-03-07 20:30:46 -03:00
Matthew Flatt
89f30c3c0d Guide: remove a broken example
Using `syntax` to capture local binding information in the current
phase doesn't work with the set-of-scopes expander. Although the
example could be adjust to use `(quote-syntax car #:local)`, it
seems like too much detail at that point in the explanation.
2016-03-07 16:23:25 -07:00
Matthew Flatt
ffbae2c090 fix resolve-path to always return a path (not a string)
Closes #1132
2016-03-07 15:34:57 -07:00
Vincent St-Amour
e90e587a91 Generalize procedure-result-arity to work on reduced-arity procedures. 2016-03-07 16:25:13 -06:00
Matthew Flatt
c1d44cedba allow cross-module inlining to introduce a variable reference
Formerly, cross-module inlining would not work for a function like

  (define (f x)
    (if .... .... (slow x)))

unless `slow` was also inlined into `f`. This commit changes
cross-module inlining so that it allows a call to `f` to be replaced
with an expression that references other module-level bindings (that
are not primitives), such as `slow`.

Adjusting the inlining rules can always make some program worse. In
this case, a hueristic about whether to export an optimized or
unoptimized variant of a fnuciton for inlining tends to collide with
the adjusted inlining rule, so this commit tweaks that heuristic, too.
2016-03-07 07:13:14 -07:00
Matthew Flatt
7e2195fdba fix optimizer bug
Fix a bug introduced by one of the last few bytecode-compiler
changes.
2016-03-05 13:10:21 -07:00
Matthew Flatt
3d484cf560 add an errortrace benchmarking mode 2016-03-05 05:51:12 -07:00
Matthew Flatt
bfb14637a6 fix validator and JIT to match with-continuation-mark compilation
Compiler changes allow the body of a `with-continuation-mark`
form to produce an unboxed value, but the validator and JIT
were not updated for that change.
2016-03-05 05:51:06 -07:00
Matthew Flatt
6c7a9ae03a sync "base" version 2016-03-05 05:17:38 -07:00
Matthew Flatt
79ad86d891 fix optimization related to with-continuation-mark
Fix mistake intoduced in 5904acc69a adding `with-continuation-mark`
to single_valued_noncm_expression().
2016-03-05 05:17:37 -07:00
Matthew Flatt
2bfb851ccc optimizer: generalize intraprocedural type tracking
Enable the optimizer to figure to figure out that a loop
argument is always a real number, for example, in much the
same way that it can detect fixnums and flonums for unboxing.

Unboxing information was only needed at the resolve level,
but `real?` information is useful only to the optimizer, so
the generalization enables the optimizer to reach
approximations of type information earlier (e.g., among
a subset of a function's arguments).
2016-03-05 05:17:37 -07:00
Matthew Flatt
8ec35de0b2 generalize predicate tracking to support numerics 2016-03-05 05:17:37 -07:00
Matthew Flatt
1c8881dbef optimizer: convert (let ([x M]) x) to (begin0 M #f)
For simple enough M, `(let ([x M]) x)` is already converted
to just M, but add a conversion for other forms that gets rid
of the binding while preserving non-tailness.
2016-03-05 05:17:37 -07:00
Matthew Flatt
254dac4625 optimizer: drop redundant with-continuation-marks
Simplify `(wcm <k1> <v1> (wcm <k1> <v2> <e>))` to
`(begin <v1> (wcm <k1> <v2> <e>))` for a simple enough <k1>.
A variable simple enough, so this is useful for improving
errortrace output.
2016-03-05 05:17:37 -07:00
Matthew Flatt
7e4d7dfdee repairs and clarification for raco exe docs 2016-03-05 05:17:37 -07:00
Sam Caldwell
8039a759f4 Fix typo in package docs 2016-03-03 15:33:30 -05:00
Robby Findler
b52a4b3318 make struct-out leave behind a disappeared use for its argument
closes PR 15263
2016-03-03 03:38:53 -06:00
Sam Tobin-Hochstadt
8eadc197a9 Use syntax-local-introduce to fix arrows in match. 2016-03-02 18:03:46 -05:00
Matthew Flatt
9b4f830268 improve hashing on structs, especially prefabs
Use the structure-type name, in addition to the structure
content. Including the name is espeically useful for
distinguishing prefabs structs that differ in the prefab
name.
2016-03-02 10:42:57 -07:00
Matthew Flatt
97d951af54 improve equal-hash-code on interned symbols
Compute an `equal?` hash code for `read`able values that
is a constant, at least for a given version of Racket. Only
(interned) symbols failed to have that property before.
2016-03-02 10:31:34 -07:00
Matthew Flatt
3617e1f81e xform: add XFORM_ASSERT_NO_CONVERSION
A `XFORM_ASSERT_NO_CONVERSION` declaration makes xform check that
an procedure that is intended to avoid instrumentation actually
does avoid it.
2016-03-02 09:48:24 -07:00
Sam Tobin-Hochstadt
f2e34fedea Avoid intermittent timeout with longer time limit. 2016-03-01 18:52:46 -05:00
Robby Findler
753def919b cooperate better with check syntax for variables generated by #:pre and #:post in ->i
closes PR 15256
2016-03-01 00:56:34 -06:00
Asumu Takikawa
f8a4982bae Add doc category for syntax collection docs 2016-02-29 18:07:03 -05:00
Sam Tobin-Hochstadt
e94081c5aa Initialize variables to avoid compiler warnings. 2016-02-29 12:21:55 -05:00
Matthew Flatt
59f3f82460 GC: fix initialization of mark tables for places
Fixes a mistake in 7d90b27524.
2016-02-29 06:08:29 -07:00
Matthew Flatt
3b25e22dd6 add XFORM_NONGCING_NONALIASING annotation
An `XFORM_NONGCING_NONALIASING` function doesn't trigger a GC, and
when it is given an argument that is an address of a local variable,
it fills in that address and doesn't leak it. This annotation allows
the xform transformation (to support precise GC) avoid some work for
some hash-iteration functions.
2016-02-28 17:19:34 -07:00
Matthew Flatt
8a59534669 adjust unsafe hash-table iteration implementation
Restore exports available to embedding, extending, and FFI
applications, and shift boundary back between hash-table
implementation details (in "hash.c") and Racket interface
(in "list.c").
2016-02-28 16:23:52 -07:00
Matthew Flatt
3ac2c69f6c add explanations for primitive-property flags 2016-02-28 15:14:53 -07:00
Matthew Flatt
428d02c78c enumerate some guidelines for changing the core implementation 2016-02-28 15:14:53 -07:00
Gustavo Massaccesi
828335a879 optimizer: split optimize_info_lookup
With the old representation of local variables, optimize_info_lookup
had to search the stack for the frame with the information about the
variable. This was complicated so it has many flags to be used in
different situations and extract different kind of information.

With the new representation this process is easier, so it's possible
to split the function into a few smaller functions with an easier
control flow.

In particular, this is useful to avoid marking a variable as used
inside a lambda when the reference in immediately reduced to a
constant using the type information.
2016-02-28 17:59:34 -03:00
Gustavo Massaccesi
5ef3a53002 special cases for small hashes in unsafe_scheme_hash_tree_iterate_*
The iterator saves the return points in a list. For small immutable hashes,
encode the values in the list in the bits of a fixnum to avoid allocations.
2016-02-28 15:34:16 -03:00
Matthew Flatt
7d90b27524 add support for defining GC traversals through ffi/unsafe
Expose tagged allocation and a function that interprets a description
of tagged shapes. As a furst cut, the description can only specify
constant offsets for pointers within the object, but future extensions
are possible.
2016-02-27 20:33:50 -07:00
Matthew Flatt
e4f0b69b72 fix chaperone-of? and property-only impersonators
Closes #1263
2016-02-27 19:50:54 -06:00
Matthew Flatt
032b1871d1 bytecode compiler: break up and improve comments at final let step 2016-02-27 18:13:14 -06:00
Matthew Flatt
d70616ec65 raco exe: fix 32-bit ELF updating
Closes #1264
2016-02-27 18:12:57 -06:00
Lehi Toskin
bc99eb0eef Fix grammar mistake 2016-02-26 23:54:15 -05:00
ben
f83cec1b04 fix (combinations n k) bug
Now using Gosper's hack to enumerate length k binary numbers.
New implementation is shorter & a little more obviously correct
(if you trust the bit-twiddling)
https://en.wikipedia.org/wiki/Combinatorial_number_system#Applications
2016-02-26 17:59:59 -05:00
Ryan Culpepper
301b47df2c saved-errno tests for windows 2016-02-26 17:57:56 -05:00
Ryan Culpepper
5aff9925ad add tests for saved-errno 2016-02-26 17:57:56 -05:00
Ryan Culpepper
c1664610e1 update version number for ffi change 2016-02-26 17:57:56 -05:00
Ryan Culpepper
2cc4b66184 add saved-errno setter variant
This makes it easier to create mock foreign functions
(or wrap existing ones) for testing.
2016-02-26 17:57:56 -05:00
ben
f2bef56a2e margin-note to say #:auto-value is evaluated once 2016-02-26 17:47:54 -05:00
Matthew Flatt
81b5d74ed6 fix mishandling of the continuation-mark depth
When a chaperone-wrapped function leads to a slow-path tail
call, the continuation-mark depth can be made too deep when
resolving the slow tail call.

Closes #1265
2016-02-26 16:39:05 -05:00
Robby Findler
7151d6d034 add missing history annotation 2016-02-26 08:10:42 -06:00
Robby Findler
990555cd8d fix arity checking for -> contract with ellipses
closes #1266
2016-02-26 08:10:42 -06:00
Matthew Flatt
d9971292a6 make compiled-expression-recompile work on top-level forms
Mostly just fill in some corners, but also fix a bug with lifted
functions that accepted a boxed argument and have less than three
arguments total.

The `tests/racket/test` test suite now passes with
`PLT_RECOMPILE_COMPILE` set --- except for the "optimize.rktl" test
suite, wher emore work is needed to ensure that optimizations
don't get lost.
2016-02-26 06:03:11 -05:00
Matthew Flatt
f0500c64d3 Windows: always get errno from "MSVCRT.dll" 2016-02-26 06:03:10 -05:00
Stephen Chang
15f47ef62e fix context of macro-generated default-in-hash- internal ids 2016-02-25 23:40:30 -05:00
Vincent St-Amour
f71474baca Add missing "not".
Found by Greg Hendershott back in September.
2016-02-25 16:09:53 -06:00
John Clements
a45330815d add note about sorting with NaN 2016-02-25 15:51:04 -06:00
Gustavo Massaccesi
5a378ca883 More reductions for (if t v v) and (eq? v v)
Reduce
(eq? v v) ==> #t
(if t v v) ==> (begin t v)
(if v v #f) ==> v
when v is a local or a top level variable.

Previously, the last two reductions were used only
with local variables.

Also, move the (if x #t #f) ==> (not x) reduction
after branch optimization.
2016-02-24 21:56:04 -03:00
Gustavo Massaccesi
6cd225e073 avoid compiler warning 2016-02-24 21:55:05 -03:00
Stephen Chang
3e29101e48 properly throw exn when in-hash seq input is wrong type of hash
- refactors define-in-hash-sequences
- closes #1256
2016-02-24 14:43:44 -05:00
ben
c15a357417 add #:exact-columns option to table-display
Least invasive change I could think of to solve #1252.
When `--full-checksum` is set, never truncates the checksum column.

Examples:
```
$ raco pkg show typed-racket
Installation-wide:
 Package       Checksum               Source
 typed-racket  32d0a97058b797a8ef...  clone...=typed-racket
User-specific for installation "development":
 [none]
```

```
$ raco pkg show --full-checksum typed-racket
Installation-wide:
 Package       Checksum                                  Source
 typed-racket  32d0a97058b797a8efe794336dde069156b98630  clone...=typed-racket
User-specific for installation "development":
 [none]
```

```
$ raco pkg show --long typed-racket
Installation-wide:
 Package         Checksum                                    Source
 typed-racket    32d0a97058b797a8efe794336dde069156b98630    (clone "/Users/ben/code/racket/fork/extra-pkgs/typed-racket/typed-racket" "git://github.com/racket/typed-racket/?path=typed-racket")
User-specific for installation "development":
 [none]
```
2016-02-23 19:23:08 -05:00
Asumu Takikawa
98ba277948 Normalize path to have a trailing slash
The regexp-based helper did not work correctly for
a path like the one in the following use:

  raco pkg install -n foo /
2016-02-22 21:53:22 -05:00
Matthew Flatt
9494216a9b fix a problem with hash-remove
When a key is removed at a level that other only has a collision
table, the HAMT representation was not adjusted properly by
eliminating the layer. As aresult, table comparison via
`equal?` could fail. The problem could show up with hash tables
used to represent scope sets, where an internal "subset?" test
could fail and produce an incorrect binding resolution.
2016-02-22 15:24:17 -07:00
Jay McCarthy
619ef41f7d If full-checksum, table can be as long as necessary 2016-02-22 09:32:06 -05:00
Matthew Flatt
c0bb539af7 make an optimizer function private 2016-02-21 08:07:27 -07:00
Matthew Flatt
d050bd79d9 revert an optimizer transformation
The transformation from

 (begin (let <bindings> (begin <e1> ...)) <e2> ...)

to

 (let <bindings> (begin <e1> ... <e2> ...))

makes things look simpler and might help the optimizer a little. But
it also tends to make the run-time stack deeper, and that slows some
programs a small but measurable amount.

A better solution would be to keep the transformation but add another
pass that moves expressions out of a `let`.
2016-02-21 08:07:26 -07:00
Matthew Flatt
537292ef45 optimizer: fix calculation of used local variables (again)
Mostly reverts a52a08146a, then repairs the problem in a way
that does not add variables unnecessarily to nested closures.
2016-02-21 08:07:26 -07:00
Gustavo Massaccesi
01458e22fa Don't burn fuel when a single use function is inlined
Since this operation only moves the code and doesn't make the final
bytecode bigger, it's not necessary to decrease the fuel and then it
is available for further inlining.
2016-02-21 08:07:26 -07:00
Matthew Flatt
0619af508b merge unresolver implementations
Merge the original implementation for cross-module inlining
with the new one for recompiling.
2016-02-21 08:07:26 -07:00
Robby Findler
be628e21a6 noticed some @tech{} cleanup opportunities and added some examples
for the random generation functionality
2016-02-21 08:27:21 -06:00
Robby Findler
c4ebd771bb add some @tech{}s 2016-02-20 19:23:18 -06:00
Matthew Flatt
e32e1383fe fix test that was supposed to be Windows-specific 2016-02-19 18:58:49 -07:00
Matthew Flatt
0606228959 add comments 2016-02-19 18:57:57 -07:00
Matthew Flatt
5f7d0317e8 improve names for some internal structures and functions
Changes:

    ...unclosed_procedure... -> lambda
    ...procedure_compilation... -> lambda
    ..._Closure_Data -> ..._Lambda
    `code` field in Scheme_Lambda -> `body` field
    ..._CLOSURE_DATA_FLAGS -> ..._LAMBDA_FLAGS
    CLOS_... -> LAMBDA_... (e.g., CLOS_IS_METHOD)
    SCHEME_COMPILED_CLOS_CODE -> SCHEME_CLOSURE_CODE
    SCHEME_COMPILED_CLOS_ENV -> SCHEME_CLOSURE_ENV

    ..._compiled_... -> ..._ir_... (where "ir" is "intermediate
                                    representation")
    ..._Compiled_... -> ..._IR_... (e.g., Scheme_Compiled_Let_Value)
    Scheme_Let_Header -> Scheme_IR_Let_Header (since it's IR-only)
    Closure_Info -> Scheme_IR_Lambda_Info

    make_syntax_compiler -> make_primitive_syntax
    scheme_syntax_compiler_type -> scheme_primitive_syntax_type
    ..._syntax -> ..._compiler (e.g., lambda_syntax -> lambda_compile)

    scheme_..._prim -> scheme_..._proc
    scheme_values_func -> scheme_values_proc

Closes #1249
2016-02-19 18:57:57 -07:00
Matthew Flatt
37a8031803 windows: fix overflow handling in seconds->date 2016-02-19 18:57:06 -07:00
Matthew Flatt
a52a08146a optimizer: fix calculation used local variables
The calculation of used variables in a possibly unused function did
not work right when the function is referenced by a more deeply
nested function that itself is unused. The extra uses triggered by
more nested uses need to be registered as tentative in the more nested
frame, not in the outer frame.

Closes #1247
2016-02-18 21:21:27 -07:00
Matthew Flatt
2b4bfcf854 raco setup: repair doc build
Fix mistake in 1005701b8e.
2016-02-18 16:26:15 -07:00
Sam Tobin-Hochstadt
f7c55a8bc6 Make explicit that this simplifies using the FS. 2016-02-18 18:07:18 -05:00
Matthew Flatt
a0f7b618f7 fix failure in cross-module inliner
Recent compiler changes expose a bug in the cross-module
inliner when it turns out to be unable to inline a candidate.
2016-02-18 14:09:35 -07:00
Matthew Flatt
1005701b8e raco setup: defend against bad scribblings in "info.rkt"
Closes #1142
2016-02-18 13:45:53 -07:00
Matthew Flatt
6a78beecdf raco setup: more consistently defend against bad "info.rkt"
Closes #1244
2016-02-18 13:28:19 -07:00
Matthew Flatt
0133954c84 avoid a made-up OS error in rename-file-or-directory
On Unix and OS X, the check to avoid replacing an existing
file or directory is made by Racket, rather than the OS,
so don't claim a system error if the operation fails for
that reason.

Also, update the docs to clarify that the check is not
atomic with the move.

Closes issue #1158
2016-02-18 13:12:55 -07:00
Sam Tobin-Hochstadt
79fcdf4201 Remove unused variables to eliminate compiler warnings. 2016-02-18 12:57:52 -05:00
Sam Tobin-Hochstadt
b92ef72c8c fix typo 2016-02-18 10:49:24 -05:00
Matthew Flatt
db04b47cdb add stack-overflow check in compiler's letrec-check pass
Closes PR 15247
2016-02-17 06:16:31 -07:00
Matthew Flatt
0c38da0ee2 change intermediate representation for the bytecode optimizer
Correct the second-biggest design flaw in the bytecode optimizer:
instead of using a de Bruijn-like representation of variable
references in the optimizer pass, use variable objects.

This change is intended to address limitations on programs like the
one in

 http://bugs.racket-lang.org/query/?cmd=view&pr=15244

where the optimizer could not perform a straightforward-seeming
transformation due to the constraints of its representation.

Besides handling the bug-report example better, there are other minor
optimization improvements as a side effect of refactoring the code. To
simplify the optimizer's implementation (e.g., eliminate code that I
didn't want to convert) and also preserve success for optimizer tests,
the optimizer ended up getting a little better at flattening and
eliminating `let` forms and `begin`--`let` combinations.

Overall, the optimizer tests in "optimize.rktl" pass, which helps
ensure that no optimizations were lost. I had to modify just a few
tests:

 * The test at line 2139 didn't actually check against reordering as
   intended, but was instead checking that the bug-report limitation
   was intact (and now it's not).

 * The tests around 3095 got extra `p` references, because the
   optimizer is now able to eliminate an unused `let` around the
   second case, but it still doesn't discover the unusedness of `p` in
   the first case soon enough to eliminate the `let`. The extra
   references prevent eliminating the `let` in both case, since that's
   not the point of the tests.

Thanks to Gustavo for taking a close look at the changes.

 LocalWords:  pkgs rkt
2016-02-16 21:05:15 -07:00
Jay McCarthy
bfc2611ff2 Attempt to detect if a sub-test file failed 2016-02-16 15:06:07 -05:00
Robby Findler
f93e0df781 explain shortcoming in define-opt/c
related to #1238
2016-02-15 14:28:16 -06:00
Vincent St-Amour
068af526de Fix test that is broken without space-efficient wrappers. 2016-02-12 13:23:21 -06:00
Vincent St-Amour
0961cf9412 Fix test failures for new double-wrapping tests.
Everything passes.
2016-02-12 13:23:21 -06:00
Vincent St-Amour
6ee45a156d Extend test suite to try double-wrapping everywhere.
To provide additional testing for space-efficient wrappers.

Currently has some failures.
2016-02-12 13:23:21 -06:00
ben
0e1f17b520 option to limit prefix in ~a,~s,~v,~e,~.a,~.s,~.v 2016-02-11 19:51:47 -05:00
Robby Findler
71f338430b clean up some confusion about the timing of errors
specifically, always wait for the neg party to come in
before signalling any errors
2016-02-10 17:36:37 -06:00
Vincent St-Amour
640895645f Fix contract-stronger? to work with late-neg projections. 2016-02-10 15:40:59 -06:00
Stephen Chang
e6a0caa147 Use better regexp for string->url input contract.
Closes #929
2016-02-10 12:54:03 -05:00
Stephen Chang
5ffe007f5c Add faster non-generic in-*-set sequences
closes #1217
2016-02-10 11:24:38 -05:00
Matthew Flatt
5b37bac183 xform: another signbit intrinsic 2016-02-10 06:07:20 -07:00
Matthew Flatt
f21aa8661b xform: more signbit variants 2016-02-09 08:21:41 -07:00
Matthew Flatt
1cffde1df8 fix parallel raco setup failure on dependency cycles
The failure should be an individual module failure, instead of
terminating `raco setup`.
2016-02-09 08:01:42 -07:00
Matthew Flatt
50db01bf2c bump version 2016-02-09 07:38:28 -07:00
Matthew Flatt
c1b9cd6828 xform: recognize some floating-point intrinsics
GCC v6.0 apparently adds `__builtin_isnan`. Guess at some other future
additions, while we're at it.

Closes #1222
2016-02-09 07:38:28 -07:00
Matthew Flatt
18990701a6 xform: better reporting for disallowed call 2016-02-09 07:38:28 -07:00
Matthew Flatt
9a8fd2912f avoid some C undefined behavior
Found with `-fsanitize=undefined`. The only changes that are potentially
bug repairs involve some abuses of pointers that can end up misaligned
(which is not an x86 issue, but might be on other platforms). Most of
the changes involve casting a signed integer to unsigned, which
effectively requests the usual two's complement behavior.

Some undefined behavior still present:

  * floating-point operations that can divide by zero or coercions
    from `double` to `float` that can fail;

  * offset calculations such as `&SCHEME_CDR((Scheme_Object *)0x0)`,
    which are supposed to be written with `offsetof`, but using
    a NULL address composes better with macros.

  * unaligned operations in the JIT for x86 (which are ok, because
    they're platform-specific).

Hints for using `-fsanitize=undefined`:

 * Add `-fsanitize=undefined` to both CPPFLAGS and LDFLAGS

 * Add `-fno-sanitize=alignment -fno-sanitize=null` to CPPFLAGS to
   disable those checks.

 * Add `-DSTACK_SAFETY_MARGIN=200000` to CPPFLAGS to avoid stack
   overflow due to large frames.

 * Use `--enable-noopt` so that the JIT compiles.
2016-02-09 07:38:28 -07:00
Stephen Chang
06c15dbf89 add tests for non-generic in-hash- sequences 2016-02-08 15:01:08 -05:00
Matthew Flatt
91d85a1fb5 doc clarification on pkg catalog protocol 2016-02-07 13:34:47 -07:00
Matthew Flatt
463c32c61d make alarm-evt tests more likely to pass
The `alarm-evt` tests are inherently racy, since they depend on
the scheduler polling quickly enough. The old time values were
close enough that a test failure is particularly likely on
Windows, where the clock resolution is around 16ms. To reduce
failures, make the time differents much bigger.

Closes issue #1232
2016-02-07 13:34:47 -07:00
Matthew Flatt
35acfab903 fix internal array size on module redeclaration
If a module is redeclared with more phases than before,
expand the `running` array.
2016-02-07 13:34:47 -07:00
Gustavo Massaccesi
7982a59a1d Fix eq? reduction 2016-02-07 16:49:06 -03:00
Stephen Chang
048c4b4a73 add unsafe-hash-iterate ops; add specific hash table sequences
- refactor for.rkt: abstract in-hash- definitions
- refactor hash_table_next in hash.c
- move hash fn headers to schpriv.h

closes #1229
2016-02-05 14:30:34 -05:00
Gustavo Massaccesi
89e00da75e Swap arguments of optimize_get_predicate 2016-02-04 15:42:09 -03:00
Gustavo Massaccesi
9cb0637f95 Don't add type information twice
In some cases, for example while using no_types, the optimizer can try to
add again the type information of a local variable. This creates unnecessary
internal storage to save the repeated information.
2016-02-04 15:41:51 -03:00
Gustavo Massaccesi
65838bd3c8 Try to collapse references in a branch using the type information of the other branch
A reference to a local may be reduced in a branch to a constant, while it's unchanged in the
other because the optimizer has different type information for each branch. Try to use the
type information of the other branch to see if both branches are actually equivalent.

For example, (if (null? x) x x) is first reduced to (if (null? x) null x) using the type
information of the #t branch. But both branches are equivalent so they can be
reduced to (begin (null? x) x) and then to just x.
2016-02-04 15:41:32 -03:00
Gustavo Massaccesi
3f246dd857 Use a sub_info to optimize branches
Create a new sub_info for each branch to hold the type information of the local variables, instead of handling the types manually.
2016-02-04 15:41:15 -03:00
Matthew Flatt
5031897c51 try again to clarify atomic mode's unsafety
Closes issue #1228
2016-02-03 10:51:17 -07:00
Gustavo Massaccesi
1b54b1c040 optimizer: reductions for expressions with fixnum
For example, reduce:

(= <fx> <fx>) ==> (unsafe-fx= <fx> <fx>)
(fxmax <fx> <fx>) ==> (unsafe-fxmax <fx> <fx>)
(zero? <fx>) ==> (unsafe-fx= <fx> 0)
(bitwise-not <fx>) ==> (unsafe-fxnot <fx>)
2016-02-03 13:11:59 -03:00
Gustavo Massaccesi
bbbe99db43 optimizer: use type predicates to calculate local types
The functions expr_implies_predicate was very similar to
expr_produces_local_type, and slighty more general.
Merging them, is possible to use the type information
is expressions where the optimizer used only the
local types that were visible at the definition.

For example, this is useful in this expression to
transform bitwise-xor to it's unsafe version.

(lambda (x)
  (when (fixnum? x)
    (bitwise-xor x #xff)))
2016-02-03 13:11:45 -03:00
Jay McCarthy
ced25315ac Merge pull request #1231 from simmone/xml
not sort xml attributes
2016-02-03 11:07:02 -05:00
Matthew Flatt
2ee721f351 clean up GC implementation
Try to make the GC implementation more readable by reordering
and reorganizing the code.
2016-02-03 06:59:05 -07:00
Chen Xiao
19c00dc91c xml attributes not sort 2016-02-03 16:52:15 +08:00
Leif Andersen
4c4874c26d Documentation for scheme_register_process_global is fixed.
It was previously both incomplete, and incorrect.
2016-02-02 17:55:06 -07:00
Gustavo Massaccesi
65eaff3a03 Avoid compiler warnings 2016-02-02 19:06:31 -03:00
Gustavo Massaccesi
2fb1d4f45d Fix typo 2016-02-02 19:06:23 -03:00
ben
7ea277e420 typo: numerator -> denominator 2016-01-30 20:40:55 -05:00
Matthew Flatt
4e7bb3071a OS X: support Unix-style install
Support "Unix-style" (as opposed to "in-place") installation for
OS X, which is mostly a matter of putting ".app" files in the
right place and correcting relative references.

Intended to fix #1180
2016-01-29 22:01:57 -07:00
Robby Findler
7a11d09134 fix tests 2016-01-29 06:14:39 -06:00
Robby Findler
ec4bd288bf add support for ... to -> contracts to indicate repeated arguments
also fix order of evaluation for ->
2016-01-28 15:34:57 -06:00
Robby Findler
856e60fe51 add *list/c 2016-01-28 10:12:24 -06:00
Robby Findler
5214b06a86 use chaperone-of? instead of eq? to find list?, null?, and pair? 2016-01-28 10:12:23 -06:00
Benjamin Greenman
70cefc60bc Merge pull request #1214 from bennn/date-docs
margin-note for gregor & srfi-19
2016-01-28 01:09:40 -05:00
ben
30f045c677 margin-note for gregor & srfi-19 2016-01-27 23:02:35 -05:00
Vincent St-Amour
fe900e0d7a More cons lifting. 2016-01-27 14:41:00 -06:00
Vincent St-Amour
870b8d4137 More cons lifting.
Could not lift all of those completely.
2016-01-27 14:40:59 -06:00
Vincent St-Amour
5dc368585f Lift some blame and neg-party consing.
To avoid doing it every time the contract is checked.
2016-01-27 14:40:59 -06:00
Stephen Chang
9419778b1e add some tests for impersonated hash tables 2016-01-27 14:51:18 -05:00
Robby Findler
c34d37d265 break list contracts out into their own file
which required moving and/c (and integer-in) out of
misc.rkt files to avoid cyclic dependencies
2016-01-27 08:16:39 -06:00
Stephen Chang
86a9c2e493 fix return type of hash_table_index 2016-01-26 10:26:51 -05:00
Stephen Chang
e8d34dd156 add hash-iterate-pair and hash-iterate-key+value
- cuts in-hash and in-hash-pairs iteration time in half
- refactor hash_table_index
- add tests
- bump version

closes #1224
2016-01-26 10:14:40 -05:00
Robby Findler
7563f5a812 refresh the popular keys 2016-01-25 23:55:41 -06:00
Robby Findler
6723c64487 dont use unsafe-{chaperone,impersonator}-procedure when {chaperone,impersonator}-procedure* might be involved 2016-01-25 23:54:12 -06:00
Vincent St-Amour
39a1b81b6a Tests for option contract instrumentation. 2016-01-25 16:36:04 -06:00
Gustavo Massaccesi
5644b901d0 Avoid unnecessary closures in arrow-val-first
This code uses call-with-values and case-lambda to check the number of
values that returns the original function inside the contract.
The case-lambda create new closures because they have references
to local variables.

In these case, it's possible to avoid the creation of closure saving the
results in temporal variables, that are used later outside the case-lambda.
2016-01-25 17:18:00 -03:00
Robby Findler
f669eb4af5 add a second argument to list*of
to control what the last piece of the list is more explicitly
2016-01-25 07:58:49 -06:00
Robby Findler
b0d9653cbe adjust the plus-one arity functions to exploit procedure-return-arity 2016-01-25 07:58:49 -06:00
Matthew Flatt
9e69f341b3 fix unsafe-chaperone-procedure and ...-procedure* side channel
Also, clarify in docs that `unsafe-chaperone-procedure` cannot
really work with an argument created via `chaperone-procedure*`.
2016-01-24 21:45:21 -08:00
Vincent St-Amour
767fd3fa3a Tests for object/c and dynamic-object/c instrumentation.
Instrumentation which was already there from object-contract.
2016-01-22 16:10:37 -06:00
Vincent St-Amour
9d990b65dc Add instrumentation to class/c.
Method contracts are taken care of by the function combinators.

So only field contract instrumentation is necessary.
2016-01-22 15:30:07 -06:00
Alexis King
95c0dfce38 Include racket/base for-label for the contracts intro in the guide 2016-01-21 20:18:54 -06:00
Alexis King
3620bae6da Fix check-version from version/check
Use get-pure-port to more robustly handle HTTP and to avoid prematurely
closing the output port.
2016-01-21 20:18:48 -06:00
Alexis King
f52d43e600 Add for/stream and for*/stream comprehensions to racket/stream
Closes #664
2016-01-21 20:18:39 -06:00
Leif Andersen
34cfe48355 Add examples to make-require-transformer 2016-01-21 17:53:37 -05:00
Robby Findler
10c934aec0 restore the contract profile marks
commit bea67c0 dropped a bit too much of the contract wrapper
2016-01-21 06:57:42 -06:00
Leif Andersen
f7298cdb29 scheme_rename -> scheme_reload 2016-01-20 23:03:16 -05:00
Robby Findler
bea67c0a39 When we know that the procedure getting a contract is "simple enough",
drop the tail call fanciness

"simple enough", for now, means that it is a struct selector, predicate,
constructor, or mutator. Perhaps we will learn more about such simple
procedures where this is safe some other way.

This commit speeds up this program:

  #lang racket/base
  (require racket/contract/base)
  (struct s (x))
  (define f (contract (-> any/c integer?) s-x 'pos 'neg))
  (define an-s (s 1))
  (time
   (for ([x (in-range 10000000)])
     (f an-s)))

by about 1.9x
2016-01-20 21:38:32 -06:00
Robby Findler
126c090579 special case any/c when it appears syntactically in the argument to ->
Skip calling the domain projection in that case and, if all of the
arguments are any/c then also skip putting the contract continuation mark

This appears to give about a 20% speed up on this program:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (λ (x) 1)
     'pos 'neg))
  (time
   (for ([x (in-range 4000000)])
     (f 1)))
2016-01-20 21:08:15 -06:00
Alex Knauth
f130a5ea48 Link to reference from reader extensions guide 2016-01-20 20:36:52 -06:00
Adrien Tateno
4949eb3374 exn-message misspelled as exn-messgae 2016-01-20 16:51:29 -06:00
Vincent St-Amour
7c4aaa20a8 Document with-contract-continuation-mark. 2016-01-20 16:51:28 -06:00
Stephen Chang
fa96375742 fix in-vector segfault; document corner cases
closes #15227
2016-01-19 16:37:07 -05:00
Stephen Chang
0f39ee9b72 fix ni-range docs; add for tests 2016-01-19 14:22:02 -05:00
Stephen Chang
60845b2098 fix broken for tests in racket-test-core 2016-01-19 11:56:46 -05:00
Stephen Chang
8331e28c49 Merge pull request #1208 from stchang/fast-in-hash
add :do-in fast path for in-hash
2016-01-19 10:52:10 -05:00
Matthew Flatt
86f0d75a96 JIT: fix fast path for property-only chaperones
The recently added fast path for property-only chaperones did not
propagate the original object in the case that the property-only
chaperone wraps a `chaperone-procedure*` chaprerone.

Merge to v6.4
2016-01-19 06:51:25 -05:00
Vincent St-Amour
ad0f94c054 Additional test case from Robby. 2016-01-18 22:23:08 -06:00
Vincent St-Amour
4fd60fed11 Instrument id table contracts. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
d5ae7125e5 Add instrumentation to sequence/c. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
451ef1d37e Add instrumentation for tail-marks-match?. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
b8af007d94 Instrument stream/c. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
74c423bb24 Add instrumentation to set/c. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
a48b559324 Instrument async-channel/c. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
c726cf6ffc More instrumentation tests. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
2f6f403ce8 Fix and improve ->i instrumentation. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
d0c48de685 Add instrumentation to struct property contracts. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
1661eeda18 Front-load some work in struct/dc instrumentation. 2016-01-18 22:23:05 -06:00
Vincent St-Amour
b00d7782ca Instrumentation for parametric->/c. 2016-01-18 22:23:05 -06:00
Vincent St-Amour
143267f1e9 Remove now-redundant instrumentation of vector contracts.
Now covered by instrumentation at contract entry points.
2016-01-18 22:23:05 -06:00
Vincent St-Amour
1277f0347a Instrumentation for object-contract. 2016-01-18 22:23:05 -06:00
Vincent St-Amour
e5738b8ee6 Add missing instrumentation to misc.rkt. 2016-01-18 22:23:04 -06:00
Vincent St-Amour
72418fba03 Instrument higher-order hash/c. 2016-01-18 22:23:04 -06:00
Vincent St-Amour
d34cd06b90 Tests for instrumentation of contract entry points. 2016-01-18 22:23:04 -06:00
Vincent St-Amour
f3f5d9212a Instrumentation at use site for provide/contract and flat contracts. 2016-01-18 22:23:04 -06:00
Vincent St-Amour
ecce6e1b85 Fix test names. 2016-01-18 22:23:03 -06:00
Vincent St-Amour
9b7724167a Add instrumentation for box contracts. 2016-01-18 22:23:03 -06:00
Vincent St-Amour
379a3dd110 Add instrumentation to contract system entry points.
To catch checking that does not happen inside chaperones.
2016-01-18 22:23:03 -06:00
Robby Findler
66d6de6394 avoid putting tail marks on when we know they are already there 2016-01-18 21:19:32 -06:00
Robby Findler
0104e753e7 fix incorrect contract profiler marks, introduced in 308c918a 2016-01-18 21:19:32 -06:00
Matthew Flatt
edd117d414 update HISTORY.txt for v6.4
Merge to v6.4
2016-01-17 16:37:20 -07:00
Matthew Flatt
1204aacd70 procedure-specialize: repair for literal syntax object
Fix `procedure-specialize` for a procedure that refers to a
syntax-object literal. A syntax-object literal becomes part of the
procedure closure, but in a special way that nomrally allows syntax
objects to be loaded on demand. For now, specialization counts as
a demand of the syntax object.

Merge to v6.4
2016-01-17 16:37:20 -07:00
Matthew Flatt
e0cc61d5af fix broken info use after JIT buffer overflow
After the JIT buffer becomes too full, some paths
don't bail out fast enough, so guard against
broken info in some relatively new uses of the info.

Merge to v6.4
2016-01-17 16:37:20 -07:00
Sam Tobin-Hochstadt
e133d87765 Handle rename transformers better in match expanders.
Closes PR 15223.

Merge to 6.4.
2016-01-17 10:48:07 -05:00
Matthew Flatt
ea172ae459 unsafe-{chaperone,impersonate}-procedure: fix name on bad arity
When a procedure created by `unsafe-{chaperone,impersonate}-procedure`
is given the wrong number of arguments, the original procedure's name
should be used in the error message.
2016-01-16 23:06:33 -07:00
Robby Findler
738529c7de fix a bug introduced in 35ce47d97 2016-01-16 12:37:58 -06:00
Matthew Flatt
f317f906d8 small repairs to docs on 'scribblings in "info.rkt"
Merge to v6.4
2016-01-16 08:20:36 -07:00
Matthew Flatt
0a266780fe unsafe-{impersonate,chaperone}-procedure: to racket/unsafe/ops
Move from racket/base, since the functions are unsafe.
2016-01-16 08:20:36 -07:00
Matthew Flatt
48de4101c2 sync version numbers 2016-01-16 07:04:06 -07:00
Matthew Flatt
cc4fd16ed5 avoid a srcloc from "kw.rkt" 2016-01-16 07:03:29 -07:00
Robby Findler
35ce47d97c use procedure-result-arity in racket/contract
This commit, combined with the use of unsafe-chaperone-procedure,
achieves almost the same speedups as c24ddb4a7, but now correctly.

More concretely, this program:

  #lang racket/base
  (module server racket/base
    (require racket/contract/base)
    (provide
     (contract-out
      [f (-> integer? integer?)]))
    (define (f x) x))
  (require 'server)
  (time
   (let ([f f]) ;;  <-- defeats the plus-one-arity optimiztion
     (for ([x (in-range 1000000)])
       (f 1) (f 2) (f 3) (f 4) (f 5))))

runs only about 40% slower than the version without the "(let ([f f])"
and this program

  #lang racket/base
  (module m racket/base
    (provide f)
    (define (f x) x))
  (module n typed/racket/base
    (require/typed
     (submod ".." m)
     [f (-> Integer Integer)])
    (time
     (for ([x (in-range 1000000)])
       (f 1) (f 2) (f 3) (f 4))))
  (require 'n)

runs about 2.8x faster than it did before that same set of changes.
2016-01-16 00:02:20 -06:00
Robby Findler
e3abc6f5c7 add a tail test 2016-01-16 00:02:20 -06:00
Robby Findler
579d50b2d8 add procedure-result-arity 2016-01-16 00:02:20 -06:00
Robby Findler
308c918a42 use unsafe-{chaperone,impersonate}-procedure in racket/contract
for contracts where the arity of the given function is exactly
the arity that the contract expects (i.e. no optional arguments
are turned into madatory or dropped)
2016-01-16 00:02:20 -06:00
Robby Findler
41c8d5bc27 add unsafe-{chaperone,impersonate}-procedure 2016-01-16 00:02:19 -06:00
Jay McCarthy
df29c4e7e2 adjust double splicing behavior of rename-transformer-parameter 2016-01-14 17:29:15 -05:00
Jay McCarthy
3cb100ba17 Clean up stxparam interface 2016-01-14 17:29:15 -05:00
Stephen Chang
187d220ecc add :do-in fast path for in-hash 2016-01-14 12:28:23 -05:00
Matthew Flatt
9498bdd80f make raco distribute work with non-writable exe
Closes PR 15214

Merge to v6.4
2016-01-13 20:12:36 -07:00
Gustavo Massaccesi
be82c27db3 fix bug in shifting of types during inlining
During inlining, the type information gathered in
code that was inside the lambda is copied to the outer
context. But the coordinates of the type information
were shifted in the wrong direction, so the type was
assigned to the wrong variable.

This bug is difficult to trigger, so the test is convoluted.

Merge to v6.4
2016-01-13 23:59:17 -03:00
Matthew Butterick
0fb11e61e6 update copyright from 2015 to 2016 2016-01-13 19:40:35 -07:00
Matthew Flatt
052c7e4c06 pick better names for new module-expansion properties
In retrospect, 'module-body-outside-context wasn't a good
name for a property that turned out to hold only an
inside-edge scope.
2016-01-13 07:53:50 -07:00
Matthew Flatt
6ea9e963c4 add context properties to a module expansion
Add 'module-body-inside-context, 'module-body-outside-context, and
'module-body-context-simple? properties to the expansion of a
`module` form. These properties expose scopes that are used by
`module->namespace` and taht appear in marshaled bytecode.
2016-01-13 07:44:31 -07:00
Asumu Takikawa
34f52deeb1 Fix struct error for bad #:constructor-name 2016-01-12 11:21:31 -05:00
Matthew Flatt
417d9b0e73 define-runtime-path: add a #:runtime?-id option
The expression in a `define-runtime-path` form is used in
both a run-time context and a compile-time context. The
latter is used for `raco exe`. In a cross-build context,
you might need to load OpenSSL support for Linux (say)
at build time while generating executables that refer to
Windows (say) OpenSSL support. In that case, `#:runtime?-id`
lets you choose between `(cross-system-type)` and
`(system-type)`.

Merge to v6.4
2016-01-09 09:44:47 -07:00
Matthew Flatt
0d3066d8db adjust doc example to avoid a dependence on "algol60"
Merge to v6.4
2016-01-09 09:44:37 -07:00
Ryan Culpepper
c2e99efefc Post-release version for the v6.4 release 2016-01-09 11:31:31 -05:00
Matthew Flatt
01e889570a net/win32-ssl: enable TLS 1.1 and 1.2 2016-01-09 08:28:20 -07:00
Matthew Flatt
034d2e9531 declare NSSupportsAutomaticGraphicsSwitching
Related to #1193
2016-01-09 06:12:46 -07:00
Matthew Flatt
3e5c889b7d adjust non-JIT application of chaperone with only properties
Don't push elements to the runstack that aren't popped back off. I
can't construct an example that demonstrates a problem, but fix it
just in case.
2016-01-09 06:09:36 -07:00
Matthew Flatt
dafb6d722e Makefile: move SRC_CATALOG definition to ealier
Accommodate nmake.exe, which needs the definition before
the use in `win32-in-place`.
2016-01-08 19:31:46 -07:00
Matthew Flatt
7b4c91ea21 setup/cross-system: configure reader properly 2016-01-08 18:29:10 -07:00
Matthew Flatt
8e162082e1 fix foreign library references for cross-build 2016-01-08 16:40:58 -07:00
Matthew Flatt
30005d41ac repair for cross-build of OS X executables 2016-01-08 16:22:44 -07:00
Matthew Flatt
d4f3dfb3d0 make SRC_CATALOG work with win32-in-place 2016-01-08 10:01:22 -07:00
Matthew Flatt
7bae604711 fix default source catalog for make 2016-01-08 09:53:44 -07:00
Jay McCarthy
b078cbc0ef Add define-rename-transformer-parameter and friends 2016-01-08 11:03:33 -05:00
Ben Greenman
3c496777ef add 'combinations' and 'in-combinations' 2016-01-07 23:44:53 -05:00
Robby Findler
32a79a22ec Revert "improve the way plus-one arity functions fall back when they can't see the application site"
This reverts commit c24ddb4a7c.

This optimization was bogus, as shown by the test case in 393d72f153

(Thanks to Sam again for the test case.)
2016-01-07 22:14:15 -06:00
Robby Findler
393d72f153 add test case that makes sure we preserve chaperone-of for contract-out functions 2016-01-07 22:14:05 -06:00
Matthew Flatt
666c5f1557 Windows code-signing and ".tgz" options for distro-build 2016-01-07 17:25:26 -07:00
Robby Findler
3e53a3ea42 make impersonator vector contracts use impersonate-vector, not chaperone-vector
closes #1198
2016-01-07 12:59:21 -06:00
Robby Findler
c24ddb4a7c improve the way plus-one arity functions fall back when they can't see the application site
In particular, instead of going directly back to the chaperone, handle
the case where the function doesn't accept keyword arguments with a
less expensive fallback.

The less expensive fallback uses a case-lambda wrapper (wrapped inside
a make-keyword-procedure) to close over the neg-party and avoid the
chaperone creation. With this commit, the program below gets about 3x
faster, and is only about 20% slower than the version that replaces
the "(let ([f f]) ...)" with its body

  #lang racket/base
  (module m racket/base
    (require racket/contract/base)
    (provide (contract-out [f (-> integer? integer?)]))
    (define (f x) x))
  (require 'm)
  (collect-garbage)
  (time (for ([x (in-range 5000000)]) (let ([f f]) (f 1))))

  Thanks, @samth!
2016-01-07 12:59:21 -06:00
Robby Findler
578b42fc2b add docs for contract-late-neg-projection and contract-val-first-projection 2016-01-07 12:59:20 -06:00
Robby Findler
8b4f8541c3 remove extraneous ? 2016-01-07 12:59:20 -06:00
Robby Findler
d04dfb67df remove stray printf 2016-01-07 12:59:20 -06:00
Matthew Flatt
7db904e984 net/osx-ssl: fix error handling 2016-01-07 10:49:53 -07:00
Gustavo Massaccesi
9a6726b10d sequence-length: more O(1) special cases 2016-01-07 13:48:42 -03:00
Matthew Flatt
bfe9b4aefd fix CFNetwork reference for old OS X 2016-01-07 06:11:28 -07:00
Matthew Flatt
c9348f7cd7 fix Mac OS X pre-built libssl install 2016-01-07 06:11:27 -07:00
Leif Andersen
7eee46c4d3 => should not be hyperlinked to cond arrow. 2016-01-06 21:27:56 -05:00
Juan Francisco Cantero Hurtado
961ab31776 Typo: clonse -> clones. 2016-01-06 19:52:31 -06:00
Jay McCarthy
d3c09ead19 Fix cpointer tags 2016-01-06 19:07:33 -05:00
Jay McCarthy
ccc50ca68f Forgot to update racket, just base 2016-01-06 17:42:56 -05:00
Jay McCarthy
18208f76f5 Improve define-cstruct inline-ability and add #:define-unsafe 2016-01-06 16:53:36 -05:00
Benjamin Greenman
69b01c637f typo: curent -> current 2016-01-06 15:42:58 -05:00
Matthew Flatt
fe1ffbe36f fix a test for the default package catalog 2016-01-06 13:17:44 -07:00
Matthew Flatt
711ab4d984 raco pkg: add PLT_PKG_SSL_NO_VERIFY environment variable
Just in case someone needs to work around an HTTPS server
without a valid certifcate.
2016-01-06 11:55:43 -07:00
Matthew Flatt
8dfce37977 net/win32-ssl: enable 'secure mode
Validate server certificate in 'secure mode.
2016-01-06 11:55:43 -07:00
Matthew Flatt
c706ee2c05 switch default catalogs to HTTPS 2016-01-06 11:55:43 -07:00
Matthew Flatt
273bc4ea49 use OS X native SSL when libssl is too old
OS X's libssl is deprecated, and it doesn't work with SSL connections
that need SNI. We'll distribute out own libssl builds for OS X via a
package, but we need a native implementation that works well enough to
get that package.
2016-01-06 11:55:43 -07:00
Matthew Flatt
d160cb81a8 raco pkg: use 'secure for an HTTPS catalog 2016-01-06 11:55:43 -07:00
Matthew Flatt
92f1bfa4d2 openssl: add 'secure protocol shortcut
The 'secure protocol symbol is just a shorthand for
`(ssl-secure-client-context)`, but it helps highlight
that the default 'auto isn't secure, and having a plain
symbol smooths the connection to native Win32 and OS X
implementations of SSL.
2016-01-06 11:55:43 -07:00
Matthew Flatt
1e5da68b88 OS X: avoid getdtablesize() by switching frmo select() to poll()
The getdtablesize() result appears not to be constant on OS X.
Creating some combination of CFStream objects, threads, and CFRunLoop
objects can cause the value to be increased by a factor of 10. Avoid
the need for getdtablesize() by switching from select() to poll().
2016-01-06 07:34:18 -07:00
Matthew Flatt
8068c1e2a5 Revert "add source for "racket-playsound.exe""
This reverts commit e08188aeda.

New implementation of `play-sound` doesn't need it.
2016-01-05 20:36:33 -07:00
Matthew Flatt
25f8a5d0d9 Revert "adjust "racket-playsound.exe" return code"
This reverts commit 26560240f1.

New implementation of `play-sound` doesn't need it.
2016-01-05 20:36:33 -07:00
Vincent St-Amour
4b266f1ff2 sequence-sample: various comments from Eli. 2016-01-05 20:33:57 -06:00
Vincent St-Amour
1ce6a49f94 random-sample: actually use the passed-in prng.
Found by Eli.
2016-01-05 20:33:56 -06:00
Leif Andersen
533c0d16ec Fix typo in raco documentation for scribblings. 2016-01-05 15:47:00 -05:00
Vincent St-Amour
656044b8fc random-sample: use reservoir sampling to do a single pass over sequences.
Suggested by Eli.
2016-01-05 14:42:43 -06:00
Robby Findler
31a9414983 move contract tests into contract subdirectory
and fix up the code that orders the tests when running them all
2016-01-05 09:41:47 -06:00
Robby Findler
c7726e23ec fix random-generation for and/c 2016-01-05 09:14:15 -06:00
Robby Findler
3f4dcb8e87 more accurate error message when content-length is missing 2016-01-05 09:09:52 -06:00
Robby Findler
3df12dca58 specialize sequence/c for one-element sequences
this yields only a modest speed up and only when iterating
over long sequences, e.g. like in this program:

  #lang racket/base
  (require racket/sequence racket/contract/base)
  (define s (make-string 10000 #\a))
  (define str (contract (any/c . -> .  (sequence/c char?))
                        (λ (x) (in-string s))
                        'pos 'neg))
  (time
   (for ([x (in-range 100)])
     (for ([x (str 0)])
       (void))))
2016-01-04 19:56:46 -06:00
Robby Findler
94ac77d30e port sequence/c to late-neg projections 2016-01-04 19:56:45 -06:00
Robby Findler
3ed7dfd62b add the contract printer to set contracts 2016-01-04 19:56:45 -06:00
Robby Findler
14b951cf44 improve the performance of the way contract-stronger? recurs
and fix evt/c's contract-stronger
2016-01-04 19:56:45 -06:00
Matthew Flatt
d37ee8c5b1 fix place and raco exe
The repair involves making `raco exe` detect a sub-submodule
whose name is `declare-preserve-for-embedding` as an indication
that a submodule should be carried along with its enclosing module.

Normally, `define-runtime-module-path-index` would do that, but
the submodule for `place` is created with `syntax-local-lift-module`,
and the point of `syntax-local-lift-module` is to work in a
nested experssion context where definitions cannot be lifted
to the enclosing module.
2016-01-04 11:01:48 -07:00
Sam Tobin-Hochstadt
5cf748d734 Fix set chaperone tests.
`set-first` just does an extract, not a remove.
2016-01-04 11:08:02 -05:00
Robby Findler
1c431e6f4d Clean up chaperone-hash-set and impersonate-hash-set and adjust set/c to match
Made the hash-set chaperones essentially forward the hash chaperone
operations, but now explain them all in terms of set-based operations
in the docs.

Also adjusted value-blame and has-blame? to support late-neg projections
2016-01-03 20:43:24 -06:00
Robby Findler
77a76a7953 fix opt/c for the new way (-> any/c ... any) works
should have been a part of 36b3493e
2016-01-03 20:43:24 -06:00
Sam Tobin-Hochstadt
5ae4e45340 Merge pull request #1184 from andmkent/patch-3
more *syntax/loc for match forms
2016-01-03 17:02:03 -05:00
Vincent St-Amour
cc79e2241c random: Get the right name without run-time overhead. 2016-01-03 13:53:31 -06:00
Vincent St-Amour
4509430063 Fix object name for new random function. 2016-01-03 13:05:35 -06:00
Vincent St-Amour
1e18a7e2b4 sequence-length: special-case lists too. 2016-01-03 13:05:35 -06:00
Matthew Flatt
a2c9b47552 Merge pull request #1189 from LeifAndersen/fix-zo-docs
Fixed typo in zo docs.
2016-01-03 06:47:48 -07:00
Leif Andersen
2aa9d8cca3 Fixed typo in zo docs. 2016-01-02 23:07:31 -07:00
Vincent St-Amour
c47c0ebfca sequence-length: special case O(1) cases. 2016-01-02 20:05:04 -06:00
Vincent St-Amour
47f06f11e1 random: encourage inlining.
Reduces overhead to 6% over #%kernel's  for the integer case.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
740b6dc198 random: Remove redundant checking. 2016-01-02 20:02:30 -06:00
Vincent St-Amour
acb7d999ba Comment typo.
Pointed out by Gustavo.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
707f9bffa6 random: move sequence support to random-ref, in racket/random.
And add `random-sample`.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
6af2f711b7 Fix optimization tests. 2016-01-02 20:02:30 -06:00
Vincent St-Amour
0796350a88 Extend random to work with ranges and sequences.
Requested by Matthias.
2016-01-02 20:02:30 -06:00
Robby Findler
36b3493e45 Change contracts of the form (-> any/c ... any) to not be flat contracts
The issue is what happens when the actual function has other arities.
For example, if the function were (λ (x [y 1]) y) then it is not okay
to simply check if procedure-arity-includes? of 1 is true (what the
code used to do) because then when the function is applied to 2
arguments, the call won't fail like it should. It is possible to check
and reject functions that don't have exactly the right arity, but if
the contract were (-> string? any), then the function would have been
allowed and only when the extra argument is supplied would the error
occur. So, this commit makes it so that (-> any/c any) is like
(-> string? any), but with the optimization that if the procedure
accepts only one argument, then no wrapper is created.

This is a backwards incompatible change because it used to be the
case that (flat-contract? (-> any)) returned #t and it now returns #f.
2016-01-02 17:29:58 -06:00
Matthew Flatt
fdf56dfebf fix calculation of unexported bindings
When a module defines <name-1> and doesn't export it, but when
the module imports <name-2> and re-exports that refers to another
module's definition of <name-1>, then <name-1> wasn't properly
registered as an unexported binding.

Most of the implementation change is just a clean-up of an
unnecessary traversal from before the addition of a `count`
field in each hash table.
2016-01-02 15:10:23 -07:00
Matthew Flatt
190925ee32 avoid a compiler warning 2016-01-02 07:46:42 -07:00
Robby Findler
2529e63b74 make stronger recognize any/c on the right as stronger than any flat contracts 2016-01-01 19:49:38 -06:00
Robby Findler
b24882fd18 implement the (-> any/c ... any) special case for the new -> contract combinator
(new is being used in a relative sense here; it is the newer of the
two -> combinators; the old one is used currently only for ->m)
2016-01-01 19:49:38 -06:00
Matthew Flatt
fd7b8b29ea avoid compiler warning 2016-01-01 14:33:16 -07:00
Matthew Flatt
c0915b02b0 pathlist-closure, tar, and tar-gzip: add #:path-filter
Also, add `#:skip-filtered-directory?` to `find-files`.

Less significantly, adjust `pathlist-closure` to be consistent in the
way that it includes a separator at the end of a directory path.
2016-01-01 13:52:37 -07:00
Matthew Flatt
c9a1dc781e raco setup: use lazy ".zo" parsing for dpeendency checking
Lazy ".zo" parsing make the dependency check take about half as
long.
2016-01-01 13:52:37 -07:00
Matthew Flatt
d3bb9d0412 fix bytecode-reading time-complexity bug
When a tree marshaled to bytecode form has many shared pieces,
the unmarshaling process can lose track of the sharing in one
place and traverse too much of the structure as pieces are
loaded.
2016-01-01 13:52:37 -07:00
Matthew Flatt
8b7f5bc046 faster xexpr->string 2016-01-01 13:52:37 -07:00
Vincent St-Amour
923b5864a5 Small guide fixes.
Closes PR 15109.
2016-01-01 12:52:14 -06:00
Vincent St-Amour
8c8a76979b Fix keyword argument name.
Closes PR 15089.
2016-01-01 12:52:14 -06:00
Vincent St-Amour
4c04d4afce Fix discussion of filter.
Closes PR 15083.
2016-01-01 12:52:14 -06:00
Robby Findler
110f1bd9b0 different, more likely fix 2015-12-31 15:36:33 -06:00
Robby Findler
357b692d33 fix typo 2015-12-31 15:33:59 -06:00
Matthew Flatt
567679bf0a {impersonate,chaperone}-hash: add equal-key-proc wrapper
The optional `equal-key-proc` wrapper effectively interposes on calls
to `equal?` and `equal-hash-code` for hash-table keys.
2015-12-31 09:22:57 -07:00
Andrew Kent
d5f61238c2 more *syntax/loc
I was using match-let and got a syntax error that pointed to this file. After changing the match-let definition to use syntax/loc the error pointed to the exact spot causing the problem. Yay!

I changed quite a few vanilla syntax-quotes to the *syntax/loc form... perhaps some do not need to? I'm not sure.

added back nested syntax/loc
2015-12-31 10:36:30 -05:00
Robby Findler
e92b8610f2 port id-set/c to late-neg 2015-12-30 19:16:36 -06:00
Robby Findler
85c781452d wording tweaks 2015-12-30 17:57:36 -06:00
Benjamin Greenman
0f7a946dba put contract-property accessors in an itemlist 2015-12-30 17:52:33 -06:00
Benjamin Greenman
61e21dba22 typo: is-flat-contract? -> is-list-contract? 2015-12-30 17:52:26 -06:00
Robby Findler
df382ca939 improve warnings and fix small problems with contract combinator constructors 2015-12-30 17:13:23 -06:00
Robby Findler
cb2af327e6 port async-channel/c to late-neg proj
and drop other projection implementations
(mostly to reduce the testing burden)
2015-12-30 17:13:22 -06:00
Robby Findler
9ee264a0ea improve performance of define-generic-created contracts and port to late-neg
This program runs about 10x faster than it did before this commit, but
seems to still be about 100x slower than the version where you change
an-s to just be (s).

  #lang racket/base
  (require racket/contract/base racket/generic)
  (define-generics id [m id x])
  (struct s () #:methods gen:id [(define (m g x) x)])
  (define an-s
    (contract (id/c [m (-> any/c integer? integer?)])
              (s)
              'pos 'neg))
  (time
   (for ([x (in-range 100000)])
     (m an-s 2)))
2015-12-30 17:13:22 -06:00
Robby Findler
a97aa8389b port id-table/c to flat-neg projection 2015-12-30 17:13:22 -06:00
Sam Tobin-Hochstadt
1c3422d420 Fix CI tests for match test move. 2015-12-30 10:39:45 -05:00
Robby Findler
f2f38cdf4a remove overly aggressive use of procedure-specialize 2015-12-30 09:28:58 -06:00
Robby Findler
a5b3d6b3d0 uncopy some code 2015-12-29 21:46:06 -06:00
Robby Findler
46ace3172f clean up interaction between strict set/c contracts and mutable sets 2015-12-29 20:28:22 -06:00
Robby Findler
757adac568 make #f always convert into the same (eq?) contract 2015-12-29 16:13:01 -06:00
Robby Findler
4bdde405f6 improve the way that 'struct-out' cooperates with the
rest of the contract system, creating and using a slightly
more legitmate blame record and calling into the late-neg
projections instead of using `contract`
2015-12-29 15:48:17 -06:00
Sam Tobin-Hochstadt
893bb56762 Rename to make it clear what to run. 2015-12-29 16:01:22 -05:00
Mira Leung
e2bd1b51bc Using in-list in for/list 2015-12-29 15:59:40 -05:00
Mira Leung
404c5b2699 Better code style for f3d888 2015-12-29 15:59:40 -05:00
Mira Leung
56ea9f8b9a Specify names of missing fields for match on structs 2015-12-29 15:59:40 -05:00
Robby Findler
22adc0253b change sets generics so they default to supplying the optional argument
if the given procedure accepts it
2015-12-29 11:26:17 -06:00
Robby Findler
2c5aa96031 change some potentially error-prone provide all-from-outs to explicit provides
and make set load its implementation via relative requires
2015-12-29 11:25:45 -06:00
Robby Findler
7056cd5f2a improve ->i in the case that the dependent contract
turns out to be a predicate.

In that case, just call it instead of creating all of the extra junk
that would normally be created by coercing the predicate to a contract
and invoking it
2015-12-29 11:20:59 -06:00
Matthew Flatt
a516304f6b fix specialization over a nested lambda 2015-12-29 07:04:17 -06:00
Matthew Flatt
26560240f1 adjust "racket-playsound.exe" return code 2015-12-29 07:04:17 -06:00
Robby Findler
d4ca825640 fix set/c name method 2015-12-29 06:56:20 -06:00
Robby Findler
a44ce40b56 fix a bug in 50405a2ca 2015-12-28 22:17:39 -06:00
Robby Findler
f7465f81f1 convert stream/c to late-neg-projection
Also, tune the projection to get a few modest performance gains.

This program gets about 20% faster:

  #lang racket
  (define s (contract (stream/c exact-nonnegative-integer?)
                      (in-naturals) 'pos 'neg))
  (time
   (for ([x (in-range 1000)])
     (for/fold ([s s])
               ([x (in-range 100)])
       (stream-rest s))))

and this program gets about 15% faster:

  #lang racket
  (define f (contract (-> (stream/c exact-nonnegative-integer?)
                          any)
                      (λ (x) 1)
                      'pos 'neg))
  (define l (make-list 10000 0))
  (time (for ([x (in-range 1000)])
          (f l) (f l) (f l) (f l) (f l)))
2015-12-28 21:57:03 -06:00
Robby Findler
ff31b01505 add some error checking for custom set type constructors 2015-12-28 16:59:43 -06:00
Robby Findler
50405a2ca9 fix chaperone-hash-set and impersonate-hash-set for custom-set-types 2015-12-28 16:59:42 -06:00
Matthew Flatt
e08188aeda add source for "racket-playsound.exe" 2015-12-28 07:37:29 -06:00
Matthew Flatt
cefcbdf802 Windows: ensure 'kill subprocesses end with Racket
Use a job object to ensure that subprocesses that are meant
to be killed by the current custodian are reliably terminated
if Racket exits for any reason.
2015-12-28 07:37:29 -06:00
Matthew Flatt
afa01fa763 allow optimizations around procedure-specialize
Although `procedure-specialize` should be useful in places where
inlining does not apply, allowing inlining and related optimizations
through it, anyway.
2015-12-28 07:37:29 -06:00
Robby Findler
b3d05de304 improvements to set/c
- use chaperone-hash-set for set/c when the contract allows only hash-sets

- add a #:lazy flag to allow explicit choice of when to use laziness
  (but have a backwards-compatible default that, roughly, eschews laziness
   only when the resulting contract would be flat)
2015-12-27 22:56:04 -06:00
Robby Findler
bc12019af4 allow the interposition procedures to all be #f in chaperone-hash-set and impersonate-hash-set 2015-12-27 21:02:20 -06:00
Robby Findler
8f2874e4b5 fix impersonator properties for chaperone-hash-set and impersonate-hash-set 2015-12-26 22:37:00 -06:00
Robby Findler
daf19869de chaperone-hash-set fixes 2015-12-26 22:09:14 -06:00
Robby Findler
1b6705f3d9 typo 2015-12-26 17:01:22 -06:00
Robby Findler
d927d04efd generalize tail contract checking for function contracts
Specifically, remove reliance on procedure-closure-contents-eq? to
tell when a pending check is stronger in favor of usint
contract-stronger?

Also, tighten up the specification of contract-stronger? to require
that any contract is stronger than itself

With this commit, this program gets about 10% slower:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (λ (x) (if (zero? x)
                0
                (f (- x 1))))
     'pos 'neg))
  (time (f 2000000))

becuase the checking is doing work more explicitly now but because the
checking in more general, it identifies the redundant checking in this
program

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (contract
      (-> any/c integer?)
      (λ (x) (if (zero? x)
                 0
                 (f (- x 1))))
      'pos 'neg)
     'pos 'neg))
  (time (f 200000))

which makes it run about 13x faster than it did before

I'm not sure if this is a win overall, since the checking can be more
significant in the case of "near misses". For example, with this
program, where neither the new nor the old checking detects the
redundancy is about 40% slower after this commit than it was before:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c (<=/c 0))
     (contract
      (-> any/c (>=/c 0))
      (λ (x) (if (zero? x)
                 0
                 (f (- x 1))))
      'pos 'neg)
     'pos 'neg))

  (time (f 50000))

(The redundancy isn't detected here because the contract system only
looks at the first pending contract check.)

Overall, despite the fact that it slows down some programs and speeds
up others, my main thought is that it is worth doing because it
eliminates a (painful) reliance on procedure-closure-contents-eq? that
inhibits other approaches to optimizing these contracts we might try.
2015-12-25 22:58:56 -06:00
Robby Findler
f0f85549ce add impersonate-hash-set and chaperone-hash-set 2015-12-25 22:58:55 -06:00
Robby Findler
c9d192f09b make more explicit that define-custom-set-types produces hash sets. 2015-12-25 22:58:55 -06:00
Robby Findler
badf2bd19e audit requires of files that require misc.rkt in racket/contract 2015-12-25 22:58:55 -06:00
Robby Findler
7708b2056a use specialize-procedure on predicate portion or or/c
This seems to give about a 10% speedup on this program:

 #lang racket/base
(require racket/contract/base)
(define f (contract
           (-> (or/c number? symbol?) any)
           (λ (x) 0)
           'pos 'neg))

(time
 (for ([_ (in-range 1000000)])
   (f 'x) (f 'x) (f 'x) (f 'x)))
2015-12-25 14:17:03 -06:00
Matthew Flatt
0840fcd6c8 JIT: avoid assertion failures due to a full buffer 2015-12-25 08:04:22 -06:00
Matthew Flatt
f0d09dbef1 make JIT recognize literal struct predicatates, etc.
Mka the closure specializer handle literal struct operations
(as opposed to just references to struct operations).
2015-12-25 07:14:40 -06:00
Matthew Flatt
843992d0c7 use specialization opportunity for #%apply-values 2015-12-24 12:17:31 -06:00
Matthew Flatt
144da5abd4 Merge pull request #1178 from vendethiel/patch-1
Fix small typo in jit.h
2015-12-24 05:30:35 -07:00
ven
c1950f1ae3 Fix small typo in jit.h
Just noticed it while reading db0a6de1d2
2015-12-24 10:11:56 +01:00
Matthew Flatt
ba2eb6487c restore precision for procedure-closure-contents-eq?
After adding `procedure-specialize`, making
`procedure-closure-contents-eq?` work as before involves
a little extra tracking. I'd prefer to weaken or
even get rid of `procedure-closure-contents-eq?`, but
this adjustment keeps some contract tests passing.
2015-12-23 22:06:18 -07:00
Matthew Flatt
44e1262648 unbreak no-JIT build 2015-12-23 21:51:14 -07:00
Matthew Flatt
db0a6de1d2 add procedure-specialize
The `procedure-specialize` function is the identity function, but it
provides a hint to the JIT to compile the body of a closure
specifically for the values in the closure (as opposed to compiling
the body generically for all closure instances).

This hint is useful to the contract system, where a predicate
is coerced to a projection with

 (lambda (p?)
   (procedure-specialize
    (lambda (v)
      (if (p? v)
          v
          ....))))

Specializing the projection to a given `p?` allows primitive
predicates to be JIT-inlined in the projection's body.
2015-12-23 17:46:56 -07:00
Matthew Flatt
592ae853e3 JIT: fast path for procedure impersonator w/o wrapper proc
Make the JIT-generated function-call dispatch recognize a call to
an impersonator that wraps a procedure only to hold properties.

This change also repairs handling for a arity-reducing wrapper
on a primitive, where the fast path incorrecty treated the
primitive as a JIT-generated function.
2015-12-22 15:05:14 -07:00
Matthew Flatt
b794404333 faster path for a procedure impersonator w/o wrapper proc
Make the call path faster when an impersontor is present
on a procedure only to add impersonator properties.
2015-12-22 15:04:53 -07:00
Matthew Flatt
e8073e699e restore a fast path for a procedure chaperone
When the representation of a redirect changed, the fast
path wasn't updated.
2015-12-22 15:04:53 -07:00
Matthew Flatt
c73bcceafe avoid a string pointer needed only for error reporting 2015-12-22 15:04:53 -07:00
Robby Findler
d2233f95e2 make vectorof also try less hard during or/c checking 2015-12-22 16:02:48 -06:00
Robby Findler
8a9408306b have a better strategy for or/c to determine which clause to commit to
in particular, when there is a recursive contract, then we check only
some part of the first-order checks and see if that was enough to
distinguish the branches. if it was, we don't continue and otherwise we do
2015-12-22 16:02:44 -06:00
Robby Findler
31cf0bdbc3 remove the error-prone except-out's from racket/contract
and take the opportunity to move some things around
internally to more reasonable places
2015-12-22 15:51:40 -06:00
Robby Findler
d2bf335212 use the correct accessor for subcontracts 2015-12-22 15:51:39 -06:00
Matthew Flatt
2b10262258 get-module-suffixes: put "rkt" first
Putting "rkt" first in the list makes it likely to act as
a default, such as for a `put-file` dialog.
2015-12-22 11:03:09 -07:00
Matthew Flatt
9bdbd14b96 sync version numbers 2015-12-22 08:03:26 -07:00
Matthew Flatt
c01ced6e1d add syntax-transforming-with-lifts? 2015-12-22 08:02:44 -07:00
Robby Findler
b221e00937 Revert " clean up exports of racket/contract/combinator"
I didn't intend to push that commit
2015-12-21 22:56:34 -06:00
Robby Findler
aeb0509f3a fix performance bug in late-neg projection for cons/c
the first-order check and the projection itself
can duplicate work (potentailly lots of work
in a non-constant factor sort of a way when
recursive-contract is involved)

this seems also to be a potential problem for other
uses of or/c too
2015-12-21 22:53:02 -06:00
Robby Findler
99d7ad56d9 clean up exports of racket/contract/combinator
It used to have a (provide (except-out (all-from-out <private-file>) ...))
    and various private functions leaked to the outside over the years.

    None of the ones removed in this commit were documented, so hopefully
    they weren't being used. But this is definitely not backwards compatible,
    so this commit is mostly about testing the waters
2015-12-21 10:32:41 -06:00
Robby Findler
3a4ba9a1ca fix parametric->/c for the keyword case 2015-12-21 10:32:08 -06:00
Robby Findler
261a5cb1f4 port rename-contract to late-neg projection and add some tests 2015-12-21 09:32:14 -06:00
Robby Findler
e4ffa6c97c port if/c to late-neg, add tests, and fix some (minor) bugs 2015-12-21 09:20:45 -06:00
Robby Findler
8776ab7686 remove implementations of non-late-neg projections from bunch of combinators 2015-12-21 09:20:45 -06:00
Robby Findler
7d02f4c7b1 port parametric->/c to late-neg 2015-12-21 08:06:14 -06:00
Robby Findler
35b2320730 add more warning logging for contracts that don't have late-neg projections 2015-12-21 07:27:38 -06:00
Robby Findler
efc8bcc2fd update contract in comment 2015-12-20 21:17:53 -06:00
Matthew Flatt
0553f191d7 adjust PLT_INCREMENTAL_GC so it can disable generational GC
A value that starts "1", "y", or "Y" enabled incremental mode
permanently (any value was allowed formerly), while a value that
starts "0", "n", or "N" causes incremental-mode requests to be
ignored.
2015-12-20 08:58:21 -07:00
Matthew Flatt
3a99a19c56 reduce double major GCs
When a major GC triggers finalization, another major
GC is scheduled immediately on the grounds that the
finalizer may release other values. That was important
at once time, but the finalization and weak-reference
implementation has improved to the point where the
extra ful GC no longer seems necessary or useful.
2015-12-20 08:58:21 -07:00
Matthew Flatt
513849c1e3 incremental GC: make accounting incremental for the root custodian 2015-12-20 08:58:21 -07:00
Matthew Flatt
9711000b70 drop generation 1/2 except in incremental mode
Originally, generation 1/2 was intended to delay major
collections when the heap is especially large. It doesn't
seem to be effective in that case, and it can slow down
minor GCs, so continue to use it only in incremental
mode (where it helps significantly with fragmentation).
2015-12-20 08:58:21 -07:00
Matthew Flatt
6957780cd5 incremental GC: tune departure from incremental mode
At the completion of an incremental major GC, if incremental
mode wasn't requested recently, schedule an immediate major
GC to reduce the heap back to its normal footprint.
2015-12-20 08:58:21 -07:00
Jay McCarthy
ddaffc8248 Revert "A kinder, gentler, friendly starting documentation page"
This reverts commit 260bfe9fec.
2015-12-20 10:51:31 -05:00
Robby Findler
15e24fce78 adjust set/c to follow the late-neg protocol
and make it do some work earlier
2015-12-19 22:17:59 -06:00
Robby Findler
53fa16fc9c adjust hash/c to more completely follow the late-neg protocol 2015-12-19 22:17:59 -06:00
Robby Findler
783443f9d7 update the docs for ->i
(should have been in commit 506c9be0cd)
2015-12-19 22:17:59 -06:00
Robby Findler
bd4b243963 port xml contracts to late-neg 2015-12-19 22:17:58 -06:00
Robby Findler
3b1e535049 port recursive-contract to late-neg 2015-12-19 22:17:58 -06:00
Robby Findler
a712117030 adjust syntax-parse's contract support to use the late-neg projections 2015-12-19 22:17:58 -06:00
Robby Findler
00c0ddb7f6 port vector/c to late-neg projection (and throw away some redundant code) 2015-12-19 22:17:58 -06:00
Robby Findler
efcbd12116 port class/c and friends to late-neg projections 2015-12-19 22:17:58 -06:00
Robby Findler
3ed5eef44d put a little more info into the test case failure messages 2015-12-19 22:17:57 -06:00
Jay McCarthy
260bfe9fec A kinder, gentler, friendly starting documentation page 2015-12-19 21:56:55 -05:00
Jay McCarthy
2e34599ce3 Support custom categories on root documentation page
When custom categories are used in older versions, raco setup will
report a warning, but the documentation will still appear under the
Miscellaneous section. Thus, this is a backwards compatible
implementation of the idea.
2015-12-19 16:56:48 -05:00
Robby Findler
93d286914e port new-∀/c and new-∃/c to late-neg 2015-12-19 11:41:38 -06:00
Robby Findler
8e2179a6eb port struct-type-property/c to late-neg and add some tests for it 2015-12-19 11:41:37 -06:00
Robby Findler
557b039f3c add more racket/contract non late-neg projection warnings 2015-12-19 11:41:37 -06:00
Robby Findler
4a29792934 port ->i to late-neg 2015-12-19 11:41:37 -06:00
Matthew Flatt
7d2b538293 fix marshaling of a compiled top-level begin-for-syntax
Closes #1174
2015-12-19 09:37:32 -07:00
Matthew Flatt
2fad028fd5 fix incremental GC bug
Also, fix reporting of whether a minor GC was in incremental mode.
2015-12-19 09:37:32 -07:00
Robby Findler
506c9be0cd add the ability to make chaperone contracts to ->i 2015-12-18 20:41:51 -06:00
Sam Tobin-Hochstadt
962a72dfda Properly handle (place ...) in submodules.
Closes #1173 and PR 12934.
2015-12-17 19:35:08 -05:00
Sam Tobin-Hochstadt
e5c5feca6d Bind channel properly in place/context.
Closes #1169.
2015-12-17 19:17:28 -05:00
Matthew Flatt
074202bdd2 raco setup: don't completely ignore a collection without compilation
A collection's "info.rkt" might have `(define compile-omit-paths
'all)` but also other setup actions, so don't completely ignore
a collection directory just because there's nothing to compile.
2015-12-17 07:55:39 -07:00
Matthew Flatt
ad1fe0c529 raco setup: make "nothing to do" count as success 2015-12-17 07:50:20 -07:00
Matthew Flatt
d7184227e1 fix mutation of shared "self" module path index for submodules 2015-12-17 06:21:05 -07:00
ben
0d633fefd3 typo: string-contains precondition 2015-12-16 14:07:16 -05:00
Robby Findler
33ba7683b2 specify default for stronger 2015-12-15 21:54:36 -06:00
Matthew Flatt
ca237910b3 fix make-syntax-delta-introducer with a #f argument
Closes PR 15202
2015-12-15 17:11:45 -07:00
Matthew Flatt
11f76cbebf fix Burroughs's name 2015-12-15 17:11:45 -07:00
Vincent St-Amour
3dc49139cf Fix more missing parties in contract instrumentation. 2015-12-15 14:31:38 -06:00
Vincent St-Amour
d0d6d719af Abstract contract instrumentation. 2015-12-15 13:37:47 -06:00
Andrew Kent
b4afecab97 slightly more explicit error msg 2015-12-15 11:33:16 -06:00
Gustavo Massaccesi
6985150e0b Don't drop expressions with side effects in eq? reduction
The expression (eq? x y) is reduced to #f when the types of
x and y are known. Reduce this to (begin x y #f) when they
have side effects.
2015-12-15 00:25:00 -03:00
Vincent St-Amour
b84233bca7 Tests for struct/dc instrumentation. 2015-12-14 16:30:30 -06:00
Vincent St-Amour
b8df0a38a2 Add instrumentation for optimized struct/dc. 2015-12-14 13:57:07 -06:00
Vincent St-Amour
bf1ba809ae Test that contract profiler instrumentation always has complete blame info. 2015-12-14 13:27:08 -06:00
Robby Findler
bd77a0102c add blame-missing-party? and document it and blame-add-missing-party 2015-12-14 12:53:35 -06:00
Vincent St-Amour
8bd47f3f8a Fix instrumentation of struct/dc.
Unbreaks the contract profiler.
2015-12-14 10:52:23 -06:00
Matthew Flatt
f7c67f5c45 incremental GC: always use generation 1/2 in incremental mode
Also, make nursery 1/4 as big in incremental mode, and
correspondingly tune the amount of work to perform per
collection by 1/4 its old value. Using generation 1/2
reduces fragmentation that would otherwise be increase
by a smaller nursery.
2015-12-13 17:16:05 -07:00
Matthew Flatt
d01aec1b32 JIT: always use buffer padding of 200
The main intent of this change is to raise the buffer size
for ARM, but that would leave only 32-bit x86 at size 100, so
just make it size large for all machines.
2015-12-12 14:11:17 -07:00
Matthew Flatt
c6b8ba7c4a JIT: add missing checks for buffer space 2015-12-12 08:13:34 -07:00
Matthew Flatt
d66af86a58 JIT on ARM: add assertion to check long-jump mode
The same assertion is present already in Thumb mode, but
add it to non-Thumb mode.
2015-12-12 07:48:14 -07:00
Matthew Flatt
39c2a08d31 make tests/zo-path inspect all installation-scope packages 2015-12-11 19:27:57 -07:00
Matthew Flatt
4354ce45d8 use `scribble/examples' for the Reference
Port `examples`, `interactions`, etc., to use the new `examples`
form of `scribble/examples`. The main intended effect is to ensure
that errors are produced by examples only as specifically
indicated.
2015-12-11 12:29:41 -07:00
Sam Tobin-Hochstadt
e45e5712de Use quote-srcloc to avoid paths in the compiled code.
Closes #1165.
2015-12-11 13:12:11 -05:00
Sam Tobin-Hochstadt
acbcff1bf4 Make zo-path checking available as a library. 2015-12-11 10:16:21 -05:00
Robby Findler
6593594ebf port struct/dc to late-neg style projections 2015-12-10 18:41:37 -06:00
Robby Findler
4aabe505be fix missing party and indy blame interaction
(also add all of the fields to the equal and hashing
functions)
2015-12-10 18:37:50 -06:00
Robby Findler
a952f11bc5 unbreak the creation of first-order contracts that
don't supply a val-first projection
2015-12-10 09:21:41 -06:00
Matthew Flatt
f5d5277ae7 fix binding table when shadowing imports 2015-12-10 04:56:14 -07:00
Matthew Flatt
b7dd829a6f bump version number 2015-12-09 21:06:55 -07:00
Matthew Flatt
835d098eb2 racket/contract: fix blame in arre case
Remove an incorrect syntax quote that could cause the contract
system to be blamed (and also lead to an absolute path in
bytecode).
2015-12-09 21:06:55 -07:00
Matthew Flatt
1d7429f1d7 match: avoid recording full paths
Use a syntax object to store a source location, letting the
marshal process for syntax objects deal with non-relative
paths.
2015-12-09 21:06:55 -07:00
Matthew Flatt
2743ea06bb avoid paths in case-lambda names
Filter absolute path names for `case-lambda` in the same way as for
`lambda`.
2015-12-09 21:06:55 -07:00
Matthew Flatt
70ee04d257 fix zo-path test to check installed packages 2015-12-09 21:06:55 -07:00
Robby Findler
3d7d906cc1 tweak and clean up the contract combinators api
- uniformly remove the extra layers of calls to unknown functions for
  chapereone-of?  checks that make sure that chaperone contracts are
  well-behaved (put those checks only in contracts that are created
  outside racket/contract)

- clean up and simplify how missing projection functions are created
  (val-first vs late-neg vs the regular ones)

- add some logging to more accurately tell when late-neg projections
  aren't being used

- port the contract combinator that ->m uses to use late-neg

- port the </c combinator to use late-neg
2015-12-09 21:55:58 -06:00
Leif Andersen
5a01b97400 Remove typo in docs for expand-syntax-top-level-with-compile-time-evals
Duplicate 'of' words.
2015-12-09 11:58:18 -05:00
Matthew Flatt
c0f4eb8287 inctemental GC: make finalization more incremental
Allow the process of discovering finalizers to be incremental,
including allow interruptions in later levels of ordered
finalization.
2015-12-08 07:53:03 -07:00
Matthew Flatt
6f106d9adc incremental GC: more precising counting of work done 2015-12-08 05:17:44 -07:00
Leif Andersen
5cd2220366 Add coverall support and use new TravisCI Infrastructure 2015-12-07 17:54:28 -05:00
Michael Campagnaro
4d7e90286e Fix typo in 'more: systems' doc 2015-12-07 10:42:13 -06:00
Vincent St-Amour
5353dd1076 free-vars: add mode that also reports module-bound variables
As a separate mode, for backwards compatibility.
2015-12-07 10:42:12 -06:00
Vincent St-Amour
22caaad944 free-vars: nicer error on submodules 2015-12-07 10:31:12 -06:00
Matthew Flatt
715bdbb49e incremental GC: avoid already-finished finalizaton work
Avoid extra work svaing finalization information and
re-chaining old-generation records for a major GC.
2015-12-06 12:36:52 -05:00
Matthew Flatt
e44926fcee increemntal GC: compact when a major GC is forced early
This change further defends against fragmentation when
incremental mode isn't working well.
2015-12-06 12:36:52 -05:00
Matthew Flatt
b5131321d7 force non-inremental GC if excessive fragmentation
Increemntal GC skips the old-generation compaction phase.
For most applications, that's ok, but it's possible for
fragmentation to get out of hand. Detect that situation
and fall back to non-incremental mode for one major GC.
2015-12-06 12:36:52 -05:00
Sam Tobin-Hochstadt
a0c09c19ac Add test for 21316e3ebf. 2015-12-06 12:22:37 -05:00
Sam Tobin-Hochstadt
21316e3ebf Don't copy immutable vectors in vectorof if not needed.
This happens only if the element contract is a flat contract.
2015-12-06 10:45:13 -05:00
Sam Tobin-Hochstadt
b8d4248053 Copy immutable vector more efficiently.
Thanks to @mflatt for the suggestion.
2015-12-06 10:31:01 -05:00
Robby Findler
e814d742a7 fix the late-neg construction for flat contracts
Thanks to Sam for finding this problem!
2015-12-05 23:03:06 -06:00
Robby Findler
8b3369f81c set up some information for TR 2015-12-05 15:35:46 -06:00
Matthew Flatt
d87e3ead7f fix test for the case that the addon dir is missing 2015-12-05 14:41:22 -05:00
Leif Andersen
f88ba77a5c Fix travis to build against latest Racket build. 2015-12-04 18:01:57 -05:00
Matthew Flatt
fef695f066 fix call-with-atomic-output-file for pathless filename
Closes #1156
2015-12-03 08:05:17 -07:00
Matthew Flatt
724dc2fdbf fix namespace-mapped-symbols forcing of lazy binding info 2015-12-02 13:14:28 -07:00
Sam Tobin-Hochstadt
a6eb00a41c Avoid warning for unused variable. 2015-12-02 10:01:01 -05:00
Matthew Flatt
345b1a8187 refine the Guide section in incremental GC 2015-12-01 17:47:29 -07:00
Matthew Flatt
d56e7309ad GC: fix yet another problem counting allocated bytes 2015-12-01 16:21:32 -07:00
Jay McCarthy
67bf4349ca Revert "Assume that files that start with . are not modules"
This reverts commit fc34292486.
2015-12-01 14:21:09 -05:00
Gustavo Massaccesi
b175241961 Flatten nested begin and begin0 forms
The nested begin/begin0 are flattened at read time, but some
optimizations may create new instances.
2015-12-01 13:50:16 -03:00
Matthew Flatt
7e949d5513 GC: skip memory accounting if demand goes away
Memory accounting is enabled on demand; if demand goes
away --- as approximated by no live custodians having
a limit or previously been queried for memory use ---
then stop accounting until demand resumes.
2015-12-01 08:14:38 -07:00
Matthew Flatt
bef34606cb incremental GC: fix handling of ephemerons
Fix the case that an old-generation finalizer ends up
on a modified page after all old-generation marking
is complete.

Also, make sure epehemerons are checked after previous
marking that may have left the stack empty.
2015-12-01 05:50:06 -07:00
Matthew Flatt
03302c3f30 repair an assertion in the GC 2015-12-01 05:50:06 -07:00
Matthew Flatt
8363144818 incremental GC: make finalization more incremental 2015-12-01 05:50:06 -07:00
Matthew Flatt
f30d8bd562 incremental GC: fix overcount of immobile objects 2015-12-01 05:50:06 -07:00
Matthew Flatt
d306ecdf3a incremental GC: fix accumulation of page-repair work
Too much work was being saved for the final step of a
major GC.
2015-12-01 05:50:06 -07:00
Matthew Flatt
e9c722cf22 re-tune incremental GC parameters
With immobile-object allocation repaired, smaller increments
work.
2015-12-01 05:50:06 -07:00
Matthew Flatt
7901962647 incremental GC: fix phantom-byte counting 2015-12-01 05:50:06 -07:00
Matthew Flatt
fa3cabd681 incremental GC: avoid allocating immobile on old-generation page
The allocation strategy for immobile objects avoids some fragmentation
in non-incremental mode, but it interferes with finishing up an
incremental major collection, so trade some fragmentation for
an earlier finish (which is far more likely to use less memory
instead of more, despite extra fragmentation).
2015-12-01 05:50:06 -07:00
Phil Nguyen
734563a7f4 remove duplicate examples in doc for arity=? and arity-includes? 2015-11-30 10:40:06 -06:00
Jay McCarthy
fc34292486 Assume that files that start with . are not modules 2015-11-30 08:30:25 -05:00
Matthew Flatt
817fdad2d5 Windows with MinGW: Fix network address resolution
Use the same code as for MSVC compilation, which is as simple
as defining `HAVE_GETADDRINFO`.

Closes PR 15192
2015-11-29 17:31:47 -07:00
Vincent St-Amour
e7e75c2292 Fix exponentiation of negative single-floats and moderately large bignums. 2015-11-29 15:46:56 -06:00
Matthew Flatt
a389678556 improve interaction of incremental mode and finalization
Really, just improve when majors GCs are forced to trigger
further finalizations. This improvement makes `(collect-garbage)`
followed by `(collect-garbage 'incremental)` move more
reliably into incremental mode.
2015-11-28 15:54:45 -07:00
Robby Findler
71d80bace5 whoops: don't want to do the precondition check twice 2015-11-28 16:27:21 -06:00
Robby Findler
8cc2e27ca7 improve error checking in version/utils
closes #1152
2015-11-28 16:26:09 -06:00
Robby Findler
86934d4a4f adjust contract printing so that it looks like
the constructors in print mode and so that it
cooperates with pretty printing to get some
newlines in there
2015-11-28 13:47:27 -06:00
Matthew Flatt
c9e9b4e400 add info on incremental GC mode to the Guide 2015-11-28 11:55:43 -07:00
Matthew Flatt
9407afa0a2 faster GC traversal of shared closure prefixes 2015-11-28 11:21:19 -07:00
Matthew Flatt
89807d178e fix accounting of nursery for logging
The pre-GC count didn't include the obejcts allocated on
the most recent nursery page.
2015-11-28 10:36:12 -07:00
Matthew Flatt
c3ac1c6bf4 reduce incremental work on (collect-garbage 'minor)
When `(collect-garbage 'minor)` is combined with incremental
mode, do less incremental work. At the same time, don't
skip an incremental GC just because a major GC is ready.
2015-11-28 10:36:12 -07:00
Matthew Flatt
e968cfbde4 fix accounting of phantom bytes for incremental GC
Also fixes accounting when a phantom-bytes value is
treated as potentially having a backpointer.
2015-11-28 10:35:24 -07:00
Matthew Flatt
81e0636843 fix counting of interior-pointer-allowed objects
Words versus bytes.
2015-11-28 09:22:11 -07:00
Matthew Flatt
ca0e9b8b2f report timing of incremental step 2015-11-28 09:22:11 -07:00
Matthew Flatt
d37bfd45ae avoid unnecessary closure-fixup work in incremental mode 2015-11-28 09:22:11 -07:00
Matthew Flatt
46fe53fadb incremental GC: avoid extra traverals of weak-link lists
When incremental mode has already gone through weak boxes
and arrays, a major GC doesn't need to see them again.
2015-11-28 09:22:11 -07:00
Matthew Flatt
ad2dd24fb8 incremental GC: split "incremental" finalization to single step
Don't finalize after performing some marking work, since
finalization is in one chunk, so it's best to avoid combining
that delay with others.
2015-11-28 06:09:39 -07:00
Matthew Flatt
493eb1de7f tweak incremental-GC parameters
Based on experiments with a few programs.
2015-11-27 15:08:54 -07:00
Matthew Flatt
ba8103bbde add PLT_INCREMENTAL_GC
Although calling `(collect-garbage 'incremental)` in a program with
a periodic task is the best way to request incremental collection, it's
handy for some experiments to have an environment variable that turns
it on permanently.

This change also makes incremental-mode minor collections log as "mIn"
instead of "min", and it changes the first field of the logged
`gc-info` structure to be a mode symbol instead of a boolean.
2015-11-27 08:02:18 -07:00
Matthew Flatt
a0576e0378 make the clean-up phase of a major GC incremental
Incremental GC now works well enough to be useful for some programs
(e.g., games). Memory accounting is still not incremental, so DrRacket
(and running programs in DrRacket) does not really support incremental
collection, although pause times can be much shorter in incremental
mode than by default.
2015-11-27 08:02:17 -07:00
Matthew Flatt
2486c7f4bc incremental GC: add finalization step
This step is semi-incremental, in that it can happen during
incremental collection, but all finalization is performed at once.
This will work well enoguh if the number of finalizers, weak boxes,
etc., will be small enough relative to the heap size.
2015-11-27 08:02:17 -07:00
Matthew Flatt
e24b73fbfd minor GC simplification 2015-11-27 08:02:17 -07:00
Ambrose Bonnaire-Sergeant
37c2558475 Fix documentation typo 2015-11-26 08:26:33 -06:00
Vincent St-Amour
e9282d4f6e Fix expt of floats by large positive bignums.
Brings behavior in line with Gambit.

Closes GH #1148.
2015-11-25 17:46:36 -06:00
Matthew Flatt
8839f7b848 bump version number
Should have incremented it for "xform.rkt" change in f5dbd99e43.
2015-11-25 07:18:12 -07:00
Sam Tobin-Hochstadt
35fffb09d0 Finally fix the concurrency in this test.
The bug was an induced failure in the http server, to test retry
support, triggered another run of half of the synchronization
protocol, leading to a stuck state.
2015-11-24 17:20:53 -05:00
Matthew Flatt
050f708879 setup/unixstyle-install: fix DESTDIR mode for ".desktop" fixup
Closes #1143
2015-11-24 09:49:09 -07:00
Matthew Flatt
b443f3fe68 fix broken resize of place array
Change default array size from 32 to 4, so that the
resize path is used (and tested) on more typical
machines.
2015-11-24 09:20:44 -07:00
Robby Findler
fcfa969b4a add some examples to impersonate-procedure 2015-11-23 09:02:41 -06:00
Jay McCarthy
ad53983276 fix history annotations 2015-11-23 08:41:13 -05:00
Matthew Flatt
5cb02282f5 fix round-to-even for exact->inexact on rationals
Thanks again to Robby
2015-11-22 18:09:11 -07:00
Matthew Flatt
ce7487182a fix too-early exact->inexact conversion in number parsing
Robby found this bug, continuing his streak that included
find the bugs behind commits f5dbd99e43 and 901ffdcbac.
2015-11-22 09:11:23 -07:00
Matthew Flatt
2a88662d01 exact->inexact fixup for MSVC
Casting a `uintptr_t` to `double` seems not to round to
nearest, so keep all bits while moving to `double` and
use arithmetic to combine them (since the rounding mode
is used correctly for arithmetic).
2015-11-22 08:33:44 -07:00
zsh_89
5691b5a344 Add a link to a Macro tutorial written by Greg Hendershott which helps new learners understand Racket macro better. 2015-11-22 06:51:14 -07:00
Matthew Flatt
901ffdcbac fix inexact-number parsing problem
Bug introduced in c40229f756.
2015-11-22 06:50:49 -07:00
Matthew Flatt
f5dbd99e43 fix precision in exact->inexact on bignums
The strategy of converting a bignum to a flonum by converting on word
boundaries can lose one bit of precision. (If the use of a word
boundary causes a single bit to get rounded away, but the first bit of
the next word is non-zero, then the rounding might have been down when
it should have been up.)

Avoid the problem by aligning relative to the high bit, instead.
2015-11-22 06:50:49 -07:00
Asumu Takikawa
92fc1f41c8 Add more hash-like operations to id-table
The operations are ref!, set*, set*!, update, and
update!. Also bumps version number.
2015-11-21 15:46:22 -05:00
Matthew Flatt
c40229f756 fix reading of extflonums, including with large exponents
Fix even basic readind when extflonums are not supported, but
also fix reading extflonums with large exponents (related to
the other recent changes to number parsing).
2015-11-21 10:55:14 -07:00
Matthew Flatt
9d2dd01689 more repairs of parsing inexact with large exponents
Fix the slow-path parsing of numbers in essentially the same
way as aff167b13d.

Closes #1140
2015-11-21 09:18:32 -07:00
Chris Jester-Young
aff167b13d Fix parsing of 0e401 on USE_EXPLICT_FP_FORM_CHECK platforms. 2015-11-21 08:27:46 -07:00
Matthew Flatt
8e46e46d40 add more support for continuation marks in procedure impersonators
Allow a more dynamic (than `impersonator-prop:application-mark`)
determination of continuation marks and associated values to wrap the
call of an impersonated procedure.
2015-11-20 10:20:02 -07:00
Jay McCarthy
69b8b2be35 Fix up prim count from merge mistake 2015-11-20 10:34:19 -05:00
Jay McCarthy
8c08d22197 update cstartup 2015-11-20 10:22:36 -05:00
Jay McCarthy
fff7bcfb03 initialize new params in read_escape_from_string 2015-11-20 10:17:59 -05:00
Jay McCarthy
ec713a22c3 Ensurce new parameters have false defaults everywhere 2015-11-20 10:17:59 -05:00
Jay McCarthy
bbf03997bb correct dot cancelling under readtable 2015-11-20 10:17:36 -05:00
Jay McCarthy
551e4d5a0d Adding documentation for new parameters and updating inside/params with other defs near my changes 2015-11-20 10:17:36 -05:00
Jay McCarthy
ce0aed77ea use readtable for detecting dot 2015-11-20 10:17:36 -05:00
Jay McCarthy
4451f44dda use readtable if available to look up whitespace 2015-11-20 10:17:36 -05:00
Jay McCarthy
35aa2c2398 first version of read_cdot 2015-11-20 10:17:36 -05:00
Jay McCarthy
23beaa4793 comments re mflatt 2015-11-20 10:17:08 -05:00
Jay McCarthy
c257d6dc64 tagged brackets and braces 2015-11-20 10:16:41 -05:00
Matthew Flatt
877264c63b fix net/url delays to be thread-safe 2015-11-20 06:17:52 -07:00
Tim Brown
0b1d0610f2 support [plt_]{http,no}_proxy environment variables
The `current-proxy-servers` and `current-no-proxy-servers` parameters
are initialized on-demand from environment variables.
2015-11-19 15:46:54 -07:00
Asumu Takikawa
76e27da8ba Fix blame error for listof contract 2015-11-17 06:30:35 -06:00
Matthew Flatt
6099a70c52 fix relative-path discovery for case-normalized paths 2015-11-16 12:55:19 -07:00
Ryan Culpepper
912f1fe603 add macro-debugger event on expand opaque expression 2015-11-16 09:09:36 -05:00
Matthew Flatt
d3f2bd6dac fix broken abort handling related to module-registry lock 2015-11-15 16:46:07 -07:00
Matthew Flatt
0e16ce4bea add internal-definition-context-{binding-identifier,track}
When an internal-definition context is used with `local-expand`, the
any binding added to the context affect expansion, but the binding do
not appear in the expansion. As a result, Check Syntax was unable to
draw an arrow from the `s` use to its binding in

 (class object%
   (define-struct s ())
   s)

The general solution is to add the internal-definition context's
bindings to the expansion as a 'disappeared-bindings property. The new
`internal-definitionc-context-track` function does that using a new
`internal-definition-context-binding-identifier` primitive.
2015-11-15 06:17:22 -07:00
Matthew Flatt
e3d78e44cc avoid excessive path retention in raco dist output
This change builds on 5c909cca0d, but it better handles files that
are installed in "lib" or "share" instead of residing in a
package.
2015-11-14 08:31:23 -07:00
Matthew Flatt
8ec17deed1 avoid Linux stack correction on non-main thread 2015-11-13 14:54:05 -07:00
Matthew Flatt
ebd84546ca adjust a test to accommodate Windows paths 2015-11-13 09:54:15 -07:00
Matthew Flatt
6343ca0826 raco {dist,c-tool}: normalize case of paths before finding prefix 2015-11-13 07:42:34 -07:00
Matthew Flatt
fb1432e70e declare and document scheme_set_dll_path() for Windows embedding 2015-11-13 06:49:07 -07:00
Matthew Flatt
825902f8e6 Windows: adjust raco ctool --c-mods ... --runtime ... to copy libs
When gathering runtime files, include the "longdouble.dll"
and "libiconv-2.dll" libraries that are referenced by the
runtime system.
2015-11-12 19:01:18 -07:00
Matthew Flatt
a053c78c30 fix re-export of shadowing binding
Mishandling of the `require`-binding table could cause
`racket/private/pre-base` to export `andmap` as syntax, for example,
instead of as a variable. The syntax-versus-variable distinction
doesn't usually matter, but it affects the order of exports in
bytecode form.
2015-11-12 14:24:44 -07:00
John Clements
b5e2ae030b net/head: better error message for bytes/string mismatch 2015-11-11 17:46:47 -08:00
Sam Tobin-Hochstadt
04c0c59d27 Yet another try at ensuring that this concurrency works. 2015-11-10 16:07:09 -05:00
Matthew Flatt
596b05146c file/tar: add #:follow-links? option 2015-11-10 10:50:07 -07:00
Matthew Flatt
4c6750286a net/http-client: avoid race between EOF and collection close
The race condition can result in an "input port is closed"
error when a connection is used again.
2015-11-10 10:50:07 -07:00
Robby Findler
3d31d86bf5 fix (-> any/c boolean?) for the case of an impersonated struct predicate
closes #1129
2015-11-10 09:00:17 -06:00
Sam Tobin-Hochstadt
54be64ad31 Restore permissive error message from permissive/c.
Thanks to @rbfindler for the suggestion.
2015-11-09 09:15:33 -05:00
Robby Findler
023e2de5be Go back to using the nicer unicode picture of the directory
now that Matthew added support for those characters to Scribble

This reverts commit db464d5ed2.
This reverts commit dd5029947c.
2015-11-08 19:43:02 -06:00
Robby Findler
a8f748abeb clarify some invariants of make-contract and friends 2015-11-08 15:41:03 -06:00
Robby Findler
611899764f pass along neg-party
closes #1126
2015-11-08 09:07:16 -06:00
Matthew Flatt
2ed6c01e56 fix space-safety annotation for nested ifs
Closes PR 15176
2015-11-08 07:36:48 -07:00
Robby Findler
db464d5ed2 make a little more space and stop decoding
(improvements to dd50299)
2015-11-08 07:57:04 -06:00
Robby Findler
dd5029947c use latex-friendly characters 2015-11-08 06:42:01 -06:00
Robby Findler
71690384a4 add first-or/c 2015-11-07 19:55:20 -06:00
Robby Findler
12d063ad87 improve error message when an unknown dependent variable is used 2015-11-07 19:55:20 -06:00
Robby Findler
657cda6e12 add missing ->i well-formedness check 2015-11-07 19:55:19 -06:00
Matthew Flatt
0beee9cd6a remove visit of available module in dynamic-require
Even though `dynamic-require` might lead to loading source, the
path into the compiler for that source will force compile-time code
as needed.

One benefit of ths change is that `racket -l pict3d` takes about half
as long, because `racket/gui` includes a `dynamic-require` to load a
platform-specific back-end, while `pict3d` can pull in a lot of
compile-time code to cooperate with Typed Racket.
2015-11-07 14:08:13 -07:00
Matthew Flatt
6655352789 guard against some cyclic lists in bytecode decoding
Closes #1098
2015-11-07 09:17:41 -07:00
Stephen Chang
83c4a2a19c typo in doc for make-syntax-delta-introducer
I'm not sure about the _m-id_ part but I think this is what the docs are trying to say.
2015-11-07 08:57:32 -07:00
Matthew Flatt
b5224743b8 refine in-directory example
Extend Juan's nice example to show simpler modes, too.
2015-11-07 08:56:05 -07:00
Juan M Uys
348cd7976f provide example for in-directory 2015-11-07 08:40:45 -07:00
Phil Nguyen
66f89cb6f6 fix documented contract ranges of set-subtract! and set-symmetric-difference! 2015-11-07 08:39:48 -07:00
Matthew Flatt
e94b07b3aa patch Pango to handle font-info failure
Getting NULL from CTFontCollectionCreateMatchingFontDescriptors()
might indicate a font installation problem; I'm not sure. In any case,
checking for NULL avoids a crash on at least one installation.
2015-11-07 08:19:50 -07:00
Matthew Flatt
4d9c5d8dd2 patch Cairo to avoid writing to a global constant
This bug is already fixed in the Cairo source repo, so we
can discard the patch on the next Cairo upgrade.

It's not clear which platforms are affected. On OS X, at least,
writing to a global constant can cause a crash.

Thanks to Spencer for making a small example that triggers the bug
(added to the "draw-test" package).
2015-11-06 16:01:36 -07:00
Sam Tobin-Hochstadt
b6939b0b2e Namespace scheme_boxmap_size now that it isn't static. 2015-11-06 14:25:41 -05:00
Sam Tobin-Hochstadt
171e4fba41 Use a semaphore instead of sleeping in this test. 2015-11-06 14:25:41 -05:00
Sam Tobin-Hochstadt
f126fd2356 Revert "change or/c so that it takes the first ho projection"
This reverts commit 5a33856802.

Merge to 6.3.
2015-11-06 14:25:41 -05:00
Juan Francisco Cantero Hurtado
5e2421b1a0 Doc: github.com/plt -> github.com/racket 2015-11-06 10:26:07 -06:00
Juan Francisco Cantero Hurtado
7e497db831 Add *.orig, *.rej and *.core files to gitignore. 2015-11-06 10:25:13 -06:00
Matthew Flatt
58c919c04e fix getting port name for reader errors
Closes #1121
2015-11-05 06:40:05 -07:00
Matthew Flatt
5cc3059de2 fix reader tests for disable extflonums 2015-11-04 19:54:27 -07:00
Matthew Flatt
585f14744e ffi/unsafe/com: repair for safe arrays, and add com-omit?
Repair provided by Antonio Menezes Leitao.
2015-11-04 16:51:09 -07:00
Matthew Flatt
b54c03bb04 refine Cairo patch for CTFontCreatePathForGlyph
The CTFontCreatePathForGlyph() function can return NULL when
the glyph exists but has an empty path. Instead of treating that
as failure, which causes Cairo to generate a bitmap version of
the glyph, check that the glyph is mapped for bounding boxes,
and treat a NULL path as an empty path in that case.
2015-11-04 16:45:44 -07:00
Matthew Flatt
c5f4740b31 fix reader error for bad surrogate-style encodings 2015-11-04 14:03:48 -07:00
Phil Nguyen
42e5d9f5cf fix typo in documented contracts for extfl->exact and extfl->inexact 2015-11-04 13:30:56 -06:00
Matthew Flatt
5a8d2e4204 fix bugs in the reader, especially related to readtables
Closes #1118, but improved testing exposed many other bugs.
2015-11-04 08:51:03 -07:00
Vincent St-Amour
86f19474ca Have magnitude preserve single-precision-ness.
Found using random testing.
2015-11-03 18:43:27 -06:00
Matthew Flatt
827fc45598 syntax-local-infer-name: restore some lost generality
In #956, @gus-massa warned that `syntax-local-infer-name` was changed
in a breaking way, but the implications were not clear. At a minimum,
identifiers need to be treated like symbols, so that `mzlib/contract`
name inference works right. I'm erroring more generally on the side
of keeping the old behavior for anything other than pair-based
trees.

Closes #1117.
2015-11-02 09:14:34 -07:00
Matthew Flatt
37dc3ffa01 report error when --enable-extflonums fails
The `--enable-extflonums` option doesn't really do anything, since
extflonum support is enabled automtatically when the compiler's
configuration allows it. To make this slightly less confusing, report
an error when extflonums cannot be supported, despite
`--enable-extflonums`. The error is reported via compiling, instead of
via `configure`, but hopefully that's enough to be helpful.
2015-11-02 09:09:44 -07:00
Asumu Takikawa
14d25abd76 Add *-keys, *-values, in-* functions for id-tables
Bump version to 6.3.0.3 too
2015-11-01 02:50:12 -05:00
Matthew Flatt
101fac5c1e repair scope-propagtion cache yet again
Commit 352a5dd2d5 effectively reverted the repair
of d719c06e00.

Merge to v6.3
2015-10-30 22:24:40 -04:00
Matthew Flatt
352a5dd2d5 avoid thread swap in checking scope-propagation cache
Continuing with 2f25a1e2bd...

On further reflection, a GC is possible because a
thread swap is possible, and that's asking for trouble.
Disallow thread swaps (and, incidentally, GCs) whle
comparing scope propagations from the cache.

Merge to v6.3
2015-10-30 21:44:13 -04:00
Matthew Flatt
2f25a1e2bd fix GC-related issue with recent cache repair
Repairs a problem with d719c06e00.

A GC can happen while checking whether a cache entry matches,
in which case the cache is cleared, so don't check the cache
slot again after comparing.

Merge to v6.3
2015-10-30 21:31:57 -04:00
Matthew Flatt
d719c06e00 fix cache comparison of scope-propagation tables
Repairs 3eb2c20ad0, which used a scope-set comparison for
a table that maps scopes to propagation actions (add, remove,
or flip).

Closes #1113

Merge to v6.3
2015-10-30 21:01:46 -04:00
Matthew Flatt
bfb245553c fix some syntax-object traversals
Fix uses of `SCHEME_STX_VAL` that should be `scheme_stx_content`
to ensure propagation of scope changes.
2015-10-30 20:48:56 -04:00
Jay McCarthy
fddd85fa18 protect against errors from early-eof, protect against url objects with no path, ensure method is always passed correctly 2015-10-30 13:50:24 -04:00
Matthew Flatt
342198625e syntax-debug-info: handle non-identifiers correctly
In particular, fix the handling of binding information
when the context includes prefixing on import.

Closes PR 15173
2015-10-30 11:39:20 -04:00
Matthew Flatt
31b035cc94 fix submodule name used in error reporting 2015-10-30 08:47:23 -04:00
Matthew Flatt
6e21376473 fix relative-path handling for source locations in bytecode
Closes PR 15174
2015-10-29 21:09:52 -04:00
Matthew Flatt
685e74a1c6 fix debugging mode for checking runstack overflow 2015-10-29 21:09:52 -04:00
Sam Tobin-Hochstadt
60fb3e06b2 Improve set! error messages. 2015-10-29 19:33:15 -04:00
Sam Tobin-Hochstadt
ef6a5c2e75 Add test case for match ordering bug. 2015-10-29 19:33:15 -04:00
Sam Tobin-Hochstadt
1d3fe10d3d Ensure that the closure_map is big enough when deserializing.
Also document more invariants about the closure representation,
and avoid some code duplication.

Fixes #1108 (caught by fuzz testing).
2015-10-29 19:33:15 -04:00
Sam Tobin-Hochstadt
9d909d6834 Another validation check.
Fixes bug caught by fuzz testing.
2015-10-29 19:33:15 -04:00
Vincent St-Amour
d00401ccc1 Use faster reverse inside racket/private/list proper. 2015-10-29 15:37:25 -05:00
Vincent St-Amour
c3aa266bee Flush the same port we write to. 2015-10-29 15:37:14 -05:00
Robby Findler
aa46d1bc10 fix predicate/c bugs 2015-10-29 13:33:28 -05:00
Robby Findler
3f20803679 implement predicate/c for the more complex arrow contract protocol
So now (-> any/c integer?) will avoid the chaperone wrapper when the
function is a struct predicate while simultaneously supporting the
"extra argument neg party" protocol
2015-10-28 20:54:00 -05:00
Matthew Flatt
d17cc6039b repair syntax-local-lift-require to top level
In `syntax-local-lift-require`, avoid scope adjustments intended
to deal with `require` forms that are compiled in one namespace
and evaluated in another.
2015-10-28 21:14:10 -04:00
Matthew Flatt
0edd781928 use "_LOCK" prefix for Windows cross-build
Use "_LOCK" instead of ".LOCK" when the cross
platform is Windows, not just when the current
platform is Windows.

Merge to v6.3
2015-10-28 17:44:26 -04:00
Jay McCarthy
2396542cda better locking test 2015-10-28 11:32:47 -04:00
Spencer Florence
8f681cec7a fixed minor docs typo 2015-10-28 09:18:05 -04:00
Stephen Chang
c868c7b68d doc typos 2015-10-27 16:11:15 -04:00
Sam Tobin-Hochstadt
d589f6a8ed Avoid problematic reordering of Or patterns.
This makes two changes to `(or ...)` pattern compilation.

* Avoid reordering the individual elements of an `or` pattern.
  Since this reordering has broken programs with `and` patterns,
  avoid it here as well.

* Avoid re-ordering sets of patterns that _contain_ an `or`. This
  is not semantically important for match itself, but Typed Racket
  relies on the previous behavior.

  Closes racket/typed-racket#150.

Merge to 6.3
2015-10-27 12:13:21 -04:00
Sam Tobin-Hochstadt
7338f45bd2 Fix unwanted reordering of match patterns.
This change ensures that the `reorder?` flag is passed to recursive
calls to `compile` correctly. Related to racket/frtime#1, which is
probably now fixed.

Merge to 6.3.
2015-10-27 12:13:21 -04:00
Vincent St-Amour
95c80cf21f Fix test phase.
Suggested by Matthew in the PR discussion.
2015-10-24 20:33:03 -05:00
Vincent St-Amour
bf69920570 Move racket/require tests. 2015-10-24 18:31:17 -05:00
Alexis King
dd97e7b72e Improve how multi-in assigns source location info for its expansion
This changes how multi-in is implemented so that the location for each
expanded element in the final require spec is tied to the last relevant
module path element. This allows DrRacket to intelligently show arrows
linking each imported binding with a relevant piece of the multi-in
import spec.
2015-10-24 18:21:30 -05:00
Alex Knauth
67e3899272 Allow separate read and write contracts for box/c 2015-10-24 14:16:49 -05:00
Robby Findler
c0209b1d80 preserve originalness so that arrows in define/contract
work properly with check syntax

Thanks to Matthew for the fix

Please include in 6.3
2015-10-24 14:16:47 -05:00
Matthew Flatt
3eb2c20ad0 avoid excessive memory use in or expansion
When `or` has many subexpressions, the expansion generates a
sequence of deeply nested `let`s, where original and macro-introduced
forms are interleaved in a way that defeats a minimal
child-is-same-as-parent sharing of scope sets. Add a small
cache that's good enough to capture extra sharing and
dramatically lower memory use for an `or` that has 1000
subexpressions.
2015-10-23 16:32:22 -06:00
Ryan Culpepper
a41c63be09 call SCHEME_EXPAND_OBSERVE_* only when in expand mode, not compile
Merge to 6.3.
2015-10-23 18:26:23 -04:00
Matthew Flatt
2e3ff0332d improve docs on make-weak-hash
Note that values are held normally and ephemerons can help.
2015-10-22 09:40:37 -06:00
Matthew Flatt
b98731ed00 Windows cross-build: MzCOM as a GUI executable
Merge to v6.3
2015-10-22 09:39:48 -06:00
Matthew Flatt
91d825ba61 Windows cross-build: fix over-agressive pruning of DLLs
The `setup/winstrip` step was run too late. As an extra measure,
make make `setup/winstrip` more precise about the files it
will discard.

Merge to v6.3
2015-10-21 18:13:39 -06:00
Matthew Flatt
876708c100 fix tracking of shadowed module imports
When an import is shadowed by another import or by a definition, don't
include it in the set of bindings in the resut of
`syntax-local-module-required-identifiers` or in the set that can be
exported by `all-from-out`.

Merge to v6.3
2015-10-21 16:56:54 -06:00
Matthew Flatt
62f089756c fix doc typo 2015-10-21 15:16:56 -06:00
Matthew Flatt
7b7a315777 fix taint-check ordering in expander
Merge to v6.3
2015-10-20 20:22:37 -06:00
Matthew Flatt
5a768de132 fix Windows distribution stripping to remove CGC ".def" files 2015-10-20 20:22:34 -06:00
Matthew Flatt
a38ba440fa add ".def" generation for MSVC build 2015-10-20 20:22:28 -06:00
Matthew Flatt
ea6cef5246 Windows: make scheme_register_tls_space() always available
To make the API consistent for MSVC versus MinGW builds, make
a functional formerly required for embedding on 32-bit Windows
always available and required for all Windows variants.
2015-10-20 20:22:22 -06:00
Matthew Flatt
8620f95763 Windows distribution: remove compiler-specific libraries
Building creates compiler-specific files in "lib/msvc"
or "lib/gcc". For consistency, strip those directories
when creating a distribution.

The newly added ".def" file provides information that
would otherwise be lost by removing the MSVC ".lib"
file from the distribution.

Removing the compiler-specific ".obj" files means that
used to be included for linking extensions. My guess
is that the files are now completely unused.
2015-10-20 20:22:16 -06:00
Matthew Flatt
0e924525ee MinGW build: put ".lib", ".exp", and ".obj" in the right place
Those files are compiler-specific, so they should be in a "gcc"
subdirectory instead of "msvc".
2015-10-20 20:22:11 -06:00
Matthew Flatt
5056e5fd1b provide ".def" file for the Racket DLL
A ".def" file is compiler-independent.
2015-10-20 20:22:05 -06:00
Matthew Flatt
b8ba78d1d3 avoid slow TLS with MinGW
Recent versions of MinGW-W64 use emutls for `__thread` variables,
and that's much slower than Windows-native TLS. Go back to the
inline-assembly implementation of therad-local access.
2015-10-20 20:21:58 -06:00
Matthew Flatt
5d74897aa4 always install static "mzconfig.h" for Windows 2015-10-20 20:21:53 -06:00
Matthew Flatt
10b3e8040a extra version-number pattern for Windows versioning 2015-10-20 20:21:44 -06:00
Matthew Flatt
dfab18fe47 configure: infer static linking of libwinpthread for MinGW
Merge to v6.3
2015-10-20 08:49:09 -06:00
Matthew Flatt
dad2804412 make MinGW build use the LIBS environment variable
Merge to v6.3
2015-10-19 20:23:00 -06:00
Matthew Flatt
7cffdca067 work around an access() problem on Mac OS X
... again.

Merge to v6.3
2015-10-19 17:48:53 -06:00
Matthew Flatt
079183eb6a fix cross-build for Windows to use setup/winvers-change
Merge to v6.3
2015-10-19 17:48:53 -06:00
Matthew Flatt
836316f5ed fix TEST_ALTERNATE_TARGET_REGISTER build
Merge to v6.3
2015-10-19 17:48:53 -06:00
Matthew Flatt
d8733b4c52 update racket/HISTORY.txt for v6.3
Merge to v6.3
2015-10-19 17:48:52 -06:00
Vincent St-Amour
8598d203fa Add a missing property to an expression lifted by the contract system.
Caused TR to miss it.
2015-10-19 16:23:01 -05:00
Matthew Flatt
04e546716e fix typo
Thanks to Jack Firth.
2015-10-19 08:09:23 -06:00
Phil Nguyen
056ec806d5 fix ranges of set-union!, set-intersect!, dict-clear! to be void? in doc 2015-10-19 08:08:22 -06:00
Juan Francisco Cantero Hurtado
e957a7d655 Add config for linux/ppc64. 2015-10-19 07:55:30 -06:00
Matthew Flatt
e803a3c15e unbreak no-places, no-futures build 2015-10-17 07:00:37 -06:00
Matthew Flatt
c50c23c134 GC: toward incremental collection
Make the old-generation marking process incremental
on request, where `(collect-garbage 'incremental)`
makes a request.

Only the marking phase of an old-generation collection
is incremental, so far. In exchange for slower
minor collections and a larger heap, you get a major
collection pause time that is roughly halved. So, this
is a step forward, but not good enough for most purposes
that need incremental collection.

An incremental-mode request sticks until the next
major GC. The idea is that any program that could
benefit from incremental collection will have
some sort of periodic task where it can naturally
request incremental mode. (In particular, that
request belongs in the program, not in some external
flag to the runtime system.) Otherwise, the
system should revert to non-incremental mode, given
that incremental mode is slower overall and can
use much more memory --- usually within a factor of
two, but the factor can be much worse due to
fragmentation.
2015-10-16 21:08:23 -06:00
Matthew Flatt
7db0c3b1d4 avoid changing mark bits for old objects
For a minor GC and pages that contain backpointers,
leave mark bits as they are; instead make a pass to
shift mark bits for new objects to "dead" bits, and
use dead bits for fixup.

This change is intended as a small step toward incremental
collection.
2015-10-16 18:10:30 -06:00
Alex Knauth
6b93b18a1a syntax/parse: update pattern expander docs 2015-10-16 18:03:40 -04:00
AlexKnauth
2acb10a5da syntax/parse: add test for non-tilde pattern expander 2015-10-16 18:03:40 -04:00
Alex Knauth
4d703fa2e2 syntax/parse: allow pattern expanders that don't start with tilde 2015-10-16 18:03:40 -04:00
Ryan Culpepper
d47b96970c make Windows build work on case-sensitive filesystems 2015-10-16 17:18:34 -04:00
Matthew Flatt
6199f9a596 GC: use generation 1/2 consistently within a collection
The rule for using generation 1/2is based on the current
memory use versus the maximum size of generation 0. Recent
changes to the GC have caused that size to vary during
a collection, which means that the choice to use generation
1/2 or not can change within a collection.

Partial use of generation 1/2 doesn't inherently cause problems, but
it can cause a generation-1 object to point to a generation-1/2 object
even though the former was allocated after the latter. That's a
problem on if getting generations out of order relative to allocation
order can create problems. As it happens, reset_finalizer_tree()
checks the generation of the finalization record and not the finalized
pointer, because the record is always allocated after the pointer.

Merge to v6.3
2015-10-15 16:02:36 -06:00
Sam Tobin-Hochstadt
03bf7d3def Remove added printf. 2015-10-14 15:29:27 -04:00
Sam Tobin-Hochstadt
a4d292b21a Use an unsigned type for sizes.
Fixes this crash http://drdr.racket-lang.org/32121/pkgs/racket-test/tests/racket/stress/fuzz.rkt
found by fuzz testing.
2015-10-14 15:27:13 -04:00
Sam Tobin-Hochstadt
297fb75009 Support -q flag for individual pkg tests. 2015-10-14 09:39:38 -04:00
Sam Tobin-Hochstadt
a3142ac257 Increase sleep time to avoid races on loaded test machines.
Hopefully alleviates DrDr & Travis failures.
2015-10-14 09:38:56 -04:00
Sam Tobin-Hochstadt
f400dab912 Add a check in the compilation-top reader.
This bug was found by fuzz testing.
2015-10-13 17:50:04 -04:00
Sam Tobin-Hochstadt
f63188b4ea Refactoring. 2015-10-13 17:49:18 -04:00
Sam Tobin-Hochstadt
e53492a68f Support environment variable for setting global seed. 2015-10-13 17:49:18 -04:00
Matthew Flatt
20f31fb742 set a bit to prevent corruption of flags via hashing
Certain datatypes in the runtime system are not supposed
to be hashed, where bits normally reserved for hash codes
are used for other purposes. A bad bytecode file can cause
some of those to be hashed, anyway. Normally, the damage is
isolated to that content of the damaged bytecode, but
certain variable-reference bytecode forms are both shared
and non-hashable. Set a bit that ensures hashing will not
change flags in the shared object.

This problem was exposed by fuzz testing.
2015-10-12 19:27:13 -06:00
Vincent St-Amour
42eb8ae332 Do shallower checkouts if possible. 2015-10-12 15:40:22 -05:00
Vincent St-Amour
511fa20825 Fix flag name. Bring in line with docs.
Please merge to 6.3.
2015-10-12 14:52:23 -05:00
Vincent St-Amour
9fe486b9e0 Add missing history annotations.
Please merge to 6.3.
2015-10-12 14:43:19 -05:00
Vincent St-Amour
270bbccf6b Fix history annotations to refer to 6.3.
Please merge to 6.3.
2015-10-12 13:49:55 -05:00
Matthew Flatt
5afdae8af9 net/url-string: change parsing of "file:" URLs for Windows
History of the parsing of "file:" URLs for Windows:

 * In response to PR 8060 (April 2006): special handling added to
   support ill-formed URLs that were (are?) commonly used for
   filesystem paths.

 * Follow-up to PR 8060 (April 2008): added `path->url` and
   `url->path`.

 * In response to #1086 (October 2015, the commit): changed
   Windows-specific handling to be more constrained and added support
   for the proper encoding of UNC paths --- where "proper" means
   "according to a blog post from late 2006", which appears to be as
   close as we get to documentation of the URL encoding for Windows
   paths.
2015-10-12 08:50:25 -06:00
Matthew Flatt
6c0ffe1ba2 add missing history
Merge to v6.3
2015-10-11 07:44:55 -06:00
Ryan Culpepper
a6835422bf Post-release version for the v6.3 release 2015-10-09 15:23:31 -04:00
Paolo G. Giarrusso
a2b213ad1b Fix typos 2015-10-08 19:03:36 -06:00
Matthew Flatt
aa7c3ac38b use libtool install -s to install libraries
Use `install -s` instead of `strip -S` when building shared libraries
via libtool.
2015-10-08 19:02:47 -06:00
Sam Tobin-Hochstadt
6b0e3f2aeb Run the pkg tests on Travis.
- Add indirectly-missing dep for pkg tests.
 - Configure git on Travis to help pkg tests.
2015-10-08 17:38:59 -04:00
Sam Tobin-Hochstadt
de27223635 Add a quiet mode to the pkg tests. 2015-10-08 17:38:59 -04:00
Matthew Flatt
7555d022db for CPP, detect __linux__, etc., instead of linux, etc.
When a compiler is run in standards mode, predefined macros that
do not start with "_" are dropped, so use the "_" versions
consistently. Whether or not Racket itself would compile in
standards mode, the Racket headers should be able to work that
way --- at least on Unix platforms.
2015-10-08 10:53:23 -06:00
Matthew Flatt
85c1ba55f3 fix native-stacktrace interaction with thread start
Repairs 4d3852ae69.
2015-10-06 19:11:28 -06:00
Matthew Flatt
a5f6bf34dc raco pkg: refine handling of HTTP status codes
Treat only 404 and 410 as "not found" errors, retry on 5xx
errors, and treat anything else as an error insteda of "not found".
2015-10-06 17:47:46 -06:00
Matthew Flatt
4d3852ae69 add indirection on thread start to avoid ObjC exception issues
In Mac OS X 10.11, something about the use of exceptions triggers
a libunwind stack traversal, and that traversal runs into trouble
with Racket's stack mangling for threads. Inserting generated code
in the stack frame sequence causes libunwind to give up and avoids
a crash (e.g., with `-j -l drracket` on startup).
2015-10-06 09:32:58 -06:00
Matthew Flatt
f86c5dfe0a document openssl/libcrypto and openssl/libssl 2015-10-05 17:40:19 -06:00
Matthew Flatt
3bcd153fb6 adjust copyright dates: 2014 -> 2015
Better late than never?
2015-10-05 13:39:11 -06:00
Matthew Flatt
c9c03dd40b regexp-replace*: recognize \$ as empty string 2015-10-05 13:28:53 -06:00
Stefan
d988055a49 added crypto-random-bytes 2015-10-05 12:00:01 -06:00
Asumu Takikawa
a729c028a6 Add racket/os library.
For now this just contains two functions from mzlib/os.
2015-10-05 11:59:38 -06:00
Gustavo Massaccesi
09a2b630bc Generalize inferred names
After some expansions, a expression with the syntax property 'inferred-name of
'x is converted to one with ('x . 'x), so it's not useful to get the name of a
procedure. So we simplify the syntax property 'inferred-name to handle
these cases.
2015-10-05 10:25:57 -06:00
Gustavo Massaccesi
b0800dab16 Typo 2015-10-05 10:15:33 -06:00
Matthew Flatt
b92eac82ab patch Pango to make the system control font accessible
The patch doesn't directly make the font accessible, but
it provides a hook so that the font can be made accessible.
2015-10-04 20:30:17 -06:00
Robby Findler
2516374744 account for the added caveat line in the example error message dissection
Thanks to Paolo G. Giarrusso for spotting this and proposing a fix
2015-10-03 09:43:51 -05:00
Matthew Flatt
2c7663eb5e remove accidentally committed explicit GC
I even marked it "REMOVEME", but didn't look at the commit
closely enough before pushing.
2015-10-02 12:50:08 -06:00
Matthew Flatt
93d9826936 fix another problem with GC and place messages
When a place message is deserialized by simply adopting the page
containing the message, the adoption can trigger a garbage
collection, but there's still a pointer to a chain of objects
"in flight" in the thread, and a GC can discard the pairs that
form the chain.
2015-10-02 11:48:25 -06:00
Matthew Flatt
d1a942be63 net/git-commit: add a #:strict-links? argument
Fail on checkout if it creates a symbolic link with an absolute
path or a relative path with "..".

Adjust `raco pkgs` to use `#:strict-links? #t`.
2015-10-02 09:38:27 -06:00
Matthew Flatt
42cf80815d net/git-checkout: fix checkout of symlinks 2015-10-02 09:05:34 -06:00
Matthew Flatt
4caaf3e8b3 Use "https://" instead of "git://" for GitHub download
I originally chose "git://" because I thought "https://"
from GitHub didn't support `--depth 1`, but that does not seem
to be the case.
2015-10-02 08:35:28 -06:00
Matthew Flatt
ed07a5e176 fixup 2015-10-02 05:50:06 -06:00
Matthew Flatt
8c51d50cd2 raco pkg: improve Git repo-download caching
Drop the path and branch from a URL that references a Git
repository, so that a single download is used for multiple
packages in the same repo.
2015-10-01 22:04:24 -06:00
Matthew Flatt
acac7092c5 doc tweak 2015-10-01 21:30:46 -06:00
Matthew Flatt
7671c15b17 more GC callback shapes to support Mac OS X 10.11 2015-10-01 21:23:25 -06:00
Matthew Flatt
7abe38e763 adjust namespace-relative treatment of compiled require
Removing all original module context doesn't work, because it
doesn't distinguish between fragments of syntax that had the
"inside-edge" scope without the "outside-edge" scope.

Record the presence of the outside-edge scope by using the
root scope, and convert the root scope to the current namespace's
outside-edge scope on evaluation.
2015-09-30 11:32:16 -06:00
Matthew Flatt
6e80609998 macro expander: fix over-eager pruning of use-site scopes
The bug could cause

 #lang racket/base

 (define x 'outer)

 (define-syntax-rule (def-and-use-m given-x)
    (begin
      (define-syntax-rule (m)
        (let ()
          (define given-x 'inner)
          x))
      (m)))

 (def-and-use-m x)

to produce 'inner when it should produce 'outer.

Thanks to Brian Mastenbrook for pointing the problem and
providing examples.
2015-09-30 08:39:03 -06:00
Matthew Flatt
31549082e6 avoid crash when interrupting bytecode unmarshal
Interrupting bytecode unmarshal for syntax objects could leave
half-constructed values in a table that is intended to resolve graph
structure. Clear out work towards a graph construction when
interrupted.

The most common symptom of half-constructed syntax objects was a crash
after a Ctl-C during startup.
2015-09-28 14:38:12 -05:00
Sam Tobin-Hochstadt
dfef5b43fc Add --write option to fuzzer. 2015-09-23 15:49:18 -04:00
Sam Tobin-Hochstadt
57b4920234 Check that serialized procedures are the right kind of procedures.
Fixes http://drdr.racket-lang.org/31801/pkgs/racket-test/tests/racket/stress/fuzz.rkt
2015-09-23 15:49:18 -04:00
Sam Tobin-Hochstadt
d6ad89764b Add a few more pair checks. 2015-09-23 15:49:18 -04:00
Sam Tobin-Hochstadt
083029fa6f Add pair check in unmarshalling.
Closes #1070.
2015-09-23 15:49:18 -04:00
Matthew Flatt
aaf098f203 fix potential GC problem while setting up a place channel 2015-09-22 16:45:47 -06:00
Robby Findler
5a33856802 change or/c so that it takes the first ho projection
whose first-order predicate accepts a value, instead
of requiring that there be exactly one
2015-09-22 09:05:34 -05:00
Robby Findler
45b635f707 don't set permissions on windows, for now
(at some point hopefully we'll figure out
what's the right behavior here)

This is related to pull request #1060
2015-09-22 09:00:55 -05:00
Spencer Florence
35a0f0c71c make sure git checkout have correct perms 2015-09-21 14:17:51 -05:00
Matthew Flatt
003bca503f avoid compiler warnings 2015-09-20 21:13:27 -06:00
Matthew Flatt
93efe503ad fix misuse of comparison macro 2015-09-20 21:13:27 -06:00
Matthew Flatt
1d5b34f48b auto-detect when strip -S works for archives
Otherwise, don't try to strip archives such as "libracket3m.a".
2015-09-20 21:13:17 -06:00
Matthew Flatt
b37c07a280 Windows: generate "lib/msvc" content from cross-compile 2015-09-20 19:54:42 -06:00
Matthew Flatt
15797a7951 Windows: use same TLS strategy for both VC and MinGW in 64-bit mode 2015-09-20 19:17:15 -06:00
Matthew Flatt
8d43c73a0c windows: use same scheme_setjmp() protocol with all compilers 2015-09-20 18:13:59 -06:00
Matthew Flatt
6dfc20d3ec fix inferred-name propagation for internal-definition contexts
Set the name while checking for an immediate expansion when
no other forms follow.
2015-09-19 19:27:13 -06:00
Robby Findler
7ee29b0239 Revert permissions change because of appveyer error (that I
should have seen before pushing, sorry)

This reverts commit 47f36952d6.
This reverts commit 47776f343d.
2015-09-19 20:24:51 -05:00
Spencer Florence
47f36952d6 removed duplicate case 2015-09-19 20:21:50 -05:00
Spencer Florence
47776f343d make sure git checkout have correct perms 2015-09-19 20:21:50 -05:00
Matthew Flatt
bcc65ac92e GC: separate old-generation finalizers from now ones
Avoiding a traversals of old-generation finalizers can
save a couple of milliseconds for a minor GC in DrRacket.
2015-09-19 16:49:58 -06:00
Matthew Flatt
7ff1cf3619 avoid traversal of full page table when restoring mprotects
Overlooked this traversal at 50df879e79.
2015-09-19 15:16:30 -06:00
Matthew Flatt
584920b3a6 GC: clarify page field overloadings
Rename fields in a page record and split some of them with `union` to
better document the intent of each field.

This change is intended to have no effect on the GC's behavior. One
tricky case is the line dropped around line 3542 of "newgc.c". That
line reset `scan_boundary` (formerly `previous_size`), which on the
surface is inconsistent with leving objects before the boundary
without `marked` bits set. However, that line is reachable only
when geneation-1 objects are being marked (objects newly moved
there would not be unmarked), in which case `san_boundary` should
already be reset.
2015-09-19 14:06:26 -06:00
Matthew Flatt
658bac7f52 note on catalogs and building from a tag
Closes #1058.
2015-09-19 09:40:43 -06:00
Matthew Flatt
1ddaad8d58 xform: accomodate tokens like "10_1"
Those show up in the Mac OS X 10.11 SDK in `availability`
annotations.

Closes PR 15154
2015-09-19 09:19:43 -06:00
Matthew Flatt
9768f632a2 Disable static-library install for Windows or Mac OS X
Also, OS X `strip` needs `-S` for archives, in case a static-library
install is enabled.
2015-09-19 09:05:45 -06:00
Matthew Flatt
a75bdbf0a1 remove unused variable 2015-09-19 08:52:19 -06:00
Matthew Flatt
ee9d797906 fix file descriptor handling for poll() without epoll()
This problem could cause busy-waiting after a network connection
on Android, for example.
2015-09-19 08:16:30 -06:00
Matthew Flatt
fccd86d67d configure: --enable-racket=auto to simplify cross-compilation
Using `--enable-racket=auto` causes a Racket for the current platform
to be built in a "local" subdirectory of the build directory as
support for cross-compilation.
2015-09-18 21:56:20 -06:00
Matthew Flatt
a88d52bd34 configure: make --enable-libs on by default 2015-09-18 21:06:00 -06:00
Matthew Flatt
1a48418844 infrastructure for raco ctool --c-mods <dest> --runtime <dir>
Make the runtime-file gatherer, which is normally used by `raco exec`,
work also for modules prepared for an executable that embeds Racket.
2015-09-18 18:55:22 -06:00
Matthew Flatt
a9015e5484 GC: remove unmaintained counters 2015-09-18 12:40:14 -06:00
Matthew Flatt
40f9467c07 count phantom bytes as regular allocation
The original idea was to count phantom bytes as "administrative
overhead", but issues discussed in #962 identified problems
with that idea. Finish shifting the accounting to treat
phantom bytes as payload allocation.
2015-09-18 12:26:32 -06:00
Matthew Flatt
4abedf63e8 raco setup: don't try to "sync" a doc that isn't pre-rendered
On my machine, the sync path was sometimes triggered for "htdp-ptr".
(I'm not sure why; progress toward determinsitic bytecode might
be relevant.) Adjust the trigger for sync mode to check that the
needed "provides.sxref" file exists.
2015-09-18 11:53:35 -06:00
Matthew Flatt
0b9cda5018 avoid undefined behavior in hashing inexacts
Casting a negative floating-point number to an unsigned integer
is not ok. Corece to a signed integer, first.

Thanks to John Regehr for help.
2015-09-18 09:49:04 -06:00
Juan Francisco Cantero Hurtado
b7bcd4f687 Remove extra ')'.
Found by cppcheck.
2015-09-17 14:12:15 -06:00
Juan Francisco Cantero Hurtado
38661481ed Missing ')' in bool.c
Found by cppcheck.
2015-09-17 14:12:15 -06:00
Jack Firth
d305ceffe1 Refactor command-name 2015-09-17 14:11:50 -06:00
Jack Firth
c05db1ecf4 Refactor raco's tool listing code 2015-09-17 11:48:44 -06:00
Vincent St-Amour
9c123172fa Move srfi-related tests to srfi-test. 2015-09-16 13:53:52 -05:00
Vincent St-Amour
17b96cc5a1 Remove unused import. 2015-09-16 13:24:32 -05:00
Vincent St-Amour
4522d2167a Merge docs for new string functions. 2015-09-16 13:05:42 -05:00
Vincent St-Amour
2b1202a6a6 Add error checking to new string functions. 2015-09-16 13:05:41 -05:00
Vincent St-Amour
ae5b980e07 Add string-contains?.
From Ben Greenman.
2015-09-16 13:05:41 -05:00
ben
3fc4a64759 faster implementation of prefix/suffix 2015-09-16 13:05:41 -05:00
ben
85e5db38fb renamed string-startswith/endswith to string-prefix/suffix 2015-09-16 13:05:40 -05:00
ben
22cda63200 add string-startswith? and string-endswith? 2015-09-16 10:33:53 -05:00
Matthew Flatt
bcfd19c902 GC: don't double-count phantom bytes 2015-09-15 19:41:17 -06:00
Gustavo Massaccesi
21cc46e915 Fix typo in test 2015-09-15 20:19:36 -03:00
Matthew Flatt
0e35b5cfad fix misplaced flag
The misplacement of `SCHEME_PRIM_SOMETIMES_INLINED` caused the
optimizer to produce different results when the JIT is statically
disabled, for example.
2015-09-15 15:16:11 -06:00
Matthew Flatt
166d6fd8a3 GC: fix block_cache assumptions
Correct a mismatch for an internal API.
2015-09-15 15:16:11 -06:00
Matthew Flatt
2616b06570 fix problems with block-cache chunked mprotects
The problems don't show up with the current use of the block
cache, but repair mprotect tracking in case it matters in
the future.
2015-09-15 15:16:11 -06:00
Matthew Flatt
68f8d63222 fix problem with traversing closures for GC
This bug is an old one, in a sense, because travesing fields
in a closure could have moved the prefix with earlier versions
of the collector. It shows up now because we're changing fields
one indirection closer.
2015-09-15 15:16:11 -06:00
Matthew Flatt
0781d0fa46 GC: refine decision for old-generation compaction
Compact fewer blocks by moving them only when other
blocks have room.

Also, fix block protection tracking in the case of a page
count that isn't divisible by 8.
2015-09-15 15:16:11 -06:00
Matthew Flatt
3d69846046 GC: fuse mark and fixup passes, usually
In the common case of a minor GC without a generation 1/2
or a major GC without compaction, a single pass suffices
to both mark and update references.

This change reduces overall GC time by 10%-25% on typical
programs.
2015-09-15 15:16:11 -06:00
Matthew Flatt
28047789a9 remove "array of tagged" GC support
The GC supported allocation for an array of objects where
the first one provides a tag, but at this point it was
used only in some corners. Change those corner and simplify
the GC by removing support for arrays of tagged objects.

The main corner to clean up is in the handling of a macro-expansion
observer and inferred names. Move those into the compile-time
environment. It's possible that name inference has been
broken by the changes, but in addition to passing the tests,
the generated bytecode for the base collections is exactly the
same as before the change.
2015-09-15 15:16:10 -06:00
Matthew Flatt
bcd3d814fd GC: chunk mrpotect calls on old-page allocation
Although a block cache is set up to group most page-protection changes
into a single OS call, allocating new old-generation pages was not
covered. Adjust the block cache to group those.

This change has a small effect on performance, but it seems
better to have a few system calls in place of thousands.
2015-09-15 15:16:10 -06:00
Vincent St-Amour
7afdca2c55 Remove unused dependencies. 2015-09-15 11:45:58 -05:00
Vincent St-Amour
1e1b6ec32e Remove stray unstable dependency. 2015-09-14 16:54:06 -05:00
Vincent St-Amour
d1ad70b7a0 Remove mention of unstable. 2015-09-14 16:23:57 -05:00
Benjamin Greenman
dedde2cd60 typo: construct -> contract 2015-09-13 15:36:19 -05:00
Vincent St-Amour
aa0823daf6 Remove dependencies on unstable/error.
Involved moving part of its implementation to the db collection.
2015-09-13 15:29:36 -05:00
Vincent St-Amour
689c294e91 Remove dependency on unstable/error. 2015-09-13 15:29:36 -05:00
Vincent St-Amour
ca64ab5e23 Move unstable/error to unstable-lib. 2015-09-13 15:29:31 -05:00
Matthew Flatt
ab2aaff6be optimizer: fix let-values splitting and allocation reordering
First bug:

When the optimize converts

 (let-values ([(X ...) (values M ...)])
   ....)

to

 (let ([X M] ...)
   ....)

it incorrectly attached a virtual timestamp to each "[X M]" binding
that corresponds to the timestamp after the whole `(values M ...)`.

The solution is to approximate tracking the timestamp for invidual
expressions.

Second bug:

The compiler could reorder a continuation-capturing expression past
an allocation.

The solution is to track allocations with a new virtual clock.
2015-09-13 12:32:08 -06:00
Matthew Flatt
5ae7e54dac {eval,compile,expand}-syntax: install top-level fallback less often
Make `eval-syntax`, `compile-syntax`, and `expand-syntax` more
consistent (with intent and each other) by not installing a fallback
automatically. In particular, a fallback is not installed for a
`module` form, so that different ways of expanding a `module` form
produce consistent results (e.g., for ambiguous bindings).
2015-09-12 16:24:52 -06:00
Matthew Flatt
5401c5d179 racket/sandbox docs: clarify that collection modules are accessible 2015-09-12 13:21:04 -06:00
Gustavo Massaccesi
58895067c8 Remove nested begin0's added by sfs pass 2015-09-11 22:38:05 -03:00
Konrad Hinsen
a47800686c Fix match with (list-no-order p ..k) patterns
p ..k matches exactly k repetitions of p, but its documented
behavior is to match "k or more" repetitions. This fix implements
the documented behavior.

Fixes bug number 15122.
2015-09-11 21:34:02 -04:00
Juan Francisco Cantero Hurtado
4f5d8da278 Fix "require" in racket-benchmarks/places/symbols.rkt 2015-09-11 21:31:58 -04:00
Anthony Carrico
390e69fac5 Test format string and arguments mismatch error. 2015-09-11 20:42:39 -04:00
Anthony Carrico
181edfeec6 Format string and arguments match. 2015-09-11 20:42:39 -04:00
Sam Tobin-Hochstadt
78fc476e61 Reject relative paths in MANIFEST files when installing. 2015-09-11 20:30:14 -04:00
Sam Tobin-Hochstadt
17d69338a9 Remove obselete time config defines.
Removes `USE_FTIME`, `USE_PALMTIME`, `USE_MACTIME`, `TIME_SYNTAX`.
2015-09-11 20:30:14 -04:00
Matthew Flatt
0d3b5b61f0 untar, untgz, and unzip: add #:permissive?
Also, strengthen the checking that `#:permissive?` (off by default)
performs for `untar` and `untgz` to disallow a link whose target is an
absolute path or has an up-directory element.
2015-09-11 16:53:31 -06:00
Matthew Flatt
c7fac6e98e raco pkg catalog-archive: add a --pkg-fail option
Relevant to #1032
2015-09-11 16:53:31 -06:00
Matthew Flatt
c15d2f71d4 file/untar: fix handling of a broken tar file
Closes #1049
2015-09-11 16:53:31 -06:00
Matthew Flatt
696c9d972f prohibit directory indicators in "git:....?path=" as a package source
Closes #1027
2015-09-11 16:53:30 -06:00
Matthew Flatt
dcfb9cb972 raco pkg: make network-retries configurable 2015-09-11 16:53:30 -06:00
Matthew Flatt
29223aaed7 raco pkg: wrap network access with retries
Retry communication up to five times when `exn:fail:network`
is raised.

Not all `exn:fail:network` exceptions are transient. For example,
attempting to connect to a bad server name will produce an error more
slowly than before, since the bad connection will be tried five times.
Still, retrying on `exn:fail:network` seems like a good heuristic.
2015-09-11 16:53:30 -06:00
Alex Knauth
2923a3adcf syntax/parse: fix disappeared-use property in attribute macro
This fixes the DrRacket check syntax arrows in uses of `attribute` like this:
```racket
#lang racket/base
(require syntax/parse)
(syntax-parse #'a
  [a
   (attribute a)])
```
2015-09-11 17:35:25 -04:00
Ryan Culpepper
4f5c54db54 syntax/parse: fix use of evaluators in docs 2015-09-11 17:35:24 -04:00
Ryan Culpepper
808a6ca266 syntax/parse: remove ref to raise-syntax-error*
Copy and specialize raise-syntax-error*.
Also, taint the stxs in the exn raised.
2015-09-11 17:35:24 -04:00
Asumu Takikawa
52aa11c407 Propagate object inspectors in class/c wrappers
This makes reflection work on an instance of a contracted
class in the same way that it does on the original class.
2015-09-11 15:11:18 -04:00
Matthew Flatt
81ee1b39c7 change the (relatively new) argument to collect-garbage
Make the argument a symbol, 'major or 'minor, instead
of a boolean, because that allows further extension.
2015-09-11 12:07:35 -06:00
Matthew Flatt
c416db91c1 Fix shared-space marked-page chaining
Fixes a problem with a4910716e4, and adjusts place-specific
major GCs to use the already constructed chain instead
of reconstructing it.
2015-09-11 12:07:35 -06:00
Matthew Flatt
50df879e79 GC: adjust cleanup phase to not touch irrelevant page records
Fixes the last place where a minor collection touched a record
per allocated page.
2015-09-11 12:07:35 -06:00
Matthew Flatt
15271b673d GC: adjust fixup phase to not touch irrelevant page records
This is another step toward making a minor collections independent
of total allocation.
2015-09-11 12:07:34 -06:00
Ryan Culpepper
8d9eb05347 syntax/parse: accept #:context (list symbol/#f syntax)
The symbol is used as the "who" field in the error message.

Also fix lazy-require of runtime-report.rkt in residual.rkt; don't
load until syntax-parse actually needs to produce an error report.
(Previously was loaded to create handler whenever syntax-parse code ran.)
2015-09-10 21:49:21 -04:00
Asumu Takikawa
4c2a32d293 Document inspector of #f for make-struct-type 2015-09-10 15:36:22 -04:00
Matthew Flatt
bc929d4876 raco pkg install: more parallelism for catalog lookups
The layer to handle Git repo clones triggers an early catalog
lookup, so add prefetching there, too.
2015-09-10 08:59:24 -06:00
Matthew Flatt
24eb509d15 fix broken test
Test added in 8ee717520f was broken, because it used
`(current-milliseconds)` instead of `(current-ienxact-milliseconds)`
to construct an argument to`alarm-evt`'
2015-09-10 07:57:30 -06:00
Matthew Flatt
58cc3e91c3 fix 32-bit Windows build for MSVC 2012 and up 2015-09-10 06:19:29 -06:00
Matthew Flatt
5aebb1c539 raco pkg: get catalog info and checksums in parallel
When `raco pkg {install,update}` has a list of packages to check,
first run through the list in a "prefetch" mode to create futures to
fetch the information. Issuing requests to servers in parallel
can greatly speed up `raco pkg update --all`.

Package content is still downloaded sequentially.
2015-09-10 06:16:50 -06:00
Matthew Flatt
9bf68db7f7 raco pkg: use Git protocol for GitHub sources
Using the GitHub API for GitHub sources can run afoul of API
limits. Since we now support the Git protocol generall, use
that for GitHub sources, too.

Set the `PLT_USE_GITHUB_API` environment variable to use the
GitHub API, instead.
2015-09-09 14:15:31 -06:00
Matthew Flatt
e318257a7f support Visual Studio 2015
Closes #996
2015-09-09 13:34:31 -06:00
Matthew Flatt
c492f763c7 Visual Studio projects: put <PlatformToolset> in more places
Putting <PlatformToolset> in the new places makes the projects
work when more than one version of Visual Studio is installed.

Maybe the old place was always the wrong place, or maybe
VS 2010 wanted it in the old place. Either way, sprinkling
the version in more places seems unlikely to hurt.
2015-09-09 13:34:07 -06:00
Asumu Takikawa
c160302be7 Bump version number for rename transformer change
Refers to commit 33bb5e9060
2015-09-09 11:37:59 -04:00
Matthew Flatt
e0506038ba doc database: retry on SQLITE_READONLY_ROLLBACK
The SQLITE_READONLY_ROLLBACK error is supposed to mean that a crash
occurred and a hot journal exists that needs to be replayed (but
can't, because the current connection is read-only).

In practice, it seems that the error can happen even if there has been
no crash. In that case, retrying in the same was as other transient
errors allows the process to continue.

A possible reason for the spurious error: In the implementation of
SQLite, comments in hasHotJournal() mention the possibility of false
positives (ticket #3883) and how the false positive will be handled in
the playback mechanism after obtaining an exclusive lock. The check
for a read-only connection after hasHotJournal() is called, however,
happens before that lock is acquired. So, it seems like the race
condition could trigger a false SQLITE_READONLY_ROLLBACK error.
2015-09-09 06:47:34 -06:00
Matthew Flatt
707f888c83 make base: more complete avoidance of user-specific state
User-scope package installation matching the version of
Racket being built could affect the collections visible
during `raco setup` for `make base`. In particular, the
presence of `setup/scribble` could cause all built docs
to be discarded.

Also, add the `--no-user-path` flag to `racket` (which
has long been documented as an alias for `-U`).
2015-09-09 06:24:35 -06:00
Vincent St-Amour
965fa8e34c Start using failure-result/c in docs.
Not exhaustive, just what I could think of.
2015-09-08 17:11:26 -05:00
Vincent St-Amour
e358c49573 Add rename-contract, if/c and failure-result/c from unstable/contract. 2015-09-08 17:11:26 -05:00
Vincent St-Amour
147baa63f7 Add port-number? and listen-port-number? to racket/tcp.
From `unstable/contract`.
2015-09-08 17:11:26 -05:00
Vincent St-Amour
dc11eede98 Add links to docs. 2015-09-08 17:11:26 -05:00
Vincent St-Amour
5f43b3a913 Move non-empty-string? to racket/string.
From `unstable/contract`.
2015-09-08 17:11:26 -05:00
Matthew Flatt
261b7bde28 set-phantom-bytes!: fix tracking across generations 2015-09-08 15:29:09 -06:00
Asumu Takikawa
33bb5e9060 Make prop:rename-transformer accept a procedure
Allows the choice of target identifier to be delayed
until expansion time, rather than fixed at the point of
the transformer definition.
2015-09-08 13:29:13 -04:00
John Clements
a07ed4647e make path/param transparent 2015-09-08 09:06:44 -07:00
John Clements
98a861507f net: make #<url> structure transparent 2015-09-08 09:06:44 -07:00
John Clements
28d5ae19f9 http-client: don't try to gunzip an empty stream 2015-09-08 09:06:43 -07:00
Matthew Flatt
98b819edd4 enable some tests
Some tests that rely on a `main` submodule for places
need a `test` submodule, too.
2015-09-08 07:39:48 -06:00
Matthew Flatt
8394936ee0 collapse copied code in GC 2015-09-08 07:39:48 -06:00
Matthew Flatt
37c4ea4720 GC: adjust backpointer marking to not touch other page records
Also, free medium pages for a terminated place.
2015-09-08 07:39:48 -06:00
Matthew Flatt
9372862ee2 GC: move minor work to clean-up phase instead of setup 2015-09-08 07:39:48 -06:00
Matthew Flatt
7eee429705 avoid traversing table of JITted code names on every GC
The table as a tree is traversed to prune empty branches,
but the travseral is needed only toward branches that
have changed. Skipping the traversal can save several
milliseconds on each collection.
2015-09-08 07:39:48 -06:00
Matthew Flatt
c401d86bb3 streamline name handling in make-struct-type
Name handling formerly interned symbols along the
way to allocating a plain string, which takes effort
and causes changes to the symbol table, which forces
a minor GC to traverse the whole symbol table. Skip
unnecessary symbol-interning steps.
2015-09-08 07:39:48 -06:00
Matthew Flatt
0ab94dd3e4 force GC more appropriately on phantom bytes
When the number of bytes recorded via phantom bytes approaches memory
use at the last GC, force a garbage collection.
2015-09-08 07:39:48 -06:00
Gustavo Massaccesi
27791ebab7 Remove ignored call/cc
Reduce (call/cc (lambda (<ignored>) body ...)) to (begin body ...)
2015-09-08 09:13:44 -03:00
Vincent St-Amour
d705e928ac Add a mode argument to pretty-format.
... which controls whether it uses `print`, `write` or `display`.

Obsoletes most of `unstable/pretty`.
2015-09-07 15:46:58 -05:00
Matthew Flatt
3963f30070 document new configure-runtime behavior of raco test 2015-09-07 11:58:41 -06:00
Brian Lachance
e0f2d9c0d6 Fix make-contract example to show the correct contract violation
There was a duplicate quote around `given:' which caused a violation in
make-contract's internals.
2015-09-07 11:58:13 -05:00
Matthew Flatt
e1333d0616 fix compilation-top contract in docs
The associated change in the "zo-lib" package fixes #1038.
2015-09-07 08:28:52 -06:00
Matthew Flatt
5ca752c92b fix problems with internal calls to syntax-track-origin 2015-09-07 08:22:21 -06:00
Matthew Flatt
c1ef6b999d fix documentation's contract for syntax-track-origin 2015-09-07 07:48:43 -06:00
Matthew Flatt
4cb74da76c add patch for Mac OS X build of Cairo
Pull in a patch to avoid CGFontGetGlyphPath, which is deprecated.
2015-09-06 17:18:35 -06:00
Matthew Flatt
8566c67b35 make syntax-object unmarshaling more accepting
Defend against certain bad encodings, but accept an encoding
that includes more sharing than the built-in marshaling
could create.
2015-09-06 16:37:31 -06:00
Spencer Florence
3018417249 added args checking to prefix functions 2015-09-06 15:28:53 -05:00
Matthew Flatt
079f46fbc1 adjust top-level handling for identifiers without #%top
Refine the changes in 16c198805b so that `(define id ... id ... )` at
the top level compiles more consistently when `id` is an identifier
whose lexical context does not include `#%top`.
2015-09-06 08:06:07 -06:00
Matthew Flatt
9c51370e51 repair extract-base-filename/ext and extract-base-filename/o 2015-09-05 17:59:44 -06:00
Matthew Flatt
06841bbaff doc typo and clarification 2015-09-05 17:59:19 -06:00
Matthew Flatt
c3f876d2f7 fix bug in mashaling paths
The change in commit fb8e08a2ac could lose part of a relative path.
2015-09-05 14:09:38 -06:00
Matthew Flatt
16c198805b prevent compile from binding in the current namespace
When `compile` is used on a top-level definition, do not
create a binding in the current namespace, but arrange for
a suitable binding to be in place for the target namespace.

Closes #1036
2015-09-05 10:58:44 -06:00
Matthew Flatt
24592f78fc ffi/unsafe/objc: add support for blocks
Also add some functions for manipualting classes and objects.
2015-09-04 08:31:52 -06:00
Vincent St-Amour
053aae7b59 Prefix property name 2015-09-03 14:08:02 -05:00
Daniel Feltey
6e5d443d7d Rename syntax property to avoid a name suggesting it is only useful for Typed Racket 2015-09-03 14:05:49 -05:00
Daniel Feltey
dc19e9c9b2 Clarify syntax property further 2015-09-03 14:05:49 -05:00
Daniel Feltey
7b513e1103 Internal documentation for init-depend syntax property 2015-09-03 14:05:49 -05:00
Daniel Feltey
b3fe6bb778 Handle tags in case this syntax-property may have uses outside of Typed Racket 2015-09-03 14:05:49 -05:00
Daniel Feltey
9b7e1767dd Add syntax property with static init-depend information to compound-unit/infer results 2015-09-03 14:05:48 -05:00
Matthew Flatt
ddb683e1f2 unbreak compile-directory 2015-09-02 18:21:38 -06:00
Matthew Flatt
8ee717520f fix sync when resumed after a break exception
This repair adjusts the bug fix of commit 769ad3e98. That older commit
ensured that `sync/enable-break` doesn't both break and accept a
channel message or semaphore wait. But it effectively disables those
actions if the break is continued.

Instead of (partially!) ending the `sync` get out of semaphore
and channel queues so that no event can be selected during
the break, and then get back in line if the break is continued.
2015-09-02 18:21:38 -06:00
Matthew Flatt
322714f123 untar and unzip: reject paths that contain ".."
Also, for unzip, reject absolute paths.
2015-09-02 18:21:38 -06:00
Matthew Flatt
efe056f18d update documentation for preserved syntax-object source locations 2015-09-02 18:21:38 -06:00
Matthew Flatt
fb8e08a2ac adjust path encoding in bytecode and syntax-object sources
When a path is made relative for marshaling to bytecode, record
a list of byte strings in stead of a platform-specific relative
path.

For syntax-object source locations, convert any non-relative path to a
string that shows just the last couple of path elements preceded by
".../". This conversion avoids embedding absolute paths in bytecode,
but at the cost of some information. A more complete and consistent
solution would invove using a module-path index instead of a path, but
that would be a big change at several layers.
2015-09-02 18:21:38 -06:00
Matthew Flatt
a934bdf444 Adjust the bytecode format to accomodate syntax source locations
Make room in the bytecode format for source locations and 'paren-shape
property values for syntax objects. Saving source locations increases
bytecode size by about 10% on average.

Also, convert the internal representation of syntax properties to
use immutable hash tables, instead of lists.
2015-09-02 14:49:39 -06:00
Matthew Flatt
53821a4997 intern path values in bytecode 2015-09-01 15:54:41 -06:00
Matthew Flatt
929db29b67 add prop:expansion-contexts
The `prop:expansion-contexts` property can control the expansion
of a rename transformer in much the same that conditionals on
`(syntax-local-context)` can control the expansion of other
transformers.
2015-09-01 13:55:35 -06:00
Gustavo Massaccesi
c290de0f88 Fix typos 2015-09-01 11:46:41 -05:00
Daniel Feltey
4fefec6386 Add test case
Closes PR 15139
2015-09-01 11:46:40 -05:00
Daniel Feltey
450ea8236d Bug fix for calculating init-dependencies when subtyping is involved. 2015-09-01 11:46:40 -05:00
Robby Findler
13964c4141 add and use late-neg projections to the contract system
These avoid one layer of currying and are more efficient, getting
about a 1.3x speed up on this program:

 #lang racket/base
(module server racket/base
  (require racket/contract/base)
  (provide
   (contract-out
    [f (-> integer? boolean? char? void?)]))
  (define (f i b c) (void)))

(require (submod "." server))

(time
  (for ([x (in-range 10000000)])
    (f 1 #t #\x)))
2015-08-31 20:48:03 -05:00
Matthew Flatt
f09c78b5f4 racket/unit: fix #:omit-constructor
Closes #1006, with a test case based on that report.
2015-08-31 16:22:12 -06:00
Blake Johnson
38317b87c2 setting the imported flag on toplevels 2015-08-31 16:13:08 -06:00
Matthew Flatt
9c0b6593b6 filesystem-change-evt: wide paths for Windows 2015-08-30 12:20:40 -06:00
Matthew Flatt
73e5313e1c fix starter icons for Windows cross-compile 2015-08-30 10:58:07 -06:00
Matthew Flatt
9aba66b608 makefile target for creating a native executable for cross compiling 2015-08-30 08:14:04 -06:00
Matthew Flatt
1b778bf34b fix GRacket paths for MinGW build 2015-08-30 07:01:10 -06:00
Matthew Flatt
ad4dcdeac0 cross-compilation support in the top-level makefile 2015-08-29 20:54:27 -06:00
Matthew Flatt
0e4d9a68af fix executable creation for cross-installation 2015-08-29 20:54:27 -06:00
Matthew Flatt
6beff43439 fix expand[-syntax[-to-top-form]] to add namespace's scope
Make `expand` more consistent with `eval` and with the old expander.
2015-08-29 11:44:33 -06:00
Matthew Flatt
94e5b1723b JIT simplification
Remove unused and confusing attempt to avoid runstack sync.
2015-08-28 20:24:46 -06:00
Matthew Flatt
ab6b58a476 avoid compiler warning 2015-08-28 20:21:29 -06:00
Gustavo Massaccesi
152787cb0e JIT: inline string=? and bytes=? 2015-08-28 20:57:39 -03:00
Matthew Flatt
79738d3bf6 fix no-places build 2015-08-28 17:27:17 -06:00
Matthew Flatt
bfb4d34715 fix memory accounting for useless channels
Fix accounting for a channel that is without a
peer for sending and/or receiving.
2015-08-28 17:05:38 -06:00
Matthew Flatt
b016246096 avoid interferences among places for memory accounting
All places uses the same accounting bit for objects
that are in the shared space. Each place also flips
the bit value it wants on each accounting, so if two
places are accounting at the same time with opposite
bit values and can reach the same objects, they can
interefere. It's even possible for them to race
through cycles and cause each other to loop forever.

Add a lock to ensure that there's only one bit value
in play for the shared space at any given time. A
place must stall if other places are busy with memory
accounting and an opposite bit value.
2015-08-28 17:05:37 -06:00
Matthew Flatt
a9078196b7 fix GC problem with in-flight place messages
While a place message is received by a thread but not yet
deserialized, if the message contains references to objects in the
shared space, and if a "master" GC happens (which crosses all places),
make sure that the references in the still-serialized message are
traversed.
2015-08-28 17:05:37 -06:00
Matthew Flatt
2773737c9c avoid races in marking shared-space objects
Although the race condition for setting mark bits
shouldn't matter, reasoning about the race is
difficult and asking for trouble, so don't do it.
2015-08-28 17:05:37 -06:00
Matthew Flatt
460743021d fix over-counting of place-message channel memory 2015-08-28 17:05:37 -06:00
Robby Findler
a6e42858f4 add a commented out specialization of (-> void)
This is the most common contract created for -> (at 318 occurrences
out of the 6515 arrow contracts created when DrRacket starts up)
but this specialization doesn't seem to actually improve the performance
much. Leave it in for now, in case the story changes at some point
in the future
2015-08-27 17:01:30 -05:00
Matthew Flatt
d71832f20e another MSVC MzCOM repair
Missed a line that was meant to be included with
commit a98947e81e.
2015-08-27 14:35:55 -06:00
Vincent St-Amour
4eeb164d31 Remove dependency on unstable/flonum. 2015-08-27 14:28:36 -05:00
Matthew Flatt
29784bda8e add cross-system-type and cross-system-library-subpath
Adjust installation tools to support cross-installation (i.e.,
installation for a platform other than the current one) as triggered
by "system.rktd" in "lib" having different information than the
running Racket executable.
2015-08-27 12:01:31 -06:00
Matthew Flatt
a98947e81e fix MSVC MzCOM build 2015-08-27 10:00:54 -06:00
Matthew Flatt
d4fb5ecec5 fix "GRacket.exe" capilization for MinGW build 2015-08-27 08:44:10 -06:00
Matthew Flatt
a3972487fb unbreak Linux build 2015-08-27 07:10:08 -06:00
Matthew Flatt
2a9022945d support for building MzCOM with MinGW 2015-08-26 14:07:19 -06:00
Matthew Flatt
828aff1476 unbreak non-Windows build 2015-08-26 10:02:02 -06:00
Matthew Flatt
ba7e2f11ec repair MinGW32 builds
Also, change floating-point handling to be like the MSVC build by
default, where the process is left in double-precision mode and
the mode is changed for exfl operations.

Includes repairs for integer-size mismatches in uses of Windows
threads.
2015-08-26 07:00:51 -06:00
Asumu Takikawa
fadcb78ffa Fixes to prop:rename-transformer
The error message for the guard used an incorrect contract.
Also removed an unused line that allows a box value in the
property. I don't think it was possible to trigger this line
anyway because of the dynamic check.
2015-08-25 08:20:49 -06:00
Blake Johnson
d86ccb1330 initializing ui->closures in the right place 2015-08-25 08:11:26 -06:00
Robby Findler
a1e6c94fda lift a few fewer negative parties 2015-08-25 05:09:28 -05:00
Matthew Flatt
3d452fdba6 raco exe: make Windows exes as proper PE32 images
Instead of simply tacking bytecode onto the end of an executable,
generate a proper PE32 image.
2015-08-24 17:12:11 -06:00
Matthew Flatt
d16c5c08b6 Windows: update default icons
Includes a 256x256 icon.
2015-08-24 17:12:11 -06:00
Matthew Flatt
96292cdf27 raco exe --ico: replace icon set wholesale
Use exactly the icons in the given icon file for the executable,
instead of coercing to the sizes and depths already in the executable.
2015-08-24 15:08:21 -06:00
Matthew Flatt
e2b27be099 file/ico: support PNG icons and arbitrary icon-set replacement
Support PNG-encoded icons in ".ico" files and executables.

For executables, instead of supporting only new icons that match the
sizes and encodings of existing icons in an executable, support
arbitrary replacement icons in an executable.

The improved funcitonality relies on a new library (currently
private) for general updates to a Windows executable's
resources.
2015-08-24 15:08:21 -06:00
Matthew Flatt
b9a5e92c37 file-truncate: flush on Windows before truncating
Otherwise, writes to the output port can get lost.
2015-08-24 15:08:21 -06:00
Matthew Flatt
cbb4ffee4d JIT: replace a multiplcation with a shift
In the implementation of `with-continuation-mark`.
2015-08-24 12:20:31 -06:00
Matthew Flatt
620ccbfa03 JIT: streamline values result delivered to let-values
In a case like

  (let-values ([(X ...) (with-continuation-mark M_k M_v
                          (values M ...))])
     ....)

where the bytecode compiler cannot convert to a sequence of `let`
bindings, make the JIT implement `values` as delivering argument
results directly to the corresponding variable locations.
2015-08-24 12:20:30 -06:00
Leif Andersen
c0dac75b7d Fix typo in zo structs documentation:
Which -> When
2015-08-24 12:19:57 -04:00
Robby Findler
b7f500fc26 create the blame+neg-party pair only once, not once for the domain
and once for the range
2015-08-23 23:18:14 -05:00
Matthew Flatt
49c4d9272f change let/cc and let/ec macros back to call/cc and call/ec
When `call/cc` and `call/ec` were moved out of `#%kernel`, the
`let/cc` and `let/ec` macros changed to refer to
`call-with-current-continuation` and `call-with-escape-continuation`.
Move `call/cc` and `call/ec` again and restore the macros, so that
matching on the expansion of the macros (e.g,. in the web server's
language that looks for `call/cc`) work as before.
2015-08-23 10:58:04 -06:00
Robby Findler
0c31a0c0b8 add some missing contract profiler wcm expressions and start a test suite for them 2015-08-22 20:22:00 -05:00
Ryan Culpepper
70ab4cfb12 fix date*->seconds handling of nanoseconds field 2015-08-22 19:33:57 -04:00
Matthew Flatt
66df8a2b9f document raco test conversion to get-module-suffixes 2015-08-22 09:48:46 -06:00
Matthew Flatt
a135c78baf add module-suffixes and doc-module-suffixes to "info.rkt"
A `module-suffixes` entry in a collection's "info.rkt" adds a
file suffix that is meant to be recognized globally (i.e., in
all collections) by all Racket tools.

The new fields are reported by `compiler/module-suffix` library, which
is (so far) used by `raco setup`.

Note that if package A includes files with a suffix that is registered
by package B, then A should have a dependency on B, but `raco setup`
cannot currently detect that such a dependency is needed. That
dependency is likely to happen, anyway, since package A is likely
using libraries form package B.
2015-08-22 09:36:19 -06:00
Matthew Flatt
f63220682b add support for compile-include-files as an "info.rkt" field
The `compile-include-files` entry lists additional files to be
compiled (when their extensions do not trigger compilation).
2015-08-22 07:41:49 -06:00
Matthew Flatt
787500f339 reduce timestamp adjustments in raco pkg create
Comments in the implementation suggest that a timestamp
specialization was intended for directories, which makes
sense given that directory-modification dates are
not preserved when unpacking an archive. The change
also affected all bytecode timestamps, however, which
can create inconsistencies across package creations.
2015-08-21 18:55:12 -06:00
Robby Findler
725536b8b4 add missing contract checking 2015-08-20 15:41:29 -05:00
Sam Tobin-Hochstadt
0ba2d30fed Increse place-channel test timeout. 2015-08-20 14:12:56 -04:00
Sam Tobin-Hochstadt
d63d3e603e Increase timeout. 2015-08-19 19:13:41 -04:00
Vincent St-Amour
ac462be47c Fix uses of unstable/struct. 2015-08-19 15:07:26 -05:00
Vincent St-Amour
e5a024b02e Move struct->list docs from unstable docs. 2015-08-19 15:07:25 -05:00
Vincent St-Amour
ed70381d70 Move rest of unstable/struct to unstable-lib. 2015-08-19 15:07:25 -05:00
Vincent St-Amour
5ce75816c5 Move struct->list to racket/struct. 2015-08-19 15:07:25 -05:00
Vincent St-Amour
13b6a98de6 Move docs for make-constructor-style-printer from unstable docs. 2015-08-19 15:07:25 -05:00
Vincent St-Amour
5c9995ee9a Move unstable/custom-write to unstable-lib. 2015-08-19 15:07:25 -05:00
Blake Johnson
674ab66d7b Added support for ref args in lifts to unresolver 2015-08-18 14:40:41 -06:00
Matthew Flatt
7371ab0cc2 remove accidentally added file 2015-08-18 14:40:41 -06:00
Vincent St-Amour
1079b2b790 Move unstable/socket to its own package. 2015-08-18 14:03:03 -05:00
Matthew Flatt
629697d14a remove accidentally added file 2015-08-17 12:36:51 -06:00
Matthew Flatt
1b493f2146 fix MzCOM's atexit replacement 2015-08-17 10:16:02 -06:00
Matthew Flatt
641c56b6e9 repair leak in managing OS-level locks 2015-08-17 09:51:20 -06:00
Matthew Flatt
693cdc673d GC: use ofm_malloc() and ofm_free() for admin allocation
Using ofm_....() makes it easier to check that memory allocated for GC
administrtation is itself reclaimed.
2015-08-17 09:39:11 -06:00
Matthew Flatt
fea2b1ce5e repairs for MinGW build
Fix compiler warnings and installation bugs related to the
".exe" extension.
2015-08-17 08:32:12 -06:00
Matthew Flatt
a3e359d9e1 refine use of "Unix" in the installation instructions
Based on a suggestion from enedil <enedil@outlook.com>, avoid
suggesting that OS X is not Unix or that Linux is truly Unix.
2015-08-17 07:22:07 -06:00
边城
5d9f63d800 Better description
Better description about "binary-keep-files"
2015-08-17 06:59:11 -06:00
Sam Tobin-Hochstadt
dfd2c6dc68 Hide output to work around racket/rackunit#5. 2015-08-16 18:55:36 -04:00
Jay McCarthy
faa1028ef6 Merge pull request #1014 from geoffhill/master
write-xexpr: consistently use argument port.
2015-08-15 07:22:05 -04:00
Geoff Hill
be66fde64c write-xexpr: consistently use parameter port. 2015-08-15 00:41:46 -07:00
Gustavo Massaccesi
1753335d34 Fix string-replace when the string is mutable
The `from` string argument is converted to a regexp and cached. When `from` is
a mutable string this can cause wrong results in the following calls
to string-replace. So the string is first converted to an immutable string to
be used as the key for the cache.
2015-08-14 21:17:48 -03:00
Matthew Flatt
80aac79507 change place to create a submodule
When `place` expands, the body of the `place` form is placed into a
`(module* place-body-<n> #f ....)` submodule.

The `place` form previously placed its body in a lifted function,
where the function's exported name was based on
`(current-inexact-milliseconds)`. The generated submodules have
deterministic names, so that compilation is deterministic, and
submodule names don't collide (unlike exported function names) when
multiple `place`-using module are imported into some other module.
Also, using a submodule avoids the problem that the clock doesn't
change fast enough on Windows.
2015-08-14 17:55:47 -06:00
Matthew Flatt
0caf079637 add syntax-local-lift-module 2015-08-14 16:52:56 -06:00
Matthew Flatt
dbd5470805 move call/cc and call/ec to racket/private/more-scheme
Those aliases were moved out of `#%kernel` as part of the
determinstic-bytecode changes, but putting them in
`racket/private/pre-base` meant that they weren't included in
`mzscheme` or Pretty Big. The new location is with `let/cc`, which
makes more sense, and makes them picked up by `mzscheme` and Pretty
Big.
2015-08-14 07:45:47 -06:00
Matthew Flatt
111a7e085d fix prefab checking in printer
Mishandling of a chaproned prefab when, for example, determining
whether to use quoted printing caused the `tests/compiler/zo` test to
sometimes fail.
2015-08-14 07:28:37 -06:00
Matthew Flatt
e82e61e84c restore needed call in unresolver
Add back a call incorrectly removed in bd82646d81.
2015-08-13 18:22:51 -06:00
Matthew Flatt
c57fb2d1ce fix setup/collection-search test 2015-08-13 18:20:24 -06:00
Matthew Flatt
cfa1d39166 add compiler/exe-dylib-path
Provide a clean interface to a private library for updating
dynamic-library paths in Mac executables.
2015-08-13 17:06:55 -06:00
Gustavo Massaccesi
07816f2ca4 Use scheme_getenv in eval.c 2015-08-13 19:05:40 -03:00
Matthew Flatt
15eadbb868 copy-directory/files: add #:preserve-links? argument 2015-08-13 15:13:46 -06:00
Blake Johnson
12315ec964 using correct inspector for unresolved module 2015-08-13 15:13:46 -06:00
Juan Francisco Cantero Hurtado
f3098a946a Fix an error in racket-test-core/number.rktl on OpenBSD-current/sparc64
"Errors were:
(Section (got expected (call)))
((numbers) (0.0 -0.0 (#<procedure:round> -0.0)))
((numbers) (125.0+0.0i 125.0-0.0i (#<procedure:z-round> 125.00000000000023-0.0i)))
((numbers) (100.0+0.0i 100.0-0.0i (#<procedure:z-round> 99.99999999999999-0.0i)))"
2015-08-13 15:13:46 -06:00
Matthew Flatt
33cf716835 include phantom bytes consistently in memory-use reports 2015-08-13 15:13:46 -06:00
Alex Knauth
3c5ed5d8e1 syntax-parse: keep more srclocs in attribute bindings
to cooperate more with DrRacket check-syntax arrows
2015-08-13 15:35:35 -05:00
Vincent St-Amour
c50eeeecc9 Fix history annotations.
Version changed while the PR was up.
2015-08-13 14:43:57 -05:00
Vincent St-Amour
033d5afb19 Revert adding in-pairs to racket/sequence.
`in-dict` is more general, and `for` loops optimize it already.
2015-08-13 14:43:57 -05:00
Vincent St-Amour
52425fbb27 Add history notes. 2015-08-13 14:43:57 -05:00
Vincent St-Amour
1b0350ec0a Add more tests. 2015-08-13 14:43:56 -05:00
Vincent St-Amour
8b1859b77d Move tests for the new bits of racket/sequence from unstable/sequence tests. 2015-08-13 14:43:56 -05:00
Vincent St-Amour
63b1f0f4aa Improve docs for the new bits of racket/sequence. 2015-08-13 14:43:56 -05:00
Vincent St-Amour
f4f75f2740 Move docs for part of unstable/sequence to the racket/sequence docs. 2015-08-13 14:43:56 -05:00
Vincent St-Amour
9508c251ee Move rest of unstable/sequence to unstable-lib. 2015-08-13 14:43:56 -05:00
Vincent St-Amour
36bb0e568c Merge part of unstable/syntax with racket/syntax. 2015-08-13 14:43:56 -05:00
Vincent St-Amour
1a7b71fb20 Improve the implementation of in-slice. 2015-08-13 14:43:56 -05:00
Vincent St-Amour
2d23ca1414 Make doc section title more accurate. 2015-08-13 14:43:56 -05:00
Matthew Flatt
bd82646d81 avoid compiler warnings 2015-08-13 11:57:06 -06:00
Matthew Flatt
7d6bec2b17 increase timeout for "determistic-zo.rkt" test 2015-08-13 11:51:23 -06:00
Matthew Flatt
7741b4b361 local-expand: fix argument checking
Also, fix contract in the docs, since the first argument is allowed to
be an S-expression.
2015-08-13 11:48:20 -06:00
Matthew Flatt
86ee9c5071 signature-members: adjust element ids based on reference
Make the resulting content ids compatible with binding and reference
at a use site, as needed for the new macro expander.
2015-08-13 10:44:26 -06:00
Ryan Culpepper
aee93fb200 added racket/struct with make-constructor-style-printer 2015-08-12 18:42:29 -04:00
Ryan Culpepper
0f6e2f8029 change sets to use make-constructor-style-printer 2015-08-12 18:42:29 -04:00
Ryan Culpepper
59300afbef add racket/private/custom-write 2015-08-12 18:42:29 -04:00
Matthew Flatt
02574d2501 SGC: use PRIdPTR and PRIxPTR
Avoid compiler warnings by using the right format string.
2015-08-12 14:48:11 -06:00
Tim Brown
3f53d214c6 url-exception? exported wrongly 2015-08-12 11:20:10 -05:00
Tim Brown
9473f394b7 url-strings: Separate URL parsing from URL actions
`net/url` provides functions for both converting strings
and paths to and from URLs.

`net/url` also includes functions for creating (pure and import)
network ports. This functionality `require` the HTTP client stack
which is unnecessary when URLs simple need parsing for their
"bits".

New library: `net/url-strings` handles `url->string` and `string->url`
(and also the related `path->url` and `url->path` functions). This is
required by net/url for compatability.

`net/url-exception.rkt` is factored out for use by both libraries.

- See also racket/net changes for T&D

url-string.rkt changes requested by mflatt

url-strings.rkt is now called url-string.rkt

identifiers from url-string.rkt are reprovided by url.rkt
using (all-from-out "url-string.rkt") instead of explicit
exports
2015-08-12 11:20:10 -05:00
Asumu Takikawa
a970f9bf6e Fix a few cases of "it's" instead of "its" in docs 2015-08-11 21:29:22 -04:00
Ryan Culpepper
3e2b916f5b annotated common version list for openssl libs 2015-08-11 18:43:35 -04:00
Ryan Culpepper
6bbcbfb3d4 fix rendering of multi-line syntax errors 2015-08-11 18:43:35 -04:00
Ryan Culpepper
49dc0625d4 more detail in openssl error 2015-08-11 18:43:34 -04:00
Matthew Flatt
956d538164 fix missing zero of allocated atomic memory in unresolver 2015-08-11 16:01:54 -06:00
Blake Johnson
d39801c937 ref_args off by one 2015-08-11 16:01:54 -06:00
Matthew Flatt
13bd013528 fix JIT-inlined set-cpointer-tag! for non-x86 2015-08-11 16:01:53 -06:00
Matthew Flatt
820ab7126c fix enum mismatch in ARM JIT
Also, recognize `__ARM_ARCH_6ZK__`.
2015-08-11 16:01:53 -06:00
Daniel Feltey
b16f0b24b7 Improvements to unit/c contracts in preparation for unit support in typed/racket
Changes:

 - Allow unit contracts to import and export the same signature.
 - Add "invoke" contracts that will wrap the result of invoking a unit contract,
   no wrapping occurs when a body contract is not specified
 - Improve error messages
 - Support for init-depend clauses in unit contracts.
 - Fix documentation to refelct the above
 - Overhaul of unit related tests

Handling init-depend clauses in unit contracts is a rather large and somewhat
non-backwards-compatible change to unit contracts. Unit contracts must now
specify at least as many initialization dependencies as the unit value being
contracted, but may include more. These new dependencies are now actually
specified in the unit wrapper so that they will be checked by compound-unit
expressions.

This commit also adds more information to the first-order-check
error messages. If a unit imports tagged signatures, previously the errror
message did not specify which tag was missing from the unit contract. Now
the tag is printed along with the signature name.

Documentation has been edited to reflect the changes to unit/c contracts
made by this commit.

Additionally this commit overhauls all tests for units and unit contracts.
Test cases now actually check that expected error messages are triggered when
checking contract, syntax, and runtime errors. Test forms now expand into uses
of rackunit's check-exn form so only test failures are reported and all tests in
a file are run on every run of the test file.
2015-08-11 16:30:39 -05:00
Asumu Takikawa
1d99ced2ea Add caveat for free-id-tables & changing bindings 2015-08-11 12:11:53 -04:00
边城
6fe8f635e4 update packges sources
Add Racket package manager to package sources
2015-08-11 08:06:34 -06:00
Georges Dupéron
666da0b215 In the docs for normal-case-path, replaced “letter” with “character”, to avoid possible confusion with drive letters. 2015-08-11 07:59:23 -06:00
Georges Dupéron
22bf10e564 Fixed typo in the docs for normal-case-path. 2015-08-11 07:59:23 -06:00
Matthew Flatt
1757348b23 repairs for MSVC
Don't use `for (int i ....`, which is too modern.
2015-08-10 17:14:09 -06:00
Matthew Flatt
335db1d1fb update "base" version 2015-08-10 17:10:11 -06:00
Blake Johnson
fbe8537f18 add compiled-expression-recompile
Uses an unresolver pass, which is expanded to work on more programs.
2015-08-10 16:39:43 -06:00
Vincent St-Amour
d66da8ff3b Fix argument order in guide.
Closes PR15131.
2015-08-10 11:56:33 -05:00
Vincent St-Amour
e9e7e42b64 Fix generics tests for hashing change. 2015-08-09 10:50:50 -05:00
Asumu Takikawa
9f682a3f11 Add prefab structs to match grammar 2015-08-07 20:11:52 -04:00
Stephen Chang
fe2e480ef1 syntax/parse doc typo in ~describe 2015-08-07 18:40:14 -04:00
Matthew Flatt
2661d46929 toward deterministic bytecode generation
Progress toward making the bytecode compiler deterministic, so that a
fresh `make base` always produces exactly the same bytecode from the
same sources. Most changes involve avoiding hash-table order
dependencies and adjusting scope identity. The namespace used to load
a reader extension is also better defined. Plus many other little
changes.

The identity of a scope that is unmarshaled from a bytecode file now
incorporates the hash of the file, and the relative order of scopes is
preserved in a bytecode file. This combination allows compilation to
start with modules that loaded and compiled in different orders
(including delayed loading of bytecode fragments within one file).

Formerly, a reader extension triggered by `#lang` or `#reader` was
loaded in whatever namespace happens to be current. That's
unpredictable and can pollute a module build at the level of bytecode.
To help make builds deterministic, reader extensions are now loaded in
a root namespace of the current namespace.

Deterministic compilation in general relies on deterministic macros.
The two most common ways for a macro to be non-deterministic are by
using `gensym` (use `generate-temporaries`, instead) and by using an
unsorted hash-table traversal (don't do that).

At this point, bytecode generation is unlikely to be completely
deterministic, since I uncovered non-determinism mostly by iterating
attempts over the base collections. For now, the intent is not to
provide guarantees outside of the compilation of the base collections
--- but "more deterministic" is likely to be useful in the short run,
and we can improve further in the long run.
2015-08-07 15:48:39 -06:00
Matthew Flatt
a55eed9718 fix data/integer-set for 32-bit platforms 2015-08-07 05:30:26 -06:00
Matthew Flatt
0efd052218 fix single-float hashing 2015-08-07 05:30:25 -06:00
Matthew Flatt
6bcb449b55 fix impersonator-property:application-mark propagation
Propagate the mark value only if it's on the current continuation
frame, as originally intended. Adjust the docs to clarify.
2015-08-07 05:30:25 -06:00
Matthew Flatt
27fed2b1ed document compiler/zo-struct changes for new bytecode form 2015-08-07 05:30:25 -06:00
Matthew Flatt
0480f55f67 add with-immediate-continuation-mark bytecode form
Specialize a
  (call-with-immediate-continuation-mark _key (lambda (_arg) _body) _def-val)
call to an internal
  (with-immediate-continuation-mark [_arg (#%immediate _key _def_val)] _body)
form, which avoids a closure allocation and more.

This optimization is useful for contracts, which use
`call-with-immediate-continuation-mark` to avoid redundant
contract checks.
2015-08-07 05:30:25 -06:00
Matthew Flatt
c308915047 minor streamlining of foreign-call path
JIT-inline `cpointer-tag` and `set-cpointer-tag!`, plus minor
shortcuts and GC hints in Racket->C conversion.
2015-08-06 14:44:30 -06:00
Matthew Flatt
d34416ea02 define-inline: fix call with multiple keyword arguments 2015-08-06 14:44:30 -06:00
Vincent St-Amour
7b70a42361 Move unstable/syntax to unstable-lib. 2015-08-05 13:11:55 -05:00
Vincent St-Amour
5ee37920f5 Move phase-of-enclosing-module to a private syntax/parse module. 2015-08-05 13:11:55 -05:00
Vincent St-Amour
d836a427cc Remove unused dependency on unstable/syntax.
This revealed a missing dependency to racket/syntax elsewhere.
2015-08-05 13:11:55 -05:00
Vincent St-Amour
fd82eed31c Add tests for syntax/transformer. 2015-08-05 13:11:55 -05:00
Vincent St-Amour
b4b0837a77 Move syntax-source-* tests from unstable-test. 2015-08-05 13:11:55 -05:00
Vincent St-Amour
6e111fe2e4 Move syntax-source-* docs from unstable-doc to syntax docs. 2015-08-05 13:11:55 -05:00
Vincent St-Amour
2c21d61870 Move syntax-source-* to syntax/location. 2015-08-05 13:11:55 -05:00
Vincent St-Amour
a1c5285cc2 Move docs for syntax/transformer from unstable-doc. 2015-08-05 13:11:54 -05:00
Vincent St-Amour
7e93b7d426 Move make-variable-like-transformer to syntax/transformer. 2015-08-05 13:11:54 -05:00
Vincent St-Amour
442db8d523 Move syntax/macro-testing tests from unstable-test. 2015-08-05 13:11:54 -05:00
Vincent St-Amour
d4f25d8c72 Move syntax/macro-testing docs from unstable-doc. 2015-08-05 13:11:54 -05:00
Vincent St-Amour
21c44635f6 Move unstable/macro-testing to syntax/macro-testing. 2015-08-05 13:11:54 -05:00
Vincent St-Amour
c541f6b4ba Move syntax/contract docs from unstable-doc. 2015-08-05 13:11:54 -05:00
Vincent St-Amour
102fbff5d2 Rename unstable/wrapc to syntax/contract. 2015-08-05 13:11:54 -05:00
Daniel Feltey
265b777b93 Fix unit contracts for new expander 2015-08-03 16:08:18 -06:00
Matthew Flatt
bf76ced8ba work around EPERM error from access()
On OS X, it seems that access() can sometimes fail with EPERM
when checking for execute permission on a file without it.
I've previously seen this result when running as the superuser,
but that's apparently not the only possibility; a long path
may also be relevant.
2015-08-01 21:59:19 -06:00
Stephen Chang
bfef7f54a3 pattern-expander docs: add note about names 2015-07-31 17:08:26 -04:00
Matthew Flatt
086d02003a fix linking of compiled reference to a top-level variable
Re-linking in a new namespace doesn't need the namespace of
compilation.

A "namespac.rktl" test exposed this problem, where the "transfer a
definition of a macro-introduced variable" test could fail if a GC
occurred between compilation in one namespace and evaluation in
another.
2015-07-31 11:17:25 -06:00
Matthew Flatt
1f2e0dacb3 minor adjustments
SGC header correction plus extra assert.
2015-07-31 07:32:34 -06:00
Gustavo Massaccesi
a1f04604df JIT: Inline keyword? 2015-07-30 21:27:26 -03:00
Vincent St-Amour
cdea0da566 Fix package name. 2015-07-30 16:26:56 -05:00
Benjamin Greenman
7259a2c76c typo: add supertype to provided zo struct
Changed doc to match `zo-structs.rkt`
2015-07-30 14:58:57 -06:00
Matthew Flatt
545c14a9cf adjust some versions in history notes
Promote v6.2.0.x changes to v6.3, since they will not be in v6.2.1.
2015-07-30 14:49:31 -06:00
Matthew Flatt
7b4d25c657 add missing history note on stream* 2015-07-30 14:45:29 -06:00
Matthew Flatt
51747e86c5 fix raco pkg conflict checking
When a module is currently installed as bytecode, but without
corresponding source and without a "info.rkt" specification that
bytecode should be preserved without source, then `raco pkg` should
not count that module bytecode as a conflict (since `raco setup`
will remove it).
2015-07-30 14:12:05 -06:00
Matthew Flatt
3dc1dc80e3 add setup/collection-search 2015-07-30 14:12:04 -06:00
Matthew Flatt
9a7d046062 raco setup: clean collections before compiling any
In case a collection "a" is composed from two places, and in
case the first place has a bytecode file for "x.rkt" while
only the second place has the source of "x.rkt" (probably it
was recently moved), then `raco setup` should delete the
sourceless bytecode so that any dependency on "x.rkt" will
reference the right version.
2015-07-30 14:12:04 -06:00
Jay McCarthy
2602ff530d Adding no major collection guarantee to collect-garbage minor collections 2015-07-30 11:42:13 -06:00
Jay McCarthy
2f22f86c0a Adding minor collections to collect-garbage 2015-07-30 11:42:13 -06:00
Matthew Flatt
26158a51d2 raise-syntax-error: fix srcloc reporting on #f as 3rd arg 2015-07-29 11:54:18 -06:00
Matthew Flatt
99f29ce8ee repair for nexted splicing forms that define the same name
Nested splicing forms would lead to an "ambigious binding" error
when the nested forms bind the same name, such as in

 (splicing-let ([a 1])
   (splicing-let ([a 2])
     (define x a)))

The problem is that splicing is implemented by adding a scope to
everything in the form's body, but removing it back off the
identifiers of a definition (so the `x` above ends up with no new
scopes). Meanwhile, a splicing form expands to a set of definitions,
where the locally bound identifier keeps the extra scope (unlike
definitions from the body). A local identifier for a nested splicing
form would then keep the inner scope but lose the outer scope, while
a local identifier from the outer splicing form would keep the outer
scope but no have the inner one --- leading to ambiguity.

The solution in this commit is to annotate a local identifier for a
splicing form with a property that says "intended to be local", so the
nested definition will keep the scope for the outer splicing form as
well as the inner one. It's not clear that this is the right approach,
but it's the best idea I have for now.
2015-07-29 06:11:13 -06:00
Benjamin Greenman
0c3b524de8 typo: prefix struct field name
Change `inspector-desc` to `src-inspector-desc`
2015-07-28 15:45:01 -06:00
Alex Knauth
3a3d17dbb5 Fix check-syntax arrows within units 2015-07-28 15:45:01 -06:00
Vincent St-Amour
496cd97351 Rename open-place to place/context. 2015-07-28 16:14:29 -05:00
Matthew Flatt
e3ed57633e syntax/module-reader: add a #:module-wrapper option
A `#:module-wrapper` option is useful for adding a scope to an
entire `module` form.
2015-07-28 14:55:02 -06:00
Jay McCarthy
cc1c989942 clarify text 2015-07-28 14:26:36 -06:00
Jay McCarthy
840f11d884 Add test-include-paths and allow test-omit-paths to use regexps 2015-07-28 14:19:49 -06:00
Matthew Flatt
7864436594 fix top-level scope introduction
Although `eval-syntax` is not supposed to add the current namespace's
"outer edge" scope, it must add the "inner edge" scope to be consistent
with adding the inner edge to every intermediate expansion (as in
other definition contexts).

In addition, `eval`, `eval-syntax`, `expand`, and `expand-syntax`
did not cooperate properly with `local-expand` on the inner edge.
2015-07-28 13:14:00 -06:00
Vincent St-Amour
8819df4add Merge unstable/sandbox with scribble/eval. 2015-07-28 13:32:29 -05:00
Vincent St-Amour
5d9c0cf1c7 Move markparam to its own package/repo. 2015-07-28 13:05:54 -05:00
Benjamin Greenman
11ccb7c530 typo: ARepresents -> Represents
In description for `decoded-module-binding`
2015-07-28 11:42:33 -05:00
Vincent St-Amour
a75b2292af Fix docs for racket/logging to be consistent with make-log-receiver's. 2015-07-28 11:26:09 -05:00
Asumu Takikawa
75e19c9435 Fix docs for syntax-debug-info 2015-07-27 17:16:57 -04:00
Alex Knauth
595925e436 fix doc typos 2015-07-27 10:47:53 -06:00
Brian Lachance
3c98fc54aa Fix bugs/typos in docs for contracts and quote-syntax
1st is a small grammatical mistake
2nd is in a section about ->* yet mistakenly -> is referred to
3rd is about recontract-out yet contract-out is mentioned instead
4th clarifies return value for value-contract
5th replaces free-identifier? with free-identifier=?
2015-07-27 10:47:06 -06:00
Rui Paulo
84996ff2ac sconfig: FreeBSD uses clang. 2015-07-25 20:57:59 -06:00
Rui Paulo
6dd1aa0cd8 sconfig: add FreeBSD/arm. 2015-07-25 20:57:40 -06:00
Matthew Flatt
98bd78e7f0 remove unused counter 2015-07-25 20:56:09 -06:00
Matthew Flatt
5e2b6c2b74 JIT: repair some runstack-pointer syncs
Some failure paths were missing an update before calling failure
code, and the new failure paths need to unconditionally update the
runstack pointer (because the common stub doesn't know whether the
calling context needs an update).
2015-07-25 20:49:58 -06:00
Matthew Flatt
6fd8f4bf08 fix test for module cache
The test didn't retain a relevant namespace, so the test could fail
due to GC timing.
2015-07-25 20:38:12 -06:00
Gustavo Massaccesi
8430daa628 Jitinline string-length and bytes-length
Previously only the unsafe versions were inlined in the jit compiler.
2015-07-25 20:31:44 -03:00
Matthew Flatt
20728278bf raco setup: fix bootstrap phase to recognize indirect dependencies
Recent changes introduced an indirect dependency in the core of
`raco setup` --- possibly the recent addition to `racket/place`.
2015-07-25 16:24:43 -06:00
Matthew Flatt
9593b4c806 make-syntax-introducer: add optional argument to change kind of scope
Genereating a use-site scope, instead of a macro-introduction scope,
prevents the scope's presense from triggering a #f result from
`syntax-original?`.
2015-07-25 14:37:54 -06:00
Vincent St-Amour
0f2d02cdd2 Move part of unstable/logging to racket/logging.
... and improve and extend its interface at the same time.
2015-07-23 12:22:51 -05:00
Vincent St-Amour
46a8506f99 Add missing label require. 2015-07-23 12:22:50 -05:00
Vincent St-Amour
0864d5848b Doc typo. 2015-07-23 12:22:50 -05:00
Vincent St-Amour
4ee1864941 Merge unstable/place with racket/place. 2015-07-23 12:22:50 -05:00
Vincent St-Amour
91c422bb66 Merge unstable/future with racket/future. 2015-07-23 11:43:37 -05:00
Andrew Gwozdziewycz
ef716ed15d Replace celcius (a common mispelling) with celsius 2015-07-23 11:21:22 -05:00
Matthew Flatt
1d380864e9 remove accidentally committed debugging change 2015-07-23 09:09:03 -06:00
Matthew Flatt
f4d05aaba8 fix bytecode-marshaling problem related to rename transformers 2015-07-23 08:04:34 -06:00
Matthew Flatt
120f1329c6 change bytecode marshaling of scopes
This change mostly reverts 1465ff25fc, which turned out to be a hassle
because it created more cyclic structure.

A simpler strategy is to allow a phase-specific scope to be detached
(perhaps temporarily, due to on-demand loading of bytecode) from its
group; when that's possible, the scope is not reachable from a place
where it can be moved to other syntax objects, so it's ok to be
detached. Debugging output needs to handle that gracefully, though.
Also, in case of broken bytecode, fix up a detached scope if it
does end up in an unexpected place.
2015-07-23 08:04:34 -06:00
Sam Tobin-Hochstadt
960fc831fc Provide promise/name?. 2015-07-22 14:33:30 -04:00
Matthew Flatt
594bdd6e61 fix incomplete text of docs for syntax-local-introduce 2015-07-22 11:17:07 -06:00
Matthew Flatt
2cf01f0257 raco exe: fix interaction of submodules and using source
Also, fix the interaction of submodules plus `--collects-dest`, but
there's room for improvement there in pruning unused submodules.
2015-07-22 10:54:31 -06:00
Matthew Flatt
176777b05f adjust transfer of compiled in one namespace and run in another
Formerly, compiling a definition in one namespace and evaluating it in
another would cause the definition to take place in the original
namespace --- unless the compiled code is marshaled to a byte string
and back. Adjust the "linking" process to redirect the variable
definition and any references to the new namespace. (This is a change
relative to the compiler with the old macro expander.)

Also, repair a compiled `require` form along similar lines. (This is
*not* a change relative to the compiler with the old macro expander;
the mismatch is part of the motivation for changing `define`
handling.)
2015-07-22 10:54:31 -06:00
Robby Findler
4899200177 add what appears to be the right missing argument, judging from other uses
of simultaneous-installs and the fact that the build seems to go through now
2015-07-21 22:21:42 -05:00
Sam Tobin-Hochstadt
a2b3cea72e Increase timeout on core tests. 2015-07-21 15:40:09 -04:00
Matthew Flatt
087eeb60ec remove racket/package tests
Moved to the "compatibility-test" package.
2015-07-21 13:10:42 -06:00
Matthew Flatt
1465ff25fc in ".zo", keep module's set of scopes together
For a set of phase-specific scopes that correspond to the "inside
edge" of a module, make sure the whole set is marshaled together.
2015-07-21 12:50:48 -06:00
Matthew Flatt
444518b344 racket/unit: fix problem with contracts
Part of the expansion to handle contracts confused internal and
external names of signature elements. The new macro expander is less
tolerant of the mistake.
2015-07-21 10:19:40 -06:00
Matthew Flatt
76a0eef121 make Reference dependency on DrRacket docs indirect
Avoids a dependency of "racket-doc" on "drracket".
2015-07-21 09:20:29 -06:00
Matthew Flatt
ea612d255f don't export old-case from racket/base
Reverts a change that was accidentally included in the set-of-scopes
switch.
2015-07-20 15:05:09 -06:00
Vincent St-Amour
1083a31965 check-duplicate -> check-duplicates
For consistency with remove-duplicates.
2015-07-20 16:00:53 -05:00
Vincent St-Amour
7700b3d736 Move contents of unstable/hash to racket/hash. 2015-07-20 16:00:52 -05:00
Vincent St-Amour
952df81877 Move remf from unstable/list to racket/list.
Add remf* for consistency.
2015-07-20 16:00:52 -05:00
Vincent St-Amour
c0408de912 Move various common prefix functions from unstable/list to racket/list.
Make their interface consistent with the rest of racket/list.
2015-07-20 16:00:52 -05:00
Vincent St-Amour
067ed4ccac Move list-update and list-set from unstable/list to racket/list. 2015-07-20 16:00:52 -05:00
Vincent St-Amour
5e23ad6ccf Move group-by and cartesian-product from unstable/list to racket/list. 2015-07-20 16:00:52 -05:00
Vincent St-Amour
6b9fc4551d Add error checking to check-duplicate.
To replace its original contract, and avoid introducing a dependecy to contracts.
2015-07-20 16:00:52 -05:00
Vincent St-Amour
4d9751e98c Move check-duplicate from unstable/list to racket/list.
Make its interface uniform with remove-duplicates.
2015-07-20 16:00:52 -05:00
Vincent St-Amour
60e7f1b7c7 Add argument checking to conjoin and disjoin. 2015-07-20 16:00:52 -05:00
Vincent St-Amour
0e6baea9f6 Move contents of unstable/function to racket/function.
Split implementation of racket/function to avoid circular dependencies.
2015-07-20 16:00:52 -05:00
Matthew Flatt
57ea02616c fix inspector tracking in syntax objects
Repair a NULL vs. #f mismatch.
2015-07-20 13:41:04 -06:00
Matthew Flatt
3d87d61039 fix expansion loop in a definition context
Add the current definition context's scope to any expression that is
produced by macro expansion before trying to expand again, in case the
expansion needs to refer to a definition introduced by a previous
expansion.

Previously, the scope was added before any expansion and after any
expansion, but that misses intermediate points.

The old expander had this bug, too (some of the new tests fail there),
but it showed up less often and was sometimes considered correct, for
various reasons.
2015-07-20 13:20:03 -06:00
Gustavo Massaccesi
a6fe7b3f40 Use the new Travis infrastructure 2015-07-20 12:49:47 -03:00
Robby Findler
e7e184a0ba link from 'disappeared-use and 'disappeared-binding in reference to check syntax 2015-07-20 10:29:24 -05:00
Matthew Flatt
54cf4c7f16 racket/generics: fix generated <gen>/c
The revised implementation of `define-generics` for the new macro
expander wasn't right, because the macro attached to `<gen>/c` for a
given `<gen>` used a macro-introduced reference to the generic to
match up method names with the generic's methods.
2015-07-20 06:39:18 -06:00
Matthew Flatt
0bc5a1b06a fix nested begin-for-syntax
Initialize a phase-2 namespace before trying to use it.
2015-07-19 12:07:53 -06:00
Gustavo Massaccesi
9fe6c138cf Fix typos in docs 2015-07-18 20:44:36 -06:00
Gustavo Massaccesi
597eb161f5 avoid compiler warning 2015-07-18 20:44:36 -06:00
Matthew Flatt
1eba8ac2a7 fix place-channel support for eq[v] hash tables
Bug caught by an existing test.
2015-07-18 20:44:36 -06:00
Sam Tobin-Hochstadt
801a8950bb Fix missing space. 2015-07-17 13:23:10 -04:00
Matthew Flatt
053cfc0ddb fix an incorrect simpliciation in the GC
I had tried to simplify the "generation 0" allocation function to
always use `GEN0_PAGE_SIZE`, but "generation 0" is also used for place
messages, in which case a much smaller size should be used.

The "place-in-channel-fnl.rkt" test exposed this problem.
2015-07-17 09:55:17 -06:00
Sam Tobin-Hochstadt
e8ca83ad78 Don't run db-test on appveyor after all. 2015-07-17 11:47:13 -04:00
Sam Tobin-Hochstadt
9a5d2d8b2d Encrypt correctly for Appveyor. 2015-07-17 11:38:02 -04:00
Sam Tobin-Hochstadt
be29992908 Have Travis post to the #notifications channel. 2015-07-17 11:14:04 -04:00
Sam Tobin-Hochstadt
9f8a0d4731 Run more tests on appveyor now that the machine is faster. 2015-07-17 10:58:23 -04:00
Sam Tobin-Hochstadt
ab07280e71 Reduce syntax/parse dependencies in match. 2015-07-17 10:58:13 -04:00
Matthew Flatt
123f724c47 fix GC problem with chains of ephemerons
A recent GC change (included with the set-of-scopes expander)
allows the GCs marking procedure to recur directly to a limited
depth, instead of always pushing pointers onto a stack. Direct
recursion is not cmopatible with ephemeron-resolution process,
so switch to no-recur mode.

This problem was uncovered by an existing test.
2015-07-17 02:10:04 -06:00
Matthew Flatt
dd0ced3c02 avoid compiler warnings 2015-07-16 21:04:01 -06:00
Matthew Flatt
e954ce0ffa document raco setup --fast-clean 2015-07-16 18:24:25 -06:00
Matthew Flatt
aaee824f68 optimizer: fix coordinate shift when a letrec is split
The combination of splitting a `letrec` and optimizing
the resulting `(let ([x <proc>]) x)` to just `<proc>`
used a bad coordinate shift, which made property testing
incorrect, etc.

For reasons that are not clear, the new expander triggered
the problem through an existing test.
2015-07-16 18:18:58 -06:00
Matthew Flatt
e65beb2636 adjust a core test to avoid mscheme 2015-07-16 17:06:59 -06:00
Matthew Flatt
b72dceb865 avoid excessive fallbacks via eval-syntax
The `eval-syntax` function (which is used by other functions, such as
loading a module) should not install fallback-binding scopes from
the current namespace.
2015-07-16 14:20:00 -06:00
Matthew Flatt
fc5e32e526 switch to set-of-scopes expander
The development history for set-of-scopes is preserved in a "scope"
branch in the main Racket repository, which is commit
 ae88c96f50
2015-07-16 14:20:00 -06:00
Matthew Flatt
bfc2b27d65 fix optimizer's single-use tracking, especially on inlining
When `(let ([x ...]) (let ([y x]) ... y ... y ...))` turns into
`(let ([x ...]) ... x ... x ...)`, make sure that `x` is not
still marked as single-use. Incorrect marking as single-use could
cause the optimizer to inline too much, for example.

Thanks to Gustavo for tracking down the problem.
2015-07-16 07:48:17 -06:00
Matthew Flatt
ec6c88442d fix length-specifying form of _bytes to include room for nul 2015-07-16 07:10:36 -06:00
Gustavo Massaccesi
bfc9eb8d62 Add ´not´ to the relevant predicates list
Previously all the predicates recognized only non-#f things, so ´not´ can be
added to the list of disjoint predicates. But many of the parts of the code
relied on the non-#f property and had to be modified.
2015-07-14 19:20:11 -03:00
Gustavo Massaccesi
dfc64053b7 Infer type from comparisons in test positions
In (if (eq? x <pred?-expr>) <tbranch> <fbranch>) infer that the type of
x is pred? in the tbranch.

Also, reduce (eq? x y) => #f when the types are different.
2015-07-14 19:19:50 -03:00
Gustavo Massaccesi
bc2cf531e3 Reduce variables with type null? and void? to null and #<void>
The optimizer reduces the variables with a known type to #t in a Boolean context.
But some predicates imply that the variable has a definite values, so they can be
reduced in a non-Boolean context too.

For example, in (lambda (x) (if (null? x) x 0))) reduce the last x ==> null.
2015-07-14 19:19:28 -03:00
Gustavo Massaccesi
58300857db Fix bug in type propagation to avoid the reduction of mutable variables
This fixes the bug twice:
* Don't reduce mutable variables with a type to #t in a Boolean context.
* Don't record the type of mutable variables when a predicate is
     checked in a test condition.
2015-07-14 19:19:05 -03:00
Gustavo Massaccesi
b7ae673ee0 Mark (values <expr>) as single valued
While reducing some ignored constructors, the optimizer may wrap the arguments
<expr> in (values <expr>) to ensure that it's a single value non-cm expression.
This avoids the unnecessary nesting of (values (values <expr>)).

Similarly, add the cases for begin and begin0 to single_valued_noncm_expression
2015-07-14 13:43:54 -03:00
Gustavo Massaccesi
d0c9a894fb Mark many port primitives as non-cm 2015-07-14 13:28:28 -03:00
Robby Findler
2ffa03c626 remove unused definition (some old refactoring lost track of this,
I presume)
2015-07-13 09:34:37 -05:00
Matthew Flatt
231e9b3f81 ffi/com repair
Thanks to Kang Ren.

The repair seems obviously correct, but I don't know how to test
it (i.e., don't have a COM object that would exercise the code).
2015-07-10 08:26:21 +02:00
Matthew Flatt
d6fa581a4c increase signal-handling stack size
On 64-bit Linux platforms other than x86_64 (e.g., AArch64), SIGSTKSZ
isn't big enough. Use a stack 10 times as large.
2015-07-03 12:41:37 -06:00
Matthew Flatt
ff492f9bb6 add comments on how page alisngment 2015-07-03 12:40:26 -06:00
Matthew Flatt
331b104345 JIT: inline ptr-ref and ptr-set!
Special treatment of `ptr-ref` and `ptr-set!` applies when the second
argument is one of a few primitive C types: `_int`, `_double`, etc.
2015-07-02 15:59:35 -06:00
Matthew Flatt
b782b9a4db fix no-places, no-futures build 2015-07-02 14:48:19 -06:00
Matthew Flatt
0cda0c98b0 fix GC for non-x86 64-bit platforms
A test for 64-bitness was broken, checking specifically for x86_64
instead of the general 64-bit flag.
2015-07-02 07:26:06 -06:00
WarGrey Gyoudmon Ju
8a817e577c disable HAVE_POLL_SYSCALL in solaris: poll(2) is the CPU eater, and this problem affects all TCP applications including plt-web-server. 2015-07-01 18:21:01 -06:00
Matthew Flatt
40f79dd72e configure: fix --enable-noopt
Broken by cf8c3c9cfe, which shifted optimization flags from
CFLAGS to PREFLAGS when using a gcc-stype preprocessor.
2015-06-30 16:27:34 -06:00
Gustavo Massaccesi
72132ea3aa Reoptimize propagated constants
Reduces them to #t or #f when they are copied to a Boolean context
2015-06-29 23:44:47 -03:00
Eric Dobson
5cd910f9f2 Fix docs on channel synchronization 2015-06-29 17:34:57 -06:00
Matthew Flatt
e4eeaa79cb fix error-message formatting
Avoid an extra newline.
2015-06-29 17:34:19 -06:00
Matthew Flatt
138e16e80f fix clone-linked package update on evolving to a multi-package repo
When a package "p" is clone-linked and the repo for "p" changes to be
a multi-package repository (e.g., with "p-lib", "p-doc", and "p"), a
`raco update` would get confused. Unofrtunately, a plain `raco pkg
update p` can't work in that case, because the clone link would still
be a pathless repo URL; the repairs make `raco pkg update --lookup
--clone ..../p` work as is should.

Related: fix inference of package names in the early check for whether
a package is installed.
2015-06-29 17:33:27 -06:00
Matthew Flatt
6f6a792d06 fix memory-management problem with #:lock-name
Repairs a bug in 290020c597.
2015-06-26 07:44:43 +08:00
Matthew Flatt
290020c597 ffi/unsafe: add #:lock-name option to _fun and _cprocedure
While `#:in-original-place? #t` provides one way to serialize
foreign calls, it acts as a single lock and requires expensive
context switches. Using an explicit lock can be more efficient
for serializing calls across different places.

For example, running "plot.scrbl" takes 70 seconds on my machine
in the original place and using `#:lock-name` in any place,
while it took 162 seconds in a non-main place with Cairo+Pango
serialization via `#:in-original-place? #t`.

Internally, the named lock combines compare-and-swap with a
place channel. That strategy gives good performance in the case
of no contention, and it cooperates properly with the Racket
scheduler where there is contention.
2015-06-25 10:35:22 +08:00
Matthew Flatt
9931d5ef1c avoid compiler warning 2015-06-24 07:17:39 +08:00
Matthew Flatt
f7e1fcd557 log a warning for shadowing an import with a definition 2015-06-24 07:15:29 +08:00
Gustavo Massaccesi
95bac91268 Propagate types form the body of let's forms and inlined functions
The optimizer was able to use the type information gained outside
the let's to reduce expressions inside the lets. For example, in
  (lambda (z) (car z) (let ([o (random)]) (pair? z)))
it reduces (pair? z) ==> #t.

This enable the propagation in the other direction so in
  (lambda (z) (let ([o (random)]) (car z)) (pair? z))
it reduces (pair? z) ==> #t too.
2015-06-23 16:52:40 -03:00
Gustavo Massaccesi
1a091f535e Intersect types gathered in if branches 2015-06-23 16:46:23 -03:00
Matthew Flatt
ea016bec96 allow definition in module to shadow a preceding import
This change is experimental and intended to reduce (but certainly not
eliminate) the problem of breaking existing code by adding exports to
a module.
2015-06-23 21:31:57 +08:00
AlexKnauth
fae92a19f5 add define-syntax-parser
idea from
863d39229f (diff-3252674930bbd0c4e113856a2a3a5747R118)
2015-06-22 18:25:44 -04:00
AlexKnauth
cb3f296678 support this-syntax in syntax-parse, syntax-parser, etc.
closes PR 14855
2015-06-22 15:40:44 -04:00
Matthew Flatt
ca57adcf2d fix slow leak in link-establishing thread-resume
Using `(thread-resume t1 t2)` would not prevent a GC of t1, but it
would create an intermediate record to make the link from t1 to t2,
and that intermediate record would leak due to a missing level of
indirection in a table-cleanup traveral. The leak not only accumulated
memory, it also caused ever slower traversals of the table in an
attempt to clean up.

(Since the leak is small and the leaking object is not directly
accessible, I don't have a good idea on how to test this repair
automatically, but see the program in the PR.)

Closes PR 15099.
2015-06-22 16:53:52 +08:00
Eric Dobson
82218f33bd Fix docs on thread-resume-evt
It returns `thd` as in the previous sentence, not itself.
2015-06-20 21:43:34 +08:00
Tony Garnock-Jones
4b2c9cfbcc Add exn->string, following the function of the same name in the web-server. 2015-06-20 21:43:33 +08:00
Gustavo Massaccesi
502575b641 Typos in docs of raco setup 2015-06-20 21:43:33 +08:00
Alexis King
c79f646545 Add stream* to complement stream 2015-06-20 21:43:27 +08:00
Jay McCarthy
33717eebaa Fixing empty request data 2015-06-18 08:41:18 -04:00
Vincent St-Amour
97827acba6 Fix name of command in docs. 2015-06-11 14:03:16 -05:00
Matthew Flatt
bf12a2bdd7 bump version number
Should have bumped it with the xform changes.
2015-06-07 09:03:01 -06:00
Matthew Flatt
d95200f19a remove setting of socket send buffer size
Modern OS configurations likely use an even larger buffer size, and
making it small can have substantial negative performance effects
(e.g., with PostgreSQL over TCP).
2015-06-06 10:50:44 -06:00
Matthew Flatt
ed4bbcd4ad xform: further parsing corrections
Although the previous commit was enough to make the build work, it
wasn't the right fix. Simplify and correct parsing and printing.
2015-06-06 10:13:33 -06:00
Matthew Flatt
26e1dd050d xform: fix character parsing
Allow L'\x7f`, for example.
2015-06-06 09:41:39 -06:00
Matthew Flatt
4deacddde8 attempt to fix xform problem
Mark some pointer arithmetic as ok.
2015-06-06 09:21:23 -06:00
Matthew Flatt
cf8c3c9cfe adjust auto-configuration of CPPFLAGS vs. CFLAGS
When AC_PROG_CC picks GCC, move its selection of CFLAGS
into CPPFLAGS, so that preprocessing will have the same
optimization and debugging flags as compilation.

Arguably, AC_PROG_CC plus AC_PROG_CPP should do that
soemhow, but it's understandable that the autoconf
implementers didn't cover the possibility of
preprocessing that changes with the optimization level.

Closes #945
2015-06-06 07:55:14 -06:00
Sam Tobin-Hochstadt
fc6ead4ac2 Improve match compilation of ? and fix bugs.
- Coalesce repeated use of the same predicate.
- Fix scoring of Exact patterns, and scoring generally.
- Use `OrderedAnd` where needed.
- Guarantee that `and` patterns match in order.
- Thread bound variable information properly in GSeq compilation.
- Warn when variables are used non-linearly with `...`
  (making this behave properly was not backwards compatible).

Closes #952, which now runs in <1ms and make it a test case.

Also add margin note about `?` patterns and multiple calls.
2015-06-05 18:08:33 -04:00
Matthew Flatt
e1e89adf62 adjust Active-X example to work with newer IE 2015-06-05 09:15:25 -06:00
Alexis King
35c3554343 Make pair accessor shorthand examples properly link to id docs 2015-06-04 06:48:18 -06:00
Matthew Flatt
4ba3adf11b document raco read 2015-06-04 06:48:18 -06:00
Alexis King
495784ed49 Fix contract error in in-vector documentation example 2015-06-04 07:38:57 -05:00
Alexis King
391a672bf6 Fix the first order check on async-channel/c 2015-06-03 12:19:28 -05:00
Matthew Flatt
0bed8e8928 fix command-line docs for flags that start "--"
Closes PR 15080
2015-05-31 06:06:22 -06:00
Sam Tobin-Hochstadt
b4c52698c0 Increase timeout more. 2015-05-27 12:56:52 -07:00
Sam Tobin-Hochstadt
c8ff0c8b18 Fix timeout for core tests. 2015-05-27 13:51:09 -04:00
Robby Findler
53f03d73f4 add more accurate timeouts 2015-05-27 09:35:05 -05:00
AlexKnauth
2b0ba444c0 and/c: use projections more on flat-contract arguments 2015-05-26 20:39:41 -05:00
Robby Findler
78ecccc2b1 fewer quotes 2015-05-19 11:17:17 -05:00
Alex Knauth
d30b90cba3 contract docs: explain positive and negative as server and client 2015-05-19 11:14:13 -05:00
Robby Findler
a9ac3be43c add missing default value 2015-05-18 20:35:36 -05:00
Matthew Flatt
235bd4de8f raco setup: fix shared-file cleanup on uninstall
The tidying step of `raco setup` looked for the "shares.rktd"
receipt file in the wrong directory.
2015-05-18 18:55:18 -06:00
Matthew Flatt
7067559ac7 raco setup: fix reporting of stderr output
Handle was mangled in commit 17275b946a.
2015-05-18 18:08:44 -06:00
Gustavo Massaccesi
542b960d12 Tests for 16ce8fd90d 2015-05-16 22:32:05 -03:00
Matthew Flatt
aaa289c7b6 tests and repairs for early checks
Also, avoid "early" checks when recurring, just in case.
2015-05-16 17:15:22 -06:00
Matthew Flatt
5aa7ba6f30 raco pkg install: check for installed before catalog, etc.
Add an early check for whether a package is installed before
doing more time-consuming work, such as consulting a catalog.
2015-05-16 16:44:46 -06:00
Matthew Flatt
07b8007edb raco pkg: better error message for bad Git URL 2015-05-16 16:26:55 -06:00
Matthew Flatt
9272781d6d git-checkout: add #:initial-error argument 2015-05-16 16:23:16 -06:00
Matthew Flatt
c4401313d4 when a directory URL fails, suggest a ".git" extension 2015-05-16 16:23:16 -06:00
Matthew Flatt
aaef69f40a raco pkg update: check already installed, first, in given scope
Before consulting a catalog, etc., check whether a given package name
is currently installed. The new check applies only if a scope is
specified, since scope inference implies the check already.
2015-05-16 15:49:34 -06:00
Matthew Flatt
12308e3f17 clarify in docs that threads provide sequential consistency 2015-05-16 15:19:13 -06:00
Matthew Flatt
32a2ca6eff doc clarification on output functions and mutable arguments 2015-05-16 15:04:32 -06:00
Matthew Flatt
298feb1bb6 fix problem with expand and local-require
When `local-require` is used in a non-phase-0 position and it is
`expand`ed (as opposed to compiled directly), then the generated
`#%require` form had the wrong binding phase.

Merge to v6.2
2015-05-15 10:44:20 -06:00
Gustavo Massaccesi
6c2888937a Make (make-vector <number>) omittable
In many use cases the length of the vector is fixed and know,
so we are sure that make-vector will not raise an error and
we can recognize these expressions as omittable and drop
them when the result is ignored.
2015-05-14 16:36:35 -03:00
Gustavo Massaccesi
2be6eb9570 Mark the result of more procedures as vector?
The result of some procedures is a vector, but they are not omittable
because they may rise an error. With the recent changes of the
predicate reduction these cases are correctly handled.
2015-05-14 16:36:21 -03:00
Matthew Flatt
39fda5ec9e keep ".LOCKpkgs.rktd" for source install
Closes PR 15062
2015-05-14 08:45:25 -06:00
Asumu Takikawa
c2cd44c928 Implement class sealing/unsealing
Adds a sealing and unsealing function to attach (or detach)
seals onto a class via impersonator properties. Since these
properties override, they do not accumulate wrappers.

Calling seal multiple times will still accumulate multiple seal
values inside the property.

A sealed class cannot be instantiated and a subclass may not
add class members that match any of the sealed names in its
sealed parent.

These functions are intended for use by TR's `sealing->/c`
contract, but are parameterized over checking functions and
could be used for other purposes.
2015-05-13 13:21:51 -04:00
Mark Lee
e4a48723b3 Fix up documentation on count. Count is more similar to filter-map than it is to filter since it can accept multiple lists. 2015-05-13 11:03:22 -04:00
Alexis King
b450aa8af6 Fix typo in ffi COM docs 2015-05-13 11:02:14 -04:00
Ryan Culpepper
9049737270 reduce memory use in net/uri-codec
Eliminated use of lists and non-tail recursion, used
string ports and loops instead.
2015-05-12 18:23:02 -04:00
Asumu Takikawa
e6113d1c3c Preserve syntax location in get-field
(needed to let TR show a type tooltip for it)
2015-05-12 15:29:27 -04:00
Edward Lee
46030642fa bytes->jsexpr: toss exn:fail:contract? when given invalid UTF-8 2015-05-12 12:45:10 -06:00
Edward Lee
ec6060b9da json: Remove regexp-try-match used to parse strings, replace with less-memory intensive functions. 2015-05-12 12:45:10 -06:00
Matthew Flatt
7ef9bd618d fix cut-and-paste error in comment 2015-05-12 10:03:46 -06:00
Matthew Flatt
64c9d8382f complete-path repair for raco make
Fix problem with 4e3a7c4 as exposed by the "make.rkt" test in
the "compiler-test" package.
2015-05-12 09:42:30 -06:00
Robby Findler
24b91852da "broke its contract" => "broke its own contract" 2015-05-12 06:45:52 -05:00
Robby Findler
8d1e16f09c add a benchmark that attempts to mimic DrRacket redrawing the window 2015-05-11 08:11:57 -05:00
Matthew Flatt
6f984d868c fix expander problem with set! 2015-05-09 18:35:25 -06:00
Robby Findler
7fb67ad644 improve error messages from contract system
closes PR 15057
2015-05-09 11:59:53 -05:00
Robby Findler
bd5723c51c add support for random generation and contract stronger to char-in 2015-05-08 16:55:27 -05:00
Alexis King
aa4c57bf9a Add a char-in flat contract 2015-05-08 16:36:33 -05:00
Stephen Chang
7d434d266e add free-id sets
merges github pull-request #815
2015-05-04 19:05:07 -04:00
Matthew Flatt
0304fedf92 Makefile: make SRC_CATALOG work for in-place and unix-style
Configure an in-place or unix-style build to use the given
SRC_CATALOG before the default catalogs.
2015-05-03 21:41:46 -07:00
Matthew Flatt
ec0350e6d9 raco pkg config: treat empty-string catalog as default paths
An empty string provided to `raco pkg config --set catalogs` would
trigger an error previously. Instead, turn it into a `#f` in the
configuration file, which is replaced by the default search sequence.
2015-05-03 21:38:49 -07:00
Matthew Flatt
78e473f017 always adjust catalogs configuration elements
Pathnames in the list need to be made absolute
"file://" URLs, even if the list has no #f element
to splice the default catalog.
2015-05-03 21:38:49 -07:00
Gustavo Massaccesi
4c10a9efac Check the type of the arguments of more procedures
The optimizer checks the type of the argument of some unary procedures and
uses the gathered information to replace them by the unsafe version, reduce
predicates and detect type errors. This extends the checks to more procedures
that have no unsafe version and procedures that have more than one argument.
2015-05-03 15:15:24 -03:00
Mark Lee
c44cffe5a8 Add example of struct subtype inheritance of supertype. Clarify struct subtype inherits the prefix of the struct supertype. 2015-05-03 10:20:26 -06:00
Matthias Felleisen
ed0e98b305 Robby's improvement for Jay's things 2015-05-03 09:25:50 -04:00
Matthias Felleisen
ab145d4c7d touching up Jay's patch 2015-05-02 12:11:14 -04:00
Matthias Felleisen
a691372419 Jay's patch for style guide 2015-05-02 12:11:14 -04:00
Stephen Chang
6e8fb5776b hash set default err msg: clarify disallowed operations 2015-05-01 19:38:44 -04:00
Stephen Chang
9e8971ba95 update gen:set defaults and docs
- set-copy-clear has no fallback - update docs to match impl
- set-copy fallback should use set-copy-clear not set-clear
2015-05-01 19:38:44 -04:00
AlexKnauth
a2d06c2cd5 at-exp: make language-info compose with other languages 2015-05-01 16:07:02 -06:00
Greg Hendershott
2c76954108 Note exn:break-continuation not usable with with-handlers. 2015-05-01 16:07:02 -06:00
Eric Dobson
4e3a7c420a Make parallel-build send the whole filename to the worker.
Closes PR 15000.
2015-05-01 16:07:02 -06:00
Eric Dobson
06634b74d5 Make file-list-queue% use new error format.
Closes PR 15013.
2015-05-01 16:07:02 -06:00
Stephen Chang
aef101fd84 hashset unavailable method err msg: don't say unimplemented 2015-05-01 16:43:18 -04:00
Stephen Chang
606a946212 improve hash set unimplemented method error msgs 2015-05-01 14:04:23 -04:00
Gustavo Massaccesi
e8ad90a14d Remove duplicate code in scheme_omittable_expr 2015-05-01 10:01:24 -03:00
Stephen Chang
dcf73f6bca compute generic method default error msg in define-generic-method
- fixes generic test failures due to computing this info
2015-04-30 16:45:35 -04:00
Stephen Chang
56cf724d12 improve generic method default error msg:
- report position of bad self arg
- report and label other args, including kw, optional, rest, if present

merge of github pull-request #821
2015-04-30 12:37:09 -04:00
Matthew Flatt
d6b587288a Adjust "6.2.0.2" history notes to just "6.2"
Due to our release process, these changes will be included in v6.2
after all.

Merge to v6.2
2015-04-28 15:36:04 -06:00
Matthew Flatt
5affb68478 raco exe: fix handling of unwritable source executable
Make the executable writable while it's patched for new content.

Closes PR 15008

Merge to v6.2
2015-04-28 15:32:52 -06:00
Matthew Flatt
423aa06426 add Gustavo to acks
Merge to v6.2
2015-04-28 15:32:43 -06:00
Matthew Flatt
f43d38914b use log-error to report missing ico conversions
Merge to v6.2
2015-04-28 15:32:33 -06:00
Ryan Culpepper
d48840f23b Post-release version for the v6.2 release 2015-04-27 09:36:47 -04:00
887 changed files with 79751 additions and 43398 deletions

7
.gitignore vendored
View File

@ -24,3 +24,10 @@ compiled/
.DS_Store .DS_Store
*.bak *.bak
TAGS TAGS
# generated by patch
*.orig
*.rej
# coredumps
*.core

View File

@ -1,56 +1,58 @@
sudo: false
language: c language: c
matrix: matrix:
include: include:
# osx, defaults, gcc and clang
- os: osx - os: osx
compiler: gcc compiler: gcc
env: PATH=./racket/bin:$PATH env: PATH=./racket/bin:$PATH
- os: osx - os: osx
compiler: clang compiler: clang
env: PATH=./racket/bin:$PATH env: PATH=./racket/bin:$PATH
# linux, defaults, gcc and clang
- os: linux - os: linux
compiler: gcc compiler: gcc
env: PATH=./racket/bin:$PATH env: PATH=./racket/bin:$PATH
- os: linux - os: linux
compiler: clang compiler: clang
env: PATH=./racket/bin:$PATH env: PATH=./racket/bin:$PATH
# linux, no places, no futures, no extflonum, gcc
- os: linux - os: linux
compiler: gcc compiler: gcc
env: PATH=./racket/bin:$PATH RACKET_CONFIGURE_ARGS="--disable-places --disable-futures --disable-extflonum" env: PATH=./racket/bin:$PATH RACKET_CONFIGURE_ARGS="--disable-places --disable-futures
# linux, no jit, gcc --disable-extflonum"
- os: linux - os: linux
compiler: gcc compiler: gcc
env: PATH=./racket/bin:$PATH RACKET_CONFIGURE_ARGS="--disable-jit" env: PATH=./racket/bin:$PATH RACKET_CONFIGURE_ARGS="--disable-jit"
# linux, no jit, no places, no futures, no extflonum, gcc
- os: linux - os: linux
compiler: gcc compiler: gcc
env: PATH=./racket/bin:$PATH RACKET_CONFIGURE_ARGS="--disable-jit --disable-places --disable-futures --disable-extflonum" env: PATH=./racket/bin:$PATH RACKET_CONFIGURE_ARGS="--disable-jit --disable-places
# Just run tests for the core --disable-futures --disable-extflonum"
before_script:
- git config --global user.email "travis-test@racket-lang.org"
- git config --global user.name "Travis Tester"
script: script:
- make CPUS="2" PKGS="racket-test db-test unstable-flonum-lib net-test" CONFIGURE_ARGS_qq="$RACKET_CONFIGURE_ARGS" - make CPUS="2" PKGS="racket-test db-test unstable-flonum-lib net-test" CONFIGURE_ARGS_qq="$RACKET_CONFIGURE_ARGS"
- raco test -l tests/racket/test - raco test -l tests/racket/test
- racket -l tests/racket/contract/all - racket -l tests/pkg/test -- -q
- raco test -l tests/json/json - racket -l tests/racket/contract/all
- raco test -l tests/file/main - raco test -l tests/json/json
- raco test -l tests/net/head - raco test -l tests/file/main
- raco test -l tests/net/uri-codec - raco test -l tests/net/head
- raco test -l tests/net/url - raco test -l tests/net/uri-codec
- raco test -l tests/net/url-port - raco test -l tests/net/url
- raco test -l tests/net/encoders - raco test -l tests/net/url-port
- raco test -l tests/openssl/basic - raco test -l tests/net/encoders
- raco test -l tests/openssl/https - raco test -l tests/openssl/basic
- raco test -l tests/match/plt-match-tests - raco test -l tests/openssl/https
- raco test -l tests/zo-path - raco test -l tests/match/main
- raco test -l tests/xml/test - raco test -l tests/zo-path
- raco test -l tests/db/all-tests - raco test -l tests/xml/test
- raco test -l tests/db/all-tests
notifications: notifications:
irc: "chat.freenode.net#racket-dev" irc: chat.freenode.net#racket-dev
email: email:
recipients: recipients:
- samth@racket-lang.org - samth@racket-lang.org
- robby@racket-lang.org - robby@racket-lang.org
- mflatt@racket-lang.org - mflatt@racket-lang.org
on_success: change on_success: change
slack:
secure: A19kphrabQHO8TU6qZcBaLQxdSNpm1ypEtbQsh8Ucg6HYPP7y1q7O7JZEndoMRHE9CNKZ9oXQzqR8H1IFVTlnjFFIJfkZzZ1YSNk4abSomhpWCq9daKMfwlcuTtY6PeI1nDVpka4/hiJGn9qzmaKYXle9Sl4CX2VEYp8o8PgMEs=

View File

@ -1,8 +1,8 @@
Build Options Build Options
============= =============
For Unix platforms, instead of using this source repository, consider Instead of using this source repository, consider getting source for
getting source for the current Racket release from the current Racket release from
http://download.racket-lang.org/ http://download.racket-lang.org/
@ -16,7 +16,9 @@ documentation are pre-built.
In contrast to this repository, release and snapshot source In contrast to this repository, release and snapshot source
distributions will work in the distributions will work in the
configure --prefix=... && make && make install configure --prefix=... && make && make install
way that you probably expect. way that you probably expect.
@ -31,7 +33,7 @@ If you stick with this repository, then you have several options:
Instructions: In-place Build" below. Instructions: In-place Build" below.
* Unix-style install --- installs to a given destination directory * Unix-style install --- installs to a given destination directory
(Unix and Mac OS X, only), leaving no reference to the source (on platforms other Windows), leaving no reference to the source
directory. This is the most natural mode for installing once from directory. This is the most natural mode for installing once from
the source repository. See "Quick Instructions: Unix-style Install" the source repository. See "Quick Instructions: Unix-style Install"
below. below.
@ -51,11 +53,11 @@ If you stick with this repository, then you have several options:
Quick Instructions: In-place Build Quick Instructions: In-place Build
================================== ==================================
On Unix, `make' (or `make in-place') creates a build in the "racket" On Unix (including Linux) and Mac OS X, `make' (or `make in-place')
directory. creates a build in the "racket" directory.
On Windows with Microsoft Visual Studio (any version between 2008/9.0 On Windows with Microsoft Visual Studio (any version between 2008/9.0
and 2013/12.0), `nmake win32-in-place' creates a build in the "racket" and 2015/14.0), `nmake win32-in-place' creates a build in the "racket"
directory. For information on configuring your command-line directory. For information on configuring your command-line
environment for Visual Studio, see "racket/src/worksp/README". environment for Visual Studio, see "racket/src/worksp/README".
@ -74,10 +76,10 @@ See "More Instructions: Building Racket" below for more information.
Quick Instructions: Unix-style Install Quick Instructions: Unix-style Install
====================================== ======================================
On Unix, `make unix-style PREFIX=<dir>' builds and installs into On Unix (including Linux), `make unix-style PREFIX=<dir>' builds and
"<dir>" (which must be an absolute path) with binaries in "<dir>/bin", installs into "<dir>" (which must be an absolute path) with binaries
packages in "<dir>/share/racket/pkgs", documentation in in "<dir>/bin", packages in "<dir>/share/racket/pkgs", documentation
"<dir>/share/racket/doc", etc. in "<dir>/share/racket/doc", etc.
On Mac OS X, `make unix-style PREFIX=<dir>' builds and installs into On Mac OS X, `make unix-style PREFIX=<dir>' builds and installs into
"<dir>" (whichmust be an absolute path) with binaries in "<dir>/bin", "<dir>" (whichmust be an absolute path) with binaries in "<dir>/bin",
@ -128,6 +130,12 @@ previously installed packages remain installed and are updated, while
new packages are added. To uninstall previously selected package, use new packages are added. To uninstall previously selected package, use
`raco pkg remove'. `raco pkg remove'.
To build anything other than the latest sources in the repository
(e.g., when building from the "v6.2.1" tag), you need a catalog
that's compatible with those sources. Note that a release distribution
is configured to use a catalog specific to that release, so you can
extract the catalog's URL from there.
Using `make' (or `make in-place') sets the installation's name to Using `make' (or `make in-place') sets the installation's name to
"development", unless the installation has been previously configured "development", unless the installation has been previously configured
(i.e., unless the "racket/etc/config.rktd" file exists). The (i.e., unless the "racket/etc/config.rktd" file exists). The
@ -181,10 +189,17 @@ but under Windows, encoding-conversion, extflonum, and SSL
functionality is hobbled until native libraries from the functionality is hobbled until native libraries from the
`racket-win32-i386' or `racket-win32-x86_64' package are installed. `racket-win32-i386' or `racket-win32-x86_64' package are installed.
On all platforms, `JOB_OPTIONS' as a makefile variable and On all platforms, fom the top-level makefile, `JOB_OPTIONS' as a
`PLT_SETUP_OPTIONS' as an environment variable are passed on to the makefile variable and `PLT_SETUP_OPTIONS' as an environment variable
`raco setup' that is used to build minimal-Racket libraries. See the are passed on to the `raco setup' that is used to build minimal-Racket
documentation for `raco setup' for information on the options. libraries. See the documentation for `raco setup' for information on
the options.
For cross compilation, add configuration options to
`CONFIGURE_ARGS_qq="..."' as descibed in the "README" of "racket/src",
but also add a `PLAIN_RACKET=...' argument for the top-level makefile
to specify the same executable as in an `--enable-racket=...' for
`configure'.
Installing Packages Installing Packages
------------------- -------------------
@ -305,8 +320,8 @@ where <dist-base> defaults to "racket" (but can be set via
normalizing the Windows results to "i386-win32" and "x86_63-win32", normalizing the Windows results to "i386-win32" and "x86_63-win32",
-<dist-suffix> is omitted unless a `#:dist-suffix' string is specified -<dist-suffix> is omitted unless a `#:dist-suffix' string is specified
for the client in the site configuration, and <ext> is for the client in the site configuration, and <ext> is
platform-specific: ".sh" for Unix, ".dmg" or ".pkg" for Mac OS X, and platform-specific: ".sh" for Unix (including Linux), ".dmg" or ".pkg"
".exe" for Windows. for Mac OS X, and ".exe" for Windows.
Generating Installer Web Sites Generating Installer Web Sites
------------------------------ ------------------------------
@ -475,8 +490,8 @@ In more detail:
To change the base name of the installer file, provide `DIST_BASE' To change the base name of the installer file, provide `DIST_BASE'
to `make'. The default is "racket". to `make'. The default is "racket".
To change the directory name for Unix installation, provide To change the directory name for installation on Unix (including
`DIST_DIR' to `make'. The default is "racket". Linux), provide `DIST_DIR' to `make'. The default is "racket".
To add an extra piece to the installer's name, such as an To add an extra piece to the installer's name, such as an
identifier for a variant of Linux, provide `DIST_SUFFIX' to identifier for a variant of Linux, provide `DIST_SUFFIX' to
@ -499,12 +514,20 @@ In more detail:
`make'. The `README' value is used as a file name to download `make'. The `README' value is used as a file name to download
from the server. from the server.
For a Mac OS X installer, set `SIGN_IDENTITY' to sign the To create a ".tgz" archive instead of an installer (or any
installer, where the value of `SIGN_IDENTITY' is the name to platform), set `TGZ_MODE' to "--tgz".
For a Mac OS X installer, set `SIGN_IDENTITY' as the name to
which the signing certificate is associated. Set `MAC_PKG_MODE' which the signing certificate is associated. Set `MAC_PKG_MODE'
to "--mac-pkg" to create a ".pkg" installer instead of a ".dmg" to "--mac-pkg" to create a ".pkg" installer instead of a ".dmg"
image. image.
For a Windows installer, set `OSSLSIGNCODE_ARGS_BASE64` as a
Base64 encoding of an S-expression for a list of argument strings
for `osslsigncode`. The `-n', `-t', `-in', and `-out' arguments
are provided to `osslsigncode` automatically, so supply the
others.
The `SERVER_CATALOG_PATH' and `SERVER_COLLECTS_PATH' makefile The `SERVER_CATALOG_PATH' and `SERVER_COLLECTS_PATH' makefile
variables specify paths at `SERVER' plus `SERVER_PORT' to access variables specify paths at `SERVER' plus `SERVER_PORT' to access
the package catalog and pre-built "collects" tree needed for a the package catalog and pre-built "collects" tree needed for a

103
Makefile
View File

@ -29,13 +29,18 @@ PKGS = main-distribution main-distribution-test
PLAIN_RACKET = racket/bin/racket PLAIN_RACKET = racket/bin/racket
WIN32_PLAIN_RACKET = racket\racket WIN32_PLAIN_RACKET = racket\racket
PLAIN_RACO = racket/bin/racket -N raco -l- raco # In case of cross-installation, point explicitly to local content:
WIN32_PLAIN_RACO = racket\racket -N raco -l- raco RUN_RACKET = $(PLAIN_RACKET) -G racket/etc -X racket/collects
WIN32_RUN_RACKET = $(WIN32_PLAIN_RACKET) -G racket/etc -X racket/collects
DEFAULT_SRC_CATALOG = http://pkgs.racket-lang.org RUN_RACO = $(RUN_RACKET) -N raco -l- raco
WIN32_RUN_RACO = $(WIN32_RUN_RACKET) -N raco -l- raco
MACOSX_CHECK_ARGS = -I racket/base -e '(case (system-type) [(macosx) (exit 0)] [else (exit 1)])' DEFAULT_SRC_CATALOG = https://pkgs.racket-lang.org
MACOSX_CHECK = $(PLAIN_RACKET) -G build/config $(MACOSX_CHECK_ARGS)
# Belongs in the "Configuration options" section, but here
# to accomodate nmake:
SRC_CATALOG = $(DEFAULT_SRC_CATALOG)
CPUS = CPUS =
@ -61,18 +66,18 @@ ALL_PLT_SETUP_OPTIONS = $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
plain-in-place: plain-in-place:
$(MAKE) base $(MAKE) base
$(MAKE) pkgs-catalog $(MAKE) pkgs-catalog
$(PLAIN_RACO) pkg update $(UPDATE_PKGS_ARGS) $(RUN_RACO) pkg update $(UPDATE_PKGS_ARGS)
$(PLAIN_RACO) pkg install $(INSTALL_PKGS_ARGS) $(RUN_RACO) pkg install $(INSTALL_PKGS_ARGS)
$(PLAIN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS) $(RUN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS)
$(PLAIN_RACO) setup $(ALL_PLT_SETUP_OPTIONS) $(RUN_RACO) setup $(ALL_PLT_SETUP_OPTIONS)
win32-in-place: win32-in-place:
$(MAKE) win32-base $(MAKE) win32-base
$(MAKE) win32-pkgs-catalog $(MAKE) win32-pkgs-catalog SRC_CATALOG="$(SRC_CATALOG)"
$(WIN32_PLAIN_RACO) pkg update $(UPDATE_PKGS_ARGS) $(WIN32_RUN_RACO) pkg update $(UPDATE_PKGS_ARGS)
$(WIN32_PLAIN_RACO) pkg install $(INSTALL_PKGS_ARGS) $(WIN32_RUN_RACO) pkg install $(INSTALL_PKGS_ARGS)
$(WIN32_PLAIN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS) $(WIN32_RUN_RACO) setup --only-foreign-libs $(ALL_PLT_SETUP_OPTIONS)
$(WIN32_PLAIN_RACO) setup $(ALL_PLT_SETUP_OPTIONS) $(WIN32_RUN_RACO) setup $(ALL_PLT_SETUP_OPTIONS)
# Rebuild without consulting catalogs or package sources: # Rebuild without consulting catalogs or package sources:
@ -86,11 +91,11 @@ cpus-as-is:
plain-as-is: plain-as-is:
$(MAKE) base $(MAKE) base
$(PLAIN_RACO) setup $(ALL_PLT_SETUP_OPTIONS) $(RUN_RACO) setup $(ALL_PLT_SETUP_OPTIONS)
win32-as-is: win32-as-is:
$(MAKE) win32-base $(MAKE) win32-base
$(WIN32_PLAIN_RACO) setup $(ALL_PLT_SETUP_OPTIONS) $(WIN32_RUN_RACO) setup $(ALL_PLT_SETUP_OPTIONS)
# ------------------------------------------------------------ # ------------------------------------------------------------
# Unix-style build (Unix and Mac OS X, only) # Unix-style build (Unix and Mac OS X, only)
@ -171,6 +176,17 @@ win32-remove-setup-dlls:
racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in
cd racket/src/build; ../configure $(CONFIGURE_ARGS_qq) cd racket/src/build; ../configure $(CONFIGURE_ARGS_qq)
# For cross-compilation, build a native executable with no configure options:
native-for-cross:
mkdir -p racket/src/build/cross
$(MAKE) racket/src/build/cross/Makefile
cd racket/src/build/cross; $(MAKE) reconfigure
cd racket/src/build/cross/racket; $(MAKE)
racket/src/build/cross/Makefile: racket/src/configure racket/src/Makefile.in
cd racket/src/build/cross; ../../configure
# ------------------------------------------------------------ # ------------------------------------------------------------
# Configuration options for building installers # Configuration options for building installers
@ -182,8 +198,8 @@ racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in
# end in "_q" or "_qq", don't use any quote marks on the right-hand # end in "_q" or "_qq", don't use any quote marks on the right-hand
# side of its definition. # side of its definition.
# Catalog for package sources: # Catalog for package sources (defined above):
SRC_CATALOG = $(DEFAULT_SRC_CATALOG) # SRC_CATALOG = $(DEFAULT_SRC_CATALOG)
# A URL embedded in documentation for remote searches, where a Racket # A URL embedded in documentation for remote searches, where a Racket
# version and search key are added as query fields to the URL, and "" # version and search key are added as query fields to the URL, and ""
@ -222,6 +238,9 @@ VERSIONLESS_MODE =
# instead of a ".dmg" for drag-and-drop installation: # instead of a ".dmg" for drag-and-drop installation:
MAC_PKG_MODE = MAC_PKG_MODE =
# Set to "--tgz" to create a ".tgz" archive instead of an installer:
TGZ_MODE =
# Set to "--source --no-setup" to include packages in an installer # Set to "--source --no-setup" to include packages in an installer
# (or archive) only in source form: # (or archive) only in source form:
PKG_SOURCE_MODE = PKG_SOURCE_MODE =
@ -252,10 +271,14 @@ BUILD_STAMP =
# the default as the version number: # the default as the version number:
INSTALL_NAME = INSTALL_NAME =
# A signing identity (spaces allowed) for Mac OS X binaries in an # For Mac OS X, a signing identity (spaces allowed) for binaries in an
# installer: # installer:
SIGN_IDENTITY = SIGN_IDENTITY =
# For Windows, `osslsigncode' arguments other than `-n', `-t', `-in',
# and `-out' as a Base64-encoded, S-expression, list of strings:
OSSLSIGNCODE_ARGS_BASE64 =
# URL for a README file to include in an installer (empty for none, # URL for a README file to include in an installer (empty for none,
# spaces allowed): # spaces allowed):
README = http://$(SVR_PRT)/README.txt README = http://$(SVR_PRT)/README.txt
@ -299,11 +322,11 @@ SVR_PRT = $(SERVER):$(SERVER_PORT)
SVR_CAT = http://$(SVR_PRT)/$(SERVER_CATALOG_PATH) SVR_CAT = http://$(SVR_PRT)/$(SERVER_CATALOG_PATH)
# Helper macros: # Helper macros:
USER_CONFIG = -G build/user/config -A build/user USER_CONFIG = -G build/user/config -X racket/collects -A build/user
RACKET = racket/bin/racket $(USER_CONFIG) RACKET = $(PLAIN_RACKET) $(USER_CONFIG)
RACO = racket/bin/racket $(USER_CONFIG) -N raco -l- raco RACO = $(PLAIN_RACKET) $(USER_CONFIG) -N raco -l- raco
WIN32_RACKET = racket\racket $(USER_CONFIG) WIN32_RACKET = $(WIN32_PLAIN_RACKET) $(USER_CONFIG)
WIN32_RACO = racket\racket $(USER_CONFIG) -N raco -l- raco WIN32_RACO = $(WIN32_PLAIN_RACKET) $(USER_CONFIG) -N raco -l- raco
X_AUTO_OPTIONS = --skip-installed --deps search-auto --pkgs $(JOB_OPTIONS) X_AUTO_OPTIONS = --skip-installed --deps search-auto --pkgs $(JOB_OPTIONS)
USER_AUTO_OPTIONS = --scope user $(X_AUTO_OPTIONS) USER_AUTO_OPTIONS = --scope user $(X_AUTO_OPTIONS)
LOCAL_USER_AUTO = --catalog build/local/catalog $(USER_AUTO_OPTIONS) LOCAL_USER_AUTO = --catalog build/local/catalog $(USER_AUTO_OPTIONS)
@ -312,9 +335,9 @@ REMOTE_USER_AUTO = --catalog $(SVR_CAT) $(USER_AUTO_OPTIONS)
REMOTE_INST_AUTO = --catalog $(SVR_CAT) --scope installation $(X_AUTO_OPTIONS) REMOTE_INST_AUTO = --catalog $(SVR_CAT) --scope installation $(X_AUTO_OPTIONS)
CONFIG_MODE_q = "$(CONFIG)" "$(CONFIG_MODE)" CONFIG_MODE_q = "$(CONFIG)" "$(CONFIG_MODE)"
BUNDLE_CONFIG = bundle/racket/etc/config.rktd BUNDLE_CONFIG = bundle/racket/etc/config.rktd
BUNDLE_RACO_FLAGS = -A bundle/user -l raco BUNDLE_RACO_FLAGS = -G bundle/racket/config -X bundle/racket/collects -A bundle/user -l raco
BUNDLE_RACO = bundle/racket/bin/racket $(BUNDLE_RACO_FLAGS) BUNDLE_RACO = $(PLAIN_RACKET) $(BUNDLE_RACO_FLAGS)
WIN32_BUNDLE_RACO = bundle\racket\racket $(BUNDLE_RACO_FLAGS) WIN32_BUNDLE_RACO = $(WIN32_PLAIN_RACKET) $(BUNDLE_RACO_FLAGS)
# ------------------------------------------------------------ # ------------------------------------------------------------
# Linking all packages (development mode; not an installer build) # Linking all packages (development mode; not an installer build)
@ -323,12 +346,14 @@ PKGS_CATALOG = -U -G build/config -l- pkg/dirs-catalog --link --check-metadata
PKGS_CONFIG = -U -G build/config racket/src/pkgs-config.rkt PKGS_CONFIG = -U -G build/config racket/src/pkgs-config.rkt
pkgs-catalog: pkgs-catalog:
$(PLAIN_RACKET) $(PKGS_CATALOG) racket/share/pkgs-catalog pkgs $(RUN_RACKET) $(PKGS_CATALOG) racket/share/pkgs-catalog pkgs
$(PLAIN_RACKET) $(PKGS_CONFIG) "$(DEFAULT_SRC_CATALOG)" "$(SRC_CATALOG)" $(RUN_RACKET) $(PKGS_CONFIG) "$(DEFAULT_SRC_CATALOG)" "$(SRC_CATALOG)"
$(PLAIN_RACKET) racket/src/pkgs-check.rkt racket/share/pkgs-catalog $(RUN_RACKET) racket/src/pkgs-check.rkt racket/share/pkgs-catalog
COPY_PKGS_ARGS = PLAIN_RACKET="$(WIN32_PLAIN_RACKET)" SRC_CATALOG="$(SRC_CATALOG)"
win32-pkgs-catalog: win32-pkgs-catalog:
$(MAKE) pkgs-catalog PLAIN_RACKET="$(WIN32_PLAIN_RACKET)" $(MAKE) pkgs-catalog $(COPY_PKGS_ARGS)
# ------------------------------------------------------------ # ------------------------------------------------------------
# On a server platform (for an installer build): # On a server platform (for an installer build):
@ -428,14 +453,15 @@ binary-catalog-server:
# client is the same as the server. # client is the same as the server.
PROP_ARGS = SERVER=$(SERVER) SERVER_PORT=$(SERVER_PORT) SERVER_HOSTS="$(SERVER_HOSTS)" \ PROP_ARGS = SERVER=$(SERVER) SERVER_PORT=$(SERVER_PORT) SERVER_HOSTS="$(SERVER_HOSTS)" \
PKGS="$(PKGS)" BUILD_STAMP="$(BUILD_STAMP)" \ PKGS="$(PKGS)" PLAIN_RACKET="$(PLAIN_RACKET)" BUILD_STAMP="$(BUILD_STAMP)" \
RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) \ RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) \
VERSIONLESS_MODE=$(VERSIONLESS_MODE) MAC_PKG_MODE=$(MAC_PKG_MODE) \ VERSIONLESS_MODE=$(VERSIONLESS_MODE) MAC_PKG_MODE=$(MAC_PKG_MODE) \
PKG_SOURCE_MODE="$(PKG_SOURCE_MODE)" INSTALL_NAME="$(INSTALL_NAME)"\ PKG_SOURCE_MODE="$(PKG_SOURCE_MODE)" INSTALL_NAME="$(INSTALL_NAME)" \
DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \ DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \
DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) UPLOAD="$(UPLOAD)" \ DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) UPLOAD="$(UPLOAD)" \
DIST_DESC="$(DIST_DESC)" README="$(README)" SIGN_IDENTITY="$(SIGN_IDENTITY)"\ DIST_DESC="$(DIST_DESC)" README="$(README)" SIGN_IDENTITY="$(SIGN_IDENTITY)" \
JOB_OPTIONS="$(JOB_OPTIONS)" OSSLSIGNCODE_ARGS_BASE64="$(OSSLSIGNCODE_ARGS_BASE64)" JOB_OPTIONS="$(JOB_OPTIONS)" \
TGZ_MODE=$(TGZ_MODE)
COPY_ARGS = $(PROP_ARGS) \ COPY_ARGS = $(PROP_ARGS) \
SERVER_CATALOG_PATH=$(SERVER_CATALOG_PATH) SERVER_COLLECTS_PATH=$(SERVER_COLLECTS_PATH) SERVER_CATALOG_PATH=$(SERVER_CATALOG_PATH) SERVER_COLLECTS_PATH=$(SERVER_COLLECTS_PATH)
@ -476,15 +502,18 @@ bundle-from-server:
rm -rf bundle rm -rf bundle
mkdir -p bundle/racket mkdir -p bundle/racket
$(RACKET) -l setup/unixstyle-install bundle racket bundle/racket $(RACKET) -l setup/unixstyle-install bundle racket bundle/racket
$(RACKET) -l setup/winstrip bundle/racket
$(RACKET) -l setup/winvers-change bundle/racket
$(RACKET) -l distro-build/unpack-collects http://$(SVR_PRT)/$(SERVER_COLLECTS_PATH) $(RACKET) -l distro-build/unpack-collects http://$(SVR_PRT)/$(SERVER_COLLECTS_PATH)
$(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS) $(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS)
$(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS) $(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS)
$(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket $(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket
UPLOAD_q = --readme "$(README)" --upload "$(UPLOAD)" --desc "$(DIST_DESC)" UPLOAD_q = --readme "$(README)" --upload "$(UPLOAD)" --desc "$(DIST_DESC)"
DIST_ARGS_q = $(UPLOAD_q) $(RELEASE_MODE) $(SOURCE_MODE) $(VERSIONLESS_MODE) $(MAC_PKG_MODE) \ DIST_ARGS_q = $(UPLOAD_q) $(RELEASE_MODE) $(SOURCE_MODE) $(VERSIONLESS_MODE) \
$(MAC_PKG_MODE) $(TGZ_MODE) \
"$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(DIST_SUFFIX)" \ "$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(DIST_SUFFIX)" \
"$(SIGN_IDENTITY)" "$(SIGN_IDENTITY)" "$(OSSLSIGNCODE_ARGS_BASE64)"
# Create an installer from the build (with installed packages) that's # Create an installer from the build (with installed packages) that's
# in "bundle/racket": # in "bundle/racket":

View File

@ -5,7 +5,7 @@ License
------- -------
Racket Racket
Copyright (c) 2010-2014 PLT Design Inc. Copyright (c) 2010-2016 PLT Design Inc.
Racket is distributed under the GNU Lesser General Public License Racket is distributed under the GNU Lesser General Public License
(LGPL). This implies that you may link Racket into proprietary (LGPL). This implies that you may link Racket into proprietary

View File

@ -8,11 +8,26 @@ cache:
build_script: build_script:
- '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\vc\vcvarsall.bat" x86' - '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\vc\vcvarsall.bat" x86'
- echo %cd% - echo %cd%
- nmake win32-in-place PKGS="racket-test-core" - nmake win32-in-place PKGS="racket-test unstable-flonum-lib net-test"
test_script: test_script:
- echo %cd% - echo %cd%
- racket\raco.exe pkg show -l
- racket\racket.exe -l tests/racket/test - racket\racket.exe -l tests/racket/test
- racket\racket.exe -l tests/racket/contract/all
- racket\raco.exe test -l tests/json/json
- racket\raco.exe test -l tests/file/main
- racket\raco.exe test -l tests/net/head
- racket\raco.exe test -l tests/net/uri-codec
- racket\raco.exe test -l tests/net/url
- racket\raco.exe test -l tests/net/url-port
- racket\raco.exe test -l tests/net/encoders
- racket\raco.exe test -l tests/openssl/basic
- racket\raco.exe test -l tests/openssl/https
- racket\raco.exe test -l tests/match/main
- racket\raco.exe test -l tests/zo-path
- racket\raco.exe test -l tests/xml/test
notifications: notifications:
- provider: Email - provider: Email
@ -20,3 +35,8 @@ notifications:
- samth@racket-lang.org - samth@racket-lang.org
on_build_success: true on_build_success: true
on_build_failure: true on_build_failure: true
- provider: Slack
auth_token:
secure: WCMkqS/3iB39INmhzQoZDNJ3zcOXLaRueWvaayOD9MW15DcWrGOAxz7dGrhh/EcQ
channel: notifications

View File

@ -1,5 +1,5 @@
at-exp-lib at-exp-lib
Copyright (c) 2010-2014 PLT Design Inc. Copyright (c) 2010-2016 PLT Design Inc.
This package is distributed under the GNU Lesser General Public This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary License (LGPL). This means that you can link this package into proprietary

View File

@ -2,9 +2,19 @@
(provide get-language-info) (provide get-language-info)
(require racket/match)
(define (get-language-info data) (define (get-language-info data)
(define other-get-info
(match data
[(vector mod sym data2)
((dynamic-require mod sym) data2)]
[_ (lambda (key default) default)]))
(lambda (key default) (lambda (key default)
(case key (case key
[(configure-runtime) [(configure-runtime)
'(#[at-exp/lang/runtime-config configure #f])] (define config-vec '#[at-exp/lang/runtime-config configure #f])
[else default]))) (define other-config (other-get-info key default))
(cond [(list? other-config) (cons config-vec other-config)]
[else (list config-vec)])]
[else (other-get-info key default)])))

View File

@ -29,9 +29,10 @@
(lambda (orig-read-syntax) (lambda (orig-read-syntax)
(define read-syntax (wrap-reader orig-read-syntax)) (define read-syntax (wrap-reader orig-read-syntax))
(lambda args (lambda args
(syntax-property (apply read-syntax args) (define stx (apply read-syntax args))
'module-language (define old-prop (syntax-property stx 'module-language))
'#(at-exp/lang/language-info get-language-info #f)))) (define new-prop `#(at-exp/lang/language-info get-language-info ,old-prop))
(syntax-property stx 'module-language new-prop)))
(lambda (proc) (lambda (proc)
(lambda (key defval) (lambda (key defval)
(define (fallback) (if proc (proc key defval) defval)) (define (fallback) (if proc (proc key defval) defval))

View File

@ -1,5 +1,5 @@
base base
Copyright (c) 2010-2014 PLT Design Inc. Copyright (c) 2010-2016 PLT Design Inc.
This package is distributed under the GNU Lesser General Public This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary License (LGPL). This means that you can link this package into proprietary

View File

@ -12,7 +12,7 @@
(define collection 'multi) (define collection 'multi)
(define version "6.2.0.900") (define version "6.4.0.15")
(define deps `("racket-lib" (define deps `("racket-lib"
["racket" #:version ,version])) ["racket" #:version ,version]))

View File

@ -6,9 +6,9 @@
"compatibility-lib" "compatibility-lib"
"r5rs-lib" "r5rs-lib"
"scheme-lib" "scheme-lib"
"srfi-lite-lib"
"racket-test" "racket-test"
"typed-racket-lib")) "typed-racket-lib"
"gui-lib"))
(define pkg-desc "Racket benchmarks") (define pkg-desc "Racket benchmarks")
(define pkg-authors '(eli jay mflatt robby samth stamourv)) (define pkg-authors '(eli jay mflatt robby samth stamourv))

View File

@ -48,6 +48,19 @@ exec racket -qu "$0" ${1+"$@"}
(compile-file name (compile-file name
"compiled/current-bm_rkt.zo")))) "compiled/current-bm_rkt.zo"))))
(define (mk-errortrace bm)
(unless (directory-exists? "compiled")
(make-directory "compiled"))
(parameterize ([current-namespace (make-base-namespace)]
[read-accept-reader #t]
[current-compile (current-compile)]
[error-display-handler (error-display-handler)]
[use-compiled-file-paths (use-compiled-file-paths)])
(dynamic-require 'errortrace #f)
(let ([name (format "~a.rkt" bm)])
(compile-file name
"compiled/current-bm_rkt.zo"))))
(define (compiled-path bm) (define (compiled-path bm)
"current-bm.rkt") "current-bm.rkt")
@ -395,6 +408,14 @@ exec racket -qu "$0" ${1+"$@"}
extract-racket-times extract-racket-times
clean-up-zo clean-up-zo
racket-skip-progs) racket-skip-progs)
(make-impl 'errortrace
void
mk-errortrace
(lambda (bm)
(system (format "racket -l errortrace -u ~a" (compiled-path bm))))
extract-racket-times
clean-up-zo
racket-skip-progs)
(make-impl 'plt-r5rs (make-impl 'plt-r5rs
void void
mk-plt-r5rs mk-plt-r5rs

View File

@ -9,7 +9,8 @@
racket/serialize racket/serialize
(for-syntax syntax/parse (for-syntax syntax/parse
racket/base racket/base
racket/file)) racket/file
syntax/strip-context))
(provide (provide
dynamic-place dynamic-place
@ -117,7 +118,7 @@
new-result)))])) new-result)))]))
(define-syntax (place/base stx) (define-syntax (place/base stx)
(syntax-case stx () (syntax-case (replace-context #'here stx) ()
[(_ module-name (name ch) body ...) [(_ module-name (name ch) body ...)
#'(module module-name racket/base #'(module module-name racket/base
(require "place-processes.rkt") (require "place-processes.rkt")

View File

@ -10,7 +10,7 @@
(module pct1 racket/base (module pct1 racket/base
(require racket/place (require racket/place
racket/match racket/match
"place-utils.rkt") tests/racket/place-utils)
(provide place-main) (provide place-main)
(define (place-main ch) (define (place-main ch)
@ -48,7 +48,7 @@ END
#<<END #<<END
(module pct1 racket/base (module pct1 racket/base
(require racket/place (require racket/place
"place-utils.rkt") tests/racket/place-utils)
(provide place-main) (provide place-main)
(require algol60/parse (require algol60/parse
(for-syntax racket/base (for-syntax racket/base

View File

@ -0,0 +1,80 @@
#lang racket/gui
#|
This is an attempt to simulate what happens when
DrRacket redraws a full window's worth of text
|#
(require framework)
(define t%
(text:column-guide-mixin
(text:line-numbers-mixin
racket:text%)))
(define (time-print-mixin t%)
(class t%
(super-new)
(define/override (on-paint before? dc left top right bottom dx dy draw-caret)
(cond
[before?
(set! start-time (current-process-milliseconds (current-thread)))
(super on-paint before? dc left top right bottom dx dy draw-caret)]
[else
(super on-paint before? dc left top right bottom dx dy draw-caret)
(define now (current-process-milliseconds (current-thread)))
(set! times (cons (- now start-time) times))
(semaphore-post s)]))))
(define start-time #f)
(define times '())
(define s (make-semaphore))
(define t (new (time-print-mixin t%)))
(send t show-line-numbers! #t)
(send t insert "#lang racket/base\n")
(for ([x (in-range 1000)])
(send t insert (format "~s\n" '(let loop ([x ""])
(when (< (string-length x) 100)
(loop (string-append x "y")))))))
(define f (new frame% [label ""] [width 1000] [height 1400]))
(define ec (new editor-canvas% [parent f] [editor t]))
(define height
(let ([yb (box 0)])
(send t position-location (send t last-position) #f yb)
(unbox yb)))
(define width
(let ([xb (box 0)])
(for/fold ([width 0]) ([para (in-range (+ (send t last-paragraph) 1))])
(send t position-location (send t paragraph-end-position para) xb #f #t #t)
(max width (unbox xb)))))
(void (send ec scroll-to 0 (/ height 2) 1 1 #t))
(send f show #t)
;; wait for syntax coloring to finish
(send t freeze-colorer)
(define number-of-experiments 10)
(queue-callback
(λ ()
(set! times '())
(set! s (make-semaphore)) ;; because earlier paints happend before we were ready
(for ([i (in-range number-of-experiments)])
(collect-garbage) (collect-garbage) (collect-garbage)
(send ec refresh)
(yield s))
(semaphore-post done))
#f)
(define done (make-semaphore 0))
(void (yield done))
;; show the actual times.
times
;; print in drdr friendly way
(let ([t (apply + times)])
(printf "cpu time: ~a real time: ~a gc time: ~a\n" t t t))
(send f show #f) (exit)

View File

@ -7,9 +7,6 @@
#lang racket/base #lang racket/base
(require (only-in srfi/13 string-index string-pad-right)
(only-in mzlib/string real->decimal-string))
(define IM 139968) (define IM 139968)
(define IA 3877) (define IA 3877)
(define IC 29573) (define IC 29573)

View File

@ -5,9 +5,6 @@
;; ;;
;; Updated by Brent Fulgham to provide proper output formatting ;; Updated by Brent Fulgham to provide proper output formatting
(require (only-in srfi/13 string-index string-pad-right)
(only-in mzlib/string real->decimal-string))
(define IM 139968) (define IM 139968)
(define IA 3877) (define IA 3877)
(define IC 29573) (define IC 29573)

View File

@ -1,5 +1,5 @@
racket-doc racket-doc
Copyright (c) 2010-2014 PLT Design Inc. Copyright (c) 2010-2016 PLT Design Inc.
This package is distributed under the GNU Lesser General Public This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary License (LGPL). This means that you can link this package into proprietary

View File

@ -2,7 +2,7 @@
@(require scribblings/reference/mz (for-label compatibility/package)) @(require scribblings/reference/mz (for-label compatibility/package))
@(define pack-eval (make-base-eval)) @(define pack-eval (make-base-eval))
@interaction-eval[#:eval pack-eval (require compatibility/package)] @examples[#:hidden #:eval pack-eval (require compatibility/package)]
@title[#:tag "compatibility-package"]{Limiting Scope: @racket[define-package], @racket[open-package], ...} @title[#:tag "compatibility-package"]{Limiting Scope: @racket[define-package], @racket[open-package], ...}
@ -61,11 +61,11 @@ is the exported one.
(define-package presents (doll) (define-package presents (doll)
(define doll "Molly Coddle") (define doll "Molly Coddle")
(define robot "Destructo")) (define robot "Destructo"))
doll (eval:error doll)
robot (eval:error robot)
(open-package presents) (open-package presents)
doll doll
robot (eval:error robot)
(define-package big-russian-doll (middle-russian-doll) (define-package big-russian-doll (middle-russian-doll)
(define-package middle-russian-doll (little-russian-doll) (define-package middle-russian-doll (little-russian-doll)
(define little-russian-doll "Anastasia"))) (define little-russian-doll "Anastasia")))
@ -95,7 +95,7 @@ the defined bindings remain hidden outside the
(package-begin (package-begin
(define secret "mimi") (define secret "mimi")
(list secret)) (list secret))
secret (eval:error secret)
]} ]}
@deftogether[( @deftogether[(

View File

@ -9,7 +9,8 @@
dynext/link-unit dynext/link-unit
dynext/link-sig dynext/link-sig
dynext/file-unit dynext/file-unit
dynext/file-sig)) dynext/file-sig
compiler/module-suffix))
@title{Dynext: Running a C Compiler/Linker} @title{Dynext: Running a C Compiler/Linker}
@ -359,7 +360,11 @@ Appends the platform-standard dynamic-extension file suffix to
(or/c path? false/c)]{ (or/c path? false/c)]{
Strips the Racket file suffix from @racket[s] and returns a stripped Strips the Racket file suffix from @racket[s] and returns a stripped
path. Unlike the other functions below, when @racket[program] is not path. The recognized suffixes are the ones reported by
@racket[(get-module-suffixes #:group 'libs)] when
@racket[extract-base-filename/ss] is first called.
Unlike the other functions below, when @racket[program] is not
@racket[#f], then any suffix (including no suffix) is allowed. If @racket[#f], then any suffix (including no suffix) is allowed. If
@racket[s] is not a Racket file and @racket[program] is @racket[#f], @racket[s] is not a Racket file and @racket[program] is @racket[#f],
@racket[#f] is returned.} @racket[#f] is returned.}

View File

@ -31,7 +31,7 @@ should be considered standard:
and eight numbers; like @racket['png-bytes+bounds], but where and eight numbers; like @racket['png-bytes+bounds], but where
the image encoded that is in the byte string can be padded in the image encoded that is in the byte string can be padded in
each direction (to allow the drawn region to extend beyond each direction (to allow the drawn region to extend beyond
it's ``bounding box''), where the extra four numbers in the its ``bounding box''), where the extra four numbers in the
list specify the amount of padding that was added to the list specify the amount of padding that was added to the
image: left, right, top, and bottom} image: left, right, top, and bottom}
@item{@racket['png@2x-bytes] --- like @racket['png-bytes], but for an @item{@racket['png@2x-bytes] --- like @racket['png-bytes], but for an

View File

@ -10,7 +10,8 @@ and writing @filepath{.ico} files, which contain one or more icons.
Each icon is up to 256 by 256 pixels, has a particular depth (i.e., Each icon is up to 256 by 256 pixels, has a particular depth (i.e.,
bits per pixel used to represent a color), and mask (i.e., whether a bits per pixel used to represent a color), and mask (i.e., whether a
pixel is shown, except that the mask may be ignored for 32-bit icons pixel is shown, except that the mask may be ignored for 32-bit icons
that have an alpha value per pixel). that have an alpha value per pixel). The library also provides support
for reading and writing icons in Windows executables.
@defproc[(ico? [v any/c]) boolean?]{ @defproc[(ico? [v any/c]) boolean?]{
@ -18,25 +19,40 @@ Returns @racket[#t] if @racket[v] represents an icon, @racket[#f]
otherwise.} otherwise.}
@deftogether[( @deftogether[(
@defproc[(ico-width [ico ico?]) (integer-in 1 256)] @defproc[(ico-width [ico ico?]) exact-positive-integer?]
@defproc[(ico-height [ico ico?]) (integer-in 1 256)] @defproc[(ico-height [ico ico?]) exact-positive-integer?]
@defproc[(ico-depth [ico ico?]) (one-of/c 1 2 4 8 16 24 32)] @defproc[(ico-depth [ico ico?]) (one-of/c 1 2 4 8 16 24 32)]
)]{ )]{
Returns the width or height of an icon in pixels, or the depth in bits per Returns the width or height of an icon in pixels, or the depth in bits per
pixel.} pixel.
@history[#:changed "6.3" @elem{A PNG-format icon can have a
width or height greater than 256.}]}
@deftogether[(
@defproc[(ico-format [ico ico?]) (or/c 'bmp 'png)]
)]{
Reports the format of the icon.
@history[#:added "6.3"]}
@defproc[(read-icos [src (or/c path-string? input-port?)]) @defproc[(read-icos [src (or/c path-string? input-port?)])
(listof ico?)]{ (listof ico?)]{
Parses @racket[src] as an @filepath{.ico} to extract a list of icons.} Parses @racket[src] as an @filepath{.ico} to extract a list of icons.}
@defproc[(read-icos-from-exe [src (or/c path-string? input-port?)]) @defproc[(read-icos-from-exe [src (or/c path-string? input-port?)])
(listof ico?)]{ (listof ico?)]{
Parses @racket[src] as an @filepath{.exe} to extract the list of Parses @racket[src] as an @filepath{.exe} to extract the list of
icons that represent the Windows executable.} icons that represent the Windows executable.}
@defproc[(write-icos [icos (listof ico?)] @defproc[(write-icos [icos (listof ico?)]
[dest (or/c path-string? output-port?)] [dest (or/c path-string? output-port?)]
[#:exists exists (or/c 'error 'append 'update 'can-update [#:exists exists (or/c 'error 'append 'update 'can-update
@ -50,22 +66,46 @@ Writes each icon in @racket[icos] to @racket[dest] as an
@racket[exists] is passed on to @racket[open-output-file] to open @racket[exists] is passed on to @racket[open-output-file] to open
@racket[dest] for writing.} @racket[dest] for writing.}
@defproc[(replace-icos [icos (listof ico?)] @defproc[(replace-icos [icos (listof ico?)]
[dest (or/c path-string? output-port?)]) [dest path-string?])
void?]{ void?]{
Writes icons in @racket[icos] to replace icons in @racket[dest] as an Writes icons in @racket[icos] to replace icons in @racket[dest] as an
Windows executable. Only existing icon sizes and depths in the Windows executable. Only existing icon sizes and depths in the
executable are replaced, and best matches for the existing sizes and executable are replaced, and only when the encoding sizes match.
depth are drawn from @racket[icos] (adjusting the scale and depth f a Best matches for the existing sizes and
best match as necessary).} depth are drawn from @racket[icos] (adjusting the scale and depth of a
best match as necessary).
Use @racket[replace-all-icos], instead, to replace a set of icons
wholesale, especially when the set include PNG-format icons.}
@defproc[(replace-all-icos [icos (listof ico?)]
[dest (or/c path-string? output-port?)])
void?]{
Replaces the icon set in the executable @racket[dest] with the given
set of icons.}
@defproc[(ico->argb [ico ico?]) bytes?]{ @defproc[(ico->argb [ico ico?]) bytes?]{
Converts an icon to an ARGB byte string, which has the icon's pixels Converts an icon in BMP format (see @racket[ico-format])
to an ARGB byte string, which has the icon's pixels
in left-to-right, top-to-bottom order, with four bytes (alpha, red, in left-to-right, top-to-bottom order, with four bytes (alpha, red,
green, and blue channels) for each pixel.} green, and blue channels) for each pixel.}
@defproc[(ico->png-bytes [ico ico?]) bytes?]{
Returns the bytes of a PNG encoding for an icon in PNG format (see
@racket[ico-format]).
@history[#:added "6.3"]}
@defproc[(argb->ico [width (integer-in 1 256)] @defproc[(argb->ico [width (integer-in 1 256)]
[height (integer-in 1 256)] [height (integer-in 1 256)]
[bstr bytes?] [bstr bytes?]
@ -73,7 +113,16 @@ green, and blue channels) for each pixel.}
ico?]{ ico?]{
Converts an ARGB byte string (in the same format as from Converts an ARGB byte string (in the same format as from
@racket[ico->argb]) to an icon of the given width, height, and depth. @racket[ico->argb]) to an icon of the given width, height, and depth
in BMP format.
The @racket[bstr] argument must have a length @racket[(* 4 width height)], The @racket[bstr] argument must have a length @racket[(* 4 width height)],
and @racket[(* width depth)] must be a multiple of 8.} and @racket[(* width depth)] must be a multiple of 8.}
@defproc[(png-bytes->ico [bstr bytes?])
ico?]{
Wraps the given PNG encoding as a PNG-encoded icon.
@history[#:added "6.3"]}

View File

@ -11,14 +11,16 @@ directories, files, and symbolic links, and owner
information is not preserved; the owner that is stored in the archive information is not preserved; the owner that is stored in the archive
is always ``root.'' is always ``root.''
Symbolic links (on Unix and Mac OS X) are not followed, and the path Symbolic links (on Unix and Mac OS X) are not followed by default, and the path
in a link must be less than 100 bytes.} in a link must be less than 100 bytes.}
@defproc[(tar [tar-file path-string?] @defproc[(tar [tar-file path-string?]
[path path-string?] ... [path path-string?] ...
[#:follow-links? follow-links? any/c #f]
[#:exists-ok? exists-ok? any/c #f] [#:exists-ok? exists-ok? any/c #f]
[#:path-prefix path-prefix (or/c #f path-string?) #f] [#:path-prefix path-prefix (or/c #f path-string?) #f]
[#:path-filter path-filter (or/c #f (path? . -> . any/c)) #f]
[#:get-timestamp get-timestamp [#:get-timestamp get-timestamp
(path? . -> . exact-integer?) (path? . -> . exact-integer?)
(if timestamp (if timestamp
@ -32,7 +34,8 @@ relative paths for 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
@racket[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
@racket[pathlist-closure]). @racket[pathlist-closure]). If @racket[follow-links?] is false, then
symbolic links are included in the resulting tar file as links.
If @racket[exists-ok?] is @racket[#f], then an exception is raised if If @racket[exists-ok?] is @racket[#f], then an exception is raised if
@racket[tar-file] exists already. If @racket[exists-ok?] is true, then @racket[tar-file] exists already. If @racket[exists-ok?] is true, then
@ -45,12 +48,16 @@ The @racket[get-timestamp] function is used to obtain the modification
date to record in the archive for each file or directory. date to record in the archive for each file or directory.
@history[#:changed "6.0.0.3" @elem{Added the @racket[#:get-timestamp] argument.} @history[#:changed "6.0.0.3" @elem{Added the @racket[#:get-timestamp] argument.}
#:changed "6.1.1.1" @elem{Added the @racket[#:exists-ok?] argument.}]} #:changed "6.1.1.1" @elem{Added the @racket[#:exists-ok?] argument.}
#:changed "6.3.0.3" @elem{Added the @racket[#:follow-links?] argument.}
#:changed "6.3.0.11" @elem{Added the @racket[#:path-filter] argument.}]}
@defproc[(tar->output [paths (listof path?)] @defproc[(tar->output [paths (listof path?)]
[out output-port? (current-output-port)] [out output-port? (current-output-port)]
[#:follow-links? follow-links? any/c #f]
[#:path-prefix path-prefix (or/c #f path-string?) #f] [#:path-prefix path-prefix (or/c #f path-string?) #f]
[#:path-filter path-filter (or/c #f (path? . -> . any/c)) #f]
[#:get-timestamp get-timestamp [#:get-timestamp get-timestamp
(path? . -> . exact-integer?) (path? . -> . exact-integer?)
(if timestamp (if timestamp
@ -64,11 +71,14 @@ archive that is written directly to the @racket[out]. The specified
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.
@history[#:changed "6.0.0.3" @elem{Added the @racket[#:get-timestamp] argument.}]} @history[#:changed "6.0.0.3" @elem{Added the @racket[#:get-timestamp] argument.}
#:changed "6.3.0.3" @elem{Added the @racket[#:follow-links?] argument.}
#:changed "6.3.0.11" @elem{Added the @racket[#:path-filter] argument.}]}
@defproc[(tar-gzip [tar-file path-string?] @defproc[(tar-gzip [tar-file path-string?]
[paths path-string?] ... [paths path-string?] ...
[#:follow-links? follow-links? any/c #f]
[#:exists-ok? exists-ok? any/c #f] [#:exists-ok? exists-ok? any/c #f]
[#:path-prefix path-prefix (or/c #f path-string?) #f] [#:path-prefix path-prefix (or/c #f path-string?) #f]
[#:get-timestamp get-timestamp [#:get-timestamp get-timestamp
@ -81,4 +91,5 @@ without parent directories.
Like @racket[tar], but compresses the resulting file with @racket[gzip]. Like @racket[tar], but compresses the resulting file with @racket[gzip].
@history[#:changed "6.0.0.3" @elem{Added the @racket[#:get-timestamp] argument.} @history[#:changed "6.0.0.3" @elem{Added the @racket[#:get-timestamp] argument.}
#:changed "6.1.1.1" @elem{Added the @racket[#:exists-ok?] argument.}]} #:changed "6.1.1.1" @elem{Added the @racket[#:exists-ok?] argument.}
#:changed "6.3.0.3" @elem{Added the @racket[#:follow-links?] argument.}]}

View File

@ -9,6 +9,7 @@ a function to extract items from a TAR/USTAR archive.}
@defproc[(untar [in (or/c path-string? input-port?)] @defproc[(untar [in (or/c path-string? input-port?)]
[#:dest dest-path (or/c path-string? #f) #f] [#:dest dest-path (or/c path-string? #f) #f]
[#:strip-count strip-count exact-nonnegative-integer? 0] [#:strip-count strip-count exact-nonnegative-integer? 0]
[#:permissive? permissive? any/c #f]
[#:filter filter-proc [#:filter filter-proc
(path? (or/c path? #f) (path? (or/c path? #f)
symbol? exact-integer? (or/c path? #f) symbol? exact-integer? (or/c path? #f)
@ -28,6 +29,12 @@ elements are removed from the item path from the archive (before
prefixing the path with @racket[dest-path]); if the item's path prefixing the path with @racket[dest-path]); if the item's path
contains @racket[strip-count] elements, then it is not extracted. contains @racket[strip-count] elements, then it is not extracted.
Unless @racket[permissive?] is true, then archive items with paths containing
an up-directory indicator are disallowed, and a link item whose target
is an absolute path or contains an up-directory indicator is also
disallowed. Absolute paths are always disallowed. A disallowed
path triggers an exception.
For each item in the archive, @racket[filter-proc] is applied to For each item in the archive, @racket[filter-proc] is applied to
@itemlist[ @itemlist[
@ -60,4 +67,6 @@ For each item in the archive, @racket[filter-proc] is applied to
] ]
If the result of @racket[filter-proc] is @racket[#f], then the item is If the result of @racket[filter-proc] is @racket[#f], then the item is
not unpacked.} not unpacked.
@history[#:changed "6.3" @elem{Added the @racket[#:permissive?] argument.}]}

View File

@ -11,6 +11,7 @@ a function to extract items from a possible @exec{gzip}ped TAR/USTAR archive.}
@defproc[(untgz [in (or/c path-string? input-port?)] @defproc[(untgz [in (or/c path-string? input-port?)]
[#:dest dest-path (or/c path-string? #f) #f] [#:dest dest-path (or/c path-string? #f) #f]
[#:strip-count strip-count exact-nonnegative-integer? 0] [#:strip-count strip-count exact-nonnegative-integer? 0]
[#:permissive? permissive? any/c #f]
[#:filter filter-proc [#:filter filter-proc
(path? (or/c path? #f) (path? (or/c path? #f)
symbol? exact-integer? (or/c path? #f) symbol? exact-integer? (or/c path? #f)
@ -21,4 +22,6 @@ a function to extract items from a possible @exec{gzip}ped TAR/USTAR archive.}
void?]{ void?]{
The same as @racket[untar], but if @racket[in] is in @exec{gzip} form, The same as @racket[untar], but if @racket[in] is in @exec{gzip} form,
it is @racket[gunzip]ped as it is unpacked.} it is @racket[gunzip]ped as it is unpacked.
@history[#:changed "6.3" @elem{Added the @racket[#:permissive?] argument.}]}

View File

@ -50,6 +50,7 @@ directory while returning the result of @racket[proc].
@defproc[(make-filesystem-entry-reader @defproc[(make-filesystem-entry-reader
[#:dest dest-path (or/c path-string? #f) #f] [#:dest dest-path (or/c path-string? #f) #f]
[#:strip-count strip-count exact-nonnegative-integer? 0] [#:strip-count strip-count exact-nonnegative-integer? 0]
[#:permissive? permissive? any/c #f]
[#:exists exists (or/c 'skip 'error 'replace 'truncate [#:exists exists (or/c 'skip 'error 'replace 'truncate
'truncate/replace 'append 'update 'truncate/replace 'append 'update
'can-update 'must-truncate) 'can-update 'must-truncate)
@ -72,13 +73,21 @@ elements are removed from the entry path from the archive (before
prefixing the path with @racket[dest-path]); if the item's path prefixing the path with @racket[dest-path]); if the item's path
contains @racket[strip-count] elements, then it is not extracted. contains @racket[strip-count] elements, then it is not extracted.
Unless @racket[permissive?] is true, then entries with paths containing
an up-directory indicator are disallowed, and a link entry whose target
is an absolute path or contains an up-directory indicator is also
disallowed. Absolute paths are always disallowed. A disallowed
path triggers an exception.
If @racket[exists] is @racket['skip] and the file for an entry already If @racket[exists] is @racket['skip] and the file for an entry already
exists, then the entry is skipped. Otherwise, @racket[exists] is exists, then the entry is skipped. Otherwise, @racket[exists] is
passed on to @racket[open-output-file] for writing the entry's passed on to @racket[open-output-file] for writing the entry's
inflated content. inflated content.
@history[#:changed "6.0.0.3" @history[#:changed "6.0.0.3"
@elem{Added support for the optional timestamp argument in the result function.}]} @elem{Added support for the optional timestamp argument in the result function.}
#:changed "6.3"
@elem{Added the @racket[#:permissive?] argument.}]}
@defproc[(read-zip-directory [in (or/c path-string? input-port?)]) zip-directory?]{ @defproc[(read-zip-directory [in (or/c path-string? input-port?)]) zip-directory?]{

View File

@ -6,7 +6,7 @@
"base" "base"
"net-lib" "net-lib"
"sandbox-lib" "sandbox-lib"
"scribble-lib" ["scribble-lib" #:version "1.14"]
"racket-index")) "racket-index"))
(define build-deps '("rackunit-doc" (define build-deps '("rackunit-doc"
"compatibility" "compatibility"

View File

@ -4,7 +4,10 @@
(for-label openssl (for-label openssl
racket racket
openssl/sha1 openssl/sha1
openssl/md5)) openssl/md5
openssl/libcrypto
openssl/libssl
(only-in ffi/unsafe ffi-lib ffi-lib?)))
@title{OpenSSL: Secure Communication} @title{OpenSSL: Secure Communication}
@ -26,8 +29,10 @@ or with the Racket distribution. In particular:
included in the Racket distribution for Windows.} included in the Racket distribution for Windows.}
@item{For Mac OS X, @racketmodname[openssl] depends on @item{For Mac OS X, @racketmodname[openssl] depends on
@filepath{libssl.dylib} and @filepath{libcrypto.dylib}, which are @filepath{libssl.dylib} and @filepath{libcrypto.dylib}. Although those
provided by Mac OS X 10.2 and later.} libraries are provided by Mac OS X 10.2 and later, their use is
deprecated, so the Racket distribution for Mac OS X includes newer
versions.}
@item{For Unix, @racketmodname[openssl] depends on @item{For Unix, @racketmodname[openssl] depends on
@filepath{libssl.so} and @filepath{libcrypto.so}, which must be @filepath{libssl.so} and @filepath{libcrypto.so}, which must be
@ -63,7 +68,9 @@ using the functions described in @secref["cert-procs"].
[port-no (integer-in 1 65535)] [port-no (integer-in 1 65535)]
[client-protocol [client-protocol
(or/c ssl-client-context? (or/c ssl-client-context?
'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12) 'secure
'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12)
'auto]) 'auto])
(values input-port? output-port?)]{ (values input-port? output-port?)]{
@ -72,6 +79,10 @@ Connect to the host given by @racket[hostname], on the port given by
return values are as for @racket[tcp-connect]: an input port and an return values are as for @racket[tcp-connect]: an input port and an
output port. output port.
The default @racket['auto] protocol is @bold{insecure}. Use
@racket['secure] for a secure connection. See
@racket[ssl-secure-client-context] for details.
The optional @racket[client-protocol] argument determines which The optional @racket[client-protocol] argument determines which
encryption protocol is used, whether the server's certificate is encryption protocol is used, whether the server's certificate is
checked, etc. The argument can be either a client context created by checked, etc. The argument can be either a client context created by
@ -101,14 +112,16 @@ well-defined communication pattern, where theres no question of
whether the other end is supposed to be sending or reading data. whether the other end is supposed to be sending or reading data.
} }
} @history[#:changed "6.3.0.12" @elem{Added @racket['secure] for
@racket[client-protocol].}]}
@defproc[(ssl-connect/enable-break @defproc[(ssl-connect/enable-break
[hostname string?] [hostname string?]
[port-no (integer-in 1 65535)] [port-no (integer-in 1 65535)]
[client-protocol [client-protocol
(or/c ssl-client-context? (or/c ssl-client-context?
'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12) 'secure 'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12)
'auto]) 'auto])
(values input-port? output-port?)]{ (values input-port? output-port?)]{
@ -146,11 +159,13 @@ The context is cached, so different calls to
@defproc[(ssl-make-client-context @defproc[(ssl-make-client-context
[protocol (or/c 'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12) 'auto]) [protocol (or/c 'secure 'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12)
'auto])
ssl-client-context?]{ ssl-client-context?]{
Creates a context to be supplied to @racket[ssl-connect]. The context Creates a context to be supplied to @racket[ssl-connect]. The context
is @bold{insecure} unless additional steps are taken; see is @bold{insecure} unless @racket['secure] is supplied or additional steps are taken; see
@racket[ssl-secure-client-context] for details. @racket[ssl-secure-client-context] for details.
The client context identifies a communication protocol (as selected by The client context identifies a communication protocol (as selected by
@ -161,6 +176,7 @@ certificates.
The @racket[protocol] should be one of the following: The @racket[protocol] should be one of the following:
@itemize[ @itemize[
@item{@racket['secure] : Equivalent to @racket[(ssl-secure-client-context)].}
@item{@racket['auto] : Automatically negotiates the protocol version @item{@racket['auto] : Automatically negotiates the protocol version
from those that this library considers sufficiently secure---currently from those that this library considers sufficiently secure---currently
TLS versions 1.0 and higher, but subject to change.} TLS versions 1.0 and higher, but subject to change.}
@ -179,27 +195,29 @@ Note that SSL 2.0 support has been removed from many platforms.}
] ]
Not all protocol versions are supported by all servers. The Not all protocol versions are supported by all servers. The
@racket['auto] option offers broad compatibility at a reasonable level @racket['secure] and @racket['auto] options offer broad compatibility at a reasonable level
of security. Note that the security of connections depends on more of security. Note that the security of connections depends on more
than the protocol version; see @racket[ssl-secure-client-context] for than the protocol version; see @racket[ssl-secure-client-context] for
details. details. See also
Not all protocol versions are available on all platforms. See also
@racket[supported-client-protocols] and @racket[supported-client-protocols] and
@racket[supported-server-protocols]. @racket[supported-server-protocols].
@history[ @history[
#:changed "6.1" @elem{Added @racket['tls11] and @racket['tls12].} #:changed "6.1" @elem{Added @racket['tls11] and @racket['tls12].}
#:changed "6.1.1.3" @elem{Default to new @racket['auto] and disabled SSL #:changed "6.1.1.3" @elem{Default to new @racket['auto] and disabled SSL
2.0 and 3.0 by default.} 2.0 and 3.0 by default.}
#:changed "6.3.0.12" @elem{Added @racket['secure].}
]} ]}
@defproc[(supported-client-protocols) @defproc[(supported-client-protocols)
(listof (or/c 'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12))]{ (listof (or/c 'secure 'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12))]{
Returns a list of symbols representing protocols that are supported Returns a list of symbols representing protocols that are supported
for clients on the current platform.} for clients on the current platform.
@history[#:changed "6.3.0.12" @elem{Added @racket['secure].}]}
@defproc[(ssl-client-context? [v any/c]) boolean?]{ @defproc[(ssl-client-context? [v any/c]) boolean?]{
@ -209,7 +227,7 @@ Returns @racket[#t] if @racket[v] is a value produced by
@history[#:added "6.0.1.3"]} @history[#:added "6.0.1.3"]}
@defproc[(ssl-max-client-protocol) (or/c 'sslv2 sslv3 'tls 'tls11 'tls12 #f)]{ @defproc[(ssl-max-client-protocol) (or/c 'sslv2 'sslv3 'tls 'tls11 'tls12 #f)]{
Returns the most recent SSL/TLS protocol version supported by the Returns the most recent SSL/TLS protocol version supported by the
current platform for client connections. current platform for client connections.
@ -228,13 +246,15 @@ current platform for client connections.
[hostname-or-#f (or/c string? #f) #f] [hostname-or-#f (or/c string? #f) #f]
[server-protocol [server-protocol
(or/c ssl-server-context? (or/c ssl-server-context?
'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12) 'secure 'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12)
'auto]) 'auto])
ssl-listener?]{ ssl-listener?]{
Like @racket[tcp-listen], but the result is an SSL listener. The extra optional Like @racket[tcp-listen], but the result is an SSL listener. The extra optional
@racket[server-protocol] is as for @racket[ssl-connect], except that a @racket[server-protocol] is as for @racket[ssl-connect], except that a
context must be a server context instead of a client context. context must be a server context instead of a client context, and
@racket['secure] is simply an alias for @racket['auto].
Call @racket[ssl-load-certificate-chain!] and Call @racket[ssl-load-certificate-chain!] and
@racket[ssl-load-private-key!] to avoid a @emph{no shared cipher} @racket[ssl-load-private-key!] to avoid a @emph{no shared cipher}
@ -247,7 +267,9 @@ An SSL listener is a synchronizable value (see @racket[sync]). It is
ready---with itself as its value---when the underlying TCP listener is ready---with itself as its value---when the underlying TCP listener is
ready. At that point, however, accepting a connection with ready. At that point, however, accepting a connection with
@racket[ssl-accept] may not complete immediately, because @racket[ssl-accept] may not complete immediately, because
further communication is needed to establish the connection.} further communication is needed to establish the connection.
@history[#:changed "6.3.0.12" @elem{Added @racket['secure].}]}
@deftogether[( @deftogether[(
@ -295,11 +317,16 @@ Returns @racket[#t] of @racket[v] is an SSL port produced by
@defproc[(ssl-make-server-context @defproc[(ssl-make-server-context
[protocol (or/c 'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12) [protocol (or/c 'secure 'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12)
'auto]) 'auto])
ssl-server-context?]{ ssl-server-context?]{
Like @racket[ssl-make-client-context], but creates a server context.} Like @racket[ssl-make-client-context], but creates a server context.
For a server context, the @racket['secure] protocol is the same as
@racket['auto].
@history[#:changed "6.3.0.12" @elem{Added @racket['secure].}]}
@defproc[(ssl-server-context? [v any/c]) boolean?]{ @defproc[(ssl-server-context? [v any/c]) boolean?]{
@ -308,14 +335,16 @@ Returns @racket[#t] if @racket[v] is a value produced by
@racket[ssl-make-server-context], @racket[#f] otherwise.} @racket[ssl-make-server-context], @racket[#f] otherwise.}
@defproc[(supported-server-protocols) @defproc[(supported-server-protocols)
(listof (or/c 'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12))]{ (listof (or/c 'secure 'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12))]{
Returns a list of symbols representing protocols that are supported Returns a list of symbols representing protocols that are supported
for servers on the current platform. for servers on the current platform.
@history[#:added "6.0.1.3"]} @history[#:added "6.0.1.3"
#:changed "6.3.0.12" @elem{Added @racket['secure].}]}
@defproc[(ssl-max-server-protocol) (or/c 'sslv2 sslv3 'tls 'tls11 'tls12 #f)]{ @defproc[(ssl-max-server-protocol) (or/c 'sslv2 'sslv3 'tls 'tls11 'tls12 #f)]{
Returns the most recent SSL/TLS protocol version supported by the Returns the most recent SSL/TLS protocol version supported by the
current platform for server connections. current platform for server connections.
@ -337,7 +366,8 @@ current platform for server connections.
ssl-make-server-context ssl-make-server-context
ssl-make-client-context) ssl-make-client-context)
protocol)] protocol)]
[#:encrypt protocol (or/c 'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12) [#:encrypt protocol (or/c 'secure 'auto
'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12)
'auto] 'auto]
[#:close-original? close-original? boolean? #f] [#:close-original? close-original? boolean? #f]
[#:shutdown-on-close? shutdown-on-close? boolean? #f] [#:shutdown-on-close? shutdown-on-close? boolean? #f]
@ -820,3 +850,58 @@ The @racket[md5] function composes @racket[bytes->hex-string] with
Returns a 16-byte byte string that represents the MD5 hash of the Returns a 16-byte byte string that represents the MD5 hash of the
content from @racket[in], consuming all of the input from @racket[in] content from @racket[in], consuming all of the input from @racket[in]
until an end-of-file.} until an end-of-file.}
@; ----------------------------------------------------------------------
@(define foreign-doc '(lib "scribblings/foreign/foreign.scrbl"))
@section[#:tag "libcrypto"]{The @filepath{libcrypto} Shared Library}
@defmodule[openssl/libcrypto]{The @racketmodname[openssl/libcrypto]
library provides a @tech[#:doc foreign-doc]{foreign-library value} for
the @filepath{libcrypto} shared library.}
@defthing[libcrypto (or/c #f ffi-lib?)]{
Returns a @tech[#:doc foreign-doc]{foreign-library value} for
@filepath{libcrypto}, or @racket[#f] if the library could not be found
or loaded. The load attempt uses the versions specified by
@racket[openssl-lib-versions].}
@defthing[libcrypto-load-fail-reason (or/c #f string?)]{
Either @racket[#f] when @racket[libcrypto] is non-@racket[#f], or a
string when @racket[libcrypto] is @racket[#f]. In the latter case, the
string provides an error message for the attempt to load
@filepath{libcrypto}.}
@defthing[openssl-lib-versions (listof string?)]{
A list of versions that are tried for loading @filepath{libcrypto}.
The list of version strings is suitable as a second argument to
@racket[ffi-lib].}
@; ----------------------------------------------------------------------
@section[#:tag "libssl"]{The @filepath{libssl} Shared Library}
@defmodule[openssl/libssl]{The @racketmodname[openssl/libssl]
library provides a @tech[#:doc foreign-doc]{foreign-library value} for
the @filepath{libssl} shared library.}
@defthing[libssl (or/c #f ffi-lib?)]{
Returns a @tech[#:doc foreign-doc]{foreign-library value} for
@filepath{libssl}, or @racket[#f] if the library could not be found
or loaded. The load attempt uses the versions specified by
@racket[openssl-lib-versions].}
@defthing[libssl-load-fail-reason (or/c #f string?)]{
Either @racket[#f] when @racket[libssl] is non-@racket[#f], or a
string when @racket[libssl] is @racket[#f]. In the latter case, the
string provides an error message for the attempt to load
@filepath{libssl}.}

View File

@ -53,3 +53,4 @@ to the @exec{raco pkg} sub-subcommands.
@include-section["name.scrbl"] @include-section["name.scrbl"]
@include-section["db.scrbl"] @include-section["db.scrbl"]
@include-section["dirs-catalog.scrbl"] @include-section["dirs-catalog.scrbl"]
@include-section["envvars.scrbl"]

View File

@ -33,7 +33,7 @@ information about packages:
@exec{version=}@nonterm{version} query (where @nonterm{version} @exec{version=}@nonterm{version} query (where @nonterm{version}
is a Racket version number) in the case of a remote URL. is a Racket version number) in the case of a remote URL.
This URL/path form is use to obtain information about This URL/path form is used to obtain information about
@nonterm{package}. An HTTP request for a remote URL should @nonterm{package}. An HTTP request for a remote URL should
respond with a @racket[read]-able hash table, as described respond with a @racket[read]-able hash table, as described
below. A path in a local directory formed by adding below. A path in a local directory formed by adding
@ -130,7 +130,8 @@ information about packages:
Note that a local directory served as files through an HTTP server Note that a local directory served as files through an HTTP server
works as a remote URL, as long as the @filepath{pkgs} and works as a remote URL, as long as the @filepath{pkgs} and
@filepath{pkgs-all} files are present. @filepath{pkgs-all} files are present (since those are optional for
local but required for HTTP).
The source for the PLT-hosted @tech{package catalog} is in the The source for the PLT-hosted @tech{package catalog} is in the
@racket[(collection-file-path "pkg-catalog" "meta")] @racket[(collection-file-path "pkg-catalog" "meta")]

View File

@ -0,0 +1,14 @@
#lang scribble/manual
@(require "common.rkt")
@title[#:tag "envvars"]{Package Management Environment Variables}
If the @indexed-envvar{PLT_PKG_SSL_NO_VERIFY} environment variable is
set, server certificates are not validated for HTTPS connections. When
accessing Git servers over HTTPS, @envvar{GIT_SSL_NO_VERIFY} must be
set, too, to disable certificate validation.
As noted in the specification of GitHub-repository package sources, if
the @envvar{PLT_USE_GITHUB_API} environment variable is set, GitHub
packages are obtained using the GitHub API protocol instead of using
the Git protocol.

View File

@ -131,7 +131,7 @@ treated as a explicitly installed package.
The PLT @tech{package catalog} at The PLT @tech{package catalog} at
@centerline{@url{http://pkgs.racket-lang.org}} @centerline{@url{https://pkgs.racket-lang.org}}
provides a centralized listing of available Racket packages. The PLT provides a centralized listing of available Racket packages. The PLT
@tech{package catalog} normally will be the first place you check when @tech{package catalog} normally will be the first place you check when
@ -385,7 +385,9 @@ is:
If you want the package to be @nonterm{branch} or @nonterm{tag} If you want the package to be @nonterm{branch} or @nonterm{tag}
instead of @exec{master}, then add @filepath{#@nonterm{branch}} or instead of @exec{master}, then add @filepath{#@nonterm{branch}} or
@filepath{#@nonterm{tag}} to the end of the package source. @filepath{#@nonterm{tag}} to the end of the package source. If your
package is a subdirectory @nonterm{path} within the repository, add
@filepath{?path=@nonterm{path}} to the end of the package source.
Whenever you Whenever you
@ -395,9 +397,10 @@ your changes will automatically be discovered by those who use
@command-ref{update} after installing from your @command-ref{update} after installing from your
GitHub-based @tech{package source}. GitHub-based @tech{package source}.
As of Racket version 6.1.1.1, other Git repository services can work Other Git repository services@margin-note*{Support for services other
than GitHub requires Racket version 6.1.1.1 or later.} can work
just as well as GitHub---including Gitorious or BitBucket---as long as just as well as GitHub---including Gitorious or BitBucket---as long as
the server supports either the ``smart'' HTTP(S) protocol or the the server supports either the HTTP(S) protocol or the
native Git protocol (but use a @exec{git://} path for the latter). native Git protocol (but use a @exec{git://} path for the latter).
The Racket package manager provides more support for Git-based The Racket package manager provides more support for Git-based
@ -445,7 +448,7 @@ by a simple name until it is listed on a @tech{package catalog}.
If you'd like to use the PLT @tech{package catalog}, browse If you'd like to use the PLT @tech{package catalog}, browse
to to
@link["http://pkgs.racket-lang.org/"]{http://pkgs.racket-lang.org/} @link["https://pkgs.racket-lang.org/"]{https://pkgs.racket-lang.org/}
and upload a new package. You will need to create an account and log and upload a new package. You will need to create an account and log
in first. in first.
@ -558,7 +561,7 @@ In your @racket[info.rkt], you should:
] ]
Finally, when listing your package on Finally, when listing your package on
@url{http://pkgs.racket-lang-org}, you should supply a GitHub source @url{https://pkgs.racket-lang-org}, you should supply a GitHub source
using the URL format using the URL format
@tt{github://github.com/@nonterm{user}/@nonterm{repo}/@nonterm{rev}@optional{/@nonterm{path}}} (not @tt{github://github.com/@nonterm{user}/@nonterm{repo}/@nonterm{rev}@optional{/@nonterm{path}}} (not
the @tt{git://} or @exec{http://} format). the @tt{git://} or @exec{http://} format).

View File

@ -102,7 +102,7 @@ develops only a few of them. The intended workflow is as follows:
@commandline{@command{update} --lookup --catalog @nonterm{catalog} --clone @nonterm{path-to}/@nonterm{pkg-name}} @commandline{@command{update} --lookup --catalog @nonterm{catalog} --clone @nonterm{path-to}/@nonterm{pkg-name}}
A suitable @nonterm{catalog} might be @url{http://pkgs.racket-lang.org}.} A suitable @nonterm{catalog} might be @url{https://pkgs.racket-lang.org}.}
@item{A newly cloned package will have the specified (or existing @item{A newly cloned package will have the specified (or existing
installation's) repository as its Git @exec{origin}. If you want to installation's) repository as its Git @exec{origin}. If you want to

View File

@ -103,6 +103,18 @@ used.
@history[#:added "6.1.1.6"]} @history[#:added "6.1.1.6"]}
@deftogether[(
@defparam[current-pkg-network-retries max-retries (or/c #f real?)]
)]{
A parameter that determines the number of times to retry a network communication
that fails due to a connection error. If
a parameter's value is @racket[#f], then the user's configuration is
used.
@history[#:added "6.3"]}
@defproc[(pkg-directory [name string?] @defproc[(pkg-directory [name string?]
[#:cache cache (or/c #f (and/c hash? (not/c immutable?))) #f]) [#:cache cache (or/c #f (and/c hash? (not/c immutable?))) #f])
(or/c path-string? #f)]{ (or/c path-string? #f)]{
@ -161,7 +173,7 @@ the package is should be treated as installed automatically for a
dependency. dependency.
The optional @racket[path] argument is intended for use when The optional @racket[path] argument is intended for use when
@racket[type] is @racket['clone], in which case it specifies< a @racket[type] is @racket['clone], in which case it specifies a
directory containing the repository clone (where the repository itself directory containing the repository clone (where the repository itself
is a directory within @racket[path]). is a directory within @racket[path]).
@ -253,7 +265,8 @@ is true, error messages may suggest specific command-line flags for
[#:force-strip? force-string? boolean? #f] [#:force-strip? force-string? boolean? #f]
[#:multi-clone-mode multi-clone-mode (or/c 'fail 'force 'convert 'ask) 'fail] [#:multi-clone-mode multi-clone-mode (or/c 'fail 'force 'convert 'ask) 'fail]
[#:pull-mode pull-mode (or/c 'ff-only 'try 'rebase) 'ff-only] [#:pull-mode pull-mode (or/c 'ff-only 'try 'rebase) 'ff-only]
[#:link-dirs? link-dirs? boolean? #f]) [#:link-dirs? link-dirs? boolean? #f]
[#:dry-run? dry-run? boolean? #f])
(or/c 'skip (or/c 'skip
#f #f
(listof (or/c path-string? (listof (or/c path-string?
@ -287,7 +300,8 @@ The package lock must be held; see @racket[with-pkg-lock].
@history[#:changed "6.1.1.5" @elem{Added the @racket[#:multi-clone-mode] @history[#:changed "6.1.1.5" @elem{Added the @racket[#:multi-clone-mode]
and @racket[#:infer-clone-from-dir?] arguments.} and @racket[#:infer-clone-from-dir?] arguments.}
#:changed "6.1.1.6" @elem{Added the @racket[#:use-trash?] argument.} #:changed "6.1.1.6" @elem{Added the @racket[#:use-trash?] argument.}
#:changed "6.1.1.8" @elem{Added the @racket[#:pull-mode] argument.}]} #:changed "6.1.1.8" @elem{Added the @racket[#:pull-mode] argument.}
#:changed "6.4.0.14" @elem{Added the @racket[#:dry-run] argument.}]}
@defproc[(pkg-update [sources (listof (or/c string? pkg-desc?))] @defproc[(pkg-update [sources (listof (or/c string? pkg-desc?))]
@ -302,7 +316,7 @@ The package lock must be held; see @racket[with-pkg-lock].
[#:use-cache? use-cache? boolean? #t] [#:use-cache? use-cache? boolean? #t]
[#:skip-uninstalled? skip-uninstalled? boolean? #t] [#:skip-uninstalled? skip-uninstalled? boolean? #t]
[#:quiet? quiet? boolean? #f] [#:quiet? quiet? boolean? #f]
[#:use-trash? boolean? use-trash? #f] [#:use-trash? use-trash? boolean? #f]
[#:from-command-line? from-command-line? boolean? #f] [#:from-command-line? from-command-line? boolean? #f]
[#:strip strip (or/c #f 'source 'binary 'binary-lib) #f] [#:strip strip (or/c #f 'source 'binary 'binary-lib) #f]
[#:force-strip? force-string? boolean? #f] [#:force-strip? force-string? boolean? #f]
@ -310,7 +324,8 @@ The package lock must be held; see @racket[with-pkg-lock].
[#:multi-clone-mode multi-clone-mode (or/c 'fail 'force 'convert 'ask) 'fail] [#:multi-clone-mode multi-clone-mode (or/c 'fail 'force 'convert 'ask) 'fail]
[#:pull-mode pull-mode (or/c 'ff-only 'try 'rebase) 'ff-only] [#:pull-mode pull-mode (or/c 'ff-only 'try 'rebase) 'ff-only]
[#:link-dirs? link-dirs? boolean? #f] [#:link-dirs? link-dirs? boolean? #f]
[#:infer-clone-from-dir? infer-clone-from-dir? boolean? #f]) [#:infer-clone-from-dir? infer-clone-from-dir? boolean? #f]
[#:dry-run? dry-run? boolean? #f])
(or/c 'skip (or/c 'skip
#f #f
(listof (or/c path-string? (listof (or/c path-string?
@ -345,7 +360,8 @@ The package lock must be held; see @racket[with-pkg-lock].
@history[#:changed "6.1.1.5" @elem{Added the @racket[#:multi-clone-mode] @history[#:changed "6.1.1.5" @elem{Added the @racket[#:multi-clone-mode]
and @racket[#:infer-clone-from-dir?] arguments.} and @racket[#:infer-clone-from-dir?] arguments.}
#:changed "6.1.1.6" @elem{Added the @racket[#:use-trash?] argument.} #:changed "6.1.1.6" @elem{Added the @racket[#:use-trash?] argument.}
#:changed "6.1.1.8" @elem{Added the @racket[#:skip-uninstalled?] and @racket[#:pull-mode] arguments.}]} #:changed "6.1.1.8" @elem{Added the @racket[#:skip-uninstalled?] and @racket[#:pull-mode] arguments.}
#:changed "6.4.0.14" @elem{Added the @racket[#:dry-run] argument.}]}
@defproc[(pkg-remove [names (listof string?)] @defproc[(pkg-remove [names (listof string?)]
@ -354,7 +370,8 @@ The package lock must be held; see @racket[with-pkg-lock].
[#:force? force? boolean? #f] [#:force? force? boolean? #f]
[#:quiet? quiet? boolean? #f] [#:quiet? quiet? boolean? #f]
[#:use-trash? boolean? use-trash? #f] [#:use-trash? boolean? use-trash? #f]
[#:from-command-line? from-command-line? boolean? #f]) [#:from-command-line? from-command-line? boolean? #f]
[#:dry-run? dry-run? boolean? #f])
(or/c 'skip (or/c 'skip
#f #f
(listof (or/c path-string? (listof (or/c path-string?
@ -369,7 +386,8 @@ specific command-line flags for @command-ref{remove}.
The package lock must be held; see @racket[with-pkg-lock]. The package lock must be held; see @racket[with-pkg-lock].
@history[#:changed "6.1.1.6" @elem{Added the @racket[#:use-trash?] argument.}]} @history[#:changed "6.1.1.6" @elem{Added the @racket[#:use-trash?] argument.}
#:changed "6.4.0.14" @elem{Added the @racket[#:dry-run] argument.}]}
@defproc[(pkg-new [name path-string?]) @defproc[(pkg-new [name path-string?])
@ -407,7 +425,8 @@ The package lock must be held to allow reads; see
[#:quiet? quiet? boolean? #f] [#:quiet? quiet? boolean? #f]
[#:from-command-line? from-command-line? boolean? #f] [#:from-command-line? from-command-line? boolean? #f]
[#:strip strip (or/c #f 'source 'binary 'binary-lib) #f] [#:strip strip (or/c #f 'source 'binary 'binary-lib) #f]
[#:force-strip? force-string? boolean? #f]) [#:force-strip? force-string? boolean? #f]
[#:dry-run? dry-run? boolean? #f])
(or/c 'skip (or/c 'skip
#f #f
(listof (or/c path-string? (listof (or/c path-string?
@ -419,7 +438,9 @@ Implements @racket[pkg-migrate-command]. The result is the same as for
If @racket[from-command-line?] is true, error messages may suggest If @racket[from-command-line?] is true, error messages may suggest
specific command-line flags for @command-ref{migrate}. specific command-line flags for @command-ref{migrate}.
The package lock must be held; see @racket[with-pkg-lock].} The package lock must be held; see @racket[with-pkg-lock].
@history[#:changed "6.4.0.14" @elem{Added the @racket[#:dry-run] argument.}]}
@defproc[(pkg-catalog-show [names (listof string?)] @defproc[(pkg-catalog-show [names (listof string?)]
@ -678,7 +699,7 @@ represented by @racket[dir] and named @racket[pkg-name].}
[pkg-name string] [pkg-name string]
[#:namespace namespace namespace? (make-base-namespace)] [#:namespace namespace namespace? (make-base-namespace)]
[#:system-type sys-type (or/c #f symbol?) (system-type)] [#:system-type sys-type (or/c #f symbol?) (system-type)]
[#:system-library-subpath sys-lib-subpath (or/c #f path?) [#:system-library-subpath sys-lib-subpath (or/c #f path-for-some-system?)
(system-library-subpath #f)]) (system-library-subpath #f)])
(listof (cons/c symbol? string?))]{ (listof (cons/c symbol? string?))]{

View File

@ -173,8 +173,8 @@ For example,
A package source is inferred to refer A package source is inferred to refer
to a directory only when it does not have a file-archive suffix, does to a directory only when it does not have a file-archive suffix, does
not match the grammar of a package name, and either starts with starts not match the grammar of a package name, and either starts with
with @litchar{file://} or does not start @litchar{file://} or does not start
with alphabetic characters followed by @litchar{://}. In the with alphabetic characters followed by @litchar{://}. In the
case that the package source starts with @litchar{file://}, case that the package source starts with @litchar{file://},
it must be a URL without a @litchar{type} query or it must be a URL without a @litchar{type} query or
@ -285,8 +285,8 @@ is a GitHub package source.
@margin-note{A Github repository source that starts with @margin-note{A Github repository source that starts with
@litchar{git://} obtains the same content that would be accessed if @litchar{git://} obtains the same content that would be accessed if
@litchar{github.com} were not treated specially. The special treatment @litchar{github.com} were not treated specially. The special treatment
is preserved for historical reasons and because GitHub provides an is preserved for historical reasons, especially in combination
interface that is always efficient.} with @envvar{PLT_USE_GITHUB_API}.}
For backward compatibility, an older format is also supported: For backward compatibility, an older format is also supported:
@ -304,7 +304,15 @@ with @litchar{git://github.com/} or @litchar{github://}; a package
source that is otherwise specified as a GitHub reference is source that is otherwise specified as a GitHub reference is
automatically prefixed with @litchar{git://github.com/}. The inferred automatically prefixed with @litchar{git://github.com/}. The inferred
package name is the last element of @nonterm{path} if it is non-empty, package name is the last element of @nonterm{path} if it is non-empty,
otherwise the inferred name is @nonterm{repo}.} otherwise the inferred name is @nonterm{repo}.
If the @indexed-envvar{PLT_USE_GITHUB_API} environment variable is
set, GitHub packages are obtained using the GitHub API protocol
instead of using the Git protocol.
@history[#:changed "6.3" @elem{Changed handling of
GitHub sources to use the Git
protocol by default.}]}
@; ---------------------------------------- @; ----------------------------------------
@item{a @tech{package name} --- A @tech{package catalog} is @item{a @tech{package name} --- A @tech{package catalog} is
@ -329,7 +337,7 @@ URL indicates a remote server, and a @litchar{file://} URL indicates a
local catalog in the form of an SQLite database or a directory tree. local catalog in the form of an SQLite database or a directory tree.
PLT supports two @tech{package catalog} servers that are enabled by PLT supports two @tech{package catalog} servers that are enabled by
default: @url{http://pkgs.racket-lang.org} for new packages and default: @url{https://pkgs.racket-lang.org} for new packages and
@url{http://planet-compats.racket-lang.org} for automatically @url{http://planet-compats.racket-lang.org} for automatically
generated packages for old @|PLaneT| packages. Anyone may host a generated packages for old @|PLaneT| packages. Anyone may host a
@tech{package catalog}, and any file-serving HTTP host can act @tech{package catalog}, and any file-serving HTTP host can act
@ -588,6 +596,9 @@ sub-commands.
]} ]}
@item{@DFlag{dry-run} --- Prevents changes to the current installation. All installation and update work is
staged and checked, but the final installation step is skipped.}
@item{@DFlag{no-setup} --- Does not run @exec{raco setup} after installation. This behavior is also the case if the @item{@DFlag{no-setup} --- Does not run @exec{raco setup} after installation. This behavior is also the case if the
environment variable @envvar{PLT_PKG_NOSETUP} is set to any non-empty value.} environment variable @envvar{PLT_PKG_NOSETUP} is set to any non-empty value.}
@ -605,7 +616,8 @@ sub-commands.
@DFlag{multi-clone} flags.} @DFlag{multi-clone} flags.}
#:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag, and changed #:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag, and changed
the @DFlag{deps} default to depend only on interactive mode.} the @DFlag{deps} default to depend only on interactive mode.}
#:changed "6.1.1.8" @elem{Added the @DFlag{pull} flag.}]} #:changed "6.1.1.8" @elem{Added the @DFlag{pull} flag.}
#:changed "6.4.0.14" @elem{Added the @DFlag{dry-run} flag.}]}
@subcommand{@command/toc{update} @nonterm{option} ... @nonterm{pkg-source} ... @subcommand{@command/toc{update} @nonterm{option} ... @nonterm{pkg-source} ...
@ -715,6 +727,7 @@ the given @nonterm{pkg-source}s.
@item{@DFlag{pull} @nonterm{mode} --- Same as for @command-ref{install}} @item{@DFlag{pull} @nonterm{mode} --- Same as for @command-ref{install}}
@item{@DFlag{dry-run} --- Same as for @command-ref{install}.}
@item{@DFlag{no-setup} --- Same as for @command-ref{install}.} @item{@DFlag{no-setup} --- Same as for @command-ref{install}.}
@item{@DFlag{jobs} @nonterm{n} or @Flag{j} @nonterm{n} --- Same as for @command-ref{install}.} @item{@DFlag{jobs} @nonterm{n} or @Flag{j} @nonterm{n} --- Same as for @command-ref{install}.}
@item{@DFlag{batch} --- Same as for @command-ref{install}.} @item{@DFlag{batch} --- Same as for @command-ref{install}.}
@ -727,7 +740,8 @@ the given @nonterm{pkg-source}s.
when no arguments are provided.} when no arguments are provided.}
#:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag, and changed #:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag, and changed
the @DFlag{deps} default to depend only on interactive mode.} the @DFlag{deps} default to depend only on interactive mode.}
#:changed "6.1.1.8" @elem{Added the @DFlag{skip-uninstalled} and @DFlag{pull} flags.}]} #:changed "6.1.1.8" @elem{Added the @DFlag{skip-uninstalled} and @DFlag{pull} flags.}]
#:changed "6.4.0.14" @elem{Added the @DFlag{dry-run} flag.}}
@subcommand{@command/toc{remove} @nonterm{option} ... @nonterm{pkg} ... @subcommand{@command/toc{remove} @nonterm{option} ... @nonterm{pkg} ...
--- Attempts to remove the given packages. By default, if a package is the dependency --- Attempts to remove the given packages. By default, if a package is the dependency
@ -753,6 +767,7 @@ the given @nonterm{pkg}s.
@item{@Flag{i} or @DFlag{installation} --- Shorthand for @exec{--scope installation}.} @item{@Flag{i} or @DFlag{installation} --- Shorthand for @exec{--scope installation}.}
@item{@Flag{u} or @DFlag{user} --- Shorthand for @exec{--scope user}.} @item{@Flag{u} or @DFlag{user} --- Shorthand for @exec{--scope user}.}
@item{@DFlag{scope-dir} @nonterm{dir} --- Selects @nonterm{dir} as the @tech{package scope}, the same as for @command-ref{install}.} @item{@DFlag{scope-dir} @nonterm{dir} --- Selects @nonterm{dir} as the @tech{package scope}, the same as for @command-ref{install}.}
@item{@DFlag{dry-run} --- Same as for @command-ref{install}.}
@item{@DFlag{no-setup} --- Same as for @command-ref{install}.} @item{@DFlag{no-setup} --- Same as for @command-ref{install}.}
@item{@DFlag{jobs} @nonterm{n} or @Flag{j} @nonterm{n} --- Same as for @command-ref{install}.} @item{@DFlag{jobs} @nonterm{n} or @Flag{j} @nonterm{n} --- Same as for @command-ref{install}.}
@item{@DFlag{batch} --- Same as for @command-ref{install}.} @item{@DFlag{batch} --- Same as for @command-ref{install}.}
@ -760,7 +775,8 @@ the given @nonterm{pkg}s.
] ]
@history[#:changed "6.1.1.5" @elem{Added the @DFlag{batch} flag.} @history[#:changed "6.1.1.5" @elem{Added the @DFlag{batch} flag.}
#:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag.}]} #:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag.}
#:changed "6.4.0.14" @elem{Added the @DFlag{dry-run} flag.}]}
@subcommand{@command/toc{new} @nonterm{pkg} --- @subcommand{@command/toc{new} @nonterm{pkg} ---
@ -840,10 +856,12 @@ package is created.
@item{@DFlag{ignore-checksums} --- Same as for @command-ref{install}.} @item{@DFlag{ignore-checksums} --- Same as for @command-ref{install}.}
@item{@DFlag{strict-doc-conflicts} --- Same as for @command-ref{install}.} @item{@DFlag{strict-doc-conflicts} --- Same as for @command-ref{install}.}
@item{@DFlag{no-cache} --- Same as for @command-ref{install}.} @item{@DFlag{no-cache} --- Same as for @command-ref{install}.}
@item{@DFlag{dry-run} --- Same as for @command-ref{install}.}
@item{@DFlag{no-setup} --- Same as for @command-ref{install}.} @item{@DFlag{no-setup} --- Same as for @command-ref{install}.}
@item{@DFlag{jobs} @nonterm{n} or @Flag{j} @nonterm{n} --- Same as for @command-ref{install}.} @item{@DFlag{jobs} @nonterm{n} or @Flag{j} @nonterm{n} --- Same as for @command-ref{install}.}
] ]
}
@history[#:changed "6.4.0.14" @elem{Added the @DFlag{dry-run} flag.}]}
@subcommand{@command/toc{create} @nonterm{option} ... @nonterm{directory-or-package} @subcommand{@command/toc{create} @nonterm{option} ... @nonterm{directory-or-package}
--- Bundles a package into an archive. Bundling --- Bundles a package into an archive. Bundling
@ -932,9 +950,12 @@ for @nonterm{key}.
updated that its implementation is kept in the trash folder. Package implementations are updated that its implementation is kept in the trash folder. Package implementations are
removed from a trash folder only when another package is potentially added removed from a trash folder only when another package is potentially added
to the trash folder or @command-ref{empty-trash} is used.} to the trash folder or @command-ref{empty-trash} is used.}
@item{@exec{network-retries} --- The number of times to retry a network communication that
fails due to a connection error.}
] ]
@history[#:changed "6.1.1.6" @elem{Added @exec{trash-max-packages} and @exec{trash-max-seconds}.}]} @history[#:changed "6.1.1.6" @elem{Added @exec{trash-max-packages} and @exec{trash-max-seconds}.}
#:changed "6.3" @elem{Added @exec{network-retries}.}]}
@subcommand{@command/toc{catalog-show} @nonterm{option} ... @nonterm{package-name} ... @subcommand{@command/toc{catalog-show} @nonterm{option} ... @nonterm{package-name} ...
@ -1015,6 +1036,15 @@ for @nonterm{key}.
@item{@DFlag{version} @nonterm{version} or @Flag{v} @nonterm{version} --- Copies catalog @item{@DFlag{version} @nonterm{version} or @Flag{v} @nonterm{version} --- Copies catalog
results specific to @nonterm{version} results specific to @nonterm{version}
(for catalogs that make a distinction), instead of the installation's Racket version.} (for catalogs that make a distinction), instead of the installation's Racket version.}
@item{@DFlag{pkg-fail} @nonterm{mode} --- Determines handling of failure for an individual
package, such as when a @nonterm{src-catalog} contains a bad package source. The
following @nonterm{mode}s are available:
@itemlist[
@item{@exec{fail} (the default) --- archiving stops and fails;}
@item{@exec{skip} --- the package is skipped and omitted from the archive catalog; or}
@item{@exec{continue} --- like @exec{skip}, but @exec{raco pkg catalog-archive}
exits with a status code of @exec{5} if any package was skipped.}
]}
] ]
@history[#:added "6.0.17"] @history[#:added "6.0.17"]
@ -1406,10 +1436,10 @@ tests, and documentation from a package before installing it.
site (where a Racket distribution downloaded from the site is site (where a Racket distribution downloaded from the site is
configured to consult the site for packages), at least for packages configured to consult the site for packages), at least for packages
associated with the distribution. Beware that associated with the distribution. Beware that
@url{http://pkgs.racket-lang.org/} generally refers to @tech{source @url{https://pkgs.racket-lang.org/} generally refers to @tech{source
packages}, not @tech{built packages}. In the near future, built packages}, not @tech{built packages}. In the near future, built
variants of the @url{http://pkgs.racket-lang.org/} packages will be variants of the @url{https://pkgs.racket-lang.org/} packages will be
provided at @url{http://pkg-build.racket-lang.org/catalog/}. provided at @url{https://pkg-build.racket-lang.org/catalog/}.
Some packages have been split at the source level into separate Some packages have been split at the source level into separate
library, test, and documentation packages. For example, library, test, and documentation packages. For example,

View File

@ -74,7 +74,7 @@ the following files and directories:
Any of the above can be suppressed, however, by a Any of the above can be suppressed, however, by a
@racket[source-keep-files] (for @tech{source package} and @tech{built @racket[source-keep-files] (for @tech{source package} and @tech{built
package} bundling), @racket[binary-keep-files] (for @tech{binary package} bundling), @racket[binary-keep-files] (for @tech{binary
package}, @tech{binary library package} @tech{built package} bundling), package}, @tech{binary library package} and @tech{built package} bundling),
or @racket[binary-lib-keep-files] (for @tech{binary library package} bundling) definition in an or @racket[binary-lib-keep-files] (for @tech{binary library package} bundling) definition in an
@filepath{info.rkt} in the package or any subdirectory. A @filepath{info.rkt} in the package or any subdirectory. A
@racket[source-keep-files], @racket[binary-keep-files], or @racket[binary-lib-keep-files] definition @racket[source-keep-files], @racket[binary-keep-files], or @racket[binary-lib-keep-files] definition

View File

@ -36,9 +36,11 @@ the ``Sysmon'' ActiveX control that is included with Windows.
(lambda (doc url) (semaphore-post ready)) (lambda (doc url) (semaphore-post ready))
ex) ex)
;; Navigate to an empty URL to get an initial document: ;; Navigate to get an initial document:
(com-invoke ie "Navigate" "") (com-invoke ie "Navigate" "about:blank")
(semaphore-wait ready) (define READYSTATE_COMPLETE 4)
(unless (= (com-get-property ie "READYSTATE") READYSTATE_COMPLETE)
(semaphore-wait ready))
(define doc (com-get-property ie "Document")) (define doc (com-get-property ie "Document"))
;; Install HTML to show the ActiveX control: ;; Install HTML to show the ActiveX control:

View File

@ -11,11 +11,17 @@ computation in this sense is @emph{not} atomic with respect to other
@tech[#:doc reference.scrbl]{places}, but only to other @tech[#:doc @tech[#:doc reference.scrbl]{places}, but only to other @tech[#:doc
reference.scrbl]{threads} within a place. reference.scrbl]{threads} within a place.
Atomic mode is unsafe, because the Racket scheduler is not able to @elemtag["atomic-unsafe"]{Atomic mode is @bold{unsafe}}, because the
operate while execution is in atomic mode; the scheduler cannot switch Racket scheduler is not able to operate while execution is in atomic
threads or poll certain kinds of events, which can lead to deadlock or mode; the scheduler cannot switch threads or poll certain kinds of
starvation of other threads. Beware that many operations can involve events, which can lead to deadlock or starvation of other threads.
such synchronization, such as writing to an output port. Beware that many operations can involve such synchronization, such as
writing to an output port. Even if an output target is known to be
free of synchronization, beware that values can have arbitrary
printing procedures attached through @racket[prop:custom-write].
Successful use of atomic mode requires a detailed knowledge of any
implementation that might be reached during atomic mode to ensure that
it terminates and does not involve synchronization.
@deftogether[( @deftogether[(
@defproc[(start-atomic) void?] @defproc[(start-atomic) void?]
@ -51,7 +57,9 @@ Using @racket[call-as-atomic] is somewhat safer than using
exiting atomic mode, and it wraps any call to the error value exiting atomic mode, and it wraps any call to the error value
conversion handler with @racket[call-as-nonatomic]. The latter is safe conversion handler with @racket[call-as-nonatomic]. The latter is safe
for a particular atomic region, however, only if the region can be for a particular atomic region, however, only if the region can be
safely interrupted by a non-atomic exception construction.} safely interrupted by a non-atomic exception construction.
See also the caveat that @elemref["atomic-unsafe"]{atomic mode is unsafe}.}
@deftogether[( @deftogether[(
@ -82,11 +90,7 @@ re-raised after exiting atomic mode. Any call to the current
@tech[#:doc reference.scrbl]{error value conversion handler} is @tech[#:doc reference.scrbl]{error value conversion handler} is
effectively wrapped with @racket[call-as-nonatomic]. effectively wrapped with @racket[call-as-nonatomic].
Besides obvious paths to unknown expressions that may not be safe for See also the caveat that @elemref["atomic-unsafe"]{atomic mode is unsafe}.}
atomic mode, beware of printing an arbitrary value in any way other
than the error value conversion handler, because values can have
arbitrary printing procedures attached through
@racket[prop:custom-write].}
@defproc[(call-as-nonatomic [thunk (-> any)]) any]{ @defproc[(call-as-nonatomic [thunk (-> any)]) any]{

View File

@ -209,6 +209,14 @@ A constant for use with @racket[com-invoke] in place of an optional
argument.} argument.}
@defproc[(com-omit? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is @racket[com-omit], @racket[#f]
otherwise.
@history[#:added "6.3.0.3"]}
@; ---------------------------------------- @; ----------------------------------------
@section{COM Properties} @section{COM Properties}

View File

@ -9,7 +9,7 @@
The @racketmodname[ffi/com] and @racketmodname[ffi/unsafe/com] The @racketmodname[ffi/com] and @racketmodname[ffi/unsafe/com]
libraries support COM interaction in two layers. The safe upper layer libraries support COM interaction in two layers. The safe upper layer
provides functions for creating COM objects and dynamically provides functions for creating COM objects and dynamically
constructing method calls based on COM automatiion (i.e., reflective constructing method calls based on COM automation (i.e., reflective
information provided by the object). The unsafe lower layer provides a information provided by the object). The unsafe lower layer provides a
syntactic form and functions for working more directly with COM syntactic form and functions for working more directly with COM
objects and interfaces. objects and interfaces.

View File

@ -23,8 +23,8 @@ the library produced by @racket[ffi-lib-expr]. The syntax of
(code:line #:fail fail-expr)])] (code:line #:fail fail-expr)])]
A @racket[define-id] form binds @racket[id] by extracting a binding A @racket[define-id] form binds @racket[id] by extracting a binding
with the name @racket[c-id] from the library produced by with the name @racket[_c-id] from the library produced by
@racket[ffi-lib-expr], where @racket[c-id] defaults to @racket[id]. @racket[ffi-lib-expr], where @racket[_c-id] defaults to @racket[_id].
The other options support further wrapping and configuration: The other options support further wrapping and configuration:
@itemize[ @itemize[

View File

@ -26,11 +26,16 @@ internal representation of @racket[vec].}
Returns a pointer to an array of @racket[_double] values, which is the Returns a pointer to an array of @racket[_double] values, which is the
internal representation of @racket[flvec].} internal representation of @racket[flvec].}
@defproc[(saved-errno) exact-integer?]{ @defproc*[([(saved-errno) exact-integer?]
[(saved-errno [new-value exact-integer?]) void?])]{
Returns the value most recently saved (in the current thread) after a Returns or sets the error code saved for the current Racket
foreign call with a non-@racket[#f] @racket[#:save-errno] option (see thread. The saved error code is set after a foreign call with a
@racket[_fun] and @racket[_cprocedure]).} non-@racket[#f] @racket[#:save-errno] option (see @racket[_fun] and
@racket[_cprocedure]), but it can also be set explicitly (for example,
to create mock foreign functions for testing).
@history[#:changed "6.4.0.9"]{Added the one-argument variant.}}
@defproc[(lookup-errno [sym (or/c 'EINTR 'EEXIST 'EAGAIN)]) @defproc[(lookup-errno [sym (or/c 'EINTR 'EEXIST 'EAGAIN)])
exact-integer?]{ exact-integer?]{

View File

@ -269,6 +269,56 @@ Check whether @racket[subcls] is @racket[cls] or a subclass.
@history[#:added "6.1.0.5"]} @history[#:added "6.1.0.5"]}
@defproc[(objc-get-class [obj _id]) _Class]{
Extract the class of @racket[obj].
@history[#:added "6.3"]}
@defproc[(objc-set-class! [obj _id] [cls _Class]) void?]{
Changes the class of @racket[obj] to @racket[cls]. The object's
existing representation must be compatible with the new class.
@history[#:added "6.3"]}
@defproc[(objc-get-superclass [cls _Class]) _Class]{
Returns the superclass of @racket[cls].
@history[#:added "6.3"]}
@defproc[(objc-dispose-class [cls _Class]) void?]{
Destroys @racket[cls], which must have no existing instances or
subclasses.
@history[#:added "6.3"]}
@defproc[(objc-block [function-type? ctype]
[proc procedure?]
[#:keep keep (box/c list?)])
cpointer?]{
Wraps a Racket function @racket[proc] as an Objective-C block. The
procedure must accept an initial pointer argument that is the ``self''
argument for the block, and that extra argument must be included in
the given @racket[function-type].
Extra records that are allocated to implement the block are added to
the list in @racket[keep], which might also be included in
@racket[function-type] through a @racket[#:keep] option to
@racket[_fun]. The pointers registered in @racket[keep] must be
retained as long as the block remains in use.
@history[#:added "6.3"]}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section{Raw Runtime Functions} @section{Raw Runtime Functions}

View File

@ -233,7 +233,7 @@ see @|InsideRacket|.
ctype?) ctype?)
@#,elem{absent}] @#,elem{absent}]
[cptr cpointer? @#,elem{absent}] [cptr cpointer? @#,elem{absent}]
[mode (one-of/c 'raw 'atomic 'nonatomic [mode (one-of/c 'raw 'atomic 'nonatomic 'tagged
'atomic-interior 'interior 'atomic-interior 'interior
'stubborn 'uncollectable 'eternal) 'stubborn 'uncollectable 'eternal)
@#,elem{absent}] @#,elem{absent}]
@ -266,6 +266,8 @@ specification is required at minimum:
what allocation function to use. It should be one of what allocation function to use. It should be one of
@indexed-racket['nonatomic] (uses @cpp{scheme_malloc} from @indexed-racket['nonatomic] (uses @cpp{scheme_malloc} from
Racket's C API), @indexed-racket['atomic] Racket's C API), @indexed-racket['atomic]
(@cpp{scheme_malloc_atomic}), @indexed-racket['tagged]
(@cpp{scheme_malloc_tagged}), @indexed-racket['atomic]
(@cpp{scheme_malloc_atomic}), @indexed-racket['stubborn] (@cpp{scheme_malloc_atomic}), @indexed-racket['stubborn]
(@cpp{scheme_malloc_stubborn}), @indexed-racket['uncollectable] (@cpp{scheme_malloc_stubborn}), @indexed-racket['uncollectable]
(@cpp{scheme_malloc_uncollectable}), @indexed-racket['eternal] (@cpp{scheme_malloc_uncollectable}), @indexed-racket['eternal]
@ -282,7 +284,9 @@ specification is required at minimum:
If no mode is specified, then @racket['nonatomic] allocation is used If no mode is specified, then @racket['nonatomic] allocation is used
when the type is a @racket[_gcpointer]- or @racket[_scheme]-based when the type is a @racket[_gcpointer]- or @racket[_scheme]-based
type, and @racket['atomic] allocation is used otherwise.} type, and @racket['atomic] allocation is used otherwise.
@history[#:changed "6.4.0.10" @elem{Added the @racket['tagged] allocation mode.}]}
@defproc[(free [cptr cpointer?]) void]{ @defproc[(free [cptr cpointer?]) void]{

View File

@ -474,6 +474,7 @@ the later case, the result is the @racket[ctype]).}
[#:abi abi (or/c #f 'default 'stdcall 'sysv) #f] [#:abi abi (or/c #f 'default 'stdcall 'sysv) #f]
[#:atomic? atomic? any/c #f] [#:atomic? atomic? any/c #f]
[#:async-apply async-apply (or/c #f ((-> any/c) . -> . any/c) box?) #f] [#:async-apply async-apply (or/c #f ((-> any/c) . -> . any/c) box?) #f]
[#:lock-name lock-name (or/c string? #f) #f]
[#:in-original-place? in-original-place? any/c #f] [#:in-original-place? in-original-place? any/c #f]
[#:save-errno save-errno (or/c #f 'posix 'windows) #f] [#:save-errno save-errno (or/c #f 'posix 'windows) #f]
[#:wrapper wrapper (or/c #f (procedure? . -> . procedure?)) [#:wrapper wrapper (or/c #f (procedure? . -> . procedure?))
@ -536,6 +537,12 @@ For @tech{callouts} to foreign functions with the generated type:
(for example, grabbing a value stored in an ``output'' pointer (for example, grabbing a value stored in an ``output'' pointer
and returning multiple values).} and returning multiple values).}
@item{If @racket[lock-name] is not @racket[#f], then a process-wide
lock with the given name is held during the foreign call. In a
build that supports parallel places, @racket[lock-name] is
registered via @cpp{scheme_register_process_global}, so choose
names that are suitably distinct.}
@item{If @racket[in-original-place?] is true, then when a foreign @item{If @racket[in-original-place?] is true, then when a foreign
@tech{callout} procedure with the generated type is called in @tech{callout} procedure with the generated type is called in
any Racket @tech-place[], the procedure any Racket @tech-place[], the procedure
@ -692,7 +699,8 @@ For @tech{callbacks} to Racket functions with the generated type:
is not used.} is not used.}
] ]
}
@history[#:changed "6.3" @elem{Added the @racket[#:lock-name] argument.}]}
@defform/subs[#:literals (->> :: :) @defform/subs[#:literals (->> :: :)
(_fun fun-option ... maybe-args type-spec ... ->> type-spec (_fun fun-option ... maybe-args type-spec ... ->> type-spec
@ -702,6 +710,7 @@ For @tech{callbacks} to Racket functions with the generated type:
(code:line #:keep keep-expr) (code:line #:keep keep-expr)
(code:line #:atomic? atomic?-expr) (code:line #:atomic? atomic?-expr)
(code:line #:async-apply async-apply-expr) (code:line #:async-apply async-apply-expr)
(code:line #:lock-name lock-name-expr)
(code:line #:in-original-place? in-original-place?-expr) (code:line #:in-original-place? in-original-place?-expr)
(code:line #:retry (retry-id [arg-id init-expr]))] (code:line #:retry (retry-id [arg-id init-expr]))]
[maybe-args code:blank [maybe-args code:blank
@ -821,7 +830,8 @@ specifications:
] ]
@history[#:changed "6.2" @elem{Added the @racket[#:retry] option.}]} @history[#:changed "6.2" @elem{Added the @racket[#:retry] option.}
#:changed "6.3" @elem{Added the @racket[#:lock-name] option.}]}
@defproc[(function-ptr [ptr-or-proc (or cpointer? procedure?)] @defproc[(function-ptr [ptr-or-proc (or cpointer? procedure?)]
[fun-type ctype?]) [fun-type ctype?])
@ -1013,13 +1023,11 @@ Racket vectors instead of lists.}
(_bytes o len-expr)]]{ (_bytes o len-expr)]]{
A @tech{custom function type} that can be used by itself as a simple A @tech{custom function type} that can be used by itself as a simple
type for a byte string as a C pointer. Alternatively, the second form type for a byte string as a C pointer. Coercion of a C pointer to
is for a pointer return value, where the size should be explicitly simply @racket[_bytes] (without a specified length) requires that the pointer
specified. refers to a nul-terminated byte string. When the length-specifying form is used
for a function argument, a byte string is allocated with the given
There is no need for other modes analogous to those of @racket[_ptr]: length, including an extra byte for the nul terminator.}
input or input/output would be just like @racket[_bytes], since the
string carries its size information.}
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@ -1047,7 +1055,7 @@ members.}
@defproc[(_list-struct [#:alignment alignment (or/c #f 1 2 4 8 16) #f] @defproc[(_list-struct [#:alignment alignment (or/c #f 1 2 4 8 16) #f]
[#:malloc-mode malloc-mode [#:malloc-mode malloc-mode
(one-of/c 'raw 'atomic 'nonatomic (one-of/c 'raw 'atomic 'nonatomic 'tagged
'atomic-interior 'interior 'atomic-interior 'interior
'stubborn 'uncollectable 'eternal) 'stubborn 'uncollectable 'eternal)
'atomic] 'atomic]
@ -1073,10 +1081,11 @@ below for a more efficient approach.
(property (code:line #:alignment alignment-expr) (property (code:line #:alignment alignment-expr)
(code:line #:malloc-mode malloc-mode-expr) (code:line #:malloc-mode malloc-mode-expr)
(code:line #:property prop-expr val-expr) (code:line #:property prop-expr val-expr)
#:no-equal)] #:no-equal
#:define-unsafe)]
#:contracts ([offset-expr exact-integer?] #:contracts ([offset-expr exact-integer?]
[alignment-expr (or/c #f 1 2 4 8 16)] [alignment-expr (or/c #f 1 2 4 8 16)]
[malloc-mode-expr (one-of/c 'raw 'atomic 'nonatomic [malloc-mode-expr (one-of/c 'raw 'atomic 'nonatomic 'tagged
'atomic-interior 'interior 'atomic-interior 'interior
'stubborn 'uncollectable 'eternal)] 'stubborn 'uncollectable 'eternal)]
[prop-expr struct-type-property?])]{ [prop-expr struct-type-property?])]{
@ -1122,7 +1131,16 @@ The resulting bindings are as follows:
@item{@racketidfont{set-}@racketvarfont{id}@racketidfont{-}@racket[field-id]@racketidfont{!} @item{@racketidfont{set-}@racketvarfont{id}@racketidfont{-}@racket[field-id]@racketidfont{!}
: a mutator function for each @racket[field-id].} : a mutator function for each @racket[field-id].}
@item{@racketvarfont{id}: structure-type information compatible with @item{@racketvarfont{id}@racketidfont{-}@racket[field-id]@racketidfont{-offset}
: the absolute offset, in bytes, of each @racket[field-id], if @racket[#:define-unsafe] is present.}
@item{@racketidfont{unsafe-}@racketvarfont{id}@racketidfont{-}@racket[field-id]
: an unsafe accessor function for each @racket[field-id], if @racket[#:define-unsafe] is present.}
@item{@racketidfont{unsafe-set-}@racketvarfont{id}@racketidfont{-}@racket[field-id]@racketidfont{!}
: an unsafe mutator function for each @racket[field-id], if @racket[#:define-unsafe] is present.}
@item{@racketvarfont{id}: structure-type information compatible with
@racket[struct-out] or @racket[match] (but not @racket[struct] or @racket[struct-out] or @racket[match] (but not @racket[struct] or
@racket[define-struct]); @racket[define-struct]);
currently, this information is correct only when no @racket[super-id] currently, this information is correct only when no @racket[super-id]
@ -1320,7 +1338,8 @@ expects arguments for both the super fields and the new ones:
] ]
@history[#:changed "6.0.0.6" @elem{Added @racket[#:malloc-mode].} @history[#:changed "6.0.0.6" @elem{Added @racket[#:malloc-mode].}
#:changed "6.1.1.8" @elem{Added @racket[#:offset] for fields.}]} #:changed "6.1.1.8" @elem{Added @racket[#:offset] for fields.}
#:changed "6.3.0.13" @elem{Added @racket[#:define-unsafe].}]}
@; ------------------------------------------------------------ @; ------------------------------------------------------------

View File

@ -1,6 +1,7 @@
#lang scribble/doc #lang scribble/doc
@(require scribble/manual scribble/eval "utils.rkt" @(require scribble/manual scribble/eval "utils.rkt"
(for-label racket/contract)) (for-label racket/base
racket/contract))
@title[#:tag "contract-boundaries"]{Contracts and Boundaries} @title[#:tag "contract-boundaries"]{Contracts and Boundaries}

View File

@ -67,13 +67,13 @@ The new argument specifies who is to be blamed for
positive and negative contract violations. positive and negative contract violations.
Contracts, in this system, are always Contracts, in this system, are always
established between two parties. One party provides some established between two parties. One party, called the server, provides some
value according to the contract, and the other consumes the value according to the contract, and the other, the client, consumes the
value, also according to the contract. The first is called value, also according to the contract. The server is called
the ``positive'' person and the second the ``negative''. So, the positive position and the client the negative position. So,
in the case of just the integer contract, the only thing in the case of just the integer contract, the only thing
that can go wrong is that the value provided is not an that can go wrong is that the value provided is not an
integer. Thus, only the positive party can ever accrue integer. Thus, only the positive party (the server) can ever accrue
blame. The @racket[raise-blame-error] function always blames blame. The @racket[raise-blame-error] function always blames
the positive party. the positive party.
@ -114,16 +114,19 @@ This technique is not merely a cheap trick to get the example to work,
however. The reversal of the positive and the negative is a however. The reversal of the positive and the negative is a
natural consequence of the way functions behave. That is, natural consequence of the way functions behave. That is,
imagine the flow of values in a program between two imagine the flow of values in a program between two
modules. First, one module defines a function, and then that modules. First, one module (the server) defines a function, and then that
module is required by another. So far, the function itself module is required by another (the client). So far, the function itself
has to go from the original, providing module to the has to go from the original, providing module to the
requiring module. Now, imagine that the providing module requiring module. Now, imagine that the providing module
invokes the function, supplying it an argument. At this invokes the function, supplying it an argument. At this
point, the flow of values reverses. The argument is point, the flow of values reverses. The argument is
traveling back from the requiring module to the providing traveling back from the requiring module to the providing
module! And finally, when the function produces a result, module! The client is ``serving'' the argument to the server,
and the server is receiving that value as a client.
And finally, when the function produces a result,
that result flows back in the original that result flows back in the original
direction. Accordingly, the contract on the domain reverses direction from server to client.
Accordingly, the contract on the domain reverses
the positive and the negative blame parties, just like the flow the positive and the negative blame parties, just like the flow
of values reverses. of values reverses.

View File

@ -404,10 +404,13 @@ the contract so that error messages become intelligible:
@interaction[#:eval @interaction[#:eval
contract-eval contract-eval
(module improved-bank-server racket (module improved-bank-server racket
(define (amount? x) (and (number? x) (integer? x) (>= x 0))) (provide
(define amount (flat-named-contract 'amount amount?)) (contract-out
[deposit (-> (flat-named-contract
(provide (contract-out [deposit (amount . -> . any)])) 'amount
(λ (x)
(and (number? x) (integer? x) (>= x 0))))
any)]))
(define total 0) (define total 0)
(define (deposit a) (set! total (+ a total))))] (define (deposit a) (set! total (+ a total))))]
@ -446,5 +449,5 @@ In general, each contract error message consists of six sections:
@item{a description of the precise aspect of the contract that was violated, @lines[1 2]} @item{a description of the precise aspect of the contract that was violated, @lines[1 2]}
@item{the complete contract plus a path into it showing which aspect was violated, @lines[3 2]} @item{the complete contract plus a path into it showing which aspect was violated, @lines[3 2]}
@item{the module where the contract was put (or, more generally, the boundary that the contract mediates), @lines[5 1]} @item{the module where the contract was put (or, more generally, the boundary that the contract mediates), @lines[5 1]}
@item{who was blamed, @lines[6 1]} @item{who was blamed, @lines[6 2]}
@item{and the source location where the contract appears. @lines[7 1]}] @item{and the source location where the contract appears. @lines[8 1]}]

View File

@ -136,8 +136,11 @@ supertype.
(define p (3d-posn 1 2 3)) (define p (3d-posn 1 2 3))
p p
(posn? p) (posn? p)
(posn-x p)
(3d-posn-z p) (3d-posn-z p)
(code:comment "a 3d-posn has an x field, but there is no 3d-posn-x selector:")
(3d-posn-x p)
(code:comment "use the supertype's posn-x selector to access the x field:")
(posn-x p)
] ]
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@ -450,7 +453,7 @@ A @racket[_struct-option] always starts with a keyword:
@racket[#:auto] field option. The constructor procedure does not @racket[#:auto] field option. The constructor procedure does not
accept arguments for automatic fields. Automatic fields are accept arguments for automatic fields. Automatic fields are
implicitly mutable (via reflective operations), but mutator implicitly mutable (via reflective operations), but mutator
functions are bound only if @racket[#:mutator] is also specified. functions are bound only if @racket[#:mutable] is also specified.
@defexamples[ @defexamples[
(struct posn (x y [z #:auto]) (struct posn (x y [z #:auto])

View File

@ -16,7 +16,7 @@ into details---covering much of the Racket toolbox, but leaving
precise details to @|Racket| and other reference manuals. precise details to @|Racket| and other reference manuals.
@margin-note{The source of this manual is available on @margin-note{The source of this manual is available on
@hyperlink["https://github.com/plt/racket/tree/master/pkgs/racket-doc/scribblings/guide"]{GitHub}.} @hyperlink["https://github.com/racket/racket/tree/master/pkgs/racket-doc/scribblings/guide"]{GitHub}.}
@table-of-contents[] @table-of-contents[]

View File

@ -69,10 +69,11 @@ file:
(close-output-port out) (close-output-port out)
] ]
Instead of having to match @racket[open-input-file] and Instead of having to match the open calls with close calls, most Racket
@racket[open-output-file] calls, most Racket programmers will instead programmers will use the @racket[call-with-input-file] and
use @racket[call-with-output-file], which takes a function to call @racket[call-with-output-file] functions which take a function to call to carry
with the output port; when the function returns, the port is closed. out the desired operation. This function gets as its only argument the port,
which is automatically opened and closed for the operation.
@examples[ @examples[
#:eval io-eval #:eval io-eval
@ -318,7 +319,7 @@ Other structure types created by @racket[struct], which offer
more abstraction than @tech{prefab} structure types, normally more abstraction than @tech{prefab} structure types, normally
@racket[write] either using @racketresultfont{#<....>} notation (for @racket[write] either using @racketresultfont{#<....>} notation (for
opaque structure types) or using @racketresultfont{#(....)} vector opaque structure types) or using @racketresultfont{#(....)} vector
notation (for transparent structure types). In neither can the notation (for transparent structure types). In neither case can the
result be read back in as an instance of the structure type: result be read back in as an instance of the structure type:
@interaction[ @interaction[

View File

@ -79,11 +79,11 @@ The difference is that each @racket[_id] is available for use in later
visible one. visible one.
@examples[ @examples[
(let* ([x (list "Borroughs")] (let* ([x (list "Burroughs")]
[y (cons "Rice" x)] [y (cons "Rice" x)]
[z (cons "Edgar" y)]) [z (cons "Edgar" y)])
(list x y z)) (list x y z))
(let* ([name (list "Borroughs")] (let* ([name (list "Burroughs")]
[name (cons "Rice" name)] [name (cons "Rice" name)]
[name (cons "Edgar" name)]) [name (cons "Edgar" name)])
name) name)
@ -93,7 +93,7 @@ In other words, a @racket[let*] form is equivalent to nested
@racket[let] forms, each with a single binding: @racket[let] forms, each with a single binding:
@interaction[ @interaction[
(let ([name (list "Borroughs")]) (let ([name (list "Burroughs")])
(let ([name (cons "Rice" name)]) (let ([name (cons "Rice" name)])
(let ([name (cons "Edgar" name)]) (let ([name (cons "Edgar" name)])
name))) name)))

View File

@ -74,15 +74,7 @@ by @racket[and]ing or @racket[or]ing:
(ormap number? (list "a" "b" 6)) (ormap number? (list "a" "b" 6))
] ]
The @racket[filter] function keeps elements for which the body result The @racket[map], @racket[andmap], and @racket[ormap]
is true, and discards elements for which it is @racket[#f]:
@interaction[
(filter string? (list "a" "b" 6))
(filter positive? (list 1 -2 6 7 0))
]
The @racket[map], @racket[andmap], @racket[ormap], and @racket[filter]
functions can all handle multiple lists, instead of just a single functions can all handle multiple lists, instead of just a single
list. The lists must all have the same length, and the given function list. The lists must all have the same length, and the given function
must accept one argument for each list: must accept one argument for each list:
@ -93,6 +85,14 @@ must accept one argument for each list:
(list 6 3 7)) (list 6 3 7))
] ]
The @racket[filter] function keeps elements for which the body result
is true, and discards elements for which it is @racket[#f]:
@interaction[
(filter string? (list "a" "b" 6))
(filter positive? (list 1 -2 6 7 0))
]
The @racket[foldl] function generalizes some iteration functions. It The @racket[foldl] function generalizes some iteration functions. It
uses the per-element function to both process an element and combine uses the per-element function to both process an element and combine
it with the ``current'' value, so the per-element function takes an it with the ``current'' value, so the per-element function takes an

View File

@ -15,6 +15,8 @@ make simple transformations easy to implement and reliable to
use. Racket also supports arbitrary macro transformers that are use. Racket also supports arbitrary macro transformers that are
implemented in Racket---or in a macro-extended variant of Racket. implemented in Racket---or in a macro-extended variant of Racket.
(For a bottom-up introduction of Racket macro, you may refer to: @(hyperlink "http://www.greghendershott.com/fear-of-macros/" "Fear of Macros"))
@local-table-of-contents[] @local-table-of-contents[]
@;------------------------------------------------------------------------ @;------------------------------------------------------------------------

View File

@ -113,7 +113,7 @@ Racket tools all work automatically with relative paths. For example,
@commandline{racket sort.rkt} @commandline{racket sort.rkt}
on the comamnd line runs the @filepath{sort.rkt} program and on the command line runs the @filepath{sort.rkt} program and
automatically loads and compiles required modules. With a large enough automatically loads and compiles required modules. With a large enough
program, compilation from source can take too long, so use program, compilation from source can take too long, so use
@ -205,7 +205,7 @@ provided by the @filepath{gui} package, while
@filepath{parser-tools} library.@margin-note{More precisely, @filepath{parser-tools} library.@margin-note{More precisely,
@racketmodname[racket/gui] is provided by @filepath{gui-lib}, @racketmodname[racket/gui] is provided by @filepath{gui-lib},
@racketmodname[parser-tools/lex] is provided by @racketmodname[parser-tools/lex] is provided by
@filepath{parser-tools}, and the @filepath{gui} and @filepath{parser-tools-lib}, and the @filepath{gui} and
@filepath{parser-tools} packages extend @filepath{gui-lib} and @filepath{parser-tools} packages extend @filepath{gui-lib} and
@filepath{parser-tools-lib} with documentation.} @filepath{parser-tools-lib} with documentation.}

View File

@ -34,7 +34,7 @@ modular reasoning about programs. For example, in the module,
(provide rx:fish fishy-string?) (provide rx:fish fishy-string?)
(define rx:fish #rx"fish") (define rx:fish #rx"fish")
(define (fishy-string? s) (define (fishy-string? s)
(regexp-match? s rx:fish))) (regexp-match? rx:fish s)))
] ]
the function @racket[fishy-string?] will always match strings that the function @racket[fishy-string?] will always match strings that

View File

@ -28,5 +28,10 @@ many other installed libraries. Run @exec{raco docs} to find
documentation for libraries that are installed on your system and documentation for libraries that are installed on your system and
specific to your user account. specific to your user account.
@link["http://planet.plt-racket.org/"]{@|PLaneT|} offers even more @link["https://pkgs.racket-lang.org/"]{The Racket package repository}
downloadable packages contributed by Racketeers. offer even more downloadable packages that are contributed by
Racketeers.
The legacy @link["http://planet.racket-lang.org/"]{@|PLaneT|} site
offers additional packages, although maintained packages have
generally migrated to the newer package repository.

View File

@ -387,7 +387,7 @@ definition
At the same time, @racket[define-cbr] needs to define @racket[do-f] At the same time, @racket[define-cbr] needs to define @racket[do-f]
using the body of @racket[f], this second part is slightly more using the body of @racket[f], this second part is slightly more
complex, so we defer most it to a @racket[define-for-cbr] helper complex, so we defer most of it to a @racket[define-for-cbr] helper
module, which lets us write @racket[define-cbr] easily enough: module, which lets us write @racket[define-cbr] easily enough:
@ -453,11 +453,11 @@ Step-by-step, expansion proceeds as follows:
@racketblock[ @racketblock[
(define-for-cbr do-f (a b) (define-for-cbr do-f (a b)
() (swap a b)) () (swap a b))
=> (define-for-cbr do-f (b) (unsyntax @tt{=>}) (define-for-cbr do-f (b)
([a get_1 put_1]) (swap a b)) ([a get_1 put_1]) (swap a b))
=> (define-for-cbr do-f () (unsyntax @tt{=>}) (define-for-cbr do-f ()
([a get_1 put_1] [b get_2 put_2]) (swap a b)) ([a get_1 put_1] [b get_2 put_2]) (swap a b))
=> (define (do-f get_1 get_2 put_1 put_2) (unsyntax @tt{=>}) (define (do-f get_1 get_2 put_1 put_2)
(define-get/put-id a get_1 put_1) (define-get/put-id a get_1 put_1)
(define-get/put-id b get_2 put_2) (define-get/put-id b get_2 put_2)
(swap a b)) (swap a b))

View File

@ -2,7 +2,8 @@
@(require scribble/manual "guide-utils.rkt" @(require scribble/manual "guide-utils.rkt"
(for-label racket/flonum (for-label racket/flonum
racket/unsafe/ops racket/unsafe/ops
racket/performance-hint)) racket/performance-hint
ffi/unsafe))
@title[#:tag "performance"]{Performance} @title[#:tag "performance"]{Performance}
@ -358,6 +359,31 @@ crashes or memory corruption.
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section[#:tag "ffi-pointer-access"]{Foreign Pointers}
The @racketmodname[ffi/unsafe] library provides functions for unsafely
reading and writing arbitrary pointer values. The JIT recognizes uses
of @racket[ptr-ref] and @racket[ptr-set!] where the second argument is
a direct reference to one of the following built-in C types:
@racket[_int8], @racket[_int16], @racket[_int32], @racket[_int64],
@racket[_double], @racket[_float], and @racket[_pointer]. Then, if the
first argument to @racket[ptr-ref] or @racket[ptr-set!] is a C pointer
(not a byte string), then the pointer read or write is performed
inline in the generated code.
The bytecode compiler will optimize references to integer
abbreviations like @racket[_int] to C types like
@racket[_int32]---where the representation sizes are constant across
platforms---so the JIT can specialize access with those C types. C
types such as @racket[_long] or @racket[_intptr] are not constant
across platforms, so their uses are currently not specialized by the
JIT.
Pointer reads and writes using @racket[_float] or @racket[_double] are
not currently subject to unboxing optimizations.
@; ----------------------------------------------------------------------
@section[#:tag "regexp-perf"]{Regular Expression Performance} @section[#:tag "regexp-perf"]{Regular Expression Performance}
When a string or byte string is provided to a function like When a string or byte string is provided to a function like
@ -445,7 +471,7 @@ then the expansion of the @racket[let] form to implement
automatically converts the closure to pass itself @racket[n] as an automatically converts the closure to pass itself @racket[n] as an
argument instead. argument instead.
@section{Reachability and Garbage Collection} @section[#:tag "Reachability and Garbage Collection"]{Reachability and Garbage Collection}
In general, Racket re-uses the storage for a value when the In general, Racket re-uses the storage for a value when the
garbage collector can prove that the object is unreachable from garbage collector can prove that the object is unreachable from
@ -508,7 +534,7 @@ There are a number of exceptions, however:
@item{Interned symbols are allocated only once (per place). A table inside @item{Interned symbols are allocated only once (per place). A table inside
Racket tracks this allocation so a symbol may not become garbage Racket tracks this allocation so a symbol may not become garbage
because that table holds onto it.} because that table holds onto it.}
@item{Reachability is only approximate with the CGC collector (i.e., @item{Reachability is only approximate with the @tech{CGC} collector (i.e.,
a value may appear reachable to that collector when there is, a value may appear reachable to that collector when there is,
in fact, no way to reach it anymore.}] in fact, no way to reach it anymore.}]
@ -551,3 +577,53 @@ occurrence of the variable @racket[_fishes]. That constitutes
a reference to the list, ensuring that the list is not itself a reference to the list, ensuring that the list is not itself
garbage collected, and thus the red fish is not either. garbage collected, and thus the red fish is not either.
@section{Reducing Garbage Collection Pauses}
By default, Racket's @tech{generational garbage collector} creates
brief pauses for frequent @deftech{minor collections}, which inspect
only the most recently allocated objects, and long pauses for infrequent
@deftech{major collections}, which re-inspect all memory.
For some applications, such as animations and games,
long pauses due to a major collection can interfere
unacceptably with a program's operation. To reduce major-collection
pauses, the Racket garbage collector supports @deftech{incremental
garbage-collection} mode. In incremental mode, minor collections
create longer (but still relatively short) pauses by performing extra
work toward the next major collection. If all goes well, most of a
major collection's work has been performed by minor collections the
time that a major collection is needed, so the major collection's
pause is as short as a minor collection's pause. Incremental mode
tends to run more slowly overall, but it can
provide much more consistent real-time behavior.
If the @envvar{PLT_INCREMENTAL_GC} environment variable is set
to a value that starts with @litchar{1}, @litchar{y}, or @litchar{Y}
when Racket starts, incremental mode is permanently enabled. Since
incremental mode is only useful for certain parts of some programs,
however, and since the need for incremental mode is a property of a
program rather than its environment, the preferred way to enable
incremental mode is with @racket[(collect-garbage 'incremental)].
Calling @racket[(collect-garbage 'incremental)] does not perform an
immediate garbage collection, but instead requests that each minor
collection perform incremental work up to the next major collection.
The request expires with the next major collection. Make a call to
@racket[(collect-garbage 'incremental)] in any repeating task within
an application that needs to be responsive in real time. Force a
full collection with @racket[(collect-garbage)] just before an initial
@racket[(collect-garbage 'incremental)] to initiate incremental mode
from an optimal state.
To check whether incremental mode is use and how it affects pause
times, enable @tt{debug}-level logging output for the
@racketidfont{GC} topic. For example,
@commandline{racket -W "debuG@"@"GC error" main.rkt}
runs @filepath{main.rkt} with garbage-collection logging to stderr
(while preserving @tt{error}-level logging for all topics). Minor
collections are reported by @litchar{min} lines, increment-mode minor
collection are reported with @litchar{mIn} lines, and major
collections are reported with @litchar{MAJ} lines.

View File

@ -67,13 +67,8 @@ to the same binding:
(free-identifier=? #'car #'car) (free-identifier=? #'car #'car)
(require (only-in racket/base [car also-car])) (require (only-in racket/base [car also-car]))
(free-identifier=? #'car #'also-car) (free-identifier=? #'car #'also-car)
(free-identifier=? #'car (let ([car 8])
#'car))
] ]
The last example above, in particular, illustrates how syntax objects
preserve lexical-context information.
To see the lists, symbols, numbers, @|etc| within a syntax object, use To see the lists, symbols, numbers, @|etc| within a syntax object, use
@racket[syntax->datum]: @racket[syntax->datum]:

View File

@ -5,6 +5,8 @@
@title[#:tag "hash-reader"]{Reader Extensions} @title[#:tag "hash-reader"]{Reader Extensions}
@refdetails["parse-reader"]{reader extensions}
The @tech{reader} layer of the Racket language can be extended through The @tech{reader} layer of the Racket language can be extended through
the @racketmetafont{#reader} form. A reader extension is implemented the @racketmetafont{#reader} form. A reader extension is implemented
as a module that is named after @racketmetafont{#reader}. The module as a module that is named after @racketmetafont{#reader}. The module

View File

@ -603,7 +603,7 @@ As a form for modularity, @racket[unit] complements @racket[module]:
] ]
The @racket[lambda] and @racket[class] forms, among others, also allow The @racket[lambda] and @racket[class] forms, among others, also allow
paremetrization of code with respect to values that are chosen parameterization of code with respect to values that are chosen
later. In principle, any of those could be implemented in terms of any later. In principle, any of those could be implemented in terms of any
of the others. In practice, each form offers certain of the others. In practice, each form offers certain
conveniences---such as allowing overriding of methods or especially conveniences---such as allowing overriding of methods or especially

View File

@ -204,7 +204,7 @@ To package the program as an executable, you have a few options:
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section[#:tag "use-module"]{A Note to Readers with Lisp/Scheme Experience} @section[#:tag "use-module"]{A Note to Readers with Lisp/Scheme Experience}
If you already know something about Racket or Lisp, you might be If you already know something about Scheme or Lisp, you might be
tempted to put just tempted to put just
@racketblock[ @racketblock[

View File

@ -1,5 +1,6 @@
#lang scribble/doc #lang scribble/doc
@(require "utils.rkt") @(require "utils.rkt"
scribble/bnf)
@(define cgc-v-3m "CGC versus 3m") @(define cgc-v-3m "CGC versus 3m")
@ -10,7 +11,8 @@
The Racket run-time system can be embedded into a larger program. The The Racket run-time system can be embedded into a larger program. The
embedding process for Racket CGC or Racket 3m (see @secref[cgc-v-3m]) embedding process for Racket CGC or Racket 3m (see @secref[cgc-v-3m])
is essentially the same, but the process for Racket 3m is most easily is essentially the same, but the process for Racket 3m is most easily
understood as a variant of the process for Racket CGC. understood as a variant of the process for Racket CGC (even though
Racket 3m is the standard variant of Racket).
@section{CGC Embedding} @section{CGC Embedding}
@ -87,7 +89,7 @@ To embed Racket CGC in a program, follow these steps:
@cpp{scheme_main_stack_setup} trampoline registers the C stack with @cpp{scheme_main_stack_setup} trampoline registers the C stack with
the memory manager without creating a namespace.) the memory manager without creating a namespace.)
On 32-bit Windows, when support for parallelism is enabled in the Racket On Windows, when support for parallelism is enabled in the Racket
build (as is the default), then before calling build (as is the default), then before calling
@cpp{scheme_main_setup}, your embedding application must first call @cpp{scheme_main_setup}, your embedding application must first call
@cppi{scheme_register_tls_space}: @cppi{scheme_register_tls_space}:
@ -101,7 +103,12 @@ To embed Racket CGC in a program, follow these steps:
@verbatim[#:indent 2]{ @verbatim[#:indent 2]{
static __declspec(thread) void *tls_space; static __declspec(thread) void *tls_space;
}} }
@history[#:changed "6.3" @elem{Calling @cpp{scheme_register_tls_space} is
required on all Windows variants, although the call
may be a no-op, depending on how Racket is
built.}]}
@item{Configure the namespace by adding module declarations. The @item{Configure the namespace by adding module declarations. The
initial namespace contains declarations only for a few primitive initial namespace contains declarations only for a few primitive
@ -109,16 +116,28 @@ To embed Racket CGC in a program, follow these steps:
into the top-level environment. into the top-level environment.
To embed a module like @racketmodname[racket/base] (along with all To embed a module like @racketmodname[racket/base] (along with all
its dependencies), use @exec{raco ctool --c-mods}, which generates a C file its dependencies), use
@seclink["c-mods" #:doc raco-doc]{@exec{raco ctool --c-mods @nonterm{dest}}},
which generates a C file @nonterm{dest}
that contains modules in bytecode form as encapsulated in a static that contains modules in bytecode form as encapsulated in a static
array. The generated C file defines a @cppi{declare_modules} array. The generated C file defines a @cppi{declare_modules}
function that takes a @cpp{Scheme_Env*}, installs the modules into function that takes a @cpp{Scheme_Env*}, installs the modules into
the environment, and adjusts the module name resolver to access the the environment, and adjusts the module name resolver to access the
embedded declarations. embedded declarations. If embedded modules refer to runtime files
that need to be carried along, supply @DFlag{runtime} to
@exec{raco ctool --c-mods} to collect the runtime files into a
directory; see @secref[#:doc raco-doc "c-mods"] for more information.
Alternately, use @cpp{scheme_set_collects_path} and Alternatively, use @cpp{scheme_set_collects_path} and
@cpp{scheme_init_collection_paths} to configure and install a path @cpp{scheme_init_collection_paths} to configure and install a path
for finding modules at run time.} for finding modules at run time.
On Windows, @exec{raco ctool --c-mods @nonterm{dest} --runtime
@nonterm{dest-dir}} includes in @nonterm{dest-dir} optional DLLs
that are referenced by the Racket library to support @tech[#:doc
reference-doc]{extflonums} and @racket[bytes-open-converter]. Call
@cpp{scheme_set_dll_path} to register @nonterm{dest-dir} so that
those DLLs can be found at run time.}
@item{Access Racket through @cppi{scheme_dynamic_require}, @item{Access Racket through @cppi{scheme_dynamic_require},
@cppi{scheme_load}, @cppi{scheme_eval}, and/or other functions @cppi{scheme_load}, @cppi{scheme_eval}, and/or other functions
@ -163,6 +182,7 @@ static int run(Scheme_Env *e, int argc, char *argv[])
{ {
Scheme_Object *curout; Scheme_Object *curout;
int i; int i;
Scheme_Thread *th;
mz_jmp_buf * volatile save, fresh; mz_jmp_buf * volatile save, fresh;
/* Declare embedded modules in "base.c": */ /* Declare embedded modules in "base.c": */
@ -173,11 +193,13 @@ static int run(Scheme_Env *e, int argc, char *argv[])
curout = scheme_get_param(scheme_current_config(), curout = scheme_get_param(scheme_current_config(),
MZCONFIG_OUTPUT_PORT); MZCONFIG_OUTPUT_PORT);
th = scheme_get_current_thread();
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
save = scheme_current_thread->error_buf; save = th->error_buf;
scheme_current_thread->error_buf = &fresh; th->error_buf = &fresh;
if (scheme_setjmp(scheme_error_buf)) { if (scheme_setjmp(*th->error_buf)) {
scheme_current_thread->error_buf = save; th->error_buf = save;
return -1; /* There was an error */ return -1; /* There was an error */
} else { } else {
Scheme_Object *v, *a[2]; Scheme_Object *v, *a[2];
@ -188,7 +210,7 @@ static int run(Scheme_Env *e, int argc, char *argv[])
a[0] = scheme_intern_symbol("racket/base"); a[0] = scheme_intern_symbol("racket/base");
a[1] = scheme_intern_symbol("read-eval-print-loop"); a[1] = scheme_intern_symbol("read-eval-print-loop");
scheme_apply(scheme_dynamic_require(2, a), 0, NULL); scheme_apply(scheme_dynamic_require(2, a), 0, NULL);
scheme_current_thread->error_buf = save; th->error_buf = save;
} }
} }
return 0; return 0;
@ -200,6 +222,16 @@ int main(int argc, char *argv[])
} }
} }
If modules embedded in the executable need to access runtime files
(via @racketmodname[racket/runtime-path] forms), supply the
@DFlag{runtime} flag to @exec{raco ctool}, specifying a directory
where the runtime files are to be gathered. The modules in the
generated @filepath{.c} file will then refer to the files in that
directory; the directory is normally specified relative to the
executable, but the embedding application must call
@cppi{scheme_set_exec_cmd} to set the executable path (typically
@cpp{argv[0]}) before declaring modules.
On Mac OS X, or on Windows when Racket is compiled to a DLL On Mac OS X, or on Windows when Racket is compiled to a DLL
using Cygwin, the garbage collector cannot find static variables using Cygwin, the garbage collector cannot find static variables
automatically. In that case, @cppi{scheme_main_setup} must be called with a automatically. In that case, @cppi{scheme_main_setup} must be called with a
@ -279,15 +311,17 @@ static int run(Scheme_Env *e, int argc, char *argv[])
Scheme_Object *curout = NULL, *v = NULL, *a[2] = {NULL, NULL}; Scheme_Object *curout = NULL, *v = NULL, *a[2] = {NULL, NULL};
Scheme_Config *config = NULL; Scheme_Config *config = NULL;
int i; int i;
Scheme_Thread *th = NULL;
mz_jmp_buf * volatile save = NULL, fresh; mz_jmp_buf * volatile save = NULL, fresh;
MZ_GC_DECL_REG(8); MZ_GC_DECL_REG(9);
MZ_GC_VAR_IN_REG(0, e); MZ_GC_VAR_IN_REG(0, e);
MZ_GC_VAR_IN_REG(1, curout); MZ_GC_VAR_IN_REG(1, curout);
MZ_GC_VAR_IN_REG(2, save); MZ_GC_VAR_IN_REG(2, save);
MZ_GC_VAR_IN_REG(3, config); MZ_GC_VAR_IN_REG(3, config);
MZ_GC_VAR_IN_REG(4, v); MZ_GC_VAR_IN_REG(4, v);
MZ_GC_ARRAY_VAR_IN_REG(5, a, 2); MZ_GC_VAR_IN_REG(5, th);
MZ_GC_ARRAY_VAR_IN_REG(6, a, 2);
MZ_GC_REG(); MZ_GC_REG();
@ -299,11 +333,13 @@ static int run(Scheme_Env *e, int argc, char *argv[])
config = scheme_current_config(); config = scheme_current_config();
curout = scheme_get_param(config, MZCONFIG_OUTPUT_PORT); curout = scheme_get_param(config, MZCONFIG_OUTPUT_PORT);
th = scheme_get_current_thread();
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
save = scheme_current_thread->error_buf; save = th->error_buf;
scheme_current_thread->error_buf = &fresh; th->error_buf = &fresh;
if (scheme_setjmp(scheme_error_buf)) { if (scheme_setjmp(*th->error_buf)) {
scheme_current_thread->error_buf = save; th->error_buf = save;
return -1; /* There was an error */ return -1; /* There was an error */
} else { } else {
v = scheme_eval_string(argv[i], e); v = scheme_eval_string(argv[i], e);
@ -315,7 +351,7 @@ static int run(Scheme_Env *e, int argc, char *argv[])
a[1] = scheme_intern_symbol("read-eval-print-loop"); a[1] = scheme_intern_symbol("read-eval-print-loop");
v = scheme_dynamic_require(2, a); v = scheme_dynamic_require(2, a);
scheme_apply(v, 0, NULL); scheme_apply(v, 0, NULL);
scheme_current_thread->error_buf = save; th->error_buf = save;
} }
} }

View File

@ -206,7 +206,7 @@ which case the @DFlag{xform} step should be skipped.
To create an extension that behaves as a module, return a symbol from To create an extension that behaves as a module, return a symbol from
@cpp{scheme_module_name}, and have @cpp{scheme_initialize} and @cpp{scheme_module_name}, and have @cpp{scheme_initialize} and
@cpp{scheme_rename} declare a module using @cpp{scheme_primitive_module}. @cpp{scheme_reload} declare a module using @cpp{scheme_primitive_module}.
For example, the following extension implements a module named For example, the following extension implements a module named
@racket[hello] that exports a binding @racket[greeting]: @racket[hello] that exports a binding @racket[greeting]:

View File

@ -64,6 +64,13 @@ Sets the path to be returned by @racket[(find-system-path
'addon-dir)].} 'addon-dir)].}
@function[(void scheme_set_exec_cmd
[const-char* path])]{
Sets the path to be returned by @racket[(find-system-path
'exec-file)].}
@function[(void scheme_init_collection_paths_post @function[(void scheme_init_collection_paths_post
[Scheme_Env* env] [Scheme_Env* env]
[Scheme_Object* pre_extra_paths] [Scheme_Object* pre_extra_paths]
@ -84,6 +91,15 @@ Like @cpp{scheme_init_collection_paths_post}, but with @racket[null]
as the last argument.} as the last argument.}
@function[(void scheme_set_dll_path
[wchar_t* path])]{
On Windows only, sets the path used to find optional DLLs that are used
by the runtime system: @filepath{longdouble.dll} and one of @filepath{iconv.dll},
@filepath{libiconv.dll}, or @filepath{libiconv-2.dll}. The given @var{path}
should be an absolute path.}
@function[(void scheme_seal_parameters)]{ @function[(void scheme_seal_parameters)]{
Takes a snapshot of the current values of built-in parameters. These Takes a snapshot of the current values of built-in parameters. These

View File

@ -196,28 +196,28 @@ A size procedure simply takes a pointer to an object with the tag and
returns its size in words (not bytes). The @cppi{gcBYTES_TO_WORDS} returns its size in words (not bytes). The @cppi{gcBYTES_TO_WORDS}
macro converts a byte count to a word count. macro converts a byte count to a word count.
A mark procedure is used to trace references among objects without A mark procedure is used to trace references among objects. The
moving any objects. The procedure takes a pointer to an object, and it procedure takes a pointer to an object, and it should apply the
should apply the @cppi{gcMARK} macro to every pointer within the @cppi{gcMARK} macro to every pointer within the object. The mark
object. The mark procedure should return the same result as the size procedure should return the same result as the size procedure.
procedure.
A fixup procedure is used to update references to objects after or A fixup procedure is potentially used to update references to objects
while they are moved. The procedure takes a pointer to an object, and that have moved, although the mark procedure may have moved objects
it should apply the @cppi{gcFIXUP} macro to every pointer within the and updated references already. The fixup procedure takes a pointer to
object; the expansion of this macro takes the address of its an object, and it should apply the @cppi{gcFIXUP} macro to every
argument. The fixup procedure should return the same result as the pointer within the object. The fixup procedure should return the same
size procedure. result as the size procedure.
Depending on the collector's implementation, the mark or fixup Depending on the collector's implementation, the @cpp{gcMARK} and/or
procedure might not be used. For example, the collector may only use @cpp{gcFIXUP} macros may take take the address of their arguments, and
the mark procedure and not actually move the object. Or it may use the the fixup procedure might not be used. For example, the collector may
fixup procedure to mark and move objects at the same time. To only use the mark procedure and not actually move the object. Or it
dereference an object pointer during a fixup procedure, use may use mark to move objects at the same time. To dereference an
object pointer during a mark or fixup procedure, use @cppi{GC_resolve}
to convert a potentially old address to the location where the object
has been moved. To dereference an object pointer during a fixup procedure, use
@cppi{GC_fixup_self} to convert the address passed to the procedure to @cppi{GC_fixup_self} to convert the address passed to the procedure to
refer to the potentially moved object, and use @cppi{GC_resolve} to refer to the potentially moved object.
convert an address that is not yet fixed up to determine the object's
current location.
When allocating a tagged object in 3m, the tag must be installed When allocating a tagged object in 3m, the tag must be installed
immediately after the object is allocated---or, at least, before the immediately after the object is allocated---or, at least, before the
@ -899,7 +899,7 @@ overflow.}
[void* ptr] [void* ptr]
[int tls_index])]{ [int tls_index])]{
Only available on 32-bit Windows; registers @var{ptr} as the address of a For Windows, registers @var{ptr} as the address of a
thread-local pointer variable that is declared in the main thread-local pointer variable that is declared in the main
executable. The variable's storage will be used to implement executable. The variable's storage will be used to implement
thread-local storage within the Racket run-time. See thread-local storage within the Racket run-time. See
@ -908,7 +908,10 @@ Only available on 32-bit Windows; registers @var{ptr} as the address of a
The @var{tls_index} argument must be @cpp{0}. It is currently The @var{tls_index} argument must be @cpp{0}. It is currently
ignored, but a future version may use the argument to allow ignored, but a future version may use the argument to allow
declaration of the thread-local variable in a dynamically linked declaration of the thread-local variable in a dynamically linked
DLL.} DLL.
@history[#:changed "6.3" @elem{Changed from available only on 32-bit Windows
to available on all Windows variants.}]}
@function[(void scheme_register_static @function[(void scheme_register_static
[void* ptr] [void* ptr]
@ -1106,9 +1109,7 @@ If the result of the size procedure is a constant, then pass a
3m only. Can be called by a size, mark, or fixup procedure that is registered 3m only. Can be called by a size, mark, or fixup procedure that is registered
with @cpp{GC_register_traversers}. It returns the current address of with @cpp{GC_register_traversers}. It returns the current address of
an object @var{p} that might have been moved already, where @var{p} an object @var{p} that might have been moved already. This translation is necessary, for
corresponds to an object that is referenced directly by the object
being sized, marked, or fixed. This translation is necessary, for
example, if the size or structure of an object depends on the content example, if the size or structure of an object depends on the content
of an object it references. For example, the size of a class instance of an object it references. For example, the size of a class instance
usually depends on a field count that is stored in the class. A fixup usually depends on a field count that is stored in the class. A fixup
@ -1120,13 +1121,58 @@ fixing it.}
3m only. Can be called by a fixup procedure that is registered with 3m only. Can be called by a fixup procedure that is registered with
@cpp{GC_register_traversers}. It returns the final address of @var{p}, @cpp{GC_register_traversers}. It returns the final address of @var{p},
which must be the pointer passed to the fixup procedure. For some which must be the pointer passed to the fixup procedure. The
@cpp{GC_resolve} function would produce the same result, but
@cpp{GC_fixup_self} may be more efficient. For some
implementations of the memory manager, the result is the same as implementations of the memory manager, the result is the same as
@var{p}, either because objects are not moved or because the object is @var{p}, either because objects are not moved or because the object is
moved before it is fixed. With other implementations, an object might moved before it is fixed. With other implementations, an object might
be moved after the fixup process, and the result is the location that be moved after the fixup process, and the result is the location that
the object will have after garbage collection finished.} the object will have after garbage collection finished.}
@function[(void scheme_register_type_gc_shape [short type]
[intptr_t* shape])]{
Like @cpp{GC_register_traversers}, but using a set of predefined
functions that interpret @var{shape} to traverse a value. The
@var{shape} array is a sequence of commands terminated with
@cpp{SCHEME_GC_SHAPE_TERM}, where each command has a single argument.
Commands:
@itemlist[
@item{@tt{#define @cppdef{SCHEME_GC_SHAPE_TERM} 0} --- the terminator
command, which has no argument.}
@item{@tt{#define @cppdef{SCHEME_GC_SHAPE_PTR_OFFSET} 1} ---
specifies that a object tagged with @var{type} has a pointer
to be made visible to the garbage collector, where the command
argument is the offset from the beginning of the object.}
@item{@tt{#define @cppdef{SCHEME_GC_SHAPE_ADD_SIZE} 2} --- specifies
the allocated size of an object tagged with @var{type},
where the command argument is an amount to add to an
accumulated size; currently, size information is not used, but
it may be needed with future implementations of the garbage
collector.}
]
To improve forward compatibility, any other command is assumed to take
a single argument and is ignored.
A GC-shape registration is place-specific, even though
@cpp{scheme_make_type} creates a type tag that spans places. If a
traversal is already installed for @cpp{type} in the current place,
the old traversal specification is replaced. The
@cpp{scheme_register_type_gc_shape} function keeps its own copy of the
array @var{shape}, so the array need not be retained.
@history[#:added "6.4.0.10"]}
@function[(Scheme_Object* scheme_add_gc_callback [Scheme_Object* pre_desc] @function[(Scheme_Object* scheme_add_gc_callback [Scheme_Object* pre_desc]
[Scheme_Object* post_desc])]{ [Scheme_Object* post_desc])]{

View File

@ -364,10 +364,12 @@ any place.}
[void* val])]{ [void* val])]{
Gets or sets a value in a process-global table (i.e., shared across Gets or sets a value in a process-global table (i.e., shared across
multiple places, if any). If @var{val} is NULL, the current mapping multiple places, if any). If @var{val} is @cpp{NULL}, the current mapping
for @var{key} is given, otherwise @var{val} is installed as the value for @var{key} is given. If @var{val} is not @cpp{NULL}, and no value has been
for @var{key} and @cpp{NULL} is returned. The given @var{val} must not installed for that @var{key}, then the value is installed and @cpp{NULL} is returned. If a
refer to garbage-collected memory. value has already been installed, then no new value is installed and the old
value is returned. The given @var{val} must not refer to garbage-collected
memory.
This function is intended for infrequent use with a small number of This function is intended for infrequent use with a small number of
keys.} keys.}

View File

@ -41,7 +41,7 @@ source distribution from @url{http://download.racket-lang.org};
detailed build instructions are in the @filepath{README} file in the detailed build instructions are in the @filepath{README} file in the
top-level @filepath{src} directory. You can also get the latest top-level @filepath{src} directory. You can also get the latest
sources from the @tt{git} repository at sources from the @tt{git} repository at
@url{https://github.com/plt/racket}, but beware that the repository is @url{https://github.com/racket/racket}, but beware that the repository is
one step away from a normal source distribution, and it provides build one step away from a normal source distribution, and it provides build
modes that are more suitable for developing Racket itself; see modes that are more suitable for developing Racket itself; see
@filepath{INSTALL.txt} in the @tt{git} repository for more @filepath{INSTALL.txt} in the @tt{git} repository for more

View File

@ -45,6 +45,13 @@ through the following indices:
@item{@cppdef{MZCONFIG_CAN_READ_COMPILED} --- @racket[read-accept-compiled]} @item{@cppdef{MZCONFIG_CAN_READ_COMPILED} --- @racket[read-accept-compiled]}
@item{@cppdef{MZCONFIG_CAN_READ_BOX} --- @racket[read-accept-box]} @item{@cppdef{MZCONFIG_CAN_READ_BOX} --- @racket[read-accept-box]}
@item{@cppdef{MZCONFIG_CAN_READ_PIPE_QUOTE} --- @racket[read-accept-bar-quote]} @item{@cppdef{MZCONFIG_CAN_READ_PIPE_QUOTE} --- @racket[read-accept-bar-quote]}
@item{@cppdef{MZCONFIG_CAN_READ_DOT} --- @racket[read-accept-dot]}
@item{@cppdef{MZCONFIG_CAN_READ_INFIX_DOT} --- @racket[read-accept-infix-dot]}
@item{@cppdef{MZCONFIG_CAN_READ_QUASI} --- @racket[read-accept-quasiquote]}
@item{@cppdef{MZCONFIG_CAN_READ_READER} --- @racket[read-accept-reader]}
@item{@cppdef{MZCONFIG_CAN_READ_LANG} --- @racket[read-accept-lang]}
@item{@cppdef{MZCONFIG_READ_DECIMAL_INEXACT} --- @racket[read-decimal-as-inexact]}
@item{@cppdef{MZCONFIG_READ_CDOT} --- @racket[read-cdot]}
@item{@cppdef{MZCONFIG_PRINT_GRAPH} --- @racket[print-graph]} @item{@cppdef{MZCONFIG_PRINT_GRAPH} --- @racket[print-graph]}
@item{@cppdef{MZCONFIG_PRINT_STRUCT} --- @racket[print-struct]} @item{@cppdef{MZCONFIG_PRINT_STRUCT} --- @racket[print-struct]}
@ -53,6 +60,8 @@ through the following indices:
@item{@cppdef{MZCONFIG_CASE_SENS} --- @racket[read-case-sensitive]} @item{@cppdef{MZCONFIG_CASE_SENS} --- @racket[read-case-sensitive]}
@item{@cppdef{MZCONFIG_SQUARE_BRACKETS_ARE_PARENS} --- @racket[read-square-brackets-as-parens]} @item{@cppdef{MZCONFIG_SQUARE_BRACKETS_ARE_PARENS} --- @racket[read-square-brackets-as-parens]}
@item{@cppdef{MZCONFIG_CURLY_BRACES_ARE_PARENS} --- @racket[read-curly-braces-as-parens]} @item{@cppdef{MZCONFIG_CURLY_BRACES_ARE_PARENS} --- @racket[read-curly-braces-as-parens]}
@item{@cppdef{MZCONFIG_SQUARE_BRACKETS_ARE_TAGGED} --- @racket[read-square-brackets-with-tag]}
@item{@cppdef{MZCONFIG_CURLY_BRACES_ARE_TAGGED} --- @racket[read-curly-braces-with-tag]}
@item{@cppdef{MZCONFIG_ERROR_PRINT_WIDTH} --- @racket[error-print-width]} @item{@cppdef{MZCONFIG_ERROR_PRINT_WIDTH} --- @racket[error-print-width]}

View File

@ -9,7 +9,8 @@ Racket thread; all other threads are created through calls to
Information about each internal Racket thread is kept in a Information about each internal Racket thread is kept in a
@cppi{Scheme_Thread} structure. A pointer to the current thread's @cppi{Scheme_Thread} structure. A pointer to the current thread's
structure is available as @cppi{scheme_current_thread}. A structure is available as @cppdef{scheme_current_thread} or
from @cppi{scheme_get_current_thread}. A
@cpp{Scheme_Thread} structure includes the following fields: @cpp{Scheme_Thread} structure includes the following fields:
@itemize[ @itemize[
@ -378,6 +379,12 @@ The following function @cpp{mzsleep} is an appropriate
@section{Thread Functions} @section{Thread Functions}
@function[(Scheme_Thread* scheme_get_current_thread)]{
Returns the currently executing thread. The result is equivalent to
@cppi{scheme_current_thread}, but the function form must be used in
some embedding contexts.}
@function[(Scheme_Object* scheme_thread @function[(Scheme_Object* scheme_thread
[Scheme_Object* thunk])]{ [Scheme_Object* thunk])]{

View File

@ -12,6 +12,7 @@
function subfunction function subfunction
FormatD FormatD
tech-place tech-place
reference-doc raco-doc
(except-out (all-from-out scribble/manual) var) (except-out (all-from-out scribble/manual) var)
(for-label (all-from-out scheme/base))) (for-label (all-from-out scheme/base)))
@ -157,8 +158,11 @@
(define mzc (exec "raco ctool")) (define mzc (exec "raco ctool"))
(define reference-doc '(lib "scribblings/reference/reference.scrbl"))
(define raco-doc '(lib "scribblings/raco/raco.scrbl"))
(define (refsecref s) (define (refsecref s)
(secref #:doc '(lib "scribblings/reference/reference.scrbl") s)) (secref #:doc reference-doc s))
(define Racket (define Racket
(other-manual '(lib "scribblings/reference/reference.scrbl"))) (other-manual '(lib "scribblings/reference/reference.scrbl")))

View File

@ -296,6 +296,9 @@ There are six global constants:
] ]
In some embedding contexts, the function forms
@cppi{scheme_make_null}, etc., must be used, instead.
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section[#:tag "im:strings"]{Strings} @section[#:tag "im:strings"]{Strings}
@ -325,6 +328,31 @@ For more fine-grained control over UTF-8 encoding, use the
@section{Value Functions} @section{Value Functions}
@function[(Scheme_Object* scheme_make_null)]{
Returns @cppi{scheme_null}.
}
@function[(Scheme_Object* scheme_make_eof)]{
Returns @cppi{scheme_eof}.
}
@function[(Scheme_Object* scheme_make_true)]{
Returns @cppi{scheme_true}.
}
@function[(Scheme_Object* scheme_make_false)]{
Returns @cppi{scheme_false}.
}
@function[(Scheme_Object* scheme_make_void)]{
Returns @cppi{scheme_void}.
}
@function[(Scheme_Object* scheme_make_char @function[(Scheme_Object* scheme_make_char
[mzchar ch])]{ [mzchar ch])]{

View File

@ -747,7 +747,7 @@ import a library of control operators:
Specifically, we need @racket[prompt] and @racket[abort] from Specifically, we need @racket[prompt] and @racket[abort] from
@racketmodname[racket/control]. We use @racket[prompt] to mark the @racketmodname[racket/control]. We use @racket[prompt] to mark the
place where a servlet is started, so that we can abort a computation place where a servlet is started, so that we can abort a computation
to that point. Change @racket[handle] by wrapping an @racket[prompt] to that point. Change @racket[handle] by wrapping a @racket[prompt]
around the call to @racket[dispatch]: around the call to @racket[dispatch]:
@racketblock[ @racketblock[

View File

@ -2,6 +2,7 @@
@(require scribble/manual @(require scribble/manual
scribble/bnf scribble/bnf
"common.rkt"
(for-label scheme/gui (for-label scheme/gui
compiler/compiler compiler/compiler
compiler/sig compiler/sig
@ -12,7 +13,9 @@
dynext/compile-sig dynext/compile-sig
dynext/link-sig dynext/link-sig
dynext/file-sig dynext/file-sig
launcher/launcher)) launcher/launcher
compiler/module-suffix
setup/getinfo))
@title{API for Raw Compilation} @title{API for Raw Compilation}
@ -70,6 +73,7 @@ file is reported through the current output port.}
@defproc[(compile-collection-zos [collection string?] ...+ @defproc[(compile-collection-zos [collection string?] ...+
[#:skip-path skip-path (or/c path-string? #f) #f] [#:skip-path skip-path (or/c path-string? #f) #f]
[#:skip-paths skip-paths (listof path-string?) null]
[#:skip-doc-sources? skip-docs? any/c #f] [#:skip-doc-sources? skip-docs? any/c #f]
[#:managed-compile-zo managed-compile-zo [#:managed-compile-zo managed-compile-zo
(path-string? . -> . void?) (path-string? . -> . void?)
@ -83,8 +87,10 @@ The @filepath{.zo} files are placed into the collection's
By default, all files with the By default, all files with the
extension @filepath{.rkt}, @filepath{.ss}, or @filepath{.scm} in a collection are extension @filepath{.rkt}, @filepath{.ss}, or @filepath{.scm} in a collection are
compiled, as are all such files within subdirectories, execept that compiled, as are all such files within subdirectories; the set of such suffixes
any file or directory whose path starts with @racket[skip-path] is is extensible globally as described in @racket[get-module-suffixes], and
@racket[compile-collection-zos] recognizes suffixes from the @racket['libs] group. However,
any file or directory whose path starts with @racket[skip-path] or an element of @racket[skip-paths] is
skipped. (``Starts with'' means that the simplified path @racket[_p]'s skipped. (``Starts with'' means that the simplified path @racket[_p]'s
byte-string form after @racket[(simplify-path _p #f)]starts with the byte-string form after @racket[(simplify-path _p #f)]starts with the
byte-string form of @racket[(simplify-path skip-path #f)].) byte-string form of @racket[(simplify-path skip-path #f)].)
@ -113,24 +119,33 @@ collection. The following fields are used:
field's value is @racket['all].} field's value is @racket['all].}
@item{@indexed-racket[compile-omit-files] : A list of filenames (without @item{@indexed-racket[compile-omit-files] : A list of filenames (without
directory paths); that are not compiled, in addition to the directory paths) that are not compiled, in addition to the
contents of @racket[compile-omit-paths]. Do not use this contents of @racket[compile-omit-paths]. Do not use this
field; it is for backward compatibility.} field; it is for backward compatibility.}
@item{@indexed-racket[scribblings] : A list of pairs, each of which @item{@indexed-racket[scribblings] : A list of pairs, each of which
starts with a path for documentation source. The sources (and starts with a path for documentation source. The sources (and
the files that they require) are compiled in the same way as the files that they require) are compiled in the same way as
@filepath{.rkt}, @filepath{.ss}, and @filepath{.scm} files, other module files, unless @racket[skip-docs?] is a true value.}
unless the provided @racket[skip-docs?] argument is a true
value.}
]} @item{@indexed-racket[compile-include-files] : A list of filenames (without
directory paths) to be compiled, in addition to files that
are compiled based on the file's extension, being in @racket[scribblings],
or being @racket[require]d by other compiled files.}
@item{@racket[module-suffixes] and @racket[doc-module-suffixes] ---
Used indirectly via @racket[get-module-suffixes].}
]
@history[#:changed "6.3" @elem{Added support for @racket[compile-include-files].}]}
@defproc[(compile-directory-zos [path path-string?] @defproc[(compile-directory-zos [path path-string?]
[info ()] [info ()]
[#:verbose verbose? any/c #f] [#:verbose verbose? any/c #f]
[#:skip-path skip-path (or/c path-string? #f) #f] [#:skip-path skip-path (or/c path-string? #f) #f]
[#:skip-paths skip-paths (listof path-string?) null]
[#:skip-doc-sources? skip-docs? any/c #f] [#:skip-doc-sources? skip-docs? any/c #f]
[#:managed-compile-zo managed-compile-zo [#:managed-compile-zo managed-compile-zo
(path-string? . -> . void?) (path-string? . -> . void?)
@ -142,6 +157,69 @@ rather than a collection. The @racket[info] function behaves like the
result of @racket[get-info] to supply @filepath{info.rkt} fields, result of @racket[get-info] to supply @filepath{info.rkt} fields,
instead of using an @filepath{info.rkt} file (if any) in the directory.} instead of using an @filepath{info.rkt} file (if any) in the directory.}
@; ----------------------------------------------------------------------
@section[#:tag "module-suffix"]{Recognizing Module Suffixes}
@defmodule[compiler/module-suffix]{The
@racketmodname[compiler/module-suffix] library provides functions for
recognizing file suffixes that correspond to Racket modules for the
purposes of compiling files in a directory, running tests for files in
a directory, and so on. The set of suffixes always includes
@filepath{.rkt}, @filepath{.ss}, and @filepath{.scm}, but it can be
extended globally by @filepath{info.rkt} configuration in collections.}
@history[#:added "6.3"]
@defproc[(get-module-suffixes [#:group group (or/c 'all 'libs 'docs) 'all]
[#:mode mode (or/c 'preferred 'all-available 'no-planet 'no-user) 'preferred]
[#:namespace namespace (or/c #f namespace?) #f])
(listof bytes?)]{
Inspects @filepath{info.rkt} files (see @secref["info.rkt"]) of
installed collections to produce a list of file suffixes that should
be recognized as Racket modules. Each suffix is reported as a byte
string that does not include the @litchar{.} that precedes a suffix.
The @racket[mode] and @racket[namespace] arguments are propagated to
@racket[find-relevant-directories] to determine which collection
directories might configure the set of suffixes. Consequently, suffix
registrations are found reliably only if @exec{raco setup} (or package
installations or updates that trigger @exec{raco setup}) is run.
The @racket[group] argument determines whether the result includes all
registered suffixes, only those that are registered as general library
suffixes, or only those that are registered as documentation suffixes.
The set of general-library suffixes always includes @filepath{.rkt},
@filepath{.ss}, and @filepath{.scm}. The set of documentation suffixes
always includes @filepath{.scrbl}.
The following fields in an @filepath{info.rkt} file extend the set of
suffixes:
@itemize[
@item{@indexed-racket[module-suffixes] : A list of byte strings that
correspond to general-library module suffixes (without the
@litchar{.} that must appear before the suffix). Non-lists or
non-byte-string elements of the list are ignored.}
@item{@indexed-racket[doc-module-suffixes] : A list of byte strings
as for @racket[module-suffixes], but for documentation
modules.}
]}
@defproc[(get-module-suffix-regexp [#:group group (or/c 'all 'libs 'docs) 'all]
[#:mode mode (or/c 'preferred 'all-available 'no-planet 'no-user) 'preferred]
[#:namespace namespace (or/c #f namespace?) #f])
byte-regexp?]{
Returns a @tech[#:doc reference-doc]{regexp value} that matches paths ending
with a suffix as reported by @racket[get-module-suffixes]. The pattern
includes a subpatterns for the suffix without its leading @litchar{.}}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@section[#:tag "api:loading"]{Loading Compiler Support} @section[#:tag "api:loading"]{Loading Compiler Support}

View File

@ -1,5 +1,7 @@
#lang scribble/doc #lang scribble/doc
@(require scribble/manual "common.rkt") @(require scribble/manual
"common.rkt"
scribble/bnf)
@title[#:tag "c-mods"]{Embedding Modules via C} @title[#:tag "c-mods"]{Embedding Modules via C}
@ -14,3 +16,39 @@ a @tt{declare_modules} function that puts the module declarations into
a namespace. Thus, using the output of @exec{raco ctool --c-mods}, a a namespace. Thus, using the output of @exec{raco ctool --c-mods}, a
program can embed Racket with a set of modules so that it does not program can embed Racket with a set of modules so that it does not
need a @filepath{collects} directory to load modules at run time. need a @filepath{collects} directory to load modules at run time.
If the embedded modules refer to runtime files, the files can be
gathers by supplying the @DFlag{runtime} argument to @exec{raco ctool
--cmods}, specifying a directory @nonterm{dir} to hold the files.
Normally, @nonterm{dir} is a relative path, and files are found at run
time in @nonterm{dir} relative to the executable, but a separate path
(usually relative) for run time can be specified with
@DFlag{runtime-access}.
Typically, @exec{raco ctool --c-mods} is used with @DPFlag{lib} to
specify a collection-based module path. For example,
@commandline{raco ctool --c-mods base.c ++lib racket/base}
generates a @filepath{base.c} whose @tt{declare_modules} function
makes @racketmodname[racket/base] available for use via the
@tt{scheme_namespace_require} or @tt{scheme_dynamic_require} functions
within the embedding application.
When a module file is provided to @exec{raco ctool --c-mods}, then
@tt{declare_modules} declares a module with the symbolic name of the
module file. For example,
@commandline{raco ctool --c-mods base.c hello.rkt}
creates a @tt{declare_modules} that defines the module
@racket['hello], which could be required into the current namespace
with @racket[(namespace-require ''hello)] or similarly at the C level:
@verbatim[#:indent 2]{
p = scheme_make_pair(scheme_intern_symbol("quote"),
scheme_make_pair(scheme_intern_symbol("hello"),
scheme_make_null()));
scheme_namespace_require(p);
}

View File

@ -7,5 +7,8 @@
(define inside-doc (define inside-doc
'(lib "scribblings/inside/inside.scrbl")) '(lib "scribblings/inside/inside.scrbl"))
(define guide-doc
'(lib "scribblings/guide/guide.scrbl"))
(define reference-doc (define reference-doc
'(lib "scribblings/reference/reference.scrbl")) '(lib "scribblings/reference/reference.scrbl"))

View File

@ -104,7 +104,10 @@ Many forms in the decompiled code, such as @racket[module],
@item{A form @racket[(#%apply-values _proc _expr)] is equivalent to @item{A form @racket[(#%apply-values _proc _expr)] is equivalent to
@racket[(call-with-values (lambda () _expr) _proc)], but the run-time @racket[(call-with-values (lambda () _expr) _proc)], but the run-time
system avoids allocating a closure for @racket[_expr].} system avoids allocating a closure for @racket[_expr]. Similarly,
a @racket[#%call-with-immediate-continuation-mark] call is equivalent to
a @racket[call-with-immediate-continuation-mark] call, but avoiding
a closure allocation.}
@item{A @racket[define-values] form may have @racket[(begin @item{A @racket[define-values] form may have @racket[(begin
'%%inline-variant%% _expr1 _expr2)] for its expression, in which case '%%inline-variant%% _expr1 _expr2)] for its expression, in which case

View File

@ -16,17 +16,26 @@ perform the same work as @exec{raco distribute}.}
@defproc[(assemble-distribution [dest-dir path-string?] @defproc[(assemble-distribution [dest-dir path-string?]
[exec-files (listof path-string?)] [exec-files (listof path-string?)]
[#:executables? executables? any/c #t]
[#:relative-base relative-base (or/c path-string? #f) #f]
[#:collects-path path (or/c false/c (and/c path-string? relative-path?)) #f] [#:collects-path path (or/c false/c (and/c path-string? relative-path?)) #f]
[#:copy-collects dirs (listof path-string?) null]) [#:copy-collects dirs (listof path-string?) null])
void?]{ void?]{
Copies the executables in @racket[exec-files] to the directory Copies the executables in @racket[exec-files] to the directory
@racket[dest-dir], along with DLLs, frameworks, and/or shared @racket[dest-dir], along with DLLs, frameworks, shared libraries,
libraries that the executables need to run a different machine. and/or runtime files that the executables need to run a different
machine. If @racket[executables?] is @racket[#f], then the
@racket[exec-files] are treated as plain data files, instead of
executables, and they are modified in-place.
The arrangement of the executables and support files in The arrangement of the executables and support files in
@racket[dest-dir] depends on the platform. In general @racket[dest-dir] depends on the platform. In general,
@racket[assemble-distribution] tries to do the Right Thing. @racket[assemble-distribution] tries to do the Right Thing, but a
non-@racket[#f] value for @racket[relative-base] specifies a
path for reaching the assembled content relative to the executable at
run time. When @racket[executables?] is @racket[#f], then the default
access path is @racket[dest-dir], with its relativeness preserved.
If a @racket[#:collects-path] argument is given, it overrides the If a @racket[#:collects-path] argument is given, it overrides the
default location of the main @filepath{collects} directory for the default location of the main @filepath{collects} directory for the
@ -35,4 +44,7 @@ directory (typically inside it).
The content of each directory in the @racket[#:copy-collects] argument The content of each directory in the @racket[#:copy-collects] argument
is copied into the main @filepath{collects} directory for the packaged is copied into the main @filepath{collects} directory for the packaged
executables.} executables.
@history[#:changed "6.3" @elem{Added the @racket[#:executables?]
and @racket[#:relative-base] arguments.}]}

View File

@ -187,11 +187,11 @@ currently supported keys are as follows:
@filepath{.icns}) to use for the executable's desktop icon.} @filepath{.icns}) to use for the executable's desktop icon.}
@item{@racket['ico] (Windows) : An icon file path (suffix @item{@racket['ico] (Windows) : An icon file path (suffix
@filepath{.ico}) to use for the executable's desktop icon; @filepath{.ico}) to use for the executable's desktop icon.
the executable will have 16x16, 32x32, and 48x48 icons at
4-bit, 8-bit, and 32-bit (RGBA) depths; the icons are copied @history[#:changed "6.3" @elem{All icons in the
and generated from any 16x16, 32x32, and 48x48 icons in the executable are replaced with icons from the file,
@filepath{.ico} file.} instead of setting only certain sizes and depths.}]}
@item{@racket['creator] (Mac OS X) : Provides a 4-character string @item{@racket['creator] (Mac OS X) : Provides a 4-character string
to use as the application signature.} to use as the application signature.}
@ -473,9 +473,17 @@ A unit that imports nothing and exports @racket[compiler:embed^].}
@defmodule[compiler/find-exe] @defmodule[compiler/find-exe]
@defproc[(find-exe [gracket? any/c #f] @defproc[(find-exe [#:cross? cross? any/c #f]
[variant (or/c 'cgc '3m) (system-type 'gc)]) [gracket? any/c #f]
[variant (or/c 'cgc '3m) (if cross?
(cross-system-type 'gc)
(system-type 'gc))])
path?]{ path?]{
Finds the path to the @exec{racket} or @exec{gracket} (when Finds the path to the @exec{racket} or @exec{gracket} (when
@racket[gracket?] is true) executable.} @racket[gracket?] is true) executable.
If @racket[cross?] is true, the executable is found for the target
platform in @seclink["cross-system"]{cross-installation mode}.
@history[#:changed "6.3" @elem{Added the @racket[#:cross?] argument.}]}

View File

@ -0,0 +1,36 @@
#lang scribble/manual
@(require "common.rkt"
(for-label racket/base
racket/contract
compiler/exe-dylib-path))
@title[#:tag "exe-dylib-path"]{Mac OS X Dynamic Library Paths}
@defmodule[compiler/exe-dylib-path]{The
@racketmodname[compiler/exe-dylib-path] library provides functions for
reading and adjusting dynamic-library references in a Mac OS X
executable.}
@history[#:added "6.3"]
@defproc[(find-matching-library-path [exe-path path-string?]
[library-str string?])
(or/c #f string?)]{
Searches dynamic-linking information in @racket[exe-path] for a
library reference whose name includes @racket[library-str] and returns
the executable's path to the library for the first match. If no match is
found, the result is @racket[#f].}
@defproc[(update-matching-library-path [exe-path path-string?]
[library-str string?]
[library-path-str string?])
void?]{
Searches dynamic-linking information in @racket[exe-path] for each
library reference whose name includes @racket[library-str] and replaces
the executable's path to that library with @racket[library-path-str].
A single match is expected, and the update assumes enough space for
the new path, perhaps because the executable is linked with
@Flag{headerpad_max_install_names}.}

View File

@ -11,10 +11,11 @@
@title[#:tag "exe"]{@exec{raco exe}: Creating Stand-Alone Executables} @title[#:tag "exe"]{@exec{raco exe}: Creating Stand-Alone Executables}
@margin-note{Use a smaller base language to achieve a faster startup time such @margin-note{To achieve a faster startup time, instead of trying
as @racketmodfont{#lang} @racketmodname[racket/base] instead of @exec{raco exe}, use a smaller base language---such as
@racketmodfont{#lang} @racketmodname[racket] rather than relying on @exec{raco @racketmodfont{#lang} @racketmodname[racket/base] instead of
exe}.} @racketmodfont{#lang} @racketmodname[racket]. Also, ensure that
bytecode files are compiled by using @seclink["make"]{@exec{raco make}}.}
Compiled code produced by @exec{raco make} relies on Racket Compiled code produced by @exec{raco make} relies on Racket
executables to provide run-time support to the compiled code. However, executables to provide run-time support to the compiled code. However,
@ -49,7 +50,10 @@ created executable. Such modules can be explicitly included using the
@racket[define-runtime-path] to embed references to the run-time files @racket[define-runtime-path] to embed references to the run-time files
in the executable; the files are then copied and packaged together in the executable; the files are then copied and packaged together
with the executable when creating a distribution (as described in with the executable when creating a distribution (as described in
@secref["exe-dist"]). @secref["exe-dist"]). Finally, a submodule is included if its
enclosing module is included and the submodule contains a
sub-submodule named @racketidfont{declare-preserve-for-embedding}
(where the implementation of the sub-submodule is ignored).
Modules that are implemented directly by extensions---i.e., extensions Modules that are implemented directly by extensions---i.e., extensions
that are automatically loaded from @racket[(build-path "compiled" that are automatically loaded from @racket[(build-path "compiled"
@ -85,8 +89,11 @@ The @exec{raco exe} command accepts the following command-line flags:
@item{@Flag{l} or @DFlag{launcher} --- create a @tech{launcher} (see @item{@Flag{l} or @DFlag{launcher} --- create a @tech{launcher} (see
@secref["launcher"]), instead of a stand-alone executable. Flags @secref["launcher"]), instead of a stand-alone executable. Flags
such as @DFlag{config-path}, @DFlag{collects-path}, and such as @DFlag{config-path}, @DFlag{collects-path}, and @DFlag{lib}
@DFlag{lib} have no effect on launchers.} have no effect on launchers. Beware that the default command-line
flags to build into the launcher prevent access to packages that
are installed in user scope; use @exec{--exf -U} to enable access
to user-scope packages from the launcher.}
@item{@DFlag{config-path} @nonterm{path} --- set @nonterm{path} @item{@DFlag{config-path} @nonterm{path} --- set @nonterm{path}
within the executable as the path to the @tech{configuration within the executable as the path to the @tech{configuration
@ -110,7 +117,9 @@ The @exec{raco exe} command accepts the following command-line flags:
included with the executable into @nonterm{path} included with the executable into @nonterm{path}
(relative to the current directory), instead of embedded within the (relative to the current directory), instead of embedded within the
executable. The @DFlag{collects-dest} flag normally makes sense executable. The @DFlag{collects-dest} flag normally makes sense
only in combination with @DFlag{collects-path}.} only in combination with @DFlag{collects-path}. This mode currently
does not prune unreferenced submodules (and it pulls along any
dependencies of submodules).}
@item{@DFlag{ico} @nonterm{.ico-path} --- on Windows, set the icons @item{@DFlag{ico} @nonterm{.ico-path} --- on Windows, set the icons
for the generated executable to ones extracted from for the generated executable to ones extracted from
@ -148,19 +157,19 @@ The @exec{raco exe} command accepts the following command-line flags:
in the executable, even if it is not referenced by the main program, in the executable, even if it is not referenced by the main program,
so that it is available via @racket[dynamic-require].} so that it is available via @racket[dynamic-require].}
@item{@DPFlag{exfl} @nonterm{flag} --- provide the @nonterm{flag} @item{@DPFlag{exf} @nonterm{flag} --- provide the @nonterm{flag}
command-line argument on startup to the embedded @exec{racket} or command-line argument on startup to the embedded @exec{racket} or
@exec{gracket}.} @exec{gracket}.}
@item{@DFlag{exfl} @nonterm{flag} --- remove @nonterm{flag} from the @item{@DFlag{exf} @nonterm{flag} --- remove @nonterm{flag} from the
command-line arguments to be provided on startup to the embedded command-line arguments to be provided on startup to the embedded
@exec{racket} or @exec{gracket}.} @exec{racket} or @exec{gracket}.}
@item{@DFlag{exfl-clear} --- remove all command-line arguments to be @item{@DFlag{exf-clear} --- remove all command-line arguments to be
provided on startup to the embedded @exec{racket} or provided on startup to the embedded @exec{racket} or
@exec{gracket}.} @exec{gracket}.}
@item{@DFlag{exfl-show} --- show (without changing) the command-line @item{@DFlag{exf-show} --- show (without changing) the command-line
arguments to be provided on startup to the embedded arguments to be provided on startup to the embedded
@exec{racket} or @exec{gracket}.} @exec{racket} or @exec{gracket}.}
@ -170,7 +179,12 @@ The @exec{raco exe} command accepts the following command-line flags:
] ]
@history[#:changed "6.3.0.11" @elem{Added support for
@racketidfont{declare-preserve-for-embedding}.}]
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@include-section["exe-api.scrbl"] @include-section["exe-api.scrbl"]
@include-section["launcher.scrbl"] @include-section["launcher.scrbl"]
@include-section["exe-dylib-path.scrbl"]

View File

@ -6,8 +6,8 @@
@title[#:tag "expand"]{@exec{raco expand}: Macro Expansion} @title[#:tag "expand"]{@exec{raco expand}: Macro Expansion}
The @exec{raco expand} command macro expands the contents of The @exec{raco expand} command macro-expands and pretty-prints the
the given source files. Also see @racket[expand]. contents of the given source files. See also @racket[expand].
Command-line flags: Command-line flags:

View File

@ -8,7 +8,8 @@
racket/file racket/file
compiler/cm compiler/cm
compiler/cm-accomplice compiler/cm-accomplice
setup/parallel-build)) setup/parallel-build
compiler/compilation-path))
@(define cm-eval (make-base-eval)) @(define cm-eval (make-base-eval))
@ -390,6 +391,29 @@ A parameter whose value is called for each file that is loaded and
@racket[#f], then the file is compiled as usual. The default is @racket[#f], then the file is compiled as usual. The default is
@racket[(lambda (x) #f)].} @racket[(lambda (x) #f)].}
@defparam[current-path->mode path->mode
(or/c #f (-> path? (and/c path? relative-path?)))
#:value #f]{
Used by @racket[make-compilation-manager-load/use-compiled-handler] and
@racket[make-caching-managed-compile-zo] to override @racket[use-compiled-file-paths]
for deciding where to write compiled @filepath{.zo} files. If it is @racket[#f],
then the first element of @racket[use-compiled-file-paths] is used. If it isn't
@racket[#f], then it is called with the original source file's location and its
result is treated the same as if it had been the first element of
@racket[use-compiled-file-paths].
Note that this parameter is not used by @racket[current-load/use-compiled]. So if
the parameter causes @filepath{.zo} files to be placed in different directories, then
the correct @filepath{.zo} file must still be communicated via @racket[use-compiled-file-paths],
and one way to do that is to override @racket[current-load/use-compiled] to delete
@filepath{.zo} files that would cause the wrong one to be chosen right before they are
loaded.
@history[#:added "6.4.0.14"]
}
@defproc[(file-stamp-in-collection [p path?]) (or/c (cons/c number? promise?) #f)]{ @defproc[(file-stamp-in-collection [p path?]) (or/c (cons/c number? promise?) #f)]{
Calls @racket[file-stamp-in-paths] with @racket[p] and Calls @racket[file-stamp-in-paths] with @racket[p] and
@racket[(current-library-collection-paths)].} @racket[(current-library-collection-paths)].}
@ -497,6 +521,18 @@ result will not call @racket[proc] with @racket['unlock].)
compilations of the same racket source files in multiple places. compilations of the same racket source files in multiple places.
} }
@defproc[(install-module-hashes! [bstr btyes?]
[start exact-nonnegatve-integer? 0]
[end exact-nonnegatve-integer? (bytes-length bstr)])
void?]{
Adjusts the bytecode representation in @racket[bstr] (from bytes
@racket[start] to @racket[end]) to install a hash code, including any
submodules within the region. The existing representation should have
zero bytes in place of each hash string, which is what @racket[write]
produces for a compiled form.
@history[#:added "6.3"]}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@ -696,14 +732,14 @@ of @racket[modes] and @racket[roots].}
[#:roots roots (non-empty-listof (or/c path-string? 'same)) (current-compiled-file-roots)]) [#:roots roots (non-empty-listof (or/c path-string? 'same)) (current-compiled-file-roots)])
path?]{ path?]{
The same as @racket[get-compilation-dir+home], but returning only the first result.} The same as @racket[get-compilation-dir+name], but returning only the first result.}
@defproc[(get-compilation-bytecode-file [path path-string?] @defproc[(get-compilation-bytecode-file [path path-string?]
[#:modes modes (non-empty-listof (and/c path-string? relative-path?)) (use-compiled-file-paths)] [#:modes modes (non-empty-listof (and/c path-string? relative-path?)) (use-compiled-file-paths)]
[#:roots roots (non-empty-listof (or/c path-string? 'same)) (current-compiled-file-roots)]) [#:roots roots (non-empty-listof (or/c path-string? 'same)) (current-compiled-file-roots)])
path?]{ path?]{
The same as @racket[get-compilation-dir+home], but combines the The same as @racket[get-compilation-dir+name], but combines the
results and adds a @filepath{.zo} suffix to arrive at a bytecode file results and adds a @filepath{.zo} suffix to arrive at a bytecode file
path.} path.}

View File

@ -30,6 +30,7 @@ a typical Racket installation.
@include-section["test.scrbl"] @include-section["test.scrbl"]
@include-section["docs.scrbl"] @include-section["docs.scrbl"]
@include-section["expand.scrbl"] @include-section["expand.scrbl"]
@include-section["read.scrbl"]
@include-section["scribble.scrbl"] @include-section["scribble.scrbl"]
@include-section["command.scrbl"] @include-section["command.scrbl"]
@include-section["config.scrbl"] @include-section["config.scrbl"]

View File

@ -0,0 +1,26 @@
#lang scribble/doc
@(require scribble/manual
scribble/bnf
"common.rkt"
(for-label racket/base))
@title[#:tag "read"]{@exec{raco read}: Reading and Pretty-Printing}
@; to associate `history` to the right package:
@(declare-exporting compiler/commands/read)
The @exec{raco read} command @racket[read]s and pretty-prints the
contents of the given files. This command is useful for showing
how a @tt{#reader} or @hash-lang[]-based reader extension converts
input to an S-expression. It is also useful for pretty-printing a term
that is already in S-expression form.
Command-line flags:
@itemlist[
@item{@Flag{n} @nonterm{n} or @DFlag{columns} @nonterm{n} --- format output for a display with @nonterm{n} columns}
@item{@Flag{h} or @DFlag{help} --- show help information for this command}
@item{@DFlag{} --- do not treat remaining arguments as switches}
]
@history[#:added "1.3"]

View File

@ -12,7 +12,9 @@
setup/getinfo setup/getinfo
setup/main-collects setup/main-collects
setup/collection-name setup/collection-name
setup/collection-search
setup/matching-platform setup/matching-platform
setup/cross-system
setup/path-to-relative setup/path-to-relative
setup/xref scribble/xref setup/xref scribble/xref
;; info -- no bindings from this are used ;; info -- no bindings from this are used
@ -21,6 +23,7 @@
setup/unpack setup/unpack
setup/link setup/link
compiler/compiler compiler/compiler
compiler/module-suffix
launcher/launcher launcher/launcher
compiler/sig compiler/sig
launcher/launcher-sig launcher/launcher-sig
@ -142,6 +145,11 @@ flags:
set of deleted files can be controlled by @filepath{info.rkt}; see set of deleted files can be controlled by @filepath{info.rkt}; see
@elemref["clean"]{@racket[clean]} for more information.} @elemref["clean"]{@racket[clean]} for more information.}
@item{@DFlag{fast-clean} or @Flag{c} --- like @DFlag{clean}, but
without forcing a bootstrap of @exec{raco setup} from source (which
means that @DFlag{fast-clean} cannot clean corruption that affects
@exec{raco setup} itself).}
@item{@DFlag{no-zo} or @Flag{n} --- refrain from compiling source @item{@DFlag{no-zo} or @Flag{n} --- refrain from compiling source
files to @filepath{.zo} files.} files to @filepath{.zo} files.}
@ -358,8 +366,8 @@ Optional @filepath{info.rkt} fields trigger additional actions by
(list src-string flags category name out-k) (list src-string flags category name out-k)
(list src-string flags category name out-k order-n)] (list src-string flags category name out-k order-n)]
[flags (list mode-symbol ...)] [flags (list mode-symbol ...)]
[category (list category-symbol) [category (list category-string-or-symbol)
(list category-symbol sort-number)] (list category-string-or-symbol sort-number)]
[name string [name string
#f] #f]
] ]
@ -374,7 +382,7 @@ Optional @filepath{info.rkt} fields trigger additional actions by
documentation, instead of defaulting to the source file's name documentation, instead of defaulting to the source file's name
(sans extension), where @racket[#f] means to use the default; a (sans extension), where @racket[#f] means to use the default; a
non-@racket[#f] value for @racket[_name] must fit the grammar non-@racket[#f] value for @racket[_name] must fit the grammar
of a colelction-name element as checked by of a collection-name element as checked by
@racket[collection-name-element?]. If a @racket[collection-name-element?]. If a
document's list contains a fifth item, @racket[_out-k], it is used document's list contains a fifth item, @racket[_out-k], it is used
a hint for the number of files to use for the document's a hint for the number of files to use for the document's
@ -444,9 +452,13 @@ Optional @filepath{info.rkt} fields trigger additional actions by
] ]
The @racket[_category] list specifies how to show the document in The @racket[_category] list specifies how to show the document in
the root table of contents. The list must start with a symbol, the root table of contents. The list must start with a category,
usually one of the following categories, which are ordered as which determines where the manual appears in the root
below in the root documentation page: documentation page. A category is either a string or a symbol. If
it is a string, then the string is the category label on the root
page. If it is a symbol, then a default category label is
used. The available symbols and the order of categories on the
root documentation page is as below:
@itemize[ @itemize[
@ -475,6 +487,8 @@ Optional @filepath{info.rkt} fields trigger additional actions by
@item{@racket['interop] : Documentation for interoperability @item{@racket['interop] : Documentation for interoperability
tools and libraries.} tools and libraries.}
@item{All string categories as ordered by @racket[string<=?].}
@item{@racket['library] : Documentation for libraries; this @item{@racket['library] : Documentation for libraries; this
category is the default and used for unrecognized category category is the default and used for unrecognized category
symbols.} symbols.}
@ -528,7 +542,10 @@ Optional @filepath{info.rkt} fields trigger additional actions by
source file need not be present. Moving documentation into place source file need not be present. Moving documentation into place
may require no movement at all, depending on the way that the may require no movement at all, depending on the way that the
enclosing collection is installed, but movement includes adding a enclosing collection is installed, but movement includes adding a
@filepath{synced.rktd} file to represent the installation.} @filepath{synced.rktd} file to represent the installation.
@history[#:changed "6.4" @elem{Allow a category to be a string
instead of a symbol.}]}
@item{@as-index{@racketidfont{release-note-files}} : @racket[(listof (cons/c string? (cons/c string? list?)))] --- @item{@as-index{@racketidfont{release-note-files}} : @racket[(listof (cons/c string? (cons/c string? list?)))] ---
A list of release-notes text files to link from the main documentation pages. A list of release-notes text files to link from the main documentation pages.
@ -639,7 +656,7 @@ Optional @filepath{info.rkt} fields trigger additional actions by
On Windows, deleting a previously installed foreign library may be On Windows, deleting a previously installed foreign library may be
complicated by a lock on the file, if it is in use. To compensate, complicated by a lock on the file, if it is in use. To compensate,
@exec{raco setup} deletes a foriegn-library file by first renaming @exec{raco setup} deletes a foreign-library file by first renaming
the file to have the prefix @filepath{raco-setup-delete-}; it then the file to have the prefix @filepath{raco-setup-delete-}; it then
attempts to delete the renamed file and merely issues a warning on attempts to delete the renamed file and merely issues a warning on
a failure to delete the renamed file. Meanwhile, in modes where a failure to delete the renamed file. Meanwhile, in modes where
@ -753,6 +770,13 @@ Optional @filepath{info.rkt} fields trigger additional actions by
file, etc. Supplying a specific list of collections to @exec{raco file, etc. Supplying a specific list of collections to @exec{raco
setup} disables this dependency-based deletion of compiled files.} setup} disables this dependency-based deletion of compiled files.}
@item{@racket[compile-omit-paths], @racket[compile-omit-files], and
@racket[compile-include-files] --- Used indirectly via
@racket[compile-collection-zos].}
@item{@racket[module-suffixes] and @racket[doc-module-suffixes] ---
Used indirectly via @racket[get-module-suffixes].}
] ]
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------
@ -1207,7 +1231,7 @@ function for installing a single @filepath{.plt} file.
@envvar{PLTCOLLECTS} setting or change to the parameter may cause @envvar{PLTCOLLECTS} setting or change to the parameter may cause
them to be omitted. Any other path in them to be omitted. Any other path in
@racket[(current-library-collection-paths)] is treated as @racket[(current-library-collection-paths)] is treated as
user-specific. The dierctories indicated by the returned paths may user-specific. The directories indicated by the returned paths may
or may not exist.} or may not exist.}
@defproc[(find-config-dir) (or/c path? #f)]{ @defproc[(find-config-dir) (or/c path? #f)]{
@ -1280,7 +1304,7 @@ function for installing a single @filepath{.plt} file.
@defproc[(get-lib-search-dirs) (listof path?)]{ @defproc[(get-lib-search-dirs) (listof path?)]{
Returns a list of paths to search for foreign libraries. Unless it is Returns a list of paths to search for foreign libraries. Unless it is
configured otherwise, the result includes any non-@racket[#f] result of configured otherwise, the result includes any non-@racket[#f] result of
@racket[(find-lib-dir)] and @racket[(find-lib-dir)]
and @racket[(find-user-lib-dir)]---but the latter is included only if the and @racket[(find-user-lib-dir)]---but the latter is included only if the
value of the @racket[use-user-specific-search-paths] parameter value of the @racket[use-user-specific-search-paths] parameter
is @racket[#t]. is @racket[#t].
@ -1526,7 +1550,7 @@ function for installing a single @filepath{.plt} file.
The Racket installation tree can usually be moved around the filesystem. The Racket installation tree can usually be moved around the filesystem.
To support this, care must be taken to avoid absolute paths. The To support this, care must be taken to avoid absolute paths. The
following two APIs cover two aspects of this: a way to convert a path to following two APIs cover two aspects of this: a way to convert a path to
a value that is relative to the @filepath{collets} tree, and a way to a value that is relative to the @filepath{collects} tree, and a way to
display such paths (e.g., in error messages). display such paths (e.g., in error messages).
@subsection{Representing Collection-Based Paths} @subsection{Representing Collection-Based Paths}
@ -1559,7 +1583,7 @@ is a pair that starts with @racket['collects], then it is converted
back to a path using @racket[collection-file-path].} back to a path using @racket[collection-file-path].}
@defproc[(path->module-path [path path-string?] @defproc[(path->module-path [path path-string?]
[#:cache cache (or/c #f (and/c hash? (not/c imutable?)))]) [#:cache cache (or/c #f (and/c hash? (not/c immutable?)))])
(or/c path-string? module-path?)]{ (or/c path-string? module-path?)]{
Like @racket[path->collects-relative], but the result is either Like @racket[path->collects-relative], but the result is either
@ -1709,6 +1733,50 @@ is not the ASCII value of a letter, digit, @litchar{-}, @litchar{+},
or @litchar{_}.} or @litchar{_}.}
@; ------------------------------------------------------------------------
@section[#:tag "collection-search"]{API for Collection Searches}
@defmodule[setup/collection-search]
@history[#:added "6.3"]
@defproc[(collection-search [mod-path normalized-lib-module-path?]
[#:init result any/c #f]
[#:combine combine (any/c (and/c path? complete-path?) . -> . any/c) (lambda (r v) v)]
[#:break? break? (any/c . -> . any/c) (lambda (r) #f)]
[#:all-possible-roots? all-possible-roots? any/c #f])
any/c]{
Generalizes @racket[collection-file-path] to support folding over all
possible locations of a collection-based file in the current
configuration. Unlike @racket[collection-file-path],
@racket[collection-search] takes the file to location in module-path
form, but always as a @racket['lib] path.
Each possible path for the file (not counting a @filepath{.ss} to/from
@filepath{.rkt} conversion) is provided as a second argument to the
@racket[combine] function, where the first argument is the current
result, and the value produced by @racket[combine] becomes the new
result. The @racket[#:init] argument provides the initial result.
The @racket[break?] function short-circuits a search based on the
current value. For example, it could be used to short-circuit a search
after a suitable path is found.
If @racket[all-possible-roots?] is @racket[#f], then @racket[combine]
is called only on paths within @filepath{collects}-like directories
(for the current configuration) where at least a matching collection
directory exists.}
@defproc[(normalized-lib-module-path? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is a module path (in the sense of
@racket[module-path?]) of the form @racket['(lib _str)] where
@racket[_str] contains at least one slash. The
@racket[collapse-module-path] function produces such module paths for
collection-based module references.}
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------
@ -1724,9 +1792,14 @@ Returns @racket[#t] if @racket[v] is a symbol, string, or regexp value
(in the sense of @racket[regexp?]), @racket[#f] otherwise.} (in the sense of @racket[regexp?]), @racket[#f] otherwise.}
@defproc[(matching-platform? [spec platform-spec?] @defproc[(matching-platform? [spec platform-spec?]
[#:system-type sys-type (or/c #f symbol?) (system-type)] [#:cross? cross? any/c #f]
[#:system-library-subpath sys-lib-subpath (or/c #f path?) [#:system-type sys-type (or/c #f symbol?) (if cross?
(system-library-subpath #f)]) (cross-system-type)
(system-type))]
[#:system-library-subpath sys-lib-subpath (or/c #f path-for-some-system?)
(if cross?
(cross-system-library-subpath #f)
(system-library-subpath #f))])
boolean?]{ boolean?]{
Reports whether @racket[spec] matches @racket[sys-type] or Reports whether @racket[spec] matches @racket[sys-type] or
@ -1742,8 +1815,74 @@ If @racket[spec] is a string, then the result is @racket[#t] if
If @racket[spec] is a regexp value, then the result is @racket[#t] if If @racket[spec] is a regexp value, then the result is @racket[#t] if
the regexp matches @racket[(path->string sys-lib-subpath)], the regexp matches @racket[(path->string sys-lib-subpath)],
@racket[#f] otherwise.
@history[#:changed "6.3" @elem{Added @racket[#:cross?] argument and
changed the contract on @racket[sys-lib-subpath]
to accept @racket[path-for-some-system?]
instead of just @racket[path?].}]}
@; ------------------------------------------------------------------------
@section[#:tag "cross-system"]{API for Cross-Platform Configuration}
@defmodule[setup/cross-system]{The @racketmodname[setup/cross-system]
library provides functions for querying the system properties of a
destination platform, which can be different than the current platform
in cross-installation modes.}
A Racket installation includes a @filepath{system.rktd} file in the
directory reported by @racket[(find-lib-dir)]. When the information in that file
does not match the running Racket's information, then the
@racketmodname[setup/cross-system] module infers that Racket is being
run in cross-installation mode.
For example, if an in-place Racket installation for a different
platform resides at @nonterm{cross-dir}, then
@commandline{racket -G @nonterm{cross-dir}/etc -X @nonterm{cross-dir}/collects -l- raco pkg}
runs @exec{raco pkg} using the current platform's @exec{racket}
executable, but using the collections and other configuration
information of @nonterm{cross-dir}, as well as modifying the packages
of @nonterm{cross-dir}. That can work as long as no platform-specific
libraries need to run to perform the requested @exec{raco pkg} action
(e.g., when installing built packages).
@history[#:added "6.3"]
@defproc[(cross-system-type [mode (or/c 'os 'word 'gc 'link 'machine
'so-suffix 'so-mode 'fs-change)
'os])
(or/c symbol? string? bytes? exact-positive-integer? vector?)]{
Like @racket[system-type], but for the target platform instead of the
current platform in cross-installation mode. When not in
cross-installation mode, the results are the same as for
@racket[system-type].}
@defproc[(cross-system-library-subpath [mode (or/c 'cgc '3m #f)
(system-type 'gc)])
path-for-some-system?]{
Like @racket[system-library-subpath], but for the target platform
instead of the current platform in cross-installation mode. When not
in cross-installation mode, the results are the same as for
@racket[system-library-subpath].
In cross-installation mode, the target platform may have a different
path convention than the current platform, so the result is
@racket[path-for-some-system?] instead of @racket[path?].}
@defproc[(cross-installation?) boolean?]{
Returns @racket[#t] if cross-installation mode has been detected,
@racket[#f] otherwise.} @racket[#f] otherwise.}
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------
@section[#:tag "xref"]{API for Cross-References for Installed Manuals} @section[#:tag "xref"]{API for Cross-References for Installed Manuals}

View File

@ -5,7 +5,8 @@
(for-label racket/runtime-path (for-label racket/runtime-path
racket/base racket/base
launcher/launcher launcher/launcher
rackunit/log)) rackunit/log
compiler/module-suffix))
@title[#:tag "test"]{@exec{raco test}: Run tests} @title[#:tag "test"]{@exec{raco test}: Run tests}
@ -19,12 +20,14 @@ the file.
When an argument path refers to a directory, @exec{raco test} When an argument path refers to a directory, @exec{raco test}
recursively discovers and runs all files within the directory that end recursively discovers and runs all files within the directory that end
in @filepath{.rkt}, end in @filepath{.scrbl}, or have a (possibly in a module suffix (see @racket[get-module-suffixes], but the suffixes
empty) list of command-line arguments provided by always include @filepath{.rkt}, @filepath{.scrbl}, @filepath{.ss}, and
@racket[test-command-line-arguments] in an @filepath{info.rkt} file. @filepath{.scm}) or have a (possibly empty) list of command-line arguments provided by
At the same time, @exec{raco test} omits files and directories within @racket[test-command-line-arguments] in an @filepath{info.rkt} file,
a directory as directed by @racket[test-omit-paths] in an or as directed by @racket[test-include-paths] in an
@filepath{info.rkt} file. @filepath{info.rkt} file. At the same time, @exec{raco test} omits
files and directories within a directory as directed by
@racket[test-omit-paths] in an @filepath{info.rkt} file.
A test is counted as failing if it logs a failing test code via A test is counted as failing if it logs a failing test code via
@racket[test-log!], causes Racket to exit with a non-zero exit code, or @racket[test-log!], causes Racket to exit with a non-zero exit code, or
@ -52,11 +55,11 @@ The @exec{raco test} command accepts several flags:
--- Not only interprets the arguments as paths (which is the --- Not only interprets the arguments as paths (which is the
default mode), but treats them the same as paths found in a default mode), but treats them the same as paths found in a
directory, which means ignoring a file argument that does not directory, which means ignoring a file argument that does not
have the extension @filepath{.rkt}, does not have the extension have a module extension or is not enabled explicitly via
@filepath{.scrbl}, or is not enabled explicitly via @racket[test-command-line-arguments] or @racket[test-include-paths]
@racket[test-command-line-arguments] in an @filepath{info.rkt} in an @filepath{info.rkt} file; meanwhile, paths that are otherwise
file; meanwhile, paths that are otherwise enabled can be disabled enabled can be disabled via @racket[test-omit-paths] in an
via @racket[test-omit-paths] in an @filepath{info.rkt} file.} @filepath{info.rkt} file.}
@item{@DFlag{drdr} @item{@DFlag{drdr}
--- Configures defaults to imitate the DrDr continuous testing --- Configures defaults to imitate the DrDr continuous testing
@ -86,6 +89,14 @@ The @exec{raco test} command accepts several flags:
--- When multiple submodule names are provided with @Flag{s} or --- When multiple submodule names are provided with @Flag{s} or
@DFlag{submodule}, runs only the first available submodule.} @DFlag{submodule}, runs only the first available submodule.}
@item{@DFlag{configure-runtime}
--- Run a @racketidfont{configure-runtime} submodule (if any) of
each specified module before the module or a
submodule is run. This mode is the default when only a single
module is provided or when @DFlag{process} or @DFlag{place}
mode is specified, unless a submodule name is provided
via @Flag{s} or @DFlag{submodule}.}
@item{@DFlag{direct} @item{@DFlag{direct}
--- Runs each test in a thread. This mode is the default if --- Runs each test in a thread. This mode is the default if
a single file is specified. Multiple tests can interfere with a single file is specified. Multiple tests can interfere with
@ -151,7 +162,9 @@ The @exec{raco test} command accepts several flags:
] ]
@history[#:changed "1.1" @elem{Added @DFlag{heartbeat}.}] @history[#:changed "1.1" @elem{Added @DFlag{heartbeat}.}
#:changed "1.4" @elem{Changed recognition of module suffixes to use @racket[get-module-suffixes],
which implies recognizing @filepath{.ss} and @filepath{.rkt}.}]
@section[#:tag "test-config"]{Test Configuration by Submodule} @section[#:tag "test-config"]{Test Configuration by Submodule}
@ -212,20 +225,29 @@ impossible (e.g., because the file will not always compile). Thus,
@exec{raco test} also consults any @filepath{info.rkt} file in the @exec{raco test} also consults any @filepath{info.rkt} file in the
candidate test file's directory. In the case of a file within a candidate test file's directory. In the case of a file within a
collection, @filepath{info.rkt} files from any enclosing collection collection, @filepath{info.rkt} files from any enclosing collection
directories are also consulted for @racket[test-omit-paths]. Finally, directories are also consulted for @racket[test-omit-paths] and
for a file within a package, the package's @filepath{info.rkt} is @racket[test-include-paths]. Finally, for a file within a package, the
consulted for @racket[pkg-authors] to set the default responsible package's @filepath{info.rkt} is consulted for @racket[pkg-authors] to
parties (see @secref["test-responsible"]) for all files in the set the default responsible parties (see @secref["test-responsible"])
package. for all files in the package.
The following @filepath{info.rkt} fields are recognized: The following @filepath{info.rkt} fields are recognized:
@itemlist[ @itemlist[
@item{@racket[test-omit-paths] --- a list of path strings (relative @item{@racket[test-omit-paths] --- a list of path strings (relative
to the enclosing directory) or @racket['all] to omit all files to the enclosing directory) and regexp values (to omit all
within the enclosing directory. When a path string refers to a files within the enclosing directory matching the expression),
directory, all files within the directory are omitted.} or @racket['all] to omit all files within the enclosing directory.
When a path string refers to a directory, all files within the
directory are omitted.}
@item{@racket[test-include-paths] --- a list of path strings (relative
to the enclosing directory) and regexp values (to include all
files within the enclosing directory matching the expression),
or @racket['all] to include all files within the enclosing directory.
When a path string refers to a directory, all files within the
directory are included.}
@item{@racket[test-command-line-arguments] --- a list of @item{@racket[test-command-line-arguments] --- a list of
@racket[(list _module-path-string (list _argument-path-string @racket[(list _module-path-string (list _argument-path-string
@ -254,6 +276,9 @@ The following @filepath{info.rkt} fields are recognized:
the enclosing directory) for modules whose output varies. the enclosing directory) for modules whose output varies.
See @secref["test-responsible"].} See @secref["test-responsible"].}
@item{@racket[module-suffixes] and @racket[doc-module-suffixes] ---
Used indirectly via @racket[get-module-suffixes].}
] ]
@section[#:tag "test-responsible"]{Responsible-Party and Varying-Output Logging} @section[#:tag "test-responsible"]{Responsible-Party and Varying-Output Logging}

View File

@ -75,3 +75,12 @@ The @racketmodname[compiler/zo-parse] module re-exports
or @racket[mod] structure indicates the list of global variables and or @racket[mod] structure indicates the list of global variables and
quoted syntax that need to be instantiated (and put into an array on quoted syntax that need to be instantiated (and put into an array on
the stack) before evaluating expressions that might use them.} the stack) before evaluating expressions that might use them.}
@defproc[(decode-module-binding [binding module-binding?]
[name symbol?])
decoded-module-binding?]{
Given a compact-form representation of a module binding and the name
from which the binding is mapped, returns a normalized form of the
binding.}

View File

@ -1,5 +1,6 @@
#lang scribble/doc #lang scribble/doc
@(require scribble/manual @(require scribble/manual
scribble/core
(for-label racket/base (for-label racket/base
racket/contract racket/contract
compiler/zo-structs compiler/zo-structs
@ -19,6 +20,14 @@ The @racketmodname[compiler/zo-structs] library defines the bytecode
structures that are produced by @racket[zo-parse] and consumed by structures that are produced by @racket[zo-parse] and consumed by
@racket[decompile] and @racket[zo-marshal]. @racket[decompile] and @racket[zo-marshal].
@nested[#:style 'inset]{
@elem[#:style (style #f (list (background-color-property "yellow")))]{@bold{Warning:}}
The @racketmodname[compiler/zo-structs] library exposes internals
of the Racket bytecode abstraction. Unlike other Racket
libraries, @racketmodname[compiler/zo-structs] is subject to
incompatible changes across Racket versions.}
@defstruct+[zo ()]{ @defstruct+[zo ()]{
A supertype for all forms that can appear in compiled code.} A supertype for all forms that can appear in compiled code.}
@ -27,21 +36,35 @@ structures that are produced by @racket[zo-parse] and consumed by
@defstruct+[(compilation-top zo) @defstruct+[(compilation-top zo)
([max-let-depth exact-nonnegative-integer?] ([max-let-depth exact-nonnegative-integer?]
[binding-namess (hash/c exact-nonnegative-integer?
(hash/c symbol? stx?))]
[prefix prefix?] [prefix prefix?]
[code (or/c form? any/c)])]{ [code (or/c form? any/c)])]{
Wraps compiled code. The @racket[max-let-depth] field indicates the Wraps compiled code.
The @racket[max-let-depth] field indicates the
maximum stack depth that @racket[code] creates (not counting the maximum stack depth that @racket[code] creates (not counting the
@racket[prefix] array). The @racket[prefix] field describes top-level @racket[prefix] array).
variables, module-level variables, and quoted syntax-objects accessed
by @racket[code]. The @racket[code] field contains executable code; The @racket[binding-namess] field provides a per-phase mapping from
it is normally a @racket[form], but a literal value is represented as symbols that appear in @racket[prefix] for top-level
itself.} @racket[def-values] forms and in top-level @racket[def-syntaxes]
forms. Each symbol is mapped to an identifier that will be bound
(after introduction into the namespace) by the definition.
The @racket[prefix] field describes top-level variables,
module-level variables, and quoted syntax-objects accessed by
@racket[code].
The @racket[code] field contains executable code; it is normally a
@racket[form], but a literal value is represented as itself.}
@defstruct+[(prefix zo) @defstruct+[(prefix zo)
([num-lifts exact-nonnegative-integer?] ([num-lifts exact-nonnegative-integer?]
[toplevels (listof (or/c #f symbol? global-bucket? [toplevels (listof (or/c #f symbol? global-bucket?
module-variable?))] module-variable?))]
[stxs (listof stx?)])]{ [stxs (listof (or stx? #f))]
[src-inspector-desc symbol?])]{
Represents a ``prefix'' that is pushed onto the stack to initiate Represents a ``prefix'' that is pushed onto the stack to initiate
evaluation. The prefix is an array, where buckets holding the evaluation. The prefix is an array, where buckets holding the
values for @racket[toplevels] are first, then the buckets for the values for @racket[toplevels] are first, then the buckets for the
@ -63,7 +86,16 @@ structures that are produced by @racket[zo-parse] and consumed by
The variable buckets and syntax objects that are recorded in a prefix The variable buckets and syntax objects that are recorded in a prefix
are accessed by @racket[toplevel] and @racket[topsyntax] expression are accessed by @racket[toplevel] and @racket[topsyntax] expression
forms.} forms.
When an element of @racket[stxs] is @racket[#f], it coresponds to a
syntax object that was optimized away at the last minute. The slot
must not be referenced vt a @racket[topsyntax] form.
The @racket[src-inspector-desc] field provides an inspector name that
is used within syntax-object bindings. At run time, the prefix gets
an inspector, and bindings that reference the same inspector name are
granted access capabilities through that inspector.}
@defstruct+[(global-bucket zo) ([name symbol?])]{ @defstruct+[(global-bucket zo) ([name symbol?])]{
Represents a top-level variable, and used only in a @racket[prefix].} Represents a top-level variable, and used only in a @racket[prefix].}
@ -111,8 +143,8 @@ returns.}
Represents the shape of an expected import as a structure-type Represents the shape of an expected import as a structure-type
binding, constructor, etc.} binding, constructor, etc.}
@defstruct+[(stx zo) ([encoded wrapped?])]{ @defstruct+[(stx zo) ([content stx-obj?])]{
Wraps a syntax object in a @racket[prefix].} Wraps a syntax object as it appears in a @racket[prefix].}
@; -------------------------------------------------- @; --------------------------------------------------
@ -205,6 +237,8 @@ binding, constructor, etc.}
[dummy toplevel?] [dummy toplevel?]
[lang-info (or/c #f (vector/c module-path? symbol? any/c))] [lang-info (or/c #f (vector/c module-path? symbol? any/c))]
[internal-context (or/c #f #t stx? (vectorof stx?))] [internal-context (or/c #f #t stx? (vectorof stx?))]
[binding-names (hash/c exact-integer?
(hash/c symbol? (or/c #t stx?)))]
[flags (listof (or/c 'cross-phase))] [flags (listof (or/c 'cross-phase))]
[pre-submodules (listof mod?)] [pre-submodules (listof mod?)]
[post-submodules (listof mod?)])]{ [post-submodules (listof mod?)])]{
@ -240,12 +274,24 @@ binding, constructor, etc.}
The @racket[lang-info] value specifies an optional module path that The @racket[lang-info] value specifies an optional module path that
provides information about the module's implementation language. provides information about the module's implementation language.
The @racket[internal-module-context] value describes the lexical The @racket[internal-context] value describes the lexical context of
context of the body of the module. This value is used by the body of the module. This value is used by
@racket[module->namespace]. A @racket[#f] value means that the @racket[module->namespace]. A @racket[#f] value means that the
context is unavailable or empty. A @racket[#t] value means that the context is unavailable or empty. A @racket[#t] value means that the
context is computed by re-importing all required modules. A context is computed by re-importing all required modules. A
syntax-object value embeds an arbitrary lexical context. syntax-object value embeds lexical information; the syntax object
should contain a vector of two elements, where the first element of
the vector is a syntax object for the module's body, which includes
the outside-edge and inside-edge scopes, and the second element of
the vector is a syntax object that has just the module's inside-edge
scope.
The @racket[binding-names] value provides additional information to
@racket[module->namespace] to correlate symbol names for variables
and syntax definitions to identifiers that map to those variables. A
separate table of names exists for each phase, and a @racket[#t]
mapping for a name indicates that it is mapped but inaccessible
(because the relevant scopes are inaccessible).
The @racket[flags] field records certain properties of the module. The @racket[flags] field records certain properties of the module.
The @racket['cross-phase] flag indicates that the module body is The @racket['cross-phase] flag indicates that the module body is
@ -257,7 +303,7 @@ binding, constructor, etc.}
submodules, while the @racket[post-submodules] field records submodules, while the @racket[post-submodules] field records
@racket[module*]-declared submodules.} @racket[module*]-declared submodules.}
@defstruct+[provided @defstruct+[(provided zo)
([name symbol?] ([name symbol?]
[src (or/c module-path-index? #f)] [src (or/c module-path-index? #f)]
[src-name symbol?] [src-name symbol?]
@ -307,7 +353,7 @@ binding, constructor, etc.}
values; also, this information is redundant, since it can be inferred values; also, this information is redundant, since it can be inferred
by the bindings referenced though @racket[closure-map]. by the bindings referenced though @racket[closure-map].
Which a closure captures top-level or module-level variables or When a closure captures top-level or module-level variables or
refers to a syntax-object constant, the variables and constants are refers to a syntax-object constant, the variables and constants are
represented in the closure by capturing a prefix (in the sense represented in the closure by capturing a prefix (in the sense
of @racket[prefix]). The @racket[toplevel-map] field indicates of @racket[prefix]). The @racket[toplevel-map] field indicates
@ -539,6 +585,22 @@ binding, constructor, etc.}
which is handled specially by the run-time system.} which is handled specially by the run-time system.}
@defstruct+[(with-immed-mark expr)
([key (or/c expr? seq? any/c)]
[val (or/c expr? seq? any/c)]
[body (or/c expr? seq? any/c)])]{
Represents a @racket[(call-with-immediate-continuation-mark key
(lambda (_arg) _body) val)] expression that is handled specially by
the run-time system to avoid a closure allocation. One initialized
slot is pushed onto the stack after @racket[expr] and @racket[val]
are evaluated and before @racket[body] is evaluated.
After each of @racket[key] and @racket[val] is evaluated, the stack is
restored to its depth from before evaluating @racket[key] or
@racket[val].}
@defstruct+[(primval expr) @defstruct+[(primval expr)
([id exact-nonnegative-integer?])]{ ([id exact-nonnegative-integer?])]{
Represents a direct reference to a variable imported from the run-time Represents a direct reference to a variable imported from the run-time
@ -547,127 +609,207 @@ binding, constructor, etc.}
@; -------------------------------------------------- @; --------------------------------------------------
@section{Syntax Objects} @section{Syntax Objects}
@defstruct+[(wrapped zo) @defstruct+[(stx-obj zo)
([datum any/c] ([datum any/c]
[wraps (listof wrap?)] [wrap wrap?]
[srcloc (or/c #f srcloc?)]
[props (hash/c symbol? any/c)]
[tamper-status (or/c 'clean 'armed 'tainted)])]{ [tamper-status (or/c 'clean 'armed 'tainted)])]{
Represents a syntax object, where @racket[wraps] contain the lexical Represents a syntax object, where @racket[wrap] contains lexical
information and @racket[tamper-status] is taint information. When the information, @racket[srcloc] is the source location,
@racket[datum] part is itself compound, its pieces are wrapped, too.} @racket[props] contains preserved properties,
and @racket[tamper-status] is taint information. When the
@racket[datum] part is itself compound, its pieces are wrapped
as @racket[stx-obj]s, too.
@defstruct+[(wrap zo) ()]{ The content of @racket[wrap] is typically cyclic, since it includes
A supertype for lexical-information elements.} scopes that contain bindings that refer to scopes.}
@defstruct+[(top-level-rename wrap) ([flag boolean?])]{ @defstruct+[(wrap zo) ([shifts (listof module-shift?)]
A top-level renaming.} [simple-scopes (listof scope?)]
[multi-scopes (listof (list/c multi-scope? (or/c #f exact-integer?)))])]{
Lexical information for a syntax object. The @racket[shifts] field
allows binding information to be relative to the enclosing module's
run-time path. The @racket[simple-scopes] field records scopes that
are attached to the syntax object at all phases, and @racket[multi-scopes]
records phase-specific scopes (which are always attached as a group)
along with a phase shift for every scope within the group).}
@defstruct+[(mark-barrier wrap) ([value symbol?])]{ @defstruct+[(module-shift zo) ([from (or/c #f module-path-index?)]
A mark barrier.} [to (or/c #f module-path-index?)]
[from-inspector-desc (or/c #f symbol?)]
[to-inspector-desc (or/c #f symbol?)])]{
@defstruct+[(free-id-info zo) Records a history of module path index replacements. These replacements
([path0 module-path-index?] are applied in reverse order, and a module instantiation typically adds
[symbol0 symbol?] one more shift to replace the current ``self'' module path index
[path1 module-path-index?] with a run-time module path. The @racket[from] and @racket[to]
[symbol1 symbol?] fields should be both @racket[#f] or both non-@racket[#f].
[phase0 (or/c exact-integer? #f)]
[phase1 (or/c exact-integer? #f)]
[phase2 (or/c exact-integer? #f)]
[use-current-inspector? boolean?])]{
Information about a free identifier.}
@defstruct+[(lexical-rename wrap) The @racket[from-inspector-desc] and @racket[to-inspector-desc] fields
([has-free-id-info? boolean?] similarly should be both @racket[#f] or both non-@racket[#f]. They
[bool2 boolean?] record a history of code-inspector replacements.}
[alist
(listof
(cons/c symbol?
(or/c symbol?
(cons/c symbol?
(or/c (cons/c symbol? (or/c symbol? #f))
free-id-info?)))))])]{
A local-binding mapping from symbols to binding-set names.}
@defstruct+[(phase-shift wrap) @defstruct+[(scope zo) ([name (or/c 'root exact-nonnegative-integer?)]
([amt (or/c exact-integer? #f)] [kind symbol?]
[src module-path-index?] [bindings (listof (list/c symbol? (listof scope?) binding?)) #;#:mutable]
[dest module-path-index?] [bulk-bindings (listof (list/c (listof scope?) all-from-module?)) #;#:mutable]
[cancel-id (or/c exact-integer? #f)])]{ [multi-owner (or/c #f multi-scope?) #;#:mutable])]{
Shifts module bindings later in the wrap set.}
@defstruct+[(module-rename wrap) Represents a scope. When @racket[name] is @racket['root] then the
([phase exact-integer?] scope represents the unique all-phases scope that is shared among
[kind (or/c 'marked 'normal)] non-module namespaces. Otherwise, @racket[name] is intended to be
[set-id any/c] distinct for each @racket[scope] instance within a module or top-level
[unmarshals (listof make-all-from-module?)] compilation, but the @racket[eq?]-identity of the @racket[scope]
[renames (listof module-binding?)] instance ultimately determines its identity. The @racket[kind] symbol
[mark-renames any/c] similarly acts as a debugging hint in the same way as for
[plus-kern? boolean?])]{ @racket[syntax-debug-info].
Represents a set of module and import bindings.}
@defstruct+[(all-from-module zo) The @racket[bindings] list indicates some bindings that are associated
([path module-path-index?] with the scope. Each element of the list includes a symbolic name, a
list of scopes (including the enclosing one), and the binding for the
combination of name and scope set. A given symbol can appear in
multiple elements of @racket[bindings], but the combination of the
symbol and scope set are unique within @racket[bindings] and across
all scopes. The mapping of a symbol and scope set to a binding is
recorded with an arbitrary member of the scope set.
The @racket[bulk-bindings] field lists bindings of all exports from a
given module, which is an optimization over including each export in
@racket[bindings]. Elements of @racket[bindings] take precedence over
elements of @racket[bulk-bindings], and earlier elements of
@racket[bulk-bindings] take precedence over later elements.
If the @racket[scope] represents a scope at a particular phase for a
group of phase-specific scopes, @racket[mark-owner] refers to the
group.}
@defstruct+[(multi-scope zo) ([name exact-nonnegative-integer?]
[src-name any/c]
[scopes (listof (list/c (or/c #f exact-integer?) scope?)) #;#:mutable])]{
Represents a set of phase-specific scopes that are added or removed
from lexical information as a group. As for @racket[scope], the
@racket[name] field is intended to be distinct for different groups,
but the @racket[eq?] identity of the @racket[multi-scope] record
ultimately determines its identity. The @racket[src-name] field
similarly acts as a debugging hint in the same way as for
@racket[syntax-debug-info].
Scopes within the group are instantiated at different phases on
demand. The @racket[scopes] field lists all of the scopes instantiated
for the group, and the phase at which it is instantiated. Each element
of @racket[scopes] must have a @racketidfont{multi-owner} field
value that refers back to the @racket[multi-scope].}
@defstruct+[(binding zo) ()]{
A supertype for all binding representations.}
@defstruct+[(module-binding binding) ([encoded any/c])]{
Represents a binding to a module or top-level definition. The
@racket[encoded] field can be unpacked using
@racket[decode-module-binding], providing the symbol name for which
the binding is the target (since @racket[encoded] can be relative to
that name).}
@defstruct+[(decoded-module-binding binding) ([path (or/c #f module-path-index?)]
[name symbol?]
[phase exact-integer?]
[nominal-path (or/c #f module-path-index?)]
[nominal-export-name symbol?]
[nominal-phase (or/c #f exact-integer?)]
[import-phase (or/c #f exact-integer?)]
[inspector-desc (or/c #f symbol?)])]{
Represents a binding to a module or top-level definition---like
@racket[module-binding], but in normalized form:
@itemlist[
@item{@racket[path]: the referenced module.}
@item{@racket[name]: the referenced definition within its module.}
@item{@racket[phase]: the phase of the referenced definition within
its module.}
@item{@racket[nominal-path]: the module that was explicitly imported
into the binding context; this path can be different from
@racket[path] when a definition is re-exported.}
@item{@racket[nominal-export-name]: the name of the binding as
exported from @racket[nominal-path], which can be different from
@racket[name] due to renaming on export.}
@item{@racket[nominal-phase]: the phase of the export from
@racket[nominal-path], which can be different from @racket[phase]
due to re-export from a module that imports at a phase level other
than @racket[0].}
@item{@racket[import-phase]: the phase of the import of
@racket[nominal-path], which shifted (if non-@racket[0]) the
binding phase relative to the export phase from
@racket[nominal-path].}
@item{@racket[inspector-desc]: a name for an inspector (mapped to a
specific inspector at run time) that determines access to the
definition.}
]}
@defstruct+[(local-binding binding) ([name symbol?])]{
Represents a local binding (i.e., not at the top level or module level).
Such bindings rarely appear in bytecode, since @racket[quote-syntax]
prunes them.}
@defstruct+[(free-id=?-binding binding) ([base (and/c binding?
(not/c free-id=?-binding?))]
[id stx-obj?]
[phase (or/c #f exact-integer?)])]{
Represents a binding that includes a @racket[free-identifier=?] alias
(to an identifier with a particular phase shift) as well as a base binding.}
@defstruct+[(all-from-module zo) ([path module-path-index?]
[phase (or/c exact-integer? #f)] [phase (or/c exact-integer? #f)]
[src-phase (or/c exact-integer? #f)] [src-phase (or/c exact-integer? #f)]
[inspector-desc symbol?]
[exceptions (listof symbol?)] [exceptions (listof symbol?)]
[prefix (or/c symbol? #f)] [prefix (or/c symbol? #f)])]{
[context (or/c (listof exact-integer?)
(vector/c (listof exact-integer?) any/c)
#f)])]{
Represents a set of simple imports from one module within a
@racket[module-rename].}
@defstruct+[(module-binding zo) ()]{ Describes a bulk import as an optimization over individual imports of
A supertype for module bindings.} a module's exports:
@defstruct+[(simple-module-binding module-binding) @itemlist[
([path module-path-index?])]{
Represents a single identifier import within a
@racket[module-rename].}
@defstruct+[(phased-module-binding module-binding) @item{@racket[path]: the imported module.}
([path module-path-index?]
[phase exact-integer?]
[export-name any/c]
[nominal-path nominal-path?]
[nominal-export-name any/c])]{
Represents a single identifier import within a
@racket[module-rename].}
@defstruct+[(exported-nominal-module-binding module-binding) @item{@racket[phase]: the phase of the import module's exports.}
([path module-path-index?]
[export-name any/c]
[nominal-path nominal-path?]
[nominal-export-name any/c])]{
Represents a single identifier import within a
@racket[module-rename].}
@defstruct+[(nominal-module-binding module-binding) @item{@racket[src-phase]: the phase at which @racket[path] was
([path module-path-index?] imported; @racket[src-phase] combined with @racket[phase]
[nominal-path nominal-path?])]{ determines the phase of the bindings.}
Represents a single identifier import within a
@racket[module-rename].}
@defstruct+[(exported-module-binding module-binding) @item{@racket[inspector-desc]: a name for an inspector (mapped to a
([path module-path-index?] specific inspector at run time) that determines access to the
[export-name any/c])]{ definition.}
Represents a single identifier import within a
@racket[module-rename].}
@defstruct+[(nominal-path zo) ()]{ @item{@racket[exceptions]: exports of @racket[path] that are omitted
A supertype for nominal paths.} from the bulk import.}
@defstruct+[(simple-nominal-path nominal-path) @item{@racket[prefix]: a prefix, if any, applied (after
([value module-path-index?])]{ @racket[exceptions]) to each of the imported names.}
Represents a simple nominal path.}
]}
@defstruct+[(imported-nominal-path nominal-path)
([value module-path-index?]
[import-phase exact-integer?])]{
Represents an imported nominal path.}
@defstruct+[(phased-nominal-path nominal-path)
([value module-path-index?]
[import-phase (or/c false/c exact-integer?)]
[phase exact-integer?])]{
Represents a phased nominal path.}

View File

@ -70,8 +70,9 @@ synchronization} when @racket[(async-channel-put ach v)] would return
a value (i.e., when the channel holds fewer values already than its a value (i.e., when the channel holds fewer values already than its
limit); @resultItself{asychronous channel-put event}.} limit); @resultItself{asychronous channel-put event}.}
@defexamples[#:eval (async-eval) @examples[#:eval (async-eval) #:once
(define (server input-channel output-channel) (eval:no-prompt
(define (server input-channel output-channel)
(thread (lambda () (thread (lambda ()
(define (get) (define (get)
(async-channel-get input-channel)) (async-channel-get input-channel))
@ -88,9 +89,8 @@ limit); @resultItself{asychronous channel-put event}.}
[(long) (begin [(long) (begin
(put (do-large-computation)) (put (do-large-computation))
(loop (get)))]))))) (loop (get)))])))))
(define to-server (make-async-channel))
(define to-server (make-async-channel)) (define from-server (make-async-channel)))
(define from-server (make-async-channel))
(server to-server from-server) (server to-server from-server)

View File

@ -1,5 +1,5 @@
#lang scribble/doc #lang scribble/doc
@(require "mz.rkt" scribble/eval (for-label racket/block)) @(require "mz.rkt" (for-label racket/block))
@(define ev (make-base-eval)) @(define ev (make-base-eval))
@(ev '(require racket/block)) @(ev '(require racket/block))

View File

@ -643,7 +643,7 @@ normally identified by @racket[""]). See also
@section{Additional Byte String Functions} @section{Additional Byte String Functions}
@note-lib[racket/bytes] @note-lib[racket/bytes]
@(define string-eval (make-base-eval)) @(define string-eval (make-base-eval))
@(interaction-eval #:eval string-eval (require racket/bytes racket/list)) @@examples[#:hidden #:eval string-eval (require racket/bytes racket/list)]
@defproc[(bytes-append* [str bytes?] ... [strs (listof bytes?)]) bytes?]{ @defproc[(bytes-append* [str bytes?] ... [strs (listof bytes?)]) bytes?]{
@; Note: this is exactly the same description as the one for append* @; Note: this is exactly the same description as the one for append*

View File

@ -15,10 +15,9 @@ often, then the thread eventually participates in a transaction.
In addition to its use with channel-specific procedures, a channel can In addition to its use with channel-specific procedures, a channel can
be used as a @tech{synchronizable event} (see @secref["sync"]). A be used as a @tech{synchronizable event} (see @secref["sync"]). A
channel is @tech{ready for synchronization} when @racket[make-channel] channel is @tech{ready for synchronization} when @racket[channel-get]
is ready when @racket[channel-get] would not block; the channel's would not block; the channel's @tech{synchronization result} is the
@tech{synchronization result} is the same as the @racket[channel-get] same as the @racket[channel-get] result.
result.
For buffered asynchronous channels, see @secref["async-channel"]. For buffered asynchronous channels, see @secref["async-channel"].

View File

@ -191,18 +191,31 @@ required keyword arguments of @racket[wrapper-proc] must be a subset
of the required keywords of @racket[proc]. of the required keywords of @racket[proc].
For applications without keywords, the result of @racket[wrapper-proc] For applications without keywords, the result of @racket[wrapper-proc]
must be either the same number of values as supplied to it or one more must be at least the same number of values as supplied to it.
than the number of supplied values, where an extra result is supplied Additional results can be supplied---before the values that correspond
before the others. The additional result, if any, must be a procedure to the supplied values---in the following pattern:
@itemlist[
@item{An optional procedure, @racket[_result-wrapper-proc], which
will be applied to the results of @racket[proc]; followed by}
@item{any number of repetitions of @racket['mark _key _val] (i.e.,
three values), where the call @racket[_proc] is wrapped to
install a @tech{continuation mark} @racket[_key] and @racket[_val].}
]
If @racket[_result-wrapper-proc] is produced, it must be a procedure
that accepts as many results as produced by @racket[proc]; it must that accepts as many results as produced by @racket[proc]; it must
return the same number of results. If @racket[wrapper-proc] returns return the same number of results. If @racket[_result-wrapper-proc] is
the same number of values as it is given (i.e., it does not return a not supplied, then @racket[proc] is called in @tech{tail position}
procedure to impersonator @racket[proc]'s result), then @racket[proc] is with respect to the call to the impersonator.
called in @tech{tail position} with respect to the call to the impersonator.
For applications that include keyword arguments, @racket[wrapper-proc] For applications that include keyword arguments, @racket[wrapper-proc]
must return an additional value before any other values but after the must return an additional value before any other values but after
result-impersonating procedure (if any). The additional value must be a @racket[_result-wrapper-proc] and @racket['mark _key _val]
sequences (if any). The additional value must be a
list of replacements for the keyword arguments that were supplied to the list of replacements for the keyword arguments that were supplied to the
impersonator (i.e., not counting optional arguments that were impersonator (i.e., not counting optional arguments that were
not supplied). The arguments must be ordered according to the sorted not supplied). The arguments must be ordered according to the sorted
@ -221,13 +234,59 @@ If any @racket[prop] is @racket[impersonator-prop:application-mark] and if the
associated @racket[prop-val] is a pair, then the call to @racket[proc] associated @racket[prop-val] is a pair, then the call to @racket[proc]
is wrapped with @racket[with-continuation-mark] using @racket[(car is wrapped with @racket[with-continuation-mark] using @racket[(car
prop-val)] as the mark key and @racket[(cdr prop-val)] as the mark prop-val)] as the mark key and @racket[(cdr prop-val)] as the mark
value. In addition, if @racket[continuation-mark-set-first] with value. In addition, if the immediate
@racket[(car prop-val)] produces a value for the immediate continuation frame of the call to the impersonated procedure
continuation frame of the call to the impersonated procedure, the value is includes a value for @racket[(car prop-val)]---that is, if
@racket[call-with-immediate-continuation-mark] would produce a value
for @racket[(car prop-val)] in the call's continuation---then the value is
also installed as an immediate value for @racket[(car prop-val)] as a also installed as an immediate value for @racket[(car prop-val)] as a
mark during the call to @racket[wrapper-proc] (which allows tail-calls mark during the call to @racket[wrapper-proc] (which allows tail-calls
of impersonators with respect to wrapping impersonators to be detected within of impersonators with respect to wrapping impersonators to be detected within
@racket[wrapper-proc]).} @racket[wrapper-proc]).
@history[#:changed "6.3.0.5" @elem{Added support for @racket['mark
_key _val] results from
@racket[wrapper-proc].}]
@examples[
(define (add15 x) (+ x 15))
(define add15+print
(impersonate-procedure add15
(λ (x)
(printf "called with ~s\n" x)
(values (λ (res)
(printf "returned ~s\n" res)
res)
x))))
(add15 27)
(add15+print 27)
(define-values (imp-prop:p1 imp-prop:p1? imp-prop:p1-get)
(make-impersonator-property 'imp-prop:p1))
(define-values (imp-prop:p2 imp-prop:p2? imp-prop:p2-get)
(make-impersonator-property 'imp-prop:p2))
(define add15.2 (impersonate-procedure add15 #f imp-prop:p1 11))
(add15.2 2)
(imp-prop:p1? add15.2)
(imp-prop:p1-get add15.2)
(imp-prop:p2? add15.2)
(define add15.3 (impersonate-procedure add15.2 #f imp-prop:p2 13))
(add15.3 3)
(imp-prop:p1? add15.3)
(imp-prop:p1-get add15.3)
(imp-prop:p2? add15.3)
(imp-prop:p2-get add15.3)
(define add15.4 (impersonate-procedure add15.3 #f imp-prop:p1 101))
(add15.4 4)
(imp-prop:p1? add15.4)
(imp-prop:p1-get add15.4)
(imp-prop:p2? add15.4)
(imp-prop:p2-get add15.4)]
}
@defproc[(impersonate-procedure* [proc procedure?] @defproc[(impersonate-procedure* [proc procedure?]
[wrapper-proc (or/c procedure? #f)] [wrapper-proc (or/c procedure? #f)]
@ -387,6 +446,7 @@ or override impersonator-property values of @racket[box].}
[remove-proc (hash? any/c . -> . any/c)] [remove-proc (hash? any/c . -> . any/c)]
[key-proc (hash? any/c . -> . any/c)] [key-proc (hash? any/c . -> . any/c)]
[clear-proc (or/c #f (hash? . -> . any)) #f] [clear-proc (or/c #f (hash? . -> . any)) #f]
[equal-key-proc (or/c #f (hash? any/c . -> . any/c)) #f]
[prop impersonator-property?] [prop impersonator-property?]
[prop-val any] ... ...) [prop-val any] ... ...)
(and/c hash? impersonator?)]{ (and/c hash? impersonator?)]{
@ -402,7 +462,7 @@ In addition, operations like
@racket[hash-iterate-key] or @racket[hash-map], which extract @racket[hash-iterate-key] or @racket[hash-map], which extract
keys from the table, use @racket[key-proc] to filter keys extracted keys from the table, use @racket[key-proc] to filter keys extracted
from the table. Operations like @racket[hash-iterate-value] or from the table. Operations like @racket[hash-iterate-value] or
@racket[hash-iterate-map] implicitly use @racket[hash-ref] and @racket[hash-values] implicitly use @racket[hash-ref] and
therefore redirect through @racket[ref-proc]. therefore redirect through @racket[ref-proc].
The @racket[ref-proc] must accept @racket[hash] and a key passed The @racket[ref-proc] must accept @racket[hash] and a key passed
@ -440,6 +500,19 @@ If @racket[clear-proc] is @racket[#f], then @racket[hash-clear] or
@racket[hash-clear!] on the impersonator is implemented using @racket[hash-clear!] on the impersonator is implemented using
@racket[hash-iterate-key] and @racket[hash-remove] or @racket[hash-remove!]. @racket[hash-iterate-key] and @racket[hash-remove] or @racket[hash-remove!].
If @racket[equal-key-proc] is not @racket[#f], it effectively
interposes on calls to @racket[equal?], @racket[equal-hash-code], and
@racket[equal-secondary-hash-code] for the keys of @racket[hash]. The
@racket[equal-key-proc] must accept as its arguments @racket[hash] and
a key that is either mapped by @racket[hash] or passed to
@racket[hash-ref], etc., where the latter has potentially been
adjusted by the corresponding @racket[ref-proc], etc@|.__| The result
is a value that is passed to @racket[equal?],
@racket[equal-hash-code], and @racket[equal-secondary-hash-code] as
needed to hash and compare keys. In the case of @racket[hash-set!] or
@racket[hash-set], the key that is passed to @racket[equal-key-proc]
is the one stored in the hash table for future lookup.
The @racket[hash-iterate-value], @racket[hash-map], or The @racket[hash-iterate-value], @racket[hash-map], or
@racket[hash-for-each] functions use a combination of @racket[hash-for-each] functions use a combination of
@racket[hash-iterate-key] and @racket[hash-ref]. If a key @racket[hash-iterate-key] and @racket[hash-ref]. If a key
@ -448,7 +521,10 @@ produced by @racket[key-proc] does not yield a value through
Pairs of @racket[prop] and @racket[prop-val] (the number of arguments Pairs of @racket[prop] and @racket[prop-val] (the number of arguments
to @racket[impersonate-hash] must be odd) add impersonator properties to @racket[impersonate-hash] must be odd) add impersonator properties
or override impersonator-property values of @racket[hash].} or override impersonator-property values of @racket[hash].
@history[#:changed "6.3.0.11" @elem{Added the @racket[equal-key-proc]
argument.}]}
@defproc[(impersonate-channel [channel channel?] @defproc[(impersonate-channel [channel channel?]
@ -707,7 +783,6 @@ or structure type.
#:changed "6.1.1.8" @elem{Added optional @racket[struct-type] #:changed "6.1.1.8" @elem{Added optional @racket[struct-type]
argument.}]} argument.}]}
@defproc[(chaperone-vector [vec vector?] @defproc[(chaperone-vector [vec vector?]
[ref-proc (vector? exact-nonnegative-integer? any/c . -> . any/c)] [ref-proc (vector? exact-nonnegative-integer? any/c . -> . any/c)]
[set-proc (vector? exact-nonnegative-integer? any/c . -> . any/c)] [set-proc (vector? exact-nonnegative-integer? any/c . -> . any/c)]
@ -743,6 +818,7 @@ the same value or a chaperone of the value that it is given. The
[remove-proc (hash? any/c . -> . any/c)] [remove-proc (hash? any/c . -> . any/c)]
[key-proc (hash? any/c . -> . any/c)] [key-proc (hash? any/c . -> . any/c)]
[clear-proc (or/c #f (hash? . -> . any)) #f] [clear-proc (or/c #f (hash? . -> . any)) #f]
[equal-key-proc (or/c #f (hash? any/c . -> . any/c)) #f]
[prop impersonator-property?] [prop impersonator-property?]
[prop-val any] ... ...) [prop-val any] ... ...)
(and/c hash? chaperone?)]{ (and/c hash? chaperone?)]{
@ -752,8 +828,12 @@ and support for immutable hashes. The @racket[ref-proc] procedure must
return a found value or a chaperone of the value. The return a found value or a chaperone of the value. The
@racket[set-proc] procedure must produce two values: the key that it @racket[set-proc] procedure must produce two values: the key that it
is given or a chaperone of the key and the value that it is given or a is given or a chaperone of the key and the value that it is given or a
chaperone of the value. The @racket[remove-proc] and @racket[key-proc] chaperone of the value. The @racket[remove-proc], @racket[key-proc],
procedures must produce the given key or a chaperone of the key.} and @racket[equal-key-proc]
procedures must produce the given key or a chaperone of the key.
@history[#:changed "6.3.0.11" @elem{Added the @racket[equal-key-proc]
argument.}]}
@defproc[(chaperone-struct-type [struct-type struct-type?] @defproc[(chaperone-struct-type [struct-type struct-type?]
[struct-info-proc procedure?] [struct-info-proc procedure?]
@ -865,11 +945,12 @@ procedure.
(lambda (n) (* n 2)) (lambda (n) (* n 2))
(lambda (n) (+ n 1)))) (lambda (n) (+ n 1))))
(eval:error
(call-with-continuation-prompt (call-with-continuation-prompt
(lambda () (lambda ()
(abort-current-continuation bad-chaperone 5)) (abort-current-continuation bad-chaperone 5))
bad-chaperone bad-chaperone
(lambda (n) n)) (lambda (n) n)))
(define good-chaperone (define good-chaperone
(chaperone-prompt-tag (chaperone-prompt-tag
@ -907,10 +988,11 @@ given.
(lambda (l) (map char-upcase l)) (lambda (l) (map char-upcase l))
string->list)) string->list))
(eval:error
(with-continuation-mark bad-chaperone "timballo" (with-continuation-mark bad-chaperone "timballo"
(continuation-mark-set-first (continuation-mark-set-first
(current-continuation-marks) (current-continuation-marks)
bad-chaperone)) bad-chaperone)))
(define (checker s) (define (checker s)
(if (> (string-length s) 5) (if (> (string-length s) 5)

View File

@ -71,11 +71,10 @@
) )
@(interaction-eval #:eval class-eval (require racket/class racket/contract)) @examples[#:hidden #:eval class-eval
@(interaction-eval (require racket/class racket/contract)]
#:eval class-ctc-eval @examples[#:hidden #:eval class-ctc-eval
(require racket/class racket/contract)) (require racket/class racket/contract)]
@title[#:tag "mzlib:class" #:style 'toc]{Classes and Objects} @title[#:tag "mzlib:class" #:style 'toc]{Classes and Objects}
@ -196,8 +195,9 @@ is the most specific requirement from its superinterfaces. If the
superinterfaces specify inconsistent derivation requirements, the superinterfaces specify inconsistent derivation requirements, the
@exnraise[exn:fail:object]. @exnraise[exn:fail:object].
@defexamples[ @examples[
#:eval class-ctc-eval #:eval class-ctc-eval
#:no-prompt
(define file-interface<%> (define file-interface<%>
(interface () open close read-byte write-byte)) (interface () open close read-byte write-byte))
(define directory-interface<%> (define directory-interface<%>
@ -226,8 +226,9 @@ extended to produce the internal structure type for instances of the
class (so that no information about fields is accessible to the class (so that no information about fields is accessible to the
structure type property's guard, if any). structure type property's guard, if any).
@defexamples[ @examples[
#:eval class-eval #:eval class-eval
#:no-prompt
(define i<%> (interface* () ([prop:custom-write (define i<%> (interface* () ([prop:custom-write
(lambda (obj port mode) (void))]) (lambda (obj port mode) (void))])
method1 method2 method3)) method1 method2 method3))
@ -387,8 +388,9 @@ calling subclass augmentations of methods (see
Like @racket[class*], but omits the @racket[_interface-expr]s, for the case that none are needed. Like @racket[class*], but omits the @racket[_interface-expr]s, for the case that none are needed.
@defexamples[ @examples[
#:eval class-eval #:eval class-eval
#:no-prompt
(define book-class% (define book-class%
(class object% (class object%
(field (pages 5)) (field (pages 5))
@ -404,15 +406,16 @@ to the current object (i.e., the object being initialized or whose
method was called). Use outside the body of a @racket[class*] form is method was called). Use outside the body of a @racket[class*] form is
a syntax error. a syntax error.
@defexamples[ @examples[
#:eval class-eval #:eval class-eval
(define (describe obj) (eval:no-prompt
(define (describe obj)
(printf "Hello ~a\n" obj)) (printf "Hello ~a\n" obj))
(define table% (define table%
(class object% (class object%
(define/public (describe-self) (define/public (describe-self)
(describe this)) (describe this))
(super-new))) (super-new))))
(send (new table%) describe-self) (send (new table%) describe-self)
]} ]}
@ -423,21 +426,22 @@ of the current object (i.e., the object being initialized or whose
method was called). Use outside the body of a @racket[class*] form is method was called). Use outside the body of a @racket[class*] form is
a syntax error. a syntax error.
@defexamples[ @examples[
#:eval class-eval #:eval class-eval
(define account% (eval:no-prompt
(define account%
(class object% (class object%
(super-new) (super-new)
(init-field balance) (init-field balance)
(define/public (add n) (define/public (add n)
(new this% [balance (+ n balance)])))) (new this% [balance (+ n balance)]))))
(define savings% (define savings%
(class account% (class account%
(super-new) (super-new)
(inherit-field balance) (inherit-field balance)
(define interest 0.04) (define interest 0.04)
(define/public (add-interest) (define/public (add-interest)
(send this add (* interest balance))))) (send this add (* interest balance))))))
(let* ([acct (new savings% [balance 500])] (let* ([acct (new savings% [balance 500])]
[acct (send acct add 500)] [acct (send acct add 500)]
[acct (send acct add-interest)]) [acct (send acct add-interest)])
@ -447,7 +451,7 @@ a syntax error.
@defclassforms[ @defclassforms[
[(inspect inspector-expr) ()] [(inspect inspector-expr) ()]
[(init init-decl ...) ("clinitvars") [(init init-decl ...) ("clinitvars")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(class object% (class object%
(super-new) (super-new)
(init turnip (init turnip
@ -455,7 +459,7 @@ a syntax error.
[carrot 'good] [carrot 'good]
[(internal-rutabaga rutabaga) 'okay]))]] [(internal-rutabaga rutabaga) 'okay]))]]
[(init-field init-decl ...) ("clinitvars" "clfields") [(init-field init-decl ...) ("clinitvars" "clfields")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(class object% (class object%
(super-new) (super-new)
(init-field turkey (init-field turkey
@ -463,87 +467,97 @@ a syntax error.
[chicken 7] [chicken 7]
[(internal-emu emu) 13]))]] [(internal-emu emu) 13]))]]
[(field field-decl ...) ("clfields") [(field field-decl ...) ("clfields")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(class object% (class object%
(super-new) (super-new)
(field [minestrone 'ready] (field [minestrone 'ready]
[(internal-coq-au-vin coq-au-vin) 'stewing]))]] [(internal-coq-au-vin coq-au-vin) 'stewing]))]]
[(inherit-field maybe-renamed ...) ("clfields") [(inherit-field maybe-renamed ...) ("clfields")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define cookbook% (define cookbook%
(class object% (class object%
(super-new) (super-new)
(field [recipes '(caldo-verde oyakodon eggs-benedict)] (field [recipes '(caldo-verde oyakodon eggs-benedict)]
[pages 389]))) [pages 389]))))
(class cookbook% (class cookbook%
(super-new) (super-new)
(inherit-field recipes (inherit-field recipes
[internal-pages pages]))]] [internal-pages pages]))]]
[* ((init-rest id) (init-rest)) ("clinitvars") [* ((init-rest id) (init-rest)) ("clinitvars")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define fruit-basket% (define fruit-basket%
(class object% (class object%
(super-new) (super-new)
(init-rest fruits) (init-rest fruits)
(displayln fruits))) (displayln fruits))))
(make-object fruit-basket% 'kiwi 'lychee 'melon)]] (make-object fruit-basket% 'kiwi 'lychee 'melon)]]
[(public maybe-renamed ...) ("clmethoddefs") [(public maybe-renamed ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define jumper% (define jumper%
(class object% (class object%
(super-new) (super-new)
(define (skip) 'skip) (define (skip) 'skip)
(define (hop) 'hop) (define (hop) 'hop)
(public skip [hop jump]))) (public skip [hop jump]))))
(send (new jumper%) skip) (send (new jumper%) skip)
(send (new jumper%) jump)]] (send (new jumper%) jump)]]
[(pubment maybe-renamed ...) ("clmethoddefs") [(pubment maybe-renamed ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define runner% (define runner%
(class object% (class object%
(super-new) (super-new)
(define (run) 'run) (define (run) 'run)
(define (trot) 'trot) (define (trot) 'trot)
(pubment run [trot jog]))) (pubment run [trot jog]))))
(send (new runner%) run) (send (new runner%) run)
(send (new runner%) jog)]] (send (new runner%) jog)]]
[(public-final maybe-renamed ...) ("clmethoddefs") [(public-final maybe-renamed ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define point% (define point%
(class object% (class object%
(super-new) (super-new)
(init-field [x 0] [y 0]) (init-field [x 0] [y 0])
(define (get-x) x) (define (get-x) x)
(define (do-get-y) y) (define (do-get-y) y)
(public-final get-x [do-get-y get-y]))) (public-final get-x [do-get-y get-y]))))
(send (new point% [x 1] [y 3]) get-y) (send (new point% [x 1] [y 3]) get-y)
(eval:error
(class point% (class point%
(super-new) (super-new)
(define (get-x) 3.14) (define (get-x) 3.14)
(override get-x))]] (override get-x)))]]
[(override maybe-renamed ...) ("clmethoddefs") [(override maybe-renamed ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define sheep% (define sheep%
(class object% (class object%
(super-new) (super-new)
(define/public (bleat) (define/public (bleat)
(displayln "baaaaaaaaah")))) (displayln "baaaaaaaaah")))))
(eval:no-prompt
(define confused-sheep% (define confused-sheep%
(class sheep% (class sheep%
(super-new) (super-new)
(define (bleat) (define (bleat)
(super bleat) (super bleat)
(displayln "???")) (displayln "???"))
(override bleat))) (override bleat))))
(send (new sheep%) bleat) (send (new sheep%) bleat)
(send (new confused-sheep%) bleat)]] (send (new confused-sheep%) bleat)]]
[(overment maybe-renamed ...) ("clmethoddefs") [(overment maybe-renamed ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define turkey% (define turkey%
(class object% (class object%
(super-new) (super-new)
(define/public (gobble) (define/public (gobble)
(displayln "gobble gobble")))) (displayln "gobble gobble")))))
(eval:no-prompt
(define extra-turkey% (define extra-turkey%
(class turkey% (class turkey%
(super-new) (super-new)
@ -551,50 +565,56 @@ a syntax error.
(super gobble) (super gobble)
(displayln "gobble gobble gobble") (displayln "gobble gobble gobble")
(inner (void) gobble)) (inner (void) gobble))
(overment gobble))) (overment gobble))))
(eval:no-prompt
(define cyborg-turkey% (define cyborg-turkey%
(class extra-turkey% (class extra-turkey%
(super-new) (super-new)
(define/augment (gobble) (define/augment (gobble)
(displayln "110011111011111100010110001011011001100101")))) (displayln "110011111011111100010110001011011001100101")))))
(send (new extra-turkey%) gobble) (send (new extra-turkey%) gobble)
(send (new cyborg-turkey%) gobble)]] (send (new cyborg-turkey%) gobble)]]
[(override-final maybe-renamed ...) ("clmethoddefs") [(override-final maybe-renamed ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define meeper% (define meeper%
(class object% (class object%
(super-new) (super-new)
(define/public (meep) (define/public (meep)
(displayln "meep")))) (displayln "meep")))))
(eval:no-prompt
(define final-meeper% (define final-meeper%
(class meeper% (class meeper%
(super-new) (super-new)
(define (meep) (define (meep)
(super meep) (super meep)
(displayln "This meeping ends with me")) (displayln "This meeping ends with me"))
(override-final meep))) (override-final meep))))
(send (new meeper%) meep) (send (new meeper%) meep)
(send (new final-meeper%) meep)]] (send (new final-meeper%) meep)]]
[(augment maybe-renamed ...) ("clmethoddefs") [(augment maybe-renamed ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define buzzer% (define buzzer%
(class object% (class object%
(super-new) (super-new)
(define/pubment (buzz) (define/pubment (buzz)
(displayln "bzzzt") (displayln "bzzzt")
(inner (void) buzz)))) (inner (void) buzz)))))
(eval:no-prompt
(define loud-buzzer% (define loud-buzzer%
(class buzzer% (class buzzer%
(super-new) (super-new)
(define (buzz) (define (buzz)
(displayln "BZZZZZZZZZT")) (displayln "BZZZZZZZZZT"))
(augment buzz))) (augment buzz))))
(send (new buzzer%) buzz) (send (new buzzer%) buzz)
(send (new loud-buzzer%) buzz)]] (send (new loud-buzzer%) buzz)]]
[(augride maybe-renamed ...) ("clmethoddefs")] [(augride maybe-renamed ...) ("clmethoddefs")]
[(augment-final maybe-renamed ...) ("clmethoddefs")] [(augment-final maybe-renamed ...) ("clmethoddefs")]
[(private id ...) ("clmethoddefs") [(private id ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define light% (define light%
(class object% (class object%
(super-new) (super-new)
@ -602,42 +622,47 @@ a syntax error.
(define (toggle) (set! on? (not on?))) (define (toggle) (set! on? (not on?)))
(private toggle) (private toggle)
(define (flick) (toggle)) (define (flick) (toggle))
(public flick))) (public flick))))
(send (new light%) toggle) (eval:error (send (new light%) toggle))
(send (new light%) flick)]] (send (new light%) flick)]]
[(abstract id ...) ("clmethoddefs") [(abstract id ...) ("clmethoddefs")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define train% (define train%
(class object% (class object%
(super-new) (super-new)
(abstract get-speed) (abstract get-speed)
(init-field [position 0]) (init-field [position 0])
(define/public (move) (define/public (move)
(new this% [position (+ position (get-speed))])))) (new this% [position (+ position (get-speed))])))))
(eval:no-prompt
(define acela% (define acela%
(class train% (class train%
(super-new) (super-new)
(define/override (get-speed) 241))) (define/override (get-speed) 241))))
(eval:no-prompt
(define talgo-350% (define talgo-350%
(class train% (class train%
(super-new) (super-new)
(define/override (get-speed) 330))) (define/override (get-speed) 330))))
(new train%) (eval:error (new train%))
(send (new acela%) move)]] (send (new acela%) move)]]
[(inherit maybe-renamed ...) ("classinherit") [(inherit maybe-renamed ...) ("classinherit")
@defexamples[#:eval class-eval @examples[#:eval class-eval
(eval:no-prompt
(define alarm% (define alarm%
(class object% (class object%
(super-new) (super-new)
(define/public (alarm) (define/public (alarm)
(displayln "beeeeeeeep")))) (displayln "beeeeeeeep")))))
(eval:no-prompt
(define car-alarm% (define car-alarm%
(class alarm% (class alarm%
(super-new) (super-new)
(init-field proximity) (init-field proximity)
(inherit alarm) (inherit alarm)
(when (< proximity 10) (when (< proximity 10)
(alarm)))) (alarm)))))
(new car-alarm% [proximity 5])]] (new car-alarm% [proximity 5])]]
[(inherit/super maybe-renamed ...) ("classinherit")] [(inherit/super maybe-renamed ...) ("classinherit")]
[(inherit/inner maybe-renamed ...) ("classinherit")] [(inherit/inner maybe-renamed ...) ("classinherit")]
@ -1067,9 +1092,10 @@ hidden name (except as a top-level definition). The
@racket[interface->method-names] procedure does not expose hidden @racket[interface->method-names] procedure does not expose hidden
names. names.
@defexamples[ @examples[
#:eval class-eval #:eval class-eval
(define-values (r o) (eval:no-prompt
(define-values (r o)
(let () (let ()
(define-local-member-name m) (define-local-member-name m)
(define c% (class object% (define c% (class object%
@ -1078,10 +1104,10 @@ names.
(define o (new c%)) (define o (new c%))
(values (send o m) (values (send o m)
o))) o))))
r r
(send o m) (eval:error (send o m))
]} ]}
@ -1121,28 +1147,27 @@ Produces an integer hash code consistent with
@racket[member-name-key=?] comparisons, analogous to @racket[member-name-key=?] comparisons, analogous to
@racket[equal-hash-code].} @racket[equal-hash-code].}
@defexamples[ @examples[
#:eval class-eval #:eval class-eval
(define (make-c% key) (eval:no-prompt
(define (make-c% key)
(define-member-name m key) (define-member-name m key)
(class object% (class object%
(define/public (m) 10) (define/public (m) 10)
(super-new))) (super-new))))
(send (new (make-c% (member-name-key m))) m) (send (new (make-c% (member-name-key m))) m)
(send (new (make-c% (member-name-key p))) m) (eval:error (send (new (make-c% (member-name-key p))) m))
(send (new (make-c% (member-name-key p))) p) (send (new (make-c% (member-name-key p))) p)
]
@defs+int[ (eval:no-prompt
#:eval class-eval (define (fresh-c%)
[(define (fresh-c%)
(let ([key (generate-member-key)]) (let ([key (generate-member-key)])
(values (make-c% key) key))) (values (make-c% key) key)))
(define-values (fc% key) (fresh-c%))] (define-values (fc% key) (fresh-c%)))
(send (new fc%) m) (eval:error (send (new fc%) m))
(let () (let ()
(define-member-name p key) (define-member-name p key)
(send (new fc%) p)) (send (new fc%) p))
@ -1352,15 +1377,16 @@ the last method call, which is expected to be an object. Each
This is the functional analogue of @racket[send*]. This is the functional analogue of @racket[send*].
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define point% (eval:no-prompt
(define point%
(class object% (class object%
(super-new) (super-new)
(init-field [x 0] [y 0]) (init-field [x 0] [y 0])
(define/public (move-x dx) (define/public (move-x dx)
(new this% [x (+ x dx)])) (new this% [x (+ x dx)]))
(define/public (move-y dy) (define/public (move-y dy)
(new this% [y (+ y dy)])))) (new this% [y (+ y dy)])))))
(send+ (new point%) (send+ (new point%)
(move-x 5) (move-x 5)
@ -1802,8 +1828,8 @@ The external contracts are as follows:
If only the field name is present, this is equivalent to insisting only If only the field name is present, this is equivalent to insisting only
that the method is present in the class. that the method is present in the class.
@defexamples[#:eval @examples[#:eval class-eval
class-eval (eval:no-prompt
(define woody% (define woody%
(class object% (class object%
(define/public (draw who) (define/public (draw who)
@ -1812,11 +1838,11 @@ The external contracts are as follows:
(define/contract woody+c% (define/contract woody+c%
(class/c [draw (->m symbol? string?)]) (class/c [draw (->m symbol? string?)])
woody%) woody%))
(send (new woody%) draw #f) (send (new woody%) draw #f)
(send (new woody+c%) draw 'zurg) (send (new woody+c%) draw 'zurg)
(send (new woody+c%) draw #f)] (eval:error (send (new woody+c%) draw #f))]
} }
@item{An external field contract, tagged with @racket[field], describes the @item{An external field contract, tagged with @racket[field], describes the
behavior of the value contained in that field when accessed from outside behavior of the value contained in that field when accessed from outside
@ -1827,8 +1853,8 @@ The external contracts are as follows:
If only the field name is present, this is equivalent to using the If only the field name is present, this is equivalent to using the
contract @racket[any/c] (but it is checked more efficiently). contract @racket[any/c] (but it is checked more efficiently).
@defexamples[#:eval @examples[#:eval class-eval
class-eval (eval:no-prompt
(define woody/hat% (define woody/hat%
(class woody% (class woody%
(field [hat-location 'uninitialized]) (field [hat-location 'uninitialized])
@ -1840,15 +1866,16 @@ The external contracts are as follows:
[lose-hat (->m void?)] [lose-hat (->m void?)]
[find-hat (->m void?)] [find-hat (->m void?)]
(field [hat-location (or/c 'on-head 'lost)])) (field [hat-location (or/c 'on-head 'lost)]))
woody/hat%) woody/hat%))
(get-field hat-location (new woody/hat%)) (get-field hat-location (new woody/hat%))
(let ([woody (new woody/hat+c%)]) (let ([woody (new woody/hat+c%)])
(send woody lose-hat) (send woody lose-hat)
(get-field hat-location woody)) (get-field hat-location woody))
(get-field hat-location (new woody/hat+c%)) (eval:error (get-field hat-location (new woody/hat+c%)))
(eval:error
(let ([woody (new woody/hat+c%)]) (let ([woody (new woody/hat+c%)])
(set-field! hat-location woody 'under-the-dresser))] (set-field! hat-location woody 'under-the-dresser)))]
} }
@item{An initialization argument contract, tagged with @racket[init], @item{An initialization argument contract, tagged with @racket[init],
@ -1861,8 +1888,8 @@ The external contracts are as follows:
If only the initialization argument name is present, this is equivalent to using the If only the initialization argument name is present, this is equivalent to using the
contract @racket[any/c] (but it is checked more efficiently). contract @racket[any/c] (but it is checked more efficiently).
@defexamples[#:eval @examples[#:eval class-eval
class-eval (eval:no-prompt
(define woody/init-hat% (define woody/init-hat%
(class woody% (class woody%
(init init-hat-location) (init init-hat-location)
@ -1876,13 +1903,14 @@ The external contracts are as follows:
[find-hat (->m void?)] [find-hat (->m void?)]
(init [init-hat-location (or/c 'on-head 'lost)]) (init [init-hat-location (or/c 'on-head 'lost)])
(field [hat-location (or/c 'on-head 'lost)])) (field [hat-location (or/c 'on-head 'lost)]))
woody/init-hat%) woody/init-hat%))
(get-field hat-location (get-field hat-location
(new woody/init-hat+c% (new woody/init-hat+c%
[init-hat-location 'lost])) [init-hat-location 'lost]))
(eval:error
(get-field hat-location (get-field hat-location
(new woody/init-hat+c% (new woody/init-hat+c%
[init-hat-location 'slinkys-mouth]))] [init-hat-location 'slinkys-mouth])))]
} }
@item{The contracts listed in an @racket[init-field] section are @item{The contracts listed in an @racket[init-field] section are
@ -1906,18 +1934,19 @@ As with the external contracts, when a method or field name is specified
contracted class's method implementation is no longer the entry point contracted class's method implementation is no longer the entry point
for dynamic dispatch. for dynamic dispatch.
@defexamples[#:eval @examples[#:eval class-eval
class-eval
(new (class woody+c% (new (class woody+c%
(inherit draw) (inherit draw)
(super-new) (super-new)
(printf "woody sez: “~a”\n" (draw "evil dr porkchop")))) (printf "woody sez: “~a”\n" (draw "evil dr porkchop"))))
(eval:no-prompt
(define/contract woody+c-inherit% (define/contract woody+c-inherit%
(class/c (inherit [draw (->m symbol? string?)])) (class/c (inherit [draw (->m symbol? string?)]))
woody+c%) woody+c%))
(eval:error
(new (class woody+c-inherit% (new (class woody+c-inherit%
(inherit draw) (inherit draw)
(printf "woody sez: ~a\n" (draw "evil dr porkchop"))))] (printf "woody sez: ~a\n" (draw "evil dr porkchop")))))]
} }
@item{A method contract tagged with @racket[super] describes the behavior of @item{A method contract tagged with @racket[super] describes the behavior of
@ -1932,8 +1961,8 @@ As with the external contracts, when a method or field name is specified
contract the controls how the @racket[super] methods must contract the controls how the @racket[super] methods must
be invoked. be invoked.
@defexamples[#:eval @examples[#:eval class-eval
class-eval (eval:no-prompt
(define/contract woody2+c% (define/contract woody2+c%
(class/c (super [draw (->m symbol? string?)])) (class/c (super [draw (->m symbol? string?)]))
(class woody% (class woody%
@ -1943,7 +1972,7 @@ As with the external contracts, when a method or field name is specified
[(a b) (string-append (super draw a) [(a b) (string-append (super draw a)
" and " " and "
(super draw b))])) (super draw b))]))
(super-new))) (super-new))))
(send (new woody2+c%) draw 'evil-dr-porkchop 'zurg) (send (new woody2+c%) draw 'evil-dr-porkchop 'zurg)
(send (new woody2+c%) draw "evil dr porkchop" "zurg")] (send (new woody2+c%) draw "evil dr porkchop" "zurg")]
@ -1971,8 +2000,8 @@ As with the external contracts, when a method or field name is specified
add a contract to make sure that overriding @racket[draw] add a contract to make sure that overriding @racket[draw]
doesn't break @racket[draw2]. doesn't break @racket[draw2].
@defexamples[#:eval @examples[#:eval class-eval
class-eval (eval:no-prompt
(define/contract woody2+override/c% (define/contract woody2+override/c%
(class/c (override [draw (->m symbol? string?)])) (class/c (override [draw (->m symbol? string?)]))
(class woody+c% (class woody+c%
@ -1987,11 +2016,12 @@ As with the external contracts, when a method or field name is specified
(class woody2+override/c% (class woody2+override/c%
(define/override (draw x) (define/override (draw x)
'not-a-string) 'not-a-string)
(super-new))) (super-new))))
(eval:error
(send (new woody2+broken-draw) draw2 (send (new woody2+broken-draw) draw2
'evil-dr-porkchop 'evil-dr-porkchop
'zurg)] 'zurg))]
} }
@ -2390,7 +2420,7 @@ A @racket[print] request is directed to @racket[custom-write].}
Returns @racket[#t] if @racket[v] is an object, @racket[#f] otherwise. Returns @racket[#t] if @racket[v] is an object, @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(object? (new object%)) (object? (new object%))
(object? object%) (object? object%)
(object? "clam chowder") (object? "clam chowder")
@ -2401,7 +2431,7 @@ Returns @racket[#t] if @racket[v] is an object, @racket[#f] otherwise.
Returns @racket[#t] if @racket[v] is a class, @racket[#f] otherwise. Returns @racket[#t] if @racket[v] is a class, @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(class? object%) (class? object%)
(class? (class object% (super-new))) (class? (class object% (super-new)))
(class? (new object%)) (class? (new object%))
@ -2413,7 +2443,7 @@ Returns @racket[#t] if @racket[v] is a class, @racket[#f] otherwise.
Returns @racket[#t] if @racket[v] is an interface, @racket[#f] otherwise. Returns @racket[#t] if @racket[v] is an interface, @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(interface? (interface () empty cons first rest)) (interface? (interface () empty cons first rest))
(interface? object%) (interface? object%)
(interface? "gazpacho") (interface? "gazpacho")
@ -2424,7 +2454,7 @@ Returns @racket[#t] if @racket[v] is an interface, @racket[#f] otherwise.
Returns @racket[#t] if @racket[v] is a @tech{generic}, @racket[#f] otherwise. Returns @racket[#t] if @racket[v] is a @tech{generic}, @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define c% (define c%
(class object% (class object%
(super-new) (super-new)
@ -2448,7 +2478,7 @@ This procedure is similar in spirit to
@racket[eq?] but also works properly with contracts @racket[eq?] but also works properly with contracts
(and has a stronger guarantee). (and has a stronger guarantee).
@defexamples[#:eval class-ctc-eval @examples[#:eval class-ctc-eval
(define obj-1 (new object%)) (define obj-1 (new object%))
(define obj-2 (new object%)) (define obj-2 (new object%))
(define/contract obj-3 (object/c) obj-1) (define/contract obj-3 (object/c) obj-1)
@ -2468,7 +2498,7 @@ This procedure is similar in spirit to
Like @racket[object=?], but accepts @racket[#f] for either argument and Like @racket[object=?], but accepts @racket[#f] for either argument and
returns @racket[#t] if both arguments are @racket[#f]. returns @racket[#t] if both arguments are @racket[#f].
@defexamples[#:eval class-ctc-eval @examples[#:eval class-ctc-eval
(object-or-false=? #f (new object%)) (object-or-false=? #f (new object%))
(object-or-false=? (new object%) #f) (object-or-false=? (new object%) #f)
(object-or-false=? #f #f) (object-or-false=? #f #f)
@ -2482,7 +2512,7 @@ returns @racket[#t] if both arguments are @racket[#f].
Returns a vector representing @racket[object] that shows its Returns a vector representing @racket[object] that shows its
inspectable fields, analogous to @racket[struct->vector]. inspectable fields, analogous to @racket[struct->vector].
@defexamples[#:eval class-eval @examples[#:eval class-eval
(object->vector (new object%)) (object->vector (new object%))
(object->vector (new (class object% (object->vector (new (class object%
(super-new) (super-new)
@ -2494,7 +2524,7 @@ inspectable fields, analogous to @racket[struct->vector].
Returns the interface implicitly defined by @racket[class]. Returns the interface implicitly defined by @racket[class].
@defexamples[#:eval class-eval @examples[#:eval class-eval
(class->interface object%) (class->interface object%)
]} ]}
@ -2504,7 +2534,7 @@ Returns the interface implicitly defined by @racket[class].
Returns the interface implicitly defined by the class of Returns the interface implicitly defined by the class of
@racket[object]. @racket[object].
@defexamples[#:eval class-eval @examples[#:eval class-eval
(object-interface (new object%)) (object-interface (new object%))
]} ]}
@ -2515,7 +2545,7 @@ Returns @racket[#t] if @racket[v] is an instance of a class
@racket[type] or a class that implements an interface @racket[type], @racket[type] or a class that implements an interface @racket[type],
@racket[#f] otherwise. @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define point<%> (interface () get-x get-y)) (define point<%> (interface () get-x get-y))
(define 2d-point% (define 2d-point%
(class* object% (point<%>) (class* object% (point<%>)
@ -2536,7 +2566,7 @@ Returns @racket[#t] if @racket[v] is an instance of a class
Returns @racket[#t] if @racket[v] is a class derived from (or equal Returns @racket[#t] if @racket[v] is a class derived from (or equal
to) @racket[cls], @racket[#f] otherwise. to) @racket[cls], @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(subclass? (class object% (super-new)) object%) (subclass? (class object% (super-new)) object%)
(subclass? object% (class object% (super-new))) (subclass? object% (class object% (super-new)))
(subclass? object% object%) (subclass? object% object%)
@ -2548,7 +2578,7 @@ to) @racket[cls], @racket[#f] otherwise.
Returns @racket[#t] if @racket[v] is a class that implements Returns @racket[#t] if @racket[v] is a class that implements
@racket[intf], @racket[#f] otherwise. @racket[intf], @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define i<%> (interface () go)) (define i<%> (interface () go))
(define c% (define c%
(class* object% (i<%>) (class* object% (i<%>)
@ -2565,7 +2595,7 @@ Returns @racket[#t] if @racket[v] is a class that implements
Returns @racket[#t] if @racket[v] is an interface that extends Returns @racket[#t] if @racket[v] is an interface that extends
@racket[intf], @racket[#f] otherwise. @racket[intf], @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define point<%> (interface () get-x get-y)) (define point<%> (interface () get-x get-y))
(define colored-point<%> (interface (point<%>) color)) (define colored-point<%> (interface (point<%>) color))
@ -2581,7 +2611,7 @@ Returns @racket[#t] if @racket[intf] (or any of its ancestor
interfaces) includes a member with the name @racket[sym], @racket[#f] interfaces) includes a member with the name @racket[sym], @racket[#f]
otherwise. otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define i<%> (interface () get-x get-y)) (define i<%> (interface () get-x get-y))
(method-in-interface? 'get-x i<%>) (method-in-interface? 'get-x i<%>)
(method-in-interface? 'get-z i<%>) (method-in-interface? 'get-z i<%>)
@ -2595,7 +2625,7 @@ including methods inherited from superinterfaces, but not including
methods whose names are local (i.e., declared with methods whose names are local (i.e., declared with
@racket[define-local-member-name]). @racket[define-local-member-name]).
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define i<%> (interface () get-x get-y)) (define i<%> (interface () get-x get-y))
(interface->method-names i<%>) (interface->method-names i<%>)
]} ]}
@ -2607,7 +2637,7 @@ methods whose names are local (i.e., declared with
Returns @racket[#t] if @racket[object] has a method named @racket[sym] Returns @racket[#t] if @racket[object] has a method named @racket[sym]
that accepts @racket[cnt] arguments, @racket[#f] otherwise. that accepts @racket[cnt] arguments, @racket[#f] otherwise.
@defexamples[#:eval class-eval @examples[#:eval class-eval
(define c% (define c%
(class object% (class object%
(super-new) (super-new)
@ -2628,7 +2658,7 @@ Returns a list of all of the names of the fields bound in
not including fields whose names are local (i.e., declared with not including fields whose names are local (i.e., declared with
@racket[define-local-member-name]). @racket[define-local-member-name]).
@defexamples[#:eval class-eval @examples[#:eval class-eval
(field-names (new object%)) (field-names (new object%))
(field-names (new (class object% (super-new) (field [x 0] [y 0])))) (field-names (new (class object% (super-new) (field [x 0] [y 0]))))
]} ]}
@ -2701,6 +2731,47 @@ a method that is not supplied by an object.
} }
@defproc[(class-seal [class class?]
[key symbol?]
[unsealed-inits (listof symbol?)]
[unsealed-fields (listof symbol?)]
[unsealed-methods (listof symbol?)]
[inst-proc (-> class? any)]
[member-proc (-> class? (listof symbol?) any)])
class?]{
Adds a seal to a given class keyed with the symbol @racket[key]. The
given @racket[unsealed-inits], @racket[unsealed-fields], and
@racket[unsealed-methods] list corresponding class members that are
unaffected by sealing.
When a class has any seals, the @racket[inst-proc] procedure is called
on instantiation (normally, this is used to raise an error on
instantiation) and the @racket[member-proc] function is called
(again, this is normally used to raise an error) when a subclass
attempts to add class members that are not listed in the unsealed lists.
The @racket[inst-proc] is called with the class value on which an
instantiation was attempted. The @racket[member-proc] is called with
the class value and the list of initialization argument, field, or
method names.
}
@defproc[(class-unseal [class class?]
[key symbol?]
[wrong-key-proc (-> class? any)])
class?]{
Removes a seal on a class that has been previously sealed with the
@racket[class-seal] function and the given @racket[key].
If the unseal removed all of the seals in the class, the class
value can be instantiated or subclassed freely. If the given
class value does not contain or any seals or does not contain
any seals with the given key, the @racket[wrong-key-proc] function
is called with the class value.
}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------
@include-section["surrogate.scrbl"] @include-section["surrogate.scrbl"]

View File

@ -1,5 +1,7 @@
#lang scribble/doc #lang scribble/doc
@(require "mz.rkt" (for-label racket/cmdline)) @(require "mz.rkt"
(for-label racket/cmdline)
(only-in scribble/core element))
@title{Command-Line Parsing} @title{Command-Line Parsing}
@ -104,7 +106,7 @@ A normal flag specification has four parts:
@racketvalfont{"-}@racketvarfont{x}@racketvalfont{"} or @racketvalfont{"-}@racketvarfont{x}@racketvalfont{"} or
@racketvalfont{"+}@racketvarfont{x}@racketvalfont{"} for some @racketvalfont{"+}@racketvarfont{x}@racketvalfont{"} for some
character @racketvarfont{x}, or character @racketvarfont{x}, or
@racketvalfont{"--}@racketvarfont{x}@racketvalfont{"} or @racketvalfont[@element[#f]{"--}]@racketvarfont{x}@racketvalfont{"} or
@racketvalfont{"++}@racketvarfont{x}@racketvalfont{"} for some @racketvalfont{"++}@racketvarfont{x}@racketvalfont{"} for some
sequence of characters @racketvarfont{x}. An @racketvarfont{x} cannot sequence of characters @racketvarfont{x}. An @racketvarfont{x} cannot
contain only digits or digits plus a single decimal point, since contain only digits or digits plus a single decimal point, since

View File

@ -1,6 +1,7 @@
#lang scribble/doc #lang scribble/doc
@(require "mz.rkt" @(require "mz.rkt"
(for-label setup/dirs)) (for-label setup/dirs
setup/collection-search))
@title[#:tag "collects"]{Libraries and Collections} @title[#:tag "collects"]{Libraries and Collections}
@ -264,6 +265,9 @@ collection specified by the @racket[collection]s, where the second
search uses the values of @racket[current-library-collection-links] search uses the values of @racket[current-library-collection-links]
and @racket[current-library-collection-paths]. and @racket[current-library-collection-paths].
@margin-note{See also @racket[collection-search] in
@racketmodname[setup/collection-search].}
If @racket[file] is not found, but @racket[file] ends in If @racket[file] is not found, but @racket[file] ends in
@filepath{.rkt} and a file with the suffix @filepath{.ss} exists, then @filepath{.rkt} and a file with the suffix @filepath{.ss} exists, then
the directory of the @filepath{.ss} file is used. If @racket[file] is the directory of the @filepath{.ss} file is used. If @racket[file] is

File diff suppressed because it is too large Load Diff

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