diff --git a/collects/compiler/embed-unit.ss b/collects/compiler/embed-unit.ss index 7a69f6f612..ef2994703b 100644 --- a/collects/compiler/embed-unit.ss +++ b/collects/compiler/embed-unit.ss @@ -820,10 +820,18 @@ (get-lib-search-dirs)))] [(and (list? p) (eq? 'lib (car p))) - (build-path (if (null? (cddr p)) - (collection-path "mzlib") - (apply collection-path (cddr p))) - (cadr p))] + (let ([p (if (and (null? (cddr p)) + (regexp-match #rx"^[^/]*[.]" (cadr p))) + p + (let ([s (regexp-split #rx"/" (cadr p))]) + (if (null? (cdr s)) + `(lib ,(cadr p) "main.ss") + (let ([s (reverse s)]) + `(list ,(car s) ,@(reverse (cdr s)))))))]) + (build-path (if (null? (cddr p)) + (collection-path "mzlib") + (apply collection-path (cddr p))) + (cadr p)))] [else p])]) (and p (path->bytes diff --git a/collects/games/scribblings/chat-noir.scrbl b/collects/games/scribblings/chat-noir.scrbl index 15c4ce7e44..94f46d8a45 100644 --- a/collects/games/scribblings/chat-noir.scrbl +++ b/collects/games/scribblings/chat-noir.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "common.ss") -@(require scheme/runtime-path (for-syntax scheme/port scheme/base)) +@(require scheme/runtime-path (for-syntax scheme/port scheme/base scheme/path)) @(define-runtime-path cn "../chat-noir/chat-noir.ss") @gametitle["Chat Noir" "chat-noir" "Puzzle Game"] @@ -15,45 +15,42 @@ The game was inspired by this one the one at @link["http://www.gamedesign.jp/flash/chatnoir/chatnoir.html"]{Game Design} and has essentailly the same rules. -This game is written in the +This game is written in the @link["http://www.htdp.org/"]{How to Design Programs} Intermediate language. It is a model solution to the final project for the introductory programming course at the University of Chicago in the fall of 2008, as below. @(define-syntax (m stx) - (syntax-case stx () - [(_) - (call-with-input-file (build-path (current-load-relative-directory) - 'up - "chat-noir" - "chat-noir.ss") - (lambda (port) - (port-count-lines! port) - #`(schemeblock - #,@ - (let loop () - (let* ([p (peeking-input-port port)] - [l (read-line p)]) - (cond - [(eof-object? l) '()] - [(regexp-match #rx"^[ \t]*$" l) - (read-line port) - (loop)] - [(regexp-match #rx"^ *;+" l) - => - (lambda (m) - (let-values ([(line col pos) (port-next-location port)]) - (read-line port) - (let-values ([(line2 col2 pos2) (port-next-location port)]) - (cons (datum->syntax - #f - `(code:comment ,(regexp-replace* #rx" " l "\u00a0")) - (list "chat-noir.ss" line col pos (- pos2 pos))) - (loop)))))] - [else - (cons (read-syntax "chat-noir.ss" port) - (loop))]))))) - #:mode 'text)])) + (call-with-input-file + (build-path (path-only (syntax-source stx)) + 'up "chat-noir" "chat-noir.ss") + (lambda (port) + (port-count-lines! port) + #`(schemeblock + #,@ + (let loop () + (let* ([p (peeking-input-port port)] + [l (read-line p)]) + (cond + [(eof-object? l) '()] + [(regexp-match #rx"^[ \t]*$" l) + (read-line port) + (loop)] + [(regexp-match #rx"^ *;+" l) + => + (lambda (m) + (let-values ([(line col pos) (port-next-location port)]) + (read-line port) + (let-values ([(line2 col2 pos2) (port-next-location port)]) + (cons (datum->syntax + #f + `(code:comment ,(regexp-replace* #rx" " l "\u00a0")) + (list "chat-noir.ss" line col pos (- pos2 pos))) + (loop)))))] + [else + (cons (read-syntax "chat-noir.ss" port) + (loop))]))))) + #:mode 'text)) @m[] diff --git a/collects/handin-server/checker.ss b/collects/handin-server/checker.ss index f4f15f90e2..b51f4adfd0 100644 --- a/collects/handin-server/checker.ss +++ b/collects/handin-server/checker.ss @@ -488,6 +488,14 @@ submission->bytes) submission maxwidth textualize? untabify? markup-prefix prefix-re)))) + (define (uem-handler e) + (let ([m (if (exn? e) (exn-message e) (format "~a" e))]) + (cond + [(procedure? uem) (uem m)] + [(not (string? uem)) + (error* "badly configured user-error-message")] + [(regexp-match? #rx"~[aesvAESV]" uem) (error* uem m)] + [else (error* "~a" uem)]))) (when create-text? (make-directory "grading") (write-text)) (when value-printer (current-value-printer value-printer)) (when coverage? (sandbox-coverage-enabled #t)) @@ -495,24 +503,10 @@ (cond [(not eval?) (let () body ...)] [language - (let ([eval - (with-handlers - ([void - (lambda (e) - (let ([m (if (exn? e) - (exn-message e) - (format "~a" e))]) - (cond - [(procedure? uem) (uem m)] - [(not (string? uem)) - (error* "badly configured ~a" - "user-error-message")] - [(regexp-match? #rx"~[aesvAESV]" uem) - (error* uem m)] - [else (error* "~a" uem)])))]) - (call-with-evaluator/submission - language (append requires teachpacks) - submission values))]) + (let ([eval (with-handlers ([void uem-handler]) + (call-with-evaluator/submission + language (append requires teachpacks) + submission values))]) (set-run-status "running tests") (parameterize ([submission-eval (wrap-evaluator eval)]) (let-syntax ([with-submission-bindings diff --git a/collects/handin-server/scribblings/checker.scrbl b/collects/handin-server/scribblings/checker.scrbl index b455d22c29..2d28eff46b 100644 --- a/collects/handin-server/scribblings/checker.scrbl +++ b/collects/handin-server/scribblings/checker.scrbl @@ -65,13 +65,16 @@ Keywords for configuring @scheme[check:]: evaluating submissions, same as the @scheme[_language] argument for @scheme[make-evaluator] (see @schememodname[handin-server/sandbox]). There is no default for this, so it must be set or an error is - raised.} + raised. (See @scheme[call-with-evaluator/submission] for further + details.)} @item{@indexed-scheme[:requires]---paths for additional libraries to require for evaluating the submission, same as the @scheme[_requires] argument for @scheme[make-evaluator] (see @schememodname[handin-server/sandbox]). This defaults to null---no - teachpacks.} + teachpacks. Note: if a module language is used (See + @scheme[call-with-evaluator/submission] for further details), it is + passed as the @scheme[_allow-read] argument.} @item{@indexed-scheme[:teachpacks]---an alternative name for @scheme[:requires], kept for legacy checkers.} diff --git a/collects/handin-server/scribblings/utils.scrbl b/collects/handin-server/scribblings/utils.scrbl index ab1c357e75..f4114eae0b 100644 --- a/collects/handin-server/scribblings/utils.scrbl +++ b/collects/handin-server/scribblings/utils.scrbl @@ -21,6 +21,7 @@ @defproc[(make-evaluator/submission [language (or/c module-path? (list/c (one-of/c 'special) symbol?) + (list/c (one-of/c 'module) module-path?) (cons/c (one-of/c 'begin) list?))] [require-paths (listof path-string?)] [content bytes?]) @@ -28,11 +29,22 @@ Like @scheme[make-evaluator], but the definitions content is supplied as a submission byte string. The byte string is opened for - reading, with line-counting enabled.} + reading, with line-counting enabled. + + In addition to the language specification for + @scheme[make-evaluator], the @scheme[language] argument can be a + list that begins with @scheme['module]. In this case, + @scheme[make-module-language] is used to create an evaluator, and + the module code must be using the the specified language in its + language position. In this case, the @scheme[requires-paths] + argument is used only for paths that are allowed to be accessed (the + @scheme[_allow-read] argument to @scheme[make-evaluator], since the + submission is expected to be a complete submission.)} @defproc[(call-with-evaluator [language (or/c module-path? (list/c (one-of/c 'special) symbol?) + (list/c (one-of/c 'module) module-path?) (cons/c (one-of/c 'begin) list?))] [require-paths (listof path-string?)] [input-program any/c] @@ -46,12 +58,14 @@ suitable for @scheme[language], it initializes @scheme[set-run-status] with @scheme["executing your code"], and it catches all exceptions to re-raise them in a form suitable as a - submission error.} + submission error. See @scheme[make-evaluator/submission] for + further details.} -@defproc[(call-with-evaluator/submission [language - (or/c module-path? - (list/c (one-of/c 'special) symbol?) - (cons/c (one-of/c 'begin) list?))] +@defproc[(call-with-evaluator/submission + [language (or/c module-path? + (list/c (one-of/c 'special) symbol?) + (list/c (one-of/c 'module) module-path?) + (cons/c (one-of/c 'begin) list?))] [require-paths (listof path-string?)] [submission bytes?] [proc (any/c . -> . any)]) @@ -59,7 +73,8 @@ Like @scheme[call-with-evaluator], but the definitions content is supplied as a byte string. The byte string is opened for reading, - with line-counting enabled.} + with line-counting enabled. See @scheme[call-with-evaluator] and + @scheme[make-evaluator/submission] for further details.} @; JBC: this contract is probably wrong @; JBC: does this eval accept an optional namespace? diff --git a/collects/handin-server/utils.ss b/collects/handin-server/utils.ss index 9ecf89f42b..9929d59073 100644 --- a/collects/handin-server/utils.ss +++ b/collects/handin-server/utils.ss @@ -48,14 +48,18 @@ ;; Execution ---------------------------------------- +(define (make-evaluator* lang reqs inp) + (if (and (list? lang) (= 2 (length lang)) (eq? 'module (car lang))) + (make-module-evaluator inp #:language (cadr lang) #:allow-read reqs) + (make-evaluator lang inp #:requires reqs))) + (define (open-input-text-editor/lines str) (let ([inp (open-input-text-editor str)]) (port-count-lines! inp) inp)) (define (make-evaluator/submission language requires str) (let-values ([(defs interacts) (unpack-submission str)]) - (make-evaluator language #:requires requires - (open-input-text-editor defs)))) + (make-evaluator* language requires (open-input-text-editor defs)))) (define (evaluate-all source port eval) (let loop () @@ -164,11 +168,12 @@ (define (call-with-evaluator lang requires program-port go) (parameterize ([error-value->string-handler (lambda (v s) ((current-value-printer) v))] - [list-abbreviation-enabled (not (or (eq? lang 'beginner) - (eq? lang 'beginner-abbr)))]) + [list-abbreviation-enabled + (not (or (equal? lang '(special beginner)) + (equal? lang '(special beginner-abbr))))]) (reraise-exn-as-submission-problem (lambda () - (let ([e (make-evaluator lang #:requires requires program-port)]) + (let ([e (make-evaluator* lang requires program-port)]) (set-run-status "executing your code") (go e)))))) diff --git a/collects/repos-time-stamp/stamp.ss b/collects/repos-time-stamp/stamp.ss index de61f90848..d878f05a88 100644 --- a/collects/repos-time-stamp/stamp.ss +++ b/collects/repos-time-stamp/stamp.ss @@ -1 +1 @@ -#lang scheme/base (provide stamp) (define stamp "6oct2008") +#lang scheme/base (provide stamp) (define stamp "8oct2008") diff --git a/collects/scheme/sandbox.ss b/collects/scheme/sandbox.ss index c5a477940b..3cf6b807a1 100644 --- a/collects/scheme/sandbox.ss +++ b/collects/scheme/sandbox.ss @@ -57,11 +57,12 @@ #| no modules here by default |#))) (define (default-sandbox-reader source) - (let loop ([l '()]) - (let ([expr (read-syntax source)]) - (if (eof-object? expr) + (parameterize ([read-accept-reader #t]) + (let loop ([l '()]) + (let ([expr (read-syntax source)]) + (if (eof-object? expr) (reverse l) - (loop (cons expr l)))))) + (loop (cons expr l))))))) (define sandbox-reader (make-parameter default-sandbox-reader)) @@ -429,7 +430,7 @@ (define-evaluator-messenger get-error-output 'error-output) (define-evaluator-messenger (get-uncovered-expressions . xs) 'uncovered) -(define (make-evaluator* init-hook require-perms program-or-maker) +(define (make-evaluator* init-hook require-perms program-maker) (define cust (make-custodian)) (define coverage? (sandbox-coverage-enabled)) (define uncovered #f) @@ -457,7 +458,7 @@ ((sandbox-init-hook)) ;; now read and evaluate the input program (evaluate-program - (if (procedure? program-or-maker) (program-or-maker) program-or-maker) + (if (procedure? program-maker) (program-maker) program-maker) limits (and coverage? (lambda (es+get) (set! uncovered es+get)))) (channel-put result-ch 'ok)) @@ -625,17 +626,24 @@ allow) (lambda () (build-program lang reqs input-program))))) -(define (make-module-evaluator input-program #:allow-read [allow null]) +(define (make-module-evaluator + input-program #:allow-read [allow null] #:language [reqlang #f]) ;; this is for a complete module input program - (let ([prog (input->code (list input-program) 'program #f)]) - (unless (= 1 (length prog)) - (error 'make-evaluator "expecting a single `module' program; ~a" - (if (zero? (length prog)) - "no program expressions given" - "got more than a single expression"))) - (syntax-case* (car prog) (module) literal-identifier=? - [(module modname lang body ...) - (make-evaluator* void allow (car prog))] - [_else (error 'make-evaluator "expecting a `module' program; got ~e" - (syntax->datum (car prog)))]))) + (define (make-program) + (let ([prog (input->code (list input-program) 'program #f)]) + (unless (= 1 (length prog)) + (error 'make-evaluator "expecting a single `module' program; ~a" + (if (zero? (length prog)) + "no program expressions given" + "got more than a single expression"))) + (syntax-case* (car prog) (module) literal-identifier=? + [(module modname lang body ...) + (if (or (not reqlang) (equal? reqlang (syntax->datum #'lang))) + (car prog) + (error 'make-evaluator + "module code used `~e' for a language, expecting `~e'" + (syntax->datum #'lang) reqlang))] + [_else (error 'make-evaluator "expecting a `module' program; got ~e" + (syntax->datum (car prog)))]))) + (make-evaluator* void allow make-program)) diff --git a/collects/scribblings/inside/hooks.scrbl b/collects/scribblings/inside/hooks.scrbl index 0c8e6453bc..8e95433539 100644 --- a/collects/scribblings/inside/hooks.scrbl +++ b/collects/scribblings/inside/hooks.scrbl @@ -57,10 +57,19 @@ Sets the path to be returned by @scheme[(find-system-path 'collects-dir)].} -@function[(void scheme_init_collection_paths +@function[(void scheme_init_collection_paths_post [Scheme_Env* env] - [Scheme_Object* extra_paths])]{ + [Scheme_Object* pre_extra_paths] + [Scheme_Object* post_extra_paths])]{ Initializes the @scheme[current-library-collection-paths] parameter -using @scheme[find-library-collection-paths]. The @var{extra_paths} -argument is propagated to @scheme[find-library-collection-paths].} +using @scheme[find-library-collection-paths]. The +@var{pre_extra_paths} and @var{post_extra-paths} arguments are +propagated to @scheme[find-library-collection-paths].} + +@function[(void scheme_init_collection_paths + [Scheme_Env* env] + [Scheme_Object* pre_extra_paths])]{ + +Like @cpp{scheme_init_collection_paths_post}, but with @scheme[null] +as the last argument.} diff --git a/collects/scribblings/inside/memory.scrbl b/collects/scribblings/inside/memory.scrbl index b9309f4264..6e67cf4105 100644 --- a/collects/scribblings/inside/memory.scrbl +++ b/collects/scribblings/inside/memory.scrbl @@ -674,6 +674,17 @@ using @cpp{scheme_free_immobile_box}.} Frees an immobile box allocated with @cpp{scheme_malloc_immobile_box}.} +@function[(void* scheme_malloc_code [long size])]{ + +Allocates non-collectable memory to hold executable machine code. Use +this function instead of @cpp{malloc} to ensure that the allocated +memory has ``execute'' permissions. Use @cpp{scheme_free_code} to free +memory allocated by this function.} + +@function[(void scheme_free_code [void* p])]{ + +Frees memory allocated with @cpp{scheme_malloc_code}.} + @function[(void scheme_register_extension_global [void* ptr] [long size])]{ diff --git a/collects/scribblings/reference/collects.scrbl b/collects/scribblings/reference/collects.scrbl index 12425b23b1..7b96a18cad 100644 --- a/collects/scribblings/reference/collects.scrbl +++ b/collects/scribblings/reference/collects.scrbl @@ -63,7 +63,8 @@ is initialized in @exec{mzscheme} to the result of @scheme[(find-library-collection-paths)]. -@defproc[(find-library-collection-paths [extras (listof path-string?) null]) +@defproc[(find-library-collection-paths [pre-extras (listof path-string?) null] + [post-extras (listof path-string?) null]) (listof path?)]{ Produces a list of paths as follows: @@ -75,14 +76,19 @@ Produces a list of paths as follows: default collection path list, unless the value of the @scheme[use-user-specific-search-paths] parameter is @scheme[#f].} - @item{Extra directories provided in @scheme[extras] are included next, - converted to complete paths relative to the executable.} + @item{Extra directories provided in @scheme[pre-extras] are included + next to the default collection path list, converted to complete + paths relative to the executable.} @item{If the directory specified by @scheme[(find-system-path 'collects-dir)] is absolute, or if it is relative (to the executable) and it exists, then it is added to the end of the default collection path list.} + @item{Extra directories provided in @scheme[post-extras] are included + last in the default collection path list, converted to complete + paths relative to the executable.} + @item{If the @indexed-envvar{PLTCOLLECTS} environment variable is defined, it is combined with the default list using @scheme[path-list-string->path-list]. If it is not defined, the diff --git a/collects/scribblings/reference/sandbox.scrbl b/collects/scribblings/reference/sandbox.scrbl index 988934ede1..0bbae96332 100644 --- a/collects/scribblings/reference/sandbox.scrbl +++ b/collects/scribblings/reference/sandbox.scrbl @@ -26,6 +26,7 @@ filesystem access, and network access. [#:allow-read allow (listof (or/c module-path? path?))]) (any/c . -> . any)] [(make-module-evaluator [module-decl (or/c syntax? pair?)] + [#:language lang (or/c false/c module-path?)] [#:allow-read allow (listof (or/c module-path? path?))]) (any/c . -> . any)])]{ @@ -47,7 +48,7 @@ included in the @scheme[allow] list. Each @scheme[input-program] or @scheme[module-decl] argument provides a program in one of the following forms: -@itemize{ +@itemize[ @item{an input port used to read the program;} @@ -58,8 +59,7 @@ a program in one of the following forms: @item{an S-expression or a @tech{syntax object}, which is evaluated as with @scheme[eval] (see also @scheme[get-uncovered-expressions]).} - -} +] In the first three cases above, the program is read using @scheme[sandbox-reader], with line-counting enabled for sensible error @@ -82,7 +82,7 @@ effectively concatenated to form a single program. The way that the @scheme[input-program]s are evaluated depends on the @scheme[language] argument: -@itemize{ +@itemize[ @item{The @scheme[language] argument can be a module path (i.e., a datum that matches the grammar for @scheme[_module-path] of @@ -122,7 +122,7 @@ argument: In the new namespace, @scheme[language] is evaluated as an expression to further initialize the namespace.} -} +] The @scheme[requires] list adds additional imports to the module or namespace for the @scheme[input-program]s, even in the case that @@ -152,7 +152,11 @@ top-level namespace: The @scheme[make-module-evaluator] function is essentially a restriction of @scheme[make-evaluator], where the program must be a -module, and all imports are part of the program: +module, and all imports are part of the program. In some cases it is +useful to restrict the program to be a module using a spcific module +in its language position --- use the optional @scheme[lang] argument +to specify such a restriction (the default, @scheme[#f], means no +restriction is enforced). @schemeblock[ (define base-module-eval2 @@ -165,7 +169,7 @@ module, and all imports are part of the program: In all cases, the evaluator operates in an isolated and limited environment: -@itemize{ +@itemize[ @item{It uses a new custodian and namespace. When @scheme[gui?] is true, it is also runs in its own eventspace.} @@ -175,7 +179,7 @@ environment: @item{Each evaluation is wrapped in a @scheme[call-with-limits]; see also @scheme[sandbox-eval-limits] and @scheme[set-eval-limits].} -} +] Evaluation can also be instrumented to track coverage information when @scheme[sandbox-coverage-enabled] is set. Exceptions (both syntax and @@ -262,8 +266,8 @@ receives @scheme[eof].} @defparam[sandbox-input in (or/c false/c - string? bytes? - input-port? + string? bytes? + input-port? (one-of/c 'pipe) (-> input-port?))]{ @@ -271,7 +275,7 @@ A parameter that determines the initial @scheme[current-input-port] setting for a newly created evaluator. It defaults to @scheme[#f], which creates an empty port. The following other values are allowed: -@itemize{ +@itemize[ @item{a string or byte string, which is converted to a port using @scheme[open-input-string] or @scheme[open-input-bytes];} @@ -286,7 +290,7 @@ which creates an empty port. The following other values are allowed: @scheme[current-input-port] means that the evaluator input is the same as the calling context's input).} -}} +]} @defparam[sandbox-output in (or/c false/c @@ -299,7 +303,7 @@ setting for a newly created evaluator. It defaults to @scheme[#f], which creates a port that discrds all data. The following other values are allowed: -@itemize{ +@itemize[ @item{an output port, which is used as-is;} @@ -318,7 +322,7 @@ values are allowed: @scheme[current-output-port] means that the evaluator output is not diverted).} -}} +]} @defparam[sandbox-error-output in (or/c false/c @@ -539,7 +543,7 @@ Returns the output or error-output of the @scheme[evaluator], in a way that depends on the setting of @scheme[(sandbox-output)] or @scheme[(sandbox-error-output)] when the evaluator was created: -@itemize{ +@itemize[ @item{if it was @scheme['pipe], then @scheme[get-output] returns the input port end of the created pipe;} @@ -550,7 +554,7 @@ in a way that depends on the setting of @scheme[(sandbox-output)] or piece of the evaluator's output);} @item{otherwise, it returns @scheme[#f].} -}} +]} @defproc[(get-uncovered-expressions [evaluator (any/c . -> . any)] diff --git a/collects/scribblings/reference/startup.scrbl b/collects/scribblings/reference/startup.scrbl index a7cd4531bd..92b19589f9 100644 --- a/collects/scribblings/reference/startup.scrbl +++ b/collects/scribblings/reference/startup.scrbl @@ -49,11 +49,11 @@ the implemetation of @schememodname[scheme/base], and The first action of MzScheme or MrEd is to initialize @scheme[current-library-collection-paths] to the result of -@scheme[(find-library-collection-paths _extras)], where -@scheme[_extras] are extra directory paths provided in order in the -command line with @Flag{S}/@DFlag{search}. An executable created from -the MzScheme or MrEd executable can embed additional paths that are -appended to @scheme[_extras]. +@scheme[(find-library-collection-paths _pre-extras _extras)], where +@scheme[_pre-extras] is normally @scheme[null] and @scheme[_extras] +are extra directory paths provided in order in the command line with +@Flag{S}/@DFlag{search}. An executable created from the MzScheme or +MrEd executable can embed paths used as @scheme[_pre-extras]. MzScheme and MrEd next @scheme[require] @schememodname[scheme/init] and @schememodname[scheme/gui/init], respectively, but only if the @@ -62,7 +62,7 @@ command line does not specify a @scheme[require] flag @Flag{u}/@DFlag{require-script}) before any @scheme[eval], @scheme[load], or read-eval-print-loop flag (@Flag{e}/@DFlag{eval}, @Flag{f}/@DFlag{load}, @Flag{r}/@DFlag{script}, @Flag{m}/@DFlag{main}, -@Flag{i}/@DFlag{repl}, or @Flag{z}/@DFlag{text-repl}). The +or @Flag{i}/@DFlag{repl}). The initialization library can be changed with the @Flag{I} @tech{configuration option}. @@ -78,7 +78,7 @@ evaluation if no command line flags are provided other than @tech{configuration options}. If any command-line argument is provided that is not a @tech{configuration option}, then the read-eval-print-loop is not started, unless the @Flag{i}/@DFlag{repl} -or @Flag{z}/@DFlag{text-repl} flag is provided on the command line to +flag is provided on the command line to specifically re-enable it. In addition, just before the command line is started, MzScheme loads the file @scheme[(find-system-path 'init-file)] and MrEd loads the file @@ -184,12 +184,9 @@ flags: loop, using either @scheme[read-eval-print-loop] (MzScheme) or @scheme[graphical-read-eval-print-loop] (MrEd) after showing @scheme[(banner)] and loading @scheme[(find-system-path - 'init-file)].} - - @item{@FlagFirst{z} or @DFlagFirst{text-repl} : MrEd only; like - @Flag{i}/@DFlag{repl}, but uses - @scheme[textual-read-eval-print-loop] instead of - @scheme[graphical-read-eval-print-loop].} + 'init-file)]. For MrEd, supply the @Flag{z}/@DFlag{text-repl} + configuration option to use @scheme[read-eval-print-loop] + instead of @scheme[graphical-read-eval-print-loop].} @item{@FlagFirst{n} or @DFlagFirst{no-lib} : Skips requiring the initialization library (i.e., @schememodname[scheme/init] or @@ -219,7 +216,12 @@ flags: @item{@FlagFirst{q} or @DFlagFirst{no-init-file} : Skips loading @scheme[(find-system-path 'init-file)] for - @Flag{i}/@DFlag{repl} or @Flag{z}/@DFlag{text-repl}.} + @Flag{i}/@DFlag{repl}.} + + @item{@FlagFirst{z} or @DFlagFirst{text-repl} : MrEd only; changes + @Flag{i}/@DFlag{repl} to use + @scheme[textual-read-eval-print-loop] instead of + @scheme[graphical-read-eval-print-loop].} @item{@FlagFirst{I} @nonterm{path} : Sets @scheme[(lib #, @nontermstr{path})] as the path to @scheme[require] to initialize @@ -231,12 +233,13 @@ flags: 'collects-dir)] produce @nonterm{dir}.} @item{@FlagFirst{S} @nonterm{dir} or @DFlagFirst{search} - @nonterm{dir} : Adds @nonterm{dir} to the library collection - search path. The @scheme{dir} is added after a user-specific - directory, if any, and before the main collection directory.} + @nonterm{dir} : Adds @nonterm{dir} to the default library + collection search path after the main collection directory. If + the @Flag{S}/@DFlag{dir} flag is supplied multiple times, the + search order is as supplied.} @item{@FlagFirst{U} or @DFlagFirst{no-user-path} : Omits - user-psecific paths in the search for collections, C + user-specific paths in the search for collections, C libraries, etc. by initializing the @scheme[use-user-specific-search-paths] parameter to @scheme[#f].} diff --git a/collects/scribblings/slideshow/picts.scrbl b/collects/scribblings/slideshow/picts.scrbl index 89b26f377f..1ae0c19f47 100644 --- a/collects/scribblings/slideshow/picts.scrbl +++ b/collects/scribblings/slideshow/picts.scrbl @@ -66,7 +66,7 @@ picts. The functions @scheme[pict-width], @scheme[pict-height], information from a pict. -@defstruct[pict ([draw ((is-a?/c dc<%>) real? real? . -> . any)] +@defstruct[pict ([draw any/c] [width real?] [height real?] [ascent real?] @@ -79,16 +79,18 @@ A @scheme[pict] structure is normally not created directly with @scheme[make-pict]. Instead, functions like @scheme[text], @scheme[hline], and @scheme[dc] are used to construct a pict. -The @scheme[draw] field contains the pict's drawing procedure, which +The @scheme[draw] field contains the pict's drawing information in an +internal format. Roughly, the drawing information is a procedure that takes a @scheme[dc<%>] drawing context and an offset for the pict's top-left corner (i.e., it's bounding box's top left corner relative to the @scheme[dc<%>] origin). The state of the @scheme[dc<%>] is intended to affect the pict's drawing; for example, the pen and brush will be set for a suitable default drawing mode, and the -@scheme[dc<%>] scale will be set to scale the resulting image. +@scheme[dc<%>] scale will be set to scale the resulting image. Use +@scheme[draw-pict] (as opposed to @scheme[pict-draw]) to draw the +picture. -The @scheme[panbox] field is internal, and it should be ininitialized -to @scheme[#f]. +The @scheme[panbox] field is internal and initialized to @scheme[#f]. The @scheme[last] field indicates a pict within the @scheme[children] list (transitively) that can be treated as the last element of the diff --git a/collects/string-constants/string-constant.ss b/collects/string-constants/string-constant.ss index bbca0ca7e8..4f317394ca 100644 --- a/collects/string-constants/string-constant.ss +++ b/collects/string-constants/string-constant.ss @@ -55,15 +55,17 @@ (regexp-match (caddr ent) slc))) (car ent) (loop (cdr table))))])))) - - + + ;; language : symbol - (define language (get-preference 'plt:human-language (lambda () (default-language)))) - + (define language + (with-handlers ([exn:fail? (lambda (_) (default-language))]) + (get-preference 'plt:human-language (lambda () (default-language))))) + (define-syntax-set (string-constant string-constants this-language all-languages) ;; type sc = (make-sc symbol (listof (list symbol string)) (union #f hash-table[symbol -o> #t])) (define-struct sc (language-name constants ht)) - + (define available-string-constant-sets (list (make-sc 'english english:string-constants #f) diff --git a/collects/syntax/module-reader.ss b/collects/syntax/module-reader.ss index 10aae4dff3..1fbeea1651 100644 --- a/collects/syntax/module-reader.ss +++ b/collects/syntax/module-reader.ss @@ -7,65 +7,81 @@ (require (for-syntax scheme/base)) (define-syntax (provide-module-reader stx) - (syntax-case stx () - [(_ lib body ...) - (let ([key-args '()]) - (define (err str [sub #f]) - (raise-syntax-error 'syntax/module-reader str sub)) - (define -body - (let loop ([body (syntax->list #'(body ...))]) - (if (not (and (pair? body) - (pair? (cdr body)) - (keyword? (syntax-e (car body))))) - (datum->syntax stx body stx) - (let* ([k (car body)] [k* (syntax-e k)] [v (cadr body)]) - (cond - [(assq k* key-args) (err (format "got two ~s keywords" k*) k)] - [(not (memq k* '(#:read #:read-syntax #:wrapper1 #:wrapper2 - #:whole-body-readers?))) - (err "got an unknown keyword" (car body))] - [else (set! key-args (cons (cons k* v) key-args)) - (loop (cddr body))]))))) - (define (get kwd [dflt #f]) - (cond [(assq kwd key-args) => cdr] [else dflt])) - (unless (equal? (and (assq '#:read key-args) #t) - (and (assq '#:read-syntax key-args) #t)) + (define (err str [sub #f]) + (raise-syntax-error 'syntax/module-reader str sub)) + (define-syntax-rule (keywords body [kwd var default] ... [checks ...]) + (begin + (define var #f) ... + (set! body + (let loop ([body body]) + (if (not (and (pair? body) + (pair? (cdr body)) + (keyword? (syntax-e (car body))))) + (datum->syntax stx body stx) + (let* ([k (car body)] [k* (syntax-e k)] [v (cadr body)]) + (case k* + [(kwd) (if var + (err (format "got two ~s keywords" k*) k) + (begin (set! var v) (loop (cddr body))))] + ... + [else (err "got an unknown keyword" (car body))]))))) + checks ... + (set! var (or var default)) ...)) + (define (construct-reader lang body) + (keywords body + [#:language ~lang lang] + [#:read ~read #'read] + [#:read-syntax ~read-syntax #'read-syntax] + [#:wrapper1 ~wrapper1 #'#f] + [#:wrapper2 ~wrapper2 #'#f] + [#:whole-body-readers? ~whole-body-readers? #'#f] + [(when (equal? (and lang #t) (and ~lang #t)) + (err (string-append "must specify either a module path, or #:lang" + (if (and lang ~lang) ", not both" "")))) + (unless (equal? (and ~read #t) (and ~read-syntax #t)) (err "must specify either both #:read and #:read-syntax, or none")) - (when (and (assq '#:whole-body-readers? key-args) - (not (assq '#:read key-args))) - (err "got a #:whole-body-readers? without #:read and #:read-syntax")) - (quasisyntax/loc stx - (#%module-begin - #,@-body - (#%provide (rename *read read) (rename *read-syntax read-syntax)) - (define-values (*read *read-syntax) - (let* ([rd #,(get '#:read #'read)] - [rds #,(get '#:read-syntax #'read-syntax)] - [w1 #,(get '#:wrapper1 #'#f)] - [w2 #,(get '#:wrapper2 #'#f)] - [w2 (cond [(not w2) (lambda (in r _) (r in))] - [(procedure-arity-includes? w2 3) w2] - [else (lambda (in r _) (w2 in r))])] - [base 'lib] - [whole? #,(get '#:whole-body-readers? #'#f)]) - (values - (lambda (in modpath line col pos) - (w2 in - (lambda (in) - (wrap-internal base in rd whole? - w1 #f modpath #f line col pos)) - #f)) - (lambda (src in modpath line col pos) - (w2 in - (lambda (in) - (wrap-internal - base in (lambda (in) (rds src in)) whole? - w1 #t modpath src line col pos)) - #t))))))))])) + (when (and ~whole-body-readers? (not (and ~read ~read-syntax))) + (err "got a #:whole-body-readers? without #:read and #:read-syntax"))]) + (quasisyntax/loc stx + (#%module-begin + #,@body + (#%provide (rename *read read) (rename *read-syntax read-syntax)) + (define-values (*read *read-syntax) + (let* ([lang #,~lang] + [rd #,~read] + [rds #,~read-syntax] + [w1 #,~wrapper1] + [w2 #,~wrapper2] + [w2 (cond [(not w2) (lambda (in r _) (r in))] + [(procedure-arity-includes? w2 3) w2] + [else (lambda (in r _) (w2 in r))])] + [whole? #,~whole-body-readers?]) + (values + (lambda (in modpath line col pos) + (w2 in + (lambda (in) + (wrap-internal lang in rd whole? + w1 #f modpath #f line col pos)) + #f)) + (lambda (src in modpath line col pos) + (w2 in + (lambda (in) + (wrap-internal lang in (lambda (in) (rds src in)) whole? + w1 #t modpath src line col pos)) + #t)))))))) + (syntax-case stx () + [(_ lang body ...) + (not (keyword? (syntax-e #'lang))) + (construct-reader #''lang (syntax->list #'(body ...)))] + [(_ body ...) (construct-reader #f (syntax->list #'(body ...)))])) -(define (wrap-internal lib port read whole? wrapper stx? +(define (wrap-internal lang port read whole? wrapper stx? modpath src line col pos) - (let* ([body (lambda () + (let* ([lang (if (procedure? lang) + (parameterize ([current-input-port port]) (lang)) + lang)] + [lang (if stx? (datum->syntax #f lang modpath modpath) lang)] + [body (lambda () (if whole? (read port) (let loop ([a null]) @@ -93,11 +109,10 @@ (- (or (syntax-position modpath) (add1 pos)) pos))) v))] - [lib (if stx? (datum->syntax #f lib modpath modpath) lib)] - [r `(,(tag-src 'module) ,(tag-src name) ,lib . ,body)]) + [r `(,(tag-src 'module) ,(tag-src name) ,lang . ,body)]) (if stx? (datum->syntax #f r all-loc) r))) -(define (wrap lib port read modpath src line col pos) - (wrap-internal lib port read #f #f #f modpath src line col pos)) +(define (wrap lang port read modpath src line col pos) + (wrap-internal lang port read #f #f #f modpath src line col pos)) ) diff --git a/collects/syntax/scribblings/module-reader.scrbl b/collects/syntax/scribblings/module-reader.scrbl index 0df8ded4f1..d867e05546 100644 --- a/collects/syntax/scribblings/module-reader.scrbl +++ b/collects/syntax/scribblings/module-reader.scrbl @@ -16,8 +16,10 @@ of read modules; using keywords, the resulting readers can be customized in a number of ways. @defform*/subs[[(#%module-begin module-path) - (#%module-begin module-path reader-option ... body ....)] - ([reader-option (code:line #:read read-expr) + (#%module-begin module-path reader-option ... body ....) + (#%module-begin reader-option ... body ....)] + ([reader-option (code:line #:language lang-expr) + (code:line #:read read-expr) (code:line #:read-syntax read-syntax-expr) (code:line #:wrapper1 wrapper1-expr) (code:line #:wrapper2 wrapper2-expr) @@ -77,7 +79,7 @@ For example, here is a case-insensitive reader for the @scheme[scheme/base] language: @schemeblock[ -(module insensitive syntax/module-reader +(module reader syntax/module-reader scheme/base #:read (wrap read) #:read-syntax (wrap read-syntax) (define ((wrap reader) . args) @@ -94,7 +96,7 @@ alternative definition of the case-insensitive language using @scheme[#:wrapper1]: @schemeblock[ -(module insensitive syntax/module-reader +(module reader syntax/module-reader scheme/base #:wrapper1 (lambda (t) (parameterize ([read-case-sensitive #f]) @@ -102,7 +104,7 @@ alternative definition of the case-insensitive language using ] Note that using a @tech[#:doc refman]{readtable}, you can implement -languages that go beyond plain S-expressions. +languages that are extensions of plain S-expressions. In addition to this wrapper, there is also @scheme[#:wrapper2] that has more control over the resulting reader functions. If specified, @@ -114,7 +116,7 @@ that corresponds to a file). Here is the case-insensitive implemented using this option: @schemeblock[ -(module insensitive syntax/module-reader +(module reader syntax/module-reader scheme/base #:wrapper2 (lambda (in r) (parameterize ([read-case-sensitive #f]) @@ -122,14 +124,14 @@ using this option: ] In some cases, the reader functions read the whole file, so there is -no need to iterate them (e.g., @scheme[read-inside] and +no need to iterate them (e.g., Scribble's @scheme[read-inside] and @scheme[read-syntax-inside]). In these cases you can specify @scheme[#:whole-body-readers?] as @scheme[#t] --- the readers are expected to return a list of expressions in this case. -Finally, note that the two wrappers can return a different value than -the wrapped function. This introduces two more customization points -for the resulting readers: +In addition, the two wrappers can return a different value than the +wrapped function. This introduces two more customization points for +the resulting readers: @itemize{ @item{The thunk that is passed to a @scheme[#:wrapper1] function reads the file contents and returns a list of read expressions @@ -157,7 +159,7 @@ scribble syntax, and the first datum in the file determines the actual language (which means that the library specification is effectively ignored): @schemeblock[ -(module scribbled syntax/module-reader +(module reader syntax/module-reader -ignored- #:wrapper2 (lambda (in rd stx?) @@ -173,6 +175,25 @@ ignored): (if stx? r (syntax->datum r)))) (require scribble/reader)) ] + +This ability to change the language position in the resulting module +expression can be useful in cases such as the above, where the base +language module is chosen based on the input. To make this more +convenient, you can omit the @scheme[module-path] and instead specify +it via a @scheme[#:language] expression. This expression can evaluate +to a datum which is used as a language, or it can evaluate to a thunk. +In the latter case, the thunk will be invoked to return such a datum +before reading the module body begins, in a dynamic extent where +@scheme[current-input-port] is the source input. Using this, the last +example above can be written more concisely: +@schemeblock[ +(module reader syntax/module-reader + #:language read + #:wrapper2 (lambda (in rd stx?) + (parameterize ([current-readtable (make-at-readtable)]) + (rd in))) + (require scribble/reader)) +] } @defproc[(wrap-read-all [mod-path module-path?] diff --git a/collects/tests/mzscheme/embed-me1b.ss b/collects/tests/mzscheme/embed-me1b.ss new file mode 100644 index 0000000000..5af91026b6 --- /dev/null +++ b/collects/tests/mzscheme/embed-me1b.ss @@ -0,0 +1,9 @@ +#lang scheme/base + +(require scheme/runtime-path + (for-syntax scheme/base)) +(define-runtime-path file '(lib "icons/file.gif")) +(with-output-to-file "stdout" + (lambda () (printf "This is 1b~n")) + #:exists 'append) + diff --git a/collects/tests/mzscheme/embed-me1c.ss b/collects/tests/mzscheme/embed-me1c.ss new file mode 100644 index 0000000000..067c8ad230 --- /dev/null +++ b/collects/tests/mzscheme/embed-me1c.ss @@ -0,0 +1,9 @@ +#lang scheme/base + +(require scheme/runtime-path + (for-syntax scheme/base)) +(define-runtime-path file '(lib "etc.ss")) ; in mzlib +(with-output-to-file "stdout" + (lambda () (printf "This is 1c~n")) + #:exists 'append) + diff --git a/collects/tests/mzscheme/embed.ss b/collects/tests/mzscheme/embed.ss index 616eb4e9c8..cf4963ac63 100644 --- a/collects/tests/mzscheme/embed.ss +++ b/collects/tests/mzscheme/embed.ss @@ -98,7 +98,7 @@ (define dest (if mred? mr-dest mz-dest)) (define (flags s) (string-append "-" s)) - (define (one-mz-test filename expect) + (define (one-mz-test filename expect literal?) ;; Try simple mode: one module, launched from cmd line: (prepare dest filename) (make-embedding-executable @@ -129,88 +129,91 @@ (w/prefix #f) (w/prefix 'before:)) - ;; Try full path, and use literal S-exp to start - (printf ">>>literal sexp\n") - (prepare dest filename) - (let ([path (build-path (collection-path "tests" "mzscheme") filename)]) + (when literal? + ;; Try full path, and use literal S-exp to start + (printf ">>>literal sexp\n") + (prepare dest filename) + (let ([path (build-path (collection-path "tests" "mzscheme") filename)]) + (make-embedding-executable + dest mred? #f + `((#t ,path)) + null + (base-compile + `(namespace-require '(file ,(path->string path)))) + `(,(flags "")))) + (try-exe dest expect mred?) + + ;; Use `file' form: + (printf ">>>file\n") + (prepare dest filename) + (let ([path (build-path (collection-path "tests" "mzscheme") filename)]) + (make-embedding-executable + dest mred? #f + `((#t (file ,(path->string path)))) + null + (base-compile + `(namespace-require '(file ,(path->string path)))) + `(,(flags "")))) + (try-exe dest expect mred?) + + ;; Use relative path + (printf ">>>relative path\n") + (prepare dest filename) + (parameterize ([current-directory (collection-path "tests" "mzscheme")]) + (make-embedding-executable + dest mred? #f + `((#f ,filename)) + null + (base-compile + `(namespace-require '',(string->symbol (regexp-replace #rx"[.].*$" filename "")))) + `(,(flags "")))) + (try-exe dest expect mred?) + + ;; Try multiple modules + (printf ">>>multiple\n") + (prepare dest filename) (make-embedding-executable dest mred? #f - `((#t ,path)) + `((#t (lib ,filename "tests" "mzscheme")) + (#t (lib "embed-me3.ss" "tests" "mzscheme"))) null (base-compile - `(namespace-require '(file ,(path->string path)))) - `(,(flags "")))) - (try-exe dest expect mred?) + `(begin + (namespace-require '(lib "embed-me3.ss" "tests" "mzscheme")) + (namespace-require '(lib ,filename "tests" "mzscheme")))) + `(,(flags ""))) + (try-exe dest (string-append "3 is here, too? #t\n" expect) mred?) - ;; Use `file' form: - (printf ">>>file\n") - (prepare dest filename) - (let ([path (build-path (collection-path "tests" "mzscheme") filename)]) - (make-embedding-executable - dest mred? #f - `((#t (file ,(path->string path)))) - null - (base-compile - `(namespace-require '(file ,(path->string path)))) - `(,(flags "")))) - (try-exe dest expect mred?) + ;; Try a literal file + (printf ">>>literal\n") + (prepare dest filename) + (let ([tmp (make-temporary-file)]) + (with-output-to-file tmp + #:exists 'truncate + (lambda () + (write (kernel-compile + '(namespace-require ''#%kernel))))) + (make-embedding-executable + dest mred? #f + `((#t (lib ,filename "tests" "mzscheme"))) + (list + tmp + (build-path (collection-path "tests" "mzscheme") "embed-me4.ss")) + `(with-output-to-file "stdout" + (lambda () (display "... and more!\n")) + 'append) + `(,(flags "l") ,(string-append "tests/mzscheme/" filename))) + (delete-file tmp)) + (try-exe dest (string-append + "This is the literal expression 4.\n" + "... and more!\n" + expect) + mred?))) - ;; Use relative path - (printf ">>>relative path\n") - (prepare dest filename) - (parameterize ([current-directory (collection-path "tests" "mzscheme")]) - (make-embedding-executable - dest mred? #f - `((#f ,filename)) - null - (base-compile - `(namespace-require '',(string->symbol (regexp-replace #rx"[.].*$" filename "")))) - `(,(flags "")))) - (try-exe dest expect mred?) - - ;; Try multiple modules - (printf ">>>multiple\n") - (prepare dest filename) - (make-embedding-executable - dest mred? #f - `((#t (lib ,filename "tests" "mzscheme")) - (#t (lib "embed-me3.ss" "tests" "mzscheme"))) - null - (base-compile - `(begin - (namespace-require '(lib "embed-me3.ss" "tests" "mzscheme")) - (namespace-require '(lib ,filename "tests" "mzscheme")))) - `(,(flags ""))) - (try-exe dest (string-append "3 is here, too? #t\n" expect) mred?) - - ;; Try a literal file - (printf ">>>literal\n") - (prepare dest filename) - (let ([tmp (make-temporary-file)]) - (with-output-to-file tmp - #:exists 'truncate - (lambda () - (write (kernel-compile - '(namespace-require ''#%kernel))))) - (make-embedding-executable - dest mred? #f - `((#t (lib ,filename "tests" "mzscheme"))) - (list - tmp - (build-path (collection-path "tests" "mzscheme") "embed-me4.ss")) - `(with-output-to-file "stdout" - (lambda () (display "... and more!\n")) - 'append) - `(,(flags "l") ,(string-append "tests/mzscheme/" filename))) - (delete-file tmp)) - (try-exe dest (string-append - "This is the literal expression 4.\n" - "... and more!\n" - expect) - mred?)) - - (one-mz-test "embed-me1.ss" "This is 1\n") - (one-mz-test "embed-me2.ss" "This is 1\nThis is 2: #t\n") + (one-mz-test "embed-me1.ss" "This is 1\n" #t) + (one-mz-test "embed-me1b.ss" "This is 1b\n" #f) + (one-mz-test "embed-me1c.ss" "This is 1c\n" #f) + (one-mz-test "embed-me2.ss" "This is 1\nThis is 2: #t\n" #t) ;; Try unicode expr and cmdline: (prepare dest "unicode") diff --git a/collects/tests/mzscheme/module-reader.ss b/collects/tests/mzscheme/module-reader.ss index 4a7a190bdb..3d754da885 100644 --- a/collects/tests/mzscheme/module-reader.ss +++ b/collects/tests/mzscheme/module-reader.ss @@ -43,8 +43,13 @@ #:wrapper2 (lambda (in rd) (if (syntax? (rd in)) #'(module page zzz) '(module page zzz)))) +;; the same, the easy way +(module r9 syntax/module-reader + #:language (lambda () 'zzz) + #:wrapper1 (lambda (t) '())) + ;; a module that uses the scribble syntax with a specified language -(module r9 syntax/module-reader -ignored- +(module r10 syntax/module-reader -ignored- #:wrapper2 (lambda (in rd stx?) (let* ([lang (read in)] @@ -59,6 +64,14 @@ (if stx? r (syntax->datum r)))) (require scribble/reader)) +;; the same, using #:language +(module r11 syntax/module-reader + #:language read + #:wrapper2 (lambda (in rd stx?) + (parameterize ([current-readtable (make-at-readtable)]) + (rd in))) + (require scribble/reader)) + (define (from-string read str) (parameterize ([read-accept-reader #t]) (read (open-input-string str)))) @@ -83,10 +96,20 @@ (test-both "#reader 'r6 (define foo #:bar)" '(module page zzz)) +(test-both "#reader 'r7 (define foo #:bar)" + '(module page zzz)) +(test-both "#reader 'r8 (define foo #:bar)" + '(module page zzz)) +(test-both "#reader 'r9 (define foo #:bar)" + '(module page zzz)) -(test-both "#reader 'r9 scheme/base (define foo 1)" +(test-both "#reader 'r10 scheme/base (define foo 1)" '(module page scheme/base (define foo 1))) -(test-both "#reader 'r9 scheme/base @define[foo]{one}" +(test-both "#reader 'r10 scheme/base @define[foo]{one}" + '(module page scheme/base (define foo "one"))) +(test-both "#reader 'r11 scheme/base (define foo 1)" + '(module page scheme/base (define foo 1))) +(test-both "#reader 'r11 scheme/base @define[foo]{one}" '(module page scheme/base (define foo "one"))) ;; ---------------------------------------- diff --git a/collects/tests/run-automated-tests.ss b/collects/tests/run-automated-tests.ss index a1ee31b382..f5b8a1e95e 100755 --- a/collects/tests/run-automated-tests.ss +++ b/collects/tests/run-automated-tests.ss @@ -32,7 +32,7 @@ ;; ignored, and should only be used by the mzscheme tests.) (define tests '([no-handler load "mzscheme/quiet.ss" (lib "scheme/init")] - [require "typed-scheme/main.ss"] + [require "typed-scheme/run.ss"] [require "match/plt-match-tests.ss"] ;; [require "stepper/automatic-tests.ss" (lib "scheme/base")] [require "lazy/main.ss"] @@ -50,7 +50,7 @@ (define name (cadr t)) (define stderr (current-error-port)) (define (echo fmt . args) - (fprintf stderr "*** ~a: ~a\n" name (apply format fmt args))) + (fprintf stderr ">>> ~a: ~a\n" name (apply format fmt args))) (newline stderr) (echo "running...") (let/ec break diff --git a/collects/tests/typed-scheme/fail/nested-tvars.ss b/collects/tests/typed-scheme/fail/nested-tvars.ss new file mode 100644 index 0000000000..9a03b559f3 --- /dev/null +++ b/collects/tests/typed-scheme/fail/nested-tvars.ss @@ -0,0 +1,9 @@ +#lang typed-scheme + +(: f (All (a) (a -> a))) +(define (f x) + (: g (All (b) (a (Listof a) -> (Listof a)))) + (define (g x y) y) + (g "foo" (list "foo"))) + +(f 3) \ No newline at end of file diff --git a/collects/tests/typed-scheme/main.ss b/collects/tests/typed-scheme/main.ss index b4fe5d20c1..78f7550d40 100644 --- a/collects/tests/typed-scheme/main.ss +++ b/collects/tests/typed-scheme/main.ss @@ -4,7 +4,7 @@ (require (planet schematics/schemeunit:2/test) (planet schematics/schemeunit:2/text-ui) - mzlib/etc + mzlib/etc scheme/port compiler/compiler scheme/match "unit-tests/all-tests.ss" @@ -31,7 +31,7 @@ (define (exn-pred p) (let ([sexp (with-handlers ([exn:fail? (lambda _ #f)]) - (call-with-input-file + (call-with-input-file* p (lambda (prt) (read-line prt 'any) (read prt))))]) @@ -54,7 +54,8 @@ (lambda () (parameterize ([read-accept-reader #t] [current-load-relative-directory path] - [current-directory path]) + [current-directory path] + [current-output-port (open-output-nowhere)]) (loader p))))))) (apply test-suite dir tests))) @@ -87,9 +88,7 @@ (define (go) (test/gui tests)) (define (go/text) (test/text-ui tests)) -(when (getenv "PLT_TESTS") - (unless (parameterize ([current-output-port (open-output-string)]) - (= 0 (go/text))) - (error "Typed Scheme Tests did not pass."))) +(provide go go/text) + diff --git a/collects/tests/typed-scheme/run.ss b/collects/tests/typed-scheme/run.ss new file mode 100644 index 0000000000..d892dd3466 --- /dev/null +++ b/collects/tests/typed-scheme/run.ss @@ -0,0 +1,6 @@ +#lang scheme/base + +(require "main.ss") +(current-namespace (make-base-namespace)) +(unless (= 0 (go/text)) + (error "Typed Scheme Tests did not pass.")) diff --git a/collects/typed-scheme/typecheck/tc-app-unit.ss b/collects/typed-scheme/typecheck/tc-app-unit.ss index 7b0b080852..6114a73981 100644 --- a/collects/typed-scheme/typecheck/tc-app-unit.ss +++ b/collects/typed-scheme/typecheck/tc-app-unit.ss @@ -376,21 +376,22 @@ [(or (Poly-names: msg-vars (Function: (list (arr: msg-doms msg-rngs msg-rests msg-drests '() _ _) ...))) (PolyDots-names: msg-vars (Function: (list (arr: msg-doms msg-rngs msg-rests msg-drests '() _ _) ...)))) (let ([fcn-string (if name - (format "function ~a (over ~~a)" (syntax->datum name)) - "function over ~a")]) + (format "function ~a" (syntax->datum name)) + "function")]) (if (and (andmap null? msg-doms) (null? argtypes)) (tc-error/expr #:return (ret (Un)) (string-append "Could not infer types for applying polymorphic " fcn-string - "\n") - (stringify msg-vars)) + "\n")) (tc-error/expr #:return (ret (Un)) (string-append "Polymorphic " fcn-string " could not be applied to arguments:~n" - (domain-mismatches t msg-doms msg-rests msg-drests argtypes #f #f)) - (stringify msg-vars))))])) + (domain-mismatches t msg-doms msg-rests msg-drests argtypes #f #f) + (if (not (for/and ([t (apply append (map fv/list msg-doms))]) (memq t msg-vars))) + (string-append "Type Variables: " (stringify msg-vars) "\n") + "")))))])) (define (tc/funapp f-stx args-stx ftype0 argtys expected) @@ -450,11 +451,11 @@ [(tc-result: (and t (or (Poly: vars (Function: (list (arr: doms rngs (and rests #f) (and drests #f) '() thn-effs els-effs) ...))) - (PolyDots: (list vars ... _) + (PolyDots: (list vars ...) (Function: (list (arr: doms rngs (and rests #f) (and drests #f) '() thn-effs els-effs) ...)))))) (handle-clauses (doms rngs) f-stx (lambda (dom _) (= (length dom) (length argtypes))) - (lambda (dom rng) (infer (fv/list (cons rng dom)) argtypes dom rng (fv rng) expected)) + (lambda (dom rng) (infer vars argtypes dom rng (fv rng) expected)) t argtypes expected)] ;; polymorphic varargs [(tc-result: (and t diff --git a/doc/release-notes/mred/HISTORY.txt b/doc/release-notes/mred/HISTORY.txt index 5dcbd5342f..7e0ec1b3d1 100644 --- a/doc/release-notes/mred/HISTORY.txt +++ b/doc/release-notes/mred/HISTORY.txt @@ -1,3 +1,9 @@ +Version 4.1.1.1 + +Changed -z/--text-repl to a configuration option + +---------------------------------------------------------------------- + Version 4.1.1, October 2008 Minor bug fixes diff --git a/doc/release-notes/mzscheme/HISTORY.txt b/doc/release-notes/mzscheme/HISTORY.txt index e568c4828e..27b9ceff2c 100644 --- a/doc/release-notes/mzscheme/HISTORY.txt +++ b/doc/release-notes/mzscheme/HISTORY.txt @@ -1,3 +1,7 @@ +Version 4.1.1.1 +Changed -X and -S to complete directory relative to pwd, and + changed -S to add after main collects + Version 4.1.1, October 2008 Added read-language Added module-compiled-language-info, module->language-info, diff --git a/src/foreign/foreign.c b/src/foreign/foreign.c index ff643ae59f..3a7628ca28 100644 --- a/src/foreign/foreign.c +++ b/src/foreign/foreign.c @@ -2529,45 +2529,7 @@ void free_cl_cif_args(void *ignored, void *p) #ifdef MZ_PRECISE_GC GC_free_immobile_box((void**)(((closure_and_cif*)p)->data)); #endif - free(p); -} - -/* This is a temporary hack to allocate a piece of executable memory, */ -/* it should be removed when mzscheme's core will include a similar function */ -#ifndef WINDOWS_DYNAMIC_LOAD -#include -#endif -void *malloc_exec(size_t size) { - static long pagesize = -1; - void *p, *pp; - if (pagesize == -1) { -#ifndef WINDOWS_DYNAMIC_LOAD - pagesize = getpagesize(); -#else - { - SYSTEM_INFO info; - GetSystemInfo(&info); - pagesize = info.dwPageSize; - } -#endif - } - p = malloc(size); - if (p == NULL) - scheme_signal_error("internal error: malloc failed (malloc_exec)"); - /* set pp to the beginning of the page */ - pp = (void*)(((long)p) & ~(pagesize-1)); - /* set size to a pagesize multiple, in case the block is more than a page */ - size = ((((long)p)+size+pagesize-1) & ~(pagesize-1)) - ((long)pp); -#ifndef WINDOWS_DYNAMIC_LOAD - if (mprotect(pp, size, PROT_READ|PROT_WRITE|PROT_EXEC)) - perror("malloc_exec mprotect failure"); -#else - { - DWORD old; - VirtualProtect(pp, size, PAGE_EXECUTE_READWRITE, &old); - } -#endif - return p; + scheme_free_code(p); } /* (ffi-callback scheme-proc in-types out-type [abi]) -> ffi-callback */ @@ -2626,7 +2588,7 @@ static Scheme_Object *foreign_ffi_callback(int argc, Scheme_Object *argv[]) rtype = CTYPE_PRIMTYPE(base); abi = GET_ABI(MYNAME,3); /* malloc space for everything needed, so a single free gets rid of this */ - cl_cif_args = malloc_exec(sizeof(closure_and_cif) + nargs*sizeof(ffi_cif*)); + cl_cif_args = scheme_malloc_code(sizeof(closure_and_cif) + nargs*sizeof(ffi_cif*)); cl = &(cl_cif_args->closure); /* cl is the same as cl_cif_args */ cif = &(cl_cif_args->cif); atypes = (ffi_type **)(((char*)cl_cif_args) + sizeof(closure_and_cif)); diff --git a/src/foreign/foreign.ssc b/src/foreign/foreign.ssc index 45a7632c86..dd544ad838 100755 --- a/src/foreign/foreign.ssc +++ b/src/foreign/foreign.ssc @@ -1969,7 +1969,7 @@ void free_cl_cif_args(void *ignored, void *p) #ifdef MZ_PRECISE_GC GC_free_immobile_box((void**)(((closure_and_cif*)p)->data)); #endif - free(p); + scheme_free_code(p); } /* (ffi-callback scheme-proc in-types out-type [abi]) -> ffi-callback */ @@ -2026,7 +2026,7 @@ void free_cl_cif_args(void *ignored, void *p) rtype = CTYPE_PRIMTYPE(base); abi = GET_ABI(MYNAME,3); /* malloc space for everything needed, so a single free gets rid of this */ - cl_cif_args = malloc(sizeof(closure_and_cif) + nargs*sizeof(ffi_cif*)); + cl_cif_args = scheme_malloc_code(sizeof(closure_and_cif) + nargs*sizeof(ffi_cif*)); cl = &(cl_cif_args->closure); /* cl is the same as cl_cif_args */ cif = &(cl_cif_args->cif); atypes = (ffi_type **)(((char*)cl_cif_args) + sizeof(closure_and_cif)); diff --git a/src/mzscheme/cmdline.inc b/src/mzscheme/cmdline.inc index fca838b2c1..5bf537bff0 100644 --- a/src/mzscheme/cmdline.inc +++ b/src/mzscheme/cmdline.inc @@ -383,6 +383,22 @@ static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl) return exit_val; } +static Scheme_Object *reverse_path_list(Scheme_Object *l, int rel_to_cwd) +{ + Scheme_Object *r, *path; + + r = scheme_make_null(); + while (SCHEME_PAIRP(l)) { + path = SCHEME_CAR(l); + if (rel_to_cwd) + path = scheme_path_to_complete_path(path, NULL); + r = scheme_make_pair(path, r); + l = SCHEME_CDR(l); + } + + return r; +} + static int get_log_level(char *prog, char *real_switch, const char *envvar, const char *what, char *str) { if (!strcmp(str, "none")) @@ -747,8 +763,7 @@ static int run_from_cmd_line(int argc, char *_argv[], --argc; if (!collects_extra) collects_extra = scheme_make_null(); - collects_extra = scheme_make_pair(scheme_make_path(argv[0]), - collects_extra); + collects_extra = scheme_make_pair(scheme_make_path(argv[0]), collects_extra); was_config_flag = 1; break; case 'c': @@ -889,8 +904,7 @@ static int run_from_cmd_line(int argc, char *_argv[], case 'z': alternate_rep = 1; no_front = 1; - use_repl = 1; - init_ns = 1; + was_config_flag = 1; break; case 'K': no_front = 1; @@ -1034,31 +1048,29 @@ static int run_from_cmd_line(int argc, char *_argv[], if (!collects_path) collects_path = scheme_make_path(_coldir XFORM_OK_PLUS _coldir_offset); + else + collects_path = scheme_path_to_complete_path(collects_path, NULL); scheme_set_collects_path(collects_path); /* Make list of additional collection paths: */ - if (collects_extra) { - l = collects_extra; - } else { - l = scheme_make_null(); - offset = _coldir_offset; - while (1) { - len = strlen(_coldir XFORM_OK_PLUS offset); - offset += len + 1; - if (!_coldir[offset]) - break; - l = scheme_make_pair(scheme_make_path(_coldir XFORM_OK_PLUS offset), - l); - } + if (collects_extra) + r = reverse_path_list(collects_extra, 1); + else + r = scheme_make_null(); + + l = scheme_make_null(); + offset = _coldir_offset; + while (1) { + len = strlen(_coldir XFORM_OK_PLUS offset); + offset += len + 1; + if (!_coldir[offset]) + break; + l = scheme_make_pair(scheme_make_path(_coldir XFORM_OK_PLUS offset), + l); } - /* Reverse list */ - r = scheme_make_null(); - while (SCHEME_PAIRP(l)) { - r = scheme_make_pair(SCHEME_CAR(l), r); - l = SCHEME_CDR(l); - } - - scheme_init_collection_paths(global_env, r); + l = reverse_path_list(l, 0); + + scheme_init_collection_paths_post(global_env, l, r); } #endif /* NO_FILE_SYSTEM_UTILS */ @@ -1093,12 +1105,6 @@ static int run_from_cmd_line(int argc, char *_argv[], return cont_run(fa); -#ifdef CMDLINE_STDIO_FLAG -# define REPL_FLAGS "-i/-z" -#else -# define REPL_FLAGS "-i" -#endif - #ifndef DONT_PARSE_COMMAND_LINE show_help: prog =("%s" @@ -1124,10 +1130,7 @@ static int run_from_cmd_line(int argc, char *_argv[], " -m, --main : Call `main' with command-line arguments, print results\n" " Interaction options:\n" " -i, --repl : Run interactive read-eval-print loop; implies -v\n" -# ifdef CMDLINE_STDIO_FLAG - " -z, --text-repl : Like -i, but use text read-eval-print loop\n" -# endif - " -n, --no-lib : Skip `(require (lib \"\"))' for " REPL_FLAGS "/-e/-f/-r\n" + " -n, --no-lib : Skip `(require (lib \"\"))' for -i/-e/-f/-r\n" " -v, --version : Show version\n" # ifdef CMDLINE_STDIO_FLAG " -K, --back : Don't bring application to the foreground (Mac OS X)\n" @@ -1137,10 +1140,13 @@ static int run_from_cmd_line(int argc, char *_argv[], # endif " Configuration options:\n" " -c, --no-compiled : Disable loading of compiled files\n" - " -q, --no-init-file : Skip load of " INIT_FILENAME " for " REPL_FLAGS "\n" + " -q, --no-init-file : Skip load of " INIT_FILENAME " for -i\n" +# ifdef CMDLINE_STDIO_FLAG + " -z, --text-repl : Use text read-eval-print loop for -i\n" +# endif " -I : Set to \n" - " -X , --collects : Main collects at relative to " PROGRAM "\n" - " -S , --search : More collects at relative to " PROGRAM "\n" + " -X , --collects : Main collects at \n" + " -S , --search : More collects at (after main collects)\n" " -U, --no-user-path : Ignore user-specific collects, etc.\n" " -N , --name : Sets `(find-system-path 'run-file)' to \n" # ifdef MZ_USE_JIT @@ -1166,10 +1172,10 @@ static int run_from_cmd_line(int argc, char *_argv[], " Example: `-ifve file expr' is the same as `-i -f file -v -e expr'\n" "Start-up sequence:\n" " 1. Set `current-library-collection-paths'\n" - " 2. Require `(lib \"\")' [when " REPL_FLAGS "/-e/-f/-r, unless -n]\n" + " 2. Require `(lib \"\")' [when -i/-e/-f/-r, unless -n]\n" " 3. Evaluate/load expressions/files in order, until first error\n" - " 4. Load \"" INIT_FILENAME "\" [when " REPL_FLAGS "]\n" - " 5. Run read-eval-print loop [when " REPL_FLAGS "]\n" + " 4. Load \"" INIT_FILENAME "\" [when -i]\n" + " 5. Run read-eval-print loop [when -i]\n" # ifdef YIELD_BEFORE_EXIT " 6. Run `(yield 'wait)' [unless -V]\n" # endif diff --git a/src/mzscheme/gc2/vm_mmap.c b/src/mzscheme/gc2/vm_mmap.c index 31de6c80e3..cfddadece5 100644 --- a/src/mzscheme/gc2/vm_mmap.c +++ b/src/mzscheme/gc2/vm_mmap.c @@ -32,7 +32,7 @@ static int page_size; /* OS page size */ #ifndef MAP_ANON -int fd, fd_created; +static int fd, fd_created; #endif inline static void *find_cached_pages(size_t len, size_t alignment, int dirty_ok); diff --git a/src/mzscheme/include/mzscheme.exp b/src/mzscheme/include/mzscheme.exp index 668e122774..e4c360354d 100644 --- a/src/mzscheme/include/mzscheme.exp +++ b/src/mzscheme/include/mzscheme.exp @@ -172,6 +172,9 @@ GC_malloc GC_malloc_atomic GC_malloc_stubborn GC_malloc_uncollectable +scheme_malloc_code +scheme_free_code +scheme_malloc_gcable_code scheme_malloc_eternal scheme_end_stubborn_change scheme_calloc diff --git a/src/mzscheme/include/mzscheme3m.exp b/src/mzscheme/include/mzscheme3m.exp index 1ddb52c904..8445281418 100644 --- a/src/mzscheme/include/mzscheme3m.exp +++ b/src/mzscheme/include/mzscheme3m.exp @@ -177,6 +177,9 @@ GC_malloc_array_tagged GC_malloc_allow_interior GC_malloc_atomic_allow_interior GC_malloc_tagged_allow_interior +scheme_malloc_code +scheme_free_code +scheme_malloc_gcable_code scheme_malloc_eternal scheme_end_stubborn_change scheme_calloc diff --git a/src/mzscheme/include/mzwin.def b/src/mzscheme/include/mzwin.def index bdd51b4f60..af098b5166 100644 --- a/src/mzscheme/include/mzwin.def +++ b/src/mzscheme/include/mzwin.def @@ -160,6 +160,9 @@ EXPORTS scheme_eval_compiled_sized_string scheme_eval_compiled_sized_string_with_magic scheme_detach_multple_array + scheme_malloc_code + scheme_free_code + scheme_malloc_gcable_code scheme_malloc_eternal scheme_end_stubborn_change scheme_calloc diff --git a/src/mzscheme/include/mzwin3m.def b/src/mzscheme/include/mzwin3m.def index b46990f72c..96bd5ea097 100644 --- a/src/mzscheme/include/mzwin3m.def +++ b/src/mzscheme/include/mzwin3m.def @@ -169,6 +169,9 @@ EXPORTS GC_malloc_allow_interior GC_malloc_atomic_allow_interior GC_malloc_tagged_allow_interior + scheme_malloc_code + scheme_free_code + scheme_malloc_gcable_code scheme_malloc_eternal scheme_end_stubborn_change scheme_calloc diff --git a/src/mzscheme/include/scheme.h b/src/mzscheme/include/scheme.h index da778d61d1..51c294dcc4 100644 --- a/src/mzscheme/include/scheme.h +++ b/src/mzscheme/include/scheme.h @@ -1734,6 +1734,7 @@ MZ_EXTERN void scheme_set_collects_path(Scheme_Object *p); MZ_EXTERN void scheme_set_original_dir(Scheme_Object *d); MZ_EXTERN void scheme_init_collection_paths(Scheme_Env *global_env, Scheme_Object *extra_dirs); +MZ_EXTERN void scheme_init_collection_paths_post(Scheme_Env *global_env, Scheme_Object *extra_dirs, Scheme_Object *extra_post_dirs); /* Initialization */ MZ_EXTERN Scheme_Env *scheme_basic_env(void); @@ -1749,8 +1750,8 @@ MZ_EXTERN void scheme_wake_up(void); MZ_EXTERN int scheme_get_external_event_fd(void); /* GC registration: */ -MZ_EXTERN void scheme_set_primordial_stack_base(void *base, int no_auto_statics); -MZ_EXTERN void scheme_set_primordial_stack_bounds(void *base, void *deepest, int no_auto_statics); +MZ_EXTERN void scheme_set_stack_base(void *base, int no_auto_statics); +MZ_EXTERN void scheme_set_stack_bounds(void *base, void *deepest, int no_auto_statics); /* Stack-preparation start-up: */ typedef int (*Scheme_Nested_Main)(void *data); diff --git a/src/mzscheme/sconfig.h b/src/mzscheme/sconfig.h index 2e1ad9d92a..ababb7ec7a 100644 --- a/src/mzscheme/sconfig.h +++ b/src/mzscheme/sconfig.h @@ -695,6 +695,7 @@ #else # define MZ_USE_JIT_I386 #endif +# define MZ_JIT_USE_MPROTECT # define FLAGS_ALREADY_SET diff --git a/src/mzscheme/src/cstartup.inc b/src/mzscheme/src/cstartup.inc index 10e1ae9207..044326d689 100644 --- a/src/mzscheme/src/cstartup.inc +++ b/src/mzscheme/src/cstartup.inc @@ -1,5 +1,5 @@ { - static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,48,46,52,50,0,0,0,1,0,0,6,0,9,0, + static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,49,46,49,50,0,0,0,1,0,0,6,0,9,0, 13,0,20,0,23,0,36,0,41,0,48,0,53,0,58,0,65,0,69,0,78, 0,84,0,98,0,112,0,115,0,119,0,121,0,132,0,134,0,148,0,155,0, 177,0,179,0,193,0,253,0,23,1,32,1,41,1,51,1,68,1,107,1,146, @@ -14,11 +14,11 @@ 115,61,120,73,108,101,116,114,101,99,45,118,97,108,117,101,115,66,108,97,109, 98,100,97,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110, 45,107,101,121,61,118,73,100,101,102,105,110,101,45,118,97,108,117,101,115,98, -10,35,11,8,147,225,94,159,2,16,35,35,159,2,15,35,35,16,20,2,3, +10,35,11,8,174,227,94,159,2,16,35,35,159,2,15,35,35,16,20,2,3, 2,2,2,4,2,2,2,11,2,2,2,5,2,2,2,6,2,2,2,7,2, 2,2,8,2,2,2,9,2,2,2,10,2,2,2,12,2,2,97,36,11,8, -147,225,93,159,2,15,35,36,16,2,2,13,161,2,2,36,2,13,2,2,2, -13,97,10,11,11,8,147,225,16,0,97,10,37,11,8,147,225,16,0,13,16, +174,227,93,159,2,15,35,36,16,2,2,13,161,2,2,36,2,13,2,2,2, +13,97,10,11,11,8,174,227,16,0,97,10,37,11,8,174,227,16,0,13,16, 4,35,29,11,11,2,2,11,18,98,64,104,101,114,101,8,31,8,30,8,29, 8,28,8,27,27,248,22,190,3,23,196,1,249,22,183,3,80,158,38,35,251, 22,73,2,17,248,22,88,23,200,2,12,249,22,63,2,1,248,22,90,23,202, @@ -28,14 +28,14 @@ 36,28,248,22,71,248,22,65,23,195,2,248,22,64,193,249,22,183,3,80,158, 38,35,251,22,73,2,17,248,22,64,23,200,2,249,22,63,2,12,248,22,65, 23,202,1,11,18,100,10,8,31,8,30,8,29,8,28,8,27,16,4,11,11, -2,18,3,1,7,101,110,118,56,50,54,57,16,4,11,11,2,19,3,1,7, -101,110,118,56,50,55,48,27,248,22,65,248,22,190,3,23,197,1,28,248,22, +2,18,3,1,7,101,110,118,57,57,52,52,16,4,11,11,2,19,3,1,7, +101,110,118,57,57,52,53,27,248,22,65,248,22,190,3,23,197,1,28,248,22, 71,23,194,2,20,15,159,36,35,36,28,248,22,71,248,22,65,23,195,2,248, 22,64,193,249,22,183,3,80,158,38,35,250,22,73,2,20,248,22,73,249,22, 73,248,22,73,2,21,248,22,64,23,202,2,251,22,73,2,17,2,21,2,21, 249,22,63,2,5,248,22,65,23,205,1,18,100,11,8,31,8,30,8,29,8, -28,8,27,16,4,11,11,2,18,3,1,7,101,110,118,56,50,55,50,16,4, -11,11,2,19,3,1,7,101,110,118,56,50,55,51,248,22,190,3,193,27,248, +28,8,27,16,4,11,11,2,18,3,1,7,101,110,118,57,57,52,55,16,4, +11,11,2,19,3,1,7,101,110,118,57,57,52,56,248,22,190,3,193,27,248, 22,190,3,194,249,22,63,248,22,73,248,22,64,196,248,22,65,195,27,248,22, 65,248,22,190,3,23,197,1,249,22,183,3,80,158,38,35,28,248,22,51,248, 22,184,3,248,22,64,23,198,2,27,249,22,2,32,0,89,162,8,44,36,42, @@ -65,8 +65,8 @@ 251,22,73,2,17,28,249,22,154,8,248,22,184,3,248,22,64,23,201,2,64, 101,108,115,101,10,248,22,64,23,198,2,250,22,74,2,20,9,248,22,65,23, 201,1,249,22,63,2,9,248,22,65,23,203,1,99,8,31,8,30,8,29,8, -28,8,27,16,4,11,11,2,18,3,1,7,101,110,118,56,50,57,53,16,4, -11,11,2,19,3,1,7,101,110,118,56,50,57,54,18,158,94,10,64,118,111, +28,8,27,16,4,11,11,2,18,3,1,7,101,110,118,57,57,55,48,16,4, +11,11,2,19,3,1,7,101,110,118,57,57,55,49,18,158,94,10,64,118,111, 105,100,8,47,27,248,22,65,248,22,190,3,196,249,22,183,3,80,158,38,35, 28,248,22,51,248,22,184,3,248,22,64,197,250,22,73,2,26,248,22,73,248, 22,64,199,248,22,88,198,27,248,22,184,3,248,22,64,197,250,22,73,2,26, @@ -99,256 +99,257 @@ EVAL_ONE_SIZED_STR((char *)expr, 2032); } { - static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,48,46,52,59,0,0,0,1,0,0,3,0,16,0, + static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,49,46,49,60,0,0,0,1,0,0,3,0,16,0, 21,0,38,0,53,0,71,0,87,0,97,0,115,0,135,0,151,0,169,0,200, 0,229,0,251,0,9,1,15,1,29,1,34,1,44,1,52,1,80,1,112,1, 157,1,202,1,226,1,9,2,11,2,68,2,158,3,199,3,33,5,137,5,241, 5,102,6,116,6,150,6,166,6,16,8,30,8,193,8,200,9,206,10,213,10, -219,10,91,11,104,11,59,12,161,12,174,12,196,12,148,13,52,14,123,15,131, -15,139,15,165,15,19,16,0,0,54,19,0,0,29,11,11,72,112,97,116,104, -45,115,116,114,105,110,103,63,64,98,115,98,115,76,110,111,114,109,97,108,45, -99,97,115,101,45,112,97,116,104,74,45,99,104,101,99,107,45,114,101,108,112, -97,116,104,77,45,99,104,101,99,107,45,99,111,108,108,101,99,116,105,111,110, -75,99,111,108,108,101,99,116,105,111,110,45,112,97,116,104,69,45,102,105,110, -100,45,99,111,108,77,99,104,101,99,107,45,115,117,102,102,105,120,45,99,97, -108,108,79,112,97,116,104,45,114,101,112,108,97,99,101,45,115,117,102,102,105, -120,75,112,97,116,104,45,97,100,100,45,115,117,102,102,105,120,77,108,111,97, -100,47,117,115,101,45,99,111,109,112,105,108,101,100,1,29,102,105,110,100,45, -108,105,98,114,97,114,121,45,99,111,108,108,101,99,116,105,111,110,45,112,97, -116,104,115,1,27,112,97,116,104,45,108,105,115,116,45,115,116,114,105,110,103, -45,62,112,97,116,104,45,108,105,115,116,1,20,102,105,110,100,45,101,120,101, -99,117,116,97,98,108,101,45,112,97,116,104,73,101,109,98,101,100,100,101,100, -45,108,111,97,100,65,113,117,111,116,101,29,94,2,17,68,35,37,112,97,114, -97,109,122,11,64,108,111,111,112,69,101,120,101,99,45,102,105,108,101,67,119, -105,110,100,111,119,115,6,25,25,112,97,116,104,32,111,114,32,118,97,108,105, -100,45,112,97,116,104,32,115,116,114,105,110,103,6,29,29,126,97,58,32,105, -110,118,97,108,105,100,32,114,101,108,97,116,105,118,101,32,112,97,116,104,58, -32,126,115,6,42,42,126,97,58,32,99,111,108,108,101,99,116,105,111,110,32, -110,111,116,32,102,111,117,110,100,58,32,126,115,32,105,110,32,97,110,121,32, -111,102,58,32,126,115,6,42,42,112,97,116,104,32,40,102,111,114,32,97,110, -121,32,115,121,115,116,101,109,41,32,111,114,32,118,97,108,105,100,45,112,97, -116,104,32,115,116,114,105,110,103,6,21,21,115,116,114,105,110,103,32,111,114, -32,98,121,116,101,32,115,116,114,105,110,103,6,36,36,99,97,110,110,111,116, -32,97,100,100,32,97,32,115,117,102,102,105,120,32,116,111,32,97,32,114,111, -111,116,32,112,97,116,104,58,32,5,0,27,20,14,159,80,158,36,50,250,80, -158,39,51,249,22,27,11,80,158,41,50,22,170,12,10,248,22,147,5,23,196, -2,28,248,22,144,6,23,194,2,12,87,94,248,22,157,8,23,194,1,248,80, -159,37,53,36,195,28,248,22,71,23,195,2,9,27,248,22,64,23,196,2,27, -28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195,2,249,22, -152,13,23,196,1,250,80,158,42,48,248,22,166,13,2,20,11,10,250,80,158, -40,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22,63,248,22, -154,13,249,22,152,13,23,198,1,247,22,167,13,27,248,22,65,23,200,1,28, -248,22,71,23,194,2,9,27,248,22,64,23,195,2,27,28,248,22,151,13,23, -195,2,23,194,1,28,248,22,150,13,23,195,2,249,22,152,13,23,196,1,250, -80,158,47,48,248,22,166,13,2,20,11,10,250,80,158,45,48,248,22,166,13, -2,20,23,197,1,10,28,23,193,2,249,22,63,248,22,154,13,249,22,152,13, -23,198,1,247,22,167,13,248,80,159,45,52,36,248,22,65,23,199,1,87,94, -23,193,1,248,80,159,43,52,36,248,22,65,23,197,1,87,94,23,193,1,27, -248,22,65,23,198,1,28,248,22,71,23,194,2,9,27,248,22,64,23,195,2, -27,28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195,2,249, -22,152,13,23,196,1,250,80,158,45,48,248,22,166,13,2,20,11,10,250,80, -158,43,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22,63,248, -22,154,13,249,22,152,13,23,198,1,247,22,167,13,248,80,159,43,52,36,248, -22,65,23,199,1,248,80,159,41,52,36,248,22,65,196,27,248,22,191,12,23, -195,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6,23,195,2,27, -248,22,149,13,195,28,192,192,248,22,150,13,195,11,87,94,28,28,248,22,128, -13,23,195,2,10,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94,23, -193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23,193, -2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8,76, -110,111,114,109,97,108,45,112,97,116,104,45,99,97,115,101,6,42,42,112,97, -116,104,32,40,102,111,114,32,97,110,121,32,115,121,115,116,101,109,41,32,111, -114,32,118,97,108,105,100,45,112,97,116,104,32,115,116,114,105,110,103,23,197, -2,28,28,248,22,128,13,23,195,2,249,22,154,8,248,22,129,13,23,197,2, -2,21,249,22,154,8,247,22,168,7,2,21,27,28,248,22,149,6,23,196,2, -23,195,2,248,22,158,7,248,22,132,13,23,197,2,28,249,22,179,13,0,21, -35,114,120,34,94,91,92,92,93,91,92,92,93,91,63,93,91,92,92,93,34, -23,195,2,28,248,22,149,6,195,248,22,135,13,195,194,27,248,22,188,6,23, -195,1,249,22,136,13,248,22,161,7,250,22,185,13,0,6,35,114,120,34,47, -34,28,249,22,179,13,0,22,35,114,120,34,91,47,92,92,93,91,46,32,93, -43,91,47,92,92,93,42,36,34,23,201,2,23,199,1,250,22,185,13,0,19, -35,114,120,34,91,32,46,93,43,40,91,47,92,92,93,42,41,36,34,23,202, -1,6,2,2,92,49,80,158,43,36,2,21,28,248,22,149,6,194,248,22,135, -13,194,193,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94, -23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23, -193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8, -23,196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11, -249,22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201,1,247, -22,23,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94,23, -193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23,193, -2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8,23, -196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11,249, -22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201,1,247,22, -23,87,94,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94, -23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23, -193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8, -195,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11,249,22, -155,10,248,22,178,6,250,22,133,7,2,23,199,23,201,1,247,22,23,249,22, -3,89,162,8,44,36,49,9,223,2,33,34,196,248,22,146,11,249,22,185,10, -23,196,1,247,22,23,87,94,250,80,159,38,39,36,2,7,196,197,251,80,159, -39,41,36,2,7,32,0,89,162,8,44,36,44,9,222,33,36,197,198,32,38, -89,162,43,41,58,65,99,108,111,111,112,222,33,39,28,248,22,71,23,199,2, -87,94,23,198,1,248,23,196,1,251,22,133,7,2,24,23,199,1,28,248,22, -71,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,145,13,23,204,1, -23,205,1,23,198,1,27,249,22,145,13,248,22,64,23,202,2,23,199,2,28, -248,22,140,13,23,194,2,27,250,22,1,22,145,13,23,197,1,23,202,2,28, -248,22,140,13,23,194,2,192,87,94,23,193,1,27,248,22,65,23,202,1,28, -248,22,71,23,194,2,87,94,23,193,1,248,23,199,1,251,22,133,7,2,24, -23,202,1,28,248,22,71,23,206,2,87,94,23,205,1,23,204,1,250,22,1, -22,145,13,23,207,1,23,208,1,23,201,1,27,249,22,145,13,248,22,64,23, -197,2,23,202,2,28,248,22,140,13,23,194,2,27,250,22,1,22,145,13,23, -197,1,204,28,248,22,140,13,193,192,253,2,38,203,204,205,206,23,15,248,22, -65,201,253,2,38,202,203,204,205,206,248,22,65,200,87,94,23,193,1,27,248, -22,65,23,201,1,28,248,22,71,23,194,2,87,94,23,193,1,248,23,198,1, -251,22,133,7,2,24,23,201,1,28,248,22,71,23,205,2,87,94,23,204,1, -23,203,1,250,22,1,22,145,13,23,206,1,23,207,1,23,200,1,27,249,22, -145,13,248,22,64,23,197,2,23,201,2,28,248,22,140,13,23,194,2,27,250, -22,1,22,145,13,23,197,1,203,28,248,22,140,13,193,192,253,2,38,202,203, -204,205,206,248,22,65,201,253,2,38,201,202,203,204,205,248,22,65,200,27,247, -22,168,13,253,2,38,198,199,200,201,202,198,87,95,28,28,248,22,128,13,23, -194,2,10,27,248,22,191,12,23,195,2,28,23,193,2,192,87,94,23,193,1, -28,248,22,149,6,23,195,2,27,248,22,149,13,23,196,2,28,23,193,2,192, -87,94,23,193,1,248,22,150,13,23,196,2,11,12,252,22,184,8,23,200,2, -2,25,35,23,198,2,23,199,2,28,28,248,22,149,6,23,195,2,10,248,22, -137,7,23,195,2,87,94,23,194,1,12,252,22,184,8,23,200,2,2,26,36, -23,198,2,23,199,1,91,159,38,11,90,161,38,35,11,248,22,148,13,23,197, -2,87,94,23,195,1,87,94,28,192,12,250,22,185,8,23,201,1,2,27,23, -199,1,249,22,7,194,195,91,159,37,11,90,161,37,35,11,87,95,28,28,248, -22,128,13,23,196,2,10,27,248,22,191,12,23,197,2,28,23,193,2,192,87, -94,23,193,1,28,248,22,149,6,23,197,2,27,248,22,149,13,23,198,2,28, -23,193,2,192,87,94,23,193,1,248,22,150,13,23,198,2,11,12,252,22,184, -8,2,10,2,25,35,23,200,2,23,201,2,28,28,248,22,149,6,23,197,2, -10,248,22,137,7,23,197,2,12,252,22,184,8,2,10,2,26,36,23,200,2, -23,201,2,91,159,38,11,90,161,38,35,11,248,22,148,13,23,199,2,87,94, -23,195,1,87,94,28,23,193,2,12,250,22,185,8,2,10,2,27,23,201,2, -249,22,7,23,195,1,23,196,1,27,249,22,137,13,250,22,184,13,0,18,35, -114,120,35,34,40,91,46,93,91,94,46,93,42,124,41,36,34,248,22,133,13, -23,201,1,28,248,22,149,6,23,203,2,249,22,161,7,23,204,1,8,63,23, -202,1,28,248,22,128,13,23,199,2,248,22,129,13,23,199,1,87,94,23,198, -1,247,22,130,13,28,248,22,191,12,194,249,22,145,13,195,194,192,91,159,37, -11,90,161,37,35,11,87,95,28,28,248,22,128,13,23,196,2,10,27,248,22, -191,12,23,197,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6,23, -197,2,27,248,22,149,13,23,198,2,28,23,193,2,192,87,94,23,193,1,248, -22,150,13,23,198,2,11,12,252,22,184,8,2,11,2,25,35,23,200,2,23, -201,2,28,28,248,22,149,6,23,197,2,10,248,22,137,7,23,197,2,12,252, -22,184,8,2,11,2,26,36,23,200,2,23,201,2,91,159,38,11,90,161,38, -35,11,248,22,148,13,23,199,2,87,94,23,195,1,87,94,28,23,193,2,12, -250,22,185,8,2,11,2,27,23,201,2,249,22,7,23,195,1,23,196,1,27, -249,22,137,13,249,22,147,7,250,22,185,13,0,9,35,114,120,35,34,91,46, -93,34,248,22,133,13,23,203,1,6,1,1,95,28,248,22,149,6,23,202,2, -249,22,161,7,23,203,1,8,63,23,201,1,28,248,22,128,13,23,199,2,248, -22,129,13,23,199,1,87,94,23,198,1,247,22,130,13,28,248,22,191,12,194, -249,22,145,13,195,194,192,249,247,22,180,4,194,11,248,80,158,36,46,9,27, -247,22,170,13,249,80,158,38,47,28,23,195,2,27,248,22,166,7,6,11,11, -80,76,84,67,79,76,76,69,67,84,83,28,192,192,6,0,0,6,0,0,27, -28,23,196,1,250,22,145,13,248,22,166,13,69,97,100,100,111,110,45,100,105, -114,247,22,164,7,6,8,8,99,111,108,108,101,99,116,115,11,27,248,80,159, -41,52,36,249,22,77,23,202,1,248,22,73,248,22,166,13,72,99,111,108,108, -101,99,116,115,45,100,105,114,28,23,194,2,249,22,63,23,196,1,23,195,1, -192,32,47,89,162,8,44,38,54,2,19,222,33,48,27,249,22,177,13,23,197, -2,23,198,2,28,23,193,2,87,94,23,196,1,27,248,22,88,23,195,2,27, -27,248,22,97,23,197,1,27,249,22,177,13,23,201,2,23,196,2,28,23,193, -2,87,94,23,194,1,27,248,22,88,23,195,2,27,250,2,47,23,203,2,23, -204,1,248,22,97,23,199,1,28,249,22,143,7,23,196,2,2,28,249,22,77, -23,202,2,194,249,22,63,248,22,136,13,23,197,1,23,195,1,87,95,23,199, -1,23,193,1,28,249,22,143,7,23,196,2,2,28,249,22,77,23,200,2,9, -249,22,63,248,22,136,13,23,197,1,9,28,249,22,143,7,23,196,2,2,28, -249,22,77,197,194,87,94,23,196,1,249,22,63,248,22,136,13,23,197,1,194, -87,94,23,193,1,28,249,22,143,7,23,198,2,2,28,249,22,77,195,9,87, -94,23,194,1,249,22,63,248,22,136,13,23,199,1,9,87,95,28,28,248,22, -137,7,194,10,248,22,149,6,194,12,250,22,184,8,2,14,6,21,21,98,121, -116,101,32,115,116,114,105,110,103,32,111,114,32,115,116,114,105,110,103,196,28, -28,248,22,72,195,249,22,4,22,191,12,196,11,12,250,22,184,8,2,14,6, -13,13,108,105,115,116,32,111,102,32,112,97,116,104,115,197,250,2,47,197,195, -28,248,22,149,6,197,248,22,160,7,197,196,32,50,89,162,8,44,39,57,2, -19,222,33,53,32,51,89,162,8,44,38,54,70,102,111,117,110,100,45,101,120, -101,99,222,33,52,28,23,193,2,91,159,38,11,90,161,38,35,11,248,22,148, -13,23,199,2,87,95,23,195,1,23,194,1,27,28,23,198,2,27,248,22,153, -13,23,201,2,28,249,22,156,8,23,195,2,23,202,2,11,28,248,22,149,13, -23,194,2,250,2,51,23,201,2,23,202,2,249,22,145,13,23,200,2,23,198, -1,250,2,51,23,201,2,23,202,2,23,196,1,11,28,23,193,2,192,87,94, -23,193,1,27,28,248,22,191,12,23,196,2,27,249,22,145,13,23,198,2,23, -201,2,28,28,248,22,140,13,193,10,248,22,139,13,193,192,11,11,28,23,193, -2,192,87,94,23,193,1,28,23,199,2,11,27,248,22,153,13,23,202,2,28, -249,22,156,8,23,195,2,23,203,1,11,28,248,22,149,13,23,194,2,250,2, -51,23,202,1,23,203,1,249,22,145,13,23,201,1,23,198,1,250,2,51,201, -202,195,194,28,248,22,71,23,197,2,11,27,248,22,152,13,248,22,64,23,199, -2,27,249,22,145,13,23,196,1,23,197,2,28,248,22,139,13,23,194,2,250, -2,51,198,199,195,87,94,23,193,1,27,248,22,65,23,200,1,28,248,22,71, -23,194,2,11,27,248,22,152,13,248,22,64,23,196,2,27,249,22,145,13,23, -196,1,23,200,2,28,248,22,139,13,23,194,2,250,2,51,201,202,195,87,94, -23,193,1,27,248,22,65,23,197,1,28,248,22,71,23,194,2,11,27,248,22, -152,13,248,22,64,195,27,249,22,145,13,23,196,1,202,28,248,22,139,13,193, -250,2,51,204,205,195,251,2,50,204,205,206,248,22,65,199,87,95,28,27,248, -22,191,12,23,196,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6, -23,196,2,27,248,22,149,13,23,197,2,28,23,193,2,192,87,94,23,193,1, -248,22,150,13,23,197,2,11,12,250,22,184,8,2,15,6,25,25,112,97,116, -104,32,111,114,32,115,116,114,105,110,103,32,40,115,97,110,115,32,110,117,108, -41,23,197,2,28,28,23,195,2,28,27,248,22,191,12,23,197,2,28,23,193, -2,192,87,94,23,193,1,28,248,22,149,6,23,197,2,27,248,22,149,13,23, -198,2,28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,198,2,11,248, -22,149,13,23,196,2,11,10,12,250,22,184,8,2,15,6,29,29,35,102,32, -111,114,32,114,101,108,97,116,105,118,101,32,112,97,116,104,32,111,114,32,115, -116,114,105,110,103,23,198,2,28,28,248,22,149,13,23,195,2,91,159,38,11, -90,161,38,35,11,248,22,148,13,23,198,2,249,22,154,8,194,68,114,101,108, -97,116,105,118,101,11,27,248,22,166,7,6,4,4,80,65,84,72,251,2,50, -23,199,1,23,200,1,23,201,1,28,23,197,2,27,249,80,158,43,47,23,200, -1,9,28,249,22,154,8,247,22,168,7,2,21,249,22,63,248,22,136,13,5, -1,46,23,195,1,192,9,27,248,22,152,13,23,196,1,28,248,22,139,13,193, -250,2,51,198,199,195,11,250,80,158,38,48,196,197,11,250,80,158,38,48,196, -11,11,87,94,249,22,140,6,247,22,176,4,195,248,22,166,5,249,22,163,3, -35,249,22,147,3,197,198,27,28,23,197,2,87,95,23,196,1,23,195,1,23, -197,1,87,94,23,197,1,27,248,22,166,13,2,20,27,249,80,158,40,48,23, -196,1,11,27,27,248,22,166,3,23,200,1,28,192,192,35,27,27,248,22,166, -3,23,202,1,28,192,192,35,249,22,143,5,23,197,1,83,158,39,20,97,95, -89,162,8,44,35,47,9,224,3,2,33,57,23,195,1,23,196,1,27,248,22, -128,5,23,195,1,248,80,159,38,53,36,193,159,35,20,103,159,35,16,1,65, -98,101,103,105,110,16,0,83,158,41,20,100,138,67,35,37,117,116,105,108,115, -2,1,11,11,10,10,42,80,158,35,35,20,103,159,37,16,17,30,2,1,2, -2,193,30,2,1,2,3,193,30,2,1,2,4,193,30,2,1,2,5,193,30, -2,1,2,6,193,30,2,1,2,7,193,30,2,1,2,8,193,30,2,1,2, -9,193,30,2,1,2,10,193,30,2,1,2,11,193,30,2,1,2,12,193,30, -2,1,2,13,193,30,2,1,2,14,193,30,2,1,2,15,193,30,2,1,2, -16,193,30,2,18,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116,105, -111,110,45,107,101,121,4,30,2,18,1,23,101,120,116,101,110,100,45,112,97, -114,97,109,101,116,101,114,105,122,97,116,105,111,110,3,16,0,11,11,16,4, -2,6,2,5,2,3,2,9,39,11,38,35,11,11,16,11,2,8,2,7,2, -16,2,15,2,13,2,12,2,4,2,11,2,14,2,10,2,2,16,11,11,11, -11,11,11,11,11,11,11,11,11,16,11,2,8,2,7,2,16,2,15,2,13, -2,12,2,4,2,11,2,14,2,10,2,2,46,46,36,11,11,16,0,16,0, -16,0,35,35,11,11,11,16,0,16,0,16,0,35,35,16,0,16,17,83,158, -35,16,2,89,162,43,36,48,2,19,223,0,33,29,80,159,35,53,36,83,158, -35,16,2,89,162,8,44,36,55,2,19,223,0,33,30,80,159,35,52,36,83, -158,35,16,2,32,0,89,162,43,36,44,2,2,222,33,31,80,159,35,35,36, -83,158,35,16,2,249,22,151,6,7,92,7,92,80,159,35,36,36,83,158,35, -16,2,89,162,43,36,53,2,4,223,0,33,32,80,159,35,37,36,83,158,35, -16,2,32,0,89,162,8,44,37,49,2,5,222,33,33,80,159,35,38,36,83, -158,35,16,2,32,0,89,162,8,44,38,50,2,6,222,33,35,80,159,35,39, -36,83,158,35,16,2,89,162,8,45,37,47,2,7,223,0,33,37,80,159,35, -40,36,83,158,35,16,2,32,0,89,162,43,39,51,2,8,222,33,40,80,159, -35,41,36,83,158,35,16,2,32,0,89,162,43,38,49,2,9,222,33,41,80, -159,35,42,36,83,158,35,16,2,32,0,89,162,43,37,52,2,10,222,33,42, -80,159,35,43,36,83,158,35,16,2,32,0,89,162,43,37,53,2,11,222,33, -43,80,159,35,44,36,83,158,35,16,2,32,0,89,162,43,36,43,2,12,222, -33,44,80,159,35,45,36,83,158,35,16,2,83,158,38,20,96,95,2,13,89, -162,43,35,42,9,223,0,33,45,89,162,43,36,52,9,223,0,33,46,80,159, -35,46,36,83,158,35,16,2,27,248,22,173,13,248,22,160,7,27,28,249,22, -154,8,247,22,168,7,2,21,6,1,1,59,6,1,1,58,250,22,133,7,6, -14,14,40,91,94,126,97,93,42,41,126,97,40,46,42,41,23,196,2,23,196, -1,89,162,8,44,37,47,2,14,223,0,33,49,80,159,35,47,36,83,158,35, -16,2,83,158,38,20,96,96,2,15,89,162,8,44,38,53,9,223,0,33,54, -89,162,43,37,46,9,223,0,33,55,89,162,43,36,45,9,223,0,33,56,80, -159,35,48,36,83,158,35,16,2,89,162,43,38,51,2,16,223,0,33,58,80, -159,35,49,36,94,29,94,2,17,68,35,37,107,101,114,110,101,108,11,29,94, -2,17,69,35,37,109,105,110,45,115,116,120,11,9,9,9,35,0}; - EVAL_ONE_SIZED_STR((char *)expr, 5057); +220,10,227,10,102,11,115,11,70,12,172,12,185,12,207,12,159,13,63,14,134, +15,142,15,150,15,176,15,30,16,0,0,75,19,0,0,29,11,11,72,112,97, +116,104,45,115,116,114,105,110,103,63,64,98,115,98,115,76,110,111,114,109,97, +108,45,99,97,115,101,45,112,97,116,104,74,45,99,104,101,99,107,45,114,101, +108,112,97,116,104,77,45,99,104,101,99,107,45,99,111,108,108,101,99,116,105, +111,110,75,99,111,108,108,101,99,116,105,111,110,45,112,97,116,104,69,45,102, +105,110,100,45,99,111,108,77,99,104,101,99,107,45,115,117,102,102,105,120,45, +99,97,108,108,79,112,97,116,104,45,114,101,112,108,97,99,101,45,115,117,102, +102,105,120,75,112,97,116,104,45,97,100,100,45,115,117,102,102,105,120,77,108, +111,97,100,47,117,115,101,45,99,111,109,112,105,108,101,100,1,29,102,105,110, +100,45,108,105,98,114,97,114,121,45,99,111,108,108,101,99,116,105,111,110,45, +112,97,116,104,115,1,27,112,97,116,104,45,108,105,115,116,45,115,116,114,105, +110,103,45,62,112,97,116,104,45,108,105,115,116,1,20,102,105,110,100,45,101, +120,101,99,117,116,97,98,108,101,45,112,97,116,104,73,101,109,98,101,100,100, +101,100,45,108,111,97,100,65,113,117,111,116,101,29,94,2,17,68,35,37,112, +97,114,97,109,122,11,64,108,111,111,112,69,101,120,101,99,45,102,105,108,101, +67,119,105,110,100,111,119,115,6,25,25,112,97,116,104,32,111,114,32,118,97, +108,105,100,45,112,97,116,104,32,115,116,114,105,110,103,6,29,29,126,97,58, +32,105,110,118,97,108,105,100,32,114,101,108,97,116,105,118,101,32,112,97,116, +104,58,32,126,115,6,42,42,126,97,58,32,99,111,108,108,101,99,116,105,111, +110,32,110,111,116,32,102,111,117,110,100,58,32,126,115,32,105,110,32,97,110, +121,32,111,102,58,32,126,115,6,42,42,112,97,116,104,32,40,102,111,114,32, +97,110,121,32,115,121,115,116,101,109,41,32,111,114,32,118,97,108,105,100,45, +112,97,116,104,32,115,116,114,105,110,103,6,21,21,115,116,114,105,110,103,32, +111,114,32,98,121,116,101,32,115,116,114,105,110,103,6,36,36,99,97,110,110, +111,116,32,97,100,100,32,97,32,115,117,102,102,105,120,32,116,111,32,97,32, +114,111,111,116,32,112,97,116,104,58,32,5,0,27,20,14,159,80,158,36,50, +250,80,158,39,51,249,22,27,11,80,158,41,50,22,170,12,10,248,22,147,5, +23,196,2,28,248,22,144,6,23,194,2,12,87,94,248,22,157,8,23,194,1, +248,80,159,37,53,36,195,28,248,22,71,23,195,2,9,27,248,22,64,23,196, +2,27,28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195,2, +249,22,152,13,23,196,1,250,80,158,42,48,248,22,166,13,2,20,11,10,250, +80,158,40,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22,63, +248,22,154,13,249,22,152,13,23,198,1,247,22,167,13,27,248,22,65,23,200, +1,28,248,22,71,23,194,2,9,27,248,22,64,23,195,2,27,28,248,22,151, +13,23,195,2,23,194,1,28,248,22,150,13,23,195,2,249,22,152,13,23,196, +1,250,80,158,47,48,248,22,166,13,2,20,11,10,250,80,158,45,48,248,22, +166,13,2,20,23,197,1,10,28,23,193,2,249,22,63,248,22,154,13,249,22, +152,13,23,198,1,247,22,167,13,248,80,159,45,52,36,248,22,65,23,199,1, +87,94,23,193,1,248,80,159,43,52,36,248,22,65,23,197,1,87,94,23,193, +1,27,248,22,65,23,198,1,28,248,22,71,23,194,2,9,27,248,22,64,23, +195,2,27,28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195, +2,249,22,152,13,23,196,1,250,80,158,45,48,248,22,166,13,2,20,11,10, +250,80,158,43,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22, +63,248,22,154,13,249,22,152,13,23,198,1,247,22,167,13,248,80,159,43,52, +36,248,22,65,23,199,1,248,80,159,41,52,36,248,22,65,196,27,248,22,191, +12,23,195,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6,23,195, +2,27,248,22,149,13,195,28,192,192,248,22,150,13,195,11,87,94,28,28,248, +22,128,13,23,195,2,10,27,248,22,191,12,23,196,2,28,23,193,2,192,87, +94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28, +23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184, +8,76,110,111,114,109,97,108,45,112,97,116,104,45,99,97,115,101,6,42,42, +112,97,116,104,32,40,102,111,114,32,97,110,121,32,115,121,115,116,101,109,41, +32,111,114,32,118,97,108,105,100,45,112,97,116,104,32,115,116,114,105,110,103, +23,197,2,28,28,248,22,128,13,23,195,2,249,22,154,8,248,22,129,13,23, +197,2,2,21,249,22,154,8,247,22,168,7,2,21,27,28,248,22,149,6,23, +196,2,23,195,2,248,22,158,7,248,22,132,13,23,197,2,28,249,22,179,13, +0,21,35,114,120,34,94,91,92,92,93,91,92,92,93,91,63,93,91,92,92, +93,34,23,195,2,28,248,22,149,6,195,248,22,135,13,195,194,27,248,22,188, +6,23,195,1,249,22,136,13,248,22,161,7,250,22,185,13,0,6,35,114,120, +34,47,34,28,249,22,179,13,0,22,35,114,120,34,91,47,92,92,93,91,46, +32,93,43,91,47,92,92,93,42,36,34,23,201,2,23,199,1,250,22,185,13, +0,19,35,114,120,34,91,32,46,93,43,40,91,47,92,92,93,42,41,36,34, +23,202,1,6,2,2,92,49,80,158,43,36,2,21,28,248,22,149,6,194,248, +22,135,13,194,193,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192, +87,94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2, +28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22, +184,8,23,196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22, +146,11,249,22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201, +1,247,22,23,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87, +94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28, +23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184, +8,23,196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146, +11,249,22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201,1, +247,22,23,87,94,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192, +87,94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2, +28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22, +184,8,195,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11, +249,22,155,10,248,22,178,6,250,22,133,7,2,23,199,23,201,1,247,22,23, +249,22,3,89,162,8,44,36,49,9,223,2,33,34,196,248,22,146,11,249,22, +185,10,23,196,1,247,22,23,87,94,250,80,159,38,39,36,2,7,196,197,251, +80,159,39,41,36,2,7,32,0,89,162,8,44,36,44,9,222,33,36,197,198, +32,38,89,162,43,41,58,65,99,108,111,111,112,222,33,39,28,248,22,71,23, +199,2,87,94,23,198,1,248,23,196,1,251,22,133,7,2,24,23,199,1,28, +248,22,71,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,145,13,23, +204,1,23,205,1,23,198,1,27,249,22,145,13,248,22,64,23,202,2,23,199, +2,28,248,22,140,13,23,194,2,27,250,22,1,22,145,13,23,197,1,23,202, +2,28,248,22,140,13,23,194,2,192,87,94,23,193,1,27,248,22,65,23,202, +1,28,248,22,71,23,194,2,87,94,23,193,1,248,23,199,1,251,22,133,7, +2,24,23,202,1,28,248,22,71,23,206,2,87,94,23,205,1,23,204,1,250, +22,1,22,145,13,23,207,1,23,208,1,23,201,1,27,249,22,145,13,248,22, +64,23,197,2,23,202,2,28,248,22,140,13,23,194,2,27,250,22,1,22,145, +13,23,197,1,204,28,248,22,140,13,193,192,253,2,38,203,204,205,206,23,15, +248,22,65,201,253,2,38,202,203,204,205,206,248,22,65,200,87,94,23,193,1, +27,248,22,65,23,201,1,28,248,22,71,23,194,2,87,94,23,193,1,248,23, +198,1,251,22,133,7,2,24,23,201,1,28,248,22,71,23,205,2,87,94,23, +204,1,23,203,1,250,22,1,22,145,13,23,206,1,23,207,1,23,200,1,27, +249,22,145,13,248,22,64,23,197,2,23,201,2,28,248,22,140,13,23,194,2, +27,250,22,1,22,145,13,23,197,1,203,28,248,22,140,13,193,192,253,2,38, +202,203,204,205,206,248,22,65,201,253,2,38,201,202,203,204,205,248,22,65,200, +27,247,22,168,13,253,2,38,198,199,200,201,202,198,87,95,28,28,248,22,128, +13,23,194,2,10,27,248,22,191,12,23,195,2,28,23,193,2,192,87,94,23, +193,1,28,248,22,149,6,23,195,2,27,248,22,149,13,23,196,2,28,23,193, +2,192,87,94,23,193,1,248,22,150,13,23,196,2,11,12,252,22,184,8,23, +200,2,2,25,35,23,198,2,23,199,2,28,28,248,22,149,6,23,195,2,10, +248,22,137,7,23,195,2,87,94,23,194,1,12,252,22,184,8,23,200,2,2, +26,36,23,198,2,23,199,1,91,159,38,11,90,161,38,35,11,248,22,148,13, +23,197,2,87,94,23,195,1,87,94,28,192,12,250,22,185,8,23,201,1,2, +27,23,199,1,249,22,7,194,195,91,159,37,11,90,161,37,35,11,87,95,28, +28,248,22,128,13,23,196,2,10,27,248,22,191,12,23,197,2,28,23,193,2, +192,87,94,23,193,1,28,248,22,149,6,23,197,2,27,248,22,149,13,23,198, +2,28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,198,2,11,12,252, +22,184,8,2,10,2,25,35,23,200,2,23,201,2,28,28,248,22,149,6,23, +197,2,10,248,22,137,7,23,197,2,12,252,22,184,8,2,10,2,26,36,23, +200,2,23,201,2,91,159,38,11,90,161,38,35,11,248,22,148,13,23,199,2, +87,94,23,195,1,87,94,28,23,193,2,12,250,22,185,8,2,10,2,27,23, +201,2,249,22,7,23,195,1,23,196,1,27,249,22,137,13,250,22,184,13,0, +18,35,114,120,35,34,40,91,46,93,91,94,46,93,42,124,41,36,34,248,22, +133,13,23,201,1,28,248,22,149,6,23,203,2,249,22,161,7,23,204,1,8, +63,23,202,1,28,248,22,128,13,23,199,2,248,22,129,13,23,199,1,87,94, +23,198,1,247,22,130,13,28,248,22,191,12,194,249,22,145,13,195,194,192,91, +159,37,11,90,161,37,35,11,87,95,28,28,248,22,128,13,23,196,2,10,27, +248,22,191,12,23,197,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149, +6,23,197,2,27,248,22,149,13,23,198,2,28,23,193,2,192,87,94,23,193, +1,248,22,150,13,23,198,2,11,12,252,22,184,8,2,11,2,25,35,23,200, +2,23,201,2,28,28,248,22,149,6,23,197,2,10,248,22,137,7,23,197,2, +12,252,22,184,8,2,11,2,26,36,23,200,2,23,201,2,91,159,38,11,90, +161,38,35,11,248,22,148,13,23,199,2,87,94,23,195,1,87,94,28,23,193, +2,12,250,22,185,8,2,11,2,27,23,201,2,249,22,7,23,195,1,23,196, +1,27,249,22,137,13,249,22,147,7,250,22,185,13,0,9,35,114,120,35,34, +91,46,93,34,248,22,133,13,23,203,1,6,1,1,95,28,248,22,149,6,23, +202,2,249,22,161,7,23,203,1,8,63,23,201,1,28,248,22,128,13,23,199, +2,248,22,129,13,23,199,1,87,94,23,198,1,247,22,130,13,28,248,22,191, +12,194,249,22,145,13,195,194,192,249,247,22,180,4,194,11,249,80,158,37,46, +9,9,249,80,158,37,46,195,9,27,247,22,170,13,249,80,158,38,47,28,23, +195,2,27,248,22,166,7,6,11,11,80,76,84,67,79,76,76,69,67,84,83, +28,192,192,6,0,0,6,0,0,27,28,23,196,1,250,22,145,13,248,22,166, +13,69,97,100,100,111,110,45,100,105,114,247,22,164,7,6,8,8,99,111,108, +108,101,99,116,115,11,27,248,80,159,41,52,36,250,22,77,23,203,1,248,22, +73,248,22,166,13,72,99,111,108,108,101,99,116,115,45,100,105,114,23,204,1, +28,23,194,2,249,22,63,23,196,1,23,195,1,192,32,48,89,162,8,44,38, +54,2,19,222,33,49,27,249,22,177,13,23,197,2,23,198,2,28,23,193,2, +87,94,23,196,1,27,248,22,88,23,195,2,27,27,248,22,97,23,197,1,27, +249,22,177,13,23,201,2,23,196,2,28,23,193,2,87,94,23,194,1,27,248, +22,88,23,195,2,27,250,2,48,23,203,2,23,204,1,248,22,97,23,199,1, +28,249,22,143,7,23,196,2,2,28,249,22,77,23,202,2,194,249,22,63,248, +22,136,13,23,197,1,23,195,1,87,95,23,199,1,23,193,1,28,249,22,143, +7,23,196,2,2,28,249,22,77,23,200,2,9,249,22,63,248,22,136,13,23, +197,1,9,28,249,22,143,7,23,196,2,2,28,249,22,77,197,194,87,94,23, +196,1,249,22,63,248,22,136,13,23,197,1,194,87,94,23,193,1,28,249,22, +143,7,23,198,2,2,28,249,22,77,195,9,87,94,23,194,1,249,22,63,248, +22,136,13,23,199,1,9,87,95,28,28,248,22,137,7,194,10,248,22,149,6, +194,12,250,22,184,8,2,14,6,21,21,98,121,116,101,32,115,116,114,105,110, +103,32,111,114,32,115,116,114,105,110,103,196,28,28,248,22,72,195,249,22,4, +22,191,12,196,11,12,250,22,184,8,2,14,6,13,13,108,105,115,116,32,111, +102,32,112,97,116,104,115,197,250,2,48,197,195,28,248,22,149,6,197,248,22, +160,7,197,196,32,51,89,162,8,44,39,57,2,19,222,33,54,32,52,89,162, +8,44,38,54,70,102,111,117,110,100,45,101,120,101,99,222,33,53,28,23,193, +2,91,159,38,11,90,161,38,35,11,248,22,148,13,23,199,2,87,95,23,195, +1,23,194,1,27,28,23,198,2,27,248,22,153,13,23,201,2,28,249,22,156, +8,23,195,2,23,202,2,11,28,248,22,149,13,23,194,2,250,2,52,23,201, +2,23,202,2,249,22,145,13,23,200,2,23,198,1,250,2,52,23,201,2,23, +202,2,23,196,1,11,28,23,193,2,192,87,94,23,193,1,27,28,248,22,191, +12,23,196,2,27,249,22,145,13,23,198,2,23,201,2,28,28,248,22,140,13, +193,10,248,22,139,13,193,192,11,11,28,23,193,2,192,87,94,23,193,1,28, +23,199,2,11,27,248,22,153,13,23,202,2,28,249,22,156,8,23,195,2,23, +203,1,11,28,248,22,149,13,23,194,2,250,2,52,23,202,1,23,203,1,249, +22,145,13,23,201,1,23,198,1,250,2,52,201,202,195,194,28,248,22,71,23, +197,2,11,27,248,22,152,13,248,22,64,23,199,2,27,249,22,145,13,23,196, +1,23,197,2,28,248,22,139,13,23,194,2,250,2,52,198,199,195,87,94,23, +193,1,27,248,22,65,23,200,1,28,248,22,71,23,194,2,11,27,248,22,152, +13,248,22,64,23,196,2,27,249,22,145,13,23,196,1,23,200,2,28,248,22, +139,13,23,194,2,250,2,52,201,202,195,87,94,23,193,1,27,248,22,65,23, +197,1,28,248,22,71,23,194,2,11,27,248,22,152,13,248,22,64,195,27,249, +22,145,13,23,196,1,202,28,248,22,139,13,193,250,2,52,204,205,195,251,2, +51,204,205,206,248,22,65,199,87,95,28,27,248,22,191,12,23,196,2,28,23, +193,2,192,87,94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13, +23,197,2,28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11, +12,250,22,184,8,2,15,6,25,25,112,97,116,104,32,111,114,32,115,116,114, +105,110,103,32,40,115,97,110,115,32,110,117,108,41,23,197,2,28,28,23,195, +2,28,27,248,22,191,12,23,197,2,28,23,193,2,192,87,94,23,193,1,28, +248,22,149,6,23,197,2,27,248,22,149,13,23,198,2,28,23,193,2,192,87, +94,23,193,1,248,22,150,13,23,198,2,11,248,22,149,13,23,196,2,11,10, +12,250,22,184,8,2,15,6,29,29,35,102,32,111,114,32,114,101,108,97,116, +105,118,101,32,112,97,116,104,32,111,114,32,115,116,114,105,110,103,23,198,2, +28,28,248,22,149,13,23,195,2,91,159,38,11,90,161,38,35,11,248,22,148, +13,23,198,2,249,22,154,8,194,68,114,101,108,97,116,105,118,101,11,27,248, +22,166,7,6,4,4,80,65,84,72,251,2,51,23,199,1,23,200,1,23,201, +1,28,23,197,2,27,249,80,158,43,47,23,200,1,9,28,249,22,154,8,247, +22,168,7,2,21,249,22,63,248,22,136,13,5,1,46,23,195,1,192,9,27, +248,22,152,13,23,196,1,28,248,22,139,13,193,250,2,52,198,199,195,11,250, +80,158,38,48,196,197,11,250,80,158,38,48,196,11,11,87,94,249,22,140,6, +247,22,176,4,195,248,22,166,5,249,22,163,3,35,249,22,147,3,197,198,27, +28,23,197,2,87,95,23,196,1,23,195,1,23,197,1,87,94,23,197,1,27, +248,22,166,13,2,20,27,249,80,158,40,48,23,196,1,11,27,27,248,22,166, +3,23,200,1,28,192,192,35,27,27,248,22,166,3,23,202,1,28,192,192,35, +249,22,143,5,23,197,1,83,158,39,20,97,95,89,162,8,44,35,47,9,224, +3,2,33,58,23,195,1,23,196,1,27,248,22,128,5,23,195,1,248,80,159, +38,53,36,193,159,35,20,103,159,35,16,1,65,98,101,103,105,110,16,0,83, +158,41,20,100,138,67,35,37,117,116,105,108,115,2,1,11,11,10,10,42,80, +158,35,35,20,103,159,37,16,17,30,2,1,2,2,193,30,2,1,2,3,193, +30,2,1,2,4,193,30,2,1,2,5,193,30,2,1,2,6,193,30,2,1, +2,7,193,30,2,1,2,8,193,30,2,1,2,9,193,30,2,1,2,10,193, +30,2,1,2,11,193,30,2,1,2,12,193,30,2,1,2,13,193,30,2,1, +2,14,193,30,2,1,2,15,193,30,2,1,2,16,193,30,2,18,1,20,112, +97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,45,107,101,121,4,30, +2,18,1,23,101,120,116,101,110,100,45,112,97,114,97,109,101,116,101,114,105, +122,97,116,105,111,110,3,16,0,11,11,16,4,2,6,2,5,2,3,2,9, +39,11,38,35,11,11,16,11,2,8,2,7,2,16,2,15,2,13,2,12,2, +4,2,11,2,14,2,10,2,2,16,11,11,11,11,11,11,11,11,11,11,11, +11,16,11,2,8,2,7,2,16,2,15,2,13,2,12,2,4,2,11,2,14, +2,10,2,2,46,46,36,11,11,16,0,16,0,16,0,35,35,11,11,11,16, +0,16,0,16,0,35,35,16,0,16,17,83,158,35,16,2,89,162,43,36,48, +2,19,223,0,33,29,80,159,35,53,36,83,158,35,16,2,89,162,8,44,36, +55,2,19,223,0,33,30,80,159,35,52,36,83,158,35,16,2,32,0,89,162, +43,36,44,2,2,222,33,31,80,159,35,35,36,83,158,35,16,2,249,22,151, +6,7,92,7,92,80,159,35,36,36,83,158,35,16,2,89,162,43,36,53,2, +4,223,0,33,32,80,159,35,37,36,83,158,35,16,2,32,0,89,162,8,44, +37,49,2,5,222,33,33,80,159,35,38,36,83,158,35,16,2,32,0,89,162, +8,44,38,50,2,6,222,33,35,80,159,35,39,36,83,158,35,16,2,89,162, +8,45,37,47,2,7,223,0,33,37,80,159,35,40,36,83,158,35,16,2,32, +0,89,162,43,39,51,2,8,222,33,40,80,159,35,41,36,83,158,35,16,2, +32,0,89,162,43,38,49,2,9,222,33,41,80,159,35,42,36,83,158,35,16, +2,32,0,89,162,43,37,52,2,10,222,33,42,80,159,35,43,36,83,158,35, +16,2,32,0,89,162,43,37,53,2,11,222,33,43,80,159,35,44,36,83,158, +35,16,2,32,0,89,162,43,36,43,2,12,222,33,44,80,159,35,45,36,83, +158,35,16,2,83,158,38,20,96,96,2,13,89,162,43,35,43,9,223,0,33, +45,89,162,43,36,44,9,223,0,33,46,89,162,43,37,54,9,223,0,33,47, +80,159,35,46,36,83,158,35,16,2,27,248,22,173,13,248,22,160,7,27,28, +249,22,154,8,247,22,168,7,2,21,6,1,1,59,6,1,1,58,250,22,133, +7,6,14,14,40,91,94,126,97,93,42,41,126,97,40,46,42,41,23,196,2, +23,196,1,89,162,8,44,37,47,2,14,223,0,33,50,80,159,35,47,36,83, +158,35,16,2,83,158,38,20,96,96,2,15,89,162,8,44,38,53,9,223,0, +33,55,89,162,43,37,46,9,223,0,33,56,89,162,43,36,45,9,223,0,33, +57,80,159,35,48,36,83,158,35,16,2,89,162,43,38,51,2,16,223,0,33, +59,80,159,35,49,36,94,29,94,2,17,68,35,37,107,101,114,110,101,108,11, +29,94,2,17,69,35,37,109,105,110,45,115,116,120,11,9,9,9,35,0}; + EVAL_ONE_SIZED_STR((char *)expr, 5080); } { - static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,48,46,52,8,0,0,0,1,0,0,6,0,19,0, + static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,49,46,49,8,0,0,0,1,0,0,6,0,19,0, 34,0,48,0,62,0,76,0,111,0,0,0,255,0,0,0,65,113,117,111,116, 101,29,94,2,1,67,35,37,117,116,105,108,115,11,29,94,2,1,69,35,37, 110,101,116,119,111,114,107,11,29,94,2,1,68,35,37,112,97,114,97,109,122, 11,29,94,2,1,68,35,37,101,120,112,111,98,115,11,29,94,2,1,68,35, -37,107,101,114,110,101,108,11,98,10,35,11,8,149,227,97,159,2,2,35,35, +37,107,101,114,110,101,108,11,98,10,35,11,8,176,229,97,159,2,2,35,35, 159,2,3,35,35,159,2,4,35,35,159,2,5,35,35,159,2,6,35,35,16, 0,159,35,20,103,159,35,16,1,65,98,101,103,105,110,16,0,83,158,41,20, 100,138,69,35,37,98,117,105,108,116,105,110,29,11,11,11,10,10,18,96,11, @@ -360,7 +361,7 @@ EVAL_ONE_SIZED_STR((char *)expr, 292); } { - static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,48,46,52,52,0,0,0,1,0,0,3,0,14,0, + static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,49,46,49,46,49,52,0,0,0,1,0,0,3,0,14,0, 41,0,47,0,60,0,74,0,96,0,122,0,134,0,152,0,172,0,184,0,200, 0,223,0,3,1,8,1,13,1,18,1,23,1,54,1,58,1,66,1,74,1, 82,1,185,1,230,1,250,1,29,2,64,2,98,2,108,2,155,2,165,2,172, diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index e9270db361..1f6e7c342f 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -9367,7 +9367,7 @@ Scheme_Object *scheme_eval_string_multi_with_prompt(const char *str, Scheme_Env return do_eval_string_all(str, env, 0, 1); } -void scheme_init_collection_paths(Scheme_Env *global_env, Scheme_Object *extra_dirs) +void scheme_init_collection_paths_post(Scheme_Env *global_env, Scheme_Object *extra_dirs, Scheme_Object *post_dirs) { mz_jmp_buf * volatile save, newbuf; Scheme_Thread * volatile p; @@ -9375,20 +9375,26 @@ void scheme_init_collection_paths(Scheme_Env *global_env, Scheme_Object *extra_d save = p->error_buf; p->error_buf = &newbuf; if (!scheme_setjmp(newbuf)) { - Scheme_Object *clcp, *flcp, *a[1]; + Scheme_Object *clcp, *flcp, *a[2]; clcp = scheme_builtin_value("current-library-collection-paths"); flcp = scheme_builtin_value("find-library-collection-paths"); if (clcp && flcp) { a[0] = extra_dirs; - a[0] = _scheme_apply(flcp, 1, a); + a[1] = post_dirs; + a[0] = _scheme_apply(flcp, 2, a); _scheme_apply(clcp, 1, a); } } p->error_buf = save; } +void scheme_init_collection_paths(Scheme_Env *global_env, Scheme_Object *extra_dirs) +{ + scheme_init_collection_paths_post(global_env, extra_dirs, scheme_null); +} + static Scheme_Object *allow_set_undefined(int argc, Scheme_Object **argv) { return scheme_param_config("compile-allow-set!-undefined", diff --git a/src/mzscheme/src/hash.c b/src/mzscheme/src/hash.c index f919a5ae35..6bc883b48c 100644 --- a/src/mzscheme/src/hash.c +++ b/src/mzscheme/src/hash.c @@ -55,8 +55,10 @@ long PTR_TO_LONG(Scheme_Object *o) #ifdef OBJHEAD_HAS_HASH_BITS /* In 3m mode, we only have 14 bits of hash code in the Scheme_Object header. But the GC-level object header has some - leftover bits (currently 9 or 41, depending on the platform), - so use those, too. */ + leftover bits (currently 9, 11, 41, or 43, depending on the + platform), so use those, too. That only works for GCable + objects, so we use 1 of our 14 bits to indicate whether the + other bit are present. */ if (GC_is_allocated(o)) { OBJHEAD_HASH_BITS(o) = (keygen >> 16); v |= 0x4000; diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index a625964682..002049abba 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -48,8 +48,7 @@ # define _CALL_DARWIN #endif -/* Separate JIT_PRECISE_GC lets us test some 3m support - in non-3m mode: */ +/* Separate JIT_PRECISE_GC lets us test some 3m support in non-3m mode: */ #ifdef MZ_PRECISE_GC # define JIT_PRECISE_GC #endif @@ -396,13 +395,13 @@ static void *generate_one(mz_jit_state *old_jitter, padding = 0; if (gcable) { #ifdef MZ_PRECISE_GC - buffer = malloc(size); + buffer = scheme_malloc_code(size); scheme_jit_malloced += size_pre_retained; #else - buffer = scheme_malloc(size); + buffer = scheme_malloc_gcable_code(size); #endif } else { - buffer = malloc(size); + buffer = scheme_malloc_code(size); } RECORD_CODE_SIZE(size); } else if (old_jitter) { @@ -7880,7 +7879,7 @@ static void release_native_code(void *fnlized, void *p) /* Remove name mapping: */ add_symbol((unsigned long)p, (unsigned long)p + SCHEME_INT_VAL(len), NULL, 0); /* Free memory: */ - free(p); + scheme_free_code(p); jit_notify_freed_code(); } #endif diff --git a/src/mzscheme/src/lightning/i386/funcs.h b/src/mzscheme/src/lightning/i386/funcs.h index 129480fa92..4901b4c16e 100644 --- a/src/mzscheme/src/lightning/i386/funcs.h +++ b/src/mzscheme/src/lightning/i386/funcs.h @@ -34,87 +34,14 @@ #ifndef __lightning_funcs_h #define __lightning_funcs_h -#ifdef MZ_JIT_USE_MPROTECT -# include -# include -#endif -#ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC -# include -#endif - -#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) -static unsigned long jit_prev_page = 0, jit_prev_length = 0; -#endif - static void jit_notify_freed_code(void) { -#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) - jit_prev_page = jit_prev_length = 0; -#endif } static void jit_flush_code(void *dest, void *end) { - /* On the x86, the PROT_EXEC bits are not handled by the MMU. - However, the kernel can emulate this by setting the code - segment's limit to the end address of the highest page - whose PROT_EXEC bit is set. - - Linux kernels that do so and that disable by default the - execution of the data and stack segment are becoming more - and more common (Fedora, for example), so we implement our - jit_flush_code as an mprotect. */ -#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) - unsigned long page, length; -# ifdef PAGESIZE - const long page_size = PAGESIZE; -# else - static unsigned long page_size = -1; - if (page_size == -1) { -# ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC - SYSTEM_INFO info; - GetSystemInfo(&info); - page_size = info.dwPageSize; -# else - page_size = sysconf (_SC_PAGESIZE); -# endif - } -# endif - - page = (long) dest & ~(page_size - 1); - length = ((char *) end - (char *) page + page_size - 1) & ~(page_size - 1); - - /* Simple-minded attempt at optimizing the common case where a single - chunk of memory is used to compile multiple functions. */ - if (page >= jit_prev_page && page + length <= jit_prev_page + jit_prev_length) - return; - -# ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC - { - DWORD old; - VirtualProtect((void *)page, length, PAGE_EXECUTE_READWRITE, &old); - } -# else - mprotect ((void *) page, length, PROT_READ | PROT_WRITE | PROT_EXEC); -# endif - - /* See if we can extend the previously mprotect'ed memory area towards - higher addresses: the starting address remains the same as before. */ - if (page >= jit_prev_page && page <= jit_prev_page + jit_prev_length) - jit_prev_length = page + length - jit_prev_page; - - /* See if we can extend the previously mprotect'ed memory area towards - lower addresses: the highest address remains the same as before. */ - else if (page < jit_prev_page && page + length >= jit_prev_page - && page + length <= jit_prev_page + jit_prev_length) - jit_prev_length += jit_prev_page - page, jit_prev_page = page; - - /* Nothing to do, replace the area. */ - else - jit_prev_page = page, jit_prev_length = length; -#endif } #endif /* __lightning_funcs_h */ diff --git a/src/mzscheme/src/lightning/ppc/funcs.h b/src/mzscheme/src/lightning/ppc/funcs.h index f19a05bf9a..5c0ea813f0 100644 --- a/src/mzscheme/src/lightning/ppc/funcs.h +++ b/src/mzscheme/src/lightning/ppc/funcs.h @@ -71,7 +71,7 @@ jit_flush_code(void *start, void *end) } start -= ((long) start) & (cache_line_size - 1); - end -= ((long) end) & (cache_line_size - 1); + end -= ((long) end - 1) & (cache_line_size - 1); /* Force data cache write-backs */ for (ddest = (char *) start; ddest <= (char *) end; ddest += cache_line_size) { diff --git a/src/mzscheme/src/salloc.c b/src/mzscheme/src/salloc.c index 44e2d9131e..1f17ee6399 100644 --- a/src/mzscheme/src/salloc.c +++ b/src/mzscheme/src/salloc.c @@ -39,6 +39,17 @@ # define MALLOC malloc #endif +#ifdef MZ_JIT_USE_MPROTECT +# include +# include +# ifndef MAP_ANON +# include +# endif +#endif +#ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC +# include +#endif + static void **dgc_array; static int *dgc_count; static int dgc_size; @@ -57,12 +68,16 @@ extern MZ_DLLIMPORT void GC_register_late_disappearing_link(void **link, void *o static int use_registered_statics; +/************************************************************************/ +/* stack setup */ +/************************************************************************/ + #if !defined(MZ_PRECISE_GC) && !defined(USE_SENORA_GC) extern MZ_DLLIMPORT void GC_init(); extern MZ_DLLIMPORT unsigned long GC_get_stack_base(); #endif -void scheme_set_primordial_stack_base(void *base, int no_auto_statics) +void scheme_set_stack_base(void *base, int no_auto_statics) { #ifdef MZ_PRECISE_GC GC_init_type_tags(_scheme_last_type_, @@ -132,7 +147,7 @@ int scheme_main_stack_setup(int no_auto_statics, Scheme_Nested_Main _main, void void *stack_start; int volatile return_code; - scheme_set_primordial_stack_base(PROMPT_STACK(stack_start), no_auto_statics); + scheme_set_stack_base(PROMPT_STACK(stack_start), no_auto_statics); return_code = _main(data); @@ -144,9 +159,9 @@ int scheme_main_stack_setup(int no_auto_statics, Scheme_Nested_Main _main, void return return_code; } -void scheme_set_primordial_stack_bounds(void *base, void *deepest, int no_auto_statics) +void scheme_set_stack_bounds(void *base, void *deepest, int no_auto_statics) { - scheme_set_primordial_stack_base(base, no_auto_statics); + scheme_set_stack_base(base, no_auto_statics); #ifdef USE_STACK_BOUNDARY_VAR if (deepest) { @@ -165,6 +180,9 @@ extern unsigned long scheme_get_stack_base() return (unsigned long)GC_get_stack_base(); } +/************************************************************************/ +/* memory utils */ +/************************************************************************/ void scheme_dont_gc_ptr(void *p) { @@ -286,6 +304,10 @@ scheme_strdup_eternal(const char *str) return naya; } +/************************************************************************/ +/* cptr */ +/************************************************************************/ + Scheme_Object *scheme_make_cptr(void *cptr, Scheme_Object *typetag) { Scheme_Object *o; @@ -311,6 +333,10 @@ Scheme_Object *scheme_make_offset_cptr(void *cptr, long offset, Scheme_Object *t return o; } +/************************************************************************/ +/* allocation */ +/************************************************************************/ + #ifndef MZ_PRECISE_GC static Scheme_Hash_Table *immobiles; #endif @@ -531,6 +557,395 @@ void *scheme_malloc_uncollectable_tagged(size_t s) #endif +/************************************************************************/ +/* code allocation */ +/************************************************************************/ + +/* We're not supposed to use mprotect() or VirtualProtect() on memory + from malloc(); Posix says that mprotect() only works on memory from + mmap(), and VirtualProtect() similarly requires alignment with a + corresponding VirtualAlloc. So we implement a little allocator here + for code chunks. */ + +#ifdef MZ_PRECISE_GC +START_XFORM_SKIP; +#endif + +/* Max of desired alignment and 2 * sizeof(long): */ +#define CODE_HEADER_SIZE 16 + +long scheme_code_page_total; + +#if defined(MZ_JIT_USE_MPROTECT) && !defined(MAP_ANON) +static int fd, fd_created; +#endif + +#define LOG_CODE_MALLOC(lvl, s) /* if (lvl > 1) s */ +#define CODE_PAGE_OF(p) ((void *)(((unsigned long)p) & ~(page_size - 1))) + +#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) + +struct free_list_entry { + long size; /* size of elements in this bucket */ + void *elems; /* doubly linked list for free blocks */ + int count; /* number of items in `elems' */ +}; + +static struct free_list_entry *free_list; +static int free_list_bucket_count; + +static long get_page_size() +{ +# ifdef PAGESIZE + const long page_size = PAGESIZE; +# else + static unsigned long page_size = -1; + if (page_size == -1) { +# ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC + SYSTEM_INFO info; + GetSystemInfo(&info); + page_size = info.dwPageSize; +# else + page_size = sysconf (_SC_PAGESIZE); +# endif + } +# endif + + return page_size; +} + +static void *malloc_page(long size) +{ + void *r; + +#ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC + { + DWORD old; + r = (void *)VirtualAlloc(NULL, size, + MEM_COMMIT | MEM_RESERVE, + /* A note in gc/os_dep.c says that VirtualAlloc + doesn't like PAGE_EXECUTE_READWRITE. In case + that's true, we use a separate VirtualProtect step. */ + PAGE_READWRITE); + if (r) + VirtualProtect(r, size, PAGE_EXECUTE_READWRITE, &old); + } +#else +# ifdef MAP_ANON + r = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0); +# else + if (!fd_created) { + fd_created = 1; + fd = open("/dev/zero", O_RDWR); + } + r = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); +# endif + if (r == (void *)-1) + r = NULL; +#endif + + if (!r) + scheme_raise_out_of_memory(NULL, NULL); + + return r; +} + +static void free_page(void *p, long size) +{ +#ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC + VirtualFree(p, 0, MEM_RELEASE); +#else + munmap(p, size); +#endif +} + +static void init_free_list() +{ + long page_size = get_page_size(); + int pos = 0; + int cnt = 2; + long last_v = page_size, v; + + /* Compute size that fits 2 objects per page, then 3 per page, etc. + Keeping CODE_HEADER_SIZE alignment gives us a small number of + buckets. */ + while (1) { + v = (page_size - CODE_HEADER_SIZE) / cnt; + v = (v / CODE_HEADER_SIZE) * CODE_HEADER_SIZE; + if (v != last_v) { + free_list[pos].size = v; + free_list[pos].elems = NULL; + free_list[pos].count = 0; + last_v = v; + pos++; + if (v == CODE_HEADER_SIZE) + break; + } + cnt++; + } + + free_list_bucket_count = pos; +} + +static long free_list_find_bucket(long size) +{ + /* binary search */ + int lo = 0, hi = free_list_bucket_count - 1, mid; + + while (lo + 1 < hi) { + mid = (lo + hi) / 2; + if (free_list[mid].size > size) { + lo = mid; + } else { + hi = mid; + } + } + + if (free_list[hi].size == size) + return hi; + else + return lo; +} +#endif + +void *scheme_malloc_code(long size) +{ +#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) + long size2, bucket, sz, page_size; + void *p, *pg, *prev; + + if (size < CODE_HEADER_SIZE) { + /* ensure CODE_HEADER_SIZE alignment + and room for free-list pointers */ + size = CODE_HEADER_SIZE; + } + + page_size = get_page_size(); + + if (!free_list) { + free_list = (struct free_list_entry *)malloc_page(page_size); + scheme_code_page_total += page_size; + init_free_list(); + } + + if (size > free_list[0].size) { + /* allocate large object on its own page(s) */ + sz = size + CODE_HEADER_SIZE; + sz = (sz + page_size - 1) & ~(page_size - 1); + pg = malloc_page(sz); + scheme_code_page_total += sz; + *(long *)pg = sz; + LOG_CODE_MALLOC(1, printf("allocated large %p (%ld) [now %ld]\n", + pg, size + CODE_HEADER_SIZE, scheme_code_page_total)); + return ((char *)pg) + CODE_HEADER_SIZE; + } + + bucket = free_list_find_bucket(size); + size2 = free_list[bucket].size; + + if (!free_list[bucket].elems) { + /* add a new page's worth of items to the free list */ + int i, count = 0; + pg = malloc_page(page_size); + scheme_code_page_total += page_size; + LOG_CODE_MALLOC(2, printf("new page for %ld / %ld at %p [now %ld]\n", + size2, bucket, pg, scheme_code_page_total)); + sz = page_size - size2; + for (i = CODE_HEADER_SIZE; i <= sz; i += size2) { + p = ((char *)pg) + i; + prev = free_list[bucket].elems; + ((void **)p)[0] = prev; + ((void **)p)[1] = NULL; + if (prev) + ((void **)prev)[1] = p; + free_list[bucket].elems = p; + count++; + } + ((long *)pg)[0] = bucket; /* first long of page indicates bucket */ + ((long *)pg)[1] = 0; /* second long indicates number of allocated on page */ + free_list[bucket].count = count; + } + + p = free_list[bucket].elems; + prev = ((void **)p)[0]; + free_list[bucket].elems = prev; + --free_list[bucket].count; + if (prev) + ((void **)prev)[1] = NULL; + ((long *)CODE_PAGE_OF(p))[1] += 1; + + LOG_CODE_MALLOC(0, printf("allocated %ld (->%ld / %ld)\n", size, size2, bucket)); + + return p; +#else + return malloc(size); /* good luck! */ +#endif +} + +void scheme_free_code(void *p) +{ +#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) + long size, size2, bucket, page_size; + int per_page, n; + void *prev; + + page_size = get_page_size(); + + size = *(long *)CODE_PAGE_OF(p); + + if (size >= page_size) { + /* it was a large object on its own page(s) */ + scheme_code_page_total -= size; + LOG_CODE_MALLOC(1, printf("freeing large %p (%ld) [%ld left]\n", + p, size, scheme_code_page_total)); + free_page((char *)p - CODE_HEADER_SIZE, size); + return; + } + + bucket = size; + + if ((bucket < 0) || (bucket >= free_list_bucket_count)) { + printf("bad free: %p\n", (char *)p + CODE_HEADER_SIZE); + abort(); + } + + size2 = free_list[bucket].size; + + LOG_CODE_MALLOC(0, printf("freeing %ld / %ld\n", size2, bucket)); + + /* decrement alloc count for this page: */ + per_page = (page_size - CODE_HEADER_SIZE) / size2; + n = ((long *)CODE_PAGE_OF(p))[1]; + /* double-check: */ + if ((n < 1) || (n > per_page)) { + printf("bad free: %p\n", (char *)p + CODE_HEADER_SIZE); + abort(); + } + n--; + ((long *)CODE_PAGE_OF(p))[1] = n; + + /* add to free list: */ + prev = free_list[bucket].elems; + ((void **)p)[0] = prev; + ((void **)p)[1] = NULL; + if (prev) + ((void **)prev)[1] = p; + free_list[bucket].elems = p; + free_list[bucket].count++; + + /* Free whole page if it's completely on the free list, and if there + are enough buckets on other pages. */ + if ((n == 0) && ((free_list[bucket].count - per_page) >= (per_page / 2))) { + /* remove same-page elements from free list, then free page */ + int i; + long sz; + void *pg; + + sz = page_size - size2; + pg = CODE_PAGE_OF(p); + for (i = CODE_HEADER_SIZE; i <= sz; i += size2) { + p = ((char *)pg) + i; + prev = ((void **)p)[1]; + if (prev) + ((void **)prev)[0] = ((void **)p)[0]; + else + free_list[bucket].elems = ((void **)p)[0]; + prev = ((void **)p)[0]; + if (prev) + ((void **)prev)[1] = ((void **)p)[1]; + --free_list[bucket].count; + } + + scheme_code_page_total -= page_size; + LOG_CODE_MALLOC(2, printf("freeing page at %p [%ld left]\n", + CODE_PAGE_OF(p), scheme_code_page_total)); + free_page(CODE_PAGE_OF(p), page_size); + } +#else + free(p); +#endif +} + +#ifndef MZ_PRECISE_GC + +/* When using the CGC allocator, we know how GCable memory is + allocated, and we expect mprotect(), etc., to work on it. The JIT + currently takes advantage of that combination, so we support it + with scheme_malloc_gcable_code() --- but only in CGC mode. */ + +#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) +static unsigned long jit_prev_page = 0, jit_prev_length = 0; +#endif + +void *scheme_malloc_gcable_code(long size) +{ + void *p; + p = scheme_malloc(size); + +#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) + { + /* [This chunk of code moved from our copy of GNU lightning to here.] */ + unsigned long page, length, page_size; + void *end; + + page_size = get_page_size(); + + end = ((char *)p) + size; + + page = (long) p & ~(page_size - 1); + length = ((char *) end - (char *) page + page_size - 1) & ~(page_size - 1); + + /* Simple-minded attempt at optimizing the common case where a single + chunk of memory is used to compile multiple functions. */ + if (!(page >= jit_prev_page && page + length <= jit_prev_page + jit_prev_length)) { + +# ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC + { + DWORD old; + VirtualProtect((void *)page, length, PAGE_EXECUTE_READWRITE, &old); + } +# else + mprotect ((void *) page, length, PROT_READ | PROT_WRITE | PROT_EXEC); +# endif + + /* See if we can extend the previously mprotect'ed memory area towards + higher addresses: the starting address remains the same as before. */ + if (page >= jit_prev_page && page <= jit_prev_page + jit_prev_length) + jit_prev_length = page + length - jit_prev_page; + + /* See if we can extend the previously mprotect'ed memory area towards + lower addresses: the highest address remains the same as before. */ + else if (page < jit_prev_page && page + length >= jit_prev_page + && page + length <= jit_prev_page + jit_prev_length) + jit_prev_length += jit_prev_page - page, jit_prev_page = page; + + /* Nothing to do, replace the area. */ + else + jit_prev_page = page, jit_prev_length = length; + } + } +#endif + + return p; +} + +void scheme_notify_code_gc() +{ +#if defined(MZ_JIT_USE_MPROTECT) || defined(MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC) + jit_prev_page = 0; + jit_prev_length = 0; +#endif +} +#endif + +#ifdef MZ_PRECISE_GC +END_XFORM_SKIP; +#endif + +/************************************************************************/ +/* finalization */ +/************************************************************************/ + typedef struct Finalization { MZTAG_IF_REQUIRED void (*f)(void *o, void *data); @@ -812,31 +1227,9 @@ unsigned long scheme_get_deeper_address(void) return (unsigned long)vp; } - - -#ifdef DOS_MEMORY - -int scheme_same_pointer(void *a, void *b) -{ - long as, ao, bs, bo, areal, breal; - - as = FP_SEG(a); - ao = FP_OFF(a); - bs = FP_SEG(b); - bo = FP_SEG(b); - - areal = (as << 4) + ao; - breal = (bs << 4) + bo; - - return areal == breal; -} - -int scheme_diff_pointer(void *a, void *b) -{ - return !scheme_same_pointer(a, b); -} - -#endif +/************************************************************************/ +/* GC_dump */ +/************************************************************************/ #ifndef MZ_PRECISE_GC # ifdef __cplusplus diff --git a/src/mzscheme/src/schemef.h b/src/mzscheme/src/schemef.h index 376edbce2b..a54723db2e 100644 --- a/src/mzscheme/src/schemef.h +++ b/src/mzscheme/src/schemef.h @@ -222,15 +222,15 @@ MZ_EXTERN char *scheme_get_type_name(Scheme_Type type); /*========================================================================*/ MZ_EXTERN Scheme_Object scheme_eof[1]; -MZ_EXTERN Scheme_Object *scheme_make_eof(void); +XFORM_NONGCING MZ_EXTERN Scheme_Object *scheme_make_eof(void); MZ_EXTERN Scheme_Object scheme_null[1]; -MZ_EXTERN Scheme_Object *scheme_make_null(void); +XFORM_NONGCING MZ_EXTERN Scheme_Object *scheme_make_null(void); MZ_EXTERN Scheme_Object scheme_true[1]; -MZ_EXTERN Scheme_Object *scheme_make_true(void); +XFORM_NONGCING MZ_EXTERN Scheme_Object *scheme_make_true(void); MZ_EXTERN Scheme_Object scheme_false[1]; -MZ_EXTERN Scheme_Object *scheme_make_false(void); +XFORM_NONGCING MZ_EXTERN Scheme_Object *scheme_make_false(void); MZ_EXTERN Scheme_Object scheme_void[1]; -MZ_EXTERN Scheme_Object *scheme_make_void(void); +XFORM_NONGCING MZ_EXTERN Scheme_Object *scheme_make_void(void); MZ_EXTERN Scheme_Object scheme_undefined[1]; MZ_EXTERN Scheme_Object *scheme_tail_call_waiting; MZ_EXTERN Scheme_Object *scheme_multiple_values; @@ -358,6 +358,13 @@ MZ_EXTERN void *GC_malloc_uncollectable(size_t size_in_bytes); # endif #endif +MZ_EXTERN void *scheme_malloc_code(long size); +MZ_EXTERN void scheme_free_code(void *p); +#ifndef MZ_PRECISE_GC +MZ_EXTERN void *scheme_malloc_gcable_code(long size); +#endif + + MZ_EXTERN void *scheme_malloc_eternal(size_t n); MZ_EXTERN void scheme_end_stubborn_change(void *p); diff --git a/src/mzscheme/src/schemex.h b/src/mzscheme/src/schemex.h index b14e953b3a..07ba9a57e3 100644 --- a/src/mzscheme/src/schemex.h +++ b/src/mzscheme/src/schemex.h @@ -291,6 +291,11 @@ void *(*GC_malloc_uncollectable)(size_t size_in_bytes); # endif # endif #endif +void *(*scheme_malloc_code)(long size); +void (*scheme_free_code)(void *p); +#ifndef MZ_PRECISE_GC +void *(*scheme_malloc_gcable_code)(long size); +#endif void *(*scheme_malloc_eternal)(size_t n); void (*scheme_end_stubborn_change)(void *p); void *(*scheme_calloc)(size_t num, size_t size); diff --git a/src/mzscheme/src/schemex.inc b/src/mzscheme/src/schemex.inc index 4152661643..9ef2d1deb5 100644 --- a/src/mzscheme/src/schemex.inc +++ b/src/mzscheme/src/schemex.inc @@ -193,6 +193,11 @@ scheme_extension_table->GC_malloc_uncollectable = GC_malloc_uncollectable; # endif # endif +#endif + scheme_extension_table->scheme_malloc_code = scheme_malloc_code; + scheme_extension_table->scheme_free_code = scheme_free_code; +#ifndef MZ_PRECISE_GC + scheme_extension_table->scheme_malloc_gcable_code = scheme_malloc_gcable_code; #endif scheme_extension_table->scheme_malloc_eternal = scheme_malloc_eternal; scheme_extension_table->scheme_end_stubborn_change = scheme_end_stubborn_change; diff --git a/src/mzscheme/src/schemexm.h b/src/mzscheme/src/schemexm.h index d0fdb0b305..a841e0e8ed 100644 --- a/src/mzscheme/src/schemexm.h +++ b/src/mzscheme/src/schemexm.h @@ -194,6 +194,11 @@ # endif # endif #endif +#define scheme_malloc_code (scheme_extension_table->scheme_malloc_code) +#define scheme_free_code (scheme_extension_table->scheme_free_code) +#ifndef MZ_PRECISE_GC +#define scheme_malloc_gcable_code (scheme_extension_table->scheme_malloc_gcable_code) +#endif #define scheme_malloc_eternal (scheme_extension_table->scheme_malloc_eternal) #define scheme_end_stubborn_change (scheme_extension_table->scheme_end_stubborn_change) #define scheme_calloc (scheme_extension_table->scheme_calloc) diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index 219f9dc5ca..7a9944be0e 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -1007,6 +1007,9 @@ Scheme_Object *scheme_unclose_case_lambda(Scheme_Object *expr, int jit); Scheme_Object *scheme_native_stack_trace(void); void scheme_clean_native_symtab(void); void scheme_clean_cust_box_list(void); +#ifndef MZ_PRECISE_GC +void scheme_notify_code_gc(void); +#endif /*========================================================================*/ /* control flow */ diff --git a/src/mzscheme/src/startup.inc b/src/mzscheme/src/startup.inc index 0defa286e3..ef05eef656 100644 --- a/src/mzscheme/src/startup.inc +++ b/src/mzscheme/src/startup.inc @@ -261,8 +261,9 @@ "(lambda(f)((current-load/use-compiled) f #f)))" "(define-values(find-library-collection-paths)" "(case-lambda" -"(()(find-library-collection-paths null))" -"((extra-collects-dirs)" +"(()(find-library-collection-paths null null))" +"((extra-collects-dirs)(find-library-collection-paths extra-collects-dirs null))" +"((extra-collects-dirs post-collects-dirs)" "(let((user-too?(use-user-specific-search-paths))" "(cons-if(lambda(f r)(if f(cons f r) r))))" "(path-list-string->path-list" @@ -276,7 +277,8 @@ " \"collects\"))" "(let loop((l(append" " extra-collects-dirs" -"(list(find-system-path 'collects-dir)))))" +"(list(find-system-path 'collects-dir))" +" post-collects-dirs)))" "(if(null? l)" " null" "(let*((collects-path(car l))" diff --git a/src/mzscheme/src/startup.ss b/src/mzscheme/src/startup.ss index 10d5b14772..a9391aacf7 100644 --- a/src/mzscheme/src/startup.ss +++ b/src/mzscheme/src/startup.ss @@ -325,8 +325,9 @@ (define-values (find-library-collection-paths) (case-lambda - [() (find-library-collection-paths null)] - [(extra-collects-dirs) + [() (find-library-collection-paths null null)] + [(extra-collects-dirs) (find-library-collection-paths extra-collects-dirs null)] + [(extra-collects-dirs post-collects-dirs) (let ([user-too? (use-user-specific-search-paths)] [cons-if (lambda (f r) (if f (cons f r) r))]) (path-list-string->path-list @@ -340,7 +341,8 @@ "collects")) (let loop ([l (append extra-collects-dirs - (list (find-system-path 'collects-dir)))]) + (list (find-system-path 'collects-dir)) + post-collects-dirs)]) (if (null? l) null (let* ([collects-path (car l)] diff --git a/src/mzscheme/src/symbol.c b/src/mzscheme/src/symbol.c index 846c00363b..97a255507d 100644 --- a/src/mzscheme/src/symbol.c +++ b/src/mzscheme/src/symbol.c @@ -253,6 +253,9 @@ static void clean_symbol_table(void) # ifndef MZ_PRECISE_GC scheme_clean_cust_box_list(); # endif +# ifndef MZ_PRECISE_GC + scheme_notify_code_gc(); +# endif } #endif diff --git a/src/wxmac/src/mac/wx_clipb.cc b/src/wxmac/src/mac/wx_clipb.cc index 63fe632f21..31d0798da3 100644 --- a/src/wxmac/src/mac/wx_clipb.cc +++ b/src/wxmac/src/mac/wx_clipb.cc @@ -534,8 +534,8 @@ wxBitmap *wxClipboard::GetClipboardBitmap(long time) bbox = *(Rect *)((char *)pd XFORM_OK_PLUS sizeof(short)); - w = bbox.right - bbox.left; - h = bbox.bottom - bbox.top; + w = EndianS16_BtoN(bbox.right) - EndianS16_BtoN(bbox.left); + h = EndianS16_BtoN(bbox.bottom) - EndianS16_BtoN(bbox.top); if ((w > 0) && (w <= 10000) && (h > 0) && (h <= 10000)) { @@ -552,6 +552,8 @@ wxBitmap *wxClipboard::GetClipboardBitmap(long time) if (mdc->Ok()) { Handle h; + mdc->Clear(); + /* Do we have to put it in a real handle? I'm not sure... */ h = NewHandle(size);