diff --git a/collects/meta/web/html/main.rkt b/collects/meta/web/html/main.rkt deleted file mode 100644 index f778e81b..00000000 --- a/collects/meta/web/html/main.rkt +++ /dev/null @@ -1,21 +0,0 @@ -#lang racket/base - -(provide (except-out (all-from-out racket/base) #%top) - (rename-out [top #%top]) - ;; to be used as a text language - (all-from-out scribble/text) - ;; provide a `text' alias - (rename-out [begin/text text]) - ;; main functionality - (all-from-out "xml.rkt" "html.rkt" "resource.rkt")) - -(require "xml.rkt" "html.rkt" "resource.rkt" - scribble/text (for-syntax racket/base)) - -(define-syntax (top stx) - (syntax-case stx () - [(_ . x) - (let ([x* (syntax-e #'x)]) - (if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*))) - #''x - #'(#%top . x)))])) diff --git a/collects/scribble/base-render.rkt b/collects/scribble/base-render.rkt index 47682e9b..8dd56c06 100644 --- a/collects/scribble/base-render.rkt +++ b/collects/scribble/base-render.rkt @@ -8,6 +8,7 @@ scheme/path setup/main-collects setup/path-relativize + file/convertible "render-struct.ss") (provide render%) @@ -207,7 +208,7 @@ ;; marshal info (define/public (get-serialize-version) - 2) + 4) (define/public (serialize-info ri) (parameterize ([current-serialize-resolve-info ri]) @@ -677,6 +678,7 @@ (render-content (traverse-element-content i ri) part ri)] [(part-relative-element? i) (render-content (part-relative-element-content i ri) part ri)] + [(convertible? i) (list "???")] [else (render-other i part ri)])) (define/public (render-other i part ri) @@ -687,13 +689,15 @@ (define copied-srcs (make-hash)) (define copied-dests (make-hash)) - (define/public (install-file fn) - (if refer-to-existing-files + (define/public (install-file fn [content #f]) + (if (and refer-to-existing-files + (not content)) (if (string? fn) (string->path fn) fn) (let ([normalized (normal-case-path (simplify-path (path->complete-path fn)))]) - (or (hash-ref copied-srcs normalized #f) + (or (and (not content) + (hash-ref copied-srcs normalized #f)) (let ([src-dir (path-only fn)] [dest-dir (get-dest-directory #t)] [fn (file-name-from-path fn)]) @@ -715,22 +719,26 @@ (let-values ([(dest-file normalized-dest-file) (let loop ([dest-file dest-file]) (let ([normalized-dest-file - (normal-case-path (simplify-path (path->complete-path dest-file)))]) - (if (file-exists? dest-file) - (cond - [(call-with-input-file* - src-file - (lambda (src) - (call-with-input-file* + (normal-case-path (simplify-path (path->complete-path dest-file)))] + [check-same + (lambda (src) + (call-with-input-file* dest-file (lambda (dest) - (or (equal? (port-file-identity src) - (port-file-identity dest)) + (or (and (not content) + (equal? (port-file-identity src) + (port-file-identity dest))) (let loop () (let ([s (read-bytes 4096 src)] [d (read-bytes 4096 dest)]) (and (equal? s d) - (or (eof-object? s) (loop)))))))))) + (or (eof-object? s) (loop)))))))))]) + (if (file-exists? dest-file) + (cond + [(or (and content + (check-same (open-input-bytes content))) + (and (not content) + (call-with-input-file* src-file check-same))) ;; same content at that destination (values dest-file normalized-dest-file)] [(hash-ref copied-dests normalized-dest-file #f) @@ -743,10 +751,15 @@ ;; new file (values dest-file normalized-dest-file))))]) (unless (file-exists? dest-file) - (copy-file src-file dest-file)) + (if content + (call-with-output-file* + dest-file + (lambda (dest) (write-bytes content dest))) + (copy-file src-file dest-file))) (hash-set! copied-dests normalized-dest-file #t) (let ([result (path->string (file-name-from-path dest-file))]) - (hash-set! copied-srcs normalized result) + (unless content + (hash-set! copied-srcs normalized result)) result)))))))) ;; ---------------------------------------- diff --git a/collects/scribble/base.rkt b/collects/scribble/base.rkt index 292d9840..0aed8345 100644 --- a/collects/scribble/base.rkt +++ b/collects/scribble/base.rkt @@ -285,7 +285,7 @@ [image (->* ((or/c path-string? (cons/c 'collects (listof bytes?)))) (#:scale real? - #:suffixes (listof #rx"^[.]")) + #:suffixes (listof (and/c string? #rx"^[.]"))) #:rest (listof content?) image-element?)]) diff --git a/collects/scribble/core.rkt b/collects/scribble/core.rkt index aa68a42f..6e71a8ce 100644 --- a/collects/scribble/core.rkt +++ b/collects/scribble/core.rkt @@ -1,7 +1,8 @@ #lang scheme/base (require "private/provide-structs.ss" scheme/serialize - scheme/contract) + scheme/contract + file/convertible) ;; ---------------------------------------- @@ -119,7 +120,8 @@ (traverse-element? v) (part-relative-element? v) (multiarg-element? v) - (hash-ref content-symbols v #f))) + (hash-ref content-symbols v #f) + (convertible? v))) (provide element-style?) (define (element-style? s) diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt index fbc0f1dd..4fe429c5 100644 --- a/collects/scribble/eval.rkt +++ b/collects/scribble/eval.rkt @@ -8,6 +8,7 @@ racket/sandbox racket/promise racket/string + file/convertible (for-syntax racket/base)) (provide interaction @@ -38,6 +39,8 @@ (define maxlen 60) + (define-namespace-anchor anchor) + (namespace-require 'racket/base) (namespace-require '(for-syntax racket/base)) @@ -92,40 +95,45 @@ (make-flow (list p)))))) (format-output (cadar val-list+outputs) output-color) (format-output (caddar val-list+outputs) error-color) - (if (string? (caar val-list+outputs)) - ;; Error result case: - (map - (lambda (s) - (car (format-output s error-color))) - (filter - (lambda (s) (not (equal? s ""))) - (let sloop ([s (caar val-list+outputs)]) - (apply - append - (map (lambda (s) - (if ((string-length s) . > . maxlen) - ;; break the error message into multiple lines: - (let loop ([pos (sub1 maxlen)]) - (cond - [(zero? pos) (cons (substring s 0 maxlen) - (sloop (substring s maxlen)))] - [(char-whitespace? (string-ref s pos)) - (cons (substring s 0 pos) - (sloop (substring s (add1 pos))))] - [else (loop (sub1 pos))])) - (list s))) - (regexp-split #rx"\n" s)))))) - ;; Normal result case: - (let ([val-list (caar val-list+outputs)]) - (if (equal? val-list (list (void))) - null - (map (lambda (v) - (list (make-flow (list (make-paragraph - (list - (hspace 2) - (elem #:style result-color - (to-element/no-color v #:expr? (print-as-expression))))))))) - val-list)))) + (cond + [(string? (caar val-list+outputs)) + ;; Error result case: + (map + (lambda (s) + (car (format-output s error-color))) + (filter + (lambda (s) (not (equal? s ""))) + (let sloop ([s (caar val-list+outputs)]) + (apply + append + (map (lambda (s) + (if ((string-length s) . > . maxlen) + ;; break the error message into multiple lines: + (let loop ([pos (sub1 maxlen)]) + (cond + [(zero? pos) (cons (substring s 0 maxlen) + (sloop (substring s maxlen)))] + [(char-whitespace? (string-ref s pos)) + (cons (substring s 0 pos) + (sloop (substring s (add1 pos))))] + [else (loop (sub1 pos))])) + (list s))) + (regexp-split #rx"\n" s))))))] + [(box? (caar val-list+outputs)) + ;; Output formatted as string: + (format-output (unbox (caar val-list+outputs)) result-color)] + [else + ;; Normal result case: + (let ([val-list (caar val-list+outputs)]) + (if (equal? val-list (list (void))) + null + (map (lambda (v) + (list (make-flow (list (make-paragraph + (list + (hspace 2) + (elem #:style result-color + (to-element/no-color v #:expr? (print-as-expression))))))))) + val-list)))]) (loop (cdr expr-paras) (cdr val-list+outputs) #f))))))) @@ -137,36 +145,56 @@ [(syntax? s) (loop (syntax-e s) ops)] [else (loop ((car ops) s) (cdr ops))]))) - (define ((do-eval ev) s) + (define (extract-to-evaluate s) (let loop ([s s][expect #f]) (syntax-case s (code:comment eval:alts eval:check) [(code:line v (code:comment . rest)) (loop (extract s cdr car) expect)] [(code:comment . rest) - (list (list (void)) "" "")] + (values #f expect)] [(eval:alts p e) (loop (extract s cdr cdr car) expect)] [(eval:check e expect) (loop (extract s cdr car) (list (syntax->datum (datum->syntax #f (extract s cdr cdr car)))))] [else - (let ([r (with-handlers ([(lambda (x) - (not (exn:break? x))) - (lambda (e) - (list (if (exn? e) - (exn-message e) - (format "uncaught exception: ~s" e)) - (get-output ev) - (get-error-output ev)))]) - (list (let ([v (do-plain-eval ev s #t)]) - (make-reader-graph (copy-value v (make-hasheq)))) - (get-output ev) - (get-error-output ev)))]) - (when expect - (let ([expect (do-plain-eval ev (car expect) #t)]) - (unless (equal? (car r) expect) - (raise-syntax-error 'eval "example result check failed" s)))) - r)]))) + (values s expect)]))) + + (define ((do-eval ev) s) + (let-values ([(s expect) (extract-to-evaluate s)]) + (if s + (let ([r (with-handlers ([(lambda (x) + (not (exn:break? x))) + (lambda (e) + (list (if (exn? e) + (exn-message e) + (format "uncaught exception: ~s" e)) + (get-output ev) + (get-error-output ev)))]) + (list (let ([v (do-plain-eval ev s #t)]) + (if (call-in-sandbox-context + ev + (let ([cp (current-print)]) + (lambda () + (and (eq? (current-print) cp) + (print-as-expression))))) + (make-reader-graph (copy-value v (make-hasheq))) + (box + (call-in-sandbox-context + ev + (lambda () + (let ([s (open-output-string)]) + (parameterize ([current-output-port s]) + (map (current-print) v)) + (get-output-string s))))))) + (get-output ev) + (get-error-output ev)))]) + (when expect + (let ([expect (do-plain-eval ev (car expect) #t)]) + (unless (equal? (car r) expect) + (raise-syntax-error 'eval "example result check failed" s)))) + r) + (values (list (list (void)) "" ""))))) (define (install ht v v2) @@ -251,7 +279,12 @@ (parameterize ([sandbox-output 'string] [sandbox-error-output 'string] [sandbox-propagate-breaks #f]) - (make-evaluator '(begin)))))) + (let ([e (make-evaluator '(begin))]) + (let ([ns (namespace-anchor->namespace anchor)]) + (call-in-sandbox-context e + (lambda () + (namespace-attach-module ns 'file/convertible)))) + e))))) (define (make-base-eval-factory mod-paths) (let ([ns (delay (let ([ns (make-base-empty-namespace)]) @@ -310,9 +343,11 @@ (define-syntax-rule (quote-expr e) 'e) (define (do-interaction-eval ev e) - (parameterize ([current-command-line-arguments #()]) - (do-plain-eval (or ev (make-base-eval)) e #f)) - "") + (let-values ([(e expect) (extract-to-evaluate e)]) + (when e + (parameterize ([current-command-line-arguments #()]) + (do-plain-eval (or ev (make-base-eval)) e #f))) + "")) (define-syntax interaction-eval (syntax-rules () diff --git a/collects/scribble/extract.rkt b/collects/scribble/extract.rkt index 679b8042..0f928571 100644 --- a/collects/scribble/extract.rkt +++ b/collects/scribble/extract.rkt @@ -5,7 +5,9 @@ scribble/srcdoc (for-syntax scheme/base scheme/path + scheme/list syntax/path-spec + syntax/modread (for-syntax scheme/base))) (provide include-extracted @@ -34,14 +36,15 @@ n-path)]) (let ([s-exp (parameterize ([current-namespace (make-base-namespace)] - [read-accept-reader #t] [current-load-relative-directory (path-only path)]) (expand - (with-input-from-file path - (lambda () - (port-count-lines! (current-input-port)) - (read-syntax path)))))]) + (with-module-reading-parameterization + (lambda () + (with-input-from-file path + (lambda () + (port-count-lines! (current-input-port)) + (read-syntax path)))))))]) (syntax-case s-exp () [(mod name lang (mod-beg @@ -55,35 +58,41 @@ (syntax->list #'(spec ...))] [_ null])) (syntax->list #'(content ...))))] + [(doc-req ...) + (map + strip-context + (append-map (lambda (c) + (syntax-case c (#%plain-app void quote-syntax require/doc) + [(#%plain-app void (quote-syntax (require/doc spec ...))) + (syntax->list #'(spec ...))] + [_ null])) + (syntax->list #'(content ...))))] [(req ...) (map strip-context - (apply - append - (map (lambda (c) - (syntax-case c (#%require #%plain-app void quote-syntax require/doc) - [(#%require spec ...) - (let loop ([specs (syntax->list #'(spec ...))]) - (cond - [(null? specs) '()] - [else (let ([spec (car specs)]) - (syntax-case spec (for-syntax for-meta) - [(for-syntax . spec) (loop (cdr specs))] - [(for-meta . spec) (loop (cdr specs))] - [(for-template . spec) (loop (cdr specs))] - [(for-label . spec) (loop (cdr specs))] - [(just-meta . spec) (loop (cdr specs))] - [_ (cons #`(for-label #,spec) (loop (cdr specs)))]))]))] - [(#%plain-app void (quote-syntax (require/doc spec ...))) - (syntax->list #'(spec ...))] - [_ null])) - (syntax->list #'(content ...)))))] + (append-map (lambda (c) + (syntax-case c (#%require) + [(#%require spec ...) + (let loop ([specs (syntax->list #'(spec ...))]) + (cond + [(null? specs) '()] + [else (let ([spec (car specs)]) + (syntax-case spec (for-syntax for-meta) + [(for-syntax . spec) (loop (cdr specs))] + [(for-meta . spec) (loop (cdr specs))] + [(for-template . spec) (loop (cdr specs))] + [(for-label . spec) (loop (cdr specs))] + [(just-meta . spec) (loop (cdr specs))] + [_ (cons #`(for-label #,spec) (loop (cdr specs)))]))]))] + [_ null])) + (syntax->list #'(content ...))))] [orig-tag (datum->syntax #f 'orig)]) ;; This template is matched in `filter-info', below #`(begin (#%require (for-label #,(strip-context #'lang)) (for-label #,(strip-context orig-path)) req ...) + (require doc-req ...) (drop-first (quote-syntax id) (def-it orig-tag content)) ...))])))) (define-syntax (include-extracted stx) @@ -94,7 +103,7 @@ (define-syntax (provide-extracted stx) (syntax-case stx () [(_ orig-path) - (with-syntax ([(_begin reqs (_drop-first (_quote-syntax id) def) ...) + (with-syntax ([(_begin reqs doc-reqs (_drop-first (_quote-syntax id) def) ...) (extract #'orig-path stx)]) #'(begin (require (for-label (only-in orig-path))) ;; creates build dependency @@ -130,6 +139,7 @@ [(box? stx) #`(box #,(loop (unbox stx)))] [else #`(quote #,stx)]))]))]) #`(begin #,(quote-syntax/loc reqs) + #,(quote-syntax/loc doc-reqs) #,@(filter values (map (lambda (i d) diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index d5b0e252..412b4c34 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -9,6 +9,7 @@ scheme/port scheme/list scheme/string + file/convertible mzlib/runtime-path setup/main-doc setup/main-collects @@ -947,6 +948,15 @@ (cond [(string? e) (super render-content e part ri)] ; short-cut for common case [(list? e) (super render-content e part ri)] ; also a short-cut + [(and (convertible? e) + (convert e 'png-bytes)) + => (lambda (bstr) + (let ([w (integer-bytes->integer (subbytes bstr 16 20) #f #t)] + [h (integer-bytes->integer (subbytes bstr 20 24) #f #t)]) + `((img ([src ,(install-file "pict.png" bstr)] + [alt "image"] + [width ,(number->string w)] + [height ,(number->string h)])))))] [(image-element? e) (let* ([src (main-collects-relative->path (image-element-path e))] [suffixes (image-element-suffixes e)] @@ -1046,7 +1056,7 @@ (begin (when #f (fprintf (current-error-port) - "Undefined link: ~s~n" + "Undefined link: ~s\n" (tag-key (link-element-tag e) ri))) `((font ([class "badlink"]) ,@(if (empty-content? (element-content e)) @@ -1421,7 +1431,12 @@ [full-path (build-path (path-only (current-output-file)) filename)]) (parameterize ([on-separate-page-ok #f]) - (with-output-to-file full-path #:exists 'truncate/replace + ;; We use 'replace instead of the usual 'truncate/replace + ;; to avoid problems where a filename changes only in case, + ;; in which case some platforms will see the old file + ;; as matching the new name, while others don't. Replacing + ;; the file syncs the case with the current uses. + (with-output-to-file full-path #:exists 'replace (lambda () (render-one-part d ri full-path number))) null)) (parameterize ([on-separate-page-ok #t]) diff --git a/collects/meta/web/html.rkt b/collects/scribble/html.rkt similarity index 100% rename from collects/meta/web/html.rkt rename to collects/scribble/html.rkt diff --git a/collects/meta/web/html/html.rkt b/collects/scribble/html/html.rkt similarity index 100% rename from collects/meta/web/html/html.rkt rename to collects/scribble/html/html.rkt diff --git a/collects/scribble/html/lang.rkt b/collects/scribble/html/lang.rkt new file mode 100644 index 00000000..3caefb4a --- /dev/null +++ b/collects/scribble/html/lang.rkt @@ -0,0 +1,14 @@ +#lang racket/base + +(require "main.rkt" (except-in scribble/text/lang #%top) + scribble/text/syntax-utils) + +(provide (except-out (all-from-out scribble/text/lang) #%module-begin) + (rename-out [module-begin #%module-begin]) + (all-from-out "main.rkt")) + +(require (for-syntax racket/base)) +(define-syntax-rule (module-begin expr ...) + (#%plain-module-begin + (port-count-lines! (current-output-port)) + (process-begin/text begin output-xml expr ...))) diff --git a/collects/scribble/html/lang/reader.rkt b/collects/scribble/html/lang/reader.rkt new file mode 100644 index 00000000..b61bd509 --- /dev/null +++ b/collects/scribble/html/lang/reader.rkt @@ -0,0 +1,11 @@ +#lang s-exp syntax/module-reader + +scribble/html/lang + +#:read scribble:read-inside +#:read-syntax scribble:read-syntax-inside +#:whole-body-readers? #t +#:info (scribble-base-reader-info) + +(require (prefix-in scribble: scribble/reader) + (only-in scribble/base/reader scribble-base-reader-info)) diff --git a/collects/scribble/html/main.rkt b/collects/scribble/html/main.rkt new file mode 100644 index 00000000..789c4fe3 --- /dev/null +++ b/collects/scribble/html/main.rkt @@ -0,0 +1,17 @@ +#lang racket/base + +(require "xml.rkt" "html.rkt" "resource.rkt" + ;; includes all of the scribble/text utilities + scribble/text) + +(provide (all-from-out "xml.rkt" "html.rkt" "resource.rkt" scribble/text) + (rename-out [top #%top])) + +(require (for-syntax racket/base)) +(define-syntax (top stx) + (syntax-case stx () + [(_ . x) + (let ([x* (syntax-e #'x)]) + (if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*))) + #''x + #'(#%top . x)))])) diff --git a/collects/meta/web/html/resource.rkt b/collects/scribble/html/resource.rkt similarity index 90% rename from collects/meta/web/html/resource.rkt rename to collects/scribble/html/resource.rkt index 774a299c..54632f4e 100644 --- a/collects/meta/web/html/resource.rkt +++ b/collects/scribble/html/resource.rkt @@ -47,10 +47,10 @@ (define cached-roots '(#f . #f)) (define (current-url-roots) - ;; takes in a (listof (list prefix-string url-string . flags)), and produces - ;; an alist with lists of strings for the keys; the prefix-strings are split - ;; on "/"s, and the url-strings can be anything at all actually (they are put - ;; as-is before the path with a "/" between them). + ;; takes `url-roots', a (listof (list prefix-string url-string . flags)), and + ;; produces an alist with lists of strings for the keys; the prefix-strings + ;; are split on "/"s, and the url-strings can be anything at all actually + ;; (they are put as-is before the path with a "/" between them). (let ([roots (url-roots)]) (unless (eq? roots (car cached-roots)) (set! cached-roots @@ -86,7 +86,7 @@ ;; find shared prefix [(and (pair? t) (pair? c) (equal? (car t) (car c))) (loop (cdr t) (cdr c) (cons (car t) pfx))] - ;; done + ;; done with the shared prefix, deal with the root now ;; no roots => always use a relative path (useful for debugging) [(not roots) `(,@(map (lambda (_) "..") c) ,@t ,file*)] ;; share a root => use a relative path unless its an absolute root @@ -197,16 +197,26 @@ (printf " ~a\n" path) (renderer filename)))))) (define (url) (relativize filename dirpathlist (rendered-dirpath))) + (define absolute-url + (delay (let ([url (relativize filename dirpathlist '())]) + (if (url-roots) + url + ;; we're in local build mode, and insist on an absolute url, + ;; so construct a `file://' result + (list* "file://" (current-directory) url))))) (add-renderer path render) (make-keyword-procedure (lambda (kws kvs . args) (keyword-apply referrer kws kvs (url) args)) - (case-lambda [(x) (if (eq? x get-resource-path) (url) (referrer (url) x))] + (case-lambda [(x) (if (and (pair? x) (eq? (car x) get-path)) + (if (cdr x) absolute-url (url)) + (referrer (url) x))] [args (apply referrer (url) args)])))) ;; make it possible to always get the path to a resource (provide get-resource-path) -(define (get-resource-path resource) - (resource get-resource-path)) +(define get-path (gensym)) +(define (get-resource-path resource [absolute? #f]) + (resource (cons get-path absolute?))) ;; a convenient utility to create renderers from some output function (like ;; `output-xml' or `display') and some content @@ -218,9 +228,11 @@ (provide render-all) (define (render-all) (printf "Rendering...\n") - (let loop () - (let ([todo (get/reset-renderers)]) + (define todo (get/reset-renderers)) + (if (null? todo) + (printf " Warning: no content to render\n") + (let loop ([todo todo]) (unless (null? todo) (for-each (lambda (r) (r)) todo) - (loop)))) ; if more were created + (loop (get/reset-renderers))))) ; if more were created (printf "Rendering done.\n")) diff --git a/collects/meta/web/html/xml.rkt b/collects/scribble/html/xml.rkt similarity index 100% rename from collects/meta/web/html/xml.rkt rename to collects/scribble/html/xml.rkt diff --git a/collects/scribble/info.rkt b/collects/scribble/info.rkt index 5d0130f0..d7c2e67a 100644 --- a/collects/scribble/info.rkt +++ b/collects/scribble/info.rkt @@ -7,3 +7,4 @@ (define raco-commands '(("scribble" scribble/run "render a Scribble document" #f))) +(define purpose "This collect contains the implementation of scribble.") diff --git a/collects/scribble/jfp.rkt b/collects/scribble/jfp.rkt index 7db49c74..e79f7713 100644 --- a/collects/scribble/jfp.rkt +++ b/collects/scribble/jfp.rkt @@ -14,7 +14,7 @@ (define jfp-extras (let ([abs (lambda (s) (path->main-collects-relative - (build-path (collection-path "scribble") "jfp" s)))]) + (collection-file-path s "scribble" "jfp")))]) (list (make-css-addition (abs "jfp.css")) (make-tex-addition (abs "jfp.tex"))))) diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index 9412958e..e1f006bb 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -9,7 +9,8 @@ scheme/path scheme/string scheme/list - setup/main-collects) + setup/main-collects + file/convertible) (provide render-mixin) (define current-table-mode (make-parameter #f)) @@ -235,18 +236,30 @@ es)] [style (and (style? es) es)] [core-render (lambda (e tt?) - (if (and (image-element? e) - (not (disable-images))) - (let ([fn (install-file - (select-suffix - (main-collects-relative->path - (image-element-path e)) - (image-element-suffixes e) - '(".pdf" ".ps" ".png")))]) - (printf "\\includegraphics[scale=~a]{~a}" - (image-element-scale e) fn)) - (parameterize ([rendering-tt (or tt? (rendering-tt))]) - (super render-content e part ri))))] + (cond + [(and (image-element? e) + (not (disable-images))) + (let ([fn (install-file + (select-suffix + (main-collects-relative->path + (image-element-path e)) + (image-element-suffixes e) + '(".pdf" ".ps" ".png")))]) + (printf "\\includegraphics[scale=~a]{~a}" + (image-element-scale e) fn))] + [(and (convertible? e) + (not (disable-images)) + (let ([ftag (lambda (v suffix) (and v (list v suffix)))]) + (or (ftag (convert e 'pdf-bytes) ".pdf") + (ftag (convert e 'eps-bytes) ".ps") + (ftag (convert e 'png-bytes) ".png")))) + => (lambda (bstr+suffix) + (let ([fn (install-file (format "pict~a" (cadr bstr+suffix)) + (car bstr+suffix))]) + (printf "\\includegraphics{~a}" fn)))] + [else + (parameterize ([rendering-tt (or tt? (rendering-tt))]) + (super render-content e part ri))]))] [wrap (lambda (e s tt?) (printf "\\~a{" s) (core-render e tt?) @@ -562,11 +575,11 @@ [(symbol? i) (display (case i [(nbsp) "~"] - [(mdash) "---"] - [(ndash) "--"] - [(ldquo) "``"] - [(rdquo) "''"] - [(rsquo) "'"] + [(mdash) "{---}"] + [(ndash) "{--}"] + [(ldquo) "{``}"] + [(rdquo) "{''}"] + [(rsquo) "{'}"] [(prime) "$'$"] [(rarr) "$\\rightarrow$"] [(larr) "$\\leftarrow$"] @@ -597,6 +610,9 @@ [(#\>) (if (rendering-tt) "{\\texttt >}" "$>$")] [(#\<) (if (rendering-tt) "{\\texttt <}" "$<$")] [(#\|) (if (rendering-tt) "{\\texttt |}" "$|$")] + [(#\-) "{-}"] ;; avoid en- or em-dash + [(#\`) "{`}"] ;; avoid double-quotes + [(#\') "{'}"] ;; avoid double-quotes [(#\? #\! #\. #\:) (if (rendering-tt) (format "{\\hbox{\\texttt{~a}}}" c) c)] [(#\~) "$\\sim$"] diff --git a/collects/scribble/manual.rkt b/collects/scribble/manual.rkt index d84a5bf7..7266ff51 100644 --- a/collects/scribble/manual.rkt +++ b/collects/scribble/manual.rkt @@ -2,6 +2,7 @@ (require "base.ss" "private/manual-style.ss" "private/manual-scheme.ss" + "private/manual-code.ss" "private/manual-mod.ss" "private/manual-tech.ss" "private/manual-bib.ss" @@ -18,6 +19,7 @@ (all-from-out "base.ss" "private/manual-style.ss" "private/manual-scheme.ss" + "private/manual-code.ss" "private/manual-mod.ss" "private/manual-tech.ss" "private/manual-bib.ss" diff --git a/collects/scribble/private/manual-code.rkt b/collects/scribble/private/manual-code.rkt new file mode 100644 index 00000000..e78d7d48 --- /dev/null +++ b/collects/scribble/private/manual-code.rkt @@ -0,0 +1,194 @@ +#lang racket/base +(require syntax/strip-context + syntax-color/module-lexer + "../racket.rkt" + "../core.rkt" + "../base.rkt" + "manual-scheme.rkt" + (for-syntax racket/base + syntax/parse)) + +(provide codeblock + typeset-code) + +(define-syntax (codeblock stx) + (syntax-parse stx + [(_ (~seq (~or (~optional (~seq #:expand expand-expr:expr) + #:defaults ([expand-expr #'#f]) + #:name "#:expand keyword") + (~optional (~seq #:indent indent-expr:expr) + #:defaults ([indent-expr #'2]) + #:name "#:expand keyword") + (~optional (~seq #:keep-lang-line? keep-lang-line?-expr:expr) + #:defaults ([keep-lang-line?-expr #'#t]) + #:name "#:keep-lang-line? keyword") + (~optional (~seq #:context context-expr:expr) + #:name "#:context keyword")) + ...) + str ...) + #`(typeset-code str ... + #:expand expand-expr + #:keep-lang-line? keep-lang-line?-expr + #:indent indent-expr + #:context #,(if (attribute context-expr) + #'context-expr + (or + (let ([v #'(str ...)]) + (and (pair? (syntax-e v)) + #`#'#,(car (syntax-e v)))) + #'#f)))])) + +(define (typeset-code #:context [context #f] + #:expand [expand #f] + #:indent [indent 2] + #:keep-lang-line? [keep-lang-line? #t] + . strs) + (let* ([str (apply string-append strs)] + [bstr (string->bytes/utf-8 (regexp-replace* #rx"(?m:^$)" str "\xA0"))] + [in (open-input-bytes bstr)]) + (let* ([tokens + (let loop ([mode #f]) + (let-values ([(lexeme type data start end backup-delta mode) + (module-lexer in 0 mode)]) + (if (eof-object? lexeme) + null + (cons (list type (sub1 start) (sub1 end) 0) + (loop mode)))))] + [substring* (lambda (bstr start [end (bytes-length bstr)]) + (bytes->string/utf-8 (subbytes bstr start end)))] + [e (parameterize ([read-accept-reader #t]) + ((or expand + (lambda (stx) + (if context + (replace-context context stx) + stx))) + (read-syntax 'prog (open-input-bytes bstr))))] + [ids (let loop ([e e]) + (cond + [(and (identifier? e) + (syntax-original? e)) + (let ([pos (sub1 (syntax-position e))]) + (list (list (to-element e) + pos + (+ pos (syntax-span e)) + 1)))] + [(syntax? e) (append (loop (syntax-e e)) + (loop (or (syntax-property e 'origin) + null)) + (loop (or (syntax-property e 'disappeared-use) + null)))] + [(pair? e) (append (loop (car e)) (loop (cdr e)))] + [else null]))] + [link-mod (lambda (mp-stx priority #:orig? [always-orig? #f]) + (if (or always-orig? + (syntax-original? mp-stx)) + (let ([mp (syntax->datum mp-stx)] + [pos (sub1 (syntax-position mp-stx))]) + (list (list (racketmodname #,mp) + pos + (+ pos (syntax-span mp-stx)) + priority))) + null))] + ;; This makes sense when `expand' actually expands, and + ;; probably not otherwise: + [mods (let loop ([e e]) + (syntax-case e (module require begin) + [(module name lang (mod-beg form ...)) + (apply append + (link-mod #'lang 2) + (map loop (syntax->list #'(form ...))))] + [(#%require spec ...) + (apply append + (map (lambda (spec) + ;; Need to add support for renaming forms, etc.: + (if (module-path? (syntax->datum spec)) + (link-mod spec 2) + null)) + (syntax->list #'(spec ...))))] + [(begin form ...) + (apply append + (map loop (syntax->list #'(form ...))))] + [else null]))] + [language (if (regexp-match? #rx"^#lang " bstr) + (let ([m (regexp-match #rx"^#lang ([-a-zA-Z/._+]+)" bstr)]) + (if m + (link-mod + #:orig? #t + (datum->syntax #f + (string->symbol (bytes->string/utf-8 (cadr m))) + (vector 'in 1 6 7 (bytes-length (cadr m)))) + 3) + null)) + null)] + [tokens (sort (append ids + mods + language + (filter (lambda (x) (not (eq? (car x) 'symbol))) + ;; Drop #lang entry: + (cdr tokens))) + (lambda (a b) + (or (< (cadr a) (cadr b)) + (and (= (cadr a) (cadr b)) + (> (cadddr a) (cadddr b))))))] + [default-color meta-color]) + (table + block-color + ((if keep-lang-line? values cdr) ; FIXME: #lang can span lines + (list->lines + indent + (let loop ([pos 0] + [tokens tokens]) + (cond + [(null? tokens) (split-lines default-color (substring* bstr pos))] + [(eq? (caar tokens) 'white-space) (loop pos (cdr tokens))] + [(= pos (cadar tokens)) + (append (let ([style (caar tokens)]) + (if (symbol? style) + (let ([scribble-style + (case style + [(symbol) symbol-color] + [(parenthesis) paren-color] + [(constant string) value-color] + [(comment) comment-color] + [else default-color])]) + (split-lines scribble-style + (substring* bstr (cadar tokens) (caddar tokens)))) + (list (caar tokens)))) + (loop (caddar tokens) (cdr tokens)))] + [(> pos (cadar tokens)) + (loop pos (cdr tokens))] + [else (append + (split-lines default-color (substring* bstr pos (cadar tokens))) + (loop (cadar tokens) tokens))])))))))) + + +(define (split-lines style s) + (cond + [(regexp-match-positions #rx"(?:\r\n|\r|\n)" s) + => (lambda (m) + (list* (element style (substring s 0 (caar m))) + 'newline + (split-lines style (substring s (cdar m)))))] + [(regexp-match-positions #rx" +" s) + => (lambda (m) + (append (split-lines style (substring s 0 (caar m))) + (list (hspace (- (cdar m) (caar m)))) + (split-lines style (substring s (cdar m)))))] + [else (list (element style s))])) + +(define omitable (make-style #f '(omitable))) + +(define (list->lines indent-amt l) + (define (make-line accum-line) (list (paragraph omitable + (cons indent-elem + (reverse accum-line))))) + (define indent-elem (hspace indent-amt)) + (let loop ([l l] [accum-line null]) + (cond + [(null? l) (if (null? accum-line) + null + (list (make-line accum-line)))] + [(eq? 'newline (car l)) + (cons (make-line accum-line) + (loop (cdr l) null))] + [else (loop (cdr l) (cons (car l) accum-line))]))) diff --git a/collects/scribble/private/manual-proc.rkt b/collects/scribble/private/manual-proc.rkt index 076a30d9..a01168bf 100644 --- a/collects/scribble/private/manual-proc.rkt +++ b/collects/scribble/private/manual-proc.rkt @@ -18,6 +18,7 @@ scheme/list (for-syntax racket/base) (for-label racket/base + racket/contract racket/class)) (provide defproc defproc* defstruct defstruct* diff --git a/collects/scribble/private/manual-tech.rkt b/collects/scribble/private/manual-tech.rkt index 539b7313..3e4d92ca 100644 --- a/collects/scribble/private/manual-tech.rkt +++ b/collects/scribble/private/manual-tech.rkt @@ -8,12 +8,18 @@ (provide/contract [deftech (() (#:style? boolean?) #:rest (listof pre-content?) . ->* . element?)] - [tech (() (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c)) #:rest (listof pre-content?) . ->* . element?)] - [techlink (() (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c)) #:rest (listof pre-content?) . ->* . element?)]) + [tech (() + (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c) #:key (or/c string? #f)) + #:rest (listof pre-content?) + . ->* . element?)] + [techlink (() + (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c) #:key (or/c string? #f)) + #:rest (listof pre-content?) + . ->* . element?)]) -(define (*tech make-elem style doc prefix s) +(define (*tech make-elem style doc prefix s key) (let* ([c (decode-content s)] - [s (string-foldcase (content->string c))] + [s (string-foldcase (or key (content->string c)))] [s (regexp-replace #rx"ies$" s "y")] [s (regexp-replace #rx"s$" s "")] [s (regexp-replace* #px"[-\\s]+" s " ")]) @@ -23,7 +29,7 @@ (let* ([e (if style? (apply defterm s) (make-element #f (decode-content s)))] - [t (*tech make-target-element #f #f #f (list e))]) + [t (*tech make-target-element #f #f #f (list e) #f)]) (make-index-element #f (list t) (target-element-tag t) @@ -31,14 +37,14 @@ (list e) 'tech))) -(define (tech #:doc [doc #f] #:tag-prefixes [prefix #f] . s) +(define (tech #:doc [doc #f] #:tag-prefixes [prefix #f] #:key [key #f] . s) (*tech (lambda (style c tag) (make-link-element style (list (make-element "techinside" c)) tag)) "techoutside" - doc prefix s)) + doc prefix s key)) -(define (techlink #:doc [doc #f] #:tag-prefixes [prefix #f] . s) - (*tech make-link-element #f doc prefix s)) +(define (techlink #:doc [doc #f] #:tag-prefixes [prefix #f] #:key [key #f] . s) + (*tech make-link-element #f doc prefix s key)) diff --git a/collects/scribble/racket.rkt b/collects/scribble/racket.rkt index 9c2be06c..a42247c8 100644 --- a/collects/scribble/racket.rkt +++ b/collects/scribble/racket.rkt @@ -8,6 +8,7 @@ mzlib/for syntax/modresolve syntax/modcode + file/convertible (for-syntax racket/base)) (provide define-code @@ -215,7 +216,8 @@ quote-depth)]) (if (or (element? (syntax-e c)) (delayed-element? (syntax-e c)) - (part-relative-element? (syntax-e c))) + (part-relative-element? (syntax-e c)) + (convertible? (syntax-e c))) (out (syntax-e c) #f) (out (if (and (identifier? c) color? @@ -441,7 +443,7 @@ (let ([l (syntax->list c)] [h? highlight?]) (unless (and l (= 2 (length l))) - (error "bad code:redex: ~e" (syntax->datum c))) + (error "bad code:redex: ~.s" (syntax->datum c))) (advance c init-line!) (set! src-col (syntax-column (cadr l))) (hash-set! next-col-map src-col dest-col) @@ -604,7 +606,10 @@ [(mpair? (syntax-e c)) (syntax-e c)] [else c])] - [first-expr? (and expr? (not (struct-proxy? (syntax-e c))) (not no-cons?))] + [first-expr? (and expr? + (or (zero? quote-depth) + (not (struct-proxy? (syntax-e c)))) + (not no-cons?))] [dotted? #f]) (cond [(and (syntax? l) @@ -1088,14 +1093,15 @@ (list (do-syntax-ize (car v) col line ht #f qq #f) c) (vector #f line col (+ 1 col) - (+ 1 - (if (and qq (zero? qq)) 1 0) + (+ delta (syntax-span c))))))] [(or (list? v) (vector? v) (and (struct? v) (or (and qq - ;; Watch out for partially transparent subtypes of `element': + ;; Watch out for partially transparent subtypes of `element' + ;; or convertible values: + (not (convertible? v)) (not (element? v))) (prefab-struct-key v)))) (let ([orig-ht (unbox ht)] @@ -1115,10 +1121,10 @@ [else 0])] [delta (if (and qq (zero? qq)) (cond - [(vector? v) 8] - [(struct? v) 1] - [no-cons? 1] - [else 5]) + [(vector? v) 8] ; `(vector ' + [(struct? v) 1] ; '(' + [no-cons? 1] ; '(' + [else 6]) ; `(list ' 1)] [r (let ([l (let loop ([col (+ col delta vec-sz graph-sz)] [v (cond diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt index 41fcf979..8607a800 100644 --- a/collects/scribble/sigplan.rkt +++ b/collects/scribble/sigplan.rkt @@ -35,22 +35,22 @@ (->* () () #:rest (listof pre-content?) content?)]) -(provide preprint 10pt +(provide preprint 10pt nocopyright onecolumn noqcourier notimes include-abstract) -(define-syntax (preprint stx) - (raise-syntax-error #f - "option must appear on the same line as `#lang scribble/sigplan'" - stx)) -(define-syntax (10pt stx) - (raise-syntax-error #f - "option must appear on the same line as `#lang scribble/sigplan'" - stx)) +(define-syntax-rule (defopts name ...) + (begin (define-syntax (name stx) + (raise-syntax-error #f + "option must appear on the same line as `#lang scribble/sigplan'" + stx)) + ... + (provide name ...))) +(defopts preprint 10pt nocopyright onecolumn noqcourier notimes) (define sigplan-extras (let ([abs (lambda (s) (path->main-collects-relative - (build-path (collection-path "scribble") "sigplan" s)))]) + (collection-file-path s "scribble" "sigplan")))]) (list (make-css-addition (abs "sigplan.css")) (make-tex-addition (abs "sigplan.tex"))))) diff --git a/collects/scribble/sigplan/lang.rkt b/collects/scribble/sigplan/lang.rkt index 39ddf14f..bcf43a50 100644 --- a/collects/scribble/sigplan/lang.rkt +++ b/collects/scribble/sigplan/lang.rkt @@ -4,6 +4,7 @@ scribble/base scribble/decode scribble/sigplan + racket/list "../private/defaults.ss" (for-syntax scheme/base)) (provide (except-out (all-from-out scribble/doclang) #%module-begin) @@ -15,35 +16,65 @@ (syntax-case stx () [(_ id . body) (let ([preprint? #f] - [10pt? #f]) + [10pt? #f] + [onecolumn? #f] + [nocopyright? #f] + [times? #t] + [qcourier? #t]) (let loop ([stuff #'body]) - (syntax-case* stuff (preprint 10pt) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) + (syntax-case* stuff (onecolumn preprint 10pt nocopyright notimes noqcourier) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) [(ws . body) ;; Skip intraline whitespace to find options: (and (string? (syntax-e #'ws)) (regexp-match? #rx"^ *$" (syntax-e #'ws))) (loop #'body)] [(preprint . body) - (set! preprint? #t) + (set! preprint? "preprint") + (loop #'body)] + [(onecolumn . body) + (set! onecolumn? "onecolumn") + (loop #'body)] + [(nocopyright . body) + (set! nocopyright? "nocopyrightspace") (loop #'body)] [(10pt . body) - (set! 10pt? #t) + (set! 10pt? "10pt") + (loop #'body)] + [(noqcourier . body) + (set! qcourier? #f) + (loop #'body)] + [(notimes . body) + (set! times? #f) (loop #'body)] [body - #`(#%module-begin id (post-process #,preprint? #,10pt?) () . body)])))])) + #`(#%module-begin id (post-process #,times? #,qcourier? #,preprint? #,10pt? #,nocopyright? #,onecolumn?) () . body)])))])) +#| -(define ((post-process preprint? 10pt?) doc) - (let ([options - (cond - [(and preprint? 10pt?) "[preprint, 10pt]"] - [preprint? "[preprint]"] - [10pt? "[10pt]"] - [else ""])]) +The docs for the times.sty package suggests that it should not be used +so maybe we want to disable it permanently (or replace it with something else). + +Read here for more: + + http://www.ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf + +|# + +(define ((post-process times? qcourier? . opts) doc) + (let ([options + (if (ormap values opts) + (format "[~a]" (apply string-append (add-between (filter values opts) ", "))) + "")]) (add-sigplan-styles (add-defaults doc (string->bytes/utf-8 - (format "\\documentclass~a{sigplanconf}\n\\usepackage{times}\n\\usepackage{qcourier}\n" - options)) + (format "\\documentclass~a{sigplanconf}\n~a~a" + options + (if times? + "\\usepackage{times}\n" + "") + (if qcourier? + "\\usepackage{qcourier}\n" + ""))) (scribble-file "sigplan/style.tex") (list (scribble-file "sigplan/sigplanconf.cls")) #f)))) diff --git a/collects/scribble/sigplan/sigplanconf.cls b/collects/scribble/sigplan/sigplanconf.cls index a5891f75..4120cbda 100644 --- a/collects/scribble/sigplan/sigplanconf.cls +++ b/collects/scribble/sigplan/sigplanconf.cls @@ -20,18 +20,18 @@ \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesClass{sigplanconf}[2009/04/29 v1.9 ACM SIGPLAN Proceedings] +\ProvidesClass{sigplanconf}[2007/03/13 v1.5 ACM SIGPLAN Proceedings] % The following few pages contain LaTeX programming extensions adapted % from the ZzTeX macro package. - + % Token Hackery % ----- ------- \def \@expandaftertwice {\expandafter\expandafter\expandafter} \def \@expandafterthrice {\expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter} + \expandafter\expandafter\expandafter} % This macro discards the next token. @@ -49,17 +49,17 @@ % Usage: \expandafter\@defof \meaning\macro\@mark \def \@defof #1:->#2\@mark{#2} - + % Control Sequence Names % ------- -------- ----- \def \@name #1{% {\tokens} - \csname \expandafter\@discardtok \string#1\endcsname} + \csname \expandafter\@discardtok \string#1\endcsname} \def \@withname #1#2{% {\command}{\tokens} - \expandafter#1\csname \expandafter\@discardtok \string#2\endcsname} - + \expandafter#1\csname \expandafter\@discardtok \string#2\endcsname} + % Flags (Booleans) % ----- ---------- @@ -70,7 +70,7 @@ \def \@false {FL} \def \@setflag #1=#2{\edef #1{#2}}% \flag = boolean - + % IF and Predicates % -- --- ---------- @@ -99,7 +99,7 @@ \def \@oddp #1{\ifodd #1\@true \else \@false \fi} \def \@evenp #1{\ifodd #1\@false \else \@true \fi} \def \@rangep #1#2#3{\if \@orp{\@lssp{#1}{#2}}{\@gtrp{#1}{#3}}\@false \else - \@true \fi} + \@true \fi} \def \@tensp #1{\@rangep{#1}{10}{19}} \def \@dimeqlp #1#2{\ifdim #1 = #2\@true \else \@false \fi} @@ -124,25 +124,25 @@ \long\def \@xtokeqlp #1#2{\expandafter\ifx #1#2\@true \else \@false \fi} \long\def \@definedp #1{% - \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname - \relax \@false \else \@true \fi} + \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname + \relax \@false \else \@true \fi} \long\def \@undefinedp #1{% - \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname - \relax \@true \else \@false \fi} + \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname + \relax \@true \else \@false \fi} \def \@emptydefp #1{\ifx #1\@empty \@true \else \@false \fi}% {\name} \let \@emptylistp = \@emptydefp \long\def \@emptyargp #1{% {#n} - \@empargp #1\@empargq\@mark} + \@empargp #1\@empargq\@mark} \long\def \@empargp #1#2\@mark{% - \ifx #1\@empargq \@true \else \@false \fi} + \ifx #1\@empargq \@true \else \@false \fi} \def \@empargq {\@empargq} \def \@emptytoksp #1{% {\tokenreg} - \expandafter\@emptoksp \the#1\@mark} + \expandafter\@emptoksp \the#1\@mark} \long\def \@emptoksp #1\@mark{\@emptyargp{#1}} @@ -163,30 +163,30 @@ \def \@notp #1{\if #1\@false \else \@true \fi} \def \@andp #1#2{\if #1% - \if #2\@true \else \@false \fi - \else - \@false - \fi} + \if #2\@true \else \@false \fi + \else + \@false + \fi} \def \@orp #1#2{\if #1% - \@true - \else - \if #2\@true \else \@false \fi - \fi} - -\def \@xorp #1#2{\if #1% - \if #2\@false \else \@true \fi + \@true \else \if #2\@true \else \@false \fi \fi} +\def \@xorp #1#2{\if #1% + \if #2\@false \else \@true \fi + \else + \if #2\@true \else \@false \fi + \fi} + % Arithmetic % ---------- \def \@increment #1{\advance #1 by 1\relax}% {\count} \def \@decrement #1{\advance #1 by -1\relax}% {\count} - + % Options % ------- @@ -207,16 +207,16 @@ % Note that all the dangerous article class options are trapped. \DeclareOption{9pt}{\@setflag \@ninepoint = \@true - \@setflag \@explicitsize = \@true} + \@setflag \@explicitsize = \@true} \DeclareOption{10pt}{\PassOptionsToClass{10pt}{article}% - \@setflag \@ninepoint = \@false - \@setflag \@tenpoint = \@true - \@setflag \@explicitsize = \@true} + \@setflag \@ninepoint = \@false + \@setflag \@tenpoint = \@true + \@setflag \@explicitsize = \@true} \DeclareOption{11pt}{\PassOptionsToClass{11pt}{article}% - \@setflag \@ninepoint = \@false - \@setflag \@explicitsize = \@true} + \@setflag \@ninepoint = \@false + \@setflag \@explicitsize = \@true} \DeclareOption{12pt}{\@unsupportedoption{12pt}} @@ -252,7 +252,7 @@ \DeclareOption{numberedpars}{\@numheaddepth = 4} -%%%\DeclareOption{onecolumn}{\@setflag \@onecolumn = \@true} +\DeclareOption{onecolumn}{\@setflag \@onecolumn = \@true} \DeclareOption{preprint}{\@setflag \@preprint = \@true} @@ -271,34 +271,34 @@ \ProcessOptions \if \@onecolumn - \if \@notp{\@explicitsize}% - \@setflag \@ninepoint = \@false - \PassOptionsToClass{11pt}{article}% - \fi - \PassOptionsToClass{twoside,onecolumn}{article} + \if \@notp{\@explicitsize}% + \@setflag \@ninepoint = \@false +% \PassOptionsToClass{11pt}{article}% + \fi + \PassOptionsToClass{twoside,onecolumn}{article} \else - \PassOptionsToClass{twoside,twocolumn}{article} + \PassOptionsToClass{twoside,twocolumn}{article} \fi \LoadClass{article} \def \@unsupportedoption #1{% - \ClassError{proc}{The standard '#1' option is not supported.}} + \ClassError{proc}{The standard '#1' option is not supported.}} % This can be used with the 'reprint' option to get the final folios. \def \setpagenumber #1{% - \setcounter{page}{#1}} + \setcounter{page}{#1}} \AtEndDocument{\label{sigplanconf@finalpage}} - + % Utilities % --------- \newcommand{\setvspace}[2]{% - #1 = #2 - \advance #1 by -1\parskip} - + #1 = #2 + \advance #1 by -1\parskip} + % Document Parameters % -------- ---------- @@ -313,11 +313,11 @@ \setlength{\headsep}{0pt} \if \@onecolumn - \setlength{\evensidemargin}{.75in} - \setlength{\oddsidemargin}{.75in} + \setlength{\evensidemargin}{.75in} + \setlength{\oddsidemargin}{.75in} \else - \setlength{\evensidemargin}{.75in} - \setlength{\oddsidemargin}{.75in} + \setlength{\evensidemargin}{.75in} + \setlength{\oddsidemargin}{.75in} \fi % Text area: @@ -326,9 +326,9 @@ \setlength{\standardtextwidth}{42pc} \if \@onecolumn - \setlength{\textwidth}{40.5pc} + \setlength{\textwidth}{20pc} \else - \setlength{\textwidth}{\standardtextwidth} + \setlength{\textwidth}{\standardtextwidth} \fi \setlength{\topskip}{8pt} @@ -342,11 +342,11 @@ % Paragraphs: \if \@blockstyle - \setlength{\parskip}{5pt plus .1pt minus .5pt} - \setlength{\parindent}{0pt} + \setlength{\parskip}{5pt plus .1pt minus .5pt} + \setlength{\parindent}{0pt} \else - \setlength{\parskip}{0pt} - \setlength{\parindent}{12pt} + \setlength{\parskip}{0pt} + \setlength{\parindent}{12pt} \fi \setlength{\lineskip}{.5pt} @@ -376,10 +376,10 @@ \setlength{\footnotesep}{9pt} \renewcommand{\footnoterule}{% - \hrule width .5\columnwidth height .33pt depth 0pt} + \hrule width .5\columnwidth height .33pt depth 0pt} \renewcommand{\@makefntext}[1]{% - \noindent \@makefnmark \hspace{1pt}#1} + \noindent \@makefnmark \hspace{1pt}#1} % Floats: @@ -409,48 +409,48 @@ % Miscellaneous: \errorcontextlines = 5 - + % Fonts % ----- \if \@times - \renewcommand{\rmdefault}{ptm}% - \if \@mathtime - \usepackage[mtbold,noTS1]{mathtime}% - \else + \renewcommand{\rmdefault}{ptm}% + \if \@mathtime + \usepackage[mtbold,noTS1]{mathtime}% + \else %%% \usepackage{mathptm}% - \fi + \fi \else - \relax + \relax \fi \if \@ninepoint \renewcommand{\normalsize}{% - \@setfontsize{\normalsize}{9pt}{10pt}% - \setlength{\abovedisplayskip}{5pt plus 1pt minus .5pt}% - \setlength{\belowdisplayskip}{\abovedisplayskip}% - \setlength{\abovedisplayshortskip}{3pt plus 1pt minus 2pt}% - \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} + \@setfontsize{\normalsize}{9pt}{10pt}% + \setlength{\abovedisplayskip}{5pt plus 1pt minus .5pt}% + \setlength{\belowdisplayskip}{\abovedisplayskip}% + \setlength{\abovedisplayshortskip}{3pt plus 1pt minus 2pt}% + \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} \renewcommand{\tiny}{\@setfontsize{\tiny}{5pt}{6pt}} \renewcommand{\scriptsize}{\@setfontsize{\scriptsize}{7pt}{8pt}} \renewcommand{\small}{% - \@setfontsize{\small}{8pt}{9pt}% - \setlength{\abovedisplayskip}{4pt plus 1pt minus 1pt}% - \setlength{\belowdisplayskip}{\abovedisplayskip}% - \setlength{\abovedisplayshortskip}{2pt plus 1pt}% - \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} + \@setfontsize{\small}{8pt}{9pt}% + \setlength{\abovedisplayskip}{4pt plus 1pt minus 1pt}% + \setlength{\belowdisplayskip}{\abovedisplayskip}% + \setlength{\abovedisplayshortskip}{2pt plus 1pt}% + \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} \renewcommand{\footnotesize}{% - \@setfontsize{\footnotesize}{8pt}{9pt}% - \setlength{\abovedisplayskip}{4pt plus 1pt minus .5pt}% - \setlength{\belowdisplayskip}{\abovedisplayskip}% - \setlength{\abovedisplayshortskip}{2pt plus 1pt}% - \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} + \@setfontsize{\footnotesize}{8pt}{9pt}% + \setlength{\abovedisplayskip}{4pt plus 1pt minus .5pt}% + \setlength{\belowdisplayskip}{\abovedisplayskip}% + \setlength{\abovedisplayshortskip}{2pt plus 1pt}% + \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} \renewcommand{\large}{\@setfontsize{\large}{11pt}{13pt}} @@ -471,52 +471,53 @@ \relax \fi\fi - + % Abstract % -------- \renewenvironment{abstract}{% - \section*{Abstract}% - \normalsize}{% - } - + \section*{Abstract}% + \normalsize}{% + } + % Bibliography % ------------ \renewenvironment{thebibliography}[1] - {\section*{\refname - \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}% - \list{\@biblabel{\@arabic\c@enumiv}}% - {\settowidth\labelwidth{\@biblabel{#1}}% - \leftmargin\labelwidth - \advance\leftmargin\labelsep - \@openbib@code - \usecounter{enumiv}% - \let\p@enumiv\@empty - \renewcommand\theenumiv{\@arabic\c@enumiv}}% - \bibfont - \softraggedright%%%\sloppy - \clubpenalty4000 - \@clubpenalty \clubpenalty - \widowpenalty4000% - \sfcode`\.\@m} - {\def\@noitemerr - {\@latex@warning{Empty `thebibliography' environment}}% - \endlist} + {\section*{\refname + \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}% + \list{\@biblabel{\@arabic\c@enumiv}}% + {\settowidth\labelwidth{\@biblabel{#1}}% + \leftmargin\labelwidth + \advance\leftmargin\labelsep + \@openbib@code + \usecounter{enumiv}% + \let\p@enumiv\@empty + \renewcommand\theenumiv{\@arabic\c@enumiv}}% + \bibfont + \softraggedright%%%\sloppy + \clubpenalty4000 + \@clubpenalty \clubpenalty + \widowpenalty4000% + \sfcode`\.\@m} + {\def\@noitemerr + {\@latex@warning{Empty `thebibliography' environment}}% + \endlist} \if \@natbib \usepackage{natbib} \setlength{\bibsep}{3pt plus .5pt minus .25pt} -\bibpunct{[}{]}{,}{A}{}{,} +\bibpunct{(}{)}{;}{A}{}{,} +\let \ncite = \cite \let \cite = \citep \fi \def \bibfont {\small} - + % Categories % ---------- @@ -524,25 +525,25 @@ \@setflag \@firstcategory = \@true \newcommand{\category}[3]{% - \if \@firstcategory - \paragraph*{Categories and Subject Descriptors}% - \@setflag \@firstcategory = \@false - \else - \unskip ;\hspace{.75em}% - \fi - \@ifnextchar [{\@category{#1}{#2}{#3}}{\@category{#1}{#2}{#3}[]}} + \if \@firstcategory + \paragraph*{Categories and Subject Descriptors}% + \@setflag \@firstcategory = \@false + \else + \unskip ;\hspace{.75em}% + \fi + \@ifnextchar [{\@category{#1}{#2}{#3}}{\@category{#1}{#2}{#3}[]}} \def \@category #1#2#3[#4]{% - {\let \and = \relax - #1 [\textit{#2}]% - \if \@emptyargp{#4}% - \if \@notp{\@emptyargp{#3}}: #3\fi - \else - :\space - \if \@notp{\@emptyargp{#3}}#3---\fi - \textrm{#4}% - \fi}} - + {\let \and = \relax + #1 [\textit{#2}]% + \if \@emptyargp{#4}% + \if \@notp{\@emptyargp{#3}}: #3\fi + \else + :\space + \if \@notp{\@emptyargp{#3}}#3---\fi + \textrm{#4}% + \fi}} + % Copyright Notice % --------- ------ @@ -550,125 +551,120 @@ \def \ftype@copyrightbox {8} \def \@toappear {} \def \@permission {} -\def \@reprintprice {} \def \@copyrightspace {% - \@float{copyrightbox}[b]% - \vbox to 1in{% - \vfill - \parbox[b]{20pc}{% - \scriptsize - \if \@preprint - [Copyright notice will appear here - once 'preprint' option is removed.]\par - \else - \@toappear - \fi - \if \@reprint - \noindent Reprinted from \@conferencename, - \@proceedings, - \@conferenceinfo, - pp.~\number\thepage--\pageref{sigplanconf@finalpage}.\par - \fi}}% - \end@float} + \@float{copyrightbox}[b]% + \vbox to 1in{% + \vfill + \parbox[b]{20pc}{% + \scriptsize + \if \@preprint + [Copyright notice will appear here + once 'preprint' option is removed.]\par + \else + \@toappear + \fi + \if \@reprint + \noindent Reprinted from \@conferencename, + \@proceedings, + \@conferenceinfo, + pp.~\number\thepage--\pageref{sigplanconf@finalpage}.\par + \fi}}% + \end@float} \long\def \toappear #1{% - \def \@toappear {#1}} + \def \@toappear {#1}} \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - \noindent Copyright \copyright\ \@copyrightyear\ ACM \@copyrightdata - \dots \@reprintprice\par} - -\newcommand{\reprintprice}[1]{% - \gdef \@reprintprice {#1}} -\reprintprice{\$10.00} + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + \noindent Copyright \copyright\ \@copyrightyear\ ACM \@copyrightdata + \dots \$5.00\par} \newcommand{\permission}[1]{% - \gdef \@permission {#1}} + \gdef \@permission {#1}} \permission{% - Permission to make digital or hard copies of all or - part of this work for personal or classroom use is granted without - fee provided that copies are not made or distributed for profit or - commercial advantage and that copies bear this notice and the full - citation on the first page. To copy otherwise, to republish, to - post on servers or to redistribute to lists, requires prior specific - permission and/or a fee.} + Permission to make digital or hard copies of all or + part of this work for personal or classroom use is granted without + fee provided that copies are not made or distributed for profit or + commercial advantage and that copies bear this notice and the full + citation on the first page. To copy otherwise, to republish, to + post on servers or to redistribute to lists, requires prior specific + permission and/or a fee.} % Here we have some alternate permission statements and copyright lines: \newcommand{\ACMCanadapermission}{% - \permission{% - Copyright \@copyrightyear\ Association for Computing Machinery. - ACM acknowledges that - this contribution was authored or co-authored by an affiliate of the - National Research Council of Canada (NRC). - As such, the Crown in Right of - Canada retains an equal interest in the copyright, however granting - nonexclusive, royalty-free right to publish or reproduce this article, - or to allow others to do so, provided that clear attribution - is also given to the authors and the NRC.}} + \permission{% + Copyright \@copyrightyear\ Association for Computing Machinery. + ACM acknowledges that + this contribution was authored or co-authored by an affiliate of the + National Research Council of Canada (NRC). + As such, the Crown in Right of + Canada retains an equal interest in the copyright, however granting + nonexclusive, royalty-free right to publish or reproduce this article, + or to allow others to do so, provided that clear attribution + is also given to the authors and the NRC.}} \newcommand{\ACMUSpermission}{% - \permission{% - Copyright \@copyrightyear\ Association for - Computing Machinery. ACM acknowledges that - this contribution was authored or co-authored - by a contractor or affiliate - of the U.S. Government. As such, the Government retains a nonexclusive, - royalty-free right to publish or reproduce this article, - or to allow others to do so, for Government purposes only.}} + \permission{% + Copyright \@copyrightyear\ Association for + Computing Machinery. ACM acknowledges that + this contribution was authored or co-authored + by a contractor or affiliate + of the U.S. Government. As such, the Government retains a nonexclusive, + royalty-free right to publish or reproduce this article, + or to allow others to do so, for Government purposes only.}} \newcommand{\authorpermission}{% - \permission{% - Copyright is held by the author/owner(s).} - \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - ACM \@copyrightdata.}} + \permission{% + Copyright is held by the author/owner(s).} + \toappear{% + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + ACM \@copyrightdata.}} \newcommand{\Sunpermission}{% - \permission{% - Copyright is held by Sun Microsystems, Inc.}% - \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - ACM \@copyrightdata.}} + \permission{% + Copyright is held by Sun Microsystems, Inc.}% + \toappear{% + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + ACM \@copyrightdata.}} \newcommand{\USpublicpermission}{% - \permission{% - This paper is authored by an employee(s) of the United States - Government and is in the public domain.}% - \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - ACM \@copyrightdata.}} - + \permission{% + This paper is authored by an employee(s) of the United States + Government and is in the public domain.}% + \toappear{% + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + ACM \@copyrightdata.}} + % Enunciations % ------------ \def \@begintheorem #1#2{% {name}{number} - \trivlist - \item[\hskip \labelsep \textsc{#1 #2.}]% - \itshape\selectfont - \ignorespaces} + \trivlist + \item[\hskip \labelsep \textsc{#1 #2.}]% + \itshape\selectfont + \ignorespaces} \def \@opargbegintheorem #1#2#3{% {name}{number}{title} - \trivlist - \item[% - \hskip\labelsep \textsc{#1\ #2}% - \if \@notp{\@emptyargp{#3}}\nut (#3).\fi]% - \itshape\selectfont - \ignorespaces} - + \trivlist + \item[% + \hskip\labelsep \textsc{#1\ #2}% + \if \@notp{\@emptyargp{#3}}\nut (#3).\fi]% + \itshape\selectfont + \ignorespaces} + % Figures % ------- @@ -676,24 +672,24 @@ \@setflag \@caprule = \@true \long\def \@makecaption #1#2{% - \addvspace{4pt} - \if \@caprule - \hrule width \hsize height .33pt - \vspace{4pt} - \fi - \setbox \@tempboxa = \hbox{\@setfigurenumber{#1.}\nut #2}% - \if \@dimgtrp{\wd\@tempboxa}{\hsize}% - \noindent \@setfigurenumber{#1.}\nut #2\par - \else - \centerline{\box\@tempboxa}% - \fi} + \addvspace{4pt} + \if \@caprule + \hrule width \hsize height .33pt + \vspace{4pt} + \fi + \setbox \@tempboxa = \hbox{\@setfigurenumber{#1.}\nut #2}% + \if \@dimgtrp{\wd\@tempboxa}{\hsize}% + \noindent \@setfigurenumber{#1.}\nut #2\par + \else + \centerline{\box\@tempboxa}% + \fi} \newcommand{\nocaptionrule}{% - \@setflag \@caprule = \@false} + \@setflag \@caprule = \@false} \def \@setfigurenumber #1{% - {\rmfamily \bfseries \selectfont #1}} - + {\rmfamily \bfseries \selectfont #1}} + % Hierarchy % --------- @@ -705,68 +701,68 @@ \newskip{\@sectionbelowskip} \if \@blockstyle - \setlength{\@sectionbelowskip}{0.1pt}% + \setlength{\@sectionbelowskip}{0.1pt}% \else - \setlength{\@sectionbelowskip}{4pt}% + \setlength{\@sectionbelowskip}{4pt}% \fi \renewcommand{\section}{% - \@startsection - {section}% - {1}% - {0pt}% - {-\@sectionaboveskip}% - {\@sectionbelowskip}% - {\large \bfseries \raggedright}} + \@startsection + {section}% + {1}% + {0pt}% + {-\@sectionaboveskip}% + {\@sectionbelowskip}% + {\large \bfseries \raggedright}} \newskip{\@subsectionaboveskip} \setvspace{\@subsectionaboveskip}{8pt plus 2pt minus 2pt} \newskip{\@subsectionbelowskip} \if \@blockstyle - \setlength{\@subsectionbelowskip}{0.1pt}% + \setlength{\@subsectionbelowskip}{0.1pt}% \else - \setlength{\@subsectionbelowskip}{4pt}% + \setlength{\@subsectionbelowskip}{4pt}% \fi \renewcommand{\subsection}{% - \@startsection% - {subsection}% - {2}% - {0pt}% - {-\@subsectionaboveskip}% - {\@subsectionbelowskip}% - {\normalsize \bfseries \raggedright}} + \@startsection% + {subsection}% + {2}% + {0pt}% + {-\@subsectionaboveskip}% + {\@subsectionbelowskip}% + {\normalsize \bfseries \raggedright}} \renewcommand{\subsubsection}{% - \@startsection% - {subsubsection}% - {3}% - {0pt}% - {-\@subsectionaboveskip} - {\@subsectionbelowskip}% - {\normalsize \bfseries \raggedright}} + \@startsection% + {subsubsection}% + {3}% + {0pt}% + {-\@subsectionaboveskip} + {\@subsectionbelowskip}% + {\normalsize \bfseries \raggedright}} \newskip{\@paragraphaboveskip} \setvspace{\@paragraphaboveskip}{6pt plus 2pt minus 2pt} \renewcommand{\paragraph}{% - \@startsection% - {paragraph}% - {4}% - {0pt}% - {\@paragraphaboveskip} - {-1em}% - {\normalsize \bfseries \if \@times \itshape \fi}} + \@startsection% + {paragraph}% + {4}% + {0pt}% + {\@paragraphaboveskip} + {-1em}% + {\normalsize \bfseries \if \@times \itshape \fi}} \renewcommand{\subparagraph}{% - \@startsection% - {subparagraph}% - {4}% - {0pt}% - {\@paragraphaboveskip} - {-1em}% - {\normalsize \itshape}} + \@startsection% + {subparagraph}% + {4}% + {0pt}% + {\@paragraphaboveskip} + {-1em}% + {\normalsize \itshape}} % Standard headings: @@ -775,7 +771,7 @@ \newcommand{\keywords}{\paragraph*{Keywords}} \newcommand{\terms}{\paragraph*{General Terms}} - + % Identification % -------------- @@ -788,22 +784,22 @@ \newcommand{\conferenceinfo}[2]{% - \gdef \@conferencename {#1}% - \gdef \@conferenceinfo {#2}} + \gdef \@conferencename {#1}% + \gdef \@conferenceinfo {#2}} \newcommand{\copyrightyear}[1]{% - \gdef \@copyrightyear {#1}} + \gdef \@copyrightyear {#1}} \let \CopyrightYear = \copyrightyear \newcommand{\copyrightdata}[1]{% - \gdef \@copyrightdata {#1}} + \gdef \@copyrightdata {#1}} \let \crdata = \copyrightdata \newcommand{\proceedings}[1]{% - \gdef \@proceedings {#1}} - + \gdef \@proceedings {#1}} + % Lists % ----- @@ -816,11 +812,11 @@ \setlength{\topsep}{\standardvspace} \if \@blockstyle - \setlength{\itemsep}{1pt} - \setlength{\parsep}{3pt} + \setlength{\itemsep}{1pt} + \setlength{\parsep}{3pt} \else - \setlength{\itemsep}{1pt} - \setlength{\parsep}{3pt} + \setlength{\itemsep}{1pt} + \setlength{\parsep}{3pt} \fi \renewcommand{\labelitemi}{{\small \centeroncapheight{\textbullet}}} @@ -829,8 +825,8 @@ \renewcommand{\labelitemiv}{{\Large \textperiodcentered}} \renewcommand{\@listi}{% - \leftmargin = \leftmargini - \listparindent = 0pt} + \leftmargin = \leftmargini + \listparindent = 0pt} %%% \itemsep = 1pt %%% \parsep = 3pt} %%% \listparindent = \parindent} @@ -838,54 +834,54 @@ \let \@listI = \@listi \renewcommand{\@listii}{% - \leftmargin = \leftmarginii - \topsep = 1pt - \labelwidth = \leftmarginii - \advance \labelwidth by -\labelsep - \listparindent = \parindent} + \leftmargin = \leftmarginii + \topsep = 1pt + \labelwidth = \leftmarginii + \advance \labelwidth by -\labelsep + \listparindent = \parindent} \renewcommand{\@listiii}{% - \leftmargin = \leftmarginiii - \labelwidth = \leftmarginiii - \advance \labelwidth by -\labelsep - \listparindent = \parindent} + \leftmargin = \leftmarginiii + \labelwidth = \leftmarginiii + \advance \labelwidth by -\labelsep + \listparindent = \parindent} \renewcommand{\@listiv}{% - \leftmargin = \leftmarginiv - \labelwidth = \leftmarginiv - \advance \labelwidth by -\labelsep - \listparindent = \parindent} - + \leftmargin = \leftmarginiv + \labelwidth = \leftmarginiv + \advance \labelwidth by -\labelsep + \listparindent = \parindent} + % Mathematics % ----------- \def \theequation {\arabic{equation}} - + % Miscellaneous % ------------- \newcommand{\balancecolumns}{% - \vfill\eject - \global\@colht = \textheight - \global\ht\@cclv = \textheight} + \vfill\eject + \global\@colht = \textheight + \global\ht\@cclv = \textheight} \newcommand{\nut}{\hspace{.5em}} \newcommand{\softraggedright}{% - \let \\ = \@centercr - \leftskip = 0pt - \rightskip = 0pt plus 10pt} - + \let \\ = \@centercr + \leftskip = 0pt + \rightskip = 0pt plus 10pt} + % Program Code % ------- ---- \newcommand{\mono}[1]{% - {\@tempdima = \fontdimen2\font - \texttt{\spaceskip = 1.1\@tempdima #1}}} - + {\@tempdima = \fontdimen2\font + \texttt{\spaceskip = 1.1\@tempdima #1}}} + % Running Heads and Feet % ------- ----- --- ---- @@ -893,26 +889,26 @@ \def \@preprintfooter {} \newcommand{\preprintfooter}[1]{% - \gdef \@preprintfooter {#1}} + \gdef \@preprintfooter {#1}} \if \@preprint \def \ps@plain {% - \let \@mkboth = \@gobbletwo - \let \@evenhead = \@empty - \def \@evenfoot {\scriptsize \textit{\@preprintfooter}\hfil \thepage \hfil - \textit{\@formatyear}}% - \let \@oddhead = \@empty - \let \@oddfoot = \@evenfoot} + \let \@mkboth = \@gobbletwo + \let \@evenhead = \@empty + \def \@evenfoot {\scriptsize \textit{\@preprintfooter}\hfil \thepage \hfil + \textit{\@formatyear}}% + \let \@oddhead = \@empty + \let \@oddfoot = \@evenfoot} \else\if \@reprint \def \ps@plain {% - \let \@mkboth = \@gobbletwo - \let \@evenhead = \@empty - \def \@evenfoot {\scriptsize \hfil \thepage \hfil}% - \let \@oddhead = \@empty - \let \@oddfoot = \@evenfoot} + \let \@mkboth = \@gobbletwo + \let \@evenhead = \@empty + \def \@evenfoot {\scriptsize \hfil \thepage \hfil}% + \let \@oddhead = \@empty + \let \@oddfoot = \@evenfoot} \else @@ -923,15 +919,15 @@ \fi\fi \def \@formatyear {% - \number\year/\number\month/\number\day} - + \number\year/\number\month/\number\day} + % Special Characters % ------- ---------- \DeclareRobustCommand{\euro}{% - \protect{\rlap{=}}{\sf \kern .1em C}} - + \protect{\rlap{=}}{\sf \kern .1em C}} + % Title Page % ----- ---- @@ -949,207 +945,202 @@ \def \@titlebanner {} \renewcommand{\title}[1]{% - \gdef \@titletext {#1}} + \gdef \@titletext {#1}} \newcommand{\subtitle}[1]{% - \gdef \@subtitletext {#1}} + \gdef \@subtitletext {#1}} \newcommand{\authorinfo}[3]{% {names}{affiliation}{email/URL} - \global\@increment \@authorcount - \@withname\gdef {\@authorname\romannumeral\@authorcount}{#1}% - \@withname\gdef {\@authoraffil\romannumeral\@authorcount}{#2}% - \@withname\gdef {\@authoremail\romannumeral\@authorcount}{#3}} + \global\@increment \@authorcount + \@withname\gdef {\@authorname\romannumeral\@authorcount}{#1}% + \@withname\gdef {\@authoraffil\romannumeral\@authorcount}{#2}% + \@withname\gdef {\@authoremail\romannumeral\@authorcount}{#3}} \renewcommand{\author}[1]{% - \@latex@error{The \string\author\space command is obsolete; - use \string\authorinfo}{}} + \@latex@error{The \string\author\space command is obsolete; + use \string\authorinfo}{}} \newcommand{\titlebanner}[1]{% - \gdef \@titlebanner {#1}} + \gdef \@titlebanner {#1}} \renewcommand{\maketitle}{% - \pagestyle{plain}% - \if \@onecolumn - {\hsize = \standardtextwidth - \@maketitle}% - \else - \twocolumn[\@maketitle]% - \fi - \@placetitlenotes - \if \@copyrightwanted \@copyrightspace \fi} + \pagestyle{plain}% + \if \@onecolumn + {\hsize = \standardtextwidth + \@maketitle}% + \else + \twocolumn[\@maketitle]% + \fi + \@placetitlenotes + \if \@copyrightwanted \@copyrightspace \fi} \def \@maketitle {% - \begin{center} - \@settitlebanner - \let \thanks = \titlenote - {\leftskip = 0pt plus 0.25\linewidth - \rightskip = 0pt plus 0.25 \linewidth - \parfillskip = 0pt - \spaceskip = .7em - \noindent \LARGE \bfseries \@titletext \par} - \vskip 6pt - \noindent \Large \@subtitletext \par - \vskip 12pt - \ifcase \@authorcount - \@latex@error{No authors were specified for this paper}{}\or - \@titleauthors{i}{}{}\or - \@titleauthors{i}{ii}{}\or - \@titleauthors{i}{ii}{iii}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{xii}% - \else - \@latex@error{Cannot handle more than 12 authors}{}% - \fi - \vspace{1.75pc} - \end{center}} + \begin{center} + \@settitlebanner + \let \thanks = \titlenote + \noindent \LARGE \bfseries \@titletext \par + \vskip 6pt + \noindent \Large \@subtitletext \par + \vskip 12pt + \ifcase \@authorcount + \@latex@error{No authors were specified for this paper}{}\or + \@titleauthors{i}{}{}\or + \@titleauthors{i}{ii}{}\or + \@titleauthors{i}{ii}{iii}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{xii}% + \else + \@latex@error{Cannot handle more than 12 authors}{}% + \fi + \vspace{1.75pc} + \end{center}} \def \@settitlebanner {% - \if \@andp{\@preprint}{\@notp{\@emptydefp{\@titlebanner}}}% - \vbox to 0pt{% - \vskip -32pt - \noindent \textbf{\@titlebanner}\par - \vss}% - \nointerlineskip - \fi} + \if \@andp{\@preprint}{\@notp{\@emptydefp{\@titlebanner}}}% + \vbox to 0pt{% + \vskip -32pt + \noindent \textbf{\@titlebanner}\par + \vss}% + \nointerlineskip + \fi} \def \@titleauthors #1#2#3{% - \if \@andp{\@emptyargp{#2}}{\@emptyargp{#3}}% - \noindent \@setauthor{40pc}{#1}{\@false}\par - \else\if \@emptyargp{#3}% - \noindent \@setauthor{17pc}{#1}{\@false}\hspace{3pc}% - \@setauthor{17pc}{#2}{\@false}\par - \else - \noindent \@setauthor{12.5pc}{#1}{\@false}\hspace{2pc}% - \@setauthor{12.5pc}{#2}{\@false}\hspace{2pc}% - \@setauthor{12.5pc}{#3}{\@true}\par - \relax - \fi\fi - \vspace{20pt}} + \if \@andp{\@emptyargp{#2}}{\@emptyargp{#3}}% + \noindent \@setauthor{40pc}{#1}{\@false}\par + \else\if \@emptyargp{#3}% + \noindent \@setauthor{17pc}{#1}{\@false}\hspace{3pc}% + \@setauthor{17pc}{#2}{\@false}\par + \else + \noindent \@setauthor{12.5pc}{#1}{\@false}\hspace{2pc}% + \@setauthor{12.5pc}{#2}{\@false}\hspace{2pc}% + \@setauthor{12.5pc}{#3}{\@true}\par + \relax + \fi\fi + \vspace{20pt}} \def \@setauthor #1#2#3{% {width}{text}{unused} - \vtop{% - \def \and {% - \hspace{16pt}} - \hsize = #1 - \normalfont - \centering - \large \@name{\@authorname#2}\par - \vspace{5pt} - \normalsize \@name{\@authoraffil#2}\par - \vspace{2pt} - \textsf{\@name{\@authoremail#2}}\par}} + \vtop{% + \def \and {% + \hspace{16pt}} + \hsize = #1 + \normalfont + \centering + \large \@name{\@authorname#2}\par + \vspace{5pt} + \normalsize \@name{\@authoraffil#2}\par + \vspace{2pt} + \textsf{\@name{\@authoremail#2}}\par}} \def \@maybetitlenote #1{% - \if \@andp{#1}{\@gtrp{\@authorcount}{3}}% - \titlenote{See page~\pageref{@addauthors} for additional authors.}% - \fi} + \if \@andp{#1}{\@gtrp{\@authorcount}{3}}% + \titlenote{See page~\pageref{@addauthors} for additional authors.}% + \fi} \newtoks{\@fnmark} \newcommand{\titlenote}[1]{% - \global\@increment \@titlenotecount - \ifcase \@titlenotecount \relax \or - \@fnmark = {\ast}\or - \@fnmark = {\dagger}\or - \@fnmark = {\ddagger}\or - \@fnmark = {\S}\or - \@fnmark = {\P}\or - \@fnmark = {\ast\ast}% - \fi - \,$^{\the\@fnmark}$% - \edef \reserved@a {\noexpand\@appendtotext{% - \noexpand\@titlefootnote{\the\@fnmark}}}% - \reserved@a{#1}} + \global\@increment \@titlenotecount + \ifcase \@titlenotecount \relax \or + \@fnmark = {\ast}\or + \@fnmark = {\dagger}\or + \@fnmark = {\ddagger}\or + \@fnmark = {\S}\or + \@fnmark = {\P}\or + \@fnmark = {\ast\ast}% + \fi +% \,$^{\the\@fnmark}$% + \edef \reserved@a {\noexpand\@appendtotext{% + \noexpand\@titlefootnote{\the\@fnmark}}}% + \reserved@a{#1}} \def \@appendtotext #1#2{% - \global\@titlenotetext = \expandafter{\the\@titlenotetext #1{#2}}} + \global\@titlenotetext = \expandafter{\the\@titlenotetext #1{#2}}} \newcount{\@authori} \iffalse \def \additionalauthors {% - \if \@gtrp{\@authorcount}{3}% - \section{Additional Authors}% - \label{@addauthors}% - \noindent - \@authori = 4 - {\let \\ = ,% - \loop - \textbf{\@name{\@authorname\romannumeral\@authori}}, - \@name{\@authoraffil\romannumeral\@authori}, - email: \@name{\@authoremail\romannumeral\@authori}.% - \@increment \@authori - \if \@notp{\@gtrp{\@authori}{\@authorcount}} \repeat}% - \par - \fi - \global\@setflag \@addauthorsdone = \@true} + \if \@gtrp{\@authorcount}{3}% + \section{Additional Authors}% + \label{@addauthors}% + \noindent + \@authori = 4 + {\let \\ = ,% + \loop + \textbf{\@name{\@authorname\romannumeral\@authori}}, + \@name{\@authoraffil\romannumeral\@authori}, + email: \@name{\@authoremail\romannumeral\@authori}.% + \@increment \@authori + \if \@notp{\@gtrp{\@authori}{\@authorcount}} \repeat}% + \par + \fi + \global\@setflag \@addauthorsdone = \@true} \fi \let \addauthorsection = \additionalauthors \def \@placetitlenotes { - \the\@titlenotetext} - + \the\@titlenotetext} + % Utilities % --------- \newcommand{\centeroncapheight}[1]{% - {\setbox\@tempboxa = \hbox{#1}% - \@measurecapheight{\@tempdima}% % Calculate ht(CAP) - ht(text) - \advance \@tempdima by -\ht\@tempboxa % ------------------ - \divide \@tempdima by 2 % 2 - \raise \@tempdima \box\@tempboxa}} + {\setbox\@tempboxa = \hbox{#1}% + \@measurecapheight{\@tempdima}% % Calculate ht(CAP) - ht(text) + \advance \@tempdima by -\ht\@tempboxa % ------------------ + \divide \@tempdima by 2 % 2 + \raise \@tempdima \box\@tempboxa}} \newbox{\@measbox} \def \@measurecapheight #1{% {\dimen} - \setbox\@measbox = \hbox{ABCDEFGHIJKLMNOPQRSTUVWXYZ}% - #1 = \ht\@measbox} + \setbox\@measbox = \hbox{ABCDEFGHIJKLMNOPQRSTUVWXYZ}% + #1 = \ht\@measbox} \long\def \@titlefootnote #1#2{% - \insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore + \insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore %%% \protected@edef\@currentlabel{% %%% \csname p@footnote\endcsname\@thefnmark}% - \color@begingroup - \def \@makefnmark {$^{#1}$}% - \@makefntext{% - \rule\z@\footnotesep\ignorespaces#2\@finalstrut\strutbox}% - \color@endgroup}} - + \color@begingroup + \def \@makefnmark {$^{#1}$}% + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#2\@finalstrut\strutbox}% + \color@endgroup}} + % LaTeX Modifications % ----- ------------- \def \@seccntformat #1{% - \@name{\the#1}% - \@expandaftertwice\@seccntformata \csname the#1\endcsname.\@mark - \quad} + \@name{\the#1}% + \@expandaftertwice\@seccntformata \csname the#1\endcsname.\@mark + \quad} \def \@seccntformata #1.#2\@mark{% - \if \@emptyargp{#2}.\fi} - + \if \@emptyargp{#2}.\fi} + % Revision History % -------- ------- -% SNC = Stephen Chong (chong@seas.harvard.edu) % Date Person Ver. Change % ---- ------ ---- ------ @@ -1205,18 +1196,9 @@ % 2006.08.24 PCA 1.4 Fix bug in \maketitle case command. -% 2007.03.13 PCA 1.5 The title banner only displays with the +% 2007.03.13 PCA 1.5 The title banner only display with the % 'preprint' option. % 2007.06.06 PCA 1.6 Use \bibfont in \thebibliography. % Add 'natbib' option to load and configure % the natbib package. - -% 2007.11.20 PCA 1.7 Balance line lengths in centered article -% title (thanks to Norman Ramsey). - -% 2009.01.26 PCA 1.8 Change natbib \bibpunct values. - -% 2009.04.29 SNC 1.9 Added \reprintprice to allow the -% specification of the price of a reprint, and -% set it to default to \$10.00 diff --git a/collects/scribble/srcdoc.rkt b/collects/scribble/srcdoc.rkt index 454e85d5..e09ff9d6 100644 --- a/collects/scribble/srcdoc.rkt +++ b/collects/scribble/srcdoc.rkt @@ -53,12 +53,21 @@ p/c ... (void (quote-syntax (provide/doc (for-docs id) ...)))))))])) +(define-for-syntax (remove->i-deps stx) + (syntax-case stx () + [(id (id2 ...) ctc) + #'(id ctc)] + [(id ctc) + #'(id ctc)] + [else + (error 'remove->i-deps "unknown thing ~s" stx)])) + (define-provide/doc-transformer proc-doc (lambda (stx) (syntax-case stx () [(_ id contract desc) (with-syntax ([(header result (body-stuff ...)) - (syntax-case #'contract (->d -> values) + (syntax-case #'contract (->d ->i -> values) [(->d (req ...) () (values [name res] ...)) #'((id req ...) (values res ...) ())] [(->d (req ...) () #:pre-cond condition (values [name res] ...)) @@ -82,6 +91,42 @@ (format "unsupported ->d contract form for ~a" (syntax->datum #'id)) stx #'contract)] + + [(->i (req ...) () (values ress ...)) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [([name res] ...) (map remove->i-deps (syntax->list #'(req ...)))]) + #'((id req ...) (values res ...) ()))] + [(->i (req ...) () #:pre (pre-id ...) condition (values ress ...)) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [([name res] ...) (map remove->i-deps (syntax->list #'(req ...)))]) + #'((id req ...) (values res ...) ((bold "Pre-condition: ") (scheme condition) "\n" "\n")))] + [(->i (req ...) () res) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [[name res] (remove->i-deps #'res)]) + #'((id req ...) res ()))] + [(->i (req ...) () #:pre (pre-id ...) condition [name res]) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [[name res] (remove->i-deps #'res)]) + #'((id req ...) res ((bold "Pre-condition: ") (scheme condition) "\n" "\n" )))] + [(->i (req ...) () #:rest rest res) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [[name res] (remove->i-deps #'res)] + [[name-t rest-ctc] (remove->i-deps #'rest)]) + #'((id req ... [name-t rest-ctc] (... ...)) res ()))] + [(->i (req ...) (one more ...) whatever) + (raise-syntax-error + #f + (format "unsupported ->i contract form for ~a, optional arguments non-empty, must use proc-doc/names" + (syntax->datum #'id)) + stx + #'contract)] + [(->i whatever ...) + (raise-syntax-error + #f + (format "unsupported ->i contract form for ~a" (syntax->datum #'id)) + stx + #'contract)] + [(-> result) #'((id) result ())] [(-> whatever ...) diff --git a/collects/scribble/text.rkt b/collects/scribble/text.rkt index 90c106d5..36f57156 100644 --- a/collects/scribble/text.rkt +++ b/collects/scribble/text.rkt @@ -1,5 +1,4 @@ #lang racket/base -(require racket/promise "text/output.ss" "text/syntax-utils.ss") -(provide (all-from-out racket/promise "text/output.ss") - begin/text include/text) +(require "text/main.rkt") +(provide (all-from-out "text/main.rkt")) diff --git a/collects/scribble/text/lang.rkt b/collects/scribble/text/lang.rkt new file mode 100644 index 00000000..3df5a5a9 --- /dev/null +++ b/collects/scribble/text/lang.rkt @@ -0,0 +1,9 @@ +#lang racket/base + +(require "syntax-utils.ss" "output.ss" + racket/promise racket/list racket/string) + +(provide (except-out (all-from-out racket/base) #%module-begin) + (all-from-out "output.ss" racket/promise racket/list racket/string) + (rename-out [module-begin/text #%module-begin] + [begin/text text] [include/text include])) diff --git a/collects/scribble/text/lang/reader.rkt b/collects/scribble/text/lang/reader.rkt index d9660753..19581ab1 100644 --- a/collects/scribble/text/lang/reader.rkt +++ b/collects/scribble/text/lang/reader.rkt @@ -1,12 +1,11 @@ #lang s-exp syntax/module-reader -scribble/text/textlang +scribble/text/lang #:read scribble:read-inside #:read-syntax scribble:read-syntax-inside #:whole-body-readers? #t #:info (scribble-base-reader-info) -(require (prefix-in scribble: "../../reader.ss") - (only-in scribble/base/reader - scribble-base-reader-info)) +(require (prefix-in scribble: scribble/reader) + (only-in scribble/base/reader scribble-base-reader-info)) diff --git a/collects/scribble/text/main.rkt b/collects/scribble/text/main.rkt new file mode 100644 index 00000000..5cc7ae6a --- /dev/null +++ b/collects/scribble/text/main.rkt @@ -0,0 +1,7 @@ +#lang racket/base + +(require "output.ss" "syntax-utils.ss" + racket/promise racket/list racket/string) + +(provide (all-from-out "output.ss" racket/promise racket/list racket/string) + begin/text include/text) diff --git a/collects/scribble/text/syntax-utils.rkt b/collects/scribble/text/syntax-utils.rkt index 5ec450eb..fea2a061 100644 --- a/collects/scribble/text/syntax-utils.rkt +++ b/collects/scribble/text/syntax-utils.rkt @@ -2,8 +2,8 @@ (require "output.ss" (for-syntax scheme/base syntax/kerncase)) -(provide module-begin/text begin/text include/text - begin/collect) +(provide module-begin/text begin/text include/text begin/collect + process-begin/text) (begin-for-syntax (define definition-ids ; ids that don't require forcing diff --git a/collects/scribble/text/textlang.rkt b/collects/scribble/text/textlang.rkt deleted file mode 100644 index 0708781f..00000000 --- a/collects/scribble/text/textlang.rkt +++ /dev/null @@ -1,9 +0,0 @@ -#lang racket/base - -(require "syntax-utils.ss" "output.ss" racket/promise) - -(provide (except-out (all-from-out racket/base) #%module-begin) - (all-from-out "output.ss" racket/promise) - begin/text - (rename-out [module-begin/text #%module-begin] - [include/text include])) diff --git a/collects/scribblings/scribble/base.scrbl b/collects/scribblings/scribble/base.scrbl index 2bd94469..59586d52 100644 --- a/collects/scribblings/scribble/base.scrbl +++ b/collects/scribblings/scribble/base.scrbl @@ -233,12 +233,13 @@ beginning of each line. The @racket[str]s are @emph{not} decoded with @racket[decode-content], so @racket[(verbatim "---")] renders with three hyphens instead of an -em-dash. Beware, however, that @litchar["@"] for a @racket[verbatim] -call performs some processing before delivering arguments to -@racket[verbatim]. The @racket[verbatim] form is typically used with -@litchar["|{"]...@litchar["}|"] or similar brackets to disable -@litchar["@"] notation within the @racket[verbatim] argument, like -this: +em-dash. Beware, however, that @emph{reading} +@litchar["@"]@racket[verbatim] converts @litchar["@"] syntax +within the argument, and such reading occurs well before +arguments to @racket[verbatim] are delivered at run-time. To disable simple +@litchar["@"] notation within the @racket[verbatim] argument, +@racket[verbatim] is typically used with +@litchar["|{"]...@litchar["}|"] or similar brackets, like this: @verbatim[#:indent 2]|{ @verbatim|{ @@ -253,8 +254,8 @@ which renders as }| Even with @litchar["|{"]...@litchar["}|"], beware that consistent -leading whitespace is removed; see @secref["alt-body-syntax"] for more -information. +leading whitespace is removed by the parser; see +@secref["alt-body-syntax"] for more information. See also @racket[literal].} @@ -333,14 +334,18 @@ See also @racket[verbatim].} @exec{setup-plt} and @exec{scribble} to the directory of the main document file. The @racket[path] argument also can be a result of @racket[path->main-collects-relative]. - + The strings in @racket[suffixes] are filtered to those supported by given renderer, and then the acceptable suffixes are tried in order. The HTML renderer supports @racket[".png"] and @racket[".gif"], while the Latex renderer supports @racket[".png"], @racket[".pdf"], and @racket[".ps"] (but @racket[".ps"] works only when converting Latex output to DVI, and @racket[".png"] and - @racket[".pdf"] work only for converting Latex output to PDF).} + @racket[".pdf"] work only for converting Latex output to PDF). + + Note that when the @racket[suffixes] library is non-empty, then + the @racket[path] argument should not have a suffix. + } @; ------------------------------------------------------------------------ diff --git a/collects/scribblings/scribble/bnf.scrbl b/collects/scribblings/scribble/bnf.scrbl index 46509979..84aa60d8 100644 --- a/collects/scribblings/scribble/bnf.scrbl +++ b/collects/scribblings/scribble/bnf.scrbl @@ -1,6 +1,7 @@ #lang scribble/doc @(require scribble/manual "utils.ss" + scribble/bnf (for-label scribble/bnf)) @title[#:tag "bnf"]{BNF Grammars} @@ -8,6 +9,40 @@ @defmodule[scribble/bnf]{The @racket[scribble/bnf] library provides utilities for typesetting grammars.} +For example, + +@verbatim[#:indent 2]|{ +@(let ([open @litchar{(}] + [close @litchar{)}]) + @BNF[(list @nonterm{expr} + @nonterm{id} + @BNF-seq[open @kleeneplus[@nonterm{expr}] close] + @BNF-seq[open @litchar{lambda} + open @kleenestar[@nonterm{id}] close + @nonterm{expr} close] + @nonterm{val}) + (list @nonterm{val} + @BNF-alt[@nonterm{number} @nonterm{primop}]) + (list @nonterm{id} + @elem{any name except for @litchar{lambda}})]) +}| + +produces the output + +@(let ([open @litchar{(}] + [close @litchar{)}]) + @BNF[(list @nonterm{expr} + @nonterm{id} + @BNF-seq[open @kleeneplus[@nonterm{expr}] close] + @BNF-seq[open @litchar{lambda} + open @kleenestar[@nonterm{id}] close + @nonterm{expr} close] + @nonterm{val}) + (list @nonterm{val} + @BNF-alt[@nonterm{number} @nonterm{primop}]) + (list @nonterm{id} + @elem{any name except for @litchar{lambda}})]) + See also @racket[racketgrammar]. @defproc[(BNF [prod (cons element? (listof element?))] ...) table?]{ diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl index bf9b3aec..a64b56de 100644 --- a/collects/scribblings/scribble/core.scrbl +++ b/collects/scribblings/scribble/core.scrbl @@ -943,8 +943,9 @@ otherwise.} Returns @racket[#t] if @racket[v] is a string, symbol, @racket[element], @racket[multiarg-element], @racket[traverse-element], @racket[delayed-element], -@racket[part-relative-element], or list of @tech{content}, @racket[#f] -otherwise.} +@racket[part-relative-element], a convertible value in +the sense of @racket[convertible?], or list of @tech{content}. +Otherwise, it returns @racket[#f].} @defstruct[style ([name (or/c string? symbol? #f)] diff --git a/collects/scribblings/scribble/eval.scrbl b/collects/scribblings/scribble/eval.scrbl index 4c50f071..0bc1aca0 100644 --- a/collects/scribblings/scribble/eval.scrbl +++ b/collects/scribblings/scribble/eval.scrbl @@ -25,12 +25,24 @@ set to @racket['string]. If @racket[eval] is not provided, an evaluator is created using @racket[make-base-eval]. See also @racket[make-eval-factory]. +If the value of @racket[current-print] in the sandbox is changed from +its default value, or if @racket[print-as-expression] in the sandbox +is set to @racket[#f], then each evaluation result is formatted to a +string by applying @racket[(current-print)] to the value (with the +output port set to a string port). Otherwise, result values are +typeset using @racket[to-element/no-color]. + Uses of @racket[code:comment] and @racketidfont{code:blank} are stipped from each @racket[datum] before evaluation. If a @racket[datum] has the form @racket[(@#,indexed-racket[eval:alts] #,(svar show-datum) #,(svar eval-datum))], then @svar[show-datum] is -typeset, while @svar[eval-datum] is evaluated.} +typeset, while @svar[eval-datum] is evaluated. + +If a @racket[datum] has the form +@racket[(@#,indexed-racket[eval:check] #,(svar eval-datum) #,(svar +expect-datum))], then both @svar[eval-datum] and @svar[check-datum] +are evaluated, and an error is raised if they are not @racket[equal?].} @defform*[[(interaction-eval datum) @@ -90,8 +102,8 @@ prompt, and with line of space after it.} @defproc[(make-base-eval) (any/c . -> . any)]{ Creates an evaluator using @racket[(make-evaluator 'racket/base)], -setting sandbox parameters to disable limits, set the outputs to -@racket['string], and not add extra security guards.} +setting sandbox parameters to disable limits, setting the outputs to +@racket['string], and not adding extra security guards.} @defproc[(make-base-eval-factory [mod-paths (listof module-path?)]) (-> (any/c . -> . any))]{ @@ -105,7 +117,7 @@ time) and then attached to each evaluator that is created.} @defproc[(make-eval-factory [mod-paths (listof module-path?)]) (-> (any/c . -> . any))]{ -Like @racket[make-base-eval-factor], but each module in @racket[mod-paths] is +Like @racket[make-base-eval-factory], but each module in @racket[mod-paths] is also required into the top-level environment for each generated evaluator.} diff --git a/collects/scribblings/scribble/how-to-paper.scrbl b/collects/scribblings/scribble/how-to-paper.scrbl index 3ee33d45..3bd44e62 100644 --- a/collects/scribblings/scribble/how-to-paper.scrbl +++ b/collects/scribblings/scribble/how-to-paper.scrbl @@ -2,9 +2,15 @@ @(require scribble/manual scribble/bnf "utils.ss" - (for-label scriblib/figure)) + (for-label scriblib/figure + scribble/base + scribble/sigplan)) -@(define (sample . text) (nested #:style 'inset (apply verbatim text))) +@(define-syntax-rule (samplemod . text) (codeblock . text)) +@(define-syntax-rule (sample a . text) (codeblock #:context #'a + #:keep-lang-line? #f + "#lang scribble/base" "\n" + a . text)) @(define (result . text) (apply nested #:style 'inset text)) @title[#:tag "getting-started"]{Getting Started} @@ -18,7 +24,7 @@ goal-specific advice on how to continue. Create a file @filepath{mouse.scrbl} with this content: - @sample|{ + @samplemod|{ #lang scribble/base @title{On the Cookie-Eating Habits of Mice} @@ -65,7 +71,7 @@ for the kind of document that you want as output: Add more text to @filepath{mouse.scrbl} so that it looks like this: - @sample|{ + @samplemod|{ #lang scribble/base @title{On the Cookie-Eating Habits of Mice} @@ -111,7 +117,7 @@ larger document. To split the example document into multiple files, change @filepath{mouse.scrbl} to just - @sample|{ + @samplemod|{ #lang scribble/base @title{On the Cookie-Eating Habits of Mice} @@ -126,7 +132,7 @@ To split the example document into multiple files, change Create @filepath{milk.scrbl} and @filepath{straw.scrbl} in the same directory as @filepath{mouse.scrbl}. In @filepath{milk.scrbl}, put - @sample|{ + @samplemod|{ #lang scribble/base @title{The Consequences of Milk} @@ -136,7 +142,7 @@ directory as @filepath{mouse.scrbl}. In @filepath{milk.scrbl}, put and in @filepath{straw.scbl}, put - @sample|{ + @samplemod|{ #lang scribble/base @title{Not the Last Straw} @@ -167,14 +173,14 @@ the paper to a workshop on programming languages, then---well, you probably need a different topic. But you can start making the current content look right by changing the first line to - @sample|{ + @samplemod|{ #lang scribble/sigplan }| If you're instead working toward Racket library documentation, try changing the first line to - @sample|{ + @samplemod|{ #lang scribble/manual }| @@ -191,7 +197,7 @@ version number---but it changes the set of bindings available in the document body. For example, with @racketmodname[scribble/sigplan], the introductory text can be marked as an abstract: - @sample|{ + @samplemod|{ #lang scribble/sigplan @title{On the Cookie-Eating Habits of Mice} @@ -467,7 +473,7 @@ For example the text-mode stream @section[#:tag "poetry"]{Of Mice and Cookies} See @secref["milk"]. - @section[#:tag "milk"]{@italic{Important} Stuff About Milk} + @section[#:tag "milk"]{@italic{Important} Milk Supplies} @figure["straw" @elem{A straw}]{@image["straw.png"]} }| @@ -573,9 +579,9 @@ renders as because the source is equivalent to - @sample|{ + @racketblock[ (verbatim (number->string (+ 1 2))) - }| + ] where @racket[(number->string (+ 1 2))] is evaluated to produce the argument to @racket[verbatim]. The @litchar["|{"]...@litchar["}|"] diff --git a/collects/scribblings/scribble/how-to.scrbl b/collects/scribblings/scribble/how-to.scrbl index de61a924..2ef05321 100644 --- a/collects/scribblings/scribble/how-to.scrbl +++ b/collects/scribblings/scribble/how-to.scrbl @@ -379,6 +379,3 @@ include introductory text before the call of important and when when local table of contents is short, putting the introductory text after the call of @racket[local-table-of-contents] may be appropriate. - -@;---------------------------------------- -@include-section["style.scrbl"] diff --git a/collects/scribblings/scribble/manual.scrbl b/collects/scribblings/scribble/manual.scrbl index 88d5db44..d137e325 100644 --- a/collects/scribblings/scribble/manual.scrbl +++ b/collects/scribblings/scribble/manual.scrbl @@ -30,6 +30,60 @@ includes a @racket[latex-defaults] @tech{style property}. @; ------------------------------------------------------------------------ @section[#:tag "scribble:manual:code"]{Typesetting Code} +@defform/subs[(codeblock option ... str-expr ...+) + ([option (code:line #:indent indent-expr) + (code:line #:expand expand-expr) + (code:line #:context context-expr) + (code:line #:keep-lang-line? keep-expr)]) + #:contracts ([indent-expr exact-nonnegative-integer?] + [expand-expr (or/c #f (syntax-object? . -> . syntax-object?))] + [context-expr syntax-object?] + [keep-expr any/c])]{ + +Parses the code formed by the strings produced by the +@racket[str-expr]s as a Racket module and produces a @tech{block} that +typesets the code. The code is indented by the amount specified by +@racket[indent-expr], which defaults to @racket[2]. + +When @racket[expand-expr] produces @racket[#f] (which is the default), +identifiers in the typeset code are colored and linked based on +for-label bindings in the lexical environment of the syntax object +provided by @racket[context-expr]. The default @racket[context-expr] +has the same lexical context as the first @racket[str-expr]. + +When @racket[expand-expr] produces a procedure, it is used to +macro-expand the parsed program, and syntax coloring is based on the +parsed program. + +When @racket[keep-lang-line?-expr] produces a true value (the +default), the @hash-lang[] line in the input is preserved in the +typeset output, otherwise the first line is dropped. + +For example, + +@codeblock[#:keep-lang-line? #f]|<|{ + #lang scribble/manual + @codeblock|{ + #lang scribble/manual + @codeblock{ + #lang scribble/manual + @title{Hello} + } + }| +}|>| + +produces the typeset result + + @codeblock|{ + #lang scribble/manual + @codeblock{ + #lang scribble/manual + @title{Hello} + } + }| + +} + @defform[(racketblock datum ...)]{ Typesets the @racket[datum] sequence as a table of Racket code inset @@ -1022,16 +1076,19 @@ If @racket[style?] is true, then @racket[defterm] is used on @racket[pre-content].} @defproc[(tech [pre-content pre-content?] ... - [#:doc module-path (or/c module-path? false/c) #f] - [#:tag-prefixes prefixes (or/c (listof string?) false/c) #f]) + [#:key key (or/c string? #f) #f] + [#:doc module-path (or/c module-path? #f) #f] + [#:tag-prefixes prefixes (or/c (listof string?) #f) #f]) element?]{ Produces an element for the @tech{decode}d @racket[pre-content], and -hyperlinks it to the definition of the content as established by -@racket[deftech]. The content's string form is normalized in the same -way as for @racket[deftech]. The @racket[#:doc] and -@racket[#:tag-prefixes] arguments support cross-document and -section-specific references, like in @racket[secref]. +hyperlinks it to the definition of the key as established by +@racket[deftech]. If @racket[key] is false, the decoded content is +converted to a string (using @racket[content->string]) to use as a +key; in either case, the key is normalized in the same way as for +@racket[deftech]. The @racket[#:doc] and @racket[#:tag-prefixes] +arguments support cross-document and section-specific references, like +in @racket[secref]. With the default style files, the hyperlink created by @racket[tech] is somewhat quieter than most hyperlinks: the underline in HTML output @@ -1045,11 +1102,12 @@ defined, but a sentence uses the term ``binding,'' the latter can be linked to the former using @racketfont["@tech{bind}ing"].} @defproc[(techlink [pre-content pre-content?] ... - [#:doc module-path (or/c module-path? false/c) #f] - [#:tag-prefixes prefixes (or/c (listof string?) false/c) #f]) + [#:key key (or/c string? #f) #f] + [#:doc module-path (or/c module-path? #f) #f] + [#:tag-prefixes prefixes (or/c (listof string?) #f) #f]) element?]{ -Like @racket[tech], but the link is not a quiet. For example, in HTML +Like @racket[tech], but the link is not quiet. For example, in HTML output, a hyperlink underline appears even when the mouse is not over the link.} @@ -1122,12 +1180,12 @@ which is created with @racket[bib-entry]. The entries are typeset in order as given.} @defproc[(bib-entry [#:key key string?] - [#:title title (or/c false/c pre-content?)] + [#:title title (or/c #f pre-content?)] [#:is-book? is-book? boolean? #f] - [#:author author (or/c false/c pre-content?) #f] - [#:location location (or/c false/c pre-content?) #f] - [#:date date (or/c false/c pre-content?) #f] - [#:url url (or/c false/c pre-content?) #f]) + [#:author author (or/c #f pre-content?) #f] + [#:location location (or/c #f pre-content?) #f] + [#:date date (or/c #f pre-content?) #f] + [#:url url (or/c #f pre-content?) #f]) bib-entry?]{ Creates a bibliography entry. The @racket[key] is used to refer to the diff --git a/collects/scribblings/scribble/plt.scrbl b/collects/scribblings/scribble/plt.scrbl index 89b1a04a..2d79866b 100644 --- a/collects/scribblings/scribble/plt.scrbl +++ b/collects/scribblings/scribble/plt.scrbl @@ -16,6 +16,7 @@ relevant libraries and APIs in detail. @local-table-of-contents[] @include-section["how-to.scrbl"] +@include-section["style.scrbl"] @include-section["manual.scrbl"] @include-section["scheme.scrbl"] @include-section["eval.scrbl"] diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 90eaf36b..bf8b2465 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -12,7 +12,7 @@ file that is included with Scribble.} @defidform[preprint]{ Enables the @tt{preprint} option. Use @racket[preprint] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[preprint]: @verbatim[#:indent 2]|{ @@ -22,15 +22,59 @@ same line as @hash-lang[], with only whitespace between @defidform[10pt]{ Enables the @tt{10pt} option. Use @racket[10pt] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[10pt]: @verbatim[#:indent 2]|{ #lang scribble/sigplan @10pt }| -The @racket[10pt] and @racket[preprint] options can be -used together and may appear in any order. +@defidform[nocopyright]{ + +Enables the @tt{nocopyright} option. Use @racket[nocopyright] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[nocopyright]: + +@verbatim[#:indent 2]|{ + #lang scribble/sigplan @nocopyright +}|} + +@defidform[onecolumn]{ + +Enables the @tt{onecolumn} option. Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[onecolumn]: + +@codeblock|{ + #lang scribble/sigplan @onecolumn +}|} + + +@defidform[notimes]{ + +Disables the use of @tt{\usepackage@"{"times@"}"} in the generated LaTeX output. +Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[notimes]: + +@codeblock|{ + #lang scribble/sigplan @notimes +}|} + +@defidform[noqcourier]{ + +Disables the use of @tt{\usepackage@"{"qcourier@"}"} in the generated LaTeX output. +Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[noqcourier]: + +@codeblock|{ + #lang scribble/sigplan @noqcourier +}|} + +The @racket[10pt], @racket[preprint], @racket[nocopyright], +@racket[onecolumn], @racket[notimes], and @racket[noqcourier] +options can be used together and may appear in any order. } diff --git a/collects/scribblings/scribble/style.scrbl b/collects/scribblings/scribble/style.scrbl index ad34b399..169e7353 100644 --- a/collects/scribblings/scribble/style.scrbl +++ b/collects/scribblings/scribble/style.scrbl @@ -2,10 +2,22 @@ @(require scribble/manual scribble/eval "utils.ss" - (for-label scribble/manual)) + (for-label scribble/manual + scribble/eval)) @title[#:tag "reference-style"]{Style Guide} +Consistent style---for terms, typesetting, and prose---makes +documentation clearer. As much as possible, follow the rules listed in +this section. Many of the rules are arbitrary in the sense that a +different choice of rule could work fine, but the only way to make our +documentation consistent is to pick one of the choices. + +There are too many rules to absorb easily on a first reading. Re-read +this section after writing documentation for a library or two, and +revisit the section periodically to refresh your memory and check for +new rules. + @section{Prose and Terminology} In the descriptive body of @racket[defform], @racket[defproc], etc., @@ -24,6 +36,18 @@ or a ``symbol.'' Do not use the word ``expression'' for a form that is a definition or might be a definition; use the word ``form,'' instead. Prefer ``function'' to ``procedure.'' +Use the word ``list'' only when you mean a run-time value consisting +of the empty list and cons cells; use the word ``sequence'' in other +cases, if you must use any word. For example, do not write that +@racket[begin] has a ``list of sub-forms;'' instead, it has a +``sequence of subforms.'' Similarly, do not refer to a ``list of +arguments'' in a function call; just write ``arguments'' if possible, +or write ``sequence of argument expressions.'' (Unfortunately, +``@tech[#:doc '(lib +"scribblings/reference/reference.scrbl")]{sequence}'' has acquired a +specific run-time meaning, too, but the collision is less severe than +the historical confusion between lists and other entities in Lisp.) + Avoid cut-and-paste for descriptive text. If two functions are similar, consider documenting them together with @racket[deftogether]. To abstract a description, consider using @@ -40,7 +64,8 @@ Use @racketidfont{id} or a name that ends @racketidfont{-id} in @racketidfont{symbol}. Similarly, use @racketidfont{expr} or something that ends @racketidfont{-expr} for an expression position within a syntactic form. Use @racketidfont{body} for a form (definition or -expression) in an internal-definition position. Do not use +expression) in an internal-definition position---always followed by +@racket[...+] in a grammar description. Do not use @racketidfont{expr} for something that isn't exactly an expression, @racket[id] for something that isn't exactly an identifier, etc.; instead, use @racket[defform/subs] to define a new non-terminal. @@ -89,7 +114,7 @@ When showing example evaluations, use the REPL-snapshot style: ] }| -See also the @racket[scribble/eval] library. +See also the @racket[scribble/eval] library and @secref["examples-style"]. Use four dots, @litchar{....}, in place of omitted code, since @litchar{...} means repetition. @@ -108,6 +133,7 @@ in HTML output. Use American style for quotation marks and punctuation @; and there's no harm in doing the more logical thing of putting @; the punctuations outside quotations and parens. Just like you @; did at the end of this sentence... +@; [Matthew] See intro of this section. at the end of quotation marks (i.e., a sentence-terminating period goes inside the quotation marks). Of course, this rule does not apply for quotation marks that are part of code. @@ -130,3 +156,43 @@ the key word is primarily an executable name, use @racket[exec] instead of @racket[bold]. Optionally add further descriptive text in the title after a colon, where the text starting with the colon is not in boldface. + +@section{Indexing} + +Document and section titles, identifiers that are documented with +@racket[defproc], @racket[defform], etc. are automatically indexed, as +are terms defined with @racket[deftech]. + +Symbols are not indexed automatically. Use @racket[indexed-racket] +instead of @racket[racket] for the instance of a symbol that roughly +defines the use. For an example, try searching for ``truncate'' to +find @racket['truncate] as used with @racket[open-output-file]. Do no +use something like @racket[(index "'truncate")] to index a symbol, +because it will not typeset correctly (i.e., in a fixed-width font +with the color of a literal). + +Use @racket[index], @racket[as-index], and @racket[section-index] as a +last resort. Create index entries for terms that are completely +different from terms otherwise indexed. Do not try to index minor +variations of a term or phrase in an attempt to improve search +results; if search fails to find a word or phrase due to a minor +variation, then the search algorithm should be fixed, not the index +entry. + +@section[#:tag "examples-style"]{Examples} + +Strive to include examples (using @racket[examples]) with the +documentation of every function and syntactic form. When writing +examples, refrain from using nonsense words like ``foo'' and ``bar.'' +For example, when documenting @racket[member], resist the temptation +to write + +@interaction[ +(member "foo" '("bar" "foo" "baz")) +] + +and instead write something like + +@interaction[ +(member "Groucho" '("Harpo" "Groucho" "Zeppo")) +] diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt index 24810e10..d1f10072 100644 --- a/collects/scriblib/autobib.rkt +++ b/collects/scriblib/autobib.rkt @@ -1,5 +1,6 @@ #lang at-exp racket/base (require scribble/manual + racket/list scribble/core scribble/decode scribble/html-properties @@ -16,7 +17,7 @@ (define autobib-style-extras (let ([abs (lambda (s) (path->main-collects-relative - (build-path (collection-path "scriblib") s)))]) + (collection-file-path s "scriblib")))]) (list (make-css-addition (abs "autobib.css")) (make-tex-addition (abs "autobib.tex"))))) @@ -46,8 +47,10 @@ (define (add-inline-cite group bib-entries) (for ([i bib-entries]) (hash-set! (bib-group-ht group) i #t)) - (when (and (pair? (cdr bib-entries)) (not (apply equal? (map auto-bib-author bib-entries)))) - (error 'citet "citet must be used with identical authors, given ~a" (map auto-bib-author bib-entries))) + (when (and (pair? (cdr bib-entries)) + (not (apply equal? (map (compose author-element-names auto-bib-author) bib-entries)))) + (error 'citet "citet must be used with identical authors, given ~a" + (map (compose author-element-names auto-bib-author) bib-entries))) (make-element #f (list (add-cite group (car bib-entries) 'autobib-author #f) @@ -64,34 +67,44 @@ ")"))) (define (add-cites group bib-entries) + (define groups (for/fold ([h (hash)]) ([b (reverse bib-entries)]) + (hash-update h (author-element-names (auto-bib-author b)) + (lambda (cur) (cons b cur)) null))) (make-element #f - (list 'nbsp - "(" - (let loop ([keys bib-entries]) - (if (null? (cdr keys)) - (make-element - #f - (list - (add-cite group (car keys) 'autobib-author #f) - " " - (add-cite group (car keys) 'autobib-date #t))) - (make-element - #f - (list (loop (list (car keys))) - "; " - (loop (cdr keys)))))) - ")"))) + (append + (list 'nbsp "(") + (add-between + (for/list ([(k v) groups]) + (make-element + #f + (list* + (add-cite group (car v) 'autobib-author #f) + " " + (add-between + (for/list ([b v]) (add-cite group b 'autobib-date #t)) + ", ")))) + "; ") + (list ")")))) (define (extract-bib-key b) (author-element-names (auto-bib-author b))) +(define (extract-bib-year b) + (string->number (auto-bib-date b))) + + (define (gen-bib tag group) - (let* ([authormain-collects-relative + (collection-file-path s "scriblib")))]) (list (make-css-addition (abs "figure.css")) (make-tex-addition (abs "figure.tex"))))) diff --git a/collects/scriblib/footnote.rkt b/collects/scriblib/footnote.rkt index 0ed1403f..cc3957b5 100644 --- a/collects/scriblib/footnote.rkt +++ b/collects/scriblib/footnote.rkt @@ -5,6 +5,7 @@ scribble/html-properties scribble/latex-properties racket/promise + setup/main-collects "private/counter.ss") (provide note @@ -12,7 +13,8 @@ (define footnote-style-extras (let ([abs (lambda (s) - (build-path (collection-path "scriblib") s))]) + (path->main-collects-relative + (collection-file-path s "scriblib")))]) (list (make-css-addition (abs "footnote.css")) (make-tex-addition (abs "footnote.tex"))))) diff --git a/collects/scriblib/info.rkt b/collects/scriblib/info.rkt new file mode 100644 index 00000000..69062dd5 --- /dev/null +++ b/collects/scriblib/info.rkt @@ -0,0 +1,3 @@ +#lang setup/infotab + +(define purpose "This collect contains auxiliary scribble libraries, they have their own documentation linked from the top level.") diff --git a/collects/scriblib/scribblings/autobib.scrbl b/collects/scriblib/scribblings/autobib.scrbl index 66a7c57c..dffd1540 100644 --- a/collects/scriblib/scribblings/autobib.scrbl +++ b/collects/scriblib/scribblings/autobib.scrbl @@ -114,7 +114,7 @@ Combines elements to generate an element that is suitable for describing a technical report's location.} @defproc[(dissertation-location [#:institution institution edition any/c] - [#:number degree any/c "PhD"]) + [#:degree degree any/c "PhD"]) element?]{ Combines elements to generate an element that is suitable for diff --git a/collects/scriblib/scribblings/figure.scrbl b/collects/scriblib/scribblings/figure.scrbl index b3500aef..67c84a47 100644 --- a/collects/scriblib/scribblings/figure.scrbl +++ b/collects/scriblib/scribblings/figure.scrbl @@ -22,7 +22,7 @@ rendering support.} )]{ Creates a figure. The given @scheme[tag] is for use with -@scheme[figure-ref] or @scheme[fFgure-ref]. The @scheme[caption] is an +@scheme[figure-ref] or @scheme[Figure-ref]. The @scheme[caption] is an element. The @scheme[pre-flow] is decoded as a flow. For HTML output, the @scheme[figure*] and @scheme[figure*] functions diff --git a/collects/tests/scribble/reader.rkt b/collects/tests/scribble/reader.rkt index 53ea81e3..41997d20 100644 --- a/collects/tests/scribble/reader.rkt +++ b/collects/tests/scribble/reader.rkt @@ -91,7 +91,13 @@ fo@o -@-> fo@o --- @[foo] -@-> (foo) --- -@|{blah}| -@-> {"blah"} +@{@foo bar} -@-> (foo " bar") +--- +@|{blah}| -@-> ("blah") +--- +@|{blah|@foo bleh}| -@-> ("blah" foo " bleh") +--- +@|{|@meh blah|@foo bleh}| -@-> (meh " blah" foo " bleh") --- ;; -------------------- newlines and spaces in text --- @@ -871,7 +877,7 @@ END-OF-TESTS [(column=) syntax-column] [(position=) syntax-position] [(span=) syntax-span] - [else (error 'syntax-test "unknown test form: ~e" (car y))]) + [else (error 'syntax-test "unknown test form: ~.s" (car y))]) x) (cadr y)) (check-stx x (cddr y))] diff --git a/src/mac/cw/MrStarter.r b/src/mac/cw/MrStarter.r index 1d721814..e69de29b 100644 --- a/src/mac/cw/MrStarter.r +++ b/src/mac/cw/MrStarter.r @@ -1,196 +0,0 @@ -data 'BNDL' (128) { - $"4D72 5374 0000 0001 4652 4546 0001 0000" /* MrSt....FREF.... */ - $"0080 0001 0081 4943 4E23 0001 0000 0082" /* ....ICN#..... */ - $"0001 0000" /* .... */ -}; - -data 'cmdl' (128) { - $"2D65 2027 2864 6973 706C 6179 2022 6869" /* -e '(display "hi */ - $"2229 27" /* ")' */ -}; - -data 'ALRT' (128) { - $"0065 0054 00EF 0184 0080 5555 300A" /* .e.T...UU0 */ -}; - -data 'DITL' (128) { - $"0002 0000 0000 006C 0089 0080 00C3 0402" /* .......l..... */ - $"4F4B 0000 0000 0007 000C 0039 0122 8802" /* OK.........9.". */ - $"5E30 0000 0000 003A 000C 0064 0122 8802" /* ^0.....:...d.". */ - $"5E31" /* ^1 */ -}; - -data 'icl8' (130) { - $"0000 0000 0000 0000 0000 0000 00F5 2BF7" /* .............+ */ - $"F7F7 F500 0000 0000 0000 0000 0000 0000" /* ............. */ - $"0000 0000 0000 0000 0000 F8FB F2F1 D4EB" /* .......... */ - $"ECD3 EEAA 802B 0000 0000 0000 0000 0000" /* +.......... */ - $"0000 0000 0000 0000 56FB FAF7 F5F5 F7AB" /* ........V */ - $"D2D2 D2D2 D2D3 AAF7 0000 0000 0000 0000" /* Ӫ........ */ - $"0000 0000 0000 F688 885D 6464 F900 00F5" /* ......]dd.. */ - $"AAD2 D2D2 D2D2 D2D3 FBF5 0000 0000 0000" /* ...... */ - $"0000 0000 00F7 6B23 2323 2323 D9F7 0000" /* .....k#####.. */ - $"F7D3 D2D2 D2D2 D2D2 D2AA F600 0000 0000" /* Ҫ..... */ - $"0000 0000 F7DA 2323 2323 2323 23DB 0000" /* ....#######.. */ - $"00AA D2D2 D2D2 D2D2 D2D2 D4F6 0000 0000" /* ..... */ - $"0000 00F6 6B23 2323 2323 2323 23D8 F800" /* ...k########. */ - $"00F9 D2D2 D2D2 D2D2 D2D2 D2AB 0000 0000" /* .ҫ.... */ - $"0000 0088 2323 2323 2323 2323 2323 6400" /* ...##########d. */ - $"00F6 EED2 D2D2 D2D2 D2D2 D2D2 8000 0000" /* .Ҁ... */ - $"0000 56D8 2323 2323 2323 2323 2323 6B00" /* ..V##########k. */ - $"0000 AAD2 D2D2 D2D2 D2D2 D2D2 D32B 0000" /* ..+.. */ - $"0000 DB23 2323 2323 2323 2323 2323 472B" /* ..###########G+ */ - $"0000 F9D2 D2D2 D2D2 D2D2 D2D2 D2AA 0000" /* ..Ҫ.. */ - $"00F8 D723 2323 2323 2323 2323 2323 D7F8" /* .########### */ - $"0000 F6EE D2D2 D2D2 D2D2 D2D2 D2ED 2B00" /* ..+. */ - $"0064 2323 2323 2323 2323 2323 2323 D7F8" /* .d############ */ - $"0000 00AA D2D2 D2D2 D2D2 D2D2 D2D2 FA00" /* .... */ - $"006B 2323 2323 2323 2323 2323 2323 D9F6" /* .k############ */ - $"0000 00F8 ECD2 D2D2 D2D2 D2D2 D2D2 AA00" /* ...Ҫ. */ - $"F6D9 2323 2323 2323 2323 2323 2323 DB00" /* ############. */ - $"F600 0000 D4D2 D2D2 D2D2 D2D2 D2D2 D400" /* .... */ - $"F7D7 2323 2323 2323 2323 2323 2323 FA5D" /* ############] */ - $"DBF6 0000 FAD2 D2D2 D2D2 D2D2 D2D2 EDF6" /* .. */ - $"56D7 2323 2323 2323 2323 2323 23DA 2B6B" /* V###########+k */ - $"235D 0000 F6ED D2D2 D2D2 D2D2 D2D2 D32B" /* #]..+ */ - $"56D7 2323 2323 2323 2323 2323 235D F9D7" /* V###########] */ - $"236B F500 00AA D2D2 D2D2 D2D2 D2D2 D32B" /* #k..+ */ - $"F7D8 2323 2323 2323 2323 2323 6BF6 6423" /* ##########kd# */ - $"2323 F900 00F8 EBD2 D2D2 D2D2 D2D2 EEF5" /* ##.. */ - $"F6D9 2323 2323 2323 2323 23D7 FAF8 D823" /* ########## */ - $"2323 6400 0000 EFD2 D2D2 D2D2 D2D2 D400" /* ##d.... */ - $"006B 2323 2323 2323 2323 23DB 0064 2323" /* .k#########.d## */ - $"2323 47F7 0000 F9EB D2D2 D2D2 D2D2 AA00" /* ##G..Ҫ. */ - $"0064 2323 2323 2323 2323 D856 F6DA 2323" /* .d########V## */ - $"2323 235D 0000 00D4 D2D2 D2D2 D2D2 8000" /* ###]...Ҁ. */ - $"00F8 D823 2323 2323 2323 6400 5D23 2323" /* .#######d.]### */ - $"2323 236B F500 00F9 EBD2 D2D2 D2ED 2B00" /* ###k..+. */ - $"0000 DB23 2323 2323 2347 F7F5 6B23 2323" /* ..######Gk### */ - $"2323 23D7 5600 00F5 D4D2 D2D2 D2AB 0000" /* ###V..ҫ.. */ - $"0000 56D8 2323 2323 2388 00F9 D723 2323" /* ..V#####.### */ - $"2323 2323 6400 0000 F9EB E3E3 ED2B 0000" /* ####d...+.. */ - $"0000 0088 2323 2323 DA2B 0064 2323 2323" /* ...####+.d#### */ - $"2323 2323 D9F6 0000 F5EF E3CB E300 0000" /* ####..... */ - $"0000 00F6 6B23 2323 5D00 F7D8 2323 2323" /* ...k###].#### */ - $"2323 2323 23E3 E3E3 E3E3 E3CB CBE3 0000" /* #####.. */ - $"0000 0000 F7DA 236B F500 6423 2323 2323" /* ....#k.d##### */ - $"2323 2323 23E3 CBCB CBCB CBCB CBCB E300" /* #####. */ - $"0000 0000 00F7 DB56 00F7 D923 2323 2323" /* .....V.##### */ - $"2323 2323 23E3 CBCB CBCB CBCB CBCB CBE3" /* ##### */ - $"0000 0000 0000 F6FC 8FD9 2323 2323 2323" /* ......###### */ - $"2323 2323 23E3 CBCB CBCB CBCB CBCB E300" /* #####. */ - $"0000 0000 0000 0000 F864 4723 2323 2323" /* ........dG##### */ - $"2323 2323 23E3 E3E3 E3E3 E3CB CBE3 0000" /* #####.. */ - $"0000 0000 0000 0000 0000 F75D DBDA 47D7" /* ..........]G */ - $"D747 6B64 5D2B 0000 0000 E3CB E300 0000" /* Gkd]+....... */ - $"0000 0000 0000 0000 0000 0000 00F5 2B2B" /* .............++ */ - $"2B2B 0000 0000 0000 0000 E3E3 0000 0000" /* ++............ */ -}; - -data 'icl4' (130) { - $"0000 0000 0000 00CC CC00 0000 0000 0000" /* .............. */ - $"0000 0000 00CE FF66 6665 DC00 0000 0000" /* .....ffe..... */ - $"0000 0000 DEDC 00CE 6666 665C 0000 0000" /* .....fff\.... */ - $"0000 00CE EBBB D000 5666 6666 E000 0000" /* ....Vfff... */ - $"0000 0C33 3333 3C00 C666 6666 65C0 0000" /* ...333<.fffe.. */ - $"0000 C333 3333 3300 0566 6666 666C 0000" /* ..3333..ffffl.. */ - $"000C 3333 3333 33C0 0D66 6666 666E 0000" /* ..33333.ffffn.. */ - $"000E 3333 3333 33B0 0C66 6666 6666 D000" /* ..33333.fffff. */ - $"00D3 3333 3333 3330 0056 6666 6666 6C00" /* .333330.Vffffl. */ - $"0033 3333 3333 333C 00D6 6666 6666 6500" /* .333333<.ffffe. */ - $"0C33 3333 3333 333C 00C6 6666 6666 66C0" /* .333333<.fffff */ - $"0B33 3333 3333 333C 0005 6666 6666 66D0" /* .333333<..fffff */ - $"0333 3333 3333 333C 000C 6666 6666 6650" /* .333333<..fffffP */ - $"C333 3333 3333 3330 C000 6666 6666 6660" /* 3333330.fffff` */ - $"C333 3333 3333 33DB 3C00 D666 6666 666C" /* 333333<.ffffl */ - $"D333 3333 3333 33C3 3B00 C666 6666 666C" /* 333333;.ffffl */ - $"D333 3333 3333 3BD3 3300 0566 6666 666C" /* 33333;3..ffffl */ - $"C333 3333 3333 3CB3 33D0 0C66 6666 6660" /* 33333<3.ffff` */ - $"C333 3333 3333 DC33 33B0 0066 6666 6660" /* 3333333.ffff` */ - $"0333 3333 3333 0B33 333C 00D6 6666 6650" /* .33333.33<.fffP */ - $"0B33 3333 333D C333 333B 0006 6666 66D0" /* .3333=33;..fff */ - $"0C33 3333 33B0 B333 3333 000D 6666 66C0" /* .3333333..fff */ - $"0033 3333 33C0 3333 3333 D000 6666 6E00" /* .33333333.ffn. */ - $"00D3 3333 3E0D 3333 3333 B000 D688 6C00" /* .33>.3333.ֈl. */ - $"000E 3333 3C0B 3333 3333 3C00 0689 8000" /* ..33<.3333<... */ - $"000C 3333 B0C3 3333 3333 3888 8889 9800" /* ..3333338. */ - $"0000 C333 00B3 3333 3333 3899 9999 9980" /* ..3.33338 */ - $"0000 0C3D 0C33 3333 3333 3899 9999 9998" /* ...=.333338 */ - $"0000 00CE A333 3333 3333 3899 9999 9980" /* ...Σ333338 */ - $"0000 0000 CB33 3333 3333 3888 8889 9800" /* ....333338. */ - $"0000 0000 00CB 3333 333B BC00 0089 8000" /* .....333;... */ - $"0000 0000 0000 00CC CC00 0000 0088 0000" /* ............. */ -}; - -data 'ICN#' (130) { - $"001F F800 0075 5600 01FE AB80 0341 5540" /* ....uV...AU@ */ - $"06B8 AAA0 0D54 D550 1AAC 6AA8 3556 5554" /* ..TP.j5VUT */ - $"2AAA 2AAC 5555 3556 6AAB 1AAA D555 1555" /* **UU5Vj.U.U */ - $"AAAB 0AAB D555 0D55 AAAA 46AB D556 C555" /* «U.UFVU */ - $"AAAC A2AB D555 6355 AAA9 A1AB D55B 5155" /* UcU[QU */ - $"AAB2 B0AB 5555 58D6 6AA6 A86A 356D 547C" /* UUXjj5mT| */ - $"2ACA AC2C 1555 57E4 0A9A AC02 05B5 5401" /* *ʬ,.UWš..T. */ - $"03EA AC02 01D5 57E4 006A AB28 001F FC30" /* ...W.j(..0 */ - $"001F F800 007F FE00 01FF FF80 03FF FFC0" /* ........ */ - $"07FF FFE0 0FFF FFF0 1FFF FFF8 3FFF FFFC" /* ...? */ - $"3FFF FFFC 7FFF FFFE 7FFF FFFE FFFF FFFF" /* ?.. */ - $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* */ - $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* */ - $"FFFF FFFF 7FFF FFFE 7FFF FFFE 3FFF FFFC" /* ..? */ - $"3FFF FFFC 1FFF FFFC 0FFF FFFE 07FF FFFF" /* ?... */ - $"03FF FFFE 01FF FFFC 007F FF38 001F FC30" /* ....8..0 */ -}; - -data 'ics#' (130) { - $"07E0 1FF8 39FC 7EFE 7E7E FF7F FF3F FE3F" /* ..9~~~.?? */ - $"FC9F FDDF F9CF 7BEE 73FA 37E1 1FFA 07E4" /* {s7.. */ - $"07E0 1FF8 3FFC 7FFE 7FFE FFFF FFFF FFFF" /* ..?.. */ - $"FFFF FFFF FFFF 7FFE 7FFE 3FFF 1FFE 07E4" /* ..?.. */ -}; - -data 'ics4' (130) { - $"0000 0FFF FFF0 0000 000F F666 666F F000" /* .......ffo. */ - $"00F3 3006 6666 6F00 0F33 3330 6666 66F0" /* .0.ffo..330fff */ - $"0F33 3330 0666 66F0 F333 3333 0666 666F" /* .330.ff333.ffo */ - $"F333 3333 0066 666F F333 3330 0066 666F" /* 333.ffo330.ffo */ - $"F333 3300 3006 666F F333 3303 3306 666F" /* 33.0.fo33.3.fo */ - $"F333 3003 3300 666F 0F33 3033 3330 68F0" /* 30.3.fo.30330h */ - $"0F33 0033 3388 8980 00F3 0333 3389 9998" /* .3.33..33 */ - $"000F F333 3388 8980 0000 0FFF FFF0 0800" /* ..33..... */ -}; - -data 'ics8' (130) { - $"0000 0000 00FF FFFF FFFF FF00 0000 0000" /* .......... */ - $"0000 00FF FFD2 D2D2 D2D2 D2FF FF00 0000" /* ...... */ - $"0000 FF23 2300 00D2 D2D2 D2D2 D2FF 0000" /* ..##.... */ - $"00FF 2323 2323 2300 D2D2 D2D2 D2D2 FF00" /* .#####.. */ - $"00FF 2323 2323 2300 00D2 D2D2 D2D2 FF00" /* .#####... */ - $"FF23 2323 2323 2323 00D2 D2D2 D2D2 D2FF" /* #######. */ - $"FF23 2323 2323 2323 0000 D2D2 D2D2 D2FF" /* #######.. */ - $"FF23 2323 2323 2300 0000 D2D2 D2D2 D2FF" /* ######... */ - $"FF23 2323 2323 0000 2300 00D2 D2D2 D2FF" /* #####..#.. */ - $"FF23 2323 2323 0023 2323 00D2 D2D2 D2FF" /* #####.###. */ - $"FF23 2323 2300 0023 2323 0000 D2D2 D2FF" /* ####..###.. */ - $"00FF 2323 2300 2323 2323 2300 ECE3 FF00" /* .###.#####.. */ - $"00FF 2323 0000 2323 2323 E3E3 E3CB E300" /* .##..####. */ - $"0000 FF23 0023 2323 2323 E3CB CBCB CBE3" /* ..#.##### */ - $"0000 00FF FF23 2323 2323 E3E3 E3CB E300" /* ...#####. */ - $"0000 0000 00FF FFFF FFFF FF00 00E3 0000" /* ......... */ -}; - -data 'MrSt' (0, "Owner resource") { - $"00" /* . */ -}; - -data 'FREF' (128) { - $"4150 504C 0000 00" /* APPL... */ -}; - -data 'FREF' (129) { - $"2A2A 2A2A 0001 00" /* ****... */ -}; - -data 'SIZE' (-1) { - $"58F0 0007 A120 0007 A120" /* X.. .. */ -}; -