adjust drracket so that, during check syntax, there is less sharing between drracket and the user program. specifically, the gui libs are not shared
This commit is contained in:
parent
ae37e186e7
commit
920800531c
|
@ -27,12 +27,14 @@
|
|||
|
||||
(define (traverse-program/multiple language-settings
|
||||
init
|
||||
kill-termination)
|
||||
kill-termination
|
||||
#:gui-modules? [gui-modules? #t])
|
||||
(let-values ([(eventspace custodian)
|
||||
(build-user-eventspace/custodian
|
||||
language-settings
|
||||
init
|
||||
kill-termination)])
|
||||
kill-termination
|
||||
#:gui-modules? gui-modules?)])
|
||||
(let ([language (drracket:language-configuration:language-settings-language
|
||||
language-settings)]
|
||||
[settings (drracket:language-configuration:language-settings-settings
|
||||
|
@ -75,8 +77,9 @@
|
|||
(define (expand-program/multiple language-settings
|
||||
eval-compile-time-part?
|
||||
init
|
||||
kill-termination)
|
||||
(let ([res (traverse-program/multiple language-settings init kill-termination)])
|
||||
kill-termination
|
||||
#:gui-modules? [gui-modules? #t])
|
||||
(let ([res (traverse-program/multiple language-settings init kill-termination #:gui-modules? gui-modules?)])
|
||||
(λ (input iter complete-program?)
|
||||
(let ([expanding-iter
|
||||
(λ (rd cont)
|
||||
|
@ -94,18 +97,20 @@
|
|||
eval-compile-time-part?
|
||||
init
|
||||
kill-termination
|
||||
iter)
|
||||
iter
|
||||
#:gui-modules? [gui-modules? #t])
|
||||
((expand-program/multiple
|
||||
language-settings
|
||||
eval-compile-time-part?
|
||||
init
|
||||
kill-termination)
|
||||
kill-termination
|
||||
#:gui-modules? gui-modules?)
|
||||
input
|
||||
iter
|
||||
#t))
|
||||
|
||||
|
||||
(define (build-user-eventspace/custodian language-settings init kill-termination)
|
||||
(define (build-user-eventspace/custodian language-settings init kill-termination #:gui-modules? [gui-modules? #t])
|
||||
(let* ([user-custodian (make-custodian)]
|
||||
[eventspace (parameterize ([current-custodian user-custodian])
|
||||
(make-eventspace))]
|
||||
|
@ -134,7 +139,7 @@
|
|||
(run-in-eventspace
|
||||
(λ ()
|
||||
(current-custodian user-custodian)
|
||||
(set-basic-parameters drs-snip-classes)
|
||||
(set-basic-parameters drs-snip-classes #:gui-modules? gui-modules?)
|
||||
(drracket:rep:current-language-settings language-settings)))
|
||||
(send language on-execute settings run-in-eventspace)
|
||||
(run-in-eventspace
|
||||
|
@ -160,7 +165,7 @@
|
|||
;; set-basic-parameters : (listof (is-a/c? snipclass%)) -> void
|
||||
;; sets the parameters that are shared between the repl's initialization
|
||||
;; and expand-program
|
||||
(define (set-basic-parameters snip-classes)
|
||||
(define (set-basic-parameters snip-classes #:gui-modules? [gui-modules? #t])
|
||||
(for-each (λ (snip-class) (send (get-the-snip-class-list) add snip-class))
|
||||
snip-classes)
|
||||
|
||||
|
@ -175,29 +180,36 @@
|
|||
|
||||
(current-namespace (make-empty-namespace))
|
||||
(for-each (λ (x) (namespace-attach-module drracket:init:system-namespace x))
|
||||
to-be-copied-module-names))
|
||||
to-be-copied-module-names)
|
||||
(when gui-modules?
|
||||
(for-each (λ (x) (namespace-attach-module drracket:init:system-namespace x))
|
||||
to-be-copied-gui-module-names)))
|
||||
|
||||
(define to-be-copied-gui-module-specs
|
||||
(list '(lib "mred/mred.rkt")
|
||||
'(lib "mrlib/cache-image-snip.rkt")
|
||||
'(lib "mrlib/image-core.rkt")
|
||||
'(lib "mrlib/matrix-snip.rkt")))
|
||||
|
||||
;; these module specs are copied over to each new user's namespace
|
||||
(define to-be-copied-module-specs
|
||||
(list 'mzscheme
|
||||
'(lib "mzlib/foreign.rkt")
|
||||
'(lib "mred/mred.rkt")
|
||||
'(lib "mrlib/cache-image-snip.rkt")
|
||||
'(lib "mrlib/image-core.rkt")
|
||||
'(lib "mrlib/matrix-snip.rkt")
|
||||
(list 'racket/base
|
||||
''#%foreign
|
||||
'(lib "mzlib/pconvert-prop.rkt")
|
||||
'(lib "planet/terse-info.rkt")))
|
||||
|
||||
;; ensure that they are all here.
|
||||
(for-each (λ (x) (dynamic-require x #f)) to-be-copied-module-specs)
|
||||
(for-each (λ (x) (dynamic-require x #f)) to-be-copied-gui-module-specs)
|
||||
;; get the names of those modules.
|
||||
(define to-be-copied-module-names
|
||||
(define-values (to-be-copied-module-names to-be-copied-gui-module-names)
|
||||
(let ([get-name
|
||||
(λ (spec)
|
||||
(if (symbol? spec)
|
||||
spec
|
||||
((current-module-name-resolver) spec #f #f)))])
|
||||
(map get-name to-be-copied-module-specs)))
|
||||
(values (map get-name to-be-copied-module-specs)
|
||||
(map get-name to-be-copied-gui-module-specs))))
|
||||
|
||||
;; build-input-port : string[file-exists?] -> (values input any)
|
||||
;; constructs an input port for the load handler. Also
|
||||
|
|
|
@ -1331,6 +1331,7 @@ If the namespace does not, they are colored the unbound color.
|
|||
(send (send the-tab get-defs) syncheck:init-arrows)
|
||||
|
||||
(drracket:eval:expand-program
|
||||
#:gui-modules? #f
|
||||
(drracket:language:make-text/pos definitions-text 0 (send definitions-text last-position))
|
||||
(send definitions-text get-next-settings)
|
||||
#t
|
||||
|
|
|
@ -31,7 +31,9 @@ all of the names in the tools library, for use defining keybindings
|
|||
|
||||
(require/doc (for-label errortrace/errortrace-key
|
||||
racket/pretty
|
||||
mzlib/pconvert))
|
||||
mzlib/pconvert
|
||||
syntax/toplevel
|
||||
))
|
||||
|
||||
(define-values/invoke-unit/infer drracket@)
|
||||
(provide-signature-elements drracket:tool-cm^) ;; provide all of the classes & interfaces
|
||||
|
@ -134,18 +136,30 @@ all of the names in the tools library, for use defining keybindings
|
|||
|
||||
(proc-doc/names
|
||||
drracket:eval:set-basic-parameters
|
||||
(-> (listof (is-a?/c snip-class%)) void?)
|
||||
(snipclasses)
|
||||
@{sets the parameters that are shared between the repl's
|
||||
initialization and @racket[drracket:eval:build-user-eventspace/custodian]
|
||||
(->* ((listof (is-a?/c snip-class%)))
|
||||
(#:gui-modules? boolean?)
|
||||
void?)
|
||||
((snipclasses)
|
||||
((gui-modules #t)))
|
||||
@{Sets the parameters that are shared between the repl's
|
||||
initialization and @racket[drracket:eval:build-user-eventspace/custodian].
|
||||
|
||||
Specifically, it sets these parameters:
|
||||
@itemize[
|
||||
@item{@racket[current-namespace] has been set to a newly
|
||||
created empty namespace. This namespace has the following modules
|
||||
copied (with @racket[namespace-attach-module])
|
||||
shared (with @racket[namespace-attach-module])
|
||||
from DrRacket's original namespace:
|
||||
@itemize[@item{@racket['mzscheme]}@item{@racket['mred]}]
|
||||
@itemize[@item{@racketmodname[racket/base]}
|
||||
@item{@racketmodname['#%foreign]}
|
||||
@item{@racketmodname[mzlib/pconvert-prop]}
|
||||
@item{@racketmodname[planet/terse-info]}]
|
||||
If the @racket[gui-modules?] parameter is a true value, then
|
||||
these modules are also shared:
|
||||
@itemize[@item{@racketmodname[mred/mred]}
|
||||
@item{@racketmodname[mrlib/cache-image-snip]}
|
||||
@item{@racketmodname[mrlib/image-core]}
|
||||
@item{@racketmodname[mrlib/matrix-snip]}]
|
||||
}
|
||||
@item{@racket[read-curly-brace-as-paren]
|
||||
is @racket[#t]; }
|
||||
|
@ -170,16 +184,18 @@ all of the names in the tools library, for use defining keybindings
|
|||
|
||||
(proc-doc/names
|
||||
drracket:eval:expand-program
|
||||
(-> (or/c port? drracket:language:text/pos?)
|
||||
drracket:language-configuration:language-settings?
|
||||
boolean?
|
||||
(-> void?)
|
||||
(-> void?)
|
||||
(-> (or/c eof-object? syntax? (cons/c string? any/c))
|
||||
(-> any)
|
||||
any)
|
||||
void?)
|
||||
(input language-settings eval-compile-time-part? init kill-termination iter)
|
||||
(->* ((or/c port? drracket:language:text/pos?)
|
||||
drracket:language-configuration:language-settings?
|
||||
boolean?
|
||||
(-> void?)
|
||||
(-> void?)
|
||||
(-> (or/c eof-object? syntax? (cons/c string? any/c))
|
||||
(-> any)
|
||||
any))
|
||||
(#:gui-modules? boolean?)
|
||||
void?)
|
||||
((input language-settings eval-compile-time-part? init kill-termination iter)
|
||||
((gui-modules? #t)))
|
||||
|
||||
@{Use this function to expand the contents of the definitions
|
||||
window for use with external program processing tools.
|
||||
|
@ -187,8 +203,8 @@ all of the names in the tools library, for use defining keybindings
|
|||
This function uses
|
||||
@racket[drracket:eval:build-user-eventspace/custodian]
|
||||
to build the user's environment.
|
||||
The arguments @racket[language-settings], @racket[init], and
|
||||
@racket[kill-termination] are passed to
|
||||
The arguments @racket[language-settings], @racket[init],
|
||||
@racket[kill-termination], and @racket[gui-modules?] are passed to
|
||||
@racket[drracket:eval:build-user-eventspace/custodian].
|
||||
|
||||
The @racket[input] argument specifies the source of the program.
|
||||
|
@ -234,19 +250,18 @@ all of the names in the tools library, for use defining keybindings
|
|||
|
||||
(proc-doc/names
|
||||
drracket:eval:traverse-program/multiple
|
||||
(drracket:language-configuration:language-settings?
|
||||
(-> void?)
|
||||
(-> void?)
|
||||
. -> .
|
||||
((or/c port? drracket:language:text/pos?)
|
||||
((or/c eof-object? syntax? (cons/c string? any/c))
|
||||
(-> any)
|
||||
. -> .
|
||||
any)
|
||||
boolean?
|
||||
. -> .
|
||||
void?))
|
||||
(language-settings init kill-termination)
|
||||
(->* (drracket:language-configuration:language-settings?
|
||||
(-> void?)
|
||||
(-> void?))
|
||||
(#:gui-modules? boolean?)
|
||||
(-> (or/c port? drracket:language:text/pos?)
|
||||
(-> (or/c eof-object? syntax? (cons/c string? any/c))
|
||||
(-> any)
|
||||
any)
|
||||
boolean?
|
||||
void?))
|
||||
((language-settings init kill-termination)
|
||||
((gui-modules #t)))
|
||||
|
||||
@{This function is similar to
|
||||
@racket[drracket:eval:expand-program/multiple]
|
||||
|
@ -257,17 +272,19 @@ all of the names in the tools library, for use defining keybindings
|
|||
|
||||
(proc-doc/names
|
||||
drracket:eval:expand-program/multiple
|
||||
(-> drracket:language-configuration:language-settings?
|
||||
boolean?
|
||||
(-> void?)
|
||||
(-> void?)
|
||||
(-> (or/c port? drracket:language:text/pos?)
|
||||
(-> (or/c eof-object? syntax? (cons/c string? any/c))
|
||||
(-> any)
|
||||
any)
|
||||
boolean?
|
||||
void?))
|
||||
(language-settings eval-compile-time-part? init kill-termination)
|
||||
(->* (drracket:language-configuration:language-settings?
|
||||
boolean?
|
||||
(-> void?)
|
||||
(-> void?))
|
||||
(#:gui-modules? boolean?)
|
||||
(-> (or/c port? drracket:language:text/pos?)
|
||||
(-> (or/c eof-object? syntax? (cons/c string? any/c))
|
||||
(-> any)
|
||||
any)
|
||||
boolean?
|
||||
void?))
|
||||
((language-settings eval-compile-time-part? init kill-termination)
|
||||
((gui-modules? #t)))
|
||||
|
||||
@{This function is just like
|
||||
@racket[drracket:eval:expand-program]
|
||||
|
@ -289,9 +306,10 @@ all of the names in the tools library, for use defining keybindings
|
|||
(->* (drracket:language-configuration:language-settings?
|
||||
(-> void?)
|
||||
(-> void?))
|
||||
()
|
||||
(#:gui-modules? boolean?)
|
||||
(values eventspace? custodian?))
|
||||
((language-settings init kill-termination) ())
|
||||
((language-settings init kill-termination)
|
||||
((gui-modules? #t)))
|
||||
|
||||
@{This function creates a custodian and an eventspace (on the
|
||||
new custodian) to expand the user's program. It does not
|
||||
|
@ -305,7 +323,8 @@ all of the names in the tools library, for use defining keybindings
|
|||
@item{ @racket[current-custodian] is set to a new custodian.
|
||||
}@item{
|
||||
In addition, it calls
|
||||
@racket[drracket:eval:set-basic-parameters].
|
||||
@racket[drracket:eval:set-basic-parameters],
|
||||
passing the @racket[#:gui-modules?] parameter along.
|
||||
}]
|
||||
|
||||
The @racket[language-settings] argument is the current
|
||||
|
|
Loading…
Reference in New Issue
Block a user