fix make-base-namespace in scheme/base (PR 10870)

This commit is contained in:
Matthew Flatt 2010-04-25 20:12:06 -06:00
parent 4fe5353dc3
commit a6694a08b7
14 changed files with 248 additions and 162 deletions

View File

@ -1,11 +1,11 @@
#lang scheme/base
#lang racket/base
(require scheme/port
scheme/path
scheme/list
scheme/string
(require racket/port
racket/path
racket/list
racket/string
syntax/moddep
scheme/gui/dynamic
racket/gui/dynamic
planet/config)
(provide gui?
@ -53,7 +53,7 @@
(define gui? (gui-available?))
(define-syntax mz/mr ; use a value for mzscheme, or pull a mred binding
(define-syntax mz/mr ; use a value for mzracket, or pull a mred binding
(syntax-rules ()
[(mz/mr mzval mrsym)
(if gui? (gui-dynamic-require 'mrsym) mzval)]))
@ -479,8 +479,8 @@
;; needed to make the test-engine work
(let ([orig-ns (namespace-anchor->empty-namespace anchor)])
(parameterize ([current-namespace orig-ns])
(dynamic-require 'scheme/class #f))
(namespace-attach-module orig-ns 'scheme/class))]))
(dynamic-require 'racket/class #f))
(namespace-attach-module orig-ns 'racket/class))]))
;; Returns a single (module ...) or (begin ...) expression (a `begin' list
;; will be evaluated one by one -- the language might not have a `begin').
@ -490,7 +490,7 @@
;; A more general solution would be to create a new module that exports
;; the given language plus all of the given extra requires.
;;
;; We use `#%requre' because, unlike the `require' of scheme/base,
;; We use `#%requre' because, unlike the `require' of racket/base,
;; it comes from `#%kernel', so it's always present through
;; transitive requires.
(define (build-program language requires input-program)
@ -882,7 +882,7 @@
(if (eq? h default-sandbox-exit-handler)
(lambda _ (terminate+kill! 'exited #f))
h))]
;; Note the above definition of `current-eventspace': in MzScheme, it
;; Note the above definition of `current-eventspace': in Racket, it
;; is an unused parameter. Also note that creating an eventspace
;; starts a thread that will eventually run the callback code (which
;; evaluates the program in `run-in-bg') -- so this parameterization

View File

@ -1,5 +1,8 @@
#lang scheme/private
(require "private/namespace.ss")
(provide (except-out (all-from-out racket/base)
struct
hash hasheq hasheqv))
hash hasheq hasheqv)
make-base-empty-namespace
make-base-namespace)

View File

@ -0,0 +1,21 @@
#lang racket/base
(provide make-base-empty-namespace
make-base-namespace)
(define orig-varref (#%variable-reference orig-varref))
(define (make-base-empty-namespace)
(let* ([this-ns (variable-reference->empty-namespace orig-varref)]
[ns (parameterize ([current-namespace this-ns]) ; ensures correct phase
(make-empty-namespace))])
(namespace-attach-module this-ns
'scheme/base
ns)
ns))
(define (make-base-namespace)
(let ([ns (make-base-empty-namespace)])
(parameterize ([current-namespace ns])
(namespace-require 'scheme/base))
ns))

View File

@ -1,2 +1,36 @@
#lang scheme/private/provider
racket/sandbox
#lang scheme/base
(require racket/sandbox
scheme/gui/dynamic)
(provide (except-out (all-from-out racket/sandbox)
sandbox-namespace-specs
make-evaluator
make-module-evaluator)
(rename-out
[scheme:sandbox-namespace-specs sandbox-namespace-specs]
[scheme:make-evaluator make-evaluator]
[scheme:make-module-evaluator make-module-evaluator]))
;; copied from racket/sandbox :(
(define-syntax mz/mr ; use a value for mzracket, or pull a mred binding
(syntax-rules ()
[(mz/mr mzval mrsym)
(if gui? (gui-dynamic-require 'mrsym) mzval)]))
(define scheme:sandbox-namespace-specs
(make-parameter `(,(mz/mr make-base-namespace make-gui-namespace))))
(define (scheme:make-evaluator language
#:requires [requires null] #:allow-read [allow null]
. input-program)
(parameterize ([sandbox-namespace-specs (scheme:sandbox-namespace-specs)])
(apply make-evaluator
language #:requires requires #:allow-read allow
input-program)))
(define (scheme:make-module-evaluator
input-program #:allow-read [allow null] #:language [reqlang #f])
(parameterize ([sandbox-namespace-specs (scheme:sandbox-namespace-specs)])
(make-module-evaluator
input-program #:allow-read allow #:language reqlang)))

View File

@ -5,7 +5,7 @@
"scheme.ss"
"decode.ss"
racket/file
scheme/sandbox
racket/sandbox
racket/promise
mzlib/string
(for-syntax racket/base))

View File

@ -1,5 +1,5 @@
#lang scheme/base
#lang racket/base
(require scheme/promise "text/output.ss" "text/syntax-utils.ss")
(provide (all-from-out scheme/promise "text/output.ss")
(require racket/promise "text/output.ss" "text/syntax-utils.ss")
(provide (all-from-out racket/promise "text/output.ss")
begin/text include/text)

View File

@ -1,9 +1,9 @@
#lang scheme/base
#lang racket/base
(require "syntax-utils.ss" "output.ss" scheme/promise)
(require "syntax-utils.ss" "output.ss" racket/promise)
(provide (except-out (all-from-out scheme/base) #%module-begin)
(all-from-out "output.ss" scheme/promise)
(provide (except-out (all-from-out racket/base) #%module-begin)
(all-from-out "output.ss" racket/promise)
begin/text
(rename-out [module-begin/text #%module-begin]
[include/text include]))

View File

@ -1,12 +1,21 @@
#lang scribble/manual
@(require (for-syntax racket)
(for-label (only-in scheme/foreign unsafe! provide* define-unsafer)))
(for-label (only-in scheme/foreign unsafe! provide* define-unsafer)
(only-in racket/base make-base-namespace make-base-empty-namespace)))
@(define-syntax-rule (def-extras unit-struct)
@(define-syntax-rule (def-extras unit-struct
make-base-namespace-id
make-base-empty-namespace-id)
(begin
(require (for-label scheme))
(define unit-struct (racket struct))))
@(def-extras unit-struct)
(require (for-label (only-in scheme struct)
(only-in racket/base make-base-namespace
make-base-empty-namespace)))
(define unit-struct (racket struct))
(define make-base-namespace-id (racket make-base-namespace))
(define make-base-empty-namespace-id (racket make-base-empty-namespace))))
@(def-extras unit-struct
make-base-namespace-id
make-base-empty-namespace-id)
@(define-syntax-rule (compat-except sid rid . rest)
(begin
@ -29,7 +38,20 @@ old name.
@schememodname[scheme/unit] is exported, instead}
@compat-except[scheme/base racket/base]{, except that
@schememodname[racket]'s @scheme[struct] is not exported}
@schememodname[racket]'s @scheme[struct] is not exported, and
@scheme[make-base-namespace] and @scheme[make-base-empty-namespace]
are different}
@defproc[(make-base-empty-namespace) namespace?]{
Like @|make-base-empty-namespace-id| from @schememodname[racket/base],
but with @schememodname[scheme/base] attached.}
@defproc[(make-base-namespace) namespace?]{
Like @|make-base-namespace-id| from @schememodname[racket/base], but
with @schememodname[scheme/base] attached.}
@compat[scheme/async-channel racket/async-channel]
@compat[scheme/bool racket/bool]

View File

@ -5,7 +5,7 @@
scribble/html-properties
scribble/latex-properties
"utils.ss"
(for-label scheme/base))
(for-label racket/base))
@(define (fake-title . str) (apply bold str))
@ -20,16 +20,16 @@ extend or configure Scribble fall into two groups:
@item{You may need to drop into the back-end ``language'' of CSS or
Latex to create a specific output effect. For this kind of
extension, you will mostly likely attach a
@scheme[css-addition] or @scheme[tex-addition] @tech{style property}
@racket[css-addition] or @racket[tex-addition] @tech{style property}
to style, where the addition implements the style name. This
kind of extension is described in @secref["extra-style"].}
@item{You may need to produce a document whose page layout is
different from the PLT Scheme documentation style. For that
different from the Racket documentation style. For that
kind of configuration, you can run the @exec{scribble} command-line
tool and supply flags like @DFlag{prefix} or @DPFlag{style}, or
you can associate a @scheme[html-defaults] or
@scheme[latex-defaults] @tech{style property} to the main document's
you can associate a @racket[html-defaults] or
@racket[latex-defaults] @tech{style property} to the main document's
style. This kind of configuration is described in
@secref["config-style"].}
@ -42,46 +42,46 @@ extend or configure Scribble fall into two groups:
(make-tex-addition "inbox.tex")))
]{Implementing Styles}
When a string is uses as a style in an @scheme[element],
a @scheme[multiarg-element], @scheme[paragraph], @scheme[table],
@scheme[itemization], @scheme[nested-flow], or
@scheme[compound-paragraph], it corresponds to a CSS class for HTML
When a string is uses as a style in an @racket[element],
a @racket[multiarg-element], @racket[paragraph], @racket[table],
@racket[itemization], @racket[nested-flow], or
@racket[compound-paragraph], it corresponds to a CSS class for HTML
output or a Latex macro/environment for Latex output. In Latex output,
the string is used as a command name for a @scheme[paragraph]
and an environment name for a @scheme[table], @scheme[itemization],
@scheme[nested-flow], or @scheme[compound-paragraph]; the if style has
a @scheme['command] @tech{style property} for a @scheme[nested-flow] or
@scheme[compound-paragraph], then the style name is used as a command
the string is used as a command name for a @racket[paragraph]
and an environment name for a @racket[table], @racket[itemization],
@racket[nested-flow], or @racket[compound-paragraph]; the if style has
a @racket['command] @tech{style property} for a @racket[nested-flow] or
@racket[compound-paragraph], then the style name is used as a command
instead of an environment. In addition, for an itemization, the style
string is suffixed with @scheme["Item"] and used as a CSS class or Latex
string is suffixed with @racket["Item"] and used as a CSS class or Latex
macro name to use for the itemization's items (in place of @tt{item}
in the case of Latex).
To add a mapping from your own style name to a CSS configuration, add
a @scheme[css-addition] structure instance to a style's @tech{style property}
a @racket[css-addition] structure instance to a style's @tech{style property}
list. To map a style name to a Latex macro or environment, add a
@scheme[tex-addition] structure instance. A @scheme[css-addition] or
@scheme[tex-addition] is normally associated with the style whose name
@racket[tex-addition] structure instance. A @racket[css-addition] or
@racket[tex-addition] is normally associated with the style whose name
is implemented by the adition, but it can also be added to the style
for an enclosing part.
Scribble includes a number of predefined styles that are used by the
exports of @scheme[scribble/base]. You can use them or redefine
exports of @racket[scribble/base]. You can use them or redefine
them. The styles are specified by @filepath{scribble.css} and
@filepath{scribble.tex} in the @filepath{scribble} collection.
The styles used by @schememodname[scribble/manual] are implemented by
@filepath{scheme.css} and @filepath{scheme.tex} in the
The styles used by @racketmodname[scribble/manual] are implemented by
@filepath{racket.css} and @filepath{racket.tex} in the
@filepath{scribble} collection. Other libraries, such as
@schememodname[scriblib/autobib], similarly implement styles through files
that are associated by @scheme[css-addition] and @scheme[tex-addition]
@racketmodname[scriblib/autobib], similarly implement styles through files
that are associated by @racket[css-addition] and @racket[tex-addition]
@tech{style properties}.
To avoid collisions with future additions to Scribble, start your
style name with an uppercase letter that is not @litchar{S}. An
uppercase letter helps to avoid collisions with macros defined by
Latex packages, and future styles needed by @schememodname[scribble/base] and
@schememodname[scribble/manual] will start with @litchar{S}.
Latex packages, and future styles needed by @racketmodname[scribble/base] and
@racketmodname[scribble/manual] will start with @litchar{S}.
For example, a Scribble document
@ -136,9 +136,9 @@ set of page-layout and font properties that are used by other
commands. The style-replacement kind of configuration corresponds to
re-defining Latex macros or overriding CSS class attributes. When
@exec{setup-plt} builds PDF documentation, it uses both kinds of
configuration to produce a standard layout for PLT Scheme manuals;
configuration to produce a standard layout for Racket manuals;
that is, it selects a particular page layout, and it replaces some
@schememodname[scheme/base] styles.
@racketmodname[racket/base] styles.
Two kinds of files implement the two kinds of configuration:
@ -155,7 +155,7 @@ Two kinds of files implement the two kinds of configuration:
@item{A @deftech{style file} refines the implementation of styles
nused in the document---typically just the ``built-in'' styles
used by @schememodname[scribble/base].
used by @racketmodname[scribble/base].
The default style files, @filepath{scribble-style.css} and
@filepath{scribble-style.tex} in the @filepath{scribble}
@ -191,24 +191,24 @@ accompanying files:
When using the @exec{scribble} command-line utility, a document can
declare its default style, prefix, and extra files through a
@scheme[html-defaults] and/or @scheme[latex-defaults]
@racket[html-defaults] and/or @racket[latex-defaults]
@tech{style property}. In particular, when using the @exec{scribble}
command-line tool to generate Latex or PDF a document whose main part
is implemented with @scheme[#, @hash-lang[] #,
@schememodname[scribble/manual]], the result has the standard PLT
Scheme manual configuration, because @schememodname[scribble/manual]
associates a @scheme[latex-defaults] @tech{style property} with the exported
document. The @schememodname[scribble/sigplan] language similarly
is implemented with @racket[#, @hash-lang[] #,
@racketmodname[scribble/manual]], the result has the standard
Racket manual configuration, because @racketmodname[scribble/manual]
associates a @racket[latex-defaults] @tech{style property} with the exported
document. The @racketmodname[scribble/sigplan] language similarly
associates a default configuration with an exported document. As
libraries imported with @scheme[require], however,
@schememodname[scribble/manual] and @schememodname[scribble/sigplan]
libraries imported with @racket[require], however,
@racketmodname[scribble/manual] and @racketmodname[scribble/sigplan]
simply implement new styles in a composable way.
Whether or not a document has a default prefix- and style-file
configuration through a @tech{style property}, the defaults can be
overridden using @exec{scribble} command-line flags. Furthermore,
languages like @schememodname[scribble/manual] and
@schememodname[scribble/sigplan] add a @scheme[html-defaults] and/or
@scheme[latex-defaults] @tech{style property} to a main-document part only if
languages like @racketmodname[scribble/manual] and
@racketmodname[scribble/sigplan] add a @racket[html-defaults] and/or
@racket[latex-defaults] @tech{style property} to a main-document part only if
it does not already have such a property added through the
@scheme[#:style] argument of @scheme[title].
@racket[#:style] argument of @racket[title].

View File

@ -2,7 +2,7 @@
@(require scribble/manual
scribble/core scribble/html-properties scribble/latex-properties
"utils.ss"
(for-label scheme/base
(for-label racket/base
;; FIXME: need to get this in
;; scribble/text
))
@ -13,21 +13,21 @@
(make-css-addition "shaded.css")))
]{Text Preprocessing}
@defmodulelang[scribble/text]{The @schememodname[scribble/text]
language provides everything from @scheme[scheme/base] with a few
@defmodulelang[scribble/text]{The @racketmodname[scribble/text]
language provides everything from @racket[racket/base] with a few
changes that make it suitable as a preprocessor language:
@itemize[
@item{It uses @scheme[read-syntax-inside] to read the body of the
@item{It uses @racket[read-syntax-inside] to read the body of the
module, similar to @secref["docreader"]. This means that by
default, all text is read in as Scheme strings; and
@seclink["reader"]|{@-forms}| can be used to use Scheme
default, all text is read in as Racket strings; and
@seclink["reader"]|{@-forms}| can be used to use Racket
functions and expression escapes.}
@item{Values of expressions are printed with a custom
@scheme[output] function. This function displays most values
in a similar way to @scheme[display], except that it is more
@racket[output] function. This function displays most values
in a similar way to @racket[display], except that it is more
convenient for a preprocessor output.}]
}
@ -42,9 +42,9 @@ changes that make it suitable as a preprocessor language:
@section{Writing Preprocessor Files}
The combination of the two features makes text in files in the
@scheme[scribble/text] language be read as strings, which get printed
out when the module is @scheme[require]d, for example, when a file is
given as an argument to @exec{mzscheme}. (In these example the left
@racket[scribble/text] language be read as strings, which get printed
out when the module is @racket[require]d, for example, when a file is
given as an argument to @exec{racket}. (In these example the left
part shows the source input, and the right part the printed result.)
@example|-{#lang scribble/text
@ -58,14 +58,14 @@ part shows the source input, and the right part the printed result.)
feature on top of feature, but
blah blah blah.}-|
Using @seclink["reader"]|{@-forms}|, we can define and use Scheme
Using @seclink["reader"]|{@-forms}|, we can define and use Racket
functions.
@example|-{#lang scribble/text
@(require scheme/list)
@(require racket/list)
@(define Foo "Preprocessing")
@(define (3x . x)
;; scheme syntax here
;; racket syntax here
(add-between (list x x x) " "))
@Foo languages should
be designed not by piling
@ -77,10 +77,10 @@ functions.
feature on top of feature, but
blah blah blah.}-|
As demonstrated in this case, the @scheme[output] function simply
As demonstrated in this case, the @racket[output] function simply
scans nested list structures recursively, which makes them convenient
for function results. In addition, @scheme[output] prints most values
similarly to @scheme[display] --- notable exceptions are void and
for function results. In addition, @racket[output] prints most values
similarly to @racket[display] --- notable exceptions are void and
false values which cause no output to appear. This can be used for
convenient conditional output.
@ -184,7 +184,7 @@ what looks like erroneous indentation. More about this below.)
A better approach is to generate newlines only when needed.
@example|-{#lang scribble/text
@(require scheme/list)
@(require racket/list)
@(define (counts n str)
(add-between
(for/list ([i (in-range 1 (+ n 1))])
@ -200,9 +200,9 @@ A better approach is to generate newlines only when needed.
3 Mississippi,
... and I'm done.}-|
In fact, this is common enough that the @scheme[scribble/text]
language provides a convenient facility: @scheme[add-newlines] is a
function that is similar to @scheme[add-between] using a newline
In fact, this is common enough that the @racket[scribble/text]
language provides a convenient facility: @racket[add-newlines] is a
function that is similar to @racket[add-between] using a newline
string as the default separator, except that false and void values are
filtered out before doing so.
@ -262,9 +262,9 @@ that uses the Scribble @"@"-form syntax.)
Because the Scribble reader is uniform, you can use it in place of any
expression where it is more convenient. (By convention, we use a
plain S-expression syntax when we want a Scheme expression escape, and
plain S-expression syntax when we want a Racket expression escape, and
an @"@"-form for expressions that render as text, which, in the
@scheme[scribble/text] language, is any value-producing expression.)
@racket[scribble/text] language, is any value-producing expression.)
For example, you can use an @"@"-form for a function that you define.
@example|-{#lang scribble/text
@ -291,7 +291,7 @@ separate text arguments in the S-expression part of an @"@"-form.
Either you're with us, or against us.
}-|
You can even use @"@"-forms with a Scheme quote or quasiquote as the
You can even use @"@"-forms with a Racket quote or quasiquote as the
``head'' part to make it shorter, or use a macro to get grouping of
sub-parts without dealing with quotes.
@ -317,11 +317,11 @@ sub-parts without dealing with quotes.
}-|
Yet another solution is to look at the text values and split the input
arguments based on a specific token. Using @scheme[match] can make it
arguments based on a specific token. Using @racket[match] can make it
convenient --- you can even specify the patterns with @"@"-forms.
@example|-{#lang scribble/text
@(require scheme/match)
@(require racket/match)
@(define (features . text)
(match text
[@list{@|1st|@...
@ -346,11 +346,11 @@ convenient --- you can even specify the patterns with @"@"-forms.
}-|
In particular, it is often convenient to split the input by lines,
identified by delimiting @scheme["\n"] strings. Since this can be
useful, a @scheme[split-lines] function is provided.
identified by delimiting @racket["\n"] strings. Since this can be
useful, a @racket[split-lines] function is provided.
@example|-{#lang scribble/text
@(require scheme/list)
@(require racket/list)
@(define (features . text)
(add-between (split-lines text)
", "))
@ -437,9 +437,9 @@ printouts, as the results are rarely desirable.
two1 3}-|
Note that you don't need side-effects if you want infinite output.
The @scheme[output] function iterates thunks and (composable)
The @racket[output] function iterates thunks and (composable)
promises, so you can create a loop that is delayed in either form.
@; Note: there is some sfs-related problem in mzscheme that makes it not
@; Note: there is some sfs-related problem in racket that makes it not
@; run in bounded space, so don't show it for nowx.
@example|-{#lang scribble/text
@ -483,12 +483,12 @@ The Scribble reader ignores indentation spaces in its body. This is
an intentional feature, since you usually do not want an expression to
depend on its position in the source. But the question is how
@emph{can} we render some output text with proper indentation. The
@scheme[output] function achieves that by assigning a special meaning
@racket[output] function achieves that by assigning a special meaning
to lists: when a newline is part of a list's contents, it causes the
following text to appear with indentation that corresponds to the
column position at the beginning of the list. In most cases, this
makes the output appear ``as intended'' when lists are used for nested
pieces of text --- either from a literal @scheme[list] expression, or
pieces of text --- either from a literal @racket[list] expression, or
an expression that evaluates to a list, or when a list is passed on as
a value; either as a toplevel expression, or as a nested value; either
appearing after spaces, or after other output.
@ -530,11 +530,11 @@ appearing after spaces, or after other output.
(for/list ([i (in-naturals 1)]
[item (in-list items)])
@list{@|i|. @item})))
Todo: @enumerate[@list{Install PLT Scheme}
Todo: @enumerate[@list{Install Racket}
@list{Hack, hack, hack}
@list{Profit}].
---***---
Todo: 1. Install PLT Scheme;
Todo: 1. Install Racket;
2. Hack, hack, hack;
3. Profit.}-|
@ -697,8 +697,8 @@ appearing after spaces, or after other output.
}-|
There are, however, cases when you need more refined control over the
output. The @scheme[scribble/text] provides a few functions for such
cases. The @scheme[splice] function is used to group together a
output. The @racket[scribble/text] provides a few functions for such
cases. The @racket[splice] function is used to group together a
number of values but avoid introducing a new indentation context.
@example|-{#lang scribble/text
@ -723,9 +723,9 @@ number of values but avoid introducing a new indentation context.
end
}-|
The @scheme[disable-prefix] function disables all indentation
The @racket[disable-prefix] function disables all indentation
printouts in its contents, including the indentation before the body
of the @scheme[disable-prefix] value itself. It is useful, for
of the @racket[disable-prefix] value itself. It is useful, for
example, to print out CPP directives.
@example|-{#lang scribble/text
@ -758,7 +758,7 @@ example, to print out CPP directives.
}
}-|
If there are values after a @scheme[disable-prefix] value on the same
If there are values after a @racket[disable-prefix] value on the same
line, they will get indented to the goal column (unless the output is
already beyond it).
@ -807,7 +807,7 @@ already beyond it).
}-|
There are cases where each line should be prefixed with some string
other than a plain indentation. The @scheme[add-prefix] function
other than a plain indentation. The @racket[add-prefix] function
causes its contents to be printed using some given string prefix for
every line. The prefix gets accumulated to an existing indentation,
and indentation in the contents gets added to the prefix.
@ -840,11 +840,11 @@ and indentation in the contents gets added to the prefix.
}
}-|
When combining @scheme[add-prefix] and @scheme[disable-prefix] there
is an additional value that can be useful: @scheme[flush]. This is a
value that causes @scheme[output] to print the current indentation and
When combining @racket[add-prefix] and @racket[disable-prefix] there
is an additional value that can be useful: @racket[flush]. This is a
value that causes @racket[output] to print the current indentation and
prefix. This makes it possible to get the ``ignored as a prefix''
property of @scheme[disable-prefix] but only for a nested prefix.
property of @racket[disable-prefix] but only for a nested prefix.
@example|-{#lang scribble/text
@(define (comment . text)
@ -923,7 +923,7 @@ property of @scheme[disable-prefix] but only for a nested prefix.
Using additional files that contain code for your preprocessing is
trivial: the preprocessor source is still source code in a module, so
you can @scheme[require] additional files with utility functions.
you can @racket[require] additional files with utility functions.
@example|-{#lang scribble/text
@(require "itemize.ss")
@ -933,7 +933,7 @@ you can @scheme[require] additional files with utility functions.
@list{Hack some
more}]
---***--- itemize.ss
#lang scheme
#lang racket
(provide itemize)
(define (itemize . items)
(add-between (map (lambda (item)
@ -948,7 +948,7 @@ you can @scheme[require] additional files with utility functions.
more
}-|
Note that the @seclink["at-exp-lang"]{@scheme[at-exp] language} can
Note that the @seclink["at-exp-lang"]{@racket[at-exp] language} can
often be useful here, since such files need to deal with texts. Using
it, it is easy to include a lot of textual content.
@ -961,8 +961,8 @@ it, it is easy to include a lot of textual content.
more}]
@summary
---***--- stuff.ss
#lang at-exp scheme/base
(require scheme/list)
#lang at-exp racket/base
(require racket/list)
(provide (all-defined-out))
(define (itemize . items)
(add-between (map (lambda (item)
@ -983,17 +983,17 @@ it, it is easy to include a lot of textual content.
}-|
Of course, the extreme side of this will be to put all of your content
in a plain Scheme module, using @"@"-forms for convenience. However,
in a plain Racket module, using @"@"-forms for convenience. However,
there is no need to use the preprocessor language in this case;
instead, you can @scheme[(require scribble/text)], which will get all
of the bindings that are available in the @scheme[scribble/text]
language. Using @scheme[output], switching from a preprocessed files
to a Scheme file is very easy ---- choosing one or the other depends
instead, you can @racket[(require scribble/text)], which will get all
of the bindings that are available in the @racket[scribble/text]
language. Using @racket[output], switching from a preprocessed files
to a Racket file is very easy ---- choosing one or the other depends
on whether it is more convenient to write a text file with occasional
Scheme expressions or the other way.
Racket expressions or the other way.
@example|-{#lang at-exp scheme/base
(require scribble/text scheme/list)
@example|-{#lang at-exp racket/base
(require scribble/text racket/list)
(define (itemize . items)
(add-between (map (lambda (item)
@list{* @item})
@ -1026,12 +1026,12 @@ mostly-text file from a preprocessor file. It might be because you
prefer to split the source text to several files, or because you need
to preprocess a file without even a @litchar{#lang} header (for
example, an HTML template file that is the result of an external
editor). For these cases, the @scheme[scribble/text] language
provides an @scheme[include] form that includes a file in the
editor). For these cases, the @racket[scribble/text] language
provides an @racket[include] form that includes a file in the
preprocessor syntax (where the default parsing mode is text).
@example|-{#lang scribble/text
@(require scheme/list)
@(require racket/list)
@(define (itemize . items)
(list
"<ul>"
@ -1074,12 +1074,12 @@ preprocessor syntax (where the default parsing mode is text).
</html>
}-|
(Using @scheme[require] with a text file in the @scheme[scribble/text]
(Using @racket[require] with a text file in the @racket[scribble/text]
language will not work as intended: using the preprocessor language
means that the text is displayed when the module is invoked, so the
required file's contents will be printed before any of the requiring
module's text does. If you find yourself in such a situation, it is
better to switch to a Scheme-with-@"@"-expressions file as shown
better to switch to a Racket-with-@"@"-expressions file as shown
above.)
@;FIXME: add more text on `restore-prefix', `set-prefix', `with-writer'
@ -1087,20 +1087,20 @@ above.)
@;FIXME: add this to the reference section
@;@defform[(include filename)]{
@;
@;Preprocess the @scheme[filename] using the same syntax as
@;@scheme[scribble/text]. This is similar to using @scheme[load] in a
@;Preprocess the @racket[filename] using the same syntax as
@;@racket[scribble/text]. This is similar to using @racket[load] in a
@;namespace that can access names bound in the current file so included
@;code can refer to bindings from the including module. Note, however,
@;that the including module cannot refer to names that are bound the
@;included file because it is still a plain scheme module---for such
@;uses you should still use @scheme[require] as usual.}
@;included file because it is still a plain racket module---for such
@;uses you should still use @racket[require] as usual.}
@; Two random tests
@example[#:hidden]|-{
#lang scribble/text
@define[name]{PLT Scheme}
@define[name]{Racket}
Suggested price list for "@name"
@ -1124,11 +1124,11 @@ above.)
Total: @items-num items
Average price: $@|average|.99
---***---
Suggested price list for "PLT Scheme"
Suggested price list for "Racket"
0. PLT Scheme Home edition: $99.99
1. PLT Scheme Professional edition: $149.99
2. PLT Scheme Enterprize edition: $349.99
0. Racket Home edition: $99.99
1. Racket Professional edition: $149.99
2. Racket Enterprize edition: $349.99
Total: 3 items
Average price: $199.99

View File

@ -1,12 +1,12 @@
#lang scheme/base
#lang racket/base
(require scribble/manual
(for-label scheme/base
scheme/contract))
(for-label racket/base
racket/contract))
(provide (all-from-out scribble/manual)
(for-label (except-out (all-from-out scheme/base
scheme/contract)
(for-label (except-out (all-from-out racket/base
racket/contract)
#%module-begin))
refman)

View File

@ -37,7 +37,8 @@
";" vc "/PlatformSDK/lib"))))
(require dynext/compile dynext/link mzlib/etc)
(let ([c (build-path (this-expression-source-directory) "foreign-test.c")]
(define delete-test-files
(let ([c (build-path (this-expression-source-directory) "foreign-test.c")]
[o (build-path (current-directory) "foreign-test.o")]
[so (build-path (current-directory)
(bytes->path (bytes-append #"foreign-test"
@ -46,7 +47,10 @@
(when (file-exists? so) (delete-file so))
(parameterize ([current-standard-link-libraries '()])
(compile-extension #t c o '())
(link-extension #t (list o) so)))
(link-extension #t (list o) so))
(lambda ()
(when (file-exists? o) (delete-file o))
(when (file-exists? so) (delete-file so)))))
(define test-lib (ffi-lib "./foreign-test"))
@ -218,6 +222,8 @@
(test #t ptr-equal? #f (ptr-add (ptr-add #f 8) -8))
)
(delete-test-files)
(report-errs)
#| --- ignore everything below ---

View File

@ -5,8 +5,8 @@
scribblings/reference/mz
"utils.ss"
(for-label unstable/sequence
scheme/contract
scheme/base))
racket/contract
racket/base))
@(define the-eval (make-base-eval))
@(the-eval '(require unstable/sequence))
@ -19,7 +19,7 @@
@defproc[(in-syntax [stx syntax?]) sequence?]{
Produces a sequence equivalent to @scheme[(syntax->list lst)].
Produces a sequence equivalent to @racket[(syntax->list lst)].
@speed[in-syntax "syntax"]
@examples[#:eval the-eval
@ -28,15 +28,15 @@ Produces a sequence equivalent to @scheme[(syntax->list lst)].
@defproc[(in-pairs [seq sequence?]) sequence?]{
Produces a sequence equivalent to
@scheme[(in-parallel (sequence-lift car seq) (sequence-lift cdr seq))].
@racket[(in-parallel (sequence-lift car seq) (sequence-lift cdr seq))].
}
@defproc[(in-sequence-forever [seq sequence?] [val any/c]) sequence?]{
Produces a sequence whose values are the elements of @scheme[seq], followed by @scheme[val] repeated.
Produces a sequence whose values are the elements of @racket[seq], followed by @racket[val] repeated.
}
@defproc[(sequence-lift [f procedure?] [seq sequence?]) sequence?]{
Produces the sequence of @scheme[f] applied to each element of @scheme[seq].
Produces the sequence of @racket[f] applied to each element of @racket[seq].
@examples[#:eval the-eval
(for/list ([x (sequence-lift add1 (in-range 10))])
x)]

View File

@ -1,4 +1,4 @@
#lang at-exp scheme/base
#lang at-exp racket/base
(require scribble/base scribble/manual scribble/core)
(provide unstable
unstable-header