improve scribble index support

svn: r7047
This commit is contained in:
Matthew Flatt 2007-08-07 20:39:54 +00:00
parent c6b723bbd8
commit ab9c34a8ec
43 changed files with 736 additions and 523 deletions

View File

@ -69,8 +69,8 @@
(let ([p-ht (make-hash-table 'equal)])
(when (part-title-content d)
(collect-content (part-title-content d) p-ht))
(when (part-tag d)
(collect-part-tag d p-ht number))
(collect-part-tags d p-ht number)
(collect-content (part-to-collect d) p-ht)
(collect-flow (part-flow d) p-ht)
(let loop ([parts (part-parts d)]
[pos 1])
@ -91,8 +91,10 @@
(lambda (k v)
(hash-table-put! ht k v)))))
(define/public (collect-part-tag d ht number)
(hash-table-put! ht `(part ,(part-tag d)) (list (part-title-content d) number)))
(define/public (collect-part-tags d ht number)
(for-each (lambda (t)
(hash-table-put! ht `(part ,t) (list (part-title-content d) number)))
(part-tags d)))
(define/public (collect-content c ht)
(for-each (lambda (i)
@ -316,7 +318,7 @@
(list
(make-element 'hspace '(" "))))
(part-title-content part))
`(part ,(part-tag part))))))))
`(part ,(car (part-tags part)))))))))
subs)])
(if (and (= 1 (length number))
(or (not (car number))

View File

@ -119,10 +119,13 @@
;; ----------------------------------------
(provide index index* as-index index-section)
(provide section-index index index* as-index index-section)
(define (section-index . elems)
(make-section-index-decl (map element->string elems) elems))
(define (gen-target)
(format "index:~s:~s" (current-seconds) (gensym)))
(format "index:~s:~s" (current-inexact-milliseconds) (gensym)))
(define (record-index word-seq element-seq tag content)
(make-index-element
@ -155,9 +158,10 @@
(define (index-section tag)
(make-unnumbered-part
tag
(and tag (list tag))
(list "Index")
#f
null
(make-flow (list (make-delayed-flow-element
(lambda (renderer sec ht)
(let ([l null])
@ -180,7 +184,14 @@
[(string-ci=? (car a) (car b))
(loop (cdr a) (cdr b))]
[else
(string-ci<? (car a) (car b))]))))])
(string-ci<? (car a) (car b))]))))]
[commas (lambda (l)
(if (or (null? l)
(null? (cdr l)))
l
(cdr (apply append (map (lambda (i)
(list ", " i))
l)))))])
(make-table
'index
(map (lambda (i)
@ -189,11 +200,12 @@
(make-paragraph
(list
(make-link-element
#f
(caddr i)
"indexlink"
(commas (caddr i))
(car i))))))))
l))))))))
null))
null
'index))
;; ----------------------------------------

View File

@ -19,7 +19,9 @@
[part-start ([depth integer?]
[tag (or/c false/c string?)]
[title list?])]
[splice ([run list?])])
[splice ([run list?])]
[section-index-decl ([plain-seq (listof string?)]
[entry-seq list?])])
(define (decode-string s)
(let loop ([l '((#rx"---" mdash)
@ -49,15 +51,39 @@
null
(list (decode-paragraph (reverse (skip-whitespace accum))))))
(define (decode-flow* l tag style title part-depth)
(let loop ([l l][next? #f][accum null][title title][tag tag][style style])
(define (decode-flow* l keys tag style title part-depth)
(let loop ([l l][next? #f][keys keys][accum null][title title][tag tag][style style])
(cond
[(null? l) (make-styled-part tag
title
#f
(make-flow (decode-accum-para accum))
null
style)]
[(null? l)
(let ([tags (map (lambda (k)
(format "secindex:~a:~a" (current-inexact-milliseconds) (gensym)))
keys)]
[tag (or tag (format "sec:~a:~a" (current-inexact-milliseconds) (gensym)))])
(make-styled-part (cons tag
tags)
title
#f
(let ([l (map (lambda (k tag)
(make-index-element
#f
null
`(part ,tag)
(section-index-decl-plain-seq k)
(section-index-decl-entry-seq k)))
keys tags)])
(if title
(cons (make-index-element
#f
null
`(part ,tag)
(list (regexp-replace #px"^(?:A|An|The)\\s" (content->string title)
""))
(list (make-element #f title)))
l)
l))
(make-flow (decode-accum-para accum))
null
style))]
[(title-decl? (car l))
(unless part-depth
(error 'decode
@ -67,16 +93,17 @@
(error 'decode
"found extra title: ~v"
(car l)))
(loop (cdr l) next? accum
(loop (cdr l) next? keys accum
(title-decl-content (car l))
(title-decl-tag (car l))
(title-decl-style (car l)))]
[(flow-element? (car l))
(let ([para (decode-accum-para accum)]
[part (decode-flow* (cdr l) tag style title part-depth)])
(make-styled-part (part-tag part)
[part (decode-flow* (cdr l) keys tag style title part-depth)])
(make-styled-part (part-tags part)
(part-title-content part)
(part-collected-info part)
(part-to-collect part)
(make-flow (append para
(list (car l))
(flow-paragraphs (part-flow part))))
@ -84,10 +111,11 @@
(styled-part-style part)))]
[(part? (car l))
(let ([para (decode-accum-para accum)]
[part (decode-flow* (cdr l) tag style title part-depth)])
(make-styled-part (part-tag part)
[part (decode-flow* (cdr l) keys tag style title part-depth)])
(make-styled-part (part-tags part)
(part-title-content part)
(part-collected-info part)
(part-to-collect part)
(make-flow (append para
(flow-paragraphs
(part-flow part))))
@ -112,41 +140,45 @@
(part-start-tag s)
(part-start-title s)
(add1 part-depth))]
[part (decode-flow* l tag style title part-depth)])
(make-styled-part (part-tag part)
[part (decode-flow* l keys tag style title part-depth)])
(make-styled-part (part-tags part)
(part-title-content part)
(part-collected-info part)
(part-to-collect part)
(make-flow para)
(cons s (part-parts part))
(styled-part-style part)))
(loop (cdr l) (cons (car l) s-accum)))))]
[(splice? (car l))
(loop (append (splice-run (car l)) (cdr l)) next? accum title tag style)]
[(null? (cdr l)) (loop null #f (cons (car l) accum) title tag style)]
(loop (append (splice-run (car l)) (cdr l)) next? keys accum title tag style)]
[(null? (cdr l)) (loop null #f keys (cons (car l) accum) title tag style)]
[(section-index-decl? (car l))
(loop (cdr l) next? (cons (car l) keys) accum title tag style)]
[(and (pair? (cdr l))
(splice? (cadr l)))
(loop (cons (car l) (append (splice-run (cadr l)) (cddr l))) next? accum title tag style)]
(loop (cons (car l) (append (splice-run (cadr l)) (cddr l))) next? keys accum title tag style)]
[(line-break? (car l))
(if next?
(loop (cdr l) #t accum title tag style)
(loop (cdr l) #t keys accum title tag style)
(let ([m (match-newline-whitespace (cdr l))])
(if m
(let ([part (loop m #t null title tag style)])
(make-styled-part (part-tag part)
(let ([part (loop m #t keys null title tag style)])
(make-styled-part (part-tags part)
(part-title-content part)
(part-collected-info part)
(part-to-collect part)
(make-flow (append (decode-accum-para accum)
(flow-paragraphs (part-flow part))))
(part-parts part)
(styled-part-style part)))
(loop (cdr l) #f (cons (car l) accum) title tag style))))]
[else (loop (cdr l) #f (cons (car l) accum) title tag style)])))
(loop (cdr l) #f keys (cons (car l) accum) title tag style))))]
[else (loop (cdr l) #f keys (cons (car l) accum) title tag style)])))
(define (decode-part l tag title depth)
(decode-flow* l tag #f title depth))
(decode-flow* l null tag #f title depth))
(define (decode-flow l)
(part-flow (decode-flow* l #f #f #f #f)))
(part-flow (decode-flow* l null #f #f #f #f)))
(define (match-newline-whitespace l)
(cond

View File

@ -19,6 +19,7 @@
(define next-separate-page (make-parameter #f))
(define collecting-sub (make-parameter 0))
(define current-no-links (make-parameter #f))
(define extra-breaking? (make-parameter #f))
;; ----------------------------------------
;; main mixin
@ -49,18 +50,20 @@
ht))
(define/public (part-whole-page? p ht)
(let ([dest (lookup p ht `(part ,(part-tag p)))])
(let ([dest (lookup p ht `(part ,(car (part-tags p))))])
(caddr dest)))
(define/public (current-part-whole-page?)
#f)
(define/override (collect-part-tag d ht number)
(hash-table-put! ht
`(part ,(part-tag d))
(list (current-output-file)
(part-title-content d)
(current-part-whole-page?))))
(define/override (collect-part-tags d ht number)
(for-each (lambda (t)
(hash-table-put! ht
`(part ,t)
(list (current-output-file)
(part-title-content d)
(current-part-whole-page?))))
(part-tags d)))
(define/override (collect-target-element i ht)
(hash-table-put! ht
@ -93,7 +96,7 @@
,@(format-number (collected-info-number (part-collected-info p))
'((tt nbsp))))
(td
(a ((href ,(let ([dest (lookup p ht `(part ,(part-tag p)))])
(a ((href ,(let ([dest (lookup p ht `(part ,(car (part-tags p))))])
(format "~a~a~a"
(from-root (car dest)
(get-dest-directory))
@ -102,7 +105,7 @@
"#")
(if (caddr dest)
""
`(part ,(part-tag p))))))
`(part ,(car (part-tags p)))))))
(class ,(if (eq? p mine)
"tocviewselflink"
"tocviewlink")))
@ -167,7 +170,8 @@
((class "tocsublist")
(cellspacing "0"))
,@(map (lambda (p)
(parameterize ([current-no-links #t])
(parameterize ([current-no-links #t]
[extra-breaking? #t])
`(tr
(td
,@(if (part? p)
@ -176,9 +180,9 @@
'((tt nbsp)))))
'(""))
(a ((href ,(if (part? p)
(let ([dest (lookup p ht `(part ,(part-tag p)))])
(let ([dest (lookup p ht `(part ,(car (part-tags p))))])
(format "#~a"
`(part ,(part-tag p))))
`(part ,(car (part-tags p)))))
(format "#~a" (target-element-tag p))))
(class ,(if (part? p)
"tocsubseclink"
@ -221,9 +225,9 @@
[(2) 'h4]
[else 'h5])
,@(format-number number '((tt nbsp)))
,@(if (part-tag d)
`((a ((name ,(format "~a" `(part ,(part-tag d)))))))
null)
,@(map (lambda (t)
`(a ((name ,(format "~a" `(part ,t))))))
(part-tags d))
,@(if (part-title-content d)
(render-content (part-title-content d) d ht)
null))))
@ -399,7 +403,13 @@
(define/override (render-other i part ht)
(cond
[(string? i) (list i)]
[(string? i) (let ([m (and (extra-breaking?)
(regexp-match-positions #rx":" i))])
(if m
(list* (substring i 0 (cdar m))
`(span ((class "mywbr")) " ")
(render-other (substring i (cdar m)) part ht))
(list i)))]
[(eq? i 'mdash) `(" " ndash " ")]
[(eq? i 'hline) `((hr))]
[(symbol? i) (list i)]
@ -428,9 +438,7 @@
(define/private (derive-filename d ht)
(let ([fn (format "~a.html" (regexp-replace*
"[^-a-zA-Z0-9_=]"
(or (format "~a" (part-tag d))
(content->string (part-title-content d)
this d ht))
(format "~a" (car (part-tags d)))
"_"))])
(when ((string-length fn) . >= . 48)
(error "file name too long (need a tag):" fn))
@ -560,7 +568,7 @@
(make-link-element
#f
index-content
`(part ,(part-tag index)))))))))
`(part ,(car (part-tags index))))))))))
null))))
d ht)
,@(render-table (make-table

View File

@ -6,6 +6,7 @@
(define current-table-mode (make-parameter #f))
(define rendering-tt (make-parameter #f))
(define show-link-page-numbers (make-parameter #f))
(define-struct (toc-paragraph paragraph) ())
@ -69,8 +70,9 @@
(printf "\\newcommand{\\schemeinput}[1]{\\colorbox{LightGray}{\\hspace{-0.5ex}\\schemeinputbg{#1}\\hspace{-0.5ex}}}\n")
(printf "\\newcommand{\\highlighted}[1]{\\colorbox{PaleBlue}{\\hspace{-0.5ex}\\schemeinputbg{#1}\\hspace{-0.5ex}}}\n")
(printf "\\newcommand{\\techlink}[1]{#1}\n")
(printf "\\newcommand{\\indexlink}[1]{#1}\n")
(printf "\\newcommand{\\imageleft}[1]{} % drop it\n")
(printf "\\begin{document}\n")
(printf "\\begin{document}\n\\sloppy\n")
(when (part-title-content d)
(printf "\\title{")
(render-content (part-title-content d) d ht)
@ -82,6 +84,9 @@
(let ([number (collected-info-number (part-collected-info d))])
(when (and (part-title-content d)
(pair? number))
(when (and (styled-part? d)
(eq? 'index (styled-part-style d)))
(printf "\\twocolumn\n\\parskip=0pt\n\\addcontentsline{toc}{section}{Index}\n"))
(printf "\\~a~a{"
(case (length number)
[(0 1) "newpage\n\n\\section"]
@ -93,10 +98,13 @@
"*"
""))
(render-content (part-title-content d) d ht)
(printf "}"))
#;
(when (part-tag d)
(printf "\\label{section:~a}" (protect-tag (part-tag d))))
(printf "}")
(when (and (styled-part? d)
(eq? 'index (styled-part-style d)))
(printf "\n\n")))
(for-each (lambda (t)
(printf "\\label{t:~a}" (t-encode `(part ,t))))
(part-tags d))
(render-flow (part-flow d) d ht)
(for-each (lambda (sec) (render-part sec ht))
(part-parts d))
@ -121,48 +129,68 @@
(pair? (link-element-tag e))
(eq? 'part (car (link-element-tag e)))
(null? (element-content e)))])
(parameterize ([show-link-page-numbers #f])
(when (target-element? e)
(printf "\\label{t:~a}" (t-encode (target-element-tag e))))
(when part-label?
(printf "\\S")
(render-content (let ([dest (lookup part ht (link-element-tag e))])
(if dest
(format-number (cadr dest) null)
(list "???")))
part
ht)
(printf " ``"))
(let ([style (and (element? e)
(element-style e))]
[wrap (lambda (e s tt?)
(printf "{\\~a{" s)
(parameterize ([rendering-tt (or tt?
(rendering-tt))])
(super render-element e part ht))
(printf "}}"))])
(cond
[(symbol? style)
(case style
[(italic) (wrap e "textit" #f)]
[(bold) (wrap e "textbf" #f)]
[(tt) (wrap e "mytexttt" #t)]
[(sf) (wrap e "textsf" #f)]
[(subscript) (wrap e "textsub" #f)]
[(superscript) (wrap e "textsuper" #f)]
[(hspace) (let ([s (content->string (element-content e))])
(case (string-length s)
[(0) (void)]
[else
(printf "{\\mytexttt{~a}}"
(regexp-replace* #rx"." s "~"))]))]
[else (error 'latex-render "unrecognzied style symbol: ~s" style)])]
[(string? style)
(wrap e style (regexp-match? #px"^scheme(?!error)" style))]
[(image-file? style)
(let ([fn (install-file (image-file-path style))])
(printf "\\includegraphics{~a}" fn))]
[else (super render-element e part ht)])))
(when part-label?
(printf "\\S")
(render-content (let ([dest (lookup part ht (link-element-tag e))])
(if dest
(format-number (cadr dest) null)
(list "???")))
part
ht)
(printf " ``"))
(let ([style (and (element? e)
(element-style e))]
[wrap (lambda (e s tt?)
(printf "{\\~a{" s)
(parameterize ([rendering-tt (or tt?
(rendering-tt))])
(super render-element e part ht))
(printf "}}"))])
(cond
[(symbol? style)
(case style
[(italic) (wrap e "textit" #f)]
[(bold) (wrap e "textbf" #f)]
[(tt) (wrap e "mytexttt" #t)]
[(sf) (wrap e "textsf" #f)]
[(subscript) (wrap e "textsub" #f)]
[(superscript) (wrap e "textsuper" #f)]
[(hspace) (let ([s (content->string (element-content e))])
(case (string-length s)
[(0) (void)]
[else
(printf "{\\mytexttt{~a}}"
(regexp-replace* #rx"." s "~"))]))]
[else (error 'latex-render "unrecognzied style symbol: ~s" style)])]
[(string? style)
(wrap e style (regexp-match? #px"^scheme(?!error)" style))]
[(image-file? style)
(let ([fn (install-file (image-file-path style))])
(printf "\\includegraphics{~a}" fn))]
[else (super render-element e part ht)]))
(when part-label?
(printf "''")))
null)
(printf "''"))
(when (and (link-element? e)
(show-link-page-numbers))
(printf ", \\pageref{t:~a}" (t-encode (link-element-tag e))))
null))
(define/private (t-encode s)
(apply
string-append
(map (lambda (c)
(cond
[(and (or (char-alphabetic? c)
(char-numeric? c))
((char->integer c) . < . 128))
(string c)]
[(char=? c #\space) "_"]
[else
(format "x~x" (char->integer c))]))
(string->list (format "~s" s)))))
(define/override (render-table t part ht)
(let* ([boxed? (eq? 'boxed (table-style t))]
@ -176,7 +204,7 @@
(equal? "longtable" (car m))
(= 1 (length (car (table-flowss (cadr m))))))))]
[tableform (cond
[index? "theindex"]
[index? "list"]
[(not (current-table-mode))
"longtable"]
[else "tabular"])]
@ -188,10 +216,11 @@
(null? (car (table-flowss t))))
(parameterize ([current-table-mode (if inline?
(current-table-mode)
(list tableform t))])
(list tableform t))]
[show-link-page-numbers (or index?
(show-link-page-numbers))])
(cond
[index?
(printf "\n\n\\begin{theindex}\n")]
[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"
@ -223,6 +252,8 @@
[row-style (car row-styles)])
(let loop ([flows flows])
(unless (null? flows)
(when index?
(printf "\\item "))
(unless (eq? 'cont (car flows))
(let ([cnt (let loop ([flows (cdr flows)][n 1])
(cond

View File

@ -88,11 +88,23 @@
(make-element 'tt (list (substring s spaces))))))))))
strs))))
(define-syntax indexed-scheme
(syntax-rules ()
[(_ x) (add-scheme-index 'x (scheme x))]))
(define (add-scheme-index s e)
(let ([k (if (and (pair? s)
(eq? (car s) 'quote))
(cadr s)
s)])
(index* (list (format "~s" k)) (list e) e)))
(provide schemeblock SCHEMEBLOCK
schemeblock0 SCHEMEBLOCK0
schemeinput
schememod
scheme schemeresult schemeid schememodname
indexed-scheme
litchar
verbatim)
@ -100,6 +112,7 @@
schemefont schemevalfont schemeresultfont schemeidfont
schemeparenfont schemekeywordfont schememetafont schememodfont
file exec envvar Flag DFlag
indexed-file indexed-envvar
link procedure
idefterm)
@ -130,6 +143,10 @@
(make-element "schemekeyword" (decode-content str)))
(define (file . str)
(make-element 'tt (append (list "\"") (decode-content str) (list "\""))))
(define (indexed-file . str)
(let* ([f (apply file str)]
[s (element->string f)])
(index* (list (substring s 1 (sub1 (string-length s)))) (list f) f)))
(define (exec . str)
(make-element 'tt (decode-content str)))
(define (Flag . str)
@ -138,6 +155,10 @@
(make-element 'tt (cons "--" (decode-content str))))
(define (envvar . str)
(make-element 'tt (decode-content str)))
(define (indexed-envvar . str)
(let* ([f (apply envvar str)]
[s (element->string f)])
(index* (list s) (list f) f)))
(define (procedure . str)
(make-element "schemeresult" (append (list "#<procedure:") (decode-content str) (list ">"))))
@ -183,7 +204,13 @@
(format "tech-term:~a" s))))
(define (deftech . s)
(*tech make-target-element #f (list (apply defterm s))))
(let* ([e (apply defterm s)]
[t (*tech make-target-element #f (list e))])
(make-index-element #f
(list t)
(target-element-tag t)
(list (element->string e))
(list e))))
(define (tech . s)
(*tech make-link-element "techlink" s))
@ -487,11 +514,17 @@
(loop (cdr a) (cons (car a) o-accum)))))
(loop (cdr a) (cons (car a) r-accum))))]
[(tagged) (if first?
(make-toc-target-element
#f
(list (to-element (make-just-context (car prototype)
stx-id)))
(register-scheme-definition stx-id))
(let ([tag (register-scheme-definition stx-id)]
[content (list (to-element (make-just-context (car prototype)
stx-id)))])
(make-toc-target-element
#f
(list (make-index-element #f
content
tag
(list (symbol->string (car prototype)))
content))
tag))
(to-element (make-just-context (car prototype)
stx-id)))]
[(flat-size) (prototype-size prototype + +)]
@ -667,14 +700,23 @@
(make-target-element*
make-target-element
stx-id
(inner-make-target-element
#f
(list content)
(register-scheme-definition
(datum->syntax-object stx-id
(string->symbol
(apply string-append
(map symbol->string (car wrappers)))))))
(let* ([name
(apply string-append
(map symbol->string (car wrappers)))]
[tag
(register-scheme-definition
(datum->syntax-object stx-id
(string->symbol
name)))])
(inner-make-target-element
#f
(list
(make-index-element #f
(list content)
tag
(list name)
(list (schemeidfont (make-element "schemevaluelink" (list name))))))
tag))
(cdr wrappers))))
(define (*defstruct stx-id name fields field-contracts immutable? transparent? content-thunk)
@ -841,10 +883,16 @@
(list (make-flow
(list
(make-paragraph
(list (make-toc-target-element
#f
(list (to-element (make-just-context name stx-id)))
(register-scheme-definition stx-id))
(list (let ([tag (register-scheme-definition stx-id)]
[content (list (to-element (make-just-context name stx-id)))])
(make-toc-target-element
#f
(list (make-index-element #f
content
tag
(list (symbol->string name))
content))
tag))
spacer ":" spacer
(to-element result-contract))))))))
(content-thunk))))
@ -890,13 +938,21 @@
. ,(cdr form)))))))
(and kw-id
(eq? form (car forms))
(make-toc-target-element
#f
(list (to-element (make-just-context (if (pair? form)
(car form)
form)
kw-id)))
(register-scheme-form-definition kw-id))))))))
(let ([tag (register-scheme-form-definition kw-id)]
[content (list (to-element (make-just-context (if (pair? form)
(car form)
form)
kw-id)))])
(make-toc-target-element
#f
(if kw-id
(list (make-index-element #f
content
tag
(list (symbol->string (syntax-e kw-id)))
content))
content)
tag))))))))
forms form-procs)
(if (null? sub-procs)
null

View File

@ -388,6 +388,7 @@
[vd
(make-link-element "schemevaluelink" (list s) vtag)]
[else s]))))
(lambda () s)
(lambda () s))
(literalize-spaces s))
(cond

View File

@ -118,6 +118,10 @@
font-weight: bold;
}
.indexlink {
text-decoration: none;
}
.title {
font-size: 200%;
font-weight: normal;
@ -405,3 +409,8 @@
.colophon a {
color: gray;
}
.mywbr {
width: 0;
font-size: 1px;
}

View File

@ -52,13 +52,14 @@
(delayed-flow-element? p)))
(provide-structs
[part ([tag (or/c false/c tag?)]
[part ([tags (listof tag?)]
[title-content (or/c false/c list?)]
[collected-info (or/c false/c collected-info?)]
[to-collect list?]
[flow flow?]
[parts (listof part?)])]
[(styled-part part) ([style any/c])]
[(unnumbered-part part) ()]
[(unnumbered-part styled-part) ()]
[flow ([paragraphs (listof flow-element?)])]
[paragraph ([content list?])]
[(styled-paragraph paragraph) ([style any/c])]
@ -96,33 +97,38 @@
delayed-element-ref
delayed-element-set!)
(make-struct-type 'delayed-element #f
2 1 #f
3 1 #f
(list (cons prop:serializable
(make-serialize-info
(lambda (d)
(unless (delayed-element-ref d 2)
(unless (delayed-element-ref d 3)
(error 'serialize-delayed-element
"cannot serialize a delayed element that was not resolved: ~e"
d))
(vector (delayed-element-ref d 2)))
(vector (delayed-element-ref d 3)))
#'deserialize-delayed-element
#f
(or (current-load-relative-directory) (current-directory)))))))
(define-syntax delayed-element (list-immutable #'struct:delayed-element
#'make-delayed-element
#'delayed-element?
(list-immutable #'delayed-element-sizer
(list-immutable #'delayed-element-plain
#'delayed-element-sizer
#'delayed-element-render)
(list-immutable #'set-delayed-element-sizer!
(list-immutable #'set-delayed-element-plain!
#'set-delayed-element-sizer!
#'set-delayed-element-render!)
#t))
(define delayed-element-render (make-struct-field-accessor delayed-element-ref 0))
(define delayed-element-sizer (make-struct-field-accessor delayed-element-ref 1))
(define delayed-element-plain (make-struct-field-accessor delayed-element-ref 2))
(define set-delayed-element-render! (make-struct-field-mutator delayed-element-set! 0))
(define set-delayed-element-sizer! (make-struct-field-mutator delayed-element-set! 1))
(define set-delayed-element-plain! (make-struct-field-mutator delayed-element-set! 2))
(provide/contract
(struct delayed-element ([render (any/c part? any/c . -> . list?)]
[sizer (-> any)])))
[sizer (-> any)]
[plain (-> any)])))
(provide deserialize-delayed-element)
(define deserialize-delayed-element
@ -130,14 +136,15 @@
(provide force-delayed-element)
(define (force-delayed-element d renderer sec ht)
(or (delayed-element-ref d 2)
(or (delayed-element-ref d 3)
(let ([v ((delayed-element-ref d 0) renderer sec ht)])
(delayed-element-set! d 2 v)
(delayed-element-set! d 3 v)
v)))
;; ----------------------------------------
(provide content->string)
(provide content->string
element->string)
(define content->string
(case-lambda
@ -154,6 +161,7 @@
[(c)
(cond
[(element? c) (content->string (element-content c))]
[(delayed-element? c) (element->string ((delayed-element-plain c)))]
[(string? c) c]
[else (case c
[(ndash) "--"]

View File

@ -25,7 +25,8 @@
(parameterize ([current-directory temp-dir])
(for-each (lambda (name)
(unless (system (format "pdflatex ~a && pdflatex ~a"
(unless (system (format "pdflatex ~a && pdflatex ~a && pdflatex ~a"
name
name
name))
(error "stopped")))

View File

@ -3,15 +3,16 @@
@title[#:tag "mz:breakhandler"]{Breaks}
@index['("threads" "breaking")]{A} @deftech{break} is an asynchronous
exception, usually triggered through an external source controlled by
the user, or through the @scheme[break-thread] procedure. A break
exception can only occur in a thread while breaks are enabled. When a
break is detected and enabled, the @exnraise[exn:break] in the thread
sometime afterward; if breaking is disabled when @scheme[break-thread]
is called, the break is suspended until breaking is again enabled for
the thread. While a thread has a suspended break, additional breaks
are ignored.
@section-index["threads" "breaking"]
A @deftech{break} is an asynchronous exception, usually triggered
through an external source controlled by the user, or through the
@scheme[break-thread] procedure. A break exception can only occur in a
thread while breaks are enabled. When a break is detected and enabled,
the @exnraise[exn:break] in the thread sometime afterward; if breaking
is disabled when @scheme[break-thread] is called, the break is
suspended until breaking is again enabled for the thread. While a
thread has a suspended break, additional breaks are ignored.
Breaks are enabled through the @scheme[break-enabled] parameter-like
procedure, and through the @scheme[parameterize-break] form, which is

View File

@ -138,11 +138,13 @@ positions are initialized with the given @scheme[b]s.
s]}
@defproc[(bytes-append [bstr bytes?] ...) bytes?]{ Returns a new
mutable byte string that is as long as the sum of the given @scheme[bstr]s'
lengths, and that contains the concatenated bytes of the given
@scheme[bstr]s. If no @scheme[bstr]s are provided, the result is a zero-length
byte string.
@defproc[(bytes-append [bstr bytes?] ...) bytes?]{
@index["byte strings" "concatenate"]{Returns} a new mutable byte string
that is as long as the sum of the given @scheme[bstr]s' lengths, and
that contains the concatenated bytes of the given @scheme[bstr]s. If
no @scheme[bstr]s are provided, the result is a zero-length byte
string.
@examples[(bytes-append #"Apple" #"Banana")]}
@ -349,11 +351,11 @@ Certain encoding combinations are always available:
to a decoding failure.}
@item{@scheme[(bytes-open-converter "UTF-8-permissive" "UTF-8")] ---
the identity conversion, except that any input byte that is not
part of a valid encoding sequence is effectively replaced by
@scheme[(char->integer #\?)]. (This handling of invalid sequences
is consistent with the interpretation of port bytes streams into
characters; see @secref["mz:ports"].)}
@index['("UTF-8-permissive")]{the} identity conversion, except that
any input byte that is not part of a valid encoding sequence is
effectively replaced by @scheme[(char->integer #\?)]. (This
handling of invalid sequences is consistent with the interpretation
of port bytes streams into characters; see @secref["mz:ports"].)}
@item{@scheme[(bytes-open-converter "" "UTF-8")] --- converts from
the current locale's default encoding (see @secref["mz:encodings"])
@ -454,9 +456,9 @@ The result of @scheme[bytes-convert] is three values:
@item{@scheme[_src-read-amt] --- the number of bytes successfully converted
from @scheme[src-bstr].}
@item{@scheme['complete], @scheme['continues],
@scheme['aborts], or @scheme['error] --- indicates how
conversion terminated:
@item{@indexed-scheme['complete], @indexed-scheme['continues],
@indexed-scheme['aborts], or @indexed-scheme['error] --- indicates
how conversion terminated:
@itemize{
@ -520,7 +522,7 @@ The result of @scheme[bytes-convert-end] is two values:
@scheme[dest-bstr] is @scheme[#f] or not provided, or the number of
bytes written into @scheme[dest-bstr] otherwise.}
@item{@scheme['complete] or @scheme['continues] ---
@item{@indexed-scheme['complete] or @indexed-scheme['continues] ---
indicates whether conversion completed. If @scheme['complete], then
an entire ending sequence was produced. If @scheme['continues], then
the conversion could not complete due to the limit on the result

View File

@ -205,13 +205,17 @@ inclusive.}
@defproc[(char-general-category [char char?]) boolean?]{
Returns a symbol representing the character's Unicode general
category, which is @scheme['lu], @scheme['ll], @scheme['lt],
@scheme['lm], @scheme['lo], @scheme['mn], @scheme['mc], @scheme['me],
@scheme['nd], @scheme['nl], @scheme['no], @scheme['ps], @scheme['pe],
@scheme['pi], @scheme['pf], @scheme['pd], @scheme['pc], @scheme['po],
@scheme['sc], @scheme['sm], @scheme['sk], @scheme['so], @scheme['zs],
@scheme['zp], @scheme['zl], @scheme['cc], @scheme['cf], @scheme['cs],
@scheme['co], or @scheme['cn].}
category, which is @indexed-scheme['lu], @indexed-scheme['ll],
@indexed-scheme['lt], @indexed-scheme['lm], @indexed-scheme['lo],
@indexed-scheme['mn], @indexed-scheme['mc], @indexed-scheme['me],
@indexed-scheme['nd], @indexed-scheme['nl], @indexed-scheme['no],
@indexed-scheme['ps], @indexed-scheme['pe], @indexed-scheme['pi],
@indexed-scheme['pf], @indexed-scheme['pd], @indexed-scheme['pc],
@indexed-scheme['po], @indexed-scheme['sc], @indexed-scheme['sm],
@indexed-scheme['sk], @indexed-scheme['so], @indexed-scheme['zs],
@indexed-scheme['zp], @indexed-scheme['zl], @indexed-scheme['cc],
@indexed-scheme['cf], @indexed-scheme['cs], @indexed-scheme['co], or
@indexed-scheme['cn].}
@defproc[(make-known-char-range-list)
(listof (list/c nonnegative-integer?

View File

@ -85,8 +85,8 @@ Produces a list of paths as follows:
executable) and it exists, then it is added to the end of the
default collection path list.}
@item{If the @envvar{PLTCOLLECTS} environment variable is defined, it
is combined with the default list using
@item{If the @indexed-envvar{PLTCOLLECTS} environment variable is
defined, it is combined with the default list using
@scheme[path-list-string->path-list]. If it is not defined, the
default collection path list (as constructed by the first three
bullets above) is used directly.}

View File

@ -120,13 +120,13 @@ Returns @scheme[#t] if @scheme[v] is a mark set created by
[mark-set continuation-mark-set?])
list?]{
Returns a list representing a ``stack trace'' for @scheme[mark-set]'s
continuation. The list contains pairs, where the @scheme[car] of each
pair contains either @scheme[#f] or a symbol for a procedure name, and
the @scheme[cdr] of each pair contains either @scheme[#f] or a
@scheme[srcloc] value for the procedure's source location (see
@secref["mz:linecol"]); the @scheme[car] and @scheme[cdr] are never
both @scheme[#f].
Returns a list representing a ``@index["stack dump"]{@as-index{stack
trace}}'' for @scheme[mark-set]'s continuation. The list contains
pairs, where the @scheme[car] of each pair contains either @scheme[#f]
or a symbol for a procedure name, and the @scheme[cdr] of each pair
contains either @scheme[#f] or a @scheme[srcloc] value for the
procedure's source location (see @secref["mz:linecol"]); the
@scheme[car] and @scheme[cdr] are never both @scheme[#f].
The stack-trace list is the result of
@scheme[continuation-mark-set->list] with @scheme[mark-set] and

View File

@ -66,16 +66,18 @@ object, @scheme[#f] otherwise. See also @secref["mz:model-eq"].}
@guideintro["guide:symbols"]{symbols}
@section-index["symbols" "generating"]
@section-index["symbols" "unique"]
A symbol is like an immutable string, but symbols are normally
@deftech{interned}, so that two symbols with the same character
content are normally @scheme[eq?]. All symbols produced by the default
reader (see @secref["mz:parse-symbol"]) are interned.
@index['("symbols" "generating")]{@index['("symbols" "unique")]{The}} two
procedures @scheme[string->uninterned-symbol] and @scheme[gensym]
generate @deftech{uninterned} symbols, i.e., symbols that are not
@scheme[eq?], @scheme[eqv?], or @scheme[equal?] to any other symbol,
although they may print the same as other symbols.
The two procedures @scheme[string->uninterned-symbol] and
@scheme[gensym] generate @deftech{uninterned} symbols, i.e., symbols
that are not @scheme[eq?], @scheme[eqv?], or @scheme[equal?] to any
other symbol, although they may print the same as other symbols.
Regular (interned) symbols are only weakly held by the internal symbol
table. This weakness can never affect the result of an @scheme[eq?],
@ -466,10 +468,10 @@ must one of the following:
@itemize{
@item{@scheme['weak] --- creates a hash table with weakly-held
@item{@indexed-scheme['weak] --- creates a hash table with weakly-held
keys (see @secref["mz:weakbox"]).}
@item{@scheme['equal] --- creates a hash table that compares
@item{@indexed-scheme['equal] --- creates a hash table that compares
keys using @scheme[equal?] instead of @scheme[eq?] (needed, for
example, when using strings as keys).}

View File

@ -216,9 +216,9 @@ available, the @file{.so}/@file{.dll}/@file{.dylib} file is used.
Multiple files can be combined into a single
@file{.so}/@file{.dll}/@file{.dylib} file by creating a special file
@file{_loader.so}, @file{_loader.dll}, or
@file{_loader.dylib}. When such a file is present where a normal
@file{.so}/@file{.dll}/@file{.dylib} would be loaded, then the
@indexed-file{_loader.so}, @indexed-file{_loader.dll}, or
@indexed-file{_loader.dylib}. When such a file is present where a
normal @file{.so}/@file{.dll}/@file{.dylib} would be loaded, then the
@file{_loader} file is first loaded via @scheme[load-extension]. The
result returned by @file{_loader} must be a procedure that accepts a
symbol. This procedure will be called with a symbol matching the base

View File

@ -9,12 +9,14 @@
@title[#:tag "mz:sync"]{Events}
@index['("select")]{@index['("poll")]{A}} @deftech{synchronizable
event} (or just @defterm{event} for short) works with the
@scheme[sync] procedure to coordinate synchronization among
threads. Certain kinds of objects double as events, including
ports and threads. Other kinds of objects exist only for their
use as events.
@section-index["select"]
@section-index["poll"]
A @deftech{synchronizable event} (or just @defterm{event} for short)
works with the @scheme[sync] procedure to coordinate synchronization
among threads. Certain kinds of objects double as events, including
ports and threads. Other kinds of objects exist only for their use as
events.
At an point in time, an event is either @defterm{ready} for
synchronization, or it is not; depending on the kind of event and how

View File

@ -23,12 +23,12 @@ translated on input:
@itemize{
@item{@scheme['binary] --- bytes are returned from the port
@item{@indexed-scheme['binary] --- bytes are returned from the port
exactly as they are read from the file.}
@item{@scheme['text] --- return and linefeed bytes (10 and 13)
as read from the file are filtered by the port in a
platform specific manner:
@item{@indexed-scheme['text] --- return and linefeed bytes (10 and
13) as read from the file are filtered by the port in a platform
specific manner:
@itemize{
@ -91,22 +91,24 @@ that the file already exists.
@itemize{
@item{@scheme['error] --- raise @scheme[exn:fail:filesystem].}
@item{@indexed-scheme['error] --- raise @scheme[exn:fail:filesystem].}
@item{@scheme['replace] --- remove the old file and write a new one.}
@item{@indexed-scheme['replace] --- remove the old file and write a new one.}
@item{@scheme['truncate] --- removed all old data.}
@item{@indexed-scheme['truncate] --- removed all old data.}
@item{@scheme['truncate/replace] --- try @scheme['truncate]; if it
fails (perhaps due to file permissions), try @scheme['replace].}
@item{@indexed-scheme['truncate/replace] --- try @scheme['truncate];
if it fails (perhaps due to file permissions), try
@scheme['replace].}
@item{@scheme['update] --- open an existing file without truncating it;
if the file does not exist, the @exnraise[exn:fail:filesystem].}
@item{@indexed-scheme['update] --- open an existing file without
truncating it; if the file does not exist, the
@exnraise[exn:fail:filesystem].}
@item{@scheme['append] --- append to the end of the file under
@|AllUnix|; under Windows, @scheme['append] is equivalent to
@scheme['update], except that the file position is immediately set
to the end of the file after opening it.}
@item{@indexed-scheme['append] --- append to the end of the file
under @|AllUnix|; under Windows, @scheme['append] is equivalent
to @scheme['update], except that the file position is
immediately set to the end of the file after opening it.}
}

View File

@ -13,28 +13,29 @@ by @scheme[kind], which must be one of the following:
@itemize{
@item{@scheme['home-dir] --- the current user's home directory.
@item{@indexed-scheme['home-dir] --- the current user's home
directory.
Under Unix and Mac OS X, this directory is determined by expanding
the path @file{~}, which is expanded by first checking for a
@envvar{HOME} environment variable. If none is defined, the
@envvar{USER} and @envvar{LOGNAME} environment variables are
consulted (in that order) to find a user name, and then system files
are consulted to locate the user's home directory.
@indexed-envvar{HOME} environment variable. If none is defined, the
@indexed-envvar{USER} and @indexed-envvar{LOGNAME} environment
variables are consulted (in that order) to find a user name, and then
system files are consulted to locate the user's home directory.
Under Windows, the user's home directory is the user-specific profile
directory as determined by the Windows registry. If the registry
cannot provide a directory for some reason, the value of the
@envvar{USERPROFILE} environment variable is used instead, as long as
it refers to a directory that exists. If @envvar{USERPROFILE} also
fails, the directory is the one specified by the @envvar{HOMEDRIVE}
and @envvar{HOMEPATH} environment variables. If those environment
variables are not defined, or if the indicated directory still does
not exist, the directory containing the current executable is used as
the home directory.}
@indexed-envvar{USERPROFILE} environment variable is used instead, as
long as it refers to a directory that exists. If @envvar{USERPROFILE}
also fails, the directory is the one specified by the
@indexed-envvar{HOMEDRIVE} and @indexed-envvar{HOMEPATH} environment
variables. If those environment variables are not defined, or if the
indicated directory still does not exist, the directory containing
the current executable is used as the home directory.}
@item{@scheme['pref-dir] --- the standard directory for storing the
current user's preferences. Under Unix, the directory is
@item{@indexed-scheme['pref-dir] --- the standard directory for
storing the current user's preferences. Under Unix, the directory is
@file{.plt-scheme} in the user's home directory. Under Windows, it
is @file{PLT Scheme} in the user's application-data folder as
specified by the Windows registry; the application-data folder is
@ -42,84 +43,86 @@ by @scheme[kind], which must be one of the following:
directory. Under Mac OS X, it is @file{Library/Preferences} in the
user's home directory. This directory might not exist.}
@item{@scheme['pref-file] --- a file that contains a symbol-keyed
association list of preference values. The file's directory path
always matches the result returned for @scheme['pref-dir]. The file
name is @file{plt-prefs.ss} under Unix and Windows, and it is
@file{org.plt-scheme.prefs.ss} under Mac OS X. The file's directory
might not exist. See also @scheme[get-preference].}
@item{@indexed-scheme['pref-file] --- a file that contains a
symbol-keyed association list of preference values. The file's
directory path always matches the result returned for
@scheme['pref-dir]. The file name is @file{plt-prefs.ss} under Unix
and Windows, and it is @file{org.plt-scheme.prefs.ss} under Mac OS
X. The file's directory might not exist. See also
@scheme[get-preference].}
@item{@scheme['temp-dir] --- the standard directory for storing
temporary files. Under @|AllUnix|, this is the directory specified by
the @envvar{TMPDIR} environment variable, if it is defined.}
@item{@indexed-scheme['temp-dir] --- the standard directory for
storing temporary files. Under @|AllUnix|, this is the directory
specified by the @indexed-envvar{TMPDIR} environment variable, if it
is defined.}
@item{@scheme['init-dir] --- the directory containing the
@item{@indexed-scheme['init-dir] --- the directory containing the
initialization file used by stand-alone @exec{mzscheme} executable.
It is the same as the current user's home directory.}
@item{@scheme['init-file] --- the file loaded at start-up
by the stand-alone @exec{mzscheme} executable. The directory part
of the path is the same path as returned for @scheme['init-dir].
The file name is platform-specific:
@item{@indexed-scheme['init-file] --- the file loaded at start-up by
the stand-alone @exec{mzscheme} executable. The directory part of the
path is the same path as returned for @scheme['init-dir]. The file
name is platform-specific:
@itemize{
@item{@|AllUnix|: @file{.mzschemerc}}
@item{@|AllUnix|: @indexed-file{.mzschemerc}}
@item{Windows: @file{mzschemerc.ss}}
@item{Windows: @indexed-file{mzschemerc.ss}}
}}
@item{@scheme['addon-dir] --- a directory for installing PLT Scheme
@item{@indexed-scheme['addon-dir] --- a directory for installing PLT Scheme
extensions. It's the same as @scheme['pref-dir], except under Mac OS
X, where it is @file{Library/PLT Scheme} in the user's home
directory. This directory might not exist.}
@item{@scheme['doc-dir] --- the standard directory for storing the
@item{@indexed-scheme['doc-dir] --- the standard directory for storing the
current user's documents. It's the same as @scheme['home-dir] under
@|AllUnix|. Under Windows, it is the user's documents folder as
specified by the Windows registry; the documents folder is usually
@file{My Documents} in the user's home directory.}
@item{@scheme['desk-dir] --- the directory for the current user's
@item{@indexed-scheme['desk-dir] --- the directory for the current user's
desktop. Under Unix, it's the same as @scheme['home-dir]. Under
Windows, it is the user's desktop folder as specified by the Windows
registry; the documents folder is usually @file{Desktop} in the
user's home directory. Under Mac OS X, it is the desktop directory,
which is specifically @file{~/Desktop} under Mac OS X.}
@item{@scheme['sys-dir] --- the directory containing the
@item{@indexed-scheme['sys-dir] --- the directory containing the
operating system for Windows. Under @|AllUnix|, the
result is @scheme["/"].}
@item{@scheme['exec-file] --- the path of the @exec{mzscheme}
@item{@indexed-scheme['exec-file] --- the path of the @exec{mzscheme}
executable as provided by the operating system for the current
invocation.
@margin-note{For MrEd, the executable path is the name of a MrEd
executable.}}
@item{@scheme['run-file] --- the path of the current executable; this
may be different from result for @scheme['exec-file] because an
alternate path was provided through a @DFlag{name} or @Flag{N}
command-line flag to the @exec{mzscheme} (or @exec{mred})
executable, or because an embedding executable installed an
alternate path. In particular a ``launcher'' script created by
@scheme[make-mzscheme-launcher] sets this path to the script's
path. In the @exec{mzscheme} executable, this path is also bound
initially to @scheme[program].}
@item{@indexed-scheme['run-file] --- the path of the current
executable; this may be different from result for
@scheme['exec-file] because an alternate path was provided through a
@DFlag{name} or @Flag{N} command-line flag to the @exec{mzscheme}
(or @exec{mred}) executable, or because an embedding executable
installed an alternate path. In particular a ``launcher'' script
created by @scheme[make-mzscheme-launcher] sets this path to the
script's path. In the @exec{mzscheme} executable, this path is also
bound initially to @scheme[program].}
@item{@scheme['collects-dir] --- a path to the main collection
of libraries (see @secref["mz:collects"]). If this path is relative, it's
relative to the directory of @scheme[(find-system-path 'exec-file)].
This path is normally embedded in the @exec{mzscheme} executable,
but it can be overridden by the @DFlag{collects} or @Flag{X}
command-line flag.}
@item{@indexed-scheme['collects-dir] --- a path to the main
collection of libraries (see @secref["mz:collects"]). If this path is
relative, it's relative to the directory of @scheme[(find-system-path
'exec-file)]. This path is normally embedded in the @exec{mzscheme}
executable, but it can be overridden by the @DFlag{collects} or
@Flag{X} command-line flag.}
@item{@scheme['orig-dir] --- the current directory at start-up, which
can be useful in converting a relative-path result from
@scheme[(find-system-path 'exec-file)] or @scheme[(find-system-path
'run-file)] to a complete path.}
@item{@indexed-scheme['orig-dir] --- the current directory at
start-up, which can be useful in converting a relative-path result
from @scheme[(find-system-path 'exec-file)] or
@scheme[(find-system-path 'run-file)] to a complete path.}
}}
@ -169,16 +172,17 @@ explored); otherwise, the result corresponds to the last link in the
chain for which @scheme[related-sub] is found.
If @scheme[program-sub] is a pathless name,
@scheme[find-executable-path] gets the value of the @envvar{PATH}
environment variable; if this environment variable is defined,
@scheme[find-executable-path] tries each path in @envvar{PATH} as a
prefix for @scheme[program-sub] using the search algorithm described
above for path-containing @scheme[program-sub]s. If the @envvar{PATH}
environment variable is not defined, @scheme[program-sub] is prefixed
with the current directory and used in the search algorithm
above. (Under Windows, the current directory is always implicitly the
first item in @envvar{PATH}, so @scheme[find-executable-path] checks
the current directory first under Windows.)}
@scheme[find-executable-path] gets the value of the
@indexed-envvar{PATH} environment variable; if this environment
variable is defined, @scheme[find-executable-path] tries each path in
@envvar{PATH} as a prefix for @scheme[program-sub] using the search
algorithm described above for path-containing
@scheme[program-sub]s. If the @envvar{PATH} environment variable is
not defined, @scheme[program-sub] is prefixed with the current
directory and used in the search algorithm above. (Under Windows, the
current directory is always implicitly the first item in
@envvar{PATH}, so @scheme[find-executable-path] checks the current
directory first under Windows.)}
@;------------------------------------------------------------------------
@section[#:tag "mz:fileutils"]{Files}
@ -261,10 +265,10 @@ called, and the default @scheme[fail-thunk] raises
@defproc[(file-or-directory-permissions [path path-string?]) (listof symbol?)]{
Returns a list containing @scheme['read], @scheme['write], and/or
@scheme['execute] for the given file or directory path. On error
(e.g., if no such file exists), the
@exnraise[exn:fail:filesystem]. Under @|AllUnix|, permissions are
Returns a list containing @indexed-scheme['read],
@indexed-scheme['write], and/or @indexed-scheme['execute] for the
given file or directory path. On error (e.g., if no such file exists),
the @exnraise[exn:fail:filesystem]. Under @|AllUnix|, permissions are
checked for the current effective user instead of the real user.}
@defproc[(file-size [path path-string?]) nonnegative-exact-integer?]{

View File

@ -568,6 +568,8 @@ by prefixes.
@;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@subsection[#:tag "mz:module-redeclare"]{Module Re-declarations}
@section-index["modules" "re-define"]
When a module is declared using a name for which a module is already
declared, the new declaration's definitions replace and extend the old
declarations. If a variable in the old declaration has no counterpart

View File

@ -28,14 +28,14 @@ is an option that determines the initial bindings in the namespace:
@itemize{
@item{@scheme['initial] --- the new namespace contains the module
declarations of the initial namespace, and the new namespace's
@tech{phase-level} 1 top-level environment contains bindings and
imports as in the initial namespace. However, the namespace's
@tech{phase-level} 1 top-level environment is empty.}
@item{@indexed-scheme['initial] --- the new namespace contains the
module declarations of the initial namespace, and the new
namespace's @tech{phase-level} 1 top-level environment contains
bindings and imports as in the initial namespace. However, the
namespace's @tech{phase-level} 1 top-level environment is empty.}
@item{@scheme['empty] --- creates a namespace with no initial
bindings or module declarations.}
@item{@indexed-scheme['empty] --- creates a namespace with no
initial bindings or module declarations.}
}}

View File

@ -26,10 +26,10 @@ and an inexact imaginary part; a complex number with an zero imaginary
part (inexact or exact) is a real number.
Inexact real numbers are implemented as either single- or
double-precision IEEE floating-point numbers---the latter by default,
and the former only when support for 32-bit inexact numbers is
specifically enabled when the run-time system is built, and when
computation starts with numerical constants specified as
double-precision @as-index{IEEE floating-point numbers}---the latter
by default, and the former only when support for 32-bit inexact
numbers is specifically enabled when the run-time system is built, and
when computation starts with numerical constants specified as
single-precision numbers.
The precision and size of exact numbers is limited only by available
@ -37,20 +37,21 @@ memory (and the precision of operations that can produce irrational
numbers). In particular, adding, multiplying, subtracting, and
dividing exact numbers always produces an extract result.
@index["division by inexact zero"]{Inexact} numbers can be coerced to
exact form, except for the inexact numbers @as-index{@scheme[+inf.0]}
(positive infinity), @as-index{@scheme[-inf.0]} (negative infinity), and
@as-index{@scheme[+nan.0]} (not-a-number), which have no exact
form. Dividing a number by exact zero raises an exception; dividing a
non-zero number other than @scheme[+nan.0] by an inexact zero returns
@scheme[+inf.0] or @scheme[-inf.0], depending on the sign of the
dividend. The infinities @scheme[+inf.0] and @scheme[-inf.0] are
integers, and they answer @scheme[#t] for both @scheme[even?] and
@scheme[odd?]. The @scheme[+nan.0] value is not an integer and is not
@scheme[=] to itself, but @scheme[+nan.0] is @scheme[eqv?] to
itself. Conversely, @scheme[(= 0.0 -0.0)] is @scheme[#t], but
@scheme[(eqv? 0.0 -0.0)] is @scheme[#f]. The datum @scheme[-nan.0]
refers to the same constant as @scheme[+nan.0].
Inexact numbers can be coerced to exact form, except for the inexact
numbers @as-index{@scheme[+inf.0]} (positive @as-index{infinity}),
@as-index{@scheme[-inf.0]} (negative infinity), and
@as-index{@scheme[+nan.0]} (@as-index{not-a-number}), which have no
exact form. @index["division by inexact zero"]{Dividing} a number by
exact zero raises an exception; dividing a non-zero number other than
@scheme[+nan.0] by an inexact zero returns @scheme[+inf.0] or
@scheme[-inf.0], depending on the sign of the dividend. The
infinities @scheme[+inf.0] and @scheme[-inf.0] are integers, and they
answer @scheme[#t] for both @scheme[even?] and @scheme[odd?]. The
@scheme[+nan.0] value is not an integer and is not @scheme[=] to
itself, but @scheme[+nan.0] is @scheme[eqv?] to itself. Conversely,
@scheme[(= 0.0 -0.0)] is @scheme[#t], but @scheme[(eqv? 0.0 -0.0)] is
@scheme[#f]. The datum @scheme[-nan.0] refers to the same constant as
@scheme[+nan.0].
Calculations with infinites produce results consistent with IEEE
double-precision floating point where IEEE specifies the result; in
@ -479,6 +480,8 @@ noted above). Two numbers are @scheme[equal?] when they are
@; ------------------------------------------------------------------------
@section{Bitwise Operations}
@section-index{logical operators}
@defproc[(bitwise-ior [n exact-integer?] ...) exact-integer?]{ Returns
the bitwise ``inclusive or'' of the @scheme[n]s in their (semi-infinite)
two's complement representation. If no arguments are provided, the
@ -600,6 +603,12 @@ one of the last three integers must be non-zero.}
@; ------------------------------------------------------------------------
@section{Number--String Conversions}
@section-index["numbers" "machine representations"]
@section-index["numbers" "floating-point"]
@section-index["numbers" "big-endian"]
@section-index["numbers" "little-endian"]
@section-index["numbers" "converting"]
@defproc[(number->string [z number?]
[radix (one-of/c 2 8 10 16) 10]) string?]{
Returns a string that is the printed form of @scheme[z]

View File

@ -194,7 +194,8 @@ type.}
(one-of 'unix 'windows)]{
Returns the path convention type of the current platform:
@scheme['unix] for @|AllUnix|, @scheme['windows] for Windows.}
@indexed-scheme['unix] for @|AllUnix|, @indexed-scheme['windows] for
Windows.}
@defproc[(build-path [base path-string?]
@ -208,12 +209,12 @@ absolute path; if @scheme[base] is a relative path, the result is a
relative path.
Each @scheme[sub] must be either a relative path, the symbol
@scheme['up] (indicating the relative parent directory), or the symbol
@scheme['same] (indicating the relative current directory). For
Windows paths, if @scheme[base] is a drive specification (with or
without a trailing slash) the first @scheme[sub] can be an absolute
(driveless) path. For all platforms, the last @scheme[sub] can be a
filename.
@indexed-scheme['up] (indicating the relative parent directory), or
the symbol @indexed-scheme['same] (indicating the relative current
directory). For Windows paths, if @scheme[base] is a drive
specification (with or without a trailing slash) the first
@scheme[sub] can be an absolute (driveless) path. For all platforms,
the last @scheme[sub] can be a filename.
The @scheme[base] and @scheme[sub-paths] arguments can be paths for
any platform. The platform for the resulting path is inferred from the
@ -428,8 +429,8 @@ directory or file name. Three values are returned:
@itemize{
@item{a path,}
@item{@scheme['relative] if @scheme[path] is an immediate relative directory
or filename, or}
@item{@indexed-scheme['relative] if @scheme[path] is an immediate
relative directory or filename, or}
@item{@scheme[#f] if @scheme[path] is a root directory.}
}}

View File

@ -65,10 +65,11 @@ TCP ports (see @secref["mz:networking"]) support setting and getting
the buffer mode, and custom ports (see @secref["mz:customport"]) may
support getting and setting buffer modes.
If @scheme[mode] is provided, it must be one of @scheme['none],
@scheme['line] (output only), or @scheme['block], and the port's
buffering is set accordingly. If the port does not support setting the
mode, the @exnraise[exn:fail].
If @scheme[mode] is provided, it must be one of
@indexed-scheme['none], @indexed-scheme['line] (output only), or
@indexed-scheme['block], and the port's buffering is set
accordingly. If the port does not support setting the mode, the
@exnraise[exn:fail].
If @scheme[mode] is not provided, the current mode is returned, or
@scheme[#f] is returned if the mode cannot be determined. If

View File

@ -3,11 +3,12 @@
@title[#:tag "mz:linecol"]{Counting Positions, Lines, and Columns}
@index['("line numbers")]{
@index['("column numbers")]{
@index['("port positions")]{
By}}} default, Scheme keeps track of the @deftech{position} in a port as the
number of bytes that have been read from or written to any port
@section-index["line numbers"]
@section-index["column numbers"]
@section-index["port positions"]
By default, Scheme keeps track of the @deftech{position} in a port as
the number of bytes that have been read from or written to any port
(independent of the read/write position, which is accessed or changed
with @scheme[file-position]). Optionally, however, Scheme can track
the position in terms of characters (after UTF-8 decoding), instead of

View File

@ -28,8 +28,6 @@ terms of Unicode characters; see @secref["mz:ports"] for information
on how a character stream is written to an port's underlying byte
stream.
@local-table-of-contents[]
@section[#:tag "mz:print-symbol"]{Printing Symbols}
Symbols containing spaces or special characters @scheme[write] using

View File

@ -41,8 +41,6 @@ Reading is defined in terms of Unicode characters; see
@secref["mz:ports"] for information on how a byte stream is converted
to a character stream.
@local-table-of-contents[]
@;------------------------------------------------------------------------
@section[#:tag "mz:default-readtable-dispatch"]{Delimiters and Dispatch}
@ -169,14 +167,16 @@ never parsed as a symbol or character (unless the
@as-index{@litchar{#%}} also starts a symbol. A successful number
parse takes precedence over a symbol parse.
When the @scheme[read-case-sensitive] @tech{parameter} is set to @scheme[#f],
@index["case-sensitivity"]{@index["case-insensitive"]{When}} the
@scheme[read-case-sensitive] @tech{parameter} is set to @scheme[#f],
characters in the sequence that are not quoted by @litchar["|"] or
@litchar["\\"] are first case-normalized. If the reader encounters
@as-index{@litchar{#ci}}, @litchar{#CI}, @litchar{#Ci}, or @litchar{#cI},
then it recursively reads the following datum in
case-insensitive mode. If the reader encounters @as-index{@litchar{#cs}},
@litchar{#CS}, @litchar{#Cs}, or @litchar{#cS}, then recursively reads
the following datum in case-sensitive mode.
@as-index{@litchar{#ci}}, @litchar{#CI}, @litchar{#Ci}, or
@litchar{#cI}, then it recursively reads the following datum in
case-insensitive mode. If the reader encounters
@as-index{@litchar{#cs}}, @litchar{#CS}, @litchar{#Cs}, or
@litchar{#cS}, then recursively reads the following datum in
case-sensitive mode.
@reader-examples[#:symbols? #f
"Apple"
@ -195,10 +195,12 @@ the following datum in case-sensitive mode.
@guideintro["guide:numbers"]{the syntax of numbers}
@index['("numbers" "parsing")]{A} sequence that does not start with a
delimiter is parsed as a number when it matches the following grammar
case-insenstively for @nonterm{number@sub{10}} (decimal), where
@metavar{n} is a meta-meta-variable in the grammar.
@section-index["numbers" "parsing"]
A sequence that does not start with a delimiter is parsed as a number
when it matches the following grammar case-insenstively for
@nonterm{number@sub{10}} (decimal), where @metavar{n} is a
meta-meta-variable in the grammar.
A number is optionally prefixed by an exactness specifier,
@as-index{@litchar{#e}} (exact) or @as-index{@litchar{#i}} (inexact),
@ -319,8 +321,7 @@ parentheses, and if a pair of delimited @litchar{.}s surrounds any
other than the first and last elements, the result is a list
containing the element surrounded by @litchar{.}s as the first
element, followed by the others in the read order. This convention
supports a kind of @index["infix"]{infix} notation at the reader
level.
supports a kind of @as-index{infix} notation at the reader level.
In @scheme[read-syntax] mode, the recursive reads for the pair/list
elements are themselves in @scheme[read-syntax] mode, so that the
@ -329,10 +330,11 @@ syntax object. If the reader constructs nested pairs because the input
included a single delimited @litchar{.}, then only the innermost pair
and outtermost pair are wrapped as syntax objects. Whether wrapping a
pair or list, if the pair or list was formed with @litchar{[} and
@litchar{]}, then a @scheme['paren-shape] property is attached to the
result with the value @scheme[#\[];if the list or pair was formed with
@litchar["{"] and @litchar["}"], then a @scheme['paren-shape] property
is attached to the result with the value @scheme[#\{].
@litchar{]}, then a @indexed-scheme['paren-shape] property is attached
to the result with the value @scheme[#\[];if the list or pair was
formed with @litchar["{"] and @litchar["}"], then a
@scheme['paren-shape] property is attached to the result with the
value @scheme[#\{].
If a delimited @litchar{.} appears in any other configuration, then
the @exnraise[exn:fail:read]. Similarly, if the reader encounters a
@ -368,10 +370,12 @@ conversion.
@guideintro["guide:strings"]{the syntax of strings}
@index['("strings" "parsing")]{When} the reader encouters
@as-index{@litchar{"}}, it begins parsing characters to form a string. The
string continues until it is terminated by another @litchar{"} (that
is not escaped by @litchar["\\"]).
@section-index["strings" "parsing"]
When the reader encounters @as-index{@litchar{"}}, it begins parsing
characters to form a string. The string continues until it is
terminated by another @litchar{"} (that is not escaped by
@litchar["\\"]).
Within a string sequence, the following escape sequences are
recognized:
@ -437,12 +441,13 @@ constant, the @exnraise[exn:fail:read].
@guideintro["guide:bytestrings"]{the syntax of byte strings}
@index['("byte strings" "parsing")]{A} string constant preceded by
@litchar{#} is parsed as a byte-string. (That is, @as-index{@litchar{#"}} starts
a byte-string literal.) See @secref["mz:bytestrings"] for
information on byte strings. Byte string constants support the same
escape sequences as character strings, except @litchar["\\u"] and
@litchar["\\U"].
@section-index["byte strings" "parsing"]
A string constant preceded by @litchar{#} is parsed as a
byte-string. (That is, @as-index{@litchar{#"}} starts a byte-string
literal.) See @secref["mz:bytestrings"] for information on byte
strings. Byte string constants support the same escape sequences as
character strings, except @litchar["\\u"] and @litchar["\\U"].
When the reader encounters @as-index{@litchar{#<<}}, it starts parsing a
@pidefterm{here string}. The characters following @litchar{#<<} until

View File

@ -85,7 +85,7 @@ The possible combinations for @scheme[key], @scheme[mode], and
@itemize{
@item{@scheme[(code:line _char 'terminating-macro _proc)] --- causes
@item{@scheme[(code:line _char (unsyntax @indexed-scheme['terminating-macro]) _proc)] --- causes
@scheme[_char] to be parsed as a delimiter, and an
unquoted/uncommented @scheme[_char] in the input string triggers a
call to the @deftech{reader macro} @scheme[_proc]; the activity of
@ -93,13 +93,13 @@ The possible combinations for @scheme[key], @scheme[mode], and
like @litchar{;}, @litchar{(}, and @litchar{)} are mapped to
terminating reader macros in the default readtable.}
@item{@scheme[(code:line _char 'non-terminating-macro _proc)] --- like
@item{@scheme[(code:line _char (unsyntax @indexed-scheme['non-terminating-macro]) _proc)] --- like
the @scheme['terminating-macro] variant, but @scheme[_char] is not
treated as a delimiter, so it can be used in the middle of an
identifier or number. Conceptually, @litchar{#} is mapped to a
non-terminating macro in the default readtable.}
@item{@scheme[(code:line _char 'dispatch-macro _proc)] --- like the
@item{@scheme[(code:line _char (unsyntax @indexed-scheme['dispatch-macro]) _proc)] --- like the
@scheme['non-terminating-macro] variant, but for @scheme[_char] only
when it follows a @litchar{#} (or, more precisely, when the character
follows one that has been mapped to the behavior of @litchar{#}hash
@ -121,7 +121,7 @@ The possible combinations for @scheme[key], @scheme[mode], and
that the character is disallowed when the
@scheme[read-curly-brace-as-paren] parameter is set to @scheme[#f].}
@item{@scheme[(code:line #f 'non-terminating-macro _proc)] ---
@item{@scheme[(code:line #f (unsyntax @indexed-scheme['non-terminating-macro]) _proc)] ---
replaces the macro used to parse characters with no specific mapping:
i.e., characters (other than @litchar{#} or @litchar{|}) that can
start a symbol or number with the default readtable.}

View File

@ -6,13 +6,10 @@
@title[#:tag "mz:regexp"]{Regular Expressions}
@;{
\index{regular expressions}
\index{regexps|see{regular expressions}}
\index{pattern matching}
\index{strings!pattern matching}
\index{input ports!pattern matching}
}
@section-index{regexps}
@section-index{pattern matching}
@section-index["strings" "pattern matching"]
@section-index["input ports" "pattern matching"]
Regular expressions are specified as strings or byte strings, using
the same pattern language as the Unix utility @exec{egrep} or Perl. A

View File

@ -25,43 +25,43 @@ contain a null character; the environment variable named by
Returns information about the operating system, build mode, or machine
for a running Scheme.
In @scheme['os] mode,
In @indexed-scheme['os] mode,
the possible symbol results are:
@itemize{
@item{@scheme['unix]}
@item{@scheme['windows]}
@item{@scheme['macosx]}
@item{@indexed-scheme['unix]}
@item{@indexed-scheme['windows]}
@item{@indexed-scheme['macosx]}
}
In @scheme['gc] mode,
In @indexed-scheme['gc] mode,
the possible symbol results are:
@itemize{
@item{@scheme['cgc]}
@item{@scheme['3m]}
@item{@indexed-scheme['cgc]}
@item{@indexed-scheme['3m]}
}
In @scheme['link] mode, the possible symbol results are:
In @indexed-scheme['link] mode, the possible symbol results are:
@itemize{
@item{@scheme['static] (Unix)}
@item{@scheme['shared] (Unix)}
@item{@scheme['dll] (Windows)}
@item{@scheme['framework] (Mac OS X)}
@item{@indexed-scheme['static] (Unix)}
@item{@indexed-scheme['shared] (Unix)}
@item{@indexed-scheme['dll] (Windows)}
@item{@indexed-scheme['framework] (Mac OS X)}
}
Future ports of Scheme may expand the list of @scheme['os],
@scheme['gc], and @scheme['link] results.
In @scheme['so-suffix] mode, then the result is a byte string that
represents the file extension used for shared objects on the current
platform. The byte string starts with a period, so it is suitable as a
second argument to @scheme[path-replace-suffix].
In @indexed-scheme['so-suffix] mode, then the result is a byte string
that represents the file extension used for shared objects on the
current platform. The byte string starts with a period, so it is
suitable as a second argument to @scheme[path-replace-suffix].
In @scheme['machine] mode, then the result is a string, which contains
further details about the current machine in a platform-specific
format.}
In @indexed-scheme['machine] mode, then the result is a string, which
contains further details about the current machine in a
platform-specific format.}
@defproc[(system-language+country) string?]{
@ -75,13 +75,13 @@ letters for the country. Under Windows, the string can be arbitrarily
long, but the language and country are in English (all ASCII letters
or spaces) separated by an underscore.
Under Unix, the result is determined by checking the @envvar{LC_ALL},
@envvar{LC_TYPE}, and @envvar{LANG} environment variables, in that
order (and the result is used if the environment variable's value
starts with two lowercase ASCII letters, an underscore, and two
uppercase ASCII letters, followed by either nothing or a
period). Under Windows and Mac OS X, the result is determined by
system calls.}
Under Unix, the result is determined by checking the
@indexed-envvar{LC_ALL}, @indexed-envvar{LC_TYPE}, and
@indexed-envvar{LANG} environment variables, in that order (and the
result is used if the environment variable's value starts with two
lowercase ASCII letters, an underscore, and two uppercase ASCII
letters, followed by either nothing or a period). Under Windows and
Mac OS X, the result is determined by system calls.}
@defproc[(system-library-subpath [mode (one-of 'cgc '3m #f)

View File

@ -64,16 +64,16 @@ The @scheme[file-guard] procedure must accept three arguments:
@itemize{
@item{@scheme['read] --- read a file or directory}
@item{@indexed-scheme['read] --- read a file or directory}
@item{@scheme['write] --- modify or create a file or
@item{@indexed-scheme['write] --- modify or create a file or
directory}
@item{@scheme['execute] --- execute a file}
@item{@indexed-scheme['execute] --- execute a file}
@item{@scheme['delete] --- delete a file or directory}
@item{@indexed-scheme['delete] --- delete a file or directory}
@item{@scheme['exists] --- determine whether a file or
@item{@indexed-scheme['exists] --- determine whether a file or
directory exists, or that a path string is well-formed}
}
@ -104,11 +104,12 @@ The @scheme[network-guard] procedure must accept four arguments:
number is the target port on the server. For a listening server, the
port number is the local port number.}
@item{a symbol, either @scheme['client] or @scheme['server],
indicating whether the check is for the creation of a client
connection or a listening server. The opening of an unbound UDP
socket is identified as a @scheme['client] connection; explicitly
binding the socket is identified as a @scheme['server] action.}
@item{a symbol, either @indexed-scheme['client] or
@indexed-scheme['server], indicating whether the check is for the
creation of a client connection or a listening server. The opening of
an unbound UDP socket is identified as a @scheme['client] connection;
explicitly binding the socket is identified as a @scheme['server]
action.}
}

View File

@ -38,22 +38,22 @@ must be one of the following symbols:
@itemize{
@item{@scheme['linefeed] breaks lines on linefeed characters.}
@item{@indexed-scheme['linefeed] breaks lines on linefeed characters.}
@item{@scheme['return] breaks lines on return characters.}
@item{@indexed-scheme['return] breaks lines on return characters.}
@item{@scheme['return-linefeed] breaks lines on
@item{@indexed-scheme['return-linefeed] breaks lines on
return-linefeed combinations. If a return character is not followed
by a linefeed character, it is included in the result string;
similarly, a linefeed that is not preceded by a return is included
in the result string.}
@item{@scheme['any] breaks lines on any of a return
@item{@indexed-scheme['any] breaks lines on any of a return
character, linefeed character, or return-linefeed combination. If a
return character is followed by a linefeed character, the two are
treated as a combination.}
@item{@scheme['any-one] breaks lines on either a return or
@item{@indexed-scheme['any-one] breaks lines on either a return or
linefeed character, without recognizing return-linefeed
combinations.}

View File

@ -131,11 +131,12 @@ Returns an immutable string with the same content as
s]}
@defproc[(string-append [str string?] ...) string?]{ Returns a new
mutable string that is as long as the sum of the given @scheme[str]s'
lengths, and that contains the concatenated characters of the given
@scheme[str]s. If no @scheme[str]s are provided, the result is a zero-length
string.
@defproc[(string-append [str string?] ...) string?]{
@index["strings" "concatenate"]{Returns} a new mutable string that is
as long as the sum of the given @scheme[str]s' lengths, and that
contains the concatenated characters of the given @scheme[str]s. If no
@scheme[str]s are provided, the result is a zero-length string.
@examples[(string-append "Apple" "Banana")]}

View File

@ -51,8 +51,8 @@ not exist.
values are @scheme[equal?] if they are @scheme[eq?], or if they are
instances of the same structure type, no fields are opaque, and the
results of applying @scheme[struct->vector] to the structs are
@scheme[equal?]. (Consequently, @scheme[equal?] testing for structures
depends on the current inspector.)
@scheme[equal?]. (Consequently, @scheme[equal?] testing for
structures depends on the current inspector.)
@;------------------------------------------------------------------------
@include-section["define-struct.scrbl"]
@ -222,11 +222,11 @@ For examples, see @scheme[make-struct-type].}
@;------------------------------------------------------------------------
@section[#:tag "mz:structprops"]{Structure Type Properties}
A @index['("structure type properties")]{@deftech{structure type
property}} allows per-type information to be associated with a
structure type (as opposed to per-instance information associated
with a structure value). A property value is associated with a
structure type through the @scheme[make-struct-type] procedure (see
A @deftech{structure type property} allows per-type information to be
associated with a structure type (as opposed to per-instance
information associated with a structure value). A property value is
associated with a structure type through the
@scheme[make-struct-type] procedure (see
@secref["mz:creatingmorestructs"]) or through the @scheme[#:property]
option of @scheme[define-struct]. Subtypes inherit the property
values of their parent types, and subtypes can override an inherited

View File

@ -38,12 +38,13 @@ shape and properties of the result:
@itemize{
@item{If the result has a @scheme['certify-mode] property (see
@secref["mz:stxprops"]) that is @scheme['opaque], then the
certificate is attached to the immediate syntax object.}
@item{If the result has a @indexed-scheme['certify-mode] property
(see @secref["mz:stxprops"]) that is
@indexed-scheme['opaque], then the certificate is attached
to the immediate syntax object.}
@item{If the result has a @scheme['certify-mode] property that is
@scheme['transparent], then the certificate is also
@indexed-scheme['transparent], then the certificate is also
propagated recursively to syntax object that corresponds to
elements of the syntax object's datum as a list (or, more
precisely, to the @scheme[car]s of the datum as reached by
@ -52,8 +53,8 @@ shape and properties of the result:
attachment.}
@item{If the result has a @scheme['certify-mode] property that is
@scheme['transparent-binding], then the certificate is
attached to similar to @scheme['transparent], but further
@indexed-scheme['transparent-binding], then the certificate
is attached to similar to @scheme['transparent], but further
treating the syntax object corresponding to the second list
element as having a @scheme['transparent] value for the
@scheme['certify-mode] property if it does not already have

View File

@ -58,8 +58,8 @@ Returns one of three kinds of values, depending on the binding of
@itemize{
@item{The result is @scheme['lexical] if @scheme[id-stx] has
a @tech{local binding}.
@item{The result is @indexed-scheme['lexical] if @scheme[id-stx]
has a @tech{local binding}.
@item{The result is a list of five items when @scheme[id-stx]
has a @tech{module binding}: @scheme[(list source-mod source-id

View File

@ -72,20 +72,20 @@ to the syntax object:
@itemize{
@item{@scheme['module-direct-requires] --- a list of
@tech{module path index}es (or symbols) representing the modules explicitly
imported into the module.}
@item{@scheme['module-direct-for-syntax-requires] --- a list of
@tech{module path index}es (or symbols) representing the modules explicitly
for-syntax imported into the module.}
@item{@scheme['module-direct-for-template-requires] --- a list of
@item{@indexed-scheme['module-direct-requires] --- a list of
@tech{module path index}es (or symbols) representing the modules
explicitly for-template imported into the module.}
explicitly imported into the module.}
@item{@scheme['module-variable-provides] --- a list of provided
items, where each item is one of the following:
@item{@indexed-scheme['module-direct-for-syntax-requires] --- a list
of @tech{module path index}es (or symbols) representing the modules
explicitly for-syntax imported into the module.}
@item{@indexed-scheme['module-direct-for-template-requires] --- a
list of @tech{module path index}es (or symbols) representing the
modules explicitly for-template imported into the module.}
@item{@indexed-scheme['module-variable-provides] --- a list of
provided items, where each item is one of the following:
@itemize{
@ -108,11 +108,11 @@ to the syntax object:
}}
@item{@scheme['module-syntax-provides] --- like
@item{@indexed-scheme['module-syntax-provides] --- like
@scheme['module-variable-provides], but for syntax exports instead of
variable exports.}
@item{@scheme['module-indirect-provides] --- a list of symbols for
@item{@indexed-scheme['module-indirect-provides] --- a list of symbols for
variables that are defined in the module but not exported; they may
be exported indirectly through macro expansions. Definitions of
macro-generated identifiers create uninterned symbols in this list.}

View File

@ -26,17 +26,17 @@ value first, original value second).
Before performing the merge, however, the syntax expander
automatically adds a property to the original syntax object using the
key @scheme['origin]. If the source syntax has no @scheme['origin]
property, it is set to the empty list. Then, still before the merge,
the identifier that triggered the macro expansion (as syntax) is
@scheme[cons-immutable]d onto the @scheme['origin] property so far.
The @scheme['origin] property thus records (in reverse order) the
sequence of macro expansions that produced an expanded
expression. Usually, the @scheme['origin] value is an immutable list
of identifiers. However, a transformer might return syntax that has
already been expanded, in which case an @scheme['origin] list can
contain other lists after a merge. The @scheme[syntax-track-origin]
procedure implements this tracking.
key @indexed-scheme['origin]. If the source syntax has no
@scheme['origin] property, it is set to the empty list. Then, still
before the merge, the identifier that triggered the macro expansion
(as syntax) is @scheme[cons-immutable]d onto the @scheme['origin]
property so far. The @scheme['origin] property thus records (in
reverse order) the sequence of macro expansions that produced an
expanded expression. Usually, the @scheme['origin] value is an
immutable list of identifiers. However, a transformer might return
syntax that has already been expanded, in which case an
@scheme['origin] list can contain other lists after a merge. The
@scheme[syntax-track-origin] procedure implements this tracking.
Besides @scheme['origin] tracking for general macro expansion,
MzScheme adds properties to expanded syntax (often using
@ -68,18 +68,18 @@ MzScheme adds properties to expanded syntax (often using
the body contained multiple expressions). To record the disappeared
syntax bindings, a property is added to the expansion result: an
immutable list of identifiers from the disappeared bindings, as a
@scheme['disappeared-binding] property.}
@indexed-scheme['disappeared-binding] property.}
@item{When a subtyping @scheme[define-struct] form is expanded, the
identifier used to reference the base type does not appear in the
expansion. Therefore, the @scheme[define-struct] transformer adds the
identifier to the expansion result as a @scheme['disappeared-use]
property.}
identifier to the expansion result as a
@indexed-scheme['disappeared-use] property.}
@item{When a reference to an unexported or protected identifier from
a module is discovered (and the reference is certified; see
@secref["mz:stxcerts"]), the @scheme['protected] property is added
to the identifier with a @scheme[#t] value.}
@secref["mz:stxcerts"]), the @indexed-scheme['protected] property is
added to the identifier with a @scheme[#t] value.}
@item{When or @scheme[read-syntax] or @scheme[read-honu-syntax]
generates a syntax object, it attaches a property to the object

View File

@ -20,9 +20,9 @@ arguments for the program. Under Unix and Mac OS X, command-line
arguments are passed as byte strings using the current locale's
encoding (see @secref["mz:encodings"]).
Under Windows, the first @scheme[arg] can be @scheme['exact], which
triggers a Windows-specific hack: the second @scheme[arg] is used
exactly as the command-line for the subprocess, and no additional
Under Windows, the first @scheme[arg] can be @indexed-scheme['exact],
which triggers a Windows-specific hack: the second @scheme[arg] is
used exactly as the command-line for the subprocess, and no additional
@scheme[arg]s can be supplied. Otherwise, a command-line string is
constructed from @scheme[command] and @scheme[arg] so that a typical
Windows console application can parse it back to an array of
@ -43,7 +43,7 @@ pipe is created and the corresponding returned value is @scheme[#f].
The @scheme[subprocess] procedure returns four values:
\begin{itemize}
@itemize{
@item{a subprocess value representing the created process;}
@ -67,7 +67,8 @@ The returned ports are @tech{file-stream ports} (see
the current custodian (see @secref["mz:custodians"]). The
@exnraise[exn:fail] when a low-level error prevents the spawning of a
process or the creation of operating system pipes for process
communication.
communication.}
@defproc[(subprocess-wait [subproc subprocess?]) void?]{
@ -78,10 +79,11 @@ Blocks until the process represented by @scheme[subproc] terminates.}
(or/c (one-of/c 'running)
nonnegative-exact-integer?)]{
Returns @scheme['running] if the process represented by @scheme[subproc] is still running, or its exit
code otherwise. The exit code is an exact integer, and @scheme[0]
typically indicates success. If the process terminated due to a fault
or signal, the exit code is non-zero.}
Returns @indexed-scheme['running] if the process represented by
@scheme[subproc] is still running, or its exit code otherwise. The
exit code is an exact integer, and @scheme[0] typically indicates
success. If the process terminated due to a fault or signal, the exit
code is non-zero.}
@defproc[(subprocess-kill [subproc subprocess?][force? any/c]) void?]{
@ -113,9 +115,9 @@ otherwise.}
[target string?][parameters string?][dir path-string?][show-mode symbol?])
false/c]
@index['("ShellExecute")]{Performs} the action specified by
@scheme[verb] on @scheme[target] in Windows. For platforms other than
Windows, the @exnraise[exn:fail:unsupported].
@index['("ShellExecute")]{Performs} the action specified by @scheme[verb]
on @scheme[target] in Windows. For platforms other than Windows, the
@exnraise[exn:fail:unsupported].
For example,
@ -149,46 +151,52 @@ of each symbol's meaning is taken from the Windows API documentation.
@itemize{
@item{@scheme['sw_hide] or @scheme['SW_HIDE] --- Hides the window and
activates another window.}
@item{@indexed-scheme['sw_hide] or @indexed-scheme['SW_HIDE] ---
Hides the window and activates another window.}
@item{@scheme['sw_maximize] or @scheme['SW_MAXIMIZE] --- Maximizes
the window.}
@item{@indexed-scheme['sw_maximize] or @indexed-scheme['SW_MAXIMIZE]
--- Maximizes the window.}
@item{@scheme['sw_minimize] or @scheme['SW_MINIMIZE] --- Minimizes
the window and activates the next top-level window in the z-order.}
@item{@indexed-scheme['sw_minimize] or @indexed-scheme['SW_MINIMIZE]
--- Minimizes the window and activates the next top-level window in
the z-order.}
@item{@scheme['sw_restore] or @scheme['SW_RESTORE] --- Activates and
displays the window. If the window is minimized or maximized, Windows
restores it to its original size and position.}
@item{@scheme['sw_show] or @scheme['SW_SHOW] --- Activates the window
and displays it in its current size and position.}
@item{@scheme['sw_showdefault] or @scheme['SW_SHOWDEFAULT] --- Uses a
default.}
@item{@scheme['sw_showmaximized] or @scheme['SW_SHOWMAXIMIZED] ---
Activates the window and displays it as a maximized window.}
@item{@scheme['sw_showminimized] or @scheme['SW_SHOWMINIMIZED] ---
Activates the window and displays it as a minimized window.}
@item{@scheme['sw_showminnoactive] or @scheme['SW_SHOWMINNOACTIVE]
--- Displays the window as a minimized window. The active window
remains active.}
@item{@scheme['sw_showna] or @scheme['SW_SHOWNA] --- Displays the
window in its current state. The active window remains active.}
@item{@scheme['sw_shownoactivate] or @scheme['SW_SHOWNOACTIVATE] ---
Displays a window in its most recent size and position. The active
window remains active.}
@item{@scheme['sw_shownormal] or @scheme['SW_SHOWNORMAL] ---
Activates and displays a window. If the window is minimized or
@item{@indexed-scheme['sw_restore] or @indexed-scheme['SW_RESTORE]
--- Activates and displays the window. If the window is minimized or
maximized, Windows restores it to its original size and position.}
@item{@indexed-scheme['sw_show] or @indexed-scheme['SW_SHOW] ---
Activates the window and displays it in its current size and
position.}
@item{@indexed-scheme['sw_showdefault] or
@indexed-scheme['SW_SHOWDEFAULT] --- Uses a default.}
@item{@indexed-scheme['sw_showmaximized] or
@indexed-scheme['SW_SHOWMAXIMIZED] --- Activates the window and
displays it as a maximized window.}
@item{@indexed-scheme['sw_showminimized] or
@indexed-scheme['SW_SHOWMINIMIZED] --- Activates the window and
displays it as a minimized window.}
@item{@indexed-scheme['sw_showminnoactive] or
@indexed-scheme['SW_SHOWMINNOACTIVE] --- Displays the window as a
minimized window. The active window remains active.}
@item{@indexed-scheme['sw_showna] or @indexed-scheme['SW_SHOWNA] ---
Displays the window in its current state. The active window remains
active.}
@item{@indexed-scheme['sw_shownoactivate] or
@indexed-scheme['SW_SHOWNOACTIVATE] --- Displays a window in its most
recent size and position. The active window remains active.}
@item{@indexed-scheme['sw_shownormal] or
@indexed-scheme['SW_SHOWNORMAL] --- Activates and displays a
window. If the window is minimized or maximized, Windows restores it
to its original size and position.}
}
If the action fails, the @exnraise[exn:fail]. If the action succeeds,

View File

@ -781,10 +781,10 @@ an expression take precedence. For example, in
the procedure bound to @scheme[my-f] will have the inferred name
@scheme['f].
When an @scheme['inferred-name] property is attached to a syntax
object for an expression (see @secref["mz:stxprops"]), the property
value is used for naming the expression, and it overrides any name
that was inferred from the expression's context.
When an @indexed-scheme['inferred-name] property is attached to a
syntax object for an expression (see @secref["mz:stxprops"]), the
property value is used for naming the expression, and it overrides any
name that was inferred from the expression's context.
When an inferred name is not available, but a source location is
available, a name is constructed using the source location

View File

@ -147,6 +147,8 @@ The result is useful only to low-level extensions; see
@;------------------------------------------------------------------------
@section[#:tag "mz:application"]{Procedure Applications and @scheme[#%app]}
@section-index{evaluation order}
@guideintro["guide:application"]{procedure applications}
@defform/none[(proc-expr arg ...)]{
@ -325,10 +327,10 @@ the procedure body.
]}
When compiling a @scheme[lambda] or @scheme[case-lambda] expression,
Scheme looks for a @scheme['method-arity-error] property attached to
the expression (see @secref["mz:stxprops"]). If it is present with a
true value, and if no case of the procedure accepts zero arguments,
then the procedure is marked so that an
Scheme looks for a @indexed-scheme['method-arity-error] property
attached to the expression (see @secref["mz:stxprops"]). If it is
present with a true value, and if no case of the procedure accepts
zero arguments, then the procedure is marked so that an
@scheme[exn:fail:contract:arity] exception involving the procedure
will hide the first argument, if one was provided. (Hiding the first
argument is useful when the procedure implements a method, where the
@ -1005,6 +1007,12 @@ multiple @scheme[form]s are provided, they are wrapped with
@schemeidfont{#%module-begin}, as in the case where a single
@scheme[form] does not expand to @scheme[#%module-begin].
After such wrapping, if any, and before any expansion, an
@indexed-scheme['enclosing-module-name] property is attached to the
@schemeidfont{#%module-begin} syntax object (see
@secref["mz:stxprops"]); the property's value is a symbol
corresponding to @scheme[id].
Each @scheme[form] is partially expanded (see
@secref["mz:partial-expansion"]) in a @tech{module context}. Further
action depends on the shape of the form:
@ -1078,6 +1086,8 @@ Legal only in a @tech{module begin context}, and handled by the
@;------------------------------------------------------------------------
@section[#:tag "mz:require"]{Importing: @scheme[require], @scheme[require-for-syntax], @scheme[require-for-template]}
@section-index["modules" "imports"]
@defform/subs[#:literals (only only-rename prefix all-except prefix-all-except rename lib file planet)
(require require-spec ...)
([require-spec module-path
@ -1199,6 +1209,8 @@ and @secref["mz:mod-parse"]).
@;------------------------------------------------------------------------
@section[#:tag "mz:provide"]{Exporting: @scheme[provide] and @scheme[provide-for-syntax]}
@section-index["modules" "exports"]
@defform/subs[#:literals (protect all-defined all-from rename except prefix)
(provide protected-provide-spec ...)
([protected-provide-spec provide-spec

View File

@ -2,7 +2,6 @@
@require[(lib "bnf.ss" "scribble")]
@require["mz.ss"]
@define[(fileFirst s) (index (list s) (file s))]
@define[MzAdd (italic "Scheme-specific:")]
@title[#:tag "mz:windowspaths"]{Windows Path Conventions}
@ -65,14 +64,14 @@ include @litchar["\\"].
@item{The following special ``files'', which access devices, exist in
all directories, case-insensitively, and with all possible
endings after a period or colon, except in pathnames that start
with @litchar["\\\\?\\"]: @fileFirst{NUL}, @fileFirst{CON},
@fileFirst{PRN}, @fileFirst{AUX}, @fileFirst{COM1},
@fileFirst{COM2}, @fileFirst{COM3}, @fileFirst{COM4},
@fileFirst{COM5}, @fileFirst{COM6}, @fileFirst{COM7},
@fileFirst{COM8}, @fileFirst{COM9}, @fileFirst{LPT1},
@fileFirst{LPT2}, @fileFirst{LPT3}, @fileFirst{LPT4},
@fileFirst{LPT5}, @fileFirst{LPT6}, @fileFirst{LPT7},
@fileFirst{LPT8}, @fileFirst{LPT9}.}
with @litchar["\\\\?\\"]: @indexed-file{NUL}, @indexed-file{CON},
@indexed-file{PRN}, @indexed-file{AUX}, @indexed-file{COM1},
@indexed-file{COM2}, @indexed-file{COM3}, @indexed-file{COM4},
@indexed-file{COM5}, @indexed-file{COM6}, @indexed-file{COM7},
@indexed-file{COM8}, @indexed-file{COM9}, @indexed-file{LPT1},
@indexed-file{LPT2}, @indexed-file{LPT3}, @indexed-file{LPT4},
@indexed-file{LPT5}, @indexed-file{LPT6}, @indexed-file{LPT7},
@indexed-file{LPT8}, @indexed-file{LPT9}.}
@item{Except for @litchar["\\\\?\\"] paths, @litchar{/}s are
equivalent to @litchar["\\"]s. Except for @litchar["\\\\?\\"]