changed htdp languages to allow identifier module paths; scribble improvements to latex back-end; added definterface
svn: r13681
This commit is contained in:
parent
4056e03bc1
commit
9927b0b576
|
@ -1183,6 +1183,16 @@
|
|||
(begin
|
||||
(check-string-form stx #'s)
|
||||
#'(require s))]
|
||||
[(_ id)
|
||||
(identifier? #'id)
|
||||
(begin
|
||||
(unless (module-path? (syntax-e #'id))
|
||||
(teach-syntax-error
|
||||
'require
|
||||
stx
|
||||
#'id
|
||||
"bad syntax for a module path"))
|
||||
#'(require id))]
|
||||
[(_ (lib . rest))
|
||||
(let ([s (syntax->list #'rest)])
|
||||
(unless ((length s) . >= . 2)
|
||||
|
|
|
@ -32,7 +32,9 @@
|
|||
[(pair? e) (or (loop (car e))
|
||||
(loop (cdr e)))]
|
||||
[else #f])))
|
||||
read-syntax)])
|
||||
(lambda (src in)
|
||||
(parameterize ([read-accept-reader #t])
|
||||
(read-syntax src in))))])
|
||||
(unless (and (procedure? read-syntax)
|
||||
(procedure-arity-includes? read-syntax 2))
|
||||
(raise-syntax-error
|
||||
|
|
|
@ -228,14 +228,6 @@
|
|||
(define/override (render-table t part ri inline-table?)
|
||||
(let* ([boxed? (eq? 'boxed (table-style t))]
|
||||
[index? (eq? 'index (table-style t))]
|
||||
[inline?
|
||||
(and (not boxed?) (not index?)
|
||||
(or (null? (table-flowss t))
|
||||
(= 1 (length (car (table-flowss t)))))
|
||||
(let ([m (current-table-mode)])
|
||||
(and m
|
||||
(equal? "bigtabular" (car m))
|
||||
(= 1 (length (car (table-flowss (cadr m))))))))]
|
||||
[tableform
|
||||
(cond [index? "list"]
|
||||
[(and (not (current-table-mode)) (not inline-table?))
|
||||
|
@ -244,7 +236,21 @@
|
|||
[opt (cond [(equal? tableform "bigtabular") "[l]"]
|
||||
[(equal? tableform "tabular") "[t]"]
|
||||
[else ""])]
|
||||
[flowss (if index? (cddr (table-flowss t)) (table-flowss t))])
|
||||
[flowss (if index? (cddr (table-flowss t)) (table-flowss t))]
|
||||
[row-styles (cdr (or (and (list? (table-style t))
|
||||
(assoc 'row-styles (table-style t)))
|
||||
(cons #f (map (lambda (x) #f) flowss))))]
|
||||
[inline?
|
||||
(and (not boxed?)
|
||||
(not index?)
|
||||
(ormap (lambda (rs) (equal? rs "inferencetop")) row-styles)
|
||||
(or (null? (table-flowss t))
|
||||
(= 1 (length (car (table-flowss t)))))
|
||||
(let ([m (current-table-mode)])
|
||||
(and m
|
||||
(equal? "bigtabular" (car m))
|
||||
(= 1 (length (car (table-flowss (cadr m))))))))]
|
||||
[boxline "{\\setlength{\\unitlength}{\\linewidth}\\begin{picture}(1,0)\\put(0,0){\\line(1,0){1}}\\end{picture}}"])
|
||||
(unless (or (null? flowss) (null? (car flowss)))
|
||||
(parameterize ([current-table-mode
|
||||
(if inline? (current-table-mode) (list tableform t))]
|
||||
|
@ -254,14 +260,7 @@
|
|||
[index? (printf "\\begin{list}{}{\\parsep=0pt \\itemsep=1pt \\leftmargin=2ex \\itemindent=-2ex}\n")]
|
||||
[inline? (void)]
|
||||
[else
|
||||
(printf "\n\n~a\\begin{~a}~a{@{}~a}\n"
|
||||
(if boxed?
|
||||
(format "{~a\\begin{picture}(1,0)\\put(0,0){\\line(1,0){1}}\\end{picture}}~a\n\\nopagebreak\n"
|
||||
"\\setlength{\\unitlength}{\\linewidth}"
|
||||
(if (equal? tableform "bigtabular")
|
||||
"\\bigtabline"
|
||||
"\n\n"))
|
||||
"")
|
||||
(printf "\n\n\\begin{~a}~a{@{}~a}\n~a"
|
||||
tableform
|
||||
opt
|
||||
(string-append*
|
||||
|
@ -276,12 +275,16 @@
|
|||
(assoc 'alignment
|
||||
(or (table-style t) null)))
|
||||
(cons #f (map (lambda (x) #f)
|
||||
(car flowss))))))))])
|
||||
(car flowss)))))))
|
||||
(if boxed?
|
||||
(if (equal? tableform "bigtabular")
|
||||
(format "~a \\endfirsthead\n" boxline)
|
||||
(format "\\multicolumn{~a}{@{}l@{}}{~a} \\\\\n"
|
||||
(length (car flowss))
|
||||
boxline))
|
||||
""))])
|
||||
(let loop ([flowss flowss]
|
||||
[row-styles
|
||||
(cdr (or (and (list? (table-style t))
|
||||
(assoc 'row-styles (table-style t)))
|
||||
(cons #f (map (lambda (x) #f) flowss))))])
|
||||
[row-styles row-styles])
|
||||
(let ([flows (car flowss)]
|
||||
[row-style (car row-styles)])
|
||||
(let loop ([flows flows])
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
(provide unsyntax
|
||||
make-binding-redirect-elements
|
||||
defidentifier
|
||||
(all-from-out "basic.ss"
|
||||
"private/manual-style.ss"
|
||||
"private/manual-scheme.ss"
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
with-exporting-libraries
|
||||
id-to-target-maker
|
||||
id-to-form-target-maker
|
||||
defidentifier
|
||||
*sig-elem
|
||||
(struct-out sig)
|
||||
;; public:
|
||||
|
@ -170,6 +171,37 @@
|
|||
(lambda () (car content))
|
||||
(lambda () (car content))))))
|
||||
|
||||
(define (defidentifier id
|
||||
#:form? [form? #f]
|
||||
#:index? [index? #t]
|
||||
#:show-libs? [show-libs? #t])
|
||||
;; This function could have more optional argument to select
|
||||
;; whether to index the id, include a toc link, etc.
|
||||
(let ([dep? #t])
|
||||
(let ([maker (if form?
|
||||
(id-to-form-target-maker id dep?)
|
||||
(id-to-target-maker id dep?))]
|
||||
[elem (if show-libs?
|
||||
(definition-site (syntax-e id) id form?)
|
||||
(to-element id))])
|
||||
(if maker
|
||||
(maker (list elem)
|
||||
(lambda (tag)
|
||||
(let ([elem
|
||||
(if index?
|
||||
(make-index-element
|
||||
#f (list elem) tag
|
||||
(list (symbol->string (syntax-e id)))
|
||||
(list elem)
|
||||
(and show-libs?
|
||||
(with-exporting-libraries
|
||||
(lambda (libs)
|
||||
(make-exported-index-desc (syntax-e id)
|
||||
libs)))))
|
||||
elem)])
|
||||
(make-target-element #f (list elem) tag))))
|
||||
elem))))
|
||||
|
||||
(define (make-binding-redirect-elements mod-path redirects)
|
||||
(let ([taglet (module-path-index->taglet
|
||||
(module-path-index-join mod-path #f))])
|
||||
|
|
|
@ -173,11 +173,20 @@
|
|||
(make-decl-collect decl)
|
||||
(append
|
||||
((decl-mk-head decl) #f)
|
||||
(list
|
||||
(make-blockquote
|
||||
"leftindent"
|
||||
(flow-paragraphs
|
||||
(decode-flow (build-body decl (decl-body decl))))))))))
|
||||
(let-values ([(pre post)
|
||||
(let loop ([l (decl-body decl)][accum null])
|
||||
(cond
|
||||
[(null? l) (values (reverse accum) null)]
|
||||
[(or (constructor? (car l)) (meth? (car l)))
|
||||
(values (reverse accum) l)]
|
||||
[else (loop (cdr l) (cons (car l) accum))]))])
|
||||
(append
|
||||
(flow-paragraphs (decode-flow pre))
|
||||
(list
|
||||
(make-blockquote
|
||||
"leftindent"
|
||||
(flow-paragraphs
|
||||
(decode-flow (build-body decl post)))))))))))
|
||||
|
||||
(define (*class-doc kind stx-id super intfs ranges whole-page? make-index-desc)
|
||||
(make-table
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
\usepackage{hyperref}
|
||||
\renewcommand{\rmdefault}{ptm}
|
||||
\usepackage{longtable}
|
||||
\usepackage{relsize}
|
||||
\usepackage[htt]{hyphenat}
|
||||
\usepackage[usenames,dvipsnames]{color}
|
||||
\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true}
|
||||
|
@ -67,8 +68,8 @@
|
|||
\newcommand{\indexlink}[1]{#1}
|
||||
\newcommand{\noborder}[1]{#1}
|
||||
\newcommand{\imageleft}[1]{} % drop it
|
||||
\newcommand{\smaller}[1]{{\footnotesize #1}}
|
||||
\newcommand{\refpara}[1]{\marginpar{\footnotesize #1}}
|
||||
\renewcommand{\smaller}[1]{\textsmaller{#1}}
|
||||
\newcommand{\refpara}[1]{\marginpar{\raggedright \footnotesize #1}}
|
||||
|
||||
\newcommand{\titleAndEmptyVersion}[2]{\title{#1}\maketitle}
|
||||
\newcommand{\titleAndVersion}[2]{\title{#1\\{\normalsize Version #2}}\maketitle}
|
||||
|
|
|
@ -349,6 +349,6 @@ The same as Beginning's @|beg-check-expect|, etc.}
|
|||
|
||||
Constants for the empty list, true, and false.}
|
||||
|
||||
@defform[(require string)]{
|
||||
@defform[(require module-path)]{
|
||||
|
||||
The same as Beginning's @|beg-require|.}
|
||||
|
|
|
@ -184,6 +184,6 @@ The same as Beginning's @|beg-check-expect|, etc.}
|
|||
|
||||
Constants for the empty list, true, and false.}
|
||||
|
||||
@defform[(require string)]{
|
||||
@defform[(require module-path)]{
|
||||
|
||||
The same as Beginning's @|beg-require|.}
|
||||
|
|
|
@ -318,6 +318,13 @@ lowercase), @litchar{0} through @litchar{9}, @litchar{-}, @litchar{_},
|
|||
and @litchar{.}, and the string cannot be empty or contain a leading
|
||||
or trailing @litchar{/}.}
|
||||
|
||||
@defform/none[#:literals (require)
|
||||
(require module-id)]{
|
||||
|
||||
Accesses a file in an installed library. The library name is an
|
||||
identifier with the same constraints as for a relative-path string,
|
||||
with the additional constraint that it must not contain a
|
||||
@litchar{.}.}
|
||||
|
||||
@defform/none[#:literals (require lib)
|
||||
(require (lib string string ...))]{
|
||||
|
|
|
@ -187,6 +187,6 @@ The same as Beginning's @|beg-check-expect|, etc.}
|
|||
|
||||
Constants for the empty list, true, and false.}
|
||||
|
||||
@defform[(require string)]{
|
||||
@defform[(require module-path)]{
|
||||
|
||||
The same as Beginning's @|beg-require|.}
|
||||
|
|
|
@ -231,6 +231,6 @@ The same as Beginning's @|beg-check-expect|, etc.}
|
|||
|
||||
Constants for the empty list, true, and false.}
|
||||
|
||||
@defform[(require string)]{
|
||||
@defform[(require module-path)]{
|
||||
|
||||
The same as Beginning's @|beg-require|.}
|
||||
|
|
|
@ -1494,7 +1494,7 @@ To customize the way that a class instance is compared to other
|
|||
instances by @scheme[equal?], implement the @scheme[equal<%>]
|
||||
interface.
|
||||
|
||||
@definterface[equal<%> ()]{}
|
||||
@definterface[equal<%> ()]{
|
||||
|
||||
The @scheme[equal<%>] interface includes three methods, which are
|
||||
analogous to the functions provided for a structure type with
|
||||
|
@ -1531,7 +1531,7 @@ classes whose most specific ancestor to explicitly implement
|
|||
|
||||
See @scheme[prop:equal+hash] for more information on equality
|
||||
comparisons and hash codes. The @scheme[equal<%>] interface is
|
||||
implemented with @scheme[interface*] and @scheme[prop:equal+hash].
|
||||
implemented with @scheme[interface*] and @scheme[prop:equal+hash].}
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
|
||||
|
@ -1610,11 +1610,11 @@ Like @scheme[define-serializable-class*], but with not interface
|
|||
expressions (analogous to @scheme[class]).}
|
||||
|
||||
|
||||
@definterface[externalizable<%> ()]{}
|
||||
@definterface[externalizable<%> ()]{
|
||||
|
||||
The @scheme[externalizable<%>] interface includes only the
|
||||
@scheme[externalize] and @scheme[internalize] methods. See
|
||||
@scheme[define-serializable-class*] for more information.
|
||||
@scheme[define-serializable-class*] for more information.}
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -478,7 +478,8 @@ specifications in @scheme[sandbox-path-permissions], and it uses
|
|||
|
||||
|
||||
@defparam[sandbox-path-permissions perms
|
||||
(listof (list/c (or/c 'execute 'write 'delete 'read-bytecode 'read 'exists)
|
||||
(listof (list/c (or/c 'execute 'write 'delete
|
||||
'read-bytecode 'read 'exists)
|
||||
(or/c byte-regexp? bytes? string? path?)))]{
|
||||
|
||||
A parameter that configures the behavior of the default sandbox
|
||||
|
|
|
@ -163,7 +163,9 @@ an element with style @scheme[#f].}
|
|||
@def-style-proc[subscript]
|
||||
@def-style-proc[superscript]
|
||||
|
||||
@def-elem-proc[smaller]{Like @scheme[elem], but with style @scheme["smaller"].}
|
||||
@def-elem-proc[smaller]{Like @scheme[elem], but with style
|
||||
@scheme["smaller"]. When uses of @scheme[smaller] are nested, text
|
||||
gets progressively smaller.}
|
||||
|
||||
@defproc[(hspace [n exact-nonnegative-integer?]) element?]{
|
||||
|
||||
|
|
|
@ -613,6 +613,29 @@ typeset as with @scheme[scheme].}
|
|||
Like @scheme[schemegrammar], but for typesetting multiple productions
|
||||
at once, aligned around the @litchar{=} and @litchar{|}.}
|
||||
|
||||
@defproc[(defidentifier [id identifier?]
|
||||
[#:form? form? any/c #f]
|
||||
[#:index? index? any/c #t]
|
||||
[#:show-libs? show-libs? any/c #t])
|
||||
element?]{
|
||||
|
||||
Typesets @scheme[id] as a Scheme identifier, and also establishes the
|
||||
identifier as the definition of a binding in the same way as
|
||||
@scheme[defproc], @scheme[defform], etc. As always, the library that
|
||||
provides the identifier must be declared via @scheme[defmodule] or
|
||||
@scheme[declare-exporting] for an enclosing section.
|
||||
|
||||
If @scheme[form?] is a true value, then the identifier is documented
|
||||
as a syntactic form, so that uses of the identifier (normally
|
||||
including @scheme[id] itself) are typeset as a syntactic form.
|
||||
|
||||
If @scheme[index?] is a true value, then the identifier is registered
|
||||
in the index.
|
||||
|
||||
If @scheme[show-libs?] is a true value, then the identifier's defining
|
||||
module may be exposed in the typeset form (e.g., when viewing HTML and
|
||||
the mouse hovers over the identifier).}
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
@section[#:tag "doc-classes"]{Documenting Classes and Interfaces}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
@author{Matthias Felleisen}
|
||||
|
||||
@defmodule[2htdp/universe #:use-sources (teachpack/htdp/image)]
|
||||
|
||||
@;{FIXME: the following paragraph uses `defterm' instead of `deftech',
|
||||
because the words "world" and "universe" are used as datatypes, and
|
||||
datatypes are currently linked as technical terms --- which is a hack.
|
||||
|
@ -52,8 +54,6 @@ The purpose of this documentation is to give experienced Schemers and HtDP
|
|||
have a series of projects available as a small booklet on
|
||||
@link["http://world.cs.brown.edu/"]{How to Design Worlds}.
|
||||
|
||||
@declare-exporting[teachpack/2htdp/universe #:use-sources (teachpack/htdp/image)]
|
||||
|
||||
@; -----------------------------------------------------------------------------
|
||||
|
||||
@section[#:tag "basics"]{Basics}
|
||||
|
|
Loading…
Reference in New Issue
Block a user