Merge branch 'master' into samth/new-logic2

Conflicts:
	collects/typed-scheme/private/parse-type.rkt
	collects/typed-scheme/typecheck/tc-app.rkt
This commit is contained in:
Sam Tobin-Hochstadt 2010-05-05 13:35:29 -04:00
commit 1146ffa76d
504 changed files with 9099 additions and 8395 deletions

View File

@ -5,7 +5,9 @@
unstable/file
scheme/file
scheme/list
scheme/path)
scheme/path
racket/promise
openssl/sha1)
(provide make-compilation-manager-load/use-compiled-handler
managed-compile-zo
@ -13,9 +15,11 @@
trust-existing-zos
manager-compile-notify-handler
manager-skip-file-handler
file-date-in-collection
file-date-in-paths
(rename-out [trace manager-trace-handler]))
file-stamp-in-collection
file-stamp-in-paths
(rename-out [trace manager-trace-handler])
get-file-sha1
get-compiled-file-sha1)
(define manager-compile-notify-handler (make-parameter void))
(define trace (make-parameter void))
@ -23,10 +27,10 @@
(define trust-existing-zos (make-parameter #f))
(define manager-skip-file-handler (make-parameter (λ (x) #f)))
(define (file-date-in-collection p)
(file-date-in-paths p (current-library-collection-paths)))
(define (file-stamp-in-collection p)
(file-stamp-in-paths p (current-library-collection-paths)))
(define (file-date-in-paths p paths)
(define (file-stamp-in-paths p paths)
(let ([p-eles (explode-path (simplify-path p))])
(let c-loop ([paths paths])
(cond
@ -47,11 +51,16 @@
#f
(lambda () #f)))]
[date (or p-date alt-date)]
[get-path (lambda ()
(if p-date
p
(rkt->ss p)))]
[mode (car (use-compiled-file-paths))]
[get-zo-date (lambda (name)
(file-or-directory-modify-seconds
(build-path
base
(car (use-compiled-file-paths))
mode
(path-add-suffix name #".zo"))
#f
(lambda () #f)))]
@ -62,12 +71,21 @@
(not alt-date)
(not main-zo-date)))
(get-zo-date (rkt->ss name)))]
[zo-date (or main-zo-date alt-zo-date)])
(or (and date
zo-date
(max date zo-date))
date
zo-date)))]
[zo-date (or main-zo-date alt-zo-date)]
[get-zo-path (lambda ()
(if main-zo-date
(path-add-suffix name #".zo")
(path-add-suffix (rkt->ss name) #".zo")))])
(cond
[(and zo-date
(or (not date)
(zo-date . > . date)))
(cons zo-date
(delay (get-compiled-file-sha1 (get-zo-path) mode)))]
[date
(cons date
(delay (get-source-sha1 (get-path))))]
[else #f])))]
[(null? p-eles)
;; this case shouldn't happen... I think.
(c-loop (cdr paths))]
@ -107,7 +125,11 @@
dir))
(define (touch path)
(close-output-port (open-output-file path #:exists 'append)))
(file-or-directory-modify-seconds
path
(current-seconds)
(lambda ()
(close-output-port (open-output-file path #:exists 'append)))))
(define (try-file-time path)
(file-or-directory-modify-seconds path #f (lambda () #f)))
@ -148,20 +170,57 @@
(rename-file-or-directory tmp-path path #t)
(try-delete-file tmp-path))))))
(define (write-deps code mode path external-deps reader-deps)
(define (get-source-sha1 p)
(with-handlers ([exn:fail:filesystem? (lambda (exn) #f)])
(call-with-input-file* p sha1)))
(define (get-dep-sha1s deps up-to-date read-src-syntax mode must-exist?)
(let ([l (for/fold ([l null]) ([dep (in-list deps)])
(and l
;; (cons 'ext rel-path) => a non-module file, check source
;; rel-path => a module file name, check cache
(let* ([ext? (and (pair? dep) (eq? 'ext (car dep)))]
[p (main-collects-relative->path (if ext? (cdr dep) dep))])
(cond
[ext? (let ([v (get-source-sha1 p)])
(cond
[v (cons (cons (delay v) dep) l)]
[must-exist? (error 'cm "cannot find external-dependency file: ~v" p)]
[else #f]))]
[(or (hash-ref up-to-date (simplify-path (cleanse-path p)) #f)
;; Use `compiler-root' with `sha1-only?' as #t:
(compile-root mode p up-to-date read-src-syntax #t))
=> (lambda (sh)
(cons (cons (cdr sh) dep) l))]
[must-exist?
(error 'cm "internal error?; cannot find sha1 for module: ~v" p)]
[else #f]))))])
(and l
(let ([p (open-output-string)]
[l (map (lambda (v) (cons (force (car v)) (cdr v))) l)])
;; sort by sha1s so that order doesn't matter
(write (sort l string<? #:key car) p)
;; compute one hash from all hashes
(sha1 (open-input-bytes (get-output-bytes p)))))))
(define (write-deps code mode path src-sha1 external-deps reader-deps up-to-date read-src-syntax)
(let ([dep-path (path-add-suffix (get-compilation-path mode path) #".dep")]
[deps (remove-duplicates (append (get-deps code path)
reader-deps))]
[external-deps (remove-duplicates external-deps)])
(with-compile-output dep-path
(lambda (op tmp-path)
(write `(,(version)
,@(map path->main-collects-relative deps)
,@(map (lambda (x)
(let ([deps (append
(map path->main-collects-relative deps)
(map (lambda (x)
(cons 'ext (path->main-collects-relative x)))
external-deps))
external-deps))])
(write (list* (version)
(cons (or src-sha1 (get-source-sha1 path))
(get-dep-sha1s deps up-to-date read-src-syntax mode #t))
deps)
op)
(newline op)))))
(newline op))))))
(define (format-time sec)
(let ([d (seconds->date sec)])
@ -188,7 +247,7 @@
#:property prop:procedure (struct-field-index proc))
(define-struct file-dependency (path) #:prefab)
(define (compile-zo* mode path read-src-syntax zo-name)
(define (compile-zo* mode path src-sha1 read-src-syntax zo-name up-to-date)
;; The `path' argument has been converted to .rkt or .ss form,
;; as appropriate.
;; External dependencies registered through reader guard and
@ -278,7 +337,7 @@
;; Note that we check time and write .deps before returning from
;; with-compile-output...
(verify-times path tmp-name)
(write-deps code mode path external-deps reader-deps)))))
(write-deps code mode path src-sha1 external-deps reader-deps up-to-date read-src-syntax)))))
(define depth (make-parameter 0))
@ -290,16 +349,44 @@
alt-path
path))))
(define (compile-zo mode path orig-path read-src-syntax)
(define (maybe-compile-zo sha1-only? deps mode path orig-path read-src-syntax up-to-date)
(let ([actual-path (actual-source-path orig-path)])
(unless sha1-only?
((manager-compile-notify-handler) actual-path)
(trace-printf "compiling: ~a" actual-path)
(trace-printf "compiling: ~a" actual-path))
(begin0
(parameterize ([indent (string-append " " (indent))])
(let* ([zo-name (path-add-suffix (get-compilation-path mode path) #".zo")]
[zo-exists? (file-exists? zo-name)])
(if (and zo-exists? (trust-existing-zos))
(begin
(log-info (format "cm: ~atrusting ~a"
(build-string
(depth)
(λ (x) (if (= 2 (modulo x 3)) #\| #\space)))
zo-name))
(touch zo-name)
(begin (when zo-exists? (delete-file zo-name))
#f)
(let ([src-sha1 (and zo-exists?
deps
(cadr deps)
(get-source-sha1 path))])
(if (and zo-exists?
src-sha1
(equal? src-sha1 (caadr deps))
(equal? (get-dep-sha1s (cddr deps) up-to-date read-src-syntax mode #f)
(cdadr deps)))
(begin
(log-info (format "cm: ~ahash-equivalent ~a"
(build-string
(depth)
(λ (x) (if (= 2 (modulo x 3)) #\| #\space)))
zo-name))
(touch zo-name)
#f)
((if sha1-only? values (lambda (build) (build) #f))
(lambda ()
(when zo-exists? (delete-file zo-name))
(log-info (format "cm: ~acompiling ~a"
(build-string
(depth)
@ -313,8 +400,9 @@
(exn:get-module-code-path ex)
(exn-message ex))
(raise ex))])
(compile-zo* mode path read-src-syntax zo-name)))))))
(trace-printf "end compile: ~a" actual-path)))
(compile-zo* mode path src-sha1 read-src-syntax zo-name up-to-date))))))))))
(unless sha1-only?
(trace-printf "end compile: ~a" actual-path)))))
(define (get-compiled-time mode path)
(define-values (dir name) (get-compilation-dir+name mode path))
@ -324,16 +412,34 @@
(try-file-time (build-path dir (path-add-suffix name #".zo")))
-inf.0))
(define (try-file-sha1 path dep-path)
(with-handlers ([exn:fail:filesystem? (lambda (exn) #f)])
(string-append
(call-with-input-file* path sha1)
(with-handlers ([exn:fail:filesystem? (lambda (exn) "")])
(call-with-input-file* dep-path (lambda (p) (cdadr (read p))))))))
(define (get-compiled-sha1 mode path)
(define-values (dir name) (get-compilation-dir+name mode path))
(let ([dep-path (build-path dir (path-add-suffix name #".dep"))])
(or (try-file-sha1 (build-path dir "native" (system-library-subpath)
(path-add-suffix name (system-type
'so-suffix)))
dep-path)
(try-file-sha1 (build-path dir (path-add-suffix name #".zo"))
dep-path)
"")))
(define (rkt->ss p)
(let ([b (path->bytes p)])
(if (regexp-match? #rx#"[.]rkt$" b)
(path-replace-suffix p #".ss")
p)))
(define (compile-root mode path0 up-to-date read-src-syntax)
(define (compile-root mode path0 up-to-date read-src-syntax sha1-only?)
(define orig-path (simplify-path (cleanse-path path0)))
(define (read-deps path)
(with-handlers ([exn:fail:filesystem? (lambda (ex) (list (version)))])
(with-handlers ([exn:fail:filesystem? (lambda (ex) (list (version) '#f))])
(call-with-input-file
(path-add-suffix (get-compilation-path mode path) #".dep")
read)))
@ -350,18 +456,25 @@
(cond
[(not path-time)
(trace-printf "~a does not exist" orig-path)
path-zo-time]
[else
(cond
[(> path-time path-zo-time)
(trace-printf "newer src...")
(compile-zo mode path orig-path read-src-syntax)]
(or (and up-to-date (hash-ref up-to-date orig-path #f))
(let ([stamp (cons path-zo-time
(delay (get-compiled-sha1 mode path)))])
(hash-set! up-to-date main-path stamp)
(unless (eq? main-path alt-path)
(hash-set! up-to-date alt-path stamp))
stamp))]
[else
(let ([deps (read-deps path)])
(define build
(cond
[(not (and (pair? deps) (equal? (version) (car deps))))
(lambda ()
(trace-printf "newer version...")
(compile-zo mode path orig-path read-src-syntax)]
(maybe-compile-zo #f #f mode path orig-path read-src-syntax up-to-date))]
[(> path-time path-zo-time)
(trace-printf "newer src...")
;; If `sha1-only?', then `maybe-compile-zo' returns a #f or thunk:
(maybe-compile-zo sha1-only? deps mode path orig-path read-src-syntax up-to-date)]
[(ormap
(lambda (p)
;; (cons 'ext rel-path) => a non-module file (check date)
@ -370,21 +483,32 @@
(define d (main-collects-relative->path (if ext? (cdr p) p)))
(define t
(if ext?
(try-file-time d)
(compile-root mode d up-to-date read-src-syntax)))
(and t (> t path-zo-time)
(cons (try-file-time d) #f)
(compile-root mode d up-to-date read-src-syntax #f)))
(and (car t)
(> (car t) path-zo-time)
(begin (trace-printf "newer: ~a (~a > ~a)..."
d t path-zo-time)
d (car t) path-zo-time)
#t)))
(cdr deps))
(compile-zo mode path orig-path read-src-syntax)]))])
(let ([stamp (get-compiled-time mode path)])
(cddr deps))
;; If `sha1-only?', then `maybe-compile-zo' returns a #f or thunk:
(maybe-compile-zo sha1-only? deps mode path orig-path read-src-syntax up-to-date)]
[else #f]))
(cond
[(and build sha1-only?) #f]
[else
(when build (build))
(let ([stamp (cons (get-compiled-time mode path)
(delay (get-compiled-sha1 mode path)))])
(hash-set! up-to-date main-path stamp)
(unless (eq? main-path alt-path)
(hash-set! up-to-date alt-path stamp))
stamp)])))
stamp)]))])))
(or (and up-to-date (hash-ref up-to-date orig-path #f))
((manager-skip-file-handler) orig-path)
(let ([v ((manager-skip-file-handler) orig-path)])
(and v
(hash-set! up-to-date orig-path v)
v))
(begin (trace-printf "checking: ~a" orig-path)
(do-check))))
@ -400,7 +524,8 @@
(compile-root (car (use-compiled-file-paths))
(path->complete-path src)
cache
read-src-syntax)
read-src-syntax
#f)
(void)))))
(define (make-compilation-manager-load/use-compiled-handler)
@ -444,7 +569,7 @@
(namespace-module-registry (current-namespace)))]
[else
(trace-printf "processing: ~a" path)
(compile-root (car modes) path cache read-syntax)
(compile-root (car modes) path cache read-syntax #f)
(trace-printf "done: ~a" path)])
(default-handler path mod-name))
(when (null? modes)
@ -452,3 +577,11 @@
"empty use-compiled-file-paths list: "
modes))
compilation-manager-load-handler))
;; Exported:
(define (get-compiled-file-sha1 path)
(try-file-sha1 path (path-replace-suffix path #".dep")))
(define (get-file-sha1 path)
(get-source-sha1 path))

View File

@ -7,4 +7,4 @@
("decompile" compiler/commands/decompile "decompile bytecode" #f)
("expand" compiler/commands/expand "macro-expand source" #f)
("distribute" compiler/commands/exe-dir "prepare executable(s) in a directory for distribution" #f)
("c-ext" compiler/commands/c-ext "compile and link C-based extensions" #f)))
("ctool" compiler/commands/ctool "compile and link C-based extensions" #f)))

View File

@ -171,7 +171,7 @@
[len (bytes-length skip-path)])
(and ((bytes-length b) . > . len)
(bytes=? (subbytes b 0 len) skip-path)))
-inf.0))])
(list -inf.0 "")))])
(let* ([sses (append
;; Find all .rkt/.ss/.scm files:
(filter extract-base-filename/ss (directory-list))

View File

@ -2,7 +2,7 @@
@(require scribblings/htdp-langs/common
"std-grammar.ss"
"prim-ops.ss"
(for-label deinprogramm/DMdA-assignments))
(for-label deinprogramm/DMdA-assignments (only-in deinprogramm/DMdA-beginner define-record-procedures-parametric)))
@title[#:style 'toc #:tag "DMdA-assignments"]{Die Macht der Abstraktion mit Zuweisungen}
@ -45,7 +45,7 @@ Mutators sein.
@defform[(define-record-procedures-parametric-2 t cc c p (field-spec1 ...))]{
Diese Form ist wie @scheme[define-record-procedures-2], nur parametrisch
wie @schemeidfont{define-record-procedures-parametric}. Außerdem
wie @scheme[define-record-procedures-parametric]. Außerdem
werden die Verträge für die Feldinhalte, anders als bei
@scheme[define-record-procedures-parametric], sofort bei der
Konstruktion überprüft und nicht erst beim Aufruf eines Selektors.

View File

@ -213,7 +213,7 @@
(current-load/use-compiled (make-compilation-manager-load/use-compiled-handler))
(manager-skip-file-handler
(λ (p) (file-date-in-paths
(λ (p) (file-stamp-in-paths
p
(cons (CACHE-DIR) (current-library-collection-paths)))))))))

View File

@ -1,18 +0,0 @@
#lang racket/base
(require racket/class
racket/gui/base
string-constants/string-constant)
(provide syncheck-drracket-button
syncheck-bitmap
syncheck:button-callback)
(define-local-member-name syncheck:button-callback)
(define syncheck-bitmap (make-object bitmap% (build-path (collection-path "icons") "syncheck.png") 'png/mask))
(define syncheck-drracket-button
(list
(string-constant check-syntax)
syncheck-bitmap
(λ (drs-frame) (send drs-frame syncheck:button-callback))))

View File

@ -97,7 +97,6 @@ Returns a region like one made by @scheme[make-region], but the is
[y real?]
[w (and/c real? (not/c negative?))]
[h (and/c real? (not/c negative?))]
[label (or/c string? false/c)]
[paint-callback
((is-a?/c dc<%>) real? real? real? real? . -> . any)])
region?]{

View File

@ -27,7 +27,7 @@
(case key
[(drscheme:toolbar-buttons)
(list (dynamic-require 'stepper/drscheme-button 'stepper-drscheme-button)
(dynamic-require 'drscheme/syncheck-drscheme-button 'syncheck-drscheme-button))]
(dynamic-require 'drscheme/syncheck-drracket-button 'syncheck-drracket-button))]
[(drscheme:opt-out-toolbar-buttons)
;; opt-out of all of the extra buttons b/c

View File

@ -1,5 +1,10 @@
#lang racket/base
;; The posn struct for the teaching languages
(module posn mzscheme
(define-struct posn (x y) (make-inspector)) ; transparent
(provide (struct posn (x y))))
(provide (struct-out posn) make-posn)
(struct posn (x y) #:mutable #:transparent)
;; We define a separate function so tha it has the
;; name `make-posn':
(define (make-posn x y) (posn x y))

View File

@ -297,7 +297,7 @@
" if so, it produces the suffix of the list that starts with x"
" if not, it produces false."
" (it compares values with the eqv? predicate.)")
((beginner-member member?) (any (listof any) -> boolean)
((beginner-member? member?) (any (listof any) -> boolean)
"to determine whether some value is on the list"
" (comparing values with equal?)")
((beginner-member member) (any (listof any) -> boolean)

View File

@ -757,7 +757,10 @@
(stepper-syntax-property
#`(define-values (def-proc-name ...)
(let ()
(define-struct name_ (field_ ...) #:transparent #:constructor-name #,(car proc-names))
(define-struct name_ (field_ ...)
#:transparent
#:mutable
#:constructor-name #,(car proc-names))
(values proc-name ...)))
'stepper-define-struct-hint
stx))))])

View File

@ -163,6 +163,11 @@ namespace.
(check-second 'member a b)
(not (boolean? (member a b)))))
(define-teach beginner member?
(lambda (a b)
(check-second 'member? a b)
(not (boolean? (member a b)))))
(define-teach beginner remove
(lambda (a b)
(check-second 'remove a b)
@ -350,6 +355,7 @@ namespace.
beginner-sqr
beginner-list?
beginner-member
beginner-member?
beginner-remove
beginner-cons
beginner-list*

View File

@ -12,7 +12,7 @@
dynext/file-sig
compiler/sig))
@(define mzc-manual @other-manual['(lib "scribblings/mzc/mzc.scrbl")])
@(define raco-manual @other-manual['(lib "scribblings/raco/raco.scrbl")])
@title{@bold{Make}: Dependency Manager}
@ -27,8 +27,8 @@ syntax of @exec{make}, only in Scheme.
@section[#:tag "overview"]{Overview}
@margin-note{If you want to build Scheme modules with automatic
dependency tracking, just use @exec{mzc} as described in
@|mzc-manual|.}
dependency tracking, just use @exec{raco make} as described in
@|raco-manual|.}
If you are already familiar with @exec{make}, skip to the precise
details of the @schememodname[make] library in @secref["make"]. This
@ -238,8 +238,8 @@ A unit that imports nothing and exports @scheme[make^].}
The @schememodname[make/setup-extension] library helps compile C code
via Setup PLT's ``pre-install'' phase (triggered by a
@schemeidfont{pre-install-collection} item in @filepath{info.ss}; see
also @secref[#:doc '(lib "scribblings/setup-plt/setup-plt.scrbl")
@schemeidfont{pre-install-collection} item in @filepath{info.rkt}; see
also @secref[#:doc '(lib "scribblings/raco/raco.scrbl")
"setup-info"]).
The @scheme[pre-install] function takes a number of arguments that
@ -361,7 +361,7 @@ The arguments are as follows:
AIX-specific compile flag in this step when compiling under AIX.}
@item{@scheme[3m-too?]--- a boolean. If true, when the 3m variant is
installed, use the equivalent to @exec{mzc --xform} to transform
installed, use the equivalent to @exec{raco ctool --xform} to transform
the source file and then compile and link for 3m. Otherwise, the
extension is built only for CGC when the CGC variant is installed.}
@ -384,8 +384,8 @@ managing dependencies. Supply @scheme['#("zo")] as @scheme[argv] to
compile all files. The @scheme[collection-name] argument is used only
for printing status information.
Compilation is performed as with @exec{mzc --make} (see
@|mzc-manual|).}
Compilation is performed as with @exec{raco make} (see
@|raco-manual|).}
@subsection{Signature}

View File

@ -463,7 +463,7 @@
[`(ext collects ,(and (? bytes?) s) ...) (pltpath s)]
[_ (error 'dependencies "bad dependency item in ~s: ~s"
file x)]))
(cdr x))))
(cddr x))))
(dprintf "Reading dependencies...")
(let loop ([tree (tree-filter "*.dep" *plt-tree*)])
(if (pair? tree)

View File

@ -9,8 +9,8 @@
(drdr-directory "/opt/svn/drdr")
(git-path "/usr/bin/git")
(Xvfb-path "/usr/bin/Xvfb")
(current-make-install-timeout-seconds (* 60 60))
(current-make-timeout-seconds (* 60 60))
(current-make-install-timeout-seconds (* 90 60))
(current-make-timeout-seconds (* 90 60))
(current-subprocess-timeout-seconds 90)
(current-monitoring-interval-seconds 60)
(number-of-cpus 12)

View File

@ -9,7 +9,7 @@ cd "$DRDR"
kill_all() {
cat "$LOGS/"*.pid > /tmp/leave-pids-$$
KILL=`pgrep '^(Xvfb|fluxbox|mzscheme|mred(-text)?)$' | grep -w -v -f /tmp/leave-pids-$$`
KILL=`pgrep '^(Xvfb|fluxbox|racket|gracket(-text)?)$' | grep -w -v -f /tmp/leave-pids-$$`
rm /tmp/leave-pids-$$
kill -15 $KILL
sleep 2

View File

@ -3,21 +3,23 @@
"dirstruct.ss"
"scm.ss")
(define (testable-file? pth)
(define suffix (filename-extension pth))
(and suffix
(ormap (lambda (bs) (bytes=? suffix bs))
(list #"ss" #"scm" #"scrbl" #"rkt" #"sls"))))
(define PROP:command-line "drdr:command-line")
(define PROP:timeout "drdr:timeout")
(define (path-command-line a-path)
(match (get-prop a-path 'drdr:command-line #f)
[#f
(if (testable-file? a-path)
(list "mzscheme" "-qt" (path->string* a-path))
#f)]
(define suffix (filename-extension a-path))
(and suffix
(cond
[(ormap (lambda (bs) (bytes=? suffix bs))
(list #"ss" #"scm" #"scrbl" #"rkt" #"sls"))
(list "racket" "-qt" (path->string* a-path))]
[(ormap (lambda (bs) (bytes=? suffix bs))
(list #"rktl"))
(list "racket" "-f" (path->string* a-path))]
[else
#f]))]
[""
#f]
[(? string? s)

File diff suppressed because it is too large Load Diff

View File

@ -145,14 +145,16 @@
(revision-log-dir rev))
(define trunk->log
(rebase-path trunk-dir log-dir))
(define mzscheme-path
(path->string (build-path trunk-dir "bin" "mzscheme")))
(define racket-path
(path->string (build-path trunk-dir "bin" "racket")))
; XXX fix
(define mzc-path
(path->string (build-path trunk-dir "bin" "mzc")))
(define mred-text-path
(path->string (build-path trunk-dir "bin" "mred-text")))
(define mred-path
(path->string (build-path trunk-dir "bin" "mred")))
(define gracket-text-path
(path->string (build-path trunk-dir "bin" "gracket-text")))
(define gracket-path
(path->string (build-path trunk-dir "bin" "gracket")))
; XXX fix
(define planet-path
(path->string (build-path trunk-dir "bin" "planet")))
(define collects-pth
@ -185,13 +187,19 @@
[#f
#f]
[(list-rest "mzscheme" rst)
(lambda () (list* mzscheme-path rst))]
(lambda () (list* racket-path rst))]
[(list-rest "racket" rst)
(lambda () (list* racket-path rst))]
[(list-rest "mzc" rst)
(lambda () (list* mzc-path rst))]
[(list-rest "mred-text" rst)
(lambda () (list* mred-text-path "-display" (format ":~a" (+ XSERVER-OFFSET (current-worker))) rst))]
(lambda () (list* gracket-text-path "-display" (format ":~a" (+ XSERVER-OFFSET (current-worker))) rst))]
[(list-rest "mred" rst)
(lambda () (list* mred-path "-display" (format ":~a" (+ XSERVER-OFFSET (current-worker))) rst))]
(lambda () (list* gracket-path "-display" (format ":~a" (+ XSERVER-OFFSET (current-worker))) rst))]
[(list-rest "gracket-text" rst)
(lambda () (list* gracket-text-path "-display" (format ":~a" (+ XSERVER-OFFSET (current-worker))) rst))]
[(list-rest "gracket" rst)
(lambda () (list* gracket-path "-display" (format ":~a" (+ XSERVER-OFFSET (current-worker))) rst))]
[_
#f]))]
(if pth-cmd
@ -233,7 +241,7 @@
#:timeout (current-subprocess-timeout-seconds)
#:env (current-env)
(build-path log-dir "src" "build" "set-browser.ss")
mzscheme-path
racket-path
(list "-t" (path->string* (build-path (drdr-directory) "set-browser.ss"))))
; And go
(notify! "Starting testing")

View File

@ -179,7 +179,7 @@
(define (scm-revisions-after cur-rev)
(define newest-rev (newest-push))
(for/list ([rev (in-range (add1 cur-rev) newest-rev)]
(for/list ([rev (in-range (add1 cur-rev) (add1 newest-rev))]
#:when
(let ([info (push-info rev)])
(and info (hash-has-key? (push-data-branches info) master-branch))))

709
collects/meta/props Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,8 @@
(require tests/eli-tester scheme/sandbox scheme/runtime-path scheme/file)
(define-runtime-path tree-module "tree.ss")
(define-runtime-path file-tree-module "file-tree.ss")
(define-runtime-path tree-module "tree.rkt")
(define-runtime-path file-tree-module "file-tree.rkt")
(define (glob-tests)
(define e

55
collects/openssl/sha1.rkt Normal file
View File

@ -0,0 +1,55 @@
#lang racket/base
(require ffi/unsafe
racket/runtime-path
(for-syntax racket/base))
(provide sha1
sha1-bytes
bytes->hex-string)
(define-runtime-path libcrypto-so
(case (system-type)
[(windows) '(so "libeay32")]
[else '(so "libcrypto")]))
(define libcrypto
(ffi-lib libcrypto-so '("" "0.9.8b" "0.9.8" "0.9.7")))
(define _SHA_CTX-pointer _pointer)
(define SHA1_Init
(get-ffi-obj 'SHA1_Init libcrypto (_fun _SHA_CTX-pointer -> _int)))
(define SHA1_Update
(get-ffi-obj 'SHA1_Update libcrypto (_fun _SHA_CTX-pointer _pointer _long -> _int)))
(define SHA1_Final
(get-ffi-obj 'SHA1_Final libcrypto (_fun _pointer _SHA_CTX-pointer -> _int)))
(define (sha1-bytes in)
(let ([ctx (malloc 256)]
[tmp (make-bytes 4096)]
[result (make-bytes 20)])
(SHA1_Init ctx)
(let loop ()
(let ([n (read-bytes-avail! tmp in)])
(unless (eof-object? n)
(SHA1_Update ctx tmp n)
(loop))))
(SHA1_Final result ctx)
result))
(define (sha1 in)
(bytes->hex-string (sha1-bytes in)))
(define (bytes->hex-string bstr)
(let* ([len (bytes-length bstr)]
[bstr2 (make-bytes (* len 2))]
[digit
(lambda (v)
(if (v . < . 10)
(+ v (char->integer #\0))
(+ v (- (char->integer #\a) 10))))])
(for ([i (in-range len)])
(let ([c (bytes-ref bstr i)])
(bytes-set! bstr2 (* 2 i) (digit (arithmetic-shift c -4)))
(bytes-set! bstr2 (+ (* 2 i) 1) (digit (bitwise-and c #xF)))))
(bytes->string/latin-1 bstr2)))

View File

@ -3,7 +3,7 @@
@(require scribble/manual
scribble/bnf
scribble/eval
(for-label scheme)
(for-label racket)
(for-label planet/config)
(for-label planet/util))
@ -20,9 +20,9 @@ The @PLaneT system is a method for automatically sharing code packages,
both as libraries and as full applications, that gives every user of a
@PLaneT client the illusion of having a local copy of every code
package on the server. It
consists of @link["http://planet.plt-scheme.org/"]{the central @PLaneT
consists of @link["http://planet.racket-lang.org/"]{the central @PLaneT
package repository}, a server that holds all PLaneT packages, and
the PLaneT client, built into PLT Scheme, which transparently
the PLaneT client, built into Racket, which transparently
interacts with the server on your behalf when necessary.
@table-of-contents[]
@ -30,41 +30,41 @@ interacts with the server on your behalf when necessary.
@section{Using PLaneT}
To use a @PLaneT package in a program, require it using the
@scheme[planet] @scheme[require] form (see @(secref "require" #:doc
@racket[planet] @racket[require] form (see @(secref "require" #:doc
'(lib "scribblings/reference/reference.scrbl")) for a full reference
on the features of the @scheme[require] statement in general and the
on the features of the @racket[require] statement in general and the
exact allowed grammar of PLaneT require statements). Here we explain
how to use PLaneT by example.
@subsection[#:tag "finding-a-package"]{Finding a Package}
If you are new to PLaneT, the first thing to do is visit
@link["http://planet.plt-scheme.org/"]{the PLaneT repository web site}
@link["http://planet.racket-lang.org/"]{the PLaneT repository web site}
and see what packages are available. People contribute new PLaneT
packages all the time --- if you want to be notified whenever a new or
updated package is released, you can subscribe to the
(announcement-only)
@link["http://mailman.cs.uchicago.edu/mailman/listinfo/planet-announce"]{PLaneT-announce mailing list}
or use an RSS reader to subscribe to
@link["http://planet.plt-scheme.org/300/planet.rss"]{PLaneT's RSS feed}.
@link["http://planet.racket-lang.org/300/planet.rss"]{PLaneT's RSS feed}.
To use a package from PLaneT in your program, the easiest thing to do
is copy the @scheme[require] code snippet off of that package's page
is copy the @racket[require] code snippet off of that package's page
and paste it ino your program. For instance, to use Schematics'
@link["http://planet.plt-scheme.org/users/schematics/spgsql.plt"]{spgsql.plt}
@link["http://planet.racket-lang.org/users/schematics/spgsql.plt"]{spgsql.plt}
package (a library for interacting with the
@link["http://www.postgresql.org/"]{PostgresQL} database), as of this
writing you would copy and paste the line:
@schemeblock[(require (planet "spgsql.ss" ("schematics" "spgsql.plt" 2 3)))]
@racketblock[(require (planet "spgsql.rkt" ("schematics" "spgsql.plt" 2 3)))]
into your program. This line requires the file @filepath{spgsql.ss} in package
into your program. This line requires the file @filepath{spgsql.rkt} in package
version 2.3 of the @filepath{spgsql.plt} package written by
@filepath{schematics}. That does two things: first, it downloads and
installs a version of @filepath{spgsql.plt} that is compatible with
package version 2.3 from @link["http://planet.plt-scheme.org/"]{the
package version 2.3 from @link["http://planet.racket-lang.org/"]{the
central PLaneT repository} if a compatible version hasn't already been
installed. Second, it requires the module in file @filepath{spgsql.ss}
installed. Second, it requires the module in file @filepath{spgsql.rkt}
from that package, making all of its exported bindings available for use.
Unlike with most package-distribution systems, package downloading and
@ -76,17 +76,16 @@ will be deployed.
@subsection{Shorthand Syntax}
As of PLT Scheme version 4.0, the code snippet above can also be
written using a new shorter syntax:
The code snippet above can also be written using a new shorter syntax:
@schemeblock[(require (planet schematics/spgsql:2:3/spgsql))]
@racketblock[(require (planet schematics/spgsql:2:3/spgsql))]
The two forms behave identically. In the abbreviated syntax, however,
it is illegal to write the trailing @filepath{.ss} suffix on the file
it is illegal to write the trailing @filepath{.rkt} suffix on the file
name to be required or the trailing @filepath{.plt} on the package file
name. (They are mandatory for the long-form syntax.) It is also legal
in the abbreviated syntax to omit a filename to be required entirely;
in that case, PLaneT requires the file @filepath{main.ss} in the given
in that case, PLaneT requires the file @filepath{main.rkt} in the given
package.
@subsection{Networking troubles}
@ -94,15 +93,15 @@ package.
Sometimes, when PLaneT tries to download and install a
package for the first time, your operating system may block
it from access to the network. If you are uncomfortable
giving DrScheme free access to the network (or if your
giving DrRacket free access to the network (or if your
attempts to do so do not seem to work), then you can use
your browser to manually install a planet package.
To see how this works, lets assume you want to install the PLAI package
and @schemeblock[(require (planet plai/plai:1))] is not working for you.
and @racketblock[(require (planet plai/plai:1))] is not working for you.
@itemize[
@item{First,
fire up a command-line window and use @tt{planet url} to
fire up a command-line window and use @tt{raco planet url} to
determine the url for downloading the package.
To find the url for version @tt{(1 1)} of the plai package,
do this:
@ -111,7 +110,7 @@ do this:
and get this as a response:
@tt{http://planet.plt-scheme.org/servlets/planet-servlet.ss?lang=%224.1.5.3%22&name=%22plai.plt%22&maj=1&min-lo=1&min-hi=%23f&path=%28%22plai%22%29}}
@tt{http://planet.racket-lang.org/servlets/planet-servlet.rkt?lang=%224.1.5.3%22&name=%22plai.plt%22&maj=1&min-lo=1&min-hi=%23f&path=%28%22plai%22%29}}
@item{Copy and paste that url into your browser, which
should trigger the dowload of a file called
@ -130,7 +129,7 @@ repeat the above steps for that package first, and then
continue with the @tt{fileinject} command for PLAI.}
@item{Finally, to check that the installation is successful,
run @tt{planet show}. You should see output like this
run @tt{raco planet show}. You should see output like this
(possibly with slightly different version numbers, if the
packages have been updated since this was written):
@verbatim{
@ -141,7 +140,7 @@ Normally-installed packages:
]
Once that is complete, PLaneT will use that version of the
package for any subsequent @scheme[require]s and won't try
package for any subsequent @racket[require]s and won't try
to use the network.
@subsection{Fine-Grained Control Over Package Imports}
@ -159,11 +158,11 @@ number that encodes backwards-compatibility information.}
The most basic planet require line, which is what is used in the form
@schemeblock[(require (planet "spgsql.ss" ("schematics" "spgsql.plt" 2 3)))]
@racketblock[(require (planet "spgsql.rkt" ("schematics" "spgsql.plt" 2 3)))]
in longhand notation, or
@schemeblock[(require (planet schematics/spgsql:2:3/spgsql))]
@racketblock[(require (planet schematics/spgsql:2:3/spgsql))]
in shorthand notation, should be read ``Require from PLaneT
@italic{any} release of Schematics' @filepath{spgsql.plt} package that
@ -172,11 +171,11 @@ package version used is determined by @seclink["search-order"]{the
PLaneT search order}.) To signal this explicitly, it is possible to
write
@schemeblock[(require (planet "spgsql.ss" ("schematics" "spgsql.plt" 2 (+ 3))))]
@racketblock[(require (planet "spgsql.rkt" ("schematics" "spgsql.plt" 2 (+ 3))))]
or
@schemeblock[(require (planet schematics/spgsql:2:>=3/spgsql))]
@racketblock[(require (planet schematics/spgsql:2:>=3/spgsql))]
both of which mean the same thing as the first pair of require lines.
@ -199,12 +198,12 @@ in third-party libraries was already working around. In those cases,
it may help to make use of the ``upper bound'' form of the planet
require, in longhand form:
@schemeblock[(require (planet "reduction-semantics.ss"
@racketblock[(require (planet "reduction-semantics.rkt"
("robby" "redex.plt" 4 (- 3))))]
and using shorthand notation:
@schemeblock[(require (planet robby/redex:4:<=3/reduction-semantics))]
@racketblock[(require (planet robby/redex:4:<=3/reduction-semantics))]
In this require line, any version of the package @filepath{redex.plt}
from package version 4.0 to package version 4.3 will match the require
@ -215,11 +214,11 @@ which package is actually loaded).
It is also possible to specify both an upper and a lower bound, using
the planet require's ``range'' form:
@schemeblock[(require (planet "test.ss" ("schematics" "schemeunit.plt" 2 (9 10))))]
@racketblock[(require (planet "test.rkt" ("schematics" "schemeunit.plt" 2 (9 10))))]
or
@schemeblock[(require (planet schematics/schemeunit:2:9-10/test))]
@racketblock[(require (planet schematics/schemeunit:2:9-10/test))]
This form matches any package in the specified range (inclusive on
both ends), in this example the specifications match either package
@ -232,11 +231,11 @@ a package as a special case (choosing the upper and lower bounds to be
equal), but this is a common enough case that it has special support
with the ``exact-match'' form:
@schemeblock[(require (planet "unzip.ss" ("dherman" "zip.plt" 2 (= 1))))]
@racketblock[(require (planet "unzip.rkt" ("dherman" "zip.plt" 2 (= 1))))]
or
@schemeblock[(require (planet dherman/zip:2:=1/unzip))]
@racketblock[(require (planet dherman/zip:2:=1/unzip))]
match only the exact package version 2.1 of the @filepath{zip.plt} package.
@ -247,9 +246,9 @@ match only the exact package version 2.1 of the @filepath{zip.plt} package.
@subsection{Monitoring PLaneT's progress}
PLaneT logs information about what it is doing to the @tt{info}
log (via @scheme[log-info]).
In DrScheme, you can view the logs from the @onscreen{Show Log}
menu item in the @onscreen{View} menu, and MzScheme's logging output
log (via @racket[log-info]).
In DrRacket, you can view the logs from the @onscreen{Show Log}
menu item in the @onscreen{View} menu, and Racket's logging output
can be controlled via command-line options and via environment
variables. See
@secref["logging" #:doc '(lib "scribblings/reference/reference.scrbl")]
@ -292,22 +291,22 @@ it to satisfy the original requirement.
If the remote server cannot be contacted (or fails in any way to
deliver an acceptable package), the PLaneT client consults the
uninstalled-packages cache, a cache of all previously-downloaded
packages, even those that are not currently installed. PLT Scheme
packages, even those that are not currently installed. Racket
users who frequently upgrade their installations may have many
packages downloaded but not installed at any given time; this step
is intended to ensure that these users can still run programs even
if they temporarily lose network connection.
@section[#:tag "cmdline"]{The @exec{planet} Command-Line Tool}
@section[#:tag "cmdline"]{The @exec{raco planet} Command-Line Tool}
The @exec{planet} command-line tool allows a command-line interface to
The @exec{raco planet} command-line tool allows a command-line interface to
the most commonly-performed PLaneT tasks. It is invoked from the
command line as
@commandline{planet @italic{subcommand} arg ...}
@commandline{raco planet @italic{subcommand} @italic{arg} ...}
where @italic{command} is a subcommand from the following list, and
@exec{arg} is a sequence of arguments determined by that subcommand:
where @italic{subcommand} is a subcommand from the following list, and
@exec{@italic{arg}} is a sequence of arguments determined by that subcommand:
@(define (cmd name desc)
@item{@(seclink name (exec name)): @desc})
@ -329,31 +328,31 @@ where @italic{command} is a subcommand from the following list, and
Each of these commands is described in more detail below. All the
functionality of the command-line tool is also provided with a programmatic interface by
@seclink["util.ss"]{the @filepath{util.ss} library}.
@seclink["util.rkt"]{the @filepath{util.rkt} library}.
@subsection[#:tag "create"]{@exec{create}}
Usage:
@commandline{planet create [ <option> ... ] <path>}
@commandline{raco planet create [ <option> ... ] <path>}
Create a PLaneT archive in the current directory whose contents are the
directory @exec{<path>}.
@exec{<option>} is one of:
@itemize[
@item{@exec{-f, --force}: force a package to be created even if its info.ss file contains
@item{@exec{-f, --force}: force a package to be created even if its info.rkt file contains
errors.}]
@subsection[#:tag "install"]{@exec{install}}
Usage:
@commandline{planet install <owner> <pkg> <maj> <min>}
Download and install the package that @scheme[(require (planet "file.ss" (<owner> <pkg> <maj> <min>)))]
@commandline{raco planet install <owner> <pkg> <maj> <min>}
Download and install the package that @racket[(require (planet "file.rkt" (<owner> <pkg> <maj> <min>)))]
would install.
@subsection[#:tag "remove"]{@exec{remove}}
Usage:
@commandline{planet remove [ <option> ... ] <owner> <pkg> <maj> <min>}
@commandline{raco planet remove [ <option> ... ] <owner> <pkg> <maj> <min>}
Remove the specified package from the local cache, optionally also removing its
distribution file.
@ -365,7 +364,7 @@ distribution file.
@subsection[#:tag "show"]{@exec{show}}
Usage:
@commandline{planet show [ <option> ... ]}
@commandline{raco planet show [ <option> ... ]}
List the packages installed in the local cache.
@exec{<option>} is one of:
@ -377,13 +376,13 @@ List the packages installed in the local cache.
@subsection[#:tag "clearlinks"]{@exec{clearlinks}}
Usage:
@commandline{planet clearlinks}
@commandline{raco planet clearlinks}
Clear the linkage table, allowing upgrades.
@subsection[#:tag "fileinject"]{@exec{fileinject}}
Usage:
@commandline{planet fileinject <owner> <plt-file> <maj> <min>}
@commandline{raco planet fileinject <owner> <plt-file> <maj> <min>}
Install local file <plt-file> into the planet cache as though it had been
downloaded from the planet server. It is treated as though it had the given owner name as its owner name,
the given file's filename as the its package name, and the given major and minor version numbers.
@ -391,27 +390,27 @@ the given file's filename as the its package name, and the given major and minor
@subsection[#:tag "link"]{@exec{link}}
Usage:
@commandline{planet link <owner> <pkg> <maj> <min> <path>}
@commandline{raco planet link <owner> <pkg> <maj> <min> <path>}
Create a development link (see @secref{devlinks}) between the given
package specifier and the specified directory name.
@subsection[#:tag "unlink"]{@exec{unlink}}
Usage:
@commandline{planet unlink <owner> <pkg> <maj> <min>}
@commandline{raco planet unlink <owner> <pkg> <maj> <min>}
Remove any development link (see @secref{devlinks}) associated with
the given package.
@subsection[#:tag "fetch"]{@exec{fetch}}
Usage:
@commandline{planet fetch <owner> <pkg> <maj> <min>}
@commandline{raco planet fetch <owner> <pkg> <maj> <min>}
Download the given package file from the central PLaneT repository without installing it.
@subsection[#:tag "url"]{@exec{url}}
Usage:
@commandline{planet url <owner> <pkg> <maj> <min>}
@commandline{raco planet url <owner> <pkg> <maj> <min>}
Get a URL for the given package.
This is never necessary for normal use of planet, but may be helpful in some
@ -420,7 +419,7 @@ circumstances for retrieving packages.
@subsection[#:tag "open"]{@exec{open}}
Usage:
@commandline{planet open <plt-file> <target>}
@commandline{raco planet open <plt-file> <target>}
Unpack the contents of the given package into the given directory without
installing.
@ -430,7 +429,7 @@ you to inspect package contents offline without needing to install the package.
@subsection[#:tag "structure"]{@exec{structure}}
Usage:
@commandline{planet structure <plt-file>}
@commandline{raco planet structure <plt-file>}
Print the structure of the PLaneT archive named by <plt-file> to the standard
output port.
@ -439,25 +438,25 @@ This command does not unpack or install the named .plt file.
@subsection[#:tag "print"]{@exec{print}}
Usage:
@commandline{planet print <plt-file> <path>}
@commandline{raco planet print <plt-file> <path>}
Print the contents of the file named by <path>, which must be a relative path
within the PLaneT archive named by <plt-file>, to the standard output port.
This command does not unpack or install the named .plt file.
@section[#:tag "hash-lang-planet"]{The @schememodname[planet] Language}
@section[#:tag "hash-lang-planet"]{The @racketmodname[planet] Language}
@defmodulelang[planet]
When used with @hash-lang[], @schememodname[planet] must be followed
When used with @hash-lang[], @racketmodname[planet] must be followed
by a short-form PLaneT path. The path is used in the same way that
@hash-lang[] uses plain identifiers: @schemeidfont{/lang/reader} is
@hash-lang[] uses plain identifiers: @racketidfont{/lang/reader} is
added to the given path to determine a module that supplies a module
reader.
The @schememodname[planet] module (as opposed to the reader used with
@hash-lang[]) implements the @exec{planet} command-line tool.
The @racketmodname[planet] module (as opposed to the reader used with
@hash-lang[]) implements the @exec{raco planet} command-line tool.
@section{Utility Libraries}
@ -467,23 +466,23 @@ The planet collection provides configuration and utilities for using PLaneT.
@defmodule[planet/resolver]
The primary purpose of this library to for @scheme[require] to find
The primary purpose of this library to for @racket[require] to find
@PLaneT packages. It also, however, provides some utilities for manipulating
the resolvers behavior.
@defproc[(resolve-planet-path [planet-path any/c]) path?]{
Returns the path where the file named by the require spec @scheme[planet-path] is located in the current installation.
Returns the path where the file named by the require spec @racket[planet-path] is located in the current installation.
}
@defparam[download? dl? boolean?]{
A parameter that controls if @PLaneT attempts to download a planet package that isn't already present.
If the package isn't present, the resolver will raise the @scheme[exn:fail:planet?] exception
If the package isn't present, the resolver will raise the @racket[exn:fail:planet?] exception
instead of downloading it.
}
@defparam[install? inst? boolean?]{
A parameter that controls if @PLaneT attempts to install a planet package that isn't already installed.
If the package isn't installed, the resolver will raise the @scheme[exn:fail:planet?] exception
If the package isn't installed, the resolver will raise the @racket[exn:fail:planet?] exception
instead of installing it.
}
@ -491,20 +490,20 @@ the resolvers behavior.
@defmodule[planet/config]
The @schememodname[planet/config] library provides several parameters
The @racketmodname[planet/config] library provides several parameters
useful for configuring how PLaneT works.
Note that while these parameters can be useful to modify
programmatically, PLaneT code runs at module-expansion time, so
most user programs cannot set them until PLaneT has already
run. Therefore, to meaningfully change these settings, it is best to
manually edit the config.ss file.
manually edit the config.rkt file.
@defparam[PLANET-DIR dir path-string?]{
The root PLaneT directory. If the environment variable
@indexed-envvar{PLTPLANETDIR} is
set, default is its value; otherwise the default is the directory in
which @filepath{config.ss} is found.}
which @filepath{config.rkt} is found.}
@defparam[CACHE-DIR dir path-string?]{
The root of the PLaneT client's cache directory.}
@ -514,12 +513,12 @@ The root of the PLaneT client's uninstalled-packages cache. PLaneT
stores package distribution files in this directory, and searches for
them in this directory for them if necessary. Unlike the main PLaneT
cache, which contains compiled files and is specific to each
particular version of PLT Scheme, the uninstalled package cache is
shared by all versions of PLT Scheme that use the same package
particular version of Racket, the uninstalled package cache is
shared by all versions of Racket that use the same package
repository, and it is searched if a package is not installed in the
primary cache and cannot be downloaded from the central PLaneT repository
(for instance due to a loss of Internet connectivity). This behavior
is intended to primarily benefit users who upgrade their PLT Scheme
is intended to primarily benefit users who upgrade their Racket
installations frequently.}
@defparam[LINKAGE-FILE file path-string?]{
@ -530,41 +529,41 @@ occur after a package is installed. The default is the file @filepath{LINKAGE}
in the root PLaneT directory.}
@defparam[LOG-FILE file (or/c path-string? false?)]{
If @scheme[#f], indicates that no logging should take place. Otherwise
If @racket[#f], indicates that no logging should take place. Otherwise
specifies the file into which logging should be written. The default
is the file @filepath{INSTALL-LOG} in the root PLaneT directory.}
@defboolparam[USE-HTTP-DOWNLOADS? bool]{
PLaneT can use two different protocols to retrieve packages. If @scheme[#t],
PLaneT will use the HTTP protocol; if @scheme[#f] it will use the custom-built
PLaneT protocol. The default value for this parameter is @scheme[#t] and setting
this parameter to @scheme[#f] is not recommended.}
PLaneT can use two different protocols to retrieve packages. If @racket[#t],
PLaneT will use the HTTP protocol; if @racket[#f] it will use the custom-built
PLaneT protocol. The default value for this parameter is @racket[#t] and setting
this parameter to @racket[#f] is not recommended.}
@defparam[HTTP-DOWNLOAD-SERVLET-URL url string?]{
The URL for the servlet that will provide PLaneT packages if
@scheme[USE-HTTP-DOWNLOADS?] is @scheme[#t], represented as a string.
@racket[USE-HTTP-DOWNLOADS?] is @racket[#t], represented as a string.
This defaults to the value of the @indexed-envvar{PLTPLANETURL} environment
variable if it is set and otherwise is
@scheme["http://planet.plt-scheme.org/servlets/planet-servlet.ss"].}
@racket["http://planet.racket-lang.org/servlets/planet-servlet.rkt"].}
@defparam[PLANET-SERVER-NAME host string?]{
The name of the PLaneT server to which the client should connect if
@scheme[USE-HTTP-DOWNLOADS?] is @scheme[#f]. The default value for this parameter is
@scheme["planet.plt-scheme.org"].}
@racket[USE-HTTP-DOWNLOADS?] is @racket[#f]. The default value for this parameter is
@racket["planet.racket-lang.org"].}
@defparam[PLANET-SERVER-PORT port natural-number?]{
The port on the server the client should connect to if
@scheme[USE-HTTP-DOWNLOADS?] is @scheme[#f]. The default value for this parameter is
@scheme[270].}
@racket[USE-HTTP-DOWNLOADS?] is @racket[#f]. The default value for this parameter is
@racket[270].}
@subsection[#:tag "util.ss"]{Utilities}
@subsection[#:tag "util.rkt"]{Utilities}
@defmodule[planet/util]
The @schememodname[planet/util] library supports examination of the pieces of
The @racketmodname[planet/util] library supports examination of the pieces of
PLaneT. It is meant primarily to support debugging and to allow easier
development of higher-level package-management tools. The
functionality exposed by @seclink["cmdline"]{the @exec{planet} command-line tool} is
functionality exposed by @seclink["cmdline"]{the @exec{raco planet} command-line tool} is
also available programmatically through this library.
@defproc[(download/install-pkg [owner string?]
@ -624,13 +623,13 @@ Removes the specified package from the local planet cache.}
@defproc[(display-plt-file-structure [plt-file (or/c path-string? path?)])
any]{
Print a tree representing the file and directory structure of the
PLaneT archive .plt file named by @scheme[plt-file] to @scheme[(current-output-port)].}
PLaneT archive .plt file named by @racket[plt-file] to @racket[(current-output-port)].}
@defproc[(display-plt-archived-file [plt-file (or/c path-string? path?)]
[file-to-print string?])
any]{
Print the contents of the file named @scheme[file-to-print] within the
PLaneT archive .plt file named by @scheme[plt-file] to @scheme[(current-output-port)].}
Print the contents of the file named @racket[file-to-print] within the
PLaneT archive .plt file named by @racket[plt-file] to @racket[(current-output-port)].}
@defproc[(unlink-all) any]{
Removes the entire linkage table from the system, which will force all
@ -675,16 +674,16 @@ file within it actually exists.}
)]{
Macros that expand into expressions that evaluate to information about
the name, owner, and version number of the package in which they
appear. @scheme[this-package-version] returns a list consisting of a string
appear. @racket[this-package-version] returns a list consisting of a string
naming the package's owner, a string naming the package, a number
indicating the package major version and a number indicating the
package minor version, or @scheme[#f] if the expression appears outside the
package minor version, or @racket[#f] if the expression appears outside the
context of a package. The others are convenience macros that
select out the relevant field, or return @scheme[#f] if the expression
select out the relevant field, or return @racket[#f] if the expression
appears outside the context of a PLaneT package.}
@defproc[(exn:fail:planet? [val any/c]) boolean?]{
Returns @scheme[#t] if @scheme[val] is
Returns @racket[#t] if @racket[val] is
}
@subsection{Terse Status Updates}
@ -693,19 +692,19 @@ appears outside the context of a PLaneT package.}
This module provides access to some PLaneT status information. This
module is first loaded by PLaneT in the initial namespace (when
PLaneT's resolver is loaded), but PLaneT uses @scheme[dynamic-require] to load
PLaneT's resolver is loaded), but PLaneT uses @racket[dynamic-require] to load
this module each time it wants to announce information. Similarly, the
state of which procedures are registered (via @scheme[planet-terse-register])
state of which procedures are registered (via @racket[planet-terse-register])
is saved in the namespace, making the listening and information producing
namespace-specific.
@defproc[(planet-terse-register
[proc (-> (or/c 'download 'install 'finish) string? any/c)]
[namespace namespace? (current-namespace)]) void?]{
Registers @scheme[proc] as a function to be called when
@scheme[planet-terse-log] is called with a matching namespace argument.
Note that @scheme[proc] is called
asynchronously (ie, on some thread other than the one calling @scheme[planet-terse-register]).
Registers @racket[proc] as a function to be called when
@racket[planet-terse-log] is called with a matching namespace argument.
Note that @racket[proc] is called
asynchronously (ie, on some thread other than the one calling @racket[planet-terse-register]).
}
@defproc[(planet-terse-log [id (or/c 'download 'install 'finish)]
@ -726,18 +725,18 @@ PLaneT can distribute whatever programs you write, but keep
these guidelines in mind as you write:
@itemize[
@item{Organize your code into modules. Since the PLaneT client is
integrated into the @scheme[require] form, it works best if your code
integrated into the @racket[require] form, it works best if your code
is arranged into modules.}
@item{When one module in your program depends on another, it is best
to require it using the relative-file-name form rather than the
planet require form. For instance, if your program contains files
primary.ss and helper.ss where primary.ss requires helper, use the form
primary.rkt and helper.rkt where primary.rkt requires helper, use the form
@scheme[(require "helper.ss")]
@racket[(require "helper.rkt")]
instead of
@scheme[(require (planet "helper.ss" ("username" "packagename.plt" 1 0)))]
@racket[(require (planet "helper.rkt" ("username" "packagename.plt" 1 0)))]
in files that will also be a part of the package.}]
@ -747,7 +746,7 @@ To aid development, PLaneT allows users to establish direct
associations between a particular planet package
with an arbitrary directory on the filesystem, for instance connecting the package named by the require line
@scheme[(require (planet "file.ss" ("my" "mypackage.plt" 1 0)))]
@racket[(require (planet "file.rkt" ("my" "mypackage.plt" 1 0)))]
to the directory @filepath{/home/myname/svn/mypackages/devel/}.
@ -755,20 +754,20 @@ These associations are intended to allow developers to use their own
directory structures, version control systems, and so on while still
being able to use the packages they create as though they were
distributed directly by PLaneT. Development links are local to a
particular user and repository (but not to a particular MzScheme minor
particular user and repository (but not to a particular Racket minor
revision).
To establish a development link, use the @exec{planet} command-line tool:
To establish a development link, use the @exec{raco planet} command-line tool:
@commandline{planet link myname mypackage.plt 1 0 ~/svn/mypackages/devel}
@commandline{raco planet link myname mypackage.plt 1 0 ~/svn/mypackages/devel}
Once you are finished developing a package, you should remove any
development links you have established for it, again using the planet
command-line tool:
@commandline{planet unlink myname mypackage.plt 1 0}
@commandline{raco planet unlink myname mypackage.plt 1 0}
You may alternately use the functions @scheme[add-hard-link] and @scheme[remove-hard-link].
You may alternately use the functions @racket[add-hard-link] and @racket[remove-hard-link].
@subsection{Prepare Your Distribution}
@ -787,56 +786,56 @@ Use Scribble to write documentation for your package. See
@other-manual['(lib "scribblings/scribble/scribble.scrbl")]
for instructions on how to write Scribble documentation.
@subsubsection{Create an @filepath{info.ss} File [Optional]}
@subsubsection{Create an @filepath{info.rkt} File [Optional]}
If you put a file named @filepath{info.ss} in your package's root directory, the
PLaneT system (as well as the rest of the PLT Scheme tool suite) will
If you put a file named @filepath{info.rkt} in your package's root directory, the
PLaneT system (as well as the rest of the Racket tool suite) will
look in it for descriptive metadata about your package. The PLaneT
system looks for certain names in that file:
@itemize[
@item{The @indexed-scheme['blurb] field: If present, the blurb field
@item{The @indexed-racket['blurb] field: If present, the blurb field
should contain a list of XHTML fragments encoded as x-expressions (see
the xml collection for details) that PLaneT will use as a short
description of your project.}
@item{The @indexed-scheme['release-notes] field: If present, the
@item{The @indexed-racket['release-notes] field: If present, the
release-notes field should contain a list of XHTML fragments encoded
as x-expressions (see the xml collection for details) that PLaneT will
use as a short description of what's new in this release of your
package.}
@item{The @indexed-scheme['categories] field: If present, the categories
@item{The @indexed-racket['categories] field: If present, the categories
field should be a list of symbols corresponding to the categories
under which this package should be listed.
The valid categories are:
@itemize[
@item{@indexed-scheme['devtools]: Development Tools}
@item{@indexed-scheme['net]: Networking and Protocols}
@item{@indexed-scheme['media]: Graphics and Audio}
@item{@indexed-scheme['xml]: XML-Related}
@item{@indexed-scheme['datastructures]: Data Structures and Algorithms}
@item{@indexed-scheme['io]: Input/Output and Filesystem}
@item{@indexed-scheme['scientific]: Mathematical and Scientific}
@item{@indexed-scheme['system]: Hardware/Operating System-Specific Tools}
@item{@indexed-scheme['ui]: Textual and Graphical User Interface}
@item{@indexed-scheme['metaprogramming]: Metaprogramming Tools}
@item{@indexed-scheme['planet]: PLaneT-Related}
@item{@indexed-scheme['misc]: Miscellaneous}]
@item{@indexed-racket['devtools]: Development Tools}
@item{@indexed-racket['net]: Networking and Protocols}
@item{@indexed-racket['media]: Graphics and Audio}
@item{@indexed-racket['xml]: XML-Related}
@item{@indexed-racket['datastructures]: Data Structures and Algorithms}
@item{@indexed-racket['io]: Input/Output and Filesystem}
@item{@indexed-racket['scientific]: Mathematical and Scientific}
@item{@indexed-racket['system]: Hardware/Operating System-Specific Tools}
@item{@indexed-racket['ui]: Textual and Graphical User Interface}
@item{@indexed-racket['metaprogramming]: Metaprogramming Tools}
@item{@indexed-racket['planet]: PLaneT-Related}
@item{@indexed-racket['misc]: Miscellaneous}]
If you put symbols other than these the categories field, they will be
ignored. If you put no legal symbols in the categories field or do not
include this field in your info.ss file, your package will be
include this field in your info.rkt file, your package will be
categorized as "Miscellaneous."}
@item{The @indexed-scheme['can-be-loaded-with] field:
@item{The @indexed-racket['can-be-loaded-with] field:
If present, the can-be-loaded-with field should be a quoted datum of
one of the following forms:
@schemegrammar[
@racketgrammar[
can-be-loaded-with 'all
'none
(list 'all-except VER-SPEC ...)
@ -851,12 +850,12 @@ particular file and assumes that nothing else writes to that same
file, then multiple versions of the same package being loaded
simultaneously may be a problem. This field allows you to specify
whether your package can be loaded simultaneously with older versions
of itself. If its value is @indexed-scheme['all], then the package may be
loaded with any older version. If it is @indexed-scheme['none], then it
may not be loaded with older versions at all. If it is @scheme[(list
of itself. If its value is @indexed-racket['all], then the package may be
loaded with any older version. If it is @indexed-racket['none], then it
may not be loaded with older versions at all. If it is @racket[(list
'all-except VER-SPEC ...)] then any package except those that match
one of the given VER-SPEC forms may be loaded with this package; if it
is @scheme[(list 'only VER-SPEC ...)] then only packages that match
is @racket[(list 'only VER-SPEC ...)] then only packages that match
one of the given VER-SPEC forms may be loaded with this package.
When checking to see if a package may be loaded, PLaneT compares it to
@ -866,18 +865,18 @@ can-be-loaded-with field allows the older package to be loaded. If all
such comparisons succeed then the new package may be loaded; otherwise
PLaneT signals an error.
The default for this field is @indexed-scheme['none] as a conservative
The default for this field is @indexed-racket['none] as a conservative
protection measure. For many packages it is safe to set this field to
@indexed-scheme['any].}
@indexed-racket['any].}
@item{The @indexed-scheme['homepage] field:
@item{The @indexed-racket['homepage] field:
If present, the URL field should be a string corresponding to a URL
for the package. PLaneT provides this link with the description of your
package on the main PLaneT web page.}
@item{The @indexed-scheme['primary-file] field:
@item{The @indexed-racket['primary-file] field:
If present, the primary-file field should be a either a string
corresponding to the name (without path) of the main Scheme source
corresponding to the name (without path) of the main Racket source
file of your package, or a list of such strings. The PLaneT web page
corresponding to this package will present all files listed here as
interface files for your package; it will give direct links to each
@ -888,29 +887,29 @@ If you include only a single string, it will be used as the require
line printed on your package's page. If you include a list of strings,
then the first legal file string in the list will be used.}
@item{The @indexed-scheme['required-core-version] field: If present, the
@item{The @indexed-racket['required-core-version] field: If present, the
required-core-version field should be a string with the same syntax as
the output of the @scheme[version] function. Defining this field
indicates that PLaneT should only allow users of a version of mzscheme
the output of the @racket[version] function. Defining this field
indicates that PLaneT should only allow users of a version of Racket
equal to or more recent than the version specified by this field. This
allows you finer-grained control of your package's core-language
requirements than its inclusion in a particular repository; for
instance, setting this field to @scheme["300.2"] would cause the PLaneT server
not to serve it to MzScheme v300.1 or older clients.}
instance, setting this field to @racket["300.2"] would cause the PLaneT server
not to serve it to Racket v300.1 or older clients.}
@item{The @indexed-scheme['version] field:
@item{The @indexed-racket['version] field:
If present, the version field should be a string that describes the
version number of this code that should be presented to users (e.g.,
@scheme["0.15 alpha"]). This field does not override or in any way interact
@racket["0.15 alpha"]). This field does not override or in any way interact
with your package's package version number, which is assigned by
PLaneT, but may be useful to users.}
@item{The @indexed-scheme['repositories] field: If present, the repositories
@item{The @indexed-racket['repositories] field: If present, the repositories
field should be a list consisting of some subset of the strings
@scheme["4.x"] and @scheme["3xx"]. The string @scheme["4.x"] indicates
@racket["4.x"] and @racket["3xx"]. The string @racket["4.x"] indicates
that this package should be included in the v4.x repository (which
contains packages that are intended to run in PLT Scheme versions at
or above version 4.0), and the string @scheme["3xx"] indicates that
contains packages that are intended to run in Racket and PLT Scheme versions at
or above version 4.0), and the string @racket["3xx"] indicates that
the package should be included in the v3xx repository (containing
packages intended to run in PLT Scheme versions in the 3xx series). A
single package (and a single version of a package) may be included in
@ -918,58 +917,58 @@ multiple repositories with the same PLaneT version number.}]
In addition, PLaneT uses the setup-plt installer to install packages
on client machines, so most fields it looks for can be included with
their usual effects. In particular, adding a @indexed-scheme['name]
field indicates that the Scheme files in the package should be
their usual effects. In particular, adding a @indexed-racket['name]
field indicates that the Racket files in the package should be
compiled during installation; it is a good idea to add it.
An example info.ss file looks like this:
An example info.rkt file looks like this:
@schememod[
@racketmod[
setup/infotab
(define name "My Application")
(define blurb
'("My application runs 60% faster on 20% less peanut "
"butter. It even shows a fancy graphic!"))
(define primary-file "my-app.ss")
(define primary-file "my-app.rkt")
(define categories '(system xml))
]
See the PLT mzc: MzScheme Compiler Manual, chapter 7 for more
information on info.ss files.
See @secref[#:doc '(lib "scribblings/raco/raco.scrbl") "info.rkt"]
for more information on @filepath{info.rkt} files.
@subsection{Build a Distribution Archive}
Use the planet command-line tool in its archive-creation mode to
create a planet archive:
@commandline{planet create /home/jacob/my-app/}
@commandline{raco planet create /home/jacob/my-app/}
This will create a planet archive named @filepath{my-app.plt} in the current
directory whose contents are the contents of @filepath{/home/jacobm/my-app} and
all its subdirectories.
Alternately, you can run @scheme[make-planet-archive] with the name of the directory
Alternately, you can run @racket[make-planet-archive] with the name of the directory
you've prepared as its argument:
@scheme[(make-planet-archive "/home/jacob/my-app/")]
@racket[(make-planet-archive "/home/jacob/my-app/")]
This function will build a packaged version of your directory and
return the path to that package. The path will always be a file named
@filepath{X.plt}, where @filepath{X} is the name of the directory you
gave to @scheme[make-planet-archive], located in that same directory.
gave to @racket[make-planet-archive], located in that same directory.
You can now test that your archive file works as intended using the
planet command-line tool in its install mode:
@commandline{planet fileinject <owner> <path to your .plt file> <maj> <min>}
@commandline{raco planet fileinject <owner> <path to your .plt file> <maj> <min>}
installs the specified file into your local PLaneT cache as
though it had been downloaded from the PLaneT server with the given
owner name and major and minor versions. After you run this command,
you can require your package on your local machine using
@scheme[(require (planet <file> (<owner> <.plt file name without path> <maj> <min>)))]
@racket[(require (planet <file> (<owner> <.plt file name without path> <maj> <min>)))]
to verify everything works. After you do so, you can use
@commandline{planet remove <owner> <.plt file name without path> <maj> <min>}
@commandline{raco planet remove <owner> <.plt file name without path> <maj> <min>}
to remove the test package from your local cache. (Not removing it is
safe as long as you use the same name and version numbers the package
will have on the PLaneT server; otherwise you may experience
@ -984,7 +983,7 @@ previously-released version of your package should unmodified with the
new package. This means that at a minimum, a backwards compatible
update should:
@itemize[
@item{Contain all the same Scheme source files in that the previous
@item{Contain all the same Racket source files in that the previous
version contained in directories intended for public access}
@item{In each public file, provide at least all the bindings that the
previous version provided}
@ -1011,7 +1010,7 @@ best judgment.
@subsection{Submit Your Package}
Go to @link["http://planet.plt-scheme.org/"]{the central PLaneT
Go to @link["http://planet.racket-lang.org/"]{the central PLaneT
package repository web page} and click on the link marked "contribute
a package / log in" in the upper-right-hand corner. If you have not
yet created an account, then do so on that page by providing your

View File

@ -17,9 +17,9 @@
@(define r5rs @elem{R@superscript{5}RS})
@(define drs-doc '(lib "scribblings/drscheme/drscheme.scrbl"))
@(define drs-doc '(lib "scribblings/drracket/drracket.scrbl"))
@title{@bold{R5RS}: Legacy Standard Language}
@title{@bold{R5RS}: Legacy Scheme}
The @link["../r5rs-std/index.html"]{The Revised@superscript{5} Report
on the Algorithmic Language Scheme} defines a dialect of Scheme. We
@ -28,10 +28,10 @@ defined by the standard.
@margin-note{See @seclink[#:doc '(lib "scribblings/guide/guide.scrbl")
"dialects"] for general information about different
dialects of Scheme within PLT Scheme.}
dialects of Scheme within Racket.}
The default dialect of Scheme provided by @exec{mzscheme} and other
PLT Scheme tools differs from @|r5rs| in many ways, but PLT Scheme
The default dialect of Lisp provided by @exec{racket} and other
Racket tools differs from @|r5rs| in many ways, but Racket
includes tools and libraries for running @|r5rs| programs.
@table-of-contents[]
@ -42,12 +42,12 @@ includes tools and libraries for running @|r5rs| programs.
@section[#:tag "running"]{Running @|r5rs| Programs}
PLT Scheme provides several layers of support for programs written
Racket provides several layers of support for programs written
according to @|r5rs|:
@itemize[
@item{DrScheme provides an @onscreen{R5RS} language, which can be
@item{DrRacket provides an @onscreen{R5RS} language, which can be
selected via the @menuitem["Language" "Choose Language..."]
menu item. See @secref[#:doc drs-doc "choose-language"] in
@other-manual[drs-doc] for more information.}
@ -57,14 +57,14 @@ according to @|r5rs|:
expressions and definitions. See @secref["plt-r5rs"] (later in
this manual) for more information.}
@item{The @schememodname[r5rs] library implemented @|r5rs| procedures
@item{The @racketmodname[r5rs] library implemented @|r5rs| procedures
and syntactic forms. It can also be used with @hash-lang[] to
create a module whose body is implemented in an @|r5rs|-like
language. See @secref["r5rs-mod"] (later in this manual) for
more information.}
@item{The @schememodname[r5rs/init] library extends
@schememodname[r5rs] to set parameters (such as
@item{The @racketmodname[r5rs/init] library extends
@racketmodname[r5rs] to set parameters (such as
case-insensitive symbol reading) for @|r5rs| loading or an
@|r5rs| read-eval-print loop. See @secref["r5rs/init-mod"]
(later in this manual) for more information.}
@ -81,8 +81,8 @@ as a command-line argument, then a read-eval-print loop is started.
Before starting a read-eval-print loop, an initialization file is
loaded, if it exists. The file is the same as the file reported by
@scheme[(find-system-path 'init-file)], but with the characters
@litchar{mzscheme} in the filename replaced by @litchar{pltr5rs}. For
@racket[(find-system-path 'init-file)], but with the characters
@litchar{racket} in the filename replaced by @litchar{pltr5rs}. For
example, under Unix, the file is @filepath{~/.pltr5rsrc}.
By default, @exec{plt-r5rs} departs from @|r5rs| conformance in one
@ -98,77 +98,77 @@ for primitive bindings (at the cost of performance).
@defmodulelang[r5rs]
As a library, @schememodname[r5rs] provides the syntactic forms and
As a library, @racketmodname[r5rs] provides the syntactic forms and
procedures defined by @|r5rs|. When used as a language via
@hash-lang[], the program is read with the following
parameterizations:
@schemeblock[
@racketblock[
(read-case-sensitive #f)
(read-accept-infix-dot #f)
(read-curly-brace-as-paren #f)
(read-square-bracket-as-paren #f)
]
The @schememodname[r5rs] bindings can be imported into a top-level
The @racketmodname[r5rs] bindings can be imported into a top-level
environment, and then evaluation in that top-level environment
corresponds to @|r5rs|. Use @scheme[(namespace-require/copy 'r5rs)]
corresponds to @|r5rs|. Use @racket[(namespace-require/copy 'r5rs)]
with an empty namespace to maximize conformance with @|r5rs|; Using
@scheme[(namespace-require 'r5rs)], in contrast, creates primitive
@racket[(namespace-require 'r5rs)], in contrast, creates primitive
bindings as imports, which is the same as using
@seclink["plt-r5rs"]{@exec{plt-r5rs}} without the @DFlag{no-prim} flag.
More simply, use @scheme[(scheme-report-environment 5)]. See also
@schememodname[r5rs/init], which sets reader and printer parameters to
More simply, use @racket[(scheme-report-environment 5)]. See also
@racketmodname[r5rs/init], which sets reader and printer parameters to
increase conformance.
Using @schememodname[r5rs] via @hash-lang[] creates a module whose
Using @racketmodname[r5rs] via @hash-lang[] creates a module whose
body is implemented with an @|r5rs|-like language. The main difference
from @|r5rs| is that, as a module language, @schememodname[r5rs] does
from @|r5rs| is that, as a module language, @racketmodname[r5rs] does
not allow redefinition of top-level bindings, and expressions
evaluated through @scheme[load] and @scheme[eval] cannot automatically
evaluated through @racket[load] and @racket[eval] cannot automatically
access bindings defined within the module.
@; --------------------
@subsection{Non-@|r5rs| Bindings from @schememodname[r5rs]}
@subsection{Non-@|r5rs| Bindings from @racketmodname[r5rs]}
In addition to the bindings defined by @|r5rs|, the
@schememodname[r5rs] library provides the following bindings from
@schememodname[mzscheme] (which are not legal identifiers in @|r5rs|
@racketmodname[r5rs] library provides the following bindings from
@racketmodname[racket/base] (which are not legal identifiers in @|r5rs|
syntax, so there is no danger of collisions in @|r5rs| programs):
@schemeblock[
@racketblock[
#%app #%datum #%top #%top-interaction #%require #%provide
]
It also provides @schememodname[mzscheme]'s
@scheme[#%plain-module-begin] as @scheme[#%module-begin]. Note that
@scheme[#%require] can be used to import PLT Scheme libraries into an
otherwise @|r5rs| program, and @scheme[#%provide] can be used to
It also provides @racketmodname[racket]'s
@racket[#%plain-module-begin] as @racket[#%module-begin]. Note that
@racket[#%require] can be used to import Racket libraries into an
otherwise @|r5rs| program, and @racket[#%provide] can be used to
export from a module that is implemented in an @|r5rs|-like language.
@; --------------------
@subsection{Notes on @|r5rs| Functions}
The @scheme[cons] of @schememodname[r5rs] corresponds to
@schememodname[scheme/base]'s @scheme[mcons]. Similarly, @scheme[cdr]
is @scheme[mcdr], and @scheme[map] is @schememodname[scheme/mpair]'s
@scheme[mmap], and so on.
The @racket[cons] of @racketmodname[r5rs] corresponds to
@racketmodname[racket/base]'s @racket[mcons]. Similarly, @racket[cdr]
is @racket[mcdr], and @racket[map] is @racketmodname[racket/mpair]'s
@racket[mmap], and so on.
An @|r5rs| @defterm{environment} is implemented as a
@scheme[scheme/base] @defterm{namespace}. Also, relative to
@scheme[scheme/base], the @scheme[expr] passed to @scheme[eval] is
@racket[racket/base] @defterm{namespace}. Also, relative to
@racket[racket/base], the @racket[expr] passed to @racket[eval] is
constructed using mutable pairs.
The @scheme[scheme-report-environment] function returns a namespace
containing the bindings of @schememodname[r5rs]. Procedure values are
installed into the namespace using @scheme[namespace-require/copy], so
The @racket[scheme-report-environment] function returns a namespace
containing the bindings of @racketmodname[r5rs]. Procedure values are
installed into the namespace using @racket[namespace-require/copy], so
that they can be redefined.
The @scheme[null-environment] function returns a namespace
containing the syntactic forms of @schememodname[r5rs], not including
@scheme[#%module-begin] (which is not useful outside of a module).
The @racket[null-environment] function returns a namespace
containing the syntactic forms of @racketmodname[r5rs], not including
@racket[#%module-begin] (which is not useful outside of a module).
@; ----------------------------------------
@ -176,10 +176,10 @@ containing the syntactic forms of @schememodname[r5rs], not including
@defmodule[r5rs/init]
The @schememodname[r5rs/init] module re-exports @schememodname[r5rs],
The @racketmodname[r5rs/init] module re-exports @racketmodname[r5rs],
and also sets parameters as follows:
@schemeblock[
@racketblock[
(read-case-sensitive #f)
(read-accept-infix-dot #f)
(read-curly-brace-as-paren #f)
@ -188,10 +188,10 @@ and also sets parameters as follows:
]
The side-effect of setting these parameters is useful when the module
is @scheme[require]d before loading an @|r5rs| program, so that the
is @racket[require]d before loading an @|r5rs| program, so that the
reader and printer behave more as specified in @|r5rs|. In particular,
the @seclink["plt-r5rs"]{@exec{plt-r5rs} executable} initializes by
importing @schememodname[r5rs/init].
importing @racketmodname[r5rs/init].
@; ----------------------------------------

View File

@ -11,7 +11,7 @@
rnrs/r5rs-6
rnrs/hashtables-6
r6rs
(only-in scheme/base
(only-in racket/base
lib
current-library-collection-paths
parameterize
@ -23,7 +23,7 @@
@(define r6rs @elem{R@superscript{6}RS})
@(define r5rs @elem{R@superscript{5}RS})
@title{@bold{R6RS}: Standard Language}
@title{@bold{R6RS}: Scheme}
The @link["../r6rs-std/index.html"]{The Revised@superscript{6} Report
on the Algorithmic Language Scheme} defines a dialect of Scheme. We
@ -32,13 +32,13 @@ defined by the standard.
@margin-note{See @seclink[#:doc '(lib "scribblings/guide/guide.scrbl")
"dialects"] for general information about different
dialects of Scheme within PLT Scheme.}
dialects of Scheme within Racket.}
@|r6rs| defines both @defterm{libraries} and @defterm{top-level
programs}. Both correspond to PLT Scheme @defterm{modules} (see
programs}. Both correspond to Rackey @defterm{modules} (see
@secref[#:doc guide-src "modules"]). That is, although @|r6rs| defines
top-level programs as entry points, you can just as easily treat a
library as an entry point when using PLT Scheme. The only difference
library as an entry point when using Racket. The only difference
is that an @|r6rs| top-level program cannot export any bindings to
other modules.
@ -59,7 +59,7 @@ To run a top-level program, either:
Additional command-line arguments are propagated as
command-line arguments to the program (accessed via
@scheme[command-line]).
@racket[command-line]).
To compile the file to bytecode (to speed future runs of the
program), use @exec{plt-r6rs} with the @DFlag{compile} flag:
@ -69,47 +69,47 @@ To run a top-level program, either:
The bytecode file is written in a @filepath{compiled}
sub-directory next to @nonterm{program-file}.
For example, if @filepath{hi.scm} contains
For example, if @filepath{hi.sps} contains
@schemeblock[
@racketblock[
(import (rnrs))
(display "hello\n")
]
then
@commandline{plt-r6rs hi.scm}
@commandline{plt-r6rs hi.sps}
prints ``hello.''}
@item{Prefix the program with @schememetafont{#!r6rs}, which counts
@item{Prefix the program with @racketmetafont{#!r6rs}, which counts
as a comment from the @|r6rs| perspective, but is a synonym for
@scheme[#,(hash-lang) r6rs] from the PLT Scheme perspective.
Such files can be run like any other PLT Scheme module, such as
using @exec{mzscheme}:
@racket[#,(hash-lang) r6rs] from the Racket perspective.
Such files can be run like any other Racket module, such as
using @exec{racket}:
@commandline{mzscheme @nonterm{program-file}}
@commandline{racket @nonterm{program-file}}
or using DrScheme with the @onscreen{Module} language. The
file can also be compiled to bytecode using @exec{mzc}:
or using DrRacket. The file can also be compiled to bytecode
using @exec{raco make}:
@commandline{mzc @nonterm{program-file}}
@commandline{raco make @nonterm{program-file}}
For example, if @filepath{hi.ss} contains
For example, if @filepath{hi.sps} contains
@schemeblock[
#,(schememetafont "#!r6rs")
@racketblock[
#,(racketmetafont "#!r6rs")
(import (rnrs))
(display "hello\n")
]
then
@commandline{mzscheme hi.ss}
@commandline{racket hi.sps}
prints ``hello.'' Similarly, opening @filepath{hi.ss} in
DrScheme and clicking @onscreen{Run} prints ``hello'' within
the DrScheme interactions window.}
prints ``hello.'' Similarly, opening @filepath{hi.sps} in
DrRacket and clicking @onscreen{Run} prints ``hello'' within
the DrRacket interactions window.}
]
@ -118,17 +118,17 @@ To run a top-level program, either:
@section{Installing Libraries}
To reference an @|r6rs| library from a top-level program or another
library, it must be installed as a collection-based library in PLT
Scheme.
library, it must be installed as a collection-based library in
Racket.
One way to produce an @|r6rs| installed library is to create in
a @techlink[#:doc guide-src]{collection} a file that starts with
@schememetafont{#!r6rs} and that contains a @scheme[library] form. For
example, the following file might be created in a @filepath{hello.ss}
@racketmetafont{#!r6rs} and that contains a @racket[library] form. For
example, the following file might be created in a @filepath{hello.sls}
file within a @filepath{examples} collection directory:
@schemeblock[
#,(schememetafont "#!r6rs")
@racketblock[
#,(racketmetafont "#!r6rs")
(library (examples hello)
(export greet)
(import (rnrs))
@ -138,16 +138,16 @@ file within a @filepath{examples} collection directory:
]
Alternately, the @exec{plt-r6rs} executable with the @DFlag{install}
flag accepts a sequence of @scheme[library] declarations and installs
flag accepts a sequence of @racket[library] declarations and installs
them into separate files in a collection directory, based on the
declared name of each library:
@commandline{plt-r6rs --install @nonterm{libraries-file}}
By default, libraries are installed into the user-specific collection
directory (see @scheme[find-user-collects-dir]). The @DFlag{all-users}
directory (see @racket[find-user-collects-dir]). The @DFlag{all-users}
flag causes the libraries to be installed into the main installation,
instead (see @scheme[find-collects-dir]):
instead (see @racket[find-collects-dir]):
@commandline{plt-r6rs --install --all-users @nonterm{libraries-file}}
@ -159,15 +159,15 @@ the files are written. Libraries installed by @exec{plt-r6rs
One final option is to supply a @as-index{@DPFlag{path}} flag to
@exec{plt-r6rs}. A path added with @DPFlag{path} extends the set of
directories that are searched to find a collection (i.e., it sets
@scheme[current-library-collection-paths]). If @nonterm{dir} contains
@racket[current-library-collection-paths]). If @nonterm{dir} contains
@filepath{duck} and @filepath{cow} sub-directories with
@filepath{duck/feather.sls} and @filepath{cow/bell.sls}, and if each
file is an @|r6rs| library prefixed with @schememetafont{#!r6rs}, then
file is an @|r6rs| library prefixed with @racketmetafont{#!r6rs}, then
@exec{plt-r6rs ++path @nonterm{dir}} directs the @|r6rs| library
references @scheme[(duck feather)] and @scheme[(cow bell)] to the
references @racket[(duck feather)] and @racket[(cow bell)] to the
files. Note that this technique does not support accessing
@filepath{duck.sls} directly within @nonterm{dir}, since the library
reference @scheme[(duck)] is treated like @scheme[(duck main)] for
reference @racket[(duck)] is treated like @racket[(duck main)] for
finding the library, as explained in @secref["libpaths"]. Multiple
paths can be provided with multiple uses of @DPFlag{path}; the paths
are searched in order, and before the installation's collections.
@ -178,14 +178,14 @@ are searched in order, and before the installation's collections.
@defmodulelang[r6rs]
The @schememodname[r6rs] language is usually used in the form
@schememetafont{#!}@schememodname[r6rs], which is equivalent to
@scheme[@#,hash-lang[] @#,schememodname[r6rs]] and is also valid
The @racketmodname[r6rs] language is usually used in the form
@racketmetafont{#!}@racketmodname[r6rs], which is equivalent to
@racket[@#,hash-lang[] @#,racketmodname[r6rs]] and is also valid
@|r6rs| syntax.
The @schememodname[r6rs] module language provides only a
@schemeidfont{#%module-begin} binding, which is used to process the
entire module body (see @scheme[module]). It allows the body of a
The @racketmodname[r6rs] module language provides only a
@racketidfont{#%module-begin} binding, which is used to process the
entire module body (see @racket[module]). It allows the body of a
module to use the syntax of either a @|r6rs| library or a @|r6rs|
top-level program.
@ -199,12 +199,12 @@ top-level program.
(import import-spec ...)
program-body ...)]]{
An @schememodname[r6rs] module that contains a single @scheme[library]
An @racketmodname[r6rs] module that contains a single @racket[library]
form defines an @|r6rs| library, while a module body that starts with
an @scheme[import] form defined an @|r6rs| top-level program.
an @racket[import] form defined an @|r6rs| top-level program.
The @scheme[library], @scheme[export], and @scheme[import] identifiers
are not exported by the @schememodname[r6rs] library; they are
The @racket[library], @racket[export], and @racket[import] identifiers
are not exported by the @racketmodname[r6rs] library; they are
recognized through equivalence to unbound identifiers.}
@; ----------------------------------------
@ -213,12 +213,12 @@ recognized through equivalence to unbound identifiers.}
An @|r6rs| library name is sequence of symbols, optionally followed by
a version as a sequence of exact, non-negative integers. Roughly, such
a name is converted to a PLT Scheme module pathname (see @secref[#:doc
a name is converted to a Racket module pathname (see @secref[#:doc
guide-src "module-paths"]) by concatenating the symbols with a
@litchar{/} separator, and then appending the version integers each
with a preceding @litchar{-}. As a special case, when an @|r6rs| path
contains a single symbol (optionally followed by a version), a
@schemeidfont{main} symbol is effectively inserted after the initial
@racketidfont{main} symbol is effectively inserted after the initial
symbol. See below for further encoding considerations.
When an @|r6rs| library or top-level program refers to another
@ -229,9 +229,9 @@ time by searching the set of installed files.
In addition, when an @|r6rs| library path is converted, a file
extension is selected at compile time based on installed files. The
search order for file extensions is @filepath{.mzscheme.ss},
@filepath{.mzscheme.sls}, @filepath{.ss}, and @filepath{.sls}. When
resolving version constraints, these extensions are all tried when
looking for matches.
@filepath{.mzscheme.sls}, @filepath{.ss}, @filepath{.sls}, and
@filepath{.rkt}. When resolving version constraints, these extensions
are all tried when looking for matches.
@ -250,44 +250,44 @@ applied to each symbol before concatenating them:
module paths.}
@item{If the @|r6rs| library reference has two symbol elements and
the second one is @schemeidfont{main} followed by any number of
the second one is @racketidfont{main} followed by any number of
underscores, then an extra underscore is added to that symbol. This
conversion avoids a collision between an explicit @schemeidfont{main}
and the implicit @schemeidfont{main} when a library path has a single
conversion avoids a collision between an explicit @racketidfont{main}
and the implicit @racketidfont{main} when a library path has a single
symbol element.}
]
Examples (assuming a typical PLT Scheme installation):
Examples (assuming a typical Racket installation):
@schemeblock[
(rnrs io simple (6)) @#,elem{means} (lib "rnrs/io/simple-6.ss")
(rnrs) @#,elem{means} (lib "rnrs/main-6.ss")
(rnrs main) @#,elem{means} (lib "rnrs/main_.ss")
(rnrs (6)) @#,elem{means} (lib "rnrs/main-6.ss")
(scheme base) @#,elem{means} (lib "scheme/base.ss")
(achtung!) @#,elem{means} (lib "achtung%21/main.ss")
(funco new-λ) @#,elem{means} (lib "funco/new-%ce%bb.ss")
@racketblock[
(rnrs io simple (6)) @#,elem{means} (lib "rnrs/io/simple-6.rkt")
(rnrs) @#,elem{means} (lib "rnrs/main-6.rkt")
(rnrs main) @#,elem{means} (lib "rnrs/main_.rkt")
(rnrs (6)) @#,elem{means} (lib "rnrs/main-6.rkt")
(racket base) @#,elem{means} (lib "racket/base.rkt")
(achtung!) @#,elem{means} (lib "achtung%21/main.rkt")
(funco new-λ) @#,elem{means} (lib "funco/new-%ce%bb.rkt")
]
@; ----------------------------------------
@section{Scheme Interoperability}
@section{Language Interoperability}
Using the conversion rules in @secref["libpaths"], and @r6rs library
can refer to modules that are implemented in other dialects supported
by PLT Scheme, and other PLT Scheme modules can refer to libraries
by Racket, and other Racket modules can refer to libraries
that are implemented in @|r6rs|.
Beware that a @defterm{pair} in @|r6rs| corresponds to a
@defterm{mutable pair} in @schememodname[scheme/base]. Otherwise,
@|r6rs| libraries and @schememodname[scheme/base] share the same
@defterm{mutable pair} in @racketmodname[racket/base]. Otherwise,
@|r6rs| libraries and @racketmodname[racket/base] share the same
datatype for numbers, characters, strings, bytevectors (a.k.a. byte
strings), vectors, and so on. Hash tables are different. Input and
output ports from @schememodname[scheme/base] can be used directly as
output ports from @racketmodname[racket/base] can be used directly as
binary ports with @|r6rs| libraries, and all @|r6rs| ports can be used
as ports in @schememodname[scheme/base] programs, but only textual
as ports in @racketmodname[racket/base] programs, but only textual
ports created via @|r6rs| libraries can be used by other @|r6rs|
operations that expect textual ports.
@ -295,21 +295,21 @@ operations that expect textual ports.
@section[#:tag "conformance"]{@|r6rs| Conformance}
PLT Scheme's @|r6rs| support does not conform with the standard in
Racket's @|r6rs| support does not conform with the standard in
several known ways:
@itemize[
@item{When @scheme[guard] catches an exception that no clause
matches, the exception is re-@scheme[raise]ed without restoring
@item{When @racket[guard] catches an exception that no clause
matches, the exception is re-@racket[raise]ed without restoring
the continuation to the one that raised the exception.
This difference can be made visible using
@scheme[dynamic-wind]. According to @|r6rs|, the following
@racket[dynamic-wind]. According to @|r6rs|, the following
program should print ``in'' and ``out'' twice, but each prints
once using PLT Scheme:
once using Racket:
@schemeblock[
@racketblock[
(guard (exn [(equal? exn 5) 'five])
(guard (exn [(equal? exn 6) 'six])
(dynamic-wind
@ -321,27 +321,27 @@ several known ways:
Along similar lines, continuation capture and invocation within
an exception handler is restricted. Unless the exception is
raised through @scheme[raise-continuable], a handler can escape
raised through @racket[raise-continuable], a handler can escape
only through a continuation that is a tail of the current
continuation, and a continuation captured within the handler
cannot be invoked after control escapes from the raise.
The initial exception handler does not return for
non-@scheme[&serious] conditions, but @scheme[raise] and
@scheme[raise-continuable] both install an uncaught-exception
handler (via @scheme[parameterize] and
@scheme[uncaught-exception-handler]) to one that returns for
non-@scheme[&serious] conditions.}
non-@racket[&serious] conditions, but @racket[raise] and
@racket[raise-continuable] both install an uncaught-exception
handler (via @racket[parameterize] and
@racket[uncaught-exception-handler]) to one that returns for
non-@racket[&serious] conditions.}
@item{Inexact numbers are printed without a precision indicator, and
precision indicators are ignored on input (e.g.,
@schemevalfont{0.5|7} is read the same as @scheme[0.5]).}
@racketvalfont{0.5|7} is read the same as @racket[0.5]).}
@item{Word boundaries for @scheme[string-downcase],
@scheme[string-upcase], and @scheme[string-titlecase] are not
@item{Word boundaries for @racket[string-downcase],
@racket[string-upcase], and @racket[string-titlecase] are not
determined as specified by Unicode Standard Annex #29.}
@item{When an identifier bound by @scheme[letrec] or @scheme[letrec*]
@item{When an identifier bound by @racket[letrec] or @racket[letrec*]
is referenced before it is bound, an exception is not raised;
instead, the reference produces @|undefined-const|.}
@ -357,13 +357,13 @@ several known ways:
automatically reset the port's position to counteract the
effects of buffering.}
@item{The bindings in a namespace produced by @scheme[null-environment]
or @scheme[scheme-report-environment] correspond to @|r5rs| bindings
instead of @|r6rs| bindings. In particular, @scheme[=>], @scheme[else],
@scheme[_], and @scheme[...] are not bound.}
@item{The bindings in a namespace produced by @racket[null-environment]
or @racket[racket-report-environment] correspond to @|r5rs| bindings
instead of @|r6rs| bindings. In particular, @racket[=>], @racket[else],
@racket[_], and @racket[...] are not bound.}
@item{Bindings for @schemeidfont{#%datum}, @schemeidfont{#%app},
@schemeidfont{#%top}, and @schemeidfont{#%top-interaction} are
@item{Bindings for @racketidfont{#%datum}, @racketidfont{#%app},
@racketidfont{#%top}, and @racketidfont{#%top-interaction} are
imported into every library and program, and at every phase
level for which the library or program has imports.}
@ -388,7 +388,7 @@ several known ways:
@(define-syntax-rule (r6rs-module mod-path lib html anchor title elem ...)
(begin
(subsection #:tag (format "~a" 'mod-path)
(scheme lib) ": " title)
(racket lib) ": " title)
(defmodule mod-path)
"Original specification: " (link (format "../~a/~a#~a" (dir-of html) html anchor)
title)
@ -398,7 +398,7 @@ several known ways:
@r6rs-module[rnrs/base-6 (rnrs base (6))
"r6rs-Z-H-14.html" "node_sec_11.4" "Base"
;; Generated with makeindex.ss --r6rs, then further converted and
;; Generated with makeindex.rkt --r6rs, then further converted and
;; filtered by hand
(* #f "r6rs-Z-H-14.html" "node_idx_496")
(+ #f "r6rs-Z-H-14.html" "node_idx_494")
@ -1119,10 +1119,10 @@ See also @secref["conformance"].
(equal-hash #f "r6rs-lib-Z-H-14.html" "node_idx_1218")]
A hashtable is a dictionary in the sense of
@schememodname[scheme/dict], and hash table operations interact with
@racketmodname[racket/dict], and hash table operations interact with
threads in the same way for hash tables created with
@scheme[make-hash] (e.g., @scheme[hashtable-ref] and
@scheme[hashtable-set!] are thread-safe).
@racket[make-hash] (e.g., @racket[hashtable-ref] and
@racket[hashtable-set!] are thread-safe).
@r6rs-module[rnrs/enums-6 (rnrs enums (6))
"r6rs-lib-Z-H-15.html" "node_idx_1226" "Enumerations"

View File

@ -5,6 +5,7 @@
(require (for-syntax racket/base
racket/list
racket/struct-info
(prefix-in a: "helpers.ss"))
"arrow.ss"
"base.ss"
@ -18,6 +19,25 @@
[(_ name x) (a:known-good-contract? #'x) #'x]
[(_ name x) #'(coerce-contract name x)]))
(define-for-syntax (self-ctor-transformer orig stx)
(with-syntax ([orig orig])
(syntax-case stx ()
[(_ arg ...) (datum->syntax stx
(syntax-e (syntax (orig arg ...)))
stx
stx)]
[_ (syntax orig)])))
(define-for-syntax make-applicable-struct-info
(letrec-values ([(struct: make- ? ref set!)
(make-struct-type 'self-ctor-struct-info struct:struct-info
1 0 #f
(list (cons prop:procedure
(lambda (v stx)
(self-ctor-transformer ((ref v 0)) stx))))
(current-inspector) #f '(0))])
make-))
(define-for-syntax (make-provide/contract-transformer contract-id id external-id pos-module-source)
(make-set!-transformer
(let ([saved-id-table (make-hasheq)])
@ -160,7 +180,7 @@
(begin
(add-to-dups-table #'new-name)
(cons (code-for-one-id provide-stx
(syntax this-name)
(syntax this-name) #f
(add-exists-binders (syntax contract) exists-binders)
(syntax new-name))
(loop (cdr clauses) exists-binders)))]
@ -229,7 +249,7 @@
(begin
(add-to-dups-table #'name)
(cons (code-for-one-id provide-stx
(syntax name)
(syntax name) #f
(add-exists-binders (syntax contract)
exists-binders)
#f)
@ -279,6 +299,8 @@
[constructor-id (list-ref struct-info 1)]
[predicate-id (list-ref struct-info 2)]
[selector-ids (reverse (list-ref struct-info 3))]
[type-is-only-constructor? (free-identifier=? constructor-id struct-name)]
[type-is-constructor? #t] ; I think there's no way to detect when the struct-name binding isn't a constructor
[is-id-ok?
(λ (id i)
(if (or (not parent-struct-count)
@ -356,8 +378,8 @@
[else (cons (- (car c) (cadr c))
(loop (cdr c)))]))]
[names (map cdr all-parent-struct-count/names)]
[maker-name (format "~a" (syntax-e constructor-id))]
[struct-name (substring maker-name 5 (string-length maker-name))])
[predicate-name (format "~a" (syntax-e predicate-id))]
[struct-name (substring predicate-name 0 (sub1 (string-length predicate-name)))])
(let loop ([count (car relative-counts)]
[name (car names)]
[counts (cdr relative-counts)]
@ -400,7 +422,7 @@
(if (is-new-id? index)
(code-for-one-id/new-name
stx
selector-id
selector-id #f
(build-selector-contract struct-name
predicate-id
field-contract-id)
@ -421,7 +443,7 @@
(map/count (λ (mutator-id field-contract-id index)
(if (and mutator-id (is-new-id? index))
(code-for-one-id/new-name stx
mutator-id
mutator-id #f
(build-mutator-contract struct-name
predicate-id
field-contract-id)
@ -430,16 +452,17 @@
mutator-ids
field-contract-ids)]
[(predicate-code predicate-new-name)
(code-for-one-id/new-name stx predicate-id (syntax (-> any/c boolean?)) #f)]
(code-for-one-id/new-name stx predicate-id #f (syntax (-> any/c boolean?)) #f)]
[(constructor-code constructor-new-name)
(code-for-one-id/new-name
stx
constructor-id
constructor-id struct-name
(build-constructor-contract stx
field-contract-ids
predicate-id)
#f
#t)]
#t
(not type-is-only-constructor?))]
[(field-contract-id-definitions ...)
(filter values (map (λ (field-contract-id field-contract)
@ -470,7 +493,7 @@
[(mutator-id-info ...)
(map (λ (x)
(syntax-case x ()
[(a b) #'(slc #'b)]
[(a b) #'(quote-syntax b)]
[else #f]))
(syntax->list #'(mutator-codes/mutator-new-names ...)))]
[(exported-selector-ids ...) (reverse selector-ids)]
@ -478,21 +501,22 @@
#`(begin
(provide (rename-out [id-rename struct-name]))
(define-syntax id-rename
(let ([slc (syntax-local-certifier)])
#;
(list (slc #'-struct:struct-name)
(slc #'#,constructor-id)
(slc #'#,predicate-id)
(list (slc #'exported-selector-ids) ...)
#,(let ([proc
#`(lambda ()
(list (quote-syntax -struct:struct-name)
#,(if type-is-only-constructor?
#'(quote-syntax id-rename)
#'(quote-syntax constructor-new-name))
(quote-syntax predicate-new-name)
(list (quote-syntax rev-selector-new-names) ...
(quote-syntax rev-selector-old-names) ...)
(list mutator-id-info ...)
super-id)
(list (slc #'-struct:struct-name)
(slc #'constructor-new-name)
(slc #'predicate-new-name)
(list (slc #'rev-selector-new-names) ...
(slc #'rev-selector-old-names) ...)
(list mutator-id-info ...)
super-id)))))]
super-id))])
(if type-is-constructor?
#`(make-applicable-struct-info #,proc
(lambda ()
(quote-syntax constructor-new-name)))
#`(make-struct-info #,proc))))))]
[struct:struct-name struct:struct-name]
[-struct:struct-name -struct:struct-name]
[struct-name struct-name]
@ -604,8 +628,8 @@
;; given the syntax for an identifier and a contract,
;; builds a begin expression for the entire contract and provide
;; the first syntax object is used for source locations
(define (code-for-one-id stx id ctrct user-rename-id)
(with-syntax ([(code id) (code-for-one-id/new-name stx id ctrct user-rename-id)])
(define (code-for-one-id stx id reflect-id ctrct user-rename-id)
(with-syntax ([(code id) (code-for-one-id/new-name stx id reflect-id ctrct user-rename-id)])
(syntax code)))
;; code-for-one-id/new-name : syntax syntax syntax (union syntax #f) -> (values syntax syntax)
@ -614,28 +638,33 @@
;; the first syntax object is used for source locations
(define code-for-one-id/new-name
(case-lambda
[(stx id ctrct user-rename-id)
(code-for-one-id/new-name stx id ctrct user-rename-id #f)]
[(stx id ctrct user-rename-id mangle-for-maker?)
(let ([no-need-to-check-ctrct? (a:known-good-contract? ctrct)])
[(stx id reflect-id ctrct user-rename-id)
(code-for-one-id/new-name stx id reflect-id ctrct user-rename-id #f #t)]
[(stx id reflect-id ctrct user-rename-id mangle-for-maker?)
(code-for-one-id/new-name id reflect-id ctrct user-rename-id mangle-for-maker? #t)]
[(stx id reflect-id ctrct user-rename-id mangle-for-maker? provide?)
(let ([no-need-to-check-ctrct? (a:known-good-contract? ctrct)]
[ex-id (or reflect-id id)])
(with-syntax ([id-rename ((if mangle-for-maker?
a:mangle-id-for-maker
a:mangle-id)
provide-stx
"provide/contract-id"
(or user-rename-id id))]
(or user-rename-id ex-id))]
[contract-id (if no-need-to-check-ctrct?
ctrct
(a:mangle-id provide-stx
"provide/contract-contract-id"
(or user-rename-id id)))]
(or user-rename-id ex-id)))]
[pos-module-source (a:mangle-id provide-stx
"provide/contract-pos-module-source"
(or user-rename-id id))]
(or user-rename-id ex-id))]
[pos-stx (datum->syntax id 'here)]
[id id]
[ctrct (syntax-property ctrct 'inferred-name id)]
[ex-id ex-id]
[ctrct (syntax-property ctrct 'inferred-name ex-id)]
[external-name (or user-rename-id id)]
[reflect-external-name (or user-rename-id ex-id)]
[where-stx stx])
(with-syntax ([extra-test
(syntax-case #'ctrct (->)
@ -651,15 +680,17 @@
#,@(if no-need-to-check-ctrct?
(list)
(list #'(define contract-id
(let ([id ctrct]) ;; let is here to give the right name.
(verify-contract 'provide/contract id)))))
(let ([ex-id ctrct]) ;; let is here to give the right name.
(verify-contract 'provide/contract ex-id)))))
(define-syntax id-rename
(make-provide/contract-transformer (quote-syntax contract-id)
(quote-syntax id)
(quote-syntax external-name)
(quote-syntax reflect-external-name)
(quote-syntax pos-module-source)))
(provide (rename-out [id-rename external-name]))))])
#,@(if provide?
(list #`(provide (rename-out [id-rename external-name])))
null)))])
(syntax-local-lift-module-end-declaration
#`(begin

View File

@ -154,7 +154,7 @@
[(struct s pats)
(parse-struct stx cert parse #'s #'pats)]
[(s . pats)
(struct-info? (syntax-local-value #'s (lambda () #f)))
(and (identifier? #'s) (struct-info? (syntax-local-value #'s (lambda () #f))))
(parse-struct stx cert parse #'s #'pats)]
[(? p q1 qs ...)
(make-And (cons (make-Pred (cert #'p))

View File

@ -910,7 +910,7 @@
(when pf? (out "s")))
(pp-list (let ([l (vector->list v)])
(if (and qd (not pf?))
(cons (make-unquoted (object-name v))
(cons (make-unquoted (object-name obj))
(cdr l))
l))
extra pp-expr #f depth

View File

@ -34,7 +34,7 @@
class?
mixin
interface interface* interface?
object% object? externalizable<%> printable<%> equal<%>
object% object? externalizable<%> printable<%> writable<%> equal<%>
object=?
new make-object instantiate
send send/apply send* class-field-accessor class-field-mutator with-method
@ -4669,14 +4669,23 @@
(define externalizable<%>
(_interface () externalize internalize))
(define printable<%>
(define writable<%>
(interface* ()
([prop:custom-write (lambda (obj port write?)
(if write?
([prop:custom-write (lambda (obj port mode)
(if mode
(send obj custom-write port)
(send obj custom-display port)))])
custom-write custom-display))
(define printable<%>
(interface* ()
([prop:custom-write (lambda (obj port mode)
(case mode
[(#t) (send obj custom-write port)]
[(#f) (send obj custom-display port)]
[else (send obj custom-print port mode)]))])
custom-write custom-display custom-print))
(define equal<%>
(interface* ()
([prop:equal+hash (list
@ -4728,7 +4737,7 @@
class?
mixin
(rename-out [_interface interface]) interface* interface?
object% object? object=? externalizable<%> printable<%> equal<%>
object% object? object=? externalizable<%> printable<%> writable<%> equal<%>
new make-object instantiate
get-field set-field! field-bound? field-names
send send/apply send* class-field-accessor class-field-mutator with-method

View File

@ -264,9 +264,9 @@
(eq? '#:extra-constructor-name (syntax-e (car p))))
(check-exprs 1 p "identifier")
(when (lookup config '#:constructor-name)
(bad "multiple #:constructor-name or #:extra-constructor-name keys" (car p)))
(bad "multiple" "#:constructor-name or #:extra-constructor-name keys" (car p)))
(unless (identifier? (cadr p))
(bad "need an identifier after #:constructor-name" (cadr p)))
(bad "need an identifier after" (car p) (cadr p)))
(loop (cddr p)
(extend-config (extend-config config '#:constructor-name (cadr p))
'#:only-constructor?

View File

@ -41,6 +41,7 @@
in-hash-keys
in-hash-values
in-hash-pairs
in-directory
in-sequences
in-cycle
@ -1322,4 +1323,40 @@
(lambda () (read-char p*)))
eof)]])))
(define in-directory
(case-lambda
[(dir)
(when dir
(unless (path-string? dir)
(raise-type-error 'in-directory "#f, path, or path string" dir)))
(let ([make-gen (lambda ()
(call-with-continuation-prompt
(lambda ()
(define (reply v)
(let/cc k
(abort-current-continuation
(default-continuation-prompt-tag)
(lambda () (cons (lambda () v) k)))))
(let loop ([dir (path->complete-path (or dir (current-directory)))]
[prefix dir])
(for ([i (in-list (directory-list dir))])
(let ([p (if prefix (build-path prefix i) i)]
[fp (build-path dir i)])
(reply p)
(when (directory-exists? fp)
(loop fp p)))))
(reply eof))))])
(make-do-sequence
(lambda ()
(values
(lambda (gen) ((car gen)))
(lambda (gen) (call-with-continuation-prompt
(lambda ()
((cdr gen)))))
(make-gen)
(lambda (gen) (not (eof-object? ((car gen)))))
(lambda (val) #t)
(lambda (gen val) #t)))))]
[() (in-directory #f)]))
)

View File

@ -1186,12 +1186,17 @@
(+ alen 2)
len)
wrap-proc))
(let ([new-args (car results)])
(let ([extra? (= len (+ alen 2))])
(let ([new-args ((if extra? cadr car) results)])
(unless (and (list? new-args)
(= (length new-args) (length args)))
(raise-mismatch-error
'|keyword procedure chaperone|
"expected a list of keyword-argument values as first result from chaperoning procedure: "
(format
"expected a list of keyword-argument values as first result~a from chaperoning procedure: "
(if (= len alen)
""
" (after the result chaperoning procedure)"))
wrap-proc))
(for-each
(lambda (kw new-arg arg)
@ -1205,7 +1210,9 @@
kws
new-args
args))
(apply values kws results))))))]
(if extra?
(apply values (car results) kws (cdr results))
(apply values kws results))))))))]
[new-proc
(cond
[(okp? proc)

View File

@ -4,7 +4,8 @@
vector-take vector-drop vector-split-at
vector-take-right vector-drop-right vector-split-at-right
vector-filter vector-filter-not
vector-count vector-argmin vector-argmax)
vector-count vector-argmin vector-argmax
vector-member vector-memq vector-memv)
(require racket/unsafe/ops)
;; unchecked version of `vector-copy'
@ -50,9 +51,9 @@
;; length is passed to save the computation
(define (vector-map/update f target length vs)
(for ([i (in-range length)])
(unsafe-vector-set!
(unsafe-vector*-set!
target i
(apply f (map (lambda (vec) (unsafe-vector-ref vec i)) vs)))))
(apply f (map (lambda (vec) (unsafe-vector*-ref vec i)) vs)))))
;; check that `v' is a vector
;; that `v' and all the `vs' have the same length
@ -68,12 +69,12 @@
0 f))
(unless (vector? v)
(raise-type-error name "vector" 1 v))
(let ([len (unsafe-vector-length v)])
(let ([len (unsafe-vector*-length v)])
(for ([e (in-list vs)]
[i (in-naturals 2)])
(unless (vector? e)
(raise-type-error name "vector" e i))
(unless (= len (unsafe-vector-length e))
(unless (= len (unsafe-vector*-length e))
(raise
(make-exn:fail:contract
(format "~e: all vectors must have same size; ~a"
@ -129,8 +130,8 @@
([i (in-range len)]
#:when
(apply f
(unsafe-vector-ref v i)
(map (lambda (v) (unsafe-vector-ref v i)) vs)))
(unsafe-vector*-ref v i)
(map (lambda (v) (unsafe-vector*-ref v i)) vs)))
(add1 c))
(error 'vector-count "all vectors must have same size")))
(for/fold ([cnt 0]) ([i (in-vector v)] #:when (f i))
@ -141,7 +142,7 @@
(raise-type-error name "vector" v))
(unless (exact-nonnegative-integer? n)
(raise-type-error name "non-negative exact integer" n))
(let ([len (unsafe-vector-length v)])
(let ([len (unsafe-vector*-length v)])
(unless (<= 0 n len)
(raise-mismatch-error
name
@ -177,14 +178,14 @@
(let* ([vs (cons v vs)]
[lens (for/list ([e (in-list vs)] [i (in-naturals)])
(if (vector? e)
(unsafe-vector-length e)
(unsafe-vector*-length e)
(raise-type-error 'vector-append "vector" e i)))]
[new-v (make-vector (apply + lens))])
(let loop ([start 0] [lens lens] [vs vs])
(when (pair? lens)
(let ([len (car lens)] [v (car vs)])
(for ([i (in-range len)])
(unsafe-vector-set! new-v (+ i start) (unsafe-vector-ref v i)))
(unsafe-vector*-set! new-v (+ i start) (unsafe-vector*-ref v i)))
(loop (+ start len) (cdr lens) (cdr vs)))))
new-v))
@ -194,13 +195,13 @@
(procedure-arity-includes? f 1))
(raise-type-error name "procedure (arity 1)" f))
(unless (and (vector? xs)
(< 0 (unsafe-vector-length xs)))
(< 0 (unsafe-vector*-length xs)))
(raise-type-error name "non-empty vector" xs))
(let ([init-min-var (f (unsafe-vector-ref xs 0))])
(let ([init-min-var (f (unsafe-vector*-ref xs 0))])
(unless (real? init-min-var)
(raise-type-error name "procedure that returns real numbers" f))
(let-values ([(min* min-var*)
(for/fold ([min (unsafe-vector-ref xs 0)]
(for/fold ([min (unsafe-vector*-ref xs 0)]
[min-var init-min-var])
([e (in-vector xs 1)])
(let ([new-min (f e)])
@ -214,3 +215,19 @@
(define (vector-argmin f xs) (mk-min < 'vector-argmin f xs))
(define (vector-argmax f xs) (mk-min > 'vector-argmax f xs))
(define-syntax-rule (vm-mk name cmp)
(define (name val vec)
(unless (vector? vec)
(raise-type-error 'name "vector" 1 vec))
(let ([sz (unsafe-vector*-length vec)])
(let loop ([k 0])
(cond [(= k sz) #f]
[(cmp val
(unsafe-vector*-ref vec k))
k]
[else (loop (unsafe-fx+ 1 k))])))))
(vm-mk vector-member equal?)
(vm-mk vector-memq eq?)
(vm-mk vector-memv eqv?)

View File

@ -7,7 +7,7 @@
@(define raclog-eval (make-base-eval))
@(raclog-eval '(require raclog))
@title{@bold{Raclog}: Prolog-style logic programming in Racket}
@title{@bold{Raclog}: Prolog-Style Logic Programming in Racket}
@author{Dorai Sitaram}

View File

@ -1,23 +1,27 @@
#lang racket/base
;; The `setup' tool loads this module with bytecode files disabled,
;; so minimize its dependencies
(provide current-command-name
(module command-name '#%kernel
(#%provide current-command-name
program+command-name
short-program+command-name)
(define current-command-name (make-parameter #f))
(define-values (current-command-name) (make-parameter #f))
(define (program+command-name)
(let ([p (find-system-path 'run-file)]
[n (current-command-name)])
(define-values (program+command-name)
(lambda ()
(let-values ([(p) (find-system-path 'run-file)]
[(n) (current-command-name)])
(if n
(format "~a ~a" p n)
p)))
p))))
(define (short-program+command-name)
(let ([p (find-system-path 'run-file)]
[n (current-command-name)])
(define-values (short-program+command-name)
(lambda ()
(let-values ([(p) (find-system-path 'run-file)]
[(n) (current-command-name)])
(let-values ([(base name dir?) (split-path p)])
(if n
(format "~a ~a" name n)
(path->string name)))))
(path->string name)))))))

View File

@ -30,6 +30,7 @@
check-=
check-not-false
check-not-eq?
check-not-eqv?
check-not-equal?
fail)
@ -174,7 +175,7 @@
(define-syntax define-binary-check
(syntax-rules ()
((_ (name expr1 expr2) expr ...)
[(_ (name expr1 expr2) expr ...)
(define-check (name expr1 expr2)
(with-check-info*
(list (make-check-actual expr1)
@ -183,8 +184,8 @@
(let ((result (begin expr ...)))
(if result
result
(fail-check)))))))
((_ (name pred expr1 expr2))
(fail-check))))))]
[(_ (name pred expr1 expr2))
(define-check (name expr1 expr2)
(with-check-info*
(list (make-check-actual expr1)
@ -192,7 +193,7 @@
(lambda ()
(if (pred expr1 expr2)
#t
(fail-check))))))))
(fail-check)))))]))
(define-check (check-exn pred thunk)
(let/ec succeed
@ -263,6 +264,9 @@
(define-simple-check (check-not-eq? expr1 expr2)
(not (eq? expr1 expr2)))
(define-simple-check (check-not-eqv? expr1 expr2)
(not (eqv? expr1 expr2)))
(define-simple-check (check-not-equal? expr1 expr2)
(not (equal? expr1 expr2)))

View File

@ -57,13 +57,6 @@
v
(raise-type-error 'current-test-case-around "procedure" v)))))
;; test-case-check-handler : (-> exn void)
;;
;; Raise any exceptions that occur in checks, halting
;; evaluation of following expression within the scope of
;; the test case
(define test-case-check-handler raise)
(define-syntax (test-begin stx)
(syntax-case stx ()
[(_ expr ...)
@ -71,7 +64,7 @@
((current-test-case-around)
(lambda ()
(parameterize
([current-check-handler test-case-check-handler]
([current-check-handler raise]
[current-check-around check-around])
expr ...))))]
[_

View File

@ -9,7 +9,8 @@
"test-suite.rkt"
"util.rkt")
(provide (struct-out exn:test:check)
(provide (struct-out exn:test)
(struct-out exn:test:check)
(struct-out check-info)
(struct-out test-result)
(struct-out test-failure)
@ -45,6 +46,10 @@
(rename-out [make-racunit-test-case make-test-case]
[racunit-test-case? test-case?]
[racunit-test-suite? test-suite?])
current-test-name
current-test-case-around
test-suite-test-case-around
test-suite-check-around
define-test-suite
define/provide-test-suite
@ -81,6 +86,9 @@
define-simple-check
define-binary-check
current-check-handler
current-check-around
check
check-exn
check-not-exn
@ -93,6 +101,7 @@
check-=
check-not-false
check-not-eq?
check-not-eqv?
check-not-equal?
check-regexp-match
fail)

View File

@ -36,6 +36,7 @@ For example, the following check succeeds:
@defproc*[([(check-eq? (v1 any) (v2 any) (message string? "")) #t]
[(check-not-eq? (v1 any) (v2 any) (message string? "")) #t]
[(check-eqv? (v1 any) (v2 any) (message string? "")) #t]
[(check-not-eqv? (v1 any) (v2 any) (message string? "")) #t]
[(check-equal? (v1 any) (v2 any) (message string? "")) #t]
[(check-not-equal? (v1 any) (v2 any) (message string? "")) #t])]{
@ -50,6 +51,7 @@ For example, the following checks all fail:
(check-eq? (list 1) (list 1) "allocated data not eq?")
(check-not-eq? 1 1 "integers are eq?")
(check-eqv? 1 1.0 "not eqv?")
(check-not-eqv? 1 1 "integers are eqv?")
(check-equal? 1 1.0 "not equal?")
(check-not-equal? (list 1) (list 1) "equal?")
]
@ -330,9 +332,7 @@ of these parameters.
@defparam[current-check-handler handler (-> any/c any/c)]{
Parameter containing the function that handles exceptions
raised by check failures. The default behaviour is to print
an error message including the exception message and stack
trace. }
raised by check failures. The default value is @racket[raise]. }
@defparam[current-check-around check (-> thunk any/c)]{

View File

@ -1,88 +1,88 @@
#lang scribble/doc
@(require scribble/manual
(for-label scheme/base
(for-label racket/base
readline
readline/pread
readline/readline
scheme/contract
(except-in scheme/foreign ->)))
racket/contract
(except-in ffi/unsafe ->)))
@(define readline "Readline")
@(define Readline "Readline")
@title{@bold{Readline}: Terminal Interaction}
The @filepath{readline} collection (not to be confused with MzScheme's
@scheme[read-line] function) provides glue for using GNU's @|readline|
library with the MzScheme @scheme[read-eval-print-loop].
The @filepath{readline} collection (not to be confused with Racket's
@racket[read-line] function) provides glue for using GNU's @|readline|
library with the Racket @racket[read-eval-print-loop].
@section{Normal Use of @|Readline|}
@defmodule*[(readline readline/rep-start)]
The @schememodname[readline] library installs a @|readline|-based
input port, and hooks the prompt-and-read part of MzScheme's
@scheme[read-eval-print-loop] to interact with it
The @racketmodname[readline] library installs a @|readline|-based
input port, and hooks the prompt-and-read part of Racket's
@racket[read-eval-print-loop] to interact with it
You can start MzScheme with
You can start Racket with
@commandline{mzscheme -il readline}
@commandline{racket -il readline}
or evaluate
@schemeblock[
@racketblock[
(require readline)
]
in the MzScheme @scheme[read-eval-print-loop] to load @|readline|
in the Racket @racket[read-eval-print-loop] to load @|readline|
manually. You can also put (require readline) in your
@filepath{~/.mzschemerc}, so that MzScheme automatically loads
@filepath{~/.racketrc}, so that Racket automatically loads
@|readline| support in interactive mode.
If you want to enable @|readline| support only sometimes---such as
only when you use an @exec{xterm}, and not when you use an Emacs
shell---then you can use @scheme[dynamic-require], as in the following
shell---then you can use @racket[dynamic-require], as in the following
example:
@schemeblock[
@racketblock[
(when (regexp-match? #rx"xterm"
(getenv "TERM"))
(dynamic-require 'readline #f))
]
The @schememodname[readline] library automatically checks whether the
The @racketmodname[readline] library automatically checks whether the
current input port is a terminal, as determined by
@scheme[terminal-port?], and it installs @|readline| only to replace
terminal ports. The @schememodname[readline/rep-start] module
@racket[terminal-port?], and it installs @|readline| only to replace
terminal ports. The @racketmodname[readline/rep-start] module
installs @|readline| without a terminal check.
By default, @|readline|'s completion is set to use the visible
bindings in the current namespace. This is far from ideal, but it's
better than @|readline|'s default filename completion which is rarely
useful. In addition, the @|readline| history is stored across
invocations in MzScheme's preferences file, assuming that MzScheme
invocations in Racket's preferences file, assuming that Racket
exits normally.
@defproc[(install-readline!) void?]{
Adds @scheme[(require readline/rep)] to the result of
@scheme[(find-system-path 'init-file)], which is
@filepath{~/.mzschemerc} under Unix. Consequently, @|readline| will be
loaded whenever MzScheme is started in interactive mode. The
Adds @racket[(require readline/rep)] to the result of
@racket[(find-system-path 'init-file)], which is
@filepath{~/.racketrc} under Unix. Consequently, @|readline| will be
loaded whenever Racket is started in interactive mode. The
declaration is added only if it is not already present, as determined
by @scheme[read]ing and checking all top-level expressions in the
by @racket[read]ing and checking all top-level expressions in the
file.
For more fine-grained control, such as conditionally loading
@|readline| based on an environment variable, edit
@filepath{~/.mzschemerc} manually.}
@filepath{~/.racketrc} manually.}
@section{Interacting with the @|Readline|-Enabled Input Port }
@defmodule[readline/pread]{ The @schememodname[readline/pread] library
@defmodule[readline/pread]{ The @racketmodname[readline/pread] library
provides customization, and support for prompt-reading after
@schememodname[readline] installs the new input port.}
@racketmodname[readline] installs the new input port.}
The reading facility that the new input port provides can be
customized with the following parameters.
@ -91,58 +91,59 @@ customized with the following parameters.
@defparam[current-prompt bstr bytes?]{
A parameter that determines the prompt that is used, as a byte string.
Defaults to @scheme[#"> "].}
Defaults to @racket[#"> "].}
@;{
@defboolparam[show-all-prompts on?]{
A parameter. If @scheme[#f], no prompt is shown until you write input
A parameter. If @racket[#f], no prompt is shown until you write input
that is completely readable. For example, when you type
@schemeblock[
@racketblock[
(foo bar) (+ 1
2)
]
you will see a single prompt in the beginning.
The problem is that the first expression can be @scheme[(read-line)],
The problem is that the first expression can be @racket[(read-line)],
which normally consumes the rest of the text on the @emph{same} line.
The default value of this parameter is therefore @scheme[#t], making
The default value of this parameter is therefore @racket[#t], making
it mimic plain I/O interactions.}
}
@defparam[max-history n exact-nonnegative-integer?]{
A parameter that determines the number of history entries to save,
defaults to @scheme[100].}
defaults to @racket[100].}
@defparam[keep-duplicates keep? (one-of/c #f 'unconsecutive #t)]{
A parameter. If @scheme[#f] (the default), then when a line is equal
A parameter. If @racket[#f] (the default), then when a line is equal
to a previous one, the previous one is removed. If it set to
@scheme['unconsecutive] then this happens only for an line that
duplicates the previous one, and if it is @scheme[#f] then all
@racket['unconsecutive] then this happens only for an line that
duplicates the previous one, and if it is @racket[#f] then all
duplicates are kept.}
@defboolparam[keep-blanks keep?]{
A parameter. If @scheme[#f] (the default), blank input lines are not
A parameter. If @racket[#f] (the default), blank input lines are not
kept in history.}
@defparam[readline-prompt status (or/c false/c bytes? (one-of/c 'space))]{
The new input port that you get when you require
@schememodname[readline] is a custom port that uses @|readline| for
@racketmodname[readline] is a custom port that uses @|readline| for
all inputs. The problem is when you want to display a prompt and then
read some input, @|readline| will get confused if it is not used when the
cursor is at the beginning of the line (which is why it has a
@scheme[_prompt] argument.) To use this prompt:
@racket[_prompt] argument.) To use this prompt:
@schemeblock[
@racketblock[
(parameterize ([readline-prompt some-byte-string])
...code-that-reads...)
]
@ -150,20 +151,20 @@ cursor is at the beginning of the line (which is why it has a
This expression makes the first call to @|readline| use the prompt, and
subsequent calls will use an all-spaces prompt of the same length (for
example, when you're reading an S-expression). The normal value of
@scheme[readline-prompt] is @scheme[#f] for an empty prompt (and
@racket[readline-prompt] is @racket[#f] for an empty prompt (and
spaces after the prompt is used, which is why you should use
@scheme[parameterize] to restore it to @scheme[#f]).
@racket[parameterize] to restore it to @racket[#f]).
A proper solution would be to install a custom output port, too, which
keeps track of text that is displayed without a trailing newline. As
a cheaper solution, if line-counting is enabled for the terminal's
output-port, then a newline is printed before reading if the column is
not 0. (The @schememodname[readline] library enables line-counting
not 0. (The @racketmodname[readline] library enables line-counting
for the output port.)
@bold{Warning:} The @|readline| library uses the output port directly.
You should not use it when @scheme[current-input-port] has been
modified, or when it was not a terminal port when MzScheme was started
You should not use it when @racket[current-input-port] has been
modified, or when it was not a terminal port when Racket was started
(eg, when reading input from a pipe). Expect some problems if you
ignore this warning (not too bad, mostly problems with detecting an
EOF).}
@ -181,7 +182,7 @@ Prints the given prompt string and reads a line.}
@defproc[(readline-bytes [prompt bytes?]) bytes?]{
Like @scheme[readline], but using raw byte-strings for the prompt and
Like @racket[readline], but using raw byte-strings for the prompt and
returning a byte string.}
@ -203,16 +204,16 @@ Returns the length of the history list.}
@defproc[(history-get [idx integer?]) string?]{
Returns the history string at the @scheme[idx] position. @scheme[idx]
Returns the history string at the @racket[idx] position. @racket[idx]
can be negative, which will make it count from the last (i.e,
@scheme[-1] returns the last item, @scheme[-2] returns the
@racket[-1] returns the last item, @racket[-2] returns the
second-to-last, etc.)}
@defproc[(history-delete [idx integer?]) string?]{
Deletes the history string at the @scheme[idx] position. The position
is specified in the same way as the argument for @scheme[history-get].}
Deletes the history string at the @racket[idx] position. The position
is specified in the same way as the argument for @racket[history-get].}
@defproc[(set-completion-function! [proc ((or/c string? bytes?)
@ -221,16 +222,16 @@ is specified in the same way as the argument for @scheme[history-get].}
void?]{
Sets @|readline|'s @tt{rl_completion_entry_function} to
@scheme[proc]. The @scheme[type] argument, whose possible values are
from @schememodname[scheme/foreign], determines the type of value
supplied to the @scheme[proc].}
@racket[proc]. The @racket[type] argument, whose possible values are
from @racketmodname[ffi/unsafe], determines the type of value supplied
to the @racket[proc].}
@section{License Issues}
GNU's @|readline| library is covered by the GPL, and that applies to code
that links with it. PLT Scheme is LGPL, so this code is not used by
default; you should explicitly enable it if you want to. Also, be
aware that if you write code that uses this library, it will make your
code link to the @|readline| library when invoked, with the usual GPL
implications.
GNU's @|readline| library is covered by the GPL, and that applies to
code that links with it. Racket is licensed with the LGPL, so the
@|readline| code is not used by default; you should explicitly enable
it if you want to. Also, be aware that if you write code that uses
this library, it will make your code link to the @|readline| library
when invoked, with the usual GPL implications.

View File

@ -3,6 +3,7 @@
(provide (except-out (all-from-out racket/base)
struct
hash hasheq hasheqv)
hash hasheq hasheqv
in-directory)
make-base-empty-namespace
make-base-namespace)

View File

@ -1,2 +1,5 @@
#lang scheme/private/provider
racket/class
#lang scheme/base
(require racket/class)
(provide (except-out (all-from-out racket/class)
printable<%>)
(rename-out [writable<%> printable<%>]))

View File

@ -1,2 +1,5 @@
#lang scheme/private/provider
racket/pretty
#lang scheme/base
(require racket/pretty)
(provide (except-out (all-from-out racket/pretty)
pretty-print)
(rename-out [pretty-write pretty-print]))

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1,12 +1,12 @@
#lang scribble/doc
@(require scribble/manual)
@title{@bold{DrScheme}: PLT Programming Environment}
@title{@bold{DrRacket}: Programming Environment}
@author["Robert Bruce Findler" "PLT"]
DrScheme is a graphical environment for developing programs using the
PLT Scheme programming languages.
DrRacket is a graphical environment for developing programs using the
Racket programming languages.
@table-of-contents[]

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -2,16 +2,16 @@
@(require "common.ss"
(for-label compiler/cm))
@title[#:tag "extending-drscheme"]{Extending DrScheme}
@title[#:tag "extending-drracket"]{Extending DrRacket}
DrScheme supports two forms of extension to the programming
DrRacket supports two forms of extension to the programming
environment:
@itemize[
@item{@index['("languages" "extending")]{@index['("DrScheme
@item{@index['("languages" "extending")]{@index['("DrRacket
Teachpacks")]{A @deftech{teachpack}}} extends the set of procedures
that are built into a language in DrScheme. For example, a
that are built into a language in DrRacket. For example, a
teachpack might extend the Beginning Student language with a
procedure for playing sounds.
@ -24,7 +24,7 @@ DrScheme supports two forms of extension to the programming
See @secref["teachpacks"] for information in creating teachpacks.}
@item{A @deftech{tool} extends the set of utilities within the
DrScheme environment. For example, DrScheme's @onscreen{Check
DrRacket environment. For example, DrRacket's @onscreen{Check
Syntax} button starts a syntax-checking tool. For information on
creating @tech{tools}, see @other-manual['(lib
"scribblings/tools/tools.scrbl")].}
@ -56,8 +56,8 @@ the students to implement the interesting part of this exercise and
still be able to enjoy today's graphics without the useless
memorization.
A single Scheme source file defines a teachpack (although the file may
access other files via @scheme[require]). The file must contain a
A single Racket source file defines a teachpack (although the file may
access other files via @racket[require]). The file must contain a
module (see @secref[#:doc '(lib "scribblings/guide/guide.scrbl")
"modules"]). Each exported syntax definition or value definition from
the module is provided as a new primitive form or primitive operation
@ -67,8 +67,8 @@ As an example, the following teachpack provides a lazy cons
implementation. To test it, be sure to save it in a file named
@filepath{lazycons.ss}.
@schememod[
scheme
@racketmod[
racket
(provide (rename-out [:lcons lcons]) lcar lcdr)
@ -87,7 +87,7 @@ scheme
Then, in this program:
@schemeblock[
@racketblock[
(define (lmap f l)
(lcons
(f (lcar l))
@ -96,7 +96,7 @@ Then, in this program:
(define all-nums (lcons 1 (lmap add1 all-nums)))
]
the list @scheme[all-nums] is bound to an infinite list
the list @racket[all-nums] is bound to an infinite list
of ascending numbers.
For more examples, see the @filepath{htdp} sub-collection in the
@ -106,53 +106,53 @@ For more examples, see the @filepath{htdp} sub-collection in the
@section[#:tag "environment-variables"]{Environment Variables}
Several environment variables can affect DrScheme's behavior:
Several environment variables can affect DrRacket's behavior:
@itemize[
@item{@indexed-envvar{PLTNOTOOLS} : When this environment variable is
set, DrScheme doesn't load any tools.}
set, DrRacket doesn't load any tools.}
@item{@indexed-envvar{PLTONLYTOOL} : When this environment variable
is set, DrScheme only loads the tools in the collection named
is set, DrRacket only loads the tools in the collection named
by the value of the environment variable. If the variable is
bound to a parenthesized list of collections, only the tools in
those collections are loaded (The contents of the environment
variable are @scheme[read] and expected to be a single symbol
variable are @racket[read] and expected to be a single symbol
or a list of symbols).}
@item{@indexed-envvar{PLTDRCM} : When this environment variable is
set, DrScheme installs the compilation manager before starting
set, DrRacket installs the compilation manager before starting
up, which means that the @filepath{.zo} files are automatically
kept up to date, as DrScheme's (or a tools) source is modified.
kept up to date, as DrRacket's (or a tools) source is modified.
If the variable is set to @litchar{trace} then the compilation
manager's output is traced, using the
@scheme[manager-trace-handler] procedure.}
@racket[manager-trace-handler] procedure.}
@item{@indexed-envvar{PLTDRDEBUG} : When this environment variable is
set, DrScheme starts up with errortrace enabled. If the
variable is set to @litchar{profile}, DrScheme also records
set, DrRacket starts up with errortrace enabled. If the
variable is set to @litchar{profile}, DrRacket also records
profiling information about itself.}
@item{@indexed-envvar{PLTDRPROFILE} : When this environment variable is
set, DrScheme uses the @schememodname[profile] library (with
set, DrRacket uses the @racketmodname[profile] library (with
a little GUI) to collect profiling information about itself.}
@item{@indexed-envvar{PLTDRBREAK} : When this environment variable is
set, DrScheme creates a window with a break button, during
startup. Clicking the button breaks DrScheme's eventspace's
set, DrRacket creates a window with a break button, during
startup. Clicking the button breaks DrRacket's eventspace's
main thread. This works well in combination with
@envvar{PLTDRDEBUG} since the source locations are reported for
the breaks.}
@item{@indexed-envvar{PLTDRTESTS} : When this environment variable is
set, DrScheme installs a special button in the button bar that
set, DrRacket installs a special button in the button bar that
starts the test suite. (The test suite is available only in the
source distribution.)}
@item{@indexed-envvar{PLTSTRINGCONSTANTS} : When this environment
variable is set, DrScheme prints out the string constants that
variable is set, DrRacket prints out the string constants that
have not yet been translated. If it is set to a particular
language (corresponding to one of the files in
@filepath{string-constants} collection) it only shows the unset

View File

@ -1,22 +1,23 @@
#lang scribble/doc
@(require "common.ss")
@title[#:tag "drscheme-files"]{DrScheme Files}
@title[#:tag "drracket-files"]{DrRacket Files}
@; ----------------------------------------
@section[#:tag "drscheme-file-formats"]{Program Files}
@section[#:tag "drracket-file-formats"]{Program Files}
The standard @as-index{file extension} for a PLT Scheme program file
is @indexed-file{.ss}. The extensions @indexed-file{.scm} and
@indexed-file{.sch} are also popular.
The standard @as-index{file extension} for a Racket program file is
@indexed-file{.rkt}. The extensions @indexed-file{.ss},
@indexed-file{.scm}, and @indexed-file{.sch} are also historically
popular.
DrScheme's editor can save a program file in two different formats:
DrRacket's editor can save a program file in two different formats:
@itemize[
@item{@deftech{Plain-text file format} --- All text editors can read
this format. DrScheme saves a program in plain-text format by
this format. DrRacket saves a program in plain-text format by
default, unless the program contains images or text boxes.
(Plain-text format does not preserve images or text boxes.)
@ -26,7 +27,7 @@ DrScheme's editor can save a program file in two different formats:
transfer mode that adjusts newlines correctly.}
@item{@deftech{Multimedia file format} --- This format is specific to
DrScheme, and no other editor recognizes it. DrScheme saves a
DrRacket, and no other editor recognizes it. DrRacket saves a
program in multimedia format by default when the program
contains images, text boxes, or formatted text.
@ -38,9 +39,9 @@ DrScheme's editor can save a program file in two different formats:
@; ----------------------------------------
@section[#:tag "drscheme-autosave-files"]{Backup and Autosave Files}
@section[#:tag "drracket-autosave-files"]{Backup and Autosave Files}
When you modify an existing file in DrScheme and save it, DrScheme
When you modify an existing file in DrRacket and save it, DrRacket
copies the old version of the file to a special backup file if no
backup file exists. The backup file is saved in the same directory as
the original file, and the backup file's name is generated from the
@ -56,10 +57,10 @@ original file's name:
]
Every five minutes, DrScheme checks each open file. If any file is
modified and not saved, DrScheme saves the file to a special autosave
Every five minutes, DrRacket checks each open file. If any file is
modified and not saved, DrRacket saves the file to a special autosave
file (just in case there is a power failure or some other catastrophic
error). If the file is later saved, or if the user exists DrScheme
error). If the file is later saved, or if the user exists DrRacket
without saving the file, the autosave file is removed. The autosave
file is saved in the same directory as the original file, and the
autosave file's name is generated from the original file's name:
@ -80,52 +81,52 @@ autosave file's name is generated from the original file's name:
If the definitions window is modified and there is no current file,
then an autosave file is written to the user's ``documents''
directory. @margin-note{The ``documents'' directory is determined by
@scheme[(find-system-path 'doc-dir)].}
@racket[(find-system-path 'doc-dir)].}
@; ----------------------------------------
@section{Preference Files}
On start-up, DrScheme reads configuration information from a
On start-up, DrRacket reads configuration information from a
preferences file. The name and location of the preferences file
depends on the platform and user:
@margin-note{The expression @scheme[(find-system-path 'pref-file)]
@margin-note{The expression @racket[(find-system-path 'pref-file)]
returns the platform- and user-specific preference file path.}
@itemize[
@item{Under Unix, preferences are stored in a
@indexed-file{.plt-scheme} subdirectory in the user's home
directory, in a file @indexed-file{plt-prefs.ss}.}
@indexed-file{.racket} subdirectory in the user's home
directory, in a file @indexed-file{racket-prefs.rktd}.}
@item{Under Windows, preferences are stored in a file
@indexed-file{plt-prefs.ss} in a sub-directory @indexed-file{PLT
Scheme} in the user's application-data folder as specified by the
Windows registry; the application-data folder is usually
@indexed-file{Application Data} in the user's profile directory, and
that directory is usually hidden in the Windows GUI.}
@indexed-file{racket-prefs.rktd} in a sub-directory
@indexed-file{Racket} in the user's application-data folder as
specified by the Windows registry; the application-data folder is
usually @indexed-file{Application Data} in the user's profile
directory, and that directory is usually hidden in the Windows GUI.}
@item{Under Mac OS X, preferences are stored in
@indexed-file{org.plt-scheme.prefs.ss} in the user's preferences
@indexed-file{org.racket-lang.prefs.rktd} in the user's preferences
folder.}
]
A lock file is used while modifying the preferences file, and it is
created in the same directory as the preferences file. Under Windows,
the lock file is named @indexed-file{_LOCKplt-prefs.ss}; under Unix,
it is @indexed-file{.LOCK.plt-prefs.ss}; under Mac OS X, it is
@indexed-file{.LOCK.org.plt-scheme.prefs.ss}.
the lock file is named @indexed-file{_LOCKracket-prefs.rktd}; under Unix,
it is @indexed-file{.LOCK.racket-prefs.rktd}; under Mac OS X, it is
@indexed-file{.LOCK.org.racket-lang.prefs.rktd}.
If the user-specific preferences file does not exist, and the file
@indexed-file{plt-prefs.ss} in the @filepath{defaults} collection does
exist, then it is used for the initial preference settings. (See
@indexed-file{racket-prefs.rktd} in the @filepath{defaults} collection
does exist, then it is used for the initial preference settings. (See
@secref[#:doc '(lib "scribblings/reference/reference.scrbl")
"collects"] for more information about collections.) This file thus
allows site-specific configuration for preference defaults. To set up
such a configuration, start DrScheme and configure the preferences to
your liking. Then, exit DrScheme and copy your preferences file into
such a configuration, start DrRacket and configure the preferences to
your liking. Then, exit DrRacket and copy your preferences file into
the @filepath{defaults} collection as
@filepath{plt-prefs.ss}. Afterward, users who have no preference
@filepath{racket-prefs.rktd}. Afterward, users who have no preference
settings already will get the preference settings that you chose.

View File

@ -0,0 +1,3 @@
#lang setup/infotab
(define scribblings '(("drracket.scrbl" (multi-page) (tool 100))))

View File

@ -3,9 +3,9 @@
scribble/decode
scribble/eval
scribble/struct
scribble/scheme
scribble/racket
(for-label htdp/convert
scheme/gui/base))
racket/gui/base))
@(define (ioinputfont . s)
(apply tt s))
@ -14,35 +14,35 @@
@title[#:tag "interface-essentials" #:style 'toc]{Interface Essentials}
The DrScheme window has three parts: a row of buttons at the top, two
The DrRacket window has three parts: a row of buttons at the top, two
editing panels in the middle, and a status line at the bottom.
@centerline{@image[#:scale 0.7 "example.png"]}
The top editing panel, called the @deftech{definitions window}, is for
defining programs. The above figure shows a program that defines the
function @scheme[square].
function @racket[square].
The bottom panel, called the @deftech{interactions window}, is for
evaluating Scheme expressions interactively. The @onscreen{Language} line
evaluating Racket expressions interactively. The @onscreen{Language} line
in the interactions window indicates which primitives are available in
the definitions and interactions windows. In the above figure, the
language is @drlang{Module}.
language is determined from the program source's @hash-lang[] line.
@margin-note{The interactions window is described further in
@secref["interactions-window"], later in this manual.}
Clicking the @onscreen{Run} button evaluates the program in the
definitions window, making the program's definitions available in the
interactions window. Given the definition of @scheme[square] as in the
figure above, typing @scheme[(square 2)] in the interactions window
produces the result @scheme[4].
interactions window. Given the definition of @racket[square] as in the
figure above, typing @racket[(square 2)] in the interactions window
produces the result @racket[4].
The @deftech{status line} at the bottom of DrScheme's window provides
The @deftech{status line} at the bottom of DrRacket's window provides
information about the current line and position of the editing caret,
whether the current file can be modified, and whether DrScheme is
whether the current file can be modified, and whether DrRacket is
currently evaluating any expression. The @as-index{recycling icon}
flashes while DrScheme is ``recycling'' internal resources, such as
flashes while DrRacket is ``recycling'' internal resources, such as
memory.
@local-table-of-contents[]
@ -51,7 +51,7 @@ memory.
@section[#:tag "buttons"]{Buttons}
The left end of the row of buttons in DrScheme contains a miniature
The left end of the row of buttons in DrRacket contains a miniature
button with the @index['("filename button")]{current file's
name}. Clicking the button opens a menu that shows the file's full
pathname. Selecting one of the menu entries produces an open-file
@ -74,8 +74,8 @@ The @as-index{@onscreen{Step} button}---which appears only for the
@as-index{Stepper}, which shows the evaluation of a program as a
series of small steps. Each evaluation step replaces an expression in
the program with an equivalent one using the evaluation rules of
DrScheme. For example, a step might replace @scheme[(+ 1 2)] with
@scheme[3]. These are the same rules used by DrScheme to evaluate a
DrRacket. For example, a step might replace @racket[(+ 1 2)] with
@racket[3]. These are the same rules used by DrRacket to evaluate a
program. Clicking @onscreen{Step} opens a new window that contains
the program from the definitions window, plus several new buttons:
these buttons allow navigation of the evaluation as a series of steps.
@ -103,16 +103,16 @@ annotations:
@item{@bold{Lexical Structure:} The lexical structure is shown with
arrows overlaid on the program text. When the mouse cursor
passes over a variable, DrScheme draws an arrow from the
passes over a variable, DrRacket draws an arrow from the
binding location to the variable, or from the binding location
to every bound occurrence of the variable.
@index['("Check syntax" "purple arrows")]{@index['("Check
syntax" "question-mark arrows")]{In}} addition to indicating
definite references with blue arrows, DrScheme also draws
definite references with blue arrows, DrRacket also draws
arrows to indicate potential references within macro
definitions. Potential arrows are drawn in purple and annotated
with a question mark to indicate uncertainty, because DrScheme
with a question mark to indicate uncertainty, because DrRacket
cannot predict how such identifiers will eventually be
used. Their roles may depend on the arguments to the macro and
the context the macro is used in.
@ -131,12 +131,12 @@ annotations:
@item{@bold{Require Annotations:} Right-clicking (or
Control-clicking under Mac OS X) on the argument to
@scheme[require] activates a popup menu that lets you open the
file that contains the @scheme[require]d module.
@racket[require] activates a popup menu that lets you open the
file that contains the @racket[require]d module.
Passing the mouse cursor over a @scheme[require] expression
Passing the mouse cursor over a @racket[require] expression
inside a module shows all of the variables that are used from
that @scheme[require] expression. Additionally, if no
that @racket[require] expression. Additionally, if no
variables are used from that require expression, it is colored
like an unbound variable.
@ -150,7 +150,7 @@ The @as-index{@onscreen{Run} button} evaluates the program in the
@tech{definitions window} and resets the @tech{interactions window}.
The @as-index{@onscreen{Break} button} interrupts an evaluation, or
beeps if DrScheme is not evaluating anything. For example, after
beeps if DrRacket is not evaluating anything. For example, after
clicking @onscreen{Run} or entering an expression into the
interactions window, click @onscreen{Break} to cancel the
evaluation. Click the @onscreen{Break} button once to try to interrupt
@ -163,27 +163,28 @@ evaluation immediately.
@section-index["language levels"]
DrScheme supports multiple dialects of Scheme, as well as some
non-Scheme languages. You specify a language in one of two ways:
DrRacket supports multiple dialects of Racket, as well as some
non-Racket languages. You specify a language in one of two ways:
@itemize[
@item{Select the @drlang{Module} language (via the
@menuitem["Language" "Choose Language..."] menu item), and then
specify a specific language as part of the program usually by
starting the definitions-window content with @hash-lang[].}
@item{Select the @drlang{Use the language declared in the source}
option (via the @menuitem["Language" "Choose Language..."] menu
item), and then specify a specific language as part of the
program usually by starting the definitions-window content with
@hash-lang[].}
@item{Select the @menuitem["Language" "Choose Language..."] menu
item, and choose a language other than @drlang{Module}. After
changing the language, click @onscreen{Run} to reset the
language in the interactions window. The bottom-left corner of
DrScheme's main window also has a shortcut menu item for
selecting previously selected languages.}
item, and choose a specific language. After changing the
language, click @onscreen{Run} to reset the language in the
interactions window. The bottom-left corner of DrRacket's main
window also has a shortcut menu item for selecting previously
selected languages.}
]
The former method, @drlang{Module} with @hash-lang[], is the recommend
mode, and it is described further in @secref["module"].
Using a language declared in a program's source is the recommend mode,
and it is described further in @secref["module"].
The @menuitem["Language" "Choose Language..."] dialog contains a
@onscreen{Show Details} button for configuring certain details of the
@ -192,68 +193,68 @@ default language specification, a @onscreen{Custom} indicator appears
next to the language-selection control at the top of the dialog.
See @secref["languages"] (later in this manual) for more information
on the languages that DrScheme supports.
on the languages that DrRacket supports.
@; ----------------------------------------------------------------------
@section[#:tag "editor"]{Editing with Parentheses}
@index['("flashing parenthesis matches")]{@index['("gray highlight
regions")]{In}} Scheme mode, especially, DrScheme's editor provides
regions")]{In}} Racket mode, especially, DrRacket's editor provides
special support for managing parentheses in a program. When the
blinking caret is next to a parenthesis, DrScheme shades the region
blinking caret is next to a parenthesis, DrRacket shades the region
between the parenthesis and its matching parenthesis. This feature is
especially helpful when for balancing parentheses to complete an
expression.
@index['("formatting Scheme code")]{@index['("indenting Scheme
code")]{Although}} whitespace is not significant in Scheme, DrScheme
encourages a particular format for Scheme code. When you type Enter or
@index['("formatting Racket code")]{@index['("indenting Racket
code")]{Although}} whitespace is not significant in Racket, DrRacket
encourages a particular format for Racket code. When you type Enter or
Return, the editor inserts a new line and automatically indents it. To
make DrScheme re-indent an existing line, move the blinking caret to
make DrRacket re-indent an existing line, move the blinking caret to
the line and hit the Tab key. (The caret can be anywhere in the line.)
You can re-indent an entire region by selecting the region and typing
Tab.
@index['("changing a parenthesis as you type")]{@index['("automatic
parenthesis")]{DrScheme}} also rewrites parenthesis as you type them,
parenthesis")]{DrRacket}} also rewrites parenthesis as you type them,
in order to make them match better. If you type a closing parenthesis
@litchar{)}, a closing square bracket @litchar{]}, or a closing curley brace
@litchar["}"], and if DrScheme can match it back to some earlier opening
parenthesis, bracket, or brace, then DrScheme changes what you type to
match. DrScheme also rewrites open square brackets, usually to an
@litchar["}"], and if DrRacket can match it back to some earlier opening
parenthesis, bracket, or brace, then DrRacket changes what you type to
match. DrRacket also rewrites open square brackets, usually to an
open parenthesis. There are some exceptions where opening square
brackets are not automatically changed to parentheses:
@itemize[
@item{If the square bracket is after @scheme[cond]-like keyword,
@item{If the square bracket is after @racket[cond]-like keyword,
potentially skipping some of the sub-expressions in the
@scheme[cond]-like expression (for example, in a @scheme[case]
@racket[cond]-like expression (for example, in a @racket[case]
expression, the square brackets start in the second
sub-expression).}
@item{If the square bracket begins a new expression immediately after
a @scheme[local]-like keyword. Note that the second expression
after a @scheme[local]-like keyword will automatically become
a @racket[local]-like keyword. Note that the second expression
after a @racket[local]-like keyword will automatically become
an ordinary parenthesis.}
@item{If the square bracket is after a parenthesis that is after a
@scheme[letrec]-like keyword,}
@racket[letrec]-like keyword,}
@item{If the square bracket is in a sequence and the s-expression
before in the sequence is a compound expression, DrScheme uses
before in the sequence is a compound expression, DrRacket uses
the same kind parenthesis, brace, or bracket as before, or}
@item{If the square bracket is in the middle of string,
comment, character, or symbol.}
]
The upshot of DrScheme's help is that you can always use the
The upshot of DrRacket's help is that you can always use the
(presumably unshifted) square brackets on your keyboard to type
parenthesis. For example, when typing
@schemeblock[
@racketblock[
(define (length l)
(cond
[(empty? l) 0]
@ -261,26 +262,26 @@ parenthesis. For example, when typing
]
If you always type @litchar{[} and @litchar{]} where any of the square
brackets or parentheses appear, DrScheme will change the square
brackets or parentheses appear, DrRacket will change the square
brackets to match the code above.
Of course, these features can be disabled and customized in the
preferences dialog; see @secref["prefs-explanation"]. Also, in case
DrScheme does not produce the character you want, holding down the
control key while typing disables DrScheme's parenthesis, brace, and
DrRacket does not produce the character you want, holding down the
control key while typing disables DrRacket's parenthesis, brace, and
bracket converter.
@; -------------------------------
@section{Searching}
DrScheme's search and replace feature is interactive,
DrRacket's search and replace feature is interactive,
similar to those in Safari, Firefox, and Emacs, but with a
few differences.
To start a search, first select the @onscreen{Find} menu
item from the @onscreen{Edit} menu. This will open a small
editor at the bottom of the DrScheme window. Start typing in
editor at the bottom of the DrRacket window. Start typing in
there and, as you type, all occurrences of the string you're
searching for will be circled in the editor window. Watch
the space right next to the search window to see how many
@ -292,17 +293,17 @@ string. This will color in one of the circles. Use
occurrence.
If you click back into the definitions window, the
@onscreen{Find Again} menu item, DrScheme will move the
@onscreen{Find Again} menu item, DrRacket will move the
selection to the next occurrence of the search string.
DrScheme also supports a mode where typing in the search
DrRacket also supports a mode where typing in the search
editor takes you directly to the next occurrence of the
search string, without selecting the @onscreen{Find Again}
menu item. In the preference dialog, in the
@onscreen{Editing} sectino and then in the
@onscreen{General} section is a checkbox labelled
@onscreen{Search using anchors}. When it is checked,
DrScheme shows a little red dot and a red line indicating
DrRacket shows a little red dot and a red line indicating
where the @deftech{search anchor} is. When the search anchor
is enabled, typing in the search window jumps to the first
occurrence of the search string after the anchor.
@ -311,13 +312,13 @@ occurrence of the search string after the anchor.
@section{Tabbed Editing}
DrScheme's allows you to edit multiple files in a single window via
DrRacket's allows you to edit multiple files in a single window via
tabs. The @menuitem["File" "New Tab"] menu item creates a new tab to
show a new file. Each tab has its own interactions window.
In the @onscreen{General} sub-pane of the @onscreen{Editing} pane in
the preferences window, a checkbox labelled @onscreen{Open files in
separate tabs} causes DrScheme to open files in new tabs in the
separate tabs} causes DrRacket to open files in new tabs in the
frontmost window, rather than opening a new window for the file.
The key bindings Control-Pageup and Control-Pagedown move between
@ -335,15 +336,15 @@ last @tt{>} prompt. To enter an expression, the blinking caret must
appear after the last prompt, and also after the space following the
prompt.
When you type a complete expression and hit Enter or Return, DrScheme
When you type a complete expression and hit Enter or Return, DrRacket
evaluates the expression and prints the result. After printing the
result, DrScheme creates a new prompt for another expression. Some
expressions return a special ``void'' value; DrScheme never prints
result, DrRacket creates a new prompt for another expression. Some
expressions return a special ``void'' value; DrRacket never prints
void, but instead produces a new prompt immediately.
If the expression following the current prompt is incomplete, then
DrScheme will not try to evaluate it. In that case, hitting Enter or
Return produces a new, auto-indented line. You can force DrScheme to
DrRacket will not try to evaluate it. In that case, hitting Enter or
Return produces a new, auto-indented line. You can force DrRacket to
evaluate the expression by typing Alt-Return or Command-Return
(depending on your platform).
@ -364,17 +365,17 @@ retrieve old expressions.
@subsection{Errors}
@index['("error highlighting")]{Whenever} DrScheme encounters an error
@index['("error highlighting")]{Whenever} DrRacket encounters an error
while evaluating an expression, it prints an error message in the
interactions window and highlights the expression that triggered the
error. The highlighted expression might be in the definitions window,
or it might be after an old prompt in the interactions window.
For certain kinds of errors, DrScheme turns a portion of the error
For certain kinds of errors, DrRacket turns a portion of the error
message into a hyperlink. Click the hyperlink to get help regarding a
function or keyword related to the error.
For some run-time errors, DrScheme shows a bug icon next to the error
For some run-time errors, DrRacket shows a bug icon next to the error
message. Click the bug icon to open a window that shows a ``stack'' of
expressions that were being evaluated at the time of the error. In
addition, if the expressions in the stack appear in the
@ -387,19 +388,19 @@ from the next deeper one in the stack.
@section-index["I/O"]
Many Scheme programs avoid explicit input and output operations,
Many Racket programs avoid explicit input and output operations,
obtaining input via direct function calls in the @tech{interactions
window}, and producing output by returning values. Other Scheme
window}, and producing output by returning values. Other Racket
programs explicitly print output for the user during evaluation using
@as-index{@scheme[write]} or @as-index{@scheme[display]}, or
explicitly request input from the user using @as-index{@scheme[read]}
or @as-index{@scheme[read-char]}.
@as-index{@racket[write]} or @as-index{@racket[display]}, or
explicitly request input from the user using @as-index{@racket[read]}
or @as-index{@racket[read-char]}.
Explicit input and output appear in the @tech{interactions window},
but within special boxes that separate explicit I/O from normal
expressions and results. For example, evaluating
@schemeblock[
@racketblock[
@#,tt{>} (read)
]
@ -408,61 +409,61 @@ in the interactions window produces a special box for entering input:
@centerline{@image[#:scale 0.6 "io.png"]}
Type a number into the box and hit Enter, and that number becomes the
result of the @scheme[(read)] expression. Once text is submitted for
an input box, it is moved outside the input box, and when DrScheme
result of the @racket[(read)] expression. Once text is submitted for
an input box, it is moved outside the input box, and when DrRacket
shows a new prompt, it hides the interaction box. Thus, if you type
@scheme[5] in the above input box and hit Return, the result appears
@racket[5] in the above input box and hit Return, the result appears
as follows:
@schemeblock[
@racketblock[
@#,tt{>} (read)
@#,ioinputfont{5}
@#,schemeresult[5]
@#,racketresult[5]
@#,tt{>} @#,tt{_}
]
In this case, the first @ioinputfont{5} is the input, and the second
@schemeresult[5] is the result of the @scheme[(read)] expression. The
second @schemeresult[5] is colored blue, as usual for a result printed
by DrScheme. (The underscore indicates the location of the blinking
@racketresult[5] is the result of the @racket[(read)] expression. The
second @racketresult[5] is colored blue, as usual for a result printed
by DrRacket. (The underscore indicates the location of the blinking
caret.)
Output goes into the @tech{interactions window} directly. If you run
the program
@schememod[
scheme
@racketmod[
racket
(define v (read))
(display v) (newline)
v
]
and provide the input S-expression @scheme[(1 2)], the interactions
and provide the input S-expression @racket[(1 2)], the interactions
window ultimately appears as follows:
@schemeblock[
@racketblock[
@#,ioinputfont{(1 2)}
@#,iooutputfont{(1 2)}
@#,schemeresult[(1 2)]
@#,racketresult[(1 2)]
@#,tt{>} @#,tt{_}
]
In this example, @scheme[display] produces output immediately beneath
In this example, @racket[display] produces output immediately beneath
the input you typed, and the final result is printed last. The
displayed output is drawn in purple. (The above example assumes
default printing. With constructor-style value printing, the final
before the prompt would be @scheme[(list 1 2)].)
before the prompt would be @racket[(list 1 2)].)
Entering the same program line-by-line in the interactions window
produces a different-looking result:
@schemeblock[
@racketblock[
@#,tt{>} (define v (read))
@#,ioinputfont{(1 2)}
@#,tt{>} (display v)
@#,iooutputfont{(1 2)}
@#,tt{>} v
@#,schemeresult[(1 2)]
@#,racketresult[(1 2)]
@#,tt{>} @#,tt{_}
]
@ -470,65 +471,65 @@ Depending on the input operation, you may enter more text into an
input box than is consumed. In that case, the leftover text remains in
the input stream for later reads. For example, in the following
interaction, two values are provided in response to the first
@scheme[(read)], so the second value is returned immediately for the
second @scheme[(read)]:
@racket[(read)], so the second value is returned immediately for the
second @racket[(read)]:
@schemeblock[
@racketblock[
@#,tt{>} (read)
@#,ioinputfont{5 6}
@#,schemeresult[5]
@#,racketresult[5]
@#,tt{>} (read)
@#,schemeresult[6]
@#,racketresult[6]
@#,tt{>} @#,tt{_}
]
The following example illustrates that submitting input with Return
inserts a newline character into the input stream:
@schemeblock[
@racketblock[
@#,tt{>} (read)
@#,ioinputfont{5}
@#,schemeresult[5]
@#,racketresult[5]
@#,tt{>} (read-char)
@#,schemeresult[#\newline]
@#,racketresult[#\newline]
@#,tt{>} @#,tt{_}
]
Within a @scheme[@#,hash-lang[] @#,schememodname[scheme]] module,
Within a @racket[@#,hash-lang[] @#,racketmodname[racket]] module,
the results of top-level expression print the same as the results of
an expression entered in the @tech{interactions window}. The reason is
that @scheme[@#,hash-lang[] @#,schememodname[scheme]] explicitly
that @racket[@#,hash-lang[] @#,racketmodname[racket]] explicitly
prints the results of top-level expressions using
@scheme[(current-print)], and DrScheme sets @scheme[(current-print)]
@racket[(current-print)], and DrRacket sets @racket[(current-print)]
to print values in the same way as for interactions.
@; ----------------------------------------------------------------------
@section{Graphical Syntax}
In addition to normal textual program, DrScheme supports certain
In addition to normal textual program, DrRacket supports certain
graphical elements as expressions within a program. Plug-in tools can
extend the available graphical syntax, but this section describes some
of the more commonly used elements.
@subsection{Images}
DrScheme's @menuitem["Insert" "Insert Image..."] menu item lets you
DrRacket's @menuitem["Insert" "Insert Image..."] menu item lets you
select an image file from disk (in various formats such as GIF, PNG,
and BMP), and the image is inserted at the current editing caret.
As an expression an image behaves like a number or string constant: it
evaluates to itself. DrScheme's @tech{interactions window} knows how
to draw image-value results or images displayed via @scheme[print].
evaluates to itself. DrRacket's @tech{interactions window} knows how
to draw image-value results or images displayed via @racket[print].
A program can manipulate image values in various ways, such as using
the @scheme[htdp/image] library or as an
@scheme[image-snip%] value.
the @racket[htdp/image] library or as an
@racket[image-snip%] value.
@subsection[#:tag "xml-boxes"]{XML Boxes and Scheme Boxes}
@subsection[#:tag "xml-boxes"]{XML Boxes and Racket Boxes}
DrScheme has special support for XML concrete syntax. The
DrRacket has special support for XML concrete syntax. The
@menuitem["Special" "Insert XML Box"] menu item inserts an embedded
editor into your program. In that embedded editor, you type XML's
concrete syntax. When a program containing an XML box is evaluated,
@ -546,24 +547,25 @@ right-clicking or Control-clicking (Mac OS X) on the top portion of
the XML box.
In addition to containing XML text, XML boxes can also
contain Scheme boxes. Scheme boxes contain Scheme
contain Racket boxes. Racket boxes contain Racket
expressions. These expressions are evaluated and their
contents are placed into the containing XML box's xexpr.
There are two varieties of Scheme box: the standard Scheme
box and the splicing Scheme box. The standard Scheme box
There are two varieties of Racket box: the standard Racket
box and the splicing Racket box. The standard Racket box
inserts its value into the containing xexpr. The contents of
the splice box must evaluate to a list and the elements of
the list are ``flattened'' into the containing xexpr.
Right-clicking or control-clicking (Mac OS X) on the top of a Scheme
box opens a menu to toggle the box between a Scheme box and
a Scheme splice box.
Right-clicking or control-clicking (Mac OS X) on the top of a Racket
box opens a menu to toggle the box between a Racket box and
a Racket splice box.
@; ----------------------------------------------------------------------
@section[#:tag "debugger"]{Graphical Debugging Interface}
@bold{Tip:} Changing the name of a file in the middle of a debugging
session will prevent the debugger from working properly on that file.
@margin-note{@bold{Tip:} Changing the name of a file in the middle of
a debugging session will prevent the debugger from working properly on
that file.}
Like the @onscreen{Run} button, the @as-index{@onscreen{Debug} button}
runs the program in the definitions window. However, instead of
@ -631,17 +633,17 @@ breakpoint at that location; the latter sets a one-time breakpoint and
resumes execution. An ordinary breakpoint appears as a red circle,
and a one-time breakpoint appears as a yellow circle.
@bold{Tip:} If the debugged program is not in the @onscreen{Module}
language, then the @italic{first time} it is debugged, breakpoints
will only become available in expressions as they are evaluated.
However, the next time the program is debugged, the debugger will
remember the set of breakable locations from the previous session.
@bold{Tip:} If the debugged program is not a module, then the
@italic{first time} it is debugged, breakpoints will only become
available in expressions as they are evaluated. However, the next
time the program is debugged, the debugger will remember the set of
breakable locations from the previous session.
@bold{Tip:} Clicking the @onscreen{Run} button after a debugging
session will cause all breakpoints to disappear from the definitions
window. These breakpoints are not forgotten, and clicking
@onscreen{Debug} again will restore them. However, breakpoints do
@italic{not} persist across restarts of DrScheme.}
@italic{not} persist across restarts of DrRacket.}
@item{If execution is paused at the start of an expression, then
right-clicking or control-clicking (Mac OS X) on the green triangle
@ -671,7 +673,7 @@ enter a new value for the variable.}
@subsection{Stack View Pane}
In addition, while execution is paused, the stack view pane at the
right of the DrScheme frame is active. The top of the pane shows a
right of the DrRacket frame is active. The top of the pane shows a
list of active stack frames. Mousing over a frame produces a faint
green highlighting of the corresponding expression. Clicking on the
frame selects that frame, which makes its lexical variables visible.
@ -681,10 +683,10 @@ The bottom of the pane shows the lexical variables in the selected
stack frame.
The following screenshot illustrates several aspects of the debugger
interface. The red circle before the @scheme[if] is a breakpoint,
and the green triangle at the end of the @scheme[(fact (sub1 n))] is where
interface. The red circle before the @racket[if] is a breakpoint,
and the green triangle at the end of the @racket[(fact (sub1 n))] is where
execution is currently paused. The expression's return value is
displayed at the left of the button bar, and the value of @scheme[n]
displayed at the left of the button bar, and the value of @racket[n]
is displayed in the stack view pane.
@centerline{@image[#:scale 0.5 "debugger1.png"]}
@ -692,7 +694,7 @@ is displayed in the stack view pane.
@subsection{Debugging Multiple Files}
To debug a program that spans several files, make sure that all of the
files are open in DrScheme. Click the @onscreen{Debug} button in the
files are open in DrRacket. Click the @onscreen{Debug} button in the
window containing the main program. As this program loads additional
files that are present in other windows or tabs, message boxes will
pop up asking whether or not to include the file in the debugging
@ -710,7 +712,7 @@ file cannot be included in another debugging session.
The module browser shows you the structure of all of the files in your program.
It can be opened via the @onscreen{Show} menu, or via the @onscreen{Module Browser ...}
menu item in the @onscreen{Scheme} menu.
menu item in the @onscreen{Racket} menu.
A module browser window contains a square for each
module. The squares are colored based on the number of
@ -730,13 +732,13 @@ A module browser window contains a square for each
The module browser will also show you the phases that each
module is loaded in; choose the ``Long, with phases'' menu item
in the ``Names'' popup menu. The integers indicate the phases and
if @scheme[#f] is present, it means the module is loaded @scheme[for-label].
if @racket[#f] is present, it means the module is loaded @racket[for-label].
@section[#:tag "create-exe"]{Creating Executables}
DrScheme's @onscreen{Create Executable...} menu item lets you create
DrRacket's @onscreen{Create Executable...} menu item lets you create
an executable for your program that you can start without first
starting DrScheme. To create an executable, first save your program to
starting DrRacket. To create an executable, first save your program to
a file and set the language and teachpacks. Click @onscreen{Run},
just to make sure that the program is working as you expect. The
executable you create will not have a read-eval-print-loop, so be sure
@ -744,7 +746,7 @@ to have an expression that starts your program running in the
definitions window before creating the executable.
Once you are satisfied with your program, choose the @onscreen{Create
Executable...} menu item from the @onscreen{Scheme} menu. You will be
Executable...} menu item from the @onscreen{Racket} menu. You will be
asked to choose an executable file name or an archive file name. In
the latter case, unpack the generated archive (on this machine or
another one) to access the executable. In either case, you will be
@ -754,7 +756,7 @@ program on your computer.
The result of @onscreen{Create Executable...} is either a
@defterm{launcher executable}, a @defterm{stand-alone executable}, or
a @defterm{distribution archive}, and it uses either a
@defterm{MzScheme} (textual) or @defterm{MrEd} (graphical) engine.
@defterm{Racket} (textual) or @defterm{GRacket} (graphical) engine.
For programs implemented with certain languages, @onscreen{Create
Executable...} will prompt you to choose the executable type and
engine, while other languages support only one type or engine.
@ -765,14 +767,14 @@ Each type has advantages and disadvantages:
@item{A @deftech{launcher executable} uses the latest version of
your program source file when it starts. It also accesses library
files from your DrScheme installation when it runs. Since a launcher
files from your DrRacket installation when it runs. Since a launcher
executable contains specific paths to access those files, launchers
usually cannot be moved from one machine to another.}
@item{A @deftech{stand-alone executable} embeds a compiled copy of
your program and any Scheme libraries that your program uses. When
your program and any Racket libraries that your program uses. When
the executable is started, it uses the embedded copies and does not
need your original source file. It may, however, access your DrScheme
need your original source file. It may, however, access your DrRacket
installation for DLLs, frameworks, shared libraries, or helper
executables. Consequently, a stand-alone executable usually cannot be
moved from one machine to another.}
@ -785,10 +787,11 @@ Each type has advantages and disadvantages:
]
In general, DrScheme's @drlang{Module} language gives you the most
options. Most other languages only allow one type of executable. The
teaching languages create stand-alone executables in
distributions. The legacy languages create launchers.
In general, DrRacket's gives you the most options when it infers a
language from a program's source. Most other languages only allow one
type of executable. The teaching languages, for example, create
stand-alone executables in distributions. The legacy languages create
only launchers.
@bold{Tip:} Disable debugging in the language dialog before creating
your executable. With debugging enabled, you will see a stack trace

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -2,9 +2,9 @@
@(require "common.ss"
scribble/struct
scribble/bnf
scheme/list
racket/list
mrlib/tex-table
(for-label scheme/gui/base))
(for-label racket/gui/base))
@(define (keybinding key . desc)
(let* ([keys (if (string? key) (list key) key)]
@ -13,8 +13,8 @@
@(define-syntax-rule (def-mod-beg id)
(begin
(require (for-label mzscheme))
(define id @scheme[#%module-begin])))
(require (for-label racket/base))
(define id @racket[#%module-begin])))
@(def-mod-beg mz-mod-begin)
@title{Keyboard Shortcuts}
@ -194,36 +194,36 @@ These are the currently supported macro names and the keys they map into:
The @onscreen{Add User-defined Keybindings...} menu item in the
@onscreen{Keybindings} sub-menu of @onscreen{Edit} selects a file
containing Scheme definitions of keybindings. The file must contain a
containing Racket definitions of keybindings. The file must contain a
module that uses a special keybindings language,
@scheme[framework/keybinding-lang]. To do so, begin your file with
@racket[framework/keybinding-lang]. To do so, begin your file with
this line:
@schememod[
@racketmod[
s-exp framework/keybinding-lang
]
The @scheme[framework/keybinding-lang] languages provides all of the bindings
from @schememodname[scheme], @schememodname[scheme/class], and
@schememodname[drscheme/tool-lib],
The @racket[framework/keybinding-lang] languages provides all of the bindings
from @racketmodname[racket], @racketmodname[racket/class], and
@racketmodname[drscheme/tool-lib],
except that it adjusts @|mz-mod-begin| to
introduce a @schemeidfont{keybinding} form:
introduce a @racketidfont{keybinding} form:
@specform[#:literals (keybindings)
(keybinding string-expr proc-expr)]{
Declares a keybinding, where @scheme[string-expr] must produce a
Declares a keybinding, where @racket[string-expr] must produce a
suitable first argument for @xmethod[keymap% map-function], and the
@scheme[proc-expr] must produce a suitable second argument for
@racket[proc-expr] must produce a suitable second argument for
@xmethod[keymap% add-function].}
For example, this remaps the key combination ``control-a'' key to ``!''.
@schememod[
@racketmod[
s-exp framework/keybinding-lang
(keybinding "c:a" (λ (editor evt) (send editor insert "!")))
]
Note that DrScheme does not reload this file automatically when you
make a change, so you'll need to restart DrScheme to see changes to
Note that DrRacket does not reload this file automatically when you
make a change, so you'll need to restart DrRacket to see changes to
the file.

View File

@ -7,99 +7,99 @@
@title[#:tag "languages" #:style 'toc]{Languages}
This chapter describes some of the languages that are available for
use within DrScheme. The list here is potentially incomplete, because
new languages can be added through DrScheme plug-ins.
use within DrRacket. The list here is potentially incomplete, because
new languages can be added through DrRacket plug-ins.
@local-table-of-contents[]
@; ----------------------------------------
@section[#:tag "module"]{Modules}
@section[#:tag "module"]{Language Declared in Source}
The @as-index{@drlang{Module} language} is really a kind of
meta-language, where the program itself specifies its language,
usually through a @hash-lang[] line.
The @as-index{@drlang{Use the language declared in the source} mode}
in DrScheme is a kind of meta-language, where the program itself
specifies its language, usually through a @hash-lang[] line.
More generally, when using @drlang{Module}, the @tech{definitions
window} must contain a module in some form. Besides @hash-lang[], a
Scheme module can be written as @scheme[(module ...)]. In any case,
aside from comments, the @tech{definitions window} must contain
exactly one module.
More generally, when using the declared-in-source mode, the
@tech{definitions window} must contain a module in some form. Besides
@hash-lang[], a Racket module can be written as @racket[(module
...)]. In any case, aside from comments, the @tech{definitions window}
must contain exactly one module.
In the details pane of the module language, some of the
configuration options for the Module language that correspond
to using various libraries and thus can be used without DrScheme.
Here's how, for the ones that are straightforward (the ones
not mentioned here require more sophisticated configuration
In the details pane of the module language, some of the configuration
options correspond to using various libraries and thus can be used
without DrRacket. Here's how, for the ones that are straightforward
(the ones not mentioned here require more sophisticated configuration
of various libraries).
@itemize[
@item{@bold{Dynamic Properties}:
The radio buttons corresond to various uses of the @schememodname[errortrace/errortrace-lib] library.
The radio buttons corresond to various uses of the @racketmodname[errortrace/errortrace-lib] library.
The @italic{No Debugging or profiling} option means not to use the library at all.
The @italic{Debugging} option means @scheme[(current-compile (make-errortrace-compile-handler))] as well as
adding @scheme[(build-path "compiled" "errortrace")] to @scheme[use-compiled-file-paths].
The @italic{Debugging} option means @racket[(current-compile (make-errortrace-compile-handler))] as well as
adding @racket[(build-path "compiled" "errortrace")] to @racket[use-compiled-file-paths].
The @italic{Debugging and profiling} option means to use @schememodname[errortrace/errortrace-lib] library's
@scheme[profiling-enabled] in conjunction with @scheme[current-eval].
The @italic{Debugging and profiling} option means to use @racketmodname[errortrace/errortrace-lib] library's
@racket[profiling-enabled] in conjunction with @racket[current-eval].
The @italic{Syntactic test suite coverage} option means to use @scheme[test-coverage-enabled]
in conjunction with @scheme[current-eval].
The @italic{Syntactic test suite coverage} option means to use @racket[test-coverage-enabled]
in conjunction with @racket[current-eval].
The other two checkboxes save compiled @tt{.zo} files and adjust the JIT compiler.
The @italic{populate compiled/ directories} option corresponds to
@schemeblock[(current-load/use-compiled
@racketblock[(current-load/use-compiled
(make-compilation-manager-load/use-compiled-handler))
(manager-skip-file-handler
(λ (p)
(file-date-in-paths
p
(cons (CACHE-DIR) (current-library-collection-paths)))))]
plus adding either @scheme[(build-path "compiled" "drscheme")] or
@scheme[(build-path "compiled" "drscheme" "errortrace")]
to the front of @scheme[use-compiled-file-paths], depending if the
plus adding either @racket[(build-path "compiled" "drracket")] or
@racket[(build-path "compiled" "drracket" "errortrace")]
to the front of @racket[use-compiled-file-paths], depending if the
@italic{Debugging} option is set or not.
The @italic{Preserve stacktrace} option corresponds to
@schemeblock[(compile-context-preservation-enabled #t)]
@racketblock[(compile-context-preservation-enabled #t)]
}
@item{@bold{Output Syntax}: The output syntax options correspond to settings in the @scheme[scheme/pretty] library and the @scheme[scheme/pconvert] library.}
@item{@bold{Collection Paths}: This corresponds to setting the @scheme[current-library-collection-paths] parameter.}
@item{@bold{Command-line arguments}: This corresponds to setting the @scheme[current-command-line-arguments] parameter.}
@item{@bold{Output Syntax}: The output syntax options correspond to settings in the @racketmodname[racket/pretty] library
and the @racketmodname[mzlib/pconvert] library.}
@item{@bold{Collection Paths}: This corresponds to setting the @racket[current-library-collection-paths] parameter.}
@item{@bold{Command-line arguments}: This corresponds to setting the @racket[current-command-line-arguments] parameter.}
]
@; ----------------------------------------
@section[#:tag "legacy"]{Legacy Languages}
DrScheme supports several historically useful variants of Scheme
DrRacket supports several historically useful variants of Scheme
without a @hash-lang[] prefix:
@itemize[
@item{The @as-index{@drlang{R5RS} language} contains those
primitives and syntax defined in the R@superscript{5}RS Scheme
standard. See the @schememodname[r5rs] library for details.}
standard. See the @racketmodname[r5rs] library for details.}
@item{The @as-index{@defterm{PLT Pretty Big} language} provides a
language roughly compatible with a language in earlier versions of
DrScheme. It evaluates a program in the same way as @scheme[load],
DrRacket. It evaluates a program in the same way as @racket[load],
and it starts by importing the following modules:
@schememodname[mzscheme], @schememodname[scheme/gui/base],
@schememodname[mzlib/class], @schememodname[mzlib/etc],
@schememodname[mzlib/file], @schememodname[mzlib/list],
@schememodname[mzlib/unit], @schememodname[mzlib/include],
@schememodname[mzlib/defmacro], @schememodname[mzlib/pretty],
@schememodname[mzlib/string], @schememodname[mzlib/thread],
@schememodname[mzlib/math], @schememodname[mzlib/match], and
@schememodname[mzlib/shared].}
@racketmodname[mzscheme], @racketmodname[racket/gui/base],
@racketmodname[mzlib/class], @racketmodname[mzlib/etc],
@racketmodname[mzlib/file], @racketmodname[mzlib/list],
@racketmodname[mzlib/unit], @racketmodname[mzlib/include],
@racketmodname[mzlib/defmacro], @racketmodname[mzlib/pretty],
@racketmodname[mzlib/string], @racketmodname[mzlib/thread],
@racketmodname[mzlib/math], @racketmodname[mzlib/match], and
@racketmodname[mzlib/shared].}
@item{The @as-index{@drlang{Swindle} language} starts with the same
bindings as @schememodname[swindle], and evaluates the program like
@scheme[load].}
bindings as @racketmodname[swindle], and evaluates the program like
@racket[load].}
]
@ -107,18 +107,18 @@ without a @hash-lang[] prefix:
@section[#:tag "htdp-langs"]{@|HtDP| Teaching Languages}
Five of DrScheme's languages are specifically designed for teaching:
Five of DrRacket's languages are specifically designed for teaching:
@itemize[
@item{The @as-index{@drlang{Beginning Student} language} is a small
version of Scheme that is tailored for beginning computer
version of Racket that is tailored for beginning computer
science students.}
@item{The @as-index{@drlang{Beginning Student with List
Abbreviations} languages} is an extension to Beginning Student
that prints lists with @scheme[list] instead of @scheme[cons],
and accepts @scheme[quasiquote]d input.}
that prints lists with @racket[list] instead of @racket[cons],
and accepts @racket[quasiquote]d input.}
@item{The @as-index{@drlang{Intermediate Student} language} adds
local bindings and higher-order functions.}
@ -131,22 +131,22 @@ Five of DrScheme's languages are specifically designed for teaching:
]
The teaching languages are different from conventional Scheme in a number
The teaching languages are different from conventional Racket in a number
of ways:
@itemize[
@item{@defterm{Case-sensitive identifiers and symbols} --- In a
case-sensitive language, the variable names @scheme[x] and
@scheme[X] are distinct, and the symbols @scheme['x] and
@scheme['X] are also distinct. In a case-insensitive language,
@scheme[x] and @scheme[X] are equivalent and @scheme['x] and
@scheme['X] represent the same value. The teaching languages
case-sensitive language, the variable names @racket[x] and
@racket[X] are distinct, and the symbols @racket['x] and
@racket['X] are also distinct. In a case-insensitive language,
@racket[x] and @racket[X] are equivalent and @racket['x] and
@racket['X] represent the same value. The teaching languages
are case-sensitive by default, and other languages are usually
case-insensitive. Case-sensitivity can be adjusted through the
detail section of the language-selection dialog.}
@item{@defterm{All numbers are exact unless @schememetafont{#i} is
@item{@defterm{All numbers are exact unless @racketmetafont{#i} is
specified} --- In the @drlang{Beginning Student} through
@drlang{Intermediate Student with Lambda languages}, numbers
containing a decimal point are interpreted as exact
@ -154,7 +154,7 @@ of ways:
decimal notation without inadvertently triggering inexact
arithmetic. Exact numbers with decimal representations are also
printed in decimal. Inexact inputs and results are explicitly
marked with @schememetafont{#i}.}
marked with @racketmetafont{#i}.}
@item{@defterm{Procedures must take at least one argument} --- In the
@drlang{Beginning Student} through @drlang{Intermediate
@ -167,19 +167,19 @@ of ways:
@item{@defterm{Identifier required at function call position} --- In
the @drlang{Beginning Student} through @drlang{Intermediate
Student} languages, procedure calls must be of the form
@scheme[(_identifier ...)]. This restriction helps detect
confusing misuses of parentheses, such as @scheme[(1)] or
@scheme[((+ 3 4))], which is a common mistake among beginners
@racket[(_identifier ...)]. This restriction helps detect
confusing misuses of parentheses, such as @racket[(1)] or
@racket[((+ 3 4))], which is a common mistake among beginners
who are used to the optional parentheses of algebra.}
@item{@defterm{Top-level required at function call position} --- In
the @drlang{Beginning Student} languages, procedure calls must
be of the form @scheme[(_top-level-identifier ...)], and the
be of the form @racket[(_top-level-identifier ...)], and the
number of actual arguments must match the number of formal
arguments if @scheme[_top-level-identifier] is
@scheme[define]d. This restriction helps detect confusing
misuses of parentheses, such as @scheme[(x)] where @scheme[x]
is a function argument. DrScheme can detect such mistakes
arguments if @racket[_top-level-identifier] is
@racket[define]d. This restriction helps detect confusing
misuses of parentheses, such as @racket[(x)] where @racket[x]
is a function argument. DrRacket can detect such mistakes
syntactically because Beginning Student does not support
higher-order procedures.}
@ -188,15 +188,15 @@ of ways:
languages, the name of a primitive operator or of a defined
function can be used only after the open-parenthesis of a
function call (except where teachpack extensions allow
otherwise, as in the @scheme[convert-gui] teachpack). Incorrect
otherwise, as in the @racket[convert-gui] teachpack). Incorrect
uses of primitives trigger a syntax error. Incorrect uses of
defined names trigger a run-time error. DrScheme can detect
defined names trigger a run-time error. DrRacket can detect
such mistakes because Beginning Student does not support
higher-order procedures.}
@item{@defterm{@scheme[lambda] allowed only in definitions} --- In
@item{@defterm{@racket[lambda] allowed only in definitions} --- In
the Beginning Student through Intermediate Student languages,
@scheme[lambda] (or @scheme[case-lambda]) may appear only in a
@racket[lambda] (or @racket[case-lambda]) may appear only in a
definition, and only as the value of the defined variable.}
@item{@defterm{Free variables are not allowed} --- In the
@ -205,56 +205,56 @@ of ways:
must be defined, pre-defined, or the name of a local function
argument.}
@item{@defterm{@scheme[quote] works only on symbols,
@scheme[quasiquote] disallowed} --- In the @drlang{Beginning
Student} language, @scheme[quote] and @schemevalfont{'} can
@item{@defterm{@racket[quote] works only on symbols,
@racket[quasiquote] disallowed} --- In the @drlang{Beginning
Student} language, @racket[quote] and @racketvalfont{'} can
specify only symbols. This restriction avoids the need to
explain to beginners why @scheme[1] and @scheme['1] are
equivalent in standard Scheme. In addition,
@scheme[quasiquote], @litchar{`}, @scheme[unquote],
@litchar{,}, @scheme[unquote-splicing], and @litchar[",@"] are
explain to beginners why @racket[1] and @racket['1] are
equivalent in standard Racket. In addition,
@racket[quasiquote], @litchar{`}, @racket[unquote],
@litchar{,}, @racket[unquote-splicing], and @litchar[",@"] are
disallowed.}
@item{@defterm{Unmatched @scheme[cond]/@scheme[case] is an error} ---
@item{@defterm{Unmatched @racket[cond]/@racket[case] is an error} ---
In the @drlang{Beginning Student} through @drlang{Advanced
Student} languages, falling through a @scheme[cond] or
@scheme[case] expression without matching a clause signals a
Student} languages, falling through a @racket[cond] or
@racket[case] expression without matching a clause signals a
run-time error. This convention helps detect syntactic and
logical errors in programs.}
@item{@defterm{Conditional values must be @scheme[true] or
@scheme[false]} --- In the @drlang{Beginning Student} through
@item{@defterm{Conditional values must be @racket[true] or
@racket[false]} --- In the @drlang{Beginning Student} through
@drlang{Advanced Student} languages, an expression whose value
is treated as a boolean must return an actual boolean,
@scheme[true] or @scheme[false]. This restriction, which
applies to @scheme[if], @scheme[cond], @scheme[and],
@scheme[or], @scheme[nand], and @scheme[nor] expressions, helps
@racket[true] or @racket[false]. This restriction, which
applies to @racket[if], @racket[cond], @racket[and],
@racket[or], @racket[nand], and @racket[nor] expressions, helps
detect errors where a boolean function application is omitted.}
@item{@defterm{@scheme[+], @scheme[*], and @scheme[/] take at least
@item{@defterm{@racket[+], @racket[*], and @racket[/] take at least
two arguments} --- In the @drlang{Beginning Student} through
@drlang{Advanced Student} languages, mathematical operators
that are infix in algebra notation require at least two
arguments in DrScheme. This restriction helps detect missing
arguments in DrRacket. This restriction helps detect missing
arguments to an operator.}
@item{@defterm{@scheme[and], @scheme[or], @scheme[nand], and
@scheme[nor] require at least 2 expressions} --- In the
@item{@defterm{@racket[and], @racket[or], @racket[nand], and
@racket[nor] require at least 2 expressions} --- In the
@drlang{Beginning Student} through @drlang{Advanced Student}
languages, the boolean combination forms require at least two
sub-expressions. This restriction helps detect missing or
ill-formed sub-expressions in a boolean expression.}
@item{@defterm{@scheme[set!] disallowed on arguments} --- In the
@drlang{Advanced Student} language, @scheme[set!] cannot be
used to mutate variables bound by @scheme[lambda]. This
@item{@defterm{@racket[set!] disallowed on arguments} --- In the
@drlang{Advanced Student} language, @racket[set!] cannot be
used to mutate variables bound by @racket[lambda]. This
restriction ensures that the substitution model of function
application is consistent with DrScheme's evaluation.}
application is consistent with DrRacket's evaluation.}
@item{@defterm{Improper lists disallowed} --- A @defterm{proper list}
is either an empty list or a list created by @scheme[cons]ing
is either an empty list or a list created by @racket[cons]ing
onto a proper list. In the @drlang{Beginning Student} through
@drlang{Advanced Student} languages, @scheme[cons] constructs
@drlang{Advanced Student} languages, @racket[cons] constructs
only @defterm{proper lists}, signaling an error if the second
argument is not a proper list. Since beginning students do not
need improper lists, this restriction help detect logical
@ -282,7 +282,7 @@ of ways:
]
The teaching languages also deviate from traditional Scheme in
The teaching languages also deviate from traditional Racket in
printing values. Different printing formats can be selected for any
language through the detail section of language-selection dialog.
@ -297,10 +297,10 @@ language through the detail section of language-selection dialog.
@item{@defterm{Rational number printing} -- In the teaching
languages, all numbers that have a finite decimal expansion are
printed in decimal form. For those numbers that do not have a
finite decimal expansion (such as @scheme[4/3]) DrScheme offers a
finite decimal expansion (such as @racket[4/3]) DrRacket offers a
choice. It either prints them as mixed fractions or as repeating
decimals, where the repeating portion of the decimal expansion is
shown with an overbar. In addition, DrScheme only shows the first
shown with an overbar. In addition, DrRacket only shows the first
25 digits of the number's decimal expansion. If there are more
digits, the number appears with an ellipses at the end. Click the
ellipses to see the next 25 digits of the expansion.
@ -310,21 +310,21 @@ language through the detail section of language-selection dialog.
you change from the fraction representation to the decimal
representation.}
@item{@defterm{@scheme[write] output} --- Prints values with
@scheme[write].}
@item{@defterm{@racket[write] output} --- Prints values with
@racket[write].}
@item{@defterm{Show sharing in values} --- Prints interaction results
using the @scheme[shared] syntax, which exposes shared
using the @racket[shared] syntax, which exposes shared
structure within a value. For example, the list created by
@scheme[(let ([lt (list 0)]) (list lt lt))] prints as
@racket[(let ([lt (list 0)]) (list lt lt))] prints as
@schemeblock[
@racketblock[
(shared ((-1- (list 0))) (list -1- -1-))
]
instead of
@schemeblock[
@racketblock[
(list (list 0) (list 0))
]
}
@ -332,20 +332,20 @@ language through the detail section of language-selection dialog.
]
A program in the teaching languages should be tested using the check forms ---
@scheme[(check-expect value value)], @scheme[(check-within value value value)], or
@scheme[(check-error value string)]. Tests are evaluated when running the program:
@racket[(check-expect value value)], @racket[(check-within value value value)], or
@racket[(check-error value string)]. Tests are evaluated when running the program:
when there are no tests, a warning appears in the interactions window;
when all tests succeed, an acknowledgement appears in the interactions window;
otherwise, a testing window appears to report the results. See @secref["menu:view"]
for details on configuring the report behavior.
Tests can be disabled if necessary, see @secref["menu:scheme"] for details.
Tests can be disabled if necessary, see @secref["menu:racket"] for details.
@; ----------------------------------------
@section[#:tag "experimental-langs"]{Other Experimental Languages}
For information on @onscreen{Lazy Scheme}, see @other-manual['(lib "lazy/lazy.scrbl")].
For information on @onscreen{Lazy Racket}, see @other-manual['(lib "lazy/lazy.scrbl")].
For information on @onscreen{FrTime}, see @other-manual['(lib "frtime/scribblings/frtime.scrbl")].

View File

@ -15,7 +15,7 @@
@itemize[
@item{@defmenuitem{New} Creates a new DrScheme window.}
@item{@defmenuitem{New} Creates a new DrRacket window.}
@item{@defmenuitem{Open...} Opens a find-file dialog for choosing
a file to load into a @tech{definitions window}.}
@ -44,7 +44,7 @@
@item{@defmenuitem{Save Definitions As Text...} Like @onscreen{Save
Definitions As...}, but the file is saved in plain-text format (see
@secref["drscheme-file-formats"]). Subsequent saves also write in
@secref["drracket-file-formats"]). Subsequent saves also write in
plain-text format.}
@item{@defmenuitem{Save Interactions} Saves the contents of the interactions
@ -57,7 +57,7 @@
@item{@defmenuitem{Save Interactions As Text...} Like @onscreen{Save
Interactions As...}, but the file is saved in plain-text format (see
@secref["drscheme-file-formats"]). Subsequent saves are write in
@secref["drracket-file-formats"]). Subsequent saves are write in
plain-text format.}
]}
@ -65,7 +65,7 @@
@item{@defmenuitem{Log Definitions and Interactions...} Starts a
running of log of the text in the interactions and definitions
windows, organized by executions. In a directory of your choosing,
DrScheme saves files with the names @filepath{01-definitions},
DrRacket saves files with the names @filepath{01-definitions},
@filepath{01-interactions}, @filepath{02-definitions},
@filepath{02-interactions}, @|etc| as you interact with various
programs.}
@ -80,11 +80,11 @@
specify the parameters of a multi-file search. The results of the
search are displayed in a separate window.}
@item{@defmenuitem{Close} Closes this DrScheme window. If this window
is the only open DrScheme window, then DrScheme quits, except under
@item{@defmenuitem{Close} Closes this DrRacket window. If this window
is the only open DrRacket window, then DrRacket quits, except under
Mac OS X.}
@item{{@onscreen{Quit} or @onscreen{Exit}} Exits DrScheme. (Under Mac
@item{{@onscreen{Quit} or @onscreen{Exit}} Exits DrRacket. (Under Mac
OS X, this menu item is in the Apple menu.)}
]
@ -158,7 +158,7 @@ case-sensitive and case-insensitive search.}
@item{@defmenuitem{Add User-defined Keybindings...} Choosing this menu
item opens a file dialog where you can select a file containing
Scheme-definitions of keybindings. See @secref["defining-shortcuts"]
Racket-definitions of keybindings. See @secref["defining-shortcuts"]
for more information.}
]}
@ -188,14 +188,14 @@ appears at any time.
@item{@defmenuitem{Hide Interactions} Hides interactions window.}
@item{@defmenuitem{Show Program Contour} Shows a ``20,000 foot''
overview window along the edge of the DrScheme
overview window along the edge of the DrRacket
window. Each pixel in this window corresponds to a letter
in the program text.}
@item{@defmenuitem{Hide Program Contour} Hides the contour window.}
@item{@defmenuitem{Show Module Browser} Shows the module DAG rooted
at the currently opened file in DrScheme.
at the currently opened file in DrRacket.
See also @secref["module-browser"].}
@ -205,8 +205,8 @@ appears at any time.
@item{@defmenuitem{Toolbar}
@itemize[
@item{@defmenuitem{Toolbar on Left} Moves the tool bar (defaultly on the top of DrScheme's window) to the left-hand side, organized vertically.}
@item{@defmenuitem{Toolbar on Top} Moves the toolbar to the top of the DrScheme window.}
@item{@defmenuitem{Toolbar on Left} Moves the tool bar (defaultly on the top of DrRacket's window) to the left-hand side, organized vertically.}
@item{@defmenuitem{Toolbar on Top} Moves the toolbar to the top of the DrRacket window.}
@item{@defmenuitem{Toolbar on Right} Moves the tool bar to the right-hand side, organized vertically.}
@item{@defmenuitem{Toolbar Hidden} Hides the toolbar entirely.}]}
@ -219,13 +219,13 @@ appears at any time.
section. Profiling does not apply to all languages.}
@item{@defmenuitem{Hide Profile} Hides any profiling
information currently displayed in the DrScheme window.}
information currently displayed in the DrRacket window.}
@item{@defmenuitem{Dock Test Report} Like the dock button on the test report
window, this causes all test report windows to merge with the appropriate
DrScheme window at the bottom of the frame.}
DrRacket window at the bottom of the frame.}
@item{@defmenuitem{Undock Test Report} Like the undock button on the test report
window, this causes the test reports attached to appropriate DrScheme tabs
window, this causes the test reports attached to appropriate DrRacket tabs
to become separate windows.}
@item{@defmenuitem{Show Tracing} Shows a trace of functions called since
@ -264,7 +264,7 @@ Note: whenever a program is run, the interactions window is made
@item{@defmenuitem{Add Teachpack...} Opens a find-file dialog for
choosing a teachpack to extend the current language. Click
@onscreen{Run} to make the teachpack available in the interactions
windows. See @secref["extending-drscheme"] for information on
windows. See @secref["extending-drracket"] for information on
creating teachpacks.}
@item{@defmenuitem{Clear All Teachpacks} Clears all of the current
@ -278,7 +278,7 @@ clears only the corresponding teachpack.
@; ----------------------------------------
@section[#:tag "menu:scheme"]{@onscreen{Scheme}}
@section[#:tag "menu:racket"]{@onscreen{Racket}}
@itemize[
@ -291,7 +291,7 @@ clears only the corresponding teachpack.
@item{@defmenuitem{Limit Memory...} Allow you to specify a
limit on the amount of memory that a program running in
DrScheme is allowed to consume.}
DrRacket is allowed to consume.}
@item{@defmenuitem{Clear Error Highlight} Removes the red
background that signals the source location of an error.}
@ -308,7 +308,7 @@ background that signals the source location of an error.}
}
@item{@defmenuitem{Reindent} Indents the selected text according to
the standard Scheme formatting conventions. (Pressing the Tab key
the standard Racket formatting conventions. (Pressing the Tab key
has the same effect.)}
@item{@defmenuitem{Reindent All} Indents all of the text in either
@ -345,7 +345,7 @@ background that signals the source location of an error.}
@itemize[
@item{@defmenuitem{Insert Comment Box} Inserts a box that is ignored
by DrScheme; use it to write comments for people who read your
by DrRacket; use it to write comments for people who read your
program.}
@item{@defmenuitem{Insert Image...} Opens a find-file dialog for
@ -368,19 +368,19 @@ background that signals the source location of an error.}
@item{@defmenuitem{Insert @|lam-str|} Inserts the symbol @|lam-str|
(as a Unicode character) into the program. The @|lam-str| symbol is
normally bound the same as @scheme[lambda].}
normally bound the same as @racket[lambda].}
@item{@defmenuitem{Insert XML Box} Inserts an XML; see
@secref["xml-boxes"] for more information.}
@item{@defmenuitem{Insert Scheme Box} Inserts a box to contain Scheme
@item{@defmenuitem{Insert Racket Box} Inserts a box to contain Racket
code, typically used inside an XML box; see @secref["xml-boxes"].}
@item{@defmenuitem{Insert Scheme Splice Box} Inserts a box to contain Scheme
@item{@defmenuitem{Insert Racket Splice Box} Inserts a box to contain Racket
code, typically used inside an XML box; see also @secref["xml-boxes"].}
@item{@defmenuitem{Insert Pict Box} Creates a box for generating a
Slideshow picture. Inside the pict box, insert and arrange Scheme
Slideshow picture. Inside the pict box, insert and arrange Racket
boxes that produce picture values.}
]
@ -392,7 +392,7 @@ background that signals the source location of an error.}
@itemize[
@item{@defmenuitem{Bring Frame to Front...} Opens a window that lists
all of the opened DrScheme frames. Selecting one of them brings the
all of the opened DrRacket frames. Selecting one of them brings the
window to the front.}
@item{@defmenuitem{Most Recent Window} Toggles between the currently
@ -401,7 +401,7 @@ background that signals the source location of an error.}
]
Additionally, after the above menu items, this menu contains
an entry for each window in DrScheme. Selecting a menu item
an entry for each window in DrRacket. Selecting a menu item
brings the corresponding window to the front.
@; ----------------------------------------
@ -411,19 +411,19 @@ brings the corresponding window to the front.
@itemize[
@item{@defmenuitem{Help Desk} Opens the Help Desk. This is the clearing
house for all documentation about DrScheme and its language.}
house for all documentation about DrRacket and its language.}
@item{@defmenuitem{About DrScheme...} Shows the credits for DrScheme.}
@item{@defmenuitem{About DrRacket...} Shows the credits for DrRacket.}
@item{@defmenuitem{Related Web Sites} Provides links to related web sites.}
@item{@defmenuitem{Tool Web Sites} Provides links to web sites for
installed tools.}
@item{@defmenuitem{Interact with DrScheme in English} Changes DrScheme's
@item{@defmenuitem{Interact with DrRacket in English} Changes DrRacket's
interface to use English; the menu item appears only when the
current language is not English. Additional menu items switch
DrScheme to other languages.}
DrRacket to other languages.}
]

View File

@ -11,20 +11,20 @@ The preferences dialog consists of several panels.
@section{@onscreen{Font}}
This panel controls the main font used by DrScheme.
This panel controls the main font used by DrRacket.
@section{@onscreen{Colors}}
The @onscreen{Colors} panel has several sub-panels that let you
configure the colors that DrScheme uses for the editor background,
configure the colors that DrRacket uses for the editor background,
for highlighting matching parentheses, for the online coloring for
Scheme and Java modes, for @onscreen{Check Syntax}, and for the
Racket and Java modes, for @onscreen{Check Syntax}, and for the
colors of the text in the @tech{interactions window}.
It also has two buttons, @onscreen{White on Black} and
@onscreen{Black on White}, which set a number of defaults for the
color preferences and change a few other aspects of DrScheme's
behavior to make DrScheme's colors look nicer for those two modes.
color preferences and change a few other aspects of DrRacket's
behavior to make DrRacket's colors look nicer for those two modes.
@section{@onscreen{Editing}}
@ -34,14 +34,14 @@ The preferences dialog consists of several panels.
@item{@onscreen{Indenting}
This panel controls which keywords DrScheme recognizes for
This panel controls which keywords DrRacket recognizes for
indenting, and how each keyword is treated.}
@item{@onscreen{Square bracket}
This panel controls which keywords DrScheme uses to determine
This panel controls which keywords DrRacket uses to determine
when to rewrite @litchar["["] to @litchar["("]. For
@scheme[cond]-like keywords, the number in parenthesis indicates
@racket[cond]-like keywords, the number in parenthesis indicates
how many sub-expressions are skipped before square brackets are
started.
@ -57,7 +57,7 @@ The preferences dialog consists of several panels.
menu).}
@item{@PrefItem{Auto-save files} --- If checked, the editor
generates autosave files (see @secref["drscheme-autosave-files"])
generates autosave files (see @secref["drracket-autosave-files"])
for files that have not been saved after five minutes.}
@item{@PrefItem{Backup files} --- If checked, when saving a file for
@ -69,7 +69,7 @@ The preferences dialog consists of several panels.
@item{@PrefItem{Map delete to backspace} --- If checked, the editor
treats the Delete key like the Backspace key.}
@item{@PrefItem{Show status-line} --- If checked, DrScheme shows a
@item{@PrefItem{Show status-line} --- If checked, DrRacket shows a
status line at the bottom of each window.}
@item{@PrefItem{Count column numbers from one} --- If checked, the
@ -82,26 +82,26 @@ The preferences dialog consists of several panels.
rather than the character offset into the text.}
@item{@PrefItem{Wrap words in editor buffers} --- If checked,
DrScheme editors auto-wrap text lines by default. Changing this
DrRacket editors auto-wrap text lines by default. Changing this
preference affects new windows only.}
@item{@PrefItem{Use separate dialog for searching} --- If checked,
then selecting the @onscreen{Find} menu item opens a separate
dialog for searching and replacing. Otherwise, selecting
@onscreen{Find} opens an interactive search-and-replace panel at
the bottom of a DrScheme window.}
the bottom of a DrRacket window.}
@item{@PrefItem{Reuse existing frames when opening new files} ---
If checked, new files are opened in the same DrScheme window,
rather than creating a new DrScheme window for each new file.}
If checked, new files are opened in the same DrRacket window,
rather than creating a new DrRacket window for each new file.}
@item{@PrefItem{Enable keybindings in menus} --- If checked, some
DrScheme menu items have keybindings. Otherwise, no menu items
DrRacket menu items have keybindings. Otherwise, no menu items
have key bindings. This preference is designed for people who are
comfortable editing in Emacs and find the standard menu
keybindings interfere with the Emacs keybindings.}
@item{@PrefItem{Color syntax interactively} --- If checked, DrScheme
@item{@PrefItem{Color syntax interactively} --- If checked, DrRacket
colors your syntax as you type.}
@item{@PrefItem{Automatically print to PostScript file} --- If
@ -110,15 +110,15 @@ The preferences dialog consists of several panels.
computer.}
@item{@PrefItem{Open files in separate tabs (not separate windows)}
-- If checked, DrScheme will use tabs in the front-most window to
-- If checked, DrRacket will use tabs in the front-most window to
open new files, rather than creating new windows for new files.}
@item{@PrefItem{Automatically open interactions window when running
a program} -- If checked, DrScheme shows the interactions window
a program} -- If checked, DrRacket shows the interactions window
(if it is hidden) when a program is run.}
@item{@PrefItem{Put the interactions window beside the definitions
window} -- If checked, DrScheme puts the interactions window to the
window} -- If checked, DrRacket puts the interactions window to the
right of the definitions window. By default, the interactions
window is below the definitions window.}
@ -130,7 +130,7 @@ The preferences dialog consists of several panels.
]}
@item{@onscreen{Scheme}
@item{@onscreen{Racket}
@itemize[
@ -159,27 +159,27 @@ The preferences dialog consists of several panels.
@itemize[
@item{@PrefItem{Ask before changing save format} --- If checked,
DrScheme consults the user before saving a file in non-text format
(see @secref["drscheme-file-formats"]).}
DrRacket consults the user before saving a file in non-text format
(see @secref["drracket-file-formats"]).}
@item{@PrefItem{Verify exit} --- If checked, DrScheme consults the
@item{@PrefItem{Verify exit} --- If checked, DrRacket consults the
user before exiting.}
@item{@PrefItem{Only warn once when executions and interactions are
not synchronized} --- If checked, DrScheme warns the user on the
not synchronized} --- If checked, DrRacket warns the user on the
first interaction after the definitions window, language, or
teachpack is changed without a corresponding click on
@onscreen{Run}. Otherwise, the warning appears on every
interaction.}
@item{@PrefItem{Ask about clearing test coverage} --- If checked,
when test coverage annotations are displayed DrScheme prompts
when test coverage annotations are displayed DrRacket prompts
about removing them. This setting only applies to the PLT
languages. DrScheme never asks in the teaching languages.}
languages. DrRacket never asks in the teaching languages.}
@item{@PrefItem{Check for newer PLT Scheme versions} --- If
checked, DrScheme periodically polls a server to determine
whether a newer version of DrScheme is available.}
@item{@PrefItem{Check for newer PLT Racket versions} --- If
checked, DrRacket periodically polls a server to determine
whether a newer version of DrRacket is available.}
]

View File

@ -5,7 +5,7 @@
@(define spacer (hspace 1))
@(define-syntax-rule (print-table [expr cons qq wr] ...)
(*print-table (list (list spacer (scheme expr) spacer (schemeresult cons) spacer (schemeresult qq) spacer (schemeresult wr)) ...)))
(*print-table (list (list spacer (racket expr) spacer (racketresult cons) spacer (racketresult qq) spacer (racketresult wr)) ...)))
@(define (*print-table rows)
(make-table
@ -29,10 +29,10 @@
@section-index["printing format"]
Many Scheme languages support a @onscreen{Output Syntax} choice that
Many Racket languages support a @onscreen{Output Syntax} choice that
determines how evaluation results are printed in the
@tech{interactions window}. This setting also applies to output
generated by calling @scheme[print] explicitly.
generated by calling @racket[print] explicitly.
The following table illustrates the difference between the different
output styles:
@ -41,43 +41,43 @@ output styles:
[(cons 1 2) (cons 1 2) `(1 . 2) (1 . 2)]
[(list 1 2) (list 1 2) `(1 2) (1 2)]
['(1 2) (list 1 2) `(1 2) (1 2)]
[(list (void)) (list (void)) `(,(void)) (#,(@schemeresultfont "#<void>"))]
[`(,(void)) (list (void)) `(,(void)) (#,(schemeresultfont "#<void>"))]
[(list (void)) (list (void)) `(,(void)) (#,(@racketresultfont "#<void>"))]
[`(,(void)) (list (void)) `(,(void)) (#,(racketresultfont "#<void>"))]
[(vector 1 2 3) (vector 1 2 3) (vector 1 2 3) #(1 2 3)]
[(box 1) (box 1) (box 1) #&1]
[(lambda (x) x) (lambda (a1) ...) (lambda (a1) ...) #,(schemeresultfont "#<procedure>")]
[(lambda (x) x) (lambda (a1) ...) (lambda (a1) ...) #,(racketresultfont "#<procedure>")]
['sym 'sym 'sym sym]
[(make-s 1 2) (make-s 1 2) (make-s 1 2) #(struct:s 1 2)]
['() empty `() ()]
[add1 add1 add1 #,(schemeresultfont "#<procedure:add1>")]
[(delay 1) (delay ...) (delay ...) #,(schemeresultfont "#<promise>")]
[add1 add1 add1 #,(racketresultfont "#<procedure:add1>")]
[(delay 1) (delay ...) (delay ...) #,(racketresultfont "#<promise>")]
[(regexp "a") (regexp "a") (regexp "a") #rx"a"]
]
The @as-index{@onscreen{Constructor} output} mode treats
@scheme[cons], @scheme[vector], and similar primitives as value
constructors, rather than functions. It also treats @scheme[list] as
shorthand for multiple @scheme[cons]'s ending with the empty list.
@racket[cons], @racket[vector], and similar primitives as value
constructors, rather than functions. It also treats @racket[list] as
shorthand for multiple @racket[cons]'s ending with the empty list.
@onscreen{Constructor} output is especially valuable for beginning
programmers, because output values look the same as input values.
The @as-index{@onscreen{Quasiquote} output} mode is like
@onscreen{Constructor} output, but it uses @scheme[quasiquote]
@onscreen{Constructor} output, but it uses @racket[quasiquote]
(abbreviated with @litchar{`}) to print lists, and it uses
@scheme[unquote] (abbreviated with @litchar{,}) to escape back to
@racket[unquote] (abbreviated with @litchar{,}) to escape back to
@onscreen{Constructor} printing as needed. This mode provides the same
benefit as @onscreen{Constructor} output, in that printed results are
expressions, but it is more convenient for many kinds of data,
especially data that represents expressions.
The @as-index{@onscreen{print} output} mode corresponds to traditional
Scheme printing via the @scheme[print] procedure, which defaults to
@scheme[write]-like printing, as shown in the last column.
The @as-index{@onscreen{write} output} mode corresponds to traditional
Scheme printing via the @racket[print] procedure, which defaults to
@racket[write]-like printing, as shown in the last column.
DrScheme also sets the @scheme[global-port-print-handler] in order to
DrRacket also sets the @racket[global-port-print-handler] in order to
customize a few aspects of the printing for all of these modes, namely
printing the symbol @scheme[quote] as a single tick mark (mutatis
mutandis for @scheme[quasiquote], @scheme[unquote], and
@scheme[unquote-splicing]), and to print rational real numbers using a
special @scheme[snip%] object that lets the user choose between
printing the symbol @racket[quote] as a single tick mark (mutatis
mutandis for @racket[quasiquote], @racket[unquote], and
@racket[unquote-splicing]), and to print rational real numbers using a
special @racket[snip%] object that lets the user choose between
improper fractions, mixed fractions, and repeating decimals.

View File

@ -1,3 +0,0 @@
#lang setup/infotab
(define scribblings '(("drscheme.scrbl" (multi-page) (tool 100))))

View File

@ -832,7 +832,7 @@ Enables or disables anti-aliased smoothing of lines, curves,
Smoothing is supported under Windows only when Microsoft's
@filepath{gdiplus.dll} is installed (which is always the case for Windows
XP). Smoothing is supported under Mac OS X always. Smoothing is
supported under X only when Cairo is installed when MrEd is compiled.
supported under X only when Cairo is installed when GRacket is compiled.
Smoothing is never supported for black-and-white contexts. Smoothing
is always supported (and cannot be disabled) for PostScript output.

View File

@ -5,7 +5,7 @@
@title[#:tag "drawing-overview"]{Drawing}
Drawing in PLT Scheme requires a @deftech{device context}
Drawing in Racket requires a @deftech{device context}
(@deftech{DC}), which is an instance of the @scheme[dc<%>]
interface. For example, the @method[canvas<%> get-dc] method of a
canvas returns a @scheme[dc<%>] instance for drawing into the canvas
@ -153,12 +153,12 @@ For all types of DCs, the drawing origin is the top-left corner of the
initially correspond to points (1/72 of an inch).
More complex shapes are typically best implemented with
@deftech{paths}. The following example uses paths to draw the PLT
Scheme logo. It also enables smoothing, so that the logo's curves are
@deftech{paths}. The following example uses paths to draw the
Racket logo. It also enables smoothing, so that the logo's curves are
anti-aliased when smoothing is available. (Smoothing is always
available under Mac OS X, smoothing is available under Windows XP or
when @filepath{gdiplus.dll} is installed, and smoothing is available
under X when Cairo is installed before MrEd is compiled.)
under X when Cairo is installed before GRacket is compiled.)
@(begin
#readerscribble/comment-reader
@ -249,7 +249,7 @@ More complex shapes are typically best implemented with
(send dc #,(:: dc<%> draw-path) right-logo-path))
;; Create a frame to display the logo on a light-purple background:
(define f (new frame% [label "PLT Logo"]))
(define f (new frame% [label "Racket Logo"]))
(define c
(new canvas%
[parent f]

View File

@ -5,7 +5,7 @@
@title{Dynamic Loading}
@defmodule[racket/gui/dynamic]{The @racketmodname[racket/gui/dynamic]
library provides functions for dynamically accessing the PLT Racket
library provides functions for dynamically accessing the Racket
GUI toolbox, instead of directly requiring @racket[racket/gui] or
@racket[racket/gui/base].}
@ -13,8 +13,8 @@ GUI toolbox, instead of directly requiring @racket[racket/gui] or
Returns @racket[#t] if dynamic access to the GUI bindings are
available---that is, that the program is being run as a
@exec{mred}-based application, as opposed to a pure
@exec{mzracket}-based application, and that GUI modules are attached
GRacket-based application, as opposed to a pure
Racket-based application, and that GUI modules are attached
to the namespace in which @racket[racket/gui/dynamic] was
instantiated.

View File

@ -351,7 +351,7 @@ This procedure is a load handler for use with @scheme[current-load].
The handler recognizes PLT Scheme editor-format files (see
@secref["editorfileformat"]) and decodes them for loading. It is
normally installed as MrEd starts (see @secref[#:doc reference-doc
normally installed as GRacket starts (see @secref[#:doc reference-doc
"running-sa"]).
The handler recognizes editor files by the first twelve characters of

View File

@ -360,7 +360,7 @@ Editor data is read and written using @scheme[editor-stream-in%] and
@scheme[write-editor-global-footer]. Similarly, reading editors from
a stream is initialized with @scheme[read-editor-global-header] and
finalized with @scheme[read-editor-global-footer]. Optionally, to
support streams that span versions of PLT Scheme, use
support streams that span versions of Racket, use
@scheme[write-editor-version] and @scheme[read-editor-version] before
the header operations.

View File

@ -10,17 +10,17 @@ This chapter describes how to set up face mappings for screen and
especially complex X font mappings before fontconfig/Xft solved the
problem.
An implementor for a MrEd-based program may find it easier to use the
An implementor for a GRacket-based program may find it easier to use the
@method[font-name-directory<%> set-screen-name] and
@method[font-name-directory<%> set-post-script-name] methods
provided by @scheme[the-font-name-directory]. As a user of a
MrEd-based program, preferences provide a mechanism for setting
GRacket-based program, preferences provide a mechanism for setting
default mappings.
Whether a programmer or a user, see @scheme[font-name-directory<%>] for
an overview of the font mapping system.
To find a font name for a family, MrEd looks for a preference name by
To find a font name for a family, GRacket looks for a preference name by
concatenating @litchar{MrEd:}, a @nonterm{dest}, a @nonterm{type},
a @nonterm{weight}, and a @nonterm{style}, where
@ -55,7 +55,7 @@ The value of the preference is parsed as described in
Building items names by concatenating @nonterm{dest}, @nonterm{type},
@nonterm{weight}, and @nonterm{style} can create a large number of preference
entries, and the @nonterm{weight} and @nonterm{style} parts are useful only
for X screen fonts. To avoid an explosion of preferences, MrEd finds
for X screen fonts. To avoid an explosion of preferences, GRacket finds
preferences via a wildcarding search.
The @nonterm{type}, @nonterm{weight}, and @nonterm{style} parts of a preference name
@ -72,7 +72,7 @@ Wildcarded preference entries are used only when un-wildcarded values
then the one with the ``earliest'' (i.e., closest to the beginning of
the preference name) non-wildcarded part will prevail.
The default MrEd preferences for Windows uses wildcarding to specify
The default GRacket preferences for Windows uses wildcarding to specify
the basic font mapping, as if written as:
@schemeblock[
@ -99,7 +99,7 @@ Suppose we define the mapping for variants of @scheme["Default"], and
(|MrEd:ScreenRoman__| "+-*-*-medium-r-normal-*-*-%d-*-*-*-*-*-*")
]
but the MrEd font-reading system provides a better syntax for
but the GRacket font-reading system provides a better syntax for
referencing another preference entry. When a preference value contains
@litchar{${x}}, then the @litchar{${x}} fragment is replaced by the
preference value of @litchar{x}. Thus, the above can be re-written:
@ -180,19 +180,19 @@ Wildcarding can be specified in a reference by separating each
]
Since @litchar{$[weight]} is between commas, it can be wildcarded if
no name exactly matching @litchar{SchemeDefault$[weight]_} is
found. In this case @litchar{SchemeDefault} and @litchar{_} can
no name exactly matching @litchar{ScreenDefault$[weight]_} is
found. In this case @litchar{ScreenDefault} and @litchar{_} can
also be wildcarded, but this will have no effect.
The wildcarding used in references need not reflect the wildcarding
MrEd initial uses for finding fonts. In other words, a number of
GRacket initial uses for finding fonts. In other words, a number of
comma-separated selects can appear between the curly braces.
@; ------------------------------------------------------------------------
@section{Internal Preferences}
The initial font setup is built into MrEd through a built-in preference
The initial font setup is built into GRacket through a built-in preference
table. The table is shown at the end of this section. When font
information is computed, it is @italic{almost} as if this table were
installed into your preferences file; the difference is that preference
@ -201,8 +201,8 @@ The initial font setup is built into MrEd through a built-in preference
match.
When no information is available for mapping a face name to a font,
MrEd falls back to the system described in
@scheme[font-name-directory<%>]. (Since a mapping is built into MrEd
GRacket falls back to the system described in
@scheme[font-name-directory<%>]. (Since a mapping is built into GRacket
for every family, information is always available for the default
font of a family.)
@ -327,12 +327,12 @@ Internal preferences for Mac OS X only:
@section-index["CID"]
@section-index["CMap"]
To generate PostScript output, MrEd must be able to find an @|AFM|
To generate PostScript output, GRacket must be able to find an @|AFM|
(AFM) file corresponding to the PostScript font. An AFM file
typically uses the suffix @indexed-file{.afm}, and several AFM files
are distributed with MrEd in the @filepath{afm} collection.
are distributed with GRacket in the @filepath{afm} collection.
MrEd finds an AFM file by adding a @filepath{.afm} suffix to the
GRacket finds an AFM file by adding a @filepath{.afm} suffix to the
PostScript name of the font, and checking all directories specified
by the @scheme[current-ps-afm-file-paths] parameter. The initial
value of this parameter is determined by the
@ -343,43 +343,43 @@ MrEd finds an AFM file by adding a @filepath{.afm} suffix to the
Depending on whether the font is CID-based (typically for the Chinese,
Japanese, Korean, and Vietnamese language families, and as indicated
in the AFM file), MrEd must find additional files:
in the AFM file), GRacket must find additional files:
@itemize[
@item{@italic{Non-CID:} In addition to an AFM file
@filepath{@nonterm{x}.afm}, MrEd looks for a
@filepath{@nonterm{x}.afm}, GRacket looks for a
@filepath{@nonterm{x}-glyphlist.txt} file (in the same directory as the
AFM file) to map glyph names in the AFM file to Unicode character
values. In addition to this font-specific file, MrEd looks for a
values. In addition to this font-specific file, GRacket looks for a
@indexed-file{glyphlist.txt} file to supply a mapping for Adobe's
standard glyph names, and this mapping is used when a font-specific
mapping is not supplied, or when the mapping does not cover a name
found in the AFM file. MrEd looks for @filepath{glyphlist.txt} in the
found in the AFM file. GRacket looks for @filepath{glyphlist.txt} in the
same place as AFM files. Since @filepath{glyphlist.txt} is large, if a
@indexed-file{glyphshortlist.txt} file is available, it is read first,
and then @filepath{glyphlist.txt} is read only if a character name must
be resolved that is not in @filepath{glyphshortlist.txt}.}
@item{@italic{CID:} In addition to an AFM file, MrEd must find and
@item{@italic{CID:} In addition to an AFM file, GRacket must find and
read CMap files to convert glyph IDs for the font to Unicode
characters. The character set name is used as the name of the CMap
file to load, and MrEd checks all directories specified by the
file to load, and GRacket checks all directories specified by the
@scheme[current-ps-cmap-file-paths] parameter. The initial value of
this parameter is determined by the @indexed-envvar{PLTCMAPPATHS}
environment variable; the environment variable's setting is parsed
with @scheme[path-list-string->path-list] using @scheme[(list
(collection-path "afm" "CMap"))] as the default list. In addition to
a CMap file for the font's character set, MrEd must find a
a CMap file for the font's character set, GRacket must find a
@indexed-file{UniCNS-UTF32-H} CMap file to complete the mapping to
Unicode. MrEd automatically adds the font's character set to the font
Unicode. GRacket automatically adds the font's character set to the font
name when producing PostScript with a CID-based font.}
]
When drawing or measuring text using a particular PostScript font, if
the font does not contain a glyph for a character (or if a relevant
AFM file cannot be found for the font), then MrEd attempts to
AFM file cannot be found for the font), then GRacket attempts to
substitute another PostScript font. A substitute font is selected by
checking all @filepath{.afm} files in the directories specified
by @scheme[current-ps-afm-file-paths] (in order), and choosing the

View File

@ -1,20 +1,20 @@
#lang scribble/doc
@(require "common.ss")
@title{@bold{GUI}: PLT Graphics Toolkit}
@title{@bold{GUI}: Racket Graphics Toolkit}
@author["Matthew Flatt" "Robert Bruce Findler" "John Clements"]
@declare-exporting[racket/gui/base racket/gui #:use-sources (mred)]
This reference manual describes the GUI toolbox that is part of PLT
Racket and whose core is implemented by the MrEd executable.
This reference manual describes the GUI toolbox that is part of Racket
and whose core is implemented by the GRacket executable.
@defmodule*/no-declare[(racket/gui/base)]{The
@racketmodname[racket/gui/base] library provides all of the class,
interface, and procedure bindings defined in this manual. At run time,
this library needs primitive graphics support that the MrEd executable
provides; this library cannot run in MzRacket.}
this library needs primitive graphics support that the GRacket executable
provides; this library cannot run inside the Racket executable.}
@defmodulelang*/no-declare[(racket/gui)]{The
@racketmodname[racket/gui] language combines all bindings of the

View File

@ -90,8 +90,8 @@ The result depends on @scheme[what], and a @scheme[#f] result is only
platform-specific:
@itemize[
@item{@|AllUnix|: @indexed-file{.mredrc}}
@item{Windows: @indexed-file{mredrc.ss}}
@item{@|AllUnix|: @indexed-file{.gracketrc}}
@item{Windows: @indexed-file{racketrc.rktl}}
]}
@ -100,7 +100,7 @@ The result depends on @scheme[what], and a @scheme[#f] result is only
@item{@scheme['x-display] returns a ``path'' whose string identifies
the X display if specified by either the @Flag{display} flag or the
@envvar{DISPLAY} environment variable when MrEd starts under X. For
@envvar{DISPLAY} environment variable when GRacket starts under X. For
other platforms, or when neither @Flag{display} nor @envvar{DISPLAY}
was specified, the result is @scheme[#f].}

View File

@ -4,15 +4,15 @@
@title[#:tag "mredprefs"]{Preferences}
MrEd supports a number of preferences for global configuration. The
MrEd preferences are stored in the common file reported by
GRacket supports a number of preferences for global configuration. The
GRacket preferences are stored in the common file reported by
@scheme[find-system-path] for @indexed-scheme['pref-file], and
preference values can be retrieved and changed through
@scheme[get-preference] and @scheme[put-preferences]. However, MrEd
@scheme[get-preference] and @scheme[put-preferences]. However, GRacket
reads most preferences once at startup (all except the
@Resource{playcmd}).
The following are the (case-sensitive) preference names used by MrEd:
The following are the (case-sensitive) preference names used by GRacket:
@itemize[
@ -62,7 +62,7 @@ The following are the (case-sensitive) preference names used by MrEd:
command; see @scheme[play-sound] for details.}
@item{@ResourceFirst{forceFocus} --- a true value enables extra
effort in MrEd to move the focus to a top-level window that is shown
effort in GRacket to move the focus to a top-level window that is shown
or raised.}
@item{@ResourceFirst{doubleClickTime} --- overrides the

View File

@ -5,7 +5,7 @@
@title[#:tag "windowing-overview"]{Windowing}
The PLT Scheme windowing toolbox provides the basic building blocks of GUI
The Racket windowing toolbox provides the basic building blocks of GUI
programs, including frames (top-level windows), modal dialogs, menus,
buttons, check boxes, text fields, and radio buttons. The toolbox
provides these building blocks via built-in classes, such as the

View File

@ -43,4 +43,4 @@ Racket installation.
]
For more information on @exec{raco}, see @other-manual['(lib
"scribblings/mzc/mzc.scrbl")].
"scribblings/raco/raco.scrbl")].

View File

@ -152,7 +152,7 @@ As a general guideline, any operation that is inlined by the
that are not inlined (including all operations if the JIT compiler is
disabled) are considered unsafe. The @exec{mzc} decompiler tool
annotates operations that can be inlined by the compiler (see
@secref[#:doc '(lib "scribblings/mzc/mzc.scrbl") "decompile"]), so the
@secref[#:doc '(lib "scribblings/raco/raco.scrbl") "decompile"]), so the
decompiler can be used to help predict parallel performance.
To more directly report what is happening in a program that uses

View File

@ -275,7 +275,7 @@ flonum-specific results that are bound with @racket[let] and consumed
by a later flonum-specific operation are unboxed within temporary
storage. Finally, the compiler can detect some flonum-valued loop
accumulators and avoid boxing of the accumulator. The bytecode
decompiler (see @secref[#:doc '(lib "scribblings/mzc/mzc.scrbl")
decompiler (see @secref[#:doc '(lib "scribblings/raco/raco.scrbl")
"decompile"]) annotates combinations where the JIT can avoid boxes with
@racketidfont{#%flonum}, @racketidfont{#%as-flonum}, and
@racketidfont{#%from-flonum}.

View File

@ -6,7 +6,7 @@
@title[#:tag "running" #:style 'toc]{Running and Creating Executables}
While developing programs, many Racket programmers use the
@seclink[#:doc '(lib "scribblings/drscheme/drscheme.scrbl")
@seclink[#:doc '(lib "scribblings/drracket/drracket.scrbl")
"top"]{DrRacket} programming environment. To run a program without the
development environment, use @exec{racket} (for console-based
programs) or @exec{gracket} (for GUI programs). This chapter mainly
@ -167,7 +167,8 @@ instead of @racketmodname[racket/init].
@section[#:tag "exe"]{Creating Stand-Alone Executables}
@(define mzc-doc '(lib "scribblings/mzc/mzc.scrbl"))
@(define raco-doc '(lib "scribblings/raco/raco.scrbl"))
For information on creating and distributing executables, see
@secref[#:doc mzc-doc "sa"] in @other-manual[mzc-doc].
@secref[#:doc raco-doc "exe"] and @secref[#:doc raco-doc "exe-dist"] in
@other-manual[raco-doc].

View File

@ -173,7 +173,7 @@ options:
@item{From a command-line prompt, run @exec{raco exe
@nonterm{src-filename}}, where @nonterm{src-filename} contains
the program. See @secref[#:doc '(lib
"scribblings/mzc/mzc.scrbl") "exe"] for more information.}
"scribblings/raco/raco.scrbl") "exe"] for more information.}
@item{With Unix or Mac OS X, you can turn the program file into an
executable script by inserting the line
@ -206,16 +206,16 @@ tempted to put just
(substring str 4 7))
]
into @filepath{extract.scm} and run @exec{racket} with
into @filepath{extract.rktl} and run @exec{racket} with
@interaction[
#:eval piece-eval
(eval:alts (load "extract.scm") (void))
(eval:alts (load "extract.rktl") (void))
(extract "the dog out")
]
That will work, because @exec{racket} is willing to imitate a
traditional Scheme environment, but we strongly recommend against using
traditional Lisp environment, but we strongly recommend against using
@racket[load] or writing programs outside of a module.
Writing definitions outside of a module leads to bad error messages,

View File

@ -4,7 +4,7 @@
@title{Custodians}
When an extension allocates resources that must be explicitly freed
(in the same way that a port must be explicitly closed), a Scheme
(in the same way that a port must be explicitly closed), a Racket
object associated with the resource should be placed into the
management of the current custodian with @cppi{scheme_add_managed}.
@ -93,7 +93,7 @@ Instructs the custodian @var{m} to shutdown all of its managed values.}
[Scheme_Exit_Closer_Func f])]{
Installs a function to be called on each custodian-registered item and
its closer when MzScheme is about to exit. The registered function
its closer when Racket is about to exit. The registered function
has the type
@verbatim[#:indent 2]{

View File

@ -3,7 +3,7 @@
@title{Evaluation}
A Scheme S-expression is evaluated by calling @cppi{scheme_eval}.
A Racket S-expression is evaluated by calling @cppi{scheme_eval}.
This function takes an S-expression (as a @cpp{Scheme_Object*}) and a
namespace and returns the value of the expression in that namespace.
@ -12,7 +12,7 @@ a procedure, the number of arguments to pass to the procedure, and an
array of @cpp{Scheme_Object *} arguments. The return value is the
result of the application. There is also a function
@cppi{scheme_apply_to_list}, which takes a procedure and a list
(constructed with @cppi{scheme_make_pair}) and performs the Scheme
(constructed with @cppi{scheme_make_pair}) and performs the Racket
@scheme[apply] operation.
The @cppi{scheme_eval} function actually calls @cppi{scheme_compile}
@ -43,15 +43,15 @@ see @secref["exceptions"].
@section-index{tail recursion}
All of Scheme's built-in functions and syntax support proper
All of Racket's built-in functions and syntax support proper
tail-recursion. When a new primitive procedure or syntax is added to
Scheme, special care must be taken to ensure that tail recursion is
Racket, special care must be taken to ensure that tail recursion is
handled properly. Specifically, when the final return value of a
function is the result of an application, then
@cppi{scheme_tail_apply} should be used instead of
@cppi{scheme_apply}. When @cppi{scheme_tail_apply} is called, it
postpones the procedure application until control returns to the
Scheme evaluation loop.
Racket evaluation loop.
For example, consider the following implementation of a
@scheme[thunk-or] primitive, which takes any number of thunks and
@ -158,9 +158,9 @@ Non-top-level version of @cpp{scheme_eval_compiled_multi}. (See @secref["topleve
@function[(Scheme_Env* scheme_basic_env)]{
Creates the main namespace for an embedded PLT Scheme. This procedure
must be called before other Scheme library function (except
@cpp{scheme_make_param}). Extensions to Scheme cannot call this
Creates the main namespace for an embedded Racket. This procedure
must be called before other Racket library function (except
@cpp{scheme_make_param}). Extensions to Racket cannot call this
function.
If it is called more than once, this function resets all threads
@ -176,7 +176,7 @@ Creates and returns a new namespace. This values can be cast to
a parameterization using @cppi{scheme_set_param} with
@cppi{MZCONFIG_ENV}.
When PLT Scheme is embedded in an application, create the initial
When Racket is embedded in an application, create the initial
namespace with @cppi{scheme_basic_env} before calling this procedure
to create new namespaces.}

View File

@ -3,7 +3,7 @@
@title[#:tag "exceptions"]{Exceptions and Escape Continuations}
When Scheme encounters an error, it raises an exception. The default
When Racket encounters an error, it raises an exception. The default
exception handler invokes the error display handler and then the error
escape handler. The default error escape handler escapes via a
@defterm{primitive error escape}, which is implemented by calling
@ -12,7 +12,7 @@ escape handler. The default error escape handler escapes via a
An embedding program should install a fresh buffer into
@cpp{scheme_current_thread->error_buf} and call
@cpp{scheme_setjmp(*scheme_current_thread->error_buf)} before any
top-level entry into Scheme evaluation to catch primitive error
top-level entry into Racket evaluation to catch primitive error
escapes. When the new buffer goes out of scope, restore the original
in @cpp{scheme_current_thread->error_buf}. The macro
@cppi{scheme_error_buf} is a shorthand for
@ -47,12 +47,12 @@ New primitive procedures can raise a generic exception by calling
function @cpp{printf}. A specific primitive exception can be raised by
calling @cppi{scheme_raise_exn}.
Full @as-index{continuations} are implemented in Scheme by copying
Full @as-index{continuations} are implemented in Racket by copying
the C stack and using @cppi{scheme_setjmp} and @cppi{scheme_longjmp}.
As long a C/C++ application invokes Scheme evaluation through the
As long a C/C++ application invokes Racket evaluation through the
top-level evaluation functions (@cpp{scheme_eval}, @cpp{scheme_apply},
etc., as opposed to @cpp{_scheme_apply}, @cpp{_scheme_eval_compiled},
etc.), the code is protected against any unusual behavior from Scheme
etc.), the code is protected against any unusual behavior from Racket
evaluations (such as returning twice from a function) because
continuation invocations are confined to jumps within a single
top-level evaluation. However, escape continuation jumps are still
@ -109,11 +109,11 @@ calls top-level evaluation functions (@cpp{scheme_eval},
@cpp{_scheme_eval_compiled}, etc.). Otherwise, use
@cppi{scheme_dynamic_wind} to protect your code against full
continuation jumps in the same way that @scheme[dynamic-wind] is used
in Scheme.
in Racket.
The above solution simply traps the escape; it doesn't report the
reason that the escape occurred. To catch exceptions and obtain
information about the exception, the simplest route is to mix Scheme
information about the exception, the simplest route is to mix Racket
code with C-implemented thunks. The code below can be used to catch
exceptions in a variety of situations. It implements the function
@cpp{_apply_catch_exceptions}, which catches exceptions during the
@ -148,7 +148,7 @@ application of a thunk. (This code is in
}
}
/* This function applies a thunk, returning the Scheme value if
/* This function applies a thunk, returning the Racket value if
there's no exception, otherwise returning NULL and setting *exn
to the raised value (usually an exn structure). */
Scheme_Object *_apply_thunk_catch_exceptions(Scheme_Object *f,
@ -184,9 +184,11 @@ In the following example, the above code is used to catch exceptions
that occur during while evaluating source code from a string.
@verbatim[#:indent 2]{
static Scheme_Object *do_eval(void *s, int noargc, Scheme_Object **noargv)
static Scheme_Object *do_eval(void *s, int noargc,
Scheme_Object **noargv)
{
return scheme_eval_string((char *)s, scheme_get_env(scheme_config));
return scheme_eval_string((char *)s,
scheme_get_env(scheme_config));
}
static Scheme_Object *eval_string_or_get_exn_message(char *s)
@ -213,12 +215,12 @@ that occur during while evaluating source code from a string.
@section{Enabling and Disabling Breaks}
When embedding PLT Scheme, asynchronous break exceptions are disabled by
When embedding Racket, asynchronous break exceptions are disabled by
default. Call @cpp{scheme_set_can_break} (which is the same as calling
the Scheme funciton @scheme[break-enabled]) to enable or disable
the Racket funciton @scheme[break-enabled]) to enable or disable
breaks. To enable or disable breaks during the dynamic extent of
another evaluation (where you would use
@scheme[with-break-parameterization] in Scheme), use
@scheme[with-break-parameterization] in Racket), use
@cppi{scheme_push_break_enable} before and
@cppi{scheme_pop_break_enable} after, instead.
@ -245,7 +247,7 @@ for @cpp{printf}, but with the following format directives:
@item{@FormatD{5} : a nul-terminated @cpp{mzchar} string}
@item{@FormatD{S} : a Scheme symbol (a @cpp{Scheme_Object*})}
@item{@FormatD{S} : a Racket symbol (a @cpp{Scheme_Object*})}
@item{@FormatD{t} : a @cpp{char} string with a @cpp{long} size (two
arguments), possibly containing a non-terminating nul byte, and
@ -255,16 +257,16 @@ for @cpp{printf}, but with the following format directives:
arguments), possibly containing a non-terminating nul character, and
possibly without a nul-terminator}
@item{@FormatD{T} : a Scheme string (a @cpp{Scheme_Object*})}
@item{@FormatD{T} : a Racket string (a @cpp{Scheme_Object*})}
@item{@FormatD{q} : a string, truncated to 253 characters, with ellipses
printed if the string is truncated}
@item{@FormatD{Q} : a Scheme string (a @cpp{Scheme_Object*}),
@item{@FormatD{Q} : a Racket string (a @cpp{Scheme_Object*}),
truncated to 253 characters, with ellipses printed if the string is
truncated}
@item{@FormatD{V} : a Scheme value (a @cpp{Scheme_Object*}),
@item{@FormatD{V} : a Racket value (a @cpp{Scheme_Object*}),
truncated according to the current error print width.}
@item{@FormatD{e} : an @cpp{errno} value, to be printed as a text
@ -282,7 +284,7 @@ for @cpp{printf}, but with the following format directives:
]
The arguments following the format string must include no more than 25
strings and Scheme values, 25 integers, and 25 floating-point
strings and Racket values, 25 integers, and 25 floating-point
numbers. (This restriction simplifies the implementation with precise
garbage collection.)}
@ -298,7 +300,7 @@ fields). The remaining arguments start with an error string and
proceed roughly as for @cpp{printf}; see @cpp{scheme_signal_error}
above for more details.
Exception ids are @cpp{#define}d using the same names as in Scheme,
Exception ids are @cpp{#define}d using the same names as in Racket,
but prefixed with ``MZ'', all letters are capitalized, and all ``:'s',
``-''s, and ``/''s are replaced with underscores. For example,
@cpp{MZEXN_FAIL_FILESYSTEM} is the exception id for a filesystem
@ -370,8 +372,8 @@ variable.}
[int count]
[int* len])]{
Converts a Scheme value into a string for the purposes of reporting an
error message. The @var{count} argument specifies how many Scheme
Converts a Racket value into a string for the purposes of reporting an
error message. The @var{count} argument specifies how many Racket
values total will appear in the error message (so the string for this
value can be scaled appropriately). If @var{len} is not @cpp{NULL}, it
is filled with the length of the returned string.}
@ -384,7 +386,7 @@ is filled with the length of the returned string.}
[Scheme_Object** argv]
[long* len])]{
Converts an array of Scheme values into a byte string, skipping the
Converts an array of Racket values into a byte string, skipping the
array element indicated by @var{which}. This function is used to
specify the ``other'' arguments to a function when one argument is bad
(thus giving the user more information about the state of the program

View File

@ -3,7 +3,7 @@
@title{Flags and Hooks}
The following flags and hooks are available when PLT Scheme is
The following flags and hooks are available when Racket is
embedded:
@itemize[
@ -14,7 +14,7 @@ embedded:
@item{@cppdef{scheme_make_stdin}, @cppdef{scheme_make_stdout},
@cppdef{scheme_make_stderr}, --- These pointers can be set to a
function that takes no arguments and returns a Scheme port
function that takes no arguments and returns a Racket port
@cpp{Scheme_Object *} to be used as the starting standard input,
output, and/or error port. The defaults are @cpp{NULL}. Setting the
initial error port is particularly important for seeing unexpected
@ -22,7 +22,7 @@ embedded:
@item{@cppdef{scheme_console_output} --- This pointer can be set to a
function that takes a string and a @cpp{long} string length; the
function will be called to display internal MzScheme warnings and
function will be called to display internal Racket warnings and
messages that possibly contain non-terminating nuls. The default is
@var{NULL}.}
@ -36,7 +36,7 @@ embedded:
@item{@cppdef{scheme_case_sensitive} --- If this flag is set to a
non-zero value before @cppi{scheme_basic_env} is called, then
MzScheme will not ignore capitalization for symbols and global
Racket will not ignore capitalization for symbols and global
variable names. The value of this flag should not change once it is
set. The default is zero.}

View File

@ -2,19 +2,19 @@
@(require "utils.ss")
@title[#:tag-prefix '(lib "scribblings/inside/inside.scrbl")
#:tag "top"]{@bold{Inside}: PLT Scheme C API}
#:tag "top"]{@bold{Inside}: Racket C API}
@author["Matthew Flatt"]
This manual describes PLT Scheme's C interface, which allows the
This manual describes Racket's C interface, which allows the
interpreter to be extended by a dynamically-loaded library, or
embedded within an arbitrary C/C++ program. The manual assumes
familiarity with PLT Scheme as described in @|MzScheme|.
familiarity with Racket as described in @|MzScheme|.
For an alternative way of dealing with foreign code, see
@other-manual['(lib "scribblings/foreign/foreign.scrbl")], which
describes the @schememodname[scheme/foreign] module for manipulating
low-level libraries and structures purely through Scheme code.
describes the @racketmodname[ffi/unsafe] module for manipulating
low-level libraries and structures purely through Racket code.
@table-of-contents[]

View File

@ -6,14 +6,14 @@
@section-index{memory}
@section-index{garbage collection}
PLT Scheme uses both @cppi{malloc} and allocation functions provided
Racket uses both @cppi{malloc} and allocation functions provided
by a garbage collector. Embedding/extension C/C++ code may use either
allocation method, keeping in mind that pointers to
garbage-collectable blocks in @cpp{malloc}ed memory are invisible
(i.e., such pointers will not prevent the block from being
garbage-collected).
PLT Scheme CGC uses a conservative garbage collector. This garbage
Racket CGC uses a conservative garbage collector. This garbage
collector normally only recognizes pointers to the beginning of
allocated objects. Thus, a pointer into the middle of a GC-allocated
string will normally not keep the string from being collected. The
@ -22,7 +22,7 @@ registers may point to the middle of a collectable object. Thus, it
is safe to loop over an array by incrementing a local pointer
variable.
PLT Scheme 3m uses a precise garbage collector that moves objects
Racket 3m uses a precise garbage collector that moves objects
during collection, in which case the C code must be instrumented to
expose local pointer bindings to the collector, and to provide tracing
procedures for (tagged) records containing pointers. This
@ -74,8 +74,8 @@ The basic collector allocation functions are:
]
@index['("globals" "in extension code")]{If} a PLT Scheme extension
stores Scheme pointers in a global or static variable, then that
@index['("globals" "in extension code")]{If} a Racket extension
stores Racket pointers in a global or static variable, then that
variable must be registered with
@cppi{scheme_register_extension_global}; this makes the pointer
visible to the garbage collector. Registered variables need not
@ -98,8 +98,8 @@ Collectable memory can be temporarily locked from collection by using
the reference-counting function @cppi{scheme_dont_gc_ptr}. Under 3m,
such locking does not prevent the object from being moved.
Garbage collection can occur during any call into Scheme or its
allocator, on anytime that Scheme has control, except during functions
Garbage collection can occur during any call into Racket or its
allocator, on anytime that Racket has control, except during functions
that are documented otherwise. The predicate and accessor macros
listed in @secref["im:stdtypes"] never trigger a collection.
@ -115,7 +115,7 @@ content of a word registered as a pointer must contain either
into an object allocated by @cpp{scheme_malloc_allow_interior}, a
pointer to an object currently allocated by another memory manager
(and therefore not into a block that is currently managed by the
collector), or a pointer to an odd-numbered address (e.g., a Scheme
collector), or a pointer to an odd-numbered address (e.g., a Racket
fixnum).
Pointers are registered in three different ways:
@ -158,7 +158,7 @@ retaining such a pointer can lead to a crash.
As explained in @secref["im:values+types"], the @cpp{scheme_make_type}
function can be used to obtain a new tag for a new type of object.
These new types are in relatively short supply for 3m; the maximum tag
is 255, and Scheme itself uses nearly 200.
is 255, and Racket itself uses nearly 200.
After allocating a new tag in 3m (and before creating instances of the
tag), a @defterm{size procedure}, a @defterm{mark procedure}, and a
@ -434,7 +434,7 @@ is not defined, so the macros can be placed into code to be compiled
for both conservative and precise collection.
The @cpp{MZ_GC_REG} and @cpp{MZ_GC_UNREG} macros must never be
used in an OS thread other than Scheme's thread.
used in an OS thread other than Racket's thread.
@; - - - - - - - - - - - - - - - - - - - - - - - -
@ -700,7 +700,7 @@ Frees memory allocated with @cpp{scheme_malloc_code}.}
[void* ptr]
[long size])]{
Registers an extension's global variable that can contain Scheme
Registers an extension's global variable that can contain Racket
pointers. The address of the global is given in @var{ptr}, and its
size in bytes in @var{size}.In addition to global variables, this
function can be used to register any permanent memory that the
@ -788,7 +788,7 @@ in the stack than @cpp{dummy}. To avoid these problems, use
Like @cpp{scheme_set_stack_base}, except for the extra
@var{stack_end} argument. If @var{stack_end} is non-@cpp{NULL}, then
it corresponds to a point of C-stack growth after which Scheme
it corresponds to a point of C-stack growth after which Racket
should attempt to handle stack overflow. The @var{stack_end} argument
should not correspond to the actual stack end, since detecting stack
overflow may take a few frames, and since handling stack overflow
@ -895,9 +895,9 @@ To remove an added finalizer, use @cpp{scheme_subtract_finalizer}.}
Installs a ``will''-like finalizer, similar to @scheme[will-register].
Scheme finalizers are called one at a time, requiring the collector
to prove that a value has become inaccessible again before calling
the next Scheme finalizer. Finalizers registered with
the next Racket finalizer. Finalizers registered with
@cpp{scheme_register_finalizer} or @cpp{scheme_add_finalizer} are
not called until all Scheme finalizers have been exhausted.
not called until all Racket finalizers have been exhausted.
See @cpp{scheme_register_finalizer}, above, for information about
the arguments.

View File

@ -4,7 +4,7 @@
@title{Miscellaneous Utilities}
The @cppi{MZSCHEME_VERSION} preprocessor macro is defined as a string
describing the version of Scheme. The @cppi{MZSCHEME_VERSION_MAJOR}
describing the version of Racket. The @cppi{MZSCHEME_VERSION_MAJOR}
and @cppi{MZSCHEME_VERSION_MINOR} macros are defined as the major and
minor version numbers, respectively.
@ -35,7 +35,7 @@ Like @cpp{scheme_equal}, but accepts an extra value for cycle
tracking. This procedure is meant to be called by a procedure
installed with @cpp{scheme_set_type_equality}.}
Returns 1 if the Scheme values are @scheme[equal?].}
Returns 1 if the Racket values are @scheme[equal?].}
@function[(long scheme_equal_hash_key
[Scheme_Object* obj])]{
@ -150,13 +150,13 @@ The same as @scheme[namespace-require].}
@function[(Scheme_Object* scheme_load
[char* file])]{
Loads the specified Scheme file, returning the value of the last
Loads the specified Racket file, returning the value of the last
expression loaded, or @cpp{NULL} if the load fails.}
@function[(Scheme_Object* scheme_load_extension
[char* filename])]{
Loads the specified Scheme extension file, returning the value provided
Loads the specified Racket extension file, returning the value provided
by the extension's initialization function.}
@function[(Scheme_Hash_Table* scheme_make_hash_table
@ -170,7 +170,7 @@ table hashes on a key's pointer address, while
@cpp{SCHEME_hash_string} uses a key as a @cpp{char*} and hashes on the
null-terminated string content. Since a hash table created with
@cpp{SCHEME_hash_string} (instead of @cpp{SCHEME_hash_ptr}) does not
use a key as a Scheme value, it cannot be used from Scheme code.
use a key as a Racket value, it cannot be used from Racket code.
Although the hash table interface uses the type @cpp{Scheme_Object*}
for both keys and values, the table functions never inspect values,
@ -212,7 +212,7 @@ that will be encountered.}
@function[(Scheme_Hash_Table* scheme_make_hash_table_equal)]{
Like @cpp{scheme_make_hash_table}, except that keys are treated as
Scheme values and hashed based on @scheme[equal?] instead of
Racket values and hashed based on @scheme[equal?] instead of
@scheme[eq?].}
@function[(void scheme_hash_set
@ -334,8 +334,8 @@ Returns the current process ``time'' in milliseconds, just like
@function[(char* scheme_banner)]{
Returns the string that is used as the Scheme startup banner.}
Returns the string that is used as the Racket startup banner.}
@function[(char* scheme_version)]{
Returns a string for the executing version of Scheme.}
Returns a string for the executing version of Racket.}

View File

@ -3,17 +3,17 @@
@title[#:tag "im:env"]{Namespaces and Modules}
A Scheme namespace (a top-level environment) is represented by a value
of type @cppi{Scheme_Env*} --- which is also a Scheme value, castable
A Racket namespace (a top-level environment) is represented by a value
of type @cppi{Scheme_Env*} --- which is also a Racket value, castable
to @cpp{Scheme_Object*}. Calling @cppi{scheme_basic_env} returns a
namespace that includes all of Scheme's standard global procedures
namespace that includes all of Racket's standard global procedures
and syntax.
The @cpp{scheme_basic_env} function must be called once by an
embedding program, before any other PLT Scheme function is called
embedding program, before any other Racket function is called
(except @cpp{scheme_make_param}), but @cpp{scheme_main_setup}
automatically calls @cpp{scheme_basic_env}. The returned namespace is
the initial current namespace for the main Scheme thread. Scheme
the initial current namespace for the main Racket thread. Racket
extensions cannot call @cpp{scheme_basic_env}.
The current thread's current namespace is available from
@ -22,7 +22,7 @@ The current thread's current namespace is available from
New values can be added as @as-index{globals} in a namespace using
@cppi{scheme_add_global}. The @cppi{scheme_lookup_global} function
takes a Scheme symbol and returns the global value for that name, or
takes a Racket symbol and returns the global value for that name, or
@cpp{NULL} if the symbol is undefined.
A @as-index{module}'s set of top-level bindings is implemented using
@ -37,8 +37,8 @@ module files). After installing variables into the module with
to make the module declaration available. All defined variables are
exported from the primitive module.
The Scheme @indexed-scheme[#%variable-reference] form produces a value
that is opaque to Scheme code. Use @cpp{SCHEME_PTR_VAL} on the result
The Racket @indexed-scheme[#%variable-reference] form produces a value
that is opaque to Racket code. Use @cpp{SCHEME_PTR_VAL} on the result
of @scheme[#%variable-reference] to obtain the same kind of value as
returned by @cpp{scheme_global_bucket} (i.e., a bucket containing the
variable's value, or @cpp{NULL} if the variable is not yet defined).
@ -95,7 +95,7 @@ The @cppi{Scheme_Bucket} structure is defined as:
Like @cpp{scheme_global_bucket}, but finds a variable in a
module. The @var{mod} and @var{symbol} arguments are as for
@scheme[dynamic-require] in Scheme. The @var{pos} argument should be
@scheme[dynamic-require] in Racket. The @var{pos} argument should be
@cpp{-1} always. The @var{env} argument represents the namespace in
which the module is declared.}

View File

@ -3,9 +3,9 @@
@title{Bignums, Rationals, and Complex Numbers}
Scheme supports integers of an arbitrary magnitude; when an integer
Racket supports integers of an arbitrary magnitude; when an integer
cannot be represented as a fixnum (i.e., 30 or 62 bits plus a sign
bit), then it is represented by the Scheme type
bit), then it is represented by the Racket type
@cppi{scheme_bignum_type}. There is no overlap in integer values
represented by fixnums and bignums.
@ -60,7 +60,7 @@ unspecified accuracy.}
@function[(float scheme_bignum_to_float
[Scheme_Object* n])]{
If PLT Scheme is not compiled with single-precision floats, this procedure
If Racket is not compiled with single-precision floats, this procedure
is actually a macro alias for @cpp{scheme_bignum_to_double}.}
@function[(Scheme_Object* scheme_bignum_from_double
@ -72,7 +72,7 @@ number @var{d}. The conversion accuracy is reasonable but unspecified.}
@function[(Scheme_Object* scheme_bignum_from_float
[float f])]{
If PLT Scheme is not compiled with single-precision floats, this procedure
If Racket is not compiled with single-precision floats, this procedure
is actually a macro alias for @cpp{scheme_bignum_from_double}.}
@function[(char* scheme_bignum_to_string
@ -121,7 +121,7 @@ Converts the rational @var{n} to a @cpp{double}.}
@function[(float scheme_rational_to_float
[Scheme_Object* n])]{
If PLT Scheme is not compiled with single-precision floats, this procedure
If Racket is not compiled with single-precision floats, this procedure
is actually a macro alias for @cpp{scheme_rational_to_double}.}
@function[(Scheme_Object* scheme_rational_numerator
@ -142,7 +142,7 @@ Converts the given @cpp{double} into a maximally-precise rational.}
@function[(Scheme_Object* scheme_rational_from_float
[float d])]{
If PLT Scheme is not compiled with single-precision floats, this procedure
If Racket is not compiled with single-precision floats, this procedure
is actually a macro alias for @cpp{scheme_rational_from_double}.}
@function[(Scheme_Object* scheme_make_complex

View File

@ -3,21 +3,31 @@
@title[#:tag "overview"]{Overview}
@section{``Scheme'' versus ``Racket''}
The old name for Racket was ``PLT Scheme,'' and the core compiler and
run-time system used to be called ``MzScheme.'' The old names are
entrenched in Racket internals, to the point that most C bindings
defined in this manual start with @cpp{scheme_}. They all should be
renamed to start @cpp{racket_}.
@; ----------------------------------------------------------------------
@section{CGC versus 3m}
Before mixing any C code with MzScheme, first decide whether to use
the @bold{3m} variant of PLT Scheme, the @bold{CGC} variant of PLT
Scheme, or both:
Before mixing any C code with Racket, first decide whether to use the
@bold{3m} variant of Racket, the @bold{CGC} variant of Racket, or
both:
@itemize[
@item{@bold{@as-index{3m}} : the main variant of PLT Scheme, which
@item{@bold{@as-index{3m}} : the main variant of Racket, which
uses @defterm{precise} garbage collection instead of conservative
garbage collection, and it may move objects in memory during a
collection.}
@item{@bold{@as-index{CGC}} : the original variant of PLT Scheme,
where memory management depends on a @defterm{conservative} garbage
@item{@bold{@as-index{CGC}} : the original variant of Racket, where
memory management depends on a @defterm{conservative} garbage
collector. The conservative garbage collector can automatically find
references to managed values from C local variables and (on some
platforms) static variables.}
@ -29,9 +39,9 @@ At the C level, working with CGC can be much easier than working with
@; ----------------------------------------------------------------------
@section{Writing MzScheme Extensions}
@section{Writing Racket Extensions}
@section-index["extending MzScheme"]
@section-index["extending Racket"]
The process of creating an extension for 3m or CGC is essentially the
same, but the process for 3m is most easily understood as a variant of
@ -40,41 +50,41 @@ the process for CGC.
@subsection{CGC Extensions}
To write a C/C++-based extension for PLT Scheme CGC, follow these
To write a C/C++-based extension for Racket CGC, follow these
steps:
@itemize[
@item{@index['("header files")]{For} each C/C++ file that uses PLT
Scheme library functions, @cpp{#include} the file
@item{@index['("header files")]{For} each C/C++ file that uses
Racket library functions, @cpp{#include} the file
@as-index{@filepath{escheme.h}}.
This file is distributed with the PLT software in an
@filepath{include} directory, but if @|mzc| is used to compile, this
path is found automatically.}
This file is distributed with the Racket software in an
@filepath{include} directory, but if @|mzc| is used to
compile, this path is found automatically.}
@item{Define the C function @cppi{scheme_initialize}, which takes a
@cpp{Scheme_Env*} namespace (see @secref["im:env"]) and returns a
@cpp{Scheme_Object*} Scheme value.
@cpp{Scheme_Object*} Racket value.
This initialization function can install new global primitive
procedures or other values into the namespace, or it can simply
return a Scheme value. The initialization function is called when the
extension is loaded with @scheme[load-extension] (the first time);
return a Racket value. The initialization function is called when the
extension is loaded with @racket[load-extension] (the first time);
the return value from @cpp{scheme_initialize} is used as the return
value for @scheme[load-extension]. The namespace provided to
value for @racket[load-extension]. The namespace provided to
@cpp{scheme_initialize} is the current namespace when
@scheme[load-extension] is called.}
@racket[load-extension] is called.}
@item{Define the C function @cppi{scheme_reload}, which has the same
arguments and return type as @cpp{scheme_initialize}.
This function is called if @scheme[load-extension] is called a second
This function is called if @racket[load-extension] is called a second
time (or more times) for an extension. Like @cpp{scheme_initialize},
the return value from this function is the return value for
@scheme[load-extension].}
@racket[load-extension].}
@item{Define the C function @cppi{scheme_module_name}, which takes
@ -84,7 +94,7 @@ steps:
The function should return a symbol when the effect of calling
@cpp{scheme_initialize} and @cpp{scheme_reload} is only to declare
a module with the returned name. This function is called when the
extension is loaded to satisfy a @scheme[require] declaration.
extension is loaded to satisfy a @racket[require] declaration.
The @cpp{scheme_module_name} function may be called before
@cpp{scheme_initialize} and @cpp{scheme_reload}, after those
@ -95,7 +105,7 @@ steps:
@item{Compile the extension C/C++ files to create platform-specific
object files.
The @as-index{@|mzc|} compiler, which is distributed with PLT Scheme,
The @as-index{@|mzc|} compiler, which is distributed with Racket,
compiles plain C files when the @as-index{@DFlag{cc}} flag is
specified. More precisely, @|mzc| does not compile the files itself,
but it locates a C compiler on the system and launches it with the
@ -104,7 +114,7 @@ steps:
compiler or @exec{gcc} in the path, or a Mac OS X system with Apple's
developer tools installed, then using @|mzc| is typically easier than
working with the C compiler directly. Use the @as-index{@DFlag{cgc}}
flag to indicate that the build is for use with PLT Scheme CGC.}
flag to indicate that the build is for use with Racket CGC.}
@item{Link the extension C/C++ files with
@ -115,50 +125,50 @@ steps:
The @filepath{mzdyn} object file is distributed in the installation's
@filepath{lib} directory. For Windows, the object file is in a
compiler-specific sub-directory of @filepath{plt\lib}.
compiler-specific sub-directory of @filepath{racket\lib}.
The @|mzc| compiler links object files into an extension when the
@as-index{@DFlag{ld}} flag is specified, automatically locating
@filepath{mzdyn}. Again, use the @DFlag{cgc} flag with @|mzc|.}
@item{Load the shared object within Scheme using
@scheme[(load-extension _path)], where @scheme[_path] is the name of
@item{Load the shared object within Racket using
@racket[(load-extension _path)], where @racket[_path] is the name of
the extension file generated in the previous step.
Alternately, if the extension defines a module (i.e.,
@cpp{scheme_module_name} returns a symbol), then place the shared
object in a special directory with a special name, so that it is
detected by the module loader when @scheme[require] is used. The
detected by the module loader when @racket[require] is used. The
special directory is a platform-specific path that can be obtained by
evaluating @scheme[(build-path "compiled" "native"
(system-library-subpath))]; see @scheme[load/use-compiled] for more
evaluating @racket[(build-path "compiled" "native"
(system-library-subpath))]; see @racket[load/use-compiled] for more
information. For example, if the shared object's name is
@filepath{example_ss.dll}, then @scheme[(require "example.ss")] will
be redirected to @filepath{example_ss.dll} if the latter is placed in
the sub-directory @scheme[(build-path "compiled" "native"
(system-library-subpath))] and if @filepath{example.ss} does not
@filepath{example_rkt.dll}, then @racket[(require "example.rkt")] will
be redirected to @filepath{example_rkt.dll} if the latter is placed in
the sub-directory @racket[(build-path "compiled" "native"
(system-library-subpath))] and if @filepath{example.rkt} does not
exist or has an earlier timestamp.
Note that @scheme[(load-extension _path)] within a @scheme[module]
Note that @racket[(load-extension _path)] within a @racket[module]
does @italic{not} introduce the extension's definitions into the
module, because @scheme[load-extension] is a run-time operation. To
module, because @racket[load-extension] is a run-time operation. To
introduce an extension's bindings into a module, make sure that the
extension defines a module, put the extension in the
platform-specific location as described above, and use
@scheme[require].}
@racket[require].}
]
@index['("allocation")]{@bold{IMPORTANT:}} With PLT Scheme CGC, Scheme
@index['("allocation")]{@bold{IMPORTANT:}} With Racket CGC, Racket
values are garbage collected using a conservative garbage collector,
so pointers to Scheme objects can be kept in registers, stack
so pointers to Racket objects can be kept in registers, stack
variables, or structures allocated with @cppi{scheme_malloc}. However,
static variables that contain pointers to collectable memory must be
registered using @cppi{scheme_register_extension_global} (see
@secref["im:memoryalloc"]).
As an example, the following C code defines an extension that returns
@scheme["hello world"] when it is loaded:
@racket["hello world"] when it is loaded:
@verbatim[#:indent 2]{
#include "escheme.h"
@ -176,18 +186,18 @@ As an example, the following C code defines an extension that returns
Assuming that this code is in the file @filepath{hw.c}, the extension
is compiled under Unix with the following two commands:
@commandline{mzc --cgc --cc hw.c}
@commandline{mzc --cgc --ld hw.so hw.o}
@commandline{raco ctool --cgc --cc hw.c}
@commandline{raco ctool --cgc --ld hw.so hw.o}
(Note that the @DFlag{cgc}, @DFlag{cc}, and @DFlag{ld} flags are each
prefixed by two dashes, not one.)
The @filepath{collects/mzscheme/examples} directory in the PLT
The @filepath{collects/mzscheme/examples} directory in the Racket
distribution contains additional examples.
@subsection{3m Extensions}
To build an extension to work with PLT Scheme 3m, the CGC instructions
To build an extension to work with Racket 3m, the CGC instructions
must be extended as follows:
@itemize[
@ -213,12 +223,12 @@ must be extended as follows:
For a relatively simple extension @filepath{hw.c}, the extension is
compiled under Unix for 3m with the following three commands:
@commandline{mzc --xform hw.c}
@commandline{mzc --3m --cc hw.3m.c}
@commandline{mzc --3m --ld hw.so hw.o}
@commandline{raco ctool --xform hw.c}
@commandline{raco ctool --3m --cc hw.3m.c}
@commandline{raco ctool --3m --ld hw.so hw.o}
Some examples in @filepath{collects/mzscheme/examples} work with
MzScheme3m in this way. A few examples are manually instrumented, in
Racket 3m in this way. A few examples are manually instrumented, in
which case the @DFlag{xform} step should be skipped.
@subsection{Declaring a Module in an Extension}
@ -228,7 +238,7 @@ To create an extension that behaves as a module, return a symbol from
@cpp{scheme_rename} declare a module using @cpp{scheme_primitive_module}.
For example, the following extension implements a module named
@scheme[hello] that exports a binding @scheme[greeting]:
@racket[hello] that exports a binding @racket[greeting]:
@verbatim[#:indent 2]{
#include "escheme.h"
@ -253,96 +263,96 @@ For example, the following extension implements a module named
}
}
This extension could be compiled for 3m on Mac OS X for i386, for
This extension could be compiled for 3m on i386 Linux, for
example, using the following sequence of @exec{mzc} commands:
@commandline{mzc --xform hi.c}
@commandline{mzc --3m --cc hi.3m.c}
@commandline{mkdir -p compiled/native/i386-macosx/3m}
@commandline{mzc --3m --ld compiled/native/i386-macosx/3m/hi_ss.dylib hi_3m.o}
@commandline{raco ctool --xform hi.c}
@commandline{raco ctool --3m --cc hi.3m.c}
@commandline{mkdir -p compiled/native/i386-linux/3m}
@commandline{raco ctool --3m --ld compiled/native/i386-linux/3m/hi_rkt.so hi_3m.o}
The resulting module can be loaded with
@schemeblock[(require "hi.ss")]
@racketblock[(require "hi.rkt")]
@; ----------------------------------------------------------------------
@section[#:tag "embedding"]{Embedding MzScheme into a Program}
@section[#:tag "embedding"]{Embedding Racket into a Program}
@section-index["embedding MzScheme"]
@section-index["embedding Racket"]
Like creating extensions, the embedding process for PLT Scheme CGC or
PLT Scheme 3m is essentially the same, but the process for PLT Scheme
Like creating extensions, the embedding process for Racket CGC or
Racket 3m is essentially the same, but the process for Racket
3m is most easily understood as a variant of the process for
PLT Scheme CGC.
Racket CGC.
@subsection{CGC Embedding}
To embed PLT Scheme CGC in a program, follow these steps:
To embed Racket CGC in a program, follow these steps:
@itemize[
@item{Locate or build the PLT Scheme CGC libraries. Since the
@item{Locate or build the Racket CGC libraries. Since the
standard distribution provides 3m libraries, only, you will most
likely have to build from source.
Under Unix, the libraries are @as-index{@filepath{libmzscheme.a}}
Under Unix, the libraries are @as-index{@filepath{libracket.a}}
and @as-index{@filepath{libmzgc.a}} (or
@as-index{@filepath{libmzscheme.so}} and
@as-index{@filepath{libracket.so}} and
@as-index{@filepath{libmzgc.so}} for a dynamic-library build, with
@as-index{@filepath{libmzscheme.la}} and
@as-index{@filepath{libracket.la}} and
@as-index{@filepath{libmzgc.la}} files for use with
@exec{libtool}). Building from source and installing places the
libraries into the installation's @filepath{lib} directory. Be sure
to build the CGC variant, since the default is 3m.
Under Windows, stub libraries for use with Microsoft tools are
@filepath{libmzsch@italic{x}.lib} and
@filepath{libracket@italic{x}.lib} and
@filepath{libmzgc@italic{x}.lib} (where @italic{x} represents the
version number) are in a compiler-specific directory in
@filepath{plt\lib}. These libraries identify the bindings that are
provided by @filepath{libmzsch@italic{x}.dll} and
@filepath{racket\lib}. These libraries identify the bindings that are
provided by @filepath{libracket@italic{x}.dll} and
@filepath{libmzgc@italic{x}.dll} --- which are typically installed
in @filepath{plt\lib}. When linking with Cygwin, link to
@filepath{libmzsch@italic{x}.dll} and
in @filepath{racket\lib}. When linking with Cygwin, link to
@filepath{libracket@italic{x}.dll} and
@filepath{libmzgc@italic{x}.dll} directly. At run time, either
@filepath{libmzsch@italic{x}.dll} and
@filepath{libracket@italic{x}.dll} and
@filepath{libmzgc@italic{x}.dll} must be moved to a location in the
standard DLL search path, or your embedding application must
``delayload'' link the DLLs and explicitly load them before
use. (@filepath{MzScheme.exe} and @filepath{MrEd.exe} use the latter
use. (@filepath{Racket.exe} and @filepath{MrEd.exe} use the latter
strategy.)
Under Mac OS X, dynamic libraries are provided by the
@filepath{PLT_MzScheme} framework, which is typically installed in
@filepath{Racket} framework, which is typically installed in
@filepath{lib} sub-directory of the installation. Supply
@exec{-framework PLT_MzScheme} to @exec{gcc} when linking, along
@exec{-framework Racket} to @exec{gcc} when linking, along
with @exec{-F} and a path to the @filepath{lib} directory. Beware
that CGC and 3m libraries are installed as different versions within
a single framework, and installation marks one version or the other
as the default (by setting symbolic links); install only CGC to
simplify accessing the CGC version within the framework. At run
time, either @filepath{PLT_MzScheme.framework} must be moved to a
time, either @filepath{Racket.framework} must be moved to a
location in the standard framework search path, or your embedding
executable must provide a specific path to the framework (possibly
an executable-relative path using the Mach-O @tt["@executable_path"]
prefix).}
@item{For each C/C++ file that uses MzScheme library functions,
@item{For each C/C++ file that uses Racket library functions,
@cpp{#include} the file @as-index{@filepath{scheme.h}}.
The C preprocessor symbol @cppi{SCHEME_DIRECT_EMBEDDED} is defined
as @cpp{1} when @filepath{scheme.h} is @cpp{#include}d, or as
@cpp{0} when @filepath{escheme.h} is @cpp{#include}d.
The @filepath{scheme.h} file is distributed with the PLT software in
The @filepath{scheme.h} file is distributed with the Racket software in
the installation's @filepath{include} directory. Building and
installing from source also places this file in the installation's
@filepath{include} directory.}
@item{Start your main program through the @cpp{scheme_main_setup} (or
@cpp{scheme_main_stack_setup}) trampoline, and put all uses of
MzScheme functions inside the function passed to
Racket functions inside the function passed to
@cpp{scheme_main_setup}. The @cpp{scheme_main_setup} function
registers the current C stack location with the memory manager. It
also creates the initial namespace @cpp{Scheme_Env*} by calling
@ -353,11 +363,11 @@ To embed PLT Scheme CGC in a program, follow these steps:
@item{Configure the namespace by adding module declarations. The
initial namespace contains declarations only for a few primitive
modules, such as @scheme['#%kernel], and no bindings are imported
modules, such as @racket['#%kernel], and no bindings are imported
into the top-level environment.
To embed a module like @schememodname[scheme/base] (along with all
its dependencies), use @exec{mzc --c-mods}, which generates a C file
To embed a module like @racketmodname[racket/base] (along with all
its dependencies), use @exec{raco ctool --c-mods}, which generates a C file
that contains modules in bytecode form as encapsulated in a static
array. The generated C file defines a @cppi{declare_modules}
function that takes a @cpp{Scheme_Env*}, installs the modules into
@ -368,7 +378,7 @@ To embed PLT Scheme CGC in a program, follow these steps:
@cpp{scheme_init_collection_paths} to configure and install a path
for finding modules at run time.}
@item{Access Scheme through @cppi{scheme_dynamic_require},
@item{Access Racket through @cppi{scheme_dynamic_require},
@cppi{scheme_load}, @cppi{scheme_eval}, and/or other functions
described in this manual.
@ -379,13 +389,13 @@ To embed PLT Scheme CGC in a program, follow these steps:
certain privileged operations, such as installing a @|PLaneT|
package.}
@item{Compile the program and link it with the MzScheme libraries.}
@item{Compile the program and link it with the Racket libraries.}
]
@index['("allocation")]{With} PLT Scheme CGC, Scheme values are
@index['("allocation")]{With} Racket CGC, Racket values are
garbage collected using a conservative garbage collector, so pointers
to Scheme objects can be kept in registers, stack variables, or
to Racket objects can be kept in registers, stack variables, or
structures allocated with @cppi{scheme_malloc}. In an embedding
application on some platforms, static variables are also automatically
registered as roots for garbage collection (but see notes below
@ -393,12 +403,12 @@ specific to Mac OS X and Windows).
For example, the following is a simple embedding program which
evaluates all expressions provided on the command line and displays
the results, then runs a @scheme[read]-@scheme[eval]-@scheme[print]
the results, then runs a @racket[read]-@racket[eval]-@racket[print]
loop. Run
@commandline{mzc --c-mods base.c ++lib scheme/base}
@commandline{raco ctool --c-mods base.c ++lib racket/base}
to generate @filepath{base.c}, which encapsulates @scheme[scheme/base]
to generate @filepath{base.c}, which encapsulates @racket[racket/base]
and all of its transitive imports (so that they need not be found
separately a run time).
@ -416,7 +426,7 @@ static int run(Scheme_Env *e, int argc, char *argv[])
/* Declare embedded modules in "base.c": */
declare_modules(e);
scheme_namespace_require(scheme_intern_symbol("scheme/base"));
scheme_namespace_require(scheme_intern_symbol("racket/base"));
curout = scheme_get_param(scheme_current_config(),
MZCONFIG_OUTPUT_PORT);
@ -433,7 +443,7 @@ static int run(Scheme_Env *e, int argc, char *argv[])
scheme_display(v, curout);
scheme_display(scheme_make_char('\n'), curout);
/* read-eval-print loop, uses initial Scheme_Env: */
a[0] = scheme_intern_symbol("scheme/base");
a[0] = scheme_intern_symbol("racket/base");
a[1] = scheme_intern_symbol("read-eval-print-loop");
scheme_apply(scheme_dynamic_require(2, a), 0, NULL);
scheme_current_thread->error_buf = save;
@ -448,7 +458,7 @@ int main(int argc, char *argv[])
}
}
Under Mac OS X, or under Windows when MzScheme is compiled to a DLL
Under Mac OS X, or under Windows when Racket is compiled to a DLL
using Cygwin, the garbage collector cannot find static variables
automatically. In that case, @cppi{scheme_main_setup} must be called with a
non-zero first argument.
@ -467,7 +477,7 @@ pointer. For example, if @cpp{curout} above is made @cpp{static}, then
@cpp{MZ_REGISTER_STATIC(curout)} should be inserted before the call to
@cpp{scheme_get_param}.
When building an embedded MzSchemeCGC to use SenoraGC (SGC) instead of
When building an embedded Racket CGC to use SenoraGC (SGC) instead of
the default collector, @cpp{scheme_main_setup} must be called with a
non-zero first argument. See @secref["im:memoryalloc"] for more
information.
@ -475,7 +485,7 @@ information.
@subsection{3m Embedding}
MzScheme3m can be embedded mostly the same as MzScheme, as long as the
Racket 3m can be embedded mostly the same as Racket, as long as the
embedding program cooperates with the precise garbage collector as
described in @secref["im:3m"].
@ -489,31 +499,31 @@ In addition, some library details are different:
@itemize[
@item{Under Unix, the library is just
@as-index{@filepath{libmzscheme3m.a}} (or
@as-index{@filepath{libmzscheme3m.so}} for a dynamic-library build,
with @as-index{@filepath{libmzscheme3m.la}} for use with
@as-index{@filepath{libracket3m.a}} (or
@as-index{@filepath{libracket3m.so}} for a dynamic-library build,
with @as-index{@filepath{libracket3m.la}} for use with
@exec{libtool}). There is no separate library for 3m analogous to
CGC's @filepath{libmzgc.a}.}
@item{Under Windows, the stub library for use with Microsoft tools is
@filepath{libmzsch3m@italic{x}.lib} (where @italic{x} represents the
@filepath{libracket3m@italic{x}.lib} (where @italic{x} represents the
version number). This library identifies the bindings that are
provided by @filepath{libmzsch3m@italic{x}.dll}. There is no
provided by @filepath{libracket3m@italic{x}.dll}. There is no
separate library for 3m analogous to CGC's
@filepath{libmzgc@italic{x}.lib}.}
@item{Under Mac OS X, 3m dynamic libraries are provided by the
@filepath{PLT_MzScheme} framework, just as for CGC, but as a version
@filepath{Racket} framework, just as for CGC, but as a version
suffixed with @filepath{_3m}.}
]
For MzScheme3m, an embedding application must call @cpp{scheme_main_setup}
For Racket 3m, an embedding application must call @cpp{scheme_main_setup}
with a non-zero first argument.
The simple embedding program from the previous section can be
processed by @exec{mzc --xform}, then compiled and linked with
MzScheme3m. Alternately, the source code can be extended to work with
processed by @exec{raco ctool --xform}, then compiled and linked with
Racket 3m. Alternately, the source code can be extended to work with
either CGC or 3m depending on whether @cpp{MZ_PRECISE_GC} is defined
on the compiler's command line:
@ -541,7 +551,7 @@ static int run(Scheme_Env *e, int argc, char *argv[])
declare_modules(e);
v = scheme_intern_symbol("scheme/base");
v = scheme_intern_symbol("racket/base");
scheme_namespace_require(v);
config = scheme_current_config();
@ -559,7 +569,7 @@ static int run(Scheme_Env *e, int argc, char *argv[])
v = scheme_make_char('\n');
scheme_display(v, curout);
/* read-eval-print loop, uses initial Scheme_Env: */
a[0] = scheme_intern_symbol("scheme/base");
a[0] = scheme_intern_symbol("racket/base");
a[1] = scheme_intern_symbol("read-eval-print-loop");
v = scheme_dynamic_require(2, a);
scheme_apply(v, 0, NULL);
@ -586,22 +596,22 @@ and when all temporary values are put into variables.
@; ----------------------------------------------------------------------
@section{MzScheme and Threads}
@section{Racket and Threads}
MzScheme implements threads for Scheme programs without aid from the
operating system, so that MzScheme threads are cooperative from the
perspective of C code. Under Unix, stand-alone MzScheme uses a single
Racket implements threads for Racket programs without aid from the
operating system, so that Racket threads are cooperative from the
perspective of C code. Under Unix, stand-alone Racket uses a single
OS-implemented thread. Under Windows and Mac OS X, stand-alone
MzScheme uses a few private OS-implemented threads for background
Racket uses a few private OS-implemented threads for background
tasks, but these OS-implemented threads are never exposed by the
MzScheme API.
Racket API.
In an embedding application, MzScheme can co-exist with additional
In an embedding application, Racket can co-exist with additional
OS-implemented threads, but the additional OS threads must not call
any @cpp{scheme_} function. Only the OS thread that originally calls
@cpp{scheme_basic_env} can call @cpp{scheme_} functions. (This
restriction is stronger than saying all calls must be serialized
across threads. MzScheme relies on properties of specific threads to
across threads. Racket relies on properties of specific threads to
avoid stack overflow and garbage collection.) When
@cpp{scheme_basic_env} is called a second time to reset the
interpreter, it can be called in an OS thread that is different from
@ -609,19 +619,19 @@ the original call to @cpp{scheme_basic_env}. Thereafter, all calls to
@cpp{scheme_} functions must originate from the new thread.
See @secref["threads"] for more information about threads, including
the possible effects of MzScheme's thread implementation on extension
the possible effects of Racket's thread implementation on extension
and embedding C code.
@; ----------------------------------------------------------------------
@section[#:tag "im:unicode"]{MzScheme, Unicode, Characters, and Strings}
@section[#:tag "im:unicode"]{Racket, Unicode, Characters, and Strings}
A character in MzScheme is a Unicode code point. In C, a character
A character in Racket is a Unicode code point. In C, a character
value has type @cppi{mzchar}, which is an alias for @cpp{unsigned} ---
which is, in turn, 4 bytes for a properly compiled MzScheme. Thus, a
which is, in turn, 4 bytes for a properly compiled Racket. Thus, a
@cpp{mzchar*} string is effectively a UCS-4 string.
Only a few MzScheme functions use @cpp{mzchar*}. Instead, most
Only a few Racket functions use @cpp{mzchar*}. Instead, most
functions accept @cpp{char*} strings. When such byte strings are to be
used as a character strings, they are interpreted as UTF-8
encodings. A plain ASCII string is always acceptable in such cases,
@ -633,7 +643,7 @@ See also @secref["im:strings"] and @secref["im:encodings"].
@section[#:tag "im:intsize"]{Integers}
MzScheme expects to be compiled in a mode where @cppi{short} is a
Racket expects to be compiled in a mode where @cppi{short} is a
16-bit integer, @cppi{int} is a 32-bit integer, and @cppi{long} has
the same number of bits as @cpp{void*}. The @cppi{mzlonglong} type has
64 bits for compilers that support a 64-bit integer type, otherwise it

View File

@ -3,7 +3,7 @@
@title{Ports and the Filesystem}
Ports are represented as Scheme values with the types
Ports are represented as Racket values with the types
@cppi{scheme_input_port_type} and @cppi{scheme_output_port_type}. The
function @cppi{scheme_read} takes an input port value and returns the
next S-expression from the port. The function @cppi{scheme_write}
@ -23,7 +23,7 @@ The contents of a string output port are obtained with
Custom ports, with arbitrary read/write handlers, are created with
@cppi{scheme_make_input_port} and @cppi{scheme_make_output_port}.
When opening a file for any reason using a name provided from Scheme,
When opening a file for any reason using a name provided from Racket,
use @cppi{scheme_expand_filename} to normalize the filename and
resolve relative paths.
@ -50,7 +50,7 @@ Like @cpp{scheme_write}, but the printing is truncated to @var{n} bytes.
[Scheme_Object* obj]
[Scheme_Object* port])]{
@scheme[display]s the Scheme value @var{obj} to the given output
@scheme[display]s the Racket value @var{obj} to the given output
port.}
@function[(void scheme_display_w_max
@ -119,7 +119,7 @@ without the non-blocking option.}
[Scheme_Object* obj]
[long* len])]{
Prints the Scheme value @var{obj} using @scheme[write] to a newly
Prints the Racket value @var{obj} using @scheme[write] to a newly
allocated string. If @var{len} is not @cpp{NULL}, @cpp{*@var{len}} is
set to the length of the bytes string.}
@ -136,7 +136,7 @@ Like @cpp{scheme_write_to_string}, but the string is truncated to
[Scheme_Object* obj]
[long* len])]{
Prints the Scheme value @var{obj} using @scheme[display] to a newly
Prints the Racket value @var{obj} using @scheme[display] to a newly
allocated string. If @var{len} is not @cpp{NULL}, @cpp{*@var{len}} is
set to the length of the string.}
@ -154,7 +154,7 @@ Like @cpp{scheme_display_to_string}, but the string is truncated to
@function[(void scheme_debug_print
[Scheme_Object* obj])]{
Prints the Scheme value @var{obj} using @scheme[write] to the main
Prints the Racket value @var{obj} using @scheme[write] to the main
thread's output port.}
@function[(void scheme_flush_output
@ -423,7 +423,7 @@ The functions are as follows.
in @var{unless} becomes ready before bytes can be read. In
particular, @var{get_bytes_fun} should check the event in
@var{unless} before taking any action, and it should check the
event in @var{unless} after any operation that may allow Scheme
event in @var{unless} after any operation that may allow Racket
thread swaps. If the read must block, then it should unblock if
the event in @var{unless} becomes ready.
@ -439,7 +439,7 @@ The functions are as follows.
use @cpp{scheme_block_until_unless} instead of
@cpp{scheme_block_until}. Finally, in blocking mode,
@var{get_bytes_fun} must return after immediately reading data,
without allowing a Scheme thread swap.}
without allowing a Racket thread swap.}
@subfunction[(long peek_bytes_fun
[Scheme_Input_Port* port]
@ -652,7 +652,7 @@ Opens @var{filename} for reading. In an exception is raised, the
[FILE* fp]
[Scheme_Object* name])]{
Creates a Scheme input file port from an ANSI C file pointer. The file
Creates a Racket input file port from an ANSI C file pointer. The file
must never block on reads. The @var{name} argument is used as the
port's name.}
@ -667,7 +667,7 @@ Opens @var{filename} for writing in @scheme['truncate/replace] mode. If
@function[(Scheme_Object* scheme_make_file_output_port
[FILE* fp])]{
Creates a Scheme output file port from an ANSI C file pointer. The
Creates a Racket output file port from an ANSI C file pointer. The
file must never block on writes.}
@function[(Scheme_Object* scheme_make_fd_input_port
@ -676,7 +676,7 @@ Creates a Scheme output file port from an ANSI C file pointer. The
[int regfile]
[int win_textmode])]{
Creates a Scheme input port for a file descriptor @var{fd}. Under
Creates a Racket input port for a file descriptor @var{fd}. Under
Windows, @var{fd} can be a @cpp{HANDLE} for a stream, and it should
never be a file descriptor from the C library or a WinSock socket.
@ -702,7 +702,7 @@ Instead of calling both @cpp{scheme_make_fd_input_port} and
[int win_textmode]
[int read_too])]{
Creates a Scheme output port for a file descriptor @var{fd}. Under
Creates a Racket output port for a file descriptor @var{fd}. Under
Windows, @var{fd} can be a @cpp{HANDLE} for a stream, and it should
never be a file descriptor from the C library or a WinSock socket.
@ -729,7 +729,7 @@ If @var{read_too} is non-zero, the function produces multiple values
[Scheme_Object** inp]
[Scheme_Object** outp])]{
Creates Scheme input and output ports for a TCP socket @var{s}. The
Creates Racket input and output ports for a TCP socket @var{s}. The
@var{name} argument supplies the name for the ports. If @var{close}
is non-zero, then the ports assume responsibility for closing the
socket. The resulting ports are written to @var{inp} and @var{outp}.}
@ -737,13 +737,13 @@ Creates Scheme input and output ports for a TCP socket @var{s}. The
@function[(Scheme_Object* scheme_make_byte_string_input_port
[char* str])]{
Creates a Scheme input port from a byte string; successive
Creates a Racket input port from a byte string; successive
@scheme[read-char]s on the port return successive bytes in the
string.}
@function[(Scheme_Object* scheme_make_byte_string_output_port)]{
Creates a Scheme output port; all writes to the port are kept in a byte string,
Creates a Racket output port; all writes to the port are kept in a byte string,
which can be obtained with @cpp{scheme_get_byte_string_output}.}
@function[(char* scheme_get_byte_string_output
@ -843,12 +843,12 @@ character string or a path value.}
@function[(Scheme_Object* scheme_char_string_to_path
[Scheme_Object* s])]{
Converts a Scheme character string into a Scheme path value.}
Converts a Racket character string into a Racket path value.}
@function[(Scheme_Object* scheme_path_to_char_string
[Scheme_Object* s])]{
Converts a Scheme path value into a Scheme character string.}
Converts a Racket path value into a Racket character string.}
@function[(Scheme_Object* scheme_make_path
[char* bytes])]{
@ -923,7 +923,7 @@ no 0, then an exception is raised if the operation fails.}
[int noexn])]{
Sets the current working directory according to the operating system. This
is separate from MzScheme's current directory parameter.
is separate from Racket's current directory parameter.
If @var{noexn} is not 0, then an exception is raised if the operation
fails.}
@ -935,7 +935,7 @@ fails.}
[Scheme_Object** argv]
[long* rlen])]{
Creates a string like MzScheme's @scheme[format] procedure, using the
Creates a string like Racket's @scheme[format] procedure, using the
format string @var{format} (of length @var{flen}) and the extra
arguments specified in @var{argc} and @var{argv}. If @var{rlen} is not
@cpp{NULL}, @cpp{*@var{rlen}} is filled with the length of the
@ -947,7 +947,7 @@ resulting string.}
[int argc]
[Scheme_Object** argv])]{
Writes to the current output port like MzScheme's @scheme[printf]
Writes to the current output port like Racket's @scheme[printf]
procedure, using the format string @var{format} (of length @var{flen})
and the extra arguments specified in @var{argc} and @var{argv}.}

View File

@ -3,11 +3,11 @@
@title{Procedures}
A @defterm{primitive procedure} is a Scheme-callable procedure that is
implemented in C. Primitive procedures are created in Scheme with
A @defterm{primitive procedure} is a Racket-callable procedure that is
implemented in C. Primitive procedures are created in Racket with
the function @cppi{scheme_make_prim_w_arity}, which takes a C function
pointer, the name of the primitive, and information about the number
of Scheme arguments that it takes; it returns a Scheme procedure
of Racket arguments that it takes; it returns a Racket procedure
value.
The C function implementing the procedure must take two arguments: an
@ -15,7 +15,7 @@ integer that specifies the number of arguments passed to the
procedure, and an array of @cpp{Scheme_Object*} arguments. The number
of arguments passed to the function will be checked using the arity
information. (The arity information provided to
@cpp{scheme_make_prim_w_arity} is also used for the Scheme
@cpp{scheme_make_prim_w_arity} is also used for the Racket
@scheme[arity] procedure.) The procedure implementation is not allowed
to mutate the input array of arguments; as an exception, the procedure
can mutate the array if it is the same a the result of
@ -60,7 +60,7 @@ maximum number of arguments that can be supplied to the procedure, or
-1 if the procedure can take arbitrarily many arguments. The
@var{mina} and @var{maxa} values are used for automatically checking
the argument count before the primitive is invoked, and also for the
Scheme @indexed-scheme[arity] procedure. The @var{name} argument is
Racket @indexed-scheme[arity] procedure. The @var{name} argument is
used to report application arity errors at run-time.}
@function[(Scheme_Object* scheme_make_folding_prim

View File

@ -3,7 +3,7 @@
@title{Structures}
A new Scheme structure type is created with
A new Racket structure type is created with
@cppi{scheme_make_struct_type}. This creates the structure type, but
does not generate the constructor, etc. procedures. The
@cppi{scheme_make_struct_values} function takes a structure type and
@ -42,6 +42,10 @@ be restricted by passing any combination of these flags:
@item{@cppi{SCHEME_STRUCT_GEN_SET} --- the field-independent
mutator procedure value/name is returned.}
@item{@cppi{SCHEME_STRUCT_NO_MAKE_PREFIX} --- the constructor name
omits a @schemeidfont{make-} prefix, like @racket[struct] instead of
@racket[define-struct].}
]
When all values or names are returned, they are returned as an array
@ -87,7 +91,7 @@ Creates and returns an array of standard structure value name
symbols. The @var{base_name} argument is used as the name of the
structure type; it should be the same symbol passed to the associated
call to @cpp{scheme_make_struct_type}. The @var{field_names} argument
is a (Scheme) list of field name symbols. The @var{flags} argument
is a (Racket) list of field name symbols. The @var{flags} argument
specifies which names should be generated, and if @var{count_out} is
not @cpp{NULL}, @var{count_out} is filled with the number of names
returned in the array.}

View File

@ -5,10 +5,10 @@
@title[#:tag "threads"]{Threads}
The initializer function @cppi{scheme_basic_env} creates the main
Scheme thread; all other threads are created through calls to
Racket thread; all other threads are created through calls to
@cppi{scheme_thread}.
Information about each internal Scheme thread is kept in a
Information about each internal Racket thread is kept in a
@cppi{Scheme_Thread} structure. A pointer to the current thread's
structure is available as @cppi{scheme_current_thread}. A
@cpp{Scheme_Thread} structure includes the following fields:
@ -43,7 +43,7 @@ The last thread in the list is always the main thread.
@section{Integration with Threads}
Scheme's threads can break external C code under two circumstances:
Racket's threads can break external C code under two circumstances:
@itemize[
@ -53,18 +53,18 @@ Scheme's threads can break external C code under two circumstances:
pointer in the global variable, it may point to data that is not
currently on the stack.}
@item{@italic{C functions that can invoke Scheme (and also be invoked
by Scheme) depend on strict function-call nesting.} For example,
@item{@italic{C functions that can invoke Racket (and also be invoked
by Racket) depend on strict function-call nesting.} For example,
suppose a function F uses an internal stack, pushing items on to the
stack on entry and popping the same items on exit. Suppose also that
F invokes Scheme to evaluate an expression. If the evaluation of
F invokes Racket to evaluate an expression. If the evaluation of
this expression invokes F again in a new thread, but then returns to
the first thread before completing the second F, then F's internal
stack will be corrupted.}
]
If either of these circumstances occurs, Scheme will probably crash.
If either of these circumstances occurs, Racket will probably crash.
@; ----------------------------------------------------------------------
@ -72,8 +72,8 @@ If either of these circumstances occurs, Scheme will probably crash.
@section[#:tag "usefuel"]{Allowing Thread Switches}
C code that performs substantial or unbounded work should occasionally
call @cppi{SCHEME_USE_FUEL}---actually a macro---which allows Scheme
to swap in another Scheme thread to run, and to check for breaks on
call @cppi{SCHEME_USE_FUEL}---actually a macro---which allows Racket
to swap in another Racket thread to run, and to check for breaks on
the current thread. In particular, if breaks are enabled, then
@cpp{SCHEME_USE_FUEL} may trigger an exception.
@ -110,18 +110,18 @@ expression.
@section[#:tag "threadblock"]{Blocking the Current Thread}
Embedding or extension code sometimes needs to block, but blocking
should allow other Scheme threads to execute. To allow other threads
should allow other Racket threads to execute. To allow other threads
to run, block using @cppi{scheme_block_until}. This procedure takes
two functions: a polling function that tests whether the blocking
operation can be completed, and a prepare-to-sleep function that sets
bits in @cpp{fd_set}s when Scheme decides to sleep (because all Scheme
bits in @cpp{fd_set}s when Racket decides to sleep (because all Racket
threads are blocked). Under Windows, an ``@cpp{fd_set}'' can also
accommodate OS-level semaphores or other handles via
@cpp{scheme_add_fd_handle}.
Since the functions passed to @cppi{scheme_block_until} are called by
the Scheme thread scheduler, they must never raise exceptions, call
@cpp{scheme_apply}, or trigger the evaluation of Scheme code in any
the Racket thread scheduler, they must never raise exceptions, call
@cpp{scheme_apply}, or trigger the evaluation of Racket code in any
way. The @cpp{scheme_block_until} function itself may call the current
exception handler, however, in reaction to a break (if breaks are
enabled).
@ -133,8 +133,8 @@ polling and sleeping functions with @cppi{scheme_add_evt}, or register
a semaphore accessor with @cppi{scheme_add_evt_through_sema}.
The @cppi{scheme_signal_received} function can be called to wake up
Scheme when it is sleeping. In particular, calling
@cppi{scheme_signal_received} ensures that Scheme will poll all
Racket when it is sleeping. In particular, calling
@cppi{scheme_signal_received} ensures that Racket will poll all
blocking synchronizations soon afterward. Furthermore,
@cpp{scheme_signal_received} can be called from any OS-level thread.
Thus, when no adequate prepare-to-sleep function can be implemented
@ -144,17 +144,17 @@ changes will ensure that a poll is issued.
@; ----------------------------------------------------------------------
@section[#:tag "threadtime"]{Threads in Embedded Scheme with Event Loops}
@section[#:tag "threadtime"]{Threads in Embedded Racket with Event Loops}
When Scheme is embedded in an application with an event-based model
(i.e., the execution of Scheme code in the main thread is repeatedly
When Racket is embedded in an application with an event-based model
(i.e., the execution of Racket code in the main thread is repeatedly
triggered by external events until the application exits) special
hooks must be set to ensure that non-main threads execute
correctly. For example, during the execution in the main thread, a new
thread may be created; the new thread may still be running when the
main thread returns to the event loop, and it may be arbitrarily long
before the main thread continues from the event loop. Under such
circumstances, the embedding program must explicitly allow Scheme to
circumstances, the embedding program must explicitly allow Racket to
execute the non-main threads; this can be done by periodically calling
the function @cppi{scheme_check_threads}.
@ -167,11 +167,11 @@ when thread-checking becomes necessary, and then with 0 when thread
checking is no longer necessary. An embedding program can use this
information to prevent unnecessary @cpp{scheme_check_threads} polling.
The below code illustrates how MrEd formerly set up
The below code illustrates how GRacket formerly set up
@cpp{scheme_check_threads} polling using the wxWindows @cpp{wxTimer}
class. (Any regular event-loop-based callback is appropriate.) The
@cpp{scheme_notify_multithread} pointer is set to
@cpp{MrEdInstallThreadTimer}. (MrEd no longer work this way, however.)
@cpp{MrEdInstallThreadTimer}. (GRacket no longer work this way, however.)
@verbatim[#:indent 2]{
class MrEdThreadTimer : public wxTimer
@ -208,15 +208,15 @@ class. (Any regular event-loop-based callback is appropriate.) The
}
}
An alternate architecture, which MrEd now uses, is to send the main
An alternate architecture, which GRacket now uses, is to send the main
thread into a loop, which blocks until an event is ready to handle.
Scheme automatically takes care of running all threads, and it does so
Racket automatically takes care of running all threads, and it does so
efficiently because the main thread blocks on a file descriptor, as
explained in @secref["threadblock"].
@subsection[#:tag "blockednonmainel"]{Callbacks for Blocked Threads}
Scheme threads are sometimes blocked on file descriptors, such as an
Racket threads are sometimes blocked on file descriptors, such as an
input file or the X event socket. Blocked non-main threads do not
block the main thread, and therefore do not affect the event loop, so
@cppi{scheme_check_threads} is sufficient to implement this case
@ -237,7 +237,7 @@ sets up callbacks on the specified file descriptors. When input is
ready on any of those file descriptors, the callbacks are removed and
@cpp{scheme_wake_up} is called.
For example, the X Windows version of MrEd formerly set
For example, the X Windows version of GRacket formerly set
@cpp{scheme_wakeup_on_input} to this @cpp{MrEdNeedWakeup}:
@verbatim[#:indent 2]{
@ -319,15 +319,15 @@ For example, the X Windows version of MrEd formerly set
@; ----------------------------------------------------------------------
@section[#:tag "sleeping"]{Sleeping by Embedded Scheme}
@section[#:tag "sleeping"]{Sleeping by Embedded Racket}
When all Scheme threads are blocked, Scheme must ``sleep'' for a
When all Racket threads are blocked, Racket must ``sleep'' for a
certain number of seconds or until external input appears on some file
descriptor. Generally, sleeping should block the main event loop of
the entire application. However, the way in which sleeping is
performed may depend on the embedding application. The global function
pointer @cppi{scheme_sleep} can be set by an embedding application to
implement a blocking sleep, although Scheme implements this function
implement a blocking sleep, although Racket implements this function
for you.
A @cpp{scheme_sleep} function takes two arguments: a @cpp{float} and a
@ -348,7 +348,7 @@ manipulate each ``@cpp{fd_set}'' with @cpp{MZ_FD_SET},
The following function @cpp{mzsleep} is an appropriate
@cpp{scheme_sleep} function for most any Unix or Windows application.
(This is approximately the built-in sleep used by Scheme.)
(This is approximately the built-in sleep used by Racket.)
@verbatim[#:indent 2]{
void mzsleep(float v, void *fds)
@ -490,7 +490,7 @@ Blocks the current thread until @var{f} with @var{data} returns a true
a @cpp{Scheme_Object*} value, because it is only used by @var{f}
and @var{fdf}.)
If Scheme decides to sleep, then the @var{fdf} function is called to
If Racket decides to sleep, then the @var{fdf} function is called to
sets bits in @var{fds}, conceptually an array of three
@cpp{fd_set}s: one or reading, one for writing, and one for
exceptions. Use @cpp{scheme_get_fdset} to get elements of this
@ -501,7 +501,7 @@ If Scheme decides to sleep, then the @var{fdf} function is called to
The @var{fdf} argument can be @cpp{NULL}, which implies that the thread
becomes unblocked (i.e., @var{ready} changes its result to true) only
through Scheme actions, and never through external processes (e.g.,
through Racket actions, and never through external processes (e.g.,
through a socket or OS-level semaphore)---with the exception that
@cpp{scheme_signal_received} may be called to indicate an external
change.
@ -548,8 +548,8 @@ Like @cpp{scheme_block_until_enable_break}, but the function
Indicates that an external event may have caused the result of a
synchronization poll to have a different result. Unlike most other
Scheme functions, this one can be called from any OS-level thread, and
it wakes up if the Scheme thread if it is sleeping.}
Racket functions, this one can be called from any OS-level thread, and
it wakes up if the Racket thread if it is sleeping.}
@function[(void scheme_check_threads)]{
@ -577,12 +577,12 @@ Extracts an ``@cpp{fd_set}'' from an array passed to
[int repost])]{
Adds an OS-level semaphore (Windows) or other waitable handle
(Windows) to the ``@cpp{fd_set}'' @var{fds}. When Scheme performs
(Windows) to the ``@cpp{fd_set}'' @var{fds}. When Racket performs
a ``@cpp{select}'' to sleep on @var{fds}, it also waits on the given
semaphore or handle. This feature makes it possible for Scheme to
semaphore or handle. This feature makes it possible for Racket to
sleep until it is awakened by an external process.
Scheme does not attempt to deallocate the given semaphore or handle,
Racket does not attempt to deallocate the given semaphore or handle,
and the ``@cpp{select}'' call using @var{fds} may be unblocked due to
some other file descriptor or handle in @var{fds}. If @var{repost} is
a true value, then @var{h} must be an OS-level semaphore, and if the
@ -603,9 +603,9 @@ Under Unix and Mac OS X, this function has no effect.}
[int mask])]{
Adds an OS-level event type (Windows) to the set of types in the
``@cpp{fd_set}'' @var{fds}. When Scheme performs a
``@cpp{fd_set}'' @var{fds}. When Racket performs a
``@cpp{select}'' to sleep on @var{fds}, it also waits on events of
them specified type. This feature makes it possible for Scheme to
them specified type. This feature makes it possible for Racket to
sleep until it is awakened by an external process.
The event mask is only used when some handle is installed with
@ -711,28 +711,28 @@ Calls @var{prim} with the given @var{argc} and @var{argv} with breaks
[Scheme_Thread_Cell_Table* cells]
[Scheme_Object* v])]{
Prevents Scheme thread swaps until @cpp{scheme_end_atomic} or
Prevents Racket thread swaps until @cpp{scheme_end_atomic} or
@cpp{scheme_end_atomic_no_swap} is called. Start-atomic and
end-atomic pairs can be nested.}
@function[(void scheme_end_atomic)]{
Ends an atomic region with respect to Scheme threads. The current
Ends an atomic region with respect to Racket threads. The current
thread may be swapped out immediately (i.e., the call to
@cpp{scheme_end_atomic} is assumed to be a safe point for thread
swaps).}
@function[(void scheme_end_atomic_no_swap)]{
Ends an atomic region with respect to Scheme threads, and also
prevents an immediate thread swap. (In other words, no Scheme
Ends an atomic region with respect to Racket threads, and also
prevents an immediate thread swap. (In other words, no Racket
thread swaps will occur until a future safe point.)}
@function[(void scheme_add_swap_callback
[Scheme_Closure_Func f]
[Scheme_Object* data])]{
Registers a callback to be invoked just after a Scheme thread is
Registers a callback to be invoked just after a Racket thread is
swapped in. The @var{data} is provided back to @var{f} when it is
called, where @cpp{Closure_Func} is defined as follows:
@ -745,4 +745,4 @@ called, where @cpp{Closure_Func} is defined as follows:
[Scheme_Object* data])]{
Like @cpp{scheme_add_swap_callback}, but registers a callback to be
invoked just before a Scheme thread is swapped out.}
invoked just before a Racket thread is swapped out.}

View File

@ -152,7 +152,7 @@
(define cppdef (lambda (x) (as-cpp-defn x (cpp x))))
(define *var italic)
(define mzc (exec "mzc"))
(define mzc (exec "raco ctool"))
(define (refsecref s)
(secref #:doc '(lib "scribblings/reference/reference.scrbl") s))

View File

@ -3,27 +3,27 @@
@title[#:tag "im:values+types"]{Values and Types}
A Scheme value is represented by a pointer-sized value. The low bit is
A Racket value is represented by a pointer-sized value. The low bit is
a mark bit: a 1 in the low bit indicates an immediate integer, a 0
indicates a (word-aligned) pointer.
A pointer Scheme value references a structure that begins with a
A pointer Racket value references a structure that begins with a
@cppi{Scheme_Object} sub-structure, which in turn starts with a tag
that has the C type @cppi{Scheme_Type}. The rest of the structure,
following the @cppi{Scheme_Object} header, is type-dependent.
PLT Scheme's C interface gives Scheme values the type
Racket's C interface gives Racket values the type
@cpp{Scheme_Object*}. (The ``object'' here does not refer to objects
in the sense of the @schememodname[scheme/class] library.)
in the sense of the @schememodname[racket/class] library.)
Examples of @cpp{Scheme_Type} values include @cpp{scheme_pair_type}
and @cpp{scheme_symbol_type}. Some of these are implemented as
instances of @cppi{Scheme_Simple_Object}, which is defined in
@filepath{scheme.h}, but extension or embedding code should never access
this structure directly. Instead, the code should use macros, such as
@cpp{SCHEME_CAR}, that provide access to the data of common Scheme
@cpp{SCHEME_CAR}, that provide access to the data of common Racket
types.
For most Scheme types, a constructor is provided for creating values
For most Racket types, a constructor is provided for creating values
of the type. For example, @cpp{scheme_make_pair} takes two
@cpp{Scheme_Object*} values and returns the @scheme[cons] of the
values.
@ -32,12 +32,12 @@ The macro @cppdef{SCHEME_TYPE} takes a @cpp{Scheme_Object *} and returns
the type of the object. This macro performs the tag-bit check, and
returns @cppi{scheme_integer_type} when the value is an immediate
integer; otherwise, @cpp{SCHEME_TYPE} follows the pointer to get the
type tag. Macros are provided to test for common Scheme types; for
type tag. Macros are provided to test for common Racket types; for
example, @cpp{SCHEME_PAIRP} returns @cpp{1} if the value is a cons
cell, @cpp{0} otherwise.
In addition to providing constructors, PLT Scheme defines six global
constant Scheme values: @cppi{scheme_true}, @cppi{scheme_false},
In addition to providing constructors, Racket defines six global
constant Racket values: @cppi{scheme_true}, @cppi{scheme_false},
@cppi{scheme_null}, @cppi{scheme_eof}, @cppi{scheme_void}, and
@cppi{scheme_undefined}. Each of these has a type tag, but each is
normally recognized via its constant address.
@ -46,7 +46,7 @@ normally recognized via its constant address.
can create new a primitive data type by calling
@cppi{scheme_make_type}, which returns a fresh @cpp{Scheme_Type}
value. To create a collectable instance of this type, allocate memory
for the instance with @cpp{scheme_malloc}. From PLT Scheme's
for the instance with @cpp{scheme_malloc}. From Racket's
perspective, the main constraint on the data format of such an
instance is that the first @cpp{sizeof(Scheme_Object)} bytes must
correspond to a @cpp{Scheme_Object} record; furthermore, the first
@ -54,7 +54,7 @@ correspond to a @cpp{Scheme_Object} record; furthermore, the first
@cpp{scheme_make_type}. Extensions with modest needs can use
@cppi{scheme_make_cptr}, instead of creating an entirely new type.
Scheme values should never be allocated on the stack, and they should
Racket values should never be allocated on the stack, and they should
never contain pointers to values on the stack. Besides the problem of
restricting the value's lifetime to that of the stack frame,
allocating values on the stack creates problems for continuations and
@ -89,7 +89,7 @@ types:
floating-point value; test for this type with @cppdef{SCHEME_DBLP}}
@item{@cppdef{scheme_float_type} --- single-precision flonum
inexact numbers, when specifically enabled when compiling PLT Scheme;
inexact numbers, when specifically enabled when compiling Racket;
@cppi{SCHEME_FLOAT_VAL} or @cppdef{SCHEME_FLT_VAL} extracts the
floating-point value; test for this type with @cppdef{SCHEME_FLTP}}
@ -109,7 +109,7 @@ types:
@item{@cppdef{scheme_char_string_type} --- @index['("strings"
"conversion to C")]{@cppdef{SCHEME_CHAR_STR_VAL}} extracts the string
as a @cpp{mzchar*}; the string is always nul-terminated, but may also
contain embedded nul characters, and the Scheme string is modified if
contain embedded nul characters, and the Racket string is modified if
this string is modified; @cppdef{SCHEME_CHAR_STRLEN_VAL} extracts the
string length (in characters, not counting the nul terminator); test
for this type with @cppdef{SCHEME_CHAR_STRINGP}}
@ -117,7 +117,7 @@ types:
@item{@cppdef{scheme_byte_string_type} ---
@cppdef{SCHEME_BYTE_STR_VAL} extracts the string as a @cpp{char*}; the
string is always nul-terminated, but may also contain embedded nul
characters, and the Scheme string is modified if this string is
characters, and the Racket string is modified if this string is
modified; @cppdef{SCHEME_BYTE_STRLEN_VAL} extracts the string length
(in bytes, not counting the nul terminator); test for this type with
@cppdef{SCHEME_BYTE_STRINGP}}
@ -158,7 +158,7 @@ types:
@item{@cppdef{scheme_vector_type} --- @cppdef{SCHEME_VEC_SIZE}
extracts the length and @cppdef{SCHEME_VEC_ELS} extracts the array of
Scheme values (the Scheme vector is modified when this array is
Racket values (the Racket vector is modified when this array is
modified); test for this type with @cppdef{SCHEME_VECTORP}; 3m: see
@secref["im:3m"] for a caution about @cppi{SCHEME_VEC_ELS}}
@ -222,7 +222,7 @@ The following are the procedure types:
@item{@cppdef{scheme_closed_prim_type} --- an old-style primitive
procedure with a data pointer}
@item{@cppdef{scheme_compiled_closure_type} --- a Scheme
@item{@cppdef{scheme_compiled_closure_type} --- a Racket
procedure}
@item{@cppdef{scheme_cont_type} --- a continuation}
@ -289,9 +289,9 @@ There are six global constants:
@section[#:tag "im:strings"]{Strings}
As noted in @secref["im:unicode"], a Scheme character is a Unicode
As noted in @secref["im:unicode"], a Racket character is a Unicode
code point represented by a @cpp{mzchar} value, and character strings
are @cpp{mzchar} arrays. PLT Scheme also supplies byte strings, which
are @cpp{mzchar} arrays. Racket also supplies byte strings, which
are @cpp{char} arrays.
For a character string @var{s}, @cpp{@cpp{SCHEME_CHAR_STR_VAL}(@var{s})}
@ -319,7 +319,7 @@ For more fine-grained control over UTF-8 encoding, use the
Returns the character value. The @var{ch} value must be a legal
Unicode code point (and not a surrogate, for example). The first 256
characters are represented by constant Scheme values, and others are
characters are represented by constant Racket values, and others are
allocated.}
@function[(Scheme_Object* scheme_make_char_or_null
@ -389,7 +389,7 @@ Creates an integer given the high and low @cpp{long}s of an unsigned
Extracts the integer value. Unlike the @cppi{SCHEME_INT_VAL} macro,
this procedure will extract an integer that fits in a @cpp{long} from
a Scheme bignum. If @var{o} fits in a @cpp{long}, the extracted
a Racket bignum. If @var{o} fits in a @cpp{long}, the extracted
integer is placed in @var{*i} and 1 is returned; otherwise, 0 is
returned and @var{*i} is unmodified.}
@ -422,13 +422,13 @@ Creates a new floating-point value.}
[float d])]{
Creates a new single-precision floating-point value. The procedure is
available only when PLT Scheme is compiled with single-precision
available only when Racket is compiled with single-precision
numbers enabled.}
@function[(double scheme_real_to_double
[Scheme_Object* o])]{
Converts a Scheme real number to a double-precision floating-point
Converts a Racket real number to a double-precision floating-point
value.}
@function[(Scheme_Object* scheme_make_pair
@ -440,7 +440,7 @@ Makes a @scheme[cons] pair.}
@function[(Scheme_Object* scheme_make_byte_string
[char* bytes])]{
Makes a Scheme byte string from a nul-terminated C string. The
Makes a Racket byte string from a nul-terminated C string. The
@var{bytes} string is copied.}
@function[(Scheme_Object* scheme_make_byte_string_without_copying
@ -475,7 +475,7 @@ Like @cpp{scheme_make_sized_byte_string}, except the @var{len}
[long size]
[char fill])]{
Allocates a new Scheme byte string.}
Allocates a new Racket byte string.}
@function[(Scheme_Object* scheme_append_byte_string
[Scheme_Object* a]
@ -486,7 +486,7 @@ Creates a new byte string by appending the two given byte strings.}
@function[(Scheme_Object* scheme_make_locale_string
[char* bytes])]{
Makes a Scheme string from a nul-terminated byte string that is a
Makes a Racket string from a nul-terminated byte string that is a
locale-specific encoding of a character string; a new string is
allocated during decoding. The ``locale in the name of this function
thus refers to @var{bytes}, and not the resulting string (which is
@ -495,7 +495,7 @@ Makes a Scheme string from a nul-terminated byte string that is a
@function[(Scheme_Object* scheme_make_utf8_string
[char* bytes])]{
Makes a Scheme string from a nul-terminated byte string that is a
Makes a Racket string from a nul-terminated byte string that is a
UTF-8 encoding. A new string is allocated during decoding. The
``utf8'' in the name of this function thus refers to @var{bytes}, and
not the resulting string (which is internally stored as UCS-4).}
@ -523,7 +523,7 @@ Like @cpp{scheme_make_sized_char_string}, except the @var{len} characters
@function[(Scheme_Object* scheme_make_char_string
[mzchar* chars])]{
Makes a Scheme string from a nul-terminated UCS-4 string. The
Makes a Racket string from a nul-terminated UCS-4 string. The
@var{chars} string is copied.}
@function[(Scheme_Object* scheme_make_char_string_without_copying
@ -558,7 +558,7 @@ Like @cpp{scheme_make_sized_char_string}, except the @var{len}
[long size]
[mzchar fill])]{
Allocates a new Scheme string.}
Allocates a new Racket string.}
@function[(Scheme_Object* scheme_append_char_string
[Scheme_Object* a]
@ -569,22 +569,22 @@ Creates a new string by appending the two given strings.}
@function[(Scheme_Object* scheme_char_string_to_byte_string
[Scheme_Object* s])]{
Converts a Scheme character string into a Scheme byte string via UTF-8.}
Converts a Racket character string into a Racket byte string via UTF-8.}
@function[(Scheme_Object* scheme_byte_string_to_char_string
[Scheme_Object* s])]{
Converts a Scheme byte string into a Scheme character string via UTF-8.}
Converts a Racket byte string into a Racket character string via UTF-8.}
@function[(Scheme_Object* scheme_char_string_to_byte_string_locale
[Scheme_Object* s])]{
Converts a Scheme character string into a Scheme byte string via the locale's encoding.}
Converts a Racket character string into a Racket byte string via the locale's encoding.}
@function[(Scheme_Object* scheme_byte_string_to_char_string_locale
[Scheme_Object* s])]{
Converts a Scheme byte string into a Scheme character string via the locale's encoding.}
Converts a Racket byte string into a Racket character string via the locale's encoding.}
@function[(Scheme_Object* scheme_intern_symbol
[char* name])]{
@ -654,7 +654,7 @@ Creates a new weak box containing the value @var{v}.}
@function[(Scheme_Type scheme_make_type
[char* name])]{
Creates a new type (not a Scheme value).}
Creates a new type (not a Racket value).}
@function[(Scheme_Object* scheme_make_cptr
[void* ptr]
@ -664,10 +664,10 @@ Creates a C-pointer object that encapsulates @var{ptr} and uses
@var{typetag} to identify the type of the pointer. The
@cppi{SCHEME_CPTRP} macro recognizes objects created by
@cpp{scheme_make_cptr}. The @cppi{SCHEME_CPTR_VAL} macro extracts
the original @var{ptr} from the Scheme object, and
the original @var{ptr} from the Racket object, and
@cppi{SCHEME_CPTR_TYPE} extracts the type tag.
The @cppi{SCHEME_CPTR_OFFSETVAL} macro returns @cpp{0}
for the result Scheme object.
for the result Racket object.
The @var{ptr} can refer to either memory managed by the garbage
collector or by some other memory manager. Beware, however, of
@ -690,7 +690,7 @@ referencing memory managed by the garbage collector.}
Creates a C-pointer object that encapsulates both @var{ptr} and @var{offset}.
The @cppi{SCHEME_CPTR_OFFSETVAL} macro returns @var{offset}
for the result Scheme object (and the macro be used to change the offset,
for the result Racket object (and the macro be used to change the offset,
since it also works on objects with no offset).
The @var{ptr} can refer to either memory managed by the garbage

View File

@ -11,7 +11,7 @@ General Public License (LGPL). This means
@itemize[
@item{You can link Racket software (such as Racket) into
@item{You can link Racket software into
proprietary applications, provided you follow the specific
rules stated in the LGPL.}

View File

@ -7,19 +7,23 @@
(apply link (apply build-path (find-doc-dir) "release-notes" path)
content))
@(define (mzport doc from to)
(rl-link (list "mzscheme" doc) (format "Porting from ~a to ~a" from to)))
(rl-link (list "racket" doc) (format "Porting from ~a to ~a" from to)))
@main-page['release]
@itemize[#:style "compact"]{
@item{@rl-link['("drscheme" "HISTORY.txt")]{DrScheme}}
@item{@rl-link['("mzscheme" "HISTORY.txt")]{MzScheme}
@item{@rl-link['("racket" "HISTORY.txt")]{Racket core}
@itemize[#:style "compact"]{
@item{@mzport["Racket_5.txt" "v4.x" "v5.x"]}
@item{@mzport["MzScheme_4.txt" "v3xx" "v4.x"]}
@item{@mzport["MzScheme_300.txt" "v2xx" "v3xx"]}
@item{@mzport["MzScheme_200.txt" "v1xx" "v2xx"]}}}
@item{@rl-link['("mred" "HISTORY.txt")]{MrEd}}
@item{@rl-link['("drracket" "HISTORY.txt")]{DrRacket}}
@item{@rl-link['("gracket" "HISTORY.txt")]{GRacket}}
@item{@rl-link['("teachpack" "HISTORY.txt")]{Teachpacks}}
@item{@rl-link['("stepper" "HISTORY.txt")]{Stepper}}
@item{@rl-link['("plai" "HISTORY.txt")]{PLAI}}
@item{@rl-link['("redex" "HISTORY.txt")]{Redex}}
}

View File

@ -1,17 +0,0 @@
#lang scribble/doc
@(require scribble/manual
"common.ss")
@title[#:tag "c-mods"]{Embedding Scheme Modules via C}
The @DFlag{c-mods} mode for @|mzc| takes a set of Scheme modules and
generates a C source file that can be used as part of program that
embeds the PLT Scheme run-time system. See @secref[#:doc inside-doc
"embedding"] in @other-manual[inside-doc] for an explanation of
embedding programs.
The generated source file embeds the specified modules, and it defines
a @tt{declare_modules} function that puts the module declarations
into a namespace. Thus, using the output of @exec{mzc --c-mods}, a
program can embed PLT Scheme with a set of modules so that it does not
need a @filepath{collects} directory to load modules at run time.

View File

@ -1,83 +0,0 @@
#lang scribble/doc
@(require scribble/manual
"common.ss"
(for-label scheme/runtime-path))
@title[#:tag "exe-dist"]{Distributing Stand-Alone Executables}
The command-line flag @DFlag{exe-dir} directs @|mzc| to combine a
stand-alone executable (created via @DFlag{exe} or @DFlag{gui-exe})
with all of the shared libraries that are needed to run it, along with
any run-time files declared via @scheme[define-runtime-path]. The
resulting package can be moved to other machines that run the same
operating system.
After the @DFlag{exe-dir} flag, supply a directory to contain the
combined files for a distribution. Each command-line argument is an
executable to include in the distribution, so multiple executables can
be packaged together. For example, under Windows,
@commandline{mzc --exe-dir greetings hello.exe goodbye.exe}
creates a directory @filepath{greetings} (if the directory doesn't
exist already), and it copies the executables @filepath{hello.exe} and
@filepath{goodbye.exe} into @filepath{greetings}. It also creates a
@filepath{lib} sub-directory in @filepath{greetings} to contain DLLs,
and it adjusts the copied @filepath{hello.exe} and
@filepath{goodbye.exe} to use the DLLs in @filepath{lib}.
The layout of files within a distribution directory is
platform-specific:
@itemize[
@item{Under Windows, executables are put directly into the
distribution directory, and DLLs and other run-time files go
into a @filepath{lib} sub-directory.}
@item{Under Mac OS X, @DFlag{gui-exe} executables go into the
distribution directory, @DFlag{exe} executables go into a
@filepath{bin} subdirectory, and frameworks (i.e., shared
libraries) go into a @filepath{lib} sub-directory along with
other run-time files. As a special case, if the distribution has
a single @DFlag{gui-exe} executable, then the @filepath{lib}
directory is hidden inside the application bundle.}
@item{Under Unix, executables go into a @filepath{bin} subdirectory,
shared libraries (if any) go into a @filepath{lib} subdirectory
along with other run-time files, and wrapped executables are
placed into a @filepath{lib/plt} subdirectory with
version-specific names. This layout is consistent with Unix
installation conventions; the version-specific names for shared
libraries and wrapped executables means that distributions can
be safely unpacked into a standard place on target machines
without colliding with an existing PLT Scheme installation or
other executables created by @|mzc|.}
]
A distribution also has a @filepath{collects} directory that is used
as the main library collection directory for the packaged executables.
By default, the directory is empty. Use @|mzc|'s
@as-index{@DPFlag{copy-collects}} flag to supply a directory whose
content is copied into the distribution's @filepath{collects}
directory. The @DPFlag{copy-collects} flag can be used multiple times
to supply multiple directories.
When multiple executables are disrtibuted together, then separately
creating the executables with @DFlag{exe} and @DFlag{gui-exe} can
generate multiple copies of collection-based libraries that are used
by multiple executables. To share the library code, instead, specify a
target directory for library copies using the
@as-index{@DFlag{collects-dest}} flag with @DFlag{exe} and
@DFlag{gui-exe}, and specify the same directory for each executable
(so that the set of libraries used by all executables are pooled
together). Finally, when packaging the distribution with
@DFlag{exe-dir}, use the @DPFlag{copy-collects} flag to include the
copied libraries in the distribution.
@; ----------------------------------------------------------------------
@include-section["dist-api.scrbl"]
@include-section["bundle-api.scrbl"]

View File

@ -1,56 +0,0 @@
#lang scribble/doc
@(require scribble/manual
"common.ss"
(for-label scheme/runtime-path))
@title[#:tag "exe"]{Stand-Alone Executables from Scheme Code}
The command-line flag @DFlag{exe} directs @|mzc| to embed a module,
from source or byte code, into a copy of the @exec{mzscheme}
executable. (Under Unix, the embedding executable is actually a copy
of a wrapper executable.) The created executable invokes the embedded
module on startup. The @DFlag{gui-exe} flag is similar, but it copies
the @exec{mred} executable. If the embedded module refers to other
modules via @scheme[require], then the other modules are also included
in the embedding executable.
For example, the command
@commandline{mzc --gui-exe hello hello.ss}
produces either @filepath{hello.exe} (Windows), @filepath{hello.app}
(Mac OS X), or @filepath{hello} (Unix), which runs the same as
invoking the @filepath{hello.ss} module in @exec{mred}.
Library modules or other files that are referenced
dynamically---through @scheme[eval], @scheme[load], or
@scheme[dynamic-require]---are not automatically embedded into the
created executable. Such modules can be explicitly included using
@|mzc|'s @DFlag{lib} flag. Alternately, use
@scheme[define-runtime-path] to embed references to the run-time files
in the executable; the files are then copied and packaged together
with the executable when creating a distribution (as described in
@secref["exe-dist"]).
Modules that are implemented directly by extensions---i.e., extensions
that are automatically loaded from @scheme[(build-path "compiled"
"native" (system-library-subpath))] to satisfy a
@scheme[require]---are treated like other run-time files: a generated
executable uses them from their original location, and they are copied
and packaged together when creating a distribution.
The @DFlag{exe} and @DFlag{gui-exe} flags work only with
@scheme[module]-based programs. The @schememodname[compiler/embed]
library provides a more general interface to the embedding mechanism.
A stand-alone executable is ``stand-alone'' in the sense that you can
run it without starting @exec{mzscheme}, @exec{mred}, or
DrScheme. However, the executable depends on PLT Scheme shared
libraries, and possibly other run-time files declared via
@scheme[define-runtime-path]. The executable can be packaged with
support libraries to create a distribution, as described in
@secref["exe-dist"].
@; ----------------------------------------------------------------------
@include-section["exe-api.scrbl"]

View File

@ -1,3 +0,0 @@
#lang setup/infotab
(define scribblings '(("mzc.scrbl" (multi-page) (tool 50))))

View File

@ -1,312 +0,0 @@
#lang scribble/doc
@(require scribble/manual
"common.ss"
(for-label scheme/base
scheme/unit
scheme/contract
launcher/launcher
launcher/launcher-sig
launcher/launcher-unit
compiler/embed
scheme/gui/base))
@title[#:tag "launcher"]{Installation-Specific Launchers for Scheme Code}
@defmodule[launcher/launcher]
The @schememodname[launcher/launcher] library provides functions for
creating @defterm{launchers}, which are similar to stand-alone
executables, but sometimes smaller because they depend permanently on
the local PLT Scheme installation. In the case of Unix, in particular,
a launcher is simply a shell script. The @|mzc| tool provides no
direct support for creating launchers.
@section{Creating Launchers}
@defproc[(make-mred-launcher [args (listof string?)]
[dest path-string?]
[aux (listof (cons/c symbol? any/c)) null])
void?]{
Creates the launcher @scheme[dest], which starts MrEd with the
command-line arguments specified as strings in @scheme[args]. Extra
arguments passed to the launcher at run-time are appended (modulo
special Unix/X flag handling, as described below) to this list and
passed on to MrEd. If @scheme[dest] exists already, as either a file
or directory, it is replaced.
The optional @scheme[aux] argument is an association list for
platform-specific options (i.e., it is a list of pairs where the first
element of the pair is a key symbol and the second element is the
value for that key). See also @scheme[build-aux-from-path]. See
@scheme[create-embedding-executable] for a list that applies to both
stand-alone executables and launchers under Windows and Mac OS X MrEd;
the following additional associations apply to launchers:
@itemize[
@item{@scheme['independent?] (Windows) --- a boolean; @scheme[#t]
creates an old-style launcher that is independent of the
MzScheme or MrEd binary, like @exec{setup-plt.exe}. No other
@scheme[aux] associations are used for an old-style launcher.}
@item{@scheme['exe-name] (Mac OS X, @scheme['script-3m] or
@scheme['script-cgc] variant) --- provides the base name for a
@scheme['3m]-/@scheme['cgc]-variant launcher, which the script
will call ignoring @scheme[args]. If this name is not provided,
the script will go through the MrEd executable as usual.}
@item{@scheme['relative?] (all platforms) --- a boolean, where
@scheme[#t] means that the generated launcher should find the
base MrEd executable through a relative path.}
]
For Unix/X, the script created by @scheme[make-mred-launcher] detects
and handles X Windows flags specially when they appear as the initial
arguments to the script. Instead of appending these arguments to the
end of @scheme[args], they are spliced in after any X Windows flags
already listed listed in @scheme[args]. The remaining arguments (i.e.,
all script flags and arguments after the last X Windows flag or
argument) are then appended after the spliced @scheme[args].}
@defproc[(make-mzscheme-launcher [args (listof string?)]
[dest path-string?]
[aux (listof (cons/c symbol? any/c)) null])
void?]{
Like @scheme[make-mred-launcher], but for starting MzScheme. Under Mac
OS X, the @scheme['exe-name] @scheme[aux] association is ignored.}
@defproc[(make-mred-program-launcher [file string?]
[collection string?]
[dest path-string?])
void?]{
Calls @scheme[make-mred-launcher] with arguments that start the MrEd
program implemented by @scheme[file] in @scheme[collection]:
@scheme[(list "-l-" (string-append collection "/" file))]. The
@scheme[_aux] argument to @scheme[make-mred-launcher] is generated by
stripping the suffix (if any) from @scheme[file], adding it to the
path of @scheme[collection], and passing the result to
@scheme[build-aux-from-path].}
@defproc[(make-mzscheme-program-launcher [file string?]
[collection string?]
[dest path-string?])
void?]{
Like @scheme[make-mred-program-launcher], but for
@scheme[make-mzscheme-launcher].}
@defproc[(install-mred-program-launcher [file string?]
[collection string?]
[name string?])
void?]{
Same as
@schemeblock[
(make-mred-program-launcher
file collection
(mred-program-launcher-path name))
]}
@defproc[(install-mzscheme-program-launcher [file string?]
[collection string?]
[name string?])
void?]{
Same as
@schemeblock[
(make-mzscheme-program-launcher
file collection
(mzscheme-program-launcher-path name))
]}
@; ----------------------------------------------------------------------
@section{Launcher Path and Platform Conventions}
@defproc[(mred-program-launcher-path [name string?]) path?]{
Returns a pathname for an executable in the PLT Scheme installation
called something like @scheme[name]. For Windows, the @filepath{.exe}
suffix is automatically appended to @scheme[name]. For Unix,
@scheme[name] is changed to lowercase, whitespace is changed to
@litchar{-}, and the path includes the @filepath{bin} subdirectory of
the PLT Scheme installation. For Mac OS X, the @filepath{.app} suffix
is appended to @scheme[name].}
@defproc[(mzscheme-program-launcher-path [name string?]) path?]{
Returns the same path as @scheme[(mred-program-launcher-path name)]
for Unix and Windows. For Mac OS X, the result is the same as for
Unix.}
@defproc[(mred-launcher-is-directory?) boolean?]{
Returns @scheme[#t] if MrEd launchers for the current platform are
directories from the user's perspective. For all currently supported
platforms, the result is @scheme[#f].}
@defproc[(mzscheme-launcher-is-directory?) boolean?]{
Like @scheme[mred-launcher-is-directory?], but for MzScheme
launchers.}
@defproc[(mred-launcher-is-actually-directory?) boolean?]{
Returns @scheme[#t] if MrEd launchers for the current platform are
implemented as directories from the filesystem's perspective. The
result is @scheme[#t] for Mac OS X, @scheme[#f] for all other
platforms.}
@defproc[(mzscheme-launcher-is-actually-directory?) boolean?]{
Like @scheme[mred-launcher-is-actuall-directory?], but for MzScheme
launchers. The result is @scheme[#f] for all platforms.}
@defproc[(mred-launcher-add-suffix [path-string? path]) path?]{
Returns a path with a suitable executable suffix added, if it's not
present already.}
@defproc[(mzscheme-launcher-add-suffix [path-string? path]) path?]{
Like @scheme[mred-launcher-add-suffix], but for MzScheme launchers.}
@defproc[(mred-launcher-put-file-extension+style+filters)
(values (or/c string? false/c)
(listof (one-of/c 'packages 'enter-packages))
(listof (list/c string? string?)))]{
Returns three values suitable for use as the @scheme[extension],
@scheme[style], and @scheme[filters] arguments to @scheme[put-file],
respectively.
If MrEd launchers for the current platform were directories form the
user's perspective, the @scheme[style] result is suitable for use with
@scheme[get-directory], and the @scheme[extension] result may be a
string indicating a required extension for the directory name. }
@defproc[(mzscheme-launcher-put-file-extension+style+filters)
(values (or/c string? false/c)
(listof (one-of/c 'packages 'enter-packages))
(listof (list/c string? string?)))]{
Like @scheme[mred-launcher-get-file-extension+style+filters], but for
MzScheme launchers.}
@; ----------------------------------------------------------------------
@section{Launcher Configuration}
@defproc[(mred-launcher-up-to-date? [dest path-string?]
[aux (listof (cons/c symbol? any/c))])
boolean?]{
Returns @scheme[#t] if the MrEd launcher @scheme[dest] does not need
to be updated, assuming that @scheme[dest] is a launcher and its
arguments have not changed.}
@defproc[(mzscheme-launcher-up-to-date? [dest path-string?]
[aux (listof (cons/c symbol? any/c))])
boolean?]{
Analogous to @scheme[mred-launcher-up-to-date?], but for a MzScheme
launcher.}
@defproc[(build-aux-from-path [path path-string?])
(listof (cons/c symbol? any/c))]{
Creates an association list suitable for use with
@scheme[make-mred-launcher] or @scheme[create-embedding-executable].
It builds associations by adding to @scheme[path] suffixes, such as
@filepath{.icns}, and checking whether such a file exists.
The recognized suffixes are as follows:
@itemize[
@item{@filepath{.icns} @'rarr @scheme['icns] file for use under Mac
OS X}
@item{@filepath{.ico} @'rarr @scheme['ico] file for use under
Windows}
@item{@filepath{.lch} @'rarr @scheme['independent?] as @scheme[#t]
(the file content is ignored) for use under Windows}
@item{@filepath{.creator} @'rarr @scheme['creator] as the initial
four characters in the file for use under Mac OS X}
@item{@filepath{.filetypes} @'rarr @scheme['file-types] as
@scheme[read] content (a single S-expression), and
@scheme['resource-files] as a list constructed by finding
@scheme["CFBundleTypeIconFile"] entries in @scheme['file-types]
(and filtering duplicates); for use under Mac OS X}
@item{@filepath{.utiexports} @'rarr @scheme['uti-exports] as
@scheme[read] content (a single S-expression); for use under
Mac OS X}
]}
@defparam[current-launcher-variant variant symbol?]{
A parameter that indicates a variant of MzScheme or MrEd to use for
launcher creation and for generating launcher names. The default is
the result of @scheme[(system-type 'gc)]. Under Unix and Windows, the
possibilities are @scheme['cgc] and @scheme['3m]. Under Mac OS X, the
@scheme['script-3m] and @scheme['script-cgc] variants are also
available for MrEd launchers.}
@defproc[(available-mred-variants) (listof symbol?)]{
Returns a list of symbols corresponding to available variants of MrEd
in the current PLT Scheme installation. The list normally includes at
least one of @scheme['3m] or @scheme['cgc]--- whichever is the result
of @scheme[(system-type 'gc)]---and may include the other, as well as
@scheme['script-3m] and/or @scheme['script-cgc] under Mac OS X.}
@defproc[(available-mzscheme-variants) (listof symbol?)]{
Returns a list of symbols corresponding to available variants of
MzScheme in the current PLT Scheme installation. The list normally
includes at least one of @scheme['3m] or @scheme['cgc]---whichever is
the result of @scheme[(system-type 'gc)]---and may include the other.}
@; ----------------------------------------
@section{Launcher Creation Signature}
@defmodule[launcher/launcher-sig]
@defsignature/splice[launcher^ ()]{
Includes the identifiers provided by @schememodname[launcher/launcher].}
@; ----------------------------------------
@section{Launcher Creation Unit}
@defmodule[launcher/launcher-unit]
@defthing[launcher@ unit?]{
A unit that imports nothing and exports @scheme[launcher^].}

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