Catching up

svn: r11980
This commit is contained in:
Stevie Strickland 2008-10-08 16:20:19 +00:00
commit 77ef410ea8
54 changed files with 1289 additions and 773 deletions

View File

@ -820,10 +820,18 @@
(get-lib-search-dirs)))] (get-lib-search-dirs)))]
[(and (list? p) [(and (list? p)
(eq? 'lib (car p))) (eq? 'lib (car 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)) (build-path (if (null? (cddr p))
(collection-path "mzlib") (collection-path "mzlib")
(apply collection-path (cddr p))) (apply collection-path (cddr p)))
(cadr p))] (cadr p)))]
[else p])]) [else p])])
(and p (and p
(path->bytes (path->bytes

View File

@ -1,6 +1,6 @@
#lang scribble/doc #lang scribble/doc
@(require "common.ss") @(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") @(define-runtime-path cn "../chat-noir/chat-noir.ss")
@gametitle["Chat Noir" "chat-noir" "Puzzle Game"] @gametitle["Chat Noir" "chat-noir" "Puzzle Game"]
@ -22,12 +22,9 @@ the introductory programming course at the University of Chicago in
the fall of 2008, as below. the fall of 2008, as below.
@(define-syntax (m stx) @(define-syntax (m stx)
(syntax-case stx () (call-with-input-file
[(_) (build-path (path-only (syntax-source stx))
(call-with-input-file (build-path (current-load-relative-directory) 'up "chat-noir" "chat-noir.ss")
'up
"chat-noir"
"chat-noir.ss")
(lambda (port) (lambda (port)
(port-count-lines! port) (port-count-lines! port)
#`(schemeblock #`(schemeblock
@ -54,6 +51,6 @@ the fall of 2008, as below.
[else [else
(cons (read-syntax "chat-noir.ss" port) (cons (read-syntax "chat-noir.ss" port)
(loop))]))))) (loop))])))))
#:mode 'text)])) #:mode 'text))
@m[] @m[]

View File

@ -488,6 +488,14 @@
submission->bytes) submission->bytes)
submission maxwidth textualize? untabify? submission maxwidth textualize? untabify?
markup-prefix prefix-re)))) 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 create-text? (make-directory "grading") (write-text))
(when value-printer (current-value-printer value-printer)) (when value-printer (current-value-printer value-printer))
(when coverage? (sandbox-coverage-enabled #t)) (when coverage? (sandbox-coverage-enabled #t))
@ -495,21 +503,7 @@
(cond (cond
[(not eval?) (let () body ...)] [(not eval?) (let () body ...)]
[language [language
(let ([eval (let ([eval (with-handlers ([void uem-handler])
(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 (call-with-evaluator/submission
language (append requires teachpacks) language (append requires teachpacks)
submission values))]) submission values))])

View File

@ -65,13 +65,16 @@ Keywords for configuring @scheme[check:]:
evaluating submissions, same as the @scheme[_language] argument for evaluating submissions, same as the @scheme[_language] argument for
@scheme[make-evaluator] (see @schememodname[handin-server/sandbox]). @scheme[make-evaluator] (see @schememodname[handin-server/sandbox]).
There is no default for this, so it must be set or an error is 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 @item{@indexed-scheme[:requires]---paths for additional libraries to
require for evaluating the submission, same as the require for evaluating the submission, same as the
@scheme[_requires] argument for @scheme[make-evaluator] (see @scheme[_requires] argument for @scheme[make-evaluator] (see
@schememodname[handin-server/sandbox]). This defaults to null---no @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 @item{@indexed-scheme[:teachpacks]---an alternative name for
@scheme[:requires], kept for legacy checkers.} @scheme[:requires], kept for legacy checkers.}

View File

@ -21,6 +21,7 @@
@defproc[(make-evaluator/submission @defproc[(make-evaluator/submission
[language (or/c module-path? [language (or/c module-path?
(list/c (one-of/c 'special) symbol?) (list/c (one-of/c 'special) symbol?)
(list/c (one-of/c 'module) module-path?)
(cons/c (one-of/c 'begin) list?))] (cons/c (one-of/c 'begin) list?))]
[require-paths (listof path-string?)] [require-paths (listof path-string?)]
[content bytes?]) [content bytes?])
@ -28,11 +29,22 @@
Like @scheme[make-evaluator], but the definitions content is Like @scheme[make-evaluator], but the definitions content is
supplied as a submission byte string. The byte string is opened for 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 @defproc[(call-with-evaluator
[language (or/c module-path? [language (or/c module-path?
(list/c (one-of/c 'special) symbol?) (list/c (one-of/c 'special) symbol?)
(list/c (one-of/c 'module) module-path?)
(cons/c (one-of/c 'begin) list?))] (cons/c (one-of/c 'begin) list?))]
[require-paths (listof path-string?)] [require-paths (listof path-string?)]
[input-program any/c] [input-program any/c]
@ -46,11 +58,13 @@
suitable for @scheme[language], it initializes suitable for @scheme[language], it initializes
@scheme[set-run-status] with @scheme["executing your code"], and it @scheme[set-run-status] with @scheme["executing your code"], and it
catches all exceptions to re-raise them in a form suitable as a 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 @defproc[(call-with-evaluator/submission
(or/c module-path? [language (or/c module-path?
(list/c (one-of/c 'special) symbol?) (list/c (one-of/c 'special) symbol?)
(list/c (one-of/c 'module) module-path?)
(cons/c (one-of/c 'begin) list?))] (cons/c (one-of/c 'begin) list?))]
[require-paths (listof path-string?)] [require-paths (listof path-string?)]
[submission bytes?] [submission bytes?]
@ -59,7 +73,8 @@
Like @scheme[call-with-evaluator], but the definitions content is Like @scheme[call-with-evaluator], but the definitions content is
supplied as a byte string. The byte string is opened for reading, 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: this contract is probably wrong
@; JBC: does this eval accept an optional namespace? @; JBC: does this eval accept an optional namespace?

View File

@ -48,14 +48,18 @@
;; Execution ---------------------------------------- ;; 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) (define (open-input-text-editor/lines str)
(let ([inp (open-input-text-editor str)]) (let ([inp (open-input-text-editor str)])
(port-count-lines! inp) inp)) (port-count-lines! inp) inp))
(define (make-evaluator/submission language requires str) (define (make-evaluator/submission language requires str)
(let-values ([(defs interacts) (unpack-submission str)]) (let-values ([(defs interacts) (unpack-submission str)])
(make-evaluator language #:requires requires (make-evaluator* language requires (open-input-text-editor defs))))
(open-input-text-editor defs))))
(define (evaluate-all source port eval) (define (evaluate-all source port eval)
(let loop () (let loop ()
@ -164,11 +168,12 @@
(define (call-with-evaluator lang requires program-port go) (define (call-with-evaluator lang requires program-port go)
(parameterize ([error-value->string-handler (lambda (v s) (parameterize ([error-value->string-handler (lambda (v s)
((current-value-printer) v))] ((current-value-printer) v))]
[list-abbreviation-enabled (not (or (eq? lang 'beginner) [list-abbreviation-enabled
(eq? lang 'beginner-abbr)))]) (not (or (equal? lang '(special beginner))
(equal? lang '(special beginner-abbr))))])
(reraise-exn-as-submission-problem (reraise-exn-as-submission-problem
(lambda () (lambda ()
(let ([e (make-evaluator lang #:requires requires program-port)]) (let ([e (make-evaluator* lang requires program-port)])
(set-run-status "executing your code") (set-run-status "executing your code")
(go e)))))) (go e))))))

View File

@ -1 +1 @@
#lang scheme/base (provide stamp) (define stamp "6oct2008") #lang scheme/base (provide stamp) (define stamp "8oct2008")

View File

@ -57,11 +57,12 @@
#| no modules here by default |#))) #| no modules here by default |#)))
(define (default-sandbox-reader source) (define (default-sandbox-reader source)
(parameterize ([read-accept-reader #t])
(let loop ([l '()]) (let loop ([l '()])
(let ([expr (read-syntax source)]) (let ([expr (read-syntax source)])
(if (eof-object? expr) (if (eof-object? expr)
(reverse l) (reverse l)
(loop (cons expr l)))))) (loop (cons expr l)))))))
(define sandbox-reader (make-parameter default-sandbox-reader)) (define sandbox-reader (make-parameter default-sandbox-reader))
@ -429,7 +430,7 @@
(define-evaluator-messenger get-error-output 'error-output) (define-evaluator-messenger get-error-output 'error-output)
(define-evaluator-messenger (get-uncovered-expressions . xs) 'uncovered) (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 cust (make-custodian))
(define coverage? (sandbox-coverage-enabled)) (define coverage? (sandbox-coverage-enabled))
(define uncovered #f) (define uncovered #f)
@ -457,7 +458,7 @@
((sandbox-init-hook)) ((sandbox-init-hook))
;; now read and evaluate the input program ;; now read and evaluate the input program
(evaluate-program (evaluate-program
(if (procedure? program-or-maker) (program-or-maker) program-or-maker) (if (procedure? program-maker) (program-maker) program-maker)
limits limits
(and coverage? (lambda (es+get) (set! uncovered es+get)))) (and coverage? (lambda (es+get) (set! uncovered es+get))))
(channel-put result-ch 'ok)) (channel-put result-ch 'ok))
@ -625,8 +626,10 @@
allow) allow)
(lambda () (build-program lang reqs input-program))))) (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 ;; this is for a complete module input program
(define (make-program)
(let ([prog (input->code (list input-program) 'program #f)]) (let ([prog (input->code (list input-program) 'program #f)])
(unless (= 1 (length prog)) (unless (= 1 (length prog))
(error 'make-evaluator "expecting a single `module' program; ~a" (error 'make-evaluator "expecting a single `module' program; ~a"
@ -635,7 +638,12 @@
"got more than a single expression"))) "got more than a single expression")))
(syntax-case* (car prog) (module) literal-identifier=? (syntax-case* (car prog) (module) literal-identifier=?
[(module modname lang body ...) [(module modname lang body ...)
(make-evaluator* void allow (car prog))] (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" [_else (error 'make-evaluator "expecting a `module' program; got ~e"
(syntax->datum (car prog)))]))) (syntax->datum (car prog)))])))
(make-evaluator* void allow make-program))

View File

@ -57,10 +57,19 @@ Sets the path to be returned by @scheme[(find-system-path
'collects-dir)].} 'collects-dir)].}
@function[(void scheme_init_collection_paths @function[(void scheme_init_collection_paths_post
[Scheme_Env* env] [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 Initializes the @scheme[current-library-collection-paths] parameter
using @scheme[find-library-collection-paths]. The @var{extra_paths} using @scheme[find-library-collection-paths]. The
argument is propagated to @scheme[find-library-collection-paths].} @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.}

View File

@ -674,6 +674,17 @@ using @cpp{scheme_free_immobile_box}.}
Frees an immobile box allocated with @cpp{scheme_malloc_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 @function[(void scheme_register_extension_global
[void* ptr] [void* ptr]
[long size])]{ [long size])]{

View File

@ -63,7 +63,8 @@ is initialized in @exec{mzscheme} to the result of
@scheme[(find-library-collection-paths)]. @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?)]{ (listof path?)]{
Produces a list of paths as follows: 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 default collection path list, unless the value of the
@scheme[use-user-specific-search-paths] parameter is @scheme[#f].} @scheme[use-user-specific-search-paths] parameter is @scheme[#f].}
@item{Extra directories provided in @scheme[extras] are included next, @item{Extra directories provided in @scheme[pre-extras] are included
converted to complete paths relative to the executable.} 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 @item{If the directory specified by @scheme[(find-system-path
'collects-dir)] is absolute, or if it is relative (to the 'collects-dir)] is absolute, or if it is relative (to the
executable) and it exists, then it is added to the end of the executable) and it exists, then it is added to the end of the
default collection path list.} 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 @item{If the @indexed-envvar{PLTCOLLECTS} environment variable is
defined, it is combined with the default list using defined, it is combined with the default list using
@scheme[path-list-string->path-list]. If it is not defined, the @scheme[path-list-string->path-list]. If it is not defined, the

View File

@ -26,6 +26,7 @@ filesystem access, and network access.
[#:allow-read allow (listof (or/c module-path? path?))]) [#:allow-read allow (listof (or/c module-path? path?))])
(any/c . -> . any)] (any/c . -> . any)]
[(make-module-evaluator [module-decl (or/c syntax? pair?)] [(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?))]) [#:allow-read allow (listof (or/c module-path? path?))])
(any/c . -> . any)])]{ (any/c . -> . any)])]{
@ -47,7 +48,7 @@ included in the @scheme[allow] list.
Each @scheme[input-program] or @scheme[module-decl] argument provides Each @scheme[input-program] or @scheme[module-decl] argument provides
a program in one of the following forms: a program in one of the following forms:
@itemize{ @itemize[
@item{an input port used to read the program;} @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 @item{an S-expression or a @tech{syntax object}, which is evaluated
as with @scheme[eval] (see also as with @scheme[eval] (see also
@scheme[get-uncovered-expressions]).} @scheme[get-uncovered-expressions]).}
]
}
In the first three cases above, the program is read using In the first three cases above, the program is read using
@scheme[sandbox-reader], with line-counting enabled for sensible error @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] @scheme[input-program]s are evaluated depends on the @scheme[language]
argument: argument:
@itemize{ @itemize[
@item{The @scheme[language] argument can be a module path (i.e., a @item{The @scheme[language] argument can be a module path (i.e., a
datum that matches the grammar for @scheme[_module-path] of 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 In the new namespace, @scheme[language] is evaluated as an
expression to further initialize the namespace.} expression to further initialize the namespace.}
} ]
The @scheme[requires] list adds additional imports to the module or The @scheme[requires] list adds additional imports to the module or
namespace for the @scheme[input-program]s, even in the case that 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 The @scheme[make-module-evaluator] function is essentially a
restriction of @scheme[make-evaluator], where the program must be 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[ @schemeblock[
(define base-module-eval2 (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 In all cases, the evaluator operates in an isolated and limited
environment: environment:
@itemize{ @itemize[
@item{It uses a new custodian and namespace. When @scheme[gui?] is @item{It uses a new custodian and namespace. When @scheme[gui?] is
true, it is also runs in its own eventspace.} 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 @item{Each evaluation is wrapped in a @scheme[call-with-limits]; see
also @scheme[sandbox-eval-limits] and @scheme[set-eval-limits].} also @scheme[sandbox-eval-limits] and @scheme[set-eval-limits].}
} ]
Evaluation can also be instrumented to track coverage information when Evaluation can also be instrumented to track coverage information when
@scheme[sandbox-coverage-enabled] is set. Exceptions (both syntax and @scheme[sandbox-coverage-enabled] is set. Exceptions (both syntax and
@ -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], setting for a newly created evaluator. It defaults to @scheme[#f],
which creates an empty port. The following other values are allowed: 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 @item{a string or byte string, which is converted to a port using
@scheme[open-input-string] or @scheme[open-input-bytes];} @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 @scheme[current-input-port] means that the evaluator input is
the same as the calling context's input).} the same as the calling context's input).}
}} ]}
@defparam[sandbox-output in (or/c false/c @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 which creates a port that discrds all data. The following other
values are allowed: values are allowed:
@itemize{ @itemize[
@item{an output port, which is used as-is;} @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 @scheme[current-output-port] means that the evaluator output is
not diverted).} not diverted).}
}} ]}
@defparam[sandbox-error-output in (or/c false/c @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 in a way that depends on the setting of @scheme[(sandbox-output)] or
@scheme[(sandbox-error-output)] when the evaluator was created: @scheme[(sandbox-error-output)] when the evaluator was created:
@itemize{ @itemize[
@item{if it was @scheme['pipe], then @scheme[get-output] returns the @item{if it was @scheme['pipe], then @scheme[get-output] returns the
input port end of the created pipe;} 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);} piece of the evaluator's output);}
@item{otherwise, it returns @scheme[#f].} @item{otherwise, it returns @scheme[#f].}
}} ]}
@defproc[(get-uncovered-expressions [evaluator (any/c . -> . any)] @defproc[(get-uncovered-expressions [evaluator (any/c . -> . any)]

View File

@ -49,11 +49,11 @@ the implemetation of @schememodname[scheme/base], and
The first action of MzScheme or MrEd is to initialize The first action of MzScheme or MrEd is to initialize
@scheme[current-library-collection-paths] to the result of @scheme[current-library-collection-paths] to the result of
@scheme[(find-library-collection-paths _extras)], where @scheme[(find-library-collection-paths _pre-extras _extras)], where
@scheme[_extras] are extra directory paths provided in order in the @scheme[_pre-extras] is normally @scheme[null] and @scheme[_extras]
command line with @Flag{S}/@DFlag{search}. An executable created from are extra directory paths provided in order in the command line with
the MzScheme or MrEd executable can embed additional paths that are @Flag{S}/@DFlag{search}. An executable created from the MzScheme or
appended to @scheme[_extras]. MrEd executable can embed paths used as @scheme[_pre-extras].
MzScheme and MrEd next @scheme[require] @schememodname[scheme/init] MzScheme and MrEd next @scheme[require] @schememodname[scheme/init]
and @schememodname[scheme/gui/init], respectively, but only if the 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], @Flag{u}/@DFlag{require-script}) before any @scheme[eval],
@scheme[load], or read-eval-print-loop flag (@Flag{e}/@DFlag{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{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} initialization library can be changed with the @Flag{I}
@tech{configuration option}. @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 @tech{configuration options}. If any command-line argument is
provided that is not a @tech{configuration option}, then the provided that is not a @tech{configuration option}, then the
read-eval-print-loop is not started, unless the @Flag{i}/@DFlag{repl} 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 specifically re-enable it. In addition, just before the command line
is started, MzScheme loads the file @scheme[(find-system-path is started, MzScheme loads the file @scheme[(find-system-path
'init-file)] and MrEd loads the file 'init-file)] and MrEd loads the file
@ -184,12 +184,9 @@ flags:
loop, using either @scheme[read-eval-print-loop] (MzScheme) or loop, using either @scheme[read-eval-print-loop] (MzScheme) or
@scheme[graphical-read-eval-print-loop] (MrEd) after showing @scheme[graphical-read-eval-print-loop] (MrEd) after showing
@scheme[(banner)] and loading @scheme[(find-system-path @scheme[(banner)] and loading @scheme[(find-system-path
'init-file)].} 'init-file)]. For MrEd, supply the @Flag{z}/@DFlag{text-repl}
configuration option to use @scheme[read-eval-print-loop]
@item{@FlagFirst{z} or @DFlagFirst{text-repl} : MrEd only; like instead of @scheme[graphical-read-eval-print-loop].}
@Flag{i}/@DFlag{repl}, but uses
@scheme[textual-read-eval-print-loop] instead of
@scheme[graphical-read-eval-print-loop].}
@item{@FlagFirst{n} or @DFlagFirst{no-lib} : Skips requiring the @item{@FlagFirst{n} or @DFlagFirst{no-lib} : Skips requiring the
initialization library (i.e., @schememodname[scheme/init] or initialization library (i.e., @schememodname[scheme/init] or
@ -219,7 +216,12 @@ flags:
@item{@FlagFirst{q} or @DFlagFirst{no-init-file} : Skips loading @item{@FlagFirst{q} or @DFlagFirst{no-init-file} : Skips loading
@scheme[(find-system-path 'init-file)] for @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 #, @item{@FlagFirst{I} @nonterm{path} : Sets @scheme[(lib #,
@nontermstr{path})] as the path to @scheme[require] to initialize @nontermstr{path})] as the path to @scheme[require] to initialize
@ -231,12 +233,13 @@ flags:
'collects-dir)] produce @nonterm{dir}.} 'collects-dir)] produce @nonterm{dir}.}
@item{@FlagFirst{S} @nonterm{dir} or @DFlagFirst{search} @item{@FlagFirst{S} @nonterm{dir} or @DFlagFirst{search}
@nonterm{dir} : Adds @nonterm{dir} to the library collection @nonterm{dir} : Adds @nonterm{dir} to the default library
search path. The @scheme{dir} is added after a user-specific collection search path after the main collection directory. If
directory, if any, and before the main collection directory.} 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 @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 libraries, etc. by initializing the
@scheme[use-user-specific-search-paths] parameter to @scheme[use-user-specific-search-paths] parameter to
@scheme[#f].} @scheme[#f].}

View File

@ -66,7 +66,7 @@ picts. The functions @scheme[pict-width], @scheme[pict-height],
information from a pict. information from a pict.
@defstruct[pict ([draw ((is-a?/c dc<%>) real? real? . -> . any)] @defstruct[pict ([draw any/c]
[width real?] [width real?]
[height real?] [height real?]
[ascent 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[make-pict]. Instead, functions like @scheme[text],
@scheme[hline], and @scheme[dc] are used to construct a pict. @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 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 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 the @scheme[dc<%>] origin). The state of the @scheme[dc<%>] is
intended to affect the pict's drawing; for example, the pen and brush intended to affect the pict's drawing; for example, the pen and brush
will be set for a suitable default drawing mode, and the 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 The @scheme[panbox] field is internal and initialized to @scheme[#f].
to @scheme[#f].
The @scheme[last] field indicates a pict within the @scheme[children] The @scheme[last] field indicates a pict within the @scheme[children]
list (transitively) that can be treated as the last element of the list (transitively) that can be treated as the last element of the

View File

@ -58,7 +58,9 @@
;; language : symbol ;; 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) (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])) ;; type sc = (make-sc symbol (listof (list symbol string)) (union #f hash-table[symbol -o> #t]))

View File

@ -7,65 +7,81 @@
(require (for-syntax scheme/base)) (require (for-syntax scheme/base))
(define-syntax (provide-module-reader stx) (define-syntax (provide-module-reader stx)
(syntax-case stx ()
[(_ lib body ...)
(let ([key-args '()])
(define (err str [sub #f]) (define (err str [sub #f])
(raise-syntax-error 'syntax/module-reader str sub)) (raise-syntax-error 'syntax/module-reader str sub))
(define -body (define-syntax-rule (keywords body [kwd var default] ... [checks ...])
(let loop ([body (syntax->list #'(body ...))]) (begin
(define var #f) ...
(set! body
(let loop ([body body])
(if (not (and (pair? body) (if (not (and (pair? body)
(pair? (cdr body)) (pair? (cdr body))
(keyword? (syntax-e (car body))))) (keyword? (syntax-e (car body)))))
(datum->syntax stx body stx) (datum->syntax stx body stx)
(let* ([k (car body)] [k* (syntax-e k)] [v (cadr body)]) (let* ([k (car body)] [k* (syntax-e k)] [v (cadr body)])
(cond (case k*
[(assq k* key-args) (err (format "got two ~s keywords" k*) k)] [(kwd) (if var
[(not (memq k* '(#:read #:read-syntax #:wrapper1 #:wrapper2 (err (format "got two ~s keywords" k*) k)
#:whole-body-readers?))) (begin (set! var v) (loop (cddr body))))]
(err "got an unknown keyword" (car body))] ...
[else (set! key-args (cons (cons k* v) key-args)) [else (err "got an unknown keyword" (car body))])))))
(loop (cddr body))]))))) checks ...
(define (get kwd [dflt #f]) (set! var (or var default)) ...))
(cond [(assq kwd key-args) => cdr] [else dflt])) (define (construct-reader lang body)
(unless (equal? (and (assq '#:read key-args) #t) (keywords body
(and (assq '#:read-syntax key-args) #t)) [#: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")) (err "must specify either both #:read and #:read-syntax, or none"))
(when (and (assq '#:whole-body-readers? key-args) (when (and ~whole-body-readers? (not (and ~read ~read-syntax)))
(not (assq '#:read key-args))) (err "got a #:whole-body-readers? without #:read and #:read-syntax"))])
(err "got a #:whole-body-readers? without #:read and #:read-syntax"))
(quasisyntax/loc stx (quasisyntax/loc stx
(#%module-begin (#%module-begin
#,@-body #,@body
(#%provide (rename *read read) (rename *read-syntax read-syntax)) (#%provide (rename *read read) (rename *read-syntax read-syntax))
(define-values (*read *read-syntax) (define-values (*read *read-syntax)
(let* ([rd #,(get '#:read #'read)] (let* ([lang #,~lang]
[rds #,(get '#:read-syntax #'read-syntax)] [rd #,~read]
[w1 #,(get '#:wrapper1 #'#f)] [rds #,~read-syntax]
[w2 #,(get '#:wrapper2 #'#f)] [w1 #,~wrapper1]
[w2 #,~wrapper2]
[w2 (cond [(not w2) (lambda (in r _) (r in))] [w2 (cond [(not w2) (lambda (in r _) (r in))]
[(procedure-arity-includes? w2 3) w2] [(procedure-arity-includes? w2 3) w2]
[else (lambda (in r _) (w2 in r))])] [else (lambda (in r _) (w2 in r))])]
[base 'lib] [whole? #,~whole-body-readers?])
[whole? #,(get '#:whole-body-readers? #'#f)])
(values (values
(lambda (in modpath line col pos) (lambda (in modpath line col pos)
(w2 in (w2 in
(lambda (in) (lambda (in)
(wrap-internal base in rd whole? (wrap-internal lang in rd whole?
w1 #f modpath #f line col pos)) w1 #f modpath #f line col pos))
#f)) #f))
(lambda (src in modpath line col pos) (lambda (src in modpath line col pos)
(w2 in (w2 in
(lambda (in) (lambda (in)
(wrap-internal (wrap-internal lang in (lambda (in) (rds src in)) whole?
base in (lambda (in) (rds src in)) whole?
w1 #t modpath src line col pos)) w1 #t modpath src line col pos))
#t))))))))])) #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) 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? (if whole?
(read port) (read port)
(let loop ([a null]) (let loop ([a null])
@ -93,11 +109,10 @@
(- (or (syntax-position modpath) (add1 pos)) (- (or (syntax-position modpath) (add1 pos))
pos))) pos)))
v))] v))]
[lib (if stx? (datum->syntax #f lib modpath modpath) lib)] [r `(,(tag-src 'module) ,(tag-src name) ,lang . ,body)])
[r `(,(tag-src 'module) ,(tag-src name) ,lib . ,body)])
(if stx? (datum->syntax #f r all-loc) r))) (if stx? (datum->syntax #f r all-loc) r)))
(define (wrap lib port read modpath src line col pos) (define (wrap lang port read modpath src line col pos)
(wrap-internal lib port read #f #f #f modpath src line col pos)) (wrap-internal lang port read #f #f #f modpath src line col pos))
) )

View File

@ -16,8 +16,10 @@ of read modules; using keywords, the resulting readers can be
customized in a number of ways. customized in a number of ways.
@defform*/subs[[(#%module-begin module-path) @defform*/subs[[(#%module-begin module-path)
(#%module-begin module-path reader-option ... body ....)] (#%module-begin module-path reader-option ... body ....)
([reader-option (code:line #:read read-expr) (#%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 #:read-syntax read-syntax-expr)
(code:line #:wrapper1 wrapper1-expr) (code:line #:wrapper1 wrapper1-expr)
(code:line #:wrapper2 wrapper2-expr) (code:line #:wrapper2 wrapper2-expr)
@ -77,7 +79,7 @@ For example, here is a case-insensitive reader for the
@scheme[scheme/base] language: @scheme[scheme/base] language:
@schemeblock[ @schemeblock[
(module insensitive syntax/module-reader (module reader syntax/module-reader
scheme/base scheme/base
#:read (wrap read) #:read-syntax (wrap read-syntax) #:read (wrap read) #:read-syntax (wrap read-syntax)
(define ((wrap reader) . args) (define ((wrap reader) . args)
@ -94,7 +96,7 @@ alternative definition of the case-insensitive language using
@scheme[#:wrapper1]: @scheme[#:wrapper1]:
@schemeblock[ @schemeblock[
(module insensitive syntax/module-reader (module reader syntax/module-reader
scheme/base scheme/base
#:wrapper1 (lambda (t) #:wrapper1 (lambda (t)
(parameterize ([read-case-sensitive #f]) (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 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 In addition to this wrapper, there is also @scheme[#:wrapper2] that
has more control over the resulting reader functions. If specified, 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: using this option:
@schemeblock[ @schemeblock[
(module insensitive syntax/module-reader (module reader syntax/module-reader
scheme/base scheme/base
#:wrapper2 (lambda (in r) #:wrapper2 (lambda (in r)
(parameterize ([read-case-sensitive #f]) (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 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[read-syntax-inside]). In these cases you can specify
@scheme[#:whole-body-readers?] as @scheme[#t] --- the readers are @scheme[#:whole-body-readers?] as @scheme[#t] --- the readers are
expected to return a list of expressions in this case. expected to return a list of expressions in this case.
Finally, note that the two wrappers can return a different value than In addition, the two wrappers can return a different value than the
the wrapped function. This introduces two more customization points wrapped function. This introduces two more customization points for
for the resulting readers: the resulting readers:
@itemize{ @itemize{
@item{The thunk that is passed to a @scheme[#:wrapper1] function @item{The thunk that is passed to a @scheme[#:wrapper1] function
reads the file contents and returns a list of read expressions 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 language (which means that the library specification is effectively
ignored): ignored):
@schemeblock[ @schemeblock[
(module scribbled syntax/module-reader (module reader syntax/module-reader
-ignored- -ignored-
#:wrapper2 #:wrapper2
(lambda (in rd stx?) (lambda (in rd stx?)
@ -173,6 +175,25 @@ ignored):
(if stx? r (syntax->datum r)))) (if stx? r (syntax->datum r))))
(require scribble/reader)) (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?] @defproc[(wrap-read-all [mod-path module-path?]

View File

@ -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)

View File

@ -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)

View File

@ -98,7 +98,7 @@
(define dest (if mred? mr-dest mz-dest)) (define dest (if mred? mr-dest mz-dest))
(define (flags s) (define (flags s)
(string-append "-" 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: ;; Try simple mode: one module, launched from cmd line:
(prepare dest filename) (prepare dest filename)
(make-embedding-executable (make-embedding-executable
@ -129,6 +129,7 @@
(w/prefix #f) (w/prefix #f)
(w/prefix 'before:)) (w/prefix 'before:))
(when literal?
;; Try full path, and use literal S-exp to start ;; Try full path, and use literal S-exp to start
(printf ">>>literal sexp\n") (printf ">>>literal sexp\n")
(prepare dest filename) (prepare dest filename)
@ -207,10 +208,12 @@
"This is the literal expression 4.\n" "This is the literal expression 4.\n"
"... and more!\n" "... and more!\n"
expect) expect)
mred?)) mred?)))
(one-mz-test "embed-me1.ss" "This is 1\n") (one-mz-test "embed-me1.ss" "This is 1\n" #t)
(one-mz-test "embed-me2.ss" "This is 1\nThis is 2: #t\n") (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: ;; Try unicode expr and cmdline:
(prepare dest "unicode") (prepare dest "unicode")

View File

@ -43,8 +43,13 @@
#:wrapper2 (lambda (in rd) #:wrapper2 (lambda (in rd)
(if (syntax? (rd in)) #'(module page zzz) '(module page zzz)))) (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 ;; a module that uses the scribble syntax with a specified language
(module r9 syntax/module-reader -ignored- (module r10 syntax/module-reader -ignored-
#:wrapper2 #:wrapper2
(lambda (in rd stx?) (lambda (in rd stx?)
(let* ([lang (read in)] (let* ([lang (read in)]
@ -59,6 +64,14 @@
(if stx? r (syntax->datum r)))) (if stx? r (syntax->datum r))))
(require scribble/reader)) (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) (define (from-string read str)
(parameterize ([read-accept-reader #t]) (parameterize ([read-accept-reader #t])
(read (open-input-string str)))) (read (open-input-string str))))
@ -83,10 +96,20 @@
(test-both "#reader 'r6 (define foo #:bar)" (test-both "#reader 'r6 (define foo #:bar)"
'(module page zzz)) '(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))) '(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"))) '(module page scheme/base (define foo "one")))
;; ---------------------------------------- ;; ----------------------------------------

View File

@ -32,7 +32,7 @@
;; ignored, and should only be used by the mzscheme tests.) ;; ignored, and should only be used by the mzscheme tests.)
(define tests (define tests
'([no-handler load "mzscheme/quiet.ss" (lib "scheme/init")] '([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 "match/plt-match-tests.ss"]
;; [require "stepper/automatic-tests.ss" (lib "scheme/base")] ;; [require "stepper/automatic-tests.ss" (lib "scheme/base")]
[require "lazy/main.ss"] [require "lazy/main.ss"]
@ -50,7 +50,7 @@
(define name (cadr t)) (define name (cadr t))
(define stderr (current-error-port)) (define stderr (current-error-port))
(define (echo fmt . args) (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) (newline stderr)
(echo "running...") (echo "running...")
(let/ec break (let/ec break

View File

@ -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)

View File

@ -4,7 +4,7 @@
(require (planet schematics/schemeunit:2/test) (require (planet schematics/schemeunit:2/test)
(planet schematics/schemeunit:2/text-ui) (planet schematics/schemeunit:2/text-ui)
mzlib/etc mzlib/etc scheme/port
compiler/compiler compiler/compiler
scheme/match scheme/match
"unit-tests/all-tests.ss" "unit-tests/all-tests.ss"
@ -31,7 +31,7 @@
(define (exn-pred p) (define (exn-pred p)
(let ([sexp (with-handlers (let ([sexp (with-handlers
([exn:fail? (lambda _ #f)]) ([exn:fail? (lambda _ #f)])
(call-with-input-file (call-with-input-file*
p p
(lambda (prt) (lambda (prt)
(read-line prt 'any) (read prt))))]) (read-line prt 'any) (read prt))))])
@ -54,7 +54,8 @@
(lambda () (lambda ()
(parameterize ([read-accept-reader #t] (parameterize ([read-accept-reader #t]
[current-load-relative-directory path] [current-load-relative-directory path]
[current-directory path]) [current-directory path]
[current-output-port (open-output-nowhere)])
(loader p))))))) (loader p)))))))
(apply test-suite dir (apply test-suite dir
tests))) tests)))
@ -87,9 +88,7 @@
(define (go) (test/gui tests)) (define (go) (test/gui tests))
(define (go/text) (test/text-ui tests)) (define (go/text) (test/text-ui tests))
(when (getenv "PLT_TESTS") (provide go go/text)
(unless (parameterize ([current-output-port (open-output-string)])
(= 0 (go/text)))
(error "Typed Scheme Tests did not pass.")))

View File

@ -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."))

View File

@ -376,21 +376,22 @@
[(or (Poly-names: msg-vars (Function: (list (arr: msg-doms msg-rngs msg-rests msg-drests '() _ _) ...))) [(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 '() _ _) ...)))) (PolyDots-names: msg-vars (Function: (list (arr: msg-doms msg-rngs msg-rests msg-drests '() _ _) ...))))
(let ([fcn-string (if name (let ([fcn-string (if name
(format "function ~a (over ~~a)" (syntax->datum name)) (format "function ~a" (syntax->datum name))
"function over ~a")]) "function")])
(if (and (andmap null? msg-doms) (if (and (andmap null? msg-doms)
(null? argtypes)) (null? argtypes))
(tc-error/expr #:return (ret (Un)) (tc-error/expr #:return (ret (Un))
(string-append (string-append
"Could not infer types for applying polymorphic " "Could not infer types for applying polymorphic "
fcn-string fcn-string
"\n") "\n"))
(stringify msg-vars))
(tc-error/expr #:return (ret (Un)) (tc-error/expr #:return (ret (Un))
(string-append (string-append
"Polymorphic " fcn-string " could not be applied to arguments:~n" "Polymorphic " fcn-string " could not be applied to arguments:~n"
(domain-mismatches t msg-doms msg-rests msg-drests argtypes #f #f)) (domain-mismatches t msg-doms msg-rests msg-drests argtypes #f #f)
(stringify msg-vars))))])) (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) (define (tc/funapp f-stx args-stx ftype0 argtys expected)
@ -450,11 +451,11 @@
[(tc-result: (and t [(tc-result: (and t
(or (Poly: vars (or (Poly: vars
(Function: (list (arr: doms rngs (and rests #f) (and drests #f) '() thn-effs els-effs) ...))) (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) ...)))))) (Function: (list (arr: doms rngs (and rests #f) (and drests #f) '() thn-effs els-effs) ...))))))
(handle-clauses (doms rngs) f-stx (handle-clauses (doms rngs) f-stx
(lambda (dom _) (= (length dom) (length argtypes))) (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)] t argtypes expected)]
;; polymorphic varargs ;; polymorphic varargs
[(tc-result: (and t [(tc-result: (and t

View File

@ -1,3 +1,9 @@
Version 4.1.1.1
Changed -z/--text-repl to a configuration option
----------------------------------------------------------------------
Version 4.1.1, October 2008 Version 4.1.1, October 2008
Minor bug fixes Minor bug fixes

View File

@ -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 Version 4.1.1, October 2008
Added read-language Added read-language
Added module-compiled-language-info, module->language-info, Added module-compiled-language-info, module->language-info,

View File

@ -2529,45 +2529,7 @@ void free_cl_cif_args(void *ignored, void *p)
#ifdef MZ_PRECISE_GC #ifdef MZ_PRECISE_GC
GC_free_immobile_box((void**)(((closure_and_cif*)p)->data)); GC_free_immobile_box((void**)(((closure_and_cif*)p)->data));
#endif #endif
free(p); scheme_free_code(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 <sys/mman.h>
#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;
} }
/* (ffi-callback scheme-proc in-types out-type [abi]) -> ffi-callback */ /* (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); rtype = CTYPE_PRIMTYPE(base);
abi = GET_ABI(MYNAME,3); abi = GET_ABI(MYNAME,3);
/* malloc space for everything needed, so a single free gets rid of this */ /* 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 */ cl = &(cl_cif_args->closure); /* cl is the same as cl_cif_args */
cif = &(cl_cif_args->cif); cif = &(cl_cif_args->cif);
atypes = (ffi_type **)(((char*)cl_cif_args) + sizeof(closure_and_cif)); atypes = (ffi_type **)(((char*)cl_cif_args) + sizeof(closure_and_cif));

View File

@ -1969,7 +1969,7 @@ void free_cl_cif_args(void *ignored, void *p)
#ifdef MZ_PRECISE_GC #ifdef MZ_PRECISE_GC
GC_free_immobile_box((void**)(((closure_and_cif*)p)->data)); GC_free_immobile_box((void**)(((closure_and_cif*)p)->data));
#endif #endif
free(p); scheme_free_code(p);
} }
/* (ffi-callback scheme-proc in-types out-type [abi]) -> ffi-callback */ /* (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); rtype = CTYPE_PRIMTYPE(base);
abi = GET_ABI(MYNAME,3); abi = GET_ABI(MYNAME,3);
/* malloc space for everything needed, so a single free gets rid of this */ /* 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 */ cl = &(cl_cif_args->closure); /* cl is the same as cl_cif_args */
cif = &(cl_cif_args->cif); cif = &(cl_cif_args->cif);
atypes = (ffi_type **)(((char*)cl_cif_args) + sizeof(closure_and_cif)); atypes = (ffi_type **)(((char*)cl_cif_args) + sizeof(closure_and_cif));

View File

@ -383,6 +383,22 @@ static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl)
return exit_val; 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) static int get_log_level(char *prog, char *real_switch, const char *envvar, const char *what, char *str)
{ {
if (!strcmp(str, "none")) if (!strcmp(str, "none"))
@ -747,8 +763,7 @@ static int run_from_cmd_line(int argc, char *_argv[],
--argc; --argc;
if (!collects_extra) if (!collects_extra)
collects_extra = scheme_make_null(); collects_extra = scheme_make_null();
collects_extra = scheme_make_pair(scheme_make_path(argv[0]), collects_extra = scheme_make_pair(scheme_make_path(argv[0]), collects_extra);
collects_extra);
was_config_flag = 1; was_config_flag = 1;
break; break;
case 'c': case 'c':
@ -889,8 +904,7 @@ static int run_from_cmd_line(int argc, char *_argv[],
case 'z': case 'z':
alternate_rep = 1; alternate_rep = 1;
no_front = 1; no_front = 1;
use_repl = 1; was_config_flag = 1;
init_ns = 1;
break; break;
case 'K': case 'K':
no_front = 1; no_front = 1;
@ -1034,12 +1048,16 @@ static int run_from_cmd_line(int argc, char *_argv[],
if (!collects_path) if (!collects_path)
collects_path = scheme_make_path(_coldir XFORM_OK_PLUS _coldir_offset); 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); scheme_set_collects_path(collects_path);
/* Make list of additional collection paths: */ /* Make list of additional collection paths: */
if (collects_extra) { if (collects_extra)
l = collects_extra; r = reverse_path_list(collects_extra, 1);
} else { else
r = scheme_make_null();
l = scheme_make_null(); l = scheme_make_null();
offset = _coldir_offset; offset = _coldir_offset;
while (1) { while (1) {
@ -1050,15 +1068,9 @@ static int run_from_cmd_line(int argc, char *_argv[],
l = scheme_make_pair(scheme_make_path(_coldir XFORM_OK_PLUS offset), l = scheme_make_pair(scheme_make_path(_coldir XFORM_OK_PLUS offset),
l); l);
} }
} l = reverse_path_list(l, 0);
/* 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); scheme_init_collection_paths_post(global_env, l, r);
} }
#endif /* NO_FILE_SYSTEM_UTILS */ #endif /* NO_FILE_SYSTEM_UTILS */
@ -1093,12 +1105,6 @@ static int run_from_cmd_line(int argc, char *_argv[],
return cont_run(fa); return cont_run(fa);
#ifdef CMDLINE_STDIO_FLAG
# define REPL_FLAGS "-i/-z"
#else
# define REPL_FLAGS "-i"
#endif
#ifndef DONT_PARSE_COMMAND_LINE #ifndef DONT_PARSE_COMMAND_LINE
show_help: show_help:
prog =("%s" 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" " -m, --main : Call `main' with command-line arguments, print results\n"
" Interaction options:\n" " Interaction options:\n"
" -i, --repl : Run interactive read-eval-print loop; implies -v\n" " -i, --repl : Run interactive read-eval-print loop; implies -v\n"
# ifdef CMDLINE_STDIO_FLAG " -n, --no-lib : Skip `(require (lib \"<init-lib>\"))' for -i/-e/-f/-r\n"
" -z, --text-repl : Like -i, but use text read-eval-print loop\n"
# endif
" -n, --no-lib : Skip `(require (lib \"<init-lib>\"))' for " REPL_FLAGS "/-e/-f/-r\n"
" -v, --version : Show version\n" " -v, --version : Show version\n"
# ifdef CMDLINE_STDIO_FLAG # ifdef CMDLINE_STDIO_FLAG
" -K, --back : Don't bring application to the foreground (Mac OS X)\n" " -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 # endif
" Configuration options:\n" " Configuration options:\n"
" -c, --no-compiled : Disable loading of compiled files\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 <path> : Set <init-lib> to <path>\n" " -I <path> : Set <init-lib> to <path>\n"
" -X <dir>, --collects <dir> : Main collects at <dir> relative to " PROGRAM "\n" " -X <dir>, --collects <dir> : Main collects at <dir>\n"
" -S <dir>, --search <dir> : More collects at <dir> relative to " PROGRAM "\n" " -S <dir>, --search <dir> : More collects at <dir> (after main collects)\n"
" -U, --no-user-path : Ignore user-specific collects, etc.\n" " -U, --no-user-path : Ignore user-specific collects, etc.\n"
" -N <file>, --name <file> : Sets `(find-system-path 'run-file)' to <file>\n" " -N <file>, --name <file> : Sets `(find-system-path 'run-file)' to <file>\n"
# ifdef MZ_USE_JIT # 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" " Example: `-ifve file expr' is the same as `-i -f file -v -e expr'\n"
"Start-up sequence:\n" "Start-up sequence:\n"
" 1. Set `current-library-collection-paths'\n" " 1. Set `current-library-collection-paths'\n"
" 2. Require `(lib \"<init-lib>\")' [when " REPL_FLAGS "/-e/-f/-r, unless -n]\n" " 2. Require `(lib \"<init-lib>\")' [when -i/-e/-f/-r, unless -n]\n"
" 3. Evaluate/load expressions/files in order, until first error\n" " 3. Evaluate/load expressions/files in order, until first error\n"
" 4. Load \"" INIT_FILENAME "\" [when " REPL_FLAGS "]\n" " 4. Load \"" INIT_FILENAME "\" [when -i]\n"
" 5. Run read-eval-print loop [when " REPL_FLAGS "]\n" " 5. Run read-eval-print loop [when -i]\n"
# ifdef YIELD_BEFORE_EXIT # ifdef YIELD_BEFORE_EXIT
" 6. Run `(yield 'wait)' [unless -V]\n" " 6. Run `(yield 'wait)' [unless -V]\n"
# endif # endif

View File

@ -32,7 +32,7 @@
static int page_size; /* OS page size */ static int page_size; /* OS page size */
#ifndef MAP_ANON #ifndef MAP_ANON
int fd, fd_created; static int fd, fd_created;
#endif #endif
inline static void *find_cached_pages(size_t len, size_t alignment, int dirty_ok); inline static void *find_cached_pages(size_t len, size_t alignment, int dirty_ok);

View File

@ -172,6 +172,9 @@ GC_malloc
GC_malloc_atomic GC_malloc_atomic
GC_malloc_stubborn GC_malloc_stubborn
GC_malloc_uncollectable GC_malloc_uncollectable
scheme_malloc_code
scheme_free_code
scheme_malloc_gcable_code
scheme_malloc_eternal scheme_malloc_eternal
scheme_end_stubborn_change scheme_end_stubborn_change
scheme_calloc scheme_calloc

View File

@ -177,6 +177,9 @@ GC_malloc_array_tagged
GC_malloc_allow_interior GC_malloc_allow_interior
GC_malloc_atomic_allow_interior GC_malloc_atomic_allow_interior
GC_malloc_tagged_allow_interior GC_malloc_tagged_allow_interior
scheme_malloc_code
scheme_free_code
scheme_malloc_gcable_code
scheme_malloc_eternal scheme_malloc_eternal
scheme_end_stubborn_change scheme_end_stubborn_change
scheme_calloc scheme_calloc

View File

@ -160,6 +160,9 @@ EXPORTS
scheme_eval_compiled_sized_string scheme_eval_compiled_sized_string
scheme_eval_compiled_sized_string_with_magic scheme_eval_compiled_sized_string_with_magic
scheme_detach_multple_array scheme_detach_multple_array
scheme_malloc_code
scheme_free_code
scheme_malloc_gcable_code
scheme_malloc_eternal scheme_malloc_eternal
scheme_end_stubborn_change scheme_end_stubborn_change
scheme_calloc scheme_calloc

View File

@ -169,6 +169,9 @@ EXPORTS
GC_malloc_allow_interior GC_malloc_allow_interior
GC_malloc_atomic_allow_interior GC_malloc_atomic_allow_interior
GC_malloc_tagged_allow_interior GC_malloc_tagged_allow_interior
scheme_malloc_code
scheme_free_code
scheme_malloc_gcable_code
scheme_malloc_eternal scheme_malloc_eternal
scheme_end_stubborn_change scheme_end_stubborn_change
scheme_calloc scheme_calloc

View File

@ -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_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(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 */ /* Initialization */
MZ_EXTERN Scheme_Env *scheme_basic_env(void); 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); MZ_EXTERN int scheme_get_external_event_fd(void);
/* GC registration: */ /* GC registration: */
MZ_EXTERN void scheme_set_primordial_stack_base(void *base, int no_auto_statics); MZ_EXTERN void scheme_set_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_bounds(void *base, void *deepest, int no_auto_statics);
/* Stack-preparation start-up: */ /* Stack-preparation start-up: */
typedef int (*Scheme_Nested_Main)(void *data); typedef int (*Scheme_Nested_Main)(void *data);

View File

@ -695,6 +695,7 @@
#else #else
# define MZ_USE_JIT_I386 # define MZ_USE_JIT_I386
#endif #endif
# define MZ_JIT_USE_MPROTECT
# define FLAGS_ALREADY_SET # define FLAGS_ALREADY_SET

View File

@ -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, 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, 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, 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, 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, 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, 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,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, 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, 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,147,225,16,0,97,10,37,11,8,147,225,16,0,13,16, 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, 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, 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, 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, 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, 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, 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, 2,18,3,1,7,101,110,118,57,57,52,52,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, 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, 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, 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, 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, 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, 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,56,50,55,51,248,22,190,3,193,27,248, 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, 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, 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, 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, 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, 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, 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, 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,56,50,57,54,18,158,94,10,64,118,111, 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, 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, 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, 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); 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, 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, 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, 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, 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, 220,10,227,10,102,11,115,11,70,12,172,12,185,12,207,12,159,13,63,14,134,
15,139,15,165,15,19,16,0,0,54,19,0,0,29,11,11,72,112,97,116,104, 15,142,15,150,15,176,15,30,16,0,0,75,19,0,0,29,11,11,72,112,97,
45,115,116,114,105,110,103,63,64,98,115,98,115,76,110,111,114,109,97,108,45, 116,104,45,115,116,114,105,110,103,63,64,98,115,98,115,76,110,111,114,109,97,
99,97,115,101,45,112,97,116,104,74,45,99,104,101,99,107,45,114,101,108,112, 108,45,99,97,115,101,45,112,97,116,104,74,45,99,104,101,99,107,45,114,101,
97,116,104,77,45,99,104,101,99,107,45,99,111,108,108,101,99,116,105,111,110, 108,112,97,116,104,77,45,99,104,101,99,107,45,99,111,108,108,101,99,116,105,
75,99,111,108,108,101,99,116,105,111,110,45,112,97,116,104,69,45,102,105,110, 111,110,75,99,111,108,108,101,99,116,105,111,110,45,112,97,116,104,69,45,102,
100,45,99,111,108,77,99,104,101,99,107,45,115,117,102,102,105,120,45,99,97, 105,110,100,45,99,111,108,77,99,104,101,99,107,45,115,117,102,102,105,120,45,
108,108,79,112,97,116,104,45,114,101,112,108,97,99,101,45,115,117,102,102,105, 99,97,108,108,79,112,97,116,104,45,114,101,112,108,97,99,101,45,115,117,102,
120,75,112,97,116,104,45,97,100,100,45,115,117,102,102,105,120,77,108,111,97, 102,105,120,75,112,97,116,104,45,97,100,100,45,115,117,102,102,105,120,77,108,
100,47,117,115,101,45,99,111,109,112,105,108,101,100,1,29,102,105,110,100,45, 111,97,100,47,117,115,101,45,99,111,109,112,105,108,101,100,1,29,102,105,110,
108,105,98,114,97,114,121,45,99,111,108,108,101,99,116,105,111,110,45,112,97, 100,45,108,105,98,114,97,114,121,45,99,111,108,108,101,99,116,105,111,110,45,
116,104,115,1,27,112,97,116,104,45,108,105,115,116,45,115,116,114,105,110,103, 112,97,116,104,115,1,27,112,97,116,104,45,108,105,115,116,45,115,116,114,105,
45,62,112,97,116,104,45,108,105,115,116,1,20,102,105,110,100,45,101,120,101, 110,103,45,62,112,97,116,104,45,108,105,115,116,1,20,102,105,110,100,45,101,
99,117,116,97,98,108,101,45,112,97,116,104,73,101,109,98,101,100,100,101,100, 120,101,99,117,116,97,98,108,101,45,112,97,116,104,73,101,109,98,101,100,100,
45,108,111,97,100,65,113,117,111,116,101,29,94,2,17,68,35,37,112,97,114, 101,100,45,108,111,97,100,65,113,117,111,116,101,29,94,2,17,68,35,37,112,
97,109,122,11,64,108,111,111,112,69,101,120,101,99,45,102,105,108,101,67,119, 97,114,97,109,122,11,64,108,111,111,112,69,101,120,101,99,45,102,105,108,101,
105,110,100,111,119,115,6,25,25,112,97,116,104,32,111,114,32,118,97,108,105, 67,119,105,110,100,111,119,115,6,25,25,112,97,116,104,32,111,114,32,118,97,
100,45,112,97,116,104,32,115,116,114,105,110,103,6,29,29,126,97,58,32,105, 108,105,100,45,112,97,116,104,32,115,116,114,105,110,103,6,29,29,126,97,58,
110,118,97,108,105,100,32,114,101,108,97,116,105,118,101,32,112,97,116,104,58, 32,105,110,118,97,108,105,100,32,114,101,108,97,116,105,118,101,32,112,97,116,
32,126,115,6,42,42,126,97,58,32,99,111,108,108,101,99,116,105,111,110,32, 104,58,32,126,115,6,42,42,126,97,58,32,99,111,108,108,101,99,116,105,111,
110,111,116,32,102,111,117,110,100,58,32,126,115,32,105,110,32,97,110,121,32, 110,32,110,111,116,32,102,111,117,110,100,58,32,126,115,32,105,110,32,97,110,
111,102,58,32,126,115,6,42,42,112,97,116,104,32,40,102,111,114,32,97,110, 121,32,111,102,58,32,126,115,6,42,42,112,97,116,104,32,40,102,111,114,32,
121,32,115,121,115,116,101,109,41,32,111,114,32,118,97,108,105,100,45,112,97, 97,110,121,32,115,121,115,116,101,109,41,32,111,114,32,118,97,108,105,100,45,
116,104,32,115,116,114,105,110,103,6,21,21,115,116,114,105,110,103,32,111,114, 112,97,116,104,32,115,116,114,105,110,103,6,21,21,115,116,114,105,110,103,32,
32,98,121,116,101,32,115,116,114,105,110,103,6,36,36,99,97,110,110,111,116, 111,114,32,98,121,116,101,32,115,116,114,105,110,103,6,36,36,99,97,110,110,
32,97,100,100,32,97,32,115,117,102,102,105,120,32,116,111,32,97,32,114,111, 111,116,32,97,100,100,32,97,32,115,117,102,102,105,120,32,116,111,32,97,32,
111,116,32,112,97,116,104,58,32,5,0,27,20,14,159,80,158,36,50,250,80, 114,111,111,116,32,112,97,116,104,58,32,5,0,27,20,14,159,80,158,36,50,
158,39,51,249,22,27,11,80,158,41,50,22,170,12,10,248,22,147,5,23,196, 250,80,158,39,51,249,22,27,11,80,158,41,50,22,170,12,10,248,22,147,5,
2,28,248,22,144,6,23,194,2,12,87,94,248,22,157,8,23,194,1,248,80, 23,196,2,28,248,22,144,6,23,194,2,12,87,94,248,22,157,8,23,194,1,
159,37,53,36,195,28,248,22,71,23,195,2,9,27,248,22,64,23,196,2,27, 248,80,159,37,53,36,195,28,248,22,71,23,195,2,9,27,248,22,64,23,196,
28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195,2,249,22, 2,27,28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195,2,
152,13,23,196,1,250,80,158,42,48,248,22,166,13,2,20,11,10,250,80,158, 249,22,152,13,23,196,1,250,80,158,42,48,248,22,166,13,2,20,11,10,250,
40,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22,63,248,22, 80,158,40,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22,63,
154,13,249,22,152,13,23,198,1,247,22,167,13,27,248,22,65,23,200,1,28, 248,22,154,13,249,22,152,13,23,198,1,247,22,167,13,27,248,22,65,23,200,
248,22,71,23,194,2,9,27,248,22,64,23,195,2,27,28,248,22,151,13,23, 1,28,248,22,71,23,194,2,9,27,248,22,64,23,195,2,27,28,248,22,151,
195,2,23,194,1,28,248,22,150,13,23,195,2,249,22,152,13,23,196,1,250, 13,23,195,2,23,194,1,28,248,22,150,13,23,195,2,249,22,152,13,23,196,
80,158,47,48,248,22,166,13,2,20,11,10,250,80,158,45,48,248,22,166,13, 1,250,80,158,47,48,248,22,166,13,2,20,11,10,250,80,158,45,48,248,22,
2,20,23,197,1,10,28,23,193,2,249,22,63,248,22,154,13,249,22,152,13, 166,13,2,20,23,197,1,10,28,23,193,2,249,22,63,248,22,154,13,249,22,
23,198,1,247,22,167,13,248,80,159,45,52,36,248,22,65,23,199,1,87,94, 152,13,23,198,1,247,22,167,13,248,80,159,45,52,36,248,22,65,23,199,1,
23,193,1,248,80,159,43,52,36,248,22,65,23,197,1,87,94,23,193,1,27, 87,94,23,193,1,248,80,159,43,52,36,248,22,65,23,197,1,87,94,23,193,
248,22,65,23,198,1,28,248,22,71,23,194,2,9,27,248,22,64,23,195,2, 1,27,248,22,65,23,198,1,28,248,22,71,23,194,2,9,27,248,22,64,23,
27,28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195,2,249, 195,2,27,28,248,22,151,13,23,195,2,23,194,1,28,248,22,150,13,23,195,
22,152,13,23,196,1,250,80,158,45,48,248,22,166,13,2,20,11,10,250,80, 2,249,22,152,13,23,196,1,250,80,158,45,48,248,22,166,13,2,20,11,10,
158,43,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22,63,248, 250,80,158,43,48,248,22,166,13,2,20,23,197,1,10,28,23,193,2,249,22,
22,154,13,249,22,152,13,23,198,1,247,22,167,13,248,80,159,43,52,36,248, 63,248,22,154,13,249,22,152,13,23,198,1,247,22,167,13,248,80,159,43,52,
22,65,23,199,1,248,80,159,41,52,36,248,22,65,196,27,248,22,191,12,23, 36,248,22,65,23,199,1,248,80,159,41,52,36,248,22,65,196,27,248,22,191,
195,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6,23,195,2,27, 12,23,195,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6,23,195,
248,22,149,13,195,28,192,192,248,22,150,13,195,11,87,94,28,28,248,22,128, 2,27,248,22,149,13,195,28,192,192,248,22,150,13,195,11,87,94,28,28,248,
13,23,195,2,10,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94,23, 22,128,13,23,195,2,10,27,248,22,191,12,23,196,2,28,23,193,2,192,87,
193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23,193, 94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,
2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8,76, 23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,
110,111,114,109,97,108,45,112,97,116,104,45,99,97,115,101,6,42,42,112,97, 8,76,110,111,114,109,97,108,45,112,97,116,104,45,99,97,115,101,6,42,42,
116,104,32,40,102,111,114,32,97,110,121,32,115,121,115,116,101,109,41,32,111, 112,97,116,104,32,40,102,111,114,32,97,110,121,32,115,121,115,116,101,109,41,
114,32,118,97,108,105,100,45,112,97,116,104,32,115,116,114,105,110,103,23,197, 32,111,114,32,118,97,108,105,100,45,112,97,116,104,32,115,116,114,105,110,103,
2,28,28,248,22,128,13,23,195,2,249,22,154,8,248,22,129,13,23,197,2, 23,197,2,28,28,248,22,128,13,23,195,2,249,22,154,8,248,22,129,13,23,
2,21,249,22,154,8,247,22,168,7,2,21,27,28,248,22,149,6,23,196,2, 197,2,2,21,249,22,154,8,247,22,168,7,2,21,27,28,248,22,149,6,23,
23,195,2,248,22,158,7,248,22,132,13,23,197,2,28,249,22,179,13,0,21, 196,2,23,195,2,248,22,158,7,248,22,132,13,23,197,2,28,249,22,179,13,
35,114,120,34,94,91,92,92,93,91,92,92,93,91,63,93,91,92,92,93,34, 0,21,35,114,120,34,94,91,92,92,93,91,92,92,93,91,63,93,91,92,92,
23,195,2,28,248,22,149,6,195,248,22,135,13,195,194,27,248,22,188,6,23, 93,34,23,195,2,28,248,22,149,6,195,248,22,135,13,195,194,27,248,22,188,
195,1,249,22,136,13,248,22,161,7,250,22,185,13,0,6,35,114,120,34,47, 6,23,195,1,249,22,136,13,248,22,161,7,250,22,185,13,0,6,35,114,120,
34,28,249,22,179,13,0,22,35,114,120,34,91,47,92,92,93,91,46,32,93, 34,47,34,28,249,22,179,13,0,22,35,114,120,34,91,47,92,92,93,91,46,
43,91,47,92,92,93,42,36,34,23,201,2,23,199,1,250,22,185,13,0,19, 32,93,43,91,47,92,92,93,42,36,34,23,201,2,23,199,1,250,22,185,13,
35,114,120,34,91,32,46,93,43,40,91,47,92,92,93,42,41,36,34,23,202, 0,19,35,114,120,34,91,32,46,93,43,40,91,47,92,92,93,42,41,36,34,
1,6,2,2,92,49,80,158,43,36,2,21,28,248,22,149,6,194,248,22,135, 23,202,1,6,2,2,92,49,80,158,43,36,2,21,28,248,22,149,6,194,248,
13,194,193,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94, 22,135,13,194,193,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,
23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23, 87,94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,
193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8, 28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,
23,196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11, 184,8,23,196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,
249,22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201,1,247, 146,11,249,22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201,
22,23,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94,23, 1,247,22,23,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87,
193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23,193, 94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,
2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8,23, 23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,
196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11,249, 8,23,196,2,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,
22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201,1,247,22, 11,249,22,155,10,248,22,178,6,250,22,133,7,2,23,23,200,1,23,201,1,
23,87,94,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,87,94, 247,22,23,87,94,87,94,28,27,248,22,191,12,23,196,2,28,23,193,2,192,
23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,28,23, 87,94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,23,197,2,
193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,184,8, 28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,12,250,22,
195,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11,249,22, 184,8,195,2,22,23,197,2,28,248,22,149,13,23,195,2,12,248,22,146,11,
155,10,248,22,178,6,250,22,133,7,2,23,199,23,201,1,247,22,23,249,22, 249,22,155,10,248,22,178,6,250,22,133,7,2,23,199,23,201,1,247,22,23,
3,89,162,8,44,36,49,9,223,2,33,34,196,248,22,146,11,249,22,185,10, 249,22,3,89,162,8,44,36,49,9,223,2,33,34,196,248,22,146,11,249,22,
23,196,1,247,22,23,87,94,250,80,159,38,39,36,2,7,196,197,251,80,159, 185,10,23,196,1,247,22,23,87,94,250,80,159,38,39,36,2,7,196,197,251,
39,41,36,2,7,32,0,89,162,8,44,36,44,9,222,33,36,197,198,32,38, 80,159,39,41,36,2,7,32,0,89,162,8,44,36,44,9,222,33,36,197,198,
89,162,43,41,58,65,99,108,111,111,112,222,33,39,28,248,22,71,23,199,2, 32,38,89,162,43,41,58,65,99,108,111,111,112,222,33,39,28,248,22,71,23,
87,94,23,198,1,248,23,196,1,251,22,133,7,2,24,23,199,1,28,248,22, 199,2,87,94,23,198,1,248,23,196,1,251,22,133,7,2,24,23,199,1,28,
71,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,145,13,23,204,1, 248,22,71,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,145,13,23,
23,205,1,23,198,1,27,249,22,145,13,248,22,64,23,202,2,23,199,2,28, 204,1,23,205,1,23,198,1,27,249,22,145,13,248,22,64,23,202,2,23,199,
248,22,140,13,23,194,2,27,250,22,1,22,145,13,23,197,1,23,202,2,28, 2,28,248,22,140,13,23,194,2,27,250,22,1,22,145,13,23,197,1,23,202,
248,22,140,13,23,194,2,192,87,94,23,193,1,27,248,22,65,23,202,1,28, 2,28,248,22,140,13,23,194,2,192,87,94,23,193,1,27,248,22,65,23,202,
248,22,71,23,194,2,87,94,23,193,1,248,23,199,1,251,22,133,7,2,24, 1,28,248,22,71,23,194,2,87,94,23,193,1,248,23,199,1,251,22,133,7,
23,202,1,28,248,22,71,23,206,2,87,94,23,205,1,23,204,1,250,22,1, 2,24,23,202,1,28,248,22,71,23,206,2,87,94,23,205,1,23,204,1,250,
22,145,13,23,207,1,23,208,1,23,201,1,27,249,22,145,13,248,22,64,23, 22,1,22,145,13,23,207,1,23,208,1,23,201,1,27,249,22,145,13,248,22,
197,2,23,202,2,28,248,22,140,13,23,194,2,27,250,22,1,22,145,13,23, 64,23,197,2,23,202,2,28,248,22,140,13,23,194,2,27,250,22,1,22,145,
197,1,204,28,248,22,140,13,193,192,253,2,38,203,204,205,206,23,15,248,22, 13,23,197,1,204,28,248,22,140,13,193,192,253,2,38,203,204,205,206,23,15,
65,201,253,2,38,202,203,204,205,206,248,22,65,200,87,94,23,193,1,27,248, 248,22,65,201,253,2,38,202,203,204,205,206,248,22,65,200,87,94,23,193,1,
22,65,23,201,1,28,248,22,71,23,194,2,87,94,23,193,1,248,23,198,1, 27,248,22,65,23,201,1,28,248,22,71,23,194,2,87,94,23,193,1,248,23,
251,22,133,7,2,24,23,201,1,28,248,22,71,23,205,2,87,94,23,204,1, 198,1,251,22,133,7,2,24,23,201,1,28,248,22,71,23,205,2,87,94,23,
23,203,1,250,22,1,22,145,13,23,206,1,23,207,1,23,200,1,27,249,22, 204,1,23,203,1,250,22,1,22,145,13,23,206,1,23,207,1,23,200,1,27,
145,13,248,22,64,23,197,2,23,201,2,28,248,22,140,13,23,194,2,27,250, 249,22,145,13,248,22,64,23,197,2,23,201,2,28,248,22,140,13,23,194,2,
22,1,22,145,13,23,197,1,203,28,248,22,140,13,193,192,253,2,38,202,203, 27,250,22,1,22,145,13,23,197,1,203,28,248,22,140,13,193,192,253,2,38,
204,205,206,248,22,65,201,253,2,38,201,202,203,204,205,248,22,65,200,27,247, 202,203,204,205,206,248,22,65,201,253,2,38,201,202,203,204,205,248,22,65,200,
22,168,13,253,2,38,198,199,200,201,202,198,87,95,28,28,248,22,128,13,23, 27,247,22,168,13,253,2,38,198,199,200,201,202,198,87,95,28,28,248,22,128,
194,2,10,27,248,22,191,12,23,195,2,28,23,193,2,192,87,94,23,193,1, 13,23,194,2,10,27,248,22,191,12,23,195,2,28,23,193,2,192,87,94,23,
28,248,22,149,6,23,195,2,27,248,22,149,13,23,196,2,28,23,193,2,192, 193,1,28,248,22,149,6,23,195,2,27,248,22,149,13,23,196,2,28,23,193,
87,94,23,193,1,248,22,150,13,23,196,2,11,12,252,22,184,8,23,200,2, 2,192,87,94,23,193,1,248,22,150,13,23,196,2,11,12,252,22,184,8,23,
2,25,35,23,198,2,23,199,2,28,28,248,22,149,6,23,195,2,10,248,22, 200,2,2,25,35,23,198,2,23,199,2,28,28,248,22,149,6,23,195,2,10,
137,7,23,195,2,87,94,23,194,1,12,252,22,184,8,23,200,2,2,26,36, 248,22,137,7,23,195,2,87,94,23,194,1,12,252,22,184,8,23,200,2,2,
23,198,2,23,199,1,91,159,38,11,90,161,38,35,11,248,22,148,13,23,197, 26,36,23,198,2,23,199,1,91,159,38,11,90,161,38,35,11,248,22,148,13,
2,87,94,23,195,1,87,94,28,192,12,250,22,185,8,23,201,1,2,27,23, 23,197,2,87,94,23,195,1,87,94,28,192,12,250,22,185,8,23,201,1,2,
199,1,249,22,7,194,195,91,159,37,11,90,161,37,35,11,87,95,28,28,248, 27,23,199,1,249,22,7,194,195,91,159,37,11,90,161,37,35,11,87,95,28,
22,128,13,23,196,2,10,27,248,22,191,12,23,197,2,28,23,193,2,192,87, 28,248,22,128,13,23,196,2,10,27,248,22,191,12,23,197,2,28,23,193,2,
94,23,193,1,28,248,22,149,6,23,197,2,27,248,22,149,13,23,198,2,28, 192,87,94,23,193,1,28,248,22,149,6,23,197,2,27,248,22,149,13,23,198,
23,193,2,192,87,94,23,193,1,248,22,150,13,23,198,2,11,12,252,22,184, 2,28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,198,2,11,12,252,
8,2,10,2,25,35,23,200,2,23,201,2,28,28,248,22,149,6,23,197,2, 22,184,8,2,10,2,25,35,23,200,2,23,201,2,28,28,248,22,149,6,23,
10,248,22,137,7,23,197,2,12,252,22,184,8,2,10,2,26,36,23,200,2, 197,2,10,248,22,137,7,23,197,2,12,252,22,184,8,2,10,2,26,36,23,
23,201,2,91,159,38,11,90,161,38,35,11,248,22,148,13,23,199,2,87,94, 200,2,23,201,2,91,159,38,11,90,161,38,35,11,248,22,148,13,23,199,2,
23,195,1,87,94,28,23,193,2,12,250,22,185,8,2,10,2,27,23,201,2, 87,94,23,195,1,87,94,28,23,193,2,12,250,22,185,8,2,10,2,27,23,
249,22,7,23,195,1,23,196,1,27,249,22,137,13,250,22,184,13,0,18,35, 201,2,249,22,7,23,195,1,23,196,1,27,249,22,137,13,250,22,184,13,0,
114,120,35,34,40,91,46,93,91,94,46,93,42,124,41,36,34,248,22,133,13, 18,35,114,120,35,34,40,91,46,93,91,94,46,93,42,124,41,36,34,248,22,
23,201,1,28,248,22,149,6,23,203,2,249,22,161,7,23,204,1,8,63,23, 133,13,23,201,1,28,248,22,149,6,23,203,2,249,22,161,7,23,204,1,8,
202,1,28,248,22,128,13,23,199,2,248,22,129,13,23,199,1,87,94,23,198, 63,23,202,1,28,248,22,128,13,23,199,2,248,22,129,13,23,199,1,87,94,
1,247,22,130,13,28,248,22,191,12,194,249,22,145,13,195,194,192,91,159,37, 23,198,1,247,22,130,13,28,248,22,191,12,194,249,22,145,13,195,194,192,91,
11,90,161,37,35,11,87,95,28,28,248,22,128,13,23,196,2,10,27,248,22, 159,37,11,90,161,37,35,11,87,95,28,28,248,22,128,13,23,196,2,10,27,
191,12,23,197,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6,23, 248,22,191,12,23,197,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,
197,2,27,248,22,149,13,23,198,2,28,23,193,2,192,87,94,23,193,1,248, 6,23,197,2,27,248,22,149,13,23,198,2,28,23,193,2,192,87,94,23,193,
22,150,13,23,198,2,11,12,252,22,184,8,2,11,2,25,35,23,200,2,23, 1,248,22,150,13,23,198,2,11,12,252,22,184,8,2,11,2,25,35,23,200,
201,2,28,28,248,22,149,6,23,197,2,10,248,22,137,7,23,197,2,12,252, 2,23,201,2,28,28,248,22,149,6,23,197,2,10,248,22,137,7,23,197,2,
22,184,8,2,11,2,26,36,23,200,2,23,201,2,91,159,38,11,90,161,38, 12,252,22,184,8,2,11,2,26,36,23,200,2,23,201,2,91,159,38,11,90,
35,11,248,22,148,13,23,199,2,87,94,23,195,1,87,94,28,23,193,2,12, 161,38,35,11,248,22,148,13,23,199,2,87,94,23,195,1,87,94,28,23,193,
250,22,185,8,2,11,2,27,23,201,2,249,22,7,23,195,1,23,196,1,27, 2,12,250,22,185,8,2,11,2,27,23,201,2,249,22,7,23,195,1,23,196,
249,22,137,13,249,22,147,7,250,22,185,13,0,9,35,114,120,35,34,91,46, 1,27,249,22,137,13,249,22,147,7,250,22,185,13,0,9,35,114,120,35,34,
93,34,248,22,133,13,23,203,1,6,1,1,95,28,248,22,149,6,23,202,2, 91,46,93,34,248,22,133,13,23,203,1,6,1,1,95,28,248,22,149,6,23,
249,22,161,7,23,203,1,8,63,23,201,1,28,248,22,128,13,23,199,2,248, 202,2,249,22,161,7,23,203,1,8,63,23,201,1,28,248,22,128,13,23,199,
22,129,13,23,199,1,87,94,23,198,1,247,22,130,13,28,248,22,191,12,194, 2,248,22,129,13,23,199,1,87,94,23,198,1,247,22,130,13,28,248,22,191,
249,22,145,13,195,194,192,249,247,22,180,4,194,11,248,80,158,36,46,9,27, 12,194,249,22,145,13,195,194,192,249,247,22,180,4,194,11,249,80,158,37,46,
247,22,170,13,249,80,158,38,47,28,23,195,2,27,248,22,166,7,6,11,11, 9,9,249,80,158,37,46,195,9,27,247,22,170,13,249,80,158,38,47,28,23,
80,76,84,67,79,76,76,69,67,84,83,28,192,192,6,0,0,6,0,0,27, 195,2,27,248,22,166,7,6,11,11,80,76,84,67,79,76,76,69,67,84,83,
28,23,196,1,250,22,145,13,248,22,166,13,69,97,100,100,111,110,45,100,105, 28,192,192,6,0,0,6,0,0,27,28,23,196,1,250,22,145,13,248,22,166,
114,247,22,164,7,6,8,8,99,111,108,108,101,99,116,115,11,27,248,80,159, 13,69,97,100,100,111,110,45,100,105,114,247,22,164,7,6,8,8,99,111,108,
41,52,36,249,22,77,23,202,1,248,22,73,248,22,166,13,72,99,111,108,108, 108,101,99,116,115,11,27,248,80,159,41,52,36,250,22,77,23,203,1,248,22,
101,99,116,115,45,100,105,114,28,23,194,2,249,22,63,23,196,1,23,195,1, 73,248,22,166,13,72,99,111,108,108,101,99,116,115,45,100,105,114,23,204,1,
192,32,47,89,162,8,44,38,54,2,19,222,33,48,27,249,22,177,13,23,197, 28,23,194,2,249,22,63,23,196,1,23,195,1,192,32,48,89,162,8,44,38,
2,23,198,2,28,23,193,2,87,94,23,196,1,27,248,22,88,23,195,2,27, 54,2,19,222,33,49,27,249,22,177,13,23,197,2,23,198,2,28,23,193,2,
27,248,22,97,23,197,1,27,249,22,177,13,23,201,2,23,196,2,28,23,193, 87,94,23,196,1,27,248,22,88,23,195,2,27,27,248,22,97,23,197,1,27,
2,87,94,23,194,1,27,248,22,88,23,195,2,27,250,2,47,23,203,2,23, 249,22,177,13,23,201,2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,
204,1,248,22,97,23,199,1,28,249,22,143,7,23,196,2,2,28,249,22,77, 22,88,23,195,2,27,250,2,48,23,203,2,23,204,1,248,22,97,23,199,1,
23,202,2,194,249,22,63,248,22,136,13,23,197,1,23,195,1,87,95,23,199, 28,249,22,143,7,23,196,2,2,28,249,22,77,23,202,2,194,249,22,63,248,
1,23,193,1,28,249,22,143,7,23,196,2,2,28,249,22,77,23,200,2,9, 22,136,13,23,197,1,23,195,1,87,95,23,199,1,23,193,1,28,249,22,143,
249,22,63,248,22,136,13,23,197,1,9,28,249,22,143,7,23,196,2,2,28, 7,23,196,2,2,28,249,22,77,23,200,2,9,249,22,63,248,22,136,13,23,
249,22,77,197,194,87,94,23,196,1,249,22,63,248,22,136,13,23,197,1,194, 197,1,9,28,249,22,143,7,23,196,2,2,28,249,22,77,197,194,87,94,23,
87,94,23,193,1,28,249,22,143,7,23,198,2,2,28,249,22,77,195,9,87, 196,1,249,22,63,248,22,136,13,23,197,1,194,87,94,23,193,1,28,249,22,
94,23,194,1,249,22,63,248,22,136,13,23,199,1,9,87,95,28,28,248,22, 143,7,23,198,2,2,28,249,22,77,195,9,87,94,23,194,1,249,22,63,248,
137,7,194,10,248,22,149,6,194,12,250,22,184,8,2,14,6,21,21,98,121, 22,136,13,23,199,1,9,87,95,28,28,248,22,137,7,194,10,248,22,149,6,
116,101,32,115,116,114,105,110,103,32,111,114,32,115,116,114,105,110,103,196,28, 194,12,250,22,184,8,2,14,6,21,21,98,121,116,101,32,115,116,114,105,110,
28,248,22,72,195,249,22,4,22,191,12,196,11,12,250,22,184,8,2,14,6, 103,32,111,114,32,115,116,114,105,110,103,196,28,28,248,22,72,195,249,22,4,
13,13,108,105,115,116,32,111,102,32,112,97,116,104,115,197,250,2,47,197,195, 22,191,12,196,11,12,250,22,184,8,2,14,6,13,13,108,105,115,116,32,111,
28,248,22,149,6,197,248,22,160,7,197,196,32,50,89,162,8,44,39,57,2, 102,32,112,97,116,104,115,197,250,2,48,197,195,28,248,22,149,6,197,248,22,
19,222,33,53,32,51,89,162,8,44,38,54,70,102,111,117,110,100,45,101,120, 160,7,197,196,32,51,89,162,8,44,39,57,2,19,222,33,54,32,52,89,162,
101,99,222,33,52,28,23,193,2,91,159,38,11,90,161,38,35,11,248,22,148, 8,44,38,54,70,102,111,117,110,100,45,101,120,101,99,222,33,53,28,23,193,
13,23,199,2,87,95,23,195,1,23,194,1,27,28,23,198,2,27,248,22,153, 2,91,159,38,11,90,161,38,35,11,248,22,148,13,23,199,2,87,95,23,195,
13,23,201,2,28,249,22,156,8,23,195,2,23,202,2,11,28,248,22,149,13, 1,23,194,1,27,28,23,198,2,27,248,22,153,13,23,201,2,28,249,22,156,
23,194,2,250,2,51,23,201,2,23,202,2,249,22,145,13,23,200,2,23,198, 8,23,195,2,23,202,2,11,28,248,22,149,13,23,194,2,250,2,52,23,201,
1,250,2,51,23,201,2,23,202,2,23,196,1,11,28,23,193,2,192,87,94, 2,23,202,2,249,22,145,13,23,200,2,23,198,1,250,2,52,23,201,2,23,
23,193,1,27,28,248,22,191,12,23,196,2,27,249,22,145,13,23,198,2,23, 202,2,23,196,1,11,28,23,193,2,192,87,94,23,193,1,27,28,248,22,191,
201,2,28,28,248,22,140,13,193,10,248,22,139,13,193,192,11,11,28,23,193, 12,23,196,2,27,249,22,145,13,23,198,2,23,201,2,28,28,248,22,140,13,
2,192,87,94,23,193,1,28,23,199,2,11,27,248,22,153,13,23,202,2,28, 193,10,248,22,139,13,193,192,11,11,28,23,193,2,192,87,94,23,193,1,28,
249,22,156,8,23,195,2,23,203,1,11,28,248,22,149,13,23,194,2,250,2, 23,199,2,11,27,248,22,153,13,23,202,2,28,249,22,156,8,23,195,2,23,
51,23,202,1,23,203,1,249,22,145,13,23,201,1,23,198,1,250,2,51,201, 203,1,11,28,248,22,149,13,23,194,2,250,2,52,23,202,1,23,203,1,249,
202,195,194,28,248,22,71,23,197,2,11,27,248,22,152,13,248,22,64,23,199, 22,145,13,23,201,1,23,198,1,250,2,52,201,202,195,194,28,248,22,71,23,
2,27,249,22,145,13,23,196,1,23,197,2,28,248,22,139,13,23,194,2,250, 197,2,11,27,248,22,152,13,248,22,64,23,199,2,27,249,22,145,13,23,196,
2,51,198,199,195,87,94,23,193,1,27,248,22,65,23,200,1,28,248,22,71, 1,23,197,2,28,248,22,139,13,23,194,2,250,2,52,198,199,195,87,94,23,
23,194,2,11,27,248,22,152,13,248,22,64,23,196,2,27,249,22,145,13,23, 193,1,27,248,22,65,23,200,1,28,248,22,71,23,194,2,11,27,248,22,152,
196,1,23,200,2,28,248,22,139,13,23,194,2,250,2,51,201,202,195,87,94, 13,248,22,64,23,196,2,27,249,22,145,13,23,196,1,23,200,2,28,248,22,
23,193,1,27,248,22,65,23,197,1,28,248,22,71,23,194,2,11,27,248,22, 139,13,23,194,2,250,2,52,201,202,195,87,94,23,193,1,27,248,22,65,23,
152,13,248,22,64,195,27,249,22,145,13,23,196,1,202,28,248,22,139,13,193, 197,1,28,248,22,71,23,194,2,11,27,248,22,152,13,248,22,64,195,27,249,
250,2,51,204,205,195,251,2,50,204,205,206,248,22,65,199,87,95,28,27,248, 22,145,13,23,196,1,202,28,248,22,139,13,193,250,2,52,204,205,195,251,2,
22,191,12,23,196,2,28,23,193,2,192,87,94,23,193,1,28,248,22,149,6, 51,204,205,206,248,22,65,199,87,95,28,27,248,22,191,12,23,196,2,28,23,
23,196,2,27,248,22,149,13,23,197,2,28,23,193,2,192,87,94,23,193,1, 193,2,192,87,94,23,193,1,28,248,22,149,6,23,196,2,27,248,22,149,13,
248,22,150,13,23,197,2,11,12,250,22,184,8,2,15,6,25,25,112,97,116, 23,197,2,28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,197,2,11,
104,32,111,114,32,115,116,114,105,110,103,32,40,115,97,110,115,32,110,117,108, 12,250,22,184,8,2,15,6,25,25,112,97,116,104,32,111,114,32,115,116,114,
41,23,197,2,28,28,23,195,2,28,27,248,22,191,12,23,197,2,28,23,193, 105,110,103,32,40,115,97,110,115,32,110,117,108,41,23,197,2,28,28,23,195,
2,192,87,94,23,193,1,28,248,22,149,6,23,197,2,27,248,22,149,13,23, 2,28,27,248,22,191,12,23,197,2,28,23,193,2,192,87,94,23,193,1,28,
198,2,28,23,193,2,192,87,94,23,193,1,248,22,150,13,23,198,2,11,248, 248,22,149,6,23,197,2,27,248,22,149,13,23,198,2,28,23,193,2,192,87,
22,149,13,23,196,2,11,10,12,250,22,184,8,2,15,6,29,29,35,102,32, 94,23,193,1,248,22,150,13,23,198,2,11,248,22,149,13,23,196,2,11,10,
111,114,32,114,101,108,97,116,105,118,101,32,112,97,116,104,32,111,114,32,115, 12,250,22,184,8,2,15,6,29,29,35,102,32,111,114,32,114,101,108,97,116,
116,114,105,110,103,23,198,2,28,28,248,22,149,13,23,195,2,91,159,38,11, 105,118,101,32,112,97,116,104,32,111,114,32,115,116,114,105,110,103,23,198,2,
90,161,38,35,11,248,22,148,13,23,198,2,249,22,154,8,194,68,114,101,108, 28,28,248,22,149,13,23,195,2,91,159,38,11,90,161,38,35,11,248,22,148,
97,116,105,118,101,11,27,248,22,166,7,6,4,4,80,65,84,72,251,2,50, 13,23,198,2,249,22,154,8,194,68,114,101,108,97,116,105,118,101,11,27,248,
23,199,1,23,200,1,23,201,1,28,23,197,2,27,249,80,158,43,47,23,200, 22,166,7,6,4,4,80,65,84,72,251,2,51,23,199,1,23,200,1,23,201,
1,9,28,249,22,154,8,247,22,168,7,2,21,249,22,63,248,22,136,13,5, 1,28,23,197,2,27,249,80,158,43,47,23,200,1,9,28,249,22,154,8,247,
1,46,23,195,1,192,9,27,248,22,152,13,23,196,1,28,248,22,139,13,193, 22,168,7,2,21,249,22,63,248,22,136,13,5,1,46,23,195,1,192,9,27,
250,2,51,198,199,195,11,250,80,158,38,48,196,197,11,250,80,158,38,48,196, 248,22,152,13,23,196,1,28,248,22,139,13,193,250,2,52,198,199,195,11,250,
11,11,87,94,249,22,140,6,247,22,176,4,195,248,22,166,5,249,22,163,3, 80,158,38,48,196,197,11,250,80,158,38,48,196,11,11,87,94,249,22,140,6,
35,249,22,147,3,197,198,27,28,23,197,2,87,95,23,196,1,23,195,1,23, 247,22,176,4,195,248,22,166,5,249,22,163,3,35,249,22,147,3,197,198,27,
197,1,87,94,23,197,1,27,248,22,166,13,2,20,27,249,80,158,40,48,23, 28,23,197,2,87,95,23,196,1,23,195,1,23,197,1,87,94,23,197,1,27,
196,1,11,27,27,248,22,166,3,23,200,1,28,192,192,35,27,27,248,22,166, 248,22,166,13,2,20,27,249,80,158,40,48,23,196,1,11,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, 3,23,200,1,28,192,192,35,27,27,248,22,166,3,23,202,1,28,192,192,35,
89,162,8,44,35,47,9,224,3,2,33,57,23,195,1,23,196,1,27,248,22, 249,22,143,5,23,197,1,83,158,39,20,97,95,89,162,8,44,35,47,9,224,
128,5,23,195,1,248,80,159,38,53,36,193,159,35,20,103,159,35,16,1,65, 3,2,33,58,23,195,1,23,196,1,27,248,22,128,5,23,195,1,248,80,159,
98,101,103,105,110,16,0,83,158,41,20,100,138,67,35,37,117,116,105,108,115, 38,53,36,193,159,35,20,103,159,35,16,1,65,98,101,103,105,110,16,0,83,
2,1,11,11,10,10,42,80,158,35,35,20,103,159,37,16,17,30,2,1,2, 158,41,20,100,138,67,35,37,117,116,105,108,115,2,1,11,11,10,10,42,80,
2,193,30,2,1,2,3,193,30,2,1,2,4,193,30,2,1,2,5,193,30, 158,35,35,20,103,159,37,16,17,30,2,1,2,2,193,30,2,1,2,3,193,
2,1,2,6,193,30,2,1,2,7,193,30,2,1,2,8,193,30,2,1,2, 30,2,1,2,4,193,30,2,1,2,5,193,30,2,1,2,6,193,30,2,1,
9,193,30,2,1,2,10,193,30,2,1,2,11,193,30,2,1,2,12,193,30, 2,7,193,30,2,1,2,8,193,30,2,1,2,9,193,30,2,1,2,10,193,
2,1,2,13,193,30,2,1,2,14,193,30,2,1,2,15,193,30,2,1,2, 30,2,1,2,11,193,30,2,1,2,12,193,30,2,1,2,13,193,30,2,1,
16,193,30,2,18,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116,105, 2,14,193,30,2,1,2,15,193,30,2,1,2,16,193,30,2,18,1,20,112,
111,110,45,107,101,121,4,30,2,18,1,23,101,120,116,101,110,100,45,112,97, 97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,45,107,101,121,4,30,
114,97,109,101,116,101,114,105,122,97,116,105,111,110,3,16,0,11,11,16,4, 2,18,1,23,101,120,116,101,110,100,45,112,97,114,97,109,101,116,101,114,105,
2,6,2,5,2,3,2,9,39,11,38,35,11,11,16,11,2,8,2,7,2, 122,97,116,105,111,110,3,16,0,11,11,16,4,2,6,2,5,2,3,2,9,
16,2,15,2,13,2,12,2,4,2,11,2,14,2,10,2,2,16,11,11,11, 39,11,38,35,11,11,16,11,2,8,2,7,2,16,2,15,2,13,2,12,2,
11,11,11,11,11,11,11,11,11,16,11,2,8,2,7,2,16,2,15,2,13, 4,2,11,2,14,2,10,2,2,16,11,11,11,11,11,11,11,11,11,11,11,
2,12,2,4,2,11,2,14,2,10,2,2,46,46,36,11,11,16,0,16,0, 11,16,11,2,8,2,7,2,16,2,15,2,13,2,12,2,4,2,11,2,14,
16,0,35,35,11,11,11,16,0,16,0,16,0,35,35,16,0,16,17,83,158, 2,10,2,2,46,46,36,11,11,16,0,16,0,16,0,35,35,11,11,11,16,
35,16,2,89,162,43,36,48,2,19,223,0,33,29,80,159,35,53,36,83,158, 0,16,0,16,0,35,35,16,0,16,17,83,158,35,16,2,89,162,43,36,48,
35,16,2,89,162,8,44,36,55,2,19,223,0,33,30,80,159,35,52,36,83, 2,19,223,0,33,29,80,159,35,53,36,83,158,35,16,2,89,162,8,44,36,
158,35,16,2,32,0,89,162,43,36,44,2,2,222,33,31,80,159,35,35,36, 55,2,19,223,0,33,30,80,159,35,52,36,83,158,35,16,2,32,0,89,162,
83,158,35,16,2,249,22,151,6,7,92,7,92,80,159,35,36,36,83,158,35, 43,36,44,2,2,222,33,31,80,159,35,35,36,83,158,35,16,2,249,22,151,
16,2,89,162,43,36,53,2,4,223,0,33,32,80,159,35,37,36,83,158,35, 6,7,92,7,92,80,159,35,36,36,83,158,35,16,2,89,162,43,36,53,2,
16,2,32,0,89,162,8,44,37,49,2,5,222,33,33,80,159,35,38,36,83, 4,223,0,33,32,80,159,35,37,36,83,158,35,16,2,32,0,89,162,8,44,
158,35,16,2,32,0,89,162,8,44,38,50,2,6,222,33,35,80,159,35,39, 37,49,2,5,222,33,33,80,159,35,38,36,83,158,35,16,2,32,0,89,162,
36,83,158,35,16,2,89,162,8,45,37,47,2,7,223,0,33,37,80,159,35, 8,44,38,50,2,6,222,33,35,80,159,35,39,36,83,158,35,16,2,89,162,
40,36,83,158,35,16,2,32,0,89,162,43,39,51,2,8,222,33,40,80,159, 8,45,37,47,2,7,223,0,33,37,80,159,35,40,36,83,158,35,16,2,32,
35,41,36,83,158,35,16,2,32,0,89,162,43,38,49,2,9,222,33,41,80, 0,89,162,43,39,51,2,8,222,33,40,80,159,35,41,36,83,158,35,16,2,
159,35,42,36,83,158,35,16,2,32,0,89,162,43,37,52,2,10,222,33,42, 32,0,89,162,43,38,49,2,9,222,33,41,80,159,35,42,36,83,158,35,16,
80,159,35,43,36,83,158,35,16,2,32,0,89,162,43,37,53,2,11,222,33, 2,32,0,89,162,43,37,52,2,10,222,33,42,80,159,35,43,36,83,158,35,
43,80,159,35,44,36,83,158,35,16,2,32,0,89,162,43,36,43,2,12,222, 16,2,32,0,89,162,43,37,53,2,11,222,33,43,80,159,35,44,36,83,158,
33,44,80,159,35,45,36,83,158,35,16,2,83,158,38,20,96,95,2,13,89, 35,16,2,32,0,89,162,43,36,43,2,12,222,33,44,80,159,35,45,36,83,
162,43,35,42,9,223,0,33,45,89,162,43,36,52,9,223,0,33,46,80,159, 158,35,16,2,83,158,38,20,96,96,2,13,89,162,43,35,43,9,223,0,33,
35,46,36,83,158,35,16,2,27,248,22,173,13,248,22,160,7,27,28,249,22, 45,89,162,43,36,44,9,223,0,33,46,89,162,43,37,54,9,223,0,33,47,
154,8,247,22,168,7,2,21,6,1,1,59,6,1,1,58,250,22,133,7,6, 80,159,35,46,36,83,158,35,16,2,27,248,22,173,13,248,22,160,7,27,28,
14,14,40,91,94,126,97,93,42,41,126,97,40,46,42,41,23,196,2,23,196, 249,22,154,8,247,22,168,7,2,21,6,1,1,59,6,1,1,58,250,22,133,
1,89,162,8,44,37,47,2,14,223,0,33,49,80,159,35,47,36,83,158,35, 7,6,14,14,40,91,94,126,97,93,42,41,126,97,40,46,42,41,23,196,2,
16,2,83,158,38,20,96,96,2,15,89,162,8,44,38,53,9,223,0,33,54, 23,196,1,89,162,8,44,37,47,2,14,223,0,33,50,80,159,35,47,36,83,
89,162,43,37,46,9,223,0,33,55,89,162,43,36,45,9,223,0,33,56,80, 158,35,16,2,83,158,38,20,96,96,2,15,89,162,8,44,38,53,9,223,0,
159,35,48,36,83,158,35,16,2,89,162,43,38,51,2,16,223,0,33,58,80, 33,55,89,162,43,37,46,9,223,0,33,56,89,162,43,36,45,9,223,0,33,
159,35,49,36,94,29,94,2,17,68,35,37,107,101,114,110,101,108,11,29,94, 57,80,159,35,48,36,83,158,35,16,2,89,162,43,38,51,2,16,223,0,33,
2,17,69,35,37,109,105,110,45,115,116,120,11,9,9,9,35,0}; 59,80,159,35,49,36,94,29,94,2,17,68,35,37,107,101,114,110,101,108,11,
EVAL_ONE_SIZED_STR((char *)expr, 5057); 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, 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, 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, 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, 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, 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, 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, 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); 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, 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, 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, 82,1,185,1,230,1,250,1,29,2,64,2,98,2,108,2,155,2,165,2,172,

View File

@ -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); 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; mz_jmp_buf * volatile save, newbuf;
Scheme_Thread * volatile p; 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; save = p->error_buf;
p->error_buf = &newbuf; p->error_buf = &newbuf;
if (!scheme_setjmp(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"); clcp = scheme_builtin_value("current-library-collection-paths");
flcp = scheme_builtin_value("find-library-collection-paths"); flcp = scheme_builtin_value("find-library-collection-paths");
if (clcp && flcp) { if (clcp && flcp) {
a[0] = extra_dirs; 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); _scheme_apply(clcp, 1, a);
} }
} }
p->error_buf = save; 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) static Scheme_Object *allow_set_undefined(int argc, Scheme_Object **argv)
{ {
return scheme_param_config("compile-allow-set!-undefined", return scheme_param_config("compile-allow-set!-undefined",

View File

@ -55,8 +55,10 @@ long PTR_TO_LONG(Scheme_Object *o)
#ifdef OBJHEAD_HAS_HASH_BITS #ifdef OBJHEAD_HAS_HASH_BITS
/* In 3m mode, we only have 14 bits of hash code in the /* In 3m mode, we only have 14 bits of hash code in the
Scheme_Object header. But the GC-level object header has some Scheme_Object header. But the GC-level object header has some
leftover bits (currently 9 or 41, depending on the platform), leftover bits (currently 9, 11, 41, or 43, depending on the
so use those, too. */ 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)) { if (GC_is_allocated(o)) {
OBJHEAD_HASH_BITS(o) = (keygen >> 16); OBJHEAD_HASH_BITS(o) = (keygen >> 16);
v |= 0x4000; v |= 0x4000;

View File

@ -48,8 +48,7 @@
# define _CALL_DARWIN # define _CALL_DARWIN
#endif #endif
/* Separate JIT_PRECISE_GC lets us test some 3m support /* Separate JIT_PRECISE_GC lets us test some 3m support in non-3m mode: */
in non-3m mode: */
#ifdef MZ_PRECISE_GC #ifdef MZ_PRECISE_GC
# define JIT_PRECISE_GC # define JIT_PRECISE_GC
#endif #endif
@ -396,13 +395,13 @@ static void *generate_one(mz_jit_state *old_jitter,
padding = 0; padding = 0;
if (gcable) { if (gcable) {
#ifdef MZ_PRECISE_GC #ifdef MZ_PRECISE_GC
buffer = malloc(size); buffer = scheme_malloc_code(size);
scheme_jit_malloced += size_pre_retained; scheme_jit_malloced += size_pre_retained;
#else #else
buffer = scheme_malloc(size); buffer = scheme_malloc_gcable_code(size);
#endif #endif
} else { } else {
buffer = malloc(size); buffer = scheme_malloc_code(size);
} }
RECORD_CODE_SIZE(size); RECORD_CODE_SIZE(size);
} else if (old_jitter) { } else if (old_jitter) {
@ -7880,7 +7879,7 @@ static void release_native_code(void *fnlized, void *p)
/* Remove name mapping: */ /* Remove name mapping: */
add_symbol((unsigned long)p, (unsigned long)p + SCHEME_INT_VAL(len), NULL, 0); add_symbol((unsigned long)p, (unsigned long)p + SCHEME_INT_VAL(len), NULL, 0);
/* Free memory: */ /* Free memory: */
free(p); scheme_free_code(p);
jit_notify_freed_code(); jit_notify_freed_code();
} }
#endif #endif

View File

@ -34,87 +34,14 @@
#ifndef __lightning_funcs_h #ifndef __lightning_funcs_h
#define __lightning_funcs_h #define __lightning_funcs_h
#ifdef MZ_JIT_USE_MPROTECT
# include <unistd.h>
# include <sys/mman.h>
#endif
#ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC
# include <windows.h>
#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 static void
jit_notify_freed_code(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 static void
jit_flush_code(void *dest, void *end) 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 */ #endif /* __lightning_funcs_h */

View File

@ -71,7 +71,7 @@ jit_flush_code(void *start, void *end)
} }
start -= ((long) start) & (cache_line_size - 1); 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 */ /* Force data cache write-backs */
for (ddest = (char *) start; ddest <= (char *) end; ddest += cache_line_size) { for (ddest = (char *) start; ddest <= (char *) end; ddest += cache_line_size) {

View File

@ -39,6 +39,17 @@
# define MALLOC malloc # define MALLOC malloc
#endif #endif
#ifdef MZ_JIT_USE_MPROTECT
# include <unistd.h>
# include <sys/mman.h>
# ifndef MAP_ANON
# include <fcntl.h>
# endif
#endif
#ifdef MZ_JIT_USE_WINDOWS_VIRTUAL_ALLOC
# include <windows.h>
#endif
static void **dgc_array; static void **dgc_array;
static int *dgc_count; static int *dgc_count;
static int dgc_size; 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; static int use_registered_statics;
/************************************************************************/
/* stack setup */
/************************************************************************/
#if !defined(MZ_PRECISE_GC) && !defined(USE_SENORA_GC) #if !defined(MZ_PRECISE_GC) && !defined(USE_SENORA_GC)
extern MZ_DLLIMPORT void GC_init(); extern MZ_DLLIMPORT void GC_init();
extern MZ_DLLIMPORT unsigned long GC_get_stack_base(); extern MZ_DLLIMPORT unsigned long GC_get_stack_base();
#endif #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 #ifdef MZ_PRECISE_GC
GC_init_type_tags(_scheme_last_type_, 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; void *stack_start;
int volatile return_code; 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); 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; 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 #ifdef USE_STACK_BOUNDARY_VAR
if (deepest) { if (deepest) {
@ -165,6 +180,9 @@ extern unsigned long scheme_get_stack_base()
return (unsigned long)GC_get_stack_base(); return (unsigned long)GC_get_stack_base();
} }
/************************************************************************/
/* memory utils */
/************************************************************************/
void scheme_dont_gc_ptr(void *p) void scheme_dont_gc_ptr(void *p)
{ {
@ -286,6 +304,10 @@ scheme_strdup_eternal(const char *str)
return naya; return naya;
} }
/************************************************************************/
/* cptr */
/************************************************************************/
Scheme_Object *scheme_make_cptr(void *cptr, Scheme_Object *typetag) Scheme_Object *scheme_make_cptr(void *cptr, Scheme_Object *typetag)
{ {
Scheme_Object *o; Scheme_Object *o;
@ -311,6 +333,10 @@ Scheme_Object *scheme_make_offset_cptr(void *cptr, long offset, Scheme_Object *t
return o; return o;
} }
/************************************************************************/
/* allocation */
/************************************************************************/
#ifndef MZ_PRECISE_GC #ifndef MZ_PRECISE_GC
static Scheme_Hash_Table *immobiles; static Scheme_Hash_Table *immobiles;
#endif #endif
@ -531,6 +557,395 @@ void *scheme_malloc_uncollectable_tagged(size_t s)
#endif #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 { typedef struct Finalization {
MZTAG_IF_REQUIRED MZTAG_IF_REQUIRED
void (*f)(void *o, void *data); void (*f)(void *o, void *data);
@ -812,31 +1227,9 @@ unsigned long scheme_get_deeper_address(void)
return (unsigned long)vp; return (unsigned long)vp;
} }
/************************************************************************/
/* GC_dump */
#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
#ifndef MZ_PRECISE_GC #ifndef MZ_PRECISE_GC
# ifdef __cplusplus # ifdef __cplusplus

View File

@ -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_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_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_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_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_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_undefined[1];
MZ_EXTERN Scheme_Object *scheme_tail_call_waiting; MZ_EXTERN Scheme_Object *scheme_tail_call_waiting;
MZ_EXTERN Scheme_Object *scheme_multiple_values; MZ_EXTERN Scheme_Object *scheme_multiple_values;
@ -358,6 +358,13 @@ MZ_EXTERN void *GC_malloc_uncollectable(size_t size_in_bytes);
# endif # endif
#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_malloc_eternal(size_t n);
MZ_EXTERN void scheme_end_stubborn_change(void *p); MZ_EXTERN void scheme_end_stubborn_change(void *p);

View File

@ -291,6 +291,11 @@ void *(*GC_malloc_uncollectable)(size_t size_in_bytes);
# endif # endif
# endif # 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_malloc_eternal)(size_t n);
void (*scheme_end_stubborn_change)(void *p); void (*scheme_end_stubborn_change)(void *p);
void *(*scheme_calloc)(size_t num, size_t size); void *(*scheme_calloc)(size_t num, size_t size);

View File

@ -193,6 +193,11 @@
scheme_extension_table->GC_malloc_uncollectable = GC_malloc_uncollectable; scheme_extension_table->GC_malloc_uncollectable = GC_malloc_uncollectable;
# endif # endif
# 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 #endif
scheme_extension_table->scheme_malloc_eternal = scheme_malloc_eternal; scheme_extension_table->scheme_malloc_eternal = scheme_malloc_eternal;
scheme_extension_table->scheme_end_stubborn_change = scheme_end_stubborn_change; scheme_extension_table->scheme_end_stubborn_change = scheme_end_stubborn_change;

View File

@ -194,6 +194,11 @@
# endif # endif
# endif # 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_malloc_eternal (scheme_extension_table->scheme_malloc_eternal)
#define scheme_end_stubborn_change (scheme_extension_table->scheme_end_stubborn_change) #define scheme_end_stubborn_change (scheme_extension_table->scheme_end_stubborn_change)
#define scheme_calloc (scheme_extension_table->scheme_calloc) #define scheme_calloc (scheme_extension_table->scheme_calloc)

View File

@ -1007,6 +1007,9 @@ Scheme_Object *scheme_unclose_case_lambda(Scheme_Object *expr, int jit);
Scheme_Object *scheme_native_stack_trace(void); Scheme_Object *scheme_native_stack_trace(void);
void scheme_clean_native_symtab(void); void scheme_clean_native_symtab(void);
void scheme_clean_cust_box_list(void); void scheme_clean_cust_box_list(void);
#ifndef MZ_PRECISE_GC
void scheme_notify_code_gc(void);
#endif
/*========================================================================*/ /*========================================================================*/
/* control flow */ /* control flow */

View File

@ -261,8 +261,9 @@
"(lambda(f)((current-load/use-compiled) f #f)))" "(lambda(f)((current-load/use-compiled) f #f)))"
"(define-values(find-library-collection-paths)" "(define-values(find-library-collection-paths)"
"(case-lambda" "(case-lambda"
"(()(find-library-collection-paths null))" "(()(find-library-collection-paths null null))"
"((extra-collects-dirs)" "((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))" "(let((user-too?(use-user-specific-search-paths))"
"(cons-if(lambda(f r)(if f(cons f r) r))))" "(cons-if(lambda(f r)(if f(cons f r) r))))"
"(path-list-string->path-list" "(path-list-string->path-list"
@ -276,7 +277,8 @@
" \"collects\"))" " \"collects\"))"
"(let loop((l(append" "(let loop((l(append"
" extra-collects-dirs" " extra-collects-dirs"
"(list(find-system-path 'collects-dir)))))" "(list(find-system-path 'collects-dir))"
" post-collects-dirs)))"
"(if(null? l)" "(if(null? l)"
" null" " null"
"(let*((collects-path(car l))" "(let*((collects-path(car l))"

View File

@ -325,8 +325,9 @@
(define-values (find-library-collection-paths) (define-values (find-library-collection-paths)
(case-lambda (case-lambda
[() (find-library-collection-paths null)] [() (find-library-collection-paths null null)]
[(extra-collects-dirs) [(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)] (let ([user-too? (use-user-specific-search-paths)]
[cons-if (lambda (f r) (if f (cons f r) r))]) [cons-if (lambda (f r) (if f (cons f r) r))])
(path-list-string->path-list (path-list-string->path-list
@ -340,7 +341,8 @@
"collects")) "collects"))
(let loop ([l (append (let loop ([l (append
extra-collects-dirs extra-collects-dirs
(list (find-system-path 'collects-dir)))]) (list (find-system-path 'collects-dir))
post-collects-dirs)])
(if (null? l) (if (null? l)
null null
(let* ([collects-path (car l)] (let* ([collects-path (car l)]

View File

@ -253,6 +253,9 @@ static void clean_symbol_table(void)
# ifndef MZ_PRECISE_GC # ifndef MZ_PRECISE_GC
scheme_clean_cust_box_list(); scheme_clean_cust_box_list();
# endif # endif
# ifndef MZ_PRECISE_GC
scheme_notify_code_gc();
# endif
} }
#endif #endif

View File

@ -534,8 +534,8 @@ wxBitmap *wxClipboard::GetClipboardBitmap(long time)
bbox = *(Rect *)((char *)pd XFORM_OK_PLUS sizeof(short)); bbox = *(Rect *)((char *)pd XFORM_OK_PLUS sizeof(short));
w = bbox.right - bbox.left; w = EndianS16_BtoN(bbox.right) - EndianS16_BtoN(bbox.left);
h = bbox.bottom - bbox.top; h = EndianS16_BtoN(bbox.bottom) - EndianS16_BtoN(bbox.top);
if ((w > 0) && (w <= 10000) if ((w > 0) && (w <= 10000)
&& (h > 0) && (h <= 10000)) { && (h > 0) && (h <= 10000)) {
@ -552,6 +552,8 @@ wxBitmap *wxClipboard::GetClipboardBitmap(long time)
if (mdc->Ok()) { if (mdc->Ok()) {
Handle h; Handle h;
mdc->Clear();
/* Do we have to put it in a real handle? /* Do we have to put it in a real handle?
I'm not sure... */ I'm not sure... */
h = NewHandle(size); h = NewHandle(size);