split reqprov.ss to require.ss and provide.ss
svn: r8952
This commit is contained in:
parent
9c0df7fc7c
commit
c3e9f14441
15
collects/scheme/provide.ss
Normal file
15
collects/scheme/provide.ss
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#lang scheme/base
|
||||||
|
|
||||||
|
(require (for-syntax scheme/base scheme/provide-transform))
|
||||||
|
|
||||||
|
(provide matching-identifiers-out)
|
||||||
|
(define-syntax matching-identifiers-out
|
||||||
|
(make-provide-transformer
|
||||||
|
(lambda (stx modes)
|
||||||
|
(syntax-case stx ()
|
||||||
|
[(_ rx spec)
|
||||||
|
(regexp? (syntax-e #'rx))
|
||||||
|
(let ([rx (syntax-e #'rx)])
|
||||||
|
(filter (lambda (e)
|
||||||
|
(regexp-match? rx (symbol->string (export-out-sym e))))
|
||||||
|
(expand-export #'spec modes)))]))))
|
|
@ -9,8 +9,8 @@
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ rx spec)
|
[(_ rx spec)
|
||||||
(regexp? (syntax-e #'rx))
|
(regexp? (syntax-e #'rx))
|
||||||
(let*-values ([(rx) (syntax-e #'rx)]
|
(let-values ([(rx) (syntax-e #'rx)]
|
||||||
[(imports sources) (expand-import #'spec)])
|
[(imports sources) (expand-import #'spec)])
|
||||||
(values
|
(values
|
||||||
(filter (lambda (i)
|
(filter (lambda (i)
|
||||||
(regexp-match? rx (symbol->string
|
(regexp-match? rx (symbol->string
|
|
@ -1341,7 +1341,7 @@ pre-defined forms are as follows.
|
||||||
error is reported.}
|
error is reported.}
|
||||||
|
|
||||||
@defsubform[(except-in require-spec id ...)]{ Like
|
@defsubform[(except-in require-spec id ...)]{ Like
|
||||||
@scheme[require-spec], but omitting those exports for which
|
@scheme[require-spec], but omitting those imports for which
|
||||||
@scheme[id]s are the identifiers to bind; if any @scheme[id] is not
|
@scheme[id]s are the identifiers to bind; if any @scheme[id] is not
|
||||||
in the set that @scheme[require-spec] describes, a syntax error is
|
in the set that @scheme[require-spec] describes, a syntax error is
|
||||||
reported.}
|
reported.}
|
||||||
|
@ -1715,9 +1715,9 @@ introduced at the same time. Similarly, @schemeidfont{all-defined} and
|
||||||
its variants export only definitions accessible from the lexical
|
its variants export only definitions accessible from the lexical
|
||||||
context of the @scheme[phaseless-spec] form.}
|
context of the @scheme[phaseless-spec] form.}
|
||||||
|
|
||||||
@subsection{Additional @scheme[require] and @scheme[provide] Macros}
|
@subsection{Additional @scheme[require] Macros}
|
||||||
|
|
||||||
@note-lib-only[scheme/reqprov]
|
@note-lib-only[scheme/require]
|
||||||
|
|
||||||
This library provides additional forms for use in @scheme[require] and
|
This library provides additional forms for use in @scheme[require] and
|
||||||
@scheme[provide]. These forms provide more complex selection and
|
@scheme[provide]. These forms provide more complex selection and
|
||||||
|
@ -1726,22 +1726,34 @@ massaging of identifiers that are useful in some cases. Note that a
|
||||||
requiring the library itself should be a separate form. For example, use
|
requiring the library itself should be a separate form. For example, use
|
||||||
|
|
||||||
@schemeblock[
|
@schemeblock[
|
||||||
(require scheme/reqprov)
|
(require scheme/require)
|
||||||
(require (matching-identifiers-in #rx"foo" "foo.ss"))
|
(require (matching-identifiers-in #rx"foo" "foo.ss"))
|
||||||
]
|
]
|
||||||
|
|
||||||
instead of
|
instead of
|
||||||
|
|
||||||
@schemeblock[
|
@schemeblock[
|
||||||
(require scheme/reqprov
|
(require scheme/require
|
||||||
(matching-identifiers-in #rx"foo" "foo.ss"))
|
(matching-identifiers-in #rx"foo" "foo.ss"))
|
||||||
]
|
]
|
||||||
|
|
||||||
@defsubform[(matching-identifiers-in regexp require-spec)]{
|
@defsubform[(matching-identifiers-in regexp require-spec)]{
|
||||||
Like @scheme[require-spec], but including only exports whose names
|
Like @scheme[require-spec], but including only imports whose names
|
||||||
match @scheme[regexp]. @scheme[regexp] must be a literal regular
|
match @scheme[regexp]. @scheme[regexp] must be a literal regular
|
||||||
expression (see @secref["regexp"]).}
|
expression (see @secref["regexp"]).}
|
||||||
|
|
||||||
|
@subsection{Additional @scheme[provide] Macros}
|
||||||
|
|
||||||
|
@note-lib-only[scheme/provide]
|
||||||
|
|
||||||
|
This library provides additional forms for use in @scheme[provide], it
|
||||||
|
mirrors the @scheme[scheme/require] library.
|
||||||
|
|
||||||
|
@defsubform[(matching-identifiers-out regexp provide-spec)]{
|
||||||
|
Like @scheme[provide-spec], but omitting the export of each binding
|
||||||
|
with an external name that matches @scheme[regexp]. @scheme[regexp]
|
||||||
|
must be a literal regular expression (see @secref["regexp"]).}
|
||||||
|
|
||||||
@;------------------------------------------------------------------------
|
@;------------------------------------------------------------------------
|
||||||
@section[#:tag "#%top-interaction"]{Interaction Wrapper: @scheme[#%top-interaction]}
|
@section[#:tag "#%top-interaction"]{Interaction Wrapper: @scheme[#%top-interaction]}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
|
|
||||||
(require scheme/reqprov)
|
(require scheme/require)
|
||||||
|
|
||||||
;; Note: this also gets additional functions for srfi-66 (u8vector-copy,
|
;; Note: this also gets additional functions for srfi-66 (u8vector-copy,
|
||||||
;; u8vector=?, u8vector-compare, u8vector-copy!) -- but that should be fine,
|
;; u8vector=?, u8vector-compare, u8vector-copy!) -- but that should be fine,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
|
|
||||||
(require scheme/reqprov)
|
(require scheme/require)
|
||||||
(require (matching-identifiers-in #px"\\bu8vector\\b" scheme/foreign))
|
(require (matching-identifiers-in #px"\\bu8vector\\b" scheme/foreign))
|
||||||
(provide (all-from-out scheme/foreign))
|
(provide (all-from-out scheme/foreign))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user