Commit Graph

37761 Commits

Author SHA1 Message Date
Matthew Flatt
bc69a9b05c Add replace-evt
As suggested by Jan Dvořák.

The event created by `replace-evt` is a kind of event-gated
version of `guard-evt`. In particular,

 (guard-evt thunk)

could be expressed as

 (replace-evt always-evt (lambda (_) (thunk)))

Use `replace-evt` as a shortcut for the case when you want to
synchronize on either A or C, but you need to wait for B to get C.
You could wait on A+B and then, if B is selected, wait on A+C;
wrapping B with `replace-evt` to generate C is a kind of shortcut that
is eaiser to write and avoids tear-down and re-setup of A.

The `replace-evt` constructor is more than a shortcut in the sense
that it builds the pattern A+B->A+C into `sync`, which enables
abstractions that need a B->C transition. So, `replace-evt` adds
expressiveness, but (perhap reassuringly) it does not add any new
rendezvous capability.

Naturally, the procedure given to `replace-evt` can produce
another `replace-evt`, and the event argument to
`replace-evt` could also be a `replace-evt`.
2014-07-15 15:22:11 +01:00
Robby Findler
9028e72813 make the code in the contract have a nicer name.
Thanks to Matthias
2014-07-15 08:57:11 -05:00
Robby Findler
6d2dfbff9e fix a bug uncovered by 1b3fd890ad
Merge to 6.1, please
2014-07-15 07:55:07 -05:00
Robby Findler
34b4472d97 spell check pict docs
Merge to 6.1, please
2014-07-15 06:05:17 -05:00
Robby Findler
ec0ccbe35e change 'jump to next misspelled word' shortcut to avoid
conflicting with the close window shortcut (which is only
<menukey>-shift-w when there are multiple tabs open)

Merge to 6.1, please
2014-07-15 06:05:16 -05:00
Robby Findler
1b3fd890ad adjust 'dc' so that the ascent and descent arguments are independently
optional and add a contract that calls the 'draw' argument to make
sure it restores the dc state.

The call to the 'draw' function happens right when 'dc' is called and
it tests the property that 'draw' doesn't abuse the state only that
one time and only with x=0 and y=0. This seems likely to catch common
errors, however, since the mismanagement of the state is unlikely to
be related to the values of 'x' and 'y' and also unlikely to depend on
the timing of the the call (i.e., if it happens at all, it probably
always happens).

Another way we could enforce this contract would be to wrap the `draw'
argument so that each time it is called, we grab the state of the dc
and compare it to afterwards.  The current strategy is less expensive
and also catches errors earlier (in the case of slidehow specifically,
we'll get the errors during the startup of the presentation instead of
when we try to render a slide (in the middle of the presentation,
typically)).

This change slows down calls to 'dc'. For example, this program:

 #lang racket/gui
(require pict)

(define brush (send the-brush-list find-or-create-brush "black" 'solid))
(define (circ w h)
  (dc (λ (dc dx dy)
        (define orig-pen (send dc get-pen))
        (define orig-brush (send dc get-brush))
        (send dc set-pen "black" 1 'transparent)
        (send dc set-brush brush)
        (send dc draw-ellipse dx dy w h)
        (send dc set-pen orig-pen)
        (send dc set-brush orig-brush))
      w h))

(void
 (time
  (for/fold ([b (blank)]) ([i (in-range 10000)])
    (vc-append (circ (random 1000)
                     (random 1000))
               b))))

goes from
  cpu time: 16 real time: 17 gc time: 0
to
  cpu time: 2166 real time: 2172 gc time: 224
on my machine.

Still, that cost, when measured in a per-call-to-dc way is
only .21 msecs, which seems reasonable given the pain of
tracking down the kinds of bugs that this contract
helps detect.
2014-07-15 06:04:31 -05:00
Matthew Flatt
add04001cd pkg/lib: fix pkg-directory->additional-installs
Merge to v6.1 (with a70b3173b2)
2014-07-15 10:39:53 +01:00
Matthew Flatt
a3af35754d prop:evt, prop:{input,output}-port and evt chaperones: fix up scheduling
Although it doesn't seem to be possible currently, avoid the case
that a property-based access or chaperone is called in a scheduler
context.
2014-07-15 09:12:14 +01:00
Matthew Flatt
fed14e1ce1 prop:evt: support chaperone when extracting field
Thanks to Sam for noticing this problem.
2014-07-15 08:50:13 +01:00
Matthew Flatt
a027e1445f chaperone-evt: don't drop other chaperones 2014-07-15 07:58:15 +01:00
Matthew Flatt
a70b3173b2 pkg/lib: make pkg-directory->additional-installs use 'compile-omit-paths
Otherwise, "test/pkgs" claims to provide various documents and executables
that are in test packages.

Merge to v6.1
2014-07-15 07:22:22 +01:00
Matthew Flatt
51a087c768 fix typo 2014-07-15 07:16:47 +01:00
Stephen Chang
3ef3c0b4cb use test submodule in lazy racket tests 2014-07-14 13:43:27 -04:00
Matthew Flatt
62dd8ea647 meta/pkg-push: allow separate src and dest catalog URLs
Also, report failures as errors, so that the result code is
helpful.
2014-07-14 16:47:53 +01:00
Matthew Flatt
2fcb65ec82 meta/pkg-build: fix break-enabled status in VM-running thread 2014-07-14 15:48:07 +01:00
Matthew Flatt
56c3dbf676 meta/pkg-build: add #:extra-packages option 2014-07-14 15:44:16 +01:00
Matthew Flatt
8d18d5eceb meta/pkg-build: change summary to include all docs
Include documentation that was part of the installer, because a package catalog
may want to show documentation links independent of whether the package
was included in a distribution.
2014-07-14 15:44:16 +01:00
J. Ian Johnson
e9ea94a3fe Fixing flawed test. The result arity does matter. 2014-07-14 10:38:05 -04:00
Asumu Takikawa
8a36919c66 Fix kw in typed/pict
Closes PR 14637
2014-07-14 10:28:39 -04:00
Robby Findler
1dda800ca2 add contract-correct caveat to contract violation error messages 2014-07-14 08:10:51 -05:00
Matthew Flatt
737330deb6 scribble: fix documentation for tt and racketfont
The `tt` and `racketfont` functions treat their arguments strangely,
applying styles only to immediate strings and symbols.

Add `racketplainfont`, which is a non-strange version of `racketfont`.
2014-07-14 11:36:26 +01:00
Matthew Flatt
69d64e2893 Scribble Latex/PDF: fix quote and backquote rendering
When text is literally a quote (ASCII 39) or backquote (ASCII 96),
then render it in a way that prevents LaTeX from converting to
curly variants.
2014-07-14 11:10:29 +01:00
Matthew Flatt
a087aea3e5 at-exp and scribble: adjust reader to compose better with readtable extensions
The `at-exp` reader now delays picking up the current readtable until
`read`/`read-syntax` is called. Also, it uses the new 'dynamic configuration
of readers for the command and datum parts of an @-form, which delays a
decision of readtable on each part until reading the part.

Thanks to Alexander Knauth for sorting out pieces of the puzzle.
2014-07-14 10:21:56 +01:00
Robby Findler
c7dd72ab4b Rackety 2014-07-13 22:31:22 -05:00
Robby Findler
8f0c0f5405 fix drracket's stacktrace handling in the case that something strange
shows up as the source field in an exception record
2014-07-13 22:31:11 -05:00
Matthew Flatt
e063b654fa xform: fix bad parsing of array sizes
A size expression N+M for a literal integer N was parsed as just N.
Report an error when that case happens (since it's difficult to
handle) instead of mishandling it.

Merge to v6.1
2014-07-13 18:42:45 +01:00
Matthew Flatt
c72f441d93 JIT: fix array-size expression that is handled badly by xform
This bug (in xform, really) appears to be responsible for recent "JIT
buffer overflow" crashes. It could also cause other memory-corruption
crashes.

The bug could be triggered by any program that uses operators like
`+`, `<`, and `bitwise-ior` on more than 2 and less than 6 operands
(which is a lot of programs), but only if a certain allocation and
GC pattern happens at just the right time (which is why a crash was
relatively rare).

Merge to v6.1
2014-07-13 18:41:11 +01:00
Robby Findler
031a0711cf use simple-form-path instead of normalize-path
in the code that decides what to put in DrRacket's pop up
menu that opens file dialogs for the subdirectories of
the place where the current file is saved

closes PR 14634
2014-07-13 08:46:54 -05:00
Robby Findler
dc6382cee9 add contract to cellophane 2014-07-13 08:45:38 -05:00
Robby Findler
3e5ba1b51a add contracts to the *-append pict functions 2014-07-13 08:45:38 -05:00
Sam Tobin-Hochstadt
0e93e633ab Remove defined-ness checks in insert-large-letters. 2014-07-12 10:46:18 -04:00
Sam Tobin-Hochstadt
d3167c1ce4 Initial implementation of struct-type contract generation.
Currently errors on all reflective access to struct types.
2014-07-12 10:37:47 -04:00
Matthew Flatt
689f449c8d ffi/unsafe/com: convert to date*, document limitations
Merge to v6.1 along with 7d65ee6127.
2014-07-12 08:17:47 +01:00
Kalimehtar
7d65ee6127 Fix _date to allow dates before 1970 year 2014-07-12 08:16:07 +01:00
Stephen Chang
8f9903ba58 in lazy: separate values tests; add more tests 2014-07-11 18:00:05 -04:00
Luke Whittlesey
8f5b5691a4 Fixed a bug in values within file lazy.rkt.
The issue was that when `values` was used with a single input, that input was being forced too early.
Now code such as:
(! (letrec-values ([(x) (values (list y))] [(y) (values 1)]) (car x))  )
should produce 1 instead of #<undefined>.

Some simple test cases were also added.
2014-07-11 15:18:48 -04:00
Matthew Flatt
75e201cc06 optimizer: fix tail-position bug in recent optimizer change
Fixes a problem with a7a912eeab.

The existing test suite caught this bug, but I somehow overlooked
the failure report.
2014-07-11 13:59:57 +01:00
Matthew Flatt
f57c1c8e2a fix GC-cooperation bug in vector->values
The `vector->values` function set up multiple return values
badly in the case that the given vector is chaperoned.
The problem could lead to NULL as results for `vector->values`.

Merge to v6.1
2014-07-11 13:31:17 +01:00
Matthew Flatt
94bd5369b5 avoid over-large buffer for tail calls
Applying to a large number of arguments once causes the run-time
system to maintain a too-large buffer for managing tail calls in
the future. Decay the buffer size as it is reallocated.
2014-07-11 07:43:02 +01:00
Matthew Flatt
8191f8b7ad net/http-client: adjust data-procedure/c contract
Promise more (a `void?` result) and requies less (`any` instead of `any/c`).

original commit: 4aa61744c6
2014-07-11 06:21:33 +01:00
Matthew Flatt
4aa61744c6 net/http-client: adjust data-procedure/c contract
Promise more (a `void?` result) and requies less (`any` instead of `any/c`).
2014-07-11 06:21:33 +01:00
Scott Bell
cb907d7eec Add documentation for data-procedure/c
(Style adjusted by Matthew.)

original commit: ddf0a334a8
2014-07-11 06:20:47 +01:00
Scott Bell
ddf0a334a8 Add documentation for data-procedure/c
(Style adjusted by Matthew.)
2014-07-11 06:20:47 +01:00
Matthew Flatt
a7a912eeab optimizer: generalize moving expressions to single-value context
Gemeralize Gustavo's change so that immediately-used right-hand sides
can be moved into any position that (like the binding context) enforces
single-valuedness --- for arbitrary right-hand expressions.
2014-07-11 06:02:14 +01:00
Gustavo Massaccesi
25c05d66b6 optimizer: allow to move once_used to test position 2014-07-11 06:02:14 +01:00
Gustavo Massaccesi
82ffd40592 optimizer: transform (if v x v) to (if v x #f) 2014-07-11 06:02:14 +01:00
Matthew Flatt
55c040cf3a raco setup -c => disable everything else 2014-07-11 06:02:13 +01:00
Matthew Flatt
8f20264a83 fix marshaling of #'(.... . ()) to bytecode 2014-07-11 06:02:13 +01:00
Matthew Flatt
a479f18c28 compiler/zo-structs: document undef-ok? in assign
Closes PR 14622

Merge to v6.1
2014-07-11 06:02:13 +01:00
Matthew Flatt
b3dd3954fb fix doc typo
Closes PR 14626

Merge to v6.1
2014-07-11 06:02:13 +01:00